@univerjs/sheets-sort-ui 0.5.4 → 0.5.5-experimental.20250123-34738ff
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 +10 -18
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +583 -585
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/index.css +1 -1
- package/lib/types/views/CustomSortPanel.d.ts +2 -3
- package/lib/types/views/EmbedSortBtn.d.ts +1 -2
- package/lib/types/views/ExtendConfirm.d.ts +16 -2
- package/lib/umd/index.js +10 -18
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +12 -12
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,495 +1,474 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
+
import { useDependency, LocaleService, Inject, Disposable, UniverInstanceType, IUniverInstanceService, ILogService, ICommandService, Tools, LocaleType, CommandType, throttle, Injector, RxDisposable, connectInjector, DependentOn, Plugin, merge, IConfigService } from "@univerjs/core";
|
|
6
|
+
import { SheetsSortService, SortType, SortRangeCommand, UniverSheetsSortPlugin } from "@univerjs/sheets-sort";
|
|
7
|
+
import { serializeRange } from "@univerjs/engine-formula";
|
|
8
|
+
import { getCurrentRangeDisable$, getCurrentExclusiveRangeInterest$, SheetsRenderService, SheetsUIPart } from "@univerjs/sheets-ui";
|
|
9
|
+
import { IConfirmService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IMenuManagerService, IDialogService, ILayoutService, IUIPartsService } from "@univerjs/ui";
|
|
10
|
+
import { BehaviorSubject, takeUntil } from "rxjs";
|
|
11
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
12
|
+
import { SheetsSelectionsService, getPrimaryForRange, SetSelectionsOperation, expandToContinuousRange, getSheetCommandTarget, WorkbookEditablePermission, WorksheetSortPermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint } from "@univerjs/sheets";
|
|
13
|
+
import { RadioGroup, Radio, Checkbox, DraggableList, Button, DropdownLegacy } from "@univerjs/design";
|
|
14
|
+
import { forwardRef, useRef, createElement, useState, useCallback, useEffect } from "react";
|
|
15
|
+
const SHEETS_SORT_UI_PLUGIN_CONFIG_KEY = "sheets-sort-ui.config", defaultPluginConfig = {};
|
|
16
|
+
var __assign = function() {
|
|
17
|
+
return __assign = Object.assign || function(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
19
21
|
}
|
|
20
|
-
return
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
var
|
|
24
|
-
for (var
|
|
25
|
-
if (
|
|
26
|
-
for (var
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
},
|
|
30
|
-
var
|
|
31
|
-
return
|
|
22
|
+
return t;
|
|
23
|
+
}, __assign.apply(this, arguments);
|
|
24
|
+
}, __rest = function(s, e) {
|
|
25
|
+
var t = {};
|
|
26
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
27
|
+
if (s != null && typeof Object.getOwnPropertySymbols == "function")
|
|
28
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
|
29
|
+
e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
30
|
+
return t;
|
|
31
|
+
}, IconBase = forwardRef(function(props, ref) {
|
|
32
|
+
var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
|
|
33
|
+
return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
|
|
32
34
|
});
|
|
33
|
-
function
|
|
34
|
-
return
|
|
35
|
-
return
|
|
35
|
+
function render(node, id, runtimeProps, rootProps, extend) {
|
|
36
|
+
return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
|
|
37
|
+
return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
|
|
36
38
|
}));
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
__name(render, "render");
|
|
41
|
+
function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
42
|
+
var attrs = __assign({}, node.attrs);
|
|
43
|
+
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
44
|
+
var defIds = runtimeProps.defIds;
|
|
45
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a4) {
|
|
46
|
+
var key = _a4[0], value = _a4[1];
|
|
47
|
+
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
48
|
+
})), attrs;
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
51
|
+
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
52
|
+
var _a4, defIds = runtimeProps.defIds;
|
|
53
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a4 = node.children) === null || _a4 === void 0) && _a4.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
54
|
+
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
55
|
+
}) }) : node;
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
__name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
|
|
58
|
+
function generateShortUuid() {
|
|
54
59
|
return Math.random().toString(36).substring(2, 8);
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
__name(generateShortUuid, "generateShortUuid");
|
|
62
|
+
IconBase.displayName = "UniverIcon";
|
|
63
|
+
var element$9 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z", fillRule: "evenodd", clipRule: "evenodd" } }] }, AscendingSingle = forwardRef(function(props, ref) {
|
|
64
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
59
65
|
id: "ascending- single",
|
|
60
|
-
ref
|
|
61
|
-
icon:
|
|
66
|
+
ref,
|
|
67
|
+
icon: element$9
|
|
62
68
|
}));
|
|
63
69
|
});
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
return
|
|
70
|
+
AscendingSingle.displayName = "AscendingSingle";
|
|
71
|
+
var element$8 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, CheckMarkSingle = forwardRef(function(props, ref) {
|
|
72
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
67
73
|
id: "check-mark-single",
|
|
68
|
-
ref
|
|
69
|
-
icon:
|
|
74
|
+
ref,
|
|
75
|
+
icon: element$8
|
|
70
76
|
}));
|
|
71
77
|
});
|
|
72
|
-
|
|
73
|
-
var
|
|
74
|
-
return
|
|
78
|
+
CheckMarkSingle.displayName = "CheckMarkSingle";
|
|
79
|
+
var element$7 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574 8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507 9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661 11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306zM6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512 7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574 6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588 4.88808 9.55156 5.26798 9.55156 5.50229 9.78588L6.22584 10.5094z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.14014 3.73989C1.14014 2.30396 2.3042 1.13989 3.74014 1.13989H12.2601C13.6961 1.13989 14.8601 2.30395 14.8601 3.73989V12.2599C14.8601 13.6958 13.6961 14.8599 12.2601 14.8599H3.74014C2.3042 14.8599 1.14014 13.6958 1.14014 12.2599V3.73989ZM2.34014 5.86724V12.2599C2.34014 13.0331 2.96694 13.6599 3.74014 13.6599H12.2601C13.0333 13.6599 13.6601 13.0331 13.6601 12.2599V5.86724H2.34014ZM13.6601 4.66724H2.34014V3.73989C2.34014 2.9667 2.96694 2.33989 3.74014 2.33989H12.2601C13.0333 2.33989 13.6601 2.96669 13.6601 3.73989V4.66724Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, CustomSortSingle = forwardRef(function(props, ref) {
|
|
80
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
75
81
|
id: "custom-sort-single",
|
|
76
|
-
ref
|
|
77
|
-
icon:
|
|
82
|
+
ref,
|
|
83
|
+
icon: element$7
|
|
78
84
|
}));
|
|
79
85
|
});
|
|
80
|
-
|
|
81
|
-
var
|
|
82
|
-
return
|
|
86
|
+
CustomSortSingle.displayName = "CustomSortSingle";
|
|
87
|
+
var element$6 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V13.1332C3.15332 14.2377 4.04875 15.1332 5.15332 15.1332H10.8465C11.9511 15.1332 12.8465 14.2377 12.8465 13.1331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V13.1331C11.6465 13.575 11.2884 13.9331 10.8465 13.9331H5.15332C4.71149 13.9331 4.35332 13.575 4.35332 13.1332V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, DeleteEmptySingle = forwardRef(function(props, ref) {
|
|
88
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
83
89
|
id: "delete-empty-single",
|
|
84
|
-
ref
|
|
85
|
-
icon:
|
|
90
|
+
ref,
|
|
91
|
+
icon: element$6
|
|
86
92
|
}));
|
|
87
93
|
});
|
|
88
|
-
|
|
89
|
-
var $
|
|
90
|
-
return
|
|
94
|
+
DeleteEmptySingle.displayName = "DeleteEmptySingle";
|
|
95
|
+
var element$5 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z", fillRule: "evenodd", clipRule: "evenodd" } }] }, DescendingSingle = forwardRef(function(props, ref) {
|
|
96
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
91
97
|
id: "descending-single",
|
|
92
|
-
ref
|
|
93
|
-
icon: $
|
|
98
|
+
ref,
|
|
99
|
+
icon: element$5
|
|
94
100
|
}));
|
|
95
101
|
});
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
return
|
|
102
|
+
DescendingSingle.displayName = "DescendingSingle";
|
|
103
|
+
var element$4 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.9064 3.20024C1.57503 3.20024 1.3064 2.93161 1.3064 2.60024C1.3064 2.26887 1.57503 2.00024 1.9064 2.00024H4.57306C4.90443 2.00024 5.17306 2.26887 5.17306 2.60024C5.17306 2.93161 4.90443 3.20024 4.57306 3.20024H1.9064ZM1.3064 6.19985C1.3064 6.53122 1.57503 6.79985 1.9064 6.79985H5.9064C6.23777 6.79985 6.5064 6.53122 6.5064 6.19985C6.5064 5.86848 6.23777 5.59985 5.9064 5.59985H1.9064C1.57503 5.59985 1.3064 5.86848 1.3064 6.19985ZM1.9064 10.3997C1.57503 10.3997 1.3064 10.1311 1.3064 9.79971C1.3064 9.46834 1.57503 9.19971 1.9064 9.19971H7.23973C7.5711 9.19971 7.83973 9.46834 7.83973 9.79971C7.83973 10.1311 7.5711 10.3997 7.23973 10.3997H1.9064ZM1.9064 13.9996C1.57503 13.9996 1.3064 13.7309 1.3064 13.3996C1.3064 13.0682 1.57503 12.7996 1.9064 12.7996H8.57306C8.90443 12.7996 9.17306 13.0682 9.17306 13.3996C9.17306 13.7309 8.90443 13.9996 8.57306 13.9996H1.9064Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.4267 14.2667C12.4267 14.5981 12.1581 14.8667 11.8267 14.8667C11.4953 14.8667 11.2267 14.5981 11.2267 14.2667V3.18198L9.98447 4.42422C9.75015 4.65853 9.37026 4.65853 9.13594 4.42422C8.90163 4.1899 8.90163 3.81 9.13594 3.57569L11.4026 1.30902C11.6369 1.07471 12.0168 1.07471 12.2511 1.30902L14.5178 3.57569C14.7521 3.81 14.7521 4.1899 14.5178 4.42422C14.2835 4.65853 13.9036 4.65853 13.6693 4.42422L12.4267 3.18165V14.2667Z" } }] }, ExpandAscendingSingle = forwardRef(function(props, ref) {
|
|
104
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
99
105
|
id: "expand-ascending-single",
|
|
100
|
-
ref
|
|
101
|
-
icon:
|
|
106
|
+
ref,
|
|
107
|
+
icon: element$4
|
|
102
108
|
}));
|
|
103
109
|
});
|
|
104
|
-
|
|
105
|
-
var
|
|
106
|
-
return
|
|
110
|
+
ExpandAscendingSingle.displayName = "ExpandAscendingSingle";
|
|
111
|
+
var element$3 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.9064 12.7998C1.57503 12.7998 1.3064 13.0684 1.3064 13.3998C1.3064 13.7311 1.57503 13.9998 1.9064 13.9998H4.57306C4.90443 13.9998 5.17306 13.7311 5.17306 13.3998C5.17306 13.0684 4.90443 12.7998 4.57306 12.7998H1.9064ZM1.3064 9.80015C1.3064 9.46878 1.57503 9.20015 1.9064 9.20015H5.9064C6.23777 9.20015 6.5064 9.46878 6.5064 9.80015C6.5064 10.1315 6.23777 10.4001 5.9064 10.4001H1.9064C1.57503 10.4001 1.3064 10.1315 1.3064 9.80015ZM1.9064 5.60029C1.57503 5.60029 1.3064 5.86892 1.3064 6.20029C1.3064 6.53166 1.57503 6.80029 1.9064 6.80029H7.23973C7.5711 6.80029 7.83973 6.53166 7.83973 6.20029C7.83973 5.86892 7.5711 5.60029 7.23973 5.60029H1.9064ZM1.9064 2.00044C1.57503 2.00044 1.3064 2.26907 1.3064 2.60044C1.3064 2.93181 1.57503 3.20044 1.9064 3.20044H8.57306C8.90443 3.20044 9.17306 2.93181 9.17306 2.60044C9.17306 2.26907 8.90443 2.00044 8.57306 2.00044H1.9064Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.4267 1.7333C12.4267 1.40193 12.1581 1.1333 11.8267 1.1333C11.4953 1.1333 11.2267 1.40193 11.2267 1.7333V12.818L9.98447 11.5758C9.75015 11.3415 9.37026 11.3415 9.13594 11.5758C8.90163 11.8101 8.90163 12.19 9.13594 12.4243L11.4026 14.691C11.6369 14.9253 12.0168 14.9253 12.2511 14.691L14.5178 12.4243C14.7521 12.19 14.7521 11.8101 14.5178 11.5758C14.2835 11.3415 13.9036 11.3415 13.6693 11.5758L12.4267 12.8183V1.7333Z" } }] }, ExpandDescendingSingle = forwardRef(function(props, ref) {
|
|
112
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
107
113
|
id: "expand-descending-single",
|
|
108
|
-
ref
|
|
109
|
-
icon:
|
|
114
|
+
ref,
|
|
115
|
+
icon: element$3
|
|
110
116
|
}));
|
|
111
117
|
});
|
|
112
|
-
|
|
113
|
-
var
|
|
114
|
-
return
|
|
118
|
+
ExpandDescendingSingle.displayName = "ExpandDescendingSingle";
|
|
119
|
+
var element$2 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, IncreaseSingle = forwardRef(function(props, ref) {
|
|
120
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
115
121
|
id: "increase-single",
|
|
116
|
-
ref
|
|
117
|
-
icon:
|
|
122
|
+
ref,
|
|
123
|
+
icon: element$2
|
|
118
124
|
}));
|
|
119
125
|
});
|
|
120
|
-
|
|
121
|
-
var
|
|
122
|
-
return
|
|
126
|
+
IncreaseSingle.displayName = "IncreaseSingle";
|
|
127
|
+
var element$1 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, MoreDownSingle = forwardRef(function(props, ref) {
|
|
128
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
123
129
|
id: "more-down-single",
|
|
124
|
-
ref
|
|
125
|
-
icon:
|
|
130
|
+
ref,
|
|
131
|
+
icon: element$1
|
|
126
132
|
}));
|
|
127
133
|
});
|
|
128
|
-
|
|
129
|
-
var
|
|
130
|
-
return
|
|
134
|
+
MoreDownSingle.displayName = "MoreDownSingle";
|
|
135
|
+
var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] }, SequenceSingle = forwardRef(function(props, ref) {
|
|
136
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
131
137
|
id: "sequence-single",
|
|
132
|
-
ref
|
|
133
|
-
icon:
|
|
138
|
+
ref,
|
|
139
|
+
icon: element
|
|
134
140
|
}));
|
|
135
141
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
extendConfirmContent:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
addCondition: Xt,
|
|
172
|
-
addConditionText: Kt,
|
|
173
|
-
addConditionDisable: Qt,
|
|
174
|
-
customSortPanelFooter: en,
|
|
175
|
-
customSortPanelFooterBtn: tn,
|
|
176
|
-
customSortPanelItem: nn,
|
|
177
|
-
customSortPanelItemHead: rn,
|
|
178
|
-
customSortPanelItemHandler: on,
|
|
179
|
-
customSortPanelItemRemove: sn,
|
|
180
|
-
customSortPanelItemColumnInput: cn,
|
|
181
|
-
customSortPanelItemColumnInputDropdown: an,
|
|
182
|
-
customSortPanelItemColumnInputText: ln,
|
|
183
|
-
customSortPanelItemOrderRadio: dn,
|
|
184
|
-
customSortPanelItemOrderRadioCn: un,
|
|
185
|
-
conditionList: mn,
|
|
186
|
-
embedSortBtnContainer: hn,
|
|
187
|
-
embedSortBtn: gn,
|
|
188
|
-
embedSortBtnAsc: Cn,
|
|
189
|
-
embedSortBtnDesc: Sn,
|
|
190
|
-
embedSortBtnIcon: fn,
|
|
191
|
-
customSortColMenu: pn,
|
|
192
|
-
customSortColMenuItem: vn,
|
|
193
|
-
customSortColMenuItemDesc: _n
|
|
194
|
-
}, xn = (e) => {
|
|
195
|
-
const [t, n] = B("0"), r = O(H);
|
|
196
|
-
return /* @__PURE__ */ i.jsxs("div", { className: a.extendConfirmContent, children: [
|
|
197
|
-
/* @__PURE__ */ i.jsx("div", { className: "extend-confirm-desc", children: r.t("sheets-sort.dialog.sort-reminder-desc") }),
|
|
198
|
-
/* @__PURE__ */ i.jsxs(
|
|
199
|
-
Ne,
|
|
142
|
+
SequenceSingle.displayName = "SequenceSingle";
|
|
143
|
+
const extendConfirmContent = "univer-extend-confirm-content", extendConfirmRadioGroup = "univer-extend-confirm-radio-group", customSortPanelContainer = "univer-custom-sort-panel-container", customSortPanelExt = "univer-custom-sort-panel-ext", addCondition = "univer-add-condition", addConditionText = "univer-add-condition-text", addConditionDisable = "univer-add-condition-disable", customSortPanelFooter = "univer-custom-sort-panel-footer", customSortPanelFooterBtn = "univer-custom-sort-panel-footer-btn", customSortPanelItem = "univer-custom-sort-panel-item", customSortPanelItemHead = "univer-custom-sort-panel-item-head", customSortPanelItemHandler = "univer-custom-sort-panel-item-handler", customSortPanelItemRemove = "univer-custom-sort-panel-item-remove", customSortPanelItemColumnInput = "univer-custom-sort-panel-item-column-input", customSortPanelItemColumnInputDropdown = "univer-custom-sort-panel-item-column-input-dropdown", customSortPanelItemColumnInputText = "univer-custom-sort-panel-item-column-input-text", customSortPanelItemOrderRadio = "univer-custom-sort-panel-item-order-radio", customSortPanelItemOrderRadioCn = "univer-custom-sort-panel-item-order-radio-cn", conditionList = "univer-condition-list", embedSortBtnContainer = "univer-embed-sort-btn-container", embedSortBtn = "univer-embed-sort-btn", embedSortBtnAsc = "univer-embed-sort-btn-asc", embedSortBtnDesc = "univer-embed-sort-btn-desc", embedSortBtnIcon = "univer-embed-sort-btn-icon", customSortColMenu = "univer-custom-sort-col-menu", customSortColMenuItem = "univer-custom-sort-col-menu-item", customSortColMenuItemDesc = "univer-custom-sort-col-menu-item-desc", styles = {
|
|
144
|
+
extendConfirmContent,
|
|
145
|
+
extendConfirmRadioGroup,
|
|
146
|
+
customSortPanelContainer,
|
|
147
|
+
customSortPanelExt,
|
|
148
|
+
addCondition,
|
|
149
|
+
addConditionText,
|
|
150
|
+
addConditionDisable,
|
|
151
|
+
customSortPanelFooter,
|
|
152
|
+
customSortPanelFooterBtn,
|
|
153
|
+
customSortPanelItem,
|
|
154
|
+
customSortPanelItemHead,
|
|
155
|
+
customSortPanelItemHandler,
|
|
156
|
+
customSortPanelItemRemove,
|
|
157
|
+
customSortPanelItemColumnInput,
|
|
158
|
+
customSortPanelItemColumnInputDropdown,
|
|
159
|
+
customSortPanelItemColumnInputText,
|
|
160
|
+
customSortPanelItemOrderRadio,
|
|
161
|
+
customSortPanelItemOrderRadioCn,
|
|
162
|
+
conditionList,
|
|
163
|
+
embedSortBtnContainer,
|
|
164
|
+
embedSortBtn,
|
|
165
|
+
embedSortBtnAsc,
|
|
166
|
+
embedSortBtnDesc,
|
|
167
|
+
embedSortBtnIcon,
|
|
168
|
+
customSortColMenu,
|
|
169
|
+
customSortColMenuItem,
|
|
170
|
+
customSortColMenuItemDesc
|
|
171
|
+
}, ExtendConfirm = /* @__PURE__ */ __name((props) => {
|
|
172
|
+
const [extend, setExtend] = useState("0"), localeService = useDependency(LocaleService);
|
|
173
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.extendConfirmContent, children: [
|
|
174
|
+
/* @__PURE__ */ jsx("div", { className: "extend-confirm-desc", children: localeService.t("sheets-sort.dialog.sort-reminder-desc") }),
|
|
175
|
+
/* @__PURE__ */ jsxs(
|
|
176
|
+
RadioGroup,
|
|
200
177
|
{
|
|
201
|
-
className:
|
|
202
|
-
value:
|
|
178
|
+
className: styles.extendConfirmRadioGroup,
|
|
179
|
+
value: extend,
|
|
203
180
|
direction: "vertical",
|
|
204
|
-
onChange: (
|
|
205
|
-
|
|
206
|
-
},
|
|
181
|
+
onChange: /* @__PURE__ */ __name((value) => {
|
|
182
|
+
setExtend(value), props.onChange(value);
|
|
183
|
+
}, "onChange"),
|
|
207
184
|
children: [
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
|
|
185
|
+
/* @__PURE__ */ jsx(
|
|
186
|
+
Radio,
|
|
210
187
|
{
|
|
211
188
|
value: "0",
|
|
212
|
-
children:
|
|
189
|
+
children: localeService.t("sheets-sort.dialog.sort-reminder-no")
|
|
213
190
|
}
|
|
214
191
|
),
|
|
215
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ jsx(Radio, { value: "1", children: localeService.t("sheets-sort.dialog.sort-reminder-ext") })
|
|
216
193
|
]
|
|
217
194
|
}
|
|
218
195
|
)
|
|
219
196
|
] });
|
|
220
|
-
};
|
|
221
|
-
var
|
|
222
|
-
for (var
|
|
223
|
-
(
|
|
224
|
-
return
|
|
225
|
-
},
|
|
226
|
-
const
|
|
197
|
+
}, "ExtendConfirm");
|
|
198
|
+
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
199
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
200
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
201
|
+
return kind && result && __defProp$2(target, key, result), result;
|
|
202
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2");
|
|
203
|
+
const SORT_ERROR_MESSAGE = {
|
|
227
204
|
MERGE_ERROR: "sheets-sort.error.merge-size",
|
|
228
205
|
EMPTY_ERROR: "sheets-sort.error.empty",
|
|
229
206
|
SINGLE_ERROR: "sheets-sort.error.single",
|
|
230
207
|
FORMULA_ARRAY: "sheets-sort.error.formula-array"
|
|
231
208
|
};
|
|
232
|
-
|
|
233
|
-
|
|
209
|
+
var _a;
|
|
210
|
+
let SheetsSortUIService = (_a = class extends Disposable {
|
|
211
|
+
constructor(_univerInstanceService, _confirmService, _logService, _selectionManagerService, _sheetsSortService, _localeService, _commandService) {
|
|
234
212
|
super();
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
this._univerInstanceService =
|
|
213
|
+
__publicField(this, "_customSortState$", new BehaviorSubject(null));
|
|
214
|
+
__publicField(this, "customSortState$", this._customSortState$.asObservable());
|
|
215
|
+
this._univerInstanceService = _univerInstanceService, this._confirmService = _confirmService, this._logService = _logService, this._selectionManagerService = _selectionManagerService, this._sheetsSortService = _sheetsSortService, this._localeService = _localeService, this._commandService = _commandService;
|
|
238
216
|
}
|
|
239
|
-
async triggerSortDirectly(
|
|
240
|
-
const
|
|
241
|
-
if (!
|
|
217
|
+
async triggerSortDirectly(asc, extend, sheetRangeLocation) {
|
|
218
|
+
const location = sheetRangeLocation || await this._detectSortLocation(extend);
|
|
219
|
+
if (!location || !this._check(location))
|
|
242
220
|
return !1;
|
|
243
|
-
const
|
|
221
|
+
const sortOption = {
|
|
244
222
|
orderRules: [{
|
|
245
|
-
type:
|
|
246
|
-
colIndex:
|
|
223
|
+
type: asc ? SortType.ASC : SortType.DESC,
|
|
224
|
+
colIndex: location.colIndex
|
|
247
225
|
}],
|
|
248
|
-
range:
|
|
226
|
+
range: location.range
|
|
249
227
|
};
|
|
250
|
-
return this._sheetsSortService.applySort(
|
|
228
|
+
return this._sheetsSortService.applySort(sortOption, location.unitId, location.subUnitId), !0;
|
|
251
229
|
}
|
|
252
230
|
async triggerSortCustomize() {
|
|
253
|
-
const
|
|
254
|
-
return !
|
|
231
|
+
const location = await this._detectSortLocation();
|
|
232
|
+
return !location || !this._check(location) ? !1 : (this.showCustomSortPanel(location), !0);
|
|
255
233
|
}
|
|
256
234
|
customSortState() {
|
|
257
235
|
return this._customSortState$.getValue();
|
|
258
236
|
}
|
|
259
|
-
getTitles(
|
|
260
|
-
var
|
|
261
|
-
const
|
|
262
|
-
if (!
|
|
237
|
+
getTitles(hasTitle) {
|
|
238
|
+
var _a4, _b;
|
|
239
|
+
const location = (_a4 = this.customSortState()) == null ? void 0 : _a4.location;
|
|
240
|
+
if (!location)
|
|
263
241
|
return [];
|
|
264
|
-
const { unitId
|
|
265
|
-
if (!
|
|
242
|
+
const { unitId, subUnitId, range } = location, worksheet = (_b = this._univerInstanceService.getUnit(unitId)) == null ? void 0 : _b.getSheetBySheetId(subUnitId);
|
|
243
|
+
if (!worksheet)
|
|
266
244
|
return [];
|
|
267
|
-
const
|
|
245
|
+
const colTranslator = colIndexTranslator(this._localeService);
|
|
268
246
|
return Array.from(
|
|
269
|
-
{ length:
|
|
270
|
-
(
|
|
271
|
-
var
|
|
272
|
-
const
|
|
247
|
+
{ length: range.endColumn - range.startColumn + 1 },
|
|
248
|
+
(_, i) => {
|
|
249
|
+
var _a5;
|
|
250
|
+
const cellValue = (_a5 = worksheet.getCell(range.startRow, i + range.startColumn)) == null ? void 0 : _a5.v;
|
|
273
251
|
return {
|
|
274
|
-
index:
|
|
275
|
-
label:
|
|
252
|
+
index: i + range.startColumn,
|
|
253
|
+
label: hasTitle ? `${cellValue != null ? cellValue : colTranslator(i + range.startColumn)}` : colTranslator(i + range.startColumn)
|
|
276
254
|
};
|
|
277
255
|
}
|
|
278
256
|
);
|
|
279
257
|
}
|
|
280
|
-
setSelection(
|
|
281
|
-
var
|
|
282
|
-
const
|
|
283
|
-
if (!
|
|
258
|
+
setSelection(unitId, subUnitId, range) {
|
|
259
|
+
var _a4;
|
|
260
|
+
const worksheet = (_a4 = this._univerInstanceService.getUnit(unitId)) == null ? void 0 : _a4.getSheetBySheetId(subUnitId);
|
|
261
|
+
if (!worksheet)
|
|
284
262
|
return;
|
|
285
|
-
const
|
|
286
|
-
unitId
|
|
287
|
-
subUnitId
|
|
288
|
-
selections: [{ range
|
|
263
|
+
const setSelectionsOperationParams = {
|
|
264
|
+
unitId,
|
|
265
|
+
subUnitId,
|
|
266
|
+
selections: [{ range, primary: getPrimaryForRange(range, worksheet), style: null }]
|
|
289
267
|
};
|
|
290
|
-
this._commandService.executeCommand(
|
|
268
|
+
this._commandService.executeCommand(SetSelectionsOperation.id, setSelectionsOperationParams);
|
|
291
269
|
}
|
|
292
|
-
async showCheckError(
|
|
270
|
+
async showCheckError(content) {
|
|
293
271
|
return await this._confirmService.confirm({
|
|
294
272
|
id: "sort-range-check-error",
|
|
295
273
|
title: {
|
|
296
274
|
title: this._localeService.t("info.tooltip")
|
|
297
275
|
},
|
|
298
276
|
children: {
|
|
299
|
-
title: /* @__PURE__ */
|
|
277
|
+
title: /* @__PURE__ */ jsx("div", { children: this._localeService.t(content) })
|
|
300
278
|
}
|
|
301
279
|
});
|
|
302
280
|
}
|
|
303
281
|
async showExtendConfirm() {
|
|
304
|
-
let
|
|
282
|
+
let shouldExtend = !1;
|
|
305
283
|
return await this._confirmService.confirm({
|
|
306
284
|
id: "extend-sort-range-dialog",
|
|
307
285
|
title: {
|
|
308
286
|
title: this._localeService.t("sheets-sort.dialog.sort-reminder")
|
|
309
287
|
},
|
|
310
288
|
children: {
|
|
311
|
-
title: /* @__PURE__ */
|
|
312
|
-
|
|
289
|
+
title: /* @__PURE__ */ jsx(
|
|
290
|
+
ExtendConfirm,
|
|
313
291
|
{
|
|
314
|
-
onChange: (
|
|
315
|
-
|
|
316
|
-
}
|
|
292
|
+
onChange: /* @__PURE__ */ __name((value) => {
|
|
293
|
+
shouldExtend = value === "1";
|
|
294
|
+
}, "onChange")
|
|
317
295
|
}
|
|
318
296
|
)
|
|
319
297
|
},
|
|
320
298
|
width: 400
|
|
321
|
-
}) ?
|
|
299
|
+
}) ? shouldExtend ? "extend" : "keep" : "cancel";
|
|
322
300
|
}
|
|
323
|
-
showCustomSortPanel(
|
|
324
|
-
this._customSortState$.next({ location
|
|
301
|
+
showCustomSortPanel(location) {
|
|
302
|
+
this._customSortState$.next({ location, show: !0 });
|
|
325
303
|
}
|
|
326
304
|
closeCustomSortPanel() {
|
|
327
305
|
this._customSortState$.next({ show: !1 });
|
|
328
306
|
}
|
|
329
|
-
_check(
|
|
330
|
-
return this._sheetsSortService.singleCheck(
|
|
307
|
+
_check(location) {
|
|
308
|
+
return this._sheetsSortService.singleCheck(location) ? this._sheetsSortService.mergeCheck(location) ? this._sheetsSortService.formulaCheck(location) ? this._sheetsSortService.emptyCheck(location) ? !0 : (this.showCheckError(SORT_ERROR_MESSAGE.EMPTY_ERROR), !1) : (this.showCheckError(SORT_ERROR_MESSAGE.FORMULA_ARRAY), !1) : (this.showCheckError(SORT_ERROR_MESSAGE.MERGE_ERROR), !1) : (this.showCheckError(SORT_ERROR_MESSAGE.SINGLE_ERROR), !1);
|
|
331
309
|
}
|
|
332
|
-
async _detectSortLocation(
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
310
|
+
async _detectSortLocation(extend) {
|
|
311
|
+
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet = workbook.getActiveSheet(), unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), selection = this._selectionManagerService.getCurrentLastSelection();
|
|
312
|
+
if (!selection)
|
|
335
313
|
return null;
|
|
336
|
-
let
|
|
337
|
-
if (
|
|
338
|
-
|
|
339
|
-
else if (
|
|
340
|
-
|
|
314
|
+
let range;
|
|
315
|
+
if (extend === !0)
|
|
316
|
+
range = expandToContinuousRange(selection.range, { up: !0, down: !0, left: !0, right: !0 }, worksheet), this.setSelection(unitId, subUnitId, range);
|
|
317
|
+
else if (extend === !1)
|
|
318
|
+
range = selection.range;
|
|
341
319
|
else {
|
|
342
|
-
const
|
|
343
|
-
if (
|
|
320
|
+
const confirmRes = await this.showExtendConfirm();
|
|
321
|
+
if (confirmRes === "cancel")
|
|
344
322
|
return null;
|
|
345
|
-
|
|
323
|
+
confirmRes === "keep" ? range = selection.range : (range = expandToContinuousRange(selection.range, { up: !0, down: !0, left: !0, right: !0 }, worksheet), this.setSelection(unitId, subUnitId, range));
|
|
346
324
|
}
|
|
347
325
|
return {
|
|
348
|
-
range
|
|
349
|
-
unitId
|
|
350
|
-
subUnitId
|
|
351
|
-
colIndex:
|
|
326
|
+
range,
|
|
327
|
+
unitId,
|
|
328
|
+
subUnitId,
|
|
329
|
+
colIndex: selection.primary.actualColumn
|
|
352
330
|
};
|
|
353
331
|
}
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
],
|
|
364
|
-
function
|
|
365
|
-
return (
|
|
366
|
-
const
|
|
367
|
-
switch (
|
|
368
|
-
case
|
|
369
|
-
return `"${
|
|
370
|
-
case
|
|
371
|
-
return `Column "${
|
|
332
|
+
}, __name(_a, "SheetsSortUIService"), _a);
|
|
333
|
+
SheetsSortUIService = __decorateClass$2([
|
|
334
|
+
__decorateParam$2(0, IUniverInstanceService),
|
|
335
|
+
__decorateParam$2(1, IConfirmService),
|
|
336
|
+
__decorateParam$2(2, ILogService),
|
|
337
|
+
__decorateParam$2(3, Inject(SheetsSelectionsService)),
|
|
338
|
+
__decorateParam$2(4, Inject(SheetsSortService)),
|
|
339
|
+
__decorateParam$2(5, Inject(LocaleService)),
|
|
340
|
+
__decorateParam$2(6, ICommandService)
|
|
341
|
+
], SheetsSortUIService);
|
|
342
|
+
function colIndexTranslator(localeService) {
|
|
343
|
+
return (colIndex) => {
|
|
344
|
+
const colName = Tools.chatAtABC(colIndex);
|
|
345
|
+
switch (localeService.getCurrentLocale()) {
|
|
346
|
+
case LocaleType.ZH_CN:
|
|
347
|
+
return `"${colName}"列`;
|
|
348
|
+
case LocaleType.EN_US:
|
|
349
|
+
return `Column "${colName}"`;
|
|
372
350
|
default:
|
|
373
|
-
return `Column "${
|
|
351
|
+
return `Column "${colName}"`;
|
|
374
352
|
}
|
|
375
353
|
};
|
|
376
354
|
}
|
|
377
|
-
|
|
355
|
+
__name(colIndexTranslator, "colIndexTranslator");
|
|
356
|
+
const SortRangeAscCommand = {
|
|
378
357
|
id: "sheet.command.sort-range-asc",
|
|
379
|
-
type:
|
|
380
|
-
handler: async (
|
|
381
|
-
},
|
|
358
|
+
type: CommandType.COMMAND,
|
|
359
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!0, !1), "handler")
|
|
360
|
+
}, SortRangeAscExtCommand = {
|
|
382
361
|
id: "sheet.command.sort-range-asc-ext",
|
|
383
|
-
type:
|
|
384
|
-
handler: async (
|
|
385
|
-
},
|
|
362
|
+
type: CommandType.COMMAND,
|
|
363
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!0, !0), "handler")
|
|
364
|
+
}, SortRangeDescCommand = {
|
|
386
365
|
id: "sheet.command.sort-range-desc",
|
|
387
|
-
type:
|
|
388
|
-
handler: async (
|
|
389
|
-
},
|
|
366
|
+
type: CommandType.COMMAND,
|
|
367
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!1, !1), "handler")
|
|
368
|
+
}, SortRangeDescExtCommand = {
|
|
390
369
|
id: "sheet.command.sort-range-desc-ext",
|
|
391
|
-
type:
|
|
392
|
-
handler: async (
|
|
393
|
-
},
|
|
370
|
+
type: CommandType.COMMAND,
|
|
371
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!1, !0), "handler")
|
|
372
|
+
}, SortRangeCustomCommand = {
|
|
394
373
|
id: "sheet.command.sort-range-custom",
|
|
395
|
-
type:
|
|
396
|
-
handler: async (
|
|
397
|
-
},
|
|
374
|
+
type: CommandType.COMMAND,
|
|
375
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortCustomize(), "handler")
|
|
376
|
+
}, SortRangeAscInCtxMenuCommand = {
|
|
398
377
|
id: "sheet.command.sort-range-asc-ctx",
|
|
399
|
-
type:
|
|
400
|
-
handler: async (
|
|
401
|
-
},
|
|
378
|
+
type: CommandType.COMMAND,
|
|
379
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!0, !1), "handler")
|
|
380
|
+
}, SortRangeAscExtInCtxMenuCommand = {
|
|
402
381
|
id: "sheet.command.sort-range-asc-ext-ctx",
|
|
403
|
-
type:
|
|
404
|
-
handler: async (
|
|
405
|
-
},
|
|
382
|
+
type: CommandType.COMMAND,
|
|
383
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!0, !0), "handler")
|
|
384
|
+
}, SortRangeDescInCtxMenuCommand = {
|
|
406
385
|
id: "sheet.command.sort-range-desc-ctx",
|
|
407
|
-
type:
|
|
408
|
-
handler: async (
|
|
409
|
-
},
|
|
386
|
+
type: CommandType.COMMAND,
|
|
387
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!1, !1), "handler")
|
|
388
|
+
}, SortRangeDescExtInCtxMenuCommand = {
|
|
410
389
|
id: "sheet.command.sort-range-desc-ext-ctx",
|
|
411
|
-
type:
|
|
412
|
-
handler: async (
|
|
413
|
-
},
|
|
390
|
+
type: CommandType.COMMAND,
|
|
391
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortDirectly(!1, !0), "handler")
|
|
392
|
+
}, SortRangeCustomInCtxMenuCommand = {
|
|
414
393
|
id: "sheet.command.sort-range-custom-ctx",
|
|
415
|
-
type:
|
|
416
|
-
handler: async (
|
|
394
|
+
type: CommandType.COMMAND,
|
|
395
|
+
handler: /* @__PURE__ */ __name(async (accessor) => await accessor.get(SheetsSortUIService).triggerSortCustomize(), "handler")
|
|
417
396
|
};
|
|
418
|
-
function
|
|
419
|
-
const
|
|
420
|
-
if (!
|
|
397
|
+
function CustomSortPanel() {
|
|
398
|
+
const sheetsSortUIService = useDependency(SheetsSortUIService), sheetsSortService = useDependency(SheetsSortService), localeService = useDependency(LocaleService), [hasTitle, setHasTitle] = useState(!1), [scrollPosition, setScrollPosition] = useState(0), listEndRef = useRef(null), state = sheetsSortUIService.customSortState();
|
|
399
|
+
if (!state || !state.location)
|
|
421
400
|
return null;
|
|
422
|
-
const { range
|
|
423
|
-
{ type:
|
|
424
|
-
]),
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
}, [
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
401
|
+
const { range, unitId, subUnitId } = state.location, titles = sheetsSortUIService.getTitles(hasTitle), [list, setList] = useState([
|
|
402
|
+
{ type: SortType.ASC, colIndex: range.startColumn }
|
|
403
|
+
]), onItemChange = useCallback((index, value) => {
|
|
404
|
+
const newList = [...list];
|
|
405
|
+
value === null ? newList.splice(index, 1) : newList[index] = value, setList(newList);
|
|
406
|
+
}, [list]), newItem = useCallback(
|
|
407
|
+
throttle(() => {
|
|
408
|
+
const newList = [...list], nextColIndex = findNextColIndex(range, list);
|
|
409
|
+
nextColIndex !== null && (newList.push({ type: SortType.ASC, colIndex: nextColIndex }), setList(newList));
|
|
431
410
|
}, 200),
|
|
432
|
-
[
|
|
433
|
-
),
|
|
434
|
-
|
|
435
|
-
}, [
|
|
436
|
-
|
|
437
|
-
}, [
|
|
438
|
-
|
|
439
|
-
}, [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}, [
|
|
443
|
-
const
|
|
444
|
-
return /* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
446
|
-
|
|
447
|
-
}, children: [
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
|
|
451
|
-
/* @__PURE__ */
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
] }) : /* @__PURE__ */
|
|
411
|
+
[list, range]
|
|
412
|
+
), apply = useCallback((orderRules, hasTitle2) => {
|
|
413
|
+
sheetsSortService.applySort({ range, orderRules, hasTitle: hasTitle2 }), sheetsSortUIService.closeCustomSortPanel();
|
|
414
|
+
}, [sheetsSortService, sheetsSortUIService, range]), cancel = useCallback(() => {
|
|
415
|
+
sheetsSortUIService.closeCustomSortPanel();
|
|
416
|
+
}, [sheetsSortUIService]), setTitle = useCallback((value) => {
|
|
417
|
+
setHasTitle(value), value ? sheetsSortUIService.setSelection(unitId, subUnitId, { ...range, startRow: range.startRow + 1 }) : sheetsSortUIService.setSelection(unitId, subUnitId, range);
|
|
418
|
+
}, [sheetsSortUIService, range, subUnitId, unitId]);
|
|
419
|
+
useEffect(() => {
|
|
420
|
+
listEndRef.current && list.length > 5 && (listEndRef.current.scrollTop = listEndRef.current.scrollHeight);
|
|
421
|
+
}, [list]);
|
|
422
|
+
const canNew = list.length < titles.length, dragList = list.map((item) => ({ ...item, id: `${item.colIndex}` }));
|
|
423
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.customSortPanelContainer, children: [
|
|
424
|
+
/* @__PURE__ */ jsxs("div", { className: styles.customSortPanelContent, onMouseDown: /* @__PURE__ */ __name((e) => {
|
|
425
|
+
e.stopPropagation();
|
|
426
|
+
}, "onMouseDown"), children: [
|
|
427
|
+
/* @__PURE__ */ jsxs("div", { className: styles.customSortPanelExt, children: [
|
|
428
|
+
/* @__PURE__ */ jsx("div", { className: styles.firstRowCheck, children: /* @__PURE__ */ jsx(Checkbox, { checked: hasTitle, onChange: /* @__PURE__ */ __name((value) => setTitle(!!value), "onChange"), children: localeService.t("sheets-sort.dialog.first-row-check") }) }),
|
|
429
|
+
canNew ? /* @__PURE__ */ jsxs("div", { className: styles.addCondition, onClick: newItem, children: [
|
|
430
|
+
/* @__PURE__ */ jsx(IncreaseSingle, {}),
|
|
431
|
+
/* @__PURE__ */ jsx("span", { className: styles.addConditionText, children: localeService.t("sheets-sort.dialog.add-condition") })
|
|
432
|
+
] }) : /* @__PURE__ */ jsxs(
|
|
454
433
|
"div",
|
|
455
434
|
{
|
|
456
435
|
className: `
|
|
457
|
-
${
|
|
458
|
-
${
|
|
436
|
+
${styles.addCondition}
|
|
437
|
+
${styles.addConditionDisable}
|
|
459
438
|
`,
|
|
460
439
|
children: [
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ jsx(IncreaseSingle, {}),
|
|
441
|
+
/* @__PURE__ */ jsx("span", { className: styles.addConditionText, children: localeService.t("sheets-sort.dialog.add-condition") })
|
|
463
442
|
]
|
|
464
443
|
}
|
|
465
444
|
)
|
|
466
445
|
] }),
|
|
467
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ jsx(
|
|
468
447
|
"div",
|
|
469
448
|
{
|
|
470
|
-
className:
|
|
471
|
-
onScroll: (
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
},
|
|
475
|
-
ref:
|
|
476
|
-
children: /* @__PURE__ */
|
|
477
|
-
|
|
449
|
+
className: styles.conditionList,
|
|
450
|
+
onScroll: /* @__PURE__ */ __name((e) => {
|
|
451
|
+
const position = e.currentTarget.scrollTop;
|
|
452
|
+
setScrollPosition(position);
|
|
453
|
+
}, "onScroll"),
|
|
454
|
+
ref: listEndRef,
|
|
455
|
+
children: /* @__PURE__ */ jsx(
|
|
456
|
+
DraggableList,
|
|
478
457
|
{
|
|
479
|
-
list:
|
|
480
|
-
onListChange:
|
|
458
|
+
list: dragList,
|
|
459
|
+
onListChange: setList,
|
|
481
460
|
idKey: "id",
|
|
482
|
-
draggableHandle: `.${
|
|
483
|
-
itemRender: (
|
|
484
|
-
|
|
461
|
+
draggableHandle: `.${styles.customSortPanelItemHandler}`,
|
|
462
|
+
itemRender: /* @__PURE__ */ __name((item) => /* @__PURE__ */ jsx(
|
|
463
|
+
SortOptionItem,
|
|
485
464
|
{
|
|
486
|
-
titles
|
|
487
|
-
list:
|
|
488
|
-
item
|
|
489
|
-
onChange: (
|
|
490
|
-
scrollPosition
|
|
465
|
+
titles,
|
|
466
|
+
list: dragList,
|
|
467
|
+
item,
|
|
468
|
+
onChange: /* @__PURE__ */ __name((value, index) => onItemChange(index, value), "onChange"),
|
|
469
|
+
scrollPosition
|
|
491
470
|
}
|
|
492
|
-
),
|
|
471
|
+
), "itemRender"),
|
|
493
472
|
rowHeight: 32,
|
|
494
473
|
margin: [0, 12]
|
|
495
474
|
}
|
|
@@ -497,392 +476,411 @@ function bn() {
|
|
|
497
476
|
}
|
|
498
477
|
)
|
|
499
478
|
] }),
|
|
500
|
-
/* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ jsxs("div", { className: styles.customSortPanelFooter, children: [
|
|
480
|
+
/* @__PURE__ */ jsx(Button, { className: styles.customSortPanelFooterBtn, type: "default", onClick: /* @__PURE__ */ __name(() => cancel(), "onClick"), children: localeService.t("sheets-sort.dialog.cancel") }),
|
|
481
|
+
/* @__PURE__ */ jsx(Button, { className: styles.customSortPanelFooterBtn, type: "primary", onClick: /* @__PURE__ */ __name(() => apply(list, hasTitle), "onClick"), children: localeService.t("sheets-sort.dialog.confirm") })
|
|
503
482
|
] })
|
|
504
483
|
] });
|
|
505
484
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
|
|
485
|
+
__name(CustomSortPanel, "CustomSortPanel");
|
|
486
|
+
function SortOptionItem(props) {
|
|
487
|
+
var _a4;
|
|
488
|
+
const { list, item, titles, onChange, scrollPosition } = props, localeService = useDependency(LocaleService), availableMenu = titles.filter((title) => !list.some((item2) => item2.colIndex === title.index) || title.index === item.colIndex), currentIndex = list.findIndex((listItem) => listItem.colIndex === item.colIndex), handleChangeColIndex = useCallback((menuItem) => {
|
|
489
|
+
onChange({ ...item, colIndex: menuItem.index }, currentIndex), setVisible(!1);
|
|
490
|
+
}, [currentIndex, item, onChange]), [visible, setVisible] = useState(!1), onVisibleChange = /* @__PURE__ */ __name((visible2) => {
|
|
491
|
+
setVisible(visible2);
|
|
492
|
+
}, "onVisibleChange");
|
|
493
|
+
useEffect(() => {
|
|
494
|
+
setVisible(!1);
|
|
495
|
+
}, [scrollPosition]);
|
|
496
|
+
const showDelete = list.length > 1, itemLabel = (_a4 = titles.find((title) => title.index === item.colIndex)) == null ? void 0 : _a4.label, radioClass = localeService.getCurrentLocale() === LocaleType.ZH_CN ? styles.customSortPanelItemOrderRadioCn : styles.customSortPanelItemOrderRadio;
|
|
497
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.customSortPanelItem, children: [
|
|
498
|
+
/* @__PURE__ */ jsxs("div", { className: styles.customSortPanelItemHead, children: [
|
|
499
|
+
/* @__PURE__ */ jsx("div", { className: styles.customSortPanelItemHandler, children: /* @__PURE__ */ jsx(SequenceSingle, {}) }),
|
|
500
|
+
/* @__PURE__ */ jsx("div", { className: styles.customSortPanelItemColumn, children: /* @__PURE__ */ jsx(
|
|
501
|
+
DropdownLegacy,
|
|
522
502
|
{
|
|
523
503
|
placement: "bottomLeft",
|
|
524
504
|
trigger: ["click"],
|
|
525
|
-
visible
|
|
526
|
-
onVisibleChange
|
|
527
|
-
overlay: /* @__PURE__ */
|
|
505
|
+
visible,
|
|
506
|
+
onVisibleChange,
|
|
507
|
+
overlay: /* @__PURE__ */ jsx("ul", { className: styles.customSortColMenu, children: availableMenu.map((menuItem) => /* @__PURE__ */ jsxs(
|
|
528
508
|
"li",
|
|
529
509
|
{
|
|
530
|
-
onClick: () =>
|
|
531
|
-
className:
|
|
510
|
+
onClick: /* @__PURE__ */ __name(() => handleChangeColIndex(menuItem), "onClick"),
|
|
511
|
+
className: styles.customSortColMenuItem,
|
|
532
512
|
children: [
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ jsx("span", { className: styles.customSortColMenuItemDesc, children: menuItem.label }),
|
|
514
|
+
/* @__PURE__ */ jsx("span", { className: styles.customSortColMenuItemCheck, children: menuItem.index === item.colIndex && /* @__PURE__ */ jsx(CheckMarkSingle, {}) })
|
|
535
515
|
]
|
|
536
516
|
},
|
|
537
|
-
|
|
517
|
+
menuItem.index
|
|
538
518
|
)) }),
|
|
539
|
-
children: /* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ jsxs("div", { className: styles.customSortPanelItemColumnInput, children: [
|
|
520
|
+
/* @__PURE__ */ jsx("span", { className: styles.customSortPanelItemColumnInputText, children: itemLabel }),
|
|
521
|
+
/* @__PURE__ */ jsx(MoreDownSingle, { className: styles.customSortPanelItemColumnInputDropdown })
|
|
542
522
|
] })
|
|
543
523
|
}
|
|
544
524
|
) })
|
|
545
525
|
] }),
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
|
|
526
|
+
/* @__PURE__ */ jsx("div", { className: styles.customSortPanelItemOrder, children: /* @__PURE__ */ jsxs(
|
|
527
|
+
RadioGroup,
|
|
548
528
|
{
|
|
549
|
-
className:
|
|
550
|
-
value:
|
|
551
|
-
onChange: (
|
|
552
|
-
|
|
553
|
-
},
|
|
529
|
+
className: radioClass,
|
|
530
|
+
value: item.type,
|
|
531
|
+
onChange: /* @__PURE__ */ __name((value) => {
|
|
532
|
+
onChange({ ...item, type: value }, currentIndex);
|
|
533
|
+
}, "onChange"),
|
|
554
534
|
children: [
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ jsx(Radio, { value: SortType.ASC, children: localeService.t("sheets-sort.general.sort-asc") }),
|
|
536
|
+
/* @__PURE__ */ jsx(Radio, { value: SortType.DESC, children: localeService.t("sheets-sort.general.sort-desc") })
|
|
557
537
|
]
|
|
558
538
|
}
|
|
559
539
|
) }),
|
|
560
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ jsx("div", { className: styles.customSortPanelItemRemove, children: showDelete && /* @__PURE__ */ jsx(DeleteEmptySingle, { onClick: /* @__PURE__ */ __name(() => onChange(null, currentIndex), "onClick") }) })
|
|
561
541
|
] });
|
|
562
542
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
543
|
+
__name(SortOptionItem, "SortOptionItem");
|
|
544
|
+
function findNextColIndex(range, list) {
|
|
545
|
+
const { startColumn, endColumn } = range, used = new Set(list.map((item) => item == null ? void 0 : item.colIndex));
|
|
546
|
+
for (let i = startColumn; i <= endColumn; i++)
|
|
547
|
+
if (!used.has(i))
|
|
548
|
+
return i;
|
|
568
549
|
return null;
|
|
569
550
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
551
|
+
__name(findNextColIndex, "findNextColIndex");
|
|
552
|
+
function EmbedSortBtn(props) {
|
|
553
|
+
const { range, colIndex, onClose } = props, sheetsSortUIService = useDependency(SheetsSortUIService), univerInstanceService = useDependency(IUniverInstanceService), localeService = useDependency(LocaleService), apply = useCallback((asc) => {
|
|
554
|
+
const { unitId, subUnitId } = getSheetCommandTarget(univerInstanceService) || {};
|
|
555
|
+
if (range && unitId && subUnitId) {
|
|
556
|
+
const noTitleRange = { ...range, startRow: range.startRow + 1 };
|
|
557
|
+
sheetsSortUIService.triggerSortDirectly(asc, !1, { unitId, subUnitId, range: noTitleRange, colIndex });
|
|
576
558
|
} else
|
|
577
|
-
console.warn(`Cannot find the target to sort. unitId: ${
|
|
578
|
-
|
|
579
|
-
}, [
|
|
580
|
-
return /* @__PURE__ */
|
|
581
|
-
/* @__PURE__ */
|
|
559
|
+
console.warn(`Cannot find the target to sort. unitId: ${unitId}, subUnitId: ${subUnitId}, range: ${range}, colIndex: ${colIndex}`);
|
|
560
|
+
onClose();
|
|
561
|
+
}, [range, colIndex, sheetsSortUIService, univerInstanceService, onClose]);
|
|
562
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.embedSortBtnContainer, children: [
|
|
563
|
+
/* @__PURE__ */ jsxs(
|
|
582
564
|
"div",
|
|
583
565
|
{
|
|
584
566
|
className: `
|
|
585
|
-
${
|
|
586
|
-
${
|
|
567
|
+
${styles.embedSortBtn}
|
|
568
|
+
${styles.embedSortBtnAsc}
|
|
587
569
|
`,
|
|
588
|
-
onClick: () =>
|
|
570
|
+
onClick: /* @__PURE__ */ __name(() => apply(!0), "onClick"),
|
|
589
571
|
children: [
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
|
|
572
|
+
/* @__PURE__ */ jsx(AscendingSingle, { className: styles.embedSortBtnIcon }),
|
|
573
|
+
localeService.t("sheets-sort.general.sort-asc")
|
|
592
574
|
]
|
|
593
575
|
}
|
|
594
576
|
),
|
|
595
|
-
/* @__PURE__ */
|
|
577
|
+
/* @__PURE__ */ jsxs(
|
|
596
578
|
"div",
|
|
597
579
|
{
|
|
598
580
|
className: `
|
|
599
|
-
${
|
|
600
|
-
${
|
|
581
|
+
${styles.embedSortBtn}
|
|
582
|
+
${styles.embedSortBtnDesc}
|
|
601
583
|
`,
|
|
602
|
-
onClick: () =>
|
|
584
|
+
onClick: /* @__PURE__ */ __name(() => apply(!1), "onClick"),
|
|
603
585
|
children: [
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
|
|
586
|
+
/* @__PURE__ */ jsx(DescendingSingle, { className: styles.embedSortBtnIcon }),
|
|
587
|
+
localeService.t("sheets-sort.general.sort-desc")
|
|
606
588
|
]
|
|
607
589
|
}
|
|
608
590
|
)
|
|
609
591
|
] });
|
|
610
592
|
}
|
|
611
|
-
|
|
612
|
-
|
|
593
|
+
__name(EmbedSortBtn, "EmbedSortBtn");
|
|
594
|
+
const SHEETS_SORT_MENU_ID = "sheet.menu.sheets-sort", SHEETS_SORT_CTX_MENU_ID = "sheet.menu.sheets-sort-ctx", SHEETS_SORT_ASC_ICON = "AscendingSingle", SHEETS_SORT_ASC_EXT_ICON = "ExpandAscendingSingle", SHEETS_SORT_DESC_ICON = "DescendingSingle", SHEETS_SORT_DESC_EXT_ICON = "ExpandDescendingSingle", SHEETS_SORT_CUSTOM_ICON = "CustomSortSingle";
|
|
595
|
+
function sortRangeMenuFactory(accessor) {
|
|
613
596
|
return {
|
|
614
|
-
id:
|
|
615
|
-
type:
|
|
616
|
-
icon:
|
|
597
|
+
id: SHEETS_SORT_MENU_ID,
|
|
598
|
+
type: MenuItemType.SUBITEMS,
|
|
599
|
+
icon: SHEETS_SORT_ASC_ICON,
|
|
617
600
|
tooltip: "sheets-sort.general.sort",
|
|
618
|
-
hidden$:
|
|
619
|
-
disabled$:
|
|
601
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
602
|
+
disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
|
|
620
603
|
};
|
|
621
604
|
}
|
|
622
|
-
|
|
605
|
+
__name(sortRangeMenuFactory, "sortRangeMenuFactory");
|
|
606
|
+
function sortRangeAscMenuFactory(_accessor) {
|
|
623
607
|
return {
|
|
624
|
-
id:
|
|
625
|
-
icon:
|
|
608
|
+
id: SortRangeAscCommand.id,
|
|
609
|
+
icon: SHEETS_SORT_ASC_ICON,
|
|
626
610
|
title: "sheets-sort.general.sort-asc-cur",
|
|
627
|
-
type:
|
|
628
|
-
hidden$:
|
|
611
|
+
type: MenuItemType.BUTTON,
|
|
612
|
+
hidden$: getCurrentExclusiveRangeInterest$(_accessor)
|
|
629
613
|
};
|
|
630
614
|
}
|
|
631
|
-
|
|
615
|
+
__name(sortRangeAscMenuFactory, "sortRangeAscMenuFactory");
|
|
616
|
+
function sortRangeAscExtMenuFactory(_accessor) {
|
|
632
617
|
return {
|
|
633
|
-
id:
|
|
618
|
+
id: SortRangeAscExtCommand.id,
|
|
634
619
|
title: "sheets-sort.general.sort-asc-ext",
|
|
635
|
-
icon:
|
|
636
|
-
type:
|
|
620
|
+
icon: SHEETS_SORT_ASC_EXT_ICON,
|
|
621
|
+
type: MenuItemType.BUTTON
|
|
637
622
|
};
|
|
638
623
|
}
|
|
639
|
-
|
|
624
|
+
__name(sortRangeAscExtMenuFactory, "sortRangeAscExtMenuFactory");
|
|
625
|
+
function sortRangeDescMenuFactory(_accessor) {
|
|
640
626
|
return {
|
|
641
|
-
id:
|
|
627
|
+
id: SortRangeDescCommand.id,
|
|
642
628
|
title: "sheets-sort.general.sort-desc-cur",
|
|
643
|
-
icon:
|
|
644
|
-
type:
|
|
629
|
+
icon: SHEETS_SORT_DESC_ICON,
|
|
630
|
+
type: MenuItemType.BUTTON
|
|
645
631
|
};
|
|
646
632
|
}
|
|
647
|
-
|
|
633
|
+
__name(sortRangeDescMenuFactory, "sortRangeDescMenuFactory");
|
|
634
|
+
function sortRangeDescExtMenuFactory(_accessor) {
|
|
648
635
|
return {
|
|
649
|
-
id:
|
|
636
|
+
id: SortRangeDescExtCommand.id,
|
|
650
637
|
title: "sheets-sort.general.sort-desc-ext",
|
|
651
|
-
icon:
|
|
652
|
-
type:
|
|
638
|
+
icon: SHEETS_SORT_DESC_EXT_ICON,
|
|
639
|
+
type: MenuItemType.BUTTON
|
|
653
640
|
};
|
|
654
641
|
}
|
|
655
|
-
|
|
642
|
+
__name(sortRangeDescExtMenuFactory, "sortRangeDescExtMenuFactory");
|
|
643
|
+
function sortRangeCustomMenuFactory(_accessor) {
|
|
656
644
|
return {
|
|
657
|
-
id:
|
|
645
|
+
id: SortRangeCustomCommand.id,
|
|
658
646
|
title: "sheets-sort.general.sort-custom",
|
|
659
|
-
type:
|
|
660
|
-
icon:
|
|
647
|
+
type: MenuItemType.BUTTON,
|
|
648
|
+
icon: SHEETS_SORT_CUSTOM_ICON
|
|
661
649
|
};
|
|
662
650
|
}
|
|
663
|
-
|
|
651
|
+
__name(sortRangeCustomMenuFactory, "sortRangeCustomMenuFactory");
|
|
652
|
+
function sortRangeCtxMenuFactory(accessor) {
|
|
664
653
|
return {
|
|
665
|
-
id:
|
|
654
|
+
id: SHEETS_SORT_CTX_MENU_ID,
|
|
666
655
|
title: "sheets-sort.general.sort",
|
|
667
|
-
type:
|
|
668
|
-
icon:
|
|
669
|
-
hidden$:
|
|
670
|
-
disabled$:
|
|
671
|
-
workbookTypes: [
|
|
672
|
-
worksheetTypes: [
|
|
673
|
-
rangeTypes: [
|
|
656
|
+
type: MenuItemType.SUBITEMS,
|
|
657
|
+
icon: SHEETS_SORT_ASC_ICON,
|
|
658
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
659
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
660
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
661
|
+
worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
|
|
662
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
674
663
|
})
|
|
675
664
|
};
|
|
676
665
|
}
|
|
677
|
-
|
|
666
|
+
__name(sortRangeCtxMenuFactory, "sortRangeCtxMenuFactory");
|
|
667
|
+
function sortRangeAscCtxMenuFactory(_accessor) {
|
|
678
668
|
return {
|
|
679
|
-
id:
|
|
669
|
+
id: SortRangeAscInCtxMenuCommand.id,
|
|
680
670
|
title: "sheets-sort.general.sort-asc-cur",
|
|
681
|
-
type:
|
|
682
|
-
icon:
|
|
683
|
-
disabled$:
|
|
671
|
+
type: MenuItemType.BUTTON,
|
|
672
|
+
icon: SHEETS_SORT_ASC_ICON,
|
|
673
|
+
disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
|
|
684
674
|
};
|
|
685
675
|
}
|
|
686
|
-
|
|
676
|
+
__name(sortRangeAscCtxMenuFactory, "sortRangeAscCtxMenuFactory");
|
|
677
|
+
function sortRangeAscExtCtxMenuFactory(_accessor) {
|
|
687
678
|
return {
|
|
688
|
-
id:
|
|
679
|
+
id: SortRangeAscExtInCtxMenuCommand.id,
|
|
689
680
|
title: "sheets-sort.general.sort-asc-ext",
|
|
690
|
-
type:
|
|
691
|
-
icon:
|
|
692
|
-
disabled$:
|
|
681
|
+
type: MenuItemType.BUTTON,
|
|
682
|
+
icon: SHEETS_SORT_ASC_EXT_ICON,
|
|
683
|
+
disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
|
|
693
684
|
};
|
|
694
685
|
}
|
|
695
|
-
|
|
686
|
+
__name(sortRangeAscExtCtxMenuFactory, "sortRangeAscExtCtxMenuFactory");
|
|
687
|
+
function sortRangeDescCtxMenuFactory(_accessor) {
|
|
696
688
|
return {
|
|
697
|
-
id:
|
|
689
|
+
id: SortRangeDescInCtxMenuCommand.id,
|
|
698
690
|
title: "sheets-sort.general.sort-desc-cur",
|
|
699
|
-
type:
|
|
700
|
-
icon:
|
|
701
|
-
disabled$:
|
|
691
|
+
type: MenuItemType.BUTTON,
|
|
692
|
+
icon: SHEETS_SORT_DESC_ICON,
|
|
693
|
+
disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
|
|
702
694
|
};
|
|
703
695
|
}
|
|
704
|
-
|
|
696
|
+
__name(sortRangeDescCtxMenuFactory, "sortRangeDescCtxMenuFactory");
|
|
697
|
+
function sortRangeDescExtCtxMenuFactory(_accessor) {
|
|
705
698
|
return {
|
|
706
|
-
id:
|
|
699
|
+
id: SortRangeDescExtInCtxMenuCommand.id,
|
|
707
700
|
title: "sheets-sort.general.sort-desc-ext",
|
|
708
|
-
type:
|
|
709
|
-
icon:
|
|
710
|
-
disabled$:
|
|
701
|
+
type: MenuItemType.BUTTON,
|
|
702
|
+
icon: SHEETS_SORT_DESC_EXT_ICON,
|
|
703
|
+
disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
|
|
711
704
|
};
|
|
712
705
|
}
|
|
713
|
-
|
|
706
|
+
__name(sortRangeDescExtCtxMenuFactory, "sortRangeDescExtCtxMenuFactory");
|
|
707
|
+
function sortRangeCustomCtxMenuFactory(_accessor) {
|
|
714
708
|
return {
|
|
715
|
-
id:
|
|
709
|
+
id: SortRangeCustomInCtxMenuCommand.id,
|
|
716
710
|
title: "sheets-sort.general.sort-custom",
|
|
717
|
-
type:
|
|
718
|
-
icon:
|
|
719
|
-
disabled$:
|
|
711
|
+
type: MenuItemType.BUTTON,
|
|
712
|
+
icon: SHEETS_SORT_CUSTOM_ICON,
|
|
713
|
+
disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
|
|
720
714
|
};
|
|
721
715
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
716
|
+
__name(sortRangeCustomCtxMenuFactory, "sortRangeCustomCtxMenuFactory");
|
|
717
|
+
const menuSchema = {
|
|
718
|
+
[RibbonStartGroup.FORMULAS_INSERT]: {
|
|
719
|
+
[SHEETS_SORT_MENU_ID]: {
|
|
725
720
|
order: 2,
|
|
726
|
-
menuItemFactory:
|
|
727
|
-
[
|
|
721
|
+
menuItemFactory: sortRangeMenuFactory,
|
|
722
|
+
[SortRangeAscCommand.id]: {
|
|
728
723
|
order: 0,
|
|
729
|
-
menuItemFactory:
|
|
724
|
+
menuItemFactory: sortRangeAscMenuFactory
|
|
730
725
|
},
|
|
731
|
-
[
|
|
726
|
+
[SortRangeAscExtCommand.id]: {
|
|
732
727
|
order: 1,
|
|
733
|
-
menuItemFactory:
|
|
728
|
+
menuItemFactory: sortRangeAscExtMenuFactory
|
|
734
729
|
},
|
|
735
|
-
[
|
|
730
|
+
[SortRangeDescCommand.id]: {
|
|
736
731
|
order: 2,
|
|
737
|
-
menuItemFactory:
|
|
732
|
+
menuItemFactory: sortRangeDescMenuFactory
|
|
738
733
|
},
|
|
739
|
-
[
|
|
734
|
+
[SortRangeDescExtCommand.id]: {
|
|
740
735
|
order: 3,
|
|
741
|
-
menuItemFactory:
|
|
736
|
+
menuItemFactory: sortRangeDescExtMenuFactory
|
|
742
737
|
},
|
|
743
|
-
[
|
|
738
|
+
[SortRangeCustomCommand.id]: {
|
|
744
739
|
order: 4,
|
|
745
|
-
menuItemFactory:
|
|
740
|
+
menuItemFactory: sortRangeCustomMenuFactory
|
|
746
741
|
}
|
|
747
742
|
}
|
|
748
743
|
},
|
|
749
|
-
[
|
|
750
|
-
[
|
|
751
|
-
[
|
|
744
|
+
[ContextMenuPosition.MAIN_AREA]: {
|
|
745
|
+
[ContextMenuGroup.DATA]: {
|
|
746
|
+
[SHEETS_SORT_CTX_MENU_ID]: {
|
|
752
747
|
order: 0,
|
|
753
|
-
menuItemFactory:
|
|
754
|
-
[
|
|
748
|
+
menuItemFactory: sortRangeCtxMenuFactory,
|
|
749
|
+
[SortRangeAscInCtxMenuCommand.id]: {
|
|
755
750
|
order: 0,
|
|
756
|
-
menuItemFactory:
|
|
751
|
+
menuItemFactory: sortRangeAscCtxMenuFactory
|
|
757
752
|
},
|
|
758
|
-
[
|
|
753
|
+
[SortRangeAscExtInCtxMenuCommand.id]: {
|
|
759
754
|
order: 1,
|
|
760
|
-
menuItemFactory:
|
|
755
|
+
menuItemFactory: sortRangeAscExtCtxMenuFactory
|
|
761
756
|
},
|
|
762
|
-
[
|
|
757
|
+
[SortRangeDescInCtxMenuCommand.id]: {
|
|
763
758
|
order: 2,
|
|
764
|
-
menuItemFactory:
|
|
759
|
+
menuItemFactory: sortRangeDescCtxMenuFactory
|
|
765
760
|
},
|
|
766
|
-
[
|
|
761
|
+
[SortRangeDescExtInCtxMenuCommand.id]: {
|
|
767
762
|
order: 3,
|
|
768
|
-
menuItemFactory:
|
|
763
|
+
menuItemFactory: sortRangeDescExtCtxMenuFactory
|
|
769
764
|
},
|
|
770
|
-
[
|
|
765
|
+
[SortRangeCustomInCtxMenuCommand.id]: {
|
|
771
766
|
order: 4,
|
|
772
|
-
menuItemFactory:
|
|
767
|
+
menuItemFactory: sortRangeCustomCtxMenuFactory
|
|
773
768
|
}
|
|
774
769
|
}
|
|
775
770
|
}
|
|
776
771
|
}
|
|
777
772
|
};
|
|
778
|
-
var
|
|
779
|
-
for (var
|
|
780
|
-
(
|
|
781
|
-
return
|
|
782
|
-
},
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
773
|
+
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
774
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
775
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
776
|
+
return kind && result && __defProp$1(target, key, result), result;
|
|
777
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
|
778
|
+
const CUSTOM_SORT_DIALOG_ID = "custom-sort-dialog", CUSTOM_SORT_PANEL_WIDTH = 560;
|
|
779
|
+
var _a2;
|
|
780
|
+
let SheetsSortUIController = (_a2 = class extends RxDisposable {
|
|
781
|
+
constructor(_commandService, _menuManagerService, _dialogService, _layoutService, _uiPartsService, _sheetRenderService, _localeService, _sheetsSortUIService, _injector, _componentManager) {
|
|
782
|
+
super(), this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._dialogService = _dialogService, this._layoutService = _layoutService, this._uiPartsService = _uiPartsService, this._sheetRenderService = _sheetRenderService, this._localeService = _localeService, this._sheetsSortUIService = _sheetsSortUIService, this._injector = _injector, this._componentManager = _componentManager, this._initCommands(), this._initMenu(), this._initUI();
|
|
787
783
|
}
|
|
788
784
|
_initMenu() {
|
|
789
|
-
this._menuManagerService.mergeMenu(
|
|
785
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
790
786
|
}
|
|
791
787
|
_initCommands() {
|
|
792
788
|
[
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
].forEach((
|
|
789
|
+
SortRangeAscCommand,
|
|
790
|
+
SortRangeAscExtCommand,
|
|
791
|
+
SortRangeDescCommand,
|
|
792
|
+
SortRangeDescExtCommand,
|
|
793
|
+
SortRangeCustomCommand,
|
|
794
|
+
SortRangeAscInCtxMenuCommand,
|
|
795
|
+
SortRangeAscExtInCtxMenuCommand,
|
|
796
|
+
SortRangeDescInCtxMenuCommand,
|
|
797
|
+
SortRangeDescExtInCtxMenuCommand,
|
|
798
|
+
SortRangeCustomInCtxMenuCommand
|
|
799
|
+
].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command))), this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(SortRangeCommand.id));
|
|
804
800
|
}
|
|
805
801
|
_initUI() {
|
|
806
|
-
this.disposeWithMe(this._componentManager.register("CustomSortPanel",
|
|
807
|
-
|
|
802
|
+
this.disposeWithMe(this._componentManager.register("CustomSortPanel", CustomSortPanel)), this.disposeWithMe(this._uiPartsService.registerComponent(SheetsUIPart.FILTER_PANEL_EMBED_POINT, () => connectInjector(EmbedSortBtn, this._injector))), this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_ICON, AscendingSingle)), this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_EXT_ICON, ExpandAscendingSingle)), this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_ICON, DescendingSingle)), this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_EXT_ICON, ExpandDescendingSingle)), this.disposeWithMe(this._componentManager.register(SHEETS_SORT_CUSTOM_ICON, CustomSortSingle)), this._sheetsSortUIService.customSortState$.pipe(takeUntil(this.dispose$)).subscribe((newState) => {
|
|
803
|
+
newState && newState.show && newState.location ? this._openCustomSortPanel(newState.location) : newState && !(newState != null && newState.show) && this._closePanel();
|
|
808
804
|
});
|
|
809
805
|
}
|
|
810
|
-
_openCustomSortPanel(
|
|
806
|
+
_openCustomSortPanel(location) {
|
|
811
807
|
this._dialogService.open({
|
|
812
|
-
id:
|
|
808
|
+
id: CUSTOM_SORT_DIALOG_ID,
|
|
813
809
|
draggable: !0,
|
|
814
|
-
width:
|
|
815
|
-
title: { title: `${this._localeService.t("sheets-sort.general.sort-custom")}: ${
|
|
810
|
+
width: CUSTOM_SORT_PANEL_WIDTH,
|
|
811
|
+
title: { title: `${this._localeService.t("sheets-sort.general.sort-custom")}: ${serializeRange(location.range)}` },
|
|
816
812
|
children: { label: "CustomSortPanel" },
|
|
817
813
|
destroyOnClose: !0,
|
|
818
|
-
defaultPosition:
|
|
814
|
+
defaultPosition: getCustomSortDialogDefaultPosition(),
|
|
819
815
|
preservePositionOnDestroy: !1,
|
|
820
|
-
onClose: () => this._closePanel(),
|
|
816
|
+
onClose: /* @__PURE__ */ __name(() => this._closePanel(), "onClose"),
|
|
821
817
|
mask: !0
|
|
822
818
|
});
|
|
823
819
|
}
|
|
824
820
|
_closePanel() {
|
|
825
|
-
this._dialogService.close(
|
|
821
|
+
this._dialogService.close(CUSTOM_SORT_DIALOG_ID), queueMicrotask(() => this._layoutService.focus());
|
|
826
822
|
}
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
],
|
|
840
|
-
function
|
|
823
|
+
}, __name(_a2, "SheetsSortUIController"), _a2);
|
|
824
|
+
SheetsSortUIController = __decorateClass$1([
|
|
825
|
+
__decorateParam$1(0, ICommandService),
|
|
826
|
+
__decorateParam$1(1, IMenuManagerService),
|
|
827
|
+
__decorateParam$1(2, IDialogService),
|
|
828
|
+
__decorateParam$1(3, ILayoutService),
|
|
829
|
+
__decorateParam$1(4, IUIPartsService),
|
|
830
|
+
__decorateParam$1(5, Inject(SheetsRenderService)),
|
|
831
|
+
__decorateParam$1(6, Inject(LocaleService)),
|
|
832
|
+
__decorateParam$1(7, Inject(SheetsSortUIService)),
|
|
833
|
+
__decorateParam$1(8, Inject(Injector)),
|
|
834
|
+
__decorateParam$1(9, Inject(ComponentManager))
|
|
835
|
+
], SheetsSortUIController);
|
|
836
|
+
function getCustomSortDialogDefaultPosition() {
|
|
841
837
|
return { x: 0, y: 0 };
|
|
842
838
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
839
|
+
__name(getCustomSortDialogDefaultPosition, "getCustomSortDialogDefaultPosition");
|
|
840
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
841
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
842
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
843
|
+
return kind && result && __defProp2(target, key, result), result;
|
|
844
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField");
|
|
845
|
+
const NAME = "SHEET_SORT_UI_PLUGIN";
|
|
846
|
+
var _a3;
|
|
847
|
+
let UniverSheetsSortUIPlugin = (_a3 = class extends Plugin {
|
|
848
|
+
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
849
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
850
|
+
const { ...rest } = merge(
|
|
853
851
|
{},
|
|
854
|
-
|
|
852
|
+
defaultPluginConfig,
|
|
855
853
|
this._config
|
|
856
854
|
);
|
|
857
|
-
this._configService.setConfig(
|
|
855
|
+
this._configService.setConfig(SHEETS_SORT_UI_PLUGIN_CONFIG_KEY, rest);
|
|
858
856
|
}
|
|
859
857
|
onStarting() {
|
|
860
858
|
[
|
|
861
|
-
[
|
|
862
|
-
[
|
|
863
|
-
].forEach((
|
|
859
|
+
[SheetsSortUIService],
|
|
860
|
+
[SheetsSortUIController]
|
|
861
|
+
].forEach((d) => this._injector.add(d));
|
|
864
862
|
}
|
|
865
863
|
onRendered() {
|
|
866
|
-
this._injector.get(
|
|
864
|
+
this._injector.get(SheetsSortUIController);
|
|
867
865
|
}
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
],
|
|
866
|
+
}, __name(_a3, "UniverSheetsSortUIPlugin"), _a3);
|
|
867
|
+
__publicField2(UniverSheetsSortUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
868
|
+
__publicField2(UniverSheetsSortUIPlugin, "pluginName", NAME);
|
|
869
|
+
UniverSheetsSortUIPlugin = __decorateClass([
|
|
870
|
+
DependentOn(UniverSheetsSortPlugin),
|
|
871
|
+
__decorateParam(1, Inject(Injector)),
|
|
872
|
+
__decorateParam(2, IConfigService)
|
|
873
|
+
], UniverSheetsSortUIPlugin);
|
|
876
874
|
export {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
875
|
+
SortRangeAscCommand,
|
|
876
|
+
SortRangeAscExtCommand,
|
|
877
|
+
SortRangeAscExtInCtxMenuCommand,
|
|
878
|
+
SortRangeAscInCtxMenuCommand,
|
|
879
|
+
SortRangeCustomCommand,
|
|
880
|
+
SortRangeCustomInCtxMenuCommand,
|
|
881
|
+
SortRangeDescCommand,
|
|
882
|
+
SortRangeDescExtCommand,
|
|
883
|
+
SortRangeDescExtInCtxMenuCommand,
|
|
884
|
+
SortRangeDescInCtxMenuCommand,
|
|
885
|
+
UniverSheetsSortUIPlugin
|
|
888
886
|
};
|