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

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 (65) hide show
  1. package/lib/cjs/index.js +815 -384
  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 +823 -392
  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 +823 -392
  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
package/lib/es/index.js CHANGED
@@ -1,21 +1,21 @@
1
- import { ColorKit, CommandType, DependentOn, Disposable, ErrorService, ICommandService, IConfigService, IContextService, IPermissionService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, ObjectMatrix, Plugin, Rectangle, RxDisposable, ThemeService, UniverInstanceType, VerticalAlign, cellToRange, merge, registerDependencies, touchDependencies } from "@univerjs/core";
2
- import { IRenderManagerService, Rect, SHEET_VIEWPORT_KEY, Shape, convertTransformToOffsetX, convertTransformToOffsetY } from "@univerjs/engine-render";
3
- import { AddSheetTableCommand, AddTableThemeCommand, DeleteSheetTableCommand, RemoveTableThemeCommand, SHEET_TABLE_CUSTOM_THEME_PREFIX, SetSheetTableCommand, SetSheetTableFilterCommand, SheetTableInsertColCommand, SheetTableInsertRowCommand, SheetTableRemoveColCommand, SheetTableRemoveRowCommand, SheetTableService, SheetsTableButtonStateEnum, SheetsTableController, SheetsTableSortStateEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableManager, TableNumberCompareTypeEnum, TableStringCompareTypeEnum, UniverSheetsTablePlugin, customEmptyThemeWithBorderStyle, isConditionFilter, isManualTableFilter, processStyleWithBorderStyle } from "@univerjs/sheets-table";
4
- import { SelectAllCommand, SetScrollOperation, SetZoomRatioOperation, SheetCanvasPopManagerService, SheetScrollManagerService, SheetSkeletonManagerService, getCoordByCell, getCurrentRangeDisable$, getSheetObject } from "@univerjs/sheets-ui";
5
- import { BuiltInUIPart, ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, IMenuManagerService, ISidebarService, IUIPartsService, MenuItemType, RibbonDataGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
6
- import { BehaviorSubject, Subject, debounceTime, distinctUntilChanged, filter, map, merge as merge$1, of, startWith, switchMap, takeUntil } from "rxjs";
1
+ import { ColorKit, CommandType, DependentOn, Disposable, ErrorService, ICommandService, IConfigService, IContextService, IPermissionService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, ObjectMatrix, Plugin, Rectangle, RxDisposable, UniverInstanceType, VerticalAlign, cellToRange, fromCallback, merge, registerDependencies, toDisposable, touchDependencies } from "@univerjs/core";
2
+ import { CURSOR_TYPE, DEFAULT_FONTFACE_PLANE, IRenderManagerService, Rect, Shape } from "@univerjs/engine-render";
3
+ import { AddSheetTableCommand, AddTableThemeCommand, DeleteSheetTableCommand, RemoveTableThemeCommand, SHEET_TABLE_CUSTOM_THEME_PREFIX, SetSheetTableCommand, SetSheetTableFilterCommand, SheetTableInsertColCommand, SheetTableInsertColumnAtCommand, SheetTableInsertRowAtCommand, SheetTableInsertRowCommand, SheetTableRemoveColCommand, SheetTableRemoveColumnAtCommand, SheetTableRemoveRowCommand, SheetTableService, SheetsTableController, SheetsTableSortStateEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableManager, TableNumberCompareTypeEnum, TableStringCompareTypeEnum, UniverSheetsTablePlugin, customEmptyThemeWithBorderStyle, getExistingNamesSet, isConditionFilter, isManualTableFilter, processStyleWithBorderStyle, validateSheetTableName } from "@univerjs/sheets-table";
4
+ import { ISheetSelectionRenderService, SHEET_VIEW_KEY, SelectAllCommand, SetScrollOperation, SetZoomRatioOperation, SheetCanvasPopManagerService, SheetSkeletonManagerService, getCoordByCell, getCurrentRangeDisable$, getTransformCoord } from "@univerjs/sheets-ui";
5
+ import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, IMenuManagerService, ISidebarService, MenuItemType, RibbonDataGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
6
+ import { Subject, distinctUntilChanged, filter, map, merge as merge$1, of, startWith, switchMap, takeUntil } from "rxjs";
7
7
  import { Button, ButtonGroup, CascaderList, Checkbox, ColorPicker, DatePicker, DateRangePicker, Dropdown, Input, InputNumber, Segmented, Select, borderClassName, clsx, scrollbarClassName } from "@univerjs/design";
8
- import { AscendingIcon, DeleteIcon, DescendingIcon, DropdownIcon, GridOutlineIcon, MoreDownIcon, PaintBucketDoubleIcon, RenameIcon, TableIcon } from "@univerjs/icons";
8
+ import { AscendingIcon, DeleteColumnDoubleIcon, DescendingIcon, DropdownIcon, LeftInsertColumnDoubleIcon, MoreDownIcon, RightInsertColumnDoubleIcon, TableIcon } from "@univerjs/icons";
9
9
  import { INTERCEPTOR_POINT, RangeThemeStyle, SetRangeThemeMutation, SetRangeValuesMutation, SetSelectionsOperation, SetVerticalTextAlignCommand, SheetInterceptorService, SheetRangeThemeModel, SheetsSelectionsService, WorkbookEditablePermission, WorkbookPermissionService, expandToContinuousRange, getPrimaryForRange, getSheetCommandTarget, isSingleCellSelection } from "@univerjs/sheets";
10
10
  import { SortRangeCommand, SortType } from "@univerjs/sheets-sort";
11
11
  import { useCallback, useEffect, useMemo, useState } from "react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
- import { deserializeRangeWithSheet, serializeRange } from "@univerjs/engine-formula";
13
+ import { IDefinedNamesService, deserializeRangeWithSheet, serializeRange } from "@univerjs/engine-formula";
14
14
  import { RangeSelector } from "@univerjs/sheets-formula-ui";
15
15
 
16
16
  //#region package.json
17
17
  var name = "@univerjs/sheets-table-ui";
18
- var version = "0.22.1";
18
+ var version = "0.23.0-insiders.20260522-e8f2a3b";
19
19
 
20
20
  //#endregion
21
21
  //#region src/const.ts
@@ -39,6 +39,8 @@ const SHEETS_TABLE_FILTER_PANEL_OPENED_KEY = "SHEETS_TABLE_FILTER_PANEL_OPENED_K
39
39
  const UNIVER_SHEET_TABLE_FILTER_PANEL_ID = "UNIVER_SHEET_Table_FILTER_PANEL_ID";
40
40
  const TABLE_TOOLBAR_BUTTON = "TABLE_TOOLBAR_BUTTON";
41
41
  const TABLE_SELECTOR_DIALOG = "TABLE_SELECTOR_DIALOG";
42
+ const SHEET_TABLE_RENAME_DIALOG = "SHEET_TABLE_RENAME_DIALOG";
43
+ const SHEET_TABLE_RENAME_DIALOG_ID = "SHEET_TABLE_RENAME_DIALOG_ID";
42
44
  const SHEET_TABLE_THEME_PANEL_ID = "SHEET_TABLE_THEME_PANEL_ID";
43
45
  const SHEET_TABLE_THEME_PANEL = "SHEET_TABLE_THEME_PANEL";
44
46
  const TABLE_CUSTOM_NAME_PREFIX = "table-custom-";
@@ -851,9 +853,12 @@ function SheetTableFilterPanel() {
851
853
  const table = tableManager.getTable(unitId, tableId);
852
854
  if (!table) return null;
853
855
  const tableFilters = table.getTableFilters();
856
+ const tableRange = table.getRange();
854
857
  const sortState = tableFilters.getSortState();
855
858
  sortState.columnIndex === columnIndex && (sortState.sortState, SheetsTableSortStateEnum.Asc);
856
859
  sortState.columnIndex === columnIndex && (sortState.sortState, SheetsTableSortStateEnum.Desc);
860
+ const absoluteColumn = tableFilterPanelInfo.column;
861
+ const canDeleteColumn = tableRange.endColumn > tableRange.startColumn;
857
862
  const closeDialog = () => {
858
863
  sheetsTableComponentController.closeFilterPanel();
859
864
  };
@@ -875,6 +880,27 @@ function SheetTableFilterPanel() {
875
880
  tableFilters.setSortState(columnIndex, asc ? SheetsTableSortStateEnum.Asc : SheetsTableSortStateEnum.Desc);
876
881
  closeDialog();
877
882
  };
883
+ const insertColumn = (side) => {
884
+ commandService.executeCommand(SheetTableInsertColumnAtCommand.id, {
885
+ unitId,
886
+ subUnitId,
887
+ tableId,
888
+ index: side === "left" ? absoluteColumn : absoluteColumn + 1,
889
+ count: 1
890
+ });
891
+ closeDialog();
892
+ };
893
+ const deleteColumn = () => {
894
+ if (!canDeleteColumn) return;
895
+ commandService.executeCommand(SheetTableRemoveColumnAtCommand.id, {
896
+ unitId,
897
+ subUnitId,
898
+ tableId,
899
+ index: absoluteColumn,
900
+ count: 1
901
+ });
902
+ closeDialog();
903
+ };
878
904
  const onApply = () => {
879
905
  if (filterBy === "items") {
880
906
  const filteredItems = [];
@@ -921,7 +947,39 @@ function SheetTableFilterPanel() {
921
947
  return /* @__PURE__ */ jsxs("div", {
922
948
  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",
923
949
  children: [
924
- ((_permissionService$ge = permissionService.getPermissionPoint(workbookEditableId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) && /* @__PURE__ */ jsx("div", {
950
+ ((_permissionService$ge = permissionService.getPermissionPoint(workbookEditableId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
951
+ 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",
952
+ children: [
953
+ /* @__PURE__ */ jsxs("button", {
954
+ type: "button",
955
+ 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",
956
+ onClick: () => insertColumn("left"),
957
+ children: [/* @__PURE__ */ jsx(LeftInsertColumnDoubleIcon, {
958
+ className: "univer-size-5",
959
+ extend: { colorChannel1: "var(--univer-primary-600)" }
960
+ }), /* @__PURE__ */ jsx("span", { children: localeService.t("sheets-table.columnMenu.insert-left") })]
961
+ }),
962
+ /* @__PURE__ */ jsxs("button", {
963
+ type: "button",
964
+ 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",
965
+ onClick: () => insertColumn("right"),
966
+ children: [/* @__PURE__ */ jsx(RightInsertColumnDoubleIcon, {
967
+ className: "univer-size-5",
968
+ extend: { colorChannel1: "var(--univer-primary-600)" }
969
+ }), /* @__PURE__ */ jsx("span", { children: localeService.t("sheets-table.columnMenu.insert-right") })]
970
+ }),
971
+ /* @__PURE__ */ jsxs("button", {
972
+ type: "button",
973
+ 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",
974
+ disabled: !canDeleteColumn,
975
+ onClick: deleteColumn,
976
+ children: [/* @__PURE__ */ jsx(DeleteColumnDoubleIcon, {
977
+ className: "univer-size-5",
978
+ extend: { colorChannel1: "var(--univer-primary-600)" }
979
+ }), /* @__PURE__ */ jsx("span", { children: localeService.t("sheets-table.columnMenu.delete") })]
980
+ })
981
+ ]
982
+ }), /* @__PURE__ */ jsx("div", {
925
983
  className: "univer-mb-3 univer-flex",
926
984
  children: /* @__PURE__ */ jsxs(ButtonGroup, {
927
985
  className: "univer-mb-3 !univer-flex univer-w-full",
@@ -935,7 +993,7 @@ function SheetTableFilterPanel() {
935
993
  children: [/* @__PURE__ */ jsx(DescendingIcon, { className: "univer-mr-1" }), localeService.t("sheets-sort.general.sort-desc")]
936
994
  })]
937
995
  })
938
- }),
996
+ })] }),
939
997
  /* @__PURE__ */ jsx("div", {
940
998
  className: "univer-w-full",
941
999
  children: /* @__PURE__ */ jsx(Segmented, {
@@ -996,6 +1054,89 @@ function useFilterByOptions(localeService) {
996
1054
  }], [localeService.getCurrentLocale(), localeService]);
997
1055
  }
998
1056
 
1057
+ //#endregion
1058
+ //#region src/views/components/SheetTableRenameDialog.tsx
1059
+ function SheetTableRenameDialog(props) {
1060
+ var _table$getDisplayName;
1061
+ const { unitId, tableId, onClose } = props;
1062
+ const localeService = useDependency(LocaleService);
1063
+ const commandService = useDependency(ICommandService);
1064
+ const tableManager = useDependency(TableManager);
1065
+ const univerInstanceService = useDependency(IUniverInstanceService);
1066
+ const definedNamesService = useDependency(IDefinedNamesService);
1067
+ const table = tableManager.getTableById(unitId, tableId);
1068
+ const [value, setValue] = useState((_table$getDisplayName = table === null || table === void 0 ? void 0 : table.getDisplayName()) !== null && _table$getDisplayName !== void 0 ? _table$getDisplayName : "");
1069
+ const [error, setError] = useState("");
1070
+ const existingNames = useMemo(() => {
1071
+ const names = getExistingNamesSet(unitId, {
1072
+ univerInstanceService,
1073
+ tableManager,
1074
+ definedNamesService
1075
+ });
1076
+ const currentName = table === null || table === void 0 ? void 0 : table.getDisplayName().toLowerCase();
1077
+ if (currentName) names.delete(currentName);
1078
+ return names;
1079
+ }, [
1080
+ definedNamesService,
1081
+ table,
1082
+ tableManager,
1083
+ unitId,
1084
+ univerInstanceService
1085
+ ]);
1086
+ const handleConfirm = () => {
1087
+ const nextName = value.trim();
1088
+ if (!table || nextName === table.getDisplayName()) {
1089
+ onClose();
1090
+ return;
1091
+ }
1092
+ if (!validateSheetTableName(nextName, existingNames).valid) {
1093
+ setError(localeService.t("sheets-table.tableNameError"));
1094
+ return;
1095
+ }
1096
+ commandService.executeCommand(SetSheetTableCommand.id, {
1097
+ unitId,
1098
+ tableId,
1099
+ name: nextName
1100
+ });
1101
+ onClose();
1102
+ };
1103
+ return /* @__PURE__ */ jsxs("div", {
1104
+ className: "univer-box-border univer-flex univer-w-full univer-flex-col univer-gap-4 univer-pb-3 univer-pt-2",
1105
+ children: [
1106
+ /* @__PURE__ */ jsx(Input, {
1107
+ size: "middle",
1108
+ value,
1109
+ placeholder: localeService.t("sheets-table.renamePlaceholder"),
1110
+ onChange: (nextValue) => {
1111
+ setValue(nextValue);
1112
+ setError("");
1113
+ },
1114
+ onKeyDown: (event) => {
1115
+ if (event.key === "Enter") handleConfirm();
1116
+ },
1117
+ autoFocus: true
1118
+ }),
1119
+ error ? /* @__PURE__ */ jsx("div", {
1120
+ className: "-univer-mt-2 univer-text-sm univer-text-red-500",
1121
+ children: error
1122
+ }) : null,
1123
+ /* @__PURE__ */ jsxs("div", {
1124
+ className: "univer-flex univer-w-full univer-items-center univer-justify-end univer-gap-2",
1125
+ children: [/* @__PURE__ */ jsx(Button, {
1126
+ className: "univer-min-w-16",
1127
+ onClick: onClose,
1128
+ children: localeService.t("sheets-table.cancel")
1129
+ }), /* @__PURE__ */ jsx(Button, {
1130
+ className: "univer-min-w-16",
1131
+ variant: "primary",
1132
+ onClick: handleConfirm,
1133
+ children: localeService.t("sheets-table.confirm")
1134
+ })]
1135
+ })
1136
+ ]
1137
+ });
1138
+ }
1139
+
999
1140
  //#endregion
1000
1141
  //#region src/controllers/sheet-table-component.controller.ts
1001
1142
  let SheetsTableComponentController = class SheetsTableComponentController extends Disposable {
@@ -1013,6 +1154,22 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
1013
1154
  setCurrentTableFilterInfo(info) {
1014
1155
  this._currentTableFilterInfo = info;
1015
1156
  }
1157
+ openOrToggleFilterPanel(info) {
1158
+ const opened = this._contextService.getContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY);
1159
+ if (opened && this._isSameFilterPanelInfo(this._currentTableFilterInfo, info)) {
1160
+ this.closeFilterPanel();
1161
+ return;
1162
+ }
1163
+ this.setCurrentTableFilterInfo(info);
1164
+ if (opened) {
1165
+ var _this$_popupDisposabl;
1166
+ (_this$_popupDisposabl = this._popupDisposable) === null || _this$_popupDisposabl === void 0 || _this$_popupDisposabl.dispose();
1167
+ this._popupDisposable = null;
1168
+ this._openFilterPopup();
1169
+ return;
1170
+ }
1171
+ this._contextService.setContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, true);
1172
+ }
1016
1173
  clearCurrentTableFilterInfo() {
1017
1174
  this._currentTableFilterInfo = null;
1018
1175
  }
@@ -1020,7 +1177,7 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
1020
1177
  return this._currentTableFilterInfo;
1021
1178
  }
1022
1179
  _initComponents() {
1023
- [[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel]].forEach(([key, comp]) => {
1180
+ [[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel], [SHEET_TABLE_RENAME_DIALOG, SheetTableRenameDialog]].forEach(([key, comp]) => {
1024
1181
  this.disposeWithMe(this._componentManager.register(key, comp));
1025
1182
  });
1026
1183
  }
@@ -1049,11 +1206,14 @@ let SheetsTableComponentController = class SheetsTableComponentController extend
1049
1206
  });
1050
1207
  }
1051
1208
  _closeFilterPopup() {
1052
- var _this$_popupDisposabl;
1053
- (_this$_popupDisposabl = this._popupDisposable) === null || _this$_popupDisposabl === void 0 || _this$_popupDisposabl.dispose();
1209
+ var _this$_popupDisposabl2;
1210
+ (_this$_popupDisposabl2 = this._popupDisposable) === null || _this$_popupDisposabl2 === void 0 || _this$_popupDisposabl2.dispose();
1054
1211
  this._popupDisposable = null;
1055
1212
  this.clearCurrentTableFilterInfo();
1056
1213
  }
1214
+ _isSameFilterPanelInfo(a, b) {
1215
+ return Boolean(a && a.unitId === b.unitId && a.subUnitId === b.subUnitId && a.tableId === b.tableId && a.column === b.column && a.row === b.row);
1216
+ }
1057
1217
  };
1058
1218
  SheetsTableComponentController = __decorate([
1059
1219
  __decorateParam(0, Inject(ComponentManager)),
@@ -1071,19 +1231,15 @@ const OpenTableFilterPanelOperation = {
1071
1231
  if (!params) return false;
1072
1232
  const { row, col, unitId, subUnitId, tableId } = params;
1073
1233
  const tableManager = accessor.get(TableManager);
1074
- const contextService = accessor.get(IContextService);
1075
1234
  const sheetsTableComponentController = accessor.get(SheetsTableComponentController);
1076
1235
  if (!tableManager.getTable(unitId, tableId)) return false;
1077
- if (!contextService.getContextValue("SHEETS_TABLE_FILTER_PANEL_OPENED_KEY")) {
1078
- sheetsTableComponentController.setCurrentTableFilterInfo({
1079
- unitId,
1080
- subUnitId,
1081
- row,
1082
- tableId,
1083
- column: col
1084
- });
1085
- contextService.setContextValue(SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, true);
1086
- }
1236
+ sheetsTableComponentController.openOrToggleFilterPanel({
1237
+ unitId,
1238
+ subUnitId,
1239
+ row,
1240
+ tableId,
1241
+ column: col
1242
+ });
1087
1243
  return true;
1088
1244
  }
1089
1245
  };
@@ -1165,6 +1321,277 @@ const defaultPluginConfig = {
1165
1321
  anchorBackgroundColor: "rgb(134,139,156)"
1166
1322
  };
1167
1323
 
1324
+ //#endregion
1325
+ //#region src/views/widgets/table-controls-util.ts
1326
+ const TABLE_CONTROL_MENU_WIDTH = 168;
1327
+ const TABLE_CONTROL_MENU_ITEM_HEIGHT = 32;
1328
+ const TABLE_CONTROL_MENU_ACTIONS = [
1329
+ "rename",
1330
+ "update-range",
1331
+ "set-theme",
1332
+ "delete"
1333
+ ];
1334
+ function isPointInTableControlRegion(region, x, y) {
1335
+ return x >= region.left && x <= region.left + region.width && y >= region.top && y <= region.top + region.height;
1336
+ }
1337
+ function hitTestTableControl(regions, x, y) {
1338
+ for (let i = regions.length - 1; i >= 0; i--) if (isPointInTableControlRegion(regions[i], x, y)) return regions[i];
1339
+ return null;
1340
+ }
1341
+ function buildTableMenuRegions(tableId, left, top) {
1342
+ return TABLE_CONTROL_MENU_ACTIONS.map((action, index) => ({
1343
+ type: "menu-item",
1344
+ tableId,
1345
+ action,
1346
+ left,
1347
+ top: top + index * 32,
1348
+ width: 168,
1349
+ height: 32
1350
+ }));
1351
+ }
1352
+
1353
+ //#endregion
1354
+ //#region src/views/widgets/table-controls.shape.ts
1355
+ const ANCHOR_MIN_WIDTH = 122;
1356
+ const ANCHOR_MAX_WIDTH = 240;
1357
+ const ANCHOR_PADDING_X = 12;
1358
+ const ANCHOR_TOGGLE_WIDTH = 30;
1359
+ const ANCHOR_OFFSET_Y = 0;
1360
+ const ANCHOR_BORDER = "rgba(0, 0, 0, 0.22)";
1361
+ const ANCHOR_DIVIDER = "rgba(0, 0, 0, 0.20)";
1362
+ const ANCHOR_TOGGLE_BG_ACTIVE = "rgba(0, 0, 0, 0.12)";
1363
+ const MENU_RADIUS = 8;
1364
+ const MENU_BORDER = "#d9dee7";
1365
+ const MENU_HOVER_BG = "#f1f3f4";
1366
+ const INSERT_BUTTON_VISUAL_SIZE = 18;
1367
+ const INSERT_BUTTON_TEXT_OFFSET_Y = -1;
1368
+ var SheetTableControlsShape = class extends Shape {
1369
+ constructor(key, _getSkeleton) {
1370
+ super(key, {
1371
+ evented: true,
1372
+ fill: "rgba(0, 0, 0, 0)",
1373
+ zIndex: 5001
1374
+ });
1375
+ this._getSkeleton = _getSkeleton;
1376
+ _defineProperty(this, "_items", []);
1377
+ _defineProperty(this, "_regions", []);
1378
+ _defineProperty(this, "_openedMenuTableId", null);
1379
+ _defineProperty(this, "_hoveredRegion", null);
1380
+ _defineProperty(this, "_hoveredInsertRegion", null);
1381
+ _defineProperty(this, "_menuLabels", {
1382
+ rename: "Rename table",
1383
+ "update-range": "Update range",
1384
+ "set-theme": "Set theme",
1385
+ delete: "Remove table"
1386
+ });
1387
+ }
1388
+ setItems(items) {
1389
+ this._items = items;
1390
+ this.makeDirty(true);
1391
+ }
1392
+ setMenuLabels(labels) {
1393
+ this._menuLabels = labels;
1394
+ this.makeDirty(true);
1395
+ }
1396
+ setOpenedMenuTableId(tableId) {
1397
+ if (this._openedMenuTableId === tableId) return;
1398
+ this._openedMenuTableId = tableId;
1399
+ this.makeDirty(true);
1400
+ }
1401
+ getOpenedMenuTableId() {
1402
+ return this._openedMenuTableId;
1403
+ }
1404
+ setHoveredRegion(region) {
1405
+ if (this._hoveredRegion === region) return;
1406
+ this._hoveredRegion = region;
1407
+ this.makeDirty(true);
1408
+ }
1409
+ setHoveredInsertRegion(region) {
1410
+ if (this._hoveredInsertRegion === region) return;
1411
+ this._hoveredInsertRegion = region;
1412
+ this.makeDirty(true);
1413
+ }
1414
+ hitTest(x, y) {
1415
+ return hitTestTableControl(this._regions, x, y);
1416
+ }
1417
+ isHit(coord) {
1418
+ return this.hitTest(coord.x, coord.y) != null;
1419
+ }
1420
+ refreshBounds() {
1421
+ const skeleton = this._getSkeleton();
1422
+ if (!skeleton) {
1423
+ this.hide();
1424
+ return;
1425
+ }
1426
+ this.show();
1427
+ this.transformByState({
1428
+ left: 0,
1429
+ top: 0,
1430
+ width: skeleton.rowHeaderWidth + skeleton.columnTotalWidth,
1431
+ height: skeleton.columnHeaderHeight + skeleton.rowTotalHeight
1432
+ });
1433
+ }
1434
+ _draw(ctx) {
1435
+ this._regions = [];
1436
+ const skeleton = this._getSkeleton();
1437
+ if (!skeleton) return;
1438
+ ctx.save();
1439
+ ctx.textBaseline = "middle";
1440
+ for (const item of this._items) this._drawAnchor(ctx, skeleton, item);
1441
+ if (this._hoveredInsertRegion) {
1442
+ var _item$fill;
1443
+ const item = this._items.find((renderItem) => {
1444
+ var _this$_hoveredInsertR;
1445
+ return renderItem.tableId === ((_this$_hoveredInsertR = this._hoveredInsertRegion) === null || _this$_hoveredInsertR === void 0 ? void 0 : _this$_hoveredInsertR.tableId);
1446
+ });
1447
+ this._drawInsertButton(ctx, this._hoveredInsertRegion, (_item$fill = item === null || item === void 0 ? void 0 : item.fill) !== null && _item$fill !== void 0 ? _item$fill : "#355bb7");
1448
+ this._regions.push(this._hoveredInsertRegion);
1449
+ }
1450
+ ctx.restore();
1451
+ }
1452
+ _drawAnchor(ctx, skeleton, item) {
1453
+ const position = skeleton.getNoMergeCellWithCoordByIndex(item.range.startRow, item.range.startColumn);
1454
+ const left = position.startX;
1455
+ const rawTop = position.startY - 28 - ANCHOR_OFFSET_Y;
1456
+ const top = Math.max(0, rawTop);
1457
+ const width = Math.max(ANCHOR_MIN_WIDTH, Math.min(ANCHOR_MAX_WIDTH, item.tableName.length * 8.5 + ANCHOR_PADDING_X * 2 + ANCHOR_TOGGLE_WIDTH));
1458
+ const toggleRegion = {
1459
+ type: "anchor-menu-toggle",
1460
+ tableId: item.tableId,
1461
+ left: left + width - ANCHOR_TOGGLE_WIDTH,
1462
+ top,
1463
+ width: ANCHOR_TOGGLE_WIDTH,
1464
+ height: 28
1465
+ };
1466
+ ctx.save();
1467
+ ctx.translateWithPrecision(left, top);
1468
+ this._drawTopRoundedRect(ctx, width, 28, 14, item.fill, ANCHOR_BORDER);
1469
+ this._drawAnchorToggle(ctx, width, item.text, this._openedMenuTableId === item.tableId || this._isSameRegion(this._hoveredRegion, toggleRegion));
1470
+ ctx.font = `600 13px ${DEFAULT_FONTFACE_PLANE}`;
1471
+ ctx.fillStyle = item.text;
1472
+ ctx.textAlign = "left";
1473
+ ctx.fillText(item.tableName, ANCHOR_PADDING_X, 28 / 2);
1474
+ ctx.restore();
1475
+ this._regions.push({
1476
+ type: "anchor-main",
1477
+ tableId: item.tableId,
1478
+ left,
1479
+ top,
1480
+ width,
1481
+ height: 28
1482
+ });
1483
+ this._regions.push(toggleRegion);
1484
+ if (this._openedMenuTableId === item.tableId) this._drawMenu(ctx, item.tableId, left, top + 28);
1485
+ }
1486
+ _drawAnchorToggle(ctx, anchorWidth, color, active) {
1487
+ const toggleLeft = anchorWidth - ANCHOR_TOGGLE_WIDTH;
1488
+ if (active) this._drawRightTopRoundedRect(ctx, toggleLeft, anchorWidth, 28, 14, ANCHOR_TOGGLE_BG_ACTIVE);
1489
+ ctx.save();
1490
+ ctx.beginPath();
1491
+ ctx.strokeStyle = ANCHOR_DIVIDER;
1492
+ ctx.lineWidth = 1;
1493
+ ctx.moveTo(toggleLeft + .5, 5);
1494
+ ctx.lineTo(toggleLeft + .5, 28 - 5);
1495
+ ctx.stroke();
1496
+ ctx.restore();
1497
+ const centerX = anchorWidth - ANCHOR_TOGGLE_WIDTH / 2;
1498
+ const centerY = 28 / 2;
1499
+ ctx.save();
1500
+ ctx.beginPath();
1501
+ ctx.strokeStyle = color;
1502
+ ctx.lineWidth = 1.6;
1503
+ ctx.lineCap = "round";
1504
+ ctx.moveTo(centerX - 5, centerY - 4);
1505
+ ctx.lineTo(centerX + 5, centerY - 4);
1506
+ ctx.moveTo(centerX - 5, centerY);
1507
+ ctx.lineTo(centerX + 5, centerY);
1508
+ ctx.moveTo(centerX - 5, centerY + 4);
1509
+ ctx.lineTo(centerX + 5, centerY + 4);
1510
+ ctx.stroke();
1511
+ ctx.restore();
1512
+ }
1513
+ _drawTopRoundedRect(ctx, width, height, radius, fill, stroke) {
1514
+ const r = Math.min(radius, width / 2, height);
1515
+ ctx.beginPath();
1516
+ ctx.moveTo(0, height);
1517
+ ctx.lineTo(0, r);
1518
+ ctx.arcTo(0, 0, r, 0, r);
1519
+ ctx.lineTo(width - r, 0);
1520
+ ctx.arcTo(width, 0, width, r, r);
1521
+ ctx.lineTo(width, height);
1522
+ ctx.closePath();
1523
+ ctx.fillStyle = fill;
1524
+ ctx.fill();
1525
+ if (stroke) {
1526
+ ctx.strokeStyle = stroke;
1527
+ ctx.lineWidth = 1;
1528
+ ctx.stroke();
1529
+ }
1530
+ }
1531
+ _drawRightTopRoundedRect(ctx, left, width, height, radius, fill) {
1532
+ const r = Math.min(radius, width - left, height);
1533
+ ctx.save();
1534
+ ctx.beginPath();
1535
+ ctx.moveTo(left, height);
1536
+ ctx.lineTo(left, 0);
1537
+ ctx.lineTo(width - r, 0);
1538
+ ctx.arcTo(width, 0, width, r, r);
1539
+ ctx.lineTo(width, height);
1540
+ ctx.closePath();
1541
+ ctx.fillStyle = fill;
1542
+ ctx.fill();
1543
+ ctx.restore();
1544
+ }
1545
+ _drawMenu(ctx, tableId, left, top) {
1546
+ const regions = buildTableMenuRegions(tableId, left, top);
1547
+ ctx.save();
1548
+ ctx.translateWithPrecision(left, top);
1549
+ Rect.drawWith(ctx, {
1550
+ width: 168,
1551
+ height: regions.length * 32,
1552
+ radius: MENU_RADIUS,
1553
+ fill: "#fff",
1554
+ stroke: MENU_BORDER
1555
+ });
1556
+ ctx.restore();
1557
+ for (const region of regions) {
1558
+ if (this._isSameRegion(this._hoveredRegion, region)) {
1559
+ ctx.save();
1560
+ ctx.fillStyle = MENU_HOVER_BG;
1561
+ ctx.fillRectByPrecision(region.left, region.top, region.width, region.height);
1562
+ ctx.restore();
1563
+ }
1564
+ ctx.save();
1565
+ ctx.font = `12px ${DEFAULT_FONTFACE_PLANE}`;
1566
+ ctx.fillStyle = region.action === "delete" ? "#d92d20" : "#344054";
1567
+ ctx.textAlign = "left";
1568
+ ctx.fillText(this._menuLabels[region.action], region.left + 12, region.top + region.height / 2);
1569
+ ctx.restore();
1570
+ }
1571
+ this._regions.push(...regions);
1572
+ }
1573
+ _drawInsertButton(ctx, region, fill) {
1574
+ const centerX = region.left + region.width / 2;
1575
+ const centerY = region.top + region.height / 2;
1576
+ const radius = INSERT_BUTTON_VISUAL_SIZE / 2;
1577
+ ctx.save();
1578
+ ctx.beginPath();
1579
+ ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
1580
+ ctx.fillStyle = "#fff";
1581
+ ctx.fill();
1582
+ ctx.strokeStyle = fill;
1583
+ ctx.stroke();
1584
+ ctx.font = `12px ${DEFAULT_FONTFACE_PLANE}`;
1585
+ ctx.fillStyle = fill;
1586
+ ctx.textAlign = "center";
1587
+ ctx.fillText("+", centerX, centerY + INSERT_BUTTON_TEXT_OFFSET_Y);
1588
+ ctx.restore();
1589
+ }
1590
+ _isSameRegion(a, b) {
1591
+ return Boolean(a && a.type === b.type && a.tableId === b.tableId && a.action === b.action && a.index === b.index);
1592
+ }
1593
+ };
1594
+
1168
1595
  //#endregion
1169
1596
  //#region src/controllers/sheet-table-theme-ui.controller.ts
1170
1597
  let SheetTableThemeUIController = class SheetTableThemeUIController extends Disposable {
@@ -1187,372 +1614,364 @@ let SheetTableThemeUIController = class SheetTableThemeUIController extends Disp
1187
1614
  SheetTableThemeUIController = __decorate([__decorateParam(0, Inject(ICommandService))], SheetTableThemeUIController);
1188
1615
 
1189
1616
  //#endregion
1190
- //#region src/views/components/SheetTableAnchor.tsx
1191
- const SheetTableAnchor = () => {
1192
- var _tableConfig$anchorHe, _tableConfig$anchorBa;
1193
- const [inputFocusId, setInputFocusId] = useState("");
1194
- const [inputValue, setInputValue] = useState("");
1195
- const sidebarService = useDependency(ISidebarService);
1196
- const [openStates, setOpenStates] = useState({});
1197
- const injector = useDependency(Injector);
1198
- const anchorPosition = useObservable(useDependency(SheetTableAnchorController).anchorPosition$);
1199
- const commandService = useDependency(ICommandService);
1200
- const univerInstanceService = useDependency(IUniverInstanceService);
1201
- const workbookPermissionInitState = useObservable(useDependency(WorkbookPermissionService).unitPermissionInitStateChange$, false);
1202
- const tableManager = useDependency(TableManager);
1203
- const rangeThemeModel = useDependency(SheetRangeThemeModel);
1204
- const tableRefresh$ = useObservable(useDependency(SheetTableThemeUIController).refreshTable$);
1205
- const localeService = useDependency(LocaleService);
1206
- const selections = useObservable(useDependency(SheetsSelectionsService).selectionChanged$, [{
1207
- range: cellToRange(0, 0),
1208
- primary: null
1209
- }]);
1210
- const [, setRefresh] = useState(Math.random());
1211
- const tableConfig = useDependency(IConfigService).getConfig(SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY);
1212
- const anchorHeight = (_tableConfig$anchorHe = tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.anchorHeight) !== null && _tableConfig$anchorHe !== void 0 ? _tableConfig$anchorHe : 24;
1213
- const anchorBackgroundColor = (_tableConfig$anchorBa = tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.anchorBackgroundColor) !== null && _tableConfig$anchorBa !== void 0 ? _tableConfig$anchorBa : "rgb(53,91,183)";
1214
- const updateOpenState = (tableId, isOpen) => {
1215
- setOpenStates((prev) => ({
1216
- ...prev,
1217
- [tableId]: isOpen
1218
- }));
1219
- };
1220
- useEffect(() => {
1221
- setRefresh(Math.random());
1222
- }, [tableRefresh$]);
1223
- if (!(anchorPosition === null || anchorPosition === void 0 ? void 0 : anchorPosition.length)) return null;
1224
- const target = getSheetCommandTarget(univerInstanceService);
1225
- if (!target) return null;
1226
- const { unitId, subUnitId } = target;
1227
- const handleChangeTableName = (tableId, name) => {
1228
- var _tableManager$getTabl;
1229
- if (((_tableManager$getTabl = tableManager.getTableById(unitId, tableId)) === null || _tableManager$getTabl === void 0 ? void 0 : _tableManager$getTabl.getDisplayName()) === name) {
1230
- setInputFocusId("");
1231
- setInputValue("");
1232
- return;
1233
- }
1234
- commandService.executeCommand(SetSheetTableCommand.id, {
1235
- tableId,
1236
- unitId,
1237
- name
1238
- });
1239
- setInputValue("");
1240
- setInputFocusId("");
1241
- };
1242
- const handleChangeRange = async (tableId) => {
1243
- const table = tableManager.getTableById(unitId, tableId);
1244
- if (!table) return;
1245
- const selection = await openRangeSelector(injector, unitId, subUnitId, table.getRange(), tableId);
1246
- if (!selection) return;
1247
- commandService.executeCommand(SetSheetTableCommand.id, {
1248
- tableId,
1249
- unitId,
1250
- updateRange: { newRange: selection.range }
1251
- });
1252
- };
1253
- if (!workbookPermissionInitState) return null;
1254
- return /* @__PURE__ */ jsx("div", {
1255
- className: "univer-absolute univer-z-50 univer-size-0",
1256
- children: anchorPosition.map((item) => {
1257
- var _rangeTheme$getHeader, _rangeTheme$getHeader2, _rangeTheme$getHeader3, _rangeTheme$getHeader4, _openStates$item$tabl;
1258
- const table = tableManager.getTableById(unitId, item.tableId);
1259
- if (!table) return null;
1260
- const rangeTheme = rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId());
1261
- 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;
1262
- 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)";
1263
- const tableRange = table.getRange();
1264
- if (!(selections === null || selections === void 0 ? void 0 : selections.length)) return null;
1265
- const lastRange = selections[selections.length - 1].range;
1266
- const shouldHidden = !Rectangle.intersects(tableRange, lastRange) && item.y <= 20;
1267
- return /* @__PURE__ */ jsxs("div", {
1268
- className: clsx("univer-shadow-xs univer-absolute univer-box-border univer-cursor-pointer univer-items-center univer-rounded-xl univer-px-2", borderClassName, {
1269
- "univer-flex": !shouldHidden,
1270
- "univer-hidden": shouldHidden
1271
- }),
1272
- style: {
1273
- left: item.x,
1274
- top: Math.max(item.y, 0),
1275
- backgroundColor: headerBgColor,
1276
- color: headerTextColor,
1277
- borderWidth: "0.5px",
1278
- height: anchorHeight ? `${anchorHeight}px` : "24px"
1279
- },
1280
- children: [/* @__PURE__ */ jsx("div", {
1281
- className: "univer-text-nowrap",
1282
- children: inputFocusId === item.tableId ? /* @__PURE__ */ jsx(Input, {
1283
- className: "univer-h-[18px] univer-min-w-16 univer-rounded-none",
1284
- inputClass: "univer-h-[18px] univer-w-[80px]",
1285
- value: inputValue,
1286
- onChange: (v) => setInputValue(v),
1287
- onBlur: () => handleChangeTableName(item.tableId, inputValue),
1288
- onKeyDown: (e) => {
1289
- if (e.key === "Enter") handleChangeTableName(item.tableId, inputValue);
1290
- },
1291
- autoFocus: inputFocusId === item.tableId
1292
- }) : /* @__PURE__ */ jsx("div", {
1293
- className: "univer-h-[18px] univer-max-w-24 univer-truncate univer-text-sm",
1294
- children: item.tableName
1295
- })
1296
- }), /* @__PURE__ */ jsx(Dropdown, {
1297
- align: "start",
1298
- overlay: /* @__PURE__ */ jsxs("div", {
1299
- className: "univer-py-2",
1300
- children: [
1301
- /* @__PURE__ */ jsxs("div", {
1302
- 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",
1303
- onClick: () => {
1304
- setInputFocusId(item.tableId);
1305
- setInputValue(item.tableName);
1306
- },
1307
- children: [/* @__PURE__ */ jsx(RenameIcon, {}), localeService.t("sheets-table.rename")]
1308
- }),
1309
- /* @__PURE__ */ jsx("div", { className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200" }),
1310
- /* @__PURE__ */ jsxs("div", {
1311
- onClick: () => handleChangeRange(item.tableId),
1312
- 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",
1313
- children: [/* @__PURE__ */ jsx(GridOutlineIcon, {}), localeService.t("sheets-table.updateRange")]
1314
- }),
1315
- /* @__PURE__ */ jsxs("div", {
1316
- 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",
1317
- onClick: () => {
1318
- updateOpenState(item.tableId, false);
1319
- const table = tableManager.getTableById(unitId, item.tableId);
1320
- if (!table) return;
1321
- const tableConfig = table.getTableConfig();
1322
- const sidebarConfig = {
1323
- id: SHEET_TABLE_THEME_PANEL_ID,
1324
- header: { title: localeService.t("sheets-table.tableStyle") },
1325
- children: {
1326
- label: SHEET_TABLE_THEME_PANEL,
1327
- oldConfig: tableConfig,
1328
- unitId,
1329
- subUnitId,
1330
- tableId: item.tableId
1331
- },
1332
- width: 330
1333
- };
1334
- sidebarService.open(sidebarConfig);
1335
- },
1336
- children: [/* @__PURE__ */ jsx(PaintBucketDoubleIcon, { extend: { colorChannel1: "rgb(53,91,183)" } }), localeService.t("sheets-table.setTheme")]
1337
- }),
1338
- /* @__PURE__ */ jsx("div", { className: "univer-my-1 univer-h-px univer-w-full univer-bg-gray-200" }),
1339
- /* @__PURE__ */ jsxs("div", {
1340
- 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",
1341
- onClick: () => {
1342
- updateOpenState(item.tableId, false);
1343
- commandService.executeCommand(DeleteSheetTableCommand.id, {
1344
- tableId: item.tableId,
1345
- subUnitId,
1346
- unitId
1347
- });
1348
- },
1349
- children: [/* @__PURE__ */ jsx(DeleteIcon, { className: "univer-mr-2" }), localeService.t("sheets-table.removeTable")]
1350
- })
1351
- ]
1352
- }),
1353
- open: (_openStates$item$tabl = openStates[item.tableId]) !== null && _openStates$item$tabl !== void 0 ? _openStates$item$tabl : false,
1354
- onOpenChange: (isOpen) => {
1355
- updateOpenState(item.tableId, isOpen);
1356
- },
1357
- children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(MoreDownIcon, {}) })
1358
- }, item.tableId)]
1359
- }, item.tableId);
1360
- })
1361
- });
1362
- };
1363
-
1364
- //#endregion
1365
- //#region src/controllers/sheet-table-anchor.controller.ts
1366
- let SheetTableAnchorController = class SheetTableAnchorController extends Disposable {
1367
- constructor(_context, _injector, _sheetSkeletonManagerService, _renderManagerService, _commandService, _univerInstanceService, _uiPartsService, _tableManager, _scrollManagerService, _workbookPermissionService, _permissionService) {
1617
+ //#region src/controllers/sheet-table-controls-render.controller.ts
1618
+ const TABLE_CONTROLS_LAYER_INDEX = 5002;
1619
+ const TABLE_CONTROL_GAP_ROW = 0;
1620
+ const TABLE_RENDER_REFRESH_COMMANDS = new Set([SetScrollOperation.id, SetZoomRatioOperation.id]);
1621
+ function isSameTopGap(left, right) {
1622
+ if (left === null || right === null) return left === right;
1623
+ return left.size === right.size && left.color === right.color && left.stripeColor === right.stripeColor;
1624
+ }
1625
+ let SheetTableControlsRenderController = class SheetTableControlsRenderController extends Disposable {
1626
+ constructor(_context, _injector, _sheetSkeletonManagerService, _commandService, _tableManager, _rangeThemeModel, _workbookPermissionService, _permissionService, _sheetsSelectionsService, _selectionRenderService, _sheetTableThemeUIController, _localeService, _dialogService, _sidebarService) {
1368
1627
  super();
1369
1628
  this._context = _context;
1370
1629
  this._injector = _injector;
1371
1630
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
1372
- this._renderManagerService = _renderManagerService;
1373
1631
  this._commandService = _commandService;
1374
- this._univerInstanceService = _univerInstanceService;
1375
- this._uiPartsService = _uiPartsService;
1376
1632
  this._tableManager = _tableManager;
1377
- this._scrollManagerService = _scrollManagerService;
1633
+ this._rangeThemeModel = _rangeThemeModel;
1378
1634
  this._workbookPermissionService = _workbookPermissionService;
1379
1635
  this._permissionService = _permissionService;
1380
- _defineProperty(this, "_anchorVisible$", new BehaviorSubject(true));
1381
- _defineProperty(this, "_timer", void 0);
1382
- _defineProperty(this, "_anchorPosition$", new BehaviorSubject([]));
1383
- _defineProperty(this, "anchorPosition$", this._anchorPosition$.asObservable());
1384
- this._initUI();
1385
- this._initListener();
1386
- this._initTableAnchor();
1636
+ this._sheetsSelectionsService = _sheetsSelectionsService;
1637
+ this._selectionRenderService = _selectionRenderService;
1638
+ this._sheetTableThemeUIController = _sheetTableThemeUIController;
1639
+ this._localeService = _localeService;
1640
+ this._dialogService = _dialogService;
1641
+ this._sidebarService = _sidebarService;
1642
+ _defineProperty(this, "_shape", void 0);
1643
+ _defineProperty(this, "_topGapBaseBySkeleton", /* @__PURE__ */ new WeakMap());
1644
+ this._shape = new SheetTableControlsShape("SheetTableControlsShape", () => this._sheetSkeletonManagerService.getCurrentSkeleton() || null);
1645
+ this._initShape();
1646
+ this._initRefresh();
1647
+ this._refresh();
1387
1648
  }
1388
- _initUI() {
1389
- this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(SheetTableAnchor, this._injector)));
1649
+ _initShape() {
1650
+ var _this$_context$compon, _this$_context$compon2;
1651
+ this._context.scene.addObjects([this._shape], TABLE_CONTROLS_LAYER_INDEX);
1652
+ this.disposeWithMe(toDisposable(() => {
1653
+ this._context.scene.removeObjects([this._shape]);
1654
+ }));
1655
+ this.disposeWithMe(this._shape.onPointerMove$.subscribeEvent((evt, state) => {
1656
+ this._handlePointerMove(evt, state);
1657
+ }));
1658
+ this.disposeWithMe(this._shape.onPointerLeave$.subscribeEvent((_evt, state) => {
1659
+ this._handlePointerLeave(state);
1660
+ }));
1661
+ this.disposeWithMe(this._shape.onPointerDown$.subscribeEvent((evt, state) => {
1662
+ this._handlePointerDown(evt, state);
1663
+ }));
1664
+ this.disposeWithMe((_this$_context$compon = (_this$_context$compon2 = this._context.components.get(SHEET_VIEW_KEY.MAIN)) === null || _this$_context$compon2 === void 0 ? void 0 : _this$_context$compon2.onPointerMove$.subscribeEvent((evt) => {
1665
+ const point = this._getLocalPoint(evt);
1666
+ const insertRegion = this._getInsertRegionFromPoint(point.x, point.y);
1667
+ this._shape.setHoveredInsertRegion(insertRegion);
1668
+ })) !== null && _this$_context$compon !== void 0 ? _this$_context$compon : toDisposable(() => {}));
1390
1669
  }
1391
- _initListener() {
1392
- this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
1393
- if (command.id === SetZoomRatioOperation.id || command.id === SetScrollOperation.id) {
1394
- this._anchorVisible$.next(false);
1395
- if (this._timer) clearTimeout(this._timer);
1396
- this._timer = setTimeout(() => {
1397
- this._anchorVisible$.next(true);
1398
- }, 300);
1670
+ _initRefresh() {
1671
+ const commandExecuted$ = fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(filter(([command]) => {
1672
+ if (command.type === CommandType.OPERATION && TABLE_RENDER_REFRESH_COMMANDS.has(command.id)) {
1673
+ this._closeFloatingControls();
1674
+ return true;
1399
1675
  }
1676
+ return command.type === CommandType.MUTATION || command.type === CommandType.COMMAND;
1677
+ }));
1678
+ this.disposeWithMe(merge$1(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(() => {
1679
+ this._closeFloatingControls();
1680
+ this._refresh();
1400
1681
  }));
1401
1682
  }
1402
- _initTableAnchor() {
1403
- this.disposeWithMe(merge$1(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(filter((v) => v)), this._permissionService.permissionPointUpdate$.pipe(debounceTime(300)), this._anchorVisible$).subscribe(() => {
1404
- var _this$_permissionServ;
1405
- if (!this._anchorVisible$.getValue()) {
1406
- this._anchorPosition$.next([]);
1407
- return;
1408
- }
1409
- const workbook = this._context.unit;
1410
- const worksheet = workbook.getActiveSheet();
1411
- const subUnitId = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getSheetId();
1412
- const tables = this._tableManager.getTableList(this._context.unitId).filter((table) => {
1413
- return table.subUnitId === subUnitId;
1683
+ _refresh() {
1684
+ const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
1685
+ const worksheet = this._context.unit.getActiveSheet();
1686
+ if (!skeleton || !worksheet || !this._canEditWorkbook()) {
1687
+ this._shape.setItems([]);
1688
+ this._shape.refreshBounds();
1689
+ this._context.scene.makeDirty();
1690
+ return;
1691
+ }
1692
+ this._syncTopTableGap(skeleton);
1693
+ this._shape.setMenuLabels({
1694
+ rename: this._localeService.t("sheets-table.rename"),
1695
+ "update-range": this._localeService.t("sheets-table.updateRange"),
1696
+ "set-theme": this._localeService.t("sheets-table.setTheme"),
1697
+ delete: this._localeService.t("sheets-table.removeTable")
1698
+ });
1699
+ const unitId = this._context.unit.getUnitId();
1700
+ const subUnitId = worksheet.getSheetId();
1701
+ const items = this._tableManager.getTablesBySubunitId(unitId, subUnitId).map((table) => {
1702
+ var _rangeTheme$getHeader, _rangeTheme$getHeader2, _rangeTheme$getHeader3, _rangeTheme$getHeader4;
1703
+ const rangeTheme = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId());
1704
+ return {
1705
+ tableId: table.getId(),
1706
+ tableName: table.getDisplayName(),
1707
+ range: table.getRange(),
1708
+ 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)",
1709
+ 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)"
1710
+ };
1711
+ });
1712
+ this._shape.setItems(items);
1713
+ this._shape.refreshBounds();
1714
+ this._shape.makeDirty(true);
1715
+ this._context.scene.makeDirty();
1716
+ }
1717
+ _canEditWorkbook() {
1718
+ var _this$_permissionServ;
1719
+ const unitId = this._context.unit.getUnitId();
1720
+ return ((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorkbookEditablePermission(unitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) !== false;
1721
+ }
1722
+ _handlePointerMove(evt, state) {
1723
+ const point = this._getLocalPoint(evt);
1724
+ const hit = this._shape.hitTest(point.x, point.y);
1725
+ const insertRegion = this._isInsertHit(hit) ? hit : hit ? null : this._getInsertRegionFromPoint(point.x, point.y);
1726
+ const activeHit = hit !== null && hit !== void 0 ? hit : insertRegion;
1727
+ this._shape.setHoveredRegion(this._isInsertHit(hit) ? null : hit);
1728
+ this._shape.setHoveredInsertRegion(insertRegion);
1729
+ if (activeHit) {
1730
+ state.stopPropagation();
1731
+ this._context.scene.setCursor(CURSOR_TYPE.POINTER);
1732
+ } else this._context.scene.resetCursor();
1733
+ }
1734
+ _isInsertHit(hit) {
1735
+ return (hit === null || hit === void 0 ? void 0 : hit.type) === "insert-row" || (hit === null || hit === void 0 ? void 0 : hit.type) === "insert-column";
1736
+ }
1737
+ _handlePointerLeave(state) {
1738
+ state.stopPropagation();
1739
+ this._shape.setHoveredRegion(null);
1740
+ this._shape.setHoveredInsertRegion(null);
1741
+ this._context.scene.resetCursor();
1742
+ }
1743
+ _handlePointerDown(evt, state) {
1744
+ var _this$_shape$hitTest;
1745
+ if (evt.button === 2) return;
1746
+ const point = this._getLocalPoint(evt);
1747
+ 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);
1748
+ if (!hit) {
1749
+ this._closeFloatingControls();
1750
+ return;
1751
+ }
1752
+ state.stopPropagation();
1753
+ evt.stopPropagation();
1754
+ evt.preventDefault();
1755
+ this._handleHit(hit);
1756
+ }
1757
+ _handleHit(hit) {
1758
+ const worksheet = this._context.unit.getActiveSheet();
1759
+ if (!worksheet) return;
1760
+ const unitId = this._context.unit.getUnitId();
1761
+ const subUnitId = worksheet.getSheetId();
1762
+ if (hit.type === "anchor-menu-toggle" || hit.type === "anchor-main") {
1763
+ this._shape.setOpenedMenuTableId(this._shape.getOpenedMenuTableId() === hit.tableId ? null : hit.tableId);
1764
+ return;
1765
+ }
1766
+ if (hit.type === "insert-row") {
1767
+ this._commandService.executeCommand(SheetTableInsertRowAtCommand.id, {
1768
+ unitId,
1769
+ subUnitId,
1770
+ tableId: hit.tableId,
1771
+ index: hit.index,
1772
+ count: 1
1414
1773
  });
1415
- const renderUnit = this._renderManagerService.getRenderById(this._context.unitId);
1416
- if (!renderUnit) {
1417
- this._anchorPosition$.next([]);
1418
- return;
1419
- }
1420
- if (!((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorkbookEditablePermission(workbook.getUnitId()).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value)) {
1421
- this._anchorPosition$.next([]);
1422
- return;
1423
- }
1424
- const tableInfos = tables.reduce((acc, table) => {
1425
- const { startRow, startColumn } = table.range;
1426
- const sheetSkeletonManagerService = renderUnit.with(SheetSkeletonManagerService);
1427
- const sheetObject = getSheetObject(this._univerInstanceService, this._renderManagerService);
1428
- if (!sheetObject) return acc;
1429
- const { scene } = sheetObject;
1430
- const viewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
1431
- if (!viewport) return acc;
1432
- const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
1433
- const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
1434
- const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
1435
- if (!scaleX || !scene || !scaleY || !scrollXY) return acc;
1436
- const skeleton = sheetSkeletonManagerService.getCurrentSkeleton();
1437
- if (!skeleton) return acc;
1438
- const position = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn);
1439
- const startX = convertTransformToOffsetX(position.startX, scaleX, scrollXY);
1440
- const startY = convertTransformToOffsetY(position.startY, scaleY, scrollXY) - 25 - 4;
1441
- if (startY >= -10 && startX >= 45) acc.push({
1442
- x: startX,
1443
- y: startY,
1444
- tableId: table.id,
1445
- tableName: table.name
1774
+ this._closeFloatingControls();
1775
+ return;
1776
+ }
1777
+ if (hit.type === "insert-column") {
1778
+ this._commandService.executeCommand(SheetTableInsertColumnAtCommand.id, {
1779
+ unitId,
1780
+ subUnitId,
1781
+ tableId: hit.tableId,
1782
+ index: hit.index,
1783
+ count: 1
1784
+ });
1785
+ this._closeFloatingControls();
1786
+ return;
1787
+ }
1788
+ if (hit.type !== "menu-item") return;
1789
+ switch (hit.action) {
1790
+ case "rename":
1791
+ this._openRenameDialog(unitId, hit.tableId);
1792
+ break;
1793
+ case "update-range":
1794
+ this._openRangeSelector(unitId, subUnitId, hit.tableId);
1795
+ break;
1796
+ case "set-theme":
1797
+ this._openThemePanel(unitId, subUnitId, hit.tableId);
1798
+ break;
1799
+ case "delete":
1800
+ this._commandService.executeCommand(DeleteSheetTableCommand.id, {
1801
+ tableId: hit.tableId,
1802
+ subUnitId,
1803
+ unitId
1446
1804
  });
1447
- return acc;
1448
- }, []);
1449
- this._anchorPosition$.next(tableInfos);
1450
- }));
1805
+ break;
1806
+ }
1807
+ this._closeFloatingControls();
1451
1808
  }
1452
- };
1453
- SheetTableAnchorController = __decorate([
1454
- __decorateParam(1, Inject(Injector)),
1455
- __decorateParam(2, Inject(SheetSkeletonManagerService)),
1456
- __decorateParam(3, IRenderManagerService),
1457
- __decorateParam(4, ICommandService),
1458
- __decorateParam(5, IUniverInstanceService),
1459
- __decorateParam(6, IUIPartsService),
1460
- __decorateParam(7, Inject(TableManager)),
1461
- __decorateParam(8, Inject(SheetScrollManagerService)),
1462
- __decorateParam(9, Inject(WorkbookPermissionService)),
1463
- __decorateParam(10, Inject(IPermissionService))
1464
- ], SheetTableAnchorController);
1465
-
1466
- //#endregion
1467
- //#region src/views/widgets/drawings.ts
1468
- const BUTTON_VIEWPORT = 16;
1469
- 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");
1470
- var TableButton = class {
1471
- static drawNoSetting(ctx, size, fgColor, bgColor) {
1472
- ctx.save();
1473
- Rect.drawWith(ctx, {
1474
- radius: 2,
1475
- width: BUTTON_VIEWPORT,
1476
- height: BUTTON_VIEWPORT,
1477
- fill: bgColor
1809
+ _openRenameDialog(unitId, tableId) {
1810
+ this._dialogService.open({
1811
+ id: SHEET_TABLE_RENAME_DIALOG_ID,
1812
+ title: { title: this._localeService.t("sheets-table.rename") },
1813
+ draggable: true,
1814
+ destroyOnClose: true,
1815
+ mask: true,
1816
+ children: { label: {
1817
+ name: SHEET_TABLE_RENAME_DIALOG,
1818
+ props: {
1819
+ unitId,
1820
+ tableId,
1821
+ onClose: () => this._dialogService.close(SHEET_TABLE_RENAME_DIALOG_ID)
1822
+ }
1823
+ } },
1824
+ width: 360,
1825
+ onClose: () => this._dialogService.close(SHEET_TABLE_RENAME_DIALOG_ID)
1478
1826
  });
1479
- ctx.lineCap = "square";
1480
- ctx.strokeStyle = fgColor;
1481
- ctx.scale(size / BUTTON_VIEWPORT, size / BUTTON_VIEWPORT);
1482
- ctx.beginPath();
1483
- ctx.lineWidth = 1;
1484
- ctx.lineCap = "round";
1485
- ctx.moveTo(3, 4);
1486
- ctx.lineTo(13, 4);
1487
- ctx.moveTo(4.5, 8);
1488
- ctx.lineTo(11.5, 8);
1489
- ctx.moveTo(6, 12);
1490
- ctx.lineTo(10, 12);
1491
- ctx.stroke();
1492
- ctx.restore();
1493
1827
  }
1494
- static drawIconByPath(ctx, pathData, fgColor, bgColor) {
1495
- ctx.save();
1496
- ctx.strokeStyle = fgColor;
1497
- ctx.fillStyle = bgColor;
1498
- Rect.drawWith(ctx, {
1499
- radius: 2,
1500
- width: BUTTON_VIEWPORT,
1501
- height: BUTTON_VIEWPORT,
1502
- fill: bgColor
1828
+ async _openRangeSelector(unitId, subUnitId, tableId) {
1829
+ const table = this._tableManager.getTableById(unitId, tableId);
1830
+ if (!table) return;
1831
+ const selection = await openRangeSelector(this._injector, unitId, subUnitId, table.getRange(), tableId);
1832
+ if (!selection) return;
1833
+ this._commandService.executeCommand(SetSheetTableCommand.id, {
1834
+ tableId,
1835
+ unitId,
1836
+ updateRange: { newRange: selection.range }
1503
1837
  });
1504
- pathData.forEach((d) => {
1505
- const path = new Path2D(d);
1506
- ctx.fillStyle = fgColor;
1507
- ctx.fill(path, "evenodd");
1838
+ }
1839
+ _openThemePanel(unitId, subUnitId, tableId) {
1840
+ const table = this._tableManager.getTableById(unitId, tableId);
1841
+ if (!table) return;
1842
+ this._sidebarService.open({
1843
+ id: SHEET_TABLE_THEME_PANEL_ID,
1844
+ header: { title: this._localeService.t("sheets-table.tableStyle") },
1845
+ children: {
1846
+ label: SHEET_TABLE_THEME_PANEL,
1847
+ oldConfig: table.getTableConfig(),
1848
+ unitId,
1849
+ subUnitId,
1850
+ tableId
1851
+ },
1852
+ width: 330
1508
1853
  });
1509
- ctx.restore();
1854
+ }
1855
+ _getInsertRegionFromPoint(x, y) {
1856
+ const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
1857
+ const worksheet = this._context.unit.getActiveSheet();
1858
+ if (!skeleton || !worksheet) return null;
1859
+ const unitId = this._context.unit.getUnitId();
1860
+ const subUnitId = worksheet.getSheetId();
1861
+ const tables = this._tableManager.getTablesBySubunitId(unitId, subUnitId);
1862
+ for (const table of tables) {
1863
+ const range = table.getRange();
1864
+ const tableBounds = this._getRangeBounds(skeleton, range);
1865
+ if (x < tableBounds.left || x > tableBounds.right || y < tableBounds.top || y > tableBounds.bottom) continue;
1866
+ if (y > this._getRangeBounds(skeleton, {
1867
+ ...range,
1868
+ endRow: range.startRow
1869
+ }).bottom) for (let row = range.startRow + 1; row <= range.endRow; row++) {
1870
+ const cell = skeleton.getNoMergeCellWithCoordByIndex(row, range.startColumn);
1871
+ if (y >= cell.startY && y <= cell.endY) return {
1872
+ type: "insert-row",
1873
+ tableId: table.getId(),
1874
+ index: row + 1,
1875
+ left: tableBounds.left - 22 / 2,
1876
+ top: cell.endY - 22 / 2,
1877
+ width: 22,
1878
+ height: 22
1879
+ };
1880
+ }
1881
+ }
1882
+ return null;
1883
+ }
1884
+ _getRangeBounds(skeleton, range) {
1885
+ const startCell = skeleton.getNoMergeCellWithCoordByIndex(range.startRow, range.startColumn);
1886
+ const endCell = skeleton.getNoMergeCellWithCoordByIndex(range.endRow, range.endColumn);
1887
+ return {
1888
+ left: startCell.startX,
1889
+ top: startCell.startY,
1890
+ right: endCell.endX,
1891
+ bottom: endCell.endY
1892
+ };
1893
+ }
1894
+ _syncTopTableGap(skeleton) {
1895
+ const worksheet = this._context.unit.getActiveSheet();
1896
+ if (!worksheet) return;
1897
+ const unitId = this._context.unit.getUnitId();
1898
+ const subUnitId = worksheet.getSheetId();
1899
+ const hasTopTable = this._tableManager.getTablesBySubunitId(unitId, subUnitId).some((table) => table.getRange().startRow === 0);
1900
+ const current = skeleton.gapConfig;
1901
+ const rowGaps = { ...current.rowGaps };
1902
+ const previousTopGap = rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null;
1903
+ let shouldSync = false;
1904
+ if (hasTopTable) {
1905
+ var _baseGap$size;
1906
+ if (!this._topGapBaseBySkeleton.has(skeleton)) this._topGapBaseBySkeleton.set(skeleton, rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null);
1907
+ const baseGap = this._topGapBaseBySkeleton.get(skeleton);
1908
+ rowGaps[TABLE_CONTROL_GAP_ROW] = {
1909
+ ...baseGap !== null && baseGap !== void 0 ? baseGap : rowGaps[TABLE_CONTROL_GAP_ROW],
1910
+ size: ((_baseGap$size = baseGap === null || baseGap === void 0 ? void 0 : baseGap.size) !== null && _baseGap$size !== void 0 ? _baseGap$size : 0) + 32
1911
+ };
1912
+ shouldSync = true;
1913
+ } else if (this._topGapBaseBySkeleton.has(skeleton)) {
1914
+ const baseGap = this._topGapBaseBySkeleton.get(skeleton);
1915
+ if (baseGap) rowGaps[TABLE_CONTROL_GAP_ROW] = { ...baseGap };
1916
+ else delete rowGaps[TABLE_CONTROL_GAP_ROW];
1917
+ this._topGapBaseBySkeleton.delete(skeleton);
1918
+ shouldSync = true;
1919
+ }
1920
+ if (!shouldSync) return;
1921
+ if (isSameTopGap(previousTopGap, rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null)) return;
1922
+ skeleton.setGapConfig({
1923
+ ...current,
1924
+ rowGaps
1925
+ });
1926
+ this._refreshSelections();
1927
+ }
1928
+ _refreshSelections() {
1929
+ this._selectionRenderService.resetSelectionsByModelData(this._sheetsSelectionsService.getCurrentSelections());
1930
+ }
1931
+ _closeFloatingControls() {
1932
+ this._shape.setOpenedMenuTableId(null);
1933
+ this._shape.setHoveredInsertRegion(null);
1934
+ this._shape.setHoveredRegion(null);
1935
+ }
1936
+ _getLocalPoint(evt) {
1937
+ const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
1938
+ if (skeleton) return getTransformCoord(evt.offsetX, evt.offsetY, this._context.scene, skeleton);
1939
+ return {
1940
+ x: evt.offsetX,
1941
+ y: evt.offsetY
1942
+ };
1510
1943
  }
1511
1944
  };
1512
-
1513
- //#endregion
1514
- //#region src/views/widgets/icons.ts
1515
- /**
1516
- * Copyright 2023-present DreamNum Co., Ltd.
1517
- *
1518
- * Licensed under the Apache License, Version 2.0 (the "License");
1519
- * you may not use this file except in compliance with the License.
1520
- * You may obtain a copy of the License at
1521
- *
1522
- * http://www.apache.org/licenses/LICENSE-2.0
1523
- *
1524
- * Unless required by applicable law or agreed to in writing, software
1525
- * distributed under the License is distributed on an "AS IS" BASIS,
1526
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1527
- * See the License for the specific language governing permissions and
1528
- * limitations under the License.
1529
- */
1530
- 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"];
1531
- 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"];
1532
- 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"];
1533
- const filterNoneSortAsc = [
1534
- "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",
1535
- "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",
1536
- "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"
1537
- ];
1538
- const filterNoneSortDesc = [
1539
- "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",
1540
- "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",
1541
- "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"
1542
- ];
1945
+ SheetTableControlsRenderController = __decorate([
1946
+ __decorateParam(1, Inject(Injector)),
1947
+ __decorateParam(2, Inject(SheetSkeletonManagerService)),
1948
+ __decorateParam(3, ICommandService),
1949
+ __decorateParam(4, Inject(TableManager)),
1950
+ __decorateParam(5, Inject(SheetRangeThemeModel)),
1951
+ __decorateParam(6, Inject(WorkbookPermissionService)),
1952
+ __decorateParam(7, Inject(IPermissionService)),
1953
+ __decorateParam(8, Inject(SheetsSelectionsService)),
1954
+ __decorateParam(9, ISheetSelectionRenderService),
1955
+ __decorateParam(10, Inject(SheetTableThemeUIController)),
1956
+ __decorateParam(11, Inject(LocaleService)),
1957
+ __decorateParam(12, IDialogService),
1958
+ __decorateParam(13, ISidebarService)
1959
+ ], SheetTableControlsRenderController);
1543
1960
 
1544
1961
  //#endregion
1545
1962
  //#region src/views/widgets/table-filter-button.shape.ts
1546
1963
  const FILTER_ICON_SIZE = 16;
1964
+ const FILTER_TRIGGER_HOVER_RADIUS = 4;
1547
1965
  let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends Shape {
1548
- constructor(key, props, _contextService, _commandService, _themeService) {
1966
+ constructor(key, props, _commandService) {
1549
1967
  super(key, props);
1550
- this._contextService = _contextService;
1551
1968
  this._commandService = _commandService;
1552
- this._themeService = _themeService;
1553
1969
  _defineProperty(this, "_cellWidth", 0);
1554
1970
  _defineProperty(this, "_cellHeight", 0);
1555
1971
  _defineProperty(this, "_filterParams", void 0);
1972
+ _defineProperty(this, "_iconColor", "#fff");
1973
+ _defineProperty(this, "_hoverBackground", "rgba(255, 255, 255, 0.92)");
1974
+ _defineProperty(this, "_hoverIconColor", "#202124");
1556
1975
  _defineProperty(this, "_hovered", false);
1557
1976
  this.setShapeProps(props);
1558
1977
  this.onPointerDown$.subscribeEvent((evt) => this.onPointerDown(evt));
@@ -1563,6 +1982,9 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends Sh
1563
1982
  if (typeof props.cellHeight !== "undefined") this._cellHeight = props.cellHeight;
1564
1983
  if (typeof props.cellWidth !== "undefined") this._cellWidth = props.cellWidth;
1565
1984
  if (typeof props.filterParams !== "undefined") this._filterParams = props.filterParams;
1985
+ if (typeof props.iconColor !== "undefined") this._iconColor = props.iconColor;
1986
+ if (typeof props.hoverBackground !== "undefined") this._hoverBackground = props.hoverBackground;
1987
+ if (typeof props.hoverIconColor !== "undefined") this._hoverIconColor = props.hoverIconColor;
1566
1988
  this.transformByState({
1567
1989
  width: props.width,
1568
1990
  height: props.height
@@ -1577,36 +1999,38 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends Sh
1577
1999
  const cellRegion = new Path2D();
1578
2000
  cellRegion.rect(left, top, cellWidth, cellHeight);
1579
2001
  ctx.clip(cellRegion);
1580
- const { buttonState } = this._filterParams;
1581
- const fgColor = this._themeService.getColorFromTheme("primary.600");
1582
- const bgColor = this._hovered ? this._themeService.getColorFromTheme("gray.50") : "rgba(255, 255, 255, 1.0)";
1583
- let icons;
1584
- switch (buttonState) {
1585
- case SheetsTableButtonStateEnum.FilteredSortNone:
1586
- icons = filterPartial;
1587
- break;
1588
- case SheetsTableButtonStateEnum.FilteredSortAsc:
1589
- icons = filteredSortAsc;
1590
- break;
1591
- case SheetsTableButtonStateEnum.FilteredSortDesc:
1592
- icons = filteredSortDesc;
1593
- break;
1594
- case SheetsTableButtonStateEnum.FilterNoneSortNone: break;
1595
- case SheetsTableButtonStateEnum.FilterNoneSortAsc:
1596
- icons = filterNoneSortAsc;
1597
- break;
1598
- case SheetsTableButtonStateEnum.FilterNoneSortDesc:
1599
- icons = filterNoneSortDesc;
1600
- break;
2002
+ if (this._hovered) {
2003
+ var _ctx$roundRect;
2004
+ ctx.save();
2005
+ ctx.fillStyle = this._hoverBackground;
2006
+ ctx.beginPath();
2007
+ (_ctx$roundRect = ctx.roundRect) === null || _ctx$roundRect === void 0 || _ctx$roundRect.call(ctx, 0, 0, 16, 16, FILTER_TRIGGER_HOVER_RADIUS);
2008
+ if (!ctx.roundRect) ctx.rect(0, 0, 16, 16);
2009
+ ctx.fill();
2010
+ ctx.restore();
1601
2011
  }
1602
- if (icons) TableButton.drawIconByPath(ctx, icons, fgColor, bgColor);
1603
- else if (buttonState !== void 0) TableButton.drawNoSetting(ctx, 16, fgColor, bgColor);
2012
+ this._drawChevron(ctx, this._hovered ? this._hoverIconColor : this._iconColor);
2013
+ ctx.restore();
2014
+ }
2015
+ _drawChevron(ctx, color) {
2016
+ const centerX = 16 / 2;
2017
+ const centerY = 16 / 2 + 1;
2018
+ ctx.save();
2019
+ ctx.beginPath();
2020
+ ctx.strokeStyle = color;
2021
+ ctx.lineWidth = 1.8;
2022
+ ctx.lineCap = "round";
2023
+ ctx.lineJoin = "round";
2024
+ ctx.moveTo(centerX - 4.5, centerY - 2.5);
2025
+ ctx.lineTo(centerX, centerY + 2);
2026
+ ctx.lineTo(centerX + 4.5, centerY - 2.5);
2027
+ ctx.stroke();
1604
2028
  ctx.restore();
1605
2029
  }
1606
2030
  onPointerDown(evt) {
1607
2031
  if (evt.button === 2) return;
1608
2032
  const { row, col, unitId, subUnitId, tableId } = this._filterParams;
1609
- if (this._contextService.getContextValue("SHEETS_TABLE_FILTER_PANEL_OPENED_KEY") || !this._commandService.hasCommand(OpenTableFilterPanelOperation.id)) return;
2033
+ if (!this._commandService.hasCommand(OpenTableFilterPanelOperation.id)) return;
1610
2034
  setTimeout(() => {
1611
2035
  const cmdParams = {
1612
2036
  row,
@@ -1627,11 +2051,7 @@ let SheetsTableFilterButtonShape = class SheetsTableFilterButtonShape extends Sh
1627
2051
  this.makeDirty(true);
1628
2052
  }
1629
2053
  };
1630
- SheetsTableFilterButtonShape = __decorate([
1631
- __decorateParam(2, IContextService),
1632
- __decorateParam(3, ICommandService),
1633
- __decorateParam(4, Inject(ThemeService))
1634
- ], SheetsTableFilterButtonShape);
2054
+ SheetsTableFilterButtonShape = __decorate([__decorateParam(2, ICommandService)], SheetsTableFilterButtonShape);
1635
2055
 
1636
2056
  //#endregion
1637
2057
  //#region src/controllers/sheet-table-filter-button-render.controller.ts
@@ -1645,13 +2065,14 @@ const computeIconTop = (startY, endY, cellHeight, verticalAlign) => {
1645
2065
  }
1646
2066
  };
1647
2067
  let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRenderController extends RxDisposable {
1648
- constructor(_context, _injector, _sheetSkeletonManagerService, _sheetInterceptorService, _tableManager, _commandService) {
2068
+ constructor(_context, _injector, _sheetSkeletonManagerService, _sheetInterceptorService, _tableManager, _rangeThemeModel, _commandService) {
1649
2069
  super();
1650
2070
  this._context = _context;
1651
2071
  this._injector = _injector;
1652
2072
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
1653
2073
  this._sheetInterceptorService = _sheetInterceptorService;
1654
2074
  this._tableManager = _tableManager;
2075
+ this._rangeThemeModel = _rangeThemeModel;
1655
2076
  this._commandService = _commandService;
1656
2077
  _defineProperty(this, "_buttonRenderDisposable", null);
1657
2078
  _defineProperty(this, "_tableFilterButtonShapes", []);
@@ -1707,7 +2128,12 @@ let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRende
1707
2128
  const worksheet = workbook.getSheetBySheetId(worksheetId);
1708
2129
  if (!worksheet) return;
1709
2130
  for (const { range, states, tableId } of tableFilterRanges) {
2131
+ var _this$_rangeThemeMode, _headerStyle$cl$rgb, _headerStyle$cl, _headerStyle$bg$rgb, _headerStyle$bg;
1710
2132
  const { startRow, startColumn, endColumn } = range;
2133
+ const table = this._tableManager.getTableById(unitId, tableId);
2134
+ const headerStyle = table ? (_this$_rangeThemeMode = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId())) === null || _this$_rangeThemeMode === void 0 ? void 0 : _this$_rangeThemeMode.getHeaderRowStyle() : null;
2135
+ 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";
2136
+ 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";
1711
2137
  this._interceptCellContent(unitId, worksheetId, range);
1712
2138
  for (let col = startColumn; col <= endColumn; col++) {
1713
2139
  const key = `sheets-table-filter-button-${startRow}-${col}`;
@@ -1725,6 +2151,9 @@ let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRende
1725
2151
  height: 16,
1726
2152
  width: 16,
1727
2153
  zIndex: SHEETS_FILTER_BUTTON_Z_INDEX,
2154
+ iconColor,
2155
+ hoverBackground: iconColor,
2156
+ hoverIconColor,
1728
2157
  cellHeight,
1729
2158
  cellWidth,
1730
2159
  filterParams: {
@@ -1773,7 +2202,8 @@ SheetsTableFilterButtonRenderController = __decorate([
1773
2202
  __decorateParam(2, Inject(SheetSkeletonManagerService)),
1774
2203
  __decorateParam(3, Inject(SheetInterceptorService)),
1775
2204
  __decorateParam(4, Inject(TableManager)),
1776
- __decorateParam(5, ICommandService)
2205
+ __decorateParam(5, Inject(SheetRangeThemeModel)),
2206
+ __decorateParam(6, ICommandService)
1777
2207
  ], SheetsTableFilterButtonRenderController);
1778
2208
 
1779
2209
  //#endregion
@@ -2502,8 +2932,9 @@ let UniverSheetsTableUIPlugin = class UniverSheetsTableUIPlugin extends Plugin {
2502
2932
  this._registerRenderModules();
2503
2933
  }
2504
2934
  _registerRenderModules() {
2505
- const renderDependencies = [[SheetsTableFilterButtonRenderController], [SheetsTableRenderController]];
2506
- if (this._config.hideAnchor !== true) renderDependencies.push([SheetTableAnchorController]);
2935
+ const renderDependencies = [];
2936
+ if (this._config.hideAnchor !== true) renderDependencies.push([SheetTableControlsRenderController]);
2937
+ renderDependencies.push([SheetsTableFilterButtonRenderController], [SheetsTableRenderController]);
2507
2938
  renderDependencies.forEach((m) => {
2508
2939
  this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
2509
2940
  });