@univerjs/sheets-numfmt-ui 1.0.0-alpha.2 → 1.0.0-alpha.4
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 +134 -134
- package/lib/es/index.js +134 -135
- package/lib/index.js +134 -135
- package/lib/types/controllers/ui.controller.d.ts +2 -3
- package/lib/types/index.d.ts +1 -0
- package/lib/types/menu/numfmt.menu.controller.d.ts +2 -3
- package/lib/umd/index.js +1 -1
- package/package.json +13 -13
package/lib/es/index.js
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import { CellValueType, CommandType, DEFAULT_TEXT_FORMAT_EXCEL, DependentOn, Disposable, DisposableCollection, ICommandService, IConfigService, ILocalStorageService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, Optional, Plugin, Range, ThemeService, Tools, UniverInstanceType, currencySymbols, fromCallback, getNumfmtParseValueFilter, isDefaultFormat, isPatternEqualWithoutDecimal, isRealNum, isTextFormat, merge, numfmt, registerDependencies, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
|
|
2
|
-
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
3
1
|
import { AddDecimalCommand, CURRENCYFORMAT, DATEFMTLISG, NUMBERFORMAT, SHEETS_NUMFMT_PLUGIN_CONFIG_KEY, SetCurrencyCommand, SetNumfmtCommand, SetPercentCommand, SheetsNumfmtCellContentController, SubtractDecimalCommand, UniverSheetsNumfmtPlugin, getCurrencyFormatOptions, getCurrencySymbolByLocale, getCurrencySymbolIconByLocale, getCurrencyType, getDateFormatOptions, getDecimalFromPattern, getNumberFormatOptions, getPatternPreview, getPatternPreviewIgnoreGeneral, getPatternType, isPatternHasDecimal, localeCurrencySymbolMap, setPatternDecimal } from "@univerjs/sheets-numfmt";
|
|
4
|
-
import { CellAlertManagerService, CellAlertType, HoverManagerService, IEditorBridgeService, IRepeatLastActionService, RepeatLastActionPermission, SheetSkeletonManagerService, UniverSheetsUIPlugin, deriveStateFromActiveSheet$, getCurrentRangeDisable$ } from "@univerjs/sheets-ui";
|
|
5
|
-
import { AddDigitsIcon, CheckMarkIcon, DollarIcon, EuroIcon, PercentIcon, ReduceDigitsIcon, RmbIcon, RoubleIcon } from "@univerjs/icons";
|
|
6
2
|
import { ComponentManager, ILayoutService, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonStartGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
7
|
-
import {
|
|
3
|
+
import { CellValueType, CommandType, DEFAULT_TEXT_FORMAT_EXCEL, DependentOn, Disposable, DisposableCollection, ICommandService, IConfigService, ILocalStorageService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, Optional, Plugin, Range, ThemeService, Tools, UniverInstanceType, currencySymbols, fromCallback, getNumfmtParseValueFilter, isDefaultFormat, isPatternEqualWithoutDecimal, isRealNum, isTextFormat, merge, numfmt, registerDependencies, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
|
|
4
|
+
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
8
5
|
import { AFTER_CELL_EDIT, BEFORE_CELL_EDIT, INTERCEPTOR_POINT, INumfmtService, RangeProtectionPermissionEditPoint, RemoveNumfmtMutation, SetNumfmtMutation, SetRangeValuesCommand, SheetInterceptorService, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, factoryRemoveNumfmtUndoMutation, factorySetNumfmtUndoMutation, transformCellsToRange } from "@univerjs/sheets";
|
|
9
|
-
import {
|
|
6
|
+
import { CellAlertManagerService, CellAlertType, HoverManagerService, IEditorBridgeService, IRepeatLastActionService, RepeatLastActionPermission, SheetSkeletonManagerService, UniverSheetsUIPlugin, deriveStateFromActiveSheet$, getCurrentRangeDisable$ } from "@univerjs/sheets-ui";
|
|
10
7
|
import { Observable, combineLatest, debounceTime, filter, merge as merge$1 } from "rxjs";
|
|
11
8
|
import { debounceTime as debounceTime$1, map, switchMap, tap } from "rxjs/operators";
|
|
9
|
+
import { Button, Input, InputNumber, Select, SelectList, Separator, borderClassName, clsx, scrollbarClassName } from "@univerjs/design";
|
|
10
|
+
import { createContext, createElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
12
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { AddDigitsIcon, CheckMarkIcon, DollarIcon, EuroIcon, PercentIcon, ReduceDigitsIcon, RmbIcon, RoubleIcon } from "@univerjs/icons";
|
|
13
13
|
import { stripErrorMargin } from "@univerjs/engine-formula";
|
|
14
14
|
|
|
15
|
-
//#region package.json
|
|
16
|
-
var name = "@univerjs/sheets-numfmt-ui";
|
|
17
|
-
var version = "1.0.0-alpha.2";
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/config/config.ts
|
|
21
|
-
const SHEETS_NUMFMT_UI_PLUGIN_CONFIG_KEY = "sheets-numfmt-ui.config";
|
|
22
|
-
const configSymbol = Symbol(SHEETS_NUMFMT_UI_PLUGIN_CONFIG_KEY);
|
|
23
|
-
const defaultPluginConfig = {};
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
15
|
//#region src/commands/operations/close.numfmt.panel.operation.ts
|
|
27
16
|
const CloseNumfmtPanelOperator = {
|
|
28
17
|
id: "sheet.operation.close.numfmt.panel",
|
|
@@ -93,7 +82,7 @@ function __decorate(decorators, target, key, desc) {
|
|
|
93
82
|
//#region src/controllers/ui.controller.ts
|
|
94
83
|
const SHEET_NUMFMT_PANEL$1 = "SHEET_NUMFMT_PANEL";
|
|
95
84
|
let SheetNumfmtUIController = class SheetNumfmtUIController extends Disposable {
|
|
96
|
-
constructor(_sheetInterceptorService, _themeService, _univerInstanceService, _commandService, _selectionManagerService, _renderManagerService, _numfmtService,
|
|
85
|
+
constructor(_sheetInterceptorService, _themeService, _univerInstanceService, _commandService, _selectionManagerService, _renderManagerService, _numfmtService, _sidebarService, _localeService, _sheetsNumfmtCellContentController) {
|
|
97
86
|
super();
|
|
98
87
|
this._sheetInterceptorService = _sheetInterceptorService;
|
|
99
88
|
this._themeService = _themeService;
|
|
@@ -102,7 +91,6 @@ let SheetNumfmtUIController = class SheetNumfmtUIController extends Disposable {
|
|
|
102
91
|
this._selectionManagerService = _selectionManagerService;
|
|
103
92
|
this._renderManagerService = _renderManagerService;
|
|
104
93
|
this._numfmtService = _numfmtService;
|
|
105
|
-
this._componentManager = _componentManager;
|
|
106
94
|
this._sidebarService = _sidebarService;
|
|
107
95
|
this._localeService = _localeService;
|
|
108
96
|
this._sheetsNumfmtCellContentController = _sheetsNumfmtCellContentController;
|
|
@@ -182,8 +170,10 @@ let SheetNumfmtUIController = class SheetNumfmtUIController extends Disposable {
|
|
|
182
170
|
return true;
|
|
183
171
|
}
|
|
184
172
|
_forceUpdate(unitId) {
|
|
185
|
-
var _renderUnit$mainCompo;
|
|
186
|
-
const
|
|
173
|
+
var _this$_univerInstance, _renderUnit$mainCompo;
|
|
174
|
+
const resolvedUnitId = unitId !== null && unitId !== void 0 ? unitId : (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
|
|
175
|
+
if (!resolvedUnitId) return;
|
|
176
|
+
const renderUnit = this._renderManagerService.getRenderById(resolvedUnitId);
|
|
187
177
|
renderUnit === null || renderUnit === void 0 || renderUnit.with(SheetSkeletonManagerService).reCalculate();
|
|
188
178
|
renderUnit === null || renderUnit === void 0 || (_renderUnit$mainCompo = renderUnit.mainComponent) === null || _renderUnit$mainCompo === void 0 || _renderUnit$mainCompo.makeDirty();
|
|
189
179
|
}
|
|
@@ -281,10 +271,9 @@ SheetNumfmtUIController = __decorate([
|
|
|
281
271
|
__decorateParam(4, Inject(SheetsSelectionsService)),
|
|
282
272
|
__decorateParam(5, IRenderManagerService),
|
|
283
273
|
__decorateParam(6, INumfmtService),
|
|
284
|
-
__decorateParam(7,
|
|
285
|
-
__decorateParam(8,
|
|
286
|
-
__decorateParam(9, Inject(
|
|
287
|
-
__decorateParam(10, Inject(SheetsNumfmtCellContentController))
|
|
274
|
+
__decorateParam(7, ISidebarService),
|
|
275
|
+
__decorateParam(8, Inject(LocaleService)),
|
|
276
|
+
__decorateParam(9, Inject(SheetsNumfmtCellContentController))
|
|
288
277
|
], SheetNumfmtUIController);
|
|
289
278
|
|
|
290
279
|
//#endregion
|
|
@@ -298,6 +287,76 @@ const OpenNumfmtPanelOperator = {
|
|
|
298
287
|
}
|
|
299
288
|
};
|
|
300
289
|
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/views/components/MoreNumfmtType.tsx
|
|
292
|
+
const MORE_NUMFMT_TYPE_KEY = "sheets-numfmt-ui.moreNumfmtType";
|
|
293
|
+
const OPTIONS_KEY = "sheets-numfmt-ui.moreNumfmtType.options";
|
|
294
|
+
function MoreNumfmtType(props) {
|
|
295
|
+
const { value } = props;
|
|
296
|
+
const localeService = useDependency(LocaleService);
|
|
297
|
+
return /* @__PURE__ */ jsx("span", {
|
|
298
|
+
className: "univer-text-sm",
|
|
299
|
+
children: value !== null && value !== void 0 ? value : localeService.t("sheets-numfmt-ui.general")
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function Options() {
|
|
303
|
+
const commandService = useDependency(ICommandService);
|
|
304
|
+
const localeService = useDependency(LocaleService);
|
|
305
|
+
const layoutService = useDependency(ILayoutService);
|
|
306
|
+
const sheetsNumfmtCellContentController = useDependency(SheetsNumfmtCellContentController);
|
|
307
|
+
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
308
|
+
const selectionManagerService = useDependency(SheetsSelectionsService);
|
|
309
|
+
const setNumfmt = (pattern) => {
|
|
310
|
+
const selection = selectionManagerService.getCurrentLastSelection();
|
|
311
|
+
if (!selection) return;
|
|
312
|
+
const range = selection.range;
|
|
313
|
+
const values = [];
|
|
314
|
+
Range.foreach(range, (row, col) => {
|
|
315
|
+
if (pattern) values.push({
|
|
316
|
+
row,
|
|
317
|
+
col,
|
|
318
|
+
pattern,
|
|
319
|
+
type: getPatternType(pattern)
|
|
320
|
+
});
|
|
321
|
+
else values.push({
|
|
322
|
+
row,
|
|
323
|
+
col
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
commandService.executeCommand(SetNumfmtCommand.id, { values });
|
|
327
|
+
layoutService.focus();
|
|
328
|
+
};
|
|
329
|
+
const menuOptions = useMemo(() => {
|
|
330
|
+
return MENU_OPTIONS(localeCurrencySymbolMap.get(localeService.getCurrentLocale()));
|
|
331
|
+
}, [localeService]);
|
|
332
|
+
const handleClick = (index) => {
|
|
333
|
+
if (index === 0) setNumfmt(null);
|
|
334
|
+
else if (index === menuOptions.length - 1) {
|
|
335
|
+
commandService.executeCommand(OpenNumfmtPanelOperator.id);
|
|
336
|
+
layoutService.focus();
|
|
337
|
+
} else {
|
|
338
|
+
const item = menuOptions[index];
|
|
339
|
+
item.pattern && setNumfmt(item.pattern);
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
const defaultValue = 1220;
|
|
343
|
+
return /* @__PURE__ */ jsx("div", {
|
|
344
|
+
dir: direction,
|
|
345
|
+
className: "univer-grid univer-gap-1 univer-p-1.5",
|
|
346
|
+
children: menuOptions.map((item, index) => {
|
|
347
|
+
if (item === "|") return /* @__PURE__ */ jsx(Separator, {}, index);
|
|
348
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
349
|
+
className: "univer-flex univer-h-7 univer-cursor-default 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",
|
|
350
|
+
onClick: () => handleClick(index),
|
|
351
|
+
children: [/* @__PURE__ */ jsx("span", { children: localeService.t(item.label) }), /* @__PURE__ */ jsx("span", {
|
|
352
|
+
className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
|
|
353
|
+
children: item.pattern ? getPatternPreview(item.pattern || "", defaultValue, sheetsNumfmtCellContentController.locale).result.trim() : ""
|
|
354
|
+
})]
|
|
355
|
+
}, index);
|
|
356
|
+
})
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
301
360
|
//#endregion
|
|
302
361
|
//#region src/menu/menu.ts
|
|
303
362
|
const MENU_OPTIONS = (currencySymbol) => {
|
|
@@ -481,74 +540,40 @@ function FactoryOtherMenuItem(accessor) {
|
|
|
481
540
|
}
|
|
482
541
|
|
|
483
542
|
//#endregion
|
|
484
|
-
//#region src/
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
});
|
|
519
|
-
commandService.executeCommand(SetNumfmtCommand.id, { values });
|
|
520
|
-
layoutService.focus();
|
|
521
|
-
};
|
|
522
|
-
const menuOptions = useMemo(() => {
|
|
523
|
-
return MENU_OPTIONS(localeCurrencySymbolMap.get(localeService.getCurrentLocale()));
|
|
524
|
-
}, [localeService]);
|
|
525
|
-
const handleClick = (index) => {
|
|
526
|
-
if (index === 0) setNumfmt(null);
|
|
527
|
-
else if (index === menuOptions.length - 1) {
|
|
528
|
-
commandService.executeCommand(OpenNumfmtPanelOperator.id);
|
|
529
|
-
layoutService.focus();
|
|
530
|
-
} else {
|
|
531
|
-
const item = menuOptions[index];
|
|
532
|
-
item.pattern && setNumfmt(item.pattern);
|
|
533
|
-
}
|
|
534
|
-
};
|
|
535
|
-
const defaultValue = 1220;
|
|
536
|
-
return /* @__PURE__ */ jsx("div", {
|
|
537
|
-
dir: direction,
|
|
538
|
-
className: "univer-grid univer-gap-1 univer-p-1.5",
|
|
539
|
-
children: menuOptions.map((item, index) => {
|
|
540
|
-
if (item === "|") return /* @__PURE__ */ jsx(Separator, {}, index);
|
|
541
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
542
|
-
className: "univer-flex univer-h-7 univer-cursor-default 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",
|
|
543
|
-
onClick: () => handleClick(index),
|
|
544
|
-
children: [/* @__PURE__ */ jsx("span", { children: localeService.t(item.label) }), /* @__PURE__ */ jsx("span", {
|
|
545
|
-
className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
|
|
546
|
-
children: item.pattern ? getPatternPreview(item.pattern || "", defaultValue, sheetsNumfmtCellContentController.locale).result.trim() : ""
|
|
547
|
-
})]
|
|
548
|
-
}, index);
|
|
549
|
-
})
|
|
550
|
-
});
|
|
551
|
-
}
|
|
543
|
+
//#region src/menu/schema.ts
|
|
544
|
+
const menuSchema = { [RibbonStartGroup.LAYOUT]: {
|
|
545
|
+
[OpenNumfmtPanelOperator.id]: {
|
|
546
|
+
order: 9,
|
|
547
|
+
menuItemFactory: FactoryOtherMenuItem
|
|
548
|
+
},
|
|
549
|
+
[SetPercentCommand.id]: {
|
|
550
|
+
order: 9.1,
|
|
551
|
+
menuItemFactory: PercentMenuItem
|
|
552
|
+
},
|
|
553
|
+
[SetCurrencyCommand.id]: {
|
|
554
|
+
order: 9.2,
|
|
555
|
+
menuItemFactory: CurrencySymbolIconMenuItem
|
|
556
|
+
},
|
|
557
|
+
[AddDecimalCommand.id]: {
|
|
558
|
+
order: 9.3,
|
|
559
|
+
menuItemFactory: AddDecimalMenuItem
|
|
560
|
+
},
|
|
561
|
+
[SubtractDecimalCommand.id]: {
|
|
562
|
+
order: 9.4,
|
|
563
|
+
menuItemFactory: SubtractDecimalMenuItem
|
|
564
|
+
}
|
|
565
|
+
} };
|
|
566
|
+
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region package.json
|
|
569
|
+
var name = "@univerjs/sheets-numfmt-ui";
|
|
570
|
+
var version = "1.0.0-alpha.4";
|
|
571
|
+
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/config/config.ts
|
|
574
|
+
const SHEETS_NUMFMT_UI_PLUGIN_CONFIG_KEY = "sheets-numfmt-ui.config";
|
|
575
|
+
const configSymbol = Symbol(SHEETS_NUMFMT_UI_PLUGIN_CONFIG_KEY);
|
|
576
|
+
const defaultPluginConfig = {};
|
|
552
577
|
|
|
553
578
|
//#endregion
|
|
554
579
|
//#region src/controllers/user-habit.controller.ts
|
|
@@ -807,20 +832,22 @@ function CustomFormat(props) {
|
|
|
807
832
|
]);
|
|
808
833
|
const [options, setOptions] = useState([]);
|
|
809
834
|
useEffect(() => {
|
|
835
|
+
let cancelled = false;
|
|
810
836
|
localStorageService.getItem(historyPatternKey).then((historyList) => {
|
|
811
837
|
const list = [
|
|
812
838
|
...CURRENCYFORMAT.map((item) => item.suffix("$")),
|
|
813
839
|
...DATEFMTLISG.map((item) => item.suffix),
|
|
814
|
-
...NUMBERFORMAT.map((item) => item.suffix)
|
|
840
|
+
...NUMBERFORMAT.map((item) => item.suffix),
|
|
841
|
+
...historyList !== null && historyList !== void 0 ? historyList : []
|
|
815
842
|
];
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
setOptions([...new Set(list)]);
|
|
820
|
-
});
|
|
821
|
-
});
|
|
843
|
+
return userHabitController.addHabit(key$1, []).then(() => userHabitController.getHabit(key$1, list));
|
|
844
|
+
}).then((list) => {
|
|
845
|
+
if (!cancelled) setOptions([...new Set(list)]);
|
|
822
846
|
});
|
|
823
|
-
|
|
847
|
+
return () => {
|
|
848
|
+
cancelled = true;
|
|
849
|
+
};
|
|
850
|
+
}, [localStorageService, userHabitController]);
|
|
824
851
|
const handleClick = (p) => {
|
|
825
852
|
setPattern(p);
|
|
826
853
|
onChange(p);
|
|
@@ -935,7 +962,7 @@ function ThousandthPercentilePanel(props) {
|
|
|
935
962
|
return (item === null || item === void 0 ? void 0 : item.value) || options[0].value;
|
|
936
963
|
});
|
|
937
964
|
const pattern = useMemo(() => setPatternDecimal(suffix, Number(decimal || 0)), [suffix, decimal]);
|
|
938
|
-
const isInputDisable =
|
|
965
|
+
const isInputDisable = !isPatternHasDecimal(suffix);
|
|
939
966
|
const handleDecimalChange = (decimal) => {
|
|
940
967
|
setDecimal(decimal || 0);
|
|
941
968
|
onChange(setPatternDecimal(suffix, Number(decimal || 0)));
|
|
@@ -1057,6 +1084,7 @@ const useNextTick = () => {
|
|
|
1057
1084
|
//#endregion
|
|
1058
1085
|
//#region src/views/SheetNumfmtPanel.tsx
|
|
1059
1086
|
function SheetNumfmtPanel(props) {
|
|
1087
|
+
var _typeOptions$find;
|
|
1060
1088
|
const { defaultValue, defaultPattern, row, col } = props.value;
|
|
1061
1089
|
const localeService = useDependency(LocaleService);
|
|
1062
1090
|
const currentPatternRef = useRef(() => "");
|
|
@@ -1095,10 +1123,7 @@ function SheetNumfmtPanel(props) {
|
|
|
1095
1123
|
const [type, setType] = useState(findDefaultType);
|
|
1096
1124
|
const [key, setKey] = useState(() => `${row}_${col}_${defaultPattern}`);
|
|
1097
1125
|
const { mark, userHabitCurrency } = useCurrencyOptions(() => setKey(`${row}_${col}_${defaultPattern}_userCurrency`));
|
|
1098
|
-
const BusinessComponent =
|
|
1099
|
-
var _typeOptions$find;
|
|
1100
|
-
return (_typeOptions$find = typeOptions.find((item) => item.label === type)) === null || _typeOptions$find === void 0 ? void 0 : _typeOptions$find.component;
|
|
1101
|
-
}, [type]);
|
|
1126
|
+
const BusinessComponent = (_typeOptions$find = typeOptions.find((item) => item.label === type)) === null || _typeOptions$find === void 0 ? void 0 : _typeOptions$find.component;
|
|
1102
1127
|
function findDefaultType() {
|
|
1103
1128
|
return [
|
|
1104
1129
|
isGeneralPanel,
|
|
@@ -1564,31 +1589,6 @@ function canConvertRichTextToNumfmt(body) {
|
|
|
1564
1589
|
}) || paragraphs.some((paragraph) => paragraph.bullet) || paragraphs.length >= 2 || Boolean(customRanges === null || customRanges === void 0 ? void 0 : customRanges.length) || customBlocks.length > 0);
|
|
1565
1590
|
}
|
|
1566
1591
|
|
|
1567
|
-
//#endregion
|
|
1568
|
-
//#region src/menu/schema.ts
|
|
1569
|
-
const menuSchema = { [RibbonStartGroup.LAYOUT]: {
|
|
1570
|
-
[OpenNumfmtPanelOperator.id]: {
|
|
1571
|
-
order: 9,
|
|
1572
|
-
menuItemFactory: FactoryOtherMenuItem
|
|
1573
|
-
},
|
|
1574
|
-
[SetPercentCommand.id]: {
|
|
1575
|
-
order: 9.1,
|
|
1576
|
-
menuItemFactory: PercentMenuItem
|
|
1577
|
-
},
|
|
1578
|
-
[SetCurrencyCommand.id]: {
|
|
1579
|
-
order: 9.2,
|
|
1580
|
-
menuItemFactory: CurrencySymbolIconMenuItem
|
|
1581
|
-
},
|
|
1582
|
-
[AddDecimalCommand.id]: {
|
|
1583
|
-
order: 9.3,
|
|
1584
|
-
menuItemFactory: AddDecimalMenuItem
|
|
1585
|
-
},
|
|
1586
|
-
[SubtractDecimalCommand.id]: {
|
|
1587
|
-
order: 9.4,
|
|
1588
|
-
menuItemFactory: SubtractDecimalMenuItem
|
|
1589
|
-
}
|
|
1590
|
-
} };
|
|
1591
|
-
|
|
1592
1592
|
//#endregion
|
|
1593
1593
|
//#region src/menu/numfmt.menu.controller.ts
|
|
1594
1594
|
/**
|
|
@@ -1607,9 +1607,8 @@ const menuSchema = { [RibbonStartGroup.LAYOUT]: {
|
|
|
1607
1607
|
* limitations under the License.
|
|
1608
1608
|
*/
|
|
1609
1609
|
let NumfmtMenuController = class NumfmtMenuController extends Disposable {
|
|
1610
|
-
constructor(
|
|
1610
|
+
constructor(_menuManagerService) {
|
|
1611
1611
|
super();
|
|
1612
|
-
this._componentManager = _componentManager;
|
|
1613
1612
|
this._menuManagerService = _menuManagerService;
|
|
1614
1613
|
this._initMenu();
|
|
1615
1614
|
}
|
|
@@ -1617,7 +1616,7 @@ let NumfmtMenuController = class NumfmtMenuController extends Disposable {
|
|
|
1617
1616
|
this._menuManagerService.mergeMenu(menuSchema);
|
|
1618
1617
|
}
|
|
1619
1618
|
};
|
|
1620
|
-
NumfmtMenuController = __decorate([__decorateParam(0,
|
|
1619
|
+
NumfmtMenuController = __decorate([__decorateParam(0, IMenuManagerService)], NumfmtMenuController);
|
|
1621
1620
|
|
|
1622
1621
|
//#endregion
|
|
1623
1622
|
//#region src/plugin.ts
|
|
@@ -1670,4 +1669,4 @@ UniverSheetsNumfmtUIPlugin = __decorate([
|
|
|
1670
1669
|
], UniverSheetsNumfmtUIPlugin);
|
|
1671
1670
|
|
|
1672
1671
|
//#endregion
|
|
1673
|
-
export { UniverSheetsNumfmtUIPlugin };
|
|
1672
|
+
export { menuSchema as SheetsNumfmtUIMenuSchema, UniverSheetsNumfmtUIPlugin };
|