@univerjs/sheets-numfmt 0.1.12 → 0.1.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 +2 -2
- package/lib/es/index.js +430 -541
- package/lib/locale/en-US.json +36 -0
- package/lib/locale/ru-RU.json +36 -0
- package/lib/locale/zh-CN.json +36 -0
- package/lib/types/controllers/numfmt.i18n.controller.d.ts +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/umd/index.js +2 -2
- package/package.json +20 -19
- package/lib/types/locale/index.d.ts +0 -18
package/lib/es/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as w, ICommandService as O, IUniverInstanceService as
|
|
5
|
-
import { getSheetCommandTarget as
|
|
6
|
-
import { Inject as S, createIdentifier as
|
|
7
|
-
import { SheetSkeletonManagerService as
|
|
8
|
-
import { map as
|
|
9
|
-
import
|
|
10
|
-
import { IRenderManagerService as
|
|
11
|
-
import { ComponentManager as
|
|
12
|
-
import { Observable as G, combineLatest as
|
|
13
|
-
import
|
|
14
|
-
import { InputNumber as
|
|
15
|
-
import { useDependency as N, useInjector as
|
|
1
|
+
var ht = Object.defineProperty;
|
|
2
|
+
var ft = (e, t, r) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var L = (e, t, r) => (ft(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { CommandType as w, ICommandService as O, IUniverInstanceService as k, IUndoRedoService as pt, sequenceExecute as vt, LocaleType as gt, Disposable as Y, ObjectMatrix as _t, CellValueType as B, Range as P, toDisposable as K, OnLifecycle as q, LifecycleStages as V, ThemeService as Fe, LocaleService as T, runOnLifecycle as St, ILocalStorageService as bt, UniverInstanceType as E, DisposableCollection as yt, Plugin as Ct, Tools as It } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as Re, transformCellsToRange as We, rangeMerge as Ae, SetNumfmtMutation as J, factorySetNumfmtUndoMutation as Ge, RemoveNumfmtMutation as ge, factoryRemoveNumfmtUndoMutation as ze, INTERCEPTOR_POINT as Ke, SheetInterceptorService as Pe, INumfmtService as H, SelectionManagerService as D, SetRangeValuesCommand as Tt, WorkbookEditablePermission as Z, WorksheetEditPermission as Q, WorksheetSetCellStylePermission as X, RangeProtectionPermissionEditPoint as ee } from "@univerjs/sheets";
|
|
6
|
+
import { Inject as S, createIdentifier as Mt, Injector as xe } from "@wendellhu/redi";
|
|
7
|
+
import { SheetSkeletonManagerService as Ye, IEditorBridgeService as Nt, getCurrentRangeDisable$ as te, deriveStateFromActiveSheet$ as Et } from "@univerjs/sheets-ui";
|
|
8
|
+
import { map as qe, distinctUntilChanged as Rt, switchMap as Pt, tap as xt, debounceTime as Ot } from "rxjs/operators";
|
|
9
|
+
import x from "@univerjs/engine-numfmt";
|
|
10
|
+
import { IRenderManagerService as jt, ITextSelectionRenderManager as $t } from "@univerjs/engine-render";
|
|
11
|
+
import { ComponentManager as Je, ISidebarService as wt, MenuItemType as ne, MenuGroup as re, MenuPosition as se, getMenuHiddenObservable as ie, IMenuService as Dt } from "@univerjs/ui";
|
|
12
|
+
import { Observable as G, combineLatest as Ut, merge as Ze } from "rxjs";
|
|
13
|
+
import Lt, { createContext as At, useState as I, useEffect as Oe, useRef as Qe, useContext as Xe, useMemo as R, createElement as Bt } from "react";
|
|
14
|
+
import { InputNumber as je, Select as $e, SelectList as we, Button as Be } from "@univerjs/design";
|
|
15
|
+
import { useDependency as N, useInjector as kt } from "@wendellhu/redi/react-bindings";
|
|
16
16
|
const $ = {
|
|
17
17
|
id: "sheet.command.numfmt.set.numfmt",
|
|
18
18
|
type: w.COMMAND,
|
|
19
19
|
handler: (e, t) => {
|
|
20
20
|
if (!t)
|
|
21
21
|
return !1;
|
|
22
|
-
const r = e.get(O), n = e.get(
|
|
22
|
+
const r = e.get(O), n = e.get(k), s = e.get(pt), i = Re(n, t);
|
|
23
23
|
if (!i)
|
|
24
24
|
return !1;
|
|
25
|
-
const { unitId:
|
|
26
|
-
unitId:
|
|
27
|
-
subUnitId:
|
|
25
|
+
const { unitId: o, subUnitId: a } = i, l = t.values.filter((h) => !!h.pattern), u = t.values.filter((h) => !h.pattern), m = We(o, a, l), c = {
|
|
26
|
+
unitId: o,
|
|
27
|
+
subUnitId: a,
|
|
28
28
|
ranges: u.map((h) => ({
|
|
29
29
|
startColumn: h.col,
|
|
30
30
|
startRow: h.row,
|
|
@@ -35,180 +35,76 @@ const $ = {
|
|
|
35
35
|
if (l.length) {
|
|
36
36
|
Object.keys(m.values).forEach((p) => {
|
|
37
37
|
const v = m.values[p];
|
|
38
|
-
v.ranges =
|
|
38
|
+
v.ranges = Ae(v.ranges);
|
|
39
39
|
}), f.push({
|
|
40
40
|
id: J.id,
|
|
41
41
|
params: m
|
|
42
42
|
});
|
|
43
|
-
const h =
|
|
43
|
+
const h = Ge(e, m);
|
|
44
44
|
_.push(...h);
|
|
45
45
|
}
|
|
46
46
|
if (u.length) {
|
|
47
|
-
|
|
48
|
-
id:
|
|
49
|
-
params:
|
|
47
|
+
c.ranges = Ae(c.ranges), f.push({
|
|
48
|
+
id: ge.id,
|
|
49
|
+
params: c
|
|
50
50
|
});
|
|
51
|
-
const h =
|
|
51
|
+
const h = ze(e, c);
|
|
52
52
|
_.push(...h);
|
|
53
53
|
}
|
|
54
|
-
const g =
|
|
54
|
+
const g = vt(f, r).result;
|
|
55
55
|
return g && s.pushUndoRedo({
|
|
56
|
-
unitID:
|
|
56
|
+
unitID: o,
|
|
57
57
|
undoMutations: _,
|
|
58
58
|
redoMutations: f
|
|
59
59
|
}), g;
|
|
60
60
|
}
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
numfmt: {
|
|
64
|
-
percent: "Percentage",
|
|
65
|
-
title: "Number format",
|
|
66
|
-
numfmtType: "Format types",
|
|
67
|
-
cancel: "Cancel",
|
|
68
|
-
confirm: "Confirm",
|
|
69
|
-
general: "General",
|
|
70
|
-
accounting: "Accounting",
|
|
71
|
-
text: "Text",
|
|
72
|
-
number: "Number",
|
|
73
|
-
currency: "Currency",
|
|
74
|
-
date: "Date",
|
|
75
|
-
time: "Time",
|
|
76
|
-
thousandthPercentile: "Thousands separator",
|
|
77
|
-
preview: "Preview",
|
|
78
|
-
dateTime: "Date and time",
|
|
79
|
-
decimalLength: "Decimal places",
|
|
80
|
-
currencyType: "Currency Symbol",
|
|
81
|
-
moreFmt: "More Formats",
|
|
82
|
-
financialValue: "Financial value",
|
|
83
|
-
roundingCurrency: "Rounding up the currency",
|
|
84
|
-
timeDuration: "Duration Time",
|
|
85
|
-
currencyDes: "The currency format is used to represent general currency values. The accounting format aligns a column of values with decimal points",
|
|
86
|
-
accountingDes: "The accounting number format aligns a column of values with currency symbols and decimal points",
|
|
87
|
-
dateType: "Date Type",
|
|
88
|
-
dateDes: "The date format presents date and time series values as date values.",
|
|
89
|
-
negType: "A negative number type",
|
|
90
|
-
generalDes: "The regular format does not contain any specific number format.",
|
|
91
|
-
thousandthPercentileDes: "The percentile format is used for the representation of ordinary numbers. Monetary and accounting formats provide a specialized format for monetary value calculations.",
|
|
92
|
-
addDecimal: "Increase decimal places",
|
|
93
|
-
subtractDecimal: "Decreasing decimal places"
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}, At = Lt, Bt = {
|
|
97
|
-
sheet: {
|
|
98
|
-
numfmt: {
|
|
99
|
-
percent: "百分比",
|
|
100
|
-
title: "数字格式",
|
|
101
|
-
numfmtType: "格式类型",
|
|
102
|
-
cancel: "取消",
|
|
103
|
-
confirm: "确认",
|
|
104
|
-
general: "常规",
|
|
105
|
-
accounting: "会计",
|
|
106
|
-
text: "文本",
|
|
107
|
-
number: "数值",
|
|
108
|
-
currency: "货币",
|
|
109
|
-
date: "日期",
|
|
110
|
-
time: "时间",
|
|
111
|
-
thousandthPercentile: "千分位符",
|
|
112
|
-
preview: "示例",
|
|
113
|
-
dateTime: "日期时间",
|
|
114
|
-
decimalLength: "小数位数",
|
|
115
|
-
currencyType: "货币类型",
|
|
116
|
-
moreFmt: "更多格式",
|
|
117
|
-
financialValue: "财务数值",
|
|
118
|
-
roundingCurrency: "货币取整",
|
|
119
|
-
timeDuration: "持续时间",
|
|
120
|
-
currencyDes: "货币格式用于表示一般货币数值。会计格式可以对一列数值进行小数点对齐",
|
|
121
|
-
accountingDes: "会计数字格式可对一列数值进行货币符号和小数点对齐",
|
|
122
|
-
dateType: "日期类型",
|
|
123
|
-
dateDes: "日期格式将日期和时间系列数值品示为日期值。",
|
|
124
|
-
negType: "负数类型",
|
|
125
|
-
generalDes: "常规格式不包含任何特定的数字格式。",
|
|
126
|
-
thousandthPercentileDes: "千分位符格式用于一般数字的表示。货币和会计格式则提供货币值计算的专用格式。",
|
|
127
|
-
addDecimal: "增加小数位",
|
|
128
|
-
subtractDecimal: "减少小数位"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}, Vt = Bt, Ft = {
|
|
132
|
-
sheet: {
|
|
133
|
-
numfmt: {
|
|
134
|
-
percent: "Процент",
|
|
135
|
-
title: "Формат числа",
|
|
136
|
-
numfmtType: "Типы форматов",
|
|
137
|
-
cancel: "Отмена",
|
|
138
|
-
confirm: "Подтвердить",
|
|
139
|
-
general: "Общий",
|
|
140
|
-
accounting: "Бухгалтерский",
|
|
141
|
-
text: "Текст",
|
|
142
|
-
number: "Число",
|
|
143
|
-
currency: "Валюта",
|
|
144
|
-
date: "Дата",
|
|
145
|
-
time: "Время",
|
|
146
|
-
thousandthPercentile: "Разделитель тысяч",
|
|
147
|
-
preview: "Предпросмотр",
|
|
148
|
-
dateTime: "Дата и время",
|
|
149
|
-
decimalLength: "Десятичные знаки",
|
|
150
|
-
currencyType: "Символ валюты",
|
|
151
|
-
moreFmt: "Другие форматы",
|
|
152
|
-
financialValue: "Финансовое значение",
|
|
153
|
-
roundingCurrency: "Округление валюты",
|
|
154
|
-
timeDuration: "Продолжительность времени",
|
|
155
|
-
currencyDes: "Формат валюты используется для представления общих значений валюты. Формат бухгалтерского учета выравнивает столбец значений по десятичным точкам.",
|
|
156
|
-
accountingDes: "Формат бухгалтерских чисел выравнивает столбец значений по символам валюты и десятичным точкам.",
|
|
157
|
-
dateType: "Тип даты",
|
|
158
|
-
dateDes: "Формат даты представляет значения времени и даты как значения даты.",
|
|
159
|
-
negType: "Тип отрицательного числа",
|
|
160
|
-
generalDes: "Обычный формат не содержит никакого специфического формата числа.",
|
|
161
|
-
thousandthPercentileDes: "Формат процента используется для представления обычных чисел. Монетарные и бухгалтерские форматы предоставляют специальный формат для вычислений монетарных значений.",
|
|
162
|
-
addDecimal: "Увеличить количество десятичных знаков",
|
|
163
|
-
subtractDecimal: "Уменьшить количество десятичных знаков"
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}, sr = Ft, Ce = "SHEET_NUMFMT_PLUGIN", ue = (e) => R.getInfo(e).type || "unknown", Oe = (e, t, r) => {
|
|
167
|
-
const n = R.getInfo(e), s = r === ht.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], c = R.format(e, t, { locale: s });
|
|
61
|
+
}, Ne = "SHEET_NUMFMT_PLUGIN", fe = (e) => x.getInfo(e).type || "unknown", De = (e, t, r) => {
|
|
62
|
+
const n = x.getInfo(e), s = r === gt.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], o = x.format(e, t, { locale: s });
|
|
168
63
|
return t < 0 ? {
|
|
169
|
-
result:
|
|
64
|
+
result: o,
|
|
170
65
|
color: i.color
|
|
171
66
|
} : {
|
|
172
|
-
result:
|
|
67
|
+
result: o
|
|
173
68
|
};
|
|
174
69
|
};
|
|
175
|
-
var
|
|
176
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
177
|
-
(
|
|
178
|
-
return n && s &&
|
|
70
|
+
var Vt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Ft = (e, t, r, n) => {
|
|
71
|
+
for (var s = n > 1 ? void 0 : n ? Ht(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
72
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
73
|
+
return n && s && Vt(t, r, s), s;
|
|
179
74
|
}, A = (e, t) => (r, n) => t(r, n, e);
|
|
180
|
-
let
|
|
75
|
+
let le = class extends Y {
|
|
181
76
|
constructor(e, t, r, n, s, i) {
|
|
182
77
|
super(), this._sheetInterceptorService = e, this._themeService = t, this._sheetSkeletonManagerService = r, this._commandService = n, this._numfmtService = s, this._localeService = i, this._initInterceptorCellContent();
|
|
183
78
|
}
|
|
184
79
|
_initInterceptorCellContent() {
|
|
185
|
-
const e = new
|
|
80
|
+
const e = new _t();
|
|
186
81
|
this.disposeWithMe(
|
|
187
|
-
this._sheetInterceptorService.intercept(
|
|
82
|
+
this._sheetInterceptorService.intercept(Ke.CELL_CONTENT, {
|
|
188
83
|
handler: (t, r, n) => {
|
|
189
|
-
const s = r.unitId, i = r.subUnitId,
|
|
190
|
-
if (!
|
|
84
|
+
const s = r.unitId, i = r.subUnitId, o = this._numfmtService.getValue(s, i, r.row, r.col);
|
|
85
|
+
if (!o)
|
|
191
86
|
return n(t);
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
87
|
+
const a = t;
|
|
88
|
+
if (!a || a.t !== B.NUMBER)
|
|
194
89
|
return n(t);
|
|
195
90
|
let l = "";
|
|
196
91
|
const u = e.getValue(r.row, r.col);
|
|
197
|
-
if (u && u.parameters ===
|
|
92
|
+
if (u && u.parameters === a.v)
|
|
198
93
|
return n({ ...t, ...u.result });
|
|
199
|
-
const m =
|
|
94
|
+
const m = De(o.pattern, Number(a.v), this._localeService.getCurrentLocale());
|
|
200
95
|
if (l = m.result, !l)
|
|
201
96
|
return n(t);
|
|
202
|
-
const
|
|
97
|
+
const c = { v: l };
|
|
203
98
|
if (m.color) {
|
|
204
99
|
const f = this._themeService.getCurrentTheme()[`${m.color}500`];
|
|
205
|
-
f && (
|
|
100
|
+
f && (c.interceptorStyle = { cl: { rgb: f } });
|
|
206
101
|
}
|
|
207
102
|
return e.setValue(r.row, r.col, {
|
|
208
|
-
result:
|
|
209
|
-
parameters:
|
|
210
|
-
}), n({ ...t, ...
|
|
211
|
-
}
|
|
103
|
+
result: c,
|
|
104
|
+
parameters: a.v
|
|
105
|
+
}), n({ ...t, ...c });
|
|
106
|
+
},
|
|
107
|
+
priority: 10
|
|
212
108
|
})
|
|
213
109
|
), this.disposeWithMe(
|
|
214
110
|
this._commandService.onCommandExecuted((t) => {
|
|
@@ -216,8 +112,8 @@ let ie = class extends Y {
|
|
|
216
112
|
const r = t.params;
|
|
217
113
|
Object.keys(r.values).forEach((n) => {
|
|
218
114
|
r.values[n].ranges.forEach((i) => {
|
|
219
|
-
P.foreach(i, (
|
|
220
|
-
e.realDeleteValue(
|
|
115
|
+
P.foreach(i, (o, a) => {
|
|
116
|
+
e.realDeleteValue(o, a);
|
|
221
117
|
});
|
|
222
118
|
});
|
|
223
119
|
});
|
|
@@ -226,8 +122,8 @@ let ie = class extends Y {
|
|
|
226
122
|
), this.disposeWithMe(
|
|
227
123
|
K(
|
|
228
124
|
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
229
|
-
|
|
230
|
-
|
|
125
|
+
qe((t) => t == null ? void 0 : t.sheetId),
|
|
126
|
+
Rt()
|
|
231
127
|
).subscribe(() => {
|
|
232
128
|
e.reset();
|
|
233
129
|
})
|
|
@@ -235,70 +131,70 @@ let ie = class extends Y {
|
|
|
235
131
|
);
|
|
236
132
|
}
|
|
237
133
|
};
|
|
238
|
-
|
|
239
|
-
q(
|
|
240
|
-
A(0, S(
|
|
241
|
-
A(1, S(
|
|
242
|
-
A(2, S(
|
|
134
|
+
le = Ft([
|
|
135
|
+
q(V.Rendered, le),
|
|
136
|
+
A(0, S(Pe)),
|
|
137
|
+
A(1, S(Fe)),
|
|
138
|
+
A(2, S(Ye)),
|
|
243
139
|
A(3, S(O)),
|
|
244
140
|
A(4, S(H)),
|
|
245
|
-
A(5, S(
|
|
246
|
-
],
|
|
247
|
-
const
|
|
141
|
+
A(5, S(T))
|
|
142
|
+
], le);
|
|
143
|
+
const j = (e, t = 0) => {
|
|
248
144
|
var n;
|
|
249
|
-
return e && (n =
|
|
250
|
-
},
|
|
145
|
+
return e && (n = x.getInfo(e).maxDecimals) != null ? n : t;
|
|
146
|
+
}, _e = (e, t) => {
|
|
251
147
|
if (e && !t || !e && t)
|
|
252
148
|
return !1;
|
|
253
149
|
const r = (u) => u.reduce(
|
|
254
|
-
(m,
|
|
150
|
+
(m, c) => {
|
|
255
151
|
if (m.isEnd)
|
|
256
152
|
return m;
|
|
257
|
-
const f =
|
|
258
|
-
return
|
|
153
|
+
const f = c.value || c.num;
|
|
154
|
+
return c.type === "point" ? (m.isEnd = !0, m) : { ...m, result: m.result + f };
|
|
259
155
|
},
|
|
260
156
|
{ isEnd: !1, result: "" }
|
|
261
|
-
).result, n =
|
|
262
|
-
return i ===
|
|
263
|
-
},
|
|
157
|
+
).result, n = x.getInfo(e)._partitions, s = x.getInfo(t)._partitions, i = r(n[0].tokens), o = r(s[0].tokens), a = r(n[1].tokens), l = r(s[1].tokens);
|
|
158
|
+
return i === o && a === l && n[1].color === s[1].color;
|
|
159
|
+
}, ke = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), C = (e, t) => e.split(";").map((n) => /\.0?/.test(n) ? n.replace(
|
|
264
160
|
/\.0*/g,
|
|
265
|
-
`${t > 0 ? "." : ""}${
|
|
161
|
+
`${t > 0 ? "." : ""}${ke(Number(t || 0))}`
|
|
266
162
|
) : /0([^0]?)|0$/.test(n) ? n.replace(
|
|
267
163
|
/0([^0]+)|0$/,
|
|
268
|
-
`0${t > 0 ? "." : ""}${
|
|
269
|
-
) : n).join(";"),
|
|
164
|
+
`0${t > 0 ? "." : ""}${ke(Number(t || 0))}$1`
|
|
165
|
+
) : n).join(";"), Wt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), et = {
|
|
270
166
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
271
167
|
type: w.COMMAND,
|
|
272
168
|
handler: async (e) => {
|
|
273
|
-
const t = e.get(O), r = e.get(
|
|
169
|
+
const t = e.get(O), r = e.get(D), n = e.get(H), s = e.get(k), i = r.getSelections();
|
|
274
170
|
if (!i || !i.length)
|
|
275
171
|
return !1;
|
|
276
|
-
const
|
|
277
|
-
if (!
|
|
172
|
+
const o = Re(s);
|
|
173
|
+
if (!o)
|
|
278
174
|
return !1;
|
|
279
|
-
const { unitId:
|
|
175
|
+
const { unitId: a, subUnitId: l } = o;
|
|
280
176
|
let u = 0;
|
|
281
177
|
i.forEach((_) => {
|
|
282
178
|
P.foreach(_.range, (g, h) => {
|
|
283
|
-
const p = n.getValue(
|
|
179
|
+
const p = n.getValue(a, l, g, h);
|
|
284
180
|
if (!p)
|
|
285
181
|
return;
|
|
286
|
-
const v =
|
|
182
|
+
const v = j(p.pattern);
|
|
287
183
|
u = v > u ? v : u;
|
|
288
184
|
});
|
|
289
185
|
});
|
|
290
|
-
const m = u + 1,
|
|
186
|
+
const m = u + 1, c = C(`0${m > 0 ? ".0" : ""}`, m), f = [];
|
|
291
187
|
return i.forEach((_) => {
|
|
292
188
|
P.foreach(_.range, (g, h) => {
|
|
293
|
-
const p = n.getValue(
|
|
189
|
+
const p = n.getValue(a, l, g, h);
|
|
294
190
|
if (!p)
|
|
295
191
|
f.push({
|
|
296
192
|
row: g,
|
|
297
193
|
col: h,
|
|
298
|
-
pattern:
|
|
194
|
+
pattern: c
|
|
299
195
|
});
|
|
300
196
|
else {
|
|
301
|
-
const v =
|
|
197
|
+
const v = j(p.pattern), b = C(p.pattern, v + 1);
|
|
302
198
|
b !== p.pattern && f.push({
|
|
303
199
|
row: g,
|
|
304
200
|
col: h,
|
|
@@ -308,7 +204,7 @@ const D = (e, t = 0) => {
|
|
|
308
204
|
});
|
|
309
205
|
}), f.length ? await t.executeCommand($.id, { values: f }) : !1;
|
|
310
206
|
}
|
|
311
|
-
},
|
|
207
|
+
}, Gt = [
|
|
312
208
|
{
|
|
313
209
|
label: "1930-08-05",
|
|
314
210
|
suffix: "yyyy-MM-dd"
|
|
@@ -353,7 +249,7 @@ const D = (e, t = 0) => {
|
|
|
353
249
|
label: "08-05 下午 01:30",
|
|
354
250
|
suffix: "MM-dd A/P hh:mm"
|
|
355
251
|
}
|
|
356
|
-
],
|
|
252
|
+
], zt = [
|
|
357
253
|
{
|
|
358
254
|
label: "(1,235)",
|
|
359
255
|
suffix: "#,##0_);(#,##0)"
|
|
@@ -381,7 +277,7 @@ const D = (e, t = 0) => {
|
|
|
381
277
|
suffix: "#,##0.00_);[Red]-#,##0.00",
|
|
382
278
|
color: "red"
|
|
383
279
|
}
|
|
384
|
-
],
|
|
280
|
+
], tt = [
|
|
385
281
|
{
|
|
386
282
|
label: (e) => `${e}1,235`,
|
|
387
283
|
suffix: (e) => `"${e}"#,##0.00_);"${e}"#,##0.00`
|
|
@@ -409,53 +305,53 @@ const D = (e, t = 0) => {
|
|
|
409
305
|
suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
|
|
410
306
|
color: "red"
|
|
411
307
|
}
|
|
412
|
-
],
|
|
308
|
+
], nt = {
|
|
413
309
|
id: "sheet.command.numfmt.set.currency",
|
|
414
310
|
type: w.COMMAND,
|
|
415
311
|
handler: async (e) => {
|
|
416
|
-
const t = e.get(O), n = e.get(
|
|
312
|
+
const t = e.get(O), n = e.get(D).getSelections();
|
|
417
313
|
if (!n || !n.length)
|
|
418
314
|
return !1;
|
|
419
|
-
const s = [], i =
|
|
420
|
-
return n.forEach((
|
|
421
|
-
P.foreach(
|
|
315
|
+
const s = [], i = tt[0].suffix("¥");
|
|
316
|
+
return n.forEach((a) => {
|
|
317
|
+
P.foreach(a.range, (l, u) => {
|
|
422
318
|
s.push({ row: l, col: u, pattern: i, type: "currency" });
|
|
423
319
|
});
|
|
424
320
|
}), await t.executeCommand($.id, { values: s });
|
|
425
321
|
}
|
|
426
|
-
},
|
|
322
|
+
}, rt = {
|
|
427
323
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
428
324
|
type: w.COMMAND,
|
|
429
325
|
handler: async (e) => {
|
|
430
|
-
const t = e.get(O), r = e.get(
|
|
326
|
+
const t = e.get(O), r = e.get(D), n = e.get(H), s = e.get(k), i = r.getSelections();
|
|
431
327
|
if (!i || !i.length)
|
|
432
328
|
return !1;
|
|
433
|
-
const
|
|
434
|
-
if (!
|
|
329
|
+
const o = Re(s);
|
|
330
|
+
if (!o)
|
|
435
331
|
return !1;
|
|
436
|
-
const { unitId:
|
|
332
|
+
const { unitId: a, subUnitId: l } = o;
|
|
437
333
|
let u = 0;
|
|
438
334
|
i.forEach((g) => {
|
|
439
335
|
P.foreach(g.range, (h, p) => {
|
|
440
|
-
const v = n.getValue(
|
|
336
|
+
const v = n.getValue(a, l, h, p);
|
|
441
337
|
if (!v)
|
|
442
338
|
return;
|
|
443
|
-
const b =
|
|
339
|
+
const b = j(v.pattern);
|
|
444
340
|
u = b > u ? b : u;
|
|
445
341
|
});
|
|
446
342
|
});
|
|
447
|
-
const m = u - 1,
|
|
343
|
+
const m = u - 1, c = C(`0${m > 0 ? ".0" : "."}`, m), f = [];
|
|
448
344
|
return i.forEach((g) => {
|
|
449
345
|
P.foreach(g.range, (h, p) => {
|
|
450
|
-
const v = n.getValue(
|
|
346
|
+
const v = n.getValue(a, l, h, p);
|
|
451
347
|
if (!v)
|
|
452
348
|
f.push({
|
|
453
349
|
row: h,
|
|
454
350
|
col: p,
|
|
455
|
-
pattern:
|
|
351
|
+
pattern: c
|
|
456
352
|
});
|
|
457
353
|
else {
|
|
458
|
-
const b =
|
|
354
|
+
const b = j(v.pattern);
|
|
459
355
|
f.push({
|
|
460
356
|
row: h,
|
|
461
357
|
col: p,
|
|
@@ -465,21 +361,21 @@ const D = (e, t = 0) => {
|
|
|
465
361
|
});
|
|
466
362
|
}), await t.executeCommand($.id, { values: f });
|
|
467
363
|
}
|
|
468
|
-
},
|
|
364
|
+
}, Ie = {
|
|
469
365
|
id: "sheet.operation.close.numfmt.panel",
|
|
470
366
|
type: w.OPERATION,
|
|
471
367
|
handler: () => (
|
|
472
368
|
// do nothing,just notify panel is closed
|
|
473
369
|
!0
|
|
474
370
|
)
|
|
475
|
-
},
|
|
476
|
-
|
|
477
|
-
const
|
|
371
|
+
}, Ue = Mt("INumfmtController");
|
|
372
|
+
St(V.Rendered, Ue);
|
|
373
|
+
const pe = {
|
|
478
374
|
id: "sheet.operation.open.numfmt.panel",
|
|
479
375
|
type: w.OPERATION,
|
|
480
|
-
handler: (e) => (e.get(
|
|
376
|
+
handler: (e) => (e.get(Ue).openPanel(), !0)
|
|
481
377
|
};
|
|
482
|
-
var
|
|
378
|
+
var st = { exports: {} }, Se = {};
|
|
483
379
|
/**
|
|
484
380
|
* @license React
|
|
485
381
|
* react-jsx-runtime.production.min.js
|
|
@@ -489,23 +385,23 @@ var et = { exports: {} }, pe = {};
|
|
|
489
385
|
* This source code is licensed under the MIT license found in the
|
|
490
386
|
* LICENSE file in the root directory of this source tree.
|
|
491
387
|
*/
|
|
492
|
-
var
|
|
493
|
-
function
|
|
494
|
-
var n, s = {}, i = null,
|
|
495
|
-
r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (
|
|
388
|
+
var Kt = Lt, Yt = Symbol.for("react.element"), qt = Symbol.for("react.fragment"), Jt = Object.prototype.hasOwnProperty, Zt = Kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Qt = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
389
|
+
function it(e, t, r) {
|
|
390
|
+
var n, s = {}, i = null, o = null;
|
|
391
|
+
r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (o = t.ref);
|
|
496
392
|
for (n in t)
|
|
497
|
-
|
|
393
|
+
Jt.call(t, n) && !Qt.hasOwnProperty(n) && (s[n] = t[n]);
|
|
498
394
|
if (e && e.defaultProps)
|
|
499
395
|
for (n in t = e.defaultProps, t)
|
|
500
396
|
s[n] === void 0 && (s[n] = t[n]);
|
|
501
|
-
return { $$typeof:
|
|
397
|
+
return { $$typeof: Yt, type: e, key: i, ref: o, props: s, _owner: Zt.current };
|
|
502
398
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
var d =
|
|
508
|
-
const
|
|
399
|
+
Se.Fragment = qt;
|
|
400
|
+
Se.jsx = it;
|
|
401
|
+
Se.jsxs = it;
|
|
402
|
+
st.exports = Se;
|
|
403
|
+
var d = st.exports;
|
|
404
|
+
const Le = At([]), Ee = [
|
|
509
405
|
"$",
|
|
510
406
|
"£",
|
|
511
407
|
"¥",
|
|
@@ -534,12 +430,12 @@ const je = $t([]), Te = [
|
|
|
534
430
|
"₾",
|
|
535
431
|
"₿"
|
|
536
432
|
];
|
|
537
|
-
var
|
|
538
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
539
|
-
(
|
|
540
|
-
return n && s &&
|
|
541
|
-
},
|
|
542
|
-
let
|
|
433
|
+
var Xt = Object.defineProperty, en = Object.getOwnPropertyDescriptor, tn = (e, t, r, n) => {
|
|
434
|
+
for (var s = n > 1 ? void 0 : n ? en(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
435
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
436
|
+
return n && s && Xt(t, r, s), s;
|
|
437
|
+
}, nn = (e, t) => (r, n) => t(r, n, e);
|
|
438
|
+
let ve = class {
|
|
543
439
|
constructor(e) {
|
|
544
440
|
this._localStorageService = e;
|
|
545
441
|
}
|
|
@@ -564,17 +460,17 @@ let de = class {
|
|
|
564
460
|
async getHabit(e, t) {
|
|
565
461
|
const r = this._getKey(e), n = await this._localStorageService.getItem(r);
|
|
566
462
|
if (t && n) {
|
|
567
|
-
const s = n.map((i,
|
|
568
|
-
const l =
|
|
463
|
+
const s = n.map((i, o, a) => {
|
|
464
|
+
const l = a.length;
|
|
569
465
|
return {
|
|
570
466
|
value: i,
|
|
571
|
-
priority: l -
|
|
467
|
+
priority: l - o
|
|
572
468
|
};
|
|
573
469
|
});
|
|
574
|
-
return t.sort((i,
|
|
470
|
+
return t.sort((i, o) => {
|
|
575
471
|
var u, m;
|
|
576
|
-
const
|
|
577
|
-
return (((m = s.find((
|
|
472
|
+
const a = ((u = s.find((c) => c.value === i)) == null ? void 0 : u.priority) || -1;
|
|
473
|
+
return (((m = s.find((c) => c.value === o)) == null ? void 0 : m.priority) || -1) - a;
|
|
578
474
|
});
|
|
579
475
|
}
|
|
580
476
|
return n || [];
|
|
@@ -583,123 +479,123 @@ let de = class {
|
|
|
583
479
|
this._localStorageService.removeItem(e);
|
|
584
480
|
}
|
|
585
481
|
};
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
],
|
|
589
|
-
const
|
|
590
|
-
const t = N(
|
|
591
|
-
return
|
|
482
|
+
ve = tn([
|
|
483
|
+
nn(0, S(bt))
|
|
484
|
+
], ve);
|
|
485
|
+
const Ve = "numfmtCurrency", rn = (e) => {
|
|
486
|
+
const t = N(ve), [r, n] = I(Ee);
|
|
487
|
+
return Oe(() => {
|
|
592
488
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
593
|
-
t.getHabit(
|
|
489
|
+
t.getHabit(Ve, [...Ee]).then((i) => {
|
|
594
490
|
n(i), e && e(i);
|
|
595
491
|
});
|
|
596
492
|
});
|
|
597
493
|
}, []), { userHabitCurrency: r, mark: (i) => {
|
|
598
|
-
t.markHabit(
|
|
494
|
+
t.markHabit(Ve, i);
|
|
599
495
|
} };
|
|
600
|
-
},
|
|
601
|
-
const e =
|
|
602
|
-
return
|
|
496
|
+
}, sn = () => {
|
|
497
|
+
const e = Qe([]), [t, r] = I({});
|
|
498
|
+
return Oe(() => {
|
|
603
499
|
e.current.forEach((s) => {
|
|
604
500
|
s();
|
|
605
501
|
}), e.current = [];
|
|
606
502
|
}, [t]), (s) => {
|
|
607
503
|
e.current.push(s), r({});
|
|
608
504
|
};
|
|
609
|
-
},
|
|
610
|
-
const [t, r] =
|
|
505
|
+
}, oe = (e) => Ee.find((r) => e.includes(r)), on = (e) => !!oe(e) && e.startsWith("_("), cn = (e) => {
|
|
506
|
+
const [t, r] = I(() => j(e.defaultPattern || "", 2)), n = Xe(Le), [s, i] = I(() => oe(e.defaultPattern) || n[0]), o = R(() => n.map((c) => ({ label: c, value: c })), []), l = N(T).t;
|
|
611
507
|
e.action.current = () => C(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
|
|
612
|
-
const u = (
|
|
613
|
-
i(
|
|
614
|
-
}, m = (
|
|
615
|
-
const f =
|
|
508
|
+
const u = (c) => {
|
|
509
|
+
i(c), e.onChange(C(`_("${c}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
|
|
510
|
+
}, m = (c) => {
|
|
511
|
+
const f = c || 0;
|
|
616
512
|
r(f), e.onChange(C(`_("${s}"* #,##0${f > 0 ? ".0" : ""}_)`, f));
|
|
617
513
|
};
|
|
618
514
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
619
515
|
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
620
516
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
621
517
|
/* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.decimalLength") }),
|
|
622
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(
|
|
518
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(je, { value: t, max: 20, min: 0, onChange: m }) })
|
|
623
519
|
] }),
|
|
624
520
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
625
521
|
/* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.currencyType") }),
|
|
626
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(
|
|
522
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx($e, { onChange: u, options: o, value: s }) })
|
|
627
523
|
] })
|
|
628
524
|
] }),
|
|
629
525
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: l("sheet.numfmt.accountingDes") })
|
|
630
526
|
] });
|
|
631
|
-
},
|
|
527
|
+
}, Te = (e) => tt.map((t) => ({
|
|
632
528
|
label: t.label(e),
|
|
633
529
|
value: t.suffix(e),
|
|
634
530
|
color: t.color
|
|
635
|
-
})),
|
|
636
|
-
const r = N(
|
|
531
|
+
})), ot = () => Gt.map((e) => ({ label: e.label, value: e.suffix })), ct = () => zt.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), an = (e) => !!oe(e) && !e.startsWith("_("), ln = (e) => {
|
|
532
|
+
const r = N(T).t, n = Xe(Le), [s, i] = I(() => oe(e.defaultPattern) || n[0]), [o, a] = I(() => j(e.defaultPattern || "", 2)), [l, u] = I(() => {
|
|
637
533
|
var v;
|
|
638
|
-
const h =
|
|
639
|
-
return ((v = h.find((b) =>
|
|
640
|
-
}), m =
|
|
641
|
-
e.action.current = () => C(l,
|
|
534
|
+
const h = Te(s);
|
|
535
|
+
return ((v = h.find((b) => _e(b.value, e.defaultPattern))) == null ? void 0 : v.value) || h[0].value;
|
|
536
|
+
}), m = R(() => Te(s), [s]), c = R(() => n.map((h) => ({ label: h, value: h })), [n]);
|
|
537
|
+
e.action.current = () => C(l, o);
|
|
642
538
|
const f = (h) => {
|
|
643
539
|
i(h);
|
|
644
|
-
const p =
|
|
645
|
-
u(p), e.onChange(C(p,
|
|
540
|
+
const p = Te(h)[0].value;
|
|
541
|
+
u(p), e.onChange(C(p, o));
|
|
646
542
|
}, _ = (h) => {
|
|
647
|
-
u(h), e.onChange(C(h,
|
|
543
|
+
u(h), e.onChange(C(h, o));
|
|
648
544
|
}, g = (h) => {
|
|
649
|
-
|
|
545
|
+
a(h || 0), e.onChange(C(l, h || 0));
|
|
650
546
|
};
|
|
651
547
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
652
548
|
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
653
549
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
654
550
|
/* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
|
|
655
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(
|
|
551
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ d.jsx(je, { value: o, max: 20, min: 0, onChange: g }) })
|
|
656
552
|
] }),
|
|
657
553
|
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
658
554
|
/* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
|
|
659
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx(
|
|
555
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ d.jsx($e, { onChange: f, options: c, value: s }) })
|
|
660
556
|
] })
|
|
661
557
|
] }),
|
|
662
558
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
|
|
663
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
|
|
559
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: _, options: m, value: l }) }),
|
|
664
560
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
|
|
665
561
|
] });
|
|
562
|
+
}, un = (e) => {
|
|
563
|
+
const t = x.getInfo(e);
|
|
564
|
+
return ot().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
666
565
|
}, mn = (e) => {
|
|
667
|
-
const t = R.
|
|
668
|
-
return nt().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
669
|
-
}, dn = (e) => {
|
|
670
|
-
const t = E(nt, []), n = N(I).t, [s, i] = T(() => {
|
|
566
|
+
const t = R(ot, []), n = N(T).t, [s, i] = I(() => {
|
|
671
567
|
if (e.defaultPattern) {
|
|
672
|
-
const
|
|
673
|
-
if (
|
|
674
|
-
return
|
|
568
|
+
const a = t.find((l) => l.value === e.defaultPattern);
|
|
569
|
+
if (a)
|
|
570
|
+
return a.value;
|
|
675
571
|
}
|
|
676
572
|
return t[0].value;
|
|
677
573
|
});
|
|
678
574
|
e.action.current = () => s;
|
|
679
|
-
const
|
|
680
|
-
i(
|
|
575
|
+
const o = (a) => {
|
|
576
|
+
i(a), e.onChange(a);
|
|
681
577
|
};
|
|
682
578
|
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
683
579
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
|
|
684
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
|
|
580
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { value: s, options: t, onChange: o }) }),
|
|
685
581
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
|
|
686
582
|
] });
|
|
687
|
-
},
|
|
688
|
-
const r = N(
|
|
583
|
+
}, dn = (e) => !e, hn = (e) => {
|
|
584
|
+
const r = N(T).t;
|
|
689
585
|
return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
|
|
690
|
-
},
|
|
691
|
-
const t = N(
|
|
692
|
-
const
|
|
693
|
-
return (
|
|
694
|
-
}),
|
|
695
|
-
s(
|
|
696
|
-
}, m = (
|
|
697
|
-
s(
|
|
586
|
+
}, fn = (e) => ct().some((t) => _e(t.value, e)), pn = (e) => {
|
|
587
|
+
const t = N(T), r = R(ct, []), [n, s] = I(() => j(e.defaultPattern || "", 0)), [i, o] = I(() => {
|
|
588
|
+
const c = r.find((f) => _e(f.value, e.defaultPattern || ""));
|
|
589
|
+
return (c == null ? void 0 : c.value) || r[0].value;
|
|
590
|
+
}), a = R(() => C(i, Number(n || 0)), [i, n]), l = R(() => !Wt(i), [i]), u = (c) => {
|
|
591
|
+
s(c || 0), e.onChange(C(i, Number(c || 0)));
|
|
592
|
+
}, m = (c) => {
|
|
593
|
+
s(j(c, 0)), o(c), e.onChange(c);
|
|
698
594
|
};
|
|
699
|
-
return e.action.current = () =>
|
|
595
|
+
return e.action.current = () => a, /* @__PURE__ */ d.jsxs("div", { children: [
|
|
700
596
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
|
|
701
597
|
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
|
|
702
|
-
|
|
598
|
+
je,
|
|
703
599
|
{
|
|
704
600
|
disabled: l,
|
|
705
601
|
value: n,
|
|
@@ -712,79 +608,79 @@ const Le = "numfmtCurrency", sn = (e) => {
|
|
|
712
608
|
" ",
|
|
713
609
|
t.t("sheet.numfmt.negType")
|
|
714
610
|
] }),
|
|
715
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
|
|
611
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: m, options: r, value: i }) }),
|
|
716
612
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: t.t("sheet.numfmt.thousandthPercentileDes") })
|
|
717
613
|
] });
|
|
718
|
-
},
|
|
719
|
-
const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(
|
|
614
|
+
}, vn = (e) => {
|
|
615
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(T), o = Qe(() => ""), a = i.t, l = sn(), u = R(
|
|
720
616
|
() => [
|
|
721
|
-
{ label: "sheet.numfmt.general", component:
|
|
722
|
-
{ label: "sheet.numfmt.accounting", component:
|
|
723
|
-
{ label: "sheet.numfmt.currency", component:
|
|
724
|
-
{ label: "sheet.numfmt.date", component:
|
|
725
|
-
{ label: "sheet.numfmt.thousandthPercentile", component:
|
|
726
|
-
].map((y) => ({ ...y, label:
|
|
617
|
+
{ label: "sheet.numfmt.general", component: hn },
|
|
618
|
+
{ label: "sheet.numfmt.accounting", component: cn },
|
|
619
|
+
{ label: "sheet.numfmt.currency", component: ln },
|
|
620
|
+
{ label: "sheet.numfmt.date", component: mn },
|
|
621
|
+
{ label: "sheet.numfmt.thousandthPercentile", component: pn }
|
|
622
|
+
].map((y) => ({ ...y, label: a(y.label) })),
|
|
727
623
|
[]
|
|
728
|
-
), [m,
|
|
624
|
+
), [m, c] = I(v), [f, _] = I(() => `${n}_${s}`), { mark: g, userHabitCurrency: h } = rn(() => _(`${n}_${s}_userCurrency'`)), p = R(() => {
|
|
729
625
|
var y;
|
|
730
|
-
return (y = u.find((
|
|
626
|
+
return (y = u.find((U) => U.label === m)) == null ? void 0 : y.component;
|
|
731
627
|
}, [m]);
|
|
732
628
|
function v() {
|
|
733
|
-
return [
|
|
629
|
+
return [dn, on, an, un, fn].reduce((U, mt, dt) => U || (mt(r) ? u[dt].label : ""), "") || u[0].label;
|
|
734
630
|
}
|
|
735
631
|
const b = u.map((y) => ({
|
|
736
632
|
label: y.label,
|
|
737
633
|
value: y.label
|
|
738
|
-
})),
|
|
739
|
-
|
|
740
|
-
},
|
|
634
|
+
})), F = (y) => {
|
|
635
|
+
c(y), l(() => e.onChange({ type: "change", value: o.current() || "" }));
|
|
636
|
+
}, ce = (y) => {
|
|
741
637
|
e.onChange({ type: "change", value: y });
|
|
742
|
-
},
|
|
743
|
-
const y =
|
|
744
|
-
|
|
745
|
-
},
|
|
638
|
+
}, be = () => {
|
|
639
|
+
const y = o.current() || "", U = oe(y);
|
|
640
|
+
U && g(U), e.onChange({ type: "confirm", value: y });
|
|
641
|
+
}, ye = () => {
|
|
746
642
|
e.onChange({ type: "cancel", value: "" });
|
|
747
|
-
},
|
|
748
|
-
onChange:
|
|
643
|
+
}, Ce = {
|
|
644
|
+
onChange: ce,
|
|
749
645
|
defaultValue: t,
|
|
750
646
|
defaultPattern: r,
|
|
751
|
-
action:
|
|
647
|
+
action: o
|
|
752
648
|
};
|
|
753
|
-
return
|
|
754
|
-
|
|
649
|
+
return Oe(() => {
|
|
650
|
+
c(v()), _(`${n}_${s}`);
|
|
755
651
|
}, [n, s]), /* @__PURE__ */ d.jsxs("div", { className: "numfmt-panel p-b-20", children: [
|
|
756
652
|
/* @__PURE__ */ d.jsxs("div", { children: [
|
|
757
|
-
/* @__PURE__ */ d.jsx("div", { className: "label m-t-14", children:
|
|
758
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
|
|
759
|
-
/* @__PURE__ */ d.jsx("div", { children: p && /* @__PURE__ */ d.jsx(
|
|
653
|
+
/* @__PURE__ */ d.jsx("div", { className: "label m-t-14", children: a("sheet.numfmt.numfmtType") }),
|
|
654
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: F, options: b, value: m }) }),
|
|
655
|
+
/* @__PURE__ */ d.jsx("div", { children: p && /* @__PURE__ */ d.jsx(Le.Provider, { value: h, children: /* @__PURE__ */ Bt(p, { ...Ce, key: f }) }) })
|
|
760
656
|
] }),
|
|
761
657
|
/* @__PURE__ */ d.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
762
|
-
/* @__PURE__ */ d.jsx(
|
|
763
|
-
/* @__PURE__ */ d.jsx(
|
|
658
|
+
/* @__PURE__ */ d.jsx(Be, { size: "small", onClick: ye, className: "m-r-12", children: a("sheet.numfmt.cancel") }),
|
|
659
|
+
/* @__PURE__ */ d.jsx(Be, { type: "primary", size: "small", onClick: be, children: a("sheet.numfmt.confirm") })
|
|
764
660
|
] })
|
|
765
661
|
] });
|
|
766
|
-
},
|
|
662
|
+
}, at = {
|
|
767
663
|
id: "sheet.command.numfmt.set.percent",
|
|
768
664
|
type: w.COMMAND,
|
|
769
665
|
handler: async (e) => {
|
|
770
|
-
const t = e.get(O), n = e.get(
|
|
666
|
+
const t = e.get(O), n = e.get(D).getSelections();
|
|
771
667
|
if (!n || !n.length)
|
|
772
668
|
return !1;
|
|
773
669
|
const s = [], i = "0%";
|
|
774
|
-
return n.forEach((
|
|
775
|
-
P.foreach(
|
|
670
|
+
return n.forEach((a) => {
|
|
671
|
+
P.foreach(a.range, (l, u) => {
|
|
776
672
|
s.push({ row: l, col: u, pattern: i, type: "percent" });
|
|
777
673
|
});
|
|
778
674
|
}), await t.executeCommand($.id, { values: s });
|
|
779
675
|
}
|
|
780
676
|
};
|
|
781
|
-
var
|
|
782
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
783
|
-
(
|
|
784
|
-
return n && s &&
|
|
677
|
+
var gn = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, Sn = (e, t, r, n) => {
|
|
678
|
+
for (var s = n > 1 ? void 0 : n ? _n(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
679
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
680
|
+
return n && s && gn(t, r, s), s;
|
|
785
681
|
}, M = (e, t) => (r, n) => t(r, n, e);
|
|
786
|
-
let
|
|
787
|
-
constructor(t, r, n, s, i,
|
|
682
|
+
let ue = class extends Y {
|
|
683
|
+
constructor(t, r, n, s, i, o, a, l, u, m, c) {
|
|
788
684
|
super();
|
|
789
685
|
/**
|
|
790
686
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -792,15 +688,15 @@ let ce = class extends Y {
|
|
|
792
688
|
* @type {(string | null)}
|
|
793
689
|
* @memberof NumfmtController
|
|
794
690
|
*/
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._selectionManagerService =
|
|
691
|
+
L(this, "_previewPattern", "");
|
|
692
|
+
L(this, "_sidebarDisposable", null);
|
|
693
|
+
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._selectionManagerService = o, this._renderManagerService = a, this._numfmtService = l, this._componentManager = u, this._sidebarService = m, this._localeService = c, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener();
|
|
798
694
|
}
|
|
799
695
|
openPanel() {
|
|
800
|
-
const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService,
|
|
696
|
+
const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService, l = (r.getSelectionRanges() || [])[0];
|
|
801
697
|
if (!l)
|
|
802
698
|
return !1;
|
|
803
|
-
const u = s.getCurrentUnitForType(
|
|
699
|
+
const u = s.getCurrentUnitForType(E.UNIVER_SHEET), m = u.getActiveSheet(), c = m.getCellRaw(l.startRow, l.startColumn), f = i.getValue(
|
|
804
700
|
u.getUnitId(),
|
|
805
701
|
m.getSheetId(),
|
|
806
702
|
l.startRow,
|
|
@@ -808,104 +704,104 @@ let ce = class extends Y {
|
|
|
808
704
|
);
|
|
809
705
|
let _ = "";
|
|
810
706
|
f && (_ = f.pattern);
|
|
811
|
-
const g = (
|
|
707
|
+
const g = (c == null ? void 0 : c.t) === B.NUMBER ? c.v : 12345678, h = {
|
|
812
708
|
onChange: (p) => {
|
|
813
709
|
var v, b;
|
|
814
710
|
if (p.type === "change")
|
|
815
711
|
this._previewPattern = p.value, this._sheetSkeletonManagerService.reCalculate(), (b = (v = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : v.mainComponent) == null || b.makeDirty();
|
|
816
712
|
else if (p.type === "confirm") {
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
P.foreach(
|
|
820
|
-
|
|
821
|
-
row:
|
|
713
|
+
const F = r.getSelectionRanges() || [], ce = { values: [] }, be = fe(p.value);
|
|
714
|
+
F.forEach((ye) => {
|
|
715
|
+
P.foreach(ye, (Ce, y) => {
|
|
716
|
+
ce.values.push({
|
|
717
|
+
row: Ce,
|
|
822
718
|
col: y,
|
|
823
719
|
pattern: p.value,
|
|
824
|
-
type:
|
|
720
|
+
type: be
|
|
825
721
|
});
|
|
826
722
|
});
|
|
827
|
-
}), n.executeCommand($.id,
|
|
723
|
+
}), n.executeCommand($.id, ce), t.close();
|
|
828
724
|
} else
|
|
829
725
|
p.type === "cancel" && t.close();
|
|
830
726
|
},
|
|
831
727
|
value: { defaultPattern: _, defaultValue: g, row: l.startRow, col: l.startColumn }
|
|
832
728
|
};
|
|
833
729
|
return this._sidebarDisposable = t.open({
|
|
834
|
-
header: { title:
|
|
730
|
+
header: { title: o.t("sheet.numfmt.title") },
|
|
835
731
|
children: {
|
|
836
|
-
label:
|
|
732
|
+
label: Ne,
|
|
837
733
|
...h
|
|
838
734
|
// need passthrough to react props.
|
|
839
735
|
},
|
|
840
736
|
onClose: () => {
|
|
841
737
|
var p, v;
|
|
842
|
-
this._sheetSkeletonManagerService.reCalculate(), (v = (p = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : p.mainComponent) == null || v.makeDirty(), n.executeCommand(
|
|
738
|
+
this._sheetSkeletonManagerService.reCalculate(), (v = (p = this._renderManagerService.getRenderById(u.getUnitId())) == null ? void 0 : p.mainComponent) == null || v.makeDirty(), n.executeCommand(Ie.id);
|
|
843
739
|
}
|
|
844
740
|
}), !0;
|
|
845
741
|
}
|
|
846
742
|
_initCommands() {
|
|
847
743
|
[
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
744
|
+
et,
|
|
745
|
+
rt,
|
|
746
|
+
nt,
|
|
747
|
+
at,
|
|
748
|
+
pe,
|
|
749
|
+
Ie,
|
|
854
750
|
$
|
|
855
751
|
].forEach((t) => {
|
|
856
752
|
this.disposeWithMe(this._commandService.registerCommand(t));
|
|
857
753
|
});
|
|
858
754
|
}
|
|
859
755
|
_initPanel() {
|
|
860
|
-
this._componentManager.register(
|
|
756
|
+
this._componentManager.register(Ne, vn);
|
|
861
757
|
}
|
|
862
758
|
_initRealTimeRenderingInterceptor() {
|
|
863
759
|
const t = new G((n) => {
|
|
864
760
|
this._commandService.onCommandExecuted((s) => {
|
|
865
|
-
s.id ===
|
|
761
|
+
s.id === pe.id && n.next(!0), s.id === Ie.id && n.next(!1);
|
|
866
762
|
});
|
|
867
|
-
}), r =
|
|
763
|
+
}), r = Ut([
|
|
868
764
|
t,
|
|
869
765
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
870
|
-
|
|
766
|
+
qe((n) => n ? n.map((s) => s.range) : [])
|
|
871
767
|
)
|
|
872
768
|
]);
|
|
873
769
|
this.disposeWithMe(
|
|
874
770
|
K(
|
|
875
771
|
r.pipe(
|
|
876
|
-
|
|
772
|
+
Pt(
|
|
877
773
|
([n, s]) => new G((i) => {
|
|
878
|
-
const
|
|
879
|
-
return n && s.length && i.next({ selectionRanges: s, disposableCollection:
|
|
880
|
-
|
|
774
|
+
const o = new yt();
|
|
775
|
+
return n && s.length && i.next({ selectionRanges: s, disposableCollection: o }), () => {
|
|
776
|
+
o.dispose();
|
|
881
777
|
};
|
|
882
778
|
})
|
|
883
779
|
),
|
|
884
|
-
|
|
780
|
+
xt(() => {
|
|
885
781
|
this._previewPattern = null;
|
|
886
782
|
})
|
|
887
783
|
).subscribe(({ disposableCollection: n, selectionRanges: s }) => {
|
|
888
|
-
var
|
|
889
|
-
const i = this._univerInstanceService.getCurrentUnitForType(
|
|
784
|
+
var o, a;
|
|
785
|
+
const i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
890
786
|
this.openPanel(), n.add(
|
|
891
|
-
this._sheetInterceptorService.intercept(
|
|
787
|
+
this._sheetInterceptorService.intercept(Ke.CELL_CONTENT, {
|
|
892
788
|
priority: 99,
|
|
893
789
|
handler: (l, u, m) => {
|
|
894
|
-
const { row:
|
|
790
|
+
const { row: c, col: f } = u, _ = m(l) || {};
|
|
895
791
|
if (s.find(
|
|
896
|
-
(g) => g.startColumn <= f && g.endColumn >= f && g.startRow <=
|
|
792
|
+
(g) => g.startColumn <= f && g.endColumn >= f && g.startRow <= c && g.endRow >= c
|
|
897
793
|
)) {
|
|
898
|
-
const g = u.worksheet.getCellRaw(
|
|
794
|
+
const g = u.worksheet.getCellRaw(c, f), h = g == null ? void 0 : g.v, p = g == null ? void 0 : g.t;
|
|
899
795
|
if (h == null || p !== B.NUMBER || this._previewPattern === null)
|
|
900
796
|
return _;
|
|
901
|
-
const v =
|
|
797
|
+
const v = De(this._previewPattern, h, this._localeService.getCurrentLocale());
|
|
902
798
|
if (v.color) {
|
|
903
|
-
const
|
|
799
|
+
const F = this._themeService.getCurrentTheme()[`${v.color}500`];
|
|
904
800
|
return {
|
|
905
801
|
..._,
|
|
906
802
|
v: v.result,
|
|
907
803
|
t: B.STRING,
|
|
908
|
-
s: { cl: { rgb:
|
|
804
|
+
s: { cl: { rgb: F } }
|
|
909
805
|
};
|
|
910
806
|
}
|
|
911
807
|
return {
|
|
@@ -917,16 +813,16 @@ let ce = class extends Y {
|
|
|
917
813
|
return _;
|
|
918
814
|
}
|
|
919
815
|
})
|
|
920
|
-
), (
|
|
816
|
+
), (a = (o = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : o.mainComponent) == null || a.makeDirty();
|
|
921
817
|
})
|
|
922
818
|
)
|
|
923
819
|
);
|
|
924
820
|
}
|
|
925
821
|
_commandExecutedListener() {
|
|
926
|
-
const t = [
|
|
822
|
+
const t = [ge.id, J.id];
|
|
927
823
|
this.disposeWithMe(
|
|
928
824
|
K(
|
|
929
|
-
|
|
825
|
+
Ze(
|
|
930
826
|
new G((r) => {
|
|
931
827
|
const n = this._commandService.onCommandExecuted((s) => {
|
|
932
828
|
if (t.includes(s.id)) {
|
|
@@ -938,7 +834,7 @@ let ce = class extends Y {
|
|
|
938
834
|
n.dispose();
|
|
939
835
|
};
|
|
940
836
|
})
|
|
941
|
-
).pipe(
|
|
837
|
+
).pipe(Ot(16)).subscribe((r) => {
|
|
942
838
|
var n, s;
|
|
943
839
|
this._sheetSkeletonManagerService.reCalculate(), (s = (n = this._renderManagerService.getRenderById(r)) == null ? void 0 : n.mainComponent) == null || s.makeDirty();
|
|
944
840
|
})
|
|
@@ -946,46 +842,46 @@ let ce = class extends Y {
|
|
|
946
842
|
);
|
|
947
843
|
}
|
|
948
844
|
_initCloseListener() {
|
|
949
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
845
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(E.UNIVER_SHEET).subscribe((t) => {
|
|
950
846
|
var r;
|
|
951
847
|
t || ((r = this._sidebarDisposable) == null || r.dispose(), this._sidebarDisposable = null);
|
|
952
848
|
});
|
|
953
849
|
}
|
|
954
850
|
};
|
|
955
|
-
|
|
956
|
-
q(
|
|
957
|
-
M(0, S(
|
|
958
|
-
M(1, S(
|
|
959
|
-
M(2,
|
|
960
|
-
M(3, S(
|
|
851
|
+
ue = Sn([
|
|
852
|
+
q(V.Rendered, ue),
|
|
853
|
+
M(0, S(Pe)),
|
|
854
|
+
M(1, S(Fe)),
|
|
855
|
+
M(2, k),
|
|
856
|
+
M(3, S(Ye)),
|
|
961
857
|
M(4, O),
|
|
962
|
-
M(5, S(
|
|
963
|
-
M(6,
|
|
858
|
+
M(5, S(D)),
|
|
859
|
+
M(6, jt),
|
|
964
860
|
M(7, H),
|
|
965
|
-
M(8, S(
|
|
966
|
-
M(9,
|
|
967
|
-
M(10, S(
|
|
968
|
-
],
|
|
969
|
-
var
|
|
970
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
971
|
-
(
|
|
972
|
-
return n && s &&
|
|
973
|
-
},
|
|
861
|
+
M(8, S(Je)),
|
|
862
|
+
M(9, wt),
|
|
863
|
+
M(10, S(T))
|
|
864
|
+
], ue);
|
|
865
|
+
var bn = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, Cn = (e, t, r, n) => {
|
|
866
|
+
for (var s = n > 1 ? void 0 : n ? yn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
867
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
868
|
+
return n && s && bn(t, r, s), s;
|
|
869
|
+
}, W = (e, t) => (r, n) => t(r, n, e);
|
|
974
870
|
const In = () => {
|
|
975
871
|
let e = [];
|
|
976
872
|
return {
|
|
977
|
-
add: (s, i,
|
|
873
|
+
add: (s, i, o, a, l) => e.push({ unitId: s, subUnitId: i, row: o, col: a, value: l }),
|
|
978
874
|
getEffects: () => e,
|
|
979
875
|
clean: () => {
|
|
980
876
|
e = [];
|
|
981
877
|
}
|
|
982
878
|
};
|
|
983
879
|
};
|
|
984
|
-
let
|
|
880
|
+
let me = class extends Y {
|
|
985
881
|
constructor(t, r, n, s, i) {
|
|
986
882
|
super();
|
|
987
883
|
// collect effect mutations when edit end and push this to commands stack in next commands progress
|
|
988
|
-
|
|
884
|
+
L(this, "_collectEffectMutation", In());
|
|
989
885
|
this._sheetInterceptorService = t, this._numfmtService = r, this._univerInstanceService = n, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
|
|
990
886
|
}
|
|
991
887
|
_initInterceptorEditorStart() {
|
|
@@ -995,14 +891,14 @@ let ae = class extends Y {
|
|
|
995
891
|
this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
|
|
996
892
|
{
|
|
997
893
|
handler: (t, r, n) => {
|
|
998
|
-
const s = r.row, i = r.col,
|
|
894
|
+
const s = r.row, i = r.col, o = this._numfmtService.getValue(
|
|
999
895
|
r.unitId,
|
|
1000
896
|
r.subUnitId,
|
|
1001
897
|
s,
|
|
1002
898
|
i
|
|
1003
899
|
);
|
|
1004
|
-
if (
|
|
1005
|
-
switch (
|
|
900
|
+
if (o)
|
|
901
|
+
switch (fe(o.pattern)) {
|
|
1006
902
|
case "scientific":
|
|
1007
903
|
case "percent":
|
|
1008
904
|
case "currency":
|
|
@@ -1041,7 +937,7 @@ let ae = class extends Y {
|
|
|
1041
937
|
r.subUnitId,
|
|
1042
938
|
r.row,
|
|
1043
939
|
r.col
|
|
1044
|
-
), i = (m = s &&
|
|
940
|
+
), i = (m = s && fe(s.pattern)) != null ? m : "", o = () => {
|
|
1045
941
|
s && this._collectEffectMutation.add(
|
|
1046
942
|
r.unitId,
|
|
1047
943
|
r.subUnitId,
|
|
@@ -1052,10 +948,10 @@ let ae = class extends Y {
|
|
|
1052
948
|
};
|
|
1053
949
|
if (!(t != null && t.v))
|
|
1054
950
|
return n(t);
|
|
1055
|
-
const
|
|
951
|
+
const a = String(t.v), l = x.parseDate(a) || x.parseTime(a);
|
|
1056
952
|
if (!!l) {
|
|
1057
953
|
if (l && l.z) {
|
|
1058
|
-
const
|
|
954
|
+
const c = Number(l.v);
|
|
1059
955
|
return this._collectEffectMutation.add(
|
|
1060
956
|
r.unitId,
|
|
1061
957
|
r.subUnitId,
|
|
@@ -1064,10 +960,10 @@ let ae = class extends Y {
|
|
|
1064
960
|
{
|
|
1065
961
|
pattern: l.z
|
|
1066
962
|
}
|
|
1067
|
-
), { ...t, v:
|
|
963
|
+
), { ...t, v: c, t: B.NUMBER };
|
|
1068
964
|
}
|
|
1069
965
|
} else
|
|
1070
|
-
(["date", "time", "datetime"].includes(i) || !
|
|
966
|
+
(["date", "time", "datetime"].includes(i) || !Tn(a)) && o();
|
|
1071
967
|
return n(t);
|
|
1072
968
|
}
|
|
1073
969
|
}
|
|
@@ -1081,46 +977,46 @@ let ae = class extends Y {
|
|
|
1081
977
|
this._sheetInterceptorService.interceptCommand({
|
|
1082
978
|
getMutations(r) {
|
|
1083
979
|
switch (r.id) {
|
|
1084
|
-
case
|
|
1085
|
-
const n = t._univerInstanceService.getCurrentUnitForType(
|
|
1086
|
-
if (!
|
|
980
|
+
case Tt.id: {
|
|
981
|
+
const n = t._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET), s = n.getUnitId(), i = n.getActiveSheet().getSheetId(), o = t._collectEffectMutation.getEffects();
|
|
982
|
+
if (!o.length)
|
|
1087
983
|
return {
|
|
1088
984
|
redos: [],
|
|
1089
985
|
undos: []
|
|
1090
986
|
};
|
|
1091
|
-
const
|
|
987
|
+
const a = o.filter((c) => {
|
|
1092
988
|
var f;
|
|
1093
|
-
return !!((f =
|
|
1094
|
-
}).map((
|
|
1095
|
-
row:
|
|
1096
|
-
col:
|
|
1097
|
-
pattern:
|
|
1098
|
-
})), l =
|
|
989
|
+
return !!((f = c.value) != null && f.pattern);
|
|
990
|
+
}).map((c) => ({
|
|
991
|
+
row: c.row,
|
|
992
|
+
col: c.col,
|
|
993
|
+
pattern: c.value.pattern
|
|
994
|
+
})), l = o.filter((c) => {
|
|
1099
995
|
var f;
|
|
1100
|
-
return !((f =
|
|
1101
|
-
}).map((
|
|
1102
|
-
startRow:
|
|
1103
|
-
endColumn:
|
|
1104
|
-
startColumn:
|
|
1105
|
-
endRow:
|
|
996
|
+
return !((f = c.value) != null && f.pattern);
|
|
997
|
+
}).map((c) => ({
|
|
998
|
+
startRow: c.row,
|
|
999
|
+
endColumn: c.col,
|
|
1000
|
+
startColumn: c.col,
|
|
1001
|
+
endRow: c.row
|
|
1106
1002
|
})), u = [], m = [];
|
|
1107
|
-
if (
|
|
1108
|
-
const
|
|
1003
|
+
if (a) {
|
|
1004
|
+
const c = {
|
|
1109
1005
|
id: J.id,
|
|
1110
|
-
params:
|
|
1006
|
+
params: We(s, i, a)
|
|
1111
1007
|
};
|
|
1112
|
-
u.push(
|
|
1008
|
+
u.push(c), m.push(...Ge(t._injector, c.params));
|
|
1113
1009
|
}
|
|
1114
1010
|
if (l) {
|
|
1115
|
-
const
|
|
1116
|
-
id:
|
|
1011
|
+
const c = {
|
|
1012
|
+
id: ge.id,
|
|
1117
1013
|
params: {
|
|
1118
1014
|
unitId: s,
|
|
1119
1015
|
subUnitId: i,
|
|
1120
1016
|
ranges: l
|
|
1121
1017
|
}
|
|
1122
1018
|
};
|
|
1123
|
-
u.push(
|
|
1019
|
+
u.push(c), m.push(...ze(t._injector, c.params));
|
|
1124
1020
|
}
|
|
1125
1021
|
return {
|
|
1126
1022
|
redos: u,
|
|
@@ -1137,36 +1033,32 @@ let ae = class extends Y {
|
|
|
1137
1033
|
);
|
|
1138
1034
|
}
|
|
1139
1035
|
};
|
|
1140
|
-
|
|
1141
|
-
q(
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
],
|
|
1148
|
-
function
|
|
1036
|
+
me = Cn([
|
|
1037
|
+
q(V.Rendered, me),
|
|
1038
|
+
W(0, S(Pe)),
|
|
1039
|
+
W(1, S(H)),
|
|
1040
|
+
W(2, S(k)),
|
|
1041
|
+
W(3, S(xe)),
|
|
1042
|
+
W(4, S(Nt))
|
|
1043
|
+
], me);
|
|
1044
|
+
function Tn(e) {
|
|
1149
1045
|
return /^-?\d+(\.\d+)?$/.test(e);
|
|
1150
1046
|
}
|
|
1151
|
-
var
|
|
1152
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1153
|
-
(
|
|
1154
|
-
return n && s &&
|
|
1155
|
-
},
|
|
1156
|
-
let
|
|
1157
|
-
constructor(
|
|
1158
|
-
super();
|
|
1159
|
-
j(this, "_initLocal", () => {
|
|
1160
|
-
this._localeService.load({ zhCN: Vt, enUS: At });
|
|
1161
|
-
});
|
|
1162
|
-
this._localeService = t, this._initLocal();
|
|
1047
|
+
var Mn = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, En = (e, t, r, n) => {
|
|
1048
|
+
for (var s = n > 1 ? void 0 : n ? Nn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1049
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
1050
|
+
return n && s && Mn(t, r, s), s;
|
|
1051
|
+
}, Rn = (e, t) => (r, n) => t(r, n, e);
|
|
1052
|
+
let de = class extends Y {
|
|
1053
|
+
constructor(e) {
|
|
1054
|
+
super(), this._localeService = e;
|
|
1163
1055
|
}
|
|
1164
1056
|
};
|
|
1165
|
-
|
|
1166
|
-
q(
|
|
1167
|
-
|
|
1168
|
-
],
|
|
1169
|
-
const
|
|
1057
|
+
de = En([
|
|
1058
|
+
q(V.Rendered, de),
|
|
1059
|
+
Rn(0, S(T))
|
|
1060
|
+
], de);
|
|
1061
|
+
const he = [
|
|
1170
1062
|
{
|
|
1171
1063
|
label: "sheet.numfmt.general",
|
|
1172
1064
|
pattern: null
|
|
@@ -1219,30 +1111,30 @@ const le = [
|
|
|
1219
1111
|
label: "sheet.numfmt.moreFmt",
|
|
1220
1112
|
pattern: ""
|
|
1221
1113
|
}
|
|
1222
|
-
],
|
|
1114
|
+
], lt = "sheet.numfmt.moreNumfmtType", ut = "sheet.numfmt.moreNumfmtType.options", Pn = (e) => {
|
|
1223
1115
|
var n;
|
|
1224
|
-
const t = N(
|
|
1116
|
+
const t = N(T), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
|
|
1225
1117
|
return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children: r });
|
|
1226
|
-
},
|
|
1227
|
-
const e = N(O), t = N(
|
|
1118
|
+
}, xn = () => {
|
|
1119
|
+
const e = N(O), t = N(T), r = kt(), n = N(D), s = (a) => {
|
|
1228
1120
|
const l = n.getLast();
|
|
1229
1121
|
if (!l)
|
|
1230
1122
|
return;
|
|
1231
|
-
const u = r.get(
|
|
1123
|
+
const u = r.get($t), m = l.range, c = [];
|
|
1232
1124
|
P.foreach(m, (f, _) => {
|
|
1233
|
-
|
|
1234
|
-
}), e.executeCommand($.id, { values:
|
|
1235
|
-
}, i = (
|
|
1236
|
-
if (
|
|
1125
|
+
a ? c.push({ row: f, col: _, pattern: a, type: fe(a) }) : c.push({ row: f, col: _ });
|
|
1126
|
+
}), e.executeCommand($.id, { values: c }), u.focus();
|
|
1127
|
+
}, i = (a) => {
|
|
1128
|
+
if (a === 0)
|
|
1237
1129
|
s(null);
|
|
1238
|
-
else if (
|
|
1239
|
-
e.executeCommand(
|
|
1130
|
+
else if (a === he.length - 1)
|
|
1131
|
+
e.executeCommand(pe.id);
|
|
1240
1132
|
else {
|
|
1241
|
-
const l =
|
|
1133
|
+
const l = he[a];
|
|
1242
1134
|
l.pattern && s(l.pattern);
|
|
1243
1135
|
}
|
|
1244
|
-
},
|
|
1245
|
-
return /* @__PURE__ */ d.jsx("div", { className: "more-numfmt-type-options", children:
|
|
1136
|
+
}, o = 1220;
|
|
1137
|
+
return /* @__PURE__ */ d.jsx("div", { className: "more-numfmt-type-options", children: he.map((a, l) => a === "|" ? /* @__PURE__ */ d.jsx("div", { className: "line m-t-4", onClick: (u) => u.stopPropagation() }, l) : /* @__PURE__ */ d.jsxs(
|
|
1246
1138
|
"div",
|
|
1247
1139
|
{
|
|
1248
1140
|
className: "option-item m-t-4",
|
|
@@ -1250,70 +1142,70 @@ const le = [
|
|
|
1250
1142
|
i(l);
|
|
1251
1143
|
},
|
|
1252
1144
|
children: [
|
|
1253
|
-
/* @__PURE__ */ d.jsx("div", { children: t.t(
|
|
1254
|
-
/* @__PURE__ */ d.jsx("div", { className: "m-l-26", children:
|
|
1145
|
+
/* @__PURE__ */ d.jsx("div", { children: t.t(a.label) }),
|
|
1146
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-l-26", children: a.pattern ? De(a.pattern || "", o, t.getCurrentLocale()).result : "" })
|
|
1255
1147
|
]
|
|
1256
1148
|
},
|
|
1257
1149
|
l
|
|
1258
1150
|
)) });
|
|
1259
|
-
},
|
|
1151
|
+
}, On = (e) => ({
|
|
1260
1152
|
icon: "RmbSingle",
|
|
1261
|
-
id:
|
|
1153
|
+
id: nt.id,
|
|
1262
1154
|
title: "sheet.numfmt.currency",
|
|
1263
1155
|
tooltip: "sheet.numfmt.currency",
|
|
1264
|
-
type:
|
|
1265
|
-
group:
|
|
1266
|
-
positions: [
|
|
1267
|
-
hidden$:
|
|
1268
|
-
disabled$:
|
|
1156
|
+
type: ne.BUTTON,
|
|
1157
|
+
group: re.TOOLBAR_FORMULAS_INSERT,
|
|
1158
|
+
positions: [se.TOOLBAR_START],
|
|
1159
|
+
hidden$: ie(e, E.UNIVER_SHEET),
|
|
1160
|
+
disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
|
|
1269
1161
|
}), jn = (e) => ({
|
|
1270
1162
|
icon: "AddDigitsSingle",
|
|
1271
|
-
id:
|
|
1163
|
+
id: et.id,
|
|
1272
1164
|
title: "sheet.numfmt.addDecimal",
|
|
1273
1165
|
tooltip: "sheet.numfmt.addDecimal",
|
|
1274
|
-
type:
|
|
1275
|
-
positions: [
|
|
1276
|
-
group:
|
|
1277
|
-
hidden$:
|
|
1278
|
-
disabled$:
|
|
1166
|
+
type: ne.BUTTON,
|
|
1167
|
+
positions: [se.TOOLBAR_START],
|
|
1168
|
+
group: re.TOOLBAR_FORMULAS_INSERT,
|
|
1169
|
+
hidden$: ie(e, E.UNIVER_SHEET),
|
|
1170
|
+
disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
|
|
1279
1171
|
}), $n = (e) => ({
|
|
1280
1172
|
icon: "ReduceDigitsSingle",
|
|
1281
|
-
id:
|
|
1173
|
+
id: rt.id,
|
|
1282
1174
|
title: "sheet.numfmt.subtractDecimal",
|
|
1283
1175
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
1284
|
-
type:
|
|
1285
|
-
group:
|
|
1286
|
-
positions: [
|
|
1287
|
-
hidden$:
|
|
1288
|
-
disabled$:
|
|
1176
|
+
type: ne.BUTTON,
|
|
1177
|
+
group: re.TOOLBAR_FORMULAS_INSERT,
|
|
1178
|
+
positions: [se.TOOLBAR_START],
|
|
1179
|
+
hidden$: ie(e, E.UNIVER_SHEET),
|
|
1180
|
+
disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
|
|
1289
1181
|
}), wn = (e) => ({
|
|
1290
1182
|
icon: "PercentSingle",
|
|
1291
|
-
id:
|
|
1183
|
+
id: at.id,
|
|
1292
1184
|
title: "sheet.numfmt.percent",
|
|
1293
1185
|
tooltip: "sheet.numfmt.percent",
|
|
1294
|
-
type:
|
|
1295
|
-
group:
|
|
1296
|
-
positions: [
|
|
1297
|
-
hidden$:
|
|
1298
|
-
disabled$:
|
|
1299
|
-
}),
|
|
1300
|
-
const t = e.get(H), r = e.get(
|
|
1301
|
-
(u) =>
|
|
1186
|
+
type: ne.BUTTON,
|
|
1187
|
+
group: re.TOOLBAR_FORMULAS_INSERT,
|
|
1188
|
+
positions: [se.TOOLBAR_START],
|
|
1189
|
+
hidden$: ie(e, E.UNIVER_SHEET),
|
|
1190
|
+
disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [Q, X], rangeTypes: [ee] })
|
|
1191
|
+
}), Dn = (e) => {
|
|
1192
|
+
const t = e.get(H), r = e.get(k), n = e.get(O), s = e.get(T), i = e.get(D), o = Et(r, "", ({ workbook: a, worksheet: l }) => new G(
|
|
1193
|
+
(u) => Ze(
|
|
1302
1194
|
i.selectionMoveEnd$,
|
|
1303
1195
|
new G((m) => {
|
|
1304
|
-
const
|
|
1305
|
-
|
|
1196
|
+
const c = [ge.id, J.id], f = n.onCommandExecuted((_) => {
|
|
1197
|
+
c.includes(_.id) && m.next(null);
|
|
1306
1198
|
});
|
|
1307
1199
|
return () => f.dispose();
|
|
1308
1200
|
})
|
|
1309
1201
|
).subscribe(() => {
|
|
1310
1202
|
const m = i.getSelections();
|
|
1311
1203
|
if (m && m[0]) {
|
|
1312
|
-
const
|
|
1204
|
+
const c = m[0].range, f = c.startRow, _ = c.startColumn, g = t.getValue(a.getUnitId(), l.getSheetId(), f, _), h = g == null ? void 0 : g.pattern;
|
|
1313
1205
|
let p = s.t("sheet.numfmt.general");
|
|
1314
1206
|
if (h) {
|
|
1315
|
-
const v =
|
|
1316
|
-
(b) =>
|
|
1207
|
+
const v = he.filter((b) => typeof b == "object" && b.pattern).find(
|
|
1208
|
+
(b) => _e(h, b.pattern)
|
|
1317
1209
|
);
|
|
1318
1210
|
v && typeof v == "object" && v.pattern ? p = s.t(v.label) : p = s.t("sheet.numfmt.moreFmt");
|
|
1319
1211
|
}
|
|
@@ -1322,59 +1214,59 @@ const le = [
|
|
|
1322
1214
|
})
|
|
1323
1215
|
));
|
|
1324
1216
|
return {
|
|
1325
|
-
label:
|
|
1326
|
-
id:
|
|
1217
|
+
label: lt,
|
|
1218
|
+
id: pe.id,
|
|
1327
1219
|
tooltip: "sheet.numfmt.title",
|
|
1328
|
-
type:
|
|
1329
|
-
group:
|
|
1330
|
-
positions: [
|
|
1220
|
+
type: ne.SELECTOR,
|
|
1221
|
+
group: re.TOOLBAR_FORMULAS_INSERT,
|
|
1222
|
+
positions: [se.TOOLBAR_START],
|
|
1331
1223
|
selections: [
|
|
1332
1224
|
{
|
|
1333
1225
|
label: {
|
|
1334
|
-
name:
|
|
1226
|
+
name: ut,
|
|
1335
1227
|
hoverable: !1
|
|
1336
1228
|
}
|
|
1337
1229
|
}
|
|
1338
1230
|
],
|
|
1339
|
-
value$:
|
|
1340
|
-
hidden$:
|
|
1341
|
-
disabled$:
|
|
1231
|
+
value$: o,
|
|
1232
|
+
hidden$: ie(e, E.UNIVER_SHEET),
|
|
1233
|
+
disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [X, Q], rangeTypes: [ee] })
|
|
1342
1234
|
};
|
|
1343
1235
|
};
|
|
1344
|
-
var
|
|
1345
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1346
|
-
(
|
|
1347
|
-
return n && s &&
|
|
1348
|
-
},
|
|
1349
|
-
const
|
|
1236
|
+
var Un = Object.defineProperty, Ln = Object.getOwnPropertyDescriptor, An = (e, t, r, n) => {
|
|
1237
|
+
for (var s = n > 1 ? void 0 : n ? Ln(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1238
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
1239
|
+
return n && s && Un(t, r, s), s;
|
|
1240
|
+
}, Me = (e, t) => (r, n) => t(r, n, e);
|
|
1241
|
+
const Bn = {};
|
|
1350
1242
|
let z = class extends Y {
|
|
1351
1243
|
constructor(e, t, r, n) {
|
|
1352
1244
|
super(), this._config = e, this._injector = t, this._componentManager = r, this._menuService = n, this._initMenu();
|
|
1353
1245
|
}
|
|
1354
1246
|
_initMenu() {
|
|
1355
1247
|
const { menu: e = {} } = this._config;
|
|
1356
|
-
[wn, jn, $n,
|
|
1248
|
+
[wn, jn, $n, On, Dn].forEach((t) => {
|
|
1357
1249
|
this.disposeWithMe(this._menuService.addMenuItem(t(this._injector), e));
|
|
1358
|
-
}), this.disposeWithMe(this._componentManager.register(
|
|
1250
|
+
}), this.disposeWithMe(this._componentManager.register(lt, Pn)), this.disposeWithMe(this._componentManager.register(ut, xn));
|
|
1359
1251
|
}
|
|
1360
1252
|
};
|
|
1361
|
-
z =
|
|
1362
|
-
q(
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1253
|
+
z = An([
|
|
1254
|
+
q(V.Rendered, z),
|
|
1255
|
+
Me(1, S(xe)),
|
|
1256
|
+
Me(2, S(Je)),
|
|
1257
|
+
Me(3, S(Dt))
|
|
1366
1258
|
], z);
|
|
1367
|
-
var
|
|
1368
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1369
|
-
(
|
|
1370
|
-
return n && s &&
|
|
1371
|
-
},
|
|
1372
|
-
let
|
|
1259
|
+
var kn = Object.defineProperty, Vn = Object.getOwnPropertyDescriptor, Hn = (e, t, r, n) => {
|
|
1260
|
+
for (var s = n > 1 ? void 0 : n ? Vn(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
1261
|
+
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
1262
|
+
return n && s && kn(t, r, s), s;
|
|
1263
|
+
}, Fn = (e, t) => (r, n) => t(r, n, e), ae;
|
|
1264
|
+
let He = (ae = class extends Ct {
|
|
1373
1265
|
constructor(e = {}, t) {
|
|
1374
|
-
super(), this._config = e, this._injector = t, this._config =
|
|
1266
|
+
super(), this._config = e, this._injector = t, this._config = It.deepMerge({}, Bn, this._config);
|
|
1375
1267
|
}
|
|
1376
1268
|
onStarting() {
|
|
1377
|
-
this._injector.add([
|
|
1269
|
+
this._injector.add([Ue, { useClass: ue, lazy: !1 }]), this._injector.add([me]), this._injector.add([ve]), this._injector.add([le]), this._injector.add([de]), this._injector.add(
|
|
1378
1270
|
[
|
|
1379
1271
|
z,
|
|
1380
1272
|
{
|
|
@@ -1383,15 +1275,12 @@ let Ae = (se = class extends _t {
|
|
|
1383
1275
|
]
|
|
1384
1276
|
);
|
|
1385
1277
|
}
|
|
1386
|
-
},
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
],
|
|
1278
|
+
}, L(ae, "pluginName", Ne), L(ae, "type", E.UNIVER_SHEET), ae);
|
|
1279
|
+
He = Hn([
|
|
1280
|
+
Fn(1, S(xe))
|
|
1281
|
+
], He);
|
|
1390
1282
|
export {
|
|
1391
1283
|
$ as SetNumfmtCommand,
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
Oe as getPatternPreview,
|
|
1395
|
-
sr as ruRU,
|
|
1396
|
-
Vt as zhCN
|
|
1284
|
+
He as UniverSheetsNumfmtPlugin,
|
|
1285
|
+
De as getPatternPreview
|
|
1397
1286
|
};
|