@univerjs/sheets-numfmt-ui 0.6.10 → 0.7.0-beta.1

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