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