@sealcode/sealgen 0.19.21 → 0.19.22

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,7 +1,4 @@
1
1
  import regex_escape from "core-js-pure/features/regexp/escape.js";
2
- console.warn(regex_escape);
3
- const string = "jedna baba ;) drugiej babie ;)";
4
- console.warn(regex_escape(string), new RegExp(regex_escape(string)));
5
2
  const BooleanListFilter = {
6
3
  render: (value, field) => {
7
4
  return (
@@ -5,11 +5,9 @@ import { from_base64, to_base64 } from "../utils/base64.js";
5
5
  import { Mountable } from "./mountable.js";
6
6
  import { isPlainObject } from "is-what";
7
7
  class StatefulPage extends Mountable {
8
- async canAccess(_ctx) {
9
- return { canAccess: true, message: "" };
10
- }
11
- constructor() {
8
+ constructor(form_id) {
12
9
  super();
10
+ this.form_id = form_id;
13
11
  const original_render = this.render.bind(this);
14
12
  this.render = async (ctx, state, inputs) => {
15
13
  return this.wrapInLayout(
@@ -23,6 +21,9 @@ class StatefulPage extends Mountable {
23
21
  );
24
22
  };
25
23
  }
24
+ async canAccess(_ctx) {
25
+ return { canAccess: true, message: "" };
26
+ }
26
27
  async wrapInForm(context, state, content) {
27
28
  return tempstream`<form
28
29
  action="./"
@@ -69,6 +70,7 @@ class StatefulPage extends Mountable {
69
70
  type="submit"
70
71
  formaction="${this.makeActionURL(action_description, ...args)}"
71
72
  title="${label}"
73
+ ${this.form_id ? `form="${this.form_id}"` : ""}
72
74
  ${disabled ? "disabled" : ""}
73
75
  >
74
76
  ${content}
@@ -185,6 +187,9 @@ class StatefulPage extends Mountable {
185
187
  ),
186
188
  page: this
187
189
  });
190
+ console.debug("stateful-page.ts:320");
191
+ console.log("NEW STATUS!!! AFTER ACTION");
192
+ console.dir(new_state, { depth: 7 });
188
193
  ctx.body = this.render(ctx, new_state, inputs);
189
194
  } else {
190
195
  ctx.body = this.render(ctx, state, inputs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.19.21",
3
+ "version": "0.19.22",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -69,7 +69,7 @@ export abstract class StatefulPage<
69
69
  return <const>{ canAccess: true, message: "" };
70
70
  }
71
71
 
72
- constructor() {
72
+ constructor(public form_id?: string) {
73
73
  super();
74
74
  const original_render = this.render.bind(this) as typeof this.render;
75
75
  this.render = async (
@@ -156,6 +156,7 @@ export abstract class StatefulPage<
156
156
  type="submit"
157
157
  formaction="${this.makeActionURL(action_description, ...args)}"
158
158
  title="${label}"
159
+ ${this.form_id ? `form="${this.form_id}"` : ""}
159
160
  ${disabled ? "disabled" : ""}
160
161
  >
161
162
  ${content}
@@ -231,9 +232,9 @@ export abstract class StatefulPage<
231
232
  const original_state_string = ctx.$body.state;
232
233
  const original_state = await this.deserializeState(
233
234
  ctx,
234
- typeof original_state_string == "string"
235
- ? from_base64(original_state_string)
236
- : "{}"
235
+ typeof original_state_string == "string" ?
236
+ from_base64(original_state_string)
237
+ : "{}"
237
238
  );
238
239
 
239
240
  const $body = ctx.$body;