cozy-ui 127.9.0 → 127.10.1
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/ActionsMenu/Actions/makeAction.jsx +42 -0
- package/react/GridList/Virtualized/Dnd/index.jsx +2 -3
- package/react/GridList/Virtualized/index.jsx +1 -2
- package/transpiled/react/ActionsMenu/Actions/makeAction.d.ts +17 -0
- package/transpiled/react/ActionsMenu/Actions/makeAction.js +45 -0
- package/transpiled/react/GridList/Virtualized/Dnd/index.js +3 -7
- package/transpiled/react/GridList/Virtualized/index.js +2 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [127.10.1](https://github.com/cozy/cozy-ui/compare/v127.10.0...v127.10.1) (2025-08-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Reorganize virtualized grid list to render item content :bug: ([62cf105](https://github.com/cozy/cozy-ui/commit/62cf105))
|
|
7
|
+
|
|
8
|
+
# [127.10.0](https://github.com/cozy/cozy-ui/compare/v127.9.0...v127.10.0) (2025-07-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **Actions:** Add `makeAction` to simplify action creation ([941e9b7](https://github.com/cozy/cozy-ui/commit/941e9b7))
|
|
14
|
+
|
|
1
15
|
# [127.9.0](https://github.com/cozy/cozy-ui/compare/v127.8.0...v127.9.0) (2025-07-31)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
|
|
3
|
+
import Icon from '../../Icon'
|
|
4
|
+
import ListItemIcon from '../../ListItemIcon'
|
|
5
|
+
import ListItemText from '../../ListItemText'
|
|
6
|
+
import ActionsMenuItem from '../ActionsMenuItem'
|
|
7
|
+
|
|
8
|
+
const makeComponent = ({ label, icon, name }) => {
|
|
9
|
+
const Component = forwardRef((props, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<ActionsMenuItem {...props} ref={ref}>
|
|
12
|
+
<ListItemIcon>
|
|
13
|
+
<Icon icon={icon} />
|
|
14
|
+
</ListItemIcon>
|
|
15
|
+
<ListItemText primary={label} />
|
|
16
|
+
</ActionsMenuItem>
|
|
17
|
+
)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
Component.displayName = name
|
|
21
|
+
|
|
22
|
+
return Component
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const makeAction = ({
|
|
26
|
+
name,
|
|
27
|
+
label,
|
|
28
|
+
icon,
|
|
29
|
+
disabled,
|
|
30
|
+
displayCondition,
|
|
31
|
+
action
|
|
32
|
+
}) => {
|
|
33
|
+
return {
|
|
34
|
+
name,
|
|
35
|
+
icon,
|
|
36
|
+
label,
|
|
37
|
+
disabled,
|
|
38
|
+
displayCondition,
|
|
39
|
+
action,
|
|
40
|
+
Component: makeComponent({ label, icon, name })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -41,13 +41,13 @@ const VirtualizedGridListDnd = ({
|
|
|
41
41
|
<div {...scrollerProps} ref={ref} />
|
|
42
42
|
</DnDConfigWrapper>
|
|
43
43
|
)),
|
|
44
|
-
Item: ({ context,
|
|
44
|
+
Item: ({ context, ...props }) => {
|
|
45
45
|
const item = context?.items?.[props['data-index']]
|
|
46
46
|
return (
|
|
47
47
|
<GridItem
|
|
48
48
|
item={item}
|
|
49
49
|
context={context}
|
|
50
|
-
renderItem={
|
|
50
|
+
renderItem={itemRenderer}
|
|
51
51
|
{...componentProps.Item}
|
|
52
52
|
/>
|
|
53
53
|
)
|
|
@@ -55,7 +55,6 @@ const VirtualizedGridListDnd = ({
|
|
|
55
55
|
...components
|
|
56
56
|
}}
|
|
57
57
|
context={_context}
|
|
58
|
-
itemRenderer={itemRenderer}
|
|
59
58
|
{...props}
|
|
60
59
|
>
|
|
61
60
|
{children}
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react'
|
|
|
2
2
|
import { VirtuosoGrid } from 'react-virtuoso'
|
|
3
3
|
|
|
4
4
|
const VirtualizedGridList = forwardRef(
|
|
5
|
-
({ items = [],
|
|
5
|
+
({ items = [], components, context, ...props }, ref) => {
|
|
6
6
|
return (
|
|
7
7
|
<VirtuosoGrid
|
|
8
8
|
ref={ref}
|
|
@@ -10,7 +10,6 @@ const VirtualizedGridList = forwardRef(
|
|
|
10
10
|
context={context}
|
|
11
11
|
style={{ height: '100%' }}
|
|
12
12
|
totalCount={items.length}
|
|
13
|
-
itemContent={index => itemRenderer(items[index])}
|
|
14
13
|
{...props}
|
|
15
14
|
/>
|
|
16
15
|
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function makeAction({ name, label, icon, disabled, displayCondition, action }: {
|
|
2
|
+
name: any;
|
|
3
|
+
label: any;
|
|
4
|
+
icon: any;
|
|
5
|
+
disabled: any;
|
|
6
|
+
displayCondition: any;
|
|
7
|
+
action: any;
|
|
8
|
+
}): {
|
|
9
|
+
name: any;
|
|
10
|
+
icon: any;
|
|
11
|
+
label: any;
|
|
12
|
+
disabled: any;
|
|
13
|
+
displayCondition: any;
|
|
14
|
+
action: any;
|
|
15
|
+
Component: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
16
|
+
};
|
|
17
|
+
import React from "react";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
4
|
+
import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
|
|
5
|
+
import ListItemText from "cozy-ui/transpiled/react/ListItemText";
|
|
6
|
+
import ActionsMenuItem from "cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem";
|
|
7
|
+
|
|
8
|
+
var makeComponent = function makeComponent(_ref) {
|
|
9
|
+
var label = _ref.label,
|
|
10
|
+
icon = _ref.icon,
|
|
11
|
+
name = _ref.name;
|
|
12
|
+
var Component = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
13
|
+
return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
|
|
14
|
+
ref: ref
|
|
15
|
+
}), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
16
|
+
icon: icon
|
|
17
|
+
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
18
|
+
primary: label
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
Component.displayName = name;
|
|
22
|
+
return Component;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export var makeAction = function makeAction(_ref2) {
|
|
26
|
+
var name = _ref2.name,
|
|
27
|
+
label = _ref2.label,
|
|
28
|
+
icon = _ref2.icon,
|
|
29
|
+
disabled = _ref2.disabled,
|
|
30
|
+
displayCondition = _ref2.displayCondition,
|
|
31
|
+
action = _ref2.action;
|
|
32
|
+
return {
|
|
33
|
+
name: name,
|
|
34
|
+
icon: icon,
|
|
35
|
+
label: label,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
displayCondition: displayCondition,
|
|
38
|
+
action: action,
|
|
39
|
+
Component: makeComponent({
|
|
40
|
+
label: label,
|
|
41
|
+
icon: icon,
|
|
42
|
+
name: name
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -3,7 +3,7 @@ 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
5
|
var _excluded = ["dragProps", "context", "itemRenderer", "children", "componentProps", "components"],
|
|
6
|
-
_excluded2 = ["context"
|
|
6
|
+
_excluded2 = ["context"];
|
|
7
7
|
|
|
8
8
|
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; }
|
|
9
9
|
|
|
@@ -60,21 +60,17 @@ var VirtualizedGridListDnd = function VirtualizedGridListDnd(_ref) {
|
|
|
60
60
|
var _context$items;
|
|
61
61
|
|
|
62
62
|
var context = _ref3.context,
|
|
63
|
-
children = _ref3.children,
|
|
64
63
|
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
65
64
|
|
|
66
65
|
var item = context === null || context === void 0 ? void 0 : (_context$items = context.items) === null || _context$items === void 0 ? void 0 : _context$items[props['data-index']];
|
|
67
66
|
return /*#__PURE__*/React.createElement(GridItem, _extends({
|
|
68
67
|
item: item,
|
|
69
68
|
context: context,
|
|
70
|
-
renderItem:
|
|
71
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
72
|
-
}
|
|
69
|
+
renderItem: itemRenderer
|
|
73
70
|
}, componentProps.Item));
|
|
74
71
|
}
|
|
75
72
|
}, components),
|
|
76
|
-
context: _context
|
|
77
|
-
itemRenderer: itemRenderer
|
|
73
|
+
context: _context
|
|
78
74
|
}, props), children));
|
|
79
75
|
};
|
|
80
76
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["items", "
|
|
3
|
+
var _excluded = ["items", "components", "context"];
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import { VirtuosoGrid } from 'react-virtuoso';
|
|
6
6
|
var VirtualizedGridList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
7
7
|
var _ref$items = _ref.items,
|
|
8
8
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
9
|
-
itemRenderer = _ref.itemRenderer,
|
|
10
9
|
components = _ref.components,
|
|
11
10
|
context = _ref.context,
|
|
12
11
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -18,10 +17,7 @@ var VirtualizedGridList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
18
17
|
style: {
|
|
19
18
|
height: '100%'
|
|
20
19
|
},
|
|
21
|
-
totalCount: items.length
|
|
22
|
-
itemContent: function itemContent(index) {
|
|
23
|
-
return itemRenderer(items[index]);
|
|
24
|
-
}
|
|
20
|
+
totalCount: items.length
|
|
25
21
|
}, props));
|
|
26
22
|
});
|
|
27
23
|
VirtualizedGridList.displayName = 'VirtualizedGridList';
|