@univerjs/sheets-table-ui 1.0.0-alpha.2 → 1.0.0-alpha.3

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.
package/lib/cjs/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- let _univerjs_core = require("@univerjs/core");
3
- let _univerjs_engine_render = require("@univerjs/engine-render");
4
2
  let _univerjs_sheets_table = require("@univerjs/sheets-table");
5
- let _univerjs_sheets_ui = require("@univerjs/sheets-ui");
6
3
  let _univerjs_ui = require("@univerjs/ui");
7
- let rxjs = require("rxjs");
4
+ let _univerjs_core = require("@univerjs/core");
8
5
  let _univerjs_sheets = require("@univerjs/sheets");
6
+ let _univerjs_sheets_ui = require("@univerjs/sheets-ui");
7
+ let rxjs = require("rxjs");
8
+ let _univerjs_engine_render = require("@univerjs/engine-render");
9
9
  let _univerjs_icons = require("@univerjs/icons");
10
10
  let _univerjs_design = require("@univerjs/design");
11
11
  let _univerjs_sheets_sort = require("@univerjs/sheets-sort");
@@ -14,11 +14,6 @@ let react_jsx_runtime = require("react/jsx-runtime");
14
14
  let _univerjs_engine_formula = require("@univerjs/engine-formula");
15
15
  let _univerjs_sheets_formula_ui = require("@univerjs/sheets-formula-ui");
16
16
 
17
- //#region package.json
18
- var name = "@univerjs/sheets-table-ui";
19
- var version = "1.0.0-alpha.2";
20
-
21
- //#endregion
22
17
  //#region src/const.ts
23
18
  /**
24
19
  * Copyright 2023-present DreamNum Co., Ltd.
@@ -49,6 +44,210 @@ const TABLE_DEFAULT_BG_COLOR = "rgb(255, 255, 255)";
49
44
  const TABLE_BORDER_NONE = "none";
50
45
  const TABLE_BORDER_DEFAULT = "1px solid rgb(var(--grey-200))";
51
46
 
47
+ //#endregion
48
+ //#region src/commands/operations/open-table-selector.operation.ts
49
+ const OpenTableSelectorOperation = {
50
+ type: _univerjs_core.CommandType.OPERATION,
51
+ id: "sheet.operation.open-table-selector",
52
+ async handler(accessor) {
53
+ var _lastSelection$range;
54
+ const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
55
+ const commandService = accessor.get(_univerjs_core.ICommandService);
56
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
57
+ if (!target) return false;
58
+ const { unitId, subUnitId, worksheet } = target;
59
+ const lastSelection = accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentLastSelection();
60
+ const range = (_lastSelection$range = lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.range) !== null && _lastSelection$range !== void 0 ? _lastSelection$range : {
61
+ startRow: 0,
62
+ endRow: 0,
63
+ startColumn: 0,
64
+ endColumn: 0
65
+ };
66
+ const rangeInfo = await openRangeSelector(accessor, unitId, subUnitId, (0, _univerjs_sheets.isSingleCellSelection)(lastSelection) ? (0, _univerjs_sheets.expandToContinuousRange)(range, {
67
+ up: true,
68
+ left: true,
69
+ right: true,
70
+ down: true
71
+ }, worksheet) : range);
72
+ if (!rangeInfo) return false;
73
+ commandService.executeCommand(_univerjs_sheets_table.AddSheetTableCommand.id, { ...rangeInfo });
74
+ return true;
75
+ }
76
+ };
77
+ async function openRangeSelector(accessor, unitId, subUnitId, range, tableId) {
78
+ const dialogService = accessor.get(_univerjs_ui.IDialogService);
79
+ const localeService = accessor.get(_univerjs_core.LocaleService);
80
+ return new Promise((resolve) => {
81
+ const dialogProps = {
82
+ unitId,
83
+ subUnitId,
84
+ range,
85
+ tableId,
86
+ onConfirm: (info) => {
87
+ resolve(info);
88
+ dialogService.close(TABLE_SELECTOR_DIALOG);
89
+ },
90
+ onCancel: () => {
91
+ resolve(null);
92
+ dialogService.close(TABLE_SELECTOR_DIALOG);
93
+ }
94
+ };
95
+ dialogService.open({
96
+ id: TABLE_SELECTOR_DIALOG,
97
+ title: { title: localeService.t("sheets-table-ui.selectRange") },
98
+ draggable: true,
99
+ destroyOnClose: true,
100
+ mask: false,
101
+ maskClosable: false,
102
+ children: { label: {
103
+ name: TABLE_SELECTOR_DIALOG,
104
+ props: dialogProps
105
+ } },
106
+ width: 300,
107
+ onClose: () => {
108
+ resolve(null);
109
+ dialogService.close(TABLE_SELECTOR_DIALOG);
110
+ }
111
+ });
112
+ });
113
+ }
114
+
115
+ //#endregion
116
+ //#region src/menu/menu.ts
117
+ const SHEET_TABLE_CONTEXT_INSERT_MENU_ID = "sheet.table.context-insert_menu-id";
118
+ const SHEET_TABLE_CONTEXT_REMOVE_MENU_ID = "sheet.table.context-remove_menu-id";
119
+ function sheetTableToolbarInsertMenuFactory(accessor) {
120
+ return {
121
+ id: OpenTableSelectorOperation.id,
122
+ type: _univerjs_ui.MenuItemType.BUTTON,
123
+ icon: "TableIcon",
124
+ tooltip: "sheets-table-ui.title",
125
+ title: "sheets-table-ui.title",
126
+ hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
127
+ disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {}, true)
128
+ };
129
+ }
130
+ function SheetTableInsertContextMenuFactory(accessor) {
131
+ return {
132
+ id: SHEET_TABLE_CONTEXT_INSERT_MENU_ID,
133
+ type: _univerjs_ui.MenuItemType.SUBITEMS,
134
+ icon: "InsertDoubleIcon",
135
+ title: "sheets-table-ui.insert.main",
136
+ hidden$: getSheetTableRowColOperationHidden$(accessor)
137
+ };
138
+ }
139
+ function SheetTableRemoveContextMenuFactory(accessor) {
140
+ return {
141
+ id: SHEET_TABLE_CONTEXT_REMOVE_MENU_ID,
142
+ type: _univerjs_ui.MenuItemType.SUBITEMS,
143
+ icon: "ReduceDoubleIcon",
144
+ title: "sheets-table-ui.remove.main",
145
+ hidden$: getSheetTableRowColOperationHidden$(accessor)
146
+ };
147
+ }
148
+ function SheetTableInsertRowMenuFactory(accessor) {
149
+ return {
150
+ id: _univerjs_sheets_table.SheetTableInsertRowCommand.id,
151
+ type: _univerjs_ui.MenuItemType.BUTTON,
152
+ title: "sheets-table-ui.insert.row",
153
+ hidden$: getSheetTableHeaderOperationHidden$(accessor)
154
+ };
155
+ }
156
+ function SheetTableInsertColMenuFactory() {
157
+ return {
158
+ id: _univerjs_sheets_table.SheetTableInsertColCommand.id,
159
+ title: "sheets-table-ui.insert.col",
160
+ type: _univerjs_ui.MenuItemType.BUTTON
161
+ };
162
+ }
163
+ function SheetTableRemoveRowMenuFactory(accessor) {
164
+ return {
165
+ id: _univerjs_sheets_table.SheetTableRemoveRowCommand.id,
166
+ type: _univerjs_ui.MenuItemType.BUTTON,
167
+ title: "sheets-table-ui.remove.row",
168
+ hidden$: getSheetTableHeaderOperationHidden$(accessor)
169
+ };
170
+ }
171
+ function SheetTableRemoveColMenuFactory() {
172
+ return {
173
+ id: _univerjs_sheets_table.SheetTableRemoveColCommand.id,
174
+ title: "sheets-table-ui.remove.col",
175
+ type: _univerjs_ui.MenuItemType.BUTTON
176
+ };
177
+ }
178
+ function getSheetTableRowColOperationHidden$(accessor) {
179
+ const sheetsSelectionsService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
180
+ return accessor.get(_univerjs_core.IUniverInstanceService).getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.switchMap)((workbook) => {
181
+ if (!workbook) return (0, rxjs.of)(true);
182
+ return workbook.activeSheet$.pipe((0, rxjs.switchMap)((sheet) => {
183
+ if (!sheet) return (0, rxjs.of)(true);
184
+ return sheetsSelectionsService.selectionMoveEnd$.pipe((0, rxjs.switchMap)((selections) => {
185
+ if (!selections.length || selections.length > 1) return (0, rxjs.of)(true);
186
+ const range = selections[0].range;
187
+ return (0, rxjs.of)(!accessor.get(_univerjs_sheets_table.SheetsTableController).getContainerTableWithRange(workbook.getUnitId(), sheet.getSheetId(), range));
188
+ }));
189
+ }));
190
+ }));
191
+ }
192
+ function getSheetTableHeaderOperationHidden$(accessor) {
193
+ const sheetsSelectionsService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
194
+ return accessor.get(_univerjs_core.IUniverInstanceService).getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.switchMap)((workbook) => {
195
+ if (!workbook) return (0, rxjs.of)(true);
196
+ return workbook.activeSheet$.pipe((0, rxjs.switchMap)((sheet) => {
197
+ if (!sheet) return (0, rxjs.of)(true);
198
+ return sheetsSelectionsService.selectionMoveEnd$.pipe((0, rxjs.switchMap)((selections) => {
199
+ if (!selections.length || selections.length > 1) return (0, rxjs.of)(true);
200
+ const range = selections[0].range;
201
+ const isInTable = accessor.get(_univerjs_sheets_table.SheetsTableController).getContainerTableWithRange(workbook.getUnitId(), sheet.getSheetId(), range);
202
+ if (!isInTable) return (0, rxjs.of)(true);
203
+ const tableRange = isInTable.getRange();
204
+ if (range.startRow === tableRange.startRow) return (0, rxjs.of)(true);
205
+ return (0, rxjs.of)(false);
206
+ }));
207
+ }));
208
+ }));
209
+ }
210
+
211
+ //#endregion
212
+ //#region src/menu/schema.ts
213
+ const menuSchema = {
214
+ [_univerjs_ui.RibbonDataGroup.ORGANIZATION]: { [OpenTableSelectorOperation.id]: {
215
+ order: 0,
216
+ menuItemFactory: sheetTableToolbarInsertMenuFactory
217
+ } },
218
+ [_univerjs_ui.ContextMenuPosition.MAIN_AREA]: { [_univerjs_ui.ContextMenuGroup.LAYOUT]: {
219
+ [SHEET_TABLE_CONTEXT_INSERT_MENU_ID]: {
220
+ order: 5,
221
+ menuItemFactory: SheetTableInsertContextMenuFactory,
222
+ [_univerjs_sheets_table.SheetTableInsertRowCommand.id]: {
223
+ order: 1,
224
+ menuItemFactory: SheetTableInsertRowMenuFactory
225
+ },
226
+ [_univerjs_sheets_table.SheetTableInsertColCommand.id]: {
227
+ order: 2,
228
+ menuItemFactory: SheetTableInsertColMenuFactory
229
+ }
230
+ },
231
+ [SHEET_TABLE_CONTEXT_REMOVE_MENU_ID]: {
232
+ order: 6,
233
+ menuItemFactory: SheetTableRemoveContextMenuFactory,
234
+ [_univerjs_sheets_table.SheetTableRemoveRowCommand.id]: {
235
+ order: 1,
236
+ menuItemFactory: SheetTableRemoveRowMenuFactory
237
+ },
238
+ [_univerjs_sheets_table.SheetTableRemoveColCommand.id]: {
239
+ order: 2,
240
+ menuItemFactory: SheetTableRemoveColMenuFactory
241
+ }
242
+ }
243
+ } }
244
+ };
245
+
246
+ //#endregion
247
+ //#region package.json
248
+ var name = "@univerjs/sheets-table-ui";
249
+ var version = "1.0.0-alpha.3";
250
+
52
251
  //#endregion
53
252
  //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
54
253
  function _typeof(o) {
@@ -207,74 +406,6 @@ const OpenTableFilterPanelOperation = {
207
406
  }
208
407
  };
209
408
 
210
- //#endregion
211
- //#region src/commands/operations/open-table-selector.operation.ts
212
- const OpenTableSelectorOperation = {
213
- type: _univerjs_core.CommandType.OPERATION,
214
- id: "sheet.operation.open-table-selector",
215
- async handler(accessor) {
216
- var _lastSelection$range;
217
- const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
218
- const commandService = accessor.get(_univerjs_core.ICommandService);
219
- const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
220
- if (!target) return false;
221
- const { unitId, subUnitId, worksheet } = target;
222
- const lastSelection = accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentLastSelection();
223
- const range = (_lastSelection$range = lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.range) !== null && _lastSelection$range !== void 0 ? _lastSelection$range : {
224
- startRow: 0,
225
- endRow: 0,
226
- startColumn: 0,
227
- endColumn: 0
228
- };
229
- const rangeInfo = await openRangeSelector(accessor, unitId, subUnitId, (0, _univerjs_sheets.isSingleCellSelection)(lastSelection) ? (0, _univerjs_sheets.expandToContinuousRange)(range, {
230
- up: true,
231
- left: true,
232
- right: true,
233
- down: true
234
- }, worksheet) : range);
235
- if (!rangeInfo) return false;
236
- commandService.executeCommand(_univerjs_sheets_table.AddSheetTableCommand.id, { ...rangeInfo });
237
- return true;
238
- }
239
- };
240
- async function openRangeSelector(accessor, unitId, subUnitId, range, tableId) {
241
- const dialogService = accessor.get(_univerjs_ui.IDialogService);
242
- const localeService = accessor.get(_univerjs_core.LocaleService);
243
- return new Promise((resolve) => {
244
- const dialogProps = {
245
- unitId,
246
- subUnitId,
247
- range,
248
- tableId,
249
- onConfirm: (info) => {
250
- resolve(info);
251
- dialogService.close(TABLE_SELECTOR_DIALOG);
252
- },
253
- onCancel: () => {
254
- resolve(null);
255
- dialogService.close(TABLE_SELECTOR_DIALOG);
256
- }
257
- };
258
- dialogService.open({
259
- id: TABLE_SELECTOR_DIALOG,
260
- title: { title: localeService.t("sheets-table-ui.selectRange") },
261
- draggable: true,
262
- destroyOnClose: true,
263
- mask: false,
264
- maskClosable: false,
265
- children: { label: {
266
- name: TABLE_SELECTOR_DIALOG,
267
- props: dialogProps
268
- } },
269
- width: 300,
270
- onClose: () => {
271
- resolve(null);
272
- dialogService.close(TABLE_SELECTOR_DIALOG);
273
- }
274
- });
275
- });
276
- }
277
-
278
409
  //#endregion
279
410
  //#region src/config/config.ts
280
411
  const SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY = "sheets-table-ui.config";
@@ -1018,10 +1149,20 @@ function SheetTableItemsFilterPanel(props) {
1018
1149
 
1019
1150
  //#endregion
1020
1151
  //#region src/views/components/SheetTableFilterPanel.tsx
1152
+ const FILTER_BY_OPTIONS = [{
1153
+ label: "sheets-table-ui.filter.by-values",
1154
+ value: "items"
1155
+ }, {
1156
+ label: "sheets-table-ui.filter.by-conditions",
1157
+ value: "condition"
1158
+ }];
1021
1159
  function SheetTableFilterPanel() {
1022
1160
  var _permissionService$ge;
1023
1161
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1024
- const filterByItems = useFilterByOptions(localeService);
1162
+ const filterByItems = FILTER_BY_OPTIONS.map((option) => ({
1163
+ ...option,
1164
+ label: localeService.t(option.label)
1165
+ }));
1025
1166
  const tableUiService = (0, _univerjs_ui.useDependency)(SheetsTableUiService);
1026
1167
  const tableManager = (0, _univerjs_ui.useDependency)(_univerjs_sheets_table.TableManager);
1027
1168
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
@@ -1233,15 +1374,6 @@ function SheetTableFilterPanel() {
1233
1374
  ]
1234
1375
  });
1235
1376
  }
1236
- function useFilterByOptions(localeService) {
1237
- return (0, react.useMemo)(() => [{
1238
- label: localeService.t("sheets-table-ui.filter.by-values"),
1239
- value: "items"
1240
- }, {
1241
- label: localeService.t("sheets-table-ui.filter.by-conditions"),
1242
- value: "condition"
1243
- }], [localeService.getCurrentLocale(), localeService]);
1244
- }
1245
1377
 
1246
1378
  //#endregion
1247
1379
  //#region src/views/components/SheetTableRenameDialog.tsx
@@ -1648,7 +1780,7 @@ const SheetTableThemePanel = (props) => {
1648
1780
  "univer-text-gray-900": !headerBgIsDark
1649
1781
  }),
1650
1782
  style: { background: headerBg }
1651
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DropdownIcon, { className: "univer-size-2" })]
1783
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1652
1784
  })
1653
1785
  })]
1654
1786
  }),
@@ -1679,7 +1811,7 @@ const SheetTableThemePanel = (props) => {
1679
1811
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1680
1812
  className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName),
1681
1813
  style: { background: firstRowBg }
1682
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DropdownIcon, { className: "univer-size-2" })]
1814
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1683
1815
  })
1684
1816
  })]
1685
1817
  }),
@@ -1708,7 +1840,7 @@ const SheetTableThemePanel = (props) => {
1708
1840
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1709
1841
  className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName),
1710
1842
  style: { background: secondRowBg }
1711
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DropdownIcon, { className: "univer-size-2" })]
1843
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1712
1844
  })
1713
1845
  })]
1714
1846
  }),
@@ -1740,7 +1872,7 @@ const SheetTableThemePanel = (props) => {
1740
1872
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1741
1873
  className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName),
1742
1874
  style: { background: lastRowBg }
1743
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DropdownIcon, { className: "univer-size-2" })]
1875
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
1744
1876
  })
1745
1877
  })]
1746
1878
  })
@@ -2786,137 +2918,6 @@ SheetTableSelectionController = __decorate([
2786
2918
  __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_table.TableManager))
2787
2919
  ], SheetTableSelectionController);
2788
2920
 
2789
- //#endregion
2790
- //#region src/menu/menu.ts
2791
- const SHEET_TABLE_CONTEXT_INSERT_MENU_ID = "sheet.table.context-insert_menu-id";
2792
- const SHEET_TABLE_CONTEXT_REMOVE_MENU_ID = "sheet.table.context-remove_menu-id";
2793
- function sheetTableToolbarInsertMenuFactory(accessor) {
2794
- return {
2795
- id: OpenTableSelectorOperation.id,
2796
- type: _univerjs_ui.MenuItemType.BUTTON,
2797
- icon: "TableIcon",
2798
- tooltip: "sheets-table-ui.title",
2799
- title: "sheets-table-ui.title",
2800
- hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
2801
- disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {}, true)
2802
- };
2803
- }
2804
- function SheetTableInsertContextMenuFactory(accessor) {
2805
- return {
2806
- id: SHEET_TABLE_CONTEXT_INSERT_MENU_ID,
2807
- type: _univerjs_ui.MenuItemType.SUBITEMS,
2808
- icon: "InsertDoubleIcon",
2809
- title: "sheets-table-ui.insert.main",
2810
- hidden$: getSheetTableRowColOperationHidden$(accessor)
2811
- };
2812
- }
2813
- function SheetTableRemoveContextMenuFactory(accessor) {
2814
- return {
2815
- id: SHEET_TABLE_CONTEXT_REMOVE_MENU_ID,
2816
- type: _univerjs_ui.MenuItemType.SUBITEMS,
2817
- icon: "ReduceDoubleIcon",
2818
- title: "sheets-table-ui.remove.main",
2819
- hidden$: getSheetTableRowColOperationHidden$(accessor)
2820
- };
2821
- }
2822
- function SheetTableInsertRowMenuFactory(accessor) {
2823
- return {
2824
- id: _univerjs_sheets_table.SheetTableInsertRowCommand.id,
2825
- type: _univerjs_ui.MenuItemType.BUTTON,
2826
- title: "sheets-table-ui.insert.row",
2827
- hidden$: getSheetTableHeaderOperationHidden$(accessor)
2828
- };
2829
- }
2830
- function SheetTableInsertColMenuFactory() {
2831
- return {
2832
- id: _univerjs_sheets_table.SheetTableInsertColCommand.id,
2833
- title: "sheets-table-ui.insert.col",
2834
- type: _univerjs_ui.MenuItemType.BUTTON
2835
- };
2836
- }
2837
- function SheetTableRemoveRowMenuFactory(accessor) {
2838
- return {
2839
- id: _univerjs_sheets_table.SheetTableRemoveRowCommand.id,
2840
- type: _univerjs_ui.MenuItemType.BUTTON,
2841
- title: "sheets-table-ui.remove.row",
2842
- hidden$: getSheetTableHeaderOperationHidden$(accessor)
2843
- };
2844
- }
2845
- function SheetTableRemoveColMenuFactory() {
2846
- return {
2847
- id: _univerjs_sheets_table.SheetTableRemoveColCommand.id,
2848
- title: "sheets-table-ui.remove.col",
2849
- type: _univerjs_ui.MenuItemType.BUTTON
2850
- };
2851
- }
2852
- function getSheetTableRowColOperationHidden$(accessor) {
2853
- const sheetsSelectionsService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
2854
- return accessor.get(_univerjs_core.IUniverInstanceService).getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.switchMap)((workbook) => {
2855
- if (!workbook) return (0, rxjs.of)(true);
2856
- return workbook.activeSheet$.pipe((0, rxjs.switchMap)((sheet) => {
2857
- if (!sheet) return (0, rxjs.of)(true);
2858
- return sheetsSelectionsService.selectionMoveEnd$.pipe((0, rxjs.switchMap)((selections) => {
2859
- if (!selections.length || selections.length > 1) return (0, rxjs.of)(true);
2860
- const range = selections[0].range;
2861
- return (0, rxjs.of)(!accessor.get(_univerjs_sheets_table.SheetsTableController).getContainerTableWithRange(workbook.getUnitId(), sheet.getSheetId(), range));
2862
- }));
2863
- }));
2864
- }));
2865
- }
2866
- function getSheetTableHeaderOperationHidden$(accessor) {
2867
- const sheetsSelectionsService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
2868
- return accessor.get(_univerjs_core.IUniverInstanceService).getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.switchMap)((workbook) => {
2869
- if (!workbook) return (0, rxjs.of)(true);
2870
- return workbook.activeSheet$.pipe((0, rxjs.switchMap)((sheet) => {
2871
- if (!sheet) return (0, rxjs.of)(true);
2872
- return sheetsSelectionsService.selectionMoveEnd$.pipe((0, rxjs.switchMap)((selections) => {
2873
- if (!selections.length || selections.length > 1) return (0, rxjs.of)(true);
2874
- const range = selections[0].range;
2875
- const isInTable = accessor.get(_univerjs_sheets_table.SheetsTableController).getContainerTableWithRange(workbook.getUnitId(), sheet.getSheetId(), range);
2876
- if (!isInTable) return (0, rxjs.of)(true);
2877
- const tableRange = isInTable.getRange();
2878
- if (range.startRow === tableRange.startRow) return (0, rxjs.of)(true);
2879
- return (0, rxjs.of)(false);
2880
- }));
2881
- }));
2882
- }));
2883
- }
2884
-
2885
- //#endregion
2886
- //#region src/menu/schema.ts
2887
- const menuSchema = {
2888
- [_univerjs_ui.RibbonDataGroup.ORGANIZATION]: { [OpenTableSelectorOperation.id]: {
2889
- order: 0,
2890
- menuItemFactory: sheetTableToolbarInsertMenuFactory
2891
- } },
2892
- [_univerjs_ui.ContextMenuPosition.MAIN_AREA]: { [_univerjs_ui.ContextMenuGroup.LAYOUT]: {
2893
- [SHEET_TABLE_CONTEXT_INSERT_MENU_ID]: {
2894
- order: 5,
2895
- menuItemFactory: SheetTableInsertContextMenuFactory,
2896
- [_univerjs_sheets_table.SheetTableInsertRowCommand.id]: {
2897
- order: 1,
2898
- menuItemFactory: SheetTableInsertRowMenuFactory
2899
- },
2900
- [_univerjs_sheets_table.SheetTableInsertColCommand.id]: {
2901
- order: 2,
2902
- menuItemFactory: SheetTableInsertColMenuFactory
2903
- }
2904
- },
2905
- [SHEET_TABLE_CONTEXT_REMOVE_MENU_ID]: {
2906
- order: 6,
2907
- menuItemFactory: SheetTableRemoveContextMenuFactory,
2908
- [_univerjs_sheets_table.SheetTableRemoveRowCommand.id]: {
2909
- order: 1,
2910
- menuItemFactory: SheetTableRemoveRowMenuFactory
2911
- },
2912
- [_univerjs_sheets_table.SheetTableRemoveColCommand.id]: {
2913
- order: 2,
2914
- menuItemFactory: SheetTableRemoveColMenuFactory
2915
- }
2916
- }
2917
- } }
2918
- };
2919
-
2920
2921
  //#endregion
2921
2922
  //#region src/menu/sheet-table-menu.controller.ts
2922
2923
  /**
@@ -3015,6 +3016,7 @@ UniverSheetsTableUIPlugin = __decorate([
3015
3016
  ], UniverSheetsTableUIPlugin);
3016
3017
 
3017
3018
  //#endregion
3019
+ exports.SheetsTableUIMenuSchema = menuSchema;
3018
3020
  Object.defineProperty(exports, 'UniverSheetsTableUIPlugin', {
3019
3021
  enumerable: true,
3020
3022
  get: function () {