@univerjs/sheets-filter-ui 0.4.1 → 0.4.2-nightly.202410301606
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/es/index.js +90 -252
- package/lib/locale/{en-US.json → en-US.js} +22 -19
- package/lib/locale/{fa-IR.json → fa-IR.js} +22 -19
- package/lib/locale/{ru-RU.json → ru-RU.js} +22 -19
- package/lib/locale/{vi-VN.json → vi-VN.js} +22 -19
- package/lib/locale/{zh-CN.json → zh-CN.js} +22 -19
- package/lib/locale/{zh-TW.json → zh-TW.js} +22 -19
- package/lib/types/controllers/sheets-filter-permission.controller.d.ts +1 -1
- package/lib/types/controllers/sheets-filter-ui-desktop.controller.d.ts +2 -2
- package/lib/types/controllers/sheets-filter.menu.d.ts +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/services/sheets-filter-panel.service.d.ts +1 -1
- package/lib/types/views/components/SheetsFilterPanel.stories.d.ts +1 -1
- package/lib/umd/index.js +12 -4
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +25 -23
- package/LICENSE +0 -176
- package/lib/cjs/index.js +0 -14
- package/lib/types/commands/commands/sheets-filter.command.d.ts +0 -57
package/lib/es/index.js
CHANGED
|
@@ -2,185 +2,19 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import {
|
|
5
|
+
import { BooleanNumber, createIdentifier, Inject, LocaleService, Disposable, IUniverInstanceService, ILogService, extractPureTextFromCell, Injector, ICommandService, Quantity, CommandType, IContextService, Tools, useDependency, UniverInstanceType, ThemeService, RxDisposable, fromCallback, InterceptorEffectEnum, DependentOn, Optional, Plugin, IConfigService } from "@univerjs/core";
|
|
6
6
|
import { IRPCChannelService, toModule, fromModule } from "@univerjs/rpc";
|
|
7
|
-
import { SheetsFilterService,
|
|
8
|
-
import {
|
|
9
|
-
import { SetCellEditVisibleOperation, SheetPermissionInterceptorBaseController, SheetsUIPart, whenSheetEditorFocused, SheetSkeletonManagerService, ISheetSelectionRenderService, SelectionShape, getCoordByCell, SheetsRenderService,
|
|
10
|
-
import {
|
|
11
|
-
import { IMessageService, ILayoutService, useObservable, useComponentsOfPart, ComponentContainer, KeyCode, MetaKeys, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ComponentManager, IShortcutService, IMenuManagerService } from "@univerjs/ui";
|
|
7
|
+
import { CustomFilterOperator, SetSheetsFilterCriteriaCommand, SheetsFilterService, SmartToggleSheetsFilterCommand, ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, FILTER_MUTATIONS, SetSheetsFilterRangeMutation, SetSheetsFilterCriteriaMutation, RemoveSheetsFilterMutation, ReCalcSheetsFilterMutation, RemoveSheetFilterCommand, SetSheetFilterRangeCommand, UniverSheetsFilterPlugin } from "@univerjs/sheets-filter";
|
|
8
|
+
import { RefRangeService, SheetsSelectionsService, getSheetCommandTarget, RangeProtectionPermissionViewPoint, WorksheetFilterPermission, WorksheetViewPermission, expandToContinuousRange, SheetInterceptorService, SetRangeValuesMutation, INTERCEPTOR_POINT } from "@univerjs/sheets";
|
|
9
|
+
import { SetCellEditVisibleOperation, SheetPermissionInterceptorBaseController, SheetsUIPart, getObservableWithExclusiveRange$, getCurrentRangeDisable$, whenSheetEditorFocused, SheetSkeletonManagerService, ISheetSelectionRenderService, SelectionShape, getCoordByCell, SheetsRenderService, SheetCanvasPopManagerService } from "@univerjs/sheets-ui";
|
|
10
|
+
import { ILayoutService, useObservable, useComponentsOfPart, ComponentContainer, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, KeyCode, MetaKeys, ComponentManager, IShortcutService, IMenuManagerService, IMessageService } from "@univerjs/ui";
|
|
12
11
|
import { BehaviorSubject, ReplaySubject, of, Subject, merge, combineLatest, throttleTime, startWith, map, shareReplay, switchMap, filter, takeUntil, distinctUntilChanged } from "rxjs";
|
|
12
|
+
import { Select, RadioGroup, Radio, Input, Checkbox, Tooltip, Button, Segmented, MessageType } from "@univerjs/design";
|
|
13
13
|
import { Rect, Shape, IRenderManagerService } from "@univerjs/engine-render";
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import React__default, { forwardRef, useRef, createElement, useCallback, useMemo as useMemo$1, version, isValidElement, useEffect, useState } from "react";
|
|
16
16
|
import ReactDOM, { flushSync } from "react-dom";
|
|
17
|
-
const PLUGIN_CONFIG_KEY = "sheets-filter-ui.config", defaultPluginConfig = {}
|
|
18
|
-
id: "sheet.command.set-filter-range",
|
|
19
|
-
type: CommandType.COMMAND,
|
|
20
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
21
|
-
const sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), instanceSrv = accessor.get(IUniverInstanceService), { unitId, subUnitId, range } = params;
|
|
22
|
-
if (!getSheetCommandTarget(instanceSrv, params) || sheetsFilterService.getFilterModel(unitId, subUnitId)) return !1;
|
|
23
|
-
if (range.endRow === range.startRow) {
|
|
24
|
-
const messageService = accessor.get(IMessageService, Quantity.OPTIONAL), localeService = accessor.get(LocaleService);
|
|
25
|
-
return messageService == null || messageService.show({ type: MessageType.Warning, content: localeService.t("sheets-filter.command.not-valid-filter-range") }), !1;
|
|
26
|
-
}
|
|
27
|
-
const redoMutation = { id: SetSheetsFilterRangeMutation.id, params: { unitId, subUnitId, range } }, result = commandService.syncExecuteCommand(redoMutation.id, redoMutation.params);
|
|
28
|
-
return result && undoRedoService.pushUndoRedo({
|
|
29
|
-
unitID: unitId,
|
|
30
|
-
undoMutations: [{ id: RemoveSheetsFilterMutation.id, params: { unitId, subUnitId } }],
|
|
31
|
-
redoMutations: [redoMutation]
|
|
32
|
-
}), result;
|
|
33
|
-
}, "handler")
|
|
34
|
-
}, RemoveSheetFilterCommand = {
|
|
35
|
-
id: "sheet.command.remove-sheet-filter",
|
|
36
|
-
type: CommandType.COMMAND,
|
|
37
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
38
|
-
const univerInstanceService = accessor.get(IUniverInstanceService), sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), commandTarget = getSheetCommandTarget(univerInstanceService, params);
|
|
39
|
-
if (!commandTarget) return !1;
|
|
40
|
-
const { unitId, subUnitId } = commandTarget, filterModel = sheetsFilterService.getFilterModel(unitId, subUnitId);
|
|
41
|
-
if (!filterModel) return !1;
|
|
42
|
-
const autoFilter = filterModel == null ? void 0 : filterModel.serialize(), undoMutations = destructFilterModel(unitId, subUnitId, autoFilter), result = commandService.syncExecuteCommand(RemoveSheetsFilterMutation.id, { unitId, subUnitId });
|
|
43
|
-
return result && undoRedoService.pushUndoRedo({
|
|
44
|
-
unitID: unitId,
|
|
45
|
-
undoMutations,
|
|
46
|
-
redoMutations: [{ id: RemoveSheetsFilterMutation.id, params: { unitId, subUnitId } }]
|
|
47
|
-
}), result;
|
|
48
|
-
}, "handler")
|
|
49
|
-
}, SmartToggleSheetsFilterCommand = {
|
|
50
|
-
id: "sheet.command.smart-toggle-filter",
|
|
51
|
-
type: CommandType.COMMAND,
|
|
52
|
-
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
53
|
-
const univerInstanceService = accessor.get(IUniverInstanceService), sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), currentWorkbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), currentWorksheet = currentWorkbook == null ? void 0 : currentWorkbook.getActiveSheet();
|
|
54
|
-
if (!currentWorksheet || !currentWorkbook) return !1;
|
|
55
|
-
const unitId = currentWorkbook.getUnitId(), subUnitId = currentWorksheet.getSheetId();
|
|
56
|
-
if (sheetsFilterService.getFilterModel(unitId, subUnitId))
|
|
57
|
-
return commandService.executeCommand(RemoveSheetFilterCommand.id, { unitId, subUnitId });
|
|
58
|
-
const lastSelection = accessor.get(SheetsSelectionsService).getCurrentLastSelection();
|
|
59
|
-
if (!lastSelection) return !1;
|
|
60
|
-
const startRange = lastSelection.range, targetFilterRange = isSingleCellSelection(lastSelection) ? expandToContinuousRange(startRange, { left: !0, right: !0, up: !0, down: !0 }, currentWorksheet) : startRange;
|
|
61
|
-
return commandService.executeCommand(SetSheetFilterRangeCommand.id, {
|
|
62
|
-
unitId,
|
|
63
|
-
subUnitId,
|
|
64
|
-
range: targetFilterRange
|
|
65
|
-
});
|
|
66
|
-
}, "handler")
|
|
67
|
-
}, SetSheetsFilterCriteriaCommand = {
|
|
68
|
-
id: "sheet.command.set-filter-criteria",
|
|
69
|
-
type: CommandType.COMMAND,
|
|
70
|
-
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
71
|
-
const sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), { unitId, subUnitId, col, criteria } = params, filterModel = sheetsFilterService.getFilterModel(unitId, subUnitId);
|
|
72
|
-
if (!filterModel) return !1;
|
|
73
|
-
const range = filterModel.getRange();
|
|
74
|
-
if (!range || col < range.startColumn || col > range.endColumn) return !1;
|
|
75
|
-
const filterColumn = filterModel.getFilterColumn(col), undoMutation = destructFilterColumn(unitId, subUnitId, col, filterColumn), redoMutation = {
|
|
76
|
-
id: SetSheetsFilterCriteriaMutation.id,
|
|
77
|
-
params: {
|
|
78
|
-
unitId,
|
|
79
|
-
subUnitId,
|
|
80
|
-
col,
|
|
81
|
-
criteria
|
|
82
|
-
}
|
|
83
|
-
}, result = commandService.syncExecuteCommand(redoMutation.id, redoMutation.params);
|
|
84
|
-
return result && undoRedoService.pushUndoRedo({
|
|
85
|
-
unitID: unitId,
|
|
86
|
-
undoMutations: [undoMutation],
|
|
87
|
-
redoMutations: [redoMutation]
|
|
88
|
-
}), result;
|
|
89
|
-
}, "handler")
|
|
90
|
-
}, ClearSheetsFilterCriteriaCommand = {
|
|
91
|
-
id: "sheet.command.clear-filter-criteria",
|
|
92
|
-
type: CommandType.COMMAND,
|
|
93
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
94
|
-
const sheetsFilterService = accessor.get(SheetsFilterService), undoRedoService = accessor.get(IUndoRedoService), commandService = accessor.get(ICommandService), instanceSrv = accessor.get(IUniverInstanceService), commandTarget = getSheetCommandTarget(instanceSrv, params);
|
|
95
|
-
if (!commandTarget) return !1;
|
|
96
|
-
const { unitId, subUnitId } = commandTarget, filterModel = sheetsFilterService.getFilterModel(commandTarget.unitId, commandTarget.subUnitId);
|
|
97
|
-
if (!filterModel) return !1;
|
|
98
|
-
const autoFilter = filterModel.serialize(), undoMutations = destructFilterCriteria(unitId, subUnitId, autoFilter), redoMutations = generateRemoveCriteriaMutations(unitId, subUnitId, autoFilter);
|
|
99
|
-
return sequenceExecute(redoMutations, commandService).result ? (undoRedoService.pushUndoRedo({
|
|
100
|
-
unitID: unitId,
|
|
101
|
-
undoMutations,
|
|
102
|
-
redoMutations
|
|
103
|
-
}), !0) : !1;
|
|
104
|
-
}, "handler")
|
|
105
|
-
}, ReCalcSheetsFilterCommand = {
|
|
106
|
-
id: "sheet.command.re-calc-filter",
|
|
107
|
-
type: CommandType.COMMAND,
|
|
108
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
109
|
-
const sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), instanceSrv = accessor.get(IUniverInstanceService), commandTarget = getSheetCommandTarget(instanceSrv, params);
|
|
110
|
-
if (!commandTarget) return !1;
|
|
111
|
-
const { unitId, subUnitId } = commandTarget;
|
|
112
|
-
return sheetsFilterService.getFilterModel(commandTarget.unitId, commandTarget.subUnitId) ? commandService.executeCommand(ReCalcSheetsFilterMutation.id, { unitId, subUnitId }) : !1;
|
|
113
|
-
}, "handler")
|
|
114
|
-
};
|
|
115
|
-
function destructFilterModel(unitId, subUnitId, autoFilter) {
|
|
116
|
-
const mutations = [], setFilterMutation = {
|
|
117
|
-
id: SetSheetsFilterRangeMutation.id,
|
|
118
|
-
params: {
|
|
119
|
-
unitId,
|
|
120
|
-
subUnitId,
|
|
121
|
-
range: autoFilter.ref
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
return mutations.push(setFilterMutation), destructFilterCriteria(unitId, subUnitId, autoFilter).forEach((m2) => mutations.push(m2)), mutations;
|
|
125
|
-
}
|
|
126
|
-
__name(destructFilterModel, "destructFilterModel");
|
|
127
|
-
function destructFilterCriteria(unitId, subUnitId, autoFilter) {
|
|
128
|
-
var _a13;
|
|
129
|
-
const mutations = [];
|
|
130
|
-
return (_a13 = autoFilter.filterColumns) == null || _a13.forEach((filterColumn) => {
|
|
131
|
-
const setFilterCriteriaMutation = {
|
|
132
|
-
id: SetSheetsFilterCriteriaMutation.id,
|
|
133
|
-
params: {
|
|
134
|
-
unitId,
|
|
135
|
-
subUnitId,
|
|
136
|
-
col: filterColumn.colId,
|
|
137
|
-
criteria: filterColumn
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
mutations.push(setFilterCriteriaMutation);
|
|
141
|
-
}), mutations;
|
|
142
|
-
}
|
|
143
|
-
__name(destructFilterCriteria, "destructFilterCriteria");
|
|
144
|
-
function generateRemoveCriteriaMutations(unitId, subUnitId, autoFilter) {
|
|
145
|
-
var _a13;
|
|
146
|
-
const mutations = [];
|
|
147
|
-
return (_a13 = autoFilter.filterColumns) == null || _a13.forEach((filterColumn) => {
|
|
148
|
-
const removeFilterCriteriaMutation = {
|
|
149
|
-
id: SetSheetsFilterCriteriaMutation.id,
|
|
150
|
-
params: {
|
|
151
|
-
unitId,
|
|
152
|
-
subUnitId,
|
|
153
|
-
col: filterColumn.colId,
|
|
154
|
-
criteria: null
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
mutations.push(removeFilterCriteriaMutation);
|
|
158
|
-
}), mutations;
|
|
159
|
-
}
|
|
160
|
-
__name(generateRemoveCriteriaMutations, "generateRemoveCriteriaMutations");
|
|
161
|
-
function destructFilterColumn(unitId, subUnitId, colId, filterColumn) {
|
|
162
|
-
if (!filterColumn)
|
|
163
|
-
return {
|
|
164
|
-
id: SetSheetsFilterCriteriaMutation.id,
|
|
165
|
-
params: {
|
|
166
|
-
unitId,
|
|
167
|
-
subUnitId,
|
|
168
|
-
col: colId,
|
|
169
|
-
criteria: null
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
const serialize = filterColumn.serialize();
|
|
173
|
-
return {
|
|
174
|
-
id: SetSheetsFilterCriteriaMutation.id,
|
|
175
|
-
params: {
|
|
176
|
-
unitId,
|
|
177
|
-
subUnitId,
|
|
178
|
-
col: colId,
|
|
179
|
-
criteria: serialize
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
__name(destructFilterColumn, "destructFilterColumn");
|
|
17
|
+
const PLUGIN_CONFIG_KEY = "sheets-filter-ui.config", defaultPluginConfig = {};
|
|
184
18
|
var OperatorOrder = /* @__PURE__ */ ((OperatorOrder2) => (OperatorOrder2[OperatorOrder2.FIRST = 0] = "FIRST", OperatorOrder2[OperatorOrder2.SECOND = 1] = "SECOND", OperatorOrder2))(OperatorOrder || {}), ExtendCustomFilterOperator = /* @__PURE__ */ ((ExtendCustomFilterOperator2) => (ExtendCustomFilterOperator2.NONE = "none", ExtendCustomFilterOperator2.STARTS_WITH = "startsWith", ExtendCustomFilterOperator2.DOES_NOT_START_WITH = "doesNotStartWith", ExtendCustomFilterOperator2.ENDS_WITH = "endsWith", ExtendCustomFilterOperator2.DOES_NOT_END_WITH = "doesNotEndWith", ExtendCustomFilterOperator2.CONTAINS = "contains", ExtendCustomFilterOperator2.DOES_NOT_CONTAIN = "doesNotContain", ExtendCustomFilterOperator2.EQUALS = "equals", ExtendCustomFilterOperator2.NOT_EQUALS = "notEquals", ExtendCustomFilterOperator2.EMPTY = "empty", ExtendCustomFilterOperator2.NOT_EMPTY = "notEmpty", ExtendCustomFilterOperator2.BETWEEN = "between", ExtendCustomFilterOperator2.NOT_BETWEEN = "notBetween", ExtendCustomFilterOperator2.CUSTOM = "custom", ExtendCustomFilterOperator2))(ExtendCustomFilterOperator || {}), FilterConditionItems;
|
|
185
19
|
((FilterConditionItems2) => {
|
|
186
20
|
FilterConditionItems2.NONE = {
|
|
@@ -1468,7 +1302,7 @@ function _objectWithoutPropertiesLoose(r, e2) {
|
|
|
1468
1302
|
if (r == null) return {};
|
|
1469
1303
|
var t2 = {};
|
|
1470
1304
|
for (var n2 in r) if ({}.hasOwnProperty.call(r, n2)) {
|
|
1471
|
-
if (e2.
|
|
1305
|
+
if (e2.includes(n2)) continue;
|
|
1472
1306
|
t2[n2] = r[n2];
|
|
1473
1307
|
}
|
|
1474
1308
|
return t2;
|
|
@@ -1478,8 +1312,8 @@ function _objectWithoutProperties(e2, t2) {
|
|
|
1478
1312
|
if (e2 == null) return {};
|
|
1479
1313
|
var o, r, i = _objectWithoutPropertiesLoose(e2, t2);
|
|
1480
1314
|
if (Object.getOwnPropertySymbols) {
|
|
1481
|
-
var
|
|
1482
|
-
for (r = 0; r <
|
|
1315
|
+
var s = Object.getOwnPropertySymbols(e2);
|
|
1316
|
+
for (r = 0; r < s.length; r++) o = s[r], t2.includes(o) || {}.propertyIsEnumerable.call(e2, o) && (i[o] = e2[o]);
|
|
1483
1317
|
}
|
|
1484
1318
|
return i;
|
|
1485
1319
|
}
|
|
@@ -2346,11 +2180,18 @@ const useOriginScroll = /* @__PURE__ */ __name(function(isScrollAtTop, isScrollA
|
|
|
2346
2180
|
}, "useOriginScroll");
|
|
2347
2181
|
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, horizontalScroll, onWheelDelta) {
|
|
2348
2182
|
var offsetRef = useRef(0), nextFrameRef = useRef(null), wheelValueRef = useRef(null), isMouseScrollRef = useRef(!1), originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);
|
|
2349
|
-
function onWheelY(
|
|
2350
|
-
wrapperRaf.cancel(nextFrameRef.current),
|
|
2351
|
-
var
|
|
2352
|
-
|
|
2353
|
-
|
|
2183
|
+
function onWheelY(e2, deltaY) {
|
|
2184
|
+
if (wrapperRaf.cancel(nextFrameRef.current), !originScroll(!1, deltaY)) {
|
|
2185
|
+
var event = e2;
|
|
2186
|
+
if (!event._virtualHandled)
|
|
2187
|
+
event._virtualHandled = !0;
|
|
2188
|
+
else
|
|
2189
|
+
return;
|
|
2190
|
+
offsetRef.current += deltaY, wheelValueRef.current = deltaY, isFF || event.preventDefault(), nextFrameRef.current = wrapperRaf(function() {
|
|
2191
|
+
var patchMultiple = isMouseScrollRef.current ? 10 : 1;
|
|
2192
|
+
onWheelDelta(offsetRef.current * patchMultiple, !1), offsetRef.current = 0;
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2354
2195
|
}
|
|
2355
2196
|
__name(onWheelY, "onWheelY");
|
|
2356
2197
|
function onWheelX(event, deltaX) {
|
|
@@ -2449,11 +2290,13 @@ function useMobileTouchMove(inVirtual, listRef, callback) {
|
|
|
2449
2290
|
var touchedRef = useRef(!1), touchXRef = useRef(0), touchYRef = useRef(0), elementRef = useRef(null), intervalRef = useRef(null), cleanUpEvents, onTouchMove = /* @__PURE__ */ __name(function(e2) {
|
|
2450
2291
|
if (touchedRef.current) {
|
|
2451
2292
|
var currentX = Math.ceil(e2.touches[0].pageX), currentY = Math.ceil(e2.touches[0].pageY), offsetX = touchXRef.current - currentX, offsetY = touchYRef.current - currentY, _isHorizontal = Math.abs(offsetX) > Math.abs(offsetY);
|
|
2452
|
-
_isHorizontal ? touchXRef.current = currentX : touchYRef.current = currentY
|
|
2293
|
+
_isHorizontal ? touchXRef.current = currentX : touchYRef.current = currentY;
|
|
2294
|
+
var scrollHandled = callback(_isHorizontal, _isHorizontal ? offsetX : offsetY, !1, e2);
|
|
2295
|
+
scrollHandled && e2.preventDefault(), clearInterval(intervalRef.current), scrollHandled && (intervalRef.current = setInterval(function() {
|
|
2453
2296
|
_isHorizontal ? offsetX *= SMOOTH_PTG : offsetY *= SMOOTH_PTG;
|
|
2454
2297
|
var offset = Math.floor(_isHorizontal ? offsetX : offsetY);
|
|
2455
2298
|
(!callback(_isHorizontal, offset, !0) || Math.abs(offset) <= 0.1) && clearInterval(intervalRef.current);
|
|
2456
|
-
}, 16);
|
|
2299
|
+
}, 16));
|
|
2457
2300
|
}
|
|
2458
2301
|
}, "onTouchMove"), onTouchEnd = /* @__PURE__ */ __name(function() {
|
|
2459
2302
|
touchedRef.current = !1, cleanUpEvents();
|
|
@@ -2778,16 +2621,18 @@ function RawList(props, ref) {
|
|
|
2778
2621
|
return newTop;
|
|
2779
2622
|
});
|
|
2780
2623
|
}), _useFrameWheel = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, !!scrollWidth, onWheelDelta), _useFrameWheel2 = _slicedToArray(_useFrameWheel, 2), onRawWheel = _useFrameWheel2[0], onFireFoxScroll = _useFrameWheel2[1];
|
|
2781
|
-
useMobileTouchMove(useVirtual, componentRef, function(isHorizontal, delta, smoothOffset) {
|
|
2782
|
-
|
|
2624
|
+
useMobileTouchMove(useVirtual, componentRef, function(isHorizontal, delta, smoothOffset, e2) {
|
|
2625
|
+
var event = e2;
|
|
2626
|
+
return originScroll(isHorizontal, delta, smoothOffset) ? !1 : !event || !event._virtualHandled ? (event && (event._virtualHandled = !0), onRawWheel({
|
|
2783
2627
|
preventDefault: /* @__PURE__ */ __name(function() {
|
|
2784
2628
|
}, "preventDefault"),
|
|
2785
2629
|
deltaX: isHorizontal ? delta : 0,
|
|
2786
2630
|
deltaY: isHorizontal ? 0 : delta
|
|
2787
|
-
}), !0);
|
|
2631
|
+
}), !0) : !1;
|
|
2788
2632
|
}), useLayoutEffect(function() {
|
|
2789
2633
|
function onMozMousePixelScroll(e2) {
|
|
2790
|
-
|
|
2634
|
+
var scrollingUpAtTop = isScrollAtTop && e2.detail < 0, scrollingDownAtBottom = isScrollAtBottom && e2.detail > 0;
|
|
2635
|
+
useVirtual && !scrollingUpAtTop && !scrollingDownAtBottom && e2.preventDefault();
|
|
2791
2636
|
}
|
|
2792
2637
|
__name(onMozMousePixelScroll, "onMozMousePixelScroll");
|
|
2793
2638
|
var componentEle = componentRef.current;
|
|
@@ -2800,7 +2645,7 @@ function RawList(props, ref) {
|
|
|
2800
2645
|
}), function() {
|
|
2801
2646
|
componentEle.removeEventListener("wheel", onRawWheel), componentEle.removeEventListener("DOMMouseScroll", onFireFoxScroll), componentEle.removeEventListener("MozMousePixelScroll", onMozMousePixelScroll);
|
|
2802
2647
|
};
|
|
2803
|
-
}, [useVirtual]), useLayoutEffect(function() {
|
|
2648
|
+
}, [useVirtual, isScrollAtTop, isScrollAtBottom]), useLayoutEffect(function() {
|
|
2804
2649
|
if (scrollWidth) {
|
|
2805
2650
|
var newOffsetLeft = keepInHorizontalRange(offsetLeft);
|
|
2806
2651
|
setOffsetLeft(newOffsetLeft), triggerScroll({
|
|
@@ -2960,7 +2805,63 @@ function useFilterByOptions(localeService) {
|
|
|
2960
2805
|
);
|
|
2961
2806
|
}
|
|
2962
2807
|
__name(useFilterByOptions, "useFilterByOptions");
|
|
2963
|
-
|
|
2808
|
+
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
2809
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2810
|
+
return {
|
|
2811
|
+
id: SmartToggleSheetsFilterCommand.id,
|
|
2812
|
+
type: MenuItemType.BUTTON_SELECTOR,
|
|
2813
|
+
icon: "FilterSingle",
|
|
2814
|
+
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
2815
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2816
|
+
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
2817
|
+
disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, { worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission], rangeTypes: [RangeProtectionPermissionViewPoint] }))
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
2820
|
+
__name(SmartToggleFilterMenuItemFactory, "SmartToggleFilterMenuItemFactory");
|
|
2821
|
+
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
2822
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2823
|
+
return {
|
|
2824
|
+
id: ClearSheetsFilterCriteriaCommand.id,
|
|
2825
|
+
type: MenuItemType.BUTTON,
|
|
2826
|
+
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
2827
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2828
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
2829
|
+
var _a13;
|
|
2830
|
+
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
2831
|
+
}))
|
|
2832
|
+
};
|
|
2833
|
+
}
|
|
2834
|
+
__name(ClearFilterCriteriaMenuItemFactory, "ClearFilterCriteriaMenuItemFactory");
|
|
2835
|
+
function ReCalcFilterMenuItemFactory(accessor) {
|
|
2836
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2837
|
+
return {
|
|
2838
|
+
id: ReCalcSheetsFilterCommand.id,
|
|
2839
|
+
type: MenuItemType.BUTTON,
|
|
2840
|
+
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
2841
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2842
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
2843
|
+
var _a13;
|
|
2844
|
+
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
2845
|
+
}))
|
|
2846
|
+
};
|
|
2847
|
+
}
|
|
2848
|
+
__name(ReCalcFilterMenuItemFactory, "ReCalcFilterMenuItemFactory");
|
|
2849
|
+
const menuSchema = {
|
|
2850
|
+
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
2851
|
+
[SmartToggleSheetsFilterCommand.id]: {
|
|
2852
|
+
order: 10,
|
|
2853
|
+
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
2854
|
+
[ClearSheetsFilterCriteriaCommand.id]: {
|
|
2855
|
+
order: 0,
|
|
2856
|
+
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
2857
|
+
},
|
|
2858
|
+
[ReCalcSheetsFilterCommand.id]: {
|
|
2859
|
+
order: 1,
|
|
2860
|
+
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
}, SmartToggleFilterShortcut = {
|
|
2964
2865
|
id: SmartToggleSheetsFilterCommand.id,
|
|
2965
2866
|
binding: KeyCode.L | MetaKeys.CTRL_COMMAND | MetaKeys.SHIFT,
|
|
2966
2867
|
description: "sheets-filter.shortcut.smart-toggle-filter",
|
|
@@ -3175,63 +3076,6 @@ SheetsFilterUIMobileController = __decorateClass$4([
|
|
|
3175
3076
|
__decorateParam$4(0, IRenderManagerService),
|
|
3176
3077
|
__decorateParam$4(1, Inject(SheetsRenderService))
|
|
3177
3078
|
], SheetsFilterUIMobileController);
|
|
3178
|
-
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
3179
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3180
|
-
return {
|
|
3181
|
-
id: SmartToggleSheetsFilterCommand.id,
|
|
3182
|
-
type: MenuItemType.BUTTON_SELECTOR,
|
|
3183
|
-
icon: "FilterSingle",
|
|
3184
|
-
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
3185
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3186
|
-
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
3187
|
-
disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, { worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission], rangeTypes: [RangeProtectionPermissionViewPoint] }))
|
|
3188
|
-
};
|
|
3189
|
-
}
|
|
3190
|
-
__name(SmartToggleFilterMenuItemFactory, "SmartToggleFilterMenuItemFactory");
|
|
3191
|
-
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
3192
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3193
|
-
return {
|
|
3194
|
-
id: ClearSheetsFilterCriteriaCommand.id,
|
|
3195
|
-
type: MenuItemType.BUTTON,
|
|
3196
|
-
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
3197
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3198
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
3199
|
-
var _a13;
|
|
3200
|
-
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
3201
|
-
}))
|
|
3202
|
-
};
|
|
3203
|
-
}
|
|
3204
|
-
__name(ClearFilterCriteriaMenuItemFactory, "ClearFilterCriteriaMenuItemFactory");
|
|
3205
|
-
function ReCalcFilterMenuItemFactory(accessor) {
|
|
3206
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3207
|
-
return {
|
|
3208
|
-
id: ReCalcSheetsFilterCommand.id,
|
|
3209
|
-
type: MenuItemType.BUTTON,
|
|
3210
|
-
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
3211
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3212
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
3213
|
-
var _a13;
|
|
3214
|
-
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
3215
|
-
}))
|
|
3216
|
-
};
|
|
3217
|
-
}
|
|
3218
|
-
__name(ReCalcFilterMenuItemFactory, "ReCalcFilterMenuItemFactory");
|
|
3219
|
-
const menuSchema = {
|
|
3220
|
-
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
3221
|
-
[SmartToggleSheetsFilterCommand.id]: {
|
|
3222
|
-
order: 10,
|
|
3223
|
-
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
3224
|
-
[ClearSheetsFilterCriteriaCommand.id]: {
|
|
3225
|
-
order: 0,
|
|
3226
|
-
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
3227
|
-
},
|
|
3228
|
-
[ReCalcSheetsFilterCommand.id]: {
|
|
3229
|
-
order: 1,
|
|
3230
|
-
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
3231
|
-
}
|
|
3232
|
-
}
|
|
3233
|
-
}
|
|
3234
|
-
};
|
|
3235
3079
|
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3236
3080
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3237
3081
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -3414,14 +3258,8 @@ UniverSheetsFilterUIWorkerPlugin = __decorateClass([
|
|
|
3414
3258
|
], UniverSheetsFilterUIWorkerPlugin);
|
|
3415
3259
|
export {
|
|
3416
3260
|
ChangeFilterByOperation,
|
|
3417
|
-
ClearSheetsFilterCriteriaCommand,
|
|
3418
3261
|
CloseFilterPanelOperation,
|
|
3419
3262
|
OpenFilterPanelOperation,
|
|
3420
|
-
ReCalcSheetsFilterCommand,
|
|
3421
|
-
RemoveSheetFilterCommand,
|
|
3422
|
-
SetSheetFilterRangeCommand,
|
|
3423
|
-
SetSheetsFilterCriteriaCommand,
|
|
3424
|
-
SmartToggleSheetsFilterCommand,
|
|
3425
3263
|
UniverSheetsFilterMobileUIPlugin,
|
|
3426
3264
|
UniverSheetsFilterUIPlugin,
|
|
3427
3265
|
UniverSheetsFilterUIWorkerPlugin
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
{
|
|
1
|
+
const locale = {
|
|
2
2
|
"sheets-filter": {
|
|
3
|
-
|
|
3
|
+
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "Toggle Filter",
|
|
5
5
|
"clear-filter-criteria": "Clear Filter Conditions",
|
|
6
6
|
"re-calc-filter-conditions": "Re-calc Filter Conditions"
|
|
7
7
|
},
|
|
8
|
-
|
|
8
|
+
command: {
|
|
9
9
|
"not-valid-filter-range": "The selected range only has one row and not valid for filter."
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
shortcut: {
|
|
12
12
|
"smart-toggle-filter": "Toggle Filter"
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
panel: {
|
|
15
15
|
"clear-filter": "Clear Filter",
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
cancel: "Cancel",
|
|
17
|
+
confirm: "Confirm",
|
|
18
18
|
"by-values": "By Values",
|
|
19
19
|
"by-conditions": "By Conditions",
|
|
20
20
|
"filter-only": "Filter Only",
|
|
21
21
|
"search-placeholder": "Use space to separate keywords",
|
|
22
22
|
"select-all": "Select All",
|
|
23
23
|
"input-values-placeholder": "Input Values",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
and: "AND",
|
|
25
|
+
or: "OR",
|
|
26
|
+
empty: "(empty)",
|
|
27
27
|
"?": "Use “?” to represent a single character.",
|
|
28
28
|
"*": "Use “*” to represent multiple characters."
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
conditions: {
|
|
31
|
+
none: "None",
|
|
32
|
+
empty: "Is Empty",
|
|
33
33
|
"not-empty": "Is Not Empty",
|
|
34
34
|
"text-contains": "Text Contains",
|
|
35
35
|
"does-not-contain": "Text Does Not Contain",
|
|
36
36
|
"starts-with": "Text Starts With",
|
|
37
37
|
"ends-with": "Text Ends With",
|
|
38
|
-
|
|
38
|
+
equals: "Text Equals",
|
|
39
39
|
"greater-than": "Greater Than",
|
|
40
40
|
"greater-than-or-equal": "Greater Than Or Equal To",
|
|
41
41
|
"less-than": "Less Than",
|
|
42
42
|
"less-than-or-equal": "Less Than Or Equal To",
|
|
43
|
-
|
|
43
|
+
equal: "Equal",
|
|
44
44
|
"not-equal": "Not Equal",
|
|
45
|
-
|
|
45
|
+
between: "Between",
|
|
46
46
|
"not-between": "Not Between",
|
|
47
|
-
|
|
47
|
+
custom: "Custom"
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
msg: {
|
|
50
50
|
"filter-header-forbidden": "You can't move the header row of a filter."
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
locale as default
|
|
56
|
+
};
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
{
|
|
1
|
+
const locale = {
|
|
2
2
|
"sheets-filter": {
|
|
3
|
-
|
|
3
|
+
toolbar: {
|
|
4
4
|
"smart-toggle-filter-tooltip": "تغییر حالت فیلتر",
|
|
5
5
|
"clear-filter-criteria": "پاک کردن شرایط فیلتر",
|
|
6
6
|
"re-calc-filter-conditions": "بازمحاسبه شرایط فیلتر"
|
|
7
7
|
},
|
|
8
|
-
|
|
8
|
+
command: {
|
|
9
9
|
"not-valid-filter-range": "محدوده انتخاب شده فقط یک ردیف دارد و برای فیلتر معتبر نیست."
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
shortcut: {
|
|
12
12
|
"smart-toggle-filter": "تغییر حالت فیلتر"
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
panel: {
|
|
15
15
|
"clear-filter": "پاک کردن فیلتر",
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
cancel: "انصراف",
|
|
17
|
+
confirm: "تایید",
|
|
18
18
|
"by-values": "بر اساس مقادیر",
|
|
19
19
|
"by-conditions": "بر اساس شرایط",
|
|
20
20
|
"filter-only": "فقط فیلتر",
|
|
21
21
|
"search-placeholder": "برای جداسازی کلیدواژهها از فاصله استفاده کنید",
|
|
22
22
|
"select-all": "انتخاب همه",
|
|
23
23
|
"input-values-placeholder": "ورود مقادیر",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
and: "و",
|
|
25
|
+
or: "یا",
|
|
26
|
+
empty: "(خالی)",
|
|
27
27
|
"?": "برای نمایش یک کاراکتر از “?” استفاده کنید.",
|
|
28
28
|
"*": "برای نمایش چندین کاراکتر از “*” استفاده کنید."
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
conditions: {
|
|
31
|
+
none: "هیچ کدام",
|
|
32
|
+
empty: "خالی است",
|
|
33
33
|
"not-empty": "خالی نیست",
|
|
34
34
|
"text-contains": "شامل متن است",
|
|
35
35
|
"does-not-contain": "شامل متن نیست",
|
|
36
36
|
"starts-with": "با متن شروع میشود",
|
|
37
37
|
"ends-with": "با متن پایان مییابد",
|
|
38
|
-
|
|
38
|
+
equals: "برابر است با",
|
|
39
39
|
"greater-than": "بزرگتر از",
|
|
40
40
|
"greater-than-or-equal": "بزرگتر از یا برابر با",
|
|
41
41
|
"less-than": "کوچکتر از",
|
|
42
42
|
"less-than-or-equal": "کوچکتر از یا برابر با",
|
|
43
|
-
|
|
43
|
+
equal: "برابر است با",
|
|
44
44
|
"not-equal": "برابر نیست با",
|
|
45
|
-
|
|
45
|
+
between: "بین",
|
|
46
46
|
"not-between": "بین نیست",
|
|
47
|
-
|
|
47
|
+
custom: "سفارشی"
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
msg: {
|
|
50
50
|
"filter-header-forbidden": "شما نمیتوانید ردیف هدر یک فیلتر را جابهجا کنید."
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
locale as default
|
|
56
|
+
};
|