@atlaskit/link-datasource 0.31.2 → 0.31.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +7 -19
  3. package/dist/cjs/ui/issue-like-table/column-picker/index.js +2 -4
  4. package/dist/cjs/ui/issue-like-table/drag-column-preview.js +37 -0
  5. package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +60 -25
  6. package/dist/cjs/ui/issue-like-table/empty-state/index.js +6 -1
  7. package/dist/cjs/ui/issue-like-table/index.js +102 -71
  8. package/dist/cjs/ui/issue-like-table/styled.js +2 -1
  9. package/dist/cjs/ui/jira-issues-modal/modal/index.js +12 -9
  10. package/dist/cjs/ui/table-footer/index.js +10 -7
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +8 -20
  13. package/dist/es2019/ui/issue-like-table/column-picker/index.js +1 -3
  14. package/dist/es2019/ui/issue-like-table/drag-column-preview.js +46 -0
  15. package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +53 -18
  16. package/dist/es2019/ui/issue-like-table/empty-state/index.js +6 -1
  17. package/dist/es2019/ui/issue-like-table/index.js +86 -43
  18. package/dist/es2019/ui/issue-like-table/styled.js +18 -0
  19. package/dist/es2019/ui/jira-issues-modal/modal/index.js +13 -10
  20. package/dist/es2019/ui/table-footer/index.js +11 -11
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +8 -20
  23. package/dist/esm/ui/issue-like-table/column-picker/index.js +2 -4
  24. package/dist/esm/ui/issue-like-table/drag-column-preview.js +29 -0
  25. package/dist/esm/ui/issue-like-table/draggable-table-heading.js +60 -25
  26. package/dist/esm/ui/issue-like-table/empty-state/index.js +6 -1
  27. package/dist/esm/ui/issue-like-table/index.js +102 -71
  28. package/dist/esm/ui/issue-like-table/styled.js +2 -1
  29. package/dist/esm/ui/jira-issues-modal/modal/index.js +13 -10
  30. package/dist/esm/ui/table-footer/index.js +10 -7
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/ui/issue-like-table/column-picker/index.d.ts +1 -1
  33. package/dist/types/ui/issue-like-table/column-picker/types.d.ts +0 -1
  34. package/dist/types/ui/issue-like-table/drag-column-preview.d.ts +7 -0
  35. package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
  36. package/dist/types/ui/issue-like-table/index.d.ts +1 -1
  37. package/dist/types/ui/issue-like-table/types.d.ts +5 -0
  38. package/dist/types-ts4.5/ui/issue-like-table/column-picker/index.d.ts +1 -1
  39. package/dist/types-ts4.5/ui/issue-like-table/column-picker/types.d.ts +0 -1
  40. package/dist/types-ts4.5/ui/issue-like-table/drag-column-preview.d.ts +7 -0
  41. package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
  42. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
  43. package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +5 -0
  44. package/package.json +2 -2
@@ -12,33 +12,50 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
12
12
  import { css, jsx } from '@emotion/react';
13
13
  import styled from '@emotion/styled';
14
14
  import invariant from 'tiny-invariant';
15
+ import Heading from '@atlaskit/heading';
15
16
  import { Skeleton } from '@atlaskit/linking-common';
16
17
  import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
17
18
  import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
18
19
  import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
19
20
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
20
21
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
22
+ import { N40 } from '@atlaskit/theme/colors';
21
23
  import { ColumnPicker } from './column-picker';
24
+ import { DragColumnPreview } from './drag-column-preview';
22
25
  import { DraggableTableHeading } from './draggable-table-heading';
23
26
  import TableEmptyState from './empty-state';
24
27
  import { fallbackRenderType } from './render-type';
25
28
  import { Table, TableHeading } from './styled';
26
29
  import { useIsOnScreen } from './useIsOnScreen';
30
+ var tableSidePadding = "var(--ds-space-200, 16px)";
27
31
  var tableHeadStyles = css({
28
32
  background: "var(--ds-surface, #FFF)",
29
- borderTop: '2px solid transparent'
33
+ position: 'sticky',
34
+ top: 0,
35
+ zIndex: 10
30
36
  });
31
- var ColumnPickerHeader = styled.td(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 40px;\n padding-block: ", ";\n position: sticky;\n right: 0px;\n background-color: ", ";\n &:last-child {\n padding-right: ", ";\n }\n"])), "var(--ds-space-100, 8px)", "var(--ds-surface, #FFF)", "var(--ds-space-100, 8px)");
37
+ var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 40px;\n position: sticky;\n right: calc(-1 * ", ");\n background-color: ", ";\n border-bottom: 2px solid ", "; /* It is required to have solid (not half-transparent) color because of this gradient business bellow */\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 0%,\n ", " 10%\n );\n vertical-align: middle; /* Keeps dropdown button in the middle */\n &:last-of-type {\n padding-right: ", ";\n }\n"])), tableSidePadding, "var(--ds-surface, #FFF)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"), "var(--ds-surface, #FFF)", tableSidePadding);
32
38
  var truncatedCellStyles = css({
33
39
  overflow: 'hidden',
34
40
  textOverflow: 'ellipsis',
35
41
  whiteSpace: 'nowrap'
36
42
  });
37
- var tableDragPreviewStyles = css({
38
- backgroundColor: "var(--ds-surface, #FFF)"
43
+ var scrollableContainerStyles = css({
44
+ overflow: 'auto',
45
+ padding: "0 ".concat(tableSidePadding, " 0 ").concat(tableSidePadding),
46
+ boxSizing: 'border-box'
39
47
  });
40
- var containerDragPreviewStyles = css({
41
- overflow: 'hidden'
48
+ var tableStyles = css({
49
+ // These styles are needed to prevent thead bottom border from scrolling away.
50
+ // This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
51
+ borderCollapse: 'separate',
52
+ borderSpacing: 0
53
+ });
54
+
55
+ // By default tbody and thead have border-bottom: 2px ...
56
+ // This removes it, because for header we handle it via `th` styling and footer supply bottom border
57
+ var noDefaultBorderStyles = css({
58
+ borderBottom: 0
42
59
  });
43
60
  function extractIndex(data) {
44
61
  var index = data.index;
@@ -66,7 +83,6 @@ var BASE_WIDTH = 8;
66
83
  function getColumnWidth(key, type) {
67
84
  var keyBasedWidth = {
68
85
  assignee: BASE_WIDTH * 22,
69
- key: BASE_WIDTH * 10,
70
86
  labels: BASE_WIDTH * 22,
71
87
  priority: BASE_WIDTH * 8,
72
88
  status: BASE_WIDTH * 18,
@@ -96,7 +112,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
96
112
  visibleColumnKeys = _ref2.visibleColumnKeys,
97
113
  onVisibleColumnKeysChange = _ref2.onVisibleColumnKeysChange,
98
114
  status = _ref2.status,
99
- hasNextPage = _ref2.hasNextPage;
115
+ hasNextPage = _ref2.hasNextPage,
116
+ scrollableContainerHeight = _ref2.scrollableContainerHeight;
100
117
  var tableId = useMemo(function () {
101
118
  return Symbol('unique-id');
102
119
  }, []);
@@ -106,20 +123,16 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
106
123
  setLastRowElement = _useState2[1];
107
124
  var _useState3 = useState(false),
108
125
  _useState4 = _slicedToArray(_useState3, 2),
109
- isDragPreview = _useState4[0],
110
- setIsDragPreview = _useState4[1];
111
- var _useState5 = useState(false),
112
- _useState6 = _slicedToArray(_useState5, 2),
113
- hasFullSchema = _useState6[0],
114
- setHasFullSchema = _useState6[1];
126
+ hasFullSchema = _useState4[0],
127
+ setHasFullSchema = _useState4[1];
115
128
  var isBottomOfTableVisibleRaw = useIsOnScreen(lastRowElement);
116
129
  var containerRef = useRef(null);
117
- var _useState7 = useState(function () {
130
+ var _useState5 = useState(function () {
118
131
  return orderColumns(_toConsumableArray(columns), _toConsumableArray(visibleColumnKeys));
119
132
  }),
120
- _useState8 = _slicedToArray(_useState7, 2),
121
- orderedColumns = _useState8[0],
122
- setOrderedColumns = _useState8[1];
133
+ _useState6 = _slicedToArray(_useState5, 2),
134
+ orderedColumns = _useState6[0],
135
+ setOrderedColumns = _useState6[1];
123
136
  useEffect(function () {
124
137
  setOrderedColumns(orderColumns(_toConsumableArray(columns), _toConsumableArray(visibleColumnKeys)));
125
138
  }, [columns, visibleColumnKeys]);
@@ -154,17 +167,19 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
154
167
  })
155
168
  };
156
169
  }, [visibleSortedColumns]);
157
- var headColumns = visibleSortedColumns.map(function (_ref5) {
158
- var key = _ref5.key,
159
- title = _ref5.title,
160
- type = _ref5.type;
161
- return {
162
- key: key,
163
- content: title,
164
- shouldTruncate: true,
165
- maxWidth: getColumnWidth(key, type)
166
- };
167
- });
170
+ var headColumns = useMemo(function () {
171
+ return visibleSortedColumns.map(function (_ref5) {
172
+ var key = _ref5.key,
173
+ title = _ref5.title,
174
+ type = _ref5.type;
175
+ return {
176
+ key: key,
177
+ content: title,
178
+ shouldTruncate: true,
179
+ maxWidth: getColumnWidth(key, type)
180
+ };
181
+ });
182
+ }, [visibleSortedColumns]);
168
183
  useEffect(function () {
169
184
  if (isBottomOfTableVisibleRaw && hasNextPage && status === 'resolved') {
170
185
  void onNextPage({
@@ -172,41 +187,43 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
172
187
  });
173
188
  }
174
189
  }, [isBottomOfTableVisibleRaw, status, hasNextPage, onNextPage]);
175
- var dndPreviewHeight = 0;
176
- if (items.length > 0 && containerRef.current) {
177
- var containerEl = containerRef.current;
178
- invariant(containerEl);
179
- dndPreviewHeight = containerEl.offsetHeight;
180
- }
190
+ var hasData = items.length > 0;
181
191
 
182
192
  // This variable contains initial Y mouse coordinate, so we can restrict
183
193
  // autoScroller in X axis only
184
194
  var initialAutoScrollerClientY = useRef();
185
195
  useEffect(function () {
186
- if (!onVisibleColumnKeysChange) {
196
+ if (!onVisibleColumnKeysChange || !hasData) {
187
197
  return;
188
198
  }
189
199
  return combine(monitorForElements({
190
200
  onDragStart: function onDragStart(_ref6) {
201
+ var _containerRef$current;
191
202
  var location = _ref6.location;
192
203
  initialAutoScrollerClientY.current = location.current.input.clientY;
193
204
  autoScroller.start({
194
- input: location.current.input,
205
+ input: _objectSpread(_objectSpread({}, location.current.input), {}, {
206
+ clientY:
207
+ // The goal is to have clientY the same and in the middle of the scrollable area
208
+ // Since clientY is taken from to of the viewport we need to plus that in order to get
209
+ // middle of the scrollable area in reference to the viewport
210
+ (initialAutoScrollerClientY.current || 0) + (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetHeight) || 0) / 2
211
+ }),
195
212
  behavior: 'container-only'
196
213
  });
197
214
  },
198
215
  onDrag: function onDrag(_ref7) {
216
+ var _containerRef$current2;
199
217
  var location = _ref7.location;
200
218
  autoScroller.updateInput({
201
219
  input: _objectSpread(_objectSpread({}, location.current.input), {}, {
202
- clientY: initialAutoScrollerClientY.current || 0
220
+ clientY: (initialAutoScrollerClientY.current || 0) + (((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetHeight) || 0) / 2
203
221
  })
204
222
  });
205
223
  },
206
224
  onDrop: function onDrop(_ref8) {
207
225
  var source = _ref8.source,
208
226
  location = _ref8.location;
209
- initialAutoScrollerClientY.current = null;
210
227
  autoScroller.stop();
211
228
  if (location.current.dropTargets.length === 0) {
212
229
  return;
@@ -236,7 +253,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
236
253
  }
237
254
  }
238
255
  }));
239
- }, [visibleColumnKeys, onVisibleColumnKeysChange, tableId]);
256
+ }, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
240
257
  var tableRows = useMemo(function () {
241
258
  return items.map(function (newRowData, rowIndex) {
242
259
  return {
@@ -265,13 +282,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
265
282
  };
266
283
  });
267
284
  }, [identityColumnKey, renderItem, items, visibleSortedColumns]);
268
- var rows = [].concat(_toConsumableArray(tableRows), _toConsumableArray(status === 'loading' ? [loadingRow] : []));
269
- var setIsDragPreviewOn = useCallback(function () {
270
- return setIsDragPreview(true);
271
- }, [setIsDragPreview]);
272
- var setIsDragPreviewOff = useCallback(function () {
273
- return setIsDragPreview(false);
274
- }, [setIsDragPreview]);
285
+ var rows = useMemo(function () {
286
+ return [].concat(_toConsumableArray(tableRows), _toConsumableArray(status === 'loading' ? [loadingRow] : []));
287
+ }, [loadingRow, status, tableRows]);
275
288
  var onSelectedColumnKeysChange = useCallback(function (newSelectedColumnKeys) {
276
289
  onVisibleColumnKeysChange === null || onVisibleColumnKeysChange === void 0 ? void 0 : onVisibleColumnKeysChange(newSelectedColumnKeys);
277
290
  }, [onVisibleColumnKeysChange]);
@@ -304,33 +317,49 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
304
317
  })), [hasFullSchema, onLoadDatasourceDetails]);
305
318
  return jsx("div", {
306
319
  ref: containerRef,
307
- css: isDragPreview ? containerDragPreviewStyles : null
320
+ css: scrollableContainerHeight ? scrollableContainerStyles : null,
321
+ style: scrollableContainerHeight ? {
322
+ maxHeight: "".concat(scrollableContainerHeight, "px")
323
+ } : undefined
308
324
  }, jsx(Table, {
309
- css: isDragPreview ? tableDragPreviewStyles : null,
325
+ css: tableStyles,
310
326
  "data-testid": testId
311
327
  }, jsx("thead", {
312
328
  "data-testid": testId && "".concat(testId, "--head"),
313
- css: tableHeadStyles
329
+ css: [noDefaultBorderStyles, tableHeadStyles]
314
330
  }, jsx("tr", null, headColumns.map(function (_ref11, cellIndex) {
315
331
  var key = _ref11.key,
316
332
  content = _ref11.content,
317
333
  maxWidth = _ref11.maxWidth;
318
- var TruncatedContent = function TruncatedContent() {
319
- return jsx("div", {
320
- css: truncatedCellStyles
321
- }, content);
322
- };
323
- if (onVisibleColumnKeysChange && status !== 'loading') {
334
+ if (onVisibleColumnKeysChange && hasData) {
335
+ var _containerRef$current3;
336
+ var previewRows = tableRows.map(function (_ref12) {
337
+ var cells = _ref12.cells;
338
+ var cell = cells.find(function (_ref13) {
339
+ var cellKey = _ref13.key;
340
+ return cellKey === key;
341
+ });
342
+ if (cell) {
343
+ return cell.content;
344
+ }
345
+ }).slice(0, 5);
346
+ var dragPreview = jsx(DragColumnPreview, {
347
+ title: jsx(Heading, {
348
+ level: "h400"
349
+ }, content),
350
+ rows: previewRows
351
+ });
324
352
  return jsx(DraggableTableHeading, {
325
353
  tableId: tableId,
326
354
  key: key,
327
355
  id: key,
328
356
  index: cellIndex,
329
357
  maxWidth: maxWidth,
330
- dndPreviewHeight: dndPreviewHeight,
331
- onDragPreviewStart: setIsDragPreviewOn,
332
- onDragPreviewEnd: setIsDragPreviewOff
333
- }, jsx(TruncatedContent, null));
358
+ dndPreviewHeight: ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetHeight) || 0,
359
+ dragPreview: dragPreview
360
+ }, jsx(Heading, {
361
+ level: "h400"
362
+ }, content));
334
363
  } else {
335
364
  return jsx(TableHeading, {
336
365
  key: key,
@@ -338,28 +367,30 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
338
367
  style: {
339
368
  maxWidth: maxWidth
340
369
  }
341
- }, jsx(TruncatedContent, null));
370
+ }, jsx(Heading, {
371
+ level: "h400"
372
+ }, content));
342
373
  }
343
- }), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
374
+ }), onVisibleColumnKeysChange && hasData && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
344
375
  columns: hasFullSchema ? orderedColumns : [],
345
376
  selectedColumnKeys: hasFullSchema ? visibleColumnKeys : [],
346
- isDatasourceLoading: status === 'loading',
347
377
  onSelectedColumnKeysChange: onSelectedColumnKeysChange,
348
378
  onOpen: handlePickerOpen
349
379
  })))), jsx("tbody", {
380
+ css: noDefaultBorderStyles,
350
381
  "data-testid": testId && "".concat(testId, "--body")
351
- }, rows.map(function (_ref12) {
352
- var key = _ref12.key,
353
- cells = _ref12.cells,
354
- ref = _ref12.ref;
382
+ }, rows.map(function (_ref14) {
383
+ var key = _ref14.key,
384
+ cells = _ref14.cells,
385
+ ref = _ref14.ref;
355
386
  return jsx("tr", {
356
387
  key: key,
357
388
  "data-testid": testId && "".concat(testId, "--row-").concat(key),
358
389
  ref: ref
359
- }, cells.map(function (_ref13, cellIndex) {
360
- var cellKey = _ref13.key,
361
- content = _ref13.content,
362
- maxWidth = _ref13.maxWidth;
390
+ }, cells.map(function (_ref15, cellIndex) {
391
+ var cellKey = _ref15.key,
392
+ content = _ref15.content,
393
+ maxWidth = _ref15.maxWidth;
363
394
  return jsx("td", {
364
395
  key: cellKey,
365
396
  "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
@@ -1,6 +1,7 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3;
3
3
  import styled from '@emotion/styled';
4
+ import { N40 } from '@atlaskit/theme/colors';
4
5
  export var Table = styled.table(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n"])));
5
- export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding-block: ", ";\n line-height: ", ";\n"])), "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 24px)");
6
+ export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: grab;\n position: relative;\n padding-block: ", ";\n line-height: ", ";\n border-bottom: 2px solid ", ";\n .ProseMirror & h5,\n & h5 {\n margin-top: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 24px; /* Is needed to keep overall height consistent with or without drag handle icon present */\n }\n\n &:hover .issue-like-table-drag-handle {\n width: 24px;\n }\n &:hover .issue-like-table-drag-handle-spacer {\n width: 0px;\n }\n"])), "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 24px)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"));
6
7
  export var EmptyStateTableHeading = styled(TableHeading)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:first-child {\n padding-left: ", ";\n }\n"])), "var(--ds-space-100, 8px)");
@@ -8,7 +8,7 @@ import { css, jsx } from '@emotion/react';
8
8
  import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
9
9
  import Button from '@atlaskit/button/standard-button';
10
10
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
11
- import { B400, N0, N800 } from '@atlaskit/theme/colors';
11
+ import { B400, N0, N40, N800 } from '@atlaskit/theme/colors';
12
12
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
13
13
  import { getAvailableJiraSites } from '../../../services/getAvailableJiraSites';
14
14
  import { AccessRequired } from '../../common/error-state/access-required';
@@ -26,8 +26,9 @@ var dropdownContainerStyles = css({
26
26
  });
27
27
  var contentContainerStyles = css({
28
28
  display: 'grid',
29
- height: '420px',
30
- overflow: 'auto'
29
+ maxHeight: '420px',
30
+ overflow: 'auto',
31
+ borderBottom: "2px solid ".concat("var(--ds-background-accent-gray-subtler, ".concat(N40, ")"))
31
32
  });
32
33
  var placeholderSmartLinkStyles = css({
33
34
  backgroundColor: "var(--ds-surface-raised, ".concat(N0, ")"),
@@ -200,7 +201,9 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
200
201
  setCurrentViewMode(selectedMode);
201
202
  };
202
203
  var issueLikeDataTableView = useMemo(function () {
203
- return jsx(IssueLikeDataTableView, {
204
+ return jsx("div", {
205
+ css: contentContainerStyles
206
+ }, jsx(IssueLikeDataTableView, {
204
207
  testId: "jira-jql-datasource-table",
205
208
  status: status,
206
209
  columns: columns,
@@ -210,7 +213,7 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
210
213
  onNextPage: onNextPage,
211
214
  onLoadDatasourceDetails: loadDatasourceDetails,
212
215
  onVisibleColumnKeysChange: setVisibleColumnKeys
213
- });
216
+ }));
214
217
  }, [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, responseItems, status, visibleColumnKeys]);
215
218
  var renderCountModeContent = useCallback(function () {
216
219
  var url = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
@@ -247,9 +250,11 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
247
250
  return jsx(NoResults, null);
248
251
  } else if (status === 'empty' || !columns.length) {
249
252
  // persist the empty state when making the initial /data request which contains the columns
250
- return jsx(EmptyState, {
253
+ return jsx("div", {
254
+ css: contentContainerStyles
255
+ }, jsx(EmptyState, {
251
256
  testId: "jira-jql-datasource-modal--empty-state"
252
- });
257
+ }));
253
258
  }
254
259
  var firstIssueUrl = retrieveUrlForSmartCardRender();
255
260
  if (responseItems.length === 1 && firstIssueUrl) {
@@ -292,9 +297,7 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
292
297
  isSearching: status === 'loading',
293
298
  parameters: parameters,
294
299
  onSearch: onSearch
295
- }), jsx("div", {
296
- css: contentContainerStyles
297
- }, currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent())), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
300
+ }), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
298
301
  "data-testid": "jira-jql-datasource-modal-total-issues-count",
299
302
  css: issueCountStyles
300
303
  }, jsx(FormattedNumber, {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
5
5
  /** @jsx jsx */
6
6
  import { Fragment, useEffect, useState } from 'react';
7
7
  import { jsx } from '@emotion/react';
@@ -13,10 +13,11 @@ import RefreshIcon from '@atlaskit/icon/glyph/refresh';
13
13
  import { N0, N40, N800, N90 } from '@atlaskit/theme/colors';
14
14
  import { footerMessages } from './messages';
15
15
  import { SyncInfo } from './sync-info';
16
- var FooterWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n padding: ", " 0;\n position: sticky;\n bottom: 0;\n background: ", ";\n border-top-style: solid;\n border-top-color: ", ";\n margin-top: -2px;\n align-self: center;\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-input, ".concat(N0, ")"), "var(--ds-background-neutral, ".concat(N40, ")"));
17
- var IssueCounterWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-left: 10px;\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(N800, ")"));
18
- var SyncWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(N90, ")"));
19
- var SyncTextWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-right: 5px;\n"])));
16
+ var FooterWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 ", ";\n box-sizing: border-box;\n background: ", ";\n"])), "var(--ds-space-200, 16px)", "var(--ds-background-input, ".concat(N0, ")"));
17
+ var TopBorderWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n box-sizing: border-box;\n justify-content: space-between;\n padding: ", " 0;\n border-top: 2px solid ", ";\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"));
18
+ var IssueCounterWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(N800, ")"));
19
+ var SyncWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(N90, ")"));
20
+ var SyncTextWrapper = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-right: 5px;\n"])));
20
21
  export var TableFooter = function TableFooter(_ref) {
21
22
  var issueCount = _ref.issueCount,
22
23
  onRefresh = _ref.onRefresh,
@@ -37,7 +38,9 @@ export var TableFooter = function TableFooter(_ref) {
37
38
  // ensure correct positioning since 'justify-content: space-between' is used).
38
39
  return onRefresh || showIssueCount ? jsx(FooterWrapper, {
39
40
  "data-testid": "table-footer"
40
- }, jsx(IssueCounterWrapper, null, showIssueCount && jsx(Heading, {
41
+ }, jsx(TopBorderWrapper, null, jsx(IssueCounterWrapper, {
42
+ "data-testid": 'issue-count-wrapper'
43
+ }, showIssueCount && jsx(Heading, {
41
44
  testId: "issue-count",
42
45
  level: "h400"
43
46
  }, jsx(FormattedNumber, {
@@ -58,5 +61,5 @@ export var TableFooter = function TableFooter(_ref) {
58
61
  }),
59
62
  isDisabled: isLoading,
60
63
  testId: "refresh-button"
61
- })))) : null;
64
+ }))))) : null;
62
65
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,3 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { ColumnPickerProps } from './types';
3
- export declare const ColumnPicker: ({ isDatasourceLoading, columns, selectedColumnKeys, onSelectedColumnKeysChange, onOpen, }: ColumnPickerProps) => jsx.JSX.Element;
3
+ export declare const ColumnPicker: ({ columns, selectedColumnKeys, onSelectedColumnKeysChange, onOpen, }: ColumnPickerProps) => jsx.JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types';
2
2
  export type ColumnPickerProps = {
3
- isDatasourceLoading: boolean;
4
3
  columns: DatasourceResponseSchemaProperty[];
5
4
  selectedColumnKeys: string[];
6
5
  onSelectedColumnKeysChange: (selectedColumnKeys: string[]) => void;
@@ -0,0 +1,7 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ export declare const DragColumnPreview: ({ title, rows, }: {
5
+ title: React.ReactNode;
6
+ rows: React.ReactNode[];
7
+ }) => jsx.JSX.Element;
@@ -1,13 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- export declare const DraggableTableHeading: ({ children, id, index, tableId, dndPreviewHeight, maxWidth, onDragPreviewStart, onDragPreviewEnd, }: {
4
+ export declare const DraggableTableHeading: ({ children, id, index, tableId, dndPreviewHeight, dragPreview, maxWidth, }: {
5
5
  children: ReactNode;
6
6
  id: string;
7
7
  index: number;
8
8
  tableId: Symbol;
9
9
  dndPreviewHeight: number;
10
+ dragPreview: React.ReactNode;
10
11
  maxWidth?: number | undefined;
11
- onDragPreviewStart: () => void;
12
- onDragPreviewEnd: () => void;
13
12
  }) => jsx.JSX.Element;
@@ -12,5 +12,5 @@ export interface RowCellType {
12
12
  content?: React.ReactNode | string;
13
13
  maxWidth?: number;
14
14
  }
15
- export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
15
+ export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
16
16
  export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -37,4 +37,9 @@ export interface IssueLikeDataTableViewProps {
37
37
  * @param visibleColumnKeys
38
38
  */
39
39
  onVisibleColumnKeysChange?: (visibleColumnKeys: string[]) => void;
40
+ /**
41
+ * If this number is set it will restrict (max-height) maximum size of the component AND make main container a scrollable container.
42
+ * It this number is undefined it will not restrict height and not make container scrollable.
43
+ */
44
+ scrollableContainerHeight?: number;
40
45
  }
@@ -1,3 +1,3 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { ColumnPickerProps } from './types';
3
- export declare const ColumnPicker: ({ isDatasourceLoading, columns, selectedColumnKeys, onSelectedColumnKeysChange, onOpen, }: ColumnPickerProps) => jsx.JSX.Element;
3
+ export declare const ColumnPicker: ({ columns, selectedColumnKeys, onSelectedColumnKeysChange, onOpen, }: ColumnPickerProps) => jsx.JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types';
2
2
  export type ColumnPickerProps = {
3
- isDatasourceLoading: boolean;
4
3
  columns: DatasourceResponseSchemaProperty[];
5
4
  selectedColumnKeys: string[];
6
5
  onSelectedColumnKeysChange: (selectedColumnKeys: string[]) => void;
@@ -0,0 +1,7 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ export declare const DragColumnPreview: ({ title, rows, }: {
5
+ title: React.ReactNode;
6
+ rows: React.ReactNode[];
7
+ }) => jsx.JSX.Element;
@@ -1,13 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- export declare const DraggableTableHeading: ({ children, id, index, tableId, dndPreviewHeight, maxWidth, onDragPreviewStart, onDragPreviewEnd, }: {
4
+ export declare const DraggableTableHeading: ({ children, id, index, tableId, dndPreviewHeight, dragPreview, maxWidth, }: {
5
5
  children: ReactNode;
6
6
  id: string;
7
7
  index: number;
8
8
  tableId: Symbol;
9
9
  dndPreviewHeight: number;
10
+ dragPreview: React.ReactNode;
10
11
  maxWidth?: number | undefined;
11
- onDragPreviewStart: () => void;
12
- onDragPreviewEnd: () => void;
13
12
  }) => jsx.JSX.Element;
@@ -12,5 +12,5 @@ export interface RowCellType {
12
12
  content?: React.ReactNode | string;
13
13
  maxWidth?: number;
14
14
  }
15
- export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
15
+ export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
16
16
  export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -37,4 +37,9 @@ export interface IssueLikeDataTableViewProps {
37
37
  * @param visibleColumnKeys
38
38
  */
39
39
  onVisibleColumnKeysChange?: (visibleColumnKeys: string[]) => void;
40
+ /**
41
+ * If this number is set it will restrict (max-height) maximum size of the component AND make main container a scrollable container.
42
+ * It this number is undefined it will not restrict height and not make container scrollable.
43
+ */
44
+ scrollableContainerHeight?: number;
40
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -58,6 +58,7 @@
58
58
  "@emotion/react": "^11.7.1",
59
59
  "@emotion/styled": "^11.0.0",
60
60
  "debounce-promise": "^3.1.2",
61
+ "react-dom": "^16.8.0",
61
62
  "react-error-boundary": "^3.1.3",
62
63
  "tiny-invariant": "^1.2.0"
63
64
  },
@@ -78,7 +79,6 @@
78
79
  "fetch-mock": "^8.0.0",
79
80
  "jest-fetch-mock": "^3.0.3",
80
81
  "json-ld-types": "3.8.0",
81
- "react-dom": "^16.8.0",
82
82
  "typescript": "~4.9.5",
83
83
  "wait-for-expect": "^1.2.0"
84
84
  },