@univerjs/sheets-numfmt-ui 0.10.13 → 0.10.14-nightly.202511031023
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 +206 -203
- package/lib/index.js +206 -203
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
var ut = Object.defineProperty;
|
|
2
2
|
var mt = (e, t, r) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var X = (e, t, r) => mt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Inject as C, LocaleService as E, IConfigService as Ue, Disposable as te, isTextFormat as ke, Tools as dt, isRealNum as De, CommandType as Fe, ILocalStorageService as Le, isPatternEqualWithoutDecimal as ne, numfmt as ht, ThemeService as vt, IUniverInstanceService as
|
|
4
|
+
import { Inject as C, LocaleService as E, IConfigService as Ue, Disposable as te, isTextFormat as ke, Tools as dt, isRealNum as De, CommandType as Fe, ILocalStorageService as Le, isPatternEqualWithoutDecimal as ne, numfmt as ht, ThemeService as vt, IUniverInstanceService as de, ICommandService as he, UniverInstanceType as T, CellValueType as P, toDisposable as ue, DisposableCollection as ft, InterceptorEffectEnum as Ee, Range as Ae, Injector as He, Optional as pt, getNumfmtParseValueFilter as gt, willLoseNumericPrecision as _t, fromCallback as St, isDefaultFormat as Ct, DEFAULT_TEXT_FORMAT_EXCEL as yt, DependentOn as bt, Plugin as It, merge as Nt, registerDependencies as Et, touchDependencies as Tt } from "@univerjs/core";
|
|
5
5
|
import { IRenderManagerService as je } from "@univerjs/engine-render";
|
|
6
|
-
import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Mt, currencySymbols as
|
|
6
|
+
import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Mt, currencySymbols as Te, getDecimalFromPattern as q, getCurrencyType as B, setPatternDecimal as $, getCurrencyFormatOptions as se, CURRENCYFORMAT as wt, DATEFMTLISG as Pt, NUMBERFORMAT as xt, getDateFormatOptions as Be, getNumberFormatOptions as Ve, isPatternHasDecimal as Rt, SheetsNumfmtCellContentController as We, getPatternPreviewIgnoreGeneral as $t, getPatternType as ve, SetNumfmtCommand as Ge, getCurrencySymbolByLocale as Ot, SetPercentCommand as Ke, SubtractDecimalCommand as Ze, AddDecimalCommand as Ye, SetCurrencyCommand as ze, getCurrencySymbolIconByLocale as Me, localeCurrencySymbolMap as Ut, getPatternPreview as kt, UniverSheetsNumfmtPlugin as Dt } from "@univerjs/sheets-numfmt";
|
|
7
7
|
import { HoverManagerService as Ft, CellAlertManagerService as Lt, CellAlertType as At, SheetSkeletonManagerService as Ht, IEditorBridgeService as jt, deriveStateFromActiveSheet$ as Bt, getCurrentRangeDisable$ as V, UniverSheetsUIPlugin as Vt } from "@univerjs/sheets-ui";
|
|
8
|
-
import { INumfmtService as
|
|
8
|
+
import { INumfmtService as fe, SheetInterceptorService as Xe, SheetsSelectionsService as pe, INTERCEPTOR_POINT as Wt, RemoveNumfmtMutation as ge, SetNumfmtMutation as _e, BEFORE_CELL_EDIT as Gt, AFTER_CELL_EDIT as Kt, SetRangeValuesCommand as Zt, transformCellsToRange as Yt, factorySetNumfmtUndoMutation as zt, factoryRemoveNumfmtUndoMutation as Xt, RangeProtectionPermissionEditPoint as W, WorksheetSetCellStylePermission as G, WorksheetEditPermission as K, WorkbookEditablePermission as Z } from "@univerjs/sheets";
|
|
9
9
|
import { IZenZoneService as qt, useDependency as b, ComponentManager as qe, ISidebarService as Jt, getMenuHiddenObservable as Y, MenuItemType as z, ILayoutService as Qt, RibbonDataGroup as en, IMenuManagerService as tn } from "@univerjs/ui";
|
|
10
10
|
import { debounceTime as nn, merge as Je, Observable as L, combineLatest as rn, filter as sn } from "rxjs";
|
|
11
11
|
import { map as on, switchMap as cn, tap as an, debounceTime as ln } from "rxjs/operators";
|
|
12
|
-
import { jsxs as y, jsx as
|
|
13
|
-
import { createContext as un, useState as N, useEffect as re, useRef as
|
|
14
|
-
import { InputNumber as
|
|
12
|
+
import { jsxs as y, jsx as v } from "react/jsx-runtime";
|
|
13
|
+
import { createContext as un, useState as N, useEffect as re, useRef as Se, useContext as Qe, useMemo as x, createElement as Ce, forwardRef as mn, useCallback as dn } from "react";
|
|
14
|
+
import { InputNumber as ye, Select as be, SelectList as Ie, Input as hn, clsx as et, borderClassName as vn, Button as we, scrollbarClassName as fn, Separator as pn } from "@univerjs/design";
|
|
15
15
|
import { stripErrorMargin as gn } from "@univerjs/engine-formula";
|
|
16
|
-
const
|
|
16
|
+
const Pe = {};
|
|
17
17
|
var _n = Object.getOwnPropertyDescriptor, Sn = (e, t, r, n) => {
|
|
18
18
|
for (var i = n > 1 ? void 0 : n ? _n(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
19
19
|
(o = e[s]) && (i = o(i) || i);
|
|
20
20
|
return i;
|
|
21
21
|
}, k = (e, t) => (r, n) => t(r, n, e);
|
|
22
|
-
const
|
|
23
|
-
let
|
|
22
|
+
const xe = "SHEET_NUMFMT_ALERT";
|
|
23
|
+
let me = class extends te {
|
|
24
24
|
constructor(e, t, r, n, i, s, o) {
|
|
25
25
|
super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = r, this._localeService = n, this._zenZoneService = i, this._numfmtService = s, this._configService = o, this._init();
|
|
26
26
|
}
|
|
@@ -33,23 +33,26 @@ let de = class extends te {
|
|
|
33
33
|
if (e) {
|
|
34
34
|
const n = e.location, i = this._context.unit, s = i.getActiveSheet();
|
|
35
35
|
if (!s) return;
|
|
36
|
-
const o = n.unitId,
|
|
36
|
+
const o = n.unitId, l = n.subUnitId;
|
|
37
37
|
let c;
|
|
38
38
|
const a = s.getCell(n.row, n.col);
|
|
39
39
|
if (a != null && a.s) {
|
|
40
40
|
const u = i.getStyles().get(a.s);
|
|
41
41
|
u != null && u.n && (c = u.n);
|
|
42
42
|
}
|
|
43
|
-
if (c || (c = this._numfmtService.getValue(o,
|
|
43
|
+
if (c || (c = this._numfmtService.getValue(o, l, n.row, n.col)), !c) {
|
|
44
44
|
this._hideAlert();
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
if (ke(c.pattern) && dt.isDefine(a == null ? void 0 : a.v) && De(a.v)) {
|
|
48
48
|
if ((t = this._configService.getConfig(Mt)) != null && t.disableTextFormatAlert)
|
|
49
49
|
return;
|
|
50
|
-
const u = this._cellAlertManagerService.currentAlert
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const u = this._cellAlertManagerService.currentAlert;
|
|
51
|
+
for (const [m, d] of u.entries()) {
|
|
52
|
+
const f = (r = d == null ? void 0 : d.alert) == null ? void 0 : r.location;
|
|
53
|
+
if (f && f.row === n.row && f.col === n.col && f.subUnitId === n.subUnitId && f.unitId === n.unitId)
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
53
56
|
this._cellAlertManagerService.showAlert({
|
|
54
57
|
type: At.ERROR,
|
|
55
58
|
title: this._localeService.t("info.error"),
|
|
@@ -57,7 +60,7 @@ let de = class extends te {
|
|
|
57
60
|
location: n,
|
|
58
61
|
width: 200,
|
|
59
62
|
height: 74,
|
|
60
|
-
key:
|
|
63
|
+
key: xe
|
|
61
64
|
});
|
|
62
65
|
return;
|
|
63
66
|
}
|
|
@@ -71,18 +74,18 @@ let de = class extends te {
|
|
|
71
74
|
}));
|
|
72
75
|
}
|
|
73
76
|
_hideAlert() {
|
|
74
|
-
this._cellAlertManagerService.removeAlert(
|
|
77
|
+
this._cellAlertManagerService.removeAlert(xe);
|
|
75
78
|
}
|
|
76
79
|
};
|
|
77
|
-
|
|
80
|
+
me = Sn([
|
|
78
81
|
k(1, C(Ft)),
|
|
79
82
|
k(2, C(Lt)),
|
|
80
83
|
k(3, C(E)),
|
|
81
84
|
k(4, qt),
|
|
82
|
-
k(5, C(
|
|
85
|
+
k(5, C(fe)),
|
|
83
86
|
k(6, Ue)
|
|
84
|
-
],
|
|
85
|
-
const
|
|
87
|
+
], me);
|
|
88
|
+
const oe = {
|
|
86
89
|
id: "sheet.operation.close.numfmt.panel",
|
|
87
90
|
type: Fe.OPERATION,
|
|
88
91
|
handler: () => (
|
|
@@ -99,7 +102,7 @@ var Cn = Object.getOwnPropertyDescriptor, yn = (e, t, r, n) => {
|
|
|
99
102
|
(o = e[s]) && (i = o(i) || i);
|
|
100
103
|
return i;
|
|
101
104
|
}, bn = (e, t) => (r, n) => t(r, n, e);
|
|
102
|
-
const
|
|
105
|
+
const Ne = un([]);
|
|
103
106
|
let H = class {
|
|
104
107
|
constructor(e) {
|
|
105
108
|
this._localStorageService = e;
|
|
@@ -125,8 +128,8 @@ let H = class {
|
|
|
125
128
|
async getHabit(e, t) {
|
|
126
129
|
const r = this._getKey(e), n = await this._localStorageService.getItem(r);
|
|
127
130
|
if (t && n) {
|
|
128
|
-
const i = n.map((s, o,
|
|
129
|
-
const c =
|
|
131
|
+
const i = n.map((s, o, l) => {
|
|
132
|
+
const c = l.length;
|
|
130
133
|
return {
|
|
131
134
|
value: s,
|
|
132
135
|
priority: c - o
|
|
@@ -134,8 +137,8 @@ let H = class {
|
|
|
134
137
|
});
|
|
135
138
|
return t.sort((s, o) => {
|
|
136
139
|
var a, u;
|
|
137
|
-
const
|
|
138
|
-
return (((u = i.find((
|
|
140
|
+
const l = ((a = i.find((m) => m.value === s)) == null ? void 0 : a.priority) || -1;
|
|
141
|
+
return (((u = i.find((m) => m.value === o)) == null ? void 0 : u.priority) || -1) - l;
|
|
139
142
|
});
|
|
140
143
|
}
|
|
141
144
|
return n || [];
|
|
@@ -148,10 +151,10 @@ H = yn([
|
|
|
148
151
|
bn(0, C(Le))
|
|
149
152
|
], H);
|
|
150
153
|
const Re = "numfmtCurrency", In = (e) => {
|
|
151
|
-
const t = b(H), [r, n] = N(
|
|
154
|
+
const t = b(H), [r, n] = N(Te);
|
|
152
155
|
return re(() => {
|
|
153
156
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
154
|
-
t.getHabit(Re, [...
|
|
157
|
+
t.getHabit(Re, [...Te]).then((s) => {
|
|
155
158
|
n(s), e && e(s);
|
|
156
159
|
});
|
|
157
160
|
});
|
|
@@ -159,7 +162,7 @@ const Re = "numfmtCurrency", In = (e) => {
|
|
|
159
162
|
t.markHabit(Re, s);
|
|
160
163
|
} };
|
|
161
164
|
}, Nn = () => {
|
|
162
|
-
const e =
|
|
165
|
+
const e = Se([]), [t, r] = N({});
|
|
163
166
|
return re(() => {
|
|
164
167
|
e.current.forEach((i) => {
|
|
165
168
|
i();
|
|
@@ -168,20 +171,20 @@ const Re = "numfmtCurrency", In = (e) => {
|
|
|
168
171
|
e.current.push(i), r({});
|
|
169
172
|
};
|
|
170
173
|
}, En = (e) => !!B(e) && e.startsWith("_("), Tn = (e) => {
|
|
171
|
-
const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => q(t || "", 2)), o = Qe(
|
|
172
|
-
r.current = () => $(`_("${
|
|
173
|
-
const
|
|
174
|
+
const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => q(t || "", 2)), o = Qe(Ne), [l, c] = N(() => B(t) || o[0]), a = x(() => o.map((p) => ({ label: p, value: p })), []), m = b(E).t;
|
|
175
|
+
r.current = () => $(`_("${l}"* #,##0${i > 0 ? ".0" : ""}_)`, i);
|
|
176
|
+
const d = (p) => {
|
|
174
177
|
c(p), n($(`_("${p}"* #,##0${i > 0 ? ".0" : ""}_)`, i));
|
|
175
178
|
}, f = (p) => {
|
|
176
|
-
const
|
|
177
|
-
s(
|
|
179
|
+
const h = p || 0;
|
|
180
|
+
s(h), n($(`_("${l}"* #,##0${h > 0 ? ".0" : ""}_)`, h));
|
|
178
181
|
};
|
|
179
182
|
return /* @__PURE__ */ y("div", { children: [
|
|
180
183
|
/* @__PURE__ */ y("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
|
|
181
184
|
/* @__PURE__ */ y("div", { className: "option", children: [
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
|
|
185
|
+
/* @__PURE__ */ v("div", { className: "univer-text-sm univer-text-gray-400", children: m("sheet.numfmt.decimalLength") }),
|
|
186
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ v(
|
|
187
|
+
ye,
|
|
185
188
|
{
|
|
186
189
|
value: i,
|
|
187
190
|
step: 1,
|
|
@@ -193,43 +196,43 @@ const Re = "numfmtCurrency", In = (e) => {
|
|
|
193
196
|
) })
|
|
194
197
|
] }),
|
|
195
198
|
/* @__PURE__ */ y("div", { className: "option", children: [
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
|
|
199
|
+
/* @__PURE__ */ v("div", { className: "univer-text-sm univer-text-gray-400", children: m("sheet.numfmt.currencyType") }),
|
|
200
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ v(
|
|
201
|
+
be,
|
|
199
202
|
{
|
|
200
203
|
options: a,
|
|
201
|
-
value:
|
|
202
|
-
onChange:
|
|
204
|
+
value: l,
|
|
205
|
+
onChange: d
|
|
203
206
|
}
|
|
204
207
|
) })
|
|
205
208
|
] })
|
|
206
209
|
] }),
|
|
207
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: m("sheet.numfmt.accountingDes") })
|
|
208
211
|
] });
|
|
209
212
|
}, Mn = (e) => !!B(e) && !e.startsWith("_("), wn = (e) => {
|
|
210
|
-
const r = b(E).t, n = Qe(
|
|
213
|
+
const r = b(E).t, n = Qe(Ne), [i, s] = N(() => B(e.defaultPattern) || n[0]), [o, l] = N(() => q(e.defaultPattern || "", 2)), [c, a] = N(() => {
|
|
211
214
|
var g;
|
|
212
|
-
const
|
|
213
|
-
return ((g =
|
|
214
|
-
}), u = x(() => se(i), [i]),
|
|
215
|
+
const h = se(i);
|
|
216
|
+
return ((g = h.find((I) => ne(I.value, e.defaultPattern))) == null ? void 0 : g.value) || h[0].value;
|
|
217
|
+
}), u = x(() => se(i), [i]), m = x(() => n.map((h) => ({ label: h, value: h })), [n]);
|
|
215
218
|
e.action.current = () => $(c, o);
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
219
|
+
const d = (h) => {
|
|
220
|
+
if (h === void 0)
|
|
218
221
|
return;
|
|
219
|
-
s(
|
|
220
|
-
const S = se(
|
|
222
|
+
s(h);
|
|
223
|
+
const S = se(h)[0].value;
|
|
221
224
|
a(S), e.onChange($(S, o));
|
|
222
|
-
}, f = (
|
|
223
|
-
|
|
224
|
-
}, p = (
|
|
225
|
-
|
|
225
|
+
}, f = (h) => {
|
|
226
|
+
h !== void 0 && (a(h), e.onChange($(h, o)));
|
|
227
|
+
}, p = (h) => {
|
|
228
|
+
l(h || 0), e.onChange($(c, h || 0));
|
|
226
229
|
};
|
|
227
230
|
return /* @__PURE__ */ y("div", { children: [
|
|
228
231
|
/* @__PURE__ */ y("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
|
|
229
232
|
/* @__PURE__ */ y("div", { className: "option", children: [
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
|
|
233
|
+
/* @__PURE__ */ v("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.decimalLength") }),
|
|
234
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2 univer-w-32", children: /* @__PURE__ */ v(
|
|
235
|
+
ye,
|
|
233
236
|
{
|
|
234
237
|
value: o,
|
|
235
238
|
max: 20,
|
|
@@ -239,35 +242,35 @@ const Re = "numfmtCurrency", In = (e) => {
|
|
|
239
242
|
) })
|
|
240
243
|
] }),
|
|
241
244
|
/* @__PURE__ */ y("div", { className: "option", children: [
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
|
|
245
|
+
/* @__PURE__ */ v("div", { className: "univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyType") }),
|
|
246
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ v(
|
|
247
|
+
be,
|
|
245
248
|
{
|
|
246
249
|
value: i,
|
|
247
|
-
options:
|
|
248
|
-
onChange:
|
|
250
|
+
options: m,
|
|
251
|
+
onChange: d
|
|
249
252
|
}
|
|
250
253
|
) })
|
|
251
254
|
] })
|
|
252
255
|
] }),
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ v("div", { className: "label univer-mt-4", children: r("sheet.numfmt.negType") }),
|
|
257
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2", children: /* @__PURE__ */ v(Ie, { value: c, options: u, onChange: f }) }),
|
|
258
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: r("sheet.numfmt.currencyDes") })
|
|
256
259
|
] });
|
|
257
260
|
};
|
|
258
261
|
function tt({ ref: e, ...t }) {
|
|
259
|
-
const { icon: r, id: n, className: i, extend: s, ...o } = t,
|
|
262
|
+
const { icon: r, id: n, className: i, extend: s, ...o } = t, l = `univerjs-icon univerjs-icon-${n} ${i || ""}`.trim(), c = Se(`_${Rn()}`);
|
|
260
263
|
return nt(r, `${n}`, {
|
|
261
264
|
defIds: r.defIds,
|
|
262
265
|
idSuffix: c.current
|
|
263
266
|
}, {
|
|
264
267
|
ref: e,
|
|
265
|
-
className:
|
|
268
|
+
className: l,
|
|
266
269
|
...o
|
|
267
270
|
}, s);
|
|
268
271
|
}
|
|
269
272
|
function nt(e, t, r, n, i) {
|
|
270
|
-
return
|
|
273
|
+
return Ce(e.tag, {
|
|
271
274
|
key: t,
|
|
272
275
|
...Pn(e, r, i),
|
|
273
276
|
...n
|
|
@@ -320,71 +323,71 @@ const $n = {
|
|
|
320
323
|
}
|
|
321
324
|
}]
|
|
322
325
|
}, rt = mn(function(t, r) {
|
|
323
|
-
return
|
|
326
|
+
return Ce(tt, Object.assign({}, t, {
|
|
324
327
|
id: "check-mark-icon",
|
|
325
328
|
ref: r,
|
|
326
329
|
icon: $n
|
|
327
330
|
}));
|
|
328
331
|
});
|
|
329
332
|
rt.displayName = "CheckMarkIcon";
|
|
330
|
-
const
|
|
333
|
+
const ce = "customFormat", ae = "numfmt_custom_pattern";
|
|
331
334
|
function On(e) {
|
|
332
|
-
const { defaultPattern: t, action: r, onChange: n } = e, i = b(H), s = b(Le), o = b(E), [
|
|
333
|
-
r.current = () => (i.markHabit(
|
|
334
|
-
const p = [.../* @__PURE__ */ new Set([
|
|
335
|
-
s.setItem(
|
|
336
|
-
}),
|
|
335
|
+
const { defaultPattern: t, action: r, onChange: n } = e, i = b(H), s = b(Le), o = b(E), [l, c] = N(t);
|
|
336
|
+
r.current = () => (i.markHabit(ce, l), s.getItem(ae).then((f = []) => {
|
|
337
|
+
const p = [.../* @__PURE__ */ new Set([l, ...f || []])].splice(0, 10).filter((h) => !!h);
|
|
338
|
+
s.setItem(ae, p);
|
|
339
|
+
}), l);
|
|
337
340
|
const [a, u] = N([]);
|
|
338
341
|
re(() => {
|
|
339
|
-
s.getItem(
|
|
342
|
+
s.getItem(ae).then((f) => {
|
|
340
343
|
const p = [
|
|
341
|
-
...wt.map((
|
|
342
|
-
...Pt.map((
|
|
343
|
-
...xt.map((
|
|
344
|
+
...wt.map((h) => h.suffix("$")),
|
|
345
|
+
...Pt.map((h) => h.suffix),
|
|
346
|
+
...xt.map((h) => h.suffix)
|
|
344
347
|
];
|
|
345
|
-
p.push(...f || []), i.addHabit(
|
|
346
|
-
i.getHabit(
|
|
347
|
-
u([...new Set(
|
|
348
|
+
p.push(...f || []), i.addHabit(ce, []).finally(() => {
|
|
349
|
+
i.getHabit(ce, p).then((h) => {
|
|
350
|
+
u([...new Set(h)]);
|
|
348
351
|
});
|
|
349
352
|
});
|
|
350
353
|
});
|
|
351
354
|
}, []);
|
|
352
|
-
const
|
|
355
|
+
const m = (f) => {
|
|
353
356
|
c(f), n(f);
|
|
354
|
-
},
|
|
355
|
-
n(
|
|
357
|
+
}, d = () => {
|
|
358
|
+
n(l);
|
|
356
359
|
};
|
|
357
360
|
return /* @__PURE__ */ y("div", { children: [
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: o.t("sheet.numfmt.customFormat") }),
|
|
362
|
+
/* @__PURE__ */ v(
|
|
360
363
|
hn,
|
|
361
364
|
{
|
|
362
365
|
placeholder: o.t("sheet.numfmt.customFormat"),
|
|
363
|
-
onBlur:
|
|
364
|
-
value:
|
|
366
|
+
onBlur: d,
|
|
367
|
+
value: l,
|
|
365
368
|
onChange: c,
|
|
366
369
|
className: "univer-mt-2 univer-w-full"
|
|
367
370
|
}
|
|
368
371
|
),
|
|
369
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ v(
|
|
370
373
|
"div",
|
|
371
374
|
{
|
|
372
375
|
className: et("univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2", vn),
|
|
373
376
|
children: a.map((f) => /* @__PURE__ */ y(
|
|
374
377
|
"div",
|
|
375
378
|
{
|
|
376
|
-
onClick: () =>
|
|
379
|
+
onClick: () => m(f),
|
|
377
380
|
className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-1.5 univer-py-1.5 univer-text-sm",
|
|
378
381
|
children: [
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ v("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: l === f && /* @__PURE__ */ v(rt, {}) }),
|
|
383
|
+
/* @__PURE__ */ v("div", { children: f })
|
|
381
384
|
]
|
|
382
385
|
},
|
|
383
386
|
f
|
|
384
387
|
))
|
|
385
388
|
}
|
|
386
389
|
),
|
|
387
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ v(
|
|
388
391
|
"div",
|
|
389
392
|
{
|
|
390
393
|
className: "univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
|
|
@@ -407,13 +410,13 @@ function kn(e) {
|
|
|
407
410
|
return n[0].value;
|
|
408
411
|
});
|
|
409
412
|
e.action.current = () => s;
|
|
410
|
-
const
|
|
413
|
+
const l = (c) => {
|
|
411
414
|
c !== void 0 && (o(c), t(c));
|
|
412
415
|
};
|
|
413
416
|
return /* @__PURE__ */ y("div", { children: [
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: i.t("sheet.numfmt.dateType") }),
|
|
418
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2", children: /* @__PURE__ */ v(Ie, { value: s, options: n, onChange: l }) }),
|
|
419
|
+
/* @__PURE__ */ v(
|
|
417
420
|
"div",
|
|
418
421
|
{
|
|
419
422
|
className: "univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200",
|
|
@@ -424,7 +427,7 @@ function kn(e) {
|
|
|
424
427
|
}
|
|
425
428
|
const Dn = (e) => !e, Fn = (e) => {
|
|
426
429
|
const r = b(E).t;
|
|
427
|
-
return e.action.current = () => "", /* @__PURE__ */
|
|
430
|
+
return e.action.current = () => "", /* @__PURE__ */ v("div", { children: /* @__PURE__ */ v(
|
|
428
431
|
"div",
|
|
429
432
|
{
|
|
430
433
|
className: "univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200",
|
|
@@ -434,17 +437,17 @@ const Dn = (e) => !e, Fn = (e) => {
|
|
|
434
437
|
}, Ln = (e) => Ve().some((t) => ne(t.value, e));
|
|
435
438
|
function An(e) {
|
|
436
439
|
const t = b(E), r = x(Ve, []), [n, i] = N(() => q(e.defaultPattern || "", 0)), [s, o] = N(() => {
|
|
437
|
-
const
|
|
438
|
-
return (
|
|
439
|
-
}),
|
|
440
|
-
i(
|
|
441
|
-
}, u = (
|
|
442
|
-
|
|
440
|
+
const m = r.find((d) => ne(d.value, e.defaultPattern || ""));
|
|
441
|
+
return (m == null ? void 0 : m.value) || r[0].value;
|
|
442
|
+
}), l = x(() => $(s, Number(n || 0)), [s, n]), c = x(() => !Rt(s), [s]), a = (m) => {
|
|
443
|
+
i(m || 0), e.onChange($(s, Number(m || 0)));
|
|
444
|
+
}, u = (m) => {
|
|
445
|
+
m !== void 0 && (i(q(m, 0)), o(m), e.onChange(m));
|
|
443
446
|
};
|
|
444
|
-
return e.action.current = () =>
|
|
445
|
-
/* @__PURE__ */
|
|
446
|
-
/* @__PURE__ */
|
|
447
|
-
|
|
447
|
+
return e.action.current = () => l, /* @__PURE__ */ y("div", { children: [
|
|
448
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: t.t("sheet.numfmt.decimalLength") }),
|
|
449
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2", children: /* @__PURE__ */ v(
|
|
450
|
+
ye,
|
|
448
451
|
{
|
|
449
452
|
disabled: c,
|
|
450
453
|
value: n,
|
|
@@ -457,8 +460,8 @@ function An(e) {
|
|
|
457
460
|
" ",
|
|
458
461
|
t.t("sheet.numfmt.negType")
|
|
459
462
|
] }),
|
|
460
|
-
/* @__PURE__ */
|
|
461
|
-
/* @__PURE__ */
|
|
463
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2", children: /* @__PURE__ */ v(Ie, { onChange: u, options: r, value: s }) }),
|
|
464
|
+
/* @__PURE__ */ v(
|
|
462
465
|
"div",
|
|
463
466
|
{
|
|
464
467
|
className: "univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200",
|
|
@@ -468,7 +471,7 @@ function An(e) {
|
|
|
468
471
|
] });
|
|
469
472
|
}
|
|
470
473
|
const Hn = (e) => {
|
|
471
|
-
const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o =
|
|
474
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = Se(() => ""), l = s.t, c = Nn(), a = x(
|
|
472
475
|
() => [
|
|
473
476
|
{ label: "sheet.numfmt.general", component: Fn },
|
|
474
477
|
{ label: "sheet.numfmt.accounting", component: Tn },
|
|
@@ -476,9 +479,9 @@ const Hn = (e) => {
|
|
|
476
479
|
{ label: "sheet.numfmt.date", component: kn },
|
|
477
480
|
{ label: "sheet.numfmt.thousandthPercentile", component: An },
|
|
478
481
|
{ label: "sheet.numfmt.customFormat", component: On }
|
|
479
|
-
].map((_) => ({ ..._, label:
|
|
482
|
+
].map((_) => ({ ..._, label: l(_.label) })),
|
|
480
483
|
[]
|
|
481
|
-
), [u,
|
|
484
|
+
), [u, m] = N(g), [d, f] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: h } = In(() => f(`${n}_${i}_userCurrency'`)), S = x(() => {
|
|
482
485
|
var _;
|
|
483
486
|
return (_ = a.find((U) => U.label === u)) == null ? void 0 : _.component;
|
|
484
487
|
}, [u]);
|
|
@@ -489,7 +492,7 @@ const Hn = (e) => {
|
|
|
489
492
|
label: _.label,
|
|
490
493
|
value: _.label
|
|
491
494
|
})), w = (_) => {
|
|
492
|
-
|
|
495
|
+
m(_), c(() => e.onChange({ type: "change", value: o.current() || "" }));
|
|
493
496
|
}, R = dn((_) => {
|
|
494
497
|
e.onChange({ type: "change", value: _ });
|
|
495
498
|
}, []), O = () => {
|
|
@@ -504,20 +507,20 @@ const Hn = (e) => {
|
|
|
504
507
|
action: o
|
|
505
508
|
};
|
|
506
509
|
return re(() => {
|
|
507
|
-
|
|
510
|
+
m(g()), f(`${n}_${i}`);
|
|
508
511
|
}, [n, i]), /* @__PURE__ */ y(
|
|
509
512
|
"div",
|
|
510
513
|
{
|
|
511
514
|
className: et("univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5", fn),
|
|
512
515
|
children: [
|
|
513
516
|
/* @__PURE__ */ y("div", { children: [
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-3.5 univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.numfmtType") }),
|
|
518
|
+
/* @__PURE__ */ v("div", { className: "univer-mt-2", children: /* @__PURE__ */ v(be, { className: "univer-w-full", value: u, options: I, onChange: w }) }),
|
|
519
|
+
/* @__PURE__ */ v("div", { children: S && /* @__PURE__ */ v(Ne.Provider, { value: h, children: /* @__PURE__ */ Ce(S, { ...ie, key: d }) }) })
|
|
517
520
|
] }),
|
|
518
521
|
/* @__PURE__ */ y("div", { className: "univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end", children: [
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ v(we, { onClick: D, className: "univer-mr-3", children: l("sheet.numfmt.cancel") }),
|
|
523
|
+
/* @__PURE__ */ v(we, { variant: "primary", onClick: O, children: l("sheet.numfmt.confirm") })
|
|
521
524
|
] })
|
|
522
525
|
]
|
|
523
526
|
}
|
|
@@ -530,7 +533,7 @@ var jn = Object.getOwnPropertyDescriptor, Bn = (e, t, r, n) => {
|
|
|
530
533
|
}, M = (e, t) => (r, n) => t(r, n, e);
|
|
531
534
|
const $e = "SHEET_NUMFMT_PANEL";
|
|
532
535
|
let j = class extends te {
|
|
533
|
-
constructor(t, r, n, i, s, o,
|
|
536
|
+
constructor(t, r, n, i, s, o, l, c, a, u, m) {
|
|
534
537
|
super();
|
|
535
538
|
/**
|
|
536
539
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -540,7 +543,7 @@ let j = class extends te {
|
|
|
540
543
|
*/
|
|
541
544
|
X(this, "_previewPattern", "");
|
|
542
545
|
X(this, "_sidebarDisposable", null);
|
|
543
|
-
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService =
|
|
546
|
+
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService = l, this._componentManager = c, this._sidebarService = a, this._localeService = u, this._sheetsNumfmtCellContentController = m, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
|
|
544
547
|
}
|
|
545
548
|
_initNumfmtLocalChange() {
|
|
546
549
|
this.disposeWithMe(Je(this._sheetsNumfmtCellContentController.locale$, this._localeService.currentLocale$).subscribe(() => {
|
|
@@ -555,21 +558,21 @@ let j = class extends te {
|
|
|
555
558
|
const a = i.getCurrentUnitForType(T.UNIVER_SHEET), u = a.getActiveSheet();
|
|
556
559
|
if (!u)
|
|
557
560
|
return !1;
|
|
558
|
-
const
|
|
561
|
+
const m = u.getCellRaw(c.startRow, c.startColumn), d = s.getValue(
|
|
559
562
|
a.getUnitId(),
|
|
560
563
|
u.getSheetId(),
|
|
561
564
|
c.startRow,
|
|
562
565
|
c.startColumn
|
|
563
566
|
);
|
|
564
567
|
let f = "";
|
|
565
|
-
|
|
566
|
-
const p = (
|
|
568
|
+
d && (f = d.pattern);
|
|
569
|
+
const p = (m == null ? void 0 : m.t) === P.NUMBER ? m.v : 12345678, h = {
|
|
567
570
|
onChange: (g) => {
|
|
568
571
|
var I;
|
|
569
572
|
if (g.type === "change")
|
|
570
573
|
this._previewPattern = g.value, this._forceUpdate();
|
|
571
574
|
else if (g.type === "confirm") {
|
|
572
|
-
const w = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((D) => D.range)) || [], R = { values: [] }, O =
|
|
575
|
+
const w = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((D) => D.range)) || [], R = { values: [] }, O = ve(g.value);
|
|
573
576
|
w.forEach((D) => {
|
|
574
577
|
Ae.foreach(D, (ie, _) => {
|
|
575
578
|
R.values.push({
|
|
@@ -588,11 +591,11 @@ let j = class extends te {
|
|
|
588
591
|
header: { title: o.t("sheet.numfmt.title") },
|
|
589
592
|
children: {
|
|
590
593
|
label: $e,
|
|
591
|
-
...
|
|
594
|
+
...h
|
|
592
595
|
// need passthrough to react props.
|
|
593
596
|
},
|
|
594
597
|
onClose: () => {
|
|
595
|
-
this._forceUpdate(), n.executeCommand(
|
|
598
|
+
this._forceUpdate(), n.executeCommand(oe.id);
|
|
596
599
|
}
|
|
597
600
|
}), !0;
|
|
598
601
|
}
|
|
@@ -606,7 +609,7 @@ let j = class extends te {
|
|
|
606
609
|
_initCommands() {
|
|
607
610
|
[
|
|
608
611
|
A,
|
|
609
|
-
|
|
612
|
+
oe
|
|
610
613
|
].forEach((t) => {
|
|
611
614
|
this.disposeWithMe(this._commandService.registerCommand(t));
|
|
612
615
|
});
|
|
@@ -620,7 +623,7 @@ let j = class extends te {
|
|
|
620
623
|
_initRealTimeRenderingInterceptor() {
|
|
621
624
|
const t = new L((n) => {
|
|
622
625
|
this._commandService.onCommandExecuted((i) => {
|
|
623
|
-
i.id === A.id && n.next(!0), i.id ===
|
|
626
|
+
i.id === A.id && n.next(!0), i.id === oe.id && n.next(!1);
|
|
624
627
|
});
|
|
625
628
|
}), r = rn([
|
|
626
629
|
t,
|
|
@@ -629,7 +632,7 @@ let j = class extends te {
|
|
|
629
632
|
)
|
|
630
633
|
]);
|
|
631
634
|
this.disposeWithMe(
|
|
632
|
-
|
|
635
|
+
ue(
|
|
633
636
|
r.pipe(
|
|
634
637
|
cn(
|
|
635
638
|
([n, i]) => new L((s) => {
|
|
@@ -643,19 +646,19 @@ let j = class extends te {
|
|
|
643
646
|
this._previewPattern = null;
|
|
644
647
|
})
|
|
645
648
|
).subscribe(({ disposableCollection: n, selectionRanges: i }) => {
|
|
646
|
-
var o,
|
|
649
|
+
var o, l;
|
|
647
650
|
const s = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
|
|
648
651
|
this.openPanel(), n.add(
|
|
649
652
|
this._sheetInterceptorService.intercept(Wt.CELL_CONTENT, {
|
|
650
653
|
priority: 99,
|
|
651
|
-
effect:
|
|
654
|
+
effect: Ee.Value | Ee.Style,
|
|
652
655
|
handler: (c, a, u) => {
|
|
653
656
|
var p;
|
|
654
|
-
const { row:
|
|
657
|
+
const { row: m, col: d } = a, f = u(c) || {};
|
|
655
658
|
if (i.find(
|
|
656
|
-
(
|
|
659
|
+
(h) => h.startColumn <= d && h.endColumn >= d && h.startRow <= m && h.endRow >= m
|
|
657
660
|
)) {
|
|
658
|
-
const
|
|
661
|
+
const h = a.worksheet.getCellRaw(m, d), S = h == null ? void 0 : h.v, g = h == null ? void 0 : h.t;
|
|
659
662
|
if (S == null || g !== P.NUMBER || this._previewPattern === null)
|
|
660
663
|
return f;
|
|
661
664
|
const I = $t(this._previewPattern, S, this._sheetsNumfmtCellContentController.locale);
|
|
@@ -677,13 +680,13 @@ let j = class extends te {
|
|
|
677
680
|
return f;
|
|
678
681
|
}
|
|
679
682
|
})
|
|
680
|
-
), (
|
|
683
|
+
), (l = (o = this._renderManagerService.getRenderById(s.getUnitId())) == null ? void 0 : o.mainComponent) == null || l.makeDirty();
|
|
681
684
|
})
|
|
682
685
|
)
|
|
683
686
|
);
|
|
684
687
|
}
|
|
685
688
|
_commandExecutedListener() {
|
|
686
|
-
const t = [
|
|
689
|
+
const t = [ge.id, _e.id];
|
|
687
690
|
this.disposeWithMe(
|
|
688
691
|
new L((r) => {
|
|
689
692
|
const n = this._commandService.onCommandExecuted((i) => {
|
|
@@ -706,11 +709,11 @@ let j = class extends te {
|
|
|
706
709
|
j = Bn([
|
|
707
710
|
M(0, C(Xe)),
|
|
708
711
|
M(1, C(vt)),
|
|
709
|
-
M(2,
|
|
710
|
-
M(3,
|
|
711
|
-
M(4, C(
|
|
712
|
+
M(2, de),
|
|
713
|
+
M(3, he),
|
|
714
|
+
M(4, C(pe)),
|
|
712
715
|
M(5, je),
|
|
713
|
-
M(6,
|
|
716
|
+
M(6, fe),
|
|
714
717
|
M(7, C(qe)),
|
|
715
718
|
M(8, Jt),
|
|
716
719
|
M(9, C(E)),
|
|
@@ -724,7 +727,7 @@ var Vn = Object.getOwnPropertyDescriptor, Wn = (e, t, r, n) => {
|
|
|
724
727
|
const Gn = () => {
|
|
725
728
|
let e = [];
|
|
726
729
|
return {
|
|
727
|
-
add: (i, s, o,
|
|
730
|
+
add: (i, s, o, l, c) => e.push({ unitId: i, subUnitId: s, row: o, col: l, value: c }),
|
|
728
731
|
getEffects: () => e,
|
|
729
732
|
clean: () => {
|
|
730
733
|
e = [];
|
|
@@ -740,7 +743,7 @@ let J = class extends te {
|
|
|
740
743
|
}
|
|
741
744
|
_initInterceptorEditorStart() {
|
|
742
745
|
this._editorBridgeService && this.disposeWithMe(
|
|
743
|
-
|
|
746
|
+
ue(
|
|
744
747
|
this._sheetInterceptorService.writeCellInterceptor.intercept(Gt, {
|
|
745
748
|
handler: (t, r, n) => {
|
|
746
749
|
const i = r.row, s = r.col, o = this._numfmtService.getValue(
|
|
@@ -750,7 +753,7 @@ let J = class extends te {
|
|
|
750
753
|
s
|
|
751
754
|
);
|
|
752
755
|
if (o)
|
|
753
|
-
switch (
|
|
756
|
+
switch (ve(o.pattern)) {
|
|
754
757
|
case "scientific":
|
|
755
758
|
case "currency":
|
|
756
759
|
case "grouped":
|
|
@@ -779,11 +782,11 @@ let J = class extends te {
|
|
|
779
782
|
// eslint-disable-next-line max-lines-per-function
|
|
780
783
|
_initInterceptorEditorEnd() {
|
|
781
784
|
this.disposeWithMe(
|
|
782
|
-
|
|
785
|
+
ue(
|
|
783
786
|
this._sheetInterceptorService.writeCellInterceptor.intercept(Kt, {
|
|
784
787
|
// eslint-disable-next-line complexity
|
|
785
788
|
handler: (t, r, n) => {
|
|
786
|
-
var a, u,
|
|
789
|
+
var a, u, m;
|
|
787
790
|
if (!(t != null && t.v) && !(t != null && t.p))
|
|
788
791
|
return n(t);
|
|
789
792
|
this._collectEffectMutation.clean();
|
|
@@ -795,20 +798,20 @@ let J = class extends te {
|
|
|
795
798
|
), s = r.worksheet.getCellRaw(r.row, r.col);
|
|
796
799
|
if (ke(i == null ? void 0 : i.pattern) || t.t === P.FORCE_STRING)
|
|
797
800
|
return n(t);
|
|
798
|
-
const o = (a = t.p) == null ? void 0 : a.body,
|
|
801
|
+
const o = (a = t.p) == null ? void 0 : a.body, l = (m = (u = t == null ? void 0 : t.p) == null ? void 0 : u.body) != null && m.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), c = gt(l);
|
|
799
802
|
if (o)
|
|
800
803
|
if (Kn(o)) {
|
|
801
|
-
const { dataStream:
|
|
804
|
+
const { dataStream: d } = o, f = d.replace(/\r\n$/, ""), p = Number(f);
|
|
802
805
|
if (Number.isNaN(p) && !c)
|
|
803
806
|
return n(t);
|
|
804
807
|
} else
|
|
805
808
|
return n(t);
|
|
806
809
|
if (c) {
|
|
807
|
-
if (!c.z && !(i != null && i.pattern) && (s == null ? void 0 : s.t) !== P.STRING && (s == null ? void 0 : s.t) !== P.FORCE_STRING && _t(
|
|
810
|
+
if (!c.z && !(i != null && i.pattern) && (s == null ? void 0 : s.t) !== P.STRING && (s == null ? void 0 : s.t) !== P.FORCE_STRING && _t(l))
|
|
808
811
|
return n({
|
|
809
812
|
...t,
|
|
810
813
|
p: void 0,
|
|
811
|
-
v:
|
|
814
|
+
v: l,
|
|
812
815
|
t: P.FORCE_STRING
|
|
813
816
|
});
|
|
814
817
|
c.z && this._collectEffectMutation.add(
|
|
@@ -820,8 +823,8 @@ let J = class extends te {
|
|
|
820
823
|
pattern: c.z
|
|
821
824
|
}
|
|
822
825
|
);
|
|
823
|
-
const
|
|
824
|
-
return n({ ...t, p: void 0, v, t: P.NUMBER });
|
|
826
|
+
const d = Number(c.v);
|
|
827
|
+
return n({ ...t, p: void 0, v: d, t: P.NUMBER });
|
|
825
828
|
}
|
|
826
829
|
return n(t);
|
|
827
830
|
}
|
|
@@ -843,49 +846,49 @@ let J = class extends te {
|
|
|
843
846
|
redos: [],
|
|
844
847
|
undos: []
|
|
845
848
|
};
|
|
846
|
-
const
|
|
847
|
-
if (t._collectEffectMutation.clean(), !
|
|
849
|
+
const l = t._collectEffectMutation.getEffects();
|
|
850
|
+
if (t._collectEffectMutation.clean(), !l.length)
|
|
848
851
|
return {
|
|
849
852
|
redos: [],
|
|
850
853
|
undos: []
|
|
851
854
|
};
|
|
852
|
-
const c =
|
|
855
|
+
const c = l.filter((d) => {
|
|
853
856
|
var f;
|
|
854
|
-
return !!((f =
|
|
855
|
-
}).map((
|
|
856
|
-
row:
|
|
857
|
-
col:
|
|
858
|
-
pattern:
|
|
859
|
-
})), a =
|
|
857
|
+
return !!((f = d.value) != null && f.pattern);
|
|
858
|
+
}).map((d) => ({
|
|
859
|
+
row: d.row,
|
|
860
|
+
col: d.col,
|
|
861
|
+
pattern: d.value.pattern
|
|
862
|
+
})), a = l.filter((d) => {
|
|
860
863
|
var f;
|
|
861
|
-
return !((f =
|
|
862
|
-
}).map((
|
|
863
|
-
startRow:
|
|
864
|
-
endColumn:
|
|
865
|
-
startColumn:
|
|
866
|
-
endRow:
|
|
867
|
-
})), u = [],
|
|
864
|
+
return !((f = d.value) != null && f.pattern);
|
|
865
|
+
}).map((d) => ({
|
|
866
|
+
startRow: d.row,
|
|
867
|
+
endColumn: d.col,
|
|
868
|
+
startColumn: d.col,
|
|
869
|
+
endRow: d.row
|
|
870
|
+
})), u = [], m = [];
|
|
868
871
|
if (c.length) {
|
|
869
|
-
const
|
|
870
|
-
id:
|
|
872
|
+
const d = {
|
|
873
|
+
id: _e.id,
|
|
871
874
|
params: Yt(s, o, c)
|
|
872
875
|
};
|
|
873
|
-
u.push(
|
|
876
|
+
u.push(d), m.push(...zt(t._injector, d.params));
|
|
874
877
|
}
|
|
875
878
|
if (a.length) {
|
|
876
|
-
const
|
|
877
|
-
id:
|
|
879
|
+
const d = {
|
|
880
|
+
id: ge.id,
|
|
878
881
|
params: {
|
|
879
882
|
unitId: s,
|
|
880
883
|
subUnitId: o,
|
|
881
884
|
ranges: a
|
|
882
885
|
}
|
|
883
886
|
};
|
|
884
|
-
u.push(
|
|
887
|
+
u.push(d), m.push(...Xt(t._injector, d.params));
|
|
885
888
|
}
|
|
886
889
|
return {
|
|
887
890
|
redos: u,
|
|
888
|
-
undos:
|
|
891
|
+
undos: m.reverse()
|
|
889
892
|
};
|
|
890
893
|
}
|
|
891
894
|
}
|
|
@@ -903,8 +906,8 @@ let J = class extends te {
|
|
|
903
906
|
};
|
|
904
907
|
J = Wn([
|
|
905
908
|
F(0, C(Xe)),
|
|
906
|
-
F(1, C(
|
|
907
|
-
F(2, C(
|
|
909
|
+
F(1, C(fe)),
|
|
910
|
+
F(2, C(de)),
|
|
908
911
|
F(3, C(He)),
|
|
909
912
|
F(4, pt(jt))
|
|
910
913
|
], J);
|
|
@@ -976,8 +979,8 @@ const it = (e) => [
|
|
|
976
979
|
], Zn = (e) => ({
|
|
977
980
|
icon: new L((t) => {
|
|
978
981
|
const r = e.get(E);
|
|
979
|
-
return t.next(
|
|
980
|
-
t.next(
|
|
982
|
+
return t.next(Me(r.getCurrentLocale()).icon), r.localeChanged$.subscribe(() => {
|
|
983
|
+
t.next(Me(r.getCurrentLocale()).icon);
|
|
981
984
|
});
|
|
982
985
|
}),
|
|
983
986
|
id: ze.id,
|
|
@@ -1011,20 +1014,20 @@ const it = (e) => [
|
|
|
1011
1014
|
hidden$: Y(e, T.UNIVER_SHEET),
|
|
1012
1015
|
disabled$: V(e, { workbookTypes: [Z], worksheetTypes: [K, G], rangeTypes: [W] })
|
|
1013
1016
|
}), qn = (e) => {
|
|
1014
|
-
const t = e.get(
|
|
1017
|
+
const t = e.get(de), r = e.get(he), n = e.get(E), i = e.get(pe), s = [ge.id, _e.id], o = Bt(
|
|
1015
1018
|
t,
|
|
1016
1019
|
"",
|
|
1017
|
-
({ workbook:
|
|
1020
|
+
({ workbook: l, worksheet: c }) => new L(
|
|
1018
1021
|
(a) => Je(
|
|
1019
1022
|
i.selectionMoveEnd$,
|
|
1020
1023
|
St(r.onCommandExecuted.bind(r)).pipe(
|
|
1021
1024
|
sn(([u]) => s.includes(u.id))
|
|
1022
1025
|
)
|
|
1023
1026
|
).subscribe(() => {
|
|
1024
|
-
var
|
|
1027
|
+
var m, d;
|
|
1025
1028
|
const u = i.getCurrentSelections();
|
|
1026
1029
|
if (u && u[0]) {
|
|
1027
|
-
const f = u[0].range, p = f.startRow,
|
|
1030
|
+
const f = u[0].range, p = f.startRow, h = f.startColumn, S = (d = l.getStyles().get((m = c.getCell(p, h)) == null ? void 0 : m.s)) == null ? void 0 : d.n, g = S == null ? void 0 : S.pattern, I = Ot(n.getCurrentLocale());
|
|
1028
1031
|
let w = n.t("sheet.numfmt.general");
|
|
1029
1032
|
if (Ct(g)) {
|
|
1030
1033
|
a.next(w);
|
|
@@ -1062,20 +1065,20 @@ const it = (e) => [
|
|
|
1062
1065
|
};
|
|
1063
1066
|
}, st = "sheet.numfmt.moreNumfmtType", ot = "sheet.numfmt.moreNumfmtType.options", Jn = (e) => {
|
|
1064
1067
|
const { value: t } = e, r = b(E), n = t != null ? t : r.t("sheet.numfmt.general");
|
|
1065
|
-
return /* @__PURE__ */
|
|
1068
|
+
return /* @__PURE__ */ v("span", { className: "univer-text-sm", children: n });
|
|
1066
1069
|
}, Qn = () => {
|
|
1067
|
-
const e = b(
|
|
1070
|
+
const e = b(he), t = b(E), r = b(Qt), n = b(We), i = b(pe), s = (a) => {
|
|
1068
1071
|
const u = i.getCurrentLastSelection();
|
|
1069
1072
|
if (!u)
|
|
1070
1073
|
return;
|
|
1071
|
-
const
|
|
1072
|
-
Ae.foreach(
|
|
1073
|
-
a ?
|
|
1074
|
-
}), e.executeCommand(Ge.id, { values:
|
|
1074
|
+
const m = u.range, d = [];
|
|
1075
|
+
Ae.foreach(m, (f, p) => {
|
|
1076
|
+
a ? d.push({ row: f, col: p, pattern: a, type: ve(a) }) : d.push({ row: f, col: p });
|
|
1077
|
+
}), e.executeCommand(Ge.id, { values: d }), r.focus();
|
|
1075
1078
|
}, o = x(() => {
|
|
1076
1079
|
const a = Ut.get(t.getCurrentLocale());
|
|
1077
1080
|
return it(a);
|
|
1078
|
-
}, [t]),
|
|
1081
|
+
}, [t]), l = (a) => {
|
|
1079
1082
|
if (a === 0)
|
|
1080
1083
|
s(null);
|
|
1081
1084
|
else if (a === o.length - 1)
|
|
@@ -1085,16 +1088,16 @@ const it = (e) => [
|
|
|
1085
1088
|
u.pattern && s(u.pattern);
|
|
1086
1089
|
}
|
|
1087
1090
|
}, c = 1220;
|
|
1088
|
-
return /* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ v("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((a, u) => a === "|" ? /* @__PURE__ */ v(pn, {}, u) : /* @__PURE__ */ y(
|
|
1089
1092
|
"div",
|
|
1090
1093
|
{
|
|
1091
1094
|
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",
|
|
1092
1095
|
onClick: () => {
|
|
1093
|
-
|
|
1096
|
+
l(u);
|
|
1094
1097
|
},
|
|
1095
1098
|
children: [
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ v("span", { children: t.t(a.label) }),
|
|
1100
|
+
/* @__PURE__ */ v("span", { className: "univer-text-xs univer-text-gray-500", children: a.pattern ? kt(a.pattern || "", c, n.locale).result.trim() : "" })
|
|
1098
1101
|
]
|
|
1099
1102
|
},
|
|
1100
1103
|
u
|
|
@@ -1151,14 +1154,14 @@ var rr = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, sr = (e, t
|
|
|
1151
1154
|
for (var i = n > 1 ? void 0 : n ? ir(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
1152
1155
|
(o = e[s]) && (i = o(i) || i);
|
|
1153
1156
|
return i;
|
|
1154
|
-
},
|
|
1157
|
+
}, le = (e, t) => (r, n) => t(r, n, e), ct = (e, t, r) => sr(e, typeof t != "symbol" ? t + "" : t, r);
|
|
1155
1158
|
const cr = "SHEET_NUMFMT_UI_PLUGIN";
|
|
1156
1159
|
let ee = class extends It {
|
|
1157
|
-
constructor(e =
|
|
1160
|
+
constructor(e = Pe, t, r, n) {
|
|
1158
1161
|
super(), this._config = e, this._injector = t, this._configService = r, this._renderManagerService = n;
|
|
1159
1162
|
const { menu: i, ...s } = Nt(
|
|
1160
1163
|
{},
|
|
1161
|
-
|
|
1164
|
+
Pe,
|
|
1162
1165
|
this._config
|
|
1163
1166
|
);
|
|
1164
1167
|
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig("sheets-numfmt-ui.config", s);
|
|
@@ -1180,7 +1183,7 @@ let ee = class extends It {
|
|
|
1180
1183
|
}
|
|
1181
1184
|
_registerRenderModules() {
|
|
1182
1185
|
[
|
|
1183
|
-
[
|
|
1186
|
+
[me]
|
|
1184
1187
|
].forEach((t) => {
|
|
1185
1188
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(T.UNIVER_SHEET, t));
|
|
1186
1189
|
});
|
|
@@ -1190,9 +1193,9 @@ ct(ee, "pluginName", cr);
|
|
|
1190
1193
|
ct(ee, "type", T.UNIVER_SHEET);
|
|
1191
1194
|
ee = or([
|
|
1192
1195
|
bt(Vt, Dt),
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
+
le(1, C(He)),
|
|
1197
|
+
le(2, Ue),
|
|
1198
|
+
le(3, je)
|
|
1196
1199
|
], ee);
|
|
1197
1200
|
export {
|
|
1198
1201
|
ee as UniverSheetsNumfmtUIPlugin
|