@univerjs/sheets-table-ui 1.0.0-beta.0 → 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 (88) hide show
  1. package/lib/cjs/index.js +312 -322
  2. package/lib/cjs/locale/ar-SA.js +1 -2
  3. package/lib/cjs/locale/ca-ES.js +1 -2
  4. package/lib/cjs/locale/de-DE.js +1 -2
  5. package/lib/cjs/locale/en-US.js +1 -2
  6. package/lib/cjs/locale/es-ES.js +1 -2
  7. package/lib/cjs/locale/fa-IR.js +1 -2
  8. package/lib/cjs/locale/fr-FR.js +1 -2
  9. package/lib/cjs/locale/id-ID.js +1 -2
  10. package/lib/cjs/locale/it-IT.js +1 -2
  11. package/lib/cjs/locale/ja-JP.js +1 -2
  12. package/lib/cjs/locale/ko-KR.js +1 -2
  13. package/lib/cjs/locale/pl-PL.js +1 -2
  14. package/lib/cjs/locale/pt-BR.js +1 -2
  15. package/lib/cjs/locale/ru-RU.js +1 -2
  16. package/lib/cjs/locale/sk-SK.js +1 -2
  17. package/lib/cjs/locale/vi-VN.js +1 -2
  18. package/lib/cjs/locale/zh-CN.js +1 -2
  19. package/lib/cjs/locale/zh-HK.js +1 -2
  20. package/lib/cjs/locale/zh-TW.js +1 -2
  21. package/lib/es/index.js +315 -325
  22. package/lib/es/locale/ar-SA.js +1 -2
  23. package/lib/es/locale/ca-ES.js +1 -2
  24. package/lib/es/locale/de-DE.js +1 -2
  25. package/lib/es/locale/en-US.js +1 -2
  26. package/lib/es/locale/es-ES.js +1 -2
  27. package/lib/es/locale/fa-IR.js +1 -2
  28. package/lib/es/locale/fr-FR.js +1 -2
  29. package/lib/es/locale/id-ID.js +1 -2
  30. package/lib/es/locale/it-IT.js +1 -2
  31. package/lib/es/locale/ja-JP.js +1 -2
  32. package/lib/es/locale/ko-KR.js +1 -2
  33. package/lib/es/locale/pl-PL.js +1 -2
  34. package/lib/es/locale/pt-BR.js +1 -2
  35. package/lib/es/locale/ru-RU.js +1 -2
  36. package/lib/es/locale/sk-SK.js +1 -2
  37. package/lib/es/locale/vi-VN.js +1 -2
  38. package/lib/es/locale/zh-CN.js +1 -2
  39. package/lib/es/locale/zh-HK.js +1 -2
  40. package/lib/es/locale/zh-TW.js +1 -2
  41. package/lib/index.css +187 -67
  42. package/lib/index.js +315 -325
  43. package/lib/locale/ar-SA.js +1 -2
  44. package/lib/locale/ca-ES.js +1 -2
  45. package/lib/locale/de-DE.js +1 -2
  46. package/lib/locale/en-US.js +1 -2
  47. package/lib/locale/es-ES.js +1 -2
  48. package/lib/locale/fa-IR.js +1 -2
  49. package/lib/locale/fr-FR.js +1 -2
  50. package/lib/locale/id-ID.js +1 -2
  51. package/lib/locale/it-IT.js +1 -2
  52. package/lib/locale/ja-JP.js +1 -2
  53. package/lib/locale/ko-KR.js +1 -2
  54. package/lib/locale/pl-PL.js +1 -2
  55. package/lib/locale/pt-BR.js +1 -2
  56. package/lib/locale/ru-RU.js +1 -2
  57. package/lib/locale/sk-SK.js +1 -2
  58. package/lib/locale/vi-VN.js +1 -2
  59. package/lib/locale/zh-CN.js +1 -2
  60. package/lib/locale/zh-HK.js +1 -2
  61. package/lib/locale/zh-TW.js +1 -2
  62. package/lib/types/const.d.ts +1 -0
  63. package/lib/types/controllers/sheet-table-controls-render.controller.d.ts +6 -2
  64. package/lib/types/locale/en-US.d.ts +1 -2
  65. package/lib/types/views/components/SheetTableMenu.d.ts +29 -0
  66. package/lib/types/views/widgets/table-controls-util.d.ts +1 -7
  67. package/lib/types/views/widgets/table-controls.shape.d.ts +1 -9
  68. package/lib/umd/index.js +1 -1
  69. package/lib/umd/locale/ar-SA.js +1 -1
  70. package/lib/umd/locale/ca-ES.js +1 -1
  71. package/lib/umd/locale/de-DE.js +1 -1
  72. package/lib/umd/locale/en-US.js +1 -1
  73. package/lib/umd/locale/es-ES.js +1 -1
  74. package/lib/umd/locale/fa-IR.js +1 -1
  75. package/lib/umd/locale/fr-FR.js +1 -1
  76. package/lib/umd/locale/id-ID.js +1 -1
  77. package/lib/umd/locale/it-IT.js +1 -1
  78. package/lib/umd/locale/ja-JP.js +1 -1
  79. package/lib/umd/locale/ko-KR.js +1 -1
  80. package/lib/umd/locale/pl-PL.js +1 -1
  81. package/lib/umd/locale/pt-BR.js +1 -1
  82. package/lib/umd/locale/ru-RU.js +1 -1
  83. package/lib/umd/locale/sk-SK.js +1 -1
  84. package/lib/umd/locale/vi-VN.js +1 -1
  85. package/lib/umd/locale/zh-CN.js +1 -1
  86. package/lib/umd/locale/zh-HK.js +1 -1
  87. package/lib/umd/locale/zh-TW.js +1 -1
  88. package/package.json +12 -12
package/lib/cjs/index.js CHANGED
@@ -38,6 +38,7 @@ const SHEET_TABLE_RENAME_DIALOG = "SHEET_TABLE_RENAME_DIALOG";
38
38
  const SHEET_TABLE_RENAME_DIALOG_ID = "SHEET_TABLE_RENAME_DIALOG_ID";
39
39
  const SHEET_TABLE_THEME_PANEL_ID = "SHEET_TABLE_THEME_PANEL_ID";
40
40
  const SHEET_TABLE_THEME_PANEL = "SHEET_TABLE_THEME_PANEL";
41
+ const SHEET_TABLE_MENU = "SHEET_TABLE_MENU";
41
42
  const TABLE_CUSTOM_NAME_PREFIX = "table-custom-";
42
43
  const TABLE_DEFAULT_NAME_PREFIX = "table-default-";
43
44
  const TABLE_DEFAULT_BG_COLOR = "rgb(255, 255, 255)";
@@ -248,7 +249,7 @@ const menuSchema = {
248
249
  //#endregion
249
250
  //#region package.json
250
251
  var name = "@univerjs/sheets-table-ui";
251
- var version = "1.0.0-beta.0";
252
+ var version = "1.0.0-beta.1";
252
253
 
253
254
  //#endregion
254
255
  //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
@@ -942,7 +943,7 @@ const SheetTableConditionPanel = (props) => {
942
943
  wrapperClassName: "!univer-h-[150px]"
943
944
  }),
944
945
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
945
- className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-2 univer-text-sm univer-transition-colors univer-duration-200 hover:univer-border-primary-600 focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2 dark:!univer-bg-gray-700 dark:!univer-text-white", _univerjs_design.borderClassName),
946
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-2 univer-text-sm univer-transition-colors univer-duration-200 hover:univer-border-primary-600 focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", _univerjs_design.borderClassName),
946
947
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectType }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})]
947
948
  })
948
949
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -950,7 +951,7 @@ const SheetTableConditionPanel = (props) => {
950
951
  children: [
951
952
  subComponentType === "Input" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: conditionInfo.type === _univerjs_sheets_table.TableConditionTypeEnum.String ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
952
953
  className: "univer-w-full",
953
- placeholder: "请输入",
954
+ placeholder: localeService.t("sheets-table-ui.filter.input-values-placeholder"),
954
955
  value: conditionInfo.info.string,
955
956
  onChange: (v) => handleConditionInfo({ string: v })
956
957
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
@@ -1275,14 +1276,14 @@ function SheetTableFilterPanel() {
1275
1276
  };
1276
1277
  const workbookEditableId = new _univerjs_sheets.WorkbookEditablePermission(unitId).id;
1277
1278
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1278
- className: "univer-box-border univer-flex univer-w-[400px] univer-flex-col univer-rounded-[10px] univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
1279
+ className: "univer-box-border univer-flex univer-w-[400px] univer-flex-col univer-rounded-[10px] univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
1279
1280
  children: [
1280
1281
  ((_permissionService$ge = permissionService.getPermissionPoint(workbookEditableId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1281
1282
  className: "-univer-mx-4 -univer-mt-2 univer-mb-3 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-py-1",
1282
1283
  children: [
1283
1284
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1284
1285
  type: "button",
1285
- className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-white dark:hover:!univer-bg-gray-600",
1286
+ className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600",
1286
1287
  onClick: () => insertColumn("left"),
1287
1288
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.LeftInsertColumnDoubleIcon, {
1288
1289
  className: "univer-size-5",
@@ -1291,7 +1292,7 @@ function SheetTableFilterPanel() {
1291
1292
  }),
1292
1293
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1293
1294
  type: "button",
1294
- className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-white dark:hover:!univer-bg-gray-600",
1295
+ className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600",
1295
1296
  onClick: () => insertColumn("right"),
1296
1297
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.RightInsertColumnDoubleIcon, {
1297
1298
  className: "univer-size-5",
@@ -1300,7 +1301,7 @@ function SheetTableFilterPanel() {
1300
1301
  }),
1301
1302
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1302
1303
  type: "button",
1303
- className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-white dark:hover:!univer-bg-gray-600",
1304
+ className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600",
1304
1305
  disabled: !canDeleteColumn,
1305
1306
  onClick: deleteColumn,
1306
1307
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteColumnDoubleIcon, {
@@ -1361,20 +1362,68 @@ function SheetTableFilterPanel() {
1361
1362
  disabled: tableFilter === void 0,
1362
1363
  onClick: onClearFilter,
1363
1364
  children: localeService.t("sheets-table-ui.filter.clear-filter")
1364
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1365
- className: "univer-mr-2",
1366
- onClick: onCancel,
1367
- children: localeService.t("sheets-table-ui.filter.cancel")
1368
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1369
- variant: "primary",
1370
- onClick: onApply,
1371
- children: localeService.t("sheets-table-ui.filter.confirm")
1372
- })] })]
1365
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1366
+ className: "univer-flex univer-gap-x-2",
1367
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1368
+ onClick: onCancel,
1369
+ children: localeService.t("sheets-table-ui.filter.cancel")
1370
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1371
+ variant: "primary",
1372
+ onClick: onApply,
1373
+ children: localeService.t("sheets-table-ui.filter.confirm")
1374
+ })]
1375
+ })]
1373
1376
  })
1374
1377
  ]
1375
1378
  });
1376
1379
  }
1377
1380
 
1381
+ //#endregion
1382
+ //#region src/views/components/SheetTableMenu.tsx
1383
+ function SheetTableMenu({ popup }) {
1384
+ const menu = popup.extraProps;
1385
+ if (!menu) return null;
1386
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DropdownMenu, {
1387
+ align: "start",
1388
+ className: "univer-min-w-40",
1389
+ items: [
1390
+ {
1391
+ type: "item",
1392
+ children: menu.labels.rename,
1393
+ onSelect: () => menu.onSelect("rename")
1394
+ },
1395
+ {
1396
+ type: "item",
1397
+ children: menu.labels["update-range"],
1398
+ onSelect: () => menu.onSelect("update-range")
1399
+ },
1400
+ {
1401
+ type: "item",
1402
+ children: menu.labels["set-theme"],
1403
+ onSelect: () => menu.onSelect("set-theme")
1404
+ },
1405
+ {
1406
+ type: "item",
1407
+ children: menu.labels.delete,
1408
+ variant: "destructive",
1409
+ onSelect: () => menu.onSelect("delete")
1410
+ }
1411
+ ],
1412
+ open: true,
1413
+ sideOffset: 0,
1414
+ onOpenChange: (open) => {
1415
+ if (!open) menu.onClose();
1416
+ },
1417
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1418
+ type: "button",
1419
+ "aria-label": menu.tableName,
1420
+ className: "univer-block univer-h-px univer-opacity-0",
1421
+ style: { width: menu.anchorWidth },
1422
+ tabIndex: -1
1423
+ })
1424
+ });
1425
+ }
1426
+
1378
1427
  //#endregion
1379
1428
  //#region src/views/components/SheetTableRenameDialog.tsx
1380
1429
  function SheetTableRenameDialog(props) {
@@ -1602,7 +1651,7 @@ const SheetTableThemePanel = (props) => {
1602
1651
  const firstRowBg = (customStyle === null || customStyle === void 0 || (_customStyle$getFirst = customStyle.getFirstRowStyle()) === null || _customStyle$getFirst === void 0 || (_customStyle$getFirst = _customStyle$getFirst.bg) === null || _customStyle$getFirst === void 0 ? void 0 : _customStyle$getFirst.rgb) ?? "rgb(255, 255, 255)";
1603
1652
  const secondRowBg = (customStyle === null || customStyle === void 0 || (_customStyle$getSecon = customStyle.getSecondRowStyle()) === null || _customStyle$getSecon === void 0 || (_customStyle$getSecon = _customStyle$getSecon.bg) === null || _customStyle$getSecon === void 0 ? void 0 : _customStyle$getSecon.rgb) ?? "rgb(255, 255, 255)";
1604
1653
  const lastRowBg = (customStyle === null || customStyle === void 0 || (_customStyle$getLastR = customStyle.getLastRowStyle()) === null || _customStyle$getLastR === void 0 || (_customStyle$getLastR = _customStyle$getLastR.bg) === null || _customStyle$getLastR === void 0 ? void 0 : _customStyle$getLastR.rgb) ?? "rgb(255, 255, 255)";
1605
- const [hoverCustomId, setHoverCustomId] = (0, react.useState)(null);
1654
+ const direction = (0, _univerjs_ui.useObservable)(localeService.direction$, localeService.getDirection());
1606
1655
  const handleThemeChange = (theme) => {
1607
1656
  commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
1608
1657
  unitId,
@@ -1648,237 +1697,192 @@ const SheetTableThemePanel = (props) => {
1648
1697
  const firstRowBgIsDark = new _univerjs_core.ColorKit(firstRowBg).isDark();
1649
1698
  const secondRowBgIsDark = new _univerjs_core.ColorKit(secondRowBg).isDark();
1650
1699
  const lastRowBgIsDark = new _univerjs_core.ColorKit(lastRowBg).isDark();
1651
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
1652
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: localeService.t("sheets-table-ui.defaultStyle") }),
1653
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1654
- className: "univer-flex univer-gap-2",
1655
- children: defaultRangeThemes.map((item) => {
1656
- var _rangeThemeItem$getHe, _rangeThemeItem$getFi, _rangeThemeItem$getSe, _rangeThemeItem$getLa;
1657
- const rangeThemeItem = rangeThemeModel.getDefaultRangeThemeStyle(item);
1658
- const headerRowBg = (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getHe = rangeThemeItem.getHeaderRowStyle()) === null || _rangeThemeItem$getHe === void 0 || (_rangeThemeItem$getHe = _rangeThemeItem$getHe.bg) === null || _rangeThemeItem$getHe === void 0 ? void 0 : _rangeThemeItem$getHe.rgb) || "rgb(255, 255, 255)";
1659
- const firstRowBg = (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getFi = rangeThemeItem.getFirstRowStyle()) === null || _rangeThemeItem$getFi === void 0 || (_rangeThemeItem$getFi = _rangeThemeItem$getFi.bg) === null || _rangeThemeItem$getFi === void 0 ? void 0 : _rangeThemeItem$getFi.rgb) || "rgb(255, 255, 255)";
1660
- const secondRowBg = (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getSe = rangeThemeItem.getSecondRowStyle()) === null || _rangeThemeItem$getSe === void 0 || (_rangeThemeItem$getSe = _rangeThemeItem$getSe.bg) === null || _rangeThemeItem$getSe === void 0 ? void 0 : _rangeThemeItem$getSe.rgb) || "rgb(255, 255, 255)";
1661
- const lastRowBg = (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getLa = rangeThemeItem.getLastRowStyle()) === null || _rangeThemeItem$getLa === void 0 || (_rangeThemeItem$getLa = _rangeThemeItem$getLa.bg) === null || _rangeThemeItem$getLa === void 0 ? void 0 : _rangeThemeItem$getLa.rgb) || "rgb(255, 255, 255)";
1662
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1663
- className: (0, _univerjs_design.clsx)("univer-h-10 univer-w-8 univer-cursor-pointer univer-border univer-border-solid univer-border-gray-200 univer-p-px [&>div]:univer-box-border [&>div]:univer-h-2.5", { "univer-border-blue-500": item === themeConfig.theme }),
1664
- onClick: () => handleThemeChange(item),
1665
- children: [
1666
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1667
- background: headerRowBg,
1668
- border: `${headerRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1669
- } }),
1670
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1671
- background: firstRowBg,
1672
- border: `${firstRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1673
- } }),
1674
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1675
- background: secondRowBg,
1676
- border: `${secondRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1677
- } }),
1678
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
1679
- background: lastRowBg,
1680
- border: `${lastRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1681
- } })
1682
- ]
1683
- }, item);
1684
- })
1685
- }),
1686
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: localeService.t("sheets-table-ui.customStyle") }),
1687
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1688
- className: (0, _univerjs_design.clsx)("univer-w-full univer-rounded-sm", _univerjs_design.borderClassName),
1689
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1690
- className: "univer-flex univer-flex-wrap univer-gap-2 univer-p-2",
1691
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1692
- className: (0, _univerjs_design.clsx)("univer-h-10 univer-w-8 univer-cursor-pointer univer-p-px univer-text-center univer-leading-10", _univerjs_design.borderClassName),
1693
- onClick: handleAddCustomTheme,
1694
- children: "+"
1695
- }), customRangeThemes.map((item) => {
1696
- var _rangeThemeItem$getHe2, _rangeThemeItem$getFi2, _rangeThemeItem$getSe2, _rangeThemeItem$getLa2;
1697
- const rangeThemeItem = rangeThemeModel.getCustomRangeThemeStyle(unitId, item);
1698
- const headerRowBg = rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getHe2 = rangeThemeItem.getHeaderRowStyle()) === null || _rangeThemeItem$getHe2 === void 0 || (_rangeThemeItem$getHe2 = _rangeThemeItem$getHe2.bg) === null || _rangeThemeItem$getHe2 === void 0 ? void 0 : _rangeThemeItem$getHe2.rgb;
1699
- const firstRowBg = rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getFi2 = rangeThemeItem.getFirstRowStyle()) === null || _rangeThemeItem$getFi2 === void 0 || (_rangeThemeItem$getFi2 = _rangeThemeItem$getFi2.bg) === null || _rangeThemeItem$getFi2 === void 0 ? void 0 : _rangeThemeItem$getFi2.rgb;
1700
- const secondRowBg = rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getSe2 = rangeThemeItem.getSecondRowStyle()) === null || _rangeThemeItem$getSe2 === void 0 || (_rangeThemeItem$getSe2 = _rangeThemeItem$getSe2.bg) === null || _rangeThemeItem$getSe2 === void 0 ? void 0 : _rangeThemeItem$getSe2.rgb;
1701
- const lastRowBg = rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getLa2 = rangeThemeItem.getLastRowStyle()) === null || _rangeThemeItem$getLa2 === void 0 || (_rangeThemeItem$getLa2 = _rangeThemeItem$getLa2.bg) === null || _rangeThemeItem$getLa2 === void 0 ? void 0 : _rangeThemeItem$getLa2.rgb;
1702
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1703
- className: (0, _univerjs_design.clsx)("univer-relative univer-h-10 univer-w-8 univer-cursor-pointer univer-border univer-border-solid univer-border-gray-200 univer-p-px", { "univer-border-blue-500": item === themeConfig.theme }),
1700
+ const customThemeRows = [
1701
+ {
1702
+ key: "header",
1703
+ label: localeService.t("sheets-table-ui.header"),
1704
+ background: headerBg,
1705
+ isDark: headerBgIsDark,
1706
+ onChange: (value) => {
1707
+ const headerRowStyle = (0, _univerjs_sheets_table.processStyleWithBorderStyle)("headerRowStyle", {
1708
+ bg: { rgb: value },
1709
+ cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
1710
+ });
1711
+ setCustomTheme(table.getTableStyleId(), { headerRowStyle });
1712
+ }
1713
+ },
1714
+ {
1715
+ key: "first-row",
1716
+ label: localeService.t("sheets-table-ui.firstLine"),
1717
+ background: firstRowBg,
1718
+ isDark: firstRowBgIsDark,
1719
+ onChange: (value) => {
1720
+ setCustomTheme(table.getTableStyleId(), { firstRowStyle: {
1721
+ bg: { rgb: value },
1722
+ cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
1723
+ } });
1724
+ }
1725
+ },
1726
+ {
1727
+ key: "second-row",
1728
+ label: localeService.t("sheets-table-ui.secondLine"),
1729
+ background: secondRowBg,
1730
+ isDark: secondRowBgIsDark,
1731
+ onChange: (value) => {
1732
+ setCustomTheme(table.getTableStyleId(), { secondRowStyle: {
1733
+ bg: { rgb: value },
1734
+ cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
1735
+ } });
1736
+ }
1737
+ },
1738
+ {
1739
+ key: "last-row",
1740
+ label: localeService.t("sheets-table-ui.footer"),
1741
+ background: lastRowBg,
1742
+ isDark: lastRowBgIsDark,
1743
+ onChange: (value) => {
1744
+ const lastRowStyle = (0, _univerjs_sheets_table.processStyleWithBorderStyle)("lastRowStyle", {
1745
+ bg: { rgb: value },
1746
+ cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
1747
+ });
1748
+ setCustomTheme(table.getTableStyleId(), { lastRowStyle });
1749
+ }
1750
+ }
1751
+ ];
1752
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1753
+ dir: direction,
1754
+ className: "univer-flex univer-flex-col univer-gap-5 univer-pb-4",
1755
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1756
+ className: "univer-flex univer-flex-col univer-gap-2",
1757
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", {
1758
+ className: "univer-m-0 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300",
1759
+ children: localeService.t("sheets-table-ui.defaultStyle")
1760
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1761
+ className: "univer-grid univer-grid-cols-6 univer-gap-2",
1762
+ children: defaultRangeThemes.map((item) => {
1763
+ var _rangeThemeItem$getHe, _rangeThemeItem$getFi, _rangeThemeItem$getSe, _rangeThemeItem$getLa;
1764
+ const rangeThemeItem = rangeThemeModel.getDefaultRangeThemeStyle(item);
1765
+ const rowBackgrounds = [
1766
+ (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getHe = rangeThemeItem.getHeaderRowStyle()) === null || _rangeThemeItem$getHe === void 0 || (_rangeThemeItem$getHe = _rangeThemeItem$getHe.bg) === null || _rangeThemeItem$getHe === void 0 ? void 0 : _rangeThemeItem$getHe.rgb) || "rgb(255, 255, 255)",
1767
+ (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getFi = rangeThemeItem.getFirstRowStyle()) === null || _rangeThemeItem$getFi === void 0 || (_rangeThemeItem$getFi = _rangeThemeItem$getFi.bg) === null || _rangeThemeItem$getFi === void 0 ? void 0 : _rangeThemeItem$getFi.rgb) || "rgb(255, 255, 255)",
1768
+ (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getSe = rangeThemeItem.getSecondRowStyle()) === null || _rangeThemeItem$getSe === void 0 || (_rangeThemeItem$getSe = _rangeThemeItem$getSe.bg) === null || _rangeThemeItem$getSe === void 0 ? void 0 : _rangeThemeItem$getSe.rgb) || "rgb(255, 255, 255)",
1769
+ (rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getLa = rangeThemeItem.getLastRowStyle()) === null || _rangeThemeItem$getLa === void 0 || (_rangeThemeItem$getLa = _rangeThemeItem$getLa.bg) === null || _rangeThemeItem$getLa === void 0 ? void 0 : _rangeThemeItem$getLa.rgb) || "rgb(255, 255, 255)"
1770
+ ];
1771
+ const selected = item === themeConfig.theme;
1772
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1773
+ type: "button",
1774
+ title: item,
1775
+ "aria-label": item,
1776
+ "aria-pressed": selected,
1777
+ className: (0, _univerjs_design.clsx)("univer-flex univer-h-12 univer-w-full univer-cursor-pointer univer-flex-col univer-overflow-hidden univer-rounded-lg univer-bg-gray-0 univer-p-1 univer-shadow-sm univer-transition-all hover:univer-border-gray-400 hover:univer-shadow-md focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-bg-gray-800", _univerjs_design.borderClassName, { "!univer-border-primary-500 univer-ring-2 univer-ring-primary-100": selected }),
1704
1778
  onClick: () => handleThemeChange(item),
1705
- onMouseEnter: () => setHoverCustomId(item),
1706
- onMouseLeave: () => setHoverCustomId(null),
1707
- children: [
1708
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1709
- className: "univer-box-border univer-h-2.5",
1710
- style: {
1711
- background: headerRowBg ?? "none",
1712
- border: `${headerRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1713
- }
1714
- }),
1715
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1716
- className: "univer-box-border univer-h-2.5",
1717
- style: {
1718
- background: firstRowBg ?? "none",
1719
- border: `${firstRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1720
- }
1721
- }),
1722
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1723
- className: "univer-box-border univer-h-2.5",
1724
- style: {
1725
- background: secondRowBg ?? "none",
1726
- border: `${secondRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1727
- }
1728
- }),
1729
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1730
- className: "univer-box-border univer-h-2.5",
1731
- style: {
1732
- background: lastRowBg ?? "none",
1733
- border: `${lastRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
1734
- }
1735
- }),
1736
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1737
- className: "univer-absolute univer-right-[-3px] univer-top-[-3px] univer-size-3 univer-rounded-md univer-bg-gray-200 univer-text-center univer-text-xs univer-leading-[10px]",
1738
- style: { display: hoverCustomId === item ? "block" : "none" },
1739
- onClick: (e) => {
1740
- e.stopPropagation();
1741
- removeCustomTheme(item);
1742
- },
1743
- children: "x"
1744
- })
1745
- ]
1779
+ children: rowBackgrounds.map((background, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1780
+ className: "univer-min-h-0 univer-w-full univer-flex-1",
1781
+ style: {
1782
+ background,
1783
+ border: background ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT
1784
+ }
1785
+ }, index))
1746
1786
  }, item);
1747
- })]
1748
- }), customSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "univer-h-px univer-w-full univer-bg-gray-200" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1749
- className: "univer-flex univer-flex-col univer-gap-2 univer-p-2",
1750
- children: [
1751
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1752
- className: "univer-flex univer-h-9 univer-gap-2",
1753
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1754
- className: (0, _univerjs_design.clsx)("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", _univerjs_design.borderClassName, {
1755
- "univer-text-white": headerBgIsDark,
1756
- "univer-text-gray-900": !headerBgIsDark
1757
- }),
1758
- style: { background: headerBg },
1759
- children: localeService.t("sheets-table-ui.header")
1760
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
1761
- overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1762
- className: "univer-p-2",
1763
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ColorPicker, {
1764
- value: headerBg,
1765
- onChange: (val) => {
1766
- const headerRowStyle = (0, _univerjs_sheets_table.processStyleWithBorderStyle)("headerRowStyle", {
1767
- bg: { rgb: val },
1768
- cl: { rgb: new _univerjs_core.ColorKit(val).isDark() ? "#fff" : "#000" }
1769
- });
1770
- setCustomTheme(table.getTableStyleId(), { headerRowStyle });
1771
- }
1772
- })
1773
- }),
1774
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1775
- className: (0, _univerjs_design.clsx)("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", _univerjs_design.borderClassName),
1776
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1777
- className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName, {
1778
- "univer-text-white": headerBgIsDark,
1779
- "univer-text-gray-900": !headerBgIsDark
1780
- }),
1781
- style: { background: headerBg }
1782
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1783
- })
1784
- })]
1785
- }),
1786
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1787
- className: "univer-flex univer-h-9 univer-gap-2",
1788
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1789
- className: (0, _univerjs_design.clsx)("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", _univerjs_design.borderClassName, {
1790
- "univer-text-white": firstRowBgIsDark,
1791
- "univer-text-gray-900": !firstRowBgIsDark
1792
- }),
1793
- style: { background: firstRowBg },
1794
- children: localeService.t("sheets-table-ui.firstLine")
1795
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
1796
- overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1797
- className: "univer-p-2",
1798
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ColorPicker, {
1799
- value: firstRowBg,
1800
- onChange: (val) => {
1801
- setCustomTheme(table.getTableStyleId(), { firstRowStyle: {
1802
- bg: { rgb: val },
1803
- cl: { rgb: new _univerjs_core.ColorKit(val).isDark() ? "#fff" : "#000" }
1804
- } });
1787
+ })
1788
+ })]
1789
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1790
+ className: "univer-flex univer-flex-col univer-gap-2",
1791
+ children: [
1792
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", {
1793
+ className: "univer-m-0 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300",
1794
+ children: localeService.t("sheets-table-ui.customStyle")
1795
+ }),
1796
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1797
+ className: "univer-grid univer-grid-cols-5 univer-gap-2 univer-rounded-lg univer-bg-gray-50 univer-p-2 dark:!univer-bg-gray-800",
1798
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1799
+ type: "button",
1800
+ "data-u-comp": "sheet-table-theme-add",
1801
+ "aria-label": localeService.t("sheets-table-ui.setTheme"),
1802
+ className: "univer-flex univer-h-12 univer-w-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-lg univer-border univer-border-dashed univer-border-gray-300 univer-bg-gray-0 univer-p-0 univer-text-gray-500 univer-transition-colors hover:univer-border-primary-500 hover:univer-text-primary-600 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-border-gray-600 dark:!univer-bg-gray-900 dark:!univer-text-gray-300",
1803
+ onClick: handleAddCustomTheme,
1804
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.IncreaseIcon, { className: "univer-size-4" })
1805
+ }), customRangeThemes.map((item) => {
1806
+ var _rangeThemeItem$getHe2, _rangeThemeItem$getFi2, _rangeThemeItem$getSe2, _rangeThemeItem$getLa2;
1807
+ const rangeThemeItem = rangeThemeModel.getCustomRangeThemeStyle(unitId, item);
1808
+ const rowBackgrounds = [
1809
+ rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getHe2 = rangeThemeItem.getHeaderRowStyle()) === null || _rangeThemeItem$getHe2 === void 0 || (_rangeThemeItem$getHe2 = _rangeThemeItem$getHe2.bg) === null || _rangeThemeItem$getHe2 === void 0 ? void 0 : _rangeThemeItem$getHe2.rgb,
1810
+ rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getFi2 = rangeThemeItem.getFirstRowStyle()) === null || _rangeThemeItem$getFi2 === void 0 || (_rangeThemeItem$getFi2 = _rangeThemeItem$getFi2.bg) === null || _rangeThemeItem$getFi2 === void 0 ? void 0 : _rangeThemeItem$getFi2.rgb,
1811
+ rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getSe2 = rangeThemeItem.getSecondRowStyle()) === null || _rangeThemeItem$getSe2 === void 0 || (_rangeThemeItem$getSe2 = _rangeThemeItem$getSe2.bg) === null || _rangeThemeItem$getSe2 === void 0 ? void 0 : _rangeThemeItem$getSe2.rgb,
1812
+ rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getLa2 = rangeThemeItem.getLastRowStyle()) === null || _rangeThemeItem$getLa2 === void 0 || (_rangeThemeItem$getLa2 = _rangeThemeItem$getLa2.bg) === null || _rangeThemeItem$getLa2 === void 0 ? void 0 : _rangeThemeItem$getLa2.rgb
1813
+ ];
1814
+ const selected = item === themeConfig.theme;
1815
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1816
+ className: "univer-group univer-relative univer-h-12 univer-min-w-0",
1817
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1818
+ type: "button",
1819
+ title: item,
1820
+ "aria-label": item,
1821
+ "aria-pressed": selected,
1822
+ className: (0, _univerjs_design.clsx)("univer-flex univer-size-full univer-cursor-pointer univer-flex-col univer-overflow-hidden univer-rounded-lg univer-bg-gray-0 univer-p-1 univer-shadow-sm univer-transition-all hover:univer-border-gray-400 hover:univer-shadow-md focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-bg-gray-900", _univerjs_design.borderClassName, { "!univer-border-primary-500 univer-ring-2 univer-ring-primary-100": selected }),
1823
+ onClick: () => handleThemeChange(item),
1824
+ children: rowBackgrounds.map((background, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1825
+ className: "univer-min-h-0 univer-w-full univer-flex-1",
1826
+ style: {
1827
+ background: background ?? "none",
1828
+ border: background ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT
1805
1829
  }
1806
- })
1807
- }),
1808
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1809
- className: (0, _univerjs_design.clsx)("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", _univerjs_design.borderClassName),
1810
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1811
- className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName),
1812
- style: { background: firstRowBg }
1813
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1814
- })
1815
- })]
1816
- }),
1817
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1818
- className: "univer-flex univer-h-9 univer-gap-2",
1830
+ }, index))
1831
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1832
+ type: "button",
1833
+ "data-u-comp": "sheet-table-theme-remove",
1834
+ "aria-label": `${localeService.t("sheets-table-ui.customStyle")} ${item}`,
1835
+ className: (0, _univerjs_design.clsx)("univer-absolute univer-right-[-6px] univer-top-[-6px] univer-z-10 univer-flex univer-size-5 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-gray-200 univer-bg-gray-0 univer-p-0 univer-text-gray-500 univer-shadow-sm univer-transition-all hover:univer-border-red-200 hover:univer-bg-red-50 hover:univer-text-red-600 focus:univer-opacity-100 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 rtl:univer-left-[-6px] rtl:univer-right-auto dark:!univer-border-gray-600 dark:!univer-bg-gray-900", {
1836
+ "univer-opacity-100": selected,
1837
+ "univer-opacity-0 group-focus-within:univer-opacity-100 group-hover:univer-opacity-100": !selected
1838
+ }),
1839
+ onClick: (event) => {
1840
+ event.stopPropagation();
1841
+ removeCustomTheme(item);
1842
+ },
1843
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, { className: "univer-size-3" })
1844
+ })]
1845
+ }, item);
1846
+ })]
1847
+ }),
1848
+ customSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1849
+ className: "univer-flex univer-flex-col univer-gap-2 univer-rounded-lg univer-bg-gray-50 univer-p-3 dark:!univer-bg-gray-800",
1850
+ children: customThemeRows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1851
+ className: "univer-flex univer-h-10 univer-min-w-0 univer-gap-2",
1819
1852
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1820
- className: (0, _univerjs_design.clsx)("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", _univerjs_design.borderClassName, {
1821
- "univer-text-white": secondRowBgIsDark,
1822
- "univer-text-gray-900": !secondRowBgIsDark
1853
+ className: (0, _univerjs_design.clsx)("univer-flex univer-min-w-0 univer-flex-1 univer-items-center univer-rounded-md univer-px-3 univer-text-sm univer-font-medium rtl:univer-text-right", _univerjs_design.borderClassName, {
1854
+ "univer-text-gray-0": row.isDark,
1855
+ "univer-text-gray-900": !row.isDark
1823
1856
  }),
1824
- style: { background: secondRowBg },
1825
- children: localeService.t("sheets-table-ui.secondLine")
1826
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
1827
- overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1828
- className: "univer-p-2",
1829
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ColorPicker, {
1830
- value: secondRowBg,
1831
- onChange: (val) => setCustomTheme(table.getTableStyleId(), { secondRowStyle: {
1832
- bg: { rgb: val },
1833
- cl: { rgb: new _univerjs_core.ColorKit(val).isDark() ? "#fff" : "#000" }
1834
- } })
1835
- })
1836
- }),
1837
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1838
- className: (0, _univerjs_design.clsx)("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", _univerjs_design.borderClassName),
1839
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1840
- className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName),
1841
- style: { background: secondRowBg }
1842
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1857
+ style: { background: row.background },
1858
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1859
+ className: "univer-truncate",
1860
+ children: row.label
1843
1861
  })
1844
- })]
1845
- }),
1846
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1847
- className: "univer-flex univer-h-9 univer-gap-2",
1848
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1849
- className: (0, _univerjs_design.clsx)("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", _univerjs_design.borderClassName, {
1850
- "univer-text-white": lastRowBgIsDark,
1851
- "univer-text-gray-900": !lastRowBgIsDark
1852
- }),
1853
- style: { background: lastRowBg },
1854
- children: localeService.t("sheets-table-ui.footer")
1855
1862
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
1856
1863
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1864
+ dir: direction,
1857
1865
  className: "univer-p-2",
1858
1866
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ColorPicker, {
1859
- value: lastRowBg,
1860
- onChange: (val) => {
1861
- const lastRowStyle = (0, _univerjs_sheets_table.processStyleWithBorderStyle)("lastRowStyle", {
1862
- bg: { rgb: val },
1863
- cl: { rgb: new _univerjs_core.ColorKit(val).isDark() ? "#fff" : "#000" }
1864
- });
1865
- setCustomTheme(table.getTableStyleId(), { lastRowStyle });
1866
- }
1867
+ value: new _univerjs_core.ColorKit(row.background).toHexString(),
1868
+ onChange: row.onChange
1867
1869
  })
1868
1870
  }),
1869
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1870
- className: (0, _univerjs_design.clsx)("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", _univerjs_design.borderClassName),
1871
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1872
- className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName),
1873
- style: { background: lastRowBg }
1874
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1871
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1872
+ type: "button",
1873
+ "aria-label": `${row.label} ${localeService.t("sheets-table-ui.setTheme")}`,
1874
+ className: (0, _univerjs_design.clsx)("univer-flex univer-h-10 univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-md univer-bg-gray-0 univer-px-2 univer-text-gray-600 univer-transition-colors hover:univer-bg-gray-100 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-bg-gray-900 dark:!univer-text-gray-300", _univerjs_design.borderClassName),
1875
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1876
+ className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-full", _univerjs_design.borderClassName),
1877
+ style: { background: row.background }
1878
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-3" })]
1875
1879
  })
1876
1880
  })]
1877
- })
1878
- ]
1879
- })] })]
1880
- })
1881
- ] });
1881
+ }, row.key))
1882
+ })
1883
+ ]
1884
+ })]
1885
+ });
1882
1886
  };
1883
1887
 
1884
1888
  //#endregion
@@ -1907,7 +1911,11 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
1907
1911
  this._registerIcons();
1908
1912
  }
1909
1913
  _registerComponents() {
1910
- [[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel], [SHEET_TABLE_RENAME_DIALOG, SheetTableRenameDialog]].forEach(([key, comp]) => {
1914
+ [
1915
+ [SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel],
1916
+ [SHEET_TABLE_MENU, SheetTableMenu],
1917
+ [SHEET_TABLE_RENAME_DIALOG, SheetTableRenameDialog]
1918
+ ].forEach(([key, comp]) => {
1911
1919
  this.disposeWithMe(this._componentManager.register(key, comp));
1912
1920
  });
1913
1921
  [[TABLE_SELECTOR_DIALOG, SheetTableSelector], [SHEET_TABLE_THEME_PANEL, SheetTableThemePanel]].forEach(([key, comp]) => {
@@ -1922,14 +1930,6 @@ ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)
1922
1930
 
1923
1931
  //#endregion
1924
1932
  //#region src/views/widgets/table-controls-util.ts
1925
- const TABLE_CONTROL_MENU_WIDTH = 168;
1926
- const TABLE_CONTROL_MENU_ITEM_HEIGHT = 32;
1927
- const TABLE_CONTROL_MENU_ACTIONS = [
1928
- "rename",
1929
- "update-range",
1930
- "set-theme",
1931
- "delete"
1932
- ];
1933
1933
  function isPointInTableControlRegion(region, x, y) {
1934
1934
  return x >= region.left && x <= region.left + region.width && y >= region.top && y <= region.top + region.height;
1935
1935
  }
@@ -1937,17 +1937,6 @@ function hitTestTableControl(regions, x, y) {
1937
1937
  for (let i = regions.length - 1; i >= 0; i--) if (isPointInTableControlRegion(regions[i], x, y)) return regions[i];
1938
1938
  return null;
1939
1939
  }
1940
- function buildTableMenuRegions(tableId, left, top) {
1941
- return TABLE_CONTROL_MENU_ACTIONS.map((action, index) => ({
1942
- type: "menu-item",
1943
- tableId,
1944
- action,
1945
- left,
1946
- top: top + index * 32,
1947
- width: 168,
1948
- height: 32
1949
- }));
1950
- }
1951
1940
  function buildCenteredPlusSegments(centerX, centerY, size) {
1952
1941
  const halfSize = size / 2;
1953
1942
  return [{
@@ -1973,9 +1962,6 @@ const ANCHOR_OFFSET_Y = 0;
1973
1962
  const ANCHOR_BORDER = "rgba(0, 0, 0, 0.22)";
1974
1963
  const ANCHOR_DIVIDER = "rgba(0, 0, 0, 0.20)";
1975
1964
  const ANCHOR_TOGGLE_BG_ACTIVE = "rgba(0, 0, 0, 0.12)";
1976
- const MENU_RADIUS = 8;
1977
- const MENU_BORDER = "#d9dee7";
1978
- const MENU_HOVER_BG = "#f1f3f4";
1979
1965
  const INSERT_BUTTON_VISUAL_SIZE = 18;
1980
1966
  const INSERT_BUTTON_PLUS_SIZE = 8;
1981
1967
  var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
@@ -1991,21 +1977,11 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
1991
1977
  _defineProperty(this, "_openedMenuTableId", null);
1992
1978
  _defineProperty(this, "_hoveredRegion", null);
1993
1979
  _defineProperty(this, "_hoveredInsertRegion", null);
1994
- _defineProperty(this, "_menuLabels", {
1995
- rename: "Rename table",
1996
- "update-range": "Update range",
1997
- "set-theme": "Set theme",
1998
- delete: "Remove table"
1999
- });
2000
1980
  }
2001
1981
  setItems(items) {
2002
1982
  this._items = items;
2003
1983
  this.makeDirty(true);
2004
1984
  }
2005
- setMenuLabels(labels) {
2006
- this._menuLabels = labels;
2007
- this.makeDirty(true);
2008
- }
2009
1985
  setOpenedMenuTableId(tableId) {
2010
1986
  if (this._openedMenuTableId === tableId) return;
2011
1987
  this._openedMenuTableId = tableId;
@@ -2014,6 +1990,9 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
2014
1990
  getOpenedMenuTableId() {
2015
1991
  return this._openedMenuTableId;
2016
1992
  }
1993
+ getAnchorRegion(tableId) {
1994
+ return this._regions.find((region) => region.type === "anchor-main" && region.tableId === tableId) ?? null;
1995
+ }
2017
1996
  setHoveredRegion(region) {
2018
1997
  if (this._hoveredRegion === region) return;
2019
1998
  this._hoveredRegion = region;
@@ -2093,7 +2072,6 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
2093
2072
  height: 28
2094
2073
  });
2095
2074
  this._regions.push(toggleRegion);
2096
- if (this._openedMenuTableId === item.tableId) this._drawMenu(ctx, item.tableId, left, top + 28);
2097
2075
  }
2098
2076
  _drawAnchorToggle(ctx, anchorWidth, color, active) {
2099
2077
  const toggleLeft = anchorWidth - ANCHOR_TOGGLE_WIDTH;
@@ -2154,34 +2132,6 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
2154
2132
  ctx.fill();
2155
2133
  ctx.restore();
2156
2134
  }
2157
- _drawMenu(ctx, tableId, left, top) {
2158
- const regions = buildTableMenuRegions(tableId, left, top);
2159
- ctx.save();
2160
- ctx.translateWithPrecision(left, top);
2161
- _univerjs_engine_render.Rect.drawWith(ctx, {
2162
- width: 168,
2163
- height: regions.length * 32,
2164
- radius: MENU_RADIUS,
2165
- fill: "#fff",
2166
- stroke: MENU_BORDER
2167
- });
2168
- ctx.restore();
2169
- for (const region of regions) {
2170
- if (this._isSameRegion(this._hoveredRegion, region)) {
2171
- ctx.save();
2172
- ctx.fillStyle = MENU_HOVER_BG;
2173
- ctx.fillRectByPrecision(region.left, region.top, region.width, region.height);
2174
- ctx.restore();
2175
- }
2176
- ctx.save();
2177
- ctx.font = `12px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
2178
- ctx.fillStyle = region.action === "delete" ? "#d92d20" : "#344054";
2179
- ctx.textAlign = "left";
2180
- ctx.fillText(this._menuLabels[region.action], region.left + 12, region.top + region.height / 2);
2181
- ctx.restore();
2182
- }
2183
- this._regions.push(...regions);
2184
- }
2185
2135
  _drawInsertButton(ctx, region, fill) {
2186
2136
  const centerX = region.left + region.width / 2;
2187
2137
  const centerY = region.top + region.height / 2;
@@ -2205,7 +2155,7 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
2205
2155
  ctx.restore();
2206
2156
  }
2207
2157
  _isSameRegion(a, b) {
2208
- return Boolean(a && a.type === b.type && a.tableId === b.tableId && a.action === b.action && a.index === b.index);
2158
+ return Boolean(a && a.type === b.type && a.tableId === b.tableId && a.index === b.index);
2209
2159
  }
2210
2160
  };
2211
2161
 
@@ -2226,7 +2176,7 @@ function isSameTopGap(left, right) {
2226
2176
  return left.size === right.size && left.color === right.color && left.stripeColor === right.stripeColor;
2227
2177
  }
2228
2178
  let SheetTableControlsRenderController = class SheetTableControlsRenderController extends _univerjs_core.Disposable {
2229
- constructor(_context, _injector, _sheetSkeletonManagerService, _commandService, _tableManager, _rangeThemeModel, _workbookPermissionService, _permissionService, _sheetsSelectionsService, _selectionRenderService, _sheetTableThemeUIController, _localeService, _dialogService, _sidebarService) {
2179
+ constructor(_context, _injector, _sheetSkeletonManagerService, _commandService, _tableManager, _rangeThemeModel, _workbookPermissionService, _permissionService, _sheetsSelectionsService, _selectionRenderService, _sheetTableThemeUIController, _localeService, _dialogService, _sidebarService, _sheetCanvasPopupService) {
2230
2180
  super();
2231
2181
  this._context = _context;
2232
2182
  this._injector = _injector;
@@ -2242,8 +2192,10 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
2242
2192
  this._localeService = _localeService;
2243
2193
  this._dialogService = _dialogService;
2244
2194
  this._sidebarService = _sidebarService;
2195
+ this._sheetCanvasPopupService = _sheetCanvasPopupService;
2245
2196
  _defineProperty(this, "_shape", void 0);
2246
2197
  _defineProperty(this, "_topGapBaseBySkeleton", /* @__PURE__ */ new WeakMap());
2198
+ _defineProperty(this, "_menuPopup", null);
2247
2199
  this._shape = new SheetTableControlsShape("SheetTableControlsShape", () => this._sheetSkeletonManagerService.getCurrentSkeleton() || null);
2248
2200
  this._initShape();
2249
2201
  this._initRefresh();
@@ -2253,6 +2205,7 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
2253
2205
  var _this$_context$compon;
2254
2206
  this._context.scene.addObjects([this._shape], TABLE_CONTROLS_LAYER_INDEX);
2255
2207
  this.disposeWithMe((0, _univerjs_core.toDisposable)(() => {
2208
+ this._closeFloatingControls();
2256
2209
  this._context.scene.removeObjects([this._shape]);
2257
2210
  }));
2258
2211
  this.disposeWithMe(this._shape.onPointerMove$.subscribeEvent((evt, state) => {
@@ -2299,12 +2252,6 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
2299
2252
  return;
2300
2253
  }
2301
2254
  this._syncTopTableGap(skeleton);
2302
- this._shape.setMenuLabels({
2303
- rename: this._localeService.t("sheets-table-ui.rename"),
2304
- "update-range": this._localeService.t("sheets-table-ui.updateRange"),
2305
- "set-theme": this._localeService.t("sheets-table-ui.setTheme"),
2306
- delete: this._localeService.t("sheets-table-ui.removeTable")
2307
- });
2308
2255
  const unitId = this._context.unit.getUnitId();
2309
2256
  const subUnitId = worksheet.getSheetId();
2310
2257
  const items = this._tableManager.getTablesBySubunitId(unitId, subUnitId).map((table) => {
@@ -2368,7 +2315,7 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
2368
2315
  const unitId = this._context.unit.getUnitId();
2369
2316
  const subUnitId = worksheet.getSheetId();
2370
2317
  if (hit.type === "anchor-menu-toggle" || hit.type === "anchor-main") {
2371
- this._shape.setOpenedMenuTableId(this._shape.getOpenedMenuTableId() === hit.tableId ? null : hit.tableId);
2318
+ this._toggleTableMenu(unitId, subUnitId, hit.tableId);
2372
2319
  return;
2373
2320
  }
2374
2321
  if (hit.type === "insert-row") {
@@ -2391,28 +2338,65 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
2391
2338
  count: 1
2392
2339
  });
2393
2340
  this._closeFloatingControls();
2341
+ }
2342
+ }
2343
+ _toggleTableMenu(unitId, subUnitId, tableId) {
2344
+ if (this._shape.getOpenedMenuTableId() === tableId) {
2345
+ this._closeFloatingControls();
2394
2346
  return;
2395
2347
  }
2396
- if (hit.type !== "menu-item") return;
2397
- switch (hit.action) {
2348
+ const table = this._tableManager.getTableById(unitId, tableId);
2349
+ const anchor = this._shape.getAnchorRegion(tableId);
2350
+ if (!table || !anchor) return;
2351
+ this._closeFloatingControls();
2352
+ this._shape.setOpenedMenuTableId(tableId);
2353
+ const range = table.getRange();
2354
+ this._menuPopup = this._sheetCanvasPopupService.attachPopupByPosition({
2355
+ left: anchor.left,
2356
+ right: anchor.left + anchor.width,
2357
+ top: anchor.top,
2358
+ bottom: anchor.top + anchor.height
2359
+ }, {
2360
+ componentKey: "SHEET_TABLE_MENU",
2361
+ direction: "bottom-left",
2362
+ extraProps: {
2363
+ anchorWidth: anchor.width,
2364
+ tableName: table.getDisplayName(),
2365
+ labels: {
2366
+ rename: this._localeService.t("sheets-table-ui.rename"),
2367
+ "update-range": this._localeService.t("sheets-table-ui.updateRange"),
2368
+ "set-theme": this._localeService.t("sheets-table-ui.setTheme"),
2369
+ delete: this._localeService.t("sheets-table-ui.removeTable")
2370
+ },
2371
+ onSelect: (action) => this._handleTableMenuAction(action, unitId, subUnitId, tableId),
2372
+ onClose: () => this._closeFloatingControls()
2373
+ }
2374
+ }, {
2375
+ unitId,
2376
+ subUnitId,
2377
+ row: range.startRow,
2378
+ col: range.startColumn
2379
+ }) ?? null;
2380
+ if (!this._menuPopup) this._shape.setOpenedMenuTableId(null);
2381
+ }
2382
+ _handleTableMenuAction(action, unitId, subUnitId, tableId) {
2383
+ this._closeFloatingControls();
2384
+ switch (action) {
2398
2385
  case "rename":
2399
- this._openRenameDialog(unitId, hit.tableId);
2400
- break;
2401
- case "update-range":
2402
- this._openRangeSelector(unitId, subUnitId, hit.tableId);
2386
+ this._openRenameDialog(unitId, tableId);
2403
2387
  break;
2388
+ case "update-range": return this._openRangeSelector(unitId, subUnitId, tableId);
2404
2389
  case "set-theme":
2405
- this._openThemePanel(unitId, subUnitId, hit.tableId);
2390
+ this._openThemePanel(unitId, subUnitId, tableId);
2406
2391
  break;
2407
2392
  case "delete":
2408
2393
  this._commandService.executeCommand(_univerjs_sheets_table.DeleteSheetTableCommand.id, {
2409
- tableId: hit.tableId,
2394
+ tableId,
2410
2395
  subUnitId,
2411
2396
  unitId
2412
2397
  });
2413
2398
  break;
2414
2399
  }
2415
- this._closeFloatingControls();
2416
2400
  }
2417
2401
  _openRenameDialog(unitId, tableId) {
2418
2402
  this._dialogService.open({
@@ -2449,13 +2433,15 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
2449
2433
  this._sidebarService.open({
2450
2434
  id: SHEET_TABLE_THEME_PANEL_ID,
2451
2435
  header: { title: this._localeService.t("sheets-table-ui.tableStyle") },
2452
- children: {
2453
- label: SHEET_TABLE_THEME_PANEL,
2454
- oldConfig: table.getTableConfig(),
2455
- unitId,
2456
- subUnitId,
2457
- tableId
2458
- },
2436
+ children: { label: {
2437
+ name: SHEET_TABLE_THEME_PANEL,
2438
+ props: {
2439
+ oldConfig: table.getTableConfig(),
2440
+ unitId,
2441
+ subUnitId,
2442
+ tableId
2443
+ }
2444
+ } },
2459
2445
  width: 330
2460
2446
  });
2461
2447
  }
@@ -2535,6 +2521,9 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
2535
2521
  this._selectionRenderService.resetSelectionsByModelData(this._sheetsSelectionsService.getCurrentSelections());
2536
2522
  }
2537
2523
  _closeFloatingControls() {
2524
+ const menuPopup = this._menuPopup;
2525
+ this._menuPopup = null;
2526
+ menuPopup === null || menuPopup === void 0 || menuPopup.dispose();
2538
2527
  this._shape.setOpenedMenuTableId(null);
2539
2528
  this._shape.setHoveredInsertRegion(null);
2540
2529
  this._shape.setHoveredRegion(null);
@@ -2561,7 +2550,8 @@ SheetTableControlsRenderController = __decorate([
2561
2550
  __decorateParam(10, (0, _univerjs_core.Inject)(SheetTableThemeUIController)),
2562
2551
  __decorateParam(11, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
2563
2552
  __decorateParam(12, _univerjs_ui.IDialogService),
2564
- __decorateParam(13, _univerjs_ui.ISidebarService)
2553
+ __decorateParam(13, _univerjs_ui.ISidebarService),
2554
+ __decorateParam(14, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetCanvasPopManagerService))
2565
2555
  ], SheetTableControlsRenderController);
2566
2556
 
2567
2557
  //#endregion