@kong-ui-public/entities-plugins 9.222.2 → 9.222.4

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,218 +1,219 @@
1
- import { s as f, i as S, c as F, g as h, w as v, a as A, b as B, d as p } from "../field-walker-_YAwDcC1.js";
2
- async function C(e) {
3
- const { page: a, fieldKey: n, value: t } = e, o = f.field(n), i = a.locator(o);
1
+ import { s as f, i as S, c as F, g as h, w as v, a as A, b as p, d as B } from "../field-walker-_YAwDcC1.js";
2
+ async function I(o) {
3
+ const { page: a, fieldKey: n, value: t } = o, e = f.field(n), i = a.locator(e);
4
4
  await i.clear(), t != null && t !== "" && await i.fill(String(t));
5
5
  }
6
- async function E(e) {
7
- const { page: a, fieldKey: n, value: t } = e, o = f.field(n), i = a.locator(o);
6
+ async function C(o) {
7
+ const { page: a, fieldKey: n, value: t } = o, e = f.field(n), i = a.locator(e);
8
8
  await i.clear(), t != null && await i.fill(String(t));
9
9
  }
10
- async function I(e) {
11
- const { page: a, fieldKey: n, value: t } = e, o = f.field(n), i = a.locator(o);
10
+ async function E(o) {
11
+ const { page: a, fieldKey: n, value: t } = o, e = f.field(n), i = a.locator(e);
12
12
  t === !0 ? await i.check({ force: !0 }) : t === !1 && await i.uncheck({ force: !0 });
13
13
  }
14
- async function j(e) {
15
- var b;
16
- const { page: a, fieldKey: n, fieldSchema: t, value: o } = e, i = S(t), w = i ? Array.isArray(o) ? o : [o] : [o], u = f.field(n);
17
- await a.locator(u).click();
18
- for (const d of t.one_of ?? ((b = t.elements) == null ? void 0 : b.one_of) ?? [])
19
- if (d != null) {
20
- const k = i ? f.multiSelectItem(String(d)) : f.selectItem(String(d));
21
- i && await a.locator(`${k} button.selected`).count() > 0 && await a.locator(k).click(), w.includes(d) && await a.locator(k).click();
14
+ async function T(o) {
15
+ var k;
16
+ const { page: a, fieldKey: n, fieldSchema: t, value: e } = o, i = S(t), w = i ? Array.isArray(e) ? e : [e] : [e], d = f.field(n);
17
+ await a.locator(d).click();
18
+ const g = f.selectTrigger(n);
19
+ for (const u of t.one_of ?? ((k = t.elements) == null ? void 0 : k.one_of) ?? [])
20
+ if (u != null) {
21
+ const r = i ? f.multiSelectItem(String(u)) : f.selectItem(String(u));
22
+ i && await a.locator(g).locator(`${r} button.selected`).count() > 0 && await a.locator(g).locator(r).click(), w.includes(u) && await a.locator(g).locator(r).click();
22
23
  }
23
24
  }
24
- async function M(e) {
25
- const { page: a, fieldKey: n, value: t } = e, o = Array.isArray(t) ? t : [t], i = f.tagInput(n);
26
- await a.locator(i).fill(o.join(","));
25
+ async function j(o) {
26
+ const { page: a, fieldKey: n, value: t } = o, e = Array.isArray(t) ? t : [t], i = f.tagInput(n);
27
+ await a.locator(i).fill(e.join(","));
27
28
  }
28
- async function T(e) {
29
- const { page: a, fieldKey: n, value: t, onFillItem: o } = e, i = f.arrayTabContainer(n), w = f.arrayBasicContainer(n), u = await a.locator(i).count() > 0, b = await a.locator(w).count() > 0;
30
- if (u || b) {
31
- const d = f.arrayRemoveBtns(n), k = async () => {
32
- await a.locator(d).count() > 0 && (await a.locator(d).first().click(), await k());
29
+ async function M(o) {
30
+ const { page: a, fieldKey: n, value: t, onFillItem: e } = o, i = f.arrayTabContainer(n), w = f.arrayBasicContainer(n), d = await a.locator(i).count() > 0, g = await a.locator(w).count() > 0;
31
+ if (d || g) {
32
+ const k = f.arrayRemoveBtns(n), u = async () => {
33
+ await a.locator(k).count() > 0 && (await a.locator(k).first().click(), await u());
33
34
  };
34
- if (await k(), !Array.isArray(t))
35
+ if (await u(), !Array.isArray(t))
35
36
  return;
36
- for (let l = 0; l < t.length; l++) {
37
+ for (let r = 0; r < t.length; r++) {
37
38
  const c = f.arrayAddBtn(n);
38
- await a.locator(c).click(), await o(l, t[l]);
39
+ await a.locator(c).scrollIntoViewIfNeeded(), await a.locator(c).click({ force: !0 }), await e(r, t[r]);
39
40
  }
40
41
  }
41
42
  }
42
- async function x(e) {
43
- const { page: a, fieldKey: n, onFillChildren: t } = e, o = f.objectSwitch(n), i = await a.locator(o).count() > 0;
44
- if ((e.value === null || e.value === void 0) && i) {
45
- await a.locator(o).locator("..").locator('[data-testid="switch-control"]').click({ force: !0 });
43
+ async function x(o) {
44
+ const { page: a, fieldKey: n, onFillChildren: t } = o, e = f.objectSwitch(n), i = await a.locator(e).count() > 0;
45
+ if ((o.value === null || o.value === void 0) && i) {
46
+ await a.locator(e).locator("..").locator('[data-testid="switch-control"]').click({ force: !0 });
46
47
  return;
47
48
  }
48
- i && await a.locator(o).locator("..").locator('[data-testid="switch-control"]').click({ force: !0 }), await new Promise((w) => setTimeout(w, 300)), await t();
49
+ i && await a.locator(e).locator("..").locator('[data-testid="switch-control"]').click({ force: !0 }), await new Promise((w) => setTimeout(w, 300)), await t();
49
50
  }
50
- function R(e, a) {
51
- if (!e)
51
+ function N(o, a) {
52
+ if (!o)
52
53
  throw new Error(`Unable to find map entry test id for "${a}"`);
53
- const n = e.match(/kid:\d+/);
54
+ const n = o.match(/kid:\d+/);
54
55
  if (!n)
55
- throw new Error(`Unable to extract map entry kid id from test id "${e}"`);
56
+ throw new Error(`Unable to extract map entry kid id from test id "${o}"`);
56
57
  return n[0];
57
58
  }
58
- async function $(e) {
59
- const { page: a, fieldKey: n, value: t, onFillEntry: o } = e, i = async () => {
60
- const u = f.mapRemoveBtns(n);
61
- await a.locator(u).count() !== 0 && (await a.locator(u).first().click(), await i());
59
+ async function R(o) {
60
+ const { page: a, fieldKey: n, value: t, onFillEntry: e } = o, i = async () => {
61
+ const d = f.mapRemoveBtns(n);
62
+ await a.locator(d).count() !== 0 && (await a.locator(d).first().click(), await i());
62
63
  };
63
64
  if (await i(), typeof t != "object" || t == null)
64
65
  return;
65
66
  const w = Object.entries(t);
66
67
  if (w.length !== 0)
67
- for (let u = 0; u < w.length; u++) {
68
- const [b, d] = w[u];
68
+ for (let d = 0; d < w.length; d++) {
69
+ const [g, k] = w[d];
69
70
  await a.locator(f.mapAddBtn(n)).click();
70
- const k = f.mapContainer(n, u), l = a.locator(k);
71
- await l.waitFor();
72
- const c = a.locator(f.mapKey(n, u));
73
- await c.clear(), await c.fill(String(b));
74
- const s = l.locator(`[data-testid*="${n}.kid:"]`).first();
71
+ const u = f.mapContainer(n, d), r = a.locator(u);
72
+ await r.waitFor();
73
+ const c = a.locator(f.mapKey(n, d));
74
+ await c.clear(), await c.fill(String(g));
75
+ const s = r.locator(`[data-testid*="${n}.kid:"]`).first();
75
76
  await s.waitFor();
76
- const r = R(await s.getAttribute("data-testid"), n);
77
- await o(r, d);
77
+ const l = N(await s.getAttribute("data-testid"), n);
78
+ await e(l, k);
78
79
  }
79
80
  }
80
- async function N(e) {
81
- const { page: a, fieldKey: n, value: t } = e, o = f.json(n), i = a.locator(o).locator("textarea"), w = typeof t == "string" ? t : JSON.stringify(t, null, 2);
81
+ async function $(o) {
82
+ const { page: a, fieldKey: n, value: t } = o, e = f.json(n), i = a.locator(e).locator("textarea"), w = typeof t == "string" ? t : JSON.stringify(t, null, 2);
82
83
  await i.clear(), await i.fill(w);
83
84
  }
84
- async function J(e) {
85
- const { page: a, fieldKey: n, value: t } = e, o = f.field(n);
86
- await a.locator(o).click();
85
+ async function J(o) {
86
+ const { page: a, fieldKey: n, value: t } = o, e = f.field(n);
87
+ await a.locator(e).click();
87
88
  const i = typeof t == "object" && (t != null && t.id) ? t.id : t;
88
89
  i && await a.locator(`[data-testid="select-item-${i}"]`).click();
89
90
  }
90
91
  const H = {
91
- fillString: C,
92
- fillNumber: E,
93
- fillBoolean: I,
94
- fillEnum: j,
95
- fillTag: M,
96
- fillArray: T,
92
+ fillString: I,
93
+ fillNumber: C,
94
+ fillBoolean: E,
95
+ fillEnum: T,
96
+ fillTag: j,
97
+ fillArray: M,
97
98
  fillRecord: x,
98
- fillMap: $,
99
- fillJson: N,
99
+ fillMap: R,
100
+ fillJson: $,
100
101
  fillForeign: J
101
102
  };
102
- function U(e, a, n) {
103
- const t = F(a), o = { ...H, ...n };
104
- async function i(l, c, s = "") {
105
- for (const r of v(l, c, t, s))
106
- await w(r);
103
+ function U(o, a, n) {
104
+ const t = F(a), e = { ...H, ...n };
105
+ async function i(r, c, s = "") {
106
+ for (const l of v(r, c, t, s))
107
+ await w(l);
107
108
  }
108
- async function w({ handlerType: l, fieldKey: c, fieldSchema: s, value: r }, y) {
109
- switch (l) {
109
+ async function w({ handlerType: r, fieldKey: c, fieldSchema: s, value: l }, y) {
110
+ switch (r) {
110
111
  case "string":
111
- await o.fillString({ page: e, fieldKey: c, fieldSchema: s, value: r, typeOptions: y });
112
+ await e.fillString({ page: o, fieldKey: c, fieldSchema: s, value: l, typeOptions: y });
112
113
  break;
113
114
  case "number":
114
- await o.fillNumber({ page: e, fieldKey: c, fieldSchema: s, value: r, typeOptions: y });
115
+ await e.fillNumber({ page: o, fieldKey: c, fieldSchema: s, value: l, typeOptions: y });
115
116
  break;
116
117
  case "boolean":
117
- await o.fillBoolean({ page: e, fieldKey: c, fieldSchema: s, value: r, typeOptions: y });
118
+ await e.fillBoolean({ page: o, fieldKey: c, fieldSchema: s, value: l, typeOptions: y });
118
119
  break;
119
120
  case "enum":
120
- await o.fillEnum({ page: e, fieldKey: c, fieldSchema: s, value: r, typeOptions: y });
121
+ await e.fillEnum({ page: o, fieldKey: c, fieldSchema: s, value: l, typeOptions: y });
121
122
  break;
122
123
  case "tag":
123
- await o.fillTag({ page: e, fieldKey: c, fieldSchema: s, value: r, typeOptions: y });
124
+ await e.fillTag({ page: o, fieldKey: c, fieldSchema: s, value: l, typeOptions: y });
124
125
  break;
125
126
  case "map":
126
- await o.fillMap({
127
- page: e,
127
+ await e.fillMap({
128
+ page: o,
128
129
  fieldKey: c,
129
130
  fieldSchema: s,
130
- value: r,
131
- onFillEntry: async (m, g) => {
132
- await b(t, c, m, g);
131
+ value: l,
132
+ onFillEntry: async (m, b) => {
133
+ await g(t, c, m, b);
133
134
  }
134
135
  });
135
136
  break;
136
137
  case "json":
137
- await o.fillJson({ page: e, fieldKey: c, fieldSchema: s, value: r, typeOptions: y });
138
+ await e.fillJson({ page: o, fieldKey: c, fieldSchema: s, value: l, typeOptions: y });
138
139
  break;
139
140
  case "foreign":
140
- await o.fillForeign({ page: e, fieldKey: c, fieldSchema: s, value: r, typeOptions: y });
141
+ await e.fillForeign({ page: o, fieldKey: c, fieldSchema: s, value: l, typeOptions: y });
141
142
  break;
142
143
  case "array":
143
- await o.fillArray({
144
- page: e,
144
+ await e.fillArray({
145
+ page: o,
145
146
  fieldKey: c,
146
147
  fieldSchema: s,
147
- value: r,
148
- onFillItem: async (m, g) => {
149
- await u(t, c, m, g);
148
+ value: l,
149
+ onFillItem: async (m, b) => {
150
+ await d(t, c, m, b);
150
151
  }
151
152
  });
152
153
  break;
153
154
  case "record":
154
- await o.fillRecord({
155
- page: e,
155
+ await e.fillRecord({
156
+ page: o,
156
157
  fieldKey: c,
157
158
  fieldSchema: s,
158
- value: r,
159
+ value: l,
159
160
  onFillChildren: async () => {
160
- await i(s.fields, r, c);
161
+ await i(s.fields, l, c);
161
162
  }
162
163
  });
163
164
  break;
164
165
  }
165
166
  }
166
- async function u(l, c, s, r) {
167
- const { itemKey: y, itemSchema: m } = A(c, s, l);
168
- B(m) ? await i(m.fields, r, y) : await w({
167
+ async function d(r, c, s, l) {
168
+ const { itemKey: y, itemSchema: m } = A(c, s, r);
169
+ p(m) ? await i(m.fields, l, y) : await w({
169
170
  handlerType: h(m),
170
171
  fieldKey: y,
171
172
  fieldSchema: m,
172
- value: r
173
+ value: l
173
174
  });
174
175
  }
175
- async function b(l, c, s, r) {
176
- const { entryKey: y, entrySchema: m } = p(c, s, l);
176
+ async function g(r, c, s, l) {
177
+ const { entryKey: y, entrySchema: m } = B(c, s, r);
177
178
  await w({
178
179
  handlerType: h(m),
179
180
  fieldKey: y,
180
181
  fieldSchema: m,
181
- value: r
182
+ value: l
182
183
  });
183
184
  }
184
- async function d(l) {
185
- a.fields && Array.isArray(a.fields) && await i(a.fields, l);
185
+ async function k(r) {
186
+ a.fields && Array.isArray(a.fields) && await i(a.fields, r);
186
187
  }
187
- async function k(l, c, s) {
188
- const r = t.schemaMap[l];
189
- if (!r)
190
- throw new Error(`Field schema for "${l}" not found in schema map`);
188
+ async function u(r, c, s) {
189
+ const l = t.schemaMap[r];
190
+ if (!l)
191
+ throw new Error(`Field schema for "${r}" not found in schema map`);
191
192
  await w({
192
- handlerType: h(r),
193
- fieldKey: l,
194
- fieldSchema: r,
193
+ handlerType: h(l),
194
+ fieldKey: r,
195
+ fieldSchema: l,
195
196
  value: c
196
197
  }, s);
197
198
  }
198
199
  return {
199
- fill: d,
200
- fillField: k,
200
+ fill: k,
201
+ fillField: u,
201
202
  schemaMap: t.schemaMap,
202
- handlers: o
203
+ handlers: e
203
204
  };
204
205
  }
205
206
  export {
206
207
  U as createFiller,
207
- T as fillArray,
208
- I as fillBoolean,
209
- j as fillEnum,
208
+ M as fillArray,
209
+ E as fillBoolean,
210
+ T as fillEnum,
210
211
  J as fillForeign,
211
- N as fillJson,
212
- $ as fillMap,
213
- E as fillNumber,
212
+ $ as fillJson,
213
+ R as fillMap,
214
+ C as fillNumber,
214
215
  x as fillRecord,
215
- C as fillString,
216
- M as fillTag,
216
+ I as fillString,
217
+ j as fillTag,
217
218
  H as handlers
218
219
  };