@univerjs/sheets-numfmt 0.8.1-nightly.202506191607 → 0.8.1
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/LICENSE +176 -0
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +162 -162
- package/lib/index.js +162 -162
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ie = Object.defineProperty;
|
|
2
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
|
|
4
|
-
import { numfmt as
|
|
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 ve, registerDependencies as Se, touchDependencies as Y } from "@univerjs/core";
|
|
5
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
6
|
import { isTextFormat as re } from "@univerjs/engine-numfmt";
|
|
7
7
|
import { BehaviorSubject as K, merge as Ie, switchMap as Te, of as Ee, skip as xe } from "rxjs";
|
|
@@ -34,7 +34,7 @@ const ne = [
|
|
|
34
34
|
"₽",
|
|
35
35
|
"₾",
|
|
36
36
|
"₿"
|
|
37
|
-
],
|
|
37
|
+
], we = {
|
|
38
38
|
US: "$",
|
|
39
39
|
// United States Dollar
|
|
40
40
|
CA: "C$",
|
|
@@ -74,7 +74,7 @@ const ne = [
|
|
|
74
74
|
SI: "€",
|
|
75
75
|
ES: "€"
|
|
76
76
|
// Add more mappings as needed
|
|
77
|
-
},
|
|
77
|
+
}, Ue = [
|
|
78
78
|
{
|
|
79
79
|
label: "1930-08-05",
|
|
80
80
|
suffix: "yyyy-MM-dd"
|
|
@@ -177,14 +177,14 @@ const ne = [
|
|
|
177
177
|
}
|
|
178
178
|
], Pe = "SHEET_NUMFMT_PLUGIN", O = (e, t = 0) => {
|
|
179
179
|
var n;
|
|
180
|
-
return e && (n =
|
|
180
|
+
return e && (n = U.getFormatInfo(e).maxDecimals) != null ? n : t;
|
|
181
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(
|
|
182
182
|
/\.0*/g,
|
|
183
183
|
`${t > 0 ? "." : ""}${k(Number(t || 0))}`
|
|
184
184
|
) : /0([^0]?)|0$/.test(n) ? n.replace(
|
|
185
185
|
/0([^0]+)|0$/,
|
|
186
186
|
`0${t > 0 ? "." : ""}${k(Number(t || 0))}$1`
|
|
187
|
-
) : n).join(";"), tt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e),
|
|
187
|
+
) : n).join(";"), tt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), w = {
|
|
188
188
|
id: "sheet.command.numfmt.set.numfmt",
|
|
189
189
|
type: V.COMMAND,
|
|
190
190
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -193,32 +193,32 @@ const ne = [
|
|
|
193
193
|
return !1;
|
|
194
194
|
const r = e.get(T), n = e.get(A), s = e.get(ue), o = H(n, t);
|
|
195
195
|
if (!o) return !1;
|
|
196
|
-
const { unitId:
|
|
197
|
-
unitId:
|
|
198
|
-
subUnitId:
|
|
199
|
-
ranges: y.map((
|
|
200
|
-
startColumn:
|
|
201
|
-
startRow:
|
|
202
|
-
endColumn:
|
|
203
|
-
endRow:
|
|
196
|
+
const { unitId: c, subUnitId: l, worksheet: f } = o, u = t.values.filter((a) => !!a.pattern), y = t.values.filter((a) => !a.pattern), _ = ye(c, l, u), h = {
|
|
197
|
+
unitId: c,
|
|
198
|
+
subUnitId: l,
|
|
199
|
+
ranges: y.map((a) => ({
|
|
200
|
+
startColumn: a.col,
|
|
201
|
+
startRow: a.row,
|
|
202
|
+
endColumn: a.col,
|
|
203
|
+
endRow: a.row
|
|
204
204
|
}))
|
|
205
205
|
}, C = [], p = [];
|
|
206
206
|
if (u.length) {
|
|
207
|
-
const
|
|
208
|
-
re(
|
|
209
|
-
const S = f.getCellRaw(
|
|
207
|
+
const a = u.reduce((m, i) => {
|
|
208
|
+
re(i.pattern) && m.setValue(i.row, i.col, { t: N.STRING });
|
|
209
|
+
const S = f.getCellRaw(i.row, i.col);
|
|
210
210
|
if (S) {
|
|
211
211
|
const x = G(S.v);
|
|
212
|
-
x !== S.t &&
|
|
212
|
+
x !== S.t && m.setValue(i.row, i.col, { t: x });
|
|
213
213
|
}
|
|
214
|
-
return
|
|
215
|
-
}, new b()).getMatrix(),
|
|
216
|
-
new b(
|
|
217
|
-
const S = f.getCellRaw(
|
|
218
|
-
S ?
|
|
219
|
-
}), Object.keys(_.values).forEach((
|
|
220
|
-
const
|
|
221
|
-
|
|
214
|
+
return m;
|
|
215
|
+
}, new b()).getMatrix(), g = new b();
|
|
216
|
+
new b(a).forValue((m, i) => {
|
|
217
|
+
const S = f.getCellRaw(m, i);
|
|
218
|
+
S ? g.setValue(m, i, { t: S.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);
|
|
222
222
|
}), C.push({
|
|
223
223
|
id: te.id,
|
|
224
224
|
params: _
|
|
@@ -227,45 +227,45 @@ const ne = [
|
|
|
227
227
|
p.push(...v);
|
|
228
228
|
}
|
|
229
229
|
if (y.length) {
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
const S = f.getCellRaw(
|
|
230
|
+
h.ranges = Z(h.ranges);
|
|
231
|
+
const a = y.reduce((m, i) => {
|
|
232
|
+
const S = f.getCellRaw(i.row, i.col);
|
|
233
233
|
if (S) {
|
|
234
234
|
const x = G(S.v);
|
|
235
|
-
x !== S.t &&
|
|
235
|
+
x !== S.t && m.setValue(i.row, i.col, { t: x });
|
|
236
236
|
}
|
|
237
|
-
return
|
|
238
|
-
}, new b()).getMatrix(),
|
|
239
|
-
new b(
|
|
240
|
-
const S = f.getCellRaw(
|
|
241
|
-
S ?
|
|
237
|
+
return m;
|
|
238
|
+
}, new b()).getMatrix(), g = new b();
|
|
239
|
+
new b(a).forValue((m, i) => {
|
|
240
|
+
const S = f.getCellRaw(m, i);
|
|
241
|
+
S ? g.setValue(m, i, { t: S.t }) : g.setValue(m, i, { t: void 0 });
|
|
242
242
|
}), C.push({
|
|
243
243
|
id: Ce.id,
|
|
244
|
-
params:
|
|
244
|
+
params: h
|
|
245
245
|
}, {
|
|
246
246
|
id: B.id,
|
|
247
247
|
params: {
|
|
248
|
-
unitId:
|
|
249
|
-
subUnitId:
|
|
250
|
-
cellValue:
|
|
248
|
+
unitId: c,
|
|
249
|
+
subUnitId: l,
|
|
250
|
+
cellValue: a
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
|
-
const v = be(e,
|
|
253
|
+
const v = be(e, h);
|
|
254
254
|
p.push({
|
|
255
255
|
id: B.id,
|
|
256
256
|
params: {
|
|
257
|
-
unitId:
|
|
258
|
-
subUnitId:
|
|
259
|
-
cellValue:
|
|
257
|
+
unitId: c,
|
|
258
|
+
subUnitId: l,
|
|
259
|
+
cellValue: g.getMatrix()
|
|
260
260
|
}
|
|
261
261
|
}, ...v);
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
return
|
|
265
|
-
unitID:
|
|
263
|
+
const d = me(C, r).result;
|
|
264
|
+
return d && s.pushUndoRedo({
|
|
265
|
+
unitID: c,
|
|
266
266
|
undoMutations: p,
|
|
267
267
|
redoMutations: C
|
|
268
|
-
}),
|
|
268
|
+
}), d;
|
|
269
269
|
}
|
|
270
270
|
}, De = {
|
|
271
271
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
@@ -274,56 +274,56 @@ const ne = [
|
|
|
274
274
|
const t = e.get(T), r = e.get(j), n = e.get(W), s = e.get(A), o = r.getCurrentSelections();
|
|
275
275
|
if (!o || !o.length)
|
|
276
276
|
return !1;
|
|
277
|
-
const
|
|
278
|
-
if (!
|
|
279
|
-
const { unitId:
|
|
277
|
+
const c = H(s);
|
|
278
|
+
if (!c) return !1;
|
|
279
|
+
const { unitId: l, subUnitId: f } = c;
|
|
280
280
|
let u = 0;
|
|
281
281
|
o.forEach((C) => {
|
|
282
|
-
I.foreach(C.range, (p,
|
|
283
|
-
const
|
|
284
|
-
if (!
|
|
285
|
-
const v =
|
|
286
|
-
if (!u && v && v.t ===
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
const
|
|
290
|
-
if (!
|
|
282
|
+
I.foreach(C.range, (p, d) => {
|
|
283
|
+
const a = n.getValue(l, f, p, d);
|
|
284
|
+
if (!a) {
|
|
285
|
+
const v = c.worksheet.getCellRaw(p, d);
|
|
286
|
+
if (!u && v && v.t === N.NUMBER && v.v) {
|
|
287
|
+
const m = /\.(\d*)$/.exec(String(v.v));
|
|
288
|
+
if (m) {
|
|
289
|
+
const i = m[1].length;
|
|
290
|
+
if (!i)
|
|
291
291
|
return;
|
|
292
|
-
u = Math.max(u,
|
|
292
|
+
u = Math.max(u, i);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
return;
|
|
296
296
|
}
|
|
297
|
-
const
|
|
298
|
-
u =
|
|
297
|
+
const g = O(a.pattern);
|
|
298
|
+
u = g > u ? g : u;
|
|
299
299
|
});
|
|
300
300
|
});
|
|
301
|
-
const y = u + 1, _ = P(`0${y > 0 ? ".0" : ""}`, y),
|
|
301
|
+
const y = u + 1, _ = P(`0${y > 0 ? ".0" : ""}`, y), h = [];
|
|
302
302
|
return o.forEach((C) => {
|
|
303
|
-
I.foreach(C.range, (p,
|
|
304
|
-
const
|
|
305
|
-
if (!
|
|
306
|
-
|
|
303
|
+
I.foreach(C.range, (p, d) => {
|
|
304
|
+
const a = n.getValue(l, f, p, d);
|
|
305
|
+
if (!a)
|
|
306
|
+
h.push({
|
|
307
307
|
row: p,
|
|
308
|
-
col:
|
|
308
|
+
col: d,
|
|
309
309
|
pattern: _
|
|
310
310
|
});
|
|
311
311
|
else {
|
|
312
|
-
const
|
|
313
|
-
v !==
|
|
312
|
+
const g = O(a.pattern), v = P(a.pattern, g + 1);
|
|
313
|
+
v !== a.pattern && h.push({
|
|
314
314
|
row: p,
|
|
315
|
-
col:
|
|
315
|
+
col: d,
|
|
316
316
|
pattern: v
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
319
|
});
|
|
320
|
-
}),
|
|
320
|
+
}), h.length ? await t.executeCommand(w.id, { values: h }) : !1;
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
class oe {
|
|
324
324
|
constructor() {
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
M(this, "_currencySymbol$", new K("US"));
|
|
326
|
+
M(this, "currencySymbol$", this._currencySymbol$.asObservable());
|
|
327
327
|
}
|
|
328
328
|
/**
|
|
329
329
|
* Set the currency symbol by setting the country code.
|
|
@@ -339,15 +339,15 @@ const Fe = {
|
|
|
339
339
|
id: "sheet.command.numfmt.set.currency",
|
|
340
340
|
type: V.COMMAND,
|
|
341
341
|
handler: async (e) => {
|
|
342
|
-
const t = e.get(T), r = e.get(j), n = e.get(oe), s =
|
|
342
|
+
const t = e.get(T), r = e.get(j), n = e.get(oe), s = we[n.getCurrencySymbol()] || "$", o = r.getCurrentSelections();
|
|
343
343
|
if (!o || !o.length)
|
|
344
344
|
return !1;
|
|
345
|
-
const
|
|
345
|
+
const c = [], l = se[4].suffix(s);
|
|
346
346
|
return o.forEach((u) => {
|
|
347
347
|
I.foreach(u.range, (y, _) => {
|
|
348
|
-
|
|
348
|
+
c.push({ row: y, col: _, pattern: l, type: "currency" });
|
|
349
349
|
});
|
|
350
|
-
}), await t.executeCommand(
|
|
350
|
+
}), await t.executeCommand(w.id, { values: c });
|
|
351
351
|
}
|
|
352
352
|
}, Ae = {
|
|
353
353
|
id: "sheet.command.numfmt.set.percent",
|
|
@@ -357,11 +357,11 @@ const Fe = {
|
|
|
357
357
|
if (!n || !n.length)
|
|
358
358
|
return !1;
|
|
359
359
|
const s = [], o = "0%";
|
|
360
|
-
return n.forEach((
|
|
361
|
-
I.foreach(
|
|
360
|
+
return n.forEach((l) => {
|
|
361
|
+
I.foreach(l.range, (f, u) => {
|
|
362
362
|
s.push({ row: f, col: u, pattern: o, type: "percent" });
|
|
363
363
|
});
|
|
364
|
-
}), await t.executeCommand(
|
|
364
|
+
}), await t.executeCommand(w.id, { values: s });
|
|
365
365
|
}
|
|
366
366
|
}, je = {
|
|
367
367
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
@@ -370,19 +370,19 @@ const Fe = {
|
|
|
370
370
|
const t = e.get(T), r = e.get(j), n = e.get(W), s = e.get(A), o = r.getCurrentSelections();
|
|
371
371
|
if (!o || !o.length)
|
|
372
372
|
return !1;
|
|
373
|
-
const
|
|
374
|
-
if (!
|
|
375
|
-
const { unitId:
|
|
373
|
+
const c = H(s);
|
|
374
|
+
if (!c) return !1;
|
|
375
|
+
const { unitId: l, subUnitId: f } = c;
|
|
376
376
|
let u = 0;
|
|
377
377
|
o.forEach((p) => {
|
|
378
|
-
I.foreach(p.range, (
|
|
379
|
-
const
|
|
380
|
-
if (!
|
|
381
|
-
const
|
|
382
|
-
if (!u &&
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
const S =
|
|
378
|
+
I.foreach(p.range, (d, a) => {
|
|
379
|
+
const g = n.getValue(l, f, d, a);
|
|
380
|
+
if (!g) {
|
|
381
|
+
const m = c.worksheet.getCellRaw(d, a);
|
|
382
|
+
if (!u && m && m.t === N.NUMBER && m.v) {
|
|
383
|
+
const i = /\.(\d*)$/.exec(String(m.v));
|
|
384
|
+
if (i) {
|
|
385
|
+
const S = i[1].length;
|
|
386
386
|
if (!S)
|
|
387
387
|
return;
|
|
388
388
|
u = Math.max(u, S);
|
|
@@ -390,33 +390,33 @@ const Fe = {
|
|
|
390
390
|
}
|
|
391
391
|
return;
|
|
392
392
|
}
|
|
393
|
-
const v = O(
|
|
393
|
+
const v = O(g.pattern);
|
|
394
394
|
u = v > u ? v : u;
|
|
395
395
|
});
|
|
396
396
|
});
|
|
397
|
-
const y = u - 1, _ = P(`0${y > 0 ? ".0" : "."}`, y),
|
|
397
|
+
const y = u - 1, _ = P(`0${y > 0 ? ".0" : "."}`, y), h = [];
|
|
398
398
|
return o.forEach((p) => {
|
|
399
|
-
I.foreach(p.range, (
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
402
|
-
|
|
403
|
-
row:
|
|
404
|
-
col:
|
|
399
|
+
I.foreach(p.range, (d, a) => {
|
|
400
|
+
const g = n.getValue(l, f, d, a);
|
|
401
|
+
if (!g)
|
|
402
|
+
h.push({
|
|
403
|
+
row: d,
|
|
404
|
+
col: a,
|
|
405
405
|
pattern: _
|
|
406
406
|
});
|
|
407
407
|
else {
|
|
408
|
-
const v = O(
|
|
409
|
-
|
|
410
|
-
row:
|
|
411
|
-
col:
|
|
412
|
-
pattern: P(
|
|
408
|
+
const v = O(g.pattern);
|
|
409
|
+
h.push({
|
|
410
|
+
row: d,
|
|
411
|
+
col: a,
|
|
412
|
+
pattern: P(g.pattern, v - 1)
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
});
|
|
416
|
-
}), await t.executeCommand(
|
|
416
|
+
}), await t.executeCommand(w.id, { values: h });
|
|
417
417
|
}
|
|
418
|
-
}, ae = "sheets-numfmt.config", q = {}, rt = (e) =>
|
|
419
|
-
const n =
|
|
418
|
+
}, ae = "sheets-numfmt.config", q = {}, rt = (e) => U.getFormatInfo(e).type || "unknown", Le = (e, t, r = "en") => {
|
|
419
|
+
const n = U.formatColor(e, t), s = n ? String(n) : void 0, o = U.format(e, t, { locale: r, throws: !1 });
|
|
420
420
|
return t < 0 ? {
|
|
421
421
|
result: o,
|
|
422
422
|
color: s
|
|
@@ -428,10 +428,10 @@ const Fe = {
|
|
|
428
428
|
// In Excel, the default General format also needs to handle numeric precision.
|
|
429
429
|
} : Le(e, t, r);
|
|
430
430
|
var Be = Object.getOwnPropertyDescriptor, He = (e, t, r, n) => {
|
|
431
|
-
for (var s = n > 1 ? void 0 : n ? Be(t, r) : t, o = e.length - 1,
|
|
432
|
-
(
|
|
431
|
+
for (var s = n > 1 ? void 0 : n ? Be(t, r) : t, o = e.length - 1, c; o >= 0; o--)
|
|
432
|
+
(c = e[o]) && (s = c(s) || s);
|
|
433
433
|
return s;
|
|
434
|
-
},
|
|
434
|
+
}, R = (e, t) => (r, n) => t(r, n, e);
|
|
435
435
|
const We = {
|
|
436
436
|
tl: {
|
|
437
437
|
size: 6,
|
|
@@ -439,29 +439,29 @@ const We = {
|
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
441
|
let D = class extends Q {
|
|
442
|
-
constructor(t, r, n, s, o,
|
|
442
|
+
constructor(t, r, n, s, o, c, l) {
|
|
443
443
|
super();
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
this._instanceService = t, this._sheetInterceptorService = r, this._themeService = n, this._commandService = s, this._numfmtService = o, this._localeService =
|
|
444
|
+
M(this, "_local$", new K("en"));
|
|
445
|
+
M(this, "local$", this._local$.asObservable());
|
|
446
|
+
this._instanceService = t, this._sheetInterceptorService = r, this._themeService = n, this._commandService = s, this._numfmtService = o, this._localeService = c, this._configService = l, this._initInterceptorCellContent();
|
|
447
447
|
}
|
|
448
448
|
get local() {
|
|
449
449
|
const t = this._local$.getValue();
|
|
450
450
|
if (t)
|
|
451
451
|
return t;
|
|
452
452
|
switch (this._localeService.getCurrentLocale()) {
|
|
453
|
-
case
|
|
453
|
+
case $.FR_FR:
|
|
454
454
|
return "fr";
|
|
455
|
-
case
|
|
455
|
+
case $.RU_RU:
|
|
456
456
|
return "ru";
|
|
457
|
-
case
|
|
457
|
+
case $.VI_VN:
|
|
458
458
|
return "vi";
|
|
459
|
-
case
|
|
459
|
+
case $.ZH_CN:
|
|
460
460
|
return "zh-CN";
|
|
461
|
-
case
|
|
461
|
+
case $.ZH_TW:
|
|
462
462
|
return "zh-TW";
|
|
463
|
-
case
|
|
464
|
-
case
|
|
463
|
+
case $.EN_US:
|
|
464
|
+
case $.FA_IR:
|
|
465
465
|
default:
|
|
466
466
|
return "en";
|
|
467
467
|
}
|
|
@@ -475,45 +475,45 @@ let D = class extends Q {
|
|
|
475
475
|
effect: z.Value | z.Style,
|
|
476
476
|
// eslint-disable-next-line complexity
|
|
477
477
|
handler: (r, n, s) => {
|
|
478
|
-
var
|
|
479
|
-
const o = n.unitId,
|
|
480
|
-
let
|
|
478
|
+
var p, d;
|
|
479
|
+
const o = n.unitId, c = n.subUnitId;
|
|
480
|
+
let l;
|
|
481
481
|
const f = r;
|
|
482
482
|
if (!f || f.v === void 0 || f.v === null)
|
|
483
483
|
return s(r);
|
|
484
484
|
if (r != null && r.s) {
|
|
485
|
-
const
|
|
486
|
-
|
|
485
|
+
const a = n.workbook.getStyles().get(r.s);
|
|
486
|
+
a != null && a.n && (l = a.n);
|
|
487
487
|
}
|
|
488
|
-
if (
|
|
488
|
+
if (l || (l = this._numfmtService.getValue(o, c, n.row, n.col)), !l || l.pattern === "General" || G(f.v) !== N.NUMBER)
|
|
489
489
|
return s(r);
|
|
490
|
-
if ((!r || r === n.rawData) && (r = { ...n.rawData }), re(
|
|
491
|
-
return (
|
|
492
|
-
let
|
|
493
|
-
const
|
|
494
|
-
if (
|
|
495
|
-
return s({ ...r, ...
|
|
496
|
-
const
|
|
497
|
-
if (
|
|
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
498
|
return s(r);
|
|
499
|
-
const
|
|
500
|
-
if (
|
|
501
|
-
const
|
|
502
|
-
|
|
499
|
+
const C = { v: y, t: N.NUMBER };
|
|
500
|
+
if (h.color) {
|
|
501
|
+
const a = (d = this._themeService.getColorFromTheme(`${h.color}.500`)) != null ? d : h.color;
|
|
502
|
+
a && (C.interceptorStyle = { cl: { rgb: a } });
|
|
503
503
|
}
|
|
504
504
|
return t.setValue(n.row, n.col, {
|
|
505
|
-
result:
|
|
506
|
-
parameters: `${f.v}_${
|
|
507
|
-
}), Object.assign(r,
|
|
505
|
+
result: C,
|
|
506
|
+
parameters: `${f.v}_${l.pattern}`
|
|
507
|
+
}), Object.assign(r, C), s(r);
|
|
508
508
|
},
|
|
509
509
|
priority: Re.NUMFMT
|
|
510
510
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((r) => {
|
|
511
511
|
if (r.id === te.id) {
|
|
512
512
|
const n = r.params;
|
|
513
513
|
Object.keys(n.values).forEach((s) => {
|
|
514
|
-
n.values[s].ranges.forEach((
|
|
515
|
-
I.foreach(
|
|
516
|
-
t.realDeleteValue(
|
|
514
|
+
n.values[s].ranges.forEach((c) => {
|
|
515
|
+
I.foreach(c, (l, f) => {
|
|
516
|
+
t.realDeleteValue(l, f);
|
|
517
517
|
});
|
|
518
518
|
});
|
|
519
519
|
});
|
|
@@ -538,19 +538,19 @@ let D = class extends Q {
|
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
540
|
D = He([
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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)),
|
|
547
|
+
R(6, X)
|
|
548
548
|
], D);
|
|
549
549
|
class J extends Q {
|
|
550
550
|
constructor() {
|
|
551
551
|
super(...arguments);
|
|
552
|
-
|
|
553
|
-
|
|
552
|
+
M(this, "_currencySymbol$", new K("US"));
|
|
553
|
+
M(this, "currencySymbol$", this._currencySymbol$.asObservable());
|
|
554
554
|
}
|
|
555
555
|
/**
|
|
556
556
|
* Set the currency symbol by setting the country code.
|
|
@@ -563,8 +563,8 @@ class J extends Q {
|
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
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, o = e.length - 1,
|
|
567
|
-
(
|
|
566
|
+
for (var s = n > 1 ? void 0 : n ? ze(t, r) : t, o = e.length - 1, c; o >= 0; o--)
|
|
567
|
+
(c = e[o]) && (s = c(s) || s);
|
|
568
568
|
return s;
|
|
569
569
|
}, L = (e, t) => (r, n) => t(r, n, e), ce = (e, t, r) => Ye(e, typeof t != "symbol" ? t + "" : t, r);
|
|
570
570
|
let F = class extends pe {
|
|
@@ -594,7 +594,7 @@ let F = class extends pe {
|
|
|
594
594
|
je,
|
|
595
595
|
Fe,
|
|
596
596
|
Ae,
|
|
597
|
-
|
|
597
|
+
w
|
|
598
598
|
].forEach((e) => {
|
|
599
599
|
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
600
600
|
});
|
|
@@ -612,21 +612,21 @@ const nt = (e) => ne.find((r) => e.includes(r)), st = () => ne.map((e) => ({ lab
|
|
|
612
612
|
label: t.label(e),
|
|
613
613
|
value: t.suffix(e),
|
|
614
614
|
color: t.color
|
|
615
|
-
})), at = () =>
|
|
615
|
+
})), at = () => Ue.map((e) => ({ label: e.label, value: e.suffix })), ct = () => Oe.map((e) => ({ label: e.label, value: e.suffix, color: e.color }));
|
|
616
616
|
export {
|
|
617
617
|
De as AddDecimalCommand,
|
|
618
618
|
se as CURRENCYFORMAT,
|
|
619
|
-
|
|
619
|
+
Ue as DATEFMTLISG,
|
|
620
620
|
oe as MenuCurrencyService,
|
|
621
621
|
Oe as NUMBERFORMAT,
|
|
622
622
|
ae as SHEETS_NUMFMT_PLUGIN_CONFIG_KEY,
|
|
623
623
|
Fe as SetCurrencyCommand,
|
|
624
|
-
|
|
624
|
+
w as SetNumfmtCommand,
|
|
625
625
|
Ae as SetPercentCommand,
|
|
626
626
|
D as SheetsNumfmtCellContentController,
|
|
627
627
|
je as SubtractDecimalCommand,
|
|
628
628
|
F as UniverSheetsNumfmtPlugin,
|
|
629
|
-
|
|
629
|
+
we as countryCurrencyMap,
|
|
630
630
|
ne as currencySymbols,
|
|
631
631
|
ot as getCurrencyFormatOptions,
|
|
632
632
|
st as getCurrencyOptions,
|