@univerjs/sheets-numfmt 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,62 +1,64 @@
1
- var $t = Object.defineProperty;
2
- var Ut = (e, t, r) => t in e ? $t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var Y = (e, t, r) => (Ut(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { CommandType as X, ICommandService as D, IUniverInstanceService as E, IUndoRedoService as At, sequenceExecute as Lt, Tools as Vt, Disposable as H, OnLifecycle as k, LifecycleStages as $, Range as R, Rectangle as De, LocaleType as Ht, ObjectMatrix as ut, CellValueType as ie, toDisposable as q, ThemeService as dt, LocaleService as j, runOnLifecycle as kt, ILocalStorageService as Ft, DisposableCollection as mt, UniverInstanceType as de, Plugin as Bt, PluginType as zt } from "@univerjs/core";
5
- import { transformCellsToRange as me, rangeMerge as z, SetNumfmtMutation as x, factorySetNumfmtUndoMutation as he, RemoveNumfmtMutation as M, factoryRemoveNumfmtUndoMutation as J, INumfmtService as U, INTERCEPTOR_POINT as ht, SheetInterceptorService as Ae, SelectionManagerService as ee, ClearSelectionFormatCommand as Wt, ClearSelectionAllCommand as Kt, SetRangeValuesCommand as Gt, getCurrentSheetDisabled$ as fe, RefRangeService as Yt, EffectRefRangId as N, handleMoveRows as Zt, handleMoveCols as qt, handleIRemoveRow as Jt, handleIRemoveCol as Qt, handleMoveRange as Xt, handleInsertRow as en, handleInsertRangeMoveRight as tn, handleInsertRangeMoveDown as nn, handleInsertCol as rn, handleDeleteRangeMoveUp as sn, handleDeleteRangeMoveLeft as an, runRefRangeMutations as on, RemoveSheetCommand as cn } from "@univerjs/sheets";
6
- import { Inject as _, Injector as K, createIdentifier as ln } from "@wendellhu/redi";
7
- import { IAutoFillService as un, APPLY_TYPE as He, getAutoFillRepeatRange as dn, SheetSkeletonManagerService as Ke, COPY_TYPE as rt, PREDEFINED_HOOK_NAME as st, getRepeatRange as mn, ISheetClipboardService as hn, IEditorBridgeService as fn } from "@univerjs/sheets-ui";
8
- import { map as le, distinctUntilChanged as ft, switchMap as pt, tap as pn, debounceTime as vn, filter as it, bufferTime as gn } from "rxjs/operators";
9
- import V from "@univerjs/engine-numfmt";
10
- import { IRenderManagerService as _n, ITextSelectionRenderManager as Sn } from "@univerjs/engine-render";
11
- import { ComponentManager as vt, ISidebarService as Cn, MenuItemType as pe, MenuGroup as ve, MenuPosition as ge, getMenuHiddenObservable as _e, IMenuService as bn } from "@univerjs/ui";
12
- import { Observable as Z, combineLatest as yn, merge as Ge } from "rxjs";
13
- import Rn, { createContext as In, useState as w, useEffect as Ye, useRef as Ze, useContext as gt, useMemo as L, createElement as te, forwardRef as ae } from "react";
14
- import { InputNumber as qe, Select as Je, SelectList as Qe, Button as at } from "@univerjs/design";
15
- import { useDependency as T, useInjector as Mn } from "@wendellhu/redi/react-bindings";
16
- import { FormulaDataModel as Pn } from "@univerjs/engine-formula";
17
- const Q = {
1
+ var gt = Object.defineProperty;
2
+ var _t = (e, t, r) => t in e ? gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var U = (e, t, r) => (_t(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import { CommandType as V, ICommandService as $, IUniverInstanceService as W, IUndoRedoService as St, sequenceExecute as Ct, LocaleType as yt, Disposable as X, ObjectMatrix as bt, CellValueType as z, Range as E, toDisposable as Q, OnLifecycle as ee, LifecycleStages as K, ThemeService as ze, LocaleService as x, runOnLifecycle as It, ILocalStorageService as Mt, UniverInstanceType as j, DisposableCollection as xt, Plugin as Nt } from "@univerjs/core";
5
+ import { getSheetCommandTarget as Re, transformCellsToRange as We, rangeMerge as Ve, SetNumfmtMutation as te, factorySetNumfmtUndoMutation as Ke, RemoveNumfmtMutation as _e, factoryRemoveNumfmtUndoMutation as Ge, INTERCEPTOR_POINT as Ze, SheetInterceptorService as Oe, INumfmtService as G, SelectionManagerService as H, SetRangeValuesCommand as Tt, getCurrentSheetDisabled$ as ne } from "@univerjs/sheets";
6
+ import { Inject as S, createIdentifier as Rt, Injector as Pe } from "@wendellhu/redi";
7
+ import { SheetSkeletonManagerService as qe, IEditorBridgeService as Ot, deriveStateFromActiveSheet$ as Pt } from "@univerjs/sheets-ui";
8
+ import { map as Ye, distinctUntilChanged as Et, switchMap as jt, tap as Dt, debounceTime as $t } from "rxjs/operators";
9
+ import D from "@univerjs/engine-numfmt";
10
+ import { IRenderManagerService as wt, ITextSelectionRenderManager as Lt } from "@univerjs/engine-render";
11
+ import { ComponentManager as Je, ISidebarService as Ut, MenuItemType as re, MenuGroup as se, MenuPosition as ie, getMenuHiddenObservable as ae, IMenuService as At } from "@univerjs/ui";
12
+ import { Observable as J, combineLatest as Vt, merge as Qe } from "rxjs";
13
+ import Ht, { createContext as Bt, useState as M, useEffect as Ee, useRef as je, useContext as Xe, useMemo as P, createElement as B, forwardRef as Z } from "react";
14
+ import { InputNumber as De, Select as $e, SelectList as we, Button as He } from "@univerjs/design";
15
+ import { useDependency as T, useInjector as kt } from "@wendellhu/redi/react-bindings";
16
+ const A = {
18
17
  id: "sheet.command.numfmt.set.numfmt",
19
- type: X.COMMAND,
18
+ type: V.COMMAND,
20
19
  handler: (e, t) => {
21
20
  if (!t)
22
21
  return !1;
23
- const r = e.get(D), n = e.get(E), s = e.get(At), i = n.getCurrentUniverSheetInstance(), a = i.getUnitId(), c = i.getActiveSheet().getSheetId(), d = t.values.filter((f) => !!f.pattern), l = t.values.filter((f) => !f.pattern), u = me(a, c, d), m = {
22
+ const r = e.get($), n = e.get(W), s = e.get(St), i = Re(n, t);
23
+ if (!i)
24
+ return !1;
25
+ const { unitId: a, subUnitId: o } = i, l = t.values.filter((f) => !!f.pattern), u = t.values.filter((f) => !f.pattern), d = We(a, o, l), c = {
24
26
  unitId: a,
25
- subUnitId: c,
26
- ranges: l.map((f) => ({
27
+ subUnitId: o,
28
+ ranges: u.map((f) => ({
27
29
  startColumn: f.col,
28
30
  startRow: f.row,
29
31
  endColumn: f.col,
30
32
  endRow: f.row
31
33
  }))
32
- }, h = [], g = [];
33
- if (d.length) {
34
- Object.keys(u.values).forEach((S) => {
35
- const C = u.values[S];
36
- C.ranges = z(C.ranges);
34
+ }, h = [], _ = [];
35
+ if (l.length) {
36
+ Object.keys(d.values).forEach((p) => {
37
+ const g = d.values[p];
38
+ g.ranges = Ve(g.ranges);
37
39
  }), h.push({
38
- id: x.id,
39
- params: u
40
+ id: te.id,
41
+ params: d
40
42
  });
41
- const f = he(e, u);
42
- g.push(...f);
43
+ const f = Ke(e, d);
44
+ _.push(...f);
43
45
  }
44
- if (l.length) {
45
- m.ranges = z(m.ranges), h.push({
46
- id: M.id,
47
- params: m
46
+ if (u.length) {
47
+ c.ranges = Ve(c.ranges), h.push({
48
+ id: _e.id,
49
+ params: c
48
50
  });
49
- const f = J(e, m);
50
- g.push(...f);
51
+ const f = Ge(e, c);
52
+ _.push(...f);
51
53
  }
52
- const v = Lt(h, r).result;
54
+ const v = Ct(h, r).result;
53
55
  return v && s.pushUndoRedo({
54
56
  unitID: a,
55
- undoMutations: g,
57
+ undoMutations: _,
56
58
  redoMutations: h
57
59
  }), v;
58
60
  }
59
- }, On = {
61
+ }, Ft = {
60
62
  sheet: {
61
63
  numfmt: {
62
64
  percent: "Percentage",
@@ -91,7 +93,7 @@ const Q = {
91
93
  subtractDecimal: "Decreasing decimal places"
92
94
  }
93
95
  }
94
- }, wn = On, xn = {
96
+ }, zt = Ft, Wt = {
95
97
  sheet: {
96
98
  numfmt: {
97
99
  percent: "百分比",
@@ -126,152 +128,8 @@ const Q = {
126
128
  subtractDecimal: "减少小数位"
127
129
  }
128
130
  }
129
- }, jn = xn, ue = "SHEET_NUMFMT_PLUGIN", Ee = (e) => {
130
- const t = e.filter((i) => i.id === M.id).map((i) => i.params), r = e.filter((i) => i.id === x.id).map((i) => i.params), n = [];
131
- if (t[0]) {
132
- const i = t.reduce(
133
- (a, o) => (a.ranges.push(...o.ranges), a),
134
- {
135
- ranges: [],
136
- unitId: t[0].unitId,
137
- subUnitId: t[0].subUnitId
138
- }
139
- );
140
- i.ranges = z(i.ranges), n.push({ id: M.id, params: i });
141
- }
142
- const s = (i, a) => {
143
- const o = Object.keys(i), c = o.findIndex((d) => {
144
- const l = i[d];
145
- return Vt.diffValue(l, a);
146
- });
147
- return o[c];
148
- };
149
- if (r[0]) {
150
- const i = r.reduce(
151
- (a, o) => (Object.keys(o.values).forEach((c) => {
152
- const d = o.values[c], l = o.refMap[c], u = s(a.refMap, l);
153
- if (u)
154
- a.values[u].ranges.push(...d.ranges);
155
- else {
156
- const m = Math.max(...Object.keys(a.refMap).map(Number), 0) + 1;
157
- a.values[m] = {
158
- ranges: d.ranges
159
- }, a.refMap[m] = l;
160
- }
161
- }), a),
162
- {
163
- values: {},
164
- refMap: {},
165
- unitId: r[0].unitId,
166
- subUnitId: r[0].subUnitId
167
- }
168
- );
169
- Object.keys(i.values).forEach((a) => {
170
- const o = i.values[a];
171
- o.ranges = z(o.ranges);
172
- }), n.push({ id: x.id, params: i });
173
- }
174
- return n;
175
- };
176
- var Nn = Object.defineProperty, Tn = Object.getOwnPropertyDescriptor, Dn = (e, t, r, n) => {
177
- for (var s = n > 1 ? void 0 : n ? Tn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
178
- (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
179
- return n && s && Nn(t, r, s), s;
180
- }, Ce = (e, t) => (r, n) => t(r, n, e);
181
- let Re = class extends H {
182
- constructor(e, t, r, n) {
183
- super(), this._injector = e, this._univerInstanceService = t, this._numfmtService = r, this._autoFillService = n, this._initAutoFill();
184
- }
185
- _initAutoFill() {
186
- const e = () => ({ redos: [], undos: [] }), t = (s, i, a) => {
187
- const o = this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(), c = this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), d = {
188
- startRow: s.row,
189
- startColumn: s.col,
190
- endColumn: s.col,
191
- endRow: s.row
192
- }, l = {
193
- startRow: i.row,
194
- startColumn: i.col,
195
- endColumn: i.col,
196
- endRow: i.row
197
- }, u = [];
198
- if (R.foreach(a, (m, h) => {
199
- const g = De.getPositionRange(
200
- {
201
- startRow: m,
202
- startColumn: h,
203
- endColumn: h,
204
- endRow: m
205
- },
206
- d
207
- ), v = this._numfmtService.getValue(
208
- o,
209
- c,
210
- g.startRow,
211
- g.startColumn
212
- );
213
- if (v) {
214
- const f = De.getPositionRange(
215
- {
216
- startRow: m,
217
- startColumn: h,
218
- endColumn: h,
219
- endRow: m
220
- },
221
- l
222
- );
223
- u.push({
224
- pattern: v.pattern,
225
- type: v.type,
226
- row: f.startRow,
227
- col: f.startColumn
228
- });
229
- }
230
- }), u.length) {
231
- const m = {
232
- id: x.id,
233
- params: me(o, c, u)
234
- }, h = he(this._injector, m.params);
235
- return {
236
- redos: [m],
237
- undos: h
238
- };
239
- }
240
- return { redos: [], undos: [] };
241
- }, r = (s, i) => {
242
- const a = [], o = [], c = {
243
- row: s.startRow,
244
- col: s.startColumn
245
- };
246
- return dn(s, i).forEach((l) => {
247
- const { undos: u, redos: m } = t(c, l.repeatStartCell, l.relativeRange);
248
- a.push(...u), o.push(...m);
249
- }), {
250
- undos: Ee(a),
251
- redos: Ee(o)
252
- };
253
- }, n = {
254
- id: ue,
255
- onFillData: (s, i, a) => {
256
- if (a === He.COPY || a === He.ONLY_FORMAT || a === He.SERIES) {
257
- const { source: o, target: c } = s;
258
- return r(o, c);
259
- }
260
- return e();
261
- }
262
- };
263
- this.disposeWithMe(this._autoFillService.addHook(n));
264
- }
265
- };
266
- Re = Dn([
267
- k($.Rendered, Re),
268
- Ce(0, _(K)),
269
- Ce(1, _(E)),
270
- Ce(2, _(U)),
271
- Ce(3, _(un))
272
- ], Re);
273
- const Xe = (e) => V.getInfo(e).type || "unknown", et = (e, t, r) => {
274
- const n = V.getInfo(e), s = r === Ht.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], a = V.format(e, t, { locale: s });
131
+ }, Kt = Wt, Ne = "SHEET_NUMFMT_PLUGIN", pe = (e) => D.getInfo(e).type || "unknown", Le = (e, t, r) => {
132
+ const n = D.getInfo(e), s = r === yt.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], a = D.format(e, t, { locale: s });
275
133
  return t < 0 ? {
276
134
  result: a,
277
135
  color: i.color
@@ -279,51 +137,51 @@ const Xe = (e) => V.getInfo(e).type || "unknown", et = (e, t, r) => {
279
137
  result: a
280
138
  };
281
139
  };
282
- var En = Object.defineProperty, $n = Object.getOwnPropertyDescriptor, Un = (e, t, r, n) => {
283
- for (var s = n > 1 ? void 0 : n ? $n(t, r) : t, i = e.length - 1, a; i >= 0; i--)
140
+ var Gt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, qt = (e, t, r, n) => {
141
+ for (var s = n > 1 ? void 0 : n ? Zt(t, r) : t, i = e.length - 1, a; i >= 0; i--)
284
142
  (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
285
- return n && s && En(t, r, s), s;
286
- }, re = (e, t) => (r, n) => t(r, n, e);
287
- let Ie = class extends H {
143
+ return n && s && Gt(t, r, s), s;
144
+ }, F = (e, t) => (r, n) => t(r, n, e);
145
+ let le = class extends X {
288
146
  constructor(e, t, r, n, s, i) {
289
147
  super(), this._sheetInterceptorService = e, this._themeService = t, this._sheetSkeletonManagerService = r, this._commandService = n, this._numfmtService = s, this._localeService = i, this._initInterceptorCellContent();
290
148
  }
291
149
  _initInterceptorCellContent() {
292
- const e = new ut();
150
+ const e = new bt();
293
151
  this.disposeWithMe(
294
- this._sheetInterceptorService.intercept(ht.CELL_CONTENT, {
152
+ this._sheetInterceptorService.intercept(Ze.CELL_CONTENT, {
295
153
  handler: (t, r, n) => {
296
154
  const s = r.unitId, i = r.subUnitId, a = this._numfmtService.getValue(s, i, r.row, r.col);
297
155
  if (!a)
298
156
  return n(t);
299
157
  const o = t;
300
- if (!o || o.t !== ie.NUMBER)
158
+ if (!o || o.t !== z.NUMBER)
301
159
  return n(t);
302
- let c = "";
303
- const d = e.getValue(r.row, r.col);
304
- if (d && d.parameters === o.v)
305
- return n({ ...t, ...d.result });
306
- const l = et(a.pattern, Number(o.v), this._localeService.getCurrentLocale());
307
- if (c = l.result, !c)
160
+ let l = "";
161
+ const u = e.getValue(r.row, r.col);
162
+ if (u && u.parameters === o.v)
163
+ return n({ ...t, ...u.result });
164
+ const d = Le(a.pattern, Number(o.v), this._localeService.getCurrentLocale());
165
+ if (l = d.result, !l)
308
166
  return n(t);
309
- const u = { v: c };
310
- if (l.color) {
311
- const m = this._themeService.getCurrentTheme()[`${l.color}500`];
312
- m && (u.interceptorStyle = { cl: { rgb: m } });
167
+ const c = { v: l };
168
+ if (d.color) {
169
+ const h = this._themeService.getCurrentTheme()[`${d.color}500`];
170
+ h && (c.interceptorStyle = { cl: { rgb: h } });
313
171
  }
314
172
  return e.setValue(r.row, r.col, {
315
- result: u,
173
+ result: c,
316
174
  parameters: o.v
317
- }), n({ ...t, ...u });
175
+ }), n({ ...t, ...c });
318
176
  }
319
177
  })
320
178
  ), this.disposeWithMe(
321
179
  this._commandService.onCommandExecuted((t) => {
322
- if (t.id === x.id) {
180
+ if (t.id === te.id) {
323
181
  const r = t.params;
324
182
  Object.keys(r.values).forEach((n) => {
325
183
  r.values[n].ranges.forEach((i) => {
326
- R.foreach(i, (a, o) => {
184
+ E.foreach(i, (a, o) => {
327
185
  e.realDeleteValue(a, o);
328
186
  });
329
187
  });
@@ -331,10 +189,10 @@ let Ie = class extends H {
331
189
  }
332
190
  })
333
191
  ), this.disposeWithMe(
334
- q(
192
+ Q(
335
193
  this._sheetSkeletonManagerService.currentSkeleton$.pipe(
336
- le((t) => t == null ? void 0 : t.sheetId),
337
- ft()
194
+ Ye((t) => t == null ? void 0 : t.sheetId),
195
+ Et()
338
196
  ).subscribe(() => {
339
197
  e.reset();
340
198
  })
@@ -342,77 +200,80 @@ let Ie = class extends H {
342
200
  );
343
201
  }
344
202
  };
345
- Ie = Un([
346
- k($.Rendered, Ie),
347
- re(0, _(Ae)),
348
- re(1, _(dt)),
349
- re(2, _(Ke)),
350
- re(3, _(D)),
351
- re(4, _(U)),
352
- re(5, _(j))
353
- ], Ie);
354
- const W = (e, t = 0) => {
203
+ le = qt([
204
+ ee(K.Rendered, le),
205
+ F(0, S(Oe)),
206
+ F(1, S(ze)),
207
+ F(2, S(qe)),
208
+ F(3, S($)),
209
+ F(4, S(G)),
210
+ F(5, S(x))
211
+ ], le);
212
+ const L = (e, t = 0) => {
355
213
  var n;
356
- return e && (n = V.getInfo(e).maxDecimals) != null ? n : t;
357
- }, Le = (e, t) => {
214
+ return e && (n = D.getInfo(e).maxDecimals) != null ? n : t;
215
+ }, Se = (e, t) => {
358
216
  if (e && !t || !e && t)
359
217
  return !1;
360
- const r = (d) => d.reduce(
361
- (l, u) => {
362
- if (l.isEnd)
363
- return l;
364
- const m = u.value || u.num;
365
- return u.type === "point" ? (l.isEnd = !0, l) : { ...l, result: l.result + m };
218
+ const r = (u) => u.reduce(
219
+ (d, c) => {
220
+ if (d.isEnd)
221
+ return d;
222
+ const h = c.value || c.num;
223
+ return c.type === "point" ? (d.isEnd = !0, d) : { ...d, result: d.result + h };
366
224
  },
367
225
  { isEnd: !1, result: "" }
368
- ).result, n = V.getInfo(e)._partitions, s = V.getInfo(t)._partitions, i = r(n[0].tokens), a = r(s[0].tokens), o = r(n[1].tokens), c = r(s[1].tokens);
369
- return i === a && o === c && n[1].color === s[1].color;
370
- }, ot = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), I = (e, t) => e.split(";").map((n) => /\.0?/.test(n) ? n.replace(
226
+ ).result, n = D.getInfo(e)._partitions, s = D.getInfo(t)._partitions, i = r(n[0].tokens), a = r(s[0].tokens), o = r(n[1].tokens), l = r(s[1].tokens);
227
+ return i === a && o === l && n[1].color === s[1].color;
228
+ }, Be = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), b = (e, t) => e.split(";").map((n) => /\.0?/.test(n) ? n.replace(
371
229
  /\.0*/g,
372
- `${t > 0 ? "." : ""}${ot(Number(t || 0))}`
230
+ `${t > 0 ? "." : ""}${Be(Number(t || 0))}`
373
231
  ) : /0([^0]?)|0$/.test(n) ? n.replace(
374
232
  /0([^0]+)|0$/,
375
- `0${t > 0 ? "." : ""}${ot(Number(t || 0))}$1`
376
- ) : n).join(";"), An = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), _t = {
233
+ `0${t > 0 ? "." : ""}${Be(Number(t || 0))}$1`
234
+ ) : n).join(";"), Yt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), et = {
377
235
  id: "sheet.command.numfmt.add.decimal.command",
378
- type: X.COMMAND,
236
+ type: V.COMMAND,
379
237
  handler: async (e) => {
380
- const t = e.get(D), r = e.get(ee), n = e.get(U), s = e.get(E), i = r.getSelections();
238
+ const t = e.get($), r = e.get(H), n = e.get(G), s = e.get(W), i = r.getSelections();
381
239
  if (!i || !i.length)
382
240
  return !1;
383
- const a = s.getCurrentUniverSheetInstance(), o = a.getActiveSheet(), c = a.getUnitId(), d = o.getSheetId();
384
- let l = 0;
385
- i.forEach((g) => {
386
- R.foreach(g.range, (v, f) => {
387
- const S = n.getValue(c, d, v, f);
388
- if (!S)
241
+ const a = Re(s);
242
+ if (!a)
243
+ return !1;
244
+ const { unitId: o, subUnitId: l } = a;
245
+ let u = 0;
246
+ i.forEach((_) => {
247
+ E.foreach(_.range, (v, f) => {
248
+ const p = n.getValue(o, l, v, f);
249
+ if (!p)
389
250
  return;
390
- const C = W(S.pattern);
391
- l = C > l ? C : l;
251
+ const g = L(p.pattern);
252
+ u = g > u ? g : u;
392
253
  });
393
254
  });
394
- const u = l + 1, m = I(`0${u > 0 ? ".0" : ""}`, u), h = [];
395
- return i.forEach((g) => {
396
- R.foreach(g.range, (v, f) => {
397
- const S = n.getValue(c, d, v, f);
398
- if (!S)
255
+ const d = u + 1, c = b(`0${d > 0 ? ".0" : ""}`, d), h = [];
256
+ return i.forEach((_) => {
257
+ E.foreach(_.range, (v, f) => {
258
+ const p = n.getValue(o, l, v, f);
259
+ if (!p)
399
260
  h.push({
400
261
  row: v,
401
262
  col: f,
402
- pattern: m
263
+ pattern: c
403
264
  });
404
265
  else {
405
- const C = W(S.pattern), b = I(S.pattern, C + 1);
406
- b !== S.pattern && h.push({
266
+ const g = L(p.pattern), C = b(p.pattern, g + 1);
267
+ C !== p.pattern && h.push({
407
268
  row: v,
408
269
  col: f,
409
- pattern: b
270
+ pattern: C
410
271
  });
411
272
  }
412
273
  });
413
- }), h.length ? await t.executeCommand(Q.id, { values: h }) : !1;
274
+ }), h.length ? await t.executeCommand(A.id, { values: h }) : !1;
414
275
  }
415
- }, Ln = [
276
+ }, Jt = [
416
277
  {
417
278
  label: "1930-08-05",
418
279
  suffix: "yyyy-MM-dd"
@@ -457,7 +318,7 @@ const W = (e, t = 0) => {
457
318
  label: "08-05 下午 01:30",
458
319
  suffix: "MM-dd A/P hh:mm"
459
320
  }
460
- ], Vn = [
321
+ ], Qt = [
461
322
  {
462
323
  label: "(1,235)",
463
324
  suffix: "#,##0_);(#,##0)"
@@ -485,7 +346,7 @@ const W = (e, t = 0) => {
485
346
  suffix: "#,##0.00_);[Red]-#,##0.00",
486
347
  color: "red"
487
348
  }
488
- ], St = [
349
+ ], tt = [
489
350
  {
490
351
  label: (e) => `${e}1,235`,
491
352
  suffix: (e) => `"${e}"#,##0.00_);"${e}"#,##0.00`
@@ -513,74 +374,77 @@ const W = (e, t = 0) => {
513
374
  suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
514
375
  color: "red"
515
376
  }
516
- ], Ct = {
377
+ ], nt = {
517
378
  id: "sheet.command.numfmt.set.currency",
518
- type: X.COMMAND,
379
+ type: V.COMMAND,
519
380
  handler: async (e) => {
520
- const t = e.get(D), n = e.get(ee).getSelections();
381
+ const t = e.get($), n = e.get(H).getSelections();
521
382
  if (!n || !n.length)
522
383
  return !1;
523
- const s = [], i = St[0].suffix("¥");
384
+ const s = [], i = tt[0].suffix("¥");
524
385
  return n.forEach((o) => {
525
- R.foreach(o.range, (c, d) => {
526
- s.push({ row: c, col: d, pattern: i, type: "currency" });
386
+ E.foreach(o.range, (l, u) => {
387
+ s.push({ row: l, col: u, pattern: i, type: "currency" });
527
388
  });
528
- }), await t.executeCommand(Q.id, { values: s });
389
+ }), await t.executeCommand(A.id, { values: s });
529
390
  }
530
- }, bt = {
391
+ }, rt = {
531
392
  id: "sheet.command.numfmt.subtract.decimal.command",
532
- type: X.COMMAND,
393
+ type: V.COMMAND,
533
394
  handler: async (e) => {
534
- const t = e.get(D), r = e.get(ee), n = e.get(U), s = e.get(E), i = r.getSelections();
395
+ const t = e.get($), r = e.get(H), n = e.get(G), s = e.get(W), i = r.getSelections();
535
396
  if (!i || !i.length)
536
397
  return !1;
537
- const a = s.getCurrentUniverSheetInstance(), o = a.getActiveSheet(), c = a.getUnitId(), d = o.getSheetId();
538
- let l = 0;
398
+ const a = Re(s);
399
+ if (!a)
400
+ return !1;
401
+ const { unitId: o, subUnitId: l } = a;
402
+ let u = 0;
539
403
  i.forEach((v) => {
540
- R.foreach(v.range, (f, S) => {
541
- const C = n.getValue(c, d, f, S);
542
- if (!C)
404
+ E.foreach(v.range, (f, p) => {
405
+ const g = n.getValue(o, l, f, p);
406
+ if (!g)
543
407
  return;
544
- const b = W(C.pattern);
545
- l = b > l ? b : l;
408
+ const C = L(g.pattern);
409
+ u = C > u ? C : u;
546
410
  });
547
411
  });
548
- const u = l - 1, m = I(`0${u > 0 ? ".0" : "."}`, u), h = [];
412
+ const d = u - 1, c = b(`0${d > 0 ? ".0" : "."}`, d), h = [];
549
413
  return i.forEach((v) => {
550
- R.foreach(v.range, (f, S) => {
551
- const C = n.getValue(c, d, f, S);
552
- if (!C)
414
+ E.foreach(v.range, (f, p) => {
415
+ const g = n.getValue(o, l, f, p);
416
+ if (!g)
553
417
  h.push({
554
418
  row: f,
555
- col: S,
556
- pattern: m
419
+ col: p,
420
+ pattern: c
557
421
  });
558
422
  else {
559
- const b = W(C.pattern);
423
+ const C = L(g.pattern);
560
424
  h.push({
561
425
  row: f,
562
- col: S,
563
- pattern: I(C.pattern, b - 1)
426
+ col: p,
427
+ pattern: b(g.pattern, C - 1)
564
428
  });
565
429
  }
566
430
  });
567
- }), await t.executeCommand(Q.id, { values: h });
431
+ }), await t.executeCommand(A.id, { values: h });
568
432
  }
569
- }, ke = {
433
+ }, Ie = {
570
434
  id: "sheet.operation.close.numfmt.panel",
571
- type: X.OPERATION,
435
+ type: V.OPERATION,
572
436
  handler: () => (
573
437
  // do nothing,just notify panel is closed
574
438
  !0
575
439
  )
576
- }, tt = ln("INumfmtController");
577
- kt($.Rendered, tt);
578
- const $e = {
440
+ }, Ue = Rt("INumfmtController");
441
+ It(K.Rendered, Ue);
442
+ const ve = {
579
443
  id: "sheet.operation.open.numfmt.panel",
580
- type: X.OPERATION,
581
- handler: (e) => (e.get(tt).openPanel(), !0)
444
+ type: V.OPERATION,
445
+ handler: (e) => (e.get(Ue).openPanel(), !0)
582
446
  };
583
- var yt = { exports: {} }, Ve = {};
447
+ var st = { exports: {} }, Ce = {};
584
448
  /**
585
449
  * @license React
586
450
  * react-jsx-runtime.production.min.js
@@ -590,23 +454,23 @@ var yt = { exports: {} }, Ve = {};
590
454
  * This source code is licensed under the MIT license found in the
591
455
  * LICENSE file in the root directory of this source tree.
592
456
  */
593
- var Hn = Rn, kn = Symbol.for("react.element"), Fn = Symbol.for("react.fragment"), Bn = Object.prototype.hasOwnProperty, zn = Hn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Wn = { key: !0, ref: !0, __self: !0, __source: !0 };
594
- function Rt(e, t, r) {
457
+ var Xt = Ht, en = Symbol.for("react.element"), tn = Symbol.for("react.fragment"), nn = Object.prototype.hasOwnProperty, rn = Xt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, sn = { key: !0, ref: !0, __self: !0, __source: !0 };
458
+ function it(e, t, r) {
595
459
  var n, s = {}, i = null, a = null;
596
460
  r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (a = t.ref);
597
461
  for (n in t)
598
- Bn.call(t, n) && !Wn.hasOwnProperty(n) && (s[n] = t[n]);
462
+ nn.call(t, n) && !sn.hasOwnProperty(n) && (s[n] = t[n]);
599
463
  if (e && e.defaultProps)
600
464
  for (n in t = e.defaultProps, t)
601
465
  s[n] === void 0 && (s[n] = t[n]);
602
- return { $$typeof: kn, type: e, key: i, ref: a, props: s, _owner: zn.current };
466
+ return { $$typeof: en, type: e, key: i, ref: a, props: s, _owner: rn.current };
603
467
  }
604
- Ve.Fragment = Fn;
605
- Ve.jsx = Rt;
606
- Ve.jsxs = Rt;
607
- yt.exports = Ve;
608
- var p = yt.exports;
609
- const nt = In([]), We = [
468
+ Ce.Fragment = tn;
469
+ Ce.jsx = it;
470
+ Ce.jsxs = it;
471
+ st.exports = Ce;
472
+ var m = st.exports;
473
+ const Ae = Bt([]), Te = [
610
474
  "$",
611
475
  "£",
612
476
  "¥",
@@ -635,12 +499,12 @@ const nt = In([]), We = [
635
499
  "₾",
636
500
  "₿"
637
501
  ];
638
- var Kn = Object.defineProperty, Gn = Object.getOwnPropertyDescriptor, Yn = (e, t, r, n) => {
639
- for (var s = n > 1 ? void 0 : n ? Gn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
502
+ var an = Object.defineProperty, cn = Object.getOwnPropertyDescriptor, on = (e, t, r, n) => {
503
+ for (var s = n > 1 ? void 0 : n ? cn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
640
504
  (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
641
- return n && s && Kn(t, r, s), s;
642
- }, Zn = (e, t) => (r, n) => t(r, n, e);
643
- let Ue = class {
505
+ return n && s && an(t, r, s), s;
506
+ }, ln = (e, t) => (r, n) => t(r, n, e);
507
+ let ge = class {
644
508
  constructor(e) {
645
509
  this._localStorageService = e;
646
510
  }
@@ -666,16 +530,16 @@ let Ue = class {
666
530
  const r = this._getKey(e), n = await this._localStorageService.getItem(r);
667
531
  if (t && n) {
668
532
  const s = n.map((i, a, o) => {
669
- const c = o.length;
533
+ const l = o.length;
670
534
  return {
671
535
  value: i,
672
- priority: c - a
536
+ priority: l - a
673
537
  };
674
538
  });
675
539
  return t.sort((i, a) => {
676
- var d, l;
677
- const o = ((d = s.find((u) => u.value === i)) == null ? void 0 : d.priority) || -1;
678
- return (((l = s.find((u) => u.value === a)) == null ? void 0 : l.priority) || -1) - o;
540
+ var u, d;
541
+ const o = ((u = s.find((c) => c.value === i)) == null ? void 0 : u.priority) || -1;
542
+ return (((d = s.find((c) => c.value === a)) == null ? void 0 : d.priority) || -1) - o;
679
543
  });
680
544
  }
681
545
  return n || [];
@@ -684,93 +548,93 @@ let Ue = class {
684
548
  this._localStorageService.removeItem(e);
685
549
  }
686
550
  };
687
- Ue = Yn([
688
- Zn(0, _(Ft))
689
- ], Ue);
690
- const ct = "numfmtCurrency", qn = (e) => {
691
- const t = T(Ue), [r, n] = w(We);
692
- return Ye(() => {
551
+ ge = on([
552
+ ln(0, S(Mt))
553
+ ], ge);
554
+ const ke = "numfmtCurrency", un = (e) => {
555
+ const t = T(ge), [r, n] = M(Te);
556
+ return Ee(() => {
693
557
  t.addHabit("numfmtCurrency", []).then(() => {
694
- t.getHabit(ct, [...We]).then((i) => {
558
+ t.getHabit(ke, [...Te]).then((i) => {
695
559
  n(i), e && e(i);
696
560
  });
697
561
  });
698
562
  }, []), { userHabitCurrency: r, mark: (i) => {
699
- t.markHabit(ct, i);
563
+ t.markHabit(ke, i);
700
564
  } };
701
- }, Jn = () => {
702
- const e = Ze([]), [t, r] = w({});
703
- return Ye(() => {
565
+ }, mn = () => {
566
+ const e = je([]), [t, r] = M({});
567
+ return Ee(() => {
704
568
  e.current.forEach((s) => {
705
569
  s();
706
570
  }), e.current = [];
707
571
  }, [t]), (s) => {
708
572
  e.current.push(s), r({});
709
573
  };
710
- }, Se = (e) => We.find((r) => e.includes(r)), Qn = (e) => !!Se(e) && e.startsWith("_("), Xn = (e) => {
711
- const [t, r] = w(() => W(e.defaultPattern || "", 2)), n = gt(nt), [s, i] = w(() => Se(e.defaultPattern) || n[0]), a = L(() => n.map((u) => ({ label: u, value: u })), []), c = T(j).t;
712
- e.action.current = () => I(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
713
- const d = (u) => {
714
- i(u), e.onChange(I(`_("${u}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
715
- }, l = (u) => {
716
- const m = u || 0;
717
- r(m), e.onChange(I(`_("${s}"* #,##0${m > 0 ? ".0" : ""}_)`, m));
574
+ }, ce = (e) => Te.find((r) => e.includes(r)), dn = (e) => !!ce(e) && e.startsWith("_("), fn = (e) => {
575
+ const [t, r] = M(() => L(e.defaultPattern || "", 2)), n = Xe(Ae), [s, i] = M(() => ce(e.defaultPattern) || n[0]), a = P(() => n.map((c) => ({ label: c, value: c })), []), l = T(x).t;
576
+ e.action.current = () => b(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
577
+ const u = (c) => {
578
+ i(c), e.onChange(b(`_("${c}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
579
+ }, d = (c) => {
580
+ const h = c || 0;
581
+ r(h), e.onChange(b(`_("${s}"* #,##0${h > 0 ? ".0" : ""}_)`, h));
718
582
  };
719
- return /* @__PURE__ */ p.jsxs("div", { children: [
720
- /* @__PURE__ */ p.jsxs("div", { className: "m-t-16 options ", children: [
721
- /* @__PURE__ */ p.jsxs("div", { className: "option", children: [
722
- /* @__PURE__ */ p.jsx("div", { className: "label", children: c("sheet.numfmt.decimalLength") }),
723
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ p.jsx(qe, { value: t, max: 20, min: 0, onChange: l }) })
583
+ return /* @__PURE__ */ m.jsxs("div", { children: [
584
+ /* @__PURE__ */ m.jsxs("div", { className: "m-t-16 options ", children: [
585
+ /* @__PURE__ */ m.jsxs("div", { className: "option", children: [
586
+ /* @__PURE__ */ m.jsx("div", { className: "label", children: l("sheet.numfmt.decimalLength") }),
587
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ m.jsx(De, { value: t, max: 20, min: 0, onChange: d }) })
724
588
  ] }),
725
- /* @__PURE__ */ p.jsxs("div", { className: "option", children: [
726
- /* @__PURE__ */ p.jsx("div", { className: "label", children: c("sheet.numfmt.currencyType") }),
727
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ p.jsx(Je, { onChange: d, options: a, value: s }) })
589
+ /* @__PURE__ */ m.jsxs("div", { className: "option", children: [
590
+ /* @__PURE__ */ m.jsx("div", { className: "label", children: l("sheet.numfmt.currencyType") }),
591
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ m.jsx($e, { onChange: u, options: a, value: s }) })
728
592
  ] })
729
593
  ] }),
730
- /* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: c("sheet.numfmt.accountingDes") })
594
+ /* @__PURE__ */ m.jsx("div", { className: "describe m-t-14", children: l("sheet.numfmt.accountingDes") })
731
595
  ] });
732
- }, Fe = (e) => St.map((t) => ({
596
+ }, Me = (e) => tt.map((t) => ({
733
597
  label: t.label(e),
734
598
  value: t.suffix(e),
735
599
  color: t.color
736
- })), It = () => Ln.map((e) => ({ label: e.label, value: e.suffix })), Mt = () => Vn.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), er = (e) => !!Se(e) && !e.startsWith("_("), tr = (e) => {
737
- const r = T(j).t, n = gt(nt), [s, i] = w(() => Se(e.defaultPattern) || n[0]), [a, o] = w(() => W(e.defaultPattern || "", 2)), [c, d] = w(() => {
738
- var S;
739
- const v = Fe(s);
740
- return ((S = v.find((C) => Le(C.value, e.defaultPattern))) == null ? void 0 : S.value) || v[0].value;
741
- }), l = L(() => Fe(s), [s]), u = L(() => n.map((v) => ({ label: v, value: v })), [n]);
742
- e.action.current = () => I(c, a);
743
- const m = (v) => {
744
- i(v);
745
- const f = Fe(v)[0].value;
746
- d(f), e.onChange(I(f, a));
747
- }, h = (v) => {
748
- d(v), e.onChange(I(v, a));
749
- }, g = (v) => {
750
- o(v || 0), e.onChange(I(c, v || 0));
600
+ })), at = () => Jt.map((e) => ({ label: e.label, value: e.suffix })), ct = () => Qt.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), hn = (e) => !!ce(e) && !e.startsWith("_("), pn = (e) => {
601
+ const r = T(x).t, n = Xe(Ae), [s, i] = M(() => ce(e.defaultPattern) || n[0]), [a, o] = M(() => L(e.defaultPattern || "", 2)), [l, u] = M(() => {
602
+ var g;
603
+ const f = Me(s);
604
+ return ((g = f.find((C) => Se(C.value, e.defaultPattern))) == null ? void 0 : g.value) || f[0].value;
605
+ }), d = P(() => Me(s), [s]), c = P(() => n.map((f) => ({ label: f, value: f })), [n]);
606
+ e.action.current = () => b(l, a);
607
+ const h = (f) => {
608
+ i(f);
609
+ const p = Me(f)[0].value;
610
+ u(p), e.onChange(b(p, a));
611
+ }, _ = (f) => {
612
+ u(f), e.onChange(b(f, a));
613
+ }, v = (f) => {
614
+ o(f || 0), e.onChange(b(l, f || 0));
751
615
  };
752
- return /* @__PURE__ */ p.jsxs("div", { children: [
753
- /* @__PURE__ */ p.jsxs("div", { className: "m-t-16 options ", children: [
754
- /* @__PURE__ */ p.jsxs("div", { className: "option", children: [
755
- /* @__PURE__ */ p.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
756
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ p.jsx(qe, { value: a, max: 20, min: 0, onChange: g }) })
616
+ return /* @__PURE__ */ m.jsxs("div", { children: [
617
+ /* @__PURE__ */ m.jsxs("div", { className: "m-t-16 options ", children: [
618
+ /* @__PURE__ */ m.jsxs("div", { className: "option", children: [
619
+ /* @__PURE__ */ m.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
620
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ m.jsx(De, { value: a, max: 20, min: 0, onChange: v }) })
757
621
  ] }),
758
- /* @__PURE__ */ p.jsxs("div", { className: "option", children: [
759
- /* @__PURE__ */ p.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
760
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ p.jsx(Je, { onChange: m, options: u, value: s }) })
622
+ /* @__PURE__ */ m.jsxs("div", { className: "option", children: [
623
+ /* @__PURE__ */ m.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
624
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ m.jsx($e, { onChange: h, options: c, value: s }) })
761
625
  ] })
762
626
  ] }),
763
- /* @__PURE__ */ p.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
764
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Qe, { onChange: h, options: l, value: c }) }),
765
- /* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
627
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
628
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ m.jsx(we, { onChange: _, options: d, value: l }) }),
629
+ /* @__PURE__ */ m.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
766
630
  ] });
767
- }, nr = (e) => {
768
- const t = V.getInfo(e);
769
- return It().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
770
- }, rr = (e) => {
771
- const t = L(It, []), n = T(j).t, [s, i] = w(() => {
631
+ }, vn = (e) => {
632
+ const t = D.getInfo(e);
633
+ return at().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
634
+ }, gn = (e) => {
635
+ const t = P(at, []), n = T(x).t, [s, i] = M(() => {
772
636
  if (e.defaultPattern) {
773
- const o = t.find((c) => c.value === e.defaultPattern);
637
+ const o = t.find((l) => l.value === e.defaultPattern);
774
638
  if (o)
775
639
  return o.value;
776
640
  }
@@ -780,112 +644,112 @@ const ct = "numfmtCurrency", qn = (e) => {
780
644
  const a = (o) => {
781
645
  i(o), e.onChange(o);
782
646
  };
783
- return /* @__PURE__ */ p.jsxs("div", { children: [
784
- /* @__PURE__ */ p.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
785
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Qe, { value: s, options: t, onChange: a }) }),
786
- /* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
647
+ return /* @__PURE__ */ m.jsxs("div", { children: [
648
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
649
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ m.jsx(we, { value: s, options: t, onChange: a }) }),
650
+ /* @__PURE__ */ m.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
787
651
  ] });
788
- }, sr = (e) => !e, ir = (e) => {
789
- const r = T(j).t;
790
- return e.action.current = () => "", /* @__PURE__ */ p.jsx("div", { children: /* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
791
- }, ar = (e) => Mt().some((t) => Le(t.value, e)), or = (e) => {
792
- const t = T(j), r = L(Mt, []), [n, s] = w(() => W(e.defaultPattern || "", 0)), [i, a] = w(() => {
793
- const u = r.find((m) => Le(m.value, e.defaultPattern || ""));
794
- return (u == null ? void 0 : u.value) || r[0].value;
795
- }), o = L(() => I(i, Number(n || 0)), [i, n]), c = L(() => !An(i), [i]), d = (u) => {
796
- s(u || 0), e.onChange(I(i, Number(u || 0)));
797
- }, l = (u) => {
798
- s(W(u, 0)), a(u), e.onChange(u);
652
+ }, _n = (e) => !e, Sn = (e) => {
653
+ const r = T(x).t;
654
+ return e.action.current = () => "", /* @__PURE__ */ m.jsx("div", { children: /* @__PURE__ */ m.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
655
+ }, Cn = (e) => ct().some((t) => Se(t.value, e)), yn = (e) => {
656
+ const t = T(x), r = P(ct, []), [n, s] = M(() => L(e.defaultPattern || "", 0)), [i, a] = M(() => {
657
+ const c = r.find((h) => Se(h.value, e.defaultPattern || ""));
658
+ return (c == null ? void 0 : c.value) || r[0].value;
659
+ }), o = P(() => b(i, Number(n || 0)), [i, n]), l = P(() => !Yt(i), [i]), u = (c) => {
660
+ s(c || 0), e.onChange(b(i, Number(c || 0)));
661
+ }, d = (c) => {
662
+ s(L(c, 0)), a(c), e.onChange(c);
799
663
  };
800
- return e.action.current = () => o, /* @__PURE__ */ p.jsxs("div", { children: [
801
- /* @__PURE__ */ p.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
802
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(
803
- qe,
664
+ return e.action.current = () => o, /* @__PURE__ */ m.jsxs("div", { children: [
665
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
666
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ m.jsx(
667
+ De,
804
668
  {
805
- disabled: c,
669
+ disabled: l,
806
670
  value: n,
807
671
  max: 20,
808
672
  min: 0,
809
- onChange: d
673
+ onChange: u
810
674
  }
811
675
  ) }),
812
- /* @__PURE__ */ p.jsxs("div", { className: "m-t-16 label", children: [
676
+ /* @__PURE__ */ m.jsxs("div", { className: "m-t-16 label", children: [
813
677
  " ",
814
678
  t.t("sheet.numfmt.negType")
815
679
  ] }),
816
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Qe, { onChange: l, options: r, value: i }) }),
817
- /* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
680
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ m.jsx(we, { onChange: d, options: r, value: i }) }),
681
+ /* @__PURE__ */ m.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
818
682
  ] });
819
- }, cr = (e) => {
820
- const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = T(j), a = Ze(() => ""), o = i.t, c = Jn(), d = L(
683
+ }, bn = (e) => {
684
+ const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = T(x), a = je(() => ""), o = i.t, l = mn(), u = P(
821
685
  () => [
822
- { label: "sheet.numfmt.general", component: ir },
823
- { label: "sheet.numfmt.accounting", component: Xn },
824
- { label: "sheet.numfmt.currency", component: tr },
825
- { label: "sheet.numfmt.date", component: rr },
826
- { label: "sheet.numfmt.thousandthPercentile", component: or }
686
+ { label: "sheet.numfmt.general", component: Sn },
687
+ { label: "sheet.numfmt.accounting", component: fn },
688
+ { label: "sheet.numfmt.currency", component: pn },
689
+ { label: "sheet.numfmt.date", component: gn },
690
+ { label: "sheet.numfmt.thousandthPercentile", component: yn }
827
691
  ].map((y) => ({ ...y, label: o(y.label) })),
828
692
  []
829
- ), [l, u] = w(S), [m, h] = w(() => `${n}_${s}`), { mark: g, userHabitCurrency: v } = qn(() => h(`${n}_${s}_userCurrency'`)), f = L(() => {
693
+ ), [d, c] = M(g), [h, _] = M(() => `${n}_${s}`), { mark: v, userHabitCurrency: f } = un(() => _(`${n}_${s}_userCurrency'`)), p = P(() => {
830
694
  var y;
831
- return (y = d.find((ne) => ne.label === l)) == null ? void 0 : y.component;
832
- }, [l]);
833
- function S() {
834
- return [sr, Qn, er, nr, ar].reduce((ne, Dt, Et) => ne || (Dt(r) ? d[Et].label : ""), "") || d[0].label;
695
+ return (y = u.find((k) => k.label === d)) == null ? void 0 : y.component;
696
+ }, [d]);
697
+ function g() {
698
+ return [_n, dn, hn, vn, Cn].reduce((k, pt, vt) => k || (pt(r) ? u[vt].label : ""), "") || u[0].label;
835
699
  }
836
- const C = d.map((y) => ({
700
+ const C = u.map((y) => ({
837
701
  label: y.label,
838
702
  value: y.label
839
- })), b = (y) => {
840
- u(y), c(() => e.onChange({ type: "change", value: a.current() || "" }));
841
- }, A = (y) => {
703
+ })), R = (y) => {
704
+ c(y), l(() => e.onChange({ type: "change", value: a.current() || "" }));
705
+ }, O = (y) => {
842
706
  e.onChange({ type: "change", value: y });
843
- }, G = () => {
844
- const y = a.current() || "", ne = Se(y);
845
- ne && g(ne), e.onChange({ type: "confirm", value: y });
846
- }, F = () => {
707
+ }, w = () => {
708
+ const y = a.current() || "", k = ce(y);
709
+ k && v(k), e.onChange({ type: "confirm", value: y });
710
+ }, ye = () => {
847
711
  e.onChange({ type: "cancel", value: "" });
848
- }, B = {
849
- onChange: A,
712
+ }, be = {
713
+ onChange: O,
850
714
  defaultValue: t,
851
715
  defaultPattern: r,
852
716
  action: a
853
717
  };
854
- return Ye(() => {
855
- u(S()), h(`${n}_${s}`);
856
- }, [n, s]), /* @__PURE__ */ p.jsxs("div", { className: "numfmt-panel p-b-20", children: [
857
- /* @__PURE__ */ p.jsxs("div", { children: [
858
- /* @__PURE__ */ p.jsx("div", { className: "label m-t-14", children: o("sheet.numfmt.numfmtType") }),
859
- /* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Je, { onChange: b, options: C, value: l }) }),
860
- /* @__PURE__ */ p.jsx("div", { children: f && /* @__PURE__ */ p.jsx(nt.Provider, { value: v, children: /* @__PURE__ */ te(f, { ...B, key: m }) }) })
718
+ return Ee(() => {
719
+ c(g()), _(`${n}_${s}`);
720
+ }, [n, s]), /* @__PURE__ */ m.jsxs("div", { className: "numfmt-panel p-b-20", children: [
721
+ /* @__PURE__ */ m.jsxs("div", { children: [
722
+ /* @__PURE__ */ m.jsx("div", { className: "label m-t-14", children: o("sheet.numfmt.numfmtType") }),
723
+ /* @__PURE__ */ m.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ m.jsx($e, { onChange: R, options: C, value: d }) }),
724
+ /* @__PURE__ */ m.jsx("div", { children: p && /* @__PURE__ */ m.jsx(Ae.Provider, { value: f, children: /* @__PURE__ */ B(p, { ...be, key: h }) }) })
861
725
  ] }),
862
- /* @__PURE__ */ p.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
863
- /* @__PURE__ */ p.jsx(at, { size: "small", onClick: F, className: "m-r-12", children: o("sheet.numfmt.cancel") }),
864
- /* @__PURE__ */ p.jsx(at, { type: "primary", size: "small", onClick: G, children: o("sheet.numfmt.confirm") })
726
+ /* @__PURE__ */ m.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
727
+ /* @__PURE__ */ m.jsx(He, { size: "small", onClick: ye, className: "m-r-12", children: o("sheet.numfmt.cancel") }),
728
+ /* @__PURE__ */ m.jsx(He, { type: "primary", size: "small", onClick: w, children: o("sheet.numfmt.confirm") })
865
729
  ] })
866
730
  ] });
867
- }, Pt = {
731
+ }, ot = {
868
732
  id: "sheet.command.numfmt.set.percent",
869
- type: X.COMMAND,
733
+ type: V.COMMAND,
870
734
  handler: async (e) => {
871
- const t = e.get(D), n = e.get(ee).getSelections();
735
+ const t = e.get($), n = e.get(H).getSelections();
872
736
  if (!n || !n.length)
873
737
  return !1;
874
738
  const s = [], i = "0%";
875
739
  return n.forEach((o) => {
876
- R.foreach(o.range, (c, d) => {
877
- s.push({ row: c, col: d, pattern: i, type: "percent" });
740
+ E.foreach(o.range, (l, u) => {
741
+ s.push({ row: l, col: u, pattern: i, type: "percent" });
878
742
  });
879
- }), await t.executeCommand(Q.id, { values: s });
743
+ }), await t.executeCommand(A.id, { values: s });
880
744
  }
881
745
  };
882
- var lr = Object.defineProperty, ur = Object.getOwnPropertyDescriptor, dr = (e, t, r, n) => {
883
- for (var s = n > 1 ? void 0 : n ? ur(t, r) : t, i = e.length - 1, a; i >= 0; i--)
746
+ var In = Object.defineProperty, Mn = Object.getOwnPropertyDescriptor, xn = (e, t, r, n) => {
747
+ for (var s = n > 1 ? void 0 : n ? Mn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
884
748
  (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
885
- return n && s && lr(t, r, s), s;
886
- }, P = (e, t) => (r, n) => t(r, n, e);
887
- let Me = class extends H {
888
- constructor(t, r, n, s, i, a, o, c, d, l, u, m) {
749
+ return n && s && In(t, r, s), s;
750
+ }, N = (e, t) => (r, n) => t(r, n, e);
751
+ let ue = class extends X {
752
+ constructor(t, r, n, s, i, a, o, l, u, d, c) {
889
753
  super();
890
754
  /**
891
755
  * If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
@@ -893,169 +757,128 @@ let Me = class extends H {
893
757
  * @type {(string | null)}
894
758
  * @memberof NumfmtController
895
759
  */
896
- Y(this, "_previewPattern", "");
897
- Y(this, "openPanel", () => {
898
- const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService, a = this._localeService, c = (r.getSelectionRanges() || [])[0];
899
- if (!c)
760
+ U(this, "_previewPattern", "");
761
+ U(this, "openPanel", () => {
762
+ const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService, a = this._localeService, l = (r.getSelectionRanges() || [])[0];
763
+ if (!l)
900
764
  return !1;
901
- const d = s.getCurrentUniverSheetInstance(), l = d.getActiveSheet(), u = l.getCellRaw(c.startRow, c.startColumn), m = i.getValue(
902
- d.getUnitId(),
903
- l.getSheetId(),
904
- c.startRow,
905
- c.startColumn
765
+ const u = s.getCurrentUnitForType(j.UNIVER_SHEET), d = u.getActiveSheet(), c = d.getCellRaw(l.startRow, l.startColumn), h = i.getValue(
766
+ u.getUnitId(),
767
+ d.getSheetId(),
768
+ l.startRow,
769
+ l.startColumn
906
770
  );
907
- let h = "";
908
- m && (h = m.pattern);
909
- const g = (u == null ? void 0 : u.t) === ie.NUMBER ? u.v : 12345678, v = {
910
- onChange: (f) => {
911
- var S, C;
912
- if (f.type === "change")
913
- this._previewPattern = f.value, this._sheetSkeletonManagerService.reCalculate(), (C = (S = this._renderManagerService.getRenderById(d.getUnitId())) == null ? void 0 : S.mainComponent) == null || C.makeDirty();
914
- else if (f.type === "confirm") {
915
- const b = r.getSelectionRanges() || [], A = { values: [] }, G = Xe(f.value);
916
- b.forEach((F) => {
917
- R.foreach(F, (B, y) => {
918
- A.values.push({
919
- row: B,
771
+ let _ = "";
772
+ h && (_ = h.pattern);
773
+ const v = (c == null ? void 0 : c.t) === z.NUMBER ? c.v : 12345678, f = {
774
+ onChange: (p) => {
775
+ var g, C;
776
+ if (p.type === "change")
777
+ this._previewPattern = p.value, this._sheetSkeletonManagerService.reCalculate(), (C = (g = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : g.mainComponent) == null || C.makeDirty();
778
+ else if (p.type === "confirm") {
779
+ const R = r.getSelectionRanges() || [], O = { values: [] }, w = pe(p.value);
780
+ R.forEach((ye) => {
781
+ E.foreach(ye, (be, y) => {
782
+ O.values.push({
783
+ row: be,
920
784
  col: y,
921
- pattern: f.value,
922
- type: G
785
+ pattern: p.value,
786
+ type: w
923
787
  });
924
788
  });
925
- }), n.executeCommand(Q.id, A), t.close();
789
+ }), n.executeCommand(A.id, O), t.close();
926
790
  } else
927
- f.type === "cancel" && t.close();
791
+ p.type === "cancel" && t.close();
928
792
  },
929
- value: { defaultPattern: h, defaultValue: g, row: c.startRow, col: c.startColumn }
793
+ value: { defaultPattern: _, defaultValue: v, row: l.startRow, col: l.startColumn }
930
794
  };
931
795
  t.open({
932
796
  header: { title: a.t("sheet.numfmt.title") },
933
797
  children: {
934
- label: ue,
935
- ...v
798
+ label: Ne,
799
+ ...f
936
800
  // need passthrough to react props.
937
801
  },
938
802
  onClose: () => {
939
- var f, S;
940
- this._sheetSkeletonManagerService.reCalculate(), (S = (f = this._renderManagerService.getRenderById(d.getUnitId())) == null ? void 0 : f.mainComponent) == null || S.makeDirty(), n.executeCommand(ke.id);
803
+ var p, g;
804
+ this._sheetSkeletonManagerService.reCalculate(), (g = (p = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : p.mainComponent) == null || g.makeDirty(), n.executeCommand(Ie.id);
941
805
  }
942
806
  });
943
807
  });
944
- this._sheetInterceptorService = t, this._themeService = r, this._injector = n, this._univerInstanceService = s, this._sheetSkeletonManagerService = i, this._commandService = a, this._selectionManagerService = o, this._renderManagerService = c, this._numfmtService = d, this._componentManager = l, this._sidebarService = u, this._localeService = m, this._initInterceptorCommands(), this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._commandExecutedListener();
808
+ this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._selectionManagerService = a, this._renderManagerService = o, this._numfmtService = l, this._componentManager = u, this._sidebarService = d, this._localeService = c, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._commandExecutedListener();
945
809
  }
946
810
  _initCommands() {
947
811
  [
948
- _t,
949
- bt,
950
- Ct,
951
- Pt,
952
- $e,
953
- ke,
954
- Q
812
+ et,
813
+ rt,
814
+ nt,
815
+ ot,
816
+ ve,
817
+ Ie,
818
+ A
955
819
  ].forEach((t) => {
956
820
  this.disposeWithMe(this._commandService.registerCommand(t));
957
821
  });
958
822
  }
959
823
  _initPanel() {
960
- this._componentManager.register(ue, cr);
961
- }
962
- _initInterceptorCommands() {
963
- const t = this;
964
- this.disposeWithMe(
965
- this._sheetInterceptorService.interceptCommand({
966
- getMutations(r) {
967
- switch (r.id) {
968
- case Kt.id:
969
- case Wt.id: {
970
- const n = t._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(), s = t._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), i = t._selectionManagerService.getSelectionRanges();
971
- if (!(i != null && i.length))
972
- break;
973
- const a = {
974
- unitId: n,
975
- subUnitId: s,
976
- ranges: []
977
- }, o = t._numfmtService.getModel(n, s);
978
- i.forEach((d) => {
979
- R.foreach(d, (l, u) => {
980
- o != null && o.getValue(l, u) && a.ranges.push({
981
- startColumn: u,
982
- endColumn: u,
983
- startRow: l,
984
- endRow: l
985
- });
986
- });
987
- }), a.ranges = z(a.ranges);
988
- const c = J(t._injector, a);
989
- return {
990
- redos: [{ id: M.id, params: a }],
991
- undos: c
992
- };
993
- }
994
- }
995
- return {
996
- redos: [],
997
- undos: []
998
- };
999
- }
1000
- })
1001
- );
824
+ this._componentManager.register(Ne, bn);
1002
825
  }
1003
826
  _initRealTimeRenderingInterceptor() {
1004
- const t = new Z((n) => {
827
+ const t = new J((n) => {
1005
828
  this._commandService.onCommandExecuted((s) => {
1006
- s.id === $e.id && n.next(!0), s.id === ke.id && n.next(!1);
829
+ s.id === ve.id && n.next(!0), s.id === Ie.id && n.next(!1);
1007
830
  });
1008
- }), r = yn([
831
+ }), r = Vt([
1009
832
  t,
1010
833
  this._selectionManagerService.selectionMoveEnd$.pipe(
1011
- le((n) => n ? n.map((s) => s.range) : [])
834
+ Ye((n) => n ? n.map((s) => s.range) : [])
1012
835
  )
1013
836
  ]);
1014
837
  this.disposeWithMe(
1015
- q(
838
+ Q(
1016
839
  r.pipe(
1017
- pt(
1018
- ([n, s]) => new Z((i) => {
1019
- const a = new mt();
840
+ jt(
841
+ ([n, s]) => new J((i) => {
842
+ const a = new xt();
1020
843
  return n && s.length && i.next({ selectionRanges: s, disposableCollection: a }), () => {
1021
844
  a.dispose();
1022
845
  };
1023
846
  })
1024
847
  ),
1025
- pn(() => {
848
+ Dt(() => {
1026
849
  this._previewPattern = null;
1027
850
  })
1028
851
  ).subscribe(({ disposableCollection: n, selectionRanges: s }) => {
1029
852
  var a, o;
1030
- const i = this._univerInstanceService.getCurrentUniverSheetInstance();
853
+ const i = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
1031
854
  this.openPanel(), n.add(
1032
- this._sheetInterceptorService.intercept(ht.CELL_CONTENT, {
855
+ this._sheetInterceptorService.intercept(Ze.CELL_CONTENT, {
1033
856
  priority: 99,
1034
- handler: (c, d, l) => {
1035
- const { row: u, col: m } = d, h = l(c) || {};
857
+ handler: (l, u, d) => {
858
+ const { row: c, col: h } = u, _ = d(l) || {};
1036
859
  if (s.find(
1037
- (g) => g.startColumn <= m && g.endColumn >= m && g.startRow <= u && g.endRow >= u
860
+ (v) => v.startColumn <= h && v.endColumn >= h && v.startRow <= c && v.endRow >= c
1038
861
  )) {
1039
- const g = d.worksheet.getCellRaw(u, m), v = g == null ? void 0 : g.v, f = g == null ? void 0 : g.t;
1040
- if (v == null || f !== ie.NUMBER || this._previewPattern === null)
1041
- return h;
1042
- const S = et(this._previewPattern, v, this._localeService.getCurrentLocale());
1043
- if (S.color) {
1044
- const b = this._themeService.getCurrentTheme()[`${S.color}500`];
862
+ const v = u.worksheet.getCellRaw(c, h), f = v == null ? void 0 : v.v, p = v == null ? void 0 : v.t;
863
+ if (f == null || p !== z.NUMBER || this._previewPattern === null)
864
+ return _;
865
+ const g = Le(this._previewPattern, f, this._localeService.getCurrentLocale());
866
+ if (g.color) {
867
+ const R = this._themeService.getCurrentTheme()[`${g.color}500`];
1045
868
  return {
1046
- ...h,
1047
- v: S.result,
1048
- t: ie.STRING,
1049
- s: { cl: { rgb: b } }
869
+ ..._,
870
+ v: g.result,
871
+ t: z.STRING,
872
+ s: { cl: { rgb: R } }
1050
873
  };
1051
874
  }
1052
875
  return {
1053
- ...h,
1054
- v: S.result,
1055
- t: ie.STRING
876
+ ..._,
877
+ v: g.result,
878
+ t: z.STRING
1056
879
  };
1057
880
  }
1058
- return h;
881
+ return _;
1059
882
  }
1060
883
  })
1061
884
  ), (o = (a = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : a.mainComponent) == null || o.makeDirty();
@@ -1064,11 +887,11 @@ let Me = class extends H {
1064
887
  );
1065
888
  }
1066
889
  _commandExecutedListener() {
1067
- const t = [M.id, x.id];
890
+ const t = [_e.id, te.id];
1068
891
  this.disposeWithMe(
1069
- q(
1070
- Ge(
1071
- new Z((r) => {
892
+ Q(
893
+ Qe(
894
+ new J((r) => {
1072
895
  const n = this._commandService.onCommandExecuted((s) => {
1073
896
  if (t.includes(s.id)) {
1074
897
  const i = s.params;
@@ -1078,9 +901,8 @@ let Me = class extends H {
1078
901
  return () => {
1079
902
  n.dispose();
1080
903
  };
1081
- }),
1082
- this._numfmtService.modelReplace$
1083
- ).pipe(vn(16)).subscribe((r) => {
904
+ })
905
+ ).pipe($t(16)).subscribe((r) => {
1084
906
  var n, s;
1085
907
  this._sheetSkeletonManagerService.reCalculate(), (s = (n = this._renderManagerService.getRenderById(r)) == null ? void 0 : n.mainComponent) == null || s.makeDirty();
1086
908
  })
@@ -1088,155 +910,45 @@ let Me = class extends H {
1088
910
  );
1089
911
  }
1090
912
  };
1091
- Me = dr([
1092
- k($.Rendered, Me),
1093
- P(0, _(Ae)),
1094
- P(1, _(dt)),
1095
- P(2, _(K)),
1096
- P(3, _(E)),
1097
- P(4, _(Ke)),
1098
- P(5, _(D)),
1099
- P(6, _(ee)),
1100
- P(7, _(_n)),
1101
- P(8, _(U)),
1102
- P(9, _(vt)),
1103
- P(10, _(Cn)),
1104
- P(11, _(j))
1105
- ], Me);
1106
- var mr = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, fr = (e, t, r, n) => {
1107
- for (var s = n > 1 ? void 0 : n ? hr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1108
- (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
1109
- return n && s && mr(t, r, s), s;
1110
- }, be = (e, t) => (r, n) => t(r, n, e);
1111
- let Pe = class extends H {
1112
- constructor(t, r, n, s) {
1113
- super();
1114
- Y(this, "_copyInfo");
1115
- this._sheetClipboardService = t, this._injector = r, this._numfmtService = n, this._univerInstanceService = s, this._initClipboardHook();
1116
- }
1117
- _initClipboardHook() {
1118
- this.disposeWithMe(
1119
- this._sheetClipboardService.addClipboardHook({
1120
- id: ue,
1121
- onBeforeCopy: (t, r, n) => this._collectNumfmt(t, r, n),
1122
- onPasteCells: (t, r, n, s) => {
1123
- const { copyType: i = rt.COPY, pasteType: a } = s, { range: o } = t || {}, { range: c } = r;
1124
- return this._generateNumfmtMutations(c, { copyType: i, pasteType: a, copyRange: o });
1125
- }
1126
- })
1127
- );
1128
- }
1129
- _collectNumfmt(t, r, n) {
1130
- const s = new ut();
1131
- this._copyInfo = {
1132
- matrix: s,
1133
- info: {
1134
- unitId: t,
1135
- subUnitId: r
1136
- }
1137
- };
1138
- const i = this._numfmtService.getModel(t, r);
1139
- i && R.foreach(n, (a, o) => {
1140
- const c = this._numfmtService.getValue(t, r, a, o, i);
1141
- if (!c)
1142
- return;
1143
- const d = De.getRelativeRange(
1144
- {
1145
- startRow: a,
1146
- endRow: a,
1147
- startColumn: o,
1148
- endColumn: o
1149
- },
1150
- n
1151
- );
1152
- s.setValue(d.startRow, d.startColumn, {
1153
- pattern: c.pattern,
1154
- type: c.type
1155
- });
1156
- });
1157
- }
1158
- _generateNumfmtMutations(t, r) {
1159
- const n = this._univerInstanceService.getCurrentUniverSheetInstance(), s = n.getActiveSheet(), i = n.getUnitId(), a = s.getSheetId();
1160
- if (r.copyType === rt.CUT)
1161
- return this._copyInfo = null, { redos: [], undos: [] };
1162
- if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !r.copyRange)
1163
- return { redos: [], undos: [] };
1164
- if ([st.SPECIAL_PASTE_COL_WIDTH, st.SPECIAL_PASTE_VALUE].includes(
1165
- r.pasteType
1166
- ))
1167
- return { redos: [], undos: [] };
1168
- const o = mn(r.copyRange, t, !0), c = [], d = { unitId: i, subUnitId: a, ranges: [] }, l = this._numfmtService.getModel(i, a);
1169
- R.foreach(t, (h, g) => {
1170
- this._numfmtService.getValue(i, a, h, g, l) && d.ranges.push({ startRow: h, startColumn: g, endRow: h, endColumn: g });
1171
- }), o.forEach((h) => {
1172
- this._copyInfo && this._copyInfo.matrix.forValue((g, v, f) => {
1173
- const S = De.getPositionRange(
1174
- {
1175
- startRow: g,
1176
- endRow: g,
1177
- startColumn: v,
1178
- endColumn: v
1179
- },
1180
- h.startRange
1181
- );
1182
- c.push({
1183
- row: S.startRow,
1184
- col: S.startColumn,
1185
- pattern: f.pattern,
1186
- type: f.type
1187
- });
1188
- });
1189
- });
1190
- const u = me(i, a, c);
1191
- Object.keys(u.values).forEach((h) => {
1192
- const g = u.values[h];
1193
- g.ranges = z(g.ranges);
1194
- }), d.ranges = z(d.ranges);
1195
- const m = [
1196
- ...he(this._injector, u),
1197
- ...J(this._injector, d)
1198
- ];
1199
- return {
1200
- redos: [
1201
- { id: M.id, params: d },
1202
- { id: x.id, params: u }
1203
- ],
1204
- undos: Ee(m)
1205
- };
1206
- }
1207
- };
1208
- Pe = fr([
1209
- k($.Rendered, Pe),
1210
- be(0, _(hn)),
1211
- be(1, _(K)),
1212
- be(2, _(U)),
1213
- be(3, _(E))
1214
- ], Pe);
1215
- var pr = Object.defineProperty, vr = Object.getOwnPropertyDescriptor, gr = (e, t, r, n) => {
1216
- for (var s = n > 1 ? void 0 : n ? vr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
913
+ ue = xn([
914
+ ee(K.Rendered, ue),
915
+ N(0, S(Oe)),
916
+ N(1, S(ze)),
917
+ N(2, S(W)),
918
+ N(3, S(qe)),
919
+ N(4, S($)),
920
+ N(5, S(H)),
921
+ N(6, S(wt)),
922
+ N(7, S(G)),
923
+ N(8, S(Je)),
924
+ N(9, S(Ut)),
925
+ N(10, S(x))
926
+ ], ue);
927
+ var Nn = Object.defineProperty, Tn = Object.getOwnPropertyDescriptor, Rn = (e, t, r, n) => {
928
+ for (var s = n > 1 ? void 0 : n ? Tn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1217
929
  (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
1218
- return n && s && pr(t, r, s), s;
1219
- }, ce = (e, t) => (r, n) => t(r, n, e);
1220
- const _r = () => {
930
+ return n && s && Nn(t, r, s), s;
931
+ }, Y = (e, t) => (r, n) => t(r, n, e);
932
+ const On = () => {
1221
933
  let e = [];
1222
934
  return {
1223
- add: (s, i, a, o, c) => e.push({ unitId: s, subUnitId: i, row: a, col: o, value: c }),
935
+ add: (s, i, a, o, l) => e.push({ unitId: s, subUnitId: i, row: a, col: o, value: l }),
1224
936
  getEffects: () => e,
1225
937
  clean: () => {
1226
938
  e = [];
1227
939
  }
1228
940
  };
1229
941
  };
1230
- let Oe = class extends H {
942
+ let me = class extends X {
1231
943
  constructor(t, r, n, s, i) {
1232
944
  super();
1233
945
  // collect effect mutations when edit end and push this to commands stack in next commands progress
1234
- Y(this, "_collectEffectMutation", _r());
946
+ U(this, "_collectEffectMutation", On());
1235
947
  this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
1236
948
  }
1237
949
  _initInterceptorEditorStart() {
1238
950
  this.disposeWithMe(
1239
- q(
951
+ Q(
1240
952
  this._editorBridgeService.interceptor.intercept(
1241
953
  this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
1242
954
  {
@@ -1248,7 +960,7 @@ let Oe = class extends H {
1248
960
  i
1249
961
  );
1250
962
  if (a)
1251
- switch (Xe(a.pattern)) {
963
+ switch (pe(a.pattern)) {
1252
964
  case "scientific":
1253
965
  case "percent":
1254
966
  case "currency":
@@ -1275,18 +987,19 @@ let Oe = class extends H {
1275
987
  */
1276
988
  _initInterceptorEditorEnd() {
1277
989
  this.disposeWithMe(
1278
- q(
990
+ Q(
1279
991
  this._editorBridgeService.interceptor.intercept(
1280
992
  this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
1281
993
  {
1282
994
  handler: (t, r, n) => {
995
+ var d;
1283
996
  this._collectEffectMutation.clean();
1284
997
  const s = this._numfmtService.getValue(
1285
998
  r.unitId,
1286
999
  r.subUnitId,
1287
1000
  r.row,
1288
1001
  r.col
1289
- ), i = () => {
1002
+ ), i = (d = s && pe(s.pattern)) != null ? d : "", a = () => {
1290
1003
  s && this._collectEffectMutation.add(
1291
1004
  r.unitId,
1292
1005
  r.subUnitId,
@@ -1297,23 +1010,22 @@ let Oe = class extends H {
1297
1010
  };
1298
1011
  if (!(t != null && t.v))
1299
1012
  return n(t);
1300
- const a = String(t.v), o = V.parseDate(a) || V.parseTime(a);
1301
- if (!!o) {
1302
- if (o && o.z) {
1303
- const d = Number(o.v);
1013
+ const o = String(t.v), l = D.parseDate(o) || D.parseTime(o);
1014
+ if (!!l) {
1015
+ if (l && l.z) {
1016
+ const c = Number(l.v);
1304
1017
  return this._collectEffectMutation.add(
1305
1018
  r.unitId,
1306
1019
  r.subUnitId,
1307
1020
  r.row,
1308
1021
  r.col,
1309
1022
  {
1310
- type: "date",
1311
- pattern: o.z
1023
+ pattern: l.z
1312
1024
  }
1313
- ), { ...t, v: d, t: ie.NUMBER };
1025
+ ), { ...t, v: c, t: z.NUMBER };
1314
1026
  }
1315
1027
  } else
1316
- (["date", "time", "datetime"].includes((s == null ? void 0 : s.type) || "") || !Sr(a)) && i();
1028
+ (["date", "time", "datetime"].includes(i) || !Pn(o)) && a();
1317
1029
  return n(t);
1318
1030
  }
1319
1031
  }
@@ -1327,50 +1039,49 @@ let Oe = class extends H {
1327
1039
  this._sheetInterceptorService.interceptCommand({
1328
1040
  getMutations(r) {
1329
1041
  switch (r.id) {
1330
- case Gt.id: {
1331
- const n = t._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(), s = t._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), i = t._collectEffectMutation.getEffects();
1332
- if (!i.length)
1042
+ case Tt.id: {
1043
+ const n = t._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET), s = n.getUnitId(), i = n.getActiveSheet().getSheetId(), a = t._collectEffectMutation.getEffects();
1044
+ if (!a.length)
1333
1045
  return {
1334
1046
  redos: [],
1335
1047
  undos: []
1336
1048
  };
1337
- const a = i.filter((l) => {
1338
- var u;
1339
- return !!((u = l.value) != null && u.pattern);
1340
- }).map((l) => ({
1341
- row: l.row,
1342
- col: l.col,
1343
- pattern: l.value.pattern,
1344
- type: l.value.type
1345
- })), o = i.filter((l) => {
1346
- var u;
1347
- return !((u = l.value) != null && u.pattern);
1348
- }).map((l) => ({
1349
- startRow: l.row,
1350
- endColumn: l.col,
1351
- startColumn: l.col,
1352
- endRow: l.row
1353
- })), c = [], d = [];
1354
- if (a) {
1355
- const l = {
1356
- id: x.id,
1357
- params: me(n, s, a)
1049
+ const o = a.filter((c) => {
1050
+ var h;
1051
+ return !!((h = c.value) != null && h.pattern);
1052
+ }).map((c) => ({
1053
+ row: c.row,
1054
+ col: c.col,
1055
+ pattern: c.value.pattern
1056
+ })), l = a.filter((c) => {
1057
+ var h;
1058
+ return !((h = c.value) != null && h.pattern);
1059
+ }).map((c) => ({
1060
+ startRow: c.row,
1061
+ endColumn: c.col,
1062
+ startColumn: c.col,
1063
+ endRow: c.row
1064
+ })), u = [], d = [];
1065
+ if (o) {
1066
+ const c = {
1067
+ id: te.id,
1068
+ params: We(s, i, o)
1358
1069
  };
1359
- c.push(l), d.push(...he(t._injector, l.params));
1070
+ u.push(c), d.push(...Ke(t._injector, c.params));
1360
1071
  }
1361
- if (o) {
1362
- const l = {
1363
- id: M.id,
1072
+ if (l) {
1073
+ const c = {
1074
+ id: _e.id,
1364
1075
  params: {
1365
- unitId: n,
1366
- subUnitId: s,
1367
- ranges: o
1076
+ unitId: s,
1077
+ subUnitId: i,
1078
+ ranges: l
1368
1079
  }
1369
1080
  };
1370
- c.push(l), d.push(...J(t._injector, l.params));
1081
+ u.push(c), d.push(...Ge(t._injector, c.params));
1371
1082
  }
1372
1083
  return {
1373
- redos: c,
1084
+ redos: u,
1374
1085
  undos: d.reverse()
1375
1086
  };
1376
1087
  }
@@ -1384,45 +1095,45 @@ let Oe = class extends H {
1384
1095
  );
1385
1096
  }
1386
1097
  };
1387
- Oe = gr([
1388
- k($.Rendered, Oe),
1389
- ce(0, _(Ae)),
1390
- ce(1, _(U)),
1391
- ce(2, _(E)),
1392
- ce(3, _(K)),
1393
- ce(4, _(fn))
1394
- ], Oe);
1395
- function Sr(e) {
1098
+ me = Rn([
1099
+ ee(K.Rendered, me),
1100
+ Y(0, S(Oe)),
1101
+ Y(1, S(G)),
1102
+ Y(2, S(W)),
1103
+ Y(3, S(Pe)),
1104
+ Y(4, S(Ot))
1105
+ ], me);
1106
+ function Pn(e) {
1396
1107
  return /^-?\d+(\.\d+)?$/.test(e);
1397
1108
  }
1398
- var Cr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, yr = (e, t, r, n) => {
1399
- for (var s = n > 1 ? void 0 : n ? br(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1109
+ var En = Object.defineProperty, jn = Object.getOwnPropertyDescriptor, Dn = (e, t, r, n) => {
1110
+ for (var s = n > 1 ? void 0 : n ? jn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1400
1111
  (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
1401
- return n && s && Cr(t, r, s), s;
1402
- }, Rr = (e, t) => (r, n) => t(r, n, e);
1403
- let we = class extends H {
1112
+ return n && s && En(t, r, s), s;
1113
+ }, $n = (e, t) => (r, n) => t(r, n, e);
1114
+ let de = class extends X {
1404
1115
  constructor(t) {
1405
1116
  super();
1406
- Y(this, "_initLocal", () => {
1407
- this._localeService.load({ zhCN: jn, enUS: wn });
1117
+ U(this, "_initLocal", () => {
1118
+ this._localeService.load({ zhCN: Kt, enUS: zt });
1408
1119
  });
1409
1120
  this._localeService = t, this._initLocal();
1410
1121
  }
1411
1122
  };
1412
- we = yr([
1413
- k($.Rendered, we),
1414
- Rr(0, _(j))
1415
- ], we);
1416
- var O = function() {
1417
- return O = Object.assign || function(e) {
1123
+ de = Dn([
1124
+ ee(K.Rendered, de),
1125
+ $n(0, S(x))
1126
+ ], de);
1127
+ var I = function() {
1128
+ return I = Object.assign || function(e) {
1418
1129
  for (var t, r = 1, n = arguments.length; r < n; r++) {
1419
1130
  t = arguments[r];
1420
1131
  for (var s in t)
1421
1132
  Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]);
1422
1133
  }
1423
1134
  return e;
1424
- }, O.apply(this, arguments);
1425
- }, Ir = function(e, t) {
1135
+ }, I.apply(this, arguments);
1136
+ }, wn = function(e, t) {
1426
1137
  var r = {};
1427
1138
  for (var n in e)
1428
1139
  Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
@@ -1430,17 +1141,17 @@ var O = function() {
1430
1141
  for (var s = 0, n = Object.getOwnPropertySymbols(e); s < n.length; s++)
1431
1142
  t.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[s]) && (r[n[s]] = e[n[s]]);
1432
1143
  return r;
1433
- }, oe = ae(function(e, t) {
1434
- var r = e.icon, n = e.id, s = e.className, i = e.extend, a = Ir(e, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(n, " ").concat(s || "").trim(), c = Ze("_".concat(Or()));
1435
- return Ot(r, "".concat(n), { defIds: r.defIds, idSuffix: c.current }, O({ ref: t, className: o }, a), i);
1144
+ }, q = Z(function(e, t) {
1145
+ var r = e.icon, n = e.id, s = e.className, i = e.extend, a = wn(e, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(n, " ").concat(s || "").trim(), l = je("_".concat(An()));
1146
+ return lt(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current }, I({ ref: t, className: o }, a), i);
1436
1147
  });
1437
- function Ot(e, t, r, n, s) {
1438
- return te(e.tag, O(O({ key: t }, Mr(e, r, s)), n), (Pr(e, r).children || []).map(function(i, a) {
1439
- return Ot(i, "".concat(t, "-").concat(e.tag, "-").concat(a), r, void 0, s);
1148
+ function lt(e, t, r, n, s) {
1149
+ return B(e.tag, I(I({ key: t }, Ln(e, r, s)), n), (Un(e, r).children || []).map(function(i, a) {
1150
+ return lt(i, "".concat(t, "-").concat(e.tag, "-").concat(a), r, void 0, s);
1440
1151
  }));
1441
1152
  }
1442
- function Mr(e, t, r) {
1443
- var n = O({}, e.attrs);
1153
+ function Ln(e, t, r) {
1154
+ var n = I({}, e.attrs);
1444
1155
  r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
1445
1156
  var s = t.defIds;
1446
1157
  return !s || s.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(i) {
@@ -1448,61 +1159,61 @@ function Mr(e, t, r) {
1448
1159
  typeof o == "string" && (n[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
1449
1160
  })), n;
1450
1161
  }
1451
- function Pr(e, t) {
1162
+ function Un(e, t) {
1452
1163
  var r, n = t.defIds;
1453
- return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? O(O({}, e), { children: e.children.map(function(s) {
1454
- return typeof s.attrs.id == "string" && n && n.indexOf(s.attrs.id) > -1 ? O(O({}, s), { attrs: O(O({}, s.attrs), { id: s.attrs.id + t.idSuffix }) }) : s;
1164
+ return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? I(I({}, e), { children: e.children.map(function(s) {
1165
+ return typeof s.attrs.id == "string" && n && n.indexOf(s.attrs.id) > -1 ? I(I({}, s), { attrs: I(I({}, s.attrs), { id: s.attrs.id + t.idSuffix }) }) : s;
1455
1166
  }) }) : e;
1456
1167
  }
1457
- function Or() {
1168
+ function An() {
1458
1169
  return Math.random().toString(36).substring(2, 8);
1459
1170
  }
1460
- oe.displayName = "UniverIcon";
1461
- var wr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.99988 3.60921C3.99988 2.32055 5.04456 1.27588 6.33321 1.27588 7.62187 1.27588 8.66654 2.32055 8.66654 3.60921V6.24136C8.66654 7.53002 7.62187 8.5747 6.33321 8.5747 5.04455 8.5747 3.99988 7.53002 3.99988 6.24136V3.60921zM6.33321 2.60921C5.78093 2.60921 5.33321 3.05693 5.33321 3.60921V6.24136C5.33321 6.79364 5.78093 7.24136 6.33321 7.24136 6.88549 7.24136 7.33321 6.79364 7.33321 6.24136V3.60921C7.33321 3.05693 6.88549 2.60921 6.33321 2.60921zM9.99988 3.60921C9.99988 2.32055 11.0446 1.27588 12.3332 1.27588 13.6219 1.27588 14.6665 2.32055 14.6665 3.60921V6.24136C14.6665 7.53002 13.6219 8.5747 12.3332 8.5747 11.0446 8.5747 9.99988 7.53002 9.99988 6.24136V3.60921zM12.3332 2.60921C11.7809 2.60921 11.3332 3.05693 11.3332 3.60921V6.24136C11.3332 6.79364 11.7809 7.24136 12.3332 7.24136 12.8855 7.24136 13.3332 6.79364 13.3332 6.24136V3.60921C13.3332 3.05693 12.8855 2.60921 12.3332 2.60921z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.4713 9.58625C12.211 9.3259 11.7889 9.3259 11.5285 9.58625 11.2682 9.8466 11.2682 10.2687 11.5285 10.5291L12.3904 11.391H6.33329C5.9651 11.391 5.66663 11.6895 5.66663 12.0577 5.66663 12.4258 5.9651 12.7243 6.33329 12.7243H12.3904L11.5285 13.5862C11.2682 13.8466 11.2682 14.2687 11.5285 14.5291 11.7889 14.7894 12.211 14.7894 12.4713 14.5291L14.4669 12.5335C14.4851 12.5156 14.5022 12.4968 14.5183 12.477 14.5484 12.4399 14.5739 12.4003 14.5948 12.359 14.6407 12.2685 14.6666 12.1661 14.6666 12.0577 14.6666 11.9492 14.6407 11.8468 14.5948 11.7563 14.5739 11.715 14.5484 11.6754 14.5183 11.6383 14.5022 11.6185 14.4851 11.5997 14.4669 11.5818L12.4713 9.58625zM1.33325 7.98825C1.33325 7.62006 1.63173 7.32159 1.99992 7.32159H2.33325C2.70144 7.32159 2.99992 7.62006 2.99992 7.98825 2.99992 8.35644 2.70144 8.65492 2.33325 8.65492H1.99992C1.63173 8.65492 1.33325 8.35644 1.33325 7.98825z" } }] }, wt = ae(function(e, t) {
1462
- return te(oe, Object.assign({}, e, {
1171
+ q.displayName = "UniverIcon";
1172
+ var Vn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.99988 3.60921C3.99988 2.32055 5.04456 1.27588 6.33321 1.27588 7.62187 1.27588 8.66654 2.32055 8.66654 3.60921V6.24136C8.66654 7.53002 7.62187 8.5747 6.33321 8.5747 5.04455 8.5747 3.99988 7.53002 3.99988 6.24136V3.60921zM6.33321 2.60921C5.78093 2.60921 5.33321 3.05693 5.33321 3.60921V6.24136C5.33321 6.79364 5.78093 7.24136 6.33321 7.24136 6.88549 7.24136 7.33321 6.79364 7.33321 6.24136V3.60921C7.33321 3.05693 6.88549 2.60921 6.33321 2.60921zM9.99988 3.60921C9.99988 2.32055 11.0446 1.27588 12.3332 1.27588 13.6219 1.27588 14.6665 2.32055 14.6665 3.60921V6.24136C14.6665 7.53002 13.6219 8.5747 12.3332 8.5747 11.0446 8.5747 9.99988 7.53002 9.99988 6.24136V3.60921zM12.3332 2.60921C11.7809 2.60921 11.3332 3.05693 11.3332 3.60921V6.24136C11.3332 6.79364 11.7809 7.24136 12.3332 7.24136 12.8855 7.24136 13.3332 6.79364 13.3332 6.24136V3.60921C13.3332 3.05693 12.8855 2.60921 12.3332 2.60921z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.4713 9.58625C12.211 9.3259 11.7889 9.3259 11.5285 9.58625 11.2682 9.8466 11.2682 10.2687 11.5285 10.5291L12.3904 11.391H6.33329C5.9651 11.391 5.66663 11.6895 5.66663 12.0577 5.66663 12.4258 5.9651 12.7243 6.33329 12.7243H12.3904L11.5285 13.5862C11.2682 13.8466 11.2682 14.2687 11.5285 14.5291 11.7889 14.7894 12.211 14.7894 12.4713 14.5291L14.4669 12.5335C14.4851 12.5156 14.5022 12.4968 14.5183 12.477 14.5484 12.4399 14.5739 12.4003 14.5948 12.359 14.6407 12.2685 14.6666 12.1661 14.6666 12.0577 14.6666 11.9492 14.6407 11.8468 14.5948 11.7563 14.5739 11.715 14.5484 11.6754 14.5183 11.6383 14.5022 11.6185 14.4851 11.5997 14.4669 11.5818L12.4713 9.58625zM1.33325 7.98825C1.33325 7.62006 1.63173 7.32159 1.99992 7.32159H2.33325C2.70144 7.32159 2.99992 7.62006 2.99992 7.98825 2.99992 8.35644 2.70144 8.65492 2.33325 8.65492H1.99992C1.63173 8.65492 1.33325 8.35644 1.33325 7.98825z" } }] }, ut = Z(function(e, t) {
1173
+ return B(q, Object.assign({}, e, {
1463
1174
  id: "add-digits-single",
1464
1175
  ref: t,
1465
- icon: wr
1176
+ icon: Vn
1466
1177
  }));
1467
1178
  });
1468
- wt.displayName = "AddDigitsSingle";
1469
- const xr = wt;
1470
- var jr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_556", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_556)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M0.629584 3.99986C1.13729 3.4922 1.9604 3.49224 2.46806 3.99995L7.57569 9.10806C7.81 9.3424 8.18992 9.3424 8.42424 9.10808L13.5323 3.99998C14.04 3.4923 14.8631 3.4923 15.3708 3.99998C15.8785 4.50766 15.8785 5.33078 15.3708 5.83846L9.41415 11.7951C8.63307 12.5762 7.36669 12.5762 6.58565 11.7951L0.629497 5.83834C0.121839 5.33063 0.121879 4.50752 0.629584 3.99986Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, xt = ae(function(e, t) {
1471
- return te(oe, Object.assign({}, e, {
1179
+ ut.displayName = "AddDigitsSingle";
1180
+ const Hn = ut;
1181
+ var Bn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_556", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_556)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M0.629584 3.99986C1.13729 3.4922 1.9604 3.49224 2.46806 3.99995L7.57569 9.10806C7.81 9.3424 8.18992 9.3424 8.42424 9.10808L13.5323 3.99998C14.04 3.4923 14.8631 3.4923 15.3708 3.99998C15.8785 4.50766 15.8785 5.33078 15.3708 5.83846L9.41415 11.7951C8.63307 12.5762 7.36669 12.5762 6.58565 11.7951L0.629497 5.83834C0.121839 5.33063 0.121879 4.50752 0.629584 3.99986Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, mt = Z(function(e, t) {
1182
+ return B(q, Object.assign({}, e, {
1472
1183
  id: "more-down-single",
1473
1184
  ref: t,
1474
- icon: jr
1185
+ icon: Bn
1475
1186
  }));
1476
1187
  });
1477
- xt.displayName = "MoreDownSingle";
1478
- const Nr = xt;
1479
- var Tr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_561_2", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_561_2)", fillRule: "evenodd", clipRule: "evenodd" }, children: [{ tag: "path", attrs: { d: "M4.91876 2.65039C3.66601 2.65039 2.65045 3.66595 2.65045 4.9187 2.65045 6.17146 3.66601 7.18702 4.91876 7.18702 6.17152 7.18702 7.18708 6.17146 7.18708 4.9187 7.18708 3.66595 6.17152 2.65039 4.91876 2.65039zM3.94663 4.9187C3.94663 4.38181 4.38187 3.94657 4.91876 3.94657 5.45566 3.94657 5.8909 4.38181 5.8909 4.9187 5.8909 5.4556 5.45566 5.89084 4.91876 5.89084 4.38187 5.89084 3.94663 5.4556 3.94663 4.9187zM11.0812 8.81299C9.82842 8.81299 8.81286 9.82855 8.81286 11.0813 8.81286 12.3341 9.82842 13.3496 11.0812 13.3496 12.3339 13.3496 13.3495 12.3341 13.3495 11.0813 13.3495 9.82855 12.3339 8.81299 11.0812 8.81299zM10.109 11.0813C10.109 10.5444 10.5443 10.1092 11.0812 10.1092 11.6181 10.1092 12.0533 10.5444 12.0533 11.0813 12.0533 11.6182 11.6181 12.0534 11.0812 12.0534 10.5443 12.0534 10.109 11.6182 10.109 11.0813zM13.1597 2.84021C13.4128 3.09331 13.4128 3.50365 13.1597 3.75675L3.7568 13.1596C3.5037 13.4127 3.09336 13.4127 2.84026 13.1596 2.58717 12.9065 2.58717 12.4962 2.84026 12.2431L12.2431 2.84021C12.4962 2.58712 12.9066 2.58712 13.1597 2.84021z" } }] }] }, jt = ae(function(e, t) {
1480
- return te(oe, Object.assign({}, e, {
1188
+ mt.displayName = "MoreDownSingle";
1189
+ const kn = mt;
1190
+ var Fn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_561_2", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_561_2)", fillRule: "evenodd", clipRule: "evenodd" }, children: [{ tag: "path", attrs: { d: "M4.91876 2.65039C3.66601 2.65039 2.65045 3.66595 2.65045 4.9187 2.65045 6.17146 3.66601 7.18702 4.91876 7.18702 6.17152 7.18702 7.18708 6.17146 7.18708 4.9187 7.18708 3.66595 6.17152 2.65039 4.91876 2.65039zM3.94663 4.9187C3.94663 4.38181 4.38187 3.94657 4.91876 3.94657 5.45566 3.94657 5.8909 4.38181 5.8909 4.9187 5.8909 5.4556 5.45566 5.89084 4.91876 5.89084 4.38187 5.89084 3.94663 5.4556 3.94663 4.9187zM11.0812 8.81299C9.82842 8.81299 8.81286 9.82855 8.81286 11.0813 8.81286 12.3341 9.82842 13.3496 11.0812 13.3496 12.3339 13.3496 13.3495 12.3341 13.3495 11.0813 13.3495 9.82855 12.3339 8.81299 11.0812 8.81299zM10.109 11.0813C10.109 10.5444 10.5443 10.1092 11.0812 10.1092 11.6181 10.1092 12.0533 10.5444 12.0533 11.0813 12.0533 11.6182 11.6181 12.0534 11.0812 12.0534 10.5443 12.0534 10.109 11.6182 10.109 11.0813zM13.1597 2.84021C13.4128 3.09331 13.4128 3.50365 13.1597 3.75675L3.7568 13.1596C3.5037 13.4127 3.09336 13.4127 2.84026 13.1596 2.58717 12.9065 2.58717 12.4962 2.84026 12.2431L12.2431 2.84021C12.4962 2.58712 12.9066 2.58712 13.1597 2.84021z" } }] }] }, dt = Z(function(e, t) {
1191
+ return B(q, Object.assign({}, e, {
1481
1192
  id: "percent-single",
1482
1193
  ref: t,
1483
- icon: Tr
1194
+ icon: Fn
1484
1195
  }));
1485
1196
  });
1486
- jt.displayName = "PercentSingle";
1487
- const Dr = jt;
1488
- var Er = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5 3.61825C5 2.32958 6.04468 1.28491 7.33333 1.28491C8.62199 1.28491 9.66667 2.32958 9.66667 3.61825V6.30787C9.66667 7.59653 8.62199 8.64121 7.33333 8.64121C6.04468 8.64121 5 7.59653 5 6.30787V3.61825ZM7.33333 2.61825C6.78105 2.61825 6.33333 3.06596 6.33333 3.61825V6.30787C6.33333 6.86015 6.78106 7.30787 7.33333 7.30787C7.88561 7.30787 8.33333 6.86015 8.33333 6.30787V3.61825C8.33333 3.06596 7.88561 2.61825 7.33333 2.61825Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2 7.9745C2 7.60631 2.29848 7.30783 2.66667 7.30783H3C3.36819 7.30783 3.66667 7.60631 3.66667 7.9745 3.66667 8.34269 3.36819 8.64117 3 8.64117H2.66667C2.29848 8.64117 2 8.34269 2 7.9745zM8.80482 9.56197C9.06517 9.82232 9.06517 10.2444 8.80482 10.5048L7.94289 11.3667H13.3334C13.7016 11.3667 14.0001 11.6652 14.0001 12.0334 14.0001 12.4016 13.7016 12.7 13.3334 12.7H7.94289L8.80482 13.562C9.06517 13.8223 9.06517 14.2444 8.80482 14.5048 8.54447 14.7651 8.12236 14.7651 7.86201 14.5048L5.86201 12.5048C5.79809 12.4409 5.74987 12.3672 5.71733 12.2886 5.68474 12.21 5.66675 12.1238 5.66675 12.0334 5.66675 11.943 5.68474 11.8568 5.71733 11.7782 5.74987 11.6996 5.79809 11.6259 5.86201 11.562L7.86201 9.56197C8.12236 9.30162 8.54447 9.30162 8.80482 9.56197z" } }] }, Nt = ae(function(e, t) {
1489
- return te(oe, Object.assign({}, e, {
1197
+ dt.displayName = "PercentSingle";
1198
+ const zn = dt;
1199
+ var Wn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5 3.61825C5 2.32958 6.04468 1.28491 7.33333 1.28491C8.62199 1.28491 9.66667 2.32958 9.66667 3.61825V6.30787C9.66667 7.59653 8.62199 8.64121 7.33333 8.64121C6.04468 8.64121 5 7.59653 5 6.30787V3.61825ZM7.33333 2.61825C6.78105 2.61825 6.33333 3.06596 6.33333 3.61825V6.30787C6.33333 6.86015 6.78106 7.30787 7.33333 7.30787C7.88561 7.30787 8.33333 6.86015 8.33333 6.30787V3.61825C8.33333 3.06596 7.88561 2.61825 7.33333 2.61825Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2 7.9745C2 7.60631 2.29848 7.30783 2.66667 7.30783H3C3.36819 7.30783 3.66667 7.60631 3.66667 7.9745 3.66667 8.34269 3.36819 8.64117 3 8.64117H2.66667C2.29848 8.64117 2 8.34269 2 7.9745zM8.80482 9.56197C9.06517 9.82232 9.06517 10.2444 8.80482 10.5048L7.94289 11.3667H13.3334C13.7016 11.3667 14.0001 11.6652 14.0001 12.0334 14.0001 12.4016 13.7016 12.7 13.3334 12.7H7.94289L8.80482 13.562C9.06517 13.8223 9.06517 14.2444 8.80482 14.5048 8.54447 14.7651 8.12236 14.7651 7.86201 14.5048L5.86201 12.5048C5.79809 12.4409 5.74987 12.3672 5.71733 12.2886 5.68474 12.21 5.66675 12.1238 5.66675 12.0334 5.66675 11.943 5.68474 11.8568 5.71733 11.7782 5.74987 11.6996 5.79809 11.6259 5.86201 11.562L7.86201 9.56197C8.12236 9.30162 8.54447 9.30162 8.80482 9.56197z" } }] }, ft = Z(function(e, t) {
1200
+ return B(q, Object.assign({}, e, {
1490
1201
  id: "reduce-digits-single",
1491
1202
  ref: t,
1492
- icon: Er
1203
+ icon: Wn
1493
1204
  }));
1494
1205
  });
1495
- Nt.displayName = "ReduceDigitsSingle";
1496
- const $r = Nt;
1497
- var Ur = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.05443 1.55744C4.34898 1.33653 4.76685 1.39623 4.98776 1.69078L7.99996 5.98276L11.0122 1.69078C11.2331 1.39623 11.6509 1.33653 11.9455 1.55744C12.24 1.77836 12.2997 2.19623 12.0788 2.49078L9.33338 6.42708H12.0788C12.447 6.42708 12.7455 6.72556 12.7455 7.09375C12.7455 7.46194 12.447 7.76042 12.0788 7.76042H8.66659V9.69702H12.3348C12.703 9.69702 13.0015 9.9955 13.0015 10.3637C13.0015 10.7319 12.703 11.0304 12.3348 11.0304H8.66659V13.9091C8.66659 14.2773 8.36811 14.5758 7.99992 14.5758C7.63173 14.5758 7.33325 14.2773 7.33325 13.9091V11.0304H3.66508C3.29689 11.0304 2.99841 10.7319 2.99841 10.3637C2.99841 9.9955 3.29689 9.69702 3.66508 9.69702H7.33325V7.76042H3.92109C3.5529 7.76042 3.25443 7.46194 3.25443 7.09375C3.25443 6.72556 3.5529 6.42708 3.92109 6.42708H6.66653L3.92109 2.49078C3.70018 2.19623 3.75987 1.77836 4.05443 1.55744Z" } }] }, Tt = ae(function(e, t) {
1498
- return te(oe, Object.assign({}, e, {
1206
+ ft.displayName = "ReduceDigitsSingle";
1207
+ const Kn = ft;
1208
+ var Gn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.05443 1.55744C4.34898 1.33653 4.76685 1.39623 4.98776 1.69078L7.99996 5.98276L11.0122 1.69078C11.2331 1.39623 11.6509 1.33653 11.9455 1.55744C12.24 1.77836 12.2997 2.19623 12.0788 2.49078L9.33338 6.42708H12.0788C12.447 6.42708 12.7455 6.72556 12.7455 7.09375C12.7455 7.46194 12.447 7.76042 12.0788 7.76042H8.66659V9.69702H12.3348C12.703 9.69702 13.0015 9.9955 13.0015 10.3637C13.0015 10.7319 12.703 11.0304 12.3348 11.0304H8.66659V13.9091C8.66659 14.2773 8.36811 14.5758 7.99992 14.5758C7.63173 14.5758 7.33325 14.2773 7.33325 13.9091V11.0304H3.66508C3.29689 11.0304 2.99841 10.7319 2.99841 10.3637C2.99841 9.9955 3.29689 9.69702 3.66508 9.69702H7.33325V7.76042H3.92109C3.5529 7.76042 3.25443 7.46194 3.25443 7.09375C3.25443 6.72556 3.5529 6.42708 3.92109 6.42708H6.66653L3.92109 2.49078C3.70018 2.19623 3.75987 1.77836 4.05443 1.55744Z" } }] }, ht = Z(function(e, t) {
1209
+ return B(q, Object.assign({}, e, {
1499
1210
  id: "rmb-single",
1500
1211
  ref: t,
1501
- icon: Ur
1212
+ icon: Gn
1502
1213
  }));
1503
1214
  });
1504
- Tt.displayName = "RmbSingle";
1505
- const Ar = Tt, xe = [
1215
+ ht.displayName = "RmbSingle";
1216
+ const Zn = ht, fe = [
1506
1217
  {
1507
1218
  label: "sheet.numfmt.general",
1508
1219
  pattern: null
@@ -1555,130 +1266,129 @@ const Ar = Tt, xe = [
1555
1266
  label: "sheet.numfmt.moreFmt",
1556
1267
  pattern: ""
1557
1268
  }
1558
- ], Lr = (e) => {
1269
+ ], qn = (e) => {
1559
1270
  var n;
1560
- const t = T(j), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
1561
- return /* @__PURE__ */ p.jsx("span", { className: "more-numfmt-type", children: r });
1562
- }, Vr = () => {
1563
- const e = T(D), t = T(j), r = Mn(), n = T(ee), s = (o) => {
1564
- const c = n.getLast();
1565
- if (!c)
1271
+ const t = T(x), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
1272
+ return /* @__PURE__ */ m.jsx("span", { className: "more-numfmt-type", children: r });
1273
+ }, Yn = () => {
1274
+ const e = T($), t = T(x), r = kt(), n = T(H), s = (o) => {
1275
+ const l = n.getLast();
1276
+ if (!l)
1566
1277
  return;
1567
- const d = r.get(Sn), l = c.range, u = [];
1568
- R.foreach(l, (m, h) => {
1569
- o ? u.push({ row: m, col: h, pattern: o, type: Xe(o) }) : u.push({ row: m, col: h });
1570
- }), e.executeCommand(Q.id, { values: u }), d.focus();
1278
+ const u = r.get(Lt), d = l.range, c = [];
1279
+ E.foreach(d, (h, _) => {
1280
+ o ? c.push({ row: h, col: _, pattern: o, type: pe(o) }) : c.push({ row: h, col: _ });
1281
+ }), e.executeCommand(A.id, { values: c }), u.focus();
1571
1282
  }, i = (o) => {
1572
1283
  if (o === 0)
1573
1284
  s(null);
1574
- else if (o === xe.length - 1)
1575
- e.executeCommand($e.id);
1285
+ else if (o === fe.length - 1)
1286
+ e.executeCommand(ve.id);
1576
1287
  else {
1577
- const c = xe[o];
1578
- c.pattern && s(c.pattern);
1288
+ const l = fe[o];
1289
+ l.pattern && s(l.pattern);
1579
1290
  }
1580
1291
  }, a = 1220;
1581
- return /* @__PURE__ */ p.jsx("div", { className: "more-numfmt-type-options", children: xe.map((o, c) => o === "|" ? /* @__PURE__ */ p.jsx("div", { className: "line m-t-4", onClick: (d) => d.stopPropagation() }, c) : /* @__PURE__ */ p.jsxs(
1292
+ return /* @__PURE__ */ m.jsx("div", { className: "more-numfmt-type-options", children: fe.map((o, l) => o === "|" ? /* @__PURE__ */ m.jsx("div", { className: "line m-t-4", onClick: (u) => u.stopPropagation() }, l) : /* @__PURE__ */ m.jsxs(
1582
1293
  "div",
1583
1294
  {
1584
1295
  className: "option-item m-t-4",
1585
1296
  onClick: () => {
1586
- i(c);
1297
+ i(l);
1587
1298
  },
1588
1299
  children: [
1589
- /* @__PURE__ */ p.jsx("div", { children: t.t(o.label) }),
1590
- /* @__PURE__ */ p.jsx("div", { className: "m-l-26", children: o.pattern ? et(o.pattern || "", a, t.getCurrentLocale()).result : "" })
1300
+ /* @__PURE__ */ m.jsx("div", { children: t.t(o.label) }),
1301
+ /* @__PURE__ */ m.jsx("div", { className: "m-l-26", children: o.pattern ? Le(o.pattern || "", a, t.getCurrentLocale()).result : "" })
1591
1302
  ]
1592
1303
  },
1593
- c
1304
+ l
1594
1305
  )) });
1595
- }, Hr = (e) => {
1306
+ }, Jn = (e) => {
1596
1307
  const t = "icon-rmbSingle";
1597
- return e.register(t, Ar), e.register("MoreDownSingle", Nr), (r) => ({
1308
+ return e.register(t, Zn), e.register("MoreDownSingle", kn), (r) => ({
1598
1309
  icon: t,
1599
- id: Ct.id,
1310
+ id: nt.id,
1600
1311
  title: "sheet.numfmt.currency",
1601
1312
  tooltip: "sheet.numfmt.currency",
1602
- type: pe.BUTTON,
1603
- group: ve.TOOLBAR_FORMULAS_INSERT,
1604
- positions: [ge.TOOLBAR_START],
1605
- hidden$: _e(r, de.SHEET),
1606
- disabled$: fe(r)
1313
+ type: re.BUTTON,
1314
+ group: se.TOOLBAR_FORMULAS_INSERT,
1315
+ positions: [ie.TOOLBAR_START],
1316
+ hidden$: ae(r, j.UNIVER_SHEET),
1317
+ disabled$: ne(r)
1607
1318
  });
1608
- }, kr = (e) => {
1319
+ }, Qn = (e) => {
1609
1320
  const t = "icon-addDigitsSingle";
1610
- return e.register(t, xr), (r) => ({
1321
+ return e.register(t, Hn), (r) => ({
1611
1322
  icon: t,
1612
- id: _t.id,
1323
+ id: et.id,
1613
1324
  title: "sheet.numfmt.addDecimal",
1614
1325
  tooltip: "sheet.numfmt.addDecimal",
1615
- type: pe.BUTTON,
1616
- positions: [ge.TOOLBAR_START],
1617
- group: ve.TOOLBAR_FORMULAS_INSERT,
1618
- hidden$: _e(r, de.SHEET),
1619
- disabled$: fe(r)
1326
+ type: re.BUTTON,
1327
+ positions: [ie.TOOLBAR_START],
1328
+ group: se.TOOLBAR_FORMULAS_INSERT,
1329
+ hidden$: ae(r, j.UNIVER_SHEET),
1330
+ disabled$: ne(r)
1620
1331
  });
1621
- }, Fr = (e) => {
1332
+ }, Xn = (e) => {
1622
1333
  const t = "icon-reduceDigitsSingle";
1623
- return e.register(t, $r), (r) => ({
1334
+ return e.register(t, Kn), (r) => ({
1624
1335
  icon: t,
1625
- id: bt.id,
1336
+ id: rt.id,
1626
1337
  title: "sheet.numfmt.subtractDecimal",
1627
1338
  tooltip: "sheet.numfmt.subtractDecimal",
1628
- type: pe.BUTTON,
1629
- group: ve.TOOLBAR_FORMULAS_INSERT,
1630
- positions: [ge.TOOLBAR_START],
1631
- hidden$: _e(r, de.SHEET),
1632
- disabled$: fe(r)
1339
+ type: re.BUTTON,
1340
+ group: se.TOOLBAR_FORMULAS_INSERT,
1341
+ positions: [ie.TOOLBAR_START],
1342
+ hidden$: ae(r, j.UNIVER_SHEET),
1343
+ disabled$: ne(r)
1633
1344
  });
1634
- }, Br = (e) => {
1345
+ }, er = (e) => {
1635
1346
  const t = "icon-PercentSingle";
1636
- return e.register(t, Dr), (r) => ({
1347
+ return e.register(t, zn), (r) => ({
1637
1348
  icon: t,
1638
- id: Pt.id,
1349
+ id: ot.id,
1639
1350
  title: "sheet.numfmt.percent",
1640
1351
  tooltip: "sheet.numfmt.percent",
1641
- type: pe.BUTTON,
1642
- group: ve.TOOLBAR_FORMULAS_INSERT,
1643
- positions: [ge.TOOLBAR_START],
1644
- hidden$: _e(r, de.SHEET),
1645
- disabled$: fe(r)
1352
+ type: re.BUTTON,
1353
+ group: se.TOOLBAR_FORMULAS_INSERT,
1354
+ positions: [ie.TOOLBAR_START],
1355
+ hidden$: ae(r, j.UNIVER_SHEET),
1356
+ disabled$: ne(r)
1646
1357
  });
1647
- }, zr = (e) => {
1358
+ }, tr = (e) => {
1648
1359
  const t = "sheet.numfmt.moreNumfmtType", r = "sheet.numfmt.moreNumfmtType.options";
1649
- return e.register(t, Lr), e.register(r, Vr), (n) => {
1650
- const s = n.get(U), i = n.get(Pn), a = n.get(E), o = n.get(D), c = n.get(j), d = n.get(ee), l = new Z(
1651
- (u) => Ge(
1652
- d.selectionMoveEnd$,
1653
- new Z((m) => {
1654
- const h = [M.id, x.id], g = o.onCommandExecuted((v) => {
1655
- h.includes(v.id) && m.next(null);
1360
+ return e.register(t, qn), e.register(r, Yn), (n) => {
1361
+ const s = n.get(G), i = n.get(W), a = n.get($), o = n.get(x), l = n.get(H), u = Pt(i, "", ({ workbook: d, worksheet: c }) => new J(
1362
+ (h) => Qe(
1363
+ l.selectionMoveEnd$,
1364
+ new J((_) => {
1365
+ const v = [_e.id, te.id], f = a.onCommandExecuted((p) => {
1366
+ v.includes(p.id) && _.next(null);
1656
1367
  });
1657
- return () => g.dispose();
1368
+ return () => f.dispose();
1658
1369
  })
1659
1370
  ).subscribe(() => {
1660
- const m = d.getSelections();
1661
- if (m && m[0]) {
1662
- const h = a.getCurrentUniverSheetInstance(), g = h.getActiveSheet(), v = m[0].range, f = v.startRow, S = v.startColumn, C = s.getValue(h.getUnitId(), g.getSheetId(), f, S), b = i.getNumfmtValue(h.getUnitId(), g.getSheetId(), f, S), A = (C == null ? void 0 : C.pattern) || b;
1663
- let G = c.t("sheet.numfmt.general");
1664
- if (A) {
1665
- const F = xe.filter((B) => typeof B == "object" && B.pattern).find(
1666
- (B) => Le(A, B.pattern)
1371
+ const _ = l.getSelections();
1372
+ if (_ && _[0]) {
1373
+ const v = _[0].range, f = v.startRow, p = v.startColumn, g = s.getValue(d.getUnitId(), c.getSheetId(), f, p), C = g == null ? void 0 : g.pattern;
1374
+ let R = o.t("sheet.numfmt.general");
1375
+ if (C) {
1376
+ const O = fe.filter((w) => typeof w == "object" && w.pattern).find(
1377
+ (w) => Se(C, w.pattern)
1667
1378
  );
1668
- F && typeof F == "object" && F.pattern ? G = c.t(F.label) : G = c.t("sheet.numfmt.moreFmt");
1379
+ O && typeof O == "object" && O.pattern ? R = o.t(O.label) : R = o.t("sheet.numfmt.moreFmt");
1669
1380
  }
1670
- u.next(G);
1381
+ h.next(R);
1671
1382
  }
1672
1383
  })
1673
- );
1384
+ ));
1674
1385
  return {
1675
- // icon: 'MoreDownSingle',
1676
1386
  label: t,
1677
- id: $e.id,
1387
+ id: ve.id,
1678
1388
  tooltip: "sheet.numfmt.title",
1679
- type: pe.SELECTOR,
1680
- group: ve.TOOLBAR_FORMULAS_INSERT,
1681
- positions: [ge.TOOLBAR_START],
1389
+ type: re.SELECTOR,
1390
+ group: se.TOOLBAR_FORMULAS_INSERT,
1391
+ positions: [ie.TOOLBAR_START],
1682
1392
  selections: [
1683
1393
  {
1684
1394
  label: {
@@ -1687,298 +1397,53 @@ const Ar = Tt, xe = [
1687
1397
  }
1688
1398
  }
1689
1399
  ],
1690
- value$: l,
1691
- hidden$: _e(n, de.SHEET),
1692
- disabled$: fe(n)
1400
+ value$: u,
1401
+ hidden$: ae(n, j.UNIVER_SHEET),
1402
+ disabled$: ne(n)
1693
1403
  };
1694
1404
  };
1695
1405
  };
1696
- var Wr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, Gr = (e, t, r, n) => {
1697
- for (var s = n > 1 ? void 0 : n ? Kr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1406
+ var nr = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, sr = (e, t, r, n) => {
1407
+ for (var s = n > 1 ? void 0 : n ? rr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1698
1408
  (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
1699
- return n && s && Wr(t, r, s), s;
1700
- }, Be = (e, t) => (r, n) => t(r, n, e);
1701
- let je = class extends H {
1409
+ return n && s && nr(t, r, s), s;
1410
+ }, xe = (e, t) => (r, n) => t(r, n, e);
1411
+ let he = class extends X {
1702
1412
  constructor(e, t, r) {
1703
1413
  super(), this._injector = e, this._componentManager = t, this._menuService = r, this._initMenu();
1704
1414
  }
1705
1415
  _initMenu() {
1706
- [Br, kr, Fr, Hr, zr].map((e) => e(this._componentManager)).forEach((e) => {
1416
+ [er, Qn, Xn, Jn, tr].map((e) => e(this._componentManager)).forEach((e) => {
1707
1417
  this.disposeWithMe(this._menuService.addMenuItem(e(this._injector)));
1708
1418
  });
1709
1419
  }
1710
1420
  };
1711
- je = Gr([
1712
- k($.Rendered, je),
1713
- Be(0, _(K)),
1714
- Be(1, _(vt)),
1715
- Be(2, _(bn))
1716
- ], je);
1717
- var Yr = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, qr = (e, t, r, n) => {
1718
- for (var s = n > 1 ? void 0 : n ? Zr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1719
- (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
1720
- return n && s && Yr(t, r, s), s;
1721
- }, se = (e, t) => (r, n) => t(r, n, e);
1722
- const Jr = [x.id, M.id];
1723
- let Ne = class extends H {
1724
- constructor(e, t, r, n, s, i) {
1725
- super(), this._numfmtService = e, this._univerInstanceService = t, this._injector = r, this._refRangeService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._registerRefRange(), this._mergeRefMutations();
1726
- }
1727
- _mergeRefMutations() {
1728
- this._refRangeService.interceptor.intercept(this._refRangeService.interceptor.getInterceptPoints().MERGE_REDO, {
1729
- handler: (e, t, r) => {
1730
- if (!e)
1731
- return r(e);
1732
- const n = e.filter((s) => !Jr.includes(s.id));
1733
- return n.push(...Ee(e)), r(n);
1734
- }
1735
- });
1736
- }
1737
- _registerRefRange() {
1738
- this.disposeWithMe(
1739
- q(
1740
- Ge(
1741
- this._sheetSkeletonManagerService.currentSkeleton$.pipe(
1742
- le((e) => e == null ? void 0 : e.sheetId),
1743
- ft()
1744
- ),
1745
- this._numfmtService.modelReplace$
1746
- ).pipe(
1747
- pt(
1748
- () => new Z((e) => {
1749
- const t = new mt();
1750
- return e.next(t), () => {
1751
- t.dispose();
1752
- };
1753
- })
1754
- )
1755
- ).subscribe((e) => {
1756
- const r = this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(), n = this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), s = this._numfmtService.getModel(r, n), i = /* @__PURE__ */ new Map(), a = (o, c, d) => {
1757
- const l = {
1758
- startRow: c,
1759
- startColumn: d,
1760
- endRow: c,
1761
- endColumn: d
1762
- };
1763
- let u = [];
1764
- switch (o.id) {
1765
- case N.DeleteRangeMoveLeftCommandId: {
1766
- u = an(o, l);
1767
- break;
1768
- }
1769
- case N.DeleteRangeMoveUpCommandId: {
1770
- u = sn(o, l);
1771
- break;
1772
- }
1773
- case N.InsertColCommandId: {
1774
- u = rn(o, l);
1775
- break;
1776
- }
1777
- case N.InsertRangeMoveDownCommandId: {
1778
- u = nn(o, l);
1779
- break;
1780
- }
1781
- case N.InsertRangeMoveRightCommandId: {
1782
- u = tn(o, l);
1783
- break;
1784
- }
1785
- case N.InsertRowCommandId: {
1786
- u = en(o, l);
1787
- break;
1788
- }
1789
- case N.MoveRangeCommandId: {
1790
- u = Xt(o, l);
1791
- break;
1792
- }
1793
- case N.RemoveColCommandId: {
1794
- u = Qt(o, l);
1795
- break;
1796
- }
1797
- case N.RemoveRowCommandId: {
1798
- u = Jt(o, l);
1799
- break;
1800
- }
1801
- case N.MoveColsCommandId: {
1802
- u = qt(o, l);
1803
- break;
1804
- }
1805
- case N.MoveRowsCommandId:
1806
- u = Zt(o, l);
1807
- }
1808
- const m = on(u, l), h = this._numfmtService.getValue(r, n, c, d);
1809
- if (!m && h) {
1810
- const g = {
1811
- id: M.id,
1812
- params: {
1813
- unitId: r,
1814
- subUnitId: n,
1815
- ranges: [{ startColumn: d, startRow: c, endColumn: d, endRow: c }]
1816
- }
1817
- }, v = J(this._injector, g.params);
1818
- return {
1819
- redos: [g],
1820
- undos: v
1821
- };
1822
- }
1823
- if (h && m) {
1824
- const g = [], v = [], f = [
1825
- {
1826
- pattern: h.pattern,
1827
- type: h.type,
1828
- row: m.startRow,
1829
- col: m.startColumn
1830
- }
1831
- ], S = {
1832
- id: x.id,
1833
- params: me(r, n, f)
1834
- }, C = he(this._injector, S.params), b = {
1835
- id: M.id,
1836
- params: {
1837
- unitId: r,
1838
- subUnitId: n,
1839
- ranges: [{ startColumn: d, startRow: c, endColumn: d, endRow: c }]
1840
- }
1841
- }, A = J(this._injector, b.params);
1842
- return g.push(S, b), v.push(...C, ...A), {
1843
- redos: g,
1844
- undos: v.reverse()
1845
- };
1846
- }
1847
- return { redos: [], undos: [] };
1848
- };
1849
- s && s.forValue((o, c) => {
1850
- const d = {
1851
- startRow: o,
1852
- startColumn: c,
1853
- endRow: o,
1854
- endColumn: c
1855
- }, l = this._refRangeService.registerRefRange(
1856
- d,
1857
- (u) => a(u, o, c)
1858
- );
1859
- i.set(`${o}_${c}`, l), e.add(l);
1860
- }), e.add(
1861
- q(
1862
- new Z((o) => {
1863
- e.add(
1864
- this._commandService.onCommandExecuted((c) => {
1865
- [x.id, M.id].includes(c.id) && o.next(c.params);
1866
- })
1867
- );
1868
- }).pipe(
1869
- it(
1870
- (o) => o.unitId === r && o.subUnitId === n
1871
- ),
1872
- le((o) => o.ranges ? o.ranges : o.values ? Object.keys(o.values).reduce((c, d) => {
1873
- const l = o.values[d];
1874
- return c.push(...l.ranges), c;
1875
- }, []) : []),
1876
- gn(300),
1877
- // updating the listener moves to the next queue
1878
- le(
1879
- (o) => o.reduce((c, d) => (c.push(...d), c), [])
1880
- ),
1881
- it((o) => !!o.length)
1882
- ).subscribe((o) => {
1883
- o.forEach((c) => {
1884
- R.foreach(c, (d, l) => {
1885
- const u = `${d}_${l}`, m = i.get(u);
1886
- if (i.delete(u), m && m.dispose(), this._numfmtService.getValue(r, n, d, l)) {
1887
- const g = {
1888
- startRow: d,
1889
- startColumn: l,
1890
- endRow: d,
1891
- endColumn: l
1892
- }, v = this._refRangeService.registerRefRange(
1893
- g,
1894
- (f) => a(f, d, l)
1895
- );
1896
- i.set(u, v), e.add(v);
1897
- }
1898
- });
1899
- });
1900
- })
1901
- )
1902
- );
1903
- })
1904
- )
1905
- );
1906
- }
1907
- };
1908
- Ne = qr([
1909
- k($.Rendered, Ne),
1910
- se(0, _(U)),
1911
- se(1, _(E)),
1912
- se(2, _(K)),
1913
- se(3, _(Yt)),
1914
- se(4, _(Ke)),
1915
- se(5, _(D))
1916
- ], Ne);
1917
- var Qr = Object.defineProperty, Xr = Object.getOwnPropertyDescriptor, es = (e, t, r, n) => {
1918
- for (var s = n > 1 ? void 0 : n ? Xr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1919
- (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
1920
- return n && s && Qr(t, r, s), s;
1921
- }, ye = (e, t) => (r, n) => t(r, n, e);
1922
- let Te = class extends H {
1923
- constructor(e, t, r, n) {
1924
- super(), this._numfmtService = e, this._sheetInterceptorService = t, this._univerInstanceService = r, this._injector = n, this._initSheetChange();
1925
- }
1926
- _initSheetChange() {
1927
- this.disposeWithMe(
1928
- this._sheetInterceptorService.interceptCommand({
1929
- getMutations: (e) => {
1930
- if (e.id === cn.id) {
1931
- const t = e.params, r = t.unitId || ts(this._univerInstanceService), n = t.subUnitId || ns(this._univerInstanceService), s = this._numfmtService.getModel(r, n);
1932
- if (!s)
1933
- return { redos: [], undos: [] };
1934
- const i = [];
1935
- s.forValue((c, d) => {
1936
- i.push({ startColumn: d, endColumn: d, startRow: c, endRow: c });
1937
- });
1938
- const a = {
1939
- unitId: r,
1940
- subUnitId: n,
1941
- ranges: z(i)
1942
- }, o = J(this._injector, a);
1943
- return {
1944
- redos: [{ id: M.id, params: a }],
1945
- undos: o
1946
- };
1947
- }
1948
- return { redos: [], undos: [] };
1949
- }
1950
- })
1951
- );
1952
- }
1953
- };
1954
- Te = es([
1955
- k($.Rendered, Te),
1956
- ye(0, _(U)),
1957
- ye(1, _(Ae)),
1958
- ye(2, _(E)),
1959
- ye(3, _(K))
1960
- ], Te);
1961
- const ts = (e) => e.getCurrentUniverSheetInstance().getUnitId(), ns = (e) => e.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
1962
- var rs = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, is = (e, t, r, n) => {
1963
- for (var s = n > 1 ? void 0 : n ? ss(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1421
+ he = sr([
1422
+ ee(K.Rendered, he),
1423
+ xe(0, S(Pe)),
1424
+ xe(1, S(Je)),
1425
+ xe(2, S(At))
1426
+ ], he);
1427
+ var ir = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, cr = (e, t, r, n) => {
1428
+ for (var s = n > 1 ? void 0 : n ? ar(t, r) : t, i = e.length - 1, a; i >= 0; i--)
1964
1429
  (a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
1965
- return n && s && rs(t, r, s), s;
1966
- }, as = (e, t) => (r, n) => t(r, n, e), ze;
1967
- let lt = (ze = class extends Bt {
1430
+ return n && s && ir(t, r, s), s;
1431
+ }, or = (e, t) => (r, n) => t(r, n, e), oe;
1432
+ let Fe = (oe = class extends Nt {
1968
1433
  constructor(e, t) {
1969
- super(ue), this._injector = t;
1434
+ super(), this._injector = t;
1970
1435
  }
1971
1436
  onStarting() {
1972
- this._injector.add([tt, { useClass: Me, lazy: !1 }]), this._injector.add([Oe]), this._injector.add([Ue]), this._injector.add([Ne]), this._injector.add([Te]), this._injector.add([Pe]), this._injector.add([Re]), this._injector.add([Ie]), this._injector.add([we]), this._injector.add([je]);
1437
+ this._injector.add([Ue, { useClass: ue, lazy: !1 }]), this._injector.add([me]), this._injector.add([ge]), this._injector.add([le]), this._injector.add([de]), this._injector.add([he]);
1973
1438
  }
1974
- }, Y(ze, "type", zt.Sheet), ze);
1975
- lt = is([
1976
- as(1, _(K))
1977
- ], lt);
1439
+ }, U(oe, "pluginName", Ne), U(oe, "type", j.UNIVER_SHEET), oe);
1440
+ Fe = cr([
1441
+ or(1, S(Pe))
1442
+ ], Fe);
1978
1443
  export {
1979
- Q as SetNumfmtCommand,
1980
- lt as UniverSheetsNumfmtPlugin,
1981
- wn as enUS,
1982
- et as getPatternPreview,
1983
- jn as zhCN
1444
+ A as SetNumfmtCommand,
1445
+ Fe as UniverSheetsNumfmtPlugin,
1446
+ zt as enUS,
1447
+ Le as getPatternPreview,
1448
+ Kt as zhCN
1984
1449
  };