cozy-ui 127.15.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,17 @@
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
+
8
+ # [127.16.0](https://github.com/cozy/cozy-ui/compare/v127.15.0...v127.16.0) (2025-08-26)
9
+
10
+
11
+ ### Features
12
+
13
+ * Update FileImageLoader to be used in shared drive :sparkles: ([cb4db8f](https://github.com/cozy/cozy-ui/commit/cb4db8f))
14
+
1
15
  # [127.15.0](https://github.com/cozy/cozy-ui/compare/v127.14.0...v127.15.0) (2025-08-25)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "127.15.0",
3
+ "version": "127.17.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -36,7 +36,13 @@ export const download = ({ encryptedUrl }) => {
36
36
  icon,
37
37
  label,
38
38
  Component: makeComponent(label, icon),
39
- action: (docs, { client, webviewIntent }) =>
40
- downloadFile({ client, file: docs[0], url: encryptedUrl, webviewIntent })
39
+ action: (docs, { client, webviewIntent, driveId }) =>
40
+ downloadFile({
41
+ client,
42
+ file: docs[0],
43
+ url: encryptedUrl,
44
+ webviewIntent,
45
+ driveId
46
+ })
41
47
  }
42
48
  }
@@ -142,7 +142,7 @@ export class FileImageLoader extends Component {
142
142
  throw new Error('No pdf files fallback')
143
143
  }
144
144
  const src = await client
145
- .collection('io.cozy.files')
145
+ .collection('io.cozy.files', { driveId: file.driveId })
146
146
  .getDownloadLinkById(this.getFileId(file), file.name)
147
147
  await checkImageSource(src)
148
148
  if (this._mounted) {
@@ -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 => {
@@ -5,9 +5,10 @@ export function download({ encryptedUrl }: {
5
5
  icon: typeof DownloadIcon;
6
6
  label: any;
7
7
  Component: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
8
- action: (docs: any, { client, webviewIntent }: {
8
+ action: (docs: any, { client, webviewIntent, driveId }: {
9
9
  client: any;
10
10
  webviewIntent: any;
11
+ driveId: any;
11
12
  }) => any;
12
13
  };
13
14
  import DownloadIcon from "../../Icons/Download";
@@ -37,12 +37,14 @@ export var download = function download(_ref) {
37
37
  Component: makeComponent(label, icon),
38
38
  action: function action(docs, _ref2) {
39
39
  var client = _ref2.client,
40
- webviewIntent = _ref2.webviewIntent;
40
+ webviewIntent = _ref2.webviewIntent,
41
+ driveId = _ref2.driveId;
41
42
  return downloadFile({
42
43
  client: client,
43
44
  file: docs[0],
44
45
  url: encryptedUrl,
45
- webviewIntent: webviewIntent
46
+ webviewIntent: webviewIntent,
47
+ driveId: driveId
46
48
  });
47
49
  }
48
50
  };
@@ -294,7 +294,9 @@ export var FileImageLoader = /*#__PURE__*/function (_Component) {
294
294
 
295
295
  case 5:
296
296
  _context4.next = 7;
297
- return client.collection('io.cozy.files').getDownloadLinkById(this.getFileId(file), file.name);
297
+ return client.collection('io.cozy.files', {
298
+ driveId: file.driveId
299
+ }).getDownloadLinkById(this.getFileId(file), file.name);
298
300
 
299
301
  case 7:
300
302
  src = _context4.sent;
@@ -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) {