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