@univerjs/sheets-sort-ui 0.7.0 → 0.8.0-nightly.202505261607

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/es/index.js CHANGED
@@ -1,15 +1,15 @@
1
- var Be = Object.defineProperty;
2
- var Ve = (e, t, n) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
1
+ var Fe = Object.defineProperty;
2
+ var Ve = (e, t, n) => t in e ? Fe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var K = (e, t, n) => Ve(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { LocaleService as P, IUniverInstanceService as _e, ILogService as ze, Inject as w, ICommandService as xe, Disposable as Ze, UniverInstanceType as Y, Tools as Ge, LocaleType as J, CommandType as R, throttle as We, Injector as Me, RxDisposable as Ye, DependentOn as qe, IConfigService as Xe, Plugin as Ke, merge as Je } from "@univerjs/core";
5
- import { SheetsSortService as Ie, SortType as U, SortRangeCommand as Qe, UniverSheetsSortPlugin as et } from "@univerjs/sheets-sort";
4
+ import { LocaleService as P, IUniverInstanceService as _e, ILogService as Ze, Inject as w, ICommandService as xe, Disposable as ze, UniverInstanceType as Y, Tools as Ge, LocaleType as J, CommandType as R, throttle as We, Injector as Ie, RxDisposable as Ye, DependentOn as qe, IConfigService as Xe, Plugin as Ke, merge as Je } from "@univerjs/core";
5
+ import { SheetsSortService as Me, SortType as U, SortRangeCommand as Qe, UniverSheetsSortPlugin as et } from "@univerjs/sheets-sort";
6
6
  import { serializeRange as tt } from "@univerjs/engine-formula";
7
7
  import { getCurrentRangeDisable$ as N, getCurrentExclusiveRangeInterest$ as rt, SheetsRenderService as nt, SheetsUIPart as it } from "@univerjs/sheets-ui";
8
- import { useDependency as E, IConfirmService as st, useObservable as ot, MenuItemType as S, getMenuHiddenObservable as Re, ContextMenuPosition as at, ContextMenuGroup as ct, RibbonStartGroup as lt, IMenuManagerService as ut, IDialogService as dt, ILayoutService as ht, IUIPartsService as gt, ComponentManager as mt, connectInjector as vt } from "@univerjs/ui";
8
+ import { useDependency as E, IConfirmService as st, useObservable as ot, MenuItemType as S, getMenuHiddenObservable as Re, ContextMenuPosition as ct, ContextMenuGroup as at, RibbonDataGroup as lt, IMenuManagerService as ut, IDialogService as dt, ILayoutService as ht, IUIPartsService as gt, ComponentManager as mt, connectInjector as vt } from "@univerjs/ui";
9
9
  import { BehaviorSubject as Ct, takeUntil as ft } from "rxjs";
10
- import { jsxs as m, jsx as a } from "react/jsx-runtime";
10
+ import { jsxs as m, jsx as c } from "react/jsx-runtime";
11
11
  import { SheetsSelectionsService as St, getPrimaryForRange as pt, SetSelectionsOperation as yt, expandToContinuousRange as fe, getSheetCommandTarget as _t, RangeProtectionPermissionEditPoint as k, WorksheetSortPermission as L, WorksheetEditPermission as D, WorkbookEditablePermission as H } from "@univerjs/sheets";
12
- import { RadioGroup as we, Radio as z, Checkbox as xt, DraggableList as Mt, Button as Z, Dropdown as It, ButtonGroup as Rt } from "@univerjs/design";
12
+ import { RadioGroup as we, Radio as Z, Checkbox as xt, DraggableList as It, Button as z, Dropdown as Mt, ButtonGroup as Rt } from "@univerjs/design";
13
13
  import { forwardRef as y, useRef as Ee, createElement as _, useState as j, useCallback as O, useEffect as Te } from "react";
14
14
  const wt = "sheets-sort-ui.config", Se = {};
15
15
  var f = function() {
@@ -28,8 +28,8 @@ var f = function() {
28
28
  t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
29
29
  return n;
30
30
  }, x = y(function(e, t) {
31
- var n = e.icon, r = e.id, i = e.className, s = e.extend, o = Et(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), l = Ee("_".concat(Ot()));
32
- return be(n, "".concat(r), { defIds: n.defIds, idSuffix: l.current }, f({ ref: t, className: c }, o), s);
31
+ var n = e.icon, r = e.id, i = e.className, s = e.extend, o = Et(e, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), l = Ee("_".concat(Ot()));
32
+ return be(n, "".concat(r), { defIds: n.defIds, idSuffix: l.current }, f({ ref: t, className: a }, o), s);
33
33
  });
34
34
  function be(e, t, n, r, i) {
35
35
  return _(e.tag, f(f({ key: t }, Tt(e, n, i)), r), (bt(e, n).children || []).map(function(s, o) {
@@ -39,13 +39,13 @@ function be(e, t, n, r, i) {
39
39
  function Tt(e, t, n) {
40
40
  var r = f({}, e.attrs);
41
41
  n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1), e.tag === "mask" && r.id && (r.id = r.id + t.idSuffix), Object.entries(r).forEach(function(s) {
42
- var o = s[0], c = s[1];
43
- o === "mask" && typeof c == "string" && (r[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
42
+ var o = s[0], a = s[1];
43
+ o === "mask" && typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
44
44
  });
45
45
  var i = t.defIds;
46
46
  return !i || i.length === 0 || (e.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + t.idSuffix), Object.entries(r).forEach(function(s) {
47
- var o = s[0], c = s[1];
48
- typeof c == "string" && (r[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
47
+ var o = s[0], a = s[1];
48
+ typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
49
49
  })), r;
50
50
  }
51
51
  function bt(e, t) {
@@ -138,10 +138,10 @@ var jt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
138
138
  }));
139
139
  });
140
140
  Ue.displayName = "SequenceSingle";
141
- const Ft = (e) => {
141
+ const Bt = (e) => {
142
142
  const [t, n] = j("0"), r = E(P);
143
143
  return /* @__PURE__ */ m("div", { className: "univer-text-sm", children: [
144
- /* @__PURE__ */ a("div", { className: "extend-confirm-desc", children: r.t("sheets-sort.dialog.sort-reminder-desc") }),
144
+ /* @__PURE__ */ c("div", { className: "extend-confirm-desc", children: r.t("sheets-sort.dialog.sort-reminder-desc") }),
145
145
  /* @__PURE__ */ m(
146
146
  we,
147
147
  {
@@ -152,15 +152,15 @@ const Ft = (e) => {
152
152
  n(i), e.onChange(i);
153
153
  },
154
154
  children: [
155
- /* @__PURE__ */ a(z, { value: "0", children: r.t("sheets-sort.dialog.sort-reminder-no") }),
156
- /* @__PURE__ */ a(z, { value: "1", children: r.t("sheets-sort.dialog.sort-reminder-ext") })
155
+ /* @__PURE__ */ c(Z, { value: "0", children: r.t("sheets-sort.dialog.sort-reminder-no") }),
156
+ /* @__PURE__ */ c(Z, { value: "1", children: r.t("sheets-sort.dialog.sort-reminder-ext") })
157
157
  ]
158
158
  }
159
159
  )
160
160
  ] });
161
161
  };
162
- var Bt = Object.getOwnPropertyDescriptor, Vt = (e, t, n, r) => {
163
- for (var i = r > 1 ? void 0 : r ? Bt(t, n) : t, s = e.length - 1, o; s >= 0; s--)
162
+ var Ft = Object.getOwnPropertyDescriptor, Vt = (e, t, n, r) => {
163
+ for (var i = r > 1 ? void 0 : r ? Ft(t, n) : t, s = e.length - 1, o; s >= 0; s--)
164
164
  (o = e[s]) && (i = o(i) || i);
165
165
  return i;
166
166
  }, b = (e, t) => (n, r) => t(n, r, e);
@@ -170,12 +170,12 @@ const V = {
170
170
  SINGLE_ERROR: "sheets-sort.error.single",
171
171
  FORMULA_ARRAY: "sheets-sort.error.formula-array"
172
172
  };
173
- let g = class extends Ze {
174
- constructor(t, n, r, i, s, o, c) {
173
+ let g = class extends ze {
174
+ constructor(t, n, r, i, s, o, a) {
175
175
  super();
176
176
  K(this, "_customSortState$", new Ct(null));
177
177
  K(this, "customSortState$", this._customSortState$.asObservable());
178
- this._univerInstanceService = t, this._confirmService = n, this._logService = r, this._selectionManagerService = i, this._sheetsSortService = s, this._localeService = o, this._commandService = c;
178
+ this._univerInstanceService = t, this._confirmService = n, this._logService = r, this._selectionManagerService = i, this._sheetsSortService = s, this._localeService = o, this._commandService = a;
179
179
  }
180
180
  async triggerSortDirectly(t, n, r) {
181
181
  const i = r || await this._detectSortLocation(n);
@@ -205,13 +205,13 @@ let g = class extends Ze {
205
205
  const { unitId: r, subUnitId: i, range: s } = n, o = (d = this._univerInstanceService.getUnit(r)) == null ? void 0 : d.getSheetBySheetId(i);
206
206
  if (!o)
207
207
  return [];
208
- const c = zt(this._localeService);
209
- return Array.from({ length: s.endColumn - s.startColumn + 1 }, (M, C) => {
208
+ const a = Zt(this._localeService);
209
+ return Array.from({ length: s.endColumn - s.startColumn + 1 }, (I, C) => {
210
210
  var v;
211
211
  const T = (v = o.getCell(s.startRow, C + s.startColumn)) == null ? void 0 : v.v;
212
212
  return {
213
213
  index: C + s.startColumn,
214
- label: t ? `${T != null ? T : c(C + s.startColumn)}` : c(C + s.startColumn)
214
+ label: t ? `${T != null ? T : a(C + s.startColumn)}` : a(C + s.startColumn)
215
215
  };
216
216
  });
217
217
  }
@@ -234,7 +234,7 @@ let g = class extends Ze {
234
234
  title: this._localeService.t("info.tooltip")
235
235
  },
236
236
  children: {
237
- title: /* @__PURE__ */ a("div", { children: this._localeService.t(t) })
237
+ title: /* @__PURE__ */ c("div", { children: this._localeService.t(t) })
238
238
  }
239
239
  });
240
240
  }
@@ -246,8 +246,8 @@ let g = class extends Ze {
246
246
  title: this._localeService.t("sheets-sort.dialog.sort-reminder")
247
247
  },
248
248
  children: {
249
- title: /* @__PURE__ */ a(
250
- Ft,
249
+ title: /* @__PURE__ */ c(
250
+ Bt,
251
251
  {
252
252
  onChange: (r) => {
253
253
  t = r === "1";
@@ -271,19 +271,19 @@ let g = class extends Ze {
271
271
  const n = this._univerInstanceService.getCurrentUnitForType(Y.UNIVER_SHEET), r = n.getActiveSheet(), i = n.getUnitId(), s = r.getSheetId(), o = this._selectionManagerService.getCurrentLastSelection();
272
272
  if (!o)
273
273
  return null;
274
- let c;
274
+ let a;
275
275
  if (t === !0)
276
- c = fe(o.range, { up: !0, down: !0, left: !0, right: !0 }, r), this.setSelection(i, s, c);
276
+ a = fe(o.range, { up: !0, down: !0, left: !0, right: !0 }, r), this.setSelection(i, s, a);
277
277
  else if (t === !1)
278
- c = o.range;
278
+ a = o.range;
279
279
  else {
280
280
  const l = await this.showExtendConfirm();
281
281
  if (l === "cancel")
282
282
  return null;
283
- l === "keep" ? c = o.range : (c = fe(o.range, { up: !0, down: !0, left: !0, right: !0 }, r), this.setSelection(i, s, c));
283
+ l === "keep" ? a = o.range : (a = fe(o.range, { up: !0, down: !0, left: !0, right: !0 }, r), this.setSelection(i, s, a));
284
284
  }
285
285
  return {
286
- range: c,
286
+ range: a,
287
287
  unitId: i,
288
288
  subUnitId: s,
289
289
  colIndex: o.primary.actualColumn
@@ -293,13 +293,13 @@ let g = class extends Ze {
293
293
  g = Vt([
294
294
  b(0, _e),
295
295
  b(1, st),
296
- b(2, ze),
296
+ b(2, Ze),
297
297
  b(3, w(St)),
298
- b(4, w(Ie)),
298
+ b(4, w(Me)),
299
299
  b(5, w(P)),
300
300
  b(6, xe)
301
301
  ], g);
302
- function zt(e) {
302
+ function Zt(e) {
303
303
  return (t) => {
304
304
  const n = Ge.chatAtABC(t);
305
305
  switch (e.getCurrentLocale()) {
@@ -332,11 +332,11 @@ const re = {
332
332
  id: "sheet.command.sort-range-custom",
333
333
  type: R.COMMAND,
334
334
  handler: async (e) => await e.get(g).triggerSortCustomize()
335
- }, ae = {
335
+ }, ce = {
336
336
  id: "sheet.command.sort-range-asc-ctx",
337
337
  type: R.COMMAND,
338
338
  handler: async (e) => await e.get(g).triggerSortDirectly(!0, !1)
339
- }, ce = {
339
+ }, ae = {
340
340
  id: "sheet.command.sort-range-asc-ext-ctx",
341
341
  type: R.COMMAND,
342
342
  handler: async (e) => await e.get(g).triggerSortDirectly(!0, !0)
@@ -353,17 +353,17 @@ const re = {
353
353
  type: R.COMMAND,
354
354
  handler: async (e) => await e.get(g).triggerSortCustomize()
355
355
  };
356
- function Zt() {
356
+ function zt() {
357
357
  const e = E(g), t = ot(e.customSortState$);
358
- return !t || !t.location ? null : /* @__PURE__ */ a(Gt, { state: t });
358
+ return !t || !t.location ? null : /* @__PURE__ */ c(Gt, { state: t });
359
359
  }
360
360
  function Gt({ state: e }) {
361
- const t = E(Ie), n = E(P), r = E(g), [i, s] = j(!1), [o, c] = j(0), l = Ee(null), { range: d, unitId: M, subUnitId: C } = e.location, T = r.getTitles(i), [v, A] = j([
361
+ const t = E(Me), n = E(P), r = E(g), [i, s] = j(!1), [o, a] = j(0), l = Ee(null), { range: d, unitId: I, subUnitId: C } = e.location, T = r.getTitles(i), [v, A] = j([
362
362
  { type: U.ASC, colIndex: d.startColumn }
363
363
  ]), q = O((u, p) => {
364
364
  const $ = [...v];
365
365
  p === null ? $.splice(u, 1) : $[u] = p, A($);
366
- }, [v]), B = O(
366
+ }, [v]), F = O(
367
367
  We(() => {
368
368
  const u = [...v], p = Yt(d, v);
369
369
  p !== null && (u.push({ type: U.ASC, colIndex: p }), A(u));
@@ -374,26 +374,26 @@ function Gt({ state: e }) {
374
374
  }, [t, r, d]), X = O(() => {
375
375
  r.closeCustomSortPanel();
376
376
  }, [r]), je = O((u) => {
377
- s(u), u ? r.setSelection(M, C, { ...d, startRow: d.startRow + 1 }) : r.setSelection(M, C, d);
378
- }, [r, d, C, M]);
377
+ s(u), u ? r.setSelection(I, C, { ...d, startRow: d.startRow + 1 }) : r.setSelection(I, C, d);
378
+ }, [r, d, C, I]);
379
379
  Te(() => {
380
380
  l.current && v.length > 5 && (l.current.scrollTop = l.current.scrollHeight);
381
381
  }, [v]);
382
- const Fe = v.length < T.length, Ce = v.map((u) => ({ ...u, id: `${u.colIndex}` }));
382
+ const Be = v.length < T.length, Ce = v.map((u) => ({ ...u, id: `${u.colIndex}` }));
383
383
  return /* @__PURE__ */ m("div", { children: [
384
384
  /* @__PURE__ */ m("div", { onMouseDown: (u) => {
385
385
  u.stopPropagation();
386
386
  }, children: [
387
387
  /* @__PURE__ */ m("div", { className: "univer-flex univer-items-center univer-justify-between", children: [
388
- /* @__PURE__ */ a(xt, { checked: i, onChange: (u) => je(!!u), children: n.t("sheets-sort.dialog.first-row-check") }),
389
- Fe ? /* @__PURE__ */ m(
388
+ /* @__PURE__ */ c(xt, { checked: i, onChange: (u) => je(!!u), children: n.t("sheets-sort.dialog.first-row-check") }),
389
+ Be ? /* @__PURE__ */ m(
390
390
  "div",
391
391
  {
392
392
  className: "univer-flex univer-cursor-pointer univer-select-none univer-items-center univer-text-base",
393
- onClick: B,
393
+ onClick: F,
394
394
  children: [
395
- /* @__PURE__ */ a(Q, {}),
396
- /* @__PURE__ */ a("span", { className: "univer-ml-1.5", children: n.t("sheets-sort.dialog.add-condition") })
395
+ /* @__PURE__ */ c(Q, {}),
396
+ /* @__PURE__ */ c("span", { className: "univer-ml-1.5", children: n.t("sheets-sort.dialog.add-condition") })
397
397
  ]
398
398
  }
399
399
  ) : /* @__PURE__ */ m(
@@ -401,29 +401,29 @@ function Gt({ state: e }) {
401
401
  {
402
402
  className: "univer-flex univer-cursor-pointer univer-select-none univer-items-center univer-text-base univer-text-primary-500 disabled:univer-cursor-not-allowed disabled:univer-divide-opacity-30 disabled:univer-text-gray-800",
403
403
  children: [
404
- /* @__PURE__ */ a(Q, {}),
405
- /* @__PURE__ */ a("span", { className: "univer-ml-1.5 univer-text-xs", children: n.t("sheets-sort.dialog.add-condition") })
404
+ /* @__PURE__ */ c(Q, {}),
405
+ /* @__PURE__ */ c("span", { className: "univer-ml-1.5 univer-text-xs", children: n.t("sheets-sort.dialog.add-condition") })
406
406
  ]
407
407
  }
408
408
  )
409
409
  ] }),
410
- /* @__PURE__ */ a(
410
+ /* @__PURE__ */ c(
411
411
  "div",
412
412
  {
413
413
  className: "univer-max-h-[310px] univer-overflow-y-auto univer-overflow-x-hidden",
414
414
  onScroll: (u) => {
415
415
  const p = u.currentTarget.scrollTop;
416
- c(p);
416
+ a(p);
417
417
  },
418
418
  ref: l,
419
- children: /* @__PURE__ */ a(
420
- Mt,
419
+ children: /* @__PURE__ */ c(
420
+ It,
421
421
  {
422
422
  list: Ce,
423
423
  onListChange: A,
424
424
  idKey: "id",
425
425
  draggableHandle: "[data-u-comp=sort-panel-item-handler]",
426
- itemRender: (u) => /* @__PURE__ */ a(
426
+ itemRender: (u) => /* @__PURE__ */ c(
427
427
  Wt,
428
428
  {
429
429
  titles: T,
@@ -441,16 +441,16 @@ function Gt({ state: e }) {
441
441
  )
442
442
  ] }),
443
443
  /* @__PURE__ */ m("div", { className: "univer-mt-5 univer-flex univer-justify-end", children: [
444
- /* @__PURE__ */ a(
445
- Z,
444
+ /* @__PURE__ */ c(
445
+ z,
446
446
  {
447
447
  className: "univer-ml-3",
448
448
  onClick: () => X(),
449
449
  children: n.t("sheets-sort.dialog.cancel")
450
450
  }
451
451
  ),
452
- /* @__PURE__ */ a(
453
- Z,
452
+ /* @__PURE__ */ c(
453
+ z,
454
454
  {
455
455
  className: "univer-ml-3",
456
456
  variant: "primary",
@@ -462,76 +462,76 @@ function Gt({ state: e }) {
462
462
  ] });
463
463
  }
464
464
  function Wt(e) {
465
- var B;
466
- const { list: t, item: n, titles: r, onChange: i, scrollPosition: s } = e, o = E(P), c = r.filter((h) => !t.some((X) => X.colIndex === h.index) || h.index === n.colIndex), l = t.findIndex((h) => h.colIndex === n.colIndex), d = O((h) => {
465
+ var F;
466
+ const { list: t, item: n, titles: r, onChange: i, scrollPosition: s } = e, o = E(P), a = r.filter((h) => !t.some((X) => X.colIndex === h.index) || h.index === n.colIndex), l = t.findIndex((h) => h.colIndex === n.colIndex), d = O((h) => {
467
467
  i({ ...n, colIndex: h.index }, l), C(!1);
468
- }, [l, n, i]), [M, C] = j(!1), T = (h) => {
468
+ }, [l, n, i]), [I, C] = j(!1), T = (h) => {
469
469
  C(h);
470
470
  };
471
471
  Te(() => {
472
472
  C(!1);
473
473
  }, [s]);
474
- const v = t.length > 1, A = (B = r.find((h) => h.index === n.colIndex)) == null ? void 0 : B.label, q = o.getCurrentLocale() === J.ZH_CN ? "univer-flex univer-px-5" : "univer-flex univer-px-2.5";
474
+ const v = t.length > 1, A = (F = r.find((h) => h.index === n.colIndex)) == null ? void 0 : F.label, q = o.getCurrentLocale() === J.ZH_CN ? "univer-flex univer-px-5" : "univer-flex univer-px-2.5";
475
475
  return /* @__PURE__ */ m("div", { className: "univer-flex univer-items-center", children: [
476
476
  /* @__PURE__ */ m("div", { className: "univer-flex univer-items-center", children: [
477
- /* @__PURE__ */ a(
477
+ /* @__PURE__ */ c(
478
478
  "div",
479
479
  {
480
480
  "data-u-comp": "sort-panel-item-handler",
481
481
  className: "univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-text-base univer-text-gray-700",
482
- children: /* @__PURE__ */ a(Ue, {})
482
+ children: /* @__PURE__ */ c(Ue, {})
483
483
  }
484
484
  ),
485
- /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
486
- It,
485
+ /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(
486
+ Mt,
487
487
  {
488
488
  align: "start",
489
- overlay: /* @__PURE__ */ a(
489
+ overlay: /* @__PURE__ */ c(
490
490
  "ul",
491
491
  {
492
492
  className: "univer-my-0 univer-box-border univer-grid univer-max-h-[310px] 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",
493
- children: c.map((h) => /* @__PURE__ */ m(
493
+ children: a.map((h) => /* @__PURE__ */ m(
494
494
  "li",
495
495
  {
496
496
  onClick: () => d(h),
497
- className: "univer-relative univer-box-border univer-flex univer-h-7 univer-cursor-pointer univer-list-none univer-items-center univer-justify-between univer-rounded univer-px-2 univer-text-sm univer-transition-all hover:univer-bg-gray-100",
497
+ className: "univer-relative univer-box-border univer-flex univer-h-7 univer-cursor-pointer univer-list-none univer-items-center univer-justify-between univer-rounded univer-px-2 univer-text-sm univer-transition-all dark:hover:!univer-bg-gray-700 hover:univer-bg-gray-100",
498
498
  children: [
499
- /* @__PURE__ */ a(
499
+ /* @__PURE__ */ c(
500
500
  "span",
501
501
  {
502
502
  className: "univer-max-w-[220px] univer-truncate",
503
503
  children: h.label
504
504
  }
505
505
  ),
506
- /* @__PURE__ */ a("span", { children: h.index === n.colIndex && /* @__PURE__ */ a(Oe, {}) })
506
+ /* @__PURE__ */ c("span", { children: h.index === n.colIndex && /* @__PURE__ */ c(Oe, {}) })
507
507
  ]
508
508
  },
509
509
  h.index
510
510
  ))
511
511
  }
512
512
  ),
513
- open: M,
513
+ open: I,
514
514
  onOpenChange: T,
515
515
  children: /* @__PURE__ */ m(
516
516
  "div",
517
517
  {
518
- className: "univer-ml-2 univer-flex univer-w-[236px] univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-md univer-border univer-border-gray-200 univer-px-2.5 univer-py-1.5 univer-text-sm univer-text-gray-900 dark:univer-text-white",
518
+ className: "univer-ml-2 univer-flex univer-w-[236px] univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-md univer-border univer-border-gray-200 univer-px-2.5 univer-py-1.5 univer-text-sm univer-text-gray-900 dark:!univer-text-white",
519
519
  children: [
520
- /* @__PURE__ */ a(
520
+ /* @__PURE__ */ c(
521
521
  "span",
522
522
  {
523
523
  className: "univer-max-w-[220px] univer-truncate",
524
524
  children: A
525
525
  }
526
526
  ),
527
- /* @__PURE__ */ a(He, {})
527
+ /* @__PURE__ */ c(He, {})
528
528
  ]
529
529
  }
530
530
  )
531
531
  }
532
532
  ) })
533
533
  ] }),
534
- /* @__PURE__ */ a("div", { children: /* @__PURE__ */ m(
534
+ /* @__PURE__ */ c("div", { children: /* @__PURE__ */ m(
535
535
  we,
536
536
  {
537
537
  className: q,
@@ -540,12 +540,12 @@ function Wt(e) {
540
540
  i({ ...n, type: h }, l);
541
541
  },
542
542
  children: [
543
- /* @__PURE__ */ a(z, { value: U.ASC, children: o.t("sheets-sort.general.sort-asc") }),
544
- /* @__PURE__ */ a(z, { value: U.DESC, children: o.t("sheets-sort.general.sort-desc") })
543
+ /* @__PURE__ */ c(Z, { value: U.ASC, children: o.t("sheets-sort.general.sort-asc") }),
544
+ /* @__PURE__ */ c(Z, { value: U.DESC, children: o.t("sheets-sort.general.sort-desc") })
545
545
  ]
546
546
  }
547
547
  ) }),
548
- /* @__PURE__ */ a("div", { className: "univer-absolute univer-right-0 univer-cursor-pointer univer-text-sm univer-s-[14px]", children: v && /* @__PURE__ */ a(ke, { onClick: () => i(null, l) }) })
548
+ /* @__PURE__ */ c("div", { className: "univer-absolute univer-right-0 univer-cursor-pointer univer-text-sm univer-s-[14px]", children: v && /* @__PURE__ */ c(ke, { onClick: () => i(null, l) }) })
549
549
  ] });
550
550
  }
551
551
  function Yt(e, t) {
@@ -556,32 +556,38 @@ function Yt(e, t) {
556
556
  return null;
557
557
  }
558
558
  function qt(e) {
559
- const { range: t, colIndex: n, onClose: r } = e, i = E(g), s = E(_e), o = E(P), c = O((l) => {
560
- const { unitId: d, subUnitId: M } = _t(s) || {};
561
- if (t && d && M) {
559
+ const { range: t, colIndex: n, onClose: r } = e, i = E(g), s = E(_e), o = E(P), a = O((l) => {
560
+ const { unitId: d, subUnitId: I } = _t(s) || {};
561
+ if (t && d && I) {
562
562
  const C = { ...t, startRow: t.startRow + 1 };
563
- i.triggerSortDirectly(l, !1, { unitId: d, subUnitId: M, range: C, colIndex: n });
563
+ i.triggerSortDirectly(l, !1, { unitId: d, subUnitId: I, range: C, colIndex: n });
564
564
  } else
565
- throw new Error(`Cannot find the target to sort. unitId: ${d}, subUnitId: ${M}, range: ${t}, colIndex: ${n}`);
565
+ throw new Error(`Cannot find the target to sort. unitId: ${d}, subUnitId: ${I}, range: ${t}, colIndex: ${n}`);
566
566
  r();
567
567
  }, [t, n, i, s, r]);
568
- return /* @__PURE__ */ m(Rt, { className: "univer-mb-3 univer-w-full", children: [
569
- /* @__PURE__ */ m(Z, { className: "univer-w-1/2", onClick: () => c(!0), children: [
570
- /* @__PURE__ */ a(ee, { className: "univer-mr-1" }),
571
- o.t("sheets-sort.general.sort-asc")
572
- ] }),
573
- /* @__PURE__ */ m(Z, { className: "univer-w-1/2", onClick: () => c(!1), children: [
574
- /* @__PURE__ */ a(te, { className: "univer-mr-1" }),
575
- o.t("sheets-sort.general.sort-desc")
576
- ] })
577
- ] });
568
+ return /* @__PURE__ */ m(
569
+ Rt,
570
+ {
571
+ className: "univer-mb-3 univer-grid univer-w-full univer-grid-flow-col univer-grid-cols-2 univer-gap-2",
572
+ children: [
573
+ /* @__PURE__ */ m(z, { onClick: () => a(!0), children: [
574
+ /* @__PURE__ */ c(ee, {}),
575
+ o.t("sheets-sort.general.sort-asc")
576
+ ] }),
577
+ /* @__PURE__ */ m(z, { onClick: () => a(!1), children: [
578
+ /* @__PURE__ */ c(te, {}),
579
+ o.t("sheets-sort.general.sort-desc")
580
+ ] })
581
+ ]
582
+ }
583
+ );
578
584
  }
579
- const Pe = "sheet.menu.sheets-sort", Ae = "sheet.menu.sheets-sort-ctx", F = "AscendingSingle", he = "ExpandAscendingSingle", ge = "DescendingSingle", me = "ExpandDescendingSingle", ve = "CustomSortSingle";
585
+ const Pe = "sheet.menu.sheets-sort", Ae = "sheet.menu.sheets-sort-ctx", B = "AscendingSingle", he = "ExpandAscendingSingle", ge = "DescendingSingle", me = "ExpandDescendingSingle", ve = "CustomSortSingle";
580
586
  function Xt(e) {
581
587
  return {
582
588
  id: Pe,
583
589
  type: S.SUBITEMS,
584
- icon: F,
590
+ icon: B,
585
591
  tooltip: "sheets-sort.general.sort",
586
592
  hidden$: Re(e, Y.UNIVER_SHEET),
587
593
  disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
@@ -590,7 +596,7 @@ function Xt(e) {
590
596
  function Kt(e) {
591
597
  return {
592
598
  id: re.id,
593
- icon: F,
599
+ icon: B,
594
600
  title: "sheets-sort.general.sort-asc-cur",
595
601
  type: S.BUTTON,
596
602
  hidden$: rt(e)
@@ -633,7 +639,7 @@ function rr(e) {
633
639
  id: Ae,
634
640
  title: "sheets-sort.general.sort",
635
641
  type: S.SUBITEMS,
636
- icon: F,
642
+ icon: B,
637
643
  hidden$: Re(e, Y.UNIVER_SHEET),
638
644
  disabled$: N(e, {
639
645
  workbookTypes: [H],
@@ -644,16 +650,16 @@ function rr(e) {
644
650
  }
645
651
  function nr(e) {
646
652
  return {
647
- id: ae.id,
653
+ id: ce.id,
648
654
  title: "sheets-sort.general.sort-asc-cur",
649
655
  type: S.BUTTON,
650
- icon: F,
656
+ icon: B,
651
657
  disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
652
658
  };
653
659
  }
654
660
  function ir(e) {
655
661
  return {
656
- id: ce.id,
662
+ id: ae.id,
657
663
  title: "sheets-sort.general.sort-asc-ext",
658
664
  type: S.BUTTON,
659
665
  icon: he,
@@ -678,7 +684,7 @@ function or(e) {
678
684
  disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
679
685
  };
680
686
  }
681
- function ar(e) {
687
+ function cr(e) {
682
688
  return {
683
689
  id: de.id,
684
690
  title: "sheets-sort.general.sort-custom",
@@ -687,10 +693,10 @@ function ar(e) {
687
693
  disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
688
694
  };
689
695
  }
690
- const cr = {
691
- [lt.FORMULAS_INSERT]: {
696
+ const ar = {
697
+ [lt.ORGANIZATION]: {
692
698
  [Pe]: {
693
- order: 2,
699
+ order: 3,
694
700
  menuItemFactory: Xt,
695
701
  [re.id]: {
696
702
  order: 0,
@@ -714,16 +720,16 @@ const cr = {
714
720
  }
715
721
  }
716
722
  },
717
- [at.MAIN_AREA]: {
718
- [ct.DATA]: {
723
+ [ct.MAIN_AREA]: {
724
+ [at.DATA]: {
719
725
  [Ae]: {
720
726
  order: 0,
721
727
  menuItemFactory: rr,
722
- [ae.id]: {
728
+ [ce.id]: {
723
729
  order: 0,
724
730
  menuItemFactory: nr
725
731
  },
726
- [ce.id]: {
732
+ [ae.id]: {
727
733
  order: 1,
728
734
  menuItemFactory: ir
729
735
  },
@@ -737,7 +743,7 @@ const cr = {
737
743
  },
738
744
  [de.id]: {
739
745
  order: 4,
740
- menuItemFactory: ar
746
+ menuItemFactory: cr
741
747
  }
742
748
  }
743
749
  }
@@ -747,14 +753,14 @@ var lr = Object.getOwnPropertyDescriptor, ur = (e, t, n, r) => {
747
753
  for (var i = r > 1 ? void 0 : r ? lr(t, n) : t, s = e.length - 1, o; s >= 0; s--)
748
754
  (o = e[s]) && (i = o(i) || i);
749
755
  return i;
750
- }, I = (e, t) => (n, r) => t(n, r, e);
756
+ }, M = (e, t) => (n, r) => t(n, r, e);
751
757
  const pe = "custom-sort-dialog", dr = 560;
752
758
  let G = class extends Ye {
753
- constructor(e, t, n, r, i, s, o, c, l, d) {
754
- super(), this._commandService = e, this._menuManagerService = t, this._dialogService = n, this._layoutService = r, this._uiPartsService = i, this._sheetRenderService = s, this._localeService = o, this._sheetsSortUIService = c, this._injector = l, this._componentManager = d, this._initCommands(), this._initMenu(), this._initUI();
759
+ constructor(e, t, n, r, i, s, o, a, l, d) {
760
+ super(), this._commandService = e, this._menuManagerService = t, this._dialogService = n, this._layoutService = r, this._uiPartsService = i, this._sheetRenderService = s, this._localeService = o, this._sheetsSortUIService = a, this._injector = l, this._componentManager = d, this._initCommands(), this._initMenu(), this._initUI();
755
761
  }
756
762
  _initMenu() {
757
- this._menuManagerService.mergeMenu(cr);
763
+ this._menuManagerService.mergeMenu(ar);
758
764
  }
759
765
  _initCommands() {
760
766
  [
@@ -763,15 +769,28 @@ let G = class extends Ye {
763
769
  ie,
764
770
  se,
765
771
  oe,
766
- ae,
767
772
  ce,
773
+ ae,
768
774
  le,
769
775
  ue,
770
776
  de
771
777
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e))), this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(Qe.id));
772
778
  }
773
779
  _initUI() {
774
- this.disposeWithMe(this._componentManager.register("CustomSortPanel", Zt)), this.disposeWithMe(this._uiPartsService.registerComponent(it.FILTER_PANEL_EMBED_POINT, () => vt(qt, this._injector))), this.disposeWithMe(this._componentManager.register(F, ee)), this.disposeWithMe(this._componentManager.register(he, Le)), this.disposeWithMe(this._componentManager.register(ge, te)), this.disposeWithMe(this._componentManager.register(me, De)), this.disposeWithMe(this._componentManager.register(ve, Ne)), this._sheetsSortUIService.customSortState$.pipe(ft(this.dispose$)).subscribe((e) => {
780
+ this.disposeWithMe(
781
+ this._uiPartsService.registerComponent(it.FILTER_PANEL_EMBED_POINT, () => vt(qt, this._injector))
782
+ ), [
783
+ ["CustomSortPanel", zt],
784
+ [B, ee],
785
+ [he, Le],
786
+ [ge, te],
787
+ [me, De],
788
+ [ve, Ne]
789
+ ].forEach(([e, t]) => {
790
+ this.disposeWithMe(
791
+ this._componentManager.register(e, t)
792
+ );
793
+ }), this._sheetsSortUIService.customSortState$.pipe(ft(this.dispose$)).subscribe((e) => {
775
794
  e && e.show && e.location ? this._openCustomSortPanel(e.location) : e && !(e != null && e.show) && this._closePanel();
776
795
  });
777
796
  }
@@ -794,16 +813,16 @@ let G = class extends Ye {
794
813
  }
795
814
  };
796
815
  G = ur([
797
- I(0, xe),
798
- I(1, ut),
799
- I(2, dt),
800
- I(3, ht),
801
- I(4, gt),
802
- I(5, w(nt)),
803
- I(6, w(P)),
804
- I(7, w(g)),
805
- I(8, w(Me)),
806
- I(9, w(mt))
816
+ M(0, xe),
817
+ M(1, ut),
818
+ M(2, dt),
819
+ M(3, ht),
820
+ M(4, gt),
821
+ M(5, w(nt)),
822
+ M(6, w(P)),
823
+ M(7, w(g)),
824
+ M(8, w(Ie)),
825
+ M(9, w(mt))
807
826
  ], G);
808
827
  function hr() {
809
828
  return { x: 0, y: 0 };
@@ -838,14 +857,14 @@ $e(W, "type", Y.UNIVER_SHEET);
838
857
  $e(W, "pluginName", fr);
839
858
  W = Cr([
840
859
  qe(et),
841
- ye(1, w(Me)),
860
+ ye(1, w(Ie)),
842
861
  ye(2, Xe)
843
862
  ], W);
844
863
  export {
845
864
  re as SortRangeAscCommand,
846
865
  ne as SortRangeAscExtCommand,
847
- ce as SortRangeAscExtInCtxMenuCommand,
848
- ae as SortRangeAscInCtxMenuCommand,
866
+ ae as SortRangeAscExtInCtxMenuCommand,
867
+ ce as SortRangeAscInCtxMenuCommand,
849
868
  oe as SortRangeCustomCommand,
850
869
  de as SortRangeCustomInCtxMenuCommand,
851
870
  ie as SortRangeDescCommand,