@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/cjs/index.js +1 -1
- package/lib/es/index.js +167 -162
- package/lib/index.js +167 -162
- package/lib/types/index.d.ts +2 -2
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
package/lib/es/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { LocaleType as i, numfmt as
|
|
5
|
-
import { getSheetCommandTarget as
|
|
6
|
-
import { BehaviorSubject as
|
|
7
|
-
import { stripErrorMargin as
|
|
8
|
-
const
|
|
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
|
-
],
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
83
|
-
return
|
|
82
|
+
function q(e) {
|
|
83
|
+
return x.get(e) || "$";
|
|
84
84
|
}
|
|
85
|
-
function
|
|
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)}`), `"${
|
|
89
|
+
return t > 0 && (n = `.${"0".repeat(t)}`), `"${q(e)}"#,##0${n}_);[Red]("${q(e)}"#,##0${n})`;
|
|
90
90
|
}
|
|
91
|
-
const
|
|
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
|
-
],
|
|
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
|
-
],
|
|
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
|
-
],
|
|
192
|
+
], F = (e, r = 0) => {
|
|
193
193
|
var n;
|
|
194
|
-
return e && (n =
|
|
195
|
-
},
|
|
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 ? "." : ""}${
|
|
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 ? "." : ""}${
|
|
201
|
-
) : n).join(";"),
|
|
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:
|
|
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(
|
|
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 =
|
|
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
|
-
|
|
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
|
|
226
|
-
|
|
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 =
|
|
235
|
+
l.ranges = Y(l.ranges);
|
|
236
236
|
}), b.push({
|
|
237
|
-
id:
|
|
237
|
+
id: ne.id,
|
|
238
238
|
params: y
|
|
239
239
|
});
|
|
240
|
-
const S =
|
|
240
|
+
const S = ye(e, y);
|
|
241
241
|
_.push(...S);
|
|
242
242
|
}
|
|
243
243
|
if (C.length) {
|
|
244
|
-
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
|
|
249
|
-
|
|
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:
|
|
257
|
+
id: be.id,
|
|
258
258
|
params: p
|
|
259
259
|
}, {
|
|
260
|
-
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 =
|
|
267
|
+
const S = Me(e, p);
|
|
268
268
|
_.push({
|
|
269
|
-
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 =
|
|
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
|
-
},
|
|
284
|
+
}, je = {
|
|
285
285
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
286
|
-
type:
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
311
|
+
const g = F(c.pattern);
|
|
312
312
|
f = g > f ? g : f;
|
|
313
313
|
});
|
|
314
314
|
});
|
|
315
|
-
const C = f + 1, y =
|
|
315
|
+
const C = f + 1, y = D(`0${C > 0 ? ".0" : ""}`, C), p = [];
|
|
316
316
|
return a.forEach((b) => {
|
|
317
|
-
|
|
317
|
+
E.foreach(b.range, (_, m) => {
|
|
318
318
|
const c = n.getValue(o, h, _, m);
|
|
319
|
-
if (
|
|
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 =
|
|
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(
|
|
334
|
+
}), p.length ? await r.executeCommand(w.id, { values: p }) : !1;
|
|
335
335
|
}
|
|
336
|
-
},
|
|
336
|
+
}, Le = {
|
|
337
337
|
id: "sheet.command.numfmt.set.currency",
|
|
338
|
-
type:
|
|
338
|
+
type: O.COMMAND,
|
|
339
339
|
handler: async (e) => {
|
|
340
|
-
const r = e.get($), t = e.get(j), n = e.get(
|
|
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 =
|
|
343
|
+
const a = [], u = Pe(n.getCurrentLocale()), o = Fe(u.locale);
|
|
344
344
|
return s.forEach((f) => {
|
|
345
|
-
|
|
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(
|
|
348
|
+
}), await r.executeCommand(w.id, { values: a });
|
|
349
349
|
}
|
|
350
|
-
},
|
|
350
|
+
}, Ke = {
|
|
351
351
|
id: "sheet.command.numfmt.set.percent",
|
|
352
|
-
type:
|
|
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
|
-
|
|
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(
|
|
362
|
+
}), await r.executeCommand(w.id, { values: s });
|
|
363
363
|
}
|
|
364
|
-
},
|
|
364
|
+
}, Be = {
|
|
365
365
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
366
|
-
type:
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
391
|
+
const S = F(g.pattern);
|
|
392
392
|
f = S > f ? S : f;
|
|
393
393
|
});
|
|
394
394
|
});
|
|
395
|
-
const C = f - 1, y =
|
|
395
|
+
const C = f - 1, y = D(`0${C > 0 ? ".0" : "."}`, C), p = [];
|
|
396
396
|
return a.forEach((_) => {
|
|
397
|
-
|
|
397
|
+
E.foreach(_.range, (m, c) => {
|
|
398
398
|
const g = n.getValue(o, h, m, c);
|
|
399
|
-
if (
|
|
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 =
|
|
406
|
+
const S = F(g.pattern);
|
|
407
407
|
p.push({
|
|
408
408
|
row: m,
|
|
409
409
|
col: c,
|
|
410
|
-
pattern:
|
|
410
|
+
pattern: D(g.pattern, S - 1)
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
});
|
|
414
|
-
}), await r.executeCommand(
|
|
414
|
+
}), await r.executeCommand(w.id, { values: p });
|
|
415
415
|
}
|
|
416
|
-
},
|
|
416
|
+
}, oe = "sheets-numfmt.config", J = {}, ct = (e) => P.getFormatInfo(e).type || "unknown", He = (e, r, t = "en") => {
|
|
417
417
|
try {
|
|
418
|
-
const n =
|
|
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
|
-
},
|
|
432
|
-
result: String(
|
|
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
|
-
} :
|
|
435
|
-
var
|
|
436
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
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
|
-
},
|
|
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
|
|
446
|
+
let A = class extends de {
|
|
447
447
|
constructor(r, t, n, s, a, u, o) {
|
|
448
448
|
super();
|
|
449
|
-
|
|
450
|
-
|
|
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(
|
|
484
|
+
this.disposeWithMe(Te(this._locale$, this._localeService.currentLocale$).subscribe(() => {
|
|
485
485
|
r.reset();
|
|
486
|
-
})), this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
487
|
-
effect:
|
|
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)),
|
|
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 }),
|
|
503
|
-
return (b = this._configService.getConfig(
|
|
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 =
|
|
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 ===
|
|
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
|
-
|
|
527
|
+
E.foreach(u, (o, h) => {
|
|
528
528
|
r.realDeleteValue(o, h);
|
|
529
529
|
});
|
|
530
530
|
});
|
|
531
531
|
});
|
|
532
|
-
} else if (t.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$(
|
|
540
|
-
|
|
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 :
|
|
542
|
+
return (n = t == null ? void 0 : t.activeSheet$) != null ? n : Oe(null);
|
|
543
543
|
}),
|
|
544
|
-
|
|
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
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
],
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
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
|
-
},
|
|
567
|
-
let
|
|
568
|
-
constructor(e =
|
|
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 } =
|
|
573
|
+
const { ...s } = _e(
|
|
571
574
|
{},
|
|
572
|
-
|
|
575
|
+
J,
|
|
573
576
|
this._config
|
|
574
577
|
);
|
|
575
|
-
this._configService.setConfig(
|
|
578
|
+
this._configService.setConfig(oe, s);
|
|
576
579
|
}
|
|
577
580
|
onStarting() {
|
|
578
|
-
|
|
579
|
-
[
|
|
580
|
-
]),
|
|
581
|
-
[
|
|
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
|
-
|
|
589
|
+
Ke,
|
|
590
|
+
w
|
|
588
591
|
].forEach((e) => {
|
|
589
592
|
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
590
593
|
});
|
|
591
594
|
}
|
|
592
595
|
};
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
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
|
-
})),
|
|
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
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
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
|
};
|