@atlaskit/editor-plugin-table 22.4.11 → 22.4.13
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 +17 -0
- package/dist/cjs/tablePlugin.js +7 -1
- package/dist/cjs/ui/TableMenu/column/getColumnMenuComponents.js +46 -11
- package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +34 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +34 -1
- package/dist/cjs/ui/TableMenu/column/items/ColumnBackgroundSection.js +15 -2
- package/dist/cjs/ui/TableMenu/column/items/ColumnToggleSection.js +15 -2
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +60 -3
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +43 -5
- package/dist/cjs/ui/TableMenu/column/items/HeaderColumnToggleItem.js +36 -5
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +69 -0
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +42 -3
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +22 -1
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +22 -1
- package/dist/cjs/ui/TableMenu/column/keys.js +6 -2
- package/dist/cjs/ui/TableMenu/row/getRowMenuComponents.js +23 -8
- package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +24 -1
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +24 -1
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +55 -3
- package/dist/cjs/ui/TableMenu/row/items/HeaderRowToggleItem.js +38 -5
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +38 -13
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +38 -13
- package/dist/cjs/ui/TableMenu/row/items/NumberedRowsToggleItem.js +29 -2
- package/dist/cjs/ui/TableMenu/shared/consts.js +4 -2
- package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +5 -2
- package/dist/cjs/ui/TableMenu/shared/getTableMenuComponents.js +2 -2
- package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +23 -3
- package/dist/cjs/ui/TableMenu/shared/types.js +5 -0
- package/dist/es2019/tablePlugin.js +7 -1
- package/dist/es2019/ui/TableMenu/column/getColumnMenuComponents.js +46 -12
- package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +37 -1
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +37 -1
- package/dist/es2019/ui/TableMenu/column/items/ColumnBackgroundSection.js +15 -1
- package/dist/es2019/ui/TableMenu/column/items/ColumnToggleSection.js +15 -1
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +63 -3
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +43 -7
- package/dist/es2019/ui/TableMenu/column/items/HeaderColumnToggleItem.js +40 -5
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +65 -0
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +44 -3
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +24 -1
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +24 -1
- package/dist/es2019/ui/TableMenu/column/keys.js +7 -2
- package/dist/es2019/ui/TableMenu/row/getRowMenuComponents.js +24 -8
- package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +27 -1
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +27 -1
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +59 -3
- package/dist/es2019/ui/TableMenu/row/items/HeaderRowToggleItem.js +42 -5
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +42 -11
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +42 -11
- package/dist/es2019/ui/TableMenu/row/items/NumberedRowsToggleItem.js +33 -2
- package/dist/es2019/ui/TableMenu/shared/consts.js +3 -1
- package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +6 -2
- package/dist/es2019/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +26 -3
- package/dist/es2019/ui/TableMenu/shared/types.js +1 -0
- package/dist/esm/tablePlugin.js +7 -1
- package/dist/esm/ui/TableMenu/column/getColumnMenuComponents.js +47 -12
- package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +34 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +34 -1
- package/dist/esm/ui/TableMenu/column/items/ColumnBackgroundSection.js +15 -2
- package/dist/esm/ui/TableMenu/column/items/ColumnToggleSection.js +15 -2
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +60 -3
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +43 -6
- package/dist/esm/ui/TableMenu/column/items/HeaderColumnToggleItem.js +36 -6
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +62 -0
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +42 -3
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +22 -1
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +22 -1
- package/dist/esm/ui/TableMenu/column/keys.js +5 -1
- package/dist/esm/ui/TableMenu/row/getRowMenuComponents.js +23 -8
- package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +24 -1
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +24 -1
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +55 -3
- package/dist/esm/ui/TableMenu/row/items/HeaderRowToggleItem.js +38 -6
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +39 -14
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +39 -14
- package/dist/esm/ui/TableMenu/row/items/NumberedRowsToggleItem.js +29 -2
- package/dist/esm/ui/TableMenu/shared/consts.js +3 -1
- package/dist/esm/ui/TableMenu/shared/getSharedItems.js +5 -2
- package/dist/esm/ui/TableMenu/shared/getTableMenuComponents.js +2 -2
- package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +23 -3
- package/dist/esm/ui/TableMenu/shared/types.js +1 -0
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/AddColumnLeftItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/AddColumnRightItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/ColumnBackgroundSection.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/ColumnToggleSection.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/DeleteColumnItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +7 -3
- package/dist/types/ui/TableMenu/column/items/MoveColumnLeftItem.d.ts +3 -0
- package/dist/types/ui/TableMenu/column/items/MoveColumnRightItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/SortDecreasingItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/items/SortIncreasingItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/keys.d.ts +1 -0
- package/dist/types/ui/TableMenu/row/getRowMenuComponents.d.ts +2 -1
- package/dist/types/ui/TableMenu/row/items/AddRowAboveItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/row/items/AddRowBelowItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/row/items/DeleteRowItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/row/items/MoveRowDownItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/row/items/MoveRowUpItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/row/items/NumberedRowsToggleItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/shared/consts.d.ts +2 -0
- package/dist/types/ui/TableMenu/shared/getSharedItems.d.ts +2 -1
- package/dist/types/ui/TableMenu/shared/getTableMenuComponents.d.ts +2 -1
- package/dist/types/ui/TableMenu/shared/items/ClearCellsItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/shared/types.d.ts +4 -0
- package/dist/types-ts4.5/types/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/getColumnMenuComponents.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/AddColumnLeftItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/AddColumnRightItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/ColumnBackgroundSection.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/ColumnToggleSection.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/DeleteColumnItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +7 -3
- package/dist/types-ts4.5/ui/TableMenu/column/items/MoveColumnLeftItem.d.ts +3 -0
- package/dist/types-ts4.5/ui/TableMenu/column/items/MoveColumnRightItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/SortDecreasingItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/items/SortIncreasingItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/keys.d.ts +1 -0
- package/dist/types-ts4.5/ui/TableMenu/row/getRowMenuComponents.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/AddRowAboveItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/AddRowBelowItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/DeleteRowItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowDownItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowUpItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/row/items/NumberedRowsToggleItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/consts.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableMenu/shared/getSharedItems.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/getTableMenuComponents.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/items/ClearCellsItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/types.d.ts +4 -0
- package/package.json +4 -4
|
@@ -1,13 +1,65 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
5
|
import { deleteRow, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
|
+
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
5
9
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
import { clearHoverSelection, hoverRows } from '../../../../pm-plugins/commands';
|
|
11
|
+
import { deleteRowsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
12
|
+
import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
|
|
13
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
14
|
+
export var DeleteRowItem = function DeleteRowItem(props) {
|
|
15
|
+
var _tableMenuContext$sel, _tooltip;
|
|
16
|
+
var api = props.api;
|
|
17
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
18
|
+
editorView = _useEditorToolbar.editorView;
|
|
19
|
+
var tableMenuContext = useTableMenuContext();
|
|
20
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
21
|
+
var _states$tableState;
|
|
22
|
+
return {
|
|
23
|
+
isHeaderRowRequired: (_states$tableState = states.tableState) === null || _states$tableState === void 0 || (_states$tableState = _states$tableState.pluginConfig) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isHeaderRowRequired
|
|
24
|
+
};
|
|
25
|
+
}),
|
|
26
|
+
isHeaderRowRequired = _useSharedPluginState.isHeaderRowRequired;
|
|
27
|
+
var selectedRowCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedRowCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
8
28
|
var _useIntl = useIntl(),
|
|
9
29
|
formatMessage = _useIntl.formatMessage;
|
|
30
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
31
|
+
if (!editorView) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
35
|
+
if (!selectionRect) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
hoverRows(getSelectedRowIndexes(selectionRect), true)(editorView.state, editorView.dispatch);
|
|
39
|
+
};
|
|
40
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
41
|
+
if (!editorView) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
clearHoverSelection()(editorView.state, editorView.dispatch);
|
|
45
|
+
};
|
|
46
|
+
var handleClick = function handleClick() {
|
|
47
|
+
var _api$analytics;
|
|
48
|
+
if (!editorView) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
52
|
+
if (!selectionRect) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
deleteRowsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(editorView.state, editorView.dispatch);
|
|
56
|
+
};
|
|
10
57
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
58
|
+
onClick: handleClick,
|
|
59
|
+
onFocus: handleMouseEnter,
|
|
60
|
+
onMouseEnter: handleMouseEnter,
|
|
61
|
+
onBlur: handleMouseLeave,
|
|
62
|
+
onMouseLeave: handleMouseLeave,
|
|
11
63
|
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
12
64
|
color: "currentColor",
|
|
13
65
|
label: "",
|
|
@@ -17,6 +69,6 @@ export var DeleteRowItem = function DeleteRowItem() {
|
|
|
17
69
|
shortcut: (_tooltip = tooltip(deleteRow)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
18
70
|
})
|
|
19
71
|
}, formatMessage(messages.removeRows, {
|
|
20
|
-
0:
|
|
72
|
+
0: selectedRowCount
|
|
21
73
|
}));
|
|
22
74
|
};
|
|
@@ -1,26 +1,58 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
4
6
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
7
|
import Toggle from '@atlaskit/toggle';
|
|
8
|
+
import { toggleHeaderRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
6
9
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
7
|
-
|
|
8
10
|
/** Header row toggle is only visible when the first row is the entire selection. */
|
|
9
|
-
var shouldShowHeaderRowToggle = function shouldShowHeaderRowToggle(
|
|
10
|
-
|
|
11
|
+
var shouldShowHeaderRowToggle = function shouldShowHeaderRowToggle(_ref) {
|
|
12
|
+
var isFirstRow = _ref.isFirstRow,
|
|
13
|
+
isHeaderRowAllowed = _ref.isHeaderRowAllowed,
|
|
14
|
+
selectedRowCount = _ref.selectedRowCount;
|
|
15
|
+
return isHeaderRowAllowed === true && isFirstRow && selectedRowCount === 1;
|
|
11
16
|
};
|
|
12
|
-
export var HeaderRowToggleItem = function HeaderRowToggleItem() {
|
|
17
|
+
export var HeaderRowToggleItem = function HeaderRowToggleItem(props) {
|
|
18
|
+
var _tableMenuContext$sel;
|
|
19
|
+
var api = props.api;
|
|
20
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
21
|
+
editorView = _useEditorToolbar.editorView;
|
|
13
22
|
var tableMenuContext = useTableMenuContext();
|
|
23
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
24
|
+
var _states$tableState, _states$tableState2;
|
|
25
|
+
return {
|
|
26
|
+
isHeaderRowAllowed: (_states$tableState = states.tableState) === null || _states$tableState === void 0 || (_states$tableState = _states$tableState.pluginConfig) === null || _states$tableState === void 0 ? void 0 : _states$tableState.allowHeaderRow,
|
|
27
|
+
isHeaderRowEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.isHeaderRowEnabled
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
isHeaderRowAllowed = _useSharedPluginState.isHeaderRowAllowed,
|
|
31
|
+
isHeaderRowEnabled = _useSharedPluginState.isHeaderRowEnabled;
|
|
32
|
+
var selectedRowCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedRowCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 0;
|
|
14
33
|
var _useIntl = useIntl(),
|
|
15
34
|
formatMessage = _useIntl.formatMessage;
|
|
16
35
|
var label = formatMessage(messages.headerRow);
|
|
17
|
-
|
|
36
|
+
var handleClick = function handleClick() {
|
|
37
|
+
var _api$analytics;
|
|
38
|
+
if (!editorView) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
toggleHeaderRowWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(editorView.state, editorView.dispatch);
|
|
42
|
+
};
|
|
43
|
+
if (!shouldShowHeaderRowToggle({
|
|
44
|
+
isFirstRow: (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow) === true,
|
|
45
|
+
isHeaderRowAllowed: isHeaderRowAllowed,
|
|
46
|
+
selectedRowCount: selectedRowCount
|
|
47
|
+
})) {
|
|
18
48
|
return null;
|
|
19
49
|
}
|
|
20
50
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
51
|
+
onClick: handleClick,
|
|
21
52
|
elemAfter: /*#__PURE__*/React.createElement(Toggle, {
|
|
22
53
|
label: label,
|
|
23
|
-
isChecked:
|
|
54
|
+
isChecked: !!isHeaderRowEnabled,
|
|
55
|
+
onChange: handleClick
|
|
24
56
|
})
|
|
25
57
|
}, label);
|
|
26
58
|
};
|
|
@@ -1,36 +1,61 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import {
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { moveRowDown, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
|
+
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
5
9
|
import { TableRowMoveDownIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import {
|
|
10
|
+
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
|
+
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
12
|
+
import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
|
|
13
|
+
import { TABLE_ROW } from '../../shared/consts';
|
|
7
14
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
8
|
-
var
|
|
9
|
-
return
|
|
15
|
+
var shouldShowMoveRowDown = function shouldShowMoveRowDown(isLastRow) {
|
|
16
|
+
return !isLastRow;
|
|
10
17
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export var MoveRowDownItem = function MoveRowDownItem() {
|
|
17
|
-
var _getMoveRowDownShortc;
|
|
18
|
+
export var MoveRowDownItem = function MoveRowDownItem(props) {
|
|
19
|
+
var _tableMenuContext$sel, _tooltip;
|
|
20
|
+
var api = props.api;
|
|
21
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
22
|
+
editorView = _useEditorToolbar.editorView;
|
|
18
23
|
var tableMenuContext = useTableMenuContext();
|
|
24
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
25
|
+
var _states$tableState;
|
|
26
|
+
return {
|
|
27
|
+
tableNode: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.tableNode
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
tableNode = _useSharedPluginState.tableNode;
|
|
31
|
+
var selectedRowCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedRowCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
19
32
|
var _useIntl = useIntl(),
|
|
20
33
|
formatMessage = _useIntl.formatMessage;
|
|
21
|
-
|
|
34
|
+
var handleClick = function handleClick() {
|
|
35
|
+
var _api$analytics, _api$accessibilityUti;
|
|
36
|
+
if (!editorView) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
40
|
+
if (!selectionRect) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.bottom)(editorView.state, editorView.dispatch);
|
|
44
|
+
};
|
|
45
|
+
if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
|
|
22
46
|
return null;
|
|
23
47
|
}
|
|
24
48
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
49
|
+
onClick: handleClick,
|
|
25
50
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
26
51
|
color: "currentColor",
|
|
27
52
|
label: "",
|
|
28
53
|
size: "small"
|
|
29
54
|
}),
|
|
30
55
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
31
|
-
shortcut: (
|
|
56
|
+
shortcut: (_tooltip = tooltip(moveRowDown)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
32
57
|
})
|
|
33
58
|
}, formatMessage(messages.moveRowDown, {
|
|
34
|
-
0:
|
|
59
|
+
0: selectedRowCount
|
|
35
60
|
}));
|
|
36
61
|
};
|
|
@@ -1,36 +1,61 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import {
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
|
+
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
5
9
|
import { TableRowMoveUpIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import {
|
|
10
|
+
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
|
+
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
12
|
+
import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
|
|
13
|
+
import { TABLE_ROW } from '../../shared/consts';
|
|
7
14
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
8
|
-
var
|
|
9
|
-
return
|
|
15
|
+
var shouldShowMoveRowUp = function shouldShowMoveRowUp(isFirstRow) {
|
|
16
|
+
return !isFirstRow;
|
|
10
17
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export var MoveRowUpItem = function MoveRowUpItem() {
|
|
17
|
-
var _getMoveRowUpShortcut;
|
|
18
|
+
export var MoveRowUpItem = function MoveRowUpItem(props) {
|
|
19
|
+
var _tableMenuContext$sel, _tooltip;
|
|
20
|
+
var api = props.api;
|
|
21
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
22
|
+
editorView = _useEditorToolbar.editorView;
|
|
18
23
|
var tableMenuContext = useTableMenuContext();
|
|
24
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
25
|
+
var _states$tableState;
|
|
26
|
+
return {
|
|
27
|
+
tableNode: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.tableNode
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
tableNode = _useSharedPluginState.tableNode;
|
|
31
|
+
var selectedRowCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedRowCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
19
32
|
var _useIntl = useIntl(),
|
|
20
33
|
formatMessage = _useIntl.formatMessage;
|
|
21
|
-
|
|
34
|
+
var handleClick = function handleClick() {
|
|
35
|
+
var _api$analytics, _api$accessibilityUti;
|
|
36
|
+
if (!editorView) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
40
|
+
if (!selectionRect) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.top - 1)(editorView.state, editorView.dispatch);
|
|
44
|
+
};
|
|
45
|
+
if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
|
|
22
46
|
return null;
|
|
23
47
|
}
|
|
24
48
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
49
|
+
onClick: handleClick,
|
|
25
50
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
26
51
|
color: "currentColor",
|
|
27
52
|
label: "",
|
|
28
53
|
size: "small"
|
|
29
54
|
}),
|
|
30
55
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
31
|
-
shortcut: (
|
|
56
|
+
shortcut: (_tooltip = tooltip(moveRowUp)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
32
57
|
})
|
|
33
58
|
}, formatMessage(messages.moveRowUp, {
|
|
34
|
-
0:
|
|
59
|
+
0: selectedRowCount
|
|
35
60
|
}));
|
|
36
61
|
};
|
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
4
6
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
7
|
import Toggle from '@atlaskit/toggle';
|
|
6
|
-
|
|
8
|
+
import { toggleNumberColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
|
+
export var NumberedRowsToggleItem = function NumberedRowsToggleItem(props) {
|
|
10
|
+
var api = props.api;
|
|
11
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
12
|
+
editorView = _useEditorToolbar.editorView;
|
|
13
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
14
|
+
var _states$tableState, _states$tableState2;
|
|
15
|
+
return {
|
|
16
|
+
isNumberColumnAllowed: (_states$tableState = states.tableState) === null || _states$tableState === void 0 || (_states$tableState = _states$tableState.pluginConfig) === null || _states$tableState === void 0 ? void 0 : _states$tableState.allowNumberColumn,
|
|
17
|
+
isNumberColumnEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.isNumberColumnEnabled
|
|
18
|
+
};
|
|
19
|
+
}),
|
|
20
|
+
isNumberColumnAllowed = _useSharedPluginState.isNumberColumnAllowed,
|
|
21
|
+
isNumberColumnEnabled = _useSharedPluginState.isNumberColumnEnabled;
|
|
7
22
|
var _useIntl = useIntl(),
|
|
8
23
|
formatMessage = _useIntl.formatMessage;
|
|
9
24
|
var label = formatMessage(messages.numberedRows);
|
|
25
|
+
var handleClick = function handleClick() {
|
|
26
|
+
var _api$analytics;
|
|
27
|
+
if (!editorView) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
toggleNumberColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(editorView.state, editorView.dispatch);
|
|
31
|
+
};
|
|
32
|
+
if (!isNumberColumnAllowed) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
10
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
36
|
+
onClick: handleClick,
|
|
11
37
|
elemAfter: /*#__PURE__*/React.createElement(Toggle, {
|
|
12
38
|
label: label,
|
|
13
|
-
isChecked:
|
|
39
|
+
isChecked: !!isNumberColumnEnabled,
|
|
40
|
+
onChange: handleClick
|
|
14
41
|
})
|
|
15
42
|
}, label);
|
|
16
43
|
};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
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]';
|
|
2
|
+
export var TABLE_MENU_SELECTOR = '[data-testid="column-handle-menu"], [data-testid="row-handle-menu"], [data-toolbar-nested-dropdown-menu]';
|
|
3
|
+
export var TABLE_ROW = 'table-row';
|
|
4
|
+
export var TABLE_COLUMN = 'table-column';
|
|
@@ -5,7 +5,8 @@ import { ROW_BACKGROUND_SECTION, ROW_DANGER_SECTION, ROW_BACKGROUND_SECTION_RANK
|
|
|
5
5
|
import { BackgroundColorItem } from './items/BackgroundColorItem';
|
|
6
6
|
import { ClearCellsItem } from './items/ClearCellsItem';
|
|
7
7
|
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from './keys';
|
|
8
|
-
export var getSharedItems = function getSharedItems() {
|
|
8
|
+
export var getSharedItems = function getSharedItems(_ref) {
|
|
9
|
+
var api = _ref.api;
|
|
9
10
|
return [{
|
|
10
11
|
type: BACKGROUND_COLOR_ITEM.type,
|
|
11
12
|
key: BACKGROUND_COLOR_ITEM.key,
|
|
@@ -42,7 +43,9 @@ export var getSharedItems = function getSharedItems() {
|
|
|
42
43
|
rank: CELL_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
43
44
|
}],
|
|
44
45
|
component: function component() {
|
|
45
|
-
return /*#__PURE__*/React.createElement(ClearCellsItem,
|
|
46
|
+
return /*#__PURE__*/React.createElement(ClearCellsItem, {
|
|
47
|
+
api: api
|
|
48
|
+
});
|
|
46
49
|
}
|
|
47
50
|
}];
|
|
48
51
|
};
|
|
@@ -3,6 +3,6 @@ import { getCellMenuComponents } from '../cell/getCellMenuComponents';
|
|
|
3
3
|
import { getColumnMenuComponents } from '../column/getColumnMenuComponents';
|
|
4
4
|
import { getRowMenuComponents } from '../row/getRowMenuComponents';
|
|
5
5
|
import { getSharedItems } from './getSharedItems';
|
|
6
|
-
export var getTableMenuComponents = function getTableMenuComponents() {
|
|
7
|
-
return [].concat(_toConsumableArray(getRowMenuComponents()), _toConsumableArray(getColumnMenuComponents()), _toConsumableArray(getCellMenuComponents()), _toConsumableArray(getSharedItems()));
|
|
6
|
+
export var getTableMenuComponents = function getTableMenuComponents(params) {
|
|
7
|
+
return [].concat(_toConsumableArray(getRowMenuComponents(params)), _toConsumableArray(getColumnMenuComponents(params)), _toConsumableArray(getCellMenuComponents()), _toConsumableArray(getSharedItems(params)));
|
|
8
8
|
};
|
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
7
|
import { CrossIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
import { emptyMultipleCellsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
|
+
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
10
|
+
import { useTableMenuContext } from '../TableMenuContext';
|
|
11
|
+
export var ClearCellsItem = function ClearCellsItem(_ref) {
|
|
12
|
+
var _tableMenuContext$sel, _tableMenuContext$sel2, _tooltip;
|
|
13
|
+
var api = _ref.api;
|
|
14
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
15
|
+
editorView = _useEditorToolbar.editorView;
|
|
16
|
+
var tableMenuContext = useTableMenuContext();
|
|
8
17
|
var _useIntl = useIntl(),
|
|
9
18
|
formatMessage = _useIntl.formatMessage;
|
|
19
|
+
var selectedCellCount = Math.max((_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1, (_tableMenuContext$sel2 = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedRowCount) !== null && _tableMenuContext$sel2 !== void 0 ? _tableMenuContext$sel2 : 1);
|
|
20
|
+
var handleClick = function handleClick() {
|
|
21
|
+
var _api$analytics;
|
|
22
|
+
if (!editorView) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
var _getPluginState = getPluginState(editorView.state),
|
|
26
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
27
|
+
emptyMultipleCellsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(editorView.state, editorView.dispatch);
|
|
28
|
+
};
|
|
10
29
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
30
|
+
onClick: handleClick,
|
|
11
31
|
elemBefore: /*#__PURE__*/React.createElement(CrossIcon, {
|
|
12
32
|
color: "currentColor",
|
|
13
33
|
label: "",
|
|
@@ -17,6 +37,6 @@ export var ClearCellsItem = function ClearCellsItem() {
|
|
|
17
37
|
shortcut: (_tooltip = tooltip(backspace)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
18
38
|
})
|
|
19
39
|
}, formatMessage(messages.clearCells, {
|
|
20
|
-
0:
|
|
40
|
+
0: selectedCellCount
|
|
21
41
|
}));
|
|
22
42
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -34,13 +34,14 @@ export type PluginInjectionAPIWithA11y = ExtractInjectionAPI<TablePlugin> & {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'wasMaxWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard'> & {
|
|
37
|
+
export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'wasMaxWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'isNumberColumnEnabled' | 'isCommentEditor' | 'isTableScalingEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard'> & {
|
|
38
38
|
dragMenuDirection?: TableDirection;
|
|
39
39
|
dragMenuIndex?: number;
|
|
40
40
|
editorContentAreaHeight?: number;
|
|
41
41
|
isDragMenuOpen?: boolean;
|
|
42
42
|
isResizing: boolean;
|
|
43
43
|
isSizeSelectorOpen?: boolean;
|
|
44
|
+
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
44
45
|
isTableResizing?: boolean;
|
|
45
46
|
isWholeTableInDanger?: boolean;
|
|
46
47
|
resizingTableLocalId?: string;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
2
|
-
|
|
2
|
+
import type { TableMenuComponentsParams } from '../shared/types';
|
|
3
|
+
export declare const getColumnMenuComponents: ({ api }: TableMenuComponentsParams) => RegisterComponent[];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
2
3
|
/**
|
|
3
4
|
* Background section sits directly below `ColumnToggleSection`. Its separator
|
|
4
5
|
* exists only to divide it from the toggle section; when the toggle section
|
|
5
6
|
* is hidden, the separator must drop too so we don't render a stray rule at
|
|
6
7
|
* the very top of the menu.
|
|
7
8
|
*/
|
|
8
|
-
export declare const ColumnBackgroundSection: ({ children, }: {
|
|
9
|
+
export declare const ColumnBackgroundSection: ({ api, children, }: TableMenuComponentsParams & {
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
}) => React.JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
2
3
|
/**
|
|
3
4
|
* The toggle section currently contains only the Header column toggle. When
|
|
4
5
|
* that item is hidden, the whole section disappears so we don't render an
|
|
5
6
|
* empty wrapper (and so the section below can drop its leading separator).
|
|
6
7
|
*/
|
|
7
|
-
export declare const ColumnToggleSection: ({ children, }: {
|
|
8
|
+
export declare const ColumnToggleSection: ({ api, children, }: TableMenuComponentsParams & {
|
|
8
9
|
children?: React.ReactNode;
|
|
9
10
|
}) => React.JSX.Element | null;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
3
|
+
export declare const DistributeColumnsItem: ({ api }: TableMenuComponentsParams) => React.JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
3
3
|
/**
|
|
4
4
|
* Header column toggle is only visible when the first column is the entire
|
|
5
5
|
* selection.
|
|
@@ -8,5 +8,9 @@ import { type TableMenuContextValue } from '../../shared/TableMenuContext';
|
|
|
8
8
|
* `ColumnBackgroundSection` (which drops its leading separator alongside)
|
|
9
9
|
* can stay in lockstep with this rule without redefining it.
|
|
10
10
|
*/
|
|
11
|
-
export declare const shouldShowHeaderColumnToggle: (
|
|
12
|
-
|
|
11
|
+
export declare const shouldShowHeaderColumnToggle: ({ isFirstColumn, isHeaderColumnAllowed, selectedColumnCount, }: {
|
|
12
|
+
isFirstColumn?: boolean;
|
|
13
|
+
isHeaderColumnAllowed?: boolean;
|
|
14
|
+
selectedColumnCount?: number;
|
|
15
|
+
}) => boolean;
|
|
16
|
+
export declare const HeaderColumnToggleItem: (props: TableMenuComponentsParams) => React.JSX.Element | null;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
3
|
+
export declare const MoveColumnRightItem: (props: TableMenuComponentsParams) => React.JSX.Element | null;
|
|
@@ -11,6 +11,7 @@ export declare const SORT_INCREASING_ITEM: MenuItemType;
|
|
|
11
11
|
export declare const SORT_DECREASING_ITEM: MenuItemType;
|
|
12
12
|
export declare const ADD_COLUMN_LEFT_ITEM: MenuItemType;
|
|
13
13
|
export declare const ADD_COLUMN_RIGHT_ITEM: MenuItemType;
|
|
14
|
+
export declare const MOVE_COLUMN_LEFT_ITEM: MenuItemType;
|
|
14
15
|
export declare const MOVE_COLUMN_RIGHT_ITEM: MenuItemType;
|
|
15
16
|
export declare const DISTRIBUTE_COLUMNS_ITEM: MenuItemType;
|
|
16
17
|
export declare const DELETE_COLUMN_ITEM: MenuItemType;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
2
|
-
|
|
2
|
+
import type { TableMenuComponentsParams } from '../shared/types';
|
|
3
|
+
export declare const getRowMenuComponents: ({ api }: TableMenuComponentsParams) => RegisterComponent[];
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
3
|
+
export declare const HeaderRowToggleItem: (props: TableMenuComponentsParams) => React.JSX.Element | null;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
3
|
+
export declare const NumberedRowsToggleItem: (props: TableMenuComponentsParams) => React.JSX.Element | null;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare const TABLE_MENU_WIDTH = 280;
|
|
2
2
|
export declare const TABLE_MENU_SELECTOR = "[data-testid=\"column-handle-menu\"], [data-testid=\"row-handle-menu\"], [data-toolbar-nested-dropdown-menu]";
|
|
3
|
+
export declare const TABLE_ROW = "table-row";
|
|
4
|
+
export declare const TABLE_COLUMN = "table-column";
|