@sealcode/sealgen 0.15.47 → 0.15.48

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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.15.47",
3
+ "version": "0.15.48",
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
  );