@hh.ru/magritte-ui-table 4.2.10 → 4.2.11

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 (59) hide show
  1. package/BaseTable.d.ts +1 -1
  2. package/BaseTable.js +266 -145
  3. package/BaseTable.js.map +1 -1
  4. package/FullPageContainer.js +27 -22
  5. package/FullPageContainer.js.map +1 -1
  6. package/SimpleTable.d.ts +1 -1
  7. package/SimpleTable.js +4 -4
  8. package/SimpleTable.js.map +1 -1
  9. package/StickyTableHeader.js +43 -37
  10. package/StickyTableHeader.js.map +1 -1
  11. package/Table.d.ts +1 -1
  12. package/Table.js +8 -8
  13. package/Table.js.map +1 -1
  14. package/TableBody.js +7 -4
  15. package/TableBody.js.map +1 -1
  16. package/TableCell.d.ts +1 -1
  17. package/TableCell.js +84 -60
  18. package/TableCell.js.map +1 -1
  19. package/TableHeader.d.ts +1 -1
  20. package/TableHeader.js +37 -11
  21. package/TableHeader.js.map +1 -1
  22. package/TableRow.d.ts +1 -1
  23. package/TableRow.js +108 -32
  24. package/TableRow.js.map +1 -1
  25. package/VirtualizedList/VirtualizedList.js +43 -32
  26. package/VirtualizedList/VirtualizedList.js.map +1 -1
  27. package/VirtualizedList/VirtualizedListWrapper.js +41 -15
  28. package/VirtualizedList/VirtualizedListWrapper.js.map +1 -1
  29. package/VirtualizedList/VirtualizedPanel.js +13 -7
  30. package/VirtualizedList/VirtualizedPanel.js.map +1 -1
  31. package/VirtualizedList/context.js +1 -1
  32. package/VirtualizedList/context.js.map +1 -1
  33. package/VirtualizedList/index.d.ts +3 -3
  34. package/VirtualizedList/index.js +1 -1
  35. package/VirtualizedList/useVirtualizedList.js +29 -33
  36. package/VirtualizedList/useVirtualizedList.js.map +1 -1
  37. package/cell-7-Eiwyn4.js +5 -0
  38. package/cell-7-Eiwyn4.js.map +1 -0
  39. package/context.js +3 -3
  40. package/context.js.map +1 -1
  41. package/index.css +1318 -1318
  42. package/index.d.ts +9 -9
  43. package/index.js +4 -4
  44. package/index.mock.d.ts +1 -1
  45. package/index.mock.js +11 -11
  46. package/index.mock.js.map +1 -1
  47. package/package.json +5 -5
  48. package/table-CQ76yrLp.js +5 -0
  49. package/table-CQ76yrLp.js.map +1 -0
  50. package/useTableResize.js +35 -37
  51. package/useTableResize.js.map +1 -1
  52. package/virtualized-list-DZqJXIA7.js +5 -0
  53. package/virtualized-list-DZqJXIA7.js.map +1 -0
  54. package/cell-C283JD07.js +0 -5
  55. package/cell-C283JD07.js.map +0 -1
  56. package/table-C-jo_Mjg.js +0 -5
  57. package/table-C-jo_Mjg.js.map +0 -1
  58. package/virtualized-list-CrBJZfKI.js +0 -5
  59. package/virtualized-list-CrBJZfKI.js.map +0 -1
package/TableRow.js CHANGED
@@ -4,39 +4,115 @@ import { forwardRef, useContext, useRef, useEffect } from 'react';
4
4
  import classnames from 'classnames';
5
5
  import { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';
6
6
  import { TableContext } from './context.js';
7
- import { c as cellStyles } from './cell-C283JD07.js';
8
- import { s as styles } from './table-C-jo_Mjg.js';
7
+ import { c as cellStyles } from './cell-7-Eiwyn4.js';
8
+ import { s as styles } from './table-CQ76yrLp.js';
9
9
 
10
- const TableRowComponent = ({ style, styleHighlighted, action, showAction, animated, onClick, panel, showPanel, children, measure, align, hoverEnabled, verticalAlign = 'top', 'data-qa': dataQa = 'table-row', ...rest }, ref) => {
11
- const { paddingLeft, paddingRight, hoverEnabled: _tableHoverEnabled } = useContext(TableContext);
12
- const _hoverEnabled = hoverEnabled ?? _tableHoverEnabled;
13
- const highlightedColor = styleHighlighted || style;
14
- const wasPanelShown = useRef(null);
15
- const rowRef = useRef(null);
16
- const multiRef = useMultipleRefs(ref, rowRef);
17
- useEffect(() => {
18
- if (wasPanelShown.current === null) {
19
- wasPanelShown.current = !!(panel && showPanel);
20
- return;
21
- }
22
- if (wasPanelShown.current !== !!(panel && showPanel)) {
23
- wasPanelShown.current = !!(panel && showPanel);
24
- rowRef.current && measure?.(rowRef.current);
25
- }
26
- }, [panel, showPanel, measure]);
27
- return (jsxs(Fragment, { children: [jsxs("tr", { ...rest, className: classnames(styles.row, {
28
- [styles.active]: !!onClick,
29
- [styles.hoverEnabled]: _hoverEnabled,
30
- [styles.animated]: animated,
31
- [styles.withPanel]: showPanel && panel,
32
- [styles[`style-${style}`]]: style,
33
- [styles[`style-highlighted-${highlightedColor}`]]: highlightedColor,
34
- }), onClick: onClick, ref: multiRef, "data-qa": dataQa, style: {
35
- textAlign: align,
36
- verticalAlign,
37
- }, children: [!!paddingLeft && (jsx("td", { className: classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td), "data-qa": "table-row-left-space", style: { width: paddingLeft }, children: showAction && action && jsx("div", { className: cellStyles.control, children: action }) })), children, !!paddingRight && (jsx("td", { className: classnames(cellStyles.spaceCell, styles.td), "data-qa": "table-row-right-space", style: { width: paddingRight } }))] }), panel && showPanel && (jsxs("tr", { "data-qa": `${dataQa}-panel`, "data-magritte-table-row-panel": true, className: classnames(styles.row, styles.rowPanel, styles.animated), style: {
38
- textAlign: align,
39
- }, children: [!!paddingLeft && (jsx("td", { className: classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td), "data-qa": "table-row-left-space", style: { width: paddingLeft } })), panel, !!paddingRight && (jsx("td", { className: classnames(cellStyles.spaceCell, styles.td), "data-qa": "table-row-right-space", style: { width: paddingRight } }))] }))] }));
10
+ const TableRowComponent = ({
11
+ style,
12
+ styleHighlighted,
13
+ action,
14
+ showAction,
15
+ animated,
16
+ onClick,
17
+ panel,
18
+ showPanel,
19
+ children,
20
+ measure,
21
+ align,
22
+ hoverEnabled,
23
+ verticalAlign = "top",
24
+ "data-qa": dataQa = "table-row",
25
+ ...rest
26
+ }, ref) => {
27
+ const { paddingLeft, paddingRight, hoverEnabled: _tableHoverEnabled } = useContext(TableContext);
28
+ const _hoverEnabled = hoverEnabled ?? _tableHoverEnabled;
29
+ const highlightedColor = styleHighlighted || style;
30
+ const wasPanelShown = useRef(null);
31
+ const rowRef = useRef(null);
32
+ const multiRef = useMultipleRefs(ref, rowRef);
33
+ useEffect(() => {
34
+ if (wasPanelShown.current === null) {
35
+ wasPanelShown.current = !!(panel && showPanel);
36
+ return;
37
+ }
38
+ if (wasPanelShown.current !== !!(panel && showPanel)) {
39
+ wasPanelShown.current = !!(panel && showPanel);
40
+ rowRef.current && measure?.(rowRef.current);
41
+ }
42
+ }, [panel, showPanel, measure]);
43
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ /* @__PURE__ */ jsxs(
45
+ "tr",
46
+ {
47
+ ...rest,
48
+ className: classnames(styles.row, {
49
+ [styles.active]: !!onClick,
50
+ [styles.hoverEnabled]: _hoverEnabled,
51
+ [styles.animated]: animated,
52
+ [styles.withPanel]: showPanel && panel,
53
+ [styles[`style-${style}`]]: style,
54
+ [styles[`style-highlighted-${highlightedColor}`]]: highlightedColor
55
+ }),
56
+ onClick,
57
+ ref: multiRef,
58
+ "data-qa": dataQa,
59
+ style: {
60
+ textAlign: align,
61
+ verticalAlign
62
+ },
63
+ children: [
64
+ !!paddingLeft && /* @__PURE__ */ jsx(
65
+ "td",
66
+ {
67
+ className: classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td),
68
+ "data-qa": "table-row-left-space",
69
+ style: { width: paddingLeft },
70
+ children: showAction && action && /* @__PURE__ */ jsx("div", { className: cellStyles.control, children: action })
71
+ }
72
+ ),
73
+ children,
74
+ !!paddingRight && /* @__PURE__ */ jsx(
75
+ "td",
76
+ {
77
+ className: classnames(cellStyles.spaceCell, styles.td),
78
+ "data-qa": "table-row-right-space",
79
+ style: { width: paddingRight }
80
+ }
81
+ )
82
+ ]
83
+ }
84
+ ),
85
+ panel && showPanel && /* @__PURE__ */ jsxs(
86
+ "tr",
87
+ {
88
+ "data-qa": `${dataQa}-panel`,
89
+ "data-magritte-table-row-panel": true,
90
+ className: classnames(styles.row, styles.rowPanel, styles.animated),
91
+ style: {
92
+ textAlign: align
93
+ },
94
+ children: [
95
+ !!paddingLeft && /* @__PURE__ */ jsx(
96
+ "td",
97
+ {
98
+ className: classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td),
99
+ "data-qa": "table-row-left-space",
100
+ style: { width: paddingLeft }
101
+ }
102
+ ),
103
+ panel,
104
+ !!paddingRight && /* @__PURE__ */ jsx(
105
+ "td",
106
+ {
107
+ className: classnames(cellStyles.spaceCell, styles.td),
108
+ "data-qa": "table-row-right-space",
109
+ style: { width: paddingRight }
110
+ }
111
+ )
112
+ ]
113
+ }
114
+ )
115
+ ] });
40
116
  };
41
117
  const TableRow = forwardRef(TableRowComponent);
42
118
 
package/TableRow.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.js","sources":["src/TableRow.tsx"],"sourcesContent":["import React, { type ForwardedRef, forwardRef, useContext, useEffect, useRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { TableContext } from '@hh.ru/magritte-ui-table/context';\nimport { TableRowProps } from '@hh.ru/magritte-ui-table/types';\n\nimport cellStyles from './cell.less';\nimport styles from './table.less';\n\nconst TableRowComponent = (\n {\n style,\n styleHighlighted,\n action,\n showAction,\n animated,\n onClick,\n panel,\n showPanel,\n children,\n measure,\n align,\n hoverEnabled,\n verticalAlign = 'top',\n 'data-qa': dataQa = 'table-row',\n ...rest\n }: TableRowProps,\n ref: ForwardedRef<HTMLTableRowElement>\n) => {\n const { paddingLeft, paddingRight, hoverEnabled: _tableHoverEnabled } = useContext(TableContext);\n const _hoverEnabled = hoverEnabled ?? _tableHoverEnabled;\n const highlightedColor = styleHighlighted || style;\n const wasPanelShown = useRef<boolean | null>(null);\n const rowRef = useRef(null);\n const multiRef = useMultipleRefs(ref, rowRef);\n\n useEffect(() => {\n if (wasPanelShown.current === null) {\n wasPanelShown.current = !!(panel && showPanel);\n return;\n }\n\n if (wasPanelShown.current !== !!(panel && showPanel)) {\n wasPanelShown.current = !!(panel && showPanel);\n rowRef.current && measure?.(rowRef.current);\n }\n }, [panel, showPanel, measure]);\n\n return (\n <>\n <tr\n {...rest}\n className={classnames(styles.row, {\n [styles.active]: !!onClick,\n [styles.hoverEnabled]: _hoverEnabled,\n [styles.animated]: animated,\n [styles.withPanel]: showPanel && panel,\n [styles[`style-${style}`]]: style,\n [styles[`style-highlighted-${highlightedColor}`]]: highlightedColor,\n })}\n onClick={onClick}\n ref={multiRef}\n data-qa={dataQa}\n style={{\n textAlign: align,\n verticalAlign,\n }}\n >\n {!!paddingLeft && (\n <td\n className={classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td)}\n data-qa=\"table-row-left-space\"\n style={{ width: paddingLeft }}\n >\n {showAction && action && <div className={cellStyles.control}>{action}</div>}\n </td>\n )}\n {children}\n {!!paddingRight && (\n <td\n className={classnames(cellStyles.spaceCell, styles.td)}\n data-qa=\"table-row-right-space\"\n style={{ width: paddingRight }}\n ></td>\n )}\n </tr>\n {panel && showPanel && (\n <tr\n data-qa={`${dataQa}-panel`}\n data-magritte-table-row-panel\n className={classnames(styles.row, styles.rowPanel, styles.animated)}\n style={{\n textAlign: align,\n }}\n >\n {!!paddingLeft && (\n <td\n className={classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td)}\n data-qa=\"table-row-left-space\"\n style={{ width: paddingLeft }}\n ></td>\n )}\n {panel}\n {!!paddingRight && (\n <td\n className={classnames(cellStyles.spaceCell, styles.td)}\n data-qa=\"table-row-right-space\"\n style={{ width: paddingRight }}\n ></td>\n )}\n </tr>\n )}\n </>\n );\n};\n\nexport const TableRow = forwardRef(TableRowComponent);\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;AAUA,MAAM,iBAAiB,GAAG,CACtB,EACI,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAA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M,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,EACnE,KAAK,EAAE;AACH,oBAAA,SAAS,EAAE,KAAK;AACnB,iBAAA,EAAA,QAAA,EAAA,CAEA,CAAC,CAAC,WAAW,KACVE,GACI,CAAA,IAAA,EAAA,EAAA,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,aACjE,sBAAsB,EAC9B,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,GAC3B,CACT,EACA,KAAK,EACL,CAAC,CAAC,YAAY,KACXA,GACI,CAAA,IAAA,EAAA,EAAA,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,EAAA,SAAA,EAC9C,uBAAuB,EAC/B,KAAK,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,GAC5B,CACT,CAAA,EAAA,CACA,CACR,CAAA,EAAA,CACF,EACL;AACN,CAAC,CAAC;MAEW,QAAQ,GAAG,UAAU,CAAC,iBAAiB;;;;"}
1
+ {"version":3,"file":"TableRow.js","sources":["src/TableRow.tsx"],"sourcesContent":["import React, { type ForwardedRef, forwardRef, useContext, useEffect, useRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { TableContext } from '@hh.ru/magritte-ui-table/context';\nimport { TableRowProps } from '@hh.ru/magritte-ui-table/types';\n\nimport cellStyles from './cell.less';\nimport styles from './table.less';\n\nconst TableRowComponent = (\n {\n style,\n styleHighlighted,\n action,\n showAction,\n animated,\n onClick,\n panel,\n showPanel,\n children,\n measure,\n align,\n hoverEnabled,\n verticalAlign = 'top',\n 'data-qa': dataQa = 'table-row',\n ...rest\n }: TableRowProps,\n ref: ForwardedRef<HTMLTableRowElement>\n) => {\n const { paddingLeft, paddingRight, hoverEnabled: _tableHoverEnabled } = useContext(TableContext);\n const _hoverEnabled = hoverEnabled ?? _tableHoverEnabled;\n const highlightedColor = styleHighlighted || style;\n const wasPanelShown = useRef<boolean | null>(null);\n const rowRef = useRef(null);\n const multiRef = useMultipleRefs(ref, rowRef);\n\n useEffect(() => {\n if (wasPanelShown.current === null) {\n wasPanelShown.current = !!(panel && showPanel);\n return;\n }\n\n if (wasPanelShown.current !== !!(panel && showPanel)) {\n wasPanelShown.current = !!(panel && showPanel);\n rowRef.current && measure?.(rowRef.current);\n }\n }, [panel, showPanel, measure]);\n\n return (\n <>\n <tr\n {...rest}\n className={classnames(styles.row, {\n [styles.active]: !!onClick,\n [styles.hoverEnabled]: _hoverEnabled,\n [styles.animated]: animated,\n [styles.withPanel]: showPanel && panel,\n [styles[`style-${style}`]]: style,\n [styles[`style-highlighted-${highlightedColor}`]]: highlightedColor,\n })}\n onClick={onClick}\n ref={multiRef}\n data-qa={dataQa}\n style={{\n textAlign: align,\n verticalAlign,\n }}\n >\n {!!paddingLeft && (\n <td\n className={classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td)}\n data-qa=\"table-row-left-space\"\n style={{ width: paddingLeft }}\n >\n {showAction && action && <div className={cellStyles.control}>{action}</div>}\n </td>\n )}\n {children}\n {!!paddingRight && (\n <td\n className={classnames(cellStyles.spaceCell, styles.td)}\n data-qa=\"table-row-right-space\"\n style={{ width: paddingRight }}\n ></td>\n )}\n </tr>\n {panel && showPanel && (\n <tr\n data-qa={`${dataQa}-panel`}\n data-magritte-table-row-panel\n className={classnames(styles.row, styles.rowPanel, styles.animated)}\n style={{\n textAlign: align,\n }}\n >\n {!!paddingLeft && (\n <td\n className={classnames(cellStyles.spaceCell, cellStyles.pinned, styles.td)}\n data-qa=\"table-row-left-space\"\n style={{ width: paddingLeft }}\n ></td>\n )}\n {panel}\n {!!paddingRight && (\n <td\n className={classnames(cellStyles.spaceCell, styles.td)}\n data-qa=\"table-row-right-space\"\n style={{ width: paddingRight }}\n ></td>\n )}\n </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;AAAA,OAAA;AAAA,KAET;AAAA,GAER,EAAA,CAAA,CAAA;AAER,CAAA,CAAA;AAEa,MAAA,QAAA,GAAW,WAAW,iBAAiB;;;;"}
@@ -4,44 +4,55 @@ import { forwardRef, useContext, Children, isValidElement, useRef, cloneElement
4
4
  import classnames from 'classnames';
5
5
  import { VirtualizedListContext } from './context.js';
6
6
  import { useVirtualizedList } from './useVirtualizedList.js';
7
- import { s as styles } from '../virtualized-list-CrBJZfKI.js';
7
+ import { s as styles } from '../virtualized-list-DZqJXIA7.js';
8
8
  import '@tanstack/react-virtual';
9
9
 
10
- const ActivatedVirtualizedList = ({ ElementItem = 'div', Element = 'div', className, children, ...rest }) => {
11
- const childArray = Children.toArray(children).filter((e) => isValidElement(e));
12
- const contentRef = useRef(null);
13
- const virtualizer = useVirtualizedList({
14
- count: childArray.length,
15
- contentRef,
16
- });
17
- const additionalProps = { ...rest };
18
- additionalProps.ref = contentRef;
19
- const items = virtualizer.getVirtualItems();
20
- const [paddingTop, paddingBottom] = items.length > 0
21
- ? [
22
- Math.max(0, items[0].start - virtualizer.options.scrollMargin),
23
- Math.max(0, virtualizer.getTotalSize() - (items[items.length - 1].end - virtualizer.options.scrollMargin)),
24
- ]
25
- : [0, 0];
26
- return (jsxs(Element, { ...additionalProps, className: classnames(styles.virtualizedList, className), children: [paddingTop > 0 && jsx(ElementItem, { style: { height: paddingTop } }), virtualizer.getVirtualItems().map((virtualItem) => {
27
- return cloneElement(childArray[virtualItem.index], {
28
- key: virtualItem.key,
29
- 'data-index': virtualItem.index,
30
- ref: virtualItem.measureElement,
31
- measure: virtualItem.measureElement,
32
- });
33
- }), paddingBottom > 0 && jsx(ElementItem, { style: { height: paddingBottom } })] }));
10
+ const ActivatedVirtualizedList = ({
11
+ ElementItem = "div",
12
+ Element = "div",
13
+ className,
14
+ children,
15
+ ...rest
16
+ }) => {
17
+ const childArray = Children.toArray(children).filter((e) => isValidElement(e));
18
+ const contentRef = useRef(null);
19
+ const virtualizer = useVirtualizedList({
20
+ count: childArray.length,
21
+ contentRef
22
+ });
23
+ const additionalProps = { ...rest };
24
+ additionalProps.ref = contentRef;
25
+ const items = virtualizer.getVirtualItems();
26
+ const [paddingTop, paddingBottom] = items.length > 0 ? [
27
+ Math.max(0, items[0].start - virtualizer.options.scrollMargin),
28
+ Math.max(
29
+ 0,
30
+ virtualizer.getTotalSize() - (items[items.length - 1].end - virtualizer.options.scrollMargin)
31
+ )
32
+ ] : [0, 0];
33
+ return /* @__PURE__ */ jsxs(Element, { ...additionalProps, className: classnames(styles.virtualizedList, className), children: [
34
+ paddingTop > 0 && /* @__PURE__ */ jsx(ElementItem, { style: { height: paddingTop } }),
35
+ virtualizer.getVirtualItems().map((virtualItem) => {
36
+ return cloneElement(childArray[virtualItem.index], {
37
+ key: virtualItem.key,
38
+ "data-index": virtualItem.index,
39
+ ref: virtualItem.measureElement,
40
+ measure: virtualItem.measureElement
41
+ });
42
+ }),
43
+ paddingBottom > 0 && /* @__PURE__ */ jsx(ElementItem, { style: { height: paddingBottom } })
44
+ ] });
34
45
  };
35
46
  const VirtualizedList = (props) => {
36
- const { Element = 'div', className, ElementItem, children, ...rest } = props;
37
- const { virtualized } = useContext(VirtualizedListContext);
38
- if (!virtualized) {
39
- return (jsx(Element, { ...rest, className: classnames(styles.virtualizedList, className), children: children }));
40
- }
41
- return jsx(ActivatedVirtualizedList, { ...props });
47
+ const { Element = "div", className, ElementItem, children, ...rest } = props;
48
+ const { virtualized } = useContext(VirtualizedListContext);
49
+ if (!virtualized) {
50
+ return /* @__PURE__ */ jsx(Element, { ...rest, className: classnames(styles.virtualizedList, className), children });
51
+ }
52
+ return /* @__PURE__ */ jsx(ActivatedVirtualizedList, { ...props });
42
53
  };
43
54
  const VirtualizedItemComponent = ({ measure, ...rest }, ref) => {
44
- return jsx("div", { ...rest, ref: ref });
55
+ return /* @__PURE__ */ jsx("div", { ...rest, ref });
45
56
  };
46
57
  const VirtualizedItem = forwardRef(VirtualizedItemComponent);
47
58
 
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedList.js","sources":["src/VirtualizedList/VirtualizedList.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n FC,\n type ForwardedRef,\n forwardRef,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactElement,\n useContext,\n useRef,\n} from 'react';\nimport { VirtualItem } from '@tanstack/virtual-core';\nimport classnames from 'classnames';\n\nimport { VirtualizedListContext } from '@hh.ru/magritte-ui-table/VirtualizedList/context';\nimport { useVirtualizedList } from '@hh.ru/magritte-ui-table/VirtualizedList/useVirtualizedList';\n\nimport styles from './virtualized-list.less';\n\ninterface VirtualizedListProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {\n ElementItem?: keyof JSX.IntrinsicElements & keyof HTMLElementTagNameMap;\n Element?: keyof JSX.IntrinsicElements & keyof HTMLElementTagNameMap;\n}\n\nconst ActivatedVirtualizedList: FC<VirtualizedListProps> = ({\n ElementItem = 'div',\n Element = 'div',\n className,\n children,\n ...rest\n}) => {\n const childArray = Children.toArray(children).filter<ReactElement>((e): e is ReactElement => isValidElement(e));\n const contentRef = useRef<HTMLElement>(null);\n\n const virtualizer = useVirtualizedList({\n count: childArray.length,\n contentRef,\n });\n\n const additionalProps: Record<string, unknown> = { ...rest };\n\n additionalProps.ref = contentRef;\n\n const items = virtualizer.getVirtualItems();\n const [paddingTop, paddingBottom] =\n items.length > 0\n ? [\n Math.max(0, items[0].start - virtualizer.options.scrollMargin),\n Math.max(\n 0,\n virtualizer.getTotalSize() - (items[items.length - 1].end - virtualizer.options.scrollMargin)\n ),\n ]\n : [0, 0];\n\n return (\n <Element {...additionalProps} className={classnames(styles.virtualizedList, className)}>\n {paddingTop > 0 && <ElementItem style={{ height: paddingTop }}></ElementItem>}\n {virtualizer.getVirtualItems().map((virtualItem) => {\n return cloneElement(childArray[virtualItem.index], {\n key: virtualItem.key,\n 'data-index': virtualItem.index,\n ref: virtualItem.measureElement,\n measure: virtualItem.measureElement,\n });\n })}\n {paddingBottom > 0 && <ElementItem style={{ height: paddingBottom }}></ElementItem>}\n </Element>\n );\n};\n\nexport const VirtualizedList: FC<VirtualizedListProps> = (props) => {\n const { Element = 'div', className, ElementItem, children, ...rest } = props;\n\n const { virtualized } = useContext(VirtualizedListContext);\n\n if (!virtualized) {\n return (\n <Element {...rest} className={classnames(styles.virtualizedList, className)}>\n {children}\n </Element>\n );\n }\n\n return <ActivatedVirtualizedList {...props} />;\n};\n\ninterface VirtualizedItemProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {\n measure?: VirtualItem<Element>['measureElement'];\n}\n\nconst VirtualizedItemComponent = ({ measure, ...rest }: VirtualizedItemProps, ref: ForwardedRef<HTMLDivElement>) => {\n return <div {...rest} ref={ref} />;\n};\n\nexport const VirtualizedItem = forwardRef(VirtualizedItemComponent);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AA0BA,MAAM,wBAAwB,GAA6B,CAAC,EACxD,WAAW,GAAG,KAAK,EACnB,OAAO,GAAG,KAAK,EACf,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,KAAI;IACD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAe,CAAC,CAAC,KAAwB,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAChH,IAAA,MAAM,UAAU,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAE7C,MAAM,WAAW,GAAG,kBAAkB,CAAC;QACnC,KAAK,EAAE,UAAU,CAAC,MAAM;QACxB,UAAU;AACb,KAAA,CAAC,CAAC;AAEH,IAAA,MAAM,eAAe,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;AAE7D,IAAA,eAAe,CAAC,GAAG,GAAG,UAAU,CAAC;AAEjC,IAAA,MAAM,KAAK,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC;IAC5C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAC7B,KAAK,CAAC,MAA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W,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAE7E,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAE3D,IAAI,CAAC,WAAW,EAAE;QACd,QACIA,IAAC,OAAO,EAAA,EAAA,GAAK,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,CAAC,YACtE,QAAQ,EAAA,CACH,EACZ;KACL;AAED,IAAA,OAAOA,GAAC,CAAA,wBAAwB,EAAK,EAAA,GAAA,KAAK,GAAI,CAAC;AACnD,EAAE;AAMF,MAAM,wBAAwB,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,EAAwB,EAAE,GAAiC,KAAI;AAC/G,IAAA,OAAOA,gBAAS,IAAI,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AACvC,CAAC,CAAC;MAEW,eAAe,GAAG,UAAU,CAAC,wBAAwB;;;;"}
1
+ {"version":3,"file":"VirtualizedList.js","sources":["src/VirtualizedList/VirtualizedList.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n FC,\n type ForwardedRef,\n forwardRef,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactElement,\n useContext,\n useRef,\n} from 'react';\nimport { VirtualItem } from '@tanstack/virtual-core';\nimport classnames from 'classnames';\n\nimport { VirtualizedListContext } from '@hh.ru/magritte-ui-table/VirtualizedList/context';\nimport { useVirtualizedList } from '@hh.ru/magritte-ui-table/VirtualizedList/useVirtualizedList';\n\nimport styles from './virtualized-list.less';\n\ninterface VirtualizedListProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {\n ElementItem?: keyof JSX.IntrinsicElements & keyof HTMLElementTagNameMap;\n Element?: keyof JSX.IntrinsicElements & keyof HTMLElementTagNameMap;\n}\n\nconst ActivatedVirtualizedList: FC<VirtualizedListProps> = ({\n ElementItem = 'div',\n Element = 'div',\n className,\n children,\n ...rest\n}) => {\n const childArray = Children.toArray(children).filter<ReactElement>((e): e is ReactElement => isValidElement(e));\n const contentRef = useRef<HTMLElement>(null);\n\n const virtualizer = useVirtualizedList({\n count: childArray.length,\n contentRef,\n });\n\n const additionalProps: Record<string, unknown> = { ...rest };\n\n additionalProps.ref = contentRef;\n\n const items = virtualizer.getVirtualItems();\n const [paddingTop, paddingBottom] =\n items.length > 0\n ? [\n Math.max(0, items[0].start - virtualizer.options.scrollMargin),\n Math.max(\n 0,\n virtualizer.getTotalSize() - (items[items.length - 1].end - virtualizer.options.scrollMargin)\n ),\n ]\n : [0, 0];\n\n return (\n <Element {...additionalProps} className={classnames(styles.virtualizedList, className)}>\n {paddingTop > 0 && <ElementItem style={{ height: paddingTop }}></ElementItem>}\n {virtualizer.getVirtualItems().map((virtualItem) => {\n return cloneElement(childArray[virtualItem.index], {\n key: virtualItem.key,\n 'data-index': virtualItem.index,\n ref: virtualItem.measureElement,\n measure: virtualItem.measureElement,\n });\n })}\n {paddingBottom > 0 && <ElementItem style={{ height: paddingBottom }}></ElementItem>}\n </Element>\n );\n};\n\nexport const VirtualizedList: FC<VirtualizedListProps> = (props) => {\n const { Element = 'div', className, ElementItem, children, ...rest } = props;\n\n const { virtualized } = useContext(VirtualizedListContext);\n\n if (!virtualized) {\n return (\n <Element {...rest} className={classnames(styles.virtualizedList, className)}>\n {children}\n </Element>\n );\n }\n\n return <ActivatedVirtualizedList {...props} />;\n};\n\ninterface VirtualizedItemProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {\n measure?: VirtualItem<Element>['measureElement'];\n}\n\nconst VirtualizedItemComponent = ({ measure, ...rest }: VirtualizedItemProps, ref: ForwardedRef<HTMLDivElement>) => {\n return <div {...rest} ref={ref} />;\n};\n\nexport const VirtualizedItem = forwardRef(VirtualizedItemComponent);\n"],"names":[],"mappings":";;;;;;;;AA0BA,MAAM,2BAAqD,CAAC;AAAA,EACxD,WAAc,GAAA,KAAA;AAAA,EACd,OAAU,GAAA,KAAA;AAAA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;;"}
@@ -5,22 +5,48 @@ import classnames from 'classnames';
5
5
  import { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';
6
6
  import { useScrollbar, Scrollbar } from '@hh.ru/magritte-ui-scrollbar';
7
7
  import { VirtualizedListContext, DEFAULT_ITEM_HEIGHT } from './context.js';
8
- import { s as styles } from '../virtualized-list-CrBJZfKI.js';
8
+ import { s as styles } from '../virtualized-list-DZqJXIA7.js';
9
9
 
10
- const VirtualizedListWrapperComponent = ({ fixedSize, topPanel, bottomPanel, virtualized = true, measureElement, estimateSize = DEFAULT_ITEM_HEIGHT, children, }, ref) => {
11
- const { hasVerticalScroll, verticalScrollbarProps, ...vScrollbar } = useScrollbar({
12
- axis: fixedSize ? 'vertical' : 'none',
13
- });
14
- const contentRef = useRef(null);
15
- const wrapperRefCallback = useMultipleRefs(ref, vScrollbar.scrollContainerRef);
16
- const contentRefCallback = useMultipleRefs(contentRef, vScrollbar.contentWrapperRef);
17
- const value = useMemo(() => ({
18
- fixedSize,
19
- virtualized,
20
- measureElement,
21
- estimateSize,
22
- }), [fixedSize, virtualized, measureElement, estimateSize]);
23
- return (jsxs("div", { className: classnames(styles.virtualizedWrapper, vScrollbar.hoverContainerCssClass), children: [jsx("div", { className: classnames({ [styles.scrollWrapper]: fixedSize }), "data-virtualized-list-wrapper": true, ref: wrapperRefCallback, children: jsxs(VirtualizedListContext.Provider, { value: value, children: [topPanel, jsx("div", { ref: contentRefCallback, "data-virtualized-list-content": true, children: children }), bottomPanel] }) }), hasVerticalScroll && jsx(Scrollbar, { className: styles.verticalScrollbar, ...verticalScrollbarProps })] }));
10
+ const VirtualizedListWrapperComponent = ({
11
+ fixedSize,
12
+ topPanel,
13
+ bottomPanel,
14
+ virtualized = true,
15
+ measureElement,
16
+ estimateSize = DEFAULT_ITEM_HEIGHT,
17
+ children
18
+ }, ref) => {
19
+ const { hasVerticalScroll, verticalScrollbarProps, ...vScrollbar } = useScrollbar({
20
+ axis: fixedSize ? "vertical" : "none"
21
+ });
22
+ const contentRef = useRef(null);
23
+ const wrapperRefCallback = useMultipleRefs(ref, vScrollbar.scrollContainerRef);
24
+ const contentRefCallback = useMultipleRefs(contentRef, vScrollbar.contentWrapperRef);
25
+ const value = useMemo(
26
+ () => ({
27
+ fixedSize,
28
+ virtualized,
29
+ measureElement,
30
+ estimateSize
31
+ }),
32
+ [fixedSize, virtualized, measureElement, estimateSize]
33
+ );
34
+ return /* @__PURE__ */ jsxs("div", { className: classnames(styles.virtualizedWrapper, vScrollbar.hoverContainerCssClass), children: [
35
+ /* @__PURE__ */ jsx(
36
+ "div",
37
+ {
38
+ className: classnames({ [styles.scrollWrapper]: fixedSize }),
39
+ "data-virtualized-list-wrapper": true,
40
+ ref: wrapperRefCallback,
41
+ children: /* @__PURE__ */ jsxs(VirtualizedListContext.Provider, { value, children: [
42
+ topPanel,
43
+ /* @__PURE__ */ jsx("div", { ref: contentRefCallback, "data-virtualized-list-content": true, children }),
44
+ bottomPanel
45
+ ] })
46
+ }
47
+ ),
48
+ hasVerticalScroll && /* @__PURE__ */ jsx(Scrollbar, { className: styles.verticalScrollbar, ...verticalScrollbarProps })
49
+ ] });
24
50
  };
25
51
  const VirtualizedListWrapper = forwardRef(VirtualizedListWrapperComponent);
26
52
 
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedListWrapper.js","sources":["src/VirtualizedList/VirtualizedListWrapper.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, PropsWithChildren, ReactNode, useMemo, useRef } from 'react';\nimport { VirtualizerOptions } from '@tanstack/virtual-core';\nimport classnames from 'classnames';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Scrollbar, useScrollbar } from '@hh.ru/magritte-ui-scrollbar';\nimport { VirtualizedListContext, DEFAULT_ITEM_HEIGHT } from '@hh.ru/magritte-ui-table/VirtualizedList/context';\n\nimport styles from './virtualized-list.less';\n\ninterface VirtualizedListWrapperProps extends PropsWithChildren {\n /** Находится ли список в блоке ограниченной высоты */\n fixedSize?: boolean;\n /** Верхняя панель */\n topPanel?: ReactNode;\n /** Нижняя панель */\n bottomPanel?: ReactNode;\n /** Включена ли виртуализация */\n virtualized?: boolean;\n /** Функция для замера размеров айтема списка (по умолчанию используется getBoundingClientRect.height) */\n measureElement?: VirtualizerOptions<HTMLElement, Element>['measureElement'];\n /** Предполагаемая высота айтема (по умолчанию 80px) */\n estimateSize?: number;\n}\n\nconst VirtualizedListWrapperComponent = (\n {\n fixedSize,\n topPanel,\n bottomPanel,\n virtualized = true,\n measureElement,\n estimateSize = DEFAULT_ITEM_HEIGHT,\n children,\n }: VirtualizedListWrapperProps,\n ref: ForwardedRef<HTMLDivElement>\n) => {\n const { hasVerticalScroll, verticalScrollbarProps, ...vScrollbar } = useScrollbar({\n axis: fixedSize ? 'vertical' : 'none',\n });\n const contentRef = useRef<HTMLDivElement>(null);\n const wrapperRefCallback = useMultipleRefs(ref, vScrollbar.scrollContainerRef);\n const contentRefCallback = useMultipleRefs(contentRef, vScrollbar.contentWrapperRef);\n\n const value = useMemo(\n () => ({\n fixedSize,\n virtualized,\n measureElement,\n estimateSize,\n }),\n [fixedSize, virtualized, measureElement, estimateSize]\n );\n\n return (\n <div className={classnames(styles.virtualizedWrapper, vScrollbar.hoverContainerCssClass)}>\n <div\n className={classnames({ [styles.scrollWrapper]: fixedSize })}\n data-virtualized-list-wrapper\n ref={wrapperRefCallback}\n >\n <VirtualizedListContext.Provider value={value}>\n {topPanel}\n <div ref={contentRefCallback} data-virtualized-list-content>\n {children}\n </div>\n {bottomPanel}\n </VirtualizedListContext.Provider>\n </div>\n {hasVerticalScroll && <Scrollbar className={styles.verticalScrollbar} {...verticalScrollbarProps} />}\n </div>\n );\n};\n\nexport const VirtualizedListWrapper = forwardRef(VirtualizedListWrapperComponent);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAyBA,MAAM,+BAA+B,GAAG,CACpC,EACI,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW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,CAAA,SAAS,IAAC,SAAS,EAAE,MAAM,CAAC,iBAAiB,EAAM,GAAA,sBAAsB,EAAI,CAAA,CAAA,EAAA,CAClG,EACR;AACN,CAAC,CAAC;MAEW,sBAAsB,GAAG,UAAU,CAAC,+BAA+B;;;;"}
1
+ {"version":3,"file":"VirtualizedListWrapper.js","sources":["src/VirtualizedList/VirtualizedListWrapper.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, PropsWithChildren, ReactNode, useMemo, useRef } from 'react';\nimport { VirtualizerOptions } from '@tanstack/virtual-core';\nimport classnames from 'classnames';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Scrollbar, useScrollbar } from '@hh.ru/magritte-ui-scrollbar';\nimport { VirtualizedListContext, DEFAULT_ITEM_HEIGHT } from '@hh.ru/magritte-ui-table/VirtualizedList/context';\n\nimport styles from './virtualized-list.less';\n\ninterface VirtualizedListWrapperProps extends PropsWithChildren {\n /** Находится ли список в блоке ограниченной высоты */\n fixedSize?: boolean;\n /** Верхняя панель */\n topPanel?: ReactNode;\n /** Нижняя панель */\n bottomPanel?: ReactNode;\n /** Включена ли виртуализация */\n virtualized?: boolean;\n /** Функция для замера размеров айтема списка (по умолчанию используется getBoundingClientRect.height) */\n measureElement?: VirtualizerOptions<HTMLElement, Element>['measureElement'];\n /** Предполагаемая высота айтема (по умолчанию 80px) */\n estimateSize?: number;\n}\n\nconst VirtualizedListWrapperComponent = (\n {\n fixedSize,\n topPanel,\n bottomPanel,\n virtualized = true,\n measureElement,\n estimateSize = DEFAULT_ITEM_HEIGHT,\n children,\n }: VirtualizedListWrapperProps,\n ref: ForwardedRef<HTMLDivElement>\n) => {\n const { hasVerticalScroll, verticalScrollbarProps, ...vScrollbar } = useScrollbar({\n axis: fixedSize ? 'vertical' : 'none',\n });\n const contentRef = useRef<HTMLDivElement>(null);\n const wrapperRefCallback = useMultipleRefs(ref, vScrollbar.scrollContainerRef);\n const contentRefCallback = useMultipleRefs(contentRef, vScrollbar.contentWrapperRef);\n\n const value = useMemo(\n () => ({\n fixedSize,\n virtualized,\n measureElement,\n estimateSize,\n }),\n [fixedSize, virtualized, measureElement, estimateSize]\n );\n\n return (\n <div className={classnames(styles.virtualizedWrapper, vScrollbar.hoverContainerCssClass)}>\n <div\n className={classnames({ [styles.scrollWrapper]: fixedSize })}\n data-virtualized-list-wrapper\n ref={wrapperRefCallback}\n >\n <VirtualizedListContext.Provider value={value}>\n {topPanel}\n <div ref={contentRefCallback} data-virtualized-list-content>\n {children}\n </div>\n {bottomPanel}\n </VirtualizedListContext.Provider>\n </div>\n {hasVerticalScroll && <Scrollbar className={styles.verticalScrollbar} {...verticalScrollbarProps} />}\n </div>\n );\n};\n\nexport const VirtualizedListWrapper = forwardRef(VirtualizedListWrapperComponent);\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,kCAAkC,CACpC;AAAA,EACI,SAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAc,GAAA,IAAA;AAAA,EACd,cAAA;AAAA,EACA,YAAe,GAAA,mBAAA;AAAA,EACf,QAAA;AACJ,CAAA,EACA,GACC,KAAA;AACD,EAAA,MAAM,EAAE,iBAAmB,EAAA,sBAAA,EAAwB,GAAG,UAAA,KAAe,YAAa,CAAA;AAAA,IAC9E,IAAA,EAAM,YAAY,UAAa,GAAA,MAAA;AAAA,GAClC,CAAA,CAAA;AACD,EAAM,MAAA,UAAA,GAAa,OAAuB,IAAI,CAAA,CAAA;AAC9C,EAAA,MAAM,kBAAqB,GAAA,eAAA,CAAgB,GAAK,EAAA,UAAA,CAAW,kBAAkB,CAAA,CAAA;AAC7E,EAAA,MAAM,kBAAqB,GAAA,eAAA,CAAgB,UAAY,EAAA,UAAA,CAAW,iBAAiB,CAAA,CAAA;AAEnF,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACV,OAAO;AAAA,MACH,SAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA,YAAA;AAAA,KACJ,CAAA;AAAA,IACA,CAAC,SAAA,EAAW,WAAa,EAAA,cAAA,EAAgB,YAAY,CAAA;AAAA,GACzD,CAAA;AAEA,EACI,uBAAA,IAAA,CAAC,SAAI,SAAW,EAAA,UAAA,CAAW,OAAO,kBAAoB,EAAA,UAAA,CAAW,sBAAsB,CACnF,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACG,SAAA,EAAW,WAAW,EAAE,CAAC,OAAO,aAAa,GAAG,WAAW,CAAA;AAAA,QAC3D,+BAA6B,EAAA,IAAA;AAAA,QAC7B,GAAK,EAAA,kBAAA;AAAA,QAEL,QAAC,kBAAA,IAAA,CAAA,sBAAA,CAAuB,QAAvB,EAAA,EAAgC,KAC5B,EAAA,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,8BACA,KAAI,EAAA,EAAA,GAAA,EAAK,kBAAoB,EAAA,+BAAA,EAA6B,MACtD,QACL,EAAA,CAAA;AAAA,UACC,WAAA;AAAA,SACL,EAAA,CAAA;AAAA,OAAA;AAAA,KACJ;AAAA,IACC,qCAAsB,GAAA,CAAA,SAAA,EAAA,EAAU,WAAW,MAAO,CAAA,iBAAA,EAAoB,GAAG,sBAAwB,EAAA,CAAA;AAAA,GACtG,EAAA,CAAA,CAAA;AAER,CAAA,CAAA;AAEa,MAAA,sBAAA,GAAyB,WAAW,+BAA+B;;;;"}
@@ -1,14 +1,20 @@
1
1
  import './../index.css';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import classnames from 'classnames';
4
- import { s as styles } from '../virtualized-list-CrBJZfKI.js';
4
+ import { s as styles } from '../virtualized-list-DZqJXIA7.js';
5
5
 
6
- const VirtualizedPanel = ({ stickyTop, stickyBottom, style = 'primary', children }) => {
7
- return (jsx("div", { className: classnames(styles.panelContainer, styles.topPanel, {
8
- [styles[`panel-style-${style}`]]: style,
9
- [styles.stickyTop]: stickyTop,
10
- [styles.stickyBottom]: stickyBottom,
11
- }), children: jsx("div", { className: classnames(styles.panel), children: children }) }));
6
+ const VirtualizedPanel = ({ stickyTop, stickyBottom, style = "primary", children }) => {
7
+ return /* @__PURE__ */ jsx(
8
+ "div",
9
+ {
10
+ className: classnames(styles.panelContainer, styles.topPanel, {
11
+ [styles[`panel-style-${style}`]]: style,
12
+ [styles.stickyTop]: stickyTop,
13
+ [styles.stickyBottom]: stickyBottom
14
+ }),
15
+ children: /* @__PURE__ */ jsx("div", { className: classnames(styles.panel), children })
16
+ }
17
+ );
12
18
  };
13
19
 
14
20
  export { VirtualizedPanel };
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedPanel.js","sources":["src/VirtualizedList/VirtualizedPanel.tsx"],"sourcesContent":["import { FC, PropsWithChildren } from 'react';\nimport classnames from 'classnames';\n\nimport { TokenColorBackground } from '@hh.ru/magritte-design-tokens/types';\n\nimport styles from './virtualized-list.less';\n\ninterface PanelProps extends PropsWithChildren {\n /** Прилипает ли панель сверху */\n stickyTop?: boolean;\n /** Прилипает ли панель снизу */\n stickyBottom?: boolean;\n /** Цвет фона */\n style?: TokenColorBackground;\n}\n\nexport const VirtualizedPanel: FC<PanelProps> = ({ stickyTop, stickyBottom, style = 'primary', children }) => {\n return (\n <div\n className={classnames(styles.panelContainer, styles.topPanel, {\n [styles[`panel-style-${style}`]]: style,\n [styles.stickyTop]: stickyTop,\n [styles.stickyBottom]: stickyBottom,\n })}\n >\n <div className={classnames(styles.panel)}>{children}</div>\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;AAgBa,MAAA,gBAAgB,GAAmB,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,EAAE,KAAI;AACzG,IAAA,QACIA,GAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC1D,CAAC,MAAM,CAAC,CAAe,YAAA,EAAA,KAAK,EAAE,CAAC,GAAG,KAAK;AACvC,YAAA,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS;AAC7B,YAAA,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY;AACtC,SAAA,CAAC,EAEF,QAAA,EAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAG,QAAA,EAAA,QAAQ,EAAO,CAAA,EAAA,CACxD,EACR;AACN;;;;"}
1
+ {"version":3,"file":"VirtualizedPanel.js","sources":["src/VirtualizedList/VirtualizedPanel.tsx"],"sourcesContent":["import { FC, PropsWithChildren } from 'react';\nimport classnames from 'classnames';\n\nimport { TokenColorBackground } from '@hh.ru/magritte-design-tokens/types';\n\nimport styles from './virtualized-list.less';\n\ninterface PanelProps extends PropsWithChildren {\n /** Прилипает ли панель сверху */\n stickyTop?: boolean;\n /** Прилипает ли панель снизу */\n stickyBottom?: boolean;\n /** Цвет фона */\n style?: TokenColorBackground;\n}\n\nexport const VirtualizedPanel: FC<PanelProps> = ({ stickyTop, stickyBottom, style = 'primary', children }) => {\n return (\n <div\n className={classnames(styles.panelContainer, styles.topPanel, {\n [styles[`panel-style-${style}`]]: style,\n [styles.stickyTop]: stickyTop,\n [styles.stickyBottom]: stickyBottom,\n })}\n >\n <div className={classnames(styles.panel)}>{children}</div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AAgBa,MAAA,gBAAA,GAAmC,CAAC,EAAE,SAAA,EAAW,cAAc,KAAQ,GAAA,SAAA,EAAW,UAAe,KAAA;AAC1G,EACI,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACG,SAAW,EAAA,UAAA,CAAW,MAAO,CAAA,cAAA,EAAgB,OAAO,QAAU,EAAA;AAAA,QAC1D,CAAC,MAAO,CAAA,CAAA,YAAA,EAAe,KAAK,CAAA,CAAE,CAAC,GAAG,KAAA;AAAA,QAClC,CAAC,MAAO,CAAA,SAAS,GAAG,SAAA;AAAA,QACpB,CAAC,MAAO,CAAA,YAAY,GAAG,YAAA;AAAA,OAC1B,CAAA;AAAA,MAED,8BAAC,KAAI,EAAA,EAAA,SAAA,EAAW,WAAW,MAAO,CAAA,KAAK,GAAI,QAAS,EAAA,CAAA;AAAA,KAAA;AAAA,GACxD,CAAA;AAER;;;;"}
@@ -3,7 +3,7 @@ import { createContext } from 'react';
3
3
 
4
4
  const DEFAULT_ITEM_HEIGHT = 80;
5
5
  const VirtualizedListContext = createContext({
6
- estimateSize: DEFAULT_ITEM_HEIGHT,
6
+ estimateSize: DEFAULT_ITEM_HEIGHT
7
7
  });
8
8
 
9
9
  export { DEFAULT_ITEM_HEIGHT, VirtualizedListContext };
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["src/VirtualizedList/context.tsx"],"sourcesContent":["import { createContext } from 'react';\nimport { VirtualizerOptions } from '@tanstack/virtual-core';\n\nexport const DEFAULT_ITEM_HEIGHT = 80;\n\nexport interface VirtualizedListContextProps {\n fixedSize?: boolean;\n virtualized?: boolean;\n measureElement?: VirtualizerOptions<HTMLElement, Element>['measureElement'];\n estimateSize: number;\n}\n\nexport const VirtualizedListContext = createContext<VirtualizedListContextProps>({\n estimateSize: DEFAULT_ITEM_HEIGHT,\n});\n"],"names":[],"mappings":";;AAGO,MAAM,mBAAmB,GAAG,GAAG;AAS/B,MAAM,sBAAsB,GAAG,aAAa,CAA8B;AAC7E,IAAA,YAAY,EAAE,mBAAmB;AACpC,CAAA;;;;"}
1
+ {"version":3,"file":"context.js","sources":["src/VirtualizedList/context.tsx"],"sourcesContent":["import { createContext } from 'react';\nimport { VirtualizerOptions } from '@tanstack/virtual-core';\n\nexport const DEFAULT_ITEM_HEIGHT = 80;\n\nexport interface VirtualizedListContextProps {\n fixedSize?: boolean;\n virtualized?: boolean;\n measureElement?: VirtualizerOptions<HTMLElement, Element>['measureElement'];\n estimateSize: number;\n}\n\nexport const VirtualizedListContext = createContext<VirtualizedListContextProps>({\n estimateSize: DEFAULT_ITEM_HEIGHT,\n});\n"],"names":[],"mappings":";;AAGO,MAAM,mBAAsB,GAAA,GAAA;AAS5B,MAAM,yBAAyB,aAA2C,CAAA;AAAA,EAC7E,YAAc,EAAA,mBAAA;AAClB,CAAC;;;;"}
@@ -1,3 +1,3 @@
1
- export * from '@hh.ru/magritte-ui-table/VirtualizedList/VirtualizedListWrapper';
2
- export * from '@hh.ru/magritte-ui-table/VirtualizedList/VirtualizedList';
3
- export * from '@hh.ru/magritte-ui-table/VirtualizedList/VirtualizedPanel';
1
+ export * from '../VirtualizedList/VirtualizedListWrapper';
2
+ export * from '../VirtualizedList/VirtualizedList';
3
+ export * from '../VirtualizedList/VirtualizedPanel';
@@ -8,7 +8,7 @@ import 'classnames';
8
8
  import '@hh.ru/magritte-common-use-multiple-refs';
9
9
  import '@hh.ru/magritte-ui-scrollbar';
10
10
  import './context.js';
11
- import '../virtualized-list-CrBJZfKI.js';
11
+ import '../virtualized-list-DZqJXIA7.js';
12
12
  import './useVirtualizedList.js';
13
13
  import '@tanstack/react-virtual';
14
14
  //# sourceMappingURL=index.js.map
@@ -4,39 +4,35 @@ import { useVirtualizer, useWindowVirtualizer } from '@tanstack/react-virtual';
4
4
  import { VirtualizedListContext } from './context.js';
5
5
 
6
6
  const useVirtualizedList = ({ count, contentRef }) => {
7
- const { fixedSize, measureElement, estimateSize } = useContext(VirtualizedListContext);
8
- const getScrollMargin = () => {
9
- if (!contentRef.current) {
10
- return 0;
11
- }
12
- if (fixedSize) {
13
- const containerElement = contentRef.current.closest('[data-virtualized-list-content]');
14
- return contentRef?.current.offsetTop + (containerElement?.offsetTop ?? 0);
15
- }
16
- return contentRef.current
17
- ? document.documentElement.scrollTop + contentRef.current.getBoundingClientRect().top
18
- : 0;
19
- };
20
- const virtualizerOptions = {
21
- count,
22
- estimateSize: () => estimateSize,
23
- overscan: 5,
24
- measureElement,
25
- scrollMargin: getScrollMargin(),
26
- initialRect: { width: 0, height: 5 * estimateSize },
27
- };
28
- const virtualizerHook = (fixedSize ? useVirtualizer : useWindowVirtualizer);
29
- const virtualizer = virtualizerHook({
30
- ...virtualizerOptions,
31
- ...(fixedSize
32
- ? {
33
- getScrollElement: () => {
34
- return contentRef.current?.closest('[data-virtualized-list-wrapper]') || null;
35
- },
36
- }
37
- : {}),
38
- });
39
- return virtualizer;
7
+ const { fixedSize, measureElement, estimateSize } = useContext(VirtualizedListContext);
8
+ const getScrollMargin = () => {
9
+ if (!contentRef.current) {
10
+ return 0;
11
+ }
12
+ if (fixedSize) {
13
+ const containerElement = contentRef.current.closest("[data-virtualized-list-content]");
14
+ return contentRef?.current.offsetTop + (containerElement?.offsetTop ?? 0);
15
+ }
16
+ return contentRef.current ? document.documentElement.scrollTop + contentRef.current.getBoundingClientRect().top : 0;
17
+ };
18
+ const virtualizerOptions = {
19
+ count,
20
+ estimateSize: () => estimateSize,
21
+ overscan: 5,
22
+ measureElement,
23
+ scrollMargin: getScrollMargin(),
24
+ initialRect: { width: 0, height: 5 * estimateSize }
25
+ };
26
+ const virtualizerHook = fixedSize ? useVirtualizer : useWindowVirtualizer;
27
+ const virtualizer = virtualizerHook({
28
+ ...virtualizerOptions,
29
+ ...fixedSize ? {
30
+ getScrollElement: () => {
31
+ return contentRef.current?.closest("[data-virtualized-list-wrapper]") || null;
32
+ }
33
+ } : {}
34
+ });
35
+ return virtualizer;
40
36
  };
41
37
 
42
38
  export { useVirtualizedList };