@univerjs/sheets-data-validation-ui 0.24.0 → 0.25.0
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 +116 -112
- package/lib/cjs/locale/ar-SA.js +94 -0
- package/lib/cjs/locale/ca-ES.js +6 -86
- package/lib/cjs/locale/de-DE.js +94 -0
- package/lib/cjs/locale/en-US.js +6 -86
- package/lib/cjs/locale/es-ES.js +6 -86
- package/lib/cjs/locale/fa-IR.js +6 -86
- package/lib/cjs/locale/fr-FR.js +6 -86
- package/lib/cjs/locale/id-ID.js +94 -0
- package/lib/cjs/locale/it-IT.js +94 -0
- package/lib/cjs/locale/ja-JP.js +6 -86
- package/lib/cjs/locale/ko-KR.js +6 -86
- package/lib/cjs/locale/pl-PL.js +94 -0
- package/lib/cjs/locale/pt-BR.js +94 -0
- package/lib/cjs/locale/ru-RU.js +6 -86
- package/lib/cjs/locale/sk-SK.js +6 -86
- package/lib/cjs/locale/vi-VN.js +6 -86
- package/lib/cjs/locale/zh-CN.js +6 -86
- package/lib/cjs/locale/zh-HK.js +94 -0
- package/lib/cjs/locale/zh-TW.js +6 -86
- package/lib/es/index.js +117 -113
- package/lib/es/locale/ar-SA.js +93 -0
- package/lib/es/locale/ca-ES.js +6 -86
- package/lib/es/locale/de-DE.js +93 -0
- package/lib/es/locale/en-US.js +6 -86
- package/lib/es/locale/es-ES.js +6 -86
- package/lib/es/locale/fa-IR.js +6 -86
- package/lib/es/locale/fr-FR.js +6 -86
- package/lib/es/locale/id-ID.js +93 -0
- package/lib/es/locale/it-IT.js +93 -0
- package/lib/es/locale/ja-JP.js +6 -86
- package/lib/es/locale/ko-KR.js +6 -86
- package/lib/es/locale/pl-PL.js +93 -0
- package/lib/es/locale/pt-BR.js +93 -0
- package/lib/es/locale/ru-RU.js +6 -86
- package/lib/es/locale/sk-SK.js +6 -86
- package/lib/es/locale/vi-VN.js +6 -86
- package/lib/es/locale/zh-CN.js +6 -86
- package/lib/es/locale/zh-HK.js +93 -0
- package/lib/es/locale/zh-TW.js +6 -86
- package/lib/index.css +0 -4
- package/lib/index.js +117 -113
- package/lib/locale/ar-SA.js +93 -0
- package/lib/locale/ca-ES.js +6 -86
- package/lib/locale/de-DE.js +93 -0
- package/lib/locale/en-US.js +6 -86
- package/lib/locale/es-ES.js +6 -86
- package/lib/locale/fa-IR.js +6 -86
- package/lib/locale/fr-FR.js +6 -86
- package/lib/locale/id-ID.js +93 -0
- package/lib/locale/it-IT.js +93 -0
- package/lib/locale/ja-JP.js +6 -86
- package/lib/locale/ko-KR.js +6 -86
- package/lib/locale/pl-PL.js +93 -0
- package/lib/locale/pt-BR.js +93 -0
- package/lib/locale/ru-RU.js +6 -86
- package/lib/locale/sk-SK.js +6 -86
- package/lib/locale/vi-VN.js +6 -86
- package/lib/locale/zh-CN.js +6 -86
- package/lib/locale/zh-HK.js +93 -0
- package/lib/locale/zh-TW.js +6 -86
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +6 -78
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/views/components/formula-input/utils.d.ts +24 -0
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +15 -15
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellValueType, ColorKit, CommandType, DEFAULT_STYLES, DataValidationErrorStyle, DataValidationRenderMode, DataValidationStatus, DataValidationType, DependentOn, Disposable, DisposableCollection, HorizontalAlign, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, ObjectMatrix, Optional, Plugin, Range, Rectangle, RedoCommand, RxDisposable, ThemeService, UndoCommand, UniverInstanceType, VerticalAlign, WrapStrategy, awaitTime, bufferDebounceTime, dateKit, debounce, generateRandomId, isFormulaString, isUnitRangesEqual, merge, numfmt, queryObjectMatrix, sequenceExecute, shallowEqual, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { CURSOR_TYPE, CheckboxShape, DeviceInputEventType, DocSimpleSkeleton, FontCache, IRenderManagerService, Rect, Shape, Text, Transform, fixLineWidthByScale, getCurrentTypeOfRenderer, getFontStyleString } from "@univerjs/engine-render";
|
|
3
|
-
import { AUTO_FILL_APPLY_TYPE, AutoFillTools, IAutoFillService, INTERCEPTOR_POINT, InterceptCellContentPriority, RangeProtectionPermissionEditPoint, SetRangeValuesCommand, SetWorksheetActiveOperation, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, VALIDATE_CELL, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, checkRangesEditablePermission, getSheetCommandTarget, rangeToDiscreteRange } from "@univerjs/sheets";
|
|
4
|
-
import { AddSheetDataValidationCommand, BASE_FORMULA_INPUT_NAME as BASE_FORMULA_INPUT_NAME$1, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, CHECKBOX_FORMULA_INPUT_NAME, CUSTOM_FORMULA_INPUT_NAME, DATA_VALIDATION_PLUGIN_NAME, DataValidationCacheService, DataValidationFormulaController, DataValidationFormulaService, LIST_FORMULA_INPUT_NAME, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, SheetDataValidationModel, SheetsDataValidationValidatorService, UniverSheetsDataValidationPlugin, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, createDefaultNewRule,
|
|
3
|
+
import { AUTO_FILL_APPLY_TYPE, AutoFillTools, IAutoFillService, INTERCEPTOR_POINT, InterceptCellContentPriority, RangeProtectionPermissionEditPoint, SetRangeValuesCommand, SetWorksheetActiveOperation, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, VALIDATE_CELL, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, checkRangesEditablePermission, deserializeListOptions, getSheetCommandTarget, rangeToDiscreteRange, serializeListOptions } from "@univerjs/sheets";
|
|
4
|
+
import { AddSheetDataValidationCommand, BASE_FORMULA_INPUT_NAME as BASE_FORMULA_INPUT_NAME$1, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, CHECKBOX_FORMULA_INPUT_NAME, CUSTOM_FORMULA_INPUT_NAME, DATA_VALIDATION_PLUGIN_NAME, DataValidationCacheService, DataValidationFormulaController, DataValidationFormulaService, LIST_FORMULA_INPUT_NAME, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, SheetDataValidationModel, SheetsDataValidationValidatorService, UniverSheetsDataValidationPlugin, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, createDefaultNewRule, getCellValueOrigin, getDataValidationCellValue, getDataValidationDiffMutations, getFormulaResult, isLegalFormulaResult, transformCheckboxValue } from "@univerjs/sheets-data-validation";
|
|
5
5
|
import { DataValidationModel, DataValidatorDropdownType, DataValidatorRegistryScope, DataValidatorRegistryService, TWO_FORMULA_OPERATOR_COUNT, getRuleOptions, getRuleSetting } from "@univerjs/data-validation";
|
|
6
6
|
import { ComponentManager, IDialogService, IMenuManagerService, ISidebarService, IZenZoneService, KeyCode, MenuItemType, RibbonDataGroup, getMenuHiddenObservable, useDependency, useEvent, useObservable, useSidebarClick } from "@univerjs/ui";
|
|
7
7
|
import { BehaviorSubject, Subject, bufferTime, debounceTime, distinctUntilChanged, filter, of } from "rxjs";
|
|
@@ -16,10 +16,10 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
16
16
|
|
|
17
17
|
//#region package.json
|
|
18
18
|
var name = "@univerjs/sheets-data-validation-ui";
|
|
19
|
-
var version = "0.
|
|
19
|
+
var version = "0.25.0";
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region \0@oxc-project+runtime@0.
|
|
22
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
|
|
23
23
|
function _typeof(o) {
|
|
24
24
|
"@babel/helpers - typeof";
|
|
25
25
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -30,7 +30,7 @@ function _typeof(o) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
|
-
//#region \0@oxc-project+runtime@0.
|
|
33
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
|
|
34
34
|
function toPrimitive(t, r) {
|
|
35
35
|
if ("object" != _typeof(t) || !t) return t;
|
|
36
36
|
var e = t[Symbol.toPrimitive];
|
|
@@ -43,14 +43,14 @@ function toPrimitive(t, r) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
|
-
//#region \0@oxc-project+runtime@0.
|
|
46
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
|
|
47
47
|
function toPropertyKey(t) {
|
|
48
48
|
var i = toPrimitive(t, "string");
|
|
49
49
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
//#endregion
|
|
53
|
-
//#region \0@oxc-project+runtime@0.
|
|
53
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
|
|
54
54
|
function _defineProperty(e, r, t) {
|
|
55
55
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
56
56
|
value: t,
|
|
@@ -61,7 +61,7 @@ function _defineProperty(e, r, t) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
//#endregion
|
|
64
|
-
//#region \0@oxc-project+runtime@0.
|
|
64
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
|
|
65
65
|
function __decorateParam(paramIndex, decorator) {
|
|
66
66
|
return function(target, key) {
|
|
67
67
|
decorator(target, key, paramIndex);
|
|
@@ -69,7 +69,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region \0@oxc-project+runtime@0.
|
|
72
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
|
|
73
73
|
function __decorate(decorators, target, key, desc) {
|
|
74
74
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
75
75
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -209,7 +209,7 @@ let DataValidationRejectInputController = class DataValidationRejectInputControl
|
|
|
209
209
|
if (await this._sheetsDataValidationValidatorService.validatorCell(unitId, subUnitId, row, col) === DataValidationStatus.VALID) return next(Promise.resolve(true));
|
|
210
210
|
this._dialogService.open({
|
|
211
211
|
width: 368,
|
|
212
|
-
title: { title: this._localeService.t("
|
|
212
|
+
title: { title: this._localeService.t("sheets-data-validation-ui.alert.title") },
|
|
213
213
|
id: "reject-input-dialog",
|
|
214
214
|
children: { title: validator.getRuleFinalError(rule, {
|
|
215
215
|
row,
|
|
@@ -220,7 +220,7 @@ let DataValidationRejectInputController = class DataValidationRejectInputControl
|
|
|
220
220
|
footer: { title: createElement(Button, {
|
|
221
221
|
variant: "primary",
|
|
222
222
|
onClick: () => this._dialogService.close("reject-input-dialog")
|
|
223
|
-
}, this._localeService.t("
|
|
223
|
+
}, this._localeService.t("sheets-data-validation-ui.alert.ok")) },
|
|
224
224
|
onClose: () => {
|
|
225
225
|
this._dialogService.close("reject-input-dialog");
|
|
226
226
|
}
|
|
@@ -231,13 +231,13 @@ let DataValidationRejectInputController = class DataValidationRejectInputControl
|
|
|
231
231
|
showReject(title) {
|
|
232
232
|
this._dialogService.open({
|
|
233
233
|
width: 368,
|
|
234
|
-
title: { title: this._localeService.t("
|
|
234
|
+
title: { title: this._localeService.t("sheets-data-validation-ui.alert.title") },
|
|
235
235
|
id: "reject-input-dialog",
|
|
236
236
|
children: { title },
|
|
237
237
|
footer: { title: createElement(Button, {
|
|
238
238
|
variant: "primary",
|
|
239
239
|
onClick: () => this._dialogService.close("reject-input-dialog")
|
|
240
|
-
}, this._localeService.t("
|
|
240
|
+
}, this._localeService.t("sheets-data-validation-ui.alert.ok")) },
|
|
241
241
|
onClose: () => {
|
|
242
242
|
this._dialogService.close("reject-input-dialog");
|
|
243
243
|
}
|
|
@@ -432,7 +432,8 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
432
432
|
var _this$_configService$, _this$_configService$2, _this$_configService$3, _this$_configService$4;
|
|
433
433
|
const multiple = validator.dropdownType === DataValidatorDropdownType.MULTIPLE_LIST;
|
|
434
434
|
const handleSave = async (newValue) => {
|
|
435
|
-
|
|
435
|
+
var _newValue$;
|
|
436
|
+
const str = multiple ? serializeListOptions(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
|
|
436
437
|
const params = {
|
|
437
438
|
unitId,
|
|
438
439
|
subUnitId,
|
|
@@ -650,7 +651,7 @@ const OpenValidationPanelOperation = {
|
|
|
650
651
|
});
|
|
651
652
|
const disposable = sidebarService.open({
|
|
652
653
|
id: DATA_VALIDATION_PANEL,
|
|
653
|
-
header: { title: isAdd ? "
|
|
654
|
+
header: { title: isAdd ? "sheets-data-validation-ui.panel.addTitle" : "sheets-data-validation-ui.panel.title" },
|
|
654
655
|
children: { label: DATA_VALIDATION_PANEL },
|
|
655
656
|
width: 312,
|
|
656
657
|
onClose: () => dataValidationPanelService.close()
|
|
@@ -778,7 +779,7 @@ let DataValidationAlertController = class DataValidationAlertController extends
|
|
|
778
779
|
}
|
|
779
780
|
this._cellAlertManagerService.showAlert({
|
|
780
781
|
type: CellAlertType.ERROR,
|
|
781
|
-
title: this._localeService.t("
|
|
782
|
+
title: this._localeService.t("sheets-data-validation-ui.error.title"),
|
|
782
783
|
message: validator === null || validator === void 0 ? void 0 : validator.getRuleFinalError(rule, cellPos.location),
|
|
783
784
|
location: cellPos.location,
|
|
784
785
|
width: 200,
|
|
@@ -1086,7 +1087,7 @@ let DataValidationPermissionController = class DataValidationPermissionControlle
|
|
|
1086
1087
|
workbookTypes: [WorkbookEditablePermission],
|
|
1087
1088
|
rangeTypes: [RangeProtectionPermissionEditPoint],
|
|
1088
1089
|
worksheetTypes: [WorksheetEditPermission, WorksheetSetCellStylePermission]
|
|
1089
|
-
}, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"));
|
|
1090
|
+
}, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-data-validation-ui.permission.dialog.setStyleErr"));
|
|
1090
1091
|
}
|
|
1091
1092
|
if (command.id === UpdateSheetDataValidationRangeCommand.id) {
|
|
1092
1093
|
const { unitId, subUnitId, ranges } = command.params;
|
|
@@ -1094,7 +1095,7 @@ let DataValidationPermissionController = class DataValidationPermissionControlle
|
|
|
1094
1095
|
workbookTypes: [WorkbookEditablePermission],
|
|
1095
1096
|
rangeTypes: [RangeProtectionPermissionEditPoint],
|
|
1096
1097
|
worksheetTypes: [WorksheetEditPermission, WorksheetSetCellStylePermission]
|
|
1097
|
-
}, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"));
|
|
1098
|
+
}, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-data-validation-ui.permission.dialog.setStyleErr"));
|
|
1098
1099
|
}
|
|
1099
1100
|
}));
|
|
1100
1101
|
}
|
|
@@ -1113,7 +1114,7 @@ function dataValidationMenuFactory(accessor) {
|
|
|
1113
1114
|
id: DATA_VALIDATION_MENU_ID,
|
|
1114
1115
|
type: MenuItemType.SUBITEMS,
|
|
1115
1116
|
icon: "DataValidationIcon",
|
|
1116
|
-
tooltip: "
|
|
1117
|
+
tooltip: "sheets-data-validation-ui.title",
|
|
1117
1118
|
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
1118
1119
|
disabled$: getCurrentRangeDisable$(accessor, {
|
|
1119
1120
|
workbookTypes: [WorkbookEditablePermission],
|
|
@@ -1125,14 +1126,14 @@ function dataValidationMenuFactory(accessor) {
|
|
|
1125
1126
|
function openDataValidationMenuFactory(_accessor) {
|
|
1126
1127
|
return {
|
|
1127
1128
|
id: OpenValidationPanelOperation.id,
|
|
1128
|
-
title: "
|
|
1129
|
+
title: "sheets-data-validation-ui.panel.title",
|
|
1129
1130
|
type: MenuItemType.BUTTON
|
|
1130
1131
|
};
|
|
1131
1132
|
}
|
|
1132
1133
|
function addDataValidationMenuFactory(_accessor) {
|
|
1133
1134
|
return {
|
|
1134
1135
|
id: AddSheetDataValidationAndOpenCommand.id,
|
|
1135
|
-
title: "
|
|
1136
|
+
title: "sheets-data-validation-ui.panel.add",
|
|
1136
1137
|
type: MenuItemType.BUTTON
|
|
1137
1138
|
};
|
|
1138
1139
|
}
|
|
@@ -1477,14 +1478,14 @@ function DataValidationOptions(props) {
|
|
|
1477
1478
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
1478
1479
|
className: "univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-white",
|
|
1479
1480
|
onClick: () => setShow(!show),
|
|
1480
|
-
children: [localeService.t("
|
|
1481
|
+
children: [localeService.t("sheets-data-validation-ui.panel.options"), show ? /* @__PURE__ */ jsx(MoreUpIcon, { className: "univer-ml-1" }) : /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-ml-1" })]
|
|
1481
1482
|
}), show && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1482
1483
|
ExtraOptions ? /* @__PURE__ */ jsx(ExtraOptions, {
|
|
1483
1484
|
value,
|
|
1484
1485
|
onChange
|
|
1485
1486
|
}) : null,
|
|
1486
1487
|
/* @__PURE__ */ jsx(FormLayout, {
|
|
1487
|
-
label: localeService.t("
|
|
1488
|
+
label: localeService.t("sheets-data-validation-ui.panel.invalid"),
|
|
1488
1489
|
children: /* @__PURE__ */ jsxs(RadioGroup, {
|
|
1489
1490
|
value: `${(_value$errorStyle = value.errorStyle) !== null && _value$errorStyle !== void 0 ? _value$errorStyle : DataValidationErrorStyle.WARNING}`,
|
|
1490
1491
|
onChange: (errorStyle) => onChange({
|
|
@@ -1493,22 +1494,22 @@ function DataValidationOptions(props) {
|
|
|
1493
1494
|
}),
|
|
1494
1495
|
children: [/* @__PURE__ */ jsx(Radio, {
|
|
1495
1496
|
value: `${DataValidationErrorStyle.WARNING}`,
|
|
1496
|
-
children: localeService.t("
|
|
1497
|
+
children: localeService.t("sheets-data-validation-ui.panel.showWarning")
|
|
1497
1498
|
}), /* @__PURE__ */ jsx(Radio, {
|
|
1498
1499
|
value: `${DataValidationErrorStyle.STOP}`,
|
|
1499
|
-
children: localeService.t("
|
|
1500
|
+
children: localeService.t("sheets-data-validation-ui.panel.rejectInput")
|
|
1500
1501
|
})]
|
|
1501
1502
|
})
|
|
1502
1503
|
}),
|
|
1503
1504
|
/* @__PURE__ */ jsx(FormLayout, {
|
|
1504
|
-
label: localeService.t("
|
|
1505
|
+
label: localeService.t("sheets-data-validation-ui.panel.messageInfo"),
|
|
1505
1506
|
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
1506
1507
|
checked: value.showErrorMessage,
|
|
1507
1508
|
onChange: () => onChange({
|
|
1508
1509
|
...value,
|
|
1509
1510
|
showErrorMessage: !value.showErrorMessage
|
|
1510
1511
|
}),
|
|
1511
|
-
children: localeService.t("
|
|
1512
|
+
children: localeService.t("sheets-data-validation-ui.panel.showInfo")
|
|
1512
1513
|
})
|
|
1513
1514
|
}),
|
|
1514
1515
|
value.showErrorMessage ? /* @__PURE__ */ jsx(FormLayout, { children: /* @__PURE__ */ jsx(Input, {
|
|
@@ -1721,8 +1722,8 @@ function DataValidationDetail() {
|
|
|
1721
1722
|
className: "univer-py-2",
|
|
1722
1723
|
children: [
|
|
1723
1724
|
/* @__PURE__ */ jsx(FormLayout, {
|
|
1724
|
-
label: localeService.t("
|
|
1725
|
-
error: !localRule.ranges.length || isRangeError ? localeService.t("
|
|
1725
|
+
label: localeService.t("sheets-data-validation-ui.panel.range"),
|
|
1726
|
+
error: !localRule.ranges.length || isRangeError ? localeService.t("sheets-data-validation-ui.panel.rangeError") : "",
|
|
1726
1727
|
children: /* @__PURE__ */ jsx(RangeSelector, {
|
|
1727
1728
|
selectorRef: rangeSelectorInstance,
|
|
1728
1729
|
unitId,
|
|
@@ -1741,7 +1742,7 @@ function DataValidationDetail() {
|
|
|
1741
1742
|
})
|
|
1742
1743
|
}),
|
|
1743
1744
|
/* @__PURE__ */ jsx(FormLayout, {
|
|
1744
|
-
label: localeService.t("
|
|
1745
|
+
label: localeService.t("sheets-data-validation-ui.panel.type"),
|
|
1745
1746
|
children: /* @__PURE__ */ jsx(Select, {
|
|
1746
1747
|
className: "univer-w-full",
|
|
1747
1748
|
value: localRule.type,
|
|
@@ -1753,13 +1754,13 @@ function DataValidationDetail() {
|
|
|
1753
1754
|
})
|
|
1754
1755
|
}),
|
|
1755
1756
|
(operators === null || operators === void 0 ? void 0 : operators.length) ? /* @__PURE__ */ jsx(FormLayout, {
|
|
1756
|
-
label: localeService.t("
|
|
1757
|
+
label: localeService.t("sheets-data-validation-ui.panel.operator"),
|
|
1757
1758
|
children: /* @__PURE__ */ jsx(Select, {
|
|
1758
1759
|
className: "univer-w-full",
|
|
1759
1760
|
value: `${localRule.operator}`,
|
|
1760
1761
|
options: [{
|
|
1761
1762
|
value: "",
|
|
1762
|
-
label: localeService.t("
|
|
1763
|
+
label: localeService.t("data-validation.operators.legal")
|
|
1763
1764
|
}, ...operators.map((op, i) => ({
|
|
1764
1765
|
value: `${op}`,
|
|
1765
1766
|
label: operatorNames[i]
|
|
@@ -1799,7 +1800,7 @@ function DataValidationDetail() {
|
|
|
1799
1800
|
allowBlank: !((_localRule$allowBlank2 = localRule.allowBlank) !== null && _localRule$allowBlank2 !== void 0 ? _localRule$allowBlank2 : true)
|
|
1800
1801
|
});
|
|
1801
1802
|
},
|
|
1802
|
-
children: localeService.t("
|
|
1803
|
+
children: localeService.t("sheets-data-validation-ui.panel.allowBlank")
|
|
1803
1804
|
}) }),
|
|
1804
1805
|
/* @__PURE__ */ jsx(DataValidationOptions, {
|
|
1805
1806
|
value: options,
|
|
@@ -1811,12 +1812,12 @@ function DataValidationDetail() {
|
|
|
1811
1812
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
1812
1813
|
className: "univer-ml-3",
|
|
1813
1814
|
onClick: handleDelete,
|
|
1814
|
-
children: localeService.t("
|
|
1815
|
+
children: localeService.t("sheets-data-validation-ui.panel.removeRule")
|
|
1815
1816
|
}), /* @__PURE__ */ jsx(Button, {
|
|
1816
1817
|
className: "univer-ml-3",
|
|
1817
1818
|
variant: "primary",
|
|
1818
1819
|
onClick: handleOk,
|
|
1819
|
-
children: localeService.t("
|
|
1820
|
+
children: localeService.t("sheets-data-validation-ui.panel.done")
|
|
1820
1821
|
})]
|
|
1821
1822
|
})
|
|
1822
1823
|
]
|
|
@@ -1988,11 +1989,11 @@ function DataValidationList(props) {
|
|
|
1988
1989
|
className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2",
|
|
1989
1990
|
children: [rules.length && !hasDisableRule ? /* @__PURE__ */ jsx(Button, {
|
|
1990
1991
|
onClick: handleRemoveAll,
|
|
1991
|
-
children: localeService.t("
|
|
1992
|
+
children: localeService.t("sheets-data-validation-ui.panel.removeAll")
|
|
1992
1993
|
}) : null, /* @__PURE__ */ jsx(Button, {
|
|
1993
1994
|
variant: "primary",
|
|
1994
1995
|
onClick: handleAddRule,
|
|
1995
|
-
children: localeService.t("
|
|
1996
|
+
children: localeService.t("sheets-data-validation-ui.panel.add")
|
|
1996
1997
|
})]
|
|
1997
1998
|
})]
|
|
1998
1999
|
});
|
|
@@ -2025,7 +2026,7 @@ const BaseFormulaInput = (props) => {
|
|
|
2025
2026
|
error: formula1Res,
|
|
2026
2027
|
children: /* @__PURE__ */ jsx(Input, {
|
|
2027
2028
|
className: "univer-w-full",
|
|
2028
|
-
placeholder: localeService.t("
|
|
2029
|
+
placeholder: localeService.t("sheets-data-validation-ui.panel.formulaPlaceholder"),
|
|
2029
2030
|
value: value === null || value === void 0 ? void 0 : value.formula1,
|
|
2030
2031
|
onChange: (newValue) => {
|
|
2031
2032
|
onChange === null || onChange === void 0 || onChange({
|
|
@@ -2037,13 +2038,13 @@ const BaseFormulaInput = (props) => {
|
|
|
2037
2038
|
}),
|
|
2038
2039
|
/* @__PURE__ */ jsx("div", {
|
|
2039
2040
|
className: "-univer-mt-2 univer-mb-1 univer-text-sm univer-text-gray-400",
|
|
2040
|
-
children: localeService.t("
|
|
2041
|
+
children: localeService.t("sheets-data-validation-ui.panel.formulaAnd")
|
|
2041
2042
|
}),
|
|
2042
2043
|
/* @__PURE__ */ jsx(FormLayout, {
|
|
2043
2044
|
error: formula2Res,
|
|
2044
2045
|
children: /* @__PURE__ */ jsx(Input, {
|
|
2045
2046
|
className: "univer-w-full",
|
|
2046
|
-
placeholder: localeService.t("
|
|
2047
|
+
placeholder: localeService.t("sheets-data-validation-ui.panel.formulaPlaceholder"),
|
|
2047
2048
|
value: value === null || value === void 0 ? void 0 : value.formula2,
|
|
2048
2049
|
onChange: (newValue) => {
|
|
2049
2050
|
onChange === null || onChange === void 0 || onChange({
|
|
@@ -2058,7 +2059,7 @@ const BaseFormulaInput = (props) => {
|
|
|
2058
2059
|
error: formula1Res,
|
|
2059
2060
|
children: /* @__PURE__ */ jsx(Input, {
|
|
2060
2061
|
className: "univer-w-full",
|
|
2061
|
-
placeholder: localeService.t("
|
|
2062
|
+
placeholder: localeService.t("sheets-data-validation-ui.panel.formulaPlaceholder"),
|
|
2062
2063
|
value: value === null || value === void 0 ? void 0 : value.formula1,
|
|
2063
2064
|
onChange: (newValue) => {
|
|
2064
2065
|
onChange === null || onChange === void 0 || onChange({ formula1: newValue });
|
|
@@ -2089,14 +2090,14 @@ function CheckboxFormulaInput(props) {
|
|
|
2089
2090
|
});
|
|
2090
2091
|
}
|
|
2091
2092
|
},
|
|
2092
|
-
children: localeService.t("
|
|
2093
|
+
children: localeService.t("sheets-data-validation-ui.checkbox.tips")
|
|
2093
2094
|
}) }),
|
|
2094
2095
|
checked ? /* @__PURE__ */ jsx(FormLayout, {
|
|
2095
|
-
label: localeService.t("
|
|
2096
|
+
label: localeService.t("sheets-data-validation-ui.checkbox.checked"),
|
|
2096
2097
|
error: formula1Res,
|
|
2097
2098
|
children: /* @__PURE__ */ jsx(Input, {
|
|
2098
2099
|
className: "univer-w-full",
|
|
2099
|
-
placeholder: localeService.t("
|
|
2100
|
+
placeholder: localeService.t("sheets-data-validation-ui.panel.valuePlaceholder"),
|
|
2100
2101
|
value: value === null || value === void 0 ? void 0 : value.formula1,
|
|
2101
2102
|
onChange: (newValue) => {
|
|
2102
2103
|
onChange === null || onChange === void 0 || onChange({
|
|
@@ -2107,11 +2108,11 @@ function CheckboxFormulaInput(props) {
|
|
|
2107
2108
|
})
|
|
2108
2109
|
}) : null,
|
|
2109
2110
|
checked ? /* @__PURE__ */ jsx(FormLayout, {
|
|
2110
|
-
label: localeService.t("
|
|
2111
|
+
label: localeService.t("sheets-data-validation-ui.checkbox.unchecked"),
|
|
2111
2112
|
error: formula2Res,
|
|
2112
2113
|
children: /* @__PURE__ */ jsx(Input, {
|
|
2113
2114
|
className: "univer-w-full",
|
|
2114
|
-
placeholder: localeService.t("
|
|
2115
|
+
placeholder: localeService.t("sheets-data-validation-ui.panel.valuePlaceholder"),
|
|
2115
2116
|
value: value === null || value === void 0 ? void 0 : value.formula2,
|
|
2116
2117
|
onChange: (newValue) => {
|
|
2117
2118
|
onChange === null || onChange === void 0 || onChange({
|
|
@@ -2159,6 +2160,37 @@ function CustomFormulaInput(props) {
|
|
|
2159
2160
|
});
|
|
2160
2161
|
}
|
|
2161
2162
|
|
|
2163
|
+
//#endregion
|
|
2164
|
+
//#region src/views/components/formula-input/utils.ts
|
|
2165
|
+
/**
|
|
2166
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2167
|
+
*
|
|
2168
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2169
|
+
* you may not use this file except in compliance with the License.
|
|
2170
|
+
* You may obtain a copy of the License at
|
|
2171
|
+
*
|
|
2172
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2173
|
+
*
|
|
2174
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2175
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2176
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2177
|
+
* See the License for the specific language governing permissions and
|
|
2178
|
+
* limitations under the License.
|
|
2179
|
+
*/
|
|
2180
|
+
function buildCustomListFormulaPayload(items, defaultColor) {
|
|
2181
|
+
const labelSet = /* @__PURE__ */ new Set();
|
|
2182
|
+
const finalList = [];
|
|
2183
|
+
items.forEach((item) => {
|
|
2184
|
+
if (!item.label || labelSet.has(item.label)) return;
|
|
2185
|
+
labelSet.add(item.label);
|
|
2186
|
+
finalList.push(item);
|
|
2187
|
+
});
|
|
2188
|
+
return {
|
|
2189
|
+
formula1: serializeListOptions(finalList.map((item) => item.label)),
|
|
2190
|
+
formula2: finalList.map((item) => item.color === defaultColor ? "" : item.color).join(",")
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2162
2194
|
//#endregion
|
|
2163
2195
|
//#region src/views/components/formula-input/ListFormulaInput.tsx
|
|
2164
2196
|
const DEFAULT_COLOR_PRESET = [
|
|
@@ -2245,8 +2277,9 @@ const Template = (props) => {
|
|
|
2245
2277
|
]
|
|
2246
2278
|
});
|
|
2247
2279
|
};
|
|
2280
|
+
const NOOP = () => {};
|
|
2248
2281
|
function ListFormulaInput(props) {
|
|
2249
|
-
const { value, onChange: _onChange =
|
|
2282
|
+
const { value, onChange: _onChange = NOOP, unitId, subUnitId, validResult, showError, ruleId } = props;
|
|
2250
2283
|
const { formula1 = "", formula2 = "" } = value || {};
|
|
2251
2284
|
const [isFormulaStr, setIsFormulaStr] = useState(() => isFormulaString(formula1) ? "1" : "0");
|
|
2252
2285
|
const [formulaStr, setFormulaStr] = useState(isFormulaStr === "1" ? formula1 : "=");
|
|
@@ -2307,13 +2340,12 @@ function ListFormulaInput(props) {
|
|
|
2307
2340
|
setStrList([...strList]);
|
|
2308
2341
|
}
|
|
2309
2342
|
};
|
|
2310
|
-
const colorList = formula2.split(",");
|
|
2311
2343
|
const refFinalList = useMemo(() => refOptions.map((label, i) => ({
|
|
2312
2344
|
label,
|
|
2313
|
-
color:
|
|
2345
|
+
color: refColors[i] || "#ECECEC",
|
|
2314
2346
|
id: `${i}`,
|
|
2315
2347
|
isRef: true
|
|
2316
|
-
})), [
|
|
2348
|
+
})), [refColors, refOptions]);
|
|
2317
2349
|
const handleRefItemChange = (id, value, color) => {
|
|
2318
2350
|
const newColors = [...refColors];
|
|
2319
2351
|
newColors[+id] = color;
|
|
@@ -2333,34 +2365,11 @@ function ListFormulaInput(props) {
|
|
|
2333
2365
|
};
|
|
2334
2366
|
useEffect(() => {
|
|
2335
2367
|
if (isFormulaStr === "1") return;
|
|
2336
|
-
|
|
2337
|
-
const finalList = [];
|
|
2338
|
-
strList.map((item) => {
|
|
2339
|
-
return {
|
|
2340
|
-
labelList: item.label.split(","),
|
|
2341
|
-
item
|
|
2342
|
-
};
|
|
2343
|
-
}).forEach(({ item, labelList }) => {
|
|
2344
|
-
labelList.forEach((labelItem) => {
|
|
2345
|
-
if (!labelSet.has(labelItem)) {
|
|
2346
|
-
labelSet.add(labelItem);
|
|
2347
|
-
finalList.push({
|
|
2348
|
-
label: labelItem,
|
|
2349
|
-
color: item.color
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
});
|
|
2353
|
-
});
|
|
2354
|
-
onChange({
|
|
2355
|
-
formula1: serializeListOptions(finalList.map((item) => item.label)),
|
|
2356
|
-
formula2: finalList.map((item) => item.color === "#ECECEC" ? "" : item.color).join(",")
|
|
2357
|
-
});
|
|
2368
|
+
onChange(buildCustomListFormulaPayload(strList, DROP_DOWN_DEFAULT_COLOR));
|
|
2358
2369
|
}, [
|
|
2359
2370
|
strList,
|
|
2360
2371
|
onChange,
|
|
2361
|
-
isFormulaStr
|
|
2362
|
-
formulaStrCopy,
|
|
2363
|
-
refColors
|
|
2372
|
+
isFormulaStr
|
|
2364
2373
|
]);
|
|
2365
2374
|
const updateFormula = useEvent(async (str) => {
|
|
2366
2375
|
if (!isFormulaString(str)) {
|
|
@@ -2382,7 +2391,7 @@ function ListFormulaInput(props) {
|
|
|
2382
2391
|
formula2
|
|
2383
2392
|
});
|
|
2384
2393
|
setFormulaStr("=");
|
|
2385
|
-
setLocalError(localeService.t("
|
|
2394
|
+
setLocalError(localeService.t("sheets-data-validation-ui.validFail.formulaError"));
|
|
2386
2395
|
}
|
|
2387
2396
|
});
|
|
2388
2397
|
const formulaEditorRef = useRef(null);
|
|
@@ -2400,7 +2409,7 @@ function ListFormulaInput(props) {
|
|
|
2400
2409
|
dataValidationPanelService
|
|
2401
2410
|
]);
|
|
2402
2411
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormLayout, {
|
|
2403
|
-
label: localeService.t("
|
|
2412
|
+
label: localeService.t("sheets-data-validation-ui.list.options"),
|
|
2404
2413
|
children: /* @__PURE__ */ jsxs(RadioGroup, {
|
|
2405
2414
|
value: isFormulaStr,
|
|
2406
2415
|
onChange: (v) => {
|
|
@@ -2413,10 +2422,10 @@ function ListFormulaInput(props) {
|
|
|
2413
2422
|
},
|
|
2414
2423
|
children: [/* @__PURE__ */ jsx(Radio, {
|
|
2415
2424
|
value: "0",
|
|
2416
|
-
children: localeService.t("
|
|
2425
|
+
children: localeService.t("sheets-data-validation-ui.list.customOptions")
|
|
2417
2426
|
}), /* @__PURE__ */ jsx(Radio, {
|
|
2418
2427
|
value: "1",
|
|
2419
|
-
children: localeService.t("
|
|
2428
|
+
children: localeService.t("sheets-data-validation-ui.list.refOptions")
|
|
2420
2429
|
})]
|
|
2421
2430
|
})
|
|
2422
2431
|
}), isFormulaStr === "1" ? /* @__PURE__ */ jsxs(FormLayout, {
|
|
@@ -2447,28 +2456,25 @@ function ListFormulaInput(props) {
|
|
|
2447
2456
|
})]
|
|
2448
2457
|
}) : /* @__PURE__ */ jsx(FormLayout, {
|
|
2449
2458
|
error: formula1Res,
|
|
2450
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
children: [/* @__PURE__ */ jsx(IncreaseIcon, { className: "univer-mr-1" }), localeService.t("dataValidation.list.add")]
|
|
2470
|
-
})]
|
|
2471
|
-
})
|
|
2459
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(DraggableList, {
|
|
2460
|
+
list: strList,
|
|
2461
|
+
onListChange: setStrList,
|
|
2462
|
+
rowHeight: 28,
|
|
2463
|
+
margin: [0, 12],
|
|
2464
|
+
draggableHandle: ".draggableHandle",
|
|
2465
|
+
itemRender: (item) => /* @__PURE__ */ jsx(Template, {
|
|
2466
|
+
item,
|
|
2467
|
+
commonProps: {
|
|
2468
|
+
onItemChange: handleStrItemChange,
|
|
2469
|
+
onItemDelete: handleStrItemDelete
|
|
2470
|
+
}
|
|
2471
|
+
}, item.id),
|
|
2472
|
+
idKey: "id"
|
|
2473
|
+
}), /* @__PURE__ */ jsxs("a", {
|
|
2474
|
+
className: "univer-text-primary univer-flex univer-w-fit univer-cursor-pointer univer-flex-row univer-items-center univer-rounded univer-p-1 univer-px-2 univer-text-sm hover:univer-bg-primary-50 dark:hover:!univer-bg-gray-800",
|
|
2475
|
+
onClick: handleAdd,
|
|
2476
|
+
children: [/* @__PURE__ */ jsx(IncreaseIcon, { className: "univer-mr-1" }), localeService.t("sheets-data-validation-ui.list.add")]
|
|
2477
|
+
})] })
|
|
2472
2478
|
})] });
|
|
2473
2479
|
}
|
|
2474
2480
|
|
|
@@ -2489,7 +2495,7 @@ function ListRenderModeInput(props) {
|
|
|
2489
2495
|
const { value, onChange } = props;
|
|
2490
2496
|
const localeService = useDependency(LocaleService);
|
|
2491
2497
|
return /* @__PURE__ */ jsx(FormLayout, {
|
|
2492
|
-
label: localeService.t("
|
|
2498
|
+
label: localeService.t("sheets-data-validation-ui.renderMode.label"),
|
|
2493
2499
|
children: /* @__PURE__ */ jsxs(RadioGroup, {
|
|
2494
2500
|
value: `${(_value$renderMode = value.renderMode) !== null && _value$renderMode !== void 0 ? _value$renderMode : DataValidationRenderMode.CUSTOM}`,
|
|
2495
2501
|
onChange: (renderMode) => onChange({
|
|
@@ -2499,15 +2505,15 @@ function ListRenderModeInput(props) {
|
|
|
2499
2505
|
children: [
|
|
2500
2506
|
/* @__PURE__ */ jsx(Radio, {
|
|
2501
2507
|
value: `${DataValidationRenderMode.CUSTOM}`,
|
|
2502
|
-
children: localeService.t("
|
|
2508
|
+
children: localeService.t("sheets-data-validation-ui.renderMode.chip")
|
|
2503
2509
|
}),
|
|
2504
2510
|
/* @__PURE__ */ jsx(Radio, {
|
|
2505
2511
|
value: `${DataValidationRenderMode.ARROW}`,
|
|
2506
|
-
children: localeService.t("
|
|
2512
|
+
children: localeService.t("sheets-data-validation-ui.renderMode.arrow")
|
|
2507
2513
|
}),
|
|
2508
2514
|
/* @__PURE__ */ jsx(Radio, {
|
|
2509
2515
|
value: `${DataValidationRenderMode.TEXT}`,
|
|
2510
|
-
children: localeService.t("
|
|
2516
|
+
children: localeService.t("sheets-data-validation-ui.renderMode.text")
|
|
2511
2517
|
})
|
|
2512
2518
|
]
|
|
2513
2519
|
})
|
|
@@ -2533,7 +2539,7 @@ function DateShowTimeOption(props) {
|
|
|
2533
2539
|
}
|
|
2534
2540
|
});
|
|
2535
2541
|
},
|
|
2536
|
-
children: localeService.t("
|
|
2542
|
+
children: localeService.t("sheets-data-validation-ui.showTime.label")
|
|
2537
2543
|
}) });
|
|
2538
2544
|
}
|
|
2539
2545
|
DateShowTimeOption.componentKey = DATE_SHOW_TIME_OPTION;
|
|
@@ -2845,9 +2851,7 @@ const PADDING_H$1 = 4;
|
|
|
2845
2851
|
const PADDING_V$1 = 0;
|
|
2846
2852
|
const MARGIN_H$1 = 4;
|
|
2847
2853
|
const MARGIN_V$1 = 4;
|
|
2848
|
-
const CELL_PADDING_H = 6;
|
|
2849
2854
|
const CELL_PADDING_V = 6;
|
|
2850
|
-
const ICON_PLACE$1 = 14;
|
|
2851
2855
|
function getDropdownItemSize(text, fontStyle) {
|
|
2852
2856
|
const bBox = FontCache.getTextSize(text, fontStyle);
|
|
2853
2857
|
const rectWidth = bBox.width + 4 * 2;
|
|
@@ -2859,7 +2863,7 @@ function getDropdownItemSize(text, fontStyle) {
|
|
|
2859
2863
|
};
|
|
2860
2864
|
}
|
|
2861
2865
|
function layoutDropdowns(items, fontStyle, cellWidth, cellHeight) {
|
|
2862
|
-
const cellPaddingH =
|
|
2866
|
+
const cellPaddingH = 26;
|
|
2863
2867
|
const widthAvailableForContent = cellWidth - cellPaddingH;
|
|
2864
2868
|
const heightAvailableForContent = cellHeight - 6 * 2;
|
|
2865
2869
|
const textLayout = items.map((item) => ({
|
|
@@ -3419,15 +3423,15 @@ let DropdownWidget = class DropdownWidget {
|
|
|
3419
3423
|
let { tb, pd } = style || {};
|
|
3420
3424
|
const { l = DEFAULT_STYLES.pd.l, r = DEFAULT_STYLES.pd.r } = pd !== null && pd !== void 0 ? pd : {};
|
|
3421
3425
|
tb = (_tb3 = tb) !== null && _tb3 !== void 0 ? _tb3 : WrapStrategy.WRAP;
|
|
3422
|
-
let paddingAll =
|
|
3426
|
+
let paddingAll = 26;
|
|
3423
3427
|
switch (rule.renderMode) {
|
|
3424
3428
|
case DataValidationRenderMode.ARROW:
|
|
3425
|
-
paddingAll =
|
|
3429
|
+
paddingAll = 18 + r + l;
|
|
3426
3430
|
break;
|
|
3427
3431
|
case DataValidationRenderMode.CUSTOM:
|
|
3428
|
-
paddingAll =
|
|
3432
|
+
paddingAll = 34 + r + l + RADIUS_BG / 2 + 1;
|
|
3429
3433
|
break;
|
|
3430
|
-
default: paddingAll =
|
|
3434
|
+
default: paddingAll = 34 + r + l + RADIUS_BG / 2 + 1;
|
|
3431
3435
|
}
|
|
3432
3436
|
const widthForTextLayout = cellWidth - paddingAll;
|
|
3433
3437
|
const skeleton = new DocSimpleSkeleton(valueStr, getFontStyleString(style).fontCache, Boolean(tb === WrapStrategy.WRAP), widthForTextLayout, Infinity);
|