@synerise/ds-table 0.56.3 → 0.56.5

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 (31) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -0
  3. package/dist/Table.d.ts +1 -1
  4. package/dist/Table.js +20 -13
  5. package/dist/Table.types.d.ts +1 -0
  6. package/dist/TableSkeleton/TableSkeleton.d.ts +3 -0
  7. package/dist/TableSkeleton/TableSkeleton.js +24 -0
  8. package/dist/TableSkeleton/TableSkeleton.styles.d.ts +12 -0
  9. package/dist/TableSkeleton/TableSkeleton.styles.js +47 -0
  10. package/dist/TableSkeleton/TableSkeleton.types.d.ts +4 -0
  11. package/dist/TableSkeleton/TableSkeleton.types.js +1 -0
  12. package/dist/TableSkeleton/components/TableSkeletonBar.d.ts +6 -0
  13. package/dist/TableSkeleton/components/TableSkeletonBar.js +19 -0
  14. package/dist/TableSkeleton/components/TableSkeletonBody.d.ts +6 -0
  15. package/dist/TableSkeleton/components/TableSkeletonBody.js +31 -0
  16. package/dist/TableSkeleton/components/TableSkeletonHeader.d.ts +2 -0
  17. package/dist/TableSkeleton/components/TableSkeletonHeader.js +15 -0
  18. package/dist/TableSkeleton/components/TableSkeletonRowRight.d.ts +2 -0
  19. package/dist/TableSkeleton/components/TableSkeletonRowRight.js +13 -0
  20. package/dist/TableSkeleton/components/TableSkeletonSubheader.d.ts +2 -0
  21. package/dist/TableSkeleton/components/TableSkeletonSubheader.js +10 -0
  22. package/dist/TableSkeleton/components/index.d.ts +5 -0
  23. package/dist/TableSkeleton/components/index.js +5 -0
  24. package/dist/TableSkeleton/constants.d.ts +8 -0
  25. package/dist/TableSkeleton/constants.js +8 -0
  26. package/dist/VirtualTable/VirtualTable.d.ts +3 -1
  27. package/dist/VirtualTable/VirtualTable.js +9 -0
  28. package/dist/VirtualTable/VirtualTable.styles.d.ts +2 -0
  29. package/dist/VirtualTable/VirtualTable.styles.js +1 -1
  30. package/dist/VirtualTable/VirtualTable.types.d.ts +3 -1
  31. package/package.json +24 -24
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.56.5](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.56.4...@synerise/ds-table@0.56.5) (2024-09-03)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-table
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.56.4](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.56.3...@synerise/ds-table@0.56.4) (2024-08-30)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **table:** virtual table sticky header offsets ([177720d](https://github.com/synerise/synerise-design/commit/177720d7d92140f497c7c2234904dae73065348e))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.56.3](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.56.2...@synerise/ds-table@0.56.3) (2024-08-27)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-table
package/README.md CHANGED
@@ -60,6 +60,8 @@ Table UI Component
60
60
  | getPopupContainer | the render container of dropdowns in table | (triggerNode) => HTMLElement | `() => TableHtmlElement` |
61
61
  | renderSelectionTitle | Function to render a custom title in table header when some items are selected | ({selection: RowSelection, filters:Filter[] }) => React.ReactNode | - |
62
62
  | rowStar | Configuration of row starring | RowStar | - |
63
+ | maxHeight | Defines the max height to which table skeleton (when loading) should be filled with rows. If undefined 10 skeleton rows will be rendered | number | - |
64
+
63
65
 
64
66
 
65
67
  ### VirtualTable
package/dist/Table.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import '@synerise/ds-core/dist/js/style';
3
3
  import './style/index.less';
4
4
  import { DSTableProps } from './Table.types';
package/dist/Table.js CHANGED
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
8
 
9
- import * as React from 'react';
9
+ import React, { useMemo } from 'react';
10
10
  import '@synerise/ds-core/dist/js/style';
11
11
  import "./style/index.css";
12
12
  import Icon, { AngleLeftS, AngleRightS, SpinnerM } from '@synerise/ds-icon';
@@ -20,6 +20,7 @@ import DefaultTable from './DefaultTable/DefaultTable';
20
20
  import GroupTable from './GroupTable/GroupTable';
21
21
  import { useTableLocale, TableLocaleContext } from './utils/locale';
22
22
  import { getChildrenColumnName } from './utils/getChildrenColumnName';
23
+ import { TableSkeleton } from './TableSkeleton/TableSkeleton';
23
24
  export var SELECTION_ALL = 'SELECTION_ALL';
24
25
  export var SELECTION_INVERT = 'SELECTION_INVERT';
25
26
  var ITEM_RENDER_TYPE = {
@@ -52,7 +53,8 @@ function DSTable(props) {
52
53
  renderSelectionTitle = props.renderSelectionTitle,
53
54
  hideTitlePart = props.hideTitlePart,
54
55
  disableColumnNamesLineBreak = props.disableColumnNamesLineBreak,
55
- expandable = props.expandable;
56
+ expandable = props.expandable,
57
+ maxHeight = props.maxHeight;
56
58
  var tableLocale = useTableLocale(intl, locale);
57
59
 
58
60
  var _useDataFormat = useDataFormat(),
@@ -126,13 +128,27 @@ function DSTable(props) {
126
128
  }
127
129
  }, pagination);
128
130
  }, [pagination, formatValue, grouped, tableLocale, hideTitlePart]);
131
+ var defaultTableContent = useMemo(function () {
132
+ return loading && !(dataSource != null && dataSource.length) ? /*#__PURE__*/React.createElement(TableSkeleton, {
133
+ maxHeight: maxHeight
134
+ }) : /*#__PURE__*/React.createElement(DefaultTable, _extends({
135
+ scroll: {
136
+ x: 'auto'
137
+ },
138
+ tableLayout: "auto"
139
+ }, props, {
140
+ locale: tableLocale,
141
+ title: renderHeader,
142
+ pagination: dataSource != null && dataSource.length && pagination ? footerPagination : false
143
+ }));
144
+ }, [dataSource == null ? void 0 : dataSource.length, footerPagination, loading, pagination, props, renderHeader, maxHeight, tableLocale]);
129
145
  return /*#__PURE__*/React.createElement(TableLocaleContext.Provider, {
130
146
  value: tableLocale
131
147
  }, /*#__PURE__*/React.createElement(S.TableWrapper, {
132
148
  className: "ds-table ds-table-cell-size-" + cellSize + " " + (roundedHeader ? 'ds-table-rounded' : ''),
133
149
  hideColumnNames: hideColumnNames,
134
150
  disableColumnNamesLineBreak: disableColumnNamesLineBreak
135
- }, loading && /*#__PURE__*/React.createElement(S.Spinner, {
151
+ }, !!(loading && dataSource != null && dataSource.length) && /*#__PURE__*/React.createElement(S.Spinner, {
136
152
  className: "spinner"
137
153
  }, /*#__PURE__*/React.createElement(Icon, {
138
154
  component: /*#__PURE__*/React.createElement(SpinnerM, null),
@@ -144,16 +160,7 @@ function DSTable(props) {
144
160
  locale: tableLocale,
145
161
  title: renderHeader,
146
162
  pagination: dataSource != null && dataSource.length && pagination ? footerPagination : false
147
- })) : /*#__PURE__*/React.createElement(DefaultTable, _extends({
148
- scroll: {
149
- x: 'auto'
150
- },
151
- tableLayout: "auto"
152
- }, props, {
153
- locale: tableLocale,
154
- title: renderHeader,
155
- pagination: dataSource != null && dataSource.length && pagination ? footerPagination : false
156
- }))));
163
+ })) : defaultTableContent));
157
164
  }
158
165
 
159
166
  DSTable.SELECTION_ALL = SELECTION_ALL;
@@ -125,5 +125,6 @@ export type DSTableProps<T extends any & GroupType<T>> = AntTableProps<T> & {
125
125
  onSort?: OnSortFn;
126
126
  dataSourceFull?: T[];
127
127
  dataSourceTotalCount?: number;
128
+ maxHeight?: number;
128
129
  };
129
130
  export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { TableSkeletonProps } from './TableSkeleton.types';
3
+ export declare const TableSkeleton: ({ maxHeight, ...htmlAttributes }: TableSkeletonProps) => React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ var _excluded = ["maxHeight"];
2
+
3
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+
7
+ import React, { useMemo } from 'react';
8
+ import * as S from './TableSkeleton.styles';
9
+ import { DEFAULT_ROW_COUNT, TABLE_HEADER, GAP, ROW_HEIGHT } from './constants';
10
+ import { TableSkeletonHeader, TableSkeletonSubheader, TableSkeletonBody } from './components';
11
+ export var TableSkeleton = function TableSkeleton(_ref) {
12
+ var maxHeight = _ref.maxHeight,
13
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
14
+
15
+ var rowCount = useMemo(function () {
16
+ if (!maxHeight) return DEFAULT_ROW_COUNT;
17
+ return Math.ceil((maxHeight - TABLE_HEADER - GAP) / (ROW_HEIGHT + GAP));
18
+ }, [maxHeight]);
19
+ return /*#__PURE__*/React.createElement(S.TableSkeletonWrapper, _extends({}, htmlAttributes, {
20
+ "data-testid": "ds-table-skeleton"
21
+ }), /*#__PURE__*/React.createElement(TableSkeletonHeader, null), /*#__PURE__*/React.createElement(TableSkeletonSubheader, null), /*#__PURE__*/React.createElement(TableSkeletonBody, {
22
+ rows: rowCount
23
+ }));
24
+ };
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export declare const TableSkeletonWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const TableSkeletonHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const Skeleton: import("styled-components").StyledComponent<({ size, numberOfSkeletons, width, height, className }: import("@synerise/ds-skeleton").SkeletonProps) => import("react").JSX.Element, any, {}, never>;
5
+ export declare const SkeletonWrapper: import("styled-components").StyledComponent<"div", any, {
6
+ width?: number | undefined;
7
+ }, never>;
8
+ export declare const TableSkeletonSubHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export declare const TableSkeletonLeft: import("styled-components").StyledComponent<"div", any, {}, never>;
10
+ export declare const TableSkeletonRight: import("styled-components").StyledComponent<"div", any, {}, never>;
11
+ export declare const TableSkeletonBody: import("styled-components").StyledComponent<"div", any, {}, never>;
12
+ export declare const TableSkeletonRow: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,47 @@
1
+ import styled, { css } from 'styled-components';
2
+ import DSSkeleton from '@synerise/ds-skeleton';
3
+ var rowCss = css(["display:flex;flex-direction:row;justify-content:space-between;"]);
4
+ export var TableSkeletonWrapper = styled.div.withConfig({
5
+ displayName: "TableSkeletonstyles__TableSkeletonWrapper",
6
+ componentId: "sc-9yqnm1-0"
7
+ })(["background:", ";z-index:10;"], function (props) {
8
+ return props.theme.palette.white;
9
+ });
10
+ export var TableSkeletonHeader = styled.div.withConfig({
11
+ displayName: "TableSkeletonstyles__TableSkeletonHeader",
12
+ componentId: "sc-9yqnm1-1"
13
+ })(["", " padding:18px;"], rowCss);
14
+ export var Skeleton = styled(DSSkeleton).withConfig({
15
+ displayName: "TableSkeletonstyles__Skeleton",
16
+ componentId: "sc-9yqnm1-2"
17
+ })(["padding:12px 0;"]);
18
+ export var SkeletonWrapper = styled.div.withConfig({
19
+ displayName: "TableSkeletonstyles__SkeletonWrapper",
20
+ componentId: "sc-9yqnm1-3"
21
+ })(["width:", "px;"], function (props) {
22
+ return props.width;
23
+ });
24
+ export var TableSkeletonSubHeader = styled.div.withConfig({
25
+ displayName: "TableSkeletonstyles__TableSkeletonSubHeader",
26
+ componentId: "sc-9yqnm1-4"
27
+ })(["", " border-top:solid 1px ", ";border-bottom:solid 1px ", ";padding:18px 18px 18px 84px;"], rowCss, function (props) {
28
+ return props.theme.palette['grey-200'];
29
+ }, function (props) {
30
+ return props.theme.palette['grey-200'];
31
+ });
32
+ export var TableSkeletonLeft = styled.div.withConfig({
33
+ displayName: "TableSkeletonstyles__TableSkeletonLeft",
34
+ componentId: "sc-9yqnm1-5"
35
+ })(["display:flex;flex-direction:row;gap:50px;"]);
36
+ export var TableSkeletonRight = styled.div.withConfig({
37
+ displayName: "TableSkeletonstyles__TableSkeletonRight",
38
+ componentId: "sc-9yqnm1-6"
39
+ })(["display:flex;flex-direction:row;gap:50px;"]);
40
+ export var TableSkeletonBody = styled.div.withConfig({
41
+ displayName: "TableSkeletonstyles__TableSkeletonBody",
42
+ componentId: "sc-9yqnm1-7"
43
+ })(["display:flex;flex-direction:column;gap:36px;padding:18px;"]);
44
+ export var TableSkeletonRow = styled.div.withConfig({
45
+ displayName: "TableSkeletonstyles__TableSkeletonRow",
46
+ componentId: "sc-9yqnm1-8"
47
+ })(["", ""], rowCss);
@@ -0,0 +1,4 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export type TableSkeletonProps = HTMLAttributes<HTMLDivElement> & {
3
+ maxHeight?: number;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ type TableSkeletonBarProps = HTMLAttributes<HTMLDivElement> & {
3
+ width: number;
4
+ };
5
+ export declare const TableSkeletonBar: ({ width, ...htmlAttributes }: TableSkeletonBarProps) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,19 @@
1
+ var _excluded = ["width"];
2
+
3
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+
7
+ import React from 'react';
8
+ import * as S from '../TableSkeleton.styles';
9
+ export var TableSkeletonBar = function TableSkeletonBar(_ref) {
10
+ var width = _ref.width,
11
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
12
+
13
+ return /*#__PURE__*/React.createElement(S.SkeletonWrapper, _extends({}, htmlAttributes, {
14
+ width: width
15
+ }), /*#__PURE__*/React.createElement(S.Skeleton, {
16
+ size: "M",
17
+ numberOfSkeletons: 1
18
+ }));
19
+ };
@@ -0,0 +1,6 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ type TableSkeletonBodyProps = HTMLAttributes<HTMLDivElement> & {
3
+ rows: number;
4
+ };
5
+ export declare const TableSkeletonBody: ({ rows, ...htmlAttributes }: TableSkeletonBodyProps) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,31 @@
1
+ var _excluded = ["rows"];
2
+
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
+
5
+ import React from 'react';
6
+ import { SkeletonAvatar } from '@synerise/ds-skeleton';
7
+ import * as S from '../TableSkeleton.styles';
8
+ import { TableSkeletonBar } from './TableSkeletonBar';
9
+ import { TableSkeletonRowRight } from './TableSkeletonRowRight';
10
+ import { SKELETON_BAR_TINY, SKELETON_BAR_WIDE } from '../constants';
11
+ export var TableSkeletonBody = function TableSkeletonBody(_ref) {
12
+ var _ref$rows = _ref.rows,
13
+ rows = _ref$rows === void 0 ? 10 : _ref$rows,
14
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+
16
+ return /*#__PURE__*/React.createElement(S.TableSkeletonBody, htmlAttributes, Array.from({
17
+ length: rows
18
+ }, function (_, index) {
19
+ return /*#__PURE__*/React.createElement(S.TableSkeletonRow, {
20
+ "data-testid": "ds-table-skeleton-row",
21
+ key: "ds-skeleton-row-" + index
22
+ }, /*#__PURE__*/React.createElement(S.TableSkeletonLeft, null, /*#__PURE__*/React.createElement(TableSkeletonBar, {
23
+ width: SKELETON_BAR_TINY
24
+ }), /*#__PURE__*/React.createElement(SkeletonAvatar, {
25
+ shape: "circle",
26
+ size: "M"
27
+ }), /*#__PURE__*/React.createElement(TableSkeletonBar, {
28
+ width: SKELETON_BAR_WIDE
29
+ })), /*#__PURE__*/React.createElement(S.TableSkeletonRight, null, /*#__PURE__*/React.createElement(TableSkeletonRowRight, null)));
30
+ }));
31
+ };
@@ -0,0 +1,2 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ export declare const TableSkeletonHeader: (props: HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { SKELETON_BAR_STANDARD } from '../constants';
3
+ import * as S from '../TableSkeleton.styles';
4
+ import { TableSkeletonBar } from './TableSkeletonBar';
5
+ export var TableSkeletonHeader = function TableSkeletonHeader(props) {
6
+ return /*#__PURE__*/React.createElement(S.TableSkeletonHeader, props, /*#__PURE__*/React.createElement(S.TableSkeletonLeft, null, /*#__PURE__*/React.createElement(TableSkeletonBar, {
7
+ width: SKELETON_BAR_STANDARD
8
+ })), /*#__PURE__*/React.createElement(S.TableSkeletonRight, null, /*#__PURE__*/React.createElement(TableSkeletonBar, {
9
+ width: SKELETON_BAR_STANDARD
10
+ }), /*#__PURE__*/React.createElement(TableSkeletonBar, {
11
+ width: SKELETON_BAR_STANDARD
12
+ }), /*#__PURE__*/React.createElement(TableSkeletonBar, {
13
+ width: SKELETON_BAR_STANDARD
14
+ })));
15
+ };
@@ -0,0 +1,2 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ export declare const TableSkeletonRowRight: (props: HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import * as S from '../TableSkeleton.styles';
3
+ import { TableSkeletonBar } from './TableSkeletonBar';
4
+ import { SKELETON_BAR_STANDARD, SKELETON_BAR_EXTRA_WIDE } from '../constants';
5
+ export var TableSkeletonRowRight = function TableSkeletonRowRight(props) {
6
+ return /*#__PURE__*/React.createElement(S.TableSkeletonRight, props, /*#__PURE__*/React.createElement(TableSkeletonBar, {
7
+ width: SKELETON_BAR_STANDARD
8
+ }), /*#__PURE__*/React.createElement(TableSkeletonBar, {
9
+ width: SKELETON_BAR_EXTRA_WIDE
10
+ }), /*#__PURE__*/React.createElement(TableSkeletonBar, {
11
+ width: SKELETON_BAR_STANDARD
12
+ }));
13
+ };
@@ -0,0 +1,2 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ export declare const TableSkeletonSubheader: (props: HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import * as S from '../TableSkeleton.styles';
3
+ import { TableSkeletonBar } from './TableSkeletonBar';
4
+ import { TableSkeletonRowRight } from './TableSkeletonRowRight';
5
+ import { SKELETON_BAR_WIDE } from '../constants';
6
+ export var TableSkeletonSubheader = function TableSkeletonSubheader(props) {
7
+ return /*#__PURE__*/React.createElement(S.TableSkeletonSubHeader, props, /*#__PURE__*/React.createElement(S.TableSkeletonLeft, null, /*#__PURE__*/React.createElement(TableSkeletonBar, {
8
+ width: SKELETON_BAR_WIDE
9
+ })), /*#__PURE__*/React.createElement(S.TableSkeletonRight, null, /*#__PURE__*/React.createElement(TableSkeletonRowRight, null)));
10
+ };
@@ -0,0 +1,5 @@
1
+ export * from './TableSkeletonBar';
2
+ export * from './TableSkeletonBody';
3
+ export * from './TableSkeletonHeader';
4
+ export * from './TableSkeletonRowRight';
5
+ export * from './TableSkeletonSubheader';
@@ -0,0 +1,5 @@
1
+ export * from './TableSkeletonBar';
2
+ export * from './TableSkeletonBody';
3
+ export * from './TableSkeletonHeader';
4
+ export * from './TableSkeletonRowRight';
5
+ export * from './TableSkeletonSubheader';
@@ -0,0 +1,8 @@
1
+ export declare const DEFAULT_ROW_COUNT = 10;
2
+ export declare const ROW_HEIGHT = 40;
3
+ export declare const GAP = 36;
4
+ export declare const TABLE_HEADER: number;
5
+ export declare const SKELETON_BAR_TINY = 16;
6
+ export declare const SKELETON_BAR_STANDARD = 72;
7
+ export declare const SKELETON_BAR_WIDE = 100;
8
+ export declare const SKELETON_BAR_EXTRA_WIDE = 164;
@@ -0,0 +1,8 @@
1
+ export var DEFAULT_ROW_COUNT = 10;
2
+ export var ROW_HEIGHT = 40;
3
+ export var GAP = 36;
4
+ export var TABLE_HEADER = 76 + 78;
5
+ export var SKELETON_BAR_TINY = 16;
6
+ export var SKELETON_BAR_STANDARD = 72;
7
+ export var SKELETON_BAR_WIDE = 100;
8
+ export var SKELETON_BAR_EXTRA_WIDE = 164;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { Ref, ReactElement } from 'react';
3
3
  import { FixedSizeList as List } from 'react-window';
4
4
  import type { RowType, DSTableProps, RowSelection, CustomizeScrollBodyInfo, DSColumnType } from '../Table.types';
5
- import type { Props, VirtualTableRef } from './VirtualTable.types';
5
+ import type { VirtualTableRef, VirtualTableProps } from './VirtualTable.types';
6
6
  declare const _default: <T extends object & RowType<T> & {
7
7
  expandedChild?: boolean | undefined;
8
8
  }>(p: import("../Table.types").AntTableProps<T> & {
@@ -35,6 +35,7 @@ declare const _default: <T extends object & RowType<T> & {
35
35
  onSort?: import("../Table.types").OnSortFn | undefined;
36
36
  dataSourceFull?: T[] | undefined;
37
37
  dataSourceTotalCount?: number | undefined;
38
+ maxHeight?: number | undefined;
38
39
  } & {
39
40
  cellHeight: number;
40
41
  infiniteScroll?: import("../InfiniteScroll/InfiniteLoaderItem.types").InfiniteScrollProps | undefined;
@@ -45,6 +46,7 @@ declare const _default: <T extends object & RowType<T> & {
45
46
  };
46
47
  sticky?: ((boolean | import("rc-table/lib/interface").TableSticky | undefined) & {
47
48
  scrollThreshold?: number | undefined;
49
+ offsetHeader?: number | undefined;
48
50
  getContainer: () => HTMLDivElement;
49
51
  }) | undefined;
50
52
  onListRefChange?: ((ref: React.RefObject<List<any>>) => void) | undefined;
@@ -170,6 +170,10 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
170
170
  scrollWidth = _useState4[0],
171
171
  setScrollWidth = _useState4[1];
172
172
 
173
+ var _useState5 = useState(0),
174
+ titleBarHeight = _useState5[0],
175
+ setTitleBarHeight = _useState5[1];
176
+
173
177
  var _useRowStar = useRowStar((rowStar == null ? void 0 : rowStar.starredRowKeys) || []),
174
178
  getRowStarColumn = _useRowStar.getRowStarColumn; // deprecated, verify if not used and remove
175
179
 
@@ -376,6 +380,7 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
376
380
  };
377
381
  }, [mergedColumns, selection, rowStar, onRowClick, infiniteScroll, cellHeight]);
378
382
  var offsetScroll = sticky && sticky !== true ? sticky.offsetScroll : 0;
383
+ var offsetStickyHeader = sticky && sticky !== true ? sticky.offsetHeader : 0;
379
384
  var connectObject = useMemo(function () {
380
385
  var obj = {};
381
386
  Object.defineProperty(obj, 'scrollLeft', {
@@ -558,7 +563,9 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
558
563
  useEffect(function () {
559
564
  if (containerRef != null && containerRef.current) {
560
565
  var headerElement = containerRef.current.querySelector('.ant-table-header');
566
+ var titleElement = containerRef.current.querySelector('.ant-table-title');
561
567
  headerElement && setScrollWidth(headerElement.scrollWidth);
568
+ titleElement && setTitleBarHeight(titleElement.clientHeight);
562
569
  }
563
570
  }, [tableWidth, mergedColumns.length, dataSource.length]);
564
571
 
@@ -571,6 +578,8 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
571
578
 
572
579
  return /*#__PURE__*/React.createElement(S.VirtualTableWrapper, {
573
580
  isSticky: isSticky,
581
+ titleBarTop: offsetStickyHeader || 0,
582
+ titleBarHeight: titleBarHeight,
574
583
  style: isSticky ? {} : relativeInlineStyle,
575
584
  key: "relative-container",
576
585
  ref: containerRef,
@@ -24,6 +24,8 @@ export declare const StickyScrollbarContent: import("styled-components").StyledC
24
24
  export declare const ColWrapper: import("styled-components").StyledComponent<"div", any, ColWrapperProps, never>;
25
25
  export declare const VirtualTableWrapper: import("styled-components").StyledComponent<"div", any, {
26
26
  isSticky: boolean;
27
+ titleBarHeight: number;
28
+ titleBarTop: number;
27
29
  isHeaderVisible?: boolean | undefined;
28
30
  }, never>;
29
31
  export {};
@@ -58,5 +58,5 @@ export var VirtualTableWrapper = styled.div.withConfig({
58
58
  displayName: "VirtualTablestyles__VirtualTableWrapper",
59
59
  componentId: "aehkhc-7"
60
60
  })(["", ""], function (props) {
61
- return props.isSticky ? css([".ant-table-title{position:sticky;top:-96px;z-index:99;}.ant-table-title,.ant-table-sticky-header{transition:top 0.3s ease-in-out;}", ";"], props.isHeaderVisible && css([".ant-table-title{top:-24px;}.ant-table-sticky-header{top:48px !important;}"])) : css(["position:relative;"]);
61
+ return props.isSticky ? css([".ant-table-title{position:sticky;top:", "px;z-index:99;}.ant-table-title,.ant-table-sticky-header{transition:top 0.3s ease-in-out;}", ";"], props.titleBarTop - props.titleBarHeight, props.isHeaderVisible && css([".ant-table-title{top:", "px;}.ant-table-sticky-header{top:", "px !important;}"], props.titleBarTop, props.titleBarTop + props.titleBarHeight)) : css(["position:relative;"]);
62
62
  });
@@ -10,7 +10,7 @@ export type VirtualColumnType<T> = DSColumnType<T> & {
10
10
  left?: number;
11
11
  right?: number;
12
12
  };
13
- export type Props<T> = DSTableProps<T> & {
13
+ export type VirtualTableProps<T> = DSTableProps<T> & {
14
14
  cellHeight: number;
15
15
  infiniteScroll?: InfiniteScrollProps;
16
16
  initialWidth: number;
@@ -20,6 +20,7 @@ export type Props<T> = DSTableProps<T> & {
20
20
  };
21
21
  sticky?: DSTableProps<T>['sticky'] & {
22
22
  scrollThreshold?: number;
23
+ offsetHeader?: number;
23
24
  getContainer: () => HTMLDivElement;
24
25
  };
25
26
  onListRefChange?: (ref: RefObject<List>) => void;
@@ -34,3 +35,4 @@ export type VirtualTableRef = {
34
35
  scrollToTop: () => void;
35
36
  scrollTo: (top: number) => void;
36
37
  };
38
+ export type Props<T> = VirtualTableProps<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-table",
3
- "version": "0.56.3",
3
+ "version": "0.56.5",
4
4
  "description": "Table UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -33,31 +33,31 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-alert": "^0.8.24",
37
- "@synerise/ds-badge": "^0.8.5",
38
- "@synerise/ds-button": "^0.21.6",
39
- "@synerise/ds-button-group": "^0.7.10",
40
- "@synerise/ds-checkbox": "^0.12.4",
41
- "@synerise/ds-column-manager": "^0.11.68",
36
+ "@synerise/ds-alert": "^0.8.26",
37
+ "@synerise/ds-badge": "^0.8.7",
38
+ "@synerise/ds-button": "^0.21.8",
39
+ "@synerise/ds-button-group": "^0.7.12",
40
+ "@synerise/ds-checkbox": "^0.12.5",
41
+ "@synerise/ds-column-manager": "^0.11.70",
42
42
  "@synerise/ds-data-format": "^0.5.2",
43
- "@synerise/ds-dropdown": "^0.18.10",
43
+ "@synerise/ds-dropdown": "^0.18.12",
44
44
  "@synerise/ds-flag": "^0.5.1",
45
- "@synerise/ds-icon": "^0.65.1",
46
- "@synerise/ds-input": "^0.24.0",
47
- "@synerise/ds-loader": "^0.3.11",
48
- "@synerise/ds-menu": "^0.19.10",
49
- "@synerise/ds-modal": "^0.17.37",
50
- "@synerise/ds-pagination": "^0.7.58",
51
- "@synerise/ds-result": "^0.7.0",
52
- "@synerise/ds-scrollbar": "^0.11.6",
53
- "@synerise/ds-search": "^0.9.6",
54
- "@synerise/ds-select": "^0.16.12",
55
- "@synerise/ds-skeleton": "^0.6.5",
56
- "@synerise/ds-status": "^0.6.18",
57
- "@synerise/ds-tags": "^0.10.3",
58
- "@synerise/ds-tooltip": "^0.14.36",
45
+ "@synerise/ds-icon": "^0.65.3",
46
+ "@synerise/ds-input": "^0.24.2",
47
+ "@synerise/ds-loader": "^0.3.12",
48
+ "@synerise/ds-menu": "^0.19.12",
49
+ "@synerise/ds-modal": "^0.17.39",
50
+ "@synerise/ds-pagination": "^0.7.60",
51
+ "@synerise/ds-result": "^0.7.2",
52
+ "@synerise/ds-scrollbar": "^0.11.8",
53
+ "@synerise/ds-search": "^0.9.8",
54
+ "@synerise/ds-select": "^0.16.14",
55
+ "@synerise/ds-skeleton": "^0.6.6",
56
+ "@synerise/ds-status": "^0.6.20",
57
+ "@synerise/ds-tags": "^0.10.5",
58
+ "@synerise/ds-tooltip": "^0.14.38",
59
59
  "@synerise/ds-typography": "^0.15.1",
60
- "@synerise/ds-utils": "^0.28.2",
60
+ "@synerise/ds-utils": "^0.29.0",
61
61
  "@types/react-window": "^1.8.5",
62
62
  "classnames": "2.3.2",
63
63
  "copy-to-clipboard": "^3.3.1",
@@ -77,5 +77,5 @@
77
77
  "react-dom": "^16.14.0",
78
78
  "styled-components": "5.0.1"
79
79
  },
80
- "gitHead": "a035aeea499cea00e72e20e3790c0ffcad4fe956"
80
+ "gitHead": "6fe94d574f25c5267c7593dec9399527f441b23a"
81
81
  }