@atlaskit/editor-plugin-table 22.4.1 → 22.4.3
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 +15 -0
- package/dist/cjs/nodeviews/TableCell.js +85 -8
- package/dist/cjs/nodeviews/table.js +75 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +4 -4
- package/dist/cjs/ui/common-styles.js +21 -9
- package/dist/cjs/ui/ui-styles.js +3 -2
- package/dist/es2019/nodeviews/TableCell.js +81 -8
- package/dist/es2019/nodeviews/table.js +67 -0
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +4 -4
- package/dist/es2019/ui/common-styles.js +335 -16
- package/dist/es2019/ui/ui-styles.js +4 -3
- package/dist/esm/nodeviews/TableCell.js +85 -8
- package/dist/esm/nodeviews/table.js +75 -0
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +4 -4
- package/dist/esm/ui/common-styles.js +21 -9
- package/dist/esm/ui/ui-styles.js +3 -2
- package/dist/types/nodeviews/TableCell.d.ts +12 -0
- package/dist/types/nodeviews/table.d.ts +4 -1
- package/dist/types-ts4.5/nodeviews/TableCell.d.ts +12 -0
- package/dist/types-ts4.5/nodeviews/table.d.ts +4 -1
- package/package.json +3 -3
package/dist/cjs/ui/ui-styles.js
CHANGED
|
@@ -9,6 +9,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
13
|
var _types = require("../types");
|
|
13
14
|
var _consts = require("./consts");
|
|
14
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22;
|
|
@@ -132,10 +133,10 @@ var columnControlsDecoration = exports.columnControlsDecoration = function colum
|
|
|
132
133
|
return (0, _react.css)(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n\t\t.", " {\n\t\t\tdisplay: none;\n\t\t\tcursor: pointer;\n\t\t\tposition: absolute;\n\t\t\twidth: 100%;\n\t\t\tleft: 0;\n\t\t\ttop: -", "px;\n\t\t\theight: ", "px;\n\t\t\t/* floating dot for adding column button */\n\t\t\t&::before {\n\t\t\t\tcontent: ' ';\n\t\t\t\tbackground-color: ", ";\n\t\t\t\tposition: absolute;\n\t\t\t\theight: ", "px;\n\t\t\t\twidth: ", "px;\n\t\t\t\tborder-radius: 50%;\n\t\t\t\tpointer-events: none;\n\t\t\t\ttop: 2px;\n\t\t\t\tright: ", ";\n\t\t\t}\n\n\t\t\t&::after {\n\t\t\t\tcontent: ' ';\n\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t/* floating dot for adding column button - overriding style on last column to avoid scroll */\n\t\t", "\n\n\t\t.", " .", " {\n\t\t\tdisplay: block;\n\t\t}\n\n\t\ttable\n\t\t\ttr:first-of-type\n\t\t\ttd.", ",table\n\t\t\ttr:first-of-type\n\t\t\tth.", " {\n\t\t\t&.", ", &.", " {\n\t\t\t\t.", "::after {\n\t\t\t\t\t", ";\n\t\t\t\t}\n\n\t\t\t\t&.", " .", "::after {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\tborder-color: ", ";\n\t\t\t\t\tz-index: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttable\n\t\t\ttr:first-of-type\n\t\t\ttd.", ",table\n\t\t\ttr:first-of-type\n\t\t\tth.", " {\n\t\t\t&.", ", &.", " {\n\t\t\t\t.", "::after {\n\t\t\t\t\t", ";\n\t\t\t\t\tborder-left: ", "px solid ", ";\n\t\t\t\t\tleft: -", "px;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttable\n\t\t\ttr:first-of-type\n\t\t\ttd.", ",\n\t\t\ttable\n\t\t\ttr:first-of-type\n\t\t\tth.", " {\n\t\t\t&.", " {\n\t\t\t\t.", "::after {\n\t\t\t\t\t", ";\n\t\t\t\t}\n\n\t\t\t\t&.", " .", "::after {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\tborder-color: ", ";\n\t\t\t\t\tborder-left: ", "px solid ", ";\n\t\t\t\t\tleft: -", "px;\n\t\t\t\t\tz-index: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t.", "\n\t\t\ttable\n\t\t\ttr:first-of-type\n\t\t\ttd.", ",\n\t\t\t.", "\n\t\t\ttable\n\t\t\ttr:first-of-type\n\t\t\tth.", " {\n\t\t\t.", "::after {\n\t\t\t\t", ";\n\t\t\t}\n\t\t}\n\t"])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _consts.columnControlsDecorationHeight + _styles.tableCellBorderWidth, _consts.columnControlsDecorationHeight, _consts.tableBorderColor, _consts.lineMarkerSize, _consts.lineMarkerSize, "var(--ds-space-negative-025, -2px)", columnHeaderButton("\n border-right: ".concat(_styles.tableCellBorderWidth, "px solid ").concat(_consts.tableBorderColor, ";\n border-top: ").concat(_styles.tableCellBorderWidth, "px solid ").concat(_consts.tableBorderColor, ";\n border-bottom: ").concat(_styles.tableCellBorderWidth, "px solid ").concat(_consts.tableBorderColor, ";\n box-sizing: content-box;\n height: ").concat(_consts.tableToolbarSize - 1, "px;\n width: 100%;\n position: absolute;\n top: ").concat(_consts.columnControlsDecorationHeight - _consts.tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(_consts.columnControlsZIndex, ";\n ")), getFloatingDotOverrides(), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_TABLE, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _consts.tableToolbarDeleteColor, _consts.tableBorderDeleteColor, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(), _styles.tableCellBorderWidth, _consts.tableBorderSelectedColor, _styles.tableCellBorderWidth, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _consts.tableToolbarDeleteColor, _consts.tableBorderDeleteColor, _styles.tableCellBorderWidth, _consts.tableBorderDeleteColor, _styles.tableCellBorderWidth, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected());
|
|
133
134
|
};
|
|
134
135
|
var hoveredDeleteButton = exports.hoveredDeleteButton = function hoveredDeleteButton() {
|
|
135
|
-
return (0, _react.css)(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n\t.", ".", " {\n\t\t.", ", .", ", .", " {\n\t\t\
|
|
136
|
+
return (0, _react.css)(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n\t.", ".", " {\n\t\t.", ", .", ", .", " {\n\t\t\t", "\n\t\t}\n\t\t.", "::after {\n\t\t\tbackground: ", ";\n\t\t}\n\n\t\t.", " > table {\n\t\t\ttd.", "::after {\n\t\t\t\tbackground: ", ";\n\t\t\t\tborder: 1px solid ", ";\n\t\t\t}\n\t\t\tth.", " {\n\t\t\t\tbackground-color: unset;\n\t\t\t}\n\t\t\tth.", "::after {\n\t\t\t\tbackground: ", ";\n\t\t\t\tborder: 1px solid ", ";\n\t\t\t}\n\t\t}\n\t}\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_CELL, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? '' /* Cell borders handled by ::after overlay in rounded mode. */ : "border: 1px solid ".concat(_consts.tableBorderDeleteColor, ";"), _types.TableCssClassName.SELECTED_CELL, _consts.tableCellDeleteColor, _types.TableCssClassName.TABLE_NODE_WRAPPER, _types.TableCssClassName.HOVERED_NO_HIGHLIGHT, _consts.tableCellDeleteColor, _consts.tableBorderDeleteColor, _types.TableCssClassName.HOVERED_NO_HIGHLIGHT, _types.TableCssClassName.HOVERED_NO_HIGHLIGHT, _consts.tableCellDeleteColor, _consts.tableBorderDeleteColor);
|
|
136
137
|
};
|
|
137
138
|
var hoveredCell = exports.hoveredCell = function hoveredCell() {
|
|
138
|
-
return (0, _react.css)(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n\t:not(.", ")\n\t\t.", ":not(.", ") {\n\t\t.", " {\n\t\t\tposition: relative;\n\t\t\
|
|
139
|
+
return (0, _react.css)(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n\t:not(.", ")\n\t\t.", ":not(.", ") {\n\t\t.", " {\n\t\t\tposition: relative;\n\t\t\t", "\n\t\t}\n\t\t.", ".", " {\n\t\t\tposition: relative;\n\t\t\t", "\n\t\t}\n\t}\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? '' /* Cell borders handled by ::after overlay in rounded mode. */ : "border: 1px solid ".concat(_consts.tableBorderSelectedColor, ";"), _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.HOVERED_NO_HIGHLIGHT, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? '' /* Cell borders handled by ::after overlay in rounded mode. */ : "border: 1px solid ".concat(_consts.tableBorderColor, ";"));
|
|
139
140
|
};
|
|
140
141
|
|
|
141
142
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { TableMap } from '@atlaskit/editor-tables';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
6
|
import TableNodeView from './TableNodeViewBase';
|
|
5
7
|
const DEFAULT_COL_SPAN = 1;
|
|
6
8
|
const DEFAULT_ROW_SPAN = 1;
|
|
@@ -28,6 +30,22 @@ const cssVariablePattern = /^VAR\(--.*\)$/;
|
|
|
28
30
|
export default class TableCell extends TableNodeView {
|
|
29
31
|
constructor(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
|
|
30
32
|
super(node, view, getPos, eventDispatcher);
|
|
33
|
+
/** Cached edge state to avoid redundant DOM writes. */
|
|
34
|
+
_defineProperty(this, "prevReachesTop", false);
|
|
35
|
+
_defineProperty(this, "prevReachesBottom", false);
|
|
36
|
+
_defineProperty(this, "prevReachesLeft", false);
|
|
37
|
+
_defineProperty(this, "prevReachesRight", false);
|
|
38
|
+
_defineProperty(this, "destroy", () => {
|
|
39
|
+
if (this.delayHandle && typeof window !== 'undefined') {
|
|
40
|
+
var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
|
|
41
|
+
// eslint-disable-next-line compat/compat
|
|
42
|
+
(_window = window) === null || _window === void 0 ? void 0 : (_window$cancelIdleCal = _window.cancelIdleCallback) === null || _window$cancelIdleCal === void 0 ? void 0 : _window$cancelIdleCal.call(_window, this.delayHandle);
|
|
43
|
+
(_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$cancelAnimat = _window2.cancelAnimationFrame) === null || _window2$cancelAnimat === void 0 ? void 0 : _window2$cancelAnimat.call(_window2, this.delayHandle);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
47
|
+
this.updateTableEdgeAttrs(node);
|
|
48
|
+
}
|
|
31
49
|
|
|
32
50
|
// CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
|
|
33
51
|
// Obviously design tokens can't be inverted and so it would result in `VAR(--DS-BACKGROUND-ACCENT-GRAY-SUBTLEST, #F4F5F7)`
|
|
@@ -39,14 +57,6 @@ export default class TableCell extends TableNodeView {
|
|
|
39
57
|
// This is a workaround to fix those cases on the fly. Note it is super specific on purpose
|
|
40
58
|
// so that it just fixes the heading token (other tokens should be unaffected)
|
|
41
59
|
// At some point in the future
|
|
42
|
-
_defineProperty(this, "destroy", () => {
|
|
43
|
-
if (this.delayHandle && typeof window !== 'undefined') {
|
|
44
|
-
var _window, _window$cancelIdleCal, _window2, _window2$cancelAnimat;
|
|
45
|
-
// eslint-disable-next-line compat/compat
|
|
46
|
-
(_window = window) === null || _window === void 0 ? void 0 : (_window$cancelIdleCal = _window.cancelIdleCallback) === null || _window$cancelIdleCal === void 0 ? void 0 : _window$cancelIdleCal.call(_window, this.delayHandle);
|
|
47
|
-
(_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$cancelAnimat = _window2.cancelAnimationFrame) === null || _window2$cancelAnimat === void 0 ? void 0 : _window2$cancelAnimat.call(_window2, this.delayHandle);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
60
|
if (cssVariablePattern.test(node.attrs.background)) {
|
|
51
61
|
this.delayHandle = delayUntilIdle(() => {
|
|
52
62
|
const pos = getPos();
|
|
@@ -73,6 +83,66 @@ export default class TableCell extends TableNodeView {
|
|
|
73
83
|
}
|
|
74
84
|
return didUpdate;
|
|
75
85
|
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Detects whether this cell visually reaches the bottom or right edge of the table
|
|
89
|
+
* (accounting for rowspan/colspan) and sets data attributes so CSS can apply
|
|
90
|
+
* rounded corners and transparent borders to merged cells that span to the table edges.
|
|
91
|
+
*/
|
|
92
|
+
updateTableEdgeAttrs(node) {
|
|
93
|
+
const pos = this.getPos();
|
|
94
|
+
if (pos === undefined) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const resolvedPos = this.view.state.doc.resolve(pos);
|
|
99
|
+
|
|
100
|
+
// Cell → row → table: depth-1 is the table, depth is the row
|
|
101
|
+
const tableDepth = resolvedPos.depth - 1;
|
|
102
|
+
const rowDepth = resolvedPos.depth;
|
|
103
|
+
if (tableDepth < 0 || rowDepth < 0) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const tableNode = resolvedPos.node(tableDepth);
|
|
107
|
+
if (tableNode.type.name !== 'table') {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const tableMap = TableMap.get(tableNode);
|
|
111
|
+
const cellStartInTable = pos - resolvedPos.start(tableDepth);
|
|
112
|
+
const cellRect = tableMap.findCell(cellStartInTable);
|
|
113
|
+
const reachesTop = cellRect.top === 0;
|
|
114
|
+
const reachesBottom = cellRect.bottom >= tableMap.height;
|
|
115
|
+
const reachesLeft = cellRect.left === 0;
|
|
116
|
+
const reachesRight = cellRect.right >= tableMap.width;
|
|
117
|
+
|
|
118
|
+
// Only touch DOM attributes that actually changed
|
|
119
|
+
if (reachesTop !== this.prevReachesTop) {
|
|
120
|
+
this.prevReachesTop = reachesTop;
|
|
121
|
+
this.setDataAttr('data-reaches-top', reachesTop);
|
|
122
|
+
}
|
|
123
|
+
if (reachesBottom !== this.prevReachesBottom) {
|
|
124
|
+
this.prevReachesBottom = reachesBottom;
|
|
125
|
+
this.setDataAttr('data-reaches-bottom', reachesBottom);
|
|
126
|
+
}
|
|
127
|
+
if (reachesLeft !== this.prevReachesLeft) {
|
|
128
|
+
this.prevReachesLeft = reachesLeft;
|
|
129
|
+
this.setDataAttr('data-reaches-left', reachesLeft);
|
|
130
|
+
}
|
|
131
|
+
if (reachesRight !== this.prevReachesRight) {
|
|
132
|
+
this.prevReachesRight = reachesRight;
|
|
133
|
+
this.setDataAttr('data-reaches-right', reachesRight);
|
|
134
|
+
}
|
|
135
|
+
} catch {
|
|
136
|
+
// Position may be stale during document mutations; silently ignore.
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
setDataAttr(attr, value) {
|
|
140
|
+
if (value) {
|
|
141
|
+
this.dom.setAttribute(attr, 'true');
|
|
142
|
+
} else {
|
|
143
|
+
this.dom.removeAttribute(attr);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
76
146
|
updateNodeView(node) {
|
|
77
147
|
if (this.node.type !== node.type) {
|
|
78
148
|
return false;
|
|
@@ -96,6 +166,9 @@ export default class TableCell extends TableNodeView {
|
|
|
96
166
|
if (addedAttrs.length || removedAttrs.length) {
|
|
97
167
|
addedAttrs.forEach(([key, value]) => this.dom.setAttribute(key, value || ''));
|
|
98
168
|
removedAttrs.forEach(key => this.dom.removeAttribute(key));
|
|
169
|
+
if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
170
|
+
this.updateTableEdgeAttrs(node);
|
|
171
|
+
}
|
|
99
172
|
return true;
|
|
100
173
|
}
|
|
101
174
|
|
|
@@ -47,6 +47,35 @@ const handleInlineTableWidth = (table, width) => {
|
|
|
47
47
|
}
|
|
48
48
|
table.style.setProperty('width', `${width}px`);
|
|
49
49
|
};
|
|
50
|
+
const setDataAttr = (cell, attr, value) => {
|
|
51
|
+
const hasAttr = cell.hasAttribute(attr);
|
|
52
|
+
if (value && !hasAttr) {
|
|
53
|
+
cell.setAttribute(attr, 'true');
|
|
54
|
+
} else if (!value && hasAttr) {
|
|
55
|
+
cell.removeAttribute(attr);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const refreshRoundedTableEdgeAttrs = (table, tableNode) => {
|
|
59
|
+
try {
|
|
60
|
+
const tableMap = TableMap.get(tableNode);
|
|
61
|
+
const cells = Array.from(table.rows).flatMap(row => Array.from(row.cells));
|
|
62
|
+
const cellOffsets = Array.from(new Set(tableMap.map));
|
|
63
|
+
cellOffsets.forEach((cellOffset, cellIndex) => {
|
|
64
|
+
const cell = cells[cellIndex];
|
|
65
|
+
if (!cell) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const cellRect = tableMap.findCell(cellOffset);
|
|
69
|
+
setDataAttr(cell, 'data-reaches-top', cellRect.top === 0);
|
|
70
|
+
setDataAttr(cell, 'data-reaches-bottom', cellRect.bottom >= tableMap.height);
|
|
71
|
+
setDataAttr(cell, 'data-reaches-left', cellRect.left === 0);
|
|
72
|
+
setDataAttr(cell, 'data-reaches-right', cellRect.right >= tableMap.width);
|
|
73
|
+
});
|
|
74
|
+
} catch {
|
|
75
|
+
// Table structure can be transient while ProseMirror normalises transactions.
|
|
76
|
+
// Keep existing edge attrs if the current shape cannot be mapped safely.
|
|
77
|
+
}
|
|
78
|
+
};
|
|
50
79
|
export default class TableView extends ReactNodeView {
|
|
51
80
|
constructor(props) {
|
|
52
81
|
super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined,
|
|
@@ -214,6 +243,40 @@ export default class TableView extends ReactNodeView {
|
|
|
214
243
|
}
|
|
215
244
|
}
|
|
216
245
|
}
|
|
246
|
+
// Each TableCell node view refreshes its own edge attrs when its cell attrs change.
|
|
247
|
+
// However, when the table's shape changes (e.g. a new row is inserted below the
|
|
248
|
+
// last row), ProseMirror may reuse the existing neighbouring cells as-is, so those
|
|
249
|
+
// cells never get a chance to update their edge attrs on their own.
|
|
250
|
+
//
|
|
251
|
+
// To cover those cases, we refresh edge attrs from the table node view here.
|
|
252
|
+
//
|
|
253
|
+
// The refresh runs on the next animation frame because ReactNodeView.update()
|
|
254
|
+
// schedules the table's React render via the portal provider. If we read
|
|
255
|
+
// `this.table.rows` synchronously, we'd still see the previous DOM.
|
|
256
|
+
scheduleRoundedTableEdgeRefresh(node) {
|
|
257
|
+
if (this.roundedTableEdgeRefreshHandle !== undefined) {
|
|
258
|
+
cancelAnimationFrame(this.roundedTableEdgeRefreshHandle);
|
|
259
|
+
}
|
|
260
|
+
this.roundedTableEdgeRefreshHandle = requestAnimationFrame(() => {
|
|
261
|
+
this.roundedTableEdgeRefreshHandle = undefined;
|
|
262
|
+
if (this.table instanceof HTMLTableElement) {
|
|
263
|
+
refreshRoundedTableEdgeAttrs(this.table, node);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
update(node, decorations, innerDecorations, validUpdate) {
|
|
268
|
+
if (!expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
269
|
+
return super.update(node, decorations, innerDecorations, validUpdate);
|
|
270
|
+
}
|
|
271
|
+
const currentTableMap = TableMap.get(this.node);
|
|
272
|
+
const nextTableMap = TableMap.get(node);
|
|
273
|
+
const tableGeometryChanged = currentTableMap.width !== nextTableMap.width || currentTableMap.height !== nextTableMap.height;
|
|
274
|
+
const didUpdate = super.update(node, decorations, innerDecorations, validUpdate);
|
|
275
|
+
if (didUpdate && tableGeometryChanged) {
|
|
276
|
+
this.scheduleRoundedTableEdgeRefresh(node);
|
|
277
|
+
}
|
|
278
|
+
return didUpdate;
|
|
279
|
+
}
|
|
217
280
|
render(props, forwardRef) {
|
|
218
281
|
return /*#__PURE__*/React.createElement(TableComponentWithSharedState, {
|
|
219
282
|
forwardRef: forwardRef,
|
|
@@ -287,6 +350,10 @@ export default class TableView extends ReactNodeView {
|
|
|
287
350
|
}
|
|
288
351
|
destroy() {
|
|
289
352
|
var _this$eventDispatcher;
|
|
353
|
+
if (this.roundedTableEdgeRefreshHandle !== undefined) {
|
|
354
|
+
cancelAnimationFrame(this.roundedTableEdgeRefreshHandle);
|
|
355
|
+
this.roundedTableEdgeRefreshHandle = undefined;
|
|
356
|
+
}
|
|
290
357
|
if (this.resizeObserver) {
|
|
291
358
|
this.resizeObserver.disconnect();
|
|
292
359
|
}
|
|
@@ -60,9 +60,9 @@ export default class NumberColumn extends Component {
|
|
|
60
60
|
style: {
|
|
61
61
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
62
62
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
|
|
63
|
-
borderLeft:
|
|
63
|
+
borderLeft: isDragAndDropEnabled && tableActive && !expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)
|
|
64
64
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
65
|
-
|
|
65
|
+
? `1px solid ${tableBorderColor}` : undefined,
|
|
66
66
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
67
67
|
visibility: 'hidden' // Ensure the column is not visible during SSR
|
|
68
68
|
},
|
|
@@ -75,9 +75,9 @@ export default class NumberColumn extends Component {
|
|
|
75
75
|
style: {
|
|
76
76
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
77
77
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
|
|
78
|
-
borderLeft:
|
|
78
|
+
borderLeft: isDragAndDropEnabled && tableActive && !expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)
|
|
79
79
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
80
|
-
|
|
80
|
+
? `1px solid ${tableBorderColor}` : undefined,
|
|
81
81
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
82
82
|
visibility: 'visible'
|
|
83
83
|
},
|
|
@@ -218,22 +218,342 @@ const tableStickyHeaderFirefoxFixStyle = () => {
|
|
|
218
218
|
`;
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
221
|
+
const roundedTableCellCornerStyles = () => css`
|
|
222
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table {
|
|
223
|
+
/* Round table corner cells (including merged cells that span to the edge)
|
|
224
|
+
and their interaction overlays. The data-reaches-* attributes are set by the
|
|
225
|
+
TableCell node view based on each cell's position + rowspan/colspan. */
|
|
226
|
+
> tbody > tr > td[data-reaches-top][data-reaches-left],
|
|
227
|
+
> tbody > tr > th[data-reaches-top][data-reaches-left] {
|
|
228
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
229
|
+
|
|
230
|
+
&::after,
|
|
231
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}::after,
|
|
232
|
+
&.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
|
|
233
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
> tbody > tr > td[data-reaches-top][data-reaches-right],
|
|
238
|
+
> tbody > tr > th[data-reaches-top][data-reaches-right] {
|
|
239
|
+
border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
240
|
+
|
|
241
|
+
&::after,
|
|
242
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}::after,
|
|
243
|
+
&.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
|
|
244
|
+
border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
> tbody > tr > td[data-reaches-bottom][data-reaches-left],
|
|
249
|
+
> tbody > tr > th[data-reaches-bottom][data-reaches-left] {
|
|
250
|
+
border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
251
|
+
|
|
252
|
+
&::after,
|
|
253
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}::after,
|
|
254
|
+
&.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
|
|
255
|
+
border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
> tbody > tr > td[data-reaches-bottom][data-reaches-right],
|
|
260
|
+
> tbody > tr > th[data-reaches-bottom][data-reaches-right] {
|
|
261
|
+
border-bottom-right-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
262
|
+
|
|
263
|
+
&::after,
|
|
264
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}::after,
|
|
265
|
+
&.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
|
|
266
|
+
border-bottom-right-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
const roundedTableInteractionOverlayStyles = () => css`
|
|
272
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table {
|
|
273
|
+
/* Active-cell highlight base properties (replaces activeCellHighlightStyles).
|
|
274
|
+
width/height: auto overrides the base cell ::after which uses width: 100%; height: 100%,
|
|
275
|
+
so that left/right/top/bottom determine the size instead. */
|
|
276
|
+
td.${ClassName.TABLE_CELL}.${ClassName.ACTIVE_CURSOR_CELL}::after,
|
|
277
|
+
th.${ClassName.TABLE_HEADER_CELL}.${ClassName.ACTIVE_CURSOR_CELL}::after {
|
|
278
|
+
border: 1px solid ${"var(--ds-border-selected, #1868DB)"};
|
|
279
|
+
box-shadow: ${"var(--ds-shadow-raised, 0px 1px 1px #1E1F2140, 0px 0px 1px #1E1F214f)"};
|
|
280
|
+
content: '';
|
|
281
|
+
position: absolute;
|
|
282
|
+
top: -1px;
|
|
283
|
+
left: -1px;
|
|
284
|
+
right: -1px;
|
|
285
|
+
bottom: -1px;
|
|
286
|
+
width: auto;
|
|
287
|
+
height: auto;
|
|
288
|
+
z-index: ${akEditorSmallZIndex};
|
|
289
|
+
pointer-events: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* Normalize selected/hover/danger overlays to the same box model as active-cell.
|
|
293
|
+
width/height: auto overrides the base cell ::after which uses width: 100%; height: 100%. */
|
|
294
|
+
td.${ClassName.HOVERED_CELL}::after,
|
|
295
|
+
td.${ClassName.SELECTED_CELL}::after,
|
|
296
|
+
th.${ClassName.TABLE_HEADER_CELL}.${ClassName.SELECTED_CELL}::after,
|
|
297
|
+
th.${ClassName.TABLE_HEADER_CELL}.${ClassName.HOVERED_CELL}::after,
|
|
298
|
+
th.${ClassName.TABLE_HEADER_CELL}.${ClassName.HOVERED_CELL_IN_DANGER}::after,
|
|
299
|
+
td.${ClassName.TABLE_CELL}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
|
|
300
|
+
left: -1px;
|
|
301
|
+
right: -1px;
|
|
302
|
+
top: -1px;
|
|
303
|
+
bottom: -1px;
|
|
304
|
+
width: auto;
|
|
305
|
+
height: auto;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/* Active-cell overlays: clamp outer sides using data-reaches-* attributes.
|
|
309
|
+
Internal sides keep -1px overlap; true outer edges are clamped to 0. */
|
|
310
|
+
> tbody > tr > td[data-reaches-top].${ClassName.ACTIVE_CURSOR_CELL}::after,
|
|
311
|
+
> tbody > tr > th[data-reaches-top].${ClassName.ACTIVE_CURSOR_CELL}::after {
|
|
312
|
+
top: 0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
> tbody > tr > td[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL}::after,
|
|
316
|
+
> tbody > tr > th[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL}::after {
|
|
317
|
+
left: 0;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
> tbody > tr > td[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL}::after,
|
|
321
|
+
> tbody > tr > th[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL}::after {
|
|
322
|
+
right: 0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
> tbody > tr > td[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL}::after,
|
|
326
|
+
> tbody > tr > th[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL}::after {
|
|
327
|
+
bottom: 0;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/* Selected/hover/active overlays: clamp outer left side and draw overlay border. */
|
|
331
|
+
> tbody > tr > td[data-reaches-left].${ClassName.SELECTED_CELL},
|
|
332
|
+
> tbody > tr > th[data-reaches-left].${ClassName.SELECTED_CELL},
|
|
333
|
+
> tbody > tr > td[data-reaches-left].${ClassName.HOVERED_CELL},
|
|
334
|
+
> tbody > tr > th[data-reaches-left].${ClassName.HOVERED_CELL},
|
|
335
|
+
> tbody > tr > td[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL},
|
|
336
|
+
> tbody > tr > th[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL} {
|
|
337
|
+
border-left-color: transparent;
|
|
338
|
+
|
|
339
|
+
&::after {
|
|
340
|
+
left: 0;
|
|
341
|
+
border-left-color: ${tableBorderSelectedColor};
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* Danger/delete overlays: clamp outer left side. */
|
|
346
|
+
> tbody > tr > td[data-reaches-left].${ClassName.HOVERED_CELL_IN_DANGER},
|
|
347
|
+
> tbody > tr > th[data-reaches-left].${ClassName.HOVERED_CELL_IN_DANGER} {
|
|
348
|
+
border-left-color: transparent;
|
|
349
|
+
|
|
350
|
+
&::after {
|
|
351
|
+
left: 0;
|
|
352
|
+
border-left-color: ${tableBorderDeleteColor};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/* Selected/hover/active overlays: clamp outer right side. */
|
|
357
|
+
> tbody > tr > td[data-reaches-right].${ClassName.SELECTED_CELL},
|
|
358
|
+
> tbody > tr > th[data-reaches-right].${ClassName.SELECTED_CELL},
|
|
359
|
+
> tbody > tr > td[data-reaches-right].${ClassName.HOVERED_CELL},
|
|
360
|
+
> tbody > tr > th[data-reaches-right].${ClassName.HOVERED_CELL},
|
|
361
|
+
> tbody > tr > td[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL},
|
|
362
|
+
> tbody > tr > th[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL} {
|
|
363
|
+
border-right-color: transparent;
|
|
364
|
+
|
|
365
|
+
&::after {
|
|
366
|
+
right: 0;
|
|
367
|
+
border-right-color: ${tableBorderSelectedColor};
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/* Danger/delete overlays: clamp outer right side. */
|
|
372
|
+
> tbody > tr > td[data-reaches-right].${ClassName.HOVERED_CELL_IN_DANGER},
|
|
373
|
+
> tbody > tr > th[data-reaches-right].${ClassName.HOVERED_CELL_IN_DANGER} {
|
|
374
|
+
border-right-color: transparent;
|
|
375
|
+
|
|
376
|
+
&::after {
|
|
377
|
+
right: 0;
|
|
378
|
+
border-right-color: ${tableBorderDeleteColor};
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* Selected/hover/active overlays: clamp outer bottom side. */
|
|
383
|
+
> tbody > tr > td[data-reaches-bottom].${ClassName.SELECTED_CELL},
|
|
384
|
+
> tbody > tr > th[data-reaches-bottom].${ClassName.SELECTED_CELL},
|
|
385
|
+
> tbody > tr > td[data-reaches-bottom].${ClassName.HOVERED_CELL},
|
|
386
|
+
> tbody > tr > th[data-reaches-bottom].${ClassName.HOVERED_CELL},
|
|
387
|
+
> tbody > tr > td[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL},
|
|
388
|
+
> tbody > tr > th[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL} {
|
|
389
|
+
border-bottom-color: transparent;
|
|
390
|
+
|
|
391
|
+
&::after {
|
|
392
|
+
border-bottom-color: ${tableBorderSelectedColor};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/* Danger/delete overlays: clamp outer bottom side. */
|
|
397
|
+
> tbody > tr > td[data-reaches-bottom].${ClassName.HOVERED_CELL_IN_DANGER},
|
|
398
|
+
> tbody > tr > th[data-reaches-bottom].${ClassName.HOVERED_CELL_IN_DANGER} {
|
|
399
|
+
border-bottom-color: transparent;
|
|
400
|
+
|
|
401
|
+
&::after {
|
|
402
|
+
border-bottom-color: ${tableBorderDeleteColor};
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
`;
|
|
407
|
+
const roundedTableNumberedColumnStyles = () => css`
|
|
408
|
+
/* Numbered columns are separate, so they need their own rounded edge owner. */
|
|
409
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
|
|
410
|
+
/* Override the inline/container left border and replace it with one rounded pseudo-border. */
|
|
411
|
+
> .${ClassName.ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN},
|
|
412
|
+
> .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN} {
|
|
413
|
+
position: relative;
|
|
414
|
+
border-left: 0;
|
|
415
|
+
|
|
416
|
+
&::before {
|
|
228
417
|
content: '';
|
|
229
418
|
position: absolute;
|
|
230
|
-
|
|
231
|
-
|
|
419
|
+
top: 0;
|
|
420
|
+
left: 0;
|
|
421
|
+
bottom: 0;
|
|
422
|
+
width: 100%;
|
|
423
|
+
border-left: 1px solid ${tableBorderColor};
|
|
424
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
425
|
+
border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
232
426
|
pointer-events: none;
|
|
427
|
+
z-index: ${akEditorUnitZIndex};
|
|
233
428
|
}
|
|
234
429
|
}
|
|
235
|
-
|
|
236
|
-
|
|
430
|
+
|
|
431
|
+
/* Prevent individual number buttons from drawing a straight left border. */
|
|
432
|
+
> .${ClassName.ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON},
|
|
433
|
+
> .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON} {
|
|
434
|
+
border-left-color: transparent;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
> .${ClassName.ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER},
|
|
438
|
+
> .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER},
|
|
439
|
+
> .${ClassName.ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE},
|
|
440
|
+
> .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE},
|
|
441
|
+
> .${ClassName.ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON}.active,
|
|
442
|
+
> .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN_BUTTON}.active {
|
|
443
|
+
border-left-color: transparent;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* When numbered column is present, the visual left edge belongs to the number column widget.
|
|
447
|
+
Zero out any left-side border-radius on the cell and its overlays/pseudo-borders —
|
|
448
|
+
but leave right-side radii untouched so right-edge cells still round correctly. */
|
|
449
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table > tbody > tr > th[data-reaches-top][data-reaches-left],
|
|
450
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table > tbody > tr > td[data-reaches-top][data-reaches-left] {
|
|
451
|
+
border-top-left-radius: 0;
|
|
452
|
+
|
|
453
|
+
&::after,
|
|
454
|
+
&::before {
|
|
455
|
+
border-top-left-radius: 0;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table > tbody > tr > th[data-reaches-bottom][data-reaches-left],
|
|
460
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table > tbody > tr > td[data-reaches-bottom][data-reaches-left] {
|
|
461
|
+
border-bottom-left-radius: 0;
|
|
462
|
+
|
|
463
|
+
&::after,
|
|
464
|
+
&::before {
|
|
465
|
+
border-bottom-left-radius: 0;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/* Preserve rounded numbered-column corners across normal, active, and danger states. */
|
|
470
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
|
|
471
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}:last-of-type {
|
|
475
|
+
border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:first-of-type,
|
|
479
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE}:first-of-type,
|
|
480
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.active:first-of-type {
|
|
481
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:last-of-type,
|
|
485
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE}:last-of-type,
|
|
486
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.active:last-of-type {
|
|
487
|
+
border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:first-of-type::after {
|
|
491
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:last-of-type::after {
|
|
495
|
+
border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/* Sticky numbered-column mask also needs the same top-left radius. */
|
|
499
|
+
.${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr th[data-reaches-top][data-reaches-left]::before {
|
|
500
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
`;
|
|
504
|
+
const roundedTableStickyHeaderStyles = () => css`
|
|
505
|
+
/* Sticky header rows have independent border/shadow/mask painting, so patch the sticky-only painters too. */
|
|
506
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table > tbody > tr.${ClassName.NATIVE_STICKY},
|
|
507
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table.${ClassName.TABLE_STICKY} > tbody > tr.sticky {
|
|
508
|
+
> th[data-reaches-left],
|
|
509
|
+
> td[data-reaches-left] {
|
|
510
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
511
|
+
|
|
512
|
+
&::after,
|
|
513
|
+
&::before {
|
|
514
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
> td[data-reaches-right],
|
|
519
|
+
> th[data-reaches-right] {
|
|
520
|
+
border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
521
|
+
|
|
522
|
+
&::after,
|
|
523
|
+
&::before {
|
|
524
|
+
border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
530
|
+
border-left-color: transparent;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr th[data-reaches-top][data-reaches-left]::before,
|
|
534
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr.${ClassName.NATIVE_STICKY} th[data-reaches-left]::before,
|
|
535
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} .${ClassName.NATIVE_STICKY_ACTIVE} th[data-reaches-left]::before {
|
|
536
|
+
border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
|
|
537
|
+
clip-path: inset(0 0 0 0 round ${"var(--ds-radius-medium, 6px)"} 0 0 0);
|
|
538
|
+
box-shadow: none !important;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table > tbody > tr.${ClassName.NATIVE_STICKY},
|
|
542
|
+
.${ClassName.TABLE_NODE_WRAPPER} > table.${ClassName.TABLE_STICKY} > tbody > tr.sticky {
|
|
543
|
+
box-shadow: none !important;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}:has(tr.sticky) .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
|
|
547
|
+
box-shadow: none !important;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
`;
|
|
551
|
+
const roundedTableOverrides = () => css`
|
|
552
|
+
${roundedTableCellCornerStyles()}
|
|
553
|
+
${roundedTableInteractionOverlayStyles()}
|
|
554
|
+
${roundedTableNumberedColumnStyles()}
|
|
555
|
+
${roundedTableStickyHeaderStyles()}
|
|
556
|
+
`;
|
|
237
557
|
const baseTableStylesWithoutSharedStyle = props => css`
|
|
238
558
|
${columnControlsLineMarker()};
|
|
239
559
|
${hoveredDeleteButton()};
|
|
@@ -1080,7 +1400,7 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
1080
1400
|
pointer-events: none;
|
|
1081
1401
|
}
|
|
1082
1402
|
.${ClassName.SELECTED_CELL} {
|
|
1083
|
-
border: 1px solid ${tableBorderSelectedColor}
|
|
1403
|
+
${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? '' /* Cell borders handled by ::after overlay in rounded mode. */ : `border: 1px solid ${tableBorderSelectedColor};`}
|
|
1084
1404
|
}
|
|
1085
1405
|
.${ClassName.SELECTED_CELL}::after {
|
|
1086
1406
|
background: ${tableCellSelectedColor};
|
|
@@ -1089,8 +1409,8 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
1089
1409
|
/* Override border colors for danger state */
|
|
1090
1410
|
th.${ClassName.TABLE_HEADER_CELL}.${ClassName.HOVERED_CELL_IN_DANGER},
|
|
1091
1411
|
td.${ClassName.TABLE_CELL}.${ClassName.HOVERED_CELL_IN_DANGER} {
|
|
1092
|
-
border-left-color: ${tableBorderDeleteColor};
|
|
1093
|
-
border-top-color: ${tableBorderDeleteColor}
|
|
1412
|
+
${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? '' /* Cell border colors are handled by the ::after overlay in rounded mode. */ : `border-left-color: ${tableBorderDeleteColor};
|
|
1413
|
+
border-top-color: ${tableBorderDeleteColor};`}
|
|
1094
1414
|
&::after {
|
|
1095
1415
|
height: 100%;
|
|
1096
1416
|
width: 100%;
|
|
@@ -1137,8 +1457,7 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
1137
1457
|
}
|
|
1138
1458
|
}
|
|
1139
1459
|
|
|
1140
|
-
|
|
1141
|
-
${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? activeCellHighlightStyles() : ''}
|
|
1460
|
+
${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableOverrides() : ''}
|
|
1142
1461
|
|
|
1143
1462
|
/* override for DnD controls */
|
|
1144
1463
|
.${ClassName.DRAG_ROW_CONTROLS_WRAPPER} {
|