@univerjs/sheets-numfmt 0.1.12 → 0.1.13

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,30 +1,30 @@
1
- var lt = Object.defineProperty;
2
- var ut = (e, t, r) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var j = (e, t, r) => (ut(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { CommandType as w, ICommandService as O, IUniverInstanceService as V, IUndoRedoService as mt, sequenceExecute as dt, LocaleType as ht, Disposable as Y, ObjectMatrix as ft, CellValueType as B, Range as P, toDisposable as K, OnLifecycle as q, LifecycleStages as F, ThemeService as Be, LocaleService as I, runOnLifecycle as pt, ILocalStorageService as vt, UniverInstanceType as x, DisposableCollection as gt, Plugin as _t, Tools as St } from "@univerjs/core";
5
- import { getSheetCommandTarget as Ie, transformCellsToRange as Ve, rangeMerge as $e, SetNumfmtMutation as J, factorySetNumfmtUndoMutation as Fe, RemoveNumfmtMutation as he, factoryRemoveNumfmtUndoMutation as He, INTERCEPTOR_POINT as We, SheetInterceptorService as Me, INumfmtService as H, SelectionManagerService as U, SetRangeValuesCommand as bt, getCurrentSheetDisabled$ as Z } from "@univerjs/sheets";
6
- import { Inject as S, createIdentifier as yt, Injector as Ne } from "@wendellhu/redi";
7
- import { SheetSkeletonManagerService as ke, IEditorBridgeService as Ct, deriveStateFromActiveSheet$ as Tt } from "@univerjs/sheets-ui";
8
- import { map as Ge, distinctUntilChanged as It, switchMap as Mt, tap as Nt, debounceTime as xt } from "rxjs/operators";
9
- import R from "@univerjs/engine-numfmt";
10
- import { IRenderManagerService as Et, ITextSelectionRenderManager as Pt } from "@univerjs/engine-render";
11
- import { ComponentManager as ze, ISidebarService as Rt, MenuItemType as Q, MenuGroup as X, MenuPosition as ee, getMenuHiddenObservable as te, IMenuService as Ot } from "@univerjs/ui";
12
- import { Observable as G, combineLatest as Dt, merge as Ke } from "rxjs";
13
- import jt, { createContext as $t, useState as T, useEffect as xe, useRef as Ye, useContext as qe, useMemo as E, createElement as wt } from "react";
14
- import { InputNumber as Ee, Select as Pe, SelectList as Re, Button as we } from "@univerjs/design";
15
- import { useDependency as N, useInjector as Ut } from "@wendellhu/redi/react-bindings";
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";
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";
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(V), s = e.get(mt), i = Ie(n, t);
22
+ const r = e.get(O), n = e.get(k), s = e.get(pt), i = Re(n, t);
23
23
  if (!i)
24
24
  return !1;
25
- const { unitId: c, subUnitId: o } = i, l = t.values.filter((h) => !!h.pattern), u = t.values.filter((h) => !h.pattern), m = Ve(c, o, l), a = {
26
- unitId: c,
27
- subUnitId: o,
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 = {
26
+ unitId: o,
27
+ subUnitId: a,
28
28
  ranges: u.map((h) => ({
29
29
  startColumn: h.col,
30
30
  startRow: h.row,
@@ -35,180 +35,76 @@ const $ = {
35
35
  if (l.length) {
36
36
  Object.keys(m.values).forEach((p) => {
37
37
  const v = m.values[p];
38
- v.ranges = $e(v.ranges);
38
+ v.ranges = Ae(v.ranges);
39
39
  }), f.push({
40
40
  id: J.id,
41
41
  params: m
42
42
  });
43
- const h = Fe(e, m);
43
+ const h = Ge(e, m);
44
44
  _.push(...h);
45
45
  }
46
46
  if (u.length) {
47
- a.ranges = $e(a.ranges), f.push({
48
- id: he.id,
49
- params: a
47
+ c.ranges = Ae(c.ranges), f.push({
48
+ id: ge.id,
49
+ params: c
50
50
  });
51
- const h = He(e, a);
51
+ const h = ze(e, c);
52
52
  _.push(...h);
53
53
  }
54
- const g = dt(f, r).result;
54
+ const g = vt(f, r).result;
55
55
  return g && s.pushUndoRedo({
56
- unitID: c,
56
+ unitID: o,
57
57
  undoMutations: _,
58
58
  redoMutations: f
59
59
  }), g;
60
60
  }
61
- }, Lt = {
62
- sheet: {
63
- numfmt: {
64
- percent: "Percentage",
65
- title: "Number format",
66
- numfmtType: "Format types",
67
- cancel: "Cancel",
68
- confirm: "Confirm",
69
- general: "General",
70
- accounting: "Accounting",
71
- text: "Text",
72
- number: "Number",
73
- currency: "Currency",
74
- date: "Date",
75
- time: "Time",
76
- thousandthPercentile: "Thousands separator",
77
- preview: "Preview",
78
- dateTime: "Date and time",
79
- decimalLength: "Decimal places",
80
- currencyType: "Currency Symbol",
81
- moreFmt: "More Formats",
82
- financialValue: "Financial value",
83
- roundingCurrency: "Rounding up the currency",
84
- timeDuration: "Duration Time",
85
- currencyDes: "The currency format is used to represent general currency values. The accounting format aligns a column of values with decimal points",
86
- accountingDes: "The accounting number format aligns a column of values with currency symbols and decimal points",
87
- dateType: "Date Type",
88
- dateDes: "The date format presents date and time series values as date values.",
89
- negType: "A negative number type",
90
- generalDes: "The regular format does not contain any specific number format.",
91
- thousandthPercentileDes: "The percentile format is used for the representation of ordinary numbers. Monetary and accounting formats provide a specialized format for monetary value calculations.",
92
- addDecimal: "Increase decimal places",
93
- subtractDecimal: "Decreasing decimal places"
94
- }
95
- }
96
- }, At = Lt, Bt = {
97
- sheet: {
98
- numfmt: {
99
- percent: "百分比",
100
- title: "数字格式",
101
- numfmtType: "格式类型",
102
- cancel: "取消",
103
- confirm: "确认",
104
- general: "常规",
105
- accounting: "会计",
106
- text: "文本",
107
- number: "数值",
108
- currency: "货币",
109
- date: "日期",
110
- time: "时间",
111
- thousandthPercentile: "千分位符",
112
- preview: "示例",
113
- dateTime: "日期时间",
114
- decimalLength: "小数位数",
115
- currencyType: "货币类型",
116
- moreFmt: "更多格式",
117
- financialValue: "财务数值",
118
- roundingCurrency: "货币取整",
119
- timeDuration: "持续时间",
120
- currencyDes: "货币格式用于表示一般货币数值。会计格式可以对一列数值进行小数点对齐",
121
- accountingDes: "会计数字格式可对一列数值进行货币符号和小数点对齐",
122
- dateType: "日期类型",
123
- dateDes: "日期格式将日期和时间系列数值品示为日期值。",
124
- negType: "负数类型",
125
- generalDes: "常规格式不包含任何特定的数字格式。",
126
- thousandthPercentileDes: "千分位符格式用于一般数字的表示。货币和会计格式则提供货币值计算的专用格式。",
127
- addDecimal: "增加小数位",
128
- subtractDecimal: "减少小数位"
129
- }
130
- }
131
- }, Vt = Bt, Ft = {
132
- sheet: {
133
- numfmt: {
134
- percent: "Процент",
135
- title: "Формат числа",
136
- numfmtType: "Типы форматов",
137
- cancel: "Отмена",
138
- confirm: "Подтвердить",
139
- general: "Общий",
140
- accounting: "Бухгалтерский",
141
- text: "Текст",
142
- number: "Число",
143
- currency: "Валюта",
144
- date: "Дата",
145
- time: "Время",
146
- thousandthPercentile: "Разделитель тысяч",
147
- preview: "Предпросмотр",
148
- dateTime: "Дата и время",
149
- decimalLength: "Десятичные знаки",
150
- currencyType: "Символ валюты",
151
- moreFmt: "Другие форматы",
152
- financialValue: "Финансовое значение",
153
- roundingCurrency: "Округление валюты",
154
- timeDuration: "Продолжительность времени",
155
- currencyDes: "Формат валюты используется для представления общих значений валюты. Формат бухгалтерского учета выравнивает столбец значений по десятичным точкам.",
156
- accountingDes: "Формат бухгалтерских чисел выравнивает столбец значений по символам валюты и десятичным точкам.",
157
- dateType: "Тип даты",
158
- dateDes: "Формат даты представляет значения времени и даты как значения даты.",
159
- negType: "Тип отрицательного числа",
160
- generalDes: "Обычный формат не содержит никакого специфического формата числа.",
161
- thousandthPercentileDes: "Формат процента используется для представления обычных чисел. Монетарные и бухгалтерские форматы предоставляют специальный формат для вычислений монетарных значений.",
162
- addDecimal: "Увеличить количество десятичных знаков",
163
- subtractDecimal: "Уменьшить количество десятичных знаков"
164
- }
165
- }
166
- }, sr = Ft, Ce = "SHEET_NUMFMT_PLUGIN", ue = (e) => R.getInfo(e).type || "unknown", Oe = (e, t, r) => {
167
- const n = R.getInfo(e), s = r === ht.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], c = R.format(e, t, { locale: s });
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 });
168
63
  return t < 0 ? {
169
- result: c,
64
+ result: o,
170
65
  color: i.color
171
66
  } : {
172
- result: c
67
+ result: o
173
68
  };
174
69
  };
175
- var Ht = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, kt = (e, t, r, n) => {
176
- for (var s = n > 1 ? void 0 : n ? Wt(t, r) : t, i = e.length - 1, c; i >= 0; i--)
177
- (c = e[i]) && (s = (n ? c(t, r, s) : c(s)) || s);
178
- return n && s && Ht(t, r, s), s;
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;
179
74
  }, A = (e, t) => (r, n) => t(r, n, e);
180
- let ie = class extends Y {
75
+ let le = class extends Y {
181
76
  constructor(e, t, r, n, s, i) {
182
77
  super(), this._sheetInterceptorService = e, this._themeService = t, this._sheetSkeletonManagerService = r, this._commandService = n, this._numfmtService = s, this._localeService = i, this._initInterceptorCellContent();
183
78
  }
184
79
  _initInterceptorCellContent() {
185
- const e = new ft();
80
+ const e = new _t();
186
81
  this.disposeWithMe(
187
- this._sheetInterceptorService.intercept(We.CELL_CONTENT, {
82
+ this._sheetInterceptorService.intercept(Ke.CELL_CONTENT, {
188
83
  handler: (t, r, n) => {
189
- const s = r.unitId, i = r.subUnitId, c = this._numfmtService.getValue(s, i, r.row, r.col);
190
- if (!c)
84
+ const s = r.unitId, i = r.subUnitId, o = this._numfmtService.getValue(s, i, r.row, r.col);
85
+ if (!o)
191
86
  return n(t);
192
- const o = t;
193
- if (!o || o.t !== B.NUMBER)
87
+ const a = t;
88
+ if (!a || a.t !== B.NUMBER)
194
89
  return n(t);
195
90
  let l = "";
196
91
  const u = e.getValue(r.row, r.col);
197
- if (u && u.parameters === o.v)
92
+ if (u && u.parameters === a.v)
198
93
  return n({ ...t, ...u.result });
199
- const m = Oe(c.pattern, Number(o.v), this._localeService.getCurrentLocale());
94
+ const m = De(o.pattern, Number(a.v), this._localeService.getCurrentLocale());
200
95
  if (l = m.result, !l)
201
96
  return n(t);
202
- const a = { v: l };
97
+ const c = { v: l };
203
98
  if (m.color) {
204
99
  const f = this._themeService.getCurrentTheme()[`${m.color}500`];
205
- f && (a.interceptorStyle = { cl: { rgb: f } });
100
+ f && (c.interceptorStyle = { cl: { rgb: f } });
206
101
  }
207
102
  return e.setValue(r.row, r.col, {
208
- result: a,
209
- parameters: o.v
210
- }), n({ ...t, ...a });
211
- }
103
+ result: c,
104
+ parameters: a.v
105
+ }), n({ ...t, ...c });
106
+ },
107
+ priority: 10
212
108
  })
213
109
  ), this.disposeWithMe(
214
110
  this._commandService.onCommandExecuted((t) => {
@@ -216,8 +112,8 @@ let ie = class extends Y {
216
112
  const r = t.params;
217
113
  Object.keys(r.values).forEach((n) => {
218
114
  r.values[n].ranges.forEach((i) => {
219
- P.foreach(i, (c, o) => {
220
- e.realDeleteValue(c, o);
115
+ P.foreach(i, (o, a) => {
116
+ e.realDeleteValue(o, a);
221
117
  });
222
118
  });
223
119
  });
@@ -226,8 +122,8 @@ let ie = class extends Y {
226
122
  ), this.disposeWithMe(
227
123
  K(
228
124
  this._sheetSkeletonManagerService.currentSkeleton$.pipe(
229
- Ge((t) => t == null ? void 0 : t.sheetId),
230
- It()
125
+ qe((t) => t == null ? void 0 : t.sheetId),
126
+ Rt()
231
127
  ).subscribe(() => {
232
128
  e.reset();
233
129
  })
@@ -235,70 +131,70 @@ let ie = class extends Y {
235
131
  );
236
132
  }
237
133
  };
238
- ie = kt([
239
- q(F.Rendered, ie),
240
- A(0, S(Me)),
241
- A(1, S(Be)),
242
- A(2, S(ke)),
134
+ le = Ft([
135
+ q(V.Rendered, le),
136
+ A(0, S(Pe)),
137
+ A(1, S(Fe)),
138
+ A(2, S(Ye)),
243
139
  A(3, S(O)),
244
140
  A(4, S(H)),
245
- A(5, S(I))
246
- ], ie);
247
- const D = (e, t = 0) => {
141
+ A(5, S(T))
142
+ ], le);
143
+ const j = (e, t = 0) => {
248
144
  var n;
249
- return e && (n = R.getInfo(e).maxDecimals) != null ? n : t;
250
- }, fe = (e, t) => {
145
+ return e && (n = x.getInfo(e).maxDecimals) != null ? n : t;
146
+ }, _e = (e, t) => {
251
147
  if (e && !t || !e && t)
252
148
  return !1;
253
149
  const r = (u) => u.reduce(
254
- (m, a) => {
150
+ (m, c) => {
255
151
  if (m.isEnd)
256
152
  return m;
257
- const f = a.value || a.num;
258
- return a.type === "point" ? (m.isEnd = !0, m) : { ...m, result: m.result + f };
153
+ const f = c.value || c.num;
154
+ return c.type === "point" ? (m.isEnd = !0, m) : { ...m, result: m.result + f };
259
155
  },
260
156
  { isEnd: !1, result: "" }
261
- ).result, n = R.getInfo(e)._partitions, s = R.getInfo(t)._partitions, i = r(n[0].tokens), c = r(s[0].tokens), o = r(n[1].tokens), l = r(s[1].tokens);
262
- return i === c && o === l && n[1].color === s[1].color;
263
- }, Ue = (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(
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(
264
160
  /\.0*/g,
265
- `${t > 0 ? "." : ""}${Ue(Number(t || 0))}`
161
+ `${t > 0 ? "." : ""}${ke(Number(t || 0))}`
266
162
  ) : /0([^0]?)|0$/.test(n) ? n.replace(
267
163
  /0([^0]+)|0$/,
268
- `0${t > 0 ? "." : ""}${Ue(Number(t || 0))}$1`
269
- ) : n).join(";"), Gt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), Je = {
164
+ `0${t > 0 ? "." : ""}${ke(Number(t || 0))}$1`
165
+ ) : n).join(";"), Wt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), et = {
270
166
  id: "sheet.command.numfmt.add.decimal.command",
271
167
  type: w.COMMAND,
272
168
  handler: async (e) => {
273
- const t = e.get(O), r = e.get(U), n = e.get(H), s = e.get(V), i = r.getSelections();
169
+ const t = e.get(O), r = e.get(D), n = e.get(H), s = e.get(k), i = r.getSelections();
274
170
  if (!i || !i.length)
275
171
  return !1;
276
- const c = Ie(s);
277
- if (!c)
172
+ const o = Re(s);
173
+ if (!o)
278
174
  return !1;
279
- const { unitId: o, subUnitId: l } = c;
175
+ const { unitId: a, subUnitId: l } = o;
280
176
  let u = 0;
281
177
  i.forEach((_) => {
282
178
  P.foreach(_.range, (g, h) => {
283
- const p = n.getValue(o, l, g, h);
179
+ const p = n.getValue(a, l, g, h);
284
180
  if (!p)
285
181
  return;
286
- const v = D(p.pattern);
182
+ const v = j(p.pattern);
287
183
  u = v > u ? v : u;
288
184
  });
289
185
  });
290
- const m = u + 1, a = C(`0${m > 0 ? ".0" : ""}`, m), f = [];
186
+ const m = u + 1, c = C(`0${m > 0 ? ".0" : ""}`, m), f = [];
291
187
  return i.forEach((_) => {
292
188
  P.foreach(_.range, (g, h) => {
293
- const p = n.getValue(o, l, g, h);
189
+ const p = n.getValue(a, l, g, h);
294
190
  if (!p)
295
191
  f.push({
296
192
  row: g,
297
193
  col: h,
298
- pattern: a
194
+ pattern: c
299
195
  });
300
196
  else {
301
- const v = D(p.pattern), b = C(p.pattern, v + 1);
197
+ const v = j(p.pattern), b = C(p.pattern, v + 1);
302
198
  b !== p.pattern && f.push({
303
199
  row: g,
304
200
  col: h,
@@ -308,7 +204,7 @@ const D = (e, t = 0) => {
308
204
  });
309
205
  }), f.length ? await t.executeCommand($.id, { values: f }) : !1;
310
206
  }
311
- }, zt = [
207
+ }, Gt = [
312
208
  {
313
209
  label: "1930-08-05",
314
210
  suffix: "yyyy-MM-dd"
@@ -353,7 +249,7 @@ const D = (e, t = 0) => {
353
249
  label: "08-05 下午 01:30",
354
250
  suffix: "MM-dd A/P hh:mm"
355
251
  }
356
- ], Kt = [
252
+ ], zt = [
357
253
  {
358
254
  label: "(1,235)",
359
255
  suffix: "#,##0_);(#,##0)"
@@ -381,7 +277,7 @@ const D = (e, t = 0) => {
381
277
  suffix: "#,##0.00_);[Red]-#,##0.00",
382
278
  color: "red"
383
279
  }
384
- ], Ze = [
280
+ ], tt = [
385
281
  {
386
282
  label: (e) => `${e}1,235`,
387
283
  suffix: (e) => `"${e}"#,##0.00_);"${e}"#,##0.00`
@@ -409,53 +305,53 @@ const D = (e, t = 0) => {
409
305
  suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
410
306
  color: "red"
411
307
  }
412
- ], Qe = {
308
+ ], nt = {
413
309
  id: "sheet.command.numfmt.set.currency",
414
310
  type: w.COMMAND,
415
311
  handler: async (e) => {
416
- const t = e.get(O), n = e.get(U).getSelections();
312
+ const t = e.get(O), n = e.get(D).getSelections();
417
313
  if (!n || !n.length)
418
314
  return !1;
419
- const s = [], i = Ze[0].suffix("¥");
420
- return n.forEach((o) => {
421
- P.foreach(o.range, (l, u) => {
315
+ const s = [], i = tt[0].suffix("¥");
316
+ return n.forEach((a) => {
317
+ P.foreach(a.range, (l, u) => {
422
318
  s.push({ row: l, col: u, pattern: i, type: "currency" });
423
319
  });
424
320
  }), await t.executeCommand($.id, { values: s });
425
321
  }
426
- }, Xe = {
322
+ }, rt = {
427
323
  id: "sheet.command.numfmt.subtract.decimal.command",
428
324
  type: w.COMMAND,
429
325
  handler: async (e) => {
430
- const t = e.get(O), r = e.get(U), n = e.get(H), s = e.get(V), i = r.getSelections();
326
+ const t = e.get(O), r = e.get(D), n = e.get(H), s = e.get(k), i = r.getSelections();
431
327
  if (!i || !i.length)
432
328
  return !1;
433
- const c = Ie(s);
434
- if (!c)
329
+ const o = Re(s);
330
+ if (!o)
435
331
  return !1;
436
- const { unitId: o, subUnitId: l } = c;
332
+ const { unitId: a, subUnitId: l } = o;
437
333
  let u = 0;
438
334
  i.forEach((g) => {
439
335
  P.foreach(g.range, (h, p) => {
440
- const v = n.getValue(o, l, h, p);
336
+ const v = n.getValue(a, l, h, p);
441
337
  if (!v)
442
338
  return;
443
- const b = D(v.pattern);
339
+ const b = j(v.pattern);
444
340
  u = b > u ? b : u;
445
341
  });
446
342
  });
447
- const m = u - 1, a = C(`0${m > 0 ? ".0" : "."}`, m), f = [];
343
+ const m = u - 1, c = C(`0${m > 0 ? ".0" : "."}`, m), f = [];
448
344
  return i.forEach((g) => {
449
345
  P.foreach(g.range, (h, p) => {
450
- const v = n.getValue(o, l, h, p);
346
+ const v = n.getValue(a, l, h, p);
451
347
  if (!v)
452
348
  f.push({
453
349
  row: h,
454
350
  col: p,
455
- pattern: a
351
+ pattern: c
456
352
  });
457
353
  else {
458
- const b = D(v.pattern);
354
+ const b = j(v.pattern);
459
355
  f.push({
460
356
  row: h,
461
357
  col: p,
@@ -465,21 +361,21 @@ const D = (e, t = 0) => {
465
361
  });
466
362
  }), await t.executeCommand($.id, { values: f });
467
363
  }
468
- }, Se = {
364
+ }, Ie = {
469
365
  id: "sheet.operation.close.numfmt.panel",
470
366
  type: w.OPERATION,
471
367
  handler: () => (
472
368
  // do nothing,just notify panel is closed
473
369
  !0
474
370
  )
475
- }, De = yt("INumfmtController");
476
- pt(F.Rendered, De);
477
- const me = {
371
+ }, Ue = Mt("INumfmtController");
372
+ St(V.Rendered, Ue);
373
+ const pe = {
478
374
  id: "sheet.operation.open.numfmt.panel",
479
375
  type: w.OPERATION,
480
- handler: (e) => (e.get(De).openPanel(), !0)
376
+ handler: (e) => (e.get(Ue).openPanel(), !0)
481
377
  };
482
- var et = { exports: {} }, pe = {};
378
+ var st = { exports: {} }, Se = {};
483
379
  /**
484
380
  * @license React
485
381
  * react-jsx-runtime.production.min.js
@@ -489,23 +385,23 @@ var et = { exports: {} }, pe = {};
489
385
  * This source code is licensed under the MIT license found in the
490
386
  * LICENSE file in the root directory of this source tree.
491
387
  */
492
- var Yt = jt, qt = Symbol.for("react.element"), Jt = Symbol.for("react.fragment"), Zt = Object.prototype.hasOwnProperty, Qt = Yt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Xt = { key: !0, ref: !0, __self: !0, __source: !0 };
493
- function tt(e, t, r) {
494
- var n, s = {}, i = null, c = null;
495
- r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (c = t.ref);
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);
496
392
  for (n in t)
497
- Zt.call(t, n) && !Xt.hasOwnProperty(n) && (s[n] = t[n]);
393
+ Jt.call(t, n) && !Qt.hasOwnProperty(n) && (s[n] = t[n]);
498
394
  if (e && e.defaultProps)
499
395
  for (n in t = e.defaultProps, t)
500
396
  s[n] === void 0 && (s[n] = t[n]);
501
- return { $$typeof: qt, type: e, key: i, ref: c, props: s, _owner: Qt.current };
397
+ return { $$typeof: Yt, type: e, key: i, ref: o, props: s, _owner: Zt.current };
502
398
  }
503
- pe.Fragment = Jt;
504
- pe.jsx = tt;
505
- pe.jsxs = tt;
506
- et.exports = pe;
507
- var d = et.exports;
508
- const je = $t([]), Te = [
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 = [
509
405
  "$",
510
406
  "£",
511
407
  "¥",
@@ -534,12 +430,12 @@ const je = $t([]), Te = [
534
430
  "₾",
535
431
  "₿"
536
432
  ];
537
- var en = Object.defineProperty, tn = Object.getOwnPropertyDescriptor, nn = (e, t, r, n) => {
538
- for (var s = n > 1 ? void 0 : n ? tn(t, r) : t, i = e.length - 1, c; i >= 0; i--)
539
- (c = e[i]) && (s = (n ? c(t, r, s) : c(s)) || s);
540
- return n && s && en(t, r, s), s;
541
- }, rn = (e, t) => (r, n) => t(r, n, e);
542
- let de = class {
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 {
543
439
  constructor(e) {
544
440
  this._localStorageService = e;
545
441
  }
@@ -564,17 +460,17 @@ let de = class {
564
460
  async getHabit(e, t) {
565
461
  const r = this._getKey(e), n = await this._localStorageService.getItem(r);
566
462
  if (t && n) {
567
- const s = n.map((i, c, o) => {
568
- const l = o.length;
463
+ const s = n.map((i, o, a) => {
464
+ const l = a.length;
569
465
  return {
570
466
  value: i,
571
- priority: l - c
467
+ priority: l - o
572
468
  };
573
469
  });
574
- return t.sort((i, c) => {
470
+ return t.sort((i, o) => {
575
471
  var u, m;
576
- const o = ((u = s.find((a) => a.value === i)) == null ? void 0 : u.priority) || -1;
577
- return (((m = s.find((a) => a.value === c)) == null ? void 0 : m.priority) || -1) - o;
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;
578
474
  });
579
475
  }
580
476
  return n || [];
@@ -583,123 +479,123 @@ let de = class {
583
479
  this._localStorageService.removeItem(e);
584
480
  }
585
481
  };
586
- de = nn([
587
- rn(0, S(vt))
588
- ], de);
589
- const Le = "numfmtCurrency", sn = (e) => {
590
- const t = N(de), [r, n] = T(Te);
591
- return xe(() => {
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(() => {
592
488
  t.addHabit("numfmtCurrency", []).then(() => {
593
- t.getHabit(Le, [...Te]).then((i) => {
489
+ t.getHabit(Ve, [...Ee]).then((i) => {
594
490
  n(i), e && e(i);
595
491
  });
596
492
  });
597
493
  }, []), { userHabitCurrency: r, mark: (i) => {
598
- t.markHabit(Le, i);
494
+ t.markHabit(Ve, i);
599
495
  } };
600
- }, cn = () => {
601
- const e = Ye([]), [t, r] = T({});
602
- return xe(() => {
496
+ }, sn = () => {
497
+ const e = Qe([]), [t, r] = I({});
498
+ return Oe(() => {
603
499
  e.current.forEach((s) => {
604
500
  s();
605
501
  }), e.current = [];
606
502
  }, [t]), (s) => {
607
503
  e.current.push(s), r({});
608
504
  };
609
- }, ne = (e) => Te.find((r) => e.includes(r)), an = (e) => !!ne(e) && e.startsWith("_("), on = (e) => {
610
- const [t, r] = T(() => D(e.defaultPattern || "", 2)), n = qe(je), [s, i] = T(() => ne(e.defaultPattern) || n[0]), c = E(() => n.map((a) => ({ label: a, value: a })), []), l = N(I).t;
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;
611
507
  e.action.current = () => C(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
612
- const u = (a) => {
613
- i(a), e.onChange(C(`_("${a}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
614
- }, m = (a) => {
615
- const f = a || 0;
508
+ const u = (c) => {
509
+ i(c), e.onChange(C(`_("${c}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
510
+ }, m = (c) => {
511
+ const f = c || 0;
616
512
  r(f), e.onChange(C(`_("${s}"* #,##0${f > 0 ? ".0" : ""}_)`, f));
617
513
  };
618
514
  return /* @__PURE__ */ d.jsxs("div", { children: [
619
515
  /* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
620
516
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
621
517
  /* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.decimalLength") }),
622
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Ee, { value: t, max: 20, min: 0, onChange: m }) })
518
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(je, { value: t, max: 20, min: 0, onChange: m }) })
623
519
  ] }),
624
520
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
625
521
  /* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.currencyType") }),
626
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(Pe, { onChange: u, options: c, value: s }) })
522
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx($e, { onChange: u, options: o, value: s }) })
627
523
  ] })
628
524
  ] }),
629
525
  /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: l("sheet.numfmt.accountingDes") })
630
526
  ] });
631
- }, be = (e) => Ze.map((t) => ({
527
+ }, Te = (e) => tt.map((t) => ({
632
528
  label: t.label(e),
633
529
  value: t.suffix(e),
634
530
  color: t.color
635
- })), nt = () => zt.map((e) => ({ label: e.label, value: e.suffix })), rt = () => Kt.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), ln = (e) => !!ne(e) && !e.startsWith("_("), un = (e) => {
636
- const r = N(I).t, n = qe(je), [s, i] = T(() => ne(e.defaultPattern) || n[0]), [c, o] = T(() => D(e.defaultPattern || "", 2)), [l, u] = T(() => {
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(() => {
637
533
  var v;
638
- const h = be(s);
639
- return ((v = h.find((b) => fe(b.value, e.defaultPattern))) == null ? void 0 : v.value) || h[0].value;
640
- }), m = E(() => be(s), [s]), a = E(() => n.map((h) => ({ label: h, value: h })), [n]);
641
- e.action.current = () => C(l, c);
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]);
537
+ e.action.current = () => C(l, o);
642
538
  const f = (h) => {
643
539
  i(h);
644
- const p = be(h)[0].value;
645
- u(p), e.onChange(C(p, c));
540
+ const p = Te(h)[0].value;
541
+ u(p), e.onChange(C(p, o));
646
542
  }, _ = (h) => {
647
- u(h), e.onChange(C(h, c));
543
+ u(h), e.onChange(C(h, o));
648
544
  }, g = (h) => {
649
- o(h || 0), e.onChange(C(l, h || 0));
545
+ a(h || 0), e.onChange(C(l, h || 0));
650
546
  };
651
547
  return /* @__PURE__ */ d.jsxs("div", { children: [
652
548
  /* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
653
549
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
654
550
  /* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
655
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Ee, { value: c, max: 20, min: 0, onChange: g }) })
551
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(je, { value: o, max: 20, min: 0, onChange: g }) })
656
552
  ] }),
657
553
  /* @__PURE__ */ d.jsxs("div", { className: "option", children: [
658
554
  /* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
659
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(Pe, { onChange: f, options: a, value: s }) })
555
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx($e, { onChange: f, options: c, value: s }) })
660
556
  ] })
661
557
  ] }),
662
558
  /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
663
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(Re, { onChange: _, options: m, value: l }) }),
559
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: _, options: m, value: l }) }),
664
560
  /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
665
561
  ] });
562
+ }, un = (e) => {
563
+ const t = x.getInfo(e);
564
+ return ot().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
666
565
  }, mn = (e) => {
667
- const t = R.getInfo(e);
668
- return nt().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
669
- }, dn = (e) => {
670
- const t = E(nt, []), n = N(I).t, [s, i] = T(() => {
566
+ const t = R(ot, []), n = N(T).t, [s, i] = I(() => {
671
567
  if (e.defaultPattern) {
672
- const o = t.find((l) => l.value === e.defaultPattern);
673
- if (o)
674
- return o.value;
568
+ const a = t.find((l) => l.value === e.defaultPattern);
569
+ if (a)
570
+ return a.value;
675
571
  }
676
572
  return t[0].value;
677
573
  });
678
574
  e.action.current = () => s;
679
- const c = (o) => {
680
- i(o), e.onChange(o);
575
+ const o = (a) => {
576
+ i(a), e.onChange(a);
681
577
  };
682
578
  return /* @__PURE__ */ d.jsxs("div", { children: [
683
579
  /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
684
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(Re, { value: s, options: t, onChange: c }) }),
580
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { value: s, options: t, onChange: o }) }),
685
581
  /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
686
582
  ] });
687
- }, hn = (e) => !e, fn = (e) => {
688
- const r = N(I).t;
583
+ }, dn = (e) => !e, hn = (e) => {
584
+ const r = N(T).t;
689
585
  return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
690
- }, pn = (e) => rt().some((t) => fe(t.value, e)), vn = (e) => {
691
- const t = N(I), r = E(rt, []), [n, s] = T(() => D(e.defaultPattern || "", 0)), [i, c] = T(() => {
692
- const a = r.find((f) => fe(f.value, e.defaultPattern || ""));
693
- return (a == null ? void 0 : a.value) || r[0].value;
694
- }), o = E(() => C(i, Number(n || 0)), [i, n]), l = E(() => !Gt(i), [i]), u = (a) => {
695
- s(a || 0), e.onChange(C(i, Number(a || 0)));
696
- }, m = (a) => {
697
- s(D(a, 0)), c(a), e.onChange(a);
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)));
592
+ }, m = (c) => {
593
+ s(j(c, 0)), o(c), e.onChange(c);
698
594
  };
699
- return e.action.current = () => o, /* @__PURE__ */ d.jsxs("div", { children: [
595
+ return e.action.current = () => a, /* @__PURE__ */ d.jsxs("div", { children: [
700
596
  /* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
701
597
  /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
702
- Ee,
598
+ je,
703
599
  {
704
600
  disabled: l,
705
601
  value: n,
@@ -712,79 +608,79 @@ const Le = "numfmtCurrency", sn = (e) => {
712
608
  " ",
713
609
  t.t("sheet.numfmt.negType")
714
610
  ] }),
715
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(Re, { onChange: m, options: r, value: i }) }),
611
+ /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: m, options: r, value: i }) }),
716
612
  /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
717
613
  ] });
718
- }, gn = (e) => {
719
- const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(I), c = Ye(() => ""), o = i.t, l = cn(), u = E(
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(
720
616
  () => [
721
- { label: "sheet.numfmt.general", component: fn },
722
- { label: "sheet.numfmt.accounting", component: on },
723
- { label: "sheet.numfmt.currency", component: un },
724
- { label: "sheet.numfmt.date", component: dn },
725
- { label: "sheet.numfmt.thousandthPercentile", component: vn }
726
- ].map((y) => ({ ...y, label: o(y.label) })),
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 }
622
+ ].map((y) => ({ ...y, label: a(y.label) })),
727
623
  []
728
- ), [m, a] = T(v), [f, _] = T(() => `${n}_${s}`), { mark: g, userHabitCurrency: h } = sn(() => _(`${n}_${s}_userCurrency'`)), p = E(() => {
624
+ ), [m, c] = I(v), [f, _] = I(() => `${n}_${s}`), { mark: g, userHabitCurrency: h } = rn(() => _(`${n}_${s}_userCurrency'`)), p = R(() => {
729
625
  var y;
730
- return (y = u.find((L) => L.label === m)) == null ? void 0 : y.component;
626
+ return (y = u.find((U) => U.label === m)) == null ? void 0 : y.component;
731
627
  }, [m]);
732
628
  function v() {
733
- return [hn, an, ln, mn, pn].reduce((L, at, ot) => L || (at(r) ? u[ot].label : ""), "") || u[0].label;
629
+ return [dn, on, an, un, fn].reduce((U, mt, dt) => U || (mt(r) ? u[dt].label : ""), "") || u[0].label;
734
630
  }
735
631
  const b = u.map((y) => ({
736
632
  label: y.label,
737
633
  value: y.label
738
- })), W = (y) => {
739
- a(y), l(() => e.onChange({ type: "change", value: c.current() || "" }));
740
- }, re = (y) => {
634
+ })), F = (y) => {
635
+ c(y), l(() => e.onChange({ type: "change", value: o.current() || "" }));
636
+ }, ce = (y) => {
741
637
  e.onChange({ type: "change", value: y });
742
- }, ve = () => {
743
- const y = c.current() || "", L = ne(y);
744
- L && g(L), e.onChange({ type: "confirm", value: y });
745
- }, ge = () => {
638
+ }, be = () => {
639
+ const y = o.current() || "", U = oe(y);
640
+ U && g(U), e.onChange({ type: "confirm", value: y });
641
+ }, ye = () => {
746
642
  e.onChange({ type: "cancel", value: "" });
747
- }, _e = {
748
- onChange: re,
643
+ }, Ce = {
644
+ onChange: ce,
749
645
  defaultValue: t,
750
646
  defaultPattern: r,
751
- action: c
647
+ action: o
752
648
  };
753
- return xe(() => {
754
- a(v()), _(`${n}_${s}`);
649
+ return Oe(() => {
650
+ c(v()), _(`${n}_${s}`);
755
651
  }, [n, s]), /* @__PURE__ */ d.jsxs("div", { className: "numfmt-panel p-b-20", children: [
756
652
  /* @__PURE__ */ d.jsxs("div", { children: [
757
- /* @__PURE__ */ d.jsx("div", { className: "label m-t-14", children: o("sheet.numfmt.numfmtType") }),
758
- /* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(Pe, { onChange: W, options: b, value: m }) }),
759
- /* @__PURE__ */ d.jsx("div", { children: p && /* @__PURE__ */ d.jsx(je.Provider, { value: h, children: /* @__PURE__ */ wt(p, { ..._e, key: f }) }) })
653
+ /* @__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 }) }) })
760
656
  ] }),
761
657
  /* @__PURE__ */ d.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
762
- /* @__PURE__ */ d.jsx(we, { size: "small", onClick: ge, className: "m-r-12", children: o("sheet.numfmt.cancel") }),
763
- /* @__PURE__ */ d.jsx(we, { type: "primary", size: "small", onClick: ve, children: o("sheet.numfmt.confirm") })
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") })
764
660
  ] })
765
661
  ] });
766
- }, st = {
662
+ }, at = {
767
663
  id: "sheet.command.numfmt.set.percent",
768
664
  type: w.COMMAND,
769
665
  handler: async (e) => {
770
- const t = e.get(O), n = e.get(U).getSelections();
666
+ const t = e.get(O), n = e.get(D).getSelections();
771
667
  if (!n || !n.length)
772
668
  return !1;
773
669
  const s = [], i = "0%";
774
- return n.forEach((o) => {
775
- P.foreach(o.range, (l, u) => {
670
+ return n.forEach((a) => {
671
+ P.foreach(a.range, (l, u) => {
776
672
  s.push({ row: l, col: u, pattern: i, type: "percent" });
777
673
  });
778
674
  }), await t.executeCommand($.id, { values: s });
779
675
  }
780
676
  };
781
- var _n = Object.defineProperty, Sn = Object.getOwnPropertyDescriptor, bn = (e, t, r, n) => {
782
- for (var s = n > 1 ? void 0 : n ? Sn(t, r) : t, i = e.length - 1, c; i >= 0; i--)
783
- (c = e[i]) && (s = (n ? c(t, r, s) : c(s)) || s);
784
- return n && s && _n(t, r, s), s;
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;
785
681
  }, M = (e, t) => (r, n) => t(r, n, e);
786
- let ce = class extends Y {
787
- constructor(t, r, n, s, i, c, o, l, u, m, a) {
682
+ let ue = class extends Y {
683
+ constructor(t, r, n, s, i, o, a, l, u, m, c) {
788
684
  super();
789
685
  /**
790
686
  * If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
@@ -792,15 +688,15 @@ let ce = class extends Y {
792
688
  * @type {(string | null)}
793
689
  * @memberof NumfmtController
794
690
  */
795
- j(this, "_previewPattern", "");
796
- j(this, "_sidebarDisposable", null);
797
- this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._selectionManagerService = c, this._renderManagerService = o, this._numfmtService = l, this._componentManager = u, this._sidebarService = m, this._localeService = a, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener();
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();
798
694
  }
799
695
  openPanel() {
800
- const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService, c = this._localeService, l = (r.getSelectionRanges() || [])[0];
696
+ const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService, l = (r.getSelectionRanges() || [])[0];
801
697
  if (!l)
802
698
  return !1;
803
- const u = s.getCurrentUnitForType(x.UNIVER_SHEET), m = u.getActiveSheet(), a = m.getCellRaw(l.startRow, l.startColumn), f = i.getValue(
699
+ const u = s.getCurrentUnitForType(E.UNIVER_SHEET), m = u.getActiveSheet(), c = m.getCellRaw(l.startRow, l.startColumn), f = i.getValue(
804
700
  u.getUnitId(),
805
701
  m.getSheetId(),
806
702
  l.startRow,
@@ -808,104 +704,104 @@ let ce = class extends Y {
808
704
  );
809
705
  let _ = "";
810
706
  f && (_ = f.pattern);
811
- const g = (a == null ? void 0 : a.t) === B.NUMBER ? a.v : 12345678, h = {
707
+ const g = (c == null ? void 0 : c.t) === B.NUMBER ? c.v : 12345678, h = {
812
708
  onChange: (p) => {
813
709
  var v, b;
814
710
  if (p.type === "change")
815
711
  this._previewPattern = p.value, this._sheetSkeletonManagerService.reCalculate(), (b = (v = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : v.mainComponent) == null || b.makeDirty();
816
712
  else if (p.type === "confirm") {
817
- const W = r.getSelectionRanges() || [], re = { values: [] }, ve = ue(p.value);
818
- W.forEach((ge) => {
819
- P.foreach(ge, (_e, y) => {
820
- re.values.push({
821
- row: _e,
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,
822
718
  col: y,
823
719
  pattern: p.value,
824
- type: ve
720
+ type: be
825
721
  });
826
722
  });
827
- }), n.executeCommand($.id, re), t.close();
723
+ }), n.executeCommand($.id, ce), t.close();
828
724
  } else
829
725
  p.type === "cancel" && t.close();
830
726
  },
831
727
  value: { defaultPattern: _, defaultValue: g, row: l.startRow, col: l.startColumn }
832
728
  };
833
729
  return this._sidebarDisposable = t.open({
834
- header: { title: c.t("sheet.numfmt.title") },
730
+ header: { title: o.t("sheet.numfmt.title") },
835
731
  children: {
836
- label: Ce,
732
+ label: Ne,
837
733
  ...h
838
734
  // need passthrough to react props.
839
735
  },
840
736
  onClose: () => {
841
737
  var p, v;
842
- this._sheetSkeletonManagerService.reCalculate(), (v = (p = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : p.mainComponent) == null || v.makeDirty(), n.executeCommand(Se.id);
738
+ this._sheetSkeletonManagerService.reCalculate(), (v = (p = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : p.mainComponent) == null || v.makeDirty(), n.executeCommand(Ie.id);
843
739
  }
844
740
  }), !0;
845
741
  }
846
742
  _initCommands() {
847
743
  [
848
- Je,
849
- Xe,
850
- Qe,
851
- st,
852
- me,
853
- Se,
744
+ et,
745
+ rt,
746
+ nt,
747
+ at,
748
+ pe,
749
+ Ie,
854
750
  $
855
751
  ].forEach((t) => {
856
752
  this.disposeWithMe(this._commandService.registerCommand(t));
857
753
  });
858
754
  }
859
755
  _initPanel() {
860
- this._componentManager.register(Ce, gn);
756
+ this._componentManager.register(Ne, vn);
861
757
  }
862
758
  _initRealTimeRenderingInterceptor() {
863
759
  const t = new G((n) => {
864
760
  this._commandService.onCommandExecuted((s) => {
865
- s.id === me.id && n.next(!0), s.id === Se.id && n.next(!1);
761
+ s.id === pe.id && n.next(!0), s.id === Ie.id && n.next(!1);
866
762
  });
867
- }), r = Dt([
763
+ }), r = Ut([
868
764
  t,
869
765
  this._selectionManagerService.selectionMoveEnd$.pipe(
870
- Ge((n) => n ? n.map((s) => s.range) : [])
766
+ qe((n) => n ? n.map((s) => s.range) : [])
871
767
  )
872
768
  ]);
873
769
  this.disposeWithMe(
874
770
  K(
875
771
  r.pipe(
876
- Mt(
772
+ Pt(
877
773
  ([n, s]) => new G((i) => {
878
- const c = new gt();
879
- return n && s.length && i.next({ selectionRanges: s, disposableCollection: c }), () => {
880
- c.dispose();
774
+ const o = new yt();
775
+ return n && s.length && i.next({ selectionRanges: s, disposableCollection: o }), () => {
776
+ o.dispose();
881
777
  };
882
778
  })
883
779
  ),
884
- Nt(() => {
780
+ xt(() => {
885
781
  this._previewPattern = null;
886
782
  })
887
783
  ).subscribe(({ disposableCollection: n, selectionRanges: s }) => {
888
- var c, o;
889
- const i = this._univerInstanceService.getCurrentUnitForType(x.UNIVER_SHEET);
784
+ var o, a;
785
+ const i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
890
786
  this.openPanel(), n.add(
891
- this._sheetInterceptorService.intercept(We.CELL_CONTENT, {
787
+ this._sheetInterceptorService.intercept(Ke.CELL_CONTENT, {
892
788
  priority: 99,
893
789
  handler: (l, u, m) => {
894
- const { row: a, col: f } = u, _ = m(l) || {};
790
+ const { row: c, col: f } = u, _ = m(l) || {};
895
791
  if (s.find(
896
- (g) => g.startColumn <= f && g.endColumn >= f && g.startRow <= a && g.endRow >= a
792
+ (g) => g.startColumn <= f && g.endColumn >= f && g.startRow <= c && g.endRow >= c
897
793
  )) {
898
- const g = u.worksheet.getCellRaw(a, f), h = g == null ? void 0 : g.v, p = g == null ? void 0 : g.t;
794
+ const g = u.worksheet.getCellRaw(c, f), h = g == null ? void 0 : g.v, p = g == null ? void 0 : g.t;
899
795
  if (h == null || p !== B.NUMBER || this._previewPattern === null)
900
796
  return _;
901
- const v = Oe(this._previewPattern, h, this._localeService.getCurrentLocale());
797
+ const v = De(this._previewPattern, h, this._localeService.getCurrentLocale());
902
798
  if (v.color) {
903
- const W = this._themeService.getCurrentTheme()[`${v.color}500`];
799
+ const F = this._themeService.getCurrentTheme()[`${v.color}500`];
904
800
  return {
905
801
  ..._,
906
802
  v: v.result,
907
803
  t: B.STRING,
908
- s: { cl: { rgb: W } }
804
+ s: { cl: { rgb: F } }
909
805
  };
910
806
  }
911
807
  return {
@@ -917,16 +813,16 @@ let ce = class extends Y {
917
813
  return _;
918
814
  }
919
815
  })
920
- ), (o = (c = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : c.mainComponent) == null || o.makeDirty();
816
+ ), (a = (o = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : o.mainComponent) == null || a.makeDirty();
921
817
  })
922
818
  )
923
819
  );
924
820
  }
925
821
  _commandExecutedListener() {
926
- const t = [he.id, J.id];
822
+ const t = [ge.id, J.id];
927
823
  this.disposeWithMe(
928
824
  K(
929
- Ke(
825
+ Ze(
930
826
  new G((r) => {
931
827
  const n = this._commandService.onCommandExecuted((s) => {
932
828
  if (t.includes(s.id)) {
@@ -938,7 +834,7 @@ let ce = class extends Y {
938
834
  n.dispose();
939
835
  };
940
836
  })
941
- ).pipe(xt(16)).subscribe((r) => {
837
+ ).pipe(Ot(16)).subscribe((r) => {
942
838
  var n, s;
943
839
  this._sheetSkeletonManagerService.reCalculate(), (s = (n = this._renderManagerService.getRenderById(r)) == null ? void 0 : n.mainComponent) == null || s.makeDirty();
944
840
  })
@@ -946,46 +842,46 @@ let ce = class extends Y {
946
842
  );
947
843
  }
948
844
  _initCloseListener() {
949
- this._univerInstanceService.getCurrentTypeOfUnit$(x.UNIVER_SHEET).subscribe((t) => {
845
+ this._univerInstanceService.getCurrentTypeOfUnit$(E.UNIVER_SHEET).subscribe((t) => {
950
846
  var r;
951
847
  t || ((r = this._sidebarDisposable) == null || r.dispose(), this._sidebarDisposable = null);
952
848
  });
953
849
  }
954
850
  };
955
- ce = bn([
956
- q(F.Rendered, ce),
957
- M(0, S(Me)),
958
- M(1, S(Be)),
959
- M(2, V),
960
- M(3, S(ke)),
851
+ ue = Sn([
852
+ q(V.Rendered, ue),
853
+ M(0, S(Pe)),
854
+ M(1, S(Fe)),
855
+ M(2, k),
856
+ M(3, S(Ye)),
961
857
  M(4, O),
962
- M(5, S(U)),
963
- M(6, Et),
858
+ M(5, S(D)),
859
+ M(6, jt),
964
860
  M(7, H),
965
- M(8, S(ze)),
966
- M(9, Rt),
967
- M(10, S(I))
968
- ], ce);
969
- var yn = Object.defineProperty, Cn = Object.getOwnPropertyDescriptor, Tn = (e, t, r, n) => {
970
- for (var s = n > 1 ? void 0 : n ? Cn(t, r) : t, i = e.length - 1, c; i >= 0; i--)
971
- (c = e[i]) && (s = (n ? c(t, r, s) : c(s)) || s);
972
- return n && s && yn(t, r, s), s;
973
- }, k = (e, t) => (r, n) => t(r, n, e);
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);
974
870
  const In = () => {
975
871
  let e = [];
976
872
  return {
977
- add: (s, i, c, o, l) => e.push({ unitId: s, subUnitId: i, row: c, col: o, value: l }),
873
+ add: (s, i, o, a, l) => e.push({ unitId: s, subUnitId: i, row: o, col: a, value: l }),
978
874
  getEffects: () => e,
979
875
  clean: () => {
980
876
  e = [];
981
877
  }
982
878
  };
983
879
  };
984
- let ae = class extends Y {
880
+ let me = class extends Y {
985
881
  constructor(t, r, n, s, i) {
986
882
  super();
987
883
  // collect effect mutations when edit end and push this to commands stack in next commands progress
988
- j(this, "_collectEffectMutation", In());
884
+ L(this, "_collectEffectMutation", In());
989
885
  this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
990
886
  }
991
887
  _initInterceptorEditorStart() {
@@ -995,14 +891,14 @@ let ae = class extends Y {
995
891
  this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
996
892
  {
997
893
  handler: (t, r, n) => {
998
- const s = r.row, i = r.col, c = this._numfmtService.getValue(
894
+ const s = r.row, i = r.col, o = this._numfmtService.getValue(
999
895
  r.unitId,
1000
896
  r.subUnitId,
1001
897
  s,
1002
898
  i
1003
899
  );
1004
- if (c)
1005
- switch (ue(c.pattern)) {
900
+ if (o)
901
+ switch (fe(o.pattern)) {
1006
902
  case "scientific":
1007
903
  case "percent":
1008
904
  case "currency":
@@ -1041,7 +937,7 @@ let ae = class extends Y {
1041
937
  r.subUnitId,
1042
938
  r.row,
1043
939
  r.col
1044
- ), i = (m = s && ue(s.pattern)) != null ? m : "", c = () => {
940
+ ), i = (m = s && fe(s.pattern)) != null ? m : "", o = () => {
1045
941
  s && this._collectEffectMutation.add(
1046
942
  r.unitId,
1047
943
  r.subUnitId,
@@ -1052,10 +948,10 @@ let ae = class extends Y {
1052
948
  };
1053
949
  if (!(t != null && t.v))
1054
950
  return n(t);
1055
- const o = String(t.v), l = R.parseDate(o) || R.parseTime(o);
951
+ const a = String(t.v), l = x.parseDate(a) || x.parseTime(a);
1056
952
  if (!!l) {
1057
953
  if (l && l.z) {
1058
- const a = Number(l.v);
954
+ const c = Number(l.v);
1059
955
  return this._collectEffectMutation.add(
1060
956
  r.unitId,
1061
957
  r.subUnitId,
@@ -1064,10 +960,10 @@ let ae = class extends Y {
1064
960
  {
1065
961
  pattern: l.z
1066
962
  }
1067
- ), { ...t, v: a, t: B.NUMBER };
963
+ ), { ...t, v: c, t: B.NUMBER };
1068
964
  }
1069
965
  } else
1070
- (["date", "time", "datetime"].includes(i) || !Mn(o)) && c();
966
+ (["date", "time", "datetime"].includes(i) || !Tn(a)) && o();
1071
967
  return n(t);
1072
968
  }
1073
969
  }
@@ -1081,46 +977,46 @@ let ae = class extends Y {
1081
977
  this._sheetInterceptorService.interceptCommand({
1082
978
  getMutations(r) {
1083
979
  switch (r.id) {
1084
- case bt.id: {
1085
- const n = t._univerInstanceService.getCurrentUnitForType(x.UNIVER_SHEET), s = n.getUnitId(), i = n.getActiveSheet().getSheetId(), c = t._collectEffectMutation.getEffects();
1086
- if (!c.length)
980
+ case Tt.id: {
981
+ const n = t._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET), s = n.getUnitId(), i = n.getActiveSheet().getSheetId(), o = t._collectEffectMutation.getEffects();
982
+ if (!o.length)
1087
983
  return {
1088
984
  redos: [],
1089
985
  undos: []
1090
986
  };
1091
- const o = c.filter((a) => {
987
+ const a = o.filter((c) => {
1092
988
  var f;
1093
- return !!((f = a.value) != null && f.pattern);
1094
- }).map((a) => ({
1095
- row: a.row,
1096
- col: a.col,
1097
- pattern: a.value.pattern
1098
- })), l = c.filter((a) => {
989
+ return !!((f = c.value) != null && f.pattern);
990
+ }).map((c) => ({
991
+ row: c.row,
992
+ col: c.col,
993
+ pattern: c.value.pattern
994
+ })), l = o.filter((c) => {
1099
995
  var f;
1100
- return !((f = a.value) != null && f.pattern);
1101
- }).map((a) => ({
1102
- startRow: a.row,
1103
- endColumn: a.col,
1104
- startColumn: a.col,
1105
- endRow: a.row
996
+ return !((f = c.value) != null && f.pattern);
997
+ }).map((c) => ({
998
+ startRow: c.row,
999
+ endColumn: c.col,
1000
+ startColumn: c.col,
1001
+ endRow: c.row
1106
1002
  })), u = [], m = [];
1107
- if (o) {
1108
- const a = {
1003
+ if (a) {
1004
+ const c = {
1109
1005
  id: J.id,
1110
- params: Ve(s, i, o)
1006
+ params: We(s, i, a)
1111
1007
  };
1112
- u.push(a), m.push(...Fe(t._injector, a.params));
1008
+ u.push(c), m.push(...Ge(t._injector, c.params));
1113
1009
  }
1114
1010
  if (l) {
1115
- const a = {
1116
- id: he.id,
1011
+ const c = {
1012
+ id: ge.id,
1117
1013
  params: {
1118
1014
  unitId: s,
1119
1015
  subUnitId: i,
1120
1016
  ranges: l
1121
1017
  }
1122
1018
  };
1123
- u.push(a), m.push(...He(t._injector, a.params));
1019
+ u.push(c), m.push(...ze(t._injector, c.params));
1124
1020
  }
1125
1021
  return {
1126
1022
  redos: u,
@@ -1137,36 +1033,32 @@ let ae = class extends Y {
1137
1033
  );
1138
1034
  }
1139
1035
  };
1140
- ae = Tn([
1141
- q(F.Rendered, ae),
1142
- k(0, S(Me)),
1143
- k(1, S(H)),
1144
- k(2, S(V)),
1145
- k(3, S(Ne)),
1146
- k(4, S(Ct))
1147
- ], ae);
1148
- function Mn(e) {
1036
+ me = Cn([
1037
+ q(V.Rendered, me),
1038
+ W(0, S(Pe)),
1039
+ 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) {
1149
1045
  return /^-?\d+(\.\d+)?$/.test(e);
1150
1046
  }
1151
- var Nn = Object.defineProperty, xn = Object.getOwnPropertyDescriptor, En = (e, t, r, n) => {
1152
- for (var s = n > 1 ? void 0 : n ? xn(t, r) : t, i = e.length - 1, c; i >= 0; i--)
1153
- (c = e[i]) && (s = (n ? c(t, r, s) : c(s)) || s);
1154
- return n && s && Nn(t, r, s), s;
1155
- }, Pn = (e, t) => (r, n) => t(r, n, e);
1156
- let oe = class extends Y {
1157
- constructor(t) {
1158
- super();
1159
- j(this, "_initLocal", () => {
1160
- this._localeService.load({ zhCN: Vt, enUS: At });
1161
- });
1162
- this._localeService = t, this._initLocal();
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 {
1053
+ constructor(e) {
1054
+ super(), this._localeService = e;
1163
1055
  }
1164
1056
  };
1165
- oe = En([
1166
- q(F.Rendered, oe),
1167
- Pn(0, S(I))
1168
- ], oe);
1169
- const le = [
1057
+ de = En([
1058
+ q(V.Rendered, de),
1059
+ Rn(0, S(T))
1060
+ ], de);
1061
+ const he = [
1170
1062
  {
1171
1063
  label: "sheet.numfmt.general",
1172
1064
  pattern: null
@@ -1219,30 +1111,30 @@ const le = [
1219
1111
  label: "sheet.numfmt.moreFmt",
1220
1112
  pattern: ""
1221
1113
  }
1222
- ], it = "sheet.numfmt.moreNumfmtType", ct = "sheet.numfmt.moreNumfmtType.options", Rn = (e) => {
1114
+ ], lt = "sheet.numfmt.moreNumfmtType", ut = "sheet.numfmt.moreNumfmtType.options", Pn = (e) => {
1223
1115
  var n;
1224
- const t = N(I), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
1116
+ const t = N(T), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
1225
1117
  return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children: r });
1226
- }, On = () => {
1227
- const e = N(O), t = N(I), r = Ut(), n = N(U), s = (o) => {
1118
+ }, xn = () => {
1119
+ const e = N(O), t = N(T), r = kt(), n = N(D), s = (a) => {
1228
1120
  const l = n.getLast();
1229
1121
  if (!l)
1230
1122
  return;
1231
- const u = r.get(Pt), m = l.range, a = [];
1123
+ const u = r.get($t), m = l.range, c = [];
1232
1124
  P.foreach(m, (f, _) => {
1233
- o ? a.push({ row: f, col: _, pattern: o, type: ue(o) }) : a.push({ row: f, col: _ });
1234
- }), e.executeCommand($.id, { values: a }), u.focus();
1235
- }, i = (o) => {
1236
- if (o === 0)
1125
+ a ? c.push({ row: f, col: _, pattern: a, type: fe(a) }) : c.push({ row: f, col: _ });
1126
+ }), e.executeCommand($.id, { values: c }), u.focus();
1127
+ }, i = (a) => {
1128
+ if (a === 0)
1237
1129
  s(null);
1238
- else if (o === le.length - 1)
1239
- e.executeCommand(me.id);
1130
+ else if (a === he.length - 1)
1131
+ e.executeCommand(pe.id);
1240
1132
  else {
1241
- const l = le[o];
1133
+ const l = he[a];
1242
1134
  l.pattern && s(l.pattern);
1243
1135
  }
1244
- }, c = 1220;
1245
- return /* @__PURE__ */ d.jsx("div", { className: "more-numfmt-type-options", children: le.map((o, l) => o === "|" ? /* @__PURE__ */ d.jsx("div", { className: "line m-t-4", onClick: (u) => u.stopPropagation() }, l) : /* @__PURE__ */ d.jsxs(
1136
+ }, 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(
1246
1138
  "div",
1247
1139
  {
1248
1140
  className: "option-item m-t-4",
@@ -1250,70 +1142,70 @@ const le = [
1250
1142
  i(l);
1251
1143
  },
1252
1144
  children: [
1253
- /* @__PURE__ */ d.jsx("div", { children: t.t(o.label) }),
1254
- /* @__PURE__ */ d.jsx("div", { className: "m-l-26", children: o.pattern ? Oe(o.pattern || "", c, t.getCurrentLocale()).result : "" })
1145
+ /* @__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 : "" })
1255
1147
  ]
1256
1148
  },
1257
1149
  l
1258
1150
  )) });
1259
- }, Dn = (e) => ({
1151
+ }, On = (e) => ({
1260
1152
  icon: "RmbSingle",
1261
- id: Qe.id,
1153
+ id: nt.id,
1262
1154
  title: "sheet.numfmt.currency",
1263
1155
  tooltip: "sheet.numfmt.currency",
1264
- type: Q.BUTTON,
1265
- group: X.TOOLBAR_FORMULAS_INSERT,
1266
- positions: [ee.TOOLBAR_START],
1267
- hidden$: te(e, x.UNIVER_SHEET),
1268
- disabled$: Z(e)
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] })
1269
1161
  }), jn = (e) => ({
1270
1162
  icon: "AddDigitsSingle",
1271
- id: Je.id,
1163
+ id: et.id,
1272
1164
  title: "sheet.numfmt.addDecimal",
1273
1165
  tooltip: "sheet.numfmt.addDecimal",
1274
- type: Q.BUTTON,
1275
- positions: [ee.TOOLBAR_START],
1276
- group: X.TOOLBAR_FORMULAS_INSERT,
1277
- hidden$: te(e, x.UNIVER_SHEET),
1278
- disabled$: Z(e)
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] })
1279
1171
  }), $n = (e) => ({
1280
1172
  icon: "ReduceDigitsSingle",
1281
- id: Xe.id,
1173
+ id: rt.id,
1282
1174
  title: "sheet.numfmt.subtractDecimal",
1283
1175
  tooltip: "sheet.numfmt.subtractDecimal",
1284
- type: Q.BUTTON,
1285
- group: X.TOOLBAR_FORMULAS_INSERT,
1286
- positions: [ee.TOOLBAR_START],
1287
- hidden$: te(e, x.UNIVER_SHEET),
1288
- disabled$: Z(e)
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] })
1289
1181
  }), wn = (e) => ({
1290
1182
  icon: "PercentSingle",
1291
- id: st.id,
1183
+ id: at.id,
1292
1184
  title: "sheet.numfmt.percent",
1293
1185
  tooltip: "sheet.numfmt.percent",
1294
- type: Q.BUTTON,
1295
- group: X.TOOLBAR_FORMULAS_INSERT,
1296
- positions: [ee.TOOLBAR_START],
1297
- hidden$: te(e, x.UNIVER_SHEET),
1298
- disabled$: Z(e)
1299
- }), Un = (e) => {
1300
- const t = e.get(H), r = e.get(V), n = e.get(O), s = e.get(I), i = e.get(U), c = Tt(r, "", ({ workbook: o, worksheet: l }) => new G(
1301
- (u) => Ke(
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(
1302
1194
  i.selectionMoveEnd$,
1303
1195
  new G((m) => {
1304
- const a = [he.id, J.id], f = n.onCommandExecuted((_) => {
1305
- a.includes(_.id) && m.next(null);
1196
+ const c = [ge.id, J.id], f = n.onCommandExecuted((_) => {
1197
+ c.includes(_.id) && m.next(null);
1306
1198
  });
1307
1199
  return () => f.dispose();
1308
1200
  })
1309
1201
  ).subscribe(() => {
1310
1202
  const m = i.getSelections();
1311
1203
  if (m && m[0]) {
1312
- const a = m[0].range, f = a.startRow, _ = a.startColumn, g = t.getValue(o.getUnitId(), l.getSheetId(), f, _), h = g == null ? void 0 : g.pattern;
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;
1313
1205
  let p = s.t("sheet.numfmt.general");
1314
1206
  if (h) {
1315
- const v = le.filter((b) => typeof b == "object" && b.pattern).find(
1316
- (b) => fe(h, b.pattern)
1207
+ const v = he.filter((b) => typeof b == "object" && b.pattern).find(
1208
+ (b) => _e(h, b.pattern)
1317
1209
  );
1318
1210
  v && typeof v == "object" && v.pattern ? p = s.t(v.label) : p = s.t("sheet.numfmt.moreFmt");
1319
1211
  }
@@ -1322,59 +1214,59 @@ const le = [
1322
1214
  })
1323
1215
  ));
1324
1216
  return {
1325
- label: it,
1326
- id: me.id,
1217
+ label: lt,
1218
+ id: pe.id,
1327
1219
  tooltip: "sheet.numfmt.title",
1328
- type: Q.SELECTOR,
1329
- group: X.TOOLBAR_FORMULAS_INSERT,
1330
- positions: [ee.TOOLBAR_START],
1220
+ type: ne.SELECTOR,
1221
+ group: re.TOOLBAR_FORMULAS_INSERT,
1222
+ positions: [se.TOOLBAR_START],
1331
1223
  selections: [
1332
1224
  {
1333
1225
  label: {
1334
- name: ct,
1226
+ name: ut,
1335
1227
  hoverable: !1
1336
1228
  }
1337
1229
  }
1338
1230
  ],
1339
- value$: c,
1340
- hidden$: te(e, x.UNIVER_SHEET),
1341
- disabled$: Z(e)
1231
+ value$: o,
1232
+ hidden$: ie(e, E.UNIVER_SHEET),
1233
+ disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [X, Q], rangeTypes: [ee] })
1342
1234
  };
1343
1235
  };
1344
- var Ln = Object.defineProperty, An = Object.getOwnPropertyDescriptor, Bn = (e, t, r, n) => {
1345
- for (var s = n > 1 ? void 0 : n ? An(t, r) : t, i = e.length - 1, c; i >= 0; i--)
1346
- (c = e[i]) && (s = (n ? c(t, r, s) : c(s)) || s);
1347
- return n && s && Ln(t, r, s), s;
1348
- }, ye = (e, t) => (r, n) => t(r, n, e);
1349
- const Vn = {};
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 = {};
1350
1242
  let z = class extends Y {
1351
1243
  constructor(e, t, r, n) {
1352
1244
  super(), this._config = e, this._injector = t, this._componentManager = r, this._menuService = n, this._initMenu();
1353
1245
  }
1354
1246
  _initMenu() {
1355
1247
  const { menu: e = {} } = this._config;
1356
- [wn, jn, $n, Dn, Un].forEach((t) => {
1248
+ [wn, jn, $n, On, Dn].forEach((t) => {
1357
1249
  this.disposeWithMe(this._menuService.addMenuItem(t(this._injector), e));
1358
- }), this.disposeWithMe(this._componentManager.register(it, Rn)), this.disposeWithMe(this._componentManager.register(ct, On));
1250
+ }), this.disposeWithMe(this._componentManager.register(lt, Pn)), this.disposeWithMe(this._componentManager.register(ut, xn));
1359
1251
  }
1360
1252
  };
1361
- z = Bn([
1362
- q(F.Rendered, z),
1363
- ye(1, S(Ne)),
1364
- ye(2, S(ze)),
1365
- ye(3, S(Ot))
1253
+ z = An([
1254
+ q(V.Rendered, z),
1255
+ Me(1, S(xe)),
1256
+ Me(2, S(Je)),
1257
+ Me(3, S(Dt))
1366
1258
  ], z);
1367
- var Fn = Object.defineProperty, Hn = Object.getOwnPropertyDescriptor, Wn = (e, t, r, n) => {
1368
- for (var s = n > 1 ? void 0 : n ? Hn(t, r) : t, i = e.length - 1, c; i >= 0; i--)
1369
- (c = e[i]) && (s = (n ? c(t, r, s) : c(s)) || s);
1370
- return n && s && Fn(t, r, s), s;
1371
- }, kn = (e, t) => (r, n) => t(r, n, e), se;
1372
- let Ae = (se = class extends _t {
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 {
1373
1265
  constructor(e = {}, t) {
1374
- super(), this._config = e, this._injector = t, this._config = St.deepMerge({}, Vn, this._config);
1266
+ super(), this._config = e, this._injector = t, this._config = It.deepMerge({}, Bn, this._config);
1375
1267
  }
1376
1268
  onStarting() {
1377
- this._injector.add([De, { useClass: ce, lazy: !1 }]), this._injector.add([ae]), this._injector.add([de]), this._injector.add([ie]), this._injector.add([oe]), this._injector.add(
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(
1378
1270
  [
1379
1271
  z,
1380
1272
  {
@@ -1383,15 +1275,12 @@ let Ae = (se = class extends _t {
1383
1275
  ]
1384
1276
  );
1385
1277
  }
1386
- }, j(se, "pluginName", Ce), j(se, "type", x.UNIVER_SHEET), se);
1387
- Ae = Wn([
1388
- kn(1, S(Ne))
1389
- ], Ae);
1278
+ }, L(ae, "pluginName", Ne), L(ae, "type", E.UNIVER_SHEET), ae);
1279
+ He = Hn([
1280
+ Fn(1, S(xe))
1281
+ ], He);
1390
1282
  export {
1391
1283
  $ as SetNumfmtCommand,
1392
- Ae as UniverSheetsNumfmtPlugin,
1393
- At as enUS,
1394
- Oe as getPatternPreview,
1395
- sr as ruRU,
1396
- Vt as zhCN
1284
+ He as UniverSheetsNumfmtPlugin,
1285
+ De as getPatternPreview
1397
1286
  };