@univerjs/sheets-numfmt 0.8.0-nightly.202505271607 → 0.8.0-nightly.202505291607

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