@atlaskit/link-datasource 1.7.5 → 1.8.0

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 (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/hooks/useDatasourceTableState.js +12 -16
  4. package/dist/cjs/ui/assets-modal/modal/index.js +1 -1
  5. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +3 -3
  6. package/dist/cjs/ui/issue-like-table/empty-state/index.js +71 -86
  7. package/dist/cjs/ui/issue-like-table/empty-state/type.js +1 -1
  8. package/dist/cjs/ui/issue-like-table/index.js +35 -10
  9. package/dist/cjs/ui/issue-like-table/styled.js +4 -4
  10. package/dist/cjs/ui/jira-issues-modal/modal/index.js +3 -3
  11. package/dist/es2019/analytics/constants.js +1 -1
  12. package/dist/es2019/hooks/useDatasourceTableState.js +1 -5
  13. package/dist/es2019/ui/assets-modal/modal/index.js +1 -1
  14. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +3 -3
  15. package/dist/es2019/ui/issue-like-table/empty-state/index.js +61 -75
  16. package/dist/es2019/ui/issue-like-table/empty-state/type.js +1 -1
  17. package/dist/es2019/ui/issue-like-table/index.js +43 -13
  18. package/dist/es2019/ui/issue-like-table/styled.js +1 -5
  19. package/dist/es2019/ui/jira-issues-modal/modal/index.js +3 -4
  20. package/dist/esm/analytics/constants.js +1 -1
  21. package/dist/esm/hooks/useDatasourceTableState.js +12 -16
  22. package/dist/esm/ui/assets-modal/modal/index.js +1 -1
  23. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +3 -3
  24. package/dist/esm/ui/issue-like-table/empty-state/index.js +72 -86
  25. package/dist/esm/ui/issue-like-table/empty-state/type.js +1 -1
  26. package/dist/esm/ui/issue-like-table/index.js +35 -10
  27. package/dist/esm/ui/issue-like-table/styled.js +3 -3
  28. package/dist/esm/ui/jira-issues-modal/modal/index.js +3 -3
  29. package/dist/types/ui/issue-like-table/empty-state/index.d.ts +1 -2
  30. package/dist/types/ui/issue-like-table/index.d.ts +1 -1
  31. package/dist/types/ui/issue-like-table/styled.d.ts +1 -8
  32. package/dist/types-ts4.5/ui/issue-like-table/empty-state/index.d.ts +1 -2
  33. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
  34. package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +1 -8
  35. package/package.json +1 -1
@@ -86,8 +86,7 @@ function getColumnWidth(key, type) {
86
86
  priority: BASE_WIDTH * 8,
87
87
  status: BASE_WIDTH * 18,
88
88
  summary: BASE_WIDTH * 45,
89
- description: BASE_WIDTH * 31.25,
90
- type: BASE_WIDTH * 8
89
+ description: BASE_WIDTH * 31.25
91
90
  };
92
91
  if (keyBasedWidth[key]) {
93
92
  return keyBasedWidth[key];
@@ -167,9 +166,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
167
166
  cells: visibleSortedColumns.map(function (_ref3) {
168
167
  var key = _ref3.key;
169
168
  var content = jsx(Skeleton, {
170
- borderRadius: "var(--ds-border-radius-100, 3px)",
171
- width: '100%',
172
- height: '20px'
169
+ borderRadius: 8,
170
+ width: "100%",
171
+ height: 14,
172
+ testId: "issues-table-row-loading"
173
173
  });
174
174
  return {
175
175
  key: key,
@@ -295,8 +295,24 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
295
295
  });
296
296
  }, [identityColumnKey, renderItem, items, visibleSortedColumns]);
297
297
  var rows = useMemo(function () {
298
- return [].concat(_toConsumableArray(tableRows), _toConsumableArray(status === 'loading' ? [loadingRow] : []));
299
- }, [loadingRow, status, tableRows]);
298
+ if (status !== 'loading') {
299
+ return tableRows;
300
+ }
301
+ // if there are table rows, only add 1 loading row
302
+ if (tableRows.length > 0) {
303
+ return [].concat(_toConsumableArray(tableRows), [_objectSpread(_objectSpread({}, loadingRow), {}, {
304
+ key: "loading-".concat(tableRows.length)
305
+ })]);
306
+ }
307
+ // if there are no table rows add 14 rows if it is compact (has scrollableContainerHeight or non-modal)
308
+ // add 10 rows if it is modal (no scrollableContainerHeight)
309
+ var loadingRowsCount = scrollableContainerHeight ? 14 : 10;
310
+ return _toConsumableArray(Array(loadingRowsCount)).map(function (_, index) {
311
+ return _objectSpread(_objectSpread({}, loadingRow), {}, {
312
+ key: "loading-".concat(index)
313
+ });
314
+ });
315
+ }, [loadingRow, status, tableRows, scrollableContainerHeight]);
300
316
  var onSelectedColumnKeysChange = useCallback(function (newSelectedColumnKeys) {
301
317
  onVisibleColumnKeysChange === null || onVisibleColumnKeysChange === void 0 || onVisibleColumnKeysChange(newSelectedColumnKeys);
302
318
  }, [onVisibleColumnKeysChange]);
@@ -389,6 +405,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
389
405
  key: key,
390
406
  "data-testid": "".concat(key, "-column-heading"),
391
407
  style: {
408
+ // this keeps the column headers from collapsing horizontally during loading states
409
+ minWidth: maxWidth,
392
410
  maxWidth: maxWidth
393
411
  }
394
412
  }, heading);
@@ -414,14 +432,21 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
414
432
  var cellKey = _ref14.key,
415
433
  content = _ref14.content,
416
434
  maxWidth = _ref14.maxWidth;
435
+ var loadingRowStyle = {
436
+ maxWidth: maxWidth
437
+ };
438
+ // extra padding is required around skeleton loader to avoid vertical jumps when data loads
439
+ if (key !== null && key !== void 0 && key.includes('loading')) {
440
+ loadingRowStyle = _objectSpread(_objectSpread({}, loadingRowStyle), {}, {
441
+ paddingBlock: "var(--ds-space-100, 12px)"
442
+ });
443
+ }
417
444
  return jsx("td", {
418
445
  key: cellKey,
419
446
  "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
420
447
  colSpan: cellIndex + 1 === cells.length ? 2 : undefined,
421
448
  css: truncatedCellStyles,
422
- style: {
423
- maxWidth: maxWidth
424
- }
449
+ style: loadingRowStyle
425
450
  }, content);
426
451
  }));
427
452
  }))));
@@ -1,8 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3;
2
+ var _templateObject, _templateObject2;
3
3
  import styled from '@emotion/styled';
4
4
  import { N40 } from '@atlaskit/theme/colors';
5
+ export var ScrollableContainerHeight = 590;
5
6
  export var FieldTextFontSize = '14px';
6
7
  export var Table = styled.table(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n"])));
7
- export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding-block: ", " ", ";\n line-height: ", ";\n border-bottom: 2px solid ", ";\n & [data-testid='datasource-header-content--container'] {\n margin-top: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 16px)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"));
8
- export var EmptyStateTableHeading = styled(TableHeading)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:first-child {\n padding-left: ", ";\n }\n"])), "var(--ds-space-100, 8px)");
8
+ export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding-block: ", " ", ";\n line-height: ", ";\n border-bottom: 2px solid ", ";\n & [data-testid='datasource-header-content--container'] {\n margin-top: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 16px)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"));
@@ -379,8 +379,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
379
379
  setCurrentViewMode(selectedMode);
380
380
  };
381
381
  var handleOnNextPage = useCallback(function () {
382
+ var onNextPageProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
382
383
  userInteractionActions.current.add(DatasourceAction.NEXT_PAGE_SCROLLED);
383
- onNextPage();
384
+ onNextPage(onNextPageProps);
384
385
  }, [onNextPage]);
385
386
  var handleVisibleColumnKeysChange = useCallback(function () {
386
387
  var newVisibleColumnKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -444,8 +445,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
444
445
  return jsx("div", {
445
446
  css: contentContainerStyles
446
447
  }, !!jql ? jsx(EmptyState, {
447
- testId: "jira-jql-datasource-modal--empty-state",
448
- isLoading: true
448
+ testId: "jira-jql-datasource-modal--empty-state"
449
449
  }) : jsx(InitialStateView, {
450
450
  searchMethod: currentSearchMethod
451
451
  }));
@@ -2,8 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  export interface Props {
4
4
  isCompact?: boolean;
5
- isLoading?: boolean;
6
5
  testId?: string;
7
6
  }
8
- declare const _default: ({ isCompact, isLoading, testId }: Props) => jsx.JSX.Element;
7
+ declare const _default: ({ isCompact, testId }: Props) => jsx.JSX.Element;
9
8
  export default _default;
@@ -15,4 +15,4 @@ export interface RowCellType {
15
15
  }
16
16
  export declare const orderColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
17
17
  export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
18
- export declare const EmptyState: ({ isCompact, isLoading, testId }: import("./empty-state").Props) => jsx.JSX.Element;
18
+ export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ export declare const ScrollableContainerHeight = 590;
2
3
  export declare const FieldTextFontSize = "14px";
3
4
  export declare const Table: import("@emotion/styled").StyledComponent<{
4
5
  theme?: import("@emotion/react").Theme | undefined;
@@ -8,11 +9,3 @@ export declare const TableHeading: import("@emotion/styled").StyledComponent<{
8
9
  theme?: import("@emotion/react").Theme | undefined;
9
10
  as?: import("react").ElementType<any> | undefined;
10
11
  }, import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, {}>;
11
- export declare const EmptyStateTableHeading: import("@emotion/styled").StyledComponent<{
12
- theme?: import("@emotion/react").Theme | undefined;
13
- as?: import("react").ElementType<any> | undefined;
14
- } & import("react").ClassAttributes<HTMLTableHeaderCellElement> & import("react").ThHTMLAttributes<HTMLTableHeaderCellElement> & {
15
- children?: import("react").ReactNode;
16
- } & {
17
- theme?: import("@emotion/react").Theme | undefined;
18
- }, {}, {}>;
@@ -2,8 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  export interface Props {
4
4
  isCompact?: boolean;
5
- isLoading?: boolean;
6
5
  testId?: string;
7
6
  }
8
- declare const _default: ({ isCompact, isLoading, testId }: Props) => jsx.JSX.Element;
7
+ declare const _default: ({ isCompact, testId }: Props) => jsx.JSX.Element;
9
8
  export default _default;
@@ -15,4 +15,4 @@ export interface RowCellType {
15
15
  }
16
16
  export declare const orderColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
17
17
  export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
18
- export declare const EmptyState: ({ isCompact, isLoading, testId }: import("./empty-state").Props) => jsx.JSX.Element;
18
+ export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ export declare const ScrollableContainerHeight = 590;
2
3
  export declare const FieldTextFontSize = "14px";
3
4
  export declare const Table: import("@emotion/styled").StyledComponent<{
4
5
  theme?: import("@emotion/react").Theme | undefined;
@@ -8,11 +9,3 @@ export declare const TableHeading: import("@emotion/styled").StyledComponent<{
8
9
  theme?: import("@emotion/react").Theme | undefined;
9
10
  as?: import("react").ElementType<any> | undefined;
10
11
  }, import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, {}>;
11
- export declare const EmptyStateTableHeading: import("@emotion/styled").StyledComponent<{
12
- theme?: import("@emotion/react").Theme | undefined;
13
- as?: import("react").ElementType<any> | undefined;
14
- } & import("react").ClassAttributes<HTMLTableHeaderCellElement> & import("react").ThHTMLAttributes<HTMLTableHeaderCellElement> & {
15
- children?: import("react").ReactNode;
16
- } & {
17
- theme?: import("@emotion/react").Theme | undefined;
18
- }, {}, {}>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.7.5",
3
+ "version": "1.8.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"