@univerjs/sheets-filter-ui 1.3.0 → 1.4.0
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/lib/cjs/index.js +142 -448
- package/lib/cjs/locale/ar-SA.js +1 -2
- package/lib/cjs/locale/ca-ES.js +1 -2
- package/lib/cjs/locale/de-DE.js +1 -2
- package/lib/cjs/locale/en-US.js +1 -2
- package/lib/cjs/locale/es-ES.js +1 -2
- package/lib/cjs/locale/fa-IR.js +1 -2
- package/lib/cjs/locale/fr-FR.js +1 -2
- package/lib/cjs/locale/id-ID.js +1 -2
- package/lib/cjs/locale/it-IT.js +1 -2
- package/lib/cjs/locale/ja-JP.js +1 -2
- package/lib/cjs/locale/ko-KR.js +1 -2
- package/lib/cjs/locale/pl-PL.js +1 -2
- package/lib/cjs/locale/pt-BR.js +1 -2
- package/lib/cjs/locale/ru-RU.js +1 -2
- package/lib/cjs/locale/sk-SK.js +1 -2
- package/lib/cjs/locale/vi-VN.js +1 -2
- package/lib/cjs/locale/zh-CN.js +1 -2
- package/lib/cjs/locale/zh-HK.js +1 -2
- package/lib/cjs/locale/zh-TW.js +1 -2
- package/lib/cjs/worker-CME9bDM7.js +338 -0
- package/lib/cjs/worker.js +9 -0
- package/lib/es/index.js +32 -338
- package/lib/es/locale/ar-SA.js +1 -2
- package/lib/es/locale/ca-ES.js +1 -2
- package/lib/es/locale/de-DE.js +1 -2
- package/lib/es/locale/en-US.js +1 -2
- package/lib/es/locale/es-ES.js +1 -2
- package/lib/es/locale/fa-IR.js +1 -2
- package/lib/es/locale/fr-FR.js +1 -2
- package/lib/es/locale/id-ID.js +1 -2
- package/lib/es/locale/it-IT.js +1 -2
- package/lib/es/locale/ja-JP.js +1 -2
- package/lib/es/locale/ko-KR.js +1 -2
- package/lib/es/locale/pl-PL.js +1 -2
- package/lib/es/locale/pt-BR.js +1 -2
- package/lib/es/locale/ru-RU.js +1 -2
- package/lib/es/locale/sk-SK.js +1 -2
- package/lib/es/locale/vi-VN.js +1 -2
- package/lib/es/locale/zh-CN.js +1 -2
- package/lib/es/locale/zh-HK.js +1 -2
- package/lib/es/locale/zh-TW.js +1 -2
- package/lib/es/worker-VROMWls7.js +273 -0
- package/lib/es/worker.js +3 -0
- package/lib/index.js +32 -338
- package/lib/locale/ar-SA.js +1 -2
- package/lib/locale/ca-ES.js +1 -2
- package/lib/locale/de-DE.js +1 -2
- package/lib/locale/en-US.js +1 -2
- package/lib/locale/es-ES.js +1 -2
- package/lib/locale/fa-IR.js +1 -2
- package/lib/locale/fr-FR.js +1 -2
- package/lib/locale/id-ID.js +1 -2
- package/lib/locale/it-IT.js +1 -2
- package/lib/locale/ja-JP.js +1 -2
- package/lib/locale/ko-KR.js +1 -2
- package/lib/locale/pl-PL.js +1 -2
- package/lib/locale/pt-BR.js +1 -2
- package/lib/locale/ru-RU.js +1 -2
- package/lib/locale/sk-SK.js +1 -2
- package/lib/locale/vi-VN.js +1 -2
- package/lib/locale/zh-CN.js +1 -2
- package/lib/locale/zh-HK.js +1 -2
- package/lib/locale/zh-TW.js +1 -2
- package/lib/types/__tests__/data.d.ts +2 -2
- package/lib/types/index.d.ts +3 -1
- package/lib/types/services/sheets-filter-panel.service.d.ts +1 -1
- package/lib/types/worker/generate-filter-values.service.d.ts +1 -1
- package/lib/types/worker.d.ts +16 -0
- package/lib/umd/index.js +2 -2
- package/lib/worker-VROMWls7.js +273 -0
- package/lib/worker.js +3 -0
- package/package.json +21 -16
package/lib/es/locale/it-IT.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/it-IT.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "Attiva/disattiva filtro",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/ja-JP.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/ja-JP.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "フィルタの切替",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/ko-KR.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/ko-KR.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "필터 토글",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/pl-PL.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/pl-PL.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "Przełącz filtr",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/pt-BR.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/pt-BR.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "Alternar Filtro",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/ru-RU.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/ru-RU.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "Переключить фильтр",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/sk-SK.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/sk-SK.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "Prepnúť filter",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/vi-VN.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/vi-VN.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "Lọc",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/zh-CN.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/zh-CN.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "筛选",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/zh-HK.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/zh-HK.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "篩選",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
package/lib/es/locale/zh-TW.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/locale/zh-TW.ts
|
|
2
2
|
const locale = { "sheets-filter-ui": {
|
|
3
3
|
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "篩選",
|
|
@@ -80,5 +80,4 @@ const locale = { "sheets-filter-ui": {
|
|
|
80
80
|
}
|
|
81
81
|
} };
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { locale as default };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { Disposable, IConfigService, ILogService, IUniverInstanceService, Inject, Injector, LocaleService, Plugin, UniverInstanceType, createIdentifier, extractPureTextFromCell, isNumeric, merge, numfmt } from "@univerjs/core";
|
|
2
|
+
import { FilterBy } from "@univerjs/sheets-filter";
|
|
3
|
+
import { IRPCChannelService, fromModule } from "@univerjs/rpc";
|
|
4
|
+
|
|
5
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
|
|
6
|
+
function __decorateParam(paramIndex, decorator) {
|
|
7
|
+
return function(target, key) {
|
|
8
|
+
decorator(target, key, paramIndex);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
|
|
13
|
+
function __decorate(decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/worker/generate-filter-values.service.ts
|
|
21
|
+
const SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME = "sheets-filter.generate-filter-values.service";
|
|
22
|
+
const ISheetsGenerateFilterValuesService = createIdentifier(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME);
|
|
23
|
+
let SheetsGenerateFilterValuesService = class SheetsGenerateFilterValuesService extends Disposable {
|
|
24
|
+
constructor(_localeService, _univerInstanceService, _logService) {
|
|
25
|
+
super();
|
|
26
|
+
this._localeService = _localeService;
|
|
27
|
+
this._univerInstanceService = _univerInstanceService;
|
|
28
|
+
this._logService = _logService;
|
|
29
|
+
}
|
|
30
|
+
async getFilterValues(params) {
|
|
31
|
+
var _this$_univerInstance;
|
|
32
|
+
const { unitId, subUnitId, filteredOutRowsByOtherColumns, filterColumn, filters, blankChecked, iterateRange, alreadyChecked } = params;
|
|
33
|
+
const workbook = this._univerInstanceService.getUnit(unitId);
|
|
34
|
+
const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(unitId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(subUnitId);
|
|
35
|
+
if (!workbook || !worksheet) return [];
|
|
36
|
+
this._logService.debug("[SheetsGenerateFilterValuesService]", "getFilterValues for", {
|
|
37
|
+
unitId,
|
|
38
|
+
subUnitId
|
|
39
|
+
});
|
|
40
|
+
return getFilterTreeByValueItems(filters, this._localeService, iterateRange, worksheet, new Set(filteredOutRowsByOtherColumns), filterColumn, new Set(alreadyChecked.map(String)), blankChecked, workbook.getStyles());
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
SheetsGenerateFilterValuesService = __decorate([
|
|
44
|
+
__decorateParam(0, Inject(LocaleService)),
|
|
45
|
+
__decorateParam(1, IUniverInstanceService),
|
|
46
|
+
__decorateParam(2, ILogService)
|
|
47
|
+
], SheetsGenerateFilterValuesService);
|
|
48
|
+
function getFilterTreeByValueItems(filters, localeService, iterateRange, worksheet, filteredOutRowsByOtherColumns, filterColumn, alreadyChecked, blankChecked, styles) {
|
|
49
|
+
var _filterColumn$filtere;
|
|
50
|
+
const items = /* @__PURE__ */ new Map();
|
|
51
|
+
const treeMap = /* @__PURE__ */ new Map();
|
|
52
|
+
const DefaultPattern = "yyyy-mm-dd";
|
|
53
|
+
const EmptyKey = "empty";
|
|
54
|
+
const isNeedClearCheckedStatus = !filters && ((filterColumn === null || filterColumn === void 0 ? void 0 : filterColumn.filterBy) === FilterBy.COLORS || (filterColumn === null || filterColumn === void 0 ? void 0 : filterColumn.filterBy) === FilterBy.CONDITIONS) && ((_filterColumn$filtere = filterColumn.filteredOutRows) === null || _filterColumn$filtere === void 0 ? void 0 : _filterColumn$filtere.size);
|
|
55
|
+
let emptyCount = 0;
|
|
56
|
+
for (const cell of worksheet.iterateByColumn(iterateRange, false, false)) {
|
|
57
|
+
const { row, rowSpan = 1 } = cell;
|
|
58
|
+
let rowIndex = 0;
|
|
59
|
+
while (rowIndex < rowSpan) {
|
|
60
|
+
var _cell$value, _styles$get, _cell$value2;
|
|
61
|
+
const targetRow = row + rowIndex;
|
|
62
|
+
if (filteredOutRowsByOtherColumns.has(targetRow)) {
|
|
63
|
+
rowIndex++;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const value = (cell === null || cell === void 0 ? void 0 : cell.value) ? extractPureTextFromCell(cell.value) : "";
|
|
67
|
+
if (!value) {
|
|
68
|
+
emptyCount += 1;
|
|
69
|
+
rowIndex += rowSpan;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const fmtStr = ((_cell$value = cell.value) === null || _cell$value === void 0 ? void 0 : _cell$value.v) && !cell.value.p ? (_styles$get = styles.get((_cell$value2 = cell.value) === null || _cell$value2 === void 0 ? void 0 : _cell$value2.s)) === null || _styles$get === void 0 || (_styles$get = _styles$get.n) === null || _styles$get === void 0 ? void 0 : _styles$get.pattern : "";
|
|
73
|
+
const isDateValue = fmtStr && numfmt.getFormatInfo(fmtStr).isDate;
|
|
74
|
+
let isIncludeDatePart = false;
|
|
75
|
+
if (isDateValue) {
|
|
76
|
+
const { year, month, day } = numfmt.getFormatDateInfo(fmtStr);
|
|
77
|
+
isIncludeDatePart = year || month || day;
|
|
78
|
+
}
|
|
79
|
+
if (fmtStr && isDateValue && isIncludeDatePart) {
|
|
80
|
+
var _worksheet$getCellRaw, _yearItem$children, _monthItem$children;
|
|
81
|
+
const originValue = (_worksheet$getCellRaw = worksheet.getCellRaw(cell.row, cell.col)) === null || _worksheet$getCellRaw === void 0 ? void 0 : _worksheet$getCellRaw.v;
|
|
82
|
+
if (!originValue) {
|
|
83
|
+
rowIndex++;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const [year, month, day] = numfmt.format(DefaultPattern, Number(originValue)).split("-").map(Number);
|
|
87
|
+
let yearItem = items.get(`${year}`);
|
|
88
|
+
if (!yearItem) {
|
|
89
|
+
yearItem = {
|
|
90
|
+
title: `${year}`,
|
|
91
|
+
key: `${year}`,
|
|
92
|
+
children: [],
|
|
93
|
+
count: 0,
|
|
94
|
+
leaf: false,
|
|
95
|
+
checked: false
|
|
96
|
+
};
|
|
97
|
+
items.set(`${year}`, yearItem);
|
|
98
|
+
treeMap.set(`${year}`, [`${year}`]);
|
|
99
|
+
}
|
|
100
|
+
let monthItem = (_yearItem$children = yearItem.children) === null || _yearItem$children === void 0 ? void 0 : _yearItem$children.find((item) => item.key === `${year}-${month}`);
|
|
101
|
+
if (!monthItem) {
|
|
102
|
+
var _yearItem$children2;
|
|
103
|
+
monthItem = {
|
|
104
|
+
title: localeService.t(`sheets-filter-ui.date.${month}`),
|
|
105
|
+
key: `${year}-${month}`,
|
|
106
|
+
children: [],
|
|
107
|
+
count: 0,
|
|
108
|
+
leaf: false,
|
|
109
|
+
checked: false
|
|
110
|
+
};
|
|
111
|
+
(_yearItem$children2 = yearItem.children) === null || _yearItem$children2 === void 0 || _yearItem$children2.push(monthItem);
|
|
112
|
+
treeMap.set(`${year}-${month}`, [`${year}`, `${year}-${month}`]);
|
|
113
|
+
}
|
|
114
|
+
const dayItem = monthItem === null || monthItem === void 0 || (_monthItem$children = monthItem.children) === null || _monthItem$children === void 0 ? void 0 : _monthItem$children.find((item) => item.key === `${year}-${month}-${day}`);
|
|
115
|
+
if (!dayItem) {
|
|
116
|
+
var _monthItem$children2;
|
|
117
|
+
(_monthItem$children2 = monthItem.children) === null || _monthItem$children2 === void 0 || _monthItem$children2.push({
|
|
118
|
+
title: `${day}`,
|
|
119
|
+
key: `${year}-${month}-${day}`,
|
|
120
|
+
count: 1,
|
|
121
|
+
originValues: /* @__PURE__ */ new Set([value]),
|
|
122
|
+
leaf: true,
|
|
123
|
+
checked: isNeedClearCheckedStatus ? false : alreadyChecked.size ? alreadyChecked.has(value) : !blankChecked
|
|
124
|
+
});
|
|
125
|
+
monthItem.count++;
|
|
126
|
+
yearItem.count++;
|
|
127
|
+
treeMap.set(`${year}-${month}-${day}`, [
|
|
128
|
+
`${year}`,
|
|
129
|
+
`${year}-${month}`,
|
|
130
|
+
`${year}-${month}-${day}`
|
|
131
|
+
]);
|
|
132
|
+
} else {
|
|
133
|
+
dayItem.originValues.add(value);
|
|
134
|
+
dayItem.count++;
|
|
135
|
+
monthItem.count++;
|
|
136
|
+
yearItem.count++;
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
const key = value;
|
|
140
|
+
let item = items.get(key);
|
|
141
|
+
if (!item) {
|
|
142
|
+
item = {
|
|
143
|
+
title: value,
|
|
144
|
+
leaf: true,
|
|
145
|
+
checked: isNeedClearCheckedStatus ? false : alreadyChecked.size ? alreadyChecked.has(value) : !blankChecked,
|
|
146
|
+
key,
|
|
147
|
+
count: 1
|
|
148
|
+
};
|
|
149
|
+
items.set(key, item);
|
|
150
|
+
treeMap.set(key, [key]);
|
|
151
|
+
} else item.count++;
|
|
152
|
+
}
|
|
153
|
+
rowIndex++;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const initialBlankChecked = isNeedClearCheckedStatus ? false : filters ? blankChecked : true;
|
|
157
|
+
if (emptyCount > 0) {
|
|
158
|
+
const item = {
|
|
159
|
+
title: localeService.t("sheets-filter-ui.panel.empty"),
|
|
160
|
+
count: emptyCount,
|
|
161
|
+
leaf: true,
|
|
162
|
+
checked: initialBlankChecked,
|
|
163
|
+
key: EmptyKey
|
|
164
|
+
};
|
|
165
|
+
items.set("empty", item);
|
|
166
|
+
treeMap.set("empty", [EmptyKey]);
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
filterTreeItems: generateFilterTreeBySort(Array.from(items.values())),
|
|
170
|
+
filterTreeMapCache: treeMap
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function generateFilterTreeBySort(tree) {
|
|
174
|
+
return Array.from(tree).sort((a, b) => {
|
|
175
|
+
if (a.children && !b.children) return -1;
|
|
176
|
+
if (!a.children && b.children) return 1;
|
|
177
|
+
return compare(a.title, b.title);
|
|
178
|
+
}).map((yearItem) => {
|
|
179
|
+
if (yearItem.children) yearItem.children.sort((a, b) => {
|
|
180
|
+
return Number.parseInt(a.key.split("-")[1], 10) - Number.parseInt(b.key.split("-")[1], 10);
|
|
181
|
+
}).forEach((monthItem) => {
|
|
182
|
+
if (monthItem.children) monthItem.children.sort((a, b) => {
|
|
183
|
+
return Number.parseInt(a.key.split("-")[2], 10) - Number.parseInt(b.key.split("-")[2], 10);
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
return yearItem;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function compare(strA, strB) {
|
|
190
|
+
const aIsNumeric = isNumeric(strA);
|
|
191
|
+
const bIsNumeric = isNumeric(strB);
|
|
192
|
+
if (aIsNumeric && bIsNumeric) return Number.parseFloat(strA) - Number.parseFloat(strB);
|
|
193
|
+
else if (aIsNumeric && !bIsNumeric) return -1;
|
|
194
|
+
else if (!aIsNumeric && bIsNumeric) return 1;
|
|
195
|
+
else return strA.localeCompare(strB);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
|
|
199
|
+
function _typeof(o) {
|
|
200
|
+
"@babel/helpers - typeof";
|
|
201
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
202
|
+
return typeof o;
|
|
203
|
+
} : function(o) {
|
|
204
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
205
|
+
}, _typeof(o);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
|
|
209
|
+
function toPrimitive(t, r) {
|
|
210
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
211
|
+
var e = t[Symbol.toPrimitive];
|
|
212
|
+
if (void 0 !== e) {
|
|
213
|
+
var i = e.call(t, r || "default");
|
|
214
|
+
if ("object" != _typeof(i)) return i;
|
|
215
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
216
|
+
}
|
|
217
|
+
return ("string" === r ? String : Number)(t);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
|
|
221
|
+
function toPropertyKey(t) {
|
|
222
|
+
var i = toPrimitive(t, "string");
|
|
223
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
|
|
227
|
+
function _defineProperty(e, r, t) {
|
|
228
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
229
|
+
value: t,
|
|
230
|
+
enumerable: !0,
|
|
231
|
+
configurable: !0,
|
|
232
|
+
writable: !0
|
|
233
|
+
}) : e[r] = t, e;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// package.json
|
|
237
|
+
var name = "@univerjs/sheets-filter-ui";
|
|
238
|
+
var version = "1.4.0";
|
|
239
|
+
|
|
240
|
+
// src/config/config.ts
|
|
241
|
+
const SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY = "sheets-filter-ui.config";
|
|
242
|
+
const configSymbol = Symbol(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY);
|
|
243
|
+
const defaultPluginConfig = {};
|
|
244
|
+
|
|
245
|
+
// src/worker/plugin.ts
|
|
246
|
+
let UniverSheetsFilterUIWorkerPlugin = class UniverSheetsFilterUIWorkerPlugin extends Plugin {
|
|
247
|
+
constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
|
|
248
|
+
super();
|
|
249
|
+
this._config = _config;
|
|
250
|
+
this._injector = _injector;
|
|
251
|
+
this._configService = _configService;
|
|
252
|
+
this._rpcChannelService = _rpcChannelService;
|
|
253
|
+
const { ...rest } = merge({}, defaultPluginConfig, this._config);
|
|
254
|
+
this._configService.setConfig(SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY, rest);
|
|
255
|
+
}
|
|
256
|
+
onStarting() {
|
|
257
|
+
[[ISheetsGenerateFilterValuesService, { useClass: SheetsGenerateFilterValuesService }]].forEach((d) => this._injector.add(d));
|
|
258
|
+
}
|
|
259
|
+
onReady() {
|
|
260
|
+
this._rpcChannelService.registerChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME, fromModule(this._injector.get(ISheetsGenerateFilterValuesService)));
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
_defineProperty(UniverSheetsFilterUIWorkerPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
264
|
+
_defineProperty(UniverSheetsFilterUIWorkerPlugin, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN");
|
|
265
|
+
_defineProperty(UniverSheetsFilterUIWorkerPlugin, "packageName", name);
|
|
266
|
+
_defineProperty(UniverSheetsFilterUIWorkerPlugin, "version", version);
|
|
267
|
+
UniverSheetsFilterUIWorkerPlugin = __decorate([
|
|
268
|
+
__decorateParam(1, Inject(Injector)),
|
|
269
|
+
__decorateParam(2, IConfigService),
|
|
270
|
+
__decorateParam(3, IRPCChannelService)
|
|
271
|
+
], UniverSheetsFilterUIWorkerPlugin);
|
|
272
|
+
|
|
273
|
+
export { version as a, SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME as c, __decorateParam as d, name as i, getFilterTreeByValueItems as l, SHEETS_FILTER_UI_PLUGIN_CONFIG_KEY as n, _defineProperty as o, defaultPluginConfig as r, ISheetsGenerateFilterValuesService as s, UniverSheetsFilterUIWorkerPlugin as t, __decorate as u };
|
package/lib/es/worker.js
ADDED