@atlaskit/editor-plugin-table 22.4.8 → 22.4.10
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/CHANGELOG.md +16 -0
- package/dist/cjs/pm-plugins/commands/split-cell.js +18 -1
- package/dist/cjs/pm-plugins/transforms/merge.js +5 -2
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +1 -0
- package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +2 -9
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +12 -0
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +12 -0
- package/dist/cjs/ui/TableMenu/cell/keys.js +2 -2
- package/dist/cjs/ui/TableMenu/column/getColumnMenuComponents.js +4 -11
- package/dist/cjs/ui/TableMenu/column/items/ColumnBackgroundSection.js +25 -0
- package/dist/cjs/ui/TableMenu/column/items/ColumnToggleSection.js +24 -0
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +10 -0
- package/dist/cjs/ui/TableMenu/column/items/HeaderColumnToggleItem.js +17 -1
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +3 -1
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +3 -1
- package/dist/cjs/ui/TableMenu/row/getRowMenuComponents.js +0 -7
- package/dist/cjs/ui/TableMenu/row/items/HeaderRowToggleItem.js +9 -0
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +10 -0
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +10 -0
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +51 -2
- package/dist/cjs/ui/TableMenu/shared/TableMenuContext.js +13 -0
- package/dist/cjs/ui/TableMenu/shared/consts.js +3 -2
- package/dist/cjs/ui/event-handlers.js +6 -1
- package/dist/es2019/pm-plugins/commands/split-cell.js +17 -1
- package/dist/es2019/pm-plugins/transforms/merge.js +4 -4
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +1 -0
- package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +3 -11
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +11 -0
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +11 -0
- package/dist/es2019/ui/TableMenu/cell/keys.js +1 -1
- package/dist/es2019/ui/TableMenu/column/getColumnMenuComponents.js +4 -12
- package/dist/es2019/ui/TableMenu/column/items/ColumnBackgroundSection.js +20 -0
- package/dist/es2019/ui/TableMenu/column/items/ColumnToggleSection.js +19 -0
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +11 -0
- package/dist/es2019/ui/TableMenu/column/items/HeaderColumnToggleItem.js +15 -0
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +3 -1
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +3 -1
- package/dist/es2019/ui/TableMenu/row/getRowMenuComponents.js +0 -8
- package/dist/es2019/ui/TableMenu/row/items/HeaderRowToggleItem.js +8 -0
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +8 -0
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +8 -0
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +49 -2
- package/dist/es2019/ui/TableMenu/shared/TableMenuContext.js +4 -0
- package/dist/es2019/ui/TableMenu/shared/consts.js +2 -1
- package/dist/es2019/ui/event-handlers.js +4 -1
- package/dist/esm/pm-plugins/commands/split-cell.js +17 -1
- package/dist/esm/pm-plugins/transforms/merge.js +4 -2
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +1 -0
- package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +3 -11
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +13 -0
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +13 -0
- package/dist/esm/ui/TableMenu/cell/keys.js +1 -1
- package/dist/esm/ui/TableMenu/column/getColumnMenuComponents.js +4 -12
- package/dist/esm/ui/TableMenu/column/items/ColumnBackgroundSection.js +19 -0
- package/dist/esm/ui/TableMenu/column/items/ColumnToggleSection.js +18 -0
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +11 -0
- package/dist/esm/ui/TableMenu/column/items/HeaderColumnToggleItem.js +17 -0
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +3 -1
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +3 -1
- package/dist/esm/ui/TableMenu/row/getRowMenuComponents.js +0 -8
- package/dist/esm/ui/TableMenu/row/items/HeaderRowToggleItem.js +10 -0
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +10 -0
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +10 -0
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +50 -2
- package/dist/esm/ui/TableMenu/shared/TableMenuContext.js +6 -0
- package/dist/esm/ui/TableMenu/shared/consts.js +2 -1
- package/dist/esm/ui/event-handlers.js +6 -1
- package/dist/types/pm-plugins/commands/split-cell.d.ts +2 -0
- package/dist/types/pm-plugins/transforms/merge.d.ts +2 -0
- package/dist/types/ui/TableMenu/cell/getCellMenuComponents.d.ts +0 -7
- package/dist/types/ui/TableMenu/cell/items/MergeCellsItem.d.ts +1 -1
- package/dist/types/ui/TableMenu/cell/items/SplitCellItem.d.ts +1 -1
- package/dist/types/ui/TableMenu/cell/keys.d.ts +1 -1
- package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +0 -7
- package/dist/types/ui/TableMenu/column/items/ColumnBackgroundSection.d.ts +10 -0
- package/dist/types/ui/TableMenu/column/items/ColumnToggleSection.d.ts +9 -0
- package/dist/types/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
- package/dist/types/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +11 -1
- package/dist/types/ui/TableMenu/row/getRowMenuComponents.d.ts +0 -7
- package/dist/types/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +1 -1
- package/dist/types/ui/TableMenu/row/items/MoveRowDownItem.d.ts +1 -1
- package/dist/types/ui/TableMenu/row/items/MoveRowUpItem.d.ts +1 -1
- package/dist/types/ui/TableMenu/shared/TableMenu.d.ts +3 -1
- package/dist/types/ui/TableMenu/shared/TableMenuContext.d.ts +14 -0
- package/dist/types/ui/TableMenu/shared/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/commands/split-cell.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/transforms/merge.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/getCellMenuComponents.d.ts +0 -7
- package/dist/types-ts4.5/ui/TableMenu/cell/items/MergeCellsItem.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/items/SplitCellItem.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/keys.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/column/getColumnMenuComponents.d.ts +0 -7
- package/dist/types-ts4.5/ui/TableMenu/column/items/ColumnBackgroundSection.d.ts +10 -0
- package/dist/types-ts4.5/ui/TableMenu/column/items/ColumnToggleSection.d.ts +9 -0
- package/dist/types-ts4.5/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +11 -1
- package/dist/types-ts4.5/ui/TableMenu/row/getRowMenuComponents.d.ts +0 -7
- package/dist/types-ts4.5/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowDownItem.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowUpItem.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/TableMenu.d.ts +3 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/TableMenuContext.d.ts +14 -0
- package/dist/types-ts4.5/ui/TableMenu/shared/consts.d.ts +1 -0
- package/package.json +4 -4
|
@@ -2,15 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
3
|
import { MergeCellsItem } from './items/MergeCellsItem';
|
|
4
4
|
import { SplitCellItem } from './items/SplitCellItem';
|
|
5
|
-
import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION,
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns the RegisterComponent[] array defining the cell contextual menu surface.
|
|
9
|
-
*
|
|
10
|
-
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
11
|
-
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
12
|
-
* will be connected in follow-up tickets.
|
|
13
|
-
*/
|
|
5
|
+
import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK } from './keys';
|
|
14
6
|
export var getCellMenuComponents = function getCellMenuComponents() {
|
|
15
7
|
return [
|
|
16
8
|
// --- Menu surface ---
|
|
@@ -25,7 +17,7 @@ export var getCellMenuComponents = function getCellMenuComponents() {
|
|
|
25
17
|
parents: [{
|
|
26
18
|
type: CELL_MENU.type,
|
|
27
19
|
key: CELL_MENU.key,
|
|
28
|
-
rank:
|
|
20
|
+
rank: CELL_MENU_RANK[CELL_ACTION_SECTION.key]
|
|
29
21
|
}],
|
|
30
22
|
component: function component(props) {
|
|
31
23
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children);
|
|
@@ -60,7 +52,7 @@ export var getCellMenuComponents = function getCellMenuComponents() {
|
|
|
60
52
|
parents: [{
|
|
61
53
|
type: CELL_MENU.type,
|
|
62
54
|
key: CELL_MENU.key,
|
|
63
|
-
rank:
|
|
55
|
+
rank: CELL_MENU_RANK[CELL_DANGER_SECTION.key]
|
|
64
56
|
}],
|
|
65
57
|
component: function component(props) {
|
|
66
58
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
@@ -2,9 +2,22 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { TableCellMergeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Merge cells is only visible when the active selection can actually be merged
|
|
9
|
+
* (multi-cell, non-overlapping).
|
|
10
|
+
*/
|
|
11
|
+
var shouldShowMergeCells = function shouldShowMergeCells(tableMenuContext) {
|
|
12
|
+
return (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMergeCells) === true;
|
|
13
|
+
};
|
|
5
14
|
export var MergeCellsItem = function MergeCellsItem() {
|
|
15
|
+
var tableMenuContext = useTableMenuContext();
|
|
6
16
|
var _useIntl = useIntl(),
|
|
7
17
|
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
8
21
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
9
22
|
elemBefore: /*#__PURE__*/React.createElement(TableCellMergeIcon, {
|
|
10
23
|
label: "",
|
|
@@ -2,9 +2,22 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { TableCellSplitIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Split cell is only visible when the active selection sits in a cell whose
|
|
9
|
+
* `rowspan` or `colspan` is greater than one.
|
|
10
|
+
*/
|
|
11
|
+
var shouldShowSplitCell = function shouldShowSplitCell(tableMenuContext) {
|
|
12
|
+
return (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canSplitCell) === true;
|
|
13
|
+
};
|
|
5
14
|
export var SplitCellItem = function SplitCellItem() {
|
|
15
|
+
var tableMenuContext = useTableMenuContext();
|
|
6
16
|
var _useIntl = useIntl(),
|
|
7
17
|
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
8
21
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
9
22
|
elemBefore: /*#__PURE__*/React.createElement(TableCellSplitIcon, {
|
|
10
23
|
label: "",
|
|
@@ -18,7 +18,7 @@ export var CELL_DANGER_SECTION = {
|
|
|
18
18
|
type: 'menu-section',
|
|
19
19
|
key: 'cell-danger-section'
|
|
20
20
|
};
|
|
21
|
-
export var
|
|
21
|
+
export var CELL_MENU_RANK = _defineProperty(_defineProperty({}, CELL_ACTION_SECTION.key, 100), CELL_DANGER_SECTION.key, 200);
|
|
22
22
|
export var MERGE_CELLS_ITEM = {
|
|
23
23
|
type: 'menu-item',
|
|
24
24
|
key: 'merge-cells'
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
3
|
import { AddColumnLeftItem } from './items/AddColumnLeftItem';
|
|
4
4
|
import { AddColumnRightItem } from './items/AddColumnRightItem';
|
|
5
|
+
import { ColumnBackgroundSection } from './items/ColumnBackgroundSection';
|
|
6
|
+
import { ColumnToggleSection } from './items/ColumnToggleSection';
|
|
5
7
|
import { DeleteColumnItem } from './items/DeleteColumnItem';
|
|
6
8
|
import { DistributeColumnsItem } from './items/DistributeColumnsItem';
|
|
7
9
|
import { HeaderColumnToggleItem } from './items/HeaderColumnToggleItem';
|
|
@@ -9,14 +11,6 @@ import { MoveColumnRightItem } from './items/MoveColumnRightItem';
|
|
|
9
11
|
import { SortDecreasingItem } from './items/SortDecreasingItem';
|
|
10
12
|
import { SortIncreasingItem } from './items/SortIncreasingItem';
|
|
11
13
|
import { COLUMN_MENU, COLUMN_TOGGLE_SECTION, COLUMN_BACKGROUND_SECTION, COLUMN_SORT_SECTION, COLUMN_ADD_SECTION, COLUMN_DANGER_SECTION, COLUMN_SECTION_RANK, HEADER_COLUMN_TOGGLE_ITEM, SORT_INCREASING_ITEM, SORT_DECREASING_ITEM, ADD_COLUMN_LEFT_ITEM, ADD_COLUMN_RIGHT_ITEM, MOVE_COLUMN_RIGHT_ITEM, DISTRIBUTE_COLUMNS_ITEM, DELETE_COLUMN_ITEM, COLUMN_TOGGLE_SECTION_RANK, COLUMN_SORT_SECTION_RANK, COLUMN_ADD_SECTION_RANK, COLUMN_DANGER_SECTION_RANK } from './keys';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns the RegisterComponent[] array defining the column menu surface.
|
|
15
|
-
*
|
|
16
|
-
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
17
|
-
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
18
|
-
* will be connected in follow-up tickets.
|
|
19
|
-
*/
|
|
20
14
|
export var getColumnMenuComponents = function getColumnMenuComponents() {
|
|
21
15
|
return [
|
|
22
16
|
// --- Menu surface ---
|
|
@@ -34,7 +28,7 @@ export var getColumnMenuComponents = function getColumnMenuComponents() {
|
|
|
34
28
|
rank: COLUMN_SECTION_RANK[COLUMN_TOGGLE_SECTION.key]
|
|
35
29
|
}],
|
|
36
30
|
component: function component(props) {
|
|
37
|
-
return /*#__PURE__*/React.createElement(
|
|
31
|
+
return /*#__PURE__*/React.createElement(ColumnToggleSection, null, props.children);
|
|
38
32
|
}
|
|
39
33
|
}, {
|
|
40
34
|
type: HEADER_COLUMN_TOGGLE_ITEM.type,
|
|
@@ -58,9 +52,7 @@ export var getColumnMenuComponents = function getColumnMenuComponents() {
|
|
|
58
52
|
rank: COLUMN_SECTION_RANK[COLUMN_BACKGROUND_SECTION.key]
|
|
59
53
|
}],
|
|
60
54
|
component: function component(props) {
|
|
61
|
-
return /*#__PURE__*/React.createElement(
|
|
62
|
-
hasSeparator: true
|
|
63
|
-
}, props.children);
|
|
55
|
+
return /*#__PURE__*/React.createElement(ColumnBackgroundSection, null, props.children);
|
|
64
56
|
}
|
|
65
57
|
},
|
|
66
58
|
// --- Sort section ---
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
4
|
+
import { shouldShowHeaderColumnToggle } from './HeaderColumnToggleItem';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Background section sits directly below `ColumnToggleSection`. Its separator
|
|
8
|
+
* exists only to divide it from the toggle section; when the toggle section
|
|
9
|
+
* is hidden, the separator must drop too so we don't render a stray rule at
|
|
10
|
+
* the very top of the menu.
|
|
11
|
+
*/
|
|
12
|
+
export var ColumnBackgroundSection = function ColumnBackgroundSection(_ref) {
|
|
13
|
+
var children = _ref.children;
|
|
14
|
+
var tableMenuContext = useTableMenuContext();
|
|
15
|
+
var hasSeparator = shouldShowHeaderColumnToggle(tableMenuContext);
|
|
16
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
17
|
+
hasSeparator: hasSeparator
|
|
18
|
+
}, children);
|
|
19
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
4
|
+
import { shouldShowHeaderColumnToggle } from './HeaderColumnToggleItem';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The toggle section currently contains only the Header column toggle. When
|
|
8
|
+
* that item is hidden, the whole section disappears so we don't render an
|
|
9
|
+
* empty wrapper (and so the section below can drop its leading separator).
|
|
10
|
+
*/
|
|
11
|
+
export var ColumnToggleSection = function ColumnToggleSection(_ref) {
|
|
12
|
+
var children = _ref.children;
|
|
13
|
+
var tableMenuContext = useTableMenuContext();
|
|
14
|
+
if (!shouldShowHeaderColumnToggle(tableMenuContext)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
|
|
18
|
+
};
|
|
@@ -2,9 +2,20 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
+
|
|
7
|
+
/** Distribute columns is only visible when more than one column is selected. */
|
|
8
|
+
var shouldShowDistributeColumns = function shouldShowDistributeColumns(tableMenuContext) {
|
|
9
|
+
var _tableMenuContext$sel;
|
|
10
|
+
return ((_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 0) > 1;
|
|
11
|
+
};
|
|
5
12
|
export var DistributeColumnsItem = function DistributeColumnsItem() {
|
|
13
|
+
var tableMenuContext = useTableMenuContext();
|
|
6
14
|
var _useIntl = useIntl(),
|
|
7
15
|
formatMessage = _useIntl.formatMessage;
|
|
16
|
+
if (!shouldShowDistributeColumns(tableMenuContext)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
8
19
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
9
20
|
elemBefore: /*#__PURE__*/React.createElement(TableColumnsDistributeIcon, {
|
|
10
21
|
color: "currentColor",
|
|
@@ -3,10 +3,27 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import Toggle from '@atlaskit/toggle';
|
|
6
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Header column toggle is only visible when the first column is the entire
|
|
10
|
+
* selection.
|
|
11
|
+
*
|
|
12
|
+
* Exported so `ColumnToggleSection` (which can become empty) and
|
|
13
|
+
* `ColumnBackgroundSection` (which drops its leading separator alongside)
|
|
14
|
+
* can stay in lockstep with this rule without redefining it.
|
|
15
|
+
*/
|
|
16
|
+
export var shouldShowHeaderColumnToggle = function shouldShowHeaderColumnToggle(tableMenuContext) {
|
|
17
|
+
return (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn) === true && tableMenuContext.selectedColumnCount === 1;
|
|
18
|
+
};
|
|
6
19
|
export var HeaderColumnToggleItem = function HeaderColumnToggleItem() {
|
|
20
|
+
var tableMenuContext = useTableMenuContext();
|
|
7
21
|
var _useIntl = useIntl(),
|
|
8
22
|
formatMessage = _useIntl.formatMessage;
|
|
9
23
|
var label = formatMessage(messages.headerColumn);
|
|
24
|
+
if (!shouldShowHeaderColumnToggle(tableMenuContext)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
10
27
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
11
28
|
elemAfter: /*#__PURE__*/React.createElement(Toggle, {
|
|
12
29
|
label: label,
|
|
@@ -2,11 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { ArrowDownIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
5
6
|
export var SortDecreasingItem = function SortDecreasingItem() {
|
|
7
|
+
var tableMenuContext = useTableMenuContext();
|
|
6
8
|
var _useIntl = useIntl(),
|
|
7
9
|
formatMessage = _useIntl.formatMessage;
|
|
8
10
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
9
|
-
isDisabled:
|
|
11
|
+
isDisabled: Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.hasMergedCellsInTable),
|
|
10
12
|
elemBefore: /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
11
13
|
color: "currentColor",
|
|
12
14
|
label: "",
|
|
@@ -2,11 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { ArrowUpIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
5
6
|
export var SortIncreasingItem = function SortIncreasingItem() {
|
|
7
|
+
var tableMenuContext = useTableMenuContext();
|
|
6
8
|
var _useIntl = useIntl(),
|
|
7
9
|
formatMessage = _useIntl.formatMessage;
|
|
8
10
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
9
|
-
isDisabled:
|
|
11
|
+
isDisabled: Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.hasMergedCellsInTable),
|
|
10
12
|
elemBefore: /*#__PURE__*/React.createElement(ArrowUpIcon, {
|
|
11
13
|
color: "currentColor",
|
|
12
14
|
label: "",
|
|
@@ -8,14 +8,6 @@ import { MoveRowDownItem } from './items/MoveRowDownItem';
|
|
|
8
8
|
import { MoveRowUpItem } from './items/MoveRowUpItem';
|
|
9
9
|
import { NumberedRowsToggleItem } from './items/NumberedRowsToggleItem';
|
|
10
10
|
import { ROW_MENU, ROW_TOGGLE_SECTION, ROW_BACKGROUND_SECTION, ROW_ADD_SECTION, ROW_DANGER_SECTION, ROW_MENU_SECTION_RANK, HEADER_ROW_TOGGLE_ITEM, NUMBERED_ROWS_TOGGLE_ITEM, ADD_ROW_ABOVE_ITEM, ADD_ROW_BELOW_ITEM, MOVE_ROW_UP_ITEM, MOVE_ROW_DOWN_ITEM, DELETE_ROW_ITEM, ROW_TOGGLE_SECTION_RANK, ROW_ADD_SECTION_RANK, ROW_DANGER_SECTION_RANK } from './keys';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Returns the RegisterComponent[] array defining the row menu surface.
|
|
14
|
-
*
|
|
15
|
-
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
16
|
-
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
17
|
-
* will be connected in follow-up tickets.
|
|
18
|
-
*/
|
|
19
11
|
export var getRowMenuComponents = function getRowMenuComponents() {
|
|
20
12
|
return [
|
|
21
13
|
// --- Menu surface ---
|
|
@@ -3,10 +3,20 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import Toggle from '@atlaskit/toggle';
|
|
6
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
7
|
+
|
|
8
|
+
/** Header row toggle is only visible when the first row is the entire selection. */
|
|
9
|
+
var shouldShowHeaderRowToggle = function shouldShowHeaderRowToggle(tableMenuContext) {
|
|
10
|
+
return (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow) === true && tableMenuContext.selectedRowCount === 1;
|
|
11
|
+
};
|
|
6
12
|
export var HeaderRowToggleItem = function HeaderRowToggleItem() {
|
|
13
|
+
var tableMenuContext = useTableMenuContext();
|
|
7
14
|
var _useIntl = useIntl(),
|
|
8
15
|
formatMessage = _useIntl.formatMessage;
|
|
9
16
|
var label = formatMessage(messages.headerRow);
|
|
17
|
+
if (!shouldShowHeaderRowToggle(tableMenuContext)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
10
20
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
11
21
|
elemAfter: /*#__PURE__*/React.createElement(Toggle, {
|
|
12
22
|
label: label,
|
|
@@ -4,13 +4,23 @@ import { moveRowDown, moveRowDownOld, tooltip } from '@atlaskit/editor-common/ke
|
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { TableRowMoveDownIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
7
8
|
var getMoveRowDownShortcut = function getMoveRowDownShortcut() {
|
|
8
9
|
return tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveRowDown : moveRowDownOld);
|
|
9
10
|
};
|
|
11
|
+
|
|
12
|
+
/** Move row down is hidden when the selection includes the last row (cannot move further down). */
|
|
13
|
+
var shouldShowMoveRowDown = function shouldShowMoveRowDown(tableMenuContext) {
|
|
14
|
+
return !(tableMenuContext !== null && tableMenuContext !== void 0 && tableMenuContext.isLastRow);
|
|
15
|
+
};
|
|
10
16
|
export var MoveRowDownItem = function MoveRowDownItem() {
|
|
11
17
|
var _getMoveRowDownShortc;
|
|
18
|
+
var tableMenuContext = useTableMenuContext();
|
|
12
19
|
var _useIntl = useIntl(),
|
|
13
20
|
formatMessage = _useIntl.formatMessage;
|
|
21
|
+
if (!shouldShowMoveRowDown(tableMenuContext)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
14
24
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
15
25
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
16
26
|
color: "currentColor",
|
|
@@ -4,13 +4,23 @@ import { moveRowUp, moveRowUpOld, tooltip } from '@atlaskit/editor-common/keymap
|
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { TableRowMoveUpIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
7
8
|
var getMoveRowUpShortcut = function getMoveRowUpShortcut() {
|
|
8
9
|
return tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveRowUp : moveRowUpOld);
|
|
9
10
|
};
|
|
11
|
+
|
|
12
|
+
/** Move row up is hidden when the selection includes row 0 (cannot move further up). */
|
|
13
|
+
var shouldShowMoveRowUp = function shouldShowMoveRowUp(tableMenuContext) {
|
|
14
|
+
return !(tableMenuContext !== null && tableMenuContext !== void 0 && tableMenuContext.isFirstRow);
|
|
15
|
+
};
|
|
10
16
|
export var MoveRowUpItem = function MoveRowUpItem() {
|
|
11
17
|
var _getMoveRowUpShortcut;
|
|
18
|
+
var tableMenuContext = useTableMenuContext();
|
|
12
19
|
var _useIntl = useIntl(),
|
|
13
20
|
formatMessage = _useIntl.formatMessage;
|
|
21
|
+
if (!shouldShowMoveRowUp(tableMenuContext)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
14
24
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
15
25
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
16
26
|
color: "currentColor",
|
|
@@ -1,28 +1,76 @@
|
|
|
1
1
|
/* TableMenu.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import "./TableMenu.compiled.css";
|
|
3
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
7
|
import React, { memo, useMemo } from 'react';
|
|
8
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
|
+
import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar';
|
|
10
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
11
|
+
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
5
12
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
6
13
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import { canSplitCellSelection } from '../../../pm-plugins/commands/split-cell';
|
|
15
|
+
import { canMergeCellSelection } from '../../../pm-plugins/transforms/merge';
|
|
16
|
+
import { TableMenuProvider } from './TableMenuContext';
|
|
7
17
|
var tableMenuContainerStyles = {
|
|
8
18
|
container: "_2rko1qi0 _1reo15vq _18m915vq _1bsb1178 _16qs130s _bfhk1bhr"
|
|
9
19
|
};
|
|
20
|
+
var EMPTY_CONTEXT = {};
|
|
10
21
|
export var TableMenu = /*#__PURE__*/memo(function (_ref) {
|
|
11
22
|
var api = _ref.api,
|
|
23
|
+
editorView = _ref.editorView,
|
|
12
24
|
surface = _ref.surface;
|
|
13
25
|
var components = useMemo(function () {
|
|
14
26
|
var _api$uiControlRegistr, _api$uiControlRegistr2;
|
|
15
27
|
return (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(surface.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
16
28
|
}, [api, surface.key]);
|
|
29
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table', 'selection'], function (states) {
|
|
30
|
+
var _states$tableState, _states$selectionStat;
|
|
31
|
+
return {
|
|
32
|
+
tableNode: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.tableNode,
|
|
33
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
tableNode = _useSharedPluginState.tableNode,
|
|
37
|
+
selection = _useSharedPluginState.selection;
|
|
38
|
+
var tableMenuContext = useMemo(function () {
|
|
39
|
+
if (!selection || !tableNode) {
|
|
40
|
+
return EMPTY_CONTEXT;
|
|
41
|
+
}
|
|
42
|
+
var tableMap = TableMap.get(tableNode);
|
|
43
|
+
var selectionRect = getSelectionRect(selection);
|
|
44
|
+
var cellOps = {
|
|
45
|
+
canMergeCells: canMergeCellSelection(selection),
|
|
46
|
+
canSplitCell: canSplitCellSelection(selection),
|
|
47
|
+
hasMergedCellsInTable: tableMap.hasMergedCells()
|
|
48
|
+
};
|
|
49
|
+
if (!selectionRect) {
|
|
50
|
+
return cellOps;
|
|
51
|
+
}
|
|
52
|
+
return _objectSpread(_objectSpread({}, cellOps), {}, {
|
|
53
|
+
isFirstRow: selectionRect.top === 0,
|
|
54
|
+
isLastRow: selectionRect.bottom === tableMap.height,
|
|
55
|
+
selectedRowCount: selectionRect.bottom - selectionRect.top,
|
|
56
|
+
isFirstColumn: selectionRect.left === 0,
|
|
57
|
+
isLastColumn: selectionRect.right === tableMap.width,
|
|
58
|
+
selectedColumnCount: selectionRect.right - selectionRect.left
|
|
59
|
+
});
|
|
60
|
+
}, [selection, tableNode]);
|
|
17
61
|
if (components.length === 0) {
|
|
18
62
|
return null;
|
|
19
63
|
}
|
|
20
|
-
return /*#__PURE__*/React.createElement(
|
|
64
|
+
return /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
|
65
|
+
editorView: editorView !== null && editorView !== void 0 ? editorView : null
|
|
66
|
+
}, /*#__PURE__*/React.createElement(TableMenuProvider, {
|
|
67
|
+
value: tableMenuContext
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
21
69
|
xcss: tableMenuContainerStyles.container,
|
|
22
70
|
testId: surface.key
|
|
23
71
|
}, /*#__PURE__*/React.createElement(SurfaceRenderer, {
|
|
24
72
|
surface: surface,
|
|
25
73
|
components: components
|
|
26
|
-
}));
|
|
74
|
+
}))));
|
|
27
75
|
});
|
|
28
76
|
TableMenu.displayName = 'TableMenu';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var TableMenuContext = /*#__PURE__*/React.createContext(undefined);
|
|
3
|
+
export var TableMenuProvider = TableMenuContext.Provider;
|
|
4
|
+
export var useTableMenuContext = function useTableMenuContext() {
|
|
5
|
+
return React.useContext(TableMenuContext);
|
|
6
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export var TABLE_MENU_WIDTH = 280;
|
|
1
|
+
export var TABLE_MENU_WIDTH = 280;
|
|
2
|
+
export var TABLE_MENU_SELECTOR = '[data-testid="column-handle-menu"], [data-testid="row-handle-menu"], [data-toolbar-nested-dropdown-menu]';
|
|
@@ -9,6 +9,7 @@ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/u
|
|
|
9
9
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
10
10
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
11
11
|
import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
|
|
12
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from '../pm-plugins/commands';
|
|
13
14
|
import { getPluginState as getDragDropPluginState } from '../pm-plugins/drag-and-drop/plugin-factory';
|
|
14
15
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -20,6 +21,7 @@ import { convertHTMLCellIndexToColumnIndex, getColumnIndexMappedToColumnIndexInF
|
|
|
20
21
|
import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isDragColumnFloatingInsertDot, isDragCornerButton, isDragRowFloatingInsertDot, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from '../pm-plugins/utils/dom';
|
|
21
22
|
import { getAllowAddColumnCustomStep } from '../pm-plugins/utils/get-allow-add-column-custom-step';
|
|
22
23
|
import { TableCssClassName as ClassName, RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
|
|
24
|
+
import { TABLE_MENU_SELECTOR } from './TableMenu/shared/consts';
|
|
23
25
|
var isFocusingCalendar = function isFocusingCalendar(event) {
|
|
24
26
|
return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.getAttribute('aria-label') === 'calendar';
|
|
25
27
|
};
|
|
@@ -35,12 +37,15 @@ var isFocusingDragHandles = function isFocusingDragHandles(event) {
|
|
|
35
37
|
var isFocusingDragHandlesClickableZone = function isFocusingDragHandlesClickableZone(event) {
|
|
36
38
|
return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.classList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE);
|
|
37
39
|
};
|
|
40
|
+
var isFocusingTableMenu = function isFocusingTableMenu(event) {
|
|
41
|
+
return expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && Boolean(event.relatedTarget.closest(TABLE_MENU_SELECTOR));
|
|
42
|
+
};
|
|
38
43
|
export var handleBlur = function handleBlur(view, event) {
|
|
39
44
|
var state = view.state,
|
|
40
45
|
dispatch = view.dispatch;
|
|
41
46
|
// IE version check for ED-4665
|
|
42
47
|
// Calendar focus check for ED-10466
|
|
43
|
-
if (getBrowserInfo().ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event)) {
|
|
48
|
+
if (getBrowserInfo().ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event) && !isFocusingTableMenu(event)) {
|
|
44
49
|
setEditorFocus(false)(state, dispatch);
|
|
45
50
|
}
|
|
46
51
|
event.preventDefault();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const canSplitCellSelection: (selection: Selection) => boolean;
|
|
2
4
|
/**
|
|
3
5
|
* We need to split cell keeping the right type of cell given current table configuration.
|
|
4
6
|
* We are using editor-tables splitCellWithType that allows you to choose what cell type should be.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
export declare function mergeCells(tr: Transaction): Transaction;
|
|
5
|
+
export declare function canMergeCellSelection(selection: Selection): boolean;
|
|
4
6
|
export declare function canMergeCells(tr: Transaction): boolean;
|
|
5
7
|
export declare function mergeEmptyColumns(table: PMNode): PMNode | null;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the RegisterComponent[] array defining the cell contextual menu surface.
|
|
4
|
-
*
|
|
5
|
-
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
6
|
-
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
7
|
-
* will be connected in follow-up tickets.
|
|
8
|
-
*/
|
|
9
2
|
export declare const getCellMenuComponents: () => RegisterComponent[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const MergeCellsItem: () => React.JSX.Element;
|
|
2
|
+
export declare const MergeCellsItem: () => React.JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const SplitCellItem: () => React.JSX.Element;
|
|
2
|
+
export declare const SplitCellItem: () => React.JSX.Element | null;
|
|
@@ -2,7 +2,7 @@ import type { MenuItemType, MenuSectionType, MenuType } from '@atlaskit/editor-u
|
|
|
2
2
|
export declare const CELL_MENU: MenuType;
|
|
3
3
|
export declare const CELL_ACTION_SECTION: MenuSectionType;
|
|
4
4
|
export declare const CELL_DANGER_SECTION: MenuSectionType;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const CELL_MENU_RANK: Record<string, number>;
|
|
6
6
|
export declare const MERGE_CELLS_ITEM: MenuItemType;
|
|
7
7
|
export declare const SPLIT_CELL_ITEM: MenuItemType;
|
|
8
8
|
export declare const CELL_ACTION_SECTION_RANK: Record<string, number>;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the RegisterComponent[] array defining the column menu surface.
|
|
4
|
-
*
|
|
5
|
-
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
6
|
-
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
7
|
-
* will be connected in follow-up tickets.
|
|
8
|
-
*/
|
|
9
2
|
export declare const getColumnMenuComponents: () => RegisterComponent[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Background section sits directly below `ColumnToggleSection`. Its separator
|
|
4
|
+
* exists only to divide it from the toggle section; when the toggle section
|
|
5
|
+
* is hidden, the separator must drop too so we don't render a stray rule at
|
|
6
|
+
* the very top of the menu.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ColumnBackgroundSection: ({ children, }: {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The toggle section currently contains only the Header column toggle. When
|
|
4
|
+
* that item is hidden, the whole section disappears so we don't render an
|
|
5
|
+
* empty wrapper (and so the section below can drop its leading separator).
|
|
6
|
+
*/
|
|
7
|
+
export declare const ColumnToggleSection: ({ children, }: {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}) => React.JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const DistributeColumnsItem: () => React.JSX.Element;
|
|
2
|
+
export declare const DistributeColumnsItem: () => React.JSX.Element | null;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { type TableMenuContextValue } from '../../shared/TableMenuContext';
|
|
3
|
+
/**
|
|
4
|
+
* Header column toggle is only visible when the first column is the entire
|
|
5
|
+
* selection.
|
|
6
|
+
*
|
|
7
|
+
* Exported so `ColumnToggleSection` (which can become empty) and
|
|
8
|
+
* `ColumnBackgroundSection` (which drops its leading separator alongside)
|
|
9
|
+
* can stay in lockstep with this rule without redefining it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const shouldShowHeaderColumnToggle: (tableMenuContext?: TableMenuContextValue) => boolean;
|
|
12
|
+
export declare const HeaderColumnToggleItem: () => React.JSX.Element | null;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the RegisterComponent[] array defining the row menu surface.
|
|
4
|
-
*
|
|
5
|
-
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
6
|
-
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
7
|
-
* will be connected in follow-up tickets.
|
|
8
|
-
*/
|
|
9
2
|
export declare const getRowMenuComponents: () => RegisterComponent[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const HeaderRowToggleItem: () => React.JSX.Element;
|
|
2
|
+
export declare const HeaderRowToggleItem: () => React.JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const MoveRowDownItem: () => React.JSX.Element;
|
|
2
|
+
export declare const MoveRowDownItem: () => React.JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const MoveRowUpItem: () => React.JSX.Element;
|
|
2
|
+
export declare const MoveRowUpItem: () => React.JSX.Element | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
3
|
import type { MenuType } from '@atlaskit/editor-ui-control-model';
|
|
3
4
|
import type { PluginInjectionAPI } from '../../../types';
|
|
4
5
|
type TableMenuProps = {
|
|
5
6
|
api: PluginInjectionAPI | undefined | null;
|
|
7
|
+
editorView?: EditorView;
|
|
6
8
|
surface: MenuType;
|
|
7
9
|
};
|
|
8
|
-
export declare const TableMenu: React.
|
|
10
|
+
export declare const TableMenu: React.NamedExoticComponent<TableMenuProps>;
|
|
9
11
|
export {};
|