@univerjs/sheets-data-validation-ui 1.0.0-alpha.8 → 1.0.0-beta.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/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ComponentManager, IDialogService, IMenuManagerService, ISidebarService, IconManager, KeyCode, MenuItemType, RibbonDataGroup, RibbonInsertGroup, UniverMobileUIPlugin, UniverUIPlugin, getMenuHiddenObservable, useDependency, useEvent, useObservable, useSidebarClick } from "@univerjs/ui";
1
+ import { ComponentManager, IDialogService, IMenuManagerService, ISidebarService, IconManager, KeyCode, MenuItemType, RibbonDataGroup, RibbonInsertGroup, UniverMobileUIPlugin, getMenuHiddenObservable, useDependency, useEvent, useObservable, useSidebarClick } from "@univerjs/ui";
2
2
  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, bufferDebounceTime, dateKit, debounce, generateRandomId, isFormulaString, isUnitRangesEqual, merge, numfmt, queryObjectMatrix, sequenceExecute, shallowEqual, toDisposable } from "@univerjs/core";
3
3
  import { AUTO_FILL_APPLY_TYPE, AutoFillTools, IAutoFillService, INTERCEPTOR_POINT, InterceptCellContentPriority, RangeProtectionPermissionEditPoint, SetRangeValuesCommand, SetWorksheetActiveOperation, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, UniverSheetsPlugin, VALIDATE_CELL, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, checkRangesEditablePermission, deserializeListOptions, getSheetCommandTarget, rangeToDiscreteRange, serializeListOptions } from "@univerjs/sheets";
4
4
  import { AddSheetDataValidationCommand, BASE_FORMULA_INPUT_NAME, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, CHECKBOX_FORMULA_INPUT_NAME, CUSTOM_FORMULA_INPUT_NAME, ClearRangeDataValidationCommand, 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";
@@ -302,7 +302,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
302
302
  if (!(validator === null || validator === void 0 ? void 0 : validator.dropdownType)) return;
303
303
  let popupDisposable;
304
304
  const handleSave = async (date, targetPatternType) => {
305
- var _numfmt$parseDate, _cellStyle$n$pattern, _cellStyle$n;
305
+ var _numfmt$parseDate, _cellStyle$n;
306
306
  if (!date) return true;
307
307
  const newValue = date;
308
308
  const cellData = worksheet.getCell(row, col);
@@ -310,7 +310,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
310
310
  const serialNum = (_numfmt$parseDate = numfmt.parseDate(dateStr)) === null || _numfmt$parseDate === void 0 ? void 0 : _numfmt$parseDate.v;
311
311
  const serialTime = targetPatternType === "time" ? serialNum % 1 : serialNum;
312
312
  const cellStyle = workbook.getStyles().getStyleByCell(cellData);
313
- const format = (_cellStyle$n$pattern = cellStyle === null || cellStyle === void 0 || (_cellStyle$n = cellStyle.n) === null || _cellStyle$n === void 0 ? void 0 : _cellStyle$n.pattern) !== null && _cellStyle$n$pattern !== void 0 ? _cellStyle$n$pattern : "";
313
+ const format = (cellStyle === null || cellStyle === void 0 || (_cellStyle$n = cellStyle.n) === null || _cellStyle$n === void 0 ? void 0 : _cellStyle$n.pattern) ?? "";
314
314
  if (rule.errorStyle !== DataValidationErrorStyle.STOP || await validator.validator({
315
315
  value: serialTime,
316
316
  unitId,
@@ -404,11 +404,10 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
404
404
  }
405
405
  case DataValidatorDropdownType.LIST:
406
406
  case DataValidatorDropdownType.MULTIPLE_LIST: {
407
- var _this$_configService$, _this$_configService$2, _this$_configService$3, _this$_configService$4;
407
+ var _this$_configService$, _this$_configService$2;
408
408
  const multiple = validator.dropdownType === DataValidatorDropdownType.MULTIPLE_LIST;
409
409
  const handleSave = async (newValue) => {
410
- var _newValue$;
411
- const str = multiple ? serializeListOptions(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
410
+ const str = multiple ? serializeListOptions(newValue) : newValue[0] ?? "";
412
411
  const params = {
413
412
  unitId,
414
413
  subUnitId,
@@ -455,14 +454,13 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
455
454
  onEdit: handleEdit,
456
455
  defaultValue: cellStr,
457
456
  multiple,
458
- showEdit: (_this$_configService$ = (_this$_configService$2 = this._configService.getConfig("sheets-data-validation-ui.config")) === null || _this$_configService$2 === void 0 ? void 0 : _this$_configService$2.showEditOnDropdown) !== null && _this$_configService$ !== void 0 ? _this$_configService$ : true,
459
- showSearch: (_this$_configService$3 = (_this$_configService$4 = this._configService.getConfig("sheets-data-validation-ui.config")) === null || _this$_configService$4 === void 0 ? void 0 : _this$_configService$4.showSearchOnDropdown) !== null && _this$_configService$3 !== void 0 ? _this$_configService$3 : true
457
+ showEdit: ((_this$_configService$ = this._configService.getConfig("sheets-data-validation-ui.config")) === null || _this$_configService$ === void 0 ? void 0 : _this$_configService$.showEditOnDropdown) ?? true,
458
+ showSearch: ((_this$_configService$2 = this._configService.getConfig("sheets-data-validation-ui.config")) === null || _this$_configService$2 === void 0 ? void 0 : _this$_configService$2.showSearchOnDropdown) ?? true
460
459
  }
461
460
  };
462
461
  break;
463
462
  }
464
463
  case DataValidatorDropdownType.CASCADE: {
465
- var _rule$formula;
466
464
  const handleSave = (newValue) => {
467
465
  const params = {
468
466
  unitId,
@@ -494,7 +492,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
494
492
  props: {
495
493
  onChange: handleSave,
496
494
  defaultValue: getDataValidationCellValue(worksheet.getCellRaw(row, col)).split("/"),
497
- options: JSON.parse((_rule$formula = rule.formula1) !== null && _rule$formula !== void 0 ? _rule$formula : "[]")
495
+ options: JSON.parse(rule.formula1 ?? "[]")
498
496
  },
499
497
  location
500
498
  };
@@ -991,12 +989,11 @@ const menuSchema = {
991
989
  //#endregion
992
990
  //#region package.json
993
991
  var name = "@univerjs/sheets-data-validation-ui";
994
- var version = "1.0.0-alpha.8";
992
+ var version = "1.0.0-beta.0";
995
993
 
996
994
  //#endregion
997
995
  //#region src/views/components/DataValidationOptions.tsx
998
996
  function DataValidationOptions(props) {
999
- var _value$errorStyle;
1000
997
  const localeService = useDependency(LocaleService);
1001
998
  const componentManager = useDependency(ComponentManager);
1002
999
  const { value, onChange, extraComponent } = props;
@@ -1014,7 +1011,7 @@ function DataValidationOptions(props) {
1014
1011
  /* @__PURE__ */ jsx(FormLayout, {
1015
1012
  label: localeService.t("sheets-data-validation-ui.panel.invalid"),
1016
1013
  children: /* @__PURE__ */ jsxs(RadioGroup, {
1017
- value: `${(_value$errorStyle = value.errorStyle) !== null && _value$errorStyle !== void 0 ? _value$errorStyle : DataValidationErrorStyle.WARNING}`,
1014
+ value: `${value.errorStyle ?? DataValidationErrorStyle.WARNING}`,
1018
1015
  onChange: (errorStyle) => onChange({
1019
1016
  ...value,
1020
1017
  errorStyle: +errorStyle
@@ -1074,7 +1071,7 @@ function DataValidationDetail() {
1074
1071
  } });
1075
1072
  }
1076
1073
  function DataValidationDetailInner(props) {
1077
- var _validators$sort, _localRule$allowBlank;
1074
+ var _validators$sort;
1078
1075
  const [key, setKey] = useState(0);
1079
1076
  const dataValidationPanelService = useDependency(DataValidationPanelService);
1080
1077
  const { unitId, subUnitId, rule } = props.activeRuleInfo;
@@ -1086,10 +1083,7 @@ function DataValidationDetailInner(props) {
1086
1083
  const dataValidationModel = useDependency(DataValidationModel);
1087
1084
  const localeService = useDependency(LocaleService);
1088
1085
  const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
1089
- const worksheet = useObservable(() => {
1090
- var _workbook$activeSheet;
1091
- return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : of(null);
1092
- }, void 0, void 0, []);
1086
+ const worksheet = useObservable(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null), void 0, void 0, []);
1093
1087
  const [localRule, setLocalRule] = useState(rule);
1094
1088
  const validator = validatorService.getValidatorItem(localRule.type);
1095
1089
  const [showError, setShowError] = useState(false);
@@ -1337,14 +1331,11 @@ function DataValidationDetailInner(props) {
1337
1331
  ruleId
1338
1332
  }, key + localRule.type) : null,
1339
1333
  /* @__PURE__ */ jsx(FormLayout, { children: /* @__PURE__ */ jsx(Checkbox, {
1340
- checked: (_localRule$allowBlank = localRule.allowBlank) !== null && _localRule$allowBlank !== void 0 ? _localRule$allowBlank : true,
1341
- onChange: () => {
1342
- var _localRule$allowBlank2;
1343
- return handleUpdateRuleSetting({
1344
- ...baseRule,
1345
- allowBlank: !((_localRule$allowBlank2 = localRule.allowBlank) !== null && _localRule$allowBlank2 !== void 0 ? _localRule$allowBlank2 : true)
1346
- });
1347
- },
1334
+ checked: localRule.allowBlank ?? true,
1335
+ onChange: () => handleUpdateRuleSetting({
1336
+ ...baseRule,
1337
+ allowBlank: !(localRule.allowBlank ?? true)
1338
+ }),
1348
1339
  children: localeService.t("sheets-data-validation-ui.panel.allowBlank")
1349
1340
  }) }),
1350
1341
  /* @__PURE__ */ jsx(DataValidationOptions, {
@@ -1381,10 +1372,9 @@ const DataValidationItem = (props) => {
1381
1372
  const [isHover, setIsHover] = useState(false);
1382
1373
  const themeService = useDependency(ThemeService);
1383
1374
  const style = useMemo(() => {
1384
- var _themeService$getColo;
1385
1375
  const defaultColor = themeService.getColorFromTheme("primary.600");
1386
1376
  const key = themeService.getColorFromTheme("loop-color.2");
1387
- const color = (_themeService$getColo = themeService.getColorFromTheme(key)) !== null && _themeService$getColo !== void 0 ? _themeService$getColo : defaultColor;
1377
+ const color = themeService.getColorFromTheme(key) ?? defaultColor;
1388
1378
  const rgb = new ColorKit(color).toRgb();
1389
1379
  return {
1390
1380
  fill: `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0.1)`,
@@ -1505,23 +1495,20 @@ function DataValidationList(props) {
1505
1495
  const hasDisableRule = rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
1506
1496
  return /* @__PURE__ */ jsxs("div", {
1507
1497
  className: "univer-pb-4",
1508
- children: [rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.map((rule) => {
1509
- var _rule$disable;
1510
- return /* @__PURE__ */ jsx(DataValidationItem, {
1511
- unitId,
1512
- subUnitId,
1513
- onClick: () => {
1514
- if (rule.disable) return;
1515
- dataValidationPanelService.setActiveRule({
1516
- unitId,
1517
- subUnitId,
1518
- rule
1519
- });
1520
- },
1521
- rule,
1522
- disable: (_rule$disable = rule.disable) !== null && _rule$disable !== void 0 ? _rule$disable : false
1523
- }, rule.uid);
1524
- }), /* @__PURE__ */ jsxs("div", {
1498
+ children: [rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.map((rule) => /* @__PURE__ */ jsx(DataValidationItem, {
1499
+ unitId,
1500
+ subUnitId,
1501
+ onClick: () => {
1502
+ if (rule.disable) return;
1503
+ dataValidationPanelService.setActiveRule({
1504
+ unitId,
1505
+ subUnitId,
1506
+ rule
1507
+ });
1508
+ },
1509
+ rule,
1510
+ disable: rule.disable ?? false
1511
+ }, rule.uid)), /* @__PURE__ */ jsxs("div", {
1525
1512
  className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2",
1526
1513
  children: [rules.length && !hasDisableRule ? /* @__PURE__ */ jsx(Button, {
1527
1514
  onClick: handleRemoveAll,
@@ -1542,10 +1529,7 @@ const DataValidationPanel = () => {
1542
1529
  const activeRule = useObservable(dataValidationPanelService.activeRule$, dataValidationPanelService.activeRule);
1543
1530
  const univerInstanceService = useDependency(IUniverInstanceService);
1544
1531
  const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
1545
- const worksheet = useObservable(() => {
1546
- var _workbook$activeSheet;
1547
- return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : of(null);
1548
- }, void 0, void 0, []);
1532
+ const worksheet = useObservable(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null), void 0, void 0, []);
1549
1533
  if (!workbook || !worksheet) return null;
1550
1534
  return activeRule && (activeRule.subUnitId === worksheet.getSheetId() || activeRule.subUnitId === dataValidationPanelService.getFocusFormulaEditorActiveRuleSubUnitId()) ? /* @__PURE__ */ jsx(DataValidationDetail, {}, activeRule.rule.uid) : /* @__PURE__ */ jsx(DataValidationList, { workbook });
1551
1535
  };
@@ -1687,7 +1671,6 @@ function CheckboxFormulaInput(props) {
1687
1671
  //#endregion
1688
1672
  //#region src/views/components/formula-input/CustomFormulaInput.tsx
1689
1673
  function CustomFormulaInput(props) {
1690
- var _value$formula;
1691
1674
  const { unitId, subUnitId, value, onChange, showError, validResult } = props;
1692
1675
  const formula1Res = showError ? validResult === null || validResult === void 0 ? void 0 : validResult.formula1 : void 0;
1693
1676
  const formulaEditorRef = useRef(null);
@@ -1701,13 +1684,13 @@ function CustomFormulaInput(props) {
1701
1684
  children: /* @__PURE__ */ jsx(FormulaEditor, {
1702
1685
  ref: formulaEditorRef,
1703
1686
  className: clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", borderClassName),
1704
- initValue: (_value$formula = value === null || value === void 0 ? void 0 : value.formula1) !== null && _value$formula !== void 0 ? _value$formula : "=",
1687
+ initValue: (value === null || value === void 0 ? void 0 : value.formula1) ?? "=",
1705
1688
  unitId,
1706
1689
  subUnitId,
1707
1690
  isFocus: isFocusFormulaEditor,
1708
1691
  isSupportAcrossSheet: true,
1709
1692
  onChange: (newValue) => {
1710
- const newFormula = (newValue !== null && newValue !== void 0 ? newValue : "").trim();
1693
+ const newFormula = (newValue ?? "").trim();
1711
1694
  if (newFormula === (value === null || value === void 0 ? void 0 : value.formula1)) return;
1712
1695
  onChange === null || onChange === void 0 || onChange({
1713
1696
  ...value,
@@ -2005,7 +1988,7 @@ function ListFormulaInput(props) {
2005
1988
  isSupportAcrossSheet: true,
2006
1989
  onFocus: () => setIsFocusFormulaEditor(true),
2007
1990
  onChange: (v = "") => {
2008
- const str = (v !== null && v !== void 0 ? v : "").trim();
1991
+ const str = (v ?? "").trim();
2009
1992
  setFormulaStrCopy(str);
2010
1993
  updateFormula(str);
2011
1994
  }
@@ -2056,13 +2039,12 @@ const FORMULA_INPUTS = [
2056
2039
  //#region src/views/components/ListRenderModeInput.tsx
2057
2040
  const LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
2058
2041
  function ListRenderModeInput(props) {
2059
- var _value$renderMode;
2060
2042
  const { value, onChange } = props;
2061
2043
  const localeService = useDependency(LocaleService);
2062
2044
  return /* @__PURE__ */ jsx(FormLayout, {
2063
2045
  label: localeService.t("sheets-data-validation-ui.renderMode.label"),
2064
2046
  children: /* @__PURE__ */ jsxs(RadioGroup, {
2065
- value: `${(_value$renderMode = value.renderMode) !== null && _value$renderMode !== void 0 ? _value$renderMode : DataValidationRenderMode.CUSTOM}`,
2047
+ value: `${value.renderMode ?? DataValidationRenderMode.CUSTOM}`,
2066
2048
  onChange: (renderMode) => onChange({
2067
2049
  ...value,
2068
2050
  renderMode: +renderMode
@@ -2348,7 +2330,7 @@ let DataValidationCopyPasteController = class DataValidationCopyPasteController
2348
2330
  rows.forEach((row, rowIndex) => {
2349
2331
  cols.forEach((col, colIndex) => {
2350
2332
  const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
2351
- matrix.setValue(rowIndex, colIndex, ruleId !== null && ruleId !== void 0 ? ruleId : "");
2333
+ matrix.setValue(rowIndex, colIndex, ruleId ?? "");
2352
2334
  });
2353
2335
  });
2354
2336
  }
@@ -2570,32 +2552,30 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2570
2552
  effect: InterceptorEffectEnum.Style,
2571
2553
  priority: InterceptCellContentPriority.DATA_VALIDATION,
2572
2554
  handler: (cell, pos, next) => {
2573
- var _this$_dataValidation, _cell$customRender, _cell$fontRenderExten, _validator$skipDefaul, _cell$coverable;
2555
+ var _cell$fontRenderExten, _validator$skipDefaul;
2574
2556
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
2575
2557
  const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
2576
2558
  if (!ruleId) return next(cell);
2577
2559
  const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
2578
2560
  if (!rule) return next(cell);
2579
- const validStatus = (_this$_dataValidation = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) !== null && _this$_dataValidation !== void 0 ? _this$_dataValidation : DataValidationStatus.VALID;
2561
+ const validStatus = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? DataValidationStatus.VALID;
2580
2562
  const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
2581
2563
  const cellOrigin = pos.rawData;
2582
2564
  let cache;
2583
2565
  const cellValue = { get value() {
2584
- var _getCellValueOrigin;
2585
2566
  if (cache !== void 0) return cache;
2586
- cache = (_getCellValueOrigin = getCellValueOrigin(cellOrigin)) !== null && _getCellValueOrigin !== void 0 ? _getCellValueOrigin : null;
2567
+ cache = getCellValueOrigin(cellOrigin) ?? null;
2587
2568
  return cache;
2588
2569
  } };
2589
2570
  const valueStr = { get value() {
2590
- var _cellValue$value;
2591
- return `${(_cellValue$value = cellValue.value) !== null && _cellValue$value !== void 0 ? _cellValue$value : ""}`;
2571
+ return `${cellValue.value ?? ""}`;
2592
2572
  } };
2593
2573
  if (!cell || cell === pos.rawData) cell = { ...pos.rawData };
2594
2574
  cell.markers = {
2595
2575
  ...cell === null || cell === void 0 ? void 0 : cell.markers,
2596
2576
  ...validStatus === DataValidationStatus.INVALID ? INVALID_MARK : null
2597
2577
  };
2598
- cell.customRender = [...(_cell$customRender = cell === null || cell === void 0 ? void 0 : cell.customRender) !== null && _cell$customRender !== void 0 ? _cell$customRender : [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
2578
+ cell.customRender = [...(cell === null || cell === void 0 ? void 0 : cell.customRender) ?? [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
2599
2579
  cell.fontRenderExtension = {
2600
2580
  ...cell === null || cell === void 0 ? void 0 : cell.fontRenderExtension,
2601
2581
  isSkip: (cell === null || cell === void 0 || (_cell$fontRenderExten = cell.fontRenderExtension) === null || _cell$fontRenderExten === void 0 ? void 0 : _cell$fontRenderExten.isSkip) || (validator === null || validator === void 0 || (_validator$skipDefaul = validator.skipDefaultFontRender) === null || _validator$skipDefaul === void 0 ? void 0 : _validator$skipDefaul.call(validator, rule, cellValue.value, pos))
@@ -2608,14 +2588,14 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2608
2588
  } }, row, col)
2609
2589
  };
2610
2590
  cell.interceptorAutoHeight = () => {
2611
- var _this$_renderManagerS, _mergeCell$startRow, _mergeCell$startColum, _validator$canvasRend, _validator$canvasRend2;
2591
+ var _this$_renderManagerS, _validator$canvasRend, _validator$canvasRend2;
2612
2592
  const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 || (_this$_renderManagerS = _this$_renderManagerS.with(SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.skeleton;
2613
2593
  if (!skeleton) return;
2614
2594
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2615
2595
  const info = {
2616
2596
  data: cell,
2617
2597
  style: workbook.getStyles().getStyleByCell(cell),
2618
- primaryWithCoord: skeleton.getCellWithCoordByIndex((_mergeCell$startRow = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) !== null && _mergeCell$startRow !== void 0 ? _mergeCell$startRow : row, (_mergeCell$startColum = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) !== null && _mergeCell$startColum !== void 0 ? _mergeCell$startColum : col),
2598
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2619
2599
  unitId,
2620
2600
  subUnitId,
2621
2601
  row,
@@ -2626,14 +2606,14 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2626
2606
  return validator === null || validator === void 0 || (_validator$canvasRend = validator.canvasRender) === null || _validator$canvasRend === void 0 || (_validator$canvasRend2 = _validator$canvasRend.calcCellAutoHeight) === null || _validator$canvasRend2 === void 0 ? void 0 : _validator$canvasRend2.call(_validator$canvasRend, info);
2627
2607
  };
2628
2608
  cell.interceptorAutoWidth = () => {
2629
- var _this$_renderManagerS2, _mergeCell$startRow2, _mergeCell$startColum2, _validator$canvasRend3, _validator$canvasRend4;
2609
+ var _this$_renderManagerS2, _validator$canvasRend3, _validator$canvasRend4;
2630
2610
  const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 || (_this$_renderManagerS2 = _this$_renderManagerS2.with(SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.skeleton;
2631
2611
  if (!skeleton) return;
2632
2612
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2633
2613
  const info = {
2634
2614
  data: cell,
2635
2615
  style: workbook.getStyles().getStyleByCell(cell),
2636
- primaryWithCoord: skeleton.getCellWithCoordByIndex((_mergeCell$startRow2 = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) !== null && _mergeCell$startRow2 !== void 0 ? _mergeCell$startRow2 : row, (_mergeCell$startColum2 = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) !== null && _mergeCell$startColum2 !== void 0 ? _mergeCell$startColum2 : col),
2616
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2637
2617
  unitId,
2638
2618
  subUnitId,
2639
2619
  row,
@@ -2643,7 +2623,7 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2643
2623
  };
2644
2624
  return validator === null || validator === void 0 || (_validator$canvasRend3 = validator.canvasRender) === null || _validator$canvasRend3 === void 0 || (_validator$canvasRend4 = _validator$canvasRend3.calcCellAutoWidth) === null || _validator$canvasRend4 === void 0 ? void 0 : _validator$canvasRend4.call(_validator$canvasRend3, info);
2645
2625
  };
2646
- cell.coverable = ((_cell$coverable = cell === null || cell === void 0 ? void 0 : cell.coverable) !== null && _cell$coverable !== void 0 ? _cell$coverable : true) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE);
2626
+ cell.coverable = ((cell === null || cell === void 0 ? void 0 : cell.coverable) ?? true) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE);
2647
2627
  return next(cell);
2648
2628
  }
2649
2629
  }));
@@ -2693,22 +2673,22 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2693
2673
  effect: InterceptorEffectEnum.Style,
2694
2674
  priority: InterceptCellContentPriority.DATA_VALIDATION,
2695
2675
  handler: (cell, pos, next) => {
2696
- var _this$_dataValidation2, _cell$customRender2, _cell$fontRenderExten2, _validator$skipDefaul2, _cell$coverable2;
2676
+ var _cell$fontRenderExten2, _validator$skipDefaul2;
2697
2677
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
2698
2678
  const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
2699
2679
  if (!ruleId) return next(cell);
2700
2680
  const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
2701
2681
  if (!rule) return next(cell);
2702
- const validStatus = (_this$_dataValidation2 = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) !== null && _this$_dataValidation2 !== void 0 ? _this$_dataValidation2 : DataValidationStatus.VALID;
2682
+ const validStatus = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? DataValidationStatus.VALID;
2703
2683
  const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
2704
2684
  const cellValue = getCellValueOrigin(worksheet.getCellRaw(row, col));
2705
- const valueStr = `${cellValue !== null && cellValue !== void 0 ? cellValue : ""}`;
2685
+ const valueStr = `${cellValue ?? ""}`;
2706
2686
  if (!cell || cell === pos.rawData) cell = { ...pos.rawData };
2707
2687
  cell.markers = {
2708
2688
  ...cell === null || cell === void 0 ? void 0 : cell.markers,
2709
2689
  ...validStatus === DataValidationStatus.INVALID ? INVALID_MARK : null
2710
2690
  };
2711
- cell.customRender = [...(_cell$customRender2 = cell === null || cell === void 0 ? void 0 : cell.customRender) !== null && _cell$customRender2 !== void 0 ? _cell$customRender2 : [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
2691
+ cell.customRender = [...(cell === null || cell === void 0 ? void 0 : cell.customRender) ?? [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
2712
2692
  cell.fontRenderExtension = {
2713
2693
  ...cell === null || cell === void 0 ? void 0 : cell.fontRenderExtension,
2714
2694
  isSkip: (cell === null || cell === void 0 || (_cell$fontRenderExten2 = cell.fontRenderExtension) === null || _cell$fontRenderExten2 === void 0 ? void 0 : _cell$fontRenderExten2.isSkip) || (validator === null || validator === void 0 || (_validator$skipDefaul2 = validator.skipDefaultFontRender) === null || _validator$skipDefaul2 === void 0 ? void 0 : _validator$skipDefaul2.call(validator, rule, cellValue, pos))
@@ -2721,14 +2701,14 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2721
2701
  } }, row, col)
2722
2702
  };
2723
2703
  cell.interceptorAutoHeight = () => {
2724
- var _this$_renderManagerS3, _mergeCell$startRow3, _mergeCell$startColum3, _validator$canvasRend5, _validator$canvasRend6;
2704
+ var _this$_renderManagerS3, _validator$canvasRend5, _validator$canvasRend6;
2725
2705
  const skeleton = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 || (_this$_renderManagerS3 = _this$_renderManagerS3.with(SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.skeleton;
2726
2706
  if (!skeleton) return;
2727
2707
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2728
2708
  const info = {
2729
2709
  data: cell,
2730
2710
  style: workbook.getStyles().getStyleByCell(cell),
2731
- primaryWithCoord: skeleton.getCellWithCoordByIndex((_mergeCell$startRow3 = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) !== null && _mergeCell$startRow3 !== void 0 ? _mergeCell$startRow3 : row, (_mergeCell$startColum3 = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) !== null && _mergeCell$startColum3 !== void 0 ? _mergeCell$startColum3 : col),
2711
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2732
2712
  unitId,
2733
2713
  subUnitId,
2734
2714
  row,
@@ -2739,14 +2719,14 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2739
2719
  return validator === null || validator === void 0 || (_validator$canvasRend5 = validator.canvasRender) === null || _validator$canvasRend5 === void 0 || (_validator$canvasRend6 = _validator$canvasRend5.calcCellAutoHeight) === null || _validator$canvasRend6 === void 0 ? void 0 : _validator$canvasRend6.call(_validator$canvasRend5, info);
2740
2720
  };
2741
2721
  cell.interceptorAutoWidth = () => {
2742
- var _this$_renderManagerS4, _mergeCell$startRow4, _mergeCell$startColum4, _validator$canvasRend7, _validator$canvasRend8;
2722
+ var _this$_renderManagerS4, _validator$canvasRend7, _validator$canvasRend8;
2743
2723
  const skeleton = (_this$_renderManagerS4 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS4 === void 0 || (_this$_renderManagerS4 = _this$_renderManagerS4.with(SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS4 === void 0 ? void 0 : _this$_renderManagerS4.skeleton;
2744
2724
  if (!skeleton) return;
2745
2725
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2746
2726
  const info = {
2747
2727
  data: cell,
2748
2728
  style: workbook.getStyles().getStyleByCell(cell),
2749
- primaryWithCoord: skeleton.getCellWithCoordByIndex((_mergeCell$startRow4 = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) !== null && _mergeCell$startRow4 !== void 0 ? _mergeCell$startRow4 : row, (_mergeCell$startColum4 = mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) !== null && _mergeCell$startColum4 !== void 0 ? _mergeCell$startColum4 : col),
2729
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2750
2730
  unitId,
2751
2731
  subUnitId,
2752
2732
  row,
@@ -2756,7 +2736,7 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2756
2736
  };
2757
2737
  return validator === null || validator === void 0 || (_validator$canvasRend7 = validator.canvasRender) === null || _validator$canvasRend7 === void 0 || (_validator$canvasRend8 = _validator$canvasRend7.calcCellAutoWidth) === null || _validator$canvasRend8 === void 0 ? void 0 : _validator$canvasRend8.call(_validator$canvasRend7, info);
2758
2738
  };
2759
- cell.coverable = ((_cell$coverable2 = cell === null || cell === void 0 ? void 0 : cell.coverable) !== null && _cell$coverable2 !== void 0 ? _cell$coverable2 : true) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE);
2739
+ cell.coverable = ((cell === null || cell === void 0 ? void 0 : cell.coverable) ?? true) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE);
2760
2740
  return next(cell);
2761
2741
  }
2762
2742
  }));
@@ -2818,11 +2798,10 @@ SheetsDataValidationReRenderController = __decorate([__decorateParam(1, Inject(S
2818
2798
  const MARGIN_H$2 = 6;
2819
2799
  let CheckboxRender = class CheckboxRender {
2820
2800
  _calc(cellInfo, style) {
2821
- var _style$fs, _style$fs2, _style$fs3;
2822
2801
  const { vt, ht } = style || {};
2823
2802
  const width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2;
2824
2803
  const height = cellInfo.endY - cellInfo.startY;
2825
- const size = ((_style$fs = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs !== void 0 ? _style$fs : 10) * 1.6;
2804
+ const size = ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2826
2805
  let widgetLeft = 0;
2827
2806
  let widgetTop = 0;
2828
2807
  switch (vt) {
@@ -2850,8 +2829,8 @@ let CheckboxRender = class CheckboxRender {
2850
2829
  return {
2851
2830
  left: cellInfo.startX + widgetLeft,
2852
2831
  top: cellInfo.startY + widgetTop,
2853
- width: ((_style$fs2 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs2 !== void 0 ? _style$fs2 : 10) * 1.6,
2854
- height: ((_style$fs3 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs3 !== void 0 ? _style$fs3 : 10) * 1.6
2832
+ width: ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6,
2833
+ height: ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6
2855
2834
  };
2856
2835
  }
2857
2836
  constructor(_commandService, _univerInstanceService, _formulaService, _themeService, _renderManagerService, _dataValidationModel) {
@@ -2863,14 +2842,12 @@ let CheckboxRender = class CheckboxRender {
2863
2842
  this._dataValidationModel = _dataValidationModel;
2864
2843
  }
2865
2844
  calcCellAutoHeight(info) {
2866
- var _style$fs4;
2867
2845
  const { style } = info;
2868
- return ((_style$fs4 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs4 !== void 0 ? _style$fs4 : 10) * 1.6;
2846
+ return ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2869
2847
  }
2870
2848
  calcCellAutoWidth(info) {
2871
- var _style$fs5;
2872
2849
  const { style } = info;
2873
- return ((_style$fs5 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs5 !== void 0 ? _style$fs5 : 10) * 1.6;
2850
+ return ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2874
2851
  }
2875
2852
  async _parseFormula(rule, unitId, subUnitId) {
2876
2853
  var _results$, _results$2, _results$3;
@@ -2886,7 +2863,7 @@ let CheckboxRender = class CheckboxRender {
2886
2863
  };
2887
2864
  }
2888
2865
  drawWith(ctx, info) {
2889
- var _validator$skipDefaul, _style$fs6, _style$cl$rgb, _style$cl;
2866
+ var _validator$skipDefaul, _style$cl;
2890
2867
  const { style, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info;
2891
2868
  const cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
2892
2869
  const value = getCellValueOrigin(worksheet.getCellRaw(row, col));
@@ -2924,14 +2901,14 @@ let CheckboxRender = class CheckboxRender {
2924
2901
  ctx.clip();
2925
2902
  const m = transform.getMatrix();
2926
2903
  ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
2927
- const size = ((_style$fs6 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs6 !== void 0 ? _style$fs6 : 10) * 1.6;
2904
+ const size = ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2928
2905
  const checked = String(value) === String(formula1);
2929
2906
  const defaultColor = this._themeService.getColorFromTheme("primary.600");
2930
2907
  CheckboxShape.drawWith(ctx, {
2931
2908
  checked,
2932
2909
  width: size,
2933
2910
  height: size,
2934
- fill: (_style$cl$rgb = style === null || style === void 0 || (_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) !== null && _style$cl$rgb !== void 0 ? _style$cl$rgb : defaultColor
2911
+ fill: (style === null || style === void 0 || (_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) ?? defaultColor
2935
2912
  });
2936
2913
  ctx.restore();
2937
2914
  }
@@ -3239,7 +3216,6 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3239
3216
  ctx.restore();
3240
3217
  }
3241
3218
  drawWith(ctx, info, skeleton, spreadsheets) {
3242
- var _ref, _getCellValueOrigin;
3243
3219
  const { primaryWithCoord, row, col, style, data, subUnitId } = info;
3244
3220
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3245
3221
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
@@ -3260,11 +3236,11 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3260
3236
  const cellWidth = cellBounding.endX - cellBounding.startX;
3261
3237
  const cellHeight = cellBounding.endY - cellBounding.startY;
3262
3238
  const { cl } = style || {};
3263
- const color = (_ref = typeof cl === "object" ? cl === null || cl === void 0 ? void 0 : cl.rgb : cl) !== null && _ref !== void 0 ? _ref : "#000";
3264
- const fontStyle = getFontStyleString(style !== null && style !== void 0 ? style : void 0);
3239
+ const color = (typeof cl === "object" ? cl === null || cl === void 0 ? void 0 : cl.rgb : cl) ?? "#000";
3240
+ const fontStyle = getFontStyleString(style ?? void 0);
3265
3241
  const { vt: _vt, ht } = style || {};
3266
- const vt = _vt !== null && _vt !== void 0 ? _vt : VerticalAlign.MIDDLE;
3267
- const cellValue = (_getCellValueOrigin = getCellValueOrigin(data)) !== null && _getCellValueOrigin !== void 0 ? _getCellValueOrigin : "";
3242
+ const vt = _vt ?? VerticalAlign.MIDDLE;
3243
+ const cellValue = getCellValueOrigin(data) ?? "";
3268
3244
  const items = validator.parseCellValue(cellValue);
3269
3245
  const labelColorMap = validator.getListWithColorMap(rule);
3270
3246
  const layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
@@ -3322,7 +3298,6 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3322
3298
  });
3323
3299
  }
3324
3300
  calcCellAutoHeight(info) {
3325
- var _getCellValueOrigin2;
3326
3301
  const { primaryWithCoord, style, data, row, col } = info;
3327
3302
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
3328
3303
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
@@ -3338,11 +3313,10 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3338
3313
  if (!validator) return;
3339
3314
  const cellWidth = cellBounding.endX - cellBounding.startX;
3340
3315
  const cellHeight = cellBounding.endY - cellBounding.startY;
3341
- const cellValue = (_getCellValueOrigin2 = getCellValueOrigin(data)) !== null && _getCellValueOrigin2 !== void 0 ? _getCellValueOrigin2 : "";
3342
- return layoutDropdowns(validator.parseCellValue(cellValue), getFontStyleString(style !== null && style !== void 0 ? style : void 0), cellWidth, cellHeight).cellAutoHeight;
3316
+ const cellValue = getCellValueOrigin(data) ?? "";
3317
+ return layoutDropdowns(validator.parseCellValue(cellValue), getFontStyleString(style ?? void 0), cellWidth, cellHeight).cellAutoHeight;
3343
3318
  }
3344
3319
  calcCellAutoWidth(info) {
3345
- var _getCellValueOrigin3;
3346
3320
  const { primaryWithCoord, style, data, row, col } = info;
3347
3321
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
3348
3322
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
@@ -3358,8 +3332,8 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3358
3332
  if (!validator) return;
3359
3333
  const cellWidth = cellBounding.endX - cellBounding.startX;
3360
3334
  const cellHeight = cellBounding.endY - cellBounding.startY;
3361
- const cellValue = (_getCellValueOrigin3 = getCellValueOrigin(data)) !== null && _getCellValueOrigin3 !== void 0 ? _getCellValueOrigin3 : "";
3362
- return layoutDropdowns(validator.parseCellValue(cellValue), getFontStyleString(style !== null && style !== void 0 ? style : void 0), cellWidth, cellHeight).calcAutoWidth;
3335
+ const cellValue = getCellValueOrigin(data) ?? "";
3336
+ return layoutDropdowns(validator.parseCellValue(cellValue), getFontStyleString(style ?? void 0), cellWidth, cellHeight).calcAutoWidth;
3363
3337
  }
3364
3338
  isHit(position, info) {
3365
3339
  const { primaryWithCoord } = info;
@@ -3512,7 +3486,6 @@ let DropdownWidget = class DropdownWidget {
3512
3486
  ctx.restore();
3513
3487
  }
3514
3488
  drawWith(ctx, info, skeleton) {
3515
- var _tb, _vt, _ht, _pd;
3516
3489
  const { primaryWithCoord, row, col, style, data, subUnitId } = info;
3517
3490
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3518
3491
  const _row = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo.startRow : row;
@@ -3535,14 +3508,13 @@ let DropdownWidget = class DropdownWidget {
3535
3508
  const map = this._ensureMap(subUnitId);
3536
3509
  const key = this._generateKey(row, col);
3537
3510
  const colorMap = validator.getListWithColorMap(rule);
3538
- const value = getCellValueOrigin(data);
3539
- const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
3511
+ const valueStr = `${getCellValueOrigin(data) ?? ""}`;
3540
3512
  const activeColor = colorMap[valueStr];
3541
3513
  let { tb, vt, ht, pd } = style || {};
3542
- tb = (_tb = tb) !== null && _tb !== void 0 ? _tb : WrapStrategy.WRAP;
3543
- vt = (_vt = vt) !== null && _vt !== void 0 ? _vt : VerticalAlign.BOTTOM;
3544
- ht = (_ht = ht) !== null && _ht !== void 0 ? _ht : DEFAULT_STYLES.ht;
3545
- pd = (_pd = pd) !== null && _pd !== void 0 ? _pd : DEFAULT_STYLES.pd;
3514
+ tb = tb ?? WrapStrategy.WRAP;
3515
+ vt = vt ?? VerticalAlign.BOTTOM;
3516
+ ht = ht ?? DEFAULT_STYLES.ht;
3517
+ pd = pd ?? DEFAULT_STYLES.pd;
3546
3518
  const fontStyle = getFontStyleString(style).fontCache;
3547
3519
  if (rule.renderMode === DataValidationRenderMode.ARROW) {
3548
3520
  var _style$cl, _style$st, _style$ul;
@@ -3636,7 +3608,6 @@ let DropdownWidget = class DropdownWidget {
3636
3608
  }
3637
3609
  }
3638
3610
  calcCellAutoHeight(info) {
3639
- var _tb2;
3640
3611
  const { primaryWithCoord, style, data, row, col } = info;
3641
3612
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3642
3613
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
@@ -3650,13 +3621,12 @@ let DropdownWidget = class DropdownWidget {
3650
3621
  endY: _cellBounding.endY - downOffset
3651
3622
  };
3652
3623
  const cellWidth = cellBounding.endX - cellBounding.startX;
3653
- const value = getCellValueOrigin(data);
3654
- const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
3624
+ const valueStr = `${getCellValueOrigin(data) ?? ""}`;
3655
3625
  let { tb, pd } = style || {};
3656
- const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd !== null && pd !== void 0 ? pd : {};
3657
- tb = (_tb2 = tb) !== null && _tb2 !== void 0 ? _tb2 : WrapStrategy.WRAP;
3626
+ const { t = DEFAULT_STYLES.pd.t, b = DEFAULT_STYLES.pd.b } = pd ?? {};
3627
+ tb = tb ?? WrapStrategy.WRAP;
3658
3628
  if (rule.renderMode === DataValidationRenderMode.ARROW) {
3659
- const { l = DEFAULT_STYLES.pd.l, r = DEFAULT_STYLES.pd.r } = pd !== null && pd !== void 0 ? pd : {};
3629
+ const { l = DEFAULT_STYLES.pd.l, r = DEFAULT_STYLES.pd.r } = pd ?? {};
3660
3630
  const realWidth = cellWidth - l - r - ICON_PLACE - 4;
3661
3631
  const skeleton = new DocSimpleSkeleton(valueStr, getFontStyleString(style).fontCache, Boolean(tb === WrapStrategy.WRAP), realWidth, Infinity);
3662
3632
  skeleton.calculate();
@@ -3669,7 +3639,6 @@ let DropdownWidget = class DropdownWidget {
3669
3639
  }
3670
3640
  }
3671
3641
  calcCellAutoWidth(info) {
3672
- var _tb3;
3673
3642
  const { primaryWithCoord, style, data, row, col } = info;
3674
3643
  const cellRange = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3675
3644
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
@@ -3683,11 +3652,10 @@ let DropdownWidget = class DropdownWidget {
3683
3652
  endY: cellRange.endY - downOffset
3684
3653
  };
3685
3654
  const cellWidth = cellBounding.endX - cellBounding.startX;
3686
- const value = getCellValueOrigin(data);
3687
- const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
3655
+ const valueStr = `${getCellValueOrigin(data) ?? ""}`;
3688
3656
  let { tb, pd } = style || {};
3689
- const { l = DEFAULT_STYLES.pd.l, r = DEFAULT_STYLES.pd.r } = pd !== null && pd !== void 0 ? pd : {};
3690
- tb = (_tb3 = tb) !== null && _tb3 !== void 0 ? _tb3 : WrapStrategy.WRAP;
3657
+ const { l = DEFAULT_STYLES.pd.l, r = DEFAULT_STYLES.pd.r } = pd ?? {};
3658
+ tb = tb ?? WrapStrategy.WRAP;
3691
3659
  let paddingAll = 26;
3692
3660
  switch (rule.renderMode) {
3693
3661
  case DataValidationRenderMode.ARROW:
@@ -3966,7 +3934,7 @@ _defineProperty(UniverSheetsDataValidationUIPlugin, "packageName", name);
3966
3934
  _defineProperty(UniverSheetsDataValidationUIPlugin, "version", version);
3967
3935
  _defineProperty(UniverSheetsDataValidationUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
3968
3936
  UniverSheetsDataValidationUIPlugin = __decorate([
3969
- DependentOn(UniverDataValidationPlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverUIPlugin, UniverSheetsUIPlugin, UniverSheetsDataValidationPlugin),
3937
+ DependentOn(UniverDataValidationPlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverSheetsUIPlugin, UniverSheetsDataValidationPlugin),
3970
3938
  __decorateParam(1, Inject(Injector)),
3971
3939
  __decorateParam(2, ICommandService),
3972
3940
  __decorateParam(3, IConfigService)