@sealcode/sealgen 0.15.47 → 0.15.49

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.
@@ -9,10 +9,13 @@ class SingleReferenceDropdown extends FreeformDropdown {
9
9
  field,
10
10
  async (ctx) => {
11
11
  const { items } = await ctx.$app.collections[field.sealiousField.target_collection].list(ctx.$context).fetch();
12
- return items.map((item) => ({
13
- value: item.id,
14
- label: options.getLabel ? options.getLabel(item) : item.id
15
- }));
12
+ return [
13
+ { value: "", label: "--" },
14
+ ...items.map((item) => ({
15
+ value: item.id,
16
+ label: options.getLabel ? options.getLabel(item) : item.id
17
+ }))
18
+ ];
16
19
  },
17
20
  options
18
21
  );
@@ -45,6 +45,7 @@ describe("single-reference.test", () => {
45
45
  await PlaywritghtExpect(page.getByLabel("article")).toBeVisible();
46
46
  await page.getByLabel("article").selectOption({ label: "article 2" });
47
47
  await page.getByRole("button", { name: "Wy\u015Blij" }).click();
48
+ await page.getByLabel("article").selectOption({ label: "--" });
48
49
  await test_app.close();
49
50
  }).timeout(100 * 1e3);
50
51
  });
@@ -20,14 +20,11 @@ export class ${toPascalCase(
20
20
  return component_arguments;
21
21
  }
22
22
 
23
- toHTML(
24
- {
25
- title,
26
- content,
27
- }: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
28
- classes: string[],
29
- { language, render_markdown }: JDDContext
30
- ): FlatTemplatable {
23
+ async toHTML({
24
+ args: { title, content},
25
+ classes,
26
+ jdd_context: { render_markdown, render_image, language },
27
+ }: ComponentToHTMLArgs<typeof component_arguments>): Promise<string> {
31
28
  return (
32
29
  <div class={["${toKebabCase(component_name)}", ...classes]}>
33
30
  <h2>{title} \u2022 ${toPascalCase(component_name)} </h2>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.15.47",
3
+ "version": "0.15.49",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -56,6 +56,7 @@ describe("single-reference.test", () => {
56
56
  await PlaywritghtExpect(page.getByLabel("article")).toBeVisible();
57
57
  await page.getByLabel("article").selectOption({ label: "article 2" });
58
58
  await page.getByRole("button", { name: "Wyślij" }).click();
59
+ await page.getByLabel("article").selectOption({ label: "--" }); // "--" means empty value - it should be available, as the field is not required
59
60
 
60
61
  await test_app.close();
61
62
  }).timeout(100 * 1000);
@@ -25,10 +25,15 @@ export class SingleReferenceDropdown<
25
25
  ]
26
26
  .list(ctx.$context)
27
27
  .fetch();
28
- return items.map((item) => ({
29
- value: item.id,
30
- label: options.getLabel ? options.getLabel(item) : item.id,
31
- }));
28
+ return [
29
+ { value: "", label: "--" },
30
+ ...items.map((item) => ({
31
+ value: item.id,
32
+ label: options.getLabel
33
+ ? options.getLabel(item)
34
+ : item.id,
35
+ })),
36
+ ];
32
37
  },
33
38
  options
34
39
  );
@@ -21,14 +21,11 @@ export class ${toPascalCase(
21
21
  return component_arguments;
22
22
  }
23
23
 
24
- toHTML(
25
- {
26
- title,
27
- content,
28
- }: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
29
- classes: string[],
30
- { language, render_markdown }: JDDContext
31
- ): FlatTemplatable {
24
+ async toHTML({
25
+ args: { title, content},
26
+ classes,
27
+ jdd_context: { render_markdown, render_image, language },
28
+ }: ComponentToHTMLArgs<typeof component_arguments>): Promise<string> {
32
29
  return (
33
30
  <div class={["${toKebabCase(component_name)}", ...classes]}>
34
31
  <h2>{title} • ${toPascalCase(component_name)} </h2>