@atlaskit/link-datasource 2.9.1 → 2.9.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/hooks/useDatasourceTableState.js +2 -0
  3. package/dist/cjs/ui/assets-modal/modal/index.js +2 -0
  4. package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +3 -1
  5. package/dist/cjs/ui/common/modal/datasources-table-in-modal-preview/index.js +2 -0
  6. package/dist/cjs/ui/confluence-search-modal/modal/ModalOld.js +3 -1
  7. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +2 -0
  8. package/dist/cjs/ui/issue-like-table/index.js +56 -66
  9. package/dist/cjs/ui/issue-like-table/styled.js +25 -3
  10. package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +54 -0
  11. package/dist/cjs/ui/issue-like-table/truncate-text-tag/index.js +32 -0
  12. package/dist/cjs/ui/jira-issues-modal/modal/ModalOld.js +3 -1
  13. package/dist/es2019/hooks/useDatasourceTableState.js +2 -1
  14. package/dist/es2019/ui/assets-modal/modal/index.js +2 -0
  15. package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +3 -1
  16. package/dist/es2019/ui/common/modal/datasources-table-in-modal-preview/index.js +2 -0
  17. package/dist/es2019/ui/confluence-search-modal/modal/ModalOld.js +3 -1
  18. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +2 -0
  19. package/dist/es2019/ui/issue-like-table/index.js +32 -52
  20. package/dist/es2019/ui/issue-like-table/styled.js +33 -0
  21. package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +44 -0
  22. package/dist/es2019/ui/issue-like-table/truncate-text-tag/index.js +21 -0
  23. package/dist/es2019/ui/jira-issues-modal/modal/ModalOld.js +3 -1
  24. package/dist/esm/hooks/useDatasourceTableState.js +2 -0
  25. package/dist/esm/ui/assets-modal/modal/index.js +2 -0
  26. package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +3 -1
  27. package/dist/esm/ui/common/modal/datasources-table-in-modal-preview/index.js +2 -0
  28. package/dist/esm/ui/confluence-search-modal/modal/ModalOld.js +3 -1
  29. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +2 -0
  30. package/dist/esm/ui/issue-like-table/index.js +53 -61
  31. package/dist/esm/ui/issue-like-table/styled.js +24 -2
  32. package/dist/esm/ui/issue-like-table/table-cell-content/index.js +47 -0
  33. package/dist/esm/ui/issue-like-table/truncate-text-tag/index.js +21 -0
  34. package/dist/esm/ui/jira-issues-modal/modal/ModalOld.js +3 -1
  35. package/dist/types/hooks/useDatasourceTableState.d.ts +2 -0
  36. package/dist/types/ui/assets-modal/modal/render-assets-content/index.d.ts +1 -0
  37. package/dist/types/ui/issue-like-table/index.d.ts +1 -17
  38. package/dist/types/ui/issue-like-table/styled.d.ts +4 -0
  39. package/dist/types/ui/issue-like-table/table-cell-content/index.d.ts +12 -0
  40. package/dist/types/ui/issue-like-table/truncate-text-tag/index.d.ts +6 -0
  41. package/dist/types/ui/issue-like-table/types.d.ts +20 -1
  42. package/dist/types-ts4.5/hooks/useDatasourceTableState.d.ts +2 -0
  43. package/dist/types-ts4.5/ui/assets-modal/modal/render-assets-content/index.d.ts +1 -0
  44. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -17
  45. package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +4 -0
  46. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/index.d.ts +12 -0
  47. package/dist/types-ts4.5/ui/issue-like-table/truncate-text-tag/index.d.ts +6 -0
  48. package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +20 -1
  49. package/examples-helpers/buildIssueLikeTable.tsx +2 -0
  50. package/package.json +8 -8
@@ -1,9 +1,8 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  /**
3
2
  * @jsxRuntime classic
4
3
  * @jsx jsx
5
4
  */
6
- import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
6
 
8
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
8
  import { css, jsx } from '@emotion/react';
@@ -13,6 +12,7 @@ import debounce from 'lodash/debounce';
13
12
  import { useIntl } from 'react-intl-next';
14
13
  import invariant from 'tiny-invariant';
15
14
  import { Skeleton } from '@atlaskit/linking-common';
15
+ import { fg } from '@atlaskit/platform-feature-flags';
16
16
  import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
17
17
  import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
18
18
  import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
@@ -30,7 +30,9 @@ import { DragColumnPreview } from './drag-column-preview';
30
30
  import { DraggableTableHeading } from './draggable-table-heading';
31
31
  import TableEmptyState from './empty-state';
32
32
  import { renderType, stringifyType } from './render-type';
33
- import { fieldTextFontSize, Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
33
+ import { Table, TableCell, TableHeading, withTablePluginHeaderPrefix } from './styled';
34
+ import { TableCellContent } from './table-cell-content';
35
+ import { TruncateTextTag } from './truncate-text-tag';
34
36
  import { useIsOnScreen } from './useIsOnScreen';
35
37
  import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
36
38
  const tableSidePadding = "var(--ds-space-200, 16px)";
@@ -41,11 +43,6 @@ const tableHeadStyles = css({
41
43
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
42
44
  zIndex: stickyTableHeadersIndex
43
45
  });
44
- const truncateTextStyles = css({
45
- overflow: 'hidden',
46
- textOverflow: 'ellipsis',
47
- whiteSpace: 'nowrap'
48
- });
49
46
  const columnPickerWidth = 80;
50
47
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
51
48
  const ColumnPickerHeader = styled.th({
@@ -72,39 +69,6 @@ const truncateStyles = css({
72
69
  textOverflow: 'ellipsis',
73
70
  whiteSpace: 'nowrap'
74
71
  });
75
-
76
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
77
- const TableCell = styled.td({
78
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
79
- [`${withTablePluginBodyPrefix()}`]: {
80
- /* First section here is to override things editor table plugin css defines */
81
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
82
- font: fieldTextFontSize,
83
- padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"}`,
84
- border: 0,
85
- minWidth: 'auto',
86
- verticalAlign: 'inherit',
87
- boxSizing: 'border-box',
88
- borderRight: `0.5px solid ${`var(--ds-border, ${N40})`}`,
89
- borderBottom: `0.5px solid ${`var(--ds-border, ${N40})`}`,
90
- overflow: 'hidden'
91
- },
92
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
93
- [`${withTablePluginBodyPrefix('&:first-child')}`]: {
94
- paddingLeft: "var(--ds-space-100, 8px)"
95
- },
96
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
97
- [`${withTablePluginBodyPrefix('&:last-child')}`]: {
98
- borderRight: 0,
99
- paddingRight: "var(--ds-space-100, 8px)"
100
- },
101
- // Inline smart links are pretty opinionated about word-wrapping.
102
- // We want it to be controlled by user, so we make it overflow and truncate by default.
103
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
104
- ["& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span"]: {
105
- whiteSpace: 'unset'
106
- }
107
- });
108
72
  const tableContainerStyles = css({
109
73
  borderRadius: 'inherit',
110
74
  borderBottomLeftRadius: 0,
@@ -314,18 +278,12 @@ function getDefaultColumnWidth(key, type) {
314
278
  return DEFAULT_WIDTH;
315
279
  }
316
280
  }
317
- const TruncateTextTag = /*#__PURE__*/forwardRef((props, ref) => {
318
- return jsx("span", _extends({
319
- css: truncateTextStyles
320
- }, props, {
321
- ref: ref
322
- }), props.children);
323
- });
324
281
  export const IssueLikeDataTableView = ({
325
282
  testId,
326
283
  onNextPage,
327
284
  onLoadDatasourceDetails,
328
285
  items,
286
+ itemIds,
329
287
  columns,
330
288
  renderItem = renderType,
331
289
  visibleColumnKeys,
@@ -406,13 +364,13 @@ export const IssueLikeDataTableView = ({
406
364
  const loadingRow = useMemo(() => ({
407
365
  key: 'loading',
408
366
  cells: headerColumns.map(column => ({
409
- ...column,
410
367
  content: jsx(Skeleton, {
411
368
  borderRadius: 8,
412
369
  width: "100%",
413
370
  height: 14,
414
371
  testId: "issues-table-row-loading"
415
- })
372
+ }),
373
+ key: column.key
416
374
  }))
417
375
  }), [headerColumns]);
418
376
  useEffect(() => {
@@ -499,7 +457,29 @@ export const IssueLikeDataTableView = ({
499
457
  }
500
458
  }));
501
459
  }, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
502
- const tableRows = useMemo(() => items.map((newRowData, rowIndex) => ({
460
+ const tableRows = useMemo(() => fg('enable_datasource_react_sweet_state') ? itemIds.map((id, rowIndex) => {
461
+ return {
462
+ key: id,
463
+ cells: visibleSortedColumns.map(({
464
+ key,
465
+ type
466
+ }, cellIndex) => {
467
+ return {
468
+ key,
469
+ columnKey: key,
470
+ content: jsx(TableCellContent, {
471
+ id: id,
472
+ columnKey: key,
473
+ columnType: type,
474
+ wrappedColumnKeys: wrappedColumnKeys,
475
+ renderItem: renderItem
476
+ }),
477
+ width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
478
+ };
479
+ }),
480
+ ref: rowIndex === items.length - 1 ? el => setLastRowElement(el) : undefined
481
+ };
482
+ }) : items.map((newRowData, rowIndex) => ({
503
483
  key: `${identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex}`,
504
484
  cells: visibleSortedColumns.map(({
505
485
  key,
@@ -531,7 +511,7 @@ export const IssueLikeDataTableView = ({
531
511
  };
532
512
  }),
533
513
  ref: rowIndex === items.length - 1 ? el => setLastRowElement(el) : undefined
534
- })), [items, visibleSortedColumns, renderItem, wrappedColumnKeys, getColumnWidth, intl.formatMessage, intl.formatDate]);
514
+ })), [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth, intl.formatMessage, intl.formatDate]);
535
515
  const rows = useMemo(() => {
536
516
  if (status !== 'loading') {
537
517
  return tableRows;
@@ -75,4 +75,37 @@ export const TableHeading = styled.th({
75
75
  overflow: 'hidden',
76
76
  wordWrap: 'break-word'
77
77
  }
78
+ });
79
+
80
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
81
+ export const TableCell = styled.td({
82
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
83
+ [`${withTablePluginBodyPrefix()}`]: {
84
+ /* First section here is to override things editor table plugin css defines */
85
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
86
+ font: fieldTextFontSize,
87
+ padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"}`,
88
+ border: 0,
89
+ minWidth: 'auto',
90
+ verticalAlign: 'inherit',
91
+ boxSizing: 'border-box',
92
+ borderRight: `0.5px solid ${`var(--ds-border, ${N40})`}`,
93
+ borderBottom: `0.5px solid ${`var(--ds-border, ${N40})`}`,
94
+ overflow: 'hidden'
95
+ },
96
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
97
+ [`${withTablePluginBodyPrefix('&:first-child')}`]: {
98
+ paddingLeft: "var(--ds-space-100, 8px)"
99
+ },
100
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
101
+ [`${withTablePluginBodyPrefix('&:last-child')}`]: {
102
+ borderRight: 0,
103
+ paddingRight: "var(--ds-space-100, 8px)"
104
+ },
105
+ // Inline smart links are pretty opinionated about word-wrapping.
106
+ // We want it to be controlled by user, so we make it overflow and truncate by default.
107
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
108
+ ["& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span"]: {
109
+ whiteSpace: 'unset'
110
+ }
78
111
  });
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import Tooltip from '@atlaskit/tooltip';
4
+ import { useDatasourceItem } from '../../../state';
5
+ import { stringifyType } from '../render-type';
6
+ import { TruncateTextTag } from '../truncate-text-tag';
7
+ export const TableCellContent = ({
8
+ columnKey,
9
+ columnType,
10
+ id,
11
+ renderItem,
12
+ wrappedColumnKeys
13
+ }) => {
14
+ var _rowData$columnKey;
15
+ const intl = useIntl();
16
+ const rowData = useDatasourceItem({
17
+ id
18
+ });
19
+ if (!rowData || !columnKey || !rowData[columnKey]) {
20
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
21
+ }
22
+
23
+ // Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
24
+ const value = (_rowData$columnKey = rowData[columnKey]) === null || _rowData$columnKey === void 0 ? void 0 : _rowData$columnKey.data;
25
+ const values = Array.isArray(value) ? value : [value];
26
+ const renderedValues = renderItem({
27
+ type: columnType,
28
+ values
29
+ });
30
+ const stringifiedContent = values.map(value => stringifyType({
31
+ type: columnType,
32
+ value
33
+ }, intl.formatMessage, intl.formatDate)).filter(value => value !== '').join(', ');
34
+ if (stringifiedContent && !(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(columnKey))) {
35
+ return /*#__PURE__*/React.createElement(Tooltip
36
+ // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
37
+ , {
38
+ tag: TruncateTextTag,
39
+ content: stringifiedContent,
40
+ testId: "issues-table-cell-tooltip"
41
+ }, renderedValues);
42
+ }
43
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderedValues);
44
+ };
@@ -0,0 +1,21 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
6
+ import React, { forwardRef } from 'react';
7
+
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
9
+ import { css, jsx } from '@emotion/react';
10
+ const truncateTextStyles = css({
11
+ overflow: 'hidden',
12
+ textOverflow: 'ellipsis',
13
+ whiteSpace: 'nowrap'
14
+ });
15
+ export const TruncateTextTag = /*#__PURE__*/forwardRef((props, ref) => {
16
+ return jsx("span", _extends({
17
+ css: truncateTextStyles
18
+ }, props, {
19
+ ref: ref
20
+ }), props.children);
21
+ });
@@ -105,6 +105,7 @@ export const PlainJiraIssuesConfigModalOld = props => {
105
105
  status,
106
106
  onNextPage,
107
107
  responseItems,
108
+ responseItemIds,
108
109
  hasNextPage,
109
110
  columns,
110
111
  defaultVisibleColumnKeys,
@@ -355,6 +356,7 @@ export const PlainJiraIssuesConfigModalOld = props => {
355
356
  status: status,
356
357
  columns: columns,
357
358
  items: responseItems,
359
+ itemIds: responseItemIds,
358
360
  hasNextPage: hasNextPage,
359
361
  visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
360
362
  onNextPage: handleOnNextPage,
@@ -365,7 +367,7 @@ export const PlainJiraIssuesConfigModalOld = props => {
365
367
  onColumnResize: onColumnResize,
366
368
  wrappedColumnKeys: wrappedColumnKeys,
367
369
  onWrappedColumnChange: fg('platform.linking-platform.datasource-word_wrap') ? onWrappedColumnChange : undefined
368
- })), [status, columns, responseItems, hasNextPage, visibleColumnKeys, defaultVisibleColumnKeys, handleOnNextPage, loadDatasourceDetails, handleVisibleColumnKeysChange, extensionKey, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange]);
370
+ })), [status, columns, responseItems, responseItemIds, hasNextPage, visibleColumnKeys, defaultVisibleColumnKeys, handleOnNextPage, loadDatasourceDetails, handleVisibleColumnKeysChange, extensionKey, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange]);
369
371
  const renderCountModeContent = useCallback(() => {
370
372
  const selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
371
373
  if (status === 'unauthorized') {
@@ -55,6 +55,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
55
55
  setResponseItems = _useState14[1];
56
56
  var _useState15 = useState(initialEmptyArray),
57
57
  _useState16 = _slicedToArray(_useState15, 2),
58
+ responseItemIds = _useState16[0],
58
59
  setResponseItemIds = _useState16[1];
59
60
  var _useState17 = useState(true),
60
61
  _useState18 = _slicedToArray(_useState17, 2),
@@ -415,6 +416,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
415
416
  status: status,
416
417
  onNextPage: onNextPage,
417
418
  responseItems: responseItems,
419
+ responseItemIds: responseItemIds,
418
420
  reset: reset,
419
421
  loadDatasourceDetails: loadDatasourceDetails,
420
422
  hasNextPage: hasNextPage,
@@ -137,6 +137,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
137
137
  status = _useDatasourceTableSt.status,
138
138
  onNextPage = _useDatasourceTableSt.onNextPage,
139
139
  responseItems = _useDatasourceTableSt.responseItems,
140
+ responseItemIds = _useDatasourceTableSt.responseItemIds,
140
141
  reset = _useDatasourceTableSt.reset,
141
142
  loadDatasourceDetails = _useDatasourceTableSt.loadDatasourceDetails,
142
143
  hasNextPage = _useDatasourceTableSt.hasNextPage,
@@ -354,6 +355,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
354
355
  isFetchingInitialData: assetsClientLoading,
355
356
  status: status,
356
357
  responseItems: responseItems,
358
+ responseItemIds: responseItemIds,
357
359
  visibleColumnKeys: visibleColumnKeys,
358
360
  onVisibleColumnKeysChange: onVisibleColumnKeysChange,
359
361
  datasourceId: datasourceId,
@@ -67,6 +67,7 @@ var LoadingView = function LoadingView() {
67
67
  export var RenderAssetsContent = function RenderAssetsContent(props) {
68
68
  var status = props.status,
69
69
  responseItems = props.responseItems,
70
+ responseItemIds = props.responseItemIds,
70
71
  visibleColumnKeys = props.visibleColumnKeys,
71
72
  onNextPage = props.onNextPage,
72
73
  hasNextPage = props.hasNextPage,
@@ -84,13 +85,14 @@ export var RenderAssetsContent = function RenderAssetsContent(props) {
84
85
  status: status,
85
86
  columns: columns,
86
87
  items: responseItems,
88
+ itemIds: responseItemIds,
87
89
  hasNextPage: hasNextPage,
88
90
  visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
89
91
  onNextPage: onNextPage,
90
92
  onLoadDatasourceDetails: loadDatasourceDetails,
91
93
  onVisibleColumnKeysChange: onVisibleColumnKeysChange
92
94
  }));
93
- }, [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, onVisibleColumnKeysChange, responseItems, status, visibleColumnKeys]);
95
+ }, [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, onVisibleColumnKeysChange, responseItems, responseItemIds, status, visibleColumnKeys]);
94
96
  var renderAssetsContentView = useCallback(function () {
95
97
  if (isFetchingInitialData) {
96
98
  // Placing this check first as it's a priority before all others
@@ -17,6 +17,7 @@ var Table = function Table(props) {
17
17
  status = _useDatasourceContext2.status,
18
18
  onNextPage = _useDatasourceContext2.onNextPage,
19
19
  responseItems = _useDatasourceContext2.responseItems,
20
+ responseItemIds = _useDatasourceContext2.responseItemIds,
20
21
  hasNextPage = _useDatasourceContext2.hasNextPage,
21
22
  columns = _useDatasourceContext2.columns,
22
23
  defaultVisibleColumnKeys = _useDatasourceContext2.defaultVisibleColumnKeys,
@@ -33,6 +34,7 @@ var Table = function Table(props) {
33
34
  status: status,
34
35
  columns: columns,
35
36
  items: responseItems,
37
+ itemIds: responseItemIds,
36
38
  hasNextPage: hasNextPage,
37
39
  visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
38
40
  onNextPage: handleOnNextPage,
@@ -128,6 +128,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
128
128
  status = _useDatasourceTableSt.status,
129
129
  onNextPage = _useDatasourceTableSt.onNextPage,
130
130
  responseItems = _useDatasourceTableSt.responseItems,
131
+ responseItemIds = _useDatasourceTableSt.responseItemIds,
131
132
  hasNextPage = _useDatasourceTableSt.hasNextPage,
132
133
  columns = _useDatasourceTableSt.columns,
133
134
  defaultVisibleColumnKeys = _useDatasourceTableSt.defaultVisibleColumnKeys,
@@ -200,6 +201,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
200
201
  status: status,
201
202
  columns: columns,
202
203
  items: responseItems,
204
+ itemIds: responseItemIds,
203
205
  hasNextPage: hasNextPage,
204
206
  visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
205
207
  onNextPage: onNextPage,
@@ -211,7 +213,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
211
213
  wrappedColumnKeys: wrappedColumnKeys,
212
214
  onWrappedColumnChange: fg('platform.linking-platform.datasource-word_wrap') ? onWrappedColumnChange : undefined
213
215
  }));
214
- }, [status, columns, responseItems, hasNextPage, visibleColumnKeys, defaultVisibleColumnKeys, onNextPage, loadDatasourceDetails, handleVisibleColumnKeysChange, extensionKey, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange]);
216
+ }, [status, columns, responseItems, responseItemIds, hasNextPage, visibleColumnKeys, defaultVisibleColumnKeys, onNextPage, loadDatasourceDetails, handleVisibleColumnKeysChange, extensionKey, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange]);
215
217
  var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
216
218
  var hasConfluenceSearchParams = selectedConfluenceSite && searchString;
217
219
  var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
@@ -50,6 +50,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
50
50
  status = _useDatasourceTableSt.status,
51
51
  onNextPage = _useDatasourceTableSt.onNextPage,
52
52
  responseItems = _useDatasourceTableSt.responseItems,
53
+ responseItemIds = _useDatasourceTableSt.responseItemIds,
53
54
  hasNextPage = _useDatasourceTableSt.hasNextPage,
54
55
  columns = _useDatasourceTableSt.columns,
55
56
  defaultVisibleColumnKeys = _useDatasourceTableSt.defaultVisibleColumnKeys,
@@ -161,6 +162,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
161
162
  testId: 'datasource-table-view',
162
163
  hasNextPage: hasNextPage,
163
164
  items: responseItems,
165
+ itemIds: responseItemIds,
164
166
  onNextPage: onNextPage,
165
167
  onLoadDatasourceDetails: loadDatasourceDetails,
166
168
  status: status,
@@ -1,9 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _extends from "@babel/runtime/helpers/extends";
4
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
- var _styled$td;
7
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
6
  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
7
  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,7 +9,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
11
9
  * @jsxRuntime classic
12
10
  * @jsx jsx
13
11
  */
14
- import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
12
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
15
13
 
16
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
17
15
  import { css, jsx } from '@emotion/react';
@@ -21,6 +19,7 @@ import debounce from 'lodash/debounce';
21
19
  import { useIntl } from 'react-intl-next';
22
20
  import invariant from 'tiny-invariant';
23
21
  import { Skeleton } from '@atlaskit/linking-common';
22
+ import { fg } from '@atlaskit/platform-feature-flags';
24
23
  import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
25
24
  import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
26
25
  import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
@@ -38,7 +37,9 @@ import { DragColumnPreview } from './drag-column-preview';
38
37
  import { DraggableTableHeading } from './draggable-table-heading';
39
38
  import TableEmptyState from './empty-state';
40
39
  import { renderType, stringifyType } from './render-type';
41
- import { fieldTextFontSize, Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
40
+ import { Table, TableCell, TableHeading, withTablePluginHeaderPrefix } from './styled';
41
+ import { TableCellContent } from './table-cell-content';
42
+ import { TruncateTextTag } from './truncate-text-tag';
42
43
  import { useIsOnScreen } from './useIsOnScreen';
43
44
  import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
44
45
  var tableSidePadding = "var(--ds-space-200, 16px)";
@@ -49,11 +50,6 @@ var tableHeadStyles = css({
49
50
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
50
51
  zIndex: stickyTableHeadersIndex
51
52
  });
52
- var truncateTextStyles = css({
53
- overflow: 'hidden',
54
- textOverflow: 'ellipsis',
55
- whiteSpace: 'nowrap'
56
- });
57
53
  var columnPickerWidth = 80;
58
54
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
59
55
  var ColumnPickerHeader = styled.th(_defineProperty({}, "".concat(withTablePluginHeaderPrefix('&:last-of-type')), {
@@ -77,28 +73,6 @@ var truncateStyles = css({
77
73
  textOverflow: 'ellipsis',
78
74
  whiteSpace: 'nowrap'
79
75
  });
80
-
81
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
82
- var TableCell = styled.td((_styled$td = {}, _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix()), {
83
- /* First section here is to override things editor table plugin css defines */
84
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
85
- font: fieldTextFontSize,
86
- padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
87
- border: 0,
88
- minWidth: 'auto',
89
- verticalAlign: 'inherit',
90
- boxSizing: 'border-box',
91
- borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
92
- borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
93
- overflow: 'hidden'
94
- }), _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix('&:first-child')), {
95
- paddingLeft: "var(--ds-space-100, 8px)"
96
- }), _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix('&:last-child')), {
97
- borderRight: 0,
98
- paddingRight: "var(--ds-space-100, 8px)"
99
- }), _defineProperty(_styled$td, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
100
- whiteSpace: 'unset'
101
- }), _styled$td));
102
76
  var tableContainerStyles = css({
103
77
  borderRadius: 'inherit',
104
78
  borderBottomLeftRadius: 0,
@@ -274,18 +248,12 @@ function getDefaultColumnWidth(key, type) {
274
248
  return DEFAULT_WIDTH;
275
249
  }
276
250
  }
277
- var TruncateTextTag = /*#__PURE__*/forwardRef(function (props, ref) {
278
- return jsx("span", _extends({
279
- css: truncateTextStyles
280
- }, props, {
281
- ref: ref
282
- }), props.children);
283
- });
284
251
  export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
285
252
  var testId = _ref5.testId,
286
253
  onNextPage = _ref5.onNextPage,
287
254
  onLoadDatasourceDetails = _ref5.onLoadDatasourceDetails,
288
255
  items = _ref5.items,
256
+ itemIds = _ref5.itemIds,
289
257
  columns = _ref5.columns,
290
258
  _ref5$renderItem = _ref5.renderItem,
291
259
  renderItem = _ref5$renderItem === void 0 ? renderType : _ref5$renderItem,
@@ -394,14 +362,15 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
394
362
  return {
395
363
  key: 'loading',
396
364
  cells: headerColumns.map(function (column) {
397
- return _objectSpread(_objectSpread({}, column), {}, {
365
+ return {
398
366
  content: jsx(Skeleton, {
399
367
  borderRadius: 8,
400
368
  width: "100%",
401
369
  height: 14,
402
370
  testId: "issues-table-row-loading"
403
- })
404
- });
371
+ }),
372
+ key: column.key
373
+ };
405
374
  })
406
375
  };
407
376
  }, [headerColumns]);
@@ -487,13 +456,36 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
487
456
  }));
488
457
  }, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
489
458
  var tableRows = useMemo(function () {
490
- return items.map(function (newRowData, rowIndex) {
459
+ return fg('enable_datasource_react_sweet_state') ? itemIds.map(function (id, rowIndex) {
491
460
  return {
492
- key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
461
+ key: id,
493
462
  cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
494
- var _newRowData$key;
495
463
  var key = _ref12.key,
496
464
  type = _ref12.type;
465
+ return {
466
+ key: key,
467
+ columnKey: key,
468
+ content: jsx(TableCellContent, {
469
+ id: id,
470
+ columnKey: key,
471
+ columnType: type,
472
+ wrappedColumnKeys: wrappedColumnKeys,
473
+ renderItem: renderItem
474
+ }),
475
+ width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
476
+ };
477
+ }),
478
+ ref: rowIndex === items.length - 1 ? function (el) {
479
+ return setLastRowElement(el);
480
+ } : undefined
481
+ };
482
+ }) : items.map(function (newRowData, rowIndex) {
483
+ return {
484
+ key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
485
+ cells: visibleSortedColumns.map(function (_ref13, cellIndex) {
486
+ var _newRowData$key;
487
+ var key = _ref13.key,
488
+ type = _ref13.type;
497
489
  // Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
498
490
  var value = (_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data;
499
491
  var values = Array.isArray(value) ? value : [value];
@@ -527,7 +519,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
527
519
  } : undefined
528
520
  };
529
521
  });
530
- }, [items, visibleSortedColumns, renderItem, wrappedColumnKeys, getColumnWidth, intl.formatMessage, intl.formatDate]);
522
+ }, [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth, intl.formatMessage, intl.formatDate]);
531
523
  var rows = useMemo(function () {
532
524
  if (status !== 'loading') {
533
525
  return tableRows;
@@ -618,10 +610,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
618
610
  className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
619
611
  }, jsx("tr", {
620
612
  ref: tableHeaderRowRef
621
- }, headerColumns.map(function (_ref14, cellIndex) {
622
- var key = _ref14.key,
623
- content = _ref14.content,
624
- width = _ref14.width;
613
+ }, headerColumns.map(function (_ref15, cellIndex) {
614
+ var key = _ref15.key,
615
+ content = _ref15.content,
616
+ width = _ref15.width;
625
617
  var heading = jsx(Tooltip, {
626
618
  content: content,
627
619
  tag: "span",
@@ -638,10 +630,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
638
630
  }
639
631
  if (isEditable) {
640
632
  var _containerRef$current3;
641
- var previewRows = tableRows.map(function (_ref15) {
642
- var cells = _ref15.cells;
643
- var cell = cells.find(function (_ref16) {
644
- var cellKey = _ref16.key;
633
+ var previewRows = tableRows.map(function (_ref16) {
634
+ var cells = _ref16.cells;
635
+ var cell = cells.find(function (_ref17) {
636
+ var cellKey = _ref17.key;
645
637
  return cellKey === key;
646
638
  });
647
639
  if (cell) {
@@ -684,18 +676,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
684
676
  })))), jsx("tbody", {
685
677
  css: noDefaultBorderStyles,
686
678
  "data-testid": testId && "".concat(testId, "--body")
687
- }, rows.map(function (_ref17) {
688
- var key = _ref17.key,
689
- cells = _ref17.cells,
690
- ref = _ref17.ref;
679
+ }, rows.map(function (_ref18) {
680
+ var key = _ref18.key,
681
+ cells = _ref18.cells,
682
+ ref = _ref18.ref;
691
683
  return jsx("tr", {
692
684
  key: key,
693
685
  "data-testid": testId && "".concat(testId, "--row-").concat(key),
694
686
  ref: ref
695
- }, cells.map(function (_ref18, cellIndex) {
696
- var cellKey = _ref18.key,
697
- content = _ref18.content,
698
- width = _ref18.width;
687
+ }, cells.map(function (_ref19, cellIndex) {
688
+ var cellKey = _ref19.key,
689
+ content = _ref19.content,
690
+ width = _ref19.width;
699
691
  var isLastCell = cellIndex === cells.length - 1;
700
692
  var loadingRowStyle = getWidthCss({
701
693
  shouldUseWidth: shouldUseWidth,
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _styled$th;
2
+ var _styled$th, _styled$td;
3
3
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
4
  import styled from '@emotion/styled';
5
5
  import { N40 } from '@atlaskit/theme/colors';
@@ -65,4 +65,26 @@ export var TableHeading = styled.th((_styled$th = {}, _defineProperty(_styled$th
65
65
  whiteSpace: 'normal',
66
66
  overflow: 'hidden',
67
67
  wordWrap: 'break-word'
68
- }), _styled$th));
68
+ }), _styled$th));
69
+
70
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
71
+ export var TableCell = styled.td((_styled$td = {}, _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix()), {
72
+ /* First section here is to override things editor table plugin css defines */
73
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
74
+ font: fieldTextFontSize,
75
+ padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
76
+ border: 0,
77
+ minWidth: 'auto',
78
+ verticalAlign: 'inherit',
79
+ boxSizing: 'border-box',
80
+ borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
81
+ borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
82
+ overflow: 'hidden'
83
+ }), _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix('&:first-child')), {
84
+ paddingLeft: "var(--ds-space-100, 8px)"
85
+ }), _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix('&:last-child')), {
86
+ borderRight: 0,
87
+ paddingRight: "var(--ds-space-100, 8px)"
88
+ }), _defineProperty(_styled$td, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
89
+ whiteSpace: 'unset'
90
+ }), _styled$td));