@univerjs/sheets-numfmt-ui 0.15.5 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,26 +1,26 @@
1
- var ut = Object.defineProperty;
2
- var mt = (e, t, r) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var X = (e, t, r) => mt(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { Inject as C, LocaleService as E, IConfigService as ke, Disposable as te, isTextFormat as Ue, Tools as dt, isRealNum as De, CommandType as Fe, ILocalStorageService as Le, isPatternEqualWithoutDecimal as ne, numfmt as ht, ThemeService as vt, IUniverInstanceService as he, ICommandService as ve, UniverInstanceType as T, CellValueType as P, toDisposable as me, DisposableCollection as ft, InterceptorEffectEnum as Te, Range as Ae, Injector as He, Optional as pt, getNumfmtParseValueFilter as gt, willLoseNumericPrecision as _t, fromCallback as St, isDefaultFormat as Ct, DEFAULT_TEXT_FORMAT_EXCEL as yt, DependentOn as bt, Plugin as It, merge as Nt, registerDependencies as Et, touchDependencies as Tt } from "@univerjs/core";
5
- import { IRenderManagerService as je } from "@univerjs/engine-render";
6
- import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Mt, currencySymbols as Me, getDecimalFromPattern as q, getCurrencyType as B, setPatternDecimal as $, getCurrencyFormatOptions as se, CURRENCYFORMAT as wt, DATEFMTLISG as Pt, NUMBERFORMAT as xt, getDateFormatOptions as Be, getNumberFormatOptions as Ve, isPatternHasDecimal as Rt, SheetsNumfmtCellContentController as We, getPatternPreviewIgnoreGeneral as $t, getPatternType as fe, SetNumfmtCommand as Ge, SubtractDecimalCommand as Ke, AddDecimalCommand as Ye, SetCurrencyCommand as Ze, getCurrencySymbolIconByLocale as we, SetPercentCommand as ze, getCurrencySymbolByLocale as Ot, localeCurrencySymbolMap as kt, getPatternPreview as Ut, UniverSheetsNumfmtPlugin as Dt } from "@univerjs/sheets-numfmt";
7
- import { HoverManagerService as Ft, CellAlertManagerService as Lt, CellAlertType as At, SheetSkeletonManagerService as Ht, IEditorBridgeService as jt, getCurrentRangeDisable$ as V, deriveStateFromActiveSheet$ as Bt, UniverSheetsUIPlugin as Vt } from "@univerjs/sheets-ui";
8
- import { INumfmtService as pe, SheetInterceptorService as Xe, SheetsSelectionsService as ge, INTERCEPTOR_POINT as Wt, RemoveNumfmtMutation as _e, SetNumfmtMutation as Se, BEFORE_CELL_EDIT as Gt, AFTER_CELL_EDIT as Kt, SetRangeValuesCommand as Yt, transformCellsToRange as Zt, factorySetNumfmtUndoMutation as zt, factoryRemoveNumfmtUndoMutation as Xt, RangeProtectionPermissionEditPoint as W, WorksheetEditPermission as G, WorksheetSetCellStylePermission as K, WorkbookEditablePermission as Y } from "@univerjs/sheets";
9
- import { IZenZoneService as qt, useDependency as b, ComponentManager as qe, ISidebarService as Jt, getMenuHiddenObservable as Z, MenuItemType as z, ILayoutService as Qt, RibbonStartGroup as en, IMenuManagerService as tn } from "@univerjs/ui";
10
- import { debounceTime as nn, merge as Je, Observable as L, combineLatest as rn, filter as sn } from "rxjs";
11
- import { map as on, switchMap as cn, tap as an, debounceTime as ln } from "rxjs/operators";
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 C, LocaleService as E, IConfigService as De, Disposable as ne, isTextFormat as Fe, Tools as ht, isRealNum as he, CommandType as Le, ILocalStorageService as Ae, isPatternEqualWithoutDecimal as re, numfmt as vt, ThemeService as ft, IUniverInstanceService as pe, ICommandService as ge, UniverInstanceType as T, CellValueType as w, toDisposable as ve, DisposableCollection as pt, InterceptorEffectEnum as we, Range as He, Injector as je, Optional as gt, getNumfmtParseValueFilter as _t, willLoseNumericPrecision as St, fromCallback as Ct, isDefaultFormat as yt, DEFAULT_TEXT_FORMAT_EXCEL as bt, DependentOn as It, Plugin as Nt, merge as Et, registerDependencies as Tt, touchDependencies as Mt } from "@univerjs/core";
5
+ import { IRenderManagerService as Be } from "@univerjs/engine-render";
6
+ import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as wt, currencySymbols as Pe, getDecimalFromPattern as J, getCurrencyType as W, setPatternDecimal as $, getCurrencyFormatOptions as oe, CURRENCYFORMAT as Pt, DATEFMTLISG as Rt, NUMBERFORMAT as xt, getDateFormatOptions as We, getNumberFormatOptions as Ve, isPatternHasDecimal as $t, SheetsNumfmtCellContentController as Ge, getPatternPreviewIgnoreGeneral as Ot, getPatternType as L, SetNumfmtCommand as Ke, SubtractDecimalCommand as Ye, AddDecimalCommand as Ze, SetCurrencyCommand as ze, getCurrencySymbolIconByLocale as Re, SetPercentCommand as Xe, getCurrencySymbolByLocale as kt, localeCurrencySymbolMap as Ut, getPatternPreview as Dt, UniverSheetsNumfmtPlugin as Ft } from "@univerjs/sheets-numfmt";
7
+ import { HoverManagerService as Lt, CellAlertManagerService as At, CellAlertType as Ht, SheetSkeletonManagerService as jt, IEditorBridgeService as Bt, getCurrentRangeDisable$ as V, deriveStateFromActiveSheet$ as Wt, UniverSheetsUIPlugin as Vt } from "@univerjs/sheets-ui";
8
+ import { INumfmtService as _e, SheetInterceptorService as qe, SheetsSelectionsService as Se, INTERCEPTOR_POINT as Gt, RemoveNumfmtMutation as Ce, SetNumfmtMutation as ye, BEFORE_CELL_EDIT as Kt, AFTER_CELL_EDIT as Yt, SetRangeValuesCommand as Zt, transformCellsToRange as zt, factorySetNumfmtUndoMutation as Xt, factoryRemoveNumfmtUndoMutation as qt, RangeProtectionPermissionEditPoint as G, WorksheetEditPermission as K, WorksheetSetCellStylePermission as Y, WorkbookEditablePermission as Z } from "@univerjs/sheets";
9
+ import { IZenZoneService as Jt, useDependency as b, ComponentManager as Je, ISidebarService as Qt, getMenuHiddenObservable as z, MenuItemType as X, ILayoutService as en, RibbonStartGroup as tn, IMenuManagerService as nn } from "@univerjs/ui";
10
+ import { debounceTime as rn, merge as Qe, Observable as A, combineLatest as sn, filter as on } from "rxjs";
11
+ import { map as cn, switchMap as an, tap as ln, debounceTime as un } from "rxjs/operators";
12
12
  import { jsxs as y, jsx as h } from "react/jsx-runtime";
13
- import { createContext as un, useState as N, useEffect as re, useRef as Ce, useContext as Qe, useMemo as x, createElement as ye, forwardRef as mn, useCallback as dn } from "react";
14
- import { InputNumber as be, Select as Ie, SelectList as Ne, Input as hn, clsx as et, borderClassName as vn, Button as Pe, scrollbarClassName as fn, Separator as pn } from "@univerjs/design";
15
- import { stripErrorMargin as gn } from "@univerjs/engine-formula";
16
- const xe = {};
13
+ import { createContext as mn, useState as N, useEffect as ie, useRef as be, useContext as et, useMemo as R, createElement as Ie, forwardRef as dn, useCallback as hn } from "react";
14
+ import { InputNumber as Ne, Select as Ee, SelectList as Te, Input as vn, clsx as tt, borderClassName as fn, Button as xe, scrollbarClassName as pn, Separator as gn } from "@univerjs/design";
15
+ import { stripErrorMargin as ce } from "@univerjs/engine-formula";
16
+ const $e = {};
17
17
  var _n = Object.getOwnPropertyDescriptor, Sn = (e, t, r, n) => {
18
18
  for (var i = n > 1 ? void 0 : n ? _n(t, r) : t, s = e.length - 1, o; s >= 0; s--)
19
19
  (o = e[s]) && (i = o(i) || i);
20
20
  return i;
21
21
  }, U = (e, t) => (r, n) => t(r, n, e);
22
- const oe = "SHEET_NUMFMT_ALERT";
23
- let de = class extends te {
22
+ const ae = "SHEET_NUMFMT_ALERT";
23
+ let fe = class extends ne {
24
24
  constructor(e, t, r, n, i, s, o) {
25
25
  super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = r, this._localeService = n, this._zenZoneService = i, this._numfmtService = s, this._configService = o, this._init();
26
26
  }
@@ -28,7 +28,7 @@ let de = class extends te {
28
28
  this._initCellAlertPopup(), this._initZenService();
29
29
  }
30
30
  _initCellAlertPopup() {
31
- this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(nn(100)).subscribe((e) => {
31
+ this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(rn(100)).subscribe((e) => {
32
32
  var t, r;
33
33
  if (e) {
34
34
  const n = e.location, i = this._context.unit, s = i.getActiveSheet();
@@ -44,22 +44,22 @@ let de = class extends te {
44
44
  this._hideAlert();
45
45
  return;
46
46
  }
47
- if (Ue(c.pattern) && dt.isDefine(a == null ? void 0 : a.v) && De(a.v)) {
48
- if ((t = this._configService.getConfig(Mt)) != null && t.disableTextFormatAlert)
47
+ if (Fe(c.pattern) && ht.isDefine(a == null ? void 0 : a.v) && he(a.v)) {
48
+ if ((t = this._configService.getConfig(wt)) != null && t.disableTextFormatAlert)
49
49
  return;
50
- const u = this._cellAlertManagerService.currentAlert.get(oe), l = (r = u == null ? void 0 : u.alert) == null ? void 0 : r.location;
50
+ const u = this._cellAlertManagerService.currentAlert.get(ae), l = (r = u == null ? void 0 : u.alert) == null ? void 0 : r.location;
51
51
  if (l && l.row === n.row && l.col === n.col && l.subUnitId === n.subUnitId && l.unitId === n.unitId) {
52
52
  this._hideAlert();
53
53
  return;
54
54
  }
55
55
  this._cellAlertManagerService.showAlert({
56
- type: At.ERROR,
56
+ type: Ht.ERROR,
57
57
  title: this._localeService.t("info.error"),
58
58
  message: this._localeService.t("info.forceStringInfo"),
59
59
  location: n,
60
60
  width: 200,
61
61
  height: 74,
62
- key: oe
62
+ key: ae
63
63
  });
64
64
  return;
65
65
  }
@@ -73,36 +73,36 @@ let de = class extends te {
73
73
  }));
74
74
  }
75
75
  _hideAlert() {
76
- this._cellAlertManagerService.removeAlert(oe);
76
+ this._cellAlertManagerService.removeAlert(ae);
77
77
  }
78
78
  };
79
- de = Sn([
80
- U(1, C(Ft)),
81
- U(2, C(Lt)),
79
+ fe = Sn([
80
+ U(1, C(Lt)),
81
+ U(2, C(At)),
82
82
  U(3, C(E)),
83
- U(4, qt),
84
- U(5, C(pe)),
85
- U(6, ke)
86
- ], de);
87
- const ce = {
83
+ U(4, Jt),
84
+ U(5, C(_e)),
85
+ U(6, De)
86
+ ], fe);
87
+ const le = {
88
88
  id: "sheet.operation.close.numfmt.panel",
89
- type: Fe.OPERATION,
89
+ type: Le.OPERATION,
90
90
  handler: () => (
91
91
  // do nothing, just notify panel is closed
92
92
  !0
93
93
  )
94
- }, A = {
94
+ }, H = {
95
95
  id: "sheet.operation.open.numfmt.panel",
96
- type: Fe.OPERATION,
97
- handler: (e) => (e.get(j).openPanel(), !0)
96
+ type: Le.OPERATION,
97
+ handler: (e) => (e.get(B).openPanel(), !0)
98
98
  };
99
99
  var Cn = Object.getOwnPropertyDescriptor, yn = (e, t, r, n) => {
100
100
  for (var i = n > 1 ? void 0 : n ? Cn(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
103
  }, bn = (e, t) => (r, n) => t(r, n, e);
104
- const Ee = un([]);
105
- let H = class {
104
+ const Me = mn([]);
105
+ let j = class {
106
106
  constructor(e) {
107
107
  this._localStorageService = e;
108
108
  }
@@ -146,31 +146,31 @@ let H = class {
146
146
  this._localStorageService.removeItem(e);
147
147
  }
148
148
  };
149
- H = yn([
150
- bn(0, C(Le))
151
- ], H);
152
- const Re = "numfmtCurrency", In = (e) => {
153
- const t = b(H), [r, n] = N(Me);
154
- return re(() => {
149
+ j = yn([
150
+ bn(0, C(Ae))
151
+ ], j);
152
+ const Oe = "numfmtCurrency", In = (e) => {
153
+ const t = b(j), [r, n] = N(Pe);
154
+ return ie(() => {
155
155
  t.addHabit("numfmtCurrency", []).then(() => {
156
- t.getHabit(Re, [...Me]).then((s) => {
156
+ t.getHabit(Oe, [...Pe]).then((s) => {
157
157
  n(s), e && e(s);
158
158
  });
159
159
  });
160
160
  }, []), { userHabitCurrency: r, mark: (s) => {
161
- t.markHabit(Re, s);
161
+ t.markHabit(Oe, s);
162
162
  } };
163
163
  }, Nn = () => {
164
- const e = Ce([]), [t, r] = N({});
165
- return re(() => {
164
+ const e = be([]), [t, r] = N({});
165
+ return ie(() => {
166
166
  e.current.forEach((i) => {
167
167
  i();
168
168
  }), e.current = [];
169
169
  }, [t]), (i) => {
170
170
  e.current.push(i), r({});
171
171
  };
172
- }, En = (e) => !!B(e) && e.startsWith("_("), Tn = (e) => {
173
- const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => q(t || "", 2)), o = Qe(Ee), [m, c] = N(() => B(t) || o[0]), a = x(() => o.map((p) => ({ label: p, value: p })), []), l = b(E).t;
172
+ }, En = (e) => !!W(e) && e.startsWith("_("), Tn = (e) => {
173
+ const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => J(t || "", 2)), o = et(Me), [m, c] = N(() => W(t) || o[0]), a = R(() => o.map((p) => ({ label: p, value: p })), []), l = b(E).t;
174
174
  r.current = () => $(`_("${m}"* #,##0${i > 0 ? ".0" : ""}_)`, i);
175
175
  const v = (p) => {
176
176
  c(p), n($(`_("${p}"* #,##0${i > 0 ? ".0" : ""}_)`, i));
@@ -183,7 +183,7 @@ const Re = "numfmtCurrency", In = (e) => {
183
183
  /* @__PURE__ */ y("div", { className: "option", children: [
184
184
  /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.decimalLength") }),
185
185
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ h(
186
- be,
186
+ Ne,
187
187
  {
188
188
  value: i,
189
189
  step: 1,
@@ -197,7 +197,7 @@ const Re = "numfmtCurrency", In = (e) => {
197
197
  /* @__PURE__ */ y("div", { className: "option", children: [
198
198
  /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.currencyType") }),
199
199
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ h(
200
- Ie,
200
+ Ee,
201
201
  {
202
202
  options: a,
203
203
  value: m,
@@ -208,18 +208,18 @@ const Re = "numfmtCurrency", In = (e) => {
208
208
  ] }),
209
209
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.accountingDes") })
210
210
  ] });
211
- }, Mn = (e) => !!B(e) && !e.startsWith("_("), wn = (e) => {
212
- const r = b(E).t, n = Qe(Ee), [i, s] = N(() => B(e.defaultPattern) || n[0]), [o, m] = N(() => q(e.defaultPattern || "", 2)), [c, a] = N(() => {
211
+ }, Mn = (e) => !!W(e) && !e.startsWith("_("), wn = (e) => {
212
+ const r = b(E).t, n = et(Me), [i, s] = N(() => W(e.defaultPattern) || n[0]), [o, m] = N(() => J(e.defaultPattern || "", 2)), [c, a] = N(() => {
213
213
  var g;
214
- const d = se(i);
215
- return ((g = d.find((I) => ne(I.value, e.defaultPattern))) == null ? void 0 : g.value) || d[0].value;
216
- }), u = x(() => se(i), [i]), l = x(() => n.map((d) => ({ label: d, value: d })), [n]);
214
+ const d = oe(i);
215
+ return ((g = d.find((I) => re(I.value, e.defaultPattern))) == null ? void 0 : g.value) || d[0].value;
216
+ }), u = R(() => oe(i), [i]), l = R(() => n.map((d) => ({ label: d, value: d })), [n]);
217
217
  e.action.current = () => $(c, o);
218
218
  const v = (d) => {
219
219
  if (d === void 0)
220
220
  return;
221
221
  s(d);
222
- const S = se(d)[0].value;
222
+ const S = oe(d)[0].value;
223
223
  a(S), e.onChange($(S, o));
224
224
  }, f = (d) => {
225
225
  d !== void 0 && (a(d), e.onChange($(d, o)));
@@ -231,7 +231,7 @@ const Re = "numfmtCurrency", In = (e) => {
231
231
  /* @__PURE__ */ y("div", { className: "option", children: [
232
232
  /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.decimalLength") }),
233
233
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ h(
234
- be,
234
+ Ne,
235
235
  {
236
236
  value: o,
237
237
  max: 20,
@@ -243,7 +243,7 @@ const Re = "numfmtCurrency", In = (e) => {
243
243
  /* @__PURE__ */ y("div", { className: "option", children: [
244
244
  /* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyType") }),
245
245
  /* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ h(
246
- Ie,
246
+ Ee,
247
247
  {
248
248
  value: i,
249
249
  options: l,
@@ -253,13 +253,13 @@ const Re = "numfmtCurrency", In = (e) => {
253
253
  ] })
254
254
  ] }),
255
255
  /* @__PURE__ */ h("div", { className: "label univer-mt-4", children: r("sheet.numfmt.negType") }),
256
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { value: c, options: u, onChange: f }) }),
256
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Te, { value: c, options: u, onChange: f }) }),
257
257
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyDes") })
258
258
  ] });
259
259
  };
260
- function tt({ ref: e, ...t }) {
261
- const { icon: r, id: n, className: i, extend: s, ...o } = t, m = `univerjs-icon univerjs-icon-${n} ${i || ""}`.trim(), c = Ce(`_${Rn()}`);
262
- return nt(r, `${n}`, {
260
+ function nt({ ref: e, ...t }) {
261
+ const { icon: r, id: n, className: i, extend: s, ...o } = t, m = `univerjs-icon univerjs-icon-${n} ${i || ""}`.trim(), c = be(`_${xn()}`);
262
+ return rt(r, `${n}`, {
263
263
  defIds: r.defIds,
264
264
  idSuffix: c.current
265
265
  }, {
@@ -268,12 +268,12 @@ function tt({ ref: e, ...t }) {
268
268
  ...o
269
269
  }, s);
270
270
  }
271
- function nt(e, t, r, n, i) {
272
- return ye(e.tag, {
271
+ function rt(e, t, r, n, i) {
272
+ return Ie(e.tag, {
273
273
  key: t,
274
274
  ...Pn(e, r, i),
275
275
  ...n
276
- }, (xn(e, r).children || []).map((s, o) => nt(s, `${t}-${e.tag}-${o}`, r, void 0, i)));
276
+ }, (Rn(e, r).children || []).map((s, o) => rt(s, `${t}-${e.tag}-${o}`, r, void 0, i)));
277
277
  }
278
278
  function Pn(e, t, r) {
279
279
  const n = { ...e.attrs };
@@ -285,7 +285,7 @@ function Pn(e, t, r) {
285
285
  typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
286
286
  })), n;
287
287
  }
288
- function xn(e, t) {
288
+ function Rn(e, t) {
289
289
  var n;
290
290
  const { defIds: r } = t;
291
291
  return !r || r.length === 0 ? e : e.tag === "defs" && ((n = e.children) != null && n.length) ? {
@@ -299,10 +299,10 @@ function xn(e, t) {
299
299
  } : i)
300
300
  } : e;
301
301
  }
302
- function Rn() {
302
+ function xn() {
303
303
  return Math.random().toString(36).substring(2, 8);
304
304
  }
305
- tt.displayName = "UniverIcon";
305
+ nt.displayName = "UniverIcon";
306
306
  const $n = {
307
307
  tag: "svg",
308
308
  attrs: {
@@ -321,31 +321,31 @@ const $n = {
321
321
  clipRule: "evenodd"
322
322
  }
323
323
  }]
324
- }, rt = mn(function(t, r) {
325
- return ye(tt, Object.assign({}, t, {
324
+ }, it = dn(function(t, r) {
325
+ return Ie(nt, Object.assign({}, t, {
326
326
  id: "check-mark-icon",
327
327
  ref: r,
328
328
  icon: $n
329
329
  }));
330
330
  });
331
- rt.displayName = "CheckMarkIcon";
332
- const ae = "customFormat", le = "numfmt_custom_pattern";
331
+ it.displayName = "CheckMarkIcon";
332
+ const ue = "customFormat", me = "numfmt_custom_pattern";
333
333
  function On(e) {
334
- const { defaultPattern: t, action: r, onChange: n } = e, i = b(H), s = b(Le), o = b(E), [m, c] = N(t);
335
- r.current = () => (i.markHabit(ae, m), s.getItem(le).then((f = []) => {
334
+ const { defaultPattern: t, action: r, onChange: n } = e, i = b(j), s = b(Ae), o = b(E), [m, c] = N(t);
335
+ r.current = () => (i.markHabit(ue, m), s.getItem(me).then((f = []) => {
336
336
  const p = [.../* @__PURE__ */ new Set([m, ...f || []])].splice(0, 10).filter((d) => !!d);
337
- s.setItem(le, p);
337
+ s.setItem(me, p);
338
338
  }), m);
339
339
  const [a, u] = N([]);
340
- re(() => {
341
- s.getItem(le).then((f) => {
340
+ ie(() => {
341
+ s.getItem(me).then((f) => {
342
342
  const p = [
343
- ...wt.map((d) => d.suffix("$")),
344
- ...Pt.map((d) => d.suffix),
343
+ ...Pt.map((d) => d.suffix("$")),
344
+ ...Rt.map((d) => d.suffix),
345
345
  ...xt.map((d) => d.suffix)
346
346
  ];
347
- p.push(...f || []), i.addHabit(ae, []).finally(() => {
348
- i.getHabit(ae, p).then((d) => {
347
+ p.push(...f || []), i.addHabit(ue, []).finally(() => {
348
+ i.getHabit(ue, p).then((d) => {
349
349
  u([...new Set(d)]);
350
350
  });
351
351
  });
@@ -359,7 +359,7 @@ function On(e) {
359
359
  return /* @__PURE__ */ y("div", { children: [
360
360
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: o.t("sheet.numfmt.customFormat") }),
361
361
  /* @__PURE__ */ h(
362
- hn,
362
+ vn,
363
363
  {
364
364
  placeholder: o.t("sheet.numfmt.customFormat"),
365
365
  onBlur: v,
@@ -371,14 +371,14 @@ function On(e) {
371
371
  /* @__PURE__ */ h(
372
372
  "div",
373
373
  {
374
- className: et("univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2", vn),
374
+ className: tt("univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2", fn),
375
375
  children: a.map((f) => /* @__PURE__ */ y(
376
376
  "div",
377
377
  {
378
378
  onClick: () => l(f),
379
379
  className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-1.5 univer-py-1.5 univer-text-sm",
380
380
  children: [
381
- /* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: m === f && /* @__PURE__ */ h(rt, {}) }),
381
+ /* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: m === f && /* @__PURE__ */ h(it, {}) }),
382
382
  /* @__PURE__ */ h("div", { children: f })
383
383
  ]
384
384
  },
@@ -396,11 +396,11 @@ function On(e) {
396
396
  ] });
397
397
  }
398
398
  const kn = (e) => {
399
- const t = ht.getFormatInfo(e);
400
- return Be().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
399
+ const t = vt.getFormatInfo(e);
400
+ return We().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
401
401
  };
402
402
  function Un(e) {
403
- const { onChange: t, defaultPattern: r } = e, n = x(Be, []), i = b(E), [s, o] = N(() => {
403
+ const { onChange: t, defaultPattern: r } = e, n = R(We, []), i = b(E), [s, o] = N(() => {
404
404
  if (r) {
405
405
  const c = n.find((a) => a.value === r);
406
406
  if (c)
@@ -414,7 +414,7 @@ function Un(e) {
414
414
  };
415
415
  return /* @__PURE__ */ y("div", { children: [
416
416
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: i.t("sheet.numfmt.dateType") }),
417
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { value: s, options: n, onChange: m }) }),
417
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Te, { value: s, options: n, onChange: m }) }),
418
418
  /* @__PURE__ */ h(
419
419
  "div",
420
420
  {
@@ -433,20 +433,20 @@ const Dn = (e) => !e, Fn = (e) => {
433
433
  children: r("sheet.numfmt.generalDes")
434
434
  }
435
435
  ) });
436
- }, Ln = (e) => Ve().some((t) => ne(t.value, e));
436
+ }, Ln = (e) => Ve().some((t) => re(t.value, e));
437
437
  function An(e) {
438
- const t = b(E), r = x(Ve, []), [n, i] = N(() => q(e.defaultPattern || "", 0)), [s, o] = N(() => {
439
- const l = r.find((v) => ne(v.value, e.defaultPattern || ""));
438
+ const t = b(E), r = R(Ve, []), [n, i] = N(() => J(e.defaultPattern || "", 0)), [s, o] = N(() => {
439
+ const l = r.find((v) => re(v.value, e.defaultPattern || ""));
440
440
  return (l == null ? void 0 : l.value) || r[0].value;
441
- }), m = x(() => $(s, Number(n || 0)), [s, n]), c = x(() => !Rt(s), [s]), a = (l) => {
441
+ }), m = R(() => $(s, Number(n || 0)), [s, n]), c = R(() => !$t(s), [s]), a = (l) => {
442
442
  i(l || 0), e.onChange($(s, Number(l || 0)));
443
443
  }, u = (l) => {
444
- l !== void 0 && (i(q(l, 0)), o(l), e.onChange(l));
444
+ l !== void 0 && (i(J(l, 0)), o(l), e.onChange(l));
445
445
  };
446
446
  return e.action.current = () => m, /* @__PURE__ */ y("div", { children: [
447
447
  /* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: t.t("sheet.numfmt.decimalLength") }),
448
448
  /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
449
- be,
449
+ Ne,
450
450
  {
451
451
  disabled: c,
452
452
  value: n,
@@ -459,7 +459,7 @@ function An(e) {
459
459
  " ",
460
460
  t.t("sheet.numfmt.negType")
461
461
  ] }),
462
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { onChange: u, options: r, value: s }) }),
462
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Te, { onChange: u, options: r, value: s }) }),
463
463
  /* @__PURE__ */ h(
464
464
  "div",
465
465
  {
@@ -470,7 +470,7 @@ function An(e) {
470
470
  ] });
471
471
  }
472
472
  const Hn = (e) => {
473
- const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = Ce(() => ""), m = s.t, c = Nn(), a = x(
473
+ const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = be(() => ""), m = s.t, c = Nn(), a = R(
474
474
  () => [
475
475
  { label: "sheet.numfmt.general", component: Fn },
476
476
  { label: "sheet.numfmt.accounting", component: Tn },
@@ -480,46 +480,46 @@ const Hn = (e) => {
480
480
  { label: "sheet.numfmt.customFormat", component: On }
481
481
  ].map((_) => ({ ..._, label: m(_.label) })),
482
482
  []
483
- ), [u, l] = N(g), [v, f] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } = In(() => f(`${n}_${i}_userCurrency'`)), S = x(() => {
483
+ ), [u, l] = N(g), [v, f] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } = In(() => f(`${n}_${i}_userCurrency'`)), S = R(() => {
484
484
  var _;
485
485
  return (_ = a.find((k) => k.label === u)) == null ? void 0 : _.component;
486
486
  }, [u]);
487
487
  function g() {
488
- return [Dn, En, Mn, kn, Ln].reduce((k, at, lt) => k || (at(r) ? a[lt].label : ""), "") || a[0].label;
488
+ return [Dn, En, Mn, kn, Ln].reduce((k, lt, ut) => k || (lt(r) ? a[ut].label : ""), "") || a[0].label;
489
489
  }
490
490
  const I = a.map((_) => ({
491
491
  label: _.label,
492
492
  value: _.label
493
- })), w = (_) => {
493
+ })), P = (_) => {
494
494
  l(_), c(() => e.onChange({ type: "change", value: o.current() || "" }));
495
- }, R = dn((_) => {
495
+ }, x = hn((_) => {
496
496
  e.onChange({ type: "change", value: _ });
497
497
  }, []), O = () => {
498
- const _ = o.current() || "", k = B(_);
498
+ const _ = o.current() || "", k = W(_);
499
499
  k && p(k), e.onChange({ type: "confirm", value: _ });
500
500
  }, D = () => {
501
501
  e.onChange({ type: "cancel", value: "" });
502
- }, ie = {
503
- onChange: R,
502
+ }, se = {
503
+ onChange: x,
504
504
  defaultValue: t,
505
505
  defaultPattern: r,
506
506
  action: o
507
507
  };
508
- return re(() => {
508
+ return ie(() => {
509
509
  l(g()), f(`${n}_${i}`);
510
510
  }, [n, i]), /* @__PURE__ */ y(
511
511
  "div",
512
512
  {
513
- className: et("univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5", fn),
513
+ className: tt("univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5", pn),
514
514
  children: [
515
515
  /* @__PURE__ */ y("div", { children: [
516
516
  /* @__PURE__ */ h("div", { className: "univer-mt-3.5 univer-text-sm univer-text-gray-400", children: m("sheet.numfmt.numfmtType") }),
517
- /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ie, { className: "univer-w-full", value: u, options: I, onChange: w }) }),
518
- /* @__PURE__ */ h("div", { children: S && /* @__PURE__ */ h(Ee.Provider, { value: d, children: /* @__PURE__ */ ye(S, { ...ie, key: v }) }) })
517
+ /* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { className: "univer-w-full", value: u, options: I, onChange: P }) }),
518
+ /* @__PURE__ */ h("div", { children: S && /* @__PURE__ */ h(Me.Provider, { value: d, children: /* @__PURE__ */ Ie(S, { ...se, key: v }) }) })
519
519
  ] }),
520
520
  /* @__PURE__ */ y("div", { className: "univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end", children: [
521
- /* @__PURE__ */ h(Pe, { onClick: D, className: "univer-mr-3", children: m("sheet.numfmt.cancel") }),
522
- /* @__PURE__ */ h(Pe, { variant: "primary", onClick: O, children: m("sheet.numfmt.confirm") })
521
+ /* @__PURE__ */ h(xe, { onClick: D, className: "univer-mr-3", children: m("sheet.numfmt.cancel") }),
522
+ /* @__PURE__ */ h(xe, { variant: "primary", onClick: O, children: m("sheet.numfmt.confirm") })
523
523
  ] })
524
524
  ]
525
525
  }
@@ -530,8 +530,8 @@ var jn = Object.getOwnPropertyDescriptor, Bn = (e, t, r, n) => {
530
530
  (o = e[s]) && (i = o(i) || i);
531
531
  return i;
532
532
  }, M = (e, t) => (r, n) => t(r, n, e);
533
- const $e = "SHEET_NUMFMT_PANEL";
534
- let j = class extends te {
533
+ const ke = "SHEET_NUMFMT_PANEL";
534
+ let B = class extends ne {
535
535
  constructor(t, r, n, i, s, o, m, c, a, u, l) {
536
536
  super();
537
537
  /**
@@ -540,12 +540,12 @@ let j = class extends te {
540
540
  * @type {(string | null)}
541
541
  * @memberof NumfmtController
542
542
  */
543
- X(this, "_previewPattern", "");
544
- X(this, "_sidebarDisposable", null);
543
+ q(this, "_previewPattern", "");
544
+ q(this, "_sidebarDisposable", null);
545
545
  this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService = m, this._componentManager = c, this._sidebarService = a, this._localeService = u, this._sheetsNumfmtCellContentController = l, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
546
546
  }
547
547
  _initNumfmtLocalChange() {
548
- this.disposeWithMe(Je(this._sheetsNumfmtCellContentController.locale$, this._localeService.currentLocale$).subscribe(() => {
548
+ this.disposeWithMe(Qe(this._sheetsNumfmtCellContentController.locale$, this._localeService.currentLocale$).subscribe(() => {
549
549
  this._forceUpdate();
550
550
  }));
551
551
  }
@@ -565,23 +565,23 @@ let j = class extends te {
565
565
  );
566
566
  let f = "";
567
567
  v && (f = v.pattern);
568
- const p = (l == null ? void 0 : l.t) === P.NUMBER ? l.v : 12345678, d = {
568
+ const p = (l == null ? void 0 : l.t) === w.NUMBER ? l.v : 12345678, d = {
569
569
  onChange: (g) => {
570
570
  var I;
571
571
  if (g.type === "change")
572
572
  this._previewPattern = g.value, this._forceUpdate();
573
573
  else if (g.type === "confirm") {
574
- const w = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((D) => D.range)) || [], R = { values: [] }, O = fe(g.value);
575
- w.forEach((D) => {
576
- Ae.foreach(D, (ie, _) => {
577
- R.values.push({
578
- row: ie,
574
+ const P = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((D) => D.range)) || [], x = { values: [] }, O = L(g.value);
575
+ P.forEach((D) => {
576
+ He.foreach(D, (se, _) => {
577
+ x.values.push({
578
+ row: se,
579
579
  col: _,
580
580
  pattern: g.value,
581
581
  type: O
582
582
  });
583
583
  });
584
- }), n.executeCommand(Ge.id, R), t.close();
584
+ }), n.executeCommand(Ke.id, x), t.close();
585
585
  } else g.type === "cancel" && t.close();
586
586
  },
587
587
  value: { defaultPattern: f, defaultValue: p, row: c.startRow, col: c.startColumn }
@@ -589,12 +589,12 @@ let j = class extends te {
589
589
  return this._sidebarDisposable = t.open({
590
590
  header: { title: o.t("sheet.numfmt.title") },
591
591
  children: {
592
- label: $e,
592
+ label: ke,
593
593
  ...d
594
594
  // need passthrough to react props.
595
595
  },
596
596
  onClose: () => {
597
- this._forceUpdate(), n.executeCommand(ce.id);
597
+ this._forceUpdate(), n.executeCommand(le.id);
598
598
  }
599
599
  }), !0;
600
600
  }
@@ -603,54 +603,54 @@ let j = class extends te {
603
603
  const r = this._renderManagerService.getRenderById(
604
604
  t != null ? t : this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId()
605
605
  );
606
- r == null || r.with(Ht).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
606
+ r == null || r.with(jt).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
607
607
  }
608
608
  _initCommands() {
609
609
  [
610
- A,
611
- ce
610
+ H,
611
+ le
612
612
  ].forEach((t) => {
613
613
  this.disposeWithMe(this._commandService.registerCommand(t));
614
614
  });
615
615
  }
616
616
  _initPanel() {
617
617
  this.disposeWithMe(
618
- this._componentManager.register($e, Hn)
618
+ this._componentManager.register(ke, Hn)
619
619
  );
620
620
  }
621
621
  // eslint-disable-next-line max-lines-per-function
622
622
  _initRealTimeRenderingInterceptor() {
623
- const t = new L((n) => {
623
+ const t = new A((n) => {
624
624
  this._commandService.onCommandExecuted((i) => {
625
- i.id === A.id && n.next(!0), i.id === ce.id && n.next(!1);
625
+ i.id === H.id && n.next(!0), i.id === le.id && n.next(!1);
626
626
  });
627
- }), r = rn([
627
+ }), r = sn([
628
628
  t,
629
629
  this._selectionManagerService.selectionMoveEnd$.pipe(
630
- on((n) => n ? n.map((i) => i.range) : [])
630
+ cn((n) => n ? n.map((i) => i.range) : [])
631
631
  )
632
632
  ]);
633
633
  this.disposeWithMe(
634
- me(
634
+ ve(
635
635
  r.pipe(
636
- cn(
637
- ([n, i]) => new L((s) => {
638
- const o = new ft();
636
+ an(
637
+ ([n, i]) => new A((s) => {
638
+ const o = new pt();
639
639
  return n && i.length && s.next({ selectionRanges: i, disposableCollection: o }), () => {
640
640
  o.dispose();
641
641
  };
642
642
  })
643
643
  ),
644
- an(() => {
644
+ ln(() => {
645
645
  this._previewPattern = null;
646
646
  })
647
647
  ).subscribe(({ disposableCollection: n, selectionRanges: i }) => {
648
648
  var o, m;
649
649
  const s = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
650
650
  this.openPanel(), n.add(
651
- this._sheetInterceptorService.intercept(Wt.CELL_CONTENT, {
651
+ this._sheetInterceptorService.intercept(Gt.CELL_CONTENT, {
652
652
  priority: 99,
653
- effect: Te.Value | Te.Style,
653
+ effect: we.Value | we.Style,
654
654
  handler: (c, a, u) => {
655
655
  var p;
656
656
  const { row: l, col: v } = a, f = u(c) || {};
@@ -658,22 +658,22 @@ let j = class extends te {
658
658
  (d) => d.startColumn <= v && d.endColumn >= v && d.startRow <= l && d.endRow >= l
659
659
  )) {
660
660
  const d = a.worksheet.getCellRaw(l, v), S = d == null ? void 0 : d.v, g = d == null ? void 0 : d.t;
661
- if (S == null || g !== P.NUMBER || this._previewPattern === null)
661
+ if (S == null || g !== w.NUMBER || this._previewPattern === null)
662
662
  return f;
663
- const I = $t(this._previewPattern, S, this._sheetsNumfmtCellContentController.locale);
663
+ const I = Ot(this._previewPattern, S, this._sheetsNumfmtCellContentController.locale);
664
664
  if (I.color) {
665
- const w = (p = this._themeService.getColorFromTheme(`${I.color}.500`)) != null ? p : I.color;
665
+ const P = (p = this._themeService.getColorFromTheme(`${I.color}.500`)) != null ? p : I.color;
666
666
  return {
667
667
  ...f,
668
668
  v: I.result,
669
- t: P.STRING,
670
- s: { cl: { rgb: w } }
669
+ t: w.STRING,
670
+ s: { cl: { rgb: P } }
671
671
  };
672
672
  }
673
673
  return {
674
674
  ...f,
675
675
  v: I.result,
676
- t: P.STRING
676
+ t: w.STRING
677
677
  };
678
678
  }
679
679
  return f;
@@ -685,9 +685,9 @@ let j = class extends te {
685
685
  );
686
686
  }
687
687
  _commandExecutedListener() {
688
- const t = [_e.id, Se.id];
688
+ const t = [Ce.id, ye.id];
689
689
  this.disposeWithMe(
690
- new L((r) => {
690
+ new A((r) => {
691
691
  const n = this._commandService.onCommandExecuted((i) => {
692
692
  if (t.includes(i.id)) {
693
693
  const s = i.params;
@@ -695,7 +695,7 @@ let j = class extends te {
695
695
  }
696
696
  });
697
697
  return () => n.dispose();
698
- }).pipe(ln(16)).subscribe((r) => this._forceUpdate(r))
698
+ }).pipe(un(16)).subscribe((r) => this._forceUpdate(r))
699
699
  );
700
700
  }
701
701
  _initCloseListener() {
@@ -705,21 +705,21 @@ let j = class extends te {
705
705
  });
706
706
  }
707
707
  };
708
- j = Bn([
709
- M(0, C(Xe)),
710
- M(1, C(vt)),
711
- M(2, he),
712
- M(3, ve),
713
- M(4, C(ge)),
714
- M(5, je),
715
- M(6, pe),
716
- M(7, C(qe)),
717
- M(8, Jt),
708
+ B = Bn([
709
+ M(0, C(qe)),
710
+ M(1, C(ft)),
711
+ M(2, pe),
712
+ M(3, ge),
713
+ M(4, C(Se)),
714
+ M(5, Be),
715
+ M(6, _e),
716
+ M(7, C(Je)),
717
+ M(8, Qt),
718
718
  M(9, C(E)),
719
- M(10, C(We))
720
- ], j);
721
- var Vn = Object.getOwnPropertyDescriptor, Wn = (e, t, r, n) => {
722
- for (var i = n > 1 ? void 0 : n ? Vn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
719
+ M(10, C(Ge))
720
+ ], B);
721
+ var Wn = Object.getOwnPropertyDescriptor, Vn = (e, t, r, n) => {
722
+ for (var i = n > 1 ? void 0 : n ? Wn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
723
723
  (o = e[s]) && (i = o(i) || i);
724
724
  return i;
725
725
  }, F = (e, t) => (r, n) => t(r, n, e);
@@ -733,17 +733,17 @@ const Gn = () => {
733
733
  }
734
734
  };
735
735
  };
736
- let J = class extends te {
736
+ let Q = class extends ne {
737
737
  constructor(t, r, n, i, s) {
738
738
  super();
739
739
  // collect effect mutations when edit end and push this to commands stack in next commands progress
740
- X(this, "_collectEffectMutation", Gn());
740
+ q(this, "_collectEffectMutation", Gn());
741
741
  this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = i, this._editorBridgeService = s, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
742
742
  }
743
743
  _initInterceptorEditorStart() {
744
744
  this._editorBridgeService && this.disposeWithMe(
745
- me(
746
- this._sheetInterceptorService.writeCellInterceptor.intercept(Gt, {
745
+ ve(
746
+ this._sheetInterceptorService.writeCellInterceptor.intercept(Kt, {
747
747
  handler: (t, r, n) => {
748
748
  const i = r.row, s = r.col, o = this._numfmtService.getValue(
749
749
  r.unitId,
@@ -752,13 +752,25 @@ let J = class extends te {
752
752
  s
753
753
  );
754
754
  if (o)
755
- switch (fe(o.pattern)) {
755
+ switch (L(o.pattern)) {
756
+ /**
757
+ * For scientific, currency, grouped and number format, the editor should display the raw number value without format, unlike the cell render which display the formatted value.
758
+ */
756
759
  case "scientific":
757
760
  case "currency":
758
761
  case "grouped":
759
762
  case "number": {
760
- const c = r.worksheet.getCellRaw(i, s);
761
- return (c == null ? void 0 : c.t) === P.NUMBER && (c == null ? void 0 : c.v) !== void 0 && c.v !== null && De(c.v) && (c.v = gn(Number(c.v))), n && n(c);
763
+ const c = { ...r.worksheet.getCellRaw(i, s) };
764
+ return (c == null ? void 0 : c.t) === w.NUMBER && he(c.v) && (c.v = ce(Number(c.v))), n && n(c);
765
+ }
766
+ /**
767
+ * For percent format, the editor should display the full percent value, unlike the cell render which display the limited decimal places.
768
+ * e.g. { v: 1.001234567, t: 2, s: { n: { pattern: '0.00%' } } } should display as '100.12%' in cell render, but when edit this cell, the editor should display '100.1234567%' rather than '100.12%'.
769
+ * If the editor also display '100.12%', will lose precision when before edit.
770
+ */
771
+ case "percent": {
772
+ const c = { ...r.worksheet.getCellRaw(i, s) };
773
+ return (c == null ? void 0 : c.t) === w.NUMBER && he(c.v) && (c.v = `${ce(Number(c.v) * 100)}%`), n && n(c);
762
774
  }
763
775
  default:
764
776
  return n && n(t);
@@ -777,9 +789,9 @@ let J = class extends te {
777
789
  // eslint-disable-next-line max-lines-per-function
778
790
  _initInterceptorEditorEnd() {
779
791
  this.disposeWithMe(
780
- me(
781
- this._sheetInterceptorService.writeCellInterceptor.intercept(Kt, {
782
- // eslint-disable-next-line complexity
792
+ ve(
793
+ this._sheetInterceptorService.writeCellInterceptor.intercept(Yt, {
794
+ // eslint-disable-next-line max-lines-per-function,complexity
783
795
  handler: (t, r, n) => {
784
796
  var a, u, l;
785
797
  if (!(t != null && t.v) && !(t != null && t.p))
@@ -791,9 +803,9 @@ let J = class extends te {
791
803
  r.row,
792
804
  r.col
793
805
  ), s = r.worksheet.getCellRaw(r.row, r.col);
794
- if (Ue(i == null ? void 0 : i.pattern) || t.t === P.FORCE_STRING)
806
+ if (Fe(i == null ? void 0 : i.pattern) || t.t === w.FORCE_STRING)
795
807
  return n(t);
796
- const o = (a = t.p) == null ? void 0 : a.body, m = (l = (u = t == null ? void 0 : t.p) == null ? void 0 : u.body) != null && l.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), c = gt(m);
808
+ const o = (a = t.p) == null ? void 0 : a.body, m = (l = (u = t == null ? void 0 : t.p) == null ? void 0 : u.body) != null && l.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), c = _t(m);
797
809
  if (o)
798
810
  if (Kn(o)) {
799
811
  const { dataStream: v } = o, f = v.replace(/\r\n$/, ""), p = Number(f);
@@ -802,14 +814,14 @@ let J = class extends te {
802
814
  } else
803
815
  return n(t);
804
816
  if (c) {
805
- if (!c.z && !(i != null && i.pattern) && (s == null ? void 0 : s.t) !== P.STRING && (s == null ? void 0 : s.t) !== P.FORCE_STRING && _t(m))
817
+ if (!c.z && !(i != null && i.pattern) && (s == null ? void 0 : s.t) !== w.STRING && (s == null ? void 0 : s.t) !== w.FORCE_STRING && St(m))
806
818
  return n({
807
819
  ...t,
808
820
  p: void 0,
809
821
  v: m,
810
- t: P.FORCE_STRING
822
+ t: w.FORCE_STRING
811
823
  });
812
- c.z && this._collectEffectMutation.add(
824
+ c.z && (!(i != null && i.pattern) || L(c.z) !== L(i.pattern)) && this._collectEffectMutation.add(
813
825
  r.unitId,
814
826
  r.subUnitId,
815
827
  r.row,
@@ -818,8 +830,8 @@ let J = class extends te {
818
830
  pattern: c.z
819
831
  }
820
832
  );
821
- const v = Number(c.v);
822
- return n({ ...t, p: void 0, v, t: P.NUMBER });
833
+ const v = ce(Number(c.v), 16);
834
+ return n({ ...t, p: void 0, v, t: w.NUMBER });
823
835
  }
824
836
  return n(t);
825
837
  }
@@ -834,7 +846,7 @@ let J = class extends te {
834
846
  getMutations(r) {
835
847
  var n;
836
848
  switch (r.id) {
837
- case Yt.id: {
849
+ case Zt.id: {
838
850
  const i = t._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET), s = i.getUnitId(), o = (n = i.getActiveSheet()) == null ? void 0 : n.getSheetId();
839
851
  if (!o)
840
852
  return {
@@ -865,21 +877,21 @@ let J = class extends te {
865
877
  })), u = [], l = [];
866
878
  if (c.length) {
867
879
  const v = {
868
- id: Se.id,
869
- params: Zt(s, o, c)
880
+ id: ye.id,
881
+ params: zt(s, o, c)
870
882
  };
871
- u.push(v), l.push(...zt(t._injector, v.params));
883
+ u.push(v), l.push(...Xt(t._injector, v.params));
872
884
  }
873
885
  if (a.length) {
874
886
  const v = {
875
- id: _e.id,
887
+ id: Ce.id,
876
888
  params: {
877
889
  unitId: s,
878
890
  subUnitId: o,
879
891
  ranges: a
880
892
  }
881
893
  };
882
- u.push(v), l.push(...Xt(t._injector, v.params));
894
+ u.push(v), l.push(...qt(t._injector, v.params));
883
895
  }
884
896
  return {
885
897
  redos: u,
@@ -899,25 +911,25 @@ let J = class extends te {
899
911
  super.dispose(), this._collectEffectMutation.clean();
900
912
  }
901
913
  };
902
- J = Wn([
903
- F(0, C(Xe)),
904
- F(1, C(pe)),
905
- F(2, C(he)),
906
- F(3, C(He)),
907
- F(4, pt(jt))
908
- ], J);
914
+ Q = Vn([
915
+ F(0, C(qe)),
916
+ F(1, C(_e)),
917
+ F(2, C(pe)),
918
+ F(3, C(je)),
919
+ F(4, gt(Bt))
920
+ ], Q);
909
921
  function Kn(e) {
910
922
  const { textRuns: t = [], paragraphs: r = [], customRanges: n, customBlocks: i = [] } = e, s = ["va"];
911
923
  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);
912
924
  }
913
- const it = (e) => [
925
+ const st = (e) => [
914
926
  {
915
927
  label: "sheet.numfmt.general",
916
928
  pattern: null
917
929
  },
918
930
  {
919
931
  label: "sheet.numfmt.text",
920
- pattern: yt
932
+ pattern: bt
921
933
  },
922
934
  "|",
923
935
  {
@@ -972,118 +984,118 @@ const it = (e) => [
972
984
  pattern: ""
973
985
  }
974
986
  ], Yn = (e) => ({
975
- icon: new L((t) => {
987
+ icon: new A((t) => {
976
988
  const r = e.get(E);
977
- return t.next(we(r.getCurrentLocale()).icon), r.localeChanged$.subscribe(() => {
978
- t.next(we(r.getCurrentLocale()).icon);
989
+ return t.next(Re(r.getCurrentLocale()).icon), r.localeChanged$.subscribe(() => {
990
+ t.next(Re(r.getCurrentLocale()).icon);
979
991
  });
980
992
  }),
981
- id: Ze.id,
993
+ id: ze.id,
982
994
  title: "sheet.numfmt.currency",
983
995
  tooltip: "sheet.numfmt.currency",
984
- type: z.BUTTON,
985
- hidden$: Z(e, T.UNIVER_SHEET),
986
- disabled$: V(e, { workbookTypes: [Y], worksheetTypes: [G, K], rangeTypes: [W] })
996
+ type: X.BUTTON,
997
+ hidden$: z(e, T.UNIVER_SHEET),
998
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, Y], rangeTypes: [G] })
987
999
  }), Zn = (e) => ({
988
1000
  icon: "AddDigitsIcon",
989
- id: Ye.id,
1001
+ id: Ze.id,
990
1002
  title: "sheet.numfmt.addDecimal",
991
1003
  tooltip: "sheet.numfmt.addDecimal",
992
- type: z.BUTTON,
993
- hidden$: Z(e, T.UNIVER_SHEET),
994
- disabled$: V(e, { workbookTypes: [Y], worksheetTypes: [G, K], rangeTypes: [W] })
1004
+ type: X.BUTTON,
1005
+ hidden$: z(e, T.UNIVER_SHEET),
1006
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, Y], rangeTypes: [G] })
995
1007
  }), zn = (e) => ({
996
1008
  icon: "ReduceDigitsIcon",
997
- id: Ke.id,
1009
+ id: Ye.id,
998
1010
  title: "sheet.numfmt.subtractDecimal",
999
1011
  tooltip: "sheet.numfmt.subtractDecimal",
1000
- type: z.BUTTON,
1001
- hidden$: Z(e, T.UNIVER_SHEET),
1002
- disabled$: V(e, { workbookTypes: [Y], worksheetTypes: [G, K], rangeTypes: [W] })
1012
+ type: X.BUTTON,
1013
+ hidden$: z(e, T.UNIVER_SHEET),
1014
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, Y], rangeTypes: [G] })
1003
1015
  }), Xn = (e) => ({
1004
1016
  icon: "PercentIcon",
1005
- id: ze.id,
1017
+ id: Xe.id,
1006
1018
  title: "sheet.numfmt.percent",
1007
1019
  tooltip: "sheet.numfmt.percent",
1008
- type: z.BUTTON,
1009
- hidden$: Z(e, T.UNIVER_SHEET),
1010
- disabled$: V(e, { workbookTypes: [Y], worksheetTypes: [G, K], rangeTypes: [W] })
1020
+ type: X.BUTTON,
1021
+ hidden$: z(e, T.UNIVER_SHEET),
1022
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, Y], rangeTypes: [G] })
1011
1023
  }), qn = (e) => {
1012
- const t = e.get(he), r = e.get(ve), n = e.get(E), i = e.get(ge), s = [_e.id, Se.id], o = Bt(
1024
+ const t = e.get(pe), r = e.get(ge), n = e.get(E), i = e.get(Se), s = [Ce.id, ye.id], o = Wt(
1013
1025
  t,
1014
1026
  "",
1015
- ({ workbook: m, worksheet: c }) => new L(
1016
- (a) => Je(
1027
+ ({ workbook: m, worksheet: c }) => new A(
1028
+ (a) => Qe(
1017
1029
  i.selectionMoveEnd$,
1018
- St(r.onCommandExecuted.bind(r)).pipe(
1019
- sn(([u]) => s.includes(u.id))
1030
+ Ct(r.onCommandExecuted.bind(r)).pipe(
1031
+ on(([u]) => s.includes(u.id))
1020
1032
  )
1021
1033
  ).subscribe(() => {
1022
1034
  var l, v;
1023
1035
  const u = i.getCurrentSelections();
1024
1036
  if (u && u[0]) {
1025
- const f = u[0].range, p = f.startRow, d = f.startColumn, S = (v = m.getStyles().get((l = c.getCell(p, d)) == null ? void 0 : l.s)) == null ? void 0 : v.n, g = S == null ? void 0 : S.pattern, I = Ot(n.getCurrentLocale());
1026
- let w = n.t("sheet.numfmt.general");
1027
- if (Ct(g)) {
1028
- a.next(w);
1037
+ const f = u[0].range, p = f.startRow, d = f.startColumn, S = (v = m.getStyles().get((l = c.getCell(p, d)) == null ? void 0 : l.s)) == null ? void 0 : v.n, g = S == null ? void 0 : S.pattern, I = kt(n.getCurrentLocale());
1038
+ let P = n.t("sheet.numfmt.general");
1039
+ if (yt(g)) {
1040
+ a.next(P);
1029
1041
  return;
1030
1042
  }
1031
1043
  if (g) {
1032
- const R = it(I).filter((O) => typeof O == "object" && O.pattern).find(
1033
- (O) => ne(g, O.pattern)
1044
+ const x = st(I).filter((O) => typeof O == "object" && O.pattern).find(
1045
+ (O) => re(g, O.pattern)
1034
1046
  );
1035
- R && typeof R == "object" && R.pattern ? w = n.t(R.label) : w = n.t("sheet.numfmt.moreFmt");
1047
+ x && typeof x == "object" && x.pattern ? P = n.t(x.label) : P = n.t("sheet.numfmt.moreFmt");
1036
1048
  }
1037
- a.next(w);
1049
+ a.next(P);
1038
1050
  }
1039
1051
  })
1040
1052
  )
1041
1053
  );
1042
1054
  return {
1043
- label: st,
1044
- id: A.id,
1055
+ label: ot,
1056
+ id: H.id,
1045
1057
  tooltip: "sheet.numfmt.title",
1046
- type: z.SELECTOR,
1058
+ type: X.SELECTOR,
1047
1059
  slot: !0,
1048
1060
  selections: [{
1049
1061
  label: {
1050
- name: ot,
1062
+ name: ct,
1051
1063
  hoverable: !1,
1052
1064
  selectable: !1
1053
1065
  }
1054
1066
  }],
1055
1067
  value$: o,
1056
- hidden$: Z(e, T.UNIVER_SHEET),
1057
- disabled$: V(e, { workbookTypes: [Y], worksheetTypes: [K, G], rangeTypes: [W] })
1068
+ hidden$: z(e, T.UNIVER_SHEET),
1069
+ disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [Y, K], rangeTypes: [G] })
1058
1070
  };
1059
- }, st = "sheet.numfmt.moreNumfmtType", ot = "sheet.numfmt.moreNumfmtType.options";
1071
+ }, ot = "sheet.numfmt.moreNumfmtType", ct = "sheet.numfmt.moreNumfmtType.options";
1060
1072
  function Jn(e) {
1061
1073
  const { value: t } = e, r = b(E), n = t != null ? t : r.t("sheet.numfmt.general");
1062
1074
  return /* @__PURE__ */ h("span", { className: "univer-text-sm", children: n });
1063
1075
  }
1064
1076
  function Qn() {
1065
- const e = b(ve), t = b(E), r = b(Qt), n = b(We), i = b(ge), s = (a) => {
1077
+ const e = b(ge), t = b(E), r = b(en), n = b(Ge), i = b(Se), s = (a) => {
1066
1078
  const u = i.getCurrentLastSelection();
1067
1079
  if (!u)
1068
1080
  return;
1069
1081
  const l = u.range, v = [];
1070
- Ae.foreach(l, (f, p) => {
1071
- a ? v.push({ row: f, col: p, pattern: a, type: fe(a) }) : v.push({ row: f, col: p });
1072
- }), e.executeCommand(Ge.id, { values: v }), r.focus();
1073
- }, o = x(() => {
1074
- const a = kt.get(t.getCurrentLocale());
1075
- return it(a);
1082
+ He.foreach(l, (f, p) => {
1083
+ a ? v.push({ row: f, col: p, pattern: a, type: L(a) }) : v.push({ row: f, col: p });
1084
+ }), e.executeCommand(Ke.id, { values: v }), r.focus();
1085
+ }, o = R(() => {
1086
+ const a = Ut.get(t.getCurrentLocale());
1087
+ return st(a);
1076
1088
  }, [t]), m = (a) => {
1077
1089
  if (a === 0)
1078
1090
  s(null);
1079
1091
  else if (a === o.length - 1)
1080
- e.executeCommand(A.id), r.focus();
1092
+ e.executeCommand(H.id), r.focus();
1081
1093
  else {
1082
1094
  const u = o[a];
1083
1095
  u.pattern && s(u.pattern);
1084
1096
  }
1085
1097
  }, c = 1220;
1086
- return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((a, u) => a === "|" ? /* @__PURE__ */ h(pn, {}, u) : /* @__PURE__ */ y(
1098
+ return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((a, u) => a === "|" ? /* @__PURE__ */ h(gn, {}, u) : /* @__PURE__ */ y(
1087
1099
  "div",
1088
1100
  {
1089
1101
  className: "univer-flex univer-h-7 univer-cursor-default univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-px-2 univer-text-sm hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
@@ -1094,7 +1106,7 @@ function Qn() {
1094
1106
  "span",
1095
1107
  {
1096
1108
  className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
1097
- children: a.pattern ? Ut(a.pattern || "", c, n.locale).result.trim() : ""
1109
+ children: a.pattern ? Dt(a.pattern || "", c, n.locale).result.trim() : ""
1098
1110
  }
1099
1111
  )
1100
1112
  ]
@@ -1103,24 +1115,24 @@ function Qn() {
1103
1115
  )) });
1104
1116
  }
1105
1117
  const er = {
1106
- [en.LAYOUT]: {
1107
- [A.id]: {
1118
+ [tn.LAYOUT]: {
1119
+ [H.id]: {
1108
1120
  order: 9,
1109
1121
  menuItemFactory: qn
1110
1122
  },
1111
- [ze.id]: {
1123
+ [Xe.id]: {
1112
1124
  order: 9.1,
1113
1125
  menuItemFactory: Xn
1114
1126
  },
1115
- [Ze.id]: {
1127
+ [ze.id]: {
1116
1128
  order: 9.2,
1117
1129
  menuItemFactory: Yn
1118
1130
  },
1119
- [Ye.id]: {
1131
+ [Ze.id]: {
1120
1132
  order: 9.3,
1121
1133
  menuItemFactory: Zn
1122
1134
  },
1123
- [Ke.id]: {
1135
+ [Ye.id]: {
1124
1136
  order: 9.4,
1125
1137
  menuItemFactory: zn
1126
1138
  }
@@ -1130,15 +1142,15 @@ var tr = Object.getOwnPropertyDescriptor, nr = (e, t, r, n) => {
1130
1142
  for (var i = n > 1 ? void 0 : n ? tr(t, r) : t, s = e.length - 1, o; s >= 0; s--)
1131
1143
  (o = e[s]) && (i = o(i) || i);
1132
1144
  return i;
1133
- }, Oe = (e, t) => (r, n) => t(r, n, e);
1134
- let Q = class extends te {
1145
+ }, Ue = (e, t) => (r, n) => t(r, n, e);
1146
+ let ee = class extends ne {
1135
1147
  constructor(e, t) {
1136
1148
  super(), this._componentManager = e, this._menuManagerService = t, this._initMenu();
1137
1149
  }
1138
1150
  _initMenu() {
1139
1151
  this._menuManagerService.mergeMenu(er), [
1140
- [st, Jn],
1141
- [ot, Qn]
1152
+ [ot, Jn],
1153
+ [ct, Qn]
1142
1154
  ].forEach(([e, t]) => {
1143
1155
  this.disposeWithMe(
1144
1156
  this._componentManager.register(e, t)
@@ -1146,57 +1158,57 @@ let Q = class extends te {
1146
1158
  });
1147
1159
  }
1148
1160
  };
1149
- Q = nr([
1150
- Oe(0, C(qe)),
1151
- Oe(1, tn)
1152
- ], Q);
1161
+ ee = nr([
1162
+ Ue(0, C(Je)),
1163
+ Ue(1, nn)
1164
+ ], ee);
1153
1165
  var rr = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, sr = (e, t, r) => t in e ? rr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, or = (e, t, r, n) => {
1154
1166
  for (var i = n > 1 ? void 0 : n ? ir(t, r) : t, s = e.length - 1, o; s >= 0; s--)
1155
1167
  (o = e[s]) && (i = o(i) || i);
1156
1168
  return i;
1157
- }, ue = (e, t) => (r, n) => t(r, n, e), ct = (e, t, r) => sr(e, typeof t != "symbol" ? t + "" : t, r);
1169
+ }, de = (e, t) => (r, n) => t(r, n, e), at = (e, t, r) => sr(e, typeof t != "symbol" ? t + "" : t, r);
1158
1170
  const cr = "SHEET_NUMFMT_UI_PLUGIN";
1159
- let ee = class extends It {
1160
- constructor(e = xe, t, r, n) {
1171
+ let te = class extends Nt {
1172
+ constructor(e = $e, t, r, n) {
1161
1173
  super(), this._config = e, this._injector = t, this._configService = r, this._renderManagerService = n;
1162
- const { menu: i, ...s } = Nt(
1174
+ const { menu: i, ...s } = Et(
1163
1175
  {},
1164
- xe,
1176
+ $e,
1165
1177
  this._config
1166
1178
  );
1167
1179
  i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig("sheets-numfmt-ui.config", s);
1168
1180
  }
1169
1181
  onStarting() {
1170
- Et(this._injector, [
1182
+ Tt(this._injector, [
1183
+ [B],
1184
+ [Q],
1171
1185
  [j],
1172
- [J],
1173
- [H],
1174
- [Q]
1186
+ [ee]
1175
1187
  ]);
1176
1188
  }
1177
1189
  onRendered() {
1178
- this._registerRenderModules(), Tt(this._injector, [
1179
- [j],
1180
- [J],
1181
- [Q]
1190
+ this._registerRenderModules(), Mt(this._injector, [
1191
+ [B],
1192
+ [Q],
1193
+ [ee]
1182
1194
  ]);
1183
1195
  }
1184
1196
  _registerRenderModules() {
1185
1197
  [
1186
- [de]
1198
+ [fe]
1187
1199
  ].forEach((t) => {
1188
1200
  this.disposeWithMe(this._renderManagerService.registerRenderModule(T.UNIVER_SHEET, t));
1189
1201
  });
1190
1202
  }
1191
1203
  };
1192
- ct(ee, "pluginName", cr);
1193
- ct(ee, "type", T.UNIVER_SHEET);
1194
- ee = or([
1195
- bt(Vt, Dt),
1196
- ue(1, C(He)),
1197
- ue(2, ke),
1198
- ue(3, je)
1199
- ], ee);
1204
+ at(te, "pluginName", cr);
1205
+ at(te, "type", T.UNIVER_SHEET);
1206
+ te = or([
1207
+ It(Vt, Ft),
1208
+ de(1, C(je)),
1209
+ de(2, De),
1210
+ de(3, Be)
1211
+ ], te);
1200
1212
  export {
1201
- ee as UniverSheetsNumfmtUIPlugin
1213
+ te as UniverSheetsNumfmtUIPlugin
1202
1214
  };