@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,221 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
|
-
import React, { useCallback, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import { DropList, type DropListProps, Popup } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
6
|
-
import {
|
|
7
|
-
ArrowKeyNavigationProvider,
|
|
8
|
-
ArrowKeyNavigationType,
|
|
9
|
-
DropdownMenuItem,
|
|
10
|
-
} from '@atlaskit/editor-common/ui-menu';
|
|
11
|
-
import {
|
|
12
|
-
OutsideClickTargetRefContext,
|
|
13
|
-
withReactEditorViewOuterListeners,
|
|
14
|
-
} from '@atlaskit/editor-common/ui-react';
|
|
15
|
-
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
16
|
-
import { MenuGroup, Section } from '@atlaskit/menu';
|
|
17
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
|
-
|
|
19
|
-
import { dragMenuDropdownWidth } from '../consts';
|
|
20
|
-
|
|
21
|
-
const DropListWithOutsideClickTargetRef = (props: DropListProps) => {
|
|
22
|
-
const setOutsideClickTargetRef = React.useContext(OutsideClickTargetRefContext);
|
|
23
|
-
// Ignored via go/ees005
|
|
24
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
25
|
-
return <DropList onDroplistRef={setOutsideClickTargetRef} {...props} />;
|
|
26
|
-
};
|
|
27
|
-
const DropListWithOutsideListeners = withReactEditorViewOuterListeners(
|
|
28
|
-
DropListWithOutsideClickTargetRef,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
type DropdownMenuProps = {
|
|
32
|
-
items: Array<{
|
|
33
|
-
items: MenuItem[];
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* use to toggle top level menu keyboard navigation and action keys
|
|
37
|
-
* e.g. should be false if submenu is rendered as a child to avoid multiple keydown handlers
|
|
38
|
-
*/
|
|
39
|
-
disableKeyboardHandling: boolean;
|
|
40
|
-
section: { hasSeparator?: boolean; title?: string };
|
|
41
|
-
onItemActivated?: (attrs: { item: MenuItem; shouldCloseMenu?: boolean }) => void;
|
|
42
|
-
handleClose: (focusTarget: 'editor' | 'handle') => void;
|
|
43
|
-
onMouseEnter: (attrs: { item: MenuItem }) => void;
|
|
44
|
-
onMouseLeave: (attrs: { item: MenuItem }) => void;
|
|
45
|
-
fitWidth?: number;
|
|
46
|
-
fitHeight?: number;
|
|
47
|
-
direction?: string;
|
|
48
|
-
offset?: Array<number>;
|
|
49
|
-
mountPoint?: HTMLElement;
|
|
50
|
-
boundariesElement?: HTMLElement;
|
|
51
|
-
scrollableElement?: HTMLElement;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const DropdownMenu = ({
|
|
55
|
-
items,
|
|
56
|
-
section,
|
|
57
|
-
disableKeyboardHandling,
|
|
58
|
-
onItemActivated,
|
|
59
|
-
handleClose,
|
|
60
|
-
onMouseEnter,
|
|
61
|
-
onMouseLeave,
|
|
62
|
-
fitWidth,
|
|
63
|
-
fitHeight,
|
|
64
|
-
direction,
|
|
65
|
-
mountPoint,
|
|
66
|
-
boundariesElement,
|
|
67
|
-
scrollableElement,
|
|
68
|
-
}: DropdownMenuProps) => {
|
|
69
|
-
const [popupPlacement, setPopupPlacement] = useState(['bottom', 'left']);
|
|
70
|
-
const [targetRefDiv, setTargetRefDiv] = useState<HTMLDivElement | null>(null);
|
|
71
|
-
const handleRef = (ref: HTMLDivElement | null) => {
|
|
72
|
-
setTargetRefDiv(ref);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
76
|
-
const offsetY = direction === 'row' ? (popupPlacement[0] === 'bottom' ? -8 : -34) : 0;
|
|
77
|
-
const offsetX = direction === 'column' ? (popupPlacement[1] === 'left' ? 0 : -7) : 0;
|
|
78
|
-
|
|
79
|
-
const innerMenu = () => {
|
|
80
|
-
return (
|
|
81
|
-
<DropListWithOutsideListeners
|
|
82
|
-
isOpen
|
|
83
|
-
shouldFitContainer
|
|
84
|
-
position={popupPlacement.join(' ')}
|
|
85
|
-
handleClickOutside={() => handleClose('editor')}
|
|
86
|
-
handleEscapeKeydown={() => {
|
|
87
|
-
if (!disableKeyboardHandling) {
|
|
88
|
-
handleClose('handle');
|
|
89
|
-
}
|
|
90
|
-
}}
|
|
91
|
-
handleEnterKeydown={(e: KeyboardEvent) => {
|
|
92
|
-
if (!disableKeyboardHandling) {
|
|
93
|
-
e.preventDefault();
|
|
94
|
-
e.stopPropagation();
|
|
95
|
-
}
|
|
96
|
-
}}
|
|
97
|
-
targetRef={targetRefDiv}
|
|
98
|
-
>
|
|
99
|
-
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 */}
|
|
100
|
-
<div style={{ height: 0, minWidth: dragMenuDropdownWidth }} />
|
|
101
|
-
<MenuGroup role="menu">
|
|
102
|
-
{items.map((group, index) => (
|
|
103
|
-
<Section
|
|
104
|
-
hasSeparator={section?.hasSeparator && index > 0}
|
|
105
|
-
title={section?.title}
|
|
106
|
-
// Ignored via go/ees005
|
|
107
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
108
|
-
key={index}
|
|
109
|
-
>
|
|
110
|
-
{group.items.map((item) => (
|
|
111
|
-
<DropdownMenuItem
|
|
112
|
-
shouldUseDefaultRole={false}
|
|
113
|
-
key={item.key ?? String(item.content)}
|
|
114
|
-
item={item}
|
|
115
|
-
onItemActivated={onItemActivated}
|
|
116
|
-
onMouseEnter={onMouseEnter}
|
|
117
|
-
onMouseLeave={onMouseLeave}
|
|
118
|
-
/>
|
|
119
|
-
))}
|
|
120
|
-
</Section>
|
|
121
|
-
))}
|
|
122
|
-
</MenuGroup>
|
|
123
|
-
</DropListWithOutsideListeners>
|
|
124
|
-
);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const onClose = useCallback(() => handleClose('handle'), [handleClose]);
|
|
128
|
-
const onSelection = useCallback(
|
|
129
|
-
(index: number) => {
|
|
130
|
-
const results = items.flatMap((item) => ('items' in item ? item.items : item));
|
|
131
|
-
|
|
132
|
-
// onSelection is called when any focusable element is 'activated'
|
|
133
|
-
// this is an issue as some menu items have toggles, which cause the index value
|
|
134
|
-
// in the callback to be outside of array length.
|
|
135
|
-
// The logic below normalises the index value based on the number
|
|
136
|
-
// of menu items with 2 focusable elements, and adjusts the index to ensure
|
|
137
|
-
// the correct menu item is sent in onItemActivated callback
|
|
138
|
-
const keys = ['row_numbers', 'header_row', 'header_column'];
|
|
139
|
-
let doubleItemCount = 0;
|
|
140
|
-
|
|
141
|
-
const firstIndex = results.findIndex((value) => {
|
|
142
|
-
const key = value.key;
|
|
143
|
-
return key !== undefined && keys.includes(key);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
if (firstIndex === -1 || index <= firstIndex) {
|
|
147
|
-
onItemActivated && onItemActivated({ item: results[index] });
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
for (let i = firstIndex; i < results.length; i += 1) {
|
|
152
|
-
const key = results[i].key;
|
|
153
|
-
if (key !== undefined && keys.includes(key)) {
|
|
154
|
-
doubleItemCount += 1;
|
|
155
|
-
}
|
|
156
|
-
if (firstIndex % 2 === 0 && index - doubleItemCount === i) {
|
|
157
|
-
onItemActivated && onItemActivated({ item: results[i] });
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
|
|
162
|
-
onItemActivated && onItemActivated({ item: results[i] });
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
[items, onItemActivated],
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
172
|
-
<div className="drag-dropdown-menu-wrapper">
|
|
173
|
-
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 */}
|
|
174
|
-
<div className="drag-dropdown-menu-popup-ref" ref={handleRef}></div>
|
|
175
|
-
<Popup
|
|
176
|
-
// Ignored via go/ees005
|
|
177
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
178
|
-
target={targetRefDiv as HTMLElement}
|
|
179
|
-
mountTo={mountPoint}
|
|
180
|
-
boundariesElement={boundariesElement}
|
|
181
|
-
scrollableElement={scrollableElement}
|
|
182
|
-
onPlacementChanged={(placement: [string, string]) => {
|
|
183
|
-
setPopupPlacement(placement);
|
|
184
|
-
}}
|
|
185
|
-
fitHeight={fitHeight}
|
|
186
|
-
fitWidth={fitWidth}
|
|
187
|
-
zIndex={akEditorFloatingPanelZIndex}
|
|
188
|
-
offset={[offsetX, offsetY]}
|
|
189
|
-
allowOutOfBounds // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
|
|
190
|
-
>
|
|
191
|
-
{fg('platform_editor_table_drag_menu_flickers_fix') ? (
|
|
192
|
-
<ArrowKeyNavigationProvider
|
|
193
|
-
closeOnTab={!disableKeyboardHandling}
|
|
194
|
-
type={ArrowKeyNavigationType.MENU}
|
|
195
|
-
handleClose={onClose}
|
|
196
|
-
onSelection={onSelection}
|
|
197
|
-
// disableKeyboardHandling is linked with isSubmenuOpen in DragMenu
|
|
198
|
-
// When isSubmenuOpen is true, the background color picker palette is open, and the picker is a ColorPaletteArrowKeyNavigationProvider
|
|
199
|
-
// At the same time the MenuArrowKeyNavigationProvider are renderer too, as it is the wrapper for all other DragMenu items
|
|
200
|
-
// In this case we want the ColorPaletteArrowKeyNavigationProvider to handle the keyboard event, not the MenuArrowKeyNavigationProvider
|
|
201
|
-
// Hence set disableArrowKeyNavigation to true when disableKeyboardHandling is true
|
|
202
|
-
disableArrowKeyNavigation={disableKeyboardHandling}
|
|
203
|
-
>
|
|
204
|
-
{innerMenu()}
|
|
205
|
-
</ArrowKeyNavigationProvider>
|
|
206
|
-
) : disableKeyboardHandling ? (
|
|
207
|
-
innerMenu()
|
|
208
|
-
) : (
|
|
209
|
-
<ArrowKeyNavigationProvider
|
|
210
|
-
closeOnTab
|
|
211
|
-
type={ArrowKeyNavigationType.MENU}
|
|
212
|
-
handleClose={onClose}
|
|
213
|
-
onSelection={onSelection}
|
|
214
|
-
>
|
|
215
|
-
{innerMenu()}
|
|
216
|
-
</ArrowKeyNavigationProvider>
|
|
217
|
-
)}
|
|
218
|
-
</Popup>
|
|
219
|
-
</div>
|
|
220
|
-
);
|
|
221
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
-
import { Popup } from '@atlaskit/editor-common/ui';
|
|
6
|
-
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
7
|
-
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
-
import {
|
|
10
|
-
akEditorFloatingDialogZIndex,
|
|
11
|
-
akEditorFloatingOverlapPanelZIndex,
|
|
12
|
-
} from '@atlaskit/editor-shared-styles';
|
|
13
|
-
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
14
|
-
|
|
15
|
-
import type { RowStickyState } from '../../pm-plugins/sticky-headers/types';
|
|
16
|
-
import type { PluginConfig, PluginInjectionAPI, TableDirection } from '../../types';
|
|
17
|
-
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
18
|
-
|
|
19
|
-
import DragMenu from './DragMenu';
|
|
20
|
-
|
|
21
|
-
interface Props {
|
|
22
|
-
editorView: EditorView;
|
|
23
|
-
isOpen: boolean;
|
|
24
|
-
tableRef?: HTMLTableElement;
|
|
25
|
-
tableNode?: PmNode;
|
|
26
|
-
mountPoint?: HTMLElement;
|
|
27
|
-
boundariesElement?: HTMLElement;
|
|
28
|
-
scrollableElement?: HTMLElement;
|
|
29
|
-
direction?: TableDirection;
|
|
30
|
-
index?: number;
|
|
31
|
-
targetCellPosition?: number;
|
|
32
|
-
getEditorContainerWidth: GetEditorContainerWidth;
|
|
33
|
-
api: PluginInjectionAPI | undefined | null;
|
|
34
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
35
|
-
stickyHeaders?: RowStickyState;
|
|
36
|
-
pluginConfig?: PluginConfig;
|
|
37
|
-
isTableScalingEnabled?: boolean;
|
|
38
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
39
|
-
ariaNotifyPlugin?: (
|
|
40
|
-
message: string,
|
|
41
|
-
ariaLiveElementAttributes?: AriaLiveElementAttributes,
|
|
42
|
-
) => void;
|
|
43
|
-
isCommentEditor?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const FloatingDragMenu = ({
|
|
47
|
-
mountPoint,
|
|
48
|
-
boundariesElement,
|
|
49
|
-
scrollableElement,
|
|
50
|
-
editorView,
|
|
51
|
-
isOpen,
|
|
52
|
-
tableNode,
|
|
53
|
-
direction,
|
|
54
|
-
index,
|
|
55
|
-
targetCellPosition,
|
|
56
|
-
getEditorContainerWidth,
|
|
57
|
-
editorAnalyticsAPI,
|
|
58
|
-
stickyHeaders,
|
|
59
|
-
pluginConfig,
|
|
60
|
-
isTableScalingEnabled,
|
|
61
|
-
getEditorFeatureFlags,
|
|
62
|
-
ariaNotifyPlugin,
|
|
63
|
-
api,
|
|
64
|
-
isCommentEditor,
|
|
65
|
-
}: Props) => {
|
|
66
|
-
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const inStickyMode = stickyHeaders?.sticky;
|
|
70
|
-
|
|
71
|
-
const targetHandleRef =
|
|
72
|
-
direction === 'row'
|
|
73
|
-
? document.querySelector('#drag-handle-button-row')
|
|
74
|
-
: document.querySelector('#drag-handle-button-column');
|
|
75
|
-
|
|
76
|
-
const offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
77
|
-
|
|
78
|
-
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags?.() ?? {};
|
|
83
|
-
|
|
84
|
-
const shouldUseIncreasedScalingPercent =
|
|
85
|
-
isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<Popup
|
|
89
|
-
alignX={direction === 'row' ? 'right' : undefined}
|
|
90
|
-
alignY={direction === 'row' ? 'start' : undefined}
|
|
91
|
-
// Ignored via go/ees005
|
|
92
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
93
|
-
target={targetHandleRef as HTMLElement}
|
|
94
|
-
mountTo={mountPoint}
|
|
95
|
-
boundariesElement={boundariesElement}
|
|
96
|
-
scrollableElement={scrollableElement}
|
|
97
|
-
fitWidth={dragMenuDropdownWidth}
|
|
98
|
-
fitHeight={tablePopupMenuFitHeight}
|
|
99
|
-
// z-index value below is to ensure that this menu is above other floating menu
|
|
100
|
-
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
101
|
-
// In sticky mode, we want to show the menu above the sticky header
|
|
102
|
-
zIndex={inStickyMode ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex}
|
|
103
|
-
forcePlacement={true}
|
|
104
|
-
offset={offset}
|
|
105
|
-
stick={true}
|
|
106
|
-
>
|
|
107
|
-
<DragMenu
|
|
108
|
-
editorView={editorView}
|
|
109
|
-
isOpen={isOpen}
|
|
110
|
-
tableNode={tableNode}
|
|
111
|
-
direction={direction}
|
|
112
|
-
index={index}
|
|
113
|
-
target={targetHandleRef || undefined}
|
|
114
|
-
targetCellPosition={targetCellPosition}
|
|
115
|
-
getEditorContainerWidth={getEditorContainerWidth}
|
|
116
|
-
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
117
|
-
pluginConfig={pluginConfig}
|
|
118
|
-
fitWidth={dragMenuDropdownWidth}
|
|
119
|
-
fitHeight={tablePopupMenuFitHeight}
|
|
120
|
-
mountPoint={mountPoint}
|
|
121
|
-
boundariesElement={boundariesElement}
|
|
122
|
-
scrollableElement={scrollableElement}
|
|
123
|
-
isTableScalingEnabled={isTableScalingEnabled}
|
|
124
|
-
shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
|
|
125
|
-
isTableFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
|
|
126
|
-
ariaNotifyPlugin={ariaNotifyPlugin}
|
|
127
|
-
api={api}
|
|
128
|
-
isCommentEditor={isCommentEditor || false}
|
|
129
|
-
/>
|
|
130
|
-
</Popup>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
135
|
-
|
|
136
|
-
export default FloatingDragMenu;
|
|
@@ -1,83 +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 {
|
|
10
|
-
dragMenuDropdownWidth,
|
|
11
|
-
TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT,
|
|
12
|
-
TABLE_DRAG_MENU_PADDING_TOP,
|
|
13
|
-
TABLE_DRAG_MENU_SORT_GROUP_HEIGHT,
|
|
14
|
-
} from '../consts';
|
|
15
|
-
|
|
16
|
-
export const cellColourPreviewStyles = (selectedColor: string) =>
|
|
17
|
-
css({
|
|
18
|
-
'&::before': {
|
|
19
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
20
|
-
background: selectedColor,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
25
|
-
export const dragMenuBackgroundColorStyles = () => css`
|
|
26
|
-
.${ClassName.DRAG_SUBMENU} {
|
|
27
|
-
border-radius: ${token('border.radius', '3px')};
|
|
28
|
-
background: ${token('elevation.surface.overlay', 'white')};
|
|
29
|
-
box-shadow: ${token('elevation.shadow.overlay', `0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`)};
|
|
30
|
-
display: block;
|
|
31
|
-
position: absolute;
|
|
32
|
-
top: ${TABLE_DRAG_MENU_PADDING_TOP +
|
|
33
|
-
TABLE_DRAG_MENU_SORT_GROUP_HEIGHT +
|
|
34
|
-
TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT}px; /* move the submenu down when 'sort increasing/decreasing' appear before background color picker */
|
|
35
|
-
left: ${dragMenuDropdownWidth}px;
|
|
36
|
-
padding: ${token('space.100', '8px')};
|
|
37
|
-
|
|
38
|
-
> div {
|
|
39
|
-
padding: 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.${ClassName.DRAG_SUBMENU_ICON} {
|
|
44
|
-
display: flex;
|
|
45
|
-
|
|
46
|
-
&::before {
|
|
47
|
-
content: '';
|
|
48
|
-
display: block;
|
|
49
|
-
border: 1px solid ${tableBackgroundBorderColor};
|
|
50
|
-
border-radius: ${token('border.radius', '3px')};
|
|
51
|
-
width: 14px;
|
|
52
|
-
height: 14px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&::after {
|
|
56
|
-
content: '›';
|
|
57
|
-
margin-left: ${token('space.050', '4px')};
|
|
58
|
-
line-height: 14px;
|
|
59
|
-
color: ${token('color.icon', N90)};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
65
|
-
export const toggleStyles = css({
|
|
66
|
-
display: 'flex',
|
|
67
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
68
|
-
"input[type='checkbox']": {
|
|
69
|
-
width: '30px',
|
|
70
|
-
height: '14px',
|
|
71
|
-
pointerEvents: 'initial',
|
|
72
|
-
cursor: 'pointer',
|
|
73
|
-
},
|
|
74
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
75
|
-
'> label': {
|
|
76
|
-
margin: '0px',
|
|
77
|
-
pointerEvents: 'none',
|
|
78
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
79
|
-
'> span': {
|
|
80
|
-
pointerEvents: 'none',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
});
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
-
import type { SyntheticEvent } from 'react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
|
-
import { injectIntl } from 'react-intl-next';
|
|
8
|
-
|
|
9
|
-
import { addColumnAfter, addRowAfter, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
10
|
-
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
-
import { tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
12
|
-
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
13
|
-
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
14
|
-
import { token } from '@atlaskit/tokens';
|
|
15
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
16
|
-
|
|
17
|
-
import type { TableDirection } from '../../types';
|
|
18
|
-
import { TableCssClassName as ClassName } from '../../types';
|
|
19
|
-
import { tableToolbarSize } from '../consts';
|
|
20
|
-
|
|
21
|
-
interface ButtonProps {
|
|
22
|
-
type: TableDirection;
|
|
23
|
-
tableRef: HTMLElement;
|
|
24
|
-
onMouseDown: (event: SyntheticEvent<HTMLButtonElement>) => void;
|
|
25
|
-
hasStickyHeaders: boolean;
|
|
26
|
-
isChromelessEditor?: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const getInsertLineHeight = (
|
|
30
|
-
tableRef: HTMLElement,
|
|
31
|
-
hasStickyHeaders: boolean,
|
|
32
|
-
isDragAndDropEnabled?: boolean,
|
|
33
|
-
) => {
|
|
34
|
-
// The line gets height 100% from the table,
|
|
35
|
-
// but since we have an overflow on the left,
|
|
36
|
-
// we should add an offset to make up for it.
|
|
37
|
-
const LINE_OFFSET = 3;
|
|
38
|
-
|
|
39
|
-
const ADDITIONAL_HEIGHT = hasStickyHeaders
|
|
40
|
-
? tableRef.getBoundingClientRect().top -
|
|
41
|
-
tableMarginTop * (isDragAndDropEnabled ? 3 : 4) -
|
|
42
|
-
LINE_OFFSET
|
|
43
|
-
: tableToolbarSize + LINE_OFFSET;
|
|
44
|
-
return tableRef.offsetHeight + ADDITIONAL_HEIGHT;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const getToolbarSize = (tableRef: HTMLElement): number => {
|
|
48
|
-
const parent = closestElement(tableRef, `.${ClassName.TABLE_CONTAINER}`);
|
|
49
|
-
if (parent) {
|
|
50
|
-
return parent.querySelector(`.${ClassName.NUMBERED_COLUMN}`)
|
|
51
|
-
? tableToolbarSize + akEditorTableNumberColumnWidth - 1
|
|
52
|
-
: tableToolbarSize;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return tableToolbarSize;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const getNumberColumnWidth = (tableRef: HTMLElement, isDragAndDropEnabled?: boolean): number => {
|
|
59
|
-
const parent = closestElement(tableRef, `.${ClassName.TABLE_CONTAINER}`);
|
|
60
|
-
if (parent && isDragAndDropEnabled) {
|
|
61
|
-
return parent.querySelector(`.${ClassName.NUMBERED_COLUMN}`)
|
|
62
|
-
? akEditorTableNumberColumnWidth - 1
|
|
63
|
-
: 0;
|
|
64
|
-
}
|
|
65
|
-
return 0;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const getInsertLineWidth = (
|
|
69
|
-
tableRef: HTMLElement,
|
|
70
|
-
isDragAndDropEnabled?: boolean,
|
|
71
|
-
isChromelessEditor?: boolean,
|
|
72
|
-
) => {
|
|
73
|
-
// The line gets width 100% from the table,
|
|
74
|
-
// but since we have an overflow on the left,
|
|
75
|
-
// we should add an offset to make up for it.
|
|
76
|
-
const LINE_OFFSET = 4;
|
|
77
|
-
const DRAG_LINE_OFFSET = isChromelessEditor ? 14 : 6;
|
|
78
|
-
const { parentElement, offsetWidth } = tableRef;
|
|
79
|
-
// Ignored via go/ees005
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
81
|
-
const parentOffsetWidth = parentElement!.offsetWidth;
|
|
82
|
-
// Ignored via go/ees005
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
84
|
-
const { scrollLeft } = parentElement!;
|
|
85
|
-
const diff = offsetWidth - parentOffsetWidth;
|
|
86
|
-
const toolbarSize = isDragAndDropEnabled ? 0 : getToolbarSize(tableRef);
|
|
87
|
-
const lineOffset = isDragAndDropEnabled ? DRAG_LINE_OFFSET : LINE_OFFSET;
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
Math.min(
|
|
91
|
-
offsetWidth + toolbarSize,
|
|
92
|
-
parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0),
|
|
93
|
-
) +
|
|
94
|
-
lineOffset +
|
|
95
|
-
getNumberColumnWidth(tableRef, isDragAndDropEnabled)
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const tooltipMessageByType = (type: TableDirection) => {
|
|
100
|
-
return type === 'row' ? messages.insertRow : messages.insertColumn;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const InsertButtonForDragAndDrop = ({
|
|
104
|
-
onMouseDown,
|
|
105
|
-
tableRef,
|
|
106
|
-
type,
|
|
107
|
-
intl: { formatMessage },
|
|
108
|
-
hasStickyHeaders,
|
|
109
|
-
isChromelessEditor,
|
|
110
|
-
}: ButtonProps & WrappedComponentProps) => {
|
|
111
|
-
const isRow = type === 'row';
|
|
112
|
-
|
|
113
|
-
const content = (
|
|
114
|
-
<Tooltip
|
|
115
|
-
content={
|
|
116
|
-
<ToolTipContent
|
|
117
|
-
description={formatMessage(isRow ? messages.insertRowDrag : messages.insertColumnDrag)}
|
|
118
|
-
keymap={isRow ? addRowAfter : addColumnAfter}
|
|
119
|
-
/>
|
|
120
|
-
}
|
|
121
|
-
position="top"
|
|
122
|
-
>
|
|
123
|
-
<>
|
|
124
|
-
<div
|
|
125
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
126
|
-
className={classnames(ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, {
|
|
127
|
-
[ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW]: isRow && !isChromelessEditor,
|
|
128
|
-
[ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN]: !isRow,
|
|
129
|
-
[ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS]:
|
|
130
|
-
isRow && isChromelessEditor,
|
|
131
|
-
})}
|
|
132
|
-
>
|
|
133
|
-
<button
|
|
134
|
-
type="button"
|
|
135
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
136
|
-
className={ClassName.DRAG_CONTROLS_INSERT_BUTTON}
|
|
137
|
-
onMouseDown={onMouseDown}
|
|
138
|
-
>
|
|
139
|
-
<svg
|
|
140
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
141
|
-
className={ClassName.CONTROLS_BUTTON_ICON}
|
|
142
|
-
width="16"
|
|
143
|
-
height="16"
|
|
144
|
-
viewBox="0 0 16 16"
|
|
145
|
-
fill="none"
|
|
146
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
147
|
-
>
|
|
148
|
-
<path
|
|
149
|
-
d="M8 4C7.44771 4 7 4.44771 7 5V7H5C4.44771 7 4 7.44771 4 8C4 8.55229 4.44771 9 5 9H7V11C7 11.5523 7.44771 12 8 12C8.55229 12 9 11.5523 9 11V9H11C11.5523 9 12 8.55229 12 8C12 7.44771 11.5523 7 11 7H9V5C9 4.44771 8.55229 4 8 4Z"
|
|
150
|
-
fill="currentColor"
|
|
151
|
-
/>
|
|
152
|
-
</svg>
|
|
153
|
-
</button>
|
|
154
|
-
</div>
|
|
155
|
-
<div
|
|
156
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
157
|
-
className={ClassName.CONTROLS_INSERT_LINE}
|
|
158
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
159
|
-
style={
|
|
160
|
-
type === 'row'
|
|
161
|
-
? {
|
|
162
|
-
width: getInsertLineWidth(tableRef, true, isChromelessEditor),
|
|
163
|
-
left: token('space.150', '12px'),
|
|
164
|
-
}
|
|
165
|
-
: {
|
|
166
|
-
height: getInsertLineHeight(tableRef, hasStickyHeaders, true) - 8,
|
|
167
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
168
|
-
top: '-3px',
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
/>
|
|
172
|
-
</>
|
|
173
|
-
</Tooltip>
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
const floatingButtonClassName = isRow
|
|
177
|
-
? ClassName.CONTROLS_FLOATING_BUTTON_ROW
|
|
178
|
-
: ClassName.CONTROLS_FLOATING_BUTTON_COLUMN;
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
182
|
-
<div className={floatingButtonClassName}>
|
|
183
|
-
<div
|
|
184
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
185
|
-
className={`${ClassName.DRAG_CONTROLS_INSERT_BUTTON_WRAP} ${ClassName.CONTROLS_INSERT_ROW}`}
|
|
186
|
-
>
|
|
187
|
-
{content}
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export const DragAndDropInsertButton = injectIntl(InsertButtonForDragAndDrop);
|
|
194
|
-
|
|
195
|
-
const InsertButton = ({
|
|
196
|
-
onMouseDown,
|
|
197
|
-
tableRef,
|
|
198
|
-
type,
|
|
199
|
-
intl: { formatMessage },
|
|
200
|
-
hasStickyHeaders,
|
|
201
|
-
}: ButtonProps & WrappedComponentProps) => {
|
|
202
|
-
const content = (
|
|
203
|
-
<Tooltip
|
|
204
|
-
content={
|
|
205
|
-
<ToolTipContent
|
|
206
|
-
description={formatMessage(tooltipMessageByType(type))}
|
|
207
|
-
keymap={type === 'row' ? addRowAfter : addColumnAfter}
|
|
208
|
-
/>
|
|
209
|
-
}
|
|
210
|
-
position="top"
|
|
211
|
-
>
|
|
212
|
-
<>
|
|
213
|
-
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 */}
|
|
214
|
-
<div className={ClassName.CONTROLS_INSERT_BUTTON_INNER}>
|
|
215
|
-
<button
|
|
216
|
-
type="button"
|
|
217
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
218
|
-
className={ClassName.CONTROLS_INSERT_BUTTON}
|
|
219
|
-
onMouseDown={onMouseDown}
|
|
220
|
-
>
|
|
221
|
-
{/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 */}
|
|
222
|
-
<svg className={ClassName.CONTROLS_BUTTON_ICON}>
|
|
223
|
-
<path
|
|
224
|
-
d="M10 4a1 1 0 0 1 1 1v4h4a1 1 0 0 1 0 2h-4v4a1 1 0 0 1-2 0v-4H5a1 1 0 1 1 0-2h4V5a1 1 0 0 1 1-1z"
|
|
225
|
-
fill="currentColor"
|
|
226
|
-
fillRule="evenodd"
|
|
227
|
-
/>
|
|
228
|
-
</svg>
|
|
229
|
-
</button>
|
|
230
|
-
</div>
|
|
231
|
-
<div
|
|
232
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
233
|
-
className={ClassName.CONTROLS_INSERT_LINE}
|
|
234
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
235
|
-
style={
|
|
236
|
-
type === 'row'
|
|
237
|
-
? { width: getInsertLineWidth(tableRef) }
|
|
238
|
-
: { height: getInsertLineHeight(tableRef, hasStickyHeaders) }
|
|
239
|
-
}
|
|
240
|
-
/>
|
|
241
|
-
</>
|
|
242
|
-
</Tooltip>
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
const floatingButtonClassName =
|
|
246
|
-
type === 'column'
|
|
247
|
-
? ClassName.CONTROLS_FLOATING_BUTTON_COLUMN
|
|
248
|
-
: ClassName.CONTROLS_FLOATING_BUTTON_ROW;
|
|
249
|
-
|
|
250
|
-
return (
|
|
251
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
252
|
-
<div className={floatingButtonClassName}>
|
|
253
|
-
<div
|
|
254
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
255
|
-
className={`${ClassName.CONTROLS_INSERT_BUTTON_WRAP} ${ClassName.CONTROLS_INSERT_ROW}`}
|
|
256
|
-
>
|
|
257
|
-
{content}
|
|
258
|
-
</div>
|
|
259
|
-
</div>
|
|
260
|
-
);
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export default injectIntl(InsertButton);
|