@univerjs/sheets-filter-ui 0.2.11 → 0.2.12
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 -86
- 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/views/render-modules/sheets-filter.render-controller.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +18 -18
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) => {
|
|
@@ -3159,18 +3114,75 @@ SheetsFilterUIMobileController = __decorateClass$5([
|
|
|
3159
3114
|
__decorateParam$5(0, IRenderManagerService),
|
|
3160
3115
|
__decorateParam$5(1, Inject(SheetsRenderService))
|
|
3161
3116
|
], SheetsFilterUIMobileController);
|
|
3117
|
+
function SmartToggleFilterMenuItemFactory(accessor) {
|
|
3118
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3119
|
+
return {
|
|
3120
|
+
id: SmartToggleSheetsFilterCommand.id,
|
|
3121
|
+
type: MenuItemType.BUTTON_SELECTOR,
|
|
3122
|
+
icon: "FilterSingle",
|
|
3123
|
+
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
3124
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3125
|
+
activated$: sheetsFilterService.activeFilterModel$.pipe(map((model) => !!model)),
|
|
3126
|
+
disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, { worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission], rangeTypes: [RangeProtectionPermissionViewPoint] }))
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
__name(SmartToggleFilterMenuItemFactory, "SmartToggleFilterMenuItemFactory");
|
|
3130
|
+
function ClearFilterCriteriaMenuItemFactory(accessor) {
|
|
3131
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3132
|
+
return {
|
|
3133
|
+
id: ClearSheetsFilterCriteriaCommand.id,
|
|
3134
|
+
type: MenuItemType.BUTTON,
|
|
3135
|
+
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
3136
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3137
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
3138
|
+
var _a13;
|
|
3139
|
+
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
3140
|
+
}))
|
|
3141
|
+
};
|
|
3142
|
+
}
|
|
3143
|
+
__name(ClearFilterCriteriaMenuItemFactory, "ClearFilterCriteriaMenuItemFactory");
|
|
3144
|
+
function ReCalcFilterMenuItemFactory(accessor) {
|
|
3145
|
+
const sheetsFilterService = accessor.get(SheetsFilterService);
|
|
3146
|
+
return {
|
|
3147
|
+
id: ReCalcSheetsFilterCommand.id,
|
|
3148
|
+
type: MenuItemType.BUTTON,
|
|
3149
|
+
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
3150
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
3151
|
+
disabled$: sheetsFilterService.activeFilterModel$.pipe(switchMap((model) => {
|
|
3152
|
+
var _a13;
|
|
3153
|
+
return (_a13 = model == null ? void 0 : model.hasCriteria$.pipe(map((m2) => !m2))) != null ? _a13 : of(!0);
|
|
3154
|
+
}))
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
__name(ReCalcFilterMenuItemFactory, "ReCalcFilterMenuItemFactory");
|
|
3158
|
+
const menuSchema = {
|
|
3159
|
+
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
3160
|
+
[SmartToggleSheetsFilterCommand.id]: {
|
|
3161
|
+
order: 10,
|
|
3162
|
+
menuItemFactory: SmartToggleFilterMenuItemFactory,
|
|
3163
|
+
[ClearSheetsFilterCriteriaCommand.id]: {
|
|
3164
|
+
order: 0,
|
|
3165
|
+
menuItemFactory: ClearFilterCriteriaMenuItemFactory
|
|
3166
|
+
},
|
|
3167
|
+
[ReCalcSheetsFilterCommand.id]: {
|
|
3168
|
+
order: 1,
|
|
3169
|
+
menuItemFactory: ReCalcFilterMenuItemFactory
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
};
|
|
3162
3174
|
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3163
3175
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3164
3176
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
3165
3177
|
return kind && result && __defProp$4(target, key, result), result;
|
|
3166
3178
|
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$4");
|
|
3167
|
-
const
|
|
3179
|
+
const FILTER_PANEL_POPUP_KEY = "FILTER_PANEL_POPUP";
|
|
3168
3180
|
var _a8;
|
|
3169
3181
|
let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileController {
|
|
3170
|
-
constructor(
|
|
3182
|
+
constructor(_injector, _componentManager, _sheetsFilterPanelService, _sheetCanvasPopupService, _sheetsFilterService, _localeService, _shortcutService, _commandService, _menuManagerService, _contextService, _messageService, sheetsRenderService, renderManagerService) {
|
|
3171
3183
|
super(renderManagerService, sheetsRenderService);
|
|
3172
3184
|
__publicField(this, "_popupDisposable");
|
|
3173
|
-
this.
|
|
3185
|
+
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
3186
|
}
|
|
3175
3187
|
dispose() {
|
|
3176
3188
|
super.dispose(), this._closeFilterPopup();
|
|
@@ -3198,14 +3210,7 @@ let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileC
|
|
|
3198
3210
|
});
|
|
3199
3211
|
}
|
|
3200
3212
|
_initMenuItems() {
|
|
3201
|
-
|
|
3202
|
-
[
|
|
3203
|
-
SmartToggleFilterMenuItemFactory,
|
|
3204
|
-
ClearFilterCriteriaMenuItemFactory,
|
|
3205
|
-
ReCalcFilterMenuItemFactory
|
|
3206
|
-
].forEach((factory) => {
|
|
3207
|
-
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));
|
|
3208
|
-
});
|
|
3213
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
3209
3214
|
}
|
|
3210
3215
|
_initUI() {
|
|
3211
3216
|
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) => {
|
|
@@ -3236,19 +3241,19 @@ let SheetsFilterUIDesktopController = (_a8 = class extends SheetsFilterUIMobileC
|
|
|
3236
3241
|
}
|
|
3237
3242
|
}, __name(_a8, "SheetsFilterUIDesktopController"), _a8);
|
|
3238
3243
|
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(
|
|
3244
|
+
__decorateParam$4(0, Inject(Injector)),
|
|
3245
|
+
__decorateParam$4(1, Inject(ComponentManager)),
|
|
3246
|
+
__decorateParam$4(2, Inject(SheetsFilterPanelService)),
|
|
3247
|
+
__decorateParam$4(3, Inject(SheetCanvasPopManagerService)),
|
|
3248
|
+
__decorateParam$4(4, Inject(SheetsFilterService)),
|
|
3249
|
+
__decorateParam$4(5, Inject(LocaleService)),
|
|
3250
|
+
__decorateParam$4(6, IShortcutService),
|
|
3251
|
+
__decorateParam$4(7, ICommandService),
|
|
3252
|
+
__decorateParam$4(8, IMenuManagerService),
|
|
3253
|
+
__decorateParam$4(9, IContextService),
|
|
3254
|
+
__decorateParam$4(10, IMessageService),
|
|
3255
|
+
__decorateParam$4(11, Inject(SheetsRenderService)),
|
|
3256
|
+
__decorateParam$4(12, IRenderManagerService)
|
|
3252
3257
|
], SheetsFilterUIDesktopController);
|
|
3253
3258
|
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3254
3259
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -3294,6 +3299,7 @@ SheetsFilterPermissionController = __decorateClass$3([
|
|
|
3294
3299
|
__decorateParam$3(3, Inject(SheetPermissionInterceptorBaseController)),
|
|
3295
3300
|
__decorateParam$3(4, Inject(Injector))
|
|
3296
3301
|
], SheetsFilterPermissionController);
|
|
3302
|
+
const PLUGIN_CONFIG_KEY = "sheets-filter-ui.config", defaultPluginConfig = {};
|
|
3297
3303
|
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
3304
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3299
3305
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -3302,16 +3308,16 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
|
|
|
3302
3308
|
const NAME$1 = "SHEET_FILTER_UI_PLUGIN";
|
|
3303
3309
|
var _a10;
|
|
3304
3310
|
let UniverSheetsFilterUIPlugin = (_a10 = class extends Plugin {
|
|
3305
|
-
constructor(_config =
|
|
3306
|
-
super(), this._config = _config, this._injector = _injector, this.
|
|
3311
|
+
constructor(_config = defaultPluginConfig, _injector, _configService, _rpcChannelService) {
|
|
3312
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService, this._rpcChannelService = _rpcChannelService;
|
|
3313
|
+
const { menu, ...rest } = this._config;
|
|
3314
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
3307
3315
|
}
|
|
3308
3316
|
onStarting() {
|
|
3309
3317
|
[
|
|
3310
3318
|
[SheetsFilterPanelService],
|
|
3311
3319
|
[SheetsFilterPermissionController],
|
|
3312
|
-
[SheetsFilterUIDesktopController
|
|
3313
|
-
useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetsFilterUIDesktopController, this._config), "useFactory")
|
|
3314
|
-
}]
|
|
3320
|
+
[SheetsFilterUIDesktopController]
|
|
3315
3321
|
].forEach((d2) => this._injector.add(d2)), this._config.useRemoteFilterValuesGenerator && this._rpcChannelService && this._injector.add([ISheetsGenerateFilterValuesService, {
|
|
3316
3322
|
useFactory: /* @__PURE__ */ __name(() => toModule(
|
|
3317
3323
|
this._rpcChannelService.requestChannel(SHEETS_GENERATE_FILTER_VALUES_SERVICE_NAME)
|
|
@@ -3330,7 +3336,8 @@ __publicField$1(UniverSheetsFilterUIPlugin, "pluginName", NAME$1);
|
|
|
3330
3336
|
UniverSheetsFilterUIPlugin = __decorateClass$2([
|
|
3331
3337
|
DependentOn(UniverSheetsFilterPlugin),
|
|
3332
3338
|
__decorateParam$2(1, Inject(Injector)),
|
|
3333
|
-
__decorateParam$2(2,
|
|
3339
|
+
__decorateParam$2(2, IConfigService),
|
|
3340
|
+
__decorateParam$2(3, Optional(IRPCChannelService))
|
|
3334
3341
|
], UniverSheetsFilterUIPlugin);
|
|
3335
3342
|
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
3343
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -3340,8 +3347,10 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
3340
3347
|
const NAME = "SHEET_FILTER_UI_PLUGIN";
|
|
3341
3348
|
var _a11;
|
|
3342
3349
|
let UniverSheetsFilterMobileUIPlugin = (_a11 = class extends Plugin {
|
|
3343
|
-
constructor(_config =
|
|
3344
|
-
super(), this._config = _config, this._injector = _injector, this.
|
|
3350
|
+
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
3351
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
3352
|
+
const { menu, ...rest } = this._config;
|
|
3353
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
3345
3354
|
}
|
|
3346
3355
|
onStarting() {
|
|
3347
3356
|
[
|
|
@@ -3360,7 +3369,8 @@ __publicField2(UniverSheetsFilterMobileUIPlugin, "type", UniverInstanceType.UNIV
|
|
|
3360
3369
|
__publicField2(UniverSheetsFilterMobileUIPlugin, "pluginName", NAME);
|
|
3361
3370
|
UniverSheetsFilterMobileUIPlugin = __decorateClass$1([
|
|
3362
3371
|
DependentOn(UniverSheetsFilterPlugin),
|
|
3363
|
-
__decorateParam$1(1, Inject(Injector))
|
|
3372
|
+
__decorateParam$1(1, Inject(Injector)),
|
|
3373
|
+
__decorateParam$1(2, IConfigService)
|
|
3364
3374
|
], UniverSheetsFilterMobileUIPlugin);
|
|
3365
3375
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
3366
3376
|
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>, _injector: Injector, _rpcChannelService?: IRPCChannelService | undefined);
|
|
14
|
+
constructor(_config: Partial<IUniverSheetsFilterUIConfig>, _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>, _injector: Injector);
|
|
9
|
+
constructor(_config: Partial<IUniverSheetsFilterUIConfig>, _injector: Injector, _configService: IConfigService);
|
|
9
10
|
onStarting(): void;
|
|
10
11
|
onReady(): void;
|
|
11
12
|
onRendered(): 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;
|