@etsoo/react 1.2.35 → 1.2.36

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.
@@ -18,7 +18,7 @@ export declare type GridData = FormData | DataTypes.StringRecord;
18
18
  * @param data Data
19
19
  * @returns Json data
20
20
  */
21
- export declare function GridDataGet<F extends {}>(props: GridLoadDataProps, template?: F): GridJsonData & Partial<F>;
21
+ export declare function GridDataGet<F extends DataTypes.BasicTemplate>(props: GridLoadDataProps, template?: F): GridJsonData & DataTypes.BasicTemplateType<F>;
22
22
  /**
23
23
  * Grid Json data
24
24
  */
@@ -25,7 +25,8 @@ export function GridDataGet(props, template) {
25
25
  // Clear empty value
26
26
  DomUtils.clearFormData(data);
27
27
  }
28
- conditions = DomUtils.dataAs(data, template);
28
+ // Set keepSource to true to hold form data, even they are invisible from the conditions
29
+ conditions = DomUtils.dataAs(data, template, true);
29
30
  }
30
31
  // DomUtils.dataAs(data, template);
31
32
  return { ...conditions, ...rest };
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { DataTypes } from '@etsoo/shared';
2
3
  import { DataGridPageProps } from './DataGridPageProps';
3
4
  /**
4
5
  * DataGrid page
5
6
  * @param props Props
6
7
  * @returns Component
7
8
  */
8
- export declare function DataGridPage<T, F extends {}>(props: DataGridPageProps<T, F>): JSX.Element;
9
+ export declare function DataGridPage<T, F extends DataTypes.BasicTemplate>(props: DataGridPageProps<T, F>): JSX.Element;
@@ -1,9 +1,10 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { DataGridExProps } from '../DataGridEx';
2
3
  import { SearchPageProps } from './SearchPageProps';
3
4
  /**
4
5
  * DataGrid page props
5
6
  */
6
- export interface DataGridPageProps<T, F extends {}> extends SearchPageProps<T, F>, Omit<DataGridExProps<T>, 'loadData' | 'height'> {
7
+ export interface DataGridPageProps<T, F extends DataTypes.BasicTemplate> extends SearchPageProps<T, F>, Omit<DataGridExProps<T>, 'loadData' | 'height'> {
7
8
  /**
8
9
  * Height will be deducted
9
10
  * @param height Current calcuated height
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
+ import { DataTypes } from '@etsoo/shared';
2
3
  import { ListPageProps } from './ListPageProps';
3
4
  /**
4
5
  * Fixed height list page
5
6
  * @param props Props
6
7
  * @returns Component
7
8
  */
8
- export declare function FixedListPage<T, F extends {}>(props: ListPageProps<T, F> & {
9
+ export declare function FixedListPage<T, F extends DataTypes.BasicTemplate>(props: ListPageProps<T, F> & {
9
10
  /**
10
11
  * Height will be deducted
11
12
  * @param height Current calcuated height
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { DataTypes } from '@etsoo/shared';
2
3
  import { ListPageProps } from './ListPageProps';
3
4
  /**
4
5
  * List page
5
6
  * @param props Props
6
7
  * @returns Component
7
8
  */
8
- export declare function ListPage<T, F extends {}>(props: ListPageProps<T, F>): JSX.Element;
9
+ export declare function ListPage<T, F extends DataTypes.BasicTemplate>(props: ListPageProps<T, F>): JSX.Element;
@@ -1,7 +1,8 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { ScrollerListExProps } from '../ScrollerListEx';
2
3
  import { SearchPageProps } from './SearchPageProps';
3
4
  /**
4
5
  * List page props
5
6
  */
6
- export interface ListPageProps<T, F extends {}> extends SearchPageProps<T, F>, Omit<ScrollerListExProps<T>, 'loadData'> {
7
+ export interface ListPageProps<T, F extends DataTypes.BasicTemplate> extends SearchPageProps<T, F>, Omit<ScrollerListExProps<T>, 'loadData'> {
7
8
  }
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { DataTypes } from '@etsoo/shared';
2
3
  import { ResponsePageProps } from './ResponsivePageProps';
3
4
  /**
4
5
  * Fixed height list page
5
6
  * @param props Props
6
7
  * @returns Component
7
8
  */
8
- export declare function ResponsivePage<T, F extends {}>(props: ResponsePageProps<T, F>): JSX.Element;
9
+ export declare function ResponsivePage<T, F extends DataTypes.BasicTemplate>(props: ResponsePageProps<T, F>): JSX.Element;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { DataTypes } from '@etsoo/shared';
2
3
  import { ListChildComponentProps } from 'react-window';
3
4
  import { GridMethodRef } from '../GridMethodRef';
4
5
  import { ScrollerListExInnerItemRendererProps } from '../ScrollerListEx';
@@ -6,7 +7,7 @@ import { DataGridPageProps } from './DataGridPageProps';
6
7
  /**
7
8
  * Response page props
8
9
  */
9
- export interface ResponsePageProps<T, F extends {}> extends Omit<DataGridPageProps<T, F>, 'mRef' | 'itemKey' | 'onScroll' | 'onItemsRendered'> {
10
+ export interface ResponsePageProps<T, F extends DataTypes.BasicTemplate> extends Omit<DataGridPageProps<T, F>, 'mRef' | 'itemKey' | 'onScroll' | 'onItemsRendered'> {
10
11
  /**
11
12
  * Min width to show Datagrid
12
13
  */
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import { DataTypes } from '@etsoo/shared';
2
3
  import { GridJsonData, GridLoader } from '../../components/GridLoader';
3
4
  import { CommonPageProps } from './CommonPageProps';
4
5
  /**
5
6
  * Search page props
6
7
  */
7
- export interface SearchPageProps<T, F extends {}> extends Omit<GridLoader<T>, 'loadData'> {
8
+ export interface SearchPageProps<T, F extends DataTypes.BasicTemplate> extends Omit<GridLoader<T>, 'loadData'> {
8
9
  /**
9
10
  * Search fields
10
11
  */
@@ -16,7 +17,7 @@ export interface SearchPageProps<T, F extends {}> extends Omit<GridLoader<T>, 'l
16
17
  /**
17
18
  * Load data callback
18
19
  */
19
- loadData: (data: GridJsonData & Partial<F>) => PromiseLike<T[] | null | undefined>;
20
+ loadData: (data: GridJsonData & DataTypes.BasicTemplateType<F>) => PromiseLike<T[] | null | undefined>;
20
21
  /**
21
22
  * Page props
22
23
  */
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { DataTypes } from '@etsoo/shared';
2
3
  import { TablePageProps } from './TablePageProps';
3
4
  /**
4
5
  * Table page
5
6
  * @param props Props
6
7
  * @returns Component
7
8
  */
8
- export declare function TablePage<T, F extends {}>(props: TablePageProps<T, F>): JSX.Element;
9
+ export declare function TablePage<T, F extends DataTypes.BasicTemplate>(props: TablePageProps<T, F>): JSX.Element;
@@ -1,7 +1,8 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { TableExProps } from '../TableEx';
2
3
  import { SearchPageProps } from './SearchPageProps';
3
4
  /**
4
5
  * Table page props
5
6
  */
6
- export interface TablePageProps<T, F extends {}> extends SearchPageProps<T, F>, Omit<TableExProps<T>, 'loadData'> {
7
+ export interface TablePageProps<T, F extends DataTypes.BasicTemplate> extends SearchPageProps<T, F>, Omit<TableExProps<T>, 'loadData'> {
7
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.2.35",
3
+ "version": "1.2.36",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,9 +44,9 @@
44
44
  "@emotion/react": "^11.4.1",
45
45
  "@emotion/style": "^0.8.0",
46
46
  "@emotion/styled": "^11.3.0",
47
- "@etsoo/appscript": "^1.1.8",
48
- "@etsoo/notificationbase": "^1.0.83",
49
- "@etsoo/shared": "^1.0.50",
47
+ "@etsoo/appscript": "^1.1.9",
48
+ "@etsoo/notificationbase": "^1.0.84",
49
+ "@etsoo/shared": "^1.0.51",
50
50
  "@mui/icons-material": "^5.0.4",
51
51
  "@mui/material": "^5.0.4",
52
52
  "@reach/router": "^1.3.4",
@@ -25,15 +25,15 @@ export type GridData = FormData | DataTypes.StringRecord;
25
25
  * @param data Data
26
26
  * @returns Json data
27
27
  */
28
- export function GridDataGet<F extends {}>(
28
+ export function GridDataGet<F extends DataTypes.BasicTemplate>(
29
29
  props: GridLoadDataProps,
30
30
  template?: F
31
- ): GridJsonData & Partial<F> {
31
+ ): GridJsonData & DataTypes.BasicTemplateType<F> {
32
32
  // Destruct
33
33
  const { data, ...rest } = props;
34
34
 
35
35
  // Conditions
36
- let conditions: Partial<F> = {};
36
+ let conditions: DataTypes.BasicTemplateType<F> = {};
37
37
 
38
38
  // Cast data
39
39
  if (data != null && template != null) {
@@ -41,7 +41,9 @@ export function GridDataGet<F extends {}>(
41
41
  // Clear empty value
42
42
  DomUtils.clearFormData(data);
43
43
  }
44
- conditions = DomUtils.dataAs(data, template);
44
+
45
+ // Set keepSource to true to hold form data, even they are invisible from the conditions
46
+ conditions = DomUtils.dataAs(data, template, true);
45
47
  }
46
48
 
47
49
  // DomUtils.dataAs(data, template);
@@ -1,3 +1,4 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { Box, Stack } from '@mui/material';
2
3
  import React from 'react';
3
4
  import { GridDataGet, GridLoadDataProps } from '../../components/GridLoader';
@@ -22,7 +23,9 @@ interface LocalStates {
22
23
  * @param props Props
23
24
  * @returns Component
24
25
  */
25
- export function DataGridPage<T, F extends {}>(props: DataGridPageProps<T, F>) {
26
+ export function DataGridPage<T, F extends DataTypes.BasicTemplate>(
27
+ props: DataGridPageProps<T, F>
28
+ ) {
26
29
  // Destruct
27
30
  const {
28
31
  adjustHeight,
@@ -1,10 +1,11 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { DataGridExProps } from '../DataGridEx';
2
3
  import { SearchPageProps } from './SearchPageProps';
3
4
 
4
5
  /**
5
6
  * DataGrid page props
6
7
  */
7
- export interface DataGridPageProps<T, F extends {}>
8
+ export interface DataGridPageProps<T, F extends DataTypes.BasicTemplate>
8
9
  extends SearchPageProps<T, F>,
9
10
  Omit<DataGridExProps<T>, 'loadData' | 'height'> {
10
11
  /**
@@ -1,3 +1,4 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { Box, Stack } from '@mui/material';
2
3
  import React from 'react';
3
4
  import { GridDataGet, GridLoadDataProps } from '../../components/GridLoader';
@@ -15,7 +16,7 @@ import { ListPageProps } from './ListPageProps';
15
16
  * @param props Props
16
17
  * @returns Component
17
18
  */
18
- export function FixedListPage<T, F extends {}>(
19
+ export function FixedListPage<T, F extends DataTypes.BasicTemplate>(
19
20
  props: ListPageProps<T, F> & {
20
21
  /**
21
22
  * Height will be deducted
@@ -1,3 +1,4 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { Box, Stack } from '@mui/material';
2
3
  import React from 'react';
3
4
  import { GridDataGet, GridLoadDataProps } from '../../components/GridLoader';
@@ -18,7 +19,9 @@ import { ListPageProps } from './ListPageProps';
18
19
  * @param props Props
19
20
  * @returns Component
20
21
  */
21
- export function ListPage<T, F extends {}>(props: ListPageProps<T, F>) {
22
+ export function ListPage<T, F extends DataTypes.BasicTemplate>(
23
+ props: ListPageProps<T, F>
24
+ ) {
22
25
  // Destruct
23
26
  const {
24
27
  fields,
@@ -1,9 +1,10 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { ScrollerListExProps } from '../ScrollerListEx';
2
3
  import { SearchPageProps } from './SearchPageProps';
3
4
 
4
5
  /**
5
6
  * List page props
6
7
  */
7
- export interface ListPageProps<T, F extends {}>
8
+ export interface ListPageProps<T, F extends DataTypes.BasicTemplate>
8
9
  extends SearchPageProps<T, F>,
9
10
  Omit<ScrollerListExProps<T>, 'loadData'> {}
@@ -1,3 +1,4 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { Box, Stack } from '@mui/material';
2
3
  import React from 'react';
3
4
  import { GridDataGet, GridLoadDataProps } from '../../components/GridLoader';
@@ -23,7 +24,7 @@ interface LocalStates {
23
24
  * @param props Props
24
25
  * @returns Component
25
26
  */
26
- export function ResponsivePage<T, F extends {}>(
27
+ export function ResponsivePage<T, F extends DataTypes.BasicTemplate>(
27
28
  props: ResponsePageProps<T, F>
28
29
  ) {
29
30
  // Destruct
@@ -1,3 +1,4 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { ListChildComponentProps } from 'react-window';
2
3
  import { GridMethodRef } from '../GridMethodRef';
3
4
  import { ScrollerListExInnerItemRendererProps } from '../ScrollerListEx';
@@ -6,7 +7,7 @@ import { DataGridPageProps } from './DataGridPageProps';
6
7
  /**
7
8
  * Response page props
8
9
  */
9
- export interface ResponsePageProps<T, F extends {}>
10
+ export interface ResponsePageProps<T, F extends DataTypes.BasicTemplate>
10
11
  extends Omit<
11
12
  DataGridPageProps<T, F>,
12
13
  'mRef' | 'itemKey' | 'onScroll' | 'onItemsRendered'
@@ -1,10 +1,11 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { GridJsonData, GridLoader } from '../../components/GridLoader';
2
3
  import { CommonPageProps } from './CommonPageProps';
3
4
 
4
5
  /**
5
6
  * Search page props
6
7
  */
7
- export interface SearchPageProps<T, F extends {}>
8
+ export interface SearchPageProps<T, F extends DataTypes.BasicTemplate>
8
9
  extends Omit<GridLoader<T>, 'loadData'> {
9
10
  /**
10
11
  * Search fields
@@ -20,7 +21,7 @@ export interface SearchPageProps<T, F extends {}>
20
21
  * Load data callback
21
22
  */
22
23
  loadData: (
23
- data: GridJsonData & Partial<F>
24
+ data: GridJsonData & DataTypes.BasicTemplateType<F>
24
25
  ) => PromiseLike<T[] | null | undefined>;
25
26
 
26
27
  /**
@@ -1,3 +1,4 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { Box, Stack } from '@mui/material';
2
3
  import React from 'react';
3
4
  import { GridDataGet, GridLoadDataProps } from '../../components/GridLoader';
@@ -18,7 +19,9 @@ import { TablePageProps } from './TablePageProps';
18
19
  * @param props Props
19
20
  * @returns Component
20
21
  */
21
- export function TablePage<T, F extends {}>(props: TablePageProps<T, F>) {
22
+ export function TablePage<T, F extends DataTypes.BasicTemplate>(
23
+ props: TablePageProps<T, F>
24
+ ) {
22
25
  // Destruct
23
26
  const {
24
27
  columns,
@@ -1,9 +1,10 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import { TableExProps } from '../TableEx';
2
3
  import { SearchPageProps } from './SearchPageProps';
3
4
 
4
5
  /**
5
6
  * Table page props
6
7
  */
7
- export interface TablePageProps<T, F extends {}>
8
+ export interface TablePageProps<T, F extends DataTypes.BasicTemplate>
8
9
  extends SearchPageProps<T, F>,
9
10
  Omit<TableExProps<T>, 'loadData'> {}