@sealcode/sealgen 0.15.25 → 0.15.27

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.
@@ -23,7 +23,7 @@ export declare abstract class Form<F extends Fields, SubmitResult> extends Mount
23
23
  onValuesInvalid(ctx: Context, form_messages: FormMessage[], _field_errors: Partial<Record<keyof Fields, string>>): Promise<FormReaction>;
24
24
  onError(ctx: Context, data: FormData, error: unknown): Promise<FormReaction>;
25
25
  abstract onSubmit(ctx: Context, data: FormData): SubmitResult | Promise<SubmitResult>;
26
- onSuccess(ctx: Context, data: FormData, _submitResult: SubmitResult): Promise<FormReaction>;
26
+ onSuccess(ctx: Context, _data: FormData, _submitResult: SubmitResult): Promise<FormReaction>;
27
27
  getRawValuesOnSuccess(ctx: Context): Promise<Record<string, FormDataValue>>;
28
28
  handlePost(ctx: Context): Promise<FormReaction>;
29
29
  mount(router: Router, path: string): void;
@@ -33,6 +33,7 @@ class CheckboxedListInput extends FormFieldControl {
33
33
  tempstream`<label
34
34
  >${this.options.label || this.field.name}</label
35
35
  >
36
+ ${~valid && fctx.validate ? `<div class="input__error">${message}</div>` : ""}
36
37
  <ul>
37
38
  ${isVisible ? options.map(
38
39
  ({ value, label }) => tempstream`<li>
@@ -55,7 +56,6 @@ class CheckboxedListInput extends FormFieldControl {
55
56
  )}
56
57
  </li>`
57
58
  ) : ""}
58
- ${~valid && fctx.validate ? `<div class="input__error">${message}</div>` : ""}
59
59
  </ul>`
60
60
  );
61
61
  }
package/lib/forms/form.js CHANGED
@@ -92,7 +92,7 @@ class Form extends MountableWithFields {
92
92
  )
93
93
  };
94
94
  }
95
- async onSuccess(ctx, data, _submitResult) {
95
+ async onSuccess(ctx, _data, _submitResult) {
96
96
  const messages = [
97
97
  { type: "success", text: this.defaultSuccessMessage }
98
98
  ];
@@ -101,7 +101,7 @@ class Form extends MountableWithFields {
101
101
  content: await this.render(
102
102
  ctx,
103
103
  {
104
- raw_values: data.raw_values,
104
+ raw_values: await this.getInitialValues(ctx),
105
105
  messages
106
106
  },
107
107
  false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.15.25",
3
+ "version": "0.15.27",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -41,6 +41,9 @@ export class CheckboxedListInput extends FormFieldControl {
41
41
  tempstream/* HTML */ `<label
42
42
  >${this.options.label || this.field.name}</label
43
43
  >
44
+ ${~valid && fctx.validate
45
+ ? `<div class="input__error">${message}</div>`
46
+ : ""}
44
47
  <ul>
45
48
  ${isVisible
46
49
  ? options.map(
@@ -66,9 +69,6 @@ export class CheckboxedListInput extends FormFieldControl {
66
69
  </li>`
67
70
  )
68
71
  : ""}
69
- ${~valid && fctx.validate
70
- ? `<div class="input__error">${message}</div>`
71
- : ""}
72
72
  </ul>`
73
73
  );
74
74
  }
package/src/forms/form.ts CHANGED
@@ -150,7 +150,7 @@ export abstract class Form<
150
150
 
151
151
  public async onSuccess(
152
152
  ctx: Context,
153
- data: FormData,
153
+ _data: FormData,
154
154
  _submitResult: SubmitResult
155
155
  ): Promise<FormReaction> {
156
156
  const messages = [
@@ -161,7 +161,7 @@ export abstract class Form<
161
161
  content: await this.render(
162
162
  ctx,
163
163
  {
164
- raw_values: data.raw_values,
164
+ raw_values: await this.getInitialValues(ctx),
165
165
  messages,
166
166
  },
167
167
  "show_field_errors" && false