@kong-ui-public/freeform 0.12.2 → 0.13.0

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.
Files changed (54) hide show
  1. package/README.md +39 -0
  2. package/dist/filler/cypress/index.js +161 -151
  3. package/dist/filler/field-walker-D6znOWwk.js +6682 -0
  4. package/dist/filler/packages/core/freeform/src/composables/field-path.d.ts +1 -3
  5. package/dist/filler/packages/core/freeform/src/composables/field-path.d.ts.map +1 -1
  6. package/dist/filler/packages/core/freeform/src/composables/field.d.ts +1 -3
  7. package/dist/filler/packages/core/freeform/src/composables/field.d.ts.map +1 -1
  8. package/dist/filler/packages/core/freeform/src/composables/useI18n.d.ts +72 -0
  9. package/dist/filler/packages/core/freeform/src/composables/useI18n.d.ts.map +1 -1
  10. package/dist/filler/packages/core/freeform/src/composables/useMapField.d.ts +1 -3
  11. package/dist/filler/packages/core/freeform/src/composables/useMapField.d.ts.map +1 -1
  12. package/dist/filler/packages/core/freeform/src/filler/cypress/create-filler.d.ts.map +1 -1
  13. package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/expression.d.ts +9 -4
  14. package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/expression.d.ts.map +1 -1
  15. package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/index.d.ts +2 -1
  16. package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/index.d.ts.map +1 -1
  17. package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/string.d.ts.map +1 -1
  18. package/dist/filler/packages/core/freeform/src/filler/fixtures/cel.d.ts +7 -0
  19. package/dist/filler/packages/core/freeform/src/filler/fixtures/cel.d.ts.map +1 -0
  20. package/dist/filler/packages/core/freeform/src/filler/playwright/create-filler.d.ts.map +1 -1
  21. package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/expression.d.ts +9 -4
  22. package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/expression.d.ts.map +1 -1
  23. package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/index.d.ts +2 -1
  24. package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/index.d.ts.map +1 -1
  25. package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/string.d.ts.map +1 -1
  26. package/dist/filler/packages/core/freeform/src/filler/shared/selectors.d.ts +0 -1
  27. package/dist/filler/packages/core/freeform/src/filler/shared/selectors.d.ts.map +1 -1
  28. package/dist/filler/packages/core/freeform/src/types.d.ts +4 -3
  29. package/dist/filler/packages/core/freeform/src/types.d.ts.map +1 -1
  30. package/dist/filler/playwright/index.js +151 -142
  31. package/dist/freeform.es.js +2186 -1958
  32. package/dist/freeform.umd.js +10 -5
  33. package/dist/style.css +1 -1
  34. package/dist/types/components/CelField.vue.d.ts +29 -0
  35. package/dist/types/components/CelField.vue.d.ts.map +1 -0
  36. package/dist/types/components/CelInput.vue.d.ts +48 -0
  37. package/dist/types/components/CelInput.vue.d.ts.map +1 -0
  38. package/dist/types/components/ExpressionEditor.vue.d.ts.map +1 -1
  39. package/dist/types/components/FieldRenderer.vue.d.ts +3 -1
  40. package/dist/types/components/FieldRenderer.vue.d.ts.map +1 -1
  41. package/dist/types/composables/field-path.d.ts +1 -3
  42. package/dist/types/composables/field-path.d.ts.map +1 -1
  43. package/dist/types/composables/field.d.ts +1 -3
  44. package/dist/types/composables/field.d.ts.map +1 -1
  45. package/dist/types/composables/useI18n.d.ts +72 -0
  46. package/dist/types/composables/useI18n.d.ts.map +1 -1
  47. package/dist/types/composables/useMapField.d.ts +1 -3
  48. package/dist/types/composables/useMapField.d.ts.map +1 -1
  49. package/dist/types/index.d.ts +2 -0
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/dist/types/types.d.ts +4 -3
  52. package/dist/types/types.d.ts.map +1 -1
  53. package/package.json +4 -1
  54. package/dist/filler/field-walker-D8i4HBJh.js +0 -22993
@@ -1,232 +1,241 @@
1
- import { s as f, i as k, c as h, g, E as S, w as A, a as v, b as F, d as E } from "../field-walker-D8i4HBJh.js";
1
+ import { s as r, i as v, c as S, g as b, E as C, w as F, a as E, b as x, d as B } from "../field-walker-D6znOWwk.js";
2
2
  import "lodash-es";
3
- async function B(o) {
4
- const { page: a, fieldKey: e, value: t } = o, n = f.field(e), i = a.locator(n);
5
- await i.clear(), t != null && t !== "" && await i.fill(String(t));
3
+ async function h(i) {
4
+ const { page: e, fieldKey: n, value: t } = i, a = e.locator(r.field(n));
5
+ await a.fill(t == null ? "" : String(t)), await a.dispatchEvent("change"), await a.blur();
6
6
  }
7
- async function C(o) {
8
- const { page: a, fieldKey: e, value: t } = o, n = f.field(e), i = a.locator(n);
9
- await i.clear(), t != null && await i.fill(String(t));
7
+ async function I(i) {
8
+ const { page: e, fieldKey: n, value: t } = i, a = r.field(n), o = e.locator(a);
9
+ await o.clear(), t != null && await o.fill(String(t));
10
10
  }
11
- async function x(o) {
12
- const { page: a, fieldKey: e, value: t } = o, n = f.field(e), i = a.locator(n);
13
- t === !0 ? await i.check() : t === !1 && await i.uncheck();
11
+ async function M(i) {
12
+ const { page: e, fieldKey: n, value: t } = i, a = r.field(n), o = e.locator(a);
13
+ t === !0 ? await o.check() : t === !1 && await o.uncheck();
14
14
  }
15
- async function I(o) {
16
- const { page: a, fieldKey: e, fieldSchema: t, value: n } = o, i = k(t), w = i ? Array.isArray(n) ? n : [n] : [n], u = f.field(e);
17
- await a.locator(u).click();
18
- const y = f.selectTrigger(e);
15
+ async function T(i) {
16
+ const { page: e, fieldKey: n, fieldSchema: t, value: a } = i, o = v(t), w = o ? Array.isArray(a) ? a : [a] : [a], u = r.field(n);
17
+ await e.locator(u).click();
18
+ const y = r.selectTrigger(n);
19
19
  for (const m of t.one_of ?? t.elements?.one_of ?? [])
20
20
  if (m != null) {
21
- const p = i ? f.multiSelectItem(String(m)) : f.selectItem(String(m));
22
- i && await a.locator(y).locator(`${p} button.selected`).count() > 0 && await a.locator(y).locator(p).click(), w.includes(m) && await a.locator(y).locator(p).click();
21
+ const g = o ? r.multiSelectItem(String(m)) : r.selectItem(String(m));
22
+ o && await e.locator(y).locator(`${g} button.selected`).count() > 0 && await e.locator(y).locator(g).click(), w.includes(m) && await e.locator(y).locator(g).click();
23
23
  }
24
24
  }
25
- async function j(o) {
26
- const { page: a, fieldKey: e, value: t } = o, n = Array.isArray(t) ? t : [t], i = f.tagInput(e);
27
- await a.locator(i).fill(n.join(","));
25
+ async function j(i) {
26
+ const { page: e, fieldKey: n, value: t } = i, a = Array.isArray(t) ? t : [t], o = r.tagInput(n);
27
+ await e.locator(o).fill(a.join(","));
28
28
  }
29
- async function M(o) {
30
- const { page: a, fieldKey: e, value: t, onFillItem: n } = o, i = f.arrayTabContainer(e), w = f.arrayBasicContainer(e), u = await a.locator(i).count() > 0, y = await a.locator(w).count() > 0;
29
+ async function R(i) {
30
+ const { page: e, fieldKey: n, value: t, onFillItem: a } = i, o = r.arrayTabContainer(n), w = r.arrayBasicContainer(n), u = await e.locator(o).count() > 0, y = await e.locator(w).count() > 0;
31
31
  if (u || y) {
32
- const m = f.arrayRemoveBtns(e), p = async () => {
33
- await a.locator(m).count() > 0 && (await a.locator(m).first().click(), await p());
32
+ const m = r.arrayRemoveBtns(n), g = async () => {
33
+ await e.locator(m).count() > 0 && (await e.locator(m).first().click(), await g());
34
34
  };
35
- if (await p(), !Array.isArray(t))
35
+ if (await g(), !Array.isArray(t))
36
36
  return;
37
- for (let l = 0; l < t.length; l++) {
38
- const c = f.arrayAddBtn(e);
39
- await a.locator(c).click(), await n(l, t[l]);
37
+ for (let s = 0; s < t.length; s++) {
38
+ const c = r.arrayAddBtn(n);
39
+ await e.locator(c).click(), await a(s, t[s]);
40
40
  }
41
41
  }
42
42
  }
43
- async function T(o) {
44
- const { page: a, fieldKey: e, onFillChildren: t } = o, n = f.objectSwitch(e);
45
- if (await a.locator(n).count() > 0) {
46
- const w = a.locator(n).locator("..").locator('[data-testid="switch-control"]'), u = await w.getAttribute("aria-checked") === "true", y = o.value !== null && o.value !== void 0;
47
- if (u !== y && (await w.click(), y && await a.locator(f.objectContent(e)).waitFor({ state: "visible" })), !y)
43
+ async function N(i) {
44
+ const { page: e, fieldKey: n, onFillChildren: t } = i, a = r.objectSwitch(n);
45
+ if (await e.locator(a).count() > 0) {
46
+ const w = e.locator(a).locator("..").locator('[data-testid="switch-control"]'), u = await w.getAttribute("aria-checked") === "true", y = i.value !== null && i.value !== void 0;
47
+ if (u !== y && (await w.click(), y && await e.locator(r.objectContent(n)).waitFor({ state: "visible" })), !y)
48
48
  return;
49
49
  }
50
50
  await t();
51
51
  }
52
- function R(o, a) {
53
- if (!o)
54
- throw new Error(`Unable to find map entry test id for "${a}"`);
55
- const e = o.match(/kid:\d+/);
56
- if (!e)
57
- throw new Error(`Unable to extract map entry kid id from test id "${o}"`);
58
- return e[0];
52
+ function $(i, e) {
53
+ if (!i)
54
+ throw new Error(`Unable to find map entry test id for "${e}"`);
55
+ const n = i.match(/kid:\d+/);
56
+ if (!n)
57
+ throw new Error(`Unable to extract map entry kid id from test id "${i}"`);
58
+ return n[0];
59
59
  }
60
- async function N(o) {
61
- const { page: a, fieldKey: e, value: t, onFillEntry: n } = o, i = async () => {
62
- const u = f.mapRemoveBtns(e);
63
- await a.locator(u).count() !== 0 && (await a.locator(u).first().click(), await i());
60
+ async function _(i) {
61
+ const { page: e, fieldKey: n, value: t, onFillEntry: a } = i, o = async () => {
62
+ const u = r.mapRemoveBtns(n);
63
+ await e.locator(u).count() !== 0 && (await e.locator(u).first().click(), await o());
64
64
  };
65
- if (await i(), typeof t != "object" || t == null)
65
+ if (await o(), typeof t != "object" || t == null)
66
66
  return;
67
67
  const w = Object.entries(t);
68
68
  if (w.length !== 0)
69
69
  for (let u = 0; u < w.length; u++) {
70
70
  const [y, m] = w[u];
71
- await a.locator(f.mapAddBtn(e)).click();
72
- const p = f.mapContainer(e, u), l = a.locator(p);
73
- await l.waitFor();
74
- const c = a.locator(f.mapKey(e, u));
71
+ await e.locator(r.mapAddBtn(n)).click();
72
+ const g = r.mapContainer(n, u), s = e.locator(g);
73
+ await s.waitFor();
74
+ const c = e.locator(r.mapKey(n, u));
75
75
  await c.clear(), await c.fill(String(y));
76
- const r = l.locator(`[data-testid*="${e}.kid:"]`).first();
77
- await r.waitFor();
78
- const s = R(await r.getAttribute("data-testid"), e);
79
- await n(s, m);
76
+ const l = s.locator(`[data-testid*="${n}.kid:"]`).first();
77
+ await l.waitFor();
78
+ const f = $(await l.getAttribute("data-testid"), n);
79
+ await a(f, m);
80
80
  }
81
81
  }
82
- async function $(o) {
83
- const { page: a, fieldKey: e, value: t } = o, n = f.json(e), i = a.locator(n).locator("textarea"), w = typeof t == "string" ? t : JSON.stringify(t, null, 2);
84
- await i.clear(), await i.fill(w);
82
+ async function J(i) {
83
+ const { page: e, fieldKey: n, value: t } = i, a = r.json(n), o = e.locator(a).locator("textarea"), w = typeof t == "string" ? t : JSON.stringify(t, null, 2);
84
+ await o.clear(), await o.fill(w);
85
+ }
86
+ async function O(i) {
87
+ const { page: e, fieldKey: n, value: t } = i, a = r.field(n), o = e.locator(a), w = typeof t == "object" && t?.id ? t.id : t;
88
+ await o.clear(), w && await o.fill(String(w));
85
89
  }
86
- async function _(o) {
87
- const { page: a, fieldKey: e, value: t } = o, n = f.field(e), i = a.locator(n), w = typeof t == "object" && t?.id ? t.id : t;
88
- await i.clear(), w && await i.fill(String(w));
90
+ async function H(i) {
91
+ const { page: e, fieldKey: n } = i;
92
+ await e.locator(r.expression(n)).waitFor({ state: "visible" });
93
+ const t = e.locator(r.expressionAddBtn(n));
94
+ await t.count() && await t.click(), await e.locator(r.field(n)).evaluate((a) => a.classList.contains("cel-input")) ? await k(i) : await h(i);
89
95
  }
90
- async function J(o) {
91
- const { page: a, fieldKey: e, value: t } = o, n = a.locator(f.expressionInput(e));
92
- await n.count() === 0 && await a.locator(f.expressionAddBtn(e)).click(), await n.clear(), t != null && t !== "" && await n.fill(String(t));
96
+ async function k(i) {
97
+ const { page: e, fieldKey: n, value: t } = i, a = e.locator(r.field(n)).locator(".monaco-editor textarea"), o = await a.evaluate(() => navigator.userAgent.includes("Macintosh") ? "Meta+A" : "Control+A");
98
+ await a.press(o), await a.press("Backspace"), t != null && t !== "" && await e.keyboard.insertText(String(t)), await a.press("Escape"), await a.blur();
93
99
  }
94
- const O = {
95
- fillString: B,
96
- fillNumber: C,
97
- fillBoolean: x,
98
- fillEnum: I,
100
+ const L = {
101
+ fillString: h,
102
+ fillNumber: I,
103
+ fillBoolean: M,
104
+ fillEnum: T,
99
105
  fillTag: j,
100
- fillArray: M,
101
- fillRecord: T,
102
- fillMap: N,
103
- fillJson: $,
104
- fillForeign: _,
105
- fillExpression: J
106
+ fillArray: R,
107
+ fillRecord: N,
108
+ fillMap: _,
109
+ fillJson: J,
110
+ fillForeign: O,
111
+ fillExpression: H,
112
+ fillCel: k
106
113
  };
107
- function U(o, a, e) {
108
- const t = h(a), n = { ...O, ...e };
109
- async function i(l, c, r = "") {
110
- for (const s of A(l, c, t, r))
111
- await w(s);
114
+ function V(i, e, n) {
115
+ const t = S(e), a = { ...L, ...n };
116
+ async function o(s, c, l = "") {
117
+ for (const f of F(s, c, t, l))
118
+ await w(f);
112
119
  }
113
- async function w({ handlerType: l, fieldKey: c, fieldSchema: r, value: s }) {
114
- switch (l) {
115
- case "string":
116
- await n.fillString({ page: o, fieldKey: c, fieldSchema: r, value: s });
120
+ async function w({ handlerType: s, fieldKey: c, fieldSchema: l, value: f }) {
121
+ switch (s) {
122
+ case "string": {
123
+ await (await i.locator(r.field(c)).evaluate((A) => A.classList.contains("cel-input")) ? a.fillCel : a.fillString)({ page: i, fieldKey: c, fieldSchema: l, value: f });
117
124
  break;
125
+ }
118
126
  case "number":
119
- await n.fillNumber({ page: o, fieldKey: c, fieldSchema: r, value: s });
127
+ await a.fillNumber({ page: i, fieldKey: c, fieldSchema: l, value: f });
120
128
  break;
121
129
  case "boolean":
122
- await n.fillBoolean({ page: o, fieldKey: c, fieldSchema: r, value: s });
130
+ await a.fillBoolean({ page: i, fieldKey: c, fieldSchema: l, value: f });
123
131
  break;
124
132
  case "enum":
125
- await n.fillEnum({ page: o, fieldKey: c, fieldSchema: r, value: s });
133
+ await a.fillEnum({ page: i, fieldKey: c, fieldSchema: l, value: f });
126
134
  break;
127
135
  case "tag":
128
- await n.fillTag({ page: o, fieldKey: c, fieldSchema: r, value: s });
136
+ await a.fillTag({ page: i, fieldKey: c, fieldSchema: l, value: f });
129
137
  break;
130
138
  case "map":
131
- await n.fillMap({
132
- page: o,
139
+ await a.fillMap({
140
+ page: i,
133
141
  fieldKey: c,
134
- fieldSchema: r,
135
- value: s,
136
- onFillEntry: async (b, d) => {
137
- await y(t, c, b, d);
142
+ fieldSchema: l,
143
+ value: f,
144
+ onFillEntry: async (p, d) => {
145
+ await y(t, c, p, d);
138
146
  }
139
147
  });
140
148
  break;
141
149
  case "json":
142
- await n.fillJson({ page: o, fieldKey: c, fieldSchema: r, value: s });
150
+ await a.fillJson({ page: i, fieldKey: c, fieldSchema: l, value: f });
143
151
  break;
144
152
  case "foreign":
145
- await n.fillForeign({ page: o, fieldKey: c, fieldSchema: r, value: s });
153
+ await a.fillForeign({ page: i, fieldKey: c, fieldSchema: l, value: f });
146
154
  break;
147
155
  case "expression":
148
- await n.fillExpression({ page: o, fieldKey: c, fieldSchema: r, value: s });
156
+ await a.fillExpression({ page: i, fieldKey: c, fieldSchema: l, value: f });
149
157
  break;
150
158
  case "expressionArray":
151
- if (Array.isArray(s))
152
- for (const [b, d] of s.entries())
153
- d == null || d === S || await u(t, c, b, d);
159
+ if (Array.isArray(f))
160
+ for (const [p, d] of f.entries())
161
+ d == null || d === C || await u(t, c, p, d);
154
162
  break;
155
163
  case "array":
156
- await n.fillArray({
157
- page: o,
164
+ await a.fillArray({
165
+ page: i,
158
166
  fieldKey: c,
159
- fieldSchema: r,
160
- value: s,
161
- onFillItem: async (b, d) => {
162
- await u(t, c, b, d);
167
+ fieldSchema: l,
168
+ value: f,
169
+ onFillItem: async (p, d) => {
170
+ await u(t, c, p, d);
163
171
  }
164
172
  });
165
173
  break;
166
174
  case "record":
167
- await n.fillRecord({
168
- page: o,
175
+ await a.fillRecord({
176
+ page: i,
169
177
  fieldKey: c,
170
- fieldSchema: r,
171
- value: s,
178
+ fieldSchema: l,
179
+ value: f,
172
180
  onFillChildren: async () => {
173
- await i(r.fields, s, c);
181
+ await o(l.fields, f, c);
174
182
  }
175
183
  });
176
184
  break;
177
185
  }
178
186
  }
179
- async function u(l, c, r, s) {
180
- const { itemKey: b, itemSchema: d } = v(c, r, l);
181
- F(d) ? await i(d.fields, s, b) : await w({
182
- handlerType: g(d),
183
- fieldKey: b,
187
+ async function u(s, c, l, f) {
188
+ const { itemKey: p, itemSchema: d } = E(c, l, s);
189
+ x(d) ? await o(d.fields, f, p) : await w({
190
+ handlerType: b(d),
191
+ fieldKey: p,
184
192
  fieldSchema: d,
185
- value: s
193
+ value: f
186
194
  });
187
195
  }
188
- async function y(l, c, r, s) {
189
- const { entryKey: b, entrySchema: d } = E(c, r, l);
196
+ async function y(s, c, l, f) {
197
+ const { entryKey: p, entrySchema: d } = B(c, l, s);
190
198
  await w({
191
- handlerType: g(d),
192
- fieldKey: b,
199
+ handlerType: b(d),
200
+ fieldKey: p,
193
201
  fieldSchema: d,
194
- value: s
202
+ value: f
195
203
  });
196
204
  }
197
- async function m(l) {
198
- a.fields && Array.isArray(a.fields) && await i(a.fields, l);
205
+ async function m(s) {
206
+ e.fields && Array.isArray(e.fields) && await o(e.fields, s);
199
207
  }
200
- async function p(l, c) {
201
- const r = t.schemaMap[l];
202
- if (!r)
203
- throw new Error(`Field schema for "${l}" not found in schema map`);
208
+ async function g(s, c) {
209
+ const l = t.schemaMap[s];
210
+ if (!l)
211
+ throw new Error(`Field schema for "${s}" not found in schema map`);
204
212
  await w({
205
- handlerType: g(r),
206
- fieldKey: l,
207
- fieldSchema: r,
213
+ handlerType: b(l),
214
+ fieldKey: s,
215
+ fieldSchema: l,
208
216
  value: c
209
217
  });
210
218
  }
211
219
  return {
212
220
  fill: m,
213
- fillField: p,
221
+ fillField: g,
214
222
  schemaMap: t.schemaMap,
215
- handlers: n
223
+ handlers: a
216
224
  };
217
225
  }
218
226
  export {
219
- U as createFiller,
220
- M as fillArray,
221
- x as fillBoolean,
222
- I as fillEnum,
223
- J as fillExpression,
224
- _ as fillForeign,
225
- $ as fillJson,
226
- N as fillMap,
227
- C as fillNumber,
228
- T as fillRecord,
229
- B as fillString,
227
+ V as createFiller,
228
+ R as fillArray,
229
+ M as fillBoolean,
230
+ k as fillCel,
231
+ T as fillEnum,
232
+ H as fillExpression,
233
+ O as fillForeign,
234
+ J as fillJson,
235
+ _ as fillMap,
236
+ I as fillNumber,
237
+ N as fillRecord,
238
+ h as fillString,
230
239
  j as fillTag,
231
- O as handlers
240
+ L as handlers
232
241
  };