@etsoo/react 1.8.8 → 1.8.10
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.
|
@@ -14,18 +14,28 @@ export declare const GridSizeGet: (size: GridSize, input: number) => number;
|
|
|
14
14
|
* Grid data type
|
|
15
15
|
*/
|
|
16
16
|
export type GridData = FormData | DataTypes.StringRecord;
|
|
17
|
+
/**
|
|
18
|
+
* Grid template type
|
|
19
|
+
*/
|
|
20
|
+
export type GridTemplateType<o extends object> = DataTypes.BasicTemplateType<{
|
|
21
|
+
[k in keyof o]: k extends "date" ? "date" | "string" : k extends DataTypes.BasicNames ? DataTypes.BasicNames : never;
|
|
22
|
+
}>;
|
|
17
23
|
/**
|
|
18
24
|
* Grid data get with format
|
|
19
25
|
* @param data Data
|
|
26
|
+
* @param template Template
|
|
27
|
+
* @param keepSource Keep source data
|
|
20
28
|
* @returns Json data
|
|
21
29
|
*/
|
|
22
|
-
export declare function GridDataGet
|
|
30
|
+
export declare function GridDataGet(props: GridLoadDataProps, template?: object, keepSource?: boolean): GridJsonData & GridTemplateType<typeof template>;
|
|
23
31
|
/**
|
|
24
32
|
* Grid data get with format
|
|
25
33
|
* @param data Data
|
|
34
|
+
* @param template Template
|
|
35
|
+
* @param keepSource Keep source data
|
|
26
36
|
* @returns Json data
|
|
27
37
|
*/
|
|
28
|
-
export declare function GridDataGetData
|
|
38
|
+
export declare function GridDataGetData(data?: GridData, template?: object, keepSource?: boolean): GridTemplateType<typeof template>;
|
|
29
39
|
/**
|
|
30
40
|
* Grid Json data
|
|
31
41
|
*/
|
|
@@ -12,25 +12,32 @@ export const GridSizeGet = (size, input) => {
|
|
|
12
12
|
/**
|
|
13
13
|
* Grid data get with format
|
|
14
14
|
* @param data Data
|
|
15
|
+
* @param template Template
|
|
16
|
+
* @param keepSource Keep source data
|
|
15
17
|
* @returns Json data
|
|
16
18
|
*/
|
|
17
|
-
export function GridDataGet(props, template) {
|
|
19
|
+
export function GridDataGet(props, template = {}, keepSource = true) {
|
|
18
20
|
// Destruct
|
|
19
21
|
const { data, ...rest } = props;
|
|
20
22
|
// DomUtils.dataAs(data, template);
|
|
21
|
-
return { ...GridDataGetData(data, template), ...rest };
|
|
23
|
+
return { ...GridDataGetData(data, template, keepSource), ...rest };
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Grid data get with format
|
|
25
27
|
* @param data Data
|
|
28
|
+
* @param template Template
|
|
29
|
+
* @param keepSource Keep source data
|
|
26
30
|
* @returns Json data
|
|
27
31
|
*/
|
|
28
|
-
export function GridDataGetData(data, template) {
|
|
32
|
+
export function GridDataGetData(data, template = {}, keepSource = true) {
|
|
29
33
|
// Clear form empty value
|
|
30
34
|
if (data instanceof FormData) {
|
|
31
35
|
DomUtils.clearFormData(data);
|
|
32
36
|
}
|
|
33
37
|
// Conditions
|
|
34
|
-
|
|
38
|
+
// Set keepSource to true to hold form data, even they are invisible from the conditions
|
|
39
|
+
const conditions = data == null
|
|
40
|
+
? {}
|
|
41
|
+
: DomUtils.dataAs(data, template, keepSource);
|
|
35
42
|
return conditions;
|
|
36
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.10",
|
|
4
4
|
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/ETSOO/AppReact#readme",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@dnd-kit/core": "^6.
|
|
47
|
-
"@dnd-kit/sortable": "^
|
|
46
|
+
"@dnd-kit/core": "^6.3.0",
|
|
47
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
48
48
|
"@emotion/css": "^11.13.5",
|
|
49
49
|
"@emotion/react": "^11.13.5",
|
|
50
50
|
"@emotion/styled": "^11.13.5",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@testing-library/jest-dom": "^6.6.3",
|
|
66
66
|
"@testing-library/react": "^16.0.1",
|
|
67
67
|
"@types/jest": "^29.5.14",
|
|
68
|
-
"@types/react": "^18.3.
|
|
68
|
+
"@types/react": "^18.3.13",
|
|
69
69
|
"@types/react-dom": "^18.3.1",
|
|
70
70
|
"@types/react-window": "^1.8.8",
|
|
71
71
|
"jest": "^29.7.0",
|
|
@@ -21,39 +21,59 @@ export const GridSizeGet = (size: GridSize, input: number) => {
|
|
|
21
21
|
*/
|
|
22
22
|
export type GridData = FormData | DataTypes.StringRecord;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Grid template type
|
|
26
|
+
*/
|
|
27
|
+
export type GridTemplateType<o extends object> = DataTypes.BasicTemplateType<{
|
|
28
|
+
[k in keyof o]: k extends "date"
|
|
29
|
+
? "date" | "string"
|
|
30
|
+
: k extends DataTypes.BasicNames
|
|
31
|
+
? DataTypes.BasicNames
|
|
32
|
+
: never;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
24
35
|
/**
|
|
25
36
|
* Grid data get with format
|
|
26
37
|
* @param data Data
|
|
38
|
+
* @param template Template
|
|
39
|
+
* @param keepSource Keep source data
|
|
27
40
|
* @returns Json data
|
|
28
41
|
*/
|
|
29
|
-
export function GridDataGet
|
|
42
|
+
export function GridDataGet(
|
|
30
43
|
props: GridLoadDataProps,
|
|
31
|
-
template
|
|
32
|
-
|
|
44
|
+
template: object = {} satisfies DataTypes.BasicTemplate,
|
|
45
|
+
keepSource: boolean = true
|
|
46
|
+
): GridJsonData & GridTemplateType<typeof template> {
|
|
33
47
|
// Destruct
|
|
34
48
|
const { data, ...rest } = props;
|
|
35
49
|
|
|
36
50
|
// DomUtils.dataAs(data, template);
|
|
37
|
-
return { ...GridDataGetData(data, template), ...rest };
|
|
51
|
+
return { ...GridDataGetData(data, template, keepSource), ...rest };
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
/**
|
|
41
55
|
* Grid data get with format
|
|
42
56
|
* @param data Data
|
|
57
|
+
* @param template Template
|
|
58
|
+
* @param keepSource Keep source data
|
|
43
59
|
* @returns Json data
|
|
44
60
|
*/
|
|
45
|
-
export function GridDataGetData
|
|
61
|
+
export function GridDataGetData(
|
|
46
62
|
data?: GridData,
|
|
47
|
-
template
|
|
48
|
-
|
|
63
|
+
template: object = {} satisfies DataTypes.BasicTemplate,
|
|
64
|
+
keepSource: boolean = true
|
|
65
|
+
): GridTemplateType<typeof template> {
|
|
49
66
|
// Clear form empty value
|
|
50
67
|
if (data instanceof FormData) {
|
|
51
68
|
DomUtils.clearFormData(data);
|
|
52
69
|
}
|
|
53
70
|
|
|
54
71
|
// Conditions
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
// Set keepSource to true to hold form data, even they are invisible from the conditions
|
|
73
|
+
const conditions: GridTemplateType<typeof template> =
|
|
74
|
+
data == null
|
|
75
|
+
? {}
|
|
76
|
+
: DomUtils.dataAs(data, template as DataTypes.BasicTemplate, keepSource);
|
|
57
77
|
|
|
58
78
|
return conditions;
|
|
59
79
|
}
|