cozy-ui 127.5.0 → 127.6.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 +13 -0
- package/package.json +2 -2
- package/react/Table/Readme.md +3 -2
- package/react/Table/Virtualized/Cell.jsx +21 -3
- package/react/Table/Virtualized/Dnd/virtuosoComponents.jsx +3 -3
- package/react/Table/Virtualized/RowContent.jsx +2 -0
- package/react/Table/Virtualized/TableRow.jsx +3 -4
- package/react/Table/Virtualized/index.jsx +0 -1
- package/react/Table/Virtualized/virtuosoComponents.jsx +1 -1
- package/react/UploadQueue/Readme.md +1 -1
- package/transpiled/react/Table/Virtualized/Cell.d.ts +2 -1
- package/transpiled/react/Table/Virtualized/Cell.js +31 -6
- package/transpiled/react/Table/Virtualized/Dnd/virtuosoComponents.d.ts +1 -1
- package/transpiled/react/Table/Virtualized/Dnd/virtuosoComponents.js +3 -5
- package/transpiled/react/Table/Virtualized/RowContent.d.ts +2 -1
- package/transpiled/react/Table/Virtualized/RowContent.js +3 -1
- package/transpiled/react/Table/Virtualized/TableRow.d.ts +6 -2
- package/transpiled/react/Table/Virtualized/TableRow.js +5 -4
- package/transpiled/react/Table/Virtualized/index.js +3 -4
- package/transpiled/react/Table/Virtualized/virtuosoComponents.d.ts +1 -1
- package/transpiled/react/Table/Virtualized/virtuosoComponents.js +4 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [127.6.0](https://github.com/cozy/cozy-ui/compare/v127.5.0...v127.6.0) (2025-07-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **VirtualizedTable:** Remove ref on TableRow ([919f742](https://github.com/cozy/cozy-ui/commit/919f742))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Upgrade rooks ([51de4e7](https://github.com/cozy/cozy-ui/commit/51de4e7))
|
|
12
|
+
* **VirtualizedTable:** Add `onLongPress` prop on Cell ([7e08d77](https://github.com/cozy/cozy-ui/commit/7e08d77))
|
|
13
|
+
|
|
1
14
|
# [127.5.0](https://github.com/cozy/cozy-ui/compare/v127.4.0...v127.5.0) (2025-07-29)
|
|
2
15
|
|
|
3
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "127.
|
|
3
|
+
"version": "127.6.0",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
"react-select": "^4.3.0",
|
|
184
184
|
"react-swipeable-views": "^0.13.3",
|
|
185
185
|
"react-virtuoso": "4.12.7",
|
|
186
|
-
"rooks": "
|
|
186
|
+
"rooks": "7.14.1"
|
|
187
187
|
},
|
|
188
188
|
"peerDependencies": {
|
|
189
189
|
"cozy-client": ">=52.1.0",
|
package/react/Table/Readme.md
CHANGED
|
@@ -110,8 +110,9 @@ const onSelectAll = rows => {
|
|
|
110
110
|
onSelectAll={onSelectAll}
|
|
111
111
|
componentsProps={{
|
|
112
112
|
rowContent: {
|
|
113
|
-
onClick: (row, column) => { console.info(`click on cell. Row ${row['id']}, Column ${column['id']}`) }
|
|
114
|
-
|
|
113
|
+
onClick: (row, column) => { console.info(`click on cell. Row ${row['id']}, Column ${column['id']}`) },
|
|
114
|
+
onLongPress: (row, column) => { console.info(`long press on cell. Row ${row['id']}, Column ${column['id']}`) },
|
|
115
|
+
},
|
|
115
116
|
}}
|
|
116
117
|
/>
|
|
117
118
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import get from 'lodash/get'
|
|
2
|
-
import React from 'react'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
import { useOnLongPress } from 'rooks'
|
|
3
4
|
|
|
4
5
|
import TableCell from '../../TableCell'
|
|
5
6
|
import { makeStyles } from '../../styles'
|
|
@@ -12,17 +13,34 @@ const useStyles = makeStyles({
|
|
|
12
13
|
}
|
|
13
14
|
})
|
|
14
15
|
|
|
15
|
-
const Cell = ({ row, columns, column, onClick, children }) => {
|
|
16
|
+
const Cell = ({ row, columns, column, onClick, onLongPress, children }) => {
|
|
17
|
+
const [isLongPress, setIsLongPress] = useState(false) // onClick is triggered after a long press anyway, so we need this bool to avoid this behavior
|
|
18
|
+
|
|
16
19
|
const classes = useStyles({ column, isClickable: !!onClick })
|
|
17
20
|
const cellContent = get(row, column.id, '—')
|
|
18
21
|
|
|
22
|
+
const longPressRef = useOnLongPress(() => {
|
|
23
|
+
setIsLongPress(true)
|
|
24
|
+
onLongPress?.(row, column)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const handleClick = () => {
|
|
28
|
+
if (!isLongPress) {
|
|
29
|
+
onClick?.(row, column)
|
|
30
|
+
} else {
|
|
31
|
+
setIsLongPress(false)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
return (
|
|
20
36
|
<TableCell
|
|
21
37
|
key={column.id}
|
|
38
|
+
ref={longPressRef}
|
|
22
39
|
classes={classes}
|
|
23
40
|
align={column.textAlign ?? 'left'}
|
|
24
41
|
padding={column.disablePadding ? 'none' : 'normal'}
|
|
25
|
-
onClick={
|
|
42
|
+
onClick={handleClick}
|
|
43
|
+
onContextMenu={isLongPress ? ev => ev.preventDefault() : undefined}
|
|
26
44
|
>
|
|
27
45
|
{children
|
|
28
46
|
? React.Children.map(children, child =>
|
|
@@ -17,9 +17,9 @@ const virtuosoComponentsDnd = {
|
|
|
17
17
|
<TableContainer {...props} ref={ref} />
|
|
18
18
|
</DnDConfigWrapper>
|
|
19
19
|
)),
|
|
20
|
-
TableRow:
|
|
21
|
-
return <TableRowDnD {...props}
|
|
22
|
-
}
|
|
20
|
+
TableRow: props => {
|
|
21
|
+
return <TableRowDnD {...props} />
|
|
22
|
+
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export default virtuosoComponentsDnd
|
|
@@ -12,6 +12,7 @@ const RowContent = ({
|
|
|
12
12
|
context,
|
|
13
13
|
children,
|
|
14
14
|
onSelectClick,
|
|
15
|
+
onLongPress,
|
|
15
16
|
onClick
|
|
16
17
|
}) => {
|
|
17
18
|
const selectedCount = context.selectedItems.length
|
|
@@ -39,6 +40,7 @@ const RowContent = ({
|
|
|
39
40
|
columns={columns}
|
|
40
41
|
column={column}
|
|
41
42
|
onClick={onClick}
|
|
43
|
+
onLongPress={onLongPress}
|
|
42
44
|
>
|
|
43
45
|
{children}
|
|
44
46
|
</Cell>
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import TableRowClassic from '../../TableRow'
|
|
5
5
|
|
|
6
|
-
const TableRow =
|
|
6
|
+
const TableRow = ({ item, context, className, ...props }) => {
|
|
7
7
|
const isSelected = context?.isSelectedItem(item)
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<TableRowClassic
|
|
11
11
|
{...props}
|
|
12
12
|
className={cx(className, 'virtualized')}
|
|
13
|
-
ref={ref}
|
|
14
13
|
selected={isSelected}
|
|
15
14
|
hover
|
|
16
15
|
/>
|
|
17
16
|
)
|
|
18
|
-
}
|
|
17
|
+
}
|
|
19
18
|
|
|
20
19
|
export default TableRow
|
|
@@ -29,7 +29,7 @@ const virtuosoComponents = {
|
|
|
29
29
|
TableFooter: forwardRef(({ context, ...props }, ref) => (
|
|
30
30
|
<TableFooter {...props} ref={ref} />
|
|
31
31
|
)),
|
|
32
|
-
TableRow:
|
|
32
|
+
TableRow: props => <TableRow {...props} />
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export default virtuosoComponents
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
declare var _default: React.MemoExoticComponent<({ row, columns, column, onClick, children }: {
|
|
1
|
+
declare var _default: React.MemoExoticComponent<({ row, columns, column, onClick, onLongPress, children }: {
|
|
2
2
|
row: any;
|
|
3
3
|
columns: any;
|
|
4
4
|
column: any;
|
|
5
5
|
onClick: any;
|
|
6
|
+
onLongPress: any;
|
|
6
7
|
children: any;
|
|
7
8
|
}) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import get from 'lodash/get';
|
|
2
|
-
import React from 'react';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { useOnLongPress } from 'rooks';
|
|
3
5
|
import TableCell from "cozy-ui/transpiled/react/TableCell";
|
|
4
6
|
import { makeStyles } from "cozy-ui/transpiled/react/styles";
|
|
5
7
|
var useStyles = makeStyles({
|
|
@@ -25,21 +27,44 @@ var Cell = function Cell(_ref4) {
|
|
|
25
27
|
var row = _ref4.row,
|
|
26
28
|
columns = _ref4.columns,
|
|
27
29
|
column = _ref4.column,
|
|
28
|
-
|
|
30
|
+
onClick = _ref4.onClick,
|
|
31
|
+
onLongPress = _ref4.onLongPress,
|
|
29
32
|
children = _ref4.children;
|
|
33
|
+
|
|
34
|
+
var _useState = useState(false),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
isLongPress = _useState2[0],
|
|
37
|
+
setIsLongPress = _useState2[1]; // onClick is triggered after a long press anyway, so we need this bool to avoid this behavior
|
|
38
|
+
|
|
39
|
+
|
|
30
40
|
var classes = useStyles({
|
|
31
41
|
column: column,
|
|
32
|
-
isClickable: !!
|
|
42
|
+
isClickable: !!onClick
|
|
33
43
|
});
|
|
34
44
|
var cellContent = get(row, column.id, '—');
|
|
45
|
+
var longPressRef = useOnLongPress(function () {
|
|
46
|
+
setIsLongPress(true);
|
|
47
|
+
onLongPress === null || onLongPress === void 0 ? void 0 : onLongPress(row, column);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
var handleClick = function handleClick() {
|
|
51
|
+
if (!isLongPress) {
|
|
52
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(row, column);
|
|
53
|
+
} else {
|
|
54
|
+
setIsLongPress(false);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
35
58
|
return /*#__PURE__*/React.createElement(TableCell, {
|
|
36
59
|
key: column.id,
|
|
60
|
+
ref: longPressRef,
|
|
37
61
|
classes: classes,
|
|
38
62
|
align: (_column$textAlign = column.textAlign) !== null && _column$textAlign !== void 0 ? _column$textAlign : 'left',
|
|
39
63
|
padding: column.disablePadding ? 'none' : 'normal',
|
|
40
|
-
onClick:
|
|
41
|
-
|
|
42
|
-
|
|
64
|
+
onClick: handleClick,
|
|
65
|
+
onContextMenu: isLongPress ? function (ev) {
|
|
66
|
+
return ev.preventDefault();
|
|
67
|
+
} : undefined
|
|
43
68
|
}, children ? React.Children.map(children, function (child) {
|
|
44
69
|
return /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
|
|
45
70
|
row: row,
|
|
@@ -5,7 +5,7 @@ export default virtuosoComponentsDnd;
|
|
|
5
5
|
*/
|
|
6
6
|
declare const virtuosoComponentsDnd: {
|
|
7
7
|
Scroller: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
8
|
-
TableRow:
|
|
8
|
+
TableRow: (props: any) => JSX.Element;
|
|
9
9
|
Table: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
10
10
|
TableHead: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
11
11
|
TableBody: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
@@ -29,11 +29,9 @@ var virtuosoComponentsDnd = _objectSpread(_objectSpread({}, virtuosoComponents),
|
|
|
29
29
|
ref: ref
|
|
30
30
|
})));
|
|
31
31
|
}),
|
|
32
|
-
TableRow:
|
|
33
|
-
return /*#__PURE__*/React.createElement(TableRowDnD,
|
|
34
|
-
|
|
35
|
-
}));
|
|
36
|
-
})
|
|
32
|
+
TableRow: function TableRow(props) {
|
|
33
|
+
return /*#__PURE__*/React.createElement(TableRowDnD, props);
|
|
34
|
+
}
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
export default virtuosoComponentsDnd;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
declare var _default: React.MemoExoticComponent<({ index, row, columns, context, children, onSelectClick, onClick }: {
|
|
1
|
+
declare var _default: React.MemoExoticComponent<({ index, row, columns, context, children, onSelectClick, onLongPress, onClick }: {
|
|
2
2
|
index: any;
|
|
3
3
|
row: any;
|
|
4
4
|
columns: any;
|
|
5
5
|
context: any;
|
|
6
6
|
children: any;
|
|
7
7
|
onSelectClick: any;
|
|
8
|
+
onLongPress: any;
|
|
8
9
|
onClick: any;
|
|
9
10
|
}) => JSX.Element>;
|
|
10
11
|
export default _default;
|
|
@@ -11,6 +11,7 @@ var RowContent = function RowContent(_ref) {
|
|
|
11
11
|
context = _ref.context,
|
|
12
12
|
children = _ref.children,
|
|
13
13
|
onSelectClick = _ref.onSelectClick,
|
|
14
|
+
onLongPress = _ref.onLongPress,
|
|
14
15
|
onClick = _ref.onClick;
|
|
15
16
|
var selectedCount = context.selectedItems.length;
|
|
16
17
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableCell, {
|
|
@@ -35,7 +36,8 @@ var RowContent = function RowContent(_ref) {
|
|
|
35
36
|
row: row,
|
|
36
37
|
columns: columns,
|
|
37
38
|
column: column,
|
|
38
|
-
onClick: onClick
|
|
39
|
+
onClick: onClick,
|
|
40
|
+
onLongPress: onLongPress
|
|
39
41
|
}, children);
|
|
40
42
|
}));
|
|
41
43
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export default TableRow;
|
|
2
|
-
declare
|
|
3
|
-
|
|
2
|
+
declare function TableRow({ item, context, className, ...props }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
item: any;
|
|
5
|
+
context: any;
|
|
6
|
+
className: any;
|
|
7
|
+
}): JSX.Element;
|
|
@@ -2,9 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["item", "context", "className"];
|
|
4
4
|
import cx from 'classnames';
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import TableRowClassic from "cozy-ui/transpiled/react/TableRow";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
var TableRow = function TableRow(_ref) {
|
|
8
9
|
var item = _ref.item,
|
|
9
10
|
context = _ref.context,
|
|
10
11
|
className = _ref.className,
|
|
@@ -13,9 +14,9 @@ var TableRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13
14
|
var isSelected = context === null || context === void 0 ? void 0 : context.isSelectedItem(item);
|
|
14
15
|
return /*#__PURE__*/React.createElement(TableRowClassic, _extends({}, props, {
|
|
15
16
|
className: cx(className, 'virtualized'),
|
|
16
|
-
ref: ref,
|
|
17
17
|
selected: isSelected,
|
|
18
18
|
hover: true
|
|
19
19
|
}));
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
|
+
|
|
21
22
|
export default TableRow;
|
|
@@ -80,16 +80,15 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
80
80
|
}));
|
|
81
81
|
},
|
|
82
82
|
itemContent: function itemContent(_index, row, context) {
|
|
83
|
-
var _componentsProps$rowC
|
|
83
|
+
var _componentsProps$rowC;
|
|
84
84
|
|
|
85
85
|
return /*#__PURE__*/React.createElement(RowContent, _extends({}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.rowContent, {
|
|
86
86
|
index: _index,
|
|
87
87
|
row: row,
|
|
88
88
|
columns: columns,
|
|
89
89
|
context: context,
|
|
90
|
-
onSelectClick: onSelect
|
|
91
|
-
|
|
92
|
-
}), componentsProps === null || componentsProps === void 0 ? void 0 : (_componentsProps$rowC2 = componentsProps.rowContent) === null || _componentsProps$rowC2 === void 0 ? void 0 : _componentsProps$rowC2.children);
|
|
90
|
+
onSelectClick: onSelect
|
|
91
|
+
}), componentsProps === null || componentsProps === void 0 ? void 0 : (_componentsProps$rowC = componentsProps.rowContent) === null || _componentsProps$rowC === void 0 ? void 0 : _componentsProps$rowC.children);
|
|
93
92
|
},
|
|
94
93
|
rowSpan: 2
|
|
95
94
|
}));
|
|
@@ -5,6 +5,6 @@ declare namespace virtuosoComponents {
|
|
|
5
5
|
const TableHead: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
6
6
|
const TableBody: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
7
7
|
const TableFooter: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
8
|
-
|
|
8
|
+
function TableRow(props: any): JSX.Element;
|
|
9
9
|
}
|
|
10
10
|
import React from "react";
|
|
@@ -9,7 +9,7 @@ var _excluded = ["context"],
|
|
|
9
9
|
/* eslint-disable no-unused-vars */
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import React, { forwardRef } from 'react';
|
|
12
|
-
import
|
|
12
|
+
import _TableRow from "cozy-ui/transpiled/react/Table/Virtualized/TableRow";
|
|
13
13
|
import Table from "cozy-ui/transpiled/react/Table";
|
|
14
14
|
import TableBody from "cozy-ui/transpiled/react/TableBody";
|
|
15
15
|
import TableContainer from "cozy-ui/transpiled/react/TableContainer";
|
|
@@ -63,10 +63,8 @@ var virtuosoComponents = {
|
|
|
63
63
|
ref: ref
|
|
64
64
|
}));
|
|
65
65
|
}),
|
|
66
|
-
TableRow:
|
|
67
|
-
return /*#__PURE__*/React.createElement(
|
|
68
|
-
|
|
69
|
-
}));
|
|
70
|
-
})
|
|
66
|
+
TableRow: function TableRow(props) {
|
|
67
|
+
return /*#__PURE__*/React.createElement(_TableRow, props);
|
|
68
|
+
}
|
|
71
69
|
};
|
|
72
70
|
export default virtuosoComponents;
|