@cloud-ru/ds-table 1.0.2-preview-55e94282.0 → 1.0.2-preview-cd0cd6fb.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.
- package/README.md +3 -3
- package/dist/cjs/components/Table/Table.js +12 -4
- package/dist/cjs/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.d.ts +2 -0
- package/dist/cjs/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.js +20 -3
- 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/getColumnSettingsMode.d.ts +8 -0
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.js +15 -0
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/index.d.ts +1 -0
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/index.js +1 -0
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +3 -4
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +3 -15
- package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +4 -2
- package/dist/cjs/components/Table/hooks/useTableScroll.js +15 -1
- package/dist/cjs/components/Table/styles.module.css +19 -1
- package/dist/cjs/components/Table/utils/alignOverlayToHeader.d.ts +6 -0
- package/dist/cjs/components/Table/utils/alignOverlayToHeader.js +28 -0
- package/dist/cjs/components/Table/utils/index.d.ts +1 -0
- package/dist/cjs/components/Table/utils/index.js +1 -0
- package/dist/cjs/constants.d.ts +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/helperComponents/Cells/BodyCell/BodyCell.js +4 -4
- package/dist/cjs/helperComponents/Cells/HeaderCell/HeaderCell.js +7 -6
- package/dist/cjs/helperComponents/Cells/HeaderCell/ResizeHandle.js +1 -1
- package/dist/cjs/helperComponents/Cells/styles.module.css +3 -0
- package/dist/cjs/helperComponents/Rows/styles.module.css +4 -0
- package/dist/cjs/helperComponents/TableEmptyState/hooks.js +0 -1
- package/dist/cjs/helperComponents/TableEmptyState/styles.module.css +3 -1
- package/dist/cjs/hooks/useCellSizes.d.ts +0 -1
- package/dist/cjs/hooks/useCellSizes.js +1 -4
- package/dist/cjs/locale/index.d.ts +0 -4
- package/dist/cjs/locale/index.js +0 -2
- package/dist/cjs/style.css +29 -2
- package/dist/cjs/types.d.ts +1 -0
- package/dist/esm/components/Table/Table.js +15 -7
- package/dist/esm/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.d.ts +2 -0
- package/dist/esm/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.js +21 -4
- 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/getColumnSettingsMode.d.ts +8 -0
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.js +11 -0
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/index.d.ts +1 -0
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/index.js +1 -0
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +3 -4
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +3 -15
- package/dist/esm/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +4 -2
- package/dist/esm/components/Table/hooks/useTableScroll.js +15 -1
- package/dist/esm/components/Table/styles.module.css +19 -1
- package/dist/esm/components/Table/utils/alignOverlayToHeader.d.ts +6 -0
- package/dist/esm/components/Table/utils/alignOverlayToHeader.js +24 -0
- package/dist/esm/components/Table/utils/index.d.ts +1 -0
- package/dist/esm/components/Table/utils/index.js +1 -0
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/helperComponents/Cells/BodyCell/BodyCell.js +4 -4
- package/dist/esm/helperComponents/Cells/HeaderCell/HeaderCell.js +7 -6
- package/dist/esm/helperComponents/Cells/HeaderCell/ResizeHandle.js +1 -1
- package/dist/esm/helperComponents/Cells/styles.module.css +3 -0
- package/dist/esm/helperComponents/Rows/styles.module.css +4 -0
- package/dist/esm/helperComponents/TableEmptyState/hooks.js +0 -1
- package/dist/esm/helperComponents/TableEmptyState/styles.module.css +3 -1
- package/dist/esm/hooks/useCellSizes.d.ts +0 -1
- package/dist/esm/hooks/useCellSizes.js +1 -4
- package/dist/esm/locale/index.d.ts +0 -4
- package/dist/esm/locale/index.js +0 -2
- package/dist/esm/style.css +29 -2
- package/dist/esm/types.d.ts +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/components/Table/Table.tsx +53 -26
- package/src/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.ts +31 -7
- package/src/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.ts +2 -2
- package/src/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.ts +18 -0
- package/src/components/Table/hooks/useColumnSettings/utils/index.ts +1 -0
- package/src/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.ts +3 -5
- package/src/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.ts +3 -18
- package/src/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.ts +4 -2
- package/src/components/Table/hooks/useTableScroll.ts +21 -1
- package/src/components/Table/styles.module.scss +23 -1
- package/src/components/Table/utils/alignOverlayToHeader.ts +36 -0
- package/src/components/Table/utils/index.ts +1 -0
- package/src/constants.ts +1 -1
- package/src/helperComponents/Cells/BodyCell/BodyCell.tsx +5 -2
- package/src/helperComponents/Cells/HeaderCell/HeaderCell.tsx +10 -7
- package/src/helperComponents/Cells/HeaderCell/ResizeHandle.tsx +1 -2
- package/src/helperComponents/Cells/styles.module.scss +11 -0
- package/src/helperComponents/Rows/styles.module.scss +5 -0
- package/src/helperComponents/TableEmptyState/hooks.ts +0 -1
- package/src/helperComponents/TableEmptyState/styles.module.scss +5 -1
- package/src/hooks/useCellSizes.ts +1 -5
- package/src/locale/index.ts +0 -2
- package/src/types.ts +3 -5
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
width:var(--sn-table-anatomy-content-tableLine-background-interaction-borderVerticalWidth, var(--sn-primitive-strokeWeight-strokeRegular, 1px));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.tableHeader .rowPinnedCells::after{
|
|
47
|
+
bottom:0;
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
.rowPinnedCells[data-position=left]{
|
|
47
51
|
left:0;
|
|
48
52
|
}
|
|
@@ -7,7 +7,6 @@ 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'),
|
|
11
10
|
...noDataStateProp,
|
|
12
11
|
};
|
|
13
12
|
const noResultsState = {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
.tableEmptyStateWrapper{
|
|
2
|
+
position:sticky;
|
|
3
|
+
left:0;
|
|
2
4
|
display:flex;
|
|
3
5
|
flex:1 1 auto;
|
|
4
6
|
flex-direction:column;
|
|
5
7
|
align-items:center;
|
|
6
8
|
justify-content:center;
|
|
7
9
|
box-sizing:border-box;
|
|
8
|
-
width:100
|
|
10
|
+
width:var(--table-viewport-width, 100%);
|
|
9
11
|
min-height:304px;
|
|
10
12
|
padding:var(--sn-primitive-dimension-24, 24px);
|
|
11
13
|
}
|
|
@@ -3,7 +3,6 @@ import { Cell, Header } from '@tanstack/react-table';
|
|
|
3
3
|
import { CSSProperties } from 'react';
|
|
4
4
|
type CellSizesOptions = {
|
|
5
5
|
isDraggable?: boolean;
|
|
6
|
-
isDragging?: boolean;
|
|
7
6
|
transform?: Transform | null;
|
|
8
7
|
};
|
|
9
8
|
export declare function useCellSizes<TData>(element: Cell<TData, unknown> | Header<TData, unknown>, options?: CellSizesOptions): CSSProperties;
|
|
@@ -3,7 +3,6 @@ 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;
|
|
7
6
|
const transform = options?.transform ?? null;
|
|
8
7
|
const minWidth = column.columnDef.minSize;
|
|
9
8
|
const maxWidth = column.columnDef.maxSize;
|
|
@@ -18,14 +17,12 @@ export function useCellSizes(element, options) {
|
|
|
18
17
|
flexShrink,
|
|
19
18
|
};
|
|
20
19
|
if (options?.isDraggable) {
|
|
21
|
-
styles.opacity = isDragging ? 0.8 : 1;
|
|
22
20
|
styles.position = 'relative';
|
|
23
21
|
styles.transform = CSS.Translate.toString(transform);
|
|
24
|
-
styles.zIndex = isDragging ? 1 : undefined;
|
|
25
22
|
if (isHeaderCell) {
|
|
26
23
|
styles.whiteSpace = 'nowrap';
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
return styles;
|
|
30
|
-
}, [options?.isDraggable, flexShrink,
|
|
27
|
+
}, [options?.isDraggable, flexShrink, isHeaderCell, maxWidth, minWidth, transform, width]);
|
|
31
28
|
}
|
|
@@ -13,7 +13,6 @@ declare const TABLE_MESSAGES: {
|
|
|
13
13
|
};
|
|
14
14
|
readonly noData: {
|
|
15
15
|
readonly title: "No data";
|
|
16
|
-
readonly content: "Try refreshing the page";
|
|
17
16
|
};
|
|
18
17
|
readonly noResults: {
|
|
19
18
|
readonly title: "Nothing found";
|
|
@@ -38,7 +37,6 @@ declare const TABLE_MESSAGES: {
|
|
|
38
37
|
};
|
|
39
38
|
readonly noData: {
|
|
40
39
|
readonly title: "Нет данных";
|
|
41
|
-
readonly content: "Обновите страницу";
|
|
42
40
|
};
|
|
43
41
|
readonly noResults: {
|
|
44
42
|
readonly title: "Ничего не найдено";
|
|
@@ -67,7 +65,6 @@ export declare const tableLocale: import("@cloud-ru/ds-locale").DefinedLocale<{
|
|
|
67
65
|
};
|
|
68
66
|
readonly noData: {
|
|
69
67
|
readonly title: "No data";
|
|
70
|
-
readonly content: "Try refreshing the page";
|
|
71
68
|
};
|
|
72
69
|
readonly noResults: {
|
|
73
70
|
readonly title: "Nothing found";
|
|
@@ -92,7 +89,6 @@ export declare const tableLocale: import("@cloud-ru/ds-locale").DefinedLocale<{
|
|
|
92
89
|
};
|
|
93
90
|
readonly noData: {
|
|
94
91
|
readonly title: "Нет данных";
|
|
95
|
-
readonly content: "Обновите страницу";
|
|
96
92
|
};
|
|
97
93
|
readonly noResults: {
|
|
98
94
|
readonly title: "Ничего не найдено";
|
package/dist/esm/locale/index.js
CHANGED
|
@@ -14,7 +14,6 @@ const TABLE_MESSAGES = defineMessages({
|
|
|
14
14
|
},
|
|
15
15
|
noData: {
|
|
16
16
|
title: 'No data',
|
|
17
|
-
content: 'Try refreshing the page',
|
|
18
17
|
},
|
|
19
18
|
noResults: {
|
|
20
19
|
title: 'Nothing found',
|
|
@@ -39,7 +38,6 @@ const TABLE_MESSAGES = defineMessages({
|
|
|
39
38
|
},
|
|
40
39
|
noData: {
|
|
41
40
|
title: 'Нет данных',
|
|
42
|
-
content: 'Обновите страницу',
|
|
43
41
|
},
|
|
44
42
|
noResults: {
|
|
45
43
|
title: 'Ничего не найдено',
|
package/dist/esm/style.css
CHANGED
|
@@ -442,7 +442,8 @@
|
|
|
442
442
|
flex:1 1 auto;
|
|
443
443
|
flex-direction:column;
|
|
444
444
|
width:100%;
|
|
445
|
-
min-width
|
|
445
|
+
min-width:-moz-max-content;
|
|
446
|
+
min-width:max-content;
|
|
446
447
|
min-height:100%;
|
|
447
448
|
}
|
|
448
449
|
|
|
@@ -576,6 +577,23 @@
|
|
|
576
577
|
width:100%;
|
|
577
578
|
max-width:100%;
|
|
578
579
|
}
|
|
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
|
+
}
|
|
579
597
|
.tableBodyCell{
|
|
580
598
|
gap:var(--sn-table-anatomy-content-tableCell-contentWrapper-slot-gap, var(--sn-primitive-dimension-2, 2px));
|
|
581
599
|
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));
|
|
@@ -1005,6 +1023,9 @@
|
|
|
1005
1023
|
width:100%;
|
|
1006
1024
|
background-color:transparent;
|
|
1007
1025
|
}
|
|
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
|
+
}
|
|
1008
1029
|
@charset "UTF-8";
|
|
1009
1030
|
.surface{
|
|
1010
1031
|
isolation:isolate;
|
|
@@ -1277,6 +1298,10 @@
|
|
|
1277
1298
|
width:var(--sn-table-anatomy-content-tableLine-background-interaction-borderVerticalWidth, var(--sn-primitive-strokeWeight-strokeRegular, 1px));
|
|
1278
1299
|
}
|
|
1279
1300
|
|
|
1301
|
+
.tableHeader .rowPinnedCells::after{
|
|
1302
|
+
bottom:0;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1280
1305
|
.rowPinnedCells[data-position=left]{
|
|
1281
1306
|
left:0;
|
|
1282
1307
|
}
|
|
@@ -1525,13 +1550,15 @@
|
|
|
1525
1550
|
padding:0;
|
|
1526
1551
|
}
|
|
1527
1552
|
.tableEmptyStateWrapper{
|
|
1553
|
+
position:sticky;
|
|
1554
|
+
left:0;
|
|
1528
1555
|
display:flex;
|
|
1529
1556
|
flex:1 1 auto;
|
|
1530
1557
|
flex-direction:column;
|
|
1531
1558
|
align-items:center;
|
|
1532
1559
|
justify-content:center;
|
|
1533
1560
|
box-sizing:border-box;
|
|
1534
|
-
width:100
|
|
1561
|
+
width:var(--table-viewport-width, 100%);
|
|
1535
1562
|
min-height:304px;
|
|
1536
1563
|
padding:var(--sn-primitive-dimension-24, 24px);
|
|
1537
1564
|
}
|
package/dist/esm/types.d.ts
CHANGED