@univerjs/sheets-numfmt 0.1.15 → 0.1.16
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 +2 -2
- package/lib/es/index.js +428 -426
- package/lib/umd/index.js +2 -2
- package/package.json +19 -19
package/lib/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var mt = Object.defineProperty;
|
|
2
|
-
var dt = (e, t,
|
|
3
|
-
var ie = (e, t,
|
|
2
|
+
var dt = (e, t, s) => t in e ? mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
+
var ie = (e, t, s) => dt(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
4
|
import { CommandType as w, ICommandService as O, IUniverInstanceService as D, IUndoRedoService as ft, sequenceExecute as ht, LocaleType as pt, Disposable as z, ObjectMatrix as vt, CellValueType as V, Range as R, UniverInstanceType as T, OnLifecycle as K, LifecycleStages as B, ThemeService as He, LocaleService as E, runOnLifecycle as _t, ILocalStorageService as gt, toDisposable as Ie, DisposableCollection as St, Plugin as bt, Tools as yt, DependentOn as Ct } from "@univerjs/core";
|
|
5
5
|
import { getSheetCommandTarget as Me, transformCellsToRange as Fe, rangeMerge as Le, SetNumfmtMutation as Y, factorySetNumfmtUndoMutation as We, RemoveNumfmtMutation as pe, factoryRemoveNumfmtUndoMutation as ke, INTERCEPTOR_POINT as Ge, SheetInterceptorService as Pe, INumfmtService as H, SelectionManagerService as U, SetRangeValuesCommand as Tt, WorkbookEditablePermission as q, WorksheetEditPermission as J, WorksheetSetCellStylePermission as Z, RangeProtectionPermissionEditPoint as Q, UniverSheetsPlugin as It } from "@univerjs/sheets";
|
|
6
6
|
import { Inject as S, createIdentifier as Et, Injector as Re } from "@wendellhu/redi";
|
|
@@ -19,47 +19,46 @@ const $ = {
|
|
|
19
19
|
handler: (e, t) => {
|
|
20
20
|
if (!t)
|
|
21
21
|
return !1;
|
|
22
|
-
const
|
|
23
|
-
if (!i)
|
|
24
|
-
|
|
25
|
-
const { unitId: o, subUnitId: a } = i, l = t.values.filter((f) => !!f.pattern), u = t.values.filter((f) => !f.pattern), m = Fe(o, a, l), c = {
|
|
22
|
+
const s = e.get(O), n = e.get(D), r = e.get(ft), i = Me(n, t);
|
|
23
|
+
if (!i) return !1;
|
|
24
|
+
const { unitId: o, subUnitId: c } = i, a = t.values.filter((h) => !!h.pattern), f = t.values.filter((h) => !h.pattern), m = Fe(o, c, a), l = {
|
|
26
25
|
unitId: o,
|
|
27
|
-
subUnitId:
|
|
28
|
-
ranges:
|
|
29
|
-
startColumn:
|
|
30
|
-
startRow:
|
|
31
|
-
endColumn:
|
|
32
|
-
endRow:
|
|
26
|
+
subUnitId: c,
|
|
27
|
+
ranges: f.map((h) => ({
|
|
28
|
+
startColumn: h.col,
|
|
29
|
+
startRow: h.row,
|
|
30
|
+
endColumn: h.col,
|
|
31
|
+
endRow: h.row
|
|
33
32
|
}))
|
|
34
|
-
},
|
|
35
|
-
if (
|
|
36
|
-
Object.keys(m.values).forEach((
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
}),
|
|
33
|
+
}, u = [], p = [];
|
|
34
|
+
if (a.length) {
|
|
35
|
+
Object.keys(m.values).forEach((v) => {
|
|
36
|
+
const g = m.values[v];
|
|
37
|
+
g.ranges = Le(g.ranges);
|
|
38
|
+
}), u.push({
|
|
40
39
|
id: Y.id,
|
|
41
40
|
params: m
|
|
42
41
|
});
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
const h = We(e, m);
|
|
43
|
+
p.push(...h);
|
|
45
44
|
}
|
|
46
|
-
if (
|
|
47
|
-
|
|
45
|
+
if (f.length) {
|
|
46
|
+
l.ranges = Le(l.ranges), u.push({
|
|
48
47
|
id: pe.id,
|
|
49
|
-
params:
|
|
48
|
+
params: l
|
|
50
49
|
});
|
|
51
|
-
const
|
|
52
|
-
|
|
50
|
+
const h = ke(e, l);
|
|
51
|
+
p.push(...h);
|
|
53
52
|
}
|
|
54
|
-
const
|
|
55
|
-
return
|
|
53
|
+
const _ = ht(u, s).result;
|
|
54
|
+
return _ && r.pushUndoRedo({
|
|
56
55
|
unitID: o,
|
|
57
|
-
undoMutations:
|
|
58
|
-
redoMutations:
|
|
59
|
-
}),
|
|
56
|
+
undoMutations: p,
|
|
57
|
+
redoMutations: u
|
|
58
|
+
}), _;
|
|
60
59
|
}
|
|
61
|
-
}, Ee = "SHEET_NUMFMT_PLUGIN", me = (e) => x.getInfo(e).type || "unknown", we = (e, t,
|
|
62
|
-
const
|
|
60
|
+
}, Ee = "SHEET_NUMFMT_PLUGIN", me = (e) => x.getInfo(e).type || "unknown", we = (e, t, s) => {
|
|
61
|
+
const n = x.getInfo(e), r = s === pt.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], o = x.format(e, t, { locale: r });
|
|
63
62
|
return t < 0 ? {
|
|
64
63
|
result: o,
|
|
65
64
|
color: i.color
|
|
@@ -67,50 +66,50 @@ const $ = {
|
|
|
67
66
|
result: o
|
|
68
67
|
};
|
|
69
68
|
};
|
|
70
|
-
var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, qt = (e, t,
|
|
71
|
-
for (var r =
|
|
72
|
-
(o = e[i]) && (r = (
|
|
73
|
-
return
|
|
74
|
-
}, A = (e, t) => (
|
|
69
|
+
var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, qt = (e, t, s, n) => {
|
|
70
|
+
for (var r = n > 1 ? void 0 : n ? Yt(t, s) : t, i = e.length - 1, o; i >= 0; i--)
|
|
71
|
+
(o = e[i]) && (r = (n ? o(t, s, r) : o(r)) || r);
|
|
72
|
+
return n && r && Kt(t, s, r), r;
|
|
73
|
+
}, A = (e, t) => (s, n) => t(s, n, e);
|
|
75
74
|
let oe = class extends z {
|
|
76
|
-
constructor(e, t,
|
|
77
|
-
super(), this._instanceService = e, this._sheetInterceptorService = t, this._themeService =
|
|
75
|
+
constructor(e, t, s, n, r, i) {
|
|
76
|
+
super(), this._instanceService = e, this._sheetInterceptorService = t, this._themeService = s, this._commandService = n, this._numfmtService = r, this._localeService = i, this._initInterceptorCellContent();
|
|
78
77
|
}
|
|
79
78
|
_initInterceptorCellContent() {
|
|
80
79
|
const e = new vt();
|
|
81
80
|
this.disposeWithMe(this._sheetInterceptorService.intercept(Ge.CELL_CONTENT, {
|
|
82
|
-
handler: (t,
|
|
83
|
-
const r =
|
|
81
|
+
handler: (t, s, n) => {
|
|
82
|
+
const r = s.unitId, i = s.subUnitId, o = this._numfmtService.getValue(r, i, s.row, s.col);
|
|
84
83
|
if (!o)
|
|
85
|
-
return
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
88
|
-
return
|
|
89
|
-
let
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
return
|
|
93
|
-
const m = we(o.pattern, Number(
|
|
94
|
-
if (
|
|
95
|
-
return
|
|
96
|
-
const
|
|
84
|
+
return n(t);
|
|
85
|
+
const c = t;
|
|
86
|
+
if (!c || c.t !== V.NUMBER)
|
|
87
|
+
return n(t);
|
|
88
|
+
let a = "";
|
|
89
|
+
const f = e.getValue(s.row, s.col);
|
|
90
|
+
if (f && f.parameters === c.v)
|
|
91
|
+
return n({ ...t, ...f.result });
|
|
92
|
+
const m = we(o.pattern, Number(c.v), this._localeService.getCurrentLocale());
|
|
93
|
+
if (a = m.result, !a)
|
|
94
|
+
return n(t);
|
|
95
|
+
const l = { v: a };
|
|
97
96
|
if (m.color) {
|
|
98
|
-
const
|
|
99
|
-
|
|
97
|
+
const u = this._themeService.getCurrentTheme()[`${m.color}500`];
|
|
98
|
+
u && (l.interceptorStyle = { cl: { rgb: u } });
|
|
100
99
|
}
|
|
101
|
-
return e.setValue(
|
|
102
|
-
result:
|
|
103
|
-
parameters:
|
|
104
|
-
}),
|
|
100
|
+
return e.setValue(s.row, s.col, {
|
|
101
|
+
result: l,
|
|
102
|
+
parameters: c.v
|
|
103
|
+
}), n({ ...t, ...l });
|
|
105
104
|
},
|
|
106
105
|
priority: 10
|
|
107
106
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
|
|
108
107
|
if (t.id === Y.id) {
|
|
109
|
-
const
|
|
110
|
-
Object.keys(
|
|
111
|
-
|
|
112
|
-
R.foreach(i, (o,
|
|
113
|
-
e.realDeleteValue(o,
|
|
108
|
+
const s = t.params;
|
|
109
|
+
Object.keys(s.values).forEach((n) => {
|
|
110
|
+
s.values[n].ranges.forEach((i) => {
|
|
111
|
+
R.foreach(i, (o, c) => {
|
|
112
|
+
e.realDeleteValue(o, c);
|
|
114
113
|
});
|
|
115
114
|
});
|
|
116
115
|
});
|
|
@@ -118,8 +117,8 @@ let oe = class extends z {
|
|
|
118
117
|
})), this.disposeWithMe(
|
|
119
118
|
this._instanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).pipe(
|
|
120
119
|
xt((t) => {
|
|
121
|
-
var
|
|
122
|
-
return (
|
|
120
|
+
var s;
|
|
121
|
+
return (s = t == null ? void 0 : t.activeSheet$) != null ? s : Ot(null);
|
|
123
122
|
}),
|
|
124
123
|
jt(1)
|
|
125
124
|
).subscribe(() => e.reset())
|
|
@@ -136,68 +135,67 @@ oe = qt([
|
|
|
136
135
|
A(5, S(E))
|
|
137
136
|
], oe);
|
|
138
137
|
const j = (e, t = 0) => {
|
|
139
|
-
var
|
|
140
|
-
return e && (
|
|
138
|
+
var n;
|
|
139
|
+
return e && (n = x.getInfo(e).maxDecimals) != null ? n : t;
|
|
141
140
|
}, ve = (e, t) => {
|
|
142
141
|
if (e && !t || !e && t)
|
|
143
142
|
return !1;
|
|
144
|
-
const
|
|
145
|
-
(m,
|
|
143
|
+
const s = (f) => f.reduce(
|
|
144
|
+
(m, l) => {
|
|
146
145
|
if (m.isEnd)
|
|
147
146
|
return m;
|
|
148
|
-
const
|
|
149
|
-
return
|
|
147
|
+
const u = l.value || l.num;
|
|
148
|
+
return l.type === "point" ? (m.isEnd = !0, m) : { ...m, result: m.result + u };
|
|
150
149
|
},
|
|
151
150
|
{ isEnd: !1, result: "" }
|
|
152
|
-
).result,
|
|
153
|
-
return i === o &&
|
|
154
|
-
}, Ve = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), C = (e, t) => e.split(";").map((
|
|
151
|
+
).result, n = x.getInfo(e)._partitions, r = x.getInfo(t)._partitions, i = s(n[0].tokens), o = s(r[0].tokens), c = s(n[1].tokens), a = s(r[1].tokens);
|
|
152
|
+
return i === o && c === a && n[1].color === r[1].color;
|
|
153
|
+
}, Ve = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), C = (e, t) => e.split(";").map((n) => /\.0?/.test(n) ? n.replace(
|
|
155
154
|
/\.0*/g,
|
|
156
155
|
`${t > 0 ? "." : ""}${Ve(Number(t || 0))}`
|
|
157
|
-
) : /0([^0]?)|0$/.test(
|
|
156
|
+
) : /0([^0]?)|0$/.test(n) ? n.replace(
|
|
158
157
|
/0([^0]+)|0$/,
|
|
159
158
|
`0${t > 0 ? "." : ""}${Ve(Number(t || 0))}$1`
|
|
160
|
-
) :
|
|
159
|
+
) : n).join(";"), Jt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), qe = {
|
|
161
160
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
162
161
|
type: w.COMMAND,
|
|
163
162
|
handler: async (e) => {
|
|
164
|
-
const t = e.get(O),
|
|
163
|
+
const t = e.get(O), s = e.get(U), n = e.get(H), r = e.get(D), i = s.getSelections();
|
|
165
164
|
if (!i || !i.length)
|
|
166
165
|
return !1;
|
|
167
166
|
const o = Me(r);
|
|
168
|
-
if (!o)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (!p)
|
|
167
|
+
if (!o) return !1;
|
|
168
|
+
const { unitId: c, subUnitId: a } = o;
|
|
169
|
+
let f = 0;
|
|
170
|
+
i.forEach((p) => {
|
|
171
|
+
R.foreach(p.range, (_, h) => {
|
|
172
|
+
const v = n.getValue(c, a, _, h);
|
|
173
|
+
if (!v)
|
|
176
174
|
return;
|
|
177
|
-
const
|
|
178
|
-
|
|
175
|
+
const g = j(v.pattern);
|
|
176
|
+
f = g > f ? g : f;
|
|
179
177
|
});
|
|
180
178
|
});
|
|
181
|
-
const m =
|
|
182
|
-
return i.forEach((
|
|
183
|
-
R.foreach(
|
|
184
|
-
const
|
|
185
|
-
if (!
|
|
186
|
-
|
|
187
|
-
row:
|
|
188
|
-
col:
|
|
189
|
-
pattern:
|
|
179
|
+
const m = f + 1, l = C(`0${m > 0 ? ".0" : ""}`, m), u = [];
|
|
180
|
+
return i.forEach((p) => {
|
|
181
|
+
R.foreach(p.range, (_, h) => {
|
|
182
|
+
const v = n.getValue(c, a, _, h);
|
|
183
|
+
if (!v)
|
|
184
|
+
u.push({
|
|
185
|
+
row: _,
|
|
186
|
+
col: h,
|
|
187
|
+
pattern: l
|
|
190
188
|
});
|
|
191
189
|
else {
|
|
192
|
-
const
|
|
193
|
-
b !==
|
|
194
|
-
row:
|
|
195
|
-
col:
|
|
190
|
+
const g = j(v.pattern), b = C(v.pattern, g + 1);
|
|
191
|
+
b !== v.pattern && u.push({
|
|
192
|
+
row: _,
|
|
193
|
+
col: h,
|
|
196
194
|
pattern: b
|
|
197
195
|
});
|
|
198
196
|
}
|
|
199
197
|
});
|
|
200
|
-
}),
|
|
198
|
+
}), u.length ? await t.executeCommand($.id, { values: u }) : !1;
|
|
201
199
|
}
|
|
202
200
|
}, Zt = [
|
|
203
201
|
{
|
|
@@ -304,13 +302,13 @@ const j = (e, t = 0) => {
|
|
|
304
302
|
id: "sheet.command.numfmt.set.currency",
|
|
305
303
|
type: w.COMMAND,
|
|
306
304
|
handler: async (e) => {
|
|
307
|
-
const t = e.get(O),
|
|
308
|
-
if (!
|
|
305
|
+
const t = e.get(O), n = e.get(U).getSelections();
|
|
306
|
+
if (!n || !n.length)
|
|
309
307
|
return !1;
|
|
310
308
|
const r = [], i = Je[0].suffix("¥");
|
|
311
|
-
return
|
|
312
|
-
R.foreach(
|
|
313
|
-
r.push({ row:
|
|
309
|
+
return n.forEach((c) => {
|
|
310
|
+
R.foreach(c.range, (a, f) => {
|
|
311
|
+
r.push({ row: a, col: f, pattern: i, type: "currency" });
|
|
314
312
|
});
|
|
315
313
|
}), await t.executeCommand($.id, { values: r });
|
|
316
314
|
}
|
|
@@ -318,43 +316,42 @@ const j = (e, t = 0) => {
|
|
|
318
316
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
319
317
|
type: w.COMMAND,
|
|
320
318
|
handler: async (e) => {
|
|
321
|
-
const t = e.get(O),
|
|
319
|
+
const t = e.get(O), s = e.get(U), n = e.get(H), r = e.get(D), i = s.getSelections();
|
|
322
320
|
if (!i || !i.length)
|
|
323
321
|
return !1;
|
|
324
322
|
const o = Me(r);
|
|
325
|
-
if (!o)
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (!_)
|
|
323
|
+
if (!o) return !1;
|
|
324
|
+
const { unitId: c, subUnitId: a } = o;
|
|
325
|
+
let f = 0;
|
|
326
|
+
i.forEach((_) => {
|
|
327
|
+
R.foreach(_.range, (h, v) => {
|
|
328
|
+
const g = n.getValue(c, a, h, v);
|
|
329
|
+
if (!g)
|
|
333
330
|
return;
|
|
334
|
-
const b = j(
|
|
335
|
-
|
|
331
|
+
const b = j(g.pattern);
|
|
332
|
+
f = b > f ? b : f;
|
|
336
333
|
});
|
|
337
334
|
});
|
|
338
|
-
const m =
|
|
339
|
-
return i.forEach((
|
|
340
|
-
R.foreach(
|
|
341
|
-
const
|
|
342
|
-
if (!
|
|
343
|
-
|
|
344
|
-
row:
|
|
345
|
-
col:
|
|
346
|
-
pattern:
|
|
335
|
+
const m = f - 1, l = C(`0${m > 0 ? ".0" : "."}`, m), u = [];
|
|
336
|
+
return i.forEach((_) => {
|
|
337
|
+
R.foreach(_.range, (h, v) => {
|
|
338
|
+
const g = n.getValue(c, a, h, v);
|
|
339
|
+
if (!g)
|
|
340
|
+
u.push({
|
|
341
|
+
row: h,
|
|
342
|
+
col: v,
|
|
343
|
+
pattern: l
|
|
347
344
|
});
|
|
348
345
|
else {
|
|
349
|
-
const b = j(
|
|
350
|
-
|
|
351
|
-
row:
|
|
352
|
-
col:
|
|
353
|
-
pattern: C(
|
|
346
|
+
const b = j(g.pattern);
|
|
347
|
+
u.push({
|
|
348
|
+
row: h,
|
|
349
|
+
col: v,
|
|
350
|
+
pattern: C(g.pattern, b - 1)
|
|
354
351
|
});
|
|
355
352
|
}
|
|
356
353
|
});
|
|
357
|
-
}), await t.executeCommand($.id, { values:
|
|
354
|
+
}), await t.executeCommand($.id, { values: u });
|
|
358
355
|
}
|
|
359
356
|
}, ye = {
|
|
360
357
|
id: "sheet.operation.close.numfmt.panel",
|
|
@@ -381,14 +378,11 @@ var Xe = { exports: {} }, _e = {};
|
|
|
381
378
|
* LICENSE file in the root directory of this source tree.
|
|
382
379
|
*/
|
|
383
380
|
var Xt = Wt, en = Symbol.for("react.element"), tn = Symbol.for("react.fragment"), nn = Object.prototype.hasOwnProperty, sn = Xt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, rn = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
384
|
-
function et(e, t,
|
|
385
|
-
var
|
|
386
|
-
|
|
387
|
-
for (
|
|
388
|
-
|
|
389
|
-
if (e && e.defaultProps)
|
|
390
|
-
for (s in t = e.defaultProps, t)
|
|
391
|
-
r[s] === void 0 && (r[s] = t[s]);
|
|
381
|
+
function et(e, t, s) {
|
|
382
|
+
var n, r = {}, i = null, o = null;
|
|
383
|
+
s !== void 0 && (i = "" + s), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (o = t.ref);
|
|
384
|
+
for (n in t) nn.call(t, n) && !rn.hasOwnProperty(n) && (r[n] = t[n]);
|
|
385
|
+
if (e && e.defaultProps) for (n in t = e.defaultProps, t) r[n] === void 0 && (r[n] = t[n]);
|
|
392
386
|
return { $$typeof: en, type: e, key: i, ref: o, props: r, _owner: sn.current };
|
|
393
387
|
}
|
|
394
388
|
_e.Fragment = tn;
|
|
@@ -425,11 +419,11 @@ const Ue = kt([]), Ne = [
|
|
|
425
419
|
"₾",
|
|
426
420
|
"₿"
|
|
427
421
|
];
|
|
428
|
-
var on = Object.defineProperty, cn = Object.getOwnPropertyDescriptor, an = (e, t,
|
|
429
|
-
for (var r =
|
|
430
|
-
(o = e[i]) && (r = (
|
|
431
|
-
return
|
|
432
|
-
}, ln = (e, t) => (
|
|
422
|
+
var on = Object.defineProperty, cn = Object.getOwnPropertyDescriptor, an = (e, t, s, n) => {
|
|
423
|
+
for (var r = n > 1 ? void 0 : n ? cn(t, s) : t, i = e.length - 1, o; i >= 0; i--)
|
|
424
|
+
(o = e[i]) && (r = (n ? o(t, s, r) : o(r)) || r);
|
|
425
|
+
return n && r && on(t, s, r), r;
|
|
426
|
+
}, ln = (e, t) => (s, n) => t(s, n, e);
|
|
433
427
|
let fe = class {
|
|
434
428
|
constructor(e) {
|
|
435
429
|
this._localStorageService = e;
|
|
@@ -438,37 +432,37 @@ let fe = class {
|
|
|
438
432
|
return `userHabitController_${e}`;
|
|
439
433
|
}
|
|
440
434
|
async addHabit(e, t) {
|
|
441
|
-
const
|
|
442
|
-
return this._localStorageService.getItem(
|
|
443
|
-
|
|
435
|
+
const s = this._getKey(e);
|
|
436
|
+
return this._localStorageService.getItem(s).then((n) => {
|
|
437
|
+
n || this._localStorageService.setItem(s, t);
|
|
444
438
|
});
|
|
445
439
|
}
|
|
446
440
|
markHabit(e, t) {
|
|
447
|
-
const
|
|
448
|
-
this._localStorageService.getItem(
|
|
449
|
-
if (
|
|
450
|
-
const r =
|
|
451
|
-
r > -1 &&
|
|
441
|
+
const s = this._getKey(e);
|
|
442
|
+
this._localStorageService.getItem(s).then((n) => {
|
|
443
|
+
if (n) {
|
|
444
|
+
const r = n.findIndex((i) => i === t);
|
|
445
|
+
r > -1 && n.splice(r, 1), n.unshift(t), this._localStorageService.setItem(s, n);
|
|
452
446
|
}
|
|
453
447
|
});
|
|
454
448
|
}
|
|
455
449
|
async getHabit(e, t) {
|
|
456
|
-
const
|
|
457
|
-
if (t &&
|
|
458
|
-
const r =
|
|
459
|
-
const
|
|
450
|
+
const s = this._getKey(e), n = await this._localStorageService.getItem(s);
|
|
451
|
+
if (t && n) {
|
|
452
|
+
const r = n.map((i, o, c) => {
|
|
453
|
+
const a = c.length;
|
|
460
454
|
return {
|
|
461
455
|
value: i,
|
|
462
|
-
priority:
|
|
456
|
+
priority: a - o
|
|
463
457
|
};
|
|
464
458
|
});
|
|
465
459
|
return t.sort((i, o) => {
|
|
466
|
-
var
|
|
467
|
-
const
|
|
468
|
-
return (((m = r.find((
|
|
460
|
+
var f, m;
|
|
461
|
+
const c = ((f = r.find((l) => l.value === i)) == null ? void 0 : f.priority) || -1;
|
|
462
|
+
return (((m = r.find((l) => l.value === o)) == null ? void 0 : m.priority) || -1) - c;
|
|
469
463
|
});
|
|
470
464
|
}
|
|
471
|
-
return
|
|
465
|
+
return n || [];
|
|
472
466
|
}
|
|
473
467
|
deleteHabit(e) {
|
|
474
468
|
this._localStorageService.removeItem(e);
|
|
@@ -478,204 +472,204 @@ fe = an([
|
|
|
478
472
|
ln(0, S(gt))
|
|
479
473
|
], fe);
|
|
480
474
|
const Be = "numfmtCurrency", un = (e) => {
|
|
481
|
-
const t = N(fe), [
|
|
475
|
+
const t = N(fe), [s, n] = I(Ne);
|
|
482
476
|
return xe(() => {
|
|
483
477
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
484
478
|
t.getHabit(Be, [...Ne]).then((i) => {
|
|
485
|
-
|
|
479
|
+
n(i), e && e(i);
|
|
486
480
|
});
|
|
487
481
|
});
|
|
488
|
-
}, []), { userHabitCurrency:
|
|
482
|
+
}, []), { userHabitCurrency: s, mark: (i) => {
|
|
489
483
|
t.markHabit(Be, i);
|
|
490
484
|
} };
|
|
491
485
|
}, mn = () => {
|
|
492
|
-
const e = Ke([]), [t,
|
|
486
|
+
const e = Ke([]), [t, s] = I({});
|
|
493
487
|
return xe(() => {
|
|
494
488
|
e.current.forEach((r) => {
|
|
495
489
|
r();
|
|
496
490
|
}), e.current = [];
|
|
497
491
|
}, [t]), (r) => {
|
|
498
|
-
e.current.push(r),
|
|
492
|
+
e.current.push(r), s({});
|
|
499
493
|
};
|
|
500
|
-
}, re = (e) => Ne.find((
|
|
501
|
-
const [t,
|
|
494
|
+
}, re = (e) => Ne.find((s) => e.includes(s)), dn = (e) => !!re(e) && e.startsWith("_("), fn = (e) => {
|
|
495
|
+
const [t, s] = I(() => j(e.defaultPattern || "", 2)), n = Ye(Ue), [r, i] = I(() => re(e.defaultPattern) || n[0]), o = P(() => n.map((l) => ({ label: l, value: l })), []), a = N(E).t;
|
|
502
496
|
e.action.current = () => C(`_("${r}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
|
|
503
|
-
const
|
|
504
|
-
i(
|
|
505
|
-
}, m = (
|
|
506
|
-
const
|
|
507
|
-
|
|
497
|
+
const f = (l) => {
|
|
498
|
+
i(l), e.onChange(C(`_("${l}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
|
|
499
|
+
}, m = (l) => {
|
|
500
|
+
const u = l || 0;
|
|
501
|
+
s(u), e.onChange(C(`_("${r}"* #,##0${u > 0 ? ".0" : ""}_)`, u));
|
|
508
502
|
};
|
|
509
503
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
510
504
|
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
511
505
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
512
|
-
/* @__PURE__ */ d.jsx("div", { className: "label", children:
|
|
506
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: a("sheet.numfmt.decimalLength") }),
|
|
513
507
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Oe, { value: t, max: 20, min: 0, onChange: m }) })
|
|
514
508
|
] }),
|
|
515
509
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
516
|
-
/* @__PURE__ */ d.jsx("div", { className: "label", children:
|
|
517
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange:
|
|
510
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: a("sheet.numfmt.currencyType") }),
|
|
511
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange: f, options: o, value: r }) })
|
|
518
512
|
] })
|
|
519
513
|
] }),
|
|
520
|
-
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children:
|
|
514
|
+
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: a("sheet.numfmt.accountingDes") })
|
|
521
515
|
] });
|
|
522
516
|
}, Ce = (e) => Je.map((t) => ({
|
|
523
517
|
label: t.label(e),
|
|
524
518
|
value: t.suffix(e),
|
|
525
519
|
color: t.color
|
|
526
520
|
})), tt = () => Zt.map((e) => ({ label: e.label, value: e.suffix })), nt = () => Qt.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), hn = (e) => !!re(e) && !e.startsWith("_("), pn = (e) => {
|
|
527
|
-
const
|
|
528
|
-
var
|
|
529
|
-
const
|
|
530
|
-
return ((
|
|
531
|
-
}), m = P(() => Ce(r), [r]),
|
|
532
|
-
e.action.current = () => C(
|
|
533
|
-
const
|
|
534
|
-
i(
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
},
|
|
538
|
-
|
|
539
|
-
},
|
|
540
|
-
|
|
521
|
+
const s = N(E).t, n = Ye(Ue), [r, i] = I(() => re(e.defaultPattern) || n[0]), [o, c] = I(() => j(e.defaultPattern || "", 2)), [a, f] = I(() => {
|
|
522
|
+
var g;
|
|
523
|
+
const h = Ce(r);
|
|
524
|
+
return ((g = h.find((b) => ve(b.value, e.defaultPattern))) == null ? void 0 : g.value) || h[0].value;
|
|
525
|
+
}), m = P(() => Ce(r), [r]), l = P(() => n.map((h) => ({ label: h, value: h })), [n]);
|
|
526
|
+
e.action.current = () => C(a, o);
|
|
527
|
+
const u = (h) => {
|
|
528
|
+
i(h);
|
|
529
|
+
const v = Ce(h)[0].value;
|
|
530
|
+
f(v), e.onChange(C(v, o));
|
|
531
|
+
}, p = (h) => {
|
|
532
|
+
f(h), e.onChange(C(h, o));
|
|
533
|
+
}, _ = (h) => {
|
|
534
|
+
c(h || 0), e.onChange(C(a, h || 0));
|
|
541
535
|
};
|
|
542
536
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
543
537
|
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
544
538
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
545
|
-
/* @__PURE__ */ d.jsx("div", { className: "label", children:
|
|
546
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Oe, { value: o, max: 20, min: 0, onChange:
|
|
539
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: s("sheet.numfmt.decimalLength") }),
|
|
540
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Oe, { value: o, max: 20, min: 0, onChange: _ }) })
|
|
547
541
|
] }),
|
|
548
542
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
549
|
-
/* @__PURE__ */ d.jsx("div", { className: "label", children:
|
|
550
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange:
|
|
543
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: s("sheet.numfmt.currencyType") }),
|
|
544
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange: u, options: l, value: r }) })
|
|
551
545
|
] })
|
|
552
546
|
] }),
|
|
553
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children:
|
|
554
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange:
|
|
555
|
-
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children:
|
|
547
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: s("sheet.numfmt.negType") }),
|
|
548
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: p, options: m, value: a }) }),
|
|
549
|
+
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: s("sheet.numfmt.currencyDes") })
|
|
556
550
|
] });
|
|
557
551
|
}, vn = (e) => {
|
|
558
552
|
const t = x.getInfo(e);
|
|
559
|
-
return tt().map((
|
|
553
|
+
return tt().map((s) => s.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
560
554
|
}, _n = (e) => {
|
|
561
|
-
const t = P(tt, []),
|
|
555
|
+
const t = P(tt, []), n = N(E).t, [r, i] = I(() => {
|
|
562
556
|
if (e.defaultPattern) {
|
|
563
|
-
const
|
|
564
|
-
if (
|
|
565
|
-
return
|
|
557
|
+
const c = t.find((a) => a.value === e.defaultPattern);
|
|
558
|
+
if (c)
|
|
559
|
+
return c.value;
|
|
566
560
|
}
|
|
567
561
|
return t[0].value;
|
|
568
562
|
});
|
|
569
563
|
e.action.current = () => r;
|
|
570
|
-
const o = (
|
|
571
|
-
i(
|
|
564
|
+
const o = (c) => {
|
|
565
|
+
i(c), e.onChange(c);
|
|
572
566
|
};
|
|
573
567
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
574
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children:
|
|
568
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
|
|
575
569
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { value: r, options: t, onChange: o }) }),
|
|
576
|
-
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children:
|
|
570
|
+
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
|
|
577
571
|
] });
|
|
578
572
|
}, gn = (e) => !e, Sn = (e) => {
|
|
579
|
-
const
|
|
580
|
-
return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children:
|
|
573
|
+
const s = N(E).t;
|
|
574
|
+
return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: s("sheet.numfmt.generalDes") }) });
|
|
581
575
|
}, bn = (e) => nt().some((t) => ve(t.value, e)), yn = (e) => {
|
|
582
|
-
const t = N(E),
|
|
583
|
-
const
|
|
584
|
-
return (
|
|
585
|
-
}),
|
|
586
|
-
r(
|
|
587
|
-
}, m = (
|
|
588
|
-
r(j(
|
|
576
|
+
const t = N(E), s = P(nt, []), [n, r] = I(() => j(e.defaultPattern || "", 0)), [i, o] = I(() => {
|
|
577
|
+
const l = s.find((u) => ve(u.value, e.defaultPattern || ""));
|
|
578
|
+
return (l == null ? void 0 : l.value) || s[0].value;
|
|
579
|
+
}), c = P(() => C(i, Number(n || 0)), [i, n]), a = P(() => !Jt(i), [i]), f = (l) => {
|
|
580
|
+
r(l || 0), e.onChange(C(i, Number(l || 0)));
|
|
581
|
+
}, m = (l) => {
|
|
582
|
+
r(j(l, 0)), o(l), e.onChange(l);
|
|
589
583
|
};
|
|
590
|
-
return e.action.current = () =>
|
|
584
|
+
return e.action.current = () => c, /* @__PURE__ */ d.jsxs("div", { children: [
|
|
591
585
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
|
|
592
586
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
|
|
593
587
|
Oe,
|
|
594
588
|
{
|
|
595
|
-
disabled:
|
|
596
|
-
value:
|
|
589
|
+
disabled: a,
|
|
590
|
+
value: n,
|
|
597
591
|
max: 20,
|
|
598
592
|
min: 0,
|
|
599
|
-
onChange:
|
|
593
|
+
onChange: f
|
|
600
594
|
}
|
|
601
595
|
) }),
|
|
602
596
|
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 label", children: [
|
|
603
597
|
" ",
|
|
604
598
|
t.t("sheet.numfmt.negType")
|
|
605
599
|
] }),
|
|
606
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: m, options:
|
|
600
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: m, options: s, value: i }) }),
|
|
607
601
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
|
|
608
602
|
] });
|
|
609
603
|
}, Cn = (e) => {
|
|
610
|
-
const { defaultValue: t, defaultPattern:
|
|
604
|
+
const { defaultValue: t, defaultPattern: s, row: n, col: r } = e.value, i = N(E), o = Ke(() => ""), c = i.t, a = mn(), f = P(
|
|
611
605
|
() => [
|
|
612
606
|
{ label: "sheet.numfmt.general", component: Sn },
|
|
613
607
|
{ label: "sheet.numfmt.accounting", component: fn },
|
|
614
608
|
{ label: "sheet.numfmt.currency", component: pn },
|
|
615
609
|
{ label: "sheet.numfmt.date", component: _n },
|
|
616
610
|
{ label: "sheet.numfmt.thousandthPercentile", component: yn }
|
|
617
|
-
].map((y) => ({ ...y, label:
|
|
611
|
+
].map((y) => ({ ...y, label: c(y.label) })),
|
|
618
612
|
[]
|
|
619
|
-
), [m,
|
|
613
|
+
), [m, l] = I(g), [u, p] = I(() => `${n}_${r}`), { mark: _, userHabitCurrency: h } = un(() => p(`${n}_${r}_userCurrency'`)), v = P(() => {
|
|
620
614
|
var y;
|
|
621
|
-
return (y =
|
|
615
|
+
return (y = f.find((L) => L.label === m)) == null ? void 0 : y.component;
|
|
622
616
|
}, [m]);
|
|
623
|
-
function
|
|
624
|
-
return [gn, dn, hn, vn, bn].reduce((L, lt, ut) => L || (lt(
|
|
617
|
+
function g() {
|
|
618
|
+
return [gn, dn, hn, vn, bn].reduce((L, lt, ut) => L || (lt(s) ? f[ut].label : ""), "") || f[0].label;
|
|
625
619
|
}
|
|
626
|
-
const b =
|
|
620
|
+
const b = f.map((y) => ({
|
|
627
621
|
label: y.label,
|
|
628
622
|
value: y.label
|
|
629
623
|
})), F = (y) => {
|
|
630
|
-
|
|
624
|
+
l(y), a(() => e.onChange({ type: "change", value: o.current() || "" }));
|
|
631
625
|
}, ge = (y) => {
|
|
632
626
|
e.onChange({ type: "change", value: y });
|
|
633
627
|
}, Se = () => {
|
|
634
628
|
const y = o.current() || "", L = re(y);
|
|
635
|
-
L &&
|
|
629
|
+
L && _(L), e.onChange({ type: "confirm", value: y });
|
|
636
630
|
}, be = () => {
|
|
637
631
|
e.onChange({ type: "cancel", value: "" });
|
|
638
632
|
}, at = {
|
|
639
633
|
onChange: ge,
|
|
640
634
|
defaultValue: t,
|
|
641
|
-
defaultPattern:
|
|
635
|
+
defaultPattern: s,
|
|
642
636
|
action: o
|
|
643
637
|
};
|
|
644
638
|
return xe(() => {
|
|
645
|
-
|
|
646
|
-
}, [
|
|
639
|
+
l(g()), p(`${n}_${r}`);
|
|
640
|
+
}, [n, r]), /* @__PURE__ */ d.jsxs("div", { className: "numfmt-panel p-b-20", children: [
|
|
647
641
|
/* @__PURE__ */ d.jsxs("div", { children: [
|
|
648
|
-
/* @__PURE__ */ d.jsx("div", { className: "label m-t-14", children:
|
|
642
|
+
/* @__PURE__ */ d.jsx("div", { className: "label m-t-14", children: c("sheet.numfmt.numfmtType") }),
|
|
649
643
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(je, { onChange: F, options: b, value: m }) }),
|
|
650
|
-
/* @__PURE__ */ d.jsx("div", { children:
|
|
644
|
+
/* @__PURE__ */ d.jsx("div", { children: v && /* @__PURE__ */ d.jsx(Ue.Provider, { value: h, children: /* @__PURE__ */ Gt(v, { ...at, key: u }) }) })
|
|
651
645
|
] }),
|
|
652
646
|
/* @__PURE__ */ d.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
653
|
-
/* @__PURE__ */ d.jsx(Ae, { size: "small", onClick: be, className: "m-r-12", children:
|
|
654
|
-
/* @__PURE__ */ d.jsx(Ae, { type: "primary", size: "small", onClick: Se, children:
|
|
647
|
+
/* @__PURE__ */ d.jsx(Ae, { size: "small", onClick: be, className: "m-r-12", children: c("sheet.numfmt.cancel") }),
|
|
648
|
+
/* @__PURE__ */ d.jsx(Ae, { type: "primary", size: "small", onClick: Se, children: c("sheet.numfmt.confirm") })
|
|
655
649
|
] })
|
|
656
650
|
] });
|
|
657
651
|
}, st = {
|
|
658
652
|
id: "sheet.command.numfmt.set.percent",
|
|
659
653
|
type: w.COMMAND,
|
|
660
654
|
handler: async (e) => {
|
|
661
|
-
const t = e.get(O),
|
|
662
|
-
if (!
|
|
655
|
+
const t = e.get(O), n = e.get(U).getSelections();
|
|
656
|
+
if (!n || !n.length)
|
|
663
657
|
return !1;
|
|
664
658
|
const r = [], i = "0%";
|
|
665
|
-
return
|
|
666
|
-
R.foreach(
|
|
667
|
-
r.push({ row:
|
|
659
|
+
return n.forEach((c) => {
|
|
660
|
+
R.foreach(c.range, (a, f) => {
|
|
661
|
+
r.push({ row: a, col: f, pattern: i, type: "percent" });
|
|
668
662
|
});
|
|
669
663
|
}), await t.executeCommand($.id, { values: r });
|
|
670
664
|
}
|
|
671
665
|
};
|
|
672
|
-
var Tn = Object.defineProperty, In = Object.getOwnPropertyDescriptor, En = (e, t,
|
|
673
|
-
for (var r =
|
|
674
|
-
(o = e[i]) && (r = (
|
|
675
|
-
return
|
|
676
|
-
}, M = (e, t) => (
|
|
666
|
+
var Tn = Object.defineProperty, In = Object.getOwnPropertyDescriptor, En = (e, t, s, n) => {
|
|
667
|
+
for (var r = n > 1 ? void 0 : n ? In(t, s) : t, i = e.length - 1, o; i >= 0; i--)
|
|
668
|
+
(o = e[i]) && (r = (n ? o(t, s, r) : o(r)) || r);
|
|
669
|
+
return n && r && Tn(t, s, r), r;
|
|
670
|
+
}, M = (e, t) => (s, n) => t(s, n, e);
|
|
677
671
|
let ce = class extends z {
|
|
678
|
-
constructor(t,
|
|
672
|
+
constructor(t, s, n, r, i, o, c, a, f, m) {
|
|
679
673
|
super();
|
|
680
674
|
/**
|
|
681
675
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -685,59 +679,61 @@ let ce = class extends z {
|
|
|
685
679
|
*/
|
|
686
680
|
ie(this, "_previewPattern", "");
|
|
687
681
|
ie(this, "_sidebarDisposable", null);
|
|
688
|
-
this._sheetInterceptorService = t, this._themeService =
|
|
682
|
+
this._sheetInterceptorService = t, this._themeService = s, this._univerInstanceService = n, this._commandService = r, this._selectionManagerService = i, this._renderManagerService = o, this._numfmtService = c, this._componentManager = a, this._sidebarService = f, this._localeService = m, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener();
|
|
689
683
|
}
|
|
690
684
|
openPanel() {
|
|
691
|
-
const t = this._sidebarService,
|
|
692
|
-
if (!
|
|
685
|
+
const t = this._sidebarService, s = this._selectionManagerService, n = this._commandService, r = this._univerInstanceService, i = this._numfmtService, o = this._localeService, a = (s.getSelectionRanges() || [])[0];
|
|
686
|
+
if (!a)
|
|
687
|
+
return !1;
|
|
688
|
+
const f = r.getCurrentUnitForType(T.UNIVER_SHEET), m = f.getActiveSheet();
|
|
689
|
+
if (!m)
|
|
693
690
|
return !1;
|
|
694
|
-
const
|
|
695
|
-
|
|
691
|
+
const l = m.getCellRaw(a.startRow, a.startColumn), u = i.getValue(
|
|
692
|
+
f.getUnitId(),
|
|
696
693
|
m.getSheetId(),
|
|
697
|
-
|
|
698
|
-
|
|
694
|
+
a.startRow,
|
|
695
|
+
a.startColumn
|
|
699
696
|
);
|
|
700
|
-
let
|
|
701
|
-
|
|
702
|
-
const
|
|
703
|
-
onChange: (
|
|
704
|
-
if (
|
|
705
|
-
this._previewPattern =
|
|
706
|
-
else if (
|
|
707
|
-
const
|
|
708
|
-
|
|
697
|
+
let p = "";
|
|
698
|
+
u && (p = u.pattern);
|
|
699
|
+
const _ = (l == null ? void 0 : l.t) === V.NUMBER ? l.v : 12345678, h = {
|
|
700
|
+
onChange: (v) => {
|
|
701
|
+
if (v.type === "change")
|
|
702
|
+
this._previewPattern = v.value, this._forceUpdate();
|
|
703
|
+
else if (v.type === "confirm") {
|
|
704
|
+
const g = s.getSelectionRanges() || [], b = { values: [] }, F = me(v.value);
|
|
705
|
+
g.forEach((ge) => {
|
|
709
706
|
R.foreach(ge, (Se, be) => {
|
|
710
707
|
b.values.push({
|
|
711
708
|
row: Se,
|
|
712
709
|
col: be,
|
|
713
|
-
pattern:
|
|
710
|
+
pattern: v.value,
|
|
714
711
|
type: F
|
|
715
712
|
});
|
|
716
713
|
});
|
|
717
|
-
}),
|
|
718
|
-
} else
|
|
719
|
-
p.type === "cancel" && t.close();
|
|
714
|
+
}), n.executeCommand($.id, b), t.close();
|
|
715
|
+
} else v.type === "cancel" && t.close();
|
|
720
716
|
},
|
|
721
|
-
value: { defaultPattern:
|
|
717
|
+
value: { defaultPattern: p, defaultValue: _, row: a.startRow, col: a.startColumn }
|
|
722
718
|
};
|
|
723
719
|
return this._sidebarDisposable = t.open({
|
|
724
720
|
header: { title: o.t("sheet.numfmt.title") },
|
|
725
721
|
children: {
|
|
726
722
|
label: Ee,
|
|
727
|
-
...
|
|
723
|
+
...h
|
|
728
724
|
// need passthrough to react props.
|
|
729
725
|
},
|
|
730
726
|
onClose: () => {
|
|
731
|
-
this._forceUpdate(),
|
|
727
|
+
this._forceUpdate(), n.executeCommand(ye.id);
|
|
732
728
|
}
|
|
733
729
|
}), !0;
|
|
734
730
|
}
|
|
735
731
|
_forceUpdate(t) {
|
|
736
|
-
var
|
|
737
|
-
const
|
|
732
|
+
var n;
|
|
733
|
+
const s = this._renderManagerService.getRenderById(
|
|
738
734
|
t != null ? t : this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId()
|
|
739
735
|
);
|
|
740
|
-
|
|
736
|
+
s == null || s.with(Nt).reCalculate(), (n = s == null ? void 0 : s.mainComponent) == null || n.makeDirty();
|
|
741
737
|
}
|
|
742
738
|
_initCommands() {
|
|
743
739
|
[
|
|
@@ -756,23 +752,23 @@ let ce = class extends z {
|
|
|
756
752
|
this._componentManager.register(Ee, Cn);
|
|
757
753
|
}
|
|
758
754
|
_initRealTimeRenderingInterceptor() {
|
|
759
|
-
const t = new k((
|
|
755
|
+
const t = new k((n) => {
|
|
760
756
|
this._commandService.onCommandExecuted((r) => {
|
|
761
|
-
r.id === de.id &&
|
|
757
|
+
r.id === de.id && n.next(!0), r.id === ye.id && n.next(!1);
|
|
762
758
|
});
|
|
763
|
-
}),
|
|
759
|
+
}), s = $t([
|
|
764
760
|
t,
|
|
765
761
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
766
|
-
Vt((
|
|
762
|
+
Vt((n) => n ? n.map((r) => r.range) : [])
|
|
767
763
|
)
|
|
768
764
|
]);
|
|
769
765
|
this.disposeWithMe(
|
|
770
766
|
Ie(
|
|
771
|
-
|
|
767
|
+
s.pipe(
|
|
772
768
|
Bt(
|
|
773
|
-
([
|
|
769
|
+
([n, r]) => new k((i) => {
|
|
774
770
|
const o = new St();
|
|
775
|
-
return
|
|
771
|
+
return n && r.length && i.next({ selectionRanges: r, disposableCollection: o }), () => {
|
|
776
772
|
o.dispose();
|
|
777
773
|
};
|
|
778
774
|
})
|
|
@@ -780,40 +776,40 @@ let ce = class extends z {
|
|
|
780
776
|
Ht(() => {
|
|
781
777
|
this._previewPattern = null;
|
|
782
778
|
})
|
|
783
|
-
).subscribe(({ disposableCollection:
|
|
784
|
-
var o,
|
|
779
|
+
).subscribe(({ disposableCollection: n, selectionRanges: r }) => {
|
|
780
|
+
var o, c;
|
|
785
781
|
const i = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
|
|
786
|
-
this.openPanel(),
|
|
782
|
+
this.openPanel(), n.add(
|
|
787
783
|
this._sheetInterceptorService.intercept(Ge.CELL_CONTENT, {
|
|
788
784
|
priority: 99,
|
|
789
|
-
handler: (
|
|
790
|
-
const { row:
|
|
785
|
+
handler: (a, f, m) => {
|
|
786
|
+
const { row: l, col: u } = f, p = m(a) || {};
|
|
791
787
|
if (r.find(
|
|
792
|
-
(
|
|
788
|
+
(_) => _.startColumn <= u && _.endColumn >= u && _.startRow <= l && _.endRow >= l
|
|
793
789
|
)) {
|
|
794
|
-
const
|
|
795
|
-
if (
|
|
796
|
-
return
|
|
797
|
-
const
|
|
798
|
-
if (
|
|
799
|
-
const F = this._themeService.getCurrentTheme()[`${
|
|
790
|
+
const _ = f.worksheet.getCellRaw(l, u), h = _ == null ? void 0 : _.v, v = _ == null ? void 0 : _.t;
|
|
791
|
+
if (h == null || v !== V.NUMBER || this._previewPattern === null)
|
|
792
|
+
return p;
|
|
793
|
+
const g = we(this._previewPattern, h, this._localeService.getCurrentLocale());
|
|
794
|
+
if (g.color) {
|
|
795
|
+
const F = this._themeService.getCurrentTheme()[`${g.color}500`];
|
|
800
796
|
return {
|
|
801
|
-
...
|
|
802
|
-
v:
|
|
797
|
+
...p,
|
|
798
|
+
v: g.result,
|
|
803
799
|
t: V.STRING,
|
|
804
800
|
s: { cl: { rgb: F } }
|
|
805
801
|
};
|
|
806
802
|
}
|
|
807
803
|
return {
|
|
808
|
-
...
|
|
809
|
-
v:
|
|
804
|
+
...p,
|
|
805
|
+
v: g.result,
|
|
810
806
|
t: V.STRING
|
|
811
807
|
};
|
|
812
808
|
}
|
|
813
|
-
return
|
|
809
|
+
return p;
|
|
814
810
|
}
|
|
815
811
|
})
|
|
816
|
-
), (
|
|
812
|
+
), (c = (o = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : o.mainComponent) == null || c.makeDirty();
|
|
817
813
|
})
|
|
818
814
|
)
|
|
819
815
|
);
|
|
@@ -821,21 +817,21 @@ let ce = class extends z {
|
|
|
821
817
|
_commandExecutedListener() {
|
|
822
818
|
const t = [pe.id, Y.id];
|
|
823
819
|
this.disposeWithMe(
|
|
824
|
-
new k((
|
|
825
|
-
const
|
|
820
|
+
new k((s) => {
|
|
821
|
+
const n = this._commandService.onCommandExecuted((r) => {
|
|
826
822
|
if (t.includes(r.id)) {
|
|
827
823
|
const i = r.params;
|
|
828
|
-
|
|
824
|
+
s.next(i.unitId);
|
|
829
825
|
}
|
|
830
826
|
});
|
|
831
|
-
return () =>
|
|
832
|
-
}).pipe(Ft(16)).subscribe((
|
|
827
|
+
return () => n.dispose();
|
|
828
|
+
}).pipe(Ft(16)).subscribe((s) => this._forceUpdate(s))
|
|
833
829
|
);
|
|
834
830
|
}
|
|
835
831
|
_initCloseListener() {
|
|
836
832
|
this._univerInstanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).subscribe((t) => {
|
|
837
|
-
var
|
|
838
|
-
t || ((
|
|
833
|
+
var s;
|
|
834
|
+
t || ((s = this._sidebarDisposable) == null || s.dispose(), this._sidebarDisposable = null);
|
|
839
835
|
});
|
|
840
836
|
}
|
|
841
837
|
};
|
|
@@ -852,15 +848,15 @@ ce = En([
|
|
|
852
848
|
M(8, Lt),
|
|
853
849
|
M(9, S(E))
|
|
854
850
|
], ce);
|
|
855
|
-
var Nn = Object.defineProperty, Mn = Object.getOwnPropertyDescriptor, Pn = (e, t,
|
|
856
|
-
for (var r =
|
|
857
|
-
(o = e[i]) && (r = (
|
|
858
|
-
return
|
|
859
|
-
}, W = (e, t) => (
|
|
851
|
+
var Nn = Object.defineProperty, Mn = Object.getOwnPropertyDescriptor, Pn = (e, t, s, n) => {
|
|
852
|
+
for (var r = n > 1 ? void 0 : n ? Mn(t, s) : t, i = e.length - 1, o; i >= 0; i--)
|
|
853
|
+
(o = e[i]) && (r = (n ? o(t, s, r) : o(r)) || r);
|
|
854
|
+
return n && r && Nn(t, s, r), r;
|
|
855
|
+
}, W = (e, t) => (s, n) => t(s, n, e);
|
|
860
856
|
const Rn = () => {
|
|
861
857
|
let e = [];
|
|
862
858
|
return {
|
|
863
|
-
add: (r, i, o,
|
|
859
|
+
add: (r, i, o, c, a) => e.push({ unitId: r, subUnitId: i, row: o, col: c, value: a }),
|
|
864
860
|
getEffects: () => e,
|
|
865
861
|
clean: () => {
|
|
866
862
|
e = [];
|
|
@@ -868,11 +864,11 @@ const Rn = () => {
|
|
|
868
864
|
};
|
|
869
865
|
};
|
|
870
866
|
let ae = class extends z {
|
|
871
|
-
constructor(t,
|
|
867
|
+
constructor(t, s, n, r, i) {
|
|
872
868
|
super();
|
|
873
869
|
// collect effect mutations when edit end and push this to commands stack in next commands progress
|
|
874
870
|
ie(this, "_collectEffectMutation", Rn());
|
|
875
|
-
this._sheetInterceptorService = t, this._numfmtService =
|
|
871
|
+
this._sheetInterceptorService = t, this._numfmtService = s, this._univerInstanceService = n, this._injector = r, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
|
|
876
872
|
}
|
|
877
873
|
_initInterceptorEditorStart() {
|
|
878
874
|
this.disposeWithMe(
|
|
@@ -880,10 +876,10 @@ let ae = class extends z {
|
|
|
880
876
|
this._editorBridgeService.interceptor.intercept(
|
|
881
877
|
this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
|
|
882
878
|
{
|
|
883
|
-
handler: (t,
|
|
884
|
-
const r =
|
|
885
|
-
|
|
886
|
-
|
|
879
|
+
handler: (t, s, n) => {
|
|
880
|
+
const r = s.row, i = s.col, o = this._numfmtService.getValue(
|
|
881
|
+
s.unitId,
|
|
882
|
+
s.subUnitId,
|
|
887
883
|
r,
|
|
888
884
|
i
|
|
889
885
|
);
|
|
@@ -894,14 +890,14 @@ let ae = class extends z {
|
|
|
894
890
|
case "currency":
|
|
895
891
|
case "grouped":
|
|
896
892
|
case "number":
|
|
897
|
-
return
|
|
893
|
+
return s.worksheet.getCellRaw(r, i);
|
|
898
894
|
case "date":
|
|
899
895
|
case "time":
|
|
900
896
|
case "datetime":
|
|
901
897
|
default:
|
|
902
|
-
return
|
|
898
|
+
return n && n(t);
|
|
903
899
|
}
|
|
904
|
-
return
|
|
900
|
+
return n(t);
|
|
905
901
|
}
|
|
906
902
|
}
|
|
907
903
|
)
|
|
@@ -919,42 +915,41 @@ let ae = class extends z {
|
|
|
919
915
|
this._editorBridgeService.interceptor.intercept(
|
|
920
916
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
|
|
921
917
|
{
|
|
922
|
-
handler: (t,
|
|
918
|
+
handler: (t, s, n) => {
|
|
923
919
|
var m;
|
|
924
920
|
this._collectEffectMutation.clean();
|
|
925
921
|
const r = this._numfmtService.getValue(
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
922
|
+
s.unitId,
|
|
923
|
+
s.subUnitId,
|
|
924
|
+
s.row,
|
|
925
|
+
s.col
|
|
930
926
|
), i = (m = r && me(r.pattern)) != null ? m : "", o = () => {
|
|
931
927
|
r && this._collectEffectMutation.add(
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
928
|
+
s.unitId,
|
|
929
|
+
s.subUnitId,
|
|
930
|
+
s.row,
|
|
931
|
+
s.col,
|
|
936
932
|
null
|
|
937
933
|
);
|
|
938
934
|
};
|
|
939
935
|
if (!(t != null && t.v))
|
|
940
|
-
return
|
|
941
|
-
const
|
|
942
|
-
if (!!
|
|
943
|
-
if (
|
|
944
|
-
const
|
|
936
|
+
return n(t);
|
|
937
|
+
const c = String(t.v), a = x.parseDate(c) || x.parseTime(c);
|
|
938
|
+
if (!!a) {
|
|
939
|
+
if (a && a.z) {
|
|
940
|
+
const l = Number(a.v);
|
|
945
941
|
return this._collectEffectMutation.add(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
942
|
+
s.unitId,
|
|
943
|
+
s.subUnitId,
|
|
944
|
+
s.row,
|
|
945
|
+
s.col,
|
|
950
946
|
{
|
|
951
|
-
pattern:
|
|
947
|
+
pattern: a.z
|
|
952
948
|
}
|
|
953
|
-
), { ...t, v:
|
|
949
|
+
), { ...t, v: l, t: V.NUMBER };
|
|
954
950
|
}
|
|
955
|
-
} else
|
|
956
|
-
|
|
957
|
-
return s(t);
|
|
951
|
+
} else (["date", "time", "datetime"].includes(i) || !xn(c)) && o();
|
|
952
|
+
return n(t);
|
|
958
953
|
}
|
|
959
954
|
}
|
|
960
955
|
)
|
|
@@ -965,52 +960,59 @@ let ae = class extends z {
|
|
|
965
960
|
const t = this;
|
|
966
961
|
this.disposeWithMe(
|
|
967
962
|
this._sheetInterceptorService.interceptCommand({
|
|
968
|
-
getMutations(
|
|
969
|
-
|
|
963
|
+
getMutations(s) {
|
|
964
|
+
var n;
|
|
965
|
+
switch (s.id) {
|
|
970
966
|
case Tt.id: {
|
|
971
|
-
const
|
|
972
|
-
if (!o
|
|
967
|
+
const r = t._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET), i = r.getUnitId(), o = (n = r.getActiveSheet()) == null ? void 0 : n.getSheetId();
|
|
968
|
+
if (!o)
|
|
969
|
+
return {
|
|
970
|
+
redos: [],
|
|
971
|
+
undos: []
|
|
972
|
+
};
|
|
973
|
+
const c = t._collectEffectMutation.getEffects();
|
|
974
|
+
if (!c.length)
|
|
973
975
|
return {
|
|
974
976
|
redos: [],
|
|
975
977
|
undos: []
|
|
976
978
|
};
|
|
977
|
-
const a =
|
|
978
|
-
var
|
|
979
|
-
return !!((
|
|
980
|
-
}).map((
|
|
981
|
-
row:
|
|
982
|
-
col:
|
|
983
|
-
pattern:
|
|
984
|
-
})),
|
|
985
|
-
var
|
|
986
|
-
return !((
|
|
987
|
-
}).map((
|
|
988
|
-
startRow:
|
|
989
|
-
endColumn:
|
|
990
|
-
startColumn:
|
|
991
|
-
endRow:
|
|
992
|
-
})),
|
|
979
|
+
const a = c.filter((u) => {
|
|
980
|
+
var p;
|
|
981
|
+
return !!((p = u.value) != null && p.pattern);
|
|
982
|
+
}).map((u) => ({
|
|
983
|
+
row: u.row,
|
|
984
|
+
col: u.col,
|
|
985
|
+
pattern: u.value.pattern
|
|
986
|
+
})), f = c.filter((u) => {
|
|
987
|
+
var p;
|
|
988
|
+
return !((p = u.value) != null && p.pattern);
|
|
989
|
+
}).map((u) => ({
|
|
990
|
+
startRow: u.row,
|
|
991
|
+
endColumn: u.col,
|
|
992
|
+
startColumn: u.col,
|
|
993
|
+
endRow: u.row
|
|
994
|
+
})), m = [], l = [];
|
|
993
995
|
if (a) {
|
|
994
|
-
const
|
|
996
|
+
const u = {
|
|
995
997
|
id: Y.id,
|
|
996
|
-
params: Fe(
|
|
998
|
+
params: Fe(i, o, a)
|
|
997
999
|
};
|
|
998
|
-
|
|
1000
|
+
m.push(u), l.push(...We(t._injector, u.params));
|
|
999
1001
|
}
|
|
1000
|
-
if (
|
|
1001
|
-
const
|
|
1002
|
+
if (f) {
|
|
1003
|
+
const u = {
|
|
1002
1004
|
id: pe.id,
|
|
1003
1005
|
params: {
|
|
1004
|
-
unitId:
|
|
1005
|
-
subUnitId:
|
|
1006
|
-
ranges:
|
|
1006
|
+
unitId: i,
|
|
1007
|
+
subUnitId: o,
|
|
1008
|
+
ranges: f
|
|
1007
1009
|
}
|
|
1008
1010
|
};
|
|
1009
|
-
|
|
1011
|
+
m.push(u), l.push(...ke(t._injector, u.params));
|
|
1010
1012
|
}
|
|
1011
1013
|
return {
|
|
1012
|
-
redos:
|
|
1013
|
-
undos:
|
|
1014
|
+
redos: m,
|
|
1015
|
+
undos: l.reverse()
|
|
1014
1016
|
};
|
|
1015
1017
|
}
|
|
1016
1018
|
}
|
|
@@ -1034,11 +1036,11 @@ ae = Pn([
|
|
|
1034
1036
|
function xn(e) {
|
|
1035
1037
|
return /^-?\d+(\.\d+)?$/.test(e);
|
|
1036
1038
|
}
|
|
1037
|
-
var On = Object.defineProperty, jn = Object.getOwnPropertyDescriptor, $n = (e, t,
|
|
1038
|
-
for (var r =
|
|
1039
|
-
(o = e[i]) && (r = (
|
|
1040
|
-
return
|
|
1041
|
-
}, wn = (e, t) => (
|
|
1039
|
+
var On = Object.defineProperty, jn = Object.getOwnPropertyDescriptor, $n = (e, t, s, n) => {
|
|
1040
|
+
for (var r = n > 1 ? void 0 : n ? jn(t, s) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1041
|
+
(o = e[i]) && (r = (n ? o(t, s, r) : o(r)) || r);
|
|
1042
|
+
return n && r && On(t, s, r), r;
|
|
1043
|
+
}, wn = (e, t) => (s, n) => t(s, n, e);
|
|
1042
1044
|
let le = class extends z {
|
|
1043
1045
|
constructor(e) {
|
|
1044
1046
|
super(), this._localeService = e;
|
|
@@ -1102,41 +1104,41 @@ const ue = [
|
|
|
1102
1104
|
pattern: ""
|
|
1103
1105
|
}
|
|
1104
1106
|
], rt = "sheet.numfmt.moreNumfmtType", it = "sheet.numfmt.moreNumfmtType.options", Dn = (e) => {
|
|
1105
|
-
var
|
|
1106
|
-
const t = N(E),
|
|
1107
|
-
return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children:
|
|
1107
|
+
var n;
|
|
1108
|
+
const t = N(E), s = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
|
|
1109
|
+
return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children: s });
|
|
1108
1110
|
}, Un = () => {
|
|
1109
|
-
const e = N(O), t = N(E),
|
|
1110
|
-
const
|
|
1111
|
-
if (!
|
|
1111
|
+
const e = N(O), t = N(E), s = zt(), n = N(U), r = (c) => {
|
|
1112
|
+
const a = n.getLast();
|
|
1113
|
+
if (!a)
|
|
1112
1114
|
return;
|
|
1113
|
-
const
|
|
1114
|
-
R.foreach(m, (
|
|
1115
|
-
|
|
1116
|
-
}), e.executeCommand($.id, { values:
|
|
1117
|
-
}, i = (
|
|
1118
|
-
if (
|
|
1115
|
+
const f = s.get(Ut), m = a.range, l = [];
|
|
1116
|
+
R.foreach(m, (u, p) => {
|
|
1117
|
+
c ? l.push({ row: u, col: p, pattern: c, type: me(c) }) : l.push({ row: u, col: p });
|
|
1118
|
+
}), e.executeCommand($.id, { values: l }), f.focus();
|
|
1119
|
+
}, i = (c) => {
|
|
1120
|
+
if (c === 0)
|
|
1119
1121
|
r(null);
|
|
1120
|
-
else if (
|
|
1122
|
+
else if (c === ue.length - 1)
|
|
1121
1123
|
e.executeCommand(de.id);
|
|
1122
1124
|
else {
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1125
|
+
const a = ue[c];
|
|
1126
|
+
a.pattern && r(a.pattern);
|
|
1125
1127
|
}
|
|
1126
1128
|
}, o = 1220;
|
|
1127
|
-
return /* @__PURE__ */ d.jsx("div", { className: "more-numfmt-type-options", children: ue.map((
|
|
1129
|
+
return /* @__PURE__ */ d.jsx("div", { className: "more-numfmt-type-options", children: ue.map((c, a) => c === "|" ? /* @__PURE__ */ d.jsx("div", { className: "line m-t-4", onClick: (f) => f.stopPropagation() }, a) : /* @__PURE__ */ d.jsxs(
|
|
1128
1130
|
"div",
|
|
1129
1131
|
{
|
|
1130
1132
|
className: "option-item m-t-4",
|
|
1131
1133
|
onClick: () => {
|
|
1132
|
-
i(
|
|
1134
|
+
i(a);
|
|
1133
1135
|
},
|
|
1134
1136
|
children: [
|
|
1135
|
-
/* @__PURE__ */ d.jsx("div", { children: t.t(
|
|
1136
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-l-26", children:
|
|
1137
|
+
/* @__PURE__ */ d.jsx("div", { children: t.t(c.label) }),
|
|
1138
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-l-26", children: c.pattern ? we(c.pattern || "", o, t.getCurrentLocale()).result : "" })
|
|
1137
1139
|
]
|
|
1138
1140
|
},
|
|
1139
|
-
|
|
1141
|
+
a
|
|
1140
1142
|
)) });
|
|
1141
1143
|
}, Ln = (e) => ({
|
|
1142
1144
|
icon: "RmbSingle",
|
|
@@ -1179,27 +1181,27 @@ const ue = [
|
|
|
1179
1181
|
hidden$: se(e, T.UNIVER_SHEET),
|
|
1180
1182
|
disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
|
|
1181
1183
|
}), Hn = (e) => {
|
|
1182
|
-
const t = e.get(H),
|
|
1183
|
-
(
|
|
1184
|
+
const t = e.get(H), s = e.get(D), n = e.get(O), r = e.get(E), i = e.get(U), o = Pt(s, "", ({ workbook: c, worksheet: a }) => new k(
|
|
1185
|
+
(f) => wt(
|
|
1184
1186
|
i.selectionMoveEnd$,
|
|
1185
1187
|
new k((m) => {
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1188
|
+
const l = [pe.id, Y.id], u = n.onCommandExecuted((p) => {
|
|
1189
|
+
l.includes(p.id) && m.next(null);
|
|
1188
1190
|
});
|
|
1189
|
-
return () =>
|
|
1191
|
+
return () => u.dispose();
|
|
1190
1192
|
})
|
|
1191
1193
|
).subscribe(() => {
|
|
1192
1194
|
const m = i.getSelections();
|
|
1193
1195
|
if (m && m[0]) {
|
|
1194
|
-
const
|
|
1195
|
-
let
|
|
1196
|
-
if (
|
|
1197
|
-
const
|
|
1198
|
-
(b) => ve(
|
|
1196
|
+
const l = m[0].range, u = l.startRow, p = l.startColumn, _ = t.getValue(c.getUnitId(), a.getSheetId(), u, p), h = _ == null ? void 0 : _.pattern;
|
|
1197
|
+
let v = r.t("sheet.numfmt.general");
|
|
1198
|
+
if (h) {
|
|
1199
|
+
const g = ue.filter((b) => typeof b == "object" && b.pattern).find(
|
|
1200
|
+
(b) => ve(h, b.pattern)
|
|
1199
1201
|
);
|
|
1200
|
-
|
|
1202
|
+
g && typeof g == "object" && g.pattern ? v = r.t(g.label) : v = r.t("sheet.numfmt.moreFmt");
|
|
1201
1203
|
}
|
|
1202
|
-
|
|
1204
|
+
f.next(v);
|
|
1203
1205
|
}
|
|
1204
1206
|
})
|
|
1205
1207
|
));
|
|
@@ -1223,15 +1225,15 @@ const ue = [
|
|
|
1223
1225
|
disabled$: X(e, { workbookTypes: [q], worksheetTypes: [Z, J], rangeTypes: [Q] })
|
|
1224
1226
|
};
|
|
1225
1227
|
};
|
|
1226
|
-
var Fn = Object.defineProperty, Wn = Object.getOwnPropertyDescriptor, kn = (e, t,
|
|
1227
|
-
for (var r =
|
|
1228
|
-
(o = e[i]) && (r = (
|
|
1229
|
-
return
|
|
1230
|
-
}, Te = (e, t) => (
|
|
1228
|
+
var Fn = Object.defineProperty, Wn = Object.getOwnPropertyDescriptor, kn = (e, t, s, n) => {
|
|
1229
|
+
for (var r = n > 1 ? void 0 : n ? Wn(t, s) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1230
|
+
(o = e[i]) && (r = (n ? o(t, s, r) : o(r)) || r);
|
|
1231
|
+
return n && r && Fn(t, s, r), r;
|
|
1232
|
+
}, Te = (e, t) => (s, n) => t(s, n, e);
|
|
1231
1233
|
const Gn = {};
|
|
1232
1234
|
let G = class extends z {
|
|
1233
|
-
constructor(e, t,
|
|
1234
|
-
super(), this._config = e, this._injector = t, this._componentManager =
|
|
1235
|
+
constructor(e, t, s, n) {
|
|
1236
|
+
super(), this._config = e, this._injector = t, this._componentManager = s, this._menuService = n, this._initMenu();
|
|
1235
1237
|
}
|
|
1236
1238
|
_initMenu() {
|
|
1237
1239
|
const { menu: e = {} } = this._config;
|
|
@@ -1246,11 +1248,11 @@ G = kn([
|
|
|
1246
1248
|
Te(2, S(ze)),
|
|
1247
1249
|
Te(3, S(At))
|
|
1248
1250
|
], G);
|
|
1249
|
-
var ot = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Kn = (e, t,
|
|
1250
|
-
for (var r =
|
|
1251
|
-
(o = e[i]) && (r = (
|
|
1252
|
-
return
|
|
1253
|
-
}, qn = (e, t) => (
|
|
1251
|
+
var ot = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Kn = (e, t, s) => t in e ? ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, Yn = (e, t, s, n) => {
|
|
1252
|
+
for (var r = n > 1 ? void 0 : n ? zn(t, s) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1253
|
+
(o = e[i]) && (r = (n ? o(t, s, r) : o(r)) || r);
|
|
1254
|
+
return n && r && ot(t, s, r), r;
|
|
1255
|
+
}, qn = (e, t) => (s, n) => t(s, n, e), ct = (e, t, s) => Kn(e, typeof t != "symbol" ? t + "" : t, s);
|
|
1254
1256
|
let he = class extends bt {
|
|
1255
1257
|
constructor(e = {}, t) {
|
|
1256
1258
|
super(), this._config = e, this._injector = t, this._config = yt.deepMerge({}, Gn, this._config);
|