| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109 |
- var pt = Object.defineProperty;
- var vt = (t, e, n) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
- var X = (t, e, n) => vt(t, typeof e != "symbol" ? e + "" : e, n);
- import { Inject as S, LocaleService as T, Disposable as oe, isRealNum as _t, CommandType as Be, ILocalStorageService as We, useDependency as b, numfmt as Q, UniverInstanceType as E, CellValueType as $, Range as Ve, toDisposable as ge, DisposableCollection as gt, InterceptorEffectEnum as Oe, ThemeService as St, IUniverInstanceService as ye, ICommandService as be, Injector as Ge, Optional as yt, DependentOn as bt, Plugin as Ct, merge as It, registerDependencies as Nt, touchDependencies as Et, IConfigService as Tt } from "@univerjs/core";
- import { IRenderManagerService as Ke } from "@univerjs/engine-render";
- import { currencySymbols as Ue, getDecimalFromPattern as te, getCurrencyType as W, setPatternDecimal as M, getCurrencyFormatOptions as ue, isPatternEqualWithoutDecimal as ce, CURRENCYFORMAT as xt, DATEFMTLISG as Pt, NUMBERFORMAT as Mt, getDateFormatOptions as qe, getNumberFormatOptions as Ye, isPatternHasDecimal as Rt, getPatternType as ne, SetNumfmtCommand as Ze, getPatternPreviewIgnoreGeneral as jt, SheetsNumfmtCellContentController as ze, MenuCurrencyService as wt, countryCurrencyMap as O, SetCurrencyCommand as Je, AddDecimalCommand as Xe, SubtractDecimalCommand as Qe, SetPercentCommand as et, getPatternPreview as Ot, UniverSheetsNumfmtPlugin as Ut } from "@univerjs/sheets-numfmt";
- import { HoverManagerService as $t, CellAlertManagerService as Dt, CellAlertType as Ft, SheetSkeletonManagerService as Lt, IEditorBridgeService as Ht, getCurrentRangeDisable$ as V, deriveStateFromActiveSheet$ as At, UniverSheetsUIPlugin as kt } from "@univerjs/sheets-ui";
- import { IZenZoneService as Bt, ComponentManager as tt, ISidebarService as Wt, MenuItemType as G, getMenuHiddenObservable as K, ILayoutService as Vt, RibbonStartGroup as Gt, IMenuManagerService as Kt, UI_PLUGIN_CONFIG_KEY as qt } from "@univerjs/ui";
- import { FormulaDataModel as Yt } from "@univerjs/engine-formula";
- import { DEFAULT_TEXT_FORMAT as Ce } from "@univerjs/engine-numfmt";
- import { INumfmtService as Ie, INTERCEPTOR_POINT as Zt, RemoveNumfmtMutation as Ne, SetNumfmtMutation as Ee, SheetInterceptorService as nt, SheetsSelectionsService as Te, BEFORE_CELL_EDIT as zt, AFTER_CELL_EDIT as Jt, SetRangeValuesCommand as Xt, transformCellsToRange as Qt, factorySetNumfmtUndoMutation as en, factoryRemoveNumfmtUndoMutation as tn, WorkbookEditablePermission as q, WorksheetEditPermission as Y, WorksheetSetCellStylePermission as Z, RangeProtectionPermissionEditPoint as z } from "@univerjs/sheets";
- import { debounceTime as nn, merge as rt, Observable as D, combineLatest as rn } from "rxjs";
- import { map as sn, switchMap as on, tap as cn, debounceTime as an } from "rxjs/operators";
- import ln, { createContext as mn, useState as C, useEffect as ae, useRef as xe, useContext as st, useMemo as R, forwardRef as it, createElement as Pe } from "react";
- import { InputNumber as Me, Select as Re, SelectList as je, Input as un, Button as $e } from "@univerjs/design";
- const De = {};
- var dn = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, fn = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? hn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && dn(e, n, s), s;
- }, U = (t, e) => (n, r) => e(n, r, t);
- const de = "SHEET_NUMFMT_ALERT";
- let Se = class extends oe {
- constructor(t, e, n, r, s, i, o) {
- super(), this._context = t, this._hoverManagerService = e, this._cellAlertManagerService = n, this._localeService = r, this._formulaDataModel = s, this._zenZoneService = i, this._numfmtService = o, this._init();
- }
- _init() {
- this._initCellAlertPopup(), this._initZenService();
- }
- _initCellAlertPopup() {
- this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(nn(100)).subscribe((t) => {
- var e;
- if (t) {
- const n = t.location, r = this._context.unit, s = r.getActiveSheet();
- if (!s) return;
- const i = n.unitId, o = n.subUnitId;
- let a;
- const c = s.getCell(n.row, n.col);
- if (c != null && c.s) {
- const m = r.getStyles().get(c.s);
- m != null && m.n && (a = m.n);
- }
- if (a || (a = this._numfmtService.getValue(i, o, n.row, n.col)), !a) {
- this._hideAlert();
- return;
- }
- if (a.pattern === Ce && (c != null && c.v) && _t(c.v)) {
- const m = this._cellAlertManagerService.currentAlert.get(de), d = (e = m == null ? void 0 : m.alert) == null ? void 0 : e.location;
- if (d && d.row === n.row && d.col === n.col && d.subUnitId === n.subUnitId && d.unitId === n.unitId)
- return;
- this._cellAlertManagerService.showAlert({
- type: Ft.ERROR,
- title: this._localeService.t("info.error"),
- message: this._localeService.t("info.forceStringInfo"),
- location: n,
- width: 200,
- height: 74,
- key: de
- });
- return;
- }
- }
- this._hideAlert();
- }));
- }
- _initZenService() {
- this.disposeWithMe(this._zenZoneService.visible$.subscribe((t) => {
- t && this._hideAlert();
- }));
- }
- _hideAlert() {
- this._cellAlertManagerService.removeAlert(de);
- }
- };
- Se = fn([
- U(1, S($t)),
- U(2, S(Dt)),
- U(3, S(T)),
- U(4, S(Yt)),
- U(5, Bt),
- U(6, S(Ie))
- ], Se);
- const he = {
- id: "sheet.operation.close.numfmt.panel",
- type: Be.OPERATION,
- handler: () => (
- // do nothing, just notify panel is closed
- !0
- )
- }, A = {
- id: "sheet.operation.open.numfmt.panel",
- type: Be.OPERATION,
- handler: (t) => (t.get(B).openPanel(), !0)
- };
- var fe = { exports: {} }, L = {};
- /**
- * @license React
- * react-jsx-runtime.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var Fe;
- function pn() {
- if (Fe) return L;
- Fe = 1;
- var t = ln, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
- function o(a, c, m) {
- var d, u = {}, h = null, p = null;
- m !== void 0 && (h = "" + m), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (p = c.ref);
- for (d in c) r.call(c, d) && !i.hasOwnProperty(d) && (u[d] = c[d]);
- if (a && a.defaultProps) for (d in c = a.defaultProps, c) u[d] === void 0 && (u[d] = c[d]);
- return { $$typeof: e, type: a, key: h, ref: p, props: u, _owner: s.current };
- }
- return L.Fragment = n, L.jsx = o, L.jsxs = o, L;
- }
- var Le;
- function vn() {
- return Le || (Le = 1, fe.exports = pn()), fe.exports;
- }
- var l = vn(), _n = Object.defineProperty, gn = Object.getOwnPropertyDescriptor, Sn = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? gn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && _n(e, n, s), s;
- }, yn = (t, e) => (n, r) => e(n, r, t);
- const we = mn([]);
- let k = class {
- constructor(t) {
- this._localStorageService = t;
- }
- _getKey(t) {
- return `userHabitController_${t}`;
- }
- async addHabit(t, e) {
- const n = this._getKey(t);
- return this._localStorageService.getItem(n).then((r) => {
- r || this._localStorageService.setItem(n, e);
- });
- }
- markHabit(t, e) {
- const n = this._getKey(t);
- this._localStorageService.getItem(n).then((r) => {
- if (r) {
- const s = r.findIndex((i) => i === e);
- s > -1 && r.splice(s, 1), r.unshift(e), this._localStorageService.setItem(n, r);
- }
- });
- }
- async getHabit(t, e) {
- const n = this._getKey(t), r = await this._localStorageService.getItem(n);
- if (e && r) {
- const s = r.map((i, o, a) => {
- const c = a.length;
- return {
- value: i,
- priority: c - o
- };
- });
- return e.sort((i, o) => {
- var m, d;
- const a = ((m = s.find((u) => u.value === i)) == null ? void 0 : m.priority) || -1;
- return (((d = s.find((u) => u.value === o)) == null ? void 0 : d.priority) || -1) - a;
- });
- }
- return r || [];
- }
- deleteHabit(t) {
- this._localStorageService.removeItem(t);
- }
- };
- k = Sn([
- yn(0, S(We))
- ], k);
- const He = "numfmtCurrency", bn = (t) => {
- const e = b(k), [n, r] = C(Ue);
- return ae(() => {
- e.addHabit("numfmtCurrency", []).then(() => {
- e.getHabit(He, [...Ue]).then((i) => {
- r(i), t(i);
- });
- });
- }, []), { userHabitCurrency: n, mark: (i) => {
- e.markHabit(He, i);
- } };
- }, Cn = () => {
- const t = xe([]), [e, n] = C({});
- return ae(() => {
- t.current.forEach((s) => {
- s();
- }), t.current = [];
- }, [e]), (s) => {
- t.current.push(s), n({});
- };
- }, In = (t) => !!W(t) && t.startsWith("_("), Nn = (t) => {
- const { defaultPattern: e, action: n, onChange: r } = t, [s, i] = C(() => te(e || "", 2)), o = st(we), [a, c] = C(() => W(e) || o[0]), m = R(() => o.map((v) => ({ label: v, value: v })), []), u = b(T).t;
- n.current = () => M(`_("${a}"* #,##0${s > 0 ? ".0" : ""}_)`, s);
- const h = (v) => {
- c(v), r(M(`_("${v}"* #,##0${s > 0 ? ".0" : ""}_)`, s));
- }, p = (v) => {
- const f = v || 0;
- i(f), r(M(`_("${a}"* #,##0${f > 0 ? ".0" : ""}_)`, f));
- };
- return /* @__PURE__ */ l.jsxs("div", { children: [
- /* @__PURE__ */ l.jsxs("div", { className: "m-t-16 options", children: [
- /* @__PURE__ */ l.jsxs("div", { className: "option", children: [
- /* @__PURE__ */ l.jsx("div", { className: "label", children: u("sheet.numfmt.decimalLength") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ l.jsx(Me, { value: s, max: 20, min: 0, onChange: p }) })
- ] }),
- /* @__PURE__ */ l.jsxs("div", { className: "option", children: [
- /* @__PURE__ */ l.jsx("div", { className: "label", children: u("sheet.numfmt.currencyType") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ l.jsx(Re, { onChange: h, options: m, value: a }) })
- ] })
- ] }),
- /* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: u("sheet.numfmt.accountingDes") })
- ] });
- }, En = (t) => !!W(t) && !t.startsWith("_("), Tn = (t) => {
- const n = b(T).t, r = st(we), [s, i] = C(() => W(t.defaultPattern) || r[0]), [o, a] = C(() => te(t.defaultPattern || "", 2)), [c, m] = C(() => {
- var _;
- const f = ue(s);
- return ((_ = f.find((I) => ce(I.value, t.defaultPattern))) == null ? void 0 : _.value) || f[0].value;
- }), d = R(() => ue(s), [s]), u = R(() => r.map((f) => ({ label: f, value: f })), [r]);
- t.action.current = () => M(c, o);
- const h = (f) => {
- if (f === void 0)
- return;
- i(f);
- const y = ue(f)[0].value;
- m(y), t.onChange(M(y, o));
- }, p = (f) => {
- f !== void 0 && (m(f), t.onChange(M(f, o)));
- }, v = (f) => {
- a(f || 0), t.onChange(M(c, f || 0));
- };
- return /* @__PURE__ */ l.jsxs("div", { children: [
- /* @__PURE__ */ l.jsxs("div", { className: "m-t-16 options", children: [
- /* @__PURE__ */ l.jsxs("div", { className: "option", children: [
- /* @__PURE__ */ l.jsx("div", { className: "label", children: n("sheet.numfmt.decimalLength") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ l.jsx(Me, { value: o, max: 20, min: 0, onChange: v }) })
- ] }),
- /* @__PURE__ */ l.jsxs("div", { className: "option", children: [
- /* @__PURE__ */ l.jsx("div", { className: "label", children: n("sheet.numfmt.currencyType") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ l.jsx(Re, { onChange: h, options: u, value: s }) })
- ] })
- ] }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: n("sheet.numfmt.negType") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(je, { onChange: p, options: d, value: c }) }),
- /* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.currencyDes") })
- ] });
- };
- var N = function() {
- return N = Object.assign || function(t) {
- for (var e, n = 1, r = arguments.length; n < r; n++) {
- e = arguments[n];
- for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
- }
- return t;
- }, N.apply(this, arguments);
- }, xn = function(t, e) {
- var n = {};
- for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
- for (var s = 0, r = Object.getOwnPropertySymbols(t); s < r.length; s++)
- e.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[s]) && (n[r[s]] = t[r[s]]);
- return n;
- }, ot = it(function(t, e) {
- var n = t.icon, r = t.id, s = t.className, i = t.extend, o = xn(t, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(s || "").trim(), c = xe("_".concat(Rn()));
- return ct(n, "".concat(r), { defIds: n.defIds, idSuffix: c.current }, N({ ref: e, className: a }, o), i);
- });
- function ct(t, e, n, r, s) {
- return Pe(t.tag, N(N({ key: e }, Pn(t, n, s)), r), (Mn(t, n).children || []).map(function(i, o) {
- return ct(i, "".concat(e, "-").concat(t.tag, "-").concat(o), n, void 0, s);
- }));
- }
- function Pn(t, e, n) {
- var r = N({}, t.attrs);
- n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
- var s = e.defIds;
- return !s || s.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(i) {
- var o = i[0], a = i[1];
- typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
- })), r;
- }
- function Mn(t, e) {
- var n, r = e.defIds;
- return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? N(N({}, t), { children: t.children.map(function(s) {
- return typeof s.attrs.id == "string" && r && r.indexOf(s.attrs.id) > -1 ? N(N({}, s), { attrs: N(N({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
- }) }) : t;
- }
- function Rn() {
- return Math.random().toString(36).substring(2, 8);
- }
- ot.displayName = "UniverIcon";
- var jn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, at = it(function(t, e) {
- return Pe(ot, Object.assign({}, t, {
- id: "check-mark-single",
- ref: e,
- icon: jn
- }));
- });
- at.displayName = "CheckMarkSingle";
- const wn = "univer-custom-format-title", On = "univer-custom-format-input", Un = "univer-custom-format-history-list", $n = "univer-custom-format-history-list-item", Dn = "univer-custom-format-history-list-item-icon-wrap", Fn = "univer-custom-format-des", j = {
- customFormatTitle: wn,
- customFormatInput: On,
- customFormatHistoryList: Un,
- customFormatHistoryListItem: $n,
- customFormatHistoryListItemIconWrap: Dn,
- customFormatDes: Fn
- }, pe = "customFormat", ve = "numfmt_custom_pattern";
- function Ln(t) {
- const { defaultPattern: e, action: n, onChange: r } = t, s = b(k), i = b(We), o = b(T), [a, c] = C(e);
- n.current = () => (s.markHabit(pe, a), i.getItem(ve).then((p = []) => {
- const v = [.../* @__PURE__ */ new Set([a, ...p || []])].splice(0, 10).filter((f) => !!f);
- i.setItem(ve, v);
- }), a);
- const [m, d] = C([]);
- ae(() => {
- i.getItem(ve).then((p) => {
- const v = [
- ...xt.map((f) => f.suffix("$")),
- ...Pt.map((f) => f.suffix),
- ...Mt.map((f) => f.suffix)
- ];
- v.push(...p || []), s.addHabit(pe, []).finally(() => {
- s.getHabit(pe, v).then((f) => {
- d([...new Set(f)]);
- });
- });
- });
- }, []);
- const u = (p) => {
- c(p), r(p);
- }, h = () => {
- r(a);
- };
- return /* @__PURE__ */ l.jsxs("div", { className: j.customFormat, children: [
- /* @__PURE__ */ l.jsx("div", { className: j.customFormatTitle, children: o.t("sheet.numfmt.customFormat") }),
- /* @__PURE__ */ l.jsx(un, { placeholder: o.t("sheet.numfmt.customFormat"), onBlur: h, value: a, onChange: c, className: j.customFormatInput }),
- /* @__PURE__ */ l.jsx("div", { className: j.customFormatHistoryList, children: m.map((p) => /* @__PURE__ */ l.jsxs("div", { onClick: () => u(p), className: j.customFormatHistoryListItem, children: [
- /* @__PURE__ */ l.jsx("div", { className: j.customFormatHistoryListItemIconWrap, children: a === p && /* @__PURE__ */ l.jsx(at, {}) }),
- /* @__PURE__ */ l.jsx("div", { children: p })
- ] }, p)) }),
- /* @__PURE__ */ l.jsx("div", { className: j.customFormatDes, children: o.t("sheet.numfmt.customFormatDes") })
- ] });
- }
- const Hn = (t) => {
- const e = Q.getInfo(t);
- return qe().map((n) => n.value).includes(t) || ["date", "datetime", "time"].includes(e.type);
- }, An = (t) => {
- const e = R(qe, []), r = b(T).t, [s, i] = C(() => {
- if (t.defaultPattern) {
- const a = e.find((c) => c.value === t.defaultPattern);
- if (a)
- return a.value;
- }
- return e[0].value;
- });
- t.action.current = () => s;
- const o = (a) => {
- a !== void 0 && (i(a), t.onChange(a));
- };
- return /* @__PURE__ */ l.jsxs("div", { children: [
- /* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: r("sheet.numfmt.dateType") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(je, { value: s, options: e, onChange: o }) }),
- /* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: r("sheet.numfmt.dateDes") })
- ] });
- }, kn = (t) => !t, Bn = (t) => {
- const n = b(T).t;
- return t.action.current = () => "", /* @__PURE__ */ l.jsx("div", { children: /* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: n("sheet.numfmt.generalDes") }) });
- }, Wn = (t) => Ye().some((e) => ce(e.value, t)), Vn = (t) => {
- const e = b(T), n = R(Ye, []), [r, s] = C(() => te(t.defaultPattern || "", 0)), [i, o] = C(() => {
- const u = n.find((h) => ce(h.value, t.defaultPattern || ""));
- return (u == null ? void 0 : u.value) || n[0].value;
- }), a = R(() => M(i, Number(r || 0)), [i, r]), c = R(() => !Rt(i), [i]), m = (u) => {
- s(u || 0), t.onChange(M(i, Number(u || 0)));
- }, d = (u) => {
- u !== void 0 && (s(te(u, 0)), o(u), t.onChange(u));
- };
- return t.action.current = () => a, /* @__PURE__ */ l.jsxs("div", { children: [
- /* @__PURE__ */ l.jsx("div", { className: "m-t-16 label", children: e.t("sheet.numfmt.decimalLength") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(
- Me,
- {
- disabled: c,
- value: r,
- max: 20,
- min: 0,
- onChange: m
- }
- ) }),
- /* @__PURE__ */ l.jsxs("div", { className: "m-t-16 label", children: [
- " ",
- e.t("sheet.numfmt.negType")
- ] }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(je, { onChange: d, options: n, value: i }) }),
- /* @__PURE__ */ l.jsx("div", { className: "describe m-t-14", children: e.t("sheet.numfmt.thousandthPercentileDes") })
- ] });
- }, Gn = (t) => {
- const { defaultValue: e, defaultPattern: n, row: r, col: s } = t.value, i = b(T), o = xe(() => ""), a = i.t, c = Cn(), m = R(
- () => [
- { label: "sheet.numfmt.general", component: Bn },
- { label: "sheet.numfmt.accounting", component: Nn },
- { label: "sheet.numfmt.currency", component: Tn },
- { label: "sheet.numfmt.date", component: An },
- { label: "sheet.numfmt.thousandthPercentile", component: Vn },
- { label: "sheet.numfmt.customFormat", component: Ln }
- ].map((g) => ({ ...g, label: a(g.label) })),
- []
- ), [d, u] = C(_), [h, p] = C(() => `${r}_${s}`), { mark: v, userHabitCurrency: f } = bn(() => p(`${r}_${s}_userCurrency'`)), y = R(() => {
- var g;
- return (g = m.find((w) => w.label === d)) == null ? void 0 : g.component;
- }, [d]);
- function _() {
- return [kn, In, En, Hn, Wn].reduce((w, ht, ft) => w || (ht(n) ? m[ft].label : ""), "") || m[0].label;
- }
- const I = m.map((g) => ({
- label: g.label,
- value: g.label
- })), P = (g) => {
- u(g), c(() => t.onChange({ type: "change", value: o.current() || "" }));
- }, J = (g) => {
- t.onChange({ type: "change", value: g });
- }, le = () => {
- const g = o.current() || "", w = W(g);
- w && v(w), t.onChange({ type: "confirm", value: g });
- }, F = () => {
- t.onChange({ type: "cancel", value: "" });
- }, me = {
- onChange: J,
- defaultValue: e,
- defaultPattern: n,
- action: o
- };
- return ae(() => {
- u(_()), p(`${r}_${s}`);
- }, [r, s]), /* @__PURE__ */ l.jsxs("div", { className: "numfmt-panel p-b-20", children: [
- /* @__PURE__ */ l.jsxs("div", { children: [
- /* @__PURE__ */ l.jsx("div", { className: "label m-t-14", children: a("sheet.numfmt.numfmtType") }),
- /* @__PURE__ */ l.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ l.jsx(Re, { onChange: P, options: I, value: d, style: { width: "100%" } }) }),
- /* @__PURE__ */ l.jsx("div", { children: y && /* @__PURE__ */ l.jsx(we.Provider, { value: f, children: /* @__PURE__ */ Pe(y, { ...me, key: h }) }) })
- ] }),
- /* @__PURE__ */ l.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
- /* @__PURE__ */ l.jsx($e, { size: "small", onClick: F, className: "m-r-12", children: a("sheet.numfmt.cancel") }),
- /* @__PURE__ */ l.jsx($e, { type: "primary", size: "small", onClick: le, children: a("sheet.numfmt.confirm") })
- ] })
- ] });
- };
- var Kn = Object.defineProperty, qn = Object.getOwnPropertyDescriptor, Yn = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? qn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && Kn(e, n, s), s;
- }, x = (t, e) => (n, r) => e(n, r, t);
- const Ae = "SHEET_NUMFMT_PANEL";
- let B = class extends oe {
- constructor(e, n, r, s, i, o, a, c, m, d, u) {
- super();
- /**
- * If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
- * @private
- * @type {(string | null)}
- * @memberof NumfmtController
- */
- X(this, "_previewPattern", "");
- X(this, "_sidebarDisposable", null);
- this._sheetInterceptorService = e, this._themeService = n, this._univerInstanceService = r, this._commandService = s, this._selectionManagerService = i, this._renderManagerService = o, this._numfmtService = a, this._componentManager = c, this._sidebarService = m, this._localeService = d, this._sheetsNumfmtCellContentController = u, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener(), this._initNumfmtLocalChange();
- }
- _initNumfmtLocalChange() {
- this.disposeWithMe(rt(this._sheetsNumfmtCellContentController.local$, this._localeService.currentLocale$).subscribe(() => {
- this._forceUpdate();
- }));
- }
- openPanel() {
- var y;
- const e = this._sidebarService, n = this._selectionManagerService, r = this._commandService, s = this._univerInstanceService, i = this._numfmtService, o = this._localeService, c = (((y = n.getCurrentSelections()) == null ? void 0 : y.map((_) => _.range)) || [])[0];
- if (!c)
- return !1;
- const m = s.getCurrentUnitForType(E.UNIVER_SHEET), d = m.getActiveSheet();
- if (!d)
- return !1;
- const u = d.getCellRaw(c.startRow, c.startColumn), h = i.getValue(
- m.getUnitId(),
- d.getSheetId(),
- c.startRow,
- c.startColumn
- );
- let p = "";
- h && (p = h.pattern);
- const v = (u == null ? void 0 : u.t) === $.NUMBER ? u.v : 12345678, f = {
- onChange: (_) => {
- var I;
- if (_.type === "change")
- this._previewPattern = _.value, this._forceUpdate();
- else if (_.type === "confirm") {
- const P = ((I = n.getCurrentSelections()) == null ? void 0 : I.map((F) => F.range)) || [], J = { values: [] }, le = ne(_.value);
- P.forEach((F) => {
- Ve.foreach(F, (me, g) => {
- J.values.push({
- row: me,
- col: g,
- pattern: _.value,
- type: le
- });
- });
- }), r.executeCommand(Ze.id, J), e.close();
- } else _.type === "cancel" && e.close();
- },
- value: { defaultPattern: p, defaultValue: v, row: c.startRow, col: c.startColumn }
- };
- return this._sidebarDisposable = e.open({
- header: { title: o.t("sheet.numfmt.title") },
- children: {
- label: Ae,
- ...f
- // need passthrough to react props.
- },
- onClose: () => {
- this._forceUpdate(), r.executeCommand(he.id);
- }
- }), !0;
- }
- _forceUpdate(e) {
- var r;
- const n = this._renderManagerService.getRenderById(
- e != null ? e : this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET).getUnitId()
- );
- n == null || n.with(Lt).reCalculate(), (r = n == null ? void 0 : n.mainComponent) == null || r.makeDirty();
- }
- _initCommands() {
- [
- A,
- he
- ].forEach((e) => {
- this.disposeWithMe(this._commandService.registerCommand(e));
- });
- }
- _initPanel() {
- this._componentManager.register(Ae, Gn);
- }
- // eslint-disable-next-line max-lines-per-function
- _initRealTimeRenderingInterceptor() {
- const e = new D((r) => {
- this._commandService.onCommandExecuted((s) => {
- s.id === A.id && r.next(!0), s.id === he.id && r.next(!1);
- });
- }), n = rn([
- e,
- this._selectionManagerService.selectionMoveEnd$.pipe(
- sn((r) => r ? r.map((s) => s.range) : [])
- )
- ]);
- this.disposeWithMe(
- ge(
- n.pipe(
- on(
- ([r, s]) => new D((i) => {
- const o = new gt();
- return r && s.length && i.next({ selectionRanges: s, disposableCollection: o }), () => {
- o.dispose();
- };
- })
- ),
- cn(() => {
- this._previewPattern = null;
- })
- ).subscribe(({ disposableCollection: r, selectionRanges: s }) => {
- var o, a;
- const i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
- this.openPanel(), r.add(
- this._sheetInterceptorService.intercept(Zt.CELL_CONTENT, {
- priority: 99,
- effect: Oe.Value | Oe.Style,
- handler: (c, m, d) => {
- const { row: u, col: h } = m, p = d(c) || {};
- if (s.find(
- (v) => v.startColumn <= h && v.endColumn >= h && v.startRow <= u && v.endRow >= u
- )) {
- const v = m.worksheet.getCellRaw(u, h), f = v == null ? void 0 : v.v, y = v == null ? void 0 : v.t;
- if (f == null || y !== $.NUMBER || this._previewPattern === null)
- return p;
- const _ = jt(this._previewPattern, f, this._sheetsNumfmtCellContentController.local);
- if (_.color) {
- const P = this._themeService.getCurrentTheme()[`${_.color}500`];
- return {
- ...p,
- v: _.result,
- t: $.STRING,
- s: { cl: { rgb: P } }
- };
- }
- return {
- ...p,
- v: _.result,
- t: $.STRING
- };
- }
- return p;
- }
- })
- ), (a = (o = this._renderManagerService.getRenderById(i.getUnitId())) == null ? void 0 : o.mainComponent) == null || a.makeDirty();
- })
- )
- );
- }
- _commandExecutedListener() {
- const e = [Ne.id, Ee.id];
- this.disposeWithMe(
- new D((n) => {
- const r = this._commandService.onCommandExecuted((s) => {
- if (e.includes(s.id)) {
- const i = s.params;
- n.next(i.unitId);
- }
- });
- return () => r.dispose();
- }).pipe(an(16)).subscribe((n) => this._forceUpdate(n))
- );
- }
- _initCloseListener() {
- this._univerInstanceService.getCurrentTypeOfUnit$(E.UNIVER_SHEET).subscribe((e) => {
- var n;
- e || ((n = this._sidebarDisposable) == null || n.dispose(), this._sidebarDisposable = null);
- });
- }
- };
- B = Yn([
- x(0, S(nt)),
- x(1, S(St)),
- x(2, ye),
- x(3, be),
- x(4, S(Te)),
- x(5, Ke),
- x(6, Ie),
- x(7, S(tt)),
- x(8, Wt),
- x(9, S(T)),
- x(10, S(ze))
- ], B);
- var Zn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Jn = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? zn(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && Zn(e, n, s), s;
- }, H = (t, e) => (n, r) => e(n, r, t);
- const Xn = () => {
- let t = [];
- return {
- add: (s, i, o, a, c) => t.push({ unitId: s, subUnitId: i, row: o, col: a, value: c }),
- getEffects: () => t,
- clean: () => {
- t = [];
- }
- };
- };
- let re = class extends oe {
- constructor(e, n, r, s, i) {
- super();
- // collect effect mutations when edit end and push this to commands stack in next commands progress
- X(this, "_collectEffectMutation", Xn());
- this._sheetInterceptorService = e, this._numfmtService = n, this._univerInstanceService = r, this._injector = s, this._editorBridgeService = i, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
- }
- _initInterceptorEditorStart() {
- this._editorBridgeService && this.disposeWithMe(
- ge(
- this._sheetInterceptorService.writeCellInterceptor.intercept(
- zt,
- {
- handler: (e, n, r) => {
- const s = n.row, i = n.col, o = this._numfmtService.getValue(
- n.unitId,
- n.subUnitId,
- s,
- i
- );
- if (o)
- switch (ne(o.pattern)) {
- case "scientific":
- case "currency":
- case "grouped":
- case "number": {
- const c = n.worksheet.getCellRaw(s, i);
- return r && r(c);
- }
- case "percent":
- case "date":
- case "time":
- case "datetime":
- default:
- return r && r(e);
- }
- return r(e);
- }
- }
- )
- )
- );
- }
- /**
- * Process the values after edit
- * @private
- * @memberof NumfmtService
- */
- _initInterceptorEditorEnd() {
- this.disposeWithMe(
- ge(
- this._sheetInterceptorService.writeCellInterceptor.intercept(
- Jt,
- {
- // eslint-disable-next-line complexity
- handler: (e, n, r) => {
- var d, u, h, p;
- this._collectEffectMutation.clean();
- const s = this._numfmtService.getValue(
- n.unitId,
- n.subUnitId,
- n.row,
- n.col
- ), i = (d = s && ne(s.pattern)) != null ? d : "", o = () => {
- s && this._collectEffectMutation.add(
- n.unitId,
- n.subUnitId,
- n.row,
- n.col,
- null
- );
- };
- if (!(e != null && e.v) && !(e != null && e.p) || (s == null ? void 0 : s.pattern) === Ce || e.t === $.FORCE_STRING)
- return r(e);
- const a = (u = e.p) == null ? void 0 : u.body, c = (p = (h = e == null ? void 0 : e.p) == null ? void 0 : h.body) != null && p.dataStream ? e.p.body.dataStream.replace(/\r\n$/, "") : String(e.v), m = Q.parseDate(c) || Q.parseTime(c) || Q.parseNumber(c);
- if (a)
- if (er(a)) {
- const { dataStream: v } = a, f = v.replace(/\r\n$/, ""), y = Number(f);
- if (Number.isNaN(y) && !m)
- return r(e);
- } else
- return r(e);
- if (m) {
- m.z && this._collectEffectMutation.add(
- n.unitId,
- n.subUnitId,
- n.row,
- n.col,
- {
- pattern: m.z
- }
- );
- const v = Number(m.v);
- return r({ ...e, p: void 0, v, t: $.NUMBER });
- } else (["date", "time", "datetime", "percent"].includes(i) || !Qn(c)) && o();
- return r(e);
- }
- }
- )
- )
- );
- }
- _initInterceptorCommands() {
- const e = this;
- this.disposeWithMe(
- this._sheetInterceptorService.interceptCommand({
- getMutations(n) {
- var r;
- switch (n.id) {
- case Xt.id: {
- const s = e._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET), i = s.getUnitId(), o = (r = s.getActiveSheet()) == null ? void 0 : r.getSheetId();
- if (!o)
- return {
- redos: [],
- undos: []
- };
- const a = e._collectEffectMutation.getEffects();
- if (e._collectEffectMutation.clean(), !a.length)
- return {
- redos: [],
- undos: []
- };
- const c = a.filter((h) => {
- var p;
- return !!((p = h.value) != null && p.pattern);
- }).map((h) => ({
- row: h.row,
- col: h.col,
- pattern: h.value.pattern
- })), m = a.filter((h) => {
- var p;
- return !((p = h.value) != null && p.pattern);
- }).map((h) => ({
- startRow: h.row,
- endColumn: h.col,
- startColumn: h.col,
- endRow: h.row
- })), d = [], u = [];
- if (c.length) {
- const h = {
- id: Ee.id,
- params: Qt(i, o, c)
- };
- d.push(h), u.push(...en(e._injector, h.params));
- }
- if (m.length) {
- const h = {
- id: Ne.id,
- params: {
- unitId: i,
- subUnitId: o,
- ranges: m
- }
- };
- d.push(h), u.push(...tn(e._injector, h.params));
- }
- return {
- redos: d,
- undos: u.reverse()
- };
- }
- }
- return {
- redos: [],
- undos: []
- };
- }
- })
- );
- }
- };
- re = Jn([
- H(0, S(nt)),
- H(1, S(Ie)),
- H(2, S(ye)),
- H(3, S(Ge)),
- H(4, yt(Ht))
- ], re);
- function Qn(t) {
- return /^-?\d+(\.\d+)?$/.test(t);
- }
- function er(t) {
- const { textRuns: e = [], paragraphs: n = [], customRanges: r, customBlocks: s = [] } = t, i = ["va"];
- return !(e.some((o) => !!(o.ts && Object.keys(o.ts).some((c) => i.includes(c)))) || n.some((o) => o.bullet) || n.length >= 2 || r != null && r.length || s.length > 0);
- }
- const ee = [
- {
- label: "sheet.numfmt.general",
- pattern: null
- },
- {
- label: "sheet.numfmt.text",
- pattern: Ce
- },
- "|",
- {
- label: "sheet.numfmt.number",
- pattern: "0"
- },
- "|",
- {
- label: "sheet.numfmt.accounting",
- pattern: '"¥" #,##0.00_);[Red]("¥"#,##0.00)'
- },
- {
- label: "sheet.numfmt.financialValue",
- pattern: "#,##0.00;[Red]#,##0.00"
- },
- {
- label: "sheet.numfmt.currency",
- pattern: '"¥"#,##0.00_);[Red]("¥"#,##0.00)'
- },
- {
- label: "sheet.numfmt.roundingCurrency",
- pattern: '"¥"#,##0;[Red]"¥"#,##0'
- },
- "|",
- {
- label: "sheet.numfmt.date",
- pattern: "yyyy-mm-dd;@"
- },
- {
- label: "sheet.numfmt.time",
- pattern: 'am/pm h":"mm":"ss'
- },
- {
- label: "sheet.numfmt.dateTime",
- pattern: "yyyy-m-d am/pm h:mm"
- },
- {
- label: "sheet.numfmt.timeDuration",
- pattern: "h:mm:ss"
- },
- "|",
- {
- label: "sheet.numfmt.moreFmt",
- pattern: ""
- }
- ], tr = (t) => ({
- icon: new D((e) => {
- const n = t.get(wt);
- function r(i) {
- return {
- [O.US]: "DollarSingle",
- [O.RU]: "RoubleSingle",
- [O.CN]: "RmbSingle",
- [O.AT]: "EuroSingle"
- }[i] || "DollarSingle";
- }
- const s = O[n.getCurrencySymbol()] || "$";
- return e.next(r(s)), n.currencySymbol$.subscribe((i) => {
- const o = O[i] || "$";
- e.next(r(o));
- });
- }),
- id: Je.id,
- title: "sheet.numfmt.currency",
- tooltip: "sheet.numfmt.currency",
- type: G.BUTTON,
- hidden$: K(t, E.UNIVER_SHEET),
- disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
- }), nr = (t) => ({
- icon: "AddDigitsSingle",
- id: Xe.id,
- title: "sheet.numfmt.addDecimal",
- tooltip: "sheet.numfmt.addDecimal",
- type: G.BUTTON,
- hidden$: K(t, E.UNIVER_SHEET),
- disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
- }), rr = (t) => ({
- icon: "ReduceDigitsSingle",
- id: Qe.id,
- title: "sheet.numfmt.subtractDecimal",
- tooltip: "sheet.numfmt.subtractDecimal",
- type: G.BUTTON,
- hidden$: K(t, E.UNIVER_SHEET),
- disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
- }), sr = (t) => ({
- icon: "PercentSingle",
- id: et.id,
- title: "sheet.numfmt.percent",
- tooltip: "sheet.numfmt.percent",
- type: G.BUTTON,
- hidden$: K(t, E.UNIVER_SHEET),
- disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Y, Z], rangeTypes: [z] })
- }), ir = (t) => {
- const e = t.get(ye), n = t.get(be), r = t.get(T), s = t.get(Te), i = At(e, "", ({ workbook: o, worksheet: a }) => new D(
- (c) => rt(
- s.selectionMoveEnd$,
- new D((m) => {
- const d = [Ne.id, Ee.id], u = n.onCommandExecuted((h) => {
- d.includes(h.id) && m.next(null);
- });
- return () => u.dispose();
- })
- ).subscribe(() => {
- var d, u;
- const m = s.getCurrentSelections();
- if (m && m[0]) {
- const h = m[0].range, p = h.startRow, v = h.startColumn, f = (u = o.getStyles().get((d = a.getCell(p, v)) == null ? void 0 : d.s)) == null ? void 0 : u.n, y = f == null ? void 0 : f.pattern;
- let _ = r.t("sheet.numfmt.general");
- if (y) {
- const I = ee.filter((P) => typeof P == "object" && P.pattern).find(
- (P) => ce(y, P.pattern)
- );
- I && typeof I == "object" && I.pattern ? _ = r.t(I.label) : _ = r.t("sheet.numfmt.moreFmt");
- }
- c.next(_);
- }
- })
- ));
- return {
- label: lt,
- id: A.id,
- tooltip: "sheet.numfmt.title",
- type: G.SELECTOR,
- selections: [
- {
- label: {
- name: mt,
- hoverable: !1
- }
- }
- ],
- value$: i,
- hidden$: K(t, E.UNIVER_SHEET),
- disabled$: V(t, { workbookTypes: [q], worksheetTypes: [Z, Y], rangeTypes: [z] })
- };
- }, lt = "sheet.numfmt.moreNumfmtType", mt = "sheet.numfmt.moreNumfmtType.options", or = (t) => {
- var r;
- const e = b(T), n = (r = t.value) != null ? r : e.t("sheet.numfmt.general");
- return /* @__PURE__ */ l.jsx("span", { className: "more-numfmt-type", children: n });
- }, cr = () => {
- const t = b(be), e = b(T), n = b(Vt), r = b(ze), s = b(Te), i = (c) => {
- const m = s.getCurrentLastSelection();
- if (!m)
- return;
- const d = m.range, u = [];
- Ve.foreach(d, (h, p) => {
- c ? u.push({ row: h, col: p, pattern: c, type: ne(c) }) : u.push({ row: h, col: p });
- }), t.executeCommand(Ze.id, { values: u }), n.focus();
- }, o = (c) => {
- if (c === 0)
- i(null);
- else if (c === ee.length - 1)
- t.executeCommand(A.id);
- else {
- const m = ee[c];
- m.pattern && i(m.pattern);
- }
- }, a = 1220;
- return /* @__PURE__ */ l.jsx("div", { className: "more-numfmt-type-options", children: ee.map((c, m) => c === "|" ? /* @__PURE__ */ l.jsx("div", { className: "line m-t-4", onClick: (d) => d.stopPropagation() }, m) : /* @__PURE__ */ l.jsxs(
- "div",
- {
- className: "option-item m-t-4",
- onClick: () => {
- o(m);
- },
- children: [
- /* @__PURE__ */ l.jsx("div", { children: e.t(c.label) }),
- /* @__PURE__ */ l.jsx("div", { className: "m-l-26", children: c.pattern ? Ot(c.pattern || "", a, r.local).result : "" })
- ]
- },
- m
- )) });
- }, ar = {
- [Gt.FORMULAS_INSERT]: {
- [Je.id]: {
- order: 4,
- menuItemFactory: tr
- },
- [Xe.id]: {
- order: 5,
- menuItemFactory: nr
- },
- [Qe.id]: {
- order: 6,
- menuItemFactory: rr
- },
- [et.id]: {
- order: 7,
- menuItemFactory: sr
- },
- [A.id]: {
- order: 8,
- menuItemFactory: ir
- }
- }
- };
- var lr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, ur = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? mr(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && lr(e, n, s), s;
- }, ke = (t, e) => (n, r) => e(n, r, t);
- let se = class extends oe {
- constructor(t, e) {
- super(), this._componentManager = t, this._menuManagerService = e, this._initMenu();
- }
- _initMenu() {
- this._menuManagerService.mergeMenu(ar), this.disposeWithMe(this._componentManager.register(lt, or)), this.disposeWithMe(this._componentManager.register(mt, cr));
- }
- };
- se = ur([
- ke(0, S(tt)),
- ke(1, Kt)
- ], se);
- var ut = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, hr = (t, e, n) => e in t ? ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, fr = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? dr(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && ut(e, n, s), s;
- }, _e = (t, e) => (n, r) => e(n, r, t), dt = (t, e, n) => hr(t, typeof e != "symbol" ? e + "" : e, n);
- const pr = "SHEET_NUMFMT_UI_PLUGIN";
- let ie = class extends Ct {
- constructor(t = De, e, n, r) {
- super(), this._config = t, this._injector = e, this._configService = n, this._renderManagerService = r;
- const { menu: s, ...i } = It(
- {},
- De,
- this._config
- );
- s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(qt, i);
- }
- onStarting() {
- Nt(this._injector, [
- [B],
- [re],
- [k],
- [se]
- ]);
- }
- onRendered() {
- this._registerRenderModules(), Et(this._injector, [
- [B],
- [re],
- [se]
- ]);
- }
- _registerRenderModules() {
- [
- [Se]
- ].forEach((e) => {
- this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SHEET, e));
- });
- }
- };
- dt(ie, "pluginName", pr);
- dt(ie, "type", E.UNIVER_SHEET);
- ie = fr([
- bt(kt, Ut),
- _e(1, S(Ge)),
- _e(2, Tt),
- _e(3, Ke)
- ], ie);
- export {
- ie as UniverSheetsNumfmtUIPlugin
- };
|