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