@univerjs/sheets-numfmt 0.1.16 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +389 -376
- package/lib/locale/en-US.json +1 -1
- package/lib/types/context/user-habit.d.ts +0 -1
- package/lib/types/controllers/__tests__/test.util.d.ts +6 -6
- package/lib/types/controllers/numfmt.editor.controller.d.ts +2 -2
- package/lib/types/index.d.ts +7 -1
- package/lib/umd/index.js +2 -2
- package/package.json +22 -22
package/lib/es/index.js
CHANGED
|
@@ -1,64 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var ie = (e, t,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { SheetSkeletonManagerService as
|
|
8
|
-
import { switchMap as
|
|
1
|
+
var dt = Object.defineProperty;
|
|
2
|
+
var ft = (e, t, r) => t in e ? dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var ie = (e, t, r) => ft(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { LocaleType as ht, Disposable as z, ObjectMatrix as Le, CellValueType as V, Range as R, UniverInstanceType as T, OnLifecycle as K, LifecycleStages as B, ThemeService as Fe, ICommandService as O, LocaleService as E, IUniverInstanceService as w, CommandType as D, IUndoRedoService as pt, sequenceExecute as vt, 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
|
+
import { Inject as b, createIdentifier as Tt, Injector as Me, Optional as It } from "@wendellhu/redi";
|
|
6
|
+
import { INTERCEPTOR_POINT as We, SetNumfmtMutation as Y, SetRangeValuesMutation as Et, SheetInterceptorService as Pe, INumfmtService as H, getSheetCommandTarget as Re, transformCellsToRange as ke, rangeMerge as Ae, factorySetNumfmtUndoMutation as Ge, RemoveNumfmtMutation as pe, factoryRemoveNumfmtUndoMutation as ze, SelectionManagerService as U, SetRangeValuesCommand as Nt, WorkbookEditablePermission as q, WorksheetEditPermission as J, WorksheetSetCellStylePermission as Z, RangeProtectionPermissionEditPoint as Q, UniverSheetsPlugin as Mt } from "@univerjs/sheets";
|
|
7
|
+
import { SheetSkeletonManagerService as Pt, IEditorBridgeService as Rt, getCurrentRangeDisable$ as X, deriveStateFromActiveSheet$ as xt, UniverSheetsUIPlugin as Ot } from "@univerjs/sheets-ui";
|
|
8
|
+
import { switchMap as jt, of as $t, skip as wt, Observable as k, combineLatest as Dt, merge as Ut } from "rxjs";
|
|
9
9
|
import x from "@univerjs/engine-numfmt";
|
|
10
|
-
import { IRenderManagerService as
|
|
11
|
-
import { ComponentManager as
|
|
12
|
-
import { map as
|
|
13
|
-
import
|
|
14
|
-
import { InputNumber as Oe, Select as je, SelectList as $e, Button as
|
|
15
|
-
import { useDependency as N, useInjector as
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
type: w.COMMAND,
|
|
19
|
-
handler: (e, t) => {
|
|
20
|
-
if (!t)
|
|
21
|
-
return !1;
|
|
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 = {
|
|
25
|
-
unitId: o,
|
|
26
|
-
subUnitId: c,
|
|
27
|
-
ranges: f.map((h) => ({
|
|
28
|
-
startColumn: h.col,
|
|
29
|
-
startRow: h.row,
|
|
30
|
-
endColumn: h.col,
|
|
31
|
-
endRow: h.row
|
|
32
|
-
}))
|
|
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({
|
|
39
|
-
id: Y.id,
|
|
40
|
-
params: m
|
|
41
|
-
});
|
|
42
|
-
const h = We(e, m);
|
|
43
|
-
p.push(...h);
|
|
44
|
-
}
|
|
45
|
-
if (f.length) {
|
|
46
|
-
l.ranges = Le(l.ranges), u.push({
|
|
47
|
-
id: pe.id,
|
|
48
|
-
params: l
|
|
49
|
-
});
|
|
50
|
-
const h = ke(e, l);
|
|
51
|
-
p.push(...h);
|
|
52
|
-
}
|
|
53
|
-
const _ = ht(u, s).result;
|
|
54
|
-
return _ && r.pushUndoRedo({
|
|
55
|
-
unitID: o,
|
|
56
|
-
undoMutations: p,
|
|
57
|
-
redoMutations: u
|
|
58
|
-
}), _;
|
|
59
|
-
}
|
|
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 });
|
|
10
|
+
import { IRenderManagerService as Lt, ITextSelectionRenderManager as At } from "@univerjs/engine-render";
|
|
11
|
+
import { ComponentManager as Ke, ISidebarService as Vt, MenuItemType as ee, MenuGroup as te, MenuPosition as ne, getMenuHiddenObservable as re, IMenuService as Bt } from "@univerjs/ui";
|
|
12
|
+
import { map as Ht, switchMap as Ft, tap as Wt, debounceTime as kt } from "rxjs/operators";
|
|
13
|
+
import Gt, { createContext as zt, useState as I, useEffect as xe, useRef as Ye, useContext as qe, useMemo as P, createElement as Kt } from "react";
|
|
14
|
+
import { InputNumber as Oe, Select as je, SelectList as $e, Button as Ve } from "@univerjs/design";
|
|
15
|
+
import { useDependency as N, useInjector as Yt } from "@wendellhu/redi/react-bindings";
|
|
16
|
+
const Ee = "SHEET_NUMFMT_PLUGIN", me = (e) => x.getInfo(e).type || "unknown", we = (e, t, r) => {
|
|
17
|
+
const n = x.getInfo(e), s = r === ht.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], o = x.format(e, t, { locale: s });
|
|
62
18
|
return t < 0 ? {
|
|
63
19
|
result: o,
|
|
64
20
|
color: i.color
|
|
@@ -66,27 +22,27 @@ const $ = {
|
|
|
66
22
|
result: o
|
|
67
23
|
};
|
|
68
24
|
};
|
|
69
|
-
var
|
|
70
|
-
for (var
|
|
71
|
-
(o = e[i]) && (
|
|
72
|
-
return n &&
|
|
73
|
-
}, A = (e, t) => (
|
|
25
|
+
var qt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Zt = (e, t, r, n) => {
|
|
26
|
+
for (var s = n > 1 ? void 0 : n ? Jt(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
27
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
28
|
+
return n && s && qt(t, r, s), s;
|
|
29
|
+
}, A = (e, t) => (r, n) => t(r, n, e);
|
|
74
30
|
let oe = class extends z {
|
|
75
|
-
constructor(e, t,
|
|
76
|
-
super(), this._instanceService = e, this._sheetInterceptorService = t, this._themeService =
|
|
31
|
+
constructor(e, t, r, n, s, i) {
|
|
32
|
+
super(), this._instanceService = e, this._sheetInterceptorService = t, this._themeService = r, this._commandService = n, this._numfmtService = s, this._localeService = i, this._initInterceptorCellContent();
|
|
77
33
|
}
|
|
78
34
|
_initInterceptorCellContent() {
|
|
79
|
-
const e = new
|
|
80
|
-
this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
81
|
-
handler: (t,
|
|
82
|
-
const
|
|
35
|
+
const e = new Le();
|
|
36
|
+
this.disposeWithMe(this._sheetInterceptorService.intercept(We.CELL_CONTENT, {
|
|
37
|
+
handler: (t, r, n) => {
|
|
38
|
+
const s = r.unitId, i = r.subUnitId, o = this._numfmtService.getValue(s, i, r.row, r.col);
|
|
83
39
|
if (!o)
|
|
84
40
|
return n(t);
|
|
85
41
|
const c = t;
|
|
86
42
|
if (!c || c.t !== V.NUMBER)
|
|
87
43
|
return n(t);
|
|
88
44
|
let a = "";
|
|
89
|
-
const f = e.getValue(
|
|
45
|
+
const f = e.getValue(r.row, r.col);
|
|
90
46
|
if (f && f.parameters === c.v)
|
|
91
47
|
return n({ ...t, ...f.result });
|
|
92
48
|
const m = we(o.pattern, Number(c.v), this._localeService.getCurrentLocale());
|
|
@@ -97,7 +53,7 @@ let oe = class extends z {
|
|
|
97
53
|
const u = this._themeService.getCurrentTheme()[`${m.color}500`];
|
|
98
54
|
u && (l.interceptorStyle = { cl: { rgb: u } });
|
|
99
55
|
}
|
|
100
|
-
return e.setValue(
|
|
56
|
+
return e.setValue(r.row, r.col, {
|
|
101
57
|
result: l,
|
|
102
58
|
parameters: c.v
|
|
103
59
|
}), n({ ...t, ...l });
|
|
@@ -105,34 +61,39 @@ let oe = class extends z {
|
|
|
105
61
|
priority: 10
|
|
106
62
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
|
|
107
63
|
if (t.id === Y.id) {
|
|
108
|
-
const
|
|
109
|
-
Object.keys(
|
|
110
|
-
|
|
64
|
+
const r = t.params;
|
|
65
|
+
Object.keys(r.values).forEach((n) => {
|
|
66
|
+
r.values[n].ranges.forEach((i) => {
|
|
111
67
|
R.foreach(i, (o, c) => {
|
|
112
68
|
e.realDeleteValue(o, c);
|
|
113
69
|
});
|
|
114
70
|
});
|
|
115
71
|
});
|
|
72
|
+
} else if (t.id === Et.id) {
|
|
73
|
+
const r = t.params;
|
|
74
|
+
new Le(r.cellValue).forValue((n, s) => {
|
|
75
|
+
e.realDeleteValue(n, s);
|
|
76
|
+
});
|
|
116
77
|
}
|
|
117
78
|
})), this.disposeWithMe(
|
|
118
79
|
this._instanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).pipe(
|
|
119
|
-
|
|
120
|
-
var
|
|
121
|
-
return (
|
|
80
|
+
jt((t) => {
|
|
81
|
+
var r;
|
|
82
|
+
return (r = t == null ? void 0 : t.activeSheet$) != null ? r : $t(null);
|
|
122
83
|
}),
|
|
123
|
-
|
|
84
|
+
wt(1)
|
|
124
85
|
).subscribe(() => e.reset())
|
|
125
86
|
);
|
|
126
87
|
}
|
|
127
88
|
};
|
|
128
|
-
oe =
|
|
89
|
+
oe = Zt([
|
|
129
90
|
K(B.Rendered, oe),
|
|
130
|
-
A(0,
|
|
131
|
-
A(1,
|
|
132
|
-
A(2,
|
|
133
|
-
A(3,
|
|
134
|
-
A(4,
|
|
135
|
-
A(5,
|
|
91
|
+
A(0, w),
|
|
92
|
+
A(1, b(Pe)),
|
|
93
|
+
A(2, b(Fe)),
|
|
94
|
+
A(3, b(O)),
|
|
95
|
+
A(4, b(H)),
|
|
96
|
+
A(5, b(E))
|
|
136
97
|
], oe);
|
|
137
98
|
const j = (e, t = 0) => {
|
|
138
99
|
var n;
|
|
@@ -140,7 +101,7 @@ const j = (e, t = 0) => {
|
|
|
140
101
|
}, ve = (e, t) => {
|
|
141
102
|
if (e && !t || !e && t)
|
|
142
103
|
return !1;
|
|
143
|
-
const
|
|
104
|
+
const r = (f) => f.reduce(
|
|
144
105
|
(m, l) => {
|
|
145
106
|
if (m.isEnd)
|
|
146
107
|
return m;
|
|
@@ -148,22 +109,66 @@ const j = (e, t = 0) => {
|
|
|
148
109
|
return l.type === "point" ? (m.isEnd = !0, m) : { ...m, result: m.result + u };
|
|
149
110
|
},
|
|
150
111
|
{ isEnd: !1, result: "" }
|
|
151
|
-
).result, n = x.getInfo(e)._partitions,
|
|
152
|
-
return i === o && c === a && n[1].color ===
|
|
153
|
-
},
|
|
112
|
+
).result, n = x.getInfo(e)._partitions, s = x.getInfo(t)._partitions, i = r(n[0].tokens), o = r(s[0].tokens), c = r(n[1].tokens), a = r(s[1].tokens);
|
|
113
|
+
return i === o && c === a && n[1].color === s[1].color;
|
|
114
|
+
}, Be = (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(
|
|
154
115
|
/\.0*/g,
|
|
155
|
-
`${t > 0 ? "." : ""}${
|
|
116
|
+
`${t > 0 ? "." : ""}${Be(Number(t || 0))}`
|
|
156
117
|
) : /0([^0]?)|0$/.test(n) ? n.replace(
|
|
157
118
|
/0([^0]+)|0$/,
|
|
158
|
-
`0${t > 0 ? "." : ""}${
|
|
159
|
-
) : n).join(";"),
|
|
119
|
+
`0${t > 0 ? "." : ""}${Be(Number(t || 0))}$1`
|
|
120
|
+
) : n).join(";"), Qt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), $ = {
|
|
121
|
+
id: "sheet.command.numfmt.set.numfmt",
|
|
122
|
+
type: D.COMMAND,
|
|
123
|
+
handler: (e, t) => {
|
|
124
|
+
if (!t)
|
|
125
|
+
return !1;
|
|
126
|
+
const r = e.get(O), n = e.get(w), s = e.get(pt), i = Re(n, t);
|
|
127
|
+
if (!i) return !1;
|
|
128
|
+
const { unitId: o, subUnitId: c } = i, a = t.values.filter((h) => !!h.pattern), f = t.values.filter((h) => !h.pattern), m = ke(o, c, a), l = {
|
|
129
|
+
unitId: o,
|
|
130
|
+
subUnitId: c,
|
|
131
|
+
ranges: f.map((h) => ({
|
|
132
|
+
startColumn: h.col,
|
|
133
|
+
startRow: h.row,
|
|
134
|
+
endColumn: h.col,
|
|
135
|
+
endRow: h.row
|
|
136
|
+
}))
|
|
137
|
+
}, u = [], p = [];
|
|
138
|
+
if (a.length) {
|
|
139
|
+
Object.keys(m.values).forEach((v) => {
|
|
140
|
+
const g = m.values[v];
|
|
141
|
+
g.ranges = Ae(g.ranges);
|
|
142
|
+
}), u.push({
|
|
143
|
+
id: Y.id,
|
|
144
|
+
params: m
|
|
145
|
+
});
|
|
146
|
+
const h = Ge(e, m);
|
|
147
|
+
p.push(...h);
|
|
148
|
+
}
|
|
149
|
+
if (f.length) {
|
|
150
|
+
l.ranges = Ae(l.ranges), u.push({
|
|
151
|
+
id: pe.id,
|
|
152
|
+
params: l
|
|
153
|
+
});
|
|
154
|
+
const h = ze(e, l);
|
|
155
|
+
p.push(...h);
|
|
156
|
+
}
|
|
157
|
+
const _ = vt(u, r).result;
|
|
158
|
+
return _ && s.pushUndoRedo({
|
|
159
|
+
unitID: o,
|
|
160
|
+
undoMutations: p,
|
|
161
|
+
redoMutations: u
|
|
162
|
+
}), _;
|
|
163
|
+
}
|
|
164
|
+
}, Je = {
|
|
160
165
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
161
|
-
type:
|
|
166
|
+
type: D.COMMAND,
|
|
162
167
|
handler: async (e) => {
|
|
163
|
-
const t = e.get(O),
|
|
168
|
+
const t = e.get(O), r = e.get(U), n = e.get(H), s = e.get(w), i = r.getSelections();
|
|
164
169
|
if (!i || !i.length)
|
|
165
170
|
return !1;
|
|
166
|
-
const o =
|
|
171
|
+
const o = Re(s);
|
|
167
172
|
if (!o) return !1;
|
|
168
173
|
const { unitId: c, subUnitId: a } = o;
|
|
169
174
|
let f = 0;
|
|
@@ -187,17 +192,17 @@ const j = (e, t = 0) => {
|
|
|
187
192
|
pattern: l
|
|
188
193
|
});
|
|
189
194
|
else {
|
|
190
|
-
const g = j(v.pattern),
|
|
191
|
-
|
|
195
|
+
const g = j(v.pattern), S = C(v.pattern, g + 1);
|
|
196
|
+
S !== v.pattern && u.push({
|
|
192
197
|
row: _,
|
|
193
198
|
col: h,
|
|
194
|
-
pattern:
|
|
199
|
+
pattern: S
|
|
195
200
|
});
|
|
196
201
|
}
|
|
197
202
|
});
|
|
198
203
|
}), u.length ? await t.executeCommand($.id, { values: u }) : !1;
|
|
199
204
|
}
|
|
200
|
-
},
|
|
205
|
+
}, Xt = [
|
|
201
206
|
{
|
|
202
207
|
label: "1930-08-05",
|
|
203
208
|
suffix: "yyyy-MM-dd"
|
|
@@ -242,7 +247,7 @@ const j = (e, t = 0) => {
|
|
|
242
247
|
label: "08-05 下午 01:30",
|
|
243
248
|
suffix: "MM-dd A/P hh:mm"
|
|
244
249
|
}
|
|
245
|
-
],
|
|
250
|
+
], en = [
|
|
246
251
|
{
|
|
247
252
|
label: "(1,235)",
|
|
248
253
|
suffix: "#,##0_);(#,##0)"
|
|
@@ -270,7 +275,7 @@ const j = (e, t = 0) => {
|
|
|
270
275
|
suffix: "#,##0.00_);[Red]-#,##0.00",
|
|
271
276
|
color: "red"
|
|
272
277
|
}
|
|
273
|
-
],
|
|
278
|
+
], Ze = [
|
|
274
279
|
{
|
|
275
280
|
label: (e) => `${e}1,235`,
|
|
276
281
|
suffix: (e) => `"${e}"#,##0.00_);"${e}"#,##0.00`
|
|
@@ -298,28 +303,28 @@ const j = (e, t = 0) => {
|
|
|
298
303
|
suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
|
|
299
304
|
color: "red"
|
|
300
305
|
}
|
|
301
|
-
],
|
|
306
|
+
], Qe = {
|
|
302
307
|
id: "sheet.command.numfmt.set.currency",
|
|
303
|
-
type:
|
|
308
|
+
type: D.COMMAND,
|
|
304
309
|
handler: async (e) => {
|
|
305
310
|
const t = e.get(O), n = e.get(U).getSelections();
|
|
306
311
|
if (!n || !n.length)
|
|
307
312
|
return !1;
|
|
308
|
-
const
|
|
313
|
+
const s = [], i = Ze[0].suffix("¥");
|
|
309
314
|
return n.forEach((c) => {
|
|
310
315
|
R.foreach(c.range, (a, f) => {
|
|
311
|
-
|
|
316
|
+
s.push({ row: a, col: f, pattern: i, type: "currency" });
|
|
312
317
|
});
|
|
313
|
-
}), await t.executeCommand($.id, { values:
|
|
318
|
+
}), await t.executeCommand($.id, { values: s });
|
|
314
319
|
}
|
|
315
|
-
},
|
|
320
|
+
}, Xe = {
|
|
316
321
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
317
|
-
type:
|
|
322
|
+
type: D.COMMAND,
|
|
318
323
|
handler: async (e) => {
|
|
319
|
-
const t = e.get(O),
|
|
324
|
+
const t = e.get(O), r = e.get(U), n = e.get(H), s = e.get(w), i = r.getSelections();
|
|
320
325
|
if (!i || !i.length)
|
|
321
326
|
return !1;
|
|
322
|
-
const o =
|
|
327
|
+
const o = Re(s);
|
|
323
328
|
if (!o) return !1;
|
|
324
329
|
const { unitId: c, subUnitId: a } = o;
|
|
325
330
|
let f = 0;
|
|
@@ -328,8 +333,8 @@ const j = (e, t = 0) => {
|
|
|
328
333
|
const g = n.getValue(c, a, h, v);
|
|
329
334
|
if (!g)
|
|
330
335
|
return;
|
|
331
|
-
const
|
|
332
|
-
f =
|
|
336
|
+
const S = j(g.pattern);
|
|
337
|
+
f = S > f ? S : f;
|
|
333
338
|
});
|
|
334
339
|
});
|
|
335
340
|
const m = f - 1, l = C(`0${m > 0 ? ".0" : "."}`, m), u = [];
|
|
@@ -343,11 +348,11 @@ const j = (e, t = 0) => {
|
|
|
343
348
|
pattern: l
|
|
344
349
|
});
|
|
345
350
|
else {
|
|
346
|
-
const
|
|
351
|
+
const S = j(g.pattern);
|
|
347
352
|
u.push({
|
|
348
353
|
row: h,
|
|
349
354
|
col: v,
|
|
350
|
-
pattern: C(g.pattern,
|
|
355
|
+
pattern: C(g.pattern, S - 1)
|
|
351
356
|
});
|
|
352
357
|
}
|
|
353
358
|
});
|
|
@@ -355,19 +360,19 @@ const j = (e, t = 0) => {
|
|
|
355
360
|
}
|
|
356
361
|
}, ye = {
|
|
357
362
|
id: "sheet.operation.close.numfmt.panel",
|
|
358
|
-
type:
|
|
363
|
+
type: D.OPERATION,
|
|
359
364
|
handler: () => (
|
|
360
365
|
// do nothing,just notify panel is closed
|
|
361
366
|
!0
|
|
362
367
|
)
|
|
363
|
-
}, De =
|
|
368
|
+
}, De = Tt("INumfmtController");
|
|
364
369
|
_t(B.Rendered, De);
|
|
365
370
|
const de = {
|
|
366
371
|
id: "sheet.operation.open.numfmt.panel",
|
|
367
|
-
type:
|
|
372
|
+
type: D.OPERATION,
|
|
368
373
|
handler: (e) => (e.get(De).openPanel(), !0)
|
|
369
374
|
};
|
|
370
|
-
var
|
|
375
|
+
var et = { exports: {} }, _e = {};
|
|
371
376
|
/**
|
|
372
377
|
* @license React
|
|
373
378
|
* react-jsx-runtime.production.min.js
|
|
@@ -377,20 +382,20 @@ var Xe = { exports: {} }, _e = {};
|
|
|
377
382
|
* This source code is licensed under the MIT license found in the
|
|
378
383
|
* LICENSE file in the root directory of this source tree.
|
|
379
384
|
*/
|
|
380
|
-
var
|
|
381
|
-
function
|
|
382
|
-
var n,
|
|
383
|
-
|
|
384
|
-
for (n in t)
|
|
385
|
-
if (e && e.defaultProps) for (n in t = e.defaultProps, t)
|
|
386
|
-
return { $$typeof:
|
|
385
|
+
var tn = Gt, nn = Symbol.for("react.element"), rn = Symbol.for("react.fragment"), sn = Object.prototype.hasOwnProperty, on = tn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, cn = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
386
|
+
function tt(e, t, r) {
|
|
387
|
+
var n, s = {}, i = null, o = null;
|
|
388
|
+
r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (o = t.ref);
|
|
389
|
+
for (n in t) sn.call(t, n) && !cn.hasOwnProperty(n) && (s[n] = t[n]);
|
|
390
|
+
if (e && e.defaultProps) for (n in t = e.defaultProps, t) s[n] === void 0 && (s[n] = t[n]);
|
|
391
|
+
return { $$typeof: nn, type: e, key: i, ref: o, props: s, _owner: on.current };
|
|
387
392
|
}
|
|
388
|
-
_e.Fragment =
|
|
389
|
-
_e.jsx =
|
|
390
|
-
_e.jsxs =
|
|
391
|
-
|
|
392
|
-
var d =
|
|
393
|
-
const Ue =
|
|
393
|
+
_e.Fragment = rn;
|
|
394
|
+
_e.jsx = tt;
|
|
395
|
+
_e.jsxs = tt;
|
|
396
|
+
et.exports = _e;
|
|
397
|
+
var d = et.exports;
|
|
398
|
+
const Ue = zt([]), Ne = [
|
|
394
399
|
"$",
|
|
395
400
|
"£",
|
|
396
401
|
"¥",
|
|
@@ -419,11 +424,11 @@ const Ue = kt([]), Ne = [
|
|
|
419
424
|
"₾",
|
|
420
425
|
"₿"
|
|
421
426
|
];
|
|
422
|
-
var
|
|
423
|
-
for (var
|
|
424
|
-
(o = e[i]) && (
|
|
425
|
-
return n &&
|
|
426
|
-
},
|
|
427
|
+
var an = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, un = (e, t, r, n) => {
|
|
428
|
+
for (var s = n > 1 ? void 0 : n ? ln(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
429
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
430
|
+
return n && s && an(t, r, s), s;
|
|
431
|
+
}, mn = (e, t) => (r, n) => t(r, n, e);
|
|
427
432
|
let fe = class {
|
|
428
433
|
constructor(e) {
|
|
429
434
|
this._localStorageService = e;
|
|
@@ -432,24 +437,24 @@ let fe = class {
|
|
|
432
437
|
return `userHabitController_${e}`;
|
|
433
438
|
}
|
|
434
439
|
async addHabit(e, t) {
|
|
435
|
-
const
|
|
436
|
-
return this._localStorageService.getItem(
|
|
437
|
-
n || this._localStorageService.setItem(
|
|
440
|
+
const r = this._getKey(e);
|
|
441
|
+
return this._localStorageService.getItem(r).then((n) => {
|
|
442
|
+
n || this._localStorageService.setItem(r, t);
|
|
438
443
|
});
|
|
439
444
|
}
|
|
440
445
|
markHabit(e, t) {
|
|
441
|
-
const
|
|
442
|
-
this._localStorageService.getItem(
|
|
446
|
+
const r = this._getKey(e);
|
|
447
|
+
this._localStorageService.getItem(r).then((n) => {
|
|
443
448
|
if (n) {
|
|
444
|
-
const
|
|
445
|
-
|
|
449
|
+
const s = n.findIndex((i) => i === t);
|
|
450
|
+
s > -1 && n.splice(s, 1), n.unshift(t), this._localStorageService.setItem(r, n);
|
|
446
451
|
}
|
|
447
452
|
});
|
|
448
453
|
}
|
|
449
454
|
async getHabit(e, t) {
|
|
450
|
-
const
|
|
455
|
+
const r = this._getKey(e), n = await this._localStorageService.getItem(r);
|
|
451
456
|
if (t && n) {
|
|
452
|
-
const
|
|
457
|
+
const s = n.map((i, o, c) => {
|
|
453
458
|
const a = c.length;
|
|
454
459
|
return {
|
|
455
460
|
value: i,
|
|
@@ -458,8 +463,8 @@ let fe = class {
|
|
|
458
463
|
});
|
|
459
464
|
return t.sort((i, o) => {
|
|
460
465
|
var f, m;
|
|
461
|
-
const c = ((f =
|
|
462
|
-
return (((m =
|
|
466
|
+
const c = ((f = s.find((l) => l.value === i)) == null ? void 0 : f.priority) || -1;
|
|
467
|
+
return (((m = s.find((l) => l.value === o)) == null ? void 0 : m.priority) || -1) - c;
|
|
463
468
|
});
|
|
464
469
|
}
|
|
465
470
|
return n || [];
|
|
@@ -468,37 +473,37 @@ let fe = class {
|
|
|
468
473
|
this._localStorageService.removeItem(e);
|
|
469
474
|
}
|
|
470
475
|
};
|
|
471
|
-
fe =
|
|
472
|
-
|
|
476
|
+
fe = un([
|
|
477
|
+
mn(0, b(gt))
|
|
473
478
|
], fe);
|
|
474
|
-
const
|
|
475
|
-
const t = N(fe), [
|
|
479
|
+
const He = "numfmtCurrency", dn = (e) => {
|
|
480
|
+
const t = N(fe), [r, n] = I(Ne);
|
|
476
481
|
return xe(() => {
|
|
477
482
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
478
|
-
t.getHabit(
|
|
483
|
+
t.getHabit(He, [...Ne]).then((i) => {
|
|
479
484
|
n(i), e && e(i);
|
|
480
485
|
});
|
|
481
486
|
});
|
|
482
|
-
}, []), { userHabitCurrency:
|
|
483
|
-
t.markHabit(
|
|
487
|
+
}, []), { userHabitCurrency: r, mark: (i) => {
|
|
488
|
+
t.markHabit(He, i);
|
|
484
489
|
} };
|
|
485
|
-
},
|
|
486
|
-
const e =
|
|
490
|
+
}, fn = () => {
|
|
491
|
+
const e = Ye([]), [t, r] = I({});
|
|
487
492
|
return xe(() => {
|
|
488
|
-
e.current.forEach((
|
|
489
|
-
|
|
493
|
+
e.current.forEach((s) => {
|
|
494
|
+
s();
|
|
490
495
|
}), e.current = [];
|
|
491
|
-
}, [t]), (
|
|
492
|
-
e.current.push(
|
|
496
|
+
}, [t]), (s) => {
|
|
497
|
+
e.current.push(s), r({});
|
|
493
498
|
};
|
|
494
|
-
},
|
|
495
|
-
const [t,
|
|
496
|
-
e.action.current = () => C(`_("${
|
|
499
|
+
}, se = (e) => Ne.find((r) => e.includes(r)), hn = (e) => !!se(e) && e.startsWith("_("), pn = (e) => {
|
|
500
|
+
const [t, r] = I(() => j(e.defaultPattern || "", 2)), n = qe(Ue), [s, i] = I(() => se(e.defaultPattern) || n[0]), o = P(() => n.map((l) => ({ label: l, value: l })), []), a = N(E).t;
|
|
501
|
+
e.action.current = () => C(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
|
|
497
502
|
const f = (l) => {
|
|
498
503
|
i(l), e.onChange(C(`_("${l}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
|
|
499
504
|
}, m = (l) => {
|
|
500
505
|
const u = l || 0;
|
|
501
|
-
|
|
506
|
+
r(u), e.onChange(C(`_("${s}"* #,##0${u > 0 ? ".0" : ""}_)`, u));
|
|
502
507
|
};
|
|
503
508
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
504
509
|
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
@@ -508,51 +513,53 @@ const Be = "numfmtCurrency", un = (e) => {
|
|
|
508
513
|
] }),
|
|
509
514
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
510
515
|
/* @__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:
|
|
516
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange: f, options: o, value: s }) })
|
|
512
517
|
] })
|
|
513
518
|
] }),
|
|
514
519
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: a("sheet.numfmt.accountingDes") })
|
|
515
520
|
] });
|
|
516
|
-
}, Ce = (e) =>
|
|
521
|
+
}, Ce = (e) => Ze.map((t) => ({
|
|
517
522
|
label: t.label(e),
|
|
518
523
|
value: t.suffix(e),
|
|
519
524
|
color: t.color
|
|
520
|
-
})),
|
|
521
|
-
const
|
|
525
|
+
})), nt = () => Xt.map((e) => ({ label: e.label, value: e.suffix })), rt = () => en.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), vn = (e) => !!se(e) && !e.startsWith("_("), _n = (e) => {
|
|
526
|
+
const r = N(E).t, n = qe(Ue), [s, i] = I(() => se(e.defaultPattern) || n[0]), [o, c] = I(() => j(e.defaultPattern || "", 2)), [a, f] = I(() => {
|
|
522
527
|
var g;
|
|
523
|
-
const h = Ce(
|
|
524
|
-
return ((g = h.find((
|
|
525
|
-
}), m = P(() => Ce(
|
|
528
|
+
const h = Ce(s);
|
|
529
|
+
return ((g = h.find((S) => ve(S.value, e.defaultPattern))) == null ? void 0 : g.value) || h[0].value;
|
|
530
|
+
}), m = P(() => Ce(s), [s]), l = P(() => n.map((h) => ({ label: h, value: h })), [n]);
|
|
526
531
|
e.action.current = () => C(a, o);
|
|
527
532
|
const u = (h) => {
|
|
533
|
+
if (h === void 0)
|
|
534
|
+
return;
|
|
528
535
|
i(h);
|
|
529
536
|
const v = Ce(h)[0].value;
|
|
530
537
|
f(v), e.onChange(C(v, o));
|
|
531
538
|
}, p = (h) => {
|
|
532
|
-
f(h), e.onChange(C(h, o));
|
|
539
|
+
h !== void 0 && (f(h), e.onChange(C(h, o)));
|
|
533
540
|
}, _ = (h) => {
|
|
534
541
|
c(h || 0), e.onChange(C(a, h || 0));
|
|
535
542
|
};
|
|
536
543
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
537
544
|
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
538
545
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
539
|
-
/* @__PURE__ */ d.jsx("div", { className: "label", children:
|
|
546
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
|
|
540
547
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(Oe, { value: o, max: 20, min: 0, onChange: _ }) })
|
|
541
548
|
] }),
|
|
542
549
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
543
|
-
/* @__PURE__ */ d.jsx("div", { className: "label", children:
|
|
544
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange: u, options: l, value:
|
|
550
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
|
|
551
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(je, { onChange: u, options: l, value: s }) })
|
|
545
552
|
] })
|
|
546
553
|
] }),
|
|
547
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children:
|
|
554
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
|
|
548
555
|
/* @__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:
|
|
556
|
+
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
|
|
550
557
|
] });
|
|
551
|
-
},
|
|
558
|
+
}, gn = (e) => {
|
|
552
559
|
const t = x.getInfo(e);
|
|
553
|
-
return
|
|
554
|
-
},
|
|
555
|
-
const t = P(
|
|
560
|
+
return nt().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
561
|
+
}, Sn = (e) => {
|
|
562
|
+
const t = P(nt, []), n = N(E).t, [s, i] = I(() => {
|
|
556
563
|
if (e.defaultPattern) {
|
|
557
564
|
const c = t.find((a) => a.value === e.defaultPattern);
|
|
558
565
|
if (c)
|
|
@@ -560,26 +567,26 @@ const Be = "numfmtCurrency", un = (e) => {
|
|
|
560
567
|
}
|
|
561
568
|
return t[0].value;
|
|
562
569
|
});
|
|
563
|
-
e.action.current = () =>
|
|
570
|
+
e.action.current = () => s;
|
|
564
571
|
const o = (c) => {
|
|
565
|
-
i(c), e.onChange(c);
|
|
572
|
+
c !== void 0 && (i(c), e.onChange(c));
|
|
566
573
|
};
|
|
567
574
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
568
575
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
|
|
569
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { value:
|
|
576
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { value: s, options: t, onChange: o }) }),
|
|
570
577
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
|
|
571
578
|
] });
|
|
572
|
-
},
|
|
573
|
-
const
|
|
574
|
-
return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children:
|
|
575
|
-
},
|
|
576
|
-
const t = N(E),
|
|
577
|
-
const l =
|
|
578
|
-
return (l == null ? void 0 : l.value) ||
|
|
579
|
-
}), c = P(() => C(i, Number(n || 0)), [i, n]), a = P(() => !
|
|
580
|
-
|
|
579
|
+
}, bn = (e) => !e, yn = (e) => {
|
|
580
|
+
const r = N(E).t;
|
|
581
|
+
return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
|
|
582
|
+
}, Cn = (e) => rt().some((t) => ve(t.value, e)), Tn = (e) => {
|
|
583
|
+
const t = N(E), r = P(rt, []), [n, s] = I(() => j(e.defaultPattern || "", 0)), [i, o] = I(() => {
|
|
584
|
+
const l = r.find((u) => ve(u.value, e.defaultPattern || ""));
|
|
585
|
+
return (l == null ? void 0 : l.value) || r[0].value;
|
|
586
|
+
}), c = P(() => C(i, Number(n || 0)), [i, n]), a = P(() => !Qt(i), [i]), f = (l) => {
|
|
587
|
+
s(l || 0), e.onChange(C(i, Number(l || 0)));
|
|
581
588
|
}, m = (l) => {
|
|
582
|
-
|
|
589
|
+
l !== void 0 && (s(j(l, 0)), o(l), e.onChange(l));
|
|
583
590
|
};
|
|
584
591
|
return e.action.current = () => c, /* @__PURE__ */ d.jsxs("div", { children: [
|
|
585
592
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
|
|
@@ -597,27 +604,27 @@ const Be = "numfmtCurrency", un = (e) => {
|
|
|
597
604
|
" ",
|
|
598
605
|
t.t("sheet.numfmt.negType")
|
|
599
606
|
] }),
|
|
600
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: m, options:
|
|
607
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: m, options: r, value: i }) }),
|
|
601
608
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
|
|
602
609
|
] });
|
|
603
|
-
},
|
|
604
|
-
const { defaultValue: t, defaultPattern:
|
|
610
|
+
}, In = (e) => {
|
|
611
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(E), o = Ye(() => ""), c = i.t, a = fn(), f = P(
|
|
605
612
|
() => [
|
|
606
|
-
{ label: "sheet.numfmt.general", component:
|
|
607
|
-
{ label: "sheet.numfmt.accounting", component:
|
|
608
|
-
{ label: "sheet.numfmt.currency", component:
|
|
609
|
-
{ label: "sheet.numfmt.date", component:
|
|
610
|
-
{ label: "sheet.numfmt.thousandthPercentile", component:
|
|
613
|
+
{ label: "sheet.numfmt.general", component: yn },
|
|
614
|
+
{ label: "sheet.numfmt.accounting", component: pn },
|
|
615
|
+
{ label: "sheet.numfmt.currency", component: _n },
|
|
616
|
+
{ label: "sheet.numfmt.date", component: Sn },
|
|
617
|
+
{ label: "sheet.numfmt.thousandthPercentile", component: Tn }
|
|
611
618
|
].map((y) => ({ ...y, label: c(y.label) })),
|
|
612
619
|
[]
|
|
613
|
-
), [m, l] = I(g), [u, p] = I(() => `${n}_${
|
|
620
|
+
), [m, l] = I(g), [u, p] = I(() => `${n}_${s}`), { mark: _, userHabitCurrency: h } = dn(() => p(`${n}_${s}_userCurrency'`)), v = P(() => {
|
|
614
621
|
var y;
|
|
615
622
|
return (y = f.find((L) => L.label === m)) == null ? void 0 : y.component;
|
|
616
623
|
}, [m]);
|
|
617
624
|
function g() {
|
|
618
|
-
return [
|
|
625
|
+
return [bn, hn, vn, gn, Cn].reduce((L, ut, mt) => L || (ut(r) ? f[mt].label : ""), "") || f[0].label;
|
|
619
626
|
}
|
|
620
|
-
const
|
|
627
|
+
const S = f.map((y) => ({
|
|
621
628
|
label: y.label,
|
|
622
629
|
value: y.label
|
|
623
630
|
})), F = (y) => {
|
|
@@ -625,51 +632,51 @@ const Be = "numfmtCurrency", un = (e) => {
|
|
|
625
632
|
}, ge = (y) => {
|
|
626
633
|
e.onChange({ type: "change", value: y });
|
|
627
634
|
}, Se = () => {
|
|
628
|
-
const y = o.current() || "", L =
|
|
635
|
+
const y = o.current() || "", L = se(y);
|
|
629
636
|
L && _(L), e.onChange({ type: "confirm", value: y });
|
|
630
637
|
}, be = () => {
|
|
631
638
|
e.onChange({ type: "cancel", value: "" });
|
|
632
|
-
},
|
|
639
|
+
}, lt = {
|
|
633
640
|
onChange: ge,
|
|
634
641
|
defaultValue: t,
|
|
635
|
-
defaultPattern:
|
|
642
|
+
defaultPattern: r,
|
|
636
643
|
action: o
|
|
637
644
|
};
|
|
638
645
|
return xe(() => {
|
|
639
|
-
l(g()), p(`${n}_${
|
|
640
|
-
}, [n,
|
|
646
|
+
l(g()), p(`${n}_${s}`);
|
|
647
|
+
}, [n, s]), /* @__PURE__ */ d.jsxs("div", { className: "numfmt-panel p-b-20", children: [
|
|
641
648
|
/* @__PURE__ */ d.jsxs("div", { children: [
|
|
642
649
|
/* @__PURE__ */ d.jsx("div", { className: "label m-t-14", children: c("sheet.numfmt.numfmtType") }),
|
|
643
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(je, { onChange: F, options:
|
|
644
|
-
/* @__PURE__ */ d.jsx("div", { children: v && /* @__PURE__ */ d.jsx(Ue.Provider, { value: h, children: /* @__PURE__ */
|
|
650
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(je, { onChange: F, options: S, value: m }) }),
|
|
651
|
+
/* @__PURE__ */ d.jsx("div", { children: v && /* @__PURE__ */ d.jsx(Ue.Provider, { value: h, children: /* @__PURE__ */ Kt(v, { ...lt, key: u }) }) })
|
|
645
652
|
] }),
|
|
646
653
|
/* @__PURE__ */ d.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
647
|
-
/* @__PURE__ */ d.jsx(
|
|
648
|
-
/* @__PURE__ */ d.jsx(
|
|
654
|
+
/* @__PURE__ */ d.jsx(Ve, { size: "small", onClick: be, className: "m-r-12", children: c("sheet.numfmt.cancel") }),
|
|
655
|
+
/* @__PURE__ */ d.jsx(Ve, { type: "primary", size: "small", onClick: Se, children: c("sheet.numfmt.confirm") })
|
|
649
656
|
] })
|
|
650
657
|
] });
|
|
651
658
|
}, st = {
|
|
652
659
|
id: "sheet.command.numfmt.set.percent",
|
|
653
|
-
type:
|
|
660
|
+
type: D.COMMAND,
|
|
654
661
|
handler: async (e) => {
|
|
655
662
|
const t = e.get(O), n = e.get(U).getSelections();
|
|
656
663
|
if (!n || !n.length)
|
|
657
664
|
return !1;
|
|
658
|
-
const
|
|
665
|
+
const s = [], i = "0%";
|
|
659
666
|
return n.forEach((c) => {
|
|
660
667
|
R.foreach(c.range, (a, f) => {
|
|
661
|
-
|
|
668
|
+
s.push({ row: a, col: f, pattern: i, type: "percent" });
|
|
662
669
|
});
|
|
663
|
-
}), await t.executeCommand($.id, { values:
|
|
670
|
+
}), await t.executeCommand($.id, { values: s });
|
|
664
671
|
}
|
|
665
672
|
};
|
|
666
|
-
var
|
|
667
|
-
for (var
|
|
668
|
-
(o = e[i]) && (
|
|
669
|
-
return n &&
|
|
670
|
-
}, M = (e, t) => (
|
|
673
|
+
var En = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, Mn = (e, t, r, n) => {
|
|
674
|
+
for (var s = n > 1 ? void 0 : n ? Nn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
675
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
676
|
+
return n && s && En(t, r, s), s;
|
|
677
|
+
}, M = (e, t) => (r, n) => t(r, n, e);
|
|
671
678
|
let ce = class extends z {
|
|
672
|
-
constructor(t,
|
|
679
|
+
constructor(t, r, n, s, i, o, c, a, f, m) {
|
|
673
680
|
super();
|
|
674
681
|
/**
|
|
675
682
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -679,13 +686,13 @@ let ce = class extends z {
|
|
|
679
686
|
*/
|
|
680
687
|
ie(this, "_previewPattern", "");
|
|
681
688
|
ie(this, "_sidebarDisposable", null);
|
|
682
|
-
this._sheetInterceptorService = t, this._themeService =
|
|
689
|
+
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = s, 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();
|
|
683
690
|
}
|
|
684
691
|
openPanel() {
|
|
685
|
-
const t = this._sidebarService,
|
|
692
|
+
const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService, a = (r.getSelectionRanges() || [])[0];
|
|
686
693
|
if (!a)
|
|
687
694
|
return !1;
|
|
688
|
-
const f =
|
|
695
|
+
const f = s.getCurrentUnitForType(T.UNIVER_SHEET), m = f.getActiveSheet();
|
|
689
696
|
if (!m)
|
|
690
697
|
return !1;
|
|
691
698
|
const l = m.getCellRaw(a.startRow, a.startColumn), u = i.getValue(
|
|
@@ -701,17 +708,17 @@ let ce = class extends z {
|
|
|
701
708
|
if (v.type === "change")
|
|
702
709
|
this._previewPattern = v.value, this._forceUpdate();
|
|
703
710
|
else if (v.type === "confirm") {
|
|
704
|
-
const g =
|
|
711
|
+
const g = r.getSelectionRanges() || [], S = { values: [] }, F = me(v.value);
|
|
705
712
|
g.forEach((ge) => {
|
|
706
713
|
R.foreach(ge, (Se, be) => {
|
|
707
|
-
|
|
714
|
+
S.values.push({
|
|
708
715
|
row: Se,
|
|
709
716
|
col: be,
|
|
710
717
|
pattern: v.value,
|
|
711
718
|
type: F
|
|
712
719
|
});
|
|
713
720
|
});
|
|
714
|
-
}), n.executeCommand($.id,
|
|
721
|
+
}), n.executeCommand($.id, S), t.close();
|
|
715
722
|
} else v.type === "cancel" && t.close();
|
|
716
723
|
},
|
|
717
724
|
value: { defaultPattern: p, defaultValue: _, row: a.startRow, col: a.startColumn }
|
|
@@ -730,16 +737,16 @@ let ce = class extends z {
|
|
|
730
737
|
}
|
|
731
738
|
_forceUpdate(t) {
|
|
732
739
|
var n;
|
|
733
|
-
const
|
|
740
|
+
const r = this._renderManagerService.getRenderById(
|
|
734
741
|
t != null ? t : this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId()
|
|
735
742
|
);
|
|
736
|
-
|
|
743
|
+
r == null || r.with(Pt).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
|
|
737
744
|
}
|
|
738
745
|
_initCommands() {
|
|
739
746
|
[
|
|
740
|
-
|
|
747
|
+
Je,
|
|
748
|
+
Xe,
|
|
741
749
|
Qe,
|
|
742
|
-
Ze,
|
|
743
750
|
st,
|
|
744
751
|
de,
|
|
745
752
|
ye,
|
|
@@ -749,42 +756,42 @@ let ce = class extends z {
|
|
|
749
756
|
});
|
|
750
757
|
}
|
|
751
758
|
_initPanel() {
|
|
752
|
-
this._componentManager.register(Ee,
|
|
759
|
+
this._componentManager.register(Ee, In);
|
|
753
760
|
}
|
|
754
761
|
_initRealTimeRenderingInterceptor() {
|
|
755
762
|
const t = new k((n) => {
|
|
756
|
-
this._commandService.onCommandExecuted((
|
|
757
|
-
|
|
763
|
+
this._commandService.onCommandExecuted((s) => {
|
|
764
|
+
s.id === de.id && n.next(!0), s.id === ye.id && n.next(!1);
|
|
758
765
|
});
|
|
759
|
-
}),
|
|
766
|
+
}), r = Dt([
|
|
760
767
|
t,
|
|
761
768
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
762
|
-
|
|
769
|
+
Ht((n) => n ? n.map((s) => s.range) : [])
|
|
763
770
|
)
|
|
764
771
|
]);
|
|
765
772
|
this.disposeWithMe(
|
|
766
773
|
Ie(
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
([n,
|
|
774
|
+
r.pipe(
|
|
775
|
+
Ft(
|
|
776
|
+
([n, s]) => new k((i) => {
|
|
770
777
|
const o = new St();
|
|
771
|
-
return n &&
|
|
778
|
+
return n && s.length && i.next({ selectionRanges: s, disposableCollection: o }), () => {
|
|
772
779
|
o.dispose();
|
|
773
780
|
};
|
|
774
781
|
})
|
|
775
782
|
),
|
|
776
|
-
|
|
783
|
+
Wt(() => {
|
|
777
784
|
this._previewPattern = null;
|
|
778
785
|
})
|
|
779
|
-
).subscribe(({ disposableCollection: n, selectionRanges:
|
|
786
|
+
).subscribe(({ disposableCollection: n, selectionRanges: s }) => {
|
|
780
787
|
var o, c;
|
|
781
788
|
const i = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
|
|
782
789
|
this.openPanel(), n.add(
|
|
783
|
-
this._sheetInterceptorService.intercept(
|
|
790
|
+
this._sheetInterceptorService.intercept(We.CELL_CONTENT, {
|
|
784
791
|
priority: 99,
|
|
785
792
|
handler: (a, f, m) => {
|
|
786
793
|
const { row: l, col: u } = f, p = m(a) || {};
|
|
787
|
-
if (
|
|
794
|
+
if (s.find(
|
|
788
795
|
(_) => _.startColumn <= u && _.endColumn >= u && _.startRow <= l && _.endRow >= l
|
|
789
796
|
)) {
|
|
790
797
|
const _ = f.worksheet.getCellRaw(l, u), h = _ == null ? void 0 : _.v, v = _ == null ? void 0 : _.t;
|
|
@@ -817,46 +824,46 @@ let ce = class extends z {
|
|
|
817
824
|
_commandExecutedListener() {
|
|
818
825
|
const t = [pe.id, Y.id];
|
|
819
826
|
this.disposeWithMe(
|
|
820
|
-
new k((
|
|
821
|
-
const n = this._commandService.onCommandExecuted((
|
|
822
|
-
if (t.includes(
|
|
823
|
-
const i =
|
|
824
|
-
|
|
827
|
+
new k((r) => {
|
|
828
|
+
const n = this._commandService.onCommandExecuted((s) => {
|
|
829
|
+
if (t.includes(s.id)) {
|
|
830
|
+
const i = s.params;
|
|
831
|
+
r.next(i.unitId);
|
|
825
832
|
}
|
|
826
833
|
});
|
|
827
834
|
return () => n.dispose();
|
|
828
|
-
}).pipe(
|
|
835
|
+
}).pipe(kt(16)).subscribe((r) => this._forceUpdate(r))
|
|
829
836
|
);
|
|
830
837
|
}
|
|
831
838
|
_initCloseListener() {
|
|
832
839
|
this._univerInstanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).subscribe((t) => {
|
|
833
|
-
var
|
|
834
|
-
t || ((
|
|
840
|
+
var r;
|
|
841
|
+
t || ((r = this._sidebarDisposable) == null || r.dispose(), this._sidebarDisposable = null);
|
|
835
842
|
});
|
|
836
843
|
}
|
|
837
844
|
};
|
|
838
|
-
ce =
|
|
845
|
+
ce = Mn([
|
|
839
846
|
K(B.Rendered, ce),
|
|
840
|
-
M(0,
|
|
841
|
-
M(1,
|
|
842
|
-
M(2,
|
|
847
|
+
M(0, b(Pe)),
|
|
848
|
+
M(1, b(Fe)),
|
|
849
|
+
M(2, w),
|
|
843
850
|
M(3, O),
|
|
844
|
-
M(4,
|
|
845
|
-
M(5,
|
|
851
|
+
M(4, b(U)),
|
|
852
|
+
M(5, Lt),
|
|
846
853
|
M(6, H),
|
|
847
|
-
M(7,
|
|
848
|
-
M(8,
|
|
849
|
-
M(9,
|
|
854
|
+
M(7, b(Ke)),
|
|
855
|
+
M(8, Vt),
|
|
856
|
+
M(9, b(E))
|
|
850
857
|
], ce);
|
|
851
|
-
var
|
|
852
|
-
for (var
|
|
853
|
-
(o = e[i]) && (
|
|
854
|
-
return n &&
|
|
855
|
-
}, W = (e, t) => (
|
|
856
|
-
const
|
|
858
|
+
var Pn = Object.defineProperty, Rn = Object.getOwnPropertyDescriptor, xn = (e, t, r, n) => {
|
|
859
|
+
for (var s = n > 1 ? void 0 : n ? Rn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
860
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
861
|
+
return n && s && Pn(t, r, s), s;
|
|
862
|
+
}, W = (e, t) => (r, n) => t(r, n, e);
|
|
863
|
+
const On = () => {
|
|
857
864
|
let e = [];
|
|
858
865
|
return {
|
|
859
|
-
add: (
|
|
866
|
+
add: (s, i, o, c, a) => e.push({ unitId: s, subUnitId: i, row: o, col: c, value: a }),
|
|
860
867
|
getEffects: () => e,
|
|
861
868
|
clean: () => {
|
|
862
869
|
e = [];
|
|
@@ -864,23 +871,23 @@ const Rn = () => {
|
|
|
864
871
|
};
|
|
865
872
|
};
|
|
866
873
|
let ae = class extends z {
|
|
867
|
-
constructor(t,
|
|
874
|
+
constructor(t, r, n, s, i) {
|
|
868
875
|
super();
|
|
869
876
|
// collect effect mutations when edit end and push this to commands stack in next commands progress
|
|
870
|
-
ie(this, "_collectEffectMutation",
|
|
871
|
-
this._sheetInterceptorService = t, this._numfmtService =
|
|
877
|
+
ie(this, "_collectEffectMutation", On());
|
|
878
|
+
this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
|
|
872
879
|
}
|
|
873
880
|
_initInterceptorEditorStart() {
|
|
874
|
-
this.disposeWithMe(
|
|
881
|
+
this._editorBridgeService && this.disposeWithMe(
|
|
875
882
|
Ie(
|
|
876
883
|
this._editorBridgeService.interceptor.intercept(
|
|
877
884
|
this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
|
|
878
885
|
{
|
|
879
|
-
handler: (t,
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
886
|
+
handler: (t, r, n) => {
|
|
887
|
+
const s = r.row, i = r.col, o = this._numfmtService.getValue(
|
|
888
|
+
r.unitId,
|
|
889
|
+
r.subUnitId,
|
|
890
|
+
s,
|
|
884
891
|
i
|
|
885
892
|
);
|
|
886
893
|
if (o)
|
|
@@ -890,7 +897,7 @@ let ae = class extends z {
|
|
|
890
897
|
case "currency":
|
|
891
898
|
case "grouped":
|
|
892
899
|
case "number":
|
|
893
|
-
return
|
|
900
|
+
return r.worksheet.getCellRaw(s, i);
|
|
894
901
|
case "date":
|
|
895
902
|
case "time":
|
|
896
903
|
case "datetime":
|
|
@@ -910,25 +917,25 @@ let ae = class extends z {
|
|
|
910
917
|
* @memberof NumfmtService
|
|
911
918
|
*/
|
|
912
919
|
_initInterceptorEditorEnd() {
|
|
913
|
-
this.disposeWithMe(
|
|
920
|
+
this._editorBridgeService && this.disposeWithMe(
|
|
914
921
|
Ie(
|
|
915
922
|
this._editorBridgeService.interceptor.intercept(
|
|
916
923
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
|
|
917
924
|
{
|
|
918
|
-
handler: (t,
|
|
925
|
+
handler: (t, r, n) => {
|
|
919
926
|
var m;
|
|
920
927
|
this._collectEffectMutation.clean();
|
|
921
|
-
const
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
), i = (m =
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
928
|
+
const s = this._numfmtService.getValue(
|
|
929
|
+
r.unitId,
|
|
930
|
+
r.subUnitId,
|
|
931
|
+
r.row,
|
|
932
|
+
r.col
|
|
933
|
+
), i = (m = s && me(s.pattern)) != null ? m : "", o = () => {
|
|
934
|
+
s && this._collectEffectMutation.add(
|
|
935
|
+
r.unitId,
|
|
936
|
+
r.subUnitId,
|
|
937
|
+
r.row,
|
|
938
|
+
r.col,
|
|
932
939
|
null
|
|
933
940
|
);
|
|
934
941
|
};
|
|
@@ -939,16 +946,16 @@ let ae = class extends z {
|
|
|
939
946
|
if (a && a.z) {
|
|
940
947
|
const l = Number(a.v);
|
|
941
948
|
return this._collectEffectMutation.add(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
949
|
+
r.unitId,
|
|
950
|
+
r.subUnitId,
|
|
951
|
+
r.row,
|
|
952
|
+
r.col,
|
|
946
953
|
{
|
|
947
954
|
pattern: a.z
|
|
948
955
|
}
|
|
949
956
|
), { ...t, v: l, t: V.NUMBER };
|
|
950
957
|
}
|
|
951
|
-
} else (["date", "time", "datetime"].includes(i) || !
|
|
958
|
+
} else (["date", "time", "datetime"].includes(i) || !jn(c)) && o();
|
|
952
959
|
return n(t);
|
|
953
960
|
}
|
|
954
961
|
}
|
|
@@ -960,11 +967,11 @@ let ae = class extends z {
|
|
|
960
967
|
const t = this;
|
|
961
968
|
this.disposeWithMe(
|
|
962
969
|
this._sheetInterceptorService.interceptCommand({
|
|
963
|
-
getMutations(
|
|
970
|
+
getMutations(r) {
|
|
964
971
|
var n;
|
|
965
|
-
switch (
|
|
966
|
-
case
|
|
967
|
-
const
|
|
972
|
+
switch (r.id) {
|
|
973
|
+
case Nt.id: {
|
|
974
|
+
const s = t._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET), i = s.getUnitId(), o = (n = s.getActiveSheet()) == null ? void 0 : n.getSheetId();
|
|
968
975
|
if (!o)
|
|
969
976
|
return {
|
|
970
977
|
redos: [],
|
|
@@ -995,9 +1002,9 @@ let ae = class extends z {
|
|
|
995
1002
|
if (a) {
|
|
996
1003
|
const u = {
|
|
997
1004
|
id: Y.id,
|
|
998
|
-
params:
|
|
1005
|
+
params: ke(i, o, a)
|
|
999
1006
|
};
|
|
1000
|
-
m.push(u), l.push(...
|
|
1007
|
+
m.push(u), l.push(...Ge(t._injector, u.params));
|
|
1001
1008
|
}
|
|
1002
1009
|
if (f) {
|
|
1003
1010
|
const u = {
|
|
@@ -1008,7 +1015,7 @@ let ae = class extends z {
|
|
|
1008
1015
|
ranges: f
|
|
1009
1016
|
}
|
|
1010
1017
|
};
|
|
1011
|
-
m.push(u), l.push(...
|
|
1018
|
+
m.push(u), l.push(...ze(t._injector, u.params));
|
|
1012
1019
|
}
|
|
1013
1020
|
return {
|
|
1014
1021
|
redos: m,
|
|
@@ -1025,30 +1032,30 @@ let ae = class extends z {
|
|
|
1025
1032
|
);
|
|
1026
1033
|
}
|
|
1027
1034
|
};
|
|
1028
|
-
ae =
|
|
1035
|
+
ae = xn([
|
|
1029
1036
|
K(B.Rendered, ae),
|
|
1030
|
-
W(0,
|
|
1031
|
-
W(1,
|
|
1032
|
-
W(2,
|
|
1033
|
-
W(3,
|
|
1034
|
-
W(4,
|
|
1037
|
+
W(0, b(Pe)),
|
|
1038
|
+
W(1, b(H)),
|
|
1039
|
+
W(2, b(w)),
|
|
1040
|
+
W(3, b(Me)),
|
|
1041
|
+
W(4, It(Rt))
|
|
1035
1042
|
], ae);
|
|
1036
|
-
function
|
|
1043
|
+
function jn(e) {
|
|
1037
1044
|
return /^-?\d+(\.\d+)?$/.test(e);
|
|
1038
1045
|
}
|
|
1039
|
-
var
|
|
1040
|
-
for (var
|
|
1041
|
-
(o = e[i]) && (
|
|
1042
|
-
return n &&
|
|
1043
|
-
},
|
|
1046
|
+
var $n = Object.defineProperty, wn = Object.getOwnPropertyDescriptor, Dn = (e, t, r, n) => {
|
|
1047
|
+
for (var s = n > 1 ? void 0 : n ? wn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1048
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
1049
|
+
return n && s && $n(t, r, s), s;
|
|
1050
|
+
}, Un = (e, t) => (r, n) => t(r, n, e);
|
|
1044
1051
|
let le = class extends z {
|
|
1045
1052
|
constructor(e) {
|
|
1046
1053
|
super(), this._localeService = e;
|
|
1047
1054
|
}
|
|
1048
1055
|
};
|
|
1049
|
-
le =
|
|
1056
|
+
le = Dn([
|
|
1050
1057
|
K(B.Rendered, le),
|
|
1051
|
-
|
|
1058
|
+
Un(0, b(E))
|
|
1052
1059
|
], le);
|
|
1053
1060
|
const ue = [
|
|
1054
1061
|
{
|
|
@@ -1103,27 +1110,27 @@ const ue = [
|
|
|
1103
1110
|
label: "sheet.numfmt.moreFmt",
|
|
1104
1111
|
pattern: ""
|
|
1105
1112
|
}
|
|
1106
|
-
],
|
|
1113
|
+
], it = "sheet.numfmt.moreNumfmtType", ot = "sheet.numfmt.moreNumfmtType.options", Ln = (e) => {
|
|
1107
1114
|
var n;
|
|
1108
|
-
const t = N(E),
|
|
1109
|
-
return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children:
|
|
1110
|
-
},
|
|
1111
|
-
const e = N(O), t = N(E),
|
|
1115
|
+
const t = N(E), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
|
|
1116
|
+
return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children: r });
|
|
1117
|
+
}, An = () => {
|
|
1118
|
+
const e = N(O), t = N(E), r = Yt(), n = N(U), s = (c) => {
|
|
1112
1119
|
const a = n.getLast();
|
|
1113
1120
|
if (!a)
|
|
1114
1121
|
return;
|
|
1115
|
-
const f =
|
|
1122
|
+
const f = r.get(At), m = a.range, l = [];
|
|
1116
1123
|
R.foreach(m, (u, p) => {
|
|
1117
1124
|
c ? l.push({ row: u, col: p, pattern: c, type: me(c) }) : l.push({ row: u, col: p });
|
|
1118
1125
|
}), e.executeCommand($.id, { values: l }), f.focus();
|
|
1119
1126
|
}, i = (c) => {
|
|
1120
1127
|
if (c === 0)
|
|
1121
|
-
|
|
1128
|
+
s(null);
|
|
1122
1129
|
else if (c === ue.length - 1)
|
|
1123
1130
|
e.executeCommand(de.id);
|
|
1124
1131
|
else {
|
|
1125
1132
|
const a = ue[c];
|
|
1126
|
-
a.pattern &&
|
|
1133
|
+
a.pattern && s(a.pattern);
|
|
1127
1134
|
}
|
|
1128
1135
|
}, o = 1220;
|
|
1129
1136
|
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(
|
|
@@ -1140,37 +1147,37 @@ const ue = [
|
|
|
1140
1147
|
},
|
|
1141
1148
|
a
|
|
1142
1149
|
)) });
|
|
1143
|
-
},
|
|
1150
|
+
}, Vn = (e) => ({
|
|
1144
1151
|
icon: "RmbSingle",
|
|
1145
|
-
id:
|
|
1152
|
+
id: Qe.id,
|
|
1146
1153
|
title: "sheet.numfmt.currency",
|
|
1147
1154
|
tooltip: "sheet.numfmt.currency",
|
|
1148
1155
|
type: ee.BUTTON,
|
|
1149
1156
|
group: te.TOOLBAR_FORMULAS_INSERT,
|
|
1150
1157
|
positions: [ne.TOOLBAR_START],
|
|
1151
|
-
hidden$:
|
|
1158
|
+
hidden$: re(e, T.UNIVER_SHEET),
|
|
1152
1159
|
disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
|
|
1153
|
-
}),
|
|
1160
|
+
}), Bn = (e) => ({
|
|
1154
1161
|
icon: "AddDigitsSingle",
|
|
1155
|
-
id:
|
|
1162
|
+
id: Je.id,
|
|
1156
1163
|
title: "sheet.numfmt.addDecimal",
|
|
1157
1164
|
tooltip: "sheet.numfmt.addDecimal",
|
|
1158
1165
|
type: ee.BUTTON,
|
|
1159
1166
|
positions: [ne.TOOLBAR_START],
|
|
1160
1167
|
group: te.TOOLBAR_FORMULAS_INSERT,
|
|
1161
|
-
hidden$:
|
|
1168
|
+
hidden$: re(e, T.UNIVER_SHEET),
|
|
1162
1169
|
disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
|
|
1163
|
-
}),
|
|
1170
|
+
}), Hn = (e) => ({
|
|
1164
1171
|
icon: "ReduceDigitsSingle",
|
|
1165
|
-
id:
|
|
1172
|
+
id: Xe.id,
|
|
1166
1173
|
title: "sheet.numfmt.subtractDecimal",
|
|
1167
1174
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
1168
1175
|
type: ee.BUTTON,
|
|
1169
1176
|
group: te.TOOLBAR_FORMULAS_INSERT,
|
|
1170
1177
|
positions: [ne.TOOLBAR_START],
|
|
1171
|
-
hidden$:
|
|
1178
|
+
hidden$: re(e, T.UNIVER_SHEET),
|
|
1172
1179
|
disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
|
|
1173
|
-
}),
|
|
1180
|
+
}), Fn = (e) => ({
|
|
1174
1181
|
icon: "PercentSingle",
|
|
1175
1182
|
id: st.id,
|
|
1176
1183
|
title: "sheet.numfmt.percent",
|
|
@@ -1178,11 +1185,11 @@ const ue = [
|
|
|
1178
1185
|
type: ee.BUTTON,
|
|
1179
1186
|
group: te.TOOLBAR_FORMULAS_INSERT,
|
|
1180
1187
|
positions: [ne.TOOLBAR_START],
|
|
1181
|
-
hidden$:
|
|
1188
|
+
hidden$: re(e, T.UNIVER_SHEET),
|
|
1182
1189
|
disabled$: X(e, { workbookTypes: [q], worksheetTypes: [J, Z], rangeTypes: [Q] })
|
|
1183
|
-
}),
|
|
1184
|
-
const t = e.get(H),
|
|
1185
|
-
(f) =>
|
|
1190
|
+
}), Wn = (e) => {
|
|
1191
|
+
const t = e.get(H), r = e.get(w), n = e.get(O), s = e.get(E), i = e.get(U), o = xt(r, "", ({ workbook: c, worksheet: a }) => new k(
|
|
1192
|
+
(f) => Ut(
|
|
1186
1193
|
i.selectionMoveEnd$,
|
|
1187
1194
|
new k((m) => {
|
|
1188
1195
|
const l = [pe.id, Y.id], u = n.onCommandExecuted((p) => {
|
|
@@ -1194,19 +1201,19 @@ const ue = [
|
|
|
1194
1201
|
const m = i.getSelections();
|
|
1195
1202
|
if (m && m[0]) {
|
|
1196
1203
|
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 =
|
|
1204
|
+
let v = s.t("sheet.numfmt.general");
|
|
1198
1205
|
if (h) {
|
|
1199
|
-
const g = ue.filter((
|
|
1200
|
-
(
|
|
1206
|
+
const g = ue.filter((S) => typeof S == "object" && S.pattern).find(
|
|
1207
|
+
(S) => ve(h, S.pattern)
|
|
1201
1208
|
);
|
|
1202
|
-
g && typeof g == "object" && g.pattern ? v =
|
|
1209
|
+
g && typeof g == "object" && g.pattern ? v = s.t(g.label) : v = s.t("sheet.numfmt.moreFmt");
|
|
1203
1210
|
}
|
|
1204
1211
|
f.next(v);
|
|
1205
1212
|
}
|
|
1206
1213
|
})
|
|
1207
1214
|
));
|
|
1208
1215
|
return {
|
|
1209
|
-
label:
|
|
1216
|
+
label: it,
|
|
1210
1217
|
id: de.id,
|
|
1211
1218
|
tooltip: "sheet.numfmt.title",
|
|
1212
1219
|
type: ee.SELECTOR,
|
|
@@ -1215,47 +1222,47 @@ const ue = [
|
|
|
1215
1222
|
selections: [
|
|
1216
1223
|
{
|
|
1217
1224
|
label: {
|
|
1218
|
-
name:
|
|
1225
|
+
name: ot,
|
|
1219
1226
|
hoverable: !1
|
|
1220
1227
|
}
|
|
1221
1228
|
}
|
|
1222
1229
|
],
|
|
1223
1230
|
value$: o,
|
|
1224
|
-
hidden$:
|
|
1231
|
+
hidden$: re(e, T.UNIVER_SHEET),
|
|
1225
1232
|
disabled$: X(e, { workbookTypes: [q], worksheetTypes: [Z, J], rangeTypes: [Q] })
|
|
1226
1233
|
};
|
|
1227
1234
|
};
|
|
1228
|
-
var
|
|
1229
|
-
for (var
|
|
1230
|
-
(o = e[i]) && (
|
|
1231
|
-
return n &&
|
|
1232
|
-
}, Te = (e, t) => (
|
|
1233
|
-
const
|
|
1235
|
+
var kn = Object.defineProperty, Gn = Object.getOwnPropertyDescriptor, zn = (e, t, r, n) => {
|
|
1236
|
+
for (var s = n > 1 ? void 0 : n ? Gn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1237
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
1238
|
+
return n && s && kn(t, r, s), s;
|
|
1239
|
+
}, Te = (e, t) => (r, n) => t(r, n, e);
|
|
1240
|
+
const Kn = {};
|
|
1234
1241
|
let G = class extends z {
|
|
1235
|
-
constructor(e, t,
|
|
1236
|
-
super(), this._config = e, this._injector = t, this._componentManager =
|
|
1242
|
+
constructor(e, t, r, n) {
|
|
1243
|
+
super(), this._config = e, this._injector = t, this._componentManager = r, this._menuService = n, this._initMenu();
|
|
1237
1244
|
}
|
|
1238
1245
|
_initMenu() {
|
|
1239
1246
|
const { menu: e = {} } = this._config;
|
|
1240
|
-
[Bn,
|
|
1247
|
+
[Fn, Bn, Hn, Vn, Wn].forEach((t) => {
|
|
1241
1248
|
this.disposeWithMe(this._menuService.addMenuItem(t(this._injector), e));
|
|
1242
|
-
}), this.disposeWithMe(this._componentManager.register(
|
|
1249
|
+
}), this.disposeWithMe(this._componentManager.register(it, Ln)), this.disposeWithMe(this._componentManager.register(ot, An));
|
|
1243
1250
|
}
|
|
1244
1251
|
};
|
|
1245
|
-
G =
|
|
1252
|
+
G = zn([
|
|
1246
1253
|
K(B.Rendered, G),
|
|
1247
|
-
Te(1,
|
|
1248
|
-
Te(2,
|
|
1249
|
-
Te(3,
|
|
1254
|
+
Te(1, b(Me)),
|
|
1255
|
+
Te(2, b(Ke)),
|
|
1256
|
+
Te(3, b(Bt))
|
|
1250
1257
|
], G);
|
|
1251
|
-
var
|
|
1252
|
-
for (var
|
|
1253
|
-
(o = e[i]) && (
|
|
1254
|
-
return n &&
|
|
1255
|
-
},
|
|
1258
|
+
var ct = Object.defineProperty, Yn = Object.getOwnPropertyDescriptor, qn = (e, t, r) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Jn = (e, t, r, n) => {
|
|
1259
|
+
for (var s = n > 1 ? void 0 : n ? Yn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1260
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
1261
|
+
return n && s && ct(t, r, s), s;
|
|
1262
|
+
}, Zn = (e, t) => (r, n) => t(r, n, e), at = (e, t, r) => qn(e, typeof t != "symbol" ? t + "" : t, r);
|
|
1256
1263
|
let he = class extends bt {
|
|
1257
1264
|
constructor(e = {}, t) {
|
|
1258
|
-
super(), this._config = e, this._injector = t, this._config = yt.deepMerge({},
|
|
1265
|
+
super(), this._config = e, this._injector = t, this._config = yt.deepMerge({}, Kn, this._config);
|
|
1259
1266
|
}
|
|
1260
1267
|
onStarting() {
|
|
1261
1268
|
this._injector.add([De, { useClass: ce, lazy: !1 }]), this._injector.add([ae]), this._injector.add([fe]), this._injector.add([oe]), this._injector.add([le]), this._injector.add(
|
|
@@ -1268,14 +1275,20 @@ let he = class extends bt {
|
|
|
1268
1275
|
);
|
|
1269
1276
|
}
|
|
1270
1277
|
};
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
he =
|
|
1274
|
-
Ct(
|
|
1275
|
-
|
|
1278
|
+
at(he, "pluginName", Ee);
|
|
1279
|
+
at(he, "type", T.UNIVER_SHEET);
|
|
1280
|
+
he = Jn([
|
|
1281
|
+
Ct(Mt, Ot),
|
|
1282
|
+
Zn(1, b(Me))
|
|
1276
1283
|
], he);
|
|
1277
1284
|
export {
|
|
1285
|
+
Je as AddDecimalCommand,
|
|
1286
|
+
ye as CloseNumfmtPanelOperator,
|
|
1287
|
+
de as OpenNumfmtPanelOperator,
|
|
1288
|
+
Qe as SetCurrencyCommand,
|
|
1278
1289
|
$ as SetNumfmtCommand,
|
|
1290
|
+
st as SetPercentCommand,
|
|
1291
|
+
Xe as SubtractDecimalCommand,
|
|
1279
1292
|
he as UniverSheetsNumfmtPlugin,
|
|
1280
1293
|
we as getPatternPreview
|
|
1281
1294
|
};
|