@univerjs/sheets-numfmt-ui 0.10.6 → 0.10.7-nightly.202509090319
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +164 -162
- package/lib/index.js +164 -162
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var dt = Object.defineProperty;
|
|
2
2
|
var ht = (e, t, r) => t in e ? dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var q = (e, t, r) => ht(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Inject as y, LocaleService as E, IConfigService as $e, Disposable as ne, isTextFormat as De, Tools as vt, isRealNum as Fe, CommandType as Le, ILocalStorageService as Ae, isPatternEqualWithoutDecimal as re, numfmt as ft, ThemeService as pt, IUniverInstanceService as ve, ICommandService as fe, UniverInstanceType as
|
|
4
|
+
import { Inject as y, LocaleService as E, IConfigService as $e, Disposable as ne, isTextFormat as De, Tools as vt, isRealNum as Fe, CommandType as Le, ILocalStorageService as Ae, isPatternEqualWithoutDecimal as re, numfmt as ft, ThemeService as pt, IUniverInstanceService as ve, ICommandService as fe, UniverInstanceType as w, CellValueType as x, toDisposable as de, DisposableCollection as gt, InterceptorEffectEnum as we, Range as He, Injector as je, Optional as _t, willLoseNumericPrecision as St, fromCallback as yt, isDefaultFormat as Ct, DEFAULT_TEXT_FORMAT_EXCEL as bt, DependentOn as It, Plugin as Nt, merge as Et, registerDependencies as Tt, touchDependencies as wt } from "@univerjs/core";
|
|
5
5
|
import { IRenderManagerService as Be } from "@univerjs/engine-render";
|
|
6
|
-
import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as
|
|
6
|
+
import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY as Mt, currencySymbols as Me, getDecimalFromPattern as J, getCurrencyType as V, setPatternDecimal as k, getCurrencyFormatOptions as oe, CURRENCYFORMAT as Pt, DATEFMTLISG as xt, NUMBERFORMAT as Rt, getDateFormatOptions as Ve, getNumberFormatOptions as We, isPatternHasDecimal as Ot, SheetsNumfmtCellContentController as Ge, getPatternPreviewIgnoreGeneral as kt, getPatternType as pe, SetNumfmtCommand as Ke, getNumfmtParseValueFilter as Ut, getCurrencySymbolByLocale as $t, SetPercentCommand as Ze, SubtractDecimalCommand as Ye, AddDecimalCommand as ze, SetCurrencyCommand as Xe, getCurrencySymbolIconByLocale as Pe, localeCurrencySymbolMap as Dt, getPatternPreview as Ft, UniverSheetsNumfmtPlugin as Lt } from "@univerjs/sheets-numfmt";
|
|
7
7
|
import { HoverManagerService as At, CellAlertManagerService as Ht, CellAlertType as jt, SheetSkeletonManagerService as Bt, IEditorBridgeService as Vt, deriveStateFromActiveSheet$ as Wt, getCurrentRangeDisable$ as W, UniverSheetsUIPlugin as Gt } from "@univerjs/sheets-ui";
|
|
8
8
|
import { INumfmtService as ge, SheetInterceptorService as qe, SheetsSelectionsService as _e, INTERCEPTOR_POINT as Kt, RemoveNumfmtMutation as Se, SetNumfmtMutation as ye, BEFORE_CELL_EDIT as Zt, AFTER_CELL_EDIT as Yt, SetRangeValuesCommand as zt, transformCellsToRange as Xt, factorySetNumfmtUndoMutation as qt, factoryRemoveNumfmtUndoMutation as Jt, RangeProtectionPermissionEditPoint as G, WorksheetSetCellStylePermission as K, WorksheetEditPermission as Z, WorkbookEditablePermission as Y } from "@univerjs/sheets";
|
|
9
9
|
import { IZenZoneService as Qt, useDependency as b, ComponentManager as Je, ISidebarService as en, getMenuHiddenObservable as z, MenuItemType as X, ILayoutService as tn, RibbonDataGroup as nn, IMenuManagerService as rn } from "@univerjs/ui";
|
|
10
10
|
import { debounceTime as sn, merge as Qe, Observable as A, combineLatest as on, filter as an } from "rxjs";
|
|
11
11
|
import { map as cn, switchMap as ln, tap as un, debounceTime as mn } from "rxjs/operators";
|
|
12
12
|
import { jsxs as C, jsx as h } from "react/jsx-runtime";
|
|
13
|
-
import { createContext as dn, useState as N, useEffect as ie, useRef as Ce, useContext as et, useMemo as
|
|
13
|
+
import { createContext as dn, useState as N, useEffect as ie, useRef as Ce, useContext as et, useMemo as R, forwardRef as tt, createElement as be, useCallback as hn } from "react";
|
|
14
14
|
import { InputNumber as Ie, Select as Ne, SelectList as Ee, Input as vn, clsx as nt, borderClassName as fn, Button as xe, scrollbarClassName as pn, Separator as gn } from "@univerjs/design";
|
|
15
15
|
import { stripErrorMargin as _n } from "@univerjs/engine-formula";
|
|
16
16
|
const Re = {};
|
|
@@ -33,19 +33,19 @@ let he = class extends ne {
|
|
|
33
33
|
if (e) {
|
|
34
34
|
const n = e.location, i = this._context.unit, s = i.getActiveSheet();
|
|
35
35
|
if (!s) return;
|
|
36
|
-
const o = n.unitId,
|
|
36
|
+
const o = n.unitId, l = n.subUnitId;
|
|
37
37
|
let a;
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
const m = i.getStyles().get(
|
|
38
|
+
const c = s.getCell(n.row, n.col);
|
|
39
|
+
if (c != null && c.s) {
|
|
40
|
+
const m = i.getStyles().get(c.s);
|
|
41
41
|
m != null && m.n && (a = m.n);
|
|
42
42
|
}
|
|
43
|
-
if (a || (a = this._numfmtService.getValue(o,
|
|
43
|
+
if (a || (a = this._numfmtService.getValue(o, l, n.row, n.col)), !a) {
|
|
44
44
|
this._hideAlert();
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if (De(a.pattern) && vt.isDefine(
|
|
48
|
-
if ((t = this._configService.getConfig(
|
|
47
|
+
if (De(a.pattern) && vt.isDefine(c == null ? void 0 : c.v) && Fe(c.v)) {
|
|
48
|
+
if ((t = this._configService.getConfig(Mt)) != null && t.disableTextFormatAlert)
|
|
49
49
|
return;
|
|
50
50
|
const m = this._cellAlertManagerService.currentAlert.get(ae), u = (r = m == null ? void 0 : m.alert) == null ? void 0 : r.location;
|
|
51
51
|
if (u && u.row === n.row && u.col === n.col && u.subUnitId === n.subUnitId && u.unitId === n.unitId)
|
|
@@ -125,17 +125,17 @@ let j = class {
|
|
|
125
125
|
async getHabit(e, t) {
|
|
126
126
|
const r = this._getKey(e), n = await this._localStorageService.getItem(r);
|
|
127
127
|
if (t && n) {
|
|
128
|
-
const i = n.map((s, o,
|
|
129
|
-
const a =
|
|
128
|
+
const i = n.map((s, o, l) => {
|
|
129
|
+
const a = l.length;
|
|
130
130
|
return {
|
|
131
131
|
value: s,
|
|
132
132
|
priority: a - o
|
|
133
133
|
};
|
|
134
134
|
});
|
|
135
135
|
return t.sort((s, o) => {
|
|
136
|
-
var
|
|
137
|
-
const
|
|
138
|
-
return (((m = i.find((u) => u.value === o)) == null ? void 0 : m.priority) || -1) -
|
|
136
|
+
var c, m;
|
|
137
|
+
const l = ((c = i.find((u) => u.value === s)) == null ? void 0 : c.priority) || -1;
|
|
138
|
+
return (((m = i.find((u) => u.value === o)) == null ? void 0 : m.priority) || -1) - l;
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
return n || [];
|
|
@@ -148,10 +148,10 @@ j = bn([
|
|
|
148
148
|
In(0, y(Ae))
|
|
149
149
|
], j);
|
|
150
150
|
const Oe = "numfmtCurrency", Nn = (e) => {
|
|
151
|
-
const t = b(j), [r, n] = N(
|
|
151
|
+
const t = b(j), [r, n] = N(Me);
|
|
152
152
|
return ie(() => {
|
|
153
153
|
t.addHabit("numfmtCurrency", []).then(() => {
|
|
154
|
-
t.getHabit(Oe, [...
|
|
154
|
+
t.getHabit(Oe, [...Me]).then((s) => {
|
|
155
155
|
n(s), e && e(s);
|
|
156
156
|
});
|
|
157
157
|
});
|
|
@@ -167,14 +167,14 @@ const Oe = "numfmtCurrency", Nn = (e) => {
|
|
|
167
167
|
}, [t]), (i) => {
|
|
168
168
|
e.current.push(i), r({});
|
|
169
169
|
};
|
|
170
|
-
}, Tn = (e) => !!V(e) && e.startsWith("_("),
|
|
171
|
-
const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => J(t || "", 2)), o = et(Te), [
|
|
172
|
-
r.current = () =>
|
|
170
|
+
}, Tn = (e) => !!V(e) && e.startsWith("_("), wn = (e) => {
|
|
171
|
+
const { defaultPattern: t, action: r, onChange: n } = e, [i, s] = N(() => J(t || "", 2)), o = et(Te), [l, a] = N(() => V(t) || o[0]), c = R(() => o.map((p) => ({ label: p, value: p })), []), u = b(E).t;
|
|
172
|
+
r.current = () => k(`_("${l}"* #,##0${i > 0 ? ".0" : ""}_)`, i);
|
|
173
173
|
const v = (p) => {
|
|
174
|
-
a(p), n(
|
|
174
|
+
a(p), n(k(`_("${p}"* #,##0${i > 0 ? ".0" : ""}_)`, i));
|
|
175
175
|
}, f = (p) => {
|
|
176
176
|
const d = p || 0;
|
|
177
|
-
s(d), n(
|
|
177
|
+
s(d), n(k(`_("${l}"* #,##0${d > 0 ? ".0" : ""}_)`, d));
|
|
178
178
|
};
|
|
179
179
|
return /* @__PURE__ */ C("div", { children: [
|
|
180
180
|
/* @__PURE__ */ C("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
|
|
@@ -197,8 +197,8 @@ const Oe = "numfmtCurrency", Nn = (e) => {
|
|
|
197
197
|
/* @__PURE__ */ h("div", { className: "univer-mt-2 univer-w-36", children: /* @__PURE__ */ h(
|
|
198
198
|
Ne,
|
|
199
199
|
{
|
|
200
|
-
options:
|
|
201
|
-
value:
|
|
200
|
+
options: c,
|
|
201
|
+
value: l,
|
|
202
202
|
onChange: v
|
|
203
203
|
}
|
|
204
204
|
) })
|
|
@@ -206,23 +206,23 @@ const Oe = "numfmtCurrency", Nn = (e) => {
|
|
|
206
206
|
] }),
|
|
207
207
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: u("sheet.numfmt.accountingDes") })
|
|
208
208
|
] });
|
|
209
|
-
},
|
|
210
|
-
const r = b(E).t, n = et(Te), [i, s] = N(() => V(e.defaultPattern) || n[0]), [o,
|
|
209
|
+
}, Mn = (e) => !!V(e) && !e.startsWith("_("), Pn = (e) => {
|
|
210
|
+
const r = b(E).t, n = et(Te), [i, s] = N(() => V(e.defaultPattern) || n[0]), [o, l] = N(() => J(e.defaultPattern || "", 2)), [a, c] = N(() => {
|
|
211
211
|
var g;
|
|
212
212
|
const d = oe(i);
|
|
213
213
|
return ((g = d.find((I) => re(I.value, e.defaultPattern))) == null ? void 0 : g.value) || d[0].value;
|
|
214
|
-
}), m =
|
|
215
|
-
e.action.current = () =>
|
|
214
|
+
}), m = R(() => oe(i), [i]), u = R(() => n.map((d) => ({ label: d, value: d })), [n]);
|
|
215
|
+
e.action.current = () => k(a, o);
|
|
216
216
|
const v = (d) => {
|
|
217
217
|
if (d === void 0)
|
|
218
218
|
return;
|
|
219
219
|
s(d);
|
|
220
220
|
const S = oe(d)[0].value;
|
|
221
|
-
|
|
221
|
+
c(S), e.onChange(k(S, o));
|
|
222
222
|
}, f = (d) => {
|
|
223
|
-
d !== void 0 && (
|
|
223
|
+
d !== void 0 && (c(d), e.onChange(k(d, o)));
|
|
224
224
|
}, p = (d) => {
|
|
225
|
-
|
|
225
|
+
l(d || 0), e.onChange(k(a, d || 0));
|
|
226
226
|
};
|
|
227
227
|
return /* @__PURE__ */ C("div", { children: [
|
|
228
228
|
/* @__PURE__ */ C("div", { className: "univer-mt-4 univer-flex univer-justify-between", children: [
|
|
@@ -271,8 +271,8 @@ var T = function() {
|
|
|
271
271
|
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
|
272
272
|
return r;
|
|
273
273
|
}, rt = tt(function(e, t) {
|
|
274
|
-
var r = e.icon, n = e.id, i = e.className, s = e.extend, o = xn(e, ["icon", "id", "className", "extend"]),
|
|
275
|
-
return it(r, "".concat(n), { defIds: r.defIds, idSuffix: a.current }, T({ ref: t, className:
|
|
274
|
+
var r = e.icon, n = e.id, i = e.className, s = e.extend, o = xn(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), a = Ce("_".concat(kn()));
|
|
275
|
+
return it(r, "".concat(n), { defIds: r.defIds, idSuffix: a.current }, T({ ref: t, className: l }, o), s);
|
|
276
276
|
});
|
|
277
277
|
function it(e, t, r, n, i) {
|
|
278
278
|
return be(e.tag, T(T({ key: t }, Rn(e, r, i)), n), (On(e, r).children || []).map(function(s, o) {
|
|
@@ -282,13 +282,13 @@ function it(e, t, r, n, i) {
|
|
|
282
282
|
function Rn(e, t, r) {
|
|
283
283
|
var n = T({}, e.attrs);
|
|
284
284
|
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(s) {
|
|
285
|
-
var o = s[0],
|
|
286
|
-
o === "mask" && typeof
|
|
285
|
+
var o = s[0], l = s[1];
|
|
286
|
+
o === "mask" && typeof l == "string" && (n[o] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
287
287
|
});
|
|
288
288
|
var i = t.defIds;
|
|
289
289
|
return !i || i.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(s) {
|
|
290
|
-
var o = s[0],
|
|
291
|
-
typeof
|
|
290
|
+
var o = s[0], l = s[1];
|
|
291
|
+
typeof l == "string" && (n[o] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
292
292
|
})), n;
|
|
293
293
|
}
|
|
294
294
|
function On(e, t) {
|
|
@@ -297,26 +297,26 @@ function On(e, t) {
|
|
|
297
297
|
return typeof i.attrs.id == "string" && n && n.includes(i.attrs.id) ? T(T({}, i), { attrs: T(T({}, i.attrs), { id: i.attrs.id + t.idSuffix }) }) : i;
|
|
298
298
|
}) }) : e;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function kn() {
|
|
301
301
|
return Math.random().toString(36).substring(2, 8);
|
|
302
302
|
}
|
|
303
303
|
rt.displayName = "UniverIcon";
|
|
304
|
-
var
|
|
304
|
+
var Un = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, st = tt(function(e, t) {
|
|
305
305
|
return be(rt, Object.assign({}, e, {
|
|
306
306
|
id: "check-mark-icon",
|
|
307
307
|
ref: t,
|
|
308
|
-
icon:
|
|
308
|
+
icon: Un
|
|
309
309
|
}));
|
|
310
310
|
});
|
|
311
311
|
st.displayName = "CheckMarkIcon";
|
|
312
312
|
const le = "customFormat", ue = "numfmt_custom_pattern";
|
|
313
313
|
function $n(e) {
|
|
314
|
-
const { defaultPattern: t, action: r, onChange: n } = e, i = b(j), s = b(Ae), o = b(E), [
|
|
315
|
-
r.current = () => (i.markHabit(le,
|
|
316
|
-
const p = [.../* @__PURE__ */ new Set([
|
|
314
|
+
const { defaultPattern: t, action: r, onChange: n } = e, i = b(j), s = b(Ae), o = b(E), [l, a] = N(t);
|
|
315
|
+
r.current = () => (i.markHabit(le, l), s.getItem(ue).then((f = []) => {
|
|
316
|
+
const p = [.../* @__PURE__ */ new Set([l, ...f || []])].splice(0, 10).filter((d) => !!d);
|
|
317
317
|
s.setItem(ue, p);
|
|
318
|
-
}),
|
|
319
|
-
const [
|
|
318
|
+
}), l);
|
|
319
|
+
const [c, m] = N([]);
|
|
320
320
|
ie(() => {
|
|
321
321
|
s.getItem(ue).then((f) => {
|
|
322
322
|
const p = [
|
|
@@ -334,7 +334,7 @@ function $n(e) {
|
|
|
334
334
|
const u = (f) => {
|
|
335
335
|
a(f), n(f);
|
|
336
336
|
}, v = () => {
|
|
337
|
-
n(
|
|
337
|
+
n(l);
|
|
338
338
|
};
|
|
339
339
|
return /* @__PURE__ */ C("div", { children: [
|
|
340
340
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: o.t("sheet.numfmt.customFormat") }),
|
|
@@ -343,7 +343,7 @@ function $n(e) {
|
|
|
343
343
|
{
|
|
344
344
|
placeholder: o.t("sheet.numfmt.customFormat"),
|
|
345
345
|
onBlur: v,
|
|
346
|
-
value:
|
|
346
|
+
value: l,
|
|
347
347
|
onChange: a,
|
|
348
348
|
className: "univer-mt-2 univer-w-full"
|
|
349
349
|
}
|
|
@@ -352,13 +352,13 @@ function $n(e) {
|
|
|
352
352
|
"div",
|
|
353
353
|
{
|
|
354
354
|
className: nt("univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2", fn),
|
|
355
|
-
children:
|
|
355
|
+
children: c.map((f) => /* @__PURE__ */ C(
|
|
356
356
|
"div",
|
|
357
357
|
{
|
|
358
358
|
onClick: () => u(f),
|
|
359
359
|
className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-1.5 univer-py-1.5 univer-text-sm",
|
|
360
360
|
children: [
|
|
361
|
-
/* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children:
|
|
361
|
+
/* @__PURE__ */ h("div", { className: "univer-flex univer-w-4 univer-items-center univer-text-primary-600", children: l === f && /* @__PURE__ */ h(st, {}) }),
|
|
362
362
|
/* @__PURE__ */ h("div", { children: f })
|
|
363
363
|
]
|
|
364
364
|
},
|
|
@@ -380,21 +380,21 @@ const Dn = (e) => {
|
|
|
380
380
|
return Ve().map((r) => r.value).includes(e) || ["date", "datetime", "time"].includes(t.type);
|
|
381
381
|
};
|
|
382
382
|
function Fn(e) {
|
|
383
|
-
const { onChange: t, defaultPattern: r } = e, n =
|
|
383
|
+
const { onChange: t, defaultPattern: r } = e, n = R(Ve, []), i = b(E), [s, o] = N(() => {
|
|
384
384
|
if (r) {
|
|
385
|
-
const a = n.find((
|
|
385
|
+
const a = n.find((c) => c.value === r);
|
|
386
386
|
if (a)
|
|
387
387
|
return a.value;
|
|
388
388
|
}
|
|
389
389
|
return n[0].value;
|
|
390
390
|
});
|
|
391
391
|
e.action.current = () => s;
|
|
392
|
-
const
|
|
392
|
+
const l = (a) => {
|
|
393
393
|
a !== void 0 && (o(a), t(a));
|
|
394
394
|
};
|
|
395
395
|
return /* @__PURE__ */ C("div", { children: [
|
|
396
396
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: i.t("sheet.numfmt.dateType") }),
|
|
397
|
-
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { value: s, options: n, onChange:
|
|
397
|
+
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ee, { value: s, options: n, onChange: l }) }),
|
|
398
398
|
/* @__PURE__ */ h(
|
|
399
399
|
"div",
|
|
400
400
|
{
|
|
@@ -415,15 +415,15 @@ const Ln = (e) => !e, An = (e) => {
|
|
|
415
415
|
) });
|
|
416
416
|
}, Hn = (e) => We().some((t) => re(t.value, e));
|
|
417
417
|
function jn(e) {
|
|
418
|
-
const t = b(E), r =
|
|
418
|
+
const t = b(E), r = R(We, []), [n, i] = N(() => J(e.defaultPattern || "", 0)), [s, o] = N(() => {
|
|
419
419
|
const u = r.find((v) => re(v.value, e.defaultPattern || ""));
|
|
420
420
|
return (u == null ? void 0 : u.value) || r[0].value;
|
|
421
|
-
}),
|
|
422
|
-
i(u || 0), e.onChange(
|
|
421
|
+
}), l = R(() => k(s, Number(n || 0)), [s, n]), a = R(() => !Ot(s), [s]), c = (u) => {
|
|
422
|
+
i(u || 0), e.onChange(k(s, Number(u || 0)));
|
|
423
423
|
}, m = (u) => {
|
|
424
424
|
u !== void 0 && (i(J(u, 0)), o(u), e.onChange(u));
|
|
425
425
|
};
|
|
426
|
-
return e.action.current = () =>
|
|
426
|
+
return e.action.current = () => l, /* @__PURE__ */ C("div", { children: [
|
|
427
427
|
/* @__PURE__ */ h("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: t.t("sheet.numfmt.decimalLength") }),
|
|
428
428
|
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(
|
|
429
429
|
Ie,
|
|
@@ -432,7 +432,7 @@ function jn(e) {
|
|
|
432
432
|
value: n,
|
|
433
433
|
max: 20,
|
|
434
434
|
min: 0,
|
|
435
|
-
onChange:
|
|
435
|
+
onChange: c
|
|
436
436
|
}
|
|
437
437
|
) }),
|
|
438
438
|
/* @__PURE__ */ C("div", { className: "univer-mt-4 univer-text-sm univer-text-gray-400", children: [
|
|
@@ -450,29 +450,29 @@ function jn(e) {
|
|
|
450
450
|
] });
|
|
451
451
|
}
|
|
452
452
|
const Bn = (e) => {
|
|
453
|
-
const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = Ce(() => ""),
|
|
453
|
+
const { defaultValue: t, defaultPattern: r, row: n, col: i } = e.value, s = b(E), o = Ce(() => ""), l = s.t, a = En(), c = R(
|
|
454
454
|
() => [
|
|
455
455
|
{ label: "sheet.numfmt.general", component: An },
|
|
456
|
-
{ label: "sheet.numfmt.accounting", component:
|
|
456
|
+
{ label: "sheet.numfmt.accounting", component: wn },
|
|
457
457
|
{ label: "sheet.numfmt.currency", component: Pn },
|
|
458
458
|
{ label: "sheet.numfmt.date", component: Fn },
|
|
459
459
|
{ label: "sheet.numfmt.thousandthPercentile", component: jn },
|
|
460
460
|
{ label: "sheet.numfmt.customFormat", component: $n }
|
|
461
|
-
].map((_) => ({ ..._, label:
|
|
461
|
+
].map((_) => ({ ..._, label: l(_.label) })),
|
|
462
462
|
[]
|
|
463
|
-
), [m, u] = N(g), [v, f] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } = Nn(() => f(`${n}_${i}_userCurrency'`)), S =
|
|
463
|
+
), [m, u] = N(g), [v, f] = N(() => `${n}_${i}`), { mark: p, userHabitCurrency: d } = Nn(() => f(`${n}_${i}_userCurrency'`)), S = R(() => {
|
|
464
464
|
var _;
|
|
465
|
-
return (_ =
|
|
465
|
+
return (_ = c.find(($) => $.label === m)) == null ? void 0 : _.component;
|
|
466
466
|
}, [m]);
|
|
467
467
|
function g() {
|
|
468
|
-
return [Ln, Tn,
|
|
468
|
+
return [Ln, Tn, Mn, Dn, Hn].reduce(($, ut, mt) => $ || (ut(r) ? c[mt].label : ""), "") || c[0].label;
|
|
469
469
|
}
|
|
470
|
-
const I =
|
|
470
|
+
const I = c.map((_) => ({
|
|
471
471
|
label: _.label,
|
|
472
472
|
value: _.label
|
|
473
473
|
})), P = (_) => {
|
|
474
474
|
u(_), a(() => e.onChange({ type: "change", value: o.current() || "" }));
|
|
475
|
-
},
|
|
475
|
+
}, O = hn((_) => {
|
|
476
476
|
e.onChange({ type: "change", value: _ });
|
|
477
477
|
}, []), U = () => {
|
|
478
478
|
const _ = o.current() || "", $ = V(_);
|
|
@@ -480,7 +480,7 @@ const Bn = (e) => {
|
|
|
480
480
|
}, F = () => {
|
|
481
481
|
e.onChange({ type: "cancel", value: "" });
|
|
482
482
|
}, se = {
|
|
483
|
-
onChange:
|
|
483
|
+
onChange: O,
|
|
484
484
|
defaultValue: t,
|
|
485
485
|
defaultPattern: r,
|
|
486
486
|
action: o
|
|
@@ -493,13 +493,13 @@ const Bn = (e) => {
|
|
|
493
493
|
className: nt("univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5", pn),
|
|
494
494
|
children: [
|
|
495
495
|
/* @__PURE__ */ C("div", { children: [
|
|
496
|
-
/* @__PURE__ */ h("div", { className: "univer-mt-3.5 univer-text-sm univer-text-gray-400", children:
|
|
496
|
+
/* @__PURE__ */ h("div", { className: "univer-mt-3.5 univer-text-sm univer-text-gray-400", children: l("sheet.numfmt.numfmtType") }),
|
|
497
497
|
/* @__PURE__ */ h("div", { className: "univer-mt-2", children: /* @__PURE__ */ h(Ne, { className: "univer-w-full", value: m, options: I, onChange: P }) }),
|
|
498
498
|
/* @__PURE__ */ h("div", { children: S && /* @__PURE__ */ h(Te.Provider, { value: d, children: /* @__PURE__ */ be(S, { ...se, key: v }) }) })
|
|
499
499
|
] }),
|
|
500
500
|
/* @__PURE__ */ C("div", { className: "univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end", children: [
|
|
501
|
-
/* @__PURE__ */ h(xe, { onClick: F, className: "univer-mr-3", children:
|
|
502
|
-
/* @__PURE__ */ h(xe, { variant: "primary", onClick: U, children:
|
|
501
|
+
/* @__PURE__ */ h(xe, { onClick: F, className: "univer-mr-3", children: l("sheet.numfmt.cancel") }),
|
|
502
|
+
/* @__PURE__ */ h(xe, { variant: "primary", onClick: U, children: l("sheet.numfmt.confirm") })
|
|
503
503
|
] })
|
|
504
504
|
]
|
|
505
505
|
}
|
|
@@ -509,10 +509,10 @@ var Vn = Object.getOwnPropertyDescriptor, Wn = (e, t, r, n) => {
|
|
|
509
509
|
for (var i = n > 1 ? void 0 : n ? Vn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
510
510
|
(o = e[s]) && (i = o(i) || i);
|
|
511
511
|
return i;
|
|
512
|
-
},
|
|
513
|
-
const
|
|
512
|
+
}, M = (e, t) => (r, n) => t(r, n, e);
|
|
513
|
+
const ke = "SHEET_NUMFMT_PANEL";
|
|
514
514
|
let B = class extends ne {
|
|
515
|
-
constructor(t, r, n, i, s, o,
|
|
515
|
+
constructor(t, r, n, i, s, o, l, a, c, m, u) {
|
|
516
516
|
super();
|
|
517
517
|
/**
|
|
518
518
|
* If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
|
|
@@ -522,7 +522,7 @@ let B = class extends ne {
|
|
|
522
522
|
*/
|
|
523
523
|
q(this, "_previewPattern", "");
|
|
524
524
|
q(this, "_sidebarDisposable", null);
|
|
525
|
-
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService =
|
|
525
|
+
this._sheetInterceptorService = t, this._themeService = r, this._univerInstanceService = n, this._commandService = i, this._selectionManagerService = s, this._renderManagerService = o, this._numfmtService = l, this._componentManager = a, this._sidebarService = c, this._localeService = m, this._sheetsNumfmtCellContentController = u, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
|
|
526
526
|
}
|
|
527
527
|
_initNumfmtLocalChange() {
|
|
528
528
|
this.disposeWithMe(Qe(this._sheetsNumfmtCellContentController.locale$, this._localeService.currentLocale$).subscribe(() => {
|
|
@@ -534,34 +534,34 @@ let B = class extends ne {
|
|
|
534
534
|
const t = this._sidebarService, r = this._selectionManagerService, n = this._commandService, i = this._univerInstanceService, s = this._numfmtService, o = this._localeService, a = (((S = r.getCurrentSelections()) == null ? void 0 : S.map((g) => g.range)) || [])[0];
|
|
535
535
|
if (!a)
|
|
536
536
|
return !1;
|
|
537
|
-
const
|
|
537
|
+
const c = i.getCurrentUnitForType(w.UNIVER_SHEET), m = c.getActiveSheet();
|
|
538
538
|
if (!m)
|
|
539
539
|
return !1;
|
|
540
540
|
const u = m.getCellRaw(a.startRow, a.startColumn), v = s.getValue(
|
|
541
|
-
|
|
541
|
+
c.getUnitId(),
|
|
542
542
|
m.getSheetId(),
|
|
543
543
|
a.startRow,
|
|
544
544
|
a.startColumn
|
|
545
545
|
);
|
|
546
546
|
let f = "";
|
|
547
547
|
v && (f = v.pattern);
|
|
548
|
-
const p = (u == null ? void 0 : u.t) ===
|
|
548
|
+
const p = (u == null ? void 0 : u.t) === x.NUMBER ? u.v : 12345678, d = {
|
|
549
549
|
onChange: (g) => {
|
|
550
550
|
var I;
|
|
551
551
|
if (g.type === "change")
|
|
552
552
|
this._previewPattern = g.value, this._forceUpdate();
|
|
553
553
|
else if (g.type === "confirm") {
|
|
554
|
-
const P = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((F) => F.range)) || [],
|
|
554
|
+
const P = ((I = r.getCurrentSelections()) == null ? void 0 : I.map((F) => F.range)) || [], O = { values: [] }, U = pe(g.value);
|
|
555
555
|
P.forEach((F) => {
|
|
556
556
|
He.foreach(F, (se, _) => {
|
|
557
|
-
|
|
557
|
+
O.values.push({
|
|
558
558
|
row: se,
|
|
559
559
|
col: _,
|
|
560
560
|
pattern: g.value,
|
|
561
561
|
type: U
|
|
562
562
|
});
|
|
563
563
|
});
|
|
564
|
-
}), n.executeCommand(Ke.id,
|
|
564
|
+
}), n.executeCommand(Ke.id, O), t.close();
|
|
565
565
|
} else g.type === "cancel" && t.close();
|
|
566
566
|
},
|
|
567
567
|
value: { defaultPattern: f, defaultValue: p, row: a.startRow, col: a.startColumn }
|
|
@@ -569,7 +569,7 @@ let B = class extends ne {
|
|
|
569
569
|
return this._sidebarDisposable = t.open({
|
|
570
570
|
header: { title: o.t("sheet.numfmt.title") },
|
|
571
571
|
children: {
|
|
572
|
-
label:
|
|
572
|
+
label: ke,
|
|
573
573
|
...d
|
|
574
574
|
// need passthrough to react props.
|
|
575
575
|
},
|
|
@@ -581,7 +581,7 @@ let B = class extends ne {
|
|
|
581
581
|
_forceUpdate(t) {
|
|
582
582
|
var n;
|
|
583
583
|
const r = this._renderManagerService.getRenderById(
|
|
584
|
-
t != null ? t : this._univerInstanceService.getCurrentUnitForType(
|
|
584
|
+
t != null ? t : this._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET).getUnitId()
|
|
585
585
|
);
|
|
586
586
|
r == null || r.with(Bt).reCalculate(), (n = r == null ? void 0 : r.mainComponent) == null || n.makeDirty();
|
|
587
587
|
}
|
|
@@ -595,7 +595,7 @@ let B = class extends ne {
|
|
|
595
595
|
}
|
|
596
596
|
_initPanel() {
|
|
597
597
|
this.disposeWithMe(
|
|
598
|
-
this._componentManager.register(
|
|
598
|
+
this._componentManager.register(ke, Bn)
|
|
599
599
|
);
|
|
600
600
|
}
|
|
601
601
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -625,41 +625,41 @@ let B = class extends ne {
|
|
|
625
625
|
this._previewPattern = null;
|
|
626
626
|
})
|
|
627
627
|
).subscribe(({ disposableCollection: n, selectionRanges: i }) => {
|
|
628
|
-
var o,
|
|
629
|
-
const s = this._univerInstanceService.getCurrentUnitForType(
|
|
628
|
+
var o, l;
|
|
629
|
+
const s = this._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET);
|
|
630
630
|
this.openPanel(), n.add(
|
|
631
631
|
this._sheetInterceptorService.intercept(Kt.CELL_CONTENT, {
|
|
632
632
|
priority: 99,
|
|
633
|
-
effect:
|
|
634
|
-
handler: (a,
|
|
633
|
+
effect: we.Value | we.Style,
|
|
634
|
+
handler: (a, c, m) => {
|
|
635
635
|
var p;
|
|
636
|
-
const { row: u, col: v } =
|
|
636
|
+
const { row: u, col: v } = c, f = m(a) || {};
|
|
637
637
|
if (i.find(
|
|
638
638
|
(d) => d.startColumn <= v && d.endColumn >= v && d.startRow <= u && d.endRow >= u
|
|
639
639
|
)) {
|
|
640
|
-
const d =
|
|
641
|
-
if (S == null || g !==
|
|
640
|
+
const d = c.worksheet.getCellRaw(u, v), S = d == null ? void 0 : d.v, g = d == null ? void 0 : d.t;
|
|
641
|
+
if (S == null || g !== x.NUMBER || this._previewPattern === null)
|
|
642
642
|
return f;
|
|
643
|
-
const I =
|
|
643
|
+
const I = kt(this._previewPattern, S, this._sheetsNumfmtCellContentController.locale);
|
|
644
644
|
if (I.color) {
|
|
645
645
|
const P = (p = this._themeService.getColorFromTheme(`${I.color}.500`)) != null ? p : I.color;
|
|
646
646
|
return {
|
|
647
647
|
...f,
|
|
648
648
|
v: I.result,
|
|
649
|
-
t:
|
|
649
|
+
t: x.STRING,
|
|
650
650
|
s: { cl: { rgb: P } }
|
|
651
651
|
};
|
|
652
652
|
}
|
|
653
653
|
return {
|
|
654
654
|
...f,
|
|
655
655
|
v: I.result,
|
|
656
|
-
t:
|
|
656
|
+
t: x.STRING
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
659
|
return f;
|
|
660
660
|
}
|
|
661
661
|
})
|
|
662
|
-
), (
|
|
662
|
+
), (l = (o = this._renderManagerService.getRenderById(s.getUnitId())) == null ? void 0 : o.mainComponent) == null || l.makeDirty();
|
|
663
663
|
})
|
|
664
664
|
)
|
|
665
665
|
);
|
|
@@ -679,24 +679,24 @@ let B = class extends ne {
|
|
|
679
679
|
);
|
|
680
680
|
}
|
|
681
681
|
_initCloseListener() {
|
|
682
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
682
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(w.UNIVER_SHEET).subscribe((t) => {
|
|
683
683
|
var r;
|
|
684
684
|
t || ((r = this._sidebarDisposable) == null || r.dispose(), this._sidebarDisposable = null);
|
|
685
685
|
});
|
|
686
686
|
}
|
|
687
687
|
};
|
|
688
688
|
B = Wn([
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
689
|
+
M(0, y(qe)),
|
|
690
|
+
M(1, y(pt)),
|
|
691
|
+
M(2, ve),
|
|
692
|
+
M(3, fe),
|
|
693
|
+
M(4, y(_e)),
|
|
694
|
+
M(5, Be),
|
|
695
|
+
M(6, ge),
|
|
696
|
+
M(7, y(Je)),
|
|
697
|
+
M(8, en),
|
|
698
|
+
M(9, y(E)),
|
|
699
|
+
M(10, y(Ge))
|
|
700
700
|
], B);
|
|
701
701
|
var Gn = Object.getOwnPropertyDescriptor, Kn = (e, t, r, n) => {
|
|
702
702
|
for (var i = n > 1 ? void 0 : n ? Gn(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
@@ -706,7 +706,7 @@ var Gn = Object.getOwnPropertyDescriptor, Kn = (e, t, r, n) => {
|
|
|
706
706
|
const Zn = () => {
|
|
707
707
|
let e = [];
|
|
708
708
|
return {
|
|
709
|
-
add: (i, s, o,
|
|
709
|
+
add: (i, s, o, l, a) => e.push({ unitId: i, subUnitId: s, row: o, col: l, value: a }),
|
|
710
710
|
getEffects: () => e,
|
|
711
711
|
clean: () => {
|
|
712
712
|
e = [];
|
|
@@ -738,7 +738,7 @@ let Q = class extends ne {
|
|
|
738
738
|
case "grouped":
|
|
739
739
|
case "number": {
|
|
740
740
|
const a = r.worksheet.getCellRaw(i, s);
|
|
741
|
-
return (a == null ? void 0 : a.t) ===
|
|
741
|
+
return (a == null ? void 0 : a.t) === x.NUMBER && (a == null ? void 0 : a.v) !== void 0 && a.v !== null && Fe(a.v) && (a.v = _n(Number(a.v))), n && n(a);
|
|
742
742
|
}
|
|
743
743
|
case "percent":
|
|
744
744
|
case "date":
|
|
@@ -765,43 +765,45 @@ let Q = class extends ne {
|
|
|
765
765
|
this._sheetInterceptorService.writeCellInterceptor.intercept(Yt, {
|
|
766
766
|
// eslint-disable-next-line complexity
|
|
767
767
|
handler: (t, r, n) => {
|
|
768
|
-
var
|
|
768
|
+
var c, m, u;
|
|
769
|
+
if (!(t != null && t.v) && !(t != null && t.p))
|
|
770
|
+
return n(t);
|
|
769
771
|
this._collectEffectMutation.clean();
|
|
770
772
|
const i = this._numfmtService.getValue(
|
|
771
773
|
r.unitId,
|
|
772
774
|
r.subUnitId,
|
|
773
775
|
r.row,
|
|
774
776
|
r.col
|
|
775
|
-
);
|
|
776
|
-
if (
|
|
777
|
+
), s = r.worksheet.getCellRaw(r.row, r.col);
|
|
778
|
+
if (De(i == null ? void 0 : i.pattern) || t.t === x.FORCE_STRING)
|
|
777
779
|
return n(t);
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
780
|
-
if (Yn(
|
|
781
|
-
const { dataStream:
|
|
782
|
-
if (Number.isNaN(
|
|
780
|
+
const o = (c = t.p) == null ? void 0 : c.body, l = (u = (m = t == null ? void 0 : t.p) == null ? void 0 : m.body) != null && u.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), a = Ut(l);
|
|
781
|
+
if (o)
|
|
782
|
+
if (Yn(o)) {
|
|
783
|
+
const { dataStream: v } = o, f = v.replace(/\r\n$/, ""), p = Number(f);
|
|
784
|
+
if (Number.isNaN(p) && !a)
|
|
783
785
|
return n(t);
|
|
784
786
|
} else
|
|
785
787
|
return n(t);
|
|
786
|
-
if (
|
|
787
|
-
if (!
|
|
788
|
+
if (a) {
|
|
789
|
+
if (!a.z && !(i != null && i.pattern) && (s == null ? void 0 : s.t) !== x.STRING && (s == null ? void 0 : s.t) !== x.FORCE_STRING && St(l))
|
|
788
790
|
return n({
|
|
789
791
|
...t,
|
|
790
792
|
p: void 0,
|
|
791
|
-
v:
|
|
792
|
-
t:
|
|
793
|
+
v: l,
|
|
794
|
+
t: x.FORCE_STRING
|
|
793
795
|
});
|
|
794
|
-
|
|
796
|
+
a.z && this._collectEffectMutation.add(
|
|
795
797
|
r.unitId,
|
|
796
798
|
r.subUnitId,
|
|
797
799
|
r.row,
|
|
798
800
|
r.col,
|
|
799
801
|
{
|
|
800
|
-
pattern:
|
|
802
|
+
pattern: a.z
|
|
801
803
|
}
|
|
802
804
|
);
|
|
803
|
-
const
|
|
804
|
-
return n({ ...t, p: void 0, v
|
|
805
|
+
const v = Number(a.v);
|
|
806
|
+
return n({ ...t, p: void 0, v, t: x.NUMBER });
|
|
805
807
|
}
|
|
806
808
|
return n(t);
|
|
807
809
|
}
|
|
@@ -817,26 +819,26 @@ let Q = class extends ne {
|
|
|
817
819
|
var n;
|
|
818
820
|
switch (r.id) {
|
|
819
821
|
case zt.id: {
|
|
820
|
-
const i = t._univerInstanceService.getCurrentUnitForType(
|
|
822
|
+
const i = t._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET), s = i.getUnitId(), o = (n = i.getActiveSheet()) == null ? void 0 : n.getSheetId();
|
|
821
823
|
if (!o)
|
|
822
824
|
return {
|
|
823
825
|
redos: [],
|
|
824
826
|
undos: []
|
|
825
827
|
};
|
|
826
|
-
const
|
|
827
|
-
if (t._collectEffectMutation.clean(), !
|
|
828
|
+
const l = t._collectEffectMutation.getEffects();
|
|
829
|
+
if (t._collectEffectMutation.clean(), !l.length)
|
|
828
830
|
return {
|
|
829
831
|
redos: [],
|
|
830
832
|
undos: []
|
|
831
833
|
};
|
|
832
|
-
const a =
|
|
834
|
+
const a = l.filter((v) => {
|
|
833
835
|
var f;
|
|
834
836
|
return !!((f = v.value) != null && f.pattern);
|
|
835
837
|
}).map((v) => ({
|
|
836
838
|
row: v.row,
|
|
837
839
|
col: v.col,
|
|
838
840
|
pattern: v.value.pattern
|
|
839
|
-
})),
|
|
841
|
+
})), c = l.filter((v) => {
|
|
840
842
|
var f;
|
|
841
843
|
return !((f = v.value) != null && f.pattern);
|
|
842
844
|
}).map((v) => ({
|
|
@@ -852,13 +854,13 @@ let Q = class extends ne {
|
|
|
852
854
|
};
|
|
853
855
|
m.push(v), u.push(...qt(t._injector, v.params));
|
|
854
856
|
}
|
|
855
|
-
if (
|
|
857
|
+
if (c.length) {
|
|
856
858
|
const v = {
|
|
857
859
|
id: Se.id,
|
|
858
860
|
params: {
|
|
859
861
|
unitId: s,
|
|
860
862
|
subUnitId: o,
|
|
861
|
-
ranges:
|
|
863
|
+
ranges: c
|
|
862
864
|
}
|
|
863
865
|
};
|
|
864
866
|
m.push(v), u.push(...Jt(t._injector, v.params));
|
|
@@ -961,7 +963,7 @@ const ot = (e) => [
|
|
|
961
963
|
title: "sheet.numfmt.currency",
|
|
962
964
|
tooltip: "sheet.numfmt.currency",
|
|
963
965
|
type: X.BUTTON,
|
|
964
|
-
hidden$: z(e,
|
|
966
|
+
hidden$: z(e, w.UNIVER_SHEET),
|
|
965
967
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
966
968
|
}), Xn = (e) => ({
|
|
967
969
|
icon: "AddDigitsIcon",
|
|
@@ -969,7 +971,7 @@ const ot = (e) => [
|
|
|
969
971
|
title: "sheet.numfmt.addDecimal",
|
|
970
972
|
tooltip: "sheet.numfmt.addDecimal",
|
|
971
973
|
type: X.BUTTON,
|
|
972
|
-
hidden$: z(e,
|
|
974
|
+
hidden$: z(e, w.UNIVER_SHEET),
|
|
973
975
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
974
976
|
}), qn = (e) => ({
|
|
975
977
|
icon: "ReduceDigitsIcon",
|
|
@@ -977,7 +979,7 @@ const ot = (e) => [
|
|
|
977
979
|
title: "sheet.numfmt.subtractDecimal",
|
|
978
980
|
tooltip: "sheet.numfmt.subtractDecimal",
|
|
979
981
|
type: X.BUTTON,
|
|
980
|
-
hidden$: z(e,
|
|
982
|
+
hidden$: z(e, w.UNIVER_SHEET),
|
|
981
983
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
982
984
|
}), Jn = (e) => ({
|
|
983
985
|
icon: "PercentIcon",
|
|
@@ -985,14 +987,14 @@ const ot = (e) => [
|
|
|
985
987
|
title: "sheet.numfmt.percent",
|
|
986
988
|
tooltip: "sheet.numfmt.percent",
|
|
987
989
|
type: X.BUTTON,
|
|
988
|
-
hidden$: z(e,
|
|
990
|
+
hidden$: z(e, w.UNIVER_SHEET),
|
|
989
991
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [Z, K], rangeTypes: [G] })
|
|
990
992
|
}), Qn = (e) => {
|
|
991
993
|
const t = e.get(ve), r = e.get(fe), n = e.get(E), i = e.get(_e), s = [Se.id, ye.id], o = Wt(
|
|
992
994
|
t,
|
|
993
995
|
"",
|
|
994
|
-
({ workbook:
|
|
995
|
-
(
|
|
996
|
+
({ workbook: l, worksheet: a }) => new A(
|
|
997
|
+
(c) => Qe(
|
|
996
998
|
i.selectionMoveEnd$,
|
|
997
999
|
yt(r.onCommandExecuted.bind(r)).pipe(
|
|
998
1000
|
an(([m]) => s.includes(m.id))
|
|
@@ -1001,19 +1003,19 @@ const ot = (e) => [
|
|
|
1001
1003
|
var u, v;
|
|
1002
1004
|
const m = i.getCurrentSelections();
|
|
1003
1005
|
if (m && m[0]) {
|
|
1004
|
-
const f = m[0].range, p = f.startRow, d = f.startColumn, S = (v =
|
|
1006
|
+
const f = m[0].range, p = f.startRow, d = f.startColumn, S = (v = l.getStyles().get((u = a.getCell(p, d)) == null ? void 0 : u.s)) == null ? void 0 : v.n, g = S == null ? void 0 : S.pattern, I = $t(n.getCurrentLocale());
|
|
1005
1007
|
let P = n.t("sheet.numfmt.general");
|
|
1006
1008
|
if (Ct(g)) {
|
|
1007
|
-
|
|
1009
|
+
c.next(P);
|
|
1008
1010
|
return;
|
|
1009
1011
|
}
|
|
1010
1012
|
if (g) {
|
|
1011
|
-
const
|
|
1013
|
+
const O = ot(I).filter((U) => typeof U == "object" && U.pattern).find(
|
|
1012
1014
|
(U) => re(g, U.pattern)
|
|
1013
1015
|
);
|
|
1014
|
-
|
|
1016
|
+
O && typeof O == "object" && O.pattern ? P = n.t(O.label) : P = n.t("sheet.numfmt.moreFmt");
|
|
1015
1017
|
}
|
|
1016
|
-
|
|
1018
|
+
c.next(P);
|
|
1017
1019
|
}
|
|
1018
1020
|
})
|
|
1019
1021
|
)
|
|
@@ -1034,44 +1036,44 @@ const ot = (e) => [
|
|
|
1034
1036
|
}
|
|
1035
1037
|
],
|
|
1036
1038
|
value$: o,
|
|
1037
|
-
hidden$: z(e,
|
|
1039
|
+
hidden$: z(e, w.UNIVER_SHEET),
|
|
1038
1040
|
disabled$: W(e, { workbookTypes: [Y], worksheetTypes: [K, Z], rangeTypes: [G] })
|
|
1039
1041
|
};
|
|
1040
1042
|
}, at = "sheet.numfmt.moreNumfmtType", ct = "sheet.numfmt.moreNumfmtType.options", er = (e) => {
|
|
1041
1043
|
const { value: t } = e, r = b(E), n = t != null ? t : r.t("sheet.numfmt.general");
|
|
1042
1044
|
return /* @__PURE__ */ h("span", { className: "univer-text-sm", children: n });
|
|
1043
1045
|
}, tr = () => {
|
|
1044
|
-
const e = b(fe), t = b(E), r = b(tn), n = b(Ge), i = b(_e), s = (
|
|
1046
|
+
const e = b(fe), t = b(E), r = b(tn), n = b(Ge), i = b(_e), s = (c) => {
|
|
1045
1047
|
const m = i.getCurrentLastSelection();
|
|
1046
1048
|
if (!m)
|
|
1047
1049
|
return;
|
|
1048
1050
|
const u = m.range, v = [];
|
|
1049
1051
|
He.foreach(u, (f, p) => {
|
|
1050
|
-
|
|
1052
|
+
c ? v.push({ row: f, col: p, pattern: c, type: pe(c) }) : v.push({ row: f, col: p });
|
|
1051
1053
|
}), e.executeCommand(Ke.id, { values: v }), r.focus();
|
|
1052
|
-
}, o =
|
|
1053
|
-
const
|
|
1054
|
-
return ot(
|
|
1055
|
-
}, [t]),
|
|
1056
|
-
if (
|
|
1054
|
+
}, o = R(() => {
|
|
1055
|
+
const c = Dt.get(t.getCurrentLocale());
|
|
1056
|
+
return ot(c);
|
|
1057
|
+
}, [t]), l = (c) => {
|
|
1058
|
+
if (c === 0)
|
|
1057
1059
|
s(null);
|
|
1058
|
-
else if (
|
|
1060
|
+
else if (c === o.length - 1)
|
|
1059
1061
|
e.executeCommand(H.id), r.focus();
|
|
1060
1062
|
else {
|
|
1061
|
-
const m = o[
|
|
1063
|
+
const m = o[c];
|
|
1062
1064
|
m.pattern && s(m.pattern);
|
|
1063
1065
|
}
|
|
1064
1066
|
}, a = 1220;
|
|
1065
|
-
return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((
|
|
1067
|
+
return /* @__PURE__ */ h("div", { className: "univer-grid univer-gap-1 univer-p-1.5", children: o.map((c, m) => c === "|" ? /* @__PURE__ */ h(gn, {}, m) : /* @__PURE__ */ C(
|
|
1066
1068
|
"div",
|
|
1067
1069
|
{
|
|
1068
1070
|
className: "univer-flex univer-h-7 univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-px-2 univer-text-sm hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
1069
1071
|
onClick: () => {
|
|
1070
|
-
|
|
1072
|
+
l(m);
|
|
1071
1073
|
},
|
|
1072
1074
|
children: [
|
|
1073
|
-
/* @__PURE__ */ h("span", { children: t.t(
|
|
1074
|
-
/* @__PURE__ */ h("span", { className: "univer-text-xs univer-text-gray-500", children:
|
|
1075
|
+
/* @__PURE__ */ h("span", { children: t.t(c.label) }),
|
|
1076
|
+
/* @__PURE__ */ h("span", { className: "univer-text-xs univer-text-gray-500", children: c.pattern ? Ft(c.pattern || "", a, n.locale).result.trim() : "" })
|
|
1075
1077
|
]
|
|
1076
1078
|
},
|
|
1077
1079
|
m
|
|
@@ -1104,7 +1106,7 @@ var rr = Object.getOwnPropertyDescriptor, ir = (e, t, r, n) => {
|
|
|
1104
1106
|
for (var i = n > 1 ? void 0 : n ? rr(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
1105
1107
|
(o = e[s]) && (i = o(i) || i);
|
|
1106
1108
|
return i;
|
|
1107
|
-
},
|
|
1109
|
+
}, Ue = (e, t) => (r, n) => t(r, n, e);
|
|
1108
1110
|
let ee = class extends ne {
|
|
1109
1111
|
constructor(e, t) {
|
|
1110
1112
|
super(), this._componentManager = e, this._menuManagerService = t, this._initMenu();
|
|
@@ -1121,8 +1123,8 @@ let ee = class extends ne {
|
|
|
1121
1123
|
}
|
|
1122
1124
|
};
|
|
1123
1125
|
ee = ir([
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
+
Ue(0, y(Je)),
|
|
1127
|
+
Ue(1, rn)
|
|
1126
1128
|
], ee);
|
|
1127
1129
|
var sr = Object.defineProperty, or = Object.getOwnPropertyDescriptor, ar = (e, t, r) => t in e ? sr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, cr = (e, t, r, n) => {
|
|
1128
1130
|
for (var i = n > 1 ? void 0 : n ? or(t, r) : t, s = e.length - 1, o; s >= 0; s--)
|
|
@@ -1149,7 +1151,7 @@ let te = class extends Nt {
|
|
|
1149
1151
|
]);
|
|
1150
1152
|
}
|
|
1151
1153
|
onRendered() {
|
|
1152
|
-
this._registerRenderModules(),
|
|
1154
|
+
this._registerRenderModules(), wt(this._injector, [
|
|
1153
1155
|
[B],
|
|
1154
1156
|
[Q],
|
|
1155
1157
|
[ee]
|
|
@@ -1159,12 +1161,12 @@ let te = class extends Nt {
|
|
|
1159
1161
|
[
|
|
1160
1162
|
[he]
|
|
1161
1163
|
].forEach((t) => {
|
|
1162
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
1164
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(w.UNIVER_SHEET, t));
|
|
1163
1165
|
});
|
|
1164
1166
|
}
|
|
1165
1167
|
};
|
|
1166
1168
|
lt(te, "pluginName", lr);
|
|
1167
|
-
lt(te, "type",
|
|
1169
|
+
lt(te, "type", w.UNIVER_SHEET);
|
|
1168
1170
|
te = cr([
|
|
1169
1171
|
It(Gt, Lt),
|
|
1170
1172
|
me(1, y(je)),
|