@etsoo/react 1.4.72 → 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/index.d.ts +1 -0
- package/lib/index.js +1 -0
- 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/MobileListItemRenderer.js +0 -1
- package/lib/mu/OptionGroup.d.ts +2 -2
- package/lib/mu/ScrollerListEx.d.ts +1 -1
- package/lib/mu/SelectBool.d.ts +14 -0
- package/lib/mu/SelectBool.js +21 -0
- package/lib/mu/SelectEx.d.ts +2 -2
- package/lib/mu/TableEx.d.ts +1 -1
- package/lib/mu/Tiplist.js +3 -1
- package/lib/mu/pages/ViewPage.d.ts +1 -1
- package/lib/mu/pages/ViewPage.js +1 -1
- package/package.json +2 -2
- package/src/components/ScrollerGrid.tsx +1 -1
- package/src/index.ts +1 -0
- 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/MobileListItemRenderer.tsx +0 -2
- package/src/mu/OptionGroup.tsx +2 -2
- package/src/mu/ScrollerListEx.tsx +1 -1
- package/src/mu/SelectBool.tsx +31 -0
- package/src/mu/SelectEx.tsx +2 -2
- package/src/mu/TableEx.tsx +2 -2
- package/src/mu/Tiplist.tsx +7 -1
- package/src/mu/pages/ViewPage.tsx +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export * from './mu/ScrollTopFab';
|
|
|
64
64
|
export * from './mu/SearchBar';
|
|
65
65
|
export * from './mu/SearchField';
|
|
66
66
|
export * from './mu/SearchOptionGroup';
|
|
67
|
+
export * from './mu/SelectBool';
|
|
67
68
|
export * from './mu/SelectEx';
|
|
68
69
|
export * from './mu/Switch';
|
|
69
70
|
export * from './mu/SwitchAnt';
|
package/lib/index.js
CHANGED
|
@@ -67,6 +67,7 @@ export * from './mu/ScrollTopFab';
|
|
|
67
67
|
export * from './mu/SearchBar';
|
|
68
68
|
export * from './mu/SearchField';
|
|
69
69
|
export * from './mu/SearchOptionGroup';
|
|
70
|
+
export * from './mu/SelectBool';
|
|
70
71
|
export * from './mu/SelectEx';
|
|
71
72
|
export * from './mu/Switch';
|
|
72
73
|
export * from './mu/SwitchAnt';
|
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
|
*/
|
|
@@ -22,7 +22,6 @@ export function MobileListItemRenderer({ data, itemHeight, margins }, renderer)
|
|
|
22
22
|
// Loading
|
|
23
23
|
if (data == null)
|
|
24
24
|
return React.createElement(LinearProgress, null);
|
|
25
|
-
console.log('margins', margins);
|
|
26
25
|
// Elements
|
|
27
26
|
const [title, subheader, actions, children, cardActions] = renderer(data);
|
|
28
27
|
return (React.createElement(Card, { sx: {
|
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
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IdLabelDto } from '@etsoo/appscript';
|
|
3
|
+
import { SelectExProps } from './SelectEx';
|
|
4
|
+
/**
|
|
5
|
+
* SelectBool props
|
|
6
|
+
*/
|
|
7
|
+
export interface SelectBoolProps extends Omit<SelectExProps<IdLabelDto<string>>, 'options' | 'loadData'> {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* SelectBool (yes/no)
|
|
11
|
+
* @param props Props
|
|
12
|
+
* @returns Component
|
|
13
|
+
*/
|
|
14
|
+
export declare function SelectBool(props: SelectBoolProps): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { globalApp } from '..';
|
|
3
|
+
import { SelectEx } from './SelectEx';
|
|
4
|
+
/**
|
|
5
|
+
* SelectBool (yes/no)
|
|
6
|
+
* @param props Props
|
|
7
|
+
* @returns Component
|
|
8
|
+
*/
|
|
9
|
+
export function SelectBool(props) {
|
|
10
|
+
// Destruct
|
|
11
|
+
const { search = true, ...rest } = props;
|
|
12
|
+
// Options
|
|
13
|
+
const options = [
|
|
14
|
+
{ id: 'false', label: globalApp.get('no') },
|
|
15
|
+
{ id: 'true', label: globalApp.get('yes') }
|
|
16
|
+
];
|
|
17
|
+
if (search)
|
|
18
|
+
options.unshift({ id: '', label: '---' });
|
|
19
|
+
// Layout
|
|
20
|
+
return React.createElement(SelectEx, { options: options, search: search, ...rest });
|
|
21
|
+
}
|
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
|
@@ -29,6 +29,8 @@ export function Tiplist(props) {
|
|
|
29
29
|
options: [],
|
|
30
30
|
value: null
|
|
31
31
|
});
|
|
32
|
+
// Input value
|
|
33
|
+
const inputValue = React.useMemo(() => states.value && Reflect.get(states.value, idField), [states.value]);
|
|
32
34
|
React.useEffect(() => {
|
|
33
35
|
if (localValue != null)
|
|
34
36
|
stateUpdate({ value: localValue });
|
|
@@ -133,7 +135,7 @@ export function Tiplist(props) {
|
|
|
133
135
|
}, []);
|
|
134
136
|
// Layout
|
|
135
137
|
return (React.createElement("div", null,
|
|
136
|
-
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 }),
|
|
137
139
|
React.createElement(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
138
140
|
// Set value
|
|
139
141
|
setInputValue(value);
|
package/lib/mu/pages/ViewPage.js
CHANGED
|
@@ -86,6 +86,6 @@ export function ViewPage(props) {
|
|
|
86
86
|
":"),
|
|
87
87
|
React.createElement(Typography, { variant: "subtitle2" }, itemData)));
|
|
88
88
|
})),
|
|
89
|
-
actions != null && (React.createElement(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", paddingTop: paddings, paddingBottom: paddings, gap: paddings }, Utils.getResult(actions, data))),
|
|
89
|
+
actions != null && (React.createElement(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "flex-end", paddingTop: paddings, paddingBottom: paddings, gap: paddings }, Utils.getResult(actions, data))),
|
|
90
90
|
Utils.getResult(children, data)))));
|
|
91
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.76",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
51
51
|
"@emotion/style": "^0.8.0",
|
|
52
52
|
"@emotion/styled": "^11.6.0",
|
|
53
|
-
"@etsoo/appscript": "^1.2.
|
|
53
|
+
"@etsoo/appscript": "^1.2.28",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.0",
|
|
55
55
|
"@etsoo/shared": "^1.1.6",
|
|
56
56
|
"@mui/icons-material": "^5.3.1",
|
package/src/index.ts
CHANGED
|
@@ -71,6 +71,7 @@ export * from './mu/ScrollTopFab';
|
|
|
71
71
|
export * from './mu/SearchBar';
|
|
72
72
|
export * from './mu/SearchField';
|
|
73
73
|
export * from './mu/SearchOptionGroup';
|
|
74
|
+
export * from './mu/SelectBool';
|
|
74
75
|
export * from './mu/SelectEx';
|
|
75
76
|
export * from './mu/Switch';
|
|
76
77
|
export * from './mu/SwitchAnt';
|
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
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IdLabelDto } from '@etsoo/appscript';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { globalApp } from '..';
|
|
4
|
+
import { SelectEx, SelectExProps } from './SelectEx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SelectBool props
|
|
8
|
+
*/
|
|
9
|
+
export interface SelectBoolProps
|
|
10
|
+
extends Omit<SelectExProps<IdLabelDto<string>>, 'options' | 'loadData'> {}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SelectBool (yes/no)
|
|
14
|
+
* @param props Props
|
|
15
|
+
* @returns Component
|
|
16
|
+
*/
|
|
17
|
+
export function SelectBool(props: SelectBoolProps) {
|
|
18
|
+
// Destruct
|
|
19
|
+
const { search = true, ...rest } = props;
|
|
20
|
+
|
|
21
|
+
// Options
|
|
22
|
+
const options: IdLabelDto<string>[] = [
|
|
23
|
+
{ id: 'false', label: globalApp.get('no')! },
|
|
24
|
+
{ id: 'true', label: globalApp.get('yes')! }
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
if (search) options.unshift({ id: '', label: '---' });
|
|
28
|
+
|
|
29
|
+
// Layout
|
|
30
|
+
return <SelectEx options={options} search={search} {...rest} />;
|
|
31
|
+
}
|
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,7 +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={
|
|
228
|
+
value={inputValue ?? ''}
|
|
223
229
|
readOnly
|
|
224
230
|
onChange={inputOnChange}
|
|
225
231
|
/>
|
|
@@ -24,7 +24,7 @@ export interface ViewPageField<T extends {}> extends GridProps {
|
|
|
24
24
|
/**
|
|
25
25
|
* Data field
|
|
26
26
|
*/
|
|
27
|
-
data: keyof T | ((item: T) => React.ReactNode);
|
|
27
|
+
data: (string & keyof T) | ((item: T) => React.ReactNode);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Data type
|
|
@@ -222,6 +222,7 @@ export function ViewPage<T extends {}>(props: ViewPageProps<T>) {
|
|
|
222
222
|
direction="row"
|
|
223
223
|
width="100%"
|
|
224
224
|
flexWrap="wrap"
|
|
225
|
+
justifyContent="flex-end"
|
|
225
226
|
paddingTop={paddings}
|
|
226
227
|
paddingBottom={paddings}
|
|
227
228
|
gap={paddings}
|