@etsoo/materialui 1.0.92 → 1.0.94
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/lib/ItemList.d.ts +4 -0
- package/lib/ItemList.js +3 -3
- package/package.json +3 -3
- package/src/ItemList.tsx +12 -4
package/lib/ItemList.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from '@etsoo/sha
|
|
|
4
4
|
* Item list properties
|
|
5
5
|
*/
|
|
6
6
|
export interface ItemListProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> {
|
|
7
|
+
/**
|
|
8
|
+
* Button label
|
|
9
|
+
*/
|
|
10
|
+
buttonLabel?: React.ReactNode;
|
|
7
11
|
/**
|
|
8
12
|
* Style class name
|
|
9
13
|
*/
|
package/lib/ItemList.js
CHANGED
|
@@ -8,7 +8,7 @@ import { DataTypes } from '@etsoo/shared';
|
|
|
8
8
|
export function ItemList(props) {
|
|
9
9
|
var _a;
|
|
10
10
|
// properties destructure
|
|
11
|
-
const { className, color = 'primary', items, idField = 'id', labelField = 'label', icon, onClose, selectedValue, size = 'medium', title, variant = 'outlined' } = props;
|
|
11
|
+
const { buttonLabel, className, color = 'primary', items, idField = 'id', labelField = 'label', icon, onClose, selectedValue, size = 'medium', title, variant = 'outlined' } = props;
|
|
12
12
|
// Get label
|
|
13
13
|
const getLabel = (item) => {
|
|
14
14
|
var _a;
|
|
@@ -57,9 +57,9 @@ export function ItemList(props) {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
return (React.createElement(React.Fragment, null,
|
|
60
|
-
React.createElement(Button, { className: className, variant: variant, startIcon: icon, color: color, size: size, onClick: clickHandler }, getLabel(currentItem)),
|
|
60
|
+
React.createElement(Button, { className: className, variant: variant, startIcon: icon, color: color, size: size, onClick: clickHandler }, buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : getLabel(currentItem)),
|
|
61
61
|
React.createElement(Dialog, { "aria-labelledby": "dialog-title", open: open, onClose: closeHandler },
|
|
62
|
-
React.createElement(DialogTitle, { sx: { minWidth: '200px' }, id: "dialog-title" }, title
|
|
62
|
+
title && (React.createElement(DialogTitle, { sx: { minWidth: '200px' }, id: "dialog-title" }, title)),
|
|
63
63
|
React.createElement(DialogContent, null,
|
|
64
64
|
React.createElement(List, null, items.map((item) => {
|
|
65
65
|
const id = item[idField];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.94",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@emotion/css": "^11.10.5",
|
|
52
52
|
"@emotion/react": "^11.10.5",
|
|
53
53
|
"@emotion/styled": "^11.10.5",
|
|
54
|
-
"@etsoo/appscript": "^1.3.
|
|
54
|
+
"@etsoo/appscript": "^1.3.43",
|
|
55
55
|
"@etsoo/notificationbase": "^1.1.18",
|
|
56
|
-
"@etsoo/react": "^1.6.
|
|
56
|
+
"@etsoo/react": "^1.6.33",
|
|
57
57
|
"@etsoo/shared": "^1.1.78",
|
|
58
58
|
"@mui/icons-material": "^5.10.16",
|
|
59
59
|
"@mui/material": "^5.10.16",
|
package/src/ItemList.tsx
CHANGED
|
@@ -23,6 +23,11 @@ export interface ItemListProps<
|
|
|
23
23
|
D extends DataTypes.Keys<T>,
|
|
24
24
|
L extends DataTypes.Keys<T, string>
|
|
25
25
|
> {
|
|
26
|
+
/**
|
|
27
|
+
* Button label
|
|
28
|
+
*/
|
|
29
|
+
buttonLabel?: React.ReactNode;
|
|
30
|
+
|
|
26
31
|
/**
|
|
27
32
|
* Style class name
|
|
28
33
|
*/
|
|
@@ -90,6 +95,7 @@ export function ItemList<
|
|
|
90
95
|
>(props: ItemListProps<T, D, L>) {
|
|
91
96
|
// properties destructure
|
|
92
97
|
const {
|
|
98
|
+
buttonLabel,
|
|
93
99
|
className,
|
|
94
100
|
color = 'primary',
|
|
95
101
|
items,
|
|
@@ -170,16 +176,18 @@ export function ItemList<
|
|
|
170
176
|
size={size}
|
|
171
177
|
onClick={clickHandler}
|
|
172
178
|
>
|
|
173
|
-
{getLabel(currentItem)}
|
|
179
|
+
{buttonLabel ?? getLabel(currentItem)}
|
|
174
180
|
</Button>
|
|
175
181
|
<Dialog
|
|
176
182
|
aria-labelledby="dialog-title"
|
|
177
183
|
open={open}
|
|
178
184
|
onClose={closeHandler}
|
|
179
185
|
>
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
|
|
186
|
+
{title && (
|
|
187
|
+
<DialogTitle sx={{ minWidth: '200px' }} id="dialog-title">
|
|
188
|
+
{title}
|
|
189
|
+
</DialogTitle>
|
|
190
|
+
)}
|
|
183
191
|
<DialogContent>
|
|
184
192
|
<List>
|
|
185
193
|
{items.map((item) => {
|