@semcore/data-table 16.0.0-prerelease.13 → 16.0.0-prerelease.14

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 (151) hide show
  1. package/lib/cjs/Body.js +476 -0
  2. package/lib/cjs/Body.js.map +1 -0
  3. package/lib/cjs/DataTable.js +622 -0
  4. package/lib/cjs/DataTable.js.map +1 -0
  5. package/lib/cjs/Head.js +399 -0
  6. package/lib/cjs/Head.js.map +1 -0
  7. package/lib/cjs/components/Body/Body.js +216 -0
  8. package/lib/cjs/components/Body/Body.js.map +1 -0
  9. package/lib/cjs/components/Body/Body.types.js +2 -0
  10. package/lib/cjs/components/Body/Body.types.js.map +1 -0
  11. package/lib/cjs/components/Body/Cell.js +133 -0
  12. package/lib/cjs/components/Body/Cell.js.map +1 -0
  13. package/lib/cjs/components/Body/Cell.types.js +2 -0
  14. package/lib/cjs/components/Body/Cell.types.js.map +1 -0
  15. package/lib/cjs/components/Body/MergedCells.js +27 -0
  16. package/lib/cjs/components/Body/MergedCells.js.map +1 -0
  17. package/lib/cjs/components/Body/Row.js +212 -0
  18. package/lib/cjs/components/Body/Row.js.map +1 -0
  19. package/lib/cjs/components/Body/Row.types.js +2 -0
  20. package/lib/cjs/components/Body/Row.types.js.map +1 -0
  21. package/lib/cjs/components/Body/style.shadow.css +190 -0
  22. package/lib/cjs/components/DataTable/DataTable.js +565 -0
  23. package/lib/cjs/components/DataTable/DataTable.js.map +1 -0
  24. package/lib/cjs/components/DataTable/DataTable.types.js +2 -0
  25. package/lib/cjs/components/DataTable/DataTable.types.js.map +1 -0
  26. package/lib/cjs/components/DataTable/dataTable.shadow.css +14 -0
  27. package/lib/cjs/components/Head/Column.js +277 -0
  28. package/lib/cjs/components/Head/Column.js.map +1 -0
  29. package/lib/cjs/components/Head/Column.types.js +2 -0
  30. package/lib/cjs/components/Head/Column.types.js.map +1 -0
  31. package/lib/cjs/components/Head/Group.js +98 -0
  32. package/lib/cjs/components/Head/Group.js.map +1 -0
  33. package/lib/cjs/components/Head/Group.type.js +2 -0
  34. package/lib/cjs/components/Head/Group.type.js.map +1 -0
  35. package/lib/cjs/components/Head/Head.js +152 -0
  36. package/lib/cjs/components/Head/Head.js.map +1 -0
  37. package/lib/cjs/components/Head/Head.types.js +2 -0
  38. package/lib/cjs/components/Head/Head.types.js.map +1 -0
  39. package/lib/cjs/components/Head/style.shadow.css +165 -0
  40. package/lib/cjs/index.js +42 -0
  41. package/lib/cjs/index.js.map +1 -0
  42. package/lib/cjs/style/data-table.shadow.css +394 -0
  43. package/lib/cjs/style/scroll-shadows.shadow.css +11 -0
  44. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +39 -0
  45. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -0
  46. package/lib/cjs/translations/de.json +3 -0
  47. package/lib/cjs/translations/en.json +5 -0
  48. package/lib/cjs/translations/es.json +3 -0
  49. package/lib/cjs/translations/fr.json +3 -0
  50. package/lib/cjs/translations/it.json +3 -0
  51. package/lib/cjs/translations/ja.json +3 -0
  52. package/lib/cjs/translations/ko.json +3 -0
  53. package/lib/cjs/translations/nl.json +3 -0
  54. package/lib/cjs/translations/pl.json +3 -0
  55. package/lib/cjs/translations/pt.json +3 -0
  56. package/lib/cjs/translations/sv.json +3 -0
  57. package/lib/cjs/translations/tr.json +3 -0
  58. package/lib/cjs/translations/vi.json +3 -0
  59. package/lib/cjs/translations/zh.json +3 -0
  60. package/lib/cjs/types.js +4 -0
  61. package/lib/cjs/types.js.map +1 -0
  62. package/lib/cjs/utils.js +66 -0
  63. package/lib/cjs/utils.js.map +1 -0
  64. package/lib/es6/Body.js +469 -0
  65. package/lib/es6/Body.js.map +1 -0
  66. package/lib/es6/DataTable.js +614 -0
  67. package/lib/es6/DataTable.js.map +1 -0
  68. package/lib/es6/Head.js +391 -0
  69. package/lib/es6/Head.js.map +1 -0
  70. package/lib/es6/components/Body/Body.js +209 -0
  71. package/lib/es6/components/Body/Body.js.map +1 -0
  72. package/lib/es6/components/Body/Body.types.js +2 -0
  73. package/lib/es6/components/Body/Body.types.js.map +1 -0
  74. package/lib/es6/components/Body/Cell.js +126 -0
  75. package/lib/es6/components/Body/Cell.js.map +1 -0
  76. package/lib/es6/components/Body/Cell.types.js +2 -0
  77. package/lib/es6/components/Body/Cell.types.js.map +1 -0
  78. package/lib/es6/components/Body/MergedCells.js +18 -0
  79. package/lib/es6/components/Body/MergedCells.js.map +1 -0
  80. package/lib/es6/components/Body/Row.js +205 -0
  81. package/lib/es6/components/Body/Row.js.map +1 -0
  82. package/lib/es6/components/Body/Row.types.js +2 -0
  83. package/lib/es6/components/Body/Row.types.js.map +1 -0
  84. package/lib/es6/components/Body/style.shadow.css +190 -0
  85. package/lib/es6/components/DataTable/DataTable.js +558 -0
  86. package/lib/es6/components/DataTable/DataTable.js.map +1 -0
  87. package/lib/es6/components/DataTable/DataTable.types.js +2 -0
  88. package/lib/es6/components/DataTable/DataTable.types.js.map +1 -0
  89. package/lib/es6/components/DataTable/dataTable.shadow.css +14 -0
  90. package/lib/es6/components/Head/Column.js +270 -0
  91. package/lib/es6/components/Head/Column.js.map +1 -0
  92. package/lib/es6/components/Head/Column.types.js +2 -0
  93. package/lib/es6/components/Head/Column.types.js.map +1 -0
  94. package/lib/es6/components/Head/Group.js +91 -0
  95. package/lib/es6/components/Head/Group.js.map +1 -0
  96. package/lib/es6/components/Head/Group.type.js +2 -0
  97. package/lib/es6/components/Head/Group.type.js.map +1 -0
  98. package/lib/es6/components/Head/Head.js +145 -0
  99. package/lib/es6/components/Head/Head.js.map +1 -0
  100. package/lib/es6/components/Head/Head.types.js +2 -0
  101. package/lib/es6/components/Head/Head.types.js.map +1 -0
  102. package/lib/es6/components/Head/style.shadow.css +165 -0
  103. package/lib/es6/index.js +5 -0
  104. package/lib/es6/index.js.map +1 -0
  105. package/lib/es6/style/data-table.shadow.css +394 -0
  106. package/lib/es6/style/scroll-shadows.shadow.css +11 -0
  107. package/lib/es6/translations/__intergalactic-dynamic-locales.js +31 -0
  108. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -0
  109. package/lib/es6/translations/de.json +3 -0
  110. package/lib/es6/translations/en.json +5 -0
  111. package/lib/es6/translations/es.json +3 -0
  112. package/lib/es6/translations/fr.json +3 -0
  113. package/lib/es6/translations/it.json +3 -0
  114. package/lib/es6/translations/ja.json +3 -0
  115. package/lib/es6/translations/ko.json +3 -0
  116. package/lib/es6/translations/nl.json +3 -0
  117. package/lib/es6/translations/pl.json +3 -0
  118. package/lib/es6/translations/pt.json +3 -0
  119. package/lib/es6/translations/sv.json +3 -0
  120. package/lib/es6/translations/tr.json +3 -0
  121. package/lib/es6/translations/vi.json +3 -0
  122. package/lib/es6/translations/zh.json +3 -0
  123. package/lib/es6/types.js +2 -0
  124. package/lib/es6/types.js.map +1 -0
  125. package/lib/es6/utils.js +56 -0
  126. package/lib/es6/utils.js.map +1 -0
  127. package/lib/esm/components/Body/Body.mjs +1 -1
  128. package/lib/esm/components/Body/Row.mjs +1 -1
  129. package/lib/types/Body.d.ts +61 -0
  130. package/lib/types/DataTable.d.ts +205 -0
  131. package/lib/types/Head.d.ts +45 -0
  132. package/lib/types/components/Body/Body.d.ts +8 -0
  133. package/lib/types/components/Body/Body.types.d.ts +31 -0
  134. package/lib/types/components/Body/Cell.d.ts +3 -0
  135. package/lib/types/components/Body/Cell.types.d.ts +14 -0
  136. package/lib/types/components/Body/MergedCells.d.ts +10 -0
  137. package/lib/types/components/Body/Row.d.ts +3 -0
  138. package/lib/types/components/Body/Row.types.d.ts +24 -0
  139. package/lib/types/components/DataTable/DataTable.d.ts +9 -0
  140. package/lib/types/components/DataTable/DataTable.types.d.ts +50 -0
  141. package/lib/types/components/Head/Column.d.ts +26 -0
  142. package/lib/types/components/Head/Column.types.d.ts +80 -0
  143. package/lib/types/components/Head/Group.d.ts +12 -0
  144. package/lib/types/components/Head/Group.type.d.ts +10 -0
  145. package/lib/types/components/Head/Head.d.ts +8 -0
  146. package/lib/types/components/Head/Head.types.d.ts +26 -0
  147. package/lib/types/index.d.ts +4 -0
  148. package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +46 -0
  149. package/lib/types/types.d.ts +73 -0
  150. package/lib/types/utils.d.ts +8 -0
  151. package/package.json +7 -6
@@ -0,0 +1,80 @@
1
+ /// <reference types="react" />
2
+ import { DataTableProps, DTUse } from '../DataTable/DataTable.types';
3
+ import { Property } from 'csstype';
4
+ export type CommonColumnType = {
5
+ /**
6
+ * Name of column for mapping with data
7
+ */
8
+ name: string;
9
+ /**
10
+ * Flag to define column as sortable
11
+ */
12
+ sortable?: boolean;
13
+ /**
14
+ * Fixes column to some side of table
15
+ */
16
+ fixed?: 'left' | 'right';
17
+ /**
18
+ * Adds vertical border(s)
19
+ */
20
+ borders?: 'both' | 'left' | 'right';
21
+ /**
22
+ * It manages the `flex-wrap` property
23
+ */
24
+ flexWrap?: boolean;
25
+ /**
26
+ * It manages the `align-items` property
27
+ */
28
+ alignItems?: Property.AlignItems;
29
+ /**
30
+ * It manages the `align-content` property
31
+ */
32
+ alignContent?: Property.AlignContent;
33
+ /**
34
+ * CSS `justify-content` property
35
+ */
36
+ justifyContent?: Property.JustifyContent;
37
+ };
38
+ export type DTColumn = CommonColumnType & {
39
+ ref: React.RefCallback<HTMLElement> & {
40
+ current: HTMLElement | null;
41
+ };
42
+ /**
43
+ * Width for grid-template-columns
44
+ */
45
+ gridColumnWidth: string;
46
+ /**
47
+ * Width of column by getBoundaryRect() value
48
+ */
49
+ calculatedWidth: number;
50
+ /**
51
+ * Height of column by getBoundaryRect() value
52
+ */
53
+ calculatedHeight: number;
54
+ parent?: DTColumn;
55
+ gridArea?: string;
56
+ };
57
+ export type DataTableColumnProps = CommonColumnType & {
58
+ /**
59
+ * Value for grid-template-columns for current column
60
+ */
61
+ gtcWidth?: string;
62
+ /**
63
+ * Flag for change column size if sorted by it
64
+ */
65
+ changeSortSize?: boolean;
66
+ children?: React.ReactElement[];
67
+ };
68
+ export type ColumnPropsInner = {
69
+ use: DTUse;
70
+ borders?: 'both' | 'left' | 'right';
71
+ sort?: DataTableProps['sort'];
72
+ onSortChange?: DataTableProps['onSortChange'];
73
+ uid: string;
74
+ parent?: DTColumn;
75
+ sortableColumnDescribeId: string;
76
+ columnIndex: number;
77
+ tableRef: React.RefObject<HTMLElement>;
78
+ gridTemplateColumns: string[];
79
+ gridTemplateAreas: string[];
80
+ };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { Component } from '@semcore/core';
3
+ import { DataTableGroupProps, GroupPropsInner } from './Group.type';
4
+ export declare class Group extends Component<DataTableGroupProps, {}, {}, [], GroupPropsInner> {
5
+ static displayName: string;
6
+ static style: {
7
+ [key: string]: string;
8
+ };
9
+ mounted: boolean;
10
+ componentDidMount(): void;
11
+ render(): React.ReactNode;
12
+ }
@@ -0,0 +1,10 @@
1
+ import { DTUse } from '../DataTable/DataTable.types';
2
+ export type DataTableGroupProps = {
3
+ title: string;
4
+ borders?: 'both' | 'left' | 'right';
5
+ fixed?: 'left' | 'right';
6
+ };
7
+ export type GroupPropsInner = {
8
+ use: DTUse;
9
+ fixedColumnsMap: Map<string, any>;
10
+ };
@@ -0,0 +1,8 @@
1
+ import { Component, Intergalactic } from '@semcore/core';
2
+ import { DataTableHeadProps } from './Head.types';
3
+ import { DataTableColumnProps } from './Column.types';
4
+ import { DataTableGroupProps } from './Group.type';
5
+ export declare const Head: (<Tag extends Intergalactic.InternalTypings.ComponentTag = "div", Props extends DataTableHeadProps = DataTableHeadProps>(props: Intergalactic.InternalTypings.ComponentProps<Tag, "div", Props, {}, never[]>) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<"div", Intergalactic.InternalTypings.ComponentTag, DataTableHeadProps, {}, never[]> & {
6
+ Column: Intergalactic.Component<'div', DataTableColumnProps>;
7
+ Group: Intergalactic.Component<'div', DataTableGroupProps>;
8
+ };
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { DataTableProps, DTUse } from '../DataTable/DataTable.types';
3
+ import { DTColumn } from './Column.types';
4
+ export type DataTableHeadProps = {
5
+ /**
6
+ * Sticky header
7
+ * @default false
8
+ */
9
+ sticky?: boolean;
10
+ /** Enable scroll bar element in header */
11
+ withScrollBar?: boolean;
12
+ };
13
+ export type HeadPropsInner = {
14
+ use: DTUse;
15
+ tableRef: React.RefObject<HTMLElement>;
16
+ columns: DTColumn[];
17
+ compact: boolean;
18
+ sort?: DataTableProps['sort'];
19
+ onSortChange?: DataTableProps['onSortChange'];
20
+ getI18nText: (key: string) => string;
21
+ uid: string;
22
+ ref: React.RefObject<HTMLDivElement>;
23
+ gridAreaGroupMap: Map<number, string>;
24
+ gridTemplateColumns: string[];
25
+ gridTemplateAreas: string[];
26
+ };
@@ -0,0 +1,4 @@
1
+ import { DataTable, ACCORDION } from './components/DataTable/DataTable';
2
+ export { default } from './DataTable';
3
+ export * from './DataTable';
4
+ export { DataTable, ACCORDION };
@@ -0,0 +1,46 @@
1
+ export declare const localizedMessages: {
2
+ de: {
3
+ sortableColumn: string;
4
+ };
5
+ en: {
6
+ sortableColumn: string;
7
+ "DataTable.Cell.AccordionToggle.expand:aria-label": string;
8
+ "DataTable.Cell.AccordionToggle.collapse:aria-label": string;
9
+ };
10
+ es: {
11
+ sortableColumn: string;
12
+ };
13
+ fr: {
14
+ sortableColumn: string;
15
+ };
16
+ it: {
17
+ sortableColumn: string;
18
+ };
19
+ ja: {
20
+ sortableColumn: string;
21
+ };
22
+ ko: {
23
+ sortableColumn: string;
24
+ };
25
+ nl: {
26
+ sortableColumn: string;
27
+ };
28
+ pt: {
29
+ sortableColumn: string;
30
+ };
31
+ tr: {
32
+ sortableColumn: string;
33
+ };
34
+ vi: {
35
+ sortableColumn: string;
36
+ };
37
+ zh: {
38
+ sortableColumn: string;
39
+ };
40
+ pl: {
41
+ sortableColumn: string;
42
+ };
43
+ sv: {
44
+ sortableColumn: string;
45
+ };
46
+ };
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import { ROW_GROUP } from './DataTable';
3
+ import { Property } from 'csstype';
4
+ import { FlexProps } from '@semcore/flex-box';
5
+ export type PseudoChildPropsGetter = (props: {
6
+ [propName: string]: unknown;
7
+ }, rowData: {
8
+ [columnName: string]: unknown;
9
+ }, index: number) => {
10
+ [propName: string]: unknown;
11
+ };
12
+ export type PropsLayer = {
13
+ childrenPropsGetter?: PseudoChildPropsGetter;
14
+ [propName: string]: unknown;
15
+ };
16
+ export type SortDirection = 'asc' | 'desc';
17
+ export type Column<Props extends {
18
+ [propName: string]: unknown;
19
+ } = {
20
+ [propName: string]: unknown;
21
+ }> = {
22
+ name: string;
23
+ active: boolean;
24
+ width: number;
25
+ fixed?: 'left' | 'right';
26
+ resizable?: boolean;
27
+ sortable?: boolean | SortDirection;
28
+ sortDirection: SortDirection;
29
+ varWidth: string;
30
+ setVar: boolean;
31
+ data?: unknown;
32
+ vBorders?: boolean;
33
+ borderLeft?: boolean;
34
+ borderRight?: boolean;
35
+ props: {
36
+ name: string;
37
+ ref: React.RefObject<HTMLElement>;
38
+ } & FlexProps & Partial<{
39
+ flex: Property.Flex;
40
+ onClick: (event: React.MouseEvent) => void;
41
+ onKeyDown: (event: React.KeyboardEvent) => void;
42
+ forwardRef: React.Ref<HTMLElement>;
43
+ style: React.CSSProperties;
44
+ fixed: 'left' | 'right';
45
+ resizable: boolean;
46
+ sortable: boolean | SortDirection;
47
+ sortDirection: SortDirection;
48
+ vBorders: boolean;
49
+ borderLeft: Property.BorderLeft;
50
+ borderRight: Property.BorderLeft;
51
+ changeSortSize?: boolean;
52
+ sortSizeRecalculation?: boolean;
53
+ }> & Props;
54
+ columns: Column[];
55
+ parentColumns: Column[];
56
+ };
57
+ export type Cell = Pick<Column, 'name' | 'fixed' | 'data'> & {
58
+ cssVar: string | string[];
59
+ cellPropsLayers: PropsLayer[];
60
+ };
61
+ export type RowData<Data extends {
62
+ [columnName: string]: unknown;
63
+ } = {
64
+ [columnName: string]: unknown;
65
+ }> = Data & Partial<{
66
+ name: string;
67
+ [ROW_GROUP]: RowData[];
68
+ }>;
69
+ export type NestedCells = (Cell | NestedCells)[] & {
70
+ flatRowData?: RowData;
71
+ };
72
+ export type RowIndex = number;
73
+ export type ColIndex = number;
@@ -0,0 +1,8 @@
1
+ import type { DTColumn } from './components/Head/Column.types';
2
+ export declare const getScrollOffsetValue: (columns: DTColumn[]) => [leftOffset: number, rightOffset: number];
3
+ export declare const createCssVarForWidth: (name: string) => string;
4
+ /**
5
+ * todo: Remove after v16
6
+ */
7
+ export declare const flattenColumns: (columns: any[]) => any;
8
+ export declare const getFixedStyle: (cell: Pick<DTColumn, 'name' | 'fixed'>, columns: DTColumn[]) => [side: "left" | "right", style: string | number] | [side: undefined, style: undefined];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/data-table",
3
3
  "description": "Semrush DataTable Component",
4
- "version": "16.0.0-prerelease.13",
4
+ "version": "16.0.0-prerelease.14",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,9 +14,10 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/icon": "16.0.0-prerelease.13",
18
- "@semcore/flex-box": "16.0.0-prerelease.13",
19
- "@semcore/scroll-area": "16.0.0-prerelease.13"
17
+ "@semcore/icon": "16.0.0-prerelease.14",
18
+ "@semcore/button": "16.0.0-prerelease.14",
19
+ "@semcore/flex-box": "16.0.0-prerelease.14",
20
+ "@semcore/scroll-area": "16.0.0-prerelease.14"
20
21
  },
21
22
  "devDependencies": {
22
23
  "@types/react": "18.0.21",
@@ -36,7 +37,7 @@
36
37
  "csstype": "3.0.8"
37
38
  },
38
39
  "peerDependencies": {
39
- "@semcore/base-components": "^16.0.0-prerelease.13"
40
+ "@semcore/base-components": "^16.0.0-prerelease.14"
40
41
  },
41
42
  "repository": {
42
43
  "type": "git",
@@ -44,6 +45,6 @@
44
45
  "directory": "semcore/data-table"
45
46
  },
46
47
  "scripts": {
47
- "build": "pnpm vite build"
48
+ "build": "pnpm semcore-builder && pnpm vite build"
48
49
  }
49
50
  }