cozy-ui 127.16.0 → 127.17.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
+ # [127.17.0](https://github.com/cozy/cozy-ui/compare/v127.16.0...v127.17.0) (2025-08-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * Implement range selection in list view and grid view :sparkles: ([a9274f2](https://github.com/cozy/cozy-ui/commit/a9274f2))
7
+
1
8
  # [127.16.0](https://github.com/cozy/cozy-ui/compare/v127.15.0...v127.16.0) (2025-08-26)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "127.16.0",
3
+ "version": "127.17.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -103,7 +103,13 @@ const initialVariants = [{ grouped: false }]
103
103
 
104
104
  const makeGroups = () => ({ groupLabels: ['C', 'D', 'Others'], groupCounts: [1,1,12] })
105
105
 
106
- ;
106
+ /**
107
+ * @param order
108
+ * @param orderBy
109
+ */
110
+ const onSortChange = ({ order, orderBy }) => {
111
+ setState({ order, orderBy })
112
+ }
107
113
 
108
114
  <Variants initialVariants={initialVariants} screenshotAllVariants>
109
115
  {variant => (
@@ -117,6 +123,7 @@ const makeGroups = () => ({ groupLabels: ['C', 'D', 'Others'], groupCounts: [1,1
117
123
  isSelectedItem={row => isSelectedItem(row)}
118
124
  onSelect={onSelect}
119
125
  onSelectAll={onSelectAll}
126
+ onSortChange={onSortChange}
120
127
  componentsProps={{
121
128
  rowContent: {
122
129
  onClick: (row, column) => { console.info(`click on cell. Row ${row['id']}, Column ${column['id']}`) },
@@ -30,7 +30,7 @@ const RowContent = ({
30
30
  'aria-labelledby': `enhanced-table-checkbox-${index}`
31
31
  }}
32
32
  size="small"
33
- onChange={() => onSelectClick(row)}
33
+ onClick={event => onSelectClick(event, row, index)}
34
34
  />
35
35
  </TableCell>
36
36
  {columns.map(column => (
@@ -23,6 +23,7 @@ const VirtualizedTable = forwardRef(
23
23
  componentsProps,
24
24
  context,
25
25
  components,
26
+ onSortChange,
26
27
  ...props
27
28
  },
28
29
  ref
@@ -43,8 +44,10 @@ const VirtualizedTable = forwardRef(
43
44
 
44
45
  const handleSort = property => {
45
46
  const isAsc = orderBy === property && order === 'asc'
46
- setOrder(isAsc ? 'desc' : 'asc')
47
+ const newOrder = isAsc ? 'desc' : 'asc'
48
+ setOrder(newOrder)
47
49
  setOrderBy(property)
50
+ onSortChange({ order: newOrder, orderBy: property })
48
51
  }
49
52
 
50
53
  const handleSelectAll = event => {
@@ -27,8 +27,8 @@ var RowContent = function RowContent(_ref) {
27
27
  'aria-labelledby': "enhanced-table-checkbox-".concat(index)
28
28
  },
29
29
  size: "small",
30
- onChange: function onChange() {
31
- return onSelectClick(row);
30
+ onClick: function onClick(event) {
31
+ return onSelectClick(event, row, index);
32
32
  }
33
33
  })), columns.map(function (column) {
34
34
  return /*#__PURE__*/React.createElement(Cell, {
@@ -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"];
5
+ var _excluded = ["rows", "columns", "groups", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "context", "components", "onSortChange"];
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
 
@@ -29,6 +29,7 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
29
29
  componentsProps = _ref.componentsProps,
30
30
  context = _ref.context,
31
31
  components = _ref.components,
32
+ onSortChange = _ref.onSortChange,
32
33
  props = _objectWithoutProperties(_ref, _excluded);
33
34
 
34
35
  var _useState = useState('asc'),
@@ -60,8 +61,13 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
60
61
 
61
62
  var handleSort = function handleSort(property) {
62
63
  var isAsc = orderBy === property && order === 'asc';
63
- setOrder(isAsc ? 'desc' : 'asc');
64
+ var newOrder = isAsc ? 'desc' : 'asc';
65
+ setOrder(newOrder);
64
66
  setOrderBy(property);
67
+ onSortChange({
68
+ order: newOrder,
69
+ orderBy: property
70
+ });
65
71
  };
66
72
 
67
73
  var handleSelectAll = function handleSelectAll(event) {