@etsoo/react 1.4.75 → 1.4.76
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/components/ScrollerGrid.d.ts +1 -1
- package/lib/mu/AutocompleteExtendedProps.d.ts +1 -1
- package/lib/mu/ComboBox.d.ts +1 -1
- package/lib/mu/DnDList.d.ts +1 -1
- package/lib/mu/ItemList.d.ts +2 -2
- package/lib/mu/OptionGroup.d.ts +2 -2
- package/lib/mu/ScrollerListEx.d.ts +1 -1
- package/lib/mu/SelectEx.d.ts +2 -2
- package/lib/mu/TableEx.d.ts +1 -1
- package/lib/mu/Tiplist.js +3 -2
- package/lib/mu/pages/ViewPage.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/ScrollerGrid.tsx +1 -1
- package/src/mu/AutocompleteExtendedProps.ts +1 -1
- package/src/mu/ComboBox.tsx +1 -1
- package/src/mu/DnDList.tsx +1 -1
- package/src/mu/ItemList.tsx +2 -2
- package/src/mu/OptionGroup.tsx +2 -2
- package/src/mu/ScrollerListEx.tsx +1 -1
- package/src/mu/SelectEx.tsx +2 -2
- package/src/mu/TableEx.tsx +2 -2
- package/src/mu/Tiplist.tsx +7 -3
- package/src/mu/pages/ViewPage.tsx +1 -1
package/lib/mu/ComboBox.d.ts
CHANGED
package/lib/mu/DnDList.d.ts
CHANGED
package/lib/mu/ItemList.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ export interface ItemListProps<T extends Record<string, unknown>> {
|
|
|
10
10
|
/**
|
|
11
11
|
* Id field name
|
|
12
12
|
*/
|
|
13
|
-
idField?: keyof T;
|
|
13
|
+
idField?: string & keyof T;
|
|
14
14
|
/**
|
|
15
15
|
* Label field name or callback
|
|
16
16
|
*/
|
|
17
|
-
labelField?: keyof T | ((item: T) => string);
|
|
17
|
+
labelField?: (string & keyof T) | ((item: T) => string);
|
|
18
18
|
/**
|
|
19
19
|
* Button icon
|
|
20
20
|
*/
|
package/lib/mu/OptionGroup.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface OptionGroupProps<T extends Record<string, any> = IdLabelDto, D
|
|
|
17
17
|
/**
|
|
18
18
|
* Id field, default is id
|
|
19
19
|
*/
|
|
20
|
-
idField?: keyof T;
|
|
20
|
+
idField?: string & keyof T;
|
|
21
21
|
/**
|
|
22
22
|
* Label
|
|
23
23
|
*/
|
|
@@ -25,7 +25,7 @@ export interface OptionGroupProps<T extends Record<string, any> = IdLabelDto, D
|
|
|
25
25
|
/**
|
|
26
26
|
* Label field, default is label
|
|
27
27
|
*/
|
|
28
|
-
labelField?: keyof T;
|
|
28
|
+
labelField?: string & keyof T;
|
|
29
29
|
/**
|
|
30
30
|
* Multiple choose item
|
|
31
31
|
*/
|
package/lib/mu/SelectEx.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface SelectExProps<T extends {}> extends Omit<SelectProps, 'labelId'
|
|
|
8
8
|
/**
|
|
9
9
|
* Id field, default is id
|
|
10
10
|
*/
|
|
11
|
-
idField?: keyof T;
|
|
11
|
+
idField?: string & keyof T;
|
|
12
12
|
/**
|
|
13
13
|
* Item icon renderer
|
|
14
14
|
*/
|
|
@@ -16,7 +16,7 @@ export interface SelectExProps<T extends {}> extends Omit<SelectProps, 'labelId'
|
|
|
16
16
|
/**
|
|
17
17
|
* Label field, default is label
|
|
18
18
|
*/
|
|
19
|
-
labelField?: ((option: T) => string) | keyof T;
|
|
19
|
+
labelField?: ((option: T) => string) | (string & keyof T);
|
|
20
20
|
/**
|
|
21
21
|
* Load data callback
|
|
22
22
|
*/
|
package/lib/mu/TableEx.d.ts
CHANGED
package/lib/mu/Tiplist.js
CHANGED
|
@@ -10,7 +10,6 @@ import { SearchField } from './SearchField';
|
|
|
10
10
|
* @returns Component
|
|
11
11
|
*/
|
|
12
12
|
export function Tiplist(props) {
|
|
13
|
-
var _a;
|
|
14
13
|
// Destruct
|
|
15
14
|
const { search = false, idField = 'id', idValue, inputAutoComplete = 'off', inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, label, loadData, defaultValue, value, name, readOnly, onChange, openOnFocus = true, sx = { minWidth: '180px' }, ...rest } = props;
|
|
16
15
|
// Value input ref
|
|
@@ -30,6 +29,8 @@ export function Tiplist(props) {
|
|
|
30
29
|
options: [],
|
|
31
30
|
value: null
|
|
32
31
|
});
|
|
32
|
+
// Input value
|
|
33
|
+
const inputValue = React.useMemo(() => states.value && Reflect.get(states.value, idField), [states.value]);
|
|
33
34
|
React.useEffect(() => {
|
|
34
35
|
if (localValue != null)
|
|
35
36
|
stateUpdate({ value: localValue });
|
|
@@ -134,7 +135,7 @@ export function Tiplist(props) {
|
|
|
134
135
|
}, []);
|
|
135
136
|
// Layout
|
|
136
137
|
return (React.createElement("div", null,
|
|
137
|
-
React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: 'none' }, name: name, value:
|
|
138
|
+
React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: 'none' }, name: name, value: inputValue !== null && inputValue !== void 0 ? inputValue : '', readOnly: true, onChange: inputOnChange }),
|
|
138
139
|
React.createElement(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
139
140
|
// Set value
|
|
140
141
|
setInputValue(value);
|
package/package.json
CHANGED
package/src/mu/ComboBox.tsx
CHANGED
package/src/mu/DnDList.tsx
CHANGED
package/src/mu/ItemList.tsx
CHANGED
|
@@ -22,12 +22,12 @@ export interface ItemListProps<T extends Record<string, unknown>> {
|
|
|
22
22
|
/**
|
|
23
23
|
* Id field name
|
|
24
24
|
*/
|
|
25
|
-
idField?: keyof T;
|
|
25
|
+
idField?: string & keyof T;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Label field name or callback
|
|
29
29
|
*/
|
|
30
|
-
labelField?: keyof T | ((item: T) => string);
|
|
30
|
+
labelField?: (string & keyof T) | ((item: T) => string);
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Button icon
|
package/src/mu/OptionGroup.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export interface OptionGroupProps<
|
|
|
32
32
|
/**
|
|
33
33
|
* Id field, default is id
|
|
34
34
|
*/
|
|
35
|
-
idField?: keyof T;
|
|
35
|
+
idField?: string & keyof T;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Label
|
|
@@ -42,7 +42,7 @@ export interface OptionGroupProps<
|
|
|
42
42
|
/**
|
|
43
43
|
* Label field, default is label
|
|
44
44
|
*/
|
|
45
|
-
labelField?: keyof T;
|
|
45
|
+
labelField?: string & keyof T;
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Multiple choose item
|
package/src/mu/SelectEx.tsx
CHANGED
|
@@ -23,7 +23,7 @@ export interface SelectExProps<T extends {}>
|
|
|
23
23
|
/**
|
|
24
24
|
* Id field, default is id
|
|
25
25
|
*/
|
|
26
|
-
idField?: keyof T;
|
|
26
|
+
idField?: string & keyof T;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Item icon renderer
|
|
@@ -33,7 +33,7 @@ export interface SelectExProps<T extends {}>
|
|
|
33
33
|
/**
|
|
34
34
|
* Label field, default is label
|
|
35
35
|
*/
|
|
36
|
-
labelField?: ((option: T) => string) | keyof T;
|
|
36
|
+
labelField?: ((option: T) => string) | (string & keyof T);
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Load data callback
|
package/src/mu/TableEx.tsx
CHANGED
|
@@ -68,7 +68,7 @@ export interface TableExProps<T extends Record<string, any>>
|
|
|
68
68
|
/**
|
|
69
69
|
* Id field
|
|
70
70
|
*/
|
|
71
|
-
idField?: keyof T;
|
|
71
|
+
idField?: string & keyof T;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Max height
|
|
@@ -107,7 +107,7 @@ export function TableEx<T extends Record<string, unknown>>(
|
|
|
107
107
|
// Theme
|
|
108
108
|
const theme = useTheme();
|
|
109
109
|
|
|
110
|
-
type keyType = keyof T;
|
|
110
|
+
type keyType = string & keyof T;
|
|
111
111
|
|
|
112
112
|
// Destruct
|
|
113
113
|
const {
|
package/src/mu/Tiplist.tsx
CHANGED
|
@@ -83,6 +83,12 @@ export function Tiplist<T extends {} = IdLabelDto>(props: TiplistProps<T>) {
|
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
85
|
|
|
86
|
+
// Input value
|
|
87
|
+
const inputValue = React.useMemo(
|
|
88
|
+
() => states.value && Reflect.get(states.value, idField),
|
|
89
|
+
[states.value]
|
|
90
|
+
);
|
|
91
|
+
|
|
86
92
|
React.useEffect(() => {
|
|
87
93
|
if (localValue != null) stateUpdate({ value: localValue });
|
|
88
94
|
}, [localValue]);
|
|
@@ -219,9 +225,7 @@ export function Tiplist<T extends {} = IdLabelDto>(props: TiplistProps<T>) {
|
|
|
219
225
|
type="text"
|
|
220
226
|
style={{ display: 'none' }}
|
|
221
227
|
name={name}
|
|
222
|
-
value={
|
|
223
|
-
(states.value && Reflect.get(states.value, idField)) ?? ''
|
|
224
|
-
}
|
|
228
|
+
value={inputValue ?? ''}
|
|
225
229
|
readOnly
|
|
226
230
|
onChange={inputOnChange}
|
|
227
231
|
/>
|