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