@synerise/ds-table 1.3.0 → 1.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +1202 -3395
  2. package/README.md +6 -6
  3. package/dist/Cell/Action/ActionCell.d.ts +1 -1
  4. package/dist/Cell/Action/ActionCell.styles.d.ts +1 -1
  5. package/dist/Cell/Action/ActionCell.styles.js +0 -2
  6. package/dist/Cell/Action/ActionCell.types.d.ts +2 -2
  7. package/dist/Cell/AvatarLabel/AvatarLabel.d.ts +1 -1
  8. package/dist/Cell/AvatarLabel/AvatarLabel.styles.d.ts +1 -1
  9. package/dist/Cell/AvatarLabel/AvatarLabel.types.d.ts +1 -1
  10. package/dist/Cell/Copyable/Copyable.styles.js +0 -2
  11. package/dist/Cell/Copyable/Copyable.types.d.ts +1 -1
  12. package/dist/Cell/Copyable/CopyableCell.d.ts +1 -1
  13. package/dist/Cell/Copyable/CopyableCell.js +4 -2
  14. package/dist/Cell/Editable/EditableCell.d.ts +1 -1
  15. package/dist/Cell/Editable/EditableCell.js +2 -5
  16. package/dist/Cell/Editable/EditableCell.types.d.ts +1 -1
  17. package/dist/Cell/FlagLabel/FlagLabelCell.d.ts +1 -1
  18. package/dist/Cell/FlagLabel/FlagLabelCell.styles.js +0 -2
  19. package/dist/Cell/FlagLabel/FlagLabelCell.types.d.ts +2 -2
  20. package/dist/Cell/IconLabel/IconLabel.d.ts +1 -1
  21. package/dist/Cell/IconTooltipCell/IconTooltipCell.d.ts +1 -1
  22. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.d.ts +2 -2
  23. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.js +1 -1
  24. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.types.d.ts +2 -2
  25. package/dist/Cell/LabelsWithShowMore/Modal/Modal.d.ts +1 -1
  26. package/dist/Cell/LabelsWithShowMore/Modal/Modal.types.d.ts +2 -2
  27. package/dist/Cell/Star/StarCell.d.ts +1 -1
  28. package/dist/Cell/Star/StarCell.styles.d.ts +1 -1
  29. package/dist/Cell/Star/StarCell.types.d.ts +2 -2
  30. package/dist/Cell/StatusLabel/StatusLabel.types.d.ts +3 -3
  31. package/dist/Cell/TagIcon/TagIcon.d.ts +1 -1
  32. package/dist/Cell/TagIcon/TagIcon.types.d.ts +2 -2
  33. package/dist/Cell/index.d.ts +7 -7
  34. package/dist/Cell/index.js +7 -7
  35. package/dist/ColumnSortMenu/SortIcons.d.ts +1 -1
  36. package/dist/ColumnSortMenu/SortIcons.js +1 -1
  37. package/dist/ColumnSortMenu/SortRenderer.d.ts +4 -4
  38. package/dist/ColumnSortMenu/SortRenderer.js +3 -3
  39. package/dist/ColumnSortMenu/TitleWithSort.d.ts +4 -4
  40. package/dist/ColumnSortMenu/columnWithSortButtons.d.ts +4 -4
  41. package/dist/ColumnSortMenu/columnWithSortButtons.js +1 -1
  42. package/dist/ColumnSortMenu/groupedColumnsSort.d.ts +4 -4
  43. package/dist/ColumnSortMenu/replaceSortButtons.d.ts +1 -1
  44. package/dist/ColumnSortMenu/useSortState.d.ts +2 -2
  45. package/dist/ColumnSortMenu/useSortState.js +1 -4
  46. package/dist/DefaultTable/DefaultTable.d.ts +1 -1
  47. package/dist/DefaultTable/DefaultTable.js +10 -14
  48. package/dist/FilterTrigger/FilterTrigger.d.ts +1 -1
  49. package/dist/FilterTrigger/FilterTrigger.types.d.ts +1 -1
  50. package/dist/GroupTable/GroupTable.d.ts +2 -2
  51. package/dist/GroupTable/GroupTable.js +8 -12
  52. package/dist/GroupTable/GroupTable.styles.js +10 -4
  53. package/dist/GroupTable/GroupTableBody/GroupTableBody.d.ts +2 -2
  54. package/dist/GroupTable/GroupTableBody/GroupTableBody.js +4 -4
  55. package/dist/GroupTable/GroupTableBody/GroupTableBody.types.d.ts +4 -4
  56. package/dist/GroupTable/GroupTableHeader/GroupTableHeader.d.ts +2 -2
  57. package/dist/GroupTable/GroupTableHeader/GroupTableHeader.types.d.ts +1 -1
  58. package/dist/InfiniteScroll/BackToTopButton.d.ts +1 -1
  59. package/dist/InfiniteScroll/ErrorItem.js +1 -1
  60. package/dist/InfiniteScroll/InfiniteLoaderItem.d.ts +1 -1
  61. package/dist/InfiniteScroll/InfiniteLoaderItem.js +2 -2
  62. package/dist/InfiniteScroll/InfiniteLoaderItem.types.d.ts +1 -1
  63. package/dist/InfiniteScroll/OuterListElement.d.ts +1 -1
  64. package/dist/InfiniteScroll/OuterListElement.js +1 -1
  65. package/dist/InfiniteScroll/utils.d.ts +1 -1
  66. package/dist/ItemsMenu/ItemsMenu.d.ts +1 -1
  67. package/dist/ItemsMenu/ItemsMenu.styles.js +0 -2
  68. package/dist/RowSelection/RowSelectionColumn.d.ts +2 -2
  69. package/dist/RowSelection/RowSelectionColumn.js +1 -1
  70. package/dist/RowSelection/RowSelectionColumn.types.d.ts +2 -2
  71. package/dist/Table.d.ts +1 -1
  72. package/dist/Table.js +8 -8
  73. package/dist/Table.styles.d.ts +2 -2
  74. package/dist/Table.styles.js +4 -4
  75. package/dist/Table.types.d.ts +4 -4
  76. package/dist/TableHeader/TableHeader.d.ts +1 -1
  77. package/dist/TableHeader/TableHeader.js +4 -5
  78. package/dist/TableHeader/TableHeader.types.d.ts +2 -2
  79. package/dist/TableHeader/TableLimit/TableLimit.d.ts +1 -1
  80. package/dist/TableHeader/TableLimit/TableLimit.js +2 -2
  81. package/dist/TableHeader/TableLimit/TableLimit.types.d.ts +1 -1
  82. package/dist/TableHeader/TableSelection.js +7 -5
  83. package/dist/TableHeader/TableSelection.types.d.ts +1 -1
  84. package/dist/TreeTable/TreeTable.d.ts +1 -1
  85. package/dist/TreeTable/TreeTable.js +4 -4
  86. package/dist/TreeTable/TreeTable.styles.js +3 -1
  87. package/dist/VirtualTable/VirtualTable.d.ts +2 -2
  88. package/dist/VirtualTable/VirtualTable.js +17 -15
  89. package/dist/VirtualTable/VirtualTable.types.d.ts +1 -1
  90. package/dist/VirtualTable/VirtualTableRow.d.ts +4 -5
  91. package/dist/VirtualTable/VirtualTableRow.js +3 -3
  92. package/dist/constants/TableSkeleton.constants.js +1 -1
  93. package/dist/hooks/useBulkSelection/useBulkSelection.d.ts +1 -1
  94. package/dist/hooks/useBulkSelection/useBulkSelection.js +4 -2
  95. package/dist/hooks/useRowKey/useRowKey.js +6 -3
  96. package/dist/hooks/useRowStar/useRowStar.d.ts +1 -1
  97. package/dist/hooks/useRowStar/useRowStar.js +3 -3
  98. package/dist/hooks/useRowStar/useRowStar.types.d.ts +3 -3
  99. package/dist/index.d.ts +3 -3
  100. package/dist/index.js +2 -2
  101. package/dist/style/index.css +1 -1
  102. package/dist/utils/calculateColumnWidths.d.ts +1 -1
  103. package/dist/utils/calculatePixels.js +1 -3
  104. package/dist/utils/getRecordSelectionStatus.d.ts +1 -1
  105. package/dist/utils/getSkeletonProps.js +4 -2
  106. package/dist/utils/getValueFromPath.js +6 -4
  107. package/dist/utils/locale.d.ts +2 -2
  108. package/package.json +27 -27
@@ -1,25 +1,25 @@
1
1
  var _excluded = ["style"];
2
2
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
- import React, { useCallback, useState, useRef, forwardRef, useEffect, useMemo, useImperativeHandle } from 'react';
5
- import { FixedSizeList as List } from 'react-window';
6
- import ResizeObserver from 'rc-resize-observer';
4
+ import classnames from 'classnames';
7
5
  import { compact } from 'lodash';
6
+ import ResizeObserver from 'rc-resize-observer';
7
+ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
8
8
  import { useIntl } from 'react-intl';
9
- import classnames from 'classnames';
9
+ import { FixedSizeList as List } from 'react-window';
10
10
  import { useElementInView } from '@synerise/ds-utils';
11
- import { infiniteLoaderItemHeight } from '../InfiniteScroll/constants';
12
11
  import BackToTopButton from '../InfiniteScroll/BackToTopButton';
13
12
  import OuterListElement from '../InfiniteScroll/OuterListElement';
13
+ import { infiniteLoaderItemHeight } from '../InfiniteScroll/constants';
14
+ import { RowSelectionColumn } from '../RowSelection';
14
15
  import DSTable from '../Table';
15
- import VirtualTableRow, { INFINITE_LOADED_ITEM_HEIGHT } from './VirtualTableRow';
16
- import * as S from './VirtualTable.styles';
17
- import { useTableLocale, calculateColumnWidths } from '../utils';
18
16
  import { useRowKey } from '../hooks/useRowKey';
19
17
  import { useRowStar } from '../hooks/useRowStar';
20
- import { RowSelectionColumn } from '../RowSelection';
21
- import { EXPANDED_ROW_PROPERTY, HEADER_ROW_HEIGHT, LOAD_DATA_OFFSET } from './constants';
18
+ import { calculateColumnWidths, useTableLocale } from '../utils';
22
19
  import { getChildrenColumnName } from '../utils/getChildrenColumnName';
20
+ import * as S from './VirtualTable.styles';
21
+ import VirtualTableRow, { INFINITE_LOADED_ITEM_HEIGHT } from './VirtualTableRow';
22
+ import { EXPANDED_ROW_PROPERTY, HEADER_ROW_HEIGHT, LOAD_DATA_OFFSET } from './constants';
23
23
  var relativeInlineStyle = {
24
24
  position: 'relative'
25
25
  };
@@ -119,7 +119,7 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
119
119
  });
120
120
  }
121
121
  }
122
- } catch (error) {
122
+ } catch (_error) {
123
123
  throw new Error('Cannot find firs item');
124
124
  }
125
125
  }, [dataSource, dataSourceEmpty, rowKey, firstItem, infiniteScroll, updateFirstItem]);
@@ -315,7 +315,9 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
315
315
  var outerElement = useMemo(function () {
316
316
  return OuterListElement(containerRef, isSticky);
317
317
  }, [isSticky]);
318
- var createItemData = useCallback(function (data, defaultTableProps) {
318
+ var createItemData = useCallback(function (data, defaultTableProps
319
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
320
+ ) {
319
321
  return {
320
322
  mergedColumns: mergedColumns,
321
323
  selection: selection,
@@ -367,7 +369,7 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
367
369
  // without sticky header the ref needs to point to the connect proxy in order for the header and body components to scroll in sync
368
370
  // this gets resolved in antd 5.9.0, when antd supports virtualisation out of the box (but not infinite loader)
369
371
  if (!isSticky) {
370
- // @ts-ignore
372
+ // @ts-expect-error Property 'current' does not exist on type '(instance: ScrollProxyType | null) => void
371
373
  ref.current = connectObject;
372
374
  }
373
375
  var renderVirtualList = function renderVirtualList(data) {
@@ -428,7 +430,7 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
428
430
  isSticky: isSticky,
429
431
  listHeight: listHeight + HEADER_ROW_HEIGHT,
430
432
  onScroll: handleBodyScroll
431
- // @ts-ignore
433
+ // @ts-expect-error Type 'RefObject<ScrollProxyType>' is not assignable to type 'RefObject<HTMLDivElement>'
432
434
  ,
433
435
  ref: isSticky ? ref : undefined
434
436
  }, /*#__PURE__*/React.createElement(List, {
@@ -445,7 +447,7 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
445
447
  itemData: itemData,
446
448
  itemKey: function itemKey(index) {
447
449
  var key = getRowKey(data[index]);
448
- // @ts-ignore
450
+ // @ts-expect-error The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
449
451
  return String(key instanceof String ? key.toLowerCase() : key);
450
452
  },
451
453
  outerElementType: outerElement,
@@ -1,7 +1,7 @@
1
1
  import type { RefObject } from 'react';
2
2
  import type { FixedSizeList as List, ListOnItemsRenderedProps } from 'react-window';
3
3
  import type { InfiniteScrollProps } from '../InfiniteScroll/InfiniteLoaderItem.types';
4
- import type { DSTableProps, DSColumnType } from '../Table.types';
4
+ import type { DSColumnType, DSTableProps } from '../Table.types';
5
5
  export type VirtualColumnType<T> = DSColumnType<T> & {
6
6
  fixedFirst?: boolean;
7
7
  id?: string | number;
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- import type { ReactElement, CSSProperties } from 'react';
1
+ import React, { type CSSProperties, type ReactElement } from 'react';
3
2
  import type { InfiniteScrollProps } from '../InfiniteScroll/InfiniteLoaderItem.types';
4
- import type { RowSelection, DSTableProps } from '../Table.types';
5
- import { RowStar } from '../hooks/useRowStar';
3
+ import type { DSTableProps, RowSelection } from '../Table.types';
4
+ import { type RowStar } from '../hooks/useRowStar';
6
5
  export declare const INFINITE_LOADED_ITEM_HEIGHT = 64;
7
6
  export interface VirtualTableRowProps<T> {
8
7
  data: {
@@ -18,6 +17,6 @@ export interface VirtualTableRowProps<T> {
18
17
  index: number;
19
18
  style: CSSProperties;
20
19
  }
21
- declare function VirtualTableRow<T extends object>({ index, style, data: { mergedColumns, onRowClick, selection, rowStar, dataSource, cellHeight, infiniteScroll, defaultTableProps }, }: VirtualTableRowProps<T>): ReactElement;
20
+ declare function VirtualTableRow<T extends object>({ index, style, data: { mergedColumns, onRowClick, selection, rowStar, dataSource, cellHeight, infiniteScroll, defaultTableProps, }, }: VirtualTableRowProps<T>): ReactElement;
22
21
  declare const _default: React.MemoExoticComponent<typeof VirtualTableRow>;
23
22
  export default _default;
@@ -1,11 +1,11 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { memo, useCallback, useMemo } from 'react';
3
2
  import classNames from 'classnames';
3
+ import React, { memo, useCallback, useMemo } from 'react';
4
4
  import { areEqual } from 'react-window';
5
5
  import InfiniteLoaderItem from '../InfiniteScroll/InfiniteLoaderItem';
6
- import { EXPANDED_ROW_PROPERTY } from './constants';
6
+ import { calculatePixels, getValueFromPath } from '../utils';
7
7
  import * as S from './VirtualTable.styles';
8
- import { getValueFromPath, calculatePixels } from '../utils';
8
+ import { EXPANDED_ROW_PROPERTY } from './constants';
9
9
  export var INFINITE_LOADED_ITEM_HEIGHT = 64;
10
10
  var isColumnSortingActive = function isColumnSortingActive(columns, column) {
11
11
  return !!columns.find(function (c) {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { SkeletonAvatar } from '@synerise/ds-skeleton';
3
- import * as S from '../Table.styles';
4
3
  import { AvatarLabelCell } from '../Cell';
4
+ import * as S from '../Table.styles';
5
5
  export var DEFAULT_ROW_COUNT = 10;
6
6
  export var HEADER_HEIGHT = 73;
7
7
  export var SUBHEADER_HEIGHT = 64;
@@ -1,4 +1,4 @@
1
- import { Props as TableSelectionType } from '../../TableHeader/TableSelection.types';
1
+ import { type Props as TableSelectionType } from '../../TableHeader/TableSelection.types';
2
2
  type BulkSelectionType = {
3
3
  allRecordsCount: number;
4
4
  selectableRecordsCount: number;
@@ -1,7 +1,7 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  import { useCallback, useMemo } from 'react';
3
- import { useRowKey } from '../useRowKey';
4
3
  import { isRecordSelectable } from '../../utils';
4
+ import { useRowKey } from '../useRowKey';
5
5
  export var useBulkSelectionCount = function useBulkSelectionCount(_ref) {
6
6
  var dataSource = _ref.dataSource,
7
7
  selection = _ref.selection,
@@ -21,7 +21,9 @@ export var useBulkSelectionCount = function useBulkSelectionCount(_ref) {
21
21
  selectableAndSelectedRecordsCount: 0,
22
22
  selectedRecordsCount: 0
23
23
  };
24
- if (!dataSource.length || !selection) return initialValue;
24
+ if (!dataSource.length || !selection) {
25
+ return initialValue;
26
+ }
25
27
  var selectedRowKeys = selection.selectedRowKeys,
26
28
  independentSelectionExpandedRows = selection.independentSelectionExpandedRows,
27
29
  checkRowSelectionStatus = selection.checkRowSelectionStatus;
@@ -2,11 +2,14 @@ import React from 'react';
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
 
5
- // eslint-disable-next-line import/prefer-default-export
6
5
  export var useRowKey = function useRowKey(rowKey) {
7
6
  var getRowKey = React.useCallback(function (row) {
8
- if (typeof rowKey === 'function') return rowKey(row);
9
- if (typeof rowKey === 'string') return row[rowKey];
7
+ if (typeof rowKey === 'function') {
8
+ return rowKey(row);
9
+ }
10
+ if (typeof rowKey === 'string') {
11
+ return row[rowKey];
12
+ }
10
13
  return row.key || undefined;
11
14
  }, [rowKey]);
12
15
  return {
@@ -1,2 +1,2 @@
1
- import { UseStarredApi } from './useRowStar.types';
1
+ import { type UseStarredApi } from './useRowStar.types';
2
2
  export declare const useRowStar: (initialStarredKeys: string[]) => UseStarredApi;
@@ -19,7 +19,9 @@ var createRowStarColumn = function createRowStarColumn(_ref) {
19
19
  render: (rowStar == null ? void 0 : rowStar.renderCell) || function (value, record) {
20
20
  var expandedChild = record.expandedChild;
21
21
  var keyString = String(getRowKey(record));
22
- if (loading || expandedChild && rowStar != null && rowStar.disableForExpandedRows) return null;
22
+ if (loading || expandedChild && rowStar != null && rowStar.disableForExpandedRows) {
23
+ return null;
24
+ }
23
25
  return /*#__PURE__*/React.createElement(Tooltip, {
24
26
  title: locale == null ? void 0 : locale.starRowTooltip
25
27
  }, /*#__PURE__*/React.createElement(Button.Star, {
@@ -39,8 +41,6 @@ var createRowStarColumn = function createRowStarColumn(_ref) {
39
41
  };
40
42
  };
41
43
  };
42
-
43
- // eslint-disable-next-line import/prefer-default-export
44
44
  export var useRowStar = function useRowStar(initialStarredKeys) {
45
45
  var starredKeys = React.useRef(new Set(initialStarredKeys));
46
46
  var getStarredRowKeys = function getStarredRowKeys() {
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { ColumnType } from 'antd/lib/table';
3
- import { DSTableProps, DSColumnType } from '../../Table.types';
1
+ import { type ColumnType } from 'antd/lib/table';
2
+ import type React from 'react';
3
+ import { type DSColumnType, type DSTableProps } from '../../Table.types';
4
4
  export interface RowStar<T> {
5
5
  className?: string;
6
6
  starredRowKeys: string[];
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import VirtualTable from './VirtualTable/VirtualTable';
2
- import GroupedTable from './GroupTable/GroupTable';
3
1
  import * as TableCell from './Cell';
2
+ import GroupedTable from './GroupTable/GroupTable';
4
3
  import ItemsMenu from './ItemsMenu/ItemsMenu';
5
4
  import TreeTable from './TreeTable/TreeTable';
5
+ import VirtualTable from './VirtualTable/VirtualTable';
6
6
  export { default } from './Table';
7
7
  export { GroupedTable, VirtualTable, TableCell, ItemsMenu, TreeTable };
8
8
  export { default as BackToTopButton } from './InfiniteScroll/BackToTopButton';
9
- export type { Props as VirtualTableProps, VirtualTableRef, VirtualColumnType } from './VirtualTable/VirtualTable.types';
9
+ export type { Props as VirtualTableProps, VirtualTableRef, VirtualColumnType, } from './VirtualTable/VirtualTable.types';
10
10
  export type { RowSelection, RowType, SingleColumnSort, OnSortFn, Locale, DSColumnType, DSTableProps, ScrollProxyType, Selection, SelectionItem, CustomizeScrollBodyInfo, } from './Table.types';
11
11
  export { GROUP_BY } from './GroupTable/GroupTable.types';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import VirtualTable from './VirtualTable/VirtualTable';
2
- import GroupedTable from './GroupTable/GroupTable';
3
1
  import * as TableCell from './Cell';
2
+ import GroupedTable from './GroupTable/GroupTable';
4
3
  import ItemsMenu from './ItemsMenu/ItemsMenu';
5
4
  import TreeTable from './TreeTable/TreeTable';
5
+ import VirtualTable from './VirtualTable/VirtualTable';
6
6
  export { default } from './Table';
7
7
  export { GroupedTable, VirtualTable, TableCell, ItemsMenu, TreeTable };
8
8
  export { default as BackToTopButton } from './InfiniteScroll/BackToTopButton';