@atlaskit/editor-plugin-table 5.3.0 → 5.3.2
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 +13 -0
- package/dist/cjs/plugins/table/commands/hover.js +17 -8
- package/dist/cjs/plugins/table/commands/index.js +6 -0
- package/dist/cjs/plugins/table/commands/misc.js +1 -7
- package/dist/cjs/plugins/table/event-handlers.js +29 -2
- package/dist/cjs/plugins/table/index.js +1 -1
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -3
- package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +7 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
- package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +14 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +36 -7
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +69 -7
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/utils/index.js +12 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +59 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +5 -5
- package/dist/cjs/plugins/table/reducer.js +2 -1
- package/dist/cjs/plugins/table/types.js +14 -1
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +50 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +53 -14
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +114 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +53 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +11 -106
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +16 -6
- package/dist/cjs/plugins/table/ui/common-styles.js +9 -6
- package/dist/cjs/plugins/table/ui/consts.js +3 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +21 -9
- package/dist/cjs/plugins/table/utils/decoration.js +111 -19
- package/dist/cjs/plugins/table/utils/dom.js +7 -1
- package/dist/cjs/plugins/table/utils/index.js +38 -1
- package/dist/cjs/plugins/table/utils/merged-cells.js +66 -0
- package/dist/es2019/plugins/table/commands/hover.js +12 -8
- package/dist/es2019/plugins/table/commands/index.js +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +1 -7
- package/dist/es2019/plugins/table/event-handlers.js +28 -2
- package/dist/es2019/plugins/table/index.js +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -3
- package/dist/es2019/plugins/table/nodeviews/table.js +4 -2
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +8 -6
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
- package/dist/es2019/plugins/table/pm-plugins/default-table-selection.js +13 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +35 -7
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +69 -4
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/utils/index.js +1 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +56 -0
- package/dist/es2019/plugins/table/pm-plugins/main.js +6 -5
- package/dist/es2019/plugins/table/reducer.js +2 -1
- package/dist/es2019/plugins/table/types.js +14 -1
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +41 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -10
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +86 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +43 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -88
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +17 -7
- package/dist/es2019/plugins/table/ui/common-styles.js +49 -13
- package/dist/es2019/plugins/table/ui/consts.js +2 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +171 -15
- package/dist/es2019/plugins/table/utils/decoration.js +106 -18
- package/dist/es2019/plugins/table/utils/dom.js +2 -0
- package/dist/es2019/plugins/table/utils/index.js +4 -3
- package/dist/es2019/plugins/table/utils/merged-cells.js +48 -0
- package/dist/esm/plugins/table/commands/hover.js +16 -8
- package/dist/esm/plugins/table/commands/index.js +1 -1
- package/dist/esm/plugins/table/commands/misc.js +1 -7
- package/dist/esm/plugins/table/event-handlers.js +29 -2
- package/dist/esm/plugins/table/index.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -3
- package/dist/esm/plugins/table/nodeviews/table.js +4 -2
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +8 -6
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
- package/dist/esm/plugins/table/pm-plugins/default-table-selection.js +13 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +36 -7
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +65 -4
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/utils/index.js +1 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +53 -0
- package/dist/esm/plugins/table/pm-plugins/main.js +7 -7
- package/dist/esm/plugins/table/reducer.js +2 -1
- package/dist/esm/plugins/table/types.js +14 -1
- package/dist/esm/plugins/table/ui/DragHandle/index.js +41 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -15
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +104 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +46 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -104
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +17 -7
- package/dist/esm/plugins/table/ui/common-styles.js +11 -8
- package/dist/esm/plugins/table/ui/consts.js +2 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +21 -9
- package/dist/esm/plugins/table/utils/decoration.js +110 -18
- package/dist/esm/plugins/table/utils/dom.js +6 -0
- package/dist/esm/plugins/table/utils/index.js +4 -3
- package/dist/esm/plugins/table/utils/merged-cells.js +60 -0
- package/dist/types/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types/plugins/table/commands/index.d.ts +1 -1
- package/dist/types/plugins/table/event-handlers.d.ts +1 -0
- package/dist/types/plugins/table/nodeviews/types.d.ts +4 -3
- package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +5 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +6 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/utils/index.d.ts +1 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/utils/monitor.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +35 -2
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +11 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
- package/dist/types/plugins/table/ui/consts.d.ts +2 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +4 -2
- package/dist/types/plugins/table/utils/dom.d.ts +2 -0
- package/dist/types/plugins/table/utils/index.d.ts +3 -2
- package/dist/types/plugins/table/utils/merged-cells.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +4 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +5 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +6 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/utils/monitor.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +35 -2
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +4 -2
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +3 -2
- package/dist/types-ts4.5/plugins/table/utils/merged-cells.d.ts +3 -0
- package/package.json +6 -2
- package/src/__tests__/unit/event-handlers.ts +74 -1
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +35 -15
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +146 -42
- package/src/__tests__/unit/ui/NumberColumn.tsx +148 -0
- package/src/__tests__/unit/ui/RowControls.tsx +4 -4
- package/src/__tests__/unit/ui/RowDragControls.tsx +118 -0
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +9 -5
- package/src/plugins/table/commands/hover.ts +16 -7
- package/src/plugins/table/commands/index.ts +1 -0
- package/src/plugins/table/commands/misc.ts +0 -5
- package/src/plugins/table/event-handlers.ts +49 -2
- package/src/plugins/table/index.tsx +1 -1
- package/src/plugins/table/nodeviews/TableComponent.tsx +3 -2
- package/src/plugins/table/nodeviews/table.tsx +2 -0
- package/src/plugins/table/nodeviews/types.ts +4 -3
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +13 -4
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +10 -5
- package/src/plugins/table/pm-plugins/default-table-selection.ts +10 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +6 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +58 -8
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +77 -4
- package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +2 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/utils/index.ts +1 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/utils/monitor.ts +72 -0
- package/src/plugins/table/pm-plugins/main.ts +9 -4
- package/src/plugins/table/reducer.ts +2 -1
- package/src/plugins/table/types.ts +37 -3
- package/src/plugins/table/ui/DragHandle/index.tsx +57 -0
- package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +68 -30
- package/src/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.tsx +129 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +75 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/index.tsx +2 -135
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +43 -24
- package/src/plugins/table/ui/common-styles.ts +54 -11
- package/src/plugins/table/ui/consts.ts +2 -0
- package/src/plugins/table/ui/ui-styles.ts +173 -14
- package/src/plugins/table/utils/decoration.ts +176 -27
- package/src/plugins/table/utils/dom.ts +8 -0
- package/src/plugins/table/utils/index.ts +5 -0
- package/src/plugins/table/utils/merged-cells.ts +67 -0
- package/tsconfig.app.json +3 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { DragHandleButton } from '@atlaskit/pragmatic-drag-and-drop-react-accessibility/drag-handle-button';
|
|
3
|
+
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
4
|
+
// TODO: use for now, in future replace with custom @atlaskit/icon/glyph/drag-handler
|
|
5
|
+
// width is too large (24px), should be 16px
|
|
6
|
+
export const DragHandle = ({
|
|
7
|
+
tableLocalId,
|
|
8
|
+
direction = 'row',
|
|
9
|
+
indexes,
|
|
10
|
+
onClick,
|
|
11
|
+
onMouseOver,
|
|
12
|
+
onMouseOut
|
|
13
|
+
}) => {
|
|
14
|
+
const dragHandleDivRef = useRef(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
17
|
+
if (dragHandleDivRefCurrent) {
|
|
18
|
+
return draggable({
|
|
19
|
+
element: dragHandleDivRefCurrent,
|
|
20
|
+
getInitialData() {
|
|
21
|
+
return {
|
|
22
|
+
localId: tableLocalId,
|
|
23
|
+
type: `table-${direction}`,
|
|
24
|
+
indexes
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, [tableLocalId, direction, indexes]);
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
ref: dragHandleDivRef,
|
|
32
|
+
style: {
|
|
33
|
+
backgroundColor: `${"var(--ds-surface, white)"}`,
|
|
34
|
+
borderRadius: '4px',
|
|
35
|
+
border: `2px solid ${"var(--ds-surface, white)"}`,
|
|
36
|
+
transform: direction === 'column' ? 'rotate(90deg)' : 'none'
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React.createElement(DragHandleButton, {
|
|
39
|
+
label: "blah"
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
3
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
5
|
-
import { clearHoverSelection } from '../../../commands';
|
|
6
|
+
import { clearHoverSelection, hoverCell } from '../../../commands';
|
|
7
|
+
import { getPluginState } from '../../../pm-plugins/plugin-factory';
|
|
6
8
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
7
9
|
import { getRowHeights } from '../../../utils';
|
|
10
|
+
import { tableBorderColor } from '../../consts';
|
|
8
11
|
export default class NumberColumn extends Component {
|
|
9
12
|
constructor(...args) {
|
|
10
13
|
super(...args);
|
|
@@ -47,7 +50,38 @@ export default class NumberColumn extends Component {
|
|
|
47
50
|
clearHoverSelection()(state, dispatch);
|
|
48
51
|
}
|
|
49
52
|
});
|
|
50
|
-
_defineProperty(this, "
|
|
53
|
+
_defineProperty(this, "updateDragHandleLocation", rowIndex => {
|
|
54
|
+
const {
|
|
55
|
+
editorView,
|
|
56
|
+
tableActive
|
|
57
|
+
} = this.props;
|
|
58
|
+
const {
|
|
59
|
+
state,
|
|
60
|
+
dispatch
|
|
61
|
+
} = editorView;
|
|
62
|
+
const {
|
|
63
|
+
hoveredCell
|
|
64
|
+
} = getPluginState(state);
|
|
65
|
+
if (tableActive && hoveredCell.rowIndex !== rowIndex) {
|
|
66
|
+
hoverCell(rowIndex, hoveredCell.colIndex)(state, dispatch);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
_defineProperty(this, "getCellStyles", (index, rowHeight) => {
|
|
70
|
+
const {
|
|
71
|
+
stickyTop,
|
|
72
|
+
hasHeaderRow
|
|
73
|
+
} = this.props;
|
|
74
|
+
if (stickyTop && hasHeaderRow && index === 0) {
|
|
75
|
+
return {
|
|
76
|
+
height: rowHeight,
|
|
77
|
+
top: `${stickyTop}px`
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
height: rowHeight
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
_defineProperty(this, "getClassNames", (index, isButtonDisabled = false) => {
|
|
51
85
|
const {
|
|
52
86
|
hoveredRows,
|
|
53
87
|
editorView,
|
|
@@ -55,29 +89,39 @@ export default class NumberColumn extends Component {
|
|
|
55
89
|
isResizing
|
|
56
90
|
} = this.props;
|
|
57
91
|
const isActive = isRowSelected(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
|
|
58
|
-
return
|
|
92
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
93
|
+
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
94
|
+
[ClassName.HOVERED_CELL_IN_DANGER]: isActive && isInDanger,
|
|
95
|
+
[ClassName.HOVERED_CELL_ACTIVE]: isActive
|
|
96
|
+
});
|
|
59
97
|
});
|
|
60
98
|
}
|
|
61
99
|
render() {
|
|
62
100
|
const {
|
|
63
101
|
tableRef,
|
|
64
|
-
hasHeaderRow
|
|
102
|
+
hasHeaderRow,
|
|
103
|
+
isDragAndDropEnabled,
|
|
104
|
+
tableActive
|
|
65
105
|
} = this.props;
|
|
66
106
|
const rowHeights = getRowHeights(tableRef);
|
|
67
107
|
return /*#__PURE__*/React.createElement("div", {
|
|
68
108
|
className: ClassName.NUMBERED_COLUMN,
|
|
69
109
|
style: {
|
|
70
|
-
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined
|
|
110
|
+
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
|
|
111
|
+
borderLeft: isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor()}` : undefined
|
|
71
112
|
},
|
|
72
113
|
contentEditable: false
|
|
73
|
-
}, rowHeights.map((rowHeight, index) => /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
}, rowHeights.map((rowHeight, index) => isDragAndDropEnabled ? /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
key: `wrapper-${index}`,
|
|
116
|
+
className: this.getClassNames(index, true),
|
|
117
|
+
"data-index": index,
|
|
118
|
+
style: this.getCellStyles(index, rowHeight),
|
|
119
|
+
onMouseOver: () => this.updateDragHandleLocation(index)
|
|
120
|
+
}, hasHeaderRow ? index > 0 ? index : null : index + 1) : /*#__PURE__*/React.createElement("div", {
|
|
74
121
|
key: `wrapper-${index}`,
|
|
75
122
|
className: this.getClassNames(index),
|
|
76
123
|
"data-index": index,
|
|
77
|
-
style:
|
|
78
|
-
height: rowHeight,
|
|
79
|
-
top: this.props.stickyTop !== undefined && hasHeaderRow && index === 0 ? `${this.props.stickyTop}px` : undefined
|
|
80
|
-
},
|
|
124
|
+
style: this.getCellStyles(index, rowHeight),
|
|
81
125
|
onClick: event => this.selectRow(index, event),
|
|
82
126
|
onMouseOver: () => this.hoverRows(index),
|
|
83
127
|
onMouseOut: this.clearHoverSelection
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
4
|
+
import { clearHoverSelection } from '../../../commands';
|
|
5
|
+
import { TableCssClassName as ClassName } from '../../../types';
|
|
6
|
+
import { getRowClassNames, getRowHeights, getRowsParams } from '../../../utils';
|
|
7
|
+
import { tableControlsSpacing, tableToolbarSize } from '../../consts';
|
|
8
|
+
const messages = defineMessages({
|
|
9
|
+
rowControl: {
|
|
10
|
+
id: 'fabric.editor.rowControl',
|
|
11
|
+
defaultMessage: 'Highlight row',
|
|
12
|
+
description: 'A button on the left of each row that shows up when the table is in focus. Clicking on it will select the entire row.'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
class RowControlsComponent extends Component {
|
|
16
|
+
constructor(...args) {
|
|
17
|
+
super(...args);
|
|
18
|
+
_defineProperty(this, "clearHoverSelection", () => {
|
|
19
|
+
const {
|
|
20
|
+
state,
|
|
21
|
+
dispatch
|
|
22
|
+
} = this.props.editorView;
|
|
23
|
+
clearHoverSelection()(state, dispatch);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
const {
|
|
28
|
+
editorView,
|
|
29
|
+
tableRef,
|
|
30
|
+
hoveredRows,
|
|
31
|
+
isInDanger,
|
|
32
|
+
isResizing,
|
|
33
|
+
intl: {
|
|
34
|
+
formatMessage
|
|
35
|
+
}
|
|
36
|
+
} = this.props;
|
|
37
|
+
if (!tableRef) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const {
|
|
41
|
+
selection
|
|
42
|
+
} = editorView.state;
|
|
43
|
+
const rowHeights = getRowHeights(tableRef);
|
|
44
|
+
const rowsParams = getRowsParams(rowHeights);
|
|
45
|
+
const firstRow = tableRef.querySelector('tr');
|
|
46
|
+
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
47
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: ClassName.ROW_CONTROLS
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: ClassName.ROW_CONTROLS_INNER
|
|
51
|
+
}, rowsParams.map(({
|
|
52
|
+
startIndex,
|
|
53
|
+
endIndex,
|
|
54
|
+
height
|
|
55
|
+
}, index) => {
|
|
56
|
+
// if previous row was header row, add its height to our margin
|
|
57
|
+
let marginTop = -1;
|
|
58
|
+
if (index === 1 && hasHeaderRow && this.props.stickyTop !== undefined) {
|
|
59
|
+
marginTop += rowHeights[index - 1] + tableToolbarSize;
|
|
60
|
+
}
|
|
61
|
+
const thisRowSticky = this.props.stickyTop !== undefined && index === 0 && hasHeaderRow;
|
|
62
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: `${ClassName.ROW_CONTROLS_BUTTON_WRAP} ${getRowClassNames(startIndex, selection, hoveredRows, isInDanger, isResizing)} ${thisRowSticky ? 'sticky' : ''}`,
|
|
64
|
+
key: startIndex,
|
|
65
|
+
style: {
|
|
66
|
+
height: height,
|
|
67
|
+
marginTop: `${marginTop}px`,
|
|
68
|
+
top: thisRowSticky ? `${this.props.stickyTop + 3}px` : undefined,
|
|
69
|
+
paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
|
|
70
|
+
}
|
|
71
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
72
|
+
"aria-label": formatMessage(messages.rowControl),
|
|
73
|
+
type: "button",
|
|
74
|
+
className: `${ClassName.ROW_CONTROLS_BUTTON} ${ClassName.CONTROLS_BUTTON}`,
|
|
75
|
+
onClick: event => this.props.selectRow(startIndex, event.shiftKey),
|
|
76
|
+
onMouseOver: () => this.props.hoverRows([startIndex]),
|
|
77
|
+
onMouseOut: this.clearHoverSelection,
|
|
78
|
+
"data-start-index": startIndex,
|
|
79
|
+
"data-end-index": endIndex
|
|
80
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: ClassName.CONTROLS_INSERT_MARKER
|
|
82
|
+
}));
|
|
83
|
+
})));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export const RowControls = injectIntl(RowControlsComponent);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { injectIntl } from 'react-intl-next';
|
|
3
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { TableCssClassName as ClassName } from '../../../types';
|
|
5
|
+
import { getRowHeights } from '../../../utils';
|
|
6
|
+
import { DragHandle } from '../../DragHandle';
|
|
7
|
+
const DragControlsComponent = ({
|
|
8
|
+
tableRef,
|
|
9
|
+
hoveredCell,
|
|
10
|
+
hoverRows,
|
|
11
|
+
selectRow,
|
|
12
|
+
tableActive,
|
|
13
|
+
editorView
|
|
14
|
+
}) => {
|
|
15
|
+
const rowHeights = getRowHeights(tableRef);
|
|
16
|
+
const heights = rowHeights.map(height => `${height - 1}px`).join(' ');
|
|
17
|
+
const onClick = (index, event) => {};
|
|
18
|
+
const onMouseOver = () => {};
|
|
19
|
+
const onMouseOut = () => {};
|
|
20
|
+
const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
21
|
+
const getLocalId = () => {
|
|
22
|
+
var _tableNode$node, _tableNode$node$attrs;
|
|
23
|
+
const tableNode = findTable(editorView.state.selection);
|
|
24
|
+
return (tableNode === null || tableNode === void 0 ? void 0 : (_tableNode$node = tableNode.node) === null || _tableNode$node === void 0 ? void 0 : (_tableNode$node$attrs = _tableNode$node.attrs) === null || _tableNode$node$attrs === void 0 ? void 0 : _tableNode$node$attrs.localId) || '';
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: ClassName.ROW_CONTROLS_WITH_DRAG,
|
|
28
|
+
style: {
|
|
29
|
+
gridTemplateRows: heights
|
|
30
|
+
}
|
|
31
|
+
}, Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
style: {
|
|
33
|
+
gridRow: `${rowIndex + 1} / span 1`
|
|
34
|
+
}
|
|
35
|
+
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
36
|
+
onClick: event => onClick(rowIndex, event),
|
|
37
|
+
onMouseOver: onMouseOver,
|
|
38
|
+
onMouseOut: onMouseOut,
|
|
39
|
+
tableLocalId: getLocalId(),
|
|
40
|
+
indexes: []
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
43
|
+
export const DragControls = injectIntl(DragControlsComponent);
|
|
@@ -1,88 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
4
|
-
import { clearHoverSelection } from '../../../commands';
|
|
5
|
-
import { TableCssClassName as ClassName } from '../../../types';
|
|
6
|
-
import { getRowClassNames, getRowHeights, getRowsParams } from '../../../utils';
|
|
7
|
-
import { tableControlsSpacing, tableToolbarSize } from '../../consts';
|
|
8
|
-
const messages = defineMessages({
|
|
9
|
-
rowControl: {
|
|
10
|
-
id: 'fabric.editor.rowControl',
|
|
11
|
-
defaultMessage: 'Highlight row',
|
|
12
|
-
description: 'A button on the left of each row that shows up when the table is in focus. Clicking on it will select the entire row.'
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
class RowControlsComponent extends Component {
|
|
16
|
-
constructor(...args) {
|
|
17
|
-
super(...args);
|
|
18
|
-
_defineProperty(this, "clearHoverSelection", () => {
|
|
19
|
-
const {
|
|
20
|
-
state,
|
|
21
|
-
dispatch
|
|
22
|
-
} = this.props.editorView;
|
|
23
|
-
clearHoverSelection()(state, dispatch);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
render() {
|
|
27
|
-
const {
|
|
28
|
-
editorView,
|
|
29
|
-
tableRef,
|
|
30
|
-
hoveredRows,
|
|
31
|
-
isInDanger,
|
|
32
|
-
isResizing,
|
|
33
|
-
intl: {
|
|
34
|
-
formatMessage
|
|
35
|
-
}
|
|
36
|
-
} = this.props;
|
|
37
|
-
if (!tableRef) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const {
|
|
41
|
-
selection
|
|
42
|
-
} = editorView.state;
|
|
43
|
-
const rowHeights = getRowHeights(tableRef);
|
|
44
|
-
const rowsParams = getRowsParams(rowHeights);
|
|
45
|
-
const firstRow = tableRef.querySelector('tr');
|
|
46
|
-
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
47
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: ClassName.ROW_CONTROLS
|
|
49
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
-
className: ClassName.ROW_CONTROLS_INNER
|
|
51
|
-
}, rowsParams.map(({
|
|
52
|
-
startIndex,
|
|
53
|
-
endIndex,
|
|
54
|
-
height
|
|
55
|
-
}, index) => {
|
|
56
|
-
// if previous row was header row, add its height to our margin
|
|
57
|
-
let marginTop = -1;
|
|
58
|
-
if (index === 1 && hasHeaderRow && this.props.stickyTop !== undefined) {
|
|
59
|
-
marginTop += rowHeights[index - 1] + tableToolbarSize;
|
|
60
|
-
}
|
|
61
|
-
const thisRowSticky = this.props.stickyTop !== undefined && index === 0 && hasHeaderRow;
|
|
62
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: `${ClassName.ROW_CONTROLS_BUTTON_WRAP} ${getRowClassNames(startIndex, selection, hoveredRows, isInDanger, isResizing)} ${thisRowSticky ? 'sticky' : ''}`,
|
|
64
|
-
key: startIndex,
|
|
65
|
-
style: {
|
|
66
|
-
height: height,
|
|
67
|
-
marginTop: `${marginTop}px`,
|
|
68
|
-
top: thisRowSticky ? `${this.props.stickyTop + 3}px` : undefined,
|
|
69
|
-
paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
|
|
70
|
-
}
|
|
71
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
72
|
-
"aria-label": formatMessage(messages.rowControl),
|
|
73
|
-
type: "button",
|
|
74
|
-
className: `${ClassName.ROW_CONTROLS_BUTTON}
|
|
75
|
-
${ClassName.CONTROLS_BUTTON}
|
|
76
|
-
`,
|
|
77
|
-
onClick: event => this.props.selectRow(startIndex, event.shiftKey),
|
|
78
|
-
onMouseOver: () => this.props.hoverRows([startIndex]),
|
|
79
|
-
onMouseOut: this.clearHoverSelection,
|
|
80
|
-
"data-start-index": startIndex,
|
|
81
|
-
"data-end-index": endIndex
|
|
82
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
83
|
-
className: ClassName.CONTROLS_INSERT_MARKER
|
|
84
|
-
}));
|
|
85
|
-
})));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
export const RowControls = injectIntl(RowControlsComponent);
|
|
1
|
+
export { RowControls } from './ClassicControls';
|
|
2
|
+
export { DragControls } from './DragControls';
|
|
@@ -5,7 +5,7 @@ import { hoverRows, selectRow } from '../../commands';
|
|
|
5
5
|
import { isSelectionUpdated } from '../../utils';
|
|
6
6
|
import { CornerControls } from './CornerControls';
|
|
7
7
|
import NumberColumn from './NumberColumn';
|
|
8
|
-
import { RowControls } from './RowControls';
|
|
8
|
+
import { DragControls, RowControls } from './RowControls';
|
|
9
9
|
export default class TableFloatingControls extends Component {
|
|
10
10
|
constructor(...args) {
|
|
11
11
|
super(...args);
|
|
@@ -71,11 +71,12 @@ export default class TableFloatingControls extends Component {
|
|
|
71
71
|
isHeaderColumnEnabled,
|
|
72
72
|
ordering,
|
|
73
73
|
headerRowHeight,
|
|
74
|
-
stickyHeader
|
|
74
|
+
stickyHeader,
|
|
75
|
+
hoveredCell
|
|
75
76
|
} = this.props;
|
|
76
77
|
const tableHeight = (_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.tableHeight;
|
|
77
78
|
const nextTableHeight = nextState === null || nextState === void 0 ? void 0 : nextState.tableHeight;
|
|
78
|
-
return ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableHeight !== nextTableHeight || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader;
|
|
79
|
+
return ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableHeight !== nextTableHeight || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell;
|
|
79
80
|
}
|
|
80
81
|
componentWillUnmount() {
|
|
81
82
|
if (this.resizeObserver) {
|
|
@@ -94,7 +95,9 @@ export default class TableFloatingControls extends Component {
|
|
|
94
95
|
tableActive,
|
|
95
96
|
hasHeaderRow,
|
|
96
97
|
hoveredRows,
|
|
97
|
-
stickyHeader
|
|
98
|
+
stickyHeader,
|
|
99
|
+
isDragAndDropEnabled,
|
|
100
|
+
hoveredCell
|
|
98
101
|
} = this.props;
|
|
99
102
|
if (!tableRef) {
|
|
100
103
|
return null;
|
|
@@ -112,8 +115,15 @@ export default class TableFloatingControls extends Component {
|
|
|
112
115
|
isInDanger: isInDanger,
|
|
113
116
|
isResizing: isResizing,
|
|
114
117
|
selectRow: this.selectRow,
|
|
115
|
-
stickyTop: stickyTop
|
|
116
|
-
|
|
118
|
+
stickyTop: stickyTop,
|
|
119
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
120
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(DragControls, {
|
|
121
|
+
tableRef: tableRef,
|
|
122
|
+
hoveredCell: hoveredCell,
|
|
123
|
+
editorView: editorView,
|
|
124
|
+
hoverRows: this.hoverRows,
|
|
125
|
+
selectRow: this.selectRow
|
|
126
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
117
127
|
editorView: editorView,
|
|
118
128
|
tableRef: tableRef,
|
|
119
129
|
isInDanger: isInDanger,
|
|
@@ -131,7 +141,7 @@ export default class TableFloatingControls extends Component {
|
|
|
131
141
|
isResizing: isResizing,
|
|
132
142
|
selectRow: this.selectRow,
|
|
133
143
|
stickyTop: tableActive ? stickyTop : undefined
|
|
134
|
-
})));
|
|
144
|
+
}))));
|
|
135
145
|
}
|
|
136
146
|
}
|
|
137
147
|
_defineProperty(TableFloatingControls, "displayName", 'TableFloatingControls');
|
|
@@ -6,8 +6,8 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
6
6
|
import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
|
|
7
7
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
8
8
|
import { TableCssClassName as ClassName } from '../types';
|
|
9
|
-
import { columnControlsDecorationHeight, resizeHandlerAreaWidth, resizeLineWidth, stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableBorderColor, tableBorderDeleteColor, tableBorderRadiusSize, tableBorderSelectedColor, tableCellBackgroundColor, tableCellDeleteColor, tableCellSelectedColor, tableControlsSpacing, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tablePadding, tableScrollbarOffset, tableTextColor, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
10
|
-
import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle } from './ui-styles';
|
|
9
|
+
import { columnControlsDecorationHeight, resizeHandlerAreaWidth, resizeLineWidth, rowControlsZIndex, stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableBorderColor, tableBorderDeleteColor, tableBorderRadiusSize, tableBorderSelectedColor, tableCellBackgroundColor, tableCellDeleteColor, tableCellSelectedColor, tableControlsSpacing, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tablePadding, tableScrollbarOffset, tableTextColor, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
10
|
+
import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle } from './ui-styles';
|
|
11
11
|
const cornerControlHeight = tableToolbarSize + 1;
|
|
12
12
|
|
|
13
13
|
/*
|
|
@@ -158,6 +158,23 @@ const tableStickyHeaderColumnControlsDecorationsStyle = props => {
|
|
|
158
158
|
`;
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
+
const tableRowControlStyles = () => {
|
|
162
|
+
return getBooleanFF('platform.editor.table.drag-and-drop') ? css`
|
|
163
|
+
.${ClassName.ROW_CONTROLS_WRAPPER} {
|
|
164
|
+
position: absolute;
|
|
165
|
+
margin-top: ${tableMarginTop}px;
|
|
166
|
+
left: -${tableToolbarSize + 1}px;
|
|
167
|
+
z-index: ${rowControlsZIndex};
|
|
168
|
+
}
|
|
169
|
+
` : css`
|
|
170
|
+
.${ClassName.ROW_CONTROLS_WRAPPER} {
|
|
171
|
+
position: absolute;
|
|
172
|
+
/* top of corner control is table margin top - corner control height + 1 pixel of table border. */
|
|
173
|
+
top: ${tableMarginTop - cornerControlHeight + 1}px;
|
|
174
|
+
left: -${tableToolbarSize}px;
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
};
|
|
161
178
|
const tableWrapperStyles = () => {
|
|
162
179
|
if (getBooleanFF('platform.editor.custom-table-width')) {
|
|
163
180
|
return css`
|
|
@@ -210,6 +227,7 @@ export const tableStyles = props => {
|
|
|
210
227
|
${hoveredDeleteButton(props)};
|
|
211
228
|
${hoveredCell(props)};
|
|
212
229
|
${hoveredWarningCell};
|
|
230
|
+
${getBooleanFF('platform.editor.table.drag-and-drop') && insertLine(props)};
|
|
213
231
|
${resizeHandle(props)};
|
|
214
232
|
${rangeSelectionStyles};
|
|
215
233
|
|
|
@@ -583,6 +601,12 @@ export const tableStyles = props => {
|
|
|
583
601
|
`)}
|
|
584
602
|
}
|
|
585
603
|
|
|
604
|
+
.${ClassName.ROW_CONTROLS_WITH_DRAG} {
|
|
605
|
+
display: grid;
|
|
606
|
+
align-items: center;
|
|
607
|
+
position: absolute;
|
|
608
|
+
}
|
|
609
|
+
|
|
586
610
|
${floatingColumnControls(props)}
|
|
587
611
|
|
|
588
612
|
:not(.${ClassName.IS_RESIZING}) .${ClassName.ROW_CONTROLS} {
|
|
@@ -595,7 +619,7 @@ export const tableStyles = props => {
|
|
|
595
619
|
position: relative;
|
|
596
620
|
float: right;
|
|
597
621
|
margin-left: ${getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize : akEditorTableToolbarSize - 1}px;
|
|
598
|
-
top: ${akEditorTableToolbarSize}px;
|
|
622
|
+
top: ${getBooleanFF('platform.editor.table.drag-and-drop') ? 0 : akEditorTableToolbarSize}px;
|
|
599
623
|
width: ${akEditorTableNumberColumnWidth + 1}px;
|
|
600
624
|
box-sizing: border-box;
|
|
601
625
|
}
|
|
@@ -621,6 +645,21 @@ export const tableStyles = props => {
|
|
|
621
645
|
}
|
|
622
646
|
}
|
|
623
647
|
|
|
648
|
+
// add a background above the first numbered column cell when sticky header is engaged
|
|
649
|
+
// which hides the table when scrolling
|
|
650
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}:first-of-type::after {
|
|
651
|
+
content: '';
|
|
652
|
+
display: block;
|
|
653
|
+
height: 33px;
|
|
654
|
+
width: 100%;
|
|
655
|
+
background-color: ${"var(--ds-surface, white)"};
|
|
656
|
+
position: absolute;
|
|
657
|
+
|
|
658
|
+
// the extra pixel is accounting for borders
|
|
659
|
+
top: -34px;
|
|
660
|
+
left: -1px;
|
|
661
|
+
}
|
|
662
|
+
|
|
624
663
|
.${ClassName.WITH_CONTROLS} {
|
|
625
664
|
.${ClassName.CORNER_CONTROLS}, .${ClassName.ROW_CONTROLS} {
|
|
626
665
|
display: block;
|
|
@@ -643,10 +682,10 @@ export const tableStyles = props => {
|
|
|
643
682
|
}
|
|
644
683
|
}
|
|
645
684
|
:not(.${ClassName.IS_RESIZING}) .${ClassName.WITH_CONTROLS} {
|
|
646
|
-
.${ClassName.NUMBERED_COLUMN_BUTTON} {
|
|
685
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}:not(.${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}) {
|
|
647
686
|
cursor: pointer;
|
|
648
687
|
}
|
|
649
|
-
.${ClassName.NUMBERED_COLUMN_BUTTON}:hover {
|
|
688
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}:not(.${ClassName.NUMBERED_COLUMN_BUTTON_DISABLED}):hover {
|
|
650
689
|
border-bottom: 1px solid ${tableBorderSelectedColor(props)};
|
|
651
690
|
border-color: ${tableBorderSelectedColor(props)};
|
|
652
691
|
background-color: ${tableToolbarSelectedColor(props)};
|
|
@@ -682,6 +721,10 @@ export const tableStyles = props => {
|
|
|
682
721
|
margin-top: 0;
|
|
683
722
|
}
|
|
684
723
|
|
|
724
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG} + * {
|
|
725
|
+
margin-top: 0;
|
|
726
|
+
}
|
|
727
|
+
|
|
685
728
|
/*
|
|
686
729
|
* Headings have a top margin by default, but we don't want this on the
|
|
687
730
|
* first heading within table header cells.
|
|
@@ -755,17 +798,10 @@ export const tableStyles = props => {
|
|
|
755
798
|
}
|
|
756
799
|
}
|
|
757
800
|
}
|
|
758
|
-
|
|
759
|
-
position: absolute;
|
|
760
|
-
/* top of corner control is table margin top - corner control height + 1 pixel of table border. */
|
|
761
|
-
top: ${tableMarginTop - cornerControlHeight + 1}px;
|
|
762
|
-
}
|
|
801
|
+
${tableRowControlStyles()}
|
|
763
802
|
.${ClassName.ROW_CONTROLS_WRAPPER}.${ClassName.TABLE_LEFT_SHADOW} {
|
|
764
803
|
z-index: ${akEditorUnitZIndex};
|
|
765
804
|
}
|
|
766
|
-
.${ClassName.ROW_CONTROLS_WRAPPER} {
|
|
767
|
-
left: -${tableToolbarSize}px;
|
|
768
|
-
}
|
|
769
805
|
|
|
770
806
|
.${ClassName.COLUMN_CONTROLS_WRAPPER} {
|
|
771
807
|
position: absolute;
|
|
@@ -88,7 +88,9 @@ export const lineMarkerSize = 4;
|
|
|
88
88
|
export const columnControlsDecorationHeight = 25;
|
|
89
89
|
export const columnControlsZIndex = akEditorUnitZIndex * 10;
|
|
90
90
|
export const columnControlsSelectedZIndex = columnControlsZIndex + 1;
|
|
91
|
+
export const rowControlsZIndex = akEditorUnitZIndex * 10;
|
|
91
92
|
export const columnResizeHandleZIndex = columnControlsSelectedZIndex + 1;
|
|
93
|
+
export const insertLineWidth = 3;
|
|
92
94
|
export const resizeHandlerAreaWidth = RESIZE_HANDLE_AREA_DECORATION_GAP / 3;
|
|
93
95
|
export const resizeLineWidth = 2;
|
|
94
96
|
export const resizeHandlerZIndex = columnControlsZIndex + akRichMediaResizeZIndex;
|