@semcore/data-table 4.50.2-prerelease.0 → 4.51.0-prerelease.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 (237) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/components/AccordionRows/AccordionRows.js +177 -0
  3. package/lib/cjs/components/AccordionRows/AccordionRows.js.map +1 -0
  4. package/lib/cjs/components/Body/Body.js +445 -0
  5. package/lib/cjs/components/Body/Body.js.map +1 -0
  6. package/lib/cjs/components/Body/Body.types.js +2 -0
  7. package/lib/cjs/components/Body/Body.types.js.map +1 -0
  8. package/lib/cjs/components/Body/Cell.js +205 -0
  9. package/lib/cjs/components/Body/Cell.js.map +1 -0
  10. package/lib/cjs/components/Body/Cell.types.js +2 -0
  11. package/lib/cjs/components/Body/Cell.types.js.map +1 -0
  12. package/lib/cjs/components/Body/LimitOverlay.js +191 -0
  13. package/lib/cjs/components/Body/LimitOverlay.js.map +1 -0
  14. package/lib/cjs/components/Body/MergedCells.js +31 -0
  15. package/lib/cjs/components/Body/MergedCells.js.map +1 -0
  16. package/lib/cjs/components/Body/Row.js +630 -0
  17. package/lib/cjs/components/Body/Row.js.map +1 -0
  18. package/lib/cjs/components/Body/Row.types.js +2 -0
  19. package/lib/cjs/components/Body/Row.types.js.map +1 -0
  20. package/lib/cjs/components/Body/RowGroup.js +118 -0
  21. package/lib/cjs/components/Body/RowGroup.js.map +1 -0
  22. package/lib/cjs/components/Body/style.shadow.css +367 -0
  23. package/lib/cjs/components/DataTable/DataTable.js +1303 -0
  24. package/lib/cjs/components/DataTable/DataTable.js.map +1 -0
  25. package/lib/cjs/components/DataTable/DataTable.types.js +2 -0
  26. package/lib/cjs/components/DataTable/DataTable.types.js.map +1 -0
  27. package/lib/cjs/components/DataTable/ScrollBars.js +63 -0
  28. package/lib/cjs/components/DataTable/ScrollBars.js.map +1 -0
  29. package/lib/cjs/components/DataTable/dataTable.shadow.css +43 -0
  30. package/lib/cjs/components/Head/Column.js +350 -0
  31. package/lib/cjs/components/Head/Column.js.map +1 -0
  32. package/lib/cjs/components/Head/Column.types.js +2 -0
  33. package/lib/cjs/components/Head/Column.types.js.map +1 -0
  34. package/lib/cjs/components/Head/Group.js +116 -0
  35. package/lib/cjs/components/Head/Group.js.map +1 -0
  36. package/lib/cjs/components/Head/Group.type.js +2 -0
  37. package/lib/cjs/components/Head/Group.type.js.map +1 -0
  38. package/lib/cjs/components/Head/Head.js +350 -0
  39. package/lib/cjs/components/Head/Head.js.map +1 -0
  40. package/lib/cjs/components/Head/Head.types.js +2 -0
  41. package/lib/cjs/components/Head/Head.types.js.map +1 -0
  42. package/lib/cjs/components/Head/style.shadow.css +292 -0
  43. package/lib/cjs/components/RowSelector/RowsSelector.js +132 -0
  44. package/lib/cjs/components/RowSelector/RowsSelector.js.map +1 -0
  45. package/lib/cjs/components/RowSelector/SRAnnouncer.js +62 -0
  46. package/lib/cjs/components/RowSelector/SRAnnouncer.js.map +1 -0
  47. package/lib/cjs/components/RowSelector/SRReactiveAnnouncer.js +39 -0
  48. package/lib/cjs/components/RowSelector/SRReactiveAnnouncer.js.map +1 -0
  49. package/lib/cjs/enhancers/focusableCell.js +76 -0
  50. package/lib/cjs/enhancers/focusableCell.js.map +1 -0
  51. package/lib/cjs/index.js +38 -15
  52. package/lib/cjs/index.js.map +1 -1
  53. package/lib/cjs/store/SelectableRows.js +211 -0
  54. package/lib/cjs/store/SelectableRows.js.map +1 -0
  55. package/lib/cjs/style/scroll-shadows.shadow.css +50 -5
  56. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
  57. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  58. package/lib/cjs/translations/de.json +6 -1
  59. package/lib/cjs/translations/en.json +6 -1
  60. package/lib/cjs/translations/es.json +6 -1
  61. package/lib/cjs/translations/fr.json +6 -1
  62. package/lib/cjs/translations/it.json +6 -1
  63. package/lib/cjs/translations/ja.json +6 -1
  64. package/lib/cjs/translations/ko.json +6 -1
  65. package/lib/cjs/translations/nl.json +6 -1
  66. package/lib/cjs/translations/pl.json +6 -1
  67. package/lib/cjs/translations/pt.json +6 -1
  68. package/lib/cjs/translations/sv.json +6 -1
  69. package/lib/cjs/translations/tr.json +6 -1
  70. package/lib/cjs/translations/vi.json +6 -1
  71. package/lib/cjs/translations/zh.json +6 -1
  72. package/lib/es6/components/AccordionRows/AccordionRows.js +171 -0
  73. package/lib/es6/components/AccordionRows/AccordionRows.js.map +1 -0
  74. package/lib/es6/components/Body/Body.js +439 -0
  75. package/lib/es6/components/Body/Body.js.map +1 -0
  76. package/lib/es6/components/Body/Body.types.js +2 -0
  77. package/lib/es6/components/Body/Body.types.js.map +1 -0
  78. package/lib/es6/components/Body/Cell.js +199 -0
  79. package/lib/es6/components/Body/Cell.js.map +1 -0
  80. package/lib/es6/components/Body/Cell.types.js +2 -0
  81. package/lib/es6/components/Body/Cell.types.js.map +1 -0
  82. package/lib/es6/components/Body/LimitOverlay.js +184 -0
  83. package/lib/es6/components/Body/LimitOverlay.js.map +1 -0
  84. package/lib/es6/components/Body/MergedCells.js +24 -0
  85. package/lib/es6/components/Body/MergedCells.js.map +1 -0
  86. package/lib/es6/components/Body/Row.js +624 -0
  87. package/lib/es6/components/Body/Row.js.map +1 -0
  88. package/lib/es6/components/Body/Row.types.js +2 -0
  89. package/lib/es6/components/Body/Row.types.js.map +1 -0
  90. package/lib/es6/components/Body/RowGroup.js +111 -0
  91. package/lib/es6/components/Body/RowGroup.js.map +1 -0
  92. package/lib/es6/components/Body/style.shadow.css +367 -0
  93. package/lib/es6/components/DataTable/DataTable.js +1298 -0
  94. package/lib/es6/components/DataTable/DataTable.js.map +1 -0
  95. package/lib/es6/components/DataTable/DataTable.types.js +2 -0
  96. package/lib/es6/components/DataTable/DataTable.types.js.map +1 -0
  97. package/lib/es6/components/DataTable/ScrollBars.js +57 -0
  98. package/lib/es6/components/DataTable/ScrollBars.js.map +1 -0
  99. package/lib/es6/components/DataTable/dataTable.shadow.css +43 -0
  100. package/lib/es6/components/Head/Column.js +344 -0
  101. package/lib/es6/components/Head/Column.js.map +1 -0
  102. package/lib/es6/components/Head/Column.types.js +2 -0
  103. package/lib/es6/components/Head/Column.types.js.map +1 -0
  104. package/lib/es6/components/Head/Group.js +111 -0
  105. package/lib/es6/components/Head/Group.js.map +1 -0
  106. package/lib/es6/components/Head/Group.type.js +2 -0
  107. package/lib/es6/components/Head/Group.type.js.map +1 -0
  108. package/lib/es6/components/Head/Head.js +345 -0
  109. package/lib/es6/components/Head/Head.js.map +1 -0
  110. package/lib/es6/components/Head/Head.types.js +2 -0
  111. package/lib/es6/components/Head/Head.types.js.map +1 -0
  112. package/lib/es6/components/Head/style.shadow.css +292 -0
  113. package/lib/es6/components/RowSelector/RowsSelector.js +125 -0
  114. package/lib/es6/components/RowSelector/RowsSelector.js.map +1 -0
  115. package/lib/es6/components/RowSelector/SRAnnouncer.js +55 -0
  116. package/lib/es6/components/RowSelector/SRAnnouncer.js.map +1 -0
  117. package/lib/es6/components/RowSelector/SRReactiveAnnouncer.js +32 -0
  118. package/lib/es6/components/RowSelector/SRReactiveAnnouncer.js.map +1 -0
  119. package/lib/es6/enhancers/focusableCell.js +69 -0
  120. package/lib/es6/enhancers/focusableCell.js.map +1 -0
  121. package/lib/es6/index.js +7 -2
  122. package/lib/es6/index.js.map +1 -1
  123. package/lib/es6/store/SelectableRows.js +204 -0
  124. package/lib/es6/store/SelectableRows.js.map +1 -0
  125. package/lib/es6/style/scroll-shadows.shadow.css +50 -5
  126. package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
  127. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  128. package/lib/es6/translations/de.json +6 -1
  129. package/lib/es6/translations/en.json +6 -1
  130. package/lib/es6/translations/es.json +6 -1
  131. package/lib/es6/translations/fr.json +6 -1
  132. package/lib/es6/translations/it.json +6 -1
  133. package/lib/es6/translations/ja.json +6 -1
  134. package/lib/es6/translations/ko.json +6 -1
  135. package/lib/es6/translations/nl.json +6 -1
  136. package/lib/es6/translations/pl.json +6 -1
  137. package/lib/es6/translations/pt.json +6 -1
  138. package/lib/es6/translations/sv.json +6 -1
  139. package/lib/es6/translations/tr.json +6 -1
  140. package/lib/es6/translations/vi.json +6 -1
  141. package/lib/es6/translations/zh.json +6 -1
  142. package/lib/esm/components/AccordionRows/AccordionRows.mjs +155 -0
  143. package/lib/esm/components/Body/Body.mjs +395 -0
  144. package/lib/esm/components/Body/Cell.mjs +192 -0
  145. package/lib/esm/components/Body/LimitOverlay.mjs +179 -0
  146. package/lib/esm/components/Body/MergedCells.mjs +27 -0
  147. package/lib/esm/components/Body/Row.mjs +556 -0
  148. package/lib/esm/components/Body/RowGroup.mjs +113 -0
  149. package/lib/esm/components/Body/style.shadow.css +367 -0
  150. package/lib/esm/components/DataTable/DataTable.mjs +1216 -0
  151. package/lib/esm/components/DataTable/ScrollBars.mjs +61 -0
  152. package/lib/esm/components/DataTable/dataTable.shadow.css +43 -0
  153. package/lib/esm/components/Head/Column.mjs +321 -0
  154. package/lib/esm/components/Head/Group.mjs +111 -0
  155. package/lib/esm/components/Head/Head.mjs +307 -0
  156. package/lib/esm/components/Head/style.shadow.css +292 -0
  157. package/lib/esm/components/RowSelector/RowsSelector.mjs +105 -0
  158. package/lib/esm/components/RowSelector/SRAnnouncer.mjs +51 -0
  159. package/lib/esm/components/RowSelector/SRReactiveAnnouncer.mjs +31 -0
  160. package/lib/esm/enhancers/focusableCell.mjs +72 -0
  161. package/lib/esm/index.mjs +12 -5
  162. package/lib/esm/store/SelectableRows.mjs +201 -0
  163. package/lib/esm/style/scroll-shadows.shadow.css +50 -5
  164. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
  165. package/lib/esm/translations/de.json.mjs +6 -1
  166. package/lib/esm/translations/en.json.mjs +6 -1
  167. package/lib/esm/translations/es.json.mjs +6 -1
  168. package/lib/esm/translations/fr.json.mjs +6 -1
  169. package/lib/esm/translations/it.json.mjs +6 -1
  170. package/lib/esm/translations/ja.json.mjs +6 -1
  171. package/lib/esm/translations/ko.json.mjs +6 -1
  172. package/lib/esm/translations/nl.json.mjs +6 -1
  173. package/lib/esm/translations/pl.json.mjs +6 -1
  174. package/lib/esm/translations/pt.json.mjs +6 -1
  175. package/lib/esm/translations/sv.json.mjs +6 -1
  176. package/lib/esm/translations/tr.json.mjs +6 -1
  177. package/lib/esm/translations/vi.json.mjs +6 -1
  178. package/lib/esm/translations/zh.json.mjs +6 -1
  179. package/lib/types/components/AccordionRows/AccordionRows.d.ts +41 -0
  180. package/lib/types/components/Body/Body.d.ts +6 -0
  181. package/lib/types/components/Body/Body.types.d.ts +87 -0
  182. package/lib/types/components/Body/Cell.d.ts +1 -0
  183. package/lib/types/components/Body/Cell.types.d.ts +36 -0
  184. package/lib/types/components/Body/LimitOverlay.d.ts +17 -0
  185. package/lib/types/components/Body/MergedCells.d.ts +17 -0
  186. package/lib/types/components/Body/Row.d.ts +47 -0
  187. package/lib/types/components/Body/Row.types.d.ts +74 -0
  188. package/lib/types/components/Body/RowGroup.d.ts +19 -0
  189. package/lib/types/components/DataTable/DataTable.d.ts +14 -0
  190. package/lib/types/components/DataTable/DataTable.types.d.ts +202 -0
  191. package/lib/types/components/DataTable/ScrollBars.d.ts +11 -0
  192. package/lib/types/components/Head/Column.d.ts +39 -0
  193. package/lib/types/components/Head/Column.types.d.ts +85 -0
  194. package/lib/types/components/Head/Group.d.ts +15 -0
  195. package/lib/types/components/Head/Group.type.d.ts +18 -0
  196. package/lib/types/components/Head/Head.d.ts +9 -0
  197. package/lib/types/components/Head/Head.types.d.ts +58 -0
  198. package/lib/types/components/RowSelector/RowsSelector.d.ts +32 -0
  199. package/lib/types/components/RowSelector/SRAnnouncer.d.ts +10 -0
  200. package/lib/types/components/RowSelector/SRReactiveAnnouncer.d.ts +8 -0
  201. package/lib/types/enhancers/focusableCell.d.ts +9 -0
  202. package/lib/types/index.d.ts +10 -2
  203. package/lib/types/store/SelectableRows.d.ts +60 -0
  204. package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +70 -0
  205. package/package.json +6 -6
  206. package/lib/cjs/Body.js +0 -477
  207. package/lib/cjs/Body.js.map +0 -1
  208. package/lib/cjs/DataTable.js +0 -629
  209. package/lib/cjs/DataTable.js.map +0 -1
  210. package/lib/cjs/Head.js +0 -398
  211. package/lib/cjs/Head.js.map +0 -1
  212. package/lib/cjs/style/data-table.shadow.css +0 -413
  213. package/lib/cjs/types.js +0 -4
  214. package/lib/cjs/types.js.map +0 -1
  215. package/lib/cjs/utils.js +0 -57
  216. package/lib/cjs/utils.js.map +0 -1
  217. package/lib/es6/Body.js +0 -469
  218. package/lib/es6/Body.js.map +0 -1
  219. package/lib/es6/DataTable.js +0 -619
  220. package/lib/es6/DataTable.js.map +0 -1
  221. package/lib/es6/Head.js +0 -390
  222. package/lib/es6/Head.js.map +0 -1
  223. package/lib/es6/style/data-table.shadow.css +0 -413
  224. package/lib/es6/types.js +0 -2
  225. package/lib/es6/types.js.map +0 -1
  226. package/lib/es6/utils.js +0 -48
  227. package/lib/es6/utils.js.map +0 -1
  228. package/lib/esm/Body.mjs +0 -430
  229. package/lib/esm/DataTable.mjs +0 -589
  230. package/lib/esm/Head.mjs +0 -368
  231. package/lib/esm/style/data-table.shadow.css +0 -413
  232. package/lib/esm/utils.mjs +0 -52
  233. package/lib/types/Body.d.ts +0 -61
  234. package/lib/types/DataTable.d.ts +0 -205
  235. package/lib/types/Head.d.ts +0 -45
  236. package/lib/types/types.d.ts +0 -73
  237. package/lib/types/utils.d.ts +0 -4
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ loading?: boolean;
4
+ withHeaderScrollBar?: boolean;
5
+ topOffset?: number;
6
+ withAnimation: boolean;
7
+ };
8
+ export declare class ScrollBars extends React.PureComponent<Props> {
9
+ render(): React.ReactNode;
10
+ }
11
+ export {};
@@ -0,0 +1,39 @@
1
+ import { Component } from '@semcore/core';
2
+ import * as React from 'react';
3
+ import type { ColumnPropsInner, DataTableColumnProps } from './Column.types';
4
+ import type { IFocusableCell, LockedCell } from '../../enhancers/focusableCell';
5
+ import type { ROW_GROUP } from '../DataTable/DataTable';
6
+ import type { DataTableData, SortDirection } from '../DataTable/DataTable.types';
7
+ type State = {
8
+ sortVisible: boolean;
9
+ };
10
+ export declare class Column<Data extends DataTableData, UniqKey extends (Data[number] extends {
11
+ [ROW_GROUP]: DataTableData;
12
+ } ? keyof Data[number][typeof ROW_GROUP][number] : keyof Data[number]), UniqKeyType extends (Data[number] extends {
13
+ [ROW_GROUP]: DataTableData;
14
+ } ? Data[number][typeof ROW_GROUP][number][UniqKey] : Data[number][UniqKey])> extends Component<DataTableColumnProps, [
15
+ ], {}, ColumnPropsInner<Data, UniqKey, UniqKeyType>, State> implements IFocusableCell {
16
+ lockedCell: LockedCell;
17
+ static displayName: string;
18
+ static style: {
19
+ [key: string]: string;
20
+ };
21
+ columnRef: React.RefObject<HTMLDivElement>;
22
+ sortWrapperRef: React.RefObject<HTMLDivElement>;
23
+ state: State;
24
+ componentDidMount(): void;
25
+ componentDidUpdate(prevProps: DataTableColumnProps & ColumnPropsInner<Data, UniqKey, UniqKeyType>): void;
26
+ changeTemplateColumnBySort(): void;
27
+ calculateActiveColumnMinWidth: () => number | null;
28
+ get defaultDirection(): SortDirection;
29
+ handleMouseEnter: () => void;
30
+ handleMouseLeave: () => void;
31
+ handleBlur: (e: React.FocusEvent<HTMLElement>) => void;
32
+ handleSort: (e: React.SyntheticEvent<HTMLElement>) => void;
33
+ handleSortClick: (e: React.SyntheticEvent<HTMLElement>) => void;
34
+ handleFocusableCellKeyDown: (e: React.KeyboardEvent) => void;
35
+ handleFocusableCellFocus: (e: React.FocusEvent<HTMLElement, HTMLElement>) => void;
36
+ handleClick: (e: React.SyntheticEvent<HTMLElement>) => void;
37
+ render(): React.ReactNode;
38
+ }
39
+ export {};
@@ -0,0 +1,85 @@
1
+ import type { Property } from 'csstype';
2
+ import type { BodyPropsInner } from '../Body/Body.types';
3
+ import type { DataTableCellProps } from '../Body/Cell.types';
4
+ import type { ROW_GROUP } from '../DataTable/DataTable';
5
+ import type { ColumnGroupConfig, ColumnItemConfig, DataTableData, DataTableProps, DTUse, SortDirection } from '../DataTable/DataTable.types';
6
+ export type CommonColumnType = {
7
+ /**
8
+ * Name of column for mapping with data
9
+ */
10
+ name: string;
11
+ /**
12
+ * Flag to define column as sortable
13
+ */
14
+ sortable?: boolean | SortDirection;
15
+ /**
16
+ * Fixes column to some side of table
17
+ */
18
+ fixed?: 'left' | 'right';
19
+ /**
20
+ * Adds vertical border(s)
21
+ */
22
+ borders?: 'both' | 'left' | 'right';
23
+ /**
24
+ * It manages the `flex-wrap` property
25
+ */
26
+ flexWrap?: boolean;
27
+ /**
28
+ * It manages the `align-items` property
29
+ */
30
+ alignItems?: Property.AlignItems;
31
+ /**
32
+ * It manages the `align-content` property
33
+ */
34
+ alignContent?: Property.AlignContent;
35
+ /**
36
+ * CSS `justify-content` property
37
+ */
38
+ justifyContent?: Property.JustifyContent;
39
+ /**
40
+ * CSS `text-align` property
41
+ */
42
+ textAlign?: Property.TextAlign;
43
+ };
44
+ export type DTColumn = ColumnItemConfig & CommonColumnType & {
45
+ /**
46
+ * Width for grid-template-columns
47
+ */
48
+ gtcWidth: string;
49
+ parent?: DTColumn | ColumnGroupConfig;
50
+ columns?: DTColumn[];
51
+ children?: React.ReactNode | React.FC;
52
+ gridArea?: string;
53
+ showShadowVertical?: boolean;
54
+ };
55
+ export type DataTableColumnProps = CommonColumnType & {
56
+ /**
57
+ * Value for grid-template-columns for current column
58
+ */
59
+ gtcWidth?: string;
60
+ /**
61
+ * Flag for change column size if sorted by it
62
+ */
63
+ changeSortSize?: boolean;
64
+ };
65
+ export type ColumnPropsInner<Data extends DataTableData, UniqKey extends (Data[number] extends {
66
+ [ROW_GROUP]: DataTableData;
67
+ } ? keyof Data[number][typeof ROW_GROUP][number] : keyof Data[number]), UniqKeyType extends (Data[number] extends {
68
+ [ROW_GROUP]: DataTableData;
69
+ } ? Data[number][typeof ROW_GROUP][number][UniqKey] : Data[number][UniqKey])> = {
70
+ use: DTUse;
71
+ borders?: 'both' | 'left' | 'right';
72
+ sort?: DataTableProps<Data, UniqKey, UniqKeyType>['sort'];
73
+ onSortChange?: DataTableProps<Data, UniqKey, UniqKeyType>['onSortChange'];
74
+ uid: string;
75
+ parent?: DTColumn;
76
+ sortableColumnDescribeId: string;
77
+ columnIndex: number;
78
+ tableRef: React.RefObject<HTMLElement>;
79
+ gridTemplateColumns: string[];
80
+ gridTemplateAreas: string[];
81
+ sticky: boolean;
82
+ onClick: DataTableCellProps<Data, UniqKeyType>['onClick'];
83
+ shadowVertical?: BodyPropsInner<Data, UniqKeyType>['shadowVertical'];
84
+ scrollDirection?: 'horizontal' | 'vertical' | 'both';
85
+ };
@@ -0,0 +1,15 @@
1
+ import { Component } from '@semcore/core';
2
+ import React from 'react';
3
+ import type { DataTableGroupProps, GroupPropsInner } from './Group.type';
4
+ export declare class Group extends Component<DataTableGroupProps, typeof Group.enhance, {}, GroupPropsInner> {
5
+ static displayName: string;
6
+ static style: {
7
+ [key: string]: string;
8
+ };
9
+ static enhance: readonly [(props: any) => {
10
+ uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
11
+ }];
12
+ componentDidMount(): void;
13
+ get groupId(): string;
14
+ render(): React.ReactNode;
15
+ }
@@ -0,0 +1,18 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { DataTableColumnProps, DTColumn } from './Column.types';
3
+ import type { BodyPropsInner } from '../Body/Body.types';
4
+ import type { DTUse } from '../DataTable/DataTable.types';
5
+ export type DataTableGroupProps = {
6
+ title: React.ReactNode;
7
+ borders?: 'both' | 'left' | 'right';
8
+ fixed?: 'left' | 'right';
9
+ children: Array<ReactElement<DataTableColumnProps>>;
10
+ name?: string;
11
+ columns?: DTColumn[];
12
+ };
13
+ export type GroupPropsInner = {
14
+ use: DTUse;
15
+ withConfig: boolean;
16
+ getFixedStyle: (cell: Pick<DTColumn, 'name' | 'fixed'>) => [side: 'left' | 'right', style: string | number] | [side: undefined, style: undefined];
17
+ shadowVertical?: BodyPropsInner<any, any>['shadowVertical'];
18
+ };
@@ -0,0 +1,9 @@
1
+ import { type Intergalactic } from '@semcore/core';
2
+ import type Tooltip from '@semcore/tooltip';
3
+ import type { DataTableColumnProps } from './Column.types';
4
+ import type { DataTableGroupProps } from './Group.type';
5
+ import type { DataTableHeadProps } from './Head.types';
6
+ export declare const Head: Intergalactic.Component<"div", DataTableHeadProps> & {
7
+ Column: <Tag extends "div" | typeof Tooltip = "div">(props: Intergalactic.InternalTypings.ComponentProps<Tag, "div", DataTableColumnProps, {}, []>) => Intergalactic.InternalTypings.ComponentRenderingResults;
8
+ Group: <Tag extends "div" | typeof Tooltip = "div">(props: Intergalactic.InternalTypings.ComponentProps<Tag, "div", DataTableGroupProps, {}, []>) => Intergalactic.InternalTypings.ComponentRenderingResults;
9
+ };
@@ -0,0 +1,58 @@
1
+ import type { ColumnPropsInner, DTColumn } from './Column.types';
2
+ import type { ISelectedRows } from '../../store/SelectableRows';
3
+ import type { BodyPropsInner } from '../Body/Body.types';
4
+ import type { DataTableCellProps } from '../Body/Cell.types';
5
+ import type { DTRow } from '../Body/Row.types';
6
+ import type { ROW_GROUP } from '../DataTable/DataTable';
7
+ import type { DataTableData, DataTableProps, DTUse } from '../DataTable/DataTable.types';
8
+ export type DataTableHeadProps = {
9
+ /**
10
+ * Sticky header
11
+ * @default false
12
+ */
13
+ sticky?: boolean;
14
+ /**
15
+ * offset for sticky header
16
+ */
17
+ top?: number;
18
+ /**
19
+ * Height of header in px
20
+ */
21
+ h?: number;
22
+ /** Enable scroll bar element in header */
23
+ withScrollBar?: boolean;
24
+ /** Animation duration for a top property. When it's set adds animation for top changes */
25
+ animationDuration?: number;
26
+ /** Outer ref for the header */
27
+ ref?: React.Ref<HTMLDivElement>;
28
+ };
29
+ export type HeadPropsInner<Data extends DataTableData, UniqKey extends (Data[number] extends {
30
+ [ROW_GROUP]: DataTableData;
31
+ } ? keyof Data[number][typeof ROW_GROUP][number] : keyof Data[number]), UniqKeyType extends (Data[number] extends {
32
+ [ROW_GROUP]: DataTableData;
33
+ } ? Data[number][typeof ROW_GROUP][number][UniqKey] : Data[number][UniqKey])> = {
34
+ use: DTUse;
35
+ tableRef: React.RefObject<HTMLElement>;
36
+ columns: DTColumn[];
37
+ treeColumns: DTColumn[];
38
+ compact: boolean;
39
+ sort?: DataTableProps<Data, UniqKey, UniqKeyType>['sort'];
40
+ onSortChange?: DataTableProps<Data, UniqKey, UniqKeyType>['onSortChange'];
41
+ getI18nText: (key: string) => string;
42
+ uid: string;
43
+ ref: React.Ref<HTMLDivElement>;
44
+ gridAreaGroupMap: Map<number, string>;
45
+ gridTemplateColumns: string[];
46
+ gridTemplateAreas: string[];
47
+ sideIndents?: 'wide';
48
+ totalRows: number;
49
+ selectedRows?: UniqKeyType[] | ISelectedRows<UniqKeyType>;
50
+ onChangeSelectAll?: (selectedRows: UniqKeyType[], event?: React.SyntheticEvent<HTMLElement>) => void;
51
+ flatRows: DTRow<UniqKeyType>[];
52
+ getFixedStyle: (cell: Pick<DTColumn, 'name' | 'fixed'>) => [side: 'left' | 'right', style: string | number] | [side: undefined, style: undefined];
53
+ onCellClick: DataTableCellProps<Data, UniqKeyType>['onClick'];
54
+ shadowVertical?: BodyPropsInner<Data, UniqKeyType>['shadowVertical'];
55
+ scrollDirection?: ColumnPropsInner<Data, UniqKey, UniqKeyType>['scrollDirection'];
56
+ isDataEmpty: boolean;
57
+ withAnimation: boolean;
58
+ };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { ISelectedRows } from '../../store/SelectableRows';
3
+ import type { Theme } from '../Body/Cell.types';
4
+ import type { DTRow } from '../Body/Row.types';
5
+ type RowSelectorProps<UniqKeyType> = {
6
+ row: DTRow<UniqKeyType>;
7
+ rowIndex: number;
8
+ gridRowIndex: number;
9
+ expanded: boolean;
10
+ withAccordion: boolean;
11
+ uid: string;
12
+ theme?: Theme;
13
+ isCellHidden?: boolean;
14
+ isAccordionRow?: boolean;
15
+ selectedRows?: UniqKeyType[] | ISelectedRows<UniqKeyType>;
16
+ onSelectRow?: (isSelect: boolean, selectedRowIndex: number, row: DTRow<UniqKeyType>, event?: React.SyntheticEvent<HTMLElement>) => void;
17
+ fixed?: boolean;
18
+ };
19
+ type State = {
20
+ checked: boolean;
21
+ };
22
+ export declare class RowSelector<UniqKeyType> extends React.PureComponent<RowSelectorProps<UniqKeyType>, State> {
23
+ state: State;
24
+ private unsubscribeToggle;
25
+ constructor(props: RowSelectorProps<UniqKeyType>);
26
+ componentDidMount(): void;
27
+ componentWillUnmount(): void;
28
+ handleSelectRow: (value: boolean, event?: React.SyntheticEvent<HTMLElement>) => void;
29
+ handleClickCheckbox: (value: boolean) => (event?: React.SyntheticEvent<HTMLElement>) => void;
30
+ render(): React.JSX.Element;
31
+ }
32
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { DTRow } from '../Body/Row.types';
3
+ type Props<UniqKey> = {
4
+ selectedRows: Array<UniqKey>;
5
+ getI18nText: (key: string) => string;
6
+ flatRows: DTRow<UniqKey>[];
7
+ data: unknown[];
8
+ };
9
+ export declare function SRAnnouncer<UniqKey>(props: Props<UniqKey>): React.JSX.Element;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ISelectedRows } from '../../store/SelectableRows';
3
+ type Props<UniqKey> = {
4
+ selectedRows: ISelectedRows<UniqKey>;
5
+ getI18nText: (key: string) => string;
6
+ };
7
+ export declare function SRReactiveAnnouncer<UniqKey>(props: Props<UniqKey>): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import type * as React from 'react';
2
+ export type LockedCell = [HTMLElement | null, boolean];
3
+ export declare function handleFocusCell(lockedCell: LockedCell, target: Element, currentTarget: Element): void;
4
+ export declare function handleKeydownFocusCell(lockedCell: LockedCell, e: React.KeyboardEvent): void;
5
+ export interface IFocusableCell {
6
+ lockedCell: LockedCell;
7
+ handleFocusableCellKeyDown: (e: React.KeyboardEvent) => void;
8
+ handleFocusableCellFocus: (e: React.FocusEvent<HTMLElement, HTMLElement>) => void;
9
+ }
@@ -1,2 +1,10 @@
1
- export { default } from './DataTable';
2
- export * from './DataTable';
1
+ import type { Intergalactic } from '@semcore/core';
2
+ import type React from 'react';
3
+ import type { CellRenderProps } from './components/Body/Body.types';
4
+ import { MergedRowsCell, MergedColumnsCell } from './components/Body/MergedCells';
5
+ import { DataTable, ACCORDION, ROW_GROUP } from './components/DataTable/DataTable';
6
+ import type { DataTableSort, DataTableType, DataTableData, DataTableProps, DataTableChangeSort, ColumnGroupConfig, ColumnItemConfig } from './components/DataTable/DataTable.types';
7
+ import { SelectableRows } from './store/SelectableRows';
8
+ declare const wrapDataTable: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<DataTableType>> & PropsExtending) => React.ReactNode) => DataTableType;
9
+ export { MergedRowsCell, MergedColumnsCell, DataTable, ACCORDION, ROW_GROUP, wrapDataTable, SelectableRows, };
10
+ export type { DataTableSort, DataTableData, DataTableProps, DataTableChangeSort, ColumnGroupConfig, ColumnItemConfig, CellRenderProps, };
@@ -0,0 +1,60 @@
1
+ import EventEmitter from '@semcore/core/lib/utils/eventEmitter';
2
+ import type { DTRow } from '../components/Body/Row.types';
3
+ export interface ISelectedRows<UniqKeyType> {
4
+ /** Flag for multiple rows selection */
5
+ isPressedShift: boolean;
6
+ /** Method for set keys from data. Call it in DataTable, on data changes */
7
+ setAvailableKeys(keys: UniqKeyType[]): void;
8
+ /** Get the list of keys */
9
+ get(): UniqKeyType[];
10
+ /** Check if the row is selected */
11
+ isChecked(key: UniqKeyType): boolean;
12
+ /** Replace the list of keys. */
13
+ replace(value: UniqKeyType[]): void;
14
+ /** Check if the key exists in selected rows */
15
+ has(value: UniqKeyType): boolean;
16
+ /** Select all handler */
17
+ selectAll(): void;
18
+ /** Clear all handler */
19
+ clearAll(): void;
20
+ /** Clear all available values (rows on current page) handler */
21
+ clearAllAvailable(): void;
22
+ /** Toggle selection of row */
23
+ toggle(selected: boolean, row: DTRow<UniqKeyType>): void;
24
+ /** Check if all rows selected */
25
+ isAllSelected(): boolean;
26
+ /** Check if at least one row selected */
27
+ isIndeterminate(): boolean;
28
+ /** Subscribe to changes */
29
+ on: EventEmitter<Events<UniqKeyType>>['on'];
30
+ /** Unsubscribe to changes */
31
+ off: EventEmitter<Events<UniqKeyType>>['off'];
32
+ }
33
+ type Events<UniqRowKeyType> = {
34
+ [SelectableRows.TOGGLE_EVENT]: (val: UniqRowKeyType) => void;
35
+ [SelectableRows.SELECT_ALL_EVENT]: () => void;
36
+ [SelectableRows.SET_INDETERMINATE_EVENT]: () => void;
37
+ };
38
+ export declare class SelectableRows<UniqRowKeyType> extends EventEmitter<Events<UniqRowKeyType>> implements ISelectedRows<UniqRowKeyType> {
39
+ private readonly values;
40
+ private availableKeys;
41
+ private lastSelectedRow;
42
+ static TOGGLE_EVENT: "toggle_selected_row";
43
+ static SELECT_ALL_EVENT: "select_all_selected_rows";
44
+ static SET_INDETERMINATE_EVENT: "set_indeterminate";
45
+ isPressedShift: boolean;
46
+ constructor(initValues?: UniqRowKeyType[]);
47
+ setAvailableKeys(value: UniqRowKeyType[]): void;
48
+ get(): UniqRowKeyType[];
49
+ isChecked(key: UniqRowKeyType): boolean;
50
+ replace(value: UniqRowKeyType[]): void;
51
+ has(value: UniqRowKeyType): boolean;
52
+ isAllSelected(): boolean;
53
+ isIndeterminate(): boolean;
54
+ selectAll(): void;
55
+ clearAll(): void;
56
+ clearAllAvailable(): void;
57
+ toggle(selected: boolean, row: DTRow<UniqRowKeyType>): void;
58
+ private toggleOneRow;
59
+ }
60
+ export {};
@@ -1,44 +1,114 @@
1
1
  export declare const localizedMessages: {
2
2
  de: {
3
3
  sortableColumn: string;
4
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
5
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
6
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
7
+ "DataTable.allItemsSelected:aria-live": string;
8
+ "DataTable.allItemsDeselected:aria-live": string;
4
9
  };
5
10
  en: {
6
11
  sortableColumn: string;
12
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
13
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
14
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
15
+ "DataTable.allItemsSelected:aria-live": string;
16
+ "DataTable.allItemsDeselected:aria-live": string;
7
17
  };
8
18
  es: {
9
19
  sortableColumn: string;
20
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
21
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
22
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
23
+ "DataTable.allItemsSelected:aria-live": string;
24
+ "DataTable.allItemsDeselected:aria-live": string;
10
25
  };
11
26
  fr: {
12
27
  sortableColumn: string;
28
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
29
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
30
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
31
+ "DataTable.allItemsSelected:aria-live": string;
32
+ "DataTable.allItemsDeselected:aria-live": string;
13
33
  };
14
34
  it: {
15
35
  sortableColumn: string;
36
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
37
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
38
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
39
+ "DataTable.allItemsSelected:aria-live": string;
40
+ "DataTable.allItemsDeselected:aria-live": string;
16
41
  };
17
42
  ja: {
18
43
  sortableColumn: string;
44
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
45
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
46
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
47
+ "DataTable.allItemsSelected:aria-live": string;
48
+ "DataTable.allItemsDeselected:aria-live": string;
19
49
  };
20
50
  ko: {
21
51
  sortableColumn: string;
52
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
53
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
54
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
55
+ "DataTable.allItemsSelected:aria-live": string;
56
+ "DataTable.allItemsDeselected:aria-live": string;
22
57
  };
23
58
  nl: {
24
59
  sortableColumn: string;
60
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
61
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
62
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
63
+ "DataTable.allItemsSelected:aria-live": string;
64
+ "DataTable.allItemsDeselected:aria-live": string;
25
65
  };
26
66
  pt: {
27
67
  sortableColumn: string;
68
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
69
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
70
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
71
+ "DataTable.allItemsSelected:aria-live": string;
72
+ "DataTable.allItemsDeselected:aria-live": string;
28
73
  };
29
74
  tr: {
30
75
  sortableColumn: string;
76
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
77
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
78
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
79
+ "DataTable.allItemsSelected:aria-live": string;
80
+ "DataTable.allItemsDeselected:aria-live": string;
31
81
  };
32
82
  vi: {
33
83
  sortableColumn: string;
84
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
85
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
86
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
87
+ "DataTable.allItemsSelected:aria-live": string;
88
+ "DataTable.allItemsDeselected:aria-live": string;
34
89
  };
35
90
  zh: {
36
91
  sortableColumn: string;
92
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
93
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
94
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
95
+ "DataTable.allItemsSelected:aria-live": string;
96
+ "DataTable.allItemsDeselected:aria-live": string;
37
97
  };
38
98
  pl: {
39
99
  sortableColumn: string;
100
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
101
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
102
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
103
+ "DataTable.allItemsSelected:aria-live": string;
104
+ "DataTable.allItemsDeselected:aria-live": string;
40
105
  };
41
106
  sv: {
42
107
  sortableColumn: string;
108
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
109
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
110
+ "DataTable.Header.selectAllCheckbox:aria-label": string;
111
+ "DataTable.allItemsSelected:aria-live": string;
112
+ "DataTable.allItemsDeselected:aria-live": string;
43
113
  };
44
114
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/data-table",
3
3
  "description": "Semrush DataTable Component",
4
- "version": "4.50.2-prerelease.0",
4
+ "version": "4.51.0-prerelease.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,10 +14,10 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/flex-box": "5.41.4-prerelease.0",
18
- "@semcore/icon": "4.62.1-prerelease.0",
19
- "@semcore/scroll-area": "5.45.4-prerelease.0",
20
- "@semcore/utils": "4.48.5-prerelease.0"
17
+ "@semcore/flex-box": "5.42.0-prerelease.0",
18
+ "@semcore/icon": "4.63.0-prerelease.0",
19
+ "@semcore/scroll-area": "5.46.0-prerelease.0",
20
+ "@semcore/utils": "4.49.0-prerelease.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/react": "18.0.21",
@@ -37,7 +37,7 @@
37
37
  "csstype": "3.0.8"
38
38
  },
39
39
  "peerDependencies": {
40
- "@semcore/core": "^2.39.4-prerelease.0",
40
+ "@semcore/core": "^2.40.0-prerelease.0",
41
41
  "react": "16.8 - 18",
42
42
  "react-dom": "16.8 - 18"
43
43
  },