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