cozy-ui 126.4.0 → 126.5.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,15 @@
|
|
|
1
|
+
# [126.5.0](https://github.com/cozy/cozy-ui/compare/v126.4.0...v126.5.0) (2025-06-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **VirtualizedTable:** Remove using react suspense ([a1f8030](https://github.com/cozy/cozy-ui/commit/a1f8030))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **VirtualizedTable:** Add some prop spread to better give controls ([4b080e6](https://github.com/cozy/cozy-ui/commit/4b080e6))
|
|
12
|
+
|
|
1
13
|
# [126.4.0](https://github.com/cozy/cozy-ui/compare/v126.3.0...v126.4.0) (2025-06-17)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import React, { useState, forwardRef } from 'react'
|
|
2
2
|
import { TableVirtuoso } from 'react-virtuoso'
|
|
3
3
|
|
|
4
|
+
import CustomDragLayer from './Dnd/CustomDrag/CustomDragLayer'
|
|
4
5
|
import FixedHeaderContent from './FixedHeaderContent'
|
|
5
6
|
import RowContent from './RowContent'
|
|
6
7
|
import { stableSort, getComparator } from './helpers'
|
|
7
8
|
import virtuosoComponents from './virtuosoComponents'
|
|
8
9
|
|
|
9
|
-
const CustomDragLayer = React.lazy(() =>
|
|
10
|
-
import('./Dnd/CustomDrag/CustomDragLayer')
|
|
11
|
-
)
|
|
12
|
-
|
|
13
10
|
const VirtualizedTable = forwardRef(
|
|
14
11
|
(
|
|
15
12
|
{
|
|
@@ -17,12 +14,14 @@ const VirtualizedTable = forwardRef(
|
|
|
17
14
|
columns,
|
|
18
15
|
defaultOrder,
|
|
19
16
|
secondarySort,
|
|
20
|
-
selectedItems
|
|
21
|
-
onSelect
|
|
22
|
-
onSelectAll
|
|
23
|
-
isSelectedItem
|
|
17
|
+
selectedItems,
|
|
18
|
+
onSelect,
|
|
19
|
+
onSelectAll,
|
|
20
|
+
isSelectedItem,
|
|
24
21
|
componentsProps,
|
|
25
22
|
dragProps,
|
|
23
|
+
context,
|
|
24
|
+
components,
|
|
26
25
|
...props
|
|
27
26
|
},
|
|
28
27
|
ref
|
|
@@ -54,15 +53,17 @@ const VirtualizedTable = forwardRef(
|
|
|
54
53
|
ref={ref}
|
|
55
54
|
data={data}
|
|
56
55
|
context={{
|
|
56
|
+
...context,
|
|
57
57
|
isSelectedItem,
|
|
58
58
|
selectedItems,
|
|
59
59
|
dragProps,
|
|
60
60
|
itemsInDropProcess,
|
|
61
61
|
setItemsInDropProcess
|
|
62
62
|
}}
|
|
63
|
-
components={virtuosoComponents}
|
|
63
|
+
components={components || virtuosoComponents}
|
|
64
64
|
fixedHeaderContent={() => (
|
|
65
65
|
<FixedHeaderContent
|
|
66
|
+
{...componentsProps?.FixedHeaderContent}
|
|
66
67
|
columns={columns}
|
|
67
68
|
rowCount={rows.length}
|
|
68
69
|
selectedCount={selectedItems.length}
|
|
@@ -74,6 +75,7 @@ const VirtualizedTable = forwardRef(
|
|
|
74
75
|
)}
|
|
75
76
|
itemContent={(_index, row) => (
|
|
76
77
|
<RowContent
|
|
78
|
+
{...componentsProps?.RowContent}
|
|
77
79
|
index={_index}
|
|
78
80
|
row={row}
|
|
79
81
|
columns={columns}
|
|
@@ -91,15 +93,22 @@ const VirtualizedTable = forwardRef(
|
|
|
91
93
|
|
|
92
94
|
VirtualizedTable.displayName = 'VirtualizedTable'
|
|
93
95
|
|
|
96
|
+
VirtualizedTable.defaultProps = {
|
|
97
|
+
selectedItems: [],
|
|
98
|
+
isSelectedItem: () => {},
|
|
99
|
+
onSelect: () => {},
|
|
100
|
+
onSelectAll: () => {}
|
|
101
|
+
}
|
|
102
|
+
|
|
94
103
|
const VirtuosoTableWrapper = props => {
|
|
95
104
|
if (!props.dragProps?.enabled) {
|
|
96
105
|
return <VirtualizedTable {...props} />
|
|
97
106
|
} else {
|
|
98
107
|
return (
|
|
99
|
-
|
|
108
|
+
<>
|
|
100
109
|
<CustomDragLayer dragId={props.dragProps.dragId} />
|
|
101
110
|
<VirtualizedTable {...props} />
|
|
102
|
-
|
|
111
|
+
</>
|
|
103
112
|
)
|
|
104
113
|
}
|
|
105
114
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
|
|
3
|
+
import DnDConfigWrapper from './Dnd/DnDConfigWrapper'
|
|
4
|
+
import TableRowDnD from './Dnd/TableRow'
|
|
3
5
|
import Table from '..'
|
|
4
6
|
import Paper from '../../Paper'
|
|
5
7
|
import TableBody from '../../TableBody'
|
|
@@ -8,9 +10,6 @@ import TableFooter from '../../TableFooter'
|
|
|
8
10
|
import TableHead from '../../TableHead'
|
|
9
11
|
import TableRow from '../../TableRow'
|
|
10
12
|
|
|
11
|
-
const DnDConfigWrapper = React.lazy(() => import('./Dnd/DnDConfigWrapper'))
|
|
12
|
-
const TableRowDnD = React.lazy(() => import('./Dnd/TableRow'))
|
|
13
|
-
|
|
14
13
|
const _TableContainer = forwardRef((props, ref) => (
|
|
15
14
|
<TableContainer
|
|
16
15
|
{...props}
|
|
@@ -28,11 +27,9 @@ const virtuosoComponents = {
|
|
|
28
27
|
return <_TableContainer {...props} ref={ref} />
|
|
29
28
|
} else {
|
|
30
29
|
return (
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
</DnDConfigWrapper>
|
|
35
|
-
</React.Suspense>
|
|
30
|
+
<DnDConfigWrapper ref={ref}>
|
|
31
|
+
<_TableContainer {...props} ref={ref} />
|
|
32
|
+
</DnDConfigWrapper>
|
|
36
33
|
)
|
|
37
34
|
}
|
|
38
35
|
}),
|
|
@@ -48,16 +45,14 @@ const virtuosoComponents = {
|
|
|
48
45
|
return <TableRow {...props} ref={ref} selected={isSelected} hover />
|
|
49
46
|
} else {
|
|
50
47
|
return (
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/>
|
|
60
|
-
</React.Suspense>
|
|
48
|
+
<TableRowDnD
|
|
49
|
+
{...props}
|
|
50
|
+
item={item}
|
|
51
|
+
context={context}
|
|
52
|
+
selected={isSelected}
|
|
53
|
+
disabled={isDisabled}
|
|
54
|
+
hover
|
|
55
|
+
/>
|
|
61
56
|
)
|
|
62
57
|
}
|
|
63
58
|
})
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["rows", "columns", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "dragProps"];
|
|
5
|
+
var _excluded = ["rows", "columns", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "dragProps", "context", "components"];
|
|
6
|
+
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
|
|
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
|
+
|
|
5
11
|
import React, { useState, forwardRef } from 'react';
|
|
6
12
|
import { TableVirtuoso } from 'react-virtuoso';
|
|
13
|
+
import CustomDragLayer from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer";
|
|
7
14
|
import FixedHeaderContent from "cozy-ui/transpiled/react/Table/Virtualized/FixedHeaderContent";
|
|
8
15
|
import RowContent from "cozy-ui/transpiled/react/Table/Virtualized/RowContent";
|
|
9
16
|
import { stableSort, getComparator } from "cozy-ui/transpiled/react/Table/Virtualized/helpers";
|
|
10
17
|
import virtuosoComponents from "cozy-ui/transpiled/react/Table/Virtualized/virtuosoComponents";
|
|
11
|
-
var CustomDragLayer = /*#__PURE__*/React.lazy(function () {
|
|
12
|
-
return import('./Dnd/CustomDrag/CustomDragLayer');
|
|
13
|
-
});
|
|
14
18
|
var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
15
19
|
var rows = _ref.rows,
|
|
16
20
|
columns = _ref.columns,
|
|
17
21
|
defaultOrder = _ref.defaultOrder,
|
|
18
22
|
secondarySort = _ref.secondarySort,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_ref$onSelectAll = _ref.onSelectAll,
|
|
24
|
-
onSelectAll = _ref$onSelectAll === void 0 ? function () {} : _ref$onSelectAll,
|
|
25
|
-
_ref$isSelectedItem = _ref.isSelectedItem,
|
|
26
|
-
isSelectedItem = _ref$isSelectedItem === void 0 ? function () {} : _ref$isSelectedItem,
|
|
23
|
+
selectedItems = _ref.selectedItems,
|
|
24
|
+
onSelect = _ref.onSelect,
|
|
25
|
+
onSelectAll = _ref.onSelectAll,
|
|
26
|
+
isSelectedItem = _ref.isSelectedItem,
|
|
27
27
|
componentsProps = _ref.componentsProps,
|
|
28
28
|
dragProps = _ref.dragProps,
|
|
29
|
+
context = _ref.context,
|
|
30
|
+
components = _ref.components,
|
|
29
31
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
32
|
|
|
31
33
|
var _useState = useState('asc'),
|
|
@@ -67,16 +69,16 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
67
69
|
return /*#__PURE__*/React.createElement(TableVirtuoso, _extends({}, props, {
|
|
68
70
|
ref: ref,
|
|
69
71
|
data: data,
|
|
70
|
-
context: {
|
|
72
|
+
context: _objectSpread(_objectSpread({}, context), {}, {
|
|
71
73
|
isSelectedItem: isSelectedItem,
|
|
72
74
|
selectedItems: selectedItems,
|
|
73
75
|
dragProps: dragProps,
|
|
74
76
|
itemsInDropProcess: itemsInDropProcess,
|
|
75
77
|
setItemsInDropProcess: setItemsInDropProcess
|
|
76
|
-
},
|
|
77
|
-
components: virtuosoComponents,
|
|
78
|
+
}),
|
|
79
|
+
components: components || virtuosoComponents,
|
|
78
80
|
fixedHeaderContent: function fixedHeaderContent() {
|
|
79
|
-
return /*#__PURE__*/React.createElement(FixedHeaderContent, {
|
|
81
|
+
return /*#__PURE__*/React.createElement(FixedHeaderContent, _extends({}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.FixedHeaderContent, {
|
|
80
82
|
columns: columns,
|
|
81
83
|
rowCount: rows.length,
|
|
82
84
|
selectedCount: selectedItems.length,
|
|
@@ -84,23 +86,29 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
84
86
|
orderBy: orderBy,
|
|
85
87
|
onClick: handleSort,
|
|
86
88
|
onSelectAllClick: handleSelectAll
|
|
87
|
-
});
|
|
89
|
+
}));
|
|
88
90
|
},
|
|
89
91
|
itemContent: function itemContent(_index, row) {
|
|
90
92
|
var _componentsProps$rowC;
|
|
91
93
|
|
|
92
|
-
return /*#__PURE__*/React.createElement(RowContent, {
|
|
94
|
+
return /*#__PURE__*/React.createElement(RowContent, _extends({}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.RowContent, {
|
|
93
95
|
index: _index,
|
|
94
96
|
row: row,
|
|
95
97
|
columns: columns,
|
|
96
98
|
isSelectedItem: isSelectedItem,
|
|
97
99
|
onSelectClick: onSelect
|
|
98
|
-
}, componentsProps === null || componentsProps === void 0 ? void 0 : (_componentsProps$rowC = componentsProps.rowContent) === null || _componentsProps$rowC === void 0 ? void 0 : _componentsProps$rowC.children);
|
|
100
|
+
}), componentsProps === null || componentsProps === void 0 ? void 0 : (_componentsProps$rowC = componentsProps.rowContent) === null || _componentsProps$rowC === void 0 ? void 0 : _componentsProps$rowC.children);
|
|
99
101
|
},
|
|
100
102
|
rowSpan: 2
|
|
101
103
|
}));
|
|
102
104
|
});
|
|
103
105
|
VirtualizedTable.displayName = 'VirtualizedTable';
|
|
106
|
+
VirtualizedTable.defaultProps = {
|
|
107
|
+
selectedItems: [],
|
|
108
|
+
isSelectedItem: function isSelectedItem() {},
|
|
109
|
+
onSelect: function onSelect() {},
|
|
110
|
+
onSelectAll: function onSelectAll() {}
|
|
111
|
+
};
|
|
104
112
|
|
|
105
113
|
var VirtuosoTableWrapper = function VirtuosoTableWrapper(props) {
|
|
106
114
|
var _props$dragProps;
|
|
@@ -108,7 +116,7 @@ var VirtuosoTableWrapper = function VirtuosoTableWrapper(props) {
|
|
|
108
116
|
if (!((_props$dragProps = props.dragProps) !== null && _props$dragProps !== void 0 && _props$dragProps.enabled)) {
|
|
109
117
|
return /*#__PURE__*/React.createElement(VirtualizedTable, props);
|
|
110
118
|
} else {
|
|
111
|
-
return /*#__PURE__*/React.createElement(React.
|
|
119
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
|
|
112
120
|
dragId: props.dragProps.dragId
|
|
113
121
|
}), /*#__PURE__*/React.createElement(VirtualizedTable, props));
|
|
114
122
|
}
|
|
@@ -9,6 +9,8 @@ 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";
|
|
12
14
|
import Table from "cozy-ui/transpiled/react/Table";
|
|
13
15
|
import Paper from "cozy-ui/transpiled/react/Paper";
|
|
14
16
|
import TableBody from "cozy-ui/transpiled/react/TableBody";
|
|
@@ -16,12 +18,6 @@ import TableContainer from "cozy-ui/transpiled/react/TableContainer";
|
|
|
16
18
|
import TableFooter from "cozy-ui/transpiled/react/TableFooter";
|
|
17
19
|
import TableHead from "cozy-ui/transpiled/react/TableHead";
|
|
18
20
|
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
|
-
});
|
|
25
21
|
|
|
26
22
|
var _TableContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
27
23
|
return /*#__PURE__*/React.createElement(TableContainer, _extends({}, props, {
|
|
@@ -47,11 +43,11 @@ var virtuosoComponents = {
|
|
|
47
43
|
ref: ref
|
|
48
44
|
}));
|
|
49
45
|
} else {
|
|
50
|
-
return /*#__PURE__*/React.createElement(
|
|
46
|
+
return /*#__PURE__*/React.createElement(DnDConfigWrapper, {
|
|
51
47
|
ref: ref
|
|
52
48
|
}, /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
|
|
53
49
|
ref: ref
|
|
54
|
-
})))
|
|
50
|
+
})));
|
|
55
51
|
}
|
|
56
52
|
}),
|
|
57
53
|
Table: /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -91,13 +87,13 @@ var virtuosoComponents = {
|
|
|
91
87
|
hover: true
|
|
92
88
|
}));
|
|
93
89
|
} else {
|
|
94
|
-
return /*#__PURE__*/React.createElement(
|
|
90
|
+
return /*#__PURE__*/React.createElement(TableRowDnD, _extends({}, props, {
|
|
95
91
|
item: item,
|
|
96
92
|
context: context,
|
|
97
93
|
selected: isSelected,
|
|
98
94
|
disabled: isDisabled,
|
|
99
95
|
hover: true
|
|
100
|
-
}))
|
|
96
|
+
}));
|
|
101
97
|
}
|
|
102
98
|
})
|
|
103
99
|
};
|