@univerjs/sheets-numfmt 0.1.1 → 0.1.2
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/README.md +34 -2
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +604 -530
- package/lib/types/commands/commands/set-percent.command.d.ts +17 -0
- package/lib/types/menu/menu.d.ts +11 -0
- package/lib/umd/index.js +2 -2
- package/package.json +19 -19
package/lib/es/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Y = (e, t, r) => (
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { transformCellsToRange as
|
|
6
|
-
import { Inject as g, Injector as K, createIdentifier as
|
|
7
|
-
import { IAutoFillService as
|
|
8
|
-
import { map as
|
|
9
|
-
import
|
|
10
|
-
import { IRenderManagerService as
|
|
11
|
-
import { ComponentManager as
|
|
12
|
-
import { Observable as q, combineLatest as
|
|
13
|
-
import
|
|
1
|
+
var $t = Object.defineProperty;
|
|
2
|
+
var Ut = (e, t, r) => t in e ? $t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var Y = (e, t, r) => (Ut(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { CommandType as X, ICommandService as E, IUniverInstanceService as $, IUndoRedoService as At, sequenceExecute as Lt, Tools as Vt, Disposable as H, OnLifecycle as k, LifecycleStages as U, Range as R, Rectangle as De, ObjectMatrix as lt, CellValueType as se, toDisposable as Z, ThemeService as ut, runOnLifecycle as Ht, ILocalStorageService as kt, LocaleService as T, DisposableCollection as dt, UniverInstanceType as de, Plugin as Ft, PluginType as Bt } from "@univerjs/core";
|
|
5
|
+
import { transformCellsToRange as me, rangeMerge as z, SetNumfmtMutation as w, factorySetNumfmtUndoMutation as he, RemoveNumfmtMutation as M, factoryRemoveNumfmtUndoMutation as J, INumfmtService as A, INTERCEPTOR_POINT as mt, SheetInterceptorService as Ae, SelectionManagerService as ee, ClearSelectionFormatCommand as zt, ClearSelectionAllCommand as Wt, SetRangeValuesCommand as Kt, getCurrentSheetDisabled$ as fe, RefRangeService as Gt, EffectRefRangId as j, handleMoveRows as Yt, handleMoveCols as qt, handleIRemoveRow as Zt, handleIRemoveCol as Jt, handleMoveRange as Qt, handleInsertRow as Xt, handleInsertRangeMoveRight as en, handleInsertRangeMoveDown as tn, handleInsertCol as nn, handleDeleteRangeMoveUp as rn, handleDeleteRangeMoveLeft as sn, runRefRangeMutations as an, RemoveSheetCommand as on } from "@univerjs/sheets";
|
|
6
|
+
import { Inject as g, Injector as K, createIdentifier as cn } from "@wendellhu/redi";
|
|
7
|
+
import { IAutoFillService as ln, APPLY_TYPE as He, getAutoFillRepeatRange as un, SheetSkeletonManagerService as Ke, COPY_TYPE as nt, PREDEFINED_HOOK_NAME as rt, getRepeatRange as dn, ISheetClipboardService as mn, IEditorBridgeService as hn } from "@univerjs/sheets-ui";
|
|
8
|
+
import { map as le, distinctUntilChanged as ht, switchMap as ft, tap as fn, debounceTime as pn, filter as st, bufferTime as vn } from "rxjs/operators";
|
|
9
|
+
import D from "@univerjs/engine-numfmt";
|
|
10
|
+
import { IRenderManagerService as gn, ITextSelectionRenderManager as _n } from "@univerjs/engine-render";
|
|
11
|
+
import { ComponentManager as pt, ISidebarService as Sn, MenuItemType as pe, MenuGroup as ve, MenuPosition as ge, getMenuHiddenObservable as _e, IMenuService as Cn } from "@univerjs/ui";
|
|
12
|
+
import { Observable as q, combineLatest as bn, merge as Ge } from "rxjs";
|
|
13
|
+
import yn, { createContext as Rn, useState as x, useEffect as Ye, useRef as qe, useContext as vt, useMemo as V, createElement as te, forwardRef as ie } from "react";
|
|
14
14
|
import { InputNumber as Ze, Select as Je, SelectList as Qe, Button as it } from "@univerjs/design";
|
|
15
|
-
import { useDependency as N, useInjector as
|
|
16
|
-
import { FormulaDataModel as
|
|
17
|
-
const
|
|
15
|
+
import { useDependency as N, useInjector as In } from "@wendellhu/redi/react-bindings";
|
|
16
|
+
import { FormulaDataModel as Mn } from "@univerjs/engine-formula";
|
|
17
|
+
const Q = {
|
|
18
18
|
id: "sheet.command.numfmt.set.numfmt",
|
|
19
|
-
type:
|
|
19
|
+
type: X.COMMAND,
|
|
20
20
|
handler: (e, t) => {
|
|
21
21
|
if (!t)
|
|
22
22
|
return !1;
|
|
23
|
-
const r = e.get(
|
|
23
|
+
const r = e.get(E), n = e.get($), s = e.get(At), i = n.getCurrentUniverSheetInstance(), a = i.getUnitId(), c = i.getActiveSheet().getSheetId(), d = t.values.filter((f) => !!f.pattern), l = t.values.filter((f) => !f.pattern), u = me(a, c, d), m = {
|
|
24
24
|
unitId: a,
|
|
25
25
|
subUnitId: c,
|
|
26
26
|
ranges: l.map((f) => ({
|
|
@@ -33,64 +33,64 @@ const te = {
|
|
|
33
33
|
if (d.length) {
|
|
34
34
|
Object.keys(u.values).forEach((S) => {
|
|
35
35
|
const C = u.values[S];
|
|
36
|
-
C.ranges =
|
|
36
|
+
C.ranges = z(C.ranges);
|
|
37
37
|
}), h.push({
|
|
38
38
|
id: w.id,
|
|
39
39
|
params: u
|
|
40
40
|
});
|
|
41
|
-
const f =
|
|
41
|
+
const f = he(e, u);
|
|
42
42
|
_.push(...f);
|
|
43
43
|
}
|
|
44
44
|
if (l.length) {
|
|
45
|
-
m.ranges =
|
|
46
|
-
id:
|
|
45
|
+
m.ranges = z(m.ranges), h.push({
|
|
46
|
+
id: M.id,
|
|
47
47
|
params: m
|
|
48
48
|
});
|
|
49
49
|
const f = J(e, m);
|
|
50
50
|
_.push(...f);
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
return
|
|
52
|
+
const v = Lt(h, r).result;
|
|
53
|
+
return v && s.pushUndoRedo({
|
|
54
54
|
unitID: a,
|
|
55
55
|
undoMutations: _,
|
|
56
56
|
redoMutations: h
|
|
57
|
-
}),
|
|
57
|
+
}), v;
|
|
58
58
|
}
|
|
59
|
-
},
|
|
59
|
+
}, On = {
|
|
60
60
|
sheet: {
|
|
61
61
|
numfmt: {
|
|
62
|
-
title: "
|
|
63
|
-
numfmtType: "
|
|
64
|
-
cancel: "
|
|
65
|
-
confirm: "
|
|
66
|
-
general: "
|
|
67
|
-
accounting: "
|
|
68
|
-
text: "
|
|
69
|
-
number: "
|
|
70
|
-
currency: "
|
|
71
|
-
date: "
|
|
72
|
-
time: "
|
|
73
|
-
thousandthPercentile: "
|
|
74
|
-
preview: "
|
|
75
|
-
dateTime: "
|
|
76
|
-
decimalLength: "
|
|
77
|
-
currencyType: "
|
|
78
|
-
moreFmt: "
|
|
79
|
-
financialValue: "
|
|
80
|
-
roundingCurrency: "
|
|
81
|
-
timeDuration: "
|
|
82
|
-
currencyDes: "
|
|
83
|
-
accountingDes: "
|
|
84
|
-
dateType: "
|
|
85
|
-
dateDes: "
|
|
86
|
-
negType: "
|
|
87
|
-
generalDes: "
|
|
88
|
-
thousandthPercentileDes: "
|
|
89
|
-
addDecimal: "
|
|
90
|
-
subtractDecimal: "
|
|
62
|
+
title: "Number format",
|
|
63
|
+
numfmtType: "Format types",
|
|
64
|
+
cancel: "Cancel",
|
|
65
|
+
confirm: "Confirm",
|
|
66
|
+
general: "General",
|
|
67
|
+
accounting: "Accounting",
|
|
68
|
+
text: "Text",
|
|
69
|
+
number: "Number",
|
|
70
|
+
currency: "Currency",
|
|
71
|
+
date: "Date",
|
|
72
|
+
time: "Time",
|
|
73
|
+
thousandthPercentile: "Thousands separator",
|
|
74
|
+
preview: "Preview",
|
|
75
|
+
dateTime: "Date and time",
|
|
76
|
+
decimalLength: "Decimal places",
|
|
77
|
+
currencyType: "Currency Symbol",
|
|
78
|
+
moreFmt: "More Formats",
|
|
79
|
+
financialValue: "Financial value",
|
|
80
|
+
roundingCurrency: "Rounding up the currency",
|
|
81
|
+
timeDuration: "Duration Time",
|
|
82
|
+
currencyDes: "The currency format is used to represent general currency values. The accounting format aligns a column of values with decimal points",
|
|
83
|
+
accountingDes: "The accounting number format aligns a column of values with currency symbols and decimal points",
|
|
84
|
+
dateType: "Date Type",
|
|
85
|
+
dateDes: "The date format presents date and time series values as date values.",
|
|
86
|
+
negType: "A negative number type",
|
|
87
|
+
generalDes: "The regular format does not contain any specific number format.",
|
|
88
|
+
thousandthPercentileDes: "The percentile format is used for the representation of ordinary numbers. Monetary and accounting formats provide a specialized format for monetary value calculations.",
|
|
89
|
+
addDecimal: "Increase decimal places",
|
|
90
|
+
subtractDecimal: "Decreasing decimal places"
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
},
|
|
93
|
+
}, Pn = On, xn = {
|
|
94
94
|
sheet: {
|
|
95
95
|
numfmt: {
|
|
96
96
|
title: "数据格式",
|
|
@@ -124,8 +124,8 @@ const te = {
|
|
|
124
124
|
subtractDecimal: "减少小数位"
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
},
|
|
128
|
-
const t = e.filter((i) => i.id ===
|
|
127
|
+
}, wn = xn, ue = "SHEET_NUMFMT_PLUGIN", Ee = (e) => {
|
|
128
|
+
const t = e.filter((i) => i.id === M.id).map((i) => i.params), r = e.filter((i) => i.id === w.id).map((i) => i.params), n = [];
|
|
129
129
|
if (t[0]) {
|
|
130
130
|
const i = t.reduce(
|
|
131
131
|
(a, o) => (a.ranges.push(...o.ranges), a),
|
|
@@ -135,12 +135,12 @@ const te = {
|
|
|
135
135
|
subUnitId: t[0].subUnitId
|
|
136
136
|
}
|
|
137
137
|
);
|
|
138
|
-
i.ranges =
|
|
138
|
+
i.ranges = z(i.ranges), n.push({ id: M.id, params: i });
|
|
139
139
|
}
|
|
140
140
|
const s = (i, a) => {
|
|
141
141
|
const o = Object.keys(i), c = o.findIndex((d) => {
|
|
142
142
|
const l = i[d];
|
|
143
|
-
return
|
|
143
|
+
return Vt.diffValue(l, a);
|
|
144
144
|
});
|
|
145
145
|
return o[c];
|
|
146
146
|
};
|
|
@@ -166,17 +166,17 @@ const te = {
|
|
|
166
166
|
);
|
|
167
167
|
Object.keys(i.values).forEach((a) => {
|
|
168
168
|
const o = i.values[a];
|
|
169
|
-
o.ranges =
|
|
169
|
+
o.ranges = z(o.ranges);
|
|
170
170
|
}), n.push({ id: w.id, params: i });
|
|
171
171
|
}
|
|
172
172
|
return n;
|
|
173
173
|
};
|
|
174
|
-
var
|
|
175
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
174
|
+
var jn = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, Tn = (e, t, r, n) => {
|
|
175
|
+
for (var s = n > 1 ? void 0 : n ? Nn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
176
176
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
177
|
-
return n && s &&
|
|
178
|
-
},
|
|
179
|
-
let
|
|
177
|
+
return n && s && jn(t, r, s), s;
|
|
178
|
+
}, Ce = (e, t) => (r, n) => t(r, n, e);
|
|
179
|
+
let Re = class extends H {
|
|
180
180
|
constructor(e, t, r, n) {
|
|
181
181
|
super(), this._injector = e, this._univerInstanceService = t, this._numfmtService = r, this._autoFillService = n, this._initAutoFill();
|
|
182
182
|
}
|
|
@@ -193,8 +193,8 @@ let _e = class extends H {
|
|
|
193
193
|
endColumn: i.col,
|
|
194
194
|
endRow: i.row
|
|
195
195
|
}, u = [];
|
|
196
|
-
if (
|
|
197
|
-
const _ =
|
|
196
|
+
if (R.foreach(a, (m, h) => {
|
|
197
|
+
const _ = De.getPositionRange(
|
|
198
198
|
{
|
|
199
199
|
startRow: m,
|
|
200
200
|
startColumn: h,
|
|
@@ -202,14 +202,14 @@ let _e = class extends H {
|
|
|
202
202
|
endRow: m
|
|
203
203
|
},
|
|
204
204
|
d
|
|
205
|
-
),
|
|
205
|
+
), v = this._numfmtService.getValue(
|
|
206
206
|
o,
|
|
207
207
|
c,
|
|
208
208
|
_.startRow,
|
|
209
209
|
_.startColumn
|
|
210
210
|
);
|
|
211
|
-
if (
|
|
212
|
-
const f =
|
|
211
|
+
if (v) {
|
|
212
|
+
const f = De.getPositionRange(
|
|
213
213
|
{
|
|
214
214
|
startRow: m,
|
|
215
215
|
startColumn: h,
|
|
@@ -219,8 +219,8 @@ let _e = class extends H {
|
|
|
219
219
|
l
|
|
220
220
|
);
|
|
221
221
|
u.push({
|
|
222
|
-
pattern:
|
|
223
|
-
type:
|
|
222
|
+
pattern: v.pattern,
|
|
223
|
+
type: v.type,
|
|
224
224
|
row: f.startRow,
|
|
225
225
|
col: f.startColumn
|
|
226
226
|
});
|
|
@@ -228,8 +228,8 @@ let _e = class extends H {
|
|
|
228
228
|
}), u.length) {
|
|
229
229
|
const m = {
|
|
230
230
|
id: w.id,
|
|
231
|
-
params:
|
|
232
|
-
}, h =
|
|
231
|
+
params: me(o, c, u)
|
|
232
|
+
}, h = he(this._injector, m.params);
|
|
233
233
|
return {
|
|
234
234
|
redos: [m],
|
|
235
235
|
undos: h
|
|
@@ -241,15 +241,15 @@ let _e = class extends H {
|
|
|
241
241
|
row: s.startRow,
|
|
242
242
|
col: s.startColumn
|
|
243
243
|
};
|
|
244
|
-
return
|
|
244
|
+
return un(s, i).forEach((l) => {
|
|
245
245
|
const { undos: u, redos: m } = t(c, l.repeatStartCell, l.relativeRange);
|
|
246
246
|
a.push(...u), o.push(...m);
|
|
247
247
|
}), {
|
|
248
|
-
undos:
|
|
249
|
-
redos:
|
|
248
|
+
undos: Ee(a),
|
|
249
|
+
redos: Ee(o)
|
|
250
250
|
};
|
|
251
251
|
}, n = {
|
|
252
|
-
id:
|
|
252
|
+
id: ue,
|
|
253
253
|
onFillData: (s, i, a) => {
|
|
254
254
|
if (a === He.COPY || a === He.ONLY_FORMAT || a === He.SERIES) {
|
|
255
255
|
const { source: o, target: c } = s;
|
|
@@ -261,15 +261,15 @@ let _e = class extends H {
|
|
|
261
261
|
this.disposeWithMe(this._autoFillService.addHook(n));
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
|
-
|
|
265
|
-
k(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
],
|
|
271
|
-
const Xe = (e) =>
|
|
272
|
-
const n =
|
|
264
|
+
Re = Tn([
|
|
265
|
+
k(U.Rendered, Re),
|
|
266
|
+
Ce(0, g(K)),
|
|
267
|
+
Ce(1, g($)),
|
|
268
|
+
Ce(2, g(A)),
|
|
269
|
+
Ce(3, g(ln))
|
|
270
|
+
], Re);
|
|
271
|
+
const Xe = (e) => D.getInfo(e).type || "unknown", gt = (e, t) => {
|
|
272
|
+
const n = D.getInfo(e)._partitions[1], s = D.format(e, t, { locale: "zh-CN" });
|
|
273
273
|
return t < 0 ? {
|
|
274
274
|
result: s,
|
|
275
275
|
color: n.color
|
|
@@ -277,12 +277,12 @@ const Xe = (e) => E.getInfo(e).type || "unknown", gt = (e, t) => {
|
|
|
277
277
|
result: s
|
|
278
278
|
};
|
|
279
279
|
};
|
|
280
|
-
var
|
|
281
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
280
|
+
var Dn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, $n = (e, t, r, n) => {
|
|
281
|
+
for (var s = n > 1 ? void 0 : n ? En(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
282
282
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
283
|
-
return n && s &&
|
|
284
|
-
},
|
|
285
|
-
let
|
|
283
|
+
return n && s && Dn(t, r, s), s;
|
|
284
|
+
}, oe = (e, t) => (r, n) => t(r, n, e);
|
|
285
|
+
let Ie = class extends H {
|
|
286
286
|
constructor(e, t, r, n, s) {
|
|
287
287
|
super(), this._sheetInterceptorService = e, this._themeService = t, this._sheetSkeletonManagerService = r, this._commandService = n, this._numfmtService = s, this._initInterceptorCellContent();
|
|
288
288
|
}
|
|
@@ -295,7 +295,7 @@ let Se = class extends H {
|
|
|
295
295
|
if (!a)
|
|
296
296
|
return n(t);
|
|
297
297
|
const o = t;
|
|
298
|
-
if (!o || o.t !==
|
|
298
|
+
if (!o || o.t !== se.NUMBER)
|
|
299
299
|
return n(t);
|
|
300
300
|
let c = "";
|
|
301
301
|
const d = e.getValue(r.row, r.col);
|
|
@@ -321,7 +321,7 @@ let Se = class extends H {
|
|
|
321
321
|
const r = t.params;
|
|
322
322
|
Object.keys(r.values).forEach((n) => {
|
|
323
323
|
r.values[n].ranges.forEach((i) => {
|
|
324
|
-
|
|
324
|
+
R.foreach(i, (a, o) => {
|
|
325
325
|
e.realDeleteValue(a, o);
|
|
326
326
|
});
|
|
327
327
|
});
|
|
@@ -331,7 +331,7 @@ let Se = class extends H {
|
|
|
331
331
|
), this.disposeWithMe(
|
|
332
332
|
Z(
|
|
333
333
|
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
334
|
-
|
|
334
|
+
le((t) => t == null ? void 0 : t.sheetId),
|
|
335
335
|
ht()
|
|
336
336
|
).subscribe(() => {
|
|
337
337
|
e.reset();
|
|
@@ -340,18 +340,18 @@ let Se = class extends H {
|
|
|
340
340
|
);
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
|
-
|
|
344
|
-
k(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
],
|
|
351
|
-
const
|
|
343
|
+
Ie = $n([
|
|
344
|
+
k(U.Rendered, Ie),
|
|
345
|
+
oe(0, g(Ae)),
|
|
346
|
+
oe(1, g(ut)),
|
|
347
|
+
oe(2, g(Ke)),
|
|
348
|
+
oe(3, g(E)),
|
|
349
|
+
oe(4, g(A))
|
|
350
|
+
], Ie);
|
|
351
|
+
const W = (e, t = 0) => {
|
|
352
352
|
var n;
|
|
353
|
-
return e && (n =
|
|
354
|
-
},
|
|
353
|
+
return e && (n = D.getInfo(e).maxDecimals) != null ? n : t;
|
|
354
|
+
}, Le = (e, t) => {
|
|
355
355
|
if (e && !t || !e && t)
|
|
356
356
|
return !1;
|
|
357
357
|
const r = (d) => d.reduce(
|
|
@@ -362,54 +362,54 @@ const z = (e, t = 0) => {
|
|
|
362
362
|
return u.type === "point" ? (l.isEnd = !0, l) : { ...l, result: l.result + m };
|
|
363
363
|
},
|
|
364
364
|
{ isEnd: !1, result: "" }
|
|
365
|
-
).result, n =
|
|
365
|
+
).result, n = D.getInfo(e)._partitions, s = D.getInfo(t)._partitions, i = r(n[0].tokens), a = r(s[0].tokens), o = r(n[1].tokens), c = r(s[1].tokens);
|
|
366
366
|
return i === a && o === c && n[1].color === s[1].color;
|
|
367
|
-
}, at = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""),
|
|
367
|
+
}, at = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), I = (e, t) => e.split(";").map((n) => /\.0?/.test(n) ? n.replace(
|
|
368
368
|
/\.0*/g,
|
|
369
369
|
`${t > 0 ? "." : ""}${at(Number(t || 0))}`
|
|
370
370
|
) : /0([^0]?)|0$/.test(n) ? n.replace(
|
|
371
371
|
/0([^0]+)|0$/,
|
|
372
372
|
`0${t > 0 ? "." : ""}${at(Number(t || 0))}$1`
|
|
373
|
-
) : n).join(";"),
|
|
373
|
+
) : n).join(";"), Un = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), _t = {
|
|
374
374
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
375
|
-
type:
|
|
375
|
+
type: X.COMMAND,
|
|
376
376
|
handler: async (e) => {
|
|
377
|
-
const t = e.get(
|
|
377
|
+
const t = e.get(E), r = e.get(ee), n = e.get(A), s = e.get($), i = r.getSelections();
|
|
378
378
|
if (!i || !i.length)
|
|
379
379
|
return !1;
|
|
380
380
|
const a = s.getCurrentUniverSheetInstance(), o = a.getActiveSheet(), c = a.getUnitId(), d = o.getSheetId();
|
|
381
381
|
let l = 0;
|
|
382
382
|
i.forEach((_) => {
|
|
383
|
-
|
|
384
|
-
const S = n.getValue(c, d,
|
|
383
|
+
R.foreach(_.range, (v, f) => {
|
|
384
|
+
const S = n.getValue(c, d, v, f);
|
|
385
385
|
if (!S)
|
|
386
386
|
return;
|
|
387
|
-
const C =
|
|
387
|
+
const C = W(S.pattern);
|
|
388
388
|
l = C > l ? C : l;
|
|
389
389
|
});
|
|
390
390
|
});
|
|
391
|
-
const u = l + 1, m =
|
|
391
|
+
const u = l + 1, m = I(`0${u > 0 ? ".0" : ""}`, u), h = [];
|
|
392
392
|
return i.forEach((_) => {
|
|
393
|
-
|
|
394
|
-
const S = n.getValue(c, d,
|
|
395
|
-
if (!S
|
|
393
|
+
R.foreach(_.range, (v, f) => {
|
|
394
|
+
const S = n.getValue(c, d, v, f);
|
|
395
|
+
if (!S)
|
|
396
396
|
h.push({
|
|
397
|
-
row:
|
|
397
|
+
row: v,
|
|
398
398
|
col: f,
|
|
399
399
|
pattern: m
|
|
400
400
|
});
|
|
401
401
|
else {
|
|
402
|
-
const C =
|
|
403
|
-
|
|
404
|
-
row:
|
|
402
|
+
const C = W(S.pattern), y = I(S.pattern, C + 1);
|
|
403
|
+
y !== S.pattern && h.push({
|
|
404
|
+
row: v,
|
|
405
405
|
col: f,
|
|
406
|
-
pattern:
|
|
406
|
+
pattern: y
|
|
407
407
|
});
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
}), h.length ? await t.executeCommand(
|
|
410
|
+
}), h.length ? await t.executeCommand(Q.id, { values: h }) : !1;
|
|
411
411
|
}
|
|
412
|
-
},
|
|
412
|
+
}, An = [
|
|
413
413
|
{
|
|
414
414
|
label: "1930-08-05",
|
|
415
415
|
suffix: "yyyy-MM-dd"
|
|
@@ -454,7 +454,7 @@ const z = (e, t = 0) => {
|
|
|
454
454
|
label: "08-05 下午 01:30",
|
|
455
455
|
suffix: "MM-dd A/P hh:mm"
|
|
456
456
|
}
|
|
457
|
-
],
|
|
457
|
+
], Ln = [
|
|
458
458
|
{
|
|
459
459
|
label: "(1,235)",
|
|
460
460
|
suffix: "#,##0_);(#,##0)"
|
|
@@ -512,72 +512,72 @@ const z = (e, t = 0) => {
|
|
|
512
512
|
}
|
|
513
513
|
], Ct = {
|
|
514
514
|
id: "sheet.command.numfmt.set.currency",
|
|
515
|
-
type:
|
|
515
|
+
type: X.COMMAND,
|
|
516
516
|
handler: async (e) => {
|
|
517
|
-
const t = e.get(
|
|
517
|
+
const t = e.get(E), n = e.get(ee).getSelections();
|
|
518
518
|
if (!n || !n.length)
|
|
519
519
|
return !1;
|
|
520
520
|
const s = [], i = St[0].suffix("¥");
|
|
521
521
|
return n.forEach((o) => {
|
|
522
|
-
|
|
522
|
+
R.foreach(o.range, (c, d) => {
|
|
523
523
|
s.push({ row: c, col: d, pattern: i, type: "currency" });
|
|
524
524
|
});
|
|
525
|
-
}), await t.executeCommand(
|
|
525
|
+
}), await t.executeCommand(Q.id, { values: s });
|
|
526
526
|
}
|
|
527
527
|
}, bt = {
|
|
528
528
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
529
|
-
type:
|
|
529
|
+
type: X.COMMAND,
|
|
530
530
|
handler: async (e) => {
|
|
531
|
-
const t = e.get(
|
|
531
|
+
const t = e.get(E), r = e.get(ee), n = e.get(A), s = e.get($), i = r.getSelections();
|
|
532
532
|
if (!i || !i.length)
|
|
533
533
|
return !1;
|
|
534
534
|
const a = s.getCurrentUniverSheetInstance(), o = a.getActiveSheet(), c = a.getUnitId(), d = o.getSheetId();
|
|
535
535
|
let l = 0;
|
|
536
|
-
i.forEach((
|
|
537
|
-
|
|
536
|
+
i.forEach((v) => {
|
|
537
|
+
R.foreach(v.range, (f, S) => {
|
|
538
538
|
const C = n.getValue(c, d, f, S);
|
|
539
539
|
if (!C)
|
|
540
540
|
return;
|
|
541
|
-
const
|
|
542
|
-
l =
|
|
541
|
+
const y = W(C.pattern);
|
|
542
|
+
l = y > l ? y : l;
|
|
543
543
|
});
|
|
544
544
|
});
|
|
545
|
-
const u = l - 1, m =
|
|
546
|
-
return i.forEach((
|
|
547
|
-
|
|
545
|
+
const u = l - 1, m = I(`0${u > 0 ? ".0" : "."}`, u), h = [];
|
|
546
|
+
return i.forEach((v) => {
|
|
547
|
+
R.foreach(v.range, (f, S) => {
|
|
548
548
|
const C = n.getValue(c, d, f, S);
|
|
549
|
-
if (!C
|
|
549
|
+
if (!C)
|
|
550
550
|
h.push({
|
|
551
551
|
row: f,
|
|
552
552
|
col: S,
|
|
553
553
|
pattern: m
|
|
554
554
|
});
|
|
555
555
|
else {
|
|
556
|
-
const
|
|
556
|
+
const y = W(C.pattern);
|
|
557
557
|
h.push({
|
|
558
558
|
row: f,
|
|
559
559
|
col: S,
|
|
560
|
-
pattern:
|
|
560
|
+
pattern: I(C.pattern, y - 1)
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
});
|
|
564
|
-
}), await t.executeCommand(
|
|
564
|
+
}), await t.executeCommand(Q.id, { values: h });
|
|
565
565
|
}
|
|
566
566
|
}, ke = {
|
|
567
567
|
id: "sheet.operation.close.numfmt.panel",
|
|
568
|
-
type:
|
|
568
|
+
type: X.OPERATION,
|
|
569
569
|
handler: () => (
|
|
570
570
|
// do nothing,just notify panel is closed
|
|
571
571
|
!0
|
|
572
572
|
)
|
|
573
|
-
}, et =
|
|
574
|
-
|
|
575
|
-
const
|
|
573
|
+
}, et = cn("INumfmtController");
|
|
574
|
+
Ht(U.Rendered, et);
|
|
575
|
+
const $e = {
|
|
576
576
|
id: "sheet.operation.open.numfmt.panel",
|
|
577
|
-
type:
|
|
577
|
+
type: X.OPERATION,
|
|
578
578
|
handler: (e) => (e.get(et).openPanel(), !0)
|
|
579
579
|
};
|
|
580
|
-
var
|
|
580
|
+
var yt = { exports: {} }, Ve = {};
|
|
581
581
|
/**
|
|
582
582
|
* @license React
|
|
583
583
|
* react-jsx-runtime.production.min.js
|
|
@@ -587,23 +587,23 @@ var Rt = { exports: {} }, Ve = {};
|
|
|
587
587
|
* This source code is licensed under the MIT license found in the
|
|
588
588
|
* LICENSE file in the root directory of this source tree.
|
|
589
589
|
*/
|
|
590
|
-
var
|
|
591
|
-
function
|
|
590
|
+
var Vn = yn, Hn = Symbol.for("react.element"), kn = Symbol.for("react.fragment"), Fn = Object.prototype.hasOwnProperty, Bn = Vn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, zn = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
591
|
+
function Rt(e, t, r) {
|
|
592
592
|
var n, s = {}, i = null, a = null;
|
|
593
593
|
r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (a = t.ref);
|
|
594
594
|
for (n in t)
|
|
595
|
-
|
|
595
|
+
Fn.call(t, n) && !zn.hasOwnProperty(n) && (s[n] = t[n]);
|
|
596
596
|
if (e && e.defaultProps)
|
|
597
597
|
for (n in t = e.defaultProps, t)
|
|
598
598
|
s[n] === void 0 && (s[n] = t[n]);
|
|
599
|
-
return { $$typeof:
|
|
599
|
+
return { $$typeof: Hn, type: e, key: i, ref: a, props: s, _owner: Bn.current };
|
|
600
600
|
}
|
|
601
|
-
Ve.Fragment =
|
|
602
|
-
Ve.jsx =
|
|
603
|
-
Ve.jsxs =
|
|
604
|
-
|
|
605
|
-
var
|
|
606
|
-
const tt =
|
|
601
|
+
Ve.Fragment = kn;
|
|
602
|
+
Ve.jsx = Rt;
|
|
603
|
+
Ve.jsxs = Rt;
|
|
604
|
+
yt.exports = Ve;
|
|
605
|
+
var p = yt.exports;
|
|
606
|
+
const tt = Rn([]), We = [
|
|
607
607
|
"$",
|
|
608
608
|
"£",
|
|
609
609
|
"¥",
|
|
@@ -632,12 +632,12 @@ const tt = bn([]), ze = [
|
|
|
632
632
|
"₾",
|
|
633
633
|
"₿"
|
|
634
634
|
];
|
|
635
|
-
var
|
|
636
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
635
|
+
var Wn = Object.defineProperty, Kn = Object.getOwnPropertyDescriptor, Gn = (e, t, r, n) => {
|
|
636
|
+
for (var s = n > 1 ? void 0 : n ? Kn(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
637
637
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
638
|
-
return n && s &&
|
|
639
|
-
},
|
|
640
|
-
let
|
|
638
|
+
return n && s && Wn(t, r, s), s;
|
|
639
|
+
}, Yn = (e, t) => (r, n) => t(r, n, e);
|
|
640
|
+
let Ue = class {
|
|
641
641
|
constructor(e) {
|
|
642
642
|
this._localStorageService = e;
|
|
643
643
|
}
|
|
@@ -681,21 +681,21 @@ let Ne = class {
|
|
|
681
681
|
this._localStorageService.removeItem(e);
|
|
682
682
|
}
|
|
683
683
|
};
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
],
|
|
687
|
-
const ot = "numfmtCurrency",
|
|
688
|
-
const t = N(
|
|
684
|
+
Ue = Gn([
|
|
685
|
+
Yn(0, g(kt))
|
|
686
|
+
], Ue);
|
|
687
|
+
const ot = "numfmtCurrency", qn = (e) => {
|
|
688
|
+
const t = N(Ue), [r, n] = x(We);
|
|
689
689
|
return Ye(() => {
|
|
690
690
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
691
|
-
t.getHabit(ot, [...
|
|
691
|
+
t.getHabit(ot, [...We]).then((i) => {
|
|
692
692
|
n(i), e && e(i);
|
|
693
693
|
});
|
|
694
694
|
});
|
|
695
695
|
}, []), { userHabitCurrency: r, mark: (i) => {
|
|
696
696
|
t.markHabit(ot, i);
|
|
697
697
|
} };
|
|
698
|
-
},
|
|
698
|
+
}, Zn = () => {
|
|
699
699
|
const e = qe([]), [t, r] = x({});
|
|
700
700
|
return Ye(() => {
|
|
701
701
|
e.current.forEach((s) => {
|
|
@@ -704,68 +704,68 @@ const ot = "numfmtCurrency", Kn = (e) => {
|
|
|
704
704
|
}, [t]), (s) => {
|
|
705
705
|
e.current.push(s), r({});
|
|
706
706
|
};
|
|
707
|
-
},
|
|
708
|
-
const [t, r] = x(() =>
|
|
709
|
-
e.action.current = () =>
|
|
707
|
+
}, Se = (e) => We.find((r) => e.includes(r)), Jn = (e) => !!Se(e) && e.startsWith("_("), Qn = (e) => {
|
|
708
|
+
const [t, r] = x(() => W(e.defaultPattern || "", 2)), n = vt(tt), [s, i] = x(() => Se(e.defaultPattern) || n[0]), a = V(() => n.map((u) => ({ label: u, value: u })), []), c = N(T).t;
|
|
709
|
+
e.action.current = () => I(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
|
|
710
710
|
const d = (u) => {
|
|
711
|
-
i(u), e.onChange(
|
|
711
|
+
i(u), e.onChange(I(`_("${u}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
|
|
712
712
|
}, l = (u) => {
|
|
713
713
|
const m = u || 0;
|
|
714
|
-
r(m), e.onChange(
|
|
714
|
+
r(m), e.onChange(I(`_("${s}"* #,##0${m > 0 ? ".0" : ""}_)`, m));
|
|
715
715
|
};
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
717
|
+
/* @__PURE__ */ p.jsxs("div", { className: "m-t-16 options ", children: [
|
|
718
|
+
/* @__PURE__ */ p.jsxs("div", { className: "option", children: [
|
|
719
|
+
/* @__PURE__ */ p.jsx("div", { className: "label", children: c("sheet.numfmt.decimalLength") }),
|
|
720
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ p.jsx(Ze, { value: t, max: 20, min: 0, onChange: l }) })
|
|
721
721
|
] }),
|
|
722
|
-
/* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ p.jsxs("div", { className: "option", children: [
|
|
723
|
+
/* @__PURE__ */ p.jsx("div", { className: "label", children: c("sheet.numfmt.currencyType") }),
|
|
724
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ p.jsx(Je, { onChange: d, options: a, value: s }) })
|
|
725
725
|
] })
|
|
726
726
|
] }),
|
|
727
|
-
/* @__PURE__ */
|
|
727
|
+
/* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: c("sheet.numfmt.accountingDes") })
|
|
728
728
|
] });
|
|
729
729
|
}, Fe = (e) => St.map((t) => ({
|
|
730
730
|
label: t.label(e),
|
|
731
731
|
value: t.suffix(e),
|
|
732
732
|
color: t.color
|
|
733
|
-
})), It = () =>
|
|
734
|
-
const r = N(
|
|
733
|
+
})), It = () => An.map((e) => ({ label: e.label, value: e.suffix })), Mt = () => Ln.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), Xn = (e) => !!Se(e) && !e.startsWith("_("), er = (e) => {
|
|
734
|
+
const r = N(T).t, n = vt(tt), [s, i] = x(() => Se(e.defaultPattern) || n[0]), [a, o] = x(() => W(e.defaultPattern || "", 2)), [c, d] = x(() => {
|
|
735
735
|
var S;
|
|
736
|
-
const
|
|
737
|
-
return ((S =
|
|
738
|
-
}), l =
|
|
739
|
-
e.action.current = () =>
|
|
740
|
-
const m = (
|
|
741
|
-
i(
|
|
742
|
-
const f = Fe(
|
|
743
|
-
d(f), e.onChange(
|
|
744
|
-
}, h = (
|
|
745
|
-
d(
|
|
746
|
-
}, _ = (
|
|
747
|
-
o(
|
|
736
|
+
const v = Fe(s);
|
|
737
|
+
return ((S = v.find((C) => Le(C.value, e.defaultPattern))) == null ? void 0 : S.value) || v[0].value;
|
|
738
|
+
}), l = V(() => Fe(s), [s]), u = V(() => n.map((v) => ({ label: v, value: v })), [n]);
|
|
739
|
+
e.action.current = () => I(c, a);
|
|
740
|
+
const m = (v) => {
|
|
741
|
+
i(v);
|
|
742
|
+
const f = Fe(v)[0].value;
|
|
743
|
+
d(f), e.onChange(I(f, a));
|
|
744
|
+
}, h = (v) => {
|
|
745
|
+
d(v), e.onChange(I(v, a));
|
|
746
|
+
}, _ = (v) => {
|
|
747
|
+
o(v || 0), e.onChange(I(c, v || 0));
|
|
748
748
|
};
|
|
749
|
-
return /* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
750
|
+
/* @__PURE__ */ p.jsxs("div", { className: "m-t-16 options ", children: [
|
|
751
|
+
/* @__PURE__ */ p.jsxs("div", { className: "option", children: [
|
|
752
|
+
/* @__PURE__ */ p.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
|
|
753
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ p.jsx(Ze, { value: a, max: 20, min: 0, onChange: _ }) })
|
|
754
754
|
] }),
|
|
755
|
-
/* @__PURE__ */
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ p.jsxs("div", { className: "option", children: [
|
|
756
|
+
/* @__PURE__ */ p.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
|
|
757
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ p.jsx(Je, { onChange: m, options: u, value: s }) })
|
|
758
758
|
] })
|
|
759
759
|
] }),
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
/* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
|
|
761
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Qe, { onChange: h, options: l, value: c }) }),
|
|
762
|
+
/* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
|
|
763
763
|
] });
|
|
764
|
-
},
|
|
765
|
-
const t =
|
|
764
|
+
}, tr = (e) => {
|
|
765
|
+
const t = D.getInfo(e);
|
|
766
766
|
return It().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
767
|
-
},
|
|
768
|
-
const t =
|
|
767
|
+
}, nr = (e) => {
|
|
768
|
+
const t = V(It, []), n = N(T).t, [s, i] = x(() => {
|
|
769
769
|
if (e.defaultPattern) {
|
|
770
770
|
const o = t.find((c) => c.value === e.defaultPattern);
|
|
771
771
|
if (o)
|
|
@@ -777,26 +777,26 @@ const ot = "numfmtCurrency", Kn = (e) => {
|
|
|
777
777
|
const a = (o) => {
|
|
778
778
|
i(o), e.onChange(o);
|
|
779
779
|
};
|
|
780
|
-
return /* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
781
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
|
|
782
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Qe, { value: s, options: t, onChange: a }) }),
|
|
783
|
+
/* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
|
|
784
784
|
] });
|
|
785
|
-
},
|
|
786
|
-
const r = N(
|
|
787
|
-
return e.action.current = () => "", /* @__PURE__ */
|
|
788
|
-
},
|
|
789
|
-
const t = N(
|
|
790
|
-
const u = r.find((m) =>
|
|
785
|
+
}, rr = (e) => !e, sr = (e) => {
|
|
786
|
+
const r = N(T).t;
|
|
787
|
+
return e.action.current = () => "", /* @__PURE__ */ p.jsx("div", { children: /* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
|
|
788
|
+
}, ir = (e) => Mt().some((t) => Le(t.value, e)), ar = (e) => {
|
|
789
|
+
const t = N(T), r = V(Mt, []), [n, s] = x(() => W(e.defaultPattern || "", 0)), [i, a] = x(() => {
|
|
790
|
+
const u = r.find((m) => Le(m.value, e.defaultPattern || ""));
|
|
791
791
|
return (u == null ? void 0 : u.value) || r[0].value;
|
|
792
|
-
}), o =
|
|
793
|
-
s(u || 0), e.onChange(
|
|
792
|
+
}), o = V(() => I(i, Number(n || 0)), [i, n]), c = V(() => !Un(i), [i]), d = (u) => {
|
|
793
|
+
s(u || 0), e.onChange(I(i, Number(u || 0)));
|
|
794
794
|
}, l = (u) => {
|
|
795
|
-
s(
|
|
795
|
+
s(W(u, 0)), a(u), e.onChange(u);
|
|
796
796
|
};
|
|
797
|
-
return e.action.current = () => o, /* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
797
|
+
return e.action.current = () => o, /* @__PURE__ */ p.jsxs("div", { children: [
|
|
798
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
|
|
799
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(
|
|
800
800
|
Ze,
|
|
801
801
|
{
|
|
802
802
|
disabled: c,
|
|
@@ -806,68 +806,82 @@ const ot = "numfmtCurrency", Kn = (e) => {
|
|
|
806
806
|
onChange: d
|
|
807
807
|
}
|
|
808
808
|
) }),
|
|
809
|
-
/* @__PURE__ */
|
|
809
|
+
/* @__PURE__ */ p.jsxs("div", { className: "m-t-16 label", children: [
|
|
810
810
|
" ",
|
|
811
811
|
t.t("sheet.numfmt.negType")
|
|
812
812
|
] }),
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
/* @__PURE__ */
|
|
813
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Qe, { onChange: l, options: r, value: i }) }),
|
|
814
|
+
/* @__PURE__ */ p.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
|
|
815
815
|
] });
|
|
816
|
-
},
|
|
817
|
-
const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(
|
|
816
|
+
}, or = (e) => {
|
|
817
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(T), a = qe(() => ""), o = i.t, c = Zn(), d = V(
|
|
818
818
|
() => [
|
|
819
|
-
{ label: "sheet.numfmt.general", component:
|
|
820
|
-
{ label: "sheet.numfmt.accounting", component:
|
|
821
|
-
{ label: "sheet.numfmt.currency", component:
|
|
822
|
-
{ label: "sheet.numfmt.date", component:
|
|
823
|
-
{ label: "sheet.numfmt.thousandthPercentile", component:
|
|
819
|
+
{ label: "sheet.numfmt.general", component: sr },
|
|
820
|
+
{ label: "sheet.numfmt.accounting", component: Qn },
|
|
821
|
+
{ label: "sheet.numfmt.currency", component: er },
|
|
822
|
+
{ label: "sheet.numfmt.date", component: nr },
|
|
823
|
+
{ label: "sheet.numfmt.thousandthPercentile", component: ar }
|
|
824
824
|
].map((b) => ({ ...b, label: o(b.label) })),
|
|
825
825
|
[]
|
|
826
|
-
), [l, u] = x(S), [m, h] = x(() => `${n}_${s}`), { mark: _, userHabitCurrency:
|
|
826
|
+
), [l, u] = x(S), [m, h] = x(() => `${n}_${s}`), { mark: _, userHabitCurrency: v } = qn(() => h(`${n}_${s}_userCurrency'`)), f = V(() => {
|
|
827
827
|
var b;
|
|
828
|
-
return (b = d.find((
|
|
828
|
+
return (b = d.find((ne) => ne.label === l)) == null ? void 0 : b.component;
|
|
829
829
|
}, [l]);
|
|
830
830
|
function S() {
|
|
831
|
-
return [
|
|
831
|
+
return [rr, Jn, Xn, tr, ir].reduce((ne, Dt, Et) => ne || (Dt(r) ? d[Et].label : ""), "") || d[0].label;
|
|
832
832
|
}
|
|
833
833
|
const C = d.map((b) => ({
|
|
834
834
|
label: b.label,
|
|
835
835
|
value: b.label
|
|
836
|
-
})),
|
|
836
|
+
})), y = (b) => {
|
|
837
837
|
u(b), c(() => e.onChange({ type: "change", value: a.current() || "" }));
|
|
838
|
-
},
|
|
838
|
+
}, L = (b) => {
|
|
839
839
|
e.onChange({ type: "change", value: b });
|
|
840
840
|
}, G = () => {
|
|
841
|
-
const b = a.current() || "",
|
|
842
|
-
|
|
841
|
+
const b = a.current() || "", ne = Se(b);
|
|
842
|
+
ne && _(ne), e.onChange({ type: "confirm", value: b });
|
|
843
843
|
}, F = () => {
|
|
844
844
|
e.onChange({ type: "cancel", value: "" });
|
|
845
845
|
}, B = {
|
|
846
|
-
onChange:
|
|
846
|
+
onChange: L,
|
|
847
847
|
defaultValue: t,
|
|
848
848
|
defaultPattern: r,
|
|
849
849
|
action: a
|
|
850
850
|
};
|
|
851
851
|
return Ye(() => {
|
|
852
852
|
u(S()), h(`${n}_${s}`);
|
|
853
|
-
}, [n, s]), /* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
-
/* @__PURE__ */
|
|
856
|
-
/* @__PURE__ */
|
|
857
|
-
/* @__PURE__ */
|
|
853
|
+
}, [n, s]), /* @__PURE__ */ p.jsxs("div", { className: "numfmt-panel p-b-20", children: [
|
|
854
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
855
|
+
/* @__PURE__ */ p.jsx("div", { className: "label m-t-14", children: o("sheet.numfmt.numfmtType") }),
|
|
856
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ p.jsx(Je, { onChange: y, options: C, value: l }) }),
|
|
857
|
+
/* @__PURE__ */ p.jsx("div", { children: f && /* @__PURE__ */ p.jsx(tt.Provider, { value: v, children: /* @__PURE__ */ te(f, { ...B, key: m }) }) })
|
|
858
858
|
] }),
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
/* @__PURE__ */
|
|
859
|
+
/* @__PURE__ */ p.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
860
|
+
/* @__PURE__ */ p.jsx(it, { size: "small", onClick: F, className: "m-r-12", children: o("sheet.numfmt.cancel") }),
|
|
861
|
+
/* @__PURE__ */ p.jsx(it, { type: "primary", size: "small", onClick: G, children: o("sheet.numfmt.confirm") })
|
|
862
862
|
] })
|
|
863
863
|
] });
|
|
864
|
+
}, Ot = {
|
|
865
|
+
id: "sheet.command.numfmt.set.percent",
|
|
866
|
+
type: X.COMMAND,
|
|
867
|
+
handler: async (e) => {
|
|
868
|
+
const t = e.get(E), n = e.get(ee).getSelections();
|
|
869
|
+
if (!n || !n.length)
|
|
870
|
+
return !1;
|
|
871
|
+
const s = [], i = "0%";
|
|
872
|
+
return n.forEach((o) => {
|
|
873
|
+
R.foreach(o.range, (c, d) => {
|
|
874
|
+
s.push({ row: c, col: d, pattern: i, type: "percent" });
|
|
875
|
+
});
|
|
876
|
+
}), await t.executeCommand(Q.id, { values: s });
|
|
877
|
+
}
|
|
864
878
|
};
|
|
865
|
-
var
|
|
866
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
879
|
+
var cr = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, ur = (e, t, r, n) => {
|
|
880
|
+
for (var s = n > 1 ? void 0 : n ? lr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
867
881
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
868
|
-
return n && s &&
|
|
882
|
+
return n && s && cr(t, r, s), s;
|
|
869
883
|
}, O = (e, t) => (r, n) => t(r, n, e);
|
|
870
|
-
let
|
|
884
|
+
let Me = class extends H {
|
|
871
885
|
constructor(t, r, n, s, i, a, o, c, d, l, u, m) {
|
|
872
886
|
super();
|
|
873
887
|
/**
|
|
@@ -889,23 +903,23 @@ let Ce = class extends H {
|
|
|
889
903
|
);
|
|
890
904
|
let h = "";
|
|
891
905
|
m && (h = m.pattern);
|
|
892
|
-
const _ = (u == null ? void 0 : u.t) ===
|
|
906
|
+
const _ = (u == null ? void 0 : u.t) === se.NUMBER ? u.v : 12345678, v = {
|
|
893
907
|
onChange: (f) => {
|
|
894
908
|
var S, C;
|
|
895
909
|
if (f.type === "change")
|
|
896
910
|
this._previewPattern = f.value, this._sheetSkeletonManagerService.reCalculate(), (C = (S = this._renderManagerService.getRenderById(d.getUnitId())) == null ? void 0 : S.mainComponent) == null || C.makeDirty();
|
|
897
911
|
else if (f.type === "confirm") {
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
912
|
+
const y = r.getSelectionRanges() || [], L = { values: [] }, G = Xe(f.value);
|
|
913
|
+
y.forEach((F) => {
|
|
914
|
+
R.foreach(F, (B, b) => {
|
|
915
|
+
L.values.push({
|
|
902
916
|
row: B,
|
|
903
917
|
col: b,
|
|
904
918
|
pattern: f.value,
|
|
905
919
|
type: G
|
|
906
920
|
});
|
|
907
921
|
});
|
|
908
|
-
}), n.executeCommand(
|
|
922
|
+
}), n.executeCommand(Q.id, L), t.close();
|
|
909
923
|
} else
|
|
910
924
|
f.type === "cancel" && t.close();
|
|
911
925
|
},
|
|
@@ -914,8 +928,8 @@ let Ce = class extends H {
|
|
|
914
928
|
t.open({
|
|
915
929
|
header: { title: a.t("sheet.numfmt.title") },
|
|
916
930
|
children: {
|
|
917
|
-
label:
|
|
918
|
-
...
|
|
931
|
+
label: ue,
|
|
932
|
+
...v
|
|
919
933
|
// need passthrough to react props.
|
|
920
934
|
},
|
|
921
935
|
onClose: () => {
|
|
@@ -931,15 +945,16 @@ let Ce = class extends H {
|
|
|
931
945
|
_t,
|
|
932
946
|
bt,
|
|
933
947
|
Ct,
|
|
934
|
-
|
|
948
|
+
Ot,
|
|
949
|
+
$e,
|
|
935
950
|
ke,
|
|
936
|
-
|
|
951
|
+
Q
|
|
937
952
|
].forEach((t) => {
|
|
938
953
|
this.disposeWithMe(this._commandService.registerCommand(t));
|
|
939
954
|
});
|
|
940
955
|
}
|
|
941
956
|
_initPanel() {
|
|
942
|
-
this._componentManager.register(
|
|
957
|
+
this._componentManager.register(ue, or);
|
|
943
958
|
}
|
|
944
959
|
_initInterceptorCommands() {
|
|
945
960
|
const t = this;
|
|
@@ -947,8 +962,8 @@ let Ce = class extends H {
|
|
|
947
962
|
this._sheetInterceptorService.interceptCommand({
|
|
948
963
|
getMutations(r) {
|
|
949
964
|
switch (r.id) {
|
|
950
|
-
case
|
|
951
|
-
case
|
|
965
|
+
case Wt.id:
|
|
966
|
+
case zt.id: {
|
|
952
967
|
const n = t._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(), s = t._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), i = t._selectionManagerService.getSelectionRanges();
|
|
953
968
|
if (!(i != null && i.length))
|
|
954
969
|
break;
|
|
@@ -958,7 +973,7 @@ let Ce = class extends H {
|
|
|
958
973
|
ranges: []
|
|
959
974
|
}, o = t._numfmtService.getModel(n, s);
|
|
960
975
|
i.forEach((d) => {
|
|
961
|
-
|
|
976
|
+
R.foreach(d, (l, u) => {
|
|
962
977
|
o != null && o.getValue(l, u) && a.ranges.push({
|
|
963
978
|
startColumn: u,
|
|
964
979
|
endColumn: u,
|
|
@@ -966,10 +981,10 @@ let Ce = class extends H {
|
|
|
966
981
|
endRow: l
|
|
967
982
|
});
|
|
968
983
|
});
|
|
969
|
-
}), a.ranges =
|
|
984
|
+
}), a.ranges = z(a.ranges);
|
|
970
985
|
const c = J(t._injector, a);
|
|
971
986
|
return {
|
|
972
|
-
redos: [{ id:
|
|
987
|
+
redos: [{ id: M.id, params: a }],
|
|
973
988
|
undos: c
|
|
974
989
|
};
|
|
975
990
|
}
|
|
@@ -985,12 +1000,12 @@ let Ce = class extends H {
|
|
|
985
1000
|
_initRealTimeRenderingInterceptor() {
|
|
986
1001
|
const t = new q((n) => {
|
|
987
1002
|
this._commandService.onCommandExecuted((s) => {
|
|
988
|
-
s.id ===
|
|
1003
|
+
s.id === $e.id && n.next(!0), s.id === ke.id && n.next(!1);
|
|
989
1004
|
});
|
|
990
|
-
}), r =
|
|
1005
|
+
}), r = bn([
|
|
991
1006
|
t,
|
|
992
1007
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
993
|
-
|
|
1008
|
+
le((n) => n ? n.map((s) => s.range) : [])
|
|
994
1009
|
)
|
|
995
1010
|
]);
|
|
996
1011
|
this.disposeWithMe(
|
|
@@ -1004,7 +1019,7 @@ let Ce = class extends H {
|
|
|
1004
1019
|
};
|
|
1005
1020
|
})
|
|
1006
1021
|
),
|
|
1007
|
-
|
|
1022
|
+
fn(() => {
|
|
1008
1023
|
this._previewPattern = null;
|
|
1009
1024
|
})
|
|
1010
1025
|
).subscribe(({ disposableCollection: n, selectionRanges: s }) => {
|
|
@@ -1018,8 +1033,8 @@ let Ce = class extends H {
|
|
|
1018
1033
|
if (s.find(
|
|
1019
1034
|
(h) => h.startColumn <= m && h.endColumn >= m && h.startRow <= u && h.endRow >= u
|
|
1020
1035
|
)) {
|
|
1021
|
-
const h = d.worksheet.getCellRaw(u, m), _ = h == null ? void 0 : h.v,
|
|
1022
|
-
if (_ == null ||
|
|
1036
|
+
const h = d.worksheet.getCellRaw(u, m), _ = h == null ? void 0 : h.v, v = h == null ? void 0 : h.t;
|
|
1037
|
+
if (_ == null || v !== se.NUMBER || this._previewPattern === null)
|
|
1023
1038
|
return l(c);
|
|
1024
1039
|
const f = gt(this._previewPattern, _);
|
|
1025
1040
|
if (f.color) {
|
|
@@ -1027,14 +1042,14 @@ let Ce = class extends H {
|
|
|
1027
1042
|
return {
|
|
1028
1043
|
...c,
|
|
1029
1044
|
v: f.result,
|
|
1030
|
-
t:
|
|
1045
|
+
t: se.STRING,
|
|
1031
1046
|
s: { cl: { rgb: C } }
|
|
1032
1047
|
};
|
|
1033
1048
|
}
|
|
1034
1049
|
return {
|
|
1035
1050
|
...c,
|
|
1036
1051
|
v: f.result,
|
|
1037
|
-
t:
|
|
1052
|
+
t: se.STRING
|
|
1038
1053
|
};
|
|
1039
1054
|
}
|
|
1040
1055
|
return l(c);
|
|
@@ -1046,7 +1061,7 @@ let Ce = class extends H {
|
|
|
1046
1061
|
);
|
|
1047
1062
|
}
|
|
1048
1063
|
_commandExecutedListener() {
|
|
1049
|
-
const t = [
|
|
1064
|
+
const t = [M.id, w.id];
|
|
1050
1065
|
this.disposeWithMe(
|
|
1051
1066
|
Z(
|
|
1052
1067
|
Ge(
|
|
@@ -1062,7 +1077,7 @@ let Ce = class extends H {
|
|
|
1062
1077
|
};
|
|
1063
1078
|
}),
|
|
1064
1079
|
this._numfmtService.modelReplace$
|
|
1065
|
-
).pipe(
|
|
1080
|
+
).pipe(pn(16)).subscribe((r) => {
|
|
1066
1081
|
var n, s;
|
|
1067
1082
|
this._sheetSkeletonManagerService.reCalculate(), (s = (n = this._renderManagerService.getRenderById(r)) == null ? void 0 : n.mainComponent) == null || s.makeDirty();
|
|
1068
1083
|
})
|
|
@@ -1070,27 +1085,27 @@ let Ce = class extends H {
|
|
|
1070
1085
|
);
|
|
1071
1086
|
}
|
|
1072
1087
|
};
|
|
1073
|
-
|
|
1074
|
-
k(
|
|
1075
|
-
O(0, g(
|
|
1088
|
+
Me = ur([
|
|
1089
|
+
k(U.Rendered, Me),
|
|
1090
|
+
O(0, g(Ae)),
|
|
1076
1091
|
O(1, g(ut)),
|
|
1077
1092
|
O(2, g(K)),
|
|
1078
1093
|
O(3, g($)),
|
|
1079
1094
|
O(4, g(Ke)),
|
|
1080
|
-
O(5, g(
|
|
1081
|
-
O(6, g(
|
|
1082
|
-
O(7, g(
|
|
1083
|
-
O(8, g(
|
|
1084
|
-
O(9, g(
|
|
1085
|
-
O(10, g(
|
|
1086
|
-
O(11, g(
|
|
1087
|
-
],
|
|
1088
|
-
var
|
|
1089
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1095
|
+
O(5, g(E)),
|
|
1096
|
+
O(6, g(ee)),
|
|
1097
|
+
O(7, g(gn)),
|
|
1098
|
+
O(8, g(A)),
|
|
1099
|
+
O(9, g(pt)),
|
|
1100
|
+
O(10, g(Sn)),
|
|
1101
|
+
O(11, g(T))
|
|
1102
|
+
], Me);
|
|
1103
|
+
var dr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, hr = (e, t, r, n) => {
|
|
1104
|
+
for (var s = n > 1 ? void 0 : n ? mr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
1090
1105
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
1091
|
-
return n && s &&
|
|
1092
|
-
},
|
|
1093
|
-
let
|
|
1106
|
+
return n && s && dr(t, r, s), s;
|
|
1107
|
+
}, be = (e, t) => (r, n) => t(r, n, e);
|
|
1108
|
+
let Oe = class extends H {
|
|
1094
1109
|
constructor(t, r, n, s) {
|
|
1095
1110
|
super();
|
|
1096
1111
|
Y(this, "_copyInfo");
|
|
@@ -1099,7 +1114,7 @@ let be = class extends H {
|
|
|
1099
1114
|
_initClipboardHook() {
|
|
1100
1115
|
this.disposeWithMe(
|
|
1101
1116
|
this._sheetClipboardService.addClipboardHook({
|
|
1102
|
-
id:
|
|
1117
|
+
id: ue,
|
|
1103
1118
|
onBeforeCopy: (t, r, n) => this._collectNumfmt(t, r, n),
|
|
1104
1119
|
onPasteCells: (t, r, n, s) => {
|
|
1105
1120
|
const { copyType: i = nt.COPY, pasteType: a } = s, { range: o } = t || {}, { range: c } = r;
|
|
@@ -1118,11 +1133,11 @@ let be = class extends H {
|
|
|
1118
1133
|
}
|
|
1119
1134
|
};
|
|
1120
1135
|
const i = this._numfmtService.getModel(t, r);
|
|
1121
|
-
i &&
|
|
1136
|
+
i && R.foreach(n, (a, o) => {
|
|
1122
1137
|
const c = this._numfmtService.getValue(t, r, a, o, i);
|
|
1123
1138
|
if (!c)
|
|
1124
1139
|
return;
|
|
1125
|
-
const d =
|
|
1140
|
+
const d = De.getRelativeRange(
|
|
1126
1141
|
{
|
|
1127
1142
|
startRow: a,
|
|
1128
1143
|
endRow: a,
|
|
@@ -1147,17 +1162,17 @@ let be = class extends H {
|
|
|
1147
1162
|
r.pasteType
|
|
1148
1163
|
))
|
|
1149
1164
|
return { redos: [], undos: [] };
|
|
1150
|
-
const o =
|
|
1151
|
-
|
|
1165
|
+
const o = dn(r.copyRange, t, !0), c = [], d = { unitId: i, subUnitId: a, ranges: [] }, l = this._numfmtService.getModel(i, a);
|
|
1166
|
+
R.foreach(t, (h, _) => {
|
|
1152
1167
|
this._numfmtService.getValue(i, a, h, _, l) && d.ranges.push({ startRow: h, startColumn: _, endRow: h, endColumn: _ });
|
|
1153
1168
|
}), o.forEach((h) => {
|
|
1154
|
-
this._copyInfo && this._copyInfo.matrix.forValue((_,
|
|
1155
|
-
const S =
|
|
1169
|
+
this._copyInfo && this._copyInfo.matrix.forValue((_, v, f) => {
|
|
1170
|
+
const S = De.getPositionRange(
|
|
1156
1171
|
{
|
|
1157
1172
|
startRow: _,
|
|
1158
1173
|
endRow: _,
|
|
1159
|
-
startColumn:
|
|
1160
|
-
endColumn:
|
|
1174
|
+
startColumn: v,
|
|
1175
|
+
endColumn: v
|
|
1161
1176
|
},
|
|
1162
1177
|
h.startRange
|
|
1163
1178
|
);
|
|
@@ -1169,37 +1184,37 @@ let be = class extends H {
|
|
|
1169
1184
|
});
|
|
1170
1185
|
});
|
|
1171
1186
|
});
|
|
1172
|
-
const u =
|
|
1187
|
+
const u = me(i, a, c);
|
|
1173
1188
|
Object.keys(u.values).forEach((h) => {
|
|
1174
1189
|
const _ = u.values[h];
|
|
1175
|
-
_.ranges =
|
|
1176
|
-
}), d.ranges =
|
|
1190
|
+
_.ranges = z(_.ranges);
|
|
1191
|
+
}), d.ranges = z(d.ranges);
|
|
1177
1192
|
const m = [
|
|
1178
|
-
...
|
|
1193
|
+
...he(this._injector, u),
|
|
1179
1194
|
...J(this._injector, d)
|
|
1180
1195
|
];
|
|
1181
1196
|
return {
|
|
1182
1197
|
redos: [
|
|
1183
|
-
{ id:
|
|
1198
|
+
{ id: M.id, params: d },
|
|
1184
1199
|
{ id: w.id, params: u }
|
|
1185
1200
|
],
|
|
1186
|
-
undos:
|
|
1201
|
+
undos: Ee(m)
|
|
1187
1202
|
};
|
|
1188
1203
|
}
|
|
1189
1204
|
};
|
|
1190
|
-
|
|
1191
|
-
k(
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
],
|
|
1197
|
-
var
|
|
1198
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1205
|
+
Oe = hr([
|
|
1206
|
+
k(U.Rendered, Oe),
|
|
1207
|
+
be(0, g(mn)),
|
|
1208
|
+
be(1, g(K)),
|
|
1209
|
+
be(2, g(A)),
|
|
1210
|
+
be(3, g($))
|
|
1211
|
+
], Oe);
|
|
1212
|
+
var fr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, vr = (e, t, r, n) => {
|
|
1213
|
+
for (var s = n > 1 ? void 0 : n ? pr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
1199
1214
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
1200
|
-
return n && s &&
|
|
1201
|
-
},
|
|
1202
|
-
const
|
|
1215
|
+
return n && s && fr(t, r, s), s;
|
|
1216
|
+
}, ce = (e, t) => (r, n) => t(r, n, e);
|
|
1217
|
+
const gr = () => {
|
|
1203
1218
|
let e = [];
|
|
1204
1219
|
return {
|
|
1205
1220
|
add: (s, i, a, o, c) => e.push({ unitId: s, subUnitId: i, row: a, col: o, value: c }),
|
|
@@ -1209,11 +1224,11 @@ const fr = () => {
|
|
|
1209
1224
|
}
|
|
1210
1225
|
};
|
|
1211
1226
|
};
|
|
1212
|
-
let
|
|
1227
|
+
let Pe = class extends H {
|
|
1213
1228
|
constructor(t, r, n, s, i) {
|
|
1214
1229
|
super();
|
|
1215
1230
|
// collect effect mutations when edit end and push this to commands stack in next commands progress
|
|
1216
|
-
Y(this, "_collectEffectMutation",
|
|
1231
|
+
Y(this, "_collectEffectMutation", gr());
|
|
1217
1232
|
this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
|
|
1218
1233
|
}
|
|
1219
1234
|
_initInterceptorEditorStart() {
|
|
@@ -1279,7 +1294,7 @@ let Re = class extends H {
|
|
|
1279
1294
|
};
|
|
1280
1295
|
if (!(t != null && t.v))
|
|
1281
1296
|
return n(t);
|
|
1282
|
-
const a = String(t.v), o =
|
|
1297
|
+
const a = String(t.v), o = D.parseDate(a) || D.parseTime(a);
|
|
1283
1298
|
if (!!o) {
|
|
1284
1299
|
if (o && o.z) {
|
|
1285
1300
|
const d = Number(o.v);
|
|
@@ -1292,10 +1307,10 @@ let Re = class extends H {
|
|
|
1292
1307
|
type: "date",
|
|
1293
1308
|
pattern: o.z
|
|
1294
1309
|
}
|
|
1295
|
-
), { ...t, v: d, t:
|
|
1310
|
+
), { ...t, v: d, t: se.NUMBER };
|
|
1296
1311
|
}
|
|
1297
1312
|
} else
|
|
1298
|
-
(["date", "time", "datetime"].includes((s == null ? void 0 : s.type) || "") || !
|
|
1313
|
+
(["date", "time", "datetime"].includes((s == null ? void 0 : s.type) || "") || !_r(a)) && i();
|
|
1299
1314
|
return n(t);
|
|
1300
1315
|
}
|
|
1301
1316
|
}
|
|
@@ -1309,7 +1324,7 @@ let Re = class extends H {
|
|
|
1309
1324
|
this._sheetInterceptorService.interceptCommand({
|
|
1310
1325
|
getMutations(r) {
|
|
1311
1326
|
switch (r.id) {
|
|
1312
|
-
case
|
|
1327
|
+
case Kt.id: {
|
|
1313
1328
|
const n = t._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(), s = t._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), i = t._collectEffectMutation.getEffects();
|
|
1314
1329
|
if (!i.length)
|
|
1315
1330
|
return {
|
|
@@ -1336,13 +1351,13 @@ let Re = class extends H {
|
|
|
1336
1351
|
if (a) {
|
|
1337
1352
|
const l = {
|
|
1338
1353
|
id: w.id,
|
|
1339
|
-
params:
|
|
1354
|
+
params: me(n, s, a)
|
|
1340
1355
|
};
|
|
1341
|
-
c.push(l), d.push(...
|
|
1356
|
+
c.push(l), d.push(...he(t._injector, l.params));
|
|
1342
1357
|
}
|
|
1343
1358
|
if (o) {
|
|
1344
1359
|
const l = {
|
|
1345
|
-
id:
|
|
1360
|
+
id: M.id,
|
|
1346
1361
|
params: {
|
|
1347
1362
|
unitId: n,
|
|
1348
1363
|
subUnitId: s,
|
|
@@ -1366,35 +1381,35 @@ let Re = class extends H {
|
|
|
1366
1381
|
);
|
|
1367
1382
|
}
|
|
1368
1383
|
};
|
|
1369
|
-
|
|
1370
|
-
k(
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
],
|
|
1377
|
-
function
|
|
1384
|
+
Pe = vr([
|
|
1385
|
+
k(U.Rendered, Pe),
|
|
1386
|
+
ce(0, g(Ae)),
|
|
1387
|
+
ce(1, g(A)),
|
|
1388
|
+
ce(2, g($)),
|
|
1389
|
+
ce(3, g(K)),
|
|
1390
|
+
ce(4, g(hn))
|
|
1391
|
+
], Pe);
|
|
1392
|
+
function _r(e) {
|
|
1378
1393
|
return /^-?\d+(\.\d+)?$/.test(e);
|
|
1379
1394
|
}
|
|
1380
|
-
var
|
|
1381
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1395
|
+
var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, br = (e, t, r, n) => {
|
|
1396
|
+
for (var s = n > 1 ? void 0 : n ? Cr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
1382
1397
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
1383
|
-
return n && s &&
|
|
1384
|
-
},
|
|
1385
|
-
let
|
|
1398
|
+
return n && s && Sr(t, r, s), s;
|
|
1399
|
+
}, yr = (e, t) => (r, n) => t(r, n, e);
|
|
1400
|
+
let xe = class extends H {
|
|
1386
1401
|
constructor(t) {
|
|
1387
1402
|
super();
|
|
1388
1403
|
Y(this, "_initLocal", () => {
|
|
1389
|
-
this._localeService.load({ zhCN:
|
|
1404
|
+
this._localeService.load({ zhCN: wn, enUS: Pn });
|
|
1390
1405
|
});
|
|
1391
1406
|
this._localeService = t, this._initLocal();
|
|
1392
1407
|
}
|
|
1393
1408
|
};
|
|
1394
|
-
|
|
1395
|
-
k(
|
|
1396
|
-
|
|
1397
|
-
],
|
|
1409
|
+
xe = br([
|
|
1410
|
+
k(U.Rendered, xe),
|
|
1411
|
+
yr(0, g(T))
|
|
1412
|
+
], xe);
|
|
1398
1413
|
var P = function() {
|
|
1399
1414
|
return P = Object.assign || function(e) {
|
|
1400
1415
|
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
@@ -1404,7 +1419,7 @@ var P = function() {
|
|
|
1404
1419
|
}
|
|
1405
1420
|
return e;
|
|
1406
1421
|
}, P.apply(this, arguments);
|
|
1407
|
-
},
|
|
1422
|
+
}, Rr = function(e, t) {
|
|
1408
1423
|
var r = {};
|
|
1409
1424
|
for (var n in e)
|
|
1410
1425
|
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
@@ -1412,16 +1427,16 @@ var P = function() {
|
|
|
1412
1427
|
for (var s = 0, n = Object.getOwnPropertySymbols(e); s < n.length; s++)
|
|
1413
1428
|
t.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[s]) && (r[n[s]] = e[n[s]]);
|
|
1414
1429
|
return r;
|
|
1415
|
-
},
|
|
1416
|
-
var r = e.icon, n = e.id, s = e.className, i = e.extend, a =
|
|
1417
|
-
return
|
|
1430
|
+
}, ae = ie(function(e, t) {
|
|
1431
|
+
var r = e.icon, n = e.id, s = e.className, i = e.extend, a = Rr(e, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(n, " ").concat(s || "").trim(), c = qe("_".concat(Or()));
|
|
1432
|
+
return Pt(r, "".concat(n), { defIds: r.defIds, idSuffix: c.current }, P({ ref: t, className: o }, a), i);
|
|
1418
1433
|
});
|
|
1419
|
-
function
|
|
1420
|
-
return
|
|
1421
|
-
return
|
|
1434
|
+
function Pt(e, t, r, n, s) {
|
|
1435
|
+
return te(e.tag, P(P({ key: t }, Ir(e, r, s)), n), (Mr(e, r).children || []).map(function(i, a) {
|
|
1436
|
+
return Pt(i, "".concat(t, "-").concat(e.tag, "-").concat(a), r, void 0, s);
|
|
1422
1437
|
}));
|
|
1423
1438
|
}
|
|
1424
|
-
function
|
|
1439
|
+
function Ir(e, t, r) {
|
|
1425
1440
|
var n = P({}, e.attrs);
|
|
1426
1441
|
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
|
|
1427
1442
|
var s = t.defIds;
|
|
@@ -1430,17 +1445,17 @@ function br(e, t, r) {
|
|
|
1430
1445
|
typeof o == "string" && (n[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
1431
1446
|
})), n;
|
|
1432
1447
|
}
|
|
1433
|
-
function
|
|
1448
|
+
function Mr(e, t) {
|
|
1434
1449
|
var r, n = t.defIds;
|
|
1435
1450
|
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? P(P({}, e), { children: e.children.map(function(s) {
|
|
1436
1451
|
return typeof s.attrs.id == "string" && n && n.indexOf(s.attrs.id) > -1 ? P(P({}, s), { attrs: P(P({}, s.attrs), { id: s.attrs.id + t.idSuffix }) }) : s;
|
|
1437
1452
|
}) }) : e;
|
|
1438
1453
|
}
|
|
1439
|
-
function
|
|
1454
|
+
function Or() {
|
|
1440
1455
|
return Math.random().toString(36).substring(2, 8);
|
|
1441
1456
|
}
|
|
1442
|
-
|
|
1443
|
-
var
|
|
1457
|
+
ae.displayName = "UniverIcon";
|
|
1458
|
+
var Pr = {
|
|
1444
1459
|
tag: "svg",
|
|
1445
1460
|
attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" },
|
|
1446
1461
|
children: [
|
|
@@ -1461,16 +1476,16 @@ var Ir = {
|
|
|
1461
1476
|
}
|
|
1462
1477
|
}
|
|
1463
1478
|
]
|
|
1464
|
-
},
|
|
1465
|
-
return
|
|
1479
|
+
}, xt = ie(function(e, t) {
|
|
1480
|
+
return te(ae, Object.assign({}, e, {
|
|
1466
1481
|
id: "add-digits-single",
|
|
1467
1482
|
ref: t,
|
|
1468
|
-
icon:
|
|
1483
|
+
icon: Pr
|
|
1469
1484
|
}));
|
|
1470
1485
|
});
|
|
1471
|
-
|
|
1472
|
-
const
|
|
1473
|
-
var
|
|
1486
|
+
xt.displayName = "AddDigitsSingle";
|
|
1487
|
+
const xr = xt;
|
|
1488
|
+
var wr = {
|
|
1474
1489
|
tag: "svg",
|
|
1475
1490
|
attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" },
|
|
1476
1491
|
children: [
|
|
@@ -1505,16 +1520,62 @@ var Or = {
|
|
|
1505
1520
|
]
|
|
1506
1521
|
}
|
|
1507
1522
|
]
|
|
1508
|
-
},
|
|
1509
|
-
return
|
|
1523
|
+
}, wt = ie(function(e, t) {
|
|
1524
|
+
return te(ae, Object.assign({}, e, {
|
|
1510
1525
|
id: "more-down-single",
|
|
1511
1526
|
ref: t,
|
|
1512
|
-
icon:
|
|
1527
|
+
icon: wr
|
|
1513
1528
|
}));
|
|
1514
1529
|
});
|
|
1515
|
-
|
|
1516
|
-
const
|
|
1517
|
-
var
|
|
1530
|
+
wt.displayName = "MoreDownSingle";
|
|
1531
|
+
const jr = wt;
|
|
1532
|
+
var Nr = {
|
|
1533
|
+
tag: "svg",
|
|
1534
|
+
attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" },
|
|
1535
|
+
children: [
|
|
1536
|
+
{
|
|
1537
|
+
tag: "mask",
|
|
1538
|
+
attrs: {
|
|
1539
|
+
id: "mask0_561_2",
|
|
1540
|
+
style: { maskType: "alpha" },
|
|
1541
|
+
width: 16,
|
|
1542
|
+
height: 16,
|
|
1543
|
+
x: 0,
|
|
1544
|
+
y: 0,
|
|
1545
|
+
maskUnits: "userSpaceOnUse"
|
|
1546
|
+
},
|
|
1547
|
+
children: [
|
|
1548
|
+
{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }
|
|
1549
|
+
]
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
tag: "g",
|
|
1553
|
+
attrs: {
|
|
1554
|
+
fill: "currentColor",
|
|
1555
|
+
mask: "url(#mask0_561_2)",
|
|
1556
|
+
fillRule: "evenodd",
|
|
1557
|
+
clipRule: "evenodd"
|
|
1558
|
+
},
|
|
1559
|
+
children: [
|
|
1560
|
+
{
|
|
1561
|
+
tag: "path",
|
|
1562
|
+
attrs: {
|
|
1563
|
+
d: "M4.91876 2.65039C3.66601 2.65039 2.65045 3.66595 2.65045 4.9187 2.65045 6.17146 3.66601 7.18702 4.91876 7.18702 6.17152 7.18702 7.18708 6.17146 7.18708 4.9187 7.18708 3.66595 6.17152 2.65039 4.91876 2.65039zM3.94663 4.9187C3.94663 4.38181 4.38187 3.94657 4.91876 3.94657 5.45566 3.94657 5.8909 4.38181 5.8909 4.9187 5.8909 5.4556 5.45566 5.89084 4.91876 5.89084 4.38187 5.89084 3.94663 5.4556 3.94663 4.9187zM11.0812 8.81299C9.82842 8.81299 8.81286 9.82855 8.81286 11.0813 8.81286 12.3341 9.82842 13.3496 11.0812 13.3496 12.3339 13.3496 13.3495 12.3341 13.3495 11.0813 13.3495 9.82855 12.3339 8.81299 11.0812 8.81299zM10.109 11.0813C10.109 10.5444 10.5443 10.1092 11.0812 10.1092 11.6181 10.1092 12.0533 10.5444 12.0533 11.0813 12.0533 11.6182 11.6181 12.0534 11.0812 12.0534 10.5443 12.0534 10.109 11.6182 10.109 11.0813zM13.1597 2.84021C13.4128 3.09331 13.4128 3.50365 13.1597 3.75675L3.7568 13.1596C3.5037 13.4127 3.09336 13.4127 2.84026 13.1596 2.58717 12.9065 2.58717 12.4962 2.84026 12.2431L12.2431 2.84021C12.4962 2.58712 12.9066 2.58712 13.1597 2.84021z"
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
]
|
|
1567
|
+
}
|
|
1568
|
+
]
|
|
1569
|
+
}, jt = ie(function(e, t) {
|
|
1570
|
+
return te(ae, Object.assign({}, e, {
|
|
1571
|
+
id: "percent-single",
|
|
1572
|
+
ref: t,
|
|
1573
|
+
icon: Nr
|
|
1574
|
+
}));
|
|
1575
|
+
});
|
|
1576
|
+
jt.displayName = "PercentSingle";
|
|
1577
|
+
const Tr = jt;
|
|
1578
|
+
var Dr = {
|
|
1518
1579
|
tag: "svg",
|
|
1519
1580
|
attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" },
|
|
1520
1581
|
children: [
|
|
@@ -1535,16 +1596,16 @@ var xr = {
|
|
|
1535
1596
|
}
|
|
1536
1597
|
}
|
|
1537
1598
|
]
|
|
1538
|
-
},
|
|
1539
|
-
return
|
|
1599
|
+
}, Nt = ie(function(e, t) {
|
|
1600
|
+
return te(ae, Object.assign({}, e, {
|
|
1540
1601
|
id: "reduce-digits-single",
|
|
1541
1602
|
ref: t,
|
|
1542
|
-
icon:
|
|
1603
|
+
icon: Dr
|
|
1543
1604
|
}));
|
|
1544
1605
|
});
|
|
1545
|
-
|
|
1546
|
-
const
|
|
1547
|
-
var
|
|
1606
|
+
Nt.displayName = "ReduceDigitsSingle";
|
|
1607
|
+
const Er = Nt;
|
|
1608
|
+
var $r = {
|
|
1548
1609
|
tag: "svg",
|
|
1549
1610
|
attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" },
|
|
1550
1611
|
children: [
|
|
@@ -1556,15 +1617,15 @@ var jr = {
|
|
|
1556
1617
|
}
|
|
1557
1618
|
}
|
|
1558
1619
|
]
|
|
1559
|
-
},
|
|
1560
|
-
return
|
|
1620
|
+
}, Tt = ie(function(e, t) {
|
|
1621
|
+
return te(ae, Object.assign({}, e, {
|
|
1561
1622
|
id: "rmb-single",
|
|
1562
1623
|
ref: t,
|
|
1563
|
-
icon:
|
|
1624
|
+
icon: $r
|
|
1564
1625
|
}));
|
|
1565
1626
|
});
|
|
1566
|
-
|
|
1567
|
-
const
|
|
1627
|
+
Tt.displayName = "RmbSingle";
|
|
1628
|
+
const Ur = Tt, we = [
|
|
1568
1629
|
{
|
|
1569
1630
|
label: "sheet.numfmt.general",
|
|
1570
1631
|
pattern: null
|
|
@@ -1617,30 +1678,30 @@ const Nr = jt, Ie = [
|
|
|
1617
1678
|
label: "sheet.numfmt.moreFmt",
|
|
1618
1679
|
pattern: ""
|
|
1619
1680
|
}
|
|
1620
|
-
],
|
|
1681
|
+
], Ar = (e) => {
|
|
1621
1682
|
var n;
|
|
1622
|
-
const t = N(
|
|
1623
|
-
return /* @__PURE__ */
|
|
1624
|
-
},
|
|
1625
|
-
const e = N(
|
|
1683
|
+
const t = N(T), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
|
|
1684
|
+
return /* @__PURE__ */ p.jsx("span", { className: "more-numfmt-type", children: r });
|
|
1685
|
+
}, Lr = () => {
|
|
1686
|
+
const e = N(E), t = N(T), r = In(), n = N(ee), s = (o) => {
|
|
1626
1687
|
const c = n.getLast();
|
|
1627
1688
|
if (!c)
|
|
1628
1689
|
return;
|
|
1629
|
-
const d = r.get(
|
|
1630
|
-
|
|
1690
|
+
const d = r.get(_n), l = c.range, u = [];
|
|
1691
|
+
R.foreach(l, (m, h) => {
|
|
1631
1692
|
o ? u.push({ row: m, col: h, pattern: o, type: Xe(o) }) : u.push({ row: m, col: h });
|
|
1632
|
-
}), e.executeCommand(
|
|
1693
|
+
}), e.executeCommand(Q.id, { values: u }), d.focus();
|
|
1633
1694
|
}, i = (o) => {
|
|
1634
1695
|
if (o === 0)
|
|
1635
1696
|
s(null);
|
|
1636
|
-
else if (o ===
|
|
1637
|
-
e.executeCommand(
|
|
1697
|
+
else if (o === we.length - 1)
|
|
1698
|
+
e.executeCommand($e.id);
|
|
1638
1699
|
else {
|
|
1639
|
-
const c =
|
|
1700
|
+
const c = we[o];
|
|
1640
1701
|
c.pattern && s(c.pattern);
|
|
1641
1702
|
}
|
|
1642
1703
|
}, a = 1220;
|
|
1643
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ p.jsx("div", { className: "more-numfmt-type-options", children: we.map((o, c) => o === "|" ? /* @__PURE__ */ p.jsx("div", { className: "line m-t-4", onClick: (d) => d.stopPropagation() }, c) : /* @__PURE__ */ p.jsxs(
|
|
1644
1705
|
"div",
|
|
1645
1706
|
{
|
|
1646
1707
|
className: "option-item m-t-4",
|
|
@@ -1648,71 +1709,84 @@ const Nr = jt, Ie = [
|
|
|
1648
1709
|
i(c);
|
|
1649
1710
|
},
|
|
1650
1711
|
children: [
|
|
1651
|
-
/* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ p.jsx("div", { children: t.t(o.label) }),
|
|
1713
|
+
/* @__PURE__ */ p.jsx("div", { className: "m-l-26", children: o.pattern ? D.format(o.pattern || "", a, { locale: "zh-CN" }) : "" })
|
|
1653
1714
|
]
|
|
1654
1715
|
},
|
|
1655
1716
|
c
|
|
1656
1717
|
)) });
|
|
1657
|
-
},
|
|
1718
|
+
}, Vr = (e) => {
|
|
1658
1719
|
const t = "icon-rmbSingle";
|
|
1659
|
-
return e.register(t,
|
|
1720
|
+
return e.register(t, Ur), e.register("MoreDownSingle", jr), (r) => ({
|
|
1660
1721
|
icon: t,
|
|
1661
1722
|
id: Ct.id,
|
|
1662
1723
|
title: "sheet.numfmt.currency",
|
|
1663
1724
|
tooltip: "sheet.numfmt.currency",
|
|
1664
|
-
type:
|
|
1665
|
-
group:
|
|
1666
|
-
positions: [
|
|
1667
|
-
hidden$:
|
|
1668
|
-
disabled$:
|
|
1725
|
+
type: pe.BUTTON,
|
|
1726
|
+
group: ve.TOOLBAR_FORMULAS_INSERT,
|
|
1727
|
+
positions: [ge.TOOLBAR_START],
|
|
1728
|
+
hidden$: _e(r, de.SHEET),
|
|
1729
|
+
disabled$: fe(r)
|
|
1669
1730
|
});
|
|
1670
|
-
},
|
|
1731
|
+
}, Hr = (e) => {
|
|
1671
1732
|
const t = "icon-addDigitsSingle";
|
|
1672
|
-
return e.register(t,
|
|
1733
|
+
return e.register(t, xr), (r) => ({
|
|
1673
1734
|
icon: t,
|
|
1674
1735
|
id: _t.id,
|
|
1675
1736
|
title: "sheet.numfmt.addDecimal",
|
|
1676
1737
|
tooltip: "sheet.numfmt.addDecimal",
|
|
1677
|
-
type:
|
|
1678
|
-
positions: [
|
|
1679
|
-
group:
|
|
1680
|
-
hidden$:
|
|
1681
|
-
disabled$:
|
|
1738
|
+
type: pe.BUTTON,
|
|
1739
|
+
positions: [ge.TOOLBAR_START],
|
|
1740
|
+
group: ve.TOOLBAR_FORMULAS_INSERT,
|
|
1741
|
+
hidden$: _e(r, de.SHEET),
|
|
1742
|
+
disabled$: fe(r)
|
|
1682
1743
|
});
|
|
1683
|
-
},
|
|
1744
|
+
}, kr = (e) => {
|
|
1684
1745
|
const t = "icon-reduceDigitsSingle";
|
|
1685
|
-
return e.register(t,
|
|
1746
|
+
return e.register(t, Er), (r) => ({
|
|
1686
1747
|
icon: t,
|
|
1687
1748
|
id: bt.id,
|
|
1688
1749
|
title: "sheet.numfmt.subtractDecimal",
|
|
1689
1750
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
1690
|
-
type:
|
|
1691
|
-
group:
|
|
1692
|
-
positions: [
|
|
1693
|
-
hidden$:
|
|
1694
|
-
disabled$:
|
|
1751
|
+
type: pe.BUTTON,
|
|
1752
|
+
group: ve.TOOLBAR_FORMULAS_INSERT,
|
|
1753
|
+
positions: [ge.TOOLBAR_START],
|
|
1754
|
+
hidden$: _e(r, de.SHEET),
|
|
1755
|
+
disabled$: fe(r)
|
|
1756
|
+
});
|
|
1757
|
+
}, Fr = (e) => {
|
|
1758
|
+
const t = "icon-PercentSingle";
|
|
1759
|
+
return e.register(t, Tr), (r) => ({
|
|
1760
|
+
icon: t,
|
|
1761
|
+
id: Ot.id,
|
|
1762
|
+
title: "sheet.numfmt.percent",
|
|
1763
|
+
tooltip: "sheet.numfmt.percent",
|
|
1764
|
+
type: pe.BUTTON,
|
|
1765
|
+
group: ve.TOOLBAR_FORMULAS_INSERT,
|
|
1766
|
+
positions: [ge.TOOLBAR_START],
|
|
1767
|
+
hidden$: _e(r, de.SHEET),
|
|
1768
|
+
disabled$: fe(r)
|
|
1695
1769
|
});
|
|
1696
|
-
},
|
|
1770
|
+
}, Br = (e) => {
|
|
1697
1771
|
const t = "sheet.numfmt.moreNumfmtType", r = "sheet.numfmt.moreNumfmtType.options";
|
|
1698
|
-
return e.register(t,
|
|
1699
|
-
const s = n.get(
|
|
1772
|
+
return e.register(t, Ar), e.register(r, Lr), (n) => {
|
|
1773
|
+
const s = n.get(A), i = n.get(Mn), a = n.get($), o = n.get(E), c = n.get(T), d = n.get(ee), l = new q(
|
|
1700
1774
|
(u) => Ge(
|
|
1701
1775
|
d.selectionMoveEnd$,
|
|
1702
1776
|
new q((m) => {
|
|
1703
|
-
const h = [
|
|
1704
|
-
h.includes(
|
|
1777
|
+
const h = [M.id, w.id], _ = o.onCommandExecuted((v) => {
|
|
1778
|
+
h.includes(v.id) && m.next(null);
|
|
1705
1779
|
});
|
|
1706
1780
|
return () => _.dispose();
|
|
1707
1781
|
})
|
|
1708
1782
|
).subscribe(() => {
|
|
1709
1783
|
const m = d.getSelections();
|
|
1710
1784
|
if (m && m[0]) {
|
|
1711
|
-
const h = a.getCurrentUniverSheetInstance(), _ = h.getActiveSheet(),
|
|
1785
|
+
const h = a.getCurrentUniverSheetInstance(), _ = h.getActiveSheet(), v = m[0].range, f = v.startRow, S = v.startColumn, C = s.getValue(h.getUnitId(), _.getSheetId(), f, S), y = i.getNumfmtValue(h.getUnitId(), _.getSheetId(), f, S), L = (C == null ? void 0 : C.pattern) || y;
|
|
1712
1786
|
let G = c.t("sheet.numfmt.general");
|
|
1713
|
-
if (
|
|
1714
|
-
const F =
|
|
1715
|
-
(B) =>
|
|
1787
|
+
if (L) {
|
|
1788
|
+
const F = we.filter((B) => typeof B == "object" && B.pattern).find(
|
|
1789
|
+
(B) => Le(L, B.pattern)
|
|
1716
1790
|
);
|
|
1717
1791
|
F && typeof F == "object" && F.pattern ? G = c.t(F.label) : G = c.t("sheet.numfmt.moreFmt");
|
|
1718
1792
|
}
|
|
@@ -1723,11 +1797,11 @@ const Nr = jt, Ie = [
|
|
|
1723
1797
|
return {
|
|
1724
1798
|
// icon: 'MoreDownSingle',
|
|
1725
1799
|
label: t,
|
|
1726
|
-
id:
|
|
1800
|
+
id: $e.id,
|
|
1727
1801
|
tooltip: "sheet.numfmt.title",
|
|
1728
|
-
type:
|
|
1729
|
-
group:
|
|
1730
|
-
positions: [
|
|
1802
|
+
type: pe.SELECTOR,
|
|
1803
|
+
group: ve.TOOLBAR_FORMULAS_INSERT,
|
|
1804
|
+
positions: [ge.TOOLBAR_START],
|
|
1731
1805
|
selections: [
|
|
1732
1806
|
{
|
|
1733
1807
|
label: {
|
|
@@ -1737,39 +1811,39 @@ const Nr = jt, Ie = [
|
|
|
1737
1811
|
}
|
|
1738
1812
|
],
|
|
1739
1813
|
value$: l,
|
|
1740
|
-
hidden$:
|
|
1741
|
-
disabled$:
|
|
1814
|
+
hidden$: _e(n, de.SHEET),
|
|
1815
|
+
disabled$: fe(n)
|
|
1742
1816
|
};
|
|
1743
1817
|
};
|
|
1744
1818
|
};
|
|
1745
|
-
var
|
|
1746
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1819
|
+
var zr = Object.defineProperty, Wr = Object.getOwnPropertyDescriptor, Kr = (e, t, r, n) => {
|
|
1820
|
+
for (var s = n > 1 ? void 0 : n ? Wr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
1747
1821
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
1748
|
-
return n && s &&
|
|
1822
|
+
return n && s && zr(t, r, s), s;
|
|
1749
1823
|
}, Be = (e, t) => (r, n) => t(r, n, e);
|
|
1750
|
-
let
|
|
1824
|
+
let je = class extends H {
|
|
1751
1825
|
constructor(e, t, r) {
|
|
1752
1826
|
super(), this._injector = e, this._componentManager = t, this._menuService = r, this._initMenu();
|
|
1753
1827
|
}
|
|
1754
1828
|
_initMenu() {
|
|
1755
|
-
[
|
|
1829
|
+
[Fr, Hr, kr, Vr, Br].map((e) => e(this._componentManager)).forEach((e) => {
|
|
1756
1830
|
this.disposeWithMe(this._menuService.addMenuItem(e(this._injector)));
|
|
1757
1831
|
});
|
|
1758
1832
|
}
|
|
1759
1833
|
};
|
|
1760
|
-
|
|
1761
|
-
k(
|
|
1834
|
+
je = Kr([
|
|
1835
|
+
k(U.Rendered, je),
|
|
1762
1836
|
Be(0, g(K)),
|
|
1763
|
-
Be(1, g(
|
|
1764
|
-
Be(2, g(
|
|
1765
|
-
],
|
|
1766
|
-
var
|
|
1767
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1837
|
+
Be(1, g(pt)),
|
|
1838
|
+
Be(2, g(Cn))
|
|
1839
|
+
], je);
|
|
1840
|
+
var Gr = Object.defineProperty, Yr = Object.getOwnPropertyDescriptor, qr = (e, t, r, n) => {
|
|
1841
|
+
for (var s = n > 1 ? void 0 : n ? Yr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
1768
1842
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
1769
|
-
return n && s &&
|
|
1770
|
-
},
|
|
1771
|
-
const
|
|
1772
|
-
let
|
|
1843
|
+
return n && s && Gr(t, r, s), s;
|
|
1844
|
+
}, re = (e, t) => (r, n) => t(r, n, e);
|
|
1845
|
+
const Zr = [w.id, M.id];
|
|
1846
|
+
let Ne = class extends H {
|
|
1773
1847
|
constructor(e, t, r, n, s, i) {
|
|
1774
1848
|
super(), this._numfmtService = e, this._univerInstanceService = t, this._injector = r, this._refRangeService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._registerRefRange(), this._mergeRefMutations();
|
|
1775
1849
|
}
|
|
@@ -1778,8 +1852,8 @@ let Oe = class extends H {
|
|
|
1778
1852
|
handler: (e, t, r) => {
|
|
1779
1853
|
if (!e)
|
|
1780
1854
|
return r(e);
|
|
1781
|
-
const n = e.filter((s) => !
|
|
1782
|
-
return n.push(...
|
|
1855
|
+
const n = e.filter((s) => !Zr.includes(s.id));
|
|
1856
|
+
return n.push(...Ee(e)), r(n);
|
|
1783
1857
|
}
|
|
1784
1858
|
});
|
|
1785
1859
|
}
|
|
@@ -1788,7 +1862,7 @@ let Oe = class extends H {
|
|
|
1788
1862
|
Z(
|
|
1789
1863
|
Ge(
|
|
1790
1864
|
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
1791
|
-
|
|
1865
|
+
le((e) => e == null ? void 0 : e.sheetId),
|
|
1792
1866
|
ht()
|
|
1793
1867
|
),
|
|
1794
1868
|
this._numfmtService.modelReplace$
|
|
@@ -1812,65 +1886,65 @@ let Oe = class extends H {
|
|
|
1812
1886
|
let u = [];
|
|
1813
1887
|
switch (o.id) {
|
|
1814
1888
|
case j.DeleteRangeMoveLeftCommandId: {
|
|
1815
|
-
u =
|
|
1889
|
+
u = sn(o, l);
|
|
1816
1890
|
break;
|
|
1817
1891
|
}
|
|
1818
1892
|
case j.DeleteRangeMoveUpCommandId: {
|
|
1819
|
-
u =
|
|
1893
|
+
u = rn(o, l);
|
|
1820
1894
|
break;
|
|
1821
1895
|
}
|
|
1822
1896
|
case j.InsertColCommandId: {
|
|
1823
|
-
u =
|
|
1897
|
+
u = nn(o, l);
|
|
1824
1898
|
break;
|
|
1825
1899
|
}
|
|
1826
1900
|
case j.InsertRangeMoveDownCommandId: {
|
|
1827
|
-
u =
|
|
1901
|
+
u = tn(o, l);
|
|
1828
1902
|
break;
|
|
1829
1903
|
}
|
|
1830
1904
|
case j.InsertRangeMoveRightCommandId: {
|
|
1831
|
-
u =
|
|
1905
|
+
u = en(o, l);
|
|
1832
1906
|
break;
|
|
1833
1907
|
}
|
|
1834
1908
|
case j.InsertRowCommandId: {
|
|
1835
|
-
u =
|
|
1909
|
+
u = Xt(o, l);
|
|
1836
1910
|
break;
|
|
1837
1911
|
}
|
|
1838
1912
|
case j.MoveRangeCommandId: {
|
|
1839
|
-
u =
|
|
1913
|
+
u = Qt(o, l);
|
|
1840
1914
|
break;
|
|
1841
1915
|
}
|
|
1842
1916
|
case j.RemoveColCommandId: {
|
|
1843
|
-
u =
|
|
1917
|
+
u = Jt(o, l);
|
|
1844
1918
|
break;
|
|
1845
1919
|
}
|
|
1846
1920
|
case j.RemoveRowCommandId: {
|
|
1847
|
-
u =
|
|
1921
|
+
u = Zt(o, l);
|
|
1848
1922
|
break;
|
|
1849
1923
|
}
|
|
1850
1924
|
case j.MoveColsCommandId: {
|
|
1851
|
-
u =
|
|
1925
|
+
u = qt(o, l);
|
|
1852
1926
|
break;
|
|
1853
1927
|
}
|
|
1854
1928
|
case j.MoveRowsCommandId:
|
|
1855
|
-
u =
|
|
1929
|
+
u = Yt(o, l);
|
|
1856
1930
|
}
|
|
1857
|
-
const m =
|
|
1931
|
+
const m = an(u, l), h = this._numfmtService.getValue(r, n, c, d);
|
|
1858
1932
|
if (!m && h) {
|
|
1859
1933
|
const _ = {
|
|
1860
|
-
id:
|
|
1934
|
+
id: M.id,
|
|
1861
1935
|
params: {
|
|
1862
1936
|
unitId: r,
|
|
1863
1937
|
subUnitId: n,
|
|
1864
1938
|
ranges: [{ startColumn: d, startRow: c, endColumn: d, endRow: c }]
|
|
1865
1939
|
}
|
|
1866
|
-
},
|
|
1940
|
+
}, v = J(this._injector, _.params);
|
|
1867
1941
|
return {
|
|
1868
1942
|
redos: [_],
|
|
1869
|
-
undos:
|
|
1943
|
+
undos: v
|
|
1870
1944
|
};
|
|
1871
1945
|
}
|
|
1872
1946
|
if (h && m) {
|
|
1873
|
-
const _ = [],
|
|
1947
|
+
const _ = [], v = [], f = [
|
|
1874
1948
|
{
|
|
1875
1949
|
pattern: h.pattern,
|
|
1876
1950
|
type: h.type,
|
|
@@ -1879,18 +1953,18 @@ let Oe = class extends H {
|
|
|
1879
1953
|
}
|
|
1880
1954
|
], S = {
|
|
1881
1955
|
id: w.id,
|
|
1882
|
-
params:
|
|
1883
|
-
}, C =
|
|
1884
|
-
id:
|
|
1956
|
+
params: me(r, n, f)
|
|
1957
|
+
}, C = he(this._injector, S.params), y = {
|
|
1958
|
+
id: M.id,
|
|
1885
1959
|
params: {
|
|
1886
1960
|
unitId: r,
|
|
1887
1961
|
subUnitId: n,
|
|
1888
1962
|
ranges: [{ startColumn: d, startRow: c, endColumn: d, endRow: c }]
|
|
1889
1963
|
}
|
|
1890
|
-
},
|
|
1891
|
-
return _.push(S,
|
|
1964
|
+
}, L = J(this._injector, y.params);
|
|
1965
|
+
return _.push(S, y), v.push(...C, ...L), {
|
|
1892
1966
|
redos: _,
|
|
1893
|
-
undos:
|
|
1967
|
+
undos: v.reverse()
|
|
1894
1968
|
};
|
|
1895
1969
|
}
|
|
1896
1970
|
return { redos: [], undos: [] };
|
|
@@ -1911,26 +1985,26 @@ let Oe = class extends H {
|
|
|
1911
1985
|
new q((o) => {
|
|
1912
1986
|
e.add(
|
|
1913
1987
|
this._commandService.onCommandExecuted((c) => {
|
|
1914
|
-
[w.id,
|
|
1988
|
+
[w.id, M.id].includes(c.id) && o.next(c.params);
|
|
1915
1989
|
})
|
|
1916
1990
|
);
|
|
1917
1991
|
}).pipe(
|
|
1918
1992
|
st(
|
|
1919
1993
|
(o) => o.unitId === r && o.subUnitId === n
|
|
1920
1994
|
),
|
|
1921
|
-
|
|
1995
|
+
le((o) => o.ranges ? o.ranges : o.values ? Object.keys(o.values).reduce((c, d) => {
|
|
1922
1996
|
const l = o.values[d];
|
|
1923
1997
|
return c.push(...l.ranges), c;
|
|
1924
1998
|
}, []) : []),
|
|
1925
|
-
|
|
1999
|
+
vn(300),
|
|
1926
2000
|
// updating the listener moves to the next queue
|
|
1927
|
-
|
|
2001
|
+
le(
|
|
1928
2002
|
(o) => o.reduce((c, d) => (c.push(...d), c), [])
|
|
1929
2003
|
),
|
|
1930
2004
|
st((o) => !!o.length)
|
|
1931
2005
|
).subscribe((o) => {
|
|
1932
2006
|
o.forEach((c) => {
|
|
1933
|
-
|
|
2007
|
+
R.foreach(c, (d, l) => {
|
|
1934
2008
|
const u = `${d}_${l}`, m = i.get(u);
|
|
1935
2009
|
if (i.delete(u), m && m.dispose(), this._numfmtService.getValue(r, n, d, l)) {
|
|
1936
2010
|
const _ = {
|
|
@@ -1938,11 +2012,11 @@ let Oe = class extends H {
|
|
|
1938
2012
|
startColumn: l,
|
|
1939
2013
|
endRow: d,
|
|
1940
2014
|
endColumn: l
|
|
1941
|
-
},
|
|
2015
|
+
}, v = this._refRangeService.registerRefRange(
|
|
1942
2016
|
_,
|
|
1943
2017
|
(f) => a(f, d, l)
|
|
1944
2018
|
);
|
|
1945
|
-
i.set(u,
|
|
2019
|
+
i.set(u, v), e.add(v);
|
|
1946
2020
|
}
|
|
1947
2021
|
});
|
|
1948
2022
|
});
|
|
@@ -1954,21 +2028,21 @@ let Oe = class extends H {
|
|
|
1954
2028
|
);
|
|
1955
2029
|
}
|
|
1956
2030
|
};
|
|
1957
|
-
|
|
1958
|
-
k(
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
],
|
|
1966
|
-
var
|
|
1967
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
2031
|
+
Ne = qr([
|
|
2032
|
+
k(U.Rendered, Ne),
|
|
2033
|
+
re(0, g(A)),
|
|
2034
|
+
re(1, g($)),
|
|
2035
|
+
re(2, g(K)),
|
|
2036
|
+
re(3, g(Gt)),
|
|
2037
|
+
re(4, g(Ke)),
|
|
2038
|
+
re(5, g(E))
|
|
2039
|
+
], Ne);
|
|
2040
|
+
var Jr = Object.defineProperty, Qr = Object.getOwnPropertyDescriptor, Xr = (e, t, r, n) => {
|
|
2041
|
+
for (var s = n > 1 ? void 0 : n ? Qr(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
1968
2042
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
1969
|
-
return n && s &&
|
|
1970
|
-
},
|
|
1971
|
-
let
|
|
2043
|
+
return n && s && Jr(t, r, s), s;
|
|
2044
|
+
}, ye = (e, t) => (r, n) => t(r, n, e);
|
|
2045
|
+
let Te = class extends H {
|
|
1972
2046
|
constructor(e, t, r, n) {
|
|
1973
2047
|
super(), this._numfmtService = e, this._sheetInterceptorService = t, this._univerInstanceService = r, this._injector = n, this._initSheetChange();
|
|
1974
2048
|
}
|
|
@@ -1976,8 +2050,8 @@ let Pe = class extends H {
|
|
|
1976
2050
|
this.disposeWithMe(
|
|
1977
2051
|
this._sheetInterceptorService.interceptCommand({
|
|
1978
2052
|
getMutations: (e) => {
|
|
1979
|
-
if (e.id ===
|
|
1980
|
-
const t = e.params, r = t.unitId ||
|
|
2053
|
+
if (e.id === on.id) {
|
|
2054
|
+
const t = e.params, r = t.unitId || es(this._univerInstanceService), n = t.subUnitId || ts(this._univerInstanceService), s = this._numfmtService.getModel(r, n);
|
|
1981
2055
|
if (!s)
|
|
1982
2056
|
return { redos: [], undos: [] };
|
|
1983
2057
|
const i = [];
|
|
@@ -1987,10 +2061,10 @@ let Pe = class extends H {
|
|
|
1987
2061
|
const a = {
|
|
1988
2062
|
unitId: r,
|
|
1989
2063
|
subUnitId: n,
|
|
1990
|
-
ranges:
|
|
2064
|
+
ranges: z(i)
|
|
1991
2065
|
}, o = J(this._injector, a);
|
|
1992
2066
|
return {
|
|
1993
|
-
redos: [{ id:
|
|
2067
|
+
redos: [{ id: M.id, params: a }],
|
|
1994
2068
|
undos: o
|
|
1995
2069
|
};
|
|
1996
2070
|
}
|
|
@@ -2000,34 +2074,34 @@ let Pe = class extends H {
|
|
|
2000
2074
|
);
|
|
2001
2075
|
}
|
|
2002
2076
|
};
|
|
2003
|
-
|
|
2004
|
-
k(
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
],
|
|
2010
|
-
const
|
|
2011
|
-
var
|
|
2012
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
2077
|
+
Te = Xr([
|
|
2078
|
+
k(U.Rendered, Te),
|
|
2079
|
+
ye(0, g(A)),
|
|
2080
|
+
ye(1, g(Ae)),
|
|
2081
|
+
ye(2, g($)),
|
|
2082
|
+
ye(3, g(K))
|
|
2083
|
+
], Te);
|
|
2084
|
+
const es = (e) => e.getCurrentUniverSheetInstance().getUnitId(), ts = (e) => e.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
|
|
2085
|
+
var ns = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, ss = (e, t, r, n) => {
|
|
2086
|
+
for (var s = n > 1 ? void 0 : n ? rs(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
2013
2087
|
(a = e[i]) && (s = (n ? a(t, r, s) : a(s)) || s);
|
|
2014
|
-
return n && s &&
|
|
2015
|
-
},
|
|
2016
|
-
let ct = (
|
|
2088
|
+
return n && s && ns(t, r, s), s;
|
|
2089
|
+
}, is = (e, t) => (r, n) => t(r, n, e), ze;
|
|
2090
|
+
let ct = (ze = class extends Ft {
|
|
2017
2091
|
constructor(e, t) {
|
|
2018
|
-
super(
|
|
2092
|
+
super(ue), this._injector = t;
|
|
2019
2093
|
}
|
|
2020
2094
|
onStarting() {
|
|
2021
|
-
this._injector.add([et, { useClass:
|
|
2095
|
+
this._injector.add([et, { useClass: Me, lazy: !1 }]), this._injector.add([Pe]), this._injector.add([Ue]), this._injector.add([Ne]), this._injector.add([Te]), this._injector.add([Oe]), this._injector.add([Re]), this._injector.add([Ie]), this._injector.add([xe]), this._injector.add([je]);
|
|
2022
2096
|
}
|
|
2023
|
-
}, Y(
|
|
2024
|
-
ct =
|
|
2025
|
-
|
|
2097
|
+
}, Y(ze, "type", Bt.Sheet), ze);
|
|
2098
|
+
ct = ss([
|
|
2099
|
+
is(1, g(K))
|
|
2026
2100
|
], ct);
|
|
2027
2101
|
export {
|
|
2028
|
-
|
|
2102
|
+
Q as SetNumfmtCommand,
|
|
2029
2103
|
ct as UniverSheetsNumfmtPlugin,
|
|
2030
|
-
|
|
2104
|
+
Pn as enUS,
|
|
2031
2105
|
gt as getPatternPreview,
|
|
2032
|
-
|
|
2106
|
+
wn as zhCN
|
|
2033
2107
|
};
|