@etsoo/react 1.2.23 → 1.2.27
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/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mu/AutocompleteExtendedProps.d.ts +4 -0
- package/lib/mu/ComboBox.js +2 -2
- package/lib/mu/ListItemRightIcon.d.ts +4 -0
- package/lib/mu/ListItemRightIcon.js +8 -0
- package/lib/mu/SelectEx.d.ts +2 -2
- package/lib/mu/SelectEx.js +4 -3
- package/lib/mu/Tiplist.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/mu/AutocompleteExtendedProps.ts +5 -0
- package/src/mu/ComboBox.tsx +3 -2
- package/src/mu/ListItemRightIcon.tsx +9 -0
- package/src/mu/SelectEx.tsx +6 -5
- package/src/mu/Tiplist.tsx +3 -0
package/lib/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export * from './mu/FlexBox';
|
|
|
36
36
|
export * from './mu/IconButtonLink';
|
|
37
37
|
export * from './mu/InputField';
|
|
38
38
|
export * from './mu/ItemList';
|
|
39
|
+
export * from './mu/ListItemRightIcon';
|
|
39
40
|
export * from './mu/LoadingButton';
|
|
40
41
|
export * from './mu/MaskInput';
|
|
41
42
|
export * from './mu/MoreFab';
|
package/lib/index.js
CHANGED
|
@@ -39,6 +39,7 @@ export * from './mu/FlexBox';
|
|
|
39
39
|
export * from './mu/IconButtonLink';
|
|
40
40
|
export * from './mu/InputField';
|
|
41
41
|
export * from './mu/ItemList';
|
|
42
|
+
export * from './mu/ListItemRightIcon';
|
|
42
43
|
export * from './mu/LoadingButton';
|
|
43
44
|
export * from './mu/MaskInput';
|
|
44
45
|
export * from './mu/MoreFab';
|
|
@@ -12,6 +12,10 @@ export interface AutocompleteExtendedProps<T extends Record<string, any>> extend
|
|
|
12
12
|
* Id value
|
|
13
13
|
*/
|
|
14
14
|
idValue?: DataTypes.IdType;
|
|
15
|
+
/**
|
|
16
|
+
* Autocomplete for the input
|
|
17
|
+
*/
|
|
18
|
+
inputAutoComplete?: string;
|
|
15
19
|
/**
|
|
16
20
|
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
17
21
|
* @default 'none'
|
package/lib/mu/ComboBox.js
CHANGED
|
@@ -10,7 +10,7 @@ import { SearchField } from './SearchField';
|
|
|
10
10
|
*/
|
|
11
11
|
export function ComboBox(props) {
|
|
12
12
|
// Destruct
|
|
13
|
-
const { search = false, idField = 'id', idValue, inputMargin, inputRequired, inputVariant, defaultValue, label, labelField, loadData, onLoadData, name, options = [], readOnly = true, onChange, value, getOptionLabel = labelField
|
|
13
|
+
const { search = false, idField = 'id', idValue, inputAutoComplete = 'new-region', inputMargin, inputRequired, inputVariant, defaultValue, label, labelField, loadData, onLoadData, name, options = [], readOnly = true, onChange, value, getOptionLabel = labelField
|
|
14
14
|
? (option) => option[labelField]
|
|
15
15
|
: undefined, sx = { minWidth: '150px' }, ...rest } = props;
|
|
16
16
|
// Value input ref
|
|
@@ -69,5 +69,5 @@ export function ComboBox(props) {
|
|
|
69
69
|
// Custom
|
|
70
70
|
if (onChange != null)
|
|
71
71
|
onChange(event, value, reason, details);
|
|
72
|
-
}, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete:
|
|
72
|
+
}, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete })) : (React.createElement(InputField, { ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete })), options: localOptions, ...rest })));
|
|
73
73
|
}
|
package/lib/mu/SelectEx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SelectProps } from '@mui/material';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { IdLabelDto } from '@etsoo/appscript';
|
|
4
4
|
/**
|
|
5
5
|
* Extended select component props
|
|
@@ -24,7 +24,7 @@ export interface SelectExProps<T extends Record<string, any> = IdLabelDto> exten
|
|
|
24
24
|
/**
|
|
25
25
|
* Item click handler
|
|
26
26
|
*/
|
|
27
|
-
onItemClick?:
|
|
27
|
+
onItemClick?: (event: React.MouseEvent, id: unknown) => void;
|
|
28
28
|
/**
|
|
29
29
|
* On load data handler
|
|
30
30
|
*/
|
package/lib/mu/SelectEx.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Utils as AppUtils } from '../app/Utils';
|
|
2
|
-
import { Checkbox, FormControl, InputLabel,
|
|
2
|
+
import { Checkbox, FormControl, InputLabel, ListItemText, MenuItem, OutlinedInput, Select } from '@mui/material';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { MUGlobal } from './MUGlobal';
|
|
5
|
+
import { ListItemRightIcon } from './ListItemRightIcon';
|
|
5
6
|
/**
|
|
6
7
|
* Extended select component
|
|
7
8
|
* @param props Props
|
|
@@ -110,7 +111,7 @@ export function SelectEx(props) {
|
|
|
110
111
|
// Option
|
|
111
112
|
return (React.createElement(MenuItem, { key: id, value: id, onClick: (event) => {
|
|
112
113
|
if (onItemClick) {
|
|
113
|
-
onItemClick(event);
|
|
114
|
+
onItemClick(event, id);
|
|
114
115
|
if (event.defaultPrevented)
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
@@ -119,6 +120,6 @@ export function SelectEx(props) {
|
|
|
119
120
|
} },
|
|
120
121
|
multiple && React.createElement(Checkbox, { checked: itemChecked(id) }),
|
|
121
122
|
React.createElement(ListItemText, { primary: label }),
|
|
122
|
-
itemIconRenderer && (React.createElement(
|
|
123
|
+
itemIconRenderer && (React.createElement(ListItemRightIcon, null, itemIconRenderer(id)))));
|
|
123
124
|
}))));
|
|
124
125
|
}
|
package/lib/mu/Tiplist.js
CHANGED
|
@@ -10,7 +10,7 @@ import { SearchField } from './SearchField';
|
|
|
10
10
|
*/
|
|
11
11
|
export function Tiplist(props) {
|
|
12
12
|
// Destruct
|
|
13
|
-
const { search = false, idField = 'id', idValue, inputMargin, inputRequired, inputVariant, label, loadData, defaultValue, value, name, readOnly, onChange, sx = { minWidth: '180px' }, ...rest } = props;
|
|
13
|
+
const { search = false, idField = 'id', idValue, inputAutoComplete = 'off', inputMargin, inputRequired, inputVariant, label, loadData, defaultValue, value, name, readOnly, onChange, sx = { minWidth: '180px' }, ...rest } = props;
|
|
14
14
|
// Value input ref
|
|
15
15
|
const inputRef = React.createRef();
|
|
16
16
|
// Local value
|
|
@@ -149,5 +149,5 @@ export function Tiplist(props) {
|
|
|
149
149
|
open: false,
|
|
150
150
|
...(!states.value && { options: [] })
|
|
151
151
|
});
|
|
152
|
-
}, loading: states.loading, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, ...params, readOnly: readOnly, label: label, margin: inputMargin, variant: inputVariant, required: inputRequired })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], ...rest })));
|
|
152
|
+
}, loading: states.loading, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, ...params, readOnly: readOnly, label: label, margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], ...rest })));
|
|
153
153
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ export * from './mu/FlexBox';
|
|
|
43
43
|
export * from './mu/IconButtonLink';
|
|
44
44
|
export * from './mu/InputField';
|
|
45
45
|
export * from './mu/ItemList';
|
|
46
|
+
export * from './mu/ListItemRightIcon';
|
|
46
47
|
export * from './mu/LoadingButton';
|
|
47
48
|
export * from './mu/MaskInput';
|
|
48
49
|
export * from './mu/MoreFab';
|
|
@@ -19,6 +19,11 @@ export interface AutocompleteExtendedProps<T extends Record<string, any>>
|
|
|
19
19
|
*/
|
|
20
20
|
idValue?: DataTypes.IdType;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Autocomplete for the input
|
|
24
|
+
*/
|
|
25
|
+
inputAutoComplete?: string;
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
24
29
|
* @default 'none'
|
package/src/mu/ComboBox.tsx
CHANGED
|
@@ -45,6 +45,7 @@ export function ComboBox<T extends Record<string, any> = IdLabelDto>(
|
|
|
45
45
|
search = false,
|
|
46
46
|
idField = 'id',
|
|
47
47
|
idValue,
|
|
48
|
+
inputAutoComplete = 'new-region',
|
|
48
49
|
inputMargin,
|
|
49
50
|
inputRequired,
|
|
50
51
|
inputVariant,
|
|
@@ -156,7 +157,7 @@ export function ComboBox<T extends Record<string, any> = IdLabelDto>(
|
|
|
156
157
|
margin={inputMargin}
|
|
157
158
|
variant={inputVariant}
|
|
158
159
|
required={inputRequired}
|
|
159
|
-
autoComplete=
|
|
160
|
+
autoComplete={inputAutoComplete}
|
|
160
161
|
/>
|
|
161
162
|
) : (
|
|
162
163
|
<InputField
|
|
@@ -165,7 +166,7 @@ export function ComboBox<T extends Record<string, any> = IdLabelDto>(
|
|
|
165
166
|
margin={inputMargin}
|
|
166
167
|
variant={inputVariant}
|
|
167
168
|
required={inputRequired}
|
|
168
|
-
autoComplete=
|
|
169
|
+
autoComplete={inputAutoComplete}
|
|
169
170
|
/>
|
|
170
171
|
)
|
|
171
172
|
}
|
package/src/mu/SelectEx.tsx
CHANGED
|
@@ -11,9 +11,10 @@ import {
|
|
|
11
11
|
SelectChangeEvent,
|
|
12
12
|
SelectProps
|
|
13
13
|
} from '@mui/material';
|
|
14
|
-
import React
|
|
14
|
+
import React from 'react';
|
|
15
15
|
import { MUGlobal } from './MUGlobal';
|
|
16
16
|
import { IdLabelDto } from '@etsoo/appscript';
|
|
17
|
+
import { ListItemRightIcon } from './ListItemRightIcon';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Extended select component props
|
|
@@ -43,7 +44,7 @@ export interface SelectExProps<T extends Record<string, any> = IdLabelDto>
|
|
|
43
44
|
/**
|
|
44
45
|
* Item click handler
|
|
45
46
|
*/
|
|
46
|
-
onItemClick?:
|
|
47
|
+
onItemClick?: (event: React.MouseEvent, id: unknown) => void;
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* On load data handler
|
|
@@ -217,7 +218,7 @@ export function SelectEx<T extends Record<string, any> = IdLabelDto>(
|
|
|
217
218
|
value={id}
|
|
218
219
|
onClick={(event) => {
|
|
219
220
|
if (onItemClick) {
|
|
220
|
-
onItemClick(event);
|
|
221
|
+
onItemClick(event, id);
|
|
221
222
|
if (event.defaultPrevented) return;
|
|
222
223
|
}
|
|
223
224
|
if (!multiple) setItemValue(id);
|
|
@@ -226,9 +227,9 @@ export function SelectEx<T extends Record<string, any> = IdLabelDto>(
|
|
|
226
227
|
{multiple && <Checkbox checked={itemChecked(id)} />}
|
|
227
228
|
<ListItemText primary={label} />
|
|
228
229
|
{itemIconRenderer && (
|
|
229
|
-
<
|
|
230
|
+
<ListItemRightIcon>
|
|
230
231
|
{itemIconRenderer(id)}
|
|
231
|
-
</
|
|
232
|
+
</ListItemRightIcon>
|
|
232
233
|
)}
|
|
233
234
|
</MenuItem>
|
|
234
235
|
);
|
package/src/mu/Tiplist.tsx
CHANGED
|
@@ -42,6 +42,7 @@ export function Tiplist<T extends Record<string, any> = IdLabelDto>(
|
|
|
42
42
|
search = false,
|
|
43
43
|
idField = 'id',
|
|
44
44
|
idValue,
|
|
45
|
+
inputAutoComplete = 'off',
|
|
45
46
|
inputMargin,
|
|
46
47
|
inputRequired,
|
|
47
48
|
inputVariant,
|
|
@@ -263,6 +264,7 @@ export function Tiplist<T extends Record<string, any> = IdLabelDto>(
|
|
|
263
264
|
margin={inputMargin}
|
|
264
265
|
variant={inputVariant}
|
|
265
266
|
required={inputRequired}
|
|
267
|
+
autoComplete={inputAutoComplete}
|
|
266
268
|
/>
|
|
267
269
|
) : (
|
|
268
270
|
<InputField
|
|
@@ -272,6 +274,7 @@ export function Tiplist<T extends Record<string, any> = IdLabelDto>(
|
|
|
272
274
|
margin={inputMargin}
|
|
273
275
|
variant={inputVariant}
|
|
274
276
|
required={inputRequired}
|
|
277
|
+
autoComplete={inputAutoComplete}
|
|
275
278
|
/>
|
|
276
279
|
)
|
|
277
280
|
}
|