@atlaskit/link-datasource 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +12 -5
- package/dist/cjs/ui/issue-like-table/index.js +86 -48
- package/dist/cjs/ui/issue-like-table/render-type/richtext/index.js +2 -3
- package/dist/cjs/ui/issue-like-table/styled.js +11 -0
- package/dist/cjs/ui/issue-like-table/utils.js +13 -6
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +12 -5
- package/dist/es2019/ui/issue-like-table/index.js +50 -17
- package/dist/es2019/ui/issue-like-table/render-type/richtext/index.js +2 -3
- package/dist/es2019/ui/issue-like-table/styled.js +11 -0
- package/dist/es2019/ui/issue-like-table/utils.js +14 -5
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +12 -5
- package/dist/esm/ui/issue-like-table/index.js +86 -48
- package/dist/esm/ui/issue-like-table/render-type/richtext/index.js +2 -3
- package/dist/esm/ui/issue-like-table/styled.js +11 -0
- package/dist/esm/ui/issue-like-table/utils.js +13 -6
- package/dist/types/common/utils/adf.d.ts +1 -1
- package/dist/types/ui/datasource-table-view/datasourceTableView.d.ts +0 -1
- package/dist/types/ui/datasource-table-view/types.d.ts +1 -2
- package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -2
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/utils.d.ts +2 -2
- package/dist/types-ts4.5/common/utils/adf.d.ts +1 -1
- package/dist/types-ts4.5/ui/datasource-table-view/datasourceTableView.d.ts +0 -1
- package/dist/types-ts4.5/ui/datasource-table-view/types.d.ts +1 -2
- package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -2
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +2 -2
- package/package.json +12 -6
|
@@ -4,8 +4,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
|
|
5
5
|
import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
const rootStyles = css({
|
|
7
|
-
position: 'relative'
|
|
8
|
-
display: 'block'
|
|
7
|
+
position: 'relative'
|
|
9
8
|
});
|
|
10
9
|
const smartLinkNodeToUrl = node => {
|
|
11
10
|
var _node$attrs$url;
|
|
@@ -45,7 +44,7 @@ const RichTextType = ({
|
|
|
45
44
|
}) => {
|
|
46
45
|
const adfPlainText = useMemo(() => parseRichText(value), [value]);
|
|
47
46
|
if (adfPlainText) {
|
|
48
|
-
return jsx("
|
|
47
|
+
return jsx("span", {
|
|
49
48
|
css: rootStyles,
|
|
50
49
|
"data-testid": "richtext-plaintext"
|
|
51
50
|
}, adfPlainText);
|
|
@@ -26,11 +26,19 @@ export const TableHeading = styled.th({
|
|
|
26
26
|
[`${withTablePluginHeaderPrefix()}`]: {
|
|
27
27
|
border: 0,
|
|
28
28
|
position: 'relative',
|
|
29
|
+
/* This makes resizing work with out jumping due to padding + changes overall width for same default values. */
|
|
29
30
|
boxSizing: 'border-box',
|
|
30
31
|
lineHeight: lineHeight,
|
|
31
32
|
padding: `${verticalPadding} ${"var(--ds-space-050, 4px)"}`,
|
|
32
33
|
borderRight: `0.5px solid ${`var(--ds-border, ${N40})`}`,
|
|
33
34
|
borderBottom: `2px solid ${`var(--ds-border, ${N40})`}`,
|
|
35
|
+
/*
|
|
36
|
+
lineHeight * 2 -> Max height of two lined header
|
|
37
|
+
verticalPadding * 2 -> padding for this component itself
|
|
38
|
+
verticalPadding * 2 -> padding inside span (--container)
|
|
39
|
+
2px -> Bottom border
|
|
40
|
+
Last two terms are needed because of border-box box sizing.
|
|
41
|
+
*/
|
|
34
42
|
height: `calc(${lineHeight} * 2 + ${verticalPadding} * 4 + 2px)`,
|
|
35
43
|
verticalAlign: 'bottom',
|
|
36
44
|
backgroundColor: "var(--ds-elevation-surface-current, #FFF)"
|
|
@@ -46,6 +54,9 @@ export const TableHeading = styled.th({
|
|
|
46
54
|
},
|
|
47
55
|
"& [data-testid='datasource-header-content--container']": {
|
|
48
56
|
width: '100%',
|
|
57
|
+
/* With Button now being a parent for this component it adds its lineHeight value and spoils
|
|
58
|
+
`height` calculation above. */
|
|
59
|
+
lineHeight: lineHeight,
|
|
49
60
|
padding: `${verticalPadding} ${"var(--ds-space-050, 4px)"}`,
|
|
50
61
|
display: '-webkit-box',
|
|
51
62
|
WebkitLineClamp: 2,
|
|
@@ -8,15 +8,24 @@ export const COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
|
8
8
|
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
9
9
|
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
10
10
|
* column widths we treat all width as custom hardcoded widths.
|
|
11
|
-
* @param width
|
|
11
|
+
* @param width Sometimes set to undefined for last column to make it occupy remainder of the table width
|
|
12
12
|
*/
|
|
13
13
|
export const getWidthCss = ({
|
|
14
14
|
shouldUseWidth,
|
|
15
15
|
width
|
|
16
|
-
}) =>
|
|
17
|
-
width
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
}) => {
|
|
17
|
+
if (!width) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
if (shouldUseWidth) {
|
|
21
|
+
return {
|
|
22
|
+
width
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
return {
|
|
26
|
+
maxWidth: width
|
|
27
|
+
};
|
|
28
|
+
}
|
|
20
29
|
};
|
|
21
30
|
|
|
22
31
|
/**
|
|
@@ -114,6 +114,11 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
114
114
|
closestEdge = _useState6[0],
|
|
115
115
|
setClosestEdge = _useState6[1];
|
|
116
116
|
var dropTargetRef = useRef(null);
|
|
117
|
+
/**
|
|
118
|
+
* When width is not set (or callback is not set) we assume not resizing is needed.
|
|
119
|
+
* In our case width won't be set for last cell when table container is bigger than sum of all columns
|
|
120
|
+
*/
|
|
121
|
+
var resizeIsEnabled = !!onWidthChange && !!width;
|
|
117
122
|
useEffect(function () {
|
|
118
123
|
var cell = mainHeaderCellRef.current;
|
|
119
124
|
invariant(cell);
|
|
@@ -221,7 +226,7 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
221
226
|
|
|
222
227
|
// Handling column resizing
|
|
223
228
|
useEffect(function () {
|
|
224
|
-
if (!
|
|
229
|
+
if (!resizeIsEnabled) {
|
|
225
230
|
return;
|
|
226
231
|
}
|
|
227
232
|
var resizeHandle = columnResizeHandleRef.current;
|
|
@@ -277,7 +282,7 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
277
282
|
}
|
|
278
283
|
}
|
|
279
284
|
});
|
|
280
|
-
}, [id, index, onWidthChange, state, tableId, width]);
|
|
285
|
+
}, [id, index, onWidthChange, resizeIsEnabled, state, tableId, width]);
|
|
281
286
|
var _useState7 = useState(false),
|
|
282
287
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
283
288
|
buttonHovered = _useState8[0],
|
|
@@ -286,7 +291,9 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
286
291
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
287
292
|
isDropdownOpen = _useState10[0],
|
|
288
293
|
setIsDropdownOpen = _useState10[1];
|
|
289
|
-
|
|
294
|
+
// Width is not set when it is a last cell in a wide table.
|
|
295
|
+
// We make assumption thus that there is enough width for chevron.
|
|
296
|
+
var isWideEnoughToHaveChevron = !width || width > 76;
|
|
290
297
|
var shouldShowTriggerIcon = (buttonHovered || isDropdownOpen) && isWideEnoughToHaveChevron;
|
|
291
298
|
var triggerIcon = useMemo(function () {
|
|
292
299
|
return shouldShowTriggerIcon ? isDropdownOpen ? ChevronUp : ChevronDown : isWideEnoughToHaveChevron ? GlyphPlaceholder : undefined;
|
|
@@ -322,10 +329,10 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
322
329
|
style: _objectSpread({
|
|
323
330
|
cursor: 'grab'
|
|
324
331
|
}, getWidthCss({
|
|
325
|
-
shouldUseWidth:
|
|
332
|
+
shouldUseWidth: resizeIsEnabled,
|
|
326
333
|
width: width
|
|
327
334
|
}))
|
|
328
|
-
},
|
|
335
|
+
}, resizeIsEnabled ? jsx("div", {
|
|
329
336
|
ref: columnResizeHandleRef,
|
|
330
337
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
331
338
|
style: {
|
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
-
var _styled$
|
|
6
|
+
var _styled$td;
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -11,6 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
12
|
import { css, jsx } from '@emotion/react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import debounce from 'lodash/debounce';
|
|
14
15
|
import { useIntl } from 'react-intl-next';
|
|
15
16
|
import invariant from 'tiny-invariant';
|
|
16
17
|
import { Skeleton } from '@atlaskit/linking-common';
|
|
@@ -22,6 +23,7 @@ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/ad
|
|
|
22
23
|
import { N40 } from '@atlaskit/theme/colors';
|
|
23
24
|
import { fontFallback } from '@atlaskit/theme/typography';
|
|
24
25
|
import Tooltip from '@atlaskit/tooltip';
|
|
26
|
+
import { WidthObserver } from '@atlaskit/width-detector';
|
|
25
27
|
import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
|
|
26
28
|
import { stickyTableHeadersIndex } from '../../common/zindex';
|
|
27
29
|
import { ColumnPicker } from './column-picker';
|
|
@@ -44,27 +46,30 @@ var truncateTextStyles = css({
|
|
|
44
46
|
textOverflow: 'ellipsis',
|
|
45
47
|
whiteSpace: 'nowrap'
|
|
46
48
|
});
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
+
var columnPickerWidth = 80;
|
|
50
|
+
var ColumnPickerHeader = styled.th(_defineProperty({}, "".concat(withTablePluginHeaderPrefix('&:last-of-type')), {
|
|
51
|
+
boxSizing: 'border-box',
|
|
49
52
|
border: 0,
|
|
50
|
-
width:
|
|
53
|
+
width: "".concat(columnPickerWidth, "px"),
|
|
51
54
|
zIndex: 10,
|
|
52
55
|
position: 'sticky',
|
|
53
56
|
right: "calc(-1 * ".concat(tableSidePadding, ")"),
|
|
54
57
|
backgroundColor: "var(--ds-elevation-surface-current, #FFF)",
|
|
58
|
+
/* It is required to have solid (not half-transparent) color because of this gradient business below */
|
|
55
59
|
borderBottom: "2px solid ".concat("var(--ds-border, ".concat(N40, ")")),
|
|
56
|
-
paddingRight:
|
|
60
|
+
paddingRight: tableSidePadding,
|
|
57
61
|
background: "linear-gradient( 90deg, rgba(255, 255, 255, 0) 0%, ".concat("var(--ds-elevation-surface-current, #FFF)", " 10% )"),
|
|
62
|
+
/* Keeps dropdown button in the middle */
|
|
58
63
|
verticalAlign: 'middle',
|
|
64
|
+
/* In case when TH itself is bigger we want to keep picker at the right side */
|
|
59
65
|
textAlign: 'right'
|
|
60
|
-
})
|
|
61
|
-
paddingRight: tableSidePadding
|
|
62
|
-
}), _styled$th));
|
|
66
|
+
}));
|
|
63
67
|
var truncateStyles = css({
|
|
64
68
|
textOverflow: 'ellipsis',
|
|
65
69
|
whiteSpace: 'nowrap'
|
|
66
70
|
});
|
|
67
71
|
var TableCell = styled.td((_styled$td = {}, _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix()), {
|
|
72
|
+
/* First section here is to override things editor table plugin css defines */
|
|
68
73
|
font: fieldTextFontSize,
|
|
69
74
|
padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
|
|
70
75
|
border: 0,
|
|
@@ -85,7 +90,8 @@ var TableCell = styled.td((_styled$td = {}, _defineProperty(_styled$td, "".conca
|
|
|
85
90
|
var tableContainerStyles = css({
|
|
86
91
|
borderRadius: 'inherit',
|
|
87
92
|
borderBottomLeftRadius: 0,
|
|
88
|
-
borderBottomRightRadius: 0
|
|
93
|
+
borderBottomRightRadius: 0,
|
|
94
|
+
position: 'relative'
|
|
89
95
|
});
|
|
90
96
|
|
|
91
97
|
/**
|
|
@@ -182,7 +188,10 @@ var tableStyles = css({
|
|
|
182
188
|
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
183
189
|
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
184
190
|
borderCollapse: 'separate',
|
|
185
|
-
borderSpacing: 0
|
|
191
|
+
borderSpacing: 0,
|
|
192
|
+
// There is a strange table:first-of-type rule that sets margin-top to 0 coming from container,
|
|
193
|
+
// but because our table is now not the first child (there is an empty div to measure width) we need to set it manually.
|
|
194
|
+
margin: 0
|
|
186
195
|
});
|
|
187
196
|
|
|
188
197
|
// By default tbody and thead have border-bottom: 2px ...
|
|
@@ -294,6 +303,19 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
294
303
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
295
304
|
orderedColumns = _useState6[0],
|
|
296
305
|
setOrderedColumns = _useState6[1];
|
|
306
|
+
|
|
307
|
+
// Table container width is used to know if sum of all column widths is bigger of container or not.
|
|
308
|
+
// When sum of all columns is less than container size we make last column stretchable (width: undefined)
|
|
309
|
+
var _useState7 = useState(),
|
|
310
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
311
|
+
tableContainerWidth = _useState8[0],
|
|
312
|
+
setTableContainerWidth = _useState8[1];
|
|
313
|
+
useEffect(function () {
|
|
314
|
+
var current = containerRef.current;
|
|
315
|
+
if (containerRef && current) {
|
|
316
|
+
setTableContainerWidth(current.getBoundingClientRect().width);
|
|
317
|
+
}
|
|
318
|
+
}, [containerRef]);
|
|
297
319
|
useEffect(function () {
|
|
298
320
|
if (!hasFullSchema) {
|
|
299
321
|
setOrderedColumns(getOrderedColumns(_toConsumableArray(columns), _toConsumableArray(visibleColumnKeys)));
|
|
@@ -320,19 +342,33 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
320
342
|
// or some other combination.
|
|
321
343
|
|
|
322
344
|
var identityColumnKey = 'id';
|
|
323
|
-
var
|
|
324
|
-
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
325
|
-
}, [columnCustomSizes]);
|
|
326
|
-
var headerColumns = useMemo(function () {
|
|
345
|
+
var columnsWidthsSum = useMemo(function () {
|
|
327
346
|
return visibleSortedColumns.map(function (_ref7) {
|
|
328
347
|
var key = _ref7.key,
|
|
329
|
-
title = _ref7.title,
|
|
330
348
|
type = _ref7.type;
|
|
349
|
+
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
350
|
+
}).reduce(function (sum, width) {
|
|
351
|
+
return width + sum;
|
|
352
|
+
}, 0) + (onVisibleColumnKeysChange ? columnPickerWidth : 0);
|
|
353
|
+
}, [columnCustomSizes, onVisibleColumnKeysChange, visibleSortedColumns]);
|
|
354
|
+
var shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
355
|
+
var getColumnWidth = useCallback(function (key, type, isLastCell) {
|
|
356
|
+
if (isLastCell && shouldUseWidth && (!tableContainerWidth || tableContainerWidth > columnsWidthsSum)) {
|
|
357
|
+
return undefined;
|
|
358
|
+
} else {
|
|
359
|
+
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
360
|
+
}
|
|
361
|
+
}, [columnCustomSizes, columnsWidthsSum, shouldUseWidth, tableContainerWidth]);
|
|
362
|
+
var headerColumns = useMemo(function () {
|
|
363
|
+
return visibleSortedColumns.map(function (_ref8, index) {
|
|
364
|
+
var key = _ref8.key,
|
|
365
|
+
title = _ref8.title,
|
|
366
|
+
type = _ref8.type;
|
|
331
367
|
return {
|
|
332
368
|
key: key,
|
|
333
369
|
content: title,
|
|
334
370
|
shouldTruncate: true,
|
|
335
|
-
width: getColumnWidth(key, type)
|
|
371
|
+
width: getColumnWidth(key, type, index === visibleSortedColumns.length - 1)
|
|
336
372
|
};
|
|
337
373
|
});
|
|
338
374
|
}, [getColumnWidth, visibleSortedColumns]);
|
|
@@ -369,9 +405,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
369
405
|
return;
|
|
370
406
|
}
|
|
371
407
|
return combine(monitorForElements({
|
|
372
|
-
onDragStart: function onDragStart(
|
|
373
|
-
var location =
|
|
374
|
-
source =
|
|
408
|
+
onDragStart: function onDragStart(_ref9) {
|
|
409
|
+
var location = _ref9.location,
|
|
410
|
+
source = _ref9.source;
|
|
375
411
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
376
412
|
if (source.data.type === 'table-header') {
|
|
377
413
|
var _containerRef$current;
|
|
@@ -387,9 +423,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
387
423
|
});
|
|
388
424
|
}
|
|
389
425
|
},
|
|
390
|
-
onDrag: function onDrag(
|
|
391
|
-
var location =
|
|
392
|
-
source =
|
|
426
|
+
onDrag: function onDrag(_ref10) {
|
|
427
|
+
var location = _ref10.location,
|
|
428
|
+
source = _ref10.source;
|
|
393
429
|
if (source.data.type === 'table-header') {
|
|
394
430
|
var _containerRef$current2;
|
|
395
431
|
autoScroller.updateInput({
|
|
@@ -399,9 +435,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
399
435
|
});
|
|
400
436
|
}
|
|
401
437
|
},
|
|
402
|
-
onDrop: function onDrop(
|
|
403
|
-
var source =
|
|
404
|
-
location =
|
|
438
|
+
onDrop: function onDrop(_ref11) {
|
|
439
|
+
var source = _ref11.source,
|
|
440
|
+
location = _ref11.location;
|
|
405
441
|
autoScroller.stop();
|
|
406
442
|
if (location.current.dropTargets.length === 0) {
|
|
407
443
|
return;
|
|
@@ -436,10 +472,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
436
472
|
return items.map(function (newRowData, rowIndex) {
|
|
437
473
|
return {
|
|
438
474
|
key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
|
|
439
|
-
cells: visibleSortedColumns.map(function (
|
|
475
|
+
cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
|
|
440
476
|
var _newRowData$key;
|
|
441
|
-
var key =
|
|
442
|
-
type =
|
|
477
|
+
var key = _ref12.key,
|
|
478
|
+
type = _ref12.type;
|
|
443
479
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
444
480
|
var value = (_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data;
|
|
445
481
|
var values = Array.isArray(value) ? value : [value];
|
|
@@ -463,7 +499,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
463
499
|
return {
|
|
464
500
|
key: key,
|
|
465
501
|
content: contentComponent,
|
|
466
|
-
width: getColumnWidth(key, type)
|
|
502
|
+
width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
|
|
467
503
|
};
|
|
468
504
|
}),
|
|
469
505
|
ref: rowIndex === items.length - 1 ? function (el) {
|
|
@@ -529,7 +565,6 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
529
565
|
}
|
|
530
566
|
}, _callee, null, [[3, 9]]);
|
|
531
567
|
})), [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
532
|
-
var shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
533
568
|
var isEditable = onVisibleColumnKeysChange && hasData;
|
|
534
569
|
return jsx("div", {
|
|
535
570
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
@@ -541,8 +576,11 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
541
576
|
css: [tableContainerStyles, scrollableContainerHeight && scrollableContainerStyles],
|
|
542
577
|
style: scrollableContainerHeight ? {
|
|
543
578
|
maxHeight: "".concat(scrollableContainerHeight, "px")
|
|
544
|
-
} : undefined
|
|
545
|
-
|
|
579
|
+
} : undefined,
|
|
580
|
+
"data-testid": 'issue-like-table-container'
|
|
581
|
+
}, jsx(WidthObserver, {
|
|
582
|
+
setWidth: debounce(setTableContainerWidth, 100)
|
|
583
|
+
}), jsx(Table, {
|
|
546
584
|
css: tableStyles,
|
|
547
585
|
"data-testid": testId,
|
|
548
586
|
style: shouldUseWidth ? {
|
|
@@ -554,10 +592,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
554
592
|
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
|
|
555
593
|
}, jsx("tr", {
|
|
556
594
|
ref: tableHeaderRowRef
|
|
557
|
-
}, headerColumns.map(function (
|
|
558
|
-
var key =
|
|
559
|
-
content =
|
|
560
|
-
width =
|
|
595
|
+
}, headerColumns.map(function (_ref14, cellIndex) {
|
|
596
|
+
var key = _ref14.key,
|
|
597
|
+
content = _ref14.content,
|
|
598
|
+
width = _ref14.width;
|
|
561
599
|
var heading = jsx(Tooltip, {
|
|
562
600
|
content: content,
|
|
563
601
|
tag: "span",
|
|
@@ -574,10 +612,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
574
612
|
}
|
|
575
613
|
if (isEditable) {
|
|
576
614
|
var _containerRef$current3;
|
|
577
|
-
var previewRows = tableRows.map(function (
|
|
578
|
-
var cells =
|
|
579
|
-
var cell = cells.find(function (
|
|
580
|
-
var cellKey =
|
|
615
|
+
var previewRows = tableRows.map(function (_ref15) {
|
|
616
|
+
var cells = _ref15.cells;
|
|
617
|
+
var cell = cells.find(function (_ref16) {
|
|
618
|
+
var cellKey = _ref16.key;
|
|
581
619
|
return cellKey === key;
|
|
582
620
|
});
|
|
583
621
|
if (cell) {
|
|
@@ -619,18 +657,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
619
657
|
})))), jsx("tbody", {
|
|
620
658
|
css: noDefaultBorderStyles,
|
|
621
659
|
"data-testid": testId && "".concat(testId, "--body")
|
|
622
|
-
}, rows.map(function (
|
|
623
|
-
var key =
|
|
624
|
-
cells =
|
|
625
|
-
ref =
|
|
660
|
+
}, rows.map(function (_ref17) {
|
|
661
|
+
var key = _ref17.key,
|
|
662
|
+
cells = _ref17.cells,
|
|
663
|
+
ref = _ref17.ref;
|
|
626
664
|
return jsx("tr", {
|
|
627
665
|
key: key,
|
|
628
666
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
629
667
|
ref: ref
|
|
630
|
-
}, cells.map(function (
|
|
631
|
-
var cellKey =
|
|
632
|
-
content =
|
|
633
|
-
width =
|
|
668
|
+
}, cells.map(function (_ref18, cellIndex) {
|
|
669
|
+
var cellKey = _ref18.key,
|
|
670
|
+
content = _ref18.content,
|
|
671
|
+
width = _ref18.width;
|
|
634
672
|
var isLastCell = cellIndex === cells.length - 1;
|
|
635
673
|
var loadingRowStyle = getWidthCss({
|
|
636
674
|
shouldUseWidth: shouldUseWidth,
|
|
@@ -8,8 +8,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
8
8
|
import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
|
|
9
9
|
import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
var rootStyles = css({
|
|
11
|
-
position: 'relative'
|
|
12
|
-
display: 'block'
|
|
11
|
+
position: 'relative'
|
|
13
12
|
});
|
|
14
13
|
var smartLinkNodeToUrl = function smartLinkNodeToUrl(node) {
|
|
15
14
|
var _node$attrs$url;
|
|
@@ -46,7 +45,7 @@ var RichTextType = function RichTextType(_ref) {
|
|
|
46
45
|
return parseRichText(value);
|
|
47
46
|
}, [value]);
|
|
48
47
|
if (adfPlainText) {
|
|
49
|
-
return jsx("
|
|
48
|
+
return jsx("span", {
|
|
50
49
|
css: rootStyles,
|
|
51
50
|
"data-testid": "richtext-plaintext"
|
|
52
51
|
}, adfPlainText);
|
|
@@ -26,11 +26,19 @@ export var withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody')
|
|
|
26
26
|
export var TableHeading = styled.th((_styled$th = {}, _defineProperty(_styled$th, "".concat(withTablePluginHeaderPrefix()), {
|
|
27
27
|
border: 0,
|
|
28
28
|
position: 'relative',
|
|
29
|
+
/* This makes resizing work with out jumping due to padding + changes overall width for same default values. */
|
|
29
30
|
boxSizing: 'border-box',
|
|
30
31
|
lineHeight: lineHeight,
|
|
31
32
|
padding: "".concat(verticalPadding, " ", "var(--ds-space-050, 4px)"),
|
|
32
33
|
borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
|
|
33
34
|
borderBottom: "2px solid ".concat("var(--ds-border, ".concat(N40, ")")),
|
|
35
|
+
/*
|
|
36
|
+
lineHeight * 2 -> Max height of two lined header
|
|
37
|
+
verticalPadding * 2 -> padding for this component itself
|
|
38
|
+
verticalPadding * 2 -> padding inside span (--container)
|
|
39
|
+
2px -> Bottom border
|
|
40
|
+
Last two terms are needed because of border-box box sizing.
|
|
41
|
+
*/
|
|
34
42
|
height: "calc(".concat(lineHeight, " * 2 + ").concat(verticalPadding, " * 4 + 2px)"),
|
|
35
43
|
verticalAlign: 'bottom',
|
|
36
44
|
backgroundColor: "var(--ds-elevation-surface-current, #FFF)"
|
|
@@ -42,6 +50,9 @@ export var TableHeading = styled.th((_styled$th = {}, _defineProperty(_styled$th
|
|
|
42
50
|
borderRight: 0
|
|
43
51
|
}), _defineProperty(_styled$th, "& [data-testid='datasource-header-content--container']", {
|
|
44
52
|
width: '100%',
|
|
53
|
+
/* With Button now being a parent for this component it adds its lineHeight value and spoils
|
|
54
|
+
`height` calculation above. */
|
|
55
|
+
lineHeight: lineHeight,
|
|
45
56
|
padding: "".concat(verticalPadding, " ", "var(--ds-space-050, 4px)"),
|
|
46
57
|
display: '-webkit-box',
|
|
47
58
|
WebkitLineClamp: 2,
|
|
@@ -8,16 +8,23 @@ export var COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
|
8
8
|
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
9
9
|
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
10
10
|
* column widths we treat all width as custom hardcoded widths.
|
|
11
|
-
* @param width
|
|
11
|
+
* @param width Sometimes set to undefined for last column to make it occupy remainder of the table width
|
|
12
12
|
*/
|
|
13
13
|
export var getWidthCss = function getWidthCss(_ref) {
|
|
14
14
|
var shouldUseWidth = _ref.shouldUseWidth,
|
|
15
15
|
width = _ref.width;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
if (!width) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
if (shouldUseWidth) {
|
|
20
|
+
return {
|
|
21
|
+
width: width
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
return {
|
|
25
|
+
maxWidth: width
|
|
26
|
+
};
|
|
27
|
+
}
|
|
21
28
|
};
|
|
22
29
|
|
|
23
30
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Datasource, DatasourceAdf } from '@atlaskit/linking-common/types';
|
|
1
|
+
import { type Datasource, type DatasourceAdf } from '@atlaskit/linking-common/types';
|
|
2
2
|
export declare const buildDatasourceAdf: <P extends Record<string, unknown>>(datasource: Datasource<P>, url?: string) => DatasourceAdf<P>;
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
export declare const DatasourceTableView: import("react").ForwardRefExoticComponent<{
|
|
3
3
|
datasourceId: string;
|
|
4
4
|
parameters: object;
|
|
5
|
-
fields?: string[] | undefined;
|
|
6
5
|
url?: string | undefined;
|
|
7
6
|
} & Partial<Pick<import("../issue-like-table/types").IssueLikeDataTableViewProps, "visibleColumnKeys" | "wrappedColumnKeys" | "columnCustomSizes" | "onVisibleColumnKeysChange" | "onColumnResize" | "onWrappedColumnChange">> & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { IssueLikeDataTableViewProps } from '../issue-like-table/types';
|
|
1
|
+
import { type IssueLikeDataTableViewProps } from '../issue-like-table/types';
|
|
2
2
|
export type DatasourceTableViewProps = {
|
|
3
3
|
/** Unique identifier for which type of datasource is being rendered and for making its requests */
|
|
4
4
|
datasourceId: string;
|
|
5
5
|
/** Parameters for making the data requests necessary to render data within the table */
|
|
6
6
|
parameters: object;
|
|
7
|
-
fields?: string[];
|
|
8
7
|
/** Url for an existing datasource, initially used for displaying to a user unauthorized to query that site */
|
|
9
8
|
url?: string;
|
|
10
9
|
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes'>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
interface DraggableTableHeadingProps {
|
|
5
5
|
children: ReactNode;
|
|
@@ -8,7 +8,7 @@ interface DraggableTableHeadingProps {
|
|
|
8
8
|
tableId: symbol;
|
|
9
9
|
dndPreviewHeight: number;
|
|
10
10
|
dragPreview: React.ReactNode;
|
|
11
|
-
width
|
|
11
|
+
width?: number;
|
|
12
12
|
onWidthChange?: (width: number) => void;
|
|
13
13
|
isWrapped?: boolean;
|
|
14
14
|
onIsWrappedChange?: (shouldWrap: boolean) => void;
|
|
@@ -4,7 +4,7 @@ export declare const COLUMN_BASE_WIDTH = 8;
|
|
|
4
4
|
export declare const COLUMN_MIN_WIDTH: number;
|
|
5
5
|
export type GetWidthCss = (arg: {
|
|
6
6
|
shouldUseWidth: boolean;
|
|
7
|
-
width
|
|
7
|
+
width?: number;
|
|
8
8
|
}) => React.CSSProperties;
|
|
9
9
|
/**
|
|
10
10
|
* Generate width related portion of css for table cell.
|
|
@@ -13,7 +13,7 @@ export type GetWidthCss = (arg: {
|
|
|
13
13
|
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
14
14
|
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
15
15
|
* column widths we treat all width as custom hardcoded widths.
|
|
16
|
-
* @param width
|
|
16
|
+
* @param width Sometimes set to undefined for last column to make it occupy remainder of the table width
|
|
17
17
|
*/
|
|
18
18
|
export declare const getWidthCss: GetWidthCss;
|
|
19
19
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Datasource, DatasourceAdf } from '@atlaskit/linking-common/types';
|
|
1
|
+
import { type Datasource, type DatasourceAdf } from '@atlaskit/linking-common/types';
|
|
2
2
|
export declare const buildDatasourceAdf: <P extends Record<string, unknown>>(datasource: Datasource<P>, url?: string) => DatasourceAdf<P>;
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
export declare const DatasourceTableView: import("react").ForwardRefExoticComponent<{
|
|
3
3
|
datasourceId: string;
|
|
4
4
|
parameters: object;
|
|
5
|
-
fields?: string[] | undefined;
|
|
6
5
|
url?: string | undefined;
|
|
7
6
|
} & Partial<Pick<import("../issue-like-table/types").IssueLikeDataTableViewProps, "visibleColumnKeys" | "wrappedColumnKeys" | "columnCustomSizes" | "onVisibleColumnKeysChange" | "onColumnResize" | "onWrappedColumnChange">> & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { IssueLikeDataTableViewProps } from '../issue-like-table/types';
|
|
1
|
+
import { type IssueLikeDataTableViewProps } from '../issue-like-table/types';
|
|
2
2
|
export type DatasourceTableViewProps = {
|
|
3
3
|
/** Unique identifier for which type of datasource is being rendered and for making its requests */
|
|
4
4
|
datasourceId: string;
|
|
5
5
|
/** Parameters for making the data requests necessary to render data within the table */
|
|
6
6
|
parameters: object;
|
|
7
|
-
fields?: string[];
|
|
8
7
|
/** Url for an existing datasource, initially used for displaying to a user unauthorized to query that site */
|
|
9
8
|
url?: string;
|
|
10
9
|
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes'>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
interface DraggableTableHeadingProps {
|
|
5
5
|
children: ReactNode;
|
|
@@ -8,7 +8,7 @@ interface DraggableTableHeadingProps {
|
|
|
8
8
|
tableId: symbol;
|
|
9
9
|
dndPreviewHeight: number;
|
|
10
10
|
dragPreview: React.ReactNode;
|
|
11
|
-
width
|
|
11
|
+
width?: number;
|
|
12
12
|
onWidthChange?: (width: number) => void;
|
|
13
13
|
isWrapped?: boolean;
|
|
14
14
|
onIsWrappedChange?: (shouldWrap: boolean) => void;
|
|
@@ -4,7 +4,7 @@ export declare const COLUMN_BASE_WIDTH = 8;
|
|
|
4
4
|
export declare const COLUMN_MIN_WIDTH: number;
|
|
5
5
|
export type GetWidthCss = (arg: {
|
|
6
6
|
shouldUseWidth: boolean;
|
|
7
|
-
width
|
|
7
|
+
width?: number;
|
|
8
8
|
}) => React.CSSProperties;
|
|
9
9
|
/**
|
|
10
10
|
* Generate width related portion of css for table cell.
|
|
@@ -13,7 +13,7 @@ export type GetWidthCss = (arg: {
|
|
|
13
13
|
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
14
14
|
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
15
15
|
* column widths we treat all width as custom hardcoded widths.
|
|
16
|
-
* @param width
|
|
16
|
+
* @param width Sometimes set to undefined for last column to make it occupy remainder of the table width
|
|
17
17
|
*/
|
|
18
18
|
export declare const getWidthCss: GetWidthCss;
|
|
19
19
|
/**
|