@univerjs/sheets-numfmt 0.1.13 → 0.1.14

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,65 +1,65 @@
1
- var ht = Object.defineProperty;
2
- var ft = (e, t, r) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var L = (e, t, r) => (ft(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { CommandType as w, ICommandService as O, IUniverInstanceService as k, IUndoRedoService as pt, sequenceExecute as vt, LocaleType as gt, Disposable as Y, ObjectMatrix as _t, CellValueType as B, Range as P, toDisposable as K, OnLifecycle as q, LifecycleStages as V, ThemeService as Fe, LocaleService as T, runOnLifecycle as St, ILocalStorageService as bt, UniverInstanceType as E, DisposableCollection as yt, Plugin as Ct, Tools as It } from "@univerjs/core";
5
- import { getSheetCommandTarget as Re, transformCellsToRange as We, rangeMerge as Ae, SetNumfmtMutation as J, factorySetNumfmtUndoMutation as Ge, RemoveNumfmtMutation as ge, factoryRemoveNumfmtUndoMutation as ze, INTERCEPTOR_POINT as Ke, SheetInterceptorService as Pe, INumfmtService as H, SelectionManagerService as D, SetRangeValuesCommand as Tt, WorkbookEditablePermission as Z, WorksheetEditPermission as Q, WorksheetSetCellStylePermission as X, RangeProtectionPermissionEditPoint as ee } from "@univerjs/sheets";
6
- import { Inject as S, createIdentifier as Mt, Injector as xe } from "@wendellhu/redi";
7
- import { SheetSkeletonManagerService as Ye, IEditorBridgeService as Nt, getCurrentRangeDisable$ as te, deriveStateFromActiveSheet$ as Et } from "@univerjs/sheets-ui";
8
- import { map as qe, distinctUntilChanged as Rt, switchMap as Pt, tap as xt, debounceTime as Ot } from "rxjs/operators";
1
+ var mt = Object.defineProperty;
2
+ var dt = (e, t, n) => t in e ? mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var ie = (e, t, n) => (dt(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ import { CommandType as w, ICommandService as O, IUniverInstanceService as D, IUndoRedoService as ft, sequenceExecute as ht, LocaleType as pt, Disposable as z, ObjectMatrix as vt, CellValueType as V, Range as R, UniverInstanceType as T, OnLifecycle as K, LifecycleStages as B, ThemeService as He, LocaleService as E, runOnLifecycle as _t, ILocalStorageService as gt, toDisposable as Ie, DisposableCollection as St, Plugin as bt, Tools as yt, DependentOn as Ct } from "@univerjs/core";
5
+ import { getSheetCommandTarget as Me, transformCellsToRange as Fe, rangeMerge as Le, SetNumfmtMutation as Y, factorySetNumfmtUndoMutation as We, RemoveNumfmtMutation as pe, factoryRemoveNumfmtUndoMutation as ke, INTERCEPTOR_POINT as Ge, SheetInterceptorService as Pe, INumfmtService as H, SelectionManagerService as U, SetRangeValuesCommand as Tt, WorkbookEditablePermission as q, WorksheetEditPermission as J, WorksheetSetCellStylePermission as Z, RangeProtectionPermissionEditPoint as Q, UniverSheetsPlugin as It } from "@univerjs/sheets";
6
+ import { Inject as S, createIdentifier as Et, Injector as Re } from "@wendellhu/redi";
7
+ import { SheetSkeletonManagerService as Nt, IEditorBridgeService as Mt, getCurrentRangeDisable$ as X, deriveStateFromActiveSheet$ as Pt, UniverSheetsUIPlugin as Rt } from "@univerjs/sheets-ui";
8
+ import { switchMap as xt, of as Ot, skip as jt, Observable as k, combineLatest as $t, merge as wt } from "rxjs";
9
9
  import x from "@univerjs/engine-numfmt";
10
- import { IRenderManagerService as jt, ITextSelectionRenderManager as $t } from "@univerjs/engine-render";
11
- import { ComponentManager as Je, ISidebarService as wt, MenuItemType as ne, MenuGroup as re, MenuPosition as se, getMenuHiddenObservable as ie, IMenuService as Dt } from "@univerjs/ui";
12
- import { Observable as G, combineLatest as Ut, merge as Ze } from "rxjs";
13
- import Lt, { createContext as At, useState as I, useEffect as Oe, useRef as Qe, useContext as Xe, useMemo as R, createElement as Bt } from "react";
14
- import { InputNumber as je, Select as $e, SelectList as we, Button as Be } from "@univerjs/design";
15
- import { useDependency as N, useInjector as kt } from "@wendellhu/redi/react-bindings";
10
+ import { IRenderManagerService as Dt, ITextSelectionRenderManager as Ut } from "@univerjs/engine-render";
11
+ import { ComponentManager as ze, ISidebarService as Lt, MenuItemType as ee, MenuGroup as te, MenuPosition as ne, getMenuHiddenObservable as se, IMenuService as At } from "@univerjs/ui";
12
+ import { map as Vt, switchMap as Bt, tap as Ht, debounceTime as Ft } from "rxjs/operators";
13
+ import Wt, { createContext as kt, useState as I, useEffect as xe, useRef as Ke, useContext as Ye, useMemo as P, createElement as Gt } from "react";
14
+ import { InputNumber as Oe, Select as je, SelectList as $e, Button as Ae } from "@univerjs/design";
15
+ import { useDependency as N, useInjector as zt } from "@wendellhu/redi/react-bindings";
16
16
  const $ = {
17
17
  id: "sheet.command.numfmt.set.numfmt",
18
18
  type: w.COMMAND,
19
19
  handler: (e, t) => {
20
20
  if (!t)
21
21
  return !1;
22
- const r = e.get(O), n = e.get(k), s = e.get(pt), i = Re(n, t);
22
+ const n = e.get(O), s = e.get(D), r = e.get(ft), i = Me(s, t);
23
23
  if (!i)
24
24
  return !1;
25
- const { unitId: o, subUnitId: a } = i, l = t.values.filter((h) => !!h.pattern), u = t.values.filter((h) => !h.pattern), m = We(o, a, l), c = {
25
+ const { unitId: o, subUnitId: a } = i, l = t.values.filter((f) => !!f.pattern), u = t.values.filter((f) => !f.pattern), m = Fe(o, a, l), c = {
26
26
  unitId: o,
27
27
  subUnitId: a,
28
- ranges: u.map((h) => ({
29
- startColumn: h.col,
30
- startRow: h.row,
31
- endColumn: h.col,
32
- endRow: h.row
28
+ ranges: u.map((f) => ({
29
+ startColumn: f.col,
30
+ startRow: f.row,
31
+ endColumn: f.col,
32
+ endRow: f.row
33
33
  }))
34
- }, f = [], _ = [];
34
+ }, h = [], g = [];
35
35
  if (l.length) {
36
36
  Object.keys(m.values).forEach((p) => {
37
- const v = m.values[p];
38
- v.ranges = Ae(v.ranges);
39
- }), f.push({
40
- id: J.id,
37
+ const _ = m.values[p];
38
+ _.ranges = Le(_.ranges);
39
+ }), h.push({
40
+ id: Y.id,
41
41
  params: m
42
42
  });
43
- const h = Ge(e, m);
44
- _.push(...h);
43
+ const f = We(e, m);
44
+ g.push(...f);
45
45
  }
46
46
  if (u.length) {
47
- c.ranges = Ae(c.ranges), f.push({
48
- id: ge.id,
47
+ c.ranges = Le(c.ranges), h.push({
48
+ id: pe.id,
49
49
  params: c
50
50
  });
51
- const h = ze(e, c);
52
- _.push(...h);
51
+ const f = ke(e, c);
52
+ g.push(...f);
53
53
  }
54
- const g = vt(f, r).result;
55
- return g && s.pushUndoRedo({
54
+ const v = ht(h, n).result;
55
+ return v && r.pushUndoRedo({
56
56
  unitID: o,
57
- undoMutations: _,
58
- redoMutations: f
59
- }), g;
57
+ undoMutations: g,
58
+ redoMutations: h
59
+ }), v;
60
60
  }
61
- }, Ne = "SHEET_NUMFMT_PLUGIN", fe = (e) => x.getInfo(e).type || "unknown", De = (e, t, r) => {
62
- const n = x.getInfo(e), s = r === gt.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], o = x.format(e, t, { locale: s });
61
+ }, Ee = "SHEET_NUMFMT_PLUGIN", me = (e) => x.getInfo(e).type || "unknown", we = (e, t, n) => {
62
+ const s = x.getInfo(e), r = n === pt.ZH_CN ? "zh-CN" : "en", i = s._partitions[1], o = x.format(e, t, { locale: r });
63
63
  return t < 0 ? {
64
64
  result: o,
65
65
  color: i.color
@@ -67,144 +67,139 @@ const $ = {
67
67
  result: o
68
68
  };
69
69
  };
70
- var Vt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Ft = (e, t, r, n) => {
71
- for (var s = n > 1 ? void 0 : n ? Ht(t, r) : t, i = e.length - 1, o; i >= 0; i--)
72
- (o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
73
- return n && s && Vt(t, r, s), s;
74
- }, A = (e, t) => (r, n) => t(r, n, e);
75
- let le = class extends Y {
76
- constructor(e, t, r, n, s, i) {
77
- super(), this._sheetInterceptorService = e, this._themeService = t, this._sheetSkeletonManagerService = r, this._commandService = n, this._numfmtService = s, this._localeService = i, this._initInterceptorCellContent();
70
+ var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, qt = (e, t, n, s) => {
71
+ for (var r = s > 1 ? void 0 : s ? Yt(t, n) : t, i = e.length - 1, o; i >= 0; i--)
72
+ (o = e[i]) && (r = (s ? o(t, n, r) : o(r)) || r);
73
+ return s && r && Kt(t, n, r), r;
74
+ }, A = (e, t) => (n, s) => t(n, s, e);
75
+ let oe = class extends z {
76
+ constructor(e, t, n, s, r, i) {
77
+ super(), this._instanceService = e, this._sheetInterceptorService = t, this._themeService = n, this._commandService = s, this._numfmtService = r, this._localeService = i, this._initInterceptorCellContent();
78
78
  }
79
79
  _initInterceptorCellContent() {
80
- const e = new _t();
81
- this.disposeWithMe(
82
- this._sheetInterceptorService.intercept(Ke.CELL_CONTENT, {
83
- handler: (t, r, n) => {
84
- const s = r.unitId, i = r.subUnitId, o = this._numfmtService.getValue(s, i, r.row, r.col);
85
- if (!o)
86
- return n(t);
87
- const a = t;
88
- if (!a || a.t !== B.NUMBER)
89
- return n(t);
90
- let l = "";
91
- const u = e.getValue(r.row, r.col);
92
- if (u && u.parameters === a.v)
93
- return n({ ...t, ...u.result });
94
- const m = De(o.pattern, Number(a.v), this._localeService.getCurrentLocale());
95
- if (l = m.result, !l)
96
- return n(t);
97
- const c = { v: l };
98
- if (m.color) {
99
- const f = this._themeService.getCurrentTheme()[`${m.color}500`];
100
- f && (c.interceptorStyle = { cl: { rgb: f } });
101
- }
102
- return e.setValue(r.row, r.col, {
103
- result: c,
104
- parameters: a.v
105
- }), n({ ...t, ...c });
106
- },
107
- priority: 10
108
- })
109
- ), this.disposeWithMe(
110
- this._commandService.onCommandExecuted((t) => {
111
- if (t.id === J.id) {
112
- const r = t.params;
113
- Object.keys(r.values).forEach((n) => {
114
- r.values[n].ranges.forEach((i) => {
115
- P.foreach(i, (o, a) => {
116
- e.realDeleteValue(o, a);
117
- });
80
+ const e = new vt();
81
+ this.disposeWithMe(this._sheetInterceptorService.intercept(Ge.CELL_CONTENT, {
82
+ handler: (t, n, s) => {
83
+ const r = n.unitId, i = n.subUnitId, o = this._numfmtService.getValue(r, i, n.row, n.col);
84
+ if (!o)
85
+ return s(t);
86
+ const a = t;
87
+ if (!a || a.t !== V.NUMBER)
88
+ return s(t);
89
+ let l = "";
90
+ const u = e.getValue(n.row, n.col);
91
+ if (u && u.parameters === a.v)
92
+ return s({ ...t, ...u.result });
93
+ const m = we(o.pattern, Number(a.v), this._localeService.getCurrentLocale());
94
+ if (l = m.result, !l)
95
+ return s(t);
96
+ const c = { v: l };
97
+ if (m.color) {
98
+ const h = this._themeService.getCurrentTheme()[`${m.color}500`];
99
+ h && (c.interceptorStyle = { cl: { rgb: h } });
100
+ }
101
+ return e.setValue(n.row, n.col, {
102
+ result: c,
103
+ parameters: a.v
104
+ }), s({ ...t, ...c });
105
+ },
106
+ priority: 10
107
+ })), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
108
+ if (t.id === Y.id) {
109
+ const n = t.params;
110
+ Object.keys(n.values).forEach((s) => {
111
+ n.values[s].ranges.forEach((i) => {
112
+ R.foreach(i, (o, a) => {
113
+ e.realDeleteValue(o, a);
118
114
  });
119
115
  });
120
- }
121
- })
122
- ), this.disposeWithMe(
123
- K(
124
- this._sheetSkeletonManagerService.currentSkeleton$.pipe(
125
- qe((t) => t == null ? void 0 : t.sheetId),
126
- Rt()
127
- ).subscribe(() => {
128
- e.reset();
129
- })
130
- )
116
+ });
117
+ }
118
+ })), this.disposeWithMe(
119
+ this._instanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).pipe(
120
+ xt((t) => {
121
+ var n;
122
+ return (n = t == null ? void 0 : t.activeSheet$) != null ? n : Ot(null);
123
+ }),
124
+ jt(1)
125
+ ).subscribe(() => e.reset())
131
126
  );
132
127
  }
133
128
  };
134
- le = Ft([
135
- q(V.Rendered, le),
136
- A(0, S(Pe)),
137
- A(1, S(Fe)),
138
- A(2, S(Ye)),
129
+ oe = qt([
130
+ K(B.Rendered, oe),
131
+ A(0, D),
132
+ A(1, S(Pe)),
133
+ A(2, S(He)),
139
134
  A(3, S(O)),
140
135
  A(4, S(H)),
141
- A(5, S(T))
142
- ], le);
136
+ A(5, S(E))
137
+ ], oe);
143
138
  const j = (e, t = 0) => {
144
- var n;
145
- return e && (n = x.getInfo(e).maxDecimals) != null ? n : t;
146
- }, _e = (e, t) => {
139
+ var s;
140
+ return e && (s = x.getInfo(e).maxDecimals) != null ? s : t;
141
+ }, ve = (e, t) => {
147
142
  if (e && !t || !e && t)
148
143
  return !1;
149
- const r = (u) => u.reduce(
144
+ const n = (u) => u.reduce(
150
145
  (m, c) => {
151
146
  if (m.isEnd)
152
147
  return m;
153
- const f = c.value || c.num;
154
- return c.type === "point" ? (m.isEnd = !0, m) : { ...m, result: m.result + f };
148
+ const h = c.value || c.num;
149
+ return c.type === "point" ? (m.isEnd = !0, m) : { ...m, result: m.result + h };
155
150
  },
156
151
  { isEnd: !1, result: "" }
157
- ).result, n = x.getInfo(e)._partitions, s = x.getInfo(t)._partitions, i = r(n[0].tokens), o = r(s[0].tokens), a = r(n[1].tokens), l = r(s[1].tokens);
158
- return i === o && a === l && n[1].color === s[1].color;
159
- }, ke = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), C = (e, t) => e.split(";").map((n) => /\.0?/.test(n) ? n.replace(
152
+ ).result, s = x.getInfo(e)._partitions, r = x.getInfo(t)._partitions, i = n(s[0].tokens), o = n(r[0].tokens), a = n(s[1].tokens), l = n(r[1].tokens);
153
+ return i === o && a === l && s[1].color === r[1].color;
154
+ }, Ve = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), C = (e, t) => e.split(";").map((s) => /\.0?/.test(s) ? s.replace(
160
155
  /\.0*/g,
161
- `${t > 0 ? "." : ""}${ke(Number(t || 0))}`
162
- ) : /0([^0]?)|0$/.test(n) ? n.replace(
156
+ `${t > 0 ? "." : ""}${Ve(Number(t || 0))}`
157
+ ) : /0([^0]?)|0$/.test(s) ? s.replace(
163
158
  /0([^0]+)|0$/,
164
- `0${t > 0 ? "." : ""}${ke(Number(t || 0))}$1`
165
- ) : n).join(";"), Wt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), et = {
159
+ `0${t > 0 ? "." : ""}${Ve(Number(t || 0))}$1`
160
+ ) : s).join(";"), Jt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), qe = {
166
161
  id: "sheet.command.numfmt.add.decimal.command",
167
162
  type: w.COMMAND,
168
163
  handler: async (e) => {
169
- const t = e.get(O), r = e.get(D), n = e.get(H), s = e.get(k), i = r.getSelections();
164
+ const t = e.get(O), n = e.get(U), s = e.get(H), r = e.get(D), i = n.getSelections();
170
165
  if (!i || !i.length)
171
166
  return !1;
172
- const o = Re(s);
167
+ const o = Me(r);
173
168
  if (!o)
174
169
  return !1;
175
170
  const { unitId: a, subUnitId: l } = o;
176
171
  let u = 0;
177
- i.forEach((_) => {
178
- P.foreach(_.range, (g, h) => {
179
- const p = n.getValue(a, l, g, h);
172
+ i.forEach((g) => {
173
+ R.foreach(g.range, (v, f) => {
174
+ const p = s.getValue(a, l, v, f);
180
175
  if (!p)
181
176
  return;
182
- const v = j(p.pattern);
183
- u = v > u ? v : u;
177
+ const _ = j(p.pattern);
178
+ u = _ > u ? _ : u;
184
179
  });
185
180
  });
186
- const m = u + 1, c = C(`0${m > 0 ? ".0" : ""}`, m), f = [];
187
- return i.forEach((_) => {
188
- P.foreach(_.range, (g, h) => {
189
- const p = n.getValue(a, l, g, h);
181
+ const m = u + 1, c = C(`0${m > 0 ? ".0" : ""}`, m), h = [];
182
+ return i.forEach((g) => {
183
+ R.foreach(g.range, (v, f) => {
184
+ const p = s.getValue(a, l, v, f);
190
185
  if (!p)
191
- f.push({
192
- row: g,
193
- col: h,
186
+ h.push({
187
+ row: v,
188
+ col: f,
194
189
  pattern: c
195
190
  });
196
191
  else {
197
- const v = j(p.pattern), b = C(p.pattern, v + 1);
198
- b !== p.pattern && f.push({
199
- row: g,
200
- col: h,
192
+ const _ = j(p.pattern), b = C(p.pattern, _ + 1);
193
+ b !== p.pattern && h.push({
194
+ row: v,
195
+ col: f,
201
196
  pattern: b
202
197
  });
203
198
  }
204
199
  });
205
- }), f.length ? await t.executeCommand($.id, { values: f }) : !1;
200
+ }), h.length ? await t.executeCommand($.id, { values: h }) : !1;
206
201
  }
207
- }, Gt = [
202
+ }, Zt = [
208
203
  {
209
204
  label: "1930-08-05",
210
205
  suffix: "yyyy-MM-dd"
@@ -249,7 +244,7 @@ const j = (e, t = 0) => {
249
244
  label: "08-05 下午 01:30",
250
245
  suffix: "MM-dd A/P hh:mm"
251
246
  }
252
- ], zt = [
247
+ ], Qt = [
253
248
  {
254
249
  label: "(1,235)",
255
250
  suffix: "#,##0_);(#,##0)"
@@ -277,7 +272,7 @@ const j = (e, t = 0) => {
277
272
  suffix: "#,##0.00_);[Red]-#,##0.00",
278
273
  color: "red"
279
274
  }
280
- ], tt = [
275
+ ], Je = [
281
276
  {
282
277
  label: (e) => `${e}1,235`,
283
278
  suffix: (e) => `"${e}"#,##0.00_);"${e}"#,##0.00`
@@ -305,77 +300,77 @@ const j = (e, t = 0) => {
305
300
  suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
306
301
  color: "red"
307
302
  }
308
- ], nt = {
303
+ ], Ze = {
309
304
  id: "sheet.command.numfmt.set.currency",
310
305
  type: w.COMMAND,
311
306
  handler: async (e) => {
312
- const t = e.get(O), n = e.get(D).getSelections();
313
- if (!n || !n.length)
307
+ const t = e.get(O), s = e.get(U).getSelections();
308
+ if (!s || !s.length)
314
309
  return !1;
315
- const s = [], i = tt[0].suffix("¥");
316
- return n.forEach((a) => {
317
- P.foreach(a.range, (l, u) => {
318
- s.push({ row: l, col: u, pattern: i, type: "currency" });
310
+ const r = [], i = Je[0].suffix("¥");
311
+ return s.forEach((a) => {
312
+ R.foreach(a.range, (l, u) => {
313
+ r.push({ row: l, col: u, pattern: i, type: "currency" });
319
314
  });
320
- }), await t.executeCommand($.id, { values: s });
315
+ }), await t.executeCommand($.id, { values: r });
321
316
  }
322
- }, rt = {
317
+ }, Qe = {
323
318
  id: "sheet.command.numfmt.subtract.decimal.command",
324
319
  type: w.COMMAND,
325
320
  handler: async (e) => {
326
- const t = e.get(O), r = e.get(D), n = e.get(H), s = e.get(k), i = r.getSelections();
321
+ const t = e.get(O), n = e.get(U), s = e.get(H), r = e.get(D), i = n.getSelections();
327
322
  if (!i || !i.length)
328
323
  return !1;
329
- const o = Re(s);
324
+ const o = Me(r);
330
325
  if (!o)
331
326
  return !1;
332
327
  const { unitId: a, subUnitId: l } = o;
333
328
  let u = 0;
334
- i.forEach((g) => {
335
- P.foreach(g.range, (h, p) => {
336
- const v = n.getValue(a, l, h, p);
337
- if (!v)
329
+ i.forEach((v) => {
330
+ R.foreach(v.range, (f, p) => {
331
+ const _ = s.getValue(a, l, f, p);
332
+ if (!_)
338
333
  return;
339
- const b = j(v.pattern);
334
+ const b = j(_.pattern);
340
335
  u = b > u ? b : u;
341
336
  });
342
337
  });
343
- const m = u - 1, c = C(`0${m > 0 ? ".0" : "."}`, m), f = [];
344
- return i.forEach((g) => {
345
- P.foreach(g.range, (h, p) => {
346
- const v = n.getValue(a, l, h, p);
347
- if (!v)
348
- f.push({
349
- row: h,
338
+ const m = u - 1, c = C(`0${m > 0 ? ".0" : "."}`, m), h = [];
339
+ return i.forEach((v) => {
340
+ R.foreach(v.range, (f, p) => {
341
+ const _ = s.getValue(a, l, f, p);
342
+ if (!_)
343
+ h.push({
344
+ row: f,
350
345
  col: p,
351
346
  pattern: c
352
347
  });
353
348
  else {
354
- const b = j(v.pattern);
355
- f.push({
356
- row: h,
349
+ const b = j(_.pattern);
350
+ h.push({
351
+ row: f,
357
352
  col: p,
358
- pattern: C(v.pattern, b - 1)
353
+ pattern: C(_.pattern, b - 1)
359
354
  });
360
355
  }
361
356
  });
362
- }), await t.executeCommand($.id, { values: f });
357
+ }), await t.executeCommand($.id, { values: h });
363
358
  }
364
- }, Ie = {
359
+ }, ye = {
365
360
  id: "sheet.operation.close.numfmt.panel",
366
361
  type: w.OPERATION,
367
362
  handler: () => (
368
363
  // do nothing,just notify panel is closed
369
364
  !0
370
365
  )
371
- }, Ue = Mt("INumfmtController");
372
- St(V.Rendered, Ue);
373
- const pe = {
366
+ }, De = Et("INumfmtController");
367
+ _t(B.Rendered, De);
368
+ const de = {
374
369
  id: "sheet.operation.open.numfmt.panel",
375
370
  type: w.OPERATION,
376
- handler: (e) => (e.get(Ue).openPanel(), !0)
371
+ handler: (e) => (e.get(De).openPanel(), !0)
377
372
  };
378
- var st = { exports: {} }, Se = {};
373
+ var Xe = { exports: {} }, _e = {};
379
374
  /**
380
375
  * @license React
381
376
  * react-jsx-runtime.production.min.js
@@ -385,23 +380,23 @@ var st = { exports: {} }, Se = {};
385
380
  * This source code is licensed under the MIT license found in the
386
381
  * LICENSE file in the root directory of this source tree.
387
382
  */
388
- var Kt = Lt, Yt = Symbol.for("react.element"), qt = Symbol.for("react.fragment"), Jt = Object.prototype.hasOwnProperty, Zt = Kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Qt = { key: !0, ref: !0, __self: !0, __source: !0 };
389
- function it(e, t, r) {
390
- var n, s = {}, i = null, o = null;
391
- r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (o = t.ref);
392
- for (n in t)
393
- Jt.call(t, n) && !Qt.hasOwnProperty(n) && (s[n] = t[n]);
383
+ var Xt = Wt, en = Symbol.for("react.element"), tn = Symbol.for("react.fragment"), nn = Object.prototype.hasOwnProperty, sn = Xt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, rn = { key: !0, ref: !0, __self: !0, __source: !0 };
384
+ function et(e, t, n) {
385
+ var s, r = {}, i = null, o = null;
386
+ n !== void 0 && (i = "" + n), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (o = t.ref);
387
+ for (s in t)
388
+ nn.call(t, s) && !rn.hasOwnProperty(s) && (r[s] = t[s]);
394
389
  if (e && e.defaultProps)
395
- for (n in t = e.defaultProps, t)
396
- s[n] === void 0 && (s[n] = t[n]);
397
- return { $$typeof: Yt, type: e, key: i, ref: o, props: s, _owner: Zt.current };
390
+ for (s in t = e.defaultProps, t)
391
+ r[s] === void 0 && (r[s] = t[s]);
392
+ return { $$typeof: en, type: e, key: i, ref: o, props: r, _owner: sn.current };
398
393
  }
399
- Se.Fragment = qt;
400
- Se.jsx = it;
401
- Se.jsxs = it;
402
- st.exports = Se;
403
- var d = st.exports;
404
- const Le = At([]), Ee = [
394
+ _e.Fragment = tn;
395
+ _e.jsx = et;
396
+ _e.jsxs = et;
397
+ Xe.exports = _e;
398
+ var d = Xe.exports;
399
+ const Ue = kt([]), Ne = [
405
400
  "$",
406
401
  "£",
407
402
  "¥",
@@ -430,12 +425,12 @@ const Le = At([]), Ee = [
430
425
  "₾",
431
426
  "₿"
432
427
  ];
433
- var Xt = Object.defineProperty, en = Object.getOwnPropertyDescriptor, tn = (e, t, r, n) => {
434
- for (var s = n > 1 ? void 0 : n ? en(t, r) : t, i = e.length - 1, o; i >= 0; i--)
435
- (o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
436
- return n && s && Xt(t, r, s), s;
437
- }, nn = (e, t) => (r, n) => t(r, n, e);
438
- let ve = class {
428
+ var on = Object.defineProperty, cn = Object.getOwnPropertyDescriptor, an = (e, t, n, s) => {
429
+ for (var r = s > 1 ? void 0 : s ? cn(t, n) : t, i = e.length - 1, o; i >= 0; i--)
430
+ (o = e[i]) && (r = (s ? o(t, n, r) : o(r)) || r);
431
+ return s && r && on(t, n, r), r;
432
+ }, ln = (e, t) => (n, s) => t(n, s, e);
433
+ let fe = class {
439
434
  constructor(e) {
440
435
  this._localStorageService = e;
441
436
  }
@@ -443,24 +438,24 @@ let ve = class {
443
438
  return `userHabitController_${e}`;
444
439
  }
445
440
  async addHabit(e, t) {
446
- const r = this._getKey(e);
447
- return this._localStorageService.getItem(r).then((n) => {
448
- n || this._localStorageService.setItem(r, t);
441
+ const n = this._getKey(e);
442
+ return this._localStorageService.getItem(n).then((s) => {
443
+ s || this._localStorageService.setItem(n, t);
449
444
  });
450
445
  }
451
446
  markHabit(e, t) {
452
- const r = this._getKey(e);
453
- this._localStorageService.getItem(r).then((n) => {
454
- if (n) {
455
- const s = n.findIndex((i) => i === t);
456
- s > -1 && n.splice(s, 1), n.unshift(t), this._localStorageService.setItem(r, n);
447
+ const n = this._getKey(e);
448
+ this._localStorageService.getItem(n).then((s) => {
449
+ if (s) {
450
+ const r = s.findIndex((i) => i === t);
451
+ r > -1 && s.splice(r, 1), s.unshift(t), this._localStorageService.setItem(n, s);
457
452
  }
458
453
  });
459
454
  }
460
455
  async getHabit(e, t) {
461
- const r = this._getKey(e), n = await this._localStorageService.getItem(r);
462
- if (t && n) {
463
- const s = n.map((i, o, a) => {
456
+ const n = this._getKey(e), s = await this._localStorageService.getItem(n);
457
+ if (t && s) {
458
+ const r = s.map((i, o, a) => {
464
459
  const l = a.length;
465
460
  return {
466
461
  value: i,
@@ -469,101 +464,101 @@ let ve = class {
469
464
  });
470
465
  return t.sort((i, o) => {
471
466
  var u, m;
472
- const a = ((u = s.find((c) => c.value === i)) == null ? void 0 : u.priority) || -1;
473
- return (((m = s.find((c) => c.value === o)) == null ? void 0 : m.priority) || -1) - a;
467
+ const a = ((u = r.find((c) => c.value === i)) == null ? void 0 : u.priority) || -1;
468
+ return (((m = r.find((c) => c.value === o)) == null ? void 0 : m.priority) || -1) - a;
474
469
  });
475
470
  }
476
- return n || [];
471
+ return s || [];
477
472
  }
478
473
  deleteHabit(e) {
479
474
  this._localStorageService.removeItem(e);
480
475
  }
481
476
  };
482
- ve = tn([
483
- nn(0, S(bt))
484
- ], ve);
485
- const Ve = "numfmtCurrency", rn = (e) => {
486
- const t = N(ve), [r, n] = I(Ee);
487
- return Oe(() => {
477
+ fe = an([
478
+ ln(0, S(gt))
479
+ ], fe);
480
+ const Be = "numfmtCurrency", un = (e) => {
481
+ const t = N(fe), [n, s] = I(Ne);
482
+ return xe(() => {
488
483
  t.addHabit("numfmtCurrency", []).then(() => {
489
- t.getHabit(Ve, [...Ee]).then((i) => {
490
- n(i), e && e(i);
484
+ t.getHabit(Be, [...Ne]).then((i) => {
485
+ s(i), e && e(i);
491
486
  });
492
487
  });
493
- }, []), { userHabitCurrency: r, mark: (i) => {
494
- t.markHabit(Ve, i);
488
+ }, []), { userHabitCurrency: n, mark: (i) => {
489
+ t.markHabit(Be, i);
495
490
  } };
496
- }, sn = () => {
497
- const e = Qe([]), [t, r] = I({});
498
- return Oe(() => {
499
- e.current.forEach((s) => {
500
- s();
491
+ }, mn = () => {
492
+ const e = Ke([]), [t, n] = I({});
493
+ return xe(() => {
494
+ e.current.forEach((r) => {
495
+ r();
501
496
  }), e.current = [];
502
- }, [t]), (s) => {
503
- e.current.push(s), r({});
497
+ }, [t]), (r) => {
498
+ e.current.push(r), n({});
504
499
  };
505
- }, oe = (e) => Ee.find((r) => e.includes(r)), on = (e) => !!oe(e) && e.startsWith("_("), cn = (e) => {
506
- const [t, r] = I(() => j(e.defaultPattern || "", 2)), n = Xe(Le), [s, i] = I(() => oe(e.defaultPattern) || n[0]), o = R(() => n.map((c) => ({ label: c, value: c })), []), l = N(T).t;
507
- e.action.current = () => C(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
500
+ }, re = (e) => Ne.find((n) => e.includes(n)), dn = (e) => !!re(e) && e.startsWith("_("), fn = (e) => {
501
+ const [t, n] = I(() => j(e.defaultPattern || "", 2)), s = Ye(Ue), [r, i] = I(() => re(e.defaultPattern) || s[0]), o = P(() => s.map((c) => ({ label: c, value: c })), []), l = N(E).t;
502
+ e.action.current = () => C(`_("${r}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
508
503
  const u = (c) => {
509
504
  i(c), e.onChange(C(`_("${c}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
510
505
  }, m = (c) => {
511
- const f = c || 0;
512
- r(f), e.onChange(C(`_("${s}"* #,##0${f > 0 ? ".0" : ""}_)`, f));
506
+ const h = c || 0;
507
+ n(h), e.onChange(C(`_("${r}"* #,##0${h > 0 ? ".0" : ""}_)`, h));
513
508
  };
514
509
  return /* @__PURE__ */ d.jsxs("div", { children: [
515
510
  /* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
516
511
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
517
512
  /* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.decimalLength") }),
518
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(je, { value: t, max: 20, min: 0, onChange: m }) })
513
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Oe, { value: t, max: 20, min: 0, onChange: m }) })
519
514
  ] }),
520
515
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
521
516
  /* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.currencyType") }),
522
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx($e, { onChange: u, options: o, value: s }) })
517
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange: u, options: o, value: r }) })
523
518
  ] })
524
519
  ] }),
525
520
  /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: l("sheet.numfmt.accountingDes") })
526
521
  ] });
527
- }, Te = (e) => tt.map((t) => ({
522
+ }, Ce = (e) => Je.map((t) => ({
528
523
  label: t.label(e),
529
524
  value: t.suffix(e),
530
525
  color: t.color
531
- })), ot = () => Gt.map((e) => ({ label: e.label, value: e.suffix })), ct = () => zt.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), an = (e) => !!oe(e) && !e.startsWith("_("), ln = (e) => {
532
- const r = N(T).t, n = Xe(Le), [s, i] = I(() => oe(e.defaultPattern) || n[0]), [o, a] = I(() => j(e.defaultPattern || "", 2)), [l, u] = I(() => {
533
- var v;
534
- const h = Te(s);
535
- return ((v = h.find((b) => _e(b.value, e.defaultPattern))) == null ? void 0 : v.value) || h[0].value;
536
- }), m = R(() => Te(s), [s]), c = R(() => n.map((h) => ({ label: h, value: h })), [n]);
526
+ })), tt = () => Zt.map((e) => ({ label: e.label, value: e.suffix })), nt = () => Qt.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), hn = (e) => !!re(e) && !e.startsWith("_("), pn = (e) => {
527
+ const n = N(E).t, s = Ye(Ue), [r, i] = I(() => re(e.defaultPattern) || s[0]), [o, a] = I(() => j(e.defaultPattern || "", 2)), [l, u] = I(() => {
528
+ var _;
529
+ const f = Ce(r);
530
+ return ((_ = f.find((b) => ve(b.value, e.defaultPattern))) == null ? void 0 : _.value) || f[0].value;
531
+ }), m = P(() => Ce(r), [r]), c = P(() => s.map((f) => ({ label: f, value: f })), [s]);
537
532
  e.action.current = () => C(l, o);
538
- const f = (h) => {
539
- i(h);
540
- const p = Te(h)[0].value;
533
+ const h = (f) => {
534
+ i(f);
535
+ const p = Ce(f)[0].value;
541
536
  u(p), e.onChange(C(p, o));
542
- }, _ = (h) => {
543
- u(h), e.onChange(C(h, o));
544
- }, g = (h) => {
545
- a(h || 0), e.onChange(C(l, h || 0));
537
+ }, g = (f) => {
538
+ u(f), e.onChange(C(f, o));
539
+ }, v = (f) => {
540
+ a(f || 0), e.onChange(C(l, f || 0));
546
541
  };
547
542
  return /* @__PURE__ */ d.jsxs("div", { children: [
548
543
  /* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
549
544
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
550
- /* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
551
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(je, { value: o, max: 20, min: 0, onChange: g }) })
545
+ /* @__PURE__ */ d.jsx("div", { className: "label", children: n("sheet.numfmt.decimalLength") }),
546
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Oe, { value: o, max: 20, min: 0, onChange: v }) })
552
547
  ] }),
553
548
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
554
- /* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
555
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx($e, { onChange: f, options: c, value: s }) })
549
+ /* @__PURE__ */ d.jsx("div", { className: "label", children: n("sheet.numfmt.currencyType") }),
550
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange: h, options: c, value: r }) })
556
551
  ] })
557
552
  ] }),
558
- /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
559
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: _, options: m, value: l }) }),
560
- /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
553
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.negType") }),
554
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: g, options: m, value: l }) }),
555
+ /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.currencyDes") })
561
556
  ] });
562
- }, un = (e) => {
557
+ }, vn = (e) => {
563
558
  const t = x.getInfo(e);
564
- return ot().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
565
- }, mn = (e) => {
566
- const t = R(ot, []), n = N(T).t, [s, i] = I(() => {
559
+ return tt().map((n) => n.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
560
+ }, _n = (e) => {
561
+ const t = P(tt, []), s = N(E).t, [r, i] = I(() => {
567
562
  if (e.defaultPattern) {
568
563
  const a = t.find((l) => l.value === e.defaultPattern);
569
564
  if (a)
@@ -571,34 +566,34 @@ const Ve = "numfmtCurrency", rn = (e) => {
571
566
  }
572
567
  return t[0].value;
573
568
  });
574
- e.action.current = () => s;
569
+ e.action.current = () => r;
575
570
  const o = (a) => {
576
571
  i(a), e.onChange(a);
577
572
  };
578
573
  return /* @__PURE__ */ d.jsxs("div", { children: [
579
- /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
580
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { value: s, options: t, onChange: o }) }),
581
- /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
574
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: s("sheet.numfmt.dateType") }),
575
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { value: r, options: t, onChange: o }) }),
576
+ /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: s("sheet.numfmt.dateDes") })
582
577
  ] });
583
- }, dn = (e) => !e, hn = (e) => {
584
- const r = N(T).t;
585
- return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
586
- }, fn = (e) => ct().some((t) => _e(t.value, e)), pn = (e) => {
587
- const t = N(T), r = R(ct, []), [n, s] = I(() => j(e.defaultPattern || "", 0)), [i, o] = I(() => {
588
- const c = r.find((f) => _e(f.value, e.defaultPattern || ""));
589
- return (c == null ? void 0 : c.value) || r[0].value;
590
- }), a = R(() => C(i, Number(n || 0)), [i, n]), l = R(() => !Wt(i), [i]), u = (c) => {
591
- s(c || 0), e.onChange(C(i, Number(c || 0)));
578
+ }, gn = (e) => !e, Sn = (e) => {
579
+ const n = N(E).t;
580
+ return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.generalDes") }) });
581
+ }, bn = (e) => nt().some((t) => ve(t.value, e)), yn = (e) => {
582
+ const t = N(E), n = P(nt, []), [s, r] = I(() => j(e.defaultPattern || "", 0)), [i, o] = I(() => {
583
+ const c = n.find((h) => ve(h.value, e.defaultPattern || ""));
584
+ return (c == null ? void 0 : c.value) || n[0].value;
585
+ }), a = P(() => C(i, Number(s || 0)), [i, s]), l = P(() => !Jt(i), [i]), u = (c) => {
586
+ r(c || 0), e.onChange(C(i, Number(c || 0)));
592
587
  }, m = (c) => {
593
- s(j(c, 0)), o(c), e.onChange(c);
588
+ r(j(c, 0)), o(c), e.onChange(c);
594
589
  };
595
590
  return e.action.current = () => a, /* @__PURE__ */ d.jsxs("div", { children: [
596
591
  /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
597
592
  /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
598
- je,
593
+ Oe,
599
594
  {
600
595
  disabled: l,
601
- value: n,
596
+ value: s,
602
597
  max: 20,
603
598
  min: 0,
604
599
  onChange: u
@@ -608,79 +603,79 @@ const Ve = "numfmtCurrency", rn = (e) => {
608
603
  " ",
609
604
  t.t("sheet.numfmt.negType")
610
605
  ] }),
611
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: m, options: r, value: i }) }),
606
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: m, options: n, value: i }) }),
612
607
  /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
613
608
  ] });
614
- }, vn = (e) => {
615
- const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(T), o = Qe(() => ""), a = i.t, l = sn(), u = R(
609
+ }, Cn = (e) => {
610
+ const { defaultValue: t, defaultPattern: n, row: s, col: r } = e.value, i = N(E), o = Ke(() => ""), a = i.t, l = mn(), u = P(
616
611
  () => [
617
- { label: "sheet.numfmt.general", component: hn },
618
- { label: "sheet.numfmt.accounting", component: cn },
619
- { label: "sheet.numfmt.currency", component: ln },
620
- { label: "sheet.numfmt.date", component: mn },
621
- { label: "sheet.numfmt.thousandthPercentile", component: pn }
612
+ { label: "sheet.numfmt.general", component: Sn },
613
+ { label: "sheet.numfmt.accounting", component: fn },
614
+ { label: "sheet.numfmt.currency", component: pn },
615
+ { label: "sheet.numfmt.date", component: _n },
616
+ { label: "sheet.numfmt.thousandthPercentile", component: yn }
622
617
  ].map((y) => ({ ...y, label: a(y.label) })),
623
618
  []
624
- ), [m, c] = I(v), [f, _] = I(() => `${n}_${s}`), { mark: g, userHabitCurrency: h } = rn(() => _(`${n}_${s}_userCurrency'`)), p = R(() => {
619
+ ), [m, c] = I(_), [h, g] = I(() => `${s}_${r}`), { mark: v, userHabitCurrency: f } = un(() => g(`${s}_${r}_userCurrency'`)), p = P(() => {
625
620
  var y;
626
- return (y = u.find((U) => U.label === m)) == null ? void 0 : y.component;
621
+ return (y = u.find((L) => L.label === m)) == null ? void 0 : y.component;
627
622
  }, [m]);
628
- function v() {
629
- return [dn, on, an, un, fn].reduce((U, mt, dt) => U || (mt(r) ? u[dt].label : ""), "") || u[0].label;
623
+ function _() {
624
+ return [gn, dn, hn, vn, bn].reduce((L, lt, ut) => L || (lt(n) ? u[ut].label : ""), "") || u[0].label;
630
625
  }
631
626
  const b = u.map((y) => ({
632
627
  label: y.label,
633
628
  value: y.label
634
629
  })), F = (y) => {
635
630
  c(y), l(() => e.onChange({ type: "change", value: o.current() || "" }));
636
- }, ce = (y) => {
631
+ }, ge = (y) => {
637
632
  e.onChange({ type: "change", value: y });
633
+ }, Se = () => {
634
+ const y = o.current() || "", L = re(y);
635
+ L && v(L), e.onChange({ type: "confirm", value: y });
638
636
  }, be = () => {
639
- const y = o.current() || "", U = oe(y);
640
- U && g(U), e.onChange({ type: "confirm", value: y });
641
- }, ye = () => {
642
637
  e.onChange({ type: "cancel", value: "" });
643
- }, Ce = {
644
- onChange: ce,
638
+ }, at = {
639
+ onChange: ge,
645
640
  defaultValue: t,
646
- defaultPattern: r,
641
+ defaultPattern: n,
647
642
  action: o
648
643
  };
649
- return Oe(() => {
650
- c(v()), _(`${n}_${s}`);
651
- }, [n, s]), /* @__PURE__ */ d.jsxs("div", { className: "numfmt-panel p-b-20", children: [
644
+ return xe(() => {
645
+ c(_()), g(`${s}_${r}`);
646
+ }, [s, r]), /* @__PURE__ */ d.jsxs("div", { className: "numfmt-panel p-b-20", children: [
652
647
  /* @__PURE__ */ d.jsxs("div", { children: [
653
648
  /* @__PURE__ */ d.jsx("div", { className: "label m-t-14", children: a("sheet.numfmt.numfmtType") }),
654
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: F, options: b, value: m }) }),
655
- /* @__PURE__ */ d.jsx("div", { children: p && /* @__PURE__ */ d.jsx(Le.Provider, { value: h, children: /* @__PURE__ */ Bt(p, { ...Ce, key: f }) }) })
649
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(je, { onChange: F, options: b, value: m }) }),
650
+ /* @__PURE__ */ d.jsx("div", { children: p && /* @__PURE__ */ d.jsx(Ue.Provider, { value: f, children: /* @__PURE__ */ Gt(p, { ...at, key: h }) }) })
656
651
  ] }),
657
652
  /* @__PURE__ */ d.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
658
- /* @__PURE__ */ d.jsx(Be, { size: "small", onClick: ye, className: "m-r-12", children: a("sheet.numfmt.cancel") }),
659
- /* @__PURE__ */ d.jsx(Be, { type: "primary", size: "small", onClick: be, children: a("sheet.numfmt.confirm") })
653
+ /* @__PURE__ */ d.jsx(Ae, { size: "small", onClick: be, className: "m-r-12", children: a("sheet.numfmt.cancel") }),
654
+ /* @__PURE__ */ d.jsx(Ae, { type: "primary", size: "small", onClick: Se, children: a("sheet.numfmt.confirm") })
660
655
  ] })
661
656
  ] });
662
- }, at = {
657
+ }, st = {
663
658
  id: "sheet.command.numfmt.set.percent",
664
659
  type: w.COMMAND,
665
660
  handler: async (e) => {
666
- const t = e.get(O), n = e.get(D).getSelections();
667
- if (!n || !n.length)
661
+ const t = e.get(O), s = e.get(U).getSelections();
662
+ if (!s || !s.length)
668
663
  return !1;
669
- const s = [], i = "0%";
670
- return n.forEach((a) => {
671
- P.foreach(a.range, (l, u) => {
672
- s.push({ row: l, col: u, pattern: i, type: "percent" });
664
+ const r = [], i = "0%";
665
+ return s.forEach((a) => {
666
+ R.foreach(a.range, (l, u) => {
667
+ r.push({ row: l, col: u, pattern: i, type: "percent" });
673
668
  });
674
- }), await t.executeCommand($.id, { values: s });
669
+ }), await t.executeCommand($.id, { values: r });
675
670
  }
676
671
  };
677
- var gn = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, Sn = (e, t, r, n) => {
678
- for (var s = n > 1 ? void 0 : n ? _n(t, r) : t, i = e.length - 1, o; i >= 0; i--)
679
- (o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
680
- return n && s && gn(t, r, s), s;
681
- }, M = (e, t) => (r, n) => t(r, n, e);
682
- let ue = class extends Y {
683
- constructor(t, r, n, s, i, o, a, l, u, m, c) {
672
+ var Tn = Object.defineProperty, In = Object.getOwnPropertyDescriptor, En = (e, t, n, s) => {
673
+ for (var r = s > 1 ? void 0 : s ? In(t, n) : t, i = e.length - 1, o; i >= 0; i--)
674
+ (o = e[i]) && (r = (s ? o(t, n, r) : o(r)) || r);
675
+ return s && r && Tn(t, n, r), r;
676
+ }, M = (e, t) => (n, s) => t(n, s, e);
677
+ let ce = class extends z {
678
+ constructor(t, n, s, r, i, o, a, l, u, m) {
684
679
  super();
685
680
  /**
686
681
  * If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
@@ -688,129 +683,134 @@ let ue = class extends Y {
688
683
  * @type {(string | null)}
689
684
  * @memberof NumfmtController
690
685
  */
691
- L(this, "_previewPattern", "");
692
- L(this, "_sidebarDisposable", null);
693
- this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._selectionManagerService = o, this._renderManagerService = a, this._numfmtService = l, this._componentManager = u, this._sidebarService = m, this._localeService = c, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener();
686
+ ie(this, "_previewPattern", "");
687
+ ie(this, "_sidebarDisposable", null);
688
+ this._sheetInterceptorService = t, this._themeService = n, this._univerInstanceService = s, this._commandService = r, this._selectionManagerService = i, this._renderManagerService = o, this._numfmtService = a, this._componentManager = l, this._sidebarService = u, this._localeService = m, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener();
694
689
  }
695
690
  openPanel() {
696
- const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService, l = (r.getSelectionRanges() || [])[0];
691
+ const t = this._sidebarService, n = this._selectionManagerService, s = this._commandService, r = this._univerInstanceService, i = this._numfmtService, o = this._localeService, l = (n.getSelectionRanges() || [])[0];
697
692
  if (!l)
698
693
  return !1;
699
- const u = s.getCurrentUnitForType(E.UNIVER_SHEET), m = u.getActiveSheet(), c = m.getCellRaw(l.startRow, l.startColumn), f = i.getValue(
694
+ const u = r.getCurrentUnitForType(T.UNIVER_SHEET), m = u.getActiveSheet(), c = m.getCellRaw(l.startRow, l.startColumn), h = i.getValue(
700
695
  u.getUnitId(),
701
696
  m.getSheetId(),
702
697
  l.startRow,
703
698
  l.startColumn
704
699
  );
705
- let _ = "";
706
- f && (_ = f.pattern);
707
- const g = (c == null ? void 0 : c.t) === B.NUMBER ? c.v : 12345678, h = {
700
+ let g = "";
701
+ h && (g = h.pattern);
702
+ const v = (c == null ? void 0 : c.t) === V.NUMBER ? c.v : 12345678, f = {
708
703
  onChange: (p) => {
709
- var v, b;
710
704
  if (p.type === "change")
711
- this._previewPattern = p.value, this._sheetSkeletonManagerService.reCalculate(), (b = (v = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : v.mainComponent) == null || b.makeDirty();
705
+ this._previewPattern = p.value, this._forceUpdate();
712
706
  else if (p.type === "confirm") {
713
- const F = r.getSelectionRanges() || [], ce = { values: [] }, be = fe(p.value);
714
- F.forEach((ye) => {
715
- P.foreach(ye, (Ce, y) => {
716
- ce.values.push({
717
- row: Ce,
718
- col: y,
707
+ const _ = n.getSelectionRanges() || [], b = { values: [] }, F = me(p.value);
708
+ _.forEach((ge) => {
709
+ R.foreach(ge, (Se, be) => {
710
+ b.values.push({
711
+ row: Se,
712
+ col: be,
719
713
  pattern: p.value,
720
- type: be
714
+ type: F
721
715
  });
722
716
  });
723
- }), n.executeCommand($.id, ce), t.close();
717
+ }), s.executeCommand($.id, b), t.close();
724
718
  } else
725
719
  p.type === "cancel" && t.close();
726
720
  },
727
- value: { defaultPattern: _, defaultValue: g, row: l.startRow, col: l.startColumn }
721
+ value: { defaultPattern: g, defaultValue: v, row: l.startRow, col: l.startColumn }
728
722
  };
729
723
  return this._sidebarDisposable = t.open({
730
724
  header: { title: o.t("sheet.numfmt.title") },
731
725
  children: {
732
- label: Ne,
733
- ...h
726
+ label: Ee,
727
+ ...f
734
728
  // need passthrough to react props.
735
729
  },
736
730
  onClose: () => {
737
- var p, v;
738
- this._sheetSkeletonManagerService.reCalculate(), (v = (p = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : p.mainComponent) == null || v.makeDirty(), n.executeCommand(Ie.id);
731
+ this._forceUpdate(), s.executeCommand(ye.id);
739
732
  }
740
733
  }), !0;
741
734
  }
735
+ _forceUpdate(t) {
736
+ var s;
737
+ const n = this._renderManagerService.getRenderById(
738
+ t != null ? t : this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId()
739
+ );
740
+ n == null || n.with(Nt).reCalculate(), (s = n == null ? void 0 : n.mainComponent) == null || s.makeDirty();
741
+ }
742
742
  _initCommands() {
743
743
  [
744
- et,
745
- rt,
746
- nt,
747
- at,
748
- pe,
749
- Ie,
744
+ qe,
745
+ Qe,
746
+ Ze,
747
+ st,
748
+ de,
749
+ ye,
750
750
  $
751
751
  ].forEach((t) => {
752
752
  this.disposeWithMe(this._commandService.registerCommand(t));
753
753
  });
754
754
  }
755
755
  _initPanel() {
756
- this._componentManager.register(Ne, vn);
756
+ this._componentManager.register(Ee, Cn);
757
757
  }
758
758
  _initRealTimeRenderingInterceptor() {
759
- const t = new G((n) => {
760
- this._commandService.onCommandExecuted((s) => {
761
- s.id === pe.id && n.next(!0), s.id === Ie.id && n.next(!1);
759
+ const t = new k((s) => {
760
+ this._commandService.onCommandExecuted((r) => {
761
+ r.id === de.id && s.next(!0), r.id === ye.id && s.next(!1);
762
762
  });
763
- }), r = Ut([
763
+ }), n = $t([
764
764
  t,
765
765
  this._selectionManagerService.selectionMoveEnd$.pipe(
766
- qe((n) => n ? n.map((s) => s.range) : [])
766
+ Vt((s) => s ? s.map((r) => r.range) : [])
767
767
  )
768
768
  ]);
769
769
  this.disposeWithMe(
770
- K(
771
- r.pipe(
772
- Pt(
773
- ([n, s]) => new G((i) => {
774
- const o = new yt();
775
- return n && s.length && i.next({ selectionRanges: s, disposableCollection: o }), () => {
770
+ Ie(
771
+ n.pipe(
772
+ Bt(
773
+ ([s, r]) => new k((i) => {
774
+ const o = new St();
775
+ return s && r.length && i.next({ selectionRanges: r, disposableCollection: o }), () => {
776
776
  o.dispose();
777
777
  };
778
778
  })
779
779
  ),
780
- xt(() => {
780
+ Ht(() => {
781
781
  this._previewPattern = null;
782
782
  })
783
- ).subscribe(({ disposableCollection: n, selectionRanges: s }) => {
783
+ ).subscribe(({ disposableCollection: s, selectionRanges: r }) => {
784
784
  var o, a;
785
- const i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
786
- this.openPanel(), n.add(
787
- this._sheetInterceptorService.intercept(Ke.CELL_CONTENT, {
785
+ const i = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
786
+ this.openPanel(), s.add(
787
+ this._sheetInterceptorService.intercept(Ge.CELL_CONTENT, {
788
788
  priority: 99,
789
789
  handler: (l, u, m) => {
790
- const { row: c, col: f } = u, _ = m(l) || {};
791
- if (s.find(
792
- (g) => g.startColumn <= f && g.endColumn >= f && g.startRow <= c && g.endRow >= c
790
+ const { row: c, col: h } = u, g = m(l) || {};
791
+ if (r.find(
792
+ (v) => v.startColumn <= h && v.endColumn >= h && v.startRow <= c && v.endRow >= c
793
793
  )) {
794
- const g = u.worksheet.getCellRaw(c, f), h = g == null ? void 0 : g.v, p = g == null ? void 0 : g.t;
795
- if (h == null || p !== B.NUMBER || this._previewPattern === null)
796
- return _;
797
- const v = De(this._previewPattern, h, this._localeService.getCurrentLocale());
798
- if (v.color) {
799
- const F = this._themeService.getCurrentTheme()[`${v.color}500`];
794
+ const v = u.worksheet.getCellRaw(c, h), f = v == null ? void 0 : v.v, p = v == null ? void 0 : v.t;
795
+ if (f == null || p !== V.NUMBER || this._previewPattern === null)
796
+ return g;
797
+ const _ = we(this._previewPattern, f, this._localeService.getCurrentLocale());
798
+ if (_.color) {
799
+ const F = this._themeService.getCurrentTheme()[`${_.color}500`];
800
800
  return {
801
- ..._,
802
- v: v.result,
803
- t: B.STRING,
801
+ ...g,
802
+ v: _.result,
803
+ t: V.STRING,
804
804
  s: { cl: { rgb: F } }
805
805
  };
806
806
  }
807
807
  return {
808
- ..._,
809
- v: v.result,
810
- t: B.STRING
808
+ ...g,
809
+ v: _.result,
810
+ t: V.STRING
811
811
  };
812
812
  }
813
- return _;
813
+ return g;
814
814
  }
815
815
  })
816
816
  ), (a = (o = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : o.mainComponent) == null || a.makeDirty();
@@ -819,99 +819,89 @@ let ue = class extends Y {
819
819
  );
820
820
  }
821
821
  _commandExecutedListener() {
822
- const t = [ge.id, J.id];
822
+ const t = [pe.id, Y.id];
823
823
  this.disposeWithMe(
824
- K(
825
- Ze(
826
- new G((r) => {
827
- const n = this._commandService.onCommandExecuted((s) => {
828
- if (t.includes(s.id)) {
829
- const i = s.params;
830
- r.next(i.unitId);
831
- }
832
- });
833
- return () => {
834
- n.dispose();
835
- };
836
- })
837
- ).pipe(Ot(16)).subscribe((r) => {
838
- var n, s;
839
- this._sheetSkeletonManagerService.reCalculate(), (s = (n = this._renderManagerService.getRenderById(r)) == null ? void 0 : n.mainComponent) == null || s.makeDirty();
840
- })
841
- )
824
+ new k((n) => {
825
+ const s = this._commandService.onCommandExecuted((r) => {
826
+ if (t.includes(r.id)) {
827
+ const i = r.params;
828
+ n.next(i.unitId);
829
+ }
830
+ });
831
+ return () => s.dispose();
832
+ }).pipe(Ft(16)).subscribe((n) => this._forceUpdate(n))
842
833
  );
843
834
  }
844
835
  _initCloseListener() {
845
- this._univerInstanceService.getCurrentTypeOfUnit$(E.UNIVER_SHEET).subscribe((t) => {
846
- var r;
847
- t || ((r = this._sidebarDisposable) == null || r.dispose(), this._sidebarDisposable = null);
836
+ this._univerInstanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).subscribe((t) => {
837
+ var n;
838
+ t || ((n = this._sidebarDisposable) == null || n.dispose(), this._sidebarDisposable = null);
848
839
  });
849
840
  }
850
841
  };
851
- ue = Sn([
852
- q(V.Rendered, ue),
842
+ ce = En([
843
+ K(B.Rendered, ce),
853
844
  M(0, S(Pe)),
854
- M(1, S(Fe)),
855
- M(2, k),
856
- M(3, S(Ye)),
857
- M(4, O),
858
- M(5, S(D)),
859
- M(6, jt),
860
- M(7, H),
861
- M(8, S(Je)),
862
- M(9, wt),
863
- M(10, S(T))
864
- ], ue);
865
- var bn = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, Cn = (e, t, r, n) => {
866
- for (var s = n > 1 ? void 0 : n ? yn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
867
- (o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
868
- return n && s && bn(t, r, s), s;
869
- }, W = (e, t) => (r, n) => t(r, n, e);
870
- const In = () => {
845
+ M(1, S(He)),
846
+ M(2, D),
847
+ M(3, O),
848
+ M(4, S(U)),
849
+ M(5, Dt),
850
+ M(6, H),
851
+ M(7, S(ze)),
852
+ M(8, Lt),
853
+ M(9, S(E))
854
+ ], ce);
855
+ var Nn = Object.defineProperty, Mn = Object.getOwnPropertyDescriptor, Pn = (e, t, n, s) => {
856
+ for (var r = s > 1 ? void 0 : s ? Mn(t, n) : t, i = e.length - 1, o; i >= 0; i--)
857
+ (o = e[i]) && (r = (s ? o(t, n, r) : o(r)) || r);
858
+ return s && r && Nn(t, n, r), r;
859
+ }, W = (e, t) => (n, s) => t(n, s, e);
860
+ const Rn = () => {
871
861
  let e = [];
872
862
  return {
873
- add: (s, i, o, a, l) => e.push({ unitId: s, subUnitId: i, row: o, col: a, value: l }),
863
+ add: (r, i, o, a, l) => e.push({ unitId: r, subUnitId: i, row: o, col: a, value: l }),
874
864
  getEffects: () => e,
875
865
  clean: () => {
876
866
  e = [];
877
867
  }
878
868
  };
879
869
  };
880
- let me = class extends Y {
881
- constructor(t, r, n, s, i) {
870
+ let ae = class extends z {
871
+ constructor(t, n, s, r, i) {
882
872
  super();
883
873
  // collect effect mutations when edit end and push this to commands stack in next commands progress
884
- L(this, "_collectEffectMutation", In());
885
- this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
874
+ ie(this, "_collectEffectMutation", Rn());
875
+ this._sheetInterceptorService = t, this._numfmtService = n, this._univerInstanceService = s, this._injector = r, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
886
876
  }
887
877
  _initInterceptorEditorStart() {
888
878
  this.disposeWithMe(
889
- K(
879
+ Ie(
890
880
  this._editorBridgeService.interceptor.intercept(
891
881
  this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
892
882
  {
893
- handler: (t, r, n) => {
894
- const s = r.row, i = r.col, o = this._numfmtService.getValue(
895
- r.unitId,
896
- r.subUnitId,
897
- s,
883
+ handler: (t, n, s) => {
884
+ const r = n.row, i = n.col, o = this._numfmtService.getValue(
885
+ n.unitId,
886
+ n.subUnitId,
887
+ r,
898
888
  i
899
889
  );
900
890
  if (o)
901
- switch (fe(o.pattern)) {
891
+ switch (me(o.pattern)) {
902
892
  case "scientific":
903
893
  case "percent":
904
894
  case "currency":
905
895
  case "grouped":
906
896
  case "number":
907
- return r.worksheet.getCellRaw(s, i);
897
+ return n.worksheet.getCellRaw(r, i);
908
898
  case "date":
909
899
  case "time":
910
900
  case "datetime":
911
901
  default:
912
- return n && n(t);
902
+ return s && s(t);
913
903
  }
914
- return n(t);
904
+ return s(t);
915
905
  }
916
906
  }
917
907
  )
@@ -925,46 +915,46 @@ let me = class extends Y {
925
915
  */
926
916
  _initInterceptorEditorEnd() {
927
917
  this.disposeWithMe(
928
- K(
918
+ Ie(
929
919
  this._editorBridgeService.interceptor.intercept(
930
920
  this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
931
921
  {
932
- handler: (t, r, n) => {
922
+ handler: (t, n, s) => {
933
923
  var m;
934
924
  this._collectEffectMutation.clean();
935
- const s = this._numfmtService.getValue(
936
- r.unitId,
937
- r.subUnitId,
938
- r.row,
939
- r.col
940
- ), i = (m = s && fe(s.pattern)) != null ? m : "", o = () => {
941
- s && this._collectEffectMutation.add(
942
- r.unitId,
943
- r.subUnitId,
944
- r.row,
945
- r.col,
925
+ const r = this._numfmtService.getValue(
926
+ n.unitId,
927
+ n.subUnitId,
928
+ n.row,
929
+ n.col
930
+ ), i = (m = r && me(r.pattern)) != null ? m : "", o = () => {
931
+ r && this._collectEffectMutation.add(
932
+ n.unitId,
933
+ n.subUnitId,
934
+ n.row,
935
+ n.col,
946
936
  null
947
937
  );
948
938
  };
949
939
  if (!(t != null && t.v))
950
- return n(t);
940
+ return s(t);
951
941
  const a = String(t.v), l = x.parseDate(a) || x.parseTime(a);
952
942
  if (!!l) {
953
943
  if (l && l.z) {
954
944
  const c = Number(l.v);
955
945
  return this._collectEffectMutation.add(
956
- r.unitId,
957
- r.subUnitId,
958
- r.row,
959
- r.col,
946
+ n.unitId,
947
+ n.subUnitId,
948
+ n.row,
949
+ n.col,
960
950
  {
961
951
  pattern: l.z
962
952
  }
963
- ), { ...t, v: c, t: B.NUMBER };
953
+ ), { ...t, v: c, t: V.NUMBER };
964
954
  }
965
955
  } else
966
- (["date", "time", "datetime"].includes(i) || !Tn(a)) && o();
967
- return n(t);
956
+ (["date", "time", "datetime"].includes(i) || !xn(a)) && o();
957
+ return s(t);
968
958
  }
969
959
  }
970
960
  )
@@ -975,25 +965,25 @@ let me = class extends Y {
975
965
  const t = this;
976
966
  this.disposeWithMe(
977
967
  this._sheetInterceptorService.interceptCommand({
978
- getMutations(r) {
979
- switch (r.id) {
968
+ getMutations(n) {
969
+ switch (n.id) {
980
970
  case Tt.id: {
981
- const n = t._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET), s = n.getUnitId(), i = n.getActiveSheet().getSheetId(), o = t._collectEffectMutation.getEffects();
971
+ const s = t._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET), r = s.getUnitId(), i = s.getActiveSheet().getSheetId(), o = t._collectEffectMutation.getEffects();
982
972
  if (!o.length)
983
973
  return {
984
974
  redos: [],
985
975
  undos: []
986
976
  };
987
977
  const a = o.filter((c) => {
988
- var f;
989
- return !!((f = c.value) != null && f.pattern);
978
+ var h;
979
+ return !!((h = c.value) != null && h.pattern);
990
980
  }).map((c) => ({
991
981
  row: c.row,
992
982
  col: c.col,
993
983
  pattern: c.value.pattern
994
984
  })), l = o.filter((c) => {
995
- var f;
996
- return !((f = c.value) != null && f.pattern);
985
+ var h;
986
+ return !((h = c.value) != null && h.pattern);
997
987
  }).map((c) => ({
998
988
  startRow: c.row,
999
989
  endColumn: c.col,
@@ -1002,21 +992,21 @@ let me = class extends Y {
1002
992
  })), u = [], m = [];
1003
993
  if (a) {
1004
994
  const c = {
1005
- id: J.id,
1006
- params: We(s, i, a)
995
+ id: Y.id,
996
+ params: Fe(r, i, a)
1007
997
  };
1008
- u.push(c), m.push(...Ge(t._injector, c.params));
998
+ u.push(c), m.push(...We(t._injector, c.params));
1009
999
  }
1010
1000
  if (l) {
1011
1001
  const c = {
1012
- id: ge.id,
1002
+ id: pe.id,
1013
1003
  params: {
1014
- unitId: s,
1004
+ unitId: r,
1015
1005
  subUnitId: i,
1016
1006
  ranges: l
1017
1007
  }
1018
1008
  };
1019
- u.push(c), m.push(...ze(t._injector, c.params));
1009
+ u.push(c), m.push(...ke(t._injector, c.params));
1020
1010
  }
1021
1011
  return {
1022
1012
  redos: u,
@@ -1033,32 +1023,32 @@ let me = class extends Y {
1033
1023
  );
1034
1024
  }
1035
1025
  };
1036
- me = Cn([
1037
- q(V.Rendered, me),
1026
+ ae = Pn([
1027
+ K(B.Rendered, ae),
1038
1028
  W(0, S(Pe)),
1039
1029
  W(1, S(H)),
1040
- W(2, S(k)),
1041
- W(3, S(xe)),
1042
- W(4, S(Nt))
1043
- ], me);
1044
- function Tn(e) {
1030
+ W(2, S(D)),
1031
+ W(3, S(Re)),
1032
+ W(4, S(Mt))
1033
+ ], ae);
1034
+ function xn(e) {
1045
1035
  return /^-?\d+(\.\d+)?$/.test(e);
1046
1036
  }
1047
- var Mn = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, En = (e, t, r, n) => {
1048
- for (var s = n > 1 ? void 0 : n ? Nn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
1049
- (o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
1050
- return n && s && Mn(t, r, s), s;
1051
- }, Rn = (e, t) => (r, n) => t(r, n, e);
1052
- let de = class extends Y {
1037
+ var On = Object.defineProperty, jn = Object.getOwnPropertyDescriptor, $n = (e, t, n, s) => {
1038
+ for (var r = s > 1 ? void 0 : s ? jn(t, n) : t, i = e.length - 1, o; i >= 0; i--)
1039
+ (o = e[i]) && (r = (s ? o(t, n, r) : o(r)) || r);
1040
+ return s && r && On(t, n, r), r;
1041
+ }, wn = (e, t) => (n, s) => t(n, s, e);
1042
+ let le = class extends z {
1053
1043
  constructor(e) {
1054
1044
  super(), this._localeService = e;
1055
1045
  }
1056
1046
  };
1057
- de = En([
1058
- q(V.Rendered, de),
1059
- Rn(0, S(T))
1060
- ], de);
1061
- const he = [
1047
+ le = $n([
1048
+ K(B.Rendered, le),
1049
+ wn(0, S(E))
1050
+ ], le);
1051
+ const ue = [
1062
1052
  {
1063
1053
  label: "sheet.numfmt.general",
1064
1054
  pattern: null
@@ -1111,30 +1101,30 @@ const he = [
1111
1101
  label: "sheet.numfmt.moreFmt",
1112
1102
  pattern: ""
1113
1103
  }
1114
- ], lt = "sheet.numfmt.moreNumfmtType", ut = "sheet.numfmt.moreNumfmtType.options", Pn = (e) => {
1115
- var n;
1116
- const t = N(T), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
1117
- return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children: r });
1118
- }, xn = () => {
1119
- const e = N(O), t = N(T), r = kt(), n = N(D), s = (a) => {
1120
- const l = n.getLast();
1104
+ ], rt = "sheet.numfmt.moreNumfmtType", it = "sheet.numfmt.moreNumfmtType.options", Dn = (e) => {
1105
+ var s;
1106
+ const t = N(E), n = (s = e.value) != null ? s : t.t("sheet.numfmt.general");
1107
+ return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children: n });
1108
+ }, Un = () => {
1109
+ const e = N(O), t = N(E), n = zt(), s = N(U), r = (a) => {
1110
+ const l = s.getLast();
1121
1111
  if (!l)
1122
1112
  return;
1123
- const u = r.get($t), m = l.range, c = [];
1124
- P.foreach(m, (f, _) => {
1125
- a ? c.push({ row: f, col: _, pattern: a, type: fe(a) }) : c.push({ row: f, col: _ });
1113
+ const u = n.get(Ut), m = l.range, c = [];
1114
+ R.foreach(m, (h, g) => {
1115
+ a ? c.push({ row: h, col: g, pattern: a, type: me(a) }) : c.push({ row: h, col: g });
1126
1116
  }), e.executeCommand($.id, { values: c }), u.focus();
1127
1117
  }, i = (a) => {
1128
1118
  if (a === 0)
1129
- s(null);
1130
- else if (a === he.length - 1)
1131
- e.executeCommand(pe.id);
1119
+ r(null);
1120
+ else if (a === ue.length - 1)
1121
+ e.executeCommand(de.id);
1132
1122
  else {
1133
- const l = he[a];
1134
- l.pattern && s(l.pattern);
1123
+ const l = ue[a];
1124
+ l.pattern && r(l.pattern);
1135
1125
  }
1136
1126
  }, o = 1220;
1137
- return /* @__PURE__ */ d.jsx("div", { className: "more-numfmt-type-options", children: he.map((a, l) => a === "|" ? /* @__PURE__ */ d.jsx("div", { className: "line m-t-4", onClick: (u) => u.stopPropagation() }, l) : /* @__PURE__ */ d.jsxs(
1127
+ return /* @__PURE__ */ d.jsx("div", { className: "more-numfmt-type-options", children: ue.map((a, l) => a === "|" ? /* @__PURE__ */ d.jsx("div", { className: "line m-t-4", onClick: (u) => u.stopPropagation() }, l) : /* @__PURE__ */ d.jsxs(
1138
1128
  "div",
1139
1129
  {
1140
1130
  className: "option-item m-t-4",
@@ -1143,144 +1133,147 @@ const he = [
1143
1133
  },
1144
1134
  children: [
1145
1135
  /* @__PURE__ */ d.jsx("div", { children: t.t(a.label) }),
1146
- /* @__PURE__ */ d.jsx("div", { className: "m-l-26", children: a.pattern ? De(a.pattern || "", o, t.getCurrentLocale()).result : "" })
1136
+ /* @__PURE__ */ d.jsx("div", { className: "m-l-26", children: a.pattern ? we(a.pattern || "", o, t.getCurrentLocale()).result : "" })
1147
1137
  ]
1148
1138
  },
1149
1139
  l
1150
1140
  )) });
1151
- }, On = (e) => ({
1141
+ }, Ln = (e) => ({
1152
1142
  icon: "RmbSingle",
1153
- id: nt.id,
1143
+ id: Ze.id,
1154
1144
  title: "sheet.numfmt.currency",
1155
1145
  tooltip: "sheet.numfmt.currency",
1156
- type: ne.BUTTON,
1157
- group: re.TOOLBAR_FORMULAS_INSERT,
1158
- positions: [se.TOOLBAR_START],
1159
- hidden$: ie(e, E.UNIVER_SHEET),
1160
- disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
1161
- }), jn = (e) => ({
1146
+ type: ee.BUTTON,
1147
+ group: te.TOOLBAR_FORMULAS_INSERT,
1148
+ positions: [ne.TOOLBAR_START],
1149
+ hidden$: se(e, T.UNIVER_SHEET),
1150
+ disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
1151
+ }), An = (e) => ({
1162
1152
  icon: "AddDigitsSingle",
1163
- id: et.id,
1153
+ id: qe.id,
1164
1154
  title: "sheet.numfmt.addDecimal",
1165
1155
  tooltip: "sheet.numfmt.addDecimal",
1166
- type: ne.BUTTON,
1167
- positions: [se.TOOLBAR_START],
1168
- group: re.TOOLBAR_FORMULAS_INSERT,
1169
- hidden$: ie(e, E.UNIVER_SHEET),
1170
- disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
1171
- }), $n = (e) => ({
1156
+ type: ee.BUTTON,
1157
+ positions: [ne.TOOLBAR_START],
1158
+ group: te.TOOLBAR_FORMULAS_INSERT,
1159
+ hidden$: se(e, T.UNIVER_SHEET),
1160
+ disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
1161
+ }), Vn = (e) => ({
1172
1162
  icon: "ReduceDigitsSingle",
1173
- id: rt.id,
1163
+ id: Qe.id,
1174
1164
  title: "sheet.numfmt.subtractDecimal",
1175
1165
  tooltip: "sheet.numfmt.subtractDecimal",
1176
- type: ne.BUTTON,
1177
- group: re.TOOLBAR_FORMULAS_INSERT,
1178
- positions: [se.TOOLBAR_START],
1179
- hidden$: ie(e, E.UNIVER_SHEET),
1180
- disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
1181
- }), wn = (e) => ({
1166
+ type: ee.BUTTON,
1167
+ group: te.TOOLBAR_FORMULAS_INSERT,
1168
+ positions: [ne.TOOLBAR_START],
1169
+ hidden$: se(e, T.UNIVER_SHEET),
1170
+ disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
1171
+ }), Bn = (e) => ({
1182
1172
  icon: "PercentSingle",
1183
- id: at.id,
1173
+ id: st.id,
1184
1174
  title: "sheet.numfmt.percent",
1185
1175
  tooltip: "sheet.numfmt.percent",
1186
- type: ne.BUTTON,
1187
- group: re.TOOLBAR_FORMULAS_INSERT,
1188
- positions: [se.TOOLBAR_START],
1189
- hidden$: ie(e, E.UNIVER_SHEET),
1190
- disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
1191
- }), Dn = (e) => {
1192
- const t = e.get(H), r = e.get(k), n = e.get(O), s = e.get(T), i = e.get(D), o = Et(r, "", ({ workbook: a, worksheet: l }) => new G(
1193
- (u) => Ze(
1176
+ type: ee.BUTTON,
1177
+ group: te.TOOLBAR_FORMULAS_INSERT,
1178
+ positions: [ne.TOOLBAR_START],
1179
+ hidden$: se(e, T.UNIVER_SHEET),
1180
+ disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
1181
+ }), Hn = (e) => {
1182
+ const t = e.get(H), n = e.get(D), s = e.get(O), r = e.get(E), i = e.get(U), o = Pt(n, "", ({ workbook: a, worksheet: l }) => new k(
1183
+ (u) => wt(
1194
1184
  i.selectionMoveEnd$,
1195
- new G((m) => {
1196
- const c = [ge.id, J.id], f = n.onCommandExecuted((_) => {
1197
- c.includes(_.id) && m.next(null);
1185
+ new k((m) => {
1186
+ const c = [pe.id, Y.id], h = s.onCommandExecuted((g) => {
1187
+ c.includes(g.id) && m.next(null);
1198
1188
  });
1199
- return () => f.dispose();
1189
+ return () => h.dispose();
1200
1190
  })
1201
1191
  ).subscribe(() => {
1202
1192
  const m = i.getSelections();
1203
1193
  if (m && m[0]) {
1204
- const c = m[0].range, f = c.startRow, _ = c.startColumn, g = t.getValue(a.getUnitId(), l.getSheetId(), f, _), h = g == null ? void 0 : g.pattern;
1205
- let p = s.t("sheet.numfmt.general");
1206
- if (h) {
1207
- const v = he.filter((b) => typeof b == "object" && b.pattern).find(
1208
- (b) => _e(h, b.pattern)
1194
+ const c = m[0].range, h = c.startRow, g = c.startColumn, v = t.getValue(a.getUnitId(), l.getSheetId(), h, g), f = v == null ? void 0 : v.pattern;
1195
+ let p = r.t("sheet.numfmt.general");
1196
+ if (f) {
1197
+ const _ = ue.filter((b) => typeof b == "object" && b.pattern).find(
1198
+ (b) => ve(f, b.pattern)
1209
1199
  );
1210
- v && typeof v == "object" && v.pattern ? p = s.t(v.label) : p = s.t("sheet.numfmt.moreFmt");
1200
+ _ && typeof _ == "object" && _.pattern ? p = r.t(_.label) : p = r.t("sheet.numfmt.moreFmt");
1211
1201
  }
1212
1202
  u.next(p);
1213
1203
  }
1214
1204
  })
1215
1205
  ));
1216
1206
  return {
1217
- label: lt,
1218
- id: pe.id,
1207
+ label: rt,
1208
+ id: de.id,
1219
1209
  tooltip: "sheet.numfmt.title",
1220
- type: ne.SELECTOR,
1221
- group: re.TOOLBAR_FORMULAS_INSERT,
1222
- positions: [se.TOOLBAR_START],
1210
+ type: ee.SELECTOR,
1211
+ group: te.TOOLBAR_FORMULAS_INSERT,
1212
+ positions: [ne.TOOLBAR_START],
1223
1213
  selections: [
1224
1214
  {
1225
1215
  label: {
1226
- name: ut,
1216
+ name: it,
1227
1217
  hoverable: !1
1228
1218
  }
1229
1219
  }
1230
1220
  ],
1231
1221
  value$: o,
1232
- hidden$: ie(e, E.UNIVER_SHEET),
1233
- disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [X, Q], rangeTypes: [ee] })
1222
+ hidden$: se(e, T.UNIVER_SHEET),
1223
+ disabled$: X(e, { workbookTypes: [q], worksheetTypes: [Z, J], rangeTypes: [Q] })
1234
1224
  };
1235
1225
  };
1236
- var Un = Object.defineProperty, Ln = Object.getOwnPropertyDescriptor, An = (e, t, r, n) => {
1237
- for (var s = n > 1 ? void 0 : n ? Ln(t, r) : t, i = e.length - 1, o; i >= 0; i--)
1238
- (o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
1239
- return n && s && Un(t, r, s), s;
1240
- }, Me = (e, t) => (r, n) => t(r, n, e);
1241
- const Bn = {};
1242
- let z = class extends Y {
1243
- constructor(e, t, r, n) {
1244
- super(), this._config = e, this._injector = t, this._componentManager = r, this._menuService = n, this._initMenu();
1226
+ var Fn = Object.defineProperty, Wn = Object.getOwnPropertyDescriptor, kn = (e, t, n, s) => {
1227
+ for (var r = s > 1 ? void 0 : s ? Wn(t, n) : t, i = e.length - 1, o; i >= 0; i--)
1228
+ (o = e[i]) && (r = (s ? o(t, n, r) : o(r)) || r);
1229
+ return s && r && Fn(t, n, r), r;
1230
+ }, Te = (e, t) => (n, s) => t(n, s, e);
1231
+ const Gn = {};
1232
+ let G = class extends z {
1233
+ constructor(e, t, n, s) {
1234
+ super(), this._config = e, this._injector = t, this._componentManager = n, this._menuService = s, this._initMenu();
1245
1235
  }
1246
1236
  _initMenu() {
1247
1237
  const { menu: e = {} } = this._config;
1248
- [wn, jn, $n, On, Dn].forEach((t) => {
1238
+ [Bn, An, Vn, Ln, Hn].forEach((t) => {
1249
1239
  this.disposeWithMe(this._menuService.addMenuItem(t(this._injector), e));
1250
- }), this.disposeWithMe(this._componentManager.register(lt, Pn)), this.disposeWithMe(this._componentManager.register(ut, xn));
1240
+ }), this.disposeWithMe(this._componentManager.register(rt, Dn)), this.disposeWithMe(this._componentManager.register(it, Un));
1251
1241
  }
1252
1242
  };
1253
- z = An([
1254
- q(V.Rendered, z),
1255
- Me(1, S(xe)),
1256
- Me(2, S(Je)),
1257
- Me(3, S(Dt))
1258
- ], z);
1259
- var kn = Object.defineProperty, Vn = Object.getOwnPropertyDescriptor, Hn = (e, t, r, n) => {
1260
- for (var s = n > 1 ? void 0 : n ? Vn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
1261
- (o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
1262
- return n && s && kn(t, r, s), s;
1263
- }, Fn = (e, t) => (r, n) => t(r, n, e), ae;
1264
- let He = (ae = class extends Ct {
1243
+ G = kn([
1244
+ K(B.Rendered, G),
1245
+ Te(1, S(Re)),
1246
+ Te(2, S(ze)),
1247
+ Te(3, S(At))
1248
+ ], G);
1249
+ var ot = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Kn = (e, t, n) => t in e ? ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Yn = (e, t, n, s) => {
1250
+ for (var r = s > 1 ? void 0 : s ? zn(t, n) : t, i = e.length - 1, o; i >= 0; i--)
1251
+ (o = e[i]) && (r = (s ? o(t, n, r) : o(r)) || r);
1252
+ return s && r && ot(t, n, r), r;
1253
+ }, qn = (e, t) => (n, s) => t(n, s, e), ct = (e, t, n) => (Kn(e, typeof t != "symbol" ? t + "" : t, n), n);
1254
+ let he = class extends bt {
1265
1255
  constructor(e = {}, t) {
1266
- super(), this._config = e, this._injector = t, this._config = It.deepMerge({}, Bn, this._config);
1256
+ super(), this._config = e, this._injector = t, this._config = yt.deepMerge({}, Gn, this._config);
1267
1257
  }
1268
1258
  onStarting() {
1269
- this._injector.add([Ue, { useClass: ue, lazy: !1 }]), this._injector.add([me]), this._injector.add([ve]), this._injector.add([le]), this._injector.add([de]), this._injector.add(
1259
+ this._injector.add([De, { useClass: ce, lazy: !1 }]), this._injector.add([ae]), this._injector.add([fe]), this._injector.add([oe]), this._injector.add([le]), this._injector.add(
1270
1260
  [
1271
- z,
1261
+ G,
1272
1262
  {
1273
- useFactory: () => this._injector.createInstance(z, this._config)
1263
+ useFactory: () => this._injector.createInstance(G, this._config)
1274
1264
  }
1275
1265
  ]
1276
1266
  );
1277
1267
  }
1278
- }, L(ae, "pluginName", Ne), L(ae, "type", E.UNIVER_SHEET), ae);
1279
- He = Hn([
1280
- Fn(1, S(xe))
1281
- ], He);
1268
+ };
1269
+ ct(he, "pluginName", Ee);
1270
+ ct(he, "type", T.UNIVER_SHEET);
1271
+ he = Yn([
1272
+ Ct(It, Rt),
1273
+ qn(1, S(Re))
1274
+ ], he);
1282
1275
  export {
1283
1276
  $ as SetNumfmtCommand,
1284
- He as UniverSheetsNumfmtPlugin,
1285
- De as getPatternPreview
1277
+ he as UniverSheetsNumfmtPlugin,
1278
+ we as getPatternPreview
1286
1279
  };