cozy-ui 126.3.0 → 126.4.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [126.4.0](https://github.com/cozy/cozy-ui/compare/v126.3.0...v126.4.0) (2025-06-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * **VirtualizedTable:** Lazy load dragndrop components ([620846e](https://github.com/cozy/cozy-ui/commit/620846e))
7
+
1
8
  # [126.3.0](https://github.com/cozy/cozy-ui/compare/v126.2.0...v126.3.0) (2025-06-17)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "126.3.0",
3
+ "version": "126.4.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -1,12 +1,15 @@
1
1
  import React, { useState, forwardRef } from 'react'
2
2
  import { TableVirtuoso } from 'react-virtuoso'
3
3
 
4
- import CustomDragLayer from './Dnd/CustomDrag/CustomDragLayer'
5
4
  import FixedHeaderContent from './FixedHeaderContent'
6
5
  import RowContent from './RowContent'
7
6
  import { stableSort, getComparator } from './helpers'
8
7
  import virtuosoComponents from './virtuosoComponents'
9
8
 
9
+ const CustomDragLayer = React.lazy(() =>
10
+ import('./Dnd/CustomDrag/CustomDragLayer')
11
+ )
12
+
10
13
  const VirtualizedTable = forwardRef(
11
14
  (
12
15
  {
@@ -91,14 +94,14 @@ VirtualizedTable.displayName = 'VirtualizedTable'
91
94
  const VirtuosoTableWrapper = props => {
92
95
  if (!props.dragProps?.enabled) {
93
96
  return <VirtualizedTable {...props} />
97
+ } else {
98
+ return (
99
+ <React.Suspense>
100
+ <CustomDragLayer dragId={props.dragProps.dragId} />
101
+ <VirtualizedTable {...props} />
102
+ </React.Suspense>
103
+ )
94
104
  }
95
-
96
- return (
97
- <>
98
- <CustomDragLayer dragId={props.dragProps.dragId} />
99
- <VirtualizedTable {...props} />
100
- </>
101
- )
102
105
  }
103
106
 
104
107
  export default VirtuosoTableWrapper
@@ -1,7 +1,5 @@
1
1
  import React, { forwardRef } from 'react'
2
2
 
3
- import DnDConfigWrapper from './Dnd/DnDConfigWrapper'
4
- import TableRowDnD from './Dnd/TableRow'
5
3
  import Table from '..'
6
4
  import Paper from '../../Paper'
7
5
  import TableBody from '../../TableBody'
@@ -10,6 +8,9 @@ import TableFooter from '../../TableFooter'
10
8
  import TableHead from '../../TableHead'
11
9
  import TableRow from '../../TableRow'
12
10
 
11
+ const DnDConfigWrapper = React.lazy(() => import('./Dnd/DnDConfigWrapper'))
12
+ const TableRowDnD = React.lazy(() => import('./Dnd/TableRow'))
13
+
13
14
  const _TableContainer = forwardRef((props, ref) => (
14
15
  <TableContainer
15
16
  {...props}
@@ -25,13 +26,15 @@ const virtuosoComponents = {
25
26
  Scroller: forwardRef(({ context, ...props }, ref) => {
26
27
  if (!context.dragProps?.enabled) {
27
28
  return <_TableContainer {...props} ref={ref} />
29
+ } else {
30
+ return (
31
+ <React.Suspense>
32
+ <DnDConfigWrapper ref={ref}>
33
+ <_TableContainer {...props} ref={ref} />
34
+ </DnDConfigWrapper>
35
+ </React.Suspense>
36
+ )
28
37
  }
29
-
30
- return (
31
- <DnDConfigWrapper ref={ref}>
32
- <_TableContainer {...props} ref={ref} />
33
- </DnDConfigWrapper>
34
- )
35
38
  }),
36
39
  Table: forwardRef((props, ref) => <Table {...props} ref={ref} />),
37
40
  TableHead: forwardRef((props, ref) => <TableHead {...props} ref={ref} />),
@@ -43,18 +46,20 @@ const virtuosoComponents = {
43
46
 
44
47
  if (!context.dragProps?.enabled) {
45
48
  return <TableRow {...props} ref={ref} selected={isSelected} hover />
49
+ } else {
50
+ return (
51
+ <React.Suspense>
52
+ <TableRowDnD
53
+ {...props}
54
+ item={item}
55
+ context={context}
56
+ selected={isSelected}
57
+ disabled={isDisabled}
58
+ hover
59
+ />
60
+ </React.Suspense>
61
+ )
46
62
  }
47
-
48
- return (
49
- <TableRowDnD
50
- {...props}
51
- item={item}
52
- context={context}
53
- selected={isSelected}
54
- disabled={isDisabled}
55
- hover
56
- />
57
- )
58
63
  })
59
64
  }
60
65
 
@@ -4,11 +4,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
4
4
  var _excluded = ["rows", "columns", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "dragProps"];
5
5
  import React, { useState, forwardRef } from 'react';
6
6
  import { TableVirtuoso } from 'react-virtuoso';
7
- import CustomDragLayer from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer";
8
7
  import FixedHeaderContent from "cozy-ui/transpiled/react/Table/Virtualized/FixedHeaderContent";
9
8
  import RowContent from "cozy-ui/transpiled/react/Table/Virtualized/RowContent";
10
9
  import { stableSort, getComparator } from "cozy-ui/transpiled/react/Table/Virtualized/helpers";
11
10
  import virtuosoComponents from "cozy-ui/transpiled/react/Table/Virtualized/virtuosoComponents";
11
+ var CustomDragLayer = /*#__PURE__*/React.lazy(function () {
12
+ return import('./Dnd/CustomDrag/CustomDragLayer');
13
+ });
12
14
  var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
13
15
  var rows = _ref.rows,
14
16
  columns = _ref.columns,
@@ -105,11 +107,11 @@ var VirtuosoTableWrapper = function VirtuosoTableWrapper(props) {
105
107
 
106
108
  if (!((_props$dragProps = props.dragProps) !== null && _props$dragProps !== void 0 && _props$dragProps.enabled)) {
107
109
  return /*#__PURE__*/React.createElement(VirtualizedTable, props);
110
+ } else {
111
+ return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
112
+ dragId: props.dragProps.dragId
113
+ }), /*#__PURE__*/React.createElement(VirtualizedTable, props));
108
114
  }
109
-
110
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
111
- dragId: props.dragProps.dragId
112
- }), /*#__PURE__*/React.createElement(VirtualizedTable, props));
113
115
  };
114
116
 
115
117
  export default VirtuosoTableWrapper;
@@ -9,8 +9,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
9
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
10
 
11
11
  import React, { forwardRef } from 'react';
12
- import DnDConfigWrapper from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/DnDConfigWrapper";
13
- import TableRowDnD from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/TableRow";
14
12
  import Table from "cozy-ui/transpiled/react/Table";
15
13
  import Paper from "cozy-ui/transpiled/react/Paper";
16
14
  import TableBody from "cozy-ui/transpiled/react/TableBody";
@@ -18,6 +16,12 @@ import TableContainer from "cozy-ui/transpiled/react/TableContainer";
18
16
  import TableFooter from "cozy-ui/transpiled/react/TableFooter";
19
17
  import TableHead from "cozy-ui/transpiled/react/TableHead";
20
18
  import TableRow from "cozy-ui/transpiled/react/TableRow";
19
+ var DnDConfigWrapper = /*#__PURE__*/React.lazy(function () {
20
+ return import('./Dnd/DnDConfigWrapper');
21
+ });
22
+ var TableRowDnD = /*#__PURE__*/React.lazy(function () {
23
+ return import('./Dnd/TableRow');
24
+ });
21
25
 
22
26
  var _TableContainer = /*#__PURE__*/forwardRef(function (props, ref) {
23
27
  return /*#__PURE__*/React.createElement(TableContainer, _extends({}, props, {
@@ -42,13 +46,13 @@ var virtuosoComponents = {
42
46
  return /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
43
47
  ref: ref
44
48
  }));
49
+ } else {
50
+ return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(DnDConfigWrapper, {
51
+ ref: ref
52
+ }, /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
53
+ ref: ref
54
+ }))));
45
55
  }
46
-
47
- return /*#__PURE__*/React.createElement(DnDConfigWrapper, {
48
- ref: ref
49
- }, /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
50
- ref: ref
51
- })));
52
56
  }),
53
57
  Table: /*#__PURE__*/forwardRef(function (props, ref) {
54
58
  return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
@@ -86,15 +90,15 @@ var virtuosoComponents = {
86
90
  selected: isSelected,
87
91
  hover: true
88
92
  }));
93
+ } else {
94
+ return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(TableRowDnD, _extends({}, props, {
95
+ item: item,
96
+ context: context,
97
+ selected: isSelected,
98
+ disabled: isDisabled,
99
+ hover: true
100
+ })));
89
101
  }
90
-
91
- return /*#__PURE__*/React.createElement(TableRowDnD, _extends({}, props, {
92
- item: item,
93
- context: context,
94
- selected: isSelected,
95
- disabled: isDisabled,
96
- hover: true
97
- }));
98
102
  })
99
103
  };
100
104
  export default virtuosoComponents;