cozy-ui 127.8.0 → 127.10.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/ActionsMenu/Actions/makeAction.jsx +42 -0
- package/react/Table/Readme.md +2 -1
- package/react/Table/Virtualized/Cell.jsx +8 -0
- package/transpiled/react/ActionsMenu/Actions/makeAction.d.ts +17 -0
- package/transpiled/react/ActionsMenu/Actions/makeAction.js +45 -0
- package/transpiled/react/Table/Virtualized/Cell.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [127.10.0](https://github.com/cozy/cozy-ui/compare/v127.9.0...v127.10.0) (2025-07-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Actions:** Add `makeAction` to simplify action creation ([941e9b7](https://github.com/cozy/cozy-ui/commit/941e9b7))
|
|
7
|
+
|
|
8
|
+
# [127.9.0](https://github.com/cozy/cozy-ui/compare/v127.8.0...v127.9.0) (2025-07-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **VirtualizedTable:** Add `disableClick` prop on column config ([6c68c01](https://github.com/cozy/cozy-ui/commit/6c68c01))
|
|
14
|
+
|
|
1
15
|
# [127.8.0](https://github.com/cozy/cozy-ui/compare/v127.7.0...v127.8.0) (2025-07-30)
|
|
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
|
+
}
|
package/react/Table/Readme.md
CHANGED
|
@@ -20,11 +20,19 @@ const Cell = ({ row, columns, column, onClick, onLongPress, children }) => {
|
|
|
20
20
|
const cellContent = get(row, column.id, '—')
|
|
21
21
|
|
|
22
22
|
const longPressRef = useOnLongPress(() => {
|
|
23
|
+
if (column.disableClick) {
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
setIsLongPress(true)
|
|
24
28
|
onLongPress?.(row, column)
|
|
25
29
|
})
|
|
26
30
|
|
|
27
31
|
const handleClick = () => {
|
|
32
|
+
if (column.disableClick) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
if (!isLongPress) {
|
|
29
37
|
onClick?.(row, column)
|
|
30
38
|
} else {
|
|
@@ -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
|
+
};
|
|
@@ -43,11 +43,19 @@ var Cell = function Cell(_ref4) {
|
|
|
43
43
|
});
|
|
44
44
|
var cellContent = get(row, column.id, '—');
|
|
45
45
|
var longPressRef = useOnLongPress(function () {
|
|
46
|
+
if (column.disableClick) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
setIsLongPress(true);
|
|
47
51
|
onLongPress === null || onLongPress === void 0 ? void 0 : onLongPress(row, column);
|
|
48
52
|
});
|
|
49
53
|
|
|
50
54
|
var handleClick = function handleClick() {
|
|
55
|
+
if (column.disableClick) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
if (!isLongPress) {
|
|
52
60
|
onClick === null || onClick === void 0 ? void 0 : onClick(row, column);
|
|
53
61
|
} else {
|