zova-cli-set-front 1.2.43 → 1.2.45
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/cli/templates/create/module/boilerplate/_package.json +1 -1
- package/cli/templates/rest/component.ts +70 -40
- package/cli/templates/rest/inner.ts +4 -0
- package/cli/templates/rest/render.ts +12 -8
- package/dist/index.js +0 -23
- package/dist/lib/bean/toolsMetadata/utils.d.ts +0 -1
- package/package.json +3 -3
- /package/cli/templates/create/component/{boilerplateActionRow → boilerplateFormActionRow}/controller.tsx_ +0 -0
- /package/cli/templates/create/component/{boilerplateActionBulk → boilerplateTableActionBulk}/controller.tsx_ +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"description": "<%=argv.description%>",
|
|
15
15
|
"keywords": ["Zova Module"],
|
|
16
16
|
"author": "<%=argv.author%>",
|
|
17
|
-
"files": ["mock", "dist", "src", "icons", "assets"
|
|
17
|
+
"files": ["mock", "dist", "src", "icons", "assets"],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
20
20
|
"tsc:publish": "npm run clean && zova :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
@@ -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/dist/index.js
CHANGED
|
@@ -2966,20 +2966,9 @@ ${contentResourceIcons}
|
|
|
2966
2966
|
}
|
|
2967
2967
|
/** icons: end */
|
|
2968
2968
|
`;
|
|
2969
|
-
// restComponent
|
|
2970
|
-
await generateRestIcon(moduleName, modulePath);
|
|
2971
2969
|
// ok
|
|
2972
2970
|
return content;
|
|
2973
2971
|
}
|
|
2974
|
-
async function generateRestIcon(moduleName, modulePath, _resourceIcons) {
|
|
2975
|
-
// icons
|
|
2976
|
-
const contentResourceIcons = `export * from 'zova-module-${moduleName}';\n`;
|
|
2977
|
-
const fileIcons = path.join(modulePath, 'rest/icons.ts');
|
|
2978
|
-
await fse.outputFile(fileIcons, contentResourceIcons);
|
|
2979
|
-
// index
|
|
2980
|
-
const exportIndexContent = "export * from './icons.js';";
|
|
2981
|
-
await generateRestIndex(modulePath, exportIndexContent);
|
|
2982
|
-
}
|
|
2983
2972
|
async function _generateFileConfigIcons(groups) {
|
|
2984
2973
|
const groupsFrontImport = [];
|
|
2985
2974
|
const groupsFrontExport = [];
|
|
@@ -3062,18 +3051,6 @@ function _getRecordId(moduleName, groupName, iconName) {
|
|
|
3062
3051
|
if (groupName === 'default') groupName = '';
|
|
3063
3052
|
return `${moduleName}:${groupName}:${iconName}`;
|
|
3064
3053
|
}
|
|
3065
|
-
async function generateRestIndex(modulePath, append) {
|
|
3066
|
-
// index
|
|
3067
|
-
const fileIndex = path.join(modulePath, 'rest/index.ts');
|
|
3068
|
-
let contentIndex = '';
|
|
3069
|
-
if (fse.existsSync(fileIndex)) {
|
|
3070
|
-
contentIndex = (await fse.readFile(fileIndex)).toString();
|
|
3071
|
-
}
|
|
3072
|
-
if (!contentIndex.includes(append)) {
|
|
3073
|
-
contentIndex = `${contentIndex}${append}\n`;
|
|
3074
|
-
await fse.outputFile(fileIndex, contentIndex);
|
|
3075
|
-
}
|
|
3076
|
-
}
|
|
3077
3054
|
|
|
3078
3055
|
// import SVGCompiler from 'svg-baker';
|
|
3079
3056
|
// const svgSymbol = await new SVGCompiler().addSymbol({
|
|
@@ -10,4 +10,3 @@ export declare function extractBeanInfo(sceneName: string, fileContent: string,
|
|
|
10
10
|
};
|
|
11
11
|
export declare function beanFullNameFromOnionName(onionName: string, sceneName: string): string;
|
|
12
12
|
export declare function onionNameFromBeanFullName(beanFullName: string, sceneName: string): string;
|
|
13
|
-
export declare function generateRestIndex(modulePath: string, append: string): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli-set-front",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.2.45",
|
|
4
|
+
"gitHead": "343c61ad189fe3f0fc997ee9f4c710567657e05c",
|
|
5
5
|
"description": "zova cli-set-front",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"framework",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@cabloy/extend": "^3.1.0",
|
|
41
41
|
"@cabloy/module-info": "^2.0.0",
|
|
42
42
|
"@cabloy/openapi-typescript": "^7.9.2",
|
|
43
|
-
"@cabloy/utils": "^2.1.
|
|
43
|
+
"@cabloy/utils": "^2.1.16",
|
|
44
44
|
"@cabloy/vite-plugin-babel": "^1.3.3",
|
|
45
45
|
"@cabloy/vue-babel-plugin-jsx": "^2.0.1",
|
|
46
46
|
"@cabloy/word-utils": "^2.1.9",
|
|
File without changes
|
|
File without changes
|