@sealcode/sealgen 0.19.28 → 0.19.29

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.
@@ -73,7 +73,7 @@ class Tickable extends FormFieldControl {
73
73
  })();
74
74
  </script>
75
75
 
76
- ${(~valid || !!field_message) && !this.options.hide_errors && fctx.validate ? `<div class="input__error">${Array.from(new Set([message, field_message.message].filter((e) => !!e))).join(" \u2022 ")}</div>` : ""}
76
+ ${(~valid || !!field_message) && !this.options.hide_errors && fctx.validate ? `<div class="input__error">${Array.from(new Set([message, field_message?.message || false].filter((e) => !!e))).join(" \u2022 ")}</div>` : ""}
77
77
  `
78
78
  );
79
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.19.28",
3
+ "version": "0.19.29",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -1,5 +1,4 @@
1
1
  export * from "./autocomplete.js";
2
- export * from "./big-radio-group.js";
3
2
  export * from "./checkbox-group.js";
4
3
  export * from "./checkbox.js";
5
4
  export { CheckboxedListInput } from "./checkboxed-list-input.js";
@@ -29,8 +29,9 @@ export class HTML extends FormControl {
29
29
  if (typeof this.renderer === "string") {
30
30
  return this.renderer;
31
31
  }
32
- return typeof this.renderer == "function"
33
- ? this.renderer(fctx)
34
- : this.renderer;
32
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
33
+ return typeof this.renderer == "function" ?
34
+ this.renderer(fctx)
35
+ : this.renderer;
35
36
  }
36
37
  }
@@ -133,7 +133,7 @@ export abstract class Tickable<T> extends FormFieldControl {
133
133
  !this.options.hide_errors &&
134
134
  fctx.validate
135
135
  ) ?
136
- `<div class="input__error">${Array.from(new Set([message, field_message!.message].filter((e) => !!e))).join(" • ")}</div>`
136
+ `<div class="input__error">${Array.from(new Set([message, field_message?.message || false].filter((e) => !!e))).join(" • ")}</div>`
137
137
  : ""}
138
138
  `
139
139
  );
@@ -1,48 +0,0 @@
1
- import { FlatTemplatable, tempstream } from "tempstream";
2
- import { FormField } from "../fields/field.js";
3
- import { FormControlContext } from "./form-control.js";
4
- import { FormFieldControl } from "./form-field-control.js";
5
-
6
- export class BigRadioGroup extends FormFieldControl {
7
- constructor(
8
- public field: FormField,
9
- public options: Record<
10
- string,
11
- {
12
- description:
13
- | FlatTemplatable
14
- | ((fctx: FormControlContext) => FlatTemplatable);
15
- }
16
- >
17
- ) {
18
- super([field]);
19
- }
20
-
21
- async render(fctx: FormControlContext): Promise<FlatTemplatable> {
22
- const { raw: current_value } = await this.field.getParsedValue(
23
- fctx.ctx,
24
- fctx.data.raw_values
25
- );
26
- return tempstream /* HTML */ `<div class="bigradios">
27
- ${Object.entries(this.options).map(([key, { description }]) => {
28
- const id = `${this.field.name}-radio-${key}`;
29
- return tempstream /* HTML */ `<input
30
- type="radio"
31
- name="${this.field.name}"
32
- value="${key}"
33
- id="${id}"
34
- style="display: none"
35
- ${fctx.form_id ? `form=${fctx.form_id}` : ""}
36
- ${this.field.required ? "required" : ""}
37
- ${key == current_value ? "checked" : ""}
38
- />
39
- <div class="bigradio">
40
- ${typeof description == "function"
41
- ? description(fctx)
42
- : description}
43
- <label class="bigradio__cta" for="${id}">Wybierz</label>
44
- </div>`;
45
- })}
46
- </div>`;
47
- }
48
- }