@univerjs/sheets-table-ui 0.22.1 → 0.23.0-insiders.20260522-ee0b0a4

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 (66) hide show
  1. package/lib/cjs/index.js +816 -385
  2. package/lib/cjs/locale/ca-ES.js +6 -0
  3. package/lib/cjs/locale/en-US.js +6 -0
  4. package/lib/cjs/locale/es-ES.js +6 -0
  5. package/lib/cjs/locale/fa-IR.js +6 -0
  6. package/lib/cjs/locale/fr-FR.js +6 -0
  7. package/lib/cjs/locale/ja-JP.js +6 -0
  8. package/lib/cjs/locale/ko-KR.js +6 -0
  9. package/lib/cjs/locale/ru-RU.js +6 -0
  10. package/lib/cjs/locale/sk-SK.js +6 -0
  11. package/lib/cjs/locale/vi-VN.js +6 -0
  12. package/lib/cjs/locale/zh-CN.js +6 -0
  13. package/lib/cjs/locale/zh-TW.js +6 -0
  14. package/lib/es/index.js +824 -393
  15. package/lib/es/locale/ca-ES.js +6 -0
  16. package/lib/es/locale/en-US.js +6 -0
  17. package/lib/es/locale/es-ES.js +6 -0
  18. package/lib/es/locale/fa-IR.js +6 -0
  19. package/lib/es/locale/fr-FR.js +6 -0
  20. package/lib/es/locale/ja-JP.js +6 -0
  21. package/lib/es/locale/ko-KR.js +6 -0
  22. package/lib/es/locale/ru-RU.js +6 -0
  23. package/lib/es/locale/sk-SK.js +6 -0
  24. package/lib/es/locale/vi-VN.js +6 -0
  25. package/lib/es/locale/zh-CN.js +6 -0
  26. package/lib/es/locale/zh-TW.js +6 -0
  27. package/lib/index.css +63 -47
  28. package/lib/index.js +824 -393
  29. package/lib/locale/ca-ES.js +6 -0
  30. package/lib/locale/en-US.js +6 -0
  31. package/lib/locale/es-ES.js +6 -0
  32. package/lib/locale/fa-IR.js +6 -0
  33. package/lib/locale/fr-FR.js +6 -0
  34. package/lib/locale/ja-JP.js +6 -0
  35. package/lib/locale/ko-KR.js +6 -0
  36. package/lib/locale/ru-RU.js +6 -0
  37. package/lib/locale/sk-SK.js +6 -0
  38. package/lib/locale/vi-VN.js +6 -0
  39. package/lib/locale/zh-CN.js +6 -0
  40. package/lib/locale/zh-TW.js +6 -0
  41. package/lib/types/const.d.ts +2 -0
  42. package/lib/types/controllers/sheet-table-component.controller.d.ts +2 -0
  43. package/lib/types/controllers/sheet-table-controls-render.controller.d.ts +60 -0
  44. package/lib/types/controllers/sheet-table-filter-button-render.controller.d.ts +3 -2
  45. package/lib/types/locale/en-US.d.ts +6 -0
  46. package/lib/types/views/components/{SheetTableAnchor.d.ts → SheetTableRenameDialog.d.ts} +6 -1
  47. package/lib/types/views/widgets/table-controls-util.d.ts +37 -0
  48. package/lib/types/views/widgets/table-controls.shape.d.ts +63 -0
  49. package/lib/types/views/widgets/table-filter-button.shape.d.ts +10 -5
  50. package/lib/umd/index.js +1 -1
  51. package/lib/umd/locale/ca-ES.js +1 -1
  52. package/lib/umd/locale/en-US.js +1 -1
  53. package/lib/umd/locale/es-ES.js +1 -1
  54. package/lib/umd/locale/fa-IR.js +1 -1
  55. package/lib/umd/locale/fr-FR.js +1 -1
  56. package/lib/umd/locale/ja-JP.js +1 -1
  57. package/lib/umd/locale/ko-KR.js +1 -1
  58. package/lib/umd/locale/ru-RU.js +1 -1
  59. package/lib/umd/locale/sk-SK.js +1 -1
  60. package/lib/umd/locale/vi-VN.js +1 -1
  61. package/lib/umd/locale/zh-CN.js +1 -1
  62. package/lib/umd/locale/zh-TW.js +1 -1
  63. package/package.json +13 -13
  64. package/LICENSE +0 -176
  65. package/lib/types/controllers/sheet-table-anchor.controller.d.ts +0 -50
  66. /package/lib/types/services/{sheets-table-ui-service.d.ts → sheets-table-ui.service.d.ts} +0 -0
package/lib/cjs/index.js CHANGED
@@ -16,7 +16,7 @@ let _univerjs_sheets_formula_ui = require("@univerjs/sheets-formula-ui");
16
16
 
17
17
  //#region package.json
18
18
  var name = "@univerjs/sheets-table-ui";
19
- var version = "0.22.1";
19
+ var version = "0.23.0-insiders.20260522-ee0b0a4";
20
20
 
21
21
  //#endregion
22
22
  //#region src/const.ts
@@ -40,6 +40,8 @@ const SHEETS_TABLE_FILTER_PANEL_OPENED_KEY = "SHEETS_TABLE_FILTER_PANEL_OPENED_K
40
40
  const UNIVER_SHEET_TABLE_FILTER_PANEL_ID = "UNIVER_SHEET_Table_FILTER_PANEL_ID";
41
41
  const TABLE_TOOLBAR_BUTTON = "TABLE_TOOLBAR_BUTTON";
42
42
  const TABLE_SELECTOR_DIALOG = "TABLE_SELECTOR_DIALOG";
43
+ const SHEET_TABLE_RENAME_DIALOG = "SHEET_TABLE_RENAME_DIALOG";
44
+ const SHEET_TABLE_RENAME_DIALOG_ID = "SHEET_TABLE_RENAME_DIALOG_ID";
43
45
  const SHEET_TABLE_THEME_PANEL_ID = "SHEET_TABLE_THEME_PANEL_ID";
44
46
  const SHEET_TABLE_THEME_PANEL = "SHEET_TABLE_THEME_PANEL";
45
47
  const TABLE_CUSTOM_NAME_PREFIX = "table-custom-";
@@ -108,7 +110,7 @@ function __decorate(decorators, target, key, desc) {
108
110
  }
109
111
 
110
112
  //#endregion
111
- //#region src/services/sheets-table-ui-service.ts
113
+ //#region src/services/sheets-table-ui.service.ts
112
114
  let SheetsTableUiService = class SheetsTableUiService extends _univerjs_core.Disposable {
113
115
  constructor(_tableManager, _sheetTableService, _univerInstanceService, _commandService, _localeService) {
114
116
  super();
@@ -852,9 +854,12 @@ function SheetTableFilterPanel() {
852
854
  const table = tableManager.getTable(unitId, tableId);
853
855
  if (!table) return null;
854
856
  const tableFilters = table.getTableFilters();
857
+ const tableRange = table.getRange();
855
858
  const sortState = tableFilters.getSortState();
856
859
  sortState.columnIndex === columnIndex && (sortState.sortState, _univerjs_sheets_table.SheetsTableSortStateEnum.Asc);
857
860
  sortState.columnIndex === columnIndex && (sortState.sortState, _univerjs_sheets_table.SheetsTableSortStateEnum.Desc);
861
+ const absoluteColumn = tableFilterPanelInfo.column;
862
+ const canDeleteColumn = tableRange.endColumn > tableRange.startColumn;
858
863
  const closeDialog = () => {
859
864
  sheetsTableComponentController.closeFilterPanel();
860
865
  };
@@ -876,6 +881,27 @@ function SheetTableFilterPanel() {
876
881
  tableFilters.setSortState(columnIndex, asc ? _univerjs_sheets_table.SheetsTableSortStateEnum.Asc : _univerjs_sheets_table.SheetsTableSortStateEnum.Desc);
877
882
  closeDialog();
878
883
  };
884
+ const insertColumn = (side) => {
885
+ commandService.executeCommand(_univerjs_sheets_table.SheetTableInsertColumnAtCommand.id, {
886
+ unitId,
887
+ subUnitId,
888
+ tableId,
889
+ index: side === "left" ? absoluteColumn : absoluteColumn + 1,
890
+ count: 1
891
+ });
892
+ closeDialog();
893
+ };
894
+ const deleteColumn = () => {
895
+ if (!canDeleteColumn) return;
896
+ commandService.executeCommand(_univerjs_sheets_table.SheetTableRemoveColumnAtCommand.id, {
897
+ unitId,
898
+ subUnitId,
899
+ tableId,
900
+ index: absoluteColumn,
901
+ count: 1
902
+ });
903
+ closeDialog();
904
+ };
879
905
  const onApply = () => {
880
906
  if (filterBy === "items") {
881
907
  const filteredItems = [];
@@ -922,7 +948,39 @@ function SheetTableFilterPanel() {
922
948
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
923
949
  className: "univer-box-border univer-flex univer-min-w-[312px] 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",
924
950
  children: [
925
- ((_permissionService$ge = permissionService.getPermissionPoint(workbookEditableId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
951
+ ((_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", {
952
+ 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",
953
+ children: [
954
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
955
+ type: "button",
956
+ 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",
957
+ onClick: () => insertColumn("left"),
958
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.LeftInsertColumnDoubleIcon, {
959
+ className: "univer-size-5",
960
+ extend: { colorChannel1: "var(--univer-primary-600)" }
961
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("sheets-table.columnMenu.insert-left") })]
962
+ }),
963
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
964
+ type: "button",
965
+ 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",
966
+ onClick: () => insertColumn("right"),
967
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.RightInsertColumnDoubleIcon, {
968
+ className: "univer-size-5",
969
+ extend: { colorChannel1: "var(--univer-primary-600)" }
970
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("sheets-table.columnMenu.insert-right") })]
971
+ }),
972
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
973
+ type: "button",
974
+ 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",
975
+ disabled: !canDeleteColumn,
976
+ onClick: deleteColumn,
977
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteColumnDoubleIcon, {
978
+ className: "univer-size-5",
979
+ extend: { colorChannel1: "var(--univer-primary-600)" }
980
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("sheets-table.columnMenu.delete") })]
981
+ })
982
+ ]
983
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
926
984
  className: "univer-mb-3 univer-flex",
927
985
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.ButtonGroup, {
928
986
  className: "univer-mb-3 !univer-flex univer-w-full",
@@ -936,7 +994,7 @@ function SheetTableFilterPanel() {
936
994
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DescendingIcon, { className: "univer-mr-1" }), localeService.t("sheets-sort.general.sort-desc")]
937
995
  })]
938
996
  })
939
- }),
997
+ })] }),
940
998
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
941
999
  className: "univer-w-full",
942
1000
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Segmented, {
@@ -997,6 +1055,89 @@ function useFilterByOptions(localeService) {
997
1055
  }], [localeService.getCurrentLocale(), localeService]);
998
1056
  }
999
1057
 
1058
+ //#endregion
1059
+ //#region src/views/components/SheetTableRenameDialog.tsx
1060
+ function SheetTableRenameDialog(props) {
1061
+ var _table$getDisplayName;
1062
+ const { unitId, tableId, onClose } = props;
1063
+ const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1064
+ const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
1065
+ const tableManager = (0, _univerjs_ui.useDependency)(_univerjs_sheets_table.TableManager);
1066
+ const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
1067
+ const definedNamesService = (0, _univerjs_ui.useDependency)(_univerjs_engine_formula.IDefinedNamesService);
1068
+ const table = tableManager.getTableById(unitId, tableId);
1069
+ const [value, setValue] = (0, react.useState)((_table$getDisplayName = table === null || table === void 0 ? void 0 : table.getDisplayName()) !== null && _table$getDisplayName !== void 0 ? _table$getDisplayName : "");
1070
+ const [error, setError] = (0, react.useState)("");
1071
+ const existingNames = (0, react.useMemo)(() => {
1072
+ const names = (0, _univerjs_sheets_table.getExistingNamesSet)(unitId, {
1073
+ univerInstanceService,
1074
+ tableManager,
1075
+ definedNamesService
1076
+ });
1077
+ const currentName = table === null || table === void 0 ? void 0 : table.getDisplayName().toLowerCase();
1078
+ if (currentName) names.delete(currentName);
1079
+ return names;
1080
+ }, [
1081
+ definedNamesService,
1082
+ table,
1083
+ tableManager,
1084
+ unitId,
1085
+ univerInstanceService
1086
+ ]);
1087
+ const handleConfirm = () => {
1088
+ const nextName = value.trim();
1089
+ if (!table || nextName === table.getDisplayName()) {
1090
+ onClose();
1091
+ return;
1092
+ }
1093
+ if (!(0, _univerjs_sheets_table.validateSheetTableName)(nextName, existingNames).valid) {
1094
+ setError(localeService.t("sheets-table.tableNameError"));
1095
+ return;
1096
+ }
1097
+ commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
1098
+ unitId,
1099
+ tableId,
1100
+ name: nextName
1101
+ });
1102
+ onClose();
1103
+ };
1104
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1105
+ className: "univer-box-border univer-flex univer-w-full univer-flex-col univer-gap-4 univer-pb-3 univer-pt-2",
1106
+ children: [
1107
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
1108
+ size: "middle",
1109
+ value,
1110
+ placeholder: localeService.t("sheets-table.renamePlaceholder"),
1111
+ onChange: (nextValue) => {
1112
+ setValue(nextValue);
1113
+ setError("");
1114
+ },
1115
+ onKeyDown: (event) => {
1116
+ if (event.key === "Enter") handleConfirm();
1117
+ },
1118
+ autoFocus: true
1119
+ }),
1120
+ error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1121
+ className: "-univer-mt-2 univer-text-sm univer-text-red-500",
1122
+ children: error
1123
+ }) : null,
1124
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1125
+ className: "univer-flex univer-w-full univer-items-center univer-justify-end univer-gap-2",
1126
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1127
+ className: "univer-min-w-16",
1128
+ onClick: onClose,
1129
+ children: localeService.t("sheets-table.cancel")
1130
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1131
+ className: "univer-min-w-16",
1132
+ variant: "primary",
1133
+ onClick: handleConfirm,
1134
+ children: localeService.t("sheets-table.confirm")
1135
+ })]
1136
+ })
1137
+ ]
1138
+ });
1139
+ }
1140
+
1000
1141
  //#endregion
1001
1142
  //#region src/controllers/sheet-table-component.controller.ts
1002
1143
  let SheetsTableComponentController = class SheetsTableComponentController extends _univerjs_core.Disposable {
@@ -1014,6 +1155,22 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
1014
1155
  setCurrentTableFilterInfo(info) {
1015
1156
  this._currentTableFilterInfo = info;
1016
1157
  }
1158
+ openOrToggleFilterPanel(info) {
1159
+ const opened = this._contextService.getContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY);
1160
+ if (opened && this._isSameFilterPanelInfo(this._currentTableFilterInfo, info)) {
1161
+ this.closeFilterPanel();
1162
+ return;
1163
+ }
1164
+ this.setCurrentTableFilterInfo(info);
1165
+ if (opened) {
1166
+ var _this$_popupDisposabl;
1167
+ (_this$_popupDisposabl = this._popupDisposable) === null || _this$_popupDisposabl === void 0 || _this$_popupDisposabl.dispose();
1168
+ this._popupDisposable = null;
1169
+ this._openFilterPopup();
1170
+ return;
1171
+ }
1172
+ this._contextService.setContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, true);
1173
+ }
1017
1174
  clearCurrentTableFilterInfo() {
1018
1175
  this._currentTableFilterInfo = null;
1019
1176
  }
@@ -1021,7 +1178,7 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
1021
1178
  return this._currentTableFilterInfo;
1022
1179
  }
1023
1180
  _initComponents() {
1024
- [[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel]].forEach(([key, comp]) => {
1181
+ [[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel], [SHEET_TABLE_RENAME_DIALOG, SheetTableRenameDialog]].forEach(([key, comp]) => {
1025
1182
  this.disposeWithMe(this._componentManager.register(key, comp));
1026
1183
  });
1027
1184
  }
@@ -1050,11 +1207,14 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
1050
1207
  });
1051
1208
  }
1052
1209
  _closeFilterPopup() {
1053
- var _this$_popupDisposabl;
1054
- (_this$_popupDisposabl = this._popupDisposable) === null || _this$_popupDisposabl === void 0 || _this$_popupDisposabl.dispose();
1210
+ var _this$_popupDisposabl2;
1211
+ (_this$_popupDisposabl2 = this._popupDisposable) === null || _this$_popupDisposabl2 === void 0 || _this$_popupDisposabl2.dispose();
1055
1212
  this._popupDisposable = null;
1056
1213
  this.clearCurrentTableFilterInfo();
1057
1214
  }
1215
+ _isSameFilterPanelInfo(a, b) {
1216
+ return Boolean(a && a.unitId === b.unitId && a.subUnitId === b.subUnitId && a.tableId === b.tableId && a.column === b.column && a.row === b.row);
1217
+ }
1058
1218
  };
1059
1219
  SheetsTableComponentController = __decorate([
1060
1220
  __decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)),
@@ -1072,19 +1232,15 @@ const OpenTableFilterPanelOperation = {
1072
1232
  if (!params) return false;
1073
1233
  const { row, col, unitId, subUnitId, tableId } = params;
1074
1234
  const tableManager = accessor.get(_univerjs_sheets_table.TableManager);
1075
- const contextService = accessor.get(_univerjs_core.IContextService);
1076
1235
  const sheetsTableComponentController = accessor.get(SheetsTableComponentController);
1077
1236
  if (!tableManager.getTable(unitId, tableId)) return false;
1078
- if (!contextService.getContextValue("SHEETS_TABLE_FILTER_PANEL_OPENED_KEY")) {
1079
- sheetsTableComponentController.setCurrentTableFilterInfo({
1080
- unitId,
1081
- subUnitId,
1082
- row,
1083
- tableId,
1084
- column: col
1085
- });
1086
- contextService.setContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, true);
1087
- }
1237
+ sheetsTableComponentController.openOrToggleFilterPanel({
1238
+ unitId,
1239
+ subUnitId,
1240
+ row,
1241
+ tableId,
1242
+ column: col
1243
+ });
1088
1244
  return true;
1089
1245
  }
1090
1246
  };
@@ -1166,6 +1322,277 @@ const defaultPluginConfig = {
1166
1322
  anchorBackgroundColor: "rgb(134,139,156)"
1167
1323
  };
1168
1324
 
1325
+ //#endregion
1326
+ //#region src/views/widgets/table-controls-util.ts
1327
+ const TABLE_CONTROL_MENU_WIDTH = 168;
1328
+ const TABLE_CONTROL_MENU_ITEM_HEIGHT = 32;
1329
+ const TABLE_CONTROL_MENU_ACTIONS = [
1330
+ "rename",
1331
+ "update-range",
1332
+ "set-theme",
1333
+ "delete"
1334
+ ];
1335
+ function isPointInTableControlRegion(region, x, y) {
1336
+ return x >= region.left && x <= region.left + region.width && y >= region.top && y <= region.top + region.height;
1337
+ }
1338
+ function hitTestTableControl(regions, x, y) {
1339
+ for (let i = regions.length - 1; i >= 0; i--) if (isPointInTableControlRegion(regions[i], x, y)) return regions[i];
1340
+ return null;
1341
+ }
1342
+ function buildTableMenuRegions(tableId, left, top) {
1343
+ return TABLE_CONTROL_MENU_ACTIONS.map((action, index) => ({
1344
+ type: "menu-item",
1345
+ tableId,
1346
+ action,
1347
+ left,
1348
+ top: top + index * 32,
1349
+ width: 168,
1350
+ height: 32
1351
+ }));
1352
+ }
1353
+
1354
+ //#endregion
1355
+ //#region src/views/widgets/table-controls.shape.ts
1356
+ const ANCHOR_MIN_WIDTH = 122;
1357
+ const ANCHOR_MAX_WIDTH = 240;
1358
+ const ANCHOR_PADDING_X = 12;
1359
+ const ANCHOR_TOGGLE_WIDTH = 30;
1360
+ const ANCHOR_OFFSET_Y = 0;
1361
+ const ANCHOR_BORDER = "rgba(0, 0, 0, 0.22)";
1362
+ const ANCHOR_DIVIDER = "rgba(0, 0, 0, 0.20)";
1363
+ const ANCHOR_TOGGLE_BG_ACTIVE = "rgba(0, 0, 0, 0.12)";
1364
+ const MENU_RADIUS = 8;
1365
+ const MENU_BORDER = "#d9dee7";
1366
+ const MENU_HOVER_BG = "#f1f3f4";
1367
+ const INSERT_BUTTON_VISUAL_SIZE = 18;
1368
+ const INSERT_BUTTON_TEXT_OFFSET_Y = -1;
1369
+ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
1370
+ constructor(key, _getSkeleton) {
1371
+ super(key, {
1372
+ evented: true,
1373
+ fill: "rgba(0, 0, 0, 0)",
1374
+ zIndex: 5001
1375
+ });
1376
+ this._getSkeleton = _getSkeleton;
1377
+ _defineProperty(this, "_items", []);
1378
+ _defineProperty(this, "_regions", []);
1379
+ _defineProperty(this, "_openedMenuTableId", null);
1380
+ _defineProperty(this, "_hoveredRegion", null);
1381
+ _defineProperty(this, "_hoveredInsertRegion", null);
1382
+ _defineProperty(this, "_menuLabels", {
1383
+ rename: "Rename table",
1384
+ "update-range": "Update range",
1385
+ "set-theme": "Set theme",
1386
+ delete: "Remove table"
1387
+ });
1388
+ }
1389
+ setItems(items) {
1390
+ this._items = items;
1391
+ this.makeDirty(true);
1392
+ }
1393
+ setMenuLabels(labels) {
1394
+ this._menuLabels = labels;
1395
+ this.makeDirty(true);
1396
+ }
1397
+ setOpenedMenuTableId(tableId) {
1398
+ if (this._openedMenuTableId === tableId) return;
1399
+ this._openedMenuTableId = tableId;
1400
+ this.makeDirty(true);
1401
+ }
1402
+ getOpenedMenuTableId() {
1403
+ return this._openedMenuTableId;
1404
+ }
1405
+ setHoveredRegion(region) {
1406
+ if (this._hoveredRegion === region) return;
1407
+ this._hoveredRegion = region;
1408
+ this.makeDirty(true);
1409
+ }
1410
+ setHoveredInsertRegion(region) {
1411
+ if (this._hoveredInsertRegion === region) return;
1412
+ this._hoveredInsertRegion = region;
1413
+ this.makeDirty(true);
1414
+ }
1415
+ hitTest(x, y) {
1416
+ return hitTestTableControl(this._regions, x, y);
1417
+ }
1418
+ isHit(coord) {
1419
+ return this.hitTest(coord.x, coord.y) != null;
1420
+ }
1421
+ refreshBounds() {
1422
+ const skeleton = this._getSkeleton();
1423
+ if (!skeleton) {
1424
+ this.hide();
1425
+ return;
1426
+ }
1427
+ this.show();
1428
+ this.transformByState({
1429
+ left: 0,
1430
+ top: 0,
1431
+ width: skeleton.rowHeaderWidth + skeleton.columnTotalWidth,
1432
+ height: skeleton.columnHeaderHeight + skeleton.rowTotalHeight
1433
+ });
1434
+ }
1435
+ _draw(ctx) {
1436
+ this._regions = [];
1437
+ const skeleton = this._getSkeleton();
1438
+ if (!skeleton) return;
1439
+ ctx.save();
1440
+ ctx.textBaseline = "middle";
1441
+ for (const item of this._items) this._drawAnchor(ctx, skeleton, item);
1442
+ if (this._hoveredInsertRegion) {
1443
+ var _item$fill;
1444
+ const item = this._items.find((renderItem) => {
1445
+ var _this$_hoveredInsertR;
1446
+ return renderItem.tableId === ((_this$_hoveredInsertR = this._hoveredInsertRegion) === null || _this$_hoveredInsertR === void 0 ? void 0 : _this$_hoveredInsertR.tableId);
1447
+ });
1448
+ this._drawInsertButton(ctx, this._hoveredInsertRegion, (_item$fill = item === null || item === void 0 ? void 0 : item.fill) !== null && _item$fill !== void 0 ? _item$fill : "#355bb7");
1449
+ this._regions.push(this._hoveredInsertRegion);
1450
+ }
1451
+ ctx.restore();
1452
+ }
1453
+ _drawAnchor(ctx, skeleton, item) {
1454
+ const position = skeleton.getNoMergeCellWithCoordByIndex(item.range.startRow, item.range.startColumn);
1455
+ const left = position.startX;
1456
+ const rawTop = position.startY - 28 - ANCHOR_OFFSET_Y;
1457
+ const top = Math.max(0, rawTop);
1458
+ const width = Math.max(ANCHOR_MIN_WIDTH, Math.min(ANCHOR_MAX_WIDTH, item.tableName.length * 8.5 + ANCHOR_PADDING_X * 2 + ANCHOR_TOGGLE_WIDTH));
1459
+ const toggleRegion = {
1460
+ type: "anchor-menu-toggle",
1461
+ tableId: item.tableId,
1462
+ left: left + width - ANCHOR_TOGGLE_WIDTH,
1463
+ top,
1464
+ width: ANCHOR_TOGGLE_WIDTH,
1465
+ height: 28
1466
+ };
1467
+ ctx.save();
1468
+ ctx.translateWithPrecision(left, top);
1469
+ this._drawTopRoundedRect(ctx, width, 28, 14, item.fill, ANCHOR_BORDER);
1470
+ this._drawAnchorToggle(ctx, width, item.text, this._openedMenuTableId === item.tableId || this._isSameRegion(this._hoveredRegion, toggleRegion));
1471
+ ctx.font = `600 13px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
1472
+ ctx.fillStyle = item.text;
1473
+ ctx.textAlign = "left";
1474
+ ctx.fillText(item.tableName, ANCHOR_PADDING_X, 28 / 2);
1475
+ ctx.restore();
1476
+ this._regions.push({
1477
+ type: "anchor-main",
1478
+ tableId: item.tableId,
1479
+ left,
1480
+ top,
1481
+ width,
1482
+ height: 28
1483
+ });
1484
+ this._regions.push(toggleRegion);
1485
+ if (this._openedMenuTableId === item.tableId) this._drawMenu(ctx, item.tableId, left, top + 28);
1486
+ }
1487
+ _drawAnchorToggle(ctx, anchorWidth, color, active) {
1488
+ const toggleLeft = anchorWidth - ANCHOR_TOGGLE_WIDTH;
1489
+ if (active) this._drawRightTopRoundedRect(ctx, toggleLeft, anchorWidth, 28, 14, ANCHOR_TOGGLE_BG_ACTIVE);
1490
+ ctx.save();
1491
+ ctx.beginPath();
1492
+ ctx.strokeStyle = ANCHOR_DIVIDER;
1493
+ ctx.lineWidth = 1;
1494
+ ctx.moveTo(toggleLeft + .5, 5);
1495
+ ctx.lineTo(toggleLeft + .5, 28 - 5);
1496
+ ctx.stroke();
1497
+ ctx.restore();
1498
+ const centerX = anchorWidth - ANCHOR_TOGGLE_WIDTH / 2;
1499
+ const centerY = 28 / 2;
1500
+ ctx.save();
1501
+ ctx.beginPath();
1502
+ ctx.strokeStyle = color;
1503
+ ctx.lineWidth = 1.6;
1504
+ ctx.lineCap = "round";
1505
+ ctx.moveTo(centerX - 5, centerY - 4);
1506
+ ctx.lineTo(centerX + 5, centerY - 4);
1507
+ ctx.moveTo(centerX - 5, centerY);
1508
+ ctx.lineTo(centerX + 5, centerY);
1509
+ ctx.moveTo(centerX - 5, centerY + 4);
1510
+ ctx.lineTo(centerX + 5, centerY + 4);
1511
+ ctx.stroke();
1512
+ ctx.restore();
1513
+ }
1514
+ _drawTopRoundedRect(ctx, width, height, radius, fill, stroke) {
1515
+ const r = Math.min(radius, width / 2, height);
1516
+ ctx.beginPath();
1517
+ ctx.moveTo(0, height);
1518
+ ctx.lineTo(0, r);
1519
+ ctx.arcTo(0, 0, r, 0, r);
1520
+ ctx.lineTo(width - r, 0);
1521
+ ctx.arcTo(width, 0, width, r, r);
1522
+ ctx.lineTo(width, height);
1523
+ ctx.closePath();
1524
+ ctx.fillStyle = fill;
1525
+ ctx.fill();
1526
+ if (stroke) {
1527
+ ctx.strokeStyle = stroke;
1528
+ ctx.lineWidth = 1;
1529
+ ctx.stroke();
1530
+ }
1531
+ }
1532
+ _drawRightTopRoundedRect(ctx, left, width, height, radius, fill) {
1533
+ const r = Math.min(radius, width - left, height);
1534
+ ctx.save();
1535
+ ctx.beginPath();
1536
+ ctx.moveTo(left, height);
1537
+ ctx.lineTo(left, 0);
1538
+ ctx.lineTo(width - r, 0);
1539
+ ctx.arcTo(width, 0, width, r, r);
1540
+ ctx.lineTo(width, height);
1541
+ ctx.closePath();
1542
+ ctx.fillStyle = fill;
1543
+ ctx.fill();
1544
+ ctx.restore();
1545
+ }
1546
+ _drawMenu(ctx, tableId, left, top) {
1547
+ const regions = buildTableMenuRegions(tableId, left, top);
1548
+ ctx.save();
1549
+ ctx.translateWithPrecision(left, top);
1550
+ _univerjs_engine_render.Rect.drawWith(ctx, {
1551
+ width: 168,
1552
+ height: regions.length * 32,
1553
+ radius: MENU_RADIUS,
1554
+ fill: "#fff",
1555
+ stroke: MENU_BORDER
1556
+ });
1557
+ ctx.restore();
1558
+ for (const region of regions) {
1559
+ if (this._isSameRegion(this._hoveredRegion, region)) {
1560
+ ctx.save();
1561
+ ctx.fillStyle = MENU_HOVER_BG;
1562
+ ctx.fillRectByPrecision(region.left, region.top, region.width, region.height);
1563
+ ctx.restore();
1564
+ }
1565
+ ctx.save();
1566
+ ctx.font = `12px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
1567
+ ctx.fillStyle = region.action === "delete" ? "#d92d20" : "#344054";
1568
+ ctx.textAlign = "left";
1569
+ ctx.fillText(this._menuLabels[region.action], region.left + 12, region.top + region.height / 2);
1570
+ ctx.restore();
1571
+ }
1572
+ this._regions.push(...regions);
1573
+ }
1574
+ _drawInsertButton(ctx, region, fill) {
1575
+ const centerX = region.left + region.width / 2;
1576
+ const centerY = region.top + region.height / 2;
1577
+ const radius = INSERT_BUTTON_VISUAL_SIZE / 2;
1578
+ ctx.save();
1579
+ ctx.beginPath();
1580
+ ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
1581
+ ctx.fillStyle = "#fff";
1582
+ ctx.fill();
1583
+ ctx.strokeStyle = fill;
1584
+ ctx.stroke();
1585
+ ctx.font = `12px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
1586
+ ctx.fillStyle = fill;
1587
+ ctx.textAlign = "center";
1588
+ ctx.fillText("+", centerX, centerY + INSERT_BUTTON_TEXT_OFFSET_Y);
1589
+ ctx.restore();
1590
+ }
1591
+ _isSameRegion(a, b) {
1592
+ return Boolean(a && a.type === b.type && a.tableId === b.tableId && a.action === b.action && a.index === b.index);
1593
+ }
1594
+ };
1595
+
1169
1596
  //#endregion
1170
1597
  //#region src/controllers/sheet-table-theme-ui.controller.ts
1171
1598
  let SheetTableThemeUIController = class SheetTableThemeUIController extends _univerjs_core.Disposable {
@@ -1188,372 +1615,364 @@ let SheetTableThemeUIController = class SheetTableThemeUIController extends _uni
1188
1615
  SheetTableThemeUIController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService))], SheetTableThemeUIController);
1189
1616
 
1190
1617
  //#endregion
1191
- //#region src/views/components/SheetTableAnchor.tsx
1192
- const SheetTableAnchor = () => {
1193
- var _tableConfig$anchorHe, _tableConfig$anchorBa;
1194
- const [inputFocusId, setInputFocusId] = (0, react.useState)("");
1195
- const [inputValue, setInputValue] = (0, react.useState)("");
1196
- const sidebarService = (0, _univerjs_ui.useDependency)(_univerjs_ui.ISidebarService);
1197
- const [openStates, setOpenStates] = (0, react.useState)({});
1198
- const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
1199
- const anchorPosition = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(SheetTableAnchorController).anchorPosition$);
1200
- const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
1201
- const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
1202
- const workbookPermissionInitState = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(_univerjs_sheets.WorkbookPermissionService).unitPermissionInitStateChange$, false);
1203
- const tableManager = (0, _univerjs_ui.useDependency)(_univerjs_sheets_table.TableManager);
1204
- const rangeThemeModel = (0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetRangeThemeModel);
1205
- const tableRefresh$ = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(SheetTableThemeUIController).refreshTable$);
1206
- const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1207
- const selections = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetsSelectionsService).selectionChanged$, [{
1208
- range: (0, _univerjs_core.cellToRange)(0, 0),
1209
- primary: null
1210
- }]);
1211
- const [, setRefresh] = (0, react.useState)(Math.random());
1212
- const tableConfig = (0, _univerjs_ui.useDependency)(_univerjs_core.IConfigService).getConfig(SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY);
1213
- const anchorHeight = (_tableConfig$anchorHe = tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.anchorHeight) !== null && _tableConfig$anchorHe !== void 0 ? _tableConfig$anchorHe : 24;
1214
- const anchorBackgroundColor = (_tableConfig$anchorBa = tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.anchorBackgroundColor) !== null && _tableConfig$anchorBa !== void 0 ? _tableConfig$anchorBa : "rgb(53,91,183)";
1215
- const updateOpenState = (tableId, isOpen) => {
1216
- setOpenStates((prev) => ({
1217
- ...prev,
1218
- [tableId]: isOpen
1219
- }));
1220
- };
1221
- (0, react.useEffect)(() => {
1222
- setRefresh(Math.random());
1223
- }, [tableRefresh$]);
1224
- if (!(anchorPosition === null || anchorPosition === void 0 ? void 0 : anchorPosition.length)) return null;
1225
- const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
1226
- if (!target) return null;
1227
- const { unitId, subUnitId } = target;
1228
- const handleChangeTableName = (tableId, name) => {
1229
- var _tableManager$getTabl;
1230
- if (((_tableManager$getTabl = tableManager.getTableById(unitId, tableId)) === null || _tableManager$getTabl === void 0 ? void 0 : _tableManager$getTabl.getDisplayName()) === name) {
1231
- setInputFocusId("");
1232
- setInputValue("");
1233
- return;
1234
- }
1235
- commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
1236
- tableId,
1237
- unitId,
1238
- name
1239
- });
1240
- setInputValue("");
1241
- setInputFocusId("");
1242
- };
1243
- const handleChangeRange = async (tableId) => {
1244
- const table = tableManager.getTableById(unitId, tableId);
1245
- if (!table) return;
1246
- const selection = await openRangeSelector(injector, unitId, subUnitId, table.getRange(), tableId);
1247
- if (!selection) return;
1248
- commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
1249
- tableId,
1250
- unitId,
1251
- updateRange: { newRange: selection.range }
1252
- });
1253
- };
1254
- if (!workbookPermissionInitState) return null;
1255
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1256
- className: "univer-absolute univer-z-50 univer-size-0",
1257
- children: anchorPosition.map((item) => {
1258
- var _rangeTheme$getHeader, _rangeTheme$getHeader2, _rangeTheme$getHeader3, _rangeTheme$getHeader4, _openStates$item$tabl;
1259
- const table = tableManager.getTableById(unitId, item.tableId);
1260
- if (!table) return null;
1261
- const rangeTheme = rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId());
1262
- const headerBgColor = (_rangeTheme$getHeader = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader2 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader2 === void 0 || (_rangeTheme$getHeader2 = _rangeTheme$getHeader2.bg) === null || _rangeTheme$getHeader2 === void 0 ? void 0 : _rangeTheme$getHeader2.rgb) !== null && _rangeTheme$getHeader !== void 0 ? _rangeTheme$getHeader : anchorBackgroundColor;
1263
- const headerTextColor = (_rangeTheme$getHeader3 = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader4 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader4 === void 0 || (_rangeTheme$getHeader4 = _rangeTheme$getHeader4.cl) === null || _rangeTheme$getHeader4 === void 0 ? void 0 : _rangeTheme$getHeader4.rgb) !== null && _rangeTheme$getHeader3 !== void 0 ? _rangeTheme$getHeader3 : "rgb(255, 255, 255)";
1264
- const tableRange = table.getRange();
1265
- if (!(selections === null || selections === void 0 ? void 0 : selections.length)) return null;
1266
- const lastRange = selections[selections.length - 1].range;
1267
- const shouldHidden = !_univerjs_core.Rectangle.intersects(tableRange, lastRange) && item.y <= 20;
1268
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1269
- className: (0, _univerjs_design.clsx)("univer-shadow-xs univer-absolute univer-box-border univer-cursor-pointer univer-items-center univer-rounded-xl univer-px-2", _univerjs_design.borderClassName, {
1270
- "univer-flex": !shouldHidden,
1271
- "univer-hidden": shouldHidden
1272
- }),
1273
- style: {
1274
- left: item.x,
1275
- top: Math.max(item.y, 0),
1276
- backgroundColor: headerBgColor,
1277
- color: headerTextColor,
1278
- borderWidth: "0.5px",
1279
- height: anchorHeight ? `${anchorHeight}px` : "24px"
1280
- },
1281
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1282
- className: "univer-text-nowrap",
1283
- children: inputFocusId === item.tableId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
1284
- className: "univer-h-[18px] univer-min-w-16 univer-rounded-none",
1285
- inputClass: "univer-h-[18px] univer-w-[80px]",
1286
- value: inputValue,
1287
- onChange: (v) => setInputValue(v),
1288
- onBlur: () => handleChangeTableName(item.tableId, inputValue),
1289
- onKeyDown: (e) => {
1290
- if (e.key === "Enter") handleChangeTableName(item.tableId, inputValue);
1291
- },
1292
- autoFocus: inputFocusId === item.tableId
1293
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1294
- className: "univer-h-[18px] univer-max-w-24 univer-truncate univer-text-sm",
1295
- children: item.tableName
1296
- })
1297
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
1298
- align: "start",
1299
- overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1300
- className: "univer-py-2",
1301
- children: [
1302
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1303
- className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-gap-2 univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
1304
- onClick: () => {
1305
- setInputFocusId(item.tableId);
1306
- setInputValue(item.tableName);
1307
- },
1308
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.RenameIcon, {}), localeService.t("sheets-table.rename")]
1309
- }),
1310
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200" }),
1311
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1312
- onClick: () => handleChangeRange(item.tableId),
1313
- className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-gap-2 univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
1314
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.GridOutlineIcon, {}), localeService.t("sheets-table.updateRange")]
1315
- }),
1316
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1317
- className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-gap-2 univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
1318
- onClick: () => {
1319
- updateOpenState(item.tableId, false);
1320
- const table = tableManager.getTableById(unitId, item.tableId);
1321
- if (!table) return;
1322
- const tableConfig = table.getTableConfig();
1323
- const sidebarConfig = {
1324
- id: SHEET_TABLE_THEME_PANEL_ID,
1325
- header: { title: localeService.t("sheets-table.tableStyle") },
1326
- children: {
1327
- label: SHEET_TABLE_THEME_PANEL,
1328
- oldConfig: tableConfig,
1329
- unitId,
1330
- subUnitId,
1331
- tableId: item.tableId
1332
- },
1333
- width: 330
1334
- };
1335
- sidebarService.open(sidebarConfig);
1336
- },
1337
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.PaintBucketDoubleIcon, { extend: { colorChannel1: "rgb(53,91,183)" } }), localeService.t("sheets-table.setTheme")]
1338
- }),
1339
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200" }),
1340
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1341
- className: "univer-flex univer-min-w-32 univer-cursor-pointer univer-items-center univer-px-2 univer-py-1 univer-text-sm hover:univer-bg-gray-200",
1342
- onClick: () => {
1343
- updateOpenState(item.tableId, false);
1344
- commandService.executeCommand(_univerjs_sheets_table.DeleteSheetTableCommand.id, {
1345
- tableId: item.tableId,
1346
- subUnitId,
1347
- unitId
1348
- });
1349
- },
1350
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteIcon, { className: "univer-mr-2" }), localeService.t("sheets-table.removeTable")]
1351
- })
1352
- ]
1353
- }),
1354
- open: (_openStates$item$tabl = openStates[item.tableId]) !== null && _openStates$item$tabl !== void 0 ? _openStates$item$tabl : false,
1355
- onOpenChange: (isOpen) => {
1356
- updateOpenState(item.tableId, isOpen);
1357
- },
1358
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {}) })
1359
- }, item.tableId)]
1360
- }, item.tableId);
1361
- })
1362
- });
1363
- };
1364
-
1365
- //#endregion
1366
- //#region src/controllers/sheet-table-anchor.controller.ts
1367
- let SheetTableAnchorController = class SheetTableAnchorController extends _univerjs_core.Disposable {
1368
- constructor(_context, _injector, _sheetSkeletonManagerService, _renderManagerService, _commandService, _univerInstanceService, _uiPartsService, _tableManager, _scrollManagerService, _workbookPermissionService, _permissionService) {
1618
+ //#region src/controllers/sheet-table-controls-render.controller.ts
1619
+ const TABLE_CONTROLS_LAYER_INDEX = 5002;
1620
+ const TABLE_CONTROL_GAP_ROW = 0;
1621
+ const TABLE_RENDER_REFRESH_COMMANDS = new Set([_univerjs_sheets_ui.SetScrollOperation.id, _univerjs_sheets_ui.SetZoomRatioOperation.id]);
1622
+ function isSameTopGap(left, right) {
1623
+ if (left === null || right === null) return left === right;
1624
+ return left.size === right.size && left.color === right.color && left.stripeColor === right.stripeColor;
1625
+ }
1626
+ let SheetTableControlsRenderController = class SheetTableControlsRenderController extends _univerjs_core.Disposable {
1627
+ constructor(_context, _injector, _sheetSkeletonManagerService, _commandService, _tableManager, _rangeThemeModel, _workbookPermissionService, _permissionService, _sheetsSelectionsService, _selectionRenderService, _sheetTableThemeUIController, _localeService, _dialogService, _sidebarService) {
1369
1628
  super();
1370
1629
  this._context = _context;
1371
1630
  this._injector = _injector;
1372
1631
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
1373
- this._renderManagerService = _renderManagerService;
1374
1632
  this._commandService = _commandService;
1375
- this._univerInstanceService = _univerInstanceService;
1376
- this._uiPartsService = _uiPartsService;
1377
1633
  this._tableManager = _tableManager;
1378
- this._scrollManagerService = _scrollManagerService;
1634
+ this._rangeThemeModel = _rangeThemeModel;
1379
1635
  this._workbookPermissionService = _workbookPermissionService;
1380
1636
  this._permissionService = _permissionService;
1381
- _defineProperty(this, "_anchorVisible$", new rxjs.BehaviorSubject(true));
1382
- _defineProperty(this, "_timer", void 0);
1383
- _defineProperty(this, "_anchorPosition$", new rxjs.BehaviorSubject([]));
1384
- _defineProperty(this, "anchorPosition$", this._anchorPosition$.asObservable());
1385
- this._initUI();
1386
- this._initListener();
1387
- this._initTableAnchor();
1637
+ this._sheetsSelectionsService = _sheetsSelectionsService;
1638
+ this._selectionRenderService = _selectionRenderService;
1639
+ this._sheetTableThemeUIController = _sheetTableThemeUIController;
1640
+ this._localeService = _localeService;
1641
+ this._dialogService = _dialogService;
1642
+ this._sidebarService = _sidebarService;
1643
+ _defineProperty(this, "_shape", void 0);
1644
+ _defineProperty(this, "_topGapBaseBySkeleton", /* @__PURE__ */ new WeakMap());
1645
+ this._shape = new SheetTableControlsShape("SheetTableControlsShape", () => this._sheetSkeletonManagerService.getCurrentSkeleton() || null);
1646
+ this._initShape();
1647
+ this._initRefresh();
1648
+ this._refresh();
1388
1649
  }
1389
- _initUI() {
1390
- this.disposeWithMe(this._uiPartsService.registerComponent(_univerjs_ui.BuiltInUIPart.CONTENT, () => (0, _univerjs_ui.connectInjector)(SheetTableAnchor, this._injector)));
1650
+ _initShape() {
1651
+ var _this$_context$compon, _this$_context$compon2;
1652
+ this._context.scene.addObjects([this._shape], TABLE_CONTROLS_LAYER_INDEX);
1653
+ this.disposeWithMe((0, _univerjs_core.toDisposable)(() => {
1654
+ this._context.scene.removeObjects([this._shape]);
1655
+ }));
1656
+ this.disposeWithMe(this._shape.onPointerMove$.subscribeEvent((evt, state) => {
1657
+ this._handlePointerMove(evt, state);
1658
+ }));
1659
+ this.disposeWithMe(this._shape.onPointerLeave$.subscribeEvent((_evt, state) => {
1660
+ this._handlePointerLeave(state);
1661
+ }));
1662
+ this.disposeWithMe(this._shape.onPointerDown$.subscribeEvent((evt, state) => {
1663
+ this._handlePointerDown(evt, state);
1664
+ }));
1665
+ this.disposeWithMe((_this$_context$compon = (_this$_context$compon2 = this._context.components.get(_univerjs_sheets_ui.SHEET_VIEW_KEY.MAIN)) === null || _this$_context$compon2 === void 0 ? void 0 : _this$_context$compon2.onPointerMove$.subscribeEvent((evt) => {
1666
+ const point = this._getLocalPoint(evt);
1667
+ const insertRegion = this._getInsertRegionFromPoint(point.x, point.y);
1668
+ this._shape.setHoveredInsertRegion(insertRegion);
1669
+ })) !== null && _this$_context$compon !== void 0 ? _this$_context$compon : (0, _univerjs_core.toDisposable)(() => {}));
1391
1670
  }
1392
- _initListener() {
1393
- this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
1394
- if (command.id === _univerjs_sheets_ui.SetZoomRatioOperation.id || command.id === _univerjs_sheets_ui.SetScrollOperation.id) {
1395
- this._anchorVisible$.next(false);
1396
- if (this._timer) clearTimeout(this._timer);
1397
- this._timer = setTimeout(() => {
1398
- this._anchorVisible$.next(true);
1399
- }, 300);
1671
+ _initRefresh() {
1672
+ const commandExecuted$ = (0, _univerjs_core.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0, rxjs.filter)(([command]) => {
1673
+ if (command.type === _univerjs_core.CommandType.OPERATION && TABLE_RENDER_REFRESH_COMMANDS.has(command.id)) {
1674
+ this._closeFloatingControls();
1675
+ return true;
1400
1676
  }
1677
+ return command.type === _univerjs_core.CommandType.MUTATION || command.type === _univerjs_core.CommandType.COMMAND;
1678
+ }));
1679
+ this.disposeWithMe((0, rxjs.merge)(this._context.unit.activeSheet$, this._sheetSkeletonManagerService.currentSkeleton$, this._tableManager.tableAdd$, this._tableManager.tableDelete$, this._tableManager.tableNameChanged$, this._tableManager.tableRangeChanged$, this._tableManager.tableThemeChanged$, this._sheetTableThemeUIController.refreshTable$, this._workbookPermissionService.unitPermissionInitStateChange$, this._permissionService.permissionPointUpdate$, this._sheetsSelectionsService.selectionChanged$, commandExecuted$).subscribe(() => {
1680
+ this._closeFloatingControls();
1681
+ this._refresh();
1401
1682
  }));
1402
1683
  }
1403
- _initTableAnchor() {
1404
- this.disposeWithMe((0, rxjs.merge)(this._context.unit.activeSheet$, this._sheetSkeletonManagerService.currentSkeleton$, this._scrollManagerService.validViewportScrollInfo$, this._tableManager.tableAdd$, this._tableManager.tableDelete$, this._tableManager.tableNameChanged$, this._tableManager.tableRangeChanged$, this._tableManager.tableThemeChanged$, this._workbookPermissionService.unitPermissionInitStateChange$.pipe((0, rxjs.filter)((v) => v)), this._permissionService.permissionPointUpdate$.pipe((0, rxjs.debounceTime)(300)), this._anchorVisible$).subscribe(() => {
1405
- var _this$_permissionServ;
1406
- if (!this._anchorVisible$.getValue()) {
1407
- this._anchorPosition$.next([]);
1408
- return;
1409
- }
1410
- const workbook = this._context.unit;
1411
- const worksheet = workbook.getActiveSheet();
1412
- const subUnitId = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getSheetId();
1413
- const tables = this._tableManager.getTableList(this._context.unitId).filter((table) => {
1414
- return table.subUnitId === subUnitId;
1684
+ _refresh() {
1685
+ const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
1686
+ const worksheet = this._context.unit.getActiveSheet();
1687
+ if (!skeleton || !worksheet || !this._canEditWorkbook()) {
1688
+ this._shape.setItems([]);
1689
+ this._shape.refreshBounds();
1690
+ this._context.scene.makeDirty();
1691
+ return;
1692
+ }
1693
+ this._syncTopTableGap(skeleton);
1694
+ this._shape.setMenuLabels({
1695
+ rename: this._localeService.t("sheets-table.rename"),
1696
+ "update-range": this._localeService.t("sheets-table.updateRange"),
1697
+ "set-theme": this._localeService.t("sheets-table.setTheme"),
1698
+ delete: this._localeService.t("sheets-table.removeTable")
1699
+ });
1700
+ const unitId = this._context.unit.getUnitId();
1701
+ const subUnitId = worksheet.getSheetId();
1702
+ const items = this._tableManager.getTablesBySubunitId(unitId, subUnitId).map((table) => {
1703
+ var _rangeTheme$getHeader, _rangeTheme$getHeader2, _rangeTheme$getHeader3, _rangeTheme$getHeader4;
1704
+ const rangeTheme = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId());
1705
+ return {
1706
+ tableId: table.getId(),
1707
+ tableName: table.getDisplayName(),
1708
+ range: table.getRange(),
1709
+ fill: (_rangeTheme$getHeader = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader2 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader2 === void 0 || (_rangeTheme$getHeader2 = _rangeTheme$getHeader2.bg) === null || _rangeTheme$getHeader2 === void 0 ? void 0 : _rangeTheme$getHeader2.rgb) !== null && _rangeTheme$getHeader !== void 0 ? _rangeTheme$getHeader : "rgb(53,91,183)",
1710
+ text: (_rangeTheme$getHeader3 = rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader4 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader4 === void 0 || (_rangeTheme$getHeader4 = _rangeTheme$getHeader4.cl) === null || _rangeTheme$getHeader4 === void 0 ? void 0 : _rangeTheme$getHeader4.rgb) !== null && _rangeTheme$getHeader3 !== void 0 ? _rangeTheme$getHeader3 : "rgb(255,255,255)"
1711
+ };
1712
+ });
1713
+ this._shape.setItems(items);
1714
+ this._shape.refreshBounds();
1715
+ this._shape.makeDirty(true);
1716
+ this._context.scene.makeDirty();
1717
+ }
1718
+ _canEditWorkbook() {
1719
+ var _this$_permissionServ;
1720
+ const unitId = this._context.unit.getUnitId();
1721
+ return ((_this$_permissionServ = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookEditablePermission(unitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) !== false;
1722
+ }
1723
+ _handlePointerMove(evt, state) {
1724
+ const point = this._getLocalPoint(evt);
1725
+ const hit = this._shape.hitTest(point.x, point.y);
1726
+ const insertRegion = this._isInsertHit(hit) ? hit : hit ? null : this._getInsertRegionFromPoint(point.x, point.y);
1727
+ const activeHit = hit !== null && hit !== void 0 ? hit : insertRegion;
1728
+ this._shape.setHoveredRegion(this._isInsertHit(hit) ? null : hit);
1729
+ this._shape.setHoveredInsertRegion(insertRegion);
1730
+ if (activeHit) {
1731
+ state.stopPropagation();
1732
+ this._context.scene.setCursor(_univerjs_engine_render.CURSOR_TYPE.POINTER);
1733
+ } else this._context.scene.resetCursor();
1734
+ }
1735
+ _isInsertHit(hit) {
1736
+ return (hit === null || hit === void 0 ? void 0 : hit.type) === "insert-row" || (hit === null || hit === void 0 ? void 0 : hit.type) === "insert-column";
1737
+ }
1738
+ _handlePointerLeave(state) {
1739
+ state.stopPropagation();
1740
+ this._shape.setHoveredRegion(null);
1741
+ this._shape.setHoveredInsertRegion(null);
1742
+ this._context.scene.resetCursor();
1743
+ }
1744
+ _handlePointerDown(evt, state) {
1745
+ var _this$_shape$hitTest;
1746
+ if (evt.button === 2) return;
1747
+ const point = this._getLocalPoint(evt);
1748
+ const hit = (_this$_shape$hitTest = this._shape.hitTest(point.x, point.y)) !== null && _this$_shape$hitTest !== void 0 ? _this$_shape$hitTest : this._getInsertRegionFromPoint(point.x, point.y);
1749
+ if (!hit) {
1750
+ this._closeFloatingControls();
1751
+ return;
1752
+ }
1753
+ state.stopPropagation();
1754
+ evt.stopPropagation();
1755
+ evt.preventDefault();
1756
+ this._handleHit(hit);
1757
+ }
1758
+ _handleHit(hit) {
1759
+ const worksheet = this._context.unit.getActiveSheet();
1760
+ if (!worksheet) return;
1761
+ const unitId = this._context.unit.getUnitId();
1762
+ const subUnitId = worksheet.getSheetId();
1763
+ if (hit.type === "anchor-menu-toggle" || hit.type === "anchor-main") {
1764
+ this._shape.setOpenedMenuTableId(this._shape.getOpenedMenuTableId() === hit.tableId ? null : hit.tableId);
1765
+ return;
1766
+ }
1767
+ if (hit.type === "insert-row") {
1768
+ this._commandService.executeCommand(_univerjs_sheets_table.SheetTableInsertRowAtCommand.id, {
1769
+ unitId,
1770
+ subUnitId,
1771
+ tableId: hit.tableId,
1772
+ index: hit.index,
1773
+ count: 1
1415
1774
  });
1416
- const renderUnit = this._renderManagerService.getRenderById(this._context.unitId);
1417
- if (!renderUnit) {
1418
- this._anchorPosition$.next([]);
1419
- return;
1420
- }
1421
- if (!((_this$_permissionServ = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookEditablePermission(workbook.getUnitId()).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value)) {
1422
- this._anchorPosition$.next([]);
1423
- return;
1424
- }
1425
- const tableInfos = tables.reduce((acc, table) => {
1426
- const { startRow, startColumn } = table.range;
1427
- const sheetSkeletonManagerService = renderUnit.with(_univerjs_sheets_ui.SheetSkeletonManagerService);
1428
- const sheetObject = (0, _univerjs_sheets_ui.getSheetObject)(this._univerInstanceService, this._renderManagerService);
1429
- if (!sheetObject) return acc;
1430
- const { scene } = sheetObject;
1431
- const viewport = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
1432
- if (!viewport) return acc;
1433
- const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
1434
- const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
1435
- const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
1436
- if (!scaleX || !scene || !scaleY || !scrollXY) return acc;
1437
- const skeleton = sheetSkeletonManagerService.getCurrentSkeleton();
1438
- if (!skeleton) return acc;
1439
- const position = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn);
1440
- const startX = (0, _univerjs_engine_render.convertTransformToOffsetX)(position.startX, scaleX, scrollXY);
1441
- const startY = (0, _univerjs_engine_render.convertTransformToOffsetY)(position.startY, scaleY, scrollXY) - 25 - 4;
1442
- if (startY >= -10 && startX >= 45) acc.push({
1443
- x: startX,
1444
- y: startY,
1445
- tableId: table.id,
1446
- tableName: table.name
1775
+ this._closeFloatingControls();
1776
+ return;
1777
+ }
1778
+ if (hit.type === "insert-column") {
1779
+ this._commandService.executeCommand(_univerjs_sheets_table.SheetTableInsertColumnAtCommand.id, {
1780
+ unitId,
1781
+ subUnitId,
1782
+ tableId: hit.tableId,
1783
+ index: hit.index,
1784
+ count: 1
1785
+ });
1786
+ this._closeFloatingControls();
1787
+ return;
1788
+ }
1789
+ if (hit.type !== "menu-item") return;
1790
+ switch (hit.action) {
1791
+ case "rename":
1792
+ this._openRenameDialog(unitId, hit.tableId);
1793
+ break;
1794
+ case "update-range":
1795
+ this._openRangeSelector(unitId, subUnitId, hit.tableId);
1796
+ break;
1797
+ case "set-theme":
1798
+ this._openThemePanel(unitId, subUnitId, hit.tableId);
1799
+ break;
1800
+ case "delete":
1801
+ this._commandService.executeCommand(_univerjs_sheets_table.DeleteSheetTableCommand.id, {
1802
+ tableId: hit.tableId,
1803
+ subUnitId,
1804
+ unitId
1447
1805
  });
1448
- return acc;
1449
- }, []);
1450
- this._anchorPosition$.next(tableInfos);
1451
- }));
1806
+ break;
1807
+ }
1808
+ this._closeFloatingControls();
1452
1809
  }
1453
- };
1454
- SheetTableAnchorController = __decorate([
1455
- __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
1456
- __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetSkeletonManagerService)),
1457
- __decorateParam(3, _univerjs_engine_render.IRenderManagerService),
1458
- __decorateParam(4, _univerjs_core.ICommandService),
1459
- __decorateParam(5, _univerjs_core.IUniverInstanceService),
1460
- __decorateParam(6, _univerjs_ui.IUIPartsService),
1461
- __decorateParam(7, (0, _univerjs_core.Inject)(_univerjs_sheets_table.TableManager)),
1462
- __decorateParam(8, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetScrollManagerService)),
1463
- __decorateParam(9, (0, _univerjs_core.Inject)(_univerjs_sheets.WorkbookPermissionService)),
1464
- __decorateParam(10, (0, _univerjs_core.Inject)(_univerjs_core.IPermissionService))
1465
- ], SheetTableAnchorController);
1466
-
1467
- //#endregion
1468
- //#region src/views/widgets/drawings.ts
1469
- const BUTTON_VIEWPORT = 16;
1470
- const PIVOT_BUTTON_EMPTY = new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");
1471
- var TableButton = class {
1472
- static drawNoSetting(ctx, size, fgColor, bgColor) {
1473
- ctx.save();
1474
- _univerjs_engine_render.Rect.drawWith(ctx, {
1475
- radius: 2,
1476
- width: BUTTON_VIEWPORT,
1477
- height: BUTTON_VIEWPORT,
1478
- fill: bgColor
1810
+ _openRenameDialog(unitId, tableId) {
1811
+ this._dialogService.open({
1812
+ id: SHEET_TABLE_RENAME_DIALOG_ID,
1813
+ title: { title: this._localeService.t("sheets-table.rename") },
1814
+ draggable: true,
1815
+ destroyOnClose: true,
1816
+ mask: true,
1817
+ children: { label: {
1818
+ name: SHEET_TABLE_RENAME_DIALOG,
1819
+ props: {
1820
+ unitId,
1821
+ tableId,
1822
+ onClose: () => this._dialogService.close(SHEET_TABLE_RENAME_DIALOG_ID)
1823
+ }
1824
+ } },
1825
+ width: 360,
1826
+ onClose: () => this._dialogService.close(SHEET_TABLE_RENAME_DIALOG_ID)
1479
1827
  });
1480
- ctx.lineCap = "square";
1481
- ctx.strokeStyle = fgColor;
1482
- ctx.scale(size / BUTTON_VIEWPORT, size / BUTTON_VIEWPORT);
1483
- ctx.beginPath();
1484
- ctx.lineWidth = 1;
1485
- ctx.lineCap = "round";
1486
- ctx.moveTo(3, 4);
1487
- ctx.lineTo(13, 4);
1488
- ctx.moveTo(4.5, 8);
1489
- ctx.lineTo(11.5, 8);
1490
- ctx.moveTo(6, 12);
1491
- ctx.lineTo(10, 12);
1492
- ctx.stroke();
1493
- ctx.restore();
1494
1828
  }
1495
- static drawIconByPath(ctx, pathData, fgColor, bgColor) {
1496
- ctx.save();
1497
- ctx.strokeStyle = fgColor;
1498
- ctx.fillStyle = bgColor;
1499
- _univerjs_engine_render.Rect.drawWith(ctx, {
1500
- radius: 2,
1501
- width: BUTTON_VIEWPORT,
1502
- height: BUTTON_VIEWPORT,
1503
- fill: bgColor
1829
+ async _openRangeSelector(unitId, subUnitId, tableId) {
1830
+ const table = this._tableManager.getTableById(unitId, tableId);
1831
+ if (!table) return;
1832
+ const selection = await openRangeSelector(this._injector, unitId, subUnitId, table.getRange(), tableId);
1833
+ if (!selection) return;
1834
+ this._commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
1835
+ tableId,
1836
+ unitId,
1837
+ updateRange: { newRange: selection.range }
1504
1838
  });
1505
- pathData.forEach((d) => {
1506
- const path = new Path2D(d);
1507
- ctx.fillStyle = fgColor;
1508
- ctx.fill(path, "evenodd");
1839
+ }
1840
+ _openThemePanel(unitId, subUnitId, tableId) {
1841
+ const table = this._tableManager.getTableById(unitId, tableId);
1842
+ if (!table) return;
1843
+ this._sidebarService.open({
1844
+ id: SHEET_TABLE_THEME_PANEL_ID,
1845
+ header: { title: this._localeService.t("sheets-table.tableStyle") },
1846
+ children: {
1847
+ label: SHEET_TABLE_THEME_PANEL,
1848
+ oldConfig: table.getTableConfig(),
1849
+ unitId,
1850
+ subUnitId,
1851
+ tableId
1852
+ },
1853
+ width: 330
1509
1854
  });
1510
- ctx.restore();
1855
+ }
1856
+ _getInsertRegionFromPoint(x, y) {
1857
+ const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
1858
+ const worksheet = this._context.unit.getActiveSheet();
1859
+ if (!skeleton || !worksheet) return null;
1860
+ const unitId = this._context.unit.getUnitId();
1861
+ const subUnitId = worksheet.getSheetId();
1862
+ const tables = this._tableManager.getTablesBySubunitId(unitId, subUnitId);
1863
+ for (const table of tables) {
1864
+ const range = table.getRange();
1865
+ const tableBounds = this._getRangeBounds(skeleton, range);
1866
+ if (x < tableBounds.left || x > tableBounds.right || y < tableBounds.top || y > tableBounds.bottom) continue;
1867
+ if (y > this._getRangeBounds(skeleton, {
1868
+ ...range,
1869
+ endRow: range.startRow
1870
+ }).bottom) for (let row = range.startRow + 1; row <= range.endRow; row++) {
1871
+ const cell = skeleton.getNoMergeCellWithCoordByIndex(row, range.startColumn);
1872
+ if (y >= cell.startY && y <= cell.endY) return {
1873
+ type: "insert-row",
1874
+ tableId: table.getId(),
1875
+ index: row + 1,
1876
+ left: tableBounds.left - 22 / 2,
1877
+ top: cell.endY - 22 / 2,
1878
+ width: 22,
1879
+ height: 22
1880
+ };
1881
+ }
1882
+ }
1883
+ return null;
1884
+ }
1885
+ _getRangeBounds(skeleton, range) {
1886
+ const startCell = skeleton.getNoMergeCellWithCoordByIndex(range.startRow, range.startColumn);
1887
+ const endCell = skeleton.getNoMergeCellWithCoordByIndex(range.endRow, range.endColumn);
1888
+ return {
1889
+ left: startCell.startX,
1890
+ top: startCell.startY,
1891
+ right: endCell.endX,
1892
+ bottom: endCell.endY
1893
+ };
1894
+ }
1895
+ _syncTopTableGap(skeleton) {
1896
+ const worksheet = this._context.unit.getActiveSheet();
1897
+ if (!worksheet) return;
1898
+ const unitId = this._context.unit.getUnitId();
1899
+ const subUnitId = worksheet.getSheetId();
1900
+ const hasTopTable = this._tableManager.getTablesBySubunitId(unitId, subUnitId).some((table) => table.getRange().startRow === 0);
1901
+ const current = skeleton.gapConfig;
1902
+ const rowGaps = { ...current.rowGaps };
1903
+ const previousTopGap = rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null;
1904
+ let shouldSync = false;
1905
+ if (hasTopTable) {
1906
+ var _baseGap$size;
1907
+ if (!this._topGapBaseBySkeleton.has(skeleton)) this._topGapBaseBySkeleton.set(skeleton, rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null);
1908
+ const baseGap = this._topGapBaseBySkeleton.get(skeleton);
1909
+ rowGaps[TABLE_CONTROL_GAP_ROW] = {
1910
+ ...baseGap !== null && baseGap !== void 0 ? baseGap : rowGaps[TABLE_CONTROL_GAP_ROW],
1911
+ size: ((_baseGap$size = baseGap === null || baseGap === void 0 ? void 0 : baseGap.size) !== null && _baseGap$size !== void 0 ? _baseGap$size : 0) + 32
1912
+ };
1913
+ shouldSync = true;
1914
+ } else if (this._topGapBaseBySkeleton.has(skeleton)) {
1915
+ const baseGap = this._topGapBaseBySkeleton.get(skeleton);
1916
+ if (baseGap) rowGaps[TABLE_CONTROL_GAP_ROW] = { ...baseGap };
1917
+ else delete rowGaps[TABLE_CONTROL_GAP_ROW];
1918
+ this._topGapBaseBySkeleton.delete(skeleton);
1919
+ shouldSync = true;
1920
+ }
1921
+ if (!shouldSync) return;
1922
+ if (isSameTopGap(previousTopGap, rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null)) return;
1923
+ skeleton.setGapConfig({
1924
+ ...current,
1925
+ rowGaps
1926
+ });
1927
+ this._refreshSelections();
1928
+ }
1929
+ _refreshSelections() {
1930
+ this._selectionRenderService.resetSelectionsByModelData(this._sheetsSelectionsService.getCurrentSelections());
1931
+ }
1932
+ _closeFloatingControls() {
1933
+ this._shape.setOpenedMenuTableId(null);
1934
+ this._shape.setHoveredInsertRegion(null);
1935
+ this._shape.setHoveredRegion(null);
1936
+ }
1937
+ _getLocalPoint(evt) {
1938
+ const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
1939
+ if (skeleton) return (0, _univerjs_sheets_ui.getTransformCoord)(evt.offsetX, evt.offsetY, this._context.scene, skeleton);
1940
+ return {
1941
+ x: evt.offsetX,
1942
+ y: evt.offsetY
1943
+ };
1511
1944
  }
1512
1945
  };
1513
-
1514
- //#endregion
1515
- //#region src/views/widgets/icons.ts
1516
- /**
1517
- * Copyright 2023-present DreamNum Co., Ltd.
1518
- *
1519
- * Licensed under the Apache License, Version 2.0 (the "License");
1520
- * you may not use this file except in compliance with the License.
1521
- * You may obtain a copy of the License at
1522
- *
1523
- * http://www.apache.org/licenses/LICENSE-2.0
1524
- *
1525
- * Unless required by applicable law or agreed to in writing, software
1526
- * distributed under the License is distributed on an "AS IS" BASIS,
1527
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1528
- * See the License for the specific language governing permissions and
1529
- * limitations under the License.
1530
- */
1531
- const filterPartial = ["M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z"];
1532
- const filteredSortAsc = ["M12.4008 13.1831C12.6907 13.1831 12.9258 12.9481 12.9258 12.6581V4.60873L14.013 5.69597C14.218 5.901 14.5505 5.901 14.7555 5.69597C14.9605 5.49094 14.9605 5.15853 14.7555 4.95351L12.7721 2.97017C12.5671 2.76515 12.2347 2.76515 12.0297 2.97017L10.0463 4.95351C9.84132 5.15853 9.84132 5.49094 10.0463 5.69597C10.2514 5.901 10.5838 5.901 10.7888 5.69597L11.8758 4.60901V12.6581C11.8758 12.9481 12.1108 13.1831 12.4008 13.1831Z", "M1.28069 4.85447C0.842195 4.33439 1.21191 3.5391 1.89218 3.5391H8.59333C9.2736 3.5391 9.64331 4.33439 9.20482 4.85447L6.51052 8.0501V11.6601C6.51052 12.2245 5.94174 12.6114 5.41683 12.404L4.48092 12.0343C4.1756 11.9136 3.97498 11.6187 3.97498 11.2904V8.0501L1.28069 4.85447Z"];
1533
- const filteredSortDesc = ["M12.4008 2.81641C12.6907 2.81641 12.9258 3.05146 12.9258 3.34141V11.3908L14.013 10.3036C14.218 10.0986 14.5505 10.0986 14.7555 10.3036C14.9605 10.5086 14.9605 10.841 14.7555 11.046L12.7721 13.0294C12.5671 13.2344 12.2347 13.2344 12.0297 13.0294L10.0463 11.046C9.84132 10.841 9.84132 10.5086 10.0463 10.3036C10.2514 10.0986 10.5838 10.0986 10.7888 10.3036L11.8758 11.3905V3.34141C11.8758 3.05146 12.1108 2.81641 12.4008 2.81641Z", "M1.28069 4.85444C0.842195 4.33435 1.21191 3.53906 1.89218 3.53906H8.59333C9.2736 3.53906 9.64331 4.33435 9.20482 4.85443L6.51052 8.05006V11.6601C6.51052 12.2245 5.94174 12.6113 5.41683 12.404L4.48092 12.0342C4.1756 11.9136 3.97498 11.6186 3.97498 11.2903V8.05006L1.28069 4.85444Z"];
1534
- const filterNoneSortAsc = [
1535
- "M11.9003 13.7046C11.9003 13.9969 11.6633 14.2339 11.371 14.2339C11.0787 14.2339 10.8417 13.9969 10.8417 13.7046V3.57272L9.74577 4.66862C9.53906 4.87534 9.20391 4.87534 8.9972 4.66862C8.79048 4.46191 8.79048 4.12676 8.9972 3.92005L10.9969 1.92039C11.2036 1.71368 11.5387 1.71368 11.7454 1.92039L13.7451 3.92005C13.9518 4.12676 13.9518 4.46191 13.7451 4.66862C13.5384 4.87534 13.2032 4.87534 12.9965 4.66862L11.9003 3.57243V13.7046Z",
1536
- "M2.69779 10.0113C2.40546 10.0113 2.16847 9.77429 2.16847 9.48196C2.16847 9.18962 2.40546 8.95264 2.69779 8.95264H6.67804C6.89213 8.95264 7.08514 9.0816 7.16707 9.2794C7.249 9.47719 7.20371 9.70486 7.05233 9.85624L3.97569 12.9329H6.67804C6.97038 12.9329 7.20736 13.1699 7.20736 13.4622C7.20736 13.7545 6.97038 13.9915 6.67804 13.9915H2.69779C2.4837 13.9915 2.29069 13.8626 2.20876 13.6648C2.12684 13.467 2.17212 13.2393 2.32351 13.0879L5.40015 10.0113H2.69779Z",
1537
- "M5.51638 2.58693C5.23363 1.81542 4.14248 1.81543 3.85973 2.58693L2.13245 7.29995C2.03185 7.57443 2.17281 7.87849 2.4473 7.97909C2.72178 8.07969 3.02584 7.93872 3.12644 7.66424L3.64346 6.25351L3.64504 6.25351H5.73266L6.24968 7.66424C6.35027 7.93872 6.65433 8.07969 6.92882 7.97909C7.2033 7.87849 7.34426 7.57443 7.24367 7.29995L5.51638 2.58693ZM5.34467 5.19487L4.68806 3.40325L4.03144 5.19487H5.34467Z"
1538
- ];
1539
- const filterNoneSortDesc = [
1540
- "M11.9003 2.29495C11.9003 2.00261 11.6633 1.76562 11.371 1.76562C11.0787 1.76562 10.8417 2.00261 10.8417 2.29495V12.4268L9.74577 11.3309C9.53906 11.1242 9.20391 11.1242 8.9972 11.3309C8.79048 11.5376 8.79048 11.8727 8.9972 12.0795L10.9969 14.0791C11.2036 14.2858 11.5387 14.2858 11.7454 14.0791L13.7451 12.0795C13.9518 11.8727 13.9518 11.5376 13.7451 11.3309C13.5384 11.1242 13.2032 11.1242 12.9965 11.3309L11.9003 12.4271V2.29495Z",
1541
- "M2.69792 10.0113C2.40558 10.0113 2.16859 9.77429 2.16859 9.48196C2.16859 9.18962 2.40558 8.95264 2.69792 8.95264H6.67816C6.89225 8.95264 7.08526 9.0816 7.16719 9.2794C7.24912 9.47719 7.20384 9.70486 7.05245 9.85624L3.97581 12.9329H6.67816C6.9705 12.9329 7.20749 13.1699 7.20749 13.4622C7.20749 13.7545 6.9705 13.9915 6.67816 13.9915H2.69792C2.48383 13.9915 2.29082 13.8626 2.20889 13.6648C2.12696 13.467 2.17224 13.2393 2.32363 13.0879L5.40027 10.0113H2.69792Z",
1542
- "M5.5165 2.58693C5.23375 1.81542 4.1426 1.81543 3.85985 2.58693L2.13257 7.29995C2.03197 7.57443 2.17294 7.8785 2.44742 7.97909C2.7219 8.07969 3.02596 7.93872 3.12656 7.66424L3.64358 6.25351L3.64516 6.25351H5.73278L6.2498 7.66424C6.35039 7.93872 6.65446 8.07969 6.92894 7.97909C7.20342 7.8785 7.34438 7.57443 7.24379 7.29995L5.5165 2.58693ZM5.34479 5.19487L4.68818 3.40325L4.03156 5.19487H5.34479Z"
1543
- ];
1946
+ SheetTableControlsRenderController = __decorate([
1947
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
1948
+ __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetSkeletonManagerService)),
1949
+ __decorateParam(3, _univerjs_core.ICommandService),
1950
+ __decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_table.TableManager)),
1951
+ __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeModel)),
1952
+ __decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_sheets.WorkbookPermissionService)),
1953
+ __decorateParam(7, (0, _univerjs_core.Inject)(_univerjs_core.IPermissionService)),
1954
+ __decorateParam(8, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
1955
+ __decorateParam(9, _univerjs_sheets_ui.ISheetSelectionRenderService),
1956
+ __decorateParam(10, (0, _univerjs_core.Inject)(SheetTableThemeUIController)),
1957
+ __decorateParam(11, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
1958
+ __decorateParam(12, _univerjs_ui.IDialogService),
1959
+ __decorateParam(13, _univerjs_ui.ISidebarService)
1960
+ ], SheetTableControlsRenderController);
1544
1961
 
1545
1962
  //#endregion
1546
1963
  //#region src/views/widgets/table-filter-button.shape.ts
1547
1964
  const FILTER_ICON_SIZE = 16;
1965
+ const FILTER_TRIGGER_HOVER_RADIUS = 4;
1548
1966
  let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _univerjs_engine_render.Shape {
1549
- constructor(key, props, _contextService, _commandService, _themeService) {
1967
+ constructor(key, props, _commandService) {
1550
1968
  super(key, props);
1551
- this._contextService = _contextService;
1552
1969
  this._commandService = _commandService;
1553
- this._themeService = _themeService;
1554
1970
  _defineProperty(this, "_cellWidth", 0);
1555
1971
  _defineProperty(this, "_cellHeight", 0);
1556
1972
  _defineProperty(this, "_filterParams", void 0);
1973
+ _defineProperty(this, "_iconColor", "#fff");
1974
+ _defineProperty(this, "_hoverBackground", "rgba(255, 255, 255, 0.92)");
1975
+ _defineProperty(this, "_hoverIconColor", "#202124");
1557
1976
  _defineProperty(this, "_hovered", false);
1558
1977
  this.setShapeProps(props);
1559
1978
  this.onPointerDown$.subscribeEvent((evt) => this.onPointerDown(evt));
@@ -1564,6 +1983,9 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _u
1564
1983
  if (typeof props.cellHeight !== "undefined") this._cellHeight = props.cellHeight;
1565
1984
  if (typeof props.cellWidth !== "undefined") this._cellWidth = props.cellWidth;
1566
1985
  if (typeof props.filterParams !== "undefined") this._filterParams = props.filterParams;
1986
+ if (typeof props.iconColor !== "undefined") this._iconColor = props.iconColor;
1987
+ if (typeof props.hoverBackground !== "undefined") this._hoverBackground = props.hoverBackground;
1988
+ if (typeof props.hoverIconColor !== "undefined") this._hoverIconColor = props.hoverIconColor;
1567
1989
  this.transformByState({
1568
1990
  width: props.width,
1569
1991
  height: props.height
@@ -1578,36 +2000,38 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _u
1578
2000
  const cellRegion = new Path2D();
1579
2001
  cellRegion.rect(left, top, cellWidth, cellHeight);
1580
2002
  ctx.clip(cellRegion);
1581
- const { buttonState } = this._filterParams;
1582
- const fgColor = this._themeService.getColorFromTheme("primary.600");
1583
- const bgColor = this._hovered ? this._themeService.getColorFromTheme("gray.50") : "rgba(255, 255, 255, 1.0)";
1584
- let icons;
1585
- switch (buttonState) {
1586
- case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilteredSortNone:
1587
- icons = filterPartial;
1588
- break;
1589
- case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilteredSortAsc:
1590
- icons = filteredSortAsc;
1591
- break;
1592
- case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilteredSortDesc:
1593
- icons = filteredSortDesc;
1594
- break;
1595
- case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilterNoneSortNone: break;
1596
- case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilterNoneSortAsc:
1597
- icons = filterNoneSortAsc;
1598
- break;
1599
- case _univerjs_sheets_table.SheetsTableButtonStateEnum.FilterNoneSortDesc:
1600
- icons = filterNoneSortDesc;
1601
- break;
2003
+ if (this._hovered) {
2004
+ var _ctx$roundRect;
2005
+ ctx.save();
2006
+ ctx.fillStyle = this._hoverBackground;
2007
+ ctx.beginPath();
2008
+ (_ctx$roundRect = ctx.roundRect) === null || _ctx$roundRect === void 0 || _ctx$roundRect.call(ctx, 0, 0, 16, 16, FILTER_TRIGGER_HOVER_RADIUS);
2009
+ if (!ctx.roundRect) ctx.rect(0, 0, 16, 16);
2010
+ ctx.fill();
2011
+ ctx.restore();
1602
2012
  }
1603
- if (icons) TableButton.drawIconByPath(ctx, icons, fgColor, bgColor);
1604
- else if (buttonState !== void 0) TableButton.drawNoSetting(ctx, 16, fgColor, bgColor);
2013
+ this._drawChevron(ctx, this._hovered ? this._hoverIconColor : this._iconColor);
2014
+ ctx.restore();
2015
+ }
2016
+ _drawChevron(ctx, color) {
2017
+ const centerX = 16 / 2;
2018
+ const centerY = 16 / 2 + 1;
2019
+ ctx.save();
2020
+ ctx.beginPath();
2021
+ ctx.strokeStyle = color;
2022
+ ctx.lineWidth = 1.8;
2023
+ ctx.lineCap = "round";
2024
+ ctx.lineJoin = "round";
2025
+ ctx.moveTo(centerX - 4.5, centerY - 2.5);
2026
+ ctx.lineTo(centerX, centerY + 2);
2027
+ ctx.lineTo(centerX + 4.5, centerY - 2.5);
2028
+ ctx.stroke();
1605
2029
  ctx.restore();
1606
2030
  }
1607
2031
  onPointerDown(evt) {
1608
2032
  if (evt.button === 2) return;
1609
2033
  const { row, col, unitId, subUnitId, tableId } = this._filterParams;
1610
- if (this._contextService.getContextValue("SHEETS_TABLE_FILTER_PANEL_OPENED_KEY") || !this._commandService.hasCommand(OpenTableFilterPanelOperation.id)) return;
2034
+ if (!this._commandService.hasCommand(OpenTableFilterPanelOperation.id)) return;
1611
2035
  setTimeout(() => {
1612
2036
  const cmdParams = {
1613
2037
  row,
@@ -1628,11 +2052,7 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends _u
1628
2052
  this.makeDirty(true);
1629
2053
  }
1630
2054
  };
1631
- SheetsTableFilterButtonShape = __decorate([
1632
- __decorateParam(2, _univerjs_core.IContextService),
1633
- __decorateParam(3, _univerjs_core.ICommandService),
1634
- __decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.ThemeService))
1635
- ], SheetsTableFilterButtonShape);
2055
+ SheetsTableFilterButtonShape = __decorate([__decorateParam(2, _univerjs_core.ICommandService)], SheetsTableFilterButtonShape);
1636
2056
 
1637
2057
  //#endregion
1638
2058
  //#region src/controllers/sheet-table-filter-button-render.controller.ts
@@ -1646,13 +2066,14 @@ const computeIconTop = (startY, endY, cellHeight, verticalAlign) => {
1646
2066
  }
1647
2067
  };
1648
2068
  let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRenderController extends _univerjs_core.RxDisposable {
1649
- constructor(_context, _injector, _sheetSkeletonManagerService, _sheetInterceptorService, _tableManager, _commandService) {
2069
+ constructor(_context, _injector, _sheetSkeletonManagerService, _sheetInterceptorService, _tableManager, _rangeThemeModel, _commandService) {
1650
2070
  super();
1651
2071
  this._context = _context;
1652
2072
  this._injector = _injector;
1653
2073
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
1654
2074
  this._sheetInterceptorService = _sheetInterceptorService;
1655
2075
  this._tableManager = _tableManager;
2076
+ this._rangeThemeModel = _rangeThemeModel;
1656
2077
  this._commandService = _commandService;
1657
2078
  _defineProperty(this, "_buttonRenderDisposable", null);
1658
2079
  _defineProperty(this, "_tableFilterButtonShapes", []);
@@ -1708,7 +2129,12 @@ let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRende
1708
2129
  const worksheet = workbook.getSheetBySheetId(worksheetId);
1709
2130
  if (!worksheet) return;
1710
2131
  for (const { range, states, tableId } of tableFilterRanges) {
2132
+ var _this$_rangeThemeMode, _headerStyle$cl$rgb, _headerStyle$cl, _headerStyle$bg$rgb, _headerStyle$bg;
1711
2133
  const { startRow, startColumn, endColumn } = range;
2134
+ const table = this._tableManager.getTableById(unitId, tableId);
2135
+ const headerStyle = table ? (_this$_rangeThemeMode = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId())) === null || _this$_rangeThemeMode === void 0 ? void 0 : _this$_rangeThemeMode.getHeaderRowStyle() : null;
2136
+ const iconColor = (_headerStyle$cl$rgb = headerStyle === null || headerStyle === void 0 || (_headerStyle$cl = headerStyle.cl) === null || _headerStyle$cl === void 0 ? void 0 : _headerStyle$cl.rgb) !== null && _headerStyle$cl$rgb !== void 0 ? _headerStyle$cl$rgb : "#fff";
2137
+ const hoverIconColor = (_headerStyle$bg$rgb = headerStyle === null || headerStyle === void 0 || (_headerStyle$bg = headerStyle.bg) === null || _headerStyle$bg === void 0 ? void 0 : _headerStyle$bg.rgb) !== null && _headerStyle$bg$rgb !== void 0 ? _headerStyle$bg$rgb : "#202124";
1712
2138
  this._interceptCellContent(unitId, worksheetId, range);
1713
2139
  for (let col = startColumn; col <= endColumn; col++) {
1714
2140
  const key = `sheets-table-filter-button-${startRow}-${col}`;
@@ -1726,6 +2152,9 @@ let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRende
1726
2152
  height: 16,
1727
2153
  width: 16,
1728
2154
  zIndex: SHEETS_FILTER_BUTTON_Z_INDEX,
2155
+ iconColor,
2156
+ hoverBackground: iconColor,
2157
+ hoverIconColor,
1729
2158
  cellHeight,
1730
2159
  cellWidth,
1731
2160
  filterParams: {
@@ -1774,7 +2203,8 @@ SheetsTableFilterButtonRenderController = __decorate([
1774
2203
  __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetSkeletonManagerService)),
1775
2204
  __decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetInterceptorService)),
1776
2205
  __decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_table.TableManager)),
1777
- __decorateParam(5, _univerjs_core.ICommandService)
2206
+ __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetRangeThemeModel)),
2207
+ __decorateParam(6, _univerjs_core.ICommandService)
1778
2208
  ], SheetsTableFilterButtonRenderController);
1779
2209
 
1780
2210
  //#endregion
@@ -2503,8 +2933,9 @@ let UniverSheetsTableUIPlugin = class UniverSheetsTableUIPlugin extends _univerj
2503
2933
  this._registerRenderModules();
2504
2934
  }
2505
2935
  _registerRenderModules() {
2506
- const renderDependencies = [[SheetsTableFilterButtonRenderController], [SheetsTableRenderController]];
2507
- if (this._config.hideAnchor !== true) renderDependencies.push([SheetTableAnchorController]);
2936
+ const renderDependencies = [];
2937
+ if (this._config.hideAnchor !== true) renderDependencies.push([SheetTableControlsRenderController]);
2938
+ renderDependencies.push([SheetsTableFilterButtonRenderController], [SheetsTableRenderController]);
2508
2939
  renderDependencies.forEach((m) => {
2509
2940
  this.disposeWithMe(this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_SHEET, m));
2510
2941
  });