@univerjs/sheets-data-validation-ui 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/lib/cjs/index.js +116 -112
  2. package/lib/cjs/locale/ar-SA.js +94 -0
  3. package/lib/cjs/locale/ca-ES.js +6 -86
  4. package/lib/cjs/locale/de-DE.js +94 -0
  5. package/lib/cjs/locale/en-US.js +6 -86
  6. package/lib/cjs/locale/es-ES.js +6 -86
  7. package/lib/cjs/locale/fa-IR.js +6 -86
  8. package/lib/cjs/locale/fr-FR.js +6 -86
  9. package/lib/cjs/locale/id-ID.js +94 -0
  10. package/lib/cjs/locale/it-IT.js +94 -0
  11. package/lib/cjs/locale/ja-JP.js +6 -86
  12. package/lib/cjs/locale/ko-KR.js +6 -86
  13. package/lib/cjs/locale/pl-PL.js +94 -0
  14. package/lib/cjs/locale/pt-BR.js +94 -0
  15. package/lib/cjs/locale/ru-RU.js +6 -86
  16. package/lib/cjs/locale/sk-SK.js +6 -86
  17. package/lib/cjs/locale/vi-VN.js +6 -86
  18. package/lib/cjs/locale/zh-CN.js +6 -86
  19. package/lib/cjs/locale/zh-HK.js +94 -0
  20. package/lib/cjs/locale/zh-TW.js +6 -86
  21. package/lib/es/index.js +117 -113
  22. package/lib/es/locale/ar-SA.js +93 -0
  23. package/lib/es/locale/ca-ES.js +6 -86
  24. package/lib/es/locale/de-DE.js +93 -0
  25. package/lib/es/locale/en-US.js +6 -86
  26. package/lib/es/locale/es-ES.js +6 -86
  27. package/lib/es/locale/fa-IR.js +6 -86
  28. package/lib/es/locale/fr-FR.js +6 -86
  29. package/lib/es/locale/id-ID.js +93 -0
  30. package/lib/es/locale/it-IT.js +93 -0
  31. package/lib/es/locale/ja-JP.js +6 -86
  32. package/lib/es/locale/ko-KR.js +6 -86
  33. package/lib/es/locale/pl-PL.js +93 -0
  34. package/lib/es/locale/pt-BR.js +93 -0
  35. package/lib/es/locale/ru-RU.js +6 -86
  36. package/lib/es/locale/sk-SK.js +6 -86
  37. package/lib/es/locale/vi-VN.js +6 -86
  38. package/lib/es/locale/zh-CN.js +6 -86
  39. package/lib/es/locale/zh-HK.js +93 -0
  40. package/lib/es/locale/zh-TW.js +6 -86
  41. package/lib/index.css +0 -4
  42. package/lib/index.js +117 -113
  43. package/lib/locale/ar-SA.js +93 -0
  44. package/lib/locale/ca-ES.js +6 -86
  45. package/lib/locale/de-DE.js +93 -0
  46. package/lib/locale/en-US.js +6 -86
  47. package/lib/locale/es-ES.js +6 -86
  48. package/lib/locale/fa-IR.js +6 -86
  49. package/lib/locale/fr-FR.js +6 -86
  50. package/lib/locale/id-ID.js +93 -0
  51. package/lib/locale/it-IT.js +93 -0
  52. package/lib/locale/ja-JP.js +6 -86
  53. package/lib/locale/ko-KR.js +6 -86
  54. package/lib/locale/pl-PL.js +93 -0
  55. package/lib/locale/pt-BR.js +93 -0
  56. package/lib/locale/ru-RU.js +6 -86
  57. package/lib/locale/sk-SK.js +6 -86
  58. package/lib/locale/vi-VN.js +6 -86
  59. package/lib/locale/zh-CN.js +6 -86
  60. package/lib/locale/zh-HK.js +93 -0
  61. package/lib/locale/zh-TW.js +6 -86
  62. package/lib/types/locale/ar-SA.d.ts +18 -0
  63. package/lib/types/locale/de-DE.d.ts +18 -0
  64. package/lib/types/locale/en-US.d.ts +6 -78
  65. package/lib/types/locale/id-ID.d.ts +18 -0
  66. package/lib/types/locale/it-IT.d.ts +18 -0
  67. package/lib/types/locale/pl-PL.d.ts +18 -0
  68. package/lib/types/locale/pt-BR.d.ts +18 -0
  69. package/lib/types/locale/zh-HK.d.ts +18 -0
  70. package/lib/types/views/components/formula-input/utils.d.ts +24 -0
  71. package/lib/umd/index.js +1 -1
  72. package/lib/umd/locale/ar-SA.js +1 -0
  73. package/lib/umd/locale/ca-ES.js +1 -1
  74. package/lib/umd/locale/de-DE.js +1 -0
  75. package/lib/umd/locale/en-US.js +1 -1
  76. package/lib/umd/locale/es-ES.js +1 -1
  77. package/lib/umd/locale/fa-IR.js +1 -1
  78. package/lib/umd/locale/fr-FR.js +1 -1
  79. package/lib/umd/locale/id-ID.js +1 -0
  80. package/lib/umd/locale/it-IT.js +1 -0
  81. package/lib/umd/locale/ja-JP.js +1 -1
  82. package/lib/umd/locale/ko-KR.js +1 -1
  83. package/lib/umd/locale/pl-PL.js +1 -0
  84. package/lib/umd/locale/pt-BR.js +1 -0
  85. package/lib/umd/locale/ru-RU.js +1 -1
  86. package/lib/umd/locale/sk-SK.js +1 -1
  87. package/lib/umd/locale/vi-VN.js +1 -1
  88. package/lib/umd/locale/zh-CN.js +1 -1
  89. package/lib/umd/locale/zh-HK.js +1 -0
  90. package/lib/umd/locale/zh-TW.js +1 -1
  91. package/package.json +15 -15
package/lib/cjs/index.js CHANGED
@@ -45,10 +45,10 @@ let react_jsx_runtime = require("react/jsx-runtime");
45
45
 
46
46
  //#region package.json
47
47
  var name = "@univerjs/sheets-data-validation-ui";
48
- var version = "0.24.0";
48
+ var version = "0.25.0";
49
49
 
50
50
  //#endregion
51
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
51
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
52
52
  function _typeof(o) {
53
53
  "@babel/helpers - typeof";
54
54
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -59,7 +59,7 @@ function _typeof(o) {
59
59
  }
60
60
 
61
61
  //#endregion
62
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
62
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
63
63
  function toPrimitive(t, r) {
64
64
  if ("object" != _typeof(t) || !t) return t;
65
65
  var e = t[Symbol.toPrimitive];
@@ -72,14 +72,14 @@ function toPrimitive(t, r) {
72
72
  }
73
73
 
74
74
  //#endregion
75
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
75
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
76
76
  function toPropertyKey(t) {
77
77
  var i = toPrimitive(t, "string");
78
78
  return "symbol" == _typeof(i) ? i : i + "";
79
79
  }
80
80
 
81
81
  //#endregion
82
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
82
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
83
83
  function _defineProperty(e, r, t) {
84
84
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
85
85
  value: t,
@@ -90,7 +90,7 @@ function _defineProperty(e, r, t) {
90
90
  }
91
91
 
92
92
  //#endregion
93
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
93
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
94
94
  function __decorateParam(paramIndex, decorator) {
95
95
  return function(target, key) {
96
96
  decorator(target, key, paramIndex);
@@ -98,7 +98,7 @@ function __decorateParam(paramIndex, decorator) {
98
98
  }
99
99
 
100
100
  //#endregion
101
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
101
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
102
102
  function __decorate(decorators, target, key, desc) {
103
103
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
104
104
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -238,7 +238,7 @@ let DataValidationRejectInputController = class DataValidationRejectInputControl
238
238
  if (await this._sheetsDataValidationValidatorService.validatorCell(unitId, subUnitId, row, col) === _univerjs_core.DataValidationStatus.VALID) return next(Promise.resolve(true));
239
239
  this._dialogService.open({
240
240
  width: 368,
241
- title: { title: this._localeService.t("dataValidation.alert.title") },
241
+ title: { title: this._localeService.t("sheets-data-validation-ui.alert.title") },
242
242
  id: "reject-input-dialog",
243
243
  children: { title: validator.getRuleFinalError(rule, {
244
244
  row,
@@ -249,7 +249,7 @@ let DataValidationRejectInputController = class DataValidationRejectInputControl
249
249
  footer: { title: (0, react.createElement)(_univerjs_design.Button, {
250
250
  variant: "primary",
251
251
  onClick: () => this._dialogService.close("reject-input-dialog")
252
- }, this._localeService.t("dataValidation.alert.ok")) },
252
+ }, this._localeService.t("sheets-data-validation-ui.alert.ok")) },
253
253
  onClose: () => {
254
254
  this._dialogService.close("reject-input-dialog");
255
255
  }
@@ -260,13 +260,13 @@ let DataValidationRejectInputController = class DataValidationRejectInputControl
260
260
  showReject(title) {
261
261
  this._dialogService.open({
262
262
  width: 368,
263
- title: { title: this._localeService.t("dataValidation.alert.title") },
263
+ title: { title: this._localeService.t("sheets-data-validation-ui.alert.title") },
264
264
  id: "reject-input-dialog",
265
265
  children: { title },
266
266
  footer: { title: (0, react.createElement)(_univerjs_design.Button, {
267
267
  variant: "primary",
268
268
  onClick: () => this._dialogService.close("reject-input-dialog")
269
- }, this._localeService.t("dataValidation.alert.ok")) },
269
+ }, this._localeService.t("sheets-data-validation-ui.alert.ok")) },
270
270
  onClose: () => {
271
271
  this._dialogService.close("reject-input-dialog");
272
272
  }
@@ -461,7 +461,8 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
461
461
  var _this$_configService$, _this$_configService$2, _this$_configService$3, _this$_configService$4;
462
462
  const multiple = validator.dropdownType === _univerjs_data_validation.DataValidatorDropdownType.MULTIPLE_LIST;
463
463
  const handleSave = async (newValue) => {
464
- const str = (0, _univerjs_sheets_data_validation.serializeListOptions)(newValue);
464
+ var _newValue$;
465
+ const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
465
466
  const params = {
466
467
  unitId,
467
468
  subUnitId,
@@ -679,7 +680,7 @@ const OpenValidationPanelOperation = {
679
680
  });
680
681
  const disposable = sidebarService.open({
681
682
  id: DATA_VALIDATION_PANEL,
682
- header: { title: isAdd ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" },
683
+ header: { title: isAdd ? "sheets-data-validation-ui.panel.addTitle" : "sheets-data-validation-ui.panel.title" },
683
684
  children: { label: DATA_VALIDATION_PANEL },
684
685
  width: 312,
685
686
  onClose: () => dataValidationPanelService.close()
@@ -807,7 +808,7 @@ let DataValidationAlertController = class DataValidationAlertController extends
807
808
  }
808
809
  this._cellAlertManagerService.showAlert({
809
810
  type: _univerjs_sheets_ui.CellAlertType.ERROR,
810
- title: this._localeService.t("dataValidation.error.title"),
811
+ title: this._localeService.t("sheets-data-validation-ui.error.title"),
811
812
  message: validator === null || validator === void 0 ? void 0 : validator.getRuleFinalError(rule, cellPos.location),
812
813
  location: cellPos.location,
813
814
  width: 200,
@@ -1115,7 +1116,7 @@ let DataValidationPermissionController = class DataValidationPermissionControlle
1115
1116
  workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
1116
1117
  rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint],
1117
1118
  worksheetTypes: [_univerjs_sheets.WorksheetEditPermission, _univerjs_sheets.WorksheetSetCellStylePermission]
1118
- }, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"));
1119
+ }, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-data-validation-ui.permission.dialog.setStyleErr"));
1119
1120
  }
1120
1121
  if (command.id === _univerjs_sheets_data_validation.UpdateSheetDataValidationRangeCommand.id) {
1121
1122
  const { unitId, subUnitId, ranges } = command.params;
@@ -1123,7 +1124,7 @@ let DataValidationPermissionController = class DataValidationPermissionControlle
1123
1124
  workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
1124
1125
  rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint],
1125
1126
  worksheetTypes: [_univerjs_sheets.WorksheetEditPermission, _univerjs_sheets.WorksheetSetCellStylePermission]
1126
- }, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"));
1127
+ }, ranges, unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-data-validation-ui.permission.dialog.setStyleErr"));
1127
1128
  }
1128
1129
  }));
1129
1130
  }
@@ -1142,7 +1143,7 @@ function dataValidationMenuFactory(accessor) {
1142
1143
  id: DATA_VALIDATION_MENU_ID,
1143
1144
  type: _univerjs_ui.MenuItemType.SUBITEMS,
1144
1145
  icon: "DataValidationIcon",
1145
- tooltip: "dataValidation.title",
1146
+ tooltip: "sheets-data-validation-ui.title",
1146
1147
  hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
1147
1148
  disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {
1148
1149
  workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
@@ -1154,14 +1155,14 @@ function dataValidationMenuFactory(accessor) {
1154
1155
  function openDataValidationMenuFactory(_accessor) {
1155
1156
  return {
1156
1157
  id: OpenValidationPanelOperation.id,
1157
- title: "dataValidation.panel.title",
1158
+ title: "sheets-data-validation-ui.panel.title",
1158
1159
  type: _univerjs_ui.MenuItemType.BUTTON
1159
1160
  };
1160
1161
  }
1161
1162
  function addDataValidationMenuFactory(_accessor) {
1162
1163
  return {
1163
1164
  id: AddSheetDataValidationAndOpenCommand.id,
1164
- title: "dataValidation.panel.add",
1165
+ title: "sheets-data-validation-ui.panel.add",
1165
1166
  type: _univerjs_ui.MenuItemType.BUTTON
1166
1167
  };
1167
1168
  }
@@ -1506,14 +1507,14 @@ function DataValidationOptions(props) {
1506
1507
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1507
1508
  className: "univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-white",
1508
1509
  onClick: () => setShow(!show),
1509
- children: [localeService.t("dataValidation.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" })]
1510
+ 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" })]
1510
1511
  }), show && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1511
1512
  ExtraOptions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExtraOptions, {
1512
1513
  value,
1513
1514
  onChange
1514
1515
  }) : null,
1515
1516
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1516
- label: localeService.t("dataValidation.panel.invalid"),
1517
+ label: localeService.t("sheets-data-validation-ui.panel.invalid"),
1517
1518
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.RadioGroup, {
1518
1519
  value: `${(_value$errorStyle = value.errorStyle) !== null && _value$errorStyle !== void 0 ? _value$errorStyle : _univerjs_core.DataValidationErrorStyle.WARNING}`,
1519
1520
  onChange: (errorStyle) => onChange({
@@ -1522,22 +1523,22 @@ function DataValidationOptions(props) {
1522
1523
  }),
1523
1524
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Radio, {
1524
1525
  value: `${_univerjs_core.DataValidationErrorStyle.WARNING}`,
1525
- children: localeService.t("dataValidation.panel.showWarning")
1526
+ children: localeService.t("sheets-data-validation-ui.panel.showWarning")
1526
1527
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Radio, {
1527
1528
  value: `${_univerjs_core.DataValidationErrorStyle.STOP}`,
1528
- children: localeService.t("dataValidation.panel.rejectInput")
1529
+ children: localeService.t("sheets-data-validation-ui.panel.rejectInput")
1529
1530
  })]
1530
1531
  })
1531
1532
  }),
1532
1533
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1533
- label: localeService.t("dataValidation.panel.messageInfo"),
1534
+ label: localeService.t("sheets-data-validation-ui.panel.messageInfo"),
1534
1535
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
1535
1536
  checked: value.showErrorMessage,
1536
1537
  onChange: () => onChange({
1537
1538
  ...value,
1538
1539
  showErrorMessage: !value.showErrorMessage
1539
1540
  }),
1540
- children: localeService.t("dataValidation.panel.showInfo")
1541
+ children: localeService.t("sheets-data-validation-ui.panel.showInfo")
1541
1542
  })
1542
1543
  }),
1543
1544
  value.showErrorMessage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
@@ -1750,8 +1751,8 @@ function DataValidationDetail() {
1750
1751
  className: "univer-py-2",
1751
1752
  children: [
1752
1753
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1753
- label: localeService.t("dataValidation.panel.range"),
1754
- error: !localRule.ranges.length || isRangeError ? localeService.t("dataValidation.panel.rangeError") : "",
1754
+ label: localeService.t("sheets-data-validation-ui.panel.range"),
1755
+ error: !localRule.ranges.length || isRangeError ? localeService.t("sheets-data-validation-ui.panel.rangeError") : "",
1755
1756
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.RangeSelector, {
1756
1757
  selectorRef: rangeSelectorInstance,
1757
1758
  unitId,
@@ -1770,7 +1771,7 @@ function DataValidationDetail() {
1770
1771
  })
1771
1772
  }),
1772
1773
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1773
- label: localeService.t("dataValidation.panel.type"),
1774
+ label: localeService.t("sheets-data-validation-ui.panel.type"),
1774
1775
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
1775
1776
  className: "univer-w-full",
1776
1777
  value: localRule.type,
@@ -1782,13 +1783,13 @@ function DataValidationDetail() {
1782
1783
  })
1783
1784
  }),
1784
1785
  (operators === null || operators === void 0 ? void 0 : operators.length) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1785
- label: localeService.t("dataValidation.panel.operator"),
1786
+ label: localeService.t("sheets-data-validation-ui.panel.operator"),
1786
1787
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
1787
1788
  className: "univer-w-full",
1788
1789
  value: `${localRule.operator}`,
1789
1790
  options: [{
1790
1791
  value: "",
1791
- label: localeService.t("dataValidation.operators.legal")
1792
+ label: localeService.t("data-validation.operators.legal")
1792
1793
  }, ...operators.map((op, i) => ({
1793
1794
  value: `${op}`,
1794
1795
  label: operatorNames[i]
@@ -1828,7 +1829,7 @@ function DataValidationDetail() {
1828
1829
  allowBlank: !((_localRule$allowBlank2 = localRule.allowBlank) !== null && _localRule$allowBlank2 !== void 0 ? _localRule$allowBlank2 : true)
1829
1830
  });
1830
1831
  },
1831
- children: localeService.t("dataValidation.panel.allowBlank")
1832
+ children: localeService.t("sheets-data-validation-ui.panel.allowBlank")
1832
1833
  }) }),
1833
1834
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationOptions, {
1834
1835
  value: options,
@@ -1840,12 +1841,12 @@ function DataValidationDetail() {
1840
1841
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1841
1842
  className: "univer-ml-3",
1842
1843
  onClick: handleDelete,
1843
- children: localeService.t("dataValidation.panel.removeRule")
1844
+ children: localeService.t("sheets-data-validation-ui.panel.removeRule")
1844
1845
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1845
1846
  className: "univer-ml-3",
1846
1847
  variant: "primary",
1847
1848
  onClick: handleOk,
1848
- children: localeService.t("dataValidation.panel.done")
1849
+ children: localeService.t("sheets-data-validation-ui.panel.done")
1849
1850
  })]
1850
1851
  })
1851
1852
  ]
@@ -2017,11 +2018,11 @@ function DataValidationList(props) {
2017
2018
  className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2",
2018
2019
  children: [rules.length && !hasDisableRule ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
2019
2020
  onClick: handleRemoveAll,
2020
- children: localeService.t("dataValidation.panel.removeAll")
2021
+ children: localeService.t("sheets-data-validation-ui.panel.removeAll")
2021
2022
  }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
2022
2023
  variant: "primary",
2023
2024
  onClick: handleAddRule,
2024
- children: localeService.t("dataValidation.panel.add")
2025
+ children: localeService.t("sheets-data-validation-ui.panel.add")
2025
2026
  })]
2026
2027
  })]
2027
2028
  });
@@ -2054,7 +2055,7 @@ const BaseFormulaInput = (props) => {
2054
2055
  error: formula1Res,
2055
2056
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
2056
2057
  className: "univer-w-full",
2057
- placeholder: localeService.t("dataValidation.panel.formulaPlaceholder"),
2058
+ placeholder: localeService.t("sheets-data-validation-ui.panel.formulaPlaceholder"),
2058
2059
  value: value === null || value === void 0 ? void 0 : value.formula1,
2059
2060
  onChange: (newValue) => {
2060
2061
  onChange === null || onChange === void 0 || onChange({
@@ -2066,13 +2067,13 @@ const BaseFormulaInput = (props) => {
2066
2067
  }),
2067
2068
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2068
2069
  className: "-univer-mt-2 univer-mb-1 univer-text-sm univer-text-gray-400",
2069
- children: localeService.t("dataValidation.panel.formulaAnd")
2070
+ children: localeService.t("sheets-data-validation-ui.panel.formulaAnd")
2070
2071
  }),
2071
2072
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
2072
2073
  error: formula2Res,
2073
2074
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
2074
2075
  className: "univer-w-full",
2075
- placeholder: localeService.t("dataValidation.panel.formulaPlaceholder"),
2076
+ placeholder: localeService.t("sheets-data-validation-ui.panel.formulaPlaceholder"),
2076
2077
  value: value === null || value === void 0 ? void 0 : value.formula2,
2077
2078
  onChange: (newValue) => {
2078
2079
  onChange === null || onChange === void 0 || onChange({
@@ -2087,7 +2088,7 @@ const BaseFormulaInput = (props) => {
2087
2088
  error: formula1Res,
2088
2089
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
2089
2090
  className: "univer-w-full",
2090
- placeholder: localeService.t("dataValidation.panel.formulaPlaceholder"),
2091
+ placeholder: localeService.t("sheets-data-validation-ui.panel.formulaPlaceholder"),
2091
2092
  value: value === null || value === void 0 ? void 0 : value.formula1,
2092
2093
  onChange: (newValue) => {
2093
2094
  onChange === null || onChange === void 0 || onChange({ formula1: newValue });
@@ -2118,14 +2119,14 @@ function CheckboxFormulaInput(props) {
2118
2119
  });
2119
2120
  }
2120
2121
  },
2121
- children: localeService.t("dataValidation.checkbox.tips")
2122
+ children: localeService.t("sheets-data-validation-ui.checkbox.tips")
2122
2123
  }) }),
2123
2124
  checked ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
2124
- label: localeService.t("dataValidation.checkbox.checked"),
2125
+ label: localeService.t("sheets-data-validation-ui.checkbox.checked"),
2125
2126
  error: formula1Res,
2126
2127
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
2127
2128
  className: "univer-w-full",
2128
- placeholder: localeService.t("dataValidation.panel.valuePlaceholder"),
2129
+ placeholder: localeService.t("sheets-data-validation-ui.panel.valuePlaceholder"),
2129
2130
  value: value === null || value === void 0 ? void 0 : value.formula1,
2130
2131
  onChange: (newValue) => {
2131
2132
  onChange === null || onChange === void 0 || onChange({
@@ -2136,11 +2137,11 @@ function CheckboxFormulaInput(props) {
2136
2137
  })
2137
2138
  }) : null,
2138
2139
  checked ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
2139
- label: localeService.t("dataValidation.checkbox.unchecked"),
2140
+ label: localeService.t("sheets-data-validation-ui.checkbox.unchecked"),
2140
2141
  error: formula2Res,
2141
2142
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
2142
2143
  className: "univer-w-full",
2143
- placeholder: localeService.t("dataValidation.panel.valuePlaceholder"),
2144
+ placeholder: localeService.t("sheets-data-validation-ui.panel.valuePlaceholder"),
2144
2145
  value: value === null || value === void 0 ? void 0 : value.formula2,
2145
2146
  onChange: (newValue) => {
2146
2147
  onChange === null || onChange === void 0 || onChange({
@@ -2188,6 +2189,37 @@ function CustomFormulaInput(props) {
2188
2189
  });
2189
2190
  }
2190
2191
 
2192
+ //#endregion
2193
+ //#region src/views/components/formula-input/utils.ts
2194
+ /**
2195
+ * Copyright 2023-present DreamNum Co., Ltd.
2196
+ *
2197
+ * Licensed under the Apache License, Version 2.0 (the "License");
2198
+ * you may not use this file except in compliance with the License.
2199
+ * You may obtain a copy of the License at
2200
+ *
2201
+ * http://www.apache.org/licenses/LICENSE-2.0
2202
+ *
2203
+ * Unless required by applicable law or agreed to in writing, software
2204
+ * distributed under the License is distributed on an "AS IS" BASIS,
2205
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2206
+ * See the License for the specific language governing permissions and
2207
+ * limitations under the License.
2208
+ */
2209
+ function buildCustomListFormulaPayload(items, defaultColor) {
2210
+ const labelSet = /* @__PURE__ */ new Set();
2211
+ const finalList = [];
2212
+ items.forEach((item) => {
2213
+ if (!item.label || labelSet.has(item.label)) return;
2214
+ labelSet.add(item.label);
2215
+ finalList.push(item);
2216
+ });
2217
+ return {
2218
+ formula1: (0, _univerjs_sheets.serializeListOptions)(finalList.map((item) => item.label)),
2219
+ formula2: finalList.map((item) => item.color === defaultColor ? "" : item.color).join(",")
2220
+ };
2221
+ }
2222
+
2191
2223
  //#endregion
2192
2224
  //#region src/views/components/formula-input/ListFormulaInput.tsx
2193
2225
  const DEFAULT_COLOR_PRESET = [
@@ -2274,8 +2306,9 @@ const Template = (props) => {
2274
2306
  ]
2275
2307
  });
2276
2308
  };
2309
+ const NOOP = () => {};
2277
2310
  function ListFormulaInput(props) {
2278
- const { value, onChange: _onChange = () => {}, unitId, subUnitId, validResult, showError, ruleId } = props;
2311
+ const { value, onChange: _onChange = NOOP, unitId, subUnitId, validResult, showError, ruleId } = props;
2279
2312
  const { formula1 = "", formula2 = "" } = value || {};
2280
2313
  const [isFormulaStr, setIsFormulaStr] = (0, react.useState)(() => (0, _univerjs_core.isFormulaString)(formula1) ? "1" : "0");
2281
2314
  const [formulaStr, setFormulaStr] = (0, react.useState)(isFormulaStr === "1" ? formula1 : "=");
@@ -2313,7 +2346,7 @@ function ListFormulaInput(props) {
2313
2346
  }
2314
2347
  }, [formulaStrCopy, formula1]);
2315
2348
  const [strList, setStrList] = (0, react.useState)(() => {
2316
- const strOptions = isFormulaStr !== "1" ? (0, _univerjs_sheets_data_validation.deserializeListOptions)(formula1) : [];
2349
+ const strOptions = isFormulaStr !== "1" ? (0, _univerjs_sheets.deserializeListOptions)(formula1) : [];
2317
2350
  const strColors = formula2.split(",");
2318
2351
  return strOptions.map((label, i) => ({
2319
2352
  label,
@@ -2336,13 +2369,12 @@ function ListFormulaInput(props) {
2336
2369
  setStrList([...strList]);
2337
2370
  }
2338
2371
  };
2339
- const colorList = formula2.split(",");
2340
2372
  const refFinalList = (0, react.useMemo)(() => refOptions.map((label, i) => ({
2341
2373
  label,
2342
- color: colorList[i] || "#ECECEC",
2374
+ color: refColors[i] || "#ECECEC",
2343
2375
  id: `${i}`,
2344
2376
  isRef: true
2345
- })), [colorList, refOptions]);
2377
+ })), [refColors, refOptions]);
2346
2378
  const handleRefItemChange = (id, value, color) => {
2347
2379
  const newColors = [...refColors];
2348
2380
  newColors[+id] = color;
@@ -2362,34 +2394,11 @@ function ListFormulaInput(props) {
2362
2394
  };
2363
2395
  (0, react.useEffect)(() => {
2364
2396
  if (isFormulaStr === "1") return;
2365
- const labelSet = /* @__PURE__ */ new Set();
2366
- const finalList = [];
2367
- strList.map((item) => {
2368
- return {
2369
- labelList: item.label.split(","),
2370
- item
2371
- };
2372
- }).forEach(({ item, labelList }) => {
2373
- labelList.forEach((labelItem) => {
2374
- if (!labelSet.has(labelItem)) {
2375
- labelSet.add(labelItem);
2376
- finalList.push({
2377
- label: labelItem,
2378
- color: item.color
2379
- });
2380
- }
2381
- });
2382
- });
2383
- onChange({
2384
- formula1: (0, _univerjs_sheets_data_validation.serializeListOptions)(finalList.map((item) => item.label)),
2385
- formula2: finalList.map((item) => item.color === "#ECECEC" ? "" : item.color).join(",")
2386
- });
2397
+ onChange(buildCustomListFormulaPayload(strList, DROP_DOWN_DEFAULT_COLOR));
2387
2398
  }, [
2388
2399
  strList,
2389
2400
  onChange,
2390
- isFormulaStr,
2391
- formulaStrCopy,
2392
- refColors
2401
+ isFormulaStr
2393
2402
  ]);
2394
2403
  const updateFormula = (0, _univerjs_ui.useEvent)(async (str) => {
2395
2404
  if (!(0, _univerjs_core.isFormulaString)(str)) {
@@ -2411,7 +2420,7 @@ function ListFormulaInput(props) {
2411
2420
  formula2
2412
2421
  });
2413
2422
  setFormulaStr("=");
2414
- setLocalError(localeService.t("dataValidation.validFail.formulaError"));
2423
+ setLocalError(localeService.t("sheets-data-validation-ui.validFail.formulaError"));
2415
2424
  }
2416
2425
  });
2417
2426
  const formulaEditorRef = (0, react.useRef)(null);
@@ -2429,7 +2438,7 @@ function ListFormulaInput(props) {
2429
2438
  dataValidationPanelService
2430
2439
  ]);
2431
2440
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
2432
- label: localeService.t("dataValidation.list.options"),
2441
+ label: localeService.t("sheets-data-validation-ui.list.options"),
2433
2442
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.RadioGroup, {
2434
2443
  value: isFormulaStr,
2435
2444
  onChange: (v) => {
@@ -2442,10 +2451,10 @@ function ListFormulaInput(props) {
2442
2451
  },
2443
2452
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Radio, {
2444
2453
  value: "0",
2445
- children: localeService.t("dataValidation.list.customOptions")
2454
+ children: localeService.t("sheets-data-validation-ui.list.customOptions")
2446
2455
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Radio, {
2447
2456
  value: "1",
2448
- children: localeService.t("dataValidation.list.refOptions")
2457
+ children: localeService.t("sheets-data-validation-ui.list.refOptions")
2449
2458
  })]
2450
2459
  })
2451
2460
  }), isFormulaStr === "1" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.FormLayout, {
@@ -2476,28 +2485,25 @@ function ListFormulaInput(props) {
2476
2485
  })]
2477
2486
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
2478
2487
  error: formula1Res,
2479
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2480
- className: "-univer-mt-3",
2481
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DraggableList, {
2482
- list: strList,
2483
- onListChange: setStrList,
2484
- rowHeight: 28,
2485
- margin: [0, 12],
2486
- draggableHandle: ".draggableHandle",
2487
- itemRender: (item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Template, {
2488
- item,
2489
- commonProps: {
2490
- onItemChange: handleStrItemChange,
2491
- onItemDelete: handleStrItemDelete
2492
- }
2493
- }, item.id),
2494
- idKey: "id"
2495
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
2496
- className: "univer-text-primary univer-flex univer-w-fit univer-cursor-pointer univer-flex-row univer-items-center univer-rounded univer-p-1 univer-px-2 univer-text-sm hover:univer-bg-primary-50 dark:hover:!univer-bg-gray-800",
2497
- onClick: handleAdd,
2498
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.IncreaseIcon, { className: "univer-mr-1" }), localeService.t("dataValidation.list.add")]
2499
- })]
2500
- })
2488
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DraggableList, {
2489
+ list: strList,
2490
+ onListChange: setStrList,
2491
+ rowHeight: 28,
2492
+ margin: [0, 12],
2493
+ draggableHandle: ".draggableHandle",
2494
+ itemRender: (item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Template, {
2495
+ item,
2496
+ commonProps: {
2497
+ onItemChange: handleStrItemChange,
2498
+ onItemDelete: handleStrItemDelete
2499
+ }
2500
+ }, item.id),
2501
+ idKey: "id"
2502
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
2503
+ className: "univer-text-primary univer-flex univer-w-fit univer-cursor-pointer univer-flex-row univer-items-center univer-rounded univer-p-1 univer-px-2 univer-text-sm hover:univer-bg-primary-50 dark:hover:!univer-bg-gray-800",
2504
+ onClick: handleAdd,
2505
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.IncreaseIcon, { className: "univer-mr-1" }), localeService.t("sheets-data-validation-ui.list.add")]
2506
+ })] })
2501
2507
  })] });
2502
2508
  }
2503
2509
 
@@ -2518,7 +2524,7 @@ function ListRenderModeInput(props) {
2518
2524
  const { value, onChange } = props;
2519
2525
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
2520
2526
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
2521
- label: localeService.t("dataValidation.renderMode.label"),
2527
+ label: localeService.t("sheets-data-validation-ui.renderMode.label"),
2522
2528
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.RadioGroup, {
2523
2529
  value: `${(_value$renderMode = value.renderMode) !== null && _value$renderMode !== void 0 ? _value$renderMode : _univerjs_core.DataValidationRenderMode.CUSTOM}`,
2524
2530
  onChange: (renderMode) => onChange({
@@ -2528,15 +2534,15 @@ function ListRenderModeInput(props) {
2528
2534
  children: [
2529
2535
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Radio, {
2530
2536
  value: `${_univerjs_core.DataValidationRenderMode.CUSTOM}`,
2531
- children: localeService.t("dataValidation.renderMode.chip")
2537
+ children: localeService.t("sheets-data-validation-ui.renderMode.chip")
2532
2538
  }),
2533
2539
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Radio, {
2534
2540
  value: `${_univerjs_core.DataValidationRenderMode.ARROW}`,
2535
- children: localeService.t("dataValidation.renderMode.arrow")
2541
+ children: localeService.t("sheets-data-validation-ui.renderMode.arrow")
2536
2542
  }),
2537
2543
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Radio, {
2538
2544
  value: `${_univerjs_core.DataValidationRenderMode.TEXT}`,
2539
- children: localeService.t("dataValidation.renderMode.text")
2545
+ children: localeService.t("sheets-data-validation-ui.renderMode.text")
2540
2546
  })
2541
2547
  ]
2542
2548
  })
@@ -2562,7 +2568,7 @@ function DateShowTimeOption(props) {
2562
2568
  }
2563
2569
  });
2564
2570
  },
2565
- children: localeService.t("dataValidation.showTime.label")
2571
+ children: localeService.t("sheets-data-validation-ui.showTime.label")
2566
2572
  }) });
2567
2573
  }
2568
2574
  DateShowTimeOption.componentKey = DATE_SHOW_TIME_OPTION;
@@ -2874,9 +2880,7 @@ const PADDING_H$1 = 4;
2874
2880
  const PADDING_V$1 = 0;
2875
2881
  const MARGIN_H$1 = 4;
2876
2882
  const MARGIN_V$1 = 4;
2877
- const CELL_PADDING_H = 6;
2878
2883
  const CELL_PADDING_V = 6;
2879
- const ICON_PLACE$1 = 14;
2880
2884
  function getDropdownItemSize(text, fontStyle) {
2881
2885
  const bBox = _univerjs_engine_render.FontCache.getTextSize(text, fontStyle);
2882
2886
  const rectWidth = bBox.width + 4 * 2;
@@ -2888,7 +2892,7 @@ function getDropdownItemSize(text, fontStyle) {
2888
2892
  };
2889
2893
  }
2890
2894
  function layoutDropdowns(items, fontStyle, cellWidth, cellHeight) {
2891
- const cellPaddingH = 14 + 6 * 2;
2895
+ const cellPaddingH = 26;
2892
2896
  const widthAvailableForContent = cellWidth - cellPaddingH;
2893
2897
  const heightAvailableForContent = cellHeight - 6 * 2;
2894
2898
  const textLayout = items.map((item) => ({
@@ -3448,15 +3452,15 @@ let DropdownWidget = class DropdownWidget {
3448
3452
  let { tb, pd } = style || {};
3449
3453
  const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd !== null && pd !== void 0 ? pd : {};
3450
3454
  tb = (_tb3 = tb) !== null && _tb3 !== void 0 ? _tb3 : _univerjs_core.WrapStrategy.WRAP;
3451
- let paddingAll = MARGIN_H * 2 + ICON_PLACE;
3455
+ let paddingAll = 26;
3452
3456
  switch (rule.renderMode) {
3453
3457
  case _univerjs_core.DataValidationRenderMode.ARROW:
3454
- paddingAll = ICON_PLACE + 4 + r + l;
3458
+ paddingAll = 18 + r + l;
3455
3459
  break;
3456
3460
  case _univerjs_core.DataValidationRenderMode.CUSTOM:
3457
- paddingAll = ICON_PLACE + MARGIN_H * 2 + PADDING_H * 2 + r + l + RADIUS_BG / 2 + 1;
3461
+ paddingAll = 34 + r + l + RADIUS_BG / 2 + 1;
3458
3462
  break;
3459
- default: paddingAll = ICON_PLACE + MARGIN_H * 2 + PADDING_H * 2 + r + l + RADIUS_BG / 2 + 1;
3463
+ default: paddingAll = 34 + r + l + RADIUS_BG / 2 + 1;
3460
3464
  }
3461
3465
  const widthForTextLayout = cellWidth - paddingAll;
3462
3466
  const skeleton = new _univerjs_engine_render.DocSimpleSkeleton(valueStr, (0, _univerjs_engine_render.getFontStyleString)(style).fontCache, Boolean(tb === _univerjs_core.WrapStrategy.WRAP), widthForTextLayout, Infinity);