@univerjs/sheets-table-ui 0.6.10-experimental.20250418-8830bd4

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.
Files changed (69) hide show
  1. package/README.md +21 -0
  2. package/lib/cjs/index.js +103 -0
  3. package/lib/cjs/locale/en-US.js +1 -0
  4. package/lib/cjs/locale/fa-IR.js +1 -0
  5. package/lib/cjs/locale/fr-FR.js +1 -0
  6. package/lib/cjs/locale/ru-RU.js +1 -0
  7. package/lib/cjs/locale/vi-VN.js +1 -0
  8. package/lib/cjs/locale/zh-CN.js +1 -0
  9. package/lib/cjs/locale/zh-TW.js +1 -0
  10. package/lib/es/index.js +2374 -0
  11. package/lib/es/locale/en-US.js +115 -0
  12. package/lib/es/locale/fa-IR.js +115 -0
  13. package/lib/es/locale/fr-FR.js +115 -0
  14. package/lib/es/locale/ru-RU.js +115 -0
  15. package/lib/es/locale/vi-VN.js +115 -0
  16. package/lib/es/locale/zh-CN.js +115 -0
  17. package/lib/es/locale/zh-TW.js +115 -0
  18. package/lib/index.js +2374 -0
  19. package/lib/locale/en-US.js +115 -0
  20. package/lib/locale/fa-IR.js +115 -0
  21. package/lib/locale/fr-FR.js +115 -0
  22. package/lib/locale/ru-RU.js +115 -0
  23. package/lib/locale/vi-VN.js +115 -0
  24. package/lib/locale/zh-CN.js +115 -0
  25. package/lib/locale/zh-TW.js +115 -0
  26. package/lib/types/commands/operations/open-table-filter-dialog.opration.d.ts +9 -0
  27. package/lib/types/commands/operations/open-table-selector.operation.d.ts +13 -0
  28. package/lib/types/const.d.ts +28 -0
  29. package/lib/types/controllers/config.schema.d.ts +22 -0
  30. package/lib/types/controllers/menu.schema.d.ts +2 -0
  31. package/lib/types/controllers/sheet-table-anchor.controller.d.ts +28 -0
  32. package/lib/types/controllers/sheet-table-component.controller.d.ts +28 -0
  33. package/lib/types/controllers/sheet-table-filter-button-render.controller.d.ts +26 -0
  34. package/lib/types/controllers/sheet-table-menu.controller.d.ts +9 -0
  35. package/lib/types/controllers/sheet-table-render.controller.d.ts +18 -0
  36. package/lib/types/controllers/sheet-table-selection.controller.d.ts +10 -0
  37. package/lib/types/controllers/sheet-table-theme-ui.controller.d.ts +8 -0
  38. package/lib/types/index.d.ts +16 -0
  39. package/lib/types/locale/en-US.d.ts +128 -0
  40. package/lib/types/locale/fa-IR.d.ts +128 -0
  41. package/lib/types/locale/fr-FR.d.ts +128 -0
  42. package/lib/types/locale/ru-RU.d.ts +128 -0
  43. package/lib/types/locale/vi-VN.d.ts +128 -0
  44. package/lib/types/locale/zh-CN.d.ts +128 -0
  45. package/lib/types/locale/zh-TW.d.ts +128 -0
  46. package/lib/types/plugin.d.ts +18 -0
  47. package/lib/types/services/sheets-table-ui-service.d.ts +25 -0
  48. package/lib/types/types.d.ts +31 -0
  49. package/lib/types/views/components/SheetTableAnchor.d.ts +16 -0
  50. package/lib/types/views/components/SheetTableConditionPanel.d.ts +13 -0
  51. package/lib/types/views/components/SheetTableFilterPanel.d.ts +16 -0
  52. package/lib/types/views/components/SheetTableItemsFilterPanel.d.ts +13 -0
  53. package/lib/types/views/components/SheetTableSelector.d.ts +5 -0
  54. package/lib/types/views/components/SheetTableThemePanel.d.ts +8 -0
  55. package/lib/types/views/components/type.d.ts +24 -0
  56. package/lib/types/views/components/util.d.ts +140 -0
  57. package/lib/types/views/menu.d.ts +32 -0
  58. package/lib/types/views/widgets/drawings.d.ts +6 -0
  59. package/lib/types/views/widgets/icons.d.ts +20 -0
  60. package/lib/types/views/widgets/table-filter-button.shape.d.ts +35 -0
  61. package/lib/umd/index.js +103 -0
  62. package/lib/umd/locale/en-US.js +1 -0
  63. package/lib/umd/locale/fa-IR.js +1 -0
  64. package/lib/umd/locale/fr-FR.js +1 -0
  65. package/lib/umd/locale/ru-RU.js +1 -0
  66. package/lib/umd/locale/vi-VN.js +1 -0
  67. package/lib/umd/locale/zh-CN.js +1 -0
  68. package/lib/umd/locale/zh-TW.js +1 -0
  69. package/package.json +91 -0
package/lib/index.js ADDED
@@ -0,0 +1,2374 @@
1
+ var _r = Object.defineProperty;
2
+ var Tr = (r, e, t) => e in r ? _r(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var F = (r, e, t) => Tr(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Inject as x, IUniverInstanceService as ge, ICommandService as ie, Disposable as $e, ObjectMatrix as yr, cellToRange as Ht, Rectangle as ve, LocaleService as le, Injector as Oe, dayjs as oe, IContextService as ft, CommandType as Vt, IConfigService as At, IPermissionService as Ir, ThemeService as Ut, RxDisposable as jt, InterceptorEffectEnum as wr, ErrorService as Mr, ColorKit as ae, UniverInstanceType as Je, Plugin as Rr, registerDependencies as xr, touchDependencies as Nr } from "@univerjs/core";
5
+ import { IRenderManagerService as Wt, SHEET_VIEWPORT_KEY as Er, convertTransformToOffsetX as Lr, convertTransformToOffsetY as $r, Rect as It, Shape as Or } from "@univerjs/engine-render";
6
+ import { TableManager as X, SheetTableService as kr, SetSheetTableFilterCommand as wt, isConditionFilter as Pr, isManualFilter as Dr, TableDateCompareTypeEnum as s, TableStringCompareTypeEnum as V, TableConditionTypeEnum as D, TableNumberCompareTypeEnum as L, SheetsTableSortStateEnum as Ze, TableColumnFilterTypeEnum as Mt, AddSheetTableCommand as Br, DeleteSheetTableCommand as Fr, SetSheetTableCommand as vt, SheetsTableButtonStateEnum as we, processStyleWithBorderStyle as Rt, customEmptyThemeWithBorderStyle as Hr, AddTableThemeCommand as Vr, RemoveTableThemeCommand as Ar, SheetTableRemoveColCommand as Zt, SheetTableRemoveRowCommand as qt, SheetTableInsertColCommand as Yt, SheetTableInsertRowCommand as Qt, SheetsTableController as zt } from "@univerjs/sheets-table";
7
+ import { SheetCanvasPopManagerService as Ur, SheetSkeletonManagerService as nt, SheetScrollManagerService as jr, getSheetObject as Wr, ISheetSelectionRenderService as Zr, getCoordByCell as qr, SelectAllCommand as Yr } from "@univerjs/sheets-ui";
8
+ import { useDependency as R, ComponentManager as Gt, IDialogService as Xt, ISidebarService as Qr, useObservable as Ne, IUIPartsService as zr, BuiltInUIPart as Gr, connectInjector as Xr, MenuItemType as Te, ContextMenuPosition as Kr, ContextMenuGroup as Jr, RibbonStartGroup as en, IMenuManagerService as tn } from "@univerjs/ui";
9
+ import { startWith as Kt, distinctUntilChanged as rn, Subject as nn, BehaviorSubject as an, merge as Ct, debounceTime as ln, switchMap as Se, of as G, map as sn, takeUntil as on } from "rxjs";
10
+ import { jsxs as _, jsx as o, Fragment as St } from "react/jsx-runtime";
11
+ import { Select as xt, CascaderList as cn, Input as _t, InputNumber as ct, DatePicker as un, DateRangePicker as dn, Scrollbar as hn, Checkbox as Nt, Segmented as vn, Button as Ve, Dropdown as Fe, ColorPicker as qe } from "@univerjs/design";
12
+ import { SortRangeCommand as bn, SortType as Et } from "@univerjs/sheets-sort";
13
+ import { forwardRef as K, useRef as gn, createElement as J, useState as U, useCallback as Lt, useMemo as mn, useEffect as Jt } from "react";
14
+ import { SetRangeValuesMutation as pn, getSheetCommandTarget as at, SheetsSelectionsService as it, isSingleCellSelection as fn, expandToContinuousRange as Cn, SetRangeThemeMutation as er, SheetRangeThemeModel as tr, WorkbookEditablePermission as Sn, SheetInterceptorService as rr, INTERCEPTOR_POINT as _n, RangeThemeStyle as Tn, getPrimaryForRange as $t, SetSelectionsOperation as Ot } from "@univerjs/sheets";
15
+ import { serializeRange as kt, deserializeRangeWithSheet as yn } from "@univerjs/engine-formula";
16
+ import { RangeSelector as In } from "@univerjs/sheets-formula-ui";
17
+ const wn = "SHEET_TABLE_UI_PLUGIN", de = "SHEETS_TABLE_FILTER_PANEL_OPENED_KEY", Mn = "UNIVER_SHEET_Table_FILTER_PANEL_ID", nr = "TABLE_TOOLBAR_BUTTON", xe = "TABLE_SELECTOR_DIALOG", Rn = "SHEET_TABLE_THEME_PANEL_ID", ar = "SHEET_TABLE_THEME_PANEL", ut = "table-custom-", xn = "table-default-", ce = "rgb(255, 255, 255)", q = "none", Me = "1px solid rgb(var(--grey-200))", Pt = "1px solid rgb(var(--blue-500))";
18
+ var Y = function() {
19
+ return Y = Object.assign || function(r) {
20
+ for (var e, t = 1, n = arguments.length; t < n; t++) {
21
+ e = arguments[t];
22
+ for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && (r[a] = e[a]);
23
+ }
24
+ return r;
25
+ }, Y.apply(this, arguments);
26
+ }, Nn = function(r, e) {
27
+ var t = {};
28
+ for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
29
+ if (r != null && typeof Object.getOwnPropertySymbols == "function")
30
+ for (var a = 0, n = Object.getOwnPropertySymbols(r); a < n.length; a++)
31
+ e.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[a]) && (t[n[a]] = r[n[a]]);
32
+ return t;
33
+ }, ee = K(function(r, e) {
34
+ var t = r.icon, n = r.id, a = r.className, i = r.extend, l = Nn(r, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(a || "").trim(), u = gn("_".concat($n()));
35
+ return ir(t, "".concat(n), { defIds: t.defIds, idSuffix: u.current }, Y({ ref: e, className: c }, l), i);
36
+ });
37
+ function ir(r, e, t, n, a) {
38
+ return J(r.tag, Y(Y({ key: e }, En(r, t, a)), n), (Ln(r, t).children || []).map(function(i, l) {
39
+ return ir(i, "".concat(e, "-").concat(r.tag, "-").concat(l), t, void 0, a);
40
+ }));
41
+ }
42
+ function En(r, e, t) {
43
+ var n = Y({}, r.attrs);
44
+ t != null && t.colorChannel1 && n.fill === "colorChannel1" && (n.fill = t.colorChannel1), r.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(i) {
45
+ var l = i[0], c = i[1];
46
+ l === "mask" && typeof c == "string" && (n[l] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
47
+ });
48
+ var a = e.defIds;
49
+ return !a || a.length === 0 || (r.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(i) {
50
+ var l = i[0], c = i[1];
51
+ typeof c == "string" && (n[l] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
52
+ })), n;
53
+ }
54
+ function Ln(r, e) {
55
+ var t, n = e.defIds;
56
+ return !n || n.length === 0 ? r : r.tag === "defs" && (!((t = r.children) === null || t === void 0) && t.length) ? Y(Y({}, r), { children: r.children.map(function(a) {
57
+ return typeof a.attrs.id == "string" && n && n.indexOf(a.attrs.id) > -1 ? Y(Y({}, a), { attrs: Y(Y({}, a.attrs), { id: a.attrs.id + e.idSuffix }) }) : a;
58
+ }) }) : r;
59
+ }
60
+ function $n() {
61
+ return Math.random().toString(36).substring(2, 8);
62
+ }
63
+ ee.displayName = "UniverIcon";
64
+ var On = { 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" } }] }, lr = K(function(r, e) {
65
+ return J(ee, Object.assign({}, r, {
66
+ id: "ascending- single",
67
+ ref: e,
68
+ icon: On
69
+ }));
70
+ });
71
+ lr.displayName = "AscendingSingle";
72
+ var kn = { 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.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.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.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, sr = K(function(r, e) {
73
+ return J(ee, Object.assign({}, r, {
74
+ id: "delete-single",
75
+ ref: e,
76
+ icon: kn
77
+ }));
78
+ });
79
+ sr.displayName = "DeleteSingle";
80
+ var Pn = { 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" } }] }, or = K(function(r, e) {
81
+ return J(ee, Object.assign({}, r, {
82
+ id: "descending-single",
83
+ ref: e,
84
+ icon: Pn
85
+ }));
86
+ });
87
+ or.displayName = "DescendingSingle";
88
+ var Dn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.85869 12.9216C8.38445 13.4708 7.61555 13.4708 7.14131 12.9216L0.358114 5.06726C-0.406895 4.18144 0.134916 2.66683 1.2168 2.66683L14.7832 2.66683C15.8651 2.66683 16.4069 4.18144 15.6419 5.06726L8.85869 12.9216Z" } }] }, He = K(function(r, e) {
89
+ return J(ee, Object.assign({}, r, {
90
+ id: "dropdown-single",
91
+ ref: e,
92
+ icon: Dn
93
+ }));
94
+ });
95
+ He.displayName = "DropdownSingle";
96
+ var Bn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.33333 3.33333V6H6V3.33333H3.33333ZM2 3.238C2 2.55427 2.55427 2 3.238 2H6.09533C6.77906 2 7.33333 2.55427 7.33333 3.238V6.09533C7.33333 6.77906 6.77906 7.33333 6.09533 7.33333H3.238C2.55427 7.33333 2 6.77906 2 6.09533V3.238ZM10 3.33333V6H12.6667V3.33333H10ZM8.66667 3.238C8.66667 2.55427 9.22094 2 9.90467 2H12.762C13.4457 2 14 2.55427 14 3.238V6.09533C14 6.77906 13.4457 7.33333 12.762 7.33333H9.90467C9.22094 7.33333 8.66667 6.77906 8.66667 6.09533V3.238ZM3.33333 10V12.6667H6V10H3.33333ZM2 9.90467C2 9.22094 2.55427 8.66667 3.238 8.66667H6.09533C6.77906 8.66667 7.33333 9.22094 7.33333 9.90467V12.762C7.33333 13.4457 6.77906 14 6.09533 14H3.238C2.55427 14 2 13.4457 2 12.762V9.90467ZM10 10V12.6667H12.6667V10H10ZM8.66667 9.90467C8.66667 9.22094 9.22094 8.66667 9.90467 8.66667H12.762C13.4457 8.66667 14 9.22094 14 9.90467V12.762C14 13.4457 13.4457 14 12.762 14H9.90467C9.22094 14 8.66667 13.4457 8.66667 12.762V9.90467Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, cr = K(function(r, e) {
97
+ return J(ee, Object.assign({}, r, {
98
+ id: "grid-outline-single",
99
+ ref: e,
100
+ icon: Bn
101
+ }));
102
+ });
103
+ cr.displayName = "GridOutlineSingle";
104
+ var Fn = { 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" } }] }, ur = K(function(r, e) {
105
+ return J(ee, Object.assign({}, r, {
106
+ id: "more-down-single",
107
+ ref: e,
108
+ icon: Fn
109
+ }));
110
+ });
111
+ ur.displayName = "MoreDownSingle";
112
+ var Hn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z" } }, { tag: "path", attrs: { fill: "colorChannel1", d: "M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z" } }] }, dr = K(function(r, e) {
113
+ return J(ee, Object.assign({}, r, {
114
+ id: "paint-bucket",
115
+ ref: e,
116
+ icon: Hn
117
+ }));
118
+ });
119
+ dr.displayName = "PaintBucket";
120
+ var Vn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.80068 2.57257L7.27955 2.57256C7.61092 2.57256 7.87954 2.30393 7.87954 1.97256C7.87954 1.64119 7.61091 1.37256 7.27954 1.37256L3.80068 1.37257C2.36473 1.37257 1.20067 2.53665 1.20068 3.97259L1.20074 12.3001C1.20075 13.736 2.36481 14.9 3.80074 14.9H12.1282C13.5641 14.9 14.7282 13.736 14.7282 12.3V8.82116C14.7282 8.48979 14.4595 8.22116 14.1282 8.22116C13.7968 8.22116 13.5282 8.48979 13.5282 8.82116V12.3C13.5282 13.0732 12.9014 13.7 12.1282 13.7H3.80074C3.02754 13.7 2.40074 13.0732 2.40074 12.3001L2.40068 3.97258C2.40068 3.19938 3.02748 2.57257 3.80068 2.57257Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M14.0072 2.0955C13.0997 1.18757 11.6278 1.18794 10.7207 2.09632L6.17749 6.646C6.10294 6.72065 6.04543 6.81056 6.00889 6.90954L4.59817 10.7315C4.51713 10.951 4.57116 11.1977 4.73657 11.3633C4.90198 11.5288 5.14858 11.5831 5.36823 11.5023L9.20237 10.0916C9.30186 10.055 9.3922 9.99722 9.46714 9.92224L14.0073 5.37972C14.9139 4.47266 14.9138 3.00252 14.0072 2.0955ZM11.5698 2.94424C12.0083 2.50513 12.7198 2.50496 13.1585 2.94384C13.5968 3.38229 13.5968 4.09294 13.1585 4.53141L8.69127 9.00102L6.1742 9.92713L7.09912 7.42132L11.5698 2.94424Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, hr = K(function(r, e) {
121
+ return J(ee, Object.assign({}, r, {
122
+ id: "rename-single",
123
+ ref: e,
124
+ icon: Vn
125
+ }));
126
+ });
127
+ hr.displayName = "RenameSingle";
128
+ var An = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.7643 4.13354C1.7643 2.82523 2.82488 1.76465 4.13319 1.76465H11.8665C13.1748 1.76465 14.2354 2.82524 14.2354 4.13354V11.8669C14.2354 13.1752 13.1748 14.2358 11.8665 14.2358H4.13318C2.82488 14.2358 1.7643 13.1752 1.7643 11.8669V6.1462C1.76388 6.13711 1.76367 6.12797 1.76367 6.11878C1.76367 6.10959 1.76388 6.10045 1.7643 6.09136V4.13354ZM2.94652 6.70989V11.8669C2.94652 12.5222 3.47781 13.0535 4.13318 13.0535H5.52732V6.70989H2.94652ZM5.52732 5.52767H2.94652V4.13354C2.94652 3.47816 3.47781 2.94687 4.13319 2.94687H5.52732V5.52767ZM6.70954 6.70989V13.0535H11.8665C12.5219 13.0535 13.0532 12.5222 13.0532 11.8669V6.70989L6.70954 6.70989ZM13.0532 5.52767L6.70954 5.52767V2.94687H11.8665C12.5219 2.94687 13.0532 3.47816 13.0532 4.13354V5.52767Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, vr = K(function(r, e) {
129
+ return J(ee, Object.assign({}, r, {
130
+ id: "table-single",
131
+ ref: e,
132
+ icon: An
133
+ }));
134
+ });
135
+ vr.displayName = "TableSingle";
136
+ var be = /* @__PURE__ */ ((r) => (r.Items = "items", r.Condition = "condition", r))(be || {}), Un = Object.getOwnPropertyDescriptor, jn = (r, e, t, n) => {
137
+ for (var a = n > 1 ? void 0 : n ? Un(e, t) : e, i = r.length - 1, l; i >= 0; i--)
138
+ (l = r[i]) && (a = l(a) || a);
139
+ return a;
140
+ }, Ye = (r, e) => (t, n) => e(t, n, r);
141
+ let Ee = class extends $e {
142
+ constructor(e, t, n, a) {
143
+ super();
144
+ F(this, "_itemsCache", /* @__PURE__ */ new Map());
145
+ this._tableManager = e, this._sheetTableService = t, this._univerInstanceService = n, this._commandService = a, this._registerTableFilterChangeEvent();
146
+ }
147
+ _registerTableFilterChangeEvent() {
148
+ this._commandService.onCommandExecuted((e) => {
149
+ if (e.id === pn.id) {
150
+ const { unitId: t, subUnitId: n, cellValue: a } = e.params, i = this._tableManager.getTablesBySubunitId(t, n);
151
+ if (!i.length)
152
+ return;
153
+ new yr(a).forValue((c, u, d) => {
154
+ const h = Ht(c, u), g = i.find((S) => {
155
+ const b = S.getTableFilterRange();
156
+ return ve.intersects(b, h);
157
+ });
158
+ if (g) {
159
+ const S = u - g.getRange().startColumn;
160
+ this._itemsCache.delete(g.getId() + S);
161
+ }
162
+ });
163
+ } else if (e.id === wt.id) {
164
+ const { unitId: t, tableId: n } = e.params, a = this._tableManager.getTable(t, n);
165
+ if (!a)
166
+ return;
167
+ const i = a.getSubunitId();
168
+ this._tableManager.getTablesBySubunitId(t, i).forEach((c) => {
169
+ const u = c.getRange();
170
+ for (let d = u.startColumn; d <= u.endColumn; d++)
171
+ this._itemsCache.delete(c.getId() + d);
172
+ });
173
+ }
174
+ });
175
+ }
176
+ getTableFilterPanelInitProps(e, t, n, a) {
177
+ const i = this._tableManager.getTable(e, n), l = i.getRange(), c = i.getTableFilterColumn(a - l.startColumn);
178
+ return {
179
+ unitId: e,
180
+ subUnitId: t,
181
+ tableFilter: c,
182
+ currentFilterBy: Pr(c) ? be.Condition : be.Items,
183
+ tableId: n,
184
+ columnIndex: a - l.startColumn
185
+ };
186
+ }
187
+ getTableFilterCheckedItems(e, t, n) {
188
+ const a = this._tableManager.getTable(e, t), i = [];
189
+ if (a) {
190
+ const l = a.getTableFilterColumn(n);
191
+ l && Dr(l) && i.push(...l.values);
192
+ }
193
+ return i;
194
+ }
195
+ setTableFilter(e, t, n, a) {
196
+ if (!this._tableManager.getTable(e, t))
197
+ return;
198
+ const l = {
199
+ unitId: e,
200
+ tableId: t,
201
+ column: n,
202
+ tableFilter: a
203
+ };
204
+ this._commandService.executeCommand(wt.id, l);
205
+ }
206
+ getTableFilterItems(e, t, n, a) {
207
+ var I;
208
+ if (this._itemsCache.has(n + a))
209
+ return this._itemsCache.get(n + a) || { data: [], itemsCountMap: /* @__PURE__ */ new Map(), allItemsCount: 0 };
210
+ const i = this._tableManager.getTable(e, n);
211
+ if (!i)
212
+ return { data: [], itemsCountMap: /* @__PURE__ */ new Map(), allItemsCount: 0 };
213
+ const l = i.getTableFilterRange(), { startRow: c, endRow: u, startColumn: d } = l, h = d + a, g = (I = this._univerInstanceService.getUnit(e)) == null ? void 0 : I.getSheetBySheetId(t);
214
+ if (!g)
215
+ return { data: [], itemsCountMap: /* @__PURE__ */ new Map(), allItemsCount: 0 };
216
+ const S = [], b = /* @__PURE__ */ new Map();
217
+ let $ = 0;
218
+ for (let y = c; y <= u; y++) {
219
+ if (g.isRowFiltered(y))
220
+ continue;
221
+ const w = this._sheetTableService.getCellValueWithConditionType(g, y, h);
222
+ b.has(w) || S.push({
223
+ title: w,
224
+ key: `${h}_${y}`,
225
+ leaf: !0
226
+ }), $++, b.set(w, (b.get(w) || 0) + 1);
227
+ }
228
+ return this._itemsCache.set(n + a, { data: S, itemsCountMap: b, allItemsCount: $ }), { data: S, itemsCountMap: b, allItemsCount: $ };
229
+ }
230
+ };
231
+ Ee = jn([
232
+ Ye(0, x(X)),
233
+ Ye(1, x(kr)),
234
+ Ye(2, x(ge)),
235
+ Ye(3, ie)
236
+ ], Ee);
237
+ var A = /* @__PURE__ */ ((r) => (r.DatePicker = "DatePicker", r.DateRange = "DateRange", r.Input = "Input", r.Inputs = "Inputs", r.Select = "Select", r.None = "None", r))(A || {});
238
+ function Wn(r) {
239
+ const t = r.get(le).t;
240
+ return [
241
+ {
242
+ value: D.String,
243
+ label: t(`sheets-table.condition.${D.String}`),
244
+ children: [
245
+ {
246
+ value: V.Equal,
247
+ label: t(`sheets-table.string.compare.${V.Equal}`)
248
+ },
249
+ {
250
+ value: V.NotEqual,
251
+ label: t(`sheets-table.string.compare.${V.NotEqual}`)
252
+ },
253
+ {
254
+ value: V.Contains,
255
+ label: t(`sheets-table.string.compare.${V.Contains}`)
256
+ },
257
+ {
258
+ value: V.NotContains,
259
+ label: t(`sheets-table.string.compare.${V.NotContains}`)
260
+ },
261
+ {
262
+ value: V.StartsWith,
263
+ label: t(`sheets-table.string.compare.${V.StartsWith}`)
264
+ },
265
+ {
266
+ value: V.EndsWith,
267
+ label: t(`sheets-table.string.compare.${V.EndsWith}`)
268
+ }
269
+ ]
270
+ },
271
+ {
272
+ value: D.Number,
273
+ label: t(`sheets-table.condition.${D.Number}`),
274
+ children: [
275
+ {
276
+ value: L.Equal,
277
+ label: t(`sheets-table.number.compare.${L.Equal}`)
278
+ },
279
+ {
280
+ value: L.NotEqual,
281
+ label: t(`sheets-table.number.compare.${L.NotEqual}`)
282
+ },
283
+ {
284
+ value: L.GreaterThan,
285
+ label: t(`sheets-table.number.compare.${L.GreaterThan}`)
286
+ },
287
+ {
288
+ value: L.GreaterThanOrEqual,
289
+ label: t(`sheets-table.number.compare.${L.GreaterThanOrEqual}`)
290
+ },
291
+ {
292
+ value: L.LessThan,
293
+ label: t(`sheets-table.number.compare.${L.LessThan}`)
294
+ },
295
+ {
296
+ value: L.LessThanOrEqual,
297
+ label: t(`sheets-table.number.compare.${L.LessThanOrEqual}`)
298
+ },
299
+ {
300
+ value: L.Between,
301
+ label: t(`sheets-table.number.compare.${L.Between}`)
302
+ },
303
+ {
304
+ value: L.NotBetween,
305
+ label: t(`sheets-table.number.compare.${L.NotBetween}`)
306
+ },
307
+ {
308
+ value: L.Above,
309
+ label: t(`sheets-table.number.compare.${L.Above}`)
310
+ },
311
+ {
312
+ value: L.Below,
313
+ label: t(`sheets-table.number.compare.${L.Below}`)
314
+ }
315
+ // {
316
+ // value: TableNumberCompareTypeEnum.TopN,
317
+ // label: t(`sheets-table.number.compare.${TableNumberCompareTypeEnum.TopN}`),
318
+ // },
319
+ ]
320
+ },
321
+ {
322
+ value: D.Date,
323
+ label: t(`sheets-table.condition.${D.Date}`),
324
+ children: [
325
+ {
326
+ value: s.Equal,
327
+ label: t(`sheets-table.date.compare.${s.Equal}`)
328
+ },
329
+ {
330
+ value: s.NotEqual,
331
+ label: t(`sheets-table.date.compare.${s.NotEqual}`)
332
+ },
333
+ {
334
+ value: s.After,
335
+ label: t(`sheets-table.date.compare.${s.After}`)
336
+ },
337
+ {
338
+ value: s.AfterOrEqual,
339
+ label: t(`sheets-table.date.compare.${s.AfterOrEqual}`)
340
+ },
341
+ {
342
+ value: s.Before,
343
+ label: t(`sheets-table.date.compare.${s.Before}`)
344
+ },
345
+ {
346
+ value: s.BeforeOrEqual,
347
+ label: t(`sheets-table.date.compare.${s.BeforeOrEqual}`)
348
+ },
349
+ {
350
+ value: s.Between,
351
+ label: t(`sheets-table.date.compare.${s.Between}`)
352
+ },
353
+ {
354
+ value: s.NotBetween,
355
+ label: t(`sheets-table.date.compare.${s.NotBetween}`)
356
+ },
357
+ {
358
+ value: s.Today,
359
+ label: t(`sheets-table.date.compare.${s.Today}`)
360
+ },
361
+ {
362
+ value: s.Yesterday,
363
+ label: t(`sheets-table.date.compare.${s.Yesterday}`)
364
+ },
365
+ {
366
+ value: s.Tomorrow,
367
+ label: t(`sheets-table.date.compare.${s.Tomorrow}`)
368
+ },
369
+ {
370
+ value: s.ThisWeek,
371
+ label: t(`sheets-table.date.compare.${s.ThisWeek}`)
372
+ },
373
+ {
374
+ value: s.LastWeek,
375
+ label: t(`sheets-table.date.compare.${s.LastWeek}`)
376
+ },
377
+ {
378
+ value: s.NextWeek,
379
+ label: t(`sheets-table.date.compare.${s.NextWeek}`)
380
+ },
381
+ {
382
+ value: s.ThisMonth,
383
+ label: t(`sheets-table.date.compare.${s.ThisMonth}`)
384
+ },
385
+ {
386
+ value: s.LastMonth,
387
+ label: t(`sheets-table.date.compare.${s.LastMonth}`)
388
+ },
389
+ {
390
+ value: s.NextMonth,
391
+ label: t(`sheets-table.date.compare.${s.NextMonth}`)
392
+ },
393
+ {
394
+ value: s.ThisYear,
395
+ label: t(`sheets-table.date.compare.${s.ThisYear}`)
396
+ },
397
+ {
398
+ value: s.LastYear,
399
+ label: t(`sheets-table.date.compare.${s.LastYear}`)
400
+ },
401
+ {
402
+ value: s.NextYear,
403
+ label: t(`sheets-table.date.compare.${s.NextYear}`)
404
+ },
405
+ {
406
+ value: s.Quarter,
407
+ label: t(`sheets-table.date.compare.${s.Quarter}`)
408
+ },
409
+ {
410
+ value: s.Month,
411
+ label: t(`sheets-table.date.compare.${s.Month}`)
412
+ }
413
+ ]
414
+ }
415
+ ];
416
+ }
417
+ function Zn(r, e) {
418
+ if (!e)
419
+ return [];
420
+ const n = r.get(le).t;
421
+ switch (e) {
422
+ case s.Quarter:
423
+ return [
424
+ {
425
+ value: s.Q1,
426
+ label: n(`sheets-table.date.compare.${s.Q1}`)
427
+ },
428
+ {
429
+ value: s.Q2,
430
+ label: n(`sheets-table.date.compare.${s.Q2}`)
431
+ },
432
+ {
433
+ value: s.Q3,
434
+ label: n(`sheets-table.date.compare.${s.Q3}`)
435
+ },
436
+ {
437
+ value: s.Q4,
438
+ label: n(`sheets-table.date.compare.${s.Q4}`)
439
+ }
440
+ ];
441
+ case s.Month:
442
+ return [
443
+ {
444
+ value: s.M1,
445
+ label: n(`sheets-table.date.compare.${s.M1}`)
446
+ },
447
+ {
448
+ value: s.M2,
449
+ label: n(`sheets-table.date.compare.${s.M2}`)
450
+ },
451
+ {
452
+ value: s.M3,
453
+ label: n(`sheets-table.date.compare.${s.M3}`)
454
+ },
455
+ {
456
+ value: s.M4,
457
+ label: n(`sheets-table.date.compare.${s.M4}`)
458
+ },
459
+ {
460
+ value: s.M5,
461
+ label: n(`sheets-table.date.compare.${s.M5}`)
462
+ },
463
+ {
464
+ value: s.M6,
465
+ label: n(`sheets-table.date.compare.${s.M6}`)
466
+ },
467
+ {
468
+ value: s.M7,
469
+ label: n(`sheets-table.date.compare.${s.M7}`)
470
+ },
471
+ {
472
+ value: s.M8,
473
+ label: n(`sheets-table.date.compare.${s.M8}`)
474
+ },
475
+ {
476
+ value: s.M9,
477
+ label: n(`sheets-table.date.compare.${s.M9}`)
478
+ },
479
+ {
480
+ value: s.M10,
481
+ label: n(`sheets-table.date.compare.${s.M10}`)
482
+ },
483
+ {
484
+ value: s.M11,
485
+ label: n(`sheets-table.date.compare.${s.M11}`)
486
+ },
487
+ {
488
+ value: s.M12,
489
+ label: n(`sheets-table.date.compare.${s.M12}`)
490
+ }
491
+ ];
492
+ default:
493
+ return [];
494
+ }
495
+ }
496
+ const Tt = /* @__PURE__ */ new Set([
497
+ s.Equal,
498
+ s.NotEqual,
499
+ s.After,
500
+ s.AfterOrEqual,
501
+ s.Before,
502
+ s.BeforeOrEqual
503
+ ]);
504
+ function qn(r, e) {
505
+ return e ? r === D.String ? A.Input : r === D.Number ? e === L.Between || e === L.NotBetween ? A.Inputs : A.Input : r === D.Date ? e === s.Between || e === s.NotBetween ? A.DateRange : e === s.Quarter || e === s.Month ? A.Select : Tt.has(e) ? A.DatePicker : A.None : A.None : A.None;
506
+ }
507
+ function Yn(r) {
508
+ if (!r || r.filterType !== "condition")
509
+ return {
510
+ type: D.String,
511
+ compareType: V.Equal,
512
+ info: {}
513
+ };
514
+ const e = r.filterInfo, { conditionType: t, compareType: n } = e;
515
+ return t === D.Date ? n === s.Between || n === s.NotBetween ? {
516
+ type: t,
517
+ compare: n,
518
+ info: {
519
+ dateRange: e.expectedValue
520
+ }
521
+ } : n === s.Today || n === s.Yesterday || n === s.Tomorrow || n === s.ThisWeek || n === s.LastWeek || n === s.NextWeek || n === s.ThisMonth || n === s.LastMonth || n === s.NextMonth || n === s.ThisYear || n === s.LastYear || n === s.NextYear ? {
522
+ type: t,
523
+ compare: n,
524
+ info: {}
525
+ } : Tt.has(n) ? {
526
+ type: t,
527
+ compare: n,
528
+ info: {
529
+ date: e.expectedValue
530
+ }
531
+ } : (/* @__PURE__ */ new Set([s.Q1, s.Q2, s.Q3, s.Q4])).has(n) ? {
532
+ type: t,
533
+ compare: s.Quarter,
534
+ info: {
535
+ dateSelect: e.compareType
536
+ }
537
+ } : {
538
+ type: t,
539
+ compare: s.Month,
540
+ info: {
541
+ dateSelect: e.compareType
542
+ }
543
+ } : t === D.Number ? n === L.Between || n === L.NotBetween ? {
544
+ type: t,
545
+ compare: n,
546
+ info: {
547
+ numberRange: e.expectedValue
548
+ }
549
+ } : {
550
+ type: t,
551
+ compare: n,
552
+ info: {
553
+ number: e.expectedValue
554
+ }
555
+ } : t === D.String ? {
556
+ type: t,
557
+ compare: n,
558
+ info: {
559
+ string: e.expectedValue
560
+ }
561
+ } : {
562
+ type: D.String,
563
+ compare: V.Equal,
564
+ info: {}
565
+ };
566
+ }
567
+ const Qn = (r) => {
568
+ var b, $, I, y, E, w, B;
569
+ const { conditionInfo: e, onChange: t } = r, n = R(le), [a, i] = U(Math.random()), l = R(Oe), c = Wn(l), u = (v) => {
570
+ var O;
571
+ const f = v[0], M = v[1];
572
+ M && i(Math.random());
573
+ const C = {};
574
+ f === D.Date ? M === s.Quarter ? C.dateSelect = s.Q1 : M === s.Month ? C.dateSelect = s.M1 : Tt.has(M) ? C.date = /* @__PURE__ */ new Date() : C.dateRange = [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()] : f === D.Number ? C.number = 0 : f === D.String && (C.string = ""), g(C, v[0], (O = v[1]) != null ? O : V.Equal);
575
+ }, d = qn(e.type, e.compare);
576
+ let h = "";
577
+ e.compare ? h = `${n.t(`sheets-table.condition.${e.type}`)} - ${n.t(`sheets-table.${e.type}.compare.${e.compare}`)}` : h = n.t(`sheets-table.condition.${e.type}`);
578
+ const g = (v, f, M) => {
579
+ t({
580
+ type: f != null ? f : e.type,
581
+ compare: M != null ? M : e.compare,
582
+ info: v
583
+ });
584
+ }, S = Zn(l, e.compare);
585
+ return /* @__PURE__ */ _("div", { children: [
586
+ /* @__PURE__ */ o(
587
+ xt,
588
+ {
589
+ className: "univer-h-8 univer-w-full",
590
+ dropdownRender: () => /* @__PURE__ */ o(
591
+ cn,
592
+ {
593
+ value: [e.type, e.compare],
594
+ options: c,
595
+ onChange: u,
596
+ contentClassName: "univer-flex-1",
597
+ wrapperClassName: "univer-max-h-[150px]"
598
+ }
599
+ ),
600
+ value: h,
601
+ onChange: () => {
602
+ }
603
+ },
604
+ a
605
+ ),
606
+ /* @__PURE__ */ _("div", { className: "univer-mt-3 univer-w-full", children: [
607
+ d === A.Input && /* @__PURE__ */ o(St, { children: e.type === D.String ? /* @__PURE__ */ o(
608
+ _t,
609
+ {
610
+ className: "univer-w-full",
611
+ placeholder: "请输入",
612
+ value: e.info.string,
613
+ onChange: (v) => g({ string: v })
614
+ }
615
+ ) : /* @__PURE__ */ o(
616
+ ct,
617
+ {
618
+ className: "univer-h-7 univer-w-full",
619
+ value: e.info.number,
620
+ controls: !1,
621
+ onChange: (v) => {
622
+ v !== null && g({ number: v });
623
+ }
624
+ }
625
+ ) }),
626
+ d === A.DatePicker && /* @__PURE__ */ o("div", { id: "univer-table-date-picker-wrapper", style: { background: "#fff", position: "relative" }, children: /* @__PURE__ */ o(
627
+ un,
628
+ {
629
+ value: oe(e.info.date),
630
+ defaultPickerValue: oe(),
631
+ onChange: (v) => g({ date: v.toDate() }),
632
+ getPopupContainer: () => document.getElementById("univer-table-date-picker-wrapper") || document.body,
633
+ className: "univer-w-full",
634
+ allowClear: !1
635
+ }
636
+ ) }),
637
+ d === A.DateRange && /* @__PURE__ */ o("div", { id: "univer-table-date-range-wrapper", style: { background: "#fff", position: "relative" }, children: /* @__PURE__ */ o(
638
+ dn,
639
+ {
640
+ value: [($ = oe((b = e.info.dateRange) == null ? void 0 : b[0])) != null ? $ : oe(), (y = oe((I = e.info.dateRange) == null ? void 0 : I[1])) != null ? y : oe()],
641
+ defaultPickerValue: [oe(), oe()],
642
+ onChange: (v) => {
643
+ g(v ? { dateRange: v.map((f) => f == null ? void 0 : f.toDate()) } : {});
644
+ },
645
+ getPopupContainer: () => document.getElementById("univer-table-date-range-wrapper") || document.body,
646
+ classNames: { popup: "univer-w-[400px]" },
647
+ allowClear: !1
648
+ }
649
+ ) }),
650
+ d === A.Inputs && /* @__PURE__ */ _("div", { className: "univer-flex univer-items-center univer-gap-2", children: [
651
+ /* @__PURE__ */ o(
652
+ ct,
653
+ {
654
+ className: "univer-h-7 univer-w-full",
655
+ value: (E = e.info.numberRange) == null ? void 0 : E[0],
656
+ onChange: (v) => {
657
+ var f;
658
+ v !== null && g({ numberRange: [v, (f = e.info.numberRange) == null ? void 0 : f[1]] });
659
+ },
660
+ controls: !1
661
+ }
662
+ ),
663
+ /* @__PURE__ */ o("span", { children: " - " }),
664
+ /* @__PURE__ */ o(
665
+ ct,
666
+ {
667
+ className: "univer-h-7 univer-w-full",
668
+ value: (w = e.info.numberRange) == null ? void 0 : w[1],
669
+ controls: !1,
670
+ onChange: (v) => {
671
+ var f;
672
+ v !== null && g({ numberRange: [(f = e.info.numberRange) == null ? void 0 : f[0], v] });
673
+ }
674
+ }
675
+ )
676
+ ] }),
677
+ d === A.Select && /* @__PURE__ */ o(
678
+ xt,
679
+ {
680
+ value: (B = e.info.dateSelect) != null ? B : S[0].value,
681
+ options: S,
682
+ onChange: (v) => g({ dateSelect: v }),
683
+ className: "univer-w-full"
684
+ }
685
+ )
686
+ ] })
687
+ ] });
688
+ }, zn = (r) => {
689
+ let e = 0;
690
+ return r.forEach((t) => {
691
+ e += t;
692
+ }), e;
693
+ };
694
+ function Gn(r) {
695
+ const { unitId: e, tableId: t, subUnitId: n, columnIndex: a, checkedItemSet: i, setCheckedItemSet: l, tableFilter: c } = r, u = R(le), d = R(Ee), { data: h, itemsCountMap: g, allItemsCount: S } = d.getTableFilterItems(e, n, t, a), [b, $] = U(c === void 0 ? !0 : i.size === g.size), [I, y] = U(b ? S : zn(g)), E = !b && i.size > 0, [w, B] = U(""), v = Lt(() => {
696
+ b ? (i.clear(), l(new Set(i)), $(!1)) : (h.forEach((C) => {
697
+ i.add(C.title);
698
+ }), l(new Set(i)), $(!0));
699
+ }, [b]), f = Lt((C) => {
700
+ }, []), M = (C) => {
701
+ if (b) {
702
+ $(!1);
703
+ const O = /* @__PURE__ */ new Set();
704
+ for (const { title: Z } of h)
705
+ C !== Z && O.add(Z);
706
+ y(S - g.get(C)), l(O);
707
+ } else
708
+ i.has(C) ? (i.delete(C), y(I - g.get(C))) : (i.add(C), y(I + g.get(C))), l(new Set(i));
709
+ };
710
+ return /* @__PURE__ */ _("div", { className: "univer-flex univer-h-full univer-flex-col", children: [
711
+ /* @__PURE__ */ o(_t, { autoFocus: !0, value: w, placeholder: u.t("sheets-filter.panel.search-placeholder"), onChange: f }),
712
+ /* @__PURE__ */ o(
713
+ "div",
714
+ {
715
+ className: `
716
+ univer-mt-2 univer-box-border univer-flex univer-h-[180px] univer-max-h-[180px] univer-flex-grow
717
+ univer-flex-col univer-overflow-hidden univer-rounded-md univer-border univer-border-solid
718
+ univer-border-gray-200 univer-py-1.5 univer-pl-2
719
+ `,
720
+ children: /* @__PURE__ */ o(
721
+ "div",
722
+ {
723
+ className: "univer-h-40 univer-overflow-y-hidden univer-py-1 univer-pl-2",
724
+ children: /* @__PURE__ */ o(hn, { children: /* @__PURE__ */ _("div", { className: "univer-h-40", children: [
725
+ /* @__PURE__ */ _(
726
+ "div",
727
+ {
728
+ className: "univer-flex univer-items-center univer-px-2 univer-py-1",
729
+ children: [
730
+ /* @__PURE__ */ o(
731
+ Nt,
732
+ {
733
+ indeterminate: E,
734
+ disabled: h.length === 0,
735
+ checked: b,
736
+ onChange: v
737
+ }
738
+ ),
739
+ /* @__PURE__ */ _(
740
+ "div",
741
+ {
742
+ className: `
743
+ univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-items-center
744
+ univer-text-sm
745
+ `,
746
+ children: [
747
+ /* @__PURE__ */ o("span", { className: "univer-inline-block univer-truncate", children: `${u.t("sheets-filter.panel.select-all")}` }),
748
+ /* @__PURE__ */ o("span", { className: "univer-ml univer-text-gray-400", children: `(${b ? S : I}/${S})` })
749
+ ]
750
+ }
751
+ )
752
+ ]
753
+ }
754
+ ),
755
+ h.map((C) => /* @__PURE__ */ _(
756
+ "div",
757
+ {
758
+ className: "univer-flex univer-items-center univer-px-2 univer-py-1",
759
+ children: [
760
+ /* @__PURE__ */ o(Nt, { checked: b || i.has(C.title), onChange: () => {
761
+ M(C.title);
762
+ } }),
763
+ /* @__PURE__ */ _(
764
+ "div",
765
+ {
766
+ className: `
767
+ univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-items-start
768
+ univer-text-sm
769
+ `,
770
+ children: [
771
+ /* @__PURE__ */ o("span", { className: "univer-inline-block univer-truncate", children: C.title }),
772
+ /* @__PURE__ */ o("span", { className: "univer-ml-1 univer-text-gray-400", children: `(${g.get(C.title) || 0})` })
773
+ ]
774
+ }
775
+ )
776
+ ]
777
+ },
778
+ C.key
779
+ ))
780
+ ] }) })
781
+ }
782
+ )
783
+ }
784
+ )
785
+ ] });
786
+ }
787
+ function Xn() {
788
+ const r = R(le), e = Kn(r), t = R(Ee), n = R(X), a = R(ie), i = R(Le), l = i.getCurrentTableFilterInfo(), c = t.getTableFilterPanelInitProps(l.unitId, l.subUnitId, l.tableId, l.column), { unitId: u, subUnitId: d, tableId: h, tableFilter: g, currentFilterBy: S, columnIndex: b } = c, { data: $ } = t.getTableFilterItems(u, d, h, b), I = t.getTableFilterCheckedItems(u, h, b), [y, E] = U(new Set(I)), [w, B] = U(S || be.Items), [v, f] = U(() => {
789
+ const m = c.tableFilter;
790
+ return Yn(m);
791
+ }), M = n.getTable(u, h);
792
+ if (!M) return null;
793
+ const C = M.getTableFilters(), O = C.getSortState(), Z = O.columnIndex === b && O.sortState === Ze.Asc, N = O.columnIndex === b && O.sortState === Ze.Desc, P = () => {
794
+ i.closeFilterPanel();
795
+ }, ye = () => {
796
+ P();
797
+ }, te = (m) => {
798
+ const k = M.getTableFilterRange();
799
+ a.executeCommand(bn.id, {
800
+ unitId: u,
801
+ subUnitId: d,
802
+ range: k,
803
+ orderRules: [{ colIndex: b + k.startColumn, type: m ? Et.ASC : Et.DESC }],
804
+ hasTitle: !1
805
+ }), C.setSortState(b, m ? Ze.Asc : Ze.Desc), P();
806
+ }, Ie = () => {
807
+ if (w === be.Items) {
808
+ const m = [];
809
+ for (const j of $)
810
+ y.has(j.title) && m.push(j.title);
811
+ const k = M.getTableFilterColumn(b);
812
+ if (k) {
813
+ if (k.values.join(",") === m.join(",")) {
814
+ P();
815
+ return;
816
+ }
817
+ } else if (m.length === 0) {
818
+ P();
819
+ return;
820
+ }
821
+ const H = {
822
+ filterType: Mt.manual,
823
+ values: m
824
+ };
825
+ t.setTableFilter(u, h, b, H);
826
+ } else {
827
+ let m;
828
+ v.compare === s.Quarter || v.compare === s.Month ? m = {
829
+ conditionType: v.type,
830
+ compareType: Object.values(v.info)[0]
831
+ } : m = {
832
+ conditionType: v.type,
833
+ compareType: v.compare,
834
+ expectedValue: Object.values(v.info)[0]
835
+ };
836
+ const k = {
837
+ filterType: Mt.condition,
838
+ // @ts-ignore
839
+ filterInfo: m
840
+ };
841
+ t.setTableFilter(u, h, b, k);
842
+ }
843
+ P();
844
+ }, me = () => {
845
+ t.setTableFilter(u, h, b, void 0), P();
846
+ };
847
+ return /* @__PURE__ */ _(
848
+ "div",
849
+ {
850
+ className: `
851
+ univer-box-border univer-flex univer-w-[312px] univer-flex-col univer-rounded-[10px] univer-bg-white
852
+ univer-p-4 univer-shadow-lg
853
+ `,
854
+ children: [
855
+ /* @__PURE__ */ _("div", { className: "univer-mb-3 univer-flex", children: [
856
+ /* @__PURE__ */ _(
857
+ "div",
858
+ {
859
+ className: `
860
+ univer-flex univer-w-[140px] univer-flex-1 univer-cursor-default univer-items-center
861
+ univer-justify-center univer-gap-1 univer-rounded-l-md univer-border univer-border-solid
862
+ univer-border-gray-200 univer-py-1.5 univer-text-[13px] univer-font-normal
863
+ hover:univer-cursor-pointer hover:univer-bg-gray-100
864
+ ${Z ? "univer-bg-gray-100" : ""}
865
+ `,
866
+ onClick: () => te(!0),
867
+ children: [
868
+ /* @__PURE__ */ o(lr, { className: "univer-text-base univer-text-color-[#1e222b] univer-mr-1" }),
869
+ r.t("sheets-sort.general.sort-asc")
870
+ ]
871
+ }
872
+ ),
873
+ /* @__PURE__ */ _(
874
+ "div",
875
+ {
876
+ className: `
877
+ univer-flex univer-w-[140px] univer-flex-1 univer-cursor-default univer-items-center
878
+ univer-justify-center univer-gap-1 univer-rounded-r-md univer-border univer-border-solid
879
+ univer-border-gray-200 univer-py-1.5 univer-text-[13px] univer-font-normal
880
+ hover:univer-cursor-pointer hover:univer-bg-gray-100
881
+ ${N ? "univer-bg-gray-100" : ""}
882
+ `,
883
+ onClick: () => te(!1),
884
+ children: [
885
+ /* @__PURE__ */ o(or, { className: "univer-text-base univer-text-color-[#1e222b] univer-mr-1" }),
886
+ r.t("sheets-sort.general.sort-desc")
887
+ ]
888
+ }
889
+ )
890
+ ] }),
891
+ /* @__PURE__ */ o("div", { className: "univer-table-filter-panel-header", children: /* @__PURE__ */ o(
892
+ vn,
893
+ {
894
+ value: w,
895
+ items: e,
896
+ onChange: (m) => B(m)
897
+ }
898
+ ) }),
899
+ /* @__PURE__ */ o("div", { className: "univer-table-filter-panel-body univer-z-10 univer-h-60", children: /* @__PURE__ */ o("div", { className: "univer-table-filter-panel-body-content univer-mt-3", children: w === be.Items ? /* @__PURE__ */ o(
900
+ Gn,
901
+ {
902
+ tableFilter: g,
903
+ unitId: u,
904
+ subUnitId: d,
905
+ tableId: h,
906
+ columnIndex: b,
907
+ checkedItemSet: y,
908
+ setCheckedItemSet: E
909
+ }
910
+ ) : /* @__PURE__ */ o(
911
+ Qn,
912
+ {
913
+ tableFilter: g,
914
+ unitId: u,
915
+ subUnitId: d,
916
+ tableId: h,
917
+ columnIndex: b,
918
+ conditionInfo: v,
919
+ onChange: f
920
+ }
921
+ ) }) }),
922
+ /* @__PURE__ */ _(
923
+ "div",
924
+ {
925
+ className: `
926
+ univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-wrap-nowrap
927
+ univer-justify-between univer-overflow-hidden
928
+ `,
929
+ children: [
930
+ /* @__PURE__ */ o(
931
+ Ve,
932
+ {
933
+ disabled: g === void 0,
934
+ onClick: me,
935
+ children: r.t("sheets-filter.panel.clear-filter")
936
+ }
937
+ ),
938
+ /* @__PURE__ */ _("div", { children: [
939
+ /* @__PURE__ */ o(Ve, { className: "univer-mr-2", onClick: ye, children: r.t("sheets-filter.panel.cancel") }),
940
+ /* @__PURE__ */ o(Ve, { variant: "primary", onClick: Ie, children: r.t("sheets-filter.panel.confirm") })
941
+ ] })
942
+ ]
943
+ }
944
+ )
945
+ ]
946
+ }
947
+ );
948
+ }
949
+ function Kn(r) {
950
+ const e = r.getCurrentLocale();
951
+ return mn(() => [
952
+ { label: r.t("sheets-filter.panel.by-values"), value: be.Items },
953
+ { label: r.t("sheets-filter.panel.by-conditions"), value: be.Condition }
954
+ ], [e, r]);
955
+ }
956
+ var Jn = Object.getOwnPropertyDescriptor, ea = (r, e, t, n) => {
957
+ for (var a = n > 1 ? void 0 : n ? Jn(e, t) : e, i = r.length - 1, l; i >= 0; i--)
958
+ (l = r[i]) && (a = l(a) || a);
959
+ return a;
960
+ }, Qe = (r, e) => (t, n) => e(t, n, r);
961
+ let Le = class extends $e {
962
+ constructor(e, t, n, a) {
963
+ super();
964
+ F(this, "_popupDisposable");
965
+ F(this, "_currentTableFilterInfo", null);
966
+ this._componentManager = e, this._contextService = t, this._sheetCanvasPopupService = n, this._dialogService = a, this._initComponents(), this._initUIPopup();
967
+ }
968
+ setCurrentTableFilterInfo(e) {
969
+ this._currentTableFilterInfo = e;
970
+ }
971
+ clearCurrentTableFilterInfo() {
972
+ this._currentTableFilterInfo = null;
973
+ }
974
+ getCurrentTableFilterInfo() {
975
+ return this._currentTableFilterInfo;
976
+ }
977
+ _initComponents() {
978
+ [
979
+ [de, Xn]
980
+ ].forEach(([e, t]) => {
981
+ this.disposeWithMe(this._componentManager.register(e, t));
982
+ });
983
+ }
984
+ _initUIPopup() {
985
+ this.disposeWithMe(this._contextService.subscribeContextValue$(de).pipe(Kt(void 0), rn()).subscribe((e) => {
986
+ e ? this._openFilterPopup() : e === !1 && this._closeFilterPopup();
987
+ }));
988
+ }
989
+ closeFilterPanel() {
990
+ this._contextService.setContextValue(de, !1);
991
+ }
992
+ _openFilterPopup() {
993
+ const e = this._currentTableFilterInfo;
994
+ if (!e)
995
+ throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");
996
+ const { row: t, column: n } = e;
997
+ this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(t, n, {
998
+ componentKey: de,
999
+ direction: "horizontal",
1000
+ onClickOutside: () => {
1001
+ this._dialogService.close(Mn), this._contextService.setContextValue(de, !1);
1002
+ },
1003
+ offset: [5, 0]
1004
+ });
1005
+ }
1006
+ _closeFilterPopup() {
1007
+ var e;
1008
+ (e = this._popupDisposable) == null || e.dispose(), this._popupDisposable = null, this.clearCurrentTableFilterInfo();
1009
+ }
1010
+ };
1011
+ Le = ea([
1012
+ Qe(0, x(Gt)),
1013
+ Qe(1, ft),
1014
+ Qe(2, x(Ur)),
1015
+ Qe(3, x(Xt))
1016
+ ], Le);
1017
+ const bt = {
1018
+ type: Vt.OPERATION,
1019
+ id: "sheet.operation.open-table-filter-panel",
1020
+ async handler(r, e) {
1021
+ if (!e)
1022
+ return !1;
1023
+ const { row: t, col: n, unitId: a, subUnitId: i, tableId: l } = e, c = r.get(X), u = r.get(ft), d = r.get(Le);
1024
+ return c.getTable(a, l) ? (u.getContextValue(de) || (d.setCurrentTableFilterInfo({ unitId: a, subUnitId: i, row: t, tableId: l, column: n }), u.setContextValue(de, !0)), !0) : !1;
1025
+ }
1026
+ }, yt = {
1027
+ type: Vt.OPERATION,
1028
+ id: "sheet.operation.open-table-selector",
1029
+ async handler(r) {
1030
+ var b;
1031
+ const e = r.get(ge), t = r.get(ie), n = at(e);
1032
+ if (!n)
1033
+ return !1;
1034
+ const { unitId: a, subUnitId: i, worksheet: l } = n, u = r.get(it).getCurrentLastSelection(), d = (b = u == null ? void 0 : u.range) != null ? b : { startRow: 0, endRow: 0, startColumn: 0, endColumn: 0 }, g = fn(u) ? Cn(d, { up: !0, left: !0, right: !0, down: !0 }, l) : d, S = await br(r, a, i, g);
1035
+ return S ? (t.executeCommand(Br.id, { ...S }), !0) : !1;
1036
+ }
1037
+ };
1038
+ async function br(r, e, t, n, a) {
1039
+ const i = r.get(Xt), l = r.get(le);
1040
+ return new Promise((c) => {
1041
+ const u = {
1042
+ unitId: e,
1043
+ subUnitId: t,
1044
+ range: n,
1045
+ tableId: a,
1046
+ onConfirm: (d) => {
1047
+ c(d), i.close(xe);
1048
+ },
1049
+ onCancel: () => {
1050
+ c(null), i.close(xe);
1051
+ }
1052
+ };
1053
+ i.open({
1054
+ id: xe,
1055
+ title: { title: l.t("sheets-table.selectRange") },
1056
+ draggable: !0,
1057
+ destroyOnClose: !0,
1058
+ children: {
1059
+ label: {
1060
+ name: xe,
1061
+ props: u
1062
+ }
1063
+ },
1064
+ width: 300,
1065
+ onClose: () => {
1066
+ c(null), i.close(xe);
1067
+ }
1068
+ });
1069
+ });
1070
+ }
1071
+ const gr = "sheets-table-ui.config";
1072
+ var ta = Object.getOwnPropertyDescriptor, ra = (r, e, t, n) => {
1073
+ for (var a = n > 1 ? void 0 : n ? ta(e, t) : e, i = r.length - 1, l; i >= 0; i--)
1074
+ (l = r[i]) && (a = l(a) || a);
1075
+ return a;
1076
+ }, na = (r, e) => (t, n) => e(t, n, r);
1077
+ let _e = class extends $e {
1078
+ constructor(e) {
1079
+ super();
1080
+ F(this, "_refreshTable", new nn());
1081
+ F(this, "refreshTable$", this._refreshTable.asObservable());
1082
+ this._commandService = e, this._initListener();
1083
+ }
1084
+ _initListener() {
1085
+ this.disposeWithMe(
1086
+ this._commandService.onCommandExecuted((e) => {
1087
+ if (e.id === er.id) {
1088
+ const t = e.params, { styleName: n } = t;
1089
+ n.startsWith("table-custom") && this._refreshTable.next(Math.random());
1090
+ }
1091
+ })
1092
+ );
1093
+ }
1094
+ };
1095
+ _e = ra([
1096
+ na(0, x(ie))
1097
+ ], _e);
1098
+ const aa = () => {
1099
+ var Ie, me;
1100
+ const [r, e] = U(""), [t, n] = U(""), a = R(Qr), [i, l] = U({}), c = R(Oe), u = R(et), d = Ne(u.anchorPosition$), h = R(ie), g = R(ge), S = R(X), b = R(tr), $ = R(_e), I = Ne($.refreshTable$), y = R(le), E = R(it), w = Ne(E.selectionChanged$, [{ range: Ht(0, 0), primary: null }]), [, B] = U(Math.random()), f = R(At).getConfig(gr), M = (Ie = f == null ? void 0 : f.anchorHeight) != null ? Ie : 24, C = (me = f == null ? void 0 : f.anchorBackgroundColor) != null ? me : "rgb(53,91,183)", O = (m, k) => {
1101
+ l((H) => ({
1102
+ ...H,
1103
+ [m]: k
1104
+ }));
1105
+ };
1106
+ if (Jt(() => {
1107
+ B(Math.random());
1108
+ }, [I]), !(d != null && d.length))
1109
+ return null;
1110
+ const Z = at(g);
1111
+ if (!Z) return null;
1112
+ const { unitId: N, subUnitId: P } = Z, ye = (m, k) => {
1113
+ var j;
1114
+ if (((j = S.getTableById(N, m)) == null ? void 0 : j.getDisplayName()) === k) {
1115
+ e(""), n("");
1116
+ return;
1117
+ }
1118
+ h.executeCommand(vt.id, {
1119
+ tableId: m,
1120
+ unitId: N,
1121
+ name: k
1122
+ }), n(""), e("");
1123
+ }, te = async (m) => {
1124
+ const k = S.getTableById(N, m);
1125
+ if (!k) return;
1126
+ const H = k.getRange(), j = await br(c, N, P, H, m);
1127
+ j && h.executeCommand(vt.id, {
1128
+ tableId: m,
1129
+ unitId: N,
1130
+ updateRange: {
1131
+ newRange: j.range
1132
+ }
1133
+ });
1134
+ };
1135
+ return /* @__PURE__ */ o(
1136
+ "div",
1137
+ {
1138
+ className: "univer-absolute univer-z-50 univer-h-0 univer-w-0",
1139
+ style: {},
1140
+ children: d.map((m) => {
1141
+ var p, T, Q, z, re, ne, se;
1142
+ const k = S.getTableById(N, m.tableId);
1143
+ if (!k) return null;
1144
+ const H = b.getRangeThemeStyle(N, k.getTableStyleId()), j = (Q = (T = (p = H == null ? void 0 : H.getHeaderRowStyle()) == null ? void 0 : p.bg) == null ? void 0 : T.rgb) != null ? Q : C, Ae = (ne = (re = (z = H == null ? void 0 : H.getHeaderRowStyle()) == null ? void 0 : z.cl) == null ? void 0 : re.rgb) != null ? ne : "rgb(255, 255, 255)", Ue = k.getRange();
1145
+ if (!(w != null && w.length))
1146
+ return null;
1147
+ const je = w[w.length - 1].range, We = !ve.intersects(Ue, je) && m.y <= 20;
1148
+ return /* @__PURE__ */ _(
1149
+ "div",
1150
+ {
1151
+ className: `
1152
+ univer-absolute univer-box-border univer-flex
1153
+ ${M ? `
1154
+ univer-h-[${M}px]
1155
+ ` : "univer-h-[24px]"}
1156
+ univer-cursor-pointer univer-items-center univer-rounded-xl univer-border univer-border-solid
1157
+ univer-border-gray-500 univer-pl-2 univer-pr-2 univer-shadow-xs
1158
+ `,
1159
+ style: {
1160
+ left: m.x,
1161
+ top: Math.max(m.y, 0),
1162
+ backgroundColor: j,
1163
+ color: Ae,
1164
+ borderWidth: "0.5px",
1165
+ display: We ? "none" : "flex"
1166
+ },
1167
+ children: [
1168
+ /* @__PURE__ */ o("div", { className: "univer-text-nowrap", children: r === m.tableId ? /* @__PURE__ */ o(
1169
+ _t,
1170
+ {
1171
+ className: "univer-h-[18px] univer-min-w-16 univer-rounded-none",
1172
+ inputClass: "univer-h-[18px] univer-w-[80px]",
1173
+ value: t,
1174
+ onChange: (W) => n(W),
1175
+ onBlur: () => ye(m.tableId, t),
1176
+ onKeyDown: (W) => {
1177
+ W.key === "Enter" && ye(m.tableId, t);
1178
+ },
1179
+ autoFocus: r === m.tableId
1180
+ }
1181
+ ) : /* @__PURE__ */ o("div", { className: "univer-h-[18px] univer-max-w-24 univer-truncate univer-text-sm", children: m.tableName }) }),
1182
+ /* @__PURE__ */ o(
1183
+ Fe,
1184
+ {
1185
+ open: (se = i[m.tableId]) != null ? se : !1,
1186
+ onOpenChange: (W) => {
1187
+ O(m.tableId, W);
1188
+ },
1189
+ overlay: /* @__PURE__ */ _("div", { className: "univer-pb-2 univer-pt-2", children: [
1190
+ /* @__PURE__ */ _(
1191
+ "div",
1192
+ {
1193
+ className: `
1194
+ univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
1195
+ univer-pb-1 univer-pl-2 univer-pr-2 univer-pt-1 univer-text-sm
1196
+ hover:univer-bg-gray-200
1197
+ `,
1198
+ onClick: () => {
1199
+ e(m.tableId), n(m.tableName);
1200
+ },
1201
+ children: [
1202
+ /* @__PURE__ */ o(hr, { className: "univer-mr-2" }),
1203
+ y.t("sheets-table.rename")
1204
+ ]
1205
+ }
1206
+ ),
1207
+ /* @__PURE__ */ o(
1208
+ "div",
1209
+ {
1210
+ className: `
1211
+ univer-mb-1 univer-mt-1 univer-h-[1px] univer-w-full univer-bg-gray-200
1212
+ `
1213
+ }
1214
+ ),
1215
+ /* @__PURE__ */ _(
1216
+ "div",
1217
+ {
1218
+ onClick: () => te(m.tableId),
1219
+ className: `
1220
+ univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
1221
+ univer-pb-1 univer-pl-2 univer-pr-2 univer-pt-1 univer-text-sm
1222
+ hover:univer-bg-gray-200
1223
+ `,
1224
+ children: [
1225
+ /* @__PURE__ */ o(cr, { className: "univer-mr-2" }),
1226
+ y.t("sheets-table.updateRange")
1227
+ ]
1228
+ }
1229
+ ),
1230
+ /* @__PURE__ */ _(
1231
+ "div",
1232
+ {
1233
+ className: `
1234
+ univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
1235
+ univer-pb-1 univer-pl-2 univer-pr-2 univer-pt-1 univer-text-sm
1236
+ hover:univer-bg-gray-200
1237
+ `,
1238
+ onClick: () => {
1239
+ O(m.tableId, !1);
1240
+ const W = S.getTableById(N, m.tableId);
1241
+ if (!W) return;
1242
+ const pe = W.getTableConfig(), fe = {
1243
+ id: Rn,
1244
+ header: { title: y.t("sheets-table.tableStyle") },
1245
+ children: {
1246
+ label: ar,
1247
+ oldConfig: pe,
1248
+ unitId: N,
1249
+ subUnitId: P,
1250
+ tableId: m.tableId
1251
+ },
1252
+ width: 330
1253
+ };
1254
+ a.open(fe);
1255
+ },
1256
+ children: [
1257
+ /* @__PURE__ */ o(
1258
+ dr,
1259
+ {
1260
+ extend: { colorChannel1: "rgb(53,91,183)" },
1261
+ className: "univer-mr-2"
1262
+ }
1263
+ ),
1264
+ y.t("sheets-table.setTheme")
1265
+ ]
1266
+ }
1267
+ ),
1268
+ /* @__PURE__ */ o(
1269
+ "div",
1270
+ {
1271
+ className: `
1272
+ univer-mb-1 univer-mt-1 univer-h-[1px] univer-w-full univer-bg-gray-200
1273
+ `
1274
+ }
1275
+ ),
1276
+ /* @__PURE__ */ _(
1277
+ "div",
1278
+ {
1279
+ className: `
1280
+ univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center
1281
+ univer-pb-1 univer-pl-2 univer-pr-2 univer-pt-1 univer-text-sm
1282
+ hover:univer-bg-gray-200
1283
+ `,
1284
+ onClick: () => {
1285
+ O(m.tableId, !1), h.executeCommand(Fr.id, {
1286
+ tableId: m.tableId,
1287
+ subUnitId: P,
1288
+ unitId: N
1289
+ });
1290
+ },
1291
+ children: [
1292
+ /* @__PURE__ */ o(sr, { className: "univer-mr-2" }),
1293
+ y.t("sheets-table.removeTable")
1294
+ ]
1295
+ }
1296
+ )
1297
+ ] }),
1298
+ align: "start",
1299
+ children: /* @__PURE__ */ o(ur, {})
1300
+ },
1301
+ m.tableId
1302
+ )
1303
+ ]
1304
+ },
1305
+ m.tableId
1306
+ );
1307
+ })
1308
+ }
1309
+ );
1310
+ };
1311
+ var ia = Object.getOwnPropertyDescriptor, la = (r, e, t, n) => {
1312
+ for (var a = n > 1 ? void 0 : n ? ia(e, t) : e, i = r.length - 1, l; i >= 0; i--)
1313
+ (l = r[i]) && (a = l(a) || a);
1314
+ return a;
1315
+ }, ue = (r, e) => (t, n) => e(t, n, r);
1316
+ let et = class extends $e {
1317
+ constructor(e, t, n, a, i, l, c, u, d) {
1318
+ super();
1319
+ F(this, "_selectedTable", !1);
1320
+ F(this, "_anchorPosition$", new an([]));
1321
+ F(this, "anchorPosition$", this._anchorPosition$.asObservable());
1322
+ this._context = e, this._injector = t, this._sheetSkeletonManagerService = n, this._renderManagerService = a, this._univerInstanceService = i, this._uiPartsService = l, this._tableManager = c, this._scrollManagerService = u, this._permissionService = d, this._initUI(), this._initTableAnchor();
1323
+ }
1324
+ _initUI() {
1325
+ this.disposeWithMe(
1326
+ this._uiPartsService.registerComponent(Gr.CONTENT, () => Xr(aa, this._injector))
1327
+ );
1328
+ }
1329
+ _initTableAnchor() {
1330
+ this.disposeWithMe(
1331
+ Ct(
1332
+ this._context.unit.activeSheet$,
1333
+ this._sheetSkeletonManagerService.currentSkeleton$,
1334
+ this._scrollManagerService.validViewportScrollInfo$,
1335
+ this._tableManager.tableAdd$,
1336
+ this._tableManager.tableDelete$,
1337
+ this._tableManager.tableNameChanged$,
1338
+ this._tableManager.tableRangeChanged$,
1339
+ this._tableManager.tableThemeChanged$,
1340
+ this._permissionService.permissionPointUpdate$.pipe(ln(100))
1341
+ ).subscribe(() => {
1342
+ var u;
1343
+ const e = this._context.unit, t = e.getActiveSheet(), n = t == null ? void 0 : t.getSheetId(), a = this._tableManager.getTableList(this._context.unitId).filter((d) => d.subUnitId === n), i = this._renderManagerService.getRenderById(this._context.unitId);
1344
+ if (!i) {
1345
+ this._anchorPosition$.next([]);
1346
+ return;
1347
+ }
1348
+ if (!((u = this._permissionService.getPermissionPoint(new Sn(e.getUnitId()).id)) == null ? void 0 : u.value)) {
1349
+ this._anchorPosition$.next([]);
1350
+ return;
1351
+ }
1352
+ const c = a.reduce((d, h) => {
1353
+ const { startRow: g, startColumn: S } = h.range, b = i.with(nt), $ = Wr(this._univerInstanceService, this._renderManagerService);
1354
+ if (!$) return d;
1355
+ const { scene: I } = $, y = I.getViewport(Er.VIEW_MAIN);
1356
+ if (!y) return d;
1357
+ const E = I == null ? void 0 : I.scaleX, w = I == null ? void 0 : I.scaleY, B = I == null ? void 0 : I.getViewportScrollXY(y);
1358
+ if (!E || !I || !w || !B) return d;
1359
+ const v = b.getCurrentSkeleton();
1360
+ if (!v) return d;
1361
+ const f = v.getNoMergeCellWithCoordByIndex(g, S), M = Lr(f.startX, E, B), C = $r(f.startY, w, B) - 25 - 4;
1362
+ return C >= -10 && M >= 45 && d.push({
1363
+ x: M,
1364
+ y: C,
1365
+ tableId: h.id,
1366
+ tableName: h.name
1367
+ }), d;
1368
+ }, []);
1369
+ this._anchorPosition$.next(c);
1370
+ })
1371
+ );
1372
+ }
1373
+ };
1374
+ et = la([
1375
+ ue(1, x(Oe)),
1376
+ ue(2, x(nt)),
1377
+ ue(3, Wt),
1378
+ ue(4, ge),
1379
+ ue(5, zr),
1380
+ ue(6, x(X)),
1381
+ ue(7, x(jr)),
1382
+ ue(8, x(Ir))
1383
+ ], et);
1384
+ const Re = 16;
1385
+ new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");
1386
+ class Dt {
1387
+ static drawNoSetting(e, t, n, a) {
1388
+ e.save(), It.drawWith(e, {
1389
+ radius: 2,
1390
+ width: Re,
1391
+ height: Re,
1392
+ fill: a
1393
+ }), e.lineCap = "square", e.strokeStyle = n, e.scale(t / Re, t / Re), e.beginPath(), e.lineWidth = 1, e.lineCap = "round", e.moveTo(3, 4), e.lineTo(13, 4), e.moveTo(4.5, 8), e.lineTo(11.5, 8), e.moveTo(6, 12), e.lineTo(10, 12), e.stroke(), e.restore();
1394
+ }
1395
+ static drawIconByPath(e, t, n, a) {
1396
+ e.save(), e.strokeStyle = n, e.fillStyle = a, It.drawWith(e, {
1397
+ radius: 2,
1398
+ width: Re,
1399
+ height: Re,
1400
+ fill: a
1401
+ }), t.forEach((i) => {
1402
+ const l = new Path2D(i);
1403
+ e.fillStyle = n, e.fill(l, "evenodd");
1404
+ }), e.restore();
1405
+ }
1406
+ }
1407
+ const sa = [
1408
+ "M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z"
1409
+ ], oa = [
1410
+ "M12.4008 13.1831C12.6907 13.1831 12.9258 12.9481 12.9258 12.6581V4.60873L14.013 5.69597C14.218 5.901 14.5505 5.901 14.7555 5.69597C14.9605 5.49094 14.9605 5.15853 14.7555 4.95351L12.7721 2.97017C12.5671 2.76515 12.2347 2.76515 12.0297 2.97017L10.0463 4.95351C9.84132 5.15853 9.84132 5.49094 10.0463 5.69597C10.2514 5.901 10.5838 5.901 10.7888 5.69597L11.8758 4.60901V12.6581C11.8758 12.9481 12.1108 13.1831 12.4008 13.1831Z",
1411
+ "M1.28069 4.85447C0.842195 4.33439 1.21191 3.5391 1.89218 3.5391H8.59333C9.2736 3.5391 9.64331 4.33439 9.20482 4.85447L6.51052 8.0501V11.6601C6.51052 12.2245 5.94174 12.6114 5.41683 12.404L4.48092 12.0343C4.1756 11.9136 3.97498 11.6187 3.97498 11.2904V8.0501L1.28069 4.85447Z"
1412
+ ], ca = [
1413
+ "M12.4008 2.81641C12.6907 2.81641 12.9258 3.05146 12.9258 3.34141V11.3908L14.013 10.3036C14.218 10.0986 14.5505 10.0986 14.7555 10.3036C14.9605 10.5086 14.9605 10.841 14.7555 11.046L12.7721 13.0294C12.5671 13.2344 12.2347 13.2344 12.0297 13.0294L10.0463 11.046C9.84132 10.841 9.84132 10.5086 10.0463 10.3036C10.2514 10.0986 10.5838 10.0986 10.7888 10.3036L11.8758 11.3905V3.34141C11.8758 3.05146 12.1108 2.81641 12.4008 2.81641Z",
1414
+ "M1.28069 4.85444C0.842195 4.33435 1.21191 3.53906 1.89218 3.53906H8.59333C9.2736 3.53906 9.64331 4.33435 9.20482 4.85443L6.51052 8.05006V11.6601C6.51052 12.2245 5.94174 12.6113 5.41683 12.404L4.48092 12.0342C4.1756 11.9136 3.97498 11.6186 3.97498 11.2903V8.05006L1.28069 4.85444Z"
1415
+ ], ua = [
1416
+ "M11.9003 13.7046C11.9003 13.9969 11.6633 14.2339 11.371 14.2339C11.0787 14.2339 10.8417 13.9969 10.8417 13.7046V3.57272L9.74577 4.66862C9.53906 4.87534 9.20391 4.87534 8.9972 4.66862C8.79048 4.46191 8.79048 4.12676 8.9972 3.92005L10.9969 1.92039C11.2036 1.71368 11.5387 1.71368 11.7454 1.92039L13.7451 3.92005C13.9518 4.12676 13.9518 4.46191 13.7451 4.66862C13.5384 4.87534 13.2032 4.87534 12.9965 4.66862L11.9003 3.57243V13.7046Z",
1417
+ "M2.69779 10.0113C2.40546 10.0113 2.16847 9.77429 2.16847 9.48196C2.16847 9.18962 2.40546 8.95264 2.69779 8.95264H6.67804C6.89213 8.95264 7.08514 9.0816 7.16707 9.2794C7.249 9.47719 7.20371 9.70486 7.05233 9.85624L3.97569 12.9329H6.67804C6.97038 12.9329 7.20736 13.1699 7.20736 13.4622C7.20736 13.7545 6.97038 13.9915 6.67804 13.9915H2.69779C2.4837 13.9915 2.29069 13.8626 2.20876 13.6648C2.12684 13.467 2.17212 13.2393 2.32351 13.0879L5.40015 10.0113H2.69779Z",
1418
+ "M5.51638 2.58693C5.23363 1.81542 4.14248 1.81543 3.85973 2.58693L2.13245 7.29995C2.03185 7.57443 2.17281 7.87849 2.4473 7.97909C2.72178 8.07969 3.02584 7.93872 3.12644 7.66424L3.64346 6.25351L3.64504 6.25351H5.73266L6.24968 7.66424C6.35027 7.93872 6.65433 8.07969 6.92882 7.97909C7.2033 7.87849 7.34426 7.57443 7.24367 7.29995L5.51638 2.58693ZM5.34467 5.19487L4.68806 3.40325L4.03144 5.19487H5.34467Z"
1419
+ ], da = [
1420
+ "M11.9003 2.29495C11.9003 2.00261 11.6633 1.76562 11.371 1.76562C11.0787 1.76562 10.8417 2.00261 10.8417 2.29495V12.4268L9.74577 11.3309C9.53906 11.1242 9.20391 11.1242 8.9972 11.3309C8.79048 11.5376 8.79048 11.8727 8.9972 12.0795L10.9969 14.0791C11.2036 14.2858 11.5387 14.2858 11.7454 14.0791L13.7451 12.0795C13.9518 11.8727 13.9518 11.5376 13.7451 11.3309C13.5384 11.1242 13.2032 11.1242 12.9965 11.3309L11.9003 12.4271V2.29495Z",
1421
+ "M2.69792 10.0113C2.40558 10.0113 2.16859 9.77429 2.16859 9.48196C2.16859 9.18962 2.40558 8.95264 2.69792 8.95264H6.67816C6.89225 8.95264 7.08526 9.0816 7.16719 9.2794C7.24912 9.47719 7.20384 9.70486 7.05245 9.85624L3.97581 12.9329H6.67816C6.9705 12.9329 7.20749 13.1699 7.20749 13.4622C7.20749 13.7545 6.9705 13.9915 6.67816 13.9915H2.69792C2.48383 13.9915 2.29082 13.8626 2.20889 13.6648C2.12696 13.467 2.17224 13.2393 2.32363 13.0879L5.40027 10.0113H2.69792Z",
1422
+ "M5.5165 2.58693C5.23375 1.81542 4.1426 1.81543 3.85985 2.58693L2.13257 7.29995C2.03197 7.57443 2.17294 7.8785 2.44742 7.97909C2.7219 8.07969 3.02596 7.93872 3.12656 7.66424L3.64358 6.25351L3.64516 6.25351H5.73278L6.2498 7.66424C6.35039 7.93872 6.65446 8.07969 6.92894 7.97909C7.20342 7.8785 7.34438 7.57443 7.24379 7.29995L5.5165 2.58693ZM5.34479 5.19487L4.68818 3.40325L4.03156 5.19487H5.34479Z"
1423
+ ];
1424
+ var ha = Object.getOwnPropertyDescriptor, va = (r, e, t, n) => {
1425
+ for (var a = n > 1 ? void 0 : n ? ha(e, t) : e, i = r.length - 1, l; i >= 0; i--)
1426
+ (l = r[i]) && (a = l(a) || a);
1427
+ return a;
1428
+ }, dt = (r, e) => (t, n) => e(t, n, r);
1429
+ const he = 16, ze = 1;
1430
+ let gt = class extends Or {
1431
+ constructor(e, t, n, a, i) {
1432
+ super(e, t);
1433
+ F(this, "_cellWidth", 0);
1434
+ F(this, "_cellHeight", 0);
1435
+ F(this, "_filterParams");
1436
+ F(this, "_hovered", !1);
1437
+ this._contextService = n, this._commandService = a, this._themeService = i, this.setShapeProps(t), this.onPointerDown$.subscribeEvent((l) => this.onPointerDown(l)), this.onPointerEnter$.subscribeEvent(() => this.onPointerEnter()), this.onPointerLeave$.subscribeEvent(() => this.onPointerLeave());
1438
+ }
1439
+ setShapeProps(e) {
1440
+ typeof e.cellHeight < "u" && (this._cellHeight = e.cellHeight), typeof e.cellWidth < "u" && (this._cellWidth = e.cellWidth), typeof e.filterParams < "u" && (this._filterParams = e.filterParams), this.transformByState({
1441
+ width: e.width,
1442
+ height: e.height
1443
+ });
1444
+ }
1445
+ _draw(e) {
1446
+ const t = this._cellHeight, n = this._cellWidth, a = he - n, i = he - t;
1447
+ e.save();
1448
+ const l = new Path2D();
1449
+ l.rect(a, i, n, t), e.clip(l);
1450
+ const { buttonState: c } = this._filterParams, u = this._themeService.getCurrentTheme().primaryColor, d = this._hovered ? this._themeService.getCurrentTheme().grey50 : "rgba(255, 255, 255, 1.0)";
1451
+ let h;
1452
+ switch (c) {
1453
+ case we.FilteredSortNone:
1454
+ h = sa;
1455
+ break;
1456
+ case we.FilteredSortAsc:
1457
+ h = oa;
1458
+ break;
1459
+ case we.FilteredSortDesc:
1460
+ h = ca;
1461
+ break;
1462
+ case we.FilterNoneSortNone:
1463
+ break;
1464
+ case we.FilterNoneSortAsc:
1465
+ h = ua;
1466
+ break;
1467
+ case we.FilterNoneSortDesc:
1468
+ h = da;
1469
+ break;
1470
+ }
1471
+ h ? Dt.drawIconByPath(e, h, u, d) : c !== void 0 && Dt.drawNoSetting(e, he, u, d), e.restore();
1472
+ }
1473
+ onPointerDown(e) {
1474
+ if (e.button === 2)
1475
+ return;
1476
+ const { row: t, col: n, unitId: a, subUnitId: i, tableId: l } = this._filterParams;
1477
+ this._contextService.getContextValue(de) || !this._commandService.hasCommand(bt.id) || setTimeout(() => {
1478
+ const u = {
1479
+ row: t,
1480
+ col: n,
1481
+ unitId: a,
1482
+ subUnitId: i,
1483
+ tableId: l
1484
+ };
1485
+ this._commandService.executeCommand(bt.id, u);
1486
+ }, 200);
1487
+ }
1488
+ onPointerEnter() {
1489
+ this._hovered = !0, this.makeDirty(!0);
1490
+ }
1491
+ onPointerLeave() {
1492
+ this._hovered = !1, this.makeDirty(!0);
1493
+ }
1494
+ };
1495
+ gt = va([
1496
+ dt(2, ft),
1497
+ dt(3, ie),
1498
+ dt(4, x(Ut))
1499
+ ], gt);
1500
+ var ba = Object.getOwnPropertyDescriptor, ga = (r, e, t, n) => {
1501
+ for (var a = n > 1 ? void 0 : n ? ba(e, t) : e, i = r.length - 1, l; i >= 0; i--)
1502
+ (l = r[i]) && (a = l(a) || a);
1503
+ return a;
1504
+ }, Ce = (r, e) => (t, n) => e(t, n, r);
1505
+ const ma = 5e3;
1506
+ let mt = class extends jt {
1507
+ constructor(e, t, n, a, i, l, c, u) {
1508
+ super();
1509
+ F(this, "_buttonRenderDisposable", null);
1510
+ F(this, "_tableFilterButtonShapes", []);
1511
+ this._context = e, this._injector = t, this._sheetSkeletonManagerService = n, this._themeService = a, this._sheetInterceptorService = i, this._commandService = l, this._selectionRenderService = c, this._tableManager = u, this._initRenderer();
1512
+ }
1513
+ dispose() {
1514
+ super.dispose(), this._disposeRendering();
1515
+ }
1516
+ _initRenderer() {
1517
+ const e = this._tableManager;
1518
+ this._sheetSkeletonManagerService.currentSkeleton$.pipe(
1519
+ Se((t) => {
1520
+ var c;
1521
+ if (!t) return G(null);
1522
+ const { unit: n, unitId: a } = this._context, i = ((c = n.getActiveSheet()) == null ? void 0 : c.getSheetId()) || "", l = () => ({
1523
+ unitId: a,
1524
+ worksheetId: i,
1525
+ tableFilterRanges: this._tableManager.getSheetFilterRangeWithState(n.getUnitId(), i),
1526
+ skeleton: t.skeleton
1527
+ });
1528
+ return Ct(
1529
+ e.tableAdd$,
1530
+ e.tableNameChanged$,
1531
+ e.tableRangeChanged$,
1532
+ e.tableThemeChanged$,
1533
+ e.tableDelete$,
1534
+ e.tableFilterChanged$
1535
+ ).pipe(
1536
+ sn(() => l()),
1537
+ Kt(l())
1538
+ );
1539
+ }),
1540
+ on(this.dispose$)
1541
+ ).subscribe((t) => {
1542
+ this._disposeRendering(), !(!t || !t.tableFilterRanges) && this._renderButtons(t);
1543
+ });
1544
+ }
1545
+ _renderButtons(e) {
1546
+ const { tableFilterRanges: t, unitId: n, skeleton: a, worksheetId: i } = e, { scene: l } = this._context;
1547
+ for (const { range: c, states: u, tableId: d } of t) {
1548
+ const { startRow: h, startColumn: g, endColumn: S } = c;
1549
+ this._interceptCellContent(n, i, c);
1550
+ for (let b = g; b <= S; b++) {
1551
+ const $ = `sheets-table-filter-button-${h}-${b}`, I = qr(h, b, l, a), { startX: y, startY: E, endX: w, endY: B } = I, v = w - y, f = B - E;
1552
+ if (f <= ze || v <= ze)
1553
+ continue;
1554
+ const M = u[b - g], C = w - he - ze, O = B - he - ze, Z = {
1555
+ left: C,
1556
+ top: O,
1557
+ height: he,
1558
+ width: he,
1559
+ zIndex: ma,
1560
+ cellHeight: f,
1561
+ cellWidth: v,
1562
+ filterParams: { unitId: n, subUnitId: i, row: h, col: b, buttonState: M, tableId: d }
1563
+ }, N = this._injector.createInstance(gt, $, Z);
1564
+ this._tableFilterButtonShapes.push(N);
1565
+ }
1566
+ }
1567
+ l.addObjects(this._tableFilterButtonShapes), l.makeDirty();
1568
+ }
1569
+ _interceptCellContent(e, t, n) {
1570
+ const { startRow: a, startColumn: i, endColumn: l } = n;
1571
+ this._buttonRenderDisposable = this._sheetInterceptorService.intercept(_n.CELL_CONTENT, {
1572
+ effect: wr.Style,
1573
+ handler: (c, u, d) => {
1574
+ const { row: h, col: g, unitId: S, subUnitId: b } = u;
1575
+ return S !== e || b !== t || h !== a || g < i || g > l ? d(c) : d({
1576
+ ...c,
1577
+ fontRenderExtension: {
1578
+ ...c == null ? void 0 : c.fontRenderExtension,
1579
+ rightOffset: he
1580
+ }
1581
+ });
1582
+ },
1583
+ priority: 10
1584
+ });
1585
+ }
1586
+ _disposeRendering() {
1587
+ var e;
1588
+ this._tableFilterButtonShapes.forEach((t) => t.dispose()), (e = this._buttonRenderDisposable) == null || e.dispose(), this._buttonRenderDisposable = null, this._tableFilterButtonShapes = [];
1589
+ }
1590
+ };
1591
+ mt = ga([
1592
+ Ce(1, x(Oe)),
1593
+ Ce(2, x(nt)),
1594
+ Ce(3, x(Ut)),
1595
+ Ce(4, x(rr)),
1596
+ Ce(5, ie),
1597
+ Ce(6, Zr),
1598
+ Ce(7, x(X))
1599
+ ], mt);
1600
+ const pa = (r) => {
1601
+ const { unitId: e, subUnitId: t, range: n, onCancel: a, onConfirm: i, tableId: l } = r, c = R(X), [u, d] = U(n), [h, g] = U(""), S = R(le), b = R(ge);
1602
+ return /* @__PURE__ */ _(St, { children: [
1603
+ /* @__PURE__ */ o(
1604
+ In,
1605
+ {
1606
+ maxRangeCount: 1,
1607
+ unitId: e,
1608
+ subUnitId: t,
1609
+ initialValue: kt(n),
1610
+ onChange: ($, I) => {
1611
+ const y = kt(n), E = yn(I).range, w = at(b, { unitId: e, subUnitId: t });
1612
+ if (!w)
1613
+ return;
1614
+ if (w.worksheet.getMergeData().some((N) => ve.intersects(E, N))) {
1615
+ g(S.t("sheets-table.tableRangeWithMergeError"));
1616
+ return;
1617
+ }
1618
+ if (c.getTablesBySubunitId(e, t).some((N) => {
1619
+ if (N.getId() === l)
1620
+ return !1;
1621
+ const P = N.getRange();
1622
+ return ve.intersects(E, P);
1623
+ })) {
1624
+ g(S.t("sheets-table.tableRangeWithOtherTableError"));
1625
+ return;
1626
+ }
1627
+ const { startRow: C, endRow: O } = E;
1628
+ if (C === O) {
1629
+ g(S.t("sheets-table.tableRangeSingleRowError"));
1630
+ return;
1631
+ }
1632
+ if (y !== I) {
1633
+ if (l) {
1634
+ const N = c.getTableById(e, l);
1635
+ if (N) {
1636
+ const P = N.getRange();
1637
+ if (ve.intersects(E, P) && P.startRow === E.startRow) {
1638
+ d(E), g(""), i({
1639
+ unitId: e,
1640
+ subUnitId: t,
1641
+ range: E
1642
+ });
1643
+ return;
1644
+ } else {
1645
+ g(S.t("sheets-table.updateError"));
1646
+ return;
1647
+ }
1648
+ }
1649
+ }
1650
+ d(n), g("");
1651
+ }
1652
+ },
1653
+ supportAcrossSheet: !1
1654
+ }
1655
+ ),
1656
+ h && /* @__PURE__ */ o("div", { className: "univer-mt-1 univer-text-xs univer-text-red-500", children: h }),
1657
+ /* @__PURE__ */ _("div", { className: "univer-mt-4 univer-flex univer-justify-end", children: [
1658
+ /* @__PURE__ */ o(Ve, { type: "default", onClick: a, children: S.t("sheets-table.cancel") }),
1659
+ /* @__PURE__ */ o(
1660
+ Ve,
1661
+ {
1662
+ type: "primary",
1663
+ onClick: () => {
1664
+ h || i({
1665
+ unitId: e,
1666
+ subUnitId: t,
1667
+ range: u
1668
+ });
1669
+ },
1670
+ className: "univer-ml-2",
1671
+ children: S.t("sheets-table.confirm")
1672
+ }
1673
+ )
1674
+ ] })
1675
+ ] });
1676
+ }, fa = (r) => {
1677
+ var me, m, k, H, j, lt, Ae, Ue, st, je, ot, We;
1678
+ const { unitId: e, subUnitId: t, tableId: n } = r, a = R(ie), i = R(le), l = R(X), c = l.getTableById(e, n), u = R(tr), d = R(_e), h = Ne(u.rangeThemeMapChange$), g = Ne(d.refreshTable$), S = R(Mr), [, b] = U(Math.random()), $ = Ne(l.tableThemeChanged$, {
1679
+ theme: c == null ? void 0 : c.getTableStyleId(),
1680
+ oldTheme: c == null ? void 0 : c.getTableStyleId(),
1681
+ unitId: e,
1682
+ subUnitId: t,
1683
+ tableId: n
1684
+ }), I = u.getRegisteredRangeThemes().filter((p) => p == null ? void 0 : p.startsWith(xn)), y = u.getALLRegisteredTheme(e).filter((p) => p == null ? void 0 : p.startsWith(ut)), E = c == null ? void 0 : c.getTableStyleId(), w = y.find((p) => p === E), B = w || y[0], v = u.getCustomRangeThemeStyle(e, B), f = (k = (m = (me = v == null ? void 0 : v.getHeaderRowStyle()) == null ? void 0 : me.bg) == null ? void 0 : m.rgb) != null ? k : ce, M = (lt = (j = (H = v == null ? void 0 : v.getFirstRowStyle()) == null ? void 0 : H.bg) == null ? void 0 : j.rgb) != null ? lt : ce, C = (st = (Ue = (Ae = v == null ? void 0 : v.getSecondRowStyle()) == null ? void 0 : Ae.bg) == null ? void 0 : Ue.rgb) != null ? st : ce, O = (We = (ot = (je = v == null ? void 0 : v.getLastRowStyle()) == null ? void 0 : je.bg) == null ? void 0 : ot.rgb) != null ? We : ce, [Z, N] = U(null), P = (p) => {
1685
+ a.executeCommand(vt.id, {
1686
+ unitId: e,
1687
+ tableId: n,
1688
+ theme: p
1689
+ });
1690
+ }, ye = () => {
1691
+ if (y.length >= 11) {
1692
+ S.emit(i.t("sheets-table.customTooMore"));
1693
+ return;
1694
+ }
1695
+ const p = y[y.length - 1];
1696
+ let T = `${ut}1`;
1697
+ if (p) {
1698
+ const z = Number(p.split("-")[2]);
1699
+ T = `${ut}${z + 1}`;
1700
+ }
1701
+ const Q = new Tn(T, { ...Hr });
1702
+ a.executeCommand(Vr.id, {
1703
+ unitId: e,
1704
+ tableId: n,
1705
+ themeStyle: Q
1706
+ });
1707
+ }, te = (p, T) => {
1708
+ a.executeCommand(er.id, {
1709
+ unitId: e,
1710
+ subUnitId: t,
1711
+ styleName: p,
1712
+ style: T
1713
+ });
1714
+ }, Ie = (p) => {
1715
+ a.executeCommand(Ar.id, {
1716
+ unitId: e,
1717
+ tableId: n,
1718
+ themeName: p
1719
+ });
1720
+ };
1721
+ return Jt(() => {
1722
+ b(Math.random());
1723
+ }, [h, g]), c ? /* @__PURE__ */ _("div", { children: [
1724
+ /* @__PURE__ */ o("h5", { children: i.t("sheets-table.defaultStyle") }),
1725
+ /* @__PURE__ */ o("div", { className: "univer-flex univer-gap-2", children: I.map((p) => {
1726
+ var se, W, pe, fe, ke, Pe, De, Be;
1727
+ const T = u.getDefaultRangeThemeStyle(p), Q = ((W = (se = T == null ? void 0 : T.getHeaderRowStyle()) == null ? void 0 : se.bg) == null ? void 0 : W.rgb) || ce, z = ((fe = (pe = T == null ? void 0 : T.getFirstRowStyle()) == null ? void 0 : pe.bg) == null ? void 0 : fe.rgb) || ce, re = ((Pe = (ke = T == null ? void 0 : T.getSecondRowStyle()) == null ? void 0 : ke.bg) == null ? void 0 : Pe.rgb) || ce, ne = ((Be = (De = T == null ? void 0 : T.getLastRowStyle()) == null ? void 0 : De.bg) == null ? void 0 : Be.rgb) || ce;
1728
+ return /* @__PURE__ */ _(
1729
+ "div",
1730
+ {
1731
+ className: "univer-h-10 univer-w-8 univer-cursor-pointer univer-p-[1px]",
1732
+ onClick: () => P(p),
1733
+ style: {
1734
+ border: p === $.theme ? Pt : Me
1735
+ },
1736
+ children: [
1737
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: Q, border: `${q}` } }),
1738
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: z, border: `${q}` } }),
1739
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: re, border: `${q}` } }),
1740
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: ne, border: `${q}` } })
1741
+ ]
1742
+ },
1743
+ p
1744
+ );
1745
+ }) }),
1746
+ /* @__PURE__ */ o("h5", { children: i.t("sheets-table.customStyle") }),
1747
+ /* @__PURE__ */ _("div", { className: "univer-w-full univer-rounded-sm univer-border univer-border-solid univer-border-gray-200", children: [
1748
+ /* @__PURE__ */ _("div", { className: "univer-flex univer-flex-wrap univer-gap-2 univer-p-2", children: [
1749
+ /* @__PURE__ */ o(
1750
+ "div",
1751
+ {
1752
+ className: `
1753
+ univer-h-10 univer-w-8 univer-cursor-pointer univer-border univer-border-solid
1754
+ univer-border-gray-200 univer-p-[1px] univer-text-center univer-leading-10
1755
+ `,
1756
+ onClick: ye,
1757
+ children: "+"
1758
+ }
1759
+ ),
1760
+ y.map((p) => {
1761
+ var se, W, pe, fe, ke, Pe, De, Be;
1762
+ const T = u.getCustomRangeThemeStyle(e, p), Q = (W = (se = T == null ? void 0 : T.getHeaderRowStyle()) == null ? void 0 : se.bg) == null ? void 0 : W.rgb, z = (fe = (pe = T == null ? void 0 : T.getFirstRowStyle()) == null ? void 0 : pe.bg) == null ? void 0 : fe.rgb, re = (Pe = (ke = T == null ? void 0 : T.getSecondRowStyle()) == null ? void 0 : ke.bg) == null ? void 0 : Pe.rgb, ne = (Be = (De = T == null ? void 0 : T.getLastRowStyle()) == null ? void 0 : De.bg) == null ? void 0 : Be.rgb;
1763
+ return /* @__PURE__ */ _(
1764
+ "div",
1765
+ {
1766
+ className: "univer-relative univer-h-10 univer-w-8 univer-cursor-pointer univer-p-[1px]",
1767
+ onClick: () => P(p),
1768
+ style: {
1769
+ border: p === $.theme ? Pt : Me
1770
+ },
1771
+ onMouseEnter: () => N(p),
1772
+ onMouseLeave: () => N(null),
1773
+ children: [
1774
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: Q != null ? Q : q, border: `${Q ? q : Me}` } }),
1775
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: z != null ? z : q, border: `${z ? q : Me}` } }),
1776
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: re != null ? re : q, border: `${re ? q : Me}` } }),
1777
+ /* @__PURE__ */ o("div", { className: "univer-box-border univer-h-[10px]", style: { background: ne != null ? ne : q, border: `${ne ? q : Me}` } }),
1778
+ /* @__PURE__ */ o(
1779
+ "div",
1780
+ {
1781
+ className: `
1782
+ univer-absolute univer-right-[-3px] univer-top-[-3px] univer-h-3 univer-w-3
1783
+ univer-rounded-md univer-bg-gray-200 univer-text-center univer-text-xs
1784
+ univer-leading-[10px]
1785
+ `,
1786
+ style: { display: Z === p ? "block" : "none" },
1787
+ onClick: (Sr) => {
1788
+ Sr.stopPropagation(), Ie(p);
1789
+ },
1790
+ children: "x"
1791
+ }
1792
+ )
1793
+ ]
1794
+ },
1795
+ p
1796
+ );
1797
+ })
1798
+ ] }),
1799
+ w && /* @__PURE__ */ _(St, { children: [
1800
+ /* @__PURE__ */ o("div", { className: "univer-h-[1px] univer-w-full univer-bg-gray-200" }),
1801
+ /* @__PURE__ */ _("div", { className: "univer-flex univer-flex-col univer-gap-2 univer-p-2", children: [
1802
+ /* @__PURE__ */ _("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
1803
+ /* @__PURE__ */ o(
1804
+ "div",
1805
+ {
1806
+ className: `
1807
+ univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-border
1808
+ univer-border-solid univer-border-gray-200 univer-text-center univer-leading-9
1809
+ `,
1810
+ style: {
1811
+ background: f,
1812
+ color: new ae(f).isDark() ? "#fff" : "#000"
1813
+ },
1814
+ children: i.t("sheets-table.header")
1815
+ }
1816
+ ),
1817
+ /* @__PURE__ */ o(
1818
+ Fe,
1819
+ {
1820
+ overlay: /* @__PURE__ */ o("div", { className: "univer-p-2", children: /* @__PURE__ */ o(
1821
+ qe,
1822
+ {
1823
+ value: f,
1824
+ onChange: (p) => {
1825
+ const T = Rt("headerRowStyle", {
1826
+ bg: {
1827
+ rgb: p
1828
+ },
1829
+ cl: {
1830
+ rgb: new ae(p).isDark() ? "#fff" : "#000"
1831
+ }
1832
+ });
1833
+ te(c.getTableStyleId(), { headerRowStyle: T });
1834
+ }
1835
+ }
1836
+ ) }),
1837
+ children: /* @__PURE__ */ _(
1838
+ "div",
1839
+ {
1840
+ className: `
1841
+ univer-flex univer-cursor-pointer univer-items-center univer-gap-2
1842
+ univer-rounded-sm univer-border univer-border-solid univer-border-gray-200
1843
+ univer-bg-white univer-p-1
1844
+ `,
1845
+ children: [
1846
+ /* @__PURE__ */ o(
1847
+ "div",
1848
+ {
1849
+ className: `
1850
+ univer-h-4 univer-w-4 univer-rounded-[8px] univer-border
1851
+ univer-border-solid univer-border-gray-200 univer-bg-slate-400
1852
+ `,
1853
+ style: {
1854
+ background: f,
1855
+ color: new ae(f).isDark() ? "#fff" : "#000"
1856
+ }
1857
+ }
1858
+ ),
1859
+ /* @__PURE__ */ o(He, { className: "univer-h-2 univer-w-2" })
1860
+ ]
1861
+ }
1862
+ )
1863
+ }
1864
+ )
1865
+ ] }),
1866
+ /* @__PURE__ */ _("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
1867
+ /* @__PURE__ */ o(
1868
+ "div",
1869
+ {
1870
+ className: `
1871
+ univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-border
1872
+ univer-border-solid univer-border-gray-200 univer-text-center univer-leading-9
1873
+ `,
1874
+ style: {
1875
+ background: M,
1876
+ color: new ae(M).isDark() ? "#fff" : "#000"
1877
+ },
1878
+ children: i.t("sheets-table.firstLine")
1879
+ }
1880
+ ),
1881
+ /* @__PURE__ */ o(
1882
+ Fe,
1883
+ {
1884
+ overlay: /* @__PURE__ */ o("div", { className: "univer-p-2", children: /* @__PURE__ */ o(
1885
+ qe,
1886
+ {
1887
+ value: M,
1888
+ onChange: (p) => {
1889
+ te(c.getTableStyleId(), {
1890
+ firstRowStyle: {
1891
+ bg: {
1892
+ rgb: p
1893
+ },
1894
+ cl: {
1895
+ rgb: new ae(p).isDark() ? "#fff" : "#000"
1896
+ }
1897
+ }
1898
+ });
1899
+ }
1900
+ }
1901
+ ) }),
1902
+ children: /* @__PURE__ */ _(
1903
+ "div",
1904
+ {
1905
+ className: `
1906
+ univer-flex univer-cursor-pointer univer-items-center univer-gap-2
1907
+ univer-rounded-sm univer-border univer-border-solid univer-border-gray-200
1908
+ univer-bg-white univer-p-1
1909
+ `,
1910
+ children: [
1911
+ /* @__PURE__ */ o(
1912
+ "div",
1913
+ {
1914
+ className: `
1915
+ univer-h-4 univer-w-4 univer-rounded-[8px] univer-border
1916
+ univer-border-solid univer-border-gray-200 univer-bg-slate-400
1917
+ `,
1918
+ style: { background: M }
1919
+ }
1920
+ ),
1921
+ /* @__PURE__ */ o(He, { className: "univer-h-2 univer-w-2" })
1922
+ ]
1923
+ }
1924
+ )
1925
+ }
1926
+ )
1927
+ ] }),
1928
+ /* @__PURE__ */ _("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
1929
+ /* @__PURE__ */ o(
1930
+ "div",
1931
+ {
1932
+ className: `
1933
+ univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-border
1934
+ univer-border-solid univer-border-gray-200 univer-text-center univer-leading-9
1935
+ `,
1936
+ style: {
1937
+ background: C,
1938
+ color: new ae(C).isDark() ? "#fff" : "#000"
1939
+ },
1940
+ children: i.t("sheets-table.secondLine")
1941
+ }
1942
+ ),
1943
+ /* @__PURE__ */ o(
1944
+ Fe,
1945
+ {
1946
+ overlay: /* @__PURE__ */ o("div", { className: "univer-p-2", children: /* @__PURE__ */ o(
1947
+ qe,
1948
+ {
1949
+ value: C,
1950
+ onChange: (p) => te(c.getTableStyleId(), {
1951
+ secondRowStyle: {
1952
+ bg: {
1953
+ rgb: p
1954
+ },
1955
+ cl: {
1956
+ rgb: new ae(p).isDark() ? "#fff" : "#000"
1957
+ }
1958
+ }
1959
+ })
1960
+ }
1961
+ ) }),
1962
+ children: /* @__PURE__ */ _(
1963
+ "div",
1964
+ {
1965
+ className: `
1966
+ univer-flex univer-cursor-pointer univer-items-center univer-gap-2
1967
+ univer-rounded-sm univer-border univer-border-solid univer-border-gray-200
1968
+ univer-bg-white univer-p-1
1969
+ `,
1970
+ children: [
1971
+ /* @__PURE__ */ o(
1972
+ "div",
1973
+ {
1974
+ className: `
1975
+ univer-h-4 univer-w-4 univer-rounded-[8px] univer-border
1976
+ univer-border-solid univer-border-gray-200 univer-bg-slate-400
1977
+ `,
1978
+ style: { background: C }
1979
+ }
1980
+ ),
1981
+ /* @__PURE__ */ o(He, { className: "univer-h-2 univer-w-2" })
1982
+ ]
1983
+ }
1984
+ )
1985
+ }
1986
+ )
1987
+ ] }),
1988
+ /* @__PURE__ */ _("div", { className: "univer-flex univer-h-9 univer-gap-2", children: [
1989
+ /* @__PURE__ */ o(
1990
+ "div",
1991
+ {
1992
+ className: `
1993
+ univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-border
1994
+ univer-border-solid univer-border-gray-200 univer-text-center univer-leading-9
1995
+ `,
1996
+ style: {
1997
+ background: O,
1998
+ color: new ae(O).isDark() ? "#fff" : "#000"
1999
+ },
2000
+ children: i.t("sheets-table.footer")
2001
+ }
2002
+ ),
2003
+ /* @__PURE__ */ o(
2004
+ Fe,
2005
+ {
2006
+ overlay: /* @__PURE__ */ o("div", { className: "univer-p-2", children: /* @__PURE__ */ o(
2007
+ qe,
2008
+ {
2009
+ value: O,
2010
+ onChange: (p) => {
2011
+ const T = Rt("lastRowStyle", {
2012
+ bg: {
2013
+ rgb: p
2014
+ },
2015
+ cl: {
2016
+ rgb: new ae(p).isDark() ? "#fff" : "#000"
2017
+ }
2018
+ });
2019
+ te(c.getTableStyleId(), { lastRowStyle: T });
2020
+ }
2021
+ }
2022
+ ) }),
2023
+ children: /* @__PURE__ */ _(
2024
+ "div",
2025
+ {
2026
+ className: `
2027
+ univer-flex univer-cursor-pointer univer-items-center univer-gap-2
2028
+ univer-rounded-sm univer-border univer-border-solid univer-border-gray-200
2029
+ univer-bg-white univer-p-1
2030
+ `,
2031
+ children: [
2032
+ /* @__PURE__ */ o(
2033
+ "div",
2034
+ {
2035
+ className: `
2036
+ univer-h-4 univer-w-4 univer-rounded-[8px] univer-border
2037
+ univer-border-solid univer-border-gray-200 univer-bg-slate-400
2038
+ `,
2039
+ style: { background: O }
2040
+ }
2041
+ ),
2042
+ /* @__PURE__ */ o(He, { className: "univer-h-2 univer-w-2" })
2043
+ ]
2044
+ }
2045
+ )
2046
+ }
2047
+ )
2048
+ ] })
2049
+ ] })
2050
+ ] })
2051
+ ] })
2052
+ ] }) : null;
2053
+ }, mr = "sheet.table.context-insert_menu-id", pr = "sheet.table.context-remove_menu-id";
2054
+ function Ca(r) {
2055
+ return {
2056
+ id: yt.id,
2057
+ type: Te.BUTTON,
2058
+ icon: nr,
2059
+ tooltip: "sheets-table.title",
2060
+ title: "sheets-table.title"
2061
+ };
2062
+ }
2063
+ function Sa(r) {
2064
+ return {
2065
+ id: mr,
2066
+ type: Te.SUBITEMS,
2067
+ icon: "Insert",
2068
+ title: "sheets-table.insert.main",
2069
+ hidden$: fr(r)
2070
+ };
2071
+ }
2072
+ function _a(r) {
2073
+ return {
2074
+ id: pr,
2075
+ type: Te.SUBITEMS,
2076
+ icon: "Reduce",
2077
+ title: "sheets-table.remove.main",
2078
+ hidden$: fr(r)
2079
+ };
2080
+ }
2081
+ function Ta(r) {
2082
+ return {
2083
+ id: Qt.id,
2084
+ type: Te.BUTTON,
2085
+ title: "sheets-table.insert.row",
2086
+ hidden$: Cr(r)
2087
+ };
2088
+ }
2089
+ function ya(r) {
2090
+ return {
2091
+ id: Yt.id,
2092
+ title: "sheets-table.insert.col",
2093
+ type: Te.BUTTON
2094
+ };
2095
+ }
2096
+ function Ia(r) {
2097
+ return {
2098
+ id: qt.id,
2099
+ type: Te.BUTTON,
2100
+ title: "sheets-table.remove.row",
2101
+ hidden$: Cr(r)
2102
+ };
2103
+ }
2104
+ function wa(r) {
2105
+ return {
2106
+ id: Zt.id,
2107
+ title: "sheets-table.remove.col",
2108
+ type: Te.BUTTON
2109
+ };
2110
+ }
2111
+ function fr(r) {
2112
+ const e = r.get(it);
2113
+ return r.get(ge).getCurrentTypeOfUnit$(Je.UNIVER_SHEET).pipe(
2114
+ Se((a) => a ? a.activeSheet$.pipe(
2115
+ Se((i) => i ? e.selectionMoveEnd$.pipe(
2116
+ Se((l) => {
2117
+ if (!l.length || l.length > 1) return G(!0);
2118
+ const u = l[0].range, h = r.get(zt).getContainerTableWithRange(a.getUnitId(), i.getSheetId(), u);
2119
+ return G(!h);
2120
+ })
2121
+ ) : G(!0))
2122
+ ) : G(!0))
2123
+ );
2124
+ }
2125
+ function Cr(r) {
2126
+ const e = r.get(it);
2127
+ return r.get(ge).getCurrentTypeOfUnit$(Je.UNIVER_SHEET).pipe(
2128
+ Se((a) => a ? a.activeSheet$.pipe(
2129
+ Se((i) => i ? e.selectionMoveEnd$.pipe(
2130
+ Se((l) => {
2131
+ if (!l.length || l.length > 1) return G(!0);
2132
+ const u = l[0].range, h = r.get(zt).getContainerTableWithRange(a.getUnitId(), i.getSheetId(), u);
2133
+ if (!h)
2134
+ return G(!0);
2135
+ const g = h.getRange();
2136
+ return u.startRow === g.startRow ? G(!0) : G(!1);
2137
+ })
2138
+ ) : G(!0))
2139
+ ) : G(!0))
2140
+ );
2141
+ }
2142
+ const Ma = {
2143
+ [en.FORMULAS_VIEW]: {
2144
+ [yt.id]: {
2145
+ order: 0,
2146
+ menuItemFactory: Ca
2147
+ }
2148
+ },
2149
+ [Kr.MAIN_AREA]: {
2150
+ [Jr.LAYOUT]: {
2151
+ [mr]: {
2152
+ order: 5,
2153
+ menuItemFactory: Sa,
2154
+ [Qt.id]: {
2155
+ order: 1,
2156
+ menuItemFactory: Ta
2157
+ },
2158
+ [Yt.id]: {
2159
+ order: 2,
2160
+ menuItemFactory: ya
2161
+ }
2162
+ },
2163
+ [pr]: {
2164
+ order: 6,
2165
+ menuItemFactory: _a,
2166
+ [qt.id]: {
2167
+ order: 1,
2168
+ menuItemFactory: Ia
2169
+ },
2170
+ [Zt.id]: {
2171
+ order: 2,
2172
+ menuItemFactory: wa
2173
+ }
2174
+ }
2175
+ }
2176
+ }
2177
+ };
2178
+ var Ra = Object.getOwnPropertyDescriptor, xa = (r, e, t, n) => {
2179
+ for (var a = n > 1 ? void 0 : n ? Ra(e, t) : e, i = r.length - 1, l; i >= 0; i--)
2180
+ (l = r[i]) && (a = l(a) || a);
2181
+ return a;
2182
+ }, Bt = (r, e) => (t, n) => e(t, n, r);
2183
+ let tt = class extends $e {
2184
+ constructor(r, e) {
2185
+ super(), this._componentManager = r, this._menuManagerService = e, this._initComponents(), this._initMenu();
2186
+ }
2187
+ _initComponents() {
2188
+ [
2189
+ [nr, vr],
2190
+ [xe, pa],
2191
+ [ar, fa]
2192
+ ].forEach(([r, e]) => {
2193
+ this.disposeWithMe(this._componentManager.register(r, e));
2194
+ });
2195
+ }
2196
+ _initMenu() {
2197
+ this._menuManagerService.mergeMenu(Ma);
2198
+ }
2199
+ };
2200
+ tt = xa([
2201
+ Bt(0, x(Gt)),
2202
+ Bt(1, x(tn))
2203
+ ], tt);
2204
+ var Na = Object.getOwnPropertyDescriptor, Ea = (r, e, t, n) => {
2205
+ for (var a = n > 1 ? void 0 : n ? Na(e, t) : e, i = r.length - 1, l; i >= 0; i--)
2206
+ (l = r[i]) && (a = l(a) || a);
2207
+ return a;
2208
+ }, Ge = (r, e) => (t, n) => e(t, n, r);
2209
+ let pt = class extends jt {
2210
+ constructor(r, e, t, n, a) {
2211
+ super(), this._context = r, this._injector = e, this._sheetSkeletonManagerService = t, this._tableManager = n, this._sheetTableThemeUIController = a, this._initListener();
2212
+ }
2213
+ _dirtySkeleton() {
2214
+ var e;
2215
+ (e = this._context.mainComponent) == null || e.makeDirty();
2216
+ const r = this._sheetSkeletonManagerService.getCurrentParam();
2217
+ if (r) {
2218
+ const t = { ...r, dirty: !0 };
2219
+ this._sheetSkeletonManagerService.reCalculate(t);
2220
+ }
2221
+ }
2222
+ _initListener() {
2223
+ const r = this._tableManager, e = this._dirtySkeleton.bind(this);
2224
+ this.disposeWithMe(
2225
+ Ct(
2226
+ r.tableAdd$,
2227
+ r.tableDelete$,
2228
+ r.tableNameChanged$,
2229
+ r.tableRangeChanged$,
2230
+ r.tableThemeChanged$,
2231
+ r.tableFilterChanged$,
2232
+ r.tableInitStatus$,
2233
+ this._sheetTableThemeUIController.refreshTable$
2234
+ ).subscribe(
2235
+ e
2236
+ )
2237
+ );
2238
+ }
2239
+ };
2240
+ pt = Ea([
2241
+ Ge(1, x(Oe)),
2242
+ Ge(2, x(nt)),
2243
+ Ge(3, x(X)),
2244
+ Ge(4, x(_e))
2245
+ ], pt);
2246
+ var La = Object.getOwnPropertyDescriptor, $a = (r, e, t, n) => {
2247
+ for (var a = n > 1 ? void 0 : n ? La(e, t) : e, i = r.length - 1, l; i >= 0; i--)
2248
+ (l = r[i]) && (a = l(a) || a);
2249
+ return a;
2250
+ }, ht = (r, e) => (t, n) => e(t, n, r);
2251
+ let rt = class extends $e {
2252
+ constructor(r, e, t) {
2253
+ super(), this._sheetInterceptorService = r, this._univerInstanceService = e, this._tableManager = t, this._initSelectionChange();
2254
+ }
2255
+ _initSelectionChange() {
2256
+ this.disposeWithMe(
2257
+ this._sheetInterceptorService.interceptCommand({
2258
+ getMutations: (r) => {
2259
+ if (r.id === Yr.id) {
2260
+ const e = at(this._univerInstanceService);
2261
+ if (!e)
2262
+ return { redos: [], undos: [] };
2263
+ const t = r.params, { range: n } = t, { unitId: a, subUnitId: i, worksheet: l } = e, u = this._tableManager.getTablesBySubunitId(a, i).find((d) => {
2264
+ const h = d.getRange();
2265
+ return ve.contains(h, n);
2266
+ });
2267
+ if (u) {
2268
+ const d = u.getRange(), h = {
2269
+ ...d,
2270
+ startRow: d.startRow + 1
2271
+ };
2272
+ return ve.equals(d, n) ? { undos: [], redos: [] } : ve.equals(h, n) ? {
2273
+ undos: [],
2274
+ redos: [
2275
+ {
2276
+ id: Ot.id,
2277
+ params: {
2278
+ unitId: a,
2279
+ subUnitId: i,
2280
+ selections: [
2281
+ {
2282
+ range: d,
2283
+ primary: $t(d, l)
2284
+ }
2285
+ ]
2286
+ }
2287
+ }
2288
+ ]
2289
+ } : {
2290
+ undos: [],
2291
+ redos: [
2292
+ {
2293
+ id: Ot.id,
2294
+ params: {
2295
+ unitId: a,
2296
+ subUnitId: i,
2297
+ selections: [
2298
+ {
2299
+ range: h,
2300
+ primary: $t(h, l)
2301
+ }
2302
+ ]
2303
+ }
2304
+ }
2305
+ ]
2306
+ };
2307
+ }
2308
+ }
2309
+ return { redos: [], undos: [] };
2310
+ }
2311
+ })
2312
+ );
2313
+ }
2314
+ };
2315
+ rt = $a([
2316
+ ht(0, x(rr)),
2317
+ ht(1, x(ge)),
2318
+ ht(2, x(X))
2319
+ ], rt);
2320
+ var Oa = Object.getOwnPropertyDescriptor, ka = (r, e, t, n) => {
2321
+ for (var a = n > 1 ? void 0 : n ? Oa(e, t) : e, i = r.length - 1, l; i >= 0; i--)
2322
+ (l = r[i]) && (a = l(a) || a);
2323
+ return a;
2324
+ }, Xe = (r, e) => (t, n) => e(t, n, r), Ke;
2325
+ let Ft = (Ke = class extends Rr {
2326
+ constructor(r = {}, e, t, n, a) {
2327
+ super(), this._config = r, this._injector = e, this._commandService = t, this._configService = n, this._renderManagerService = a, this._initRegisterCommand(), this._configService.setConfig(gr, this._config);
2328
+ }
2329
+ onStarting() {
2330
+ xr(this._injector, [
2331
+ [Le],
2332
+ [Ee],
2333
+ [tt],
2334
+ [_e],
2335
+ [rt]
2336
+ ]);
2337
+ }
2338
+ onReady() {
2339
+ Nr(this._injector, [
2340
+ [Le],
2341
+ [Ee],
2342
+ [tt],
2343
+ [_e],
2344
+ [rt]
2345
+ ]);
2346
+ }
2347
+ onRendered() {
2348
+ this._registerRenderModules();
2349
+ }
2350
+ _registerRenderModules() {
2351
+ [
2352
+ [mt],
2353
+ [pt],
2354
+ [et]
2355
+ ].forEach((r) => {
2356
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(Je.UNIVER_SHEET, r));
2357
+ });
2358
+ }
2359
+ _initRegisterCommand() {
2360
+ [
2361
+ bt,
2362
+ yt
2363
+ ].forEach((r) => this._commandService.registerCommand(r));
2364
+ }
2365
+ }, F(Ke, "pluginName", wn), F(Ke, "type", Je.UNIVER_SHEET), Ke);
2366
+ Ft = ka([
2367
+ Xe(1, x(Oe)),
2368
+ Xe(2, x(ie)),
2369
+ Xe(3, At),
2370
+ Xe(4, Wt)
2371
+ ], Ft);
2372
+ export {
2373
+ Ft as UniverSheetTableUIPlugin
2374
+ };