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