@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.
Files changed (109) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +3 -3
  3. package/dist/cjs/components/Table/Table.js +4 -12
  4. package/dist/cjs/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.d.ts +0 -2
  5. package/dist/cjs/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.js +3 -20
  6. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.d.ts +2 -2
  7. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.js +2 -2
  8. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/index.d.ts +0 -1
  9. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/index.js +0 -1
  10. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +4 -3
  11. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +15 -3
  12. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +2 -4
  13. package/dist/cjs/components/Table/hooks/useTableScroll.js +1 -15
  14. package/dist/cjs/components/Table/styles.module.css +1 -19
  15. package/dist/cjs/components/Table/utils/index.d.ts +0 -1
  16. package/dist/cjs/components/Table/utils/index.js +0 -1
  17. package/dist/cjs/constants.d.ts +1 -1
  18. package/dist/cjs/constants.js +1 -1
  19. package/dist/cjs/helperComponents/Cells/BodyCell/BodyCell.d.ts +1 -3
  20. package/dist/cjs/helperComponents/Cells/BodyCell/BodyCell.js +10 -9
  21. package/dist/cjs/helperComponents/Cells/HeaderCell/HeaderCell.js +6 -7
  22. package/dist/cjs/helperComponents/Cells/HeaderCell/ResizeHandle.js +1 -1
  23. package/dist/cjs/helperComponents/Cells/styles.module.css +0 -3
  24. package/dist/cjs/helperComponents/Rows/BodyRow.js +2 -1
  25. package/dist/cjs/helperComponents/Rows/styles.module.css +0 -4
  26. package/dist/cjs/helperComponents/TableEmptyState/hooks.js +1 -0
  27. package/dist/cjs/helperComponents/TableEmptyState/styles.module.css +1 -3
  28. package/dist/cjs/hooks/index.d.ts +0 -1
  29. package/dist/cjs/hooks/index.js +0 -1
  30. package/dist/cjs/hooks/useCellSizes.d.ts +1 -0
  31. package/dist/cjs/hooks/useCellSizes.js +4 -1
  32. package/dist/cjs/locale/index.d.ts +4 -0
  33. package/dist/cjs/locale/index.js +2 -0
  34. package/dist/cjs/style.css +2 -29
  35. package/dist/cjs/types.d.ts +0 -1
  36. package/dist/esm/components/Table/Table.js +7 -15
  37. package/dist/esm/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.d.ts +0 -2
  38. package/dist/esm/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.js +4 -21
  39. package/dist/esm/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.d.ts +2 -2
  40. package/dist/esm/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.js +2 -2
  41. package/dist/esm/components/Table/hooks/useColumnSettings/utils/index.d.ts +0 -1
  42. package/dist/esm/components/Table/hooks/useColumnSettings/utils/index.js +0 -1
  43. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.js +4 -3
  44. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.js +15 -3
  45. package/dist/esm/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.js +2 -4
  46. package/dist/esm/components/Table/hooks/useTableScroll.js +1 -15
  47. package/dist/esm/components/Table/styles.module.css +1 -19
  48. package/dist/esm/components/Table/utils/index.d.ts +0 -1
  49. package/dist/esm/components/Table/utils/index.js +0 -1
  50. package/dist/esm/constants.d.ts +1 -1
  51. package/dist/esm/constants.js +1 -1
  52. package/dist/esm/helperComponents/Cells/BodyCell/BodyCell.d.ts +1 -3
  53. package/dist/esm/helperComponents/Cells/BodyCell/BodyCell.js +11 -10
  54. package/dist/esm/helperComponents/Cells/HeaderCell/HeaderCell.js +6 -7
  55. package/dist/esm/helperComponents/Cells/HeaderCell/ResizeHandle.js +1 -1
  56. package/dist/esm/helperComponents/Cells/styles.module.css +0 -3
  57. package/dist/esm/helperComponents/Rows/BodyRow.js +2 -1
  58. package/dist/esm/helperComponents/Rows/styles.module.css +0 -4
  59. package/dist/esm/helperComponents/TableEmptyState/hooks.js +1 -0
  60. package/dist/esm/helperComponents/TableEmptyState/styles.module.css +1 -3
  61. package/dist/esm/hooks/index.d.ts +0 -1
  62. package/dist/esm/hooks/index.js +0 -1
  63. package/dist/esm/hooks/useCellSizes.d.ts +1 -0
  64. package/dist/esm/hooks/useCellSizes.js +4 -1
  65. package/dist/esm/locale/index.d.ts +4 -0
  66. package/dist/esm/locale/index.js +2 -0
  67. package/dist/esm/style.css +2 -29
  68. package/dist/esm/types.d.ts +0 -1
  69. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  70. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  71. package/package.json +20 -21
  72. package/src/components/Table/Table.tsx +26 -53
  73. package/src/components/Table/hooks/useColumnOrderByDrag/useColumnOrderByDrag.ts +7 -31
  74. package/src/components/Table/hooks/useColumnSettings/utils/createColumnsSettingsOption.ts +2 -2
  75. package/src/components/Table/hooks/useColumnSettings/utils/index.ts +0 -1
  76. package/src/components/Table/hooks/useColumnSettings/utils/isColumnEnabledInitially.ts +5 -3
  77. package/src/components/Table/hooks/useColumnSettings/utils/isColumnVisibilityConfigurable.ts +18 -3
  78. package/src/components/Table/hooks/useColumnSettings/utils/isFilterableColumn.ts +2 -4
  79. package/src/components/Table/hooks/useTableScroll.ts +1 -21
  80. package/src/components/Table/styles.module.scss +1 -23
  81. package/src/components/Table/utils/index.ts +0 -1
  82. package/src/constants.ts +1 -1
  83. package/src/helperComponents/Cells/BodyCell/BodyCell.tsx +15 -18
  84. package/src/helperComponents/Cells/HeaderCell/HeaderCell.tsx +7 -10
  85. package/src/helperComponents/Cells/HeaderCell/ResizeHandle.tsx +2 -1
  86. package/src/helperComponents/Cells/styles.module.scss +0 -11
  87. package/src/helperComponents/Rows/BodyRow.tsx +10 -9
  88. package/src/helperComponents/Rows/styles.module.scss +0 -5
  89. package/src/helperComponents/TableEmptyState/hooks.ts +1 -0
  90. package/src/helperComponents/TableEmptyState/styles.module.scss +1 -5
  91. package/src/hooks/index.ts +0 -1
  92. package/src/hooks/useCellSizes.ts +5 -1
  93. package/src/locale/index.ts +2 -0
  94. package/src/types.ts +5 -3
  95. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.d.ts +0 -8
  96. package/dist/cjs/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.js +0 -15
  97. package/dist/cjs/components/Table/utils/alignOverlayToHeader.d.ts +0 -6
  98. package/dist/cjs/components/Table/utils/alignOverlayToHeader.js +0 -28
  99. package/dist/cjs/hooks/useColumnDragTransform.d.ts +0 -15
  100. package/dist/cjs/hooks/useColumnDragTransform.js +0 -38
  101. package/dist/esm/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.d.ts +0 -8
  102. package/dist/esm/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.js +0 -11
  103. package/dist/esm/components/Table/utils/alignOverlayToHeader.d.ts +0 -6
  104. package/dist/esm/components/Table/utils/alignOverlayToHeader.js +0 -24
  105. package/dist/esm/hooks/useColumnDragTransform.d.ts +0 -15
  106. package/dist/esm/hooks/useColumnDragTransform.js +0 -35
  107. package/src/components/Table/hooks/useColumnSettings/utils/getColumnSettingsMode.ts +0 -18
  108. package/src/components/Table/utils/alignOverlayToHeader.ts +0 -36
  109. 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:var(--table-viewport-width, 100%);
8
+ width:100%;
11
9
  min-height:304px;
12
10
  padding:var(--sn-primitive-dimension-24, 24px);
13
11
  }
@@ -1,5 +1,4 @@
1
1
  export * from './useCellSizes.js';
2
- export * from './useColumnDragTransform.js';
3
2
  export * from './useColumnsSettingsToolbarSlot/index.js';
4
3
  export * from './useExportToolbarSlot/index.js';
5
4
  export * from './useHeaderGroups.js';
@@ -1,5 +1,4 @@
1
1
  export * from './useCellSizes.js';
2
- export * from './useColumnDragTransform.js';
3
2
  export * from './useColumnsSettingsToolbarSlot/index.js';
4
3
  export * from './useExportToolbarSlot/index.js';
5
4
  export * from './useHeaderGroups.js';
@@ -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: "Ничего не найдено";
@@ -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: 'Ничего не найдено',
@@ -442,8 +442,7 @@
442
442
  flex:1 1 auto;
443
443
  flex-direction:column;
444
444
  width:100%;
445
- min-width:-moz-max-content;
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:var(--table-viewport-width, 100%);
1534
+ width:100%;
1562
1535
  min-height:304px;
1563
1536
  padding:var(--sn-primitive-dimension-24, 24px);
1564
1537
  }
@@ -43,7 +43,6 @@ type FilterableProps = {
43
43
  columnSettings?: {
44
44
  /** Название колонки в настройках таблицы */
45
45
  label?: string;
46
- /** Поведение колонки в меню настроек. По умолчанию `defaultVisible` */
47
46
  mode?: ColumnSettingsMode;
48
47
  };
49
48
  } & ({