@univerjs/sheets-numfmt 0.1.11 → 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 +576 -782
- package/lib/index.css +1 -1
- 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/components/more-numfmt-type/MoreNumfmtType.d.ts +2 -0
- package/lib/types/controllers/numfmt.i18n.controller.d.ts +0 -1
- package/lib/types/controllers/numfmt.menu.controller.d.ts +7 -2
- package/lib/types/index.d.ts +0 -1
- package/lib/types/menu/menu.d.ts +6 -6
- package/lib/types/numfmt-plugin.d.ts +3 -1
- package/lib/umd/index.js +2 -2
- package/package.json +22 -21
- package/lib/types/locale/index.d.ts +0 -18
package/lib/es/index.js
CHANGED
|
@@ -1,233 +1,129 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { getSheetCommandTarget as Re, transformCellsToRange as We, rangeMerge 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 Je, ISidebarService as
|
|
12
|
-
import { Observable as
|
|
13
|
-
import
|
|
14
|
-
import { InputNumber as je, Select as $e, SelectList as we, Button 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
15
|
import { useDependency as N, useInjector as kt } from "@wendellhu/redi/react-bindings";
|
|
16
|
-
const
|
|
16
|
+
const $ = {
|
|
17
17
|
id: "sheet.command.numfmt.set.numfmt",
|
|
18
|
-
type:
|
|
18
|
+
type: w.COMMAND,
|
|
19
19
|
handler: (e, t) => {
|
|
20
20
|
if (!t)
|
|
21
21
|
return !1;
|
|
22
|
-
const r = 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:
|
|
28
|
-
ranges: u.map((
|
|
29
|
-
startColumn:
|
|
30
|
-
startRow:
|
|
31
|
-
endColumn:
|
|
32
|
-
endRow:
|
|
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
|
+
ranges: u.map((h) => ({
|
|
29
|
+
startColumn: h.col,
|
|
30
|
+
startRow: h.row,
|
|
31
|
+
endColumn: h.col,
|
|
32
|
+
endRow: h.row
|
|
33
33
|
}))
|
|
34
|
-
},
|
|
34
|
+
}, f = [], _ = [];
|
|
35
35
|
if (l.length) {
|
|
36
|
-
Object.keys(
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
}),
|
|
40
|
-
id:
|
|
41
|
-
params:
|
|
36
|
+
Object.keys(m.values).forEach((p) => {
|
|
37
|
+
const v = m.values[p];
|
|
38
|
+
v.ranges = Ae(v.ranges);
|
|
39
|
+
}), f.push({
|
|
40
|
+
id: J.id,
|
|
41
|
+
params: m
|
|
42
42
|
});
|
|
43
|
-
const
|
|
44
|
-
_.push(...
|
|
43
|
+
const h = Ge(e, m);
|
|
44
|
+
_.push(...h);
|
|
45
45
|
}
|
|
46
46
|
if (u.length) {
|
|
47
|
-
c.ranges =
|
|
48
|
-
id:
|
|
47
|
+
c.ranges = Ae(c.ranges), f.push({
|
|
48
|
+
id: ge.id,
|
|
49
49
|
params: c
|
|
50
50
|
});
|
|
51
|
-
const
|
|
52
|
-
_.push(...
|
|
51
|
+
const h = ze(e, c);
|
|
52
|
+
_.push(...h);
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
unitID:
|
|
54
|
+
const g = vt(f, r).result;
|
|
55
|
+
return g && s.pushUndoRedo({
|
|
56
|
+
unitID: o,
|
|
57
57
|
undoMutations: _,
|
|
58
|
-
redoMutations:
|
|
59
|
-
}),
|
|
58
|
+
redoMutations: f
|
|
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
|
-
}, zt = Ft, Wt = {
|
|
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
|
-
}, Kt = Wt, Gt = {
|
|
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
|
-
}, Ir = Gt, xe = "SHEET_NUMFMT_PLUGIN", pe = (e) => j.getInfo(e).type || "unknown", Le = (e, t, r) => {
|
|
167
|
-
const n = j.getInfo(e), s = r === yt.ZH_CN ? "zh-CN" : "en", i = n._partitions[1], a = j.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 &&
|
|
179
|
-
},
|
|
180
|
-
let le = class extends
|
|
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;
|
|
74
|
+
}, A = (e, t) => (r, n) => t(r, n, e);
|
|
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
|
|
200
|
-
if (l =
|
|
94
|
+
const m = De(o.pattern, Number(a.v), this._localeService.getCurrentLocale());
|
|
95
|
+
if (l = m.result, !l)
|
|
201
96
|
return n(t);
|
|
202
97
|
const c = { v: l };
|
|
203
|
-
if (
|
|
204
|
-
const
|
|
205
|
-
|
|
98
|
+
if (m.color) {
|
|
99
|
+
const f = this._themeService.getCurrentTheme()[`${m.color}500`];
|
|
100
|
+
f && (c.interceptorStyle = { cl: { rgb: f } });
|
|
206
101
|
}
|
|
207
102
|
return e.setValue(r.row, r.col, {
|
|
208
103
|
result: c,
|
|
209
|
-
parameters:
|
|
104
|
+
parameters: a.v
|
|
210
105
|
}), n({ ...t, ...c });
|
|
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 === J.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
|
+
P.foreach(i, (o, a) => {
|
|
116
|
+
e.realDeleteValue(o, a);
|
|
221
117
|
});
|
|
222
118
|
});
|
|
223
119
|
});
|
|
224
120
|
}
|
|
225
121
|
})
|
|
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,80 +131,80 @@ let le = class extends X {
|
|
|
235
131
|
);
|
|
236
132
|
}
|
|
237
133
|
};
|
|
238
|
-
le =
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
134
|
+
le = Ft([
|
|
135
|
+
q(V.Rendered, le),
|
|
136
|
+
A(0, S(Pe)),
|
|
137
|
+
A(1, S(Fe)),
|
|
138
|
+
A(2, S(Ye)),
|
|
139
|
+
A(3, S(O)),
|
|
140
|
+
A(4, S(H)),
|
|
141
|
+
A(5, S(T))
|
|
246
142
|
], le);
|
|
247
|
-
const
|
|
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
|
-
(
|
|
255
|
-
if (
|
|
256
|
-
return
|
|
257
|
-
const
|
|
258
|
-
return c.type === "point" ? (
|
|
150
|
+
(m, c) => {
|
|
151
|
+
if (m.isEnd)
|
|
152
|
+
return m;
|
|
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
|
-
type:
|
|
167
|
+
type: w.COMMAND,
|
|
272
168
|
handler: async (e) => {
|
|
273
|
-
const t = 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
|
-
|
|
283
|
-
const p = n.getValue(
|
|
178
|
+
P.foreach(_.range, (g, h) => {
|
|
179
|
+
const p = n.getValue(a, l, g, h);
|
|
284
180
|
if (!p)
|
|
285
181
|
return;
|
|
286
|
-
const
|
|
287
|
-
u =
|
|
182
|
+
const v = j(p.pattern);
|
|
183
|
+
u = v > u ? v : u;
|
|
288
184
|
});
|
|
289
185
|
});
|
|
290
|
-
const
|
|
186
|
+
const m = u + 1, c = C(`0${m > 0 ? ".0" : ""}`, m), f = [];
|
|
291
187
|
return i.forEach((_) => {
|
|
292
|
-
|
|
293
|
-
const p = n.getValue(
|
|
188
|
+
P.foreach(_.range, (g, h) => {
|
|
189
|
+
const p = n.getValue(a, l, g, h);
|
|
294
190
|
if (!p)
|
|
295
|
-
|
|
296
|
-
row:
|
|
297
|
-
col:
|
|
191
|
+
f.push({
|
|
192
|
+
row: g,
|
|
193
|
+
col: h,
|
|
298
194
|
pattern: c
|
|
299
195
|
});
|
|
300
196
|
else {
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
row:
|
|
304
|
-
col:
|
|
305
|
-
pattern:
|
|
197
|
+
const v = j(p.pattern), b = C(p.pattern, v + 1);
|
|
198
|
+
b !== p.pattern && f.push({
|
|
199
|
+
row: g,
|
|
200
|
+
col: h,
|
|
201
|
+
pattern: b
|
|
306
202
|
});
|
|
307
203
|
}
|
|
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 L = (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)"
|
|
@@ -411,75 +307,75 @@ const L = (e, t = 0) => {
|
|
|
411
307
|
}
|
|
412
308
|
], nt = {
|
|
413
309
|
id: "sheet.command.numfmt.set.currency",
|
|
414
|
-
type:
|
|
310
|
+
type: w.COMMAND,
|
|
415
311
|
handler: async (e) => {
|
|
416
|
-
const t = e.get(
|
|
312
|
+
const t = e.get(O), n = e.get(D).getSelections();
|
|
417
313
|
if (!n || !n.length)
|
|
418
314
|
return !1;
|
|
419
315
|
const s = [], i = tt[0].suffix("¥");
|
|
420
|
-
return n.forEach((
|
|
421
|
-
|
|
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
|
-
}), await t.executeCommand(
|
|
320
|
+
}), await t.executeCommand($.id, { values: s });
|
|
425
321
|
}
|
|
426
322
|
}, rt = {
|
|
427
323
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
428
|
-
type:
|
|
324
|
+
type: w.COMMAND,
|
|
429
325
|
handler: async (e) => {
|
|
430
|
-
const t = 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
|
-
i.forEach((
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
if (!
|
|
334
|
+
i.forEach((g) => {
|
|
335
|
+
P.foreach(g.range, (h, p) => {
|
|
336
|
+
const v = n.getValue(a, l, h, p);
|
|
337
|
+
if (!v)
|
|
442
338
|
return;
|
|
443
|
-
const
|
|
444
|
-
u =
|
|
339
|
+
const b = j(v.pattern);
|
|
340
|
+
u = b > u ? b : u;
|
|
445
341
|
});
|
|
446
342
|
});
|
|
447
|
-
const
|
|
448
|
-
return i.forEach((
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
if (!
|
|
452
|
-
|
|
453
|
-
row:
|
|
343
|
+
const m = u - 1, c = C(`0${m > 0 ? ".0" : "."}`, m), f = [];
|
|
344
|
+
return i.forEach((g) => {
|
|
345
|
+
P.foreach(g.range, (h, p) => {
|
|
346
|
+
const v = n.getValue(a, l, h, p);
|
|
347
|
+
if (!v)
|
|
348
|
+
f.push({
|
|
349
|
+
row: h,
|
|
454
350
|
col: p,
|
|
455
351
|
pattern: c
|
|
456
352
|
});
|
|
457
353
|
else {
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
row:
|
|
354
|
+
const b = j(v.pattern);
|
|
355
|
+
f.push({
|
|
356
|
+
row: h,
|
|
461
357
|
col: p,
|
|
462
|
-
pattern:
|
|
358
|
+
pattern: C(v.pattern, b - 1)
|
|
463
359
|
});
|
|
464
360
|
}
|
|
465
361
|
});
|
|
466
|
-
}), await t.executeCommand(
|
|
362
|
+
}), await t.executeCommand($.id, { values: f });
|
|
467
363
|
}
|
|
468
364
|
}, Ie = {
|
|
469
365
|
id: "sheet.operation.close.numfmt.panel",
|
|
470
|
-
type:
|
|
366
|
+
type: w.OPERATION,
|
|
471
367
|
handler: () => (
|
|
472
368
|
// do nothing,just notify panel is closed
|
|
473
369
|
!0
|
|
474
370
|
)
|
|
475
|
-
}, Ue =
|
|
476
|
-
|
|
477
|
-
const
|
|
371
|
+
}, Ue = Mt("INumfmtController");
|
|
372
|
+
St(V.Rendered, Ue);
|
|
373
|
+
const pe = {
|
|
478
374
|
id: "sheet.operation.open.numfmt.panel",
|
|
479
|
-
type:
|
|
375
|
+
type: w.OPERATION,
|
|
480
376
|
handler: (e) => (e.get(Ue).openPanel(), !0)
|
|
481
377
|
};
|
|
482
|
-
var st = { exports: {} },
|
|
378
|
+
var st = { exports: {} }, Se = {};
|
|
483
379
|
/**
|
|
484
380
|
* @license React
|
|
485
381
|
* react-jsx-runtime.production.min.js
|
|
@@ -489,23 +385,23 @@ var st = { exports: {} }, Ce = {};
|
|
|
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
|
|
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 };
|
|
493
389
|
function it(e, t, r) {
|
|
494
|
-
var n, s = {}, i = null,
|
|
495
|
-
r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (
|
|
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
|
-
st.exports =
|
|
507
|
-
var
|
|
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 Ae = Bt([]), Ne = [
|
|
|
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 ge = 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,
|
|
575
|
-
var u,
|
|
576
|
-
const
|
|
577
|
-
return (((
|
|
470
|
+
return t.sort((i, o) => {
|
|
471
|
+
var u, m;
|
|
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,122 +479,122 @@ let ge = 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] =
|
|
611
|
-
e.action.current = () =>
|
|
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;
|
|
507
|
+
e.action.current = () => C(`_("${s}"* #,##0${t > 0 ? ".0" : ""}_)`, t);
|
|
612
508
|
const u = (c) => {
|
|
613
|
-
i(c), e.onChange(
|
|
614
|
-
},
|
|
615
|
-
const
|
|
616
|
-
r(
|
|
509
|
+
i(c), e.onChange(C(`_("${c}"* #,##0${t > 0 ? ".0" : ""}_)`, t));
|
|
510
|
+
}, m = (c) => {
|
|
511
|
+
const f = c || 0;
|
|
512
|
+
r(f), e.onChange(C(`_("${s}"* #,##0${f > 0 ? ".0" : ""}_)`, f));
|
|
617
513
|
};
|
|
618
|
-
return /* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
514
|
+
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
515
|
+
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
516
|
+
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
517
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.decimalLength") }),
|
|
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
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
521
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: l("sheet.numfmt.currencyType") }),
|
|
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
|
-
/* @__PURE__ */
|
|
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(T).t, n = Xe(
|
|
637
|
-
var
|
|
638
|
-
const
|
|
639
|
-
return ((
|
|
640
|
-
}),
|
|
641
|
-
e.action.current = () =>
|
|
642
|
-
const
|
|
643
|
-
i(
|
|
644
|
-
const p =
|
|
645
|
-
u(p), e.onChange(
|
|
646
|
-
}, _ = (
|
|
647
|
-
u(
|
|
648
|
-
},
|
|
649
|
-
|
|
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(() => {
|
|
533
|
+
var v;
|
|
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);
|
|
538
|
+
const f = (h) => {
|
|
539
|
+
i(h);
|
|
540
|
+
const p = Te(h)[0].value;
|
|
541
|
+
u(p), e.onChange(C(p, o));
|
|
542
|
+
}, _ = (h) => {
|
|
543
|
+
u(h), e.onChange(C(h, o));
|
|
544
|
+
}, g = (h) => {
|
|
545
|
+
a(h || 0), e.onChange(C(l, h || 0));
|
|
650
546
|
};
|
|
651
|
-
return /* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
/* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
548
|
+
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 options ", children: [
|
|
549
|
+
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
550
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.decimalLength") }),
|
|
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
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ d.jsxs("div", { className: "option", children: [
|
|
554
|
+
/* @__PURE__ */ d.jsx("div", { className: "label", children: r("sheet.numfmt.currencyType") }),
|
|
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
|
-
/* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
558
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.negType") }),
|
|
559
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: _, options: m, value: l }) }),
|
|
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
|
+
}, un = (e) => {
|
|
563
|
+
const t = x.getInfo(e);
|
|
564
|
+
return ot().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
565
|
+
}, mn = (e) => {
|
|
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
|
-
return /* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
578
|
+
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
579
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.dateType") }),
|
|
580
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { value: s, options: t, onChange: o }) }),
|
|
581
|
+
/* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.dateDes") })
|
|
686
582
|
] });
|
|
687
|
-
},
|
|
583
|
+
}, dn = (e) => !e, hn = (e) => {
|
|
688
584
|
const r = N(T).t;
|
|
689
|
-
return e.action.current = () => "", /* @__PURE__ */
|
|
690
|
-
},
|
|
691
|
-
const t = N(T), r =
|
|
692
|
-
const c = r.find((
|
|
585
|
+
return e.action.current = () => "", /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.generalDes") }) });
|
|
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 || ""));
|
|
693
589
|
return (c == null ? void 0 : c.value) || r[0].value;
|
|
694
|
-
}),
|
|
695
|
-
s(c || 0), e.onChange(
|
|
696
|
-
},
|
|
697
|
-
s(
|
|
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 = () =>
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */
|
|
595
|
+
return e.action.current = () => a, /* @__PURE__ */ d.jsxs("div", { children: [
|
|
596
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-16 label", children: t.t("sheet.numfmt.decimalLength") }),
|
|
597
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(
|
|
702
598
|
je,
|
|
703
599
|
{
|
|
704
600
|
disabled: l,
|
|
@@ -708,83 +604,83 @@ const ke = "numfmtCurrency", mn = (e) => {
|
|
|
708
604
|
onChange: u
|
|
709
605
|
}
|
|
710
606
|
) }),
|
|
711
|
-
/* @__PURE__ */
|
|
607
|
+
/* @__PURE__ */ d.jsxs("div", { className: "m-t-16 label", children: [
|
|
712
608
|
" ",
|
|
713
609
|
t.t("sheet.numfmt.negType")
|
|
714
610
|
] }),
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
611
|
+
/* @__PURE__ */ d.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ d.jsx(we, { onChange: m, options: r, value: i }) }),
|
|
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(T),
|
|
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
|
-
), [
|
|
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((
|
|
731
|
-
}, [
|
|
732
|
-
function
|
|
733
|
-
return [
|
|
626
|
+
return (y = u.find((U) => U.label === m)) == null ? void 0 : y.component;
|
|
627
|
+
}, [m]);
|
|
628
|
+
function v() {
|
|
629
|
+
return [dn, on, an, un, fn].reduce((U, mt, dt) => U || (mt(r) ? u[dt].label : ""), "") || u[0].label;
|
|
734
630
|
}
|
|
735
|
-
const
|
|
631
|
+
const b = u.map((y) => ({
|
|
736
632
|
label: y.label,
|
|
737
633
|
value: y.label
|
|
738
|
-
})),
|
|
739
|
-
c(y), l(() => e.onChange({ type: "change", value:
|
|
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
|
-
|
|
638
|
+
}, be = () => {
|
|
639
|
+
const y = o.current() || "", U = oe(y);
|
|
640
|
+
U && g(U), e.onChange({ type: "confirm", value: y });
|
|
745
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
|
-
c(
|
|
755
|
-
}, [n, s]), /* @__PURE__ */
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
649
|
+
return Oe(() => {
|
|
650
|
+
c(v()), _(`${n}_${s}`);
|
|
651
|
+
}, [n, s]), /* @__PURE__ */ d.jsxs("div", { className: "numfmt-panel p-b-20", children: [
|
|
652
|
+
/* @__PURE__ */ d.jsxs("div", { children: [
|
|
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
|
-
/* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ d.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
|
|
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
|
-
type:
|
|
664
|
+
type: w.COMMAND,
|
|
769
665
|
handler: async (e) => {
|
|
770
|
-
const t = 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
|
-
|
|
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
|
-
}), await t.executeCommand(
|
|
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 &&
|
|
785
|
-
},
|
|
786
|
-
let ue = class extends
|
|
787
|
-
constructor(t, r, n, s, i,
|
|
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;
|
|
681
|
+
}, M = (e, t) => (r, n) => t(r, n, e);
|
|
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,54 +688,54 @@ let ue = class extends X {
|
|
|
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,
|
|
807
703
|
l.startColumn
|
|
808
704
|
);
|
|
809
705
|
let _ = "";
|
|
810
|
-
|
|
811
|
-
const
|
|
706
|
+
f && (_ = f.pattern);
|
|
707
|
+
const g = (c == null ? void 0 : c.t) === B.NUMBER ? c.v : 12345678, h = {
|
|
812
708
|
onChange: (p) => {
|
|
813
|
-
var
|
|
709
|
+
var v, b;
|
|
814
710
|
if (p.type === "change")
|
|
815
|
-
this._previewPattern = p.value, this._sheetSkeletonManagerService.reCalculate(), (
|
|
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 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(
|
|
723
|
+
}), n.executeCommand($.id, ce), t.close();
|
|
828
724
|
} else
|
|
829
725
|
p.type === "cancel" && t.close();
|
|
830
726
|
},
|
|
831
|
-
value: { defaultPattern: _, defaultValue:
|
|
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:
|
|
837
|
-
...
|
|
732
|
+
label: Ne,
|
|
733
|
+
...h
|
|
838
734
|
// need passthrough to react props.
|
|
839
735
|
},
|
|
840
736
|
onClose: () => {
|
|
841
|
-
var p,
|
|
842
|
-
this._sheetSkeletonManagerService.reCalculate(), (
|
|
737
|
+
var p, v;
|
|
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
|
}
|
|
@@ -848,86 +744,86 @@ let ue = class extends X {
|
|
|
848
744
|
et,
|
|
849
745
|
rt,
|
|
850
746
|
nt,
|
|
851
|
-
|
|
852
|
-
|
|
747
|
+
at,
|
|
748
|
+
pe,
|
|
853
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
|
-
const t = new
|
|
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
|
-
|
|
877
|
-
([n, s]) => new
|
|
878
|
-
const
|
|
879
|
-
return n && s.length && i.next({ selectionRanges: s, disposableCollection:
|
|
880
|
-
|
|
772
|
+
Pt(
|
|
773
|
+
([n, s]) => new G((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
|
+
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
|
-
handler: (l, u,
|
|
894
|
-
const { row: c, col:
|
|
789
|
+
handler: (l, u, m) => {
|
|
790
|
+
const { row: c, col: f } = u, _ = m(l) || {};
|
|
895
791
|
if (s.find(
|
|
896
|
-
(
|
|
792
|
+
(g) => g.startColumn <= f && g.endColumn >= f && g.startRow <= c && g.endRow >= c
|
|
897
793
|
)) {
|
|
898
|
-
const
|
|
899
|
-
if (
|
|
794
|
+
const g = u.worksheet.getCellRaw(c, f), h = g == null ? void 0 : g.v, p = g == null ? void 0 : g.t;
|
|
795
|
+
if (h == null || p !== B.NUMBER || this._previewPattern === null)
|
|
900
796
|
return _;
|
|
901
|
-
const
|
|
902
|
-
if (
|
|
903
|
-
const
|
|
797
|
+
const v = De(this._previewPattern, h, this._localeService.getCurrentLocale());
|
|
798
|
+
if (v.color) {
|
|
799
|
+
const F = this._themeService.getCurrentTheme()[`${v.color}500`];
|
|
904
800
|
return {
|
|
905
801
|
..._,
|
|
906
|
-
v:
|
|
907
|
-
t:
|
|
908
|
-
s: { cl: { rgb:
|
|
802
|
+
v: v.result,
|
|
803
|
+
t: B.STRING,
|
|
804
|
+
s: { cl: { rgb: F } }
|
|
909
805
|
};
|
|
910
806
|
}
|
|
911
807
|
return {
|
|
912
808
|
..._,
|
|
913
|
-
v:
|
|
914
|
-
t:
|
|
809
|
+
v: v.result,
|
|
810
|
+
t: B.STRING
|
|
915
811
|
};
|
|
916
812
|
}
|
|
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
|
-
|
|
929
|
-
|
|
930
|
-
new
|
|
824
|
+
K(
|
|
825
|
+
Ze(
|
|
826
|
+
new G((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 ue = class extends X {
|
|
|
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,63 +842,63 @@ let ue = class extends X {
|
|
|
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
|
-
ue =
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
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)),
|
|
857
|
+
M(4, O),
|
|
858
|
+
M(5, S(D)),
|
|
859
|
+
M(6, jt),
|
|
860
|
+
M(7, H),
|
|
861
|
+
M(8, S(Je)),
|
|
862
|
+
M(9, wt),
|
|
863
|
+
M(10, S(T))
|
|
968
864
|
], ue);
|
|
969
|
-
var
|
|
970
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
971
|
-
(
|
|
972
|
-
return n && s &&
|
|
973
|
-
},
|
|
974
|
-
const
|
|
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);
|
|
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 me = class extends
|
|
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() {
|
|
992
888
|
this.disposeWithMe(
|
|
993
|
-
|
|
889
|
+
K(
|
|
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 (fe(o.pattern)) {
|
|
1006
902
|
case "scientific":
|
|
1007
903
|
case "percent":
|
|
1008
904
|
case "currency":
|
|
@@ -1029,19 +925,19 @@ let me = class extends X {
|
|
|
1029
925
|
*/
|
|
1030
926
|
_initInterceptorEditorEnd() {
|
|
1031
927
|
this.disposeWithMe(
|
|
1032
|
-
|
|
928
|
+
K(
|
|
1033
929
|
this._editorBridgeService.interceptor.intercept(
|
|
1034
930
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
|
|
1035
931
|
{
|
|
1036
932
|
handler: (t, r, n) => {
|
|
1037
|
-
var
|
|
933
|
+
var m;
|
|
1038
934
|
this._collectEffectMutation.clean();
|
|
1039
935
|
const s = this._numfmtService.getValue(
|
|
1040
936
|
r.unitId,
|
|
1041
937
|
r.subUnitId,
|
|
1042
938
|
r.row,
|
|
1043
939
|
r.col
|
|
1044
|
-
), i = (
|
|
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,7 +948,7 @@ let me = class extends X {
|
|
|
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
954
|
const c = Number(l.v);
|
|
@@ -1064,10 +960,10 @@ let me = class extends X {
|
|
|
1064
960
|
{
|
|
1065
961
|
pattern: l.z
|
|
1066
962
|
}
|
|
1067
|
-
), { ...t, v: c, t:
|
|
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,50 +977,50 @@ let me = class extends X {
|
|
|
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
|
|
1092
|
-
var
|
|
1093
|
-
return !!((
|
|
987
|
+
const a = o.filter((c) => {
|
|
988
|
+
var f;
|
|
989
|
+
return !!((f = c.value) != null && f.pattern);
|
|
1094
990
|
}).map((c) => ({
|
|
1095
991
|
row: c.row,
|
|
1096
992
|
col: c.col,
|
|
1097
993
|
pattern: c.value.pattern
|
|
1098
|
-
})), l =
|
|
1099
|
-
var
|
|
1100
|
-
return !((
|
|
994
|
+
})), l = o.filter((c) => {
|
|
995
|
+
var f;
|
|
996
|
+
return !((f = c.value) != null && f.pattern);
|
|
1101
997
|
}).map((c) => ({
|
|
1102
998
|
startRow: c.row,
|
|
1103
999
|
endColumn: c.col,
|
|
1104
1000
|
startColumn: c.col,
|
|
1105
1001
|
endRow: c.row
|
|
1106
|
-
})), u = [],
|
|
1107
|
-
if (
|
|
1002
|
+
})), u = [], m = [];
|
|
1003
|
+
if (a) {
|
|
1108
1004
|
const c = {
|
|
1109
|
-
id:
|
|
1110
|
-
params: We(s, i,
|
|
1005
|
+
id: J.id,
|
|
1006
|
+
params: We(s, i, a)
|
|
1111
1007
|
};
|
|
1112
|
-
u.push(c),
|
|
1008
|
+
u.push(c), m.push(...Ge(t._injector, c.params));
|
|
1113
1009
|
}
|
|
1114
1010
|
if (l) {
|
|
1115
1011
|
const c = {
|
|
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(c),
|
|
1019
|
+
u.push(c), m.push(...ze(t._injector, c.params));
|
|
1124
1020
|
}
|
|
1125
1021
|
return {
|
|
1126
1022
|
redos: u,
|
|
1127
|
-
undos:
|
|
1023
|
+
undos: m.reverse()
|
|
1128
1024
|
};
|
|
1129
1025
|
}
|
|
1130
1026
|
}
|
|
@@ -1137,125 +1033,32 @@ let me = class extends X {
|
|
|
1137
1033
|
);
|
|
1138
1034
|
}
|
|
1139
1035
|
};
|
|
1140
|
-
me =
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
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))
|
|
1147
1043
|
], me);
|
|
1148
|
-
function
|
|
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 de = class extends
|
|
1157
|
-
constructor(
|
|
1158
|
-
super();
|
|
1159
|
-
U(this, "_initLocal", () => {
|
|
1160
|
-
this._localeService.load({ zhCN: Kt, enUS: zt });
|
|
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
|
-
de =
|
|
1166
|
-
|
|
1167
|
-
|
|
1057
|
+
de = En([
|
|
1058
|
+
q(V.Rendered, de),
|
|
1059
|
+
Rn(0, S(T))
|
|
1168
1060
|
], de);
|
|
1169
|
-
|
|
1170
|
-
return I = Object.assign || function(e) {
|
|
1171
|
-
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
1172
|
-
t = arguments[r];
|
|
1173
|
-
for (var s in t)
|
|
1174
|
-
Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]);
|
|
1175
|
-
}
|
|
1176
|
-
return e;
|
|
1177
|
-
}, I.apply(this, arguments);
|
|
1178
|
-
}, Ln = function(e, t) {
|
|
1179
|
-
var r = {};
|
|
1180
|
-
for (var n in e)
|
|
1181
|
-
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
1182
|
-
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1183
|
-
for (var s = 0, n = Object.getOwnPropertySymbols(e); s < n.length; s++)
|
|
1184
|
-
t.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[s]) && (r[n[s]] = e[n[s]]);
|
|
1185
|
-
return r;
|
|
1186
|
-
}, q = Z(function(e, t) {
|
|
1187
|
-
var r = e.icon, n = e.id, s = e.className, i = e.extend, a = Ln(e, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(n, " ").concat(s || "").trim(), l = Ee("_".concat(Vn()));
|
|
1188
|
-
return lt(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current }, I({ ref: t, className: o }, a), i);
|
|
1189
|
-
});
|
|
1190
|
-
function lt(e, t, r, n, s) {
|
|
1191
|
-
return B(e.tag, I(I({ key: t }, Un(e, r, s)), n), (An(e, r).children || []).map(function(i, a) {
|
|
1192
|
-
return lt(i, "".concat(t, "-").concat(e.tag, "-").concat(a), r, void 0, s);
|
|
1193
|
-
}));
|
|
1194
|
-
}
|
|
1195
|
-
function Un(e, t, r) {
|
|
1196
|
-
var n = I({}, e.attrs);
|
|
1197
|
-
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
|
|
1198
|
-
var s = t.defIds;
|
|
1199
|
-
return !s || s.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(i) {
|
|
1200
|
-
var a = i[0], o = i[1];
|
|
1201
|
-
typeof o == "string" && (n[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
1202
|
-
})), n;
|
|
1203
|
-
}
|
|
1204
|
-
function An(e, t) {
|
|
1205
|
-
var r, n = t.defIds;
|
|
1206
|
-
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? I(I({}, e), { children: e.children.map(function(s) {
|
|
1207
|
-
return typeof s.attrs.id == "string" && n && n.indexOf(s.attrs.id) > -1 ? I(I({}, s), { attrs: I(I({}, s.attrs), { id: s.attrs.id + t.idSuffix }) }) : s;
|
|
1208
|
-
}) }) : e;
|
|
1209
|
-
}
|
|
1210
|
-
function Vn() {
|
|
1211
|
-
return Math.random().toString(36).substring(2, 8);
|
|
1212
|
-
}
|
|
1213
|
-
q.displayName = "UniverIcon";
|
|
1214
|
-
var Hn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.99988 3.60921C3.99988 2.32055 5.04456 1.27588 6.33321 1.27588 7.62187 1.27588 8.66654 2.32055 8.66654 3.60921V6.24136C8.66654 7.53002 7.62187 8.5747 6.33321 8.5747 5.04455 8.5747 3.99988 7.53002 3.99988 6.24136V3.60921zM6.33321 2.60921C5.78093 2.60921 5.33321 3.05693 5.33321 3.60921V6.24136C5.33321 6.79364 5.78093 7.24136 6.33321 7.24136 6.88549 7.24136 7.33321 6.79364 7.33321 6.24136V3.60921C7.33321 3.05693 6.88549 2.60921 6.33321 2.60921zM9.99988 3.60921C9.99988 2.32055 11.0446 1.27588 12.3332 1.27588 13.6219 1.27588 14.6665 2.32055 14.6665 3.60921V6.24136C14.6665 7.53002 13.6219 8.5747 12.3332 8.5747 11.0446 8.5747 9.99988 7.53002 9.99988 6.24136V3.60921zM12.3332 2.60921C11.7809 2.60921 11.3332 3.05693 11.3332 3.60921V6.24136C11.3332 6.79364 11.7809 7.24136 12.3332 7.24136 12.8855 7.24136 13.3332 6.79364 13.3332 6.24136V3.60921C13.3332 3.05693 12.8855 2.60921 12.3332 2.60921z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.4713 9.58625C12.211 9.3259 11.7889 9.3259 11.5285 9.58625 11.2682 9.8466 11.2682 10.2687 11.5285 10.5291L12.3904 11.391H6.33329C5.9651 11.391 5.66663 11.6895 5.66663 12.0577 5.66663 12.4258 5.9651 12.7243 6.33329 12.7243H12.3904L11.5285 13.5862C11.2682 13.8466 11.2682 14.2687 11.5285 14.5291 11.7889 14.7894 12.211 14.7894 12.4713 14.5291L14.4669 12.5335C14.4851 12.5156 14.5022 12.4968 14.5183 12.477 14.5484 12.4399 14.5739 12.4003 14.5948 12.359 14.6407 12.2685 14.6666 12.1661 14.6666 12.0577 14.6666 11.9492 14.6407 11.8468 14.5948 11.7563 14.5739 11.715 14.5484 11.6754 14.5183 11.6383 14.5022 11.6185 14.4851 11.5997 14.4669 11.5818L12.4713 9.58625zM1.33325 7.98825C1.33325 7.62006 1.63173 7.32159 1.99992 7.32159H2.33325C2.70144 7.32159 2.99992 7.62006 2.99992 7.98825 2.99992 8.35644 2.70144 8.65492 2.33325 8.65492H1.99992C1.63173 8.65492 1.33325 8.35644 1.33325 7.98825z" } }] }, ut = Z(function(e, t) {
|
|
1215
|
-
return B(q, Object.assign({}, e, {
|
|
1216
|
-
id: "add-digits-single",
|
|
1217
|
-
ref: t,
|
|
1218
|
-
icon: Hn
|
|
1219
|
-
}));
|
|
1220
|
-
});
|
|
1221
|
-
ut.displayName = "AddDigitsSingle";
|
|
1222
|
-
const Bn = ut;
|
|
1223
|
-
var kn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_556", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_556)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M0.629584 3.99986C1.13729 3.4922 1.9604 3.49224 2.46806 3.99995L7.57569 9.10806C7.81 9.3424 8.18992 9.3424 8.42424 9.10808L13.5323 3.99998C14.04 3.4923 14.8631 3.4923 15.3708 3.99998C15.8785 4.50766 15.8785 5.33078 15.3708 5.83846L9.41415 11.7951C8.63307 12.5762 7.36669 12.5762 6.58565 11.7951L0.629497 5.83834C0.121839 5.33063 0.121879 4.50752 0.629584 3.99986Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, mt = Z(function(e, t) {
|
|
1224
|
-
return B(q, Object.assign({}, e, {
|
|
1225
|
-
id: "more-down-single",
|
|
1226
|
-
ref: t,
|
|
1227
|
-
icon: kn
|
|
1228
|
-
}));
|
|
1229
|
-
});
|
|
1230
|
-
mt.displayName = "MoreDownSingle";
|
|
1231
|
-
const Fn = mt;
|
|
1232
|
-
var zn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_561_2", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_561_2)", fillRule: "evenodd", clipRule: "evenodd" }, children: [{ tag: "path", attrs: { d: "M4.91876 2.65039C3.66601 2.65039 2.65045 3.66595 2.65045 4.9187 2.65045 6.17146 3.66601 7.18702 4.91876 7.18702 6.17152 7.18702 7.18708 6.17146 7.18708 4.9187 7.18708 3.66595 6.17152 2.65039 4.91876 2.65039zM3.94663 4.9187C3.94663 4.38181 4.38187 3.94657 4.91876 3.94657 5.45566 3.94657 5.8909 4.38181 5.8909 4.9187 5.8909 5.4556 5.45566 5.89084 4.91876 5.89084 4.38187 5.89084 3.94663 5.4556 3.94663 4.9187zM11.0812 8.81299C9.82842 8.81299 8.81286 9.82855 8.81286 11.0813 8.81286 12.3341 9.82842 13.3496 11.0812 13.3496 12.3339 13.3496 13.3495 12.3341 13.3495 11.0813 13.3495 9.82855 12.3339 8.81299 11.0812 8.81299zM10.109 11.0813C10.109 10.5444 10.5443 10.1092 11.0812 10.1092 11.6181 10.1092 12.0533 10.5444 12.0533 11.0813 12.0533 11.6182 11.6181 12.0534 11.0812 12.0534 10.5443 12.0534 10.109 11.6182 10.109 11.0813zM13.1597 2.84021C13.4128 3.09331 13.4128 3.50365 13.1597 3.75675L3.7568 13.1596C3.5037 13.4127 3.09336 13.4127 2.84026 13.1596 2.58717 12.9065 2.58717 12.4962 2.84026 12.2431L12.2431 2.84021C12.4962 2.58712 12.9066 2.58712 13.1597 2.84021z" } }] }] }, dt = Z(function(e, t) {
|
|
1233
|
-
return B(q, Object.assign({}, e, {
|
|
1234
|
-
id: "percent-single",
|
|
1235
|
-
ref: t,
|
|
1236
|
-
icon: zn
|
|
1237
|
-
}));
|
|
1238
|
-
});
|
|
1239
|
-
dt.displayName = "PercentSingle";
|
|
1240
|
-
const Wn = dt;
|
|
1241
|
-
var Kn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5 3.61825C5 2.32958 6.04468 1.28491 7.33333 1.28491C8.62199 1.28491 9.66667 2.32958 9.66667 3.61825V6.30787C9.66667 7.59653 8.62199 8.64121 7.33333 8.64121C6.04468 8.64121 5 7.59653 5 6.30787V3.61825ZM7.33333 2.61825C6.78105 2.61825 6.33333 3.06596 6.33333 3.61825V6.30787C6.33333 6.86015 6.78106 7.30787 7.33333 7.30787C7.88561 7.30787 8.33333 6.86015 8.33333 6.30787V3.61825C8.33333 3.06596 7.88561 2.61825 7.33333 2.61825Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2 7.9745C2 7.60631 2.29848 7.30783 2.66667 7.30783H3C3.36819 7.30783 3.66667 7.60631 3.66667 7.9745 3.66667 8.34269 3.36819 8.64117 3 8.64117H2.66667C2.29848 8.64117 2 8.34269 2 7.9745zM8.80482 9.56197C9.06517 9.82232 9.06517 10.2444 8.80482 10.5048L7.94289 11.3667H13.3334C13.7016 11.3667 14.0001 11.6652 14.0001 12.0334 14.0001 12.4016 13.7016 12.7 13.3334 12.7H7.94289L8.80482 13.562C9.06517 13.8223 9.06517 14.2444 8.80482 14.5048 8.54447 14.7651 8.12236 14.7651 7.86201 14.5048L5.86201 12.5048C5.79809 12.4409 5.74987 12.3672 5.71733 12.2886 5.68474 12.21 5.66675 12.1238 5.66675 12.0334 5.66675 11.943 5.68474 11.8568 5.71733 11.7782 5.74987 11.6996 5.79809 11.6259 5.86201 11.562L7.86201 9.56197C8.12236 9.30162 8.54447 9.30162 8.80482 9.56197z" } }] }, ft = Z(function(e, t) {
|
|
1242
|
-
return B(q, Object.assign({}, e, {
|
|
1243
|
-
id: "reduce-digits-single",
|
|
1244
|
-
ref: t,
|
|
1245
|
-
icon: Kn
|
|
1246
|
-
}));
|
|
1247
|
-
});
|
|
1248
|
-
ft.displayName = "ReduceDigitsSingle";
|
|
1249
|
-
const Gn = ft;
|
|
1250
|
-
var Zn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.05443 1.55744C4.34898 1.33653 4.76685 1.39623 4.98776 1.69078L7.99996 5.98276L11.0122 1.69078C11.2331 1.39623 11.6509 1.33653 11.9455 1.55744C12.24 1.77836 12.2997 2.19623 12.0788 2.49078L9.33338 6.42708H12.0788C12.447 6.42708 12.7455 6.72556 12.7455 7.09375C12.7455 7.46194 12.447 7.76042 12.0788 7.76042H8.66659V9.69702H12.3348C12.703 9.69702 13.0015 9.9955 13.0015 10.3637C13.0015 10.7319 12.703 11.0304 12.3348 11.0304H8.66659V13.9091C8.66659 14.2773 8.36811 14.5758 7.99992 14.5758C7.63173 14.5758 7.33325 14.2773 7.33325 13.9091V11.0304H3.66508C3.29689 11.0304 2.99841 10.7319 2.99841 10.3637C2.99841 9.9955 3.29689 9.69702 3.66508 9.69702H7.33325V7.76042H3.92109C3.5529 7.76042 3.25443 7.46194 3.25443 7.09375C3.25443 6.72556 3.5529 6.42708 3.92109 6.42708H6.66653L3.92109 2.49078C3.70018 2.19623 3.75987 1.77836 4.05443 1.55744Z" } }] }, ht = Z(function(e, t) {
|
|
1251
|
-
return B(q, Object.assign({}, e, {
|
|
1252
|
-
id: "rmb-single",
|
|
1253
|
-
ref: t,
|
|
1254
|
-
icon: Zn
|
|
1255
|
-
}));
|
|
1256
|
-
});
|
|
1257
|
-
ht.displayName = "RmbSingle";
|
|
1258
|
-
const qn = ht, fe = [
|
|
1061
|
+
const he = [
|
|
1259
1062
|
{
|
|
1260
1063
|
label: "sheet.numfmt.general",
|
|
1261
1064
|
pattern: null
|
|
@@ -1308,30 +1111,30 @@ const qn = ht, fe = [
|
|
|
1308
1111
|
label: "sheet.numfmt.moreFmt",
|
|
1309
1112
|
pattern: ""
|
|
1310
1113
|
}
|
|
1311
|
-
],
|
|
1114
|
+
], lt = "sheet.numfmt.moreNumfmtType", ut = "sheet.numfmt.moreNumfmtType.options", Pn = (e) => {
|
|
1312
1115
|
var n;
|
|
1313
1116
|
const t = N(T), r = (n = e.value) != null ? n : t.t("sheet.numfmt.general");
|
|
1314
|
-
return /* @__PURE__ */
|
|
1315
|
-
},
|
|
1316
|
-
const e = N(
|
|
1117
|
+
return /* @__PURE__ */ d.jsx("span", { className: "more-numfmt-type", children: r });
|
|
1118
|
+
}, xn = () => {
|
|
1119
|
+
const e = N(O), t = N(T), r = kt(), n = N(D), s = (a) => {
|
|
1317
1120
|
const l = n.getLast();
|
|
1318
1121
|
if (!l)
|
|
1319
1122
|
return;
|
|
1320
|
-
const u = r.get(
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
}), e.executeCommand(
|
|
1324
|
-
}, i = (
|
|
1325
|
-
if (
|
|
1123
|
+
const u = r.get($t), m = l.range, c = [];
|
|
1124
|
+
P.foreach(m, (f, _) => {
|
|
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)
|
|
1326
1129
|
s(null);
|
|
1327
|
-
else if (
|
|
1328
|
-
e.executeCommand(
|
|
1130
|
+
else if (a === he.length - 1)
|
|
1131
|
+
e.executeCommand(pe.id);
|
|
1329
1132
|
else {
|
|
1330
|
-
const l =
|
|
1133
|
+
const l = he[a];
|
|
1331
1134
|
l.pattern && s(l.pattern);
|
|
1332
1135
|
}
|
|
1333
|
-
},
|
|
1334
|
-
return /* @__PURE__ */
|
|
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(
|
|
1335
1138
|
"div",
|
|
1336
1139
|
{
|
|
1337
1140
|
className: "option-item m-t-4",
|
|
@@ -1339,154 +1142,145 @@ const qn = ht, fe = [
|
|
|
1339
1142
|
i(l);
|
|
1340
1143
|
},
|
|
1341
1144
|
children: [
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
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 : "" })
|
|
1344
1147
|
]
|
|
1345
1148
|
},
|
|
1346
1149
|
l
|
|
1347
1150
|
)) });
|
|
1348
|
-
},
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
hidden$: ae(r, R.UNIVER_SHEET),
|
|
1398
|
-
disabled$: ne(r)
|
|
1399
|
-
});
|
|
1400
|
-
}, nr = (e) => {
|
|
1401
|
-
const t = "sheet.numfmt.moreNumfmtType", r = "sheet.numfmt.moreNumfmtType.options";
|
|
1402
|
-
return e.register(t, Yn), e.register(r, Jn), (n) => {
|
|
1403
|
-
const s = n.get(G), i = n.get(W), a = n.get($), o = n.get(T), l = n.get(H), u = Dt(i, "", ({ workbook: d, worksheet: c }) => new J(
|
|
1404
|
-
(h) => Qe(
|
|
1405
|
-
l.selectionMoveEnd$,
|
|
1406
|
-
new J((_) => {
|
|
1407
|
-
const v = [_e.id, te.id], f = a.onCommandExecuted((p) => {
|
|
1408
|
-
v.includes(p.id) && _.next(null);
|
|
1409
|
-
});
|
|
1410
|
-
return () => f.dispose();
|
|
1411
|
-
})
|
|
1412
|
-
).subscribe(() => {
|
|
1413
|
-
const _ = l.getSelections();
|
|
1414
|
-
if (_ && _[0]) {
|
|
1415
|
-
const v = _[0].range, f = v.startRow, p = v.startColumn, g = s.getValue(d.getUnitId(), c.getSheetId(), f, p), C = g == null ? void 0 : g.pattern;
|
|
1416
|
-
let O = o.t("sheet.numfmt.general");
|
|
1417
|
-
if (C) {
|
|
1418
|
-
const D = fe.filter((w) => typeof w == "object" && w.pattern).find(
|
|
1419
|
-
(w) => Se(C, w.pattern)
|
|
1420
|
-
);
|
|
1421
|
-
D && typeof D == "object" && D.pattern ? O = o.t(D.label) : O = o.t("sheet.numfmt.moreFmt");
|
|
1422
|
-
}
|
|
1423
|
-
h.next(O);
|
|
1424
|
-
}
|
|
1151
|
+
}, On = (e) => ({
|
|
1152
|
+
icon: "RmbSingle",
|
|
1153
|
+
id: nt.id,
|
|
1154
|
+
title: "sheet.numfmt.currency",
|
|
1155
|
+
tooltip: "sheet.numfmt.currency",
|
|
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] })
|
|
1161
|
+
}), jn = (e) => ({
|
|
1162
|
+
icon: "AddDigitsSingle",
|
|
1163
|
+
id: et.id,
|
|
1164
|
+
title: "sheet.numfmt.addDecimal",
|
|
1165
|
+
tooltip: "sheet.numfmt.addDecimal",
|
|
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] })
|
|
1171
|
+
}), $n = (e) => ({
|
|
1172
|
+
icon: "ReduceDigitsSingle",
|
|
1173
|
+
id: rt.id,
|
|
1174
|
+
title: "sheet.numfmt.subtractDecimal",
|
|
1175
|
+
tooltip: "sheet.numfmt.subtractDecimal",
|
|
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] })
|
|
1181
|
+
}), wn = (e) => ({
|
|
1182
|
+
icon: "PercentSingle",
|
|
1183
|
+
id: at.id,
|
|
1184
|
+
title: "sheet.numfmt.percent",
|
|
1185
|
+
tooltip: "sheet.numfmt.percent",
|
|
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(
|
|
1194
|
+
i.selectionMoveEnd$,
|
|
1195
|
+
new G((m) => {
|
|
1196
|
+
const c = [ge.id, J.id], f = n.onCommandExecuted((_) => {
|
|
1197
|
+
c.includes(_.id) && m.next(null);
|
|
1198
|
+
});
|
|
1199
|
+
return () => f.dispose();
|
|
1425
1200
|
})
|
|
1426
|
-
))
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
label: {
|
|
1437
|
-
name: r,
|
|
1438
|
-
hoverable: !1
|
|
1439
|
-
}
|
|
1201
|
+
).subscribe(() => {
|
|
1202
|
+
const m = i.getSelections();
|
|
1203
|
+
if (m && m[0]) {
|
|
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;
|
|
1205
|
+
let p = s.t("sheet.numfmt.general");
|
|
1206
|
+
if (h) {
|
|
1207
|
+
const v = he.filter((b) => typeof b == "object" && b.pattern).find(
|
|
1208
|
+
(b) => _e(h, b.pattern)
|
|
1209
|
+
);
|
|
1210
|
+
v && typeof v == "object" && v.pattern ? p = s.t(v.label) : p = s.t("sheet.numfmt.moreFmt");
|
|
1440
1211
|
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1212
|
+
u.next(p);
|
|
1213
|
+
}
|
|
1214
|
+
})
|
|
1215
|
+
));
|
|
1216
|
+
return {
|
|
1217
|
+
label: lt,
|
|
1218
|
+
id: pe.id,
|
|
1219
|
+
tooltip: "sheet.numfmt.title",
|
|
1220
|
+
type: ne.SELECTOR,
|
|
1221
|
+
group: re.TOOLBAR_FORMULAS_INSERT,
|
|
1222
|
+
positions: [se.TOOLBAR_START],
|
|
1223
|
+
selections: [
|
|
1224
|
+
{
|
|
1225
|
+
label: {
|
|
1226
|
+
name: ut,
|
|
1227
|
+
hoverable: !1
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
],
|
|
1231
|
+
value$: o,
|
|
1232
|
+
hidden$: ie(e, E.UNIVER_SHEET),
|
|
1233
|
+
disabled$: te(e, { workbookTypes: [Z], worksheetTypes: [X, Q], rangeTypes: [ee] })
|
|
1446
1234
|
};
|
|
1447
1235
|
};
|
|
1448
|
-
var
|
|
1449
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1450
|
-
(
|
|
1451
|
-
return n && s &&
|
|
1452
|
-
},
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
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 = {};
|
|
1242
|
+
let z = class extends Y {
|
|
1243
|
+
constructor(e, t, r, n) {
|
|
1244
|
+
super(), this._config = e, this._injector = t, this._componentManager = r, this._menuService = n, this._initMenu();
|
|
1456
1245
|
}
|
|
1457
1246
|
_initMenu() {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1247
|
+
const { menu: e = {} } = this._config;
|
|
1248
|
+
[wn, jn, $n, On, Dn].forEach((t) => {
|
|
1249
|
+
this.disposeWithMe(this._menuService.addMenuItem(t(this._injector), e));
|
|
1250
|
+
}), this.disposeWithMe(this._componentManager.register(lt, Pn)), this.disposeWithMe(this._componentManager.register(ut, xn));
|
|
1461
1251
|
}
|
|
1462
1252
|
};
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
],
|
|
1469
|
-
var
|
|
1470
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1471
|
-
(
|
|
1472
|
-
return n && s &&
|
|
1473
|
-
},
|
|
1474
|
-
let
|
|
1475
|
-
constructor(e, t) {
|
|
1476
|
-
super(), this._injector = t;
|
|
1253
|
+
z = An([
|
|
1254
|
+
q(V.Rendered, z),
|
|
1255
|
+
Me(1, S(xe)),
|
|
1256
|
+
Me(2, S(Je)),
|
|
1257
|
+
Me(3, S(Dt))
|
|
1258
|
+
], z);
|
|
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 {
|
|
1265
|
+
constructor(e = {}, t) {
|
|
1266
|
+
super(), this._config = e, this._injector = t, this._config = It.deepMerge({}, Bn, this._config);
|
|
1477
1267
|
}
|
|
1478
1268
|
onStarting() {
|
|
1479
|
-
this._injector.add([Ue, { useClass: ue, lazy: !1 }]), this._injector.add([me]), 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(
|
|
1270
|
+
[
|
|
1271
|
+
z,
|
|
1272
|
+
{
|
|
1273
|
+
useFactory: () => this._injector.createInstance(z, this._config)
|
|
1274
|
+
}
|
|
1275
|
+
]
|
|
1276
|
+
);
|
|
1480
1277
|
}
|
|
1481
|
-
},
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
],
|
|
1278
|
+
}, L(ae, "pluginName", Ne), L(ae, "type", E.UNIVER_SHEET), ae);
|
|
1279
|
+
He = Hn([
|
|
1280
|
+
Fn(1, S(xe))
|
|
1281
|
+
], He);
|
|
1485
1282
|
export {
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
Le as getPatternPreview,
|
|
1490
|
-
Ir as ruRU,
|
|
1491
|
-
Kt as zhCN
|
|
1283
|
+
$ as SetNumfmtCommand,
|
|
1284
|
+
He as UniverSheetsNumfmtPlugin,
|
|
1285
|
+
De as getPatternPreview
|
|
1492
1286
|
};
|