@univerjs/sheets-sort-ui 0.25.0 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +264 -240
- package/lib/es/index.js +265 -241
- package/lib/index.js +265 -241
- package/lib/types/controllers/components.controller.d.ts +24 -0
- package/lib/types/controllers/{sheets-sort-ui.controller.d.ts → ui.controller.d.ts} +2 -3
- package/lib/types/locale/types.d.ts +18 -0
- package/lib/types/menu/sheets-sort.menu.d.ts +13 -17
- package/lib/types/views/CustomSortPanel.d.ts +2 -2
- package/lib/types/views/EmbedSortBtn.d.ts +1 -1
- package/lib/types/views/ExtendConfirm.d.ts +2 -1
- package/lib/types/views/SortCheckError.d.ts +20 -0
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
package/lib/es/index.js
CHANGED
|
@@ -3,29 +3,14 @@ import { RangeProtectionPermissionEditPoint, SetSelectionsOperation, SheetsSelec
|
|
|
3
3
|
import { SheetsSortService, SortRangeCommand, SortType, UniverSheetsSortPlugin } from "@univerjs/sheets-sort";
|
|
4
4
|
import { BehaviorSubject, takeUntil } from "rxjs";
|
|
5
5
|
import { Button, ButtonGroup, Checkbox, DraggableList, Dropdown, Radio, RadioGroup, clsx, scrollbarClassName } from "@univerjs/design";
|
|
6
|
-
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, ILayoutService, IMenuManagerService, IUIPartsService, MenuItemType, RibbonDataGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
6
|
+
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, ILayoutService, IMenuManagerService, IUIPartsService, IconManager, MenuItemType, RibbonDataGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
7
7
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { AscendingIcon, CheckMarkIcon, CustomSortIcon, DeleteEmptyIcon, DescendingIcon, ExpandAscendingIcon, ExpandDescendingIcon, GripVerticalIcon, IncreaseIcon, MoreDownIcon } from "@univerjs/icons";
|
|
9
10
|
import { serializeRange } from "@univerjs/engine-formula";
|
|
10
|
-
import { AscendingIcon, CheckMarkIcon, CustomSortIcon, DeleteEmptyIcon, DescendingIcon, ExpandAscendingIcon, ExpandDescendingIcon, IncreaseIcon, MoreDownIcon, SequenceIcon } from "@univerjs/icons";
|
|
11
11
|
import { SheetsRenderService, SheetsUIPart, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$ } from "@univerjs/sheets-ui";
|
|
12
12
|
|
|
13
13
|
//#region src/views/ExtendConfirm.tsx
|
|
14
|
-
/**
|
|
15
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
16
|
-
*
|
|
17
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License.
|
|
19
|
-
* You may obtain a copy of the License at
|
|
20
|
-
*
|
|
21
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
* See the License for the specific language governing permissions and
|
|
27
|
-
* limitations under the License.
|
|
28
|
-
*/
|
|
29
14
|
const ExtendConfirm = (props) => {
|
|
30
15
|
const [extend, setExtend] = useState("0");
|
|
31
16
|
const localeService = useDependency(LocaleService);
|
|
@@ -52,9 +37,21 @@ const ExtendConfirm = (props) => {
|
|
|
52
37
|
})]
|
|
53
38
|
});
|
|
54
39
|
};
|
|
40
|
+
function createExtendConfirm(onChange) {
|
|
41
|
+
return /* @__PURE__ */ jsx(ExtendConfirm, { onChange });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/views/SortCheckError.tsx
|
|
46
|
+
const SortCheckError = (props) => {
|
|
47
|
+
return /* @__PURE__ */ jsx("div", { children: props.message });
|
|
48
|
+
};
|
|
49
|
+
function createSortCheckError(message) {
|
|
50
|
+
return /* @__PURE__ */ jsx(SortCheckError, { message });
|
|
51
|
+
}
|
|
55
52
|
|
|
56
53
|
//#endregion
|
|
57
|
-
//#region \0@oxc-project+runtime@0.
|
|
54
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
|
|
58
55
|
function _typeof(o) {
|
|
59
56
|
"@babel/helpers - typeof";
|
|
60
57
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -65,7 +62,7 @@ function _typeof(o) {
|
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
//#endregion
|
|
68
|
-
//#region \0@oxc-project+runtime@0.
|
|
65
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
|
|
69
66
|
function toPrimitive(t, r) {
|
|
70
67
|
if ("object" != _typeof(t) || !t) return t;
|
|
71
68
|
var e = t[Symbol.toPrimitive];
|
|
@@ -78,14 +75,14 @@ function toPrimitive(t, r) {
|
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
//#endregion
|
|
81
|
-
//#region \0@oxc-project+runtime@0.
|
|
78
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
|
|
82
79
|
function toPropertyKey(t) {
|
|
83
80
|
var i = toPrimitive(t, "string");
|
|
84
81
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
85
82
|
}
|
|
86
83
|
|
|
87
84
|
//#endregion
|
|
88
|
-
//#region \0@oxc-project+runtime@0.
|
|
85
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
|
|
89
86
|
function _defineProperty(e, r, t) {
|
|
90
87
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
91
88
|
value: t,
|
|
@@ -96,7 +93,7 @@ function _defineProperty(e, r, t) {
|
|
|
96
93
|
}
|
|
97
94
|
|
|
98
95
|
//#endregion
|
|
99
|
-
//#region \0@oxc-project+runtime@0.
|
|
96
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
|
|
100
97
|
function __decorateParam(paramIndex, decorator) {
|
|
101
98
|
return function(target, key) {
|
|
102
99
|
decorator(target, key, paramIndex);
|
|
@@ -104,7 +101,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
104
101
|
}
|
|
105
102
|
|
|
106
103
|
//#endregion
|
|
107
|
-
//#region \0@oxc-project+runtime@0.
|
|
104
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
|
|
108
105
|
function __decorate(decorators, target, key, desc) {
|
|
109
106
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
110
107
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -113,7 +110,7 @@ function __decorate(decorators, target, key, desc) {
|
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
//#endregion
|
|
116
|
-
//#region src/services/sheets-sort-ui.service.
|
|
113
|
+
//#region src/services/sheets-sort-ui.service.ts
|
|
117
114
|
const SORT_ERROR_MESSAGE = {
|
|
118
115
|
MERGE_ERROR: "sheets-sort-ui.error.merge-size",
|
|
119
116
|
EMPTY_ERROR: "sheets-sort-ui.error.empty",
|
|
@@ -192,7 +189,7 @@ let SheetsSortUIService = class SheetsSortUIService extends Disposable {
|
|
|
192
189
|
return await this._confirmService.confirm({
|
|
193
190
|
id: "sort-range-check-error",
|
|
194
191
|
title: { title: this._localeService.t("sheets-sort-ui.info.tooltip") },
|
|
195
|
-
children: { title:
|
|
192
|
+
children: { title: createSortCheckError(this._localeService.t(content)) },
|
|
196
193
|
cancelText: this._localeService.t("sheets-sort-ui.dialog.cancel"),
|
|
197
194
|
confirmText: this._localeService.t("sheets-sort-ui.dialog.confirm")
|
|
198
195
|
});
|
|
@@ -202,9 +199,9 @@ let SheetsSortUIService = class SheetsSortUIService extends Disposable {
|
|
|
202
199
|
if (await this._confirmService.confirm({
|
|
203
200
|
id: "extend-sort-range-dialog",
|
|
204
201
|
title: { title: this._localeService.t("sheets-sort-ui.dialog.sort-reminder") },
|
|
205
|
-
children: { title:
|
|
202
|
+
children: { title: createExtendConfirm((value) => {
|
|
206
203
|
shouldExtend = value === "1";
|
|
207
|
-
}
|
|
204
|
+
}) },
|
|
208
205
|
width: 400,
|
|
209
206
|
cancelText: this._localeService.t("sheets-sort-ui.dialog.cancel"),
|
|
210
207
|
confirmText: this._localeService.t("sheets-sort-ui.dialog.confirm")
|
|
@@ -373,7 +370,7 @@ const SortRangeCustomInCtxMenuCommand = {
|
|
|
373
370
|
//#endregion
|
|
374
371
|
//#region package.json
|
|
375
372
|
var name = "@univerjs/sheets-sort-ui";
|
|
376
|
-
var version = "0.
|
|
373
|
+
var version = "1.0.0-alpha.0";
|
|
377
374
|
|
|
378
375
|
//#endregion
|
|
379
376
|
//#region src/config/config.ts
|
|
@@ -381,203 +378,6 @@ const SHEETS_SORT_UI_PLUGIN_CONFIG_KEY = "sheets-sort-ui.config";
|
|
|
381
378
|
const configSymbol = Symbol(SHEETS_SORT_UI_PLUGIN_CONFIG_KEY);
|
|
382
379
|
const defaultPluginConfig = {};
|
|
383
380
|
|
|
384
|
-
//#endregion
|
|
385
|
-
//#region src/menu/sheets-sort.menu.ts
|
|
386
|
-
const SHEETS_SORT_MENU_ID = "sheet.menu.sheets-sort";
|
|
387
|
-
const SHEETS_SORT_CTX_MENU_ID = "sheet.menu.sheets-sort-ctx";
|
|
388
|
-
const SHEETS_SORT_ASC_ICON = "AscendingIcon";
|
|
389
|
-
const SHEETS_SORT_ASC_EXT_ICON = "ExpandAscendingIcon";
|
|
390
|
-
const SHEETS_SORT_DESC_ICON = "DescendingIcon";
|
|
391
|
-
const SHEETS_SORT_DESC_EXT_ICON = "ExpandDescendingIcon";
|
|
392
|
-
const SHEETS_SORT_CUSTOM_ICON = "CustomSortIcon";
|
|
393
|
-
function sortRangeMenuFactory(accessor) {
|
|
394
|
-
return {
|
|
395
|
-
id: SHEETS_SORT_MENU_ID,
|
|
396
|
-
type: MenuItemType.SUBITEMS,
|
|
397
|
-
icon: SHEETS_SORT_ASC_ICON,
|
|
398
|
-
tooltip: "sheets-sort-ui.general.sort",
|
|
399
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
400
|
-
disabled$: getCurrentRangeDisable$(accessor, {
|
|
401
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
402
|
-
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
403
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
404
|
-
})
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
function sortRangeAscMenuFactory(_accessor) {
|
|
408
|
-
return {
|
|
409
|
-
id: SortRangeAscCommand.id,
|
|
410
|
-
icon: SHEETS_SORT_ASC_ICON,
|
|
411
|
-
title: "sheets-sort-ui.general.sort-asc-cur",
|
|
412
|
-
type: MenuItemType.BUTTON,
|
|
413
|
-
hidden$: getCurrentExclusiveRangeInterest$(_accessor)
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
function sortRangeAscExtMenuFactory(_accessor) {
|
|
417
|
-
return {
|
|
418
|
-
id: SortRangeAscExtCommand.id,
|
|
419
|
-
title: "sheets-sort-ui.general.sort-asc-ext",
|
|
420
|
-
icon: SHEETS_SORT_ASC_EXT_ICON,
|
|
421
|
-
type: MenuItemType.BUTTON
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
function sortRangeDescMenuFactory(_accessor) {
|
|
425
|
-
return {
|
|
426
|
-
id: SortRangeDescCommand.id,
|
|
427
|
-
title: "sheets-sort-ui.general.sort-desc-cur",
|
|
428
|
-
icon: SHEETS_SORT_DESC_ICON,
|
|
429
|
-
type: MenuItemType.BUTTON
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
function sortRangeDescExtMenuFactory(_accessor) {
|
|
433
|
-
return {
|
|
434
|
-
id: SortRangeDescExtCommand.id,
|
|
435
|
-
title: "sheets-sort-ui.general.sort-desc-ext",
|
|
436
|
-
icon: SHEETS_SORT_DESC_EXT_ICON,
|
|
437
|
-
type: MenuItemType.BUTTON
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
function sortRangeCustomMenuFactory(_accessor) {
|
|
441
|
-
return {
|
|
442
|
-
id: SortRangeCustomCommand.id,
|
|
443
|
-
title: "sheets-sort-ui.general.sort-custom",
|
|
444
|
-
type: MenuItemType.BUTTON,
|
|
445
|
-
icon: SHEETS_SORT_CUSTOM_ICON
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
function sortRangeCtxMenuFactory(accessor) {
|
|
449
|
-
return {
|
|
450
|
-
id: SHEETS_SORT_CTX_MENU_ID,
|
|
451
|
-
title: "sheets-sort-ui.general.sort",
|
|
452
|
-
type: MenuItemType.SUBITEMS,
|
|
453
|
-
icon: SHEETS_SORT_ASC_ICON,
|
|
454
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
455
|
-
disabled$: getCurrentRangeDisable$(accessor, {
|
|
456
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
457
|
-
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
458
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
459
|
-
})
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
function sortRangeAscCtxMenuFactory(_accessor) {
|
|
463
|
-
return {
|
|
464
|
-
id: SortRangeAscInCtxMenuCommand.id,
|
|
465
|
-
title: "sheets-sort-ui.general.sort-asc-cur",
|
|
466
|
-
type: MenuItemType.BUTTON,
|
|
467
|
-
icon: SHEETS_SORT_ASC_ICON,
|
|
468
|
-
disabled$: getCurrentRangeDisable$(_accessor, {
|
|
469
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
470
|
-
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
471
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
472
|
-
})
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
function sortRangeAscExtCtxMenuFactory(_accessor) {
|
|
476
|
-
return {
|
|
477
|
-
id: SortRangeAscExtInCtxMenuCommand.id,
|
|
478
|
-
title: "sheets-sort-ui.general.sort-asc-ext",
|
|
479
|
-
type: MenuItemType.BUTTON,
|
|
480
|
-
icon: SHEETS_SORT_ASC_EXT_ICON,
|
|
481
|
-
disabled$: getCurrentRangeDisable$(_accessor, {
|
|
482
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
483
|
-
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
484
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
485
|
-
})
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
function sortRangeDescCtxMenuFactory(_accessor) {
|
|
489
|
-
return {
|
|
490
|
-
id: SortRangeDescInCtxMenuCommand.id,
|
|
491
|
-
title: "sheets-sort-ui.general.sort-desc-cur",
|
|
492
|
-
type: MenuItemType.BUTTON,
|
|
493
|
-
icon: SHEETS_SORT_DESC_ICON,
|
|
494
|
-
disabled$: getCurrentRangeDisable$(_accessor, {
|
|
495
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
496
|
-
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
497
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
498
|
-
})
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
function sortRangeDescExtCtxMenuFactory(_accessor) {
|
|
502
|
-
return {
|
|
503
|
-
id: SortRangeDescExtInCtxMenuCommand.id,
|
|
504
|
-
title: "sheets-sort-ui.general.sort-desc-ext",
|
|
505
|
-
type: MenuItemType.BUTTON,
|
|
506
|
-
icon: SHEETS_SORT_DESC_EXT_ICON,
|
|
507
|
-
disabled$: getCurrentRangeDisable$(_accessor, {
|
|
508
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
509
|
-
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
510
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
511
|
-
})
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
function sortRangeCustomCtxMenuFactory(_accessor) {
|
|
515
|
-
return {
|
|
516
|
-
id: SortRangeCustomInCtxMenuCommand.id,
|
|
517
|
-
title: "sheets-sort-ui.general.sort-custom",
|
|
518
|
-
type: MenuItemType.BUTTON,
|
|
519
|
-
icon: SHEETS_SORT_CUSTOM_ICON,
|
|
520
|
-
disabled$: getCurrentRangeDisable$(_accessor, {
|
|
521
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
522
|
-
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
523
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
524
|
-
})
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
//#endregion
|
|
529
|
-
//#region src/menu/schema.ts
|
|
530
|
-
const menuSchema = {
|
|
531
|
-
[RibbonDataGroup.ORGANIZATION]: { [SHEETS_SORT_MENU_ID]: {
|
|
532
|
-
order: 3,
|
|
533
|
-
menuItemFactory: sortRangeMenuFactory,
|
|
534
|
-
[SortRangeAscCommand.id]: {
|
|
535
|
-
order: 0,
|
|
536
|
-
menuItemFactory: sortRangeAscMenuFactory
|
|
537
|
-
},
|
|
538
|
-
[SortRangeAscExtCommand.id]: {
|
|
539
|
-
order: 1,
|
|
540
|
-
menuItemFactory: sortRangeAscExtMenuFactory
|
|
541
|
-
},
|
|
542
|
-
[SortRangeDescCommand.id]: {
|
|
543
|
-
order: 2,
|
|
544
|
-
menuItemFactory: sortRangeDescMenuFactory
|
|
545
|
-
},
|
|
546
|
-
[SortRangeDescExtCommand.id]: {
|
|
547
|
-
order: 3,
|
|
548
|
-
menuItemFactory: sortRangeDescExtMenuFactory
|
|
549
|
-
},
|
|
550
|
-
[SortRangeCustomCommand.id]: {
|
|
551
|
-
order: 4,
|
|
552
|
-
menuItemFactory: sortRangeCustomMenuFactory
|
|
553
|
-
}
|
|
554
|
-
} },
|
|
555
|
-
[ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { [SHEETS_SORT_CTX_MENU_ID]: {
|
|
556
|
-
order: 0,
|
|
557
|
-
menuItemFactory: sortRangeCtxMenuFactory,
|
|
558
|
-
[SortRangeAscInCtxMenuCommand.id]: {
|
|
559
|
-
order: 0,
|
|
560
|
-
menuItemFactory: sortRangeAscCtxMenuFactory
|
|
561
|
-
},
|
|
562
|
-
[SortRangeAscExtInCtxMenuCommand.id]: {
|
|
563
|
-
order: 1,
|
|
564
|
-
menuItemFactory: sortRangeAscExtCtxMenuFactory
|
|
565
|
-
},
|
|
566
|
-
[SortRangeDescInCtxMenuCommand.id]: {
|
|
567
|
-
order: 2,
|
|
568
|
-
menuItemFactory: sortRangeDescCtxMenuFactory
|
|
569
|
-
},
|
|
570
|
-
[SortRangeDescExtInCtxMenuCommand.id]: {
|
|
571
|
-
order: 3,
|
|
572
|
-
menuItemFactory: sortRangeDescExtCtxMenuFactory
|
|
573
|
-
},
|
|
574
|
-
[SortRangeCustomInCtxMenuCommand.id]: {
|
|
575
|
-
order: 4,
|
|
576
|
-
menuItemFactory: sortRangeCustomCtxMenuFactory
|
|
577
|
-
}
|
|
578
|
-
} } }
|
|
579
|
-
};
|
|
580
|
-
|
|
581
381
|
//#endregion
|
|
582
382
|
//#region src/views/CustomSortPanel.tsx
|
|
583
383
|
function CustomSortPanel() {
|
|
@@ -745,7 +545,7 @@ function SortOptionItem(props) {
|
|
|
745
545
|
children: [/* @__PURE__ */ jsx("div", {
|
|
746
546
|
"data-u-comp": "sort-panel-item-handler",
|
|
747
547
|
className: "univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-text-base univer-text-gray-700",
|
|
748
|
-
children: /* @__PURE__ */ jsx(
|
|
548
|
+
children: /* @__PURE__ */ jsx(GripVerticalIcon, {})
|
|
749
549
|
}), /* @__PURE__ */ jsx(Dropdown, {
|
|
750
550
|
overlay: /* @__PURE__ */ jsx("ul", {
|
|
751
551
|
className: clsx("univer-my-0 univer-box-border univer-grid univer-max-h-[310px] univer-w-[--radix-popper-anchor-width] univer-items-center univer-gap-1 univer-overflow-y-auto univer-overflow-x-hidden univer-rounded-lg univer-border univer-bg-white univer-p-1 univer-text-base univer-shadow-lg", scrollbarClassName),
|
|
@@ -800,6 +600,240 @@ function findNextColIndex(range, list) {
|
|
|
800
600
|
return null;
|
|
801
601
|
}
|
|
802
602
|
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region src/controllers/components.controller.ts
|
|
605
|
+
/**
|
|
606
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
607
|
+
*
|
|
608
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
609
|
+
* you may not use this file except in compliance with the License.
|
|
610
|
+
* You may obtain a copy of the License at
|
|
611
|
+
*
|
|
612
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
613
|
+
*
|
|
614
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
615
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
616
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
617
|
+
* See the License for the specific language governing permissions and
|
|
618
|
+
* limitations under the License.
|
|
619
|
+
*/
|
|
620
|
+
let ComponentsController = class ComponentsController extends Disposable {
|
|
621
|
+
constructor(_componentManager, _iconManager) {
|
|
622
|
+
super();
|
|
623
|
+
this._componentManager = _componentManager;
|
|
624
|
+
this._iconManager = _iconManager;
|
|
625
|
+
this._registerIcons();
|
|
626
|
+
this._registerComponents();
|
|
627
|
+
}
|
|
628
|
+
_registerIcons() {
|
|
629
|
+
this.disposeWithMe(this._iconManager.register({
|
|
630
|
+
AscendingIcon,
|
|
631
|
+
ExpandAscendingIcon,
|
|
632
|
+
DescendingIcon,
|
|
633
|
+
ExpandDescendingIcon,
|
|
634
|
+
CustomSortIcon
|
|
635
|
+
}));
|
|
636
|
+
}
|
|
637
|
+
_registerComponents() {
|
|
638
|
+
[["CustomSortPanel", CustomSortPanel]].forEach(([key, comp]) => {
|
|
639
|
+
this.disposeWithMe(this._componentManager.register(key, comp));
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
|
|
644
|
+
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/menu/sheets-sort.menu.ts
|
|
647
|
+
const SHEETS_SORT_MENU_ID = "sheet.menu.sheets-sort";
|
|
648
|
+
const SHEETS_SORT_CTX_MENU_ID = "sheet.menu.sheets-sort-ctx";
|
|
649
|
+
function sortRangeMenuFactory(accessor) {
|
|
650
|
+
return {
|
|
651
|
+
id: SHEETS_SORT_MENU_ID,
|
|
652
|
+
type: MenuItemType.SUBITEMS,
|
|
653
|
+
icon: "AscendingIcon",
|
|
654
|
+
tooltip: "sheets-sort-ui.general.sort",
|
|
655
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
656
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
657
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
658
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
659
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
660
|
+
})
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
function sortRangeAscMenuFactory(accessor) {
|
|
664
|
+
return {
|
|
665
|
+
id: SortRangeAscCommand.id,
|
|
666
|
+
icon: "AscendingIcon",
|
|
667
|
+
title: "sheets-sort-ui.general.sort-asc-cur",
|
|
668
|
+
type: MenuItemType.BUTTON,
|
|
669
|
+
hidden$: getCurrentExclusiveRangeInterest$(accessor)
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function sortRangeAscExtMenuFactory() {
|
|
673
|
+
return {
|
|
674
|
+
id: SortRangeAscExtCommand.id,
|
|
675
|
+
title: "sheets-sort-ui.general.sort-asc-ext",
|
|
676
|
+
icon: "ExpandAscendingIcon",
|
|
677
|
+
type: MenuItemType.BUTTON
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function sortRangeDescMenuFactory() {
|
|
681
|
+
return {
|
|
682
|
+
id: SortRangeDescCommand.id,
|
|
683
|
+
title: "sheets-sort-ui.general.sort-desc-cur",
|
|
684
|
+
icon: "DescendingIcon",
|
|
685
|
+
type: MenuItemType.BUTTON
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
function sortRangeDescExtMenuFactory() {
|
|
689
|
+
return {
|
|
690
|
+
id: SortRangeDescExtCommand.id,
|
|
691
|
+
title: "sheets-sort-ui.general.sort-desc-ext",
|
|
692
|
+
icon: "ExpandDescendingIcon",
|
|
693
|
+
type: MenuItemType.BUTTON
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function sortRangeCustomMenuFactory() {
|
|
697
|
+
return {
|
|
698
|
+
id: SortRangeCustomCommand.id,
|
|
699
|
+
title: "sheets-sort-ui.general.sort-custom",
|
|
700
|
+
type: MenuItemType.BUTTON,
|
|
701
|
+
icon: "CustomSortIcon"
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function sortRangeCtxMenuFactory(accessor) {
|
|
705
|
+
return {
|
|
706
|
+
id: SHEETS_SORT_CTX_MENU_ID,
|
|
707
|
+
title: "sheets-sort-ui.general.sort",
|
|
708
|
+
type: MenuItemType.SUBITEMS,
|
|
709
|
+
icon: "AscendingIcon",
|
|
710
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
711
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
712
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
713
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
714
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
715
|
+
})
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
function sortRangeAscCtxMenuFactory(accessor) {
|
|
719
|
+
return {
|
|
720
|
+
id: SortRangeAscInCtxMenuCommand.id,
|
|
721
|
+
title: "sheets-sort-ui.general.sort-asc-cur",
|
|
722
|
+
type: MenuItemType.BUTTON,
|
|
723
|
+
icon: "AscendingIcon",
|
|
724
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
725
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
726
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
727
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
728
|
+
})
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
function sortRangeAscExtCtxMenuFactory(accessor) {
|
|
732
|
+
return {
|
|
733
|
+
id: SortRangeAscExtInCtxMenuCommand.id,
|
|
734
|
+
title: "sheets-sort-ui.general.sort-asc-ext",
|
|
735
|
+
type: MenuItemType.BUTTON,
|
|
736
|
+
icon: "ExpandAscendingIcon",
|
|
737
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
738
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
739
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
740
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
741
|
+
})
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
function sortRangeDescCtxMenuFactory(accessor) {
|
|
745
|
+
return {
|
|
746
|
+
id: SortRangeDescInCtxMenuCommand.id,
|
|
747
|
+
title: "sheets-sort-ui.general.sort-desc-cur",
|
|
748
|
+
type: MenuItemType.BUTTON,
|
|
749
|
+
icon: "DescendingIcon",
|
|
750
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
751
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
752
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
753
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
754
|
+
})
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function sortRangeDescExtCtxMenuFactory(accessor) {
|
|
758
|
+
return {
|
|
759
|
+
id: SortRangeDescExtInCtxMenuCommand.id,
|
|
760
|
+
title: "sheets-sort-ui.general.sort-desc-ext",
|
|
761
|
+
type: MenuItemType.BUTTON,
|
|
762
|
+
icon: "ExpandDescendingIcon",
|
|
763
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
764
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
765
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
766
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
767
|
+
})
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
function sortRangeCustomCtxMenuFactory(accessor) {
|
|
771
|
+
return {
|
|
772
|
+
id: SortRangeCustomInCtxMenuCommand.id,
|
|
773
|
+
title: "sheets-sort-ui.general.sort-custom",
|
|
774
|
+
type: MenuItemType.BUTTON,
|
|
775
|
+
icon: "CustomSortIcon",
|
|
776
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
777
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
778
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
779
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
780
|
+
})
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region src/menu/schema.ts
|
|
786
|
+
const menuSchema = {
|
|
787
|
+
[RibbonDataGroup.ORGANIZATION]: { [SHEETS_SORT_MENU_ID]: {
|
|
788
|
+
order: 3,
|
|
789
|
+
menuItemFactory: sortRangeMenuFactory,
|
|
790
|
+
[SortRangeAscCommand.id]: {
|
|
791
|
+
order: 0,
|
|
792
|
+
menuItemFactory: sortRangeAscMenuFactory
|
|
793
|
+
},
|
|
794
|
+
[SortRangeAscExtCommand.id]: {
|
|
795
|
+
order: 1,
|
|
796
|
+
menuItemFactory: sortRangeAscExtMenuFactory
|
|
797
|
+
},
|
|
798
|
+
[SortRangeDescCommand.id]: {
|
|
799
|
+
order: 2,
|
|
800
|
+
menuItemFactory: sortRangeDescMenuFactory
|
|
801
|
+
},
|
|
802
|
+
[SortRangeDescExtCommand.id]: {
|
|
803
|
+
order: 3,
|
|
804
|
+
menuItemFactory: sortRangeDescExtMenuFactory
|
|
805
|
+
},
|
|
806
|
+
[SortRangeCustomCommand.id]: {
|
|
807
|
+
order: 4,
|
|
808
|
+
menuItemFactory: sortRangeCustomMenuFactory
|
|
809
|
+
}
|
|
810
|
+
} },
|
|
811
|
+
[ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { [SHEETS_SORT_CTX_MENU_ID]: {
|
|
812
|
+
order: 0,
|
|
813
|
+
menuItemFactory: sortRangeCtxMenuFactory,
|
|
814
|
+
[SortRangeAscInCtxMenuCommand.id]: {
|
|
815
|
+
order: 0,
|
|
816
|
+
menuItemFactory: sortRangeAscCtxMenuFactory
|
|
817
|
+
},
|
|
818
|
+
[SortRangeAscExtInCtxMenuCommand.id]: {
|
|
819
|
+
order: 1,
|
|
820
|
+
menuItemFactory: sortRangeAscExtCtxMenuFactory
|
|
821
|
+
},
|
|
822
|
+
[SortRangeDescInCtxMenuCommand.id]: {
|
|
823
|
+
order: 2,
|
|
824
|
+
menuItemFactory: sortRangeDescCtxMenuFactory
|
|
825
|
+
},
|
|
826
|
+
[SortRangeDescExtInCtxMenuCommand.id]: {
|
|
827
|
+
order: 3,
|
|
828
|
+
menuItemFactory: sortRangeDescExtCtxMenuFactory
|
|
829
|
+
},
|
|
830
|
+
[SortRangeCustomInCtxMenuCommand.id]: {
|
|
831
|
+
order: 4,
|
|
832
|
+
menuItemFactory: sortRangeCustomCtxMenuFactory
|
|
833
|
+
}
|
|
834
|
+
} } }
|
|
835
|
+
};
|
|
836
|
+
|
|
803
837
|
//#endregion
|
|
804
838
|
//#region src/views/EmbedSortBtn.tsx
|
|
805
839
|
function EmbedSortBtn(props) {
|
|
@@ -842,12 +876,12 @@ function EmbedSortBtn(props) {
|
|
|
842
876
|
}
|
|
843
877
|
|
|
844
878
|
//#endregion
|
|
845
|
-
//#region src/controllers/
|
|
879
|
+
//#region src/controllers/ui.controller.ts
|
|
846
880
|
const CUSTOM_SORT_DIALOG_ID = "custom-sort-dialog";
|
|
847
881
|
const CUSTOM_SORT_PANEL_WIDTH = 560;
|
|
848
882
|
const CUSTOM_SORT_PANEL_TOP = 128;
|
|
849
883
|
let SheetsSortUIController = class SheetsSortUIController extends RxDisposable {
|
|
850
|
-
constructor(_commandService, _menuManagerService, _dialogService, _layoutService, _uiPartsService, _sheetRenderService, _localeService, _sheetsSortUIService, _injector
|
|
884
|
+
constructor(_commandService, _menuManagerService, _dialogService, _layoutService, _uiPartsService, _sheetRenderService, _localeService, _sheetsSortUIService, _injector) {
|
|
851
885
|
super();
|
|
852
886
|
this._commandService = _commandService;
|
|
853
887
|
this._menuManagerService = _menuManagerService;
|
|
@@ -858,7 +892,6 @@ let SheetsSortUIController = class SheetsSortUIController extends RxDisposable {
|
|
|
858
892
|
this._localeService = _localeService;
|
|
859
893
|
this._sheetsSortUIService = _sheetsSortUIService;
|
|
860
894
|
this._injector = _injector;
|
|
861
|
-
this._componentManager = _componentManager;
|
|
862
895
|
this._initCommands();
|
|
863
896
|
this._initMenu();
|
|
864
897
|
this._initUI();
|
|
@@ -883,16 +916,6 @@ let SheetsSortUIController = class SheetsSortUIController extends RxDisposable {
|
|
|
883
916
|
}
|
|
884
917
|
_initUI() {
|
|
885
918
|
this.disposeWithMe(this._uiPartsService.registerComponent(SheetsUIPart.FILTER_PANEL_EMBED_POINT, () => connectInjector(EmbedSortBtn, this._injector)));
|
|
886
|
-
[
|
|
887
|
-
["CustomSortPanel", CustomSortPanel],
|
|
888
|
-
[SHEETS_SORT_ASC_ICON, AscendingIcon],
|
|
889
|
-
[SHEETS_SORT_ASC_EXT_ICON, ExpandAscendingIcon],
|
|
890
|
-
[SHEETS_SORT_DESC_ICON, DescendingIcon],
|
|
891
|
-
[SHEETS_SORT_DESC_EXT_ICON, ExpandDescendingIcon],
|
|
892
|
-
[SHEETS_SORT_CUSTOM_ICON, CustomSortIcon]
|
|
893
|
-
].forEach(([key, comp]) => {
|
|
894
|
-
this.disposeWithMe(this._componentManager.register(key, comp));
|
|
895
|
-
});
|
|
896
919
|
this._sheetsSortUIService.customSortState$.pipe(takeUntil(this.dispose$)).subscribe((newState) => {
|
|
897
920
|
if (newState && newState.show && newState.location) this._openCustomSortPanel(newState.location);
|
|
898
921
|
else if (newState && !(newState === null || newState === void 0 ? void 0 : newState.show)) this._closePanel();
|
|
@@ -926,8 +949,7 @@ SheetsSortUIController = __decorate([
|
|
|
926
949
|
__decorateParam(5, Inject(SheetsRenderService)),
|
|
927
950
|
__decorateParam(6, Inject(LocaleService)),
|
|
928
951
|
__decorateParam(7, Inject(SheetsSortUIService)),
|
|
929
|
-
__decorateParam(8, Inject(Injector))
|
|
930
|
-
__decorateParam(9, Inject(ComponentManager))
|
|
952
|
+
__decorateParam(8, Inject(Injector))
|
|
931
953
|
], SheetsSortUIController);
|
|
932
954
|
function getCustomSortDialogDefaultPosition() {
|
|
933
955
|
return {
|
|
@@ -948,6 +970,8 @@ let UniverSheetsSortUIPlugin = class UniverSheetsSortUIPlugin extends Plugin {
|
|
|
948
970
|
this._configService.setConfig(SHEETS_SORT_UI_PLUGIN_CONFIG_KEY, rest);
|
|
949
971
|
}
|
|
950
972
|
onStarting() {
|
|
973
|
+
this._injector.add([ComponentsController]);
|
|
974
|
+
this._injector.get(ComponentsController);
|
|
951
975
|
[[SheetsSortUIService], [SheetsSortUIController]].forEach((d) => this._injector.add(d));
|
|
952
976
|
}
|
|
953
977
|
onRendered() {
|