@univerjs/sheets-numfmt-ui 0.10.12 → 0.10.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/index.js CHANGED
@@ -1,26 +1,26 @@
1
- var dt = Object.defineProperty;
2
- var ht = (e, t, r) => t in e ? dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var q = (e, t, r) => ht(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { Inject as y, LocaleService as E, IConfigService as $e, Disposable as ne, isTextFormat as De, Tools as vt, isRealNum as Fe, CommandType as Le, ILocalStorageService as Ae, isPatternEqualWithoutDecimal as re, numfmt as ft, ThemeService as pt, IUniverInstanceService as ve, ICommandService as fe, UniverInstanceType as w, CellValueType as x, toDisposable as de, DisposableCollection as gt, InterceptorEffectEnum as we, Range as He, Injector as je, Optional as _t, getNumfmtParseValueFilter as St, willLoseNumericPrecision as yt, fromCallback as Ct, isDefaultFormat as bt, DEFAULT_TEXT_FORMAT_EXCEL as It, DependentOn as Nt, Plugin as Et, merge as Tt, registerDependencies as wt, touchDependencies as Mt } from "@univerjs/core";
5
- import { IRenderManagerService as Be } from "@univerjs/engine-render";
6
- import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Pt, currencySymbols as Me, getDecimalFromPattern as J, getCurrencyType as V, setPatternDecimal as k, getCurrencyFormatOptions as oe, CURRENCYFORMAT as xt, DATEFMTLISG as Rt, NUMBERFORMAT as Ot, getDateFormatOptions as Ve, getNumberFormatOptions as We, isPatternHasDecimal as kt, SheetsNumfmtCellContentController as Ge, getPatternPreviewIgnoreGeneral as Ut, getPatternType as pe, SetNumfmtCommand as Ke, getCurrencySymbolByLocale as $t, SetPercentCommand as Ze, SubtractDecimalCommand as Ye, AddDecimalCommand as ze, SetCurrencyCommand as Xe, getCurrencySymbolIconByLocale as Pe, localeCurrencySymbolMap as Dt, getPatternPreview as Ft, UniverSheetsNumfmtPlugin as Lt } from "@univerjs/sheets-numfmt";
7
- import { HoverManagerService as At, CellAlertManagerService as Ht, CellAlertType as jt, SheetSkeletonManagerService as Bt, IEditorBridgeService as Vt, deriveStateFromActiveSheet$ as Wt, getCurrentRangeDisable$ as W, UniverSheetsUIPlugin as Gt } from "@univerjs/sheets-ui";
8
- import { INumfmtService as ge, SheetInterceptorService as qe, SheetsSelectionsService as _e, INTERCEPTOR_POINT as Kt, RemoveNumfmtMutation as Se, SetNumfmtMutation as ye, BEFORE_CELL_EDIT as Zt, AFTER_CELL_EDIT as Yt, SetRangeValuesCommand as zt, transformCellsToRange as Xt, factorySetNumfmtUndoMutation as qt, factoryRemoveNumfmtUndoMutation as Jt, RangeProtectionPermissionEditPoint as G, WorksheetSetCellStylePermission as K, WorksheetEditPermission as Z, WorkbookEditablePermission as Y } from "@univerjs/sheets";
9
- import { IZenZoneService as Qt, useDependency as b, ComponentManager as Je, ISidebarService as en, getMenuHiddenObservable as z, MenuItemType as X, ILayoutService as tn, RibbonDataGroup as nn, IMenuManagerService as rn } from "@univerjs/ui";
10
- import { debounceTime as sn, merge as Qe, Observable as A, combineLatest as on, filter as an } from "rxjs";
11
- import { map as cn, switchMap as ln, tap as un, debounceTime as mn } from "rxjs/operators";
12
- import { jsxs as C, jsx as h } from "react/jsx-runtime";
13
- import { createContext as dn, useState as N, useEffect as ie, useRef as Ce, useContext as et, useMemo as R, forwardRef as tt, createElement as be, useCallback as hn } from "react";
14
- import { InputNumber as Ie, Select as Ne, SelectList as Ee, Input as vn, clsx as nt, borderClassName as fn, Button as xe, scrollbarClassName as pn, Separator as gn } from "@univerjs/design";
15
- import { stripErrorMargin as _n } from "@univerjs/engine-formula";
16
- const Re = {};
17
- var Sn = Object.getOwnPropertyDescriptor, yn = (e, t, r, n) => {
18
- for (var i = n > 1 ? void 0 : n ? Sn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
1
+ var ut = Object.defineProperty;
2
+ var mt = (e, t, r) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var X = (e, t, r) => mt(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { Inject as C, LocaleService as E, IConfigService as Ue, Disposable as te, isTextFormat as ke, Tools as dt, isRealNum as De, CommandType as Fe, ILocalStorageService as Le, isPatternEqualWithoutDecimal as ne, numfmt as ht, ThemeService as vt, IUniverInstanceService as he, ICommandService as ve, UniverInstanceType as T, CellValueType as P, toDisposable as me, DisposableCollection as ft, InterceptorEffectEnum as Te, Range as Ae, Injector as He, Optional as pt, getNumfmtParseValueFilter as gt, willLoseNumericPrecision as _t, fromCallback as St, isDefaultFormat as Ct, DEFAULT_TEXT_FORMAT_EXCEL as yt, DependentOn as bt, Plugin as It, merge as Nt, registerDependencies as Et, touchDependencies as Tt } from "@univerjs/core";
5
+ import { IRenderManagerService as je } from "@univerjs/engine-render";
6
+ import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Mt, currencySymbols as Me, getDecimalFromPattern as q, getCurrencyType as B, setPatternDecimal as $, getCurrencyFormatOptions as se, CURRENCYFORMAT as wt, DATEFMTLISG as Pt, NUMBERFORMAT as xt, getDateFormatOptions as Be, getNumberFormatOptions as Ve, isPatternHasDecimal as Rt, SheetsNumfmtCellContentController as We, getPatternPreviewIgnoreGeneral as $t, getPatternType as fe, SetNumfmtCommand as Ge, getCurrencySymbolByLocale as Ot, SetPercentCommand as Ke, SubtractDecimalCommand as Ze, AddDecimalCommand as Ye, SetCurrencyCommand as ze, getCurrencySymbolIconByLocale as we, localeCurrencySymbolMap as Ut, getPatternPreview as kt, UniverSheetsNumfmtPlugin as Dt } from "@univerjs/sheets-numfmt";
7
+ import { HoverManagerService as Ft, CellAlertManagerService as Lt, CellAlertType as At, SheetSkeletonManagerService as Ht, IEditorBridgeService as jt, deriveStateFromActiveSheet$ as Bt, getCurrentRangeDisable$ as V, UniverSheetsUIPlugin as Vt } from "@univerjs/sheets-ui";
8
+ import { INumfmtService as pe, SheetInterceptorService as Xe, SheetsSelectionsService as ge, INTERCEPTOR_POINT as Wt, RemoveNumfmtMutation as _e, SetNumfmtMutation as Se, BEFORE_CELL_EDIT as Gt, AFTER_CELL_EDIT as Kt, SetRangeValuesCommand as Zt, transformCellsToRange as Yt, factorySetNumfmtUndoMutation as zt, factoryRemoveNumfmtUndoMutation as Xt, RangeProtectionPermissionEditPoint as W, WorksheetSetCellStylePermission as G, WorksheetEditPermission as K, WorkbookEditablePermission as Z } from "@univerjs/sheets";
9
+ import { IZenZoneService as qt, useDependency as b, ComponentManager as qe, ISidebarService as Jt, getMenuHiddenObservable as Y, MenuItemType as z, ILayoutService as Qt, RibbonDataGroup as en, IMenuManagerService as tn } from "@univerjs/ui";
10
+ import { debounceTime as nn, merge as Je, Observable as L, combineLatest as rn, filter as sn } from "rxjs";
11
+ import { map as on, switchMap as cn, tap as an, debounceTime as ln } from "rxjs/operators";
12
+ import { jsxs as y, jsx as h } from "react/jsx-runtime";
13
+ import { createContext as un, useState as N, useEffect as re, useRef as Ce, useContext as Qe, useMemo as x, createElement as ye, forwardRef as mn, useCallback as dn } from "react";
14
+ import { InputNumber as be, Select as Ie, SelectList as Ne, Input as hn, clsx as et, borderClassName as vn, Button as Pe, scrollbarClassName as fn, Separator as pn } from "@univerjs/design";
15
+ import { stripErrorMargin as gn } from "@univerjs/engine-formula";
16
+ const xe = {};
17
+ var _n = Object.getOwnPropertyDescriptor, Sn = (e, t, r, n) => {
18
+ for (var i = n > 1 ? void 0 : n ? _n(t, r) : t, s = e.length - 1, o; s >= 0; s--)
19
19
  (o = e[s]) && (i = o(i) || i);
20
20
  return i;
21
- }, D = (e, t) => (r, n) => t(r, n, e);
22
- const ae = "SHEET_NUMFMT_ALERT";
23
- let he = class extends ne {
21
+ }, k = (e, t) => (r, n) => t(r, n, e);
22
+ const oe = "SHEET_NUMFMT_ALERT";
23
+ let de = class extends te {
24
24
  constructor(e, t, r, n, i, s, o) {
25
25
  super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = r, this._localeService = n, this._zenZoneService = i, this._numfmtService = s, this._configService = o, this._init();
26
26
  }
@@ -28,36 +28,36 @@ let he = class extends ne {
28
28
  this._initCellAlertPopup(), this._initZenService();
29
29
  }
30
30
  _initCellAlertPopup() {
31
- this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(sn(100)).subscribe((e) => {
31
+ this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(nn(100)).subscribe((e) => {
32
32
  var t, r;
33
33
  if (e) {
34
34
  const n = e.location, i = this._context.unit, s = i.getActiveSheet();
35
35
  if (!s) return;
36
- const o = n.unitId, l = n.subUnitId;
37
- let a;
38
- const c = s.getCell(n.row, n.col);
39
- if (c != null && c.s) {
40
- const m = i.getStyles().get(c.s);
41
- m != null && m.n && (a = m.n);
36
+ const o = n.unitId, m = n.subUnitId;
37
+ let c;
38
+ const a = s.getCell(n.row, n.col);
39
+ if (a != null && a.s) {
40
+ const u = i.getStyles().get(a.s);
41
+ u != null && u.n && (c = u.n);
42
42
  }
43
- if (a || (a = this._numfmtService.getValue(o, l, n.row, n.col)), !a) {
43
+ if (c || (c = this._numfmtService.getValue(o, m, n.row, n.col)), !c) {
44
44
  this._hideAlert();
45
45
  return;
46
46
  }
47
- if (De(a.pattern) && vt.isDefine(c == null ? void 0 : c.v) && Fe(c.v)) {
48
- if ((t = this._configService.getConfig(Pt)) != null && t.disableTextFormatAlert)
47
+ if (ke(c.pattern) && dt.isDefine(a == null ? void 0 : a.v) && De(a.v)) {
48
+ if ((t = this._configService.getConfig(Mt)) != null && t.disableTextFormatAlert)
49
49
  return;
50
- const m = this._cellAlertManagerService.currentAlert.get(ae), u = (r = m == null ? void 0 : m.alert) == null ? void 0 : r.location;
51
- if (u && u.row === n.row && u.col === n.col && u.subUnitId === n.subUnitId && u.unitId === n.unitId)
50
+ const u = this._cellAlertManagerService.currentAlert.get(oe), l = (r = u == null ? void 0 : u.alert) == null ? void 0 : r.location;
51
+ if (l && l.row === n.row && l.col === n.col && l.subUnitId === n.subUnitId && l.unitId === n.unitId)
52
52
  return;
53
53
  this._cellAlertManagerService.showAlert({
54
- type: jt.ERROR,
54
+ type: At.ERROR,
55
55
  title: this._localeService.t("info.error"),
56
56
  message: this._localeService.t("info.forceStringInfo"),
57
57
  location: n,
58
58
  width: 200,
59
59
  height: 74,
60
- key: ae
60
+ key: oe
61
61
  });
62
62
  return;
63
63
  }
@@ -71,36 +71,36 @@ let he = class extends ne {
71
71
  }));
72
72
  }
73
73
  _hideAlert() {
74
- this._cellAlertManagerService.removeAlert(ae);
74
+ this._cellAlertManagerService.removeAlert(oe);
75
75
  }
76
76
  };
77
- he = yn([
78
- D(1, y(At)),
79
- D(2, y(Ht)),
80
- D(3, y(E)),
81
- D(4, Qt),
82
- D(5, y(ge)),
83
- D(6, $e)
84
- ], he);
77
+ de = Sn([
78
+ k(1, C(Ft)),
79
+ k(2, C(Lt)),
80
+ k(3, C(E)),
81
+ k(4, qt),
82
+ k(5, C(pe)),
83
+ k(6, Ue)
84
+ ], de);
85
85
  const ce = {
86
86
  id: "sheet.operation.close.numfmt.panel",
87
- type: Le.OPERATION,
87
+ type: Fe.OPERATION,
88
88
  handler: () => (
89
89
  // do nothing, just notify panel is closed
90
90
  !0
91
91
  )
92
- }, H = {
92
+ }, A = {
93
93
  id: "sheet.operation.open.numfmt.panel",
94
- type: Le.OPERATION,
95
- handler: (e) => (e.get(B).openPanel(), !0)
94
+ type: Fe.OPERATION,
95
+ handler: (e) => (e.get(j).openPanel(), !0)
96
96
  };
97
- var Cn = Object.getOwnPropertyDescriptor, bn = (e, t, r, n) => {
97
+ var Cn = Object.getOwnPropertyDescriptor, yn = (e, t, r, n) => {
98
98
  for (var i = n > 1 ? void 0 : n ? Cn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
99
99
  (o = e[s]) && (i = o(i) || i);
100
100
  return i;
101
- }, In = (e, t) => (r, n) => t(r, n, e);
102
- const Te = dn([]);
103
- let j = class {
101
+ }, bn = (e, t) => (r, n) => t(r, n, e);
102
+ const Ee = un([]);
103
+ let H = class {
104
104
  constructor(e) {
105
105
  this._localStorageService = e;
106
106
  }
@@ -125,17 +125,17 @@ let j = class {
125
125
  async getHabit(e, t) {
126
126
  const r = this._getKey(e), n = await this._localStorageService.getItem(r);
127
127
  if (t && n) {
128
- const i = n.map((s, o, l) => {
129
- const a = l.length;
128
+ const i = n.map((s, o, m) => {
129
+ const c = m.length;
130
130
  return {
131
131
  value: s,
132
- priority: a - o
132
+ priority: c - o
133
133
  };
134
134
  });
135
135
  return t.sort((s, o) => {
136
- var c, m;
137
- const l = ((c = i.find((u) => u.value === s)) == null ? void 0 : c.priority) || -1;
138
- return (((m = i.find((u) => u.value === o)) == null ? void 0 : m.priority) || -1) - l;
136
+ var a, u;
137
+ const m = ((a = i.find((l) => l.value === s)) == null ? void 0 : a.priority) || -1;
138
+ return (((u = i.find((l) => l.value === o)) == null ? void 0 : u.priority) || -1) - m;
139
139
  });
140
140
  }
141
141
  return n || [];
@@ -144,44 +144,44 @@ let j = class {
144
144
  this._localStorageService.removeItem(e);
145
145
  }
146
146
  };
147
- j = bn([
148
- In(0, y(Ae))
149
- ], j);
150
- const Oe = "numfmtCurrency", Nn = (e) => {
151
- const t = b(j), [r, n] = N(Me);
152
- return ie(() => {
147
+ H = yn([
148
+ bn(0, C(Le))
149
+ ], H);
150
+ const Re = "numfmtCurrency", In = (e) => {
151
+ const t = b(H), [r, n] = N(Me);
152
+ return re(() => {
153
153
  t.addHabit("numfmtCurrency", []).then(() => {
154
- t.getHabit(Oe, [...Me]).then((s) => {
154
+ t.getHabit(Re, [...Me]).then((s) => {
155
155
  n(s), e && e(s);
156
156
  });
157
157
  });
158
158
  }, []), { userHabitCurrency: r, mark: (s) => {
159
- t.markHabit(Oe, s);
159
+ t.markHabit(Re, s);
160
160
  } };
161
- }, En = () => {
161
+ }, Nn = () => {
162
162
  const e = Ce([]), [t, r] = N({});
163
- return ie(() => {
163
+ return re(() => {
164
164
  e.current.forEach((i) => {
165
165
  i();
166
166
  }), e.current = [];
167
167
  }, [t]), (i) => {
168
168
  e.current.push(i), r({});
169
169
  };
170
- }, Tn = (e) => !!V(e) && e.startsWith("_("), wn = (e) => {
171
- const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => J(t || "", 2)), o = et(Te), [l, a] = N(() => V(t) || o[0]), c = R(() => o.map((p) => ({ label: p, value: p })), []), u = b(E).t;
172
- r.current = () => k(`_("${l}"* #,##0${i > 0 ? ".0" : ""}_)`, i);
170
+ }, En = (e) => !!B(e) && e.startsWith("_("), Tn = (e) => {
171
+ const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => q(t || "", 2)), o = Qe(Ee), [m, c] = N(() => B(t) || o[0]), a = x(() => o.map((p) => ({ label: p, value: p })), []), l = b(E).t;
172
+ r.current = () => $(`_("${m}"* #,##0${i > 0 ? ".0" : ""}_)`, i);
173
173
  const v = (p) => {
174
- a(p), n(k(`_("${p}"* #,##0${i > 0 ? ".0" : ""}_)`, i));
174
+ c(p), n($(`_("${p}"* #,##0${i > 0 ? ".0" : ""}_)`, i));
175
175
  }, f = (p) => {
176
176
  const d = p || 0;
177
- s(d), n(k(`_("${l}"* #,##0${d > 0 ? ".0" : ""}_)`, d));
177
+ s(d), n($(`_("${m}"* #,##0${d > 0 ? ".0" : ""}_)`, d));
178
178
  };
179
- return /* @__PURE__ */ C("div", { children: [
180
- /* @__PURE__ */ C("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
181
- /* @__PURE__ */ C("div", { className: "option", children: [
182
- /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: u("sheet.numfmt.decimalLength") }),
179
+ return /* @__PURE__ */ y("div", { children: [
180
+ /* @__PURE__ */ y("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
181
+ /* @__PURE__ */ y("div", { className: "option", children: [
182
+ /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.decimalLength") }),
183
183
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ h(
184
- Ie,
184
+ be,
185
185
  {
186
186
  value: i,
187
187
  step: 1,
@@ -192,44 +192,44 @@ const Oe = "numfmtCurrency", Nn = (e) => {
192
192
  }
193
193
  ) })
194
194
  ] }),
195
- /* @__PURE__ */ C("div", { className: "option", children: [
196
- /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: u("sheet.numfmt.currencyType") }),
195
+ /* @__PURE__ */ y("div", { className: "option", children: [
196
+ /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.currencyType") }),
197
197
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ h(
198
- Ne,
198
+ Ie,
199
199
  {
200
- options: c,
201
- value: l,
200
+ options: a,
201
+ value: m,
202
202
  onChange: v
203
203
  }
204
204
  ) })
205
205
  ] })
206
206
  ] }),
207
- /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: u("sheet.numfmt.accountingDes") })
207
+ /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.accountingDes") })
208
208
  ] });
209
- }, Mn = (e) => !!V(e) && !e.startsWith("_("), Pn = (e) => {
210
- const r = b(E).t, n = et(Te), [i, s] = N(() => V(e.defaultPattern) || n[0]), [o, l] = N(() => J(e.defaultPattern || "", 2)), [a, c] = N(() => {
209
+ }, Mn = (e) => !!B(e) && !e.startsWith("_("), wn = (e) => {
210
+ const r = b(E).t, n = Qe(Ee), [i, s] = N(() => B(e.defaultPattern) || n[0]), [o, m] = N(() => q(e.defaultPattern || "", 2)), [c, a] = N(() => {
211
211
  var g;
212
- const d = oe(i);
213
- return ((g = d.find((I) => re(I.value, e.defaultPattern))) == null ? void 0 : g.value) || d[0].value;
214
- }), m = R(() => oe(i), [i]), u = R(() => n.map((d) => ({ label: d, value: d })), [n]);
215
- e.action.current = () => k(a, o);
212
+ const d = se(i);
213
+ return ((g = d.find((I) => ne(I.value, e.defaultPattern))) == null ? void 0 : g.value) || d[0].value;
214
+ }), u = x(() => se(i), [i]), l = x(() => n.map((d) => ({ label: d, value: d })), [n]);
215
+ e.action.current = () => $(c, o);
216
216
  const v = (d) => {
217
217
  if (d === void 0)
218
218
  return;
219
219
  s(d);
220
- const S = oe(d)[0].value;
221
- c(S), e.onChange(k(S, o));
220
+ const S = se(d)[0].value;
221
+ a(S), e.onChange($(S, o));
222
222
  }, f = (d) => {
223
- d !== void 0 && (c(d), e.onChange(k(d, o)));
223
+ d !== void 0 && (a(d), e.onChange($(d, o)));
224
224
  }, p = (d) => {
225
- l(d || 0), e.onChange(k(a, d || 0));
225
+ m(d || 0), e.onChange($(c, d || 0));
226
226
  };
227
- return /* @__PURE__ */ C("div", { children: [
228
- /* @__PURE__ */ C("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
229
- /* @__PURE__ */ C("div", { className: "option", children: [
227
+ return /* @__PURE__ */ y("div", { children: [
228
+ /* @__PURE__ */ y("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
229
+ /* @__PURE__ */ y("div", { className: "option", children: [
230
230
  /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.decimalLength") }),
231
231
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ h(
232
- Ie,
232
+ be,
233
233
  {
234
234
  value: o,
235
235
  max: 20,
@@ -238,127 +238,145 @@ const Oe = "numfmtCurrency", Nn = (e) => {
238
238
  }
239
239
  ) })
240
240
  ] }),
241
- /* @__PURE__ */ C("div", { className: "option", children: [
241
+ /* @__PURE__ */ y("div", { className: "option", children: [
242
242
  /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyType") }),
243
243
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ h(
244
- Ne,
244
+ Ie,
245
245
  {
246
246
  value: i,
247
- options: u,
247
+ options: l,
248
248
  onChange: v
249
249
  }
250
250
  ) })
251
251
  ] })
252
252
  ] }),
253
253
  /* @__PURE__ */ h("div", { className: "label univer-mt-4", children: r("sheet.numfmt.negType") }),
254
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { value: a, options: m, onChange: f }) }),
254
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { value: c, options: u, onChange: f }) }),
255
255
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyDes") })
256
256
  ] });
257
257
  };
258
- var T = function() {
259
- return T = Object.assign || function(e) {
260
- for (var t, r = 1, n = arguments.length; r < n; r++) {
261
- t = arguments[r];
262
- for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
263
- }
264
- return e;
265
- }, T.apply(this, arguments);
266
- }, xn = function(e, t) {
267
- var r = {};
268
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
269
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
270
- for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
271
- t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
272
- return r;
273
- }, rt = tt(function(e, t) {
274
- var r = e.icon, n = e.id, i = e.className, s = e.extend, o = xn(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), a = Ce("_".concat(kn()));
275
- return it(r, "".concat(n), { defIds: r.defIds, idSuffix: a.current }, T({ ref: t, className: l }, o), s);
276
- });
277
- function it(e, t, r, n, i) {
278
- return be(e.tag, T(T({ key: t }, Rn(e, r, i)), n), (On(e, r).children || []).map(function(s, o) {
279
- return it(s, "".concat(t, "-").concat(e.tag, "-").concat(o), r, void 0, i);
280
- }));
258
+ function tt({ ref: e, ...t }) {
259
+ const { icon: r, id: n, className: i, extend: s, ...o } = t, m = `univerjs-icon univerjs-icon-${n} ${i || ""}`.trim(), c = Ce(`_${Rn()}`);
260
+ return nt(r, `${n}`, {
261
+ defIds: r.defIds,
262
+ idSuffix: c.current
263
+ }, {
264
+ ref: e,
265
+ className: m,
266
+ ...o
267
+ }, s);
268
+ }
269
+ function nt(e, t, r, n, i) {
270
+ return ye(e.tag, {
271
+ key: t,
272
+ ...Pn(e, r, i),
273
+ ...n
274
+ }, (xn(e, r).children || []).map((s, o) => nt(s, `${t}-${e.tag}-${o}`, r, void 0, i)));
281
275
  }
282
- function Rn(e, t, r) {
283
- var n = T({}, e.attrs);
284
- r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(s) {
285
- var o = s[0], l = s[1];
286
- o === "mask" && typeof l == "string" && (n[o] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
276
+ function Pn(e, t, r) {
277
+ const n = { ...e.attrs };
278
+ r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(([s, o]) => {
279
+ s === "mask" && typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
287
280
  });
288
- var i = t.defIds;
289
- return !i || i.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(s) {
290
- var o = s[0], l = s[1];
291
- typeof l == "string" && (n[o] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
281
+ const { defIds: i } = t;
282
+ return !i || i.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(([s, o]) => {
283
+ typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
292
284
  })), n;
293
285
  }
294
- function On(e, t) {
295
- var r, n = t.defIds;
296
- return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? T(T({}, e), { children: e.children.map(function(i) {
297
- return typeof i.attrs.id == "string" && n && n.includes(i.attrs.id) ? T(T({}, i), { attrs: T(T({}, i.attrs), { id: i.attrs.id + t.idSuffix }) }) : i;
298
- }) }) : e;
286
+ function xn(e, t) {
287
+ var n;
288
+ const { defIds: r } = t;
289
+ return !r || r.length === 0 ? e : e.tag === "defs" && ((n = e.children) != null && n.length) ? {
290
+ ...e,
291
+ children: e.children.map((i) => typeof i.attrs.id == "string" && r && r.includes(i.attrs.id) ? {
292
+ ...i,
293
+ attrs: {
294
+ ...i.attrs,
295
+ id: i.attrs.id + t.idSuffix
296
+ }
297
+ } : i)
298
+ } : e;
299
299
  }
300
- function kn() {
300
+ function Rn() {
301
301
  return Math.random().toString(36).substring(2, 8);
302
302
  }
303
- rt.displayName = "UniverIcon";
304
- var Un = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, st = tt(function(e, t) {
305
- return be(rt, Object.assign({}, e, {
303
+ tt.displayName = "UniverIcon";
304
+ const $n = {
305
+ tag: "svg",
306
+ attrs: {
307
+ xmlns: "http://www.w3.org/2000/svg",
308
+ fill: "none",
309
+ viewBox: "0 0 16 16",
310
+ width: "1em",
311
+ height: "1em"
312
+ },
313
+ children: [{
314
+ tag: "path",
315
+ attrs: {
316
+ fill: "currentColor",
317
+ d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",
318
+ fillRule: "evenodd",
319
+ clipRule: "evenodd"
320
+ }
321
+ }]
322
+ }, rt = mn(function(t, r) {
323
+ return ye(tt, Object.assign({}, t, {
306
324
  id: "check-mark-icon",
307
- ref: t,
308
- icon: Un
325
+ ref: r,
326
+ icon: $n
309
327
  }));
310
328
  });
311
- st.displayName = "CheckMarkIcon";
312
- const le = "customFormat", ue = "numfmt_custom_pattern";
313
- function $n(e) {
314
- const { defaultPattern: t, action: r, onChange: n } = e, i = b(j), s = b(Ae), o = b(E), [l, a] = N(t);
315
- r.current = () => (i.markHabit(le, l), s.getItem(ue).then((f = []) => {
316
- const p = [.../* @__PURE__ */ new Set([l, ...f || []])].splice(0, 10).filter((d) => !!d);
317
- s.setItem(ue, p);
318
- }), l);
319
- const [c, m] = N([]);
320
- ie(() => {
321
- s.getItem(ue).then((f) => {
329
+ rt.displayName = "CheckMarkIcon";
330
+ const ae = "customFormat", le = "numfmt_custom_pattern";
331
+ function On(e) {
332
+ const { defaultPattern: t, action: r, onChange: n } = e, i = b(H), s = b(Le), o = b(E), [m, c] = N(t);
333
+ r.current = () => (i.markHabit(ae, m), s.getItem(le).then((f = []) => {
334
+ const p = [.../* @__PURE__ */ new Set([m, ...f || []])].splice(0, 10).filter((d) => !!d);
335
+ s.setItem(le, p);
336
+ }), m);
337
+ const [a, u] = N([]);
338
+ re(() => {
339
+ s.getItem(le).then((f) => {
322
340
  const p = [
323
- ...xt.map((d) => d.suffix("$")),
324
- ...Rt.map((d) => d.suffix),
325
- ...Ot.map((d) => d.suffix)
341
+ ...wt.map((d) => d.suffix("$")),
342
+ ...Pt.map((d) => d.suffix),
343
+ ...xt.map((d) => d.suffix)
326
344
  ];
327
- p.push(...f || []), i.addHabit(le, []).finally(() => {
328
- i.getHabit(le, p).then((d) => {
329
- m([...new Set(d)]);
345
+ p.push(...f || []), i.addHabit(ae, []).finally(() => {
346
+ i.getHabit(ae, p).then((d) => {
347
+ u([...new Set(d)]);
330
348
  });
331
349
  });
332
350
  });
333
351
  }, []);
334
- const u = (f) => {
335
- a(f), n(f);
352
+ const l = (f) => {
353
+ c(f), n(f);
336
354
  }, v = () => {
337
- n(l);
355
+ n(m);
338
356
  };
339
- return /* @__PURE__ */ C("div", { children: [
357
+ return /* @__PURE__ */ y("div", { children: [
340
358
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: o.t("sheet.numfmt.customFormat") }),
341
359
  /* @__PURE__ */ h(
342
- vn,
360
+ hn,
343
361
  {
344
362
  placeholder: o.t("sheet.numfmt.customFormat"),
345
363
  onBlur: v,
346
- value: l,
347
- onChange: a,
364
+ value: m,
365
+ onChange: c,
348
366
  className: "univer-mt-2 univer-w-full"
349
367
  }
350
368
  ),
351
369
  /* @__PURE__ */ h(
352
370
  "div",
353
371
  {
354
- className: nt("univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2", fn),
355
- children: c.map((f) => /* @__PURE__ */ C(
372
+ className: et("univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2", vn),
373
+ children: a.map((f) => /* @__PURE__ */ y(
356
374
  "div",
357
375
  {
358
- onClick: () => u(f),
376
+ onClick: () => l(f),
359
377
  className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-1.5 univer-py-1.5 univer-text-sm",
360
378
  children: [
361
- /* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: l === f && /* @__PURE__ */ h(st, {}) }),
379
+ /* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: m === f && /* @__PURE__ */ h(rt, {}) }),
362
380
  /* @__PURE__ */ h("div", { children: f })
363
381
  ]
364
382
  },
@@ -375,26 +393,26 @@ function $n(e) {
375
393
  )
376
394
  ] });
377
395
  }
378
- const Dn = (e) => {
379
- const t = ft.getFormatInfo(e);
380
- return Ve().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
396
+ const Un = (e) => {
397
+ const t = ht.getFormatInfo(e);
398
+ return Be().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
381
399
  };
382
- function Fn(e) {
383
- const { onChange: t, defaultPattern: r } = e, n = R(Ve, []), i = b(E), [s, o] = N(() => {
400
+ function kn(e) {
401
+ const { onChange: t, defaultPattern: r } = e, n = x(Be, []), i = b(E), [s, o] = N(() => {
384
402
  if (r) {
385
- const a = n.find((c) => c.value === r);
386
- if (a)
387
- return a.value;
403
+ const c = n.find((a) => a.value === r);
404
+ if (c)
405
+ return c.value;
388
406
  }
389
407
  return n[0].value;
390
408
  });
391
409
  e.action.current = () => s;
392
- const l = (a) => {
393
- a !== void 0 && (o(a), t(a));
410
+ const m = (c) => {
411
+ c !== void 0 && (o(c), t(c));
394
412
  };
395
- return /* @__PURE__ */ C("div", { children: [
413
+ return /* @__PURE__ */ y("div", { children: [
396
414
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: i.t("sheet.numfmt.dateType") }),
397
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { value: s, options: n, onChange: l }) }),
415
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { value: s, options: n, onChange: m }) }),
398
416
  /* @__PURE__ */ h(
399
417
  "div",
400
418
  {
@@ -404,7 +422,7 @@ function Fn(e) {
404
422
  )
405
423
  ] });
406
424
  }
407
- const Ln = (e) => !e, An = (e) => {
425
+ const Dn = (e) => !e, Fn = (e) => {
408
426
  const r = b(E).t;
409
427
  return e.action.current = () => "", /* @__PURE__ */ h("div", { children: /* @__PURE__ */ h(
410
428
  "div",
@@ -413,33 +431,33 @@ const Ln = (e) => !e, An = (e) => {
413
431
  children: r("sheet.numfmt.generalDes")
414
432
  }
415
433
  ) });
416
- }, Hn = (e) => We().some((t) => re(t.value, e));
417
- function jn(e) {
418
- const t = b(E), r = R(We, []), [n, i] = N(() => J(e.defaultPattern || "", 0)), [s, o] = N(() => {
419
- const u = r.find((v) => re(v.value, e.defaultPattern || ""));
420
- return (u == null ? void 0 : u.value) || r[0].value;
421
- }), l = R(() => k(s, Number(n || 0)), [s, n]), a = R(() => !kt(s), [s]), c = (u) => {
422
- i(u || 0), e.onChange(k(s, Number(u || 0)));
423
- }, m = (u) => {
424
- u !== void 0 && (i(J(u, 0)), o(u), e.onChange(u));
434
+ }, Ln = (e) => Ve().some((t) => ne(t.value, e));
435
+ function An(e) {
436
+ const t = b(E), r = x(Ve, []), [n, i] = N(() => q(e.defaultPattern || "", 0)), [s, o] = N(() => {
437
+ const l = r.find((v) => ne(v.value, e.defaultPattern || ""));
438
+ return (l == null ? void 0 : l.value) || r[0].value;
439
+ }), m = x(() => $(s, Number(n || 0)), [s, n]), c = x(() => !Rt(s), [s]), a = (l) => {
440
+ i(l || 0), e.onChange($(s, Number(l || 0)));
441
+ }, u = (l) => {
442
+ l !== void 0 && (i(q(l, 0)), o(l), e.onChange(l));
425
443
  };
426
- return e.action.current = () => l, /* @__PURE__ */ C("div", { children: [
444
+ return e.action.current = () => m, /* @__PURE__ */ y("div", { children: [
427
445
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: t.t("sheet.numfmt.decimalLength") }),
428
446
  /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
429
- Ie,
447
+ be,
430
448
  {
431
- disabled: a,
449
+ disabled: c,
432
450
  value: n,
433
451
  max: 20,
434
452
  min: 0,
435
- onChange: c
453
+ onChange: a
436
454
  }
437
455
  ) }),
438
- /* @__PURE__ */ C("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: [
456
+ /* @__PURE__ */ y("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: [
439
457
  " ",
440
458
  t.t("sheet.numfmt.negType")
441
459
  ] }),
442
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { onChange: m, options: r, value: s }) }),
460
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { onChange: u, options: r, value: s }) }),
443
461
  /* @__PURE__ */ h(
444
462
  "div",
445
463
  {
@@ -449,70 +467,70 @@ function jn(e) {
449
467
  )
450
468
  ] });
451
469
  }
452
- const Bn = (e) => {
453
- const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = Ce(() => ""), l = s.t, a = En(), c = R(
470
+ const Hn = (e) => {
471
+ const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = Ce(() => ""), m = s.t, c = Nn(), a = x(
454
472
  () => [
455
- { label: "sheet.numfmt.general", component: An },
456
- { label: "sheet.numfmt.accounting", component: wn },
457
- { label: "sheet.numfmt.currency", component: Pn },
458
- { label: "sheet.numfmt.date", component: Fn },
459
- { label: "sheet.numfmt.thousandthPercentile", component: jn },
460
- { label: "sheet.numfmt.customFormat", component: $n }
461
- ].map((_) => ({ ..._, label: l(_.label) })),
473
+ { label: "sheet.numfmt.general", component: Fn },
474
+ { label: "sheet.numfmt.accounting", component: Tn },
475
+ { label: "sheet.numfmt.currency", component: wn },
476
+ { label: "sheet.numfmt.date", component: kn },
477
+ { label: "sheet.numfmt.thousandthPercentile", component: An },
478
+ { label: "sheet.numfmt.customFormat", component: On }
479
+ ].map((_) => ({ ..._, label: m(_.label) })),
462
480
  []
463
- ), [m, u] = N(g), [v, f] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } = Nn(() => f(`${n}_${i}_userCurrency'`)), S = R(() => {
481
+ ), [u, l] = N(g), [v, f] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } = In(() => f(`${n}_${i}_userCurrency'`)), S = x(() => {
464
482
  var _;
465
- return (_ = c.find(($) => $.label === m)) == null ? void 0 : _.component;
466
- }, [m]);
483
+ return (_ = a.find((U) => U.label === u)) == null ? void 0 : _.component;
484
+ }, [u]);
467
485
  function g() {
468
- return [Ln, Tn, Mn, Dn, Hn].reduce(($, ut, mt) => $ || (ut(r) ? c[mt].label : ""), "") || c[0].label;
486
+ return [Dn, En, Mn, Un, Ln].reduce((U, at, lt) => U || (at(r) ? a[lt].label : ""), "") || a[0].label;
469
487
  }
470
- const I = c.map((_) => ({
488
+ const I = a.map((_) => ({
471
489
  label: _.label,
472
490
  value: _.label
473
- })), P = (_) => {
474
- u(_), a(() => e.onChange({ type: "change", value: o.current() || "" }));
475
- }, O = hn((_) => {
491
+ })), w = (_) => {
492
+ l(_), c(() => e.onChange({ type: "change", value: o.current() || "" }));
493
+ }, R = dn((_) => {
476
494
  e.onChange({ type: "change", value: _ });
477
- }, []), U = () => {
478
- const _ = o.current() || "", $ = V(_);
479
- $ && p($), e.onChange({ type: "confirm", value: _ });
480
- }, F = () => {
495
+ }, []), O = () => {
496
+ const _ = o.current() || "", U = B(_);
497
+ U && p(U), e.onChange({ type: "confirm", value: _ });
498
+ }, D = () => {
481
499
  e.onChange({ type: "cancel", value: "" });
482
- }, se = {
483
- onChange: O,
500
+ }, ie = {
501
+ onChange: R,
484
502
  defaultValue: t,
485
503
  defaultPattern: r,
486
504
  action: o
487
505
  };
488
- return ie(() => {
489
- u(g()), f(`${n}_${i}`);
490
- }, [n, i]), /* @__PURE__ */ C(
506
+ return re(() => {
507
+ l(g()), f(`${n}_${i}`);
508
+ }, [n, i]), /* @__PURE__ */ y(
491
509
  "div",
492
510
  {
493
- className: nt("univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5", pn),
511
+ className: et("univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5", fn),
494
512
  children: [
495
- /* @__PURE__ */ C("div", { children: [
496
- /* @__PURE__ */ h("div", { className: "univer-mt-3.5 univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.numfmtType") }),
497
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { className: "univer-w-full", value: m, options: I, onChange: P }) }),
498
- /* @__PURE__ */ h("div", { children: S && /* @__PURE__ */ h(Te.Provider, { value: d, children: /* @__PURE__ */ be(S, { ...se, key: v }) }) })
513
+ /* @__PURE__ */ y("div", { children: [
514
+ /* @__PURE__ */ h("div", { className: "univer-mt-3.5 univer-text-sm univer-text-gray-400", children: m("sheet.numfmt.numfmtType") }),
515
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ie, { className: "univer-w-full", value: u, options: I, onChange: w }) }),
516
+ /* @__PURE__ */ h("div", { children: S && /* @__PURE__ */ h(Ee.Provider, { value: d, children: /* @__PURE__ */ ye(S, { ...ie, key: v }) }) })
499
517
  ] }),
500
- /* @__PURE__ */ C("div", { className: "univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end", children: [
501
- /* @__PURE__ */ h(xe, { onClick: F, className: "univer-mr-3", children: l("sheet.numfmt.cancel") }),
502
- /* @__PURE__ */ h(xe, { variant: "primary", onClick: U, children: l("sheet.numfmt.confirm") })
518
+ /* @__PURE__ */ y("div", { className: "univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end", children: [
519
+ /* @__PURE__ */ h(Pe, { onClick: D, className: "univer-mr-3", children: m("sheet.numfmt.cancel") }),
520
+ /* @__PURE__ */ h(Pe, { variant: "primary", onClick: O, children: m("sheet.numfmt.confirm") })
503
521
  ] })
504
522
  ]
505
523
  }
506
524
  );
507
525
  };
508
- var Vn = Object.getOwnPropertyDescriptor, Wn = (e, t, r, n) => {
509
- for (var i = n > 1 ? void 0 : n ? Vn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
526
+ var jn = Object.getOwnPropertyDescriptor, Bn = (e, t, r, n) => {
527
+ for (var i = n > 1 ? void 0 : n ? jn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
510
528
  (o = e[s]) && (i = o(i) || i);
511
529
  return i;
512
530
  }, M = (e, t) => (r, n) => t(r, n, e);
513
- const ke = "SHEET_NUMFMT_PANEL";
514
- let B = class extends ne {
515
- constructor(t, r, n, i, s, o, l, a, c, m, u) {
531
+ const $e = "SHEET_NUMFMT_PANEL";
532
+ let j = class extends te {
533
+ constructor(t, r, n, i, s, o, m, c, a, u, l) {
516
534
  super();
517
535
  /**
518
536
  * If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
@@ -520,56 +538,56 @@ let B = class extends ne {
520
538
  * @type {(string | null)}
521
539
  * @memberof NumfmtController
522
540
  */
523
- q(this, "_previewPattern", "");
524
- q(this, "_sidebarDisposable", null);
525
- this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService = l, this._componentManager = a, this._sidebarService = c, this._localeService = m, this._sheetsNumfmtCellContentController = u, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
541
+ X(this, "_previewPattern", "");
542
+ X(this, "_sidebarDisposable", null);
543
+ this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService = m, this._componentManager = c, this._sidebarService = a, this._localeService = u, this._sheetsNumfmtCellContentController = l, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
526
544
  }
527
545
  _initNumfmtLocalChange() {
528
- this.disposeWithMe(Qe(this._sheetsNumfmtCellContentController.locale$, this._localeService.currentLocale$).subscribe(() => {
546
+ this.disposeWithMe(Je(this._sheetsNumfmtCellContentController.locale$, this._localeService.currentLocale$).subscribe(() => {
529
547
  this._forceUpdate();
530
548
  }));
531
549
  }
532
550
  openPanel() {
533
551
  var S;
534
- const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, i = this._univerInstanceService, s = this._numfmtService, o = this._localeService, a = (((S = r.getCurrentSelections()) == null ? void 0 : S.map((g) => g.range)) || [])[0];
535
- if (!a)
552
+ const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, i = this._univerInstanceService, s = this._numfmtService, o = this._localeService, c = (((S = r.getCurrentSelections()) == null ? void 0 : S.map((g) => g.range)) || [])[0];
553
+ if (!c)
536
554
  return !1;
537
- const c = i.getCurrentUnitForType(w.UNIVER_SHEET), m = c.getActiveSheet();
538
- if (!m)
555
+ const a = i.getCurrentUnitForType(T.UNIVER_SHEET), u = a.getActiveSheet();
556
+ if (!u)
539
557
  return !1;
540
- const u = m.getCellRaw(a.startRow, a.startColumn), v = s.getValue(
541
- c.getUnitId(),
542
- m.getSheetId(),
543
- a.startRow,
544
- a.startColumn
558
+ const l = u.getCellRaw(c.startRow, c.startColumn), v = s.getValue(
559
+ a.getUnitId(),
560
+ u.getSheetId(),
561
+ c.startRow,
562
+ c.startColumn
545
563
  );
546
564
  let f = "";
547
565
  v && (f = v.pattern);
548
- const p = (u == null ? void 0 : u.t) === x.NUMBER ? u.v : 12345678, d = {
566
+ const p = (l == null ? void 0 : l.t) === P.NUMBER ? l.v : 12345678, d = {
549
567
  onChange: (g) => {
550
568
  var I;
551
569
  if (g.type === "change")
552
570
  this._previewPattern = g.value, this._forceUpdate();
553
571
  else if (g.type === "confirm") {
554
- const P = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((F) => F.range)) || [], O = { values: [] }, U = pe(g.value);
555
- P.forEach((F) => {
556
- He.foreach(F, (se, _) => {
557
- O.values.push({
558
- row: se,
572
+ const w = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((D) => D.range)) || [], R = { values: [] }, O = fe(g.value);
573
+ w.forEach((D) => {
574
+ Ae.foreach(D, (ie, _) => {
575
+ R.values.push({
576
+ row: ie,
559
577
  col: _,
560
578
  pattern: g.value,
561
- type: U
579
+ type: O
562
580
  });
563
581
  });
564
- }), n.executeCommand(Ke.id, O), t.close();
582
+ }), n.executeCommand(Ge.id, R), t.close();
565
583
  } else g.type === "cancel" && t.close();
566
584
  },
567
- value: { defaultPattern: f, defaultValue: p, row: a.startRow, col: a.startColumn }
585
+ value: { defaultPattern: f, defaultValue: p, row: c.startRow, col: c.startColumn }
568
586
  };
569
587
  return this._sidebarDisposable = t.open({
570
588
  header: { title: o.t("sheet.numfmt.title") },
571
589
  children: {
572
- label: ke,
590
+ label: $e,
573
591
  ...d
574
592
  // need passthrough to react props.
575
593
  },
@@ -581,13 +599,13 @@ let B = class extends ne {
581
599
  _forceUpdate(t) {
582
600
  var n;
583
601
  const r = this._renderManagerService.getRenderById(
584
- t != null ? t : this._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET).getUnitId()
602
+ t != null ? t : this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId()
585
603
  );
586
- r == null || r.with(Bt).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
604
+ r == null || r.with(Ht).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
587
605
  }
588
606
  _initCommands() {
589
607
  [
590
- H,
608
+ A,
591
609
  ce
592
610
  ].forEach((t) => {
593
611
  this.disposeWithMe(this._commandService.registerCommand(t));
@@ -595,79 +613,79 @@ let B = class extends ne {
595
613
  }
596
614
  _initPanel() {
597
615
  this.disposeWithMe(
598
- this._componentManager.register(ke, Bn)
616
+ this._componentManager.register($e, Hn)
599
617
  );
600
618
  }
601
619
  // eslint-disable-next-line max-lines-per-function
602
620
  _initRealTimeRenderingInterceptor() {
603
- const t = new A((n) => {
621
+ const t = new L((n) => {
604
622
  this._commandService.onCommandExecuted((i) => {
605
- i.id === H.id && n.next(!0), i.id === ce.id && n.next(!1);
623
+ i.id === A.id && n.next(!0), i.id === ce.id && n.next(!1);
606
624
  });
607
- }), r = on([
625
+ }), r = rn([
608
626
  t,
609
627
  this._selectionManagerService.selectionMoveEnd$.pipe(
610
- cn((n) => n ? n.map((i) => i.range) : [])
628
+ on((n) => n ? n.map((i) => i.range) : [])
611
629
  )
612
630
  ]);
613
631
  this.disposeWithMe(
614
- de(
632
+ me(
615
633
  r.pipe(
616
- ln(
617
- ([n, i]) => new A((s) => {
618
- const o = new gt();
634
+ cn(
635
+ ([n, i]) => new L((s) => {
636
+ const o = new ft();
619
637
  return n && i.length && s.next({ selectionRanges: i, disposableCollection: o }), () => {
620
638
  o.dispose();
621
639
  };
622
640
  })
623
641
  ),
624
- un(() => {
642
+ an(() => {
625
643
  this._previewPattern = null;
626
644
  })
627
645
  ).subscribe(({ disposableCollection: n, selectionRanges: i }) => {
628
- var o, l;
629
- const s = this._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET);
646
+ var o, m;
647
+ const s = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
630
648
  this.openPanel(), n.add(
631
- this._sheetInterceptorService.intercept(Kt.CELL_CONTENT, {
649
+ this._sheetInterceptorService.intercept(Wt.CELL_CONTENT, {
632
650
  priority: 99,
633
- effect: we.Value | we.Style,
634
- handler: (a, c, m) => {
651
+ effect: Te.Value | Te.Style,
652
+ handler: (c, a, u) => {
635
653
  var p;
636
- const { row: u, col: v } = c, f = m(a) || {};
654
+ const { row: l, col: v } = a, f = u(c) || {};
637
655
  if (i.find(
638
- (d) => d.startColumn <= v && d.endColumn >= v && d.startRow <= u && d.endRow >= u
656
+ (d) => d.startColumn <= v && d.endColumn >= v && d.startRow <= l && d.endRow >= l
639
657
  )) {
640
- const d = c.worksheet.getCellRaw(u, v), S = d == null ? void 0 : d.v, g = d == null ? void 0 : d.t;
641
- if (S == null || g !== x.NUMBER || this._previewPattern === null)
658
+ const d = a.worksheet.getCellRaw(l, v), S = d == null ? void 0 : d.v, g = d == null ? void 0 : d.t;
659
+ if (S == null || g !== P.NUMBER || this._previewPattern === null)
642
660
  return f;
643
- const I = Ut(this._previewPattern, S, this._sheetsNumfmtCellContentController.locale);
661
+ const I = $t(this._previewPattern, S, this._sheetsNumfmtCellContentController.locale);
644
662
  if (I.color) {
645
- const P = (p = this._themeService.getColorFromTheme(`${I.color}.500`)) != null ? p : I.color;
663
+ const w = (p = this._themeService.getColorFromTheme(`${I.color}.500`)) != null ? p : I.color;
646
664
  return {
647
665
  ...f,
648
666
  v: I.result,
649
- t: x.STRING,
650
- s: { cl: { rgb: P } }
667
+ t: P.STRING,
668
+ s: { cl: { rgb: w } }
651
669
  };
652
670
  }
653
671
  return {
654
672
  ...f,
655
673
  v: I.result,
656
- t: x.STRING
674
+ t: P.STRING
657
675
  };
658
676
  }
659
677
  return f;
660
678
  }
661
679
  })
662
- ), (l = (o = this._renderManagerService.getRenderById(s.getUnitId())) == null ? void 0 : o.mainComponent) == null || l.makeDirty();
680
+ ), (m = (o = this._renderManagerService.getRenderById(s.getUnitId())) == null ? void 0 : o.mainComponent) == null || m.makeDirty();
663
681
  })
664
682
  )
665
683
  );
666
684
  }
667
685
  _commandExecutedListener() {
668
- const t = [Se.id, ye.id];
686
+ const t = [_e.id, Se.id];
669
687
  this.disposeWithMe(
670
- new A((r) => {
688
+ new L((r) => {
671
689
  const n = this._commandService.onCommandExecuted((i) => {
672
690
  if (t.includes(i.id)) {
673
691
  const s = i.params;
@@ -675,55 +693,55 @@ let B = class extends ne {
675
693
  }
676
694
  });
677
695
  return () => n.dispose();
678
- }).pipe(mn(16)).subscribe((r) => this._forceUpdate(r))
696
+ }).pipe(ln(16)).subscribe((r) => this._forceUpdate(r))
679
697
  );
680
698
  }
681
699
  _initCloseListener() {
682
- this._univerInstanceService.getCurrentTypeOfUnit$(w.UNIVER_SHEET).subscribe((t) => {
700
+ this._univerInstanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).subscribe((t) => {
683
701
  var r;
684
702
  t || ((r = this._sidebarDisposable) == null || r.dispose(), this._sidebarDisposable = null);
685
703
  });
686
704
  }
687
705
  };
688
- B = Wn([
689
- M(0, y(qe)),
690
- M(1, y(pt)),
691
- M(2, ve),
692
- M(3, fe),
693
- M(4, y(_e)),
694
- M(5, Be),
695
- M(6, ge),
696
- M(7, y(Je)),
697
- M(8, en),
698
- M(9, y(E)),
699
- M(10, y(Ge))
700
- ], B);
701
- var Gn = Object.getOwnPropertyDescriptor, Kn = (e, t, r, n) => {
702
- for (var i = n > 1 ? void 0 : n ? Gn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
706
+ j = Bn([
707
+ M(0, C(Xe)),
708
+ M(1, C(vt)),
709
+ M(2, he),
710
+ M(3, ve),
711
+ M(4, C(ge)),
712
+ M(5, je),
713
+ M(6, pe),
714
+ M(7, C(qe)),
715
+ M(8, Jt),
716
+ M(9, C(E)),
717
+ M(10, C(We))
718
+ ], j);
719
+ var Vn = Object.getOwnPropertyDescriptor, Wn = (e, t, r, n) => {
720
+ for (var i = n > 1 ? void 0 : n ? Vn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
703
721
  (o = e[s]) && (i = o(i) || i);
704
722
  return i;
705
- }, L = (e, t) => (r, n) => t(r, n, e);
706
- const Zn = () => {
723
+ }, F = (e, t) => (r, n) => t(r, n, e);
724
+ const Gn = () => {
707
725
  let e = [];
708
726
  return {
709
- add: (i, s, o, l, a) => e.push({ unitId: i, subUnitId: s, row: o, col: l, value: a }),
727
+ add: (i, s, o, m, c) => e.push({ unitId: i, subUnitId: s, row: o, col: m, value: c }),
710
728
  getEffects: () => e,
711
729
  clean: () => {
712
730
  e = [];
713
731
  }
714
732
  };
715
733
  };
716
- let Q = class extends ne {
734
+ let J = class extends te {
717
735
  constructor(t, r, n, i, s) {
718
736
  super();
719
737
  // collect effect mutations when edit end and push this to commands stack in next commands progress
720
- q(this, "_collectEffectMutation", Zn());
738
+ X(this, "_collectEffectMutation", Gn());
721
739
  this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = i, this._editorBridgeService = s, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
722
740
  }
723
741
  _initInterceptorEditorStart() {
724
742
  this._editorBridgeService && this.disposeWithMe(
725
- de(
726
- this._sheetInterceptorService.writeCellInterceptor.intercept(Zt, {
743
+ me(
744
+ this._sheetInterceptorService.writeCellInterceptor.intercept(Gt, {
727
745
  handler: (t, r, n) => {
728
746
  const i = r.row, s = r.col, o = this._numfmtService.getValue(
729
747
  r.unitId,
@@ -732,13 +750,13 @@ let Q = class extends ne {
732
750
  s
733
751
  );
734
752
  if (o)
735
- switch (pe(o.pattern)) {
753
+ switch (fe(o.pattern)) {
736
754
  case "scientific":
737
755
  case "currency":
738
756
  case "grouped":
739
757
  case "number": {
740
- const a = r.worksheet.getCellRaw(i, s);
741
- return (a == null ? void 0 : a.t) === x.NUMBER && (a == null ? void 0 : a.v) !== void 0 && a.v !== null && Fe(a.v) && (a.v = _n(Number(a.v))), n && n(a);
758
+ const c = r.worksheet.getCellRaw(i, s);
759
+ return (c == null ? void 0 : c.t) === P.NUMBER && (c == null ? void 0 : c.v) !== void 0 && c.v !== null && De(c.v) && (c.v = gn(Number(c.v))), n && n(c);
742
760
  }
743
761
  case "percent":
744
762
  case "date":
@@ -761,11 +779,11 @@ let Q = class extends ne {
761
779
  // eslint-disable-next-line max-lines-per-function
762
780
  _initInterceptorEditorEnd() {
763
781
  this.disposeWithMe(
764
- de(
765
- this._sheetInterceptorService.writeCellInterceptor.intercept(Yt, {
782
+ me(
783
+ this._sheetInterceptorService.writeCellInterceptor.intercept(Kt, {
766
784
  // eslint-disable-next-line complexity
767
785
  handler: (t, r, n) => {
768
- var c, m, u;
786
+ var a, u, l;
769
787
  if (!(t != null && t.v) && !(t != null && t.p))
770
788
  return n(t);
771
789
  this._collectEffectMutation.clean();
@@ -775,35 +793,35 @@ let Q = class extends ne {
775
793
  r.row,
776
794
  r.col
777
795
  ), s = r.worksheet.getCellRaw(r.row, r.col);
778
- if (De(i == null ? void 0 : i.pattern) || t.t === x.FORCE_STRING)
796
+ if (ke(i == null ? void 0 : i.pattern) || t.t === P.FORCE_STRING)
779
797
  return n(t);
780
- const o = (c = t.p) == null ? void 0 : c.body, l = (u = (m = t == null ? void 0 : t.p) == null ? void 0 : m.body) != null && u.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), a = St(l);
798
+ const o = (a = t.p) == null ? void 0 : a.body, m = (l = (u = t == null ? void 0 : t.p) == null ? void 0 : u.body) != null && l.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), c = gt(m);
781
799
  if (o)
782
- if (Yn(o)) {
800
+ if (Kn(o)) {
783
801
  const { dataStream: v } = o, f = v.replace(/\r\n$/, ""), p = Number(f);
784
- if (Number.isNaN(p) && !a)
802
+ if (Number.isNaN(p) && !c)
785
803
  return n(t);
786
804
  } else
787
805
  return n(t);
788
- if (a) {
789
- if (!a.z && !(i != null && i.pattern) && (s == null ? void 0 : s.t) !== x.STRING && (s == null ? void 0 : s.t) !== x.FORCE_STRING && yt(l))
806
+ if (c) {
807
+ if (!c.z && !(i != null && i.pattern) && (s == null ? void 0 : s.t) !== P.STRING && (s == null ? void 0 : s.t) !== P.FORCE_STRING && _t(m))
790
808
  return n({
791
809
  ...t,
792
810
  p: void 0,
793
- v: l,
794
- t: x.FORCE_STRING
811
+ v: m,
812
+ t: P.FORCE_STRING
795
813
  });
796
- a.z && this._collectEffectMutation.add(
814
+ c.z && this._collectEffectMutation.add(
797
815
  r.unitId,
798
816
  r.subUnitId,
799
817
  r.row,
800
818
  r.col,
801
819
  {
802
- pattern: a.z
820
+ pattern: c.z
803
821
  }
804
822
  );
805
- const v = Number(a.v);
806
- return n({ ...t, p: void 0, v, t: x.NUMBER });
823
+ const v = Number(c.v);
824
+ return n({ ...t, p: void 0, v, t: P.NUMBER });
807
825
  }
808
826
  return n(t);
809
827
  }
@@ -818,27 +836,27 @@ let Q = class extends ne {
818
836
  getMutations(r) {
819
837
  var n;
820
838
  switch (r.id) {
821
- case zt.id: {
822
- const i = t._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET), s = i.getUnitId(), o = (n = i.getActiveSheet()) == null ? void 0 : n.getSheetId();
839
+ case Zt.id: {
840
+ const i = t._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET), s = i.getUnitId(), o = (n = i.getActiveSheet()) == null ? void 0 : n.getSheetId();
823
841
  if (!o)
824
842
  return {
825
843
  redos: [],
826
844
  undos: []
827
845
  };
828
- const l = t._collectEffectMutation.getEffects();
829
- if (t._collectEffectMutation.clean(), !l.length)
846
+ const m = t._collectEffectMutation.getEffects();
847
+ if (t._collectEffectMutation.clean(), !m.length)
830
848
  return {
831
849
  redos: [],
832
850
  undos: []
833
851
  };
834
- const a = l.filter((v) => {
852
+ const c = m.filter((v) => {
835
853
  var f;
836
854
  return !!((f = v.value) != null && f.pattern);
837
855
  }).map((v) => ({
838
856
  row: v.row,
839
857
  col: v.col,
840
858
  pattern: v.value.pattern
841
- })), c = l.filter((v) => {
859
+ })), a = m.filter((v) => {
842
860
  var f;
843
861
  return !((f = v.value) != null && f.pattern);
844
862
  }).map((v) => ({
@@ -846,28 +864,28 @@ let Q = class extends ne {
846
864
  endColumn: v.col,
847
865
  startColumn: v.col,
848
866
  endRow: v.row
849
- })), m = [], u = [];
850
- if (a.length) {
867
+ })), u = [], l = [];
868
+ if (c.length) {
851
869
  const v = {
852
- id: ye.id,
853
- params: Xt(s, o, a)
870
+ id: Se.id,
871
+ params: Yt(s, o, c)
854
872
  };
855
- m.push(v), u.push(...qt(t._injector, v.params));
873
+ u.push(v), l.push(...zt(t._injector, v.params));
856
874
  }
857
- if (c.length) {
875
+ if (a.length) {
858
876
  const v = {
859
- id: Se.id,
877
+ id: _e.id,
860
878
  params: {
861
879
  unitId: s,
862
880
  subUnitId: o,
863
- ranges: c
881
+ ranges: a
864
882
  }
865
883
  };
866
- m.push(v), u.push(...Jt(t._injector, v.params));
884
+ u.push(v), l.push(...Xt(t._injector, v.params));
867
885
  }
868
886
  return {
869
- redos: m,
870
- undos: u.reverse()
887
+ redos: u,
888
+ undos: l.reverse()
871
889
  };
872
890
  }
873
891
  }
@@ -883,25 +901,25 @@ let Q = class extends ne {
883
901
  super.dispose(), this._collectEffectMutation.clean();
884
902
  }
885
903
  };
886
- Q = Kn([
887
- L(0, y(qe)),
888
- L(1, y(ge)),
889
- L(2, y(ve)),
890
- L(3, y(je)),
891
- L(4, _t(Vt))
892
- ], Q);
893
- function Yn(e) {
904
+ J = Wn([
905
+ F(0, C(Xe)),
906
+ F(1, C(pe)),
907
+ F(2, C(he)),
908
+ F(3, C(He)),
909
+ F(4, pt(jt))
910
+ ], J);
911
+ function Kn(e) {
894
912
  const { textRuns: t = [], paragraphs: r = [], customRanges: n, customBlocks: i = [] } = e, s = ["va"];
895
- return !(t.some((o) => !!(o.ts && Object.keys(o.ts).some((a) => s.includes(a)))) || r.some((o) => o.bullet) || r.length >= 2 || n != null && n.length || i.length > 0);
913
+ return !(t.some((o) => !!(o.ts && Object.keys(o.ts).some((c) => s.includes(c)))) || r.some((o) => o.bullet) || r.length >= 2 || n != null && n.length || i.length > 0);
896
914
  }
897
- const ot = (e) => [
915
+ const it = (e) => [
898
916
  {
899
917
  label: "sheet.numfmt.general",
900
918
  pattern: null
901
919
  },
902
920
  {
903
921
  label: "sheet.numfmt.text",
904
- pattern: It
922
+ pattern: yt
905
923
  },
906
924
  "|",
907
925
  {
@@ -955,169 +973,169 @@ const ot = (e) => [
955
973
  label: "sheet.numfmt.moreFmt",
956
974
  pattern: ""
957
975
  }
958
- ], zn = (e) => ({
959
- icon: new A((t) => {
976
+ ], Zn = (e) => ({
977
+ icon: new L((t) => {
960
978
  const r = e.get(E);
961
- return t.next(Pe(r.getCurrentLocale()).icon), r.localeChanged$.subscribe(() => {
962
- t.next(Pe(r.getCurrentLocale()).icon);
979
+ return t.next(we(r.getCurrentLocale()).icon), r.localeChanged$.subscribe(() => {
980
+ t.next(we(r.getCurrentLocale()).icon);
963
981
  });
964
982
  }),
965
- id: Xe.id,
983
+ id: ze.id,
966
984
  title: "sheet.numfmt.currency",
967
985
  tooltip: "sheet.numfmt.currency",
968
- type: X.BUTTON,
969
- hidden$: z(e, w.UNIVER_SHEET),
970
- disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
971
- }), Xn = (e) => ({
986
+ type: z.BUTTON,
987
+ hidden$: Y(e, T.UNIVER_SHEET),
988
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, G], rangeTypes: [W] })
989
+ }), Yn = (e) => ({
972
990
  icon: "AddDigitsIcon",
973
- id: ze.id,
991
+ id: Ye.id,
974
992
  title: "sheet.numfmt.addDecimal",
975
993
  tooltip: "sheet.numfmt.addDecimal",
976
- type: X.BUTTON,
977
- hidden$: z(e, w.UNIVER_SHEET),
978
- disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
979
- }), qn = (e) => ({
994
+ type: z.BUTTON,
995
+ hidden$: Y(e, T.UNIVER_SHEET),
996
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, G], rangeTypes: [W] })
997
+ }), zn = (e) => ({
980
998
  icon: "ReduceDigitsIcon",
981
- id: Ye.id,
999
+ id: Ze.id,
982
1000
  title: "sheet.numfmt.subtractDecimal",
983
1001
  tooltip: "sheet.numfmt.subtractDecimal",
984
- type: X.BUTTON,
985
- hidden$: z(e, w.UNIVER_SHEET),
986
- disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
987
- }), Jn = (e) => ({
1002
+ type: z.BUTTON,
1003
+ hidden$: Y(e, T.UNIVER_SHEET),
1004
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, G], rangeTypes: [W] })
1005
+ }), Xn = (e) => ({
988
1006
  icon: "PercentIcon",
989
- id: Ze.id,
1007
+ id: Ke.id,
990
1008
  title: "sheet.numfmt.percent",
991
1009
  tooltip: "sheet.numfmt.percent",
992
- type: X.BUTTON,
993
- hidden$: z(e, w.UNIVER_SHEET),
994
- disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
995
- }), Qn = (e) => {
996
- const t = e.get(ve), r = e.get(fe), n = e.get(E), i = e.get(_e), s = [Se.id, ye.id], o = Wt(
1010
+ type: z.BUTTON,
1011
+ hidden$: Y(e, T.UNIVER_SHEET),
1012
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, G], rangeTypes: [W] })
1013
+ }), qn = (e) => {
1014
+ const t = e.get(he), r = e.get(ve), n = e.get(E), i = e.get(ge), s = [_e.id, Se.id], o = Bt(
997
1015
  t,
998
1016
  "",
999
- ({ workbook: l, worksheet: a }) => new A(
1000
- (c) => Qe(
1017
+ ({ workbook: m, worksheet: c }) => new L(
1018
+ (a) => Je(
1001
1019
  i.selectionMoveEnd$,
1002
- Ct(r.onCommandExecuted.bind(r)).pipe(
1003
- an(([m]) => s.includes(m.id))
1020
+ St(r.onCommandExecuted.bind(r)).pipe(
1021
+ sn(([u]) => s.includes(u.id))
1004
1022
  )
1005
1023
  ).subscribe(() => {
1006
- var u, v;
1007
- const m = i.getCurrentSelections();
1008
- if (m && m[0]) {
1009
- const f = m[0].range, p = f.startRow, d = f.startColumn, S = (v = l.getStyles().get((u = a.getCell(p, d)) == null ? void 0 : u.s)) == null ? void 0 : v.n, g = S == null ? void 0 : S.pattern, I = $t(n.getCurrentLocale());
1010
- let P = n.t("sheet.numfmt.general");
1011
- if (bt(g)) {
1012
- c.next(P);
1024
+ var l, v;
1025
+ const u = i.getCurrentSelections();
1026
+ if (u && u[0]) {
1027
+ const f = u[0].range, p = f.startRow, d = f.startColumn, S = (v = m.getStyles().get((l = c.getCell(p, d)) == null ? void 0 : l.s)) == null ? void 0 : v.n, g = S == null ? void 0 : S.pattern, I = Ot(n.getCurrentLocale());
1028
+ let w = n.t("sheet.numfmt.general");
1029
+ if (Ct(g)) {
1030
+ a.next(w);
1013
1031
  return;
1014
1032
  }
1015
1033
  if (g) {
1016
- const O = ot(I).filter((U) => typeof U == "object" && U.pattern).find(
1017
- (U) => re(g, U.pattern)
1034
+ const R = it(I).filter((O) => typeof O == "object" && O.pattern).find(
1035
+ (O) => ne(g, O.pattern)
1018
1036
  );
1019
- O && typeof O == "object" && O.pattern ? P = n.t(O.label) : P = n.t("sheet.numfmt.moreFmt");
1037
+ R && typeof R == "object" && R.pattern ? w = n.t(R.label) : w = n.t("sheet.numfmt.moreFmt");
1020
1038
  }
1021
- c.next(P);
1039
+ a.next(w);
1022
1040
  }
1023
1041
  })
1024
1042
  )
1025
1043
  );
1026
1044
  return {
1027
- label: at,
1028
- id: H.id,
1045
+ label: st,
1046
+ id: A.id,
1029
1047
  tooltip: "sheet.numfmt.title",
1030
- type: X.SELECTOR,
1048
+ type: z.SELECTOR,
1031
1049
  slot: !0,
1032
1050
  selections: [
1033
1051
  {
1034
1052
  label: {
1035
- name: ct,
1053
+ name: ot,
1036
1054
  hoverable: !1,
1037
1055
  selectable: !1
1038
1056
  }
1039
1057
  }
1040
1058
  ],
1041
1059
  value$: o,
1042
- hidden$: z(e, w.UNIVER_SHEET),
1043
- disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [K, Z], rangeTypes: [G] })
1060
+ hidden$: Y(e, T.UNIVER_SHEET),
1061
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [G, K], rangeTypes: [W] })
1044
1062
  };
1045
- }, at = "sheet.numfmt.moreNumfmtType", ct = "sheet.numfmt.moreNumfmtType.options", er = (e) => {
1063
+ }, st = "sheet.numfmt.moreNumfmtType", ot = "sheet.numfmt.moreNumfmtType.options", Jn = (e) => {
1046
1064
  const { value: t } = e, r = b(E), n = t != null ? t : r.t("sheet.numfmt.general");
1047
1065
  return /* @__PURE__ */ h("span", { className: "univer-text-sm", children: n });
1048
- }, tr = () => {
1049
- const e = b(fe), t = b(E), r = b(tn), n = b(Ge), i = b(_e), s = (c) => {
1050
- const m = i.getCurrentLastSelection();
1051
- if (!m)
1066
+ }, Qn = () => {
1067
+ const e = b(ve), t = b(E), r = b(Qt), n = b(We), i = b(ge), s = (a) => {
1068
+ const u = i.getCurrentLastSelection();
1069
+ if (!u)
1052
1070
  return;
1053
- const u = m.range, v = [];
1054
- He.foreach(u, (f, p) => {
1055
- c ? v.push({ row: f, col: p, pattern: c, type: pe(c) }) : v.push({ row: f, col: p });
1056
- }), e.executeCommand(Ke.id, { values: v }), r.focus();
1057
- }, o = R(() => {
1058
- const c = Dt.get(t.getCurrentLocale());
1059
- return ot(c);
1060
- }, [t]), l = (c) => {
1061
- if (c === 0)
1071
+ const l = u.range, v = [];
1072
+ Ae.foreach(l, (f, p) => {
1073
+ a ? v.push({ row: f, col: p, pattern: a, type: fe(a) }) : v.push({ row: f, col: p });
1074
+ }), e.executeCommand(Ge.id, { values: v }), r.focus();
1075
+ }, o = x(() => {
1076
+ const a = Ut.get(t.getCurrentLocale());
1077
+ return it(a);
1078
+ }, [t]), m = (a) => {
1079
+ if (a === 0)
1062
1080
  s(null);
1063
- else if (c === o.length - 1)
1064
- e.executeCommand(H.id), r.focus();
1081
+ else if (a === o.length - 1)
1082
+ e.executeCommand(A.id), r.focus();
1065
1083
  else {
1066
- const m = o[c];
1067
- m.pattern && s(m.pattern);
1084
+ const u = o[a];
1085
+ u.pattern && s(u.pattern);
1068
1086
  }
1069
- }, a = 1220;
1070
- return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((c, m) => c === "|" ? /* @__PURE__ */ h(gn, {}, m) : /* @__PURE__ */ C(
1087
+ }, c = 1220;
1088
+ return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((a, u) => a === "|" ? /* @__PURE__ */ h(pn, {}, u) : /* @__PURE__ */ y(
1071
1089
  "div",
1072
1090
  {
1073
1091
  className: "univer-flex univer-h-7 univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-px-2 univer-text-sm hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
1074
1092
  onClick: () => {
1075
- l(m);
1093
+ m(u);
1076
1094
  },
1077
1095
  children: [
1078
- /* @__PURE__ */ h("span", { children: t.t(c.label) }),
1079
- /* @__PURE__ */ h("span", { className: "univer-text-xs univer-text-gray-500", children: c.pattern ? Ft(c.pattern || "", a, n.locale).result.trim() : "" })
1096
+ /* @__PURE__ */ h("span", { children: t.t(a.label) }),
1097
+ /* @__PURE__ */ h("span", { className: "univer-text-xs univer-text-gray-500", children: a.pattern ? kt(a.pattern || "", c, n.locale).result.trim() : "" })
1080
1098
  ]
1081
1099
  },
1082
- m
1100
+ u
1083
1101
  )) });
1084
- }, nr = {
1085
- [nn.FORMULAS]: {
1086
- [Xe.id]: {
1102
+ }, er = {
1103
+ [en.FORMULAS]: {
1104
+ [ze.id]: {
1087
1105
  order: 0,
1088
- menuItemFactory: zn
1106
+ menuItemFactory: Zn
1089
1107
  },
1090
- [ze.id]: {
1108
+ [Ye.id]: {
1091
1109
  order: 1,
1092
- menuItemFactory: Xn
1110
+ menuItemFactory: Yn
1093
1111
  },
1094
- [Ye.id]: {
1112
+ [Ze.id]: {
1095
1113
  order: 2,
1096
- menuItemFactory: qn
1114
+ menuItemFactory: zn
1097
1115
  },
1098
- [Ze.id]: {
1116
+ [Ke.id]: {
1099
1117
  order: 3,
1100
- menuItemFactory: Jn
1118
+ menuItemFactory: Xn
1101
1119
  },
1102
- [H.id]: {
1120
+ [A.id]: {
1103
1121
  order: 4,
1104
- menuItemFactory: Qn
1122
+ menuItemFactory: qn
1105
1123
  }
1106
1124
  }
1107
1125
  };
1108
- var rr = Object.getOwnPropertyDescriptor, ir = (e, t, r, n) => {
1109
- for (var i = n > 1 ? void 0 : n ? rr(t, r) : t, s = e.length - 1, o; s >= 0; s--)
1126
+ var tr = Object.getOwnPropertyDescriptor, nr = (e, t, r, n) => {
1127
+ for (var i = n > 1 ? void 0 : n ? tr(t, r) : t, s = e.length - 1, o; s >= 0; s--)
1110
1128
  (o = e[s]) && (i = o(i) || i);
1111
1129
  return i;
1112
- }, Ue = (e, t) => (r, n) => t(r, n, e);
1113
- let ee = class extends ne {
1130
+ }, Oe = (e, t) => (r, n) => t(r, n, e);
1131
+ let Q = class extends te {
1114
1132
  constructor(e, t) {
1115
1133
  super(), this._componentManager = e, this._menuManagerService = t, this._initMenu();
1116
1134
  }
1117
1135
  _initMenu() {
1118
- this._menuManagerService.mergeMenu(nr), [
1119
- [at, er],
1120
- [ct, tr]
1136
+ this._menuManagerService.mergeMenu(er), [
1137
+ [st, Jn],
1138
+ [ot, Qn]
1121
1139
  ].forEach(([e, t]) => {
1122
1140
  this.disposeWithMe(
1123
1141
  this._componentManager.register(e, t)
@@ -1125,57 +1143,57 @@ let ee = class extends ne {
1125
1143
  });
1126
1144
  }
1127
1145
  };
1128
- ee = ir([
1129
- Ue(0, y(Je)),
1130
- Ue(1, rn)
1131
- ], ee);
1132
- var sr = Object.defineProperty, or = Object.getOwnPropertyDescriptor, ar = (e, t, r) => t in e ? sr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, cr = (e, t, r, n) => {
1133
- for (var i = n > 1 ? void 0 : n ? or(t, r) : t, s = e.length - 1, o; s >= 0; s--)
1146
+ Q = nr([
1147
+ Oe(0, C(qe)),
1148
+ Oe(1, tn)
1149
+ ], Q);
1150
+ var rr = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, sr = (e, t, r) => t in e ? rr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, or = (e, t, r, n) => {
1151
+ for (var i = n > 1 ? void 0 : n ? ir(t, r) : t, s = e.length - 1, o; s >= 0; s--)
1134
1152
  (o = e[s]) && (i = o(i) || i);
1135
1153
  return i;
1136
- }, me = (e, t) => (r, n) => t(r, n, e), lt = (e, t, r) => ar(e, typeof t != "symbol" ? t + "" : t, r);
1137
- const lr = "SHEET_NUMFMT_UI_PLUGIN";
1138
- let te = class extends Et {
1139
- constructor(e = Re, t, r, n) {
1154
+ }, ue = (e, t) => (r, n) => t(r, n, e), ct = (e, t, r) => sr(e, typeof t != "symbol" ? t + "" : t, r);
1155
+ const cr = "SHEET_NUMFMT_UI_PLUGIN";
1156
+ let ee = class extends It {
1157
+ constructor(e = xe, t, r, n) {
1140
1158
  super(), this._config = e, this._injector = t, this._configService = r, this._renderManagerService = n;
1141
- const { menu: i, ...s } = Tt(
1159
+ const { menu: i, ...s } = Nt(
1142
1160
  {},
1143
- Re,
1161
+ xe,
1144
1162
  this._config
1145
1163
  );
1146
1164
  i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig("sheets-numfmt-ui.config", s);
1147
1165
  }
1148
1166
  onStarting() {
1149
- wt(this._injector, [
1150
- [B],
1151
- [Q],
1167
+ Et(this._injector, [
1152
1168
  [j],
1153
- [ee]
1169
+ [J],
1170
+ [H],
1171
+ [Q]
1154
1172
  ]);
1155
1173
  }
1156
1174
  onRendered() {
1157
- this._registerRenderModules(), Mt(this._injector, [
1158
- [B],
1159
- [Q],
1160
- [ee]
1175
+ this._registerRenderModules(), Tt(this._injector, [
1176
+ [j],
1177
+ [J],
1178
+ [Q]
1161
1179
  ]);
1162
1180
  }
1163
1181
  _registerRenderModules() {
1164
1182
  [
1165
- [he]
1183
+ [de]
1166
1184
  ].forEach((t) => {
1167
- this.disposeWithMe(this._renderManagerService.registerRenderModule(w.UNIVER_SHEET, t));
1185
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(T.UNIVER_SHEET, t));
1168
1186
  });
1169
1187
  }
1170
1188
  };
1171
- lt(te, "pluginName", lr);
1172
- lt(te, "type", w.UNIVER_SHEET);
1173
- te = cr([
1174
- Nt(Gt, Lt),
1175
- me(1, y(je)),
1176
- me(2, $e),
1177
- me(3, Be)
1178
- ], te);
1189
+ ct(ee, "pluginName", cr);
1190
+ ct(ee, "type", T.UNIVER_SHEET);
1191
+ ee = or([
1192
+ bt(Vt, Dt),
1193
+ ue(1, C(He)),
1194
+ ue(2, Ue),
1195
+ ue(3, je)
1196
+ ], ee);
1179
1197
  export {
1180
- te as UniverSheetsNumfmtUIPlugin
1198
+ ee as UniverSheetsNumfmtUIPlugin
1181
1199
  };