@univerjs/sheets-numfmt-ui 0.5.3 → 0.5.4
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 +599 -523
- package/lib/types/controllers/numfmt-alert-render.controller.d.ts +20 -0
- package/lib/types/plugin.d.ts +4 -1
- package/lib/umd/index.js +2 -2
- package/package.json +14 -13
package/lib/es/index.js
CHANGED
|
@@ -1,30 +1,98 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var X = (t, e,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
1
|
+
var ht = Object.defineProperty;
|
|
2
|
+
var ft = (t, e, n) => e in t ? ht(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var X = (t, e, n) => ft(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Inject as S, LocaleService as T, Disposable as oe, isRealNum as pt, CommandType as Be, ILocalStorageService as We, useDependency as b, numfmt as Q, UniverInstanceType as E, CellValueType as $, Range as Ve, toDisposable as ge, DisposableCollection as vt, InterceptorEffectEnum as Oe, ThemeService as _t, IUniverInstanceService as ye, ICommandService as be, Injector as Ge, Optional as gt, useInjector as St, DependentOn as yt, Plugin as bt, merge as Ct, registerDependencies as It, touchDependencies as Nt, IConfigService as Et } from "@univerjs/core";
|
|
5
|
+
import { IRenderManagerService as Ke } from "@univerjs/engine-render";
|
|
6
|
+
import { currencySymbols as Ue, getDecimalFromPattern as te, getCurrencyType as W, setPatternDecimal as M, getCurrencyFormatOptions as ue, isPatternEqualWithoutDecimal as ce, CURRENCYFORMAT as Tt, DATEFMTLISG as xt, NUMBERFORMAT as Pt, getDateFormatOptions as qe, getNumberFormatOptions as Ye, isPatternHasDecimal as Mt, getPatternType as ne, SetNumfmtCommand as Ze, getPatternPreviewIgnoreGeneral as Rt, MenuCurrencyService as jt, countryCurrencyMap as O, SetCurrencyCommand as ze, AddDecimalCommand as Je, SubtractDecimalCommand as Xe, SetPercentCommand as Qe, getPatternPreview as wt, UniverSheetsNumfmtPlugin as Ot } from "@univerjs/sheets-numfmt";
|
|
7
|
+
import { HoverManagerService as Ut, CellAlertManagerService as $t, CellAlertType as Dt, SheetSkeletonManagerService as Ft, IEditorBridgeService as Lt, getCurrentRangeDisable$ as V, deriveStateFromActiveSheet$ as Ht, UniverSheetsUIPlugin as At } from "@univerjs/sheets-ui";
|
|
8
|
+
import { IZenZoneService as kt, ComponentManager as et, ISidebarService as Bt, MenuItemType as G, getMenuHiddenObservable as K, ILayoutService as Wt, RibbonStartGroup as Vt, IMenuManagerService as Gt, UI_PLUGIN_CONFIG_KEY as Kt } from "@univerjs/ui";
|
|
9
|
+
import { FormulaDataModel as qt } from "@univerjs/engine-formula";
|
|
10
|
+
import { DEFAULT_TEXT_FORMAT as Ce } from "@univerjs/engine-numfmt";
|
|
11
|
+
import { INumfmtService as Ie, INTERCEPTOR_POINT as Yt, RemoveNumfmtMutation as Ne, SetNumfmtMutation as Ee, SheetInterceptorService as tt, SheetsSelectionsService as Te, BEFORE_CELL_EDIT as Zt, AFTER_CELL_EDIT as zt, SetRangeValuesCommand as Jt, transformCellsToRange as Xt, factorySetNumfmtUndoMutation as Qt, factoryRemoveNumfmtUndoMutation as en, WorkbookEditablePermission as q, WorksheetEditPermission as Y, WorksheetSetCellStylePermission as Z, RangeProtectionPermissionEditPoint as z } from "@univerjs/sheets";
|
|
12
|
+
import { debounceTime as tn, Observable as D, combineLatest as nn, merge as rn } from "rxjs";
|
|
13
|
+
import { map as sn, switchMap as on, tap as cn, debounceTime as an } from "rxjs/operators";
|
|
14
|
+
import ln, { createContext as mn, useState as C, useEffect as ae, useRef as xe, useContext as nt, useMemo as R, forwardRef as rt, createElement as Pe } from "react";
|
|
15
|
+
import { InputNumber as Me, Select as Re, SelectList as je, Input as un, Button as $e } from "@univerjs/design";
|
|
16
|
+
const De = {};
|
|
17
|
+
var dn = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, fn = (t, e, n, r) => {
|
|
18
|
+
for (var s = r > 1 ? void 0 : r ? hn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
19
|
+
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
20
|
+
return r && s && dn(e, n, s), s;
|
|
21
|
+
}, U = (t, e) => (n, r) => e(n, r, t);
|
|
22
|
+
const de = "SHEET_NUMFMT_ALERT";
|
|
23
|
+
let Se = class extends oe {
|
|
24
|
+
constructor(t, e, n, r, s, i, o) {
|
|
25
|
+
super(), this._context = t, this._hoverManagerService = e, this._cellAlertManagerService = n, this._localeService = r, this._formulaDataModel = s, this._zenZoneService = i, this._numfmtService = o, this._init();
|
|
26
|
+
}
|
|
27
|
+
_init() {
|
|
28
|
+
this._initCellAlertPopup(), this._initZenService();
|
|
29
|
+
}
|
|
30
|
+
_initCellAlertPopup() {
|
|
31
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(tn(100)).subscribe((t) => {
|
|
32
|
+
var e;
|
|
33
|
+
if (t) {
|
|
34
|
+
const n = t.location, r = this._context.unit, s = r.getActiveSheet();
|
|
35
|
+
if (!s) return;
|
|
36
|
+
const i = n.unitId, o = n.subUnitId;
|
|
37
|
+
let c;
|
|
38
|
+
const a = s.getCell(n.row, n.col);
|
|
39
|
+
if (a != null && a.s) {
|
|
40
|
+
const m = r.getStyles().get(a.s);
|
|
41
|
+
m != null && m.n && (c = m.n);
|
|
42
|
+
}
|
|
43
|
+
if (c || (c = this._numfmtService.getValue(i, o, n.row, n.col)), !c) {
|
|
44
|
+
this._hideAlert();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (c.pattern === Ce && (a != null && a.v) && pt(a.v)) {
|
|
48
|
+
const m = this._cellAlertManagerService.currentAlert.get(de), d = (e = m == null ? void 0 : m.alert) == null ? void 0 : e.location;
|
|
49
|
+
if (d && d.row === n.row && d.col === n.col && d.subUnitId === n.subUnitId && d.unitId === n.unitId)
|
|
50
|
+
return;
|
|
51
|
+
this._cellAlertManagerService.showAlert({
|
|
52
|
+
type: Dt.ERROR,
|
|
53
|
+
title: this._localeService.t("info.error"),
|
|
54
|
+
message: this._localeService.t("info.forceStringInfo"),
|
|
55
|
+
location: n,
|
|
56
|
+
width: 200,
|
|
57
|
+
height: 74,
|
|
58
|
+
key: de
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
this._hideAlert();
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
_initZenService() {
|
|
67
|
+
this.disposeWithMe(this._zenZoneService.visible$.subscribe((t) => {
|
|
68
|
+
t && this._hideAlert();
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
_hideAlert() {
|
|
72
|
+
this._cellAlertManagerService.removeAlert(de);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
Se = fn([
|
|
76
|
+
U(1, S(Ut)),
|
|
77
|
+
U(2, S($t)),
|
|
78
|
+
U(3, S(T)),
|
|
79
|
+
U(4, S(qt)),
|
|
80
|
+
U(5, kt),
|
|
81
|
+
U(6, S(Ie))
|
|
82
|
+
], Se);
|
|
83
|
+
const he = {
|
|
16
84
|
id: "sheet.operation.close.numfmt.panel",
|
|
17
|
-
type:
|
|
85
|
+
type: Be.OPERATION,
|
|
18
86
|
handler: () => (
|
|
19
87
|
// do nothing, just notify panel is closed
|
|
20
88
|
!0
|
|
21
89
|
)
|
|
22
|
-
},
|
|
90
|
+
}, A = {
|
|
23
91
|
id: "sheet.operation.open.numfmt.panel",
|
|
24
|
-
type:
|
|
25
|
-
handler: (t) => (t.get(
|
|
92
|
+
type: Be.OPERATION,
|
|
93
|
+
handler: (t) => (t.get(B).openPanel(), !0)
|
|
26
94
|
};
|
|
27
|
-
var
|
|
95
|
+
var fe = { exports: {} }, L = {};
|
|
28
96
|
/**
|
|
29
97
|
* @license React
|
|
30
98
|
* react-jsx-runtime.production.min.js
|
|
@@ -34,30 +102,30 @@ var ue = { exports: {} }, $ = {};
|
|
|
34
102
|
* This source code is licensed under the MIT license found in the
|
|
35
103
|
* LICENSE file in the root directory of this source tree.
|
|
36
104
|
*/
|
|
37
|
-
var
|
|
38
|
-
function
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
var t =
|
|
42
|
-
function o(c, a,
|
|
43
|
-
var d,
|
|
44
|
-
|
|
45
|
-
for (d in a)
|
|
46
|
-
if (c && c.defaultProps) for (d in a = c.defaultProps, a)
|
|
47
|
-
return { $$typeof: e, type: c, key:
|
|
105
|
+
var Fe;
|
|
106
|
+
function pn() {
|
|
107
|
+
if (Fe) return L;
|
|
108
|
+
Fe = 1;
|
|
109
|
+
var t = ln, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
110
|
+
function o(c, a, m) {
|
|
111
|
+
var d, u = {}, h = null, p = null;
|
|
112
|
+
m !== void 0 && (h = "" + m), a.key !== void 0 && (h = "" + a.key), a.ref !== void 0 && (p = a.ref);
|
|
113
|
+
for (d in a) r.call(a, d) && !i.hasOwnProperty(d) && (u[d] = a[d]);
|
|
114
|
+
if (c && c.defaultProps) for (d in a = c.defaultProps, a) u[d] === void 0 && (u[d] = a[d]);
|
|
115
|
+
return { $$typeof: e, type: c, key: h, ref: p, props: u, _owner: s.current };
|
|
48
116
|
}
|
|
49
|
-
return
|
|
117
|
+
return L.Fragment = n, L.jsx = o, L.jsxs = o, L;
|
|
50
118
|
}
|
|
51
|
-
var
|
|
52
|
-
function
|
|
53
|
-
return
|
|
119
|
+
var Le;
|
|
120
|
+
function vn() {
|
|
121
|
+
return Le || (Le = 1, fe.exports = pn()), fe.exports;
|
|
54
122
|
}
|
|
55
|
-
var l =
|
|
56
|
-
for (var s =
|
|
57
|
-
(o = t[i]) && (s = (
|
|
58
|
-
return
|
|
59
|
-
},
|
|
60
|
-
const
|
|
123
|
+
var l = vn(), _n = Object.defineProperty, gn = Object.getOwnPropertyDescriptor, Sn = (t, e, n, r) => {
|
|
124
|
+
for (var s = r > 1 ? void 0 : r ? gn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
125
|
+
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
126
|
+
return r && s && _n(e, n, s), s;
|
|
127
|
+
}, yn = (t, e) => (n, r) => e(n, r, t);
|
|
128
|
+
const we = mn([]);
|
|
61
129
|
let k = class {
|
|
62
130
|
constructor(t) {
|
|
63
131
|
this._localStorageService = t;
|
|
@@ -66,24 +134,24 @@ let k = class {
|
|
|
66
134
|
return `userHabitController_${t}`;
|
|
67
135
|
}
|
|
68
136
|
async addHabit(t, e) {
|
|
69
|
-
const
|
|
70
|
-
return this._localStorageService.getItem(
|
|
71
|
-
|
|
137
|
+
const n = this._getKey(t);
|
|
138
|
+
return this._localStorageService.getItem(n).then((r) => {
|
|
139
|
+
r || this._localStorageService.setItem(n, e);
|
|
72
140
|
});
|
|
73
141
|
}
|
|
74
142
|
markHabit(t, e) {
|
|
75
|
-
const
|
|
76
|
-
this._localStorageService.getItem(
|
|
77
|
-
if (
|
|
78
|
-
const s =
|
|
79
|
-
s > -1 &&
|
|
143
|
+
const n = this._getKey(t);
|
|
144
|
+
this._localStorageService.getItem(n).then((r) => {
|
|
145
|
+
if (r) {
|
|
146
|
+
const s = r.findIndex((i) => i === e);
|
|
147
|
+
s > -1 && r.splice(s, 1), r.unshift(e), this._localStorageService.setItem(n, r);
|
|
80
148
|
}
|
|
81
149
|
});
|
|
82
150
|
}
|
|
83
151
|
async getHabit(t, e) {
|
|
84
|
-
const
|
|
85
|
-
if (e &&
|
|
86
|
-
const s =
|
|
152
|
+
const n = this._getKey(t), r = await this._localStorageService.getItem(n);
|
|
153
|
+
if (e && r) {
|
|
154
|
+
const s = r.map((i, o, c) => {
|
|
87
155
|
const a = c.length;
|
|
88
156
|
return {
|
|
89
157
|
value: i,
|
|
@@ -91,196 +159,196 @@ let k = class {
|
|
|
91
159
|
};
|
|
92
160
|
});
|
|
93
161
|
return e.sort((i, o) => {
|
|
94
|
-
var
|
|
95
|
-
const c = ((
|
|
96
|
-
return (((d = s.find((
|
|
162
|
+
var m, d;
|
|
163
|
+
const c = ((m = s.find((u) => u.value === i)) == null ? void 0 : m.priority) || -1;
|
|
164
|
+
return (((d = s.find((u) => u.value === o)) == null ? void 0 : d.priority) || -1) - c;
|
|
97
165
|
});
|
|
98
166
|
}
|
|
99
|
-
return
|
|
167
|
+
return r || [];
|
|
100
168
|
}
|
|
101
169
|
deleteHabit(t) {
|
|
102
170
|
this._localStorageService.removeItem(t);
|
|
103
171
|
}
|
|
104
172
|
};
|
|
105
|
-
k =
|
|
106
|
-
|
|
173
|
+
k = Sn([
|
|
174
|
+
yn(0, S(We))
|
|
107
175
|
], k);
|
|
108
|
-
const
|
|
109
|
-
const e =
|
|
110
|
-
return
|
|
176
|
+
const He = "numfmtCurrency", bn = (t) => {
|
|
177
|
+
const e = b(k), [n, r] = C(Ue);
|
|
178
|
+
return ae(() => {
|
|
111
179
|
e.addHabit("numfmtCurrency", []).then(() => {
|
|
112
|
-
e.getHabit(
|
|
113
|
-
|
|
180
|
+
e.getHabit(He, [...Ue]).then((i) => {
|
|
181
|
+
r(i), t(i);
|
|
114
182
|
});
|
|
115
183
|
});
|
|
116
|
-
}, []), { userHabitCurrency:
|
|
117
|
-
e.markHabit(
|
|
184
|
+
}, []), { userHabitCurrency: n, mark: (i) => {
|
|
185
|
+
e.markHabit(He, i);
|
|
118
186
|
} };
|
|
119
|
-
},
|
|
120
|
-
const t =
|
|
121
|
-
return
|
|
187
|
+
}, Cn = () => {
|
|
188
|
+
const t = xe([]), [e, n] = C({});
|
|
189
|
+
return ae(() => {
|
|
122
190
|
t.current.forEach((s) => {
|
|
123
191
|
s();
|
|
124
192
|
}), t.current = [];
|
|
125
193
|
}, [e]), (s) => {
|
|
126
|
-
t.current.push(s),
|
|
194
|
+
t.current.push(s), n({});
|
|
127
195
|
};
|
|
128
|
-
},
|
|
129
|
-
const { defaultPattern: e, action:
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
a(v),
|
|
196
|
+
}, In = (t) => !!W(t) && t.startsWith("_("), Nn = (t) => {
|
|
197
|
+
const { defaultPattern: e, action: n, onChange: r } = t, [s, i] = C(() => te(e || "", 2)), o = nt(we), [c, a] = C(() => W(e) || o[0]), m = R(() => o.map((v) => ({ label: v, value: v })), []), u = b(T).t;
|
|
198
|
+
n.current = () => M(`_("${c}"* #,##0${s > 0 ? ".0" : ""}_)`, s);
|
|
199
|
+
const h = (v) => {
|
|
200
|
+
a(v), r(M(`_("${v}"* #,##0${s > 0 ? ".0" : ""}_)`, s));
|
|
133
201
|
}, p = (v) => {
|
|
134
202
|
const f = v || 0;
|
|
135
|
-
i(f),
|
|
203
|
+
i(f), r(M(`_("${c}"* #,##0${f > 0 ? ".0" : ""}_)`, f));
|
|
136
204
|
};
|
|
137
205
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
138
206
|
/* @__PURE__ */ l.jsxs("div", { className: "m-t-16 options", children: [
|
|
139
207
|
/* @__PURE__ */ l.jsxs("div", { className: "option", children: [
|
|
140
|
-
/* @__PURE__ */ l.jsx("div", { className: "label", children:
|
|
141
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ l.jsx(
|
|
208
|
+
/* @__PURE__ */ l.jsx("div", { className: "label", children: u("sheet.numfmt.decimalLength") }),
|
|
209
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ l.jsx(Me, { value: s, max: 20, min: 0, onChange: p }) })
|
|
142
210
|
] }),
|
|
143
211
|
/* @__PURE__ */ l.jsxs("div", { className: "option", children: [
|
|
144
|
-
/* @__PURE__ */ l.jsx("div", { className: "label", children:
|
|
145
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ l.jsx(
|
|
212
|
+
/* @__PURE__ */ l.jsx("div", { className: "label", children: u("sheet.numfmt.currencyType") }),
|
|
213
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ l.jsx(Re, { onChange: h, options: m, value: c }) })
|
|
146
214
|
] })
|
|
147
215
|
] }),
|
|
148
|
-
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children:
|
|
216
|
+
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: u("sheet.numfmt.accountingDes") })
|
|
149
217
|
] });
|
|
150
|
-
},
|
|
151
|
-
const
|
|
152
|
-
var
|
|
153
|
-
const f =
|
|
154
|
-
return ((
|
|
155
|
-
}), d = R(() =>
|
|
156
|
-
t.action.current = () =>
|
|
157
|
-
const
|
|
218
|
+
}, En = (t) => !!W(t) && !t.startsWith("_("), Tn = (t) => {
|
|
219
|
+
const n = b(T).t, r = nt(we), [s, i] = C(() => W(t.defaultPattern) || r[0]), [o, c] = C(() => te(t.defaultPattern || "", 2)), [a, m] = C(() => {
|
|
220
|
+
var _;
|
|
221
|
+
const f = ue(s);
|
|
222
|
+
return ((_ = f.find((I) => ce(I.value, t.defaultPattern))) == null ? void 0 : _.value) || f[0].value;
|
|
223
|
+
}), d = R(() => ue(s), [s]), u = R(() => r.map((f) => ({ label: f, value: f })), [r]);
|
|
224
|
+
t.action.current = () => M(a, o);
|
|
225
|
+
const h = (f) => {
|
|
158
226
|
if (f === void 0)
|
|
159
227
|
return;
|
|
160
228
|
i(f);
|
|
161
|
-
const
|
|
162
|
-
|
|
229
|
+
const y = ue(f)[0].value;
|
|
230
|
+
m(y), t.onChange(M(y, o));
|
|
163
231
|
}, p = (f) => {
|
|
164
|
-
f !== void 0 && (
|
|
232
|
+
f !== void 0 && (m(f), t.onChange(M(f, o)));
|
|
165
233
|
}, v = (f) => {
|
|
166
|
-
c(f || 0), t.onChange(
|
|
234
|
+
c(f || 0), t.onChange(M(a, f || 0));
|
|
167
235
|
};
|
|
168
236
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
169
237
|
/* @__PURE__ */ l.jsxs("div", { className: "m-t-16 options", children: [
|
|
170
238
|
/* @__PURE__ */ l.jsxs("div", { className: "option", children: [
|
|
171
|
-
/* @__PURE__ */ l.jsx("div", { className: "label", children:
|
|
172
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ l.jsx(
|
|
239
|
+
/* @__PURE__ */ l.jsx("div", { className: "label", children: n("sheet.numfmt.decimalLength") }),
|
|
240
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ l.jsx(Me, { value: o, max: 20, min: 0, onChange: v }) })
|
|
173
241
|
] }),
|
|
174
242
|
/* @__PURE__ */ l.jsxs("div", { className: "option", children: [
|
|
175
|
-
/* @__PURE__ */ l.jsx("div", { className: "label", children:
|
|
176
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ l.jsx(
|
|
243
|
+
/* @__PURE__ */ l.jsx("div", { className: "label", children: n("sheet.numfmt.currencyType") }),
|
|
244
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ l.jsx(Re, { onChange: h, options: u, value: s }) })
|
|
177
245
|
] })
|
|
178
246
|
] }),
|
|
179
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children:
|
|
180
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(
|
|
181
|
-
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children:
|
|
247
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.negType") }),
|
|
248
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(je, { onChange: p, options: d, value: a }) }),
|
|
249
|
+
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.currencyDes") })
|
|
182
250
|
] });
|
|
183
251
|
};
|
|
184
|
-
var
|
|
185
|
-
return
|
|
186
|
-
for (var e,
|
|
187
|
-
e = arguments[
|
|
252
|
+
var N = function() {
|
|
253
|
+
return N = Object.assign || function(t) {
|
|
254
|
+
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
255
|
+
e = arguments[n];
|
|
188
256
|
for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
|
|
189
257
|
}
|
|
190
258
|
return t;
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
var
|
|
194
|
-
for (var
|
|
259
|
+
}, N.apply(this, arguments);
|
|
260
|
+
}, xn = function(t, e) {
|
|
261
|
+
var n = {};
|
|
262
|
+
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
195
263
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
196
|
-
for (var s = 0,
|
|
197
|
-
e.indexOf(
|
|
198
|
-
return
|
|
199
|
-
},
|
|
200
|
-
var
|
|
201
|
-
return
|
|
264
|
+
for (var s = 0, r = Object.getOwnPropertySymbols(t); s < r.length; s++)
|
|
265
|
+
e.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[s]) && (n[r[s]] = t[r[s]]);
|
|
266
|
+
return n;
|
|
267
|
+
}, st = rt(function(t, e) {
|
|
268
|
+
var n = t.icon, r = t.id, s = t.className, i = t.extend, o = xn(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(s || "").trim(), a = xe("_".concat(Rn()));
|
|
269
|
+
return it(n, "".concat(r), { defIds: n.defIds, idSuffix: a.current }, N({ ref: e, className: c }, o), i);
|
|
202
270
|
});
|
|
203
|
-
function
|
|
204
|
-
return
|
|
205
|
-
return
|
|
271
|
+
function it(t, e, n, r, s) {
|
|
272
|
+
return Pe(t.tag, N(N({ key: e }, Pn(t, n, s)), r), (Mn(t, n).children || []).map(function(i, o) {
|
|
273
|
+
return it(i, "".concat(e, "-").concat(t.tag, "-").concat(o), n, void 0, s);
|
|
206
274
|
}));
|
|
207
275
|
}
|
|
208
|
-
function
|
|
209
|
-
var
|
|
210
|
-
|
|
276
|
+
function Pn(t, e, n) {
|
|
277
|
+
var r = N({}, t.attrs);
|
|
278
|
+
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
|
|
211
279
|
var s = e.defIds;
|
|
212
|
-
return !s || s.length === 0 || (t.tag === "use" &&
|
|
280
|
+
return !s || s.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(i) {
|
|
213
281
|
var o = i[0], c = i[1];
|
|
214
|
-
typeof c == "string" && (
|
|
215
|
-
})),
|
|
282
|
+
typeof c == "string" && (r[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
283
|
+
})), r;
|
|
216
284
|
}
|
|
217
|
-
function
|
|
218
|
-
var
|
|
219
|
-
return !
|
|
220
|
-
return typeof s.attrs.id == "string" &&
|
|
285
|
+
function Mn(t, e) {
|
|
286
|
+
var n, r = e.defIds;
|
|
287
|
+
return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? N(N({}, t), { children: t.children.map(function(s) {
|
|
288
|
+
return typeof s.attrs.id == "string" && r && r.indexOf(s.attrs.id) > -1 ? N(N({}, s), { attrs: N(N({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
|
|
221
289
|
}) }) : t;
|
|
222
290
|
}
|
|
223
|
-
function
|
|
291
|
+
function Rn() {
|
|
224
292
|
return Math.random().toString(36).substring(2, 8);
|
|
225
293
|
}
|
|
226
|
-
|
|
227
|
-
var
|
|
228
|
-
return
|
|
294
|
+
st.displayName = "UniverIcon";
|
|
295
|
+
var jn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ot = rt(function(t, e) {
|
|
296
|
+
return Pe(st, Object.assign({}, t, {
|
|
229
297
|
id: "check-mark-single",
|
|
230
298
|
ref: e,
|
|
231
|
-
icon:
|
|
299
|
+
icon: jn
|
|
232
300
|
}));
|
|
233
301
|
});
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
customFormatTitle:
|
|
237
|
-
customFormatInput:
|
|
238
|
-
customFormatHistoryList:
|
|
239
|
-
customFormatHistoryListItem:
|
|
240
|
-
customFormatHistoryListItemIconWrap:
|
|
241
|
-
customFormatDes:
|
|
242
|
-
},
|
|
243
|
-
function
|
|
244
|
-
const { defaultPattern: e, action:
|
|
245
|
-
|
|
302
|
+
ot.displayName = "CheckMarkSingle";
|
|
303
|
+
const wn = "univer-custom-format-title", On = "univer-custom-format-input", Un = "univer-custom-format-history-list", $n = "univer-custom-format-history-list-item", Dn = "univer-custom-format-history-list-item-icon-wrap", Fn = "univer-custom-format-des", j = {
|
|
304
|
+
customFormatTitle: wn,
|
|
305
|
+
customFormatInput: On,
|
|
306
|
+
customFormatHistoryList: Un,
|
|
307
|
+
customFormatHistoryListItem: $n,
|
|
308
|
+
customFormatHistoryListItemIconWrap: Dn,
|
|
309
|
+
customFormatDes: Fn
|
|
310
|
+
}, pe = "customFormat", ve = "numfmt_custom_pattern";
|
|
311
|
+
function Ln(t) {
|
|
312
|
+
const { defaultPattern: e, action: n, onChange: r } = t, s = b(k), i = b(We), o = b(T), [c, a] = C(e);
|
|
313
|
+
n.current = () => (s.markHabit(pe, c), i.getItem(ve).then((p = []) => {
|
|
246
314
|
const v = [.../* @__PURE__ */ new Set([c, ...p || []])].splice(0, 10).filter((f) => !!f);
|
|
247
|
-
i.setItem(
|
|
315
|
+
i.setItem(ve, v);
|
|
248
316
|
}), c);
|
|
249
|
-
const [
|
|
250
|
-
|
|
251
|
-
i.getItem(
|
|
317
|
+
const [m, d] = C([]);
|
|
318
|
+
ae(() => {
|
|
319
|
+
i.getItem(ve).then((p) => {
|
|
252
320
|
const v = [
|
|
253
|
-
...
|
|
254
|
-
...
|
|
255
|
-
...
|
|
321
|
+
...Tt.map((f) => f.suffix("$")),
|
|
322
|
+
...xt.map((f) => f.suffix),
|
|
323
|
+
...Pt.map((f) => f.suffix)
|
|
256
324
|
];
|
|
257
|
-
v.push(...p || []), s.addHabit(
|
|
258
|
-
s.getHabit(
|
|
325
|
+
v.push(...p || []), s.addHabit(pe, []).finally(() => {
|
|
326
|
+
s.getHabit(pe, v).then((f) => {
|
|
259
327
|
d([...new Set(f)]);
|
|
260
328
|
});
|
|
261
329
|
});
|
|
262
330
|
});
|
|
263
331
|
}, []);
|
|
264
|
-
const
|
|
265
|
-
a(p),
|
|
266
|
-
},
|
|
267
|
-
|
|
332
|
+
const u = (p) => {
|
|
333
|
+
a(p), r(p);
|
|
334
|
+
}, h = () => {
|
|
335
|
+
r(c);
|
|
268
336
|
};
|
|
269
|
-
return /* @__PURE__ */ l.jsxs("div", { className:
|
|
270
|
-
/* @__PURE__ */ l.jsx("div", { className:
|
|
271
|
-
/* @__PURE__ */ l.jsx(
|
|
272
|
-
/* @__PURE__ */ l.jsx("div", { className:
|
|
273
|
-
/* @__PURE__ */ l.jsx("div", { className:
|
|
337
|
+
return /* @__PURE__ */ l.jsxs("div", { className: j.customFormat, children: [
|
|
338
|
+
/* @__PURE__ */ l.jsx("div", { className: j.customFormatTitle, children: o.t("sheet.numfmt.customFormat") }),
|
|
339
|
+
/* @__PURE__ */ l.jsx(un, { placeholder: o.t("sheet.numfmt.customFormat"), onBlur: h, value: c, onChange: a, className: j.customFormatInput }),
|
|
340
|
+
/* @__PURE__ */ l.jsx("div", { className: j.customFormatHistoryList, children: m.map((p) => /* @__PURE__ */ l.jsxs("div", { onClick: () => u(p), className: j.customFormatHistoryListItem, children: [
|
|
341
|
+
/* @__PURE__ */ l.jsx("div", { className: j.customFormatHistoryListItemIconWrap, children: c === p && /* @__PURE__ */ l.jsx(ot, {}) }),
|
|
274
342
|
/* @__PURE__ */ l.jsx("div", { children: p })
|
|
275
343
|
] }, p)) }),
|
|
276
|
-
/* @__PURE__ */ l.jsx("div", { className:
|
|
344
|
+
/* @__PURE__ */ l.jsx("div", { className: j.customFormatDes, children: o.t("sheet.numfmt.customFormatDes") })
|
|
277
345
|
] });
|
|
278
346
|
}
|
|
279
|
-
const
|
|
280
|
-
const e =
|
|
281
|
-
return
|
|
282
|
-
},
|
|
283
|
-
const e = R(
|
|
347
|
+
const Hn = (t) => {
|
|
348
|
+
const e = Q.getInfo(t);
|
|
349
|
+
return qe().map((n) => n.value).includes(t) || ["date", "datetime", "time"].includes(e.type);
|
|
350
|
+
}, An = (t) => {
|
|
351
|
+
const e = R(qe, []), r = b(T).t, [s, i] = C(() => {
|
|
284
352
|
if (t.defaultPattern) {
|
|
285
353
|
const c = e.find((a) => a.value === t.defaultPattern);
|
|
286
354
|
if (c)
|
|
@@ -293,99 +361,99 @@ const Tn = (t) => {
|
|
|
293
361
|
c !== void 0 && (i(c), t.onChange(c));
|
|
294
362
|
};
|
|
295
363
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
296
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children:
|
|
297
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(
|
|
298
|
-
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children:
|
|
364
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.dateType") }),
|
|
365
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(je, { value: s, options: e, onChange: o }) }),
|
|
366
|
+
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.dateDes") })
|
|
299
367
|
] });
|
|
300
|
-
},
|
|
301
|
-
const
|
|
302
|
-
return t.action.current = () => "", /* @__PURE__ */ l.jsx("div", { children: /* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children:
|
|
303
|
-
},
|
|
304
|
-
const e =
|
|
305
|
-
const
|
|
306
|
-
return (
|
|
307
|
-
}), c = R(() =>
|
|
308
|
-
s(
|
|
309
|
-
}, d = (
|
|
310
|
-
|
|
368
|
+
}, kn = (t) => !t, Bn = (t) => {
|
|
369
|
+
const n = b(T).t;
|
|
370
|
+
return t.action.current = () => "", /* @__PURE__ */ l.jsx("div", { children: /* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.generalDes") }) });
|
|
371
|
+
}, Wn = (t) => Ye().some((e) => ce(e.value, t)), Vn = (t) => {
|
|
372
|
+
const e = b(T), n = R(Ye, []), [r, s] = C(() => te(t.defaultPattern || "", 0)), [i, o] = C(() => {
|
|
373
|
+
const u = n.find((h) => ce(h.value, t.defaultPattern || ""));
|
|
374
|
+
return (u == null ? void 0 : u.value) || n[0].value;
|
|
375
|
+
}), c = R(() => M(i, Number(r || 0)), [i, r]), a = R(() => !Mt(i), [i]), m = (u) => {
|
|
376
|
+
s(u || 0), t.onChange(M(i, Number(u || 0)));
|
|
377
|
+
}, d = (u) => {
|
|
378
|
+
u !== void 0 && (s(te(u, 0)), o(u), t.onChange(u));
|
|
311
379
|
};
|
|
312
380
|
return t.action.current = () => c, /* @__PURE__ */ l.jsxs("div", { children: [
|
|
313
381
|
/* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: e.t("sheet.numfmt.decimalLength") }),
|
|
314
382
|
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(
|
|
315
|
-
|
|
383
|
+
Me,
|
|
316
384
|
{
|
|
317
385
|
disabled: a,
|
|
318
|
-
value:
|
|
386
|
+
value: r,
|
|
319
387
|
max: 20,
|
|
320
388
|
min: 0,
|
|
321
|
-
onChange:
|
|
389
|
+
onChange: m
|
|
322
390
|
}
|
|
323
391
|
) }),
|
|
324
392
|
/* @__PURE__ */ l.jsxs("div", { className: "m-t-16 label", children: [
|
|
325
393
|
" ",
|
|
326
394
|
e.t("sheet.numfmt.negType")
|
|
327
395
|
] }),
|
|
328
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(
|
|
396
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(je, { onChange: d, options: n, value: i }) }),
|
|
329
397
|
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: e.t("sheet.numfmt.thousandthPercentileDes") })
|
|
330
398
|
] });
|
|
331
|
-
},
|
|
332
|
-
const { defaultValue: e, defaultPattern:
|
|
399
|
+
}, Gn = (t) => {
|
|
400
|
+
const { defaultValue: e, defaultPattern: n, row: r, col: s } = t.value, i = b(T), o = xe(() => ""), c = i.t, a = Cn(), m = R(
|
|
333
401
|
() => [
|
|
334
|
-
{ label: "sheet.numfmt.general", component:
|
|
335
|
-
{ label: "sheet.numfmt.accounting", component:
|
|
336
|
-
{ label: "sheet.numfmt.currency", component:
|
|
337
|
-
{ label: "sheet.numfmt.date", component:
|
|
338
|
-
{ label: "sheet.numfmt.thousandthPercentile", component:
|
|
339
|
-
{ label: "sheet.numfmt.customFormat", component:
|
|
340
|
-
].map((
|
|
402
|
+
{ label: "sheet.numfmt.general", component: Bn },
|
|
403
|
+
{ label: "sheet.numfmt.accounting", component: Nn },
|
|
404
|
+
{ label: "sheet.numfmt.currency", component: Tn },
|
|
405
|
+
{ label: "sheet.numfmt.date", component: An },
|
|
406
|
+
{ label: "sheet.numfmt.thousandthPercentile", component: Vn },
|
|
407
|
+
{ label: "sheet.numfmt.customFormat", component: Ln }
|
|
408
|
+
].map((g) => ({ ...g, label: c(g.label) })),
|
|
341
409
|
[]
|
|
342
|
-
), [d,
|
|
343
|
-
var
|
|
344
|
-
return (
|
|
410
|
+
), [d, u] = C(_), [h, p] = C(() => `${r}_${s}`), { mark: v, userHabitCurrency: f } = bn(() => p(`${r}_${s}_userCurrency'`)), y = R(() => {
|
|
411
|
+
var g;
|
|
412
|
+
return (g = m.find((w) => w.label === d)) == null ? void 0 : g.component;
|
|
345
413
|
}, [d]);
|
|
346
|
-
function
|
|
347
|
-
return [
|
|
414
|
+
function _() {
|
|
415
|
+
return [kn, In, En, Hn, Wn].reduce((w, ut, dt) => w || (ut(n) ? m[dt].label : ""), "") || m[0].label;
|
|
348
416
|
}
|
|
349
|
-
const
|
|
350
|
-
label:
|
|
351
|
-
value:
|
|
352
|
-
})), x = (
|
|
353
|
-
|
|
354
|
-
},
|
|
355
|
-
t.onChange({ type: "change", value:
|
|
356
|
-
},
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
},
|
|
417
|
+
const I = m.map((g) => ({
|
|
418
|
+
label: g.label,
|
|
419
|
+
value: g.label
|
|
420
|
+
})), x = (g) => {
|
|
421
|
+
u(g), a(() => t.onChange({ type: "change", value: o.current() || "" }));
|
|
422
|
+
}, J = (g) => {
|
|
423
|
+
t.onChange({ type: "change", value: g });
|
|
424
|
+
}, le = () => {
|
|
425
|
+
const g = o.current() || "", w = W(g);
|
|
426
|
+
w && v(w), t.onChange({ type: "confirm", value: g });
|
|
427
|
+
}, F = () => {
|
|
360
428
|
t.onChange({ type: "cancel", value: "" });
|
|
361
|
-
},
|
|
362
|
-
onChange:
|
|
429
|
+
}, me = {
|
|
430
|
+
onChange: J,
|
|
363
431
|
defaultValue: e,
|
|
364
|
-
defaultPattern:
|
|
432
|
+
defaultPattern: n,
|
|
365
433
|
action: o
|
|
366
434
|
};
|
|
367
|
-
return
|
|
368
|
-
|
|
369
|
-
}, [
|
|
435
|
+
return ae(() => {
|
|
436
|
+
u(_()), p(`${r}_${s}`);
|
|
437
|
+
}, [r, s]), /* @__PURE__ */ l.jsxs("div", { className: "numfmt-panel p-b-20", children: [
|
|
370
438
|
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
371
439
|
/* @__PURE__ */ l.jsx("div", { className: "label m-t-14", children: c("sheet.numfmt.numfmtType") }),
|
|
372
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(
|
|
373
|
-
/* @__PURE__ */ l.jsx("div", { children:
|
|
440
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(Re, { onChange: x, options: I, value: d, style: { width: "100%" } }) }),
|
|
441
|
+
/* @__PURE__ */ l.jsx("div", { children: y && /* @__PURE__ */ l.jsx(we.Provider, { value: f, children: /* @__PURE__ */ Pe(y, { ...me, key: h }) }) })
|
|
374
442
|
] }),
|
|
375
443
|
/* @__PURE__ */ l.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
376
|
-
/* @__PURE__ */ l.jsx(
|
|
377
|
-
/* @__PURE__ */ l.jsx(
|
|
444
|
+
/* @__PURE__ */ l.jsx($e, { size: "small", onClick: F, className: "m-r-12", children: c("sheet.numfmt.cancel") }),
|
|
445
|
+
/* @__PURE__ */ l.jsx($e, { type: "primary", size: "small", onClick: le, children: c("sheet.numfmt.confirm") })
|
|
378
446
|
] })
|
|
379
447
|
] });
|
|
380
448
|
};
|
|
381
|
-
var
|
|
382
|
-
for (var s =
|
|
383
|
-
(o = t[i]) && (s = (
|
|
384
|
-
return
|
|
385
|
-
}, P = (t, e) => (
|
|
386
|
-
const
|
|
387
|
-
let
|
|
388
|
-
constructor(e,
|
|
449
|
+
var Kn = Object.defineProperty, qn = Object.getOwnPropertyDescriptor, Yn = (t, e, n, r) => {
|
|
450
|
+
for (var s = r > 1 ? void 0 : r ? qn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
451
|
+
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
452
|
+
return r && s && Kn(e, n, s), s;
|
|
453
|
+
}, P = (t, e) => (n, r) => e(n, r, t);
|
|
454
|
+
const Ae = "SHEET_NUMFMT_PANEL";
|
|
455
|
+
let B = class extends oe {
|
|
456
|
+
constructor(e, n, r, s, i, o, c, a, m, d) {
|
|
389
457
|
super();
|
|
390
458
|
/**
|
|
391
459
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -395,129 +463,129 @@ let A = class extends pe {
|
|
|
395
463
|
*/
|
|
396
464
|
X(this, "_previewPattern", "");
|
|
397
465
|
X(this, "_sidebarDisposable", null);
|
|
398
|
-
this._sheetInterceptorService = e, this._themeService =
|
|
466
|
+
this._sheetInterceptorService = e, this._themeService = n, this._univerInstanceService = r, this._commandService = s, this._selectionManagerService = i, this._renderManagerService = o, this._numfmtService = c, this._componentManager = a, this._sidebarService = m, this._localeService = d, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener();
|
|
399
467
|
}
|
|
400
468
|
openPanel() {
|
|
401
|
-
var
|
|
402
|
-
const e = this._sidebarService,
|
|
469
|
+
var y;
|
|
470
|
+
const e = this._sidebarService, n = this._selectionManagerService, r = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService, a = (((y = n.getCurrentSelections()) == null ? void 0 : y.map((_) => _.range)) || [])[0];
|
|
403
471
|
if (!a)
|
|
404
472
|
return !1;
|
|
405
|
-
const
|
|
473
|
+
const m = s.getCurrentUnitForType(E.UNIVER_SHEET), d = m.getActiveSheet();
|
|
406
474
|
if (!d)
|
|
407
475
|
return !1;
|
|
408
|
-
const
|
|
409
|
-
|
|
476
|
+
const u = d.getCellRaw(a.startRow, a.startColumn), h = i.getValue(
|
|
477
|
+
m.getUnitId(),
|
|
410
478
|
d.getSheetId(),
|
|
411
479
|
a.startRow,
|
|
412
480
|
a.startColumn
|
|
413
481
|
);
|
|
414
482
|
let p = "";
|
|
415
|
-
|
|
416
|
-
const v = (
|
|
417
|
-
onChange: (
|
|
418
|
-
var
|
|
419
|
-
if (
|
|
420
|
-
this._previewPattern =
|
|
421
|
-
else if (
|
|
422
|
-
const x = ((
|
|
423
|
-
x.forEach((
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
row:
|
|
427
|
-
col:
|
|
428
|
-
pattern:
|
|
429
|
-
type:
|
|
483
|
+
h && (p = h.pattern);
|
|
484
|
+
const v = (u == null ? void 0 : u.t) === $.NUMBER ? u.v : 12345678, f = {
|
|
485
|
+
onChange: (_) => {
|
|
486
|
+
var I;
|
|
487
|
+
if (_.type === "change")
|
|
488
|
+
this._previewPattern = _.value, this._forceUpdate();
|
|
489
|
+
else if (_.type === "confirm") {
|
|
490
|
+
const x = ((I = n.getCurrentSelections()) == null ? void 0 : I.map((F) => F.range)) || [], J = { values: [] }, le = ne(_.value);
|
|
491
|
+
x.forEach((F) => {
|
|
492
|
+
Ve.foreach(F, (me, g) => {
|
|
493
|
+
J.values.push({
|
|
494
|
+
row: me,
|
|
495
|
+
col: g,
|
|
496
|
+
pattern: _.value,
|
|
497
|
+
type: le
|
|
430
498
|
});
|
|
431
499
|
});
|
|
432
|
-
}),
|
|
433
|
-
} else
|
|
500
|
+
}), r.executeCommand(Ze.id, J), e.close();
|
|
501
|
+
} else _.type === "cancel" && e.close();
|
|
434
502
|
},
|
|
435
503
|
value: { defaultPattern: p, defaultValue: v, row: a.startRow, col: a.startColumn }
|
|
436
504
|
};
|
|
437
505
|
return this._sidebarDisposable = e.open({
|
|
438
506
|
header: { title: o.t("sheet.numfmt.title") },
|
|
439
507
|
children: {
|
|
440
|
-
label:
|
|
508
|
+
label: Ae,
|
|
441
509
|
...f
|
|
442
510
|
// need passthrough to react props.
|
|
443
511
|
},
|
|
444
512
|
onClose: () => {
|
|
445
|
-
this._forceUpdate(),
|
|
513
|
+
this._forceUpdate(), r.executeCommand(he.id);
|
|
446
514
|
}
|
|
447
515
|
}), !0;
|
|
448
516
|
}
|
|
449
517
|
_forceUpdate(e) {
|
|
450
|
-
var
|
|
451
|
-
const
|
|
518
|
+
var r;
|
|
519
|
+
const n = this._renderManagerService.getRenderById(
|
|
452
520
|
e != null ? e : this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET).getUnitId()
|
|
453
521
|
);
|
|
454
|
-
|
|
522
|
+
n == null || n.with(Ft).reCalculate(), (r = n == null ? void 0 : n.mainComponent) == null || r.makeDirty();
|
|
455
523
|
}
|
|
456
524
|
_initCommands() {
|
|
457
525
|
[
|
|
458
|
-
|
|
459
|
-
|
|
526
|
+
A,
|
|
527
|
+
he
|
|
460
528
|
].forEach((e) => {
|
|
461
529
|
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
462
530
|
});
|
|
463
531
|
}
|
|
464
532
|
_initPanel() {
|
|
465
|
-
this._componentManager.register(
|
|
533
|
+
this._componentManager.register(Ae, Gn);
|
|
466
534
|
}
|
|
467
535
|
_initRealTimeRenderingInterceptor() {
|
|
468
|
-
const e = new
|
|
536
|
+
const e = new D((r) => {
|
|
469
537
|
this._commandService.onCommandExecuted((s) => {
|
|
470
|
-
s.id ===
|
|
538
|
+
s.id === A.id && r.next(!0), s.id === he.id && r.next(!1);
|
|
471
539
|
});
|
|
472
|
-
}),
|
|
540
|
+
}), n = nn([
|
|
473
541
|
e,
|
|
474
542
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
475
|
-
|
|
543
|
+
sn((r) => r ? r.map((s) => s.range) : [])
|
|
476
544
|
)
|
|
477
545
|
]);
|
|
478
546
|
this.disposeWithMe(
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
([
|
|
483
|
-
const o = new
|
|
484
|
-
return
|
|
547
|
+
ge(
|
|
548
|
+
n.pipe(
|
|
549
|
+
on(
|
|
550
|
+
([r, s]) => new D((i) => {
|
|
551
|
+
const o = new vt();
|
|
552
|
+
return r && s.length && i.next({ selectionRanges: s, disposableCollection: o }), () => {
|
|
485
553
|
o.dispose();
|
|
486
554
|
};
|
|
487
555
|
})
|
|
488
556
|
),
|
|
489
|
-
|
|
557
|
+
cn(() => {
|
|
490
558
|
this._previewPattern = null;
|
|
491
559
|
})
|
|
492
|
-
).subscribe(({ disposableCollection:
|
|
560
|
+
).subscribe(({ disposableCollection: r, selectionRanges: s }) => {
|
|
493
561
|
var o, c;
|
|
494
562
|
const i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
495
|
-
this.openPanel(),
|
|
496
|
-
this._sheetInterceptorService.intercept(
|
|
563
|
+
this.openPanel(), r.add(
|
|
564
|
+
this._sheetInterceptorService.intercept(Yt.CELL_CONTENT, {
|
|
497
565
|
priority: 99,
|
|
498
|
-
effect:
|
|
499
|
-
handler: (a,
|
|
500
|
-
const { row:
|
|
566
|
+
effect: Oe.Value | Oe.Style,
|
|
567
|
+
handler: (a, m, d) => {
|
|
568
|
+
const { row: u, col: h } = m, p = d(a) || {};
|
|
501
569
|
if (s.find(
|
|
502
|
-
(v) => v.startColumn <=
|
|
570
|
+
(v) => v.startColumn <= h && v.endColumn >= h && v.startRow <= u && v.endRow >= u
|
|
503
571
|
)) {
|
|
504
|
-
const v =
|
|
505
|
-
if (f == null ||
|
|
572
|
+
const v = m.worksheet.getCellRaw(u, h), f = v == null ? void 0 : v.v, y = v == null ? void 0 : v.t;
|
|
573
|
+
if (f == null || y !== $.NUMBER || this._previewPattern === null)
|
|
506
574
|
return p;
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
509
|
-
const x = this._themeService.getCurrentTheme()[`${
|
|
575
|
+
const _ = Rt(this._previewPattern, f, this._localeService.getCurrentLocale());
|
|
576
|
+
if (_.color) {
|
|
577
|
+
const x = this._themeService.getCurrentTheme()[`${_.color}500`];
|
|
510
578
|
return {
|
|
511
579
|
...p,
|
|
512
|
-
v:
|
|
513
|
-
t:
|
|
580
|
+
v: _.result,
|
|
581
|
+
t: $.STRING,
|
|
514
582
|
s: { cl: { rgb: x } }
|
|
515
583
|
};
|
|
516
584
|
}
|
|
517
585
|
return {
|
|
518
586
|
...p,
|
|
519
|
-
v:
|
|
520
|
-
t:
|
|
587
|
+
v: _.result,
|
|
588
|
+
t: $.STRING
|
|
521
589
|
};
|
|
522
590
|
}
|
|
523
591
|
return p;
|
|
@@ -529,44 +597,44 @@ let A = class extends pe {
|
|
|
529
597
|
);
|
|
530
598
|
}
|
|
531
599
|
_commandExecutedListener() {
|
|
532
|
-
const e = [
|
|
600
|
+
const e = [Ne.id, Ee.id];
|
|
533
601
|
this.disposeWithMe(
|
|
534
|
-
new
|
|
535
|
-
const
|
|
602
|
+
new D((n) => {
|
|
603
|
+
const r = this._commandService.onCommandExecuted((s) => {
|
|
536
604
|
if (e.includes(s.id)) {
|
|
537
605
|
const i = s.params;
|
|
538
|
-
|
|
606
|
+
n.next(i.unitId);
|
|
539
607
|
}
|
|
540
608
|
});
|
|
541
|
-
return () =>
|
|
542
|
-
}).pipe(
|
|
609
|
+
return () => r.dispose();
|
|
610
|
+
}).pipe(an(16)).subscribe((n) => this._forceUpdate(n))
|
|
543
611
|
);
|
|
544
612
|
}
|
|
545
613
|
_initCloseListener() {
|
|
546
614
|
this._univerInstanceService.getCurrentTypeOfUnit$(E.UNIVER_SHEET).subscribe((e) => {
|
|
547
|
-
var
|
|
548
|
-
e || ((
|
|
615
|
+
var n;
|
|
616
|
+
e || ((n = this._sidebarDisposable) == null || n.dispose(), this._sidebarDisposable = null);
|
|
549
617
|
});
|
|
550
618
|
}
|
|
551
619
|
};
|
|
552
|
-
|
|
553
|
-
P(0,
|
|
554
|
-
P(1,
|
|
555
|
-
P(2,
|
|
556
|
-
P(3,
|
|
557
|
-
P(4,
|
|
558
|
-
P(5,
|
|
559
|
-
P(6,
|
|
560
|
-
P(7,
|
|
561
|
-
P(8,
|
|
562
|
-
P(9,
|
|
563
|
-
],
|
|
564
|
-
var
|
|
565
|
-
for (var s =
|
|
566
|
-
(o = t[i]) && (s = (
|
|
567
|
-
return
|
|
568
|
-
},
|
|
569
|
-
const
|
|
620
|
+
B = Yn([
|
|
621
|
+
P(0, S(tt)),
|
|
622
|
+
P(1, S(_t)),
|
|
623
|
+
P(2, ye),
|
|
624
|
+
P(3, be),
|
|
625
|
+
P(4, S(Te)),
|
|
626
|
+
P(5, Ke),
|
|
627
|
+
P(6, Ie),
|
|
628
|
+
P(7, S(et)),
|
|
629
|
+
P(8, Bt),
|
|
630
|
+
P(9, S(T))
|
|
631
|
+
], B);
|
|
632
|
+
var Zn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Jn = (t, e, n, r) => {
|
|
633
|
+
for (var s = r > 1 ? void 0 : r ? zn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
634
|
+
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
635
|
+
return r && s && Zn(e, n, s), s;
|
|
636
|
+
}, H = (t, e) => (n, r) => e(n, r, t);
|
|
637
|
+
const Xn = () => {
|
|
570
638
|
let t = [];
|
|
571
639
|
return {
|
|
572
640
|
add: (s, i, o, c, a) => t.push({ unitId: s, subUnitId: i, row: o, col: c, value: a }),
|
|
@@ -576,41 +644,41 @@ const Hn = () => {
|
|
|
576
644
|
}
|
|
577
645
|
};
|
|
578
646
|
};
|
|
579
|
-
let
|
|
580
|
-
constructor(e,
|
|
647
|
+
let re = class extends oe {
|
|
648
|
+
constructor(e, n, r, s, i) {
|
|
581
649
|
super();
|
|
582
650
|
// collect effect mutations when edit end and push this to commands stack in next commands progress
|
|
583
|
-
X(this, "_collectEffectMutation",
|
|
584
|
-
this._sheetInterceptorService = e, this._numfmtService =
|
|
651
|
+
X(this, "_collectEffectMutation", Xn());
|
|
652
|
+
this._sheetInterceptorService = e, this._numfmtService = n, this._univerInstanceService = r, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
|
|
585
653
|
}
|
|
586
654
|
_initInterceptorEditorStart() {
|
|
587
655
|
this._editorBridgeService && this.disposeWithMe(
|
|
588
|
-
|
|
656
|
+
ge(
|
|
589
657
|
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
590
|
-
|
|
658
|
+
Zt,
|
|
591
659
|
{
|
|
592
|
-
handler: (e,
|
|
593
|
-
const s =
|
|
594
|
-
|
|
595
|
-
|
|
660
|
+
handler: (e, n, r) => {
|
|
661
|
+
const s = n.row, i = n.col, o = this._numfmtService.getValue(
|
|
662
|
+
n.unitId,
|
|
663
|
+
n.subUnitId,
|
|
596
664
|
s,
|
|
597
665
|
i
|
|
598
666
|
);
|
|
599
667
|
if (o)
|
|
600
|
-
switch (
|
|
668
|
+
switch (ne(o.pattern)) {
|
|
601
669
|
case "scientific":
|
|
602
670
|
case "currency":
|
|
603
671
|
case "grouped":
|
|
604
672
|
case "number":
|
|
605
|
-
return
|
|
673
|
+
return n.worksheet.getCellRaw(s, i);
|
|
606
674
|
case "percent":
|
|
607
675
|
case "date":
|
|
608
676
|
case "time":
|
|
609
677
|
case "datetime":
|
|
610
678
|
default:
|
|
611
|
-
return
|
|
679
|
+
return r && r(e);
|
|
612
680
|
}
|
|
613
|
-
return
|
|
681
|
+
return r(e);
|
|
614
682
|
}
|
|
615
683
|
}
|
|
616
684
|
)
|
|
@@ -624,52 +692,52 @@ let ne = class extends pe {
|
|
|
624
692
|
*/
|
|
625
693
|
_initInterceptorEditorEnd() {
|
|
626
694
|
this.disposeWithMe(
|
|
627
|
-
|
|
695
|
+
ge(
|
|
628
696
|
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
629
|
-
|
|
697
|
+
zt,
|
|
630
698
|
{
|
|
631
699
|
// eslint-disable-next-line complexity
|
|
632
|
-
handler: (e,
|
|
633
|
-
var d,
|
|
700
|
+
handler: (e, n, r) => {
|
|
701
|
+
var d, u, h, p;
|
|
634
702
|
this._collectEffectMutation.clean();
|
|
635
703
|
const s = this._numfmtService.getValue(
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
), i = (d = s &&
|
|
704
|
+
n.unitId,
|
|
705
|
+
n.subUnitId,
|
|
706
|
+
n.row,
|
|
707
|
+
n.col
|
|
708
|
+
), i = (d = s && ne(s.pattern)) != null ? d : "", o = () => {
|
|
641
709
|
s && this._collectEffectMutation.add(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
710
|
+
n.unitId,
|
|
711
|
+
n.subUnitId,
|
|
712
|
+
n.row,
|
|
713
|
+
n.col,
|
|
646
714
|
null
|
|
647
715
|
);
|
|
648
716
|
};
|
|
649
|
-
if (!(e != null && e.v) && !(e != null && e.p) || (s == null ? void 0 : s.pattern) ===
|
|
650
|
-
return
|
|
651
|
-
const c = (
|
|
717
|
+
if (!(e != null && e.v) && !(e != null && e.p) || (s == null ? void 0 : s.pattern) === Ce || e.t === $.FORCE_STRING)
|
|
718
|
+
return r(e);
|
|
719
|
+
const c = (u = e.p) == null ? void 0 : u.body, a = (p = (h = e == null ? void 0 : e.p) == null ? void 0 : h.body) != null && p.dataStream ? e.p.body.dataStream.replace(/\r\n$/, "") : String(e.v), m = Q.parseDate(a) || Q.parseTime(a) || Q.parseNumber(a);
|
|
652
720
|
if (c)
|
|
653
|
-
if (
|
|
654
|
-
const { dataStream: v } = c, f = v.replace(/\r\n$/, ""),
|
|
655
|
-
if (Number.isNaN(
|
|
656
|
-
return
|
|
721
|
+
if (er(c)) {
|
|
722
|
+
const { dataStream: v } = c, f = v.replace(/\r\n$/, ""), y = Number(f);
|
|
723
|
+
if (Number.isNaN(y) && !m)
|
|
724
|
+
return r(e);
|
|
657
725
|
} else
|
|
658
|
-
return
|
|
659
|
-
if (
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
726
|
+
return r(e);
|
|
727
|
+
if (m) {
|
|
728
|
+
m.z && this._collectEffectMutation.add(
|
|
729
|
+
n.unitId,
|
|
730
|
+
n.subUnitId,
|
|
731
|
+
n.row,
|
|
732
|
+
n.col,
|
|
665
733
|
{
|
|
666
|
-
pattern:
|
|
734
|
+
pattern: m.z
|
|
667
735
|
}
|
|
668
736
|
);
|
|
669
|
-
const v = Number(
|
|
670
|
-
return
|
|
671
|
-
} else (["date", "time", "datetime", "percent"].includes(i) || !
|
|
672
|
-
return
|
|
737
|
+
const v = Number(m.v);
|
|
738
|
+
return r({ ...e, p: void 0, v, t: $.NUMBER });
|
|
739
|
+
} else (["date", "time", "datetime", "percent"].includes(i) || !Qn(a)) && o();
|
|
740
|
+
return r(e);
|
|
673
741
|
}
|
|
674
742
|
}
|
|
675
743
|
)
|
|
@@ -680,11 +748,11 @@ let ne = class extends pe {
|
|
|
680
748
|
const e = this;
|
|
681
749
|
this.disposeWithMe(
|
|
682
750
|
this._sheetInterceptorService.interceptCommand({
|
|
683
|
-
getMutations(
|
|
684
|
-
var
|
|
685
|
-
switch (
|
|
686
|
-
case
|
|
687
|
-
const s = e._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET), i = s.getUnitId(), o = (
|
|
751
|
+
getMutations(n) {
|
|
752
|
+
var r;
|
|
753
|
+
switch (n.id) {
|
|
754
|
+
case Jt.id: {
|
|
755
|
+
const s = e._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET), i = s.getUnitId(), o = (r = s.getActiveSheet()) == null ? void 0 : r.getSheetId();
|
|
688
756
|
if (!o)
|
|
689
757
|
return {
|
|
690
758
|
redos: [],
|
|
@@ -696,43 +764,43 @@ let ne = class extends pe {
|
|
|
696
764
|
redos: [],
|
|
697
765
|
undos: []
|
|
698
766
|
};
|
|
699
|
-
const a = c.filter((
|
|
767
|
+
const a = c.filter((h) => {
|
|
700
768
|
var p;
|
|
701
|
-
return !!((p =
|
|
702
|
-
}).map((
|
|
703
|
-
row:
|
|
704
|
-
col:
|
|
705
|
-
pattern:
|
|
706
|
-
})),
|
|
769
|
+
return !!((p = h.value) != null && p.pattern);
|
|
770
|
+
}).map((h) => ({
|
|
771
|
+
row: h.row,
|
|
772
|
+
col: h.col,
|
|
773
|
+
pattern: h.value.pattern
|
|
774
|
+
})), m = c.filter((h) => {
|
|
707
775
|
var p;
|
|
708
|
-
return !((p =
|
|
709
|
-
}).map((
|
|
710
|
-
startRow:
|
|
711
|
-
endColumn:
|
|
712
|
-
startColumn:
|
|
713
|
-
endRow:
|
|
714
|
-
})), d = [],
|
|
776
|
+
return !((p = h.value) != null && p.pattern);
|
|
777
|
+
}).map((h) => ({
|
|
778
|
+
startRow: h.row,
|
|
779
|
+
endColumn: h.col,
|
|
780
|
+
startColumn: h.col,
|
|
781
|
+
endRow: h.row
|
|
782
|
+
})), d = [], u = [];
|
|
715
783
|
if (a.length) {
|
|
716
|
-
const
|
|
717
|
-
id:
|
|
718
|
-
params:
|
|
784
|
+
const h = {
|
|
785
|
+
id: Ee.id,
|
|
786
|
+
params: Xt(i, o, a)
|
|
719
787
|
};
|
|
720
|
-
d.push(
|
|
788
|
+
d.push(h), u.push(...Qt(e._injector, h.params));
|
|
721
789
|
}
|
|
722
|
-
if (
|
|
723
|
-
const
|
|
724
|
-
id:
|
|
790
|
+
if (m.length) {
|
|
791
|
+
const h = {
|
|
792
|
+
id: Ne.id,
|
|
725
793
|
params: {
|
|
726
794
|
unitId: i,
|
|
727
795
|
subUnitId: o,
|
|
728
|
-
ranges:
|
|
796
|
+
ranges: m
|
|
729
797
|
}
|
|
730
798
|
};
|
|
731
|
-
d.push(
|
|
799
|
+
d.push(h), u.push(...en(e._injector, h.params));
|
|
732
800
|
}
|
|
733
801
|
return {
|
|
734
802
|
redos: d,
|
|
735
|
-
undos:
|
|
803
|
+
undos: u.reverse()
|
|
736
804
|
};
|
|
737
805
|
}
|
|
738
806
|
}
|
|
@@ -745,28 +813,28 @@ let ne = class extends pe {
|
|
|
745
813
|
);
|
|
746
814
|
}
|
|
747
815
|
};
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
],
|
|
755
|
-
function
|
|
816
|
+
re = Jn([
|
|
817
|
+
H(0, S(tt)),
|
|
818
|
+
H(1, S(Ie)),
|
|
819
|
+
H(2, S(ye)),
|
|
820
|
+
H(3, S(Ge)),
|
|
821
|
+
H(4, gt(Lt))
|
|
822
|
+
], re);
|
|
823
|
+
function Qn(t) {
|
|
756
824
|
return /^-?\d+(\.\d+)?$/.test(t);
|
|
757
825
|
}
|
|
758
|
-
function
|
|
759
|
-
const { textRuns: e = [], paragraphs:
|
|
760
|
-
return !(e.some((o) => !!(o.ts && Object.keys(o.ts).some((a) => i.includes(a)))) ||
|
|
826
|
+
function er(t) {
|
|
827
|
+
const { textRuns: e = [], paragraphs: n = [], customRanges: r, customBlocks: s = [] } = t, i = ["va"];
|
|
828
|
+
return !(e.some((o) => !!(o.ts && Object.keys(o.ts).some((a) => i.includes(a)))) || n.some((o) => o.bullet) || n.length >= 2 || r != null && r.length || s.length > 0);
|
|
761
829
|
}
|
|
762
|
-
const
|
|
830
|
+
const ee = [
|
|
763
831
|
{
|
|
764
832
|
label: "sheet.numfmt.general",
|
|
765
833
|
pattern: null
|
|
766
834
|
},
|
|
767
835
|
{
|
|
768
836
|
label: "sheet.numfmt.text",
|
|
769
|
-
pattern:
|
|
837
|
+
pattern: Ce
|
|
770
838
|
},
|
|
771
839
|
"|",
|
|
772
840
|
{
|
|
@@ -812,122 +880,122 @@ const Q = [
|
|
|
812
880
|
label: "sheet.numfmt.moreFmt",
|
|
813
881
|
pattern: ""
|
|
814
882
|
}
|
|
815
|
-
],
|
|
816
|
-
icon: new
|
|
817
|
-
const
|
|
818
|
-
function
|
|
883
|
+
], tr = (t) => ({
|
|
884
|
+
icon: new D((e) => {
|
|
885
|
+
const n = t.get(jt);
|
|
886
|
+
function r(i) {
|
|
819
887
|
return {
|
|
820
|
-
[
|
|
821
|
-
[
|
|
822
|
-
[
|
|
823
|
-
[
|
|
888
|
+
[O.US]: "DollarSingle",
|
|
889
|
+
[O.RU]: "RoubleSingle",
|
|
890
|
+
[O.CN]: "RmbSingle",
|
|
891
|
+
[O.AT]: "EuroSingle"
|
|
824
892
|
}[i] || "DollarSingle";
|
|
825
893
|
}
|
|
826
|
-
const s =
|
|
827
|
-
return e.next(
|
|
828
|
-
const o =
|
|
829
|
-
e.next(
|
|
894
|
+
const s = O[n.getCurrencySymbol()] || "$";
|
|
895
|
+
return e.next(r(s)), n.currencySymbol$.subscribe((i) => {
|
|
896
|
+
const o = O[i] || "$";
|
|
897
|
+
e.next(r(o));
|
|
830
898
|
});
|
|
831
899
|
}),
|
|
832
|
-
id:
|
|
900
|
+
id: ze.id,
|
|
833
901
|
title: "sheet.numfmt.currency",
|
|
834
902
|
tooltip: "sheet.numfmt.currency",
|
|
835
|
-
type:
|
|
836
|
-
hidden$:
|
|
837
|
-
disabled$:
|
|
838
|
-
}),
|
|
903
|
+
type: G.BUTTON,
|
|
904
|
+
hidden$: K(t, E.UNIVER_SHEET),
|
|
905
|
+
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
906
|
+
}), nr = (t) => ({
|
|
839
907
|
icon: "AddDigitsSingle",
|
|
840
|
-
id:
|
|
908
|
+
id: Je.id,
|
|
841
909
|
title: "sheet.numfmt.addDecimal",
|
|
842
910
|
tooltip: "sheet.numfmt.addDecimal",
|
|
843
|
-
type:
|
|
844
|
-
hidden$:
|
|
845
|
-
disabled$:
|
|
846
|
-
}),
|
|
911
|
+
type: G.BUTTON,
|
|
912
|
+
hidden$: K(t, E.UNIVER_SHEET),
|
|
913
|
+
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
914
|
+
}), rr = (t) => ({
|
|
847
915
|
icon: "ReduceDigitsSingle",
|
|
848
|
-
id:
|
|
916
|
+
id: Xe.id,
|
|
849
917
|
title: "sheet.numfmt.subtractDecimal",
|
|
850
918
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
851
|
-
type:
|
|
852
|
-
hidden$:
|
|
853
|
-
disabled$:
|
|
854
|
-
}),
|
|
919
|
+
type: G.BUTTON,
|
|
920
|
+
hidden$: K(t, E.UNIVER_SHEET),
|
|
921
|
+
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
922
|
+
}), sr = (t) => ({
|
|
855
923
|
icon: "PercentSingle",
|
|
856
|
-
id:
|
|
924
|
+
id: Qe.id,
|
|
857
925
|
title: "sheet.numfmt.percent",
|
|
858
926
|
tooltip: "sheet.numfmt.percent",
|
|
859
|
-
type:
|
|
860
|
-
hidden$:
|
|
861
|
-
disabled$:
|
|
862
|
-
}),
|
|
863
|
-
const e = t.get(
|
|
864
|
-
(a) =>
|
|
927
|
+
type: G.BUTTON,
|
|
928
|
+
hidden$: K(t, E.UNIVER_SHEET),
|
|
929
|
+
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
930
|
+
}), ir = (t) => {
|
|
931
|
+
const e = t.get(ye), n = t.get(be), r = t.get(T), s = t.get(Te), i = Ht(e, "", ({ workbook: o, worksheet: c }) => new D(
|
|
932
|
+
(a) => rn(
|
|
865
933
|
s.selectionMoveEnd$,
|
|
866
|
-
new
|
|
867
|
-
const d = [
|
|
868
|
-
d.includes(
|
|
934
|
+
new D((m) => {
|
|
935
|
+
const d = [Ne.id, Ee.id], u = n.onCommandExecuted((h) => {
|
|
936
|
+
d.includes(h.id) && m.next(null);
|
|
869
937
|
});
|
|
870
|
-
return () =>
|
|
938
|
+
return () => u.dispose();
|
|
871
939
|
})
|
|
872
940
|
).subscribe(() => {
|
|
873
|
-
var d,
|
|
874
|
-
const
|
|
875
|
-
if (
|
|
876
|
-
const
|
|
877
|
-
let
|
|
878
|
-
if (
|
|
879
|
-
const
|
|
880
|
-
(x) =>
|
|
941
|
+
var d, u;
|
|
942
|
+
const m = s.getCurrentSelections();
|
|
943
|
+
if (m && m[0]) {
|
|
944
|
+
const h = m[0].range, p = h.startRow, v = h.startColumn, f = (u = o.getStyles().get((d = c.getCell(p, v)) == null ? void 0 : d.s)) == null ? void 0 : u.n, y = f == null ? void 0 : f.pattern;
|
|
945
|
+
let _ = r.t("sheet.numfmt.general");
|
|
946
|
+
if (y) {
|
|
947
|
+
const I = ee.filter((x) => typeof x == "object" && x.pattern).find(
|
|
948
|
+
(x) => ce(y, x.pattern)
|
|
881
949
|
);
|
|
882
|
-
|
|
950
|
+
I && typeof I == "object" && I.pattern ? _ = r.t(I.label) : _ = r.t("sheet.numfmt.moreFmt");
|
|
883
951
|
}
|
|
884
|
-
a.next(
|
|
952
|
+
a.next(_);
|
|
885
953
|
}
|
|
886
954
|
})
|
|
887
955
|
));
|
|
888
956
|
return {
|
|
889
|
-
label:
|
|
890
|
-
id:
|
|
957
|
+
label: ct,
|
|
958
|
+
id: A.id,
|
|
891
959
|
tooltip: "sheet.numfmt.title",
|
|
892
|
-
type:
|
|
960
|
+
type: G.SELECTOR,
|
|
893
961
|
selections: [
|
|
894
962
|
{
|
|
895
963
|
label: {
|
|
896
|
-
name:
|
|
964
|
+
name: at,
|
|
897
965
|
hoverable: !1
|
|
898
966
|
}
|
|
899
967
|
}
|
|
900
968
|
],
|
|
901
969
|
value$: i,
|
|
902
|
-
hidden$:
|
|
903
|
-
disabled$:
|
|
970
|
+
hidden$: K(t, E.UNIVER_SHEET),
|
|
971
|
+
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Z, Y], rangeTypes: [z] })
|
|
904
972
|
};
|
|
905
|
-
},
|
|
906
|
-
var
|
|
907
|
-
const e =
|
|
908
|
-
return /* @__PURE__ */ l.jsx("span", { className: "more-numfmt-type", children:
|
|
909
|
-
},
|
|
910
|
-
const t =
|
|
911
|
-
|
|
912
|
-
const
|
|
913
|
-
const a =
|
|
973
|
+
}, ct = "sheet.numfmt.moreNumfmtType", at = "sheet.numfmt.moreNumfmtType.options", or = (t) => {
|
|
974
|
+
var r;
|
|
975
|
+
const e = b(T), n = (r = t.value) != null ? r : e.t("sheet.numfmt.general");
|
|
976
|
+
return /* @__PURE__ */ l.jsx("span", { className: "more-numfmt-type", children: n });
|
|
977
|
+
}, cr = () => {
|
|
978
|
+
const t = b(be), e = b(T), n = b(Wt);
|
|
979
|
+
St();
|
|
980
|
+
const r = b(Te), s = (c) => {
|
|
981
|
+
const a = r.getCurrentLastSelection();
|
|
914
982
|
if (!a)
|
|
915
983
|
return;
|
|
916
|
-
const
|
|
917
|
-
|
|
918
|
-
c ? d.push({ row:
|
|
919
|
-
}), t.executeCommand(
|
|
984
|
+
const m = a.range, d = [];
|
|
985
|
+
Ve.foreach(m, (u, h) => {
|
|
986
|
+
c ? d.push({ row: u, col: h, pattern: c, type: ne(c) }) : d.push({ row: u, col: h });
|
|
987
|
+
}), t.executeCommand(Ze.id, { values: d }), n.focus();
|
|
920
988
|
}, i = (c) => {
|
|
921
989
|
if (c === 0)
|
|
922
990
|
s(null);
|
|
923
|
-
else if (c ===
|
|
924
|
-
t.executeCommand(
|
|
991
|
+
else if (c === ee.length - 1)
|
|
992
|
+
t.executeCommand(A.id);
|
|
925
993
|
else {
|
|
926
|
-
const a =
|
|
994
|
+
const a = ee[c];
|
|
927
995
|
a.pattern && s(a.pattern);
|
|
928
996
|
}
|
|
929
997
|
}, o = 1220;
|
|
930
|
-
return /* @__PURE__ */ l.jsx("div", { className: "more-numfmt-type-options", children:
|
|
998
|
+
return /* @__PURE__ */ l.jsx("div", { className: "more-numfmt-type-options", children: ee.map((c, a) => c === "|" ? /* @__PURE__ */ l.jsx("div", { className: "line m-t-4", onClick: (m) => m.stopPropagation() }, a) : /* @__PURE__ */ l.jsxs(
|
|
931
999
|
"div",
|
|
932
1000
|
{
|
|
933
1001
|
className: "option-item m-t-4",
|
|
@@ -936,91 +1004,99 @@ const Q = [
|
|
|
936
1004
|
},
|
|
937
1005
|
children: [
|
|
938
1006
|
/* @__PURE__ */ l.jsx("div", { children: e.t(c.label) }),
|
|
939
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-l-26", children: c.pattern ?
|
|
1007
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-l-26", children: c.pattern ? wt(c.pattern || "", o, e.getCurrentLocale()).result : "" })
|
|
940
1008
|
]
|
|
941
1009
|
},
|
|
942
1010
|
a
|
|
943
1011
|
)) });
|
|
944
|
-
},
|
|
945
|
-
[
|
|
946
|
-
[
|
|
1012
|
+
}, ar = {
|
|
1013
|
+
[Vt.FORMULAS_INSERT]: {
|
|
1014
|
+
[ze.id]: {
|
|
947
1015
|
order: 4,
|
|
948
|
-
menuItemFactory:
|
|
1016
|
+
menuItemFactory: tr
|
|
949
1017
|
},
|
|
950
|
-
[
|
|
1018
|
+
[Je.id]: {
|
|
951
1019
|
order: 5,
|
|
952
|
-
menuItemFactory:
|
|
1020
|
+
menuItemFactory: nr
|
|
953
1021
|
},
|
|
954
|
-
[
|
|
1022
|
+
[Xe.id]: {
|
|
955
1023
|
order: 6,
|
|
956
|
-
menuItemFactory:
|
|
1024
|
+
menuItemFactory: rr
|
|
957
1025
|
},
|
|
958
|
-
[
|
|
1026
|
+
[Qe.id]: {
|
|
959
1027
|
order: 7,
|
|
960
|
-
menuItemFactory:
|
|
1028
|
+
menuItemFactory: sr
|
|
961
1029
|
},
|
|
962
|
-
[
|
|
1030
|
+
[A.id]: {
|
|
963
1031
|
order: 8,
|
|
964
|
-
menuItemFactory:
|
|
1032
|
+
menuItemFactory: ir
|
|
965
1033
|
}
|
|
966
1034
|
}
|
|
967
1035
|
};
|
|
968
|
-
var
|
|
969
|
-
for (var s =
|
|
970
|
-
(o = t[i]) && (s = (
|
|
971
|
-
return
|
|
972
|
-
},
|
|
973
|
-
let
|
|
1036
|
+
var lr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, ur = (t, e, n, r) => {
|
|
1037
|
+
for (var s = r > 1 ? void 0 : r ? mr(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1038
|
+
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
1039
|
+
return r && s && lr(e, n, s), s;
|
|
1040
|
+
}, ke = (t, e) => (n, r) => e(n, r, t);
|
|
1041
|
+
let se = class extends oe {
|
|
974
1042
|
constructor(t, e) {
|
|
975
1043
|
super(), this._componentManager = t, this._menuManagerService = e, this._initMenu();
|
|
976
1044
|
}
|
|
977
1045
|
_initMenu() {
|
|
978
|
-
this._menuManagerService.mergeMenu(
|
|
1046
|
+
this._menuManagerService.mergeMenu(ar), this.disposeWithMe(this._componentManager.register(ct, or)), this.disposeWithMe(this._componentManager.register(at, cr));
|
|
979
1047
|
}
|
|
980
1048
|
};
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
],
|
|
985
|
-
var
|
|
986
|
-
for (var s =
|
|
987
|
-
(o = t[i]) && (s = (
|
|
988
|
-
return
|
|
989
|
-
},
|
|
990
|
-
const
|
|
991
|
-
let
|
|
992
|
-
constructor(t =
|
|
993
|
-
super(), this._config = t, this._injector = e, this._configService = r;
|
|
994
|
-
const { menu:
|
|
1049
|
+
se = ur([
|
|
1050
|
+
ke(0, S(et)),
|
|
1051
|
+
ke(1, Gt)
|
|
1052
|
+
], se);
|
|
1053
|
+
var lt = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, hr = (t, e, n) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, fr = (t, e, n, r) => {
|
|
1054
|
+
for (var s = r > 1 ? void 0 : r ? dr(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1055
|
+
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
1056
|
+
return r && s && lt(e, n, s), s;
|
|
1057
|
+
}, _e = (t, e) => (n, r) => e(n, r, t), mt = (t, e, n) => hr(t, typeof e != "symbol" ? e + "" : e, n);
|
|
1058
|
+
const pr = "SHEET_NUMFMT_UI_PLUGIN";
|
|
1059
|
+
let ie = class extends bt {
|
|
1060
|
+
constructor(t = De, e, n, r) {
|
|
1061
|
+
super(), this._config = t, this._injector = e, this._configService = n, this._renderManagerService = r;
|
|
1062
|
+
const { menu: s, ...i } = Ct(
|
|
995
1063
|
{},
|
|
996
|
-
|
|
1064
|
+
De,
|
|
997
1065
|
this._config
|
|
998
1066
|
);
|
|
999
|
-
|
|
1067
|
+
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(Kt, i);
|
|
1000
1068
|
}
|
|
1001
1069
|
onStarting() {
|
|
1002
|
-
|
|
1003
|
-
[
|
|
1004
|
-
[
|
|
1070
|
+
It(this._injector, [
|
|
1071
|
+
[B],
|
|
1072
|
+
[re],
|
|
1005
1073
|
[k],
|
|
1006
|
-
[
|
|
1074
|
+
[se]
|
|
1007
1075
|
]);
|
|
1008
1076
|
}
|
|
1009
1077
|
onRendered() {
|
|
1010
|
-
|
|
1011
|
-
[
|
|
1012
|
-
[
|
|
1013
|
-
[
|
|
1078
|
+
this._registerRenderModules(), Nt(this._injector, [
|
|
1079
|
+
[B],
|
|
1080
|
+
[re],
|
|
1081
|
+
[se]
|
|
1014
1082
|
]);
|
|
1015
1083
|
}
|
|
1084
|
+
_registerRenderModules() {
|
|
1085
|
+
[
|
|
1086
|
+
[Se]
|
|
1087
|
+
].forEach((e) => {
|
|
1088
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SHEET, e));
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1016
1091
|
};
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1092
|
+
mt(ie, "pluginName", pr);
|
|
1093
|
+
mt(ie, "type", E.UNIVER_SHEET);
|
|
1094
|
+
ie = fr([
|
|
1095
|
+
yt(At, Ot),
|
|
1096
|
+
_e(1, S(Ge)),
|
|
1097
|
+
_e(2, Et),
|
|
1098
|
+
_e(3, Ke)
|
|
1099
|
+
], ie);
|
|
1024
1100
|
export {
|
|
1025
|
-
|
|
1101
|
+
ie as UniverSheetsNumfmtUIPlugin
|
|
1026
1102
|
};
|