@univerjs/sheets-numfmt-ui 0.5.3 → 0.5.4

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