@sealcode/sealgen 0.17.25 → 0.17.26
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/@types/src/templates/form.d.ts +4 -1
- package/lib/forms/controls/single-reference.test.js +2 -1
- package/lib/templates/form.js +2 -1
- package/lib/templates/shared/collection-create-form.js +1 -0
- package/lib/templates/shared/collection-edit-form.js +1 -0
- package/package.json +1 -1
- package/src/forms/controls/single-reference.test.ts +1 -0
- package/src/templates/form.ts +2 -1
- package/src/templates/shared/collection-create-form.ts +1 -0
- package/src/templates/shared/collection-edit-form.ts +1 -0
|
@@ -8,6 +8,9 @@ declare const defaults: {
|
|
|
8
8
|
render: string;
|
|
9
9
|
get_initial_values: string;
|
|
10
10
|
other_methods: string;
|
|
11
|
+
success_message: string;
|
|
11
12
|
};
|
|
12
|
-
export declare function formTemplate(action_name: string, newfilefullpath: string, _params?: Partial<typeof defaults>
|
|
13
|
+
export declare function formTemplate(action_name: string, newfilefullpath: string, _params?: Partial<typeof defaults> & {
|
|
14
|
+
success_message: string;
|
|
15
|
+
}): Promise<string>;
|
|
13
16
|
export {};
|
|
@@ -34,7 +34,8 @@ describe("single-reference.test", () => {
|
|
|
34
34
|
postimport: `import {Comments} from "../collections/collections.js"; import {Fields} from "@sealcode/sealgen";`,
|
|
35
35
|
fields: `article: new Fields.CollectionField(true, Comments.fields.article),`,
|
|
36
36
|
controls: `new Controls.SingleReferenceDropdown(fields.article, {getLabel: item=>item.get("title")}),`,
|
|
37
|
-
validate_method: ""
|
|
37
|
+
validate_method: "",
|
|
38
|
+
success_message: "Submit OK"
|
|
38
39
|
})
|
|
39
40
|
);
|
|
40
41
|
await test_app.start();
|
package/lib/templates/form.js
CHANGED
|
@@ -38,7 +38,8 @@ const defaults = {
|
|
|
38
38
|
return html({ctx, title: "Form", description: "", css_clumps: ["admin-forms"], body: await super.render(ctx, data, show_field_errors)});
|
|
39
39
|
}`,
|
|
40
40
|
get_initial_values: "",
|
|
41
|
-
other_methods: ""
|
|
41
|
+
other_methods: "",
|
|
42
|
+
success_message: "Success!"
|
|
42
43
|
};
|
|
43
44
|
async function formTemplate(action_name, newfilefullpath, _params = defaults) {
|
|
44
45
|
const params = { ...defaults, ..._params };
|
|
@@ -15,6 +15,7 @@ async function createItemFormTemplate(create_action_name, newfilefullpath, colle
|
|
|
15
15
|
);
|
|
16
16
|
const post_create_actions = field_handler_results.map(({ post_create }) => post_create).filter((e) => e != "");
|
|
17
17
|
return formTemplate(create_action_name, newfilefullpath, {
|
|
18
|
+
success_message: "Created!",
|
|
18
19
|
postimport: `import {${toPascalCase(
|
|
19
20
|
collection_name
|
|
20
21
|
)}FormFields, ${toPascalCase(
|
|
@@ -14,6 +14,7 @@ async function editItemFormTemplate(edit_action_name, newfilefullpath, collectio
|
|
|
14
14
|
})
|
|
15
15
|
);
|
|
16
16
|
return formTemplate(edit_action_name, newfilefullpath, {
|
|
17
|
+
success_message: "Changes saved!",
|
|
17
18
|
postimport: `import {${toPascalCase(
|
|
18
19
|
collection_name
|
|
19
20
|
)}FormFields, ${toPascalCase(
|
package/package.json
CHANGED
|
@@ -44,6 +44,7 @@ describe("single-reference.test", () => {
|
|
|
44
44
|
fields: `article: new Fields.CollectionField(true, Comments.fields.article),`,
|
|
45
45
|
controls: `new Controls.SingleReferenceDropdown(fields.article, {getLabel: item=>item.get("title")}),`,
|
|
46
46
|
validate_method: "",
|
|
47
|
+
success_message: "Submit OK",
|
|
47
48
|
})
|
|
48
49
|
);
|
|
49
50
|
|
package/src/templates/form.ts
CHANGED
|
@@ -40,12 +40,13 @@ const defaults = {
|
|
|
40
40
|
}`,
|
|
41
41
|
get_initial_values: "",
|
|
42
42
|
other_methods: "",
|
|
43
|
+
success_message: "Success!",
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
export async function formTemplate(
|
|
46
47
|
action_name: string,
|
|
47
48
|
newfilefullpath: string,
|
|
48
|
-
_params: Partial<typeof defaults> = defaults
|
|
49
|
+
_params: Partial<typeof defaults> & { success_message: string } = defaults
|
|
49
50
|
): Promise<string> {
|
|
50
51
|
const params = { ...defaults, ..._params };
|
|
51
52
|
const rel = curryImportPath(newfilefullpath);
|
|
@@ -28,6 +28,7 @@ export async function createItemFormTemplate(
|
|
|
28
28
|
.filter((e) => e != "");
|
|
29
29
|
|
|
30
30
|
return formTemplate(create_action_name, newfilefullpath, {
|
|
31
|
+
success_message: "Created!",
|
|
31
32
|
postimport: `import {${toPascalCase(
|
|
32
33
|
collection_name
|
|
33
34
|
)}FormFields, ${toPascalCase(
|