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