@atlaskit/editor-plugin-table 22.4.12 → 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 +8 -0
- package/dist/cjs/tablePlugin.js +3 -0
- 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/shared/getTableMenuComponents.js +1 -1
- package/dist/es2019/tablePlugin.js +3 -0
- 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/shared/getTableMenuComponents.js +1 -1
- package/dist/esm/tablePlugin.js +3 -0
- 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/shared/getTableMenuComponents.js +1 -1
- 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-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/package.json +3 -3
|
@@ -1,13 +1,70 @@
|
|
|
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 { deleteColumn, 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, hoverColumns } from '../../../../pm-plugins/commands';
|
|
11
|
+
import { deleteColumnsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
12
|
+
import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
|
|
13
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
14
|
+
export var DeleteColumnItem = function DeleteColumnItem(_ref) {
|
|
15
|
+
var _tableMenuContext$sel, _tooltip;
|
|
16
|
+
var api = _ref.api;
|
|
17
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
18
|
+
editorView = _useEditorToolbar.editorView;
|
|
19
|
+
var tableMenuContext = useTableMenuContext();
|
|
20
|
+
var selectedColumnCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
8
21
|
var _useIntl = useIntl(),
|
|
9
22
|
formatMessage = _useIntl.formatMessage;
|
|
23
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
24
|
+
var tableState = states.tableState;
|
|
25
|
+
return {
|
|
26
|
+
isCommentEditor: tableState === null || tableState === void 0 ? void 0 : tableState.isCommentEditor,
|
|
27
|
+
isTableFixedColumnWidthsOptionEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isTableFixedColumnWidthsOptionEnabled,
|
|
28
|
+
isTableScalingEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isTableScalingEnabled
|
|
29
|
+
};
|
|
30
|
+
}),
|
|
31
|
+
isCommentEditor = _useSharedPluginState.isCommentEditor,
|
|
32
|
+
isTableFixedColumnWidthsOptionEnabled = _useSharedPluginState.isTableFixedColumnWidthsOptionEnabled,
|
|
33
|
+
isTableScalingEnabled = _useSharedPluginState.isTableScalingEnabled;
|
|
34
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
35
|
+
if (!editorView) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
39
|
+
if (!selectionRect) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
hoverColumns(getSelectedColumnIndexes(selectionRect), true)(editorView.state, editorView.dispatch);
|
|
43
|
+
};
|
|
44
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
45
|
+
if (!editorView) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
clearHoverSelection()(editorView.state, editorView.dispatch);
|
|
49
|
+
};
|
|
50
|
+
var handleClick = function handleClick() {
|
|
51
|
+
var _api$analytics;
|
|
52
|
+
if (!editorView) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
56
|
+
if (!selectionRect) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
60
|
+
deleteColumnsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect)(editorView.state, editorView.dispatch, editorView);
|
|
61
|
+
};
|
|
10
62
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
63
|
+
onClick: handleClick,
|
|
64
|
+
onFocus: handleMouseEnter,
|
|
65
|
+
onMouseEnter: handleMouseEnter,
|
|
66
|
+
onBlur: handleMouseLeave,
|
|
67
|
+
onMouseLeave: handleMouseLeave,
|
|
11
68
|
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
12
69
|
color: "currentColor",
|
|
13
70
|
label: "",
|
|
@@ -17,6 +74,6 @@ export var DeleteColumnItem = function DeleteColumnItem() {
|
|
|
17
74
|
shortcut: (_tooltip = tooltip(deleteColumn)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
18
75
|
})
|
|
19
76
|
}, formatMessage(messages.removeColumns, {
|
|
20
|
-
0:
|
|
77
|
+
0: selectedColumnCount
|
|
21
78
|
}));
|
|
22
79
|
};
|
|
@@ -1,22 +1,59 @@
|
|
|
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 { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
|
+
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
4
8
|
import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { distributeColumnsWidthsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
|
+
import { getNewResizeStateFromSelectedColumns } from '../../../../pm-plugins/table-resizing/utils/resize-state';
|
|
5
11
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
-
|
|
7
12
|
/** Distribute columns is only visible when more than one column is selected. */
|
|
8
|
-
var shouldShowDistributeColumns = function shouldShowDistributeColumns(
|
|
9
|
-
|
|
10
|
-
return ((_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 0) > 1;
|
|
13
|
+
var shouldShowDistributeColumns = function shouldShowDistributeColumns(selectedColumnCount) {
|
|
14
|
+
return (selectedColumnCount !== null && selectedColumnCount !== void 0 ? selectedColumnCount : 0) > 1;
|
|
11
15
|
};
|
|
12
|
-
export var DistributeColumnsItem = function DistributeColumnsItem() {
|
|
16
|
+
export var DistributeColumnsItem = function DistributeColumnsItem(_ref) {
|
|
17
|
+
var api = _ref.api;
|
|
18
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
19
|
+
editorView = _useEditorToolbar.editorView;
|
|
13
20
|
var tableMenuContext = useTableMenuContext();
|
|
14
21
|
var _useIntl = useIntl(),
|
|
15
22
|
formatMessage = _useIntl.formatMessage;
|
|
16
|
-
|
|
23
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
24
|
+
var tableState = states.tableState;
|
|
25
|
+
return {
|
|
26
|
+
isCommentEditor: tableState === null || tableState === void 0 ? void 0 : tableState.isCommentEditor,
|
|
27
|
+
isTableFixedColumnWidthsOptionEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isTableFixedColumnWidthsOptionEnabled,
|
|
28
|
+
isTableScalingEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isTableScalingEnabled
|
|
29
|
+
};
|
|
30
|
+
}),
|
|
31
|
+
isCommentEditor = _useSharedPluginState.isCommentEditor,
|
|
32
|
+
isTableFixedColumnWidthsOptionEnabled = _useSharedPluginState.isTableFixedColumnWidthsOptionEnabled,
|
|
33
|
+
isTableScalingEnabled = _useSharedPluginState.isTableScalingEnabled;
|
|
34
|
+
var handleClick = function handleClick() {
|
|
35
|
+
var _api$width, _api$analytics;
|
|
36
|
+
if (!editorView) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
40
|
+
var editorContainerWidth = api === null || api === void 0 || (_api$width = api.width) === null || _api$width === void 0 ? void 0 : _api$width.sharedState.currentState();
|
|
41
|
+
if (!selectionRect || !editorContainerWidth) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, editorView.state, editorView.domAtPos.bind(editorView), function () {
|
|
45
|
+
return editorContainerWidth;
|
|
46
|
+
}, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
47
|
+
if (!newResizeState) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
distributeColumnsWidthsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(editorView.state, editorView.dispatch);
|
|
51
|
+
};
|
|
52
|
+
if (!shouldShowDistributeColumns(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount)) {
|
|
17
53
|
return null;
|
|
18
54
|
}
|
|
19
55
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
56
|
+
onClick: handleClick,
|
|
20
57
|
elemBefore: /*#__PURE__*/React.createElement(TableColumnsDistributeIcon, {
|
|
21
58
|
color: "currentColor",
|
|
22
59
|
label: "",
|
|
@@ -1,10 +1,12 @@
|
|
|
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 { toggleHeaderColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
6
9
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
7
|
-
|
|
8
10
|
/**
|
|
9
11
|
* Header column toggle is only visible when the first column is the entire
|
|
10
12
|
* selection.
|
|
@@ -13,21 +15,49 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
13
15
|
* `ColumnBackgroundSection` (which drops its leading separator alongside)
|
|
14
16
|
* can stay in lockstep with this rule without redefining it.
|
|
15
17
|
*/
|
|
16
|
-
export var shouldShowHeaderColumnToggle = function shouldShowHeaderColumnToggle(
|
|
17
|
-
|
|
18
|
+
export var shouldShowHeaderColumnToggle = function shouldShowHeaderColumnToggle(_ref) {
|
|
19
|
+
var isFirstColumn = _ref.isFirstColumn,
|
|
20
|
+
isHeaderColumnAllowed = _ref.isHeaderColumnAllowed,
|
|
21
|
+
selectedColumnCount = _ref.selectedColumnCount;
|
|
22
|
+
return isHeaderColumnAllowed === true && isFirstColumn === true && selectedColumnCount === 1;
|
|
18
23
|
};
|
|
19
|
-
export var HeaderColumnToggleItem = function HeaderColumnToggleItem() {
|
|
24
|
+
export var HeaderColumnToggleItem = function HeaderColumnToggleItem(props) {
|
|
25
|
+
var api = props.api;
|
|
26
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
27
|
+
editorView = _useEditorToolbar.editorView;
|
|
20
28
|
var tableMenuContext = useTableMenuContext();
|
|
29
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
30
|
+
var _states$tableState, _states$tableState2;
|
|
31
|
+
return {
|
|
32
|
+
isHeaderColumnAllowed: (_states$tableState = states.tableState) === null || _states$tableState === void 0 || (_states$tableState = _states$tableState.pluginConfig) === null || _states$tableState === void 0 ? void 0 : _states$tableState.allowHeaderColumn,
|
|
33
|
+
isHeaderColumnEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.isHeaderColumnEnabled
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
isHeaderColumnAllowed = _useSharedPluginState.isHeaderColumnAllowed,
|
|
37
|
+
isHeaderColumnEnabled = _useSharedPluginState.isHeaderColumnEnabled;
|
|
21
38
|
var _useIntl = useIntl(),
|
|
22
39
|
formatMessage = _useIntl.formatMessage;
|
|
23
40
|
var label = formatMessage(messages.headerColumn);
|
|
24
|
-
|
|
41
|
+
var handleClick = function handleClick() {
|
|
42
|
+
var _api$analytics;
|
|
43
|
+
if (!editorView) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
toggleHeaderColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(editorView.state, editorView.dispatch);
|
|
47
|
+
};
|
|
48
|
+
if (!shouldShowHeaderColumnToggle({
|
|
49
|
+
isFirstColumn: tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn,
|
|
50
|
+
isHeaderColumnAllowed: isHeaderColumnAllowed,
|
|
51
|
+
selectedColumnCount: tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount
|
|
52
|
+
})) {
|
|
25
53
|
return null;
|
|
26
54
|
}
|
|
27
55
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
56
|
+
onClick: handleClick,
|
|
28
57
|
elemAfter: /*#__PURE__*/React.createElement(Toggle, {
|
|
29
58
|
label: label,
|
|
30
|
-
isChecked:
|
|
59
|
+
isChecked: !!isHeaderColumnEnabled,
|
|
60
|
+
onChange: handleClick
|
|
31
61
|
})
|
|
32
62
|
}, label);
|
|
33
63
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { moveColumnLeft, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
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';
|
|
9
|
+
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
|
+
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
11
|
+
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
12
|
+
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
13
|
+
import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
|
|
14
|
+
import { TABLE_COLUMN } from '../../shared/consts';
|
|
15
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
16
|
+
var shouldShowMoveColumnLeft = function shouldShowMoveColumnLeft(isFirstColumn) {
|
|
17
|
+
return !isFirstColumn;
|
|
18
|
+
};
|
|
19
|
+
export var MoveColumnLeftItem = function MoveColumnLeftItem(props) {
|
|
20
|
+
var _tableMenuContext$sel, _tooltip;
|
|
21
|
+
var api = props.api;
|
|
22
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
23
|
+
editorView = _useEditorToolbar.editorView;
|
|
24
|
+
var tableMenuContext = useTableMenuContext();
|
|
25
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], function (states) {
|
|
26
|
+
var _states$tableState;
|
|
27
|
+
return {
|
|
28
|
+
tableNode: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.tableNode
|
|
29
|
+
};
|
|
30
|
+
}),
|
|
31
|
+
tableNode = _useSharedPluginState.tableNode;
|
|
32
|
+
var selectedColumnCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
33
|
+
var _useIntl = useIntl(),
|
|
34
|
+
formatMessage = _useIntl.formatMessage;
|
|
35
|
+
var handleClick = function handleClick() {
|
|
36
|
+
var _api$analytics, _api$accessibilityUti;
|
|
37
|
+
if (!editorView) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
41
|
+
if (!selectionRect) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
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_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.left - 1)(editorView.state, editorView.dispatch);
|
|
45
|
+
};
|
|
46
|
+
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
50
|
+
onClick: handleClick,
|
|
51
|
+
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveLeftIcon, {
|
|
52
|
+
color: "currentColor",
|
|
53
|
+
label: "",
|
|
54
|
+
size: "small"
|
|
55
|
+
}),
|
|
56
|
+
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
57
|
+
shortcut: (_tooltip = tooltip(moveColumnLeft)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
58
|
+
})
|
|
59
|
+
}, formatMessage(messages.moveColumnLeft, {
|
|
60
|
+
0: selectedColumnCount
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
@@ -1,13 +1,52 @@
|
|
|
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 { moveColumnRight, 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 { TableColumnMoveRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
|
+
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
12
|
+
import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
|
|
13
|
+
import { TABLE_COLUMN } from '../../shared/consts';
|
|
14
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
15
|
+
var shouldShowMoveColumnRight = function shouldShowMoveColumnRight(isLastColumn) {
|
|
16
|
+
return !isLastColumn;
|
|
17
|
+
};
|
|
18
|
+
export var MoveColumnRightItem = function MoveColumnRightItem(props) {
|
|
19
|
+
var _tableMenuContext$sel, _tooltip;
|
|
20
|
+
var api = props.api;
|
|
21
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
22
|
+
editorView = _useEditorToolbar.editorView;
|
|
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 selectedColumnCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
8
32
|
var _useIntl = useIntl(),
|
|
9
33
|
formatMessage = _useIntl.formatMessage;
|
|
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_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.right)(editorView.state, editorView.dispatch);
|
|
44
|
+
};
|
|
45
|
+
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
10
48
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
49
|
+
onClick: handleClick,
|
|
11
50
|
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveRightIcon, {
|
|
12
51
|
color: "currentColor",
|
|
13
52
|
label: "",
|
|
@@ -17,6 +56,6 @@ export var MoveColumnRightItem = function MoveColumnRightItem() {
|
|
|
17
56
|
shortcut: (_tooltip = tooltip(moveColumnRight)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
18
57
|
})
|
|
19
58
|
}, formatMessage(messages.moveColumnRight, {
|
|
20
|
-
0:
|
|
59
|
+
0: selectedColumnCount
|
|
21
60
|
}));
|
|
22
61
|
};
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
|
+
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
4
8
|
import { ArrowDownIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
5
10
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
-
export var SortDecreasingItem = function SortDecreasingItem() {
|
|
11
|
+
export var SortDecreasingItem = function SortDecreasingItem(_ref) {
|
|
12
|
+
var api = _ref.api;
|
|
13
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
14
|
+
editorView = _useEditorToolbar.editorView;
|
|
7
15
|
var tableMenuContext = useTableMenuContext();
|
|
8
16
|
var _useIntl = useIntl(),
|
|
9
17
|
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
var handleClick = function handleClick() {
|
|
19
|
+
var _api$analytics;
|
|
20
|
+
if (!editorView) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
24
|
+
var columnIndex = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.left;
|
|
25
|
+
if (columnIndex === undefined) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
sortColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, SortOrder.DESC)(editorView.state, editorView.dispatch);
|
|
29
|
+
};
|
|
10
30
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
31
|
+
onClick: handleClick,
|
|
11
32
|
isDisabled: Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.hasMergedCellsInTable),
|
|
12
33
|
elemBefore: /*#__PURE__*/React.createElement(ArrowDownIcon, {
|
|
13
34
|
color: "currentColor",
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
|
+
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
4
8
|
import { ArrowUpIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
5
10
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
-
export var SortIncreasingItem = function SortIncreasingItem() {
|
|
11
|
+
export var SortIncreasingItem = function SortIncreasingItem(_ref) {
|
|
12
|
+
var api = _ref.api;
|
|
13
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
14
|
+
editorView = _useEditorToolbar.editorView;
|
|
7
15
|
var tableMenuContext = useTableMenuContext();
|
|
8
16
|
var _useIntl = useIntl(),
|
|
9
17
|
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
var handleClick = function handleClick() {
|
|
19
|
+
var _api$analytics;
|
|
20
|
+
if (!editorView) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
24
|
+
var columnIndex = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.left;
|
|
25
|
+
if (columnIndex === undefined) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
sortColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, SortOrder.ASC)(editorView.state, editorView.dispatch);
|
|
29
|
+
};
|
|
10
30
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
31
|
+
onClick: handleClick,
|
|
11
32
|
isDisabled: Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.hasMergedCellsInTable),
|
|
12
33
|
elemBefore: /*#__PURE__*/React.createElement(ArrowUpIcon, {
|
|
13
34
|
color: "currentColor",
|
|
@@ -51,6 +51,10 @@ export var ADD_COLUMN_RIGHT_ITEM = {
|
|
|
51
51
|
type: 'menu-item',
|
|
52
52
|
key: 'add-column-right'
|
|
53
53
|
};
|
|
54
|
+
export var MOVE_COLUMN_LEFT_ITEM = {
|
|
55
|
+
type: 'menu-item',
|
|
56
|
+
key: 'move-column-left'
|
|
57
|
+
};
|
|
54
58
|
export var MOVE_COLUMN_RIGHT_ITEM = {
|
|
55
59
|
type: 'menu-item',
|
|
56
60
|
key: 'move-column-right'
|
|
@@ -69,5 +73,5 @@ export var DELETE_COLUMN_ITEM = {
|
|
|
69
73
|
export var COLUMN_TOGGLE_SECTION_RANK = _defineProperty({}, HEADER_COLUMN_TOGGLE_ITEM.key, 100);
|
|
70
74
|
export var COLUMN_BACKGROUND_SECTION_RANK = _defineProperty({}, BACKGROUND_COLOR_ITEM.key, 100);
|
|
71
75
|
export var COLUMN_SORT_SECTION_RANK = _defineProperty(_defineProperty({}, SORT_INCREASING_ITEM.key, 100), SORT_DECREASING_ITEM.key, 200);
|
|
72
|
-
export var COLUMN_ADD_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ADD_COLUMN_LEFT_ITEM.key, 100), ADD_COLUMN_RIGHT_ITEM.key, 200),
|
|
76
|
+
export var COLUMN_ADD_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ADD_COLUMN_LEFT_ITEM.key, 100), ADD_COLUMN_RIGHT_ITEM.key, 200), MOVE_COLUMN_LEFT_ITEM.key, 300), MOVE_COLUMN_RIGHT_ITEM.key, 400), DISTRIBUTE_COLUMNS_ITEM.key, 500);
|
|
73
77
|
export var COLUMN_DANGER_SECTION_RANK = _defineProperty(_defineProperty({}, CLEAR_CELLS_ITEM.key, 100), DELETE_COLUMN_ITEM.key, 200);
|
|
@@ -4,5 +4,5 @@ import { getColumnMenuComponents } from '../column/getColumnMenuComponents';
|
|
|
4
4
|
import { getRowMenuComponents } from '../row/getRowMenuComponents';
|
|
5
5
|
import { getSharedItems } from './getSharedItems';
|
|
6
6
|
export var getTableMenuComponents = function getTableMenuComponents(params) {
|
|
7
|
-
return [].concat(_toConsumableArray(getRowMenuComponents(params)), _toConsumableArray(getColumnMenuComponents()), _toConsumableArray(getCellMenuComponents()), _toConsumableArray(getSharedItems(params)));
|
|
7
|
+
return [].concat(_toConsumableArray(getRowMenuComponents(params)), _toConsumableArray(getColumnMenuComponents(params)), _toConsumableArray(getCellMenuComponents()), _toConsumableArray(getSharedItems(params)));
|
|
8
8
|
};
|
|
@@ -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' | 'isNumberColumnEnabled' | '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;
|
|
@@ -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' | 'isNumberColumnEnabled' | '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[];
|