@univerjs/sheets-numfmt-ui 0.10.4 → 0.10.5
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 +1 -1
- package/lib/es/index.js +261 -261
- package/lib/index.js +261 -261
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +12 -12
package/lib/es/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var q = (e, t, r) =>
|
|
4
|
-
import { Inject as y, LocaleService as E, IConfigService as
|
|
5
|
-
import { IRenderManagerService as
|
|
6
|
-
import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Mt, currencySymbols as
|
|
7
|
-
import { HoverManagerService as
|
|
8
|
-
import { INumfmtService as
|
|
9
|
-
import { IZenZoneService as
|
|
10
|
-
import { debounceTime as
|
|
11
|
-
import { map as
|
|
1
|
+
var mt = Object.defineProperty;
|
|
2
|
+
var dt = (e, t, r) => t in e ? mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var q = (e, t, r) => dt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Inject as y, LocaleService as E, IConfigService as $e, Disposable as ne, isTextFormat as De, Tools as ht, isRealNum as ft, CommandType as Fe, ILocalStorageService as Le, isPatternEqualWithoutDecimal as re, numfmt as vt, ThemeService as pt, IUniverInstanceService as fe, ICommandService as ve, UniverInstanceType as w, CellValueType as U, toDisposable as de, DisposableCollection as gt, InterceptorEffectEnum as we, Range as Ae, Injector as He, Optional as _t, willLoseNumericPrecision as St, fromCallback as yt, isDefaultFormat as Ct, DEFAULT_TEXT_FORMAT_EXCEL as bt, DependentOn as It, Plugin as Nt, merge as Et, registerDependencies as Tt, touchDependencies as wt } from "@univerjs/core";
|
|
5
|
+
import { IRenderManagerService as je } from "@univerjs/engine-render";
|
|
6
|
+
import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Mt, currencySymbols as Me, getDecimalFromPattern as J, getCurrencyType as V, setPatternDecimal as R, getCurrencyFormatOptions as oe, CURRENCYFORMAT as Pt, DATEFMTLISG as xt, NUMBERFORMAT as Ot, getDateFormatOptions as Be, getNumberFormatOptions as Ve, isPatternHasDecimal as Rt, SheetsNumfmtCellContentController as We, getPatternPreviewIgnoreGeneral as kt, getPatternType as pe, SetNumfmtCommand as Ge, getNumfmtParseValueFilter as Ut, getCurrencySymbolByLocale as $t, SetPercentCommand as Ke, SubtractDecimalCommand as Ze, AddDecimalCommand as Ye, SetCurrencyCommand as ze, getCurrencySymbolIconByLocale as Pe, localeCurrencySymbolMap as Dt, getPatternPreview as Ft, UniverSheetsNumfmtPlugin as Lt } from "@univerjs/sheets-numfmt";
|
|
7
|
+
import { HoverManagerService as At, CellAlertManagerService as Ht, CellAlertType as jt, SheetSkeletonManagerService as Bt, IEditorBridgeService as Vt, deriveStateFromActiveSheet$ as Wt, getCurrentRangeDisable$ as W, UniverSheetsUIPlugin as Gt } from "@univerjs/sheets-ui";
|
|
8
|
+
import { INumfmtService as ge, SheetInterceptorService as Xe, SheetsSelectionsService as _e, INTERCEPTOR_POINT as Kt, RemoveNumfmtMutation as Se, SetNumfmtMutation as ye, BEFORE_CELL_EDIT as Zt, AFTER_CELL_EDIT as Yt, SetRangeValuesCommand as zt, transformCellsToRange as Xt, factorySetNumfmtUndoMutation as qt, factoryRemoveNumfmtUndoMutation as Jt, RangeProtectionPermissionEditPoint as G, WorksheetSetCellStylePermission as K, WorksheetEditPermission as Z, WorkbookEditablePermission as Y } from "@univerjs/sheets";
|
|
9
|
+
import { IZenZoneService as Qt, useDependency as b, ComponentManager as qe, ISidebarService as en, getMenuHiddenObservable as z, MenuItemType as X, ILayoutService as tn, RibbonDataGroup as nn, IMenuManagerService as rn } from "@univerjs/ui";
|
|
10
|
+
import { debounceTime as sn, merge as Je, Observable as A, combineLatest as on, filter as an } from "rxjs";
|
|
11
|
+
import { map as cn, switchMap as ln, tap as un, debounceTime as mn } from "rxjs/operators";
|
|
12
12
|
import { jsxs as C, jsx as h } from "react/jsx-runtime";
|
|
13
|
-
import { createContext as
|
|
14
|
-
import { InputNumber as
|
|
15
|
-
const
|
|
16
|
-
var
|
|
17
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
13
|
+
import { createContext as dn, useState as N, useEffect as ie, useRef as Ce, useContext as Qe, useMemo as x, forwardRef as et, createElement as be, useCallback as hn } from "react";
|
|
14
|
+
import { InputNumber as Ie, Select as Ne, SelectList as Ee, Input as fn, clsx as tt, borderClassName as vn, Button as xe, scrollbarClassName as pn, Separator as gn } from "@univerjs/design";
|
|
15
|
+
const Oe = {};
|
|
16
|
+
var _n = Object.getOwnPropertyDescriptor, Sn = (e, t, r, n) => {
|
|
17
|
+
for (var i = n > 1 ? void 0 : n ? _n(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
18
18
|
(o = e[s]) && (i = o(i) || i);
|
|
19
19
|
return i;
|
|
20
20
|
}, D = (e, t) => (r, n) => t(r, n, e);
|
|
21
|
-
const
|
|
22
|
-
let
|
|
21
|
+
const ae = "SHEET_NUMFMT_ALERT";
|
|
22
|
+
let he = class extends ne {
|
|
23
23
|
constructor(e, t, r, n, i, s, o) {
|
|
24
24
|
super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = r, this._localeService = n, this._zenZoneService = i, this._numfmtService = s, this._configService = o, this._init();
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ let fe = class extends re {
|
|
|
27
27
|
this._initCellAlertPopup(), this._initZenService();
|
|
28
28
|
}
|
|
29
29
|
_initCellAlertPopup() {
|
|
30
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
|
30
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(sn(100)).subscribe((e) => {
|
|
31
31
|
var t, r;
|
|
32
32
|
if (e) {
|
|
33
33
|
const n = e.location, i = this._context.unit, s = i.getActiveSheet();
|
|
@@ -43,20 +43,20 @@ let fe = class extends re {
|
|
|
43
43
|
this._hideAlert();
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (De(l.pattern) && ht.isDefine(c == null ? void 0 : c.v) && ft(c.v)) {
|
|
47
47
|
if ((t = this._configService.getConfig(Mt)) != null && t.disableTextFormatAlert)
|
|
48
48
|
return;
|
|
49
|
-
const m = this._cellAlertManagerService.currentAlert.get(
|
|
49
|
+
const m = this._cellAlertManagerService.currentAlert.get(ae), u = (r = m == null ? void 0 : m.alert) == null ? void 0 : r.location;
|
|
50
50
|
if (u && u.row === n.row && u.col === n.col && u.subUnitId === n.subUnitId && u.unitId === n.unitId)
|
|
51
51
|
return;
|
|
52
52
|
this._cellAlertManagerService.showAlert({
|
|
53
|
-
type:
|
|
53
|
+
type: jt.ERROR,
|
|
54
54
|
title: this._localeService.t("info.error"),
|
|
55
55
|
message: this._localeService.t("info.forceStringInfo"),
|
|
56
56
|
location: n,
|
|
57
57
|
width: 200,
|
|
58
58
|
height: 74,
|
|
59
|
-
key:
|
|
59
|
+
key: ae
|
|
60
60
|
});
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
@@ -70,18 +70,18 @@ let fe = class extends re {
|
|
|
70
70
|
}));
|
|
71
71
|
}
|
|
72
72
|
_hideAlert() {
|
|
73
|
-
this._cellAlertManagerService.removeAlert(
|
|
73
|
+
this._cellAlertManagerService.removeAlert(ae);
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
D(1, y(
|
|
78
|
-
D(2, y(
|
|
76
|
+
he = Sn([
|
|
77
|
+
D(1, y(At)),
|
|
78
|
+
D(2, y(Ht)),
|
|
79
79
|
D(3, y(E)),
|
|
80
|
-
D(4,
|
|
81
|
-
D(5, y(
|
|
82
|
-
D(6,
|
|
83
|
-
],
|
|
84
|
-
const
|
|
80
|
+
D(4, Qt),
|
|
81
|
+
D(5, y(ge)),
|
|
82
|
+
D(6, $e)
|
|
83
|
+
], he);
|
|
84
|
+
const ce = {
|
|
85
85
|
id: "sheet.operation.close.numfmt.panel",
|
|
86
86
|
type: Fe.OPERATION,
|
|
87
87
|
handler: () => (
|
|
@@ -93,12 +93,12 @@ const le = {
|
|
|
93
93
|
type: Fe.OPERATION,
|
|
94
94
|
handler: (e) => (e.get(B).openPanel(), !0)
|
|
95
95
|
};
|
|
96
|
-
var
|
|
97
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
96
|
+
var yn = Object.getOwnPropertyDescriptor, Cn = (e, t, r, n) => {
|
|
97
|
+
for (var i = n > 1 ? void 0 : n ? yn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
98
98
|
(o = e[s]) && (i = o(i) || i);
|
|
99
99
|
return i;
|
|
100
|
-
},
|
|
101
|
-
const
|
|
100
|
+
}, bn = (e, t) => (r, n) => t(r, n, e);
|
|
101
|
+
const Te = dn([]);
|
|
102
102
|
let j = class {
|
|
103
103
|
constructor(e) {
|
|
104
104
|
this._localStorageService = e;
|
|
@@ -143,31 +143,31 @@ let j = class {
|
|
|
143
143
|
this._localStorageService.removeItem(e);
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
|
-
j =
|
|
147
|
-
|
|
146
|
+
j = Cn([
|
|
147
|
+
bn(0, y(Le))
|
|
148
148
|
], j);
|
|
149
|
-
const
|
|
150
|
-
const t = b(j), [r, n] = N(
|
|
151
|
-
return
|
|
149
|
+
const Re = "numfmtCurrency", In = (e) => {
|
|
150
|
+
const t = b(j), [r, n] = N(Me);
|
|
151
|
+
return ie(() => {
|
|
152
152
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
153
|
-
t.getHabit(
|
|
153
|
+
t.getHabit(Re, [...Me]).then((s) => {
|
|
154
154
|
n(s), e && e(s);
|
|
155
155
|
});
|
|
156
156
|
});
|
|
157
157
|
}, []), { userHabitCurrency: r, mark: (s) => {
|
|
158
|
-
t.markHabit(
|
|
158
|
+
t.markHabit(Re, s);
|
|
159
159
|
} };
|
|
160
|
-
},
|
|
161
|
-
const e =
|
|
162
|
-
return
|
|
160
|
+
}, Nn = () => {
|
|
161
|
+
const e = Ce([]), [t, r] = N({});
|
|
162
|
+
return ie(() => {
|
|
163
163
|
e.current.forEach((i) => {
|
|
164
164
|
i();
|
|
165
165
|
}), e.current = [];
|
|
166
166
|
}, [t]), (i) => {
|
|
167
167
|
e.current.push(i), r({});
|
|
168
168
|
};
|
|
169
|
-
},
|
|
170
|
-
const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() =>
|
|
169
|
+
}, En = (e) => !!V(e) && e.startsWith("_("), Tn = (e) => {
|
|
170
|
+
const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => J(t || "", 2)), o = Qe(Te), [a, l] = N(() => V(t) || o[0]), c = x(() => o.map((p) => ({ label: p, value: p })), []), u = b(E).t;
|
|
171
171
|
r.current = () => R(`_("${a}"* #,##0${i > 0 ? ".0" : ""}_)`, i);
|
|
172
172
|
const f = (p) => {
|
|
173
173
|
l(p), n(R(`_("${p}"* #,##0${i > 0 ? ".0" : ""}_)`, i));
|
|
@@ -180,7 +180,7 @@ const ke = "numfmtCurrency", bn = (e) => {
|
|
|
180
180
|
/* @__PURE__ */ C("div", { className: "option", children: [
|
|
181
181
|
/* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: u("sheet.numfmt.decimalLength") }),
|
|
182
182
|
/* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ h(
|
|
183
|
-
|
|
183
|
+
Ie,
|
|
184
184
|
{
|
|
185
185
|
value: i,
|
|
186
186
|
step: 1,
|
|
@@ -194,7 +194,7 @@ const ke = "numfmtCurrency", bn = (e) => {
|
|
|
194
194
|
/* @__PURE__ */ C("div", { className: "option", children: [
|
|
195
195
|
/* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: u("sheet.numfmt.currencyType") }),
|
|
196
196
|
/* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ h(
|
|
197
|
-
|
|
197
|
+
Ne,
|
|
198
198
|
{
|
|
199
199
|
options: c,
|
|
200
200
|
value: a,
|
|
@@ -205,18 +205,18 @@ const ke = "numfmtCurrency", bn = (e) => {
|
|
|
205
205
|
] }),
|
|
206
206
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: u("sheet.numfmt.accountingDes") })
|
|
207
207
|
] });
|
|
208
|
-
},
|
|
209
|
-
const r = b(E).t, n =
|
|
208
|
+
}, wn = (e) => !!V(e) && !e.startsWith("_("), Mn = (e) => {
|
|
209
|
+
const r = b(E).t, n = Qe(Te), [i, s] = N(() => V(e.defaultPattern) || n[0]), [o, a] = N(() => J(e.defaultPattern || "", 2)), [l, c] = N(() => {
|
|
210
210
|
var g;
|
|
211
|
-
const d =
|
|
212
|
-
return ((g = d.find((I) =>
|
|
213
|
-
}), m =
|
|
211
|
+
const d = oe(i);
|
|
212
|
+
return ((g = d.find((I) => re(I.value, e.defaultPattern))) == null ? void 0 : g.value) || d[0].value;
|
|
213
|
+
}), m = x(() => oe(i), [i]), u = x(() => n.map((d) => ({ label: d, value: d })), [n]);
|
|
214
214
|
e.action.current = () => R(l, o);
|
|
215
215
|
const f = (d) => {
|
|
216
216
|
if (d === void 0)
|
|
217
217
|
return;
|
|
218
218
|
s(d);
|
|
219
|
-
const S =
|
|
219
|
+
const S = oe(d)[0].value;
|
|
220
220
|
c(S), e.onChange(R(S, o));
|
|
221
221
|
}, v = (d) => {
|
|
222
222
|
d !== void 0 && (c(d), e.onChange(R(d, o)));
|
|
@@ -228,7 +228,7 @@ const ke = "numfmtCurrency", bn = (e) => {
|
|
|
228
228
|
/* @__PURE__ */ C("div", { className: "option", children: [
|
|
229
229
|
/* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.decimalLength") }),
|
|
230
230
|
/* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ h(
|
|
231
|
-
|
|
231
|
+
Ie,
|
|
232
232
|
{
|
|
233
233
|
value: o,
|
|
234
234
|
max: 20,
|
|
@@ -240,7 +240,7 @@ const ke = "numfmtCurrency", bn = (e) => {
|
|
|
240
240
|
/* @__PURE__ */ C("div", { className: "option", children: [
|
|
241
241
|
/* @__PURE__ */ h("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyType") }),
|
|
242
242
|
/* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ h(
|
|
243
|
-
|
|
243
|
+
Ne,
|
|
244
244
|
{
|
|
245
245
|
value: i,
|
|
246
246
|
options: u,
|
|
@@ -250,7 +250,7 @@ const ke = "numfmtCurrency", bn = (e) => {
|
|
|
250
250
|
] })
|
|
251
251
|
] }),
|
|
252
252
|
/* @__PURE__ */ h("div", { className: "label univer-mt-4", children: r("sheet.numfmt.negType") }),
|
|
253
|
-
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
|
|
253
|
+
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { value: l, options: m, onChange: v }) }),
|
|
254
254
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyDes") })
|
|
255
255
|
] });
|
|
256
256
|
};
|
|
@@ -262,20 +262,20 @@ var T = function() {
|
|
|
262
262
|
}
|
|
263
263
|
return e;
|
|
264
264
|
}, T.apply(this, arguments);
|
|
265
|
-
},
|
|
265
|
+
}, Pn = function(e, t) {
|
|
266
266
|
var r = {};
|
|
267
267
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
268
268
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
269
269
|
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
270
270
|
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
|
271
271
|
return r;
|
|
272
|
-
},
|
|
273
|
-
var r = e.icon, n = e.id, i = e.className, s = e.extend, o =
|
|
274
|
-
return
|
|
272
|
+
}, nt = et(function(e, t) {
|
|
273
|
+
var r = e.icon, n = e.id, i = e.className, s = e.extend, o = Pn(e, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), l = Ce("_".concat(Rn()));
|
|
274
|
+
return rt(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current }, T({ ref: t, className: a }, o), s);
|
|
275
275
|
});
|
|
276
|
-
function
|
|
277
|
-
return
|
|
278
|
-
return
|
|
276
|
+
function rt(e, t, r, n, i) {
|
|
277
|
+
return be(e.tag, T(T({ key: t }, xn(e, r, i)), n), (On(e, r).children || []).map(function(s, o) {
|
|
278
|
+
return rt(s, "".concat(t, "-").concat(e.tag, "-").concat(o), r, void 0, i);
|
|
279
279
|
}));
|
|
280
280
|
}
|
|
281
281
|
function xn(e, t, r) {
|
|
@@ -290,41 +290,41 @@ function xn(e, t, r) {
|
|
|
290
290
|
typeof a == "string" && (n[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
291
291
|
})), n;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function On(e, t) {
|
|
294
294
|
var r, n = t.defIds;
|
|
295
295
|
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? T(T({}, e), { children: e.children.map(function(i) {
|
|
296
296
|
return typeof i.attrs.id == "string" && n && n.includes(i.attrs.id) ? T(T({}, i), { attrs: T(T({}, i.attrs), { id: i.attrs.id + t.idSuffix }) }) : i;
|
|
297
297
|
}) }) : e;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Rn() {
|
|
300
300
|
return Math.random().toString(36).substring(2, 8);
|
|
301
301
|
}
|
|
302
|
-
|
|
303
|
-
var
|
|
304
|
-
return
|
|
302
|
+
nt.displayName = "UniverIcon";
|
|
303
|
+
var kn = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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" } }] }, it = et(function(e, t) {
|
|
304
|
+
return be(nt, Object.assign({}, e, {
|
|
305
305
|
id: "check-mark-icon",
|
|
306
306
|
ref: t,
|
|
307
|
-
icon:
|
|
307
|
+
icon: kn
|
|
308
308
|
}));
|
|
309
309
|
});
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
function
|
|
313
|
-
const { defaultPattern: t, action: r, onChange: n } = e, i = b(j), s = b(
|
|
314
|
-
r.current = () => (i.markHabit(
|
|
310
|
+
it.displayName = "CheckMarkIcon";
|
|
311
|
+
const le = "customFormat", ue = "numfmt_custom_pattern";
|
|
312
|
+
function Un(e) {
|
|
313
|
+
const { defaultPattern: t, action: r, onChange: n } = e, i = b(j), s = b(Le), o = b(E), [a, l] = N(t);
|
|
314
|
+
r.current = () => (i.markHabit(le, a), s.getItem(ue).then((v = []) => {
|
|
315
315
|
const p = [.../* @__PURE__ */ new Set([a, ...v || []])].splice(0, 10).filter((d) => !!d);
|
|
316
|
-
s.setItem(
|
|
316
|
+
s.setItem(ue, p);
|
|
317
317
|
}), a);
|
|
318
318
|
const [c, m] = N([]);
|
|
319
|
-
|
|
320
|
-
s.getItem(
|
|
319
|
+
ie(() => {
|
|
320
|
+
s.getItem(ue).then((v) => {
|
|
321
321
|
const p = [
|
|
322
|
-
...
|
|
323
|
-
...
|
|
322
|
+
...Pt.map((d) => d.suffix("$")),
|
|
323
|
+
...xt.map((d) => d.suffix),
|
|
324
324
|
...Ot.map((d) => d.suffix)
|
|
325
325
|
];
|
|
326
|
-
p.push(...v || []), i.addHabit(
|
|
327
|
-
i.getHabit(
|
|
326
|
+
p.push(...v || []), i.addHabit(le, []).finally(() => {
|
|
327
|
+
i.getHabit(le, p).then((d) => {
|
|
328
328
|
m([...new Set(d)]);
|
|
329
329
|
});
|
|
330
330
|
});
|
|
@@ -338,7 +338,7 @@ function kn(e) {
|
|
|
338
338
|
return /* @__PURE__ */ C("div", { children: [
|
|
339
339
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: o.t("sheet.numfmt.customFormat") }),
|
|
340
340
|
/* @__PURE__ */ h(
|
|
341
|
-
|
|
341
|
+
fn,
|
|
342
342
|
{
|
|
343
343
|
placeholder: o.t("sheet.numfmt.customFormat"),
|
|
344
344
|
onBlur: f,
|
|
@@ -350,14 +350,14 @@ function kn(e) {
|
|
|
350
350
|
/* @__PURE__ */ h(
|
|
351
351
|
"div",
|
|
352
352
|
{
|
|
353
|
-
className:
|
|
353
|
+
className: tt("univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2", vn),
|
|
354
354
|
children: c.map((v) => /* @__PURE__ */ C(
|
|
355
355
|
"div",
|
|
356
356
|
{
|
|
357
357
|
onClick: () => u(v),
|
|
358
358
|
className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-1.5 univer-py-1.5 univer-text-sm",
|
|
359
359
|
children: [
|
|
360
|
-
/* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: a === v && /* @__PURE__ */ h(
|
|
360
|
+
/* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: a === v && /* @__PURE__ */ h(it, {}) }),
|
|
361
361
|
/* @__PURE__ */ h("div", { children: v })
|
|
362
362
|
]
|
|
363
363
|
},
|
|
@@ -374,12 +374,12 @@ function kn(e) {
|
|
|
374
374
|
)
|
|
375
375
|
] });
|
|
376
376
|
}
|
|
377
|
-
const
|
|
378
|
-
const t =
|
|
379
|
-
return
|
|
377
|
+
const $n = (e) => {
|
|
378
|
+
const t = vt.getFormatInfo(e);
|
|
379
|
+
return Be().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
380
380
|
};
|
|
381
|
-
function
|
|
382
|
-
const { onChange: t, defaultPattern: r } = e, n =
|
|
381
|
+
function Dn(e) {
|
|
382
|
+
const { onChange: t, defaultPattern: r } = e, n = x(Be, []), i = b(E), [s, o] = N(() => {
|
|
383
383
|
if (r) {
|
|
384
384
|
const l = n.find((c) => c.value === r);
|
|
385
385
|
if (l)
|
|
@@ -393,7 +393,7 @@ function $n(e) {
|
|
|
393
393
|
};
|
|
394
394
|
return /* @__PURE__ */ C("div", { children: [
|
|
395
395
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: i.t("sheet.numfmt.dateType") }),
|
|
396
|
-
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
|
|
396
|
+
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { value: s, options: n, onChange: a }) }),
|
|
397
397
|
/* @__PURE__ */ h(
|
|
398
398
|
"div",
|
|
399
399
|
{
|
|
@@ -403,7 +403,7 @@ function $n(e) {
|
|
|
403
403
|
)
|
|
404
404
|
] });
|
|
405
405
|
}
|
|
406
|
-
const
|
|
406
|
+
const Fn = (e) => !e, Ln = (e) => {
|
|
407
407
|
const r = b(E).t;
|
|
408
408
|
return e.action.current = () => "", /* @__PURE__ */ h("div", { children: /* @__PURE__ */ h(
|
|
409
409
|
"div",
|
|
@@ -412,20 +412,20 @@ const Dn = (e) => !e, Ln = (e) => {
|
|
|
412
412
|
children: r("sheet.numfmt.generalDes")
|
|
413
413
|
}
|
|
414
414
|
) });
|
|
415
|
-
},
|
|
416
|
-
function
|
|
417
|
-
const t = b(E), r =
|
|
418
|
-
const u = r.find((f) =>
|
|
415
|
+
}, An = (e) => Ve().some((t) => re(t.value, e));
|
|
416
|
+
function Hn(e) {
|
|
417
|
+
const t = b(E), r = x(Ve, []), [n, i] = N(() => J(e.defaultPattern || "", 0)), [s, o] = N(() => {
|
|
418
|
+
const u = r.find((f) => re(f.value, e.defaultPattern || ""));
|
|
419
419
|
return (u == null ? void 0 : u.value) || r[0].value;
|
|
420
|
-
}), a =
|
|
420
|
+
}), a = x(() => R(s, Number(n || 0)), [s, n]), l = x(() => !Rt(s), [s]), c = (u) => {
|
|
421
421
|
i(u || 0), e.onChange(R(s, Number(u || 0)));
|
|
422
422
|
}, m = (u) => {
|
|
423
|
-
u !== void 0 && (i(
|
|
423
|
+
u !== void 0 && (i(J(u, 0)), o(u), e.onChange(u));
|
|
424
424
|
};
|
|
425
425
|
return e.action.current = () => a, /* @__PURE__ */ C("div", { children: [
|
|
426
426
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: t.t("sheet.numfmt.decimalLength") }),
|
|
427
427
|
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
|
|
428
|
-
|
|
428
|
+
Ie,
|
|
429
429
|
{
|
|
430
430
|
disabled: l,
|
|
431
431
|
value: n,
|
|
@@ -438,7 +438,7 @@ function An(e) {
|
|
|
438
438
|
" ",
|
|
439
439
|
t.t("sheet.numfmt.negType")
|
|
440
440
|
] }),
|
|
441
|
-
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
|
|
441
|
+
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { onChange: m, options: r, value: s }) }),
|
|
442
442
|
/* @__PURE__ */ h(
|
|
443
443
|
"div",
|
|
444
444
|
{
|
|
@@ -448,69 +448,69 @@ function An(e) {
|
|
|
448
448
|
)
|
|
449
449
|
] });
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o =
|
|
451
|
+
const jn = (e) => {
|
|
452
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = Ce(() => ""), a = s.t, l = Nn(), c = x(
|
|
453
453
|
() => [
|
|
454
454
|
{ label: "sheet.numfmt.general", component: Ln },
|
|
455
|
-
{ label: "sheet.numfmt.accounting", component:
|
|
456
|
-
{ label: "sheet.numfmt.currency", component:
|
|
457
|
-
{ label: "sheet.numfmt.date", component:
|
|
458
|
-
{ label: "sheet.numfmt.thousandthPercentile", component:
|
|
459
|
-
{ label: "sheet.numfmt.customFormat", component:
|
|
455
|
+
{ label: "sheet.numfmt.accounting", component: Tn },
|
|
456
|
+
{ label: "sheet.numfmt.currency", component: Mn },
|
|
457
|
+
{ label: "sheet.numfmt.date", component: Dn },
|
|
458
|
+
{ label: "sheet.numfmt.thousandthPercentile", component: Hn },
|
|
459
|
+
{ label: "sheet.numfmt.customFormat", component: Un }
|
|
460
460
|
].map((_) => ({ ..._, label: a(_.label) })),
|
|
461
461
|
[]
|
|
462
|
-
), [m, u] = N(g), [f, v] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } =
|
|
462
|
+
), [m, u] = N(g), [f, v] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } = In(() => v(`${n}_${i}_userCurrency'`)), S = x(() => {
|
|
463
463
|
var _;
|
|
464
464
|
return (_ = c.find(($) => $.label === m)) == null ? void 0 : _.component;
|
|
465
465
|
}, [m]);
|
|
466
466
|
function g() {
|
|
467
|
-
return [
|
|
467
|
+
return [Fn, En, wn, $n, An].reduce(($, lt, ut) => $ || (lt(r) ? c[ut].label : ""), "") || c[0].label;
|
|
468
468
|
}
|
|
469
469
|
const I = c.map((_) => ({
|
|
470
470
|
label: _.label,
|
|
471
471
|
value: _.label
|
|
472
|
-
})),
|
|
472
|
+
})), P = (_) => {
|
|
473
473
|
u(_), l(() => e.onChange({ type: "change", value: o.current() || "" }));
|
|
474
|
-
}, O =
|
|
474
|
+
}, O = hn((_) => {
|
|
475
475
|
e.onChange({ type: "change", value: _ });
|
|
476
476
|
}, []), k = () => {
|
|
477
477
|
const _ = o.current() || "", $ = V(_);
|
|
478
478
|
$ && p($), e.onChange({ type: "confirm", value: _ });
|
|
479
|
-
},
|
|
479
|
+
}, F = () => {
|
|
480
480
|
e.onChange({ type: "cancel", value: "" });
|
|
481
|
-
},
|
|
481
|
+
}, se = {
|
|
482
482
|
onChange: O,
|
|
483
483
|
defaultValue: t,
|
|
484
484
|
defaultPattern: r,
|
|
485
485
|
action: o
|
|
486
486
|
};
|
|
487
|
-
return
|
|
487
|
+
return ie(() => {
|
|
488
488
|
u(g()), v(`${n}_${i}`);
|
|
489
489
|
}, [n, i]), /* @__PURE__ */ C(
|
|
490
490
|
"div",
|
|
491
491
|
{
|
|
492
|
-
className:
|
|
492
|
+
className: tt("univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5", pn),
|
|
493
493
|
children: [
|
|
494
494
|
/* @__PURE__ */ C("div", { children: [
|
|
495
495
|
/* @__PURE__ */ h("div", { className: "univer-mt-3.5 univer-text-sm univer-text-gray-400", children: a("sheet.numfmt.numfmtType") }),
|
|
496
|
-
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
|
|
497
|
-
/* @__PURE__ */ h("div", { children: S && /* @__PURE__ */ h(
|
|
496
|
+
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { className: "univer-w-full", value: m, options: I, onChange: P }) }),
|
|
497
|
+
/* @__PURE__ */ h("div", { children: S && /* @__PURE__ */ h(Te.Provider, { value: d, children: /* @__PURE__ */ be(S, { ...se, key: f }) }) })
|
|
498
498
|
] }),
|
|
499
499
|
/* @__PURE__ */ C("div", { className: "univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end", children: [
|
|
500
|
-
/* @__PURE__ */ h(
|
|
501
|
-
/* @__PURE__ */ h(
|
|
500
|
+
/* @__PURE__ */ h(xe, { onClick: F, className: "univer-mr-3", children: a("sheet.numfmt.cancel") }),
|
|
501
|
+
/* @__PURE__ */ h(xe, { variant: "primary", onClick: k, children: a("sheet.numfmt.confirm") })
|
|
502
502
|
] })
|
|
503
503
|
]
|
|
504
504
|
}
|
|
505
505
|
);
|
|
506
506
|
};
|
|
507
|
-
var
|
|
508
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
507
|
+
var Bn = Object.getOwnPropertyDescriptor, Vn = (e, t, r, n) => {
|
|
508
|
+
for (var i = n > 1 ? void 0 : n ? Bn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
509
509
|
(o = e[s]) && (i = o(i) || i);
|
|
510
510
|
return i;
|
|
511
511
|
}, M = (e, t) => (r, n) => t(r, n, e);
|
|
512
|
-
const
|
|
513
|
-
let B = class extends
|
|
512
|
+
const ke = "SHEET_NUMFMT_PANEL";
|
|
513
|
+
let B = class extends ne {
|
|
514
514
|
constructor(t, r, n, i, s, o, a, l, c, m, u) {
|
|
515
515
|
super();
|
|
516
516
|
/**
|
|
@@ -524,7 +524,7 @@ let B = class extends re {
|
|
|
524
524
|
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService = a, this._componentManager = l, this._sidebarService = c, this._localeService = m, this._sheetsNumfmtCellContentController = u, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
|
|
525
525
|
}
|
|
526
526
|
_initNumfmtLocalChange() {
|
|
527
|
-
this.disposeWithMe(
|
|
527
|
+
this.disposeWithMe(Je(this._sheetsNumfmtCellContentController.locale$, this._localeService.currentLocale$).subscribe(() => {
|
|
528
528
|
this._forceUpdate();
|
|
529
529
|
}));
|
|
530
530
|
}
|
|
@@ -550,17 +550,17 @@ let B = class extends re {
|
|
|
550
550
|
if (g.type === "change")
|
|
551
551
|
this._previewPattern = g.value, this._forceUpdate();
|
|
552
552
|
else if (g.type === "confirm") {
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
const P = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((F) => F.range)) || [], O = { values: [] }, k = pe(g.value);
|
|
554
|
+
P.forEach((F) => {
|
|
555
|
+
Ae.foreach(F, (se, _) => {
|
|
556
556
|
O.values.push({
|
|
557
|
-
row:
|
|
557
|
+
row: se,
|
|
558
558
|
col: _,
|
|
559
559
|
pattern: g.value,
|
|
560
560
|
type: k
|
|
561
561
|
});
|
|
562
562
|
});
|
|
563
|
-
}), n.executeCommand(
|
|
563
|
+
}), n.executeCommand(Ge.id, O), t.close();
|
|
564
564
|
} else g.type === "cancel" && t.close();
|
|
565
565
|
},
|
|
566
566
|
value: { defaultPattern: v, defaultValue: p, row: l.startRow, col: l.startColumn }
|
|
@@ -568,12 +568,12 @@ let B = class extends re {
|
|
|
568
568
|
return this._sidebarDisposable = t.open({
|
|
569
569
|
header: { title: o.t("sheet.numfmt.title") },
|
|
570
570
|
children: {
|
|
571
|
-
label:
|
|
571
|
+
label: ke,
|
|
572
572
|
...d
|
|
573
573
|
// need passthrough to react props.
|
|
574
574
|
},
|
|
575
575
|
onClose: () => {
|
|
576
|
-
this._forceUpdate(), n.executeCommand(
|
|
576
|
+
this._forceUpdate(), n.executeCommand(ce.id);
|
|
577
577
|
}
|
|
578
578
|
}), !0;
|
|
579
579
|
}
|
|
@@ -582,37 +582,37 @@ let B = class extends re {
|
|
|
582
582
|
const r = this._renderManagerService.getRenderById(
|
|
583
583
|
t != null ? t : this._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET).getUnitId()
|
|
584
584
|
);
|
|
585
|
-
r == null || r.with(
|
|
585
|
+
r == null || r.with(Bt).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
|
|
586
586
|
}
|
|
587
587
|
_initCommands() {
|
|
588
588
|
[
|
|
589
589
|
H,
|
|
590
|
-
|
|
590
|
+
ce
|
|
591
591
|
].forEach((t) => {
|
|
592
592
|
this.disposeWithMe(this._commandService.registerCommand(t));
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
_initPanel() {
|
|
596
596
|
this.disposeWithMe(
|
|
597
|
-
this._componentManager.register(
|
|
597
|
+
this._componentManager.register(ke, jn)
|
|
598
598
|
);
|
|
599
599
|
}
|
|
600
600
|
// eslint-disable-next-line max-lines-per-function
|
|
601
601
|
_initRealTimeRenderingInterceptor() {
|
|
602
602
|
const t = new A((n) => {
|
|
603
603
|
this._commandService.onCommandExecuted((i) => {
|
|
604
|
-
i.id === H.id && n.next(!0), i.id ===
|
|
604
|
+
i.id === H.id && n.next(!0), i.id === ce.id && n.next(!1);
|
|
605
605
|
});
|
|
606
|
-
}), r =
|
|
606
|
+
}), r = on([
|
|
607
607
|
t,
|
|
608
608
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
609
|
-
|
|
609
|
+
cn((n) => n ? n.map((i) => i.range) : [])
|
|
610
610
|
)
|
|
611
611
|
]);
|
|
612
612
|
this.disposeWithMe(
|
|
613
|
-
|
|
613
|
+
de(
|
|
614
614
|
r.pipe(
|
|
615
|
-
|
|
615
|
+
ln(
|
|
616
616
|
([n, i]) => new A((s) => {
|
|
617
617
|
const o = new gt();
|
|
618
618
|
return n && i.length && s.next({ selectionRanges: i, disposableCollection: o }), () => {
|
|
@@ -620,16 +620,16 @@ let B = class extends re {
|
|
|
620
620
|
};
|
|
621
621
|
})
|
|
622
622
|
),
|
|
623
|
-
|
|
623
|
+
un(() => {
|
|
624
624
|
this._previewPattern = null;
|
|
625
625
|
})
|
|
626
626
|
).subscribe(({ disposableCollection: n, selectionRanges: i }) => {
|
|
627
627
|
var o, a;
|
|
628
628
|
const s = this._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET);
|
|
629
629
|
this.openPanel(), n.add(
|
|
630
|
-
this._sheetInterceptorService.intercept(
|
|
630
|
+
this._sheetInterceptorService.intercept(Kt.CELL_CONTENT, {
|
|
631
631
|
priority: 99,
|
|
632
|
-
effect:
|
|
632
|
+
effect: we.Value | we.Style,
|
|
633
633
|
handler: (l, c, m) => {
|
|
634
634
|
var p;
|
|
635
635
|
const { row: u, col: f } = c, v = m(l) || {};
|
|
@@ -641,12 +641,12 @@ let B = class extends re {
|
|
|
641
641
|
return v;
|
|
642
642
|
const I = kt(this._previewPattern, S, this._sheetsNumfmtCellContentController.locale);
|
|
643
643
|
if (I.color) {
|
|
644
|
-
const
|
|
644
|
+
const P = (p = this._themeService.getColorFromTheme(`${I.color}.500`)) != null ? p : I.color;
|
|
645
645
|
return {
|
|
646
646
|
...v,
|
|
647
647
|
v: I.result,
|
|
648
648
|
t: U.STRING,
|
|
649
|
-
s: { cl: { rgb:
|
|
649
|
+
s: { cl: { rgb: P } }
|
|
650
650
|
};
|
|
651
651
|
}
|
|
652
652
|
return {
|
|
@@ -664,7 +664,7 @@ let B = class extends re {
|
|
|
664
664
|
);
|
|
665
665
|
}
|
|
666
666
|
_commandExecutedListener() {
|
|
667
|
-
const t = [
|
|
667
|
+
const t = [Se.id, ye.id];
|
|
668
668
|
this.disposeWithMe(
|
|
669
669
|
new A((r) => {
|
|
670
670
|
const n = this._commandService.onCommandExecuted((i) => {
|
|
@@ -674,7 +674,7 @@ let B = class extends re {
|
|
|
674
674
|
}
|
|
675
675
|
});
|
|
676
676
|
return () => n.dispose();
|
|
677
|
-
}).pipe(
|
|
677
|
+
}).pipe(mn(16)).subscribe((r) => this._forceUpdate(r))
|
|
678
678
|
);
|
|
679
679
|
}
|
|
680
680
|
_initCloseListener() {
|
|
@@ -684,25 +684,25 @@ let B = class extends re {
|
|
|
684
684
|
});
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
|
-
B =
|
|
688
|
-
M(0, y(
|
|
687
|
+
B = Vn([
|
|
688
|
+
M(0, y(Xe)),
|
|
689
689
|
M(1, y(pt)),
|
|
690
|
-
M(2,
|
|
691
|
-
M(3,
|
|
692
|
-
M(4, y(
|
|
693
|
-
M(5,
|
|
694
|
-
M(6,
|
|
695
|
-
M(7, y(
|
|
696
|
-
M(8,
|
|
690
|
+
M(2, fe),
|
|
691
|
+
M(3, ve),
|
|
692
|
+
M(4, y(_e)),
|
|
693
|
+
M(5, je),
|
|
694
|
+
M(6, ge),
|
|
695
|
+
M(7, y(qe)),
|
|
696
|
+
M(8, en),
|
|
697
697
|
M(9, y(E)),
|
|
698
|
-
M(10, y(
|
|
698
|
+
M(10, y(We))
|
|
699
699
|
], B);
|
|
700
|
-
var
|
|
701
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
700
|
+
var Wn = Object.getOwnPropertyDescriptor, Gn = (e, t, r, n) => {
|
|
701
|
+
for (var i = n > 1 ? void 0 : n ? Wn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
702
702
|
(o = e[s]) && (i = o(i) || i);
|
|
703
703
|
return i;
|
|
704
|
-
},
|
|
705
|
-
const
|
|
704
|
+
}, L = (e, t) => (r, n) => t(r, n, e);
|
|
705
|
+
const Kn = () => {
|
|
706
706
|
let e = [];
|
|
707
707
|
return {
|
|
708
708
|
add: (i, s, o, a, l) => e.push({ unitId: i, subUnitId: s, row: o, col: a, value: l }),
|
|
@@ -712,17 +712,17 @@ const Gn = () => {
|
|
|
712
712
|
}
|
|
713
713
|
};
|
|
714
714
|
};
|
|
715
|
-
let
|
|
715
|
+
let Q = class extends ne {
|
|
716
716
|
constructor(t, r, n, i, s) {
|
|
717
717
|
super();
|
|
718
718
|
// collect effect mutations when edit end and push this to commands stack in next commands progress
|
|
719
|
-
q(this, "_collectEffectMutation",
|
|
719
|
+
q(this, "_collectEffectMutation", Kn());
|
|
720
720
|
this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = i, this._editorBridgeService = s, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
|
|
721
721
|
}
|
|
722
722
|
_initInterceptorEditorStart() {
|
|
723
723
|
this._editorBridgeService && this.disposeWithMe(
|
|
724
|
-
|
|
725
|
-
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
724
|
+
de(
|
|
725
|
+
this._sheetInterceptorService.writeCellInterceptor.intercept(Zt, {
|
|
726
726
|
handler: (t, r, n) => {
|
|
727
727
|
const i = r.row, s = r.col, o = this._numfmtService.getValue(
|
|
728
728
|
r.unitId,
|
|
@@ -731,7 +731,7 @@ let ee = class extends re {
|
|
|
731
731
|
s
|
|
732
732
|
);
|
|
733
733
|
if (o)
|
|
734
|
-
switch (
|
|
734
|
+
switch (pe(o.pattern)) {
|
|
735
735
|
case "scientific":
|
|
736
736
|
case "currency":
|
|
737
737
|
case "grouped":
|
|
@@ -760,8 +760,8 @@ let ee = class extends re {
|
|
|
760
760
|
// eslint-disable-next-line max-lines-per-function
|
|
761
761
|
_initInterceptorEditorEnd() {
|
|
762
762
|
this.disposeWithMe(
|
|
763
|
-
|
|
764
|
-
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
763
|
+
de(
|
|
764
|
+
this._sheetInterceptorService.writeCellInterceptor.intercept(Yt, {
|
|
765
765
|
// eslint-disable-next-line complexity
|
|
766
766
|
handler: (t, r, n) => {
|
|
767
767
|
var l, c, m;
|
|
@@ -772,11 +772,11 @@ let ee = class extends re {
|
|
|
772
772
|
r.row,
|
|
773
773
|
r.col
|
|
774
774
|
);
|
|
775
|
-
if (!(t != null && t.v) && !(t != null && t.p) ||
|
|
775
|
+
if (!(t != null && t.v) && !(t != null && t.p) || De(i == null ? void 0 : i.pattern) || t.t === U.FORCE_STRING)
|
|
776
776
|
return n(t);
|
|
777
|
-
const s = (l = t.p) == null ? void 0 : l.body, o = (m = (c = t == null ? void 0 : t.p) == null ? void 0 : c.body) != null && m.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), a =
|
|
777
|
+
const s = (l = t.p) == null ? void 0 : l.body, o = (m = (c = t == null ? void 0 : t.p) == null ? void 0 : c.body) != null && m.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), a = Ut(o);
|
|
778
778
|
if (s)
|
|
779
|
-
if (
|
|
779
|
+
if (Zn(s)) {
|
|
780
780
|
const { dataStream: u } = s, f = u.replace(/\r\n$/, ""), v = Number(f);
|
|
781
781
|
if (Number.isNaN(v) && !a)
|
|
782
782
|
return n(t);
|
|
@@ -815,7 +815,7 @@ let ee = class extends re {
|
|
|
815
815
|
getMutations(r) {
|
|
816
816
|
var n;
|
|
817
817
|
switch (r.id) {
|
|
818
|
-
case
|
|
818
|
+
case zt.id: {
|
|
819
819
|
const i = t._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET), s = i.getUnitId(), o = (n = i.getActiveSheet()) == null ? void 0 : n.getSheetId();
|
|
820
820
|
if (!o)
|
|
821
821
|
return {
|
|
@@ -846,21 +846,21 @@ let ee = class extends re {
|
|
|
846
846
|
})), m = [], u = [];
|
|
847
847
|
if (l.length) {
|
|
848
848
|
const f = {
|
|
849
|
-
id:
|
|
850
|
-
params:
|
|
849
|
+
id: ye.id,
|
|
850
|
+
params: Xt(s, o, l)
|
|
851
851
|
};
|
|
852
|
-
m.push(f), u.push(...
|
|
852
|
+
m.push(f), u.push(...qt(t._injector, f.params));
|
|
853
853
|
}
|
|
854
854
|
if (c.length) {
|
|
855
855
|
const f = {
|
|
856
|
-
id:
|
|
856
|
+
id: Se.id,
|
|
857
857
|
params: {
|
|
858
858
|
unitId: s,
|
|
859
859
|
subUnitId: o,
|
|
860
860
|
ranges: c
|
|
861
861
|
}
|
|
862
862
|
};
|
|
863
|
-
m.push(f), u.push(...
|
|
863
|
+
m.push(f), u.push(...Jt(t._injector, f.params));
|
|
864
864
|
}
|
|
865
865
|
return {
|
|
866
866
|
redos: m,
|
|
@@ -877,18 +877,18 @@ let ee = class extends re {
|
|
|
877
877
|
);
|
|
878
878
|
}
|
|
879
879
|
};
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
],
|
|
887
|
-
function
|
|
880
|
+
Q = Gn([
|
|
881
|
+
L(0, y(Xe)),
|
|
882
|
+
L(1, y(ge)),
|
|
883
|
+
L(2, y(fe)),
|
|
884
|
+
L(3, y(He)),
|
|
885
|
+
L(4, _t(Vt))
|
|
886
|
+
], Q);
|
|
887
|
+
function Zn(e) {
|
|
888
888
|
const { textRuns: t = [], paragraphs: r = [], customRanges: n, customBlocks: i = [] } = e, s = ["va"];
|
|
889
889
|
return !(t.some((o) => !!(o.ts && Object.keys(o.ts).some((l) => s.includes(l)))) || r.some((o) => o.bullet) || r.length >= 2 || n != null && n.length || i.length > 0);
|
|
890
890
|
}
|
|
891
|
-
const
|
|
891
|
+
const st = (e) => [
|
|
892
892
|
{
|
|
893
893
|
label: "sheet.numfmt.general",
|
|
894
894
|
pattern: null
|
|
@@ -949,76 +949,76 @@ const ot = (e) => [
|
|
|
949
949
|
label: "sheet.numfmt.moreFmt",
|
|
950
950
|
pattern: ""
|
|
951
951
|
}
|
|
952
|
-
],
|
|
952
|
+
], Yn = (e) => ({
|
|
953
953
|
icon: new A((t) => {
|
|
954
954
|
const r = e.get(E);
|
|
955
955
|
return t.next(Pe(r.getCurrentLocale()).icon), r.localeChanged$.subscribe(() => {
|
|
956
956
|
t.next(Pe(r.getCurrentLocale()).icon);
|
|
957
957
|
});
|
|
958
958
|
}),
|
|
959
|
-
id:
|
|
959
|
+
id: ze.id,
|
|
960
960
|
title: "sheet.numfmt.currency",
|
|
961
961
|
tooltip: "sheet.numfmt.currency",
|
|
962
962
|
type: X.BUTTON,
|
|
963
963
|
hidden$: z(e, w.UNIVER_SHEET),
|
|
964
964
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
965
|
-
}),
|
|
965
|
+
}), zn = (e) => ({
|
|
966
966
|
icon: "AddDigitsIcon",
|
|
967
|
-
id:
|
|
967
|
+
id: Ye.id,
|
|
968
968
|
title: "sheet.numfmt.addDecimal",
|
|
969
969
|
tooltip: "sheet.numfmt.addDecimal",
|
|
970
970
|
type: X.BUTTON,
|
|
971
971
|
hidden$: z(e, w.UNIVER_SHEET),
|
|
972
972
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
973
|
-
}),
|
|
973
|
+
}), Xn = (e) => ({
|
|
974
974
|
icon: "ReduceDigitsIcon",
|
|
975
|
-
id:
|
|
975
|
+
id: Ze.id,
|
|
976
976
|
title: "sheet.numfmt.subtractDecimal",
|
|
977
977
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
978
978
|
type: X.BUTTON,
|
|
979
979
|
hidden$: z(e, w.UNIVER_SHEET),
|
|
980
980
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
981
|
-
}),
|
|
981
|
+
}), qn = (e) => ({
|
|
982
982
|
icon: "PercentIcon",
|
|
983
|
-
id:
|
|
983
|
+
id: Ke.id,
|
|
984
984
|
title: "sheet.numfmt.percent",
|
|
985
985
|
tooltip: "sheet.numfmt.percent",
|
|
986
986
|
type: X.BUTTON,
|
|
987
987
|
hidden$: z(e, w.UNIVER_SHEET),
|
|
988
988
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
989
|
-
}),
|
|
990
|
-
const t = e.get(
|
|
989
|
+
}), Jn = (e) => {
|
|
990
|
+
const t = e.get(fe), r = e.get(ve), n = e.get(E), i = e.get(_e), s = [Se.id, ye.id], o = Wt(
|
|
991
991
|
t,
|
|
992
992
|
"",
|
|
993
993
|
({ workbook: a, worksheet: l }) => new A(
|
|
994
|
-
(c) =>
|
|
994
|
+
(c) => Je(
|
|
995
995
|
i.selectionMoveEnd$,
|
|
996
996
|
yt(r.onCommandExecuted.bind(r)).pipe(
|
|
997
|
-
|
|
997
|
+
an(([m]) => s.includes(m.id))
|
|
998
998
|
)
|
|
999
999
|
).subscribe(() => {
|
|
1000
1000
|
var u, f;
|
|
1001
1001
|
const m = i.getCurrentSelections();
|
|
1002
1002
|
if (m && m[0]) {
|
|
1003
|
-
const v = m[0].range, p = v.startRow, d = v.startColumn, S = (f = a.getStyles().get((u = l.getCell(p, d)) == null ? void 0 : u.s)) == null ? void 0 : f.n, g = S == null ? void 0 : S.pattern, I =
|
|
1004
|
-
let
|
|
1003
|
+
const v = m[0].range, p = v.startRow, d = v.startColumn, S = (f = a.getStyles().get((u = l.getCell(p, d)) == null ? void 0 : u.s)) == null ? void 0 : f.n, g = S == null ? void 0 : S.pattern, I = $t(n.getCurrentLocale());
|
|
1004
|
+
let P = n.t("sheet.numfmt.general");
|
|
1005
1005
|
if (Ct(g)) {
|
|
1006
|
-
c.next(
|
|
1006
|
+
c.next(P);
|
|
1007
1007
|
return;
|
|
1008
1008
|
}
|
|
1009
1009
|
if (g) {
|
|
1010
|
-
const O =
|
|
1011
|
-
(k) =>
|
|
1010
|
+
const O = st(I).filter((k) => typeof k == "object" && k.pattern).find(
|
|
1011
|
+
(k) => re(g, k.pattern)
|
|
1012
1012
|
);
|
|
1013
|
-
O && typeof O == "object" && O.pattern ?
|
|
1013
|
+
O && typeof O == "object" && O.pattern ? P = n.t(O.label) : P = n.t("sheet.numfmt.moreFmt");
|
|
1014
1014
|
}
|
|
1015
|
-
c.next(
|
|
1015
|
+
c.next(P);
|
|
1016
1016
|
}
|
|
1017
1017
|
})
|
|
1018
1018
|
)
|
|
1019
1019
|
);
|
|
1020
1020
|
return {
|
|
1021
|
-
label:
|
|
1021
|
+
label: ot,
|
|
1022
1022
|
id: H.id,
|
|
1023
1023
|
tooltip: "sheet.numfmt.title",
|
|
1024
1024
|
type: X.SELECTOR,
|
|
@@ -1026,7 +1026,7 @@ const ot = (e) => [
|
|
|
1026
1026
|
selections: [
|
|
1027
1027
|
{
|
|
1028
1028
|
label: {
|
|
1029
|
-
name:
|
|
1029
|
+
name: at,
|
|
1030
1030
|
hoverable: !1,
|
|
1031
1031
|
selectable: !1
|
|
1032
1032
|
}
|
|
@@ -1036,21 +1036,21 @@ const ot = (e) => [
|
|
|
1036
1036
|
hidden$: z(e, w.UNIVER_SHEET),
|
|
1037
1037
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [K, Z], rangeTypes: [G] })
|
|
1038
1038
|
};
|
|
1039
|
-
},
|
|
1039
|
+
}, ot = "sheet.numfmt.moreNumfmtType", at = "sheet.numfmt.moreNumfmtType.options", Qn = (e) => {
|
|
1040
1040
|
const { value: t } = e, r = b(E), n = t != null ? t : r.t("sheet.numfmt.general");
|
|
1041
1041
|
return /* @__PURE__ */ h("span", { className: "univer-text-sm", children: n });
|
|
1042
|
-
},
|
|
1043
|
-
const e = b(
|
|
1042
|
+
}, er = () => {
|
|
1043
|
+
const e = b(ve), t = b(E), r = b(tn), n = b(We), i = b(_e), s = (c) => {
|
|
1044
1044
|
const m = i.getCurrentLastSelection();
|
|
1045
1045
|
if (!m)
|
|
1046
1046
|
return;
|
|
1047
1047
|
const u = m.range, f = [];
|
|
1048
|
-
|
|
1049
|
-
c ? f.push({ row: v, col: p, pattern: c, type:
|
|
1050
|
-
}), e.executeCommand(
|
|
1051
|
-
}, o =
|
|
1052
|
-
const c =
|
|
1053
|
-
return
|
|
1048
|
+
Ae.foreach(u, (v, p) => {
|
|
1049
|
+
c ? f.push({ row: v, col: p, pattern: c, type: pe(c) }) : f.push({ row: v, col: p });
|
|
1050
|
+
}), e.executeCommand(Ge.id, { values: f }), r.focus();
|
|
1051
|
+
}, o = x(() => {
|
|
1052
|
+
const c = Dt.get(t.getCurrentLocale());
|
|
1053
|
+
return st(c);
|
|
1054
1054
|
}, [t]), a = (c) => {
|
|
1055
1055
|
if (c === 0)
|
|
1056
1056
|
s(null);
|
|
@@ -1061,7 +1061,7 @@ const ot = (e) => [
|
|
|
1061
1061
|
m.pattern && s(m.pattern);
|
|
1062
1062
|
}
|
|
1063
1063
|
}, l = 1220;
|
|
1064
|
-
return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((c, m) => c === "|" ? /* @__PURE__ */ h(
|
|
1064
|
+
return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((c, m) => c === "|" ? /* @__PURE__ */ h(gn, {}, m) : /* @__PURE__ */ C(
|
|
1065
1065
|
"div",
|
|
1066
1066
|
{
|
|
1067
1067
|
className: "univer-flex univer-h-7 univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-px-2 univer-text-sm hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
@@ -1070,48 +1070,48 @@ const ot = (e) => [
|
|
|
1070
1070
|
},
|
|
1071
1071
|
children: [
|
|
1072
1072
|
/* @__PURE__ */ h("span", { children: t.t(c.label) }),
|
|
1073
|
-
/* @__PURE__ */ h("span", { className: "univer-text-xs univer-text-gray-500", children: c.pattern ?
|
|
1073
|
+
/* @__PURE__ */ h("span", { className: "univer-text-xs univer-text-gray-500", children: c.pattern ? Ft(c.pattern || "", l, n.locale).result.trim() : "" })
|
|
1074
1074
|
]
|
|
1075
1075
|
},
|
|
1076
1076
|
m
|
|
1077
1077
|
)) });
|
|
1078
|
-
},
|
|
1079
|
-
[
|
|
1080
|
-
[Xe.id]: {
|
|
1081
|
-
order: 0,
|
|
1082
|
-
menuItemFactory: Zn
|
|
1083
|
-
},
|
|
1078
|
+
}, tr = {
|
|
1079
|
+
[nn.FORMULAS]: {
|
|
1084
1080
|
[ze.id]: {
|
|
1085
|
-
order:
|
|
1081
|
+
order: 0,
|
|
1086
1082
|
menuItemFactory: Yn
|
|
1087
1083
|
},
|
|
1088
1084
|
[Ye.id]: {
|
|
1089
|
-
order:
|
|
1085
|
+
order: 1,
|
|
1090
1086
|
menuItemFactory: zn
|
|
1091
1087
|
},
|
|
1092
1088
|
[Ze.id]: {
|
|
1093
|
-
order:
|
|
1089
|
+
order: 2,
|
|
1094
1090
|
menuItemFactory: Xn
|
|
1095
1091
|
},
|
|
1092
|
+
[Ke.id]: {
|
|
1093
|
+
order: 3,
|
|
1094
|
+
menuItemFactory: qn
|
|
1095
|
+
},
|
|
1096
1096
|
[H.id]: {
|
|
1097
1097
|
order: 4,
|
|
1098
|
-
menuItemFactory:
|
|
1098
|
+
menuItemFactory: Jn
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
};
|
|
1102
|
-
var
|
|
1103
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1102
|
+
var nr = Object.getOwnPropertyDescriptor, rr = (e, t, r, n) => {
|
|
1103
|
+
for (var i = n > 1 ? void 0 : n ? nr(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
1104
1104
|
(o = e[s]) && (i = o(i) || i);
|
|
1105
1105
|
return i;
|
|
1106
|
-
},
|
|
1107
|
-
let
|
|
1106
|
+
}, Ue = (e, t) => (r, n) => t(r, n, e);
|
|
1107
|
+
let ee = class extends ne {
|
|
1108
1108
|
constructor(e, t) {
|
|
1109
1109
|
super(), this._componentManager = e, this._menuManagerService = t, this._initMenu();
|
|
1110
1110
|
}
|
|
1111
1111
|
_initMenu() {
|
|
1112
|
-
this._menuManagerService.mergeMenu(
|
|
1113
|
-
[
|
|
1114
|
-
[
|
|
1112
|
+
this._menuManagerService.mergeMenu(tr), [
|
|
1113
|
+
[ot, Qn],
|
|
1114
|
+
[at, er]
|
|
1115
1115
|
].forEach(([e, t]) => {
|
|
1116
1116
|
this.disposeWithMe(
|
|
1117
1117
|
this._componentManager.register(e, t)
|
|
@@ -1119,22 +1119,22 @@ let te = class extends re {
|
|
|
1119
1119
|
});
|
|
1120
1120
|
}
|
|
1121
1121
|
};
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
],
|
|
1126
|
-
var
|
|
1127
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1122
|
+
ee = rr([
|
|
1123
|
+
Ue(0, y(qe)),
|
|
1124
|
+
Ue(1, rn)
|
|
1125
|
+
], ee);
|
|
1126
|
+
var ir = Object.defineProperty, sr = Object.getOwnPropertyDescriptor, or = (e, t, r) => t in e ? ir(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ar = (e, t, r, n) => {
|
|
1127
|
+
for (var i = n > 1 ? void 0 : n ? sr(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
1128
1128
|
(o = e[s]) && (i = o(i) || i);
|
|
1129
1129
|
return i;
|
|
1130
|
-
},
|
|
1131
|
-
const
|
|
1132
|
-
let
|
|
1133
|
-
constructor(e =
|
|
1130
|
+
}, me = (e, t) => (r, n) => t(r, n, e), ct = (e, t, r) => or(e, typeof t != "symbol" ? t + "" : t, r);
|
|
1131
|
+
const cr = "SHEET_NUMFMT_UI_PLUGIN";
|
|
1132
|
+
let te = class extends Nt {
|
|
1133
|
+
constructor(e = Oe, t, r, n) {
|
|
1134
1134
|
super(), this._config = e, this._injector = t, this._configService = r, this._renderManagerService = n;
|
|
1135
1135
|
const { menu: i, ...s } = Et(
|
|
1136
1136
|
{},
|
|
1137
|
-
|
|
1137
|
+
Oe,
|
|
1138
1138
|
this._config
|
|
1139
1139
|
);
|
|
1140
1140
|
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig("sheets-numfmt-ui.config", s);
|
|
@@ -1142,34 +1142,34 @@ let ne = class extends Nt {
|
|
|
1142
1142
|
onStarting() {
|
|
1143
1143
|
Tt(this._injector, [
|
|
1144
1144
|
[B],
|
|
1145
|
-
[
|
|
1145
|
+
[Q],
|
|
1146
1146
|
[j],
|
|
1147
|
-
[
|
|
1147
|
+
[ee]
|
|
1148
1148
|
]);
|
|
1149
1149
|
}
|
|
1150
1150
|
onRendered() {
|
|
1151
1151
|
this._registerRenderModules(), wt(this._injector, [
|
|
1152
1152
|
[B],
|
|
1153
|
-
[
|
|
1154
|
-
[
|
|
1153
|
+
[Q],
|
|
1154
|
+
[ee]
|
|
1155
1155
|
]);
|
|
1156
1156
|
}
|
|
1157
1157
|
_registerRenderModules() {
|
|
1158
1158
|
[
|
|
1159
|
-
[
|
|
1159
|
+
[he]
|
|
1160
1160
|
].forEach((t) => {
|
|
1161
1161
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(w.UNIVER_SHEET, t));
|
|
1162
1162
|
});
|
|
1163
1163
|
}
|
|
1164
1164
|
};
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
It(
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
],
|
|
1165
|
+
ct(te, "pluginName", cr);
|
|
1166
|
+
ct(te, "type", w.UNIVER_SHEET);
|
|
1167
|
+
te = ar([
|
|
1168
|
+
It(Gt, Lt),
|
|
1169
|
+
me(1, y(He)),
|
|
1170
|
+
me(2, $e),
|
|
1171
|
+
me(3, je)
|
|
1172
|
+
], te);
|
|
1173
1173
|
export {
|
|
1174
|
-
|
|
1174
|
+
te as UniverSheetsNumfmtUIPlugin
|
|
1175
1175
|
};
|