@atlaskit/editor-plugin-table 7.10.1 → 7.11.0
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 +16 -0
- package/dist/cjs/commands/insert.js +4 -7
- package/dist/cjs/commands/misc.js +10 -3
- package/dist/cjs/nodeviews/TableComponent.js +23 -2
- package/dist/cjs/plugin.js +7 -1
- package/dist/cjs/pm-plugins/analytics/plugin.js +17 -22
- package/dist/cjs/pm-plugins/view-mode-sort/consts.js +9 -0
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +304 -0
- package/dist/cjs/pm-plugins/view-mode-sort/plugin-key.js +8 -0
- package/dist/cjs/pm-plugins/view-mode-sort/types.js +5 -0
- package/dist/cjs/pm-plugins/view-mode-sort/utils.js +106 -0
- package/dist/cjs/ui/common-styles.js +22 -15
- package/dist/es2019/commands/insert.js +4 -7
- package/dist/es2019/commands/misc.js +10 -3
- package/dist/es2019/nodeviews/TableComponent.js +24 -2
- package/dist/es2019/plugin.js +7 -1
- package/dist/es2019/pm-plugins/analytics/plugin.js +21 -26
- package/dist/es2019/pm-plugins/view-mode-sort/consts.js +3 -0
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +243 -0
- package/dist/es2019/pm-plugins/view-mode-sort/plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/view-mode-sort/types.js +1 -0
- package/dist/es2019/pm-plugins/view-mode-sort/utils.js +98 -0
- package/dist/es2019/ui/common-styles.js +35 -0
- package/dist/esm/commands/insert.js +4 -7
- package/dist/esm/commands/misc.js +10 -3
- package/dist/esm/nodeviews/TableComponent.js +23 -2
- package/dist/esm/plugin.js +7 -1
- package/dist/esm/pm-plugins/analytics/plugin.js +17 -22
- package/dist/esm/pm-plugins/view-mode-sort/consts.js +3 -0
- package/dist/esm/pm-plugins/view-mode-sort/index.js +299 -0
- package/dist/esm/pm-plugins/view-mode-sort/plugin-key.js +2 -0
- package/dist/esm/pm-plugins/view-mode-sort/types.js +1 -0
- package/dist/esm/pm-plugins/view-mode-sort/utils.js +99 -0
- package/dist/esm/ui/common-styles.js +15 -8
- package/dist/types/pm-plugins/view-mode-sort/consts.d.ts +3 -0
- package/dist/types/pm-plugins/view-mode-sort/index.d.ts +10 -0
- package/dist/types/pm-plugins/view-mode-sort/plugin-key.d.ts +3 -0
- package/dist/types/pm-plugins/view-mode-sort/types.d.ts +17 -0
- package/dist/types/pm-plugins/view-mode-sort/utils.d.ts +15 -0
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -4
- package/dist/types/ui/TableFloatingControls/index.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/consts.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/index.d.ts +10 -0
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/types.d.ts +21 -0
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/utils.d.ts +15 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -4
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -2
- package/package.json +8 -8
- package/src/commands/insert.ts +7 -13
- package/src/commands/misc.ts +14 -8
- package/src/nodeviews/TableComponent.tsx +22 -0
- package/src/plugin.tsx +12 -3
- package/src/pm-plugins/analytics/plugin.ts +24 -33
- package/src/pm-plugins/view-mode-sort/consts.ts +3 -0
- package/src/pm-plugins/view-mode-sort/index.ts +257 -0
- package/src/pm-plugins/view-mode-sort/plugin-key.ts +6 -0
- package/src/pm-plugins/view-mode-sort/types.ts +23 -0
- package/src/pm-plugins/view-mode-sort/utils.ts +120 -0
- package/src/ui/common-styles.ts +36 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
/**
|
|
10
|
+
* This plugin allows sorting of table nodes in the Editor without modifying the underlying ProseMirror document.
|
|
11
|
+
* Instead of making changes to the ProseMirror document, the plugin sorts the table rows in the DOM. This allows the sorting to be
|
|
12
|
+
* visible to the user without affecting the document's content.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { createElement } from 'react';
|
|
16
|
+
import ReactDOM from 'react-dom';
|
|
17
|
+
import { RawIntlProvider } from 'react-intl-next';
|
|
18
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
19
|
+
import { SortingIcon } from '@atlaskit/editor-common/table';
|
|
20
|
+
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
21
|
+
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
22
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
23
|
+
import { getPluginState } from '../plugin-factory';
|
|
24
|
+
import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
|
|
25
|
+
import { tableViewModeSortPluginKey as key } from './plugin-key';
|
|
26
|
+
import { getTableElements, toggleSort } from './utils';
|
|
27
|
+
export var createPlugin = function createPlugin(editorViewModeAPI) {
|
|
28
|
+
return new SafePlugin({
|
|
29
|
+
state: {
|
|
30
|
+
init: function init() {
|
|
31
|
+
return {
|
|
32
|
+
decorations: DecorationSet.empty,
|
|
33
|
+
sort: {},
|
|
34
|
+
allTables: []
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
apply: function apply(tr, pluginState, oldState) {
|
|
38
|
+
// TODO - move this mode check to plugin creation if possible. Right now it's here because the initial state
|
|
39
|
+
// does not appear correct when the plugin is created.
|
|
40
|
+
var _ref = (editorViewModeAPI === null || editorViewModeAPI === void 0 ? void 0 : editorViewModeAPI.sharedState.currentState()) || {},
|
|
41
|
+
mode = _ref.mode;
|
|
42
|
+
if (mode !== 'view') {
|
|
43
|
+
return pluginState;
|
|
44
|
+
}
|
|
45
|
+
var decorations = pluginState.decorations,
|
|
46
|
+
sort = pluginState.sort,
|
|
47
|
+
allTables = pluginState.allTables;
|
|
48
|
+
var sortMeta = tr.getMeta('tableSortMeta');
|
|
49
|
+
var hoverTableMeta = tr.getMeta('mouseEnterTable');
|
|
50
|
+
var removeTableMeta = tr.getMeta('removeTable');
|
|
51
|
+
var tableId = '';
|
|
52
|
+
|
|
53
|
+
// Remove the table from the state
|
|
54
|
+
if (removeTableMeta) {
|
|
55
|
+
allTables = allTables.filter(function (_ref2) {
|
|
56
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
|
57
|
+
id = _ref3[0];
|
|
58
|
+
return id !== removeTableMeta;
|
|
59
|
+
});
|
|
60
|
+
} else {
|
|
61
|
+
tableId = hoverTableMeta === null || hoverTableMeta === void 0 ? void 0 : hoverTableMeta[0];
|
|
62
|
+
}
|
|
63
|
+
sort = _objectSpread(_objectSpread({}, sort), sortMeta);
|
|
64
|
+
var isTableInState = allTables.some(function (_ref4) {
|
|
65
|
+
var _ref5 = _slicedToArray(_ref4, 1),
|
|
66
|
+
id = _ref5[0];
|
|
67
|
+
return id === tableId;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Update the table in the state
|
|
71
|
+
if (hoverTableMeta) {
|
|
72
|
+
allTables = allTables.filter(function (_ref6) {
|
|
73
|
+
var _ref7 = _slicedToArray(_ref6, 1),
|
|
74
|
+
id = _ref7[0];
|
|
75
|
+
return id !== hoverTableMeta[0];
|
|
76
|
+
});
|
|
77
|
+
allTables.push(hoverTableMeta);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Create decorations for the sorting icons
|
|
82
|
+
*/
|
|
83
|
+
var decs = [];
|
|
84
|
+
|
|
85
|
+
// TODO - add support for keyboard only users
|
|
86
|
+
if (hoverTableMeta && !isTableInState || sortMeta) {
|
|
87
|
+
allTables.forEach(function (table) {
|
|
88
|
+
var _table = _slicedToArray(table, 3),
|
|
89
|
+
tableId = _table[0],
|
|
90
|
+
_node = _table[1],
|
|
91
|
+
pos = _table[2];
|
|
92
|
+
var tableNode = tr.doc.nodeAt(tr.mapping.map(pos));
|
|
93
|
+
if (!tableNode || tableNode.type.name !== 'table') {
|
|
94
|
+
return pluginState;
|
|
95
|
+
}
|
|
96
|
+
var map = TableMap.get(tableNode);
|
|
97
|
+
var hasMergedCells = new Set(map.map).size !== map.map.length;
|
|
98
|
+
map.mapByRow[0].forEach(function (cell, index) {
|
|
99
|
+
// return pluginState;
|
|
100
|
+
decs.push(Decoration.widget(cell + pos + 2, function () {
|
|
101
|
+
var _sort$tableId;
|
|
102
|
+
var element = document.createElement('div');
|
|
103
|
+
element.setAttribute(SORT_INDEX_DATA_ATTRIBUTE, "".concat(index));
|
|
104
|
+
element.classList.add(SORTING_ICON_CLASS_NAME);
|
|
105
|
+
if (hasMergedCells) {
|
|
106
|
+
element.classList.add(IS_DISABLED_CLASS_NAME);
|
|
107
|
+
}
|
|
108
|
+
var sortOrdered;
|
|
109
|
+
if (index === ((_sort$tableId = sort[tableId]) === null || _sort$tableId === void 0 ? void 0 : _sort$tableId.index)) {
|
|
110
|
+
var _sort$tableId2;
|
|
111
|
+
sortOrdered = (_sort$tableId2 = sort[tableId]) === null || _sort$tableId2 === void 0 ? void 0 : _sort$tableId2.direction;
|
|
112
|
+
} else {
|
|
113
|
+
sortOrdered = SortOrder.NO_ORDER;
|
|
114
|
+
}
|
|
115
|
+
var _getPluginState = getPluginState(oldState),
|
|
116
|
+
getIntl = _getPluginState.getIntl;
|
|
117
|
+
ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
|
|
118
|
+
value: getIntl()
|
|
119
|
+
}, /*#__PURE__*/createElement(SortingIcon, {
|
|
120
|
+
isSortingAllowed: !hasMergedCells,
|
|
121
|
+
sortOrdered: sortOrdered,
|
|
122
|
+
onClick: function onClick() {},
|
|
123
|
+
onKeyDown: function onKeyDown() {}
|
|
124
|
+
})), element);
|
|
125
|
+
return element;
|
|
126
|
+
}));
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
decorations = DecorationSet.create(tr.doc, decs);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Map the decorations to the new document if there are changes
|
|
134
|
+
*/
|
|
135
|
+
if (tr.docChanged) {
|
|
136
|
+
decorations = decorations.map(tr.mapping, tr.doc);
|
|
137
|
+
allTables = allTables.map(function (table) {
|
|
138
|
+
return [table[0], table[1], tr.mapping.map(table[2])];
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
decorations: decorations,
|
|
143
|
+
sort: sort,
|
|
144
|
+
allTables: allTables
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
key: key,
|
|
149
|
+
appendTransaction: function appendTransaction(trs, oldState, newState) {
|
|
150
|
+
var _key$getState;
|
|
151
|
+
// return newState.tr;
|
|
152
|
+
var _ref8 = (editorViewModeAPI === null || editorViewModeAPI === void 0 ? void 0 : editorViewModeAPI.sharedState.currentState()) || {},
|
|
153
|
+
mode = _ref8.mode;
|
|
154
|
+
if (mode !== 'view') {
|
|
155
|
+
return newState.tr;
|
|
156
|
+
}
|
|
157
|
+
var allTables = ((_key$getState = key.getState(newState)) === null || _key$getState === void 0 ? void 0 : _key$getState.allTables) || [];
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* If incoming changes have affected a table node, remove the sorting. This prevents the
|
|
161
|
+
* table from breaking if changes like merged cells are incoming.
|
|
162
|
+
*/
|
|
163
|
+
var _iterator = _createForOfIteratorHelper(trs),
|
|
164
|
+
_step;
|
|
165
|
+
try {
|
|
166
|
+
var _loop = function _loop() {
|
|
167
|
+
var tr = _step.value;
|
|
168
|
+
var hoverTableMeta = tr.getMeta('mouseEnterTable');
|
|
169
|
+
if (hoverTableMeta) {
|
|
170
|
+
allTables = allTables.filter(function (_ref9) {
|
|
171
|
+
var _ref10 = _slicedToArray(_ref9, 1),
|
|
172
|
+
id = _ref10[0];
|
|
173
|
+
return id !== hoverTableMeta[0];
|
|
174
|
+
});
|
|
175
|
+
allTables.push(hoverTableMeta);
|
|
176
|
+
}
|
|
177
|
+
var isRemote = tr.getMeta('isRemote');
|
|
178
|
+
var isDocChanged = tr.docChanged;
|
|
179
|
+
var isChangesIncoming = isRemote && isDocChanged;
|
|
180
|
+
var oldPluginState = key.getState(oldState);
|
|
181
|
+
var newPluginState = key.getState(newState);
|
|
182
|
+
var _iterator2 = _createForOfIteratorHelper(allTables),
|
|
183
|
+
_step2;
|
|
184
|
+
try {
|
|
185
|
+
var _loop2 = function _loop2() {
|
|
186
|
+
var _oldPluginState$sort, _newPluginState$sort;
|
|
187
|
+
var table = _step2.value;
|
|
188
|
+
var _table2 = _slicedToArray(table, 3),
|
|
189
|
+
tableId = _table2[0],
|
|
190
|
+
node = _table2[1],
|
|
191
|
+
pos = _table2[2];
|
|
192
|
+
var _ref11 = (oldPluginState === null || oldPluginState === void 0 || (_oldPluginState$sort = oldPluginState.sort) === null || _oldPluginState$sort === void 0 ? void 0 : _oldPluginState$sort[tableId]) || {},
|
|
193
|
+
oldOrder = _ref11.order,
|
|
194
|
+
oldDirection = _ref11.direction,
|
|
195
|
+
oldIndex = _ref11.index;
|
|
196
|
+
if (isChangesIncoming) {
|
|
197
|
+
var _maybeTableNode$attrs;
|
|
198
|
+
var maybeTableNode = tr.doc.nodeAt(pos);
|
|
199
|
+
var isTableNodeChanged = (maybeTableNode === null || maybeTableNode === void 0 || (_maybeTableNode$attrs = maybeTableNode.attrs) === null || _maybeTableNode$attrs === void 0 ? void 0 : _maybeTableNode$attrs.localId) !== tableId || !node.eq(maybeTableNode);
|
|
200
|
+
if (isTableNodeChanged) {
|
|
201
|
+
var newtr = newState.tr;
|
|
202
|
+
newtr.setMeta('tableSortMeta', _defineProperty({}, tableId, {}));
|
|
203
|
+
newtr.setMeta('removeTable', tableId);
|
|
204
|
+
|
|
205
|
+
// Unsort the table here
|
|
206
|
+
if (oldOrder !== undefined) {
|
|
207
|
+
var _getTableElements = getTableElements(tableId),
|
|
208
|
+
rows = _getTableElements.rows,
|
|
209
|
+
tbody = _getTableElements.tbody;
|
|
210
|
+
if (!rows || !tbody) {
|
|
211
|
+
return {
|
|
212
|
+
v: {
|
|
213
|
+
v: newtr
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
var sortedOrder = _toConsumableArray(oldOrder).sort(function (a, b) {
|
|
218
|
+
return a.value - b.value;
|
|
219
|
+
});
|
|
220
|
+
sortedOrder.forEach(function (index, i) {
|
|
221
|
+
tbody.appendChild(rows[index.index + 1]);
|
|
222
|
+
});
|
|
223
|
+
return {
|
|
224
|
+
v: {
|
|
225
|
+
v: newtr
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Sort the table if the sort order has changed
|
|
234
|
+
*/
|
|
235
|
+
var _ref12 = (newPluginState === null || newPluginState === void 0 || (_newPluginState$sort = newPluginState.sort) === null || _newPluginState$sort === void 0 ? void 0 : _newPluginState$sort[tableId]) || {},
|
|
236
|
+
newOrder = _ref12.order,
|
|
237
|
+
newDirection = _ref12.direction,
|
|
238
|
+
newIndex = _ref12.index;
|
|
239
|
+
var orderChanged = oldDirection !== newDirection || oldIndex !== newIndex;
|
|
240
|
+
if (orderChanged) {
|
|
241
|
+
if (!isRemote && newDirection !== SortOrder.NO_ORDER) {
|
|
242
|
+
var _getTableElements2 = getTableElements(tableId),
|
|
243
|
+
_rows = _getTableElements2.rows,
|
|
244
|
+
_tbody = _getTableElements2.tbody;
|
|
245
|
+
if (_rows && newOrder) {
|
|
246
|
+
newOrder.forEach(function (index, i) {
|
|
247
|
+
_tbody === null || _tbody === void 0 || _tbody.appendChild(_rows[index.value + 1]);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
_ret2;
|
|
254
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
255
|
+
_ret2 = _loop2();
|
|
256
|
+
if (_ret2) return _ret2.v;
|
|
257
|
+
}
|
|
258
|
+
} catch (err) {
|
|
259
|
+
_iterator2.e(err);
|
|
260
|
+
} finally {
|
|
261
|
+
_iterator2.f();
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
_ret;
|
|
265
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
266
|
+
_ret = _loop();
|
|
267
|
+
if (_ret) return _ret.v;
|
|
268
|
+
}
|
|
269
|
+
} catch (err) {
|
|
270
|
+
_iterator.e(err);
|
|
271
|
+
} finally {
|
|
272
|
+
_iterator.f();
|
|
273
|
+
}
|
|
274
|
+
return newState.tr;
|
|
275
|
+
},
|
|
276
|
+
props: {
|
|
277
|
+
handleDOMEvents: {
|
|
278
|
+
keydown: function keydown(view, event) {
|
|
279
|
+
// TODO - fix the focus issue here, where toggling sort with a keypress loses focus
|
|
280
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
281
|
+
var _key$getState2;
|
|
282
|
+
var pluginState = ((_key$getState2 = key.getState(view.state)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.sort) || {};
|
|
283
|
+
toggleSort(view, event, pluginState);
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
click: function click(view, event) {
|
|
287
|
+
var _key$getState3;
|
|
288
|
+
var pluginState = ((_key$getState3 = key.getState(view.state)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.sort) || {};
|
|
289
|
+
toggleSort(view, event, pluginState);
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
decorations: function decorations(state) {
|
|
293
|
+
var _key$getState4;
|
|
294
|
+
var decs = ((_key$getState4 = key.getState(state)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.decorations) || DecorationSet.empty;
|
|
295
|
+
return decs;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
|
|
5
|
+
export var unsort = function unsort(oldOrder, tableElement) {
|
|
6
|
+
var rows = tableElement.querySelectorAll('tr');
|
|
7
|
+
var tbody = tableElement.querySelector('tbody');
|
|
8
|
+
var sortedOrder = _toConsumableArray(oldOrder).sort(function (a, b) {
|
|
9
|
+
return a.value - b.value;
|
|
10
|
+
});
|
|
11
|
+
sortedOrder.forEach(function (item) {
|
|
12
|
+
tbody === null || tbody === void 0 || tbody.appendChild(rows[item.index + 1]);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// TODO - reuse sort logic from the Renderer and support switching between ASC, DESC and NO_ORDER
|
|
17
|
+
export var getSortOrderFromTable = function getSortOrderFromTable(tableElement, sortIndex, direction) {
|
|
18
|
+
var sortOrder = direction === SortOrder.DESC ? -1 : 1;
|
|
19
|
+
var strings = [];
|
|
20
|
+
tableElement.querySelectorAll('tr:not([data-header-row="true"])').forEach(function (tr) {
|
|
21
|
+
var _tr$querySelectorAll$;
|
|
22
|
+
strings.push(((_tr$querySelectorAll$ = tr.querySelectorAll('td')[sortIndex]) === null || _tr$querySelectorAll$ === void 0 ? void 0 : _tr$querySelectorAll$.textContent) || '');
|
|
23
|
+
});
|
|
24
|
+
var order = Array.from(strings.keys()).sort(function (a, b) {
|
|
25
|
+
var string = strings[a] || '';
|
|
26
|
+
return string.localeCompare(strings[b] || '') * sortOrder;
|
|
27
|
+
}).map(function (value, index) {
|
|
28
|
+
return {
|
|
29
|
+
value: value,
|
|
30
|
+
index: index
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
// TODO - improve this. right now this is a workaround to ensure the first tr is always first in the order
|
|
34
|
+
return [{
|
|
35
|
+
value: -1,
|
|
36
|
+
index: -1
|
|
37
|
+
}].concat(_toConsumableArray(order));
|
|
38
|
+
};
|
|
39
|
+
export var toggleSort = function toggleSort(view, event, pluginState) {
|
|
40
|
+
var _target$closest;
|
|
41
|
+
var target = event.target;
|
|
42
|
+
var widget = target.closest(".".concat(SORTING_ICON_CLASS_NAME));
|
|
43
|
+
if (widget !== null && widget !== void 0 && widget.classList.contains(IS_DISABLED_CLASS_NAME) || !widget) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
var datasetortIndex = target === null || target === void 0 || (_target$closest = target.closest('.ProseMirror-widget')) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute(SORT_INDEX_DATA_ATTRIBUTE);
|
|
47
|
+
var tr = view.state.tr;
|
|
48
|
+
var tableElement = target.closest('table');
|
|
49
|
+
if (!tableElement || !datasetortIndex) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
var tableId = tableElement.getAttribute('data-table-local-id') || '';
|
|
53
|
+
var _ref = (pluginState === null || pluginState === void 0 ? void 0 : pluginState[tableId]) || {},
|
|
54
|
+
index = _ref.index,
|
|
55
|
+
direction = _ref.direction,
|
|
56
|
+
oldOrder = _ref.order;
|
|
57
|
+
|
|
58
|
+
// Unsort if there was already a sort
|
|
59
|
+
if (direction !== SortOrder.NO_ORDER && oldOrder !== undefined) {
|
|
60
|
+
unsort(oldOrder, tableElement);
|
|
61
|
+
}
|
|
62
|
+
var sortIndex = parseInt(datasetortIndex);
|
|
63
|
+
if (sortIndex === index) {
|
|
64
|
+
switch (direction) {
|
|
65
|
+
case SortOrder.NO_ORDER:
|
|
66
|
+
direction = SortOrder.ASC;
|
|
67
|
+
break;
|
|
68
|
+
case SortOrder.ASC:
|
|
69
|
+
direction = SortOrder.DESC;
|
|
70
|
+
break;
|
|
71
|
+
case SortOrder.DESC:
|
|
72
|
+
direction = SortOrder.NO_ORDER;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
direction = SortOrder.ASC; // default direction when a new index is clicked
|
|
77
|
+
}
|
|
78
|
+
var order = getSortOrderFromTable(tableElement, sortIndex, direction);
|
|
79
|
+
if (direction === SortOrder.NO_ORDER) {
|
|
80
|
+
tr.setMeta('tableSortMeta', _defineProperty({}, tableId, {}));
|
|
81
|
+
} else {
|
|
82
|
+
tr.setMeta('tableSortMeta', _defineProperty({}, tableId, {
|
|
83
|
+
index: sortIndex,
|
|
84
|
+
direction: direction,
|
|
85
|
+
order: order,
|
|
86
|
+
tableElement: tableElement
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
view.dispatch(tr);
|
|
90
|
+
};
|
|
91
|
+
export var getTableElements = function getTableElements(tableId) {
|
|
92
|
+
var tableElement = document.querySelector("table[data-table-local-id=\"".concat(tableId, "\"]"));
|
|
93
|
+
var tbody = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tbody');
|
|
94
|
+
var rows = tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('tr');
|
|
95
|
+
return {
|
|
96
|
+
tbody: tbody,
|
|
97
|
+
rows: rows
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
3
3
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
7
|
+
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
7
8
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
8
9
|
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, relativeFontSizeToBase16, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
9
10
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
10
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { N0, N40A, R500 } from '@atlaskit/theme/colors';
|
|
12
13
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
14
|
+
import { SORTING_ICON_CLASS_NAME } from '../pm-plugins/view-mode-sort/consts';
|
|
13
15
|
import { TableCssClassName as ClassName } from '../types';
|
|
14
16
|
import { columnControlsDecorationHeight, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, rowControlsZIndex, stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableBorderColor, tableBorderDeleteColor, tableBorderRadiusSize, tableBorderSelectedColor, tableCellBackgroundColor, tableCellDeleteColor, tableCellSelectedColor, tableControlsSpacing, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tablePadding, tableScrollbarOffset, tableTextColor, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
15
17
|
import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, dragCornerControlButton, dragInsertButtonWrapper, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle, rowControlsWrapperDotStyle } from './ui-styles';
|
|
@@ -33,6 +35,11 @@ var shadowSentinelStyles = "\n .".concat(ClassName.TABLE_SHADOW_SENTINEL_LEFT,
|
|
|
33
35
|
var breakoutWidthStyling = function breakoutWidthStyling() {
|
|
34
36
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n > *:not([data-mark-type='fragment'])\n .", "\n .", " {\n margin-left: unset !important;\n width: 100% !important;\n }\n\n > [data-mark-type='fragment']\n *\n .", "\n .", " {\n margin-left: unset !important;\n width: 100% !important;\n }\n "])), ClassName.NODEVIEW_WRAPPER, ClassName.TABLE_CONTAINER, ClassName.NODEVIEW_WRAPPER, ClassName.TABLE_CONTAINER);
|
|
35
37
|
};
|
|
38
|
+
var viewModeSortStyles = function viewModeSortStyles() {
|
|
39
|
+
if (getBooleanFF('platform.editor.table.live-pages-sorting_4malx')) {
|
|
40
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n th {\n .", " {\n + p {\n margin-top: 0 !important;\n }\n }\n\n &:has(.is-active) {\n .", " {\n opacity: 1;\n }\n }\n\n .", " {\n opacity: 0;\n &:focus {\n opacity: 1;\n }\n }\n\n &:hover {\n .", " {\n opacity: 1;\n }\n }\n }\n "])), SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
36
43
|
var tableBorderStyles = function tableBorderStyles() {
|
|
37
44
|
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
38
45
|
return "border-color: ".concat(tableBorderDeleteColor);
|
|
@@ -44,9 +51,9 @@ var tableBorderStyles = function tableBorderStyles() {
|
|
|
44
51
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
45
52
|
var tableStickyHeaderColumnControlsDecorationsStyle = function tableStickyHeaderColumnControlsDecorationsStyle() {
|
|
46
53
|
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
47
|
-
return css(
|
|
54
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", " .", " {\n z-index: 0;\n left: -1px;\n }\n\n .", "\n .", "::after {\n border-left: 1px solid ", ";\n }\n\n .", "\n tr:first-of-type\n th.", " {\n &.", ", &.", " {\n .", "::after {\n left: 0;\n }\n }\n }\n "])), ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, tableBorderColor, ClassName.TABLE_STICKY, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
48
55
|
} else {
|
|
49
|
-
return css(
|
|
56
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .", " .", " {\n z-index: 0;\n }\n "])), ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
50
57
|
}
|
|
51
58
|
};
|
|
52
59
|
var tableStickyHeaderFirefoxFixStyle = function tableStickyHeaderFirefoxFixStyle() {
|
|
@@ -56,21 +63,21 @@ var tableStickyHeaderFirefoxFixStyle = function tableStickyHeaderFirefoxFixStyle
|
|
|
56
63
|
see https://product-fabric.atlassian.net/browse/ED-19177
|
|
57
64
|
*/
|
|
58
65
|
if (browser.gecko) {
|
|
59
|
-
return css(
|
|
66
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n .", " > tbody::before {\n content: '';\n }\n "])), ClassName.TABLE_STICKY);
|
|
60
67
|
}
|
|
61
68
|
};
|
|
62
69
|
|
|
63
70
|
// re-exporting these styles to use in Gemini test when table node view is rendered outside of PM
|
|
64
71
|
export var baseTableStyles = function baseTableStyles(props) {
|
|
65
72
|
var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4;
|
|
66
|
-
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n ", "\n\n ", "\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n ", "\n\n ", "\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection but below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: 0 6px 4px -4px ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n /* needs to be above sticky header row and below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky .", ", tr.sticky .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", ",\n .", " {\n padding: 0 ", "px;\n\n // https://product-fabric.atlassian.net/browse/ED-16386\n // Fixes issue where the extra padding that is added here throws off the position\n // of the rows control dot\n &::after {\n right: 6px !important;\n }\n }\n\n .", " {\n padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n .", ", .", " {\n width: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level unless wrapped in fragment mark */\n ", "\n\n ", ";\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n .", " {\n display: grid;\n align-items: center;\n position: absolute;\n z-index: ", ";\n\n .", " {\n position: absolute;\n align-self: end;\n height: 100%;\n width: 18px;\n }\n\n .", " {\n position: absolute;\n bottom: -3px;\n left: 2px;\n background-color: ", ";\n height: 4px;\n width: 4px;\n border-radius: 50%;\n pointer-events: none;\n }\n }\n\n .", " {\n .", " {\n height: 24px;\n position: absolute;\n top: ", ";\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n height: 24px;\n width: 100%;\n }\n\n .", " {\n background-color: ", ";\n height: 4px;\n width: 4px;\n border-radius: 50%;\n position: absolute;\n right: -2px;\n }\n }\n\n .", " {\n background: none;\n border: none;\n outline: none;\n position: absolute;\n margin: 0;\n padding: 0;\n display: flex;\n align-items: center;\n cursor: pointer;\n\n :focus {\n outline: none;\n }\n }\n\n .", " {\n cursor: grab;\n pointer-events: auto;\n\n line-height: 0;\n padding: 0;\n border-radius: 6px;\n width: max-content;\n border: 2px solid ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n background: transparent;\n outline: none;\n\n &.placeholder {\n background-color: transparent;\n border: 2px solid transparent;\n }\n\n &.", " {\n cursor: pointer;\n & svg {\n & > rect.", " {\n fill: ", ";\n }\n & > rect {\n fill: ", ";\n }\n & > g > rect {\n fill: ", ";\n }\n }\n }\n\n &:not(.", ") {\n & svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n\n &:hover {\n svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n }\n\n &:active {\n cursor: grabbing;\n }\n\n &.selected {\n :focus {\n outline: 2px solid ", ";\n outline-offset: 1px;\n }\n\n &:active {\n outline: none;\n }\n\n svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n }\n\n &.danger {\n svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n }\n }\n }\n\n ", "\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n // add a background above the first numbered column cell when sticky header is engaged\n // which hides the table when scrolling\n .", " {\n .", ":first-of-type::after {\n content: '';\n display: block;\n height: 33px;\n width: 100%;\n background-color: ", ";\n position: absolute;\n\n // the extra pixel is accounting for borders\n top: -34px;\n left: -1px;\n }\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 0px;\n\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", ":not(.", ") {\n cursor: pointer;\n }\n .", ":not(.", "):hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n // Allows better positioning for the shadow sentinels - ED-16668\n position: relative;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n /* ED-19064: To fix when enable header column in the table,\n and selection the header column, the right border is not tableBorderSelectedColor\n when deleting the header column, the right border is not tableToolbarDeleteColor */\n td.", ",\n td.", ",\n th.", ".", ",\n th.", ".", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n ", ";\n z-index: ", ";\n }\n\n &.", ".", "::after {\n ", ";\n z-index: ", ";\n }\n }\n }\n\n // override for DnD controls\n .", " {\n position: absolute;\n margin-top: ", "px;\n left: -", "px;\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n /* top of corner control is table margin top - corner control height + 1 pixel of table border. */\n top: ", "px;\n left: -", "px;\n }\n\n .", ".", ",\n .", ".", " {\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n top: ", "px;\n }\n\n .", " .", " {\n position: fixed;\n /* higher zIndex than sticky header which is akEditorTableCellOnStickyHeaderZIndex - 5 */\n z-index: ", ";\n }\n\n .", " {\n padding-bottom: 0px;\n /* fixes gap cursor height */\n overflow: auto;\n overflow-y: hidden;\n position: relative;\n\n > table[data-number-column='true'] {\n width: calc(100% - 1px);\n }\n }\n"])), tableSharedStyle(), columnControlsLineMarker(), hoveredDeleteButton(), hoveredCell(), hoveredWarningCell, ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableDragAndDrop) && insertLine(), resizeHandle((_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.tableDragAndDrop), rangeSelectionStyles, ClassName.LAST_ITEM_IN_CELL, ClassName.TABLE_NODE_WRAPPER, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.TABLE_CELL, tableCellBackgroundColor, tableBorderColor, tableBorderColor, ClassName.CONTROLS_FLOATING_BUTTON_COLUMN, insertColumnButtonWrapper(), ClassName.CONTROLS_FLOATING_BUTTON_ROW, insertRowButtonWrapper(), dragInsertButtonWrapper(), dragCornerControlButton(), DeleteButton(), ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, stickyRowOffsetTop + 2, akEditorTableNumberColumnWidth, akEditorStickyHeaderZIndex, stickyRowOffsetTop, "var(--ds-surface, white)", ClassName.TABLE_STICKY, ClassName.CORNER_CONTROLS, akEditorSmallZIndex, "var(--ds-surface, white)", tableToolbarSize, tableToolbarSize, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize, tableToolbarSize, tableStickyHeaderColumnControlsDecorationsStyle(), tableStickyHeaderFirefoxFixStyle(), ClassName.TABLE_STICKY, ClassName.ROW_CONTROLS, ClassName.ROW_CONTROLS_BUTTON_WRAP, akEditorStickyHeaderZIndex, tableToolbarSize, "var(--ds-surface, white)", tableToolbarSize, ClassName.TABLE_STICKY, "var(--ds-surface, green)", stickyRowOffsetTop, akEditorTableCellOnStickyHeaderZIndex - 5, "var(--ds-surface, white)", "var(--ds-shadow-overflow-perimeter, ".concat(N40A, ")"), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, akEditorTableCellOnStickyHeaderZIndex, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tableToolbarSize, stickyHeaderBorderBottomWidth, tableBorderColor, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, insertColumnButtonOffset + 1, ClassName.TABLE_STICKY, ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY, ClassName.WITH_RESIZE_LINE, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2 + 1, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.WITH_CONTROLS, tableControlsSpacing, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, tableControlsSpacing + 2, ClassName.CORNER_CONTROLS, tableControlsSpacing - tableToolbarSize + 2, "var(--ds-surface, white)", sentinelStyles, OverflowShadow((_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.tableDragAndDrop), stickyScrollbarStyles(props.featureFlags), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tablePadding, ClassName.DRAG_ROW_CONTROLS_WRAPPER, ClassName.ROW_CONTROLS_WRAPPER, tablePadding, ClassName.DRAG_COLUMN_CONTROLS_WRAPPER, tablePadding, ClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth + tablePadding - 1, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, tableOverflowShadowWidth, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, ClassName.NODEVIEW_WRAPPER, breakoutWidthStyling(), columnControlsDecoration(), rowControlsWrapperDotStyle(), ClassName.CORNER_CONTROLS, tableToolbarSize + 1, cornerControlHeight, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, InsertMarker("\n left: -11px;\n top: 9px;\n "), ClassName.CORNER_CONTROLS, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize + 1, tableToolbarSize + 1, tableBorderColor, tableBorderRadiusSize, tableHeaderCellBackgroundColor, ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor, tableToolbarSelectedColor, ClassName.TABLE_CONTAINER, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1, ClassName.ROW_CONTROLS, ClassName.CONTROLS_BUTTON, ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor, tableToolbarSelectedColor, ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableBorderDeleteColor, tableToolbarDeleteColor, ClassName.ROW_CONTROLS, tableToolbarSize, InsertMarker("\n bottom: -1px;\n left: -11px;\n "), ClassName.ROW_CONTROLS_INNER, ClassName.ROW_CONTROLS_BUTTON_WRAP, tableBorderRadiusSize, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.CONTROLS_BUTTON, akEditorUnitZIndex, HeaderButton("\n border-bottom: 1px solid ".concat(tableBorderColor, ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(tableToolbarSize, "px;\n\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), ClassName.DRAG_ROW_CONTROLS, akEditorUnitZIndex, ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER, ClassName.DRAG_ROW_FLOATING_INSERT_DOT, "var(--ds-background-accent-gray-subtler, #C1C7D0)", ClassName.DRAG_COLUMN_CONTROLS, ClassName.DRAG_COLUMN_CONTROLS_INNER, "var(--ds-space-negative-150, -12px)", resizeHandlerZIndex, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT, "var(--ds-background-accent-gray-subtler, #C1C7D0)", ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE, ClassName.DRAG_HANDLE_BUTTON_CONTAINER, "var(--ds-surface, ".concat(N0, ")"), ClassName.DRAG_HANDLE_DISABLED, ClassName.DRAG_HANDLE_MINIMISED, "var(--ds-background-accent-gray-subtler, #DCDFE4)", "var(--ds-background-accent-gray-subtlest, #F4F5F7)", "var(--ds-icon-disabled, #BFDBF847)", ClassName.DRAG_HANDLE_DISABLED, "var(--ds-background-accent-gray-subtler, #DCDFE4)", "var(--ds-icon-subtle, #626f86)", "var(--ds-background-accent-blue-subtle, #579DFF)", "var(--ds-icon-inverse, #FFF)", "var(--ds-border-focused, #2684FF)", "var(--ds-background-accent-blue-subtle, #579dff)", "var(--ds-icon-inverse, #fff)", "var(--ds-background-accent-red-subtler-pressed, #F87462)", "var(--ds-border-inverse, #FFF)", floatingColumnControls(), ClassName.IS_RESIZING, ClassName.ROW_CONTROLS, HeaderButtonHover(), HeaderButtonDanger(), ClassName.NUMBERED_COLUMN, akEditorTableToolbarSize, (_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.tableDragAndDrop ? 0 : akEditorTableToolbarSize, akEditorTableNumberColumnWidth + 1, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderColor, relativeFontSizeToBase16(fontSize()), tableHeaderCellBackgroundColor, tableTextColor, tableBorderColor, tableBorderColor, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, "var(--ds-surface, white)", ClassName.WITH_CONTROLS, ClassName.CORNER_CONTROLS, ClassName.ROW_CONTROLS, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.IS_RESIZING, ClassName.WITH_CONTROLS, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.NUMBERED_COLUMN_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableToolbarDeleteColor, tableBorderDeleteColor, "var(--ds-text-danger, ".concat(R500, ")"), akEditorUnitZIndex, ClassName.TABLE_NODE_WRAPPER, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, akEditorSmallZIndex, ClassName.SELECTED_CELL, tableBorderSelectedColor, ClassName.SELECTED_CELL, tableCellSelectedColor, akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, ClassName.HOVERED_CELL_IN_DANGER, tableCellDeleteColor, akEditorUnitZIndex * 100, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.HOVERED_CELL, tableBorderSelectedColor, akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, tableBorderStyles(), akEditorUnitZIndex * 100, ClassName.HOVERED_NO_HIGHLIGHT, ClassName.HOVERED_CELL_IN_DANGER, tableBorderStyles(), akEditorUnitZIndex * 100, ClassName.DRAG_ROW_CONTROLS_WRAPPER, tableMarginTop, tableToolbarSize + 1, rowControlsZIndex + 4, ClassName.ROW_CONTROLS_WRAPPER, tableMarginTop - cornerControlHeight + 1, tableToolbarSize, ClassName.DRAG_ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, ClassName.ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, akEditorUnitZIndex, ClassName.DRAG_COLUMN_CONTROLS_WRAPPER, tableMarginTop, ClassName.TABLE_STICKY, ClassName.DRAG_COLUMN_CONTROLS_WRAPPER, akEditorTableCellOnStickyHeaderZIndex - 4, ClassName.TABLE_NODE_WRAPPER);
|
|
73
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n ", "\n\n ", "\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n ", "\n\n ", "\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection but below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: 0 6px 4px -4px ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n /* needs to be above sticky header row and below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky .", ", tr.sticky .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", ",\n .", " {\n padding: 0 ", "px;\n\n // https://product-fabric.atlassian.net/browse/ED-16386\n // Fixes issue where the extra padding that is added here throws off the position\n // of the rows control dot\n &::after {\n right: 6px !important;\n }\n }\n\n .", " {\n padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n .", ", .", " {\n width: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level unless wrapped in fragment mark */\n ", "\n\n ", ";\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n .", " {\n display: grid;\n align-items: center;\n position: absolute;\n z-index: ", ";\n\n .", " {\n position: absolute;\n align-self: end;\n height: 100%;\n width: 18px;\n }\n\n .", " {\n position: absolute;\n bottom: -3px;\n left: 2px;\n background-color: ", ";\n height: 4px;\n width: 4px;\n border-radius: 50%;\n pointer-events: none;\n }\n }\n\n .", " {\n .", " {\n height: 24px;\n position: absolute;\n top: ", ";\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n height: 24px;\n width: 100%;\n }\n\n .", " {\n background-color: ", ";\n height: 4px;\n width: 4px;\n border-radius: 50%;\n position: absolute;\n right: -2px;\n }\n }\n\n .", " {\n background: none;\n border: none;\n outline: none;\n position: absolute;\n margin: 0;\n padding: 0;\n display: flex;\n align-items: center;\n cursor: pointer;\n\n :focus {\n outline: none;\n }\n }\n\n .", " {\n cursor: grab;\n pointer-events: auto;\n\n line-height: 0;\n padding: 0;\n border-radius: 6px;\n width: max-content;\n border: 2px solid ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n background: transparent;\n outline: none;\n\n &.placeholder {\n background-color: transparent;\n border: 2px solid transparent;\n }\n\n &.", " {\n cursor: pointer;\n & svg {\n & > rect.", " {\n fill: ", ";\n }\n & > rect {\n fill: ", ";\n }\n & > g > rect {\n fill: ", ";\n }\n }\n }\n\n &:not(.", ") {\n & svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n\n &:hover {\n svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n }\n\n &:active {\n cursor: grabbing;\n }\n\n &.selected {\n :focus {\n outline: 2px solid ", ";\n outline-offset: 1px;\n }\n\n &:active {\n outline: none;\n }\n\n svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n }\n\n &.danger {\n svg {\n rect {\n fill: ", ";\n }\n g {\n fill: ", ";\n }\n }\n }\n }\n }\n\n ", "\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n // add a background above the first numbered column cell when sticky header is engaged\n // which hides the table when scrolling\n .", " {\n .", ":first-of-type::after {\n content: '';\n display: block;\n height: 33px;\n width: 100%;\n background-color: ", ";\n position: absolute;\n\n // the extra pixel is accounting for borders\n top: -34px;\n left: -1px;\n }\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 0px;\n\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", ":not(.", ") {\n cursor: pointer;\n }\n .", ":not(.", "):hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n // Allows better positioning for the shadow sentinels - ED-16668\n position: relative;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n /* ED-19064: To fix when enable header column in the table,\n and selection the header column, the right border is not tableBorderSelectedColor\n when deleting the header column, the right border is not tableToolbarDeleteColor */\n td.", ",\n td.", ",\n th.", ".", ",\n th.", ".", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n ", ";\n z-index: ", ";\n }\n\n &.", ".", "::after {\n ", ";\n z-index: ", ";\n }\n }\n }\n\n // override for DnD controls\n .", " {\n position: absolute;\n margin-top: ", "px;\n left: -", "px;\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n /* top of corner control is table margin top - corner control height + 1 pixel of table border. */\n top: ", "px;\n left: -", "px;\n }\n\n .", ".", ",\n .", ".", " {\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n top: ", "px;\n }\n\n .", " .", " {\n position: fixed;\n /* higher zIndex than sticky header which is akEditorTableCellOnStickyHeaderZIndex - 5 */\n z-index: ", ";\n }\n\n .", " {\n padding-bottom: 0px;\n /* fixes gap cursor height */\n overflow: auto;\n overflow-y: hidden;\n position: relative;\n\n > table[data-number-column='true'] {\n width: calc(100% - 1px);\n }\n }\n"])), tableSharedStyle(), columnControlsLineMarker(), hoveredDeleteButton(), hoveredCell(), hoveredWarningCell, ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableDragAndDrop) && insertLine(), resizeHandle((_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.tableDragAndDrop), rangeSelectionStyles, viewModeSortStyles(), ClassName.LAST_ITEM_IN_CELL, ClassName.TABLE_NODE_WRAPPER, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.TABLE_CELL, tableCellBackgroundColor, tableBorderColor, tableBorderColor, ClassName.CONTROLS_FLOATING_BUTTON_COLUMN, insertColumnButtonWrapper(), ClassName.CONTROLS_FLOATING_BUTTON_ROW, insertRowButtonWrapper(), dragInsertButtonWrapper(), dragCornerControlButton(), DeleteButton(), ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, stickyRowOffsetTop + 2, akEditorTableNumberColumnWidth, akEditorStickyHeaderZIndex, stickyRowOffsetTop, "var(--ds-surface, white)", ClassName.TABLE_STICKY, ClassName.CORNER_CONTROLS, akEditorSmallZIndex, "var(--ds-surface, white)", tableToolbarSize, tableToolbarSize, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize, tableToolbarSize, tableStickyHeaderColumnControlsDecorationsStyle(), tableStickyHeaderFirefoxFixStyle(), ClassName.TABLE_STICKY, ClassName.ROW_CONTROLS, ClassName.ROW_CONTROLS_BUTTON_WRAP, akEditorStickyHeaderZIndex, tableToolbarSize, "var(--ds-surface, white)", tableToolbarSize, ClassName.TABLE_STICKY, "var(--ds-surface, green)", stickyRowOffsetTop, akEditorTableCellOnStickyHeaderZIndex - 5, "var(--ds-surface, white)", "var(--ds-shadow-overflow-perimeter, ".concat(N40A, ")"), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, akEditorTableCellOnStickyHeaderZIndex, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tableToolbarSize, stickyHeaderBorderBottomWidth, tableBorderColor, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, insertColumnButtonOffset + 1, ClassName.TABLE_STICKY, ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY, ClassName.WITH_RESIZE_LINE, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2 + 1, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.WITH_CONTROLS, tableControlsSpacing, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, tableControlsSpacing + 2, ClassName.CORNER_CONTROLS, tableControlsSpacing - tableToolbarSize + 2, "var(--ds-surface, white)", sentinelStyles, OverflowShadow((_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.tableDragAndDrop), stickyScrollbarStyles(props.featureFlags), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tablePadding, ClassName.DRAG_ROW_CONTROLS_WRAPPER, ClassName.ROW_CONTROLS_WRAPPER, tablePadding, ClassName.DRAG_COLUMN_CONTROLS_WRAPPER, tablePadding, ClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth + tablePadding - 1, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, tableOverflowShadowWidth, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, ClassName.NODEVIEW_WRAPPER, breakoutWidthStyling(), columnControlsDecoration(), rowControlsWrapperDotStyle(), ClassName.CORNER_CONTROLS, tableToolbarSize + 1, cornerControlHeight, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, InsertMarker("\n left: -11px;\n top: 9px;\n "), ClassName.CORNER_CONTROLS, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize + 1, tableToolbarSize + 1, tableBorderColor, tableBorderRadiusSize, tableHeaderCellBackgroundColor, ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor, tableToolbarSelectedColor, ClassName.TABLE_CONTAINER, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1, ClassName.ROW_CONTROLS, ClassName.CONTROLS_BUTTON, ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor, tableToolbarSelectedColor, ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableBorderDeleteColor, tableToolbarDeleteColor, ClassName.ROW_CONTROLS, tableToolbarSize, InsertMarker("\n bottom: -1px;\n left: -11px;\n "), ClassName.ROW_CONTROLS_INNER, ClassName.ROW_CONTROLS_BUTTON_WRAP, tableBorderRadiusSize, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.CONTROLS_BUTTON, akEditorUnitZIndex, HeaderButton("\n border-bottom: 1px solid ".concat(tableBorderColor, ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(tableToolbarSize, "px;\n\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), ClassName.DRAG_ROW_CONTROLS, akEditorUnitZIndex, ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER, ClassName.DRAG_ROW_FLOATING_INSERT_DOT, "var(--ds-background-accent-gray-subtler, #C1C7D0)", ClassName.DRAG_COLUMN_CONTROLS, ClassName.DRAG_COLUMN_CONTROLS_INNER, "var(--ds-space-negative-150, -12px)", resizeHandlerZIndex, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT, "var(--ds-background-accent-gray-subtler, #C1C7D0)", ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE, ClassName.DRAG_HANDLE_BUTTON_CONTAINER, "var(--ds-surface, ".concat(N0, ")"), ClassName.DRAG_HANDLE_DISABLED, ClassName.DRAG_HANDLE_MINIMISED, "var(--ds-background-accent-gray-subtler, #DCDFE4)", "var(--ds-background-accent-gray-subtlest, #F4F5F7)", "var(--ds-icon-disabled, #BFDBF847)", ClassName.DRAG_HANDLE_DISABLED, "var(--ds-background-accent-gray-subtler, #DCDFE4)", "var(--ds-icon-subtle, #626f86)", "var(--ds-background-accent-blue-subtle, #579DFF)", "var(--ds-icon-inverse, #FFF)", "var(--ds-border-focused, #2684FF)", "var(--ds-background-accent-blue-subtle, #579dff)", "var(--ds-icon-inverse, #fff)", "var(--ds-background-accent-red-subtler-pressed, #F87462)", "var(--ds-border-inverse, #FFF)", floatingColumnControls(), ClassName.IS_RESIZING, ClassName.ROW_CONTROLS, HeaderButtonHover(), HeaderButtonDanger(), ClassName.NUMBERED_COLUMN, akEditorTableToolbarSize, (_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.tableDragAndDrop ? 0 : akEditorTableToolbarSize, akEditorTableNumberColumnWidth + 1, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderColor, relativeFontSizeToBase16(fontSize()), tableHeaderCellBackgroundColor, tableTextColor, tableBorderColor, tableBorderColor, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, "var(--ds-surface, white)", ClassName.WITH_CONTROLS, ClassName.CORNER_CONTROLS, ClassName.ROW_CONTROLS, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.IS_RESIZING, ClassName.WITH_CONTROLS, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.NUMBERED_COLUMN_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableToolbarDeleteColor, tableBorderDeleteColor, "var(--ds-text-danger, ".concat(R500, ")"), akEditorUnitZIndex, ClassName.TABLE_NODE_WRAPPER, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, akEditorSmallZIndex, ClassName.SELECTED_CELL, tableBorderSelectedColor, ClassName.SELECTED_CELL, tableCellSelectedColor, akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, ClassName.HOVERED_CELL_IN_DANGER, tableCellDeleteColor, akEditorUnitZIndex * 100, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.HOVERED_CELL, tableBorderSelectedColor, akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, tableBorderStyles(), akEditorUnitZIndex * 100, ClassName.HOVERED_NO_HIGHLIGHT, ClassName.HOVERED_CELL_IN_DANGER, tableBorderStyles(), akEditorUnitZIndex * 100, ClassName.DRAG_ROW_CONTROLS_WRAPPER, tableMarginTop, tableToolbarSize + 1, rowControlsZIndex + 4, ClassName.ROW_CONTROLS_WRAPPER, tableMarginTop - cornerControlHeight + 1, tableToolbarSize, ClassName.DRAG_ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, ClassName.ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, akEditorUnitZIndex, ClassName.DRAG_COLUMN_CONTROLS_WRAPPER, tableMarginTop, ClassName.TABLE_STICKY, ClassName.DRAG_COLUMN_CONTROLS_WRAPPER, akEditorTableCellOnStickyHeaderZIndex - 4, ClassName.TABLE_NODE_WRAPPER);
|
|
67
74
|
};
|
|
68
75
|
|
|
69
76
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4139
|
|
70
77
|
export var tableStyles = function tableStyles(props) {
|
|
71
|
-
return css(
|
|
78
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n .ProseMirror {\n ", "\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n ", "\n"])), baseTableStyles(props), ClassName.IS_RESIZING, ClassName.TABLE_NODE_WRAPPER, scrollbarStyles, ClassName.RESIZE_CURSOR, shadowSentinelStyles);
|
|
72
79
|
};
|
|
73
80
|
|
|
74
81
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
75
|
-
export var tableFullPageEditorStyles = css(
|
|
76
|
-
export var tableCommentEditorStyles = css(
|
|
82
|
+
export var tableFullPageEditorStyles = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n .ProseMirror .", " > table {\n margin-left: 0;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n width: 100%;\n }\n"])), ClassName.TABLE_NODE_WRAPPER);
|
|
83
|
+
export var tableCommentEditorStyles = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n .ProseMirror .", " > table {\n margin-left: 0;\n margin-right: 0;\n ", ";\n }\n"])), ClassName.TABLE_NODE_WRAPPER, scrollbarStyles);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This plugin allows sorting of table nodes in the Editor without modifying the underlying ProseMirror document.
|
|
3
|
+
* Instead of making changes to the ProseMirror document, the plugin sorts the table rows in the DOM. This allows the sorting to be
|
|
4
|
+
* visible to the user without affecting the document's content.
|
|
5
|
+
*/
|
|
6
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type tablePlugin from '../../plugin';
|
|
9
|
+
import type { ViewModeSortPluginState } from './types';
|
|
10
|
+
export declare const createPlugin: (editorViewModeAPI: ExtractInjectionAPI<typeof tablePlugin>['editorViewMode']) => SafePlugin<ViewModeSortPluginState>;
|