@sealcode/sealgen 0.8.20 → 0.8.21

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.
@@ -1,12 +1,13 @@
1
1
  import { Context } from "koa";
2
2
  import { FlatTemplatable } from "tempstream";
3
+ import { FormDataValue, FormMessage } from "../form";
3
4
  import { FormControl } from "./controls";
4
- declare type Renderer = ((ctx: Context) => FlatTemplatable) | FlatTemplatable;
5
+ declare type Renderer = ((ctx: Context, form_id: string) => FlatTemplatable) | FlatTemplatable;
5
6
  export declare class HTML extends FormControl {
6
7
  role: "decoration" | "submit";
7
8
  renderer: Renderer;
8
9
  constructor(role: "decoration" | "submit", renderer: Renderer);
9
10
  constructor(renderer: Renderer);
10
- render(ctx: Context): Promise<FlatTemplatable>;
11
+ render(ctx: Context, _data: Record<string, FormDataValue>, _messages: FormMessage[], _field_name_prefix: string, form_id: string): Promise<FlatTemplatable>;
11
12
  }
12
13
  export {};
@@ -20,6 +20,7 @@ class BigRadioGroup extends form_field_control_1.FormFieldControl {
20
20
  value="${key}"
21
21
  id="${id}"
22
22
  style="display: none"
23
+ ${form_id ? `form=${form_id}` : ""}
23
24
  ${this.field.required ? "required" : ""}
24
25
  ${key == current_value ? "checked" : ""}
25
26
  />
@@ -1 +1 @@
1
- {"version":3,"file":"big-radio-group.js","sourceRoot":"","sources":["../../../src/forms/controls/big-radio-group.ts"],"names":[],"mappings":";;;AACA,2CAAyD;AAGzD,6DAAwD;AAExD,MAAa,aAAc,SAAQ,qCAAgB;IAClD,YACQ,KAAgB,EAChB,OAcN;QAED,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAjBR,UAAK,GAAL,KAAK,CAAW;QAChB,YAAO,GAAP,OAAO,CAcb;IAGF,CAAC;IAED,KAAK,CAAC,MAAM,CACX,GAAY,EACZ,IAAmC,EACnC,QAAY,EACZ,iBAAyB,EACzB,OAAe,EACf,iBAA0B;QAE1B,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpE,OAAO,uBAAU,CAAA,UAAU,CAAC;KACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE;YAC7D,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,UAAU,GAAG,EAAE,CAAC;YAC7C,OAAO,uBAAU,CAAA,UAAU,CAAC;;cAElB,IAAI,CAAC,KAAK,CAAC,IAAI;eACd,GAAG;YACN,EAAE;;QAEN,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QACrC,GAAG,IAAI,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;;;QAGrC,OAAO,WAAW,IAAI,UAAU;gBACjC,CAAC,CAAC,WAAW,CACX,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,iBAAiB,CAChB;gBACH,CAAC,CAAC,WAAW;0CACsB,EAAE;YAChC,CAAC;QACV,CAAC,CAAC;SACI,CAAC;IACT,CAAC;CACD;AA3DD,sCA2DC"}
1
+ {"version":3,"file":"big-radio-group.js","sourceRoot":"","sources":["../../../src/forms/controls/big-radio-group.ts"],"names":[],"mappings":";;;AACA,2CAAyD;AAGzD,6DAAwD;AAExD,MAAa,aAAc,SAAQ,qCAAgB;IAClD,YACQ,KAAgB,EAChB,OAcN;QAED,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAjBR,UAAK,GAAL,KAAK,CAAW;QAChB,YAAO,GAAP,OAAO,CAcb;IAGF,CAAC;IAED,KAAK,CAAC,MAAM,CACX,GAAY,EACZ,IAAmC,EACnC,QAAY,EACZ,iBAAyB,EACzB,OAAe,EACf,iBAA0B;QAE1B,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpE,OAAO,uBAAU,CAAA,UAAU,CAAC;KACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE;YAC7D,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,UAAU,GAAG,EAAE,CAAC;YAC7C,OAAO,uBAAU,CAAA,UAAU,CAAC;;cAElB,IAAI,CAAC,KAAK,CAAC,IAAI;eACd,GAAG;YACN,EAAE;;QAEN,OAAO,CAAC,CAAC,CAAC,QAAQ,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE;QAChC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QACrC,GAAG,IAAI,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;;;QAGrC,OAAO,WAAW,IAAI,UAAU;gBACjC,CAAC,CAAC,WAAW,CACX,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,iBAAiB,CAChB;gBACH,CAAC,CAAC,WAAW;0CACsB,EAAE;YAChC,CAAC;QACV,CAAC,CAAC;SACI,CAAC;IACT,CAAC;CACD;AA5DD,sCA4DC"}
@@ -14,12 +14,12 @@ class HTML extends controls_1.FormControl {
14
14
  this.renderer = role_or_renderer;
15
15
  }
16
16
  }
17
- async render(ctx) {
17
+ async render(ctx, _data, _messages, _field_name_prefix, form_id) {
18
18
  if (typeof this.renderer === "string") {
19
19
  return this.renderer;
20
20
  }
21
21
  return typeof this.renderer == "function"
22
- ? this.renderer(ctx)
22
+ ? this.renderer(ctx, form_id)
23
23
  : this.renderer;
24
24
  }
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/forms/controls/html.ts"],"names":[],"mappings":";;;AAEA,yCAAyC;AAIzC,MAAa,IAAK,SAAQ,sBAAW;IAMpC,YACC,gBAAoD,EACpD,qBAEkB;QAElB,KAAK,EAAE,CAAC;QAXT,SAAI,GAAW,YAAwC,CAAC;QAYvD,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,IAAI,GAAG,gBAA2C,CAAC;YACxD,IAAI,CAAC,QAAQ,GAAG,qBAAiC,CAAC;SAClD;aAAM;YACN,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;SACjC;IACF,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAY;QACxB,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAC;SACrB;QACD,OAAO,OAAO,IAAI,CAAC,QAAQ,IAAI,UAAU;YACxC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACpB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAClB,CAAC;CACD;AA7BD,oBA6BC"}
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/forms/controls/html.ts"],"names":[],"mappings":";;;AAGA,yCAAyC;AAMzC,MAAa,IAAK,SAAQ,sBAAW;IAMpC,YACC,gBAAoD,EACpD,qBAAkD;QAElD,KAAK,EAAE,CAAC;QATT,SAAI,GAAW,YAAwC,CAAC;QAUvD,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,IAAI,GAAG,gBAA2C,CAAC;YACxD,IAAI,CAAC,QAAQ,GAAG,qBAAiC,CAAC;SAClD;aAAM;YACN,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;SACjC;IACF,CAAC;IAED,KAAK,CAAC,MAAM,CACX,GAAY,EACZ,KAAoC,EACpC,SAAwB,EACxB,kBAA0B,EAC1B,OAAe;QAEf,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAC;SACrB;QACD,OAAO,OAAO,IAAI,CAAC,QAAQ,IAAI,UAAU;YACxC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;YAC7B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAClB,CAAC;CACD;AAjCD,oBAiCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.8.20",
3
+ "version": "0.8.21",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -44,6 +44,7 @@ export class BigRadioGroup extends FormFieldControl {
44
44
  value="${key}"
45
45
  id="${id}"
46
46
  style="display: none"
47
+ ${form_id ? `form=${form_id}` : ""}
47
48
  ${this.field.required ? "required" : ""}
48
49
  ${key == current_value ? "checked" : ""}
49
50
  />
@@ -1,8 +1,11 @@
1
1
  import { Context } from "koa";
2
2
  import { FlatTemplatable } from "tempstream";
3
+ import { FormDataValue, FormMessage } from "../form";
3
4
  import { FormControl } from "./controls";
4
5
 
5
- type Renderer = ((ctx: Context) => FlatTemplatable) | FlatTemplatable;
6
+ type Renderer =
7
+ | ((ctx: Context, form_id: string) => FlatTemplatable)
8
+ | FlatTemplatable;
6
9
 
7
10
  export class HTML extends FormControl {
8
11
  role = (<const>"decoration") as "decoration" | "submit";
@@ -12,9 +15,7 @@ export class HTML extends FormControl {
12
15
  constructor(renderer: Renderer);
13
16
  constructor(
14
17
  role_or_renderer: "decoration" | "submit" | Renderer,
15
- renderer_or_undefined?:
16
- | ((ctx: Context) => FlatTemplatable)
17
- | FlatTemplatable
18
+ renderer_or_undefined?: Renderer | FlatTemplatable
18
19
  ) {
19
20
  super();
20
21
  if (arguments.length == 2) {
@@ -25,12 +26,18 @@ export class HTML extends FormControl {
25
26
  }
26
27
  }
27
28
 
28
- async render(ctx: Context): Promise<FlatTemplatable> {
29
+ async render(
30
+ ctx: Context,
31
+ _data: Record<string, FormDataValue>,
32
+ _messages: FormMessage[],
33
+ _field_name_prefix: string,
34
+ form_id: string
35
+ ): Promise<FlatTemplatable> {
29
36
  if (typeof this.renderer === "string") {
30
37
  return this.renderer;
31
38
  }
32
39
  return typeof this.renderer == "function"
33
- ? this.renderer(ctx)
40
+ ? this.renderer(ctx, form_id)
34
41
  : this.renderer;
35
42
  }
36
43
  }