@univerjs/sheets-numfmt 0.1.12 → 0.1.13-nightly.202406041140
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 +429 -537
- 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 +22 -21
- package/LICENSE +0 -176
- 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
|
|
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
|
|
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 ae = (e, t, r) => (ft(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { CommandType as k, ICommandService as O, IUniverInstanceService as A, IUndoRedoService as pt, sequenceExecute as vt, LocaleType as gt, Disposable as K, ObjectMatrix as _t, CellValueType as L, Range as x, toDisposable as z, OnLifecycle as Y, LifecycleStages as B, ThemeService as He, LocaleService as T, runOnLifecycle as St, ILocalStorageService as bt, UniverInstanceType as E, DisposableCollection as yt, Plugin as Ct, Tools as It, DependentOn as Tt } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as Re, transformCellsToRange as Fe, rangeMerge as Le, SetNumfmtMutation as q, factorySetNumfmtUndoMutation as We, RemoveNumfmtMutation as ge, factoryRemoveNumfmtUndoMutation as Ge, INTERCEPTOR_POINT as ze, SheetInterceptorService as xe, INumfmtService as V, SelectionManagerService as w, SetRangeValuesCommand as Mt, WorkbookEditablePermission as J, WorksheetEditPermission as Z, WorksheetSetCellStylePermission as Q, RangeProtectionPermissionEditPoint as X, UniverSheetsPlugin as Nt } from "@univerjs/sheets";
|
|
6
|
+
import { Inject as S, createIdentifier as Et, Injector as Pe } from "@wendellhu/redi";
|
|
7
|
+
import { SheetSkeletonManagerService as Ke, IEditorBridgeService as Rt, getCurrentRangeDisable$ as ee, deriveStateFromActiveSheet$ as xt, UniverSheetsUIPlugin as Pt } from "@univerjs/sheets-ui";
|
|
8
|
+
import { map as Ye, distinctUntilChanged as Ot, switchMap as jt, tap as $t, debounceTime as kt } from "rxjs/operators";
|
|
9
|
+
import P from "@univerjs/engine-numfmt";
|
|
10
|
+
import { IRenderManagerService as wt, ITextSelectionRenderManager as Ut } from "@univerjs/engine-render";
|
|
11
|
+
import { ComponentManager as qe, ISidebarService as Dt, MenuItemType as te, MenuGroup as ne, MenuPosition as re, getMenuHiddenObservable as se, IMenuService as Lt } from "@univerjs/ui";
|
|
12
|
+
import { Observable as W, combineLatest as At, merge as Je } from "rxjs";
|
|
13
|
+
import Bt, { createContext as Vt, useState as I, useEffect as Oe, useRef as Ze, useContext as Qe, useMemo as R, createElement as Ht } from "react";
|
|
14
|
+
import { InputNumber as je, Select as $e, SelectList as ke, Button as Ae } from "@univerjs/design";
|
|
15
|
+
import { useDependency as N, useInjector as Ft } from "@wendellhu/redi/react-bindings";
|
|
16
16
|
const $ = {
|
|
17
17
|
id: "sheet.command.numfmt.set.numfmt",
|
|
18
|
-
type:
|
|
18
|
+
type: k.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(A), 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: c } = i, l = t.values.filter((h) => !!h.pattern), u = t.values.filter((h) => !h.pattern), m = Fe(o, c, l), a = {
|
|
26
|
+
unitId: o,
|
|
27
|
+
subUnitId: c,
|
|
28
28
|
ranges: u.map((h) => ({
|
|
29
29
|
startColumn: h.col,
|
|
30
30
|
startRow: h.row,
|
|
@@ -35,168 +35,63 @@ 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 = Le(v.ranges);
|
|
39
39
|
}), f.push({
|
|
40
|
-
id:
|
|
40
|
+
id: q.id,
|
|
41
41
|
params: m
|
|
42
42
|
});
|
|
43
|
-
const h =
|
|
43
|
+
const h = We(e, m);
|
|
44
44
|
_.push(...h);
|
|
45
45
|
}
|
|
46
46
|
if (u.length) {
|
|
47
|
-
a.ranges =
|
|
48
|
-
id:
|
|
47
|
+
a.ranges = Le(a.ranges), f.push({
|
|
48
|
+
id: ge.id,
|
|
49
49
|
params: a
|
|
50
50
|
});
|
|
51
|
-
const h =
|
|
51
|
+
const h = Ge(e, a);
|
|
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", he = (e) => P.getInfo(e).type || "unknown", we = (e, t, r) => {
|
|
62
|
+
const n = P.getInfo(e), s = r === gt.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], o = P.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 =
|
|
177
|
-
(
|
|
178
|
-
return
|
|
179
|
-
},
|
|
180
|
-
let
|
|
70
|
+
var Wt = (e, t, r, n) => {
|
|
71
|
+
for (var s = t, i = e.length - 1, o; i >= 0; i--)
|
|
72
|
+
(o = e[i]) && (s = o(s) || s);
|
|
73
|
+
return s;
|
|
74
|
+
}, D = (e, t) => (r, n) => t(r, n, e);
|
|
75
|
+
let ce = class extends K {
|
|
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(ze.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 c = t;
|
|
88
|
+
if (!c || c.t !== L.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 === c.v)
|
|
198
93
|
return n({ ...t, ...u.result });
|
|
199
|
-
const m =
|
|
94
|
+
const m = we(o.pattern, Number(c.v), this._localeService.getCurrentLocale());
|
|
200
95
|
if (l = m.result, !l)
|
|
201
96
|
return n(t);
|
|
202
97
|
const a = { v: l };
|
|
@@ -206,28 +101,29 @@ let ie = class extends Y {
|
|
|
206
101
|
}
|
|
207
102
|
return e.setValue(r.row, r.col, {
|
|
208
103
|
result: a,
|
|
209
|
-
parameters:
|
|
104
|
+
parameters: c.v
|
|
210
105
|
}), n({ ...t, ...a });
|
|
211
|
-
}
|
|
106
|
+
},
|
|
107
|
+
priority: 10
|
|
212
108
|
})
|
|
213
109
|
), this.disposeWithMe(
|
|
214
110
|
this._commandService.onCommandExecuted((t) => {
|
|
215
|
-
if (t.id ===
|
|
111
|
+
if (t.id === q.id) {
|
|
216
112
|
const r = t.params;
|
|
217
113
|
Object.keys(r.values).forEach((n) => {
|
|
218
114
|
r.values[n].ranges.forEach((i) => {
|
|
219
|
-
|
|
220
|
-
e.realDeleteValue(
|
|
115
|
+
x.foreach(i, (o, c) => {
|
|
116
|
+
e.realDeleteValue(o, c);
|
|
221
117
|
});
|
|
222
118
|
});
|
|
223
119
|
});
|
|
224
120
|
}
|
|
225
121
|
})
|
|
226
122
|
), this.disposeWithMe(
|
|
227
|
-
|
|
123
|
+
z(
|
|
228
124
|
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
229
|
-
|
|
230
|
-
|
|
125
|
+
Ye((t) => t == null ? void 0 : t.sheetId),
|
|
126
|
+
Ot()
|
|
231
127
|
).subscribe(() => {
|
|
232
128
|
e.reset();
|
|
233
129
|
})
|
|
@@ -235,19 +131,19 @@ let ie = class extends Y {
|
|
|
235
131
|
);
|
|
236
132
|
}
|
|
237
133
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
],
|
|
247
|
-
const
|
|
134
|
+
ce = Wt([
|
|
135
|
+
Y(B.Rendered, ce),
|
|
136
|
+
D(0, S(xe)),
|
|
137
|
+
D(1, S(He)),
|
|
138
|
+
D(2, S(Ke)),
|
|
139
|
+
D(3, S(O)),
|
|
140
|
+
D(4, S(V)),
|
|
141
|
+
D(5, S(T))
|
|
142
|
+
], ce);
|
|
143
|
+
const j = (e, t = 0) => {
|
|
248
144
|
var n;
|
|
249
|
-
return e && (n =
|
|
250
|
-
},
|
|
145
|
+
return e && (n = P.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(
|
|
@@ -258,39 +154,39 @@ const D = (e, t = 0) => {
|
|
|
258
154
|
return a.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 = P.getInfo(e)._partitions, s = P.getInfo(t)._partitions, i = r(n[0].tokens), o = r(s[0].tokens), c = r(n[1].tokens), l = r(s[1].tokens);
|
|
158
|
+
return i === o && c === l && n[1].color === s[1].color;
|
|
159
|
+
}, Be = (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 ? "." : ""}${Be(Number(t || 0))}`
|
|
266
162
|
) : /0([^0]?)|0$/.test(n) ? n.replace(
|
|
267
163
|
/0([^0]+)|0$/,
|
|
268
|
-
`0${t > 0 ? "." : ""}${
|
|
269
|
-
) : n).join(";"), Gt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e),
|
|
164
|
+
`0${t > 0 ? "." : ""}${Be(Number(t || 0))}$1`
|
|
165
|
+
) : n).join(";"), Gt = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), Xe = {
|
|
270
166
|
id: "sheet.command.numfmt.add.decimal.command",
|
|
271
|
-
type:
|
|
167
|
+
type: k.COMMAND,
|
|
272
168
|
handler: async (e) => {
|
|
273
|
-
const t = e.get(O), r = e.get(
|
|
169
|
+
const t = e.get(O), r = e.get(w), n = e.get(V), s = e.get(A), 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: c, subUnitId: l } = o;
|
|
280
176
|
let u = 0;
|
|
281
177
|
i.forEach((_) => {
|
|
282
|
-
|
|
283
|
-
const p = n.getValue(
|
|
178
|
+
x.foreach(_.range, (g, h) => {
|
|
179
|
+
const p = n.getValue(c, 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
186
|
const m = u + 1, a = C(`0${m > 0 ? ".0" : ""}`, m), f = [];
|
|
291
187
|
return i.forEach((_) => {
|
|
292
|
-
|
|
293
|
-
const p = n.getValue(
|
|
188
|
+
x.foreach(_.range, (g, h) => {
|
|
189
|
+
const p = n.getValue(c, l, g, h);
|
|
294
190
|
if (!p)
|
|
295
191
|
f.push({
|
|
296
192
|
row: g,
|
|
@@ -298,7 +194,7 @@ const D = (e, t = 0) => {
|
|
|
298
194
|
pattern: a
|
|
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,
|
|
@@ -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
|
+
], et = [
|
|
385
281
|
{
|
|
386
282
|
label: (e) => `${e}1,235`,
|
|
387
283
|
suffix: (e) => `"${e}"#,##0.00_);"${e}"#,##0.00`
|
|
@@ -409,45 +305,45 @@ const D = (e, t = 0) => {
|
|
|
409
305
|
suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
|
|
410
306
|
color: "red"
|
|
411
307
|
}
|
|
412
|
-
],
|
|
308
|
+
], tt = {
|
|
413
309
|
id: "sheet.command.numfmt.set.currency",
|
|
414
|
-
type:
|
|
310
|
+
type: k.COMMAND,
|
|
415
311
|
handler: async (e) => {
|
|
416
|
-
const t = e.get(O), n = e.get(
|
|
312
|
+
const t = e.get(O), n = e.get(w).getSelections();
|
|
417
313
|
if (!n || !n.length)
|
|
418
314
|
return !1;
|
|
419
|
-
const s = [], i =
|
|
420
|
-
return n.forEach((
|
|
421
|
-
|
|
315
|
+
const s = [], i = et[0].suffix("¥");
|
|
316
|
+
return n.forEach((c) => {
|
|
317
|
+
x.foreach(c.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
|
+
}, nt = {
|
|
427
323
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
428
|
-
type:
|
|
324
|
+
type: k.COMMAND,
|
|
429
325
|
handler: async (e) => {
|
|
430
|
-
const t = e.get(O), r = e.get(
|
|
326
|
+
const t = e.get(O), r = e.get(w), n = e.get(V), s = e.get(A), 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: c, subUnitId: l } = o;
|
|
437
333
|
let u = 0;
|
|
438
334
|
i.forEach((g) => {
|
|
439
|
-
|
|
440
|
-
const v = n.getValue(
|
|
335
|
+
x.foreach(g.range, (h, p) => {
|
|
336
|
+
const v = n.getValue(c, 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
343
|
const m = u - 1, a = C(`0${m > 0 ? ".0" : "."}`, m), f = [];
|
|
448
344
|
return i.forEach((g) => {
|
|
449
|
-
|
|
450
|
-
const v = n.getValue(
|
|
345
|
+
x.foreach(g.range, (h, p) => {
|
|
346
|
+
const v = n.getValue(c, l, h, p);
|
|
451
347
|
if (!v)
|
|
452
348
|
f.push({
|
|
453
349
|
row: h,
|
|
@@ -455,7 +351,7 @@ const D = (e, t = 0) => {
|
|
|
455
351
|
pattern: a
|
|
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
|
-
type:
|
|
366
|
+
type: k.OPERATION,
|
|
471
367
|
handler: () => (
|
|
472
368
|
// do nothing,just notify panel is closed
|
|
473
369
|
!0
|
|
474
370
|
)
|
|
475
|
-
},
|
|
476
|
-
|
|
477
|
-
const
|
|
371
|
+
}, Ue = Et("INumfmtController");
|
|
372
|
+
St(B.Rendered, Ue);
|
|
373
|
+
const fe = {
|
|
478
374
|
id: "sheet.operation.open.numfmt.panel",
|
|
479
|
-
type:
|
|
480
|
-
handler: (e) => (e.get(
|
|
375
|
+
type: k.OPERATION,
|
|
376
|
+
handler: (e) => (e.get(Ue).openPanel(), !0)
|
|
481
377
|
};
|
|
482
|
-
var
|
|
378
|
+
var rt = { 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 Yt =
|
|
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 Yt = Bt, qt = Symbol.for("react.element"), Jt = Symbol.for("react.fragment"), Zt = Object.prototype.hasOwnProperty, Qt = Yt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Xt = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
389
|
+
function st(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
|
Zt.call(t, n) && !Xt.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: qt, type: e, key: i, ref:
|
|
397
|
+
return { $$typeof: qt, type: e, key: i, ref: o, props: s, _owner: Qt.current };
|
|
502
398
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
var d =
|
|
508
|
-
const
|
|
399
|
+
Se.Fragment = Jt;
|
|
400
|
+
Se.jsx = st;
|
|
401
|
+
Se.jsxs = st;
|
|
402
|
+
rt.exports = Se;
|
|
403
|
+
var d = rt.exports;
|
|
404
|
+
const De = Vt([]), Ee = [
|
|
509
405
|
"$",
|
|
510
406
|
"£",
|
|
511
407
|
"¥",
|
|
@@ -534,12 +430,12 @@ const je = $t([]), Te = [
|
|
|
534
430
|
"₾",
|
|
535
431
|
"₿"
|
|
536
432
|
];
|
|
537
|
-
var en =
|
|
538
|
-
for (var s =
|
|
539
|
-
(
|
|
540
|
-
return
|
|
541
|
-
},
|
|
542
|
-
let
|
|
433
|
+
var en = (e, t, r, n) => {
|
|
434
|
+
for (var s = t, i = e.length - 1, o; i >= 0; i--)
|
|
435
|
+
(o = e[i]) && (s = o(s) || s);
|
|
436
|
+
return s;
|
|
437
|
+
}, tn = (e, t) => (r, n) => t(r, n, e);
|
|
438
|
+
let pe = 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, c) => {
|
|
464
|
+
const l = c.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((a) => a.value ===
|
|
472
|
+
const c = ((u = s.find((a) => a.value === i)) == null ? void 0 : u.priority) || -1;
|
|
473
|
+
return (((m = s.find((a) => a.value === o)) == null ? void 0 : m.priority) || -1) - c;
|
|
578
474
|
});
|
|
579
475
|
}
|
|
580
476
|
return n || [];
|
|
@@ -583,31 +479,31 @@ 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
|
+
pe = en([
|
|
483
|
+
tn(0, S(bt))
|
|
484
|
+
], pe);
|
|
485
|
+
const Ve = "numfmtCurrency", nn = (e) => {
|
|
486
|
+
const t = N(pe), [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
|
+
}, rn = () => {
|
|
497
|
+
const e = Ze([]), [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
|
+
}, ie = (e) => Ee.find((r) => e.includes(r)), sn = (e) => !!ie(e) && e.startsWith("_("), on = (e) => {
|
|
506
|
+
const [t, r] = I(() => j(e.defaultPattern || "", 2)), n = Qe(De), [s, i] = I(() => ie(e.defaultPattern) || n[0]), o = R(() => n.map((a) => ({ label: a, value: a })), []), l = N(T).t;
|
|
611
507
|
e.action.current = () => C(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
|
|
612
508
|
const u = (a) => {
|
|
613
509
|
i(a), e.onChange(C(`_("${a}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
|
|
@@ -619,87 +515,87 @@ const Le = "numfmtCurrency", sn = (e) => {
|
|
|
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) => et.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
|
+
})), it = () => zt.map((e) => ({ label: e.label, value: e.suffix })), ot = () => Kt.map((e) => ({ label: e.label, value: e.suffix, color: e.color })), an = (e) => !!ie(e) && !e.startsWith("_("), cn = (e) => {
|
|
532
|
+
const r = N(T).t, n = Qe(De), [s, i] = I(() => ie(e.defaultPattern) || n[0]), [o, c] = 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]), a = 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
|
+
c(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: a, 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(ke, { onChange: _, options: m, value: l }) }),
|
|
664
560
|
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.currencyDes") })
|
|
665
561
|
] });
|
|
666
|
-
},
|
|
667
|
-
const t =
|
|
668
|
-
return
|
|
669
|
-
},
|
|
670
|
-
const t =
|
|
562
|
+
}, ln = (e) => {
|
|
563
|
+
const t = P.getInfo(e);
|
|
564
|
+
return it().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
565
|
+
}, un = (e) => {
|
|
566
|
+
const t = R(it, []), n = N(T).t, [s, i] = I(() => {
|
|
671
567
|
if (e.defaultPattern) {
|
|
672
|
-
const
|
|
673
|
-
if (
|
|
674
|
-
return
|
|
568
|
+
const c = t.find((l) => l.value === e.defaultPattern);
|
|
569
|
+
if (c)
|
|
570
|
+
return c.value;
|
|
675
571
|
}
|
|
676
572
|
return t[0].value;
|
|
677
573
|
});
|
|
678
574
|
e.action.current = () => s;
|
|
679
|
-
const
|
|
680
|
-
i(
|
|
575
|
+
const o = (c) => {
|
|
576
|
+
i(c), e.onChange(c);
|
|
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(ke, { 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
|
+
}, mn = (e) => !e, dn = (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 a = r.find((f) =>
|
|
586
|
+
}, hn = (e) => ot().some((t) => _e(t.value, e)), fn = (e) => {
|
|
587
|
+
const t = N(T), r = R(ot, []), [n, s] = I(() => j(e.defaultPattern || "", 0)), [i, o] = I(() => {
|
|
588
|
+
const a = r.find((f) => _e(f.value, e.defaultPattern || ""));
|
|
693
589
|
return (a == null ? void 0 : a.value) || r[0].value;
|
|
694
|
-
}),
|
|
590
|
+
}), c = R(() => C(i, Number(n || 0)), [i, n]), l = R(() => !Gt(i), [i]), u = (a) => {
|
|
695
591
|
s(a || 0), e.onChange(C(i, Number(a || 0)));
|
|
696
592
|
}, m = (a) => {
|
|
697
|
-
s(
|
|
593
|
+
s(j(a, 0)), o(a), e.onChange(a);
|
|
698
594
|
};
|
|
699
|
-
return e.action.current = () =>
|
|
595
|
+
return e.action.current = () => c, /* @__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(ke, { 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
|
+
}, pn = (e) => {
|
|
615
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: s } = e.value, i = N(T), o = Ze(() => ""), c = i.t, l = rn(), u = R(
|
|
720
616
|
() => [
|
|
721
|
-
{ label: "sheet.numfmt.general", component:
|
|
617
|
+
{ label: "sheet.numfmt.general", component: dn },
|
|
722
618
|
{ label: "sheet.numfmt.accounting", component: on },
|
|
723
|
-
{ label: "sheet.numfmt.currency", component:
|
|
724
|
-
{ label: "sheet.numfmt.date", component:
|
|
725
|
-
{ label: "sheet.numfmt.thousandthPercentile", component:
|
|
726
|
-
].map((y) => ({ ...y, label:
|
|
619
|
+
{ label: "sheet.numfmt.currency", component: cn },
|
|
620
|
+
{ label: "sheet.numfmt.date", component: un },
|
|
621
|
+
{ label: "sheet.numfmt.thousandthPercentile", component: fn }
|
|
622
|
+
].map((y) => ({ ...y, label: c(y.label) })),
|
|
727
623
|
[]
|
|
728
|
-
), [m, a] =
|
|
624
|
+
), [m, a] = I(v), [f, _] = I(() => `${n}_${s}`), { mark: g, userHabitCurrency: h } = nn(() => _(`${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 [mn, sn, an, ln, hn].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
|
-
a(y), l(() => e.onChange({ type: "change", value:
|
|
740
|
-
},
|
|
634
|
+
})), H = (y) => {
|
|
635
|
+
a(y), l(() => e.onChange({ type: "change", value: o.current() || "" }));
|
|
636
|
+
}, oe = (y) => {
|
|
741
637
|
e.onChange({ type: "change", value: y });
|
|
742
|
-
},
|
|
743
|
-
const y =
|
|
744
|
-
|
|
745
|
-
},
|
|
638
|
+
}, be = () => {
|
|
639
|
+
const y = o.current() || "", U = ie(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: oe,
|
|
749
645
|
defaultValue: t,
|
|
750
646
|
defaultPattern: r,
|
|
751
|
-
action:
|
|
647
|
+
action: o
|
|
752
648
|
};
|
|
753
|
-
return
|
|
649
|
+
return Oe(() => {
|
|
754
650
|
a(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: c("sheet.numfmt.numfmtType") }),
|
|
654
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx($e, { onChange: H, options: b, value: m }) }),
|
|
655
|
+
/* @__PURE__ */ d.jsx("div", { children: p && /* @__PURE__ */ d.jsx(De.Provider, { value: h, children: /* @__PURE__ */ Ht(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(Ae, { size: "small", onClick: ye, className: "m-r-12", children: c("sheet.numfmt.cancel") }),
|
|
659
|
+
/* @__PURE__ */ d.jsx(Ae, { type: "primary", size: "small", onClick: be, children: c("sheet.numfmt.confirm") })
|
|
764
660
|
] })
|
|
765
661
|
] });
|
|
766
|
-
},
|
|
662
|
+
}, at = {
|
|
767
663
|
id: "sheet.command.numfmt.set.percent",
|
|
768
|
-
type:
|
|
664
|
+
type: k.COMMAND,
|
|
769
665
|
handler: async (e) => {
|
|
770
|
-
const t = e.get(O), n = e.get(
|
|
666
|
+
const t = e.get(O), n = e.get(w).getSelections();
|
|
771
667
|
if (!n || !n.length)
|
|
772
668
|
return !1;
|
|
773
669
|
const s = [], i = "0%";
|
|
774
|
-
return n.forEach((
|
|
775
|
-
|
|
670
|
+
return n.forEach((c) => {
|
|
671
|
+
x.foreach(c.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 =
|
|
783
|
-
(
|
|
784
|
-
return
|
|
677
|
+
var vn = (e, t, r, n) => {
|
|
678
|
+
for (var s = t, i = e.length - 1, o; i >= 0; i--)
|
|
679
|
+
(o = e[i]) && (s = o(s) || s);
|
|
680
|
+
return s;
|
|
785
681
|
}, M = (e, t) => (r, n) => t(r, n, e);
|
|
786
|
-
let
|
|
787
|
-
constructor(t, r, n, s, i,
|
|
682
|
+
let le = class extends K {
|
|
683
|
+
constructor(t, r, n, s, i, o, c, l, u, m, a) {
|
|
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
|
+
ae(this, "_previewPattern", "");
|
|
692
|
+
ae(this, "_sidebarDisposable", null);
|
|
693
|
+
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._sheetSkeletonManagerService = s, this._commandService = i, this._selectionManagerService = o, this._renderManagerService = c, this._numfmtService = l, this._componentManager = u, this._sidebarService = m, this._localeService = a, 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(), a = m.getCellRaw(l.startRow, l.startColumn), f = i.getValue(
|
|
804
700
|
u.getUnitId(),
|
|
805
701
|
m.getSheetId(),
|
|
806
702
|
l.startRow,
|
|
@@ -808,87 +704,87 @@ let ce = class extends Y {
|
|
|
808
704
|
);
|
|
809
705
|
let _ = "";
|
|
810
706
|
f && (_ = f.pattern);
|
|
811
|
-
const g = (a == null ? void 0 : a.t) ===
|
|
707
|
+
const g = (a == null ? void 0 : a.t) === L.NUMBER ? a.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
|
-
|
|
820
|
-
|
|
821
|
-
row:
|
|
713
|
+
const H = r.getSelectionRanges() || [], oe = { values: [] }, be = he(p.value);
|
|
714
|
+
H.forEach((ye) => {
|
|
715
|
+
x.foreach(ye, (Ce, y) => {
|
|
716
|
+
oe.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, oe), 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
|
-
Je,
|
|
849
744
|
Xe,
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
745
|
+
nt,
|
|
746
|
+
tt,
|
|
747
|
+
at,
|
|
748
|
+
fe,
|
|
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, pn);
|
|
861
757
|
}
|
|
862
758
|
_initRealTimeRenderingInterceptor() {
|
|
863
|
-
const t = new
|
|
759
|
+
const t = new W((n) => {
|
|
864
760
|
this._commandService.onCommandExecuted((s) => {
|
|
865
|
-
s.id ===
|
|
761
|
+
s.id === fe.id && n.next(!0), s.id === Ie.id && n.next(!1);
|
|
866
762
|
});
|
|
867
|
-
}), r =
|
|
763
|
+
}), r = At([
|
|
868
764
|
t,
|
|
869
765
|
this._selectionManagerService.selectionMoveEnd$.pipe(
|
|
870
|
-
|
|
766
|
+
Ye((n) => n ? n.map((s) => s.range) : [])
|
|
871
767
|
)
|
|
872
768
|
]);
|
|
873
769
|
this.disposeWithMe(
|
|
874
|
-
|
|
770
|
+
z(
|
|
875
771
|
r.pipe(
|
|
876
|
-
|
|
877
|
-
([n, s]) => new
|
|
878
|
-
const
|
|
879
|
-
return n && s.length && i.next({ selectionRanges: s, disposableCollection:
|
|
880
|
-
|
|
772
|
+
jt(
|
|
773
|
+
([n, s]) => new W((i) => {
|
|
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
|
+
$t(() => {
|
|
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, c;
|
|
785
|
+
const i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
890
786
|
this.openPanel(), n.add(
|
|
891
|
-
this._sheetInterceptorService.intercept(
|
|
787
|
+
this._sheetInterceptorService.intercept(ze.CELL_CONTENT, {
|
|
892
788
|
priority: 99,
|
|
893
789
|
handler: (l, u, m) => {
|
|
894
790
|
const { row: a, col: f } = u, _ = m(l) || {};
|
|
@@ -896,38 +792,38 @@ let ce = class extends Y {
|
|
|
896
792
|
(g) => g.startColumn <= f && g.endColumn >= f && g.startRow <= a && g.endRow >= a
|
|
897
793
|
)) {
|
|
898
794
|
const g = u.worksheet.getCellRaw(a, f), h = g == null ? void 0 : g.v, p = g == null ? void 0 : g.t;
|
|
899
|
-
if (h == null || p !==
|
|
795
|
+
if (h == null || p !== L.NUMBER || this._previewPattern === null)
|
|
900
796
|
return _;
|
|
901
|
-
const v =
|
|
797
|
+
const v = we(this._previewPattern, h, this._localeService.getCurrentLocale());
|
|
902
798
|
if (v.color) {
|
|
903
|
-
const
|
|
799
|
+
const H = this._themeService.getCurrentTheme()[`${v.color}500`];
|
|
904
800
|
return {
|
|
905
801
|
..._,
|
|
906
802
|
v: v.result,
|
|
907
|
-
t:
|
|
908
|
-
s: { cl: { rgb:
|
|
803
|
+
t: L.STRING,
|
|
804
|
+
s: { cl: { rgb: H } }
|
|
909
805
|
};
|
|
910
806
|
}
|
|
911
807
|
return {
|
|
912
808
|
..._,
|
|
913
809
|
v: v.result,
|
|
914
|
-
t:
|
|
810
|
+
t: L.STRING
|
|
915
811
|
};
|
|
916
812
|
}
|
|
917
813
|
return _;
|
|
918
814
|
}
|
|
919
815
|
})
|
|
920
|
-
), (
|
|
816
|
+
), (c = (o = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : o.mainComponent) == null || c.makeDirty();
|
|
921
817
|
})
|
|
922
818
|
)
|
|
923
819
|
);
|
|
924
820
|
}
|
|
925
821
|
_commandExecutedListener() {
|
|
926
|
-
const t = [
|
|
822
|
+
const t = [ge.id, q.id];
|
|
927
823
|
this.disposeWithMe(
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
new
|
|
824
|
+
z(
|
|
825
|
+
Je(
|
|
826
|
+
new W((r) => {
|
|
931
827
|
const n = this._commandService.onCommandExecuted((s) => {
|
|
932
828
|
if (t.includes(s.id)) {
|
|
933
829
|
const i = s.params;
|
|
@@ -938,7 +834,7 @@ let ce = class extends Y {
|
|
|
938
834
|
n.dispose();
|
|
939
835
|
};
|
|
940
836
|
})
|
|
941
|
-
).pipe(
|
|
837
|
+
).pipe(kt(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,63 +842,63 @@ 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
|
-
|
|
957
|
-
M(0, S(
|
|
958
|
-
M(1, S(
|
|
959
|
-
M(2,
|
|
960
|
-
M(3, S(
|
|
851
|
+
le = vn([
|
|
852
|
+
Y(B.Rendered, le),
|
|
853
|
+
M(0, S(xe)),
|
|
854
|
+
M(1, S(He)),
|
|
855
|
+
M(2, A),
|
|
856
|
+
M(3, S(Ke)),
|
|
961
857
|
M(4, O),
|
|
962
|
-
M(5, S(
|
|
963
|
-
M(6,
|
|
964
|
-
M(7,
|
|
965
|
-
M(8, S(
|
|
966
|
-
M(9,
|
|
967
|
-
M(10, S(
|
|
968
|
-
],
|
|
969
|
-
var
|
|
970
|
-
for (var s =
|
|
971
|
-
(
|
|
972
|
-
return
|
|
973
|
-
},
|
|
974
|
-
const
|
|
858
|
+
M(5, S(w)),
|
|
859
|
+
M(6, wt),
|
|
860
|
+
M(7, V),
|
|
861
|
+
M(8, S(qe)),
|
|
862
|
+
M(9, Dt),
|
|
863
|
+
M(10, S(T))
|
|
864
|
+
], le);
|
|
865
|
+
var gn = (e, t, r, n) => {
|
|
866
|
+
for (var s = t, i = e.length - 1, o; i >= 0; i--)
|
|
867
|
+
(o = e[i]) && (s = o(s) || s);
|
|
868
|
+
return s;
|
|
869
|
+
}, F = (e, t) => (r, n) => t(r, n, e);
|
|
870
|
+
const _n = () => {
|
|
975
871
|
let e = [];
|
|
976
872
|
return {
|
|
977
|
-
add: (s, i,
|
|
873
|
+
add: (s, i, o, c, l) => e.push({ unitId: s, subUnitId: i, row: o, col: c, value: l }),
|
|
978
874
|
getEffects: () => e,
|
|
979
875
|
clean: () => {
|
|
980
876
|
e = [];
|
|
981
877
|
}
|
|
982
878
|
};
|
|
983
879
|
};
|
|
984
|
-
let
|
|
880
|
+
let ue = class extends K {
|
|
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
|
+
ae(this, "_collectEffectMutation", _n());
|
|
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() {
|
|
992
888
|
this.disposeWithMe(
|
|
993
|
-
|
|
889
|
+
z(
|
|
994
890
|
this._editorBridgeService.interceptor.intercept(
|
|
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 (he(o.pattern)) {
|
|
1006
902
|
case "scientific":
|
|
1007
903
|
case "percent":
|
|
1008
904
|
case "currency":
|
|
@@ -1029,7 +925,7 @@ let ae = class extends Y {
|
|
|
1029
925
|
*/
|
|
1030
926
|
_initInterceptorEditorEnd() {
|
|
1031
927
|
this.disposeWithMe(
|
|
1032
|
-
|
|
928
|
+
z(
|
|
1033
929
|
this._editorBridgeService.interceptor.intercept(
|
|
1034
930
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
|
|
1035
931
|
{
|
|
@@ -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 && he(s.pattern)) != null ? m : "", o = () => {
|
|
1045
941
|
s && this._collectEffectMutation.add(
|
|
1046
942
|
r.unitId,
|
|
1047
943
|
r.subUnitId,
|
|
@@ -1052,7 +948,7 @@ let ae = class extends Y {
|
|
|
1052
948
|
};
|
|
1053
949
|
if (!(t != null && t.v))
|
|
1054
950
|
return n(t);
|
|
1055
|
-
const
|
|
951
|
+
const c = String(t.v), l = P.parseDate(c) || P.parseTime(c);
|
|
1056
952
|
if (!!l) {
|
|
1057
953
|
if (l && l.z) {
|
|
1058
954
|
const a = Number(l.v);
|
|
@@ -1064,10 +960,10 @@ let ae = class extends Y {
|
|
|
1064
960
|
{
|
|
1065
961
|
pattern: l.z
|
|
1066
962
|
}
|
|
1067
|
-
), { ...t, v: a, t:
|
|
963
|
+
), { ...t, v: a, t: L.NUMBER };
|
|
1068
964
|
}
|
|
1069
965
|
} else
|
|
1070
|
-
(["date", "time", "datetime"].includes(i) || !
|
|
966
|
+
(["date", "time", "datetime"].includes(i) || !Sn(c)) && o();
|
|
1071
967
|
return n(t);
|
|
1072
968
|
}
|
|
1073
969
|
}
|
|
@@ -1081,21 +977,21 @@ 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 Mt.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 c = o.filter((a) => {
|
|
1092
988
|
var f;
|
|
1093
989
|
return !!((f = a.value) != null && f.pattern);
|
|
1094
990
|
}).map((a) => ({
|
|
1095
991
|
row: a.row,
|
|
1096
992
|
col: a.col,
|
|
1097
993
|
pattern: a.value.pattern
|
|
1098
|
-
})), l =
|
|
994
|
+
})), l = o.filter((a) => {
|
|
1099
995
|
var f;
|
|
1100
996
|
return !((f = a.value) != null && f.pattern);
|
|
1101
997
|
}).map((a) => ({
|
|
@@ -1104,23 +1000,23 @@ let ae = class extends Y {
|
|
|
1104
1000
|
startColumn: a.col,
|
|
1105
1001
|
endRow: a.row
|
|
1106
1002
|
})), u = [], m = [];
|
|
1107
|
-
if (
|
|
1003
|
+
if (c) {
|
|
1108
1004
|
const a = {
|
|
1109
|
-
id:
|
|
1110
|
-
params:
|
|
1005
|
+
id: q.id,
|
|
1006
|
+
params: Fe(s, i, c)
|
|
1111
1007
|
};
|
|
1112
|
-
u.push(a), m.push(...
|
|
1008
|
+
u.push(a), m.push(...We(t._injector, a.params));
|
|
1113
1009
|
}
|
|
1114
1010
|
if (l) {
|
|
1115
1011
|
const a = {
|
|
1116
|
-
id:
|
|
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(a), m.push(...
|
|
1019
|
+
u.push(a), m.push(...Ge(t._injector, a.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
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
],
|
|
1148
|
-
function
|
|
1036
|
+
ue = gn([
|
|
1037
|
+
Y(B.Rendered, ue),
|
|
1038
|
+
F(0, S(xe)),
|
|
1039
|
+
F(1, S(V)),
|
|
1040
|
+
F(2, S(A)),
|
|
1041
|
+
F(3, S(Pe)),
|
|
1042
|
+
F(4, S(Rt))
|
|
1043
|
+
], ue);
|
|
1044
|
+
function Sn(e) {
|
|
1149
1045
|
return /^-?\d+(\.\d+)?$/.test(e);
|
|
1150
1046
|
}
|
|
1151
|
-
var
|
|
1152
|
-
for (var s =
|
|
1153
|
-
(
|
|
1154
|
-
return
|
|
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 bn = (e, t, r, n) => {
|
|
1048
|
+
for (var s = t, i = e.length - 1, o; i >= 0; i--)
|
|
1049
|
+
(o = e[i]) && (s = o(s) || s);
|
|
1050
|
+
return s;
|
|
1051
|
+
}, yn = (e, t) => (r, n) => t(r, n, e);
|
|
1052
|
+
let me = class extends K {
|
|
1053
|
+
constructor(e) {
|
|
1054
|
+
super(), this._localeService = e;
|
|
1163
1055
|
}
|
|
1164
1056
|
};
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
],
|
|
1169
|
-
const
|
|
1057
|
+
me = bn([
|
|
1058
|
+
Y(B.Rendered, me),
|
|
1059
|
+
yn(0, S(T))
|
|
1060
|
+
], me);
|
|
1061
|
+
const de = [
|
|
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
|
+
], ct = "sheet.numfmt.moreNumfmtType", lt = "sheet.numfmt.moreNumfmtType.options", Cn = (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
|
+
}, In = () => {
|
|
1119
|
+
const e = N(O), t = N(T), r = Ft(), n = N(w), s = (c) => {
|
|
1228
1120
|
const l = n.getLast();
|
|
1229
1121
|
if (!l)
|
|
1230
1122
|
return;
|
|
1231
|
-
const u = r.get(
|
|
1232
|
-
|
|
1233
|
-
|
|
1123
|
+
const u = r.get(Ut), m = l.range, a = [];
|
|
1124
|
+
x.foreach(m, (f, _) => {
|
|
1125
|
+
c ? a.push({ row: f, col: _, pattern: c, type: he(c) }) : a.push({ row: f, col: _ });
|
|
1234
1126
|
}), e.executeCommand($.id, { values: a }), u.focus();
|
|
1235
|
-
}, i = (
|
|
1236
|
-
if (
|
|
1127
|
+
}, i = (c) => {
|
|
1128
|
+
if (c === 0)
|
|
1237
1129
|
s(null);
|
|
1238
|
-
else if (
|
|
1239
|
-
e.executeCommand(
|
|
1130
|
+
else if (c === de.length - 1)
|
|
1131
|
+
e.executeCommand(fe.id);
|
|
1240
1132
|
else {
|
|
1241
|
-
const l =
|
|
1133
|
+
const l = de[c];
|
|
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: de.map((c, l) => c === "|" ? /* @__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,58 +1142,58 @@ 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(c.label) }),
|
|
1146
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-l-26", children: c.pattern ? we(c.pattern || "", o, t.getCurrentLocale()).result : "" })
|
|
1255
1147
|
]
|
|
1256
1148
|
},
|
|
1257
1149
|
l
|
|
1258
1150
|
)) });
|
|
1259
|
-
},
|
|
1151
|
+
}, Tn = (e) => ({
|
|
1260
1152
|
icon: "RmbSingle",
|
|
1261
|
-
id:
|
|
1153
|
+
id: tt.id,
|
|
1262
1154
|
title: "sheet.numfmt.currency",
|
|
1263
1155
|
tooltip: "sheet.numfmt.currency",
|
|
1264
|
-
type:
|
|
1265
|
-
group:
|
|
1266
|
-
positions: [
|
|
1267
|
-
hidden$:
|
|
1268
|
-
disabled$:
|
|
1269
|
-
}),
|
|
1156
|
+
type: te.BUTTON,
|
|
1157
|
+
group: ne.TOOLBAR_FORMULAS_INSERT,
|
|
1158
|
+
positions: [re.TOOLBAR_START],
|
|
1159
|
+
hidden$: se(e, E.UNIVER_SHEET),
|
|
1160
|
+
disabled$: ee(e, { workbookTypes: [J], worksheetTypes: [Z, Q], rangeTypes: [X] })
|
|
1161
|
+
}), Mn = (e) => ({
|
|
1270
1162
|
icon: "AddDigitsSingle",
|
|
1271
|
-
id:
|
|
1163
|
+
id: Xe.id,
|
|
1272
1164
|
title: "sheet.numfmt.addDecimal",
|
|
1273
1165
|
tooltip: "sheet.numfmt.addDecimal",
|
|
1274
|
-
type:
|
|
1275
|
-
positions: [
|
|
1276
|
-
group:
|
|
1277
|
-
hidden$:
|
|
1278
|
-
disabled$:
|
|
1279
|
-
}),
|
|
1166
|
+
type: te.BUTTON,
|
|
1167
|
+
positions: [re.TOOLBAR_START],
|
|
1168
|
+
group: ne.TOOLBAR_FORMULAS_INSERT,
|
|
1169
|
+
hidden$: se(e, E.UNIVER_SHEET),
|
|
1170
|
+
disabled$: ee(e, { workbookTypes: [J], worksheetTypes: [Z, Q], rangeTypes: [X] })
|
|
1171
|
+
}), Nn = (e) => ({
|
|
1280
1172
|
icon: "ReduceDigitsSingle",
|
|
1281
|
-
id:
|
|
1173
|
+
id: nt.id,
|
|
1282
1174
|
title: "sheet.numfmt.subtractDecimal",
|
|
1283
1175
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
1284
|
-
type:
|
|
1285
|
-
group:
|
|
1286
|
-
positions: [
|
|
1287
|
-
hidden$:
|
|
1288
|
-
disabled$:
|
|
1289
|
-
}),
|
|
1176
|
+
type: te.BUTTON,
|
|
1177
|
+
group: ne.TOOLBAR_FORMULAS_INSERT,
|
|
1178
|
+
positions: [re.TOOLBAR_START],
|
|
1179
|
+
hidden$: se(e, E.UNIVER_SHEET),
|
|
1180
|
+
disabled$: ee(e, { workbookTypes: [J], worksheetTypes: [Z, Q], rangeTypes: [X] })
|
|
1181
|
+
}), En = (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(
|
|
1301
|
-
(u) =>
|
|
1186
|
+
type: te.BUTTON,
|
|
1187
|
+
group: ne.TOOLBAR_FORMULAS_INSERT,
|
|
1188
|
+
positions: [re.TOOLBAR_START],
|
|
1189
|
+
hidden$: se(e, E.UNIVER_SHEET),
|
|
1190
|
+
disabled$: ee(e, { workbookTypes: [J], worksheetTypes: [Z, Q], rangeTypes: [X] })
|
|
1191
|
+
}), Rn = (e) => {
|
|
1192
|
+
const t = e.get(V), r = e.get(A), n = e.get(O), s = e.get(T), i = e.get(w), o = xt(r, "", ({ workbook: c, worksheet: l }) => new W(
|
|
1193
|
+
(u) => Je(
|
|
1302
1194
|
i.selectionMoveEnd$,
|
|
1303
|
-
new
|
|
1304
|
-
const a = [
|
|
1195
|
+
new W((m) => {
|
|
1196
|
+
const a = [ge.id, q.id], f = n.onCommandExecuted((_) => {
|
|
1305
1197
|
a.includes(_.id) && m.next(null);
|
|
1306
1198
|
});
|
|
1307
1199
|
return () => f.dispose();
|
|
@@ -1309,11 +1201,11 @@ const le = [
|
|
|
1309
1201
|
).subscribe(() => {
|
|
1310
1202
|
const m = i.getSelections();
|
|
1311
1203
|
if (m && m[0]) {
|
|
1312
|
-
const a = m[0].range, f = a.startRow, _ = a.startColumn, g = t.getValue(
|
|
1204
|
+
const a = m[0].range, f = a.startRow, _ = a.startColumn, g = t.getValue(c.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 = de.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,76 +1214,76 @@ const le = [
|
|
|
1322
1214
|
})
|
|
1323
1215
|
));
|
|
1324
1216
|
return {
|
|
1325
|
-
label:
|
|
1326
|
-
id:
|
|
1217
|
+
label: ct,
|
|
1218
|
+
id: fe.id,
|
|
1327
1219
|
tooltip: "sheet.numfmt.title",
|
|
1328
|
-
type:
|
|
1329
|
-
group:
|
|
1330
|
-
positions: [
|
|
1220
|
+
type: te.SELECTOR,
|
|
1221
|
+
group: ne.TOOLBAR_FORMULAS_INSERT,
|
|
1222
|
+
positions: [re.TOOLBAR_START],
|
|
1331
1223
|
selections: [
|
|
1332
1224
|
{
|
|
1333
1225
|
label: {
|
|
1334
|
-
name:
|
|
1226
|
+
name: lt,
|
|
1335
1227
|
hoverable: !1
|
|
1336
1228
|
}
|
|
1337
1229
|
}
|
|
1338
1230
|
],
|
|
1339
|
-
value$:
|
|
1340
|
-
hidden$:
|
|
1341
|
-
disabled$:
|
|
1231
|
+
value$: o,
|
|
1232
|
+
hidden$: se(e, E.UNIVER_SHEET),
|
|
1233
|
+
disabled$: ee(e, { workbookTypes: [J], worksheetTypes: [Q, Z], rangeTypes: [X] })
|
|
1342
1234
|
};
|
|
1343
1235
|
};
|
|
1344
|
-
var
|
|
1345
|
-
for (var s =
|
|
1346
|
-
(
|
|
1347
|
-
return
|
|
1348
|
-
},
|
|
1349
|
-
const
|
|
1350
|
-
let
|
|
1236
|
+
var xn = (e, t, r, n) => {
|
|
1237
|
+
for (var s = t, i = e.length - 1, o; i >= 0; i--)
|
|
1238
|
+
(o = e[i]) && (s = o(s) || s);
|
|
1239
|
+
return s;
|
|
1240
|
+
}, Me = (e, t) => (r, n) => t(r, n, e);
|
|
1241
|
+
const Pn = {};
|
|
1242
|
+
let G = class extends K {
|
|
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
|
-
[
|
|
1248
|
+
[En, Mn, Nn, Tn, Rn].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(ct, Cn)), this.disposeWithMe(this._componentManager.register(lt, In));
|
|
1359
1251
|
}
|
|
1360
1252
|
};
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
],
|
|
1367
|
-
var
|
|
1368
|
-
for (var s =
|
|
1369
|
-
(
|
|
1370
|
-
return
|
|
1371
|
-
}, kn = (e, t) => (r, n) => t(r, n, e),
|
|
1372
|
-
let
|
|
1253
|
+
G = xn([
|
|
1254
|
+
Y(B.Rendered, G),
|
|
1255
|
+
Me(1, S(Pe)),
|
|
1256
|
+
Me(2, S(qe)),
|
|
1257
|
+
Me(3, S(Lt))
|
|
1258
|
+
], G);
|
|
1259
|
+
var On = Object.defineProperty, jn = (e, t, r) => t in e ? On(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, $n = (e, t, r, n) => {
|
|
1260
|
+
for (var s = t, i = e.length - 1, o; i >= 0; i--)
|
|
1261
|
+
(o = e[i]) && (s = o(s) || s);
|
|
1262
|
+
return s;
|
|
1263
|
+
}, kn = (e, t) => (r, n) => t(r, n, e), ut = (e, t, r) => (jn(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
1264
|
+
let ve = 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({}, Pn, this._config);
|
|
1375
1267
|
}
|
|
1376
1268
|
onStarting() {
|
|
1377
|
-
this._injector.add([
|
|
1269
|
+
this._injector.add([Ue, { useClass: le, lazy: !1 }]), this._injector.add([ue]), this._injector.add([pe]), this._injector.add([ce]), this._injector.add([me]), this._injector.add(
|
|
1378
1270
|
[
|
|
1379
|
-
|
|
1271
|
+
G,
|
|
1380
1272
|
{
|
|
1381
|
-
useFactory: () => this._injector.createInstance(
|
|
1273
|
+
useFactory: () => this._injector.createInstance(G, this._config)
|
|
1382
1274
|
}
|
|
1383
1275
|
]
|
|
1384
1276
|
);
|
|
1385
1277
|
}
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1278
|
+
};
|
|
1279
|
+
ut(ve, "pluginName", Ne);
|
|
1280
|
+
ut(ve, "type", E.UNIVER_SHEET);
|
|
1281
|
+
ve = $n([
|
|
1282
|
+
Tt(Nt, Pt),
|
|
1283
|
+
kn(1, S(Pe))
|
|
1284
|
+
], ve);
|
|
1390
1285
|
export {
|
|
1391
1286
|
$ as SetNumfmtCommand,
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
Oe as getPatternPreview,
|
|
1395
|
-
sr as ruRU,
|
|
1396
|
-
Vt as zhCN
|
|
1287
|
+
ve as UniverSheetsNumfmtPlugin,
|
|
1288
|
+
we as getPatternPreview
|
|
1397
1289
|
};
|