@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.
- package/README.md +39 -0
- package/dist/filler/cypress/index.js +161 -151
- package/dist/filler/field-walker-D6znOWwk.js +6682 -0
- package/dist/filler/packages/core/freeform/src/composables/field-path.d.ts +1 -3
- package/dist/filler/packages/core/freeform/src/composables/field-path.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/field.d.ts +1 -3
- package/dist/filler/packages/core/freeform/src/composables/field.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/useI18n.d.ts +72 -0
- package/dist/filler/packages/core/freeform/src/composables/useI18n.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/useMapField.d.ts +1 -3
- package/dist/filler/packages/core/freeform/src/composables/useMapField.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/cypress/create-filler.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/expression.d.ts +9 -4
- package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/expression.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/index.d.ts +2 -1
- package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/index.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/string.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/fixtures/cel.d.ts +7 -0
- package/dist/filler/packages/core/freeform/src/filler/fixtures/cel.d.ts.map +1 -0
- package/dist/filler/packages/core/freeform/src/filler/playwright/create-filler.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/expression.d.ts +9 -4
- package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/expression.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/index.d.ts +2 -1
- package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/index.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/string.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/shared/selectors.d.ts +0 -1
- package/dist/filler/packages/core/freeform/src/filler/shared/selectors.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/types.d.ts +4 -3
- package/dist/filler/packages/core/freeform/src/types.d.ts.map +1 -1
- package/dist/filler/playwright/index.js +151 -142
- package/dist/freeform.es.js +2186 -1958
- package/dist/freeform.umd.js +10 -5
- package/dist/style.css +1 -1
- package/dist/types/components/CelField.vue.d.ts +29 -0
- package/dist/types/components/CelField.vue.d.ts.map +1 -0
- package/dist/types/components/CelInput.vue.d.ts +48 -0
- package/dist/types/components/CelInput.vue.d.ts.map +1 -0
- package/dist/types/components/ExpressionEditor.vue.d.ts.map +1 -1
- package/dist/types/components/FieldRenderer.vue.d.ts +3 -1
- package/dist/types/components/FieldRenderer.vue.d.ts.map +1 -1
- package/dist/types/composables/field-path.d.ts +1 -3
- package/dist/types/composables/field-path.d.ts.map +1 -1
- package/dist/types/composables/field.d.ts +1 -3
- package/dist/types/composables/field.d.ts.map +1 -1
- package/dist/types/composables/useI18n.d.ts +72 -0
- package/dist/types/composables/useI18n.d.ts.map +1 -1
- package/dist/types/composables/useMapField.d.ts +1 -3
- package/dist/types/composables/useMapField.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +4 -3
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/filler/field-walker-D8i4HBJh.js +0 -22993
|
@@ -1,232 +1,241 @@
|
|
|
1
|
-
import { s as
|
|
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
|
|
4
|
-
const { page:
|
|
5
|
-
await
|
|
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
|
|
8
|
-
const { page:
|
|
9
|
-
await
|
|
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
|
|
12
|
-
const { page:
|
|
13
|
-
t === !0 ? await
|
|
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
|
|
16
|
-
const { page:
|
|
17
|
-
await
|
|
18
|
-
const y =
|
|
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
|
|
22
|
-
|
|
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(
|
|
26
|
-
const { page:
|
|
27
|
-
await
|
|
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
|
|
30
|
-
const { page:
|
|
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 =
|
|
33
|
-
await
|
|
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
|
|
35
|
+
if (await g(), !Array.isArray(t))
|
|
36
36
|
return;
|
|
37
|
-
for (let
|
|
38
|
-
const c =
|
|
39
|
-
await
|
|
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
|
|
44
|
-
const { page:
|
|
45
|
-
if (await
|
|
46
|
-
const w =
|
|
47
|
-
if (u !== y && (await w.click(), y && await
|
|
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
|
|
53
|
-
if (!
|
|
54
|
-
throw new Error(`Unable to find map entry test id for "${
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
throw new Error(`Unable to extract map entry kid id from test id "${
|
|
58
|
-
return
|
|
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
|
|
61
|
-
const { page:
|
|
62
|
-
const u =
|
|
63
|
-
await
|
|
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
|
|
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
|
|
72
|
-
const
|
|
73
|
-
await
|
|
74
|
-
const c =
|
|
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
|
|
77
|
-
await
|
|
78
|
-
const
|
|
79
|
-
await
|
|
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
|
|
83
|
-
const { page:
|
|
84
|
-
await
|
|
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
|
|
87
|
-
const { page:
|
|
88
|
-
await
|
|
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
|
|
91
|
-
const { page:
|
|
92
|
-
await
|
|
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
|
|
95
|
-
fillString:
|
|
96
|
-
fillNumber:
|
|
97
|
-
fillBoolean:
|
|
98
|
-
fillEnum:
|
|
100
|
+
const L = {
|
|
101
|
+
fillString: h,
|
|
102
|
+
fillNumber: I,
|
|
103
|
+
fillBoolean: M,
|
|
104
|
+
fillEnum: T,
|
|
99
105
|
fillTag: j,
|
|
100
|
-
fillArray:
|
|
101
|
-
fillRecord:
|
|
102
|
-
fillMap:
|
|
103
|
-
fillJson:
|
|
104
|
-
fillForeign:
|
|
105
|
-
fillExpression:
|
|
106
|
+
fillArray: R,
|
|
107
|
+
fillRecord: N,
|
|
108
|
+
fillMap: _,
|
|
109
|
+
fillJson: J,
|
|
110
|
+
fillForeign: O,
|
|
111
|
+
fillExpression: H,
|
|
112
|
+
fillCel: k
|
|
106
113
|
};
|
|
107
|
-
function
|
|
108
|
-
const t =
|
|
109
|
-
async function
|
|
110
|
-
for (const
|
|
111
|
-
await w(
|
|
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:
|
|
114
|
-
switch (
|
|
115
|
-
case "string":
|
|
116
|
-
await
|
|
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
|
|
127
|
+
await a.fillNumber({ page: i, fieldKey: c, fieldSchema: l, value: f });
|
|
120
128
|
break;
|
|
121
129
|
case "boolean":
|
|
122
|
-
await
|
|
130
|
+
await a.fillBoolean({ page: i, fieldKey: c, fieldSchema: l, value: f });
|
|
123
131
|
break;
|
|
124
132
|
case "enum":
|
|
125
|
-
await
|
|
133
|
+
await a.fillEnum({ page: i, fieldKey: c, fieldSchema: l, value: f });
|
|
126
134
|
break;
|
|
127
135
|
case "tag":
|
|
128
|
-
await
|
|
136
|
+
await a.fillTag({ page: i, fieldKey: c, fieldSchema: l, value: f });
|
|
129
137
|
break;
|
|
130
138
|
case "map":
|
|
131
|
-
await
|
|
132
|
-
page:
|
|
139
|
+
await a.fillMap({
|
|
140
|
+
page: i,
|
|
133
141
|
fieldKey: c,
|
|
134
|
-
fieldSchema:
|
|
135
|
-
value:
|
|
136
|
-
onFillEntry: async (
|
|
137
|
-
await y(t, c,
|
|
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
|
|
150
|
+
await a.fillJson({ page: i, fieldKey: c, fieldSchema: l, value: f });
|
|
143
151
|
break;
|
|
144
152
|
case "foreign":
|
|
145
|
-
await
|
|
153
|
+
await a.fillForeign({ page: i, fieldKey: c, fieldSchema: l, value: f });
|
|
146
154
|
break;
|
|
147
155
|
case "expression":
|
|
148
|
-
await
|
|
156
|
+
await a.fillExpression({ page: i, fieldKey: c, fieldSchema: l, value: f });
|
|
149
157
|
break;
|
|
150
158
|
case "expressionArray":
|
|
151
|
-
if (Array.isArray(
|
|
152
|
-
for (const [
|
|
153
|
-
d == null || 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
|
|
157
|
-
page:
|
|
164
|
+
await a.fillArray({
|
|
165
|
+
page: i,
|
|
158
166
|
fieldKey: c,
|
|
159
|
-
fieldSchema:
|
|
160
|
-
value:
|
|
161
|
-
onFillItem: async (
|
|
162
|
-
await u(t, c,
|
|
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
|
|
168
|
-
page:
|
|
175
|
+
await a.fillRecord({
|
|
176
|
+
page: i,
|
|
169
177
|
fieldKey: c,
|
|
170
|
-
fieldSchema:
|
|
171
|
-
value:
|
|
178
|
+
fieldSchema: l,
|
|
179
|
+
value: f,
|
|
172
180
|
onFillChildren: async () => {
|
|
173
|
-
await
|
|
181
|
+
await o(l.fields, f, c);
|
|
174
182
|
}
|
|
175
183
|
});
|
|
176
184
|
break;
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
|
-
async function u(
|
|
180
|
-
const { itemKey:
|
|
181
|
-
|
|
182
|
-
handlerType:
|
|
183
|
-
fieldKey:
|
|
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:
|
|
193
|
+
value: f
|
|
186
194
|
});
|
|
187
195
|
}
|
|
188
|
-
async function y(
|
|
189
|
-
const { entryKey:
|
|
196
|
+
async function y(s, c, l, f) {
|
|
197
|
+
const { entryKey: p, entrySchema: d } = B(c, l, s);
|
|
190
198
|
await w({
|
|
191
|
-
handlerType:
|
|
192
|
-
fieldKey:
|
|
199
|
+
handlerType: b(d),
|
|
200
|
+
fieldKey: p,
|
|
193
201
|
fieldSchema: d,
|
|
194
|
-
value:
|
|
202
|
+
value: f
|
|
195
203
|
});
|
|
196
204
|
}
|
|
197
|
-
async function m(
|
|
198
|
-
|
|
205
|
+
async function m(s) {
|
|
206
|
+
e.fields && Array.isArray(e.fields) && await o(e.fields, s);
|
|
199
207
|
}
|
|
200
|
-
async function
|
|
201
|
-
const
|
|
202
|
-
if (!
|
|
203
|
-
throw new Error(`Field schema for "${
|
|
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:
|
|
206
|
-
fieldKey:
|
|
207
|
-
fieldSchema:
|
|
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:
|
|
221
|
+
fillField: g,
|
|
214
222
|
schemaMap: t.schemaMap,
|
|
215
|
-
handlers:
|
|
223
|
+
handlers: a
|
|
216
224
|
};
|
|
217
225
|
}
|
|
218
226
|
export {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
|
|
240
|
+
L as handlers
|
|
232
241
|
};
|