@univerjs/sheets-filter-ui 0.2.8 → 0.2.10
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 +2 -2
- package/lib/es/index.js +144 -115
- package/lib/types/commands/commands/sheets-filter.command.d.ts +42 -9
- package/lib/types/controllers/sheets-filter-permission.controller.d.ts +3 -2
- package/lib/types/controllers/{sheets-filter-ui.controller.d.ts → sheets-filter-ui-desktop.controller.d.ts} +4 -4
- package/lib/types/controllers/sheets-filter-ui-mobile.controller.d.ts +8 -0
- package/lib/types/{plugin.d.ts → filter-ui-desktop.plugin.d.ts} +6 -1
- package/lib/types/{mobile-plugin.d.ts → filter-ui-mobile.plugin.d.ts} +3 -1
- package/lib/types/index.d.ts +3 -3
- package/lib/types/{controllers/sheets-filter-render.controller.d.ts → views/render-modules/sheets-filter.render-controller.d.ts} +3 -5
- package/lib/umd/index.js +2 -2
- package/package.json +20 -20
- package/lib/types/controllers/sheets-filter-mobile-ui.controller.d.ts +0 -7
package/lib/es/index.js
CHANGED
|
@@ -2,15 +2,15 @@ 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 { CommandType,
|
|
6
|
-
import { SheetsFilterService,
|
|
5
|
+
import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService, Quantity, LocaleService, UniverInstanceType, sequenceExecute, BooleanNumber, createIdentifier, Disposable, Inject, extractPureTextFromCell, ILogService, Injector, IContextService, useDependency, ThemeService, RxDisposable, fromCallback, Tools, Plugin, DependentOn, Optional } from "@univerjs/core";
|
|
6
|
+
import { SheetsFilterService, SetSheetsFilterRangeMutation, RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, ReCalcSheetsFilterMutation, CustomFilterOperator, FILTER_MUTATIONS, UniverSheetsFilterPlugin } from "@univerjs/sheets-filter";
|
|
7
7
|
import { toModule, IRPCChannelService, fromModule } from "@univerjs/rpc";
|
|
8
8
|
import { IMessageService, ILayoutService, useObservable, useComponentsOfPart, ComponentContainer, KeyCode, MetaKeys, MenuGroup, MenuItemType, MenuPosition, getMenuHiddenObservable, ComponentManager, IShortcutService, IMenuService } from "@univerjs/ui";
|
|
9
9
|
import { BehaviorSubject, ReplaySubject, of, Subject, merge, combineLatest, throttleTime, startWith, map, shareReplay, switchMap, filter, takeUntil, distinctUntilChanged } from "rxjs";
|
|
10
|
-
import { SetCellEditVisibleOperation, SheetsUIPart, whenSheetEditorFocused, getCurrentRangeDisable$, SelectionShape, getCoordByCell, SheetSkeletonManagerService,
|
|
10
|
+
import { SetCellEditVisibleOperation, SheetsUIPart, whenSheetEditorFocused, getCurrentRangeDisable$, SelectionShape, getCoordByCell, SheetSkeletonManagerService, ISheetSelectionRenderService, SheetsRenderService, SheetCanvasPopManagerService, SheetPermissionInterceptorBaseController } from "@univerjs/sheets-ui";
|
|
11
11
|
import { Rect, Shape, IRenderManagerService } from "@univerjs/engine-render";
|
|
12
12
|
import { MessageType, Select, RadioGroup, Radio, Input, Checkbox, Tooltip, Button, Segmented } from "@univerjs/design";
|
|
13
|
-
import { SheetsSelectionsService, isSingleCellSelection, expandToContinuousRange, RefRangeService,
|
|
13
|
+
import { getSheetCommandTarget, SheetsSelectionsService, isSingleCellSelection, expandToContinuousRange, RefRangeService, WorksheetFilterPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, INTERCEPTOR_POINT, SheetInterceptorService } from "@univerjs/sheets";
|
|
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";
|
|
@@ -69,45 +69,64 @@ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width:
|
|
|
69
69
|
}));
|
|
70
70
|
});
|
|
71
71
|
FilterSingle.displayName = "FilterSingle";
|
|
72
|
-
const
|
|
73
|
-
id: "sheet.command.
|
|
72
|
+
const SetSheetFilterRangeCommand = {
|
|
73
|
+
id: "sheet.command.set-filter-range",
|
|
74
74
|
type: CommandType.COMMAND,
|
|
75
|
-
handler: /* @__PURE__ */ __name(
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
-
|
|
79
|
-
if (filterModel) {
|
|
80
|
-
const autoFilter = filterModel == null ? void 0 : filterModel.serialize(), undoMutations = destructFilterModel(unitId, subUnitId, autoFilter), result2 = commandService.syncExecuteCommand(RemoveSheetsFilterMutation.id, { unitId, subUnitId });
|
|
81
|
-
return result2 && undoRedoService.pushUndoRedo({
|
|
82
|
-
unitID: unitId,
|
|
83
|
-
undoMutations,
|
|
84
|
-
redoMutations: [{ id: RemoveSheetsFilterMutation.id, params: { unitId, subUnitId } }]
|
|
85
|
-
}), result2;
|
|
86
|
-
}
|
|
87
|
-
const lastSelection = accessor.get(SheetsSelectionsService).getCurrentLastSelection();
|
|
88
|
-
if (!lastSelection) return !1;
|
|
89
|
-
const startRange = lastSelection.range, targetFilterRange = isSingleCellSelection(lastSelection) ? expandToContinuousRange(startRange, { left: !0, right: !0, up: !0, down: !0 }, currentWorksheet) : startRange;
|
|
90
|
-
if (targetFilterRange.endRow === targetFilterRange.startRow) {
|
|
75
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
76
|
+
const sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), instanceSrv = accessor.get(IUniverInstanceService), { unitId, subUnitId, range } = params;
|
|
77
|
+
if (!getSheetCommandTarget(instanceSrv, params) || sheetsFilterService.getFilterModel(unitId, subUnitId)) return !1;
|
|
78
|
+
if (range.endRow === range.startRow) {
|
|
91
79
|
const messageService = accessor.get(IMessageService, Quantity.OPTIONAL), localeService = accessor.get(LocaleService);
|
|
92
80
|
return messageService == null || messageService.show({ type: MessageType.Warning, content: localeService.t("sheets-filter.command.not-valid-filter-range") }), !1;
|
|
93
81
|
}
|
|
94
|
-
const redoMutation = { id: SetSheetsFilterRangeMutation.id, params: { unitId, subUnitId, range
|
|
82
|
+
const redoMutation = { id: SetSheetsFilterRangeMutation.id, params: { unitId, subUnitId, range } }, result = commandService.syncExecuteCommand(redoMutation.id, redoMutation.params);
|
|
95
83
|
return result && undoRedoService.pushUndoRedo({
|
|
96
84
|
unitID: unitId,
|
|
97
85
|
undoMutations: [{ id: RemoveSheetsFilterMutation.id, params: { unitId, subUnitId } }],
|
|
98
86
|
redoMutations: [redoMutation]
|
|
99
87
|
}), result;
|
|
100
88
|
}, "handler")
|
|
89
|
+
}, RemoveSheetFilterCommand = {
|
|
90
|
+
id: "sheet.command.remove-sheet-filter",
|
|
91
|
+
type: CommandType.COMMAND,
|
|
92
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
93
|
+
const univerInstanceService = accessor.get(IUniverInstanceService), sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), commandTarget = getSheetCommandTarget(univerInstanceService, params);
|
|
94
|
+
if (!commandTarget) return !1;
|
|
95
|
+
const { unitId, subUnitId } = commandTarget, filterModel = sheetsFilterService.getFilterModel(unitId, subUnitId);
|
|
96
|
+
if (!filterModel) return !1;
|
|
97
|
+
const autoFilter = filterModel == null ? void 0 : filterModel.serialize(), undoMutations = destructFilterModel(unitId, subUnitId, autoFilter), result = commandService.syncExecuteCommand(RemoveSheetsFilterMutation.id, { unitId, subUnitId });
|
|
98
|
+
return result && undoRedoService.pushUndoRedo({
|
|
99
|
+
unitID: unitId,
|
|
100
|
+
undoMutations,
|
|
101
|
+
redoMutations: [{ id: RemoveSheetsFilterMutation.id, params: { unitId, subUnitId } }]
|
|
102
|
+
}), result;
|
|
103
|
+
}, "handler")
|
|
104
|
+
}, SmartToggleSheetsFilterCommand = {
|
|
105
|
+
id: "sheet.command.smart-toggle-filter",
|
|
106
|
+
type: CommandType.COMMAND,
|
|
107
|
+
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
108
|
+
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();
|
|
109
|
+
if (!currentWorksheet || !currentWorkbook) return !1;
|
|
110
|
+
const unitId = currentWorkbook.getUnitId(), subUnitId = currentWorksheet.getSheetId();
|
|
111
|
+
if (sheetsFilterService.getFilterModel(unitId, subUnitId))
|
|
112
|
+
return commandService.executeCommand(RemoveSheetFilterCommand.id, { unitId, subUnitId });
|
|
113
|
+
const lastSelection = accessor.get(SheetsSelectionsService).getCurrentLastSelection();
|
|
114
|
+
if (!lastSelection) return !1;
|
|
115
|
+
const startRange = lastSelection.range, targetFilterRange = isSingleCellSelection(lastSelection) ? expandToContinuousRange(startRange, { left: !0, right: !0, up: !0, down: !0 }, currentWorksheet) : startRange;
|
|
116
|
+
return commandService.executeCommand(SetSheetFilterRangeCommand.id, {
|
|
117
|
+
unitId,
|
|
118
|
+
subUnitId,
|
|
119
|
+
range: targetFilterRange
|
|
120
|
+
});
|
|
121
|
+
}, "handler")
|
|
101
122
|
}, SetSheetsFilterCriteriaCommand = {
|
|
102
123
|
id: "sheet.command.set-filter-criteria",
|
|
103
124
|
type: CommandType.COMMAND,
|
|
104
125
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
105
126
|
const sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), { unitId, subUnitId, col, criteria } = params, filterModel = sheetsFilterService.getFilterModel(unitId, subUnitId);
|
|
106
|
-
if (!filterModel)
|
|
107
|
-
return !1;
|
|
127
|
+
if (!filterModel) return !1;
|
|
108
128
|
const range = filterModel.getRange();
|
|
109
|
-
if (!range || col < range.startColumn || col > range.endColumn)
|
|
110
|
-
return !1;
|
|
129
|
+
if (!range || col < range.startColumn || col > range.endColumn) return !1;
|
|
111
130
|
const filterColumn = filterModel.getFilterColumn(col), undoMutation = destructFilterColumn(unitId, subUnitId, col, filterColumn), redoMutation = {
|
|
112
131
|
id: SetSheetsFilterCriteriaMutation.id,
|
|
113
132
|
params: {
|
|
@@ -126,26 +145,26 @@ const SmartToggleSheetsFilterCommand = {
|
|
|
126
145
|
}, ClearSheetsFilterCriteriaCommand = {
|
|
127
146
|
id: "sheet.command.clear-filter-criteria",
|
|
128
147
|
type: CommandType.COMMAND,
|
|
129
|
-
handler: /* @__PURE__ */ __name((accessor) => {
|
|
130
|
-
const sheetsFilterService = accessor.get(SheetsFilterService), undoRedoService = accessor.get(IUndoRedoService), commandService = accessor.get(ICommandService),
|
|
131
|
-
if (!
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
148
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
149
|
+
const sheetsFilterService = accessor.get(SheetsFilterService), undoRedoService = accessor.get(IUndoRedoService), commandService = accessor.get(ICommandService), instanceSrv = accessor.get(IUniverInstanceService), commandTarget = getSheetCommandTarget(instanceSrv, params);
|
|
150
|
+
if (!commandTarget) return !1;
|
|
151
|
+
const { unitId, subUnitId } = commandTarget, filterModel = sheetsFilterService.getFilterModel(commandTarget.unitId, commandTarget.subUnitId);
|
|
152
|
+
if (!filterModel) return !1;
|
|
153
|
+
const autoFilter = filterModel.serialize(), undoMutations = destructFilterCriteria(unitId, subUnitId, autoFilter), redoMutations = generateRemoveCriteriaMutations(unitId, subUnitId, autoFilter);
|
|
154
|
+
return sequenceExecute(redoMutations, commandService).result ? (undoRedoService.pushUndoRedo({
|
|
135
155
|
unitID: unitId,
|
|
136
156
|
undoMutations,
|
|
137
157
|
redoMutations
|
|
138
|
-
}), !0;
|
|
158
|
+
}), !0) : !1;
|
|
139
159
|
}, "handler")
|
|
140
160
|
}, ReCalcSheetsFilterCommand = {
|
|
141
161
|
id: "sheet.command.re-calc-filter",
|
|
142
162
|
type: CommandType.COMMAND,
|
|
143
|
-
handler: /* @__PURE__ */ __name((accessor) => {
|
|
144
|
-
const sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService),
|
|
145
|
-
if (!
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return commandService.executeCommand(ReCalcSheetsFilterMutation.id, { unitId, subUnitId });
|
|
163
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
164
|
+
const sheetsFilterService = accessor.get(SheetsFilterService), commandService = accessor.get(ICommandService), instanceSrv = accessor.get(IUniverInstanceService), commandTarget = getSheetCommandTarget(instanceSrv, params);
|
|
165
|
+
if (!commandTarget) return !1;
|
|
166
|
+
const { unitId, subUnitId } = commandTarget;
|
|
167
|
+
return sheetsFilterService.getFilterModel(commandTarget.unitId, commandTarget.subUnitId) ? commandService.executeCommand(ReCalcSheetsFilterMutation.id, { unitId, subUnitId }) : !1;
|
|
149
168
|
}, "handler")
|
|
150
169
|
};
|
|
151
170
|
function destructFilterModel(unitId, subUnitId, autoFilter) {
|
|
@@ -2900,7 +2919,7 @@ function SmartToggleFilterMenuItemFactory(accessor) {
|
|
|
2900
2919
|
positions: [MenuPosition.TOOLBAR_START],
|
|
2901
2920
|
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2902
2921
|
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
2903
|
-
disabled$: getCurrentRangeDisable$(accessor, {
|
|
2922
|
+
disabled$: getCurrentRangeDisable$(accessor, { worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission], rangeTypes: [RangeProtectionPermissionViewPoint] })
|
|
2904
2923
|
};
|
|
2905
2924
|
}
|
|
2906
2925
|
__name(SmartToggleFilterMenuItemFactory, "SmartToggleFilterMenuItemFactory");
|
|
@@ -3018,17 +3037,12 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
|
|
|
3018
3037
|
const DEFAULT_Z_INDEX = 1e3, SHEETS_FILTER_BUTTON_Z_INDEX = 5e3;
|
|
3019
3038
|
var _a6;
|
|
3020
3039
|
let SheetsFilterRenderController = (_a6 = class extends RxDisposable {
|
|
3021
|
-
constructor(_context, _injector, _sheetSkeletonManagerService, _sheetsFilterService, _themeService, _sheetInterceptorService,
|
|
3040
|
+
constructor(_context, _injector, _sheetSkeletonManagerService, _sheetsFilterService, _themeService, _sheetInterceptorService, _commandService, _selectionRenderService) {
|
|
3022
3041
|
super();
|
|
3023
3042
|
__publicField(this, "_filterRangeShape", null);
|
|
3024
3043
|
__publicField(this, "_buttonRenderDisposable", null);
|
|
3025
3044
|
__publicField(this, "_filterButtonShapes", []);
|
|
3026
|
-
this._context = _context, this._injector = _injector, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._sheetsFilterService = _sheetsFilterService, this._themeService = _themeService, this._sheetInterceptorService = _sheetInterceptorService, this.
|
|
3027
|
-
SetSheetsFilterRangeMutation,
|
|
3028
|
-
SetSheetsFilterCriteriaMutation,
|
|
3029
|
-
RemoveSheetsFilterMutation,
|
|
3030
|
-
ReCalcSheetsFilterMutation
|
|
3031
|
-
].forEach((m2) => this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(m2.id))), this._initRenderer();
|
|
3045
|
+
this._context = _context, this._injector = _injector, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._sheetsFilterService = _sheetsFilterService, this._themeService = _themeService, this._sheetInterceptorService = _sheetInterceptorService, this._commandService = _commandService, this._selectionRenderService = _selectionRenderService, this._initRenderer();
|
|
3032
3046
|
}
|
|
3033
3047
|
_initRenderer() {
|
|
3034
3048
|
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
@@ -3054,18 +3068,15 @@ let SheetsFilterRenderController = (_a6 = class extends RxDisposable {
|
|
|
3054
3068
|
}),
|
|
3055
3069
|
takeUntil(this.dispose$)
|
|
3056
3070
|
).subscribe((renderParams) => {
|
|
3057
|
-
this._disposeRendering(), !(!renderParams || !renderParams.range) && (this._renderRange(renderParams.
|
|
3071
|
+
this._disposeRendering(), !(!renderParams || !renderParams.range) && (this._renderRange(renderParams.range, renderParams.skeleton), this._renderButtons(renderParams));
|
|
3058
3072
|
});
|
|
3059
3073
|
}
|
|
3060
|
-
_renderRange(
|
|
3061
|
-
const
|
|
3062
|
-
if (!renderer)
|
|
3063
|
-
return;
|
|
3064
|
-
const { scene } = renderer, { rangeWithCoord, style } = this._selectionRenderService.attachSelectionWithCoord({
|
|
3074
|
+
_renderRange(range, skeleton) {
|
|
3075
|
+
const { scene } = this._context, { rangeWithCoord, style } = this._selectionRenderService.attachSelectionWithCoord({
|
|
3065
3076
|
range,
|
|
3066
3077
|
primary: null,
|
|
3067
3078
|
style: null
|
|
3068
|
-
}), { rowHeaderWidth, columnHeaderHeight } = skeleton, filterRangeShape = this._filterRangeShape = new SelectionShape(scene, DEFAULT_Z_INDEX,
|
|
3079
|
+
}), { rowHeaderWidth, columnHeaderHeight } = skeleton, filterRangeShape = this._filterRangeShape = new SelectionShape(scene, DEFAULT_Z_INDEX, this._themeService, !0);
|
|
3069
3080
|
filterRangeShape.update(rangeWithCoord, rowHeaderWidth, columnHeaderHeight, {
|
|
3070
3081
|
hasAutoFill: !1,
|
|
3071
3082
|
fill: "rgba(0, 0, 0, 0.0)",
|
|
@@ -3073,11 +3084,8 @@ let SheetsFilterRenderController = (_a6 = class extends RxDisposable {
|
|
|
3073
3084
|
}), filterRangeShape.setEvent(!1), scene.makeDirty(!0);
|
|
3074
3085
|
}
|
|
3075
3086
|
_renderButtons(params) {
|
|
3076
|
-
const { range, filterModel, unitId, skeleton, worksheetId } = params,
|
|
3077
|
-
|
|
3078
|
-
return;
|
|
3079
|
-
const { scene } = currentRenderer;
|
|
3080
|
-
this._interceptCellContent(params.range);
|
|
3087
|
+
const { range, filterModel, unitId, skeleton, worksheetId } = params, { scene } = this._context;
|
|
3088
|
+
this._interceptCellContent(unitId, worksheetId, params.range);
|
|
3081
3089
|
const { startColumn, endColumn, startRow } = range;
|
|
3082
3090
|
for (let col = startColumn; col <= endColumn; col++) {
|
|
3083
3091
|
const key = `sheets-filter-button-${col}`, startPosition = getCoordByCell(startRow, col, scene, skeleton), { startX, startY, endX, endY } = startPosition, cellWidth = endX - startX, cellHeight = endY - startY;
|
|
@@ -3097,12 +3105,12 @@ let SheetsFilterRenderController = (_a6 = class extends RxDisposable {
|
|
|
3097
3105
|
}
|
|
3098
3106
|
scene.addObjects(this._filterButtonShapes), scene.makeDirty();
|
|
3099
3107
|
}
|
|
3100
|
-
_interceptCellContent(range) {
|
|
3108
|
+
_interceptCellContent(workbookId, worksheetId, range) {
|
|
3101
3109
|
const { startRow, startColumn, endColumn } = range;
|
|
3102
3110
|
this._buttonRenderDisposable = this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
|
|
3103
3111
|
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
|
3104
|
-
const { row, col } = pos;
|
|
3105
|
-
return row !== startRow || col < startColumn || col > endColumn ? next(cell) : next({
|
|
3112
|
+
const { row, col, unitId, subUnitId } = pos;
|
|
3113
|
+
return unitId !== workbookId || subUnitId !== worksheetId || row !== startRow || col < startColumn || col > endColumn ? next(cell) : next({
|
|
3106
3114
|
...cell,
|
|
3107
3115
|
// @ts-ignore
|
|
3108
3116
|
fontRenderExtension: {
|
|
@@ -3126,28 +3134,31 @@ SheetsFilterRenderController = __decorateClass$6([
|
|
|
3126
3134
|
__decorateParam$6(3, Inject(SheetsFilterService)),
|
|
3127
3135
|
__decorateParam$6(4, Inject(ThemeService)),
|
|
3128
3136
|
__decorateParam$6(5, Inject(SheetInterceptorService)),
|
|
3129
|
-
__decorateParam$6(6,
|
|
3130
|
-
__decorateParam$6(7,
|
|
3131
|
-
__decorateParam$6(8, IRenderManagerService),
|
|
3132
|
-
__decorateParam$6(9, ISheetSelectionRenderService)
|
|
3137
|
+
__decorateParam$6(6, ICommandService),
|
|
3138
|
+
__decorateParam$6(7, ISheetSelectionRenderService)
|
|
3133
3139
|
], SheetsFilterRenderController);
|
|
3134
3140
|
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3135
3141
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3136
3142
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3137
3143
|
return kind && result && __defProp$5(target, key, result), result;
|
|
3138
3144
|
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$5"), _a7;
|
|
3139
|
-
let
|
|
3140
|
-
constructor(_renderManagerService) {
|
|
3141
|
-
super(), this._renderManagerService = _renderManagerService, this.
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3145
|
+
let SheetsFilterUIMobileController = (_a7 = class extends RxDisposable {
|
|
3146
|
+
constructor(_renderManagerService, _sheetsRenderService) {
|
|
3147
|
+
super(), this._renderManagerService = _renderManagerService, this._sheetsRenderService = _sheetsRenderService, [
|
|
3148
|
+
SetSheetsFilterRangeMutation,
|
|
3149
|
+
SetSheetsFilterCriteriaMutation,
|
|
3150
|
+
RemoveSheetsFilterMutation,
|
|
3151
|
+
ReCalcSheetsFilterMutation
|
|
3152
|
+
].forEach((m2) => this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(m2.id))), this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
3153
|
+
UniverInstanceType.UNIVER_SHEET,
|
|
3154
|
+
[SheetsFilterRenderController]
|
|
3155
|
+
));
|
|
3156
|
+
}
|
|
3157
|
+
}, __name(_a7, "SheetsFilterUIMobileController"), _a7);
|
|
3158
|
+
SheetsFilterUIMobileController = __decorateClass$5([
|
|
3159
|
+
__decorateParam$5(0, IRenderManagerService),
|
|
3160
|
+
__decorateParam$5(1, Inject(SheetsRenderService))
|
|
3161
|
+
], SheetsFilterUIMobileController);
|
|
3151
3162
|
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3152
3163
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3153
3164
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -3155,9 +3166,9 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
|
|
|
3155
3166
|
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$4");
|
|
3156
3167
|
const DefaultSheetFilterUiConfig = {}, FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
|
|
3157
3168
|
var _a8;
|
|
3158
|
-
let
|
|
3159
|
-
constructor(_config, _injector, _componentManager, _sheetsFilterPanelService, _sheetCanvasPopupService, _sheetsFilterService, _localeService, _shortcutService, _commandService, _menuService, _contextService, _messageService,
|
|
3160
|
-
super(
|
|
3169
|
+
let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileController {
|
|
3170
|
+
constructor(_config, _injector, _componentManager, _sheetsFilterPanelService, _sheetCanvasPopupService, _sheetsFilterService, _localeService, _shortcutService, _commandService, _menuService, _contextService, _messageService, sheetsRenderService, renderManagerService) {
|
|
3171
|
+
super(renderManagerService, sheetsRenderService);
|
|
3161
3172
|
__publicField(this, "_popupDisposable");
|
|
3162
3173
|
this._config = _config, this._injector = _injector, this._componentManager = _componentManager, this._sheetsFilterPanelService = _sheetsFilterPanelService, this._sheetCanvasPopupService = _sheetCanvasPopupService, this._sheetsFilterService = _sheetsFilterService, this._localeService = _localeService, this._shortcutService = _shortcutService, this._commandService = _commandService, this._menuService = _menuService, this._contextService = _contextService, this._messageService = _messageService, this._initCommands(), this._initShortcuts(), this._initMenuItems(), this._initUI();
|
|
3163
3174
|
}
|
|
@@ -3174,6 +3185,8 @@ let SheetsFilterUIController = (_a8 = class extends SheetsFilterMobileUIControll
|
|
|
3174
3185
|
_initCommands() {
|
|
3175
3186
|
[
|
|
3176
3187
|
SmartToggleSheetsFilterCommand,
|
|
3188
|
+
RemoveSheetFilterCommand,
|
|
3189
|
+
SetSheetFilterRangeCommand,
|
|
3177
3190
|
SetSheetsFilterCriteriaCommand,
|
|
3178
3191
|
ClearSheetsFilterCriteriaCommand,
|
|
3179
3192
|
ReCalcSheetsFilterCommand,
|
|
@@ -3221,9 +3234,8 @@ let SheetsFilterUIController = (_a8 = class extends SheetsFilterMobileUIControll
|
|
|
3221
3234
|
var _a13;
|
|
3222
3235
|
(_a13 = this._popupDisposable) == null || _a13.dispose(), this._popupDisposable = null;
|
|
3223
3236
|
}
|
|
3224
|
-
}, __name(_a8, "
|
|
3225
|
-
|
|
3226
|
-
OnLifecycle(LifecycleStages.Rendered, SheetsFilterUIController),
|
|
3237
|
+
}, __name(_a8, "SheetsFilterUIDesktopController"), _a8);
|
|
3238
|
+
SheetsFilterUIDesktopController = __decorateClass$4([
|
|
3227
3239
|
__decorateParam$4(1, Inject(Injector)),
|
|
3228
3240
|
__decorateParam$4(2, Inject(ComponentManager)),
|
|
3229
3241
|
__decorateParam$4(3, Inject(SheetsFilterPanelService)),
|
|
@@ -3235,31 +3247,40 @@ SheetsFilterUIController = __decorateClass$4([
|
|
|
3235
3247
|
__decorateParam$4(9, IMenuService),
|
|
3236
3248
|
__decorateParam$4(10, IContextService),
|
|
3237
3249
|
__decorateParam$4(11, IMessageService),
|
|
3238
|
-
__decorateParam$4(12,
|
|
3239
|
-
|
|
3250
|
+
__decorateParam$4(12, Inject(SheetsRenderService)),
|
|
3251
|
+
__decorateParam$4(13, IRenderManagerService)
|
|
3252
|
+
], SheetsFilterUIDesktopController);
|
|
3240
3253
|
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3241
3254
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3242
3255
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3243
3256
|
return kind && result && __defProp$3(target, key, result), result;
|
|
3244
3257
|
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$3"), _a9;
|
|
3245
3258
|
let SheetsFilterPermissionController = (_a9 = class extends Disposable {
|
|
3246
|
-
constructor(_sheetsFilterService, _localeService, _commandService, _sheetPermissionInterceptorBaseController) {
|
|
3247
|
-
super(), this._sheetsFilterService = _sheetsFilterService, this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
|
|
3259
|
+
constructor(_sheetsFilterService, _localeService, _commandService, _sheetPermissionInterceptorBaseController, _injector) {
|
|
3260
|
+
super(), this._sheetsFilterService = _sheetsFilterService, this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._injector = _injector, this._commandExecutedListener();
|
|
3248
3261
|
}
|
|
3249
3262
|
_commandExecutedListener() {
|
|
3250
3263
|
this.disposeWithMe(
|
|
3251
3264
|
this._commandService.beforeCommandExecuted((command) => {
|
|
3252
|
-
var _a13;
|
|
3253
|
-
if (command.id === SmartToggleSheetsFilterCommand.id
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3265
|
+
var _a13, _b;
|
|
3266
|
+
if (command.id === SmartToggleSheetsFilterCommand.id) {
|
|
3267
|
+
const univerInstanceService = this._injector.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
|
|
3268
|
+
if (!target) return;
|
|
3269
|
+
const { unitId, subUnitId } = target, filterRange = (_a13 = this._sheetsFilterService.getFilterModel(unitId, subUnitId)) == null ? void 0 : _a13.getRange();
|
|
3270
|
+
let permission;
|
|
3271
|
+
filterRange ? permission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
3272
|
+
rangeTypes: [RangeProtectionPermissionViewPoint],
|
|
3273
|
+
worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission]
|
|
3274
|
+
}, [filterRange]) : permission = this._sheetPermissionInterceptorBaseController.permissionCheckWithoutRange({
|
|
3275
|
+
rangeTypes: [RangeProtectionPermissionViewPoint],
|
|
3276
|
+
worksheetTypes: [WorksheetViewPermission, WorksheetFilterPermission]
|
|
3277
|
+
}), permission || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr"));
|
|
3278
|
+
}
|
|
3279
|
+
if (command.id === OpenFilterPanelOperation.id) {
|
|
3280
|
+
const params = command.params, { unitId, subUnitId } = params, filterRange = (_b = this._sheetsFilterService.getFilterModel(unitId, subUnitId)) == null ? void 0 : _b.getRange(), colRange = Tools.deepClone(filterRange);
|
|
3259
3281
|
colRange && (colRange.startColumn = params.col, colRange.endColumn = params.col, this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
3260
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
3261
3282
|
rangeTypes: [RangeProtectionPermissionViewPoint],
|
|
3262
|
-
worksheetTypes: [WorksheetFilterPermission,
|
|
3283
|
+
worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission]
|
|
3263
3284
|
}, [colRange]) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr")));
|
|
3264
3285
|
}
|
|
3265
3286
|
})
|
|
@@ -3267,11 +3288,11 @@ let SheetsFilterPermissionController = (_a9 = class extends Disposable {
|
|
|
3267
3288
|
}
|
|
3268
3289
|
}, __name(_a9, "SheetsFilterPermissionController"), _a9);
|
|
3269
3290
|
SheetsFilterPermissionController = __decorateClass$3([
|
|
3270
|
-
OnLifecycle(LifecycleStages.Ready, SheetsFilterPermissionController),
|
|
3271
3291
|
__decorateParam$3(0, Inject(SheetsFilterService)),
|
|
3272
3292
|
__decorateParam$3(1, Inject(LocaleService)),
|
|
3273
3293
|
__decorateParam$3(2, ICommandService),
|
|
3274
|
-
__decorateParam$3(3, Inject(SheetPermissionInterceptorBaseController))
|
|
3294
|
+
__decorateParam$3(3, Inject(SheetPermissionInterceptorBaseController)),
|
|
3295
|
+
__decorateParam$3(4, Inject(Injector))
|
|
3275
3296
|
], SheetsFilterPermissionController);
|
|
3276
3297
|
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp$1"), __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3277
3298
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -3288,20 +3309,20 @@ let UniverSheetsFilterUIPlugin = (_a10 = class extends Plugin {
|
|
|
3288
3309
|
[
|
|
3289
3310
|
[SheetsFilterPanelService],
|
|
3290
3311
|
[SheetsFilterPermissionController],
|
|
3291
|
-
[
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3312
|
+
[SheetsFilterUIDesktopController, {
|
|
3313
|
+
useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetsFilterUIDesktopController, this._config), "useFactory")
|
|
3314
|
+
}]
|
|
3315
|
+
].forEach((d2) => this._injector.add(d2)), this._config.useRemoteFilterValuesGenerator && this._rpcChannelService && this._injector.add([ISheetsGenerateFilterValuesService, {
|
|
3316
|
+
useFactory: /* @__PURE__ */ __name(() => toModule(
|
|
3317
|
+
this._rpcChannelService.requestChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME)
|
|
3318
|
+
), "useFactory")
|
|
3319
|
+
}]);
|
|
3320
|
+
}
|
|
3321
|
+
onReady() {
|
|
3322
|
+
this._injector.get(SheetsFilterPermissionController);
|
|
3323
|
+
}
|
|
3324
|
+
onRendered() {
|
|
3325
|
+
this._injector.get(SheetsFilterUIDesktopController);
|
|
3305
3326
|
}
|
|
3306
3327
|
}, __name(_a10, "UniverSheetsFilterUIPlugin"), _a10);
|
|
3307
3328
|
__publicField$1(UniverSheetsFilterUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
@@ -3325,9 +3346,15 @@ let UniverSheetsFilterMobileUIPlugin = (_a11 = class extends Plugin {
|
|
|
3325
3346
|
onStarting() {
|
|
3326
3347
|
[
|
|
3327
3348
|
[SheetsFilterPermissionController],
|
|
3328
|
-
[
|
|
3349
|
+
[SheetsFilterUIMobileController]
|
|
3329
3350
|
].forEach((d2) => this._injector.add(d2));
|
|
3330
3351
|
}
|
|
3352
|
+
onReady() {
|
|
3353
|
+
this._injector.get(SheetsFilterPermissionController);
|
|
3354
|
+
}
|
|
3355
|
+
onRendered() {
|
|
3356
|
+
this._injector.get(SheetsFilterUIMobileController);
|
|
3357
|
+
}
|
|
3331
3358
|
}, __name(_a11, "UniverSheetsFilterMobileUIPlugin"), _a11);
|
|
3332
3359
|
__publicField2(UniverSheetsFilterMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
3333
3360
|
__publicField2(UniverSheetsFilterMobileUIPlugin, "pluginName", NAME);
|
|
@@ -3366,6 +3393,8 @@ export {
|
|
|
3366
3393
|
CloseFilterPanelOperation,
|
|
3367
3394
|
OpenFilterPanelOperation,
|
|
3368
3395
|
ReCalcSheetsFilterCommand,
|
|
3396
|
+
RemoveSheetFilterCommand,
|
|
3397
|
+
SetSheetFilterRangeCommand,
|
|
3369
3398
|
SetSheetsFilterCriteriaCommand,
|
|
3370
3399
|
SmartToggleSheetsFilterCommand,
|
|
3371
3400
|
UniverSheetsFilterMobileUIPlugin,
|
|
@@ -1,24 +1,57 @@
|
|
|
1
|
-
import { ICommand, IMutationInfo, Nullable } from '@univerjs/core';
|
|
1
|
+
import { ICommand, IMutationInfo, IRange, Nullable } from '@univerjs/core';
|
|
2
2
|
import { ISheetCommandSharedParams } from '@univerjs/sheets';
|
|
3
|
-
import { IAutoFilter, IFilterColumn } from '@univerjs/sheets-filter';
|
|
3
|
+
import { IAutoFilter, IFilterColumn, ISetSheetsFilterCriteriaMutationParams } from '@univerjs/sheets-filter';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Parameters of command {@link SetSheetFilterRangeCommand}.
|
|
6
|
+
* @property {IRange} range - the range to be set as filter range.
|
|
7
|
+
*/
|
|
8
|
+
export interface ISetSheetFilterRangeCommandParams extends ISheetCommandSharedParams {
|
|
9
|
+
range: IRange;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A {@link CommandType.COMMAND} to set filter range in a Worksheet. Its params {@link ISetSheetFilterRangeCommandParams}
|
|
13
|
+
* is required. If the {@link FilterModel} does not exist, it will be created.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SetSheetFilterRangeCommand: ICommand<ISetSheetFilterRangeCommandParams>;
|
|
16
|
+
/**
|
|
17
|
+
* A {@link CommandType.COMMAND} to remove filter in a Worksheet. Its params {@link ISheetCommandSharedParams} is
|
|
18
|
+
* required. If the {@link FilterModel} does not exist, it will fail to execute.
|
|
19
|
+
*/
|
|
20
|
+
export declare const RemoveSheetFilterCommand: ICommand<ISheetCommandSharedParams>;
|
|
21
|
+
/**
|
|
22
|
+
* A {@link CommandType.COMMAND} to toggle filter in the current {@link Worksheet}.
|
|
6
23
|
*/
|
|
7
24
|
export declare const SmartToggleSheetsFilterCommand: ICommand;
|
|
25
|
+
/**
|
|
26
|
+
* Parameters of command {@link SetSheetsFilterCriteriaCommand}.
|
|
27
|
+
* @property {number} col - the column index of the filter criteria
|
|
28
|
+
* @property {Nullable<IFilterColumn>} criteria - the filter criteria to be set
|
|
29
|
+
*/
|
|
8
30
|
export interface ISetSheetsFilterCriteriaCommandParams extends ISheetCommandSharedParams {
|
|
9
31
|
col: number;
|
|
10
32
|
criteria: Nullable<IFilterColumn>;
|
|
11
33
|
}
|
|
12
34
|
/**
|
|
13
|
-
*
|
|
35
|
+
* A {@link CommandType.COMMAND} to set filter criteria to a column in the targeting {@link FilterModel}. Its params
|
|
36
|
+
* {@link ISetSheetsFilterCriteriaCommandParams} is required.
|
|
14
37
|
*/
|
|
15
38
|
export declare const SetSheetsFilterCriteriaCommand: ICommand<ISetSheetsFilterCriteriaCommandParams>;
|
|
16
39
|
/**
|
|
17
|
-
*
|
|
40
|
+
* A {@link CommandType.COMMAND} to clear all filter criteria in the targeting {@link FilterModel}. Its params
|
|
41
|
+
* {@link ISheetCommandSharedParams} is required.
|
|
42
|
+
*/
|
|
43
|
+
export declare const ClearSheetsFilterCriteriaCommand: ICommand<ISheetCommandSharedParams>;
|
|
44
|
+
/**
|
|
45
|
+
* A {@link CommandType.COMMAND} forcing the currently active {@link FilterModel} to re-calculate all filter criteria.
|
|
46
|
+
* Its params {@link ISheetCommandSharedParams} is required.
|
|
18
47
|
*/
|
|
19
|
-
export declare const
|
|
48
|
+
export declare const ReCalcSheetsFilterCommand: ICommand<ISheetCommandSharedParams>;
|
|
20
49
|
/**
|
|
21
|
-
*
|
|
50
|
+
* Transform a {@link FilterModel} to a list of mutations to set the filter criteria.
|
|
51
|
+
* @param unitId - the unit id of the {@link Workbook}
|
|
52
|
+
* @param subUnitId - the sub unit id of the {@link Worksheet}
|
|
53
|
+
* @param autoFilter - the to be destructed {@link FilterModel}
|
|
54
|
+
* @returns {IMutationInfo<ISetSheetsFilterCriteriaMutationParams>} a list of mutations those can be used to
|
|
55
|
+
* reconstruct the {@link FilterModel}
|
|
22
56
|
*/
|
|
23
|
-
export declare
|
|
24
|
-
export declare function destructFilterCriteria(unitId: string, subUnitId: string, autoFilter: IAutoFilter): IMutationInfo[];
|
|
57
|
+
export declare function destructFilterCriteria(unitId: string, subUnitId: string, autoFilter: IAutoFilter): IMutationInfo<ISetSheetsFilterCriteriaMutationParams>[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Disposable, ICommandService, LocaleService } from '@univerjs/core';
|
|
1
|
+
import { Disposable, ICommandService, Injector, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { MenuConfig } from '@univerjs/ui';
|
|
3
3
|
import { SheetPermissionInterceptorBaseController } from '@univerjs/sheets-ui';
|
|
4
4
|
import { SheetsFilterService } from '@univerjs/sheets-filter';
|
|
@@ -15,6 +15,7 @@ export declare class SheetsFilterPermissionController extends Disposable {
|
|
|
15
15
|
private _localeService;
|
|
16
16
|
private readonly _commandService;
|
|
17
17
|
private readonly _sheetPermissionInterceptorBaseController;
|
|
18
|
-
|
|
18
|
+
private _injector;
|
|
19
|
+
constructor(_sheetsFilterService: SheetsFilterService, _localeService: LocaleService, _commandService: ICommandService, _sheetPermissionInterceptorBaseController: SheetPermissionInterceptorBaseController, _injector: Injector);
|
|
19
20
|
private _commandExecutedListener;
|
|
20
21
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ICommandService, IContextService, Injector, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { ComponentManager, IMenuService, IMessageService, IShortcutService, MenuConfig } from '@univerjs/ui';
|
|
3
|
-
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
|
|
3
|
+
import { SheetCanvasPopManagerService, SheetsRenderService } from '@univerjs/sheets-ui';
|
|
4
4
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
5
5
|
import { SheetsFilterService } from '@univerjs/sheets-filter';
|
|
6
6
|
import { SheetsFilterPanelService } from '../services/sheets-filter-panel.service';
|
|
7
|
-
import {
|
|
7
|
+
import { SheetsFilterUIMobileController } from './sheets-filter-ui-mobile.controller';
|
|
8
8
|
export interface IUniverSheetsFilterUIConfig {
|
|
9
9
|
menu: MenuConfig;
|
|
10
10
|
useRemoteFilterValuesGenerator?: boolean;
|
|
@@ -14,7 +14,7 @@ export declare const FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
|
|
|
14
14
|
/**
|
|
15
15
|
* This controller controls the UI of "filter" features. Menus, commands and filter panel etc. Except for the rendering.
|
|
16
16
|
*/
|
|
17
|
-
export declare class
|
|
17
|
+
export declare class SheetsFilterUIDesktopController extends SheetsFilterUIMobileController {
|
|
18
18
|
private readonly _config;
|
|
19
19
|
private readonly _injector;
|
|
20
20
|
private readonly _componentManager;
|
|
@@ -27,7 +27,7 @@ export declare class SheetsFilterUIController extends SheetsFilterMobileUIContro
|
|
|
27
27
|
private readonly _menuService;
|
|
28
28
|
private readonly _contextService;
|
|
29
29
|
private readonly _messageService;
|
|
30
|
-
constructor(_config: Partial<IUniverSheetsFilterUIConfig>, _injector: Injector, _componentManager: ComponentManager, _sheetsFilterPanelService: SheetsFilterPanelService, _sheetCanvasPopupService: SheetCanvasPopManagerService, _sheetsFilterService: SheetsFilterService, _localeService: LocaleService, _shortcutService: IShortcutService, _commandService: ICommandService, _menuService: IMenuService, _contextService: IContextService, _messageService: IMessageService,
|
|
30
|
+
constructor(_config: Partial<IUniverSheetsFilterUIConfig>, _injector: Injector, _componentManager: ComponentManager, _sheetsFilterPanelService: SheetsFilterPanelService, _sheetCanvasPopupService: SheetCanvasPopManagerService, _sheetsFilterService: SheetsFilterService, _localeService: LocaleService, _shortcutService: IShortcutService, _commandService: ICommandService, _menuService: IMenuService, _contextService: IContextService, _messageService: IMessageService, sheetsRenderService: SheetsRenderService, renderManagerService: IRenderManagerService);
|
|
31
31
|
dispose(): void;
|
|
32
32
|
private _initShortcuts;
|
|
33
33
|
private _initCommands;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
+
import { SheetsRenderService } from '@univerjs/sheets-ui';
|
|
4
|
+
export declare class SheetsFilterUIMobileController extends RxDisposable {
|
|
5
|
+
private readonly _renderManagerService;
|
|
6
|
+
private _sheetsRenderService;
|
|
7
|
+
constructor(_renderManagerService: IRenderManagerService, _sheetsRenderService: SheetsRenderService);
|
|
8
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
2
|
import { IRPCChannelService } from '@univerjs/rpc';
|
|
3
|
-
import { IUniverSheetsFilterUIConfig } from './controllers/sheets-filter-ui.controller';
|
|
3
|
+
import { IUniverSheetsFilterUIConfig } from './controllers/sheets-filter-ui-desktop.controller';
|
|
4
|
+
/**
|
|
5
|
+
* The plugin for the desktop version of the sheets filter UI. Its type is {@link UniverInstanceType.UNIVER_SHEET}.
|
|
6
|
+
*/
|
|
4
7
|
export declare class UniverSheetsFilterUIPlugin extends Plugin {
|
|
5
8
|
private readonly _config;
|
|
6
9
|
protected readonly _injector: Injector;
|
|
@@ -9,4 +12,6 @@ export declare class UniverSheetsFilterUIPlugin extends Plugin {
|
|
|
9
12
|
static pluginName: string;
|
|
10
13
|
constructor(_config: Partial<IUniverSheetsFilterUIConfig>, _injector: Injector, _rpcChannelService?: IRPCChannelService | undefined);
|
|
11
14
|
onStarting(): void;
|
|
15
|
+
onReady(): void;
|
|
16
|
+
onRendered(): void;
|
|
12
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
-
import { IUniverSheetsFilterUIConfig } from './controllers/sheets-filter-ui.controller';
|
|
2
|
+
import { IUniverSheetsFilterUIConfig } from './controllers/sheets-filter-ui-desktop.controller';
|
|
3
3
|
export declare class UniverSheetsFilterMobileUIPlugin extends Plugin {
|
|
4
4
|
private readonly _config;
|
|
5
5
|
protected readonly _injector: Injector;
|
|
@@ -7,4 +7,6 @@ export declare class UniverSheetsFilterMobileUIPlugin extends Plugin {
|
|
|
7
7
|
static pluginName: string;
|
|
8
8
|
constructor(_config: Partial<IUniverSheetsFilterUIConfig>, _injector: Injector);
|
|
9
9
|
onStarting(): void;
|
|
10
|
+
onReady(): void;
|
|
11
|
+
onRendered(): void;
|
|
10
12
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export { UniverSheetsFilterUIPlugin } from './plugin';
|
|
17
|
-
export { UniverSheetsFilterMobileUIPlugin } from './mobile
|
|
16
|
+
export { UniverSheetsFilterUIPlugin } from './filter-ui-desktop.plugin';
|
|
17
|
+
export { UniverSheetsFilterMobileUIPlugin } from './filter-ui-mobile.plugin';
|
|
18
18
|
export { UniverSheetsFilterUIWorkerPlugin } from './worker/plugin';
|
|
19
|
-
export { SmartToggleSheetsFilterCommand, SetSheetsFilterCriteriaCommand, ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, } from './commands/commands/sheets-filter.command';
|
|
19
|
+
export { SmartToggleSheetsFilterCommand, SetSheetsFilterCriteriaCommand, ClearSheetsFilterCriteriaCommand, SetSheetFilterRangeCommand, RemoveSheetFilterCommand, type ISetSheetFilterRangeCommandParams, ReCalcSheetsFilterCommand, type ISetSheetsFilterCriteriaCommandParams, } from './commands/commands/sheets-filter.command';
|
|
20
20
|
export { OpenFilterPanelOperation, CloseFilterPanelOperation, ChangeFilterByOperation, type IOpenFilterPanelOperationParams, } from './commands/operations/sheets-filter.operation';
|