@etsoo/react 1.5.75 → 1.5.78
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/app/CommonApp.d.ts +2 -2
- package/lib/app/Labels.d.ts +1 -1
- package/lib/app/ServiceApp.d.ts +2 -2
- package/lib/components/GridColumn.d.ts +10 -10
- package/lib/components/GridLoader.d.ts +7 -8
- package/lib/components/ScrollerGrid.d.ts +7 -7
- package/lib/components/ScrollerList.d.ts +2 -2
- package/lib/mu/AutocompleteExtendedProps.d.ts +9 -7
- package/lib/mu/ComboBox.d.ts +10 -8
- package/lib/mu/ComboBox.js +6 -6
- package/lib/mu/DataGridEx.d.ts +6 -5
- package/lib/mu/DataGridRenderers.d.ts +1 -1
- package/lib/mu/DnDList.d.ts +2 -2
- package/lib/mu/ListMoreDisplay.d.ts +2 -2
- package/lib/mu/MUGlobal.d.ts +5 -5
- package/lib/mu/OptionGroup.d.ts +17 -14
- package/lib/mu/ResponsibleContainer.d.ts +5 -5
- package/lib/mu/ScrollerListEx.d.ts +11 -9
- package/lib/mu/ScrollerListEx.js +1 -1
- package/lib/mu/SearchOptionGroup.d.ts +1 -2
- package/lib/mu/SelectBool.d.ts +2 -2
- package/lib/mu/SelectBool.js +1 -1
- package/lib/mu/SelectEx.d.ts +16 -12
- package/lib/mu/SelectEx.js +2 -2
- package/lib/mu/TableEx.d.ts +10 -7
- package/lib/mu/TableEx.js +1 -2
- package/lib/mu/Tiplist.d.ts +4 -5
- package/lib/mu/Tiplist.js +4 -6
- package/lib/mu/pages/CommonPageProps.d.ts +1 -1
- package/lib/mu/pages/DataGridPage.d.ts +1 -1
- package/lib/mu/pages/DataGridPageProps.d.ts +2 -2
- package/lib/mu/pages/FixedListPage.d.ts +1 -1
- package/lib/mu/pages/ListPage.d.ts +1 -1
- package/lib/mu/pages/ListPageProps.d.ts +1 -2
- package/lib/mu/pages/ResponsivePage.d.ts +1 -1
- package/lib/mu/pages/ResponsivePageProps.d.ts +2 -2
- package/lib/mu/pages/SearchPageProps.d.ts +2 -2
- package/lib/mu/pages/TablePage.d.ts +1 -1
- package/lib/mu/pages/TablePageProps.d.ts +1 -2
- package/lib/mu/pages/ViewPage.d.ts +5 -4
- package/lib/states/IState.d.ts +1 -1
- package/lib/uses/useCombinedRefs.d.ts +1 -1
- package/package.json +11 -11
- package/src/app/CommonApp.ts +2 -2
- package/src/app/Labels.ts +1 -1
- package/src/app/ServiceApp.ts +2 -2
- package/src/components/GridColumn.ts +10 -11
- package/src/components/GridLoader.ts +7 -7
- package/src/components/ScrollerGrid.tsx +66 -59
- package/src/components/ScrollerList.tsx +2 -4
- package/src/mu/AutocompleteExtendedProps.ts +15 -12
- package/src/mu/ComboBox.tsx +25 -21
- package/src/mu/DataGridEx.tsx +19 -18
- package/src/mu/DataGridRenderers.tsx +1 -1
- package/src/mu/DnDList.tsx +2 -2
- package/src/mu/ListMoreDisplay.tsx +2 -2
- package/src/mu/MUGlobal.ts +5 -5
- package/src/mu/OptionGroup.tsx +29 -27
- package/src/mu/ResponsibleContainer.tsx +18 -21
- package/src/mu/ScrollerListEx.tsx +24 -20
- package/src/mu/SearchOptionGroup.tsx +2 -3
- package/src/mu/SelectBool.tsx +13 -5
- package/src/mu/SelectEx.tsx +27 -20
- package/src/mu/TableEx.tsx +61 -59
- package/src/mu/Tiplist.tsx +20 -17
- package/src/mu/pages/CommonPageProps.ts +1 -1
- package/src/mu/pages/DataGridPage.tsx +14 -10
- package/src/mu/pages/DataGridPageProps.ts +16 -13
- package/src/mu/pages/FixedListPage.tsx +1 -1
- package/src/mu/pages/ListPage.tsx +1 -1
- package/src/mu/pages/ListPageProps.ts +4 -3
- package/src/mu/pages/ResponsivePage.tsx +5 -4
- package/src/mu/pages/ResponsivePageProps.ts +9 -6
- package/src/mu/pages/SearchPageProps.ts +5 -3
- package/src/mu/pages/TablePage.tsx +1 -1
- package/src/mu/pages/TablePageProps.ts +4 -3
- package/src/mu/pages/ViewPage.tsx +8 -6
- package/src/states/IState.ts +1 -1
- package/src/states/UserState.ts +1 -1
- package/src/uses/useCombinedRefs.ts +3 -3
|
@@ -5,7 +5,7 @@ import { GridDataGet, GridLoadDataProps } from '../../components/GridLoader';
|
|
|
5
5
|
import { ScrollerGridForwardRef } from '../../components/ScrollerGrid';
|
|
6
6
|
import useCombinedRefs from '../../uses/useCombinedRefs';
|
|
7
7
|
import { useDimensions } from '../../uses/useDimensions';
|
|
8
|
-
import { DataGridEx } from '../DataGridEx';
|
|
8
|
+
import { DataGridEx, DataGridExProps } from '../DataGridEx';
|
|
9
9
|
import { MUGlobal } from '../MUGlobal';
|
|
10
10
|
import { SearchBar } from '../SearchBar';
|
|
11
11
|
import { CommonPage } from './CommonPage';
|
|
@@ -24,9 +24,10 @@ interface LocalStates {
|
|
|
24
24
|
* @returns Component
|
|
25
25
|
*/
|
|
26
26
|
export function DataGridPage<
|
|
27
|
-
T,
|
|
28
|
-
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
|
|
29
|
-
>
|
|
27
|
+
T extends object,
|
|
28
|
+
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate,
|
|
29
|
+
D extends DataTypes.Keys<T> = DataTypes.Keys<T>
|
|
30
|
+
>(props: DataGridPageProps<T, F, D>) {
|
|
30
31
|
// Destruct
|
|
31
32
|
const {
|
|
32
33
|
adjustHeight,
|
|
@@ -52,11 +53,14 @@ export function DataGridPage<
|
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
|
|
55
|
-
const refs = useCombinedRefs(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const refs = useCombinedRefs<ScrollerGridForwardRef>(
|
|
57
|
+
mRef,
|
|
58
|
+
(ref: ScrollerGridForwardRef | null) => {
|
|
59
|
+
if (ref == null) return;
|
|
60
|
+
states.ref = ref;
|
|
61
|
+
//setStates({ ref });
|
|
62
|
+
}
|
|
63
|
+
);
|
|
60
64
|
|
|
61
65
|
// On submit callback
|
|
62
66
|
const onSubmit = (data: FormData, _reset: boolean) => {
|
|
@@ -95,7 +99,7 @@ export function DataGridPage<
|
|
|
95
99
|
if (gridHeight == null) return;
|
|
96
100
|
|
|
97
101
|
return (
|
|
98
|
-
<DataGridEx<T>
|
|
102
|
+
<DataGridEx<T, D>
|
|
99
103
|
autoLoad={false}
|
|
100
104
|
height={gridHeight}
|
|
101
105
|
loadData={localLoadData}
|
|
@@ -5,17 +5,20 @@ import { SearchPageProps } from './SearchPageProps';
|
|
|
5
5
|
/**
|
|
6
6
|
* DataGrid page props
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
extends
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
export type DataGridPageProps<
|
|
9
|
+
T extends object,
|
|
10
|
+
F extends DataTypes.BasicTemplate,
|
|
11
|
+
D extends DataTypes.Keys<T> = DataTypes.Keys<T>
|
|
12
|
+
> = SearchPageProps<T, F> &
|
|
13
|
+
Omit<DataGridExProps<T, D>, 'loadData' | 'height'> & {
|
|
14
|
+
/**
|
|
15
|
+
* Height will be deducted
|
|
16
|
+
* @param height Current calcuated height
|
|
17
|
+
*/
|
|
18
|
+
adjustHeight?: (height: number) => number;
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* Grid height
|
|
22
|
+
*/
|
|
23
|
+
height?: number;
|
|
24
|
+
};
|
|
@@ -5,6 +5,7 @@ import { SearchPageProps } from './SearchPageProps';
|
|
|
5
5
|
/**
|
|
6
6
|
* List page props
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
extends
|
|
10
|
-
|
|
8
|
+
export type ListPageProps<
|
|
9
|
+
T extends object,
|
|
10
|
+
F extends DataTypes.BasicTemplate
|
|
11
|
+
> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, 'loadData'>;
|
|
@@ -11,9 +11,10 @@ import { ResponsePageProps } from './ResponsivePageProps';
|
|
|
11
11
|
* @returns Component
|
|
12
12
|
*/
|
|
13
13
|
export function ResponsivePage<
|
|
14
|
-
T extends
|
|
15
|
-
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
|
|
16
|
-
>
|
|
14
|
+
T extends object,
|
|
15
|
+
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate,
|
|
16
|
+
D extends DataTypes.Keys<T> = DataTypes.Keys<T>
|
|
17
|
+
>(props: ResponsePageProps<T, F, D>) {
|
|
17
18
|
// Destruct
|
|
18
19
|
const { pageProps = {}, ...rest } = props;
|
|
19
20
|
|
|
@@ -32,7 +33,7 @@ export function ResponsivePage<
|
|
|
32
33
|
scrollContainer={scrollContainer}
|
|
33
34
|
fabColumnDirection={direction}
|
|
34
35
|
>
|
|
35
|
-
<ResponsibleContainer<T, F>
|
|
36
|
+
<ResponsibleContainer<T, F, D>
|
|
36
37
|
paddings={paddings}
|
|
37
38
|
containerBoxSx={(paddings, hasField, _dataGrid) => {
|
|
38
39
|
// Half
|
|
@@ -10,11 +10,14 @@ import { DataGridPageProps } from './DataGridPageProps';
|
|
|
10
10
|
/**
|
|
11
11
|
* Response page props
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
14
|
-
extends
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export type ResponsePageProps<
|
|
14
|
+
T extends object,
|
|
15
|
+
F extends DataTypes.BasicTemplate,
|
|
16
|
+
D extends DataTypes.Keys<T> = DataTypes.Keys<T>
|
|
17
|
+
> = Omit<
|
|
18
|
+
DataGridPageProps<T, F, D>,
|
|
19
|
+
'mRef' | 'itemKey' | 'onScroll' | 'onItemsRendered'
|
|
20
|
+
> & {
|
|
18
21
|
/**
|
|
19
22
|
* Min width to show Datagrid
|
|
20
23
|
*/
|
|
@@ -51,4 +54,4 @@ export interface ResponsePageProps<T, F extends DataTypes.BasicTemplate>
|
|
|
51
54
|
* Quick action for double click or click under mobile
|
|
52
55
|
*/
|
|
53
56
|
quickAction?: (data: T) => void;
|
|
54
|
-
}
|
|
57
|
+
};
|
|
@@ -5,8 +5,10 @@ import { CommonPageProps } from './CommonPageProps';
|
|
|
5
5
|
/**
|
|
6
6
|
* Search page props
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
8
|
+
export type SearchPageProps<
|
|
9
|
+
T extends object,
|
|
10
|
+
F extends DataTypes.BasicTemplate
|
|
11
|
+
> = Omit<GridLoader<T>, 'loadData'> & {
|
|
10
12
|
/**
|
|
11
13
|
* Search fields
|
|
12
14
|
*/
|
|
@@ -34,4 +36,4 @@ export interface SearchPageProps<T, F extends DataTypes.BasicTemplate>
|
|
|
34
36
|
* @default 100
|
|
35
37
|
*/
|
|
36
38
|
sizeReadyMiliseconds?: number;
|
|
37
|
-
}
|
|
39
|
+
};
|
|
@@ -16,7 +16,7 @@ import { TablePageProps } from './TablePageProps';
|
|
|
16
16
|
* @returns Component
|
|
17
17
|
*/
|
|
18
18
|
export function TablePage<
|
|
19
|
-
T extends
|
|
19
|
+
T extends object,
|
|
20
20
|
F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate
|
|
21
21
|
>(props: TablePageProps<T, F>) {
|
|
22
22
|
// Destruct
|
|
@@ -5,6 +5,7 @@ import { SearchPageProps } from './SearchPageProps';
|
|
|
5
5
|
/**
|
|
6
6
|
* Table page props
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
extends
|
|
10
|
-
|
|
8
|
+
export type TablePageProps<
|
|
9
|
+
T extends object,
|
|
10
|
+
F extends DataTypes.BasicTemplate
|
|
11
|
+
> = SearchPageProps<T, F> & Omit<TableExProps<T>, 'loadData'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Utils } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, Utils } from '@etsoo/shared';
|
|
2
2
|
import {
|
|
3
3
|
Grid,
|
|
4
4
|
GridProps,
|
|
@@ -22,7 +22,7 @@ import { CommonPageProps } from './CommonPageProps';
|
|
|
22
22
|
/**
|
|
23
23
|
* View page display field
|
|
24
24
|
*/
|
|
25
|
-
export interface ViewPageField<T extends
|
|
25
|
+
export interface ViewPageField<T extends object> extends GridProps {
|
|
26
26
|
/**
|
|
27
27
|
* Data field
|
|
28
28
|
*/
|
|
@@ -49,7 +49,7 @@ export interface ViewPageField<T extends {}> extends GridProps {
|
|
|
49
49
|
renderProps?: GridColumnRenderProps;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
type ViewPageFieldType<T> =
|
|
52
|
+
type ViewPageFieldType<T extends object> =
|
|
53
53
|
| (string & keyof T)
|
|
54
54
|
| [string & keyof T, GridDataType, GridColumnRenderProps?]
|
|
55
55
|
| ViewPageField<T>;
|
|
@@ -57,7 +57,7 @@ type ViewPageFieldType<T> =
|
|
|
57
57
|
/**
|
|
58
58
|
* View page props
|
|
59
59
|
*/
|
|
60
|
-
export interface ViewPageProps<T extends
|
|
60
|
+
export interface ViewPageProps<T extends DataTypes.StringRecord>
|
|
61
61
|
extends Omit<CommonPageProps, 'children'> {
|
|
62
62
|
/**
|
|
63
63
|
* Actions
|
|
@@ -101,7 +101,7 @@ function formatItemData(fieldData: unknown): string | undefined {
|
|
|
101
101
|
return `${fieldData}`;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function getItemField<T>(
|
|
104
|
+
function getItemField<T extends object>(
|
|
105
105
|
field: ViewPageFieldType<T>,
|
|
106
106
|
data: T
|
|
107
107
|
): [React.ReactNode, React.ReactNode, GridProps] {
|
|
@@ -163,7 +163,9 @@ function getItemField<T>(
|
|
|
163
163
|
* View page
|
|
164
164
|
* @param props Props
|
|
165
165
|
*/
|
|
166
|
-
export function ViewPage<T extends
|
|
166
|
+
export function ViewPage<T extends DataTypes.StringRecord>(
|
|
167
|
+
props: ViewPageProps<T>
|
|
168
|
+
) {
|
|
167
169
|
// Destruct
|
|
168
170
|
const {
|
|
169
171
|
actions,
|
package/src/states/IState.ts
CHANGED
|
@@ -4,7 +4,7 @@ import React, { ReactNode } from 'react';
|
|
|
4
4
|
/**
|
|
5
5
|
* State UI creator
|
|
6
6
|
*/
|
|
7
|
-
export interface IUICreator<S extends IState, A extends IAction, P =
|
|
7
|
+
export interface IUICreator<S extends IState, A extends IAction, P = object> {
|
|
8
8
|
(state: S, dispatch: React.Dispatch<A>, props: P): React.ReactElement;
|
|
9
9
|
}
|
|
10
10
|
|
package/src/states/UserState.ts
CHANGED
|
@@ -122,7 +122,7 @@ export class UserState<D extends IUser> {
|
|
|
122
122
|
this.provider = provider;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
private getChangedFields(input:
|
|
125
|
+
private getChangedFields(input: object, init: object) {
|
|
126
126
|
return Utils.objectUpdated(input, init, [
|
|
127
127
|
'authorized',
|
|
128
128
|
'seconds',
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @param refs Refs
|
|
4
4
|
* @returns Callback
|
|
5
5
|
*/
|
|
6
|
-
export default function useCombinedRefs(
|
|
7
|
-
...refs: (React.Ref<
|
|
6
|
+
export default function useCombinedRefs<T>(
|
|
7
|
+
...refs: (React.Ref<T> | undefined)[]
|
|
8
8
|
) {
|
|
9
|
-
return (target:
|
|
9
|
+
return (target: T | null) => {
|
|
10
10
|
// Ignore null reference
|
|
11
11
|
if (target == null) return;
|
|
12
12
|
|