zova-cli-set-front 1.2.43 → 1.2.44
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.
|
@@ -2,27 +2,30 @@ import type z from 'zod';
|
|
|
2
2
|
import type { TypeRenderComponentJsx } from 'zova-jsx';
|
|
3
3
|
import type {
|
|
4
4
|
IResourceFormFieldRecord,
|
|
5
|
+
IResourceTableCellRecord,
|
|
6
|
+
IResourceTableActionRowRecord,
|
|
7
|
+
IResourceFormActionRowRecord,
|
|
8
|
+
IResourceTableActionBulkRecord,
|
|
9
|
+
IResourceBlockRecord,
|
|
5
10
|
TypeFormSchemaScene,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
IResourceRenderTableActionRowOptionsAction,
|
|
12
|
+
IResourceRenderFormActionRowOptionsAction,
|
|
13
|
+
IResourceRenderTableActionBulkOptionsAction,
|
|
14
|
+
IResourceRenderBlockOptionsBlock,
|
|
15
|
+
IResourceTableActionRowOptionsBase,
|
|
16
|
+
IResourceFormActionRowOptionsBase,
|
|
17
|
+
IResourceTableActionBulkOptionsBase,
|
|
13
18
|
} from 'zova-module-a-openapi';
|
|
14
19
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
import { _generalSchemaRest } from './inner.ts';
|
|
20
|
+
import { _generalSchemaRest, _toLowerCaseFirstChar } from './inner.ts';
|
|
18
21
|
|
|
19
22
|
export function schemaRenderField<K extends keyof IResourceFormFieldRecord, T extends z.ZodType>(
|
|
20
|
-
|
|
23
|
+
render: K,
|
|
21
24
|
options?: IResourceFormFieldRecord[K],
|
|
22
25
|
scene?: TypeFormSchemaScene,
|
|
23
26
|
) {
|
|
24
27
|
return function (schema: T): T {
|
|
25
|
-
const options2 = options !== undefined ? { render
|
|
28
|
+
const options2 = options !== undefined ? { render, options } : { render };
|
|
26
29
|
return _generalSchemaRest(schema, options2, scene ?? 'form'); // diff from table
|
|
27
30
|
};
|
|
28
31
|
}
|
|
@@ -34,52 +37,79 @@ export function schemaRenderFieldJsx<T extends z.ZodType>(renderComponentJsx: Ty
|
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
export function schemaRenderCell<K extends keyof
|
|
38
|
-
|
|
39
|
-
options?:
|
|
40
|
+
export function schemaRenderCell<K extends keyof (IResourceTableCellRecord & IResourceTableActionRowRecord), T extends z.ZodType>(
|
|
41
|
+
render: K,
|
|
42
|
+
options?: (IResourceTableCellRecord & IResourceTableActionRowRecord)[K],
|
|
40
43
|
) {
|
|
41
44
|
return function (schema: T): T {
|
|
42
|
-
const options2 = options !== undefined ? { render
|
|
45
|
+
const options2 = options !== undefined ? { render, columnProps: options } : { render };
|
|
43
46
|
return _generalSchemaRest(schema, options2, 'table');
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
export function schemaRenderCellJsx<T extends z.ZodType>(
|
|
50
|
+
export function schemaRenderCellJsx<T extends z.ZodType>(
|
|
51
|
+
renderComponentJsx: TypeRenderComponentJsx,
|
|
52
|
+
options?: Pick<IResourceTableActionRowOptionsBase, 'permission'>,
|
|
53
|
+
) {
|
|
48
54
|
return function (schema: T): T {
|
|
49
|
-
const
|
|
50
|
-
return _generalSchemaRest(schema,
|
|
55
|
+
const options2 = options !== undefined ? { render: renderComponentJsx, columnProps: options } : { render: renderComponentJsx };
|
|
56
|
+
return _generalSchemaRest(schema, options2, 'table');
|
|
51
57
|
};
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
export function
|
|
55
|
-
|
|
56
|
-
options?:
|
|
57
|
-
):
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
+
export function schemaRenderTableActionRow<K extends keyof IResourceTableActionRowRecord>(
|
|
61
|
+
render: K,
|
|
62
|
+
options?: IResourceTableActionRowRecord[K],
|
|
63
|
+
): IResourceRenderTableActionRowOptionsAction {
|
|
64
|
+
const pos = render.toString().indexOf(':action');
|
|
65
|
+
const name = pos > -1 ? _toLowerCaseFirstChar(render.toString().substring(pos + ':action'.length)) : undefined;
|
|
66
|
+
return { $$typeof: 'zova-jsx:actionRow', name, render, options };
|
|
60
67
|
}
|
|
61
68
|
|
|
62
|
-
export function
|
|
63
|
-
|
|
69
|
+
export function schemaRenderTableActionRowJsx(
|
|
70
|
+
renderComponentJsx: TypeRenderComponentJsx,
|
|
71
|
+
options?: Pick<IResourceTableActionRowOptionsBase, 'permission'>,
|
|
72
|
+
) {
|
|
73
|
+
return { render: renderComponentJsx, options };
|
|
64
74
|
}
|
|
65
75
|
|
|
66
|
-
export function
|
|
67
|
-
|
|
68
|
-
options?:
|
|
69
|
-
):
|
|
70
|
-
const
|
|
71
|
-
|
|
76
|
+
export function schemaRenderFormActionRow<K extends keyof IResourceFormActionRowRecord>(
|
|
77
|
+
render: K,
|
|
78
|
+
options?: IResourceFormActionRowRecord[K],
|
|
79
|
+
): IResourceRenderFormActionRowOptionsAction {
|
|
80
|
+
const pos = render.toString().indexOf(':action');
|
|
81
|
+
const name = pos > -1 ? _toLowerCaseFirstChar(render.toString().substring(pos + ':action'.length)) : undefined;
|
|
82
|
+
return { $$typeof: 'zova-jsx:actionRow', name, render, options };
|
|
72
83
|
}
|
|
73
84
|
|
|
74
|
-
export function
|
|
75
|
-
|
|
85
|
+
export function schemaRenderFormActionRowJsx(
|
|
86
|
+
renderComponentJsx: TypeRenderComponentJsx,
|
|
87
|
+
options?: Pick<IResourceFormActionRowOptionsBase, 'permission'>,
|
|
88
|
+
) {
|
|
89
|
+
return { render: renderComponentJsx, options };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function schemaRenderTableActionBulk<K extends keyof IResourceTableActionBulkRecord>(
|
|
93
|
+
render: K,
|
|
94
|
+
options?: IResourceTableActionBulkRecord[K],
|
|
95
|
+
): IResourceRenderTableActionBulkOptionsAction {
|
|
96
|
+
const pos = render.toString().indexOf(':action');
|
|
97
|
+
const name = pos > -1 ? _toLowerCaseFirstChar(render.toString().substring(pos + ':action'.length)) : undefined;
|
|
98
|
+
return { $$typeof: 'zova-jsx:actionBulk', name, render, options };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function schemaRenderTableActionBulkJsx(
|
|
102
|
+
renderComponentJsx: TypeRenderComponentJsx,
|
|
103
|
+
options?: Pick<IResourceTableActionBulkOptionsBase, 'permission'>,
|
|
104
|
+
) {
|
|
105
|
+
return { render: renderComponentJsx, options };
|
|
76
106
|
}
|
|
77
107
|
|
|
78
|
-
export function schemaRenderBlock<K extends keyof
|
|
79
|
-
|
|
80
|
-
options?:
|
|
81
|
-
):
|
|
82
|
-
return { $$typeof: 'zova-jsx:block', render
|
|
108
|
+
export function schemaRenderBlock<K extends keyof IResourceBlockRecord>(
|
|
109
|
+
render: K,
|
|
110
|
+
options?: IResourceBlockRecord[K],
|
|
111
|
+
): IResourceRenderBlockOptionsBlock {
|
|
112
|
+
return { $$typeof: 'zova-jsx:block', render, options };
|
|
83
113
|
}
|
|
84
114
|
|
|
85
115
|
export function schemaRenderBlockJsx(renderComponentJsx: TypeRenderComponentJsx) {
|
|
@@ -20,3 +20,7 @@ export function _order(order: number, level?: TypeSchemaOrderLevel) {
|
|
|
20
20
|
const levelBase = OrderLevelBaseMap[level ?? 'business'];
|
|
21
21
|
return levelBase + order;
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
export function _toLowerCaseFirstChar(str: string) {
|
|
25
|
+
return str.charAt(0).toLowerCase() + str.substring(1);
|
|
26
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
schemaRenderActionBulk,
|
|
3
|
-
schemaRenderActionBulkJsx,
|
|
4
|
-
schemaRenderActionRow,
|
|
5
|
-
schemaRenderActionRowJsx,
|
|
6
2
|
schemaRenderBlock,
|
|
7
3
|
schemaRenderBlockJsx,
|
|
8
4
|
schemaRenderCell,
|
|
9
5
|
schemaRenderCellJsx,
|
|
10
6
|
schemaRenderField,
|
|
11
7
|
schemaRenderFieldJsx,
|
|
8
|
+
schemaRenderFormActionRow,
|
|
9
|
+
schemaRenderFormActionRowJsx,
|
|
10
|
+
schemaRenderTableActionBulk,
|
|
11
|
+
schemaRenderTableActionBulkJsx,
|
|
12
|
+
schemaRenderTableActionRow,
|
|
13
|
+
schemaRenderTableActionRowJsx,
|
|
12
14
|
} from './component.ts';
|
|
13
15
|
import {
|
|
14
16
|
schemaRenderDisableNotifyChanged,
|
|
@@ -32,10 +34,12 @@ export const render = {
|
|
|
32
34
|
fieldJsx: schemaRenderFieldJsx,
|
|
33
35
|
cell: schemaRenderCell,
|
|
34
36
|
cellJsx: schemaRenderCellJsx,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
tableActionRow: schemaRenderTableActionRow,
|
|
38
|
+
tableActionRowJsx: schemaRenderTableActionRowJsx,
|
|
39
|
+
formActionRow: schemaRenderFormActionRow,
|
|
40
|
+
formActionRowJsx: schemaRenderFormActionRowJsx,
|
|
41
|
+
tableActionBulk: schemaRenderTableActionBulk,
|
|
42
|
+
tableActionBulkJsx: schemaRenderTableActionBulkJsx,
|
|
39
43
|
block: schemaRenderBlock,
|
|
40
44
|
blockJsx: schemaRenderBlockJsx,
|
|
41
45
|
};
|
package/package.json
CHANGED