@univerjs/sheets-conditional-formatting-ui 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/lib/cjs/index.js +127 -2
  2. package/lib/cjs/locale/ca-ES.js +1 -1
  3. package/lib/cjs/locale/en-US.js +1 -1
  4. package/lib/cjs/locale/es-ES.js +1 -1
  5. package/lib/cjs/locale/fa-IR.js +1 -1
  6. package/lib/cjs/locale/fr-FR.js +1 -1
  7. package/lib/cjs/locale/ja-JP.js +1 -1
  8. package/lib/cjs/locale/ko-KR.js +1 -1
  9. package/lib/cjs/locale/ru-RU.js +1 -1
  10. package/lib/cjs/locale/sk-SK.js +1 -1
  11. package/lib/cjs/locale/vi-VN.js +1 -1
  12. package/lib/cjs/locale/zh-CN.js +1 -1
  13. package/lib/cjs/locale/zh-TW.js +1 -1
  14. package/lib/es/index.js +127 -4135
  15. package/lib/es/locale/ca-ES.js +1 -162
  16. package/lib/es/locale/en-US.js +1 -162
  17. package/lib/es/locale/es-ES.js +1 -162
  18. package/lib/es/locale/fa-IR.js +1 -162
  19. package/lib/es/locale/fr-FR.js +1 -162
  20. package/lib/es/locale/ja-JP.js +1 -162
  21. package/lib/es/locale/ko-KR.js +1 -162
  22. package/lib/es/locale/ru-RU.js +1 -162
  23. package/lib/es/locale/sk-SK.js +1 -162
  24. package/lib/es/locale/vi-VN.js +1 -162
  25. package/lib/es/locale/zh-CN.js +1 -162
  26. package/lib/es/locale/zh-TW.js +1 -162
  27. package/lib/index.css +424 -1
  28. package/lib/index.js +127 -4135
  29. package/lib/locale/ca-ES.js +1 -162
  30. package/lib/locale/en-US.js +1 -162
  31. package/lib/locale/es-ES.js +1 -162
  32. package/lib/locale/fa-IR.js +1 -162
  33. package/lib/locale/fr-FR.js +1 -162
  34. package/lib/locale/ja-JP.js +1 -162
  35. package/lib/locale/ko-KR.js +1 -162
  36. package/lib/locale/ru-RU.js +1 -162
  37. package/lib/locale/sk-SK.js +1 -162
  38. package/lib/locale/vi-VN.js +1 -162
  39. package/lib/locale/zh-CN.js +1 -162
  40. package/lib/locale/zh-TW.js +1 -162
  41. package/lib/types/commands/commands/add-average-cf.command.d.ts +17 -2
  42. package/lib/types/commands/commands/add-color-scale-cf.command.d.ts +17 -2
  43. package/lib/types/commands/commands/add-data-bar-cf.command.d.ts +17 -2
  44. package/lib/types/commands/commands/add-duplicate-values-cf.command.d.ts +17 -2
  45. package/lib/types/commands/commands/add-number-cf.command.d.ts +17 -2
  46. package/lib/types/commands/commands/add-rank-cf.command.d.ts +17 -2
  47. package/lib/types/commands/commands/add-text-cf.command.d.ts +17 -2
  48. package/lib/types/commands/commands/add-time-period-cf.command.d.ts +17 -2
  49. package/lib/types/commands/commands/add-unique-values-cf.command.d.ts +17 -2
  50. package/lib/types/commands/operations/open-conditional-formatting-panel.d.ts +16 -1
  51. package/lib/types/components/color-picker/index.d.ts +16 -1
  52. package/lib/types/components/conditional-style-editor/index.d.ts +16 -1
  53. package/lib/types/components/panel/index.d.ts +16 -1
  54. package/lib/types/components/panel/rule-edit/ColorScale.d.ts +16 -1
  55. package/lib/types/components/panel/rule-edit/DataBar.d.ts +16 -1
  56. package/lib/types/components/panel/rule-edit/Formula.d.ts +16 -1
  57. package/lib/types/components/panel/rule-edit/HighlightCell.d.ts +17 -2
  58. package/lib/types/components/panel/rule-edit/IconSet.d.ts +17 -2
  59. package/lib/types/components/panel/rule-edit/Rank.d.ts +16 -1
  60. package/lib/types/components/panel/rule-edit/index.d.ts +16 -1
  61. package/lib/types/components/panel/rule-edit/type.d.ts +19 -4
  62. package/lib/types/components/panel/rule-list/index.d.ts +16 -1
  63. package/lib/types/components/preview/index.d.ts +16 -1
  64. package/lib/types/components/wrapper-error/WrapperError.d.ts +16 -1
  65. package/lib/types/config/config.d.ts +16 -1
  66. package/lib/types/controllers/cf-formula-ref-range.controller.d.ts +17 -1
  67. package/lib/types/controllers/cf.auto-fill.controller.d.ts +15 -0
  68. package/lib/types/controllers/cf.clear.controller.d.ts +19 -2
  69. package/lib/types/controllers/cf.copy-paste.controller.d.ts +15 -0
  70. package/lib/types/controllers/cf.editor.controller.d.ts +15 -0
  71. package/lib/types/controllers/cf.i18n.controller.d.ts +16 -1
  72. package/lib/types/controllers/cf.painter.controller.d.ts +15 -0
  73. package/lib/types/controllers/cf.panel.controller.d.ts +16 -1
  74. package/lib/types/controllers/cf.permission.controller.d.ts +15 -0
  75. package/lib/types/controllers/cf.render.controller.d.ts +15 -0
  76. package/lib/types/controllers/cf.viewport.controller.d.ts +15 -0
  77. package/lib/types/locale/ca-ES.d.ts +16 -1
  78. package/lib/types/locale/es-ES.d.ts +16 -1
  79. package/lib/types/locale/fa-IR.d.ts +16 -1
  80. package/lib/types/locale/fr-FR.d.ts +16 -1
  81. package/lib/types/locale/ja-JP.d.ts +16 -1
  82. package/lib/types/locale/ko-KR.d.ts +16 -1
  83. package/lib/types/locale/ru-RU.d.ts +16 -1
  84. package/lib/types/locale/sk-SK.d.ts +16 -1
  85. package/lib/types/locale/vi-VN.d.ts +16 -1
  86. package/lib/types/locale/zh-CN.d.ts +16 -1
  87. package/lib/types/locale/zh-TW.d.ts +16 -1
  88. package/lib/types/menu/cf.menu.controller.d.ts +15 -0
  89. package/lib/types/menu/manage-rule.d.ts +17 -2
  90. package/lib/types/menu/schema.d.ts +16 -1
  91. package/lib/types/mobile-plugin.d.ts +16 -1
  92. package/lib/types/plugin.d.ts +16 -1
  93. package/lib/umd/index.js +127 -2
  94. package/lib/umd/locale/ca-ES.js +1 -1
  95. package/lib/umd/locale/en-US.js +1 -1
  96. package/lib/umd/locale/es-ES.js +1 -1
  97. package/lib/umd/locale/fa-IR.js +1 -1
  98. package/lib/umd/locale/fr-FR.js +1 -1
  99. package/lib/umd/locale/ja-JP.js +1 -1
  100. package/lib/umd/locale/ko-KR.js +1 -1
  101. package/lib/umd/locale/ru-RU.js +1 -1
  102. package/lib/umd/locale/sk-SK.js +1 -1
  103. package/lib/umd/locale/vi-VN.js +1 -1
  104. package/lib/umd/locale/zh-CN.js +1 -1
  105. package/lib/umd/locale/zh-TW.js +1 -1
  106. package/package.json +16 -15
package/lib/index.js CHANGED
@@ -1,4136 +1,128 @@
1
- var nr = Object.defineProperty;
2
- var rr = (n, e, t) => e in n ? nr(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var ge = (n, e, t) => rr(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { CommandType as he, ICommandService as Q, IUniverInstanceService as G, ColorKit as vn, BooleanNumber as ie, LocaleService as te, UniverInstanceType as H, Tools as _t, get as ir, set as or, createInterceptorKey as gn, InterceptorManager as sr, Inject as $, Disposable as se, Injector as ve, Rectangle as me, generateRandomId as ar, toDisposable as mn, ObjectMatrix as Re, Range as fe, InterceptorEffectEnum as lr, DependentOn as fn, IConfigService as pn, Plugin as Cn, merge as yn, registerDependencies as cr, touchDependencies as Vt } from "@univerjs/core";
5
- import { getSheetCommandTarget as Ce, SheetsSelectionsService as $e, RemoveSheetMutation as ur, SetWorksheetActiveOperation as Bt, setEndForRange as dr, SetSelectionsOperation as hr, checkRangesEditablePermission as dt, SheetInterceptorService as Wt, ClearSelectionFormatCommand as vr, ClearSelectionAllCommand as gr, RangeMergeUtil as mr, rangeToDiscreteRange as fr, findAllRectangle as ht, createTopMatrixFromMatrix as vt, SheetPermissionCheckController as pr, WorksheetEditPermission as bn, WorksheetSetCellStylePermission as In, RangeProtectionPermissionEditPoint as Sn, WorkbookEditablePermission as _n, INTERCEPTOR_POINT as Cr, IAutoFillService as yr, AUTO_FILL_APPLY_TYPE as kt, AutoFillTools as br, AFTER_CELL_EDIT as Ir } from "@univerjs/sheets";
6
- import { ConditionalFormattingRuleModel as X, CFSubRuleType as k, CFRuleType as M, AddConditionalRuleMutation as ee, CFNumberOperator as O, getColorScaleFromValue as Sr, iconMap as Te, DEFAULT_BG_COLOR as _r, DEFAULT_FONT_COLOR as wr, defaultDataBarPositiveColor as qe, defaultDataBarNativeColor as Ge, CFValueType as P, createDefaultValueByValueType as Ze, removeUndefinedAttr as Rr, createDefaultValue as gt, CFTextOperator as j, CFTimePeriodOperator as de, iconGroup as Tr, getOppositeOperator as Ht, compareWithNumber as xr, EMPTY_ICON_TYPE as Er, SetCfCommand as Nr, AddCfCommand as wn, SetConditionalRuleMutation as be, DeleteConditionalRuleMutation as Ie, MoveConditionalRuleMutation as Rn, ClearWorksheetCfCommand as Tn, DeleteCfCommand as Yt, MoveCfCommand as Mr, ClearRangeCfCommand as Vr, createDefaultRule as _e, setConditionalRuleMutationUndoFactory as Le, DeleteConditionalRuleMutationUndoFactory as ze, createCfId as kr, AddConditionalRuleMutationUndoFactory as qt, ConditionalFormattingViewModel as et, SHEET_CONDITIONAL_FORMATTING_PLUGIN as tt, ConditionalFormattingService as xn, DEFAULT_PADDING as Fr, DEFAULT_WIDTH as Lr, UniverSheetsConditionalFormattingPlugin as En, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH as Pr } from "@univerjs/sheets-conditional-formatting";
7
- import { useDependency as q, useSidebarClick as wt, ILayoutService as Ur, useScrollYOverContainer as Or, useObservable as $r, ComponentManager as Dr, ISidebarService as Ar, getMenuHiddenObservable as Hr, MenuItemType as jr, RibbonDataGroup as Br, IMenuManagerService as Wr } from "@univerjs/ui";
8
- import { jsx as c, jsxs as F, Fragment as jt } from "react/jsx-runtime";
9
- import { useRef as pe, createElement as ae, forwardRef as le, useMemo as K, useState as N, useEffect as J } from "react";
10
- import { Dropdown as Gt, clsx as Y, ColorPicker as qr, borderClassName as Ne, Select as oe, InputNumber as xe, RadioGroup as Gr, Radio as Kt, Checkbox as mt, Input as Zr, Button as Xt, Tooltip as Jt, DraggableList as zr } from "@univerjs/design";
11
- import { serializeRange as Nn, deserializeRangeWithSheet as Yr } from "@univerjs/engine-formula";
12
- import { FormulaEditor as Rt, RangeSelector as Kr } from "@univerjs/sheets-formula-ui";
13
- import { useHighlightRange as Xr, ISheetClipboardService as Jr, COPY_TYPE as Qt, PREDEFINED_HOOK_NAME_PASTE as Ft, virtualizeDiscreteRanges as Mn, getRepeatRange as Qr, SheetSkeletonManagerService as Vn, IFormatPainterService as ei, FormatPainterStatus as Lt, getCurrentRangeDisable$ as ti } from "@univerjs/sheets-ui";
14
- import { Observable as Fe, debounceTime as ni, merge as kn } from "rxjs";
15
- import { FormulaRefRangeService as ri, UniverSheetsFormulaPlugin as ii } from "@univerjs/sheets-formula";
16
- import { IRenderManagerService as Fn } from "@univerjs/engine-render";
17
- import { bufferTime as oi, filter as en, debounceTime as tn } from "rxjs/operators";
18
- const Ln = {
19
- type: he.COMMAND,
20
- id: "sheet.command.add-average-conditional-rule",
21
- handler(n, e) {
22
- if (!e)
23
- return !1;
24
- const { ranges: t, style: r, stopIfTrue: i, operator: o } = e, s = n.get(X), u = n.get(Q), l = n.get(G), g = Ce(l);
25
- if (!g) return !1;
26
- const { unitId: a, subUnitId: d } = g, h = s.createCfId(a, d), p = {
27
- ranges: t,
28
- cfId: h,
29
- stopIfTrue: !!i,
30
- rule: {
31
- type: M.highlightCell,
32
- subType: k.average,
33
- operator: o,
34
- style: r
35
- }
36
- };
37
- return u.executeCommand(ee.id, { unitId: a, subUnitId: d, rule: p });
38
- }
39
- }, Pn = {
40
- type: he.COMMAND,
41
- id: "sheet.command.add-color-scale-conditional-rule",
42
- handler(n, e) {
43
- if (!e)
44
- return !1;
45
- const { ranges: t, config: r, stopIfTrue: i } = e, o = n.get(X), s = n.get(Q), u = n.get(G), l = Ce(u);
46
- if (!l) return !1;
47
- const { unitId: g, subUnitId: a } = l, d = o.createCfId(g, a), h = {
48
- ranges: t,
49
- cfId: d,
50
- stopIfTrue: !!i,
51
- rule: {
52
- type: M.colorScale,
53
- config: r
54
- }
55
- };
56
- return s.executeCommand(ee.id, { unitId: g, subUnitId: a, rule: h });
57
- }
58
- }, Un = {
59
- type: he.COMMAND,
60
- id: "sheet.command.add-data-bar-conditional-rule",
61
- handler(n, e) {
62
- if (!e)
63
- return !1;
64
- const { ranges: t, min: r, max: i, nativeColor: o, positiveColor: s, isGradient: u, stopIfTrue: l, isShowValue: g } = e, a = n.get(X), d = n.get(G), h = Ce(d);
65
- if (!h) return !1;
66
- const { unitId: p, subUnitId: y } = h, f = n.get(Q), w = a.createCfId(p, y), S = {
67
- ranges: t,
68
- cfId: w,
69
- stopIfTrue: !!l,
70
- rule: {
71
- type: M.dataBar,
72
- isShowValue: g,
73
- config: {
74
- min: r,
75
- max: i,
76
- nativeColor: o,
77
- positiveColor: s,
78
- isGradient: u
79
- }
80
- }
81
- };
82
- return f.executeCommand(ee.id, { unitId: p, subUnitId: y, rule: S });
83
- }
84
- }, On = {
85
- type: he.COMMAND,
86
- id: "sheet.command.add-duplicate-values-conditional-rule",
87
- handler(n, e) {
88
- if (!e)
89
- return !1;
90
- const { ranges: t, style: r, stopIfTrue: i } = e, o = n.get(X), s = n.get(Q), u = n.get(G), l = Ce(u);
91
- if (!l) return !1;
92
- const { unitId: g, subUnitId: a } = l, d = o.createCfId(g, a), h = {
93
- ranges: t,
94
- cfId: d,
95
- stopIfTrue: !!i,
96
- rule: {
97
- type: M.highlightCell,
98
- subType: k.duplicateValues,
99
- style: r
100
- }
101
- };
102
- return s.executeCommand(ee.id, { unitId: g, subUnitId: a, rule: h });
103
- }
104
- }, $n = {
105
- type: he.COMMAND,
106
- id: "sheet.command.add-number-conditional-rule",
107
- handler(n, e) {
108
- if (!e)
109
- return !1;
110
- const { ranges: t, style: r, stopIfTrue: i, operator: o, value: s } = e, u = n.get(X), l = n.get(Q), g = n.get(G), a = Ce(g);
111
- if (!a) return !1;
112
- const { unitId: d, subUnitId: h } = a, p = u.createCfId(d, h);
113
- let y;
114
- if ([O.between, O.notBetween].includes(o)) {
115
- const f = s;
116
- if (f.length !== 2 || !Array.isArray(f))
117
- return !1;
118
- y = {
119
- ranges: t,
120
- cfId: p,
121
- stopIfTrue: !!i,
122
- rule: {
123
- type: M.highlightCell,
124
- subType: k.number,
125
- operator: o,
126
- style: r,
127
- value: f
128
- }
129
- };
130
- } else {
131
- const f = s;
132
- if (typeof f != "number")
133
- return !1;
134
- y = {
135
- ranges: t,
136
- cfId: p,
137
- stopIfTrue: !!i,
138
- rule: {
139
- type: M.highlightCell,
140
- subType: k.number,
141
- operator: o,
142
- style: r,
143
- value: f
144
- }
145
- };
146
- }
147
- return l.executeCommand(ee.id, { unitId: d, subUnitId: h, rule: y });
148
- }
149
- }, Dn = {
150
- type: he.COMMAND,
151
- id: "sheet.command.add-rank-conditional-rule",
152
- handler(n, e) {
153
- if (!e)
154
- return !1;
155
- const { ranges: t, style: r, stopIfTrue: i, isPercent: o, isBottom: s, value: u } = e, l = n.get(X), g = n.get(G), a = n.get(Q), d = Ce(g);
156
- if (!d) return !1;
157
- const { unitId: h, subUnitId: p } = d, y = l.createCfId(h, p), f = {
158
- ranges: t,
159
- cfId: y,
160
- stopIfTrue: !!i,
161
- rule: {
162
- type: M.highlightCell,
163
- subType: k.rank,
164
- isPercent: o,
165
- isBottom: s,
166
- style: r,
167
- value: u
168
- }
169
- };
170
- return a.executeCommand(ee.id, { unitId: h, subUnitId: p, rule: f });
171
- }
172
- }, An = {
173
- type: he.COMMAND,
174
- id: "sheet.command.add-text-conditional-rule",
175
- handler(n, e) {
176
- if (!e)
177
- return !1;
178
- const { ranges: t, style: r, stopIfTrue: i, operator: o, value: s } = e, u = n.get(X), l = n.get(G), g = Ce(l);
179
- if (!g) return !1;
180
- const { unitId: a, subUnitId: d } = g, h = n.get(Q), p = u.createCfId(a, d), y = {
181
- ranges: t,
182
- cfId: p,
183
- stopIfTrue: !!i,
184
- rule: {
185
- type: M.highlightCell,
186
- subType: k.text,
187
- operator: o,
188
- style: r,
189
- value: s
190
- }
191
- };
192
- return h.executeCommand(ee.id, { unitId: a, subUnitId: d, rule: y });
193
- }
194
- }, Hn = {
195
- type: he.COMMAND,
196
- id: "sheet.command.add-time-period-conditional-rule",
197
- handler(n, e) {
198
- if (!e)
199
- return !1;
200
- const { ranges: t, style: r, stopIfTrue: i, operator: o } = e, s = n.get(X), u = n.get(G), l = n.get(Q), g = Ce(u);
201
- if (!g) return !1;
202
- const { unitId: a, subUnitId: d } = g, h = s.createCfId(a, d), p = {
203
- ranges: t,
204
- cfId: h,
205
- stopIfTrue: !!i,
206
- rule: {
207
- type: M.highlightCell,
208
- subType: k.timePeriod,
209
- operator: o,
210
- style: r
211
- }
212
- };
213
- return l.executeCommand(ee.id, { unitId: a, subUnitId: d, rule: p });
214
- }
215
- }, jn = {
216
- type: he.COMMAND,
217
- id: "sheet.command.add-uniqueValues-conditional-rule",
218
- handler(n, e) {
219
- if (!e)
220
- return !1;
221
- const { ranges: t, style: r, stopIfTrue: i } = e, o = n.get(X), s = n.get(G), u = n.get(Q), l = Ce(s);
222
- if (!l) return !1;
223
- const { unitId: g, subUnitId: a } = l, d = o.createCfId(g, a), h = {
224
- ranges: t,
225
- cfId: d,
226
- stopIfTrue: !!i,
227
- rule: {
228
- type: M.highlightCell,
229
- subType: k.uniqueValues,
230
- style: r
231
- }
232
- };
233
- return u.executeCommand(ee.id, { unitId: g, subUnitId: a, rule: h });
234
- }
235
- };
236
- function ce({ ref: n, ...e }) {
237
- const { icon: t, id: r, className: i, extend: o, ...s } = e, u = `univerjs-icon univerjs-icon-${r} ${i || ""}`.trim(), l = pe(`_${li()}`);
238
- return Bn(t, `${r}`, {
239
- defIds: t.defIds,
240
- idSuffix: l.current
241
- }, {
242
- ref: n,
243
- className: u,
244
- ...s
245
- }, o);
246
- }
247
- function Bn(n, e, t, r, i) {
248
- return ae(n.tag, {
249
- key: e,
250
- ...si(n, t, i),
251
- ...r
252
- }, (ai(n, t).children || []).map((o, s) => Bn(o, `${e}-${n.tag}-${s}`, t, void 0, i)));
253
- }
254
- function si(n, e, t) {
255
- const r = { ...n.attrs };
256
- t != null && t.colorChannel1 && r.fill === "colorChannel1" && (r.fill = t.colorChannel1), n.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(([o, s]) => {
257
- o === "mask" && typeof s == "string" && (r[o] = s.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
258
- });
259
- const { defIds: i } = e;
260
- return !i || i.length === 0 || (n.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(([o, s]) => {
261
- typeof s == "string" && (r[o] = s.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
262
- })), r;
263
- }
264
- function ai(n, e) {
265
- var r;
266
- const { defIds: t } = e;
267
- return !t || t.length === 0 ? n : n.tag === "defs" && ((r = n.children) != null && r.length) ? {
268
- ...n,
269
- children: n.children.map((i) => typeof i.attrs.id == "string" && t && t.includes(i.attrs.id) ? {
270
- ...i,
271
- attrs: {
272
- ...i.attrs,
273
- id: i.attrs.id + e.idSuffix
274
- }
275
- } : i)
276
- } : n;
277
- }
278
- function li() {
279
- return Math.random().toString(36).substring(2, 8);
280
- }
281
- ce.displayName = "UniverIcon";
282
- const ci = {
283
- tag: "svg",
284
- attrs: {
285
- xmlns: "http://www.w3.org/2000/svg",
286
- fill: "none",
287
- viewBox: "0 0 16 16",
288
- width: "1em",
289
- height: "1em"
290
- },
291
- children: [{
292
- tag: "path",
293
- attrs: {
294
- fill: "currentColor",
295
- d: "M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z",
296
- fillRule: "evenodd",
297
- clipRule: "evenodd"
298
- }
299
- }]
300
- }, Wn = le(function(e, t) {
301
- return ae(ce, Object.assign({}, e, {
302
- id: "bold-icon",
303
- ref: t,
304
- icon: ci
305
- }));
306
- });
307
- Wn.displayName = "BoldIcon";
308
- const ui = {
309
- tag: "svg",
310
- attrs: {
311
- xmlns: "http://www.w3.org/2000/svg",
312
- fill: "none",
313
- viewBox: "0 0 16 16",
314
- width: "1em",
315
- height: "1em"
316
- },
317
- children: [
318
- {
319
- tag: "path",
320
- attrs: {
321
- fill: "currentColor",
322
- d: "M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"
323
- }
324
- },
325
- {
326
- tag: "path",
327
- attrs: {
328
- fill: "currentColor",
329
- d: "M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"
330
- }
331
- },
332
- {
333
- tag: "path",
334
- attrs: {
335
- fill: "currentColor",
336
- d: "M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z"
337
- }
338
- },
339
- {
340
- tag: "path",
341
- attrs: {
342
- fill: "currentColor",
343
- 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",
344
- fillRule: "evenodd",
345
- clipRule: "evenodd"
346
- }
347
- }
348
- ]
349
- }, ut = le(function(e, t) {
350
- return ae(ce, Object.assign({}, e, {
351
- id: "delete-icon",
352
- ref: t,
353
- icon: ui
354
- }));
355
- });
356
- ut.displayName = "DeleteIcon";
357
- const di = {
358
- tag: "svg",
359
- attrs: {
360
- xmlns: "http://www.w3.org/2000/svg",
361
- fill: "none",
362
- viewBox: "0 0 16 16",
363
- width: "1em",
364
- height: "1em"
365
- },
366
- children: [{
367
- tag: "path",
368
- attrs: {
369
- fill: "currentColor",
370
- d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"
371
- }
372
- }]
373
- }, qn = le(function(e, t) {
374
- return ae(ce, Object.assign({}, e, {
375
- id: "increase-icon",
376
- ref: t,
377
- icon: di
378
- }));
379
- });
380
- qn.displayName = "IncreaseIcon";
381
- const hi = {
382
- tag: "svg",
383
- attrs: {
384
- xmlns: "http://www.w3.org/2000/svg",
385
- fill: "none",
386
- viewBox: "0 0 16 16",
387
- width: "1em",
388
- height: "1em"
389
- },
390
- children: [{
391
- tag: "path",
392
- attrs: {
393
- fill: "currentColor",
394
- d: "M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z"
395
- }
396
- }]
397
- }, Gn = le(function(e, t) {
398
- return ae(ce, Object.assign({}, e, {
399
- id: "italic-icon",
400
- ref: t,
401
- icon: hi
402
- }));
403
- });
404
- Gn.displayName = "ItalicIcon";
405
- const vi = {
406
- tag: "svg",
407
- attrs: {
408
- xmlns: "http://www.w3.org/2000/svg",
409
- fill: "none",
410
- viewBox: "0 0 16 16",
411
- width: "1em",
412
- height: "1em"
413
- },
414
- children: [{
415
- tag: "path",
416
- attrs: {
417
- fill: "currentColor",
418
- 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",
419
- fillRule: "evenodd",
420
- clipRule: "evenodd"
421
- }
422
- }]
423
- }, Zt = le(function(e, t) {
424
- return ae(ce, Object.assign({}, e, {
425
- id: "more-down-icon",
426
- ref: t,
427
- icon: vi
428
- }));
429
- });
430
- Zt.displayName = "MoreDownIcon";
431
- const gi = {
432
- tag: "svg",
433
- attrs: {
434
- xmlns: "http://www.w3.org/2000/svg",
435
- fill: "none",
436
- viewBox: "0 0 16 16",
437
- width: "1em",
438
- height: "1em"
439
- },
440
- children: [
441
- {
442
- tag: "path",
443
- attrs: {
444
- fill: "currentColor",
445
- d: "M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"
446
- }
447
- },
448
- {
449
- tag: "path",
450
- attrs: {
451
- fill: "currentColor",
452
- d: "M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"
453
- }
454
- },
455
- {
456
- tag: "path",
457
- attrs: {
458
- fill: "currentColor",
459
- d: "M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"
460
- }
461
- },
462
- {
463
- tag: "path",
464
- attrs: {
465
- fill: "currentColor",
466
- d: "M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"
467
- }
468
- },
469
- {
470
- tag: "path",
471
- attrs: {
472
- fill: "currentColor",
473
- d: "M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"
474
- }
475
- },
476
- {
477
- tag: "path",
478
- attrs: {
479
- fill: "currentColor",
480
- d: "M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"
481
- }
482
- }
483
- ]
484
- }, Zn = le(function(e, t) {
485
- return ae(ce, Object.assign({}, e, {
486
- id: "sequence-icon",
487
- ref: t,
488
- icon: gi
489
- }));
490
- });
491
- Zn.displayName = "SequenceIcon";
492
- const mi = {
493
- tag: "svg",
494
- attrs: {
495
- xmlns: "http://www.w3.org/2000/svg",
496
- fill: "none",
497
- viewBox: "0 0 16 16",
498
- width: "1em",
499
- height: "1em"
500
- },
501
- children: [{
502
- tag: "path",
503
- attrs: {
504
- fill: "currentColor",
505
- d: "M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z"
506
- }
507
- }, {
508
- tag: "path",
509
- attrs: {
510
- fill: "currentColor",
511
- d: "M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z"
512
- }
513
- }]
514
- }, zn = le(function(e, t) {
515
- return ae(ce, Object.assign({}, e, {
516
- id: "strikethrough-icon",
517
- ref: t,
518
- icon: mi
519
- }));
520
- });
521
- zn.displayName = "StrikethroughIcon";
522
- const fi = {
523
- tag: "svg",
524
- attrs: {
525
- xmlns: "http://www.w3.org/2000/svg",
526
- fill: "none",
527
- viewBox: "0 0 16 16",
528
- width: "1em",
529
- height: "1em"
530
- },
531
- children: [{
532
- tag: "path",
533
- attrs: {
534
- fill: "currentColor",
535
- d: "M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z"
536
- }
537
- }, {
538
- tag: "path",
539
- attrs: {
540
- fill: "currentColor",
541
- d: "M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z"
542
- }
543
- }]
544
- }, Yn = le(function(e, t) {
545
- return ae(ce, Object.assign({}, e, {
546
- id: "underline-icon",
547
- ref: t,
548
- icon: fi
549
- }));
550
- });
551
- Yn.displayName = "UnderlineIcon";
552
- const pi = {
553
- tag: "svg",
554
- attrs: {
555
- xmlns: "http://www.w3.org/2000/svg",
556
- fill: "none",
557
- viewBox: "0 0 17 16",
558
- width: "1em",
559
- height: "1em"
560
- },
561
- children: [{
562
- tag: "path",
563
- attrs: {
564
- fill: "colorChannel1",
565
- 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"
566
- }
567
- }, {
568
- tag: "path",
569
- attrs: {
570
- fill: "currentColor",
571
- d: "M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z",
572
- fillRule: "evenodd",
573
- clipRule: "evenodd"
574
- }
575
- }]
576
- }, Kn = le(function(e, t) {
577
- return ae(ce, Object.assign({}, e, {
578
- id: "font-color-double-icon",
579
- ref: t,
580
- icon: pi
581
- }));
582
- });
583
- Kn.displayName = "FontColorDoubleIcon";
584
- const Ci = {
585
- tag: "svg",
586
- attrs: {
587
- xmlns: "http://www.w3.org/2000/svg",
588
- fill: "none",
589
- viewBox: "0 0 17 16",
590
- width: "1em",
591
- height: "1em"
592
- },
593
- children: [
594
- {
595
- tag: "path",
596
- attrs: {
597
- fill: "currentColor",
598
- 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",
599
- fillRule: "evenodd",
600
- clipRule: "evenodd"
601
- }
602
- },
603
- {
604
- tag: "path",
605
- attrs: {
606
- fill: "currentColor",
607
- 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"
608
- }
609
- },
610
- {
611
- tag: "path",
612
- attrs: {
613
- fill: "colorChannel1",
614
- 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"
615
- }
616
- }
617
- ]
618
- }, Xn = le(function(e, t) {
619
- return ae(ce, Object.assign({}, e, {
620
- id: "paint-bucket-double-icon",
621
- ref: t,
622
- icon: Ci
623
- }));
624
- });
625
- Xn.displayName = "PaintBucketDoubleIcon";
626
- const yi = {
627
- tag: "svg",
628
- attrs: {
629
- xmlns: "http://www.w3.org/2000/svg",
630
- fill: "none",
631
- viewBox: "0 0 17 17",
632
- width: "1em",
633
- height: "1em"
634
- },
635
- children: [{
636
- tag: "path",
637
- attrs: {
638
- fill: "currentColor",
639
- d: "M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z",
640
- fillRule: "evenodd",
641
- clipRule: "evenodd"
642
- }
643
- }, {
644
- tag: "path",
645
- attrs: {
646
- fill: "colorChannel1",
647
- d: "M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z",
648
- fillRule: "evenodd",
649
- clipRule: "evenodd"
650
- }
651
- }]
652
- }, nt = le(function(e, t) {
653
- return ae(ce, Object.assign({}, e, {
654
- id: "slash-double-icon",
655
- ref: t,
656
- icon: yi
657
- }));
658
- });
659
- nt.displayName = "SlashDoubleIcon";
660
- const Ee = (n) => {
661
- const { color: e, onChange: t, disable: r = !1, Icon: i = Xn, className: o } = n, s = K(() => new vn(e), [e]), u = () => {
662
- const l = {
663
- className: Y("univer-fill-primary-600", r && o),
664
- extend: { colorChannel1: s.isValid ? e : "" }
665
- };
666
- return /* @__PURE__ */ c(i, { ...l });
667
- };
668
- return r ? u() : /* @__PURE__ */ c(
669
- Gt,
670
- {
671
- overlay: /* @__PURE__ */ c("div", { className: "univer-rounded-lg univer-p-4", children: /* @__PURE__ */ c(qr, { value: e, onChange: t }) }),
672
- children: /* @__PURE__ */ c(
673
- "span",
674
- {
675
- className: Y("univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", o),
676
- children: u()
677
- }
678
- )
679
- }
680
- );
681
- }, De = (n) => {
682
- var o, s, u, l, g;
683
- const e = n.rule;
684
- if (!e) return null;
685
- const t = K(() => {
686
- if (e.type === M.colorScale) {
687
- const a = e.config.map((p, y) => ({ color: new vn(p.color), value: y })), d = a.length - 1;
688
- return new Array(5).fill("").map((p, y, f) => y * d / (f.length - 1)).map((p) => Sr(a, p));
689
- }
690
- return null;
691
- }, [e]), r = K(() => {
692
- if (e.type === M.iconSet)
693
- return e.config.map((a) => {
694
- const d = Te[a.iconType];
695
- return d && d[Number(a.iconId)];
696
- });
697
- }, [e]), i = "univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";
698
- switch (e.type) {
699
- case M.dataBar: {
700
- const { isGradient: a } = e.config, d = a ? `linear-gradient(to right, ${e.config.positiveColor || qe}, rgb(255 255 255))` : e.config.positiveColor, h = a ? `linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor || Ge})` : e.config.nativeColor;
701
- return /* @__PURE__ */ F("div", { className: i, children: [
702
- /* @__PURE__ */ c(
703
- "div",
704
- {
705
- className: "univer-h-full univer-w-1/2 univer-border univer-border-solid",
706
- style: {
707
- background: h,
708
- borderColor: (o = e.config.nativeColor) != null ? o : Ge
709
- }
710
- }
711
- ),
712
- /* @__PURE__ */ c(
713
- "div",
714
- {
715
- className: "univer-h-full univer-w-1/2 univer-border univer-border-solid",
716
- style: {
717
- background: d,
718
- borderColor: (s = e.config.positiveColor) != null ? s : qe
719
- }
720
- }
721
- )
722
- ] });
723
- }
724
- case M.colorScale:
725
- return t && /* @__PURE__ */ c("div", { className: i, children: t.map((a, d) => /* @__PURE__ */ c(
726
- "div",
727
- {
728
- className: "univer-h-full",
729
- style: { width: `${100 / t.length}%`, background: a }
730
- },
731
- d
732
- )) });
733
- case M.iconSet:
734
- return r && /* @__PURE__ */ c("div", { className: i, children: r.map((a, d) => a ? /* @__PURE__ */ c("img", { className: "univer-h-full", src: a, draggable: !1 }, d) : /* @__PURE__ */ c(nt, {}, d)) });
735
- case M.highlightCell: {
736
- const { ul: a, st: d, it: h, bl: p, bg: y, cl: f } = e.style, w = (a == null ? void 0 : a.s) === ie.TRUE, S = (d == null ? void 0 : d.s) === ie.TRUE, R = h === ie.TRUE, x = p === ie.TRUE, T = (u = y == null ? void 0 : y.rgb) != null ? u : _r, v = (l = f == null ? void 0 : f.rgb) != null ? l : wr, b = {
737
- textDecoration: (g = `${w ? "underline" : ""} ${S ? "line-through" : ""}`.replace(/^ /, "")) != null ? g : void 0,
738
- backgroundColor: T,
739
- color: v
740
- };
741
- return /* @__PURE__ */ c(
742
- "div",
743
- {
744
- className: Y(i, {
745
- "univer-font-bold": x,
746
- "univer-italic": R
747
- }),
748
- style: b,
749
- children: "123"
750
- }
751
- );
752
- }
753
- }
754
- }, rt = Y("univer-mt-5 univer-px-1 univer-py-2 univer-rounded", Ne), we = (n, e) => ({ label: e.t(`sheet.cf.valueType.${n}`), value: n }), Pt = (n) => {
755
- var y;
756
- const { type: e, className: t, onChange: r, id: i, value: o } = n, s = q(G), u = s.getCurrentUnitForType(H.UNIVER_SHEET).getUnitId(), l = (y = s.getCurrentUnitForType(H.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : y.getSheetId(), g = K(() => String(o).startsWith("=") ? String(o) : "=", [o]), a = K(() => [P.max, P.min, "none"].includes(e) ? { disabled: !0 } : [P.percent, P.percentile].includes(e) ? {
757
- min: 0,
758
- max: 100
759
- } : {
760
- min: Number.MIN_SAFE_INTEGER,
761
- max: Number.MAX_SAFE_INTEGER
762
- }, [e]), d = pe(null), [h, p] = N(!1);
763
- return wt((f) => {
764
- var S;
765
- (S = d.current) != null && S.isClickOutSide(f) && p(!1);
766
- }), e === P.formula ? /* @__PURE__ */ c("div", { className: "univer-ml-1 univer-w-full", children: /* @__PURE__ */ c(
767
- Rt,
768
- {
769
- ref: d,
770
- className: Y("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", Ne),
771
- initValue: g,
772
- unitId: u,
773
- subUnitId: l,
774
- isFocus: h,
775
- onChange: (f = "") => {
776
- r(f || "");
777
- },
778
- onFocus: () => p(!0)
779
- }
780
- ) }) : /* @__PURE__ */ c(xe, { className: t, value: Number(n.value) || 0, onChange: (f) => n.onChange(f || 0), ...a });
781
- }, bi = (n) => {
782
- var D;
783
- const { interceptorManager: e } = n, t = q(te), r = ((D = n.rule) == null ? void 0 : D.type) === M.colorScale ? n.rule : void 0, i = [we(P.num, t), we(P.percent, t), we(P.percentile, t), we(P.formula, t)], o = [we(P.min, t), ...i], s = [we("none", t), ...i], u = [we(P.max, t), ...i], [l, g] = N(() => {
784
- var _;
785
- const m = P.min;
786
- return r && ((_ = r.config[0]) == null ? void 0 : _.value.type) || m;
787
- }), [a, d] = N(() => {
788
- var _;
789
- const m = "none";
790
- return !r || r.config.length !== 3 ? m : ((_ = r.config[1]) == null ? void 0 : _.value.type) || m;
791
- }), [h, p] = N(() => {
792
- var _;
793
- const m = P.max;
794
- return r && ((_ = r.config[r.config.length - 1]) == null ? void 0 : _.value.type) || m;
795
- }), [y, f] = N(() => {
796
- if (!r)
797
- return 10;
798
- const _ = r.config[0];
799
- return (_ == null ? void 0 : _.value.value) === void 0 ? 10 : _ == null ? void 0 : _.value.value;
800
- }), [w, S] = N(() => {
801
- var B;
802
- if (!r || r.config.length !== 3)
803
- return 50;
804
- const _ = (B = r.config[1]) == null ? void 0 : B.value.value;
805
- return _ === void 0 ? 50 : _;
806
- }), [R, x] = N(() => {
807
- var B;
808
- if (!r)
809
- return 90;
810
- const _ = (B = r.config[r.config.length - 1]) == null ? void 0 : B.value.value;
811
- return _ === void 0 ? 90 : _;
812
- }), [T, v] = N(() => {
813
- var _;
814
- const m = "#d0d9fb";
815
- return r && ((_ = r.config[0]) == null ? void 0 : _.color) || m;
816
- }), [b, I] = N(() => {
817
- var _;
818
- const m = "#7790f3";
819
- return !r || r.config.length !== 3 ? m : ((_ = r.config[1]) == null ? void 0 : _.color) || m;
820
- }), [C, V] = N(() => {
821
- var _;
822
- const m = "#2e55ef";
823
- return r && ((_ = r.config[r.config.length - 1]) == null ? void 0 : _.color) || m;
824
- }), E = K(() => (m) => {
825
- const { minType: _, medianType: B, maxType: L, minValue: A, medianValue: Z, maxValue: z, minColor: ne, medianColor: ye, maxColor: Se } = m, ue = [];
826
- return ue.push({ color: ne, value: { type: _, value: A } }), B !== "none" && ue.push({ color: ye, value: { type: B, value: Z } }), ue.push({ color: Se, value: { type: L, value: z } }), { config: ue.map((it, ot) => ({ ...it, index: ot })), type: M.colorScale };
827
- }, []);
828
- J(() => e.intercept(e.getInterceptPoints().submit, {
829
- handler() {
830
- return E({ minType: l, medianType: a, maxType: h, minValue: y, medianValue: w, maxValue: R, minColor: T, medianColor: b, maxColor: C });
831
- }
832
- }), [E, l, a, h, y, w, R, T, b, C, e]);
833
- const U = (m) => {
834
- n.onChange(E(m));
835
- };
836
- return /* @__PURE__ */ F("div", { children: [
837
- /* @__PURE__ */ c(
838
- "div",
839
- {
840
- className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
841
- children: t.t("sheet.cf.panel.styleRule")
842
- }
843
- ),
844
- /* @__PURE__ */ c("div", { className: rt, children: /* @__PURE__ */ c(De, { rule: E({ minType: l, medianType: a, maxType: h, minValue: y, medianValue: w, maxValue: R, minColor: T, medianColor: b, maxColor: C }) }) }),
845
- /* @__PURE__ */ c(
846
- "div",
847
- {
848
- className: "univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",
849
- children: t.t("sheet.cf.valueType.min")
850
- }
851
- ),
852
- /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-h-8 univer-items-center", children: [
853
- /* @__PURE__ */ c(
854
- oe,
855
- {
856
- className: "univer-flex-shrink-0",
857
- options: o,
858
- value: l,
859
- onChange: (m) => {
860
- g(m);
861
- const _ = Ze(m, 10);
862
- f(_), U({
863
- minType: m,
864
- medianType: a,
865
- maxType: h,
866
- minValue: _,
867
- medianValue: w,
868
- maxValue: R,
869
- minColor: T,
870
- medianColor: b,
871
- maxColor: C
872
- });
873
- }
874
- }
875
- ),
876
- /* @__PURE__ */ c(
877
- Pt,
878
- {
879
- id: "min",
880
- className: "univer-ml-1",
881
- value: y,
882
- type: l,
883
- onChange: (m) => {
884
- f(m), U({
885
- minType: l,
886
- medianType: a,
887
- maxType: h,
888
- minValue: m,
889
- medianValue: w,
890
- maxValue: R,
891
- minColor: T,
892
- medianColor: b,
893
- maxColor: C
894
- });
895
- }
896
- }
897
- ),
898
- /* @__PURE__ */ c(
899
- Ee,
900
- {
901
- className: "univer-ml-1",
902
- color: T,
903
- onChange: (m) => {
904
- v(m), U({
905
- minType: l,
906
- medianType: a,
907
- maxType: h,
908
- minValue: y,
909
- medianValue: w,
910
- maxValue: R,
911
- minColor: m,
912
- medianColor: b,
913
- maxColor: C
914
- });
915
- }
916
- }
917
- )
918
- ] }),
919
- /* @__PURE__ */ c(
920
- "div",
921
- {
922
- className: "univer-text-gray-600dark:!univer-text-gray-200 univer-mt-3 univer-text-xs",
923
- children: t.t("sheet.cf.panel.medianValue")
924
- }
925
- ),
926
- /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-h-8 univer-items-center", children: [
927
- /* @__PURE__ */ c(
928
- oe,
929
- {
930
- className: "univer-flex-shrink-0",
931
- options: s,
932
- value: a,
933
- onChange: (m) => {
934
- d(m);
935
- const _ = Ze(m, 50);
936
- S(_), U({
937
- minType: l,
938
- medianType: m,
939
- maxType: h,
940
- minValue: y,
941
- medianValue: _,
942
- maxValue: R,
943
- minColor: T,
944
- medianColor: b,
945
- maxColor: C
946
- });
947
- }
948
- }
949
- ),
950
- /* @__PURE__ */ c(
951
- Pt,
952
- {
953
- id: "median",
954
- className: "univer-ml-1",
955
- value: w,
956
- type: a,
957
- onChange: (m) => {
958
- S(m), U({
959
- minType: l,
960
- medianType: a,
961
- maxType: h,
962
- minValue: y,
963
- medianValue: m,
964
- maxValue: R,
965
- minColor: T,
966
- medianColor: b,
967
- maxColor: C
968
- });
969
- }
970
- }
971
- ),
972
- a !== "none" && /* @__PURE__ */ c(
973
- Ee,
974
- {
975
- className: "univer-ml-1",
976
- color: b,
977
- onChange: (m) => {
978
- I(m), U({
979
- minType: l,
980
- medianType: a,
981
- maxType: h,
982
- minValue: y,
983
- medianValue: w,
984
- maxValue: R,
985
- minColor: T,
986
- medianColor: m,
987
- maxColor: C
988
- });
989
- }
990
- }
991
- )
992
- ] }),
993
- /* @__PURE__ */ c(
994
- "div",
995
- {
996
- className: "univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",
997
- children: t.t("sheet.cf.valueType.max")
998
- }
999
- ),
1000
- /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-h-8 univer-items-center", children: [
1001
- /* @__PURE__ */ c(
1002
- oe,
1003
- {
1004
- className: "univer-flex-shrink-0",
1005
- options: u,
1006
- value: h,
1007
- onChange: (m) => {
1008
- p(m);
1009
- const _ = Ze(m, 90);
1010
- x(_), U({
1011
- minType: l,
1012
- medianType: a,
1013
- maxType: m,
1014
- minValue: y,
1015
- medianValue: w,
1016
- maxValue: _,
1017
- minColor: T,
1018
- medianColor: b,
1019
- maxColor: C
1020
- });
1021
- }
1022
- }
1023
- ),
1024
- /* @__PURE__ */ c(
1025
- Pt,
1026
- {
1027
- id: "max",
1028
- className: "univer-ml-1",
1029
- value: R,
1030
- type: h,
1031
- onChange: (m) => {
1032
- x(m), U({
1033
- minType: l,
1034
- medianType: a,
1035
- maxType: h,
1036
- minValue: y,
1037
- medianValue: w,
1038
- maxValue: m,
1039
- minColor: T,
1040
- medianColor: b,
1041
- maxColor: C
1042
- });
1043
- }
1044
- }
1045
- ),
1046
- /* @__PURE__ */ c(
1047
- Ee,
1048
- {
1049
- className: "univer-ml-1",
1050
- color: C,
1051
- onChange: (m) => {
1052
- V(m), U({
1053
- minType: l,
1054
- medianType: a,
1055
- maxType: h,
1056
- minValue: y,
1057
- medianValue: w,
1058
- maxValue: R,
1059
- minColor: T,
1060
- medianColor: b,
1061
- maxColor: m
1062
- });
1063
- }
1064
- }
1065
- )
1066
- ] })
1067
- ] });
1068
- }, Me = (n, e) => ({ label: e.t(`sheet.cf.valueType.${n}`), value: n }), nn = (n) => {
1069
- var f;
1070
- const { onChange: e, className: t, value: r, type: i, id: o, disabled: s = !1 } = n, u = q(G), l = u.getCurrentUnitOfType(H.UNIVER_SHEET).getUnitId(), g = (f = u.getCurrentUnitOfType(H.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : f.getSheetId(), a = pe(null), [d, h] = N(!1);
1071
- wt((w) => {
1072
- var R;
1073
- (R = a.current) != null && R.isClickOutSide(w) && h(!1);
1074
- });
1075
- const p = pe(r), y = K(() => [P.percentile, P.percent].includes(i) ? {
1076
- max: 100,
1077
- min: 0
1078
- } : {
1079
- min: Number.MIN_SAFE_INTEGER,
1080
- max: Number.MAX_SAFE_INTEGER
1081
- }, [i]);
1082
- if (i === P.formula) {
1083
- const w = String(p.current).startsWith("=") ? String(p.current) || "" : "=";
1084
- return /* @__PURE__ */ c("div", { className: "univer-ml-3 univer-w-full", children: /* @__PURE__ */ c(
1085
- Rt,
1086
- {
1087
- ref: a,
1088
- className: Y("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", Ne),
1089
- initValue: w,
1090
- unitId: l,
1091
- subUnitId: g,
1092
- isFocus: d,
1093
- onChange: (S = "") => {
1094
- e(S || "");
1095
- },
1096
- onFocus: () => h(!0)
1097
- }
1098
- ) });
1099
- }
1100
- return /* @__PURE__ */ c(
1101
- xe,
1102
- {
1103
- className: t,
1104
- value: Number(r) || 0,
1105
- disabled: s,
1106
- onChange: (w) => {
1107
- e(w || 0);
1108
- },
1109
- ...y
1110
- }
1111
- );
1112
- }, Ii = (n) => {
1113
- var D;
1114
- const { interceptorManager: e } = n, t = q(te), r = ((D = n.rule) == null ? void 0 : D.type) === M.dataBar ? n.rule : void 0, [i, o] = N(() => {
1115
- var _;
1116
- return r && (_ = r.config) != null && _.isGradient ? "1" : "0";
1117
- }), [s, u] = N(() => {
1118
- var m;
1119
- return r ? ((m = r.config) == null ? void 0 : m.positiveColor) || qe : qe;
1120
- }), [l, g] = N(() => {
1121
- var m;
1122
- return r ? ((m = r.config) == null ? void 0 : m.nativeColor) || Ge : Ge;
1123
- }), a = [
1124
- Me(P.num, t),
1125
- Me(P.percent, t),
1126
- Me(P.percentile, t),
1127
- Me(P.formula, t)
1128
- ], d = [Me(P.min, t), ...a], h = [Me(P.max, t), ...a], [p, y] = N(() => {
1129
- var _;
1130
- const m = d[0].value;
1131
- return r && ((_ = r.config) == null ? void 0 : _.min.type) || m;
1132
- }), [f, w] = N(() => {
1133
- var _;
1134
- const m = h[0].value;
1135
- return r && ((_ = r.config) == null ? void 0 : _.max.type) || m;
1136
- }), [S, R] = N(() => {
1137
- var B;
1138
- if (!r)
1139
- return 0;
1140
- const _ = ((B = r.config) == null ? void 0 : B.min) || {};
1141
- return _.type === P.formula ? _.value || "=" : _.value || 0;
1142
- }), [x, T] = N(() => {
1143
- var B;
1144
- if (!r)
1145
- return 100;
1146
- const _ = ((B = r.config) == null ? void 0 : B.max) || {};
1147
- return _.type === P.formula ? _.value || "=" : _.value === void 0 ? 100 : _.value;
1148
- }), [v, b] = N(() => r ? r.isShowValue === void 0 ? !0 : !!r.isShowValue : !0), I = (m) => ({ config: {
1149
- min: { type: m.minValueType, value: m.minValue },
1150
- max: { type: m.maxValueType, value: m.maxValue },
1151
- isGradient: m.isGradient === "1",
1152
- positiveColor: m.positiveColor || qe,
1153
- nativeColor: m.nativeColor || Ge
1154
- }, type: M.dataBar, isShowValue: m.isShowValue });
1155
- J(() => e.intercept(e.getInterceptPoints().submit, {
1156
- handler() {
1157
- return I({ isGradient: i, minValue: S, minValueType: p, maxValue: x, maxValueType: f, positiveColor: s, nativeColor: l, isShowValue: v });
1158
- }
1159
- }), [i, S, p, x, f, s, l, e, v]);
1160
- const C = (m) => {
1161
- n.onChange(I(m));
1162
- }, V = (m) => {
1163
- u(m), C({
1164
- isGradient: i,
1165
- minValue: S,
1166
- minValueType: p,
1167
- maxValue: x,
1168
- maxValueType: f,
1169
- positiveColor: m,
1170
- nativeColor: l,
1171
- isShowValue: v
1172
- });
1173
- }, E = (m) => {
1174
- g(m), C({
1175
- isGradient: i,
1176
- minValue: S,
1177
- minValueType: p,
1178
- maxValue: x,
1179
- maxValueType: f,
1180
- positiveColor: s,
1181
- nativeColor: m,
1182
- isShowValue: v
1183
- });
1184
- }, U = (m) => a.map((_) => _.value).includes(m);
1185
- return /* @__PURE__ */ F("div", { children: [
1186
- /* @__PURE__ */ c(
1187
- "div",
1188
- {
1189
- className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1190
- children: t.t("sheet.cf.panel.styleRule")
1191
- }
1192
- ),
1193
- /* @__PURE__ */ c("div", { className: rt, children: /* @__PURE__ */ c(
1194
- De,
1195
- {
1196
- rule: I({
1197
- isGradient: i,
1198
- minValue: S,
1199
- minValueType: p,
1200
- maxValue: x,
1201
- maxValueType: f,
1202
- positiveColor: s,
1203
- nativeColor: l,
1204
- isShowValue: v
1205
- })
1206
- }
1207
- ) }),
1208
- /* @__PURE__ */ F("div", { children: [
1209
- /* @__PURE__ */ c(
1210
- "div",
1211
- {
1212
- className: "univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1213
- children: t.t("sheet.cf.panel.fillType")
1214
- }
1215
- ),
1216
- /* @__PURE__ */ F("div", { className: "univer-ml-1 univer-mt-3 univer-flex univer-items-center", children: [
1217
- /* @__PURE__ */ F(
1218
- Gr,
1219
- {
1220
- value: i,
1221
- onChange: (m) => {
1222
- o(m), C({
1223
- isGradient: m,
1224
- minValue: S,
1225
- minValueType: p,
1226
- maxValue: x,
1227
- maxValueType: f,
1228
- positiveColor: s,
1229
- nativeColor: l,
1230
- isShowValue: v
1231
- });
1232
- },
1233
- children: [
1234
- /* @__PURE__ */ c(Kt, { value: "0", children: /* @__PURE__ */ c("span", { className: "univer-text-xs", children: t.t("sheet.cf.panel.pureColor") }) }),
1235
- /* @__PURE__ */ c(Kt, { value: "1", children: /* @__PURE__ */ c("span", { className: "univer-text-xs", children: t.t("sheet.cf.panel.gradient") }) })
1236
- ]
1237
- }
1238
- ),
1239
- /* @__PURE__ */ F("div", { className: "univer-ml-6 univer-flex univer-items-center univer-text-xs", children: [
1240
- /* @__PURE__ */ c(
1241
- mt,
1242
- {
1243
- checked: !v,
1244
- onChange: (m) => {
1245
- b(!m), C({
1246
- isGradient: m,
1247
- minValue: S,
1248
- minValueType: p,
1249
- maxValue: x,
1250
- maxValueType: f,
1251
- positiveColor: s,
1252
- nativeColor: l,
1253
- isShowValue: !m
1254
- });
1255
- }
1256
- }
1257
- ),
1258
- t.t("sheet.cf.panel.onlyShowDataBar")
1259
- ] })
1260
- ] })
1261
- ] }),
1262
- /* @__PURE__ */ F("div", { children: [
1263
- /* @__PURE__ */ c(
1264
- "div",
1265
- {
1266
- className: "univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1267
- children: t.t("sheet.cf.panel.colorSet")
1268
- }
1269
- ),
1270
- /* @__PURE__ */ F("div", { className: "univer-ml-1 univer-mt-3 univer-flex univer-items-center", children: [
1271
- /* @__PURE__ */ F("div", { className: "univer-flex univer-items-center", children: [
1272
- /* @__PURE__ */ c("div", { className: "univer-text-xs", children: t.t("sheet.cf.panel.native") }),
1273
- /* @__PURE__ */ c(
1274
- Ee,
1275
- {
1276
- color: l,
1277
- onChange: E
1278
- }
1279
- )
1280
- ] }),
1281
- /* @__PURE__ */ F("div", { className: "univer-ml-3 univer-flex univer-items-center", children: [
1282
- /* @__PURE__ */ c("div", { className: "univer-text-xs", children: t.t("sheet.cf.panel.positive") }),
1283
- /* @__PURE__ */ c(
1284
- Ee,
1285
- {
1286
- color: s,
1287
- onChange: V
1288
- }
1289
- )
1290
- ] })
1291
- ] })
1292
- ] }),
1293
- /* @__PURE__ */ F("div", { children: [
1294
- /* @__PURE__ */ c(
1295
- "div",
1296
- {
1297
- className: "univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1298
- children: t.t("sheet.cf.valueType.min")
1299
- }
1300
- ),
1301
- /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-items-center", children: [
1302
- /* @__PURE__ */ c(
1303
- oe,
1304
- {
1305
- className: "univer-w-1/2 univer-flex-shrink-0",
1306
- options: d,
1307
- value: p,
1308
- onChange: (m) => {
1309
- y(m);
1310
- const _ = Ze(m, 10);
1311
- R(_), C({
1312
- isGradient: i,
1313
- minValue: _,
1314
- minValueType: m,
1315
- maxValue: x,
1316
- maxValueType: f,
1317
- positiveColor: s,
1318
- nativeColor: l,
1319
- isShowValue: v
1320
- });
1321
- }
1322
- }
1323
- ),
1324
- /* @__PURE__ */ c(
1325
- nn,
1326
- {
1327
- id: "min",
1328
- className: "univer-ml-3",
1329
- disabled: !U(p),
1330
- type: p,
1331
- value: S,
1332
- onChange: (m) => {
1333
- R(m || 0), C({
1334
- isGradient: i,
1335
- minValue: m || 0,
1336
- minValueType: p,
1337
- maxValue: x,
1338
- maxValueType: f,
1339
- positiveColor: s,
1340
- nativeColor: l,
1341
- isShowValue: v
1342
- });
1343
- }
1344
- }
1345
- )
1346
- ] }),
1347
- /* @__PURE__ */ c(
1348
- "div",
1349
- {
1350
- className: "univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1351
- children: t.t("sheet.cf.valueType.max")
1352
- }
1353
- ),
1354
- /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-items-center", children: [
1355
- /* @__PURE__ */ c(
1356
- oe,
1357
- {
1358
- className: "univer-w-1/2 univer-flex-shrink-0",
1359
- options: h,
1360
- value: f,
1361
- onChange: (m) => {
1362
- w(m);
1363
- const _ = Ze(m, 90);
1364
- T(_), C({
1365
- isGradient: i,
1366
- minValue: S,
1367
- minValueType: p,
1368
- maxValue: _,
1369
- maxValueType: m,
1370
- positiveColor: s,
1371
- nativeColor: l,
1372
- isShowValue: v
1373
- });
1374
- }
1375
- }
1376
- ),
1377
- /* @__PURE__ */ c(
1378
- nn,
1379
- {
1380
- className: "univer-ml-3",
1381
- disabled: !U(f),
1382
- id: "max",
1383
- type: f,
1384
- value: x,
1385
- onChange: (m) => {
1386
- T(m || 0), C({
1387
- isGradient: i,
1388
- minValue: S,
1389
- minValueType: p,
1390
- maxValue: m || 0,
1391
- maxValueType: f,
1392
- positiveColor: s,
1393
- nativeColor: l,
1394
- isShowValue: v
1395
- });
1396
- }
1397
- }
1398
- )
1399
- ] })
1400
- ] })
1401
- ] });
1402
- }, st = (n) => [ie.FALSE, void 0].includes(n) ? ie.TRUE : ie.FALSE, at = (n) => n !== ie.FALSE, zt = (n) => {
1403
- const { style: e, onChange: t, className: r } = n, [i, o] = N(() => {
1404
- if (e != null && e.bl)
1405
- return e.bl;
1406
- }), [s, u] = N(() => {
1407
- if (e != null && e.it)
1408
- return e.it;
1409
- }), [l, g] = N(() => {
1410
- if (e != null && e.ul)
1411
- return e.ul.s;
1412
- }), [a, d] = N(() => {
1413
- if (e != null && e.st)
1414
- return e.st.s;
1415
- }), [h, p] = N(() => {
1416
- var R;
1417
- const S = "#2f56ef";
1418
- return (R = e == null ? void 0 : e.cl) != null && R.rgb ? e.cl.rgb : S;
1419
- }), [y, f] = N(() => {
1420
- var R;
1421
- const S = "#e8ecfc";
1422
- return (R = e == null ? void 0 : e.bg) != null && R.rgb ? e.bg.rgb : S;
1423
- });
1424
- J(() => {
1425
- const S = {
1426
- bl: i,
1427
- it: s
1428
- };
1429
- h !== void 0 && (S.cl = { rgb: h }), y !== void 0 && (S.bg = { rgb: y }), a !== void 0 && (S.st = { s: a }), l !== void 0 && (S.ul = { s: l }), t(Rr(S));
1430
- }, [i, s, l, a, h, y]);
1431
- const w = "univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";
1432
- return /* @__PURE__ */ F("div", { className: Y("univer-my-2.5 univer-flex univer-justify-between", r), children: [
1433
- /* @__PURE__ */ c(
1434
- "div",
1435
- {
1436
- className: Y(w, {
1437
- "univer-bg-gray-100 dark:!univer-bg-gray-700": at(i || ie.FALSE)
1438
- }),
1439
- onClick: () => o(st(i)),
1440
- children: /* @__PURE__ */ c(Wn, {})
1441
- }
1442
- ),
1443
- /* @__PURE__ */ c(
1444
- "div",
1445
- {
1446
- className: Y(w, {
1447
- "univer-bg-gray-100 dark:!univer-bg-gray-700": at(s || ie.FALSE)
1448
- }),
1449
- onClick: () => u(st(s)),
1450
- children: /* @__PURE__ */ c(Gn, {})
1451
- }
1452
- ),
1453
- /* @__PURE__ */ c(
1454
- "div",
1455
- {
1456
- className: Y(w, {
1457
- "univer-bg-gray-100 dark:!univer-bg-gray-700": at(l || ie.FALSE)
1458
- }),
1459
- onClick: () => g(st(l)),
1460
- children: /* @__PURE__ */ c(Yn, {})
1461
- }
1462
- ),
1463
- /* @__PURE__ */ c(
1464
- "div",
1465
- {
1466
- className: Y(w, {
1467
- "univer-bg-gray-100 dark:!univer-bg-gray-700": at(a || ie.FALSE)
1468
- }),
1469
- onClick: () => d(st(a)),
1470
- children: /* @__PURE__ */ c(zn, {})
1471
- }
1472
- ),
1473
- /* @__PURE__ */ c(Ee, { color: h, onChange: p, Icon: Kn }),
1474
- /* @__PURE__ */ c(Ee, { color: y, onChange: f })
1475
- ] });
1476
- }, Si = (n) => {
1477
- var T;
1478
- const { onChange: e, interceptorManager: t } = n, r = q(te), o = q(G).getCurrentUnitForType(H.UNIVER_SHEET), s = o.getActiveSheet(), u = ((T = n.rule) == null ? void 0 : T.type) === M.highlightCell ? n.rule : void 0, l = pe(null), [g, a] = N(!1), d = pe(null), [h, p] = N({}), [y, f] = N(() => (u == null ? void 0 : u.subType) === k.formula ? u.value : "="), [w, S] = N(void 0), R = (v) => ({
1479
- style: v.style,
1480
- value: y,
1481
- type: M.highlightCell,
1482
- subType: k.formula
1483
- });
1484
- J(() => t.intercept(t.getInterceptPoints().submit, {
1485
- handler() {
1486
- return R({ style: h });
1487
- }
1488
- }), [h, y, t]), J(() => t.intercept(t.getInterceptPoints().beforeSubmit, {
1489
- handler: (b, I, C) => w || y.length === 1 || !y.startsWith("=") ? (S(r.t("sheet.cf.errorMessage.formulaError")), !1) : C(b)
1490
- }), [w, y]);
1491
- const x = (v) => {
1492
- e(R(v));
1493
- };
1494
- return wt((v) => {
1495
- var I;
1496
- (I = d.current) != null && I.isClickOutSide(v) && a(!1);
1497
- }), /* @__PURE__ */ F("div", { ref: l, children: [
1498
- /* @__PURE__ */ c(
1499
- "div",
1500
- {
1501
- className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1502
- children: r.t("sheet.cf.panel.styleRule")
1503
- }
1504
- ),
1505
- /* @__PURE__ */ c("div", { className: "univer-mt-3", children: /* @__PURE__ */ c(
1506
- Rt,
1507
- {
1508
- ref: d,
1509
- className: Y("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", Ne),
1510
- errorText: w,
1511
- isFocus: g,
1512
- initValue: y,
1513
- unitId: o.getUnitId(),
1514
- subUnitId: s == null ? void 0 : s.getSheetId(),
1515
- onFocus: () => {
1516
- a(!0);
1517
- },
1518
- onChange: (v) => {
1519
- f(v), x({ style: h });
1520
- },
1521
- onVerify: (v, b) => {
1522
- !v || b.length === 1 ? S(r.t("sheet.cf.errorMessage.formulaError")) : S(void 0);
1523
- }
1524
- }
1525
- ) }),
1526
- /* @__PURE__ */ c("div", { className: rt, children: /* @__PURE__ */ c(De, { rule: R({ style: h }) }) }),
1527
- /* @__PURE__ */ c(
1528
- zt,
1529
- {
1530
- style: u == null ? void 0 : u.style,
1531
- className: "univer-mt-3",
1532
- onChange: (v) => {
1533
- p(v), x({ style: v });
1534
- }
1535
- }
1536
- )
1537
- ] });
1538
- }, lt = (n) => /* @__PURE__ */ F("div", { className: "univer-relative", children: [
1539
- /* @__PURE__ */ c(
1540
- "div",
1541
- {
1542
- className: "univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500",
1543
- children: n.errorText
1544
- }
1545
- ),
1546
- n.children
1547
- ] }), W = (n, e) => ({ label: e.t(`sheet.cf.operator.${n}`), value: n }), _i = (n) => {
1548
- const { type: e, operator: t, onChange: r, value: i, interceptorManager: o } = n, s = q(te), [u, l] = N(() => typeof i == "number" ? i : 0), [g, a] = N(""), [d, h] = N(() => typeof i == "string" ? i : ""), [p, y] = N(""), [f, w] = N(() => Array.isArray(i) ? i[0] === void 0 ? 0 : i[0] : 0), [S, R] = N(""), [x, T] = N(() => Array.isArray(i) ? i[1] === void 0 ? 100 : i[1] : 100), [v, b] = N("");
1549
- switch (J(() => {
1550
- switch (e) {
1551
- case k.text: {
1552
- [j.beginsWith, j.endsWith, j.containsText, j.notContainsText, j.equal, j.notEqual].includes(t) && r(d);
1553
- break;
1554
- }
1555
- case k.number: {
1556
- [O.equal, O.notEqual, O.greaterThan, O.greaterThanOrEqual, O.lessThan, O.lessThanOrEqual].includes(t) && r(u), [O.between, O.notBetween].includes(t) && r([f, x]);
1557
- break;
1558
- }
1559
- }
1560
- }, [e]), J(() => {
1561
- const I = o.intercept(o.getInterceptPoints().beforeSubmit, {
1562
- handler: (C, V, E) => {
1563
- switch (e) {
1564
- case k.text:
1565
- if ([j.beginsWith, j.containsText, j.endsWith, j.notEqual, j.notContainsText, j.equal].includes(t))
1566
- return d ? E(C) : (y(s.t("sheet.cf.errorMessage.notBlank")), !1);
1567
- }
1568
- return E(C);
1569
- }
1570
- });
1571
- return () => {
1572
- I();
1573
- };
1574
- }, [e, u, d, t]), e) {
1575
- case k.text: {
1576
- if ([j.beginsWith, j.endsWith, j.containsText, j.notContainsText, j.equal, j.notEqual].includes(t)) {
1577
- const I = (C) => {
1578
- h(C), r(C);
1579
- };
1580
- return /* @__PURE__ */ c("div", { className: "univer-mt-3", children: /* @__PURE__ */ c(lt, { errorText: p, children: /* @__PURE__ */ c(
1581
- Zr,
1582
- {
1583
- value: d,
1584
- onChange: (C) => {
1585
- y(""), I(C);
1586
- }
1587
- }
1588
- ) }) });
1589
- }
1590
- break;
1591
- }
1592
- case k.number: {
1593
- if ([O.equal, O.notEqual, O.greaterThan, O.greaterThanOrEqual, O.lessThan, O.lessThanOrEqual].includes(t)) {
1594
- const I = (C) => {
1595
- l(C || 0), r(C || 0), a("");
1596
- };
1597
- return /* @__PURE__ */ c("div", { className: "univer-mt-3", children: /* @__PURE__ */ c(lt, { errorText: g, children: /* @__PURE__ */ c(
1598
- xe,
1599
- {
1600
- className: "univer-w-full",
1601
- min: Number.MIN_SAFE_INTEGER,
1602
- max: Number.MAX_SAFE_INTEGER,
1603
- value: u,
1604
- onChange: I
1605
- }
1606
- ) }) });
1607
- }
1608
- if ([O.between, O.notBetween].includes(t)) {
1609
- const I = (V) => {
1610
- w(V || 0), r([V || 0, x]), R("");
1611
- }, C = (V) => {
1612
- T(V || 0), r([f, V || 0]), b("");
1613
- };
1614
- return /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-items-center", children: [
1615
- /* @__PURE__ */ c(lt, { errorText: S, children: /* @__PURE__ */ c(xe, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, value: f, onChange: I }) }),
1616
- /* @__PURE__ */ c(lt, { errorText: v, children: /* @__PURE__ */ c(
1617
- xe,
1618
- {
1619
- className: "univer-ml-3",
1620
- min: Number.MIN_SAFE_INTEGER,
1621
- max: Number.MAX_SAFE_INTEGER,
1622
- value: x,
1623
- onChange: C
1624
- }
1625
- ) })
1626
- ] });
1627
- }
1628
- }
1629
- }
1630
- return null;
1631
- }, rn = (n, e) => {
1632
- switch (n) {
1633
- case k.text:
1634
- return [
1635
- W(j.containsText, e),
1636
- W(j.notContainsText, e),
1637
- W(j.beginsWith, e),
1638
- W(j.endsWith, e),
1639
- W(j.equal, e),
1640
- W(j.notEqual, e),
1641
- W(j.containsBlanks, e),
1642
- W(j.notContainsBlanks, e),
1643
- W(j.containsErrors, e),
1644
- W(j.notContainsErrors, e)
1645
- ];
1646
- case k.number:
1647
- return [
1648
- W(O.between, e),
1649
- W(O.notBetween, e),
1650
- W(O.equal, e),
1651
- W(O.notEqual, e),
1652
- W(O.greaterThan, e),
1653
- W(O.greaterThanOrEqual, e),
1654
- W(O.lessThan, e),
1655
- W(O.lessThanOrEqual, e)
1656
- ];
1657
- case k.timePeriod:
1658
- return [
1659
- W(de.yesterday, e),
1660
- W(de.today, e),
1661
- W(de.tomorrow, e),
1662
- W(de.last7Days, e),
1663
- W(de.lastWeek, e),
1664
- W(de.thisWeek, e),
1665
- W(de.nextWeek, e),
1666
- W(de.lastMonth, e),
1667
- W(de.thisMonth, e),
1668
- W(de.nextMonth, e)
1669
- ];
1670
- }
1671
- }, on = (n) => {
1672
- var T;
1673
- const { interceptorManager: e, onChange: t } = n, r = q(te), i = ((T = n.rule) == null ? void 0 : T.type) === M.highlightCell ? n.rule : void 0, [o, s] = N(() => {
1674
- const v = k.text;
1675
- return i && i.subType || v;
1676
- }), u = [{
1677
- value: k.text,
1678
- label: r.t("sheet.cf.subRuleType.text")
1679
- }, {
1680
- value: k.number,
1681
- label: r.t("sheet.cf.subRuleType.number")
1682
- }, {
1683
- value: k.timePeriod,
1684
- label: r.t("sheet.cf.subRuleType.timePeriod")
1685
- }, {
1686
- value: k.duplicateValues,
1687
- label: r.t("sheet.cf.subRuleType.duplicateValues")
1688
- }, {
1689
- value: k.uniqueValues,
1690
- label: r.t("sheet.cf.subRuleType.uniqueValues")
1691
- }], l = K(() => rn(o, r), [o]), [g, a] = N(() => {
1692
- const v = l ? l[0].value : void 0;
1693
- return i && i.operator || v;
1694
- }), [d, h] = N(() => {
1695
- var I;
1696
- return i ? (I = i.value) != null ? I : gt(i.subType, i.operator) : "";
1697
- }), [p, y] = N({}), f = K(() => (v) => {
1698
- var b, I, C, V, E, U, D, m, _, B, L, A, Z, z, ne;
1699
- switch (v.subType || o) {
1700
- case k.text: {
1701
- if ([j.beginsWith, j.endsWith, j.containsText, j.notContainsText, j.equal, j.notEqual].includes(g))
1702
- return {
1703
- type: M.highlightCell,
1704
- subType: (b = v.subType) != null ? b : o,
1705
- operator: (I = v.operator) != null ? I : g,
1706
- style: (C = v.style) != null ? C : p,
1707
- value: (V = v.value) != null ? V : d
1708
- };
1709
- break;
1710
- }
1711
- case k.number: {
1712
- if ([O.equal, O.notEqual, O.greaterThan, O.greaterThanOrEqual, O.lessThan, O.lessThanOrEqual].includes(g))
1713
- return {
1714
- type: M.highlightCell,
1715
- subType: (E = v.subType) != null ? E : o,
1716
- operator: (U = v.operator) != null ? U : g,
1717
- style: (D = v.style) != null ? D : p,
1718
- value: (m = v.value) != null ? m : d
1719
- };
1720
- if ([O.between, O.notBetween].includes(g))
1721
- return {
1722
- type: M.highlightCell,
1723
- subType: (_ = v.subType) != null ? _ : o,
1724
- operator: (B = v.operator) != null ? B : g,
1725
- style: (L = v.style) != null ? L : p,
1726
- value: (A = v.value) != null ? A : d
1727
- };
1728
- break;
1729
- }
1730
- }
1731
- return {
1732
- type: M.highlightCell,
1733
- subType: (Z = v.subType) != null ? Z : o,
1734
- operator: (z = v.operator) != null ? z : g,
1735
- style: (ne = v.style) != null ? ne : p
1736
- };
1737
- }, [o, g, d, p]);
1738
- J(() => e.intercept(e.getInterceptPoints().submit, {
1739
- handler() {
1740
- return f({});
1741
- }
1742
- }), [f, e]), J(() => {
1743
- u.some((v) => v.value === o) || s(u[0].value);
1744
- }, [u]);
1745
- const w = (v) => {
1746
- const b = v, I = rn(b, r), C = I && I[0].value;
1747
- s(b), a(C), C && h(gt(b, C)), t(f({ subType: b, operator: C }));
1748
- }, S = (v) => {
1749
- const b = v;
1750
- a(b), t(f({ operator: b }));
1751
- }, R = (v) => {
1752
- h(v), t(f({ value: v }));
1753
- }, x = K(() => `${o}_${g}_${Math.random()}`, [o, g]);
1754
- return /* @__PURE__ */ F("div", { children: [
1755
- /* @__PURE__ */ c(
1756
- "div",
1757
- {
1758
- className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1759
- children: r.t("sheet.cf.panel.styleRule")
1760
- }
1761
- ),
1762
- /* @__PURE__ */ F("div", { className: "univer-flex univer-justify-between univer-gap-4", children: [
1763
- /* @__PURE__ */ c(
1764
- oe,
1765
- {
1766
- className: "univer-mt-3 univer-w-full",
1767
- onChange: w,
1768
- value: o,
1769
- options: u
1770
- }
1771
- ),
1772
- (l == null ? void 0 : l.length) && /* @__PURE__ */ c(
1773
- oe,
1774
- {
1775
- className: "univer-mt-3 univer-w-full",
1776
- onChange: S,
1777
- value: g || "",
1778
- options: l
1779
- }
1780
- )
1781
- ] }),
1782
- /* @__PURE__ */ c(
1783
- _i,
1784
- {
1785
- value: d,
1786
- interceptorManager: e,
1787
- type: o,
1788
- operator: g,
1789
- rule: i,
1790
- onChange: R
1791
- },
1792
- x
1793
- ),
1794
- /* @__PURE__ */ c("div", { className: rt, children: /* @__PURE__ */ c(De, { rule: f({}) }) }),
1795
- /* @__PURE__ */ c(
1796
- zt,
1797
- {
1798
- style: i == null ? void 0 : i.style,
1799
- className: "univer-ml-1",
1800
- onChange: (v) => {
1801
- y(v), t(f({ style: v }));
1802
- }
1803
- }
1804
- )
1805
- ] });
1806
- }, Jn = (n, e) => (Te[n] || [])[Number(e)] || "", wi = (n) => {
1807
- var a;
1808
- const { error: e, type: t, onChange: r } = n, i = q(G), o = i.getCurrentUnitForType(H.UNIVER_SHEET).getUnitId(), s = (a = i.getCurrentUnitForType(H.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : a.getSheetId(), u = pe(null), [l, g] = N(!1);
1809
- return wt((d) => {
1810
- var p;
1811
- (p = u.current) != null && p.isClickOutSide(d) && g(!1);
1812
- }), /* @__PURE__ */ c("div", { className: "univer-relative", children: t !== P.formula ? /* @__PURE__ */ F(jt, { children: [
1813
- /* @__PURE__ */ c(
1814
- xe,
1815
- {
1816
- className: Y({
1817
- "univer-border-red-500": e
1818
- }),
1819
- value: Number(n.value) || 0,
1820
- onChange: (d) => r(d != null ? d : 0)
1821
- }
1822
- ),
1823
- e && /* @__PURE__ */ c("div", { className: "univer-absolute univer-text-xs univer-text-red-500", children: e })
1824
- ] }) : /* @__PURE__ */ c("div", { className: "univer-w-full", children: /* @__PURE__ */ c(
1825
- Rt,
1826
- {
1827
- ref: u,
1828
- className: Y("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", Ne),
1829
- initValue: String(n.value),
1830
- unitId: o,
1831
- subUnitId: s,
1832
- isFocus: l,
1833
- onChange: (d = "") => {
1834
- r(d || "");
1835
- },
1836
- onFocus: () => g(!0)
1837
- }
1838
- ) }) });
1839
- }, sn = (n, e, t) => ({
1840
- operator: O.greaterThan,
1841
- value: { type: P.num, value: (t.length - 1 - e) * 10 },
1842
- iconType: n,
1843
- iconId: String(e)
1844
- }), Ri = le((n, e) => {
1845
- const { onClick: t } = n, r = q(te), i = (o) => {
1846
- t(o);
1847
- };
1848
- return /* @__PURE__ */ c("div", { ref: e, className: "univer-w-80", children: Tr.map((o, s) => /* @__PURE__ */ F("div", { className: "univer-mb-3", children: [
1849
- /* @__PURE__ */ c("div", { className: "univer-mb-1 univer-text-sm", children: r.t(o.title) }),
1850
- /* @__PURE__ */ c("div", { className: "univer-flex univer-flex-wrap", children: o.group.map((u) => /* @__PURE__ */ c(
1851
- "div",
1852
- {
1853
- className: "univer-mb-1 univer-flex univer-w-1/2 univer-items-center",
1854
- onClick: () => {
1855
- i(u.name);
1856
- },
1857
- children: /* @__PURE__ */ c(
1858
- "a",
1859
- {
1860
- className: "univer-flex univer-cursor-pointer univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
1861
- children: u.list.map((l, g) => /* @__PURE__ */ c(
1862
- "img",
1863
- {
1864
- className: "univer-size-5",
1865
- src: l,
1866
- draggable: !1
1867
- },
1868
- g
1869
- ))
1870
- }
1871
- )
1872
- },
1873
- u.name
1874
- )) })
1875
- ] }, s)) });
1876
- }), Ti = (n) => {
1877
- const { onClick: e } = n, t = K(() => {
1878
- const i = [];
1879
- for (const o in Te) {
1880
- const s = Te[o], u = o;
1881
- s.forEach((l, g) => {
1882
- i.push({
1883
- iconType: u,
1884
- base64: l,
1885
- iconId: String(g)
1886
- });
1887
- });
1888
- }
1889
- return i;
1890
- }, []), r = (i) => {
1891
- e(i.iconType, i.iconId);
1892
- };
1893
- return /* @__PURE__ */ F("div", { children: [
1894
- /* @__PURE__ */ F(
1895
- "div",
1896
- {
1897
- className: "univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1",
1898
- onClick: () => r({ iconType: Er, iconId: "" }),
1899
- children: [
1900
- /* @__PURE__ */ c(nt, { className: "univer-size-5" }),
1901
- /* @__PURE__ */ c("span", { className: "univer-ml-2", children: "无单元格图标" })
1902
- ]
1903
- }
1904
- ),
1905
- /* @__PURE__ */ c("div", { className: "univer-flex univer-w-64 univer-flex-wrap", children: t.map((i) => /* @__PURE__ */ c(
1906
- "div",
1907
- {
1908
- className: "univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
1909
- children: /* @__PURE__ */ c(
1910
- "img",
1911
- {
1912
- className: "univer-size-5",
1913
- src: i.base64,
1914
- draggable: !1,
1915
- onClick: () => r(i)
1916
- }
1917
- )
1918
- },
1919
- `${i.iconType}_${i.iconId}`
1920
- )) })
1921
- ] });
1922
- }, xi = (n) => {
1923
- const { onChange: e, configList: t, errorMap: r = {} } = n, i = q(te), o = [{ label: i.t(`sheet.cf.symbol.${O.greaterThan}`), value: O.greaterThan }, { label: i.t(`sheet.cf.symbol.${O.greaterThanOrEqual}`), value: O.greaterThanOrEqual }], s = [
1924
- { label: i.t(`sheet.cf.valueType.${P.num}`), value: P.num },
1925
- { label: i.t(`sheet.cf.valueType.${P.percent}`), value: P.percent },
1926
- { label: i.t(`sheet.cf.valueType.${P.percentile}`), value: P.percentile },
1927
- { label: i.t(`sheet.cf.valueType.${P.formula}`), value: P.formula }
1928
- ], u = (d, h) => {
1929
- e([String(h), "value", "value"], d);
1930
- }, l = (d, h) => {
1931
- e([String(h), "operator"], d);
1932
- const p = gt(k.number, d);
1933
- u(p, h);
1934
- }, g = (d, h) => {
1935
- e([String(h), "value", "type"], d);
1936
- const p = t[h], y = gt(k.number, p.operator);
1937
- u(y, h);
1938
- };
1939
- return K(() => t.map((d, h) => {
1940
- const p = r[h], y = Jn(d.iconType, d.iconId), f = h === t.length - 1, w = h === 0, S = t[h - 1], R = (S == null ? void 0 : S.value.type) === P.formula ? i.t("sheet.cf.valueType.formula") : S == null ? void 0 : S.value.value, x = (T, v) => {
1941
- const b = { ...d, iconId: v, iconType: T };
1942
- e([String(h)], b);
1943
- };
1944
- return /* @__PURE__ */ F(
1945
- "div",
1946
- {
1947
- className: h ? "univer-mt-6" : "univer-mt-3",
1948
- children: [
1949
- /* @__PURE__ */ F(
1950
- "div",
1951
- {
1952
- className: "univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1953
- children: [
1954
- /* @__PURE__ */ F(
1955
- "div",
1956
- {
1957
- className: "univer-w-[45%]",
1958
- children: [
1959
- i.t("sheet.cf.iconSet.icon"),
1960
- h + 1
1961
- ]
1962
- }
1963
- ),
1964
- /* @__PURE__ */ c("div", { className: "univer-w-[45%]", children: /* @__PURE__ */ F(jt, { children: [
1965
- !w && !f && i.t("sheet.cf.iconSet.rule"),
1966
- !w && !f && /* @__PURE__ */ F(
1967
- "span",
1968
- {
1969
- className: "univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200",
1970
- children: [
1971
- i.t("sheet.cf.iconSet.when"),
1972
- i.t(`sheet.cf.symbol.${Ht(S.operator)}`),
1973
- R,
1974
- f ? "" : ` ${i.t("sheet.cf.iconSet.and")} `
1975
- ]
1976
- }
1977
- )
1978
- ] }) })
1979
- ]
1980
- }
1981
- ),
1982
- /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4", children: [
1983
- /* @__PURE__ */ c("div", { className: "univer-flex univer-items-center", children: /* @__PURE__ */ c(
1984
- Gt,
1985
- {
1986
- overlay: /* @__PURE__ */ c("div", { className: "univer-rounded-lg univer-p-4", children: /* @__PURE__ */ c(Ti, { onClick: x, iconId: d.iconId, iconType: d.iconType }) }),
1987
- children: /* @__PURE__ */ F(
1988
- "div",
1989
- {
1990
- className: Y("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200", Ne),
1991
- children: [
1992
- y ? /* @__PURE__ */ c("img", { src: y, className: "univer-size-4", draggable: !1 }) : /* @__PURE__ */ c(nt, { className: "univer-size-4" }),
1993
- /* @__PURE__ */ c(Zt, {})
1994
- ]
1995
- }
1996
- )
1997
- }
1998
- ) }),
1999
- f ? /* @__PURE__ */ F(
2000
- "div",
2001
- {
2002
- className: "univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
2003
- children: [
2004
- i.t("sheet.cf.iconSet.rule"),
2005
- /* @__PURE__ */ F("span", { className: "univer-font-medium", children: [
2006
- i.t("sheet.cf.iconSet.when"),
2007
- i.t(`sheet.cf.symbol.${Ht(S.operator)}`),
2008
- R,
2009
- f ? "" : ` ${i.t("sheet.cf.iconSet.and")} `
2010
- ] })
2011
- ]
2012
- }
2013
- ) : /* @__PURE__ */ c(
2014
- oe,
2015
- {
2016
- options: o,
2017
- value: d.operator,
2018
- onChange: (T) => {
2019
- l(T, h);
2020
- }
2021
- }
2022
- )
2023
- ] }),
2024
- f ? /* @__PURE__ */ c("div", {}) : /* @__PURE__ */ F(jt, { children: [
2025
- /* @__PURE__ */ F(
2026
- "div",
2027
- {
2028
- className: "univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
2029
- children: [
2030
- /* @__PURE__ */ c("div", { children: i.t("sheet.cf.iconSet.type") }),
2031
- /* @__PURE__ */ c("div", { children: i.t("sheet.cf.iconSet.value") })
2032
- ]
2033
- }
2034
- ),
2035
- /* @__PURE__ */ F(
2036
- "div",
2037
- {
2038
- className: "univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",
2039
- children: [
2040
- /* @__PURE__ */ c(
2041
- oe,
2042
- {
2043
- options: s,
2044
- value: d.value.type,
2045
- onChange: (T) => {
2046
- g(T, h);
2047
- }
2048
- }
2049
- ),
2050
- /* @__PURE__ */ c(
2051
- wi,
2052
- {
2053
- id: h,
2054
- type: d.value.type,
2055
- error: p,
2056
- value: d.value.value || "",
2057
- onChange: (T) => {
2058
- u(T, h);
2059
- }
2060
- }
2061
- )
2062
- ]
2063
- }
2064
- )
2065
- ] })
2066
- ]
2067
- },
2068
- h
2069
- );
2070
- }), [t, r]);
2071
- }, Ei = (n) => {
2072
- var T;
2073
- const { interceptorManager: e } = n, t = ((T = n.rule) == null ? void 0 : T.type) === M.iconSet ? n.rule : void 0, r = q(te), [i, o] = N({}), [s, u] = N(() => {
2074
- const v = Object.keys(Te)[0];
2075
- if (t && t.config.length) {
2076
- const b = t.config[0].iconType;
2077
- if (!t.config.some((C) => C.iconType !== b))
2078
- return b;
2079
- }
2080
- return v;
2081
- }), [l, g] = N(() => {
2082
- if (t && t.config.length)
2083
- return _t.deepClone(t == null ? void 0 : t.config);
2084
- const v = Te[s] || [];
2085
- return new Array(v.length).fill("").map((b, I, C) => I === C.length - 1 ? {
2086
- operator: O.lessThanOrEqual,
2087
- value: { type: P.num, value: Number.MAX_SAFE_INTEGER },
2088
- iconType: s,
2089
- iconId: String(I)
2090
- } : sn(s, I, C));
2091
- }), [a, d] = N(() => t ? !!t.isShowValue : !0), h = K(() => {
2092
- const v = l.map((b) => Jn(b.iconType, b.iconId));
2093
- return /* @__PURE__ */ c("div", { className: "univer-flex univer-items-center", children: v.map((b, I) => b ? /* @__PURE__ */ c(
2094
- "img",
2095
- {
2096
- className: "univer-size-5",
2097
- src: b
2098
- },
2099
- I
2100
- ) : /* @__PURE__ */ c(nt, { className: "univer-size-5" }, I)) });
2101
- }, [l]), p = (v) => {
2102
- if (v.reduce((I, C, V) => I.preType && !I.result || v.length - 1 === V ? I : C.value.type === P.formula ? {
2103
- preType: P.formula,
2104
- result: !1
2105
- } : I.preType ? {
2106
- result: I.preType === C.value.type,
2107
- preType: C.value.type
2108
- } : {
2109
- result: !0,
2110
- preType: C.value.type
2111
- }, { result: !0, preType: "" }).result && [P.num, P.percent, P.percentile].includes(v[0].value.type)) {
2112
- const I = {};
2113
- return v.forEach((C, V, E) => {
2114
- if (V - 1 < 0 || V === E.length - 1)
2115
- return;
2116
- const D = v[V - 1], m = Ht(D.operator);
2117
- xr({ operator: m, value: D.value.value }, C.value.value) || (I[V] = `${r.t(`sheet.cf.form.${m}`, String(D.value.value))} `);
2118
- }), I;
2119
- }
2120
- return {};
2121
- }, y = (v, b) => {
2122
- ir(l, v) !== b && (or(l, v, b), g([...l]), o(p(l)));
2123
- }, f = (v) => {
2124
- u(v);
2125
- const b = Te[v] || [], I = new Array(b.length).fill("").map((C, V, E) => sn(v, V, E));
2126
- g(I), o(p(I));
2127
- };
2128
- J(() => {
2129
- const v = e.intercept(e.getInterceptPoints().submit, {
2130
- handler() {
2131
- return { type: M.iconSet, isShowValue: a, config: l };
2132
- }
2133
- });
2134
- return () => {
2135
- v();
2136
- };
2137
- }, [a, l, e]), J(() => {
2138
- const v = e.intercept(e.getInterceptPoints().beforeSubmit, {
2139
- handler() {
2140
- return Object.keys(i).length === 0;
2141
- }
2142
- });
2143
- return () => {
2144
- v();
2145
- };
2146
- }, [a, l, e, i]);
2147
- const w = () => {
2148
- const v = l.map((b) => ({ ...b }));
2149
- l.forEach((b, I) => {
2150
- const C = l.length - 1 - I, V = v[C];
2151
- b.iconId = V.iconId, b.iconType = V.iconType;
2152
- }), g([...l]);
2153
- }, S = q(Ur), [R, x] = N();
2154
- return Or(R, S.rootContainerElement), /* @__PURE__ */ F("div", { children: [
2155
- /* @__PURE__ */ c("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-600", children: r.t("sheet.cf.panel.styleRule") }),
2156
- /* @__PURE__ */ c("div", { className: "univer-mt-3", children: /* @__PURE__ */ c(
2157
- Gt,
2158
- {
2159
- overlay: /* @__PURE__ */ c("div", { className: "univer-rounded-lg univer-p-4", children: /* @__PURE__ */ c(
2160
- Ri,
2161
- {
2162
- ref: (v) => {
2163
- !R && v && x(v);
2164
- },
2165
- iconType: s,
2166
- onClick: f
2167
- }
2168
- ) }),
2169
- children: /* @__PURE__ */ F(
2170
- "div",
2171
- {
2172
- className: Y("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600", Ne),
2173
- children: [
2174
- h,
2175
- /* @__PURE__ */ c(Zt, {})
2176
- ]
2177
- }
2178
- )
2179
- }
2180
- ) }),
2181
- /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-items-center univer-text-xs", children: [
2182
- /* @__PURE__ */ F("div", { className: "univer-flex univer-items-center univer-text-xs", children: [
2183
- /* @__PURE__ */ c(mt, { onChange: w }),
2184
- r.t("sheet.cf.iconSet.reverseIconOrder")
2185
- ] }),
2186
- /* @__PURE__ */ F("div", { className: "univer-ml-6 univer-flex univer-items-center univer-text-xs", children: [
2187
- /* @__PURE__ */ c(mt, { checked: !a, onChange: (v) => {
2188
- d(!v);
2189
- } }),
2190
- r.t("sheet.cf.iconSet.onlyShowIcon")
2191
- ] })
2192
- ] }),
2193
- /* @__PURE__ */ c(xi, { errorMap: i, onChange: y, configList: l })
2194
- ] });
2195
- }, Ni = (n) => {
2196
- var w;
2197
- const { onChange: e, interceptorManager: t } = n, r = q(te), i = ((w = n.rule) == null ? void 0 : w.type) === M.highlightCell ? n.rule : void 0, o = [{ label: r.t("sheet.cf.panel.isNotBottom"), value: "isNotBottom" }, { label: r.t("sheet.cf.panel.isBottom"), value: "isBottom" }, { label: r.t("sheet.cf.panel.greaterThanAverage"), value: "greaterThanAverage" }, { label: r.t("sheet.cf.panel.lessThanAverage"), value: "lessThanAverage" }], [s, u] = N(() => {
2198
- const S = o[0].value, R = i == null ? void 0 : i.type;
2199
- if (!i)
2200
- return S;
2201
- switch (R) {
2202
- case M.highlightCell:
2203
- switch (i.subType) {
2204
- case k.average:
2205
- return [O.greaterThan, O.greaterThanOrEqual].includes(i.operator) ? "greaterThanAverage" : [O.lessThan, O.lessThanOrEqual].includes(i.operator) ? "lessThanAverage" : S;
2206
- case k.rank:
2207
- return i.isBottom ? "isBottom" : "isNotBottom";
2208
- }
2209
- }
2210
- return S;
2211
- }), [l, g] = N(() => {
2212
- const R = i == null ? void 0 : i.type;
2213
- if (!i)
2214
- return 10;
2215
- switch (R) {
2216
- case M.highlightCell:
2217
- if (i.subType === k.rank)
2218
- return i.value || 10;
2219
- }
2220
- return 10;
2221
- }), [a, d] = N(() => {
2222
- const R = i == null ? void 0 : i.type;
2223
- if (!i)
2224
- return !1;
2225
- switch (R) {
2226
- case M.highlightCell:
2227
- if (i.subType === k.rank)
2228
- return i.isPercent || !1;
2229
- }
2230
- return !1;
2231
- }), [h, p] = N({}), y = (S) => {
2232
- const { type: R, isPercent: x, value: T, style: v } = S;
2233
- if (R === "isNotBottom")
2234
- return { type: M.highlightCell, subType: k.rank, isPercent: x, isBottom: !1, value: T, style: v };
2235
- if (R === "isBottom")
2236
- return { type: M.highlightCell, subType: k.rank, isPercent: x, isBottom: !0, value: T, style: v };
2237
- if (R === "greaterThanAverage")
2238
- return { type: M.highlightCell, subType: k.average, operator: O.greaterThan, style: v };
2239
- if (R === "lessThanAverage")
2240
- return { type: M.highlightCell, subType: k.average, operator: O.lessThan, style: v };
2241
- };
2242
- J(() => t.intercept(t.getInterceptPoints().submit, {
2243
- handler() {
2244
- return y({ type: s, isPercent: a, value: l, style: h });
2245
- }
2246
- }), [s, a, l, h, t]);
2247
- const f = (S) => {
2248
- e(y(S));
2249
- };
2250
- return /* @__PURE__ */ F("div", { children: [
2251
- /* @__PURE__ */ c(
2252
- "div",
2253
- {
2254
- className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
2255
- children: r.t("sheet.cf.panel.styleRule")
2256
- }
2257
- ),
2258
- /* @__PURE__ */ c(
2259
- oe,
2260
- {
2261
- className: "univer-mt-3 univer-w-full",
2262
- value: s,
2263
- options: o,
2264
- onChange: (S) => {
2265
- u(S), f({ type: S, isPercent: a, value: l, style: h });
2266
- }
2267
- }
2268
- ),
2269
- ["isNotBottom", "isBottom"].includes(s) && /* @__PURE__ */ F("div", { className: "univer-mt-3 univer-flex univer-items-center", children: [
2270
- /* @__PURE__ */ c(
2271
- xe,
2272
- {
2273
- min: 1,
2274
- max: 1e3,
2275
- value: l,
2276
- onChange: (S) => {
2277
- const R = S || 0;
2278
- g(R), f({ type: s, isPercent: a, value: R, style: h });
2279
- }
2280
- }
2281
- ),
2282
- /* @__PURE__ */ F(
2283
- "div",
2284
- {
2285
- className: "univer-ml-3 univer-flex univer-items-center univer-text-xs",
2286
- children: [
2287
- /* @__PURE__ */ c(
2288
- mt,
2289
- {
2290
- checked: a,
2291
- onChange: (S) => {
2292
- d(!!S), f({ type: s, isPercent: !!S, value: l, style: h });
2293
- }
2294
- }
2295
- ),
2296
- r.t("sheet.cf.valueType.percent")
2297
- ]
2298
- }
2299
- )
2300
- ] }),
2301
- /* @__PURE__ */ c("div", { className: rt, children: /* @__PURE__ */ c(De, { rule: y({ type: s, isPercent: a, value: l, style: h }) }) }),
2302
- /* @__PURE__ */ c(
2303
- zt,
2304
- {
2305
- style: i == null ? void 0 : i.style,
2306
- className: "univer-mt-3",
2307
- onChange: (S) => {
2308
- p(S), f({ type: s, isPercent: a, value: l, style: S });
2309
- }
2310
- }
2311
- )
2312
- ] });
2313
- }, Mi = gn("beforeSubmit"), Vi = gn("submit"), an = (n) => n.getCurrentUnitForType(H.UNIVER_SHEET).getUnitId(), ln = (n) => {
2314
- var e;
2315
- return (e = n.getCurrentUnitForType(H.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : e.getSheetId();
2316
- }, ki = (n) => {
2317
- var I, C, V;
2318
- const e = q(te), t = q(Q), r = q(G), i = q(X), o = q($e), s = an(r), u = ln(r), [l, g] = N(void 0), a = pe((C = (I = n.rule) == null ? void 0 : I.ranges) != null ? C : []), d = K(() => {
2319
- var U, D, m;
2320
- let E = (U = n.rule) == null ? void 0 : U.ranges;
2321
- return E != null && E.length || (E = (m = (D = o.getCurrentSelections()) == null ? void 0 : D.map((_) => _.range)) != null ? m : []), a.current = E, E != null && E.length ? E.map((_) => {
2322
- const B = Nn(_);
2323
- return B === "NaN" ? "" : B;
2324
- }).filter((_) => !!_).join(",") : "";
2325
- }, [n.rule]), h = [
2326
- { label: e.t("sheet.cf.ruleType.highlightCell"), value: "1" },
2327
- { label: e.t("sheet.cf.panel.rankAndAverage"), value: "2" },
2328
- { label: e.t("sheet.cf.ruleType.dataBar"), value: "3" },
2329
- { label: e.t("sheet.cf.ruleType.colorScale"), value: "4" },
2330
- { label: e.t("sheet.cf.ruleType.formula"), value: "5" },
2331
- { label: e.t("sheet.cf.ruleType.iconSet"), value: "6" }
2332
- ], [p, y] = N(() => {
2333
- var D, m;
2334
- const E = (D = n.rule) == null ? void 0 : D.rule.type, U = h[0].value;
2335
- if (!E)
2336
- return U;
2337
- switch (E) {
2338
- case M.highlightCell: {
2339
- switch ((m = n.rule) == null ? void 0 : m.rule.subType) {
2340
- case k.number:
2341
- case k.text:
2342
- case k.duplicateValues:
2343
- case k.uniqueValues:
2344
- case k.timePeriod:
2345
- return "1";
2346
- case k.average:
2347
- case k.rank:
2348
- return "2";
2349
- case k.formula:
2350
- return "5";
2351
- }
2352
- break;
2353
- }
2354
- case M.dataBar:
2355
- return "3";
2356
- case M.colorScale:
2357
- return "4";
2358
- case M.iconSet:
2359
- return "6";
2360
- }
2361
- return U;
2362
- }), f = pe(void 0), w = K(() => new sr({ beforeSubmit: Mi, submit: Vi }), []), S = K(() => {
2363
- switch (p) {
2364
- case "1":
2365
- return on;
2366
- case "2":
2367
- return Ni;
2368
- case "3":
2369
- return Ii;
2370
- case "4":
2371
- return bi;
2372
- case "5":
2373
- return Si;
2374
- case "6":
2375
- return Ei;
2376
- default:
2377
- return on;
2378
- }
2379
- }, [p]);
2380
- J(() => {
2381
- const E = t.onCommandExecuted((U) => {
2382
- if (U.id === ur.id) {
2383
- const D = U.params;
2384
- D.subUnitId === u && D.unitId === s && n.onCancel();
2385
- }
2386
- U.id === Bt.id && n.onCancel();
2387
- });
2388
- return () => E.dispose();
2389
- }, []);
2390
- const R = (E) => {
2391
- f.current = E;
2392
- }, x = (E) => {
2393
- const U = E.split(",").filter((D) => !!D).map(Yr).map((D) => D.range);
2394
- a.current = U;
2395
- }, T = () => {
2396
- if (l)
2397
- return;
2398
- const U = (() => {
2399
- const m = r.getCurrentUnitForType(H.UNIVER_SHEET).getActiveSheet();
2400
- if (!m)
2401
- throw new Error("No active sheet found");
2402
- return a.current.map((L) => dr(L, m.getRowCount(), m.getColumnCount())).filter((L) => !(Number.isNaN(L.startRow) || Number.isNaN(L.startColumn)));
2403
- })();
2404
- if (w.fetchThroughInterceptors(w.getInterceptPoints().beforeSubmit)(!0, null)) {
2405
- const m = w.fetchThroughInterceptors(w.getInterceptPoints().submit)(null, null);
2406
- if (m) {
2407
- const _ = an(r), B = ln(r);
2408
- if (!_ || !B)
2409
- throw new Error("No active sheet found");
2410
- let L = {};
2411
- n.rule && n.rule.cfId ? (L = { ...n.rule, ranges: U, rule: m }, t.executeCommand(Nr.id, { unitId: _, subUnitId: B, rule: L }), n.onCancel()) : (L = { cfId: i.createCfId(_, B), ranges: U, rule: m, stopIfTrue: !1 }, t.executeCommand(wn.id, { unitId: _, subUnitId: B, rule: L }), n.onCancel());
2412
- }
2413
- }
2414
- }, v = () => {
2415
- n.onCancel();
2416
- }, b = (E, U) => {
2417
- E ? U.length < 1 ? g(e.t("sheet.cf.errorMessage.rangeError")) : g(void 0) : g(e.t("sheet.cf.errorMessage.rangeError"));
2418
- };
2419
- return /* @__PURE__ */ F("div", { children: [
2420
- /* @__PURE__ */ c(
2421
- "div",
2422
- {
2423
- className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
2424
- children: e.t("sheet.cf.panel.range")
2425
- }
2426
- ),
2427
- /* @__PURE__ */ F("div", { className: "univer-mt-4", children: [
2428
- /* @__PURE__ */ c(
2429
- Kr,
2430
- {
2431
- unitId: s,
2432
- subUnitId: u,
2433
- initialValue: d,
2434
- onChange: (E, U) => x(U),
2435
- onVerify: b
2436
- }
2437
- ),
2438
- l && /* @__PURE__ */ c("div", { className: "univer-mt-1 univer-text-xs univer-text-red-500", children: l })
2439
- ] }),
2440
- /* @__PURE__ */ c(
2441
- "div",
2442
- {
2443
- className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
2444
- children: e.t("sheet.cf.panel.styleType")
2445
- }
2446
- ),
2447
- /* @__PURE__ */ c(
2448
- oe,
2449
- {
2450
- className: "univer-mt-4 univer-w-full",
2451
- value: p,
2452
- options: h,
2453
- onChange: (E) => y(E)
2454
- }
2455
- ),
2456
- /* @__PURE__ */ c(
2457
- S,
2458
- {
2459
- interceptorManager: w,
2460
- rule: (V = n.rule) == null ? void 0 : V.rule,
2461
- onChange: R
2462
- }
2463
- ),
2464
- /* @__PURE__ */ F("div", { className: "univer-mt-4 univer-flex univer-justify-end", children: [
2465
- /* @__PURE__ */ c(Xt, { onClick: v, children: e.t("sheet.cf.panel.cancel") }),
2466
- /* @__PURE__ */ c(Xt, { className: "univer-ml-3", variant: "primary", onClick: T, children: e.t("sheet.cf.panel.submit") })
2467
- ] })
2468
- ] });
2469
- };
2470
- var Fi = Object.getOwnPropertyDescriptor, Li = (n, e, t, r) => {
2471
- for (var i = r > 1 ? void 0 : r ? Fi(e, t) : e, o = n.length - 1, s; o >= 0; o--)
2472
- (s = n[o]) && (i = s(i) || i);
2473
- return i;
2474
- }, Pi = (n, e) => (t, r) => e(t, r, n);
2475
- let Pe = class extends se {
2476
- constructor(e) {
2477
- super();
2478
- ge(this, "_initLocal", () => {
2479
- });
2480
- ge(this, "_findReplaceIndex", (e) => {
2481
- const t = /\{([^}]+)?\}/g, r = [];
2482
- let i = t.exec(e);
2483
- for (; i; )
2484
- r.push({
2485
- startIndex: i.index,
2486
- key: Number(i[1]),
2487
- endIndex: i.index + i[0].length - 1
2488
- }), i = t.exec(e);
2489
- return r;
2490
- });
2491
- this._localeService = e, this._initLocal();
2492
- }
2493
- tWithReactNode(e, ...t) {
2494
- const r = this._localeService.getLocales(), i = e.split("."), o = r && this._localeService.resolveKeyPath(r, i);
2495
- if (typeof o == "string") {
2496
- const s = [];
2497
- return this._findReplaceIndex(o).forEach((u, l, g) => {
2498
- const a = g[l - 1] || { endIndex: -1 };
2499
- if (a.endIndex + 1 < u.startIndex) {
2500
- const d = o.slice(a.endIndex + 1, u.startIndex);
2501
- d && s.push(d);
2502
- }
2503
- if (t[u.key] && s.push(t[u.key]), l === g.length - 1) {
2504
- const d = o.slice(u.endIndex + 1);
2505
- d && s.push(d);
2506
- }
2507
- }), s;
2508
- }
2509
- return [];
2510
- }
2511
- };
2512
- Pe = Li([
2513
- Pi(0, $(te))
2514
- ], Pe);
2515
- const Ui = (n, e) => {
2516
- const t = n.rule;
2517
- switch (t.type) {
2518
- case M.colorScale:
2519
- return e.t("sheet.cf.ruleType.colorScale");
2520
- case M.dataBar:
2521
- return e.t("sheet.cf.ruleType.dataBar");
2522
- case M.iconSet:
2523
- return e.t("sheet.cf.ruleType.iconSet");
2524
- case M.highlightCell:
2525
- switch (t.subType) {
2526
- case k.average: {
2527
- const r = t.operator;
2528
- return e.t(`sheet.cf.preview.describe.${r}`, e.t("sheet.cf.subRuleType.average"));
2529
- }
2530
- case k.duplicateValues:
2531
- return e.t("sheet.cf.subRuleType.duplicateValues");
2532
- case k.uniqueValues:
2533
- return e.t("sheet.cf.subRuleType.uniqueValues");
2534
- case k.number: {
2535
- const r = t.operator;
2536
- return e.t(`sheet.cf.preview.describe.${r}`, ...Array.isArray(t.value) ? t.value.map((i) => String(i)) : [String(t.value || "")]);
2537
- }
2538
- case k.text: {
2539
- const r = t.operator;
2540
- return e.t(`sheet.cf.preview.describe.${r}`, t.value || "");
2541
- }
2542
- case k.timePeriod: {
2543
- const r = t.operator;
2544
- return e.t(`sheet.cf.preview.describe.${r}`);
2545
- }
2546
- case k.rank:
2547
- return t.isPercent ? t.isBottom ? e.t("sheet.cf.preview.describe.bottomNPercent", String(t.value)) : e.t("sheet.cf.preview.describe.topNPercent", String(t.value)) : t.isBottom ? e.t("sheet.cf.preview.describe.bottomN", String(t.value)) : e.t("sheet.cf.preview.describe.topN", String(t.value));
2548
- case k.formula:
2549
- return e.t("sheet.cf.ruleType.formula");
2550
- }
2551
- }
2552
- }, Oi = (n) => {
2553
- const { onClick: e } = n, t = q(X), r = q(G), i = q($e), o = q(Q), s = q(te), u = q(ve), l = q(Pe), g = $r(() => r.getCurrentTypeOfUnit$(H.UNIVER_SHEET), void 0, void 0, []), a = g.getUnitId(), d = g.getActiveSheet();
2554
- if (!d)
2555
- throw new Error("No active sheet found");
2556
- const h = d.getSheetId(), [p, y] = N([]), [f, w] = N("2"), [S, R] = N(0), [x, T] = N(""), v = [
2557
- { label: s.t("sheet.cf.panel.workSheet"), value: "2" },
2558
- { label: s.t("sheet.cf.panel.selectedRange"), value: "1" }
2559
- ], b = () => {
2560
- const L = t.getSubunitRules(a, h);
2561
- if (!L || !L.length)
2562
- return [];
2563
- if (f === "1") {
2564
- const A = i.getCurrentLastSelection();
2565
- if (!A)
2566
- return [];
2567
- const Z = A.range;
2568
- return L.filter((ne) => ne.ranges.some((ye) => me.intersects(ye, Z)));
2569
- } else if (f === "2")
2570
- return [...L];
2571
- return [];
2572
- }, [I, C] = N(b);
2573
- Xr(p), J(() => {
2574
- const L = o.onCommandExecuted((A) => {
2575
- A.id === Bt.id && R(Math.random());
2576
- });
2577
- return () => L.dispose();
2578
- }), J(() => {
2579
- C(b);
2580
- }, [f, S, a, h]), J(() => {
2581
- if (f === "2")
2582
- return;
2583
- const L = new Fe((A) => {
2584
- const Z = [hr.id, ee.id, be.id, Ie.id, Rn.id], z = o.onCommandExecuted((ne) => {
2585
- const { id: ye, params: Se } = ne, ue = r.getCurrentUnitOfType(H.UNIVER_SHEET).getUnitId();
2586
- Z.includes(ye) && Se.unitId === ue && A.next(null);
2587
- });
2588
- return () => z.dispose();
2589
- }).pipe(ni(16)).subscribe(() => {
2590
- C(b);
2591
- });
2592
- return () => {
2593
- L.unsubscribe();
2594
- };
2595
- }, [r, f, a, h]), J(() => {
2596
- const L = t.$ruleChange.subscribe(() => {
2597
- R(Math.random());
2598
- });
2599
- return () => L.unsubscribe();
2600
- }, [t]);
2601
- const V = (L) => {
2602
- var z;
2603
- const A = r.getCurrentUnitOfType(H.UNIVER_SHEET).getUnitId(), Z = (z = r.getCurrentUnitOfType(H.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : z.getSheetId();
2604
- if (!A || !Z)
2605
- throw new Error("No active sheet found");
2606
- o.executeCommand(Yt.id, { unitId: A, subUnitId: Z, cfId: L.cfId });
2607
- }, E = (L, A) => {
2608
- var z;
2609
- const Z = _[A.y];
2610
- T((z = Z == null ? void 0 : Z.cfId) != null ? z : "");
2611
- }, U = (L, A, Z) => {
2612
- var Mt, it, ot;
2613
- T("");
2614
- const z = r.getCurrentUnitOfType(H.UNIVER_SHEET).getUnitId(), ne = (Mt = r.getCurrentUnitOfType(H.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : Mt.getSheetId();
2615
- if (!z || !ne)
2616
- throw new Error("No active sheet found");
2617
- const ye = (er) => {
2618
- const tr = _.length;
2619
- return Math.min(tr - 1, Math.max(0, er));
2620
- }, Se = (it = _[ye(A.y)]) == null ? void 0 : it.cfId, ue = (ot = _[ye(Z.y)]) == null ? void 0 : ot.cfId;
2621
- !Se || !ue || Se !== ue && o.executeCommand(Mr.id, { unitId: z, subUnitId: ne, start: { id: Se, type: "self" }, end: { id: ue, type: Z.y > A.y ? "after" : "before" } });
2622
- }, D = () => {
2623
- n.onCreate();
2624
- }, m = () => {
2625
- f === "2" ? o.executeCommand(Tn.id) : f === "1" && I.map((A) => ({ unitId: a, subUnitId: h, cfId: A.cfId })).forEach((A) => {
2626
- o.executeCommand(Yt.id, A);
2627
- });
2628
- }, _ = K(() => {
2629
- const L = r.getCurrentUnitOfType(H.UNIVER_SHEET), A = L.getActiveSheet();
2630
- return I.filter((Z) => {
2631
- const z = Z.ranges;
2632
- return dt(u, L.getUnitId(), A.getSheetId(), z);
2633
- });
2634
- }, [I]), B = K(() => {
2635
- const L = r.getCurrentUnitOfType(H.UNIVER_SHEET), A = L.getActiveSheet();
2636
- return I.every((Z) => {
2637
- const z = Z.ranges;
2638
- return dt(u, L.getUnitId(), A.getSheetId(), z);
2639
- });
2640
- }, [I]);
2641
- return /* @__PURE__ */ F("div", { children: [
2642
- /* @__PURE__ */ F(
2643
- "div",
2644
- {
2645
- className: `
1
+ import{BooleanNumber as e,ColorKit as t,CommandType as n,DependentOn as r,Disposable as i,ICommandService as a,IConfigService as o,IUniverInstanceService as s,Inject as c,Injector as l,InterceptorEffectEnum as u,InterceptorManager as d,LocaleService as f,ObjectMatrix as p,Plugin as m,Range as h,Rectangle as g,Tools as _,UniverInstanceType as v,createInterceptorKey as y,generateRandomId as b,get as x,merge as S,registerDependencies as C,set as w,toDisposable as T,touchDependencies as E}from"@univerjs/core";import{AFTER_CELL_EDIT as ee,AUTO_FILL_APPLY_TYPE as D,AutoFillTools as O,ClearSelectionAllCommand as te,ClearSelectionFormatCommand as ne,IAutoFillService as re,INTERCEPTOR_POINT as ie,RangeMergeUtil as ae,RangeProtectionPermissionEditPoint as oe,RemoveSheetMutation as se,SetSelectionsOperation as ce,SetWorksheetActiveOperation as le,SheetInterceptorService as ue,SheetPermissionCheckController as de,SheetsSelectionsService as fe,WorkbookEditablePermission as pe,WorksheetEditPermission as me,WorksheetSetCellStylePermission as he,checkRangesEditablePermission as ge,createTopMatrixFromMatrix as _e,findAllRectangle as ve,getSheetCommandTarget as k,rangeToDiscreteRange as ye,setEndForRange as be}from"@univerjs/sheets";import{AddCfCommand as xe,AddConditionalRuleMutation as A,AddConditionalRuleMutationUndoFactory as Se,CFNumberOperator as j,CFRuleType as M,CFSubRuleType as N,CFTextOperator as P,CFTimePeriodOperator as F,CFValueType as I,CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH as Ce,ClearRangeCfCommand as we,ClearWorksheetCfCommand as Te,ConditionalFormattingRuleModel as L,ConditionalFormattingService as Ee,ConditionalFormattingViewModel as De,DEFAULT_BG_COLOR as Oe,DEFAULT_FONT_COLOR as ke,DEFAULT_PADDING as Ae,DEFAULT_WIDTH as je,DeleteCfCommand as Me,DeleteConditionalRuleMutation as R,DeleteConditionalRuleMutationUndoFactory as Ne,EMPTY_ICON_TYPE as Pe,MoveCfCommand as Fe,MoveConditionalRuleMutation as Ie,SHEET_CONDITIONAL_FORMATTING_PLUGIN as Le,SetCfCommand as Re,SetConditionalRuleMutation as z,UniverSheetsConditionalFormattingPlugin as ze,compareWithNumber as Be,createCfId as Ve,createDefaultRule as He,createDefaultValue as Ue,createDefaultValueByValueType as We,defaultDataBarNativeColor as Ge,defaultDataBarPositiveColor as Ke,getColorScaleFromValue as qe,getOppositeOperator as Je,iconGroup as Ye,iconMap as Xe,removeUndefinedAttr as Ze,setConditionalRuleMutationUndoFactory as Qe}from"@univerjs/sheets-conditional-formatting";import{ComponentManager as $e,ILayoutService as et,IMenuManagerService as tt,ISidebarService as nt,MenuItemType as rt,RibbonDataGroup as it,getMenuHiddenObservable as at,useDependency as B,useObservable as ot,useScrollYOverContainer as st,useSidebarClick as ct}from"@univerjs/ui";import{forwardRef as lt,useEffect as V,useMemo as H,useRef as U,useState as W}from"react";import{Button as ut,Checkbox as dt,ColorPicker as ft,DraggableList as pt,Dropdown as mt,Input as ht,InputNumber as gt,Radio as _t,RadioGroup as vt,Select as G,Tooltip as yt,borderClassName as bt,clsx as K}from"@univerjs/design";import{deserializeRangeWithSheet as xt,serializeRange as St}from"@univerjs/engine-formula";import{FormulaEditor as Ct,RangeSelector as wt}from"@univerjs/sheets-formula-ui";import{BoldIcon as Tt,DeleteIcon as Et,FontColorDoubleIcon as Dt,IncreaseIcon as Ot,ItalicIcon as kt,MoreDownIcon as At,PaintBucketDoubleIcon as jt,SequenceIcon as Mt,SlashDoubleIcon as Nt,StrikethroughIcon as Pt,UnderlineIcon as Ft}from"@univerjs/icons";import{Fragment as It,jsx as q,jsxs as J}from"react/jsx-runtime";import{COPY_TYPE as Lt,FormatPainterStatus as Rt,IFormatPainterService as zt,ISheetClipboardService as Bt,PREDEFINED_HOOK_NAME_PASTE as Vt,SheetSkeletonManagerService as Ht,getCurrentRangeDisable$ as Ut,getRepeatRange as Wt,useHighlightRange as Gt,virtualizeDiscreteRanges as Kt}from"@univerjs/sheets-ui";import{Observable as qt,debounceTime as Jt,merge as Yt}from"rxjs";import{FormulaRefRangeService as Xt,UniverSheetsFormulaPlugin as Zt}from"@univerjs/sheets-formula";import{IRenderManagerService as Qt}from"@univerjs/engine-render";import{bufferTime as $t,debounceTime as en,filter as tn}from"rxjs/operators";const nn={type:n.COMMAND,id:`sheet.command.add-average-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,style:r,stopIfTrue:i,operator:o}=t,c=e.get(L),l=e.get(a),u=k(e.get(s));if(!u)return!1;let{unitId:d,subUnitId:f}=u,p={ranges:n,cfId:c.createCfId(d,f),stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.average,operator:o,style:r}};return l.executeCommand(A.id,{unitId:d,subUnitId:f,rule:p})}},rn={type:n.COMMAND,id:`sheet.command.add-color-scale-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,config:r,stopIfTrue:i}=t,o=e.get(L),c=e.get(a),l=k(e.get(s));if(!l)return!1;let{unitId:u,subUnitId:d}=l,f={ranges:n,cfId:o.createCfId(u,d),stopIfTrue:!!i,rule:{type:M.colorScale,config:r}};return c.executeCommand(A.id,{unitId:u,subUnitId:d,rule:f})}},an={type:n.COMMAND,id:`sheet.command.add-data-bar-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,min:r,max:i,nativeColor:o,positiveColor:c,isGradient:l,stopIfTrue:u,isShowValue:d}=t,f=e.get(L),p=k(e.get(s));if(!p)return!1;let{unitId:m,subUnitId:h}=p,g=e.get(a),_={ranges:n,cfId:f.createCfId(m,h),stopIfTrue:!!u,rule:{type:M.dataBar,isShowValue:d,config:{min:r,max:i,nativeColor:o,positiveColor:c,isGradient:l}}};return g.executeCommand(A.id,{unitId:m,subUnitId:h,rule:_})}},on={type:n.COMMAND,id:`sheet.command.add-duplicate-values-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,style:r,stopIfTrue:i}=t,o=e.get(L),c=e.get(a),l=k(e.get(s));if(!l)return!1;let{unitId:u,subUnitId:d}=l,f={ranges:n,cfId:o.createCfId(u,d),stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.duplicateValues,style:r}};return c.executeCommand(A.id,{unitId:u,subUnitId:d,rule:f})}},sn={type:n.COMMAND,id:`sheet.command.add-number-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,style:r,stopIfTrue:i,operator:o,value:c}=t,l=e.get(L),u=e.get(a),d=k(e.get(s));if(!d)return!1;let{unitId:f,subUnitId:p}=d,m=l.createCfId(f,p),h;if([j.between,j.notBetween].includes(o)){let e=c;if(e.length!==2||!Array.isArray(e))return!1;h={ranges:n,cfId:m,stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.number,operator:o,style:r,value:e}}}else{let e=c;if(typeof e!=`number`)return!1;h={ranges:n,cfId:m,stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.number,operator:o,style:r,value:e}}}return u.executeCommand(A.id,{unitId:f,subUnitId:p,rule:h})}},cn={type:n.COMMAND,id:`sheet.command.add-rank-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,style:r,stopIfTrue:i,isPercent:o,isBottom:c,value:l}=t,u=e.get(L),d=e.get(s),f=e.get(a),p=k(d);if(!p)return!1;let{unitId:m,subUnitId:h}=p,g={ranges:n,cfId:u.createCfId(m,h),stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.rank,isPercent:o,isBottom:c,style:r,value:l}};return f.executeCommand(A.id,{unitId:m,subUnitId:h,rule:g})}},ln={type:n.COMMAND,id:`sheet.command.add-text-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,style:r,stopIfTrue:i,operator:o,value:c}=t,l=e.get(L),u=k(e.get(s));if(!u)return!1;let{unitId:d,subUnitId:f}=u,p=e.get(a),m={ranges:n,cfId:l.createCfId(d,f),stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.text,operator:o,style:r,value:c}};return p.executeCommand(A.id,{unitId:d,subUnitId:f,rule:m})}},un={type:n.COMMAND,id:`sheet.command.add-time-period-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,style:r,stopIfTrue:i,operator:o}=t,c=e.get(L),l=e.get(s),u=e.get(a),d=k(l);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:n,cfId:c.createCfId(f,p),stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.timePeriod,operator:o,style:r}};return u.executeCommand(A.id,{unitId:f,subUnitId:p,rule:m})}},dn={type:n.COMMAND,id:`sheet.command.add-uniqueValues-conditional-rule`,handler(e,t){if(!t)return!1;let{ranges:n,style:r,stopIfTrue:i}=t,o=e.get(L),c=e.get(s),l=e.get(a),u=k(c);if(!u)return!1;let{unitId:d,subUnitId:f}=u,p={ranges:n,cfId:o.createCfId(d,f),stopIfTrue:!!i,rule:{type:M.highlightCell,subType:N.uniqueValues,style:r}};return l.executeCommand(A.id,{unitId:d,subUnitId:f,rule:p})}},fn=e=>{let{color:n,onChange:r,disable:i=!1,Icon:a=jt,className:o}=e,s=H(()=>new t(n),[n]),c=()=>q(a,{className:K(`univer-fill-primary-600`,i&&o),extend:{colorChannel1:s.isValid?n:``}});return i?c():q(mt,{overlay:q(`div`,{className:`univer-rounded-lg univer-p-4`,children:q(ft,{value:n,onChange:r})}),children:q(`span`,{className:K(`
2
+ univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1
3
+ hover:univer-bg-gray-100
4
+ dark:hover:!univer-bg-gray-700
5
+ `,o),children:c()})})},pn=n=>{let r=n.rule;if(!r)return null;let i=H(()=>{if(r.type===M.colorScale){let e=r.config.map((e,n)=>({color:new t(e.color),value:n})),n=e.length-1;return[,,,,,].fill(``).map((e,t,r)=>t*n/(r.length-1)).map(t=>qe(e,t))}return null},[r]),a=H(()=>{if(r.type===M.iconSet)return r.config.map(e=>{let t=Xe[e.iconType];return t&&t[Number(e.iconId)]})},[r]),o=`univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs`;switch(r.type){case M.dataBar:{var s,c;let{isGradient:e}=r.config,t=e?`linear-gradient(to right, ${r.config.positiveColor||Ke}, rgb(255 255 255))`:r.config.positiveColor;return J(`div`,{className:o,children:[q(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:e?`linear-gradient(to right, rgb(255 255 255),${r.config.nativeColor||Ge})`:r.config.nativeColor,borderColor:(s=r.config.nativeColor)==null?Ge:s}}),q(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:t,borderColor:(c=r.config.positiveColor)==null?Ke:c}})]})}case M.colorScale:return i&&q(`div`,{className:o,children:i.map((e,t)=>q(`div`,{className:`univer-h-full`,style:{width:`${100/i.length}%`,background:e}},t))});case M.iconSet:return a&&q(`div`,{className:o,children:a.map((e,t)=>e?q(`img`,{className:`univer-h-full`,src:e,draggable:!1},t):q(Nt,{},t))});case M.highlightCell:{var l,u,d;let{ul:t,st:n,it:i,bl:a,bg:s,cl:c}=r.style,f=(t==null?void 0:t.s)===e.TRUE,p=(n==null?void 0:n.s)===e.TRUE,m=i===e.TRUE,h=a===e.TRUE,g=(l=s==null?void 0:s.rgb)==null?Oe:l,_=(u=c==null?void 0:c.rgb)==null?ke:u,v={textDecoration:(d=`${f?`underline`:``} ${p?`line-through`:``}`.replace(/^ /,``))==null?void 0:d,backgroundColor:g,color:_};return q(`div`,{className:K(o,{"univer-font-bold":h,"univer-italic":m}),style:v,children:`123`})}}},mn=K(`univer-mt-5 univer-px-1 univer-py-2 univer-rounded`,bt),hn=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),gn=e=>{var t;let{type:n,className:r,onChange:i,id:a,value:o}=e,c=B(s),l=c.getCurrentUnitForType(v.UNIVER_SHEET).getUnitId(),u=(t=c.getCurrentUnitForType(v.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId(),d=H(()=>String(o).startsWith(`=`)?String(o):`=`,[o]),f=H(()=>[I.max,I.min,`none`].includes(n)?{disabled:!0}:[I.percent,I.percentile].includes(n)?{min:0,max:100}:{min:-(2**53-1),max:2**53-1},[n]),p=U(null),[m,h]=W(!1);return ct(e=>{var t;(t=p.current)!=null&&t.isClickOutSide(e)&&h(!1)}),n===I.formula?q(`div`,{className:`univer-ml-1 univer-w-full`,children:q(Ct,{ref:p,className:K(`
6
+ univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
7
+ univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
8
+ hover:univer-border-primary-600
9
+ dark:!univer-bg-gray-700 dark:!univer-text-white
10
+ [&>div:first-child]:univer-px-2.5
11
+ [&>div]:univer-h-5 [&>div]:univer-ring-transparent
12
+ `,bt),initValue:d,unitId:l,subUnitId:u,isFocus:m,onChange:(e=``)=>{i(e||``)},onFocus:()=>h(!0)})}):q(gt,{className:r,value:Number(e.value)||0,onChange:t=>e.onChange(t||0),...f})},_n=e=>{var t;let{interceptorManager:n}=e,r=B(f),i=((t=e.rule)==null?void 0:t.type)===M.colorScale?e.rule:void 0,a=[hn(I.num,r),hn(I.percent,r),hn(I.percentile,r),hn(I.formula,r)],o=[hn(I.min,r),...a],s=[hn(`none`,r),...a],c=[hn(I.max,r),...a],[l,u]=W(()=>{var e;let t=I.min;return i&&((e=i.config[0])==null?void 0:e.value.type)||t}),[d,p]=W(()=>{var e;let t=`none`;return!i||i.config.length!==3?t:((e=i.config[1])==null?void 0:e.value.type)||t}),[m,h]=W(()=>{var e;let t=I.max;return i&&((e=i.config[i.config.length-1])==null?void 0:e.value.type)||t}),[g,_]=W(()=>{if(!i)return 10;let e=i.config[0];return(e==null?void 0:e.value.value)===void 0?10:e==null?void 0:e.value.value}),[v,y]=W(()=>{var e;if(!i||i.config.length!==3)return 50;let t=(e=i.config[1])==null?void 0:e.value.value;return t===void 0?50:t}),[b,x]=W(()=>{var e;if(!i)return 90;let t=(e=i.config[i.config.length-1])==null?void 0:e.value.value;return t===void 0?90:t}),[S,C]=W(()=>{var e;return i&&((e=i.config[0])==null?void 0:e.color)||`#d0d9fb`}),[w,T]=W(()=>{var e;let t=`#7790f3`;return!i||i.config.length!==3?t:((e=i.config[1])==null?void 0:e.color)||t}),[E,ee]=W(()=>{var e;return i&&((e=i.config[i.config.length-1])==null?void 0:e.color)||`#2e55ef`}),D=H(()=>e=>{let{minType:t,medianType:n,maxType:r,minValue:i,medianValue:a,maxValue:o,minColor:s,medianColor:c,maxColor:l}=e,u=[];return u.push({color:s,value:{type:t,value:i}}),n!==`none`&&u.push({color:c,value:{type:n,value:a}}),u.push({color:l,value:{type:r,value:o}}),{config:u.map((e,t)=>({...e,index:t})),type:M.colorScale}},[]);V(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return D({minType:l,medianType:d,maxType:m,minValue:g,medianValue:v,maxValue:b,minColor:S,medianColor:w,maxColor:E})}}),[D,l,d,m,g,v,b,S,w,E,n]);let O=t=>{e.onChange(D(t))};return J(`div`,{children:[q(`div`,{className:`
13
+ univer-mt-4 univer-text-sm univer-text-gray-600
14
+ dark:!univer-text-gray-200
15
+ `,children:r.t(`sheet.cf.panel.styleRule`)}),q(`div`,{className:mn,children:q(pn,{rule:D({minType:l,medianType:d,maxType:m,minValue:g,medianValue:v,maxValue:b,minColor:S,medianColor:w,maxColor:E})})}),q(`div`,{className:`
16
+ univer-mt-3 univer-text-xs univer-text-gray-600
17
+ dark:!univer-text-gray-200
18
+ `,children:r.t(`sheet.cf.valueType.min`)}),J(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center`,children:[q(G,{className:`univer-flex-shrink-0`,options:o,value:l,onChange:e=>{u(e);let t=We(e,10);_(t),O({minType:e,medianType:d,maxType:m,minValue:t,medianValue:v,maxValue:b,minColor:S,medianColor:w,maxColor:E})}}),q(gn,{id:`min`,className:`univer-ml-1`,value:g,type:l,onChange:e=>{_(e),O({minType:l,medianType:d,maxType:m,minValue:e,medianValue:v,maxValue:b,minColor:S,medianColor:w,maxColor:E})}}),q(fn,{className:`univer-ml-1`,color:S,onChange:e=>{C(e),O({minType:l,medianType:d,maxType:m,minValue:g,medianValue:v,maxValue:b,minColor:e,medianColor:w,maxColor:E})}})]}),q(`div`,{className:`
19
+ univer-text-gray-600dark:!univer-text-gray-200
20
+ univer-mt-3 univer-text-xs
21
+ `,children:r.t(`sheet.cf.panel.medianValue`)}),J(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center`,children:[q(G,{className:`univer-flex-shrink-0`,options:s,value:d,onChange:e=>{p(e);let t=We(e,50);y(t),O({minType:l,medianType:e,maxType:m,minValue:g,medianValue:t,maxValue:b,minColor:S,medianColor:w,maxColor:E})}}),q(gn,{id:`median`,className:`univer-ml-1`,value:v,type:d,onChange:e=>{y(e),O({minType:l,medianType:d,maxType:m,minValue:g,medianValue:e,maxValue:b,minColor:S,medianColor:w,maxColor:E})}}),d!==`none`&&q(fn,{className:`univer-ml-1`,color:w,onChange:e=>{T(e),O({minType:l,medianType:d,maxType:m,minValue:g,medianValue:v,maxValue:b,minColor:S,medianColor:e,maxColor:E})}})]}),q(`div`,{className:`
22
+ univer-mt-3 univer-text-xs univer-text-gray-600
23
+ dark:!univer-text-gray-200
24
+ `,children:r.t(`sheet.cf.valueType.max`)}),J(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center`,children:[q(G,{className:`univer-flex-shrink-0`,options:c,value:m,onChange:e=>{h(e);let t=We(e,90);x(t),O({minType:l,medianType:d,maxType:e,minValue:g,medianValue:v,maxValue:t,minColor:S,medianColor:w,maxColor:E})}}),q(gn,{id:`max`,className:`univer-ml-1`,value:b,type:m,onChange:e=>{x(e),O({minType:l,medianType:d,maxType:m,minValue:g,medianValue:v,maxValue:e,minColor:S,medianColor:w,maxColor:E})}}),q(fn,{className:`univer-ml-1`,color:E,onChange:e=>{ee(e),O({minType:l,medianType:d,maxType:m,minValue:g,medianValue:v,maxValue:b,minColor:S,medianColor:w,maxColor:e})}})]})]})},vn=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),yn=e=>{var t;let{onChange:n,className:r,value:i,type:a,id:o,disabled:c=!1}=e,l=B(s),u=l.getCurrentUnitOfType(v.UNIVER_SHEET).getUnitId(),d=(t=l.getCurrentUnitOfType(v.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId(),f=U(null),[p,m]=W(!1);ct(e=>{var t;(t=f.current)!=null&&t.isClickOutSide(e)&&m(!1)});let h=U(i),g=H(()=>[I.percentile,I.percent].includes(a)?{max:100,min:0}:{min:-(2**53-1),max:2**53-1},[a]);if(a===I.formula){let e=String(h.current).startsWith(`=`)?String(h.current)||``:`=`;return q(`div`,{className:`univer-ml-3 univer-w-full`,children:q(Ct,{ref:f,className:K(`
25
+ univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
26
+ univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
27
+ hover:univer-border-primary-600
28
+ dark:!univer-bg-gray-700 dark:!univer-text-white
29
+ [&>div:first-child]:univer-px-2.5
30
+ [&>div]:univer-h-5 [&>div]:univer-ring-transparent
31
+ `,bt),initValue:e,unitId:u,subUnitId:d,isFocus:p,onChange:(e=``)=>{n(e||``)},onFocus:()=>m(!0)})})}return q(gt,{className:r,value:Number(i)||0,disabled:c,onChange:e=>{n(e||0)},...g})},bn=e=>{var t;let{interceptorManager:n}=e,r=B(f),i=((t=e.rule)==null?void 0:t.type)===M.dataBar?e.rule:void 0,[a,o]=W(()=>{var e;return i&&(e=i.config)!=null&&e.isGradient?`1`:`0`}),[s,c]=W(()=>{var e;return i&&((e=i.config)==null?void 0:e.positiveColor)||Ke}),[l,u]=W(()=>{var e;return i&&((e=i.config)==null?void 0:e.nativeColor)||Ge}),d=[vn(I.num,r),vn(I.percent,r),vn(I.percentile,r),vn(I.formula,r)],p=[vn(I.min,r),...d],m=[vn(I.max,r),...d],[h,g]=W(()=>{var e;let t=p[0].value;return i&&((e=i.config)==null?void 0:e.min.type)||t}),[_,v]=W(()=>{var e;let t=m[0].value;return i&&((e=i.config)==null?void 0:e.max.type)||t}),[y,b]=W(()=>{var e;if(!i)return 0;let t=((e=i.config)==null?void 0:e.min)||{};return t.type===I.formula?t.value||`=`:t.value||0}),[x,S]=W(()=>{var e;if(!i)return 100;let t=((e=i.config)==null?void 0:e.max)||{};return t.type===I.formula?t.value||`=`:t.value===void 0?100:t.value}),[C,w]=W(()=>i?i.isShowValue===void 0?!0:!!i.isShowValue:!0),T=e=>({config:{min:{type:e.minValueType,value:e.minValue},max:{type:e.maxValueType,value:e.maxValue},isGradient:e.isGradient===`1`,positiveColor:e.positiveColor||Ke,nativeColor:e.nativeColor||Ge},type:M.dataBar,isShowValue:e.isShowValue});V(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return T({isGradient:a,minValue:y,minValueType:h,maxValue:x,maxValueType:_,positiveColor:s,nativeColor:l,isShowValue:C})}}),[a,y,h,x,_,s,l,n,C]);let E=t=>{e.onChange(T(t))},ee=e=>{c(e),E({isGradient:a,minValue:y,minValueType:h,maxValue:x,maxValueType:_,positiveColor:e,nativeColor:l,isShowValue:C})},D=e=>{u(e),E({isGradient:a,minValue:y,minValueType:h,maxValue:x,maxValueType:_,positiveColor:s,nativeColor:e,isShowValue:C})},O=e=>d.map(e=>e.value).includes(e);return J(`div`,{children:[q(`div`,{className:`
32
+ univer-mt-4 univer-text-sm univer-text-gray-600
33
+ dark:!univer-text-gray-200
34
+ `,children:r.t(`sheet.cf.panel.styleRule`)}),q(`div`,{className:mn,children:q(pn,{rule:T({isGradient:a,minValue:y,minValueType:h,maxValue:x,maxValueType:_,positiveColor:s,nativeColor:l,isShowValue:C})})}),J(`div`,{children:[q(`div`,{className:`
35
+ univer-mt-3 univer-text-sm univer-text-gray-600
36
+ dark:!univer-text-gray-200
37
+ `,children:r.t(`sheet.cf.panel.fillType`)}),J(`div`,{className:`univer-ml-1 univer-mt-3 univer-flex univer-items-center`,children:[J(vt,{value:a,onChange:e=>{o(e),E({isGradient:e,minValue:y,minValueType:h,maxValue:x,maxValueType:_,positiveColor:s,nativeColor:l,isShowValue:C})},children:[q(_t,{value:`0`,children:q(`span`,{className:`univer-text-xs`,children:r.t(`sheet.cf.panel.pureColor`)})}),q(_t,{value:`1`,children:q(`span`,{className:`univer-text-xs`,children:r.t(`sheet.cf.panel.gradient`)})})]}),J(`div`,{className:`univer-ml-6 univer-flex univer-items-center univer-text-xs`,children:[q(dt,{checked:!C,onChange:e=>{w(!e),E({isGradient:e,minValue:y,minValueType:h,maxValue:x,maxValueType:_,positiveColor:s,nativeColor:l,isShowValue:!e})}}),r.t(`sheet.cf.panel.onlyShowDataBar`)]})]})]}),J(`div`,{children:[q(`div`,{className:`
38
+ univer-mt-3 univer-text-sm univer-text-gray-600
39
+ dark:!univer-text-gray-200
40
+ `,children:r.t(`sheet.cf.panel.colorSet`)}),J(`div`,{className:`univer-ml-1 univer-mt-3 univer-flex univer-items-center`,children:[J(`div`,{className:`univer-flex univer-items-center`,children:[q(`div`,{className:`univer-text-xs`,children:r.t(`sheet.cf.panel.native`)}),q(fn,{color:l,onChange:D})]}),J(`div`,{className:`univer-ml-3 univer-flex univer-items-center`,children:[q(`div`,{className:`univer-text-xs`,children:r.t(`sheet.cf.panel.positive`)}),q(fn,{color:s,onChange:ee})]})]})]}),J(`div`,{children:[q(`div`,{className:`
41
+ univer-mt-3 univer-text-sm univer-text-gray-600
42
+ dark:!univer-text-gray-200
43
+ `,children:r.t(`sheet.cf.valueType.min`)}),J(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[q(G,{className:`univer-w-1/2 univer-flex-shrink-0`,options:p,value:h,onChange:e=>{g(e);let t=We(e,10);b(t),E({isGradient:a,minValue:t,minValueType:e,maxValue:x,maxValueType:_,positiveColor:s,nativeColor:l,isShowValue:C})}}),q(yn,{id:`min`,className:`univer-ml-3`,disabled:!O(h),type:h,value:y,onChange:e=>{b(e||0),E({isGradient:a,minValue:e||0,minValueType:h,maxValue:x,maxValueType:_,positiveColor:s,nativeColor:l,isShowValue:C})}})]}),q(`div`,{className:`
44
+ univer-mt-3 univer-text-sm univer-text-gray-600
45
+ dark:!univer-text-gray-200
46
+ `,children:r.t(`sheet.cf.valueType.max`)}),J(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[q(G,{className:`univer-w-1/2 univer-flex-shrink-0`,options:m,value:_,onChange:e=>{v(e);let t=We(e,90);S(t),E({isGradient:a,minValue:y,minValueType:h,maxValue:t,maxValueType:e,positiveColor:s,nativeColor:l,isShowValue:C})}}),q(yn,{className:`univer-ml-3`,disabled:!O(_),id:`max`,type:_,value:x,onChange:e=>{S(e||0),E({isGradient:a,minValue:y,minValueType:h,maxValue:e||0,maxValueType:_,positiveColor:s,nativeColor:l,isShowValue:C})}})]})]})]})},xn=t=>[e.FALSE,void 0].includes(t)?e.TRUE:e.FALSE,Sn=t=>t!==e.FALSE,Cn=t=>{let{style:n,onChange:r,className:i}=t,[a,o]=W(()=>{if(n!=null&&n.bl)return n.bl}),[s,c]=W(()=>{if(n!=null&&n.it)return n.it}),[l,u]=W(()=>{if(n!=null&&n.ul)return n.ul.s}),[d,f]=W(()=>{if(n!=null&&n.st)return n.st.s}),[p,m]=W(()=>{var e;return!(n==null||(e=n.cl)==null)&&e.rgb?n.cl.rgb:`#2f56ef`}),[h,g]=W(()=>{var e;return!(n==null||(e=n.bg)==null)&&e.rgb?n.bg.rgb:`#e8ecfc`});V(()=>{let e={bl:a,it:s};p!==void 0&&(e.cl={rgb:p}),h!==void 0&&(e.bg={rgb:h}),d!==void 0&&(e.st={s:d}),l!==void 0&&(e.ul={s:l}),r(Ze(e))},[a,s,l,d,p,h]);let _=`univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1`;return J(`div`,{className:K(`univer-my-2.5 univer-flex univer-justify-between`,i),children:[q(`div`,{className:K(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Sn(a||e.FALSE)}),onClick:()=>o(xn(a)),children:q(Tt,{})}),q(`div`,{className:K(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Sn(s||e.FALSE)}),onClick:()=>c(xn(s)),children:q(kt,{})}),q(`div`,{className:K(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Sn(l||e.FALSE)}),onClick:()=>u(xn(l)),children:q(Ft,{})}),q(`div`,{className:K(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Sn(d||e.FALSE)}),onClick:()=>f(xn(d)),children:q(Pt,{})}),q(fn,{color:p,onChange:m,Icon:Dt}),q(fn,{color:h,onChange:g})]})},wn=e=>{var t;let{onChange:n,interceptorManager:r}=e,i=B(f),a=B(s).getCurrentUnitForType(v.UNIVER_SHEET),o=a.getActiveSheet(),c=((t=e.rule)==null?void 0:t.type)===M.highlightCell?e.rule:void 0,l=U(null),[u,d]=W(!1),p=U(null),[m,h]=W({}),[g,_]=W(()=>(c==null?void 0:c.subType)===N.formula?c.value:`=`),[y,b]=W(void 0),x=e=>({style:e.style,value:g,type:M.highlightCell,subType:N.formula});V(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return x({style:m,formula:g})}}),[m,g,r]),V(()=>r.intercept(r.getInterceptPoints().beforeSubmit,{handler:(e,t,n)=>y||g.length===1||!g.startsWith(`=`)?(b(i.t(`sheet.cf.errorMessage.formulaError`)),!1):n(e)}),[y,g]);let S=e=>{n(x(e))};return ct(e=>{var t;(t=p.current)!=null&&t.isClickOutSide(e)&&d(!1)}),J(`div`,{ref:l,children:[q(`div`,{className:`
47
+ univer-mt-4 univer-text-sm univer-text-gray-600
48
+ dark:!univer-text-gray-200
49
+ `,children:i.t(`sheet.cf.panel.styleRule`)}),q(`div`,{className:`univer-mt-3`,children:q(Ct,{ref:p,className:K(`
50
+ univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
51
+ univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
52
+ hover:univer-border-primary-600
53
+ dark:!univer-bg-gray-700 dark:!univer-text-white
54
+ [&>div:first-child]:univer-px-2.5
55
+ [&>div]:univer-h-5 [&>div]:univer-ring-transparent
56
+ `,bt),errorText:y,isFocus:u,initValue:g,unitId:a.getUnitId(),subUnitId:o==null?void 0:o.getSheetId(),onFocus:()=>{d(!0)},onChange:e=>{_(e),S({style:m,formula:e})},onVerify:(e,t)=>{!e||t.length===1?b(i.t(`sheet.cf.errorMessage.formulaError`)):b(void 0)}})}),q(`div`,{className:mn,children:q(pn,{rule:x({style:m,formula:g})})}),q(Cn,{style:c==null?void 0:c.style,className:`univer-mt-3`,onChange:e=>{h(e),S({style:e,formula:g})}})]})},Tn=e=>J(`div`,{className:`univer-relative`,children:[q(`div`,{className:`univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500`,children:e.errorText}),e.children]}),Y=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),En=e=>{let{type:t,operator:n,onChange:r,value:i,interceptorManager:a}=e,o=B(f),[s,c]=W(()=>typeof i==`number`?i:0),[l,u]=W(``),[d,p]=W(()=>typeof i==`string`?i:``),[m,h]=W(``),[g,_]=W(()=>Array.isArray(i)?i[0]===void 0?0:i[0]:0),[v,y]=W(``),[b,x]=W(()=>Array.isArray(i)?i[1]===void 0?100:i[1]:100),[S,C]=W(``);switch(V(()=>{switch(t){case N.text:[P.beginsWith,P.endsWith,P.containsText,P.notContainsText,P.equal,P.notEqual].includes(n)&&r(d);break;case N.number:[j.equal,j.notEqual,j.greaterThan,j.greaterThanOrEqual,j.lessThan,j.lessThanOrEqual].includes(n)&&r(s),[j.between,j.notBetween].includes(n)&&r([g,b]);break}},[t]),V(()=>{let e=a.intercept(a.getInterceptPoints().beforeSubmit,{handler:(e,r,i)=>{switch(t){case N.text:if([P.beginsWith,P.containsText,P.endsWith,P.notEqual,P.notContainsText,P.equal].includes(n))return d?i(e):(h(o.t(`sheet.cf.errorMessage.notBlank`)),!1)}return i(e)}});return()=>{e()}},[t,s,d,n]),t){case N.text:if([P.beginsWith,P.endsWith,P.containsText,P.notContainsText,P.equal,P.notEqual].includes(n)){let e=e=>{p(e),r(e)};return q(`div`,{className:`univer-mt-3`,children:q(Tn,{errorText:m,children:q(ht,{value:d,onChange:t=>{h(``),e(t)}})})})}break;case N.number:if([j.equal,j.notEqual,j.greaterThan,j.greaterThanOrEqual,j.lessThan,j.lessThanOrEqual].includes(n))return q(`div`,{className:`univer-mt-3`,children:q(Tn,{errorText:l,children:q(gt,{className:`univer-w-full`,min:-(2**53-1),max:2**53-1,value:s,onChange:e=>{c(e||0),r(e||0),u(``)}})})});if([j.between,j.notBetween].includes(n))return J(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[q(Tn,{errorText:v,children:q(gt,{min:-(2**53-1),max:2**53-1,value:g,onChange:e=>{_(e||0),r([e||0,b]),y(``)}})}),q(Tn,{errorText:S,children:q(gt,{className:`univer-ml-3`,min:-(2**53-1),max:2**53-1,value:b,onChange:e=>{x(e||0),r([g,e||0]),C(``)}})})]})}return null},Dn=(e,t)=>{switch(e){case N.text:return[Y(P.containsText,t),Y(P.notContainsText,t),Y(P.beginsWith,t),Y(P.endsWith,t),Y(P.equal,t),Y(P.notEqual,t),Y(P.containsBlanks,t),Y(P.notContainsBlanks,t),Y(P.containsErrors,t),Y(P.notContainsErrors,t)];case N.number:return[Y(j.between,t),Y(j.notBetween,t),Y(j.equal,t),Y(j.notEqual,t),Y(j.greaterThan,t),Y(j.greaterThanOrEqual,t),Y(j.lessThan,t),Y(j.lessThanOrEqual,t)];case N.timePeriod:return[Y(F.yesterday,t),Y(F.today,t),Y(F.tomorrow,t),Y(F.last7Days,t),Y(F.lastWeek,t),Y(F.thisWeek,t),Y(F.nextWeek,t),Y(F.lastMonth,t),Y(F.thisMonth,t),Y(F.nextMonth,t)]}},On=e=>{var t;let{interceptorManager:n,onChange:r}=e,i=B(f),a=((t=e.rule)==null?void 0:t.type)===M.highlightCell?e.rule:void 0,[o,s]=W(()=>{let e=N.text;return a&&a.subType||e}),c=[{value:N.text,label:i.t(`sheet.cf.subRuleType.text`)},{value:N.number,label:i.t(`sheet.cf.subRuleType.number`)},{value:N.timePeriod,label:i.t(`sheet.cf.subRuleType.timePeriod`)},{value:N.duplicateValues,label:i.t(`sheet.cf.subRuleType.duplicateValues`)},{value:N.uniqueValues,label:i.t(`sheet.cf.subRuleType.uniqueValues`)}],l=H(()=>Dn(o,i),[o]),[u,d]=W(()=>{let e=l?l[0].value:void 0;return a&&a.operator||e}),[p,m]=W(()=>{var e;return a?(e=a.value)==null?Ue(a.subType,a.operator):e:``}),[h,g]=W({}),_=H(()=>e=>{var t,n,r;switch(e.subType||o){case N.text:if([P.beginsWith,P.endsWith,P.containsText,P.notContainsText,P.equal,P.notEqual].includes(u)){var i,a,s,c;return{type:M.highlightCell,subType:(i=e.subType)==null?o:i,operator:(a=e.operator)==null?u:a,style:(s=e.style)==null?h:s,value:(c=e.value)==null?p:c}}break;case N.number:if([j.equal,j.notEqual,j.greaterThan,j.greaterThanOrEqual,j.lessThan,j.lessThanOrEqual].includes(u)){var l,d,f,m;return{type:M.highlightCell,subType:(l=e.subType)==null?o:l,operator:(d=e.operator)==null?u:d,style:(f=e.style)==null?h:f,value:(m=e.value)==null?p:m}}if([j.between,j.notBetween].includes(u)){var g,_,v,y;return{type:M.highlightCell,subType:(g=e.subType)==null?o:g,operator:(_=e.operator)==null?u:_,style:(v=e.style)==null?h:v,value:(y=e.value)==null?p:y}}break}return{type:M.highlightCell,subType:(t=e.subType)==null?o:t,operator:(n=e.operator)==null?u:n,style:(r=e.style)==null?h:r}},[o,u,p,h]);V(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return _({})}}),[_,n]),V(()=>{c.some(e=>e.value===o)||s(c[0].value)},[c]);let v=e=>{let t=e,n=Dn(t,i),a=n&&n[0].value;s(t),d(a),a&&m(Ue(t,a)),r(_({subType:t,operator:a}))},y=e=>{let t=e;d(t),r(_({operator:t}))},b=e=>{m(e),r(_({value:e}))},x=H(()=>`${o}_${u}_${Math.random()}`,[o,u]);return J(`div`,{children:[q(`div`,{className:`
57
+ univer-mt-4 univer-text-sm univer-text-gray-600
58
+ dark:!univer-text-gray-200
59
+ `,children:i.t(`sheet.cf.panel.styleRule`)}),J(`div`,{className:`univer-flex univer-justify-between univer-gap-4`,children:[q(G,{className:`univer-mt-3 univer-w-full`,onChange:v,value:o,options:c}),(l==null?void 0:l.length)&&q(G,{className:`univer-mt-3 univer-w-full`,onChange:y,value:u||``,options:l})]}),q(En,{value:p,interceptorManager:n,type:o,operator:u,rule:a,onChange:b},x),q(`div`,{className:mn,children:q(pn,{rule:_({})})}),q(Cn,{style:a==null?void 0:a.style,className:`univer-ml-1`,onChange:e=>{g(e),r(_({style:e}))}})]})},kn=(e,t)=>(Xe[e]||[])[Number(t)]||``,An=e=>{var t;let{error:n,type:r,onChange:i}=e,a=B(s),o=a.getCurrentUnitForType(v.UNIVER_SHEET).getUnitId(),c=(t=a.getCurrentUnitForType(v.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId(),l=U(null),[u,d]=W(!1);return ct(e=>{var t;(t=l.current)!=null&&t.isClickOutSide(e)&&d(!1)}),q(`div`,{className:`univer-relative`,children:r===I.formula?q(`div`,{className:`univer-w-full`,children:q(Ct,{ref:l,className:K(`
60
+ univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
61
+ univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
62
+ hover:univer-border-primary-600
63
+ dark:!univer-bg-gray-700 dark:!univer-text-white
64
+ [&>div:first-child]:univer-px-2.5
65
+ [&>div]:univer-h-5 [&>div]:univer-ring-transparent
66
+ `,bt),initValue:String(e.value),unitId:o,subUnitId:c,isFocus:u,onChange:(e=``)=>{i(e||``)},onFocus:()=>d(!0)})}):J(It,{children:[q(gt,{className:K({"univer-border-red-500":n}),value:Number(e.value)||0,onChange:e=>i(e==null?0:e)}),n&&q(`div`,{className:`univer-absolute univer-text-xs univer-text-red-500`,children:n})]})})},jn=(e,t,n)=>({operator:j.greaterThan,value:{type:I.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),Mn=lt((e,t)=>{let{onClick:n}=e,r=B(f),i=e=>{n(e)};return q(`div`,{ref:t,className:`univer-w-80`,children:Ye.map((e,t)=>J(`div`,{className:`univer-mb-3`,children:[q(`div`,{className:`univer-mb-1 univer-text-sm`,children:r.t(e.title)}),q(`div`,{className:`univer-flex univer-flex-wrap`,children:e.group.map(e=>q(`div`,{className:`univer-mb-1 univer-flex univer-w-1/2 univer-items-center`,onClick:()=>{i(e.name)},children:q(`a`,{className:`
67
+ univer-flex univer-cursor-pointer univer-rounded
68
+ hover:univer-bg-gray-100
69
+ dark:hover:!univer-bg-gray-700
70
+ `,children:e.list.map((e,t)=>q(`img`,{className:`univer-size-5`,src:e,draggable:!1},t))})},e.name))})]},t))})}),Nn=e=>{let{onClick:t}=e,n=H(()=>{let e=[];for(let t in Xe){let n=Xe[t],r=t;n.forEach((t,n)=>{e.push({iconType:r,base64:t,iconId:String(n)})})}return e},[]),r=e=>{t(e.iconType,e.iconId)};return J(`div`,{children:[J(`div`,{className:`univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1`,onClick:()=>r({iconType:Pe,iconId:``,base64:``}),children:[q(Nt,{className:`univer-size-5`}),q(`span`,{className:`univer-ml-2`,children:`无单元格图标`})]}),q(`div`,{className:`univer-flex univer-w-64 univer-flex-wrap`,children:n.map(e=>q(`div`,{className:`
71
+ univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center
72
+ univer-justify-center univer-rounded
73
+ hover:univer-bg-gray-100
74
+ dark:hover:!univer-bg-gray-700
75
+ `,children:q(`img`,{className:`univer-size-5`,src:e.base64,draggable:!1,onClick:()=>r(e)})},`${e.iconType}_${e.iconId}`))})]})},Pn=e=>{let{onChange:t,configList:n,errorMap:r={}}=e,i=B(f),a=[{label:i.t(`sheet.cf.symbol.${j.greaterThan}`),value:j.greaterThan},{label:i.t(`sheet.cf.symbol.${j.greaterThanOrEqual}`),value:j.greaterThanOrEqual}],o=[{label:i.t(`sheet.cf.valueType.${I.num}`),value:I.num},{label:i.t(`sheet.cf.valueType.${I.percent}`),value:I.percent},{label:i.t(`sheet.cf.valueType.${I.percentile}`),value:I.percentile},{label:i.t(`sheet.cf.valueType.${I.formula}`),value:I.formula}],s=(e,n)=>{t([String(n),`value`,`value`],e)},c=(e,n)=>{t([String(n),`operator`],e),s(Ue(N.number,e),n)},l=(e,r)=>{t([String(r),`value`,`type`],e);let i=n[r];s(Ue(N.number,i.operator),r)};return H(()=>n.map((e,u)=>{let d=r[u],f=kn(e.iconType,e.iconId),p=u===n.length-1,m=u===0,h=n[u-1],g=(h==null?void 0:h.value.type)===I.formula?i.t(`sheet.cf.valueType.formula`):h==null?void 0:h.value.value;return J(`div`,{className:u?`univer-mt-6`:`univer-mt-3`,children:[J(`div`,{className:`
76
+ univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm
77
+ univer-text-gray-600
78
+ dark:!univer-text-gray-200
79
+ `,children:[J(`div`,{className:`univer-w-[45%]`,children:[i.t(`sheet.cf.iconSet.icon`),u+1]}),q(`div`,{className:`univer-w-[45%]`,children:J(It,{children:[!m&&!p&&i.t(`sheet.cf.iconSet.rule`),!m&&!p&&J(`span`,{className:`
80
+ univer-font-medium univer-text-gray-600
81
+ dark:!univer-text-gray-200
82
+ `,children:[i.t(`sheet.cf.iconSet.when`),i.t(`sheet.cf.symbol.${Je(h.operator)}`),g,p?``:` ${i.t(`sheet.cf.iconSet.and`)} `]})]})})]}),J(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4`,children:[q(`div`,{className:`univer-flex univer-items-center`,children:q(mt,{overlay:q(`div`,{className:`univer-rounded-lg univer-p-4`,children:q(Nn,{onClick:(n,r)=>{let i={...e,iconId:r,iconType:n};t([String(u)],i)},iconId:e.iconId,iconType:e.iconType})}),children:J(`div`,{className:K(`
83
+ univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
84
+ univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2
85
+ univer-text-xs univer-text-gray-600 univer-transition-all
86
+ hover:univer-border-primary-600
87
+ dark:!univer-text-gray-200
88
+ `,bt),children:[f?q(`img`,{src:f,className:`univer-size-4`,draggable:!1}):q(Nt,{className:`univer-size-4`}),q(At,{})]})})}),p?J(`div`,{className:`
89
+ univer-mt-0 univer-text-sm univer-text-gray-600
90
+ dark:!univer-text-gray-200
91
+ `,children:[i.t(`sheet.cf.iconSet.rule`),J(`span`,{className:`univer-font-medium`,children:[i.t(`sheet.cf.iconSet.when`),i.t(`sheet.cf.symbol.${Je(h.operator)}`),g,p?``:` ${i.t(`sheet.cf.iconSet.and`)} `]})]}):q(G,{options:a,value:e.operator,onChange:e=>{c(e,u)}})]}),p?q(`div`,{}):J(It,{children:[J(`div`,{className:`
92
+ univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm
93
+ univer-text-gray-600
94
+ dark:!univer-text-gray-200
95
+ `,children:[q(`div`,{children:i.t(`sheet.cf.iconSet.type`)}),q(`div`,{children:i.t(`sheet.cf.iconSet.value`)})]}),J(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4`,children:[q(G,{options:o,value:e.value.type,onChange:e=>{l(e,u)}}),q(An,{id:u,type:e.value.type,error:d,value:e.value.value||``,onChange:e=>{s(e,u)}})]})]})]},u)}),[n,r])},Fn=e=>{var t;let{interceptorManager:n}=e,r=((t=e.rule)==null?void 0:t.type)===M.iconSet?e.rule:void 0,i=B(f),[a,o]=W({}),[s,c]=W(()=>{let e=Object.keys(Xe)[0];if(r&&r.config.length){let e=r.config[0].iconType;if(!r.config.some(t=>t.iconType!==e))return e}return e}),[l,u]=W(()=>{if(r&&r.config.length)return _.deepClone(r==null?void 0:r.config);let e=Xe[s]||[];return Array(e.length).fill(``).map((e,t,n)=>t===n.length-1?{operator:j.lessThanOrEqual,value:{type:I.num,value:2**53-1},iconType:s,iconId:String(t)}:jn(s,t,n))}),[d,p]=W(()=>r?!!r.isShowValue:!0),m=H(()=>q(`div`,{className:`univer-flex univer-items-center`,children:l.map(e=>kn(e.iconType,e.iconId)).map((e,t)=>e?q(`img`,{className:`univer-size-5`,src:e},t):q(Nt,{className:`univer-size-5`},t))}),[l]),h=e=>{if(e.reduce((t,n,r)=>t.preType&&!t.result||e.length-1===r?t:n.value.type===I.formula?{preType:I.formula,result:!1}:t.preType?{result:t.preType===n.value.type,preType:n.value.type}:{result:!0,preType:n.value.type},{result:!0,preType:``}).result&&[I.num,I.percent,I.percentile].includes(e[0].value.type)){let t={};return e.forEach((n,r,a)=>{if(r-1<0||r===a.length-1)return;let o=e[r-1],s=Je(o.operator);Be({operator:s,value:o.value.value},n.value.value)||(t[r]=`${i.t(`sheet.cf.form.${s}`,String(o.value.value))} `)}),t}return{}},g=(e,t)=>{x(l,e)!==t&&(w(l,e,t),u([...l]),o(h(l)))},v=e=>{c(e);let t=Xe[e]||[],n=Array(t.length).fill(``).map((t,n,r)=>jn(e,n,r));u(n),o(h(n))};V(()=>{let e=n.intercept(n.getInterceptPoints().submit,{handler(){return{type:M.iconSet,isShowValue:d,config:l}}});return()=>{e()}},[d,l,n]),V(()=>{let e=n.intercept(n.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{e()}},[d,l,n,a]);let y=()=>{let e=l.map(e=>({...e}));l.forEach((t,n)=>{let r=e[l.length-1-n];t.iconId=r.iconId,t.iconType=r.iconType}),u([...l])},b=B(et),[S,C]=W();return st(S,b.rootContainerElement),J(`div`,{children:[q(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600`,children:i.t(`sheet.cf.panel.styleRule`)}),q(`div`,{className:`univer-mt-3`,children:q(mt,{overlay:q(`div`,{className:`univer-rounded-lg univer-p-4`,children:q(Mn,{ref:e=>{!S&&e&&C(e)},iconType:s,onClick:v})}),children:J(`div`,{className:K(`
96
+ univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
97
+ univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2
98
+ univer-text-xs univer-text-gray-600 univer-transition-all
99
+ hover:univer-border-primary-600
100
+ `,bt),children:[m,q(At,{})]})})}),J(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-text-xs`,children:[J(`div`,{className:`univer-flex univer-items-center univer-text-xs`,children:[q(dt,{onChange:y}),i.t(`sheet.cf.iconSet.reverseIconOrder`)]}),J(`div`,{className:`univer-ml-6 univer-flex univer-items-center univer-text-xs`,children:[q(dt,{checked:!d,onChange:e=>{p(!e)}}),i.t(`sheet.cf.iconSet.onlyShowIcon`)]})]}),q(Pn,{errorMap:a,onChange:g,configList:l})]})},In=e=>{var t;let{onChange:n,interceptorManager:r}=e,i=B(f),a=((t=e.rule)==null?void 0:t.type)===M.highlightCell?e.rule:void 0,o=[{label:i.t(`sheet.cf.panel.isNotBottom`),value:`isNotBottom`},{label:i.t(`sheet.cf.panel.isBottom`),value:`isBottom`},{label:i.t(`sheet.cf.panel.greaterThanAverage`),value:`greaterThanAverage`},{label:i.t(`sheet.cf.panel.lessThanAverage`),value:`lessThanAverage`}],[s,c]=W(()=>{let e=o[0].value,t=a==null?void 0:a.type;if(!a)return e;switch(t){case M.highlightCell:switch(a.subType){case N.average:return[j.greaterThan,j.greaterThanOrEqual].includes(a.operator)?`greaterThanAverage`:[j.lessThan,j.lessThanOrEqual].includes(a.operator)?`lessThanAverage`:e;case N.rank:return a.isBottom?`isBottom`:`isNotBottom`}}return e}),[l,u]=W(()=>{let e=a==null?void 0:a.type;if(!a)return 10;switch(e){case M.highlightCell:switch(a.subType){case N.rank:return a.value||10}}return 10}),[d,p]=W(()=>{let e=a==null?void 0:a.type;if(!a)return!1;switch(e){case M.highlightCell:switch(a.subType){case N.rank:return a.isPercent||!1}}return!1}),[m,h]=W({}),g=e=>{let{type:t,isPercent:n,value:r,style:i}=e;if(t===`isNotBottom`)return{type:M.highlightCell,subType:N.rank,isPercent:n,isBottom:!1,value:r,style:i};if(t===`isBottom`)return{type:M.highlightCell,subType:N.rank,isPercent:n,isBottom:!0,value:r,style:i};if(t===`greaterThanAverage`)return{type:M.highlightCell,subType:N.average,operator:j.greaterThan,style:i};if(t===`lessThanAverage`)return{type:M.highlightCell,subType:N.average,operator:j.lessThan,style:i}};V(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return g({type:s,isPercent:d,value:l,style:m})}}),[s,d,l,m,r]);let _=e=>{n(g(e))};return J(`div`,{children:[q(`div`,{className:`
101
+ univer-mt-4 univer-text-sm univer-text-gray-600
102
+ dark:!univer-text-gray-200
103
+ `,children:i.t(`sheet.cf.panel.styleRule`)}),q(G,{className:`univer-mt-3 univer-w-full`,value:s,options:o,onChange:e=>{c(e),_({type:e,isPercent:d,value:l,style:m})}}),[`isNotBottom`,`isBottom`].includes(s)&&J(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[q(gt,{min:1,max:1e3,value:l,onChange:e=>{let t=e||0;u(t),_({type:s,isPercent:d,value:t,style:m})}}),J(`div`,{className:`univer-ml-3 univer-flex univer-items-center univer-text-xs`,children:[q(dt,{checked:d,onChange:e=>{p(!!e),_({type:s,isPercent:!!e,value:l,style:m})}}),i.t(`sheet.cf.valueType.percent`)]})]}),q(`div`,{className:mn,children:q(pn,{rule:g({type:s,isPercent:d,value:l,style:m})})}),q(Cn,{style:a==null?void 0:a.style,className:`univer-mt-3`,onChange:e=>{h(e),_({type:s,isPercent:d,value:l,style:e})}})]})},Ln=y(`beforeSubmit`),Rn=y(`submit`),zn=e=>e.getCurrentUnitForType(v.UNIVER_SHEET).getUnitId(),Bn=e=>{var t;return(t=e.getCurrentUnitForType(v.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},Vn=e=>{var t,n,r;let i=B(f),o=B(a),c=B(s),l=B(L),u=B(fe),p=zn(c),m=Bn(c),[h,g]=W(void 0),_=U((t=(n=e.rule)==null?void 0:n.ranges)==null?[]:t),y=H(()=>{var t;let n=(t=e.rule)==null?void 0:t.ranges;if(!(n!=null&&n.length)){var r,i;n=(r=(i=u.getCurrentSelections())==null?void 0:i.map(e=>e.range))==null?[]:r}return _.current=n,n!=null&&n.length?n.map(e=>{let t=St(e);return t===`NaN`?``:t}).filter(e=>!!e).join(`,`):``},[e.rule]),b=[{label:i.t(`sheet.cf.ruleType.highlightCell`),value:`1`},{label:i.t(`sheet.cf.panel.rankAndAverage`),value:`2`},{label:i.t(`sheet.cf.ruleType.dataBar`),value:`3`},{label:i.t(`sheet.cf.ruleType.colorScale`),value:`4`},{label:i.t(`sheet.cf.ruleType.formula`),value:`5`},{label:i.t(`sheet.cf.ruleType.iconSet`),value:`6`}],[x,S]=W(()=>{var t;let n=(t=e.rule)==null?void 0:t.rule.type,r=b[0].value;if(!n)return r;switch(n){case M.highlightCell:var i;switch((i=e.rule)==null?void 0:i.rule.subType){case N.number:case N.text:case N.duplicateValues:case N.uniqueValues:case N.timePeriod:return`1`;case N.average:case N.rank:return`2`;case N.formula:return`5`}break;case M.dataBar:return`3`;case M.colorScale:return`4`;case M.iconSet:return`6`}return r}),C=U(void 0),w=H(()=>new d({beforeSubmit:Ln,submit:Rn}),[]),T=H(()=>{switch(x){case`1`:return On;case`2`:return In;case`3`:return bn;case`4`:return _n;case`5`:return wn;case`6`:return Fn;default:return On}},[x]);V(()=>{let t=o.onCommandExecuted(t=>{if(t.id===se.id){let n=t.params;n.subUnitId===m&&n.unitId===p&&e.onCancel()}t.id===le.id&&e.onCancel()});return()=>t.dispose()},[]);let E=e=>{C.current=e},ee=e=>{_.current=e.split(`,`).filter(e=>!!e).map(xt).map(e=>e.range)};return J(`div`,{children:[q(`div`,{className:`
104
+ univer-mt-4 univer-text-sm univer-text-gray-600
105
+ dark:!univer-text-gray-200
106
+ `,children:i.t(`sheet.cf.panel.range`)}),J(`div`,{className:`univer-mt-4`,children:[q(wt,{unitId:p,subUnitId:m,initialValue:y,onChange:(e,t)=>ee(t),onVerify:(e,t)=>{e?t.length<1?g(i.t(`sheet.cf.errorMessage.rangeError`)):g(void 0):g(i.t(`sheet.cf.errorMessage.rangeError`))}}),h&&q(`div`,{className:`univer-mt-1 univer-text-xs univer-text-red-500`,children:h})]}),q(`div`,{className:`
107
+ univer-mt-4 univer-text-sm univer-text-gray-600
108
+ dark:!univer-text-gray-200
109
+ `,children:i.t(`sheet.cf.panel.styleType`)}),q(G,{className:`univer-mt-4 univer-w-full`,value:x,options:b,onChange:e=>S(e)}),q(T,{interceptorManager:w,rule:(r=e.rule)==null?void 0:r.rule,onChange:E}),J(`div`,{className:`univer-mt-4 univer-flex univer-justify-end`,children:[q(ut,{onClick:()=>{e.onCancel()},children:i.t(`sheet.cf.panel.cancel`)}),q(ut,{className:`univer-ml-3`,variant:`primary`,onClick:()=>{if(h)return;let t=(()=>{let e=c.getCurrentUnitForType(v.UNIVER_SHEET).getActiveSheet();if(!e)throw Error(`No active sheet found`);return _.current.map(t=>be(t,e.getRowCount(),e.getColumnCount())).filter(e=>!(Number.isNaN(e.startRow)||Number.isNaN(e.startColumn)))})();if(w.fetchThroughInterceptors(w.getInterceptPoints().beforeSubmit)(!0,null)){let n=w.fetchThroughInterceptors(w.getInterceptPoints().submit)(null,null);if(n){let r=zn(c),i=Bn(c);if(!r||!i)throw Error(`No active sheet found`);let a={};e.rule&&e.rule.cfId?(a={...e.rule,ranges:t,rule:n},o.executeCommand(Re.id,{unitId:r,subUnitId:i,rule:a}),e.onCancel()):(a={cfId:l.createCfId(r,i),ranges:t,rule:n,stopIfTrue:!1},o.executeCommand(xe.id,{unitId:r,subUnitId:i,rule:a}),e.onCancel())}}},children:i.t(`sheet.cf.panel.submit`)})]})]})};function Hn(e){"@babel/helpers - typeof";return Hn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Hn(e)}function Un(e,t){if(Hn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Hn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Wn(e){var t=Un(e,`string`);return Hn(t)==`symbol`?t:t+``}function X(e,t,n){return(t=Wn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e,t){return function(n,r){t(n,r,e)}}function Q(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let Gn=class extends i{constructor(e){super(),this._localeService=e,X(this,`_initLocal`,()=>{}),X(this,`_findReplaceIndex`,e=>{let t=/\{([^}]+)?\}/g,n=[],r=t.exec(e);for(;r;)n.push({startIndex:r.index,key:Number(r[1]),endIndex:r.index+r[0].length-1}),r=t.exec(e);return n}),this._initLocal()}tWithReactNode(e,...t){let n=this._localeService.getLocales(),r=e.split(`.`),i=n&&this._localeService.resolveKeyPath(n,r);if(typeof i==`string`){let e=[];return this._findReplaceIndex(i).forEach((n,r,a)=>{let o=a[r-1]||{startIndex:0,endIndex:-1};if(o.endIndex+1<n.startIndex){let t=i.slice(o.endIndex+1,n.startIndex);t&&e.push(t)}if(t[n.key]&&e.push(t[n.key]),r===a.length-1){let t=i.slice(n.endIndex+1);t&&e.push(t)}}),e}return[]}};Gn=Q([Z(0,c(f))],Gn);const Kn=(e,t)=>{let n=e.rule;switch(n.type){case M.colorScale:return t.t(`sheet.cf.ruleType.colorScale`);case M.dataBar:return t.t(`sheet.cf.ruleType.dataBar`);case M.iconSet:return t.t(`sheet.cf.ruleType.iconSet`);case M.highlightCell:switch(n.subType){case N.average:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`,t.t(`sheet.cf.subRuleType.average`))}case N.duplicateValues:return t.t(`sheet.cf.subRuleType.duplicateValues`);case N.uniqueValues:return t.t(`sheet.cf.subRuleType.uniqueValues`);case N.number:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`,...Array.isArray(n.value)?n.value.map(e=>String(e)):[String(n.value||``)])}case N.text:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`,n.value||``)}case N.timePeriod:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`)}case N.rank:return n.isPercent?n.isBottom?t.t(`sheet.cf.preview.describe.bottomNPercent`,String(n.value)):t.t(`sheet.cf.preview.describe.topNPercent`,String(n.value)):n.isBottom?t.t(`sheet.cf.preview.describe.bottomN`,String(n.value)):t.t(`sheet.cf.preview.describe.topN`,String(n.value));case N.formula:return t.t(`sheet.cf.ruleType.formula`)}}},qn=e=>{let{onClick:t}=e,n=B(L),r=B(s),i=B(fe),o=B(a),c=B(f),u=B(l),d=B(Gn),p=ot(()=>r.getCurrentTypeOfUnit$(v.UNIVER_SHEET),void 0,void 0,[]),m=p.getUnitId(),h=p.getActiveSheet();if(!h)throw Error(`No active sheet found`);let _=h.getSheetId(),[y,b]=W([]),[x,S]=W(`2`),[C,w]=W(0),[T,E]=W(``),ee=[{label:c.t(`sheet.cf.panel.workSheet`),value:`2`},{label:c.t(`sheet.cf.panel.selectedRange`),value:`1`}],D=()=>{let e=n.getSubunitRules(m,_);if(!e||!e.length)return[];if(x===`1`){let t=i.getCurrentLastSelection();if(!t)return[];let n=t.range;return e.filter(e=>e.ranges.some(e=>g.intersects(e,n)))}else if(x===`2`)return[...e];return[]},[O,te]=W(D);Gt(y),V(()=>{let e=o.onCommandExecuted(e=>{e.id===le.id&&w(Math.random())});return()=>e.dispose()}),V(()=>{te(D)},[x,C,m,_]),V(()=>{if(x===`2`)return;let e=new qt(e=>{let t=[ce.id,A.id,z.id,R.id,Ie.id],n=o.onCommandExecuted(n=>{let{id:i,params:a}=n,o=r.getCurrentUnitOfType(v.UNIVER_SHEET).getUnitId();t.includes(i)&&a.unitId===o&&e.next(null)});return()=>n.dispose()}).pipe(Jt(16)).subscribe(()=>{te(D)});return()=>{e.unsubscribe()}},[r,x,m,_]),V(()=>{let e=n.$ruleChange.subscribe(()=>{w(Math.random())});return()=>e.unsubscribe()},[n]);let ne=e=>{var t;let n=r.getCurrentUnitOfType(v.UNIVER_SHEET).getUnitId(),i=(t=r.getCurrentUnitOfType(v.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId();if(!n||!i)throw Error(`No active sheet found`);o.executeCommand(Me.id,{unitId:n,subUnitId:i,cfId:e.cfId})},re=(e,t)=>{var n;let r=se[t.y];E((n=r==null?void 0:r.cfId)==null?``:n)},ie=(e,t,n)=>{var i,a,s;E(``);let c=r.getCurrentUnitOfType(v.UNIVER_SHEET).getUnitId(),l=(i=r.getCurrentUnitOfType(v.UNIVER_SHEET).getActiveSheet())==null?void 0:i.getSheetId();if(!c||!l)throw Error(`No active sheet found`);let u=e=>{let t=se.length;return Math.min(t-1,Math.max(0,e))},d=(a=se[u(t.y)])==null?void 0:a.cfId,f=(s=se[u(n.y)])==null?void 0:s.cfId;!d||!f||d!==f&&o.executeCommand(Fe.id,{unitId:c,subUnitId:l,start:{id:d,type:`self`},end:{id:f,type:n.y>t.y?`after`:`before`}})},ae=()=>{e.onCreate()},oe=()=>{x===`2`?o.executeCommand(Te.id):x===`1`&&O.map(e=>({unitId:m,subUnitId:_,cfId:e.cfId})).forEach(e=>{o.executeCommand(Me.id,e)})},se=H(()=>{let e=r.getCurrentUnitOfType(v.UNIVER_SHEET),t=e.getActiveSheet();return O.filter(n=>{let r=n.ranges;return ge(u,e.getUnitId(),t.getSheetId(),r)})},[O]),ue=H(()=>{let e=r.getCurrentUnitOfType(v.UNIVER_SHEET),t=e.getActiveSheet();return O.every(n=>{let r=n.ranges;return ge(u,e.getUnitId(),t.getSheetId(),r)})},[O]);return J(`div`,{children:[J(`div`,{className:`
2646
110
  univer-mb-2 univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm
2647
- `,
2648
- children: [
2649
- /* @__PURE__ */ c("div", { className: "univer-flex univer-items-center univer-gap-2", children: l.tWithReactNode(
2650
- "sheet.cf.panel.managerRuleSelect",
2651
- /* @__PURE__ */ c(
2652
- oe,
2653
- {
2654
- className: "univer-w-36",
2655
- options: v,
2656
- value: f,
2657
- onChange: (L) => {
2658
- w(L);
2659
- }
2660
- }
2661
- )
2662
- ).map((L, A) => /* @__PURE__ */ c("span", { children: L }, A)) }),
2663
- /* @__PURE__ */ F("div", { className: "univer-flex univer-justify-end univer-space-x-2", children: [
2664
- /* @__PURE__ */ c(Jt, { title: s.t("sheet.cf.panel.createRule"), placement: "bottom", children: /* @__PURE__ */ c(
2665
- "a",
2666
- {
2667
- className: "univer-size-5 univer-cursor-pointer",
2668
- onClick: D,
2669
- children: /* @__PURE__ */ c(qn, {})
2670
- }
2671
- ) }),
2672
- I.length && B ? /* @__PURE__ */ c(Jt, { title: s.t("sheet.cf.panel.clear"), placement: "bottom", children: /* @__PURE__ */ c(
2673
- "a",
2674
- {
2675
- className: "univer-size-5 univer-cursor-pointer",
2676
- onClick: m,
2677
- children: /* @__PURE__ */ c(ut, { className: "univer-text-red-500" })
2678
- }
2679
- ) }) : /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(ut, { className: "univer-text-gray-300" }) })
2680
- ] })
2681
- ]
2682
- }
2683
- ),
2684
- /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(
2685
- zr,
2686
- {
2687
- className: "univer-w-full",
2688
- draggableHandle: ".draggableHandle",
2689
- list: _,
2690
- onListChange: () => {
2691
- },
2692
- idKey: "cfId",
2693
- rowHeight: 60,
2694
- margin: [0, 10],
2695
- onDragStop: U,
2696
- onDragStart: E,
2697
- itemRender: (L) => /* @__PURE__ */ F(
2698
- "div",
2699
- {
2700
- className: Y("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", {
2701
- "univer-bg-gray-100 dark:!univer-bg-gray-700": x === L.cfId
2702
- }),
2703
- onMouseMove: () => {
2704
- L.ranges !== p && y(L.ranges);
2705
- },
2706
- onMouseLeave: () => y([]),
2707
- onClick: () => {
2708
- e(L);
2709
- },
2710
- children: [
2711
- /* @__PURE__ */ c(
2712
- "div",
2713
- {
2714
- className: Y("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex", "draggableHandle"),
2715
- onClick: (A) => A.stopPropagation(),
2716
- children: /* @__PURE__ */ c(Zn, {})
2717
- }
2718
- ),
2719
- /* @__PURE__ */ F(
2720
- "div",
2721
- {
2722
- className: "univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden",
2723
- children: [
2724
- /* @__PURE__ */ c(
2725
- "div",
2726
- {
2727
- className: "univer-text-sm univer-text-gray-900 dark:!univer-text-white",
2728
- children: Ui(L, s)
2729
- }
2730
- ),
2731
- /* @__PURE__ */ c("div", { className: "univer-text-xs univer-text-gray-400", children: L.ranges.map((A) => Nn(A)).join(",") })
2732
- ]
2733
- }
2734
- ),
2735
- /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(De, { rule: L.rule }) }),
2736
- /* @__PURE__ */ c(
2737
- "div",
2738
- {
2739
- className: Y("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-red-500 group-hover:univer-flex hover:univer-bg-gray-200", {
2740
- "univer-flex univer-items-center univer-justify-center": x === L.cfId
2741
- }),
2742
- onClick: (A) => {
2743
- A.stopPropagation(), V(L), y([]);
2744
- },
2745
- children: /* @__PURE__ */ c(ut, {})
2746
- }
2747
- )
2748
- ]
2749
- }
2750
- )
2751
- }
2752
- ) })
2753
- ] });
2754
- }, $i = (n) => {
2755
- const [e, t] = N(n.rule), [r, i] = N(!!n.rule);
2756
- return /* @__PURE__ */ c("div", { className: "univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4", children: r ? /* @__PURE__ */ c(ki, { onCancel: () => {
2757
- i(!1), t(void 0);
2758
- }, rule: e }) : /* @__PURE__ */ c(Oi, { onClick: (l) => {
2759
- t(l), i(!0);
2760
- }, onCreate: () => {
2761
- i(!0);
2762
- } }) });
2763
- };
2764
- var Di = Object.getOwnPropertyDescriptor, Ai = (n, e, t, r) => {
2765
- for (var i = r > 1 ? void 0 : r ? Di(e, t) : e, o = n.length - 1, s; o >= 0; o--)
2766
- (s = n[o]) && (i = s(i) || i);
2767
- return i;
2768
- }, Ae = (n, e) => (t, r) => e(t, r, n);
2769
- const ct = "sheet.conditional.formatting.panel";
2770
- let Ye = class extends se {
2771
- constructor(e, t, r, i, o) {
2772
- super();
2773
- ge(this, "_sidebarDisposable", null);
2774
- this._univerInstanceService = e, this._injector = t, this._componentManager = r, this._sidebarService = i, this._localeService = o, this._initPanel(), this.disposeWithMe(
2775
- this._univerInstanceService.getCurrentTypeOfUnit$(H.UNIVER_SHEET).subscribe((s) => {
2776
- var u;
2777
- s || (u = this._sidebarDisposable) == null || u.dispose();
2778
- })
2779
- ), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((s) => {
2780
- s.id === ct && (s.visible || setTimeout(() => {
2781
- this._sidebarService.sidebarOptions$.next({ visible: !1 });
2782
- }));
2783
- }));
2784
- }
2785
- openPanel(e) {
2786
- const t = {
2787
- id: ct,
2788
- header: { title: this._localeService.t("sheet.cf.title") },
2789
- children: {
2790
- label: ct,
2791
- rule: e,
2792
- key: ar(4)
2793
- },
2794
- onClose: () => this._sidebarDisposable = null
2795
- };
2796
- this._sidebarDisposable = this._sidebarService.open(t);
2797
- }
2798
- _initPanel() {
2799
- this.disposeWithMe(
2800
- this._componentManager.register(ct, $i)
2801
- );
2802
- }
2803
- };
2804
- Ye = Ai([
2805
- Ae(0, G),
2806
- Ae(1, $(ve)),
2807
- Ae(2, $(Dr)),
2808
- Ae(3, $(Ar)),
2809
- Ae(4, $(te))
2810
- ], Ye);
2811
- var re = /* @__PURE__ */ ((n) => (n[n.createRule = 1] = "createRule", n[n.viewRule = 2] = "viewRule", n[n.highlightCell = 3] = "highlightCell", n[n.rank = 4] = "rank", n[n.formula = 5] = "formula", n[n.colorScale = 6] = "colorScale", n[n.dataBar = 7] = "dataBar", n[n.icon = 8] = "icon", n[n.clearRangeRules = 9] = "clearRangeRules", n[n.clearWorkSheetRules = 10] = "clearWorkSheetRules", n))(re || {});
2812
- const Tt = {
2813
- id: "sheet.operation.open.conditional.formatting.panel",
2814
- type: he.OPERATION,
2815
- handler: (n, e) => {
2816
- var u;
2817
- const t = n.get(Ye), r = n.get($e), i = n.get(Q), o = ((u = r.getCurrentSelections()) == null ? void 0 : u.map((l) => l.range)) || [];
2818
- switch (e.value) {
2819
- case 3: {
2820
- t.openPanel({ ..._e(), ranges: o });
2821
- break;
2822
- }
2823
- case 4: {
2824
- const l = {
2825
- ..._e,
2826
- ranges: o,
2827
- rule: {
2828
- type: M.highlightCell,
2829
- subType: k.rank
2830
- }
2831
- };
2832
- t.openPanel(l);
2833
- break;
2834
- }
2835
- case 5: {
2836
- const l = {
2837
- ..._e,
2838
- ranges: o,
2839
- rule: {
2840
- type: M.highlightCell,
2841
- subType: k.formula,
2842
- value: "="
2843
- }
2844
- };
2845
- t.openPanel(l);
2846
- break;
2847
- }
2848
- case 6: {
2849
- const l = {
2850
- ..._e,
2851
- ranges: o,
2852
- rule: {
2853
- type: M.colorScale,
2854
- config: []
2855
- }
2856
- };
2857
- t.openPanel(l);
2858
- break;
2859
- }
2860
- case 7: {
2861
- const l = {
2862
- ..._e,
2863
- ranges: o,
2864
- rule: {
2865
- type: M.dataBar,
2866
- isShowValue: !0
2867
- }
2868
- };
2869
- t.openPanel(l);
2870
- break;
2871
- }
2872
- case 8: {
2873
- const l = {
2874
- ..._e,
2875
- ranges: o,
2876
- rule: {
2877
- type: M.iconSet,
2878
- config: [],
2879
- isShowValue: !0
2880
- }
2881
- };
2882
- t.openPanel(l);
2883
- break;
2884
- }
2885
- case 2: {
2886
- t.openPanel();
2887
- break;
2888
- }
2889
- case 1: {
2890
- t.openPanel({ ..._e(), ranges: o });
2891
- break;
2892
- }
2893
- case 9: {
2894
- i.executeCommand(Vr.id, { ranges: o });
2895
- break;
2896
- }
2897
- case 10: {
2898
- i.executeCommand(Tn.id);
2899
- break;
2900
- }
2901
- }
2902
- return !0;
2903
- }
2904
- };
2905
- var Hi = Object.getOwnPropertyDescriptor, ji = (n, e, t, r) => {
2906
- for (var i = r > 1 ? void 0 : r ? Hi(e, t) : e, o = n.length - 1, s; o >= 0; o--)
2907
- (s = n[o]) && (i = s(i) || i);
2908
- return i;
2909
- }, He = (n, e) => (t, r) => e(t, r, n);
2910
- let ft = class extends se {
2911
- constructor(n, e, t, r, i) {
2912
- super(), this._injector = n, this._univerInstanceService = e, this._sheetInterceptorService = t, this._selectionManagerService = r, this._conditionalFormattingRuleModel = i, this._init();
2913
- }
2914
- _init() {
2915
- this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
2916
- getMutations: (n) => {
2917
- var i;
2918
- const e = [], t = [], r = { redos: e, undos: t };
2919
- if ([vr.id, gr.id].includes(n.id)) {
2920
- const o = (i = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : i.map((p) => p.range);
2921
- if (!o)
2922
- return r;
2923
- const s = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET), u = s.getActiveSheet();
2924
- if (!u)
2925
- return r;
2926
- const l = s.getUnitId(), g = u.getSheetId(), a = this._conditionalFormattingRuleModel.getSubunitRules(l, g);
2927
- if (!a || !a.length)
2928
- return r;
2929
- const { redos: d, undos: h } = cn(this._injector, a, o, l, g);
2930
- e.push(...d), t.push(...h);
2931
- }
2932
- return r;
2933
- }
2934
- })), this.disposeWithMe(this._sheetInterceptorService.interceptRanges({
2935
- getMutations: ({ unitId: n, subUnitId: e, ranges: t }) => {
2936
- const r = [], i = [], o = { redos: r, undos: i };
2937
- if (!t || !t.length)
2938
- return o;
2939
- const s = this._conditionalFormattingRuleModel.getSubunitRules(n, e);
2940
- if (!s || !s.length)
2941
- return o;
2942
- const { redos: u, undos: l } = cn(this._injector, s, t, n, e);
2943
- return r.push(...u), i.push(...l), o;
2944
- }
2945
- }));
2946
- }
2947
- };
2948
- ft = ji([
2949
- He(0, $(ve)),
2950
- He(1, $(G)),
2951
- He(2, $(Wt)),
2952
- He(3, $($e)),
2953
- He(4, $(X))
2954
- ], ft);
2955
- function cn(n, e, t, r, i) {
2956
- const o = [], s = [];
2957
- return e.filter((u) => t.some((l) => u.ranges.some((g) => me.getIntersects(g, l)))).forEach((u) => {
2958
- const g = new mr().add(...u.ranges).subtract(...t).merge();
2959
- if (g.length) {
2960
- const a = {
2961
- id: be.id,
2962
- params: {
2963
- unitId: r,
2964
- subUnitId: i,
2965
- rule: { ...u, ranges: g }
2966
- }
2967
- }, d = Le(n, a.params);
2968
- o.push(a), s.push(...d);
2969
- } else {
2970
- const a = {
2971
- id: Ie.id,
2972
- params: {
2973
- unitId: r,
2974
- subUnitId: i,
2975
- cfId: u.cfId
2976
- }
2977
- }, d = ze(n, a.params);
2978
- o.push(a), s.push(...d);
2979
- }
2980
- }), { redos: o, undos: s };
2981
- }
2982
- const Bi = "@univerjs/sheets-conditional-formatting-ui", Wi = "0.17.0", xt = {
2983
- name: Bi,
2984
- version: Wi
2985
- }, Qn = "sheets-conditional-formatting-ui.config", pt = {};
2986
- var qi = Object.getOwnPropertyDescriptor, Gi = (n, e, t, r) => {
2987
- for (var i = r > 1 ? void 0 : r ? qi(e, t) : e, o = n.length - 1, s; o >= 0; o--)
2988
- (s = n[o]) && (i = s(i) || i);
2989
- return i;
2990
- }, Ut = (n, e) => (t, r) => e(t, r, n);
2991
- let Ke = class extends se {
2992
- constructor(e, t, r) {
2993
- super();
2994
- ge(this, "_disposableMap", /* @__PURE__ */ new Map());
2995
- this._conditionalFormattingRuleModel = e, this._formulaRefRangeService = t, this._injector = r, this._initRefRange();
2996
- }
2997
- _getIdWithUnitId(e, t, r) {
2998
- return `${e}_${t}_${r}`;
2999
- }
3000
- _getRuleFormulas(e) {
3001
- const t = [], r = e.rule;
3002
- switch (r.type) {
3003
- case M.highlightCell:
3004
- r.subType === k.formula && t.push(r.value);
3005
- break;
3006
- case M.dataBar: {
3007
- const i = r;
3008
- i.config.min.type === P.formula && t.push(i.config.min.value), i.config.max.type === P.formula && t.push(i.config.max.value);
3009
- break;
3010
- }
3011
- case M.colorScale: {
3012
- r.config.forEach((o) => {
3013
- o.value.type === P.formula && t.push(o.value.value);
3014
- });
3015
- break;
3016
- }
3017
- case M.iconSet: {
3018
- r.config.forEach((o) => {
3019
- o.value.type === P.formula && t.push(o.value.value);
3020
- });
3021
- break;
3022
- }
3023
- }
3024
- return t;
3025
- }
3026
- _updateRuleFormulas(e, t) {
3027
- const r = _t.deepClone(e), i = r.rule;
3028
- let o = 0;
3029
- switch (i.type) {
3030
- case M.highlightCell:
3031
- i.subType === k.formula && (i.value = t[o++]);
3032
- break;
3033
- case M.dataBar: {
3034
- const s = i;
3035
- s.config.min.type === P.formula && (s.config.min.value = t[o++]), s.config.max.type === P.formula && (s.config.max.value = t[o++]);
3036
- break;
3037
- }
3038
- case M.colorScale: {
3039
- i.config.forEach((u) => {
3040
- u.value.type === P.formula && (u.value.value = t[o++]);
3041
- });
3042
- break;
3043
- }
3044
- case M.iconSet: {
3045
- i.config.forEach((u) => {
3046
- u.value.type === P.formula && (u.value.value = t[o++]);
3047
- });
3048
- break;
3049
- }
3050
- }
3051
- return r;
3052
- }
3053
- register(e, t, r) {
3054
- const i = r.ranges, o = this._getRuleFormulas(r), s = this._formulaRefRangeService.registerRangeFormula(e, t, i, o, (l) => {
3055
- if (l.length === 0)
3056
- return {
3057
- undos: [{
3058
- id: ee.id,
3059
- params: {
3060
- unitId: e,
3061
- subUnitId: t,
3062
- rule: r
3063
- }
3064
- }],
3065
- redos: [{
3066
- id: Ie.id,
3067
- params: {
3068
- unitId: e,
3069
- subUnitId: t,
3070
- cfId: r.cfId
3071
- }
3072
- }]
3073
- };
3074
- const g = [], a = [], d = l[0], h = this._updateRuleFormulas(r, d.formulas);
3075
- h.ranges = d.ranges, g.push({
3076
- id: be.id,
3077
- params: {
3078
- unitId: e,
3079
- subUnitId: t,
3080
- cfId: r.cfId,
3081
- rule: h
3082
- }
3083
- }), a.push(...Le(this._injector, {
3084
- unitId: e,
3085
- subUnitId: t,
3086
- cfId: r.cfId,
3087
- rule: h
3088
- }));
3089
- for (let p = 1; p < l.length; p++) {
3090
- const y = l[p], f = kr(), w = this._updateRuleFormulas(r, y.formulas);
3091
- w.cfId = f, w.ranges = y.ranges, g.push({
3092
- id: ee.id,
3093
- params: {
3094
- unitId: e,
3095
- subUnitId: t,
3096
- rule: w
3097
- }
3098
- }), a.push(qt(this._injector, {
3099
- unitId: e,
3100
- subUnitId: t,
3101
- rule: w
3102
- }));
3103
- }
3104
- return {
3105
- undos: a,
3106
- redos: g
3107
- };
3108
- }), u = this._getIdWithUnitId(e, t, r.cfId);
3109
- this._disposableMap.set(u, s);
3110
- }
3111
- _initRefRange() {
3112
- const e = this._conditionalFormattingRuleModel.getAll();
3113
- for (const [t, r] of e)
3114
- for (const [i, o] of r)
3115
- for (const s of o)
3116
- this.register(t, i, s);
3117
- this.disposeWithMe(
3118
- this._conditionalFormattingRuleModel.$ruleChange.subscribe((t) => {
3119
- const { unitId: r, subUnitId: i, rule: o } = t;
3120
- switch (t.type) {
3121
- case "add": {
3122
- this.register(r, i, o);
3123
- break;
3124
- }
3125
- case "delete": {
3126
- const s = this._getIdWithUnitId(r, i, o.cfId), u = this._disposableMap.get(s);
3127
- u && (u.dispose(), this._disposableMap.delete(s));
3128
- break;
3129
- }
3130
- case "set": {
3131
- const s = this._getIdWithUnitId(r, i, o.cfId), u = this._disposableMap.get(s);
3132
- u && (u.dispose(), this._disposableMap.delete(s)), this.register(r, i, o);
3133
- break;
3134
- }
3135
- }
3136
- })
3137
- ), this.disposeWithMe(mn(() => {
3138
- this._disposableMap.forEach((t) => {
3139
- t.dispose();
3140
- }), this._disposableMap.clear();
3141
- }));
3142
- }
3143
- };
3144
- Ke = Gi([
3145
- Ut(0, $(X)),
3146
- Ut(1, $(ri)),
3147
- Ut(2, $(ve))
3148
- ], Ke);
3149
- var Zi = Object.getOwnPropertyDescriptor, zi = (n, e, t, r) => {
3150
- for (var i = r > 1 ? void 0 : r ? Zi(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3151
- (s = n[o]) && (i = s(i) || i);
3152
- return i;
3153
- }, je = (n, e) => (t, r) => e(t, r, n);
3154
- let Xe = class extends se {
3155
- constructor(e, t, r, i, o) {
3156
- super();
3157
- ge(this, "_copyInfo");
3158
- this._sheetClipboardService = e, this._conditionalFormattingRuleModel = t, this._injector = r, this._conditionalFormattingViewModel = i, this._univerInstanceService = o, this._initClipboardHook();
3159
- }
3160
- _initClipboardHook() {
3161
- this.disposeWithMe(
3162
- this._sheetClipboardService.addClipboardHook({
3163
- id: tt,
3164
- onBeforeCopy: (e, t, r) => this._collectConditionalRule(e, t, r),
3165
- onPasteCells: (e, t, r, i) => {
3166
- const { copyType: o = Qt.COPY, pasteType: s } = i, { range: u } = e || {}, { range: l } = t;
3167
- return this._generateConditionalFormattingMutations(l, { copyType: o, pasteType: s, copyRange: u });
3168
- }
3169
- })
3170
- );
3171
- }
3172
- _collectConditionalRule(e, t, r) {
3173
- const i = new Re(), o = {};
3174
- this._copyInfo = {
3175
- matrix: i,
3176
- info: {
3177
- unitId: e,
3178
- subUnitId: t,
3179
- cfMap: o
3180
- }
3181
- };
3182
- const s = this._injector.invoke((a) => fr(r, a, e, t));
3183
- if (!s)
3184
- return;
3185
- const { rows: u, cols: l } = s, g = /* @__PURE__ */ new Set();
3186
- u.forEach((a, d) => {
3187
- l.forEach((h, p) => {
3188
- const y = this._conditionalFormattingViewModel.getCellCfs(e, t, a, h);
3189
- y && (y.forEach((f) => g.add(f.cfId)), i.setValue(d, p, y.map((f) => f.cfId)));
3190
- });
3191
- }), g.forEach((a) => {
3192
- const d = this._conditionalFormattingRuleModel.getRule(e, t, a);
3193
- d && (o[a] = d.rule);
3194
- });
3195
- }
3196
- // eslint-disable-next-line max-lines-per-function
3197
- _generateConditionalFormattingMutations(e, t) {
3198
- const r = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET), i = r.getActiveSheet(), o = r.getUnitId();
3199
- if (!i) return { redos: [], undos: [] };
3200
- const s = i.getSheetId();
3201
- if (t.copyType === Qt.CUT)
3202
- return this._copyInfo = null, { redos: [], undos: [] };
3203
- if (!this._copyInfo || !t.copyRange)
3204
- return { redos: [], undos: [] };
3205
- if (![
3206
- Ft.SPECIAL_PASTE_FORMAT,
3207
- Ft.DEFAULT_PASTE,
3208
- Ft.SPECIAL_PASTE_BESIDES_BORDER
3209
- ].includes(
3210
- t.pasteType
3211
- ))
3212
- return { redos: [], undos: [] };
3213
- const { ranges: [l, g], mapFunc: a } = Mn([t.copyRange, e]), d = Qr(l, g, !0), h = {};
3214
- fe.foreach(g, (v, b) => {
3215
- const { row: I, col: C } = a(v, b), V = this._conditionalFormattingViewModel.getCellCfs(o, s, I, C);
3216
- V && V.forEach((E) => {
3217
- if (!h[E.cfId]) {
3218
- const U = new Re();
3219
- h[E.cfId] = U;
3220
- const D = this._conditionalFormattingRuleModel.getRule(o, s, E.cfId);
3221
- D == null || D.ranges.forEach((m) => {
3222
- fe.foreach(m, (_, B) => {
3223
- U.setValue(_, B, 1);
3224
- });
3225
- });
3226
- }
3227
- h[E.cfId].realDeleteValue(I, C);
3228
- });
3229
- });
3230
- const { matrix: p, info: y } = this._copyInfo, f = [];
3231
- let w = this._conditionalFormattingRuleModel.createCfId(o, s);
3232
- const S = {}, R = (v) => {
3233
- if (S[v])
3234
- return S[v];
3235
- const b = y == null ? void 0 : y.cfMap[v], I = [...this._conditionalFormattingRuleModel.getSubunitRules(o, s) || [], ...f].find((C) => _t.diffValue(C.rule, b));
3236
- if (I)
3237
- return S[v] = I, I;
3238
- {
3239
- const C = {
3240
- rule: b,
3241
- cfId: w,
3242
- ranges: [],
3243
- stopIfTrue: !1
3244
- };
3245
- return S[v] = C, f.push(C), w = `${Number(w) + 1}`, C;
3246
- }
3247
- };
3248
- d.forEach((v) => {
3249
- p && p.forValue((b, I, C) => {
3250
- const V = me.getPositionRange(
3251
- {
3252
- startRow: b,
3253
- endRow: b,
3254
- startColumn: I,
3255
- endColumn: I
3256
- },
3257
- v.startRange
3258
- ), { row: E, col: U } = a(V.startRow, V.startColumn);
3259
- C.forEach((D) => {
3260
- if (!h[D]) {
3261
- const m = R(D), _ = new Re();
3262
- h[D] = _, m.ranges.forEach((B) => {
3263
- fe.foreach(B, (L, A) => {
3264
- _.setValue(L, A, 1);
3265
- });
3266
- });
3267
- }
3268
- h[D].setValue(E, U, 1);
3269
- });
3270
- });
3271
- });
3272
- const x = [], T = [];
3273
- for (const v in h) {
3274
- const b = h[v], I = ht(vt(b));
3275
- if (!I.length) {
3276
- const C = {
3277
- unitId: o,
3278
- subUnitId: s,
3279
- cfId: v
3280
- };
3281
- x.push({ id: Ie.id, params: C }), T.push(...ze(this._injector, C));
3282
- }
3283
- if (f.some((C) => C.cfId === v)) {
3284
- const C = R(v), V = {
3285
- unitId: o,
3286
- subUnitId: s,
3287
- rule: { ...C, ranges: I }
3288
- };
3289
- x.push({ id: ee.id, params: V }), T.push(qt(this._injector, V));
3290
- } else {
3291
- const C = this._conditionalFormattingRuleModel.getRule(o, s, v);
3292
- if (!C)
3293
- continue;
3294
- const V = {
3295
- unitId: o,
3296
- subUnitId: s,
3297
- rule: { ...C, ranges: I }
3298
- };
3299
- x.push({ id: be.id, params: V }), T.push(...Le(this._injector, V));
3300
- }
3301
- }
3302
- return {
3303
- redos: x,
3304
- undos: T
3305
- };
3306
- }
3307
- };
3308
- Xe = zi([
3309
- je(0, $(Jr)),
3310
- je(1, $(X)),
3311
- je(2, $(ve)),
3312
- je(3, $(et)),
3313
- je(4, $(G))
3314
- ], Xe);
3315
- var Yi = Object.getOwnPropertyDescriptor, Ki = (n, e, t, r) => {
3316
- for (var i = r > 1 ? void 0 : r ? Yi(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3317
- (s = n[o]) && (i = s(i) || i);
3318
- return i;
3319
- }, Ot = (n, e) => (t, r) => e(t, r, n);
3320
- let Je = class extends se {
3321
- constructor(n, e, t) {
3322
- super(), this._localeService = n, this._commandService = e, this._sheetPermissionCheckController = t, this._commandExecutedListener();
3323
- }
3324
- _commandExecutedListener() {
3325
- this.disposeWithMe(
3326
- this._commandService.beforeCommandExecuted((n) => {
3327
- if (n.id === wn.id) {
3328
- const { unitId: e, subUnitId: t, rule: { ranges: r } } = n.params;
3329
- this._sheetPermissionCheckController.permissionCheckWithRanges({
3330
- workbookTypes: [_n],
3331
- rangeTypes: [Sn],
3332
- worksheetTypes: [bn, In]
3333
- }, r, e, t) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"));
3334
- }
3335
- })
3336
- );
3337
- }
3338
- };
3339
- Je = Ki([
3340
- Ot(0, $(te)),
3341
- Ot(1, Q),
3342
- Ot(2, $(pr))
3343
- ], Je);
3344
- var Xi = Object.getOwnPropertyDescriptor, Ji = (n, e, t, r) => {
3345
- for (var i = r > 1 ? void 0 : r ? Xi(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3346
- (s = n[o]) && (i = s(i) || i);
3347
- return i;
3348
- }, Ve = (n, e) => (t, r) => e(t, r, n);
3349
- let Qe = class extends se {
3350
- constructor(e, t, r, i, o, s) {
3351
- super();
3352
- /**
3353
- * When a set operation is triggered multiple times over a short period of time, it may result in some callbacks not being disposed,and caused a render cache exception.
3354
- * The solution here is to store all the asynchronous tasks and focus on processing after the last callback
3355
- */
3356
- ge(this, "_ruleChangeCacheMap", /* @__PURE__ */ new Map());
3357
- this._sheetInterceptorService = e, this._conditionalFormattingService = t, this._univerInstanceService = r, this._renderManagerService = i, this._conditionalFormattingViewModel = o, this._conditionalFormattingRuleModel = s, this._initViewModelInterceptor(), this._initSkeleton(), this.disposeWithMe(() => {
3358
- this._ruleChangeCacheMap.clear();
3359
- });
3360
- }
3361
- _markDirtySkeleton() {
3362
- var t, r, i;
3363
- const e = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET).getUnitId();
3364
- (t = this._renderManagerService.getRenderById(e)) == null || t.with(Vn).reCalculate(), (i = (r = this._renderManagerService.getRenderById(e)) == null ? void 0 : r.mainComponent) == null || i.makeDirty();
3365
- }
3366
- _initSkeleton() {
3367
- this.disposeWithMe(kn(this._conditionalFormattingRuleModel.$ruleChange, this._conditionalFormattingViewModel.markDirty$).pipe(
3368
- oi(16),
3369
- en((e) => !!e.length),
3370
- en((e) => {
3371
- const t = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET);
3372
- if (!t) return !1;
3373
- const r = t.getActiveSheet();
3374
- return r ? e.filter((i) => i.unitId === t.getUnitId() && i.subUnitId === r.getSheetId()).length > 0 : !1;
3375
- })
3376
- ).subscribe(() => this._markDirtySkeleton()));
3377
- }
3378
- _initViewModelInterceptor() {
3379
- this.disposeWithMe(this._sheetInterceptorService.intercept(Cr.CELL_CONTENT, {
3380
- effect: lr.Style,
3381
- handler: (e, t, r) => {
3382
- const i = this._conditionalFormattingService.composeStyle(t.unitId, t.subUnitId, t.row, t.col);
3383
- if (!i)
3384
- return r(e);
3385
- const o = t.workbook.getStyles(), s = (typeof (e == null ? void 0 : e.s) == "string" ? o.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {}, u = e === t.rawData ? { ...t.rawData } : e;
3386
- if (i.style) {
3387
- const l = {
3388
- ...s,
3389
- ...i.style
3390
- };
3391
- Object.assign(u, { s: l });
3392
- }
3393
- return u.fontRenderExtension || (u.fontRenderExtension = {}, i.isShowValue !== void 0 && (u.fontRenderExtension.isSkip = !i.isShowValue)), i.dataBar && (u.dataBar = i.dataBar), i.iconSet && (u.iconSet = i.iconSet, u.fontRenderExtension.leftOffset = Fr + Lr), r(u);
3394
- },
3395
- priority: 10
3396
- }));
3397
- }
3398
- };
3399
- Qe = Ji([
3400
- Ve(0, $(Wt)),
3401
- Ve(1, $(xn)),
3402
- Ve(2, $(G)),
3403
- Ve(3, $(Fn)),
3404
- Ve(4, $(et)),
3405
- Ve(5, $(X))
3406
- ], Qe);
3407
- var Qi = Object.defineProperty, eo = Object.getOwnPropertyDescriptor, to = (n, e, t) => e in n ? Qi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, no = (n, e, t, r) => {
3408
- for (var i = r > 1 ? void 0 : r ? eo(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3409
- (s = n[o]) && (i = s(i) || i);
3410
- return i;
3411
- }, $t = (n, e) => (t, r) => e(t, r, n), Et = (n, e, t) => to(n, typeof e != "symbol" ? e + "" : e, t);
3412
- let Ue = class extends Cn {
3413
- constructor(n = pt, e, t, r) {
3414
- super(), this._config = n, this._injector = e, this._commandService = t, this._configService = r;
3415
- const { menu: i, ...o } = yn(
3416
- {},
3417
- pt,
3418
- this._config
3419
- );
3420
- i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Qn, o), this._initCommand(), this._injector.add([Qe]), this._injector.add([Xe]), this._injector.add([Je]), this._injector.add([Pe]), this._injector.add([Ke]);
3421
- }
3422
- _initCommand() {
3423
- [
3424
- Ln,
3425
- Pn,
3426
- Un,
3427
- On,
3428
- $n,
3429
- Dn,
3430
- An,
3431
- Hn,
3432
- jn,
3433
- Tt
3434
- ].forEach((n) => {
3435
- this._commandService.registerCommand(n);
3436
- });
3437
- }
3438
- };
3439
- Et(Ue, "pluginName", `${tt}_MOBILE_UI_PLUGIN`);
3440
- Et(Ue, "packageName", xt.name);
3441
- Et(Ue, "version", xt.version);
3442
- Et(Ue, "type", H.UNIVER_SHEET);
3443
- Ue = no([
3444
- fn(En),
3445
- $t(1, $(ve)),
3446
- $t(2, $(Q)),
3447
- $t(3, pn)
3448
- ], Ue);
3449
- var ro = Object.getOwnPropertyDescriptor, io = (n, e, t, r) => {
3450
- for (var i = r > 1 ? void 0 : r ? ro(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3451
- (s = n[o]) && (i = s(i) || i);
3452
- return i;
3453
- }, Be = (n, e) => (t, r) => e(t, r, n);
3454
- let Ct = class extends se {
3455
- constructor(n, e, t, r, i) {
3456
- super(), this._injector = n, this._univerInstanceService = e, this._autoFillService = t, this._conditionalFormattingRuleModel = r, this._conditionalFormattingViewModel = i, this._initAutoFill();
3457
- }
3458
- // eslint-disable-next-line max-lines-per-function
3459
- _initAutoFill() {
3460
- const n = () => ({ redos: [], undos: [] }), e = (i, o, s, u, l) => {
3461
- var p;
3462
- const g = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET).getUnitId(), a = (p = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : p.getSheetId();
3463
- if (!g || !a)
3464
- return;
3465
- const d = {
3466
- startRow: i.row,
3467
- startColumn: i.col,
3468
- endColumn: i.col,
3469
- endRow: i.row
3470
- }, h = {
3471
- startRow: o.row,
3472
- startColumn: o.col,
3473
- endColumn: o.col,
3474
- endRow: o.row
3475
- };
3476
- fe.foreach(s, (y, f) => {
3477
- const w = me.getPositionRange(
3478
- {
3479
- startRow: y,
3480
- startColumn: f,
3481
- endColumn: f,
3482
- endRow: y
3483
- },
3484
- d
3485
- ), S = me.getPositionRange(
3486
- {
3487
- startRow: y,
3488
- startColumn: f,
3489
- endColumn: f,
3490
- endRow: y
3491
- },
3492
- h
3493
- ), { row: R, col: x } = l(w.startRow, w.startColumn), T = this._conditionalFormattingViewModel.getCellCfs(
3494
- g,
3495
- a,
3496
- R,
3497
- x
3498
- ), { row: v, col: b } = l(S.startRow, S.startColumn), I = this._conditionalFormattingViewModel.getCellCfs(
3499
- g,
3500
- a,
3501
- v,
3502
- b
3503
- );
3504
- I && I.forEach((C) => {
3505
- let V = u.get(C.cfId);
3506
- if (!u.get(C.cfId)) {
3507
- const E = this._conditionalFormattingRuleModel.getRule(g, a, C.cfId);
3508
- if (!E)
3509
- return;
3510
- V = new Re(), E.ranges.forEach((U) => {
3511
- fe.foreach(U, (D, m) => {
3512
- V.setValue(D, m, 1);
3513
- });
3514
- }), u.set(C.cfId, V);
3515
- }
3516
- V.realDeleteValue(v, b);
3517
- }), T && T.forEach((C) => {
3518
- let V = u.get(C.cfId);
3519
- if (!u.get(C.cfId)) {
3520
- const E = this._conditionalFormattingRuleModel.getRule(g, a, C.cfId);
3521
- if (!E)
3522
- return;
3523
- V = new Re(), E.ranges.forEach((U) => {
3524
- fe.foreach(U, (D, m) => {
3525
- V.setValue(D, m, 1);
3526
- });
3527
- }), u.set(C.cfId, V);
3528
- }
3529
- V.setValue(v, b, 1);
3530
- });
3531
- });
3532
- }, t = (i, o) => {
3533
- var S, R, x;
3534
- const s = (S = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET)) == null ? void 0 : S.getUnitId(), u = (x = (R = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET)) == null ? void 0 : R.getActiveSheet()) == null ? void 0 : x.getSheetId(), l = /* @__PURE__ */ new Map(), g = [], a = [];
3535
- if (!s || !u)
3536
- return n();
3537
- const d = Mn([i, o]), [h, p] = d.ranges, { mapFunc: y } = d, f = {
3538
- row: h.startRow,
3539
- col: h.startColumn
3540
- };
3541
- return br.getAutoFillRepeatRange(h, p).forEach((T) => {
3542
- e(f, T.repeatStartCell, T.relativeRange, l, y);
3543
- }), l.forEach((T, v) => {
3544
- const b = this._conditionalFormattingRuleModel.getRule(s, u, v);
3545
- if (!b)
3546
- return;
3547
- const I = ht(vt(T));
3548
- if (I.length) {
3549
- const C = {
3550
- unitId: s,
3551
- subUnitId: u,
3552
- rule: { ...b, ranges: I }
3553
- };
3554
- g.push({ id: be.id, params: C }), a.push(...Le(this._injector, C));
3555
- } else {
3556
- const C = {
3557
- unitId: s,
3558
- subUnitId: u,
3559
- cfId: b.cfId
3560
- };
3561
- g.push({ id: Ie.id, params: C }), a.push(...ze(this._injector, C));
3562
- }
3563
- }), {
3564
- undos: a,
3565
- redos: g
3566
- };
3567
- }, r = {
3568
- id: tt,
3569
- onFillData: (i, o, s) => {
3570
- if (s === kt.COPY || s === kt.ONLY_FORMAT || s === kt.SERIES) {
3571
- const { source: u, target: l } = i;
3572
- return t(u, l);
3573
- }
3574
- return n();
3575
- }
3576
- };
3577
- this.disposeWithMe(this._autoFillService.addHook(r));
3578
- }
3579
- };
3580
- Ct = io([
3581
- Be(0, $(ve)),
3582
- Be(1, $(G)),
3583
- Be(2, $(yr)),
3584
- Be(3, $(X)),
3585
- Be(4, $(et))
3586
- ], Ct);
3587
- var oo = Object.getOwnPropertyDescriptor, so = (n, e, t, r) => {
3588
- for (var i = r > 1 ? void 0 : r ? oo(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3589
- (s = n[o]) && (i = s(i) || i);
3590
- return i;
3591
- }, un = (n, e) => (t, r) => e(t, r, n);
3592
- let yt = class extends se {
3593
- constructor(n, e) {
3594
- super(), this._sheetInterceptorService = n, this._conditionalFormattingService = e, this._initInterceptorEditorEnd();
3595
- }
3596
- /**
3597
- * Process the values after edit
3598
- * @private
3599
- * @memberof NumfmtService
3600
- */
3601
- _initInterceptorEditorEnd() {
3602
- this.disposeWithMe(
3603
- mn(
3604
- this._sheetInterceptorService.writeCellInterceptor.intercept(
3605
- Ir,
3606
- {
3607
- handler: (n, e, t) => {
3608
- var s, u, l;
3609
- n || t(n);
3610
- const r = this._conditionalFormattingService.composeStyle(e.unitId, e.subUnitId, e.row, e.col), i = (s = r == null ? void 0 : r.style) != null ? s : {}, o = Object.keys(i);
3611
- if (n != null && n.p)
3612
- return (l = (u = n.p.body) == null ? void 0 : u.textRuns) == null || l.forEach((g) => {
3613
- g.ts && o.forEach((a) => {
3614
- var d;
3615
- (d = g.ts) == null || delete d[a];
3616
- });
3617
- }), t(n);
3618
- {
3619
- const g = { ...(typeof (n == null ? void 0 : n.s) == "string" ? e.workbook.getStyles().get(n.s) : n == null ? void 0 : n.s) || {} };
3620
- o.forEach((d) => {
3621
- delete g[d];
3622
- });
3623
- const a = { ...n, s: { ...g } };
3624
- return t(a);
3625
- }
3626
- }
3627
- }
3628
- )
3629
- )
3630
- );
3631
- }
3632
- };
3633
- yt = so([
3634
- un(0, $(Wt)),
3635
- un(1, $(xn))
3636
- ], yt);
3637
- var ao = Object.getOwnPropertyDescriptor, lo = (n, e, t, r) => {
3638
- for (var i = r > 1 ? void 0 : r ? ao(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3639
- (s = n[o]) && (i = s(i) || i);
3640
- return i;
3641
- }, ke = (n, e) => (t, r) => e(t, r, n);
3642
- const co = (n, e) => {
3643
- const t = (a) => a.endRow - a.startRow + 1, r = (a) => a.endColumn - a.startColumn + 1, i = t(e) % t(n), o = r(e) % r(n), s = Math.floor(t(e) / t(n)), u = Math.floor(r(e) / r(n)), l = [], g = {
3644
- startRow: 0,
3645
- endRow: t(n) - 1,
3646
- startColumn: 0,
3647
- endColumn: r(n) - 1
3648
- };
3649
- if (t(e) === 1 && r(e) === 1) {
3650
- const a = {
3651
- startRow: e.startRow,
3652
- endRow: e.startRow,
3653
- startColumn: e.startColumn,
3654
- endColumn: e.startColumn
3655
- };
3656
- return l.push({ repeatRelativeRange: g, startRange: a }), l;
3657
- }
3658
- for (let a = 0; a < s + (i ? 0.1 : 0); a++)
3659
- for (let d = 0; d < u + (o ? 0.1 : 0); d++) {
3660
- const h = t(n) * a, p = r(n) * d, y = {
3661
- startRow: h + e.startRow,
3662
- endRow: h + e.startRow,
3663
- startColumn: p + e.startColumn,
3664
- endColumn: p + e.startColumn
3665
- };
3666
- let f = g;
3667
- a === s && i && (f = { ...f }, f.endRow = f.endRow - (t(n) - i)), d === u && o && (f = { ...f }, f.endColumn = f.endColumn - (r(n) - o)), l.push({ repeatRelativeRange: f, startRange: y });
3668
- }
3669
- return l;
3670
- };
3671
- let bt = class extends se {
3672
- constructor(e, t, r, i, o, s) {
3673
- super();
3674
- ge(this, "_painterConfig", null);
3675
- this._injector = e, this._univerInstanceService = t, this._formatPainterService = r, this._sheetsSelectionsService = i, this._conditionalFormattingRuleModel = o, this._conditionalFormattingViewModel = s, this._initFormattingPainter();
3676
- }
3677
- // eslint-disable-next-line max-lines-per-function
3678
- _initFormattingPainter() {
3679
- const e = () => ({ redos: [], undos: [] }), t = (o, s, u, l, g) => {
3680
- const { unitId: a, subUnitId: d } = this._painterConfig, { targetUnitId: h, targetSubUnitId: p } = g, y = {
3681
- startRow: o.row,
3682
- startColumn: o.col,
3683
- endColumn: o.col,
3684
- endRow: o.row
3685
- }, f = {
3686
- startRow: s.row,
3687
- startColumn: s.col,
3688
- endColumn: s.col,
3689
- endRow: s.row
3690
- };
3691
- fe.foreach(u, (w, S) => {
3692
- const R = me.getPositionRange(
3693
- {
3694
- startRow: w,
3695
- startColumn: S,
3696
- endColumn: S,
3697
- endRow: w
3698
- },
3699
- y
3700
- ), x = me.getPositionRange(
3701
- {
3702
- startRow: w,
3703
- startColumn: S,
3704
- endColumn: S,
3705
- endRow: w
3706
- },
3707
- f
3708
- ), T = this._conditionalFormattingViewModel.getCellCfs(
3709
- a,
3710
- d,
3711
- R.startRow,
3712
- R.startColumn
3713
- ), v = this._conditionalFormattingViewModel.getCellCfs(
3714
- h,
3715
- p,
3716
- x.startRow,
3717
- x.startColumn
3718
- );
3719
- v && v.forEach((b) => {
3720
- let I = l.get(b.cfId);
3721
- if (!l.get(b.cfId)) {
3722
- const C = this._conditionalFormattingRuleModel.getRule(h, p, b.cfId);
3723
- if (!C)
3724
- return;
3725
- I = new Re(), C.ranges.forEach((V) => {
3726
- fe.foreach(V, (E, U) => {
3727
- I.setValue(E, U, 1);
3728
- });
3729
- }), l.set(b.cfId, I);
3730
- }
3731
- I.realDeleteValue(x.startRow, x.startColumn);
3732
- }), T && T.forEach((b) => {
3733
- const I = l.get(b.cfId);
3734
- I && I.setValue(x.startRow, x.startColumn, 1);
3735
- });
3736
- });
3737
- }, r = (o, s, u) => {
3738
- var R;
3739
- const { range: l, unitId: g, subUnitId: a } = this._painterConfig, d = o !== g || a !== s, h = /* @__PURE__ */ new Map(), p = [], y = [];
3740
- if (!o || !s || !g || !a)
3741
- return e();
3742
- const f = (R = this._conditionalFormattingRuleModel.getSubunitRules(g, a)) != null ? R : [];
3743
- f == null || f.forEach((x) => {
3744
- const { ranges: T, cfId: v } = x;
3745
- if (T.some((b) => me.intersects(l, b))) {
3746
- const b = new Re();
3747
- d || T.forEach((I) => {
3748
- fe.foreach(I, (C, V) => {
3749
- b.setValue(C, V, 1);
3750
- });
3751
- }), h.set(v, b);
3752
- }
3753
- });
3754
- const w = {
3755
- row: l.startRow,
3756
- col: l.startColumn
3757
- };
3758
- return co(l, u).forEach((x) => {
3759
- t(w, { row: x.startRange.startRow, col: x.startRange.startColumn }, x.repeatRelativeRange, h, { targetUnitId: o, targetSubUnitId: s });
3760
- }), h.forEach((x, T) => {
3761
- if (d) {
3762
- const v = this._conditionalFormattingRuleModel.getRule(o, s, T), b = ht(vt(x));
3763
- if (v)
3764
- if (b.length) {
3765
- const I = {
3766
- unitId: o,
3767
- subUnitId: s,
3768
- rule: { ...v, ranges: b }
3769
- };
3770
- p.push({ id: be.id, params: I }), y.push(...Le(this._injector, I));
3771
- } else {
3772
- const I = {
3773
- unitId: o,
3774
- subUnitId: s,
3775
- cfId: v.cfId
3776
- };
3777
- p.push({ id: Ie.id, params: I }), y.push(...ze(this._injector, I));
3778
- }
3779
- else if (b.length) {
3780
- const I = this._conditionalFormattingRuleModel.getRule(g, a, T);
3781
- if (I) {
3782
- const C = {
3783
- unitId: o,
3784
- subUnitId: s,
3785
- rule: {
3786
- ..._t.deepClone(I),
3787
- cfId: this._conditionalFormattingRuleModel.createCfId(o, s),
3788
- ranges: b
3789
- }
3790
- };
3791
- p.push({ id: ee.id, params: C }), y.push(qt(this._injector, C));
3792
- }
3793
- }
3794
- } else {
3795
- const v = this._conditionalFormattingRuleModel.getRule(g, a, T);
3796
- if (!v)
3797
- return;
3798
- const b = ht(vt(x));
3799
- if (b.length) {
3800
- const I = {
3801
- unitId: g,
3802
- subUnitId: a,
3803
- rule: { ...v, ranges: b }
3804
- };
3805
- p.push({ id: be.id, params: I }), y.push(...Le(this._injector, I));
3806
- } else {
3807
- const I = {
3808
- unitId: g,
3809
- subUnitId: a,
3810
- cfId: v.cfId
3811
- };
3812
- p.push({ id: Ie.id, params: I }), y.push(...ze(this._injector, I));
3813
- }
3814
- }
3815
- }), {
3816
- undos: y,
3817
- redos: p
3818
- };
3819
- }, i = {
3820
- id: tt,
3821
- onStatusChange: (o) => {
3822
- var s, u, l;
3823
- switch (o) {
3824
- case Lt.INFINITE:
3825
- case Lt.ONCE: {
3826
- const g = (s = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET)) == null ? void 0 : s.getUnitId(), a = (l = (u = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET)) == null ? void 0 : u.getActiveSheet()) == null ? void 0 : l.getSheetId(), d = this._sheetsSelectionsService.getCurrentLastSelection(), h = d == null ? void 0 : d.range;
3827
- g && a && h && (this._painterConfig = { unitId: g, subUnitId: a, range: h });
3828
- break;
3829
- }
3830
- case Lt.OFF: {
3831
- this._painterConfig = null;
3832
- break;
3833
- }
3834
- }
3835
- },
3836
- onApply: (o, s, u) => this._painterConfig ? r(o, s, u) : {
3837
- redos: [],
3838
- undos: []
3839
- }
3840
- };
3841
- this._formatPainterService.addHook(i);
3842
- }
3843
- };
3844
- bt = lo([
3845
- ke(0, $(ve)),
3846
- ke(1, $(G)),
3847
- ke(2, $(ei)),
3848
- ke(3, $($e)),
3849
- ke(4, $(X)),
3850
- ke(5, $(et))
3851
- ], bt);
3852
- var uo = Object.getOwnPropertyDescriptor, ho = (n, e, t, r) => {
3853
- for (var i = r > 1 ? void 0 : r ? uo(e, t) : e, o = n.length - 1, s; o >= 0; o--)
3854
- (s = n[o]) && (i = s(i) || i);
3855
- return i;
3856
- }, Dt = (n, e) => (t, r) => e(t, r, n);
3857
- let It = class extends se {
3858
- constructor(n, e, t) {
3859
- super(), this._conditionalFormattingViewModel = n, this._univerInstanceService = e, this._renderManagerService = t, this._init();
3860
- }
3861
- _init() {
3862
- const n = this._univerInstanceService.getCurrentUnitForType(H.UNIVER_SHEET), e = (t) => {
3863
- const r = t.getUnitId(), i = this._renderManagerService.getRenderById(r);
3864
- if (!i)
3865
- return;
3866
- const o = i.with(Vn);
3867
- this.disposeWithMe(o.currentSkeleton$.subscribe((s) => {
3868
- if (s) {
3869
- const u = s.skeleton.rowColumnSegment, l = u.endColumn - u.startColumn + 1, a = (u.endRow - u.startRow + 1) * l * 9, d = Math.max(Pr, a);
3870
- this._conditionalFormattingViewModel.setCacheLength(d);
3871
- }
3872
- }));
3873
- };
3874
- n && e(n), this._univerInstanceService.getCurrentTypeOfUnit$(H.UNIVER_SHEET).subscribe((t) => {
3875
- t && e(t);
3876
- });
3877
- }
3878
- };
3879
- It = ho([
3880
- Dt(0, $(et)),
3881
- Dt(1, G),
3882
- Dt(2, Fn)
3883
- ], It);
3884
- const dn = [
3885
- Bt.id,
3886
- ee.id,
3887
- be.id,
3888
- Ie.id,
3889
- Rn.id
3890
- ], We = [
3891
- {
3892
- label: {
3893
- name: "sheet.cf.ruleType.highlightCell",
3894
- selectable: !1
3895
- },
3896
- value: re.highlightCell
3897
- },
3898
- {
3899
- label: {
3900
- name: "sheet.cf.panel.rankAndAverage",
3901
- selectable: !1
3902
- },
3903
- value: re.rank
3904
- },
3905
- {
3906
- label: {
3907
- name: "sheet.cf.ruleType.formula",
3908
- selectable: !1
3909
- },
3910
- value: re.formula
3911
- },
3912
- {
3913
- label: {
3914
- name: "sheet.cf.ruleType.colorScale",
3915
- selectable: !1
3916
- },
3917
- value: re.colorScale
3918
- },
3919
- {
3920
- label: {
3921
- name: "sheet.cf.ruleType.dataBar",
3922
- selectable: !1
3923
- },
3924
- value: re.dataBar
3925
- },
3926
- {
3927
- label: {
3928
- name: "sheet.cf.ruleType.iconSet",
3929
- selectable: !1
3930
- },
3931
- value: re.icon
3932
- },
3933
- {
3934
- label: {
3935
- name: "sheet.cf.menu.manageConditionalFormatting",
3936
- selectable: !1
3937
- },
3938
- value: re.viewRule
3939
- },
3940
- {
3941
- label: {
3942
- name: "sheet.cf.menu.createConditionalFormatting",
3943
- selectable: !1
3944
- },
3945
- value: re.createRule
3946
- },
3947
- {
3948
- label: {
3949
- name: "sheet.cf.menu.clearRangeRules",
3950
- selectable: !1
3951
- },
3952
- value: re.clearRangeRules,
3953
- disabled: !1
3954
- },
3955
- {
3956
- label: {
3957
- name: "sheet.cf.menu.clearWorkSheetRules",
3958
- selectable: !1
3959
- },
3960
- value: re.clearWorkSheetRules
3961
- }
3962
- ], vo = (n) => {
3963
- const e = n.get($e), t = n.get(Q), r = n.get(G), i = n.get(X), o = new Fe((l) => kn(
3964
- e.selectionMoveEnd$,
3965
- e.selectionSet$,
3966
- new Fe((g) => {
3967
- const a = t.onCommandExecuted((d) => {
3968
- var f;
3969
- const { id: h, params: p } = d, y = (f = r.getCurrentUnitForType(H.UNIVER_SHEET)) == null ? void 0 : f.getUnitId();
3970
- dn.includes(h) && p.unitId === y && g.next(null);
3971
- });
3972
- return () => a.dispose();
3973
- })
3974
- ).pipe(tn(16)).subscribe(() => {
3975
- var f;
3976
- const g = ((f = e.getCurrentSelections()) == null ? void 0 : f.map((w) => w.range)) || [], a = r.getCurrentUnitForType(H.UNIVER_SHEET);
3977
- if (!a) return;
3978
- const d = a.getActiveSheet();
3979
- if (!d) return;
3980
- const y = (i.getSubunitRules(a.getUnitId(), d.getSheetId()) || []).filter((w) => w.ranges.some((S) => g.some((R) => me.intersects(R, S)))).map((w) => w.ranges).every((w) => dt(n, a.getUnitId(), d.getSheetId(), w));
3981
- l.next(y);
3982
- })), s = new Fe(
3983
- (l) => new Fe((g) => {
3984
- const a = t.onCommandExecuted((d) => {
3985
- var f;
3986
- const { id: h, params: p } = d, y = (f = r.getCurrentUnitForType(H.UNIVER_SHEET)) == null ? void 0 : f.getUnitId();
3987
- dn.includes(h) && p.unitId === y && g.next(null);
3988
- });
3989
- return () => a.dispose();
3990
- }).pipe(tn(16)).subscribe(() => {
3991
- const g = r.getCurrentUnitForType(H.UNIVER_SHEET);
3992
- if (!g) return;
3993
- const a = g.getActiveSheet();
3994
- if (!a) return;
3995
- const d = i.getSubunitRules(g.getUnitId(), a.getSheetId()) || [];
3996
- if (!d.length)
3997
- return l.next(!1), !1;
3998
- const h = d.map((p) => p.ranges).every((p) => dt(n, g.getUnitId(), a.getSheetId(), p));
3999
- l.next(h);
4000
- })
4001
- ), u = new Fe((l) => {
4002
- o.subscribe((g) => {
4003
- const a = We.find((d) => d.value === re.clearRangeRules);
4004
- a && (a.disabled = !g, l.next(We));
4005
- }), s.subscribe((g) => {
4006
- const a = We.find((d) => d.value === re.clearWorkSheetRules);
4007
- a && (a.disabled = !g, l.next(We));
4008
- }), l.next(We);
4009
- });
4010
- return {
4011
- id: Tt.id,
4012
- type: jr.SELECTOR,
4013
- icon: "ConditionsDoubleIcon",
4014
- tooltip: "sheet.cf.title",
4015
- selections: u,
4016
- hidden$: Hr(n, H.UNIVER_SHEET),
4017
- disabled$: ti(n, { workbookTypes: [_n], worksheetTypes: [In, bn], rangeTypes: [Sn] })
4018
- };
4019
- }, go = {
4020
- [Br.RULES]: {
4021
- [Tt.id]: {
4022
- order: 1,
4023
- menuItemFactory: vo
4024
- }
4025
- }
4026
- };
4027
- var mo = Object.getOwnPropertyDescriptor, fo = (n, e, t, r) => {
4028
- for (var i = r > 1 ? void 0 : r ? mo(e, t) : e, o = n.length - 1, s; o >= 0; o--)
4029
- (s = n[o]) && (i = s(i) || i);
4030
- return i;
4031
- }, hn = (n, e) => (t, r) => e(t, r, n);
4032
- let St = class extends se {
4033
- constructor(e, t) {
4034
- super();
4035
- ge(this, "_sidebarDisposable", null);
4036
- this._injector = e, this._menuManagerService = t, this._menuManagerService.mergeMenu(go);
4037
- }
4038
- };
4039
- St = fo([
4040
- hn(0, $(ve)),
4041
- hn(1, Wr)
4042
- ], St);
4043
- var po = Object.defineProperty, Co = Object.getOwnPropertyDescriptor, yo = (n, e, t) => e in n ? po(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, bo = (n, e, t, r) => {
4044
- for (var i = r > 1 ? void 0 : r ? Co(e, t) : e, o = n.length - 1, s; o >= 0; o--)
4045
- (s = n[o]) && (i = s(i) || i);
4046
- return i;
4047
- }, At = (n, e) => (t, r) => e(t, r, n), Nt = (n, e, t) => yo(n, typeof e != "symbol" ? e + "" : e, t);
4048
- let Oe = class extends Cn {
4049
- constructor(n = pt, e, t, r) {
4050
- super(), this._config = n, this._injector = e, this._commandService = t, this._configService = r;
4051
- const { menu: i, ...o } = yn(
4052
- {},
4053
- pt,
4054
- this._config
4055
- );
4056
- i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Qn, o), this._initCommand();
4057
- }
4058
- onStarting() {
4059
- cr(this._injector, [
4060
- [Qe],
4061
- [Xe],
4062
- [Ct],
4063
- [Je],
4064
- [Ye],
4065
- [St],
4066
- [Pe],
4067
- [yt],
4068
- [ft],
4069
- [bt],
4070
- [It],
4071
- [Ke]
4072
- ]), Vt(this._injector, [
4073
- [Qe],
4074
- [Ke]
4075
- ]);
4076
- }
4077
- onReady() {
4078
- Vt(this._injector, [
4079
- [St],
4080
- [Ye]
4081
- ]);
4082
- }
4083
- onRendered() {
4084
- Vt(this._injector, [
4085
- [Ct],
4086
- [ft],
4087
- [Xe],
4088
- [yt],
4089
- [Pe],
4090
- [bt],
4091
- [Je],
4092
- [It]
4093
- ]);
4094
- }
4095
- _initCommand() {
4096
- [
4097
- Ln,
4098
- Pn,
4099
- Un,
4100
- On,
4101
- $n,
4102
- Dn,
4103
- An,
4104
- Hn,
4105
- jn,
4106
- Tt
4107
- ].forEach((n) => {
4108
- this._commandService.registerCommand(n);
4109
- });
4110
- }
4111
- };
4112
- Nt(Oe, "pluginName", `${tt}_UI_PLUGIN`);
4113
- Nt(Oe, "packageName", xt.name);
4114
- Nt(Oe, "version", xt.version);
4115
- Nt(Oe, "type", H.UNIVER_SHEET);
4116
- Oe = bo([
4117
- fn(En, ii),
4118
- At(1, $(ve)),
4119
- At(2, $(Q)),
4120
- At(3, pn)
4121
- ], Oe);
4122
- export {
4123
- Ln as AddAverageCfCommand,
4124
- Pn as AddColorScaleConditionalRuleCommand,
4125
- Un as AddDataBarConditionalRuleCommand,
4126
- On as AddDuplicateValuesCfCommand,
4127
- $n as AddNumberCfCommand,
4128
- Dn as AddRankCfCommand,
4129
- An as AddTextCfCommand,
4130
- Hn as AddTimePeriodCfCommand,
4131
- jn as AddUniqueValuesCfCommand,
4132
- ft as ConditionalFormattingClearController,
4133
- Tt as OpenConditionalFormattingOperator,
4134
- Ue as UniverSheetsConditionalFormattingMobileUIPlugin,
4135
- Oe as UniverSheetsConditionalFormattingUIPlugin
4136
- };
111
+ `,children:[q(`div`,{className:`univer-flex univer-items-center univer-gap-2`,children:d.tWithReactNode(`sheet.cf.panel.managerRuleSelect`,q(G,{className:`univer-w-36`,options:ee,value:x,onChange:e=>{S(e)}})).map((e,t)=>q(`span`,{children:e},t))}),J(`div`,{className:`univer-flex univer-justify-end univer-space-x-2`,children:[q(yt,{title:c.t(`sheet.cf.panel.createRule`),placement:`bottom`,children:q(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:ae,children:q(Ot,{})})}),O.length&&ue?q(yt,{title:c.t(`sheet.cf.panel.clear`),placement:`bottom`,children:q(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:oe,children:q(Et,{className:`univer-text-red-500`})})}):q(`div`,{children:q(Et,{className:`univer-text-gray-300`})})]})]}),q(`div`,{children:q(pt,{className:`univer-w-full`,draggableHandle:`.draggableHandle`,list:se,onListChange:()=>void 0,idKey:`cfId`,rowHeight:60,margin:[0,10],onDragStop:ie,onDragStart:re,itemRender:e=>J(`div`,{className:K(`
112
+ univer-group univer-relative univer-flex univer-items-center univer-justify-between
113
+ univer-rounded univer-py-2 univer-pl-5 univer-pr-8
114
+ hover:univer-bg-gray-100
115
+ dark:hover:!univer-bg-gray-700
116
+ `,{"univer-bg-gray-100 dark:!univer-bg-gray-700":T===e.cfId}),onMouseMove:()=>{e.ranges!==y&&b(e.ranges)},onMouseLeave:()=>b([]),onClick:()=>{t(e)},children:[q(`div`,{className:K(`
117
+ univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab
118
+ univer-items-center univer-justify-center univer-rounded
119
+ group-hover:univer-flex
120
+ `,`draggableHandle`),onClick:e=>e.stopPropagation(),children:q(Mt,{})}),J(`div`,{className:`univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden`,children:[q(`div`,{className:`
121
+ univer-text-sm univer-text-gray-900
122
+ dark:!univer-text-white
123
+ `,children:Kn(e,c)}),q(`div`,{className:`univer-text-xs univer-text-gray-400`,children:e.ranges.map(e=>St(e)).join(`,`)})]}),q(`div`,{children:q(pn,{rule:e.rule})}),q(`div`,{className:K(`
124
+ univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer
125
+ univer-items-center univer-justify-center univer-rounded univer-text-red-500
126
+ group-hover:univer-flex
127
+ hover:univer-bg-gray-200
128
+ `,{"univer-flex univer-items-center univer-justify-center":T===e.cfId}),onClick:t=>{t.stopPropagation(),ne(e),b([])},children:q(Et,{})})]})})})]})},Jn=e=>{let[t,n]=W(e.rule),[r,i]=W(!!e.rule);return q(`div`,{className:`univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4`,children:r?q(Vn,{onCancel:()=>{i(!1),n(void 0)},rule:t}):q(qn,{onClick:e=>{n(e),i(!0)},onCreate:()=>{i(!0)}})})},Yn=`sheet.conditional.formatting.panel`;let Xn=class extends i{constructor(e,t,n,r,i){super(),this._univerInstanceService=e,this._injector=t,this._componentManager=n,this._sidebarService=r,this._localeService=i,X(this,`_sidebarDisposable`,null),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(v.UNIVER_SHEET).subscribe(e=>{var t;e||(t=this._sidebarDisposable)==null||t.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.id===Yn&&(e.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){let t={id:Yn,header:{title:this._localeService.t(`sheet.cf.title`)},children:{label:Yn,rule:e,key:b(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(t)}_initPanel(){this.disposeWithMe(this._componentManager.register(Yn,Jn))}};Xn=Q([Z(0,s),Z(1,c(l)),Z(2,c($e)),Z(3,c(nt)),Z(4,c(f))],Xn);let $=function(e){return e[e.createRule=1]=`createRule`,e[e.viewRule=2]=`viewRule`,e[e.highlightCell=3]=`highlightCell`,e[e.rank=4]=`rank`,e[e.formula=5]=`formula`,e[e.colorScale=6]=`colorScale`,e[e.dataBar=7]=`dataBar`,e[e.icon=8]=`icon`,e[e.clearRangeRules=9]=`clearRangeRules`,e[e.clearWorkSheetRules=10]=`clearWorkSheetRules`,e}({});const Zn={id:`sheet.operation.open.conditional.formatting.panel`,type:n.OPERATION,handler:(e,t)=>{var n;let r=e.get(Xn),i=e.get(fe),o=e.get(a),s=((n=i.getCurrentSelections())==null?void 0:n.map(e=>e.range))||[];switch(t.value){case $.highlightCell:r.openPanel({...He(),ranges:s});break;case $.rank:{let e={...He,ranges:s,rule:{type:M.highlightCell,subType:N.rank}};r.openPanel(e);break}case $.formula:{let e={...He,ranges:s,rule:{type:M.highlightCell,subType:N.formula,value:`=`}};r.openPanel(e);break}case $.colorScale:{let e={...He,ranges:s,rule:{type:M.colorScale,config:[]}};r.openPanel(e);break}case $.dataBar:{let e={...He,ranges:s,rule:{type:M.dataBar,isShowValue:!0}};r.openPanel(e);break}case $.icon:{let e={...He,ranges:s,rule:{type:M.iconSet,config:[],isShowValue:!0}};r.openPanel(e);break}case $.viewRule:r.openPanel();break;case $.createRule:r.openPanel({...He(),ranges:s});break;case $.clearRangeRules:o.executeCommand(we.id,{ranges:s});break;case $.clearWorkSheetRules:o.executeCommand(Te.id);break}return!0}};let Qn=class extends i{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{let t=[],n=[],r={redos:t,undos:n};if([ne.id,te.id].includes(e.id)){var i;let e=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(e=>e.range);if(!e)return r;let a=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET),o=a.getActiveSheet();if(!o)return r;let s=a.getUnitId(),c=o.getSheetId(),l=this._conditionalFormattingRuleModel.getSubunitRules(s,c);if(!l||!l.length)return r;let{redos:u,undos:d}=$n(this._injector,l,e,s,c);t.push(...u),n.push(...d)}return r}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:n})=>{let r=[],i=[],a={redos:r,undos:i};if(!n||!n.length)return a;let o=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!o||!o.length)return a;let{redos:s,undos:c}=$n(this._injector,o,n,e,t);return r.push(...s),i.push(...c),a}}))}};Qn=Q([Z(0,c(l)),Z(1,c(s)),Z(2,c(ue)),Z(3,c(fe)),Z(4,c(L))],Qn);function $n(e,t,n,r,i){let a=[],o=[];return t.filter(e=>n.some(t=>e.ranges.some(e=>g.getIntersects(e,t)))).forEach(t=>{let s=new ae().add(...t.ranges).subtract(...n).merge();if(s.length){let n={id:z.id,params:{unitId:r,subUnitId:i,rule:{...t,ranges:s}}},c=Qe(e,n.params);a.push(n),o.push(...c)}else{let n={id:R.id,params:{unitId:r,subUnitId:i,cfId:t.cfId}},s=Ne(e,n.params);a.push(n),o.push(...s)}}),{redos:a,undos:o}}var er=`@univerjs/sheets-conditional-formatting-ui`,tr=`0.18.0`;const nr=`sheets-conditional-formatting-ui.config`;Symbol(nr);const rr={};let ir=class extends i{constructor(e,t,n){super(),this._conditionalFormattingRuleModel=e,this._formulaRefRangeService=t,this._injector=n,X(this,`_disposableMap`,new Map),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}_${t}_${n}`}_getRuleFormulas(e){let t=[],n=e.rule;switch(n.type){case M.highlightCell:n.subType===N.formula&&t.push(n.value);break;case M.dataBar:{let e=n;e.config.min.type===I.formula&&t.push(e.config.min.value),e.config.max.type===I.formula&&t.push(e.config.max.value);break}case M.colorScale:n.config.forEach(e=>{e.value.type===I.formula&&t.push(e.value.value)});break;case M.iconSet:n.config.forEach(e=>{e.value.type===I.formula&&t.push(e.value.value)});break}return t}_updateRuleFormulas(e,t){let n=_.deepClone(e),r=n.rule,i=0;switch(r.type){case M.highlightCell:r.subType===N.formula&&(r.value=t[i++]);break;case M.dataBar:{let e=r;e.config.min.type===I.formula&&(e.config.min.value=t[i++]),e.config.max.type===I.formula&&(e.config.max.value=t[i++]);break}case M.colorScale:r.config.forEach(e=>{e.value.type===I.formula&&(e.value.value=t[i++])});break;case M.iconSet:r.config.forEach(e=>{e.value.type===I.formula&&(e.value.value=t[i++])});break}return n}register(e,t,n){let r=n.ranges,i=this._getRuleFormulas(n),a=this._formulaRefRangeService.registerRangeFormula(e,t,r,i,r=>{if(r.length===0)return{undos:[{id:A.id,params:{unitId:e,subUnitId:t,rule:n}}],redos:[{id:R.id,params:{unitId:e,subUnitId:t,cfId:n.cfId}}]};let i=[],a=[],o=r[0],s=this._updateRuleFormulas(n,o.formulas);s.ranges=o.ranges,i.push({id:z.id,params:{unitId:e,subUnitId:t,cfId:n.cfId,rule:s}}),a.push(...Qe(this._injector,{unitId:e,subUnitId:t,cfId:n.cfId,rule:s}));for(let o=1;o<r.length;o++){let s=r[o],c=Ve(),l=this._updateRuleFormulas(n,s.formulas);l.cfId=c,l.ranges=s.ranges,i.push({id:A.id,params:{unitId:e,subUnitId:t,rule:l}}),a.push(Se(this._injector,{unitId:e,subUnitId:t,rule:l}))}return{undos:a,redos:i}}),o=this._getIdWithUnitId(e,t,n.cfId);this._disposableMap.set(o,a)}_initRefRange(){let e=this._conditionalFormattingRuleModel.getAll();for(let[t,n]of e)for(let[e,r]of n)for(let n of r)this.register(t,e,n);this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{let{unitId:t,subUnitId:n,rule:r}=e;switch(e.type){case`add`:this.register(t,n,r);break;case`delete`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e));break}case`set`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e)),this.register(t,n,r);break}}})),this.disposeWithMe(T(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};ir=Q([Z(0,c(L)),Z(1,c(Xt)),Z(2,c(l))],ir);let ar=class extends i{constructor(e,t,n,r,i){super(),this._sheetClipboardService=e,this._conditionalFormattingRuleModel=t,this._injector=n,this._conditionalFormattingViewModel=r,this._univerInstanceService=i,X(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Le,onBeforeCopy:(e,t,n)=>this._collectConditionalRule(e,t,n),onPasteCells:(e,t,n,r)=>{let{copyType:i=Lt.COPY,pasteType:a}=r,{range:o}=e||{},{range:s}=t;return this._generateConditionalFormattingMutations(s,{copyType:i,pasteType:a,copyRange:o})}}))}_collectConditionalRule(e,t,n){let r=new p,i={};this._copyInfo={matrix:r,info:{unitId:e,subUnitId:t,cfMap:i}};let a=this._injector.invoke(r=>ye(n,r,e,t));if(!a)return;let{rows:o,cols:s}=a,c=new Set;o.forEach((n,i)=>{s.forEach((a,o)=>{let s=this._conditionalFormattingViewModel.getCellCfs(e,t,n,a);s&&(s.forEach(e=>c.add(e.cfId)),r.setValue(i,o,s.map(e=>e.cfId)))})}),c.forEach(n=>{let r=this._conditionalFormattingRuleModel.getRule(e,t,n);r&&(i[n]=r.rule)})}_generateConditionalFormattingMutations(e,t){let n=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET),r=n.getActiveSheet(),i=n.getUnitId();if(!r)return{redos:[],undos:[]};let a=r.getSheetId();if(t.copyType===Lt.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!t.copyRange||![Vt.SPECIAL_PASTE_FORMAT,Vt.DEFAULT_PASTE,Vt.SPECIAL_PASTE_BESIDES_BORDER].includes(t.pasteType))return{redos:[],undos:[]};let{ranges:[o,s],mapFunc:c}=Kt([t.copyRange,e]),l=Wt(o,s,!0),u={};h.foreach(s,(e,t)=>{let{row:n,col:r}=c(e,t),o=this._conditionalFormattingViewModel.getCellCfs(i,a,n,r);o&&o.forEach(e=>{if(!u[e.cfId]){let t=new p;u[e.cfId]=t;let n=this._conditionalFormattingRuleModel.getRule(i,a,e.cfId);n==null||n.ranges.forEach(e=>{h.foreach(e,(e,n)=>{t.setValue(e,n,1)})})}u[e.cfId].realDeleteValue(n,r)})});let{matrix:d,info:f}=this._copyInfo,m=[],y=this._conditionalFormattingRuleModel.createCfId(i,a),b={},x=e=>{if(b[e])return b[e];let t=f==null?void 0:f.cfMap[e],n=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...m].find(e=>_.diffValue(e.rule,t));if(n)return b[e]=n,n;{let n={rule:t,cfId:y,ranges:[],stopIfTrue:!1};return b[e]=n,m.push(n),y=`${Number(y)+1}`,n}};l.forEach(e=>{d&&d.forValue((t,n,r)=>{let i=g.getPositionRange({startRow:t,endRow:t,startColumn:n,endColumn:n},e.startRange),{row:a,col:o}=c(i.startRow,i.startColumn);r.forEach(e=>{if(!u[e]){let t=x(e),n=new p;u[e]=n,t.ranges.forEach(e=>{h.foreach(e,(e,t)=>{n.setValue(e,t,1)})})}u[e].setValue(a,o,1)})})});let S=[],C=[];for(let e in u){let t=u[e],n=ve(_e(t));if(!n.length){let t={unitId:i,subUnitId:a,cfId:e};S.push({id:R.id,params:t}),C.push(...Ne(this._injector,t))}if(m.some(t=>t.cfId===e)){let t={unitId:i,subUnitId:a,rule:{...x(e),ranges:n}};S.push({id:A.id,params:t}),C.push(Se(this._injector,t))}else{let t=this._conditionalFormattingRuleModel.getRule(i,a,e);if(!t)continue;let r={unitId:i,subUnitId:a,rule:{...t,ranges:n}};S.push({id:z.id,params:r}),C.push(...Qe(this._injector,r))}}return{redos:S,undos:C}}};ar=Q([Z(0,c(Bt)),Z(1,c(L)),Z(2,c(l)),Z(3,c(De)),Z(4,c(s))],ar);let or=class extends i{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===xe.id){let{unitId:t,subUnitId:n,rule:{ranges:r}}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[pe],rangeTypes:[oe],worksheetTypes:[me,he]},r,t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.setStyleErr`))}}))}};or=Q([Z(0,c(f)),Z(1,a),Z(2,c(de))],or);let sr=class extends i{constructor(e,t,n,r,i,a){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=a,X(this,`_ruleChangeCacheMap`,new Map),this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var e,t;let n=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET).getUnitId();(e=this._renderManagerService.getRenderById(n))==null||e.with(Ht).reCalculate(),(t=this._renderManagerService.getRenderById(n))==null||(t=t.mainComponent)==null||t.makeDirty()}_initSkeleton(){this.disposeWithMe(Yt(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe($t(16),tn(e=>!!e.length),tn(e=>{let t=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET);if(!t)return!1;let n=t.getActiveSheet();return n?e.filter(e=>e.unitId===t.getUnitId()&&e.subUnitId===n.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(ie.CELL_CONTENT,{effect:u.Style,handler:(e,t,n)=>{let r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);let i=t.workbook.getStyles(),a=(typeof(e==null?void 0:e.s)==`string`?i.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},o=e===t.rawData?{...t.rawData}:e;if(r.style){let e={...a,...r.style};Object.assign(o,{s:e})}return o.fontRenderExtension||(o.fontRenderExtension={},r.isShowValue!==void 0&&(o.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(o.dataBar=r.dataBar),r.iconSet&&(o.iconSet=r.iconSet,o.fontRenderExtension.leftOffset=Ae+je),n(o)},priority:10}))}};sr=Q([Z(0,c(ue)),Z(1,c(Ee)),Z(2,c(s)),Z(3,c(Qt)),Z(4,c(De)),Z(5,c(L))],sr);let cr=class extends m{constructor(e=rr,t,n,r){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=r;let{menu:i,...a}=S({},rr,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(nr,a),this._initCommand(),this._injector.add([sr]),this._injector.add([ar]),this._injector.add([or]),this._injector.add([Gn]),this._injector.add([ir])}_initCommand(){[nn,rn,an,on,sn,cn,ln,un,dn,Zn].forEach(e=>{this._commandService.registerCommand(e)})}};X(cr,`pluginName`,`${Le}_MOBILE_UI_PLUGIN`),X(cr,`packageName`,er),X(cr,`version`,tr),X(cr,`type`,v.UNIVER_SHEET),cr=Q([r(ze),Z(1,c(l)),Z(2,c(a)),Z(3,o)],cr);let lr=class extends i{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=i,this._initAutoFill()}_initAutoFill(){let e=()=>({redos:[],undos:[]}),t=(e,t,n,r,i)=>{var a;let o=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET).getUnitId(),s=(a=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET).getActiveSheet())==null?void 0:a.getSheetId();if(!o||!s)return;let c={startRow:e.row,startColumn:e.col,endColumn:e.col,endRow:e.row},l={startRow:t.row,startColumn:t.col,endColumn:t.col,endRow:t.row};h.foreach(n,(e,t)=>{let n=g.getPositionRange({startRow:e,startColumn:t,endColumn:t,endRow:e},c),a=g.getPositionRange({startRow:e,startColumn:t,endColumn:t,endRow:e},l),{row:u,col:d}=i(n.startRow,n.startColumn),f=this._conditionalFormattingViewModel.getCellCfs(o,s,u,d),{row:m,col:_}=i(a.startRow,a.startColumn),v=this._conditionalFormattingViewModel.getCellCfs(o,s,m,_);v&&v.forEach(e=>{let t=r.get(e.cfId);if(!r.get(e.cfId)){let n=this._conditionalFormattingRuleModel.getRule(o,s,e.cfId);if(!n)return;t=new p,n.ranges.forEach(e=>{h.foreach(e,(e,n)=>{t.setValue(e,n,1)})}),r.set(e.cfId,t)}t.realDeleteValue(m,_)}),f&&f.forEach(e=>{let t=r.get(e.cfId);if(!r.get(e.cfId)){let n=this._conditionalFormattingRuleModel.getRule(o,s,e.cfId);if(!n)return;t=new p,n.ranges.forEach(e=>{h.foreach(e,(e,n)=>{t.setValue(e,n,1)})}),r.set(e.cfId,t)}t.setValue(m,_,1)})})},n=(n,r)=>{var i,a;let o=(i=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET))==null?void 0:i.getUnitId(),s=(a=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET))==null||(a=a.getActiveSheet())==null?void 0:a.getSheetId(),c=new Map,l=[],u=[];if(!o||!s)return e();let d=Kt([n,r]),[f,p]=d.ranges,{mapFunc:m}=d,h={row:f.startRow,col:f.startColumn};return O.getAutoFillRepeatRange(f,p).forEach(e=>{t(h,e.repeatStartCell,e.relativeRange,c,m)}),c.forEach((e,t)=>{let n=this._conditionalFormattingRuleModel.getRule(o,s,t);if(!n)return;let r=ve(_e(e));if(r.length){let e={unitId:o,subUnitId:s,rule:{...n,ranges:r}};l.push({id:z.id,params:e}),u.push(...Qe(this._injector,e))}else{let e={unitId:o,subUnitId:s,cfId:n.cfId};l.push({id:R.id,params:e}),u.push(...Ne(this._injector,e))}}),{undos:u,redos:l}},r={id:Le,onFillData:(t,r,i)=>{if(i===D.COPY||i===D.ONLY_FORMAT||i===D.SERIES){let{source:e,target:r}=t;return n(e,r)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};lr=Q([Z(0,c(l)),Z(1,c(s)),Z(2,c(re)),Z(3,c(L)),Z(4,c(De))],lr);let ur=class extends i{constructor(e,t){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(T(this._sheetInterceptorService.writeCellInterceptor.intercept(ee,{handler:(e,t,n)=>{var r;e||n(e);let i=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col),a=(r=i==null?void 0:i.style)==null?{}:r,o=Object.keys(a);if(e!=null&&e.p){var s;return(s=e.p.body)==null||(s=s.textRuns)==null||s.forEach(e=>{e.ts&&o.forEach(t=>{var n;(n=e.ts)==null||delete n[t]})}),n(e)}else{let r={...(typeof(e==null?void 0:e.s)==`string`?t.workbook.getStyles().get(e.s):e==null?void 0:e.s)||{}};return o.forEach(e=>{delete r[e]}),n({...e,s:{...r}})}}})))}};ur=Q([Z(0,c(ue)),Z(1,c(Ee))],ur);const dr=(e,t)=>{let n=e=>e.endRow-e.startRow+1,r=e=>e.endColumn-e.startColumn+1,i=n(t)%n(e),a=r(t)%r(e),o=Math.floor(n(t)/n(e)),s=Math.floor(r(t)/r(e)),c=[],l={startRow:0,endRow:n(e)-1,startColumn:0,endColumn:r(e)-1};if(n(t)===1&&r(t)===1){let e={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};return c.push({repeatRelativeRange:l,startRange:e}),c}for(let u=0;u<o+(i?.1:0);u++)for(let d=0;d<s+(a?.1:0);d++){let f=n(e)*u,p=r(e)*d,m={startRow:f+t.startRow,endRow:f+t.startRow,startColumn:p+t.startColumn,endColumn:p+t.startColumn},h=l;u===o&&i&&(h={...h},h.endRow-=n(e)-i),d===s&&a&&(h={...h},h.endColumn-=r(e)-a),c.push({repeatRelativeRange:h,startRange:m})}return c};let fr=class extends i{constructor(e,t,n,r,i,a){super(),this._injector=e,this._univerInstanceService=t,this._formatPainterService=n,this._sheetsSelectionsService=r,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=a,X(this,`_painterConfig`,null),this._initFormattingPainter()}_initFormattingPainter(){let e=()=>({redos:[],undos:[]}),t=(e,t,n,r,i)=>{let{unitId:a,subUnitId:o}=this._painterConfig,{targetUnitId:s,targetSubUnitId:c}=i,l={startRow:e.row,startColumn:e.col,endColumn:e.col,endRow:e.row},u={startRow:t.row,startColumn:t.col,endColumn:t.col,endRow:t.row};h.foreach(n,(e,t)=>{let n=g.getPositionRange({startRow:e,startColumn:t,endColumn:t,endRow:e},l),i=g.getPositionRange({startRow:e,startColumn:t,endColumn:t,endRow:e},u),d=this._conditionalFormattingViewModel.getCellCfs(a,o,n.startRow,n.startColumn),f=this._conditionalFormattingViewModel.getCellCfs(s,c,i.startRow,i.startColumn);f&&f.forEach(e=>{let t=r.get(e.cfId);if(!r.get(e.cfId)){let n=this._conditionalFormattingRuleModel.getRule(s,c,e.cfId);if(!n)return;t=new p,n.ranges.forEach(e=>{h.foreach(e,(e,n)=>{t.setValue(e,n,1)})}),r.set(e.cfId,t)}t.realDeleteValue(i.startRow,i.startColumn)}),d&&d.forEach(e=>{let t=r.get(e.cfId);t&&t.setValue(i.startRow,i.startColumn,1)})})},n=(n,r,i)=>{var a;let{range:o,unitId:s,subUnitId:c}=this._painterConfig,l=n!==s||c!==r,u=new Map,d=[],f=[];if(!n||!r||!s||!c)return e();let m=(a=this._conditionalFormattingRuleModel.getSubunitRules(s,c))==null?[]:a;m==null||m.forEach(e=>{let{ranges:t,cfId:n}=e;if(t.some(e=>g.intersects(o,e))){let e=new p;l||t.forEach(t=>{h.foreach(t,(t,n)=>{e.setValue(t,n,1)})}),u.set(n,e)}});let v={row:o.startRow,col:o.startColumn};return dr(o,i).forEach(e=>{t(v,{row:e.startRange.startRow,col:e.startRange.startColumn},e.repeatRelativeRange,u,{targetUnitId:n,targetSubUnitId:r})}),u.forEach((e,t)=>{if(l){let i=this._conditionalFormattingRuleModel.getRule(n,r,t),a=ve(_e(e));if(!i){if(a.length){let e=this._conditionalFormattingRuleModel.getRule(s,c,t);if(e){let t={unitId:n,subUnitId:r,rule:{..._.deepClone(e),cfId:this._conditionalFormattingRuleModel.createCfId(n,r),ranges:a}};d.push({id:A.id,params:t}),f.push(Se(this._injector,t))}}}else if(a.length){let e={unitId:n,subUnitId:r,rule:{...i,ranges:a}};d.push({id:z.id,params:e}),f.push(...Qe(this._injector,e))}else{let e={unitId:n,subUnitId:r,cfId:i.cfId};d.push({id:R.id,params:e}),f.push(...Ne(this._injector,e))}}else{let n=this._conditionalFormattingRuleModel.getRule(s,c,t);if(!n)return;let r=ve(_e(e));if(r.length){let e={unitId:s,subUnitId:c,rule:{...n,ranges:r}};d.push({id:z.id,params:e}),f.push(...Qe(this._injector,e))}else{let e={unitId:s,subUnitId:c,cfId:n.cfId};d.push({id:R.id,params:e}),f.push(...Ne(this._injector,e))}}}),{undos:f,redos:d}},r={id:Le,onStatusChange:e=>{switch(e){case Rt.INFINITE:case Rt.ONCE:{var t,n;let e=(t=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET))==null?void 0:t.getUnitId(),r=(n=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET))==null||(n=n.getActiveSheet())==null?void 0:n.getSheetId(),i=this._sheetsSelectionsService.getCurrentLastSelection(),a=i==null?void 0:i.range;e&&r&&a&&(this._painterConfig={unitId:e,subUnitId:r,range:a});break}case Rt.OFF:this._painterConfig=null;break}},onApply:(e,t,r)=>this._painterConfig?n(e,t,r):{redos:[],undos:[]}};this._formatPainterService.addHook(r)}};fr=Q([Z(0,c(l)),Z(1,c(s)),Z(2,c(zt)),Z(3,c(fe)),Z(4,c(L)),Z(5,c(De))],fr);let pr=class extends i{constructor(e,t,n){super(),this._conditionalFormattingViewModel=e,this._univerInstanceService=t,this._renderManagerService=n,this._init()}_init(){let e=this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET),t=e=>{let t=e.getUnitId(),n=this._renderManagerService.getRenderById(t);if(!n)return;let r=n.with(Ht);this.disposeWithMe(r.currentSkeleton$.subscribe(e=>{if(e){let t=e.skeleton.rowColumnSegment,n=t.endColumn-t.startColumn+1,r=(t.endRow-t.startRow+1)*n*9,i=Math.max(Ce,r);this._conditionalFormattingViewModel.setCacheLength(i)}}))};e&&t(e),this._univerInstanceService.getCurrentTypeOfUnit$(v.UNIVER_SHEET).subscribe(e=>{e&&t(e)})}};pr=Q([Z(0,c(De)),Z(1,s),Z(2,Qt)],pr);const mr=[le.id,A.id,z.id,R.id,Ie.id],hr=[{label:{name:`sheet.cf.ruleType.highlightCell`,selectable:!1},value:$.highlightCell},{label:{name:`sheet.cf.panel.rankAndAverage`,selectable:!1},value:$.rank},{label:{name:`sheet.cf.ruleType.formula`,selectable:!1},value:$.formula},{label:{name:`sheet.cf.ruleType.colorScale`,selectable:!1},value:$.colorScale},{label:{name:`sheet.cf.ruleType.dataBar`,selectable:!1},value:$.dataBar},{label:{name:`sheet.cf.ruleType.iconSet`,selectable:!1},value:$.icon},{label:{name:`sheet.cf.menu.manageConditionalFormatting`,selectable:!1},value:$.viewRule},{label:{name:`sheet.cf.menu.createConditionalFormatting`,selectable:!1},value:$.createRule},{label:{name:`sheet.cf.menu.clearRangeRules`,selectable:!1},value:$.clearRangeRules,disabled:!1},{label:{name:`sheet.cf.menu.clearWorkSheetRules`,selectable:!1},value:$.clearWorkSheetRules}],gr=e=>{let t=e.get(fe),n=e.get(a),r=e.get(s),i=e.get(L),o=new qt(a=>Yt(t.selectionMoveEnd$,t.selectionSet$,new qt(e=>{let t=n.onCommandExecuted(t=>{var n;let{id:i,params:a}=t,o=(n=r.getCurrentUnitForType(v.UNIVER_SHEET))==null?void 0:n.getUnitId();mr.includes(i)&&a.unitId===o&&e.next(null)});return()=>t.dispose()})).pipe(en(16)).subscribe(()=>{var n;let o=((n=t.getCurrentSelections())==null?void 0:n.map(e=>e.range))||[],s=r.getCurrentUnitForType(v.UNIVER_SHEET);if(!s)return;let c=s.getActiveSheet();if(!c)return;let l=(i.getSubunitRules(s.getUnitId(),c.getSheetId())||[]).filter(e=>e.ranges.some(e=>o.some(t=>g.intersects(t,e)))).map(e=>e.ranges).every(t=>ge(e,s.getUnitId(),c.getSheetId(),t));a.next(l)})),c=new qt(t=>new qt(e=>{let t=n.onCommandExecuted(t=>{var n;let{id:i,params:a}=t,o=(n=r.getCurrentUnitForType(v.UNIVER_SHEET))==null?void 0:n.getUnitId();mr.includes(i)&&a.unitId===o&&e.next(null)});return()=>t.dispose()}).pipe(en(16)).subscribe(()=>{let n=r.getCurrentUnitForType(v.UNIVER_SHEET);if(!n)return;let a=n.getActiveSheet();if(!a)return;let o=i.getSubunitRules(n.getUnitId(),a.getSheetId())||[];if(!o.length)return t.next(!1),!1;let s=o.map(e=>e.ranges).every(t=>ge(e,n.getUnitId(),a.getSheetId(),t));t.next(s)})),l=new qt(e=>{o.subscribe(t=>{let n=hr.find(e=>e.value===$.clearRangeRules);n&&(n.disabled=!t,e.next(hr))}),c.subscribe(t=>{let n=hr.find(e=>e.value===$.clearWorkSheetRules);n&&(n.disabled=!t,e.next(hr))}),e.next(hr)});return{id:Zn.id,type:rt.SELECTOR,icon:`ConditionsDoubleIcon`,tooltip:`sheet.cf.title`,selections:l,hidden$:at(e,v.UNIVER_SHEET),disabled$:Ut(e,{workbookTypes:[pe],worksheetTypes:[he,me],rangeTypes:[oe]})}},_r={[it.RULES]:{[Zn.id]:{order:1,menuItemFactory:gr}}};let vr=class extends i{constructor(e,t){super(),this._injector=e,this._menuManagerService=t,X(this,`_sidebarDisposable`,null),this._menuManagerService.mergeMenu(_r)}};vr=Q([Z(0,c(l)),Z(1,tt)],vr);let yr=class extends m{constructor(e=rr,t,n,r){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=r;let{menu:i,...a}=S({},rr,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(nr,a),this._initCommand()}onStarting(){C(this._injector,[[sr],[ar],[lr],[or],[Xn],[vr],[Gn],[ur],[Qn],[fr],[pr],[ir]]),E(this._injector,[[sr],[ir]])}onReady(){E(this._injector,[[vr],[Xn]])}onRendered(){E(this._injector,[[lr],[Qn],[ar],[ur],[Gn],[fr],[or],[pr]])}_initCommand(){[nn,rn,an,on,sn,cn,ln,un,dn,Zn].forEach(e=>{this._commandService.registerCommand(e)})}};X(yr,`pluginName`,`${Le}_UI_PLUGIN`),X(yr,`packageName`,er),X(yr,`version`,tr),X(yr,`type`,v.UNIVER_SHEET),yr=Q([r(ze,Zt),Z(1,c(l)),Z(2,c(a)),Z(3,o)],yr);export{nn as AddAverageCfCommand,rn as AddColorScaleConditionalRuleCommand,an as AddDataBarConditionalRuleCommand,on as AddDuplicateValuesCfCommand,sn as AddNumberCfCommand,cn as AddRankCfCommand,ln as AddTextCfCommand,un as AddTimePeriodCfCommand,dn as AddUniqueValuesCfCommand,Qn as ConditionalFormattingClearController,Zn as OpenConditionalFormattingOperator,cr as UniverSheetsConditionalFormattingMobileUIPlugin,yr as UniverSheetsConditionalFormattingUIPlugin};