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