@univerjs/sheets-numfmt 0.10.8 → 0.10.9

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,11 +1,11 @@
1
- var oe = Object.defineProperty;
2
- var ae = (e, n, t) => n in e ? oe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
- var L = (e, n, t) => ae(e, typeof n != "symbol" ? n + "" : n, t);
4
- import { LocaleType as m, numfmt as E, CommandType as U, ICommandService as I, IUniverInstanceService as V, IUndoRedoService as ie, isTextFormat as X, CellValueType as b, ObjectMatrix as R, sequenceExecute as ce, Range as $, LocaleService as J, DEFAULT_NUMBER_FORMAT as le, Inject as T, ThemeService as ue, IConfigService as Q, Disposable as me, isDefaultFormat as fe, InterceptorEffectEnum as Z, UniverInstanceType as ee, DependentOn as de, Injector as ge, Plugin as he, merge as pe, registerDependencies as _e, touchDependencies as Se } from "@univerjs/core";
5
- import { getSheetCommandTarget as W, transformCellsToRange as ve, checkCellValueType as H, rangeMerge as z, SetNumfmtMutation as te, factorySetNumfmtUndoMutation as Ce, RemoveNumfmtMutation as Me, SetRangeValuesMutation as G, factoryRemoveNumfmtUndoMutation as ye, SheetsSelectionsService as j, INumfmtService as K, SheetInterceptorService as be, INTERCEPTOR_POINT as Re, InterceptCellContentPriority as Ne, UniverSheetsPlugin as Ee } from "@univerjs/sheets";
6
- import { BehaviorSubject as $e, merge as Ie, switchMap as Te, of as Pe, skip as Ue } from "rxjs";
7
- import { stripErrorMargin as Oe } from "@univerjs/engine-formula";
8
- const ne = [
1
+ var ae = Object.defineProperty;
2
+ var ie = (e, n, t) => n in e ? ae(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var L = (e, n, t) => ie(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import { LocaleType as f, numfmt as x, CommandType as U, ICommandService as $, IUniverInstanceService as V, IUndoRedoService as ce, isTextFormat as J, CellValueType as M, ObjectMatrix as R, sequenceExecute as le, Range as N, isDefaultFormat as W, LocaleService as Q, DEFAULT_NUMBER_FORMAT as ue, Inject as I, ThemeService as fe, IConfigService as ee, Disposable as me, InterceptorEffectEnum as z, UniverInstanceType as te, DependentOn as de, Injector as ge, Plugin as he, merge as pe, registerDependencies as _e, touchDependencies as ve } from "@univerjs/core";
5
+ import { getSheetCommandTarget as K, transformCellsToRange as Se, checkCellValueType as H, rangeMerge as k, SetNumfmtMutation as ne, factorySetNumfmtUndoMutation as Ce, RemoveNumfmtMutation as ye, SetRangeValuesMutation as G, factoryRemoveNumfmtUndoMutation as be, SheetsSelectionsService as j, INumfmtService as Z, SheetInterceptorService as Me, INTERCEPTOR_POINT as Re, InterceptCellContentPriority as Ee, UniverSheetsPlugin as Ne } from "@univerjs/sheets";
6
+ import { BehaviorSubject as $e, merge as Ie, switchMap as Te, of as Ue, skip as Oe } from "rxjs";
7
+ import { stripErrorMargin as we } from "@univerjs/engine-formula";
8
+ const re = [
9
9
  "$",
10
10
  "£",
11
11
  "¥",
@@ -35,58 +35,58 @@ const ne = [
35
35
  "₿",
36
36
  "﷼"
37
37
  ], w = /* @__PURE__ */ new Map([
38
- [m.EN_US, "$"],
39
- [m.RU_RU, "₽"],
40
- [m.VI_VN, "₫"],
41
- [m.ZH_CN, "¥"],
42
- [m.ZH_TW, "NT$"],
43
- [m.FR_FR, "€"],
44
- [m.FA_IR, "﷼"],
45
- [m.KO_KR, "₩"],
46
- [m.ES_ES, "€"],
47
- [m.CA_ES, "€"]
38
+ [f.EN_US, "$"],
39
+ [f.RU_RU, "₽"],
40
+ [f.VI_VN, "₫"],
41
+ [f.ZH_CN, "¥"],
42
+ [f.ZH_TW, "NT$"],
43
+ [f.FR_FR, "€"],
44
+ [f.FA_IR, "﷼"],
45
+ [f.KO_KR, "₩"],
46
+ [f.ES_ES, "€"],
47
+ [f.CA_ES, "€"]
48
48
  ]);
49
- function we(e) {
49
+ function xe(e) {
50
50
  switch (e) {
51
- case m.CA_ES:
52
- case m.ES_ES:
53
- case m.FR_FR:
51
+ case f.CA_ES:
52
+ case f.ES_ES:
53
+ case f.FR_FR:
54
54
  return {
55
55
  icon: "EuroIcon",
56
56
  symbol: w.get(e) || "€",
57
57
  locale: e
58
58
  };
59
- case m.RU_RU:
59
+ case f.RU_RU:
60
60
  return {
61
61
  icon: "RoubleIcon",
62
62
  symbol: w.get(e) || "₽",
63
63
  locale: e
64
64
  };
65
- case m.ZH_CN:
65
+ case f.ZH_CN:
66
66
  return {
67
67
  icon: "RmbIcon",
68
68
  symbol: w.get(e) || "¥",
69
69
  locale: e
70
70
  };
71
- case m.EN_US:
71
+ case f.EN_US:
72
72
  default:
73
73
  return {
74
74
  icon: "DollarIcon",
75
75
  symbol: "$",
76
- locale: m.EN_US
76
+ locale: f.EN_US
77
77
  };
78
78
  }
79
79
  }
80
- function k(e) {
80
+ function Y(e) {
81
81
  return w.get(e) || "$";
82
82
  }
83
- function xe(e, n = 2) {
83
+ function Pe(e, n = 2) {
84
84
  let t = n;
85
85
  n > 127 && (t = 127);
86
86
  let r = "";
87
- return t > 0 && (r = `.${"0".repeat(t)}`), `"${k(e)}"#,##0${r}_);[Red]("${k(e)}"#,##0${r})`;
87
+ return t > 0 && (r = `.${"0".repeat(t)}`), `"${Y(e)}"#,##0${r}_);[Red]("${Y(e)}"#,##0${r})`;
88
88
  }
89
- const De = [
89
+ const Fe = [
90
90
  {
91
91
  label: "1930-08-05",
92
92
  suffix: "yyyy-MM-dd"
@@ -131,7 +131,7 @@ const De = [
131
131
  label: "08-05 下午 01:30",
132
132
  suffix: "MM-dd A/P hh:mm"
133
133
  }
134
- ], Fe = [
134
+ ], De = [
135
135
  {
136
136
  label: "(1,235)",
137
137
  suffix: "#,##0_);(#,##0)"
@@ -187,145 +187,145 @@ const De = [
187
187
  suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
188
188
  color: "red"
189
189
  }
190
- ], x = (e, n = 0) => {
190
+ ], P = (e, n = 0) => {
191
191
  var r;
192
- return e && (r = E.getFormatInfo(e).maxDecimals) != null ? r : n;
193
- }, Y = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), D = (e, n) => e.split(";").map((r) => /\.0?/.test(r) ? r.replace(
192
+ return e && (r = x.getFormatInfo(e).maxDecimals) != null ? r : n;
193
+ }, q = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), F = (e, n) => e.split(";").map((r) => /\.0?/.test(r) ? r.replace(
194
194
  /\.0*/g,
195
- `${n > 0 ? "." : ""}${Y(Number(n || 0))}`
195
+ `${n > 0 ? "." : ""}${q(Number(n || 0))}`
196
196
  ) : /0([^0]?)|0$/.test(r) ? r.replace(
197
197
  /0([^0]+)|0$/,
198
- `0${n > 0 ? "." : ""}${Y(Number(n || 0))}$1`
199
- ) : r).join(";"), ot = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), O = {
198
+ `0${n > 0 ? "." : ""}${q(Number(n || 0))}$1`
199
+ ) : r).join(";"), rt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), O = {
200
200
  id: "sheet.command.numfmt.set.numfmt",
201
201
  type: U.COMMAND,
202
202
  // eslint-disable-next-line max-lines-per-function
203
203
  handler: (e, n) => {
204
204
  if (!n)
205
205
  return !1;
206
- const t = e.get(I), r = e.get(V), s = e.get(ie), a = W(r, n);
206
+ const t = e.get($), r = e.get(V), s = e.get(ce), a = K(r, n);
207
207
  if (!a) return !1;
208
- const { unitId: c, subUnitId: o, worksheet: g } = a, u = n.values.filter((l) => !!l.pattern), C = n.values.filter((l) => !l.pattern), M = ve(c, o, u), p = {
209
- unitId: c,
208
+ const { unitId: l, subUnitId: o, worksheet: h } = a, u = n.values.filter((i) => !!i.pattern), C = n.values.filter((i) => !i.pattern), y = Se(l, o, u), p = {
209
+ unitId: l,
210
210
  subUnitId: o,
211
- ranges: C.map((l) => ({
212
- startColumn: l.col,
213
- startRow: l.row,
214
- endColumn: l.col,
215
- endRow: l.row
211
+ ranges: C.map((i) => ({
212
+ startColumn: i.col,
213
+ startRow: i.row,
214
+ endColumn: i.col,
215
+ endRow: i.row
216
216
  }))
217
- }, y = [], _ = [];
217
+ }, b = [], _ = [];
218
218
  if (u.length) {
219
- const l = u.reduce((d, i) => {
220
- X(i.pattern) && d.setValue(i.row, i.col, { t: b.STRING });
221
- const v = g.getCellRaw(i.row, i.col);
222
- if (v) {
223
- const P = H(v.v);
224
- P !== v.t && d.setValue(i.row, i.col, { t: P });
219
+ const i = u.reduce((d, c) => {
220
+ J(c.pattern) && d.setValue(c.row, c.col, { t: M.STRING });
221
+ const S = h.getCellRaw(c.row, c.col);
222
+ if (S) {
223
+ const T = H(S.v);
224
+ T !== S.t && d.setValue(c.row, c.col, { t: T });
225
225
  }
226
226
  return d;
227
- }, new R()).getMatrix(), h = new R();
228
- new R(l).forValue((d, i) => {
229
- const v = g.getCellRaw(d, i);
230
- v ? h.setValue(d, i, { t: v.t }) : h.setValue(d, i, { t: void 0 });
231
- }), Object.keys(M.values).forEach((d) => {
232
- const i = M.values[d];
233
- i.ranges = z(i.ranges);
234
- }), y.push({
235
- id: te.id,
236
- params: M
227
+ }, new R()).getMatrix(), g = new R();
228
+ new R(i).forValue((d, c) => {
229
+ const S = h.getCellRaw(d, c);
230
+ S ? g.setValue(d, c, { t: S.t }) : g.setValue(d, c, { t: void 0 });
231
+ }), Object.keys(y.values).forEach((d) => {
232
+ const c = y.values[d];
233
+ c.ranges = k(c.ranges);
234
+ }), b.push({
235
+ id: ne.id,
236
+ params: y
237
237
  });
238
- const S = Ce(e, M);
239
- _.push(...S);
238
+ const v = Ce(e, y);
239
+ _.push(...v);
240
240
  }
241
241
  if (C.length) {
242
- p.ranges = z(p.ranges);
243
- const l = C.reduce((d, i) => {
244
- const v = g.getCellRaw(i.row, i.col);
245
- if (v) {
246
- const P = H(v.v);
247
- P !== v.t && d.setValue(i.row, i.col, { t: P });
242
+ p.ranges = k(p.ranges);
243
+ const i = C.reduce((d, c) => {
244
+ const S = h.getCellRaw(c.row, c.col);
245
+ if (S) {
246
+ const T = H(S.v);
247
+ T !== S.t && d.setValue(c.row, c.col, { t: T });
248
248
  }
249
249
  return d;
250
- }, new R()).getMatrix(), h = new R();
251
- new R(l).forValue((d, i) => {
252
- const v = g.getCellRaw(d, i);
253
- v ? h.setValue(d, i, { t: v.t }) : h.setValue(d, i, { t: void 0 });
254
- }), y.push({
255
- id: Me.id,
250
+ }, new R()).getMatrix(), g = new R();
251
+ new R(i).forValue((d, c) => {
252
+ const S = h.getCellRaw(d, c);
253
+ S ? g.setValue(d, c, { t: S.t }) : g.setValue(d, c, { t: void 0 });
254
+ }), b.push({
255
+ id: ye.id,
256
256
  params: p
257
257
  }, {
258
258
  id: G.id,
259
259
  params: {
260
- unitId: c,
260
+ unitId: l,
261
261
  subUnitId: o,
262
- cellValue: l
262
+ cellValue: i
263
263
  }
264
264
  });
265
- const S = ye(e, p);
265
+ const v = be(e, p);
266
266
  _.push({
267
267
  id: G.id,
268
268
  params: {
269
- unitId: c,
269
+ unitId: l,
270
270
  subUnitId: o,
271
- cellValue: h.getMatrix()
271
+ cellValue: g.getMatrix()
272
272
  }
273
- }, ...S);
273
+ }, ...v);
274
274
  }
275
- const f = ce(y, t).result;
276
- return f && s.pushUndoRedo({
277
- unitID: c,
275
+ const m = le(b, t).result;
276
+ return m && s.pushUndoRedo({
277
+ unitID: l,
278
278
  undoMutations: _,
279
- redoMutations: y
280
- }), f;
279
+ redoMutations: b
280
+ }), m;
281
281
  }
282
282
  }, Ve = {
283
283
  id: "sheet.command.numfmt.add.decimal.command",
284
284
  type: U.COMMAND,
285
285
  handler: async (e) => {
286
- const n = e.get(I), t = e.get(j), r = e.get(K), s = e.get(V), a = t.getCurrentSelections();
286
+ const n = e.get($), t = e.get(j), r = e.get(Z), s = e.get(V), a = t.getCurrentSelections();
287
287
  if (!a || !a.length)
288
288
  return !1;
289
- const c = W(s);
290
- if (!c) return !1;
291
- const { unitId: o, subUnitId: g } = c;
289
+ const l = K(s);
290
+ if (!l) return !1;
291
+ const { unitId: o, subUnitId: h } = l;
292
292
  let u = 0;
293
- a.forEach((y) => {
294
- $.foreach(y.range, (_, f) => {
295
- const l = r.getValue(o, g, _, f);
296
- if (!l) {
297
- const S = c.worksheet.getCellRaw(_, f);
298
- if (!u && S && S.t === b.NUMBER && S.v) {
299
- const d = /\.(\d*)$/.exec(String(S.v));
293
+ a.forEach((b) => {
294
+ N.foreach(b.range, (_, m) => {
295
+ const i = r.getValue(o, h, _, m);
296
+ if (!i) {
297
+ const v = l.worksheet.getCellRaw(_, m);
298
+ if (!u && v && v.t === M.NUMBER && v.v) {
299
+ const d = /\.(\d*)$/.exec(String(v.v));
300
300
  if (d) {
301
- const i = d[1].length;
302
- if (!i)
301
+ const c = d[1].length;
302
+ if (!c)
303
303
  return;
304
- u = Math.max(u, i);
304
+ u = Math.max(u, c);
305
305
  }
306
306
  }
307
307
  return;
308
308
  }
309
- const h = x(l.pattern);
310
- u = h > u ? h : u;
309
+ const g = P(i.pattern);
310
+ u = g > u ? g : u;
311
311
  });
312
312
  });
313
- const C = u + 1, M = D(`0${C > 0 ? ".0" : ""}`, C), p = [];
314
- return a.forEach((y) => {
315
- $.foreach(y.range, (_, f) => {
316
- const l = r.getValue(o, g, _, f);
317
- if (!l)
313
+ const C = u + 1, y = F(`0${C > 0 ? ".0" : ""}`, C), p = [];
314
+ return a.forEach((b) => {
315
+ N.foreach(b.range, (_, m) => {
316
+ const i = r.getValue(o, h, _, m);
317
+ if (W(i == null ? void 0 : i.pattern))
318
318
  p.push({
319
319
  row: _,
320
- col: f,
321
- pattern: M
320
+ col: m,
321
+ pattern: y
322
322
  });
323
323
  else {
324
- const h = x(l.pattern), S = D(l.pattern, h + 1);
325
- S !== l.pattern && p.push({
324
+ const g = P(i.pattern), v = F(i.pattern, g + 1);
325
+ v !== i.pattern && p.push({
326
326
  row: _,
327
- col: f,
328
- pattern: S
327
+ col: m,
328
+ pattern: v
329
329
  });
330
330
  }
331
331
  });
@@ -335,13 +335,13 @@ const De = [
335
335
  id: "sheet.command.numfmt.set.currency",
336
336
  type: U.COMMAND,
337
337
  handler: async (e) => {
338
- const n = e.get(I), t = e.get(j), r = e.get(J), s = t.getCurrentSelections();
338
+ const n = e.get($), t = e.get(j), r = e.get(Q), s = t.getCurrentSelections();
339
339
  if (!s || !s.length)
340
340
  return !1;
341
- const a = [], c = we(r.getCurrentLocale()), o = xe(c.locale);
341
+ const a = [], l = xe(r.getCurrentLocale()), o = Pe(l.locale);
342
342
  return s.forEach((u) => {
343
- $.foreach(u.range, (C, M) => {
344
- a.push({ row: C, col: M, pattern: o, type: "currency" });
343
+ N.foreach(u.range, (C, y) => {
344
+ a.push({ row: C, col: y, pattern: o, type: "currency" });
345
345
  });
346
346
  }), await n.executeCommand(O.id, { values: a });
347
347
  }
@@ -349,13 +349,13 @@ const De = [
349
349
  id: "sheet.command.numfmt.set.percent",
350
350
  type: U.COMMAND,
351
351
  handler: async (e) => {
352
- const n = e.get(I), r = e.get(j).getCurrentSelections();
352
+ const n = e.get($), r = e.get(j).getCurrentSelections();
353
353
  if (!r || !r.length)
354
354
  return !1;
355
355
  const s = [], a = "0%";
356
356
  return r.forEach((o) => {
357
- $.foreach(o.range, (g, u) => {
358
- s.push({ row: g, col: u, pattern: a, type: "percent" });
357
+ N.foreach(o.range, (h, u) => {
358
+ s.push({ row: h, col: u, pattern: a, type: "percent" });
359
359
  });
360
360
  }), await n.executeCommand(O.id, { values: s });
361
361
  }
@@ -363,112 +363,106 @@ const De = [
363
363
  id: "sheet.command.numfmt.subtract.decimal.command",
364
364
  type: U.COMMAND,
365
365
  handler: async (e) => {
366
- const n = e.get(I), t = e.get(j), r = e.get(K), s = e.get(V), a = t.getCurrentSelections();
366
+ const n = e.get($), t = e.get(j), r = e.get(Z), s = e.get(V), a = t.getCurrentSelections();
367
367
  if (!a || !a.length)
368
368
  return !1;
369
- const c = W(s);
370
- if (!c) return !1;
371
- const { unitId: o, subUnitId: g } = c;
369
+ const l = K(s);
370
+ if (!l) return !1;
371
+ const { unitId: o, subUnitId: h } = l;
372
372
  let u = 0;
373
373
  a.forEach((_) => {
374
- $.foreach(_.range, (f, l) => {
375
- const h = r.getValue(o, g, f, l);
376
- if (!h) {
377
- const d = c.worksheet.getCellRaw(f, l);
378
- if (!u && d && d.t === b.NUMBER && d.v) {
379
- const i = /\.(\d*)$/.exec(String(d.v));
380
- if (i) {
381
- const v = i[1].length;
382
- if (!v)
374
+ N.foreach(_.range, (m, i) => {
375
+ const g = r.getValue(o, h, m, i);
376
+ if (!g) {
377
+ const d = l.worksheet.getCellRaw(m, i);
378
+ if (!u && d && d.t === M.NUMBER && d.v) {
379
+ const c = /\.(\d*)$/.exec(String(d.v));
380
+ if (c) {
381
+ const S = c[1].length;
382
+ if (!S)
383
383
  return;
384
- u = Math.max(u, v);
384
+ u = Math.max(u, S);
385
385
  }
386
386
  }
387
387
  return;
388
388
  }
389
- const S = x(h.pattern);
390
- u = S > u ? S : u;
389
+ const v = P(g.pattern);
390
+ u = v > u ? v : u;
391
391
  });
392
392
  });
393
- const C = u - 1, M = D(`0${C > 0 ? ".0" : "."}`, C), p = [];
393
+ const C = u - 1, y = F(`0${C > 0 ? ".0" : "."}`, C), p = [];
394
394
  return a.forEach((_) => {
395
- $.foreach(_.range, (f, l) => {
396
- const h = r.getValue(o, g, f, l);
397
- if (!h)
395
+ N.foreach(_.range, (m, i) => {
396
+ const g = r.getValue(o, h, m, i);
397
+ if (W(g == null ? void 0 : g.pattern))
398
398
  p.push({
399
- row: f,
400
- col: l,
401
- pattern: M
399
+ row: m,
400
+ col: i,
401
+ pattern: y
402
402
  });
403
403
  else {
404
- const S = x(h.pattern);
404
+ const v = P(g.pattern);
405
405
  p.push({
406
- row: f,
407
- col: l,
408
- pattern: D(h.pattern, S - 1)
406
+ row: m,
407
+ col: i,
408
+ pattern: F(g.pattern, v - 1)
409
409
  });
410
410
  }
411
411
  });
412
412
  }), await n.executeCommand(O.id, { values: p });
413
413
  }
414
- }, re = "sheets-numfmt.config", q = {}, at = (e) => E.getFormatInfo(e).type || "unknown", He = (e, n, t = "en") => {
415
- const r = E.formatColor(e, n), s = r ? String(r) : void 0, a = E.format(e, n, { locale: t, throws: !1 });
414
+ }, se = "sheets-numfmt.config", X = {}, st = (e) => x.getFormatInfo(e).type || "unknown", He = (e, n, t = "en") => {
415
+ const r = x.formatColor(e, n), s = r ? String(r) : void 0, a = x.format(e, n, { locale: t, throws: !1 });
416
416
  return n < 0 ? {
417
417
  result: a,
418
418
  color: s
419
419
  } : {
420
420
  result: a
421
421
  };
422
- }, Ge = (e, n, t) => e === le ? {
423
- result: String(Oe(n))
422
+ }, Ge = (e, n, t) => e === ue ? {
423
+ result: String(we(n))
424
424
  // In Excel, the default General format also needs to handle numeric precision.
425
- } : He(e, n, t), We = /* @__PURE__ */ new Set(["m d"]), Ke = /* @__PURE__ */ new Set(["h:mm AM/PM", "hh:mm AM/PM"]), it = (e) => {
426
- var r, s;
427
- const n = (s = (r = E.parseDate(e)) != null ? r : E.parseTime(e)) != null ? s : E.parseNumber(e);
428
- if (!n) return null;
429
- const { z: t } = n;
430
- return t && (We.has(t) || Ke.has(t) && !/\s(A|AM|P|PM)$/i.test(e)) ? null : n;
431
- };
432
- var Ze = Object.getOwnPropertyDescriptor, ze = (e, n, t, r) => {
433
- for (var s = r > 1 ? void 0 : r ? Ze(n, t) : n, a = e.length - 1, c; a >= 0; a--)
434
- (c = e[a]) && (s = c(s) || s);
425
+ } : He(e, n, t);
426
+ var We = Object.getOwnPropertyDescriptor, Ke = (e, n, t, r) => {
427
+ for (var s = r > 1 ? void 0 : r ? We(n, t) : n, a = e.length - 1, l; a >= 0; a--)
428
+ (l = e[a]) && (s = l(s) || s);
435
429
  return s;
436
- }, N = (e, n) => (t, r) => n(t, r, e);
437
- const ke = {
430
+ }, E = (e, n) => (t, r) => n(t, r, e);
431
+ const Ze = {
438
432
  tl: {
439
433
  size: 6,
440
434
  color: "#409f11"
441
435
  }
442
436
  };
443
- let F = class extends me {
444
- constructor(n, t, r, s, a, c, o) {
437
+ let D = class extends me {
438
+ constructor(n, t, r, s, a, l, o) {
445
439
  super();
446
440
  L(this, "_locale$", new $e("en"));
447
441
  L(this, "locale$", this._locale$.asObservable());
448
- this._instanceService = n, this._sheetInterceptorService = t, this._themeService = r, this._commandService = s, this._numfmtService = a, this._localeService = c, this._configService = o, this._initInterceptorCellContent();
442
+ this._instanceService = n, this._sheetInterceptorService = t, this._themeService = r, this._commandService = s, this._numfmtService = a, this._localeService = l, this._configService = o, this._initInterceptorCellContent();
449
443
  }
450
444
  get locale() {
451
445
  const n = this._locale$.getValue();
452
446
  if (n)
453
447
  return n;
454
448
  switch (this._localeService.getCurrentLocale()) {
455
- case m.FR_FR:
449
+ case f.FR_FR:
456
450
  return "fr";
457
- case m.RU_RU:
451
+ case f.RU_RU:
458
452
  return "ru";
459
- case m.VI_VN:
453
+ case f.VI_VN:
460
454
  return "vi";
461
- case m.ZH_CN:
455
+ case f.ZH_CN:
462
456
  return "zh-CN";
463
- case m.KO_KR:
457
+ case f.KO_KR:
464
458
  return "ko";
465
- case m.ZH_TW:
459
+ case f.ZH_TW:
466
460
  return "zh-TW";
467
- case m.ES_ES:
468
- case m.CA_ES:
461
+ case f.ES_ES:
462
+ case f.CA_ES:
469
463
  return "es";
470
- case m.EN_US:
471
- case m.FA_IR:
464
+ case f.EN_US:
465
+ case f.FA_IR:
472
466
  default:
473
467
  return "en";
474
468
  }
@@ -479,48 +473,48 @@ let F = class extends me {
479
473
  this.disposeWithMe(Ie(this._locale$, this._localeService.currentLocale$).subscribe(() => {
480
474
  n.reset();
481
475
  })), this.disposeWithMe(this._sheetInterceptorService.intercept(Re.CELL_CONTENT, {
482
- effect: Z.Value | Z.Style,
476
+ effect: z.Value | z.Style,
483
477
  // eslint-disable-next-line max-lines-per-function, complexity
484
478
  handler: (t, r, s) => {
485
- var y, _;
486
- if (!t || t.v === void 0 || t.v === null || t.t === b.BOOLEAN || t.t === b.FORCE_STRING)
479
+ var b, _;
480
+ if (!t || t.v === void 0 || t.v === null || t.t === M.BOOLEAN || t.t === M.FORCE_STRING)
487
481
  return s(t);
488
- const a = r.unitId, c = r.subUnitId;
482
+ const a = r.unitId, l = r.subUnitId;
489
483
  let o;
490
484
  if (t != null && t.s) {
491
- const f = r.workbook.getStyles().get(t.s);
492
- f != null && f.n && (o = f.n);
485
+ const m = r.workbook.getStyles().get(t.s);
486
+ m != null && m.n && (o = m.n);
493
487
  }
494
- if (o || (o = this._numfmtService.getValue(a, c, r.row, r.col)), fe(o == null ? void 0 : o.pattern) || t.t !== b.NUMBER && H(t.v, t.t) !== b.NUMBER)
488
+ if (o || (o = this._numfmtService.getValue(a, l, r.row, r.col)), W(o == null ? void 0 : o.pattern) || t.t !== M.NUMBER && H(t.v, t.t) !== M.NUMBER)
495
489
  return s(t);
496
- const g = t;
497
- if ((!t || t === r.rawData) && (t = { ...r.rawData }), X(o == null ? void 0 : o.pattern))
498
- return (y = this._configService.getConfig(re)) != null && y.disableTextFormatMark ? (t.t = b.STRING, s(t)) : (t.t = b.STRING, t.markers = { ...t == null ? void 0 : t.markers, ...ke }, s(t));
490
+ const h = t;
491
+ if ((!t || t === r.rawData) && (t = { ...r.rawData }), J(o == null ? void 0 : o.pattern))
492
+ return (b = this._configService.getConfig(se)) != null && b.disableTextFormatMark ? (t.t = M.STRING, s(t)) : (t.t = M.STRING, t.markers = { ...t == null ? void 0 : t.markers, ...Ze }, s(t));
499
493
  let u = "";
500
494
  const C = n.getValue(r.row, r.col);
501
- if (C && C.parameters === `${g.v}_${o == null ? void 0 : o.pattern}`)
495
+ if (C && C.parameters === `${h.v}_${o == null ? void 0 : o.pattern}`)
502
496
  return s({ ...t, ...C.result });
503
- const M = Ge(o == null ? void 0 : o.pattern, Number(g.v), this.locale);
504
- if (u = M.result, !u)
497
+ const y = Ge(o == null ? void 0 : o.pattern, Number(h.v), this.locale);
498
+ if (u = y.result, !u)
505
499
  return s(t);
506
- const p = { v: u, t: b.NUMBER };
507
- if (M.color) {
508
- const f = (_ = this._themeService.getColorFromTheme(`${M.color}.500`)) != null ? _ : M.color;
509
- f && (p.interceptorStyle = { cl: { rgb: f } });
500
+ const p = { v: u, t: M.NUMBER };
501
+ if (y.color) {
502
+ const m = (_ = this._themeService.getColorFromTheme(`${y.color}.500`)) != null ? _ : y.color;
503
+ m && (p.interceptorStyle = { cl: { rgb: m } });
510
504
  }
511
505
  return n.setValue(r.row, r.col, {
512
506
  result: p,
513
- parameters: `${g.v}_${o == null ? void 0 : o.pattern}`
507
+ parameters: `${h.v}_${o == null ? void 0 : o.pattern}`
514
508
  }), Object.assign(t, p), s(t);
515
509
  },
516
- priority: Ne.NUMFMT
510
+ priority: Ee.NUMFMT
517
511
  })), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
518
- if (t.id === te.id) {
512
+ if (t.id === ne.id) {
519
513
  const r = t.params;
520
514
  Object.keys(r.values).forEach((s) => {
521
- r.values[s].ranges.forEach((c) => {
522
- $.foreach(c, (o, g) => {
523
- n.realDeleteValue(o, g);
515
+ r.values[s].ranges.forEach((l) => {
516
+ N.foreach(l, (o, h) => {
517
+ n.realDeleteValue(o, h);
524
518
  });
525
519
  });
526
520
  });
@@ -531,12 +525,12 @@ let F = class extends me {
531
525
  });
532
526
  }
533
527
  })), this.disposeWithMe(
534
- this._instanceService.getCurrentTypeOfUnit$(ee.UNIVER_SHEET).pipe(
528
+ this._instanceService.getCurrentTypeOfUnit$(te.UNIVER_SHEET).pipe(
535
529
  Te((t) => {
536
530
  var r;
537
- return (r = t == null ? void 0 : t.activeSheet$) != null ? r : Pe(null);
531
+ return (r = t == null ? void 0 : t.activeSheet$) != null ? r : Ue(null);
538
532
  }),
539
- Ue(1)
533
+ Oe(1)
540
534
  ).subscribe(() => n.reset())
541
535
  );
542
536
  }
@@ -544,36 +538,36 @@ let F = class extends me {
544
538
  this._locale$.next(n);
545
539
  }
546
540
  };
547
- F = ze([
548
- N(0, V),
549
- N(1, T(be)),
550
- N(2, T(ue)),
551
- N(3, T(I)),
552
- N(4, T(K)),
553
- N(5, T(J)),
554
- N(6, Q)
555
- ], F);
556
- const Ye = "SHEET_NUMFMT_PLUGIN";
557
- var qe = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, Je = (e, n, t) => n in e ? qe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, Qe = (e, n, t, r) => {
558
- for (var s = r > 1 ? void 0 : r ? Xe(n, t) : n, a = e.length - 1, c; a >= 0; a--)
559
- (c = e[a]) && (s = c(s) || s);
541
+ D = Ke([
542
+ E(0, V),
543
+ E(1, I(Me)),
544
+ E(2, I(fe)),
545
+ E(3, I($)),
546
+ E(4, I(Z)),
547
+ E(5, I(Q)),
548
+ E(6, ee)
549
+ ], D);
550
+ const ze = "SHEET_NUMFMT_PLUGIN";
551
+ var ke = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, qe = (e, n, t) => n in e ? ke(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, Xe = (e, n, t, r) => {
552
+ for (var s = r > 1 ? void 0 : r ? Ye(n, t) : n, a = e.length - 1, l; a >= 0; a--)
553
+ (l = e[a]) && (s = l(s) || s);
560
554
  return s;
561
- }, B = (e, n) => (t, r) => n(t, r, e), se = (e, n, t) => Je(e, typeof n != "symbol" ? n + "" : n, t);
555
+ }, B = (e, n) => (t, r) => n(t, r, e), oe = (e, n, t) => qe(e, typeof n != "symbol" ? n + "" : n, t);
562
556
  let A = class extends he {
563
- constructor(e = q, n, t, r) {
557
+ constructor(e = X, n, t, r) {
564
558
  super(), this._config = e, this._injector = n, this._configService = t, this._commandService = r;
565
559
  const { ...s } = pe(
566
560
  {},
567
- q,
561
+ X,
568
562
  this._config
569
563
  );
570
- this._configService.setConfig(re, s);
564
+ this._configService.setConfig(se, s);
571
565
  }
572
566
  onStarting() {
573
567
  _e(this._injector, [
574
- [F]
575
- ]), Se(this._injector, [
576
- [F]
568
+ [D]
569
+ ]), ve(this._injector, [
570
+ [D]
577
571
  ]);
578
572
  }
579
573
  onRendered() {
@@ -588,47 +582,46 @@ let A = class extends he {
588
582
  });
589
583
  }
590
584
  };
591
- se(A, "pluginName", Ye);
592
- se(A, "type", ee.UNIVER_SHEET);
593
- A = Qe([
594
- de(Ee),
595
- B(1, T(ge)),
596
- B(2, Q),
597
- B(3, I)
585
+ oe(A, "pluginName", ze);
586
+ oe(A, "type", te.UNIVER_SHEET);
587
+ A = Xe([
588
+ de(Ne),
589
+ B(1, I(ge)),
590
+ B(2, ee),
591
+ B(3, $)
598
592
  ], A);
599
- const ct = (e) => ne.find((t) => e.includes(t)), lt = () => ne.map((e) => ({ label: e, value: e })), ut = (e) => Ae.map((n) => ({
593
+ const ot = (e) => re.find((t) => e.includes(t)), at = () => re.map((e) => ({ label: e, value: e })), it = (e) => Ae.map((n) => ({
600
594
  label: n.label(e),
601
595
  value: n.suffix(e),
602
596
  color: n.color
603
- })), mt = () => De.map((e) => ({ label: e.label, value: e.suffix })), ft = () => Fe.map((e) => ({ label: e.label, value: e.suffix, color: e.color }));
597
+ })), ct = () => Fe.map((e) => ({ label: e.label, value: e.suffix })), lt = () => De.map((e) => ({ label: e.label, value: e.suffix, color: e.color }));
604
598
  export {
605
599
  Ve as AddDecimalCommand,
606
600
  Ae as CURRENCYFORMAT,
607
- De as DATEFMTLISG,
608
- Fe as NUMBERFORMAT,
609
- re as SHEETS_NUMFMT_PLUGIN_CONFIG_KEY,
601
+ Fe as DATEFMTLISG,
602
+ De as NUMBERFORMAT,
603
+ se as SHEETS_NUMFMT_PLUGIN_CONFIG_KEY,
610
604
  je as SetCurrencyCommand,
611
605
  O as SetNumfmtCommand,
612
606
  Le as SetPercentCommand,
613
- F as SheetsNumfmtCellContentController,
607
+ D as SheetsNumfmtCellContentController,
614
608
  Be as SubtractDecimalCommand,
615
609
  A as UniverSheetsNumfmtPlugin,
616
- ne as currencySymbols,
617
- xe as getCurrencyFormat,
618
- ut as getCurrencyFormatOptions,
619
- lt as getCurrencyOptions,
620
- k as getCurrencySymbolByLocale,
621
- we as getCurrencySymbolIconByLocale,
622
- ct as getCurrencyType,
623
- mt as getDateFormatOptions,
624
- x as getDecimalFromPattern,
625
- Y as getDecimalString,
626
- ft as getNumberFormatOptions,
627
- it as getNumfmtParseValueFilter,
610
+ re as currencySymbols,
611
+ Pe as getCurrencyFormat,
612
+ it as getCurrencyFormatOptions,
613
+ at as getCurrencyOptions,
614
+ Y as getCurrencySymbolByLocale,
615
+ xe as getCurrencySymbolIconByLocale,
616
+ ot as getCurrencyType,
617
+ ct as getDateFormatOptions,
618
+ P as getDecimalFromPattern,
619
+ q as getDecimalString,
620
+ lt as getNumberFormatOptions,
628
621
  He as getPatternPreview,
629
622
  Ge as getPatternPreviewIgnoreGeneral,
630
- at as getPatternType,
631
- ot as isPatternHasDecimal,
623
+ st as getPatternType,
624
+ rt as isPatternHasDecimal,
632
625
  w as localeCurrencySymbolMap,
633
- D as setPatternDecimal
626
+ F as setPatternDecimal
634
627
  };