@univerjs/sheets-numfmt 0.8.0-nightly.202505261607 → 0.8.0-nightly.202505281606

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 ae = Object.defineProperty;
2
- var le = (e, t, n) => t in e ? ae(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 P, 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 ve, merge as pe, 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
  "¥",
@@ -34,7 +34,7 @@ const re = [
34
34
  "₽",
35
35
  "₾",
36
36
  "₿"
37
- ], Pe = {
37
+ ], we = {
38
38
  US: "$",
39
39
  // United States Dollar
40
40
  CA: "C$",
@@ -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
- ], we = [
122
+ ], Oe = [
123
123
  {
124
124
  label: "(1,235)",
125
125
  suffix: "#,##0_);(#,##0)"
@@ -175,83 +175,70 @@ const re = [
175
175
  suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
176
176
  color: "red"
177
177
  }
178
- ], Oe = "SHEET_NUMFMT_PLUGIN", w = (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, v) => {
186
- if (g.isEnd)
187
- return g;
188
- const h = v.value || v.num;
189
- return v.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), c = n(s[0].tokens), i = n(r[1].tokens), m = n(s[1].tokens);
193
- return o === c && 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), U = {
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: P.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: c, subUnitId: i, worksheet: m } = o, u = t.values.filter((l) => !!l.pattern), g = t.values.filter((l) => !l.pattern), v = ye(c, i, u), h = {
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 = {
210
197
  unitId: c,
211
- subUnitId: i,
212
- ranges: g.map((l) => ({
213
- startColumn: l.col,
214
- startRow: l.row,
215
- endColumn: l.col,
216
- endRow: l.row
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, a) => {
221
- ne(a.pattern) && d.setValue(a.row, a.col, { t: I.STRING });
222
- const _ = m.getCellRaw(a.row, a.col);
223
- if (_) {
224
- const V = G(_.v);
225
- V !== _.t && d.setValue(a.row, a.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(), p = new b();
229
- new b(l).forValue((d, a) => {
230
- const _ = m.getCellRaw(d, a);
231
- _ ? p.setValue(d, a, { t: _.t }) : p.setValue(d, a, { t: void 0 });
232
- }), Object.keys(v.values).forEach((d) => {
233
- const a = v.values[d];
234
- a.ranges = Y(a.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: v
224
+ params: _
238
225
  });
239
- const y = _e(e, v);
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, a) => {
245
- const _ = m.getCellRaw(a.row, a.col);
246
- if (_) {
247
- const V = G(_.v);
248
- V !== _.t && d.setValue(a.row, a.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(), p = new b();
252
- new b(l).forValue((d, a) => {
253
- const _ = m.getCellRaw(d, a);
254
- _ ? p.setValue(d, a, { t: _.t }) : p.setValue(d, a, { 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
@@ -259,83 +246,83 @@ const re = [
259
246
  id: B.id,
260
247
  params: {
261
248
  unitId: c,
262
- subUnitId: i,
263
- cellValue: l
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
257
  unitId: c,
271
- subUnitId: i,
272
- cellValue: p.getMatrix()
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({
263
+ const d = me(C, r).result;
264
+ return d && s.pushUndoRedo({
278
265
  unitID: c,
279
- undoMutations: S,
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: P.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
277
  const c = H(s);
291
278
  if (!c) return !1;
292
- const { unitId: i, subUnitId: m } = c;
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 = c.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 a = d[1].length;
303
- if (!a)
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, a);
292
+ u = Math.max(u, i);
306
293
  }
307
294
  }
308
295
  return;
309
296
  }
310
- const p = w(l.pattern);
311
- u = p > u ? p : u;
297
+ const g = O(o.pattern);
298
+ u = g > u ? g : u;
312
299
  });
313
300
  });
314
- const g = u + 1, v = 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: v
307
+ row: p,
308
+ col: d,
309
+ pattern: _
323
310
  });
324
311
  else {
325
- const p = w(l.pattern), y = O(l.pattern, p + 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(U.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: P.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 = Pe[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 c = [], i = se[4].suffix(s);
359
- return o.forEach((u) => {
360
- N.foreach(u.range, (g, v) => {
361
- c.push({ row: g, col: v, 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(U.id, { values: c });
350
+ }), await t.executeCommand(w.id, { values: c });
364
351
  }
365
- }, Fe = {
352
+ }, Ae = {
366
353
  id: "sheet.command.numfmt.set.percent",
367
- type: P.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(U.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: P.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
373
  const c = H(s);
387
374
  if (!c) return !1;
388
- const { unitId: i, subUnitId: m } = c;
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 p = r.getValue(i, m, f, l);
393
- if (!p) {
394
- const d = c.worksheet.getCellRaw(f, l);
395
- if (!u && d && d.t === I.NUMBER && d.v) {
396
- const a = /\.(\d*)$/.exec(String(d.v));
397
- if (a) {
398
- const _ = a[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 = w(p.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, v = O(`0${g > 0 ? ".0" : "."}`, g), h = [];
411
- return o.forEach((S) => {
412
- N.foreach(S.range, (f, l) => {
413
- const p = r.getValue(i, m, f, l);
414
- if (!p)
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: v
403
+ row: d,
404
+ col: o,
405
+ pattern: _
419
406
  });
420
407
  else {
421
- const y = w(p.pattern);
408
+ const S = O(g.pattern);
422
409
  h.push({
423
- row: f,
424
- col: l,
425
- pattern: O(p.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(U.id, { values: h });
416
+ }), await t.executeCommand(w.id, { values: h });
430
417
  }
431
- }, ce = "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, c; o >= 0; o--)
445
- (c = e[o]) && (s = c(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, c, 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 = c, 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,77 +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, c = r.subUnitId;
493
- let i;
494
- const m = n;
495
- if (!m)
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, c, r.row, r.col)), !i || (n.t || G(m.v)) !== I.NUMBER)
502
- return s(n);
503
- if (ne(i.pattern))
504
- return (S = this._configService.getConfig(ce)) != null && S.disableTextFormatMark ? s({
505
- ...n,
506
- t: I.STRING
507
- }) : s({
508
- ...n,
509
- t: I.STRING,
510
- markers: {
511
- ...n == null ? void 0 : n.markers,
512
- ...We
513
- }
514
- });
515
- let g = "";
516
- const v = t.getValue(r.row, r.col);
517
- if (v && v.parameters === `${m.v}_${i.pattern}`)
518
- return s({ ...n, ...v.result });
519
- if (m.v === void 0 || m.v === null)
520
- return s(n);
521
- const h = Ge(i.pattern, Number(m.v), this.local);
522
- if (g = h.result, !g)
523
- return s(n);
524
- 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 };
525
500
  if (h.color) {
526
- const f = this._themeService.getColorFromTheme(`${h.color}.500`);
527
- 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 } });
528
503
  }
529
- return t.setValue(r.row, r.col, {
504
+ return t.setValue(n.row, n.col, {
530
505
  result: C,
531
- parameters: `${m.v}_${i.pattern}`
532
- }), s({ ...n, ...C });
506
+ parameters: `${f.v}_${l.pattern}`
507
+ }), Object.assign(r, C), s(r);
533
508
  },
534
509
  priority: Re.NUMFMT
535
- })), this.disposeWithMe(this._commandService.onCommandExecuted((n) => {
536
- if (n.id === te.id) {
537
- const r = n.params;
538
- Object.keys(r.values).forEach((s) => {
539
- r.values[s].ranges.forEach((c) => {
540
- N.foreach(c, (i, m) => {
541
- 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);
542
517
  });
543
518
  });
544
519
  });
545
- } else if (n.id === B.id) {
546
- const r = n.params;
547
- new b(r.cellValue).forValue((s, o) => {
548
- 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);
549
524
  });
550
525
  }
551
526
  })), this.disposeWithMe(
552
527
  this._instanceService.getCurrentTypeOfUnit$(ee.UNIVER_SHEET).pipe(
553
- Ee((n) => {
554
- var r;
555
- 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);
556
531
  }),
557
532
  xe(1)
558
533
  ).subscribe(() => t.reset())
@@ -563,107 +538,106 @@ let D = class extends Q {
563
538
  }
564
539
  };
565
540
  D = He([
566
- R(0, F),
567
- R(1, T(Me)),
568
- R(2, T(fe)),
569
- R(3, T(E)),
570
- R(4, T(W)),
571
- 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)),
572
547
  R(6, X)
573
548
  ], D);
574
549
  class J extends Q {
575
550
  constructor() {
576
551
  super(...arguments);
577
- M(this, "_currencySymbol$", new k("US"));
552
+ M(this, "_currencySymbol$", new K("US"));
578
553
  M(this, "currencySymbol$", this._currencySymbol$.asObservable());
579
554
  }
580
555
  /**
581
556
  * Set the currency symbol by setting the country code.
582
557
  */
583
- setCurrencySymbolByCountryCode(n) {
584
- this._currencySymbol$.next(n);
558
+ setCurrencySymbolByCountryCode(r) {
559
+ this._currencySymbol$.next(r);
585
560
  }
586
561
  getCurrencySymbol() {
587
562
  return this._currencySymbol$.getValue();
588
563
  }
589
564
  }
590
- 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) => {
591
- for (var s = r > 1 ? void 0 : r ? Ke(t, n) : t, o = e.length - 1, c; o >= 0; o--)
592
- (c = e[o]) && (s = c(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);
593
568
  return s;
594
- }, L = (e, t) => (n, r) => t(n, r, e), ie = (e, t, n) => ze(e, typeof t != "symbol" ? t + "" : t, n);
595
- let A = class extends ve {
596
- constructor(e = Z, t, n, r) {
597
- super(), this._config = e, this._injector = t, this._configService = n, this._commandService = r;
598
- const { ...s } = pe(
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(
599
574
  {},
600
- Z,
575
+ q,
601
576
  this._config
602
577
  );
603
- this._configService.setConfig(ce, s);
578
+ this._configService.setConfig(ae, s);
604
579
  }
605
580
  onStarting() {
606
- Se(this._injector, [
581
+ ve(this._injector, [
607
582
  [D],
608
583
  [oe],
609
584
  [J]
610
- ]), z(this._injector, [
585
+ ]), Y(this._injector, [
611
586
  [D]
612
587
  ]);
613
588
  }
614
589
  onRendered() {
615
- z(this._injector, [
590
+ Y(this._injector, [
616
591
  [J]
617
592
  ]), [
618
593
  De,
619
594
  je,
620
- Ae,
621
595
  Fe,
622
- U
596
+ Ae,
597
+ w
623
598
  ].forEach((e) => {
624
599
  this.disposeWithMe(this._commandService.registerCommand(e));
625
600
  });
626
601
  }
627
602
  };
628
- ie(A, "pluginName", Oe);
629
- ie(A, "type", ee.UNIVER_SHEET);
630
- A = Ye([
631
- ge(Ie),
632
- 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)),
633
608
  L(2, X),
634
- L(3, E)
635
- ], A);
636
- const st = (e) => re.find((n) => e.includes(n)), ot = () => re.map((e) => ({ label: e, value: e })), ct = (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) => ({
637
612
  label: t.label(e),
638
613
  value: t.suffix(e),
639
614
  color: t.color
640
- })), it = () => Ue.map((e) => ({ label: e.label, value: e.suffix })), at = () => we.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 }));
641
616
  export {
642
617
  De as AddDecimalCommand,
643
618
  se as CURRENCYFORMAT,
644
619
  Ue as DATEFMTLISG,
645
620
  oe as MenuCurrencyService,
646
- we as NUMBERFORMAT,
647
- ce as SHEETS_NUMFMT_PLUGIN_CONFIG_KEY,
648
- Ae as SetCurrencyCommand,
649
- U as SetNumfmtCommand,
650
- Fe as SetPercentCommand,
621
+ Oe as NUMBERFORMAT,
622
+ ae as SHEETS_NUMFMT_PLUGIN_CONFIG_KEY,
623
+ Fe as SetCurrencyCommand,
624
+ w as SetNumfmtCommand,
625
+ Ae as SetPercentCommand,
651
626
  D as SheetsNumfmtCellContentController,
652
627
  je as SubtractDecimalCommand,
653
- A as UniverSheetsNumfmtPlugin,
654
- Pe as countryCurrencyMap,
655
- re as currencySymbols,
656
- ct as getCurrencyFormatOptions,
657
- ot as getCurrencyOptions,
658
- st as getCurrencyType,
659
- it as getDateFormatOptions,
660
- w as getDecimalFromPattern,
661
- q as getDecimalString,
662
- at as getNumberFormatOptions,
628
+ F as UniverSheetsNumfmtPlugin,
629
+ we as countryCurrencyMap,
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,
637
+ ct as getNumberFormatOptions,
663
638
  Le as getPatternPreview,
664
639
  Ge as getPatternPreviewIgnoreGeneral,
665
640
  rt as getPatternType,
666
- tt as isPatternEqualWithoutDecimal,
667
- nt as isPatternHasDecimal,
668
- O as setPatternDecimal
641
+ tt as isPatternHasDecimal,
642
+ P as setPatternDecimal
669
643
  };