@univerjs/sheets-numfmt 0.5.3-nightly.202501070959 → 0.5.3-nightly.202501081606
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/es/index.js +29 -29
- package/package.json +5 -5
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var te = Object.defineProperty;
|
|
|
2
2
|
var ne = (e, t, n) => t in e ? te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var N = (e, t, n) => ne(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { numfmt as $, CommandType as I, ICommandService as C, IUniverInstanceService as O, IUndoRedoService as re, sequenceExecute as se, Range as _, CellValueType as V, LocaleType as oe, Inject as M, ThemeService as ce, LocaleService as ie, Disposable as q, ObjectMatrix as j, InterceptorEffectEnum as B, isRealNum as ae, UniverInstanceType as z, DependentOn as ue, Injector as le, Plugin as me, registerDependencies as fe, touchDependencies as L } from "@univerjs/core";
|
|
5
|
-
import { getSheetCommandTarget as A, transformCellsToRange as de, rangeMerge as G, SetNumfmtMutation as X, factorySetNumfmtUndoMutation as he, RemoveNumfmtMutation as ge, factoryRemoveNumfmtUndoMutation as
|
|
5
|
+
import { getSheetCommandTarget as A, transformCellsToRange as de, rangeMerge as G, SetNumfmtMutation as X, factorySetNumfmtUndoMutation as he, RemoveNumfmtMutation as ge, factoryRemoveNumfmtUndoMutation as pe, SheetsSelectionsService as D, INumfmtService as w, SheetInterceptorService as ve, INTERCEPTOR_POINT as Se, InterceptCellContentPriority as ye, SetRangeValuesMutation as _e, UniverSheetsPlugin as Ce } from "@univerjs/sheets";
|
|
6
6
|
import { BehaviorSubject as Y, switchMap as be, of as Me, skip as $e } from "rxjs";
|
|
7
7
|
import { DEFAULT_TEXT_FORMAT as Ee } from "@univerjs/engine-numfmt";
|
|
8
8
|
const J = [
|
|
@@ -216,8 +216,8 @@ const J = [
|
|
|
216
216
|
}, f = [], h = [];
|
|
217
217
|
if (l.length) {
|
|
218
218
|
Object.keys(m.values).forEach((g) => {
|
|
219
|
-
const
|
|
220
|
-
|
|
219
|
+
const p = m.values[g];
|
|
220
|
+
p.ranges = G(p.ranges);
|
|
221
221
|
}), f.push({
|
|
222
222
|
id: X.id,
|
|
223
223
|
params: m
|
|
@@ -230,15 +230,15 @@ const J = [
|
|
|
230
230
|
id: ge.id,
|
|
231
231
|
params: d
|
|
232
232
|
});
|
|
233
|
-
const a =
|
|
233
|
+
const a = pe(e, d);
|
|
234
234
|
h.push(...a);
|
|
235
235
|
}
|
|
236
|
-
const
|
|
237
|
-
return
|
|
236
|
+
const v = se(f, n).result;
|
|
237
|
+
return v && s.pushUndoRedo({
|
|
238
238
|
unitID: c,
|
|
239
239
|
undoMutations: h,
|
|
240
240
|
redoMutations: f
|
|
241
|
-
}),
|
|
241
|
+
}), v;
|
|
242
242
|
}
|
|
243
243
|
}, xe = {
|
|
244
244
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
@@ -252,10 +252,10 @@ const J = [
|
|
|
252
252
|
const { unitId: u, subUnitId: l } = c;
|
|
253
253
|
let i = 0;
|
|
254
254
|
o.forEach((h) => {
|
|
255
|
-
_.foreach(h.range, (
|
|
256
|
-
const g = r.getValue(u, l,
|
|
255
|
+
_.foreach(h.range, (v, a) => {
|
|
256
|
+
const g = r.getValue(u, l, v, a);
|
|
257
257
|
if (!g) {
|
|
258
|
-
const S = c.worksheet.getCellRaw(
|
|
258
|
+
const S = c.worksheet.getCellRaw(v, a);
|
|
259
259
|
if (!i && S && S.t === V.NUMBER && S.v) {
|
|
260
260
|
const y = /\.(\d*)$/.exec(String(S.v));
|
|
261
261
|
if (y) {
|
|
@@ -267,24 +267,24 @@ const J = [
|
|
|
267
267
|
}
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
-
const
|
|
271
|
-
i =
|
|
270
|
+
const p = T(g.pattern);
|
|
271
|
+
i = p > i ? p : i;
|
|
272
272
|
});
|
|
273
273
|
});
|
|
274
274
|
const m = i + 1, d = x(`0${m > 0 ? ".0" : ""}`, m), f = [];
|
|
275
275
|
return o.forEach((h) => {
|
|
276
|
-
_.foreach(h.range, (
|
|
277
|
-
const g = r.getValue(u, l,
|
|
276
|
+
_.foreach(h.range, (v, a) => {
|
|
277
|
+
const g = r.getValue(u, l, v, a);
|
|
278
278
|
if (!g)
|
|
279
279
|
f.push({
|
|
280
|
-
row:
|
|
280
|
+
row: v,
|
|
281
281
|
col: a,
|
|
282
282
|
pattern: d
|
|
283
283
|
});
|
|
284
284
|
else {
|
|
285
|
-
const
|
|
285
|
+
const p = T(g.pattern), S = x(g.pattern, p + 1);
|
|
286
286
|
S !== g.pattern && f.push({
|
|
287
|
-
row:
|
|
287
|
+
row: v,
|
|
288
288
|
col: a,
|
|
289
289
|
pattern: S
|
|
290
290
|
});
|
|
@@ -347,10 +347,10 @@ const Pe = {
|
|
|
347
347
|
if (!c) return !1;
|
|
348
348
|
const { unitId: u, subUnitId: l } = c;
|
|
349
349
|
let i = 0;
|
|
350
|
-
o.forEach((
|
|
351
|
-
_.foreach(
|
|
352
|
-
const
|
|
353
|
-
if (!
|
|
350
|
+
o.forEach((v) => {
|
|
351
|
+
_.foreach(v.range, (a, g) => {
|
|
352
|
+
const p = r.getValue(u, l, a, g);
|
|
353
|
+
if (!p) {
|
|
354
354
|
const y = c.worksheet.getCellRaw(a, g);
|
|
355
355
|
if (!i && y && y.t === V.NUMBER && y.v) {
|
|
356
356
|
const E = /\.(\d*)$/.exec(String(y.v));
|
|
@@ -363,26 +363,26 @@ const Pe = {
|
|
|
363
363
|
}
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
const S = T(
|
|
366
|
+
const S = T(p.pattern);
|
|
367
367
|
i = S > i ? S : i;
|
|
368
368
|
});
|
|
369
369
|
});
|
|
370
370
|
const m = i - 1, d = x(`0${m > 0 ? ".0" : "."}`, m), f = [];
|
|
371
|
-
return o.forEach((
|
|
372
|
-
_.foreach(
|
|
373
|
-
const
|
|
374
|
-
if (!
|
|
371
|
+
return o.forEach((v) => {
|
|
372
|
+
_.foreach(v.range, (a, g) => {
|
|
373
|
+
const p = r.getValue(u, l, a, g);
|
|
374
|
+
if (!p)
|
|
375
375
|
f.push({
|
|
376
376
|
row: a,
|
|
377
377
|
col: g,
|
|
378
378
|
pattern: d
|
|
379
379
|
});
|
|
380
380
|
else {
|
|
381
|
-
const S = T(
|
|
381
|
+
const S = T(p.pattern);
|
|
382
382
|
f.push({
|
|
383
383
|
row: a,
|
|
384
384
|
col: g,
|
|
385
|
-
pattern: x(
|
|
385
|
+
pattern: x(p.pattern, S - 1)
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
388
|
});
|
|
@@ -487,7 +487,7 @@ let P = class extends q {
|
|
|
487
487
|
};
|
|
488
488
|
P = Fe([
|
|
489
489
|
b(0, O),
|
|
490
|
-
b(1, M(
|
|
490
|
+
b(1, M(ve)),
|
|
491
491
|
b(2, M(ce)),
|
|
492
492
|
b(3, M(C)),
|
|
493
493
|
b(4, M(w)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-numfmt",
|
|
3
|
-
"version": "0.5.3-nightly.
|
|
3
|
+
"version": "0.5.3-nightly.202501081606",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UniverSheet numfmt plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"rxjs": ">=7.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@univerjs/core": "0.5.3-nightly.
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/
|
|
56
|
+
"@univerjs/core": "0.5.3-nightly.202501081606",
|
|
57
|
+
"@univerjs/engine-numfmt": "0.5.3-nightly.202501081606",
|
|
58
|
+
"@univerjs/sheets": "0.5.3-nightly.202501081606"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"rxjs": "^7.8.1",
|
|
62
62
|
"typescript": "^5.7.2",
|
|
63
|
-
"vite": "^6.0.
|
|
63
|
+
"vite": "^6.0.7",
|
|
64
64
|
"vitest": "^2.1.8",
|
|
65
65
|
"@univerjs-infra/shared": "0.5.3"
|
|
66
66
|
},
|