@cloud-ru/ds-table 1.0.2-preview-ad4a761f.0 → 1.0.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.
- package/CHANGELOG.md +4 -0
- package/README.md +3 -3
- package/dist/cjs/components/Table/Table.js +4 -12
- package/dist/cjs/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.d.ts +0 -2
- package/dist/cjs/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.js +3 -20
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.d.ts +2 -2
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.js +2 -2
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/index.d.ts +0 -1
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/index.js +0 -1
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +4 -3
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +15 -3
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +2 -4
- package/dist/cjs/components/Table/hooks/useTableScroll.js +1 -15
- package/dist/cjs/components/Table/styles.module.css +1 -19
- package/dist/cjs/components/Table/utils/index.d.ts +0 -1
- package/dist/cjs/components/Table/utils/index.js +0 -1
- package/dist/cjs/constants.d.ts +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/helperComponents/Cells/BodyCell/BodyCell.d.ts +1 -3
- package/dist/cjs/helperComponents/Cells/BodyCell/BodyCell.js +10 -9
- package/dist/cjs/helperComponents/Cells/HeaderCell/HeaderCell.js +6 -7
- package/dist/cjs/helperComponents/Cells/HeaderCell/ResizeHandle.js +1 -1
- package/dist/cjs/helperComponents/Cells/styles.module.css +0 -3
- package/dist/cjs/helperComponents/Rows/BodyRow.js +2 -1
- package/dist/cjs/helperComponents/Rows/styles.module.css +0 -4
- package/dist/cjs/helperComponents/TableEmptyState/hooks.js +1 -0
- package/dist/cjs/helperComponents/TableEmptyState/styles.module.css +1 -3
- package/dist/cjs/hooks/index.d.ts +0 -1
- package/dist/cjs/hooks/index.js +0 -1
- package/dist/cjs/hooks/useCellSizes.d.ts +1 -0
- package/dist/cjs/hooks/useCellSizes.js +4 -1
- package/dist/cjs/locale/index.d.ts +4 -0
- package/dist/cjs/locale/index.js +2 -0
- package/dist/cjs/style.css +2 -29
- package/dist/cjs/types.d.ts +0 -1
- package/dist/esm/components/Table/Table.js +7 -15
- package/dist/esm/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.d.ts +0 -2
- package/dist/esm/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.js +4 -21
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.d.ts +2 -2
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.js +2 -2
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/index.d.ts +0 -1
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/index.js +0 -1
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +4 -3
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +15 -3
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +2 -4
- package/dist/esm/components/Table/hooks/useTableScroll.js +1 -15
- package/dist/esm/components/Table/styles.module.css +1 -19
- package/dist/esm/components/Table/utils/index.d.ts +0 -1
- package/dist/esm/components/Table/utils/index.js +0 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/helperComponents/Cells/BodyCell/BodyCell.d.ts +1 -3
- package/dist/esm/helperComponents/Cells/BodyCell/BodyCell.js +11 -10
- package/dist/esm/helperComponents/Cells/HeaderCell/HeaderCell.js +6 -7
- package/dist/esm/helperComponents/Cells/HeaderCell/ResizeHandle.js +1 -1
- package/dist/esm/helperComponents/Cells/styles.module.css +0 -3
- package/dist/esm/helperComponents/Rows/BodyRow.js +2 -1
- package/dist/esm/helperComponents/Rows/styles.module.css +0 -4
- package/dist/esm/helperComponents/TableEmptyState/hooks.js +1 -0
- package/dist/esm/helperComponents/TableEmptyState/styles.module.css +1 -3
- package/dist/esm/hooks/index.d.ts +0 -1
- package/dist/esm/hooks/index.js +0 -1
- package/dist/esm/hooks/useCellSizes.d.ts +1 -0
- package/dist/esm/hooks/useCellSizes.js +4 -1
- package/dist/esm/locale/index.d.ts +4 -0
- package/dist/esm/locale/index.js +2 -0
- package/dist/esm/style.css +2 -29
- package/dist/esm/types.d.ts +0 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +20 -21
- package/src/components/Table/Table.tsx +26 -53
- package/src/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.ts +7 -31
- package/src/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.ts +2 -2
- package/src/components/Table/hooks/useColumnSettings/utils/index.ts +0 -1
- package/src/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.ts +5 -3
- package/src/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.ts +18 -3
- package/src/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.ts +2 -4
- package/src/components/Table/hooks/useTableScroll.ts +1 -21
- package/src/components/Table/styles.module.scss +1 -23
- package/src/components/Table/utils/index.ts +0 -1
- package/src/constants.ts +1 -1
- package/src/helperComponents/Cells/BodyCell/BodyCell.tsx +15 -18
- package/src/helperComponents/Cells/HeaderCell/HeaderCell.tsx +7 -10
- package/src/helperComponents/Cells/HeaderCell/ResizeHandle.tsx +2 -1
- package/src/helperComponents/Cells/styles.module.scss +0 -11
- package/src/helperComponents/Rows/BodyRow.tsx +10 -9
- package/src/helperComponents/Rows/styles.module.scss +0 -5
- package/src/helperComponents/TableEmptyState/hooks.ts +1 -0
- package/src/helperComponents/TableEmptyState/styles.module.scss +1 -5
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useCellSizes.ts +5 -1
- package/src/locale/index.ts +2 -0
- package/src/types.ts +5 -3
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.d.ts +0 -8
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.js +0 -15
- package/dist/cjs/components/Table/utils/alignOverlayToHeader.d.ts +0 -6
- package/dist/cjs/components/Table/utils/alignOverlayToHeader.js +0 -28
- package/dist/cjs/hooks/useColumnDragTransform.d.ts +0 -15
- package/dist/cjs/hooks/useColumnDragTransform.js +0 -38
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.d.ts +0 -8
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.js +0 -11
- package/dist/esm/components/Table/utils/alignOverlayToHeader.d.ts +0 -6
- package/dist/esm/components/Table/utils/alignOverlayToHeader.js +0 -24
- package/dist/esm/hooks/useColumnDragTransform.d.ts +0 -15
- package/dist/esm/hooks/useColumnDragTransform.js +0 -35
- package/src/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.ts +0 -18
- package/src/components/Table/utils/alignOverlayToHeader.ts +0 -36
- package/src/hooks/useColumnDragTransform.ts +0 -52
|
@@ -7,6 +7,7 @@ export function useEmptyState({ noDataState: noDataStateProp, noResultsState: no
|
|
|
7
7
|
const noDataState = {
|
|
8
8
|
icon: { icon: SearchSVG, appearance: 'neutral', background: true },
|
|
9
9
|
title: t('noData.title'),
|
|
10
|
+
content: t('noData.content'),
|
|
10
11
|
...noDataStateProp,
|
|
11
12
|
};
|
|
12
13
|
const noResultsState = {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
.tableEmptyStateWrapper{
|
|
2
|
-
position:sticky;
|
|
3
|
-
left:0;
|
|
4
2
|
display:flex;
|
|
5
3
|
flex:1 1 auto;
|
|
6
4
|
flex-direction:column;
|
|
7
5
|
align-items:center;
|
|
8
6
|
justify-content:center;
|
|
9
7
|
box-sizing:border-box;
|
|
10
|
-
width:
|
|
8
|
+
width:100%;
|
|
11
9
|
min-height:304px;
|
|
12
10
|
padding:var(--sn-primitive-dimension-24, 24px);
|
|
13
11
|
}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Cell, Header } from '@tanstack/react-table';
|
|
|
3
3
|
import { CSSProperties } from 'react';
|
|
4
4
|
type CellSizesOptions = {
|
|
5
5
|
isDraggable?: boolean;
|
|
6
|
+
isDragging?: boolean;
|
|
6
7
|
transform?: Transform | null;
|
|
7
8
|
};
|
|
8
9
|
export declare function useCellSizes<TData>(element: Cell<TData, unknown> | Header<TData, unknown>, options?: CellSizesOptions): CSSProperties;
|
|
@@ -3,6 +3,7 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { TABLE_COLUMN_CSS_VARS } from '../constants.js';
|
|
4
4
|
export function useCellSizes(element, options) {
|
|
5
5
|
const column = element.column;
|
|
6
|
+
const isDragging = options?.isDragging ?? false;
|
|
6
7
|
const transform = options?.transform ?? null;
|
|
7
8
|
const minWidth = column.columnDef.minSize;
|
|
8
9
|
const maxWidth = column.columnDef.maxSize;
|
|
@@ -17,12 +18,14 @@ export function useCellSizes(element, options) {
|
|
|
17
18
|
flexShrink,
|
|
18
19
|
};
|
|
19
20
|
if (options?.isDraggable) {
|
|
21
|
+
styles.opacity = isDragging ? 0.8 : 1;
|
|
20
22
|
styles.position = 'relative';
|
|
21
23
|
styles.transform = CSS.Translate.toString(transform);
|
|
24
|
+
styles.zIndex = isDragging ? 1 : undefined;
|
|
22
25
|
if (isHeaderCell) {
|
|
23
26
|
styles.whiteSpace = 'nowrap';
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
return styles;
|
|
27
|
-
}, [options?.isDraggable, flexShrink, isHeaderCell, maxWidth, minWidth, transform, width]);
|
|
30
|
+
}, [options?.isDraggable, flexShrink, isDragging, isHeaderCell, maxWidth, minWidth, transform, width]);
|
|
28
31
|
}
|
|
@@ -13,6 +13,7 @@ declare const TABLE_MESSAGES: {
|
|
|
13
13
|
};
|
|
14
14
|
readonly noData: {
|
|
15
15
|
readonly title: "No data";
|
|
16
|
+
readonly content: "Try refreshing the page";
|
|
16
17
|
};
|
|
17
18
|
readonly noResults: {
|
|
18
19
|
readonly title: "Nothing found";
|
|
@@ -37,6 +38,7 @@ declare const TABLE_MESSAGES: {
|
|
|
37
38
|
};
|
|
38
39
|
readonly noData: {
|
|
39
40
|
readonly title: "Нет данных";
|
|
41
|
+
readonly content: "Обновите страницу";
|
|
40
42
|
};
|
|
41
43
|
readonly noResults: {
|
|
42
44
|
readonly title: "Ничего не найдено";
|
|
@@ -65,6 +67,7 @@ export declare const tableLocale: import("@cloud-ru/ds-locale").DefinedLocale<{
|
|
|
65
67
|
};
|
|
66
68
|
readonly noData: {
|
|
67
69
|
readonly title: "No data";
|
|
70
|
+
readonly content: "Try refreshing the page";
|
|
68
71
|
};
|
|
69
72
|
readonly noResults: {
|
|
70
73
|
readonly title: "Nothing found";
|
|
@@ -89,6 +92,7 @@ export declare const tableLocale: import("@cloud-ru/ds-locale").DefinedLocale<{
|
|
|
89
92
|
};
|
|
90
93
|
readonly noData: {
|
|
91
94
|
readonly title: "Нет данных";
|
|
95
|
+
readonly content: "Обновите страницу";
|
|
92
96
|
};
|
|
93
97
|
readonly noResults: {
|
|
94
98
|
readonly title: "Ничего не найдено";
|
package/dist/esm/locale/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const TABLE_MESSAGES = defineMessages({
|
|
|
14
14
|
},
|
|
15
15
|
noData: {
|
|
16
16
|
title: 'No data',
|
|
17
|
+
content: 'Try refreshing the page',
|
|
17
18
|
},
|
|
18
19
|
noResults: {
|
|
19
20
|
title: 'Nothing found',
|
|
@@ -38,6 +39,7 @@ const TABLE_MESSAGES = defineMessages({
|
|
|
38
39
|
},
|
|
39
40
|
noData: {
|
|
40
41
|
title: 'Нет данных',
|
|
42
|
+
content: 'Обновите страницу',
|
|
41
43
|
},
|
|
42
44
|
noResults: {
|
|
43
45
|
title: 'Ничего не найдено',
|
package/dist/esm/style.css
CHANGED
|
@@ -442,8 +442,7 @@
|
|
|
442
442
|
flex:1 1 auto;
|
|
443
443
|
flex-direction:column;
|
|
444
444
|
width:100%;
|
|
445
|
-
min-width
|
|
446
|
-
min-width:max-content;
|
|
445
|
+
min-width:0;
|
|
447
446
|
min-height:100%;
|
|
448
447
|
}
|
|
449
448
|
|
|
@@ -577,23 +576,6 @@
|
|
|
577
576
|
width:100%;
|
|
578
577
|
max-width:100%;
|
|
579
578
|
}
|
|
580
|
-
|
|
581
|
-
.columnDragPreview{
|
|
582
|
-
display:flex;
|
|
583
|
-
align-items:center;
|
|
584
|
-
box-sizing:border-box;
|
|
585
|
-
height:var(--sn-table-anatomy-content-tableCell-minHeight, var(--sn-primitive-dimension-40, 40px));
|
|
586
|
-
padding:var(--sn-table-anatomy-content-tableHead-paddingTop, var(--sn-primitive-dimension-6, 6px)) var(--sn-table-anatomy-content-tableHead-paddingRight, var(--sn-primitive-dimension-12, 12px)) var(--sn-table-anatomy-content-tableHead-paddingBottom, var(--sn-primitive-dimension-6, 6px)) var(--sn-table-anatomy-content-tableHead-paddingLeft, var(--sn-primitive-dimension-12, 12px));
|
|
587
|
-
border-radius:var(--sn-table-anatomy-content-borderRadius, var(--sn-brand-anatomy-radius-table-m, var(--sn-primitive-dimension-4, 4px)));
|
|
588
|
-
color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
|
|
589
|
-
white-space:nowrap;
|
|
590
|
-
font-family:var(--sn-regular-body-m-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
|
|
591
|
-
font-weight:var(--sn-regular-body-m-fontWeight, var(--sn-theme-typography-fontWeight-regular-body-m, var(--sn-brand-font-fontWeight-light-regular-body-m, var(--sn-primitive-font-fontWeightValue-400, 400))));
|
|
592
|
-
line-height:var(--sn-regular-body-m-lineHeight, var(--sn-density-typography-roleBody-lineHeightM, var(--sn-primitive-font-lineHeight-by16, 24px)));
|
|
593
|
-
font-size:var(--sn-regular-body-m-fontSize, var(--sn-density-typography-roleBody-fontSizeM, var(--sn-primitive-font-fontSize-16, 16px)));
|
|
594
|
-
letter-spacing:var(--sn-regular-body-m-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
|
|
595
|
-
paragraph-spacing:var(--sn-regular-body-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize14, 7px));
|
|
596
|
-
}
|
|
597
579
|
.tableBodyCell{
|
|
598
580
|
gap:var(--sn-table-anatomy-content-tableCell-contentWrapper-slot-gap, var(--sn-primitive-dimension-2, 2px));
|
|
599
581
|
padding:calc(var(--sn-table-anatomy-content-tableCell-paddingTop, var(--sn-primitive-dimension-6, 6px)) + var(--sn-table-anatomy-content-tableCell-contentWrapper-paddingTop, var(--sn-primitive-dimension-2, 2px))) var(--sn-table-anatomy-content-tableCell-paddingRight, var(--sn-primitive-dimension-12, 12px)) calc(var(--sn-table-anatomy-content-tableCell-paddingBottom, var(--sn-primitive-dimension-6, 6px)) + var(--sn-table-anatomy-content-tableCell-contentWrapper-paddingBottom, var(--sn-primitive-dimension-2, 2px))) var(--sn-table-anatomy-content-tableCell-paddingLeft, var(--sn-primitive-dimension-12, 12px));
|
|
@@ -1023,9 +1005,6 @@
|
|
|
1023
1005
|
width:100%;
|
|
1024
1006
|
background-color:transparent;
|
|
1025
1007
|
}
|
|
1026
|
-
.tableCell[data-dragging]{
|
|
1027
|
-
box-shadow:inset var(--sn-table-anatomy-content-tableLine-background-interaction-borderVerticalWidth, var(--sn-primitive-strokeWeight-strokeRegular, 1px)) 0 0 0 var(--sn-theme-color-available-borderColor, var(--sn-brand-color-state-neutralBorder-forLightMode-default-borderColor, rgba(159, 166, 198, 0.3019607843))), inset calc(-1 * var(--sn-table-anatomy-content-tableLine-background-interaction-borderVerticalWidth, var(--sn-primitive-strokeWeight-strokeRegular, 1px))) 0 0 0 var(--sn-theme-color-available-borderColor, var(--sn-brand-color-state-neutralBorder-forLightMode-default-borderColor, rgba(159, 166, 198, 0.3019607843)));
|
|
1028
|
-
}
|
|
1029
1008
|
@charset "UTF-8";
|
|
1030
1009
|
.surface{
|
|
1031
1010
|
isolation:isolate;
|
|
@@ -1298,10 +1277,6 @@
|
|
|
1298
1277
|
width:var(--sn-table-anatomy-content-tableLine-background-interaction-borderVerticalWidth, var(--sn-primitive-strokeWeight-strokeRegular, 1px));
|
|
1299
1278
|
}
|
|
1300
1279
|
|
|
1301
|
-
.tableHeader .rowPinnedCells::after{
|
|
1302
|
-
bottom:0;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
1280
|
.rowPinnedCells[data-position=left]{
|
|
1306
1281
|
left:0;
|
|
1307
1282
|
}
|
|
@@ -1550,15 +1525,13 @@
|
|
|
1550
1525
|
padding:0;
|
|
1551
1526
|
}
|
|
1552
1527
|
.tableEmptyStateWrapper{
|
|
1553
|
-
position:sticky;
|
|
1554
|
-
left:0;
|
|
1555
1528
|
display:flex;
|
|
1556
1529
|
flex:1 1 auto;
|
|
1557
1530
|
flex-direction:column;
|
|
1558
1531
|
align-items:center;
|
|
1559
1532
|
justify-content:center;
|
|
1560
1533
|
box-sizing:border-box;
|
|
1561
|
-
width:
|
|
1534
|
+
width:100%;
|
|
1562
1535
|
min-height:304px;
|
|
1563
1536
|
padding:var(--sn-primitive-dimension-24, 24px);
|
|
1564
1537
|
}
|
package/dist/esm/types.d.ts
CHANGED