@univerjs/sheets-numfmt-ui 0.5.4 → 0.5.5-nightly.202501201336
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 +195 -188
- package/lib/index.css +1 -1
- package/lib/types/controllers/numfmt.controller.d.ts +4 -1
- package/lib/umd/index.js +2 -2
- package/package.json +11 -11
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var X = (t, e, n) =>
|
|
4
|
-
import { Inject as S, LocaleService as T, Disposable as oe, isRealNum as
|
|
1
|
+
var pt = Object.defineProperty;
|
|
2
|
+
var vt = (t, e, n) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var X = (t, e, n) => vt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Inject as S, LocaleService as T, Disposable as oe, isRealNum as _t, 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 gt, InterceptorEffectEnum as Oe, ThemeService as St, IUniverInstanceService as ye, ICommandService as be, Injector as Ge, Optional as yt, DependentOn as bt, Plugin as Ct, merge as It, registerDependencies as Nt, touchDependencies as Et, IConfigService as Tt } from "@univerjs/core";
|
|
5
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
|
|
7
|
-
import { HoverManagerService as
|
|
8
|
-
import { IZenZoneService as
|
|
9
|
-
import { FormulaDataModel as
|
|
6
|
+
import { currencySymbols as Ue, getDecimalFromPattern as te, getCurrencyType as W, setPatternDecimal as M, getCurrencyFormatOptions as ue, isPatternEqualWithoutDecimal as ce, CURRENCYFORMAT as xt, DATEFMTLISG as Pt, NUMBERFORMAT as Mt, getDateFormatOptions as qe, getNumberFormatOptions as Ye, isPatternHasDecimal as Rt, getPatternType as ne, SetNumfmtCommand as Ze, getPatternPreviewIgnoreGeneral as jt, SheetsNumfmtCellContentController as ze, MenuCurrencyService as wt, countryCurrencyMap as O, SetCurrencyCommand as Je, AddDecimalCommand as Xe, SubtractDecimalCommand as Qe, SetPercentCommand as et, getPatternPreview as Ot, UniverSheetsNumfmtPlugin as Ut } from "@univerjs/sheets-numfmt";
|
|
7
|
+
import { HoverManagerService as $t, CellAlertManagerService as Dt, CellAlertType as Ft, SheetSkeletonManagerService as Lt, IEditorBridgeService as Ht, getCurrentRangeDisable$ as V, deriveStateFromActiveSheet$ as At, UniverSheetsUIPlugin as kt } from "@univerjs/sheets-ui";
|
|
8
|
+
import { IZenZoneService as Bt, ComponentManager as tt, ISidebarService as Wt, MenuItemType as G, getMenuHiddenObservable as K, ILayoutService as Vt, RibbonStartGroup as Gt, IMenuManagerService as Kt, UI_PLUGIN_CONFIG_KEY as qt } from "@univerjs/ui";
|
|
9
|
+
import { FormulaDataModel as Yt } from "@univerjs/engine-formula";
|
|
10
10
|
import { DEFAULT_TEXT_FORMAT as Ce } from "@univerjs/engine-numfmt";
|
|
11
|
-
import { INumfmtService as Ie, INTERCEPTOR_POINT as
|
|
12
|
-
import { debounceTime as
|
|
11
|
+
import { INumfmtService as Ie, INTERCEPTOR_POINT as Zt, RemoveNumfmtMutation as Ne, SetNumfmtMutation as Ee, SheetInterceptorService as nt, SheetsSelectionsService as Te, BEFORE_CELL_EDIT as zt, AFTER_CELL_EDIT as Jt, SetRangeValuesCommand as Xt, transformCellsToRange as Qt, factorySetNumfmtUndoMutation as en, factoryRemoveNumfmtUndoMutation as tn, WorkbookEditablePermission as q, WorksheetEditPermission as Y, WorksheetSetCellStylePermission as Z, RangeProtectionPermissionEditPoint as z } from "@univerjs/sheets";
|
|
12
|
+
import { debounceTime as nn, merge as rt, Observable as D, combineLatest as rn } from "rxjs";
|
|
13
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
|
|
14
|
+
import ln, { createContext as mn, useState as C, useEffect as ae, useRef as xe, useContext as st, useMemo as R, forwardRef as it, createElement as Pe } from "react";
|
|
15
15
|
import { InputNumber as Me, Select as Re, SelectList as je, Input as un, Button as $e } from "@univerjs/design";
|
|
16
16
|
const De = {};
|
|
17
17
|
var dn = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, fn = (t, e, n, r) => {
|
|
@@ -28,28 +28,28 @@ let Se = class extends oe {
|
|
|
28
28
|
this._initCellAlertPopup(), this._initZenService();
|
|
29
29
|
}
|
|
30
30
|
_initCellAlertPopup() {
|
|
31
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
|
31
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(nn(100)).subscribe((t) => {
|
|
32
32
|
var e;
|
|
33
33
|
if (t) {
|
|
34
34
|
const n = t.location, r = this._context.unit, s = r.getActiveSheet();
|
|
35
35
|
if (!s) return;
|
|
36
36
|
const i = n.unitId, o = n.subUnitId;
|
|
37
|
-
let
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
const m = r.getStyles().get(
|
|
41
|
-
m != null && m.n && (
|
|
37
|
+
let a;
|
|
38
|
+
const c = s.getCell(n.row, n.col);
|
|
39
|
+
if (c != null && c.s) {
|
|
40
|
+
const m = r.getStyles().get(c.s);
|
|
41
|
+
m != null && m.n && (a = m.n);
|
|
42
42
|
}
|
|
43
|
-
if (
|
|
43
|
+
if (a || (a = this._numfmtService.getValue(i, o, n.row, n.col)), !a) {
|
|
44
44
|
this._hideAlert();
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
47
|
+
if (a.pattern === Ce && (c != null && c.v) && _t(c.v)) {
|
|
48
48
|
const m = this._cellAlertManagerService.currentAlert.get(de), d = (e = m == null ? void 0 : m.alert) == null ? void 0 : e.location;
|
|
49
49
|
if (d && d.row === n.row && d.col === n.col && d.subUnitId === n.subUnitId && d.unitId === n.unitId)
|
|
50
50
|
return;
|
|
51
51
|
this._cellAlertManagerService.showAlert({
|
|
52
|
-
type:
|
|
52
|
+
type: Ft.ERROR,
|
|
53
53
|
title: this._localeService.t("info.error"),
|
|
54
54
|
message: this._localeService.t("info.forceStringInfo"),
|
|
55
55
|
location: n,
|
|
@@ -73,11 +73,11 @@ let Se = class extends oe {
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
Se = fn([
|
|
76
|
-
U(1, S(
|
|
77
|
-
U(2, S(
|
|
76
|
+
U(1, S($t)),
|
|
77
|
+
U(2, S(Dt)),
|
|
78
78
|
U(3, S(T)),
|
|
79
|
-
U(4, S(
|
|
80
|
-
U(5,
|
|
79
|
+
U(4, S(Yt)),
|
|
80
|
+
U(5, Bt),
|
|
81
81
|
U(6, S(Ie))
|
|
82
82
|
], Se);
|
|
83
83
|
const he = {
|
|
@@ -107,12 +107,12 @@ function pn() {
|
|
|
107
107
|
if (Fe) return L;
|
|
108
108
|
Fe = 1;
|
|
109
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(
|
|
110
|
+
function o(a, c, m) {
|
|
111
111
|
var d, u = {}, h = null, p = null;
|
|
112
|
-
m !== void 0 && (h = "" + m),
|
|
113
|
-
for (d in
|
|
114
|
-
if (
|
|
115
|
-
return { $$typeof: e, type:
|
|
112
|
+
m !== void 0 && (h = "" + m), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (p = c.ref);
|
|
113
|
+
for (d in c) r.call(c, d) && !i.hasOwnProperty(d) && (u[d] = c[d]);
|
|
114
|
+
if (a && a.defaultProps) for (d in c = a.defaultProps, c) u[d] === void 0 && (u[d] = c[d]);
|
|
115
|
+
return { $$typeof: e, type: a, key: h, ref: p, props: u, _owner: s.current };
|
|
116
116
|
}
|
|
117
117
|
return L.Fragment = n, L.jsx = o, L.jsxs = o, L;
|
|
118
118
|
}
|
|
@@ -151,17 +151,17 @@ let k = class {
|
|
|
151
151
|
async getHabit(t, e) {
|
|
152
152
|
const n = this._getKey(t), r = await this._localStorageService.getItem(n);
|
|
153
153
|
if (e && r) {
|
|
154
|
-
const s = r.map((i, o,
|
|
155
|
-
const
|
|
154
|
+
const s = r.map((i, o, a) => {
|
|
155
|
+
const c = a.length;
|
|
156
156
|
return {
|
|
157
157
|
value: i,
|
|
158
|
-
priority:
|
|
158
|
+
priority: c - o
|
|
159
159
|
};
|
|
160
160
|
});
|
|
161
161
|
return e.sort((i, o) => {
|
|
162
162
|
var m, d;
|
|
163
|
-
const
|
|
164
|
-
return (((d = s.find((u) => u.value === o)) == null ? void 0 : d.priority) || -1) -
|
|
163
|
+
const a = ((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) - a;
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
return r || [];
|
|
@@ -194,13 +194,13 @@ const He = "numfmtCurrency", bn = (t) => {
|
|
|
194
194
|
t.current.push(s), n({});
|
|
195
195
|
};
|
|
196
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 =
|
|
198
|
-
n.current = () => M(`_("${
|
|
197
|
+
const { defaultPattern: e, action: n, onChange: r } = t, [s, i] = C(() => te(e || "", 2)), o = st(we), [a, c] = C(() => W(e) || o[0]), m = R(() => o.map((v) => ({ label: v, value: v })), []), u = b(T).t;
|
|
198
|
+
n.current = () => M(`_("${a}"* #,##0${s > 0 ? ".0" : ""}_)`, s);
|
|
199
199
|
const h = (v) => {
|
|
200
|
-
|
|
200
|
+
c(v), r(M(`_("${v}"* #,##0${s > 0 ? ".0" : ""}_)`, s));
|
|
201
201
|
}, p = (v) => {
|
|
202
202
|
const f = v || 0;
|
|
203
|
-
i(f), r(M(`_("${
|
|
203
|
+
i(f), r(M(`_("${a}"* #,##0${f > 0 ? ".0" : ""}_)`, f));
|
|
204
204
|
};
|
|
205
205
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
206
206
|
/* @__PURE__ */ l.jsxs("div", { className: "m-t-16 options", children: [
|
|
@@ -210,18 +210,18 @@ const He = "numfmtCurrency", bn = (t) => {
|
|
|
210
210
|
] }),
|
|
211
211
|
/* @__PURE__ */ l.jsxs("div", { className: "option", children: [
|
|
212
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:
|
|
213
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ l.jsx(Re, { onChange: h, options: m, value: a }) })
|
|
214
214
|
] })
|
|
215
215
|
] }),
|
|
216
216
|
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: u("sheet.numfmt.accountingDes") })
|
|
217
217
|
] });
|
|
218
218
|
}, En = (t) => !!W(t) && !t.startsWith("_("), Tn = (t) => {
|
|
219
|
-
const n = b(T).t, r =
|
|
219
|
+
const n = b(T).t, r = st(we), [s, i] = C(() => W(t.defaultPattern) || r[0]), [o, a] = C(() => te(t.defaultPattern || "", 2)), [c, m] = C(() => {
|
|
220
220
|
var _;
|
|
221
221
|
const f = ue(s);
|
|
222
222
|
return ((_ = f.find((I) => ce(I.value, t.defaultPattern))) == null ? void 0 : _.value) || f[0].value;
|
|
223
223
|
}), d = R(() => ue(s), [s]), u = R(() => r.map((f) => ({ label: f, value: f })), [r]);
|
|
224
|
-
t.action.current = () => M(
|
|
224
|
+
t.action.current = () => M(c, o);
|
|
225
225
|
const h = (f) => {
|
|
226
226
|
if (f === void 0)
|
|
227
227
|
return;
|
|
@@ -231,7 +231,7 @@ const He = "numfmtCurrency", bn = (t) => {
|
|
|
231
231
|
}, p = (f) => {
|
|
232
232
|
f !== void 0 && (m(f), t.onChange(M(f, o)));
|
|
233
233
|
}, v = (f) => {
|
|
234
|
-
|
|
234
|
+
a(f || 0), t.onChange(M(c, f || 0));
|
|
235
235
|
};
|
|
236
236
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
237
237
|
/* @__PURE__ */ l.jsxs("div", { className: "m-t-16 options", children: [
|
|
@@ -245,7 +245,7 @@ const He = "numfmtCurrency", bn = (t) => {
|
|
|
245
245
|
] })
|
|
246
246
|
] }),
|
|
247
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:
|
|
248
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(je, { onChange: p, options: d, value: c }) }),
|
|
249
249
|
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.currencyDes") })
|
|
250
250
|
] });
|
|
251
251
|
};
|
|
@@ -264,13 +264,13 @@ var N = function() {
|
|
|
264
264
|
for (var s = 0, r = Object.getOwnPropertySymbols(t); s < r.length; s++)
|
|
265
265
|
e.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[s]) && (n[r[s]] = t[r[s]]);
|
|
266
266
|
return n;
|
|
267
|
-
},
|
|
268
|
-
var n = t.icon, r = t.id, s = t.className, i = t.extend, o = xn(t, ["icon", "id", "className", "extend"]),
|
|
269
|
-
return
|
|
267
|
+
}, ot = it(function(t, e) {
|
|
268
|
+
var n = t.icon, r = t.id, s = t.className, i = t.extend, o = xn(t, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(s || "").trim(), c = xe("_".concat(Rn()));
|
|
269
|
+
return ct(n, "".concat(r), { defIds: n.defIds, idSuffix: c.current }, N({ ref: e, className: a }, o), i);
|
|
270
270
|
});
|
|
271
|
-
function
|
|
271
|
+
function ct(t, e, n, r, s) {
|
|
272
272
|
return Pe(t.tag, N(N({ key: e }, Pn(t, n, s)), r), (Mn(t, n).children || []).map(function(i, o) {
|
|
273
|
-
return
|
|
273
|
+
return ct(i, "".concat(e, "-").concat(t.tag, "-").concat(o), n, void 0, s);
|
|
274
274
|
}));
|
|
275
275
|
}
|
|
276
276
|
function Pn(t, e, n) {
|
|
@@ -278,8 +278,8 @@ function Pn(t, e, n) {
|
|
|
278
278
|
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
|
|
279
279
|
var s = e.defIds;
|
|
280
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) {
|
|
281
|
-
var o = i[0],
|
|
282
|
-
typeof
|
|
281
|
+
var o = i[0], a = i[1];
|
|
282
|
+
typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
283
283
|
})), r;
|
|
284
284
|
}
|
|
285
285
|
function Mn(t, e) {
|
|
@@ -291,15 +291,15 @@ function Mn(t, e) {
|
|
|
291
291
|
function Rn() {
|
|
292
292
|
return Math.random().toString(36).substring(2, 8);
|
|
293
293
|
}
|
|
294
|
-
|
|
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" } }] },
|
|
296
|
-
return Pe(
|
|
294
|
+
ot.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" } }] }, at = it(function(t, e) {
|
|
296
|
+
return Pe(ot, Object.assign({}, t, {
|
|
297
297
|
id: "check-mark-single",
|
|
298
298
|
ref: e,
|
|
299
299
|
icon: jn
|
|
300
300
|
}));
|
|
301
301
|
});
|
|
302
|
-
|
|
302
|
+
at.displayName = "CheckMarkSingle";
|
|
303
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
304
|
customFormatTitle: wn,
|
|
305
305
|
customFormatInput: On,
|
|
@@ -309,18 +309,18 @@ const wn = "univer-custom-format-title", On = "univer-custom-format-input", Un =
|
|
|
309
309
|
customFormatDes: Fn
|
|
310
310
|
}, pe = "customFormat", ve = "numfmt_custom_pattern";
|
|
311
311
|
function Ln(t) {
|
|
312
|
-
const { defaultPattern: e, action: n, onChange: r } = t, s = b(k), i = b(We), o = b(T), [
|
|
313
|
-
n.current = () => (s.markHabit(pe,
|
|
314
|
-
const v = [.../* @__PURE__ */ new Set([
|
|
312
|
+
const { defaultPattern: e, action: n, onChange: r } = t, s = b(k), i = b(We), o = b(T), [a, c] = C(e);
|
|
313
|
+
n.current = () => (s.markHabit(pe, a), i.getItem(ve).then((p = []) => {
|
|
314
|
+
const v = [.../* @__PURE__ */ new Set([a, ...p || []])].splice(0, 10).filter((f) => !!f);
|
|
315
315
|
i.setItem(ve, v);
|
|
316
|
-
}),
|
|
316
|
+
}), a);
|
|
317
317
|
const [m, d] = C([]);
|
|
318
318
|
ae(() => {
|
|
319
319
|
i.getItem(ve).then((p) => {
|
|
320
320
|
const v = [
|
|
321
|
-
...
|
|
322
|
-
...
|
|
323
|
-
...
|
|
321
|
+
...xt.map((f) => f.suffix("$")),
|
|
322
|
+
...Pt.map((f) => f.suffix),
|
|
323
|
+
...Mt.map((f) => f.suffix)
|
|
324
324
|
];
|
|
325
325
|
v.push(...p || []), s.addHabit(pe, []).finally(() => {
|
|
326
326
|
s.getHabit(pe, v).then((f) => {
|
|
@@ -330,15 +330,15 @@ function Ln(t) {
|
|
|
330
330
|
});
|
|
331
331
|
}, []);
|
|
332
332
|
const u = (p) => {
|
|
333
|
-
|
|
333
|
+
c(p), r(p);
|
|
334
334
|
}, h = () => {
|
|
335
|
-
r(
|
|
335
|
+
r(a);
|
|
336
336
|
};
|
|
337
337
|
return /* @__PURE__ */ l.jsxs("div", { className: j.customFormat, children: [
|
|
338
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:
|
|
339
|
+
/* @__PURE__ */ l.jsx(un, { placeholder: o.t("sheet.numfmt.customFormat"), onBlur: h, value: a, onChange: c, className: j.customFormatInput }),
|
|
340
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:
|
|
341
|
+
/* @__PURE__ */ l.jsx("div", { className: j.customFormatHistoryListItemIconWrap, children: a === p && /* @__PURE__ */ l.jsx(at, {}) }),
|
|
342
342
|
/* @__PURE__ */ l.jsx("div", { children: p })
|
|
343
343
|
] }, p)) }),
|
|
344
344
|
/* @__PURE__ */ l.jsx("div", { className: j.customFormatDes, children: o.t("sheet.numfmt.customFormatDes") })
|
|
@@ -350,15 +350,15 @@ const Hn = (t) => {
|
|
|
350
350
|
}, An = (t) => {
|
|
351
351
|
const e = R(qe, []), r = b(T).t, [s, i] = C(() => {
|
|
352
352
|
if (t.defaultPattern) {
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
return
|
|
353
|
+
const a = e.find((c) => c.value === t.defaultPattern);
|
|
354
|
+
if (a)
|
|
355
|
+
return a.value;
|
|
356
356
|
}
|
|
357
357
|
return e[0].value;
|
|
358
358
|
});
|
|
359
359
|
t.action.current = () => s;
|
|
360
|
-
const o = (
|
|
361
|
-
|
|
360
|
+
const o = (a) => {
|
|
361
|
+
a !== void 0 && (i(a), t.onChange(a));
|
|
362
362
|
};
|
|
363
363
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
364
364
|
/* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.dateType") }),
|
|
@@ -372,17 +372,17 @@ const Hn = (t) => {
|
|
|
372
372
|
const e = b(T), n = R(Ye, []), [r, s] = C(() => te(t.defaultPattern || "", 0)), [i, o] = C(() => {
|
|
373
373
|
const u = n.find((h) => ce(h.value, t.defaultPattern || ""));
|
|
374
374
|
return (u == null ? void 0 : u.value) || n[0].value;
|
|
375
|
-
}),
|
|
375
|
+
}), a = R(() => M(i, Number(r || 0)), [i, r]), c = R(() => !Rt(i), [i]), m = (u) => {
|
|
376
376
|
s(u || 0), t.onChange(M(i, Number(u || 0)));
|
|
377
377
|
}, d = (u) => {
|
|
378
378
|
u !== void 0 && (s(te(u, 0)), o(u), t.onChange(u));
|
|
379
379
|
};
|
|
380
|
-
return t.action.current = () =>
|
|
380
|
+
return t.action.current = () => a, /* @__PURE__ */ l.jsxs("div", { children: [
|
|
381
381
|
/* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: e.t("sheet.numfmt.decimalLength") }),
|
|
382
382
|
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(
|
|
383
383
|
Me,
|
|
384
384
|
{
|
|
385
|
-
disabled:
|
|
385
|
+
disabled: c,
|
|
386
386
|
value: r,
|
|
387
387
|
max: 20,
|
|
388
388
|
min: 0,
|
|
@@ -397,7 +397,7 @@ const Hn = (t) => {
|
|
|
397
397
|
/* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: e.t("sheet.numfmt.thousandthPercentileDes") })
|
|
398
398
|
] });
|
|
399
399
|
}, Gn = (t) => {
|
|
400
|
-
const { defaultValue: e, defaultPattern: n, row: r, col: s } = t.value, i = b(T), o = xe(() => ""),
|
|
400
|
+
const { defaultValue: e, defaultPattern: n, row: r, col: s } = t.value, i = b(T), o = xe(() => ""), a = i.t, c = Cn(), m = R(
|
|
401
401
|
() => [
|
|
402
402
|
{ label: "sheet.numfmt.general", component: Bn },
|
|
403
403
|
{ label: "sheet.numfmt.accounting", component: Nn },
|
|
@@ -405,20 +405,20 @@ const Hn = (t) => {
|
|
|
405
405
|
{ label: "sheet.numfmt.date", component: An },
|
|
406
406
|
{ label: "sheet.numfmt.thousandthPercentile", component: Vn },
|
|
407
407
|
{ label: "sheet.numfmt.customFormat", component: Ln }
|
|
408
|
-
].map((g) => ({ ...g, label:
|
|
408
|
+
].map((g) => ({ ...g, label: a(g.label) })),
|
|
409
409
|
[]
|
|
410
410
|
), [d, u] = C(_), [h, p] = C(() => `${r}_${s}`), { mark: v, userHabitCurrency: f } = bn(() => p(`${r}_${s}_userCurrency'`)), y = R(() => {
|
|
411
411
|
var g;
|
|
412
412
|
return (g = m.find((w) => w.label === d)) == null ? void 0 : g.component;
|
|
413
413
|
}, [d]);
|
|
414
414
|
function _() {
|
|
415
|
-
return [kn, In, En, Hn, Wn].reduce((w,
|
|
415
|
+
return [kn, In, En, Hn, Wn].reduce((w, ht, ft) => w || (ht(n) ? m[ft].label : ""), "") || m[0].label;
|
|
416
416
|
}
|
|
417
417
|
const I = m.map((g) => ({
|
|
418
418
|
label: g.label,
|
|
419
419
|
value: g.label
|
|
420
|
-
})),
|
|
421
|
-
u(g),
|
|
420
|
+
})), P = (g) => {
|
|
421
|
+
u(g), c(() => t.onChange({ type: "change", value: o.current() || "" }));
|
|
422
422
|
}, J = (g) => {
|
|
423
423
|
t.onChange({ type: "change", value: g });
|
|
424
424
|
}, le = () => {
|
|
@@ -436,13 +436,13 @@ const Hn = (t) => {
|
|
|
436
436
|
u(_()), p(`${r}_${s}`);
|
|
437
437
|
}, [r, s]), /* @__PURE__ */ l.jsxs("div", { className: "numfmt-panel p-b-20", children: [
|
|
438
438
|
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
439
|
-
/* @__PURE__ */ l.jsx("div", { className: "label m-t-14", children:
|
|
440
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(Re, { onChange:
|
|
439
|
+
/* @__PURE__ */ l.jsx("div", { className: "label m-t-14", children: a("sheet.numfmt.numfmtType") }),
|
|
440
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(Re, { onChange: P, options: I, value: d, style: { width: "100%" } }) }),
|
|
441
441
|
/* @__PURE__ */ l.jsx("div", { children: y && /* @__PURE__ */ l.jsx(we.Provider, { value: f, children: /* @__PURE__ */ Pe(y, { ...me, key: h }) }) })
|
|
442
442
|
] }),
|
|
443
443
|
/* @__PURE__ */ l.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
444
|
-
/* @__PURE__ */ l.jsx($e, { size: "small", onClick: F, className: "m-r-12", children:
|
|
445
|
-
/* @__PURE__ */ l.jsx($e, { type: "primary", size: "small", onClick: le, children:
|
|
444
|
+
/* @__PURE__ */ l.jsx($e, { size: "small", onClick: F, className: "m-r-12", children: a("sheet.numfmt.cancel") }),
|
|
445
|
+
/* @__PURE__ */ l.jsx($e, { type: "primary", size: "small", onClick: le, children: a("sheet.numfmt.confirm") })
|
|
446
446
|
] })
|
|
447
447
|
] });
|
|
448
448
|
};
|
|
@@ -450,10 +450,10 @@ var Kn = Object.defineProperty, qn = Object.getOwnPropertyDescriptor, Yn = (t, e
|
|
|
450
450
|
for (var s = r > 1 ? void 0 : r ? qn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
451
451
|
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
452
452
|
return r && s && Kn(e, n, s), s;
|
|
453
|
-
},
|
|
453
|
+
}, x = (t, e) => (n, r) => e(n, r, t);
|
|
454
454
|
const Ae = "SHEET_NUMFMT_PANEL";
|
|
455
455
|
let B = class extends oe {
|
|
456
|
-
constructor(e, n, r, s, i, o,
|
|
456
|
+
constructor(e, n, r, s, i, o, a, c, m, d, u) {
|
|
457
457
|
super();
|
|
458
458
|
/**
|
|
459
459
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -463,21 +463,26 @@ let B = class extends oe {
|
|
|
463
463
|
*/
|
|
464
464
|
X(this, "_previewPattern", "");
|
|
465
465
|
X(this, "_sidebarDisposable", null);
|
|
466
|
-
this._sheetInterceptorService = e, this._themeService = n, this._univerInstanceService = r, this._commandService = s, this._selectionManagerService = i, this._renderManagerService = o, this._numfmtService =
|
|
466
|
+
this._sheetInterceptorService = e, this._themeService = n, this._univerInstanceService = r, this._commandService = s, this._selectionManagerService = i, this._renderManagerService = o, this._numfmtService = a, this._componentManager = c, this._sidebarService = m, this._localeService = d, this._sheetsNumfmtCellContentController = u, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
|
|
467
|
+
}
|
|
468
|
+
_initNumfmtLocalChange() {
|
|
469
|
+
this.disposeWithMe(rt(this._sheetsNumfmtCellContentController.local$, this._localeService.currentLocale$).subscribe(() => {
|
|
470
|
+
this._forceUpdate();
|
|
471
|
+
}));
|
|
467
472
|
}
|
|
468
473
|
openPanel() {
|
|
469
474
|
var y;
|
|
470
|
-
const e = this._sidebarService, n = this._selectionManagerService, r = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService,
|
|
471
|
-
if (!
|
|
475
|
+
const e = this._sidebarService, n = this._selectionManagerService, r = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService, c = (((y = n.getCurrentSelections()) == null ? void 0 : y.map((_) => _.range)) || [])[0];
|
|
476
|
+
if (!c)
|
|
472
477
|
return !1;
|
|
473
478
|
const m = s.getCurrentUnitForType(E.UNIVER_SHEET), d = m.getActiveSheet();
|
|
474
479
|
if (!d)
|
|
475
480
|
return !1;
|
|
476
|
-
const u = d.getCellRaw(
|
|
481
|
+
const u = d.getCellRaw(c.startRow, c.startColumn), h = i.getValue(
|
|
477
482
|
m.getUnitId(),
|
|
478
483
|
d.getSheetId(),
|
|
479
|
-
|
|
480
|
-
|
|
484
|
+
c.startRow,
|
|
485
|
+
c.startColumn
|
|
481
486
|
);
|
|
482
487
|
let p = "";
|
|
483
488
|
h && (p = h.pattern);
|
|
@@ -487,8 +492,8 @@ let B = class extends oe {
|
|
|
487
492
|
if (_.type === "change")
|
|
488
493
|
this._previewPattern = _.value, this._forceUpdate();
|
|
489
494
|
else if (_.type === "confirm") {
|
|
490
|
-
const
|
|
491
|
-
|
|
495
|
+
const P = ((I = n.getCurrentSelections()) == null ? void 0 : I.map((F) => F.range)) || [], J = { values: [] }, le = ne(_.value);
|
|
496
|
+
P.forEach((F) => {
|
|
492
497
|
Ve.foreach(F, (me, g) => {
|
|
493
498
|
J.values.push({
|
|
494
499
|
row: me,
|
|
@@ -500,7 +505,7 @@ let B = class extends oe {
|
|
|
500
505
|
}), r.executeCommand(Ze.id, J), e.close();
|
|
501
506
|
} else _.type === "cancel" && e.close();
|
|
502
507
|
},
|
|
503
|
-
value: { defaultPattern: p, defaultValue: v, row:
|
|
508
|
+
value: { defaultPattern: p, defaultValue: v, row: c.startRow, col: c.startColumn }
|
|
504
509
|
};
|
|
505
510
|
return this._sidebarDisposable = e.open({
|
|
506
511
|
header: { title: o.t("sheet.numfmt.title") },
|
|
@@ -519,7 +524,7 @@ let B = class extends oe {
|
|
|
519
524
|
const n = this._renderManagerService.getRenderById(
|
|
520
525
|
e != null ? e : this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET).getUnitId()
|
|
521
526
|
);
|
|
522
|
-
n == null || n.with(
|
|
527
|
+
n == null || n.with(Lt).reCalculate(), (r = n == null ? void 0 : n.mainComponent) == null || r.makeDirty();
|
|
523
528
|
}
|
|
524
529
|
_initCommands() {
|
|
525
530
|
[
|
|
@@ -532,12 +537,13 @@ let B = class extends oe {
|
|
|
532
537
|
_initPanel() {
|
|
533
538
|
this._componentManager.register(Ae, Gn);
|
|
534
539
|
}
|
|
540
|
+
// eslint-disable-next-line max-lines-per-function
|
|
535
541
|
_initRealTimeRenderingInterceptor() {
|
|
536
542
|
const e = new D((r) => {
|
|
537
543
|
this._commandService.onCommandExecuted((s) => {
|
|
538
544
|
s.id === A.id && r.next(!0), s.id === he.id && r.next(!1);
|
|
539
545
|
});
|
|
540
|
-
}), n =
|
|
546
|
+
}), n = rn([
|
|
541
547
|
e,
|
|
542
548
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
543
549
|
sn((r) => r ? r.map((s) => s.range) : [])
|
|
@@ -548,7 +554,7 @@ let B = class extends oe {
|
|
|
548
554
|
n.pipe(
|
|
549
555
|
on(
|
|
550
556
|
([r, s]) => new D((i) => {
|
|
551
|
-
const o = new
|
|
557
|
+
const o = new gt();
|
|
552
558
|
return r && s.length && i.next({ selectionRanges: s, disposableCollection: o }), () => {
|
|
553
559
|
o.dispose();
|
|
554
560
|
};
|
|
@@ -558,28 +564,28 @@ let B = class extends oe {
|
|
|
558
564
|
this._previewPattern = null;
|
|
559
565
|
})
|
|
560
566
|
).subscribe(({ disposableCollection: r, selectionRanges: s }) => {
|
|
561
|
-
var o,
|
|
567
|
+
var o, a;
|
|
562
568
|
const i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
563
569
|
this.openPanel(), r.add(
|
|
564
|
-
this._sheetInterceptorService.intercept(
|
|
570
|
+
this._sheetInterceptorService.intercept(Zt.CELL_CONTENT, {
|
|
565
571
|
priority: 99,
|
|
566
572
|
effect: Oe.Value | Oe.Style,
|
|
567
|
-
handler: (
|
|
568
|
-
const { row: u, col: h } = m, p = d(
|
|
573
|
+
handler: (c, m, d) => {
|
|
574
|
+
const { row: u, col: h } = m, p = d(c) || {};
|
|
569
575
|
if (s.find(
|
|
570
576
|
(v) => v.startColumn <= h && v.endColumn >= h && v.startRow <= u && v.endRow >= u
|
|
571
577
|
)) {
|
|
572
578
|
const v = m.worksheet.getCellRaw(u, h), f = v == null ? void 0 : v.v, y = v == null ? void 0 : v.t;
|
|
573
579
|
if (f == null || y !== $.NUMBER || this._previewPattern === null)
|
|
574
580
|
return p;
|
|
575
|
-
const _ =
|
|
581
|
+
const _ = jt(this._previewPattern, f, this._sheetsNumfmtCellContentController.local);
|
|
576
582
|
if (_.color) {
|
|
577
|
-
const
|
|
583
|
+
const P = this._themeService.getCurrentTheme()[`${_.color}500`];
|
|
578
584
|
return {
|
|
579
585
|
...p,
|
|
580
586
|
v: _.result,
|
|
581
587
|
t: $.STRING,
|
|
582
|
-
s: { cl: { rgb:
|
|
588
|
+
s: { cl: { rgb: P } }
|
|
583
589
|
};
|
|
584
590
|
}
|
|
585
591
|
return {
|
|
@@ -591,7 +597,7 @@ let B = class extends oe {
|
|
|
591
597
|
return p;
|
|
592
598
|
}
|
|
593
599
|
})
|
|
594
|
-
), (
|
|
600
|
+
), (a = (o = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : o.mainComponent) == null || a.makeDirty();
|
|
595
601
|
})
|
|
596
602
|
)
|
|
597
603
|
);
|
|
@@ -618,16 +624,17 @@ let B = class extends oe {
|
|
|
618
624
|
}
|
|
619
625
|
};
|
|
620
626
|
B = Yn([
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
627
|
+
x(0, S(nt)),
|
|
628
|
+
x(1, S(St)),
|
|
629
|
+
x(2, ye),
|
|
630
|
+
x(3, be),
|
|
631
|
+
x(4, S(Te)),
|
|
632
|
+
x(5, Ke),
|
|
633
|
+
x(6, Ie),
|
|
634
|
+
x(7, S(tt)),
|
|
635
|
+
x(8, Wt),
|
|
636
|
+
x(9, S(T)),
|
|
637
|
+
x(10, S(ze))
|
|
631
638
|
], B);
|
|
632
639
|
var Zn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Jn = (t, e, n, r) => {
|
|
633
640
|
for (var s = r > 1 ? void 0 : r ? zn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
@@ -637,7 +644,7 @@ var Zn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Jn = (t, e
|
|
|
637
644
|
const Xn = () => {
|
|
638
645
|
let t = [];
|
|
639
646
|
return {
|
|
640
|
-
add: (s, i, o,
|
|
647
|
+
add: (s, i, o, a, c) => t.push({ unitId: s, subUnitId: i, row: o, col: a, value: c }),
|
|
641
648
|
getEffects: () => t,
|
|
642
649
|
clean: () => {
|
|
643
650
|
t = [];
|
|
@@ -655,7 +662,7 @@ let re = class extends oe {
|
|
|
655
662
|
this._editorBridgeService && this.disposeWithMe(
|
|
656
663
|
ge(
|
|
657
664
|
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
658
|
-
|
|
665
|
+
zt,
|
|
659
666
|
{
|
|
660
667
|
handler: (e, n, r) => {
|
|
661
668
|
const s = n.row, i = n.col, o = this._numfmtService.getValue(
|
|
@@ -669,8 +676,10 @@ let re = class extends oe {
|
|
|
669
676
|
case "scientific":
|
|
670
677
|
case "currency":
|
|
671
678
|
case "grouped":
|
|
672
|
-
case "number":
|
|
673
|
-
|
|
679
|
+
case "number": {
|
|
680
|
+
const c = n.worksheet.getCellRaw(s, i);
|
|
681
|
+
return r && r(c);
|
|
682
|
+
}
|
|
674
683
|
case "percent":
|
|
675
684
|
case "date":
|
|
676
685
|
case "time":
|
|
@@ -694,7 +703,7 @@ let re = class extends oe {
|
|
|
694
703
|
this.disposeWithMe(
|
|
695
704
|
ge(
|
|
696
705
|
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
697
|
-
|
|
706
|
+
Jt,
|
|
698
707
|
{
|
|
699
708
|
// eslint-disable-next-line complexity
|
|
700
709
|
handler: (e, n, r) => {
|
|
@@ -716,10 +725,10 @@ let re = class extends oe {
|
|
|
716
725
|
};
|
|
717
726
|
if (!(e != null && e.v) && !(e != null && e.p) || (s == null ? void 0 : s.pattern) === Ce || e.t === $.FORCE_STRING)
|
|
718
727
|
return r(e);
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
721
|
-
if (er(
|
|
722
|
-
const { dataStream: v } =
|
|
728
|
+
const a = (u = e.p) == null ? void 0 : u.body, c = (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(c) || Q.parseTime(c) || Q.parseNumber(c);
|
|
729
|
+
if (a)
|
|
730
|
+
if (er(a)) {
|
|
731
|
+
const { dataStream: v } = a, f = v.replace(/\r\n$/, ""), y = Number(f);
|
|
723
732
|
if (Number.isNaN(y) && !m)
|
|
724
733
|
return r(e);
|
|
725
734
|
} else
|
|
@@ -736,7 +745,7 @@ let re = class extends oe {
|
|
|
736
745
|
);
|
|
737
746
|
const v = Number(m.v);
|
|
738
747
|
return r({ ...e, p: void 0, v, t: $.NUMBER });
|
|
739
|
-
} else (["date", "time", "datetime", "percent"].includes(i) || !Qn(
|
|
748
|
+
} else (["date", "time", "datetime", "percent"].includes(i) || !Qn(c)) && o();
|
|
740
749
|
return r(e);
|
|
741
750
|
}
|
|
742
751
|
}
|
|
@@ -751,27 +760,27 @@ let re = class extends oe {
|
|
|
751
760
|
getMutations(n) {
|
|
752
761
|
var r;
|
|
753
762
|
switch (n.id) {
|
|
754
|
-
case
|
|
763
|
+
case Xt.id: {
|
|
755
764
|
const s = e._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET), i = s.getUnitId(), o = (r = s.getActiveSheet()) == null ? void 0 : r.getSheetId();
|
|
756
765
|
if (!o)
|
|
757
766
|
return {
|
|
758
767
|
redos: [],
|
|
759
768
|
undos: []
|
|
760
769
|
};
|
|
761
|
-
const
|
|
762
|
-
if (e._collectEffectMutation.clean(), !
|
|
770
|
+
const a = e._collectEffectMutation.getEffects();
|
|
771
|
+
if (e._collectEffectMutation.clean(), !a.length)
|
|
763
772
|
return {
|
|
764
773
|
redos: [],
|
|
765
774
|
undos: []
|
|
766
775
|
};
|
|
767
|
-
const
|
|
776
|
+
const c = a.filter((h) => {
|
|
768
777
|
var p;
|
|
769
778
|
return !!((p = h.value) != null && p.pattern);
|
|
770
779
|
}).map((h) => ({
|
|
771
780
|
row: h.row,
|
|
772
781
|
col: h.col,
|
|
773
782
|
pattern: h.value.pattern
|
|
774
|
-
})), m =
|
|
783
|
+
})), m = a.filter((h) => {
|
|
775
784
|
var p;
|
|
776
785
|
return !((p = h.value) != null && p.pattern);
|
|
777
786
|
}).map((h) => ({
|
|
@@ -780,12 +789,12 @@ let re = class extends oe {
|
|
|
780
789
|
startColumn: h.col,
|
|
781
790
|
endRow: h.row
|
|
782
791
|
})), d = [], u = [];
|
|
783
|
-
if (
|
|
792
|
+
if (c.length) {
|
|
784
793
|
const h = {
|
|
785
794
|
id: Ee.id,
|
|
786
|
-
params:
|
|
795
|
+
params: Qt(i, o, c)
|
|
787
796
|
};
|
|
788
|
-
d.push(h), u.push(...
|
|
797
|
+
d.push(h), u.push(...en(e._injector, h.params));
|
|
789
798
|
}
|
|
790
799
|
if (m.length) {
|
|
791
800
|
const h = {
|
|
@@ -796,7 +805,7 @@ let re = class extends oe {
|
|
|
796
805
|
ranges: m
|
|
797
806
|
}
|
|
798
807
|
};
|
|
799
|
-
d.push(h), u.push(...
|
|
808
|
+
d.push(h), u.push(...tn(e._injector, h.params));
|
|
800
809
|
}
|
|
801
810
|
return {
|
|
802
811
|
redos: d,
|
|
@@ -814,18 +823,18 @@ let re = class extends oe {
|
|
|
814
823
|
}
|
|
815
824
|
};
|
|
816
825
|
re = Jn([
|
|
817
|
-
H(0, S(
|
|
826
|
+
H(0, S(nt)),
|
|
818
827
|
H(1, S(Ie)),
|
|
819
828
|
H(2, S(ye)),
|
|
820
829
|
H(3, S(Ge)),
|
|
821
|
-
H(4,
|
|
830
|
+
H(4, yt(Ht))
|
|
822
831
|
], re);
|
|
823
832
|
function Qn(t) {
|
|
824
833
|
return /^-?\d+(\.\d+)?$/.test(t);
|
|
825
834
|
}
|
|
826
835
|
function er(t) {
|
|
827
836
|
const { textRuns: e = [], paragraphs: n = [], customRanges: r, customBlocks: s = [] } = t, i = ["va"];
|
|
828
|
-
return !(e.some((o) => !!(o.ts && Object.keys(o.ts).some((
|
|
837
|
+
return !(e.some((o) => !!(o.ts && Object.keys(o.ts).some((c) => i.includes(c)))) || n.some((o) => o.bullet) || n.length >= 2 || r != null && r.length || s.length > 0);
|
|
829
838
|
}
|
|
830
839
|
const ee = [
|
|
831
840
|
{
|
|
@@ -882,7 +891,7 @@ const ee = [
|
|
|
882
891
|
}
|
|
883
892
|
], tr = (t) => ({
|
|
884
893
|
icon: new D((e) => {
|
|
885
|
-
const n = t.get(
|
|
894
|
+
const n = t.get(wt);
|
|
886
895
|
function r(i) {
|
|
887
896
|
return {
|
|
888
897
|
[O.US]: "DollarSingle",
|
|
@@ -897,7 +906,7 @@ const ee = [
|
|
|
897
906
|
e.next(r(o));
|
|
898
907
|
});
|
|
899
908
|
}),
|
|
900
|
-
id:
|
|
909
|
+
id: Je.id,
|
|
901
910
|
title: "sheet.numfmt.currency",
|
|
902
911
|
tooltip: "sheet.numfmt.currency",
|
|
903
912
|
type: G.BUTTON,
|
|
@@ -905,7 +914,7 @@ const ee = [
|
|
|
905
914
|
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
906
915
|
}), nr = (t) => ({
|
|
907
916
|
icon: "AddDigitsSingle",
|
|
908
|
-
id:
|
|
917
|
+
id: Xe.id,
|
|
909
918
|
title: "sheet.numfmt.addDecimal",
|
|
910
919
|
tooltip: "sheet.numfmt.addDecimal",
|
|
911
920
|
type: G.BUTTON,
|
|
@@ -913,7 +922,7 @@ const ee = [
|
|
|
913
922
|
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
914
923
|
}), rr = (t) => ({
|
|
915
924
|
icon: "ReduceDigitsSingle",
|
|
916
|
-
id:
|
|
925
|
+
id: Qe.id,
|
|
917
926
|
title: "sheet.numfmt.subtractDecimal",
|
|
918
927
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
919
928
|
type: G.BUTTON,
|
|
@@ -921,15 +930,15 @@ const ee = [
|
|
|
921
930
|
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
922
931
|
}), sr = (t) => ({
|
|
923
932
|
icon: "PercentSingle",
|
|
924
|
-
id:
|
|
933
|
+
id: et.id,
|
|
925
934
|
title: "sheet.numfmt.percent",
|
|
926
935
|
tooltip: "sheet.numfmt.percent",
|
|
927
936
|
type: G.BUTTON,
|
|
928
937
|
hidden$: K(t, E.UNIVER_SHEET),
|
|
929
938
|
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
|
|
930
939
|
}), ir = (t) => {
|
|
931
|
-
const e = t.get(ye), n = t.get(be), r = t.get(T), s = t.get(Te), i =
|
|
932
|
-
(
|
|
940
|
+
const e = t.get(ye), n = t.get(be), r = t.get(T), s = t.get(Te), i = At(e, "", ({ workbook: o, worksheet: a }) => new D(
|
|
941
|
+
(c) => rt(
|
|
933
942
|
s.selectionMoveEnd$,
|
|
934
943
|
new D((m) => {
|
|
935
944
|
const d = [Ne.id, Ee.id], u = n.onCommandExecuted((h) => {
|
|
@@ -941,27 +950,27 @@ const ee = [
|
|
|
941
950
|
var d, u;
|
|
942
951
|
const m = s.getCurrentSelections();
|
|
943
952
|
if (m && m[0]) {
|
|
944
|
-
const h = m[0].range, p = h.startRow, v = h.startColumn, f = (u = o.getStyles().get((d =
|
|
953
|
+
const h = m[0].range, p = h.startRow, v = h.startColumn, f = (u = o.getStyles().get((d = a.getCell(p, v)) == null ? void 0 : d.s)) == null ? void 0 : u.n, y = f == null ? void 0 : f.pattern;
|
|
945
954
|
let _ = r.t("sheet.numfmt.general");
|
|
946
955
|
if (y) {
|
|
947
|
-
const I = ee.filter((
|
|
948
|
-
(
|
|
956
|
+
const I = ee.filter((P) => typeof P == "object" && P.pattern).find(
|
|
957
|
+
(P) => ce(y, P.pattern)
|
|
949
958
|
);
|
|
950
959
|
I && typeof I == "object" && I.pattern ? _ = r.t(I.label) : _ = r.t("sheet.numfmt.moreFmt");
|
|
951
960
|
}
|
|
952
|
-
|
|
961
|
+
c.next(_);
|
|
953
962
|
}
|
|
954
963
|
})
|
|
955
964
|
));
|
|
956
965
|
return {
|
|
957
|
-
label:
|
|
966
|
+
label: lt,
|
|
958
967
|
id: A.id,
|
|
959
968
|
tooltip: "sheet.numfmt.title",
|
|
960
969
|
type: G.SELECTOR,
|
|
961
970
|
selections: [
|
|
962
971
|
{
|
|
963
972
|
label: {
|
|
964
|
-
name:
|
|
973
|
+
name: mt,
|
|
965
974
|
hoverable: !1
|
|
966
975
|
}
|
|
967
976
|
}
|
|
@@ -970,60 +979,58 @@ const ee = [
|
|
|
970
979
|
hidden$: K(t, E.UNIVER_SHEET),
|
|
971
980
|
disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Z, Y], rangeTypes: [z] })
|
|
972
981
|
};
|
|
973
|
-
},
|
|
982
|
+
}, lt = "sheet.numfmt.moreNumfmtType", mt = "sheet.numfmt.moreNumfmtType.options", or = (t) => {
|
|
974
983
|
var r;
|
|
975
984
|
const e = b(T), n = (r = t.value) != null ? r : e.t("sheet.numfmt.general");
|
|
976
985
|
return /* @__PURE__ */ l.jsx("span", { className: "more-numfmt-type", children: n });
|
|
977
986
|
}, cr = () => {
|
|
978
|
-
const t = b(be), e = b(T), n = b(
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
const a = r.getCurrentLastSelection();
|
|
982
|
-
if (!a)
|
|
987
|
+
const t = b(be), e = b(T), n = b(Vt), r = b(ze), s = b(Te), i = (c) => {
|
|
988
|
+
const m = s.getCurrentLastSelection();
|
|
989
|
+
if (!m)
|
|
983
990
|
return;
|
|
984
|
-
const
|
|
985
|
-
Ve.foreach(
|
|
986
|
-
c ?
|
|
987
|
-
}), t.executeCommand(Ze.id, { values:
|
|
988
|
-
},
|
|
991
|
+
const d = m.range, u = [];
|
|
992
|
+
Ve.foreach(d, (h, p) => {
|
|
993
|
+
c ? u.push({ row: h, col: p, pattern: c, type: ne(c) }) : u.push({ row: h, col: p });
|
|
994
|
+
}), t.executeCommand(Ze.id, { values: u }), n.focus();
|
|
995
|
+
}, o = (c) => {
|
|
989
996
|
if (c === 0)
|
|
990
|
-
|
|
997
|
+
i(null);
|
|
991
998
|
else if (c === ee.length - 1)
|
|
992
999
|
t.executeCommand(A.id);
|
|
993
1000
|
else {
|
|
994
|
-
const
|
|
995
|
-
|
|
1001
|
+
const m = ee[c];
|
|
1002
|
+
m.pattern && i(m.pattern);
|
|
996
1003
|
}
|
|
997
|
-
},
|
|
998
|
-
return /* @__PURE__ */ l.jsx("div", { className: "more-numfmt-type-options", children: ee.map((c,
|
|
1004
|
+
}, a = 1220;
|
|
1005
|
+
return /* @__PURE__ */ l.jsx("div", { className: "more-numfmt-type-options", children: ee.map((c, m) => c === "|" ? /* @__PURE__ */ l.jsx("div", { className: "line m-t-4", onClick: (d) => d.stopPropagation() }, m) : /* @__PURE__ */ l.jsxs(
|
|
999
1006
|
"div",
|
|
1000
1007
|
{
|
|
1001
1008
|
className: "option-item m-t-4",
|
|
1002
1009
|
onClick: () => {
|
|
1003
|
-
|
|
1010
|
+
o(m);
|
|
1004
1011
|
},
|
|
1005
1012
|
children: [
|
|
1006
1013
|
/* @__PURE__ */ l.jsx("div", { children: e.t(c.label) }),
|
|
1007
|
-
/* @__PURE__ */ l.jsx("div", { className: "m-l-26", children: c.pattern ?
|
|
1014
|
+
/* @__PURE__ */ l.jsx("div", { className: "m-l-26", children: c.pattern ? Ot(c.pattern || "", a, r.local).result : "" })
|
|
1008
1015
|
]
|
|
1009
1016
|
},
|
|
1010
|
-
|
|
1017
|
+
m
|
|
1011
1018
|
)) });
|
|
1012
1019
|
}, ar = {
|
|
1013
|
-
[
|
|
1014
|
-
[
|
|
1020
|
+
[Gt.FORMULAS_INSERT]: {
|
|
1021
|
+
[Je.id]: {
|
|
1015
1022
|
order: 4,
|
|
1016
1023
|
menuItemFactory: tr
|
|
1017
1024
|
},
|
|
1018
|
-
[
|
|
1025
|
+
[Xe.id]: {
|
|
1019
1026
|
order: 5,
|
|
1020
1027
|
menuItemFactory: nr
|
|
1021
1028
|
},
|
|
1022
|
-
[
|
|
1029
|
+
[Qe.id]: {
|
|
1023
1030
|
order: 6,
|
|
1024
1031
|
menuItemFactory: rr
|
|
1025
1032
|
},
|
|
1026
|
-
[
|
|
1033
|
+
[et.id]: {
|
|
1027
1034
|
order: 7,
|
|
1028
1035
|
menuItemFactory: sr
|
|
1029
1036
|
},
|
|
@@ -1043,31 +1050,31 @@ let se = class extends oe {
|
|
|
1043
1050
|
super(), this._componentManager = t, this._menuManagerService = e, this._initMenu();
|
|
1044
1051
|
}
|
|
1045
1052
|
_initMenu() {
|
|
1046
|
-
this._menuManagerService.mergeMenu(ar), this.disposeWithMe(this._componentManager.register(
|
|
1053
|
+
this._menuManagerService.mergeMenu(ar), this.disposeWithMe(this._componentManager.register(lt, or)), this.disposeWithMe(this._componentManager.register(mt, cr));
|
|
1047
1054
|
}
|
|
1048
1055
|
};
|
|
1049
1056
|
se = ur([
|
|
1050
|
-
ke(0, S(
|
|
1051
|
-
ke(1,
|
|
1057
|
+
ke(0, S(tt)),
|
|
1058
|
+
ke(1, Kt)
|
|
1052
1059
|
], se);
|
|
1053
|
-
var
|
|
1060
|
+
var ut = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, hr = (t, e, n) => e in t ? ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, fr = (t, e, n, r) => {
|
|
1054
1061
|
for (var s = r > 1 ? void 0 : r ? dr(e, n) : e, i = t.length - 1, o; i >= 0; i--)
|
|
1055
1062
|
(o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
|
|
1056
|
-
return r && s &&
|
|
1057
|
-
}, _e = (t, e) => (n, r) => e(n, r, t),
|
|
1063
|
+
return r && s && ut(e, n, s), s;
|
|
1064
|
+
}, _e = (t, e) => (n, r) => e(n, r, t), dt = (t, e, n) => hr(t, typeof e != "symbol" ? e + "" : e, n);
|
|
1058
1065
|
const pr = "SHEET_NUMFMT_UI_PLUGIN";
|
|
1059
|
-
let ie = class extends
|
|
1066
|
+
let ie = class extends Ct {
|
|
1060
1067
|
constructor(t = De, e, n, r) {
|
|
1061
1068
|
super(), this._config = t, this._injector = e, this._configService = n, this._renderManagerService = r;
|
|
1062
|
-
const { menu: s, ...i } =
|
|
1069
|
+
const { menu: s, ...i } = It(
|
|
1063
1070
|
{},
|
|
1064
1071
|
De,
|
|
1065
1072
|
this._config
|
|
1066
1073
|
);
|
|
1067
|
-
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(
|
|
1074
|
+
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(qt, i);
|
|
1068
1075
|
}
|
|
1069
1076
|
onStarting() {
|
|
1070
|
-
|
|
1077
|
+
Nt(this._injector, [
|
|
1071
1078
|
[B],
|
|
1072
1079
|
[re],
|
|
1073
1080
|
[k],
|
|
@@ -1075,7 +1082,7 @@ let ie = class extends bt {
|
|
|
1075
1082
|
]);
|
|
1076
1083
|
}
|
|
1077
1084
|
onRendered() {
|
|
1078
|
-
this._registerRenderModules(),
|
|
1085
|
+
this._registerRenderModules(), Et(this._injector, [
|
|
1079
1086
|
[B],
|
|
1080
1087
|
[re],
|
|
1081
1088
|
[se]
|
|
@@ -1089,12 +1096,12 @@ let ie = class extends bt {
|
|
|
1089
1096
|
});
|
|
1090
1097
|
}
|
|
1091
1098
|
};
|
|
1092
|
-
|
|
1093
|
-
|
|
1099
|
+
dt(ie, "pluginName", pr);
|
|
1100
|
+
dt(ie, "type", E.UNIVER_SHEET);
|
|
1094
1101
|
ie = fr([
|
|
1095
|
-
|
|
1102
|
+
bt(kt, Ut),
|
|
1096
1103
|
_e(1, S(Ge)),
|
|
1097
|
-
_e(2,
|
|
1104
|
+
_e(2, Tt),
|
|
1098
1105
|
_e(3, Ke)
|
|
1099
1106
|
], ie);
|
|
1100
1107
|
export {
|