@kong-ui-public/freeform 0.14.4 → 0.14.5-pr.4118.e25eb830e.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 +1 -0
- package/dist/filler/cypress/index.js +126 -120
- package/dist/filler/{field-walker-C92sISTY.js → field-walker-BoN8CVDN.js} +1 -0
- package/dist/filler/packages/core/freeform/src/composables/errors.d.ts +1 -0
- package/dist/filler/packages/core/freeform/src/composables/errors.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/field.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/form-context.d.ts +9 -0
- package/dist/filler/packages/core/freeform/src/composables/form-context.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/index.d.ts +2 -0
- package/dist/filler/packages/core/freeform/src/composables/index.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/reveal-adapter.d.ts +63 -0
- package/dist/filler/packages/core/freeform/src/composables/reveal-adapter.d.ts.map +1 -0
- package/dist/filler/packages/core/freeform/src/composables/reveal-tree.d.ts +53 -0
- package/dist/filler/packages/core/freeform/src/composables/reveal-tree.d.ts.map +1 -0
- package/dist/filler/packages/core/freeform/src/composables/reveal.d.ts +24 -1
- package/dist/filler/packages/core/freeform/src/composables/reveal.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/useI18n.d.ts +4 -0
- package/dist/filler/packages/core/freeform/src/composables/useI18n.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/cypress/handlers/map.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/playwright/handlers/map.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/filler/shared/selectors.d.ts +1 -0
- package/dist/filler/packages/core/freeform/src/filler/shared/selectors.d.ts.map +1 -1
- package/dist/filler/playwright/index.js +116 -111
- package/dist/freeform.es.js +2518 -2196
- package/dist/freeform.umd.js +6 -6
- package/dist/style.css +1 -1
- package/dist/types/components/Form.vue.d.ts +11 -0
- package/dist/types/components/Form.vue.d.ts.map +1 -1
- package/dist/types/components/MapField.vue.d.ts.map +1 -1
- package/dist/types/components/ObjectField.vue.d.ts.map +1 -1
- package/dist/types/components/free-form-mocking.d.ts.map +1 -1
- package/dist/types/composables/errors.d.ts +1 -0
- package/dist/types/composables/errors.d.ts.map +1 -1
- package/dist/types/composables/field.d.ts.map +1 -1
- package/dist/types/composables/form-context.d.ts +9 -0
- package/dist/types/composables/form-context.d.ts.map +1 -1
- package/dist/types/composables/index.d.ts +2 -0
- package/dist/types/composables/index.d.ts.map +1 -1
- package/dist/types/composables/reveal-adapter.d.ts +63 -0
- package/dist/types/composables/reveal-adapter.d.ts.map +1 -0
- package/dist/types/composables/reveal-tree.d.ts +53 -0
- package/dist/types/composables/reveal-tree.d.ts.map +1 -0
- package/dist/types/composables/reveal.d.ts +24 -1
- package/dist/types/composables/reveal.d.ts.map +1 -1
- package/dist/types/composables/useI18n.d.ts +4 -0
- package/dist/types/composables/useI18n.d.ts.map +1 -1
- package/dist/types/reveal-adapters.d.ts +2 -0
- package/dist/types/reveal-adapters.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ function handleSubmit() {
|
|
|
66
66
|
- [CEL Input](docs/cel-input.md): `CelInput` and `CelField`
|
|
67
67
|
- [Custom Fields](docs/custom-fields.md): `FieldRenderer` and custom field components
|
|
68
68
|
- [Field Navigation](docs/field-navigation.md): `reveal(path)`
|
|
69
|
+
- [Closed Containers](docs/closed-containers.md): `defineRevealAdapter`, for fields in tabs, `v-if` sections and opaque components
|
|
69
70
|
- [Field Errors](docs/field-errors.md): `errors` and `unmatchedErrors`
|
|
70
71
|
- [Filler](docs/filler.md): test utilities for Cypress and Playwright, adding a new field type
|
|
71
72
|
- [Reference](docs/reference.md): injection keys, `data-testid` conventions
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { s as l, i as
|
|
1
|
+
import { s as l, i as A, c as E, g as k, E as x, w as I, a as C, b as B, d as F } from "../field-walker-BoN8CVDN.js";
|
|
2
2
|
import "lodash-es";
|
|
3
|
-
const
|
|
4
|
-
function
|
|
3
|
+
const a = { scrollBehavior: "center" };
|
|
4
|
+
function h(r) {
|
|
5
5
|
cy.get(r).then((n) => {
|
|
6
6
|
n[0]?.scrollIntoView({ block: "center", inline: "nearest" });
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
9
|
function w(r) {
|
|
10
10
|
const { fieldKey: n, value: e } = r, t = l.field(n);
|
|
11
|
-
|
|
12
|
-
cy.wrap(c).clear(
|
|
11
|
+
h(t), cy.get(t).then((c) => {
|
|
12
|
+
cy.wrap(c).clear(a), cy.wrap(c).trigger("change"), e != null && e !== "" && cy.wrap(c).type(String(e), { ...a, parseSpecialCharSequences: !1 }), cy.wrap(c).blur();
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function M(r) {
|
|
16
16
|
const { fieldKey: n, value: e } = r, t = l.field(n);
|
|
17
|
-
|
|
18
|
-
cy.wrap(c).clear(
|
|
17
|
+
h(t), cy.get(t).then((c) => {
|
|
18
|
+
cy.wrap(c).clear(a), e != null && cy.wrap(c).type(String(e), a);
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
function R(r) {
|
|
22
22
|
const { fieldKey: n, value: e } = r, t = l.field(n);
|
|
23
|
-
|
|
23
|
+
h(t), e === !0 ? cy.get(t).check(a) : e === !1 && cy.get(t).uncheck(a);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const { fieldKey: n, fieldSchema: e, value: t } = r, c =
|
|
27
|
-
|
|
28
|
-
const
|
|
25
|
+
function T(r) {
|
|
26
|
+
const { fieldKey: n, fieldSchema: e, value: t } = r, c = A(e), y = c ? Array.isArray(t) ? t : [t] : [t], u = l.field(n);
|
|
27
|
+
h(u), cy.get(u).click(a);
|
|
28
|
+
const b = l.selectTrigger(n);
|
|
29
29
|
for (const p of e.one_of ?? e.elements?.one_of ?? [])
|
|
30
30
|
if (p != null) {
|
|
31
31
|
const m = c ? l.multiSelectItem(String(p)) : l.selectItem(String(p));
|
|
32
|
-
c && cy.get(
|
|
33
|
-
|
|
34
|
-
}),
|
|
32
|
+
c && cy.get(b).find(m).within((s) => {
|
|
33
|
+
s.find("button.selected").length > 0 && cy.get("button").click(a);
|
|
34
|
+
}), y.includes(p) && cy.get(b).find(m).click(a);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function j(r) {
|
|
38
38
|
const { fieldKey: n, value: e } = r, t = Array.isArray(e) ? e : [e], c = l.tagInput(n);
|
|
39
|
-
|
|
39
|
+
h(c), cy.get(c).type(t.join(","), a);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const { fieldKey: n, value: e, onFillItem: t } = r, c = l.arrayTabContainer(n),
|
|
43
|
-
cy.get("body").then((
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const m = l.arrayRemoveBtns(n),
|
|
41
|
+
function N(r) {
|
|
42
|
+
const { fieldKey: n, value: e, onFillItem: t } = r, c = l.arrayTabContainer(n), y = l.arrayBasicContainer(n);
|
|
43
|
+
cy.get("body").then((u) => {
|
|
44
|
+
const b = u.find(c).length > 0, p = u.find(y).length > 0;
|
|
45
|
+
if (b || p) {
|
|
46
|
+
const m = l.arrayRemoveBtns(n), s = () => {
|
|
47
47
|
cy.get("body").then((i) => {
|
|
48
48
|
const o = i.find(m).first();
|
|
49
|
-
o.length > 0 && (cy.wrap(o).click(
|
|
49
|
+
o.length > 0 && (cy.wrap(o).click(a), s());
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
if (
|
|
52
|
+
if (s(), !Array.isArray(e))
|
|
53
53
|
return;
|
|
54
54
|
for (let i = 0; i < e.length; i++) {
|
|
55
55
|
const o = l.arrayAddBtn(n);
|
|
56
|
-
|
|
56
|
+
h(o), cy.get(o).click(a), cy.get(l.arrayItem(n, i)).should("exist"), t(i, e[i]);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function _(r) {
|
|
62
62
|
const { fieldKey: n, value: e, onFillChildren: t } = r, c = l.objectSwitch(n);
|
|
63
|
-
cy.get("body").then((
|
|
64
|
-
const
|
|
65
|
-
if (e == null &&
|
|
63
|
+
cy.get("body").then((y) => {
|
|
64
|
+
const u = y.find(c).length > 0;
|
|
65
|
+
if (e == null && u) {
|
|
66
66
|
cy.get(c).uncheck({ force: !0 });
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
u && (cy.get(c).check({ force: !0 }), cy.get(l.objectContent(n)).should("not.have.class", "ff-slide-active")), t();
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
function O(r, n) {
|
|
@@ -77,123 +77,129 @@ function O(r, n) {
|
|
|
77
77
|
throw new Error(`Unable to extract map entry kid id from test id "${r}"`);
|
|
78
78
|
return e[0];
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
const { fieldKey: n,
|
|
82
|
-
cy.get("body").then((
|
|
83
|
-
const
|
|
84
|
-
|
|
80
|
+
function K(r) {
|
|
81
|
+
const { fieldKey: n, fieldSchema: e, value: t, onFillEntry: c } = r, y = e.keys, u = y?.type === "string" && !!y.one_of?.length, b = l.mapRemoveBtns(n), p = () => {
|
|
82
|
+
cy.get("body").then((s) => {
|
|
83
|
+
const i = s.find(b).first();
|
|
84
|
+
i.length > 0 && (cy.wrap(i).click(a), p());
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
|
-
if (
|
|
87
|
+
if (p(), typeof t != "object" || t == null)
|
|
88
88
|
return;
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
for (let
|
|
92
|
-
const [
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
const m = Object.entries(t);
|
|
90
|
+
if (m.length !== 0)
|
|
91
|
+
for (let s = 0; s < m.length; s++) {
|
|
92
|
+
const [i, o] = m[s], f = l.mapAddBtn(n);
|
|
93
|
+
h(f), cy.get(f).click(a);
|
|
94
|
+
const d = l.mapKey(n, s);
|
|
95
|
+
if (h(d), u) {
|
|
96
|
+
if (y?.type !== "string" || !y.one_of?.includes(String(i)))
|
|
97
|
+
throw new Error(`Map key "${String(i)}" is not an option of "${n}"`);
|
|
98
|
+
cy.get(d).click(a), cy.get(l.mapKeyItems(n, s)).find(l.selectItem(String(i))).click(a);
|
|
99
|
+
} else
|
|
100
|
+
cy.get(d).clear(a), cy.get(d).type(String(i), a);
|
|
101
|
+
cy.get(l.mapContainer(n, s)).find(`[data-testid*="${n}.kid:"]`).first().invoke("attr", "data-testid").then((g) => {
|
|
102
|
+
const v = O(g, n);
|
|
103
|
+
c(v, o);
|
|
98
104
|
});
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
function H(r) {
|
|
102
108
|
const { fieldKey: n, value: e } = r, t = l.json(n), c = typeof e == "string" ? e : JSON.stringify(e, null, 2);
|
|
103
|
-
|
|
104
|
-
cy.wrap(
|
|
109
|
+
h(t), cy.get(t).then((y) => {
|
|
110
|
+
cy.wrap(y.find("textarea")).clear(a), cy.wrap(y.find("textarea")).type(c, a);
|
|
105
111
|
});
|
|
106
112
|
}
|
|
107
113
|
function J(r) {
|
|
108
114
|
const { fieldKey: n, value: e } = r, t = l.field(n), c = typeof e == "object" && e?.id ? e.id : e;
|
|
109
|
-
|
|
110
|
-
cy.wrap(
|
|
115
|
+
h(t), cy.get(t).then((y) => {
|
|
116
|
+
cy.wrap(y).clear(a), c && cy.wrap(y).type(String(c), a);
|
|
111
117
|
});
|
|
112
118
|
}
|
|
113
119
|
function P(r) {
|
|
114
120
|
const { fieldKey: n } = r, e = l.expression(n);
|
|
115
|
-
|
|
116
|
-
t.find('[data-testid^="ff-expression-add-"]').length && cy.get(l.expressionAddBtn(n)).click(
|
|
121
|
+
h(e), cy.get(e).then((t) => {
|
|
122
|
+
t.find('[data-testid^="ff-expression-add-"]').length && cy.get(l.expressionAddBtn(n)).click(a);
|
|
117
123
|
}), cy.get(l.field(n)).then((t) => {
|
|
118
124
|
t.hasClass("cel-input") ? S(r) : w(r);
|
|
119
125
|
});
|
|
120
126
|
}
|
|
121
127
|
function S(r) {
|
|
122
128
|
const { fieldKey: n, value: e } = r, t = l.field(n), c = `${t} .monaco-editor textarea`;
|
|
123
|
-
|
|
124
|
-
cy.get(c).type(
|
|
125
|
-
}), cy.get(c).type("{backspace}",
|
|
129
|
+
h(t), cy.get(c, { timeout: 2e4 }).should("be.visible"), cy.get(c).focus(), cy.window().then((y) => {
|
|
130
|
+
cy.get(c).type(y.navigator.userAgent.includes("Macintosh") ? "{meta}a" : "{ctrl}a", a);
|
|
131
|
+
}), cy.get(c).type("{backspace}", a), e != null && e !== "" && (cy.get(c).invoke("val", String(e)), cy.get(c).trigger("input", { inputType: "insertFromPaste", force: !0 })), cy.get(c).type("{esc}", a), cy.get(c).blur();
|
|
126
132
|
}
|
|
127
|
-
const
|
|
133
|
+
const L = {
|
|
128
134
|
fillString: w,
|
|
129
|
-
fillNumber:
|
|
135
|
+
fillNumber: M,
|
|
130
136
|
fillBoolean: R,
|
|
131
|
-
fillEnum:
|
|
132
|
-
fillTag:
|
|
133
|
-
fillArray:
|
|
134
|
-
fillRecord:
|
|
135
|
-
fillMap:
|
|
137
|
+
fillEnum: T,
|
|
138
|
+
fillTag: j,
|
|
139
|
+
fillArray: N,
|
|
140
|
+
fillRecord: _,
|
|
141
|
+
fillMap: K,
|
|
136
142
|
fillJson: H,
|
|
137
143
|
fillForeign: J,
|
|
138
144
|
fillExpression: P,
|
|
139
145
|
fillCel: S
|
|
140
146
|
};
|
|
141
|
-
function
|
|
142
|
-
const e =
|
|
143
|
-
function c(
|
|
144
|
-
for (const
|
|
145
|
-
f
|
|
147
|
+
function $(r, n) {
|
|
148
|
+
const e = E(r), t = { ...L, ...n };
|
|
149
|
+
function c(s, i, o = "") {
|
|
150
|
+
for (const f of I(s, i, e, o))
|
|
151
|
+
y(f);
|
|
146
152
|
}
|
|
147
|
-
function
|
|
148
|
-
switch (
|
|
153
|
+
function y({ handlerType: s, fieldKey: i, fieldSchema: o, value: f }) {
|
|
154
|
+
switch (s) {
|
|
149
155
|
case "string":
|
|
150
|
-
cy.get(l.field(i)).then((
|
|
151
|
-
(
|
|
156
|
+
cy.get(l.field(i)).then((d) => {
|
|
157
|
+
(d.hasClass("cel-input") ? t.fillCel : t.fillString)({ fieldKey: i, fieldSchema: o, value: f });
|
|
152
158
|
});
|
|
153
159
|
break;
|
|
154
160
|
case "number":
|
|
155
|
-
t.fillNumber({ fieldKey: i, fieldSchema: o, value:
|
|
161
|
+
t.fillNumber({ fieldKey: i, fieldSchema: o, value: f });
|
|
156
162
|
break;
|
|
157
163
|
case "boolean":
|
|
158
|
-
t.fillBoolean({ fieldKey: i, fieldSchema: o, value:
|
|
164
|
+
t.fillBoolean({ fieldKey: i, fieldSchema: o, value: f });
|
|
159
165
|
break;
|
|
160
166
|
case "enum":
|
|
161
|
-
t.fillEnum({ fieldKey: i, fieldSchema: o, value:
|
|
167
|
+
t.fillEnum({ fieldKey: i, fieldSchema: o, value: f });
|
|
162
168
|
break;
|
|
163
169
|
case "tag":
|
|
164
|
-
t.fillTag({ fieldKey: i, fieldSchema: o, value:
|
|
170
|
+
t.fillTag({ fieldKey: i, fieldSchema: o, value: f });
|
|
165
171
|
break;
|
|
166
172
|
case "map":
|
|
167
173
|
t.fillMap({
|
|
168
174
|
fieldKey: i,
|
|
169
175
|
fieldSchema: o,
|
|
170
|
-
value:
|
|
171
|
-
onFillEntry: (
|
|
172
|
-
|
|
176
|
+
value: f,
|
|
177
|
+
onFillEntry: (d, g) => {
|
|
178
|
+
b(e, i, d, g);
|
|
173
179
|
}
|
|
174
180
|
});
|
|
175
181
|
break;
|
|
176
182
|
case "json":
|
|
177
|
-
t.fillJson({ fieldKey: i, fieldSchema: o, value:
|
|
183
|
+
t.fillJson({ fieldKey: i, fieldSchema: o, value: f });
|
|
178
184
|
break;
|
|
179
185
|
case "foreign":
|
|
180
|
-
t.fillForeign({ fieldKey: i, fieldSchema: o, value:
|
|
186
|
+
t.fillForeign({ fieldKey: i, fieldSchema: o, value: f });
|
|
181
187
|
break;
|
|
182
188
|
case "expression":
|
|
183
|
-
t.fillExpression({ fieldKey: i, fieldSchema: o, value:
|
|
189
|
+
t.fillExpression({ fieldKey: i, fieldSchema: o, value: f });
|
|
184
190
|
break;
|
|
185
191
|
case "expressionArray":
|
|
186
|
-
Array.isArray(
|
|
187
|
-
|
|
192
|
+
Array.isArray(f) && f.forEach((d, g) => {
|
|
193
|
+
d == null || d === x || u(e, i, g, d);
|
|
188
194
|
});
|
|
189
195
|
break;
|
|
190
196
|
case "array":
|
|
191
197
|
t.fillArray({
|
|
192
198
|
fieldKey: i,
|
|
193
199
|
fieldSchema: o,
|
|
194
|
-
value:
|
|
195
|
-
onFillItem: (
|
|
196
|
-
|
|
200
|
+
value: f,
|
|
201
|
+
onFillItem: (d, g) => {
|
|
202
|
+
u(e, i, d, g);
|
|
197
203
|
}
|
|
198
204
|
});
|
|
199
205
|
break;
|
|
@@ -201,42 +207,42 @@ function Y(r, n) {
|
|
|
201
207
|
t.fillRecord({
|
|
202
208
|
fieldKey: i,
|
|
203
209
|
fieldSchema: o,
|
|
204
|
-
value:
|
|
210
|
+
value: f,
|
|
205
211
|
onFillChildren: () => {
|
|
206
|
-
c(o.fields,
|
|
212
|
+
c(o.fields, f, i);
|
|
207
213
|
}
|
|
208
214
|
});
|
|
209
215
|
break;
|
|
210
216
|
}
|
|
211
217
|
}
|
|
212
|
-
function
|
|
213
|
-
const { itemKey:
|
|
214
|
-
B(
|
|
215
|
-
handlerType: k(
|
|
216
|
-
fieldKey:
|
|
217
|
-
fieldSchema:
|
|
218
|
-
value:
|
|
218
|
+
function u(s, i, o, f) {
|
|
219
|
+
const { itemKey: d, itemSchema: g } = C(i, o, s);
|
|
220
|
+
B(g) ? c(g.fields, f, d) : y({
|
|
221
|
+
handlerType: k(g),
|
|
222
|
+
fieldKey: d,
|
|
223
|
+
fieldSchema: g,
|
|
224
|
+
value: f
|
|
219
225
|
});
|
|
220
226
|
}
|
|
221
|
-
function
|
|
222
|
-
const { entryKey:
|
|
223
|
-
|
|
224
|
-
handlerType: k(
|
|
225
|
-
fieldKey:
|
|
226
|
-
fieldSchema:
|
|
227
|
-
value:
|
|
227
|
+
function b(s, i, o, f) {
|
|
228
|
+
const { entryKey: d, entrySchema: g } = F(i, o, s);
|
|
229
|
+
y({
|
|
230
|
+
handlerType: k(g),
|
|
231
|
+
fieldKey: d,
|
|
232
|
+
fieldSchema: g,
|
|
233
|
+
value: f
|
|
228
234
|
});
|
|
229
235
|
}
|
|
230
|
-
function p(
|
|
231
|
-
r.fields && Array.isArray(r.fields) && c(r.fields,
|
|
236
|
+
function p(s) {
|
|
237
|
+
r.fields && Array.isArray(r.fields) && c(r.fields, s);
|
|
232
238
|
}
|
|
233
|
-
function m(
|
|
234
|
-
const o = e.schemaMap[
|
|
239
|
+
function m(s, i) {
|
|
240
|
+
const o = e.schemaMap[s];
|
|
235
241
|
if (!o)
|
|
236
|
-
throw new Error(`Field schema for "${
|
|
237
|
-
|
|
242
|
+
throw new Error(`Field schema for "${s}" not found in schema map`);
|
|
243
|
+
y({
|
|
238
244
|
handlerType: k(o),
|
|
239
|
-
fieldKey:
|
|
245
|
+
fieldKey: s,
|
|
240
246
|
fieldSchema: o,
|
|
241
247
|
value: i
|
|
242
248
|
});
|
|
@@ -249,20 +255,20 @@ function Y(r, n) {
|
|
|
249
255
|
};
|
|
250
256
|
}
|
|
251
257
|
export {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
258
|
+
a as SCROLL_BEHAVIOR,
|
|
259
|
+
$ as createFiller,
|
|
260
|
+
N as fillArray,
|
|
255
261
|
R as fillBoolean,
|
|
256
262
|
S as fillCel,
|
|
257
|
-
|
|
263
|
+
T as fillEnum,
|
|
258
264
|
P as fillExpression,
|
|
259
265
|
J as fillForeign,
|
|
260
266
|
H as fillJson,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
267
|
+
K as fillMap,
|
|
268
|
+
M as fillNumber,
|
|
269
|
+
_ as fillRecord,
|
|
264
270
|
w as fillString,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
j as fillTag,
|
|
272
|
+
L as handlers,
|
|
273
|
+
h as scrollIntoViewNative
|
|
268
274
|
};
|
|
@@ -25,6 +25,7 @@ const Wc = {
|
|
|
25
25
|
map: (e) => `[data-testid="ff-map-${e}"]`,
|
|
26
26
|
mapContainer: (e, t) => `[data-testid="ff-map-container-${e}.${t}"]`,
|
|
27
27
|
mapKey: (e, t) => `[data-testid="ff-map-key-${e}.${t}"]`,
|
|
28
|
+
mapKeyItems: (e, t) => `[data-testid="ff-map-key-${e}.${t}-items"]`,
|
|
28
29
|
mapRemoveBtns: (e) => `[data-testid^="ff-map-remove-btn-${e}"]`,
|
|
29
30
|
mapRemoveBtn: (e, t) => `[data-testid="ff-map-remove-btn-${e}.${t}"]`,
|
|
30
31
|
mapAddBtn: (e) => `[data-testid="ff-map-add-btn-${e}"]`,
|
|
@@ -33,6 +33,7 @@ export declare function createFieldErrors(options: {
|
|
|
33
33
|
onChange?: (errors: FieldError[]) => void;
|
|
34
34
|
}): {
|
|
35
35
|
getFieldErrors: (fieldPath: string, deep?: boolean) => FieldError[];
|
|
36
|
+
getErrorsWhere: (predicate: (fieldPath: string) => boolean) => FieldError[];
|
|
36
37
|
unmatchedErrors: import("vue").ComputedRef<FieldError[]>;
|
|
37
38
|
onArrayItemRemoved: (arrayFieldPath: string, index: number) => void;
|
|
38
39
|
onMapKeyRenamed: (mapFieldPath: string, from: string, to: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/errors.ts"],"names":[],"mappings":"AAMA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C,EAC9B,OAAO,GAAE;IACP;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;CAC5C;;;;;;;
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/field.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAE3C,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC;;EAW5D;AAED,wBAAgB,QAAQ,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EAC3F,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAC9B,OAAO,GAAE;IACP;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;CAC5C;;;;;;;IA6FJ;;OAEG;;;;;;;;;;;;;;;IAFH;;OAEG;;;;;;;;;;EAWN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC;mBAQ/C,CAAC,SAAS,MAAM,KAAG,MAAM;EAmChD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,gBAAgB,CAAC,UAAU,CAAC,EACpC,UAAU,EAAE,MAAM,QAenB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import type { EmptyValue, FieldError, FormConfig, MatchMap, RenderRules } from '../types';
|
|
3
3
|
import type { FormSchema, UnionFieldSchema } from '../form-schema';
|
|
4
|
+
import type { RevealContainerQuery, RevealNode } from './reveal-tree';
|
|
4
5
|
export declare const provideFormShared: (options: {
|
|
5
6
|
schema: FormSchema | UnionFieldSchema;
|
|
6
7
|
propsData?: ComputedRef<Record<string, any>> | undefined;
|
|
@@ -33,7 +34,11 @@ export declare const provideFormShared: (options: {
|
|
|
33
34
|
getEmptyOrDefault: <T = unknown>(path?: string) => EmptyValue | T;
|
|
34
35
|
revealTarget: import("vue").ShallowRef<string | null, string | null>;
|
|
35
36
|
registerFieldElement: (entry: import("./reveal").FieldElementEntry) => () => void;
|
|
37
|
+
rememberField: (memory: import("./reveal").FieldMemory) => void;
|
|
38
|
+
findAnchor: (fieldPath: string, element: Element | null) => string | null;
|
|
36
39
|
findCoveringElement: (fieldPath: string) => Element | null;
|
|
40
|
+
revealTree: ComputedRef<RevealNode[]>;
|
|
41
|
+
getContainerErrors: (query: RevealContainerQuery) => FieldError[];
|
|
37
42
|
/**
|
|
38
43
|
* Reveals the field at a data path, see `createFieldReveal`
|
|
39
44
|
*/
|
|
@@ -93,7 +98,11 @@ export declare const provideFormShared: (options: {
|
|
|
93
98
|
getEmptyOrDefault: <T = unknown>(path?: string) => EmptyValue | T;
|
|
94
99
|
revealTarget: import("vue").ShallowRef<string | null, string | null>;
|
|
95
100
|
registerFieldElement: (entry: import("./reveal").FieldElementEntry) => () => void;
|
|
101
|
+
rememberField: (memory: import("./reveal").FieldMemory) => void;
|
|
102
|
+
findAnchor: (fieldPath: string, element: Element | null) => string | null;
|
|
96
103
|
findCoveringElement: (fieldPath: string) => Element | null;
|
|
104
|
+
revealTree: ComputedRef<RevealNode[]>;
|
|
105
|
+
getContainerErrors: (query: RevealContainerQuery) => FieldError[];
|
|
97
106
|
/**
|
|
98
107
|
* Reveals the field at a data path, see `createFieldReveal`
|
|
99
108
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-context.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/form-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-context.d.ts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W,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAA;IAC/B,QAAQ,EAAE,MAAM,CAAC,CAAA;CAClB,CACF"}
|
|
@@ -8,7 +8,9 @@ export * from './form-context';
|
|
|
8
8
|
export * from './labels';
|
|
9
9
|
export type { RevealOptions, RevealResult } from './reveal';
|
|
10
10
|
export { DEFAULT_REVEAL_DURATION, DEFAULT_REVEAL_HIGHLIGHT_DURATION } from './reveal';
|
|
11
|
+
export * from './reveal-adapter';
|
|
11
12
|
export * from './reveal-open';
|
|
13
|
+
export * from './reveal-tree';
|
|
12
14
|
export * from './schema';
|
|
13
15
|
export * from './useMapField';
|
|
14
16
|
export { renderRuleExactMatch } from './render-rules';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAA;AACrF,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAA;AACrF,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
2
|
+
import type { RenderRules } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* A field a part of the form covers: the field at `path` and everything below
|
|
5
|
+
* it, except the children named in `exclude` (e.g. `ObjectField`'s `omit`)
|
|
6
|
+
*/
|
|
7
|
+
export interface FieldCover {
|
|
8
|
+
path: string;
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* The render rules the field applies to its children (e.g. `ObjectField`'s
|
|
12
|
+
* `renderRules`). A field registers them only as it mounts, so the form reads
|
|
13
|
+
* them here to know which children they hide before then.
|
|
14
|
+
*/
|
|
15
|
+
renderRules?: RenderRules;
|
|
16
|
+
}
|
|
17
|
+
export interface RevealAdapterContext<P = Record<string, any>> {
|
|
18
|
+
/** The component's vnode, as the form's content renders it now */
|
|
19
|
+
vnode: VNode;
|
|
20
|
+
props: P;
|
|
21
|
+
/** The slot that holds the field being revealed */
|
|
22
|
+
slotName: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Tells the form what a component does with fields, so a reveal can find the
|
|
26
|
+
* fields its content holds without the content being mounted (e.g. an inactive
|
|
27
|
+
* tab), and open it.
|
|
28
|
+
*/
|
|
29
|
+
export interface RevealAdapter<P = Record<string, any>> {
|
|
30
|
+
/**
|
|
31
|
+
* For a field component: the field it renders, named as its `name` prop is.
|
|
32
|
+
* The fields in its default slot are relative to it.
|
|
33
|
+
*/
|
|
34
|
+
field?: (props: P) => FieldCover | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* For a component that renders fields in its own template, which the form
|
|
37
|
+
* can't see until it mounts: those fields, named as a `name` prop would be.
|
|
38
|
+
*/
|
|
39
|
+
fields?: (props: P) => Array<string | FieldCover>;
|
|
40
|
+
/**
|
|
41
|
+
* For a container: the slots whose content shows only while it opens them,
|
|
42
|
+
* e.g. a tab's panel. Its other slots always show.
|
|
43
|
+
*/
|
|
44
|
+
contentSlots?: (slotName: string) => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Opens a content slot. Only view state should change, e.g. by calling the
|
|
47
|
+
* vnode's `onUpdate:modelValue`.
|
|
48
|
+
*/
|
|
49
|
+
open?: (context: RevealAdapterContext<P>) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Tells the form what a component does with fields (see `RevealAdapter`).
|
|
53
|
+
* Register it once per component, e.g. next to where the component is defined.
|
|
54
|
+
*/
|
|
55
|
+
export declare function defineRevealAdapter<P = Record<string, any>>(component: object, adapter: RevealAdapter<P>): void;
|
|
56
|
+
export declare function getRevealAdapter(component: unknown): RevealAdapter | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Asks the parent of a vnode to set its `v-model`, as the component would
|
|
59
|
+
* when the user changes it. Warns when the parent binds no `v-model`, so
|
|
60
|
+
* there is no state to set.
|
|
61
|
+
*/
|
|
62
|
+
export declare function updateModelValue(vnode: VNode, value: unknown): void;
|
|
63
|
+
//# sourceMappingURL=reveal-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal-adapter.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/reveal-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MA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AK,EAAE,OAAO,QAS5D"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Component, VNode, VNodeChild } from 'vue';
|
|
2
|
+
import type { FieldCover } from './reveal-adapter';
|
|
3
|
+
/** A field the form's content renders, mounted or not */
|
|
4
|
+
export interface RevealFieldNode {
|
|
5
|
+
kind: 'field';
|
|
6
|
+
cover: FieldCover;
|
|
7
|
+
}
|
|
8
|
+
/** A slot of a container that shows its content only while opened, e.g. a tab's panel */
|
|
9
|
+
export interface RevealContainerNode {
|
|
10
|
+
kind: 'container';
|
|
11
|
+
component: Component;
|
|
12
|
+
/** The vnode's `key`, to tell containers of the same component apart */
|
|
13
|
+
key: VNode['key'];
|
|
14
|
+
slotName: string;
|
|
15
|
+
open: () => void;
|
|
16
|
+
children: RevealNode[];
|
|
17
|
+
}
|
|
18
|
+
export type RevealNode = RevealFieldNode | RevealContainerNode;
|
|
19
|
+
/**
|
|
20
|
+
* Finds the fields that vnodes render and the containers they sit in, without
|
|
21
|
+
* mounting them. It renders the slots of components to read them, so the
|
|
22
|
+
* content of a closed container (e.g. an inactive tab) is found too. A
|
|
23
|
+
* component's own template is not rendered: what it renders is up to its
|
|
24
|
+
* `RevealAdapter`.
|
|
25
|
+
*
|
|
26
|
+
* @param base The field path the vnodes' field names are relative to
|
|
27
|
+
*/
|
|
28
|
+
export declare function scanRevealTree(vnodes: VNodeChild, base?: string): RevealNode[];
|
|
29
|
+
/**
|
|
30
|
+
* Whether a cover stands for the field at `fieldPath`: its own path, or a path
|
|
31
|
+
* below it that is not in a child it leaves out
|
|
32
|
+
*/
|
|
33
|
+
export declare function coversFieldPath(cover: FieldCover, fieldPath: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The cover that most closely stands for `fieldPath`: the deepest one that
|
|
36
|
+
* covers it (see `coversFieldPath`). At the same depth, the first one wins.
|
|
37
|
+
*/
|
|
38
|
+
export declare function findDeepest<T extends FieldCover>(covers: Iterable<T>, fieldPath: string): T | null;
|
|
39
|
+
/** A field of the reveal tree */
|
|
40
|
+
export interface RevealTreeField extends FieldCover {
|
|
41
|
+
/** The containers it sits in, outermost first: those to open to show it */
|
|
42
|
+
containers: RevealContainerNode[];
|
|
43
|
+
}
|
|
44
|
+
/** Every field of the tree, with the containers it sits in */
|
|
45
|
+
export declare function flattenRevealTree(nodes: RevealNode[], containers?: RevealContainerNode[]): RevealTreeField[];
|
|
46
|
+
/** Picks the containers of a tree, e.g. to count the errors in a tab */
|
|
47
|
+
export interface RevealContainerQuery {
|
|
48
|
+
component: Component;
|
|
49
|
+
slotName?: string;
|
|
50
|
+
key?: VNode['key'];
|
|
51
|
+
}
|
|
52
|
+
export declare function matchesContainer(node: RevealContainerNode, query: RevealContainerQuery): boolean;
|
|
53
|
+
//# sourceMappingURL=reveal-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal-tree.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/reveal-tree.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,yFAAyF;AACzF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,SAAS,CAAA;IACpB,wEAAwE;IACxE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,QAAQ,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,mBAAmB,CAAA;AAgG9D;;;;;;;;GAQG;AACH,wBAAgB,cAAc,C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