@atlaskit/editor-plugin-table 12.2.6 → 12.2.7
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/package.json +4 -4
- package/afm-cc/tsconfig.json +0 -123
- package/afm-dev-agents/tsconfig.json +0 -123
- package/afm-jira/tsconfig.json +0 -123
- package/afm-passionfruit/tsconfig.json +0 -123
- package/afm-post-office/tsconfig.json +0 -123
- package/afm-rovo-extension/tsconfig.json +0 -123
- package/afm-townsquare/tsconfig.json +0 -123
- package/afm-volt/tsconfig.json +0 -114
- package/build/tsconfig.json +0 -23
- package/docs/0-intro.tsx +0 -57
- package/src/index.ts +0 -21
- package/src/nodeviews/ExternalDropTargets.tsx +0 -91
- package/src/nodeviews/OverflowShadowsObserver.ts +0 -156
- package/src/nodeviews/TableCell.ts +0 -134
- package/src/nodeviews/TableComponent.tsx +0 -1590
- package/src/nodeviews/TableComponentWithSharedState.tsx +0 -278
- package/src/nodeviews/TableContainer.tsx +0 -926
- package/src/nodeviews/TableNodeViewBase.ts +0 -29
- package/src/nodeviews/TableResizer.tsx +0 -884
- package/src/nodeviews/TableRow.ts +0 -830
- package/src/nodeviews/TableStickyScrollbar.ts +0 -211
- package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +0 -15
- package/src/nodeviews/__mocks__/OverridableMock.ts +0 -26
- package/src/nodeviews/table-container-styles.ts +0 -9
- package/src/nodeviews/table-node-views.ts +0 -76
- package/src/nodeviews/table.tsx +0 -530
- package/src/nodeviews/toDOM.ts +0 -244
- package/src/nodeviews/types.ts +0 -36
- package/src/nodeviews/update-overflow-shadows.ts +0 -11
- package/src/pm-plugins/analytics/actions.ts +0 -21
- package/src/pm-plugins/analytics/commands.ts +0 -47
- package/src/pm-plugins/analytics/plugin-factory.ts +0 -9
- package/src/pm-plugins/analytics/plugin-key.ts +0 -5
- package/src/pm-plugins/analytics/plugin.ts +0 -80
- package/src/pm-plugins/analytics/reducer.ts +0 -27
- package/src/pm-plugins/analytics/types.ts +0 -20
- package/src/pm-plugins/analytics/utils/moved-event.ts +0 -51
- package/src/pm-plugins/commands/clear.ts +0 -43
- package/src/pm-plugins/commands/collapse.ts +0 -17
- package/src/pm-plugins/commands/column-resize.ts +0 -478
- package/src/pm-plugins/commands/commands-with-analytics.ts +0 -715
- package/src/pm-plugins/commands/delete.ts +0 -42
- package/src/pm-plugins/commands/display-mode.ts +0 -18
- package/src/pm-plugins/commands/go-to-next-cell.ts +0 -198
- package/src/pm-plugins/commands/hover.ts +0 -242
- package/src/pm-plugins/commands/index.ts +0 -51
- package/src/pm-plugins/commands/insert.ts +0 -438
- package/src/pm-plugins/commands/misc.ts +0 -811
- package/src/pm-plugins/commands/referentiality.ts +0 -15
- package/src/pm-plugins/commands/selection.ts +0 -537
- package/src/pm-plugins/commands/sort.ts +0 -102
- package/src/pm-plugins/commands/split-cell.ts +0 -28
- package/src/pm-plugins/commands/toggle.ts +0 -109
- package/src/pm-plugins/create-plugin-config.ts +0 -17
- package/src/pm-plugins/decorations/plugin.ts +0 -107
- package/src/pm-plugins/decorations/utils/column-controls.ts +0 -91
- package/src/pm-plugins/decorations/utils/column-resizing.ts +0 -71
- package/src/pm-plugins/decorations/utils/compose-decorations.ts +0 -9
- package/src/pm-plugins/decorations/utils/types.ts +0 -16
- package/src/pm-plugins/default-table-selection.ts +0 -14
- package/src/pm-plugins/drag-and-drop/actions.ts +0 -48
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +0 -222
- package/src/pm-plugins/drag-and-drop/commands.ts +0 -194
- package/src/pm-plugins/drag-and-drop/consts.ts +0 -7
- package/src/pm-plugins/drag-and-drop/plugin-factory.ts +0 -33
- package/src/pm-plugins/drag-and-drop/plugin-key.ts +0 -5
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -398
- package/src/pm-plugins/drag-and-drop/reducer.ts +0 -38
- package/src/pm-plugins/drag-and-drop/types.ts +0 -18
- package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +0 -49
- package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +0 -9
- package/src/pm-plugins/drag-and-drop/utils/monitor.ts +0 -73
- package/src/pm-plugins/handlers.ts +0 -161
- package/src/pm-plugins/keymap.ts +0 -436
- package/src/pm-plugins/main.ts +0 -433
- package/src/pm-plugins/plugin-factory.ts +0 -42
- package/src/pm-plugins/plugin-key.ts +0 -8
- package/src/pm-plugins/reducer.ts +0 -145
- package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -102
- package/src/pm-plugins/sticky-headers/commands.ts +0 -8
- package/src/pm-plugins/sticky-headers/plugin-key.ts +0 -5
- package/src/pm-plugins/sticky-headers/plugin-state.ts +0 -52
- package/src/pm-plugins/sticky-headers/plugin.ts +0 -12
- package/src/pm-plugins/sticky-headers/types.ts +0 -20
- package/src/pm-plugins/sticky-headers/util.ts +0 -18
- package/src/pm-plugins/table-analytics.ts +0 -100
- package/src/pm-plugins/table-local-id.ts +0 -213
- package/src/pm-plugins/table-resizing/commands.ts +0 -116
- package/src/pm-plugins/table-resizing/event-handlers.ts +0 -352
- package/src/pm-plugins/table-resizing/plugin-factory.ts +0 -29
- package/src/pm-plugins/table-resizing/plugin-key.ts +0 -5
- package/src/pm-plugins/table-resizing/plugin.ts +0 -94
- package/src/pm-plugins/table-resizing/reducer.ts +0 -37
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +0 -306
- package/src/pm-plugins/table-resizing/utils/column-state.ts +0 -120
- package/src/pm-plugins/table-resizing/utils/consts.ts +0 -11
- package/src/pm-plugins/table-resizing/utils/content-width.ts +0 -118
- package/src/pm-plugins/table-resizing/utils/dom.ts +0 -132
- package/src/pm-plugins/table-resizing/utils/misc.ts +0 -282
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +0 -34
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +0 -289
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +0 -417
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +0 -290
- package/src/pm-plugins/table-resizing/utils/types.ts +0 -25
- package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +0 -1
- package/src/pm-plugins/table-selection-keymap.ts +0 -64
- package/src/pm-plugins/table-size-selector.ts +0 -39
- package/src/pm-plugins/table-width-in-comment-fix.ts +0 -113
- package/src/pm-plugins/table-width.ts +0 -153
- package/src/pm-plugins/transforms/column-width.ts +0 -249
- package/src/pm-plugins/transforms/delete-columns.ts +0 -281
- package/src/pm-plugins/transforms/delete-rows.ts +0 -154
- package/src/pm-plugins/transforms/fix-tables.ts +0 -249
- package/src/pm-plugins/transforms/merge.ts +0 -301
- package/src/pm-plugins/transforms/replace-table.ts +0 -38
- package/src/pm-plugins/transforms/split.ts +0 -90
- package/src/pm-plugins/utils/alignment.ts +0 -33
- package/src/pm-plugins/utils/analytics.ts +0 -238
- package/src/pm-plugins/utils/collapse.ts +0 -93
- package/src/pm-plugins/utils/column-controls.ts +0 -250
- package/src/pm-plugins/utils/create.ts +0 -64
- package/src/pm-plugins/utils/decoration.ts +0 -672
- package/src/pm-plugins/utils/dom.ts +0 -251
- package/src/pm-plugins/utils/drag-menu.tsx +0 -491
- package/src/pm-plugins/utils/get-allow-add-column-custom-step.ts +0 -10
- package/src/pm-plugins/utils/guidelines.ts +0 -30
- package/src/pm-plugins/utils/merged-cells.ts +0 -239
- package/src/pm-plugins/utils/nodes.ts +0 -162
- package/src/pm-plugins/utils/paste.ts +0 -386
- package/src/pm-plugins/utils/row-controls.ts +0 -211
- package/src/pm-plugins/utils/selection.ts +0 -17
- package/src/pm-plugins/utils/snapping.ts +0 -136
- package/src/pm-plugins/utils/table.ts +0 -60
- package/src/pm-plugins/utils/update-plugin-state-decorations.ts +0 -13
- package/src/pm-plugins/view-mode-sort/consts.ts +0 -3
- package/src/pm-plugins/view-mode-sort/index.ts +0 -291
- package/src/pm-plugins/view-mode-sort/plugin-key.ts +0 -7
- package/src/pm-plugins/view-mode-sort/types.ts +0 -23
- package/src/pm-plugins/view-mode-sort/utils.ts +0 -136
- package/src/tablePlugin.tsx +0 -971
- package/src/tablePluginType.ts +0 -102
- package/src/types/index.ts +0 -592
- package/src/ui/ColumnResizeWidget/index.tsx +0 -61
- package/src/ui/ContentComponent.tsx +0 -311
- package/src/ui/DragHandle/HandleIconComponent.tsx +0 -21
- package/src/ui/DragHandle/index.tsx +0 -391
- package/src/ui/DragPreview/index.tsx +0 -51
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +0 -59
- package/src/ui/FloatingContextualButton/FixedButton.tsx +0 -203
- package/src/ui/FloatingContextualButton/index.tsx +0 -168
- package/src/ui/FloatingContextualButton/styles.ts +0 -69
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +0 -931
- package/src/ui/FloatingContextualMenu/index.tsx +0 -141
- package/src/ui/FloatingContextualMenu/styles.ts +0 -77
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +0 -54
- package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +0 -65
- package/src/ui/FloatingDeleteButton/index.tsx +0 -383
- package/src/ui/FloatingDeleteButton/types.ts +0 -3
- package/src/ui/FloatingDragMenu/DragMenu.tsx +0 -668
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +0 -221
- package/src/ui/FloatingDragMenu/index.tsx +0 -136
- package/src/ui/FloatingDragMenu/styles.ts +0 -83
- package/src/ui/FloatingInsertButton/InsertButton.tsx +0 -263
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -131
- package/src/ui/FloatingInsertButton/index.tsx +0 -314
- package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +0 -31
- package/src/ui/SizeSelector/index.tsx +0 -74
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +0 -397
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +0 -105
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +0 -63
- package/src/ui/TableFloatingColumnControls/index.tsx +0 -151
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +0 -106
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +0 -143
- package/src/ui/TableFloatingControls/CornerControls/types.ts +0 -12
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +0 -88
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +0 -175
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +0 -131
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +0 -429
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +0 -96
- package/src/ui/TableFloatingControls/index.tsx +0 -275
- package/src/ui/TableFullWidthLabel/index.tsx +0 -38
- package/src/ui/common-styles.ts +0 -1218
- package/src/ui/consts.ts +0 -109
- package/src/ui/event-handlers.ts +0 -662
- package/src/ui/global-styles.tsx +0 -55
- package/src/ui/hooks/useInternalTablePluginStateSelector.ts +0 -38
- package/src/ui/icons/AddColLeftIcon.tsx +0 -37
- package/src/ui/icons/AddColRightIcon.tsx +0 -37
- package/src/ui/icons/AddRowAboveIcon.tsx +0 -22
- package/src/ui/icons/AddRowBelowIcon.tsx +0 -39
- package/src/ui/icons/DragHandleDisabledIcon.tsx +0 -25
- package/src/ui/icons/DragHandleIcon.tsx +0 -16
- package/src/ui/icons/DragInMotionIcon.tsx +0 -54
- package/src/ui/icons/MergeCellsIcon.tsx +0 -26
- package/src/ui/icons/MinimisedHandle.tsx +0 -15
- package/src/ui/icons/SortingIconWrapper.tsx +0 -43
- package/src/ui/icons/SplitCellIcon.tsx +0 -34
- package/src/ui/toolbar.tsx +0 -1153
- package/src/ui/ui-styles.ts +0 -960
- package/tsconfig.app.json +0 -135
- package/tsconfig.dev.json +0 -54
- package/tsconfig.json +0 -18
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
|
|
8
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
9
|
-
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
10
|
-
import { Popup } from '@atlaskit/editor-common/ui';
|
|
11
|
-
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
13
|
-
import {
|
|
14
|
-
akEditorFloatingDialogZIndex,
|
|
15
|
-
akEditorFloatingOverlapPanelZIndex,
|
|
16
|
-
} from '@atlaskit/editor-shared-styles';
|
|
17
|
-
import {
|
|
18
|
-
findCellRectClosestToPos,
|
|
19
|
-
getSelectionRect,
|
|
20
|
-
isSelectionType,
|
|
21
|
-
} from '@atlaskit/editor-tables/utils';
|
|
22
|
-
|
|
23
|
-
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
24
|
-
import type { PluginConfig, PluginInjectionAPI } from '../../types';
|
|
25
|
-
import {
|
|
26
|
-
contextualMenuDropdownWidth,
|
|
27
|
-
contextualMenuDropdownWidthDnD,
|
|
28
|
-
contextualMenuTriggerSize,
|
|
29
|
-
tablePopupMenuFitHeight,
|
|
30
|
-
} from '../consts';
|
|
31
|
-
|
|
32
|
-
// Ignored via go/ees005
|
|
33
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
34
|
-
import ContextualMenu from './ContextualMenu';
|
|
35
|
-
import { tablePopupStyles } from './styles';
|
|
36
|
-
|
|
37
|
-
interface Props {
|
|
38
|
-
editorView: EditorView;
|
|
39
|
-
isOpen: boolean;
|
|
40
|
-
getEditorContainerWidth: GetEditorContainerWidth;
|
|
41
|
-
api: PluginInjectionAPI | undefined | null;
|
|
42
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
43
|
-
targetCellPosition?: number;
|
|
44
|
-
mountPoint?: HTMLElement;
|
|
45
|
-
boundariesElement?: HTMLElement;
|
|
46
|
-
scrollableElement?: HTMLElement;
|
|
47
|
-
pluginConfig?: PluginConfig;
|
|
48
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
49
|
-
isCellMenuOpenByKeyboard?: boolean;
|
|
50
|
-
isCommentEditor?: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const FloatingContextualMenu = ({
|
|
54
|
-
mountPoint,
|
|
55
|
-
boundariesElement,
|
|
56
|
-
scrollableElement,
|
|
57
|
-
editorView,
|
|
58
|
-
isOpen,
|
|
59
|
-
pluginConfig,
|
|
60
|
-
editorAnalyticsAPI,
|
|
61
|
-
getEditorContainerWidth,
|
|
62
|
-
getEditorFeatureFlags,
|
|
63
|
-
isCellMenuOpenByKeyboard,
|
|
64
|
-
isCommentEditor,
|
|
65
|
-
api,
|
|
66
|
-
}: Props) => {
|
|
67
|
-
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
68
|
-
const { targetCellPosition, isDragAndDropEnabled } = getPluginState(editorView.state);
|
|
69
|
-
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const { selection } = editorView.state;
|
|
74
|
-
const selectionRect = isSelectionType(selection, 'cell')
|
|
75
|
-
? // Ignored via go/ees005
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
77
|
-
getSelectionRect(selection)!
|
|
78
|
-
: findCellRectClosestToPos(selection.$from);
|
|
79
|
-
|
|
80
|
-
if (!selectionRect) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
84
|
-
const targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
85
|
-
if (!targetCellRef) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const parentSticky =
|
|
90
|
-
targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<Popup
|
|
94
|
-
alignX="right"
|
|
95
|
-
alignY="top"
|
|
96
|
-
// Ignored via go/ees005
|
|
97
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
98
|
-
target={targetCellRef as HTMLElement}
|
|
99
|
-
mountTo={mountPoint}
|
|
100
|
-
boundariesElement={boundariesElement}
|
|
101
|
-
scrollableElement={scrollableElement}
|
|
102
|
-
fitHeight={tablePopupMenuFitHeight}
|
|
103
|
-
fitWidth={isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth}
|
|
104
|
-
// z-index value below is to ensure that this menu is above other floating menu
|
|
105
|
-
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
106
|
-
zIndex={parentSticky ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex}
|
|
107
|
-
forcePlacement={true}
|
|
108
|
-
offset={[-7, 0]}
|
|
109
|
-
stick={true}
|
|
110
|
-
>
|
|
111
|
-
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 */}
|
|
112
|
-
<div css={tablePopupStyles(isDragAndDropEnabled)}>
|
|
113
|
-
<ContextualMenu
|
|
114
|
-
editorView={editorView}
|
|
115
|
-
offset={[contextualMenuTriggerSize / 2, -contextualMenuTriggerSize]}
|
|
116
|
-
isOpen={isOpen}
|
|
117
|
-
targetCellPosition={targetCellPosition}
|
|
118
|
-
allowColumnSorting={pluginConfig && pluginConfig.allowColumnSorting}
|
|
119
|
-
// Ignored via go/ees005
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
121
|
-
allowMergeCells={pluginConfig!.allowMergeCells}
|
|
122
|
-
// Ignored via go/ees005
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
124
|
-
allowBackgroundColor={pluginConfig!.allowBackgroundColor}
|
|
125
|
-
selectionRect={selectionRect}
|
|
126
|
-
boundariesElement={boundariesElement}
|
|
127
|
-
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
128
|
-
getEditorContainerWidth={getEditorContainerWidth}
|
|
129
|
-
getEditorFeatureFlags={getEditorFeatureFlags}
|
|
130
|
-
isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
|
|
131
|
-
isCommentEditor={isCommentEditor}
|
|
132
|
-
api={api}
|
|
133
|
-
/>
|
|
134
|
-
</div>
|
|
135
|
-
</Popup>
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
140
|
-
|
|
141
|
-
export default FloatingContextualMenu;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
-
|
|
4
|
-
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
|
-
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
6
|
-
import { token } from '@atlaskit/tokens';
|
|
7
|
-
|
|
8
|
-
import { TableCssClassName as ClassName } from '../../types';
|
|
9
|
-
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
|
|
10
|
-
|
|
11
|
-
export const cellColourPreviewStyles = (selectedColor: string) =>
|
|
12
|
-
css({
|
|
13
|
-
'&::before': {
|
|
14
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
15
|
-
background: selectedColor,
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export const tablePopupStyles = (
|
|
20
|
-
isDragAndDropEnabled: boolean | undefined,
|
|
21
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
22
|
-
) => css`
|
|
23
|
-
.${ClassName.CONTEXTUAL_SUBMENU} {
|
|
24
|
-
border-radius: ${token('border.radius', '3px')};
|
|
25
|
-
background: ${token('elevation.surface.overlay', 'white')};
|
|
26
|
-
box-shadow: ${token('elevation.shadow.overlay', `0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`)};
|
|
27
|
-
display: block;
|
|
28
|
-
position: absolute;
|
|
29
|
-
top: 0;
|
|
30
|
-
left: ${isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth}px;
|
|
31
|
-
padding: ${token('space.100', '8px')};
|
|
32
|
-
|
|
33
|
-
> div {
|
|
34
|
-
padding: 0;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.${ClassName.CONTEXTUAL_MENU_ICON} {
|
|
39
|
-
display: flex;
|
|
40
|
-
|
|
41
|
-
&::before {
|
|
42
|
-
content: '';
|
|
43
|
-
display: block;
|
|
44
|
-
border: 1px solid ${tableBackgroundBorderColor};
|
|
45
|
-
border-radius: ${token('border.radius', '3px')};
|
|
46
|
-
width: 20px;
|
|
47
|
-
height: 20px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&::after {
|
|
51
|
-
content: '›';
|
|
52
|
-
margin-left: ${token('space.050', '4px')};
|
|
53
|
-
line-height: 20px;
|
|
54
|
-
color: ${token('color.icon', N90)};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.${ClassName.CONTEXTUAL_MENU_ICON_SMALL} {
|
|
59
|
-
display: flex;
|
|
60
|
-
|
|
61
|
-
&::before {
|
|
62
|
-
content: '';
|
|
63
|
-
display: block;
|
|
64
|
-
border: 1px solid ${tableBackgroundBorderColor};
|
|
65
|
-
border-radius: ${token('border.radius', '3px')};
|
|
66
|
-
width: 14px;
|
|
67
|
-
height: 14px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&::after {
|
|
71
|
-
content: '›';
|
|
72
|
-
margin-left: ${token('space.050', '4px')};
|
|
73
|
-
line-height: 14px;
|
|
74
|
-
color: ${token('color.icon', N90)};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { SyntheticEvent } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import type { MessageDescriptor, WrappedComponentProps } from 'react-intl-next';
|
|
5
|
-
import { injectIntl } from 'react-intl-next';
|
|
6
|
-
|
|
7
|
-
import { TableCssClassName as ClassName } from '../../types';
|
|
8
|
-
|
|
9
|
-
interface ButtonProps {
|
|
10
|
-
removeLabel: MessageDescriptor;
|
|
11
|
-
style?: object;
|
|
12
|
-
onClick?: (event: SyntheticEvent) => void;
|
|
13
|
-
onMouseEnter?: (event: SyntheticEvent) => void;
|
|
14
|
-
onMouseLeave?: (event: SyntheticEvent) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const DeleteButton = ({
|
|
18
|
-
style,
|
|
19
|
-
onClick,
|
|
20
|
-
onMouseEnter,
|
|
21
|
-
onMouseLeave,
|
|
22
|
-
removeLabel,
|
|
23
|
-
intl: { formatMessage },
|
|
24
|
-
}: ButtonProps & WrappedComponentProps) => (
|
|
25
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
26
|
-
<div
|
|
27
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
28
|
-
className={ClassName.CONTROLS_DELETE_BUTTON_WRAP}
|
|
29
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
30
|
-
style={style}
|
|
31
|
-
onMouseEnter={onMouseEnter}
|
|
32
|
-
onMouseLeave={onMouseLeave}
|
|
33
|
-
>
|
|
34
|
-
<button
|
|
35
|
-
type="button"
|
|
36
|
-
aria-label={formatMessage(removeLabel, { 0: 1 })}
|
|
37
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
38
|
-
className={ClassName.CONTROLS_DELETE_BUTTON}
|
|
39
|
-
onMouseDown={onClick}
|
|
40
|
-
onMouseMove={(e) => e.preventDefault()}
|
|
41
|
-
>
|
|
42
|
-
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 */}
|
|
43
|
-
<svg className={ClassName.CONTROLS_BUTTON_ICON}>
|
|
44
|
-
<path
|
|
45
|
-
d="M12.242 10.828L9.414 8l2.828-2.829a.999.999 0 1 0-1.414-1.414L8 6.587l-2.829-2.83a1 1 0 0 0-1.414 1.414l2.83 2.83-2.83 2.827a1 1 0 0 0 1.414 1.414l2.83-2.828 2.827 2.828a.999.999 0 1 0 1.414-1.414"
|
|
46
|
-
fill="currentColor"
|
|
47
|
-
fillRule="evenodd"
|
|
48
|
-
/>
|
|
49
|
-
</svg>
|
|
50
|
-
</button>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
export default injectIntl(DeleteButton);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { PopupProps } from '@atlaskit/editor-common/ui';
|
|
2
|
-
|
|
3
|
-
import { tableDeleteButtonOffset, tableDeleteButtonSize, tableToolbarSize } from '../consts';
|
|
4
|
-
|
|
5
|
-
import type { CellSelectionType } from './types';
|
|
6
|
-
|
|
7
|
-
interface GetPopupOptions {
|
|
8
|
-
left: number;
|
|
9
|
-
top: number;
|
|
10
|
-
selectionType?: CellSelectionType;
|
|
11
|
-
tableWrapper: HTMLElement | null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const DELETE_BUTTON_CONTROLS_OFFSET =
|
|
15
|
-
tableToolbarSize + tableDeleteButtonSize + tableDeleteButtonOffset;
|
|
16
|
-
|
|
17
|
-
function getColumnOptions(left: number, tableWrapper: HTMLElement | null): Partial<PopupProps> {
|
|
18
|
-
return {
|
|
19
|
-
alignX: 'left',
|
|
20
|
-
alignY: 'start',
|
|
21
|
-
offset: [left, DELETE_BUTTON_CONTROLS_OFFSET],
|
|
22
|
-
shouldRenderPopup() {
|
|
23
|
-
if (tableWrapper) {
|
|
24
|
-
const rect = tableWrapper.getBoundingClientRect();
|
|
25
|
-
const maxVisibleLeftPosition = rect.width + tableWrapper.scrollLeft - tableDeleteButtonSize;
|
|
26
|
-
const minVisibleLeftPosition = tableWrapper.scrollLeft;
|
|
27
|
-
return maxVisibleLeftPosition - left > 0 && left > minVisibleLeftPosition;
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getRowOptions(top: number): Partial<PopupProps> {
|
|
35
|
-
return {
|
|
36
|
-
alignX: 'left',
|
|
37
|
-
alignY: 'start',
|
|
38
|
-
forcePlacement: true,
|
|
39
|
-
offset: [0, -top],
|
|
40
|
-
onPositionCalculated(position) {
|
|
41
|
-
return {
|
|
42
|
-
...position,
|
|
43
|
-
// We need to force left to always be the offset to not be affected by overflow
|
|
44
|
-
left: -DELETE_BUTTON_CONTROLS_OFFSET,
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default function getPopupOptions({
|
|
51
|
-
left,
|
|
52
|
-
top,
|
|
53
|
-
selectionType,
|
|
54
|
-
tableWrapper,
|
|
55
|
-
}: GetPopupOptions): Partial<PopupProps> {
|
|
56
|
-
switch (selectionType) {
|
|
57
|
-
case 'column':
|
|
58
|
-
return getColumnOptions(left, tableWrapper);
|
|
59
|
-
case 'row':
|
|
60
|
-
return getRowOptions(top);
|
|
61
|
-
default: {
|
|
62
|
-
return {};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|