@univerjs/sheets-table-ui 0.21.1 → 0.22.0-insiders.20260513-09bbeca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -10
- package/lib/cjs/index.js +27 -62
- package/lib/es/index.js +27 -62
- package/lib/index.js +27 -62
- package/lib/umd/index.js +1 -1
- package/package.json +20 -18
- package/LICENSE +0 -176
package/README.md
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
# @univerjs/sheets-table-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://npmjs.com/package/@univerjs/sheets-table-ui)
|
|
4
|
+
[](https://npmjs.com/package/@univerjs/sheets-table-ui)
|
|
5
|
+
[](https://npmjs.com/package/@univerjs/sheets-table-ui)
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
`@univerjs/sheets-table-ui` adds table UI interactions for Univer Sheets, including menus and controls for table-related workflows.
|
|
8
|
+
|
|
9
|
+
## Package Overview
|
|
10
|
+
|
|
11
|
+
| Package | UMD global | CSS | Locales | Facade entry |
|
|
12
|
+
| --- | --- | :---: | :---: | :---: |
|
|
13
|
+
| `@univerjs/sheets-table-ui` | `UniverSheetsTableUi` | Yes | Yes | No |
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pnpm add @univerjs/sheets-table-ui
|
|
19
|
+
# or
|
|
20
|
+
npm install @univerjs/sheets-table-ui
|
|
7
21
|
```
|
|
8
22
|
|
|
9
|
-
|
|
23
|
+
Keep all `@univerjs/*` packages on the same version.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
10
26
|
|
|
11
27
|
```ts
|
|
12
|
-
import
|
|
28
|
+
import '@univerjs/sheets-table-ui/lib/index.css';
|
|
29
|
+
import EnUS from '@univerjs/sheets-table-ui/locale/en-US';
|
|
30
|
+
import { UniverSheetsTableUIPlugin } from '@univerjs/sheets-table-ui';
|
|
13
31
|
|
|
14
32
|
univer.registerPlugin(UniverSheetsTableUIPlugin);
|
|
33
|
+
|
|
34
|
+
// Merge EnUS into your Univer locale map when this package contributes UI text.
|
|
15
35
|
```
|
|
16
36
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
37
|
+
## Resources
|
|
38
|
+
|
|
39
|
+
- [Documentation](https://docs.univer.ai)
|
|
40
|
+
- [NPM package](https://npmjs.com/package/@univerjs/sheets-table-ui)
|
|
41
|
+
- [GitHub repository](https://github.com/dream-num/univer)
|
|
42
|
+
|
package/lib/cjs/index.js
CHANGED
|
@@ -16,7 +16,7 @@ let _univerjs_sheets_formula_ui = require("@univerjs/sheets-formula-ui");
|
|
|
16
16
|
|
|
17
17
|
//#region package.json
|
|
18
18
|
var name = "@univerjs/sheets-table-ui";
|
|
19
|
-
var version = "0.
|
|
19
|
+
var version = "0.22.0-insiders.20260513-09bbeca";
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/const.ts
|
|
@@ -49,30 +49,7 @@ const TABLE_BORDER_NONE = "none";
|
|
|
49
49
|
const TABLE_BORDER_DEFAULT = "1px solid rgb(var(--grey-200))";
|
|
50
50
|
|
|
51
51
|
//#endregion
|
|
52
|
-
//#region
|
|
53
|
-
/**
|
|
54
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
55
|
-
*
|
|
56
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
57
|
-
* you may not use this file except in compliance with the License.
|
|
58
|
-
* You may obtain a copy of the License at
|
|
59
|
-
*
|
|
60
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
61
|
-
*
|
|
62
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
63
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
64
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
65
|
-
* See the License for the specific language governing permissions and
|
|
66
|
-
* limitations under the License.
|
|
67
|
-
*/
|
|
68
|
-
let FilterByEnum = /* @__PURE__ */ function(FilterByEnum) {
|
|
69
|
-
FilterByEnum["Items"] = "items";
|
|
70
|
-
FilterByEnum["Condition"] = "condition";
|
|
71
|
-
return FilterByEnum;
|
|
72
|
-
}({});
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
|
|
52
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
76
53
|
function _typeof(o) {
|
|
77
54
|
"@babel/helpers - typeof";
|
|
78
55
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -83,7 +60,7 @@ function _typeof(o) {
|
|
|
83
60
|
}
|
|
84
61
|
|
|
85
62
|
//#endregion
|
|
86
|
-
//#region \0@oxc-project+runtime@0.
|
|
63
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
87
64
|
function toPrimitive(t, r) {
|
|
88
65
|
if ("object" != _typeof(t) || !t) return t;
|
|
89
66
|
var e = t[Symbol.toPrimitive];
|
|
@@ -96,14 +73,14 @@ function toPrimitive(t, r) {
|
|
|
96
73
|
}
|
|
97
74
|
|
|
98
75
|
//#endregion
|
|
99
|
-
//#region \0@oxc-project+runtime@0.
|
|
76
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
100
77
|
function toPropertyKey(t) {
|
|
101
78
|
var i = toPrimitive(t, "string");
|
|
102
79
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
103
80
|
}
|
|
104
81
|
|
|
105
82
|
//#endregion
|
|
106
|
-
//#region \0@oxc-project+runtime@0.
|
|
83
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
107
84
|
function _defineProperty(e, r, t) {
|
|
108
85
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
109
86
|
value: t,
|
|
@@ -114,7 +91,7 @@ function _defineProperty(e, r, t) {
|
|
|
114
91
|
}
|
|
115
92
|
|
|
116
93
|
//#endregion
|
|
117
|
-
//#region \0@oxc-project+runtime@0.
|
|
94
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
118
95
|
function __decorateParam(paramIndex, decorator) {
|
|
119
96
|
return function(target, key) {
|
|
120
97
|
decorator(target, key, paramIndex);
|
|
@@ -122,7 +99,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
122
99
|
}
|
|
123
100
|
|
|
124
101
|
//#endregion
|
|
125
|
-
//#region \0@oxc-project+runtime@0.
|
|
102
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
126
103
|
function __decorate(decorators, target, key, desc) {
|
|
127
104
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
128
105
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -180,7 +157,7 @@ let SheetsTableUiService = class SheetsTableUiService extends _univerjs_core.Dis
|
|
|
180
157
|
unitId,
|
|
181
158
|
subUnitId,
|
|
182
159
|
tableFilter,
|
|
183
|
-
currentFilterBy: (0, _univerjs_sheets_table.isConditionFilter)(tableFilter) ?
|
|
160
|
+
currentFilterBy: (0, _univerjs_sheets_table.isConditionFilter)(tableFilter) ? "condition" : "items",
|
|
184
161
|
tableId,
|
|
185
162
|
columnIndex: column - tableRange.startColumn
|
|
186
163
|
};
|
|
@@ -260,18 +237,6 @@ SheetsTableUiService = __decorate([
|
|
|
260
237
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
|
|
261
238
|
], SheetsTableUiService);
|
|
262
239
|
|
|
263
|
-
//#endregion
|
|
264
|
-
//#region src/views/components/type.ts
|
|
265
|
-
let ConditionSubComponentEnum = /* @__PURE__ */ function(ConditionSubComponentEnum) {
|
|
266
|
-
ConditionSubComponentEnum["DatePicker"] = "DatePicker";
|
|
267
|
-
ConditionSubComponentEnum["DateRange"] = "DateRange";
|
|
268
|
-
ConditionSubComponentEnum["Input"] = "Input";
|
|
269
|
-
ConditionSubComponentEnum["Inputs"] = "Inputs";
|
|
270
|
-
ConditionSubComponentEnum["Select"] = "Select";
|
|
271
|
-
ConditionSubComponentEnum["None"] = "None";
|
|
272
|
-
return ConditionSubComponentEnum;
|
|
273
|
-
}({});
|
|
274
|
-
|
|
275
240
|
//#endregion
|
|
276
241
|
//#region src/views/components/util.ts
|
|
277
242
|
function getCascaderListOptions(injector) {
|
|
@@ -533,17 +498,17 @@ const datePickerSet = new Set([
|
|
|
533
498
|
_univerjs_sheets_table.TableDateCompareTypeEnum.BeforeOrEqual
|
|
534
499
|
]);
|
|
535
500
|
function getSubComponentType(type, compare) {
|
|
536
|
-
if (!compare) return
|
|
537
|
-
if (type === _univerjs_sheets_table.TableConditionTypeEnum.String) return
|
|
538
|
-
else if (type === _univerjs_sheets_table.TableConditionTypeEnum.Number) if (compare === _univerjs_sheets_table.TableNumberCompareTypeEnum.Between || compare === _univerjs_sheets_table.TableNumberCompareTypeEnum.NotBetween) return
|
|
539
|
-
else return
|
|
501
|
+
if (!compare) return "None";
|
|
502
|
+
if (type === _univerjs_sheets_table.TableConditionTypeEnum.String) return "Input";
|
|
503
|
+
else if (type === _univerjs_sheets_table.TableConditionTypeEnum.Number) if (compare === _univerjs_sheets_table.TableNumberCompareTypeEnum.Between || compare === _univerjs_sheets_table.TableNumberCompareTypeEnum.NotBetween) return "Inputs";
|
|
504
|
+
else return "Input";
|
|
540
505
|
else if (type === _univerjs_sheets_table.TableConditionTypeEnum.Date) {
|
|
541
|
-
if (compare === _univerjs_sheets_table.TableDateCompareTypeEnum.Between || compare === _univerjs_sheets_table.TableDateCompareTypeEnum.NotBetween) return
|
|
542
|
-
else if (compare === _univerjs_sheets_table.TableDateCompareTypeEnum.Quarter || compare === _univerjs_sheets_table.TableDateCompareTypeEnum.Month) return
|
|
543
|
-
else if (datePickerSet.has(compare)) return
|
|
544
|
-
return
|
|
506
|
+
if (compare === _univerjs_sheets_table.TableDateCompareTypeEnum.Between || compare === _univerjs_sheets_table.TableDateCompareTypeEnum.NotBetween) return "DateRange";
|
|
507
|
+
else if (compare === _univerjs_sheets_table.TableDateCompareTypeEnum.Quarter || compare === _univerjs_sheets_table.TableDateCompareTypeEnum.Month) return "Select";
|
|
508
|
+
else if (datePickerSet.has(compare)) return "DatePicker";
|
|
509
|
+
return "None";
|
|
545
510
|
}
|
|
546
|
-
return
|
|
511
|
+
return "None";
|
|
547
512
|
}
|
|
548
513
|
function getInitConditionInfo(tableFilter) {
|
|
549
514
|
if (!tableFilter || tableFilter.filterType !== "condition") return {
|
|
@@ -667,7 +632,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
667
632
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
668
633
|
className: "univer-mt-3 univer-w-full",
|
|
669
634
|
children: [
|
|
670
|
-
subComponentType ===
|
|
635
|
+
subComponentType === "Input" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: conditionInfo.type === _univerjs_sheets_table.TableConditionTypeEnum.String ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
671
636
|
className: "univer-w-full",
|
|
672
637
|
placeholder: "请输入",
|
|
673
638
|
value: conditionInfo.info.string,
|
|
@@ -680,7 +645,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
680
645
|
if (v !== null) handleConditionInfo({ number: v });
|
|
681
646
|
}
|
|
682
647
|
}) }),
|
|
683
|
-
!!(subComponentType ===
|
|
648
|
+
!!(subComponentType === "DatePicker") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
684
649
|
id: "univer-table-date-picker-wrapper",
|
|
685
650
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DatePicker, {
|
|
686
651
|
className: "univer-w-full",
|
|
@@ -688,7 +653,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
688
653
|
onValueChange: (v) => handleConditionInfo({ date: v })
|
|
689
654
|
})
|
|
690
655
|
}),
|
|
691
|
-
!!(subComponentType ===
|
|
656
|
+
!!(subComponentType === "DateRange") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
692
657
|
id: "univer-table-date-range-wrapper",
|
|
693
658
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DateRangePicker, {
|
|
694
659
|
className: "univer-w-full",
|
|
@@ -699,7 +664,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
699
664
|
}
|
|
700
665
|
})
|
|
701
666
|
}),
|
|
702
|
-
subComponentType ===
|
|
667
|
+
subComponentType === "Inputs" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
703
668
|
className: "univer-flex univer-items-center univer-gap-2",
|
|
704
669
|
children: [
|
|
705
670
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
@@ -727,7 +692,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
727
692
|
})
|
|
728
693
|
]
|
|
729
694
|
}),
|
|
730
|
-
!!(subComponentType ===
|
|
695
|
+
!!(subComponentType === "Select") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
731
696
|
className: "univer-w-full",
|
|
732
697
|
value: (_conditionInfo$info$d6 = conditionInfo.info.dateSelect) !== null && _conditionInfo$info$d6 !== void 0 ? _conditionInfo$info$d6 : conditionDateOptions[0].value,
|
|
733
698
|
options: conditionDateOptions,
|
|
@@ -879,7 +844,7 @@ function SheetTableFilterPanel() {
|
|
|
879
844
|
const { data } = tableUiService.getTableFilterItems(unitId, subUnitId, tableId, columnIndex);
|
|
880
845
|
const checkedItems = tableUiService.getTableFilterCheckedItems(unitId, tableId, columnIndex);
|
|
881
846
|
const [checkedItemSet, setCheckedItemSet] = (0, react.useState)(new Set(checkedItems));
|
|
882
|
-
const [filterBy, setFilterBy] = (0, react.useState)(currentFilterBy ||
|
|
847
|
+
const [filterBy, setFilterBy] = (0, react.useState)(currentFilterBy || "items");
|
|
883
848
|
const [conditionInfo, setConditionInfo] = (0, react.useState)(() => {
|
|
884
849
|
const tableFilter = props.tableFilter;
|
|
885
850
|
return getInitConditionInfo(tableFilter);
|
|
@@ -912,7 +877,7 @@ function SheetTableFilterPanel() {
|
|
|
912
877
|
closeDialog();
|
|
913
878
|
};
|
|
914
879
|
const onApply = () => {
|
|
915
|
-
if (filterBy ===
|
|
880
|
+
if (filterBy === "items") {
|
|
916
881
|
const filteredItems = [];
|
|
917
882
|
for (const itemInfo of data) if (checkedItemSet.has(itemInfo.title)) filteredItems.push(itemInfo.title);
|
|
918
883
|
const originFilter = table.getTableFilterColumn(columnIndex);
|
|
@@ -984,7 +949,7 @@ function SheetTableFilterPanel() {
|
|
|
984
949
|
className: "univer-z-10 univer-h-60",
|
|
985
950
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
986
951
|
className: "univer-mt-3 univer-size-full",
|
|
987
|
-
children: filterBy ===
|
|
952
|
+
children: filterBy === "items" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetTableItemsFilterPanel, {
|
|
988
953
|
tableFilter,
|
|
989
954
|
unitId,
|
|
990
955
|
subUnitId,
|
|
@@ -1025,10 +990,10 @@ function SheetTableFilterPanel() {
|
|
|
1025
990
|
function useFilterByOptions(localeService) {
|
|
1026
991
|
return (0, react.useMemo)(() => [{
|
|
1027
992
|
label: localeService.t("sheets-table.filter.by-values"),
|
|
1028
|
-
value:
|
|
993
|
+
value: "items"
|
|
1029
994
|
}, {
|
|
1030
995
|
label: localeService.t("sheets-table.filter.by-conditions"),
|
|
1031
|
-
value:
|
|
996
|
+
value: "condition"
|
|
1032
997
|
}], [localeService.getCurrentLocale(), localeService]);
|
|
1033
998
|
}
|
|
1034
999
|
|
package/lib/es/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { RangeSelector } from "@univerjs/sheets-formula-ui";
|
|
|
15
15
|
|
|
16
16
|
//#region package.json
|
|
17
17
|
var name = "@univerjs/sheets-table-ui";
|
|
18
|
-
var version = "0.
|
|
18
|
+
var version = "0.22.0-insiders.20260513-09bbeca";
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/const.ts
|
|
@@ -48,30 +48,7 @@ const TABLE_BORDER_NONE = "none";
|
|
|
48
48
|
const TABLE_BORDER_DEFAULT = "1px solid rgb(var(--grey-200))";
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
51
|
-
//#region
|
|
52
|
-
/**
|
|
53
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
54
|
-
*
|
|
55
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
56
|
-
* you may not use this file except in compliance with the License.
|
|
57
|
-
* You may obtain a copy of the License at
|
|
58
|
-
*
|
|
59
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
60
|
-
*
|
|
61
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
62
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
63
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
64
|
-
* See the License for the specific language governing permissions and
|
|
65
|
-
* limitations under the License.
|
|
66
|
-
*/
|
|
67
|
-
let FilterByEnum = /* @__PURE__ */ function(FilterByEnum) {
|
|
68
|
-
FilterByEnum["Items"] = "items";
|
|
69
|
-
FilterByEnum["Condition"] = "condition";
|
|
70
|
-
return FilterByEnum;
|
|
71
|
-
}({});
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
|
|
51
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
75
52
|
function _typeof(o) {
|
|
76
53
|
"@babel/helpers - typeof";
|
|
77
54
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -82,7 +59,7 @@ function _typeof(o) {
|
|
|
82
59
|
}
|
|
83
60
|
|
|
84
61
|
//#endregion
|
|
85
|
-
//#region \0@oxc-project+runtime@0.
|
|
62
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
86
63
|
function toPrimitive(t, r) {
|
|
87
64
|
if ("object" != _typeof(t) || !t) return t;
|
|
88
65
|
var e = t[Symbol.toPrimitive];
|
|
@@ -95,14 +72,14 @@ function toPrimitive(t, r) {
|
|
|
95
72
|
}
|
|
96
73
|
|
|
97
74
|
//#endregion
|
|
98
|
-
//#region \0@oxc-project+runtime@0.
|
|
75
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
99
76
|
function toPropertyKey(t) {
|
|
100
77
|
var i = toPrimitive(t, "string");
|
|
101
78
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
102
79
|
}
|
|
103
80
|
|
|
104
81
|
//#endregion
|
|
105
|
-
//#region \0@oxc-project+runtime@0.
|
|
82
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
106
83
|
function _defineProperty(e, r, t) {
|
|
107
84
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
108
85
|
value: t,
|
|
@@ -113,7 +90,7 @@ function _defineProperty(e, r, t) {
|
|
|
113
90
|
}
|
|
114
91
|
|
|
115
92
|
//#endregion
|
|
116
|
-
//#region \0@oxc-project+runtime@0.
|
|
93
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
117
94
|
function __decorateParam(paramIndex, decorator) {
|
|
118
95
|
return function(target, key) {
|
|
119
96
|
decorator(target, key, paramIndex);
|
|
@@ -121,7 +98,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
121
98
|
}
|
|
122
99
|
|
|
123
100
|
//#endregion
|
|
124
|
-
//#region \0@oxc-project+runtime@0.
|
|
101
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
125
102
|
function __decorate(decorators, target, key, desc) {
|
|
126
103
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
127
104
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -179,7 +156,7 @@ let SheetsTableUiService = class SheetsTableUiService extends Disposable {
|
|
|
179
156
|
unitId,
|
|
180
157
|
subUnitId,
|
|
181
158
|
tableFilter,
|
|
182
|
-
currentFilterBy: isConditionFilter(tableFilter) ?
|
|
159
|
+
currentFilterBy: isConditionFilter(tableFilter) ? "condition" : "items",
|
|
183
160
|
tableId,
|
|
184
161
|
columnIndex: column - tableRange.startColumn
|
|
185
162
|
};
|
|
@@ -259,18 +236,6 @@ SheetsTableUiService = __decorate([
|
|
|
259
236
|
__decorateParam(4, Inject(LocaleService))
|
|
260
237
|
], SheetsTableUiService);
|
|
261
238
|
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/views/components/type.ts
|
|
264
|
-
let ConditionSubComponentEnum = /* @__PURE__ */ function(ConditionSubComponentEnum) {
|
|
265
|
-
ConditionSubComponentEnum["DatePicker"] = "DatePicker";
|
|
266
|
-
ConditionSubComponentEnum["DateRange"] = "DateRange";
|
|
267
|
-
ConditionSubComponentEnum["Input"] = "Input";
|
|
268
|
-
ConditionSubComponentEnum["Inputs"] = "Inputs";
|
|
269
|
-
ConditionSubComponentEnum["Select"] = "Select";
|
|
270
|
-
ConditionSubComponentEnum["None"] = "None";
|
|
271
|
-
return ConditionSubComponentEnum;
|
|
272
|
-
}({});
|
|
273
|
-
|
|
274
239
|
//#endregion
|
|
275
240
|
//#region src/views/components/util.ts
|
|
276
241
|
function getCascaderListOptions(injector) {
|
|
@@ -532,17 +497,17 @@ const datePickerSet = new Set([
|
|
|
532
497
|
TableDateCompareTypeEnum.BeforeOrEqual
|
|
533
498
|
]);
|
|
534
499
|
function getSubComponentType(type, compare) {
|
|
535
|
-
if (!compare) return
|
|
536
|
-
if (type === TableConditionTypeEnum.String) return
|
|
537
|
-
else if (type === TableConditionTypeEnum.Number) if (compare === TableNumberCompareTypeEnum.Between || compare === TableNumberCompareTypeEnum.NotBetween) return
|
|
538
|
-
else return
|
|
500
|
+
if (!compare) return "None";
|
|
501
|
+
if (type === TableConditionTypeEnum.String) return "Input";
|
|
502
|
+
else if (type === TableConditionTypeEnum.Number) if (compare === TableNumberCompareTypeEnum.Between || compare === TableNumberCompareTypeEnum.NotBetween) return "Inputs";
|
|
503
|
+
else return "Input";
|
|
539
504
|
else if (type === TableConditionTypeEnum.Date) {
|
|
540
|
-
if (compare === TableDateCompareTypeEnum.Between || compare === TableDateCompareTypeEnum.NotBetween) return
|
|
541
|
-
else if (compare === TableDateCompareTypeEnum.Quarter || compare === TableDateCompareTypeEnum.Month) return
|
|
542
|
-
else if (datePickerSet.has(compare)) return
|
|
543
|
-
return
|
|
505
|
+
if (compare === TableDateCompareTypeEnum.Between || compare === TableDateCompareTypeEnum.NotBetween) return "DateRange";
|
|
506
|
+
else if (compare === TableDateCompareTypeEnum.Quarter || compare === TableDateCompareTypeEnum.Month) return "Select";
|
|
507
|
+
else if (datePickerSet.has(compare)) return "DatePicker";
|
|
508
|
+
return "None";
|
|
544
509
|
}
|
|
545
|
-
return
|
|
510
|
+
return "None";
|
|
546
511
|
}
|
|
547
512
|
function getInitConditionInfo(tableFilter) {
|
|
548
513
|
if (!tableFilter || tableFilter.filterType !== "condition") return {
|
|
@@ -666,7 +631,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
666
631
|
}), /* @__PURE__ */ jsxs("div", {
|
|
667
632
|
className: "univer-mt-3 univer-w-full",
|
|
668
633
|
children: [
|
|
669
|
-
subComponentType ===
|
|
634
|
+
subComponentType === "Input" && /* @__PURE__ */ jsx(Fragment, { children: conditionInfo.type === TableConditionTypeEnum.String ? /* @__PURE__ */ jsx(Input, {
|
|
670
635
|
className: "univer-w-full",
|
|
671
636
|
placeholder: "请输入",
|
|
672
637
|
value: conditionInfo.info.string,
|
|
@@ -679,7 +644,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
679
644
|
if (v !== null) handleConditionInfo({ number: v });
|
|
680
645
|
}
|
|
681
646
|
}) }),
|
|
682
|
-
!!(subComponentType ===
|
|
647
|
+
!!(subComponentType === "DatePicker") && /* @__PURE__ */ jsx("div", {
|
|
683
648
|
id: "univer-table-date-picker-wrapper",
|
|
684
649
|
children: /* @__PURE__ */ jsx(DatePicker, {
|
|
685
650
|
className: "univer-w-full",
|
|
@@ -687,7 +652,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
687
652
|
onValueChange: (v) => handleConditionInfo({ date: v })
|
|
688
653
|
})
|
|
689
654
|
}),
|
|
690
|
-
!!(subComponentType ===
|
|
655
|
+
!!(subComponentType === "DateRange") && /* @__PURE__ */ jsx("div", {
|
|
691
656
|
id: "univer-table-date-range-wrapper",
|
|
692
657
|
children: /* @__PURE__ */ jsx(DateRangePicker, {
|
|
693
658
|
className: "univer-w-full",
|
|
@@ -698,7 +663,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
698
663
|
}
|
|
699
664
|
})
|
|
700
665
|
}),
|
|
701
|
-
subComponentType ===
|
|
666
|
+
subComponentType === "Inputs" && /* @__PURE__ */ jsxs("div", {
|
|
702
667
|
className: "univer-flex univer-items-center univer-gap-2",
|
|
703
668
|
children: [
|
|
704
669
|
/* @__PURE__ */ jsx(InputNumber, {
|
|
@@ -726,7 +691,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
726
691
|
})
|
|
727
692
|
]
|
|
728
693
|
}),
|
|
729
|
-
!!(subComponentType ===
|
|
694
|
+
!!(subComponentType === "Select") && /* @__PURE__ */ jsx(Select, {
|
|
730
695
|
className: "univer-w-full",
|
|
731
696
|
value: (_conditionInfo$info$d6 = conditionInfo.info.dateSelect) !== null && _conditionInfo$info$d6 !== void 0 ? _conditionInfo$info$d6 : conditionDateOptions[0].value,
|
|
732
697
|
options: conditionDateOptions,
|
|
@@ -878,7 +843,7 @@ function SheetTableFilterPanel() {
|
|
|
878
843
|
const { data } = tableUiService.getTableFilterItems(unitId, subUnitId, tableId, columnIndex);
|
|
879
844
|
const checkedItems = tableUiService.getTableFilterCheckedItems(unitId, tableId, columnIndex);
|
|
880
845
|
const [checkedItemSet, setCheckedItemSet] = useState(new Set(checkedItems));
|
|
881
|
-
const [filterBy, setFilterBy] = useState(currentFilterBy ||
|
|
846
|
+
const [filterBy, setFilterBy] = useState(currentFilterBy || "items");
|
|
882
847
|
const [conditionInfo, setConditionInfo] = useState(() => {
|
|
883
848
|
const tableFilter = props.tableFilter;
|
|
884
849
|
return getInitConditionInfo(tableFilter);
|
|
@@ -911,7 +876,7 @@ function SheetTableFilterPanel() {
|
|
|
911
876
|
closeDialog();
|
|
912
877
|
};
|
|
913
878
|
const onApply = () => {
|
|
914
|
-
if (filterBy ===
|
|
879
|
+
if (filterBy === "items") {
|
|
915
880
|
const filteredItems = [];
|
|
916
881
|
for (const itemInfo of data) if (checkedItemSet.has(itemInfo.title)) filteredItems.push(itemInfo.title);
|
|
917
882
|
const originFilter = table.getTableFilterColumn(columnIndex);
|
|
@@ -983,7 +948,7 @@ function SheetTableFilterPanel() {
|
|
|
983
948
|
className: "univer-z-10 univer-h-60",
|
|
984
949
|
children: /* @__PURE__ */ jsx("div", {
|
|
985
950
|
className: "univer-mt-3 univer-size-full",
|
|
986
|
-
children: filterBy ===
|
|
951
|
+
children: filterBy === "items" ? /* @__PURE__ */ jsx(SheetTableItemsFilterPanel, {
|
|
987
952
|
tableFilter,
|
|
988
953
|
unitId,
|
|
989
954
|
subUnitId,
|
|
@@ -1024,10 +989,10 @@ function SheetTableFilterPanel() {
|
|
|
1024
989
|
function useFilterByOptions(localeService) {
|
|
1025
990
|
return useMemo(() => [{
|
|
1026
991
|
label: localeService.t("sheets-table.filter.by-values"),
|
|
1027
|
-
value:
|
|
992
|
+
value: "items"
|
|
1028
993
|
}, {
|
|
1029
994
|
label: localeService.t("sheets-table.filter.by-conditions"),
|
|
1030
|
-
value:
|
|
995
|
+
value: "condition"
|
|
1031
996
|
}], [localeService.getCurrentLocale(), localeService]);
|
|
1032
997
|
}
|
|
1033
998
|
|