@etsoo/react 1.5.78 → 1.5.79
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 +3 -3
- package/lib/mu/AutocompleteExtendedProps.d.ts +5 -7
- package/lib/mu/ComboBox.d.ts +8 -10
- package/lib/mu/DataGridEx.d.ts +3 -3
- package/lib/mu/ItemList.d.ts +6 -5
- package/lib/mu/ItemList.js +4 -12
- package/lib/mu/OptionGroup.d.ts +12 -16
- package/lib/mu/ResponsibleContainer.d.ts +3 -3
- package/lib/mu/ScrollerListEx.d.ts +3 -3
- package/lib/mu/SearchOptionGroup.d.ts +2 -2
- package/lib/mu/SelectBool.d.ts +2 -3
- package/lib/mu/SelectBool.js +1 -1
- package/lib/mu/SelectEx.d.ts +12 -16
- package/lib/mu/TableEx.d.ts +8 -10
- package/lib/mu/Tiplist.d.ts +2 -2
- package/lib/mu/pages/DataGridPage.d.ts +2 -2
- package/lib/mu/pages/DataGridPageProps.d.ts +2 -2
- package/lib/mu/pages/FixedListPage.d.ts +2 -2
- package/lib/mu/pages/ListPage.d.ts +2 -2
- package/lib/mu/pages/ListPageProps.d.ts +1 -1
- package/lib/mu/pages/ResponsivePage.d.ts +2 -2
- package/lib/mu/pages/ResponsivePageProps.d.ts +2 -2
- package/lib/mu/pages/TablePage.d.ts +2 -2
- package/lib/mu/pages/TablePageProps.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/ScrollerGrid.tsx +3 -3
- package/src/mu/AutocompleteExtendedProps.ts +6 -7
- package/src/mu/ComboBox.tsx +20 -13
- package/src/mu/DataGridEx.tsx +3 -3
- package/src/mu/ItemList.tsx +28 -25
- package/src/mu/OptionGroup.tsx +26 -21
- package/src/mu/ResponsibleContainer.tsx +3 -3
- package/src/mu/ScrollerListEx.tsx +3 -3
- package/src/mu/SearchOptionGroup.tsx +11 -5
- package/src/mu/SelectBool.tsx +7 -14
- package/src/mu/SelectEx.tsx +25 -20
- package/src/mu/TableEx.tsx +9 -10
- package/src/mu/Tiplist.tsx +3 -3
- package/src/mu/pages/DataGridPage.tsx +2 -2
- package/src/mu/pages/DataGridPageProps.ts +2 -2
- package/src/mu/pages/FixedListPage.tsx +5 -4
- package/src/mu/pages/ListPage.tsx +5 -4
- package/src/mu/pages/ListPageProps.ts +3 -2
- package/src/mu/pages/ResponsivePage.tsx +2 -2
- package/src/mu/pages/ResponsivePageProps.ts +2 -2
- package/src/mu/pages/TablePage.tsx +5 -4
- package/src/mu/pages/TablePageProps.ts +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Align, GridChildComponentProps, VariableSizeGridProps } from 'react-window';
|
|
4
4
|
import { GridMethodRef } from '../mu/GridMethodRef';
|
|
@@ -16,7 +16,7 @@ export declare type ScrollerGridItemRendererProps<T> = Omit<GridChildComponentPr
|
|
|
16
16
|
/**
|
|
17
17
|
* Scroller vertical grid props
|
|
18
18
|
*/
|
|
19
|
-
export declare type ScrollerGridProps<T extends object, D extends DataTypes.Keys<T
|
|
19
|
+
export declare type ScrollerGridProps<T extends object, D extends DataTypes.Keys<T>> = GridLoader<T> & Omit<VariableSizeGridProps<T>, 'children' | 'rowCount' | 'rowHeight' | 'ref'> & {
|
|
20
20
|
/**
|
|
21
21
|
* Default order by asc
|
|
22
22
|
* @default true
|
|
@@ -109,4 +109,4 @@ export interface ScrollerGridForwardRef extends GridMethodRef {
|
|
|
109
109
|
* @param props Props
|
|
110
110
|
* @returns Component
|
|
111
111
|
*/
|
|
112
|
-
export declare const ScrollerGrid: <T extends object, D extends DataTypes.Keys<T, string | number> =
|
|
112
|
+
export declare const ScrollerGrid: <T extends object, D extends DataTypes.Keys<T, string | number> = IdDefaultType<T>>(props: ScrollerGridProps<T, D>) => JSX.Element;
|
|
@@ -5,6 +5,10 @@ import { ChangeEventHandler } from 'react';
|
|
|
5
5
|
* Autocomplete extended props
|
|
6
6
|
*/
|
|
7
7
|
export declare type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys<T>> = Omit<AutocompleteProps<T, undefined, false, false>, 'renderInput' | 'options'> & {
|
|
8
|
+
/**
|
|
9
|
+
* Id field
|
|
10
|
+
*/
|
|
11
|
+
idField?: D;
|
|
8
12
|
/**
|
|
9
13
|
* Id value
|
|
10
14
|
*/
|
|
@@ -57,10 +61,4 @@ export declare type AutocompleteExtendedProps<T extends object, D extends DataTy
|
|
|
57
61
|
* Is search field?
|
|
58
62
|
*/
|
|
59
63
|
search?: boolean;
|
|
60
|
-
}
|
|
61
|
-
id: DataTypes.IdType;
|
|
62
|
-
} ? {
|
|
63
|
-
idField?: D;
|
|
64
|
-
} : {
|
|
65
|
-
idField: D;
|
|
66
|
-
});
|
|
64
|
+
};
|
package/lib/mu/ComboBox.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from '@etsoo/shared';
|
|
3
3
|
import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
|
|
4
4
|
/**
|
|
5
5
|
* ComboBox props
|
|
6
6
|
*/
|
|
7
|
-
export declare type ComboBoxProps<T extends object, D extends DataTypes.Keys<T
|
|
7
|
+
export declare type ComboBoxProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> = AutocompleteExtendedProps<T, D> & {
|
|
8
8
|
/**
|
|
9
9
|
* Auto add blank item
|
|
10
10
|
*/
|
|
@@ -13,6 +13,10 @@ export declare type ComboBoxProps<T extends object, D extends DataTypes.Keys<T>
|
|
|
13
13
|
* Data readonly
|
|
14
14
|
*/
|
|
15
15
|
dataReadonly?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Label field
|
|
18
|
+
*/
|
|
19
|
+
labelField?: L;
|
|
16
20
|
/**
|
|
17
21
|
* Load data callback
|
|
18
22
|
*/
|
|
@@ -25,16 +29,10 @@ export declare type ComboBoxProps<T extends object, D extends DataTypes.Keys<T>
|
|
|
25
29
|
* Array of options.
|
|
26
30
|
*/
|
|
27
31
|
options?: ReadonlyArray<T>;
|
|
28
|
-
}
|
|
29
|
-
label: string;
|
|
30
|
-
} ? {
|
|
31
|
-
labelField?: D;
|
|
32
|
-
} : {
|
|
33
|
-
labelField: D;
|
|
34
|
-
});
|
|
32
|
+
};
|
|
35
33
|
/**
|
|
36
34
|
* ComboBox
|
|
37
35
|
* @param props Props
|
|
38
36
|
* @returns Component
|
|
39
37
|
*/
|
|
40
|
-
export declare function ComboBox<T extends object =
|
|
38
|
+
export declare function ComboBox<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>>(props: ComboBoxProps<T, D, L>): JSX.Element;
|
package/lib/mu/DataGridEx.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { GridColumn } from '../components/GridColumn';
|
|
4
4
|
import { GridLoaderStates } from '../components/GridLoader';
|
|
@@ -17,7 +17,7 @@ export declare type DataGridExFooterItemRendererProps<T extends object> = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Extended DataGrid with VariableSizeGrid props
|
|
19
19
|
*/
|
|
20
|
-
export declare type DataGridExProps<T extends object, D extends DataTypes.Keys<T
|
|
20
|
+
export declare type DataGridExProps<T extends object, D extends DataTypes.Keys<T>> = Omit<ScrollerGridProps<T, D>, 'itemRenderer' | 'columnCount' | 'columnWidth' | 'width'> & {
|
|
21
21
|
/**
|
|
22
22
|
* Alternating colors for odd/even rows
|
|
23
23
|
*/
|
|
@@ -93,4 +93,4 @@ export declare function DataGridExCalColumns<T>(columns: GridColumn<T>[]): {
|
|
|
93
93
|
* @param props Props
|
|
94
94
|
* @returns Component
|
|
95
95
|
*/
|
|
96
|
-
export declare function DataGridEx<T extends object, D extends DataTypes.Keys<T> =
|
|
96
|
+
export declare function DataGridEx<T extends object, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: DataGridExProps<T, D>): JSX.Element;
|
package/lib/mu/ItemList.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from '@etsoo/shared';
|
|
2
3
|
/**
|
|
3
4
|
* Item list properties
|
|
4
5
|
*/
|
|
5
|
-
export interface ItemListProps<T extends
|
|
6
|
+
export interface ItemListProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> {
|
|
6
7
|
/**
|
|
7
8
|
* Style class name
|
|
8
9
|
*/
|
|
@@ -10,11 +11,11 @@ export interface ItemListProps<T extends Record<string, unknown>> {
|
|
|
10
11
|
/**
|
|
11
12
|
* Id field name
|
|
12
13
|
*/
|
|
13
|
-
idField?:
|
|
14
|
+
idField?: D;
|
|
14
15
|
/**
|
|
15
16
|
* Label field name or callback
|
|
16
17
|
*/
|
|
17
|
-
labelField?:
|
|
18
|
+
labelField?: L | ((item: T) => string);
|
|
18
19
|
/**
|
|
19
20
|
* Button icon
|
|
20
21
|
*/
|
|
@@ -30,7 +31,7 @@ export interface ItemListProps<T extends Record<string, unknown>> {
|
|
|
30
31
|
/**
|
|
31
32
|
* Current selected language
|
|
32
33
|
*/
|
|
33
|
-
selectedValue?:
|
|
34
|
+
selectedValue?: T[D];
|
|
34
35
|
/**
|
|
35
36
|
* Button size
|
|
36
37
|
*/
|
|
@@ -52,4 +53,4 @@ export interface ItemListProps<T extends Record<string, unknown>> {
|
|
|
52
53
|
* Item list component
|
|
53
54
|
* @param props Properties
|
|
54
55
|
*/
|
|
55
|
-
export declare function ItemList<T extends
|
|
56
|
+
export declare function ItemList<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>>(props: ItemListProps<T, D, L>): JSX.Element;
|
package/lib/mu/ItemList.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Dialog, DialogTitle, List,
|
|
2
|
+
import { Dialog, DialogTitle, List, ListItemText, DialogContent, Button, ListItemButton } from '@mui/material';
|
|
3
3
|
import { DataTypes } from '@etsoo/shared';
|
|
4
4
|
/**
|
|
5
5
|
* Item list component
|
|
@@ -9,14 +9,6 @@ export function ItemList(props) {
|
|
|
9
9
|
var _a;
|
|
10
10
|
// properties destructure
|
|
11
11
|
const { className, color = 'primary', items, idField = 'id', labelField = 'label', icon, onClose, selectedValue, size = 'medium', title, variant = 'outlined' } = props;
|
|
12
|
-
// Get id
|
|
13
|
-
const getId = (item) => {
|
|
14
|
-
var _a;
|
|
15
|
-
const id = item[idField];
|
|
16
|
-
if (typeof id === 'number')
|
|
17
|
-
return id;
|
|
18
|
-
return (_a = DataTypes.convert(id, 'string')) !== null && _a !== void 0 ? _a : '';
|
|
19
|
-
};
|
|
20
12
|
// Get label
|
|
21
13
|
const getLabel = (item) => {
|
|
22
14
|
var _a;
|
|
@@ -30,7 +22,7 @@ export function ItemList(props) {
|
|
|
30
22
|
// Dialog open or not state
|
|
31
23
|
const [open, setOpen] = React.useState(false);
|
|
32
24
|
// Default state
|
|
33
|
-
const defaultItem = (_a = items.find((item) =>
|
|
25
|
+
const defaultItem = (_a = items.find((item) => item[idField] === selectedValue)) !== null && _a !== void 0 ? _a : items[0];
|
|
34
26
|
// Current item
|
|
35
27
|
const [currentItem, setCurrentItem] = React.useState(defaultItem);
|
|
36
28
|
// Click handler
|
|
@@ -70,8 +62,8 @@ export function ItemList(props) {
|
|
|
70
62
|
React.createElement(DialogTitle, { sx: { minWidth: '200px' }, id: "dialog-title" }, title || ''),
|
|
71
63
|
React.createElement(DialogContent, null,
|
|
72
64
|
React.createElement(List, null, items.map((item) => {
|
|
73
|
-
const id =
|
|
74
|
-
return (React.createElement(
|
|
65
|
+
const id = item[idField];
|
|
66
|
+
return (React.createElement(ListItemButton, { key: id, disabled: id === currentItem[idField], onClick: () => closeItemHandler(item) },
|
|
75
67
|
React.createElement(ListItemText, null, getLabel(item))));
|
|
76
68
|
}))))));
|
|
77
69
|
}
|
package/lib/mu/OptionGroup.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from '@etsoo/shared';
|
|
3
3
|
import { FormControlProps } from '@mui/material';
|
|
4
4
|
/**
|
|
5
5
|
* OptionGroup props
|
|
6
6
|
*/
|
|
7
|
-
export declare type OptionGroupProps<T extends object
|
|
7
|
+
export declare type OptionGroupProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> = Omit<FormControlProps<'fieldset'>, 'defaultValue'> & {
|
|
8
8
|
/**
|
|
9
9
|
* Default value
|
|
10
10
|
*/
|
|
@@ -13,10 +13,18 @@ export declare type OptionGroupProps<T extends object = DataTypes.IdLabelItem, D
|
|
|
13
13
|
* Get option label function
|
|
14
14
|
*/
|
|
15
15
|
getOptionLabel?: (option: T) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Id field
|
|
18
|
+
*/
|
|
19
|
+
idField?: D;
|
|
16
20
|
/**
|
|
17
21
|
* Label
|
|
18
22
|
*/
|
|
19
23
|
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Label field
|
|
26
|
+
*/
|
|
27
|
+
labelField?: L;
|
|
20
28
|
/**
|
|
21
29
|
* Multiple choose item
|
|
22
30
|
*/
|
|
@@ -41,22 +49,10 @@ export declare type OptionGroupProps<T extends object = DataTypes.IdLabelItem, D
|
|
|
41
49
|
* Display group of elements in a compact row
|
|
42
50
|
*/
|
|
43
51
|
row?: boolean;
|
|
44
|
-
}
|
|
45
|
-
id: DataTypes.IdType;
|
|
46
|
-
} ? {
|
|
47
|
-
idField?: D;
|
|
48
|
-
} : {
|
|
49
|
-
idField: D;
|
|
50
|
-
}) & (T extends {
|
|
51
|
-
label: string;
|
|
52
|
-
} ? {
|
|
53
|
-
labelField?: D;
|
|
54
|
-
} : {
|
|
55
|
-
labelField: D;
|
|
56
|
-
});
|
|
52
|
+
};
|
|
57
53
|
/**
|
|
58
54
|
* OptionGroup
|
|
59
55
|
* @param props Props
|
|
60
56
|
* @returns Component
|
|
61
57
|
*/
|
|
62
|
-
export declare function OptionGroup<T extends object =
|
|
58
|
+
export declare function OptionGroup<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>>(props: OptionGroupProps<T, D, L>): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ListChildComponentProps } from 'react-window';
|
|
@@ -10,7 +10,7 @@ import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from './
|
|
|
10
10
|
/**
|
|
11
11
|
* ResponsibleContainer props
|
|
12
12
|
*/
|
|
13
|
-
export declare type ResponsibleContainerProps<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> =
|
|
13
|
+
export declare type ResponsibleContainerProps<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = Omit<DataGridExProps<T, D>, 'height' | 'itemKey' | 'loadData' | 'mRef' | 'onScroll' | 'onItemsRendered'> & {
|
|
14
14
|
/**
|
|
15
15
|
* Height will be deducted
|
|
16
16
|
* @param height Current calcuated height
|
|
@@ -86,4 +86,4 @@ export declare type ResponsibleContainerProps<T extends object, F extends DataTy
|
|
|
86
86
|
* @param props Props
|
|
87
87
|
* @returns Layout
|
|
88
88
|
*/
|
|
89
|
-
export declare function ResponsibleContainer<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> =
|
|
89
|
+
export declare function ResponsibleContainer<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ResponsibleContainerProps<T, F, D>): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ListChildComponentProps } from 'react-window';
|
|
4
4
|
import { ScrollerListProps } from '../components/ScrollerList';
|
|
@@ -34,7 +34,7 @@ export declare type ScrollerListExItemSize = ((index: number) => [number, number
|
|
|
34
34
|
/**
|
|
35
35
|
* Extended ScrollerList Props
|
|
36
36
|
*/
|
|
37
|
-
export declare type ScrollerListExProps<T extends object, D extends DataTypes.Keys<T
|
|
37
|
+
export declare type ScrollerListExProps<T extends object, D extends DataTypes.Keys<T>> = Omit<ScrollerListProps<T>, 'itemRenderer' | 'itemSize'> & {
|
|
38
38
|
/**
|
|
39
39
|
* Alternating colors for odd/even rows
|
|
40
40
|
*/
|
|
@@ -78,4 +78,4 @@ export declare type ScrollerListExProps<T extends object, D extends DataTypes.Ke
|
|
|
78
78
|
* @param props Props
|
|
79
79
|
* @returns Component
|
|
80
80
|
*/
|
|
81
|
-
export declare function ScrollerListEx<T extends object, D extends DataTypes.Keys<T> =
|
|
81
|
+
export declare function ScrollerListEx<T extends object, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ScrollerListExProps<T, D>): JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from '@etsoo/shared';
|
|
3
3
|
import { OptionGroupProps } from './OptionGroup';
|
|
4
4
|
/**
|
|
5
5
|
* Search OptionGroup
|
|
6
6
|
* @param props Props
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
|
-
export declare function SearchOptionGroup<T extends object =
|
|
9
|
+
export declare function SearchOptionGroup<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>>(props: OptionGroupProps<T, D, L>): JSX.Element;
|
package/lib/mu/SelectBool.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { ListType1 } from '@etsoo/shared';
|
|
3
3
|
import { SelectExProps } from './SelectEx';
|
|
4
4
|
/**
|
|
5
5
|
* SelectBool props
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
}
|
|
7
|
+
export declare type SelectBoolProps = Omit<SelectExProps<ListType1>, 'options' | 'loadData'>;
|
|
9
8
|
/**
|
|
10
9
|
* SelectBool (yes/no)
|
|
11
10
|
* @param props Props
|
package/lib/mu/SelectBool.js
CHANGED
|
@@ -18,5 +18,5 @@ export function SelectBool(props) {
|
|
|
18
18
|
if (autoAddBlankItem)
|
|
19
19
|
Utils.addBlankItem(options);
|
|
20
20
|
// Layout
|
|
21
|
-
return
|
|
21
|
+
return React.createElement(SelectEx, { options: options, search: search, ...rest });
|
|
22
22
|
}
|
package/lib/mu/SelectEx.d.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { SelectProps } from '@mui/material';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { DataTypes } from '@etsoo/shared';
|
|
3
|
+
import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from '@etsoo/shared';
|
|
4
4
|
/**
|
|
5
5
|
* Extended select component props
|
|
6
6
|
*/
|
|
7
|
-
export declare type SelectExProps<T extends object, D extends DataTypes.Keys<T> = DataTypes.Keys<T>> = Omit<SelectProps, 'labelId' | 'input' | 'native'> & {
|
|
7
|
+
export declare type SelectExProps<T extends object, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>> = Omit<SelectProps, 'labelId' | 'input' | 'native'> & {
|
|
8
8
|
/**
|
|
9
9
|
* Auto add blank item
|
|
10
10
|
*/
|
|
11
11
|
autoAddBlankItem?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Id field
|
|
14
|
+
*/
|
|
15
|
+
idField?: D;
|
|
12
16
|
/**
|
|
13
17
|
* Item icon renderer
|
|
14
18
|
*/
|
|
15
19
|
itemIconRenderer?: (id: unknown) => React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Label field
|
|
22
|
+
*/
|
|
23
|
+
labelField?: L | ((option: T) => string);
|
|
16
24
|
/**
|
|
17
25
|
* Load data callback
|
|
18
26
|
*/
|
|
@@ -33,22 +41,10 @@ export declare type SelectExProps<T extends object, D extends DataTypes.Keys<T>
|
|
|
33
41
|
* Is search case?
|
|
34
42
|
*/
|
|
35
43
|
search?: boolean;
|
|
36
|
-
}
|
|
37
|
-
id: DataTypes.IdType;
|
|
38
|
-
} ? {
|
|
39
|
-
idField?: D;
|
|
40
|
-
} : {
|
|
41
|
-
idField: D;
|
|
42
|
-
}) & (T extends {
|
|
43
|
-
label: string;
|
|
44
|
-
} ? {
|
|
45
|
-
labelField?: ((option: T) => string) | D;
|
|
46
|
-
} : {
|
|
47
|
-
labelField: ((option: T) => string) | D;
|
|
48
|
-
});
|
|
44
|
+
};
|
|
49
45
|
/**
|
|
50
46
|
* Extended select component
|
|
51
47
|
* @param props Props
|
|
52
48
|
* @returns Component
|
|
53
49
|
*/
|
|
54
|
-
export declare function SelectEx<T extends object =
|
|
50
|
+
export declare function SelectEx<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>>(props: SelectExProps<T, D, L>): JSX.Element;
|
package/lib/mu/TableEx.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import { TableProps } from '@mui/material';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { GridColumn } from '../components/GridColumn';
|
|
@@ -20,7 +20,7 @@ export interface TableExMethodRef extends GridMethodRef {
|
|
|
20
20
|
/**
|
|
21
21
|
* Extended table props
|
|
22
22
|
*/
|
|
23
|
-
export declare type TableExProps<T extends object, D extends DataTypes.Keys<T
|
|
23
|
+
export declare type TableExProps<T extends object, D extends DataTypes.Keys<T>> = TableProps & GridLoader<T> & {
|
|
24
24
|
/**
|
|
25
25
|
* Alternating colors for odd/even rows
|
|
26
26
|
*/
|
|
@@ -33,6 +33,10 @@ export declare type TableExProps<T extends object, D extends DataTypes.Keys<T> =
|
|
|
33
33
|
* Header cells background color and font color
|
|
34
34
|
*/
|
|
35
35
|
headerColors?: [string?, string?];
|
|
36
|
+
/**
|
|
37
|
+
* Id field
|
|
38
|
+
*/
|
|
39
|
+
idField?: D;
|
|
36
40
|
/**
|
|
37
41
|
* Max height
|
|
38
42
|
*/
|
|
@@ -53,16 +57,10 @@ export declare type TableExProps<T extends object, D extends DataTypes.Keys<T> =
|
|
|
53
57
|
* Header and bottom height
|
|
54
58
|
*/
|
|
55
59
|
otherHeight?: number;
|
|
56
|
-
}
|
|
57
|
-
id: DataTypes.IdType;
|
|
58
|
-
} ? {
|
|
59
|
-
idField?: D;
|
|
60
|
-
} : {
|
|
61
|
-
idField: D;
|
|
62
|
-
});
|
|
60
|
+
};
|
|
63
61
|
/**
|
|
64
62
|
* Extended Table
|
|
65
63
|
* @param props Props
|
|
66
64
|
* @returns Component
|
|
67
65
|
*/
|
|
68
|
-
export declare function TableEx<T extends object, D extends DataTypes.Keys<T> =
|
|
66
|
+
export declare function TableEx<T extends object, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: TableExProps<T, D>): JSX.Element;
|
package/lib/mu/Tiplist.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType, ListType } from '@etsoo/shared';
|
|
3
3
|
import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
|
|
4
4
|
/**
|
|
5
5
|
* Tiplist props
|
|
@@ -15,4 +15,4 @@ export declare type TiplistProps<T extends object, D extends DataTypes.Keys<T>>
|
|
|
15
15
|
* @param props Props
|
|
16
16
|
* @returns Component
|
|
17
17
|
*/
|
|
18
|
-
export declare function Tiplist<T extends object =
|
|
18
|
+
export declare function Tiplist<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: TiplistProps<T, D>): JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
3
3
|
import { DataGridPageProps } from './DataGridPageProps';
|
|
4
4
|
/**
|
|
5
5
|
* DataGrid page
|
|
6
6
|
* @param props Props
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
|
-
export declare function DataGridPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> =
|
|
9
|
+
export declare function DataGridPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: DataGridPageProps<T, F, D>): JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import { DataGridExProps } from '../DataGridEx';
|
|
3
3
|
import { SearchPageProps } from './SearchPageProps';
|
|
4
4
|
/**
|
|
5
5
|
* DataGrid page props
|
|
6
6
|
*/
|
|
7
|
-
export declare type DataGridPageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> =
|
|
7
|
+
export declare type DataGridPageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = SearchPageProps<T, F> & Omit<DataGridExProps<T, D>, 'loadData' | 'height'> & {
|
|
8
8
|
/**
|
|
9
9
|
* Height will be deducted
|
|
10
10
|
* @param height Current calcuated height
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
3
3
|
import { ListPageProps } from './ListPageProps';
|
|
4
4
|
/**
|
|
5
5
|
* Fixed height list page
|
|
6
6
|
* @param props Props
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
|
-
export declare function FixedListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: ListPageProps<T, F> & {
|
|
9
|
+
export declare function FixedListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ListPageProps<T, F, D> & {
|
|
10
10
|
/**
|
|
11
11
|
* Height will be deducted
|
|
12
12
|
* @param height Current calcuated height
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
3
3
|
import { ListPageProps } from './ListPageProps';
|
|
4
4
|
/**
|
|
5
5
|
* List page
|
|
6
6
|
* @param props Props
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
|
-
export declare function ListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: ListPageProps<T, F>): JSX.Element;
|
|
9
|
+
export declare function ListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ListPageProps<T, F, D>): JSX.Element;
|
|
@@ -4,4 +4,4 @@ import { SearchPageProps } from './SearchPageProps';
|
|
|
4
4
|
/**
|
|
5
5
|
* List page props
|
|
6
6
|
*/
|
|
7
|
-
export declare type ListPageProps<T extends object, F extends DataTypes.BasicTemplate
|
|
7
|
+
export declare type ListPageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T>> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T, D>, 'loadData'>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
3
3
|
import { ResponsePageProps } from './ResponsivePageProps';
|
|
4
4
|
/**
|
|
5
5
|
* Fixed height list page
|
|
6
6
|
* @param props Props
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
|
-
export declare function ResponsivePage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> =
|
|
9
|
+
export declare function ResponsivePage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ResponsePageProps<T, F, D>): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
3
3
|
import { ListChildComponentProps } from 'react-window';
|
|
4
4
|
import { GridMethodRef } from '../GridMethodRef';
|
|
5
5
|
import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from '../ScrollerListEx';
|
|
@@ -7,7 +7,7 @@ import { DataGridPageProps } from './DataGridPageProps';
|
|
|
7
7
|
/**
|
|
8
8
|
* Response page props
|
|
9
9
|
*/
|
|
10
|
-
export declare type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> =
|
|
10
|
+
export declare type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = Omit<DataGridPageProps<T, F, D>, 'mRef' | 'itemKey' | 'onScroll' | 'onItemsRendered'> & {
|
|
11
11
|
/**
|
|
12
12
|
* Min width to show Datagrid
|
|
13
13
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
3
3
|
import { TablePageProps } from './TablePageProps';
|
|
4
4
|
/**
|
|
5
5
|
* Table page
|
|
6
6
|
* @param props Props
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
|
-
export declare function TablePage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: TablePageProps<T, F>): JSX.Element;
|
|
9
|
+
export declare function TablePage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: TablePageProps<T, F, D>): JSX.Element;
|
|
@@ -4,4 +4,4 @@ import { SearchPageProps } from './SearchPageProps';
|
|
|
4
4
|
/**
|
|
5
5
|
* Table page props
|
|
6
6
|
*/
|
|
7
|
-
export declare type TablePageProps<T extends object, F extends DataTypes.BasicTemplate
|
|
7
|
+
export declare type TablePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T>> = SearchPageProps<T, F> & Omit<TableExProps<T, D>, 'loadData'>;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, IdDefaultType } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import {
|
|
4
4
|
Align,
|
|
@@ -30,7 +30,7 @@ export type ScrollerGridItemRendererProps<T> = Omit<
|
|
|
30
30
|
*/
|
|
31
31
|
export type ScrollerGridProps<
|
|
32
32
|
T extends object,
|
|
33
|
-
D extends DataTypes.Keys<T>
|
|
33
|
+
D extends DataTypes.Keys<T>
|
|
34
34
|
> = GridLoader<T> &
|
|
35
35
|
Omit<
|
|
36
36
|
VariableSizeGridProps<T>,
|
|
@@ -149,7 +149,7 @@ export interface ScrollerGridForwardRef extends GridMethodRef {
|
|
|
149
149
|
*/
|
|
150
150
|
export const ScrollerGrid = <
|
|
151
151
|
T extends object,
|
|
152
|
-
D extends DataTypes.Keys<T> =
|
|
152
|
+
D extends DataTypes.Keys<T> = IdDefaultType<T>
|
|
153
153
|
>(
|
|
154
154
|
props: ScrollerGridProps<T, D>
|
|
155
155
|
) => {
|
|
@@ -12,6 +12,11 @@ export type AutocompleteExtendedProps<
|
|
|
12
12
|
AutocompleteProps<T, undefined, false, false>,
|
|
13
13
|
'renderInput' | 'options'
|
|
14
14
|
> & {
|
|
15
|
+
/**
|
|
16
|
+
* Id field
|
|
17
|
+
*/
|
|
18
|
+
idField?: D;
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* Id value
|
|
17
22
|
*/
|
|
@@ -75,10 +80,4 @@ export type AutocompleteExtendedProps<
|
|
|
75
80
|
* Is search field?
|
|
76
81
|
*/
|
|
77
82
|
search?: boolean;
|
|
78
|
-
}
|
|
79
|
-
? {
|
|
80
|
-
idField?: D;
|
|
81
|
-
}
|
|
82
|
-
: {
|
|
83
|
-
idField: D;
|
|
84
|
-
});
|
|
83
|
+
};
|