cozy-ui 130.3.1 → 130.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 +14 -0
- package/package.json +1 -1
- package/react/Table/Virtualized/Dnd/TableRow.jsx +10 -3
- package/react/Table/Virtualized/index.jsx +6 -2
- package/transpiled/react/Table/Virtualized/Dnd/TableRow.d.ts +2 -1
- package/transpiled/react/Table/Virtualized/Dnd/TableRow.js +8 -3
- package/transpiled/react/Table/Virtualized/index.js +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [130.5.0](https://github.com/cozy/cozy-ui/compare/v130.4.0...v130.5.0) (2025-10-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **TableRow, VirtualizedTable:** add isNewItem prop to track new items and highlight them ([d60d485](https://github.com/cozy/cozy-ui/commit/d60d485))
|
|
7
|
+
|
|
8
|
+
# [130.4.0](https://github.com/cozy/cozy-ui/compare/v130.3.1...v130.4.0) (2025-10-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Disable table row on cut :sparkles: ([41f8c1d](https://github.com/cozy/cozy-ui/commit/41f8c1d))
|
|
14
|
+
|
|
1
15
|
## [130.3.1](https://github.com/cozy/cozy-ui/compare/v130.3.0...v130.3.1) (2025-09-24)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
|
+
import cx from 'classnames'
|
|
3
|
+
|
|
2
4
|
import { useDrag, useDrop } from 'react-dnd'
|
|
3
5
|
import { getEmptyImage } from 'react-dnd-html5-backend'
|
|
4
6
|
|
|
5
7
|
import TableRowClassic from '../../../TableRow'
|
|
6
8
|
|
|
7
|
-
const TableRow = ({ item, context, ...props }) => {
|
|
9
|
+
const TableRow = ({ item, context, componentsProps, ...props }) => {
|
|
8
10
|
const {
|
|
9
11
|
selectedItems,
|
|
10
12
|
itemsInDropProcess,
|
|
@@ -18,7 +20,9 @@ const TableRow = ({ item, context, ...props }) => {
|
|
|
18
20
|
dragId
|
|
19
21
|
} = dragProps
|
|
20
22
|
const isSelected = context?.isSelectedItem(item)
|
|
21
|
-
const isDisabled =
|
|
23
|
+
const isDisabled =
|
|
24
|
+
itemsInDropProcess.includes(item._id) || componentsProps?.tableRow?.disabled
|
|
25
|
+
const isNew = context?.isNewItem?.(item)
|
|
22
26
|
|
|
23
27
|
const [dragCollect, dragRef, dragRefPreview] = useDrag(
|
|
24
28
|
() => ({
|
|
@@ -84,7 +88,10 @@ const TableRow = ({ item, context, ...props }) => {
|
|
|
84
88
|
{...props}
|
|
85
89
|
ref={node => dragRef(dropRef(node))}
|
|
86
90
|
selected={isSelected || dropCollect.isOver}
|
|
87
|
-
className={
|
|
91
|
+
className={cx(
|
|
92
|
+
dragCollect.isDragging ? 'virtualized u-o-50' : 'virtualized',
|
|
93
|
+
isNew ? 'u-bg-primaryColorLight' : ''
|
|
94
|
+
)}
|
|
88
95
|
disabled={isDisabled}
|
|
89
96
|
hover
|
|
90
97
|
/>
|
|
@@ -24,6 +24,7 @@ const VirtualizedTable = forwardRef(
|
|
|
24
24
|
context,
|
|
25
25
|
components,
|
|
26
26
|
onSortChange,
|
|
27
|
+
isNewItem,
|
|
27
28
|
...props
|
|
28
29
|
},
|
|
29
30
|
ref
|
|
@@ -43,7 +44,8 @@ const VirtualizedTable = forwardRef(
|
|
|
43
44
|
...context,
|
|
44
45
|
...(isGroupedTable && { data }), // we use directly `data` prop if no groupCounts
|
|
45
46
|
isSelectedItem,
|
|
46
|
-
selectedItems
|
|
47
|
+
selectedItems,
|
|
48
|
+
isNewItem
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
const handleSort = property => {
|
|
@@ -141,7 +143,9 @@ VirtualizedTable.propTypes = {
|
|
|
141
143
|
/** Function to determine if a row is selected */
|
|
142
144
|
isSelectedItem: PropTypes.func,
|
|
143
145
|
/** Callback called after the sort */
|
|
144
|
-
onSortChange: PropTypes.func
|
|
146
|
+
onSortChange: PropTypes.func,
|
|
147
|
+
/** Function to determine if a row is new */
|
|
148
|
+
isNewItem: PropTypes.func
|
|
145
149
|
}
|
|
146
150
|
|
|
147
151
|
export default VirtualizedTable
|
|
@@ -2,16 +2,20 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["item", "context"];
|
|
5
|
+
var _excluded = ["item", "context", "componentsProps"];
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useEffect } from 'react';
|
|
8
|
+
import cx from 'classnames';
|
|
8
9
|
import { useDrag, useDrop } from 'react-dnd';
|
|
9
10
|
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
10
11
|
import TableRowClassic from "cozy-ui/transpiled/react/TableRow";
|
|
11
12
|
|
|
12
13
|
var TableRow = function TableRow(_ref) {
|
|
14
|
+
var _componentsProps$tabl, _context$isNewItem;
|
|
15
|
+
|
|
13
16
|
var item = _ref.item,
|
|
14
17
|
context = _ref.context,
|
|
18
|
+
componentsProps = _ref.componentsProps,
|
|
15
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
20
|
|
|
17
21
|
var selectedItems = context.selectedItems,
|
|
@@ -23,7 +27,8 @@ var TableRow = function TableRow(_ref) {
|
|
|
23
27
|
canDragProps = dragProps.canDrag,
|
|
24
28
|
dragId = dragProps.dragId;
|
|
25
29
|
var isSelected = context === null || context === void 0 ? void 0 : context.isSelectedItem(item);
|
|
26
|
-
var isDisabled = itemsInDropProcess.includes(item._id);
|
|
30
|
+
var isDisabled = itemsInDropProcess.includes(item._id) || (componentsProps === null || componentsProps === void 0 ? void 0 : (_componentsProps$tabl = componentsProps.tableRow) === null || _componentsProps$tabl === void 0 ? void 0 : _componentsProps$tabl.disabled);
|
|
31
|
+
var isNew = context === null || context === void 0 ? void 0 : (_context$isNewItem = context.isNewItem) === null || _context$isNewItem === void 0 ? void 0 : _context$isNewItem.call(context, item);
|
|
27
32
|
|
|
28
33
|
var _useDrag = useDrag(function () {
|
|
29
34
|
return {
|
|
@@ -123,7 +128,7 @@ var TableRow = function TableRow(_ref) {
|
|
|
123
128
|
return dragRef(dropRef(node));
|
|
124
129
|
},
|
|
125
130
|
selected: isSelected || dropCollect.isOver,
|
|
126
|
-
className: dragCollect.isDragging ? 'virtualized u-o-50' : 'virtualized',
|
|
131
|
+
className: cx(dragCollect.isDragging ? 'virtualized u-o-50' : 'virtualized', isNew ? 'u-bg-primaryColorLight' : ''),
|
|
127
132
|
disabled: isDisabled,
|
|
128
133
|
hover: true
|
|
129
134
|
}));
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["rows", "columns", "groups", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "context", "components", "onSortChange"];
|
|
5
|
+
var _excluded = ["rows", "columns", "groups", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "context", "components", "onSortChange", "isNewItem"];
|
|
6
6
|
|
|
7
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
8
|
|
|
@@ -32,6 +32,7 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
32
32
|
context = _ref.context,
|
|
33
33
|
components = _ref.components,
|
|
34
34
|
onSortChange = _ref.onSortChange,
|
|
35
|
+
isNewItem = _ref.isNewItem,
|
|
35
36
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
37
|
|
|
37
38
|
var _useState = useState((_defaultOrder$directi = defaultOrder === null || defaultOrder === void 0 ? void 0 : defaultOrder.direction) !== null && _defaultOrder$directi !== void 0 ? _defaultOrder$directi : 'asc'),
|
|
@@ -58,7 +59,8 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
58
59
|
}), {}, {
|
|
59
60
|
// we use directly `data` prop if no groupCounts
|
|
60
61
|
isSelectedItem: isSelectedItem,
|
|
61
|
-
selectedItems: selectedItems
|
|
62
|
+
selectedItems: selectedItems,
|
|
63
|
+
isNewItem: isNewItem
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
var handleSort = function handleSort(property) {
|
|
@@ -162,6 +164,9 @@ VirtualizedTable.propTypes = {
|
|
|
162
164
|
isSelectedItem: PropTypes.func,
|
|
163
165
|
|
|
164
166
|
/** Callback called after the sort */
|
|
165
|
-
onSortChange: PropTypes.func
|
|
167
|
+
onSortChange: PropTypes.func,
|
|
168
|
+
|
|
169
|
+
/** Function to determine if a row is new */
|
|
170
|
+
isNewItem: PropTypes.func
|
|
166
171
|
};
|
|
167
172
|
export default VirtualizedTable;
|