@atlaskit/editor-plugin-table 0.1.2 → 0.2.1

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/plugins/table/commands/misc.js +4 -2
  3. package/dist/cjs/plugins/table/create-plugin-config.js +0 -1
  4. package/dist/cjs/plugins/table/event-handlers.js +5 -6
  5. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +2 -2
  6. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -5
  7. package/dist/cjs/plugins/table/reducer.js +3 -2
  8. package/dist/cjs/plugins/table/types.js +2 -1
  9. package/dist/cjs/plugins/table/ui/common-styles.js +8 -1
  10. package/dist/cjs/plugins/table/ui/ui-styles.js +4 -4
  11. package/dist/cjs/plugins/table/utils/column-controls.js +1 -1
  12. package/dist/cjs/plugins/table/utils/decoration.js +16 -5
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/plugins/table/commands/misc.js +4 -2
  15. package/dist/es2019/plugins/table/create-plugin-config.js +0 -1
  16. package/dist/es2019/plugins/table/event-handlers.js +6 -7
  17. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +2 -2
  18. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -8
  19. package/dist/es2019/plugins/table/reducer.js +3 -2
  20. package/dist/es2019/plugins/table/types.js +2 -1
  21. package/dist/es2019/plugins/table/ui/common-styles.js +16 -17
  22. package/dist/es2019/plugins/table/ui/ui-styles.js +67 -24
  23. package/dist/es2019/plugins/table/utils/column-controls.js +1 -1
  24. package/dist/es2019/plugins/table/utils/decoration.js +16 -5
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/plugins/table/commands/misc.js +4 -2
  27. package/dist/esm/plugins/table/create-plugin-config.js +0 -1
  28. package/dist/esm/plugins/table/event-handlers.js +6 -7
  29. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +2 -2
  30. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -8
  31. package/dist/esm/plugins/table/reducer.js +3 -2
  32. package/dist/esm/plugins/table/types.js +2 -1
  33. package/dist/esm/plugins/table/ui/common-styles.js +8 -1
  34. package/dist/esm/plugins/table/ui/ui-styles.js +5 -5
  35. package/dist/esm/plugins/table/utils/column-controls.js +1 -1
  36. package/dist/esm/plugins/table/utils/decoration.js +16 -5
  37. package/dist/esm/version.json +1 -1
  38. package/dist/types/plugins/table/commands/misc.d.ts +1 -1
  39. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +1 -1
  40. package/dist/types/plugins/table/types.d.ts +3 -1
  41. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  42. package/package.json +2 -2
  43. package/src/__tests__/unit/event-handlers.ts +1 -1
  44. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +5 -4
  45. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +8 -0
  46. package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +5228 -0
  47. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +3 -0
  48. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +3 -0
  49. package/src/__tests__/visual-regression/cell-options-menu.ts +110 -99
  50. package/src/__tests__/visual-regression/index.ts +56 -44
  51. package/src/__tests__/visual-regression/sticky-header.ts +55 -0
  52. package/src/plugins/table/commands/misc.ts +10 -2
  53. package/src/plugins/table/create-plugin-config.ts +0 -1
  54. package/src/plugins/table/event-handlers.ts +9 -7
  55. package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +4 -2
  56. package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +5 -11
  57. package/src/plugins/table/reducer.ts +3 -1
  58. package/src/plugins/table/types.ts +7 -2
  59. package/src/plugins/table/ui/common-styles.ts +16 -20
  60. package/src/plugins/table/ui/ui-styles.ts +66 -25
  61. package/src/plugins/table/utils/column-controls.ts +1 -1
  62. package/src/plugins/table/utils/decoration.ts +17 -4
@@ -9,6 +9,13 @@ import { tableCellBackgroundColor, tableToolbarColor, tableBorderColor, tableCel
9
9
  import { HeaderButton, HeaderButtonHover, HeaderButtonDanger, insertColumnButtonWrapper, insertRowButtonWrapper, columnControlsLineMarker, DeleteButton, OverflowShadow, columnControlsDecoration, hoveredDeleteButton, hoveredCell, hoveredWarningCell, resizeHandle, InsertMarker } from './ui-styles';
10
10
  import { token } from '@atlaskit/tokens';
11
11
  const cornerControlHeight = tableToolbarSize + 1;
12
+ /*
13
+ compensating for half of the insert column button
14
+ that is aligned to the right edge initially on hover of the top right column control when table overflown,
15
+ its center should be aligned with the edge
16
+ */
17
+
18
+ const insertColumnButtonOffset = tableInsertColumnButtonSize / 2;
12
19
  const rangeSelectionStyles = `
13
20
  .${ClassName.NODEVIEW_WRAPPER}.${akEditorSelectedNodeClassName} table tbody tr {
14
21
  th,td {
@@ -216,7 +223,7 @@ export const tableStyles = props => {
216
223
  /* add a little bit so the scroll lines up with the table */
217
224
  .${ClassName.TABLE_STICKY} tr.sticky::after {
218
225
  content: ' ';
219
- width: 1px;
226
+ width: ${insertColumnButtonOffset + 1}px;
220
227
  }
221
228
 
222
229
  /* To fix jumpiness caused in Chrome Browsers for sticky headers */
@@ -327,15 +334,6 @@ export const tableStyles = props => {
327
334
  top: 9px;
328
335
  `)};
329
336
  }
330
-
331
- .${ClassName.CORNER_CONTROLS_INSERT_COLUMN_MARKER} {
332
- position: relative;
333
-
334
- ${InsertMarker(props, `
335
- right: -1px;
336
- top: -12px;
337
- `)};
338
- }
339
337
  }
340
338
 
341
339
  .${ClassName.CORNER_CONTROLS}.sticky {
@@ -516,6 +514,12 @@ export const tableStyles = props => {
516
514
  /* Table */
517
515
  .${ClassName.TABLE_NODE_WRAPPER} > table {
518
516
  table-layout: fixed;
517
+ white-space: normal;
518
+ border-top: none;
519
+
520
+ > tbody > tr {
521
+ white-space: pre-wrap;
522
+ }
519
523
 
520
524
  .${ClassName.COLUMN_CONTROLS_DECORATIONS} + * {
521
525
  margin-top: 0;
@@ -600,13 +604,8 @@ export const tableStyles = props => {
600
604
  left: -${tableToolbarSize}px;
601
605
  }
602
606
  .${ClassName.TABLE_NODE_WRAPPER} {
603
- /*
604
- compensating for half of the insert column button
605
- that is aligned to the right edge initially on hover of the top right column control when table overflown,
606
- its center should be aligned with the edge
607
- */
608
- padding-right: ${tableInsertColumnButtonSize / 2}px;
609
- margin-right: -${tableInsertColumnButtonSize / 2}px;
607
+ padding-right: ${insertColumnButtonOffset}px;
608
+ margin-right: -${insertColumnButtonOffset}px;
610
609
  padding-bottom: ${tableScrollbarOffset}px;
611
610
  margin-bottom: -${tableScrollbarOffset}px;
612
611
  /* fixes gap cursor height */
@@ -2,7 +2,7 @@ import { css } from '@emotion/react';
2
2
  import { tableCellBorderWidth, tableMarginBottom, tableMarginTop } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
4
4
  import { N40A, B300, N300, R300, N20A, N60A, N0, Y50, Y200 } from '@atlaskit/theme/colors';
5
- import { tableToolbarColor, tableBorderColor, tableToolbarSelectedColor, tableBorderSelectedColor, tableCellDeleteColor, tableBorderDeleteColor, tableToolbarDeleteColor, lineMarkerOffsetFromColumnControls, lineMarkerSize, columnControlsDecorationHeight, columnControlsZIndex, columnControlsSelectedZIndex, resizeHandlerAreaWidth, resizeLineWidth, resizeHandlerZIndex, tableToolbarSize, tableInsertColumnButtonSize, tableDeleteButtonSize, tableControlsSpacing } from './consts';
5
+ import { tableToolbarColor, tableBorderColor, tableToolbarSelectedColor, tableBorderSelectedColor, tableCellDeleteColor, tableBorderDeleteColor, tableToolbarDeleteColor, lineMarkerSize, columnControlsDecorationHeight, columnControlsZIndex, columnControlsSelectedZIndex, resizeHandlerAreaWidth, resizeLineWidth, resizeHandlerZIndex, tableToolbarSize, tableInsertColumnButtonSize, tableDeleteButtonSize } from './consts';
6
6
  import { TableCssClassName as ClassName } from '../types';
7
7
  import { borderRadius } from '@atlaskit/theme/constants';
8
8
  import { token } from '@atlaskit/tokens';
@@ -164,13 +164,6 @@ export const columnControlsLineMarker = props => css`
164
164
  tr:first-of-type
165
165
  th {
166
166
  position: relative;
167
-
168
- &::before {
169
- content: ' ';
170
- ${Marker(props)};
171
- top: -${tableToolbarSize + lineMarkerOffsetFromColumnControls}px;
172
- right: -${lineMarkerSize / 2}px;
173
- }
174
167
  }
175
168
  `;
176
169
  export const DeleteButton = css`
@@ -233,11 +226,6 @@ export const OverflowShadow = props => css`
233
226
  border-left: 1px solid ${tableBorderColor(props)};
234
227
  }
235
228
  }
236
- .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY} {
237
- .${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
238
- top: ${tableControlsSpacing}px;
239
- }
240
- }
241
229
  `;
242
230
  /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
243
231
 
@@ -271,6 +259,18 @@ export const columnControlsDecoration = props => css`
271
259
  top: -${columnControlsDecorationHeight + tableCellBorderWidth}px;
272
260
  height: ${columnControlsDecorationHeight}px;
273
261
 
262
+ &::before {
263
+ content: ' ';
264
+ background-color: ${tableBorderColor(props)};
265
+ position: absolute;
266
+ height: ${lineMarkerSize}px;
267
+ width: ${lineMarkerSize}px;
268
+ border-radius: 50%;
269
+ pointer-events: none;
270
+ top: 2px;
271
+ right: -1px;
272
+ }
273
+
274
274
  &::after {
275
275
  content: ' ';
276
276
 
@@ -287,6 +287,18 @@ export const columnControlsDecoration = props => css`
287
287
  }
288
288
  }
289
289
 
290
+ div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
291
+ content: ' ';
292
+ background-color: ${tableBorderColor(props)};
293
+ position: absolute;
294
+ height: ${lineMarkerSize}px;
295
+ width: ${lineMarkerSize}px;
296
+ border-radius: 50%;
297
+ pointer-events: none;
298
+ top: -${tableToolbarSize + tableCellBorderWidth}px;
299
+ right: -1px;
300
+ }
301
+
290
302
  .${ClassName.WITH_CONTROLS} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
291
303
  display: block;
292
304
  }
@@ -370,17 +382,48 @@ export const resizeHandle = css`
370
382
  z-index: ${resizeHandlerZIndex};
371
383
  }
372
384
 
373
- td.${ClassName.WITH_RESIZE_LINE}, th.${ClassName.WITH_RESIZE_LINE} {
374
- .${ClassName.RESIZE_HANDLE_DECORATION}::after {
375
- content: ' ';
376
- right: ${(resizeHandlerAreaWidth - resizeLineWidth) / 2}px;
377
- position: absolute;
378
- width: ${resizeLineWidth}px;
379
- height: calc(100% + 1px);
380
- background-color: ${tableBorderSelectedColor};
381
- z-index: ${columnControlsZIndex * 2};
382
- top: 0;
383
- }
385
+ td.${ClassName.WITH_RESIZE_LINE}::before {
386
+ content: ' ';
387
+ position: absolute;
388
+ left: -2px;
389
+ top: -1px;
390
+ width: ${resizeLineWidth}px;
391
+ height: calc(100% + 2px);
392
+ background-color: ${tableBorderSelectedColor};
393
+ z-index: ${columnControlsZIndex * 2};
394
+ }
395
+
396
+ th.${ClassName.WITH_RESIZE_LINE}::before {
397
+ content: ' ';
398
+ left: -2px;
399
+ position: absolute;
400
+ width: ${resizeLineWidth}px;
401
+ height: calc(100% + ${tableToolbarSize + tableCellBorderWidth}px);
402
+ background-color: ${tableBorderSelectedColor};
403
+ z-index: ${columnControlsZIndex * 2};
404
+ top: -${tableToolbarSize + tableCellBorderWidth}px;
405
+ }
406
+
407
+ td.${ClassName.WITH_RESIZE_LINE_LAST_COLUMN}::before {
408
+ content: ' ';
409
+ position: absolute;
410
+ right: -1px;
411
+ top: -1px;
412
+ width: ${resizeLineWidth}px;
413
+ height: calc(100% + 2px);
414
+ background-color: ${tableBorderSelectedColor};
415
+ z-index: ${columnControlsZIndex * 2};
416
+ }
417
+
418
+ th.${ClassName.WITH_RESIZE_LINE_LAST_COLUMN}::before {
419
+ content: ' ';
420
+ right: -1px;
421
+ position: absolute;
422
+ width: ${resizeLineWidth}px;
423
+ height: calc(100% + ${tableToolbarSize + tableCellBorderWidth}px);
424
+ background-color: ${tableBorderSelectedColor};
425
+ z-index: ${columnControlsZIndex * 2};
426
+ top: -${tableToolbarSize + tableCellBorderWidth}px;
384
427
  }
385
428
 
386
429
  table
@@ -153,7 +153,7 @@ export const colWidthsForRow = (colGroup, tr) => {
153
153
  if (copyTarget) {
154
154
  // either from the first row while it's still in the table
155
155
  const cellInfos = maphElem(copyTarget, cell => ({
156
- width: cell.offsetWidth,
156
+ width: cell.getBoundingClientRect().width,
157
157
  colspan: Number(cell.getAttribute('colspan') || 1),
158
158
  colwidth: cell.dataset.colwidth
159
159
  })); // reverse engineer cell widths from table widths
@@ -211,7 +211,7 @@ const makeArray = n => Array.from(Array(n).keys());
211
211
  */
212
212
 
213
213
 
214
- export const createResizeHandleDecoration = (tr, columnEndIndexTarget) => {
214
+ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget) => {
215
215
  const emptyResult = [[], []];
216
216
  const table = findTable(tr.selection);
217
217
 
@@ -265,6 +265,10 @@ export const createResizeHandleDecoration = (tr, columnEndIndexTarget) => {
265
265
  for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
266
266
  const seen = {};
267
267
 
268
+ if (rowIndex !== rowIndexTarget) {
269
+ continue;
270
+ }
271
+
268
272
  for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
269
273
  const cellPosition = map.map[map.width * rowIndex + columnIndex];
270
274
 
@@ -353,14 +357,21 @@ export const createColumnLineResize = (selection, cellColumnPositioning) => {
353
357
  return [];
354
358
  }
355
359
 
356
- const columnIndex = cellColumnPositioning.right - 1;
360
+ let columnIndex = cellColumnPositioning.right;
357
361
  const map = TableMap.get(table.node);
362
+ const isLastColumn = columnIndex === map.width;
363
+
364
+ if (isLastColumn) {
365
+ columnIndex -= 1;
366
+ }
367
+
368
+ const decorationClassName = isLastColumn ? ClassName.WITH_RESIZE_LINE_LAST_COLUMN : ClassName.WITH_RESIZE_LINE;
358
369
  const cellPositions = makeArray(map.height).map(rowIndex => map.map[map.width * rowIndex + columnIndex]).filter((cellPosition, rowIndex) => {
359
- if (columnIndex === map.width) {
370
+ if (isLastColumn) {
360
371
  return true; // If is the last column no filter applied
361
372
  }
362
373
 
363
- const nextPosition = map.map[map.width * rowIndex + columnIndex + 1];
374
+ const nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
364
375
  return cellPosition !== nextPosition; // Removed it if next position is merged
365
376
  });
366
377
  const cells = cellPositions.map(pos => ({
@@ -373,7 +384,7 @@ export const createColumnLineResize = (selection, cellColumnPositioning) => {
373
384
  }
374
385
 
375
386
  return Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
376
- class: ClassName.WITH_RESIZE_LINE
387
+ class: decorationClassName
377
388
  }, {
378
389
  key: `${TableDecorations.COLUMN_RESIZING_HANDLE_LINE}_${cellColumnPositioning.right}_${index}`
379
390
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "0.1.2"
3
+ "version": "0.2.1"
4
4
  }
@@ -50,6 +50,7 @@ export var setTableRef = function setTableRef(ref) {
50
50
  isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
51
51
  isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
52
52
  decorationSet: decorationSet,
53
+ resizeHandleRowIndex: undefined,
53
54
  resizeHandleColumnIndex: undefined
54
55
  }
55
56
  };
@@ -372,7 +373,7 @@ export var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton()
372
373
  return tr.setMeta('addToHistory', false);
373
374
  });
374
375
  };
375
- export var addResizeHandleDecorations = function addResizeHandleDecorations(columnIndex) {
376
+ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex) {
376
377
  return createCommand(function (state) {
377
378
  var tableNode = findTable(state.selection);
378
379
 
@@ -386,10 +387,11 @@ export var addResizeHandleDecorations = function addResizeHandleDecorations(colu
386
387
  return {
387
388
  type: 'ADD_RESIZE_HANDLE_DECORATIONS',
388
389
  data: {
389
- decorationSet: buildColumnResizingDecorations(columnIndex)({
390
+ decorationSet: buildColumnResizingDecorations(rowIndex, columnIndex)({
390
391
  tr: state.tr,
391
392
  decorationSet: getDecorations(state)
392
393
  }),
394
+ resizeHandleRowIndex: rowIndex,
393
395
  resizeHandleColumnIndex: columnIndex
394
396
  }
395
397
  };
@@ -13,7 +13,6 @@ export var pluginConfig = function pluginConfig() {
13
13
  allowHeaderRow: true,
14
14
  allowMergeCells: true,
15
15
  allowNumberColumn: true,
16
- stickToolbarToBottom: true,
17
16
  permittedLayouts: 'all',
18
17
  allowControls: true
19
18
  }, config) : config;
@@ -12,7 +12,7 @@ import { getPluginState } from './pm-plugins/plugin-factory';
12
12
  import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
13
13
  import { deleteColumns, deleteRows } from './transforms';
14
14
  import { RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
15
- import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableControlsButton, isTableContainerOrWrapper } from './utils';
15
+ import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, isCell, isColumnControlsDecorations, isCornerButton, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableControlsButton, isTableContainerOrWrapper } from './utils';
16
16
  import { getAllowAddColumnCustomStep } from './utils/get-allow-add-column-custom-step';
17
17
 
18
18
  var isFocusingCalendar = function isFocusingCalendar(event) {
@@ -267,7 +267,8 @@ export var handleMouseMove = function handleMouseMove(getEditorFeatureFlags) {
267
267
  _dispatch5 = view.dispatch;
268
268
 
269
269
  var _getPluginState5 = getPluginState(_state4),
270
- resizeHandleColumnIndex = _getPluginState5.resizeHandleColumnIndex;
270
+ resizeHandleColumnIndex = _getPluginState5.resizeHandleColumnIndex,
271
+ resizeHandleRowIndex = _getPluginState5.resizeHandleRowIndex;
271
272
 
272
273
  var tableCell = closestElement(element, 'td, th');
273
274
  var cellStartPosition = view.posAtDOM(tableCell, 0);
@@ -275,12 +276,10 @@ export var handleMouseMove = function handleMouseMove(getEditorFeatureFlags) {
275
276
 
276
277
  if (rect) {
277
278
  var columnEndIndexTarget = positionColumn === 'left' ? rect.left : rect.right;
279
+ var rowIndexTarget = rect.top;
278
280
 
279
- if (columnEndIndexTarget !== resizeHandleColumnIndex || !hasResizeHandler({
280
- target: element,
281
- columnEndIndexTarget: columnEndIndexTarget
282
- })) {
283
- return addResizeHandleDecorations(columnEndIndexTarget)(_state4, _dispatch5);
281
+ if (columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex) {
282
+ return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget)(_state4, _dispatch5);
284
283
  }
285
284
  }
286
285
  }
@@ -20,12 +20,12 @@ var updateLastCellElement = function updateLastCellElement(lastCellElementsDecor
20
20
  };
21
21
  };
22
22
 
23
- export var buildColumnResizingDecorations = function buildColumnResizingDecorations(columnEndIndex) {
23
+ export var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex) {
24
24
  return function (_ref3) {
25
25
  var tr = _ref3.tr,
26
26
  decorationSet = _ref3.decorationSet;
27
27
 
28
- var _ref4 = columnEndIndex < 0 ? emptyDecorations : createResizeHandleDecoration(tr, {
28
+ var _ref4 = columnEndIndex < 0 ? emptyDecorations : createResizeHandleDecoration(tr, rowEndIndex, {
29
29
  right: columnEndIndex
30
30
  }),
31
31
  _ref5 = _slicedToArray(_ref4, 2),
@@ -1,5 +1,4 @@
1
- import { tableCellBorderWidth, tableCellPadding, tableMarginTop } from '@atlaskit/editor-common/styles';
2
- import { browser } from '@atlaskit/editor-common/utils';
1
+ import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
3
2
  import { closestElement, containsClassName, parsePx } from '@atlaskit/editor-common/utils';
4
3
  import { updateOverflowShadows } from '../../../nodeviews/update-overflow-shadows';
5
4
  import { TableCssClassName as ClassName } from '../../../types';
@@ -79,12 +78,8 @@ export var updateStickyMargins = function updateStickyMargins(table) {
79
78
  }
80
79
 
81
80
  var paddingTop = parsePx(window.getComputedStyle(row).paddingTop || '') || 0;
82
- var firstRowHeight = row.clientHeight - paddingTop - 2;
83
- /* border */
84
- // firefox handles margin and padding differently
85
- // when applied with tables
86
-
87
- table.style.marginTop = "".concat(browser.gecko ? firstRowHeight + tableCellPadding - tableCellBorderWidth : tableMarginTop + firstRowHeight, "px");
81
+ var firstRowHeight = row.getBoundingClientRect().height - paddingTop - tableCellBorderWidth;
82
+ table.style.marginTop = "".concat(tableMarginTop + firstRowHeight, "px");
88
83
  };
89
84
  export var applyColWidthsToStickyRow = function applyColWidthsToStickyRow(colGroup, headerRow) {
90
85
  // sync column widths for the sticky row
@@ -70,11 +70,12 @@ export default (function (pluginState, action) {
70
70
 
71
71
  case 'HIDE_RESIZE_HANDLE_LINE':
72
72
  return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
73
- resizeHandleColumnIndex: undefined
73
+ resizeHandleColumnIndex: undefined,
74
+ resizeHandleRowIndex: undefined
74
75
  });
75
76
 
76
77
  case 'ADD_RESIZE_HANDLE_DECORATIONS':
77
- if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex) {
78
+ if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex) {
78
79
  return pluginState;
79
80
  }
80
81
 
@@ -80,7 +80,8 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
80
80
  TABLE_STICKY: "".concat(tablePrefixSelector, "-sticky"),
81
81
  TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
82
82
  LAST_ITEM_IN_CELL: "".concat(tablePrefixSelector, "-last-item-in-cell"),
83
- WITH_RESIZE_LINE: "".concat(tablePrefixSelector, "-column-resize-line")
83
+ WITH_RESIZE_LINE: "".concat(tablePrefixSelector, "-column-resize-line"),
84
+ WITH_RESIZE_LINE_LAST_COLUMN: "".concat(tablePrefixSelector, "-column-resize-line-last-column")
84
85
  });
85
86
  export var ShadowEvent;
86
87
 
@@ -13,13 +13,20 @@ import { tableCellBackgroundColor, tableToolbarColor, tableBorderColor, tableCel
13
13
  import { HeaderButton, HeaderButtonHover, HeaderButtonDanger, insertColumnButtonWrapper, insertRowButtonWrapper, columnControlsLineMarker, DeleteButton, OverflowShadow, columnControlsDecoration, hoveredDeleteButton, hoveredCell, hoveredWarningCell, resizeHandle, InsertMarker } from './ui-styles';
14
14
  import { token } from '@atlaskit/tokens';
15
15
  var cornerControlHeight = tableToolbarSize + 1;
16
+ /*
17
+ compensating for half of the insert column button
18
+ that is aligned to the right edge initially on hover of the top right column control when table overflown,
19
+ its center should be aligned with the edge
20
+ */
21
+
22
+ var insertColumnButtonOffset = tableInsertColumnButtonSize / 2;
16
23
  var rangeSelectionStyles = "\n.".concat(ClassName.NODEVIEW_WRAPPER, ".").concat(akEditorSelectedNodeClassName, " table tbody tr {\n th,td {\n ").concat(getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.Border]), "\n }\n}\n");
17
24
  var sentinelStyles = ".".concat(ClassName.TABLE_CONTAINER, " {\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_TOP, ", > .").concat(ClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n position: absolute;\n width: 100%;\n height: 1px;\n margin-top: -1px;\n // need this to avoid sentinel being focused via keyboard\n // this still allows it to be detected by intersection observer\n visibility: hidden;\n }\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_TOP, " {\n top: ").concat(columnControlsDecorationHeight, "px;\n }\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n bottom: ").concat(tableScrollbarOffset + stickyRowOffsetTop + tablePadding * 2 + 23, "px;\n }\n &.").concat(ClassName.WITH_CONTROLS, " {\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_TOP, " {\n top: 0px;\n }\n > .").concat(ClassName.TABLE_STICKY_SENTINEL_BOTTOM, " {\n margin-bottom: ").concat(columnControlsDecorationHeight, "px;\n }\n }\n}"); // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
18
25
 
19
26
  export var tableStyles = function tableStyles(props) {
20
27
  var _props$featureFlags;
21
28
 
22
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\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 /* 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 z-index: 0;\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 */\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: ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\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: 1px;\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\n .", ",\n tr.sticky\n .", " {\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 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 padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "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 */\n > * .", " .", " {\n margin-left: unset !important;\n width: 100% !important;\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 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 :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 .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 1px;\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 .", " {\n cursor: pointer;\n }\n .", ":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\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 td.", ", td.", " {\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 border: 1px solid ", ";\n z-index: ", ";\n }\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 }\n .", ".", " {\n z-index: ", ";\n }\n .", " {\n left: -", "px;\n }\n .", " {\n /*\n compensating for half of the insert column button\n that is aligned to the right edge initially on hover of the top right column control when table overflown,\n its center should be aligned with the edge\n */\n padding-right: ", "px;\n margin-right: -", "px;\n padding-bottom: ", "px;\n margin-bottom: -", "px;\n /* fixes gap cursor height */\n overflow: auto;\n position: relative;\n }\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n .ProseMirror .pm-table-cell-content-wrap ol[data-child-count='100+'] {\n padding-left: revert;\n }\n"])), ClassName.LAYOUT_BUTTON, token('color.background.neutral', N20A), token('color.icon', N300), ClassName.LAYOUT_BUTTON, ClassName.IS_RESIZING, token('color.background.neutral.hovered', B300), token('color.icon', 'white'), tableSharedStyle(props), columnControlsLineMarker(props), hoveredDeleteButton, hoveredCell, hoveredWarningCell, resizeHandle, rangeSelectionStyles, ClassName.LAST_ITEM_IN_CELL, ClassName.TABLE_NODE_WRAPPER, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.TABLE_CELL, tableCellBackgroundColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.CONTROLS_FLOATING_BUTTON_COLUMN, insertColumnButtonWrapper, ClassName.CONTROLS_FLOATING_BUTTON_ROW, insertRowButtonWrapper, DeleteButton, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, stickyRowOffsetTop + 2, akEditorTableNumberColumnWidth, akEditorStickyHeaderZIndex, stickyRowOffsetTop, token('elevation.surface', 'white'), ClassName.TABLE_STICKY, ClassName.CORNER_CONTROLS, akEditorSmallZIndex, token('elevation.surface', 'white'), tableToolbarSize, tableToolbarSize, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize, tableToolbarSize, ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_STICKY, ClassName.ROW_CONTROLS, ClassName.ROW_CONTROLS_BUTTON_WRAP, akEditorStickyHeaderZIndex, tableToolbarSize, token('elevation.surface', 'white'), tableToolbarSize, ClassName.TABLE_STICKY, token('elevation.surface', 'green'), stickyRowOffsetTop, stickyRowZIndex, token('elevation.surface', 'white'), token('elevation.shadow.overflow', "0 6px 4px -4px ".concat(N40A)), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, stickyRowZIndex + 1, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tableToolbarSize, stickyHeaderBorderBottomWidth, tableBorderColor(props), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, 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, token('elevation.surface', 'white'), (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : '', OverflowShadow(props), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tablePadding, ClassName.ROW_CONTROLS_WRAPPER, tablePadding, ClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth + tablePadding - 1, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, ClassName.NODEVIEW_WRAPPER, ClassName.NODEVIEW_WRAPPER, ClassName.TABLE_CONTAINER, columnControlsDecoration(props), ClassName.CORNER_CONTROLS, tableToolbarSize + 1, cornerControlHeight, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, InsertMarker(props, "\n left: -11px;\n top: 9px;\n "), ClassName.CORNER_CONTROLS_INSERT_COLUMN_MARKER, InsertMarker(props, "\n right: -1px;\n top: -12px;\n "), ClassName.CORNER_CONTROLS, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize + 1, tableToolbarSize + 1, tableBorderColor(props), tableBorderRadiusSize, tableToolbarColor(props), ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor, tableToolbarSelectedColor, ClassName.TABLE_CONTAINER, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, akEditorTableToolbarSize + akEditorTableNumberColumnWidth, 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(props, "\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(props, "\n border-bottom: 1px solid ".concat(tableBorderColor(props), ";\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.IS_RESIZING, ClassName.ROW_CONTROLS, HeaderButtonHover(), HeaderButtonDanger(), ClassName.NUMBERED_COLUMN, akEditorTableToolbarSize - 1, akEditorTableToolbarSize, akEditorTableNumberColumnWidth + 1, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderColor(props), relativeFontSizeToBase16(fontSize()), tableToolbarColor(props), tableTextColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.WITH_CONTROLS, ClassName.CORNER_CONTROLS, ClassName.ROW_CONTROLS, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, token('color.text.inverse', N0), ClassName.IS_RESIZING, ClassName.WITH_CONTROLS, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, token('color.text.inverse', N0), ClassName.NUMBERED_COLUMN_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableToolbarDeleteColor, tableBorderDeleteColor, token('color.text.inverse', 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, tableBorderSelectedColor, akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, tableBorderDeleteColor, akEditorUnitZIndex * 100, ClassName.ROW_CONTROLS_WRAPPER, tableMarginTop - cornerControlHeight + 1, ClassName.ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, akEditorUnitZIndex, ClassName.ROW_CONTROLS_WRAPPER, tableToolbarSize, ClassName.TABLE_NODE_WRAPPER, tableInsertColumnButtonSize / 2, tableInsertColumnButtonSize / 2, tableScrollbarOffset, tableScrollbarOffset, ClassName.IS_RESIZING, ClassName.TABLE_NODE_WRAPPER, scrollbarStyles, ClassName.RESIZE_CURSOR);
29
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\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 /* 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 z-index: 0;\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 */\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: ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\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\n .", ",\n tr.sticky\n .", " {\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 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 padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "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 */\n > * .", " .", " {\n margin-left: unset !important;\n width: 100% !important;\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 :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 .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: 1px;\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 .", " {\n cursor: pointer;\n }\n .", ":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\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 td.", ", td.", " {\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 border: 1px solid ", ";\n z-index: ", ";\n }\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 }\n .", ".", " {\n z-index: ", ";\n }\n .", " {\n left: -", "px;\n }\n .", " {\n padding-right: ", "px;\n margin-right: -", "px;\n padding-bottom: ", "px;\n margin-bottom: -", "px;\n /* fixes gap cursor height */\n overflow: auto;\n position: relative;\n }\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n .ProseMirror .pm-table-cell-content-wrap ol[data-child-count='100+'] {\n padding-left: revert;\n }\n"])), ClassName.LAYOUT_BUTTON, token('color.background.neutral', N20A), token('color.icon', N300), ClassName.LAYOUT_BUTTON, ClassName.IS_RESIZING, token('color.background.neutral.hovered', B300), token('color.icon', 'white'), tableSharedStyle(props), columnControlsLineMarker(props), hoveredDeleteButton, hoveredCell, hoveredWarningCell, resizeHandle, rangeSelectionStyles, ClassName.LAST_ITEM_IN_CELL, ClassName.TABLE_NODE_WRAPPER, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.TABLE_CELL, tableCellBackgroundColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.CONTROLS_FLOATING_BUTTON_COLUMN, insertColumnButtonWrapper, ClassName.CONTROLS_FLOATING_BUTTON_ROW, insertRowButtonWrapper, DeleteButton, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, stickyRowOffsetTop + 2, akEditorTableNumberColumnWidth, akEditorStickyHeaderZIndex, stickyRowOffsetTop, token('elevation.surface', 'white'), ClassName.TABLE_STICKY, ClassName.CORNER_CONTROLS, akEditorSmallZIndex, token('elevation.surface', 'white'), tableToolbarSize, tableToolbarSize, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize, tableToolbarSize, ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_STICKY, ClassName.ROW_CONTROLS, ClassName.ROW_CONTROLS_BUTTON_WRAP, akEditorStickyHeaderZIndex, tableToolbarSize, token('elevation.surface', 'white'), tableToolbarSize, ClassName.TABLE_STICKY, token('elevation.surface', 'green'), stickyRowOffsetTop, stickyRowZIndex, token('elevation.surface', 'white'), token('elevation.shadow.overflow', "0 6px 4px -4px ".concat(N40A)), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, stickyRowZIndex + 1, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tableToolbarSize, stickyHeaderBorderBottomWidth, tableBorderColor(props), 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, token('elevation.surface', 'white'), (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : '', OverflowShadow(props), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tablePadding, ClassName.ROW_CONTROLS_WRAPPER, tablePadding, ClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth + tablePadding - 1, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, ClassName.NODEVIEW_WRAPPER, ClassName.NODEVIEW_WRAPPER, ClassName.TABLE_CONTAINER, columnControlsDecoration(props), ClassName.CORNER_CONTROLS, tableToolbarSize + 1, cornerControlHeight, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, InsertMarker(props, "\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(props), tableBorderRadiusSize, tableToolbarColor(props), ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor, tableToolbarSelectedColor, ClassName.TABLE_CONTAINER, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, akEditorTableToolbarSize + akEditorTableNumberColumnWidth, 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(props, "\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(props, "\n border-bottom: 1px solid ".concat(tableBorderColor(props), ";\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.IS_RESIZING, ClassName.ROW_CONTROLS, HeaderButtonHover(), HeaderButtonDanger(), ClassName.NUMBERED_COLUMN, akEditorTableToolbarSize - 1, akEditorTableToolbarSize, akEditorTableNumberColumnWidth + 1, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderColor(props), relativeFontSizeToBase16(fontSize()), tableToolbarColor(props), tableTextColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.WITH_CONTROLS, ClassName.CORNER_CONTROLS, ClassName.ROW_CONTROLS, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, token('color.text.inverse', N0), ClassName.IS_RESIZING, ClassName.WITH_CONTROLS, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor, tableBorderSelectedColor, tableToolbarSelectedColor, akEditorUnitZIndex, token('color.text.inverse', N0), ClassName.NUMBERED_COLUMN_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableToolbarDeleteColor, tableBorderDeleteColor, token('color.text.inverse', 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, tableBorderSelectedColor, akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, tableBorderDeleteColor, akEditorUnitZIndex * 100, ClassName.ROW_CONTROLS_WRAPPER, tableMarginTop - cornerControlHeight + 1, ClassName.ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, akEditorUnitZIndex, ClassName.ROW_CONTROLS_WRAPPER, tableToolbarSize, ClassName.TABLE_NODE_WRAPPER, insertColumnButtonOffset, insertColumnButtonOffset, tableScrollbarOffset, tableScrollbarOffset, ClassName.IS_RESIZING, ClassName.TABLE_NODE_WRAPPER, scrollbarStyles, ClassName.RESIZE_CURSOR);
23
30
  };
24
31
  export var tableFullPageEditorStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .", " > table {\n margin-left: 0;\n margin-right: 0;\n width: 100%;\n }\n"])), ClassName.TABLE_NODE_WRAPPER);
25
32
  export var tableCommentEditorStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ProseMirror .", " > table {\n margin-left: 0;\n margin-right: 0;\n ", ";\n }\n"])), ClassName.TABLE_NODE_WRAPPER, scrollbarStyles);
@@ -6,7 +6,7 @@ import { css } from '@emotion/react';
6
6
  import { tableCellBorderWidth, tableMarginBottom, tableMarginTop } from '@atlaskit/editor-common/styles';
7
7
  import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
8
8
  import { N40A, B300, N300, R300, N20A, N60A, N0, Y50, Y200 } from '@atlaskit/theme/colors';
9
- import { tableToolbarColor, tableBorderColor, tableToolbarSelectedColor, tableBorderSelectedColor, tableCellDeleteColor, tableBorderDeleteColor, tableToolbarDeleteColor, lineMarkerOffsetFromColumnControls, lineMarkerSize, columnControlsDecorationHeight, columnControlsZIndex, columnControlsSelectedZIndex, resizeHandlerAreaWidth, resizeLineWidth, resizeHandlerZIndex, tableToolbarSize, tableInsertColumnButtonSize, tableDeleteButtonSize, tableControlsSpacing } from './consts';
9
+ import { tableToolbarColor, tableBorderColor, tableToolbarSelectedColor, tableBorderSelectedColor, tableCellDeleteColor, tableBorderDeleteColor, tableToolbarDeleteColor, lineMarkerSize, columnControlsDecorationHeight, columnControlsZIndex, columnControlsSelectedZIndex, resizeHandlerAreaWidth, resizeLineWidth, resizeHandlerZIndex, tableToolbarSize, tableInsertColumnButtonSize, tableDeleteButtonSize } from './consts';
10
10
  import { TableCssClassName as ClassName } from '../types';
11
11
  import { borderRadius } from '@atlaskit/theme/constants';
12
12
  import { token } from '@atlaskit/tokens';
@@ -48,14 +48,14 @@ var InsertButtonHover = function InsertButtonHover() {
48
48
  export var insertColumnButtonWrapper = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n"])), InsertButton(), InsertButtonHover(), InsertLine("\n width: 2px;\n left: 9px;\n "));
49
49
  export var insertRowButtonWrapper = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n"])), InsertButton(), InsertButtonHover(), InsertLine("\n height: 2px;\n top: -11px;\n left: ".concat(tableInsertColumnButtonSize - 1, "px;\n ")));
50
50
  export var columnControlsLineMarker = function columnControlsLineMarker(props) {
51
- return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n .", ".", "\n table\n tr:first-of-type\n td,\n .", ".", "\n table\n tr:first-of-type\n th {\n position: relative;\n\n &::before {\n content: ' ';\n ", ";\n top: -", "px;\n right: -", "px;\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.WITH_CONTROLS, ClassName.TABLE_CONTAINER, ClassName.WITH_CONTROLS, Marker(props), tableToolbarSize + lineMarkerOffsetFromColumnControls, lineMarkerSize / 2);
51
+ return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n .", ".", "\n table\n tr:first-of-type\n td,\n .", ".", "\n table\n tr:first-of-type\n th {\n position: relative;\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.WITH_CONTROLS, ClassName.TABLE_CONTAINER, ClassName.WITH_CONTROLS);
52
52
  };
53
53
  export var DeleteButton = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n .", ",\n .", " {\n height: ", "px;\n width: ", "px;\n }\n .", " {\n .", " {\n ", "\n }\n }\n\n .", ":hover {\n background: ", ";\n color: ", ";\n cursor: pointer;\n }\n"])), ClassName.CONTROLS_DELETE_BUTTON_WRAP, ClassName.CONTROLS_DELETE_BUTTON, tableDeleteButtonSize, tableDeleteButtonSize, ClassName.CONTROLS_DELETE_BUTTON_WRAP, ClassName.CONTROLS_DELETE_BUTTON, Button("\n background: ".concat(token('color.background.neutral', N20A), ";\n color: ").concat(token('color.icon', N300), ";\n ")), ClassName.CONTROLS_DELETE_BUTTON, token('color.background.danger.bold', R300), token('color.icon.inverse', 'white')); // TODO: https://product-fabric.atlassian.net/browse/DSP-4451
54
54
 
55
55
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
56
56
 
57
57
  export var OverflowShadow = function OverflowShadow(props) {
58
- return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n .", ", .", " {\n display: block;\n height: calc(\n 100% - ", "px\n );\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: 8px;\n }\n .", " {\n background: linear-gradient(to left, rgba(99, 114, 130, 0) 0, ", " 100%);\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n rgba(99, 114, 130, 0) 0,\n ", " 100%\n );\n left: calc(100% + 2px);\n }\n .", " {\n .", ", .", " {\n height: calc(100% - ", "px);\n top: ", "px;\n }\n .", " {\n border-left: 1px solid ", ";\n }\n }\n .", ".", " {\n .", ", .", " {\n top: ", "px;\n }\n }\n"])), ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTop + tableMarginBottom + tableToolbarSize - 2, tableMarginTop + tableToolbarSize - 1, akEditorShadowZIndex, ClassName.TABLE_LEFT_SHADOW, N40A, ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY_SHADOW, ClassName.TABLE_LEFT_SHADOW, akEditorTableNumberColumnWidth - 1, ClassName.TABLE_RIGHT_SHADOW, N40A, ClassName.WITH_CONTROLS, ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTop + tableMarginBottom - 2, tableMarginTop - 1, ClassName.TABLE_LEFT_SHADOW, tableBorderColor(props), ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableControlsSpacing);
58
+ return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n .", ", .", " {\n display: block;\n height: calc(\n 100% - ", "px\n );\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: 8px;\n }\n .", " {\n background: linear-gradient(to left, rgba(99, 114, 130, 0) 0, ", " 100%);\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n rgba(99, 114, 130, 0) 0,\n ", " 100%\n );\n left: calc(100% + 2px);\n }\n .", " {\n .", ", .", " {\n height: calc(100% - ", "px);\n top: ", "px;\n }\n .", " {\n border-left: 1px solid ", ";\n }\n }\n"])), ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTop + tableMarginBottom + tableToolbarSize - 2, tableMarginTop + tableToolbarSize - 1, akEditorShadowZIndex, ClassName.TABLE_LEFT_SHADOW, N40A, ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY_SHADOW, ClassName.TABLE_LEFT_SHADOW, akEditorTableNumberColumnWidth - 1, ClassName.TABLE_RIGHT_SHADOW, N40A, ClassName.WITH_CONTROLS, ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTop + tableMarginBottom - 2, tableMarginTop - 1, ClassName.TABLE_LEFT_SHADOW, tableBorderColor(props));
59
59
  };
60
60
  /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
61
61
 
@@ -65,9 +65,9 @@ var columnHeaderButton = function columnHeaderButton(props, cssString) {
65
65
 
66
66
  var columnHeaderButtonSelected = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n"])), token('color.text.inverse', N0), tableToolbarSelectedColor, tableBorderSelectedColor, columnControlsSelectedZIndex);
67
67
  export var columnControlsDecoration = function columnControlsDecoration(props) {
68
- return css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n"])), ClassName.COLUMN_CONTROLS_DECORATIONS, tableCellBorderWidth * 2, columnControlsDecorationHeight + tableCellBorderWidth, columnControlsDecorationHeight, columnHeaderButton(props, "\n border-right: ".concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-bottom: none;\n height: ").concat(tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(columnControlsDecorationHeight - tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(columnControlsZIndex, ";\n ")), ClassName.WITH_CONTROLS, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.HOVERED_TABLE, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected, ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor, tableBorderDeleteColor, akEditorUnitZIndex * 100, ClassName.TABLE_SELECTED, ClassName.TABLE_CELL, ClassName.TABLE_SELECTED, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected);
68
+ return css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n"])), ClassName.COLUMN_CONTROLS_DECORATIONS, tableCellBorderWidth * 2, columnControlsDecorationHeight + tableCellBorderWidth, columnControlsDecorationHeight, tableBorderColor(props), lineMarkerSize, lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-bottom: none;\n height: ").concat(tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(columnControlsDecorationHeight - tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(columnControlsZIndex, ";\n ")), ClassName.WITH_CONTROLS, ClassName.ROW_CONTROLS_WRAPPER, tableBorderColor(props), lineMarkerSize, lineMarkerSize, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_CONTROLS, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.HOVERED_TABLE, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected, ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor, tableBorderDeleteColor, akEditorUnitZIndex * 100, ClassName.TABLE_SELECTED, ClassName.TABLE_CELL, ClassName.TABLE_SELECTED, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected);
69
69
  };
70
70
  export var hoveredDeleteButton = css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n .", ".", " {\n .", ",\n .", ",\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.SELECTED_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_CELL, tableBorderDeleteColor, ClassName.SELECTED_CELL, tableCellDeleteColor);
71
71
  export var hoveredCell = css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n :not(.", ")\n .", ":not(.", ") {\n .", " {\n position: relative;\n border: 1px solid ", ";\n }\n }\n"])), ClassName.IS_RESIZING, ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.HOVERED_CELL, tableBorderSelectedColor);
72
72
  export var hoveredWarningCell = css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n :not(.", ")\n .", ":not(.", ") {\n td.", " {\n background-color: ", " !important; // We need to override the background-color added to the cell\n border: 1px solid ", ";\n }\n }\n"])), ClassName.IS_RESIZING, ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.HOVERED_CELL_WARNING, token('color.background.warning', Y50), token('color.border.warning', Y200));
73
- export var resizeHandle = css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n td.", ", th.", " {\n .", "::after {\n content: ' ';\n right: ", "px;\n position: absolute;\n width: ", "px;\n height: calc(100% + 1px);\n background-color: ", ";\n z-index: ", ";\n top: 0;\n }\n }\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.RESIZE_HANDLE_DECORATION, resizeHandlerAreaWidth, resizeHandlerAreaWidth / 2, resizeHandlerZIndex, ClassName.WITH_RESIZE_LINE, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2, resizeLineWidth, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, tableToolbarSize + tableCellBorderWidth, tableToolbarSize + tableCellBorderWidth);
73
+ export var resizeHandle = css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: -2px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: -2px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.RESIZE_HANDLE_DECORATION, resizeHandlerAreaWidth, resizeHandlerAreaWidth / 2, resizeHandlerZIndex, ClassName.WITH_RESIZE_LINE, resizeLineWidth, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE, resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor, columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor, columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, tableToolbarSize + tableCellBorderWidth, tableToolbarSize + tableCellBorderWidth);
@@ -166,7 +166,7 @@ export var colWidthsForRow = function colWidthsForRow(colGroup, tr) {
166
166
  // either from the first row while it's still in the table
167
167
  var cellInfos = maphElem(copyTarget, function (cell) {
168
168
  return {
169
- width: cell.offsetWidth,
169
+ width: cell.getBoundingClientRect().width,
170
170
  colspan: Number(cell.getAttribute('colspan') || 1),
171
171
  colwidth: cell.dataset.colwidth
172
172
  };