@atlaskit/renderer 118.1.0 → 118.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/react/nodes/mediaGroup.js +6 -3
- package/dist/cjs/react/nodes/table/sticky.js +2 -1
- package/dist/cjs/react/nodes/table/table.js +7 -2
- package/dist/cjs/react/nodes/table.js +46 -16
- package/dist/cjs/react/nodes/tableNew.js +116 -88
- package/dist/cjs/react/utils/EditorMediaClientProvider.js +8 -22
- package/dist/cjs/ui/Renderer/index.js +3 -9
- package/dist/cjs/ui/annotations/element/mark.js +16 -23
- package/dist/cjs/ui/annotations/hooks/use-events.js +1 -1
- package/dist/es2019/react/nodes/mediaGroup.js +6 -3
- package/dist/es2019/react/nodes/table/sticky.js +2 -1
- package/dist/es2019/react/nodes/table/table.js +6 -2
- package/dist/es2019/react/nodes/table.js +45 -17
- package/dist/es2019/react/nodes/tableNew.js +112 -94
- package/dist/es2019/react/utils/EditorMediaClientProvider.js +10 -24
- package/dist/es2019/ui/Renderer/index.js +3 -9
- package/dist/es2019/ui/annotations/element/mark.js +16 -25
- package/dist/es2019/ui/annotations/hooks/use-events.js +1 -1
- package/dist/esm/react/nodes/mediaGroup.js +6 -3
- package/dist/esm/react/nodes/table/sticky.js +2 -1
- package/dist/esm/react/nodes/table/table.js +7 -2
- package/dist/esm/react/nodes/table.js +46 -16
- package/dist/esm/react/nodes/tableNew.js +118 -90
- package/dist/esm/react/utils/EditorMediaClientProvider.js +10 -24
- package/dist/esm/ui/Renderer/index.js +3 -9
- package/dist/esm/ui/annotations/element/mark.js +16 -23
- package/dist/esm/ui/annotations/hooks/use-events.js +1 -1
- package/dist/types/react/nodes/table/table.d.ts +2 -1
- package/dist/types/react/nodes/table.d.ts +1 -1
- package/dist/types/react/nodes/tableNew.d.ts +33 -0
- package/dist/types/ui/annotations/element/mark.d.ts +0 -6
- package/dist/types-ts4.5/react/nodes/table/table.d.ts +2 -1
- package/dist/types-ts4.5/react/nodes/table.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/tableNew.d.ts +33 -0
- package/dist/types-ts4.5/ui/annotations/element/mark.d.ts +0 -6
- package/package.json +11 -14
|
@@ -12,30 +12,17 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
12
12
|
/* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
15
|
+
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
16
|
+
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
15
17
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
16
18
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
17
|
-
import {
|
|
19
|
+
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
18
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
19
21
|
import { TableHeader } from './tableCell';
|
|
20
22
|
import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
|
|
21
23
|
import { Table } from './table/table';
|
|
22
|
-
import {
|
|
23
|
-
import { isCommentAppearance, isFullWidthOrFullPageAppearance } from '../utils/appearance';
|
|
24
|
+
import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isFullPageAppearance } from '../utils/appearance';
|
|
24
25
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
25
|
-
var getResizerMinWidth = function getResizerMinWidth(node) {
|
|
26
|
-
var currentColumnCount = getColgroupChildrenLength(node);
|
|
27
|
-
var minColumnWidth = Math.min(3, currentColumnCount) * COLUMN_MIN_WIDTH;
|
|
28
|
-
// add an extra pixel as the scale table logic will scale columns to be tableContainerWidth - 1
|
|
29
|
-
// the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
|
|
30
|
-
return minColumnWidth + 1;
|
|
31
|
-
};
|
|
32
|
-
var getColgroupChildrenLength = function getColgroupChildrenLength(table) {
|
|
33
|
-
var map = TableMap.get(table);
|
|
34
|
-
return map.width;
|
|
35
|
-
};
|
|
36
|
-
var gutterPadding = akEditorGutterPaddingDynamic() * 2;
|
|
37
|
-
var TABLE_MAX_WIDTH = 1800;
|
|
38
|
-
var COLUMN_MIN_WIDTH = 48;
|
|
39
26
|
export var isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
40
27
|
return isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance) && editorExperiment('support_table_in_comment', true, {
|
|
41
28
|
exposure: true
|
|
@@ -127,6 +114,9 @@ export var isHeaderRowEnabled = function isHeaderRowEnabled(rows) {
|
|
|
127
114
|
export var tableCanBeSticky = function tableCanBeSticky(node, children) {
|
|
128
115
|
return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
|
|
129
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* TableContainer renders tables using only CSS-based rules
|
|
119
|
+
*/
|
|
130
120
|
// Ignored via go/ees005
|
|
131
121
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
132
122
|
export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
@@ -253,7 +243,12 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
253
243
|
_inherits(TableContainer, _React$Component);
|
|
254
244
|
return _createClass(TableContainer, [{
|
|
255
245
|
key: "componentDidMount",
|
|
256
|
-
value:
|
|
246
|
+
value:
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
*/
|
|
251
|
+
function componentDidMount() {
|
|
257
252
|
this.resizeObserver = new ResizeObserver(this.applyResizerChange);
|
|
258
253
|
if (this.wrapperRef.current) {
|
|
259
254
|
this.resizeObserver.observe(this.wrapperRef.current);
|
|
@@ -272,6 +267,13 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
272
267
|
this.stickyScrollbar = new TableStickyScrollbar(this.wrapperRef.current);
|
|
273
268
|
}
|
|
274
269
|
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
*
|
|
273
|
+
* @param prevProps
|
|
274
|
+
* @param prevState
|
|
275
|
+
* @example
|
|
276
|
+
*/
|
|
275
277
|
}, {
|
|
276
278
|
key: "componentDidUpdate",
|
|
277
279
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
@@ -298,12 +300,20 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
298
300
|
}
|
|
299
301
|
}, {
|
|
300
302
|
key: "pinTop",
|
|
301
|
-
get:
|
|
303
|
+
get:
|
|
304
|
+
/**
|
|
305
|
+
*
|
|
306
|
+
*/
|
|
307
|
+
function get() {
|
|
302
308
|
if (!this.tableRef.current || !this.stickyHeaderRef.current) {
|
|
303
309
|
return;
|
|
304
310
|
}
|
|
305
311
|
return this.tableRef.current.offsetHeight - this.stickyHeaderRef.current.offsetHeight + tableMarginTop - tableStickyPadding;
|
|
306
312
|
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
*
|
|
316
|
+
*/
|
|
307
317
|
}, {
|
|
308
318
|
key: "shouldAddOverflowParentOffsetTop_DO_NOT_USE",
|
|
309
319
|
get: function get() {
|
|
@@ -313,6 +323,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
313
323
|
// THEN we should add the OverflowParent offset top (RETURN TRUE)
|
|
314
324
|
return this.props.stickyHeaders && !!this.props.stickyHeaders.shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE && !!this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE && this.overflowParent && this.overflowParent.id === this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE;
|
|
315
325
|
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
*
|
|
329
|
+
*/
|
|
316
330
|
}, {
|
|
317
331
|
key: "stickyTop",
|
|
318
332
|
get: function get() {
|
|
@@ -331,6 +345,11 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
331
345
|
return undefined;
|
|
332
346
|
}
|
|
333
347
|
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
*/
|
|
334
353
|
}, {
|
|
335
354
|
key: "render",
|
|
336
355
|
value: function render() {
|
|
@@ -345,92 +364,92 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
345
364
|
isInsideOfBlockNode = _this$props.isInsideOfBlockNode,
|
|
346
365
|
isInsideOfTable = _this$props.isInsideOfTable,
|
|
347
366
|
isinsideMultiBodiedExtension = _this$props.isinsideMultiBodiedExtension,
|
|
367
|
+
allowTableAlignment = _this$props.allowTableAlignment,
|
|
348
368
|
allowTableResizing = _this$props.allowTableResizing,
|
|
349
369
|
isPresentational = _this$props.isPresentational;
|
|
350
370
|
var stickyMode = this.state.stickyMode;
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
371
|
+
var lineLengthFixedWidth = akEditorDefaultLayoutWidth;
|
|
372
|
+
var updatedLayout;
|
|
373
|
+
var renderWidthCSS = rendererAppearance === 'full-page' ? "100cqw - ".concat(FullPagePadding, "px * 2") : "100cqw";
|
|
374
|
+
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode) {
|
|
375
|
+
if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
|
|
376
|
+
return "min(".concat(akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
|
|
377
|
+
} else if (rendererAppearance === 'comment' && allowTableResizing && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
|
|
378
|
+
return renderWidthCSS;
|
|
379
|
+
} else {
|
|
380
|
+
// custom width, or width mapped to breakpoint
|
|
381
|
+
var tableContainerWidth = getTableContainerWidth(tableNode);
|
|
382
|
+
return "min(".concat(tableContainerWidth, "px, ").concat(renderWidthCSS, ")");
|
|
356
383
|
}
|
|
357
|
-
// this scenario occurs when there is a full width table nested within a component (expand, column layout). In these cases
|
|
358
|
-
// the table should inherit the width of its parent component
|
|
359
|
-
if (rendererAppearance === 'full-page' && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) === TABLE_MAX_WIDTH && layout === 'align-start') {
|
|
360
|
-
return "100%";
|
|
361
|
-
}
|
|
362
|
-
return "".concat(tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width, "px");
|
|
363
384
|
};
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
385
|
+
var tableWidthCSS = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
|
|
386
|
+
|
|
387
|
+
// Logic for table alignment in renderer
|
|
388
|
+
var isTableAlignStart = tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && allowTableAlignment;
|
|
389
|
+
var fullWidthLineLengthCSS = "min(".concat(akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
|
|
390
|
+
var isCommentAppearanceAndTableAlignmentEnabled = isCommentAppearance(rendererAppearance) && allowTableAlignment;
|
|
391
|
+
var lineLengthCSS = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLengthCSS : isCommentAppearanceAndTableAlignmentEnabled ? renderWidthCSS : "".concat(lineLengthFixedWidth, "px");
|
|
392
|
+
var tableWidthNew = getTableContainerWidth(tableNode);
|
|
393
|
+
var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && !isInsideOfTable && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
|
|
394
|
+
var leftCSS;
|
|
395
|
+
if (shouldCalculateLeftForAlignment) {
|
|
396
|
+
leftCSS = "(".concat(tableWidthCSS, " - ").concat(lineLengthCSS, ") / 2");
|
|
397
|
+
}
|
|
398
|
+
if (!shouldCalculateLeftForAlignment && isFullPageAppearance(rendererAppearance)) {
|
|
399
|
+
// Note tableWidthCSS here is the renderer width
|
|
400
|
+
// When the screen is super wide we want table to break out.
|
|
401
|
+
// However if screen is smaller than 760px. We want table align to left.
|
|
402
|
+
leftCSS = "min(0px, ".concat(lineLengthCSS, " - ").concat(tableWidthCSS, ") / 2");
|
|
369
403
|
}
|
|
404
|
+
var children = React.Children.toArray(this.props.children);
|
|
370
405
|
|
|
371
406
|
// Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
|
|
372
407
|
// This check caters for those tables and helps with SSR logic
|
|
373
|
-
var isFullWidth = rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
408
|
+
var isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
374
409
|
if (isFullWidth) {
|
|
375
|
-
|
|
410
|
+
updatedLayout = 'full-width';
|
|
376
411
|
// if table has width explicity set, ensure SSR is handled
|
|
377
412
|
} else if (tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) {
|
|
378
|
-
|
|
413
|
+
updatedLayout = 'custom';
|
|
379
414
|
} else {
|
|
380
|
-
|
|
415
|
+
updatedLayout = layout;
|
|
381
416
|
}
|
|
417
|
+
var finalTableContainerWidth = allowTableResizing ? tableWidthNew : 'inherit';
|
|
382
418
|
|
|
383
|
-
//
|
|
384
|
-
// appearance
|
|
385
|
-
//
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
419
|
+
// We can only use CSS to determine the width when we have a known width in container.
|
|
420
|
+
// When appearance is full-page, full-width or comment we use CSS based width calculation.
|
|
421
|
+
// Otherwise it's fixed table width (customized width) or inherit.
|
|
422
|
+
if (rendererAppearance === 'full-page' || rendererAppearance === 'full-width') {
|
|
423
|
+
finalTableContainerWidth = allowTableResizing ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
424
|
+
}
|
|
425
|
+
if (rendererAppearance === 'comment' && allowTableResizing && !allowTableAlignment) {
|
|
426
|
+
// If table alignment is disabled and table width is akEditorDefaultLayoutWidth = 760,
|
|
427
|
+
// it is most likely a table created before "Support Table in Comments" FF was enabled
|
|
428
|
+
// and we would see a bug ED-24795. A table created before "Support Table in Comments",
|
|
429
|
+
// should inhirit the width of the renderer container.
|
|
394
430
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
431
|
+
// !NOTE: it a table resized to 760 is copied from 'full-page' editor and pasted in comment editor
|
|
432
|
+
// where (allowTableResizing && !allowTableAlignment), the table will loose 760px width.
|
|
433
|
+
finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== akEditorDefaultLayoutWidth ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
434
|
+
}
|
|
435
|
+
if (rendererAppearance === 'comment' && allowTableResizing && allowTableAlignment) {
|
|
436
|
+
// If table alignment is enabled and layout is not 'align-start' or 'center', we are loading a table that was
|
|
437
|
+
// created before "Support Table in Comments" FF was enabled. So the table should have the same width as renderer container
|
|
438
|
+
// instead of 760 that was set on tableNode when the table had been published.
|
|
439
|
+
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
440
|
+
}
|
|
441
|
+
var style = {
|
|
442
|
+
width: finalTableContainerWidth,
|
|
443
|
+
left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
|
|
444
|
+
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
|
|
399
445
|
};
|
|
400
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
401
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
402
|
-
className: "table-alignment-container"
|
|
403
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
404
|
-
,
|
|
405
|
-
style: {
|
|
406
|
-
display: 'flex',
|
|
407
|
-
justifyContent: getTableAlignment()
|
|
408
|
-
}
|
|
409
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
410
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
411
|
-
className: "pm-table-resizer-container"
|
|
412
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
413
|
-
,
|
|
414
|
-
style: {
|
|
415
|
-
width: isInsideInlineComment ? '100%' : "min(calc(100cqw - ".concat(resizerContainerPadding, "px), ").concat(tableWidthAttribute, ")")
|
|
416
|
-
}
|
|
417
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
418
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
419
|
-
className: "resizer-item display-handle",
|
|
420
|
-
style: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
421
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
422
|
-
position: 'relative',
|
|
423
|
-
userSelect: 'auto',
|
|
424
|
-
boxSizing: 'border-box'
|
|
425
|
-
}, '--ak-editor-table-gutter-padding', "".concat(gutterPadding, "px")), '--ak-editor-table-max-width', "".concat(TABLE_MAX_WIDTH, "px")), '--ak-editor-table-min-width', "".concat(tableMinWidth, "px")), "minWidth", 'var(--ak-editor-table-min-width)'), "maxWidth", resizerItemMaxWidth), "width", resizerItemWidth)
|
|
426
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
427
|
-
className: "resizer-hover-zone"
|
|
428
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
446
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
429
447
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
430
448
|
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
431
|
-
"data-layout":
|
|
449
|
+
"data-layout": updatedLayout,
|
|
432
450
|
"data-testid": "table-container",
|
|
433
|
-
ref: this.props.handleRef
|
|
451
|
+
ref: this.props.handleRef,
|
|
452
|
+
style: style
|
|
434
453
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
435
454
|
}, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
|
|
436
455
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -438,8 +457,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
438
457
|
"data-testid": "sticky-scrollbar-sentinel-top"
|
|
439
458
|
}), stickyHeaders && tableNode && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
|
|
440
459
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
441
|
-
renderWidth: 0,
|
|
442
460
|
tableWidth: "inherit",
|
|
461
|
+
renderWidth: 0,
|
|
443
462
|
layout: layout,
|
|
444
463
|
handleRef: this.props.handleRef,
|
|
445
464
|
shadowClassNames: this.props.shadowClassNames,
|
|
@@ -451,7 +470,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
451
470
|
rowHeight: this.state.headerRowHeight,
|
|
452
471
|
tableNode: tableNode,
|
|
453
472
|
rendererAppearance: rendererAppearance,
|
|
454
|
-
allowTableResizing: allowTableResizing
|
|
473
|
+
allowTableResizing: allowTableResizing,
|
|
474
|
+
fixTableSSRResizing: true
|
|
455
475
|
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
456
476
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
457
477
|
className: TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
@@ -467,8 +487,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
467
487
|
innerRef: this.tableRef,
|
|
468
488
|
columnWidths: columnWidths,
|
|
469
489
|
layout: layout,
|
|
470
|
-
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
471
490
|
renderWidth: 0,
|
|
491
|
+
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
472
492
|
tableNode: tableNode,
|
|
473
493
|
rendererAppearance: rendererAppearance,
|
|
474
494
|
isInsideOfBlockNode: isInsideOfBlockNode,
|
|
@@ -502,10 +522,13 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
502
522
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
503
523
|
className: TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM,
|
|
504
524
|
"data-testid": "sticky-scrollbar-sentinel-bottom"
|
|
505
|
-
})))
|
|
525
|
+
})));
|
|
506
526
|
}
|
|
507
527
|
}]);
|
|
508
528
|
}(React.Component);
|
|
529
|
+
/**
|
|
530
|
+
*
|
|
531
|
+
*/
|
|
509
532
|
// Ignored via go/ees005
|
|
510
533
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
511
534
|
export var TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Component2) {
|
|
@@ -556,7 +579,12 @@ export var TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Com
|
|
|
556
579
|
_inherits(TableProcessorWithContainerStyles, _React$Component2);
|
|
557
580
|
return _createClass(TableProcessorWithContainerStyles, [{
|
|
558
581
|
key: "render",
|
|
559
|
-
value:
|
|
582
|
+
value:
|
|
583
|
+
/**
|
|
584
|
+
*
|
|
585
|
+
* @example
|
|
586
|
+
*/
|
|
587
|
+
function render() {
|
|
560
588
|
var children = this.props.children;
|
|
561
589
|
if (!children) {
|
|
562
590
|
return null;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { useContext,
|
|
2
|
+
import React, { useContext, useLayoutEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { MediaClientContext, getMediaClient } from '@atlaskit/media-client-react';
|
|
4
|
-
import { useProviderLayout
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { useProviderLayout } from '@atlaskit/editor-common/provider-factory';
|
|
6
5
|
export var EditorMediaClientProvider = function EditorMediaClientProvider(_ref) {
|
|
7
6
|
var children = _ref.children,
|
|
8
7
|
ssr = _ref.ssr;
|
|
@@ -10,14 +9,13 @@ export var EditorMediaClientProvider = function EditorMediaClientProvider(_ref)
|
|
|
10
9
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11
10
|
mediaClientConfig = _useState2[0],
|
|
12
11
|
setMediaClientConfig = _useState2[1];
|
|
13
|
-
var oldMediaProvider = useProvider('mediaProvider');
|
|
14
12
|
var mediaProvider = useProviderLayout('mediaProvider');
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* If a mediaClientConfig is provided then we will force
|
|
18
16
|
* skip the mediaClient from context
|
|
19
17
|
*/
|
|
20
|
-
var shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) ||
|
|
18
|
+
var shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) || mediaProvider);
|
|
21
19
|
var contextMediaClient = useContext(MediaClientContext);
|
|
22
20
|
|
|
23
21
|
// MediaClientProvider currently requires a mediaClientConfig
|
|
@@ -31,26 +29,14 @@ export var EditorMediaClientProvider = function EditorMediaClientProvider(_ref)
|
|
|
31
29
|
// by not providing both SSR config and mediaProvider,
|
|
32
30
|
// and provide a top level mediaClient context
|
|
33
31
|
// This is useful for testing and creating examples.
|
|
34
|
-
|
|
35
|
-
if (!fg('platform_editor_speedup_media_client')) {
|
|
36
|
-
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
37
|
-
setMediaClientConfig(ssr.config);
|
|
38
|
-
} else if (oldMediaProvider) {
|
|
39
|
-
oldMediaProvider.then(function (provider) {
|
|
40
|
-
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, [oldMediaProvider, ssr]);
|
|
32
|
+
|
|
45
33
|
useLayoutEffect(function () {
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
}
|
|
34
|
+
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
35
|
+
setMediaClientConfig(ssr.config);
|
|
36
|
+
} else if (mediaProvider) {
|
|
37
|
+
mediaProvider.then(function (provider) {
|
|
38
|
+
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
39
|
+
});
|
|
54
40
|
}
|
|
55
41
|
}, [mediaProvider, ssr]);
|
|
56
42
|
return /*#__PURE__*/React.createElement(MediaClientContext.Provider, {
|
|
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
|
|
|
53
53
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
54
54
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
55
55
|
var packageName = "@atlaskit/renderer";
|
|
56
|
-
var packageVersion = "118.1.
|
|
56
|
+
var packageVersion = "118.1.2";
|
|
57
57
|
var setAsQueryContainerStyles = css({
|
|
58
58
|
containerName: 'ak-renderer-wrapper',
|
|
59
59
|
containerType: 'inline-size'
|
|
@@ -462,15 +462,9 @@ var getRendererComponent = function getRendererComponent(nodeComponents) {
|
|
|
462
462
|
// and use context instead because at this time we cannot guarantee that existing
|
|
463
463
|
// consumers of Atlaskit Renderer will update to use the new portal context.
|
|
464
464
|
if (!Boolean(nodeComponents) && fg('cc_complexit_reduce_portal_rerenders')) {
|
|
465
|
-
|
|
466
|
-
return RendererFunctionalComponentWithPortalContextMemoized;
|
|
467
|
-
}
|
|
468
|
-
return RendererFunctionalComponentWithPortalContext;
|
|
469
|
-
}
|
|
470
|
-
if (fg('cc_perf_reduce_rerenders')) {
|
|
471
|
-
return RendererFunctionalComponentMemoized;
|
|
465
|
+
return RendererFunctionalComponentWithPortalContextMemoized;
|
|
472
466
|
}
|
|
473
|
-
return
|
|
467
|
+
return RendererFunctionalComponentMemoized;
|
|
474
468
|
};
|
|
475
469
|
|
|
476
470
|
/**
|
|
@@ -14,7 +14,6 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { useIntl } from 'react-intl-next';
|
|
16
16
|
import { inlineCommentMessages } from '../../../messages';
|
|
17
|
-
import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
|
|
18
17
|
var markStyles = css(_defineProperty({
|
|
19
18
|
color: 'inherit',
|
|
20
19
|
backgroundColor: 'unset',
|
|
@@ -123,20 +122,6 @@ export var MarkComponent = function MarkComponent(_ref) {
|
|
|
123
122
|
var annotationIds = useMemo(function () {
|
|
124
123
|
return _toConsumableArray(new Set([].concat(_toConsumableArray(annotationParentIds), [id])));
|
|
125
124
|
}, [id, annotationParentIds]);
|
|
126
|
-
var _useAnnotationManager = useAnnotationManagerDispatch(),
|
|
127
|
-
dispatch = _useAnnotationManager.dispatch;
|
|
128
|
-
var _useAnnotationManager2 = useAnnotationManagerState(),
|
|
129
|
-
currentSelectedAnnotationId = _useAnnotationManager2.currentSelectedAnnotationId;
|
|
130
|
-
var markRef = useCallback(function (node) {
|
|
131
|
-
if (id === currentSelectedAnnotationId && node) {
|
|
132
|
-
dispatch({
|
|
133
|
-
type: 'setSelectedMarkRef',
|
|
134
|
-
data: {
|
|
135
|
-
markRef: node
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}, [dispatch, id, currentSelectedAnnotationId]);
|
|
140
125
|
var onMarkClick = useCallback(function (event) {
|
|
141
126
|
// prevent inline mark logic for media block marks
|
|
142
127
|
if (event.currentTarget instanceof HTMLElement && event.currentTarget.getAttribute('data-block-mark')) {
|
|
@@ -163,13 +148,22 @@ export var MarkComponent = function MarkComponent(_ref) {
|
|
|
163
148
|
// prevents from opening link URL inside webView in Safari
|
|
164
149
|
event.preventDefault();
|
|
165
150
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
151
|
+
if (fg('platform_editor_comments_api_manager')) {
|
|
152
|
+
// currentTarget is the right element if there are multiple overlapping annotations
|
|
153
|
+
// Ignored via go/ees005
|
|
154
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
155
|
+
onClick({
|
|
156
|
+
eventTarget: event.currentTarget,
|
|
157
|
+
annotationIds: annotationIds
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
// Ignored via go/ees005
|
|
161
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
162
|
+
onClick({
|
|
163
|
+
eventTarget: event.target,
|
|
164
|
+
annotationIds: annotationIds
|
|
165
|
+
});
|
|
166
|
+
}
|
|
173
167
|
}, [annotationIds, onClick, state]);
|
|
174
168
|
var onMarkEnter = function onMarkEnter(evt) {
|
|
175
169
|
var _document$activeEleme;
|
|
@@ -195,7 +189,6 @@ export var MarkComponent = function MarkComponent(_ref) {
|
|
|
195
189
|
'aria-details': annotationIds.join(', ')
|
|
196
190
|
}, desktopAccessibilityAttributes);
|
|
197
191
|
return jsx(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread(_defineProperty({
|
|
198
|
-
ref: id === currentSelectedAnnotationId ? markRef : undefined,
|
|
199
192
|
id: id
|
|
200
193
|
}, fg('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
|
|
201
194
|
css: [markStyles, fg('platform_renderer_nested_annotation_styling') && markStylesLayeringFix, fg('editor_inline_comments_on_inline_nodes') && markStylesWithInlineComments, fg('confluence-frontend-comments-panel') && markStylesWithCommentsPanel, !isMobile() && accessibilityStyles, markStylesWithUpdatedShadow],
|
|
@@ -194,7 +194,7 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
|
|
|
194
194
|
}
|
|
195
195
|
}, [updateSubscriber, createAnalyticsEvent, isNestedRender]);
|
|
196
196
|
if (fg('platform_editor_comments_api_manager')) {
|
|
197
|
-
return selectedAnnotation;
|
|
197
|
+
return isNestedRender ? null : selectedAnnotation;
|
|
198
198
|
} else {
|
|
199
199
|
return annotationClickEvent;
|
|
200
200
|
}
|
|
@@ -4,6 +4,7 @@ type TableProps = SharedTableProps & {
|
|
|
4
4
|
innerRef?: React.RefObject<HTMLTableElement>;
|
|
5
5
|
children: React.ReactNode[];
|
|
6
6
|
isPresentational?: boolean;
|
|
7
|
+
fixTableSSRResizing?: boolean;
|
|
7
8
|
};
|
|
8
|
-
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, tableNode, rendererAppearance, isInsideOfBlockNode, isInsideOfTable, isinsideMultiBodiedExtension, allowTableResizing, isPresentational, }: TableProps) => React.JSX.Element>;
|
|
9
|
+
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, tableNode, rendererAppearance, isInsideOfBlockNode, isInsideOfTable, isinsideMultiBodiedExtension, allowTableResizing, isPresentational, fixTableSSRResizing, }: TableProps) => React.JSX.Element>;
|
|
9
10
|
export {};
|
|
@@ -42,7 +42,7 @@ export interface TableState {
|
|
|
42
42
|
headerRowHeight: number;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
*
|
|
46
46
|
*/
|
|
47
47
|
export declare class TableContainer extends React.Component<TableProps & OverflowShadowProps & WithSmartCardStorageProps, TableState> {
|
|
48
48
|
state: TableState;
|
|
@@ -42,6 +42,9 @@ export interface TableState {
|
|
|
42
42
|
wrapperWidth: number;
|
|
43
43
|
headerRowHeight: number;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* TableContainer renders tables using only CSS-based rules
|
|
47
|
+
*/
|
|
45
48
|
export declare class TableContainer extends React.Component<TableProps & OverflowShadowProps & WithSmartCardStorageProps, TableState> {
|
|
46
49
|
state: TableState;
|
|
47
50
|
tableRef: React.RefObject<HTMLTableElement>;
|
|
@@ -55,26 +58,56 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
|
|
|
55
58
|
updatedLayout: TableLayout | 'custom';
|
|
56
59
|
private resizeObserver;
|
|
57
60
|
private applyResizerChange;
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
*/
|
|
58
65
|
componentDidMount(): void;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param prevProps
|
|
69
|
+
* @param prevState
|
|
70
|
+
* @example
|
|
71
|
+
*/
|
|
59
72
|
componentDidUpdate(prevProps: TableProps, prevState: TableState): void;
|
|
60
73
|
componentWillUnmount: () => void;
|
|
61
74
|
getScrollTop: () => number;
|
|
62
75
|
updateSticky: () => void;
|
|
63
76
|
onScroll: () => void;
|
|
64
77
|
onWrapperScrolled: () => void;
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
65
81
|
get pinTop(): number | undefined;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
66
85
|
get shouldAddOverflowParentOffsetTop_DO_NOT_USE(): boolean | null | undefined;
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
67
89
|
get stickyTop(): number | undefined;
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
*/
|
|
68
94
|
render(): React.JSX.Element;
|
|
69
95
|
private grabFirstRowRef;
|
|
70
96
|
}
|
|
71
97
|
type TableProcessorState = {
|
|
72
98
|
tableOrderStatus?: TableOrderStatus;
|
|
73
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
74
103
|
export declare class TableProcessorWithContainerStyles extends React.Component<TableProps & OverflowShadowProps & WithSmartCardStorageProps, TableProcessorState> {
|
|
75
104
|
state: {
|
|
76
105
|
tableOrderStatus: undefined;
|
|
77
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
*/
|
|
78
111
|
render(): React.JSX.Element | null;
|
|
79
112
|
private addSortableColumn;
|
|
80
113
|
private changeSortOrder;
|
|
@@ -27,7 +27,6 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
|
|
|
27
27
|
'data-id': string;
|
|
28
28
|
'data-mark-annotation-state'?: AnnotationMarkStates | undefined;
|
|
29
29
|
'aria-disabled': boolean;
|
|
30
|
-
ref: ((node: HTMLElement | null) => void) | undefined;
|
|
31
30
|
id: string;
|
|
32
31
|
} | {
|
|
33
32
|
css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
|
|
@@ -42,7 +41,6 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
|
|
|
42
41
|
'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
|
|
43
42
|
'data-id': string;
|
|
44
43
|
'aria-disabled': boolean;
|
|
45
|
-
ref: ((node: HTMLElement | null) => void) | undefined;
|
|
46
44
|
id: string;
|
|
47
45
|
} | {
|
|
48
46
|
css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
|
|
@@ -60,7 +58,6 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
|
|
|
60
58
|
'aria-expanded'?: undefined;
|
|
61
59
|
'aria-details': string;
|
|
62
60
|
'aria-disabled'?: undefined;
|
|
63
|
-
ref: ((node: HTMLElement | null) => void) | undefined;
|
|
64
61
|
id: string;
|
|
65
62
|
} | {
|
|
66
63
|
css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
|
|
@@ -80,7 +77,6 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
|
|
|
80
77
|
'aria-expanded'?: undefined;
|
|
81
78
|
'aria-details': string;
|
|
82
79
|
'aria-disabled'?: undefined;
|
|
83
|
-
ref: ((node: HTMLElement | null) => void) | undefined;
|
|
84
80
|
id: string;
|
|
85
81
|
} | {
|
|
86
82
|
css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
|
|
@@ -98,7 +94,6 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
|
|
|
98
94
|
'aria-expanded': boolean;
|
|
99
95
|
'aria-details': string;
|
|
100
96
|
'aria-disabled'?: undefined;
|
|
101
|
-
ref: ((node: HTMLElement | null) => void) | undefined;
|
|
102
97
|
id: string;
|
|
103
98
|
} | {
|
|
104
99
|
css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
|
|
@@ -118,7 +113,6 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
|
|
|
118
113
|
'aria-expanded': boolean;
|
|
119
114
|
'aria-details': string;
|
|
120
115
|
'aria-disabled'?: undefined;
|
|
121
|
-
ref: ((node: HTMLElement | null) => void) | undefined;
|
|
122
116
|
id: string;
|
|
123
117
|
}, string | React.JSXElementConstructor<any>>;
|
|
124
118
|
export {};
|
|
@@ -4,6 +4,7 @@ type TableProps = SharedTableProps & {
|
|
|
4
4
|
innerRef?: React.RefObject<HTMLTableElement>;
|
|
5
5
|
children: React.ReactNode[];
|
|
6
6
|
isPresentational?: boolean;
|
|
7
|
+
fixTableSSRResizing?: boolean;
|
|
7
8
|
};
|
|
8
|
-
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, tableNode, rendererAppearance, isInsideOfBlockNode, isInsideOfTable, isinsideMultiBodiedExtension, allowTableResizing, isPresentational, }: TableProps) => React.JSX.Element>;
|
|
9
|
+
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, tableNode, rendererAppearance, isInsideOfBlockNode, isInsideOfTable, isinsideMultiBodiedExtension, allowTableResizing, isPresentational, fixTableSSRResizing, }: TableProps) => React.JSX.Element>;
|
|
9
10
|
export {};
|