@univerjs/sheets-numfmt-ui 0.6.0 → 0.6.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 +364 -357
- package/lib/umd/index.js +1 -1
- package/package.json +15 -15
package/lib/es/index.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
var ut = Object.defineProperty;
|
|
2
|
-
var dt = (e, t,
|
|
3
|
-
var J = (e, t,
|
|
4
|
-
import { Inject as S, LocaleService as M, Disposable as oe, isRealNum as ht, CommandType as
|
|
5
|
-
import { IRenderManagerService as
|
|
6
|
-
import { currencySymbols as
|
|
7
|
-
import { HoverManagerService as Ot, CellAlertManagerService as Ut, CellAlertType as Dt, SheetSkeletonManagerService as
|
|
8
|
-
import { IZenZoneService as Ht, useDependency as C, ComponentManager as
|
|
2
|
+
var dt = (e, t, r) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var J = (e, t, r) => dt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Inject as S, LocaleService as M, Disposable as oe, isRealNum as ht, CommandType as He, ILocalStorageService as xe, numfmt as Q, ThemeService as ft, IUniverInstanceService as Se, ICommandService as ye, UniverInstanceType as T, CellValueType as $, toDisposable as ge, DisposableCollection as pt, InterceptorEffectEnum as Oe, Range as Ae, Injector as je, Optional as vt, DependentOn as gt, IConfigService as _t, Plugin as St, merge as yt, registerDependencies as bt, touchDependencies as Ct } from "@univerjs/core";
|
|
5
|
+
import { IRenderManagerService as Be } from "@univerjs/engine-render";
|
|
6
|
+
import { currencySymbols as Ue, getDecimalFromPattern as te, getCurrencyType as W, setPatternDecimal as R, getCurrencyFormatOptions as ue, isPatternEqualWithoutDecimal as ce, CURRENCYFORMAT as It, DATEFMTLISG as Nt, NUMBERFORMAT as Et, getDateFormatOptions as We, getNumberFormatOptions as Ve, isPatternHasDecimal as Tt, SheetsNumfmtCellContentController as Ge, getPatternPreviewIgnoreGeneral as Mt, getPatternType as ne, SetNumfmtCommand as Ke, SetPercentCommand as Ze, SubtractDecimalCommand as ze, AddDecimalCommand as Ye, SetCurrencyCommand as Xe, MenuCurrencyService as Pt, countryCurrencyMap as k, getPatternPreview as wt, UniverSheetsNumfmtPlugin as Rt } from "@univerjs/sheets-numfmt";
|
|
7
|
+
import { HoverManagerService as Ot, CellAlertManagerService as Ut, CellAlertType as Dt, SheetSkeletonManagerService as kt, IEditorBridgeService as Ft, deriveStateFromActiveSheet$ as $t, getCurrentRangeDisable$ as V, UniverSheetsUIPlugin as Lt } from "@univerjs/sheets-ui";
|
|
8
|
+
import { IZenZoneService as Ht, useDependency as C, ComponentManager as qe, ISidebarService as xt, getMenuHiddenObservable as G, MenuItemType as K, ILayoutService as At, RibbonStartGroup as jt, IMenuManagerService as Bt, UI_PLUGIN_CONFIG_KEY as Wt } from "@univerjs/ui";
|
|
9
9
|
import { FormulaDataModel as Vt } from "@univerjs/engine-formula";
|
|
10
|
-
import {
|
|
11
|
-
import { INumfmtService as
|
|
12
|
-
import { debounceTime as
|
|
13
|
-
import { map as
|
|
14
|
-
import { jsxs as
|
|
15
|
-
import { createContext as
|
|
16
|
-
import { InputNumber as
|
|
10
|
+
import { isTextFormat as Je, isDefaultFormat as Gt, DEFAULT_TEXT_FORMAT_EXCEL as Kt } from "@univerjs/engine-numfmt";
|
|
11
|
+
import { INumfmtService as be, SheetInterceptorService as Qe, SheetsSelectionsService as Ce, INTERCEPTOR_POINT as Zt, RemoveNumfmtMutation as Ie, SetNumfmtMutation as Ne, BEFORE_CELL_EDIT as zt, AFTER_CELL_EDIT as Yt, SetRangeValuesCommand as Xt, transformCellsToRange as qt, factorySetNumfmtUndoMutation as Jt, factoryRemoveNumfmtUndoMutation as Qt, RangeProtectionPermissionEditPoint as Z, WorksheetSetCellStylePermission as z, WorksheetEditPermission as Y, WorkbookEditablePermission as X } from "@univerjs/sheets";
|
|
12
|
+
import { debounceTime as en, merge as et, Observable as L, combineLatest as tn } from "rxjs";
|
|
13
|
+
import { map as nn, switchMap as rn, tap as sn, debounceTime as on } from "rxjs/operators";
|
|
14
|
+
import { jsxs as b, jsx as u } from "react/jsx-runtime";
|
|
15
|
+
import { createContext as cn, useState as I, useEffect as ae, useRef as Ee, useContext as tt, useMemo as O, forwardRef as nt, createElement as Te } from "react";
|
|
16
|
+
import { InputNumber as Me, Select as Pe, SelectList as we, Input as an, Button as De } from "@univerjs/design";
|
|
17
17
|
const ke = {};
|
|
18
|
-
var
|
|
19
|
-
for (var i =
|
|
18
|
+
var ln = Object.getOwnPropertyDescriptor, mn = (e, t, r, n) => {
|
|
19
|
+
for (var i = n > 1 ? void 0 : n ? ln(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
20
20
|
(o = e[s]) && (i = o(i) || i);
|
|
21
21
|
return i;
|
|
22
|
-
},
|
|
22
|
+
}, F = (e, t) => (r, n) => t(r, n, e);
|
|
23
23
|
const de = "SHEET_NUMFMT_ALERT";
|
|
24
24
|
let _e = class extends oe {
|
|
25
|
-
constructor(e, t,
|
|
26
|
-
super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService =
|
|
25
|
+
constructor(e, t, r, n, i, s, o) {
|
|
26
|
+
super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = r, this._localeService = n, this._formulaDataModel = i, this._zenZoneService = s, this._numfmtService = o, this._init();
|
|
27
27
|
}
|
|
28
28
|
_init() {
|
|
29
29
|
this._initCellAlertPopup(), this._initZenService();
|
|
30
30
|
}
|
|
31
31
|
_initCellAlertPopup() {
|
|
32
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
|
32
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(en(100)).subscribe((e) => {
|
|
33
33
|
var t;
|
|
34
34
|
if (e) {
|
|
35
|
-
const
|
|
35
|
+
const r = e.location, n = this._context.unit, i = n.getActiveSheet();
|
|
36
36
|
if (!i) return;
|
|
37
|
-
const s =
|
|
37
|
+
const s = r.unitId, o = r.subUnitId;
|
|
38
38
|
let a;
|
|
39
|
-
const c = i.getCell(
|
|
39
|
+
const c = i.getCell(r.row, r.col);
|
|
40
40
|
if (c != null && c.s) {
|
|
41
|
-
const l =
|
|
41
|
+
const l = n.getStyles().get(c.s);
|
|
42
42
|
l != null && l.n && (a = l.n);
|
|
43
43
|
}
|
|
44
|
-
if (a || (a = this._numfmtService.getValue(s, o,
|
|
44
|
+
if (a || (a = this._numfmtService.getValue(s, o, r.row, r.col)), !a) {
|
|
45
45
|
this._hideAlert();
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (a.pattern
|
|
48
|
+
if (Je(a.pattern) && (c != null && c.v) && ht(c.v)) {
|
|
49
49
|
const l = this._cellAlertManagerService.currentAlert.get(de), f = (t = l == null ? void 0 : l.alert) == null ? void 0 : t.location;
|
|
50
|
-
if (f && f.row ===
|
|
50
|
+
if (f && f.row === r.row && f.col === r.col && f.subUnitId === r.subUnitId && f.unitId === r.unitId)
|
|
51
51
|
return;
|
|
52
52
|
this._cellAlertManagerService.showAlert({
|
|
53
53
|
type: Dt.ERROR,
|
|
54
54
|
title: this._localeService.t("info.error"),
|
|
55
55
|
message: this._localeService.t("info.forceStringInfo"),
|
|
56
|
-
location:
|
|
56
|
+
location: r,
|
|
57
57
|
width: 200,
|
|
58
58
|
height: 74,
|
|
59
59
|
key: de
|
|
@@ -73,32 +73,32 @@ let _e = class extends oe {
|
|
|
73
73
|
this._cellAlertManagerService.removeAlert(de);
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
_e =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
_e = mn([
|
|
77
|
+
F(1, S(Ot)),
|
|
78
|
+
F(2, S(Ut)),
|
|
79
|
+
F(3, S(M)),
|
|
80
|
+
F(4, S(Vt)),
|
|
81
|
+
F(5, Ht),
|
|
82
|
+
F(6, S(be))
|
|
83
83
|
], _e);
|
|
84
84
|
const he = {
|
|
85
85
|
id: "sheet.operation.close.numfmt.panel",
|
|
86
|
-
type:
|
|
86
|
+
type: He.OPERATION,
|
|
87
87
|
handler: () => (
|
|
88
88
|
// do nothing, just notify panel is closed
|
|
89
89
|
!0
|
|
90
90
|
)
|
|
91
|
-
},
|
|
91
|
+
}, A = {
|
|
92
92
|
id: "sheet.operation.open.numfmt.panel",
|
|
93
|
-
type:
|
|
93
|
+
type: He.OPERATION,
|
|
94
94
|
handler: (e) => (e.get(B).openPanel(), !0)
|
|
95
95
|
};
|
|
96
|
-
var
|
|
97
|
-
for (var i =
|
|
96
|
+
var un = Object.getOwnPropertyDescriptor, dn = (e, t, r, n) => {
|
|
97
|
+
for (var i = n > 1 ? void 0 : n ? un(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
98
98
|
(o = e[s]) && (i = o(i) || i);
|
|
99
99
|
return i;
|
|
100
|
-
},
|
|
101
|
-
const
|
|
100
|
+
}, hn = (e, t) => (r, n) => t(r, n, e);
|
|
101
|
+
const Re = cn([]);
|
|
102
102
|
let j = class {
|
|
103
103
|
constructor(e) {
|
|
104
104
|
this._localStorageService = e;
|
|
@@ -107,24 +107,24 @@ let j = class {
|
|
|
107
107
|
return `userHabitController_${e}`;
|
|
108
108
|
}
|
|
109
109
|
async addHabit(e, t) {
|
|
110
|
-
const
|
|
111
|
-
return this._localStorageService.getItem(
|
|
112
|
-
|
|
110
|
+
const r = this._getKey(e);
|
|
111
|
+
return this._localStorageService.getItem(r).then((n) => {
|
|
112
|
+
n || this._localStorageService.setItem(r, t);
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
markHabit(e, t) {
|
|
116
|
-
const
|
|
117
|
-
this._localStorageService.getItem(
|
|
118
|
-
if (
|
|
119
|
-
const i =
|
|
120
|
-
i > -1 &&
|
|
116
|
+
const r = this._getKey(e);
|
|
117
|
+
this._localStorageService.getItem(r).then((n) => {
|
|
118
|
+
if (n) {
|
|
119
|
+
const i = n.findIndex((s) => s === t);
|
|
120
|
+
i > -1 && n.splice(i, 1), n.unshift(t), this._localStorageService.setItem(r, n);
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
async getHabit(e, t) {
|
|
125
|
-
const
|
|
126
|
-
if (t &&
|
|
127
|
-
const i =
|
|
125
|
+
const r = this._getKey(e), n = await this._localStorageService.getItem(r);
|
|
126
|
+
if (t && n) {
|
|
127
|
+
const i = n.map((s, o, a) => {
|
|
128
128
|
const c = a.length;
|
|
129
129
|
return {
|
|
130
130
|
value: s,
|
|
@@ -137,153 +137,156 @@ let j = class {
|
|
|
137
137
|
return (((f = i.find((m) => m.value === o)) == null ? void 0 : f.priority) || -1) - a;
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return n || [];
|
|
141
141
|
}
|
|
142
142
|
deleteHabit(e) {
|
|
143
143
|
this._localStorageService.removeItem(e);
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
|
-
j =
|
|
147
|
-
|
|
146
|
+
j = dn([
|
|
147
|
+
hn(0, S(xe))
|
|
148
148
|
], j);
|
|
149
|
-
const Fe = "numfmtCurrency",
|
|
150
|
-
const t = C(j), [
|
|
149
|
+
const Fe = "numfmtCurrency", fn = (e) => {
|
|
150
|
+
const t = C(j), [r, n] = I(Ue);
|
|
151
151
|
return ae(() => {
|
|
152
152
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
153
|
-
t.getHabit(Fe, [...
|
|
154
|
-
|
|
153
|
+
t.getHabit(Fe, [...Ue]).then((s) => {
|
|
154
|
+
n(s), e && e(s);
|
|
155
155
|
});
|
|
156
156
|
});
|
|
157
|
-
}, []), { userHabitCurrency:
|
|
157
|
+
}, []), { userHabitCurrency: r, mark: (s) => {
|
|
158
158
|
t.markHabit(Fe, s);
|
|
159
159
|
} };
|
|
160
|
-
},
|
|
161
|
-
const e =
|
|
160
|
+
}, pn = () => {
|
|
161
|
+
const e = Ee([]), [t, r] = I({});
|
|
162
162
|
return ae(() => {
|
|
163
163
|
e.current.forEach((i) => {
|
|
164
164
|
i();
|
|
165
165
|
}), e.current = [];
|
|
166
166
|
}, [t]), (i) => {
|
|
167
|
-
e.current.push(i),
|
|
167
|
+
e.current.push(i), r({});
|
|
168
168
|
};
|
|
169
|
-
},
|
|
170
|
-
const { defaultPattern: t, action:
|
|
171
|
-
|
|
169
|
+
}, vn = (e) => !!W(e) && e.startsWith("_("), gn = (e) => {
|
|
170
|
+
const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = I(() => te(t || "", 2)), o = tt(Re), [a, c] = I(() => W(t) || o[0]), l = O(() => o.map((v) => ({ label: v, value: v })), []), m = C(M).t;
|
|
171
|
+
r.current = () => R(`_("${a}"* #,##0${i > 0 ? ".0" : ""}_)`, i);
|
|
172
172
|
const d = (v) => {
|
|
173
|
-
c(v),
|
|
173
|
+
c(v), n(R(`_("${v}"* #,##0${i > 0 ? ".0" : ""}_)`, i));
|
|
174
174
|
}, p = (v) => {
|
|
175
175
|
const h = v || 0;
|
|
176
|
-
s(h),
|
|
176
|
+
s(h), n(R(`_("${a}"* #,##0${h > 0 ? ".0" : ""}_)`, h));
|
|
177
177
|
};
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ b("div", { children: [
|
|
179
|
+
/* @__PURE__ */ b("div", { className: "m-t-16 options", children: [
|
|
180
|
+
/* @__PURE__ */ b("div", { className: "option", children: [
|
|
181
181
|
/* @__PURE__ */ u("div", { className: "label", children: m("sheet.numfmt.decimalLength") }),
|
|
182
|
-
/* @__PURE__ */ u("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ u(
|
|
182
|
+
/* @__PURE__ */ u("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ u(Me, { value: i, max: 20, min: 0, onChange: p }) })
|
|
183
183
|
] }),
|
|
184
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ b("div", { className: "option", children: [
|
|
185
185
|
/* @__PURE__ */ u("div", { className: "label", children: m("sheet.numfmt.currencyType") }),
|
|
186
|
-
/* @__PURE__ */ u("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ u(
|
|
186
|
+
/* @__PURE__ */ u("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ u(Pe, { onChange: d, options: l, value: a }) })
|
|
187
187
|
] })
|
|
188
188
|
] }),
|
|
189
189
|
/* @__PURE__ */ u("div", { className: "describe m-t-14", children: m("sheet.numfmt.accountingDes") })
|
|
190
190
|
] });
|
|
191
|
-
},
|
|
192
|
-
const
|
|
191
|
+
}, _n = (e) => !!W(e) && !e.startsWith("_("), Sn = (e) => {
|
|
192
|
+
const r = C(M).t, n = tt(Re), [i, s] = I(() => W(e.defaultPattern) || n[0]), [o, a] = I(() => te(e.defaultPattern || "", 2)), [c, l] = I(() => {
|
|
193
193
|
var g;
|
|
194
194
|
const h = ue(i);
|
|
195
195
|
return ((g = h.find((N) => ce(N.value, e.defaultPattern))) == null ? void 0 : g.value) || h[0].value;
|
|
196
|
-
}), f = O(() => ue(i), [i]), m = O(() =>
|
|
196
|
+
}), f = O(() => ue(i), [i]), m = O(() => n.map((h) => ({ label: h, value: h })), [n]);
|
|
197
197
|
e.action.current = () => R(c, o);
|
|
198
198
|
const d = (h) => {
|
|
199
199
|
if (h === void 0)
|
|
200
200
|
return;
|
|
201
201
|
s(h);
|
|
202
|
-
const
|
|
203
|
-
l(
|
|
202
|
+
const y = ue(h)[0].value;
|
|
203
|
+
l(y), e.onChange(R(y, o));
|
|
204
204
|
}, p = (h) => {
|
|
205
205
|
h !== void 0 && (l(h), e.onChange(R(h, o)));
|
|
206
206
|
}, v = (h) => {
|
|
207
207
|
a(h || 0), e.onChange(R(c, h || 0));
|
|
208
208
|
};
|
|
209
|
-
return /* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */ u("div", { className: "label", children:
|
|
213
|
-
/* @__PURE__ */ u("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ u(
|
|
209
|
+
return /* @__PURE__ */ b("div", { children: [
|
|
210
|
+
/* @__PURE__ */ b("div", { className: "m-t-16 options", children: [
|
|
211
|
+
/* @__PURE__ */ b("div", { className: "option", children: [
|
|
212
|
+
/* @__PURE__ */ u("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
|
|
213
|
+
/* @__PURE__ */ u("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ u(Me, { value: o, max: 20, min: 0, onChange: v }) })
|
|
214
214
|
] }),
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */ u("div", { className: "label", children:
|
|
217
|
-
/* @__PURE__ */ u("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ u(
|
|
215
|
+
/* @__PURE__ */ b("div", { className: "option", children: [
|
|
216
|
+
/* @__PURE__ */ u("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
|
|
217
|
+
/* @__PURE__ */ u("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ u(Pe, { onChange: d, options: m, value: i }) })
|
|
218
218
|
] })
|
|
219
219
|
] }),
|
|
220
|
-
/* @__PURE__ */ u("div", { className: "m-t-16 label", children:
|
|
221
|
-
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(
|
|
222
|
-
/* @__PURE__ */ u("div", { className: "describe m-t-14", children:
|
|
220
|
+
/* @__PURE__ */ u("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
|
|
221
|
+
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(we, { onChange: p, options: f, value: c }) }),
|
|
222
|
+
/* @__PURE__ */ u("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
|
|
223
223
|
] });
|
|
224
224
|
};
|
|
225
225
|
var E = function() {
|
|
226
226
|
return E = Object.assign || function(e) {
|
|
227
|
-
for (var t,
|
|
228
|
-
t = arguments[
|
|
227
|
+
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
228
|
+
t = arguments[r];
|
|
229
229
|
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
230
230
|
}
|
|
231
231
|
return e;
|
|
232
232
|
}, E.apply(this, arguments);
|
|
233
|
-
},
|
|
234
|
-
var
|
|
235
|
-
for (var
|
|
233
|
+
}, yn = function(e, t) {
|
|
234
|
+
var r = {};
|
|
235
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
236
236
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
237
|
-
for (var i = 0,
|
|
238
|
-
t.indexOf(
|
|
239
|
-
return
|
|
237
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
238
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
|
239
|
+
return r;
|
|
240
240
|
}, rt = nt(function(e, t) {
|
|
241
|
-
var
|
|
242
|
-
return it(
|
|
241
|
+
var r = e.icon, n = e.id, i = e.className, s = e.extend, o = yn(e, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), c = Ee("_".concat(In()));
|
|
242
|
+
return it(r, "".concat(n), { defIds: r.defIds, idSuffix: c.current }, E({ ref: t, className: a }, o), s);
|
|
243
243
|
});
|
|
244
|
-
function it(e, t,
|
|
245
|
-
return
|
|
246
|
-
return it(s, "".concat(t, "-").concat(e.tag, "-").concat(o),
|
|
244
|
+
function it(e, t, r, n, i) {
|
|
245
|
+
return Te(e.tag, E(E({ key: t }, bn(e, r, i)), n), (Cn(e, r).children || []).map(function(s, o) {
|
|
246
|
+
return it(s, "".concat(t, "-").concat(e.tag, "-").concat(o), r, void 0, i);
|
|
247
247
|
}));
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
var
|
|
251
|
-
|
|
249
|
+
function bn(e, t, r) {
|
|
250
|
+
var n = E({}, e.attrs);
|
|
251
|
+
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) {
|
|
252
|
+
var o = s[0], a = s[1];
|
|
253
|
+
o === "mask" && typeof a == "string" && (n[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
254
|
+
});
|
|
252
255
|
var i = t.defIds;
|
|
253
|
-
return !i || i.length === 0 || (e.tag === "use" &&
|
|
256
|
+
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) {
|
|
254
257
|
var o = s[0], a = s[1];
|
|
255
|
-
typeof a == "string" && (
|
|
256
|
-
})),
|
|
258
|
+
typeof a == "string" && (n[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
259
|
+
})), n;
|
|
257
260
|
}
|
|
258
|
-
function
|
|
259
|
-
var
|
|
260
|
-
return !
|
|
261
|
-
return typeof i.attrs.id == "string" &&
|
|
261
|
+
function Cn(e, t) {
|
|
262
|
+
var r, n = t.defIds;
|
|
263
|
+
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) {
|
|
264
|
+
return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? E(E({}, i), { attrs: E(E({}, i.attrs), { id: i.attrs.id + t.idSuffix }) }) : i;
|
|
262
265
|
}) }) : e;
|
|
263
266
|
}
|
|
264
|
-
function
|
|
267
|
+
function In() {
|
|
265
268
|
return Math.random().toString(36).substring(2, 8);
|
|
266
269
|
}
|
|
267
270
|
rt.displayName = "UniverIcon";
|
|
268
|
-
var
|
|
269
|
-
return
|
|
271
|
+
var Nn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, st = nt(function(e, t) {
|
|
272
|
+
return Te(rt, Object.assign({}, e, {
|
|
270
273
|
id: "check-mark-single",
|
|
271
274
|
ref: t,
|
|
272
|
-
icon:
|
|
275
|
+
icon: Nn
|
|
273
276
|
}));
|
|
274
277
|
});
|
|
275
278
|
st.displayName = "CheckMarkSingle";
|
|
276
|
-
const
|
|
277
|
-
customFormatTitle:
|
|
278
|
-
customFormatInput:
|
|
279
|
-
customFormatHistoryList:
|
|
280
|
-
customFormatHistoryListItem:
|
|
281
|
-
customFormatHistoryListItemIconWrap:
|
|
282
|
-
customFormatDes:
|
|
279
|
+
const En = "univer-custom-format-title", Tn = "univer-custom-format-input", Mn = "univer-custom-format-history-list", Pn = "univer-custom-format-history-list-item", wn = "univer-custom-format-history-list-item-icon-wrap", Rn = "univer-custom-format-des", U = {
|
|
280
|
+
customFormatTitle: En,
|
|
281
|
+
customFormatInput: Tn,
|
|
282
|
+
customFormatHistoryList: Mn,
|
|
283
|
+
customFormatHistoryListItem: Pn,
|
|
284
|
+
customFormatHistoryListItemIconWrap: wn,
|
|
285
|
+
customFormatDes: Rn
|
|
283
286
|
}, fe = "customFormat", pe = "numfmt_custom_pattern";
|
|
284
|
-
function
|
|
285
|
-
const { defaultPattern: t, action:
|
|
286
|
-
|
|
287
|
+
function On(e) {
|
|
288
|
+
const { defaultPattern: t, action: r, onChange: n } = e, i = C(j), s = C(xe), o = C(M), [a, c] = I(t);
|
|
289
|
+
r.current = () => (i.markHabit(fe, a), s.getItem(pe).then((p = []) => {
|
|
287
290
|
const v = [.../* @__PURE__ */ new Set([a, ...p || []])].splice(0, 10).filter((h) => !!h);
|
|
288
291
|
s.setItem(pe, v);
|
|
289
292
|
}), a);
|
|
@@ -303,25 +306,25 @@ function wn(e) {
|
|
|
303
306
|
});
|
|
304
307
|
}, []);
|
|
305
308
|
const m = (p) => {
|
|
306
|
-
c(p),
|
|
309
|
+
c(p), n(p);
|
|
307
310
|
}, d = () => {
|
|
308
|
-
|
|
311
|
+
n(a);
|
|
309
312
|
};
|
|
310
|
-
return /* @__PURE__ */
|
|
313
|
+
return /* @__PURE__ */ b("div", { className: U.customFormat, children: [
|
|
311
314
|
/* @__PURE__ */ u("div", { className: U.customFormatTitle, children: o.t("sheet.numfmt.customFormat") }),
|
|
312
|
-
/* @__PURE__ */ u(
|
|
313
|
-
/* @__PURE__ */ u("div", { className: U.customFormatHistoryList, children: l.map((p) => /* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ u(an, { placeholder: o.t("sheet.numfmt.customFormat"), onBlur: d, value: a, onChange: c, className: U.customFormatInput }),
|
|
316
|
+
/* @__PURE__ */ u("div", { className: U.customFormatHistoryList, children: l.map((p) => /* @__PURE__ */ b("div", { onClick: () => m(p), className: U.customFormatHistoryListItem, children: [
|
|
314
317
|
/* @__PURE__ */ u("div", { className: U.customFormatHistoryListItemIconWrap, children: a === p && /* @__PURE__ */ u(st, {}) }),
|
|
315
318
|
/* @__PURE__ */ u("div", { children: p })
|
|
316
319
|
] }, p)) }),
|
|
317
320
|
/* @__PURE__ */ u("div", { className: U.customFormatDes, children: o.t("sheet.numfmt.customFormatDes") })
|
|
318
321
|
] });
|
|
319
322
|
}
|
|
320
|
-
const
|
|
323
|
+
const Un = (e) => {
|
|
321
324
|
const t = Q.getInfo(e);
|
|
322
|
-
return
|
|
323
|
-
},
|
|
324
|
-
const t = O(
|
|
325
|
+
return We().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
326
|
+
}, Dn = (e) => {
|
|
327
|
+
const t = O(We, []), n = C(M).t, [i, s] = I(() => {
|
|
325
328
|
if (e.defaultPattern) {
|
|
326
329
|
const a = t.find((c) => c.value === e.defaultPattern);
|
|
327
330
|
if (a)
|
|
@@ -333,66 +336,66 @@ const Rn = (e) => {
|
|
|
333
336
|
const o = (a) => {
|
|
334
337
|
a !== void 0 && (s(a), e.onChange(a));
|
|
335
338
|
};
|
|
336
|
-
return /* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */ u("div", { className: "m-t-16 label", children:
|
|
338
|
-
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(
|
|
339
|
-
/* @__PURE__ */ u("div", { className: "describe m-t-14", children:
|
|
339
|
+
return /* @__PURE__ */ b("div", { children: [
|
|
340
|
+
/* @__PURE__ */ u("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
|
|
341
|
+
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(we, { value: i, options: t, onChange: o }) }),
|
|
342
|
+
/* @__PURE__ */ u("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
|
|
340
343
|
] });
|
|
341
|
-
},
|
|
342
|
-
const
|
|
343
|
-
return e.action.current = () => "", /* @__PURE__ */ u("div", { children: /* @__PURE__ */ u("div", { className: "describe m-t-14", children:
|
|
344
|
-
}, $n = (e) =>
|
|
345
|
-
const t = C(M),
|
|
346
|
-
const m =
|
|
347
|
-
return (m == null ? void 0 : m.value) ||
|
|
348
|
-
}), a = O(() => R(s, Number(
|
|
344
|
+
}, kn = (e) => !e, Fn = (e) => {
|
|
345
|
+
const r = C(M).t;
|
|
346
|
+
return e.action.current = () => "", /* @__PURE__ */ u("div", { children: /* @__PURE__ */ u("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
|
|
347
|
+
}, $n = (e) => Ve().some((t) => ce(t.value, e)), Ln = (e) => {
|
|
348
|
+
const t = C(M), r = O(Ve, []), [n, i] = I(() => te(e.defaultPattern || "", 0)), [s, o] = I(() => {
|
|
349
|
+
const m = r.find((d) => ce(d.value, e.defaultPattern || ""));
|
|
350
|
+
return (m == null ? void 0 : m.value) || r[0].value;
|
|
351
|
+
}), a = O(() => R(s, Number(n || 0)), [s, n]), c = O(() => !Tt(s), [s]), l = (m) => {
|
|
349
352
|
i(m || 0), e.onChange(R(s, Number(m || 0)));
|
|
350
353
|
}, f = (m) => {
|
|
351
354
|
m !== void 0 && (i(te(m, 0)), o(m), e.onChange(m));
|
|
352
355
|
};
|
|
353
|
-
return e.action.current = () => a, /* @__PURE__ */
|
|
356
|
+
return e.action.current = () => a, /* @__PURE__ */ b("div", { children: [
|
|
354
357
|
/* @__PURE__ */ u("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
|
|
355
358
|
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(
|
|
356
|
-
|
|
359
|
+
Me,
|
|
357
360
|
{
|
|
358
361
|
disabled: c,
|
|
359
|
-
value:
|
|
362
|
+
value: n,
|
|
360
363
|
max: 20,
|
|
361
364
|
min: 0,
|
|
362
365
|
onChange: l
|
|
363
366
|
}
|
|
364
367
|
) }),
|
|
365
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ b("div", { className: "m-t-16 label", children: [
|
|
366
369
|
" ",
|
|
367
370
|
t.t("sheet.numfmt.negType")
|
|
368
371
|
] }),
|
|
369
|
-
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(
|
|
372
|
+
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(we, { onChange: f, options: r, value: s }) }),
|
|
370
373
|
/* @__PURE__ */ u("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
|
|
371
374
|
] });
|
|
372
|
-
},
|
|
373
|
-
const { defaultValue: t, defaultPattern:
|
|
375
|
+
}, Hn = (e) => {
|
|
376
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = C(M), o = Ee(() => ""), a = s.t, c = pn(), l = O(
|
|
374
377
|
() => [
|
|
375
|
-
{ label: "sheet.numfmt.general", component:
|
|
376
|
-
{ label: "sheet.numfmt.accounting", component:
|
|
377
|
-
{ label: "sheet.numfmt.currency", component:
|
|
378
|
-
{ label: "sheet.numfmt.date", component:
|
|
379
|
-
{ label: "sheet.numfmt.thousandthPercentile", component:
|
|
380
|
-
{ label: "sheet.numfmt.customFormat", component:
|
|
378
|
+
{ label: "sheet.numfmt.general", component: Fn },
|
|
379
|
+
{ label: "sheet.numfmt.accounting", component: gn },
|
|
380
|
+
{ label: "sheet.numfmt.currency", component: Sn },
|
|
381
|
+
{ label: "sheet.numfmt.date", component: Dn },
|
|
382
|
+
{ label: "sheet.numfmt.thousandthPercentile", component: Ln },
|
|
383
|
+
{ label: "sheet.numfmt.customFormat", component: On }
|
|
381
384
|
].map((_) => ({ ..._, label: a(_.label) })),
|
|
382
385
|
[]
|
|
383
|
-
), [f, m] = I(g), [d, p] = I(() => `${
|
|
386
|
+
), [f, m] = I(g), [d, p] = I(() => `${n}_${i}`), { mark: v, userHabitCurrency: h } = fn(() => p(`${n}_${i}_userCurrency'`)), y = O(() => {
|
|
384
387
|
var _;
|
|
385
388
|
return (_ = l.find((D) => D.label === f)) == null ? void 0 : _.component;
|
|
386
389
|
}, [f]);
|
|
387
390
|
function g() {
|
|
388
|
-
return [
|
|
391
|
+
return [kn, vn, _n, Un, $n].reduce((D, lt, mt) => D || (lt(r) ? l[mt].label : ""), "") || l[0].label;
|
|
389
392
|
}
|
|
390
393
|
const N = l.map((_) => ({
|
|
391
394
|
label: _.label,
|
|
392
395
|
value: _.label
|
|
393
396
|
})), w = (_) => {
|
|
394
397
|
m(_), c(() => e.onChange({ type: "change", value: o.current() || "" }));
|
|
395
|
-
},
|
|
398
|
+
}, q = (_) => {
|
|
396
399
|
e.onChange({ type: "change", value: _ });
|
|
397
400
|
}, le = () => {
|
|
398
401
|
const _ = o.current() || "", D = W(_);
|
|
@@ -400,33 +403,33 @@ const Rn = (e) => {
|
|
|
400
403
|
}, H = () => {
|
|
401
404
|
e.onChange({ type: "cancel", value: "" });
|
|
402
405
|
}, me = {
|
|
403
|
-
onChange:
|
|
406
|
+
onChange: q,
|
|
404
407
|
defaultValue: t,
|
|
405
|
-
defaultPattern:
|
|
408
|
+
defaultPattern: r,
|
|
406
409
|
action: o
|
|
407
410
|
};
|
|
408
411
|
return ae(() => {
|
|
409
|
-
m(g()), p(`${
|
|
410
|
-
}, [
|
|
411
|
-
/* @__PURE__ */
|
|
412
|
+
m(g()), p(`${n}_${i}`);
|
|
413
|
+
}, [n, i]), /* @__PURE__ */ b("div", { className: "numfmt-panel p-b-20", children: [
|
|
414
|
+
/* @__PURE__ */ b("div", { children: [
|
|
412
415
|
/* @__PURE__ */ u("div", { className: "label m-t-14", children: a("sheet.numfmt.numfmtType") }),
|
|
413
|
-
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(
|
|
414
|
-
/* @__PURE__ */ u("div", { children:
|
|
416
|
+
/* @__PURE__ */ u("div", { className: "m-t-8", children: /* @__PURE__ */ u(Pe, { onChange: w, options: N, value: f, style: { width: "100%" } }) }),
|
|
417
|
+
/* @__PURE__ */ u("div", { children: y && /* @__PURE__ */ u(Re.Provider, { value: h, children: /* @__PURE__ */ Te(y, { ...me, key: d }) }) })
|
|
415
418
|
] }),
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */ u(
|
|
418
|
-
/* @__PURE__ */ u(
|
|
419
|
+
/* @__PURE__ */ b("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
420
|
+
/* @__PURE__ */ u(De, { size: "small", onClick: H, className: "m-r-12", children: a("sheet.numfmt.cancel") }),
|
|
421
|
+
/* @__PURE__ */ u(De, { type: "primary", size: "small", onClick: le, children: a("sheet.numfmt.confirm") })
|
|
419
422
|
] })
|
|
420
423
|
] });
|
|
421
424
|
};
|
|
422
|
-
var
|
|
423
|
-
for (var i =
|
|
425
|
+
var xn = Object.getOwnPropertyDescriptor, An = (e, t, r, n) => {
|
|
426
|
+
for (var i = n > 1 ? void 0 : n ? xn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
424
427
|
(o = e[s]) && (i = o(i) || i);
|
|
425
428
|
return i;
|
|
426
|
-
}, P = (e, t) => (
|
|
427
|
-
const
|
|
429
|
+
}, P = (e, t) => (r, n) => t(r, n, e);
|
|
430
|
+
const $e = "SHEET_NUMFMT_PANEL";
|
|
428
431
|
let B = class extends oe {
|
|
429
|
-
constructor(t,
|
|
432
|
+
constructor(t, r, n, i, s, o, a, c, l, f, m) {
|
|
430
433
|
super();
|
|
431
434
|
/**
|
|
432
435
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -436,7 +439,7 @@ let B = class extends oe {
|
|
|
436
439
|
*/
|
|
437
440
|
J(this, "_previewPattern", "");
|
|
438
441
|
J(this, "_sidebarDisposable", null);
|
|
439
|
-
this._sheetInterceptorService = t, this._themeService =
|
|
442
|
+
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 = l, this._localeService = f, this._sheetsNumfmtCellContentController = m, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
|
|
440
443
|
}
|
|
441
444
|
_initNumfmtLocalChange() {
|
|
442
445
|
this.disposeWithMe(et(this._sheetsNumfmtCellContentController.local$, this._localeService.currentLocale$).subscribe(() => {
|
|
@@ -444,8 +447,8 @@ let B = class extends oe {
|
|
|
444
447
|
}));
|
|
445
448
|
}
|
|
446
449
|
openPanel() {
|
|
447
|
-
var
|
|
448
|
-
const t = this._sidebarService,
|
|
450
|
+
var y;
|
|
451
|
+
const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, i = this._univerInstanceService, s = this._numfmtService, o = this._localeService, c = (((y = r.getCurrentSelections()) == null ? void 0 : y.map((g) => g.range)) || [])[0];
|
|
449
452
|
if (!c)
|
|
450
453
|
return !1;
|
|
451
454
|
const l = i.getCurrentUnitForType(T.UNIVER_SHEET), f = l.getActiveSheet();
|
|
@@ -459,23 +462,23 @@ let B = class extends oe {
|
|
|
459
462
|
);
|
|
460
463
|
let p = "";
|
|
461
464
|
d && (p = d.pattern);
|
|
462
|
-
const v = (m == null ? void 0 : m.t) ===
|
|
465
|
+
const v = (m == null ? void 0 : m.t) === $.NUMBER ? m.v : 12345678, h = {
|
|
463
466
|
onChange: (g) => {
|
|
464
467
|
var N;
|
|
465
468
|
if (g.type === "change")
|
|
466
469
|
this._previewPattern = g.value, this._forceUpdate();
|
|
467
470
|
else if (g.type === "confirm") {
|
|
468
|
-
const w = ((N =
|
|
471
|
+
const w = ((N = r.getCurrentSelections()) == null ? void 0 : N.map((H) => H.range)) || [], q = { values: [] }, le = ne(g.value);
|
|
469
472
|
w.forEach((H) => {
|
|
470
|
-
|
|
471
|
-
|
|
473
|
+
Ae.foreach(H, (me, _) => {
|
|
474
|
+
q.values.push({
|
|
472
475
|
row: me,
|
|
473
476
|
col: _,
|
|
474
477
|
pattern: g.value,
|
|
475
478
|
type: le
|
|
476
479
|
});
|
|
477
480
|
});
|
|
478
|
-
}),
|
|
481
|
+
}), n.executeCommand(Ke.id, q), t.close();
|
|
479
482
|
} else g.type === "cancel" && t.close();
|
|
480
483
|
},
|
|
481
484
|
value: { defaultPattern: p, defaultValue: v, row: c.startRow, col: c.startColumn }
|
|
@@ -483,73 +486,73 @@ let B = class extends oe {
|
|
|
483
486
|
return this._sidebarDisposable = t.open({
|
|
484
487
|
header: { title: o.t("sheet.numfmt.title") },
|
|
485
488
|
children: {
|
|
486
|
-
label:
|
|
489
|
+
label: $e,
|
|
487
490
|
...h
|
|
488
491
|
// need passthrough to react props.
|
|
489
492
|
},
|
|
490
493
|
onClose: () => {
|
|
491
|
-
this._forceUpdate(),
|
|
494
|
+
this._forceUpdate(), n.executeCommand(he.id);
|
|
492
495
|
}
|
|
493
496
|
}), !0;
|
|
494
497
|
}
|
|
495
498
|
_forceUpdate(t) {
|
|
496
|
-
var
|
|
497
|
-
const
|
|
499
|
+
var n;
|
|
500
|
+
const r = this._renderManagerService.getRenderById(
|
|
498
501
|
t != null ? t : this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getUnitId()
|
|
499
502
|
);
|
|
500
|
-
|
|
503
|
+
r == null || r.with(kt).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
|
|
501
504
|
}
|
|
502
505
|
_initCommands() {
|
|
503
506
|
[
|
|
504
|
-
|
|
507
|
+
A,
|
|
505
508
|
he
|
|
506
509
|
].forEach((t) => {
|
|
507
510
|
this.disposeWithMe(this._commandService.registerCommand(t));
|
|
508
511
|
});
|
|
509
512
|
}
|
|
510
513
|
_initPanel() {
|
|
511
|
-
this._componentManager.register(
|
|
514
|
+
this._componentManager.register($e, Hn);
|
|
512
515
|
}
|
|
513
516
|
// eslint-disable-next-line max-lines-per-function
|
|
514
517
|
_initRealTimeRenderingInterceptor() {
|
|
515
|
-
const t = new L((
|
|
518
|
+
const t = new L((n) => {
|
|
516
519
|
this._commandService.onCommandExecuted((i) => {
|
|
517
|
-
i.id ===
|
|
520
|
+
i.id === A.id && n.next(!0), i.id === he.id && n.next(!1);
|
|
518
521
|
});
|
|
519
|
-
}),
|
|
522
|
+
}), r = tn([
|
|
520
523
|
t,
|
|
521
524
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
522
|
-
|
|
525
|
+
nn((n) => n ? n.map((i) => i.range) : [])
|
|
523
526
|
)
|
|
524
527
|
]);
|
|
525
528
|
this.disposeWithMe(
|
|
526
529
|
ge(
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
([
|
|
530
|
+
r.pipe(
|
|
531
|
+
rn(
|
|
532
|
+
([n, i]) => new L((s) => {
|
|
530
533
|
const o = new pt();
|
|
531
|
-
return
|
|
534
|
+
return n && i.length && s.next({ selectionRanges: i, disposableCollection: o }), () => {
|
|
532
535
|
o.dispose();
|
|
533
536
|
};
|
|
534
537
|
})
|
|
535
538
|
),
|
|
536
|
-
|
|
539
|
+
sn(() => {
|
|
537
540
|
this._previewPattern = null;
|
|
538
541
|
})
|
|
539
|
-
).subscribe(({ disposableCollection:
|
|
542
|
+
).subscribe(({ disposableCollection: n, selectionRanges: i }) => {
|
|
540
543
|
var o, a;
|
|
541
544
|
const s = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
|
|
542
|
-
this.openPanel(),
|
|
543
|
-
this._sheetInterceptorService.intercept(
|
|
545
|
+
this.openPanel(), n.add(
|
|
546
|
+
this._sheetInterceptorService.intercept(Zt.CELL_CONTENT, {
|
|
544
547
|
priority: 99,
|
|
545
|
-
effect:
|
|
548
|
+
effect: Oe.Value | Oe.Style,
|
|
546
549
|
handler: (c, l, f) => {
|
|
547
550
|
const { row: m, col: d } = l, p = f(c) || {};
|
|
548
551
|
if (i.find(
|
|
549
552
|
(v) => v.startColumn <= d && v.endColumn >= d && v.startRow <= m && v.endRow >= m
|
|
550
553
|
)) {
|
|
551
|
-
const v = l.worksheet.getCellRaw(m, d), h = v == null ? void 0 : v.v,
|
|
552
|
-
if (h == null ||
|
|
554
|
+
const v = l.worksheet.getCellRaw(m, d), h = v == null ? void 0 : v.v, y = v == null ? void 0 : v.t;
|
|
555
|
+
if (h == null || y !== $.NUMBER || this._previewPattern === null)
|
|
553
556
|
return p;
|
|
554
557
|
const g = Mt(this._previewPattern, h, this._sheetsNumfmtCellContentController.local);
|
|
555
558
|
if (g.color) {
|
|
@@ -557,14 +560,14 @@ let B = class extends oe {
|
|
|
557
560
|
return {
|
|
558
561
|
...p,
|
|
559
562
|
v: g.result,
|
|
560
|
-
t:
|
|
563
|
+
t: $.STRING,
|
|
561
564
|
s: { cl: { rgb: w } }
|
|
562
565
|
};
|
|
563
566
|
}
|
|
564
567
|
return {
|
|
565
568
|
...p,
|
|
566
569
|
v: g.result,
|
|
567
|
-
t:
|
|
570
|
+
t: $.STRING
|
|
568
571
|
};
|
|
569
572
|
}
|
|
570
573
|
return p;
|
|
@@ -576,45 +579,45 @@ let B = class extends oe {
|
|
|
576
579
|
);
|
|
577
580
|
}
|
|
578
581
|
_commandExecutedListener() {
|
|
579
|
-
const t = [
|
|
582
|
+
const t = [Ie.id, Ne.id];
|
|
580
583
|
this.disposeWithMe(
|
|
581
|
-
new L((
|
|
582
|
-
const
|
|
584
|
+
new L((r) => {
|
|
585
|
+
const n = this._commandService.onCommandExecuted((i) => {
|
|
583
586
|
if (t.includes(i.id)) {
|
|
584
587
|
const s = i.params;
|
|
585
|
-
|
|
588
|
+
r.next(s.unitId);
|
|
586
589
|
}
|
|
587
590
|
});
|
|
588
|
-
return () =>
|
|
589
|
-
}).pipe(
|
|
591
|
+
return () => n.dispose();
|
|
592
|
+
}).pipe(on(16)).subscribe((r) => this._forceUpdate(r))
|
|
590
593
|
);
|
|
591
594
|
}
|
|
592
595
|
_initCloseListener() {
|
|
593
596
|
this._univerInstanceService.getCurrentTypeOfUnit$(T.UNIVER_SHEET).subscribe((t) => {
|
|
594
|
-
var
|
|
595
|
-
t || ((
|
|
597
|
+
var r;
|
|
598
|
+
t || ((r = this._sidebarDisposable) == null || r.dispose(), this._sidebarDisposable = null);
|
|
596
599
|
});
|
|
597
600
|
}
|
|
598
601
|
};
|
|
599
|
-
B =
|
|
602
|
+
B = An([
|
|
600
603
|
P(0, S(Qe)),
|
|
601
604
|
P(1, S(ft)),
|
|
602
605
|
P(2, Se),
|
|
603
606
|
P(3, ye),
|
|
604
|
-
P(4, S(
|
|
605
|
-
P(5,
|
|
606
|
-
P(6,
|
|
607
|
-
P(7, S(
|
|
608
|
-
P(8,
|
|
607
|
+
P(4, S(Ce)),
|
|
608
|
+
P(5, Be),
|
|
609
|
+
P(6, be),
|
|
610
|
+
P(7, S(qe)),
|
|
611
|
+
P(8, xt),
|
|
609
612
|
P(9, S(M)),
|
|
610
|
-
P(10, S(
|
|
613
|
+
P(10, S(Ge))
|
|
611
614
|
], B);
|
|
612
|
-
var
|
|
613
|
-
for (var i =
|
|
615
|
+
var jn = Object.getOwnPropertyDescriptor, Bn = (e, t, r, n) => {
|
|
616
|
+
for (var i = n > 1 ? void 0 : n ? jn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
614
617
|
(o = e[s]) && (i = o(i) || i);
|
|
615
618
|
return i;
|
|
616
|
-
},
|
|
617
|
-
const
|
|
619
|
+
}, x = (e, t) => (r, n) => t(r, n, e);
|
|
620
|
+
const Wn = () => {
|
|
618
621
|
let e = [];
|
|
619
622
|
return {
|
|
620
623
|
add: (i, s, o, a, c) => e.push({ unitId: i, subUnitId: s, row: o, col: a, value: c }),
|
|
@@ -625,22 +628,22 @@ const jn = () => {
|
|
|
625
628
|
};
|
|
626
629
|
};
|
|
627
630
|
let re = class extends oe {
|
|
628
|
-
constructor(t,
|
|
631
|
+
constructor(t, r, n, i, s) {
|
|
629
632
|
super();
|
|
630
633
|
// collect effect mutations when edit end and push this to commands stack in next commands progress
|
|
631
|
-
J(this, "_collectEffectMutation",
|
|
632
|
-
this._sheetInterceptorService = t, this._numfmtService =
|
|
634
|
+
J(this, "_collectEffectMutation", Wn());
|
|
635
|
+
this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = i, this._editorBridgeService = s, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
|
|
633
636
|
}
|
|
634
637
|
_initInterceptorEditorStart() {
|
|
635
638
|
this._editorBridgeService && this.disposeWithMe(
|
|
636
639
|
ge(
|
|
637
640
|
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
638
|
-
|
|
641
|
+
zt,
|
|
639
642
|
{
|
|
640
|
-
handler: (t,
|
|
641
|
-
const i =
|
|
642
|
-
|
|
643
|
-
|
|
643
|
+
handler: (t, r, n) => {
|
|
644
|
+
const i = r.row, s = r.col, o = this._numfmtService.getValue(
|
|
645
|
+
r.unitId,
|
|
646
|
+
r.subUnitId,
|
|
644
647
|
i,
|
|
645
648
|
s
|
|
646
649
|
);
|
|
@@ -650,17 +653,17 @@ let re = class extends oe {
|
|
|
650
653
|
case "currency":
|
|
651
654
|
case "grouped":
|
|
652
655
|
case "number": {
|
|
653
|
-
const c =
|
|
654
|
-
return
|
|
656
|
+
const c = r.worksheet.getCellRaw(i, s);
|
|
657
|
+
return n && n(c);
|
|
655
658
|
}
|
|
656
659
|
case "percent":
|
|
657
660
|
case "date":
|
|
658
661
|
case "time":
|
|
659
662
|
case "datetime":
|
|
660
663
|
default:
|
|
661
|
-
return
|
|
664
|
+
return n && n(t);
|
|
662
665
|
}
|
|
663
|
-
return
|
|
666
|
+
return n(t);
|
|
664
667
|
}
|
|
665
668
|
}
|
|
666
669
|
)
|
|
@@ -676,50 +679,50 @@ let re = class extends oe {
|
|
|
676
679
|
this.disposeWithMe(
|
|
677
680
|
ge(
|
|
678
681
|
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
679
|
-
|
|
682
|
+
Yt,
|
|
680
683
|
{
|
|
681
684
|
// eslint-disable-next-line complexity
|
|
682
|
-
handler: (t,
|
|
685
|
+
handler: (t, r, n) => {
|
|
683
686
|
var f, m, d, p;
|
|
684
687
|
this._collectEffectMutation.clean();
|
|
685
688
|
const i = this._numfmtService.getValue(
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
689
|
+
r.unitId,
|
|
690
|
+
r.subUnitId,
|
|
691
|
+
r.row,
|
|
692
|
+
r.col
|
|
690
693
|
), s = (f = i && ne(i.pattern)) != null ? f : "", o = () => {
|
|
691
694
|
i && this._collectEffectMutation.add(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
695
|
+
r.unitId,
|
|
696
|
+
r.subUnitId,
|
|
697
|
+
r.row,
|
|
698
|
+
r.col,
|
|
696
699
|
null
|
|
697
700
|
);
|
|
698
701
|
};
|
|
699
|
-
if (!(t != null && t.v) && !(t != null && t.p) || (i == null ? void 0 : i.pattern)
|
|
700
|
-
return
|
|
702
|
+
if (!(t != null && t.v) && !(t != null && t.p) || Je(i == null ? void 0 : i.pattern) || t.t === $.FORCE_STRING)
|
|
703
|
+
return n(t);
|
|
701
704
|
const a = (m = t.p) == null ? void 0 : m.body, c = (p = (d = t == null ? void 0 : t.p) == null ? void 0 : d.body) != null && p.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), l = Q.parseDate(c) || Q.parseTime(c) || Q.parseNumber(c);
|
|
702
705
|
if (a)
|
|
703
|
-
if (
|
|
704
|
-
const { dataStream: v } = a, h = v.replace(/\r\n$/, ""),
|
|
705
|
-
if (Number.isNaN(
|
|
706
|
-
return
|
|
706
|
+
if (Gn(a)) {
|
|
707
|
+
const { dataStream: v } = a, h = v.replace(/\r\n$/, ""), y = Number(h);
|
|
708
|
+
if (Number.isNaN(y) && !l)
|
|
709
|
+
return n(t);
|
|
707
710
|
} else
|
|
708
|
-
return
|
|
711
|
+
return n(t);
|
|
709
712
|
if (l) {
|
|
710
713
|
l.z && this._collectEffectMutation.add(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
714
|
+
r.unitId,
|
|
715
|
+
r.subUnitId,
|
|
716
|
+
r.row,
|
|
717
|
+
r.col,
|
|
715
718
|
{
|
|
716
719
|
pattern: l.z
|
|
717
720
|
}
|
|
718
721
|
);
|
|
719
722
|
const v = Number(l.v);
|
|
720
|
-
return
|
|
721
|
-
} else (["date", "time", "datetime", "percent"].includes(s) || !
|
|
722
|
-
return
|
|
723
|
+
return n({ ...t, p: void 0, v, t: $.NUMBER });
|
|
724
|
+
} else (["date", "time", "datetime", "percent"].includes(s) || !Vn(c)) && o();
|
|
725
|
+
return n(t);
|
|
723
726
|
}
|
|
724
727
|
}
|
|
725
728
|
)
|
|
@@ -730,11 +733,11 @@ let re = class extends oe {
|
|
|
730
733
|
const t = this;
|
|
731
734
|
this.disposeWithMe(
|
|
732
735
|
this._sheetInterceptorService.interceptCommand({
|
|
733
|
-
getMutations(
|
|
734
|
-
var
|
|
735
|
-
switch (
|
|
736
|
-
case
|
|
737
|
-
const i = t._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET), s = i.getUnitId(), o = (
|
|
736
|
+
getMutations(r) {
|
|
737
|
+
var n;
|
|
738
|
+
switch (r.id) {
|
|
739
|
+
case Xt.id: {
|
|
740
|
+
const i = t._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET), s = i.getUnitId(), o = (n = i.getActiveSheet()) == null ? void 0 : n.getSheetId();
|
|
738
741
|
if (!o)
|
|
739
742
|
return {
|
|
740
743
|
redos: [],
|
|
@@ -764,21 +767,21 @@ let re = class extends oe {
|
|
|
764
767
|
})), f = [], m = [];
|
|
765
768
|
if (c.length) {
|
|
766
769
|
const d = {
|
|
767
|
-
id:
|
|
768
|
-
params:
|
|
770
|
+
id: Ne.id,
|
|
771
|
+
params: qt(s, o, c)
|
|
769
772
|
};
|
|
770
|
-
f.push(d), m.push(...
|
|
773
|
+
f.push(d), m.push(...Jt(t._injector, d.params));
|
|
771
774
|
}
|
|
772
775
|
if (l.length) {
|
|
773
776
|
const d = {
|
|
774
|
-
id:
|
|
777
|
+
id: Ie.id,
|
|
775
778
|
params: {
|
|
776
779
|
unitId: s,
|
|
777
780
|
subUnitId: o,
|
|
778
781
|
ranges: l
|
|
779
782
|
}
|
|
780
783
|
};
|
|
781
|
-
f.push(d), m.push(...
|
|
784
|
+
f.push(d), m.push(...Qt(t._injector, d.params));
|
|
782
785
|
}
|
|
783
786
|
return {
|
|
784
787
|
redos: f,
|
|
@@ -795,19 +798,19 @@ let re = class extends oe {
|
|
|
795
798
|
);
|
|
796
799
|
}
|
|
797
800
|
};
|
|
798
|
-
re =
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
801
|
+
re = Bn([
|
|
802
|
+
x(0, S(Qe)),
|
|
803
|
+
x(1, S(be)),
|
|
804
|
+
x(2, S(Se)),
|
|
805
|
+
x(3, S(je)),
|
|
806
|
+
x(4, vt(Ft))
|
|
804
807
|
], re);
|
|
805
|
-
function
|
|
808
|
+
function Vn(e) {
|
|
806
809
|
return /^-?\d+(\.\d+)?$/.test(e);
|
|
807
810
|
}
|
|
808
|
-
function
|
|
809
|
-
const { textRuns: t = [], paragraphs:
|
|
810
|
-
return !(t.some((o) => !!(o.ts && Object.keys(o.ts).some((c) => s.includes(c)))) ||
|
|
811
|
+
function Gn(e) {
|
|
812
|
+
const { textRuns: t = [], paragraphs: r = [], customRanges: n, customBlocks: i = [] } = e, s = ["va"];
|
|
813
|
+
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);
|
|
811
814
|
}
|
|
812
815
|
const ee = [
|
|
813
816
|
{
|
|
@@ -816,7 +819,7 @@ const ee = [
|
|
|
816
819
|
},
|
|
817
820
|
{
|
|
818
821
|
label: "sheet.numfmt.text",
|
|
819
|
-
pattern:
|
|
822
|
+
pattern: Kt
|
|
820
823
|
},
|
|
821
824
|
"|",
|
|
822
825
|
{
|
|
@@ -862,21 +865,21 @@ const ee = [
|
|
|
862
865
|
label: "sheet.numfmt.moreFmt",
|
|
863
866
|
pattern: ""
|
|
864
867
|
}
|
|
865
|
-
],
|
|
868
|
+
], Kn = (e) => ({
|
|
866
869
|
icon: new L((t) => {
|
|
867
|
-
const
|
|
868
|
-
function
|
|
870
|
+
const r = e.get(Pt);
|
|
871
|
+
function n(s) {
|
|
869
872
|
return {
|
|
870
|
-
[
|
|
871
|
-
[
|
|
872
|
-
[
|
|
873
|
-
[
|
|
873
|
+
[k.US]: "DollarSingle",
|
|
874
|
+
[k.RU]: "RoubleSingle",
|
|
875
|
+
[k.CN]: "RmbSingle",
|
|
876
|
+
[k.AT]: "EuroSingle"
|
|
874
877
|
}[s] || "DollarSingle";
|
|
875
878
|
}
|
|
876
|
-
const i =
|
|
877
|
-
return t.next(
|
|
878
|
-
const o =
|
|
879
|
-
t.next(
|
|
879
|
+
const i = k[r.getCurrencySymbol()] || "$";
|
|
880
|
+
return t.next(n(i)), r.currencySymbol$.subscribe((s) => {
|
|
881
|
+
const o = k[s] || "$";
|
|
882
|
+
t.next(n(o));
|
|
880
883
|
});
|
|
881
884
|
}),
|
|
882
885
|
id: Xe.id,
|
|
@@ -884,37 +887,37 @@ const ee = [
|
|
|
884
887
|
tooltip: "sheet.numfmt.currency",
|
|
885
888
|
type: K.BUTTON,
|
|
886
889
|
hidden$: G(e, T.UNIVER_SHEET),
|
|
887
|
-
disabled$: V(e, { workbookTypes: [
|
|
888
|
-
}),
|
|
890
|
+
disabled$: V(e, { workbookTypes: [X], worksheetTypes: [Y, z], rangeTypes: [Z] })
|
|
891
|
+
}), Zn = (e) => ({
|
|
889
892
|
icon: "AddDigitsSingle",
|
|
890
|
-
id:
|
|
893
|
+
id: Ye.id,
|
|
891
894
|
title: "sheet.numfmt.addDecimal",
|
|
892
895
|
tooltip: "sheet.numfmt.addDecimal",
|
|
893
896
|
type: K.BUTTON,
|
|
894
897
|
hidden$: G(e, T.UNIVER_SHEET),
|
|
895
|
-
disabled$: V(e, { workbookTypes: [
|
|
896
|
-
}),
|
|
898
|
+
disabled$: V(e, { workbookTypes: [X], worksheetTypes: [Y, z], rangeTypes: [Z] })
|
|
899
|
+
}), zn = (e) => ({
|
|
897
900
|
icon: "ReduceDigitsSingle",
|
|
898
|
-
id:
|
|
901
|
+
id: ze.id,
|
|
899
902
|
title: "sheet.numfmt.subtractDecimal",
|
|
900
903
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
901
904
|
type: K.BUTTON,
|
|
902
905
|
hidden$: G(e, T.UNIVER_SHEET),
|
|
903
|
-
disabled$: V(e, { workbookTypes: [
|
|
904
|
-
}),
|
|
906
|
+
disabled$: V(e, { workbookTypes: [X], worksheetTypes: [Y, z], rangeTypes: [Z] })
|
|
907
|
+
}), Yn = (e) => ({
|
|
905
908
|
icon: "PercentSingle",
|
|
906
|
-
id:
|
|
909
|
+
id: Ze.id,
|
|
907
910
|
title: "sheet.numfmt.percent",
|
|
908
911
|
tooltip: "sheet.numfmt.percent",
|
|
909
912
|
type: K.BUTTON,
|
|
910
913
|
hidden$: G(e, T.UNIVER_SHEET),
|
|
911
|
-
disabled$: V(e, { workbookTypes: [
|
|
912
|
-
}),
|
|
913
|
-
const t = e.get(Se),
|
|
914
|
+
disabled$: V(e, { workbookTypes: [X], worksheetTypes: [Y, z], rangeTypes: [Z] })
|
|
915
|
+
}), Xn = (e) => {
|
|
916
|
+
const t = e.get(Se), r = e.get(ye), n = e.get(M), i = e.get(Ce), s = $t(t, "", ({ workbook: o, worksheet: a }) => new L(
|
|
914
917
|
(c) => et(
|
|
915
918
|
i.selectionMoveEnd$,
|
|
916
919
|
new L((l) => {
|
|
917
|
-
const f = [
|
|
920
|
+
const f = [Ie.id, Ne.id], m = r.onCommandExecuted((d) => {
|
|
918
921
|
f.includes(d.id) && l.next(null);
|
|
919
922
|
});
|
|
920
923
|
return () => m.dispose();
|
|
@@ -923,13 +926,17 @@ const ee = [
|
|
|
923
926
|
var f, m;
|
|
924
927
|
const l = i.getCurrentSelections();
|
|
925
928
|
if (l && l[0]) {
|
|
926
|
-
const d = l[0].range, p = d.startRow, v = d.startColumn, h = (m = o.getStyles().get((f = a.getCell(p, v)) == null ? void 0 : f.s)) == null ? void 0 : m.n,
|
|
927
|
-
let g =
|
|
928
|
-
if (
|
|
929
|
+
const d = l[0].range, p = d.startRow, v = d.startColumn, h = (m = o.getStyles().get((f = a.getCell(p, v)) == null ? void 0 : f.s)) == null ? void 0 : m.n, y = h == null ? void 0 : h.pattern;
|
|
930
|
+
let g = n.t("sheet.numfmt.general");
|
|
931
|
+
if (Gt(y)) {
|
|
932
|
+
c.next(g);
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
if (y) {
|
|
929
936
|
const N = ee.filter((w) => typeof w == "object" && w.pattern).find(
|
|
930
|
-
(w) => ce(
|
|
937
|
+
(w) => ce(y, w.pattern)
|
|
931
938
|
);
|
|
932
|
-
N && typeof N == "object" && N.pattern ? g =
|
|
939
|
+
N && typeof N == "object" && N.pattern ? g = n.t(N.label) : g = n.t("sheet.numfmt.moreFmt");
|
|
933
940
|
}
|
|
934
941
|
c.next(g);
|
|
935
942
|
}
|
|
@@ -937,7 +944,7 @@ const ee = [
|
|
|
937
944
|
));
|
|
938
945
|
return {
|
|
939
946
|
label: ot,
|
|
940
|
-
id:
|
|
947
|
+
id: A.id,
|
|
941
948
|
tooltip: "sheet.numfmt.title",
|
|
942
949
|
type: K.SELECTOR,
|
|
943
950
|
selections: [
|
|
@@ -950,32 +957,32 @@ const ee = [
|
|
|
950
957
|
],
|
|
951
958
|
value$: s,
|
|
952
959
|
hidden$: G(e, T.UNIVER_SHEET),
|
|
953
|
-
disabled$: V(e, { workbookTypes: [
|
|
960
|
+
disabled$: V(e, { workbookTypes: [X], worksheetTypes: [z, Y], rangeTypes: [Z] })
|
|
954
961
|
};
|
|
955
|
-
}, ot = "sheet.numfmt.moreNumfmtType", ct = "sheet.numfmt.moreNumfmtType.options",
|
|
956
|
-
var
|
|
957
|
-
const t = C(M),
|
|
958
|
-
return /* @__PURE__ */ u("span", { className: "more-numfmt-type", children:
|
|
959
|
-
},
|
|
960
|
-
const e = C(ye), t = C(M),
|
|
962
|
+
}, ot = "sheet.numfmt.moreNumfmtType", ct = "sheet.numfmt.moreNumfmtType.options", qn = (e) => {
|
|
963
|
+
var n;
|
|
964
|
+
const t = C(M), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
|
|
965
|
+
return /* @__PURE__ */ u("span", { className: "more-numfmt-type", children: r });
|
|
966
|
+
}, Jn = () => {
|
|
967
|
+
const e = C(ye), t = C(M), r = C(At), n = C(Ge), i = C(Ce), s = (c) => {
|
|
961
968
|
const l = i.getCurrentLastSelection();
|
|
962
969
|
if (!l)
|
|
963
970
|
return;
|
|
964
971
|
const f = l.range, m = [];
|
|
965
|
-
|
|
972
|
+
Ae.foreach(f, (d, p) => {
|
|
966
973
|
c ? m.push({ row: d, col: p, pattern: c, type: ne(c) }) : m.push({ row: d, col: p });
|
|
967
|
-
}), e.executeCommand(
|
|
974
|
+
}), e.executeCommand(Ke.id, { values: m }), r.focus();
|
|
968
975
|
}, o = (c) => {
|
|
969
976
|
if (c === 0)
|
|
970
977
|
s(null);
|
|
971
978
|
else if (c === ee.length - 1)
|
|
972
|
-
e.executeCommand(
|
|
979
|
+
e.executeCommand(A.id);
|
|
973
980
|
else {
|
|
974
981
|
const l = ee[c];
|
|
975
982
|
l.pattern && s(l.pattern);
|
|
976
983
|
}
|
|
977
984
|
}, a = 1220;
|
|
978
|
-
return /* @__PURE__ */ u("div", { className: "more-numfmt-type-options", children: ee.map((c, l) => c === "|" ? /* @__PURE__ */ u("div", { className: "line m-t-4", onClick: (f) => f.stopPropagation() }, l) : /* @__PURE__ */
|
|
985
|
+
return /* @__PURE__ */ u("div", { className: "more-numfmt-type-options", children: ee.map((c, l) => c === "|" ? /* @__PURE__ */ u("div", { className: "line m-t-4", onClick: (f) => f.stopPropagation() }, l) : /* @__PURE__ */ b(
|
|
979
986
|
"div",
|
|
980
987
|
{
|
|
981
988
|
className: "option-item m-t-4",
|
|
@@ -984,61 +991,61 @@ const ee = [
|
|
|
984
991
|
},
|
|
985
992
|
children: [
|
|
986
993
|
/* @__PURE__ */ u("div", { children: t.t(c.label) }),
|
|
987
|
-
/* @__PURE__ */ u("div", { className: "m-l-26", children: c.pattern ? wt(c.pattern || "", a,
|
|
994
|
+
/* @__PURE__ */ u("div", { className: "m-l-26", children: c.pattern ? wt(c.pattern || "", a, n.local).result : "" })
|
|
988
995
|
]
|
|
989
996
|
},
|
|
990
997
|
l
|
|
991
998
|
)) });
|
|
992
|
-
},
|
|
999
|
+
}, Qn = {
|
|
993
1000
|
[jt.FORMULAS_INSERT]: {
|
|
994
1001
|
[Xe.id]: {
|
|
995
1002
|
order: 4,
|
|
996
|
-
menuItemFactory:
|
|
1003
|
+
menuItemFactory: Kn
|
|
997
1004
|
},
|
|
998
|
-
[
|
|
1005
|
+
[Ye.id]: {
|
|
999
1006
|
order: 5,
|
|
1000
|
-
menuItemFactory:
|
|
1007
|
+
menuItemFactory: Zn
|
|
1001
1008
|
},
|
|
1002
|
-
[
|
|
1009
|
+
[ze.id]: {
|
|
1003
1010
|
order: 6,
|
|
1004
|
-
menuItemFactory:
|
|
1011
|
+
menuItemFactory: zn
|
|
1005
1012
|
},
|
|
1006
|
-
[
|
|
1013
|
+
[Ze.id]: {
|
|
1007
1014
|
order: 7,
|
|
1008
|
-
menuItemFactory:
|
|
1015
|
+
menuItemFactory: Yn
|
|
1009
1016
|
},
|
|
1010
|
-
[
|
|
1017
|
+
[A.id]: {
|
|
1011
1018
|
order: 8,
|
|
1012
|
-
menuItemFactory:
|
|
1019
|
+
menuItemFactory: Xn
|
|
1013
1020
|
}
|
|
1014
1021
|
}
|
|
1015
1022
|
};
|
|
1016
|
-
var
|
|
1017
|
-
for (var i =
|
|
1023
|
+
var er = Object.getOwnPropertyDescriptor, tr = (e, t, r, n) => {
|
|
1024
|
+
for (var i = n > 1 ? void 0 : n ? er(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
1018
1025
|
(o = e[s]) && (i = o(i) || i);
|
|
1019
1026
|
return i;
|
|
1020
|
-
},
|
|
1027
|
+
}, Le = (e, t) => (r, n) => t(r, n, e);
|
|
1021
1028
|
let ie = class extends oe {
|
|
1022
1029
|
constructor(e, t) {
|
|
1023
1030
|
super(), this._componentManager = e, this._menuManagerService = t, this._initMenu();
|
|
1024
1031
|
}
|
|
1025
1032
|
_initMenu() {
|
|
1026
|
-
this._menuManagerService.mergeMenu(
|
|
1033
|
+
this._menuManagerService.mergeMenu(Qn), this.disposeWithMe(this._componentManager.register(ot, qn)), this.disposeWithMe(this._componentManager.register(ct, Jn));
|
|
1027
1034
|
}
|
|
1028
1035
|
};
|
|
1029
|
-
ie =
|
|
1030
|
-
|
|
1031
|
-
|
|
1036
|
+
ie = tr([
|
|
1037
|
+
Le(0, S(qe)),
|
|
1038
|
+
Le(1, Bt)
|
|
1032
1039
|
], ie);
|
|
1033
|
-
var
|
|
1034
|
-
for (var i =
|
|
1040
|
+
var nr = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, ir = (e, t, r) => t in e ? nr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, sr = (e, t, r, n) => {
|
|
1041
|
+
for (var i = n > 1 ? void 0 : n ? rr(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
1035
1042
|
(o = e[s]) && (i = o(i) || i);
|
|
1036
1043
|
return i;
|
|
1037
|
-
}, ve = (e, t) => (
|
|
1038
|
-
const
|
|
1044
|
+
}, ve = (e, t) => (r, n) => t(r, n, e), at = (e, t, r) => ir(e, typeof t != "symbol" ? t + "" : t, r);
|
|
1045
|
+
const or = "SHEET_NUMFMT_UI_PLUGIN";
|
|
1039
1046
|
let se = class extends St {
|
|
1040
|
-
constructor(e = ke, t,
|
|
1041
|
-
super(), this._config = e, this._injector = t, this._configService =
|
|
1047
|
+
constructor(e = ke, t, r, n) {
|
|
1048
|
+
super(), this._config = e, this._injector = t, this._configService = r, this._renderManagerService = n;
|
|
1042
1049
|
const { menu: i, ...s } = yt(
|
|
1043
1050
|
{},
|
|
1044
1051
|
ke,
|
|
@@ -1069,13 +1076,13 @@ let se = class extends St {
|
|
|
1069
1076
|
});
|
|
1070
1077
|
}
|
|
1071
1078
|
};
|
|
1072
|
-
at(se, "pluginName",
|
|
1079
|
+
at(se, "pluginName", or);
|
|
1073
1080
|
at(se, "type", T.UNIVER_SHEET);
|
|
1074
|
-
se =
|
|
1081
|
+
se = sr([
|
|
1075
1082
|
gt(Lt, Rt),
|
|
1076
|
-
ve(1, S(
|
|
1083
|
+
ve(1, S(je)),
|
|
1077
1084
|
ve(2, _t),
|
|
1078
|
-
ve(3,
|
|
1085
|
+
ve(3, Be)
|
|
1079
1086
|
], se);
|
|
1080
1087
|
export {
|
|
1081
1088
|
se as UniverSheetsNumfmtUIPlugin
|