@univerjs/sheets-data-validation-ui 1.0.0-alpha.8 → 1.0.0-beta.1

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.
Files changed (84) hide show
  1. package/lib/cjs/index.js +173 -244
  2. package/lib/cjs/locale/ar-SA.js +1 -36
  3. package/lib/cjs/locale/ca-ES.js +1 -36
  4. package/lib/cjs/locale/de-DE.js +1 -36
  5. package/lib/cjs/locale/en-US.js +1 -36
  6. package/lib/cjs/locale/es-ES.js +1 -36
  7. package/lib/cjs/locale/fa-IR.js +1 -36
  8. package/lib/cjs/locale/fr-FR.js +1 -36
  9. package/lib/cjs/locale/id-ID.js +1 -36
  10. package/lib/cjs/locale/it-IT.js +1 -36
  11. package/lib/cjs/locale/ja-JP.js +1 -36
  12. package/lib/cjs/locale/ko-KR.js +1 -36
  13. package/lib/cjs/locale/pl-PL.js +1 -36
  14. package/lib/cjs/locale/pt-BR.js +1 -36
  15. package/lib/cjs/locale/ru-RU.js +1 -36
  16. package/lib/cjs/locale/sk-SK.js +1 -36
  17. package/lib/cjs/locale/vi-VN.js +1 -36
  18. package/lib/cjs/locale/zh-CN.js +1 -36
  19. package/lib/cjs/locale/zh-HK.js +1 -36
  20. package/lib/cjs/locale/zh-TW.js +1 -36
  21. package/lib/es/index.js +175 -246
  22. package/lib/es/locale/ar-SA.js +1 -36
  23. package/lib/es/locale/ca-ES.js +1 -36
  24. package/lib/es/locale/de-DE.js +1 -36
  25. package/lib/es/locale/en-US.js +1 -36
  26. package/lib/es/locale/es-ES.js +1 -36
  27. package/lib/es/locale/fa-IR.js +1 -36
  28. package/lib/es/locale/fr-FR.js +1 -36
  29. package/lib/es/locale/id-ID.js +1 -36
  30. package/lib/es/locale/it-IT.js +1 -36
  31. package/lib/es/locale/ja-JP.js +1 -36
  32. package/lib/es/locale/ko-KR.js +1 -36
  33. package/lib/es/locale/pl-PL.js +1 -36
  34. package/lib/es/locale/pt-BR.js +1 -36
  35. package/lib/es/locale/ru-RU.js +1 -36
  36. package/lib/es/locale/sk-SK.js +1 -36
  37. package/lib/es/locale/vi-VN.js +1 -36
  38. package/lib/es/locale/zh-CN.js +1 -36
  39. package/lib/es/locale/zh-HK.js +1 -36
  40. package/lib/es/locale/zh-TW.js +1 -36
  41. package/lib/index.css +24 -8
  42. package/lib/index.js +175 -246
  43. package/lib/locale/ar-SA.js +1 -36
  44. package/lib/locale/ca-ES.js +1 -36
  45. package/lib/locale/de-DE.js +1 -36
  46. package/lib/locale/en-US.js +1 -36
  47. package/lib/locale/es-ES.js +1 -36
  48. package/lib/locale/fa-IR.js +1 -36
  49. package/lib/locale/fr-FR.js +1 -36
  50. package/lib/locale/id-ID.js +1 -36
  51. package/lib/locale/it-IT.js +1 -36
  52. package/lib/locale/ja-JP.js +1 -36
  53. package/lib/locale/ko-KR.js +1 -36
  54. package/lib/locale/pl-PL.js +1 -36
  55. package/lib/locale/pt-BR.js +1 -36
  56. package/lib/locale/ru-RU.js +1 -36
  57. package/lib/locale/sk-SK.js +1 -36
  58. package/lib/locale/vi-VN.js +1 -36
  59. package/lib/locale/zh-CN.js +1 -36
  60. package/lib/locale/zh-HK.js +1 -36
  61. package/lib/locale/zh-TW.js +1 -36
  62. package/lib/types/const.d.ts +2 -1
  63. package/lib/types/locale/en-US.d.ts +0 -39
  64. package/lib/umd/index.js +1 -1
  65. package/lib/umd/locale/ar-SA.js +1 -1
  66. package/lib/umd/locale/ca-ES.js +1 -1
  67. package/lib/umd/locale/de-DE.js +1 -1
  68. package/lib/umd/locale/en-US.js +1 -1
  69. package/lib/umd/locale/es-ES.js +1 -1
  70. package/lib/umd/locale/fa-IR.js +1 -1
  71. package/lib/umd/locale/fr-FR.js +1 -1
  72. package/lib/umd/locale/id-ID.js +1 -1
  73. package/lib/umd/locale/it-IT.js +1 -1
  74. package/lib/umd/locale/ja-JP.js +1 -1
  75. package/lib/umd/locale/ko-KR.js +1 -1
  76. package/lib/umd/locale/pl-PL.js +1 -1
  77. package/lib/umd/locale/pt-BR.js +1 -1
  78. package/lib/umd/locale/ru-RU.js +1 -1
  79. package/lib/umd/locale/sk-SK.js +1 -1
  80. package/lib/umd/locale/vi-VN.js +1 -1
  81. package/lib/umd/locale/zh-CN.js +1 -1
  82. package/lib/umd/locale/zh-HK.js +1 -1
  83. package/lib/umd/locale/zh-TW.js +1 -1
  84. package/package.json +15 -15
package/lib/cjs/index.js CHANGED
@@ -162,7 +162,8 @@ const defaultPluginConfig = {};
162
162
  * See the License for the specific language governing permissions and
163
163
  * limitations under the License.
164
164
  */
165
- const DROP_DOWN_DEFAULT_COLOR = "#ECECEC";
165
+ const DROP_DOWN_DEFAULT_COLOR = "gray.100";
166
+ const DROP_DOWN_ICON_COLOR = "gray.600";
166
167
 
167
168
  //#endregion
168
169
  //#region src/controllers/dv-reject-input.controller.ts
@@ -303,7 +304,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
303
304
  if (!(validator === null || validator === void 0 ? void 0 : validator.dropdownType)) return;
304
305
  let popupDisposable;
305
306
  const handleSave = async (date, targetPatternType) => {
306
- var _numfmt$parseDate, _cellStyle$n$pattern, _cellStyle$n;
307
+ var _numfmt$parseDate, _cellStyle$n;
307
308
  if (!date) return true;
308
309
  const newValue = date;
309
310
  const cellData = worksheet.getCell(row, col);
@@ -311,7 +312,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
311
312
  const serialNum = (_numfmt$parseDate = _univerjs_core.numfmt.parseDate(dateStr)) === null || _numfmt$parseDate === void 0 ? void 0 : _numfmt$parseDate.v;
312
313
  const serialTime = targetPatternType === "time" ? serialNum % 1 : serialNum;
313
314
  const cellStyle = workbook.getStyles().getStyleByCell(cellData);
314
- 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 : "";
315
+ const format = (cellStyle === null || cellStyle === void 0 || (_cellStyle$n = cellStyle.n) === null || _cellStyle$n === void 0 ? void 0 : _cellStyle$n.pattern) ?? "";
315
316
  if (rule.errorStyle !== _univerjs_core.DataValidationErrorStyle.STOP || await validator.validator({
316
317
  value: serialTime,
317
318
  unitId,
@@ -405,11 +406,10 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
405
406
  }
406
407
  case _univerjs_data_validation.DataValidatorDropdownType.LIST:
407
408
  case _univerjs_data_validation.DataValidatorDropdownType.MULTIPLE_LIST: {
408
- var _this$_configService$, _this$_configService$2, _this$_configService$3, _this$_configService$4;
409
+ var _this$_configService$, _this$_configService$2;
409
410
  const multiple = validator.dropdownType === _univerjs_data_validation.DataValidatorDropdownType.MULTIPLE_LIST;
410
411
  const handleSave = async (newValue) => {
411
- var _newValue$;
412
- const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
412
+ const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : newValue[0] ?? "";
413
413
  const params = {
414
414
  unitId,
415
415
  subUnitId,
@@ -451,19 +451,18 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
451
451
  options: list.map((item) => ({
452
452
  label: item.label,
453
453
  value: item.label,
454
- color: showColor || item.color ? item.color || "#ECECEC" : "transparent"
454
+ color: showColor || item.color ? item.color || "gray.100" : "transparent"
455
455
  })),
456
456
  onEdit: handleEdit,
457
457
  defaultValue: cellStr,
458
458
  multiple,
459
- 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,
460
- 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
459
+ showEdit: ((_this$_configService$ = this._configService.getConfig("sheets-data-validation-ui.config")) === null || _this$_configService$ === void 0 ? void 0 : _this$_configService$.showEditOnDropdown) ?? true,
460
+ 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
461
461
  }
462
462
  };
463
463
  break;
464
464
  }
465
465
  case _univerjs_data_validation.DataValidatorDropdownType.CASCADE: {
466
- var _rule$formula;
467
466
  const handleSave = (newValue) => {
468
467
  const params = {
469
468
  unitId,
@@ -495,7 +494,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
495
494
  props: {
496
495
  onChange: handleSave,
497
496
  defaultValue: (0, _univerjs_sheets_data_validation.getDataValidationCellValue)(worksheet.getCellRaw(row, col)).split("/"),
498
- options: JSON.parse((_rule$formula = rule.formula1) !== null && _rule$formula !== void 0 ? _rule$formula : "[]")
497
+ options: JSON.parse(rule.formula1 ?? "[]")
499
498
  },
500
499
  location
501
500
  };
@@ -777,7 +776,7 @@ function DropdownPresets({ onChange }) {
777
776
  children: presets.map((values) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
778
777
  type: "button",
779
778
  "aria-label": values.join(" / "),
780
- className: "univer-flex univer-min-h-20 univer-cursor-pointer univer-flex-col univer-items-start univer-gap-1.5 univer-rounded-md univer-border-0 univer-bg-gray-50 univer-p-3 univer-text-left univer-text-sm univer-leading-5 univer-text-gray-900 univer-transition-colors hover:univer-bg-gray-100 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 focus-visible:univer-ring-offset-0 dark:!univer-bg-gray-800 dark:!univer-text-white dark:hover:!univer-bg-gray-700",
779
+ className: "univer-flex univer-min-h-20 univer-cursor-pointer univer-flex-col univer-items-start univer-gap-1.5 univer-rounded-md univer-border-0 univer-bg-gray-50 univer-p-3 univer-text-left univer-text-sm univer-leading-5 univer-text-gray-900 univer-transition-colors hover:univer-bg-gray-100 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 focus-visible:univer-ring-offset-0 dark:!univer-bg-gray-800 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700",
781
780
  onClick: () => onChange((0, _univerjs_sheets.serializeListOptions)(values)),
782
781
  children: values.map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
783
782
  className: "univer-w-full univer-break-words",
@@ -992,19 +991,18 @@ const menuSchema = {
992
991
  //#endregion
993
992
  //#region package.json
994
993
  var name = "@univerjs/sheets-data-validation-ui";
995
- var version = "1.0.0-alpha.8";
994
+ var version = "1.0.0-beta.1";
996
995
 
997
996
  //#endregion
998
997
  //#region src/views/components/DataValidationOptions.tsx
999
998
  function DataValidationOptions(props) {
1000
- var _value$errorStyle;
1001
999
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1002
1000
  const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
1003
1001
  const { value, onChange, extraComponent } = props;
1004
1002
  const [show, setShow] = (0, react.useState)(false);
1005
1003
  const ExtraOptions = extraComponent ? componentManager.get(extraComponent) : null;
1006
1004
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1007
- className: "univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-white",
1005
+ className: "univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0",
1008
1006
  onClick: () => setShow(!show),
1009
1007
  children: [localeService.t("sheets-data-validation-ui.panel.options"), show ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreUpIcon, { className: "univer-ml-1" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "univer-ml-1" })]
1010
1008
  }), show && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
@@ -1015,7 +1013,7 @@ function DataValidationOptions(props) {
1015
1013
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1016
1014
  label: localeService.t("sheets-data-validation-ui.panel.invalid"),
1017
1015
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.RadioGroup, {
1018
- value: `${(_value$errorStyle = value.errorStyle) !== null && _value$errorStyle !== void 0 ? _value$errorStyle : _univerjs_core.DataValidationErrorStyle.WARNING}`,
1016
+ value: `${value.errorStyle ?? _univerjs_core.DataValidationErrorStyle.WARNING}`,
1019
1017
  onChange: (errorStyle) => onChange({
1020
1018
  ...value,
1021
1019
  errorStyle: +errorStyle
@@ -1075,7 +1073,7 @@ function DataValidationDetail() {
1075
1073
  } });
1076
1074
  }
1077
1075
  function DataValidationDetailInner(props) {
1078
- var _validators$sort, _localRule$allowBlank;
1076
+ var _validators$sort;
1079
1077
  const [key, setKey] = (0, react.useState)(0);
1080
1078
  const dataValidationPanelService = (0, _univerjs_ui.useDependency)(DataValidationPanelService);
1081
1079
  const { unitId, subUnitId, rule } = props.activeRuleInfo;
@@ -1087,10 +1085,7 @@ function DataValidationDetailInner(props) {
1087
1085
  const dataValidationModel = (0, _univerjs_ui.useDependency)(_univerjs_data_validation.DataValidationModel);
1088
1086
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1089
1087
  const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
1090
- const worksheet = (0, _univerjs_ui.useObservable)(() => {
1091
- var _workbook$activeSheet;
1092
- return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
1093
- }, void 0, void 0, []);
1088
+ const worksheet = (0, _univerjs_ui.useObservable)(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? (0, rxjs.of)(null), void 0, void 0, []);
1094
1089
  const [localRule, setLocalRule] = (0, react.useState)(rule);
1095
1090
  const validator = validatorService.getValidatorItem(localRule.type);
1096
1091
  const [showError, setShowError] = (0, react.useState)(false);
@@ -1338,14 +1333,11 @@ function DataValidationDetailInner(props) {
1338
1333
  ruleId
1339
1334
  }, key + localRule.type) : null,
1340
1335
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
1341
- checked: (_localRule$allowBlank = localRule.allowBlank) !== null && _localRule$allowBlank !== void 0 ? _localRule$allowBlank : true,
1342
- onChange: () => {
1343
- var _localRule$allowBlank2;
1344
- return handleUpdateRuleSetting({
1345
- ...baseRule,
1346
- allowBlank: !((_localRule$allowBlank2 = localRule.allowBlank) !== null && _localRule$allowBlank2 !== void 0 ? _localRule$allowBlank2 : true)
1347
- });
1348
- },
1336
+ checked: localRule.allowBlank ?? true,
1337
+ onChange: () => handleUpdateRuleSetting({
1338
+ ...baseRule,
1339
+ allowBlank: !(localRule.allowBlank ?? true)
1340
+ }),
1349
1341
  children: localeService.t("sheets-data-validation-ui.panel.allowBlank")
1350
1342
  }) }),
1351
1343
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationOptions, {
@@ -1382,10 +1374,9 @@ const DataValidationItem = (props) => {
1382
1374
  const [isHover, setIsHover] = (0, react.useState)(false);
1383
1375
  const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
1384
1376
  const style = (0, react.useMemo)(() => {
1385
- var _themeService$getColo;
1386
1377
  const defaultColor = themeService.getColorFromTheme("primary.600");
1387
1378
  const key = themeService.getColorFromTheme("loop-color.2");
1388
- const color = (_themeService$getColo = themeService.getColorFromTheme(key)) !== null && _themeService$getColo !== void 0 ? _themeService$getColo : defaultColor;
1379
+ const color = themeService.getColorFromTheme(key) ?? defaultColor;
1389
1380
  const rgb = new _univerjs_core.ColorKit(color).toRgb();
1390
1381
  return {
1391
1382
  fill: `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0.1)`,
@@ -1411,7 +1402,7 @@ const DataValidationItem = (props) => {
1411
1402
  };
1412
1403
  }, [markSelectionService]);
1413
1404
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1414
- className: (0, _univerjs_design.clsx)("univer-bg-secondary univer-relative univer--mx-2 univer-box-border univer-flex univer-w-[287px] univer-cursor-pointer univer-flex-col univer-justify-between univer-overflow-hidden univer-rounded-md univer-p-2 univer-pr-9", {
1405
+ className: (0, _univerjs_design.clsx)("univer-bg-secondary univer-relative univer--mx-2 univer-box-border univer-flex univer-w-[287px] univer-cursor-pointer univer-flex-col univer-justify-between univer-overflow-hidden univer-rounded-md univer-p-2 univer-pr-9 rtl:univer-pl-9 rtl:univer-pr-2", {
1415
1406
  "hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-700": !disable,
1416
1407
  "univer-opacity-50": disable
1417
1408
  }),
@@ -1435,7 +1426,7 @@ const DataValidationItem = (props) => {
1435
1426
  },
1436
1427
  children: [
1437
1428
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1438
- className: "univer-truncate univer-text-sm univer-font-medium univer-leading-[22px] univer-text-gray-900 dark:!univer-text-white",
1429
+ className: "univer-truncate univer-text-sm univer-font-medium univer-leading-[22px] univer-text-gray-900 dark:!univer-text-gray-0",
1439
1430
  children: validator === null || validator === void 0 ? void 0 : validator.generateRuleName(rule)
1440
1431
  }),
1441
1432
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -1443,7 +1434,7 @@ const DataValidationItem = (props) => {
1443
1434
  children: rule.ranges.map((range) => (0, _univerjs_engine_formula.serializeRange)(range)).join(",")
1444
1435
  }),
1445
1436
  isHover && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1446
- className: "univer-absolute univer-right-2 univer-top-[19px] univer-flex univer-size-5 univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-200 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700",
1437
+ className: "univer-absolute univer-right-2 univer-top-[19px] univer-flex univer-size-5 univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-200 rtl:univer-left-2 rtl:univer-right-auto dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700",
1447
1438
  onClick: handleDelete,
1448
1439
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteIcon, {})
1449
1440
  })
@@ -1506,23 +1497,20 @@ function DataValidationList(props) {
1506
1497
  const hasDisableRule = rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
1507
1498
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1508
1499
  className: "univer-pb-4",
1509
- children: [rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.map((rule) => {
1510
- var _rule$disable;
1511
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationItem, {
1512
- unitId,
1513
- subUnitId,
1514
- onClick: () => {
1515
- if (rule.disable) return;
1516
- dataValidationPanelService.setActiveRule({
1517
- unitId,
1518
- subUnitId,
1519
- rule
1520
- });
1521
- },
1522
- rule,
1523
- disable: (_rule$disable = rule.disable) !== null && _rule$disable !== void 0 ? _rule$disable : false
1524
- }, rule.uid);
1525
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1500
+ children: [rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.map((rule) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationItem, {
1501
+ unitId,
1502
+ subUnitId,
1503
+ onClick: () => {
1504
+ if (rule.disable) return;
1505
+ dataValidationPanelService.setActiveRule({
1506
+ unitId,
1507
+ subUnitId,
1508
+ rule
1509
+ });
1510
+ },
1511
+ rule,
1512
+ disable: rule.disable ?? false
1513
+ }, rule.uid)), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1526
1514
  className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2",
1527
1515
  children: [rules.length && !hasDisableRule ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1528
1516
  onClick: handleRemoveAll,
@@ -1543,10 +1531,7 @@ const DataValidationPanel = () => {
1543
1531
  const activeRule = (0, _univerjs_ui.useObservable)(dataValidationPanelService.activeRule$, dataValidationPanelService.activeRule);
1544
1532
  const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
1545
1533
  const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
1546
- const worksheet = (0, _univerjs_ui.useObservable)(() => {
1547
- var _workbook$activeSheet;
1548
- return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
1549
- }, void 0, void 0, []);
1534
+ const worksheet = (0, _univerjs_ui.useObservable)(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? (0, rxjs.of)(null), void 0, void 0, []);
1550
1535
  if (!workbook || !worksheet) return null;
1551
1536
  return activeRule && (activeRule.subUnitId === worksheet.getSheetId() || activeRule.subUnitId === dataValidationPanelService.getFocusFormulaEditorActiveRuleSubUnitId()) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationDetail, {}, activeRule.rule.uid) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationList, { workbook });
1552
1537
  };
@@ -1688,7 +1673,6 @@ function CheckboxFormulaInput(props) {
1688
1673
  //#endregion
1689
1674
  //#region src/views/components/formula-input/CustomFormulaInput.tsx
1690
1675
  function CustomFormulaInput(props) {
1691
- var _value$formula;
1692
1676
  const { unitId, subUnitId, value, onChange, showError, validResult } = props;
1693
1677
  const formula1Res = showError ? validResult === null || validResult === void 0 ? void 0 : validResult.formula1 : void 0;
1694
1678
  const formulaEditorRef = (0, react.useRef)(null);
@@ -1701,14 +1685,14 @@ function CustomFormulaInput(props) {
1701
1685
  error: formula1Res,
1702
1686
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.FormulaEditor, {
1703
1687
  ref: formulaEditorRef,
1704
- className: (0, _univerjs_design.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", _univerjs_design.borderClassName),
1705
- initValue: (_value$formula = value === null || value === void 0 ? void 0 : value.formula1) !== null && _value$formula !== void 0 ? _value$formula : "=",
1688
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", _univerjs_design.borderClassName),
1689
+ initValue: (value === null || value === void 0 ? void 0 : value.formula1) ?? "=",
1706
1690
  unitId,
1707
1691
  subUnitId,
1708
1692
  isFocus: isFocusFormulaEditor,
1709
1693
  isSupportAcrossSheet: true,
1710
1694
  onChange: (newValue) => {
1711
- const newFormula = (newValue !== null && newValue !== void 0 ? newValue : "").trim();
1695
+ const newFormula = (newValue ?? "").trim();
1712
1696
  if (newFormula === (value === null || value === void 0 ? void 0 : value.formula1)) return;
1713
1697
  onChange === null || onChange === void 0 || onChange({
1714
1698
  ...value,
@@ -1782,6 +1766,9 @@ const DEFAULT_COLOR_PRESET = [
1782
1766
  const ColorSelect = (props) => {
1783
1767
  const { value, onChange, disabled } = props;
1784
1768
  const [open, setOpen] = (0, react.useState)(false);
1769
+ const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
1770
+ (0, _univerjs_ui.useObservable)(themeService.currentTheme$);
1771
+ const backgroundColor = value.includes(".") && themeService.isValidThemeColor(value) ? themeService.getColorFromTheme(value) : value;
1785
1772
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
1786
1773
  align: "start",
1787
1774
  disabled,
@@ -1799,10 +1786,10 @@ const ColorSelect = (props) => {
1799
1786
  }, color))
1800
1787
  }),
1801
1788
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1802
- className: (0, _univerjs_design.clsx)("univer-box-border univer-inline-flex univer-h-8 univer-w-16 univer-cursor-pointer univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-white univer-px-2.5 univer-transition-colors univer-duration-200 hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white", _univerjs_design.borderClassName),
1789
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-inline-flex univer-h-8 univer-w-16 univer-cursor-pointer univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-gray-0 univer-px-2.5 univer-transition-colors univer-duration-200 hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", _univerjs_design.borderClassName),
1803
1790
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1804
1791
  className: "univer-box-border univer-size-4 univer-rounded univer-text-base",
1805
- style: { background: value }
1792
+ style: { background: backgroundColor }
1806
1793
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})]
1807
1794
  })
1808
1795
  });
@@ -1887,7 +1874,7 @@ function ListFormulaInput(props) {
1887
1874
  const strColors = formula2.split(",");
1888
1875
  return strOptions.map((label, i) => ({
1889
1876
  label,
1890
- color: strColors[i] || "#ECECEC",
1877
+ color: strColors[i] || "gray.100",
1891
1878
  isRef: false,
1892
1879
  id: (0, _univerjs_core.generateRandomId)(4)
1893
1880
  }));
@@ -1908,7 +1895,7 @@ function ListFormulaInput(props) {
1908
1895
  };
1909
1896
  const refFinalList = (0, react.useMemo)(() => refOptions.map((label, i) => ({
1910
1897
  label,
1911
- color: refColors[i] || "#ECECEC",
1898
+ color: refColors[i] || "gray.100",
1912
1899
  id: `${i}`,
1913
1900
  isRef: true
1914
1901
  })), [refColors, refOptions]);
@@ -1998,7 +1985,7 @@ function ListFormulaInput(props) {
1998
1985
  error: formula1Res || localError || void 0,
1999
1986
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.FormulaEditor, {
2000
1987
  ref: formulaEditorRef,
2001
- className: (0, _univerjs_design.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", _univerjs_design.borderClassName),
1988
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", _univerjs_design.borderClassName),
2002
1989
  initValue: formulaStr,
2003
1990
  unitId,
2004
1991
  subUnitId,
@@ -2006,7 +1993,7 @@ function ListFormulaInput(props) {
2006
1993
  isSupportAcrossSheet: true,
2007
1994
  onFocus: () => setIsFocusFormulaEditor(true),
2008
1995
  onChange: (v = "") => {
2009
- const str = (v !== null && v !== void 0 ? v : "").trim();
1996
+ const str = (v ?? "").trim();
2010
1997
  setFormulaStrCopy(str);
2011
1998
  updateFormula(str);
2012
1999
  }
@@ -2057,13 +2044,12 @@ const FORMULA_INPUTS = [
2057
2044
  //#region src/views/components/ListRenderModeInput.tsx
2058
2045
  const LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
2059
2046
  function ListRenderModeInput(props) {
2060
- var _value$renderMode;
2061
2047
  const { value, onChange } = props;
2062
2048
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
2063
2049
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
2064
2050
  label: localeService.t("sheets-data-validation-ui.renderMode.label"),
2065
2051
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.RadioGroup, {
2066
- value: `${(_value$renderMode = value.renderMode) !== null && _value$renderMode !== void 0 ? _value$renderMode : _univerjs_core.DataValidationRenderMode.CUSTOM}`,
2052
+ value: `${value.renderMode ?? _univerjs_core.DataValidationRenderMode.CUSTOM}`,
2067
2053
  onChange: (renderMode) => onChange({
2068
2054
  ...value,
2069
2055
  renderMode: +renderMode
@@ -2222,52 +2208,36 @@ let DataValidationAutoFillController = class DataValidationAutoFillController ex
2222
2208
  const ruleMatrixCopy = this._sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone();
2223
2209
  const virtualRange = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([sourceRange, targetRange]);
2224
2210
  const [vSourceRange, vTargetRange] = virtualRange.ranges;
2225
- const { mapFunc } = virtualRange;
2226
- const sourceStartCell = {
2227
- row: vSourceRange.startRow,
2228
- col: vSourceRange.startColumn
2229
- };
2211
+ const { mapRange, projectRange } = virtualRange;
2230
2212
  const repeats = _univerjs_sheets.AutoFillTools.getAutoFillRepeatRange(vSourceRange, vTargetRange);
2231
- const additionMatrix = new _univerjs_core.ObjectMatrix();
2232
- const additionRules = /* @__PURE__ */ new Set();
2233
- repeats.forEach((repeat) => {
2234
- const targetStartCell = repeat.repeatStartCell;
2235
- const relativeRange = repeat.relativeRange;
2236
- const sourceRange = {
2237
- startRow: sourceStartCell.row,
2238
- startColumn: sourceStartCell.col,
2239
- endColumn: sourceStartCell.col,
2240
- endRow: sourceStartCell.row
2241
- };
2242
- const targetRange = {
2243
- startRow: targetStartCell.row,
2244
- startColumn: targetStartCell.col,
2245
- endColumn: targetStartCell.col,
2246
- endRow: targetStartCell.row
2247
- };
2248
- _univerjs_core.Range.foreach(relativeRange, (row, col) => {
2249
- const sourcePositionRange = _univerjs_core.Rectangle.getPositionRange({
2250
- startRow: row,
2251
- startColumn: col,
2252
- endColumn: col,
2253
- endRow: row
2254
- }, sourceRange);
2255
- const { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn);
2256
- const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, sourceRow, sourceCol) || "";
2257
- const targetPositionRange = _univerjs_core.Rectangle.getPositionRange({
2258
- startRow: row,
2259
- startColumn: col,
2260
- endColumn: col,
2261
- endRow: row
2262
- }, targetRange);
2263
- const { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn);
2264
- additionMatrix.setValue(targetRow, targetCol, ruleId);
2265
- additionRules.add(ruleId);
2213
+ const additionsByRuleId = /* @__PURE__ */ new Map();
2214
+ additionsByRuleId.set("", repeats.flatMap((repeat) => mapRange(_univerjs_core.Rectangle.getPositionRange(repeat.relativeRange, {
2215
+ startRow: repeat.repeatStartCell.row,
2216
+ endRow: repeat.repeatStartCell.row,
2217
+ startColumn: repeat.repeatStartCell.col,
2218
+ endColumn: repeat.repeatStartCell.col
2219
+ }))));
2220
+ this._sheetDataValidationModel.getRules(unitId, subUnitId).forEach((rule) => {
2221
+ const relativeSourceRanges = rule.ranges.flatMap((range) => {
2222
+ const projected = projectRange(range);
2223
+ const intersected = projected && (0, _univerjs_core.getIntersectRange)(projected, vSourceRange);
2224
+ return intersected ? [_univerjs_core.Rectangle.getRelativeRange(intersected, vSourceRange)] : [];
2266
2225
  });
2226
+ const targetRanges = repeats.flatMap((repeat) => relativeSourceRanges.flatMap((sourceRange) => {
2227
+ const copiedRange = (0, _univerjs_core.getIntersectRange)(sourceRange, repeat.relativeRange);
2228
+ if (!copiedRange) return [];
2229
+ return mapRange(_univerjs_core.Rectangle.getPositionRange(copiedRange, {
2230
+ startRow: repeat.repeatStartCell.row,
2231
+ endRow: repeat.repeatStartCell.row,
2232
+ startColumn: repeat.repeatStartCell.col,
2233
+ endColumn: repeat.repeatStartCell.col
2234
+ }));
2235
+ }));
2236
+ if (targetRanges.length) additionsByRuleId.set(rule.uid, targetRanges);
2267
2237
  });
2268
- const additions = Array.from(additionRules).map((id) => ({
2238
+ const additions = Array.from(additionsByRuleId, ([id, ranges]) => ({
2269
2239
  id,
2270
- ranges: (0, _univerjs_core.queryObjectMatrix)(additionMatrix, (value) => value === id)
2240
+ ranges: ranges.length > 1 ? _univerjs_core.Rectangle.mergeRanges(ranges) : ranges
2271
2241
  }));
2272
2242
  ruleMatrixCopy.addRangeRules(additions);
2273
2243
  const { redoMutations, undoMutations } = (0, _univerjs_sheets_data_validation.getDataValidationDiffMutations)(unitId, subUnitId, ruleMatrixCopy.diff(this._sheetDataValidationModel.getRules(unitId, subUnitId)), this._injector, "patched", applyType === _univerjs_sheets.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT);
@@ -2280,13 +2250,8 @@ let DataValidationAutoFillController = class DataValidationAutoFillController ex
2280
2250
  id: _univerjs_sheets_data_validation.DATA_VALIDATION_PLUGIN_NAME,
2281
2251
  onBeforeFillData: (location) => {
2282
2252
  const { source: sourceRange, unitId, subUnitId } = location;
2283
- for (const row of sourceRange.rows) for (const col of sourceRange.cols) {
2284
- const dv = this._sheetDataValidationModel.getRuleByLocation(unitId, subUnitId, row, col);
2285
- if (dv && dv.type === _univerjs_core.DataValidationType.CHECKBOX) {
2286
- this._autoFillService.setDisableApplyType(_univerjs_sheets.AUTO_FILL_APPLY_TYPE.SERIES, true);
2287
- return;
2288
- }
2289
- }
2253
+ const { projectRange } = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([sourceRange]);
2254
+ if (this._sheetDataValidationModel.getRules(unitId, subUnitId).some((rule) => rule.type === _univerjs_core.DataValidationType.CHECKBOX && rule.ranges.some((range) => projectRange(range) !== null))) this._autoFillService.setDisableApplyType(_univerjs_sheets.AUTO_FILL_APPLY_TYPE.SERIES, true);
2290
2255
  },
2291
2256
  onFillData: (location, direction, applyType) => {
2292
2257
  if (applyType === _univerjs_sheets.AUTO_FILL_APPLY_TYPE.COPY || applyType === _univerjs_sheets.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT || applyType === _univerjs_sheets.AUTO_FILL_APPLY_TYPE.SERIES) return generalApplyFunc(location, applyType);
@@ -2335,25 +2300,31 @@ let DataValidationCopyPasteController = class DataValidationCopyPasteController
2335
2300
  });
2336
2301
  }
2337
2302
  _collect(unitId, subUnitId, range) {
2338
- const matrix = new _univerjs_core.ObjectMatrix();
2303
+ const rules = /* @__PURE__ */ new Map();
2339
2304
  this._copyInfo = {
2340
2305
  unitId,
2341
2306
  subUnitId,
2342
- matrix
2307
+ rules
2343
2308
  };
2344
2309
  const discreteRange = this._injector.invoke((accessor) => {
2345
2310
  return (0, _univerjs_sheets.rangeToDiscreteRange)(range, accessor, unitId, subUnitId);
2346
2311
  });
2347
2312
  if (!discreteRange) return;
2348
- const { rows, cols } = discreteRange;
2349
- rows.forEach((row, rowIndex) => {
2350
- cols.forEach((col, colIndex) => {
2351
- const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
2352
- matrix.setValue(rowIndex, colIndex, ruleId !== null && ruleId !== void 0 ? ruleId : "");
2313
+ const { projectRange } = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([discreteRange]);
2314
+ this._sheetDataValidationModel.getRules(unitId, subUnitId).forEach((rule) => {
2315
+ const projectedRanges = rule.ranges.flatMap((ruleRange) => {
2316
+ const projected = projectRange(ruleRange);
2317
+ return projected ? [projected] : [];
2353
2318
  });
2319
+ if (projectedRanges.length) rules.set(rule.uid, projectedRanges.length > 1 ? _univerjs_core.Rectangle.mergeRanges(projectedRanges) : projectedRanges);
2354
2320
  });
2355
2321
  }
2356
2322
  _generateMutations(pasteFrom, pasteTo, payload) {
2323
+ const copyInfo = this._copyInfo;
2324
+ if (!copyInfo) return {
2325
+ redos: [],
2326
+ undos: []
2327
+ };
2357
2328
  const { unitId: copyUnitId, subUnitId: copySubUnitId, range: copyRange } = pasteFrom;
2358
2329
  const { unitId: pastedUnitId, subUnitId: pastedSubUnitId, range: pastedRange } = pasteTo;
2359
2330
  const { copyType = _univerjs_sheets_ui.COPY_TYPE.COPY } = payload;
@@ -2371,51 +2342,38 @@ let DataValidationCopyPasteController = class DataValidationCopyPasteController
2371
2342
  undos: []
2372
2343
  };
2373
2344
  }
2345
+ const sourceVirtualRange = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([copyRange]).ranges[0];
2346
+ const targetVirtualization = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([pastedRange]);
2347
+ const targetVirtualRange = targetVirtualization.ranges[0];
2348
+ const repeatRange = (0, _univerjs_sheets_ui.getRepeatRange)(sourceVirtualRange, targetVirtualRange, true);
2349
+ const clearTargetRanges = targetVirtualization.mapRange(targetVirtualRange);
2350
+ const getTargetRanges = (sourceRanges) => repeatRange.flatMap(({ startRange }) => sourceRanges.flatMap((sourceRange) => targetVirtualization.mapRange(_univerjs_core.Rectangle.getPositionRange(sourceRange, startRange))));
2374
2351
  if (pastedUnitId !== copyUnitId || pastedSubUnitId !== copySubUnitId) {
2375
2352
  const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(pastedUnitId, pastedSubUnitId).clone();
2376
- const additionMatrix = new _univerjs_core.ObjectMatrix();
2377
- const addRules = /* @__PURE__ */ new Set();
2378
- const { ranges: [vCopyRange, vPastedRange], mapFunc } = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([copyRange, pastedRange]);
2379
- const repeatRange = (0, _univerjs_sheets_ui.getRepeatRange)(vCopyRange, vPastedRange, true);
2380
2353
  const additionRules = /* @__PURE__ */ new Map();
2381
- repeatRange.forEach(({ startRange }) => {
2382
- var _this$_copyInfo;
2383
- (_this$_copyInfo = this._copyInfo) === null || _this$_copyInfo === void 0 || _this$_copyInfo.matrix.forValue((row, col, ruleId) => {
2384
- const range = _univerjs_core.Rectangle.getPositionRange({
2385
- startRow: row,
2386
- endRow: row,
2387
- startColumn: col,
2388
- endColumn: col
2389
- }, startRange);
2390
- const transformedRuleId = `${copySubUnitId}-${ruleId}`;
2391
- const oldRule = this._sheetDataValidationModel.getRuleById(copyUnitId, copySubUnitId, ruleId);
2392
- if (!this._sheetDataValidationModel.getRuleById(pastedUnitId, pastedSubUnitId, transformedRuleId) && oldRule) additionRules.set(transformedRuleId, {
2393
- ...oldRule,
2394
- uid: transformedRuleId
2395
- });
2396
- const { row: startRow, col: startColumn } = mapFunc(range.startRow, range.startColumn);
2397
- addRules.add(transformedRuleId);
2398
- additionMatrix.setValue(startRow, startColumn, transformedRuleId);
2354
+ const additions = [{
2355
+ id: "",
2356
+ ranges: clearTargetRanges
2357
+ }];
2358
+ copyInfo.rules.forEach((ranges, ruleId) => {
2359
+ const transformedRuleId = `${copySubUnitId}-${ruleId}`;
2360
+ const oldRule = this._sheetDataValidationModel.getRuleById(copyUnitId, copySubUnitId, ruleId);
2361
+ if (!this._sheetDataValidationModel.getRuleById(pastedUnitId, pastedSubUnitId, transformedRuleId) && oldRule) additionRules.set(transformedRuleId, {
2362
+ ...oldRule,
2363
+ uid: transformedRuleId
2364
+ });
2365
+ additions.push({
2366
+ id: transformedRuleId,
2367
+ ranges: getTargetRanges(ranges)
2399
2368
  });
2400
2369
  });
2401
- const additions = Array.from(addRules).map((id) => ({
2402
- id,
2403
- ranges: (0, _univerjs_core.queryObjectMatrix)(additionMatrix, (value) => value === id)
2404
- }));
2405
2370
  ruleMatrix.addRangeRules(additions);
2406
2371
  const { redoMutations, undoMutations } = (0, _univerjs_sheets_data_validation.getDataValidationDiffMutations)(pastedUnitId, pastedSubUnitId, ruleMatrix.diffWithAddition(this._sheetDataValidationModel.getRules(pastedUnitId, pastedSubUnitId), additionRules.values()), this._injector, "patched", false);
2407
2372
  if (copyType === _univerjs_sheets_ui.COPY_TYPE.CUT) {
2408
2373
  const copySheetRuleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(copyUnitId, copySubUnitId).clone();
2409
- const deleteRangeStartCell = mapFunc(vCopyRange.startRow, vCopyRange.startColumn);
2410
- const deleteRangeEndCell = mapFunc(vCopyRange.endRow, vCopyRange.endColumn);
2411
2374
  copySheetRuleMatrix.addRangeRules([{
2412
2375
  id: "",
2413
- ranges: [{
2414
- startRow: deleteRangeStartCell.row,
2415
- endRow: deleteRangeEndCell.row,
2416
- startColumn: deleteRangeStartCell.col,
2417
- endColumn: deleteRangeEndCell.col
2418
- }]
2376
+ ranges: (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([copyRange]).mapRange(sourceVirtualRange)
2419
2377
  }]);
2420
2378
  const { redoMutations: cutRedos, undoMutations: cutUndos } = (0, _univerjs_sheets_data_validation.getDataValidationDiffMutations)(copyUnitId, copySubUnitId, copySheetRuleMatrix.diff(this._sheetDataValidationModel.getRules(copyUnitId, copySubUnitId)), this._injector, "patched", false);
2421
2379
  redoMutations.push(...cutRedos);
@@ -2427,27 +2385,13 @@ let DataValidationCopyPasteController = class DataValidationCopyPasteController
2427
2385
  };
2428
2386
  } else {
2429
2387
  const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(copyUnitId, copySubUnitId).clone();
2430
- const additionMatrix = new _univerjs_core.ObjectMatrix();
2431
- const additionRules = /* @__PURE__ */ new Set();
2432
- const { ranges: [vCopyRange, vPastedRange], mapFunc } = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([copyRange, pastedRange]);
2433
- (0, _univerjs_sheets_ui.getRepeatRange)(vCopyRange, vPastedRange, true).forEach(({ startRange }) => {
2434
- var _this$_copyInfo2;
2435
- (_this$_copyInfo2 = this._copyInfo) === null || _this$_copyInfo2 === void 0 || _this$_copyInfo2.matrix.forValue((row, col, ruleId) => {
2436
- const range = _univerjs_core.Rectangle.getPositionRange({
2437
- startRow: row,
2438
- endRow: row,
2439
- startColumn: col,
2440
- endColumn: col
2441
- }, startRange);
2442
- const { row: startRow, col: startColumn } = mapFunc(range.startRow, range.startColumn);
2443
- additionMatrix.setValue(startRow, startColumn, ruleId);
2444
- additionRules.add(ruleId);
2445
- });
2446
- });
2447
- const additions = Array.from(additionRules).map((id) => ({
2388
+ const additions = [{
2389
+ id: "",
2390
+ ranges: clearTargetRanges
2391
+ }, ...Array.from(copyInfo.rules, ([id, ranges]) => ({
2448
2392
  id,
2449
- ranges: (0, _univerjs_core.queryObjectMatrix)(additionMatrix, (value) => value === id)
2450
- }));
2393
+ ranges: getTargetRanges(ranges)
2394
+ }))];
2451
2395
  ruleMatrix.addRangeRules(additions);
2452
2396
  const { redoMutations, undoMutations } = (0, _univerjs_sheets_data_validation.getDataValidationDiffMutations)(pastedUnitId, pastedSubUnitId, ruleMatrix.diff(this._sheetDataValidationModel.getRules(copyUnitId, copySubUnitId)), this._injector, "patched", false);
2453
2397
  return {
@@ -2571,32 +2515,30 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2571
2515
  effect: _univerjs_core.InterceptorEffectEnum.Style,
2572
2516
  priority: _univerjs_sheets.InterceptCellContentPriority.DATA_VALIDATION,
2573
2517
  handler: (cell, pos, next) => {
2574
- var _this$_dataValidation, _cell$customRender, _cell$fontRenderExten, _validator$skipDefaul, _cell$coverable;
2518
+ var _cell$fontRenderExten, _validator$skipDefaul;
2575
2519
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
2576
2520
  const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
2577
2521
  if (!ruleId) return next(cell);
2578
2522
  const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
2579
2523
  if (!rule) return next(cell);
2580
- const validStatus = (_this$_dataValidation = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) !== null && _this$_dataValidation !== void 0 ? _this$_dataValidation : _univerjs_core.DataValidationStatus.VALID;
2524
+ const validStatus = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? _univerjs_core.DataValidationStatus.VALID;
2581
2525
  const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
2582
2526
  const cellOrigin = pos.rawData;
2583
2527
  let cache;
2584
2528
  const cellValue = { get value() {
2585
- var _getCellValueOrigin;
2586
2529
  if (cache !== void 0) return cache;
2587
- cache = (_getCellValueOrigin = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(cellOrigin)) !== null && _getCellValueOrigin !== void 0 ? _getCellValueOrigin : null;
2530
+ cache = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(cellOrigin) ?? null;
2588
2531
  return cache;
2589
2532
  } };
2590
2533
  const valueStr = { get value() {
2591
- var _cellValue$value;
2592
- return `${(_cellValue$value = cellValue.value) !== null && _cellValue$value !== void 0 ? _cellValue$value : ""}`;
2534
+ return `${cellValue.value ?? ""}`;
2593
2535
  } };
2594
2536
  if (!cell || cell === pos.rawData) cell = { ...pos.rawData };
2595
2537
  cell.markers = {
2596
2538
  ...cell === null || cell === void 0 ? void 0 : cell.markers,
2597
2539
  ...validStatus === _univerjs_core.DataValidationStatus.INVALID ? INVALID_MARK : null
2598
2540
  };
2599
- 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] : []];
2541
+ cell.customRender = [...(cell === null || cell === void 0 ? void 0 : cell.customRender) ?? [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
2600
2542
  cell.fontRenderExtension = {
2601
2543
  ...cell === null || cell === void 0 ? void 0 : cell.fontRenderExtension,
2602
2544
  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))
@@ -2609,14 +2551,14 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2609
2551
  } }, row, col)
2610
2552
  };
2611
2553
  cell.interceptorAutoHeight = () => {
2612
- var _this$_renderManagerS, _mergeCell$startRow, _mergeCell$startColum, _validator$canvasRend, _validator$canvasRend2;
2554
+ var _this$_renderManagerS, _validator$canvasRend, _validator$canvasRend2;
2613
2555
  const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 || (_this$_renderManagerS = _this$_renderManagerS.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.skeleton;
2614
2556
  if (!skeleton) return;
2615
2557
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2616
2558
  const info = {
2617
2559
  data: cell,
2618
2560
  style: workbook.getStyles().getStyleByCell(cell),
2619
- 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),
2561
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2620
2562
  unitId,
2621
2563
  subUnitId,
2622
2564
  row,
@@ -2627,14 +2569,14 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2627
2569
  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);
2628
2570
  };
2629
2571
  cell.interceptorAutoWidth = () => {
2630
- var _this$_renderManagerS2, _mergeCell$startRow2, _mergeCell$startColum2, _validator$canvasRend3, _validator$canvasRend4;
2572
+ var _this$_renderManagerS2, _validator$canvasRend3, _validator$canvasRend4;
2631
2573
  const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 || (_this$_renderManagerS2 = _this$_renderManagerS2.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.skeleton;
2632
2574
  if (!skeleton) return;
2633
2575
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2634
2576
  const info = {
2635
2577
  data: cell,
2636
2578
  style: workbook.getStyles().getStyleByCell(cell),
2637
- 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),
2579
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2638
2580
  unitId,
2639
2581
  subUnitId,
2640
2582
  row,
@@ -2644,7 +2586,7 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
2644
2586
  };
2645
2587
  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);
2646
2588
  };
2647
- cell.coverable = ((_cell$coverable = cell === null || cell === void 0 ? void 0 : cell.coverable) !== null && _cell$coverable !== void 0 ? _cell$coverable : true) && !(rule.type === _univerjs_core.DataValidationType.LIST || rule.type === _univerjs_core.DataValidationType.LIST_MULTIPLE);
2589
+ cell.coverable = ((cell === null || cell === void 0 ? void 0 : cell.coverable) ?? true) && !(rule.type === _univerjs_core.DataValidationType.LIST || rule.type === _univerjs_core.DataValidationType.LIST_MULTIPLE);
2648
2590
  return next(cell);
2649
2591
  }
2650
2592
  }));
@@ -2694,22 +2636,22 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2694
2636
  effect: _univerjs_core.InterceptorEffectEnum.Style,
2695
2637
  priority: _univerjs_sheets.InterceptCellContentPriority.DATA_VALIDATION,
2696
2638
  handler: (cell, pos, next) => {
2697
- var _this$_dataValidation2, _cell$customRender2, _cell$fontRenderExten2, _validator$skipDefaul2, _cell$coverable2;
2639
+ var _cell$fontRenderExten2, _validator$skipDefaul2;
2698
2640
  const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
2699
2641
  const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
2700
2642
  if (!ruleId) return next(cell);
2701
2643
  const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
2702
2644
  if (!rule) return next(cell);
2703
- const validStatus = (_this$_dataValidation2 = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) !== null && _this$_dataValidation2 !== void 0 ? _this$_dataValidation2 : _univerjs_core.DataValidationStatus.VALID;
2645
+ const validStatus = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? _univerjs_core.DataValidationStatus.VALID;
2704
2646
  const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
2705
2647
  const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(worksheet.getCellRaw(row, col));
2706
- const valueStr = `${cellValue !== null && cellValue !== void 0 ? cellValue : ""}`;
2648
+ const valueStr = `${cellValue ?? ""}`;
2707
2649
  if (!cell || cell === pos.rawData) cell = { ...pos.rawData };
2708
2650
  cell.markers = {
2709
2651
  ...cell === null || cell === void 0 ? void 0 : cell.markers,
2710
2652
  ...validStatus === _univerjs_core.DataValidationStatus.INVALID ? INVALID_MARK : null
2711
2653
  };
2712
- 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] : []];
2654
+ cell.customRender = [...(cell === null || cell === void 0 ? void 0 : cell.customRender) ?? [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
2713
2655
  cell.fontRenderExtension = {
2714
2656
  ...cell === null || cell === void 0 ? void 0 : cell.fontRenderExtension,
2715
2657
  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))
@@ -2722,14 +2664,14 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2722
2664
  } }, row, col)
2723
2665
  };
2724
2666
  cell.interceptorAutoHeight = () => {
2725
- var _this$_renderManagerS3, _mergeCell$startRow3, _mergeCell$startColum3, _validator$canvasRend5, _validator$canvasRend6;
2667
+ var _this$_renderManagerS3, _validator$canvasRend5, _validator$canvasRend6;
2726
2668
  const skeleton = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 || (_this$_renderManagerS3 = _this$_renderManagerS3.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.skeleton;
2727
2669
  if (!skeleton) return;
2728
2670
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2729
2671
  const info = {
2730
2672
  data: cell,
2731
2673
  style: workbook.getStyles().getStyleByCell(cell),
2732
- 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),
2674
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2733
2675
  unitId,
2734
2676
  subUnitId,
2735
2677
  row,
@@ -2740,14 +2682,14 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2740
2682
  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);
2741
2683
  };
2742
2684
  cell.interceptorAutoWidth = () => {
2743
- var _this$_renderManagerS4, _mergeCell$startRow4, _mergeCell$startColum4, _validator$canvasRend7, _validator$canvasRend8;
2685
+ var _this$_renderManagerS4, _validator$canvasRend7, _validator$canvasRend8;
2744
2686
  const skeleton = (_this$_renderManagerS4 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS4 === void 0 || (_this$_renderManagerS4 = _this$_renderManagerS4.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS4 === void 0 ? void 0 : _this$_renderManagerS4.skeleton;
2745
2687
  if (!skeleton) return;
2746
2688
  const mergeCell = skeleton.worksheet.getMergedCell(row, col);
2747
2689
  const info = {
2748
2690
  data: cell,
2749
2691
  style: workbook.getStyles().getStyleByCell(cell),
2750
- 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),
2692
+ primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
2751
2693
  unitId,
2752
2694
  subUnitId,
2753
2695
  row,
@@ -2757,7 +2699,7 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
2757
2699
  };
2758
2700
  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);
2759
2701
  };
2760
- cell.coverable = ((_cell$coverable2 = cell === null || cell === void 0 ? void 0 : cell.coverable) !== null && _cell$coverable2 !== void 0 ? _cell$coverable2 : true) && !(rule.type === _univerjs_core.DataValidationType.LIST || rule.type === _univerjs_core.DataValidationType.LIST_MULTIPLE);
2702
+ cell.coverable = ((cell === null || cell === void 0 ? void 0 : cell.coverable) ?? true) && !(rule.type === _univerjs_core.DataValidationType.LIST || rule.type === _univerjs_core.DataValidationType.LIST_MULTIPLE);
2761
2703
  return next(cell);
2762
2704
  }
2763
2705
  }));
@@ -2819,11 +2761,10 @@ SheetsDataValidationReRenderController = __decorate([__decorateParam(1, (0, _uni
2819
2761
  const MARGIN_H$2 = 6;
2820
2762
  let CheckboxRender = class CheckboxRender {
2821
2763
  _calc(cellInfo, style) {
2822
- var _style$fs, _style$fs2, _style$fs3;
2823
2764
  const { vt, ht } = style || {};
2824
2765
  const width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2;
2825
2766
  const height = cellInfo.endY - cellInfo.startY;
2826
- const size = ((_style$fs = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs !== void 0 ? _style$fs : 10) * 1.6;
2767
+ const size = ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2827
2768
  let widgetLeft = 0;
2828
2769
  let widgetTop = 0;
2829
2770
  switch (vt) {
@@ -2851,8 +2792,8 @@ let CheckboxRender = class CheckboxRender {
2851
2792
  return {
2852
2793
  left: cellInfo.startX + widgetLeft,
2853
2794
  top: cellInfo.startY + widgetTop,
2854
- width: ((_style$fs2 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs2 !== void 0 ? _style$fs2 : 10) * 1.6,
2855
- height: ((_style$fs3 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs3 !== void 0 ? _style$fs3 : 10) * 1.6
2795
+ width: ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6,
2796
+ height: ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6
2856
2797
  };
2857
2798
  }
2858
2799
  constructor(_commandService, _univerInstanceService, _formulaService, _themeService, _renderManagerService, _dataValidationModel) {
@@ -2864,14 +2805,12 @@ let CheckboxRender = class CheckboxRender {
2864
2805
  this._dataValidationModel = _dataValidationModel;
2865
2806
  }
2866
2807
  calcCellAutoHeight(info) {
2867
- var _style$fs4;
2868
2808
  const { style } = info;
2869
- return ((_style$fs4 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs4 !== void 0 ? _style$fs4 : 10) * 1.6;
2809
+ return ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2870
2810
  }
2871
2811
  calcCellAutoWidth(info) {
2872
- var _style$fs5;
2873
2812
  const { style } = info;
2874
- return ((_style$fs5 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs5 !== void 0 ? _style$fs5 : 10) * 1.6;
2813
+ return ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2875
2814
  }
2876
2815
  async _parseFormula(rule, unitId, subUnitId) {
2877
2816
  var _results$, _results$2, _results$3;
@@ -2887,7 +2826,7 @@ let CheckboxRender = class CheckboxRender {
2887
2826
  };
2888
2827
  }
2889
2828
  drawWith(ctx, info) {
2890
- var _validator$skipDefaul, _style$fs6, _style$cl$rgb, _style$cl;
2829
+ var _validator$skipDefaul, _style$cl;
2891
2830
  const { style, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info;
2892
2831
  const cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
2893
2832
  const value = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(worksheet.getCellRaw(row, col));
@@ -2925,14 +2864,14 @@ let CheckboxRender = class CheckboxRender {
2925
2864
  ctx.clip();
2926
2865
  const m = transform.getMatrix();
2927
2866
  ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
2928
- const size = ((_style$fs6 = style === null || style === void 0 ? void 0 : style.fs) !== null && _style$fs6 !== void 0 ? _style$fs6 : 10) * 1.6;
2867
+ const size = ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
2929
2868
  const checked = String(value) === String(formula1);
2930
2869
  const defaultColor = this._themeService.getColorFromTheme("primary.600");
2931
2870
  _univerjs_engine_render.CheckboxShape.drawWith(ctx, {
2932
2871
  checked,
2933
2872
  width: size,
2934
2873
  height: size,
2935
- 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
2874
+ fill: (style === null || style === void 0 || (_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) ?? defaultColor
2936
2875
  });
2937
2876
  ctx.restore();
2938
2877
  }
@@ -3188,7 +3127,7 @@ var Dropdown = class extends _univerjs_engine_render.Shape {
3188
3127
  width: layout.width,
3189
3128
  height: layout.height,
3190
3129
  radius: RADIUS,
3191
- fill: fill || "#ECECEC"
3130
+ fill: fill || "gray.100"
3192
3131
  });
3193
3132
  ctx.translateWithPrecision(4, layout.ba);
3194
3133
  ctx.font = fontString;
@@ -3235,12 +3174,11 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3235
3174
  }
3236
3175
  ctx.save();
3237
3176
  ctx.translateWithPrecision(cellBounding.startX + left, cellBounding.startY + top);
3238
- ctx.fillStyle = "#565656";
3177
+ ctx.fillStyle = DROP_DOWN_ICON_COLOR;
3239
3178
  ctx.fill(downPath$1);
3240
3179
  ctx.restore();
3241
3180
  }
3242
3181
  drawWith(ctx, info, skeleton, spreadsheets) {
3243
- var _ref, _getCellValueOrigin;
3244
3182
  const { primaryWithCoord, row, col, style, data, subUnitId } = info;
3245
3183
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3246
3184
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
@@ -3261,11 +3199,11 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3261
3199
  const cellWidth = cellBounding.endX - cellBounding.startX;
3262
3200
  const cellHeight = cellBounding.endY - cellBounding.startY;
3263
3201
  const { cl } = style || {};
3264
- const color = (_ref = typeof cl === "object" ? cl === null || cl === void 0 ? void 0 : cl.rgb : cl) !== null && _ref !== void 0 ? _ref : "#000";
3265
- const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style !== null && style !== void 0 ? style : void 0);
3202
+ const color = (typeof cl === "object" ? cl === null || cl === void 0 ? void 0 : cl.rgb : cl) ?? "#000";
3203
+ const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0);
3266
3204
  const { vt: _vt, ht } = style || {};
3267
- const vt = _vt !== null && _vt !== void 0 ? _vt : _univerjs_core.VerticalAlign.MIDDLE;
3268
- const cellValue = (_getCellValueOrigin = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data)) !== null && _getCellValueOrigin !== void 0 ? _getCellValueOrigin : "";
3205
+ const vt = _vt ?? _univerjs_core.VerticalAlign.MIDDLE;
3206
+ const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
3269
3207
  const items = validator.parseCellValue(cellValue);
3270
3208
  const labelColorMap = validator.getListWithColorMap(rule);
3271
3209
  const layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
@@ -3323,7 +3261,6 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3323
3261
  });
3324
3262
  }
3325
3263
  calcCellAutoHeight(info) {
3326
- var _getCellValueOrigin2;
3327
3264
  const { primaryWithCoord, style, data, row, col } = info;
3328
3265
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
3329
3266
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
@@ -3339,11 +3276,10 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3339
3276
  if (!validator) return;
3340
3277
  const cellWidth = cellBounding.endX - cellBounding.startX;
3341
3278
  const cellHeight = cellBounding.endY - cellBounding.startY;
3342
- const cellValue = (_getCellValueOrigin2 = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data)) !== null && _getCellValueOrigin2 !== void 0 ? _getCellValueOrigin2 : "";
3343
- return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style !== null && style !== void 0 ? style : void 0), cellWidth, cellHeight).cellAutoHeight;
3279
+ const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
3280
+ return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0), cellWidth, cellHeight).cellAutoHeight;
3344
3281
  }
3345
3282
  calcCellAutoWidth(info) {
3346
- var _getCellValueOrigin3;
3347
3283
  const { primaryWithCoord, style, data, row, col } = info;
3348
3284
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
3349
3285
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
@@ -3359,8 +3295,8 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
3359
3295
  if (!validator) return;
3360
3296
  const cellWidth = cellBounding.endX - cellBounding.startX;
3361
3297
  const cellHeight = cellBounding.endY - cellBounding.startY;
3362
- const cellValue = (_getCellValueOrigin3 = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data)) !== null && _getCellValueOrigin3 !== void 0 ? _getCellValueOrigin3 : "";
3363
- return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style !== null && style !== void 0 ? style : void 0), cellWidth, cellHeight).calcAutoWidth;
3298
+ const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
3299
+ return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0), cellWidth, cellHeight).calcAutoWidth;
3364
3300
  }
3365
3301
  isHit(position, info) {
3366
3302
  const { primaryWithCoord } = info;
@@ -3437,7 +3373,6 @@ const PADDING_V = 1;
3437
3373
  const MARGIN_H = 6;
3438
3374
  const MARGIN_V = 3;
3439
3375
  const RADIUS_BG = 8;
3440
- const DROP_DOWN_ICON_COLOR = "#565656";
3441
3376
  const downPath = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
3442
3377
  function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margin = true) {
3443
3378
  let paddingTop = 0;
@@ -3508,12 +3443,11 @@ let DropdownWidget = class DropdownWidget {
3508
3443
  }
3509
3444
  ctx.save();
3510
3445
  ctx.translateWithPrecision(cellBounding.startX + left, cellBounding.startY + top);
3511
- ctx.fillStyle = "#565656";
3446
+ ctx.fillStyle = DROP_DOWN_ICON_COLOR;
3512
3447
  ctx.fill(downPath);
3513
3448
  ctx.restore();
3514
3449
  }
3515
3450
  drawWith(ctx, info, skeleton) {
3516
- var _tb, _vt, _ht, _pd;
3517
3451
  const { primaryWithCoord, row, col, style, data, subUnitId } = info;
3518
3452
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3519
3453
  const _row = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo.startRow : row;
@@ -3536,14 +3470,13 @@ let DropdownWidget = class DropdownWidget {
3536
3470
  const map = this._ensureMap(subUnitId);
3537
3471
  const key = this._generateKey(row, col);
3538
3472
  const colorMap = validator.getListWithColorMap(rule);
3539
- const value = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data);
3540
- const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
3473
+ const valueStr = `${(0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? ""}`;
3541
3474
  const activeColor = colorMap[valueStr];
3542
3475
  let { tb, vt, ht, pd } = style || {};
3543
- tb = (_tb = tb) !== null && _tb !== void 0 ? _tb : _univerjs_core.WrapStrategy.WRAP;
3544
- vt = (_vt = vt) !== null && _vt !== void 0 ? _vt : _univerjs_core.VerticalAlign.BOTTOM;
3545
- ht = (_ht = ht) !== null && _ht !== void 0 ? _ht : _univerjs_core.DEFAULT_STYLES.ht;
3546
- pd = (_pd = pd) !== null && _pd !== void 0 ? _pd : _univerjs_core.DEFAULT_STYLES.pd;
3476
+ tb = tb ?? _univerjs_core.WrapStrategy.WRAP;
3477
+ vt = vt ?? _univerjs_core.VerticalAlign.BOTTOM;
3478
+ ht = ht ?? _univerjs_core.DEFAULT_STYLES.ht;
3479
+ pd = pd ?? _univerjs_core.DEFAULT_STYLES.pd;
3547
3480
  const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style).fontCache;
3548
3481
  if (rule.renderMode === _univerjs_core.DataValidationRenderMode.ARROW) {
3549
3482
  var _style$cl, _style$st, _style$ul;
@@ -3604,7 +3537,7 @@ let DropdownWidget = class DropdownWidget {
3604
3537
  _univerjs_engine_render.Rect.drawWith(ctx, {
3605
3538
  width: rectWidth,
3606
3539
  height: rectHeight,
3607
- fill: activeColor || "#ECECEC",
3540
+ fill: activeColor || "gray.100",
3608
3541
  radius: RADIUS_BG
3609
3542
  });
3610
3543
  ctx.save();
@@ -3637,7 +3570,6 @@ let DropdownWidget = class DropdownWidget {
3637
3570
  }
3638
3571
  }
3639
3572
  calcCellAutoHeight(info) {
3640
- var _tb2;
3641
3573
  const { primaryWithCoord, style, data, row, col } = info;
3642
3574
  const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3643
3575
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
@@ -3651,13 +3583,12 @@ let DropdownWidget = class DropdownWidget {
3651
3583
  endY: _cellBounding.endY - downOffset
3652
3584
  };
3653
3585
  const cellWidth = cellBounding.endX - cellBounding.startX;
3654
- const value = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data);
3655
- const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
3586
+ const valueStr = `${(0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? ""}`;
3656
3587
  let { tb, pd } = style || {};
3657
- const { t = _univerjs_core.DEFAULT_STYLES.pd.t, b = _univerjs_core.DEFAULT_STYLES.pd.b } = pd !== null && pd !== void 0 ? pd : {};
3658
- tb = (_tb2 = tb) !== null && _tb2 !== void 0 ? _tb2 : _univerjs_core.WrapStrategy.WRAP;
3588
+ const { t = _univerjs_core.DEFAULT_STYLES.pd.t, b = _univerjs_core.DEFAULT_STYLES.pd.b } = pd ?? {};
3589
+ tb = tb ?? _univerjs_core.WrapStrategy.WRAP;
3659
3590
  if (rule.renderMode === _univerjs_core.DataValidationRenderMode.ARROW) {
3660
- const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd !== null && pd !== void 0 ? pd : {};
3591
+ const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd ?? {};
3661
3592
  const realWidth = cellWidth - l - r - ICON_PLACE - 4;
3662
3593
  const skeleton = new _univerjs_engine_render.DocSimpleSkeleton(valueStr, (0, _univerjs_engine_render.getFontStyleString)(style).fontCache, Boolean(tb === _univerjs_core.WrapStrategy.WRAP), realWidth, Infinity);
3663
3594
  skeleton.calculate();
@@ -3670,7 +3601,6 @@ let DropdownWidget = class DropdownWidget {
3670
3601
  }
3671
3602
  }
3672
3603
  calcCellAutoWidth(info) {
3673
- var _tb3;
3674
3604
  const { primaryWithCoord, style, data, row, col } = info;
3675
3605
  const cellRange = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
3676
3606
  const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
@@ -3684,11 +3614,10 @@ let DropdownWidget = class DropdownWidget {
3684
3614
  endY: cellRange.endY - downOffset
3685
3615
  };
3686
3616
  const cellWidth = cellBounding.endX - cellBounding.startX;
3687
- const value = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data);
3688
- const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
3617
+ const valueStr = `${(0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? ""}`;
3689
3618
  let { tb, pd } = style || {};
3690
- const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd !== null && pd !== void 0 ? pd : {};
3691
- tb = (_tb3 = tb) !== null && _tb3 !== void 0 ? _tb3 : _univerjs_core.WrapStrategy.WRAP;
3619
+ const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd ?? {};
3620
+ tb = tb ?? _univerjs_core.WrapStrategy.WRAP;
3692
3621
  let paddingAll = 26;
3693
3622
  switch (rule.renderMode) {
3694
3623
  case _univerjs_core.DataValidationRenderMode.ARROW:
@@ -3967,7 +3896,7 @@ _defineProperty(UniverSheetsDataValidationUIPlugin, "packageName", name);
3967
3896
  _defineProperty(UniverSheetsDataValidationUIPlugin, "version", version);
3968
3897
  _defineProperty(UniverSheetsDataValidationUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
3969
3898
  UniverSheetsDataValidationUIPlugin = __decorate([
3970
- (0, _univerjs_core.DependentOn)(_univerjs_data_validation.UniverDataValidationPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverUIPlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin, _univerjs_sheets_data_validation.UniverSheetsDataValidationPlugin),
3899
+ (0, _univerjs_core.DependentOn)(_univerjs_data_validation.UniverDataValidationPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin, _univerjs_sheets_data_validation.UniverSheetsDataValidationPlugin),
3971
3900
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
3972
3901
  __decorateParam(2, _univerjs_core.ICommandService),
3973
3902
  __decorateParam(3, _univerjs_core.IConfigService)