@univerjs/sheets-filter-ui 0.2.11 → 0.2.13
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 +1 -1
- package/lib/es/index.js +96 -89
- package/lib/types/controllers/config.schema.d.ts +8 -0
- package/lib/types/controllers/menu.schema.d.ts +2 -0
- package/lib/types/controllers/sheets-filter-ui-desktop.controller.d.ts +3 -9
- package/lib/types/filter-ui-desktop.plugin.d.ts +4 -3
- package/lib/types/filter-ui-mobile.plugin.d.ts +4 -3
- package/lib/types/services/sheets-filter-panel.service.d.ts +1 -1
- package/lib/types/views/render-modules/sheets-filter.render-controller.d.ts +1 -0
- package/lib/types/worker/generate-filter-values.service.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +23 -23
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, 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";
|
|
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, IConfigService } from "@univerjs/core";
|
|
6
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
|
-
import { IMessageService, ILayoutService, useObservable, useComponentsOfPart, ComponentContainer, KeyCode, MetaKeys,
|
|
8
|
+
import { IMessageService, ILayoutService, useObservable, useComponentsOfPart, ComponentContainer, KeyCode, MetaKeys, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ComponentManager, IShortcutService, IMenuManagerService } 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,
|
|
10
|
+
import { SetCellEditVisibleOperation, SheetsUIPart, whenSheetEditorFocused, SelectionShape, getCoordByCell, SheetSkeletonManagerService, ISheetSelectionRenderService, SheetsRenderService, getObservableWithExclusiveRange$, getCurrentRangeDisable$, 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 { getSheetCommandTarget, SheetsSelectionsService, isSingleCellSelection, expandToContinuousRange, RefRangeService,
|
|
13
|
+
import { getSheetCommandTarget, SheetsSelectionsService, isSingleCellSelection, expandToContinuousRange, RefRangeService, INTERCEPTOR_POINT, SheetInterceptorService, WorksheetFilterPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint } 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";
|
|
@@ -2907,55 +2907,7 @@ const SmartToggleFilterShortcut = {
|
|
|
2907
2907
|
description: "sheets-filter.shortcut.smart-toggle-filter",
|
|
2908
2908
|
preconditions: whenSheetEditorFocused,
|
|
2909
2909
|
group: "4_sheet-edit"
|
|
2910
|
-
}
|
|
2911
|
-
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
2912
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2913
|
-
return {
|
|
2914
|
-
id: SmartToggleSheetsFilterCommand.id,
|
|
2915
|
-
group: MenuGroup.TOOLBAR_FORMULAS_INSERT,
|
|
2916
|
-
type: MenuItemType.BUTTON_SELECTOR,
|
|
2917
|
-
icon: "FilterSingle",
|
|
2918
|
-
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
2919
|
-
positions: [MenuPosition.TOOLBAR_START],
|
|
2920
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2921
|
-
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
2922
|
-
disabled$: getCurrentRangeDisable$(accessor, { worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission], rangeTypes: [RangeProtectionPermissionViewPoint] })
|
|
2923
|
-
};
|
|
2924
|
-
}
|
|
2925
|
-
__name(SmartToggleFilterMenuItemFactory, "SmartToggleFilterMenuItemFactory");
|
|
2926
|
-
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
2927
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2928
|
-
return {
|
|
2929
|
-
id: ClearSheetsFilterCriteriaCommand.id,
|
|
2930
|
-
group: MenuGroup.TOOLBAR_OTHERS,
|
|
2931
|
-
type: MenuItemType.BUTTON,
|
|
2932
|
-
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
2933
|
-
positions: [SmartToggleSheetsFilterCommand.id],
|
|
2934
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2935
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
2936
|
-
var _a13;
|
|
2937
|
-
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
2938
|
-
}))
|
|
2939
|
-
};
|
|
2940
|
-
}
|
|
2941
|
-
__name(ClearFilterCriteriaMenuItemFactory, "ClearFilterCriteriaMenuItemFactory");
|
|
2942
|
-
function ReCalcFilterMenuItemFactory(accessor) {
|
|
2943
|
-
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
2944
|
-
return {
|
|
2945
|
-
id: ReCalcSheetsFilterCommand.id,
|
|
2946
|
-
group: MenuGroup.TOOLBAR_OTHERS,
|
|
2947
|
-
type: MenuItemType.BUTTON,
|
|
2948
|
-
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
2949
|
-
positions: [SmartToggleSheetsFilterCommand.id],
|
|
2950
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
2951
|
-
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
2952
|
-
var _a13;
|
|
2953
|
-
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
2954
|
-
}))
|
|
2955
|
-
};
|
|
2956
|
-
}
|
|
2957
|
-
__name(ReCalcFilterMenuItemFactory, "ReCalcFilterMenuItemFactory");
|
|
2958
|
-
const BUTTON_VIEWPORT = 16, FILTER_BUTTON_EMPTY = new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z"), _FilterButton = class _FilterButton {
|
|
2910
|
+
}, BUTTON_VIEWPORT = 16, FILTER_BUTTON_EMPTY = new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z"), _FilterButton = class _FilterButton {
|
|
2959
2911
|
static drawNoCriteria(ctx, size, fgColor, bgColor) {
|
|
2960
2912
|
ctx.save(), Rect.drawWith(ctx, {
|
|
2961
2913
|
radius: 2,
|
|
@@ -3044,6 +2996,9 @@ let SheetsFilterRenderController = (_a6 = class extends RxDisposable {
|
|
|
3044
2996
|
__publicField(this, "_filterButtonShapes", []);
|
|
3045
2997
|
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();
|
|
3046
2998
|
}
|
|
2999
|
+
dispose() {
|
|
3000
|
+
super.dispose(), this._disposeRendering();
|
|
3001
|
+
}
|
|
3047
3002
|
_initRenderer() {
|
|
3048
3003
|
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
3049
3004
|
switchMap((skeletonParams) => {
|
|
@@ -3112,9 +3067,7 @@ let SheetsFilterRenderController = (_a6 = class extends RxDisposable {
|
|
|
3112
3067
|
const { row, col, unitId, subUnitId } = pos;
|
|
3113
3068
|
return unitId !== workbookId || subUnitId !== worksheetId || row !== startRow || col < startColumn || col > endColumn ? next(cell) : next({
|
|
3114
3069
|
...cell,
|
|
3115
|
-
// @ts-ignore
|
|
3116
3070
|
fontRenderExtension: {
|
|
3117
|
-
// @ts-ignore
|
|
3118
3071
|
...cell == null ? void 0 : cell.fontRenderExtension,
|
|
3119
3072
|
rightOffset: FILTER_ICON_SIZE
|
|
3120
3073
|
}
|
|
@@ -3159,18 +3112,75 @@ SheetsFilterUIMobileController = __decorateClass$5([
|
|
|
3159
3112
|
__decorateParam$5(0, IRenderManagerService),
|
|
3160
3113
|
__decorateParam$5(1, Inject(SheetsRenderService))
|
|
3161
3114
|
], SheetsFilterUIMobileController);
|
|
3115
|
+
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
3116
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3117
|
+
return {
|
|
3118
|
+
id: SmartToggleSheetsFilterCommand.id,
|
|
3119
|
+
type: MenuItemType.BUTTON_SELECTOR,
|
|
3120
|
+
icon: "FilterSingle",
|
|
3121
|
+
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
3122
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3123
|
+
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
3124
|
+
disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, { worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission], rangeTypes: [RangeProtectionPermissionViewPoint] }))
|
|
3125
|
+
};
|
|
3126
|
+
}
|
|
3127
|
+
__name(SmartToggleFilterMenuItemFactory, "SmartToggleFilterMenuItemFactory");
|
|
3128
|
+
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
3129
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3130
|
+
return {
|
|
3131
|
+
id: ClearSheetsFilterCriteriaCommand.id,
|
|
3132
|
+
type: MenuItemType.BUTTON,
|
|
3133
|
+
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
3134
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3135
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
3136
|
+
var _a13;
|
|
3137
|
+
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
3138
|
+
}))
|
|
3139
|
+
};
|
|
3140
|
+
}
|
|
3141
|
+
__name(ClearFilterCriteriaMenuItemFactory, "ClearFilterCriteriaMenuItemFactory");
|
|
3142
|
+
function ReCalcFilterMenuItemFactory(accessor) {
|
|
3143
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3144
|
+
return {
|
|
3145
|
+
id: ReCalcSheetsFilterCommand.id,
|
|
3146
|
+
type: MenuItemType.BUTTON,
|
|
3147
|
+
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
3148
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3149
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
3150
|
+
var _a13;
|
|
3151
|
+
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
3152
|
+
}))
|
|
3153
|
+
};
|
|
3154
|
+
}
|
|
3155
|
+
__name(ReCalcFilterMenuItemFactory, "ReCalcFilterMenuItemFactory");
|
|
3156
|
+
const menuSchema = {
|
|
3157
|
+
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
3158
|
+
[SmartToggleSheetsFilterCommand.id]: {
|
|
3159
|
+
order: 10,
|
|
3160
|
+
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
3161
|
+
[ClearSheetsFilterCriteriaCommand.id]: {
|
|
3162
|
+
order: 0,
|
|
3163
|
+
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
3164
|
+
},
|
|
3165
|
+
[ReCalcSheetsFilterCommand.id]: {
|
|
3166
|
+
order: 1,
|
|
3167
|
+
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
};
|
|
3162
3172
|
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3163
3173
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3164
3174
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3165
3175
|
return kind && result && __defProp$4(target, key, result), result;
|
|
3166
3176
|
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$4");
|
|
3167
|
-
const
|
|
3177
|
+
const FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
|
|
3168
3178
|
var _a8;
|
|
3169
3179
|
let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileController {
|
|
3170
|
-
constructor(
|
|
3180
|
+
constructor(_injector, _componentManager, _sheetsFilterPanelService, _sheetCanvasPopupService, _sheetsFilterService, _localeService, _shortcutService, _commandService, _menuManagerService, _contextService, _messageService, sheetsRenderService, renderManagerService) {
|
|
3171
3181
|
super(renderManagerService, sheetsRenderService);
|
|
3172
3182
|
__publicField(this, "_popupDisposable");
|
|
3173
|
-
this.
|
|
3183
|
+
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._menuManagerService = _menuManagerService, this._contextService = _contextService, this._messageService = _messageService, this._initCommands(), this._initShortcuts(), this._initMenuItems(), this._initUI();
|
|
3174
3184
|
}
|
|
3175
3185
|
dispose() {
|
|
3176
3186
|
super.dispose(), this._closeFilterPopup();
|
|
@@ -3198,14 +3208,7 @@ let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileC
|
|
|
3198
3208
|
});
|
|
3199
3209
|
}
|
|
3200
3210
|
_initMenuItems() {
|
|
3201
|
-
|
|
3202
|
-
[
|
|
3203
|
-
SmartToggleFilterMenuItemFactory,
|
|
3204
|
-
ClearFilterCriteriaMenuItemFactory,
|
|
3205
|
-
ReCalcFilterMenuItemFactory
|
|
3206
|
-
].forEach((factory) => {
|
|
3207
|
-
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));
|
|
3208
|
-
});
|
|
3211
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
3209
3212
|
}
|
|
3210
3213
|
_initUI() {
|
|
3211
3214
|
this.disposeWithMe(this._componentManager.register(FILTER_PANEL_POPUP_KEY, FilterPanel)), this.disposeWithMe(this._componentManager.register("FilterSingle", FilterSingle)), this.disposeWithMe(this._contextService.subscribeContextValue$(FILTER_PANEL_OPENED_KEY).pipe(distinctUntilChanged()).subscribe((open) => {
|
|
@@ -3225,7 +3228,6 @@ let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileC
|
|
|
3225
3228
|
this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(startRow, col, {
|
|
3226
3229
|
componentKey: FILTER_PANEL_POPUP_KEY,
|
|
3227
3230
|
direction: "horizontal",
|
|
3228
|
-
closeOnSelfTarget: !0,
|
|
3229
3231
|
onClickOutside: /* @__PURE__ */ __name(() => this._commandService.syncExecuteCommand(CloseFilterPanelOperation.id), "onClickOutside"),
|
|
3230
3232
|
offset: [5, 0]
|
|
3231
3233
|
});
|
|
@@ -3236,19 +3238,19 @@ let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileC
|
|
|
3236
3238
|
}
|
|
3237
3239
|
}, __name(_a8, "SheetsFilterUIDesktopController"), _a8);
|
|
3238
3240
|
SheetsFilterUIDesktopController = __decorateClass$4([
|
|
3239
|
-
__decorateParam$4(
|
|
3240
|
-
__decorateParam$4(
|
|
3241
|
-
__decorateParam$4(
|
|
3242
|
-
__decorateParam$4(
|
|
3243
|
-
__decorateParam$4(
|
|
3244
|
-
__decorateParam$4(
|
|
3245
|
-
__decorateParam$4(
|
|
3246
|
-
__decorateParam$4(
|
|
3247
|
-
__decorateParam$4(
|
|
3248
|
-
__decorateParam$4(
|
|
3249
|
-
__decorateParam$4(
|
|
3250
|
-
__decorateParam$4(
|
|
3251
|
-
__decorateParam$4(
|
|
3241
|
+
__decorateParam$4(0, Inject(Injector)),
|
|
3242
|
+
__decorateParam$4(1, Inject(ComponentManager)),
|
|
3243
|
+
__decorateParam$4(2, Inject(SheetsFilterPanelService)),
|
|
3244
|
+
__decorateParam$4(3, Inject(SheetCanvasPopManagerService)),
|
|
3245
|
+
__decorateParam$4(4, Inject(SheetsFilterService)),
|
|
3246
|
+
__decorateParam$4(5, Inject(LocaleService)),
|
|
3247
|
+
__decorateParam$4(6, IShortcutService),
|
|
3248
|
+
__decorateParam$4(7, ICommandService),
|
|
3249
|
+
__decorateParam$4(8, IMenuManagerService),
|
|
3250
|
+
__decorateParam$4(9, IContextService),
|
|
3251
|
+
__decorateParam$4(10, IMessageService),
|
|
3252
|
+
__decorateParam$4(11, Inject(SheetsRenderService)),
|
|
3253
|
+
__decorateParam$4(12, IRenderManagerService)
|
|
3252
3254
|
], SheetsFilterUIDesktopController);
|
|
3253
3255
|
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3254
3256
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -3294,6 +3296,7 @@ SheetsFilterPermissionController = __decorateClass$3([
|
|
|
3294
3296
|
__decorateParam$3(3, Inject(SheetPermissionInterceptorBaseController)),
|
|
3295
3297
|
__decorateParam$3(4, Inject(Injector))
|
|
3296
3298
|
], SheetsFilterPermissionController);
|
|
3299
|
+
const PLUGIN_CONFIG_KEY = "sheets-filter-ui.config", defaultPluginConfig = {};
|
|
3297
3300
|
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) => {
|
|
3298
3301
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3299
3302
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -3302,16 +3305,16 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
|
|
|
3302
3305
|
const NAME$1 = "SHEET_FILTER_UI_PLUGIN";
|
|
3303
3306
|
var _a10;
|
|
3304
3307
|
let UniverSheetsFilterUIPlugin = (_a10 = class extends Plugin {
|
|
3305
|
-
constructor(_config =
|
|
3306
|
-
super(), this._config = _config, this._injector = _injector, this.
|
|
3308
|
+
constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
|
|
3309
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService, this._rpcChannelService = _rpcChannelService;
|
|
3310
|
+
const { menu, ...rest } = this._config;
|
|
3311
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
3307
3312
|
}
|
|
3308
3313
|
onStarting() {
|
|
3309
3314
|
[
|
|
3310
3315
|
[SheetsFilterPanelService],
|
|
3311
3316
|
[SheetsFilterPermissionController],
|
|
3312
|
-
[SheetsFilterUIDesktopController
|
|
3313
|
-
useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetsFilterUIDesktopController, this._config), "useFactory")
|
|
3314
|
-
}]
|
|
3317
|
+
[SheetsFilterUIDesktopController]
|
|
3315
3318
|
].forEach((d2) => this._injector.add(d2)), this._config.useRemoteFilterValuesGenerator && this._rpcChannelService && this._injector.add([ISheetsGenerateFilterValuesService, {
|
|
3316
3319
|
useFactory: /* @__PURE__ */ __name(() => toModule(
|
|
3317
3320
|
this._rpcChannelService.requestChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME)
|
|
@@ -3330,7 +3333,8 @@ __publicField$1(UniverSheetsFilterUIPlugin, "pluginName", NAME$1);
|
|
|
3330
3333
|
UniverSheetsFilterUIPlugin = __decorateClass$2([
|
|
3331
3334
|
DependentOn(UniverSheetsFilterPlugin),
|
|
3332
3335
|
__decorateParam$2(1, Inject(Injector)),
|
|
3333
|
-
__decorateParam$2(2,
|
|
3336
|
+
__decorateParam$2(2, IConfigService),
|
|
3337
|
+
__decorateParam$2(3, Optional(IRPCChannelService))
|
|
3334
3338
|
], UniverSheetsFilterUIPlugin);
|
|
3335
3339
|
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3336
3340
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -3340,8 +3344,10 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
3340
3344
|
const NAME = "SHEET_FILTER_UI_PLUGIN";
|
|
3341
3345
|
var _a11;
|
|
3342
3346
|
let UniverSheetsFilterMobileUIPlugin = (_a11 = class extends Plugin {
|
|
3343
|
-
constructor(_config =
|
|
3344
|
-
super(), this._config = _config, this._injector = _injector, this.
|
|
3347
|
+
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
3348
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
3349
|
+
const { menu, ...rest } = this._config;
|
|
3350
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
3345
3351
|
}
|
|
3346
3352
|
onStarting() {
|
|
3347
3353
|
[
|
|
@@ -3360,7 +3366,8 @@ __publicField2(UniverSheetsFilterMobileUIPlugin, "type", UniverInstanceType.UNIV
|
|
|
3360
3366
|
__publicField2(UniverSheetsFilterMobileUIPlugin, "pluginName", NAME);
|
|
3361
3367
|
UniverSheetsFilterMobileUIPlugin = __decorateClass$1([
|
|
3362
3368
|
DependentOn(UniverSheetsFilterPlugin),
|
|
3363
|
-
__decorateParam$1(1, Inject(Injector))
|
|
3369
|
+
__decorateParam$1(1, Inject(Injector)),
|
|
3370
|
+
__decorateParam$1(2, IConfigService)
|
|
3364
3371
|
], UniverSheetsFilterMobileUIPlugin);
|
|
3365
3372
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3366
3373
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MenuConfig } from '@univerjs/ui';
|
|
2
|
+
export declare const PLUGIN_CONFIG_KEY = "sheets-filter-ui.config";
|
|
3
|
+
export declare const configSymbol: unique symbol;
|
|
4
|
+
export interface IUniverSheetsFilterUIConfig {
|
|
5
|
+
menu?: MenuConfig;
|
|
6
|
+
useRemoteFilterValuesGenerator?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const defaultPluginConfig: IUniverSheetsFilterUIConfig;
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { ICommandService, IContextService, Injector, LocaleService } from '@univerjs/core';
|
|
2
|
-
import { ComponentManager,
|
|
2
|
+
import { ComponentManager, IMenuManagerService, IMessageService, IShortcutService } from '@univerjs/ui';
|
|
3
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
7
|
import { SheetsFilterUIMobileController } from './sheets-filter-ui-mobile.controller';
|
|
8
|
-
export interface IUniverSheetsFilterUIConfig {
|
|
9
|
-
menu: MenuConfig;
|
|
10
|
-
useRemoteFilterValuesGenerator?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const DefaultSheetFilterUiConfig: {};
|
|
13
8
|
export declare const FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
|
|
14
9
|
/**
|
|
15
10
|
* This controller controls the UI of "filter" features. Menus, commands and filter panel etc. Except for the rendering.
|
|
16
11
|
*/
|
|
17
12
|
export declare class SheetsFilterUIDesktopController extends SheetsFilterUIMobileController {
|
|
18
|
-
private readonly _config;
|
|
19
13
|
private readonly _injector;
|
|
20
14
|
private readonly _componentManager;
|
|
21
15
|
private readonly _sheetsFilterPanelService;
|
|
@@ -24,10 +18,10 @@ export declare class SheetsFilterUIDesktopController extends SheetsFilterUIMobil
|
|
|
24
18
|
private _localeService;
|
|
25
19
|
private readonly _shortcutService;
|
|
26
20
|
private readonly _commandService;
|
|
27
|
-
private readonly
|
|
21
|
+
private readonly _menuManagerService;
|
|
28
22
|
private readonly _contextService;
|
|
29
23
|
private readonly _messageService;
|
|
30
|
-
constructor(
|
|
24
|
+
constructor(_injector: Injector, _componentManager: ComponentManager, _sheetsFilterPanelService: SheetsFilterPanelService, _sheetCanvasPopupService: SheetCanvasPopManagerService, _sheetsFilterService: SheetsFilterService, _localeService: LocaleService, _shortcutService: IShortcutService, _commandService: ICommandService, _menuManagerService: IMenuManagerService, _contextService: IContextService, _messageService: IMessageService, sheetsRenderService: SheetsRenderService, renderManagerService: IRenderManagerService);
|
|
31
25
|
dispose(): void;
|
|
32
26
|
private _initShortcuts;
|
|
33
27
|
private _initCommands;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
1
|
+
import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
2
|
import { IRPCChannelService } from '@univerjs/rpc';
|
|
3
|
-
import { IUniverSheetsFilterUIConfig } from './controllers/
|
|
3
|
+
import { IUniverSheetsFilterUIConfig } from './controllers/config.schema';
|
|
4
4
|
/**
|
|
5
5
|
* The plugin for the desktop version of the sheets filter UI. Its type is {@link UniverInstanceType.UNIVER_SHEET}.
|
|
6
6
|
*/
|
|
7
7
|
export declare class UniverSheetsFilterUIPlugin extends Plugin {
|
|
8
8
|
private readonly _config;
|
|
9
9
|
protected readonly _injector: Injector;
|
|
10
|
+
private readonly _configService;
|
|
10
11
|
private readonly _rpcChannelService?;
|
|
11
12
|
static type: UniverInstanceType;
|
|
12
13
|
static pluginName: string;
|
|
13
|
-
constructor(_config: Partial<IUniverSheetsFilterUIConfig
|
|
14
|
+
constructor(_config: Partial<IUniverSheetsFilterUIConfig> | undefined, _injector: Injector, _configService: IConfigService, _rpcChannelService?: IRPCChannelService | undefined);
|
|
14
15
|
onStarting(): void;
|
|
15
16
|
onReady(): void;
|
|
16
17
|
onRendered(): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
-
import { IUniverSheetsFilterUIConfig } from './controllers/
|
|
1
|
+
import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
import { IUniverSheetsFilterUIConfig } from './controllers/config.schema';
|
|
3
3
|
export declare class UniverSheetsFilterMobileUIPlugin extends Plugin {
|
|
4
4
|
private readonly _config;
|
|
5
5
|
protected readonly _injector: Injector;
|
|
6
|
+
private readonly _configService;
|
|
6
7
|
static type: UniverInstanceType;
|
|
7
8
|
static pluginName: string;
|
|
8
|
-
constructor(_config: Partial<IUniverSheetsFilterUIConfig
|
|
9
|
+
constructor(_config: Partial<IUniverSheetsFilterUIConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
9
10
|
onStarting(): void;
|
|
10
11
|
onReady(): void;
|
|
11
12
|
onRendered(): void;
|
|
@@ -30,7 +30,7 @@ export interface ISheetsFilterPanelService {
|
|
|
30
30
|
*/
|
|
31
31
|
terminate(): boolean;
|
|
32
32
|
}
|
|
33
|
-
export declare const ISheetsFilterPanelService: import('@
|
|
33
|
+
export declare const ISheetsFilterPanelService: import('@wendellhu/redi').IdentifierDecorator<ISheetsFilterPanelService>;
|
|
34
34
|
export interface IFilterByModel extends IDisposable {
|
|
35
35
|
canApply$: Observable<boolean>;
|
|
36
36
|
deltaCol(offset: number): void;
|
|
@@ -16,6 +16,7 @@ export declare class SheetsFilterRenderController extends RxDisposable implement
|
|
|
16
16
|
private _buttonRenderDisposable;
|
|
17
17
|
private _filterButtonShapes;
|
|
18
18
|
constructor(_context: IRenderContext<Workbook>, _injector: Injector, _sheetSkeletonManagerService: SheetSkeletonManagerService, _sheetsFilterService: SheetsFilterService, _themeService: ThemeService, _sheetInterceptorService: SheetInterceptorService, _commandService: ICommandService, _selectionRenderService: ISheetSelectionRenderService);
|
|
19
|
+
dispose(): void;
|
|
19
20
|
private _initRenderer;
|
|
20
21
|
private _renderRange;
|
|
21
22
|
private _renderButtons;
|
|
@@ -12,7 +12,7 @@ export interface ISheetsGenerateFilterValuesService {
|
|
|
12
12
|
}): Promise<IFilterByValueItem[]>;
|
|
13
13
|
}
|
|
14
14
|
export declare const SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME = "sheets-filter.generate-filter-values.service";
|
|
15
|
-
export declare const ISheetsGenerateFilterValuesService: import('@
|
|
15
|
+
export declare const ISheetsGenerateFilterValuesService: import('@wendellhu/redi').IdentifierDecorator<ISheetsGenerateFilterValuesService>;
|
|
16
16
|
export declare class SheetsGenerateFilterValuesService extends Disposable {
|
|
17
17
|
private readonly _localeService;
|
|
18
18
|
private readonly _univerInstanceService;
|