Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(design): add `DateRangePicker` (#1510)

白熱9f0a84204870
diff --git a/examples/package.json b/examples/package.json
index df673e582c..f40e114f4d 100644
--- a/examples/package.json
+++ b/examples/package.json
@@ -18,7 +18,7 @@
"@univerjs/engine-render": "workspace:*",
"@univerjs/facade": "workspace:*",
"@univerjs/find-replace": "workspace:*",
- "@univerjs/icons": "^0.1.39",
+ "@univerjs/icons": "^0.1.40",
"@univerjs/rpc": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-find-replace": "workspace:*",
diff --git a/packages/design/package.json b/packages/design/package.json
index d7e04bae5f..9a08ff88a6 100644
--- a/packages/design/package.json
+++ b/packages/design/package.json
@@ -71,7 +71,7 @@
"dependencies": {
"@rc-component/color-picker": "^1.5.2",
"@rc-component/trigger": "^1.18.3",
- "@univerjs/icons": "^0.1.39",
+ "@univerjs/icons": "^0.1.40",
"dayjs": ">=1.11.10",
"rc-dialog": "^9.4.0",
"rc-dropdown": "^4.1.0",
diff --git a/packages/design/src/components/date-range-picker/DateRangePicker.stories.tsx b/packages/design/src/components/date-range-picker/DateRangePicker.stories.tsx
new file mode 100644
index 0000000000..9a9583cf00
--- /dev/null
+++ b/packages/design/src/components/date-range-picker/DateRangePicker.stories.tsx
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Meta } from '@storybook/react';
+import React, { useState } from 'react';
+
+import type { Dayjs } from 'dayjs';
+import dayjs from 'dayjs';
+import type { NoUndefinedRangeValueType } from 'rc-picker/lib/PickerInput/RangePicker';
+import { DateRangePicker } from './DateRangePicker';
+
+const meta: Meta<typeof DateRangePicker> = {
+ title: 'Components / DateRangePicker',
+ component: DateRangePicker,
+ parameters: {
+ layout: 'centered',
+ },
+ tags: ['autodocs'],
+};
+
+export default meta;
+
+export const DateRangePickerBasic = {
+ render() {
+ const [value, setValue] = useState<NoUndefinedRangeValueType<Dayjs>>([dayjs(), dayjs().add(7, 'day')]);
+
+ return (
+ <>
+ <DateRangePicker value={value} onChange={setValue} />
+ </>
+ );
+ },
+};
diff --git a/packages/design/src/components/date-range-picker/DateRangePicker.tsx b/packages/design/src/components/date-range-picker/DateRangePicker.tsx
new file mode 100644
index 0000000000..a4652bce1c
--- /dev/null
+++ b/packages/design/src/components/date-range-picker/DateRangePicker.tsx
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React, { useContext } from 'react';
+import { RangePicker } from 'rc-picker';
+import generateConfig from 'rc-picker/lib/generate/dayjs';
+import { CalendarSingle, GuideSingle } from '@univerjs/icons';
+import type { Dayjs } from 'dayjs';
+import type { NoUndefinedRangeValueType } from 'rc-picker/lib/PickerInput/RangePicker';
+import { ConfigContext } from '../config-provider/ConfigProvider';
+import styles from './index.module.less';
+
+export interface IDateRangePickerProps {
+ /**
+ * The value of the date picker.
+ */
+ value: NoUndefinedRangeValueType<Dayjs>;
+
+ /**
+ * Callback when the value of the date picker changes.
+ */
+ onChange: (date: NoUndefinedRangeValueType<Dayjs>, dateString: [string, string]) => void;
+}
+
+export function DateRangePicker(props: IDateRangePickerProps) {
+ const { value, onChange } = props;
+
+ const { locale } = useContext(ConfigContext);
+
+ function handleChange(date: NoUndefinedRangeValueType<Dayjs>, dateString: [string, string]) {
+ if (Array.isArray(date) && Array.isArray(dateString)) {
+ onChange(date, dateString);
+ }
+ }
+
+ return (
+ <RangePicker<Dayjs>
+ value={value}
+ prefixCls={styles.dateRangePicker}
+ generateConfig={generateConfig}
+ locale={locale.design.Picker}
+ separator={<GuideSingle />}
+ suffixIcon={<CalendarSingle className={styles.dateRangePickerSuffixIcon} />}
+ onChange={handleChange}
+ />
+ );
+}
diff --git a/packages/design/src/components/date-range-picker/index.module.less b/packages/design/src/components/date-range-picker/index.module.less
new file mode 100644
index 0000000000..c798643092
--- /dev/null
+++ b/packages/design/src/components/date-range-picker/index.module.less
@@ -0,0 +1,691 @@
+@prefix-cls: date-range-picker;
+
+@background-color: rgb(var(--bg-color-secondary));
+
+@input-placeholder-color: hsv(0, 0, 75%);
+
+@time-panel-padding-total: 180px;
+// @time-panel-padding-top: 90px;
+@time-panel-padding-top: 0;
+
+@cell-size: 24px;
+
+.placeholder(@color: @input-placeholder-color) {
+ // Firefox
+ &::-moz-placeholder {
+ opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526
+ }
+
+ &::placeholder {
+ color: @color;
+ }
+
+ &:placeholder-shown {
+ text-overflow: ellipsis;
+ }
+}
+
+.@{prefix-cls} {
+ position: relative;
+ width: 280px;
+ height: 32px;
+ border: 1px solid rgb(var(--border-color));
+ border-radius: 4px;
+ box-sizing: border-box;
+ display: inline-flex;
+
+ &-rtl {
+ direction: rtl;
+ }
+
+ &-focused {
+ // border: 1px solid rgb(var(--primary-color));
+ }
+ &-invalid {
+ box-shadow: 0 0 2px red;
+ }
+ &-panel {
+ display: inline-block;
+ vertical-align: top;
+
+ &-focused {
+ border-color: blue;
+ }
+
+ &-rtl {
+ direction: rtl;
+ }
+ }
+
+ &-suffix-icon {
+ position: absolute;
+ top: 50%;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ align-items: center;
+ padding: 0 8px;
+ color: rgb(var(--text-color-secondary));
+ transform: translateY(-50%);
+ cursor: pointer;
+ }
+
+ // ===================== Shared Panel =====================
+ &-decade-panel,
+ &-year-panel,
+ &-month-panel,
+ &-week-panel,
+ &-date-panel,
+ &-time-panel {
+ display: flex;
+ flex-direction: column;
+
+ table {
+ text-align: center;
+ border-collapse: collapse;
+ }
+ }
+
+ // Header
+ &-header {
+ margin-bottom: var(--margin-base);
+ display: flex;
+ align-items: center;
+
+ > * {
+ flex: none;
+ }
+
+ &-view {
+ height: 16px;
+ flex: auto;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: var(--margin-xs);
+
+ > button {
+ padding: 0;
+ border: 0;
+ background-color: transparent;
+ cursor: pointer;
+ }
+ }
+
+ .btn () {
+ width: 16px;
+ height: 16px;
+ padding: 0;
+ line-height: 16px;
+ font-size: var(--font-size-lg);
+ border: none;
+ background-color: transparent;
+ cursor: pointer;
+ }
+
+ &-super {
+ &-prev,
+ &-next {
+ &-btn {
+ .btn();
+ }
+ }
+ }
+
+ &-prev,
+ &-next {
+ &-btn {
+ .btn();
+ }
+ }
+ }
+
+ // Content
+ &-cell {
+ color: #aaa;
+
+ &-disabled {
+ opacity: 0.2;
+ }
+
+ &-inner {
+ display: inline-block;
+ box-sizing: border-box;
+ width: 100%;
+ height: @cell-size;
+ margin: 0;
+ padding: 0;
+ font-size: 12px;
+ line-height: @cell-size;
+ background: transparent;
+ border: 0;
+ border-radius: var(--border-radius-base);
+ outline: none;
+ cursor: pointer;
+ transition: background 0.3s;
+ }
+
+ &-in-view {
+ color: #333;
+ }
+
+ &-in-range > &-inner {
+ background: fade(blue, 5%);
+ }
+
+ &-hover > &-inner {
+ background: rgb(var(--bg-color));
+ }
+
+ &-range-hover-start,
+ &-range-hover-end,
+ &-range-hover {
+ position: relative;
+ &::after {
+ position: absolute;
+ top: 3px;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ border: 1px solid green;
+ border-right: 0;
+ border-left: 0;
+ content: '';
+ pointer-events: none;
+ }
+ }
+
+ &-range-hover-start::after {
+ border-left: 1px solid green !important;
+ }
+ &-range-hover-end::after {
+ border-right: 1px solid green !important;
+ }
+
+ &-today > &-inner {
+ border: 1px solid rgb(var(--primary-color));
+ }
+ &-range-start > &-inner,
+ &-range-end > &-inner,
+ &-selected > &-inner {
+ // TODO:
+ // background: fade(blue, 20%);
+ color: #fff;
+ background: rgb(var(--primary-color));
+ }
+ }
+
+ // Preset
+ &-presets {
+ background: #ccccff;
+
+ ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ }
+ }
+
+ &-now {
+ padding-top: var(--padding-base);
+
+ &-btn {
+ font-size: var(--font-size-xs);
+ color: rgb(var(--primary-color));
+ cursor: pointer;
+ }
+ }
+
+ &-footer,
+ &-picker-footer {
+ margin-top: var(--margin-sm);
+ border-top: 1px solid rgb(var(--border-color));
+ }
+
+ &-ranges {
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ list-style: none;
+
+ > li {
+ text-align: center;
+ display: block;
+ }
+ }
+
+ &-ok {
+ float: right;
+ }
+
+ &-decade-panel {
+ .@{prefix-cls}-content {
+ tbody {
+ display: grid;
+ gap: 20px;
+ }
+ }
+
+ .@{prefix-cls}-cell-inner {
+ width: 78px;
+ height: 24px;
+ }
+ }
+
+ // ================== Year & Month Panel ==================
+ &-year-panel,
+ &-month-panel {
+ .@{prefix-cls}-content {
+ tbody {
+ display: grid;
+ gap: 20px;
+ }
+ }
+ .@{prefix-cls}-cell-inner {
+ width: 48px;
+ height: 24px;
+ }
+ }
+
+ // ====================== Week Panel ======================
+ &-week-panel {
+ &-row {
+ &:hover {
+ .@{prefix-cls}-cell {
+ background: red;
+ }
+ }
+
+ &-selected {
+ .@{prefix-cls}-cell {
+ background: rgba(0, 0, 255, 0.3);
+ }
+ }
+
+ &-range {
+ &-hover {
+ .@{prefix-cls}-cell {
+ background: rgba(0, 255, 0, 0.1);
+ }
+ }
+
+ &-start,
+ &-end {
+ .@{prefix-cls}-cell {
+ background: rgba(0, 255, 0, 0.3);
+ }
+ }
+ }
+ }
+
+ .@{prefix-cls}-cell,
+ .@{prefix-cls}-cell-inner {
+ width: @cell-size;
+ }
+
+ .@{prefix-cls}-cell-week {
+ color: #999;
+ font-weight: bold;
+ font-size: 12px;
+ }
+
+ .@{prefix-cls}-cell:hover > .@{prefix-cls}-cell-inner,
+ .@{prefix-cls}-cell-selected > .@{prefix-cls}-cell-inner {
+ background: transparent;
+ }
+ }
+
+ // ====================== Date Panel ======================
+ &-date-panel {
+ .@{prefix-cls}-cell-inner {
+ width: @cell-size;
+ height: @cell-size;
+ font-size: var(--font-size-xs);
+ }
+ }
+
+ // ====================== Time Panel ======================
+ &-time-panel {
+ width: auto;
+
+ .@{prefix-cls}-content {
+ position: relative;
+ display: flex;
+ max-height: 200px;
+
+ // &::after {
+ // position: absolute;
+ // top: @time-panel-padding-top;
+ // right: -5px;
+ // left: -5px;
+ // height: 20px;
+ // background: rgba(255, 0, 0, 0.05);
+ // content: '';
+ // pointer-events: none;
+ // }
+ }
+
+ // &-column-holder {
+ // display: flex;
+ // flex-direction: column;
+ // text-align: center;
+ // }
+
+ &-column-title {
+ font-size: 14px;
+ line-height: @cell-size;
+ }
+
+ &-column {
+ flex: auto;
+ width: 50px;
+ margin: 0;
+ // padding: 0 0 180px 0;
+ padding: @time-panel-padding-top 0
+ (@time-panel-padding-total - @time-panel-padding-top);
+ overflow-x: hidden;
+ overflow-y: hidden;
+ font-size: 12px;
+ text-align: left;
+ list-style: none;
+ transition: background 0.3s;
+
+ &-active {
+ background: rgba(0, 0, 255, 0.1);
+ }
+
+ &:hover {
+ overflow-y: auto;
+ }
+
+ > li {
+ width: 50px;
+ margin: 0;
+ padding: 0;
+ cursor: pointer;
+
+ &.@{prefix-cls}-time-panel-cell {
+ &-disabled {
+ opacity: 0.5;
+ }
+
+ &-selected {
+ background: rgba(0, 0, 255, 0.5);
+ }
+ }
+
+ .@{prefix-cls}-time-panel-cell-inner {
+ display: block;
+ width: 100%;
+ height: @cell-size;
+ margin: 0;
+ // padding: 0 0 0 12px;
+ color: #333;
+ line-height: @cell-size;
+ text-align: center;
+
+ .@{prefix-cls}-panel-rtl & {
+ padding: 0 12px 0 0;
+ text-align: right;
+ }
+ }
+ }
+ }
+ }
+
+ // ====================== Date Time =======================
+ &-datetime-panel {
+ display: flex;
+
+ .@{prefix-cls}-time-panel {
+ border-left: 1px solid #999;
+ }
+
+ .@{prefix-cls}-date-panel,
+ .@{prefix-cls}-time-panel {
+ transition: opacity 0.3s;
+ }
+
+ // Keyboard
+ &-active {
+ .@{prefix-cls}-date-panel,
+ .@{prefix-cls}-time-panel {
+ opacity: 0.3;
+
+ &-active {
+ opacity: 1;
+ }
+ }
+ }
+ }
+
+ // ======================== Input =========================
+ &-input {
+ position: relative;
+ display: inline-flex;
+ width: 100%;
+
+ .@{prefix-cls}-rtl & {
+ text-align: right;
+ }
+
+ &-active {
+ > input {
+ background: rgba(0, 0, 255, 0.05);
+ }
+ }
+
+ > input {
+ width: 100%;
+ padding-left: 12px;
+ border: none;
+ border-radius: var(--border-radius-base);
+ box-sizing: border-box;
+ .placeholder();
+ &:focus {
+ outline: none;
+ }
+ }
+
+ &-placeholder {
+ > input {
+ color: @input-placeholder-color;
+ }
+ }
+ }
+
+ &-clear {
+ position: absolute;
+ top: 7px;
+ right: 8px;
+ cursor: pointer;
+
+ .@{prefix-cls}-rtl & {
+ right: auto;
+ left: 4px;
+ }
+
+ &-btn {
+ width: 16px;
+ height: 16px;
+ text-align: center;
+ line-height: 16px;
+ background-color: rgb(var(--grey-500));
+ border-radius: 50%;
+ display: block;
+
+ &::before {
+ content: '×';
+ position: absolute;
+ top: -1px;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ color: white;
+ font-size: 16px;
+ line-height: 16px;
+ }
+ }
+ }
+
+ // ======================= Dropdown =======================
+ &-dropdown {
+ position: absolute;
+ pointer-events: none;
+
+ &-range {
+ padding: 10px 0;
+ }
+
+ &-hidden {
+ display: none;
+ }
+
+ // Panel
+ @arrow-size: 10px;
+
+ &-placement-topLeft,
+ &-placement-topRight {
+ .@{prefix-cls}-range-arrow {
+ bottom: @arrow-size / 2 + 1px;
+ transform: rotate(135deg);
+ }
+ }
+ &-placement-bottomLeft,
+ &-placement-bottomright {
+ .@{prefix-cls}-range-arrow {
+ top: (@arrow-size / 2 + 1px);
+ transform: rotate(-45deg);
+ }
+ }
+
+ .@{prefix-cls}-range-arrow {
+ position: absolute;
+ left: @arrow-size;
+ z-index: 1;
+ width: @arrow-size;
+ height: @arrow-size;
+ margin-left: 10px;
+ transition: all 0.3s;
+
+ .@{prefix-cls}-dropdown-rtl& {
+ right: @arrow-size;
+ left: auto;
+ margin-right: 10px;
+ margin-left: 0;
+ }
+
+ &::before,
+ &::after {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ box-sizing: border-box;
+ transform: translate(-50%, -50%);
+ content: '';
+
+ .@{prefix-cls}-dropdown-rtl& {
+ right: 50%;
+ left: auto;
+ transform: translate(50%, -50%);
+ }
+ }
+
+ &::before {
+ width: @arrow-size;
+ height: @arrow-size;
+ border: (@arrow-size / 2) solid blue;
+ border-color: blue blue transparent transparent;
+ }
+ &::after {
+ width: @arrow-size - 2px;
+ height: @arrow-size - 2px;
+ border: (@arrow-size - 2px) / 2 solid blue;
+ border-color: @background-color @background-color transparent
+ transparent;
+ }
+ }
+ }
+
+ // ========================================================
+ // = Range Picker =
+ // ========================================================
+ &-range {
+ position: relative;
+ display: inline-flex;
+
+ &-wrapper {
+ display: flex;
+ }
+
+ .@{prefix-cls}-active-bar {
+ bottom: 0;
+ height: 3px;
+ background: rgb(var(--primary-color));
+ opacity: 0;
+ transition: all 0.3s;
+ pointer-events: none;
+ }
+
+ &.@{prefix-cls}-focused {
+ .@{prefix-cls}-active-bar {
+ opacity: 1;
+ }
+ }
+
+ &-separator {
+ height: 100%;
+ color: rgb(var(--text-color-tertiary));
+ display: inline-flex;
+ align-items: center;
+ }
+ }
+
+ &-panel-container {
+ display: inline-block;
+ vertical-align: top;
+ transition: margin 0.3s;
+ pointer-events: all;
+ }
+
+ &-panel-layout {
+ padding: var(--padding-lg);
+ background: rgb(var(--bg-color-secondary));
+ border: 1px solid rgb(var(--border-color));
+ border-radius: var(--border-radius-lg);
+ box-shadow: var(--box-shadow-base);
+ display: flex;
+ flex-wrap: nowrap;
+ align-items: stretch;
+ overflow: hidden;
+ }
+
+ // ========================================================
+ // = Overflow =
+ // ========================================================
+ &-selector {
+ width: 100%;
+ }
+
+ &-selection-overflow {
+ display: flex;
+ flex-wrap: wrap;
+ box-sizing: border-box;
+ width: 100%;
+ border: 1px solid green;
+
+ &-item {
+ flex: none;
+ max-width: 100%;
+ }
+ }
+
+ &-selection-item {
+ border: 1px solid blue;
+ }
+
+ &-multiple-input {
+ width: 10px;
+ opacity: 0.1;
+ }
+}
diff --git a/packages/design/src/components/date-range-picker/index.ts b/packages/design/src/components/date-range-picker/index.ts
new file mode 100644
index 0000000000..50c775a966
--- /dev/null
+++ b/packages/design/src/components/date-range-picker/index.ts
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { DateRangePicker, type IDateRangePickerProps } from './DateRangePicker';
diff --git a/packages/find-replace/package.json b/packages/find-replace/package.json
index 0a997c91ce..f7a0dc9fee 100644
--- a/packages/find-replace/package.json
+++ b/packages/find-replace/package.json
@@ -63,14 +63,14 @@
"peerDependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/design": "workspace:*",
- "@univerjs/icons": "^0.1.39",
+ "@univerjs/icons": "^0.1.40",
"@univerjs/ui": "workspace:*",
"@wendellhu/redi": "^0.13.0",
"react": "^18.2.0",
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.39"
+ "@univerjs/icons": "^0.1.40"
},
"devDependencies": {
"@types/react": "^18.2.63",
diff --git a/packages/sheets-formula/package.json b/packages/sheets-formula/package.json
index 74a2666a0b..417ad91e52 100644
--- a/packages/sheets-formula/package.json
+++ b/packages/sheets-formula/package.json
@@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.39"
+ "@univerjs/icons": "^0.1.40"
},
"devDependencies": {
"@types/react": "^18.2.63",
diff --git a/packages/sheets-numfmt/package.json b/packages/sheets-numfmt/package.json
index b2c028cb8e..ce48494b6b 100644
--- a/packages/sheets-numfmt/package.json
+++ b/packages/sheets-numfmt/package.json
@@ -77,7 +77,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.39"
+ "@univerjs/icons": "^0.1.40"
},
"devDependencies": {
"@types/react": "^18.2.63",
diff --git a/packages/sheets-ui/package.json b/packages/sheets-ui/package.json
index 418d092166..f4903a7ccf 100644
--- a/packages/sheets-ui/package.json
+++ b/packages/sheets-ui/package.json
@@ -78,7 +78,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.39"
+ "@univerjs/icons": "^0.1.40"
},
"devDependencies": {
"@types/react": "^18.2.63",
diff --git a/packages/sheets-zen-editor/package.json b/packages/sheets-zen-editor/package.json
index 8bbce6939c..fa7f8b8811 100644
--- a/packages/sheets-zen-editor/package.json
+++ b/packages/sheets-zen-editor/package.json
@@ -73,7 +73,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.39"
+ "@univerjs/icons": "^0.1.40"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
diff --git a/packages/ui/package.json b/packages/ui/package.json
index bd0ddfc830..7a164204c6 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -74,7 +74,7 @@
"rxjs": ">=7.0.0"
},
"dependencies": {
- "@univerjs/icons": "^0.1.39",
+ "@univerjs/icons": "^0.1.40",
"localforage": "^1.10.0",
"rc-notification": "^5.3.0",
"rc-util": "^5.38.2"
diff --git a/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx b/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx
index c8e840388f..037ddff735 100644
--- a/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx
+++ b/packages/ui/src/views/components/doc-bars/ToolbarItem.tsx
@@ -210,7 +210,24 @@ export const ToolbarItem = forwardRef((props: IDisplayMenuItem<IMenuItem>, ref:
</div>
</Dropdown>
)
- : <></>;
+ : (
+ <div className={`${styles.toolbarItemSelect} ${disabled ? styles.toolbarItemSelectDisabled : ''}`}>
+ <CustomLabel
+ icon={iconToDisplay}
+ title={title!}
+ value={value}
+ label={label}
+ onChange={handleChange}
+ />
+ <div
+ className={`${styles.toolbarItemSelectArrow} ${
+ disabled ? styles.toolbarItemSelectArrowDisabled : ''
+ }`}
+ >
+ <MoreDownSingle />
+ </div>
+ </div>
+ );
}
function renderButtonType() {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 23ae813ccb..e00c0f355d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -205,8 +205,8 @@ importers:
specifier: workspace:*
version: link:../packages/find-replace
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
'@univerjs/rpc':
specifier: workspace:*
version: link:../packages/rpc
@@ -342,8 +342,8 @@ importers:
specifier: ^1.18.3
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
dayjs:
specifier: '>=1.11.10'
version: 1.11.10
@@ -631,8 +631,8 @@ importers:
packages/find-replace:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
devDependencies:
'@types/react':
specifier: ^18.2.63
@@ -785,8 +785,8 @@ importers:
packages/sheets-formula:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
devDependencies:
'@types/react':
specifier: ^18.2.63
@@ -849,8 +849,8 @@ importers:
packages/sheets-numfmt:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
devDependencies:
'@types/react':
specifier: ^18.2.63
@@ -907,8 +907,8 @@ importers:
packages/sheets-ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
devDependencies:
'@types/react':
specifier: ^18.2.63
@@ -968,8 +968,8 @@ importers:
packages/sheets-zen-editor:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
devDependencies:
'@univerjs/core':
specifier: workspace:*
@@ -1093,8 +1093,8 @@ importers:
packages/ui:
dependencies:
'@univerjs/icons':
- specifier: ^0.1.39
+ specifier: ^0.1.40
localforage:
specifier: ^1.10.0
version: 1.10.0
@@ -2816,7 +2816,6 @@ packages:
cpu: [ppc64]
os: [aix]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -2841,7 +2840,6 @@ packages:
cpu: [arm64]
os: [android]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -2866,7 +2864,6 @@ packages:
cpu: [arm]
os: [android]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -2891,7 +2888,6 @@ packages:
cpu: [x64]
os: [android]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -2916,7 +2912,6 @@ packages:
cpu: [arm64]
os: [darwin]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -2941,7 +2936,6 @@ packages:
cpu: [x64]
os: [darwin]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -2966,7 +2960,6 @@ packages:
cpu: [arm64]
os: [freebsd]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -2991,7 +2984,6 @@ packages:
cpu: [x64]
os: [freebsd]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3016,7 +3008,6 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3041,7 +3032,6 @@ packages:
cpu: [arm]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3066,7 +3056,6 @@ packages:
cpu: [ia32]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3100,7 +3089,6 @@ packages:
cpu: [loong64]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3125,7 +3113,6 @@ packages:
cpu: [mips64el]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3150,7 +3137,6 @@ packages:
cpu: [ppc64]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3175,7 +3161,6 @@ packages:
cpu: [riscv64]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3200,7 +3185,6 @@ packages:
cpu: [s390x]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3225,7 +3209,6 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3250,7 +3233,6 @@ packages:
cpu: [x64]
os: [netbsd]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3275,7 +3257,6 @@ packages:
cpu: [x64]
os: [openbsd]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3300,7 +3281,6 @@ packages:
cpu: [x64]
os: [sunos]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3325,7 +3305,6 @@ packages:
cpu: [arm64]
os: [win32]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3350,7 +3329,6 @@ packages:
cpu: [ia32]
os: [win32]
requiresBuild: true
- dev: true
optional: true
/@esbuild/[email protected]:
@@ -3375,7 +3353,6 @@ packages:
cpu: [x64]
os: [win32]
requiresBuild: true
- dev: true
optional: true
@@ -4175,7 +4152,7 @@ packages:
resolution: {integrity: sha512-5HGgegON/aBu/tDM3IFyEAZfaMmG98Y0OI48kkkc9EipfQRMIrYFizbCjV7388H98wM81TqTEqvzxYpFkPSphg==}
engines: {node: '>=18'}
dependencies:
- '@storybook/core-common': 8.0.0-rc.2
+ '@storybook/core-common': 8.0.0-rc.3
'@swc/core': 1.4.2
swc-loader: 0.2.6(@swc/[email protected])([email protected])
transitivePeerDependencies:
@@ -4324,13 +4301,12 @@ packages:
telejson: 7.2.0
tiny-invariant: 1.3.1
- /@storybook/[email protected]:
- resolution: {integrity: sha512-Gb7lVLKPHpdCGNMvAF4Zrr5QNrjlRgDXTC1AxjfJtJcZw4BsCfmLiPbQVltCrIFHgtPbxXB20gCCtYcE4M6k7Q==}
+ /@storybook/[email protected]:
+ resolution: {integrity: sha512-XGTHjZ4ovCS3i9ocjBMrEAnwQ16SXSXX9i+K+5o0p9NSHSWvwd2rtjtInSCDnBvJHWS+typVYkfwpcwcJkbP2g==}
dependencies:
- '@storybook/client-logger': 8.0.0-rc.2
- '@storybook/core-events': 8.0.0-rc.2
+ '@storybook/client-logger': 8.0.0-rc.3
+ '@storybook/core-events': 8.0.0-rc.3
'@storybook/global': 5.0.0
- qs: 6.11.2
telejson: 7.2.0
tiny-invariant: 1.3.3
dev: false
@@ -4396,8 +4372,8 @@ packages:
dependencies:
'@storybook/global': 5.0.0
- /@storybook/[email protected]:
- resolution: {integrity: sha512-T5HhSJUDnOKhpgPiogCEGvW9KATVWfKDBlDbh0/MBmVBR0tqGpFVLefGAM7wmRoVg3MVIeQRRtzMv02PYFxJDg==}
+ /@storybook/[email protected]:
+ resolution: {integrity: sha512-Bx4IFbpiCwyGXnCwbYW+bYIMAQzZrF9gQniEt5yDF7P5vGw4GcI7+Q6GCj+PIzlJDSt77dHvrHgTptIXbPNBHw==}
dependencies:
'@storybook/global': 5.0.0
dev: false
@@ -4480,19 +4456,19 @@ packages:
- encoding
- supports-color
- /@storybook/[email protected]:
- resolution: {integrity: sha512-31B/kUzpH/TP3yVmv3g5UlnuJ0rR7dBPIB5qaKsDx/ygpG9sm4xhXFHGZWU8Nqshu2MREuPQYI2UPELF+luUug==}
+ /@storybook/[email protected]:
+ resolution: {integrity: sha512-rv0Yx07iI3eckCdYShdMtLIg7KdL5JsFuEggVelHW61fvirm+ekWhXVu4EHKbUZPlntf+EdQryW0xYDJwNkEEQ==}
dependencies:
- '@storybook/core-events': 8.0.0-rc.2
- '@storybook/csf-tools': 8.0.0-rc.2
- '@storybook/node-logger': 8.0.0-rc.2
- '@storybook/types': 8.0.0-rc.2
+ '@storybook/core-events': 8.0.0-rc.3
+ '@storybook/csf-tools': 8.0.0-rc.3
+ '@storybook/node-logger': 8.0.0-rc.3
+ '@storybook/types': 8.0.0-rc.3
'@yarnpkg/fslib': 2.10.3
'@yarnpkg/libzip': 2.3.0
chalk: 4.1.2
cross-spawn: 7.0.3
- esbuild: 0.18.20
- esbuild-register: 3.5.0([email protected])
+ esbuild: 0.20.1
+ esbuild-register: 3.5.0([email protected])
execa: 5.1.1
file-system-cache: 2.3.0
find-cache-dir: 3.3.2
@@ -4527,8 +4503,8 @@ packages:
dependencies:
ts-dedent: 2.2.0
- /@storybook/[email protected]:
- resolution: {integrity: sha512-SQ/vcAbRJCuywQDiBsKZDXRbqbTEcQQlDOdzoDtV9jjfPhcIShB4BMhUmoTkR5OJAImHmTYm5gOXvYMXo97IEQ==}
+ /@storybook/[email protected]:
+ resolution: {integrity: sha512-W2hoe8hRA4RM7YVQoaSW6qbUCTlx/HfzQXqVTT78A/w5Th+GLzAvu6yX8E+fbPJotTNzK81yp9Uf1C4g2cveyg==}
dependencies:
ts-dedent: 2.2.0
dev: false
@@ -4625,15 +4601,15 @@ packages:
transitivePeerDependencies:
- supports-color
- /@storybook/[email protected]:
- resolution: {integrity: sha512-IwYQEwXvm3P1DzDPzxhcqQ+xcoLj6DGfgQaHLeIrmmUtpVEA8am5mAgqfKUqd55RuaBYFh78qfTLMEL3dJBSBw==}
+ /@storybook/[email protected]:
+ resolution: {integrity: sha512-4Z0wTok3IEtMxzhM+29TajUjTk3Y4UFNDgotgsJ4He7nJ6HUu73zea9HxI238MDM9zd92KZ17FLNIvyhUWpDUg==}
dependencies:
'@babel/generator': 7.23.6
'@babel/parser': 7.23.9
'@babel/traverse': 7.23.9
'@babel/types': 7.23.9
'@storybook/csf': 0.1.2
- '@storybook/types': 8.0.0-rc.2
+ '@storybook/types': 8.0.0-rc.3
fs-extra: 11.2.0
recast: 0.23.5
ts-dedent: 2.2.0
@@ -4711,8 +4687,8 @@ packages:
/@storybook/[email protected]:
resolution: {integrity: sha512-WFIK9NRclmSepPsTmVOcxzVGv/yyjAckiL3Z/iV2idwP4Qj/TT/FGFGAPs7oGSiQfgP80FMifDFN6tcZ0awpYQ==}
- /@storybook/[email protected]:
- resolution: {integrity: sha512-jL2bF9BkD9kNELlt5zW1fTB6OI3Ue47ob8j6AtgeB32FW1idheycRzzGCNgZTVBhcKsdSIIg5D49cTadpjJHbQ==}
+ /@storybook/[email protected]:
+ resolution: {integrity: sha512-8VkQSMdU9/NwqQWRibG6hlI/MIq3qJ+qMx4TekTHvPXjJbbW+tRvGsFbyqQSFonZmg25XgUIp2wLc46CS/CEvw==}
dev: false
@@ -4927,10 +4903,10 @@ packages:
'@types/express': 4.17.21
file-system-cache: 2.3.0
- /@storybook/[email protected]:
- resolution: {integrity: sha512-xzj7l/54hPMLLxT3CyBJhCNSpfPNpyxsStNEb9zTSZXTu4xxRTPy09oJ1psSpJeMcG71bTAo6ElPxMVvBENP4w==}
+ /@storybook/[email protected]:
+ resolution: {integrity: sha512-rV6Vj84WcD+Xea9c0LdVTAzRvDWHTFIbDiT4R4+yNppy9q5NZGTiWprdGNtOiDVCGsT6kpvafBzKYXPtLiCJ+Q==}
dependencies:
- '@storybook/channels': 8.0.0-rc.2
+ '@storybook/channels': 8.0.0-rc.3
'@types/express': 4.17.21
file-system-cache: 2.3.0
dev: false
@@ -5666,8 +5642,8 @@ packages:
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
- resolution: {integrity: sha512-LlvMLjF18VM1KKLybMpCEnetnyvQgb5ZvJA0HeWRnTNO8HFXlEpCJmXpAIajNGL+PjtZU4LTj3tMf/2C6prn/w==}
+ resolution: {integrity: sha512-XsMlxOmTYAyV3H2RHZTJieLRTkO76/X/QgcjL9n0XrWOuIyCkGAOsyTIMtqOMOvQdd0TwYqX8ZBPwxwNvhLqrw==}
peerDependencies:
react: '*'
react-dom: '*'
@@ -8013,6 +7989,17 @@ packages:
transitivePeerDependencies:
- supports-color
+ resolution: {integrity: sha512-+4G/XmakeBAsvJuDugJvtyF1x+XJT4FMocynNpxrvEBViirpfUn2PgNpCHedfWhF4WokNsO/OvMKrmJOIJsI5A==}
+ peerDependencies:
+ esbuild: '>=0.12 <1'
+ dependencies:
+ debug: 4.3.4
+ esbuild: 0.20.1
+ transitivePeerDependencies:
+ - supports-color
+ dev: false
+
resolution: {integrity: sha512-XPEKf4FjLjEVLv/dJH4UxDzXCrFHYpD93DBO8B+izdZARW5b7nNKQbnKv3J+7VDWJbgCU+hzfgIh2AuIZzlmXQ==}
dependencies:
@@ -8177,7 +8164,6 @@ packages:
'@esbuild/win32-arm64': 0.20.1
'@esbuild/win32-ia32': 0.20.1
'@esbuild/win32-x64': 0.20.1
- dev: true
resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==}