bhl-forms 0.0.1 → 0.0.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.
- package/dist/bhl-forms.es.js +747 -340
- package/dist/bhl-forms.iife.js +2 -2
- package/dist/bhl-forms.umd.js +2 -2
- package/dist/forms/childAndFamily.es.js +570 -0
- package/dist/forms/childAndFamily.iife.js +575 -0
- package/dist/forms/childAndFamily.json +1 -0
- package/dist/forms/testForm.es.js +200 -72
- package/dist/forms/testForm.iife.js +342 -0
- package/dist/forms/testForm.json +1 -0
- package/dist/style.css +1 -1
- package/package.json +8 -5
- package/dist/forms/testForm.js +0 -214
package/dist/bhl-forms.es.js
CHANGED
|
@@ -5,18 +5,18 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (
|
|
9
|
-
for (var prop in
|
|
10
|
-
if (__hasOwnProp.call(
|
|
11
|
-
__defNormalProp(
|
|
8
|
+
var __spreadValues = (a2, b2) => {
|
|
9
|
+
for (var prop in b2 || (b2 = {}))
|
|
10
|
+
if (__hasOwnProp.call(b2, prop))
|
|
11
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
12
12
|
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(
|
|
14
|
-
if (__propIsEnum.call(
|
|
15
|
-
__defNormalProp(
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b2)) {
|
|
14
|
+
if (__propIsEnum.call(b2, prop))
|
|
15
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return a2;
|
|
18
18
|
};
|
|
19
|
-
var __spreadProps = (
|
|
19
|
+
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
|
20
20
|
var __objRest = (source, exclude) => {
|
|
21
21
|
var target = {};
|
|
22
22
|
for (var prop in source)
|
|
@@ -137,7 +137,7 @@ const cacheStringFunction = (fn) => {
|
|
|
137
137
|
};
|
|
138
138
|
const camelizeRE = /-(\w)/g;
|
|
139
139
|
const camelize = cacheStringFunction((str) => {
|
|
140
|
-
return str.replace(camelizeRE, (_,
|
|
140
|
+
return str.replace(camelizeRE, (_, c2) => c2 ? c2.toUpperCase() : "");
|
|
141
141
|
});
|
|
142
142
|
const hyphenateRE = /\B([A-Z])/g;
|
|
143
143
|
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
@@ -157,8 +157,8 @@ const def = (obj, key, value) => {
|
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
159
|
const toNumber = (val) => {
|
|
160
|
-
const
|
|
161
|
-
return isNaN(
|
|
160
|
+
const n2 = parseFloat(val);
|
|
161
|
+
return isNaN(n2) ? val : n2;
|
|
162
162
|
};
|
|
163
163
|
let _globalThis;
|
|
164
164
|
const getGlobalThis = () => {
|
|
@@ -194,15 +194,15 @@ class EffectScope {
|
|
|
194
194
|
}
|
|
195
195
|
stop(fromParent) {
|
|
196
196
|
if (this.active) {
|
|
197
|
-
let i2,
|
|
198
|
-
for (i2 = 0,
|
|
197
|
+
let i2, l2;
|
|
198
|
+
for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) {
|
|
199
199
|
this.effects[i2].stop();
|
|
200
200
|
}
|
|
201
|
-
for (i2 = 0,
|
|
201
|
+
for (i2 = 0, l2 = this.cleanups.length; i2 < l2; i2++) {
|
|
202
202
|
this.cleanups[i2]();
|
|
203
203
|
}
|
|
204
204
|
if (this.scopes) {
|
|
205
|
-
for (i2 = 0,
|
|
205
|
+
for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) {
|
|
206
206
|
this.scopes[i2].stop(true);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -460,7 +460,7 @@ function createArrayInstrumentations() {
|
|
|
460
460
|
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
461
461
|
instrumentations[key] = function(...args) {
|
|
462
462
|
const arr = toRaw(this);
|
|
463
|
-
for (let i2 = 0,
|
|
463
|
+
for (let i2 = 0, l2 = this.length; i2 < l2; i2++) {
|
|
464
464
|
track(arr, "get", i2 + "");
|
|
465
465
|
}
|
|
466
466
|
const res = arr[key](...args);
|
|
@@ -909,8 +909,8 @@ function triggerRefValue(ref2, newVal) {
|
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
|
-
function isRef(
|
|
913
|
-
return !!(
|
|
912
|
+
function isRef(r2) {
|
|
913
|
+
return !!(r2 && r2.__v_isRef === true);
|
|
914
914
|
}
|
|
915
915
|
function ref(value) {
|
|
916
916
|
return createRef(value, false);
|
|
@@ -1169,7 +1169,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1169
1169
|
return;
|
|
1170
1170
|
}
|
|
1171
1171
|
activePostFlushCbs = deduped;
|
|
1172
|
-
activePostFlushCbs.sort((
|
|
1172
|
+
activePostFlushCbs.sort((a2, b2) => getId(a2) - getId(b2));
|
|
1173
1173
|
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
1174
1174
|
activePostFlushCbs[postFlushIndex]();
|
|
1175
1175
|
}
|
|
@@ -1182,7 +1182,7 @@ function flushJobs(seen) {
|
|
|
1182
1182
|
isFlushPending = false;
|
|
1183
1183
|
isFlushing = true;
|
|
1184
1184
|
flushPreFlushCbs(seen);
|
|
1185
|
-
queue.sort((
|
|
1185
|
+
queue.sort((a2, b2) => getId(a2) - getId(b2));
|
|
1186
1186
|
const check = NOOP;
|
|
1187
1187
|
try {
|
|
1188
1188
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
@@ -1215,7 +1215,7 @@ function emit$1$2(instance, event, ...rawArgs) {
|
|
|
1215
1215
|
const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
|
|
1216
1216
|
const { number: number3, trim } = props2[modifiersKey] || EMPTY_OBJ;
|
|
1217
1217
|
if (trim) {
|
|
1218
|
-
args = rawArgs.map((
|
|
1218
|
+
args = rawArgs.map((a2) => a2.trim());
|
|
1219
1219
|
}
|
|
1220
1220
|
if (number3) {
|
|
1221
1221
|
args = rawArgs.map(toNumber);
|
|
@@ -1816,9 +1816,9 @@ const PublicInstanceProxyHandlers = {
|
|
|
1816
1816
|
const { ctx, setupState, data, props: props2, accessCache, type, appContext } = instance;
|
|
1817
1817
|
let normalizedProps;
|
|
1818
1818
|
if (key[0] !== "$") {
|
|
1819
|
-
const
|
|
1820
|
-
if (
|
|
1821
|
-
switch (
|
|
1819
|
+
const n2 = accessCache[key];
|
|
1820
|
+
if (n2 !== void 0) {
|
|
1821
|
+
switch (n2) {
|
|
1822
1822
|
case 1:
|
|
1823
1823
|
return setupState[key];
|
|
1824
1824
|
case 2:
|
|
@@ -1962,15 +1962,15 @@ function applyOptions(instance) {
|
|
|
1962
1962
|
const opt = computedOptions[key];
|
|
1963
1963
|
const get2 = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
|
1964
1964
|
const set2 = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : NOOP;
|
|
1965
|
-
const
|
|
1965
|
+
const c2 = computed({
|
|
1966
1966
|
get: get2,
|
|
1967
1967
|
set: set2
|
|
1968
1968
|
});
|
|
1969
1969
|
Object.defineProperty(ctx, key, {
|
|
1970
1970
|
enumerable: true,
|
|
1971
1971
|
configurable: true,
|
|
1972
|
-
get: () =>
|
|
1973
|
-
set: (v) =>
|
|
1972
|
+
get: () => c2.value,
|
|
1973
|
+
set: (v) => c2.value = v
|
|
1974
1974
|
});
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
@@ -2077,7 +2077,7 @@ function createWatcher(raw2, ctx, publicThis, key) {
|
|
|
2077
2077
|
watch$1(getter, raw2.bind(publicThis));
|
|
2078
2078
|
} else if (isObject$1(raw2)) {
|
|
2079
2079
|
if (isArray(raw2)) {
|
|
2080
|
-
raw2.forEach((
|
|
2080
|
+
raw2.forEach((r2) => createWatcher(r2, ctx, publicThis, key));
|
|
2081
2081
|
} else {
|
|
2082
2082
|
const handler = isFunction(raw2.handler) ? raw2.handler.bind(publicThis) : ctx[raw2.handler];
|
|
2083
2083
|
if (isFunction(handler)) {
|
|
@@ -2102,7 +2102,7 @@ function resolveMergedOptions(instance) {
|
|
|
2102
2102
|
} else {
|
|
2103
2103
|
resolved = {};
|
|
2104
2104
|
if (globalMixins.length) {
|
|
2105
|
-
globalMixins.forEach((
|
|
2105
|
+
globalMixins.forEach((m2) => mergeOptions(resolved, m2, optionMergeStrategies, true));
|
|
2106
2106
|
}
|
|
2107
2107
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2108
2108
|
}
|
|
@@ -2115,7 +2115,7 @@ function mergeOptions(to, from, strats, asMixin = false) {
|
|
|
2115
2115
|
mergeOptions(to, extendsOptions, strats, true);
|
|
2116
2116
|
}
|
|
2117
2117
|
if (mixins) {
|
|
2118
|
-
mixins.forEach((
|
|
2118
|
+
mixins.forEach((m2) => mergeOptions(to, m2, strats, true));
|
|
2119
2119
|
}
|
|
2120
2120
|
for (const key in from) {
|
|
2121
2121
|
if (asMixin && key === "expose")
|
|
@@ -2412,12 +2412,12 @@ function getType(ctor) {
|
|
|
2412
2412
|
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
2413
2413
|
return match ? match[1] : ctor === null ? "null" : "";
|
|
2414
2414
|
}
|
|
2415
|
-
function isSameType(
|
|
2416
|
-
return getType(
|
|
2415
|
+
function isSameType(a2, b2) {
|
|
2416
|
+
return getType(a2) === getType(b2);
|
|
2417
2417
|
}
|
|
2418
2418
|
function getTypeIndex(type, expectedTypes) {
|
|
2419
2419
|
if (isArray(expectedTypes)) {
|
|
2420
|
-
return expectedTypes.findIndex((
|
|
2420
|
+
return expectedTypes.findIndex((t2) => isSameType(t2, type));
|
|
2421
2421
|
} else if (isFunction(expectedTypes)) {
|
|
2422
2422
|
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
2423
2423
|
}
|
|
@@ -2614,7 +2614,7 @@ function createAppAPI(render, hydrate2) {
|
|
|
2614
2614
|
}
|
|
2615
2615
|
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
2616
2616
|
if (isArray(rawRef)) {
|
|
2617
|
-
rawRef.forEach((
|
|
2617
|
+
rawRef.forEach((r2, i2) => setRef(r2, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i2] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
2618
2618
|
return;
|
|
2619
2619
|
}
|
|
2620
2620
|
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
@@ -3017,7 +3017,7 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3017
3017
|
if (!instance.isMounted) {
|
|
3018
3018
|
let vnodeHook;
|
|
3019
3019
|
const { el, props: props2 } = initialVNode;
|
|
3020
|
-
const { bm, m, parent } = instance;
|
|
3020
|
+
const { bm, m: m2, parent } = instance;
|
|
3021
3021
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
3022
3022
|
toggleRecurse(instance, false);
|
|
3023
3023
|
if (bm) {
|
|
@@ -3042,8 +3042,8 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3042
3042
|
patch(null, subTree, container, anchor, instance, parentSuspense, isSVG);
|
|
3043
3043
|
initialVNode.el = subTree.el;
|
|
3044
3044
|
}
|
|
3045
|
-
if (
|
|
3046
|
-
queuePostRenderEffect(
|
|
3045
|
+
if (m2) {
|
|
3046
|
+
queuePostRenderEffect(m2, parentSuspense);
|
|
3047
3047
|
}
|
|
3048
3048
|
if (!isAsyncWrapperVNode && (vnodeHook = props2 && props2.onVnodeMounted)) {
|
|
3049
3049
|
const scopedInitialVNode = initialVNode;
|
|
@@ -3055,7 +3055,7 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3055
3055
|
instance.isMounted = true;
|
|
3056
3056
|
initialVNode = container = anchor = null;
|
|
3057
3057
|
} else {
|
|
3058
|
-
let { next, bu, u, parent, vnode } = instance;
|
|
3058
|
+
let { next, bu, u: u2, parent, vnode } = instance;
|
|
3059
3059
|
let originNext = next;
|
|
3060
3060
|
let vnodeHook;
|
|
3061
3061
|
toggleRecurse(instance, false);
|
|
@@ -3080,8 +3080,8 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3080
3080
|
if (originNext === null) {
|
|
3081
3081
|
updateHOCHostEl(instance, nextTree.el);
|
|
3082
3082
|
}
|
|
3083
|
-
if (
|
|
3084
|
-
queuePostRenderEffect(
|
|
3083
|
+
if (u2) {
|
|
3084
|
+
queuePostRenderEffect(u2, parentSuspense);
|
|
3085
3085
|
}
|
|
3086
3086
|
if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
|
3087
3087
|
queuePostRenderEffect(() => invokeVNodeHook(vnodeHook, parent, next, vnode), parentSuspense);
|
|
@@ -3210,7 +3210,7 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3210
3210
|
keyToNewIndexMap.set(nextChild.key, i2);
|
|
3211
3211
|
}
|
|
3212
3212
|
}
|
|
3213
|
-
let
|
|
3213
|
+
let j2;
|
|
3214
3214
|
let patched = 0;
|
|
3215
3215
|
const toBePatched = e2 - s2 + 1;
|
|
3216
3216
|
let moved = false;
|
|
@@ -3228,9 +3228,9 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3228
3228
|
if (prevChild.key != null) {
|
|
3229
3229
|
newIndex = keyToNewIndexMap.get(prevChild.key);
|
|
3230
3230
|
} else {
|
|
3231
|
-
for (
|
|
3232
|
-
if (newIndexToOldIndexMap[
|
|
3233
|
-
newIndex =
|
|
3231
|
+
for (j2 = s2; j2 <= e2; j2++) {
|
|
3232
|
+
if (newIndexToOldIndexMap[j2 - s2] === 0 && isSameVNodeType(prevChild, c2[j2])) {
|
|
3233
|
+
newIndex = j2;
|
|
3234
3234
|
break;
|
|
3235
3235
|
}
|
|
3236
3236
|
}
|
|
@@ -3249,7 +3249,7 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3249
3249
|
}
|
|
3250
3250
|
}
|
|
3251
3251
|
const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
|
|
3252
|
-
|
|
3252
|
+
j2 = increasingNewIndexSequence.length - 1;
|
|
3253
3253
|
for (i2 = toBePatched - 1; i2 >= 0; i2--) {
|
|
3254
3254
|
const nextIndex = s2 + i2;
|
|
3255
3255
|
const nextChild = c2[nextIndex];
|
|
@@ -3257,10 +3257,10 @@ function baseCreateRenderer(options2, createHydrationFns) {
|
|
|
3257
3257
|
if (newIndexToOldIndexMap[i2] === 0) {
|
|
3258
3258
|
patch(null, nextChild, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
3259
3259
|
} else if (moved) {
|
|
3260
|
-
if (
|
|
3260
|
+
if (j2 < 0 || i2 !== increasingNewIndexSequence[j2]) {
|
|
3261
3261
|
move(nextChild, container, anchor, 2);
|
|
3262
3262
|
} else {
|
|
3263
|
-
|
|
3263
|
+
j2--;
|
|
3264
3264
|
}
|
|
3265
3265
|
}
|
|
3266
3266
|
}
|
|
@@ -3494,39 +3494,39 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
3494
3494
|
function getSequence(arr) {
|
|
3495
3495
|
const p2 = arr.slice();
|
|
3496
3496
|
const result = [0];
|
|
3497
|
-
let i2,
|
|
3497
|
+
let i2, j2, u2, v, c2;
|
|
3498
3498
|
const len = arr.length;
|
|
3499
3499
|
for (i2 = 0; i2 < len; i2++) {
|
|
3500
3500
|
const arrI = arr[i2];
|
|
3501
3501
|
if (arrI !== 0) {
|
|
3502
|
-
|
|
3503
|
-
if (arr[
|
|
3504
|
-
p2[i2] =
|
|
3502
|
+
j2 = result[result.length - 1];
|
|
3503
|
+
if (arr[j2] < arrI) {
|
|
3504
|
+
p2[i2] = j2;
|
|
3505
3505
|
result.push(i2);
|
|
3506
3506
|
continue;
|
|
3507
3507
|
}
|
|
3508
|
-
|
|
3508
|
+
u2 = 0;
|
|
3509
3509
|
v = result.length - 1;
|
|
3510
|
-
while (
|
|
3511
|
-
|
|
3512
|
-
if (arr[result[
|
|
3513
|
-
|
|
3510
|
+
while (u2 < v) {
|
|
3511
|
+
c2 = u2 + v >> 1;
|
|
3512
|
+
if (arr[result[c2]] < arrI) {
|
|
3513
|
+
u2 = c2 + 1;
|
|
3514
3514
|
} else {
|
|
3515
|
-
v =
|
|
3515
|
+
v = c2;
|
|
3516
3516
|
}
|
|
3517
3517
|
}
|
|
3518
|
-
if (arrI < arr[result[
|
|
3519
|
-
if (
|
|
3520
|
-
p2[i2] = result[
|
|
3518
|
+
if (arrI < arr[result[u2]]) {
|
|
3519
|
+
if (u2 > 0) {
|
|
3520
|
+
p2[i2] = result[u2 - 1];
|
|
3521
3521
|
}
|
|
3522
|
-
result[
|
|
3522
|
+
result[u2] = i2;
|
|
3523
3523
|
}
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
3526
|
-
|
|
3527
|
-
v = result[
|
|
3528
|
-
while (
|
|
3529
|
-
result[
|
|
3526
|
+
u2 = result.length;
|
|
3527
|
+
v = result[u2 - 1];
|
|
3528
|
+
while (u2-- > 0) {
|
|
3529
|
+
result[u2] = v;
|
|
3530
3530
|
v = p2[v];
|
|
3531
3531
|
}
|
|
3532
3532
|
return result;
|
|
@@ -3894,8 +3894,8 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
3894
3894
|
if (isSSR) {
|
|
3895
3895
|
return setupResult.then((resolvedResult) => {
|
|
3896
3896
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
3897
|
-
}).catch((
|
|
3898
|
-
handleError(
|
|
3897
|
+
}).catch((e2) => {
|
|
3898
|
+
handleError(e2, instance, 0);
|
|
3899
3899
|
});
|
|
3900
3900
|
} else {
|
|
3901
3901
|
instance.asyncDep = setupResult;
|
|
@@ -3992,9 +3992,9 @@ function isClassComponent(value) {
|
|
|
3992
3992
|
const computed = (getterOrOptions, debugOptions) => {
|
|
3993
3993
|
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
3994
3994
|
};
|
|
3995
|
-
function h(type, propsOrChildren, children) {
|
|
3996
|
-
const
|
|
3997
|
-
if (
|
|
3995
|
+
function h$1(type, propsOrChildren, children) {
|
|
3996
|
+
const l2 = arguments.length;
|
|
3997
|
+
if (l2 === 2) {
|
|
3998
3998
|
if (isObject$1(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
3999
3999
|
if (isVNode(propsOrChildren)) {
|
|
4000
4000
|
return createVNode(type, null, [propsOrChildren]);
|
|
@@ -4004,9 +4004,9 @@ function h(type, propsOrChildren, children) {
|
|
|
4004
4004
|
return createVNode(type, null, propsOrChildren);
|
|
4005
4005
|
}
|
|
4006
4006
|
} else {
|
|
4007
|
-
if (
|
|
4007
|
+
if (l2 > 3) {
|
|
4008
4008
|
children = Array.prototype.slice.call(arguments, 2);
|
|
4009
|
-
} else if (
|
|
4009
|
+
} else if (l2 === 3 && isVNode(children)) {
|
|
4010
4010
|
children = [children];
|
|
4011
4011
|
}
|
|
4012
4012
|
return createVNode(type, propsOrChildren, children);
|
|
@@ -4211,7 +4211,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
|
|
|
4211
4211
|
}
|
|
4212
4212
|
try {
|
|
4213
4213
|
el[key] = value;
|
|
4214
|
-
} catch (
|
|
4214
|
+
} catch (e2) {
|
|
4215
4215
|
}
|
|
4216
4216
|
needRemove && el.removeAttribute(key);
|
|
4217
4217
|
}
|
|
@@ -4260,33 +4260,33 @@ function parseName(name) {
|
|
|
4260
4260
|
let options2;
|
|
4261
4261
|
if (optionsModifierRE.test(name)) {
|
|
4262
4262
|
options2 = {};
|
|
4263
|
-
let
|
|
4264
|
-
while (
|
|
4265
|
-
name = name.slice(0, name.length -
|
|
4266
|
-
options2[
|
|
4263
|
+
let m2;
|
|
4264
|
+
while (m2 = name.match(optionsModifierRE)) {
|
|
4265
|
+
name = name.slice(0, name.length - m2[0].length);
|
|
4266
|
+
options2[m2[0].toLowerCase()] = true;
|
|
4267
4267
|
}
|
|
4268
4268
|
}
|
|
4269
4269
|
return [hyphenate(name.slice(2)), options2];
|
|
4270
4270
|
}
|
|
4271
4271
|
function createInvoker(initialValue2, instance) {
|
|
4272
|
-
const invoker = (
|
|
4273
|
-
const timeStamp =
|
|
4272
|
+
const invoker = (e2) => {
|
|
4273
|
+
const timeStamp = e2.timeStamp || _getNow();
|
|
4274
4274
|
if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
|
|
4275
|
-
callWithAsyncErrorHandling(patchStopImmediatePropagation(
|
|
4275
|
+
callWithAsyncErrorHandling(patchStopImmediatePropagation(e2, invoker.value), instance, 5, [e2]);
|
|
4276
4276
|
}
|
|
4277
4277
|
};
|
|
4278
4278
|
invoker.value = initialValue2;
|
|
4279
4279
|
invoker.attached = getNow();
|
|
4280
4280
|
return invoker;
|
|
4281
4281
|
}
|
|
4282
|
-
function patchStopImmediatePropagation(
|
|
4282
|
+
function patchStopImmediatePropagation(e2, value) {
|
|
4283
4283
|
if (isArray(value)) {
|
|
4284
|
-
const originalStop =
|
|
4285
|
-
|
|
4286
|
-
originalStop.call(
|
|
4287
|
-
|
|
4284
|
+
const originalStop = e2.stopImmediatePropagation;
|
|
4285
|
+
e2.stopImmediatePropagation = () => {
|
|
4286
|
+
originalStop.call(e2);
|
|
4287
|
+
e2._stopped = true;
|
|
4288
4288
|
};
|
|
4289
|
-
return value.map((fn) => (
|
|
4289
|
+
return value.map((fn) => (e3) => !e3._stopped && fn && fn(e3));
|
|
4290
4290
|
} else {
|
|
4291
4291
|
return value;
|
|
4292
4292
|
}
|
|
@@ -4379,18 +4379,45 @@ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
|
4379
4379
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
4380
4380
|
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
4381
4381
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4382
|
-
var __spreadValues2 = (
|
|
4383
|
-
for (var prop in
|
|
4384
|
-
if (__hasOwnProp2.call(
|
|
4385
|
-
__defNormalProp2(
|
|
4382
|
+
var __spreadValues2 = (a2, b2) => {
|
|
4383
|
+
for (var prop in b2 || (b2 = {}))
|
|
4384
|
+
if (__hasOwnProp2.call(b2, prop))
|
|
4385
|
+
__defNormalProp2(a2, prop, b2[prop]);
|
|
4386
4386
|
if (__getOwnPropSymbols2)
|
|
4387
|
-
for (var prop of __getOwnPropSymbols2(
|
|
4388
|
-
if (__propIsEnum2.call(
|
|
4389
|
-
__defNormalProp2(
|
|
4387
|
+
for (var prop of __getOwnPropSymbols2(b2)) {
|
|
4388
|
+
if (__propIsEnum2.call(b2, prop))
|
|
4389
|
+
__defNormalProp2(a2, prop, b2[prop]);
|
|
4390
4390
|
}
|
|
4391
|
-
return
|
|
4391
|
+
return a2;
|
|
4392
4392
|
};
|
|
4393
|
-
var __spreadProps2 = (
|
|
4393
|
+
var __spreadProps2 = (a2, b2) => __defProps2(a2, __getOwnPropDescs2(b2));
|
|
4394
|
+
function usePrepop() {
|
|
4395
|
+
let prepopSettings = {};
|
|
4396
|
+
const urlParams2 = new URLSearchParams(window.location.search);
|
|
4397
|
+
const prepopPlugin2 = (node) => {
|
|
4398
|
+
if (node.props.type == "form") {
|
|
4399
|
+
prepopSettings = node.props.attrs.prepop || prepopSettings;
|
|
4400
|
+
return true;
|
|
4401
|
+
}
|
|
4402
|
+
if (node.props.type == "group") {
|
|
4403
|
+
return true;
|
|
4404
|
+
}
|
|
4405
|
+
if (prepopSettings) {
|
|
4406
|
+
let value;
|
|
4407
|
+
if (prepopSettings.values) {
|
|
4408
|
+
value = prepopSettings.values[node.name];
|
|
4409
|
+
}
|
|
4410
|
+
if (prepopSettings.fromURL && urlParams2.has(node.name)) {
|
|
4411
|
+
value = urlParams2.get(node.name);
|
|
4412
|
+
}
|
|
4413
|
+
if (value) {
|
|
4414
|
+
console.debug("Setting prepop value for:", node.name, value);
|
|
4415
|
+
node.input(value);
|
|
4416
|
+
}
|
|
4417
|
+
}
|
|
4418
|
+
};
|
|
4419
|
+
return { prepopPlugin: prepopPlugin2, prepopSettings };
|
|
4420
|
+
}
|
|
4394
4421
|
function token$1() {
|
|
4395
4422
|
return Math.random().toString(36).substring(2, 15);
|
|
4396
4423
|
}
|
|
@@ -4408,8 +4435,8 @@ function eq$1(valA, valB, deep = true, explicit = ["__key"]) {
|
|
|
4408
4435
|
return false;
|
|
4409
4436
|
if (Object.keys(valA).length !== Object.keys(valB).length)
|
|
4410
4437
|
return false;
|
|
4411
|
-
for (const
|
|
4412
|
-
if ((
|
|
4438
|
+
for (const k2 of explicit) {
|
|
4439
|
+
if ((k2 in valA || k2 in valB) && valA[k2] !== valB[k2])
|
|
4413
4440
|
return false;
|
|
4414
4441
|
}
|
|
4415
4442
|
for (const key in valA) {
|
|
@@ -4425,7 +4452,7 @@ function eq$1(valA, valB, deep = true, explicit = ["__key"]) {
|
|
|
4425
4452
|
return false;
|
|
4426
4453
|
}
|
|
4427
4454
|
function camel$1(str) {
|
|
4428
|
-
return str.replace(/-([a-z0-9])/gi, (_s,
|
|
4455
|
+
return str.replace(/-([a-z0-9])/gi, (_s, g2) => g2.toUpperCase());
|
|
4429
4456
|
}
|
|
4430
4457
|
function kebab$1(str) {
|
|
4431
4458
|
return str.replace(/([a-z0-9])([A-Z])/g, (_s, trail, cap) => trail + "-" + cap.toLowerCase()).replace(" ", "-").toLowerCase();
|
|
@@ -4574,7 +4601,7 @@ function bubble$1(node, _context, event) {
|
|
|
4574
4601
|
}
|
|
4575
4602
|
return node;
|
|
4576
4603
|
}
|
|
4577
|
-
function on$
|
|
4604
|
+
function on$2(_node, context, name, listener) {
|
|
4578
4605
|
return context._e.on(name, listener);
|
|
4579
4606
|
}
|
|
4580
4607
|
function off$1(node, context, receipt) {
|
|
@@ -4603,18 +4630,18 @@ function error$1(code, data = {}) {
|
|
|
4603
4630
|
throw Error(errorHandler$1.dispatch({ code, data }).message);
|
|
4604
4631
|
}
|
|
4605
4632
|
function createMessage$1(conf, node) {
|
|
4606
|
-
const
|
|
4633
|
+
const m2 = __spreadValues2({
|
|
4607
4634
|
blocking: false,
|
|
4608
4635
|
key: token$1(),
|
|
4609
4636
|
meta: {},
|
|
4610
4637
|
type: "state",
|
|
4611
4638
|
visible: true
|
|
4612
4639
|
}, conf);
|
|
4613
|
-
if (node &&
|
|
4614
|
-
|
|
4615
|
-
|
|
4640
|
+
if (node && m2.value && m2.meta.localize !== false) {
|
|
4641
|
+
m2.value = node.t(m2);
|
|
4642
|
+
m2.meta.locale = node.config.locale;
|
|
4616
4643
|
}
|
|
4617
|
-
return
|
|
4644
|
+
return m2;
|
|
4618
4645
|
}
|
|
4619
4646
|
function createMessages$1(node, ...errors2) {
|
|
4620
4647
|
const sourceKey = `${node.name}-set`;
|
|
@@ -4624,7 +4651,7 @@ function createMessages$1(node, ...errors2) {
|
|
|
4624
4651
|
value: error2,
|
|
4625
4652
|
meta: { source: sourceKey, autoClear: true }
|
|
4626
4653
|
});
|
|
4627
|
-
return errors2.filter((
|
|
4654
|
+
return errors2.filter((m2) => !!m2).map((errorSet) => {
|
|
4628
4655
|
if (typeof errorSet === "string")
|
|
4629
4656
|
errorSet = [errorSet];
|
|
4630
4657
|
if (Array.isArray(errorSet)) {
|
|
@@ -4680,13 +4707,13 @@ function submitForm$1(id) {
|
|
|
4680
4707
|
warn$1(151, id);
|
|
4681
4708
|
}
|
|
4682
4709
|
function clearState$1(node) {
|
|
4683
|
-
const clear2 = (
|
|
4684
|
-
for (const key in
|
|
4685
|
-
const message2 =
|
|
4710
|
+
const clear2 = (n2) => {
|
|
4711
|
+
for (const key in n2.store) {
|
|
4712
|
+
const message2 = n2.store[key];
|
|
4686
4713
|
if (message2.type === "error" || message2.type === "ui" && key === "incomplete") {
|
|
4687
|
-
|
|
4714
|
+
n2.store.remove(key);
|
|
4688
4715
|
} else if (message2.type === "state") {
|
|
4689
|
-
|
|
4716
|
+
n2.store.set(__spreadProps2(__spreadValues2({}, message2), { value: false }));
|
|
4690
4717
|
}
|
|
4691
4718
|
}
|
|
4692
4719
|
};
|
|
@@ -4696,7 +4723,7 @@ function clearState$1(node) {
|
|
|
4696
4723
|
function reset$1(id, resetTo) {
|
|
4697
4724
|
const node = typeof id === "string" ? getNode$1$1(id) : id;
|
|
4698
4725
|
if (node) {
|
|
4699
|
-
const initial = (
|
|
4726
|
+
const initial = (n2) => cloneAny$1(n2.props.initial) || (n2.type === "group" ? {} : n2.type === "list" ? [] : void 0);
|
|
4700
4727
|
node._e.pause(node);
|
|
4701
4728
|
node.input(cloneAny$1(resetTo) || initial(node), false);
|
|
4702
4729
|
node.walk((child) => child.input(initial(child), false));
|
|
@@ -4748,7 +4775,7 @@ const invalidSetter$1 = (node, _context, property) => {
|
|
|
4748
4775
|
each: trap$1(eachChild$1),
|
|
4749
4776
|
emit: trap$1(emit$1$1),
|
|
4750
4777
|
find: trap$1(find$1),
|
|
4751
|
-
on: trap$1(on$
|
|
4778
|
+
on: trap$1(on$2),
|
|
4752
4779
|
off: trap$1(off$1),
|
|
4753
4780
|
parent: trap$1(false, setParent$1),
|
|
4754
4781
|
plugins: trap$1(false),
|
|
@@ -5026,7 +5053,7 @@ function walkTree$1(_node, context, callback, stopIfFalse = false) {
|
|
|
5026
5053
|
function resetConfig$1(node, context) {
|
|
5027
5054
|
const parent = node.parent || void 0;
|
|
5028
5055
|
context.config = createConfig$2(node.config._t, parent);
|
|
5029
|
-
node.walk((
|
|
5056
|
+
node.walk((n2) => n2.resetConfig());
|
|
5030
5057
|
}
|
|
5031
5058
|
function use$1(node, context, plugin2, run2 = true, library = true) {
|
|
5032
5059
|
if (Array.isArray(plugin2) || plugin2 instanceof Set) {
|
|
@@ -5104,7 +5131,7 @@ function getNode$2(node, _context, locator) {
|
|
|
5104
5131
|
pointer = node;
|
|
5105
5132
|
break;
|
|
5106
5133
|
default:
|
|
5107
|
-
pointer = pointer.children.find((
|
|
5134
|
+
pointer = pointer.children.find((c2) => String(c2.name) === String(name)) || select$4(pointer, name);
|
|
5108
5135
|
}
|
|
5109
5136
|
}
|
|
5110
5137
|
return pointer || void 0;
|
|
@@ -5127,7 +5154,7 @@ function find$1(node, _context, searchTerm, searcher) {
|
|
|
5127
5154
|
return bfs$1(node, searchTerm, searcher);
|
|
5128
5155
|
}
|
|
5129
5156
|
function bfs$1(tree, searchValue, searchGoal = "name") {
|
|
5130
|
-
const search2 = typeof searchGoal === "string" ? (
|
|
5157
|
+
const search2 = typeof searchGoal === "string" ? (n2) => n2[searchGoal] == searchValue : searchGoal;
|
|
5131
5158
|
const stack = [tree];
|
|
5132
5159
|
while (stack.length) {
|
|
5133
5160
|
const node = stack.shift();
|
|
@@ -5137,8 +5164,8 @@ function bfs$1(tree, searchValue, searchGoal = "name") {
|
|
|
5137
5164
|
}
|
|
5138
5165
|
return void 0;
|
|
5139
5166
|
}
|
|
5140
|
-
function getRoot$1(
|
|
5141
|
-
let node =
|
|
5167
|
+
function getRoot$1(n2) {
|
|
5168
|
+
let node = n2;
|
|
5142
5169
|
while (node.parent) {
|
|
5143
5170
|
node = node.parent;
|
|
5144
5171
|
}
|
|
@@ -5188,7 +5215,7 @@ function createConfig$2(target = {}, parent) {
|
|
|
5188
5215
|
if (node) {
|
|
5189
5216
|
node.emit(`config:${prop}`, value, false);
|
|
5190
5217
|
configChange$1(node, prop, value);
|
|
5191
|
-
node.walk((
|
|
5218
|
+
node.walk((n2) => configChange$1(n2, prop, value), true);
|
|
5192
5219
|
}
|
|
5193
5220
|
return didSet;
|
|
5194
5221
|
}
|
|
@@ -5237,44 +5264,136 @@ function clearErrors$1$1(node, context, clearChildErrors = true) {
|
|
|
5237
5264
|
}
|
|
5238
5265
|
return node;
|
|
5239
5266
|
}
|
|
5267
|
+
const postJSON = async (url3, data) => {
|
|
5268
|
+
console.debug("Posting to " + url3);
|
|
5269
|
+
const raw2 = await fetch(url3, {
|
|
5270
|
+
method: "POST",
|
|
5271
|
+
headers: {
|
|
5272
|
+
"Accept": "application/json",
|
|
5273
|
+
"Content-Type": "application/json"
|
|
5274
|
+
},
|
|
5275
|
+
body: JSON.stringify(data)
|
|
5276
|
+
});
|
|
5277
|
+
if (!raw2.ok) {
|
|
5278
|
+
let error2 = new Error(raw2.statusText);
|
|
5279
|
+
Object.assign(error2, { response: raw2 });
|
|
5280
|
+
throw error2;
|
|
5281
|
+
}
|
|
5282
|
+
const res = await raw2.json();
|
|
5283
|
+
console.debug("POST response:" + JSON.stringify(res, null, 2));
|
|
5284
|
+
return res;
|
|
5285
|
+
};
|
|
5286
|
+
const redirect = (url3) => {
|
|
5287
|
+
window.location.href = url3;
|
|
5288
|
+
};
|
|
5289
|
+
const handleSubmitError = (err, node) => {
|
|
5290
|
+
if (err.response) {
|
|
5291
|
+
const code = err.response.status;
|
|
5292
|
+
if (node.props.attrs.errorCodes && code in node.props.attrs.errorCodes) {
|
|
5293
|
+
const value = node.props.attrs.errorCodes[code];
|
|
5294
|
+
let message2 = null;
|
|
5295
|
+
let abort = true;
|
|
5296
|
+
if (typeof value === "string") {
|
|
5297
|
+
message2 = value;
|
|
5298
|
+
} else {
|
|
5299
|
+
if ("message" in value) {
|
|
5300
|
+
message2 = value.message;
|
|
5301
|
+
}
|
|
5302
|
+
if ("abort" in value) {
|
|
5303
|
+
abort = value.abort;
|
|
5304
|
+
}
|
|
5305
|
+
}
|
|
5306
|
+
if (message2) {
|
|
5307
|
+
node.setErrors(message2);
|
|
5308
|
+
}
|
|
5309
|
+
return abort;
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
node.setErrors(err.toString());
|
|
5313
|
+
return true;
|
|
5314
|
+
};
|
|
5315
|
+
const keyValOverlap = (o1, o2, multiple = true) => {
|
|
5316
|
+
let result = null;
|
|
5317
|
+
for (var input2 of Object.keys(o1)) {
|
|
5318
|
+
const value = o1[input2];
|
|
5319
|
+
if (o2[input2] && o2[input2][value]) {
|
|
5320
|
+
if (result !== null && !multiple) {
|
|
5321
|
+
throw Error("Multiple values not allowed");
|
|
5322
|
+
}
|
|
5323
|
+
result = o2[input2][value];
|
|
5324
|
+
break;
|
|
5325
|
+
}
|
|
5326
|
+
}
|
|
5327
|
+
if (result === null) {
|
|
5328
|
+
if ("*" in o2) {
|
|
5329
|
+
return o2["*"];
|
|
5330
|
+
}
|
|
5331
|
+
throw Error("result not found and no default specified");
|
|
5332
|
+
}
|
|
5333
|
+
return result;
|
|
5334
|
+
};
|
|
5335
|
+
const getKey = (d2, path) => {
|
|
5336
|
+
if (typeof path === "string") {
|
|
5337
|
+
path = path.split(".");
|
|
5338
|
+
}
|
|
5339
|
+
return path.reduce((x2, y) => x2[y], d2);
|
|
5340
|
+
};
|
|
5341
|
+
const strSubUrl = (str, obj) => str.replace(/\${(.*?)}/g, (x2, g2) => encodeURIComponent(getKey(obj, g2)));
|
|
5240
5342
|
function useSteps() {
|
|
5241
5343
|
const activeStep2 = ref("");
|
|
5242
5344
|
const steps2 = reactive({});
|
|
5243
5345
|
let defaultOrder2 = [];
|
|
5244
|
-
let
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5346
|
+
let stepQueue2 = ref([]);
|
|
5347
|
+
let stepHistory2 = ref([]);
|
|
5348
|
+
const lastItem = (x2) => {
|
|
5349
|
+
return x2.value[x2.value.length - 1];
|
|
5248
5350
|
};
|
|
5249
5351
|
const firstStep2 = () => {
|
|
5250
|
-
|
|
5251
|
-
|
|
5352
|
+
if (stepHistory2.value.length > 0) {
|
|
5353
|
+
return stepHistory2.value[0];
|
|
5354
|
+
}
|
|
5355
|
+
return stepQueue2.value[0];
|
|
5252
5356
|
};
|
|
5253
5357
|
const lastStep2 = () => {
|
|
5254
|
-
|
|
5358
|
+
if (stepQueue2.value.length > 0) {
|
|
5359
|
+
return lastItem(stepQueue2);
|
|
5360
|
+
}
|
|
5361
|
+
return lastItem(stepHistory2);
|
|
5255
5362
|
};
|
|
5256
|
-
const
|
|
5257
|
-
|
|
5258
|
-
return stepOrder2.value.indexOf(activeStep2.value);
|
|
5363
|
+
const enabledSteps2 = () => {
|
|
5364
|
+
return [...stepHistory2.value, ...stepQueue2.value];
|
|
5259
5365
|
};
|
|
5260
|
-
const
|
|
5261
|
-
|
|
5366
|
+
const setStepQueue = (value) => {
|
|
5367
|
+
stepQueue2.value = [...value];
|
|
5262
5368
|
};
|
|
5263
|
-
const
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5369
|
+
const queueStep = (stepName, next = false) => {
|
|
5370
|
+
if (next == true) {
|
|
5371
|
+
stepQueue2.value.unshift(stepName);
|
|
5372
|
+
} else {
|
|
5373
|
+
stepQueue2.value.push(stepName);
|
|
5267
5374
|
}
|
|
5268
|
-
|
|
5375
|
+
};
|
|
5376
|
+
const advanceStep = (stepCount) => {
|
|
5377
|
+
if (stepCount == 1) {
|
|
5378
|
+
const done = stepQueue2.value.shift();
|
|
5379
|
+
stepHistory2.value.push(done);
|
|
5380
|
+
activeStep2.value = stepQueue2.value[0];
|
|
5381
|
+
} else if (stepCount == -1) {
|
|
5382
|
+
const undone = stepHistory2.value.pop();
|
|
5383
|
+
queueStep(undone, true);
|
|
5384
|
+
activeStep2.value = undone;
|
|
5385
|
+
} else {
|
|
5386
|
+
throw Error("Invalid stepCount: " + JSON.stringify(stepCount));
|
|
5387
|
+
}
|
|
5388
|
+
};
|
|
5389
|
+
const getNextStepsFromMap = (node, nextStepMap) => {
|
|
5390
|
+
return keyValOverlap(node.value, nextStepMap, false);
|
|
5269
5391
|
};
|
|
5270
5392
|
const setStep2 = ({ nextStep = 1, validate: validate2 = true } = {}) => {
|
|
5271
|
-
|
|
5393
|
+
const node = steps2[activeStep2.value].node;
|
|
5272
5394
|
if (validate2) {
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
const node = steps2[currentStep].node;
|
|
5276
|
-
node.walk((n) => {
|
|
5277
|
-
n.store.set(createMessage$1({
|
|
5395
|
+
node.walk((n2) => {
|
|
5396
|
+
n2.store.set(createMessage$1({
|
|
5278
5397
|
key: "submitted",
|
|
5279
5398
|
value: true,
|
|
5280
5399
|
visible: false
|
|
@@ -5284,35 +5403,43 @@ function useSteps() {
|
|
|
5284
5403
|
return;
|
|
5285
5404
|
}
|
|
5286
5405
|
}
|
|
5287
|
-
if (
|
|
5288
|
-
const
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
}
|
|
5293
|
-
|
|
5406
|
+
if (node.props.attrs.nextStepMap) {
|
|
5407
|
+
const nextSteps = getNextStepsFromMap(node, node.props.attrs.nextStepMap);
|
|
5408
|
+
if (nextSteps) {
|
|
5409
|
+
setStepQueue([activeStep2.value, ...nextSteps]);
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
if (typeof nextStep === "number") {
|
|
5413
|
+
advanceStep(nextStep);
|
|
5294
5414
|
} else {
|
|
5295
5415
|
throw Error("Unexpected value for nextStep: " + nextStep);
|
|
5296
5416
|
}
|
|
5297
5417
|
};
|
|
5298
5418
|
const setNextStep2 = () => {
|
|
5299
|
-
setStep2({ nextStep:
|
|
5419
|
+
setStep2({ nextStep: 1 });
|
|
5300
5420
|
};
|
|
5301
5421
|
const setPreviousStep2 = () => {
|
|
5302
|
-
setStep2({ nextStep:
|
|
5422
|
+
setStep2({ nextStep: -1, validate: false });
|
|
5303
5423
|
};
|
|
5304
5424
|
const stepPlugin2 = (node) => {
|
|
5425
|
+
if (node.props.type == "form") {
|
|
5426
|
+
if (node.props.attrs.defaultOrder) {
|
|
5427
|
+
defaultOrder2.push(...node.props.attrs.defaultOrder);
|
|
5428
|
+
}
|
|
5429
|
+
return true;
|
|
5430
|
+
}
|
|
5305
5431
|
if (node.props.type == "group") {
|
|
5306
|
-
console.debug("Adding step node", node);
|
|
5307
|
-
steps2[node.name] = steps2[node.name] || {};
|
|
5308
|
-
steps2[node.name].node = node;
|
|
5309
5432
|
if (defaultOrder2.length > 0) {
|
|
5310
|
-
if (
|
|
5311
|
-
|
|
5433
|
+
if (Object.keys(steps2).length === 0) {
|
|
5434
|
+
setStepQueue(defaultOrder2);
|
|
5312
5435
|
}
|
|
5313
5436
|
} else {
|
|
5314
|
-
|
|
5437
|
+
if (!(node.name in steps2)) {
|
|
5438
|
+
queueStep(node.name);
|
|
5439
|
+
}
|
|
5315
5440
|
}
|
|
5441
|
+
steps2[node.name] = steps2[node.name] || {};
|
|
5442
|
+
steps2[node.name].node = node;
|
|
5316
5443
|
node.on("created", () => {
|
|
5317
5444
|
steps2[node.name].valid = toRef(node.context.state, "valid");
|
|
5318
5445
|
});
|
|
@@ -5328,41 +5455,23 @@ function useSteps() {
|
|
|
5328
5455
|
return false;
|
|
5329
5456
|
}
|
|
5330
5457
|
};
|
|
5331
|
-
return { stepPlugin: stepPlugin2, steps: steps2,
|
|
5458
|
+
return { stepPlugin: stepPlugin2, steps: steps2, stepHistory: stepHistory2, stepQueue: stepQueue2, enabledSteps: enabledSteps2, defaultOrder: defaultOrder2, activeStep: activeStep2, firstStep: firstStep2, lastStep: lastStep2, setStep: setStep2, setStepQueue, setNextStep: setNextStep2, setPreviousStep: setPreviousStep2 };
|
|
5332
5459
|
}
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
method: "POST",
|
|
5337
|
-
headers: {
|
|
5338
|
-
"Accept": "application/json",
|
|
5339
|
-
"Content-Type": "application/json"
|
|
5340
|
-
},
|
|
5341
|
-
body: JSON.stringify(data)
|
|
5342
|
-
});
|
|
5343
|
-
const res = await rawResponse.json();
|
|
5344
|
-
console.debug("POST response:" + JSON.stringify(res, null, 2));
|
|
5345
|
-
return res;
|
|
5346
|
-
};
|
|
5347
|
-
const redirect = (url3) => {
|
|
5348
|
-
console.debug("redirect to " + url3);
|
|
5349
|
-
window.location.href = url3;
|
|
5350
|
-
};
|
|
5351
|
-
const getKey = (d, path) => {
|
|
5352
|
-
if (typeof path === "string") {
|
|
5353
|
-
path = path.split(".");
|
|
5354
|
-
}
|
|
5355
|
-
return path.reduce((x, y) => x[y], d);
|
|
5356
|
-
};
|
|
5357
|
-
const strSubUrl = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => encodeURIComponent(getKey(obj, g)));
|
|
5358
|
-
let { stepPlugin, steps, stepOrder, defaultOrder, setStepOrder, activeStep, firstStep, lastStep, setStep, setNextStep, setPreviousStep } = useSteps();
|
|
5460
|
+
let { prepopPlugin } = usePrepop();
|
|
5461
|
+
let { stepPlugin, steps, stepHistory, stepQueue, enabledSteps, defaultOrder, activeStep, firstStep, lastStep, setStep, setNextStep, setPreviousStep } = useSteps();
|
|
5462
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
5359
5463
|
const dataDefaults = {
|
|
5360
5464
|
steps,
|
|
5361
|
-
stepOrder,
|
|
5362
5465
|
activeStep,
|
|
5466
|
+
stepHistory,
|
|
5467
|
+
stepQueue,
|
|
5363
5468
|
plugins: [
|
|
5364
|
-
stepPlugin
|
|
5469
|
+
stepPlugin,
|
|
5470
|
+
prepopPlugin
|
|
5365
5471
|
],
|
|
5472
|
+
urlParam: (name, backup = null) => {
|
|
5473
|
+
return urlParams.get(name) || backup;
|
|
5474
|
+
},
|
|
5366
5475
|
firstStep: () => {
|
|
5367
5476
|
return firstStep();
|
|
5368
5477
|
},
|
|
@@ -5376,34 +5485,53 @@ const dataDefaults = {
|
|
|
5376
5485
|
setPreviousStep();
|
|
5377
5486
|
},
|
|
5378
5487
|
setStep: (nextStep, validate2) => () => {
|
|
5379
|
-
console.debug("setStep:", nextStep, validate2);
|
|
5380
5488
|
setStep({ nextStep, validate: validate2 });
|
|
5381
5489
|
},
|
|
5382
|
-
setStepOrder: (target) => () => {
|
|
5383
|
-
setStepOrder(target);
|
|
5384
|
-
},
|
|
5385
|
-
redirect: (target) => () => {
|
|
5386
|
-
redirect("https://www.google.com");
|
|
5387
|
-
},
|
|
5388
|
-
log: (target) => () => {
|
|
5389
|
-
console.log("target:", target);
|
|
5390
|
-
},
|
|
5391
5490
|
stepIsValid: (stepName) => {
|
|
5392
5491
|
return steps[stepName].valid && steps[stepName].errorCount === 0;
|
|
5393
5492
|
},
|
|
5394
5493
|
stepIsEnabled: (stepName) => {
|
|
5395
|
-
|
|
5494
|
+
if (!enabledSteps().length) {
|
|
5495
|
+
return true;
|
|
5496
|
+
}
|
|
5497
|
+
return enabledSteps().indexOf(stepName) > -1;
|
|
5498
|
+
},
|
|
5499
|
+
inputIsEnabled: (node, key, inputName) => {
|
|
5500
|
+
if (!node || !key || !node.attrs.inputMap) {
|
|
5501
|
+
return true;
|
|
5502
|
+
}
|
|
5503
|
+
if (node.attrs.inputMap[key].indexOf(inputName) < 0) {
|
|
5504
|
+
return false;
|
|
5505
|
+
}
|
|
5506
|
+
return true;
|
|
5507
|
+
},
|
|
5508
|
+
getRedirect: (formData, node) => {
|
|
5509
|
+
if (!node || !node.props.attrs.redirectMap) {
|
|
5510
|
+
return;
|
|
5511
|
+
}
|
|
5512
|
+
return keyValOverlap(formData, node.props.attrs.redirectMap, false);
|
|
5396
5513
|
},
|
|
5397
|
-
submit: (postUrl, redirectUrl = null) => async (formData, node) => {
|
|
5514
|
+
submit: (postUrl, prepData2 = null, redirectUrl = null) => async (formData, node) => {
|
|
5515
|
+
if (prepData2 && prepData2 != "null") {
|
|
5516
|
+
if (!(prepData2 instanceof Function)) {
|
|
5517
|
+
throw "prepData must be a function";
|
|
5518
|
+
}
|
|
5519
|
+
formData = prepData2(formData);
|
|
5520
|
+
}
|
|
5521
|
+
let abort = false;
|
|
5398
5522
|
try {
|
|
5399
5523
|
const res = await postJSON(postUrl, formData);
|
|
5400
5524
|
node.clearErrors();
|
|
5401
|
-
alert("Submitted successfully!");
|
|
5402
5525
|
} catch (err) {
|
|
5403
|
-
|
|
5404
|
-
|
|
5526
|
+
abort = handleSubmitError(err, node);
|
|
5527
|
+
}
|
|
5528
|
+
if (abort) {
|
|
5529
|
+
return;
|
|
5405
5530
|
}
|
|
5406
|
-
if (redirectUrl) {
|
|
5531
|
+
if (redirectUrl instanceof Function) {
|
|
5532
|
+
redirectUrl = redirectUrl(formData, node);
|
|
5533
|
+
}
|
|
5534
|
+
if (redirectUrl && redirectUrl !== "null") {
|
|
5407
5535
|
if (formData) {
|
|
5408
5536
|
redirectUrl = strSubUrl(redirectUrl, formData);
|
|
5409
5537
|
}
|
|
@@ -5421,7 +5549,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
5421
5549
|
},
|
|
5422
5550
|
setup(__props) {
|
|
5423
5551
|
const props2 = __props;
|
|
5424
|
-
const
|
|
5552
|
+
const meta = {};
|
|
5553
|
+
for (var node of props2.schema) {
|
|
5554
|
+
if (!node.type || node.type !== "meta") {
|
|
5555
|
+
continue;
|
|
5556
|
+
}
|
|
5557
|
+
Object.assign(meta, node.data || {});
|
|
5558
|
+
}
|
|
5559
|
+
const mergedData = reactive(Object.assign({}, dataDefaults, { meta }, props2.data));
|
|
5425
5560
|
console.debug("FormKitSchema data:", mergedData);
|
|
5426
5561
|
return (_ctx, _cache) => {
|
|
5427
5562
|
const _component_FormKitSchema = resolveComponent("FormKitSchema");
|
|
@@ -5458,8 +5593,8 @@ function eq(valA, valB, deep = true, explicit = ["__key"]) {
|
|
|
5458
5593
|
return false;
|
|
5459
5594
|
if (Object.keys(valA).length !== Object.keys(valB).length)
|
|
5460
5595
|
return false;
|
|
5461
|
-
for (const
|
|
5462
|
-
if ((
|
|
5596
|
+
for (const k2 of explicit) {
|
|
5597
|
+
if ((k2 in valA || k2 in valB) && valA[k2] !== valB[k2])
|
|
5463
5598
|
return false;
|
|
5464
5599
|
}
|
|
5465
5600
|
for (const key in valA) {
|
|
@@ -5514,18 +5649,18 @@ function regexForFormat(format) {
|
|
|
5514
5649
|
return regex.replace(format2, formats[format2]);
|
|
5515
5650
|
}, escaped));
|
|
5516
5651
|
}
|
|
5517
|
-
function isRecord(
|
|
5518
|
-
return Object.prototype.toString.call(
|
|
5652
|
+
function isRecord(o2) {
|
|
5653
|
+
return Object.prototype.toString.call(o2) === "[object Object]";
|
|
5519
5654
|
}
|
|
5520
|
-
function isObject(
|
|
5521
|
-
return isRecord(
|
|
5655
|
+
function isObject(o2) {
|
|
5656
|
+
return isRecord(o2) || Array.isArray(o2);
|
|
5522
5657
|
}
|
|
5523
|
-
function isPojo(
|
|
5524
|
-
if (isRecord(
|
|
5658
|
+
function isPojo(o2) {
|
|
5659
|
+
if (isRecord(o2) === false)
|
|
5525
5660
|
return false;
|
|
5526
|
-
if (
|
|
5661
|
+
if (o2.__FKNode__ || o2.__POJO__ === false)
|
|
5527
5662
|
return false;
|
|
5528
|
-
const ctor =
|
|
5663
|
+
const ctor = o2.constructor;
|
|
5529
5664
|
if (ctor === void 0)
|
|
5530
5665
|
return true;
|
|
5531
5666
|
const prot = ctor.prototype;
|
|
@@ -5632,7 +5767,7 @@ function parseArgs(str) {
|
|
|
5632
5767
|
}
|
|
5633
5768
|
function except(obj, toRemove) {
|
|
5634
5769
|
const clean = {};
|
|
5635
|
-
const exps = toRemove.filter((
|
|
5770
|
+
const exps = toRemove.filter((n2) => n2 instanceof RegExp);
|
|
5636
5771
|
const keysToRemove = new Set(toRemove);
|
|
5637
5772
|
for (const key in obj) {
|
|
5638
5773
|
if (!keysToRemove.has(key) && !exps.some((exp) => exp.test(key))) {
|
|
@@ -5643,7 +5778,7 @@ function except(obj, toRemove) {
|
|
|
5643
5778
|
}
|
|
5644
5779
|
function only(obj, include) {
|
|
5645
5780
|
const clean = {};
|
|
5646
|
-
const exps = include.filter((
|
|
5781
|
+
const exps = include.filter((n2) => n2 instanceof RegExp);
|
|
5647
5782
|
include.forEach((key) => {
|
|
5648
5783
|
if (!(key instanceof RegExp)) {
|
|
5649
5784
|
clean[key] = obj[key];
|
|
@@ -5657,7 +5792,7 @@ function only(obj, include) {
|
|
|
5657
5792
|
return clean;
|
|
5658
5793
|
}
|
|
5659
5794
|
function camel(str) {
|
|
5660
|
-
return str.replace(/-([a-z0-9])/gi, (_s,
|
|
5795
|
+
return str.replace(/-([a-z0-9])/gi, (_s, g2) => g2.toUpperCase());
|
|
5661
5796
|
}
|
|
5662
5797
|
function kebab(str) {
|
|
5663
5798
|
return str.replace(/([a-z0-9])([A-Z])/g, (_s, trail, cap) => trail + "-" + cap.toLowerCase()).replace(" ", "-").toLowerCase();
|
|
@@ -5695,15 +5830,15 @@ function getAt(obj, addr) {
|
|
|
5695
5830
|
if (!obj || typeof obj !== "object")
|
|
5696
5831
|
return null;
|
|
5697
5832
|
const segments = addr.split(".");
|
|
5698
|
-
let
|
|
5833
|
+
let o2 = obj;
|
|
5699
5834
|
for (const i2 in segments) {
|
|
5700
5835
|
const segment = segments[i2];
|
|
5701
|
-
if (has(
|
|
5702
|
-
|
|
5836
|
+
if (has(o2, segment)) {
|
|
5837
|
+
o2 = o2[segment];
|
|
5703
5838
|
}
|
|
5704
5839
|
if (+i2 === segments.length - 1)
|
|
5705
|
-
return
|
|
5706
|
-
if (!
|
|
5840
|
+
return o2;
|
|
5841
|
+
if (!o2 || typeof o2 !== "object")
|
|
5707
5842
|
return null;
|
|
5708
5843
|
}
|
|
5709
5844
|
return null;
|
|
@@ -5823,7 +5958,7 @@ function bubble(node, _context, event) {
|
|
|
5823
5958
|
}
|
|
5824
5959
|
return node;
|
|
5825
5960
|
}
|
|
5826
|
-
function on(_node, context, name, listener) {
|
|
5961
|
+
function on$1(_node, context, name, listener) {
|
|
5827
5962
|
return context._e.on(name, listener);
|
|
5828
5963
|
}
|
|
5829
5964
|
function off(node, context, receipt) {
|
|
@@ -5852,18 +5987,18 @@ function error(code, data = {}) {
|
|
|
5852
5987
|
throw Error(errorHandler.dispatch({ code, data }).message);
|
|
5853
5988
|
}
|
|
5854
5989
|
function createMessage(conf, node) {
|
|
5855
|
-
const
|
|
5990
|
+
const m2 = __spreadValues({
|
|
5856
5991
|
blocking: false,
|
|
5857
5992
|
key: token(),
|
|
5858
5993
|
meta: {},
|
|
5859
5994
|
type: "state",
|
|
5860
5995
|
visible: true
|
|
5861
5996
|
}, conf);
|
|
5862
|
-
if (node &&
|
|
5863
|
-
|
|
5864
|
-
|
|
5997
|
+
if (node && m2.value && m2.meta.localize !== false) {
|
|
5998
|
+
m2.value = node.t(m2);
|
|
5999
|
+
m2.meta.locale = node.config.locale;
|
|
5865
6000
|
}
|
|
5866
|
-
return
|
|
6001
|
+
return m2;
|
|
5867
6002
|
}
|
|
5868
6003
|
const storeTraps = {
|
|
5869
6004
|
apply: applyMessages,
|
|
@@ -5932,9 +6067,9 @@ function setMessage(messageStore, store, node, message2) {
|
|
|
5932
6067
|
message2.meta.locale = node.props.locale;
|
|
5933
6068
|
}
|
|
5934
6069
|
}
|
|
5935
|
-
const
|
|
6070
|
+
const e2 = `message-${has(messageStore, message2.key) ? "updated" : "added"}`;
|
|
5936
6071
|
messageStore[message2.key] = Object.freeze(node.hook.message.dispatch(message2));
|
|
5937
|
-
node.emit(
|
|
6072
|
+
node.emit(e2, message2);
|
|
5938
6073
|
}
|
|
5939
6074
|
return store;
|
|
5940
6075
|
}
|
|
@@ -5952,7 +6087,7 @@ function removeMessage$1(messageStore, store, node, key) {
|
|
|
5952
6087
|
}
|
|
5953
6088
|
if (store.buffer === true) {
|
|
5954
6089
|
store._b = store._b.filter((buffered) => {
|
|
5955
|
-
buffered[0] = buffered[0].filter((
|
|
6090
|
+
buffered[0] = buffered[0].filter((m2) => m2.key !== key);
|
|
5956
6091
|
return buffered[1] || buffered[0].length;
|
|
5957
6092
|
});
|
|
5958
6093
|
}
|
|
@@ -6007,7 +6142,7 @@ function createMessages(node, ...errors2) {
|
|
|
6007
6142
|
value: error2,
|
|
6008
6143
|
meta: { source: sourceKey, autoClear: true }
|
|
6009
6144
|
});
|
|
6010
|
-
return errors2.filter((
|
|
6145
|
+
return errors2.filter((m2) => !!m2).map((errorSet) => {
|
|
6011
6146
|
if (typeof errorSet === "string")
|
|
6012
6147
|
errorSet = [errorSet];
|
|
6013
6148
|
if (Array.isArray(errorSet)) {
|
|
@@ -6057,19 +6192,19 @@ function releaseBuffer(_messageStore, store) {
|
|
|
6057
6192
|
}
|
|
6058
6193
|
function createLedger() {
|
|
6059
6194
|
const ledger = {};
|
|
6060
|
-
let
|
|
6195
|
+
let n2;
|
|
6061
6196
|
return {
|
|
6062
|
-
count: (...args) => createCounter(
|
|
6197
|
+
count: (...args) => createCounter(n2, ledger, ...args),
|
|
6063
6198
|
init(node) {
|
|
6064
|
-
|
|
6199
|
+
n2 = node;
|
|
6065
6200
|
node.on("message-added.deep", add(ledger, 1));
|
|
6066
6201
|
node.on("message-removed.deep", add(ledger, -1));
|
|
6067
6202
|
},
|
|
6068
|
-
merge: (child) => merge(
|
|
6203
|
+
merge: (child) => merge(n2, ledger, child),
|
|
6069
6204
|
settled(counterName) {
|
|
6070
6205
|
return has(ledger, counterName) ? ledger[counterName].promise : Promise.resolve();
|
|
6071
6206
|
},
|
|
6072
|
-
unmerge: (child) => merge(
|
|
6207
|
+
unmerge: (child) => merge(n2, ledger, child, true),
|
|
6073
6208
|
value(counterName) {
|
|
6074
6209
|
return has(ledger, counterName) ? ledger[counterName].count : 0;
|
|
6075
6210
|
}
|
|
@@ -6088,7 +6223,7 @@ function createCounter(node, ledger, counterName, condition, increment = 0) {
|
|
|
6088
6223
|
}
|
|
6089
6224
|
};
|
|
6090
6225
|
ledger[counterName] = counter;
|
|
6091
|
-
increment = node.store.reduce((sum,
|
|
6226
|
+
increment = node.store.reduce((sum, m2) => sum + counter.condition(m2) * 1, increment);
|
|
6092
6227
|
node.each((child) => {
|
|
6093
6228
|
child.ledger.count(counter.name, counter.condition);
|
|
6094
6229
|
increment += child.ledger.value(counter.name);
|
|
@@ -6100,7 +6235,7 @@ function parseCondition(condition) {
|
|
|
6100
6235
|
if (typeof condition === "function") {
|
|
6101
6236
|
return condition;
|
|
6102
6237
|
}
|
|
6103
|
-
return (
|
|
6238
|
+
return (m2) => m2.type === condition;
|
|
6104
6239
|
}
|
|
6105
6240
|
function count(counter, increment) {
|
|
6106
6241
|
const initial = counter.count;
|
|
@@ -6108,7 +6243,7 @@ function count(counter, increment) {
|
|
|
6108
6243
|
counter.count = post;
|
|
6109
6244
|
if (initial === 0 && post !== 0) {
|
|
6110
6245
|
counter.node.emit(`unsettled:${counter.name}`, counter.count, false);
|
|
6111
|
-
counter.promise = new Promise((
|
|
6246
|
+
counter.promise = new Promise((r2) => counter.resolve = r2);
|
|
6112
6247
|
} else if (initial !== 0 && post === 0) {
|
|
6113
6248
|
counter.node.emit(`settled:${counter.name}`, counter.count, false);
|
|
6114
6249
|
counter.resolve();
|
|
@@ -6117,10 +6252,10 @@ function count(counter, increment) {
|
|
|
6117
6252
|
return counter;
|
|
6118
6253
|
}
|
|
6119
6254
|
function add(ledger, delta) {
|
|
6120
|
-
return (
|
|
6255
|
+
return (e2) => {
|
|
6121
6256
|
for (const name in ledger) {
|
|
6122
6257
|
const counter = ledger[name];
|
|
6123
|
-
if (counter.condition(
|
|
6258
|
+
if (counter.condition(e2.payload)) {
|
|
6124
6259
|
count(counter, delta);
|
|
6125
6260
|
}
|
|
6126
6261
|
}
|
|
@@ -6191,11 +6326,11 @@ function createConfig$1(options2 = {}) {
|
|
|
6191
6326
|
_rm: (node) => node.remove(node)
|
|
6192
6327
|
});
|
|
6193
6328
|
const rootConfig = new Proxy(target, {
|
|
6194
|
-
set(
|
|
6329
|
+
set(t2, prop, value, r2) {
|
|
6195
6330
|
if (typeof prop === "string") {
|
|
6196
6331
|
nodes.forEach((node) => configChange(node, prop, value));
|
|
6197
6332
|
}
|
|
6198
|
-
return Reflect.set(
|
|
6333
|
+
return Reflect.set(t2, prop, value, r2);
|
|
6199
6334
|
}
|
|
6200
6335
|
});
|
|
6201
6336
|
return rootConfig;
|
|
@@ -6210,13 +6345,13 @@ function submitForm(id) {
|
|
|
6210
6345
|
warn(151, id);
|
|
6211
6346
|
}
|
|
6212
6347
|
function clearState(node) {
|
|
6213
|
-
const clear2 = (
|
|
6214
|
-
for (const key in
|
|
6215
|
-
const message2 =
|
|
6348
|
+
const clear2 = (n2) => {
|
|
6349
|
+
for (const key in n2.store) {
|
|
6350
|
+
const message2 = n2.store[key];
|
|
6216
6351
|
if (message2.type === "error" || message2.type === "ui" && key === "incomplete") {
|
|
6217
|
-
|
|
6352
|
+
n2.store.remove(key);
|
|
6218
6353
|
} else if (message2.type === "state") {
|
|
6219
|
-
|
|
6354
|
+
n2.store.set(__spreadProps(__spreadValues({}, message2), { value: false }));
|
|
6220
6355
|
}
|
|
6221
6356
|
}
|
|
6222
6357
|
};
|
|
@@ -6226,7 +6361,7 @@ function clearState(node) {
|
|
|
6226
6361
|
function reset(id, resetTo) {
|
|
6227
6362
|
const node = typeof id === "string" ? getNode$1(id) : id;
|
|
6228
6363
|
if (node) {
|
|
6229
|
-
const initial = (
|
|
6364
|
+
const initial = (n2) => cloneAny(n2.props.initial) || (n2.type === "group" ? {} : n2.type === "list" ? [] : void 0);
|
|
6230
6365
|
node._e.pause(node);
|
|
6231
6366
|
node.input(cloneAny(resetTo) || initial(node), false);
|
|
6232
6367
|
node.walk((child) => child.input(initial(child), false));
|
|
@@ -6278,7 +6413,7 @@ const traps = {
|
|
|
6278
6413
|
each: trap(eachChild),
|
|
6279
6414
|
emit: trap(emit$1),
|
|
6280
6415
|
find: trap(find),
|
|
6281
|
-
on: trap(on),
|
|
6416
|
+
on: trap(on$1),
|
|
6282
6417
|
off: trap(off),
|
|
6283
6418
|
parent: trap(false, setParent),
|
|
6284
6419
|
plugins: trap(false),
|
|
@@ -6578,7 +6713,7 @@ function walkTree(_node, context, callback, stopIfFalse = false) {
|
|
|
6578
6713
|
function resetConfig(node, context) {
|
|
6579
6714
|
const parent = node.parent || void 0;
|
|
6580
6715
|
context.config = createConfig(node.config._t, parent);
|
|
6581
|
-
node.walk((
|
|
6716
|
+
node.walk((n2) => n2.resetConfig());
|
|
6582
6717
|
}
|
|
6583
6718
|
function use(node, context, plugin2, run2 = true, library = true) {
|
|
6584
6719
|
if (Array.isArray(plugin2) || plugin2 instanceof Set) {
|
|
@@ -6656,7 +6791,7 @@ function getNode(node, _context, locator) {
|
|
|
6656
6791
|
pointer = node;
|
|
6657
6792
|
break;
|
|
6658
6793
|
default:
|
|
6659
|
-
pointer = pointer.children.find((
|
|
6794
|
+
pointer = pointer.children.find((c2) => String(c2.name) === String(name)) || select$3(pointer, name);
|
|
6660
6795
|
}
|
|
6661
6796
|
}
|
|
6662
6797
|
return pointer || void 0;
|
|
@@ -6679,7 +6814,7 @@ function find(node, _context, searchTerm, searcher) {
|
|
|
6679
6814
|
return bfs(node, searchTerm, searcher);
|
|
6680
6815
|
}
|
|
6681
6816
|
function bfs(tree, searchValue, searchGoal = "name") {
|
|
6682
|
-
const search2 = typeof searchGoal === "string" ? (
|
|
6817
|
+
const search2 = typeof searchGoal === "string" ? (n2) => n2[searchGoal] == searchValue : searchGoal;
|
|
6683
6818
|
const stack = [tree];
|
|
6684
6819
|
while (stack.length) {
|
|
6685
6820
|
const node = stack.shift();
|
|
@@ -6689,8 +6824,8 @@ function bfs(tree, searchValue, searchGoal = "name") {
|
|
|
6689
6824
|
}
|
|
6690
6825
|
return void 0;
|
|
6691
6826
|
}
|
|
6692
|
-
function getRoot(
|
|
6693
|
-
let node =
|
|
6827
|
+
function getRoot(n2) {
|
|
6828
|
+
let node = n2;
|
|
6694
6829
|
while (node.parent) {
|
|
6695
6830
|
node = node.parent;
|
|
6696
6831
|
}
|
|
@@ -6740,7 +6875,7 @@ function createConfig(target = {}, parent) {
|
|
|
6740
6875
|
if (node) {
|
|
6741
6876
|
node.emit(`config:${prop}`, value, false);
|
|
6742
6877
|
configChange(node, prop, value);
|
|
6743
|
-
node.walk((
|
|
6878
|
+
node.walk((n2) => configChange(n2, prop, value), true);
|
|
6744
6879
|
}
|
|
6745
6880
|
return didSet;
|
|
6746
6881
|
}
|
|
@@ -6958,36 +7093,36 @@ function sugar(node) {
|
|
|
6958
7093
|
function compile(expr) {
|
|
6959
7094
|
let provideTokens;
|
|
6960
7095
|
const requirements = /* @__PURE__ */ new Set();
|
|
6961
|
-
const
|
|
7096
|
+
const x2 = function expand(operand, tokens) {
|
|
6962
7097
|
return typeof operand === "function" ? operand(tokens) : operand;
|
|
6963
7098
|
};
|
|
6964
7099
|
const operatorRegistry = [
|
|
6965
7100
|
{
|
|
6966
|
-
"&&": (
|
|
6967
|
-
"||": (
|
|
7101
|
+
"&&": (l2, r2, t2) => x2(l2, t2) && x2(r2, t2),
|
|
7102
|
+
"||": (l2, r2, t2) => x2(l2, t2) || x2(r2, t2)
|
|
6968
7103
|
},
|
|
6969
7104
|
{
|
|
6970
|
-
"===": (
|
|
6971
|
-
"!==": (
|
|
6972
|
-
"==": (
|
|
6973
|
-
"!=": (
|
|
6974
|
-
">=": (
|
|
6975
|
-
"<=": (
|
|
6976
|
-
">": (
|
|
6977
|
-
"<": (
|
|
7105
|
+
"===": (l2, r2, t2) => !!(x2(l2, t2) === x2(r2, t2)),
|
|
7106
|
+
"!==": (l2, r2, t2) => !!(x2(l2, t2) !== x2(r2, t2)),
|
|
7107
|
+
"==": (l2, r2, t2) => !!(x2(l2, t2) == x2(r2, t2)),
|
|
7108
|
+
"!=": (l2, r2, t2) => !!(x2(l2, t2) != x2(r2, t2)),
|
|
7109
|
+
">=": (l2, r2, t2) => !!(x2(l2, t2) >= x2(r2, t2)),
|
|
7110
|
+
"<=": (l2, r2, t2) => !!(x2(l2, t2) <= x2(r2, t2)),
|
|
7111
|
+
">": (l2, r2, t2) => !!(x2(l2, t2) > x2(r2, t2)),
|
|
7112
|
+
"<": (l2, r2, t2) => !!(x2(l2, t2) < x2(r2, t2))
|
|
6978
7113
|
},
|
|
6979
7114
|
{
|
|
6980
|
-
"+": (
|
|
6981
|
-
"-": (
|
|
7115
|
+
"+": (l2, r2, t2) => x2(l2, t2) + x2(r2, t2),
|
|
7116
|
+
"-": (l2, r2, t2) => x2(l2, t2) - x2(r2, t2)
|
|
6982
7117
|
},
|
|
6983
7118
|
{
|
|
6984
|
-
"*": (
|
|
6985
|
-
"/": (
|
|
6986
|
-
"%": (
|
|
7119
|
+
"*": (l2, r2, t2) => x2(l2, t2) * x2(r2, t2),
|
|
7120
|
+
"/": (l2, r2, t2) => x2(l2, t2) / x2(r2, t2),
|
|
7121
|
+
"%": (l2, r2, t2) => x2(l2, t2) % x2(r2, t2)
|
|
6987
7122
|
}
|
|
6988
7123
|
];
|
|
6989
|
-
const operatorSymbols = operatorRegistry.reduce((s,
|
|
6990
|
-
return s.concat(Object.keys(
|
|
7124
|
+
const operatorSymbols = operatorRegistry.reduce((s, g2) => {
|
|
7125
|
+
return s.concat(Object.keys(g2));
|
|
6991
7126
|
}, []);
|
|
6992
7127
|
const operatorChars = new Set(operatorSymbols.map((key) => key.charAt(0)));
|
|
6993
7128
|
function getOp(symbols, char, p2, expression) {
|
|
@@ -7145,8 +7280,8 @@ function compile(expr) {
|
|
|
7145
7280
|
}
|
|
7146
7281
|
op = !op && left ? left : op;
|
|
7147
7282
|
if (!op && operand) {
|
|
7148
|
-
op = (v,
|
|
7149
|
-
return typeof v === "function" ? v(
|
|
7283
|
+
op = (v, t2) => {
|
|
7284
|
+
return typeof v === "function" ? v(t2) : v;
|
|
7150
7285
|
};
|
|
7151
7286
|
op = op.bind(null, evaluate(operand, step));
|
|
7152
7287
|
}
|
|
@@ -7172,7 +7307,7 @@ function compile(expr) {
|
|
|
7172
7307
|
if (tailCall) {
|
|
7173
7308
|
tailCall = tailCall.provide((subTokens) => {
|
|
7174
7309
|
const rootTokens = provideTokens(subTokens);
|
|
7175
|
-
const
|
|
7310
|
+
const t2 = subTokens.reduce((tokenSet, token2) => {
|
|
7176
7311
|
const isTail = token2 === tail || (tail === null || tail === void 0 ? void 0 : tail.startsWith(`${token2}(`));
|
|
7177
7312
|
if (isTail) {
|
|
7178
7313
|
const value = getAt(userFuncReturn, token2);
|
|
@@ -7182,7 +7317,7 @@ function compile(expr) {
|
|
|
7182
7317
|
}
|
|
7183
7318
|
return tokenSet;
|
|
7184
7319
|
}, {});
|
|
7185
|
-
return
|
|
7320
|
+
return t2;
|
|
7186
7321
|
});
|
|
7187
7322
|
}
|
|
7188
7323
|
return tailCall ? tailCall() : userFuncReturn;
|
|
@@ -7853,9 +7988,9 @@ function isSelected(node, option2) {
|
|
|
7853
7988
|
const value = optionValue(node.props.options, option2);
|
|
7854
7989
|
return Array.isArray(node._value) ? node._value.some((optionA) => shouldSelect(optionA, value)) : node.value === void 0 && !option2 || shouldSelect(value, node._value);
|
|
7855
7990
|
}
|
|
7856
|
-
function selectInput(node,
|
|
7857
|
-
const target =
|
|
7858
|
-
const value = target.hasAttribute("multiple") ? Array.from(target.selectedOptions).map((
|
|
7991
|
+
function selectInput(node, e2) {
|
|
7992
|
+
const target = e2.target;
|
|
7993
|
+
const value = target.hasAttribute("multiple") ? Array.from(target.selectedOptions).map((o2) => optionValue(node.props.options, o2.value)) : optionValue(node.props.options, target.value);
|
|
7859
7994
|
node.input(value);
|
|
7860
7995
|
}
|
|
7861
7996
|
function applyPlaceholder(options2, placeholder) {
|
|
@@ -7944,8 +8079,8 @@ function normalizeBoxes(node) {
|
|
|
7944
8079
|
return next(prop);
|
|
7945
8080
|
};
|
|
7946
8081
|
}
|
|
7947
|
-
function toggleChecked$1(node,
|
|
7948
|
-
const el =
|
|
8082
|
+
function toggleChecked$1(node, e2) {
|
|
8083
|
+
const el = e2.target;
|
|
7949
8084
|
if (el instanceof HTMLInputElement) {
|
|
7950
8085
|
const value = Array.isArray(node.props.options) ? optionValue(node.props.options, el.value) : el.value;
|
|
7951
8086
|
if (Array.isArray(node.props.options) && node.props.options.length) {
|
|
@@ -8034,8 +8169,8 @@ function disables(node) {
|
|
|
8034
8169
|
async function handleSubmit(node, submitEvent) {
|
|
8035
8170
|
submitEvent.preventDefault();
|
|
8036
8171
|
await node.settled;
|
|
8037
|
-
node.walk((
|
|
8038
|
-
|
|
8172
|
+
node.walk((n2) => {
|
|
8173
|
+
n2.store.set(createMessage({
|
|
8039
8174
|
key: "submitted",
|
|
8040
8175
|
value: true,
|
|
8041
8176
|
visible: false
|
|
@@ -8109,19 +8244,19 @@ function localize(key, value) {
|
|
|
8109
8244
|
};
|
|
8110
8245
|
}
|
|
8111
8246
|
const isBrowser = typeof window !== "undefined";
|
|
8112
|
-
function removeHover(
|
|
8113
|
-
if (
|
|
8114
|
-
|
|
8247
|
+
function removeHover(e2) {
|
|
8248
|
+
if (e2.target instanceof HTMLElement && e2.target.hasAttribute("data-file-hover")) {
|
|
8249
|
+
e2.target.removeAttribute("data-file-hover");
|
|
8115
8250
|
}
|
|
8116
8251
|
}
|
|
8117
|
-
function preventStrayDrop(type,
|
|
8118
|
-
if (!(
|
|
8119
|
-
|
|
8252
|
+
function preventStrayDrop(type, e2) {
|
|
8253
|
+
if (!(e2.target instanceof HTMLInputElement)) {
|
|
8254
|
+
e2.preventDefault();
|
|
8120
8255
|
} else if (type === "dragover") {
|
|
8121
|
-
|
|
8256
|
+
e2.target.setAttribute("data-file-hover", "true");
|
|
8122
8257
|
}
|
|
8123
8258
|
if (type === "drop") {
|
|
8124
|
-
removeHover(
|
|
8259
|
+
removeHover(e2);
|
|
8125
8260
|
}
|
|
8126
8261
|
}
|
|
8127
8262
|
function files(node) {
|
|
@@ -8142,8 +8277,8 @@ function files(node) {
|
|
|
8142
8277
|
}
|
|
8143
8278
|
if (!node.context)
|
|
8144
8279
|
return;
|
|
8145
|
-
node.context.handlers.resetFiles = (
|
|
8146
|
-
|
|
8280
|
+
node.context.handlers.resetFiles = (e2) => {
|
|
8281
|
+
e2.preventDefault();
|
|
8147
8282
|
node.input([]);
|
|
8148
8283
|
if (node.props.id && isBrowser) {
|
|
8149
8284
|
const el = document.getElementById(node.props.id);
|
|
@@ -8151,13 +8286,13 @@ function files(node) {
|
|
|
8151
8286
|
el.value = "";
|
|
8152
8287
|
}
|
|
8153
8288
|
};
|
|
8154
|
-
node.context.handlers.files = (
|
|
8289
|
+
node.context.handlers.files = (e2) => {
|
|
8155
8290
|
var _a, _b;
|
|
8156
8291
|
const files2 = [];
|
|
8157
|
-
if (
|
|
8158
|
-
for (let i2 = 0; i2 <
|
|
8292
|
+
if (e2.target instanceof HTMLInputElement && e2.target.files) {
|
|
8293
|
+
for (let i2 = 0; i2 < e2.target.files.length; i2++) {
|
|
8159
8294
|
let file2;
|
|
8160
|
-
if (file2 =
|
|
8295
|
+
if (file2 = e2.target.files.item(i2)) {
|
|
8161
8296
|
files2.push({ name: file2.name, file: file2 });
|
|
8162
8297
|
}
|
|
8163
8298
|
}
|
|
@@ -8166,7 +8301,7 @@ function files(node) {
|
|
|
8166
8301
|
if (node.context)
|
|
8167
8302
|
node.context.files = files2;
|
|
8168
8303
|
if (typeof ((_a = node.props.attrs) === null || _a === void 0 ? void 0 : _a.onChange) === "function") {
|
|
8169
|
-
(_b = node.props.attrs) === null || _b === void 0 ? void 0 : _b.onChange(
|
|
8304
|
+
(_b = node.props.attrs) === null || _b === void 0 ? void 0 : _b.onChange(e2);
|
|
8170
8305
|
}
|
|
8171
8306
|
};
|
|
8172
8307
|
});
|
|
@@ -8347,8 +8482,8 @@ const between = function between2({ value }, from, to) {
|
|
|
8347
8482
|
const val = 1 * value;
|
|
8348
8483
|
from = Number(from);
|
|
8349
8484
|
to = Number(to);
|
|
8350
|
-
const [
|
|
8351
|
-
return val >= 1 *
|
|
8485
|
+
const [a2, b2] = from <= to ? [from, to] : [to, from];
|
|
8486
|
+
return val >= 1 * a2 && val <= 1 * b2;
|
|
8352
8487
|
}
|
|
8353
8488
|
return false;
|
|
8354
8489
|
};
|
|
@@ -8724,7 +8859,7 @@ function run(current, validations, node, state, removeImmediately, complete) {
|
|
|
8724
8859
|
if ((!empty(node.value) || !validation.skipEmpty) && (state.isPassing || validation.force)) {
|
|
8725
8860
|
if (validation.queued) {
|
|
8726
8861
|
runRule(validation, node, (result) => {
|
|
8727
|
-
result instanceof Promise ? result.then((
|
|
8862
|
+
result instanceof Promise ? result.then((r2) => next(true, r2)) : next(false, result);
|
|
8728
8863
|
});
|
|
8729
8864
|
} else {
|
|
8730
8865
|
run(current + 1, validations, node, state, removeImmediately, complete);
|
|
@@ -8958,8 +9093,8 @@ const validation$m = {
|
|
|
8958
9093
|
if (isNaN(args[0]) || isNaN(args[1])) {
|
|
8959
9094
|
return `This field was configured incorrectly and can\u2019t be submitted.`;
|
|
8960
9095
|
}
|
|
8961
|
-
const [
|
|
8962
|
-
return `${sentence(name)} must be between ${
|
|
9096
|
+
const [a2, b2] = order(args[0], args[1]);
|
|
9097
|
+
return `${sentence(name)} must be between ${a2} and ${b2}.`;
|
|
8963
9098
|
},
|
|
8964
9099
|
confirm({ name }) {
|
|
8965
9100
|
return `${sentence(name)} does not match.`;
|
|
@@ -9051,11 +9186,11 @@ function createI18nPlugin(registry2) {
|
|
|
9051
9186
|
var _a, _b;
|
|
9052
9187
|
const key = ((_a = fragment2.meta) === null || _a === void 0 ? void 0 : _a.messageKey) || fragment2.key;
|
|
9053
9188
|
if (has(locale, fragment2.type) && has(locale[fragment2.type], key)) {
|
|
9054
|
-
const
|
|
9055
|
-
if (typeof
|
|
9056
|
-
fragment2.value = Array.isArray((_b = fragment2.meta) === null || _b === void 0 ? void 0 : _b.i18nArgs) ?
|
|
9189
|
+
const t2 = locale[fragment2.type][key];
|
|
9190
|
+
if (typeof t2 === "function") {
|
|
9191
|
+
fragment2.value = Array.isArray((_b = fragment2.meta) === null || _b === void 0 ? void 0 : _b.i18nArgs) ? t2(...fragment2.meta.i18nArgs) : t2(fragment2);
|
|
9057
9192
|
} else {
|
|
9058
|
-
fragment2.value =
|
|
9193
|
+
fragment2.value = t2;
|
|
9059
9194
|
}
|
|
9060
9195
|
}
|
|
9061
9196
|
return next(fragment2);
|
|
@@ -9182,25 +9317,25 @@ function parseSchema(library, schema) {
|
|
|
9182
9317
|
function parseConditionAttr(attr, _default2) {
|
|
9183
9318
|
var _a, _b;
|
|
9184
9319
|
const condition = provider(compile(attr.if));
|
|
9185
|
-
let
|
|
9186
|
-
let
|
|
9320
|
+
let b2 = () => _default2;
|
|
9321
|
+
let a2 = () => _default2;
|
|
9187
9322
|
if (typeof attr.then === "object") {
|
|
9188
|
-
|
|
9323
|
+
a2 = parseAttrs(attr.then, void 0);
|
|
9189
9324
|
} else if (typeof attr.then === "string" && ((_a = attr.then) === null || _a === void 0 ? void 0 : _a.startsWith("$"))) {
|
|
9190
|
-
|
|
9325
|
+
a2 = provider(compile(attr.then));
|
|
9191
9326
|
} else {
|
|
9192
|
-
|
|
9327
|
+
a2 = () => attr.then;
|
|
9193
9328
|
}
|
|
9194
9329
|
if (has(attr, "else")) {
|
|
9195
9330
|
if (typeof attr.else === "object") {
|
|
9196
|
-
|
|
9331
|
+
b2 = parseAttrs(attr.else);
|
|
9197
9332
|
} else if (typeof attr.else === "string" && ((_b = attr.else) === null || _b === void 0 ? void 0 : _b.startsWith("$"))) {
|
|
9198
|
-
|
|
9333
|
+
b2 = provider(compile(attr.else));
|
|
9199
9334
|
} else {
|
|
9200
|
-
|
|
9335
|
+
b2 = () => attr.else;
|
|
9201
9336
|
}
|
|
9202
9337
|
}
|
|
9203
|
-
return () => condition() ?
|
|
9338
|
+
return () => condition() ? a2() : b2();
|
|
9204
9339
|
}
|
|
9205
9340
|
function parseAttrs(unparsedAttrs, bindExp, _default2 = {}) {
|
|
9206
9341
|
const explicitAttrs = new Set(Object.keys(unparsedAttrs || {}));
|
|
@@ -9293,8 +9428,8 @@ function parseSchema(library, schema) {
|
|
|
9293
9428
|
} else if (Array.isArray(node.children)) {
|
|
9294
9429
|
children = createElements(library2, node.children);
|
|
9295
9430
|
} else {
|
|
9296
|
-
const [childCondition,
|
|
9297
|
-
children = (iterationData) => childCondition && childCondition() ?
|
|
9431
|
+
const [childCondition, c2, a2] = parseCondition2(library2, node.children);
|
|
9432
|
+
children = (iterationData) => childCondition && childCondition() ? c2 && c2(iterationData) : a2 && a2(iterationData);
|
|
9298
9433
|
}
|
|
9299
9434
|
}
|
|
9300
9435
|
if (isComponent(node)) {
|
|
@@ -9311,13 +9446,13 @@ function parseSchema(library, schema) {
|
|
|
9311
9446
|
(_a = instanceScopes.get(instanceKey)) === null || _a === void 0 ? void 0 : _a.unshift(slotData2);
|
|
9312
9447
|
if (iterationData)
|
|
9313
9448
|
(_b = instanceScopes.get(instanceKey)) === null || _b === void 0 ? void 0 : _b.unshift(iterationData);
|
|
9314
|
-
const
|
|
9449
|
+
const c2 = produceChildren(iterationData);
|
|
9315
9450
|
if (slotData2)
|
|
9316
9451
|
(_c = instanceScopes.get(instanceKey)) === null || _c === void 0 ? void 0 : _c.shift();
|
|
9317
9452
|
if (iterationData)
|
|
9318
9453
|
(_d = instanceScopes.get(instanceKey)) === null || _d === void 0 ? void 0 : _d.shift();
|
|
9319
9454
|
instanceKey = currentKey;
|
|
9320
|
-
return
|
|
9455
|
+
return c2;
|
|
9321
9456
|
}
|
|
9322
9457
|
};
|
|
9323
9458
|
};
|
|
@@ -9362,7 +9497,7 @@ function parseSchema(library, schema) {
|
|
|
9362
9497
|
return children(iterationData);
|
|
9363
9498
|
const el = resolve2 ? resolveComponent(element) : element;
|
|
9364
9499
|
const slots = (children === null || children === void 0 ? void 0 : children.slot) ? createSlots(children, iterationData) : null;
|
|
9365
|
-
return h(el, attrs(), slots || (children ? children(iterationData) : []));
|
|
9500
|
+
return h$1(el, attrs(), slots || (children ? children(iterationData) : []));
|
|
9366
9501
|
}
|
|
9367
9502
|
return typeof alternate === "function" ? alternate(iterationData) : alternate;
|
|
9368
9503
|
};
|
|
@@ -9466,7 +9601,7 @@ function createRenderFn(instanceCreator, data, instanceKey2) {
|
|
|
9466
9601
|
}, {});
|
|
9467
9602
|
}, instanceKey2);
|
|
9468
9603
|
}
|
|
9469
|
-
let i = 0;
|
|
9604
|
+
let i$3 = 0;
|
|
9470
9605
|
const FormKitSchema = defineComponent({
|
|
9471
9606
|
name: "FormKitSchema",
|
|
9472
9607
|
props: {
|
|
@@ -9485,14 +9620,14 @@ const FormKitSchema = defineComponent({
|
|
|
9485
9620
|
},
|
|
9486
9621
|
setup(props2, context) {
|
|
9487
9622
|
const instance = getCurrentInstance();
|
|
9488
|
-
let instanceKey2 = Symbol(String(i++));
|
|
9623
|
+
let instanceKey2 = Symbol(String(i$3++));
|
|
9489
9624
|
instanceScopes.set(instanceKey2, []);
|
|
9490
9625
|
let provider = parseSchema(props2.library, props2.schema);
|
|
9491
9626
|
let render;
|
|
9492
9627
|
let data;
|
|
9493
9628
|
watch$1(() => props2.schema, (newSchema, oldSchema) => {
|
|
9494
9629
|
var _a;
|
|
9495
|
-
instanceKey2 = Symbol(String(i++));
|
|
9630
|
+
instanceKey2 = Symbol(String(i$3++));
|
|
9496
9631
|
provider = parseSchema(props2.library, props2.schema);
|
|
9497
9632
|
render = createRenderFn(provider, data, instanceKey2);
|
|
9498
9633
|
if (newSchema === oldSchema) {
|
|
@@ -9597,7 +9732,7 @@ const FormKit = defineComponent({
|
|
|
9597
9732
|
if (node.props.definition.component) {
|
|
9598
9733
|
return () => {
|
|
9599
9734
|
var _a;
|
|
9600
|
-
return h((_a = node.props.definition) === null || _a === void 0 ? void 0 : _a.component, {
|
|
9735
|
+
return h$1((_a = node.props.definition) === null || _a === void 0 ? void 0 : _a.component, {
|
|
9601
9736
|
context: node.context
|
|
9602
9737
|
}, __spreadValues({}, context.slots));
|
|
9603
9738
|
};
|
|
@@ -9615,7 +9750,7 @@ const FormKit = defineComponent({
|
|
|
9615
9750
|
context.emit("node", node);
|
|
9616
9751
|
const library = node.props.definition.library;
|
|
9617
9752
|
context.expose({ node });
|
|
9618
|
-
return () => h(FormKitSchema, { schema: schema.value, data: node.context, library }, __spreadValues({}, context.slots));
|
|
9753
|
+
return () => h$1(FormKitSchema, { schema: schema.value, data: node.context, library }, __spreadValues({}, context.slots));
|
|
9619
9754
|
}
|
|
9620
9755
|
});
|
|
9621
9756
|
function createPlugin$4(app, options2) {
|
|
@@ -9924,9 +10059,9 @@ function useInput(props2, context, options2 = {}) {
|
|
|
9924
10059
|
return node;
|
|
9925
10060
|
}
|
|
9926
10061
|
const vueBindings = function vueBindings2(node) {
|
|
9927
|
-
node.ledger.count("blocking", (
|
|
10062
|
+
node.ledger.count("blocking", (m2) => m2.blocking);
|
|
9928
10063
|
const isValid = ref(!node.ledger.value("blocking"));
|
|
9929
|
-
node.ledger.count("errors", (
|
|
10064
|
+
node.ledger.count("errors", (m2) => m2.type === "error");
|
|
9930
10065
|
const hasErrors = ref(!!node.ledger.value("errors"));
|
|
9931
10066
|
let hasTicked = false;
|
|
9932
10067
|
nextTick(() => {
|
|
@@ -10032,9 +10167,9 @@ const vueBindings = function vueBindings2(node) {
|
|
|
10032
10167
|
touch: () => {
|
|
10033
10168
|
node.store.set(createMessage({ key: "dirty", visible: false, value: true }));
|
|
10034
10169
|
},
|
|
10035
|
-
DOMInput: (
|
|
10036
|
-
node.input(
|
|
10037
|
-
node.emit("dom-input-event",
|
|
10170
|
+
DOMInput: (e2) => {
|
|
10171
|
+
node.input(e2.target.value);
|
|
10172
|
+
node.emit("dom-input-event", e2);
|
|
10038
10173
|
}
|
|
10039
10174
|
},
|
|
10040
10175
|
help: node.props.help,
|
|
@@ -10125,8 +10260,8 @@ const vueBindings = function vueBindings2(node) {
|
|
|
10125
10260
|
context.state[message2.key] = !!message2.value;
|
|
10126
10261
|
}
|
|
10127
10262
|
};
|
|
10128
|
-
node.on("message-added", (
|
|
10129
|
-
node.on("message-updated", (
|
|
10263
|
+
node.on("message-added", (e2) => updateState(e2.payload));
|
|
10264
|
+
node.on("message-updated", (e2) => updateState(e2.payload));
|
|
10130
10265
|
node.on("message-removed", ({ payload: message2 }) => {
|
|
10131
10266
|
delete ui[message2.key];
|
|
10132
10267
|
delete availableMessages[message2.key];
|
|
@@ -10285,6 +10420,258 @@ plugin(({ addVariant }) => {
|
|
|
10285
10420
|
'[data-message-type="error"]&'
|
|
10286
10421
|
]);
|
|
10287
10422
|
});
|
|
10423
|
+
var e = "undefined", o$1 = "object", g$1 = "any", m = "*", j = "__", F$1 = typeof process != "undefined" ? process : {};
|
|
10424
|
+
F$1.env && F$1.env.NODE_ENV || "";
|
|
10425
|
+
var $ = typeof window != "undefined";
|
|
10426
|
+
F$1.versions != null && F$1.versions.node != null;
|
|
10427
|
+
typeof Deno != "undefined" && Deno.core !== void 0;
|
|
10428
|
+
$ && window.name === "nodejs" || typeof navigator != "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
10429
|
+
function M(n2, t2) {
|
|
10430
|
+
return t2.charAt(0)[n2]() + t2.slice(1);
|
|
10431
|
+
}
|
|
10432
|
+
var U = M.bind(null, "toUpperCase"), H = M.bind(null, "toLowerCase");
|
|
10433
|
+
function J(n2) {
|
|
10434
|
+
return Y(n2) ? U("null") : typeof n2 == "object" ? yn(n2) : Object.prototype.toString.call(n2).slice(8, -1);
|
|
10435
|
+
}
|
|
10436
|
+
function R(n2, t2) {
|
|
10437
|
+
t2 === void 0 && (t2 = true);
|
|
10438
|
+
var e2 = J(n2);
|
|
10439
|
+
return t2 ? H(e2) : e2;
|
|
10440
|
+
}
|
|
10441
|
+
function V(n2, t2) {
|
|
10442
|
+
return typeof t2 === n2;
|
|
10443
|
+
}
|
|
10444
|
+
var W = V.bind(null, "function"), q = V.bind(null, "string"), I$1 = V.bind(null, "undefined");
|
|
10445
|
+
V.bind(null, "boolean");
|
|
10446
|
+
V.bind(null, "symbol");
|
|
10447
|
+
function Y(n2) {
|
|
10448
|
+
return n2 === null;
|
|
10449
|
+
}
|
|
10450
|
+
function nn(n2) {
|
|
10451
|
+
return R(n2) === "number" && !isNaN(n2);
|
|
10452
|
+
}
|
|
10453
|
+
function on(n2) {
|
|
10454
|
+
if (!un(n2))
|
|
10455
|
+
return false;
|
|
10456
|
+
for (var t2 = n2; Object.getPrototypeOf(t2) !== null; )
|
|
10457
|
+
t2 = Object.getPrototypeOf(t2);
|
|
10458
|
+
return Object.getPrototypeOf(n2) === t2;
|
|
10459
|
+
}
|
|
10460
|
+
function un(n2) {
|
|
10461
|
+
return n2 && (typeof n2 == "object" || n2 !== null);
|
|
10462
|
+
}
|
|
10463
|
+
function yn(n2) {
|
|
10464
|
+
return W(n2.constructor) ? n2.constructor.name : null;
|
|
10465
|
+
}
|
|
10466
|
+
function hn(n2) {
|
|
10467
|
+
return n2 instanceof Error || q(n2.message) && n2.constructor && nn(n2.constructor.stackTraceLimit);
|
|
10468
|
+
}
|
|
10469
|
+
function On(n2, t2) {
|
|
10470
|
+
if (typeof t2 != "object" || Y(t2))
|
|
10471
|
+
return false;
|
|
10472
|
+
if (t2 instanceof n2)
|
|
10473
|
+
return true;
|
|
10474
|
+
var e2 = R(new n2(""));
|
|
10475
|
+
if (hn(t2))
|
|
10476
|
+
for (; t2; ) {
|
|
10477
|
+
if (R(t2) === e2)
|
|
10478
|
+
return true;
|
|
10479
|
+
t2 = Object.getPrototypeOf(t2);
|
|
10480
|
+
}
|
|
10481
|
+
return false;
|
|
10482
|
+
}
|
|
10483
|
+
On.bind(null, TypeError);
|
|
10484
|
+
On.bind(null, SyntaxError);
|
|
10485
|
+
function $n(n2, t2) {
|
|
10486
|
+
var e2 = n2 instanceof Element || n2 instanceof HTMLDocument;
|
|
10487
|
+
return e2 && t2 ? Tn(n2, t2) : e2;
|
|
10488
|
+
}
|
|
10489
|
+
function Tn(n2, t2) {
|
|
10490
|
+
return t2 === void 0 && (t2 = ""), n2 && n2.nodeName === t2.toUpperCase();
|
|
10491
|
+
}
|
|
10492
|
+
function _n(n2) {
|
|
10493
|
+
var t2 = [].slice.call(arguments, 1);
|
|
10494
|
+
return function() {
|
|
10495
|
+
return n2.apply(void 0, [].slice.call(arguments).concat(t2));
|
|
10496
|
+
};
|
|
10497
|
+
}
|
|
10498
|
+
_n($n, "form");
|
|
10499
|
+
_n($n, "button");
|
|
10500
|
+
_n($n, "input");
|
|
10501
|
+
_n($n, "select");
|
|
10502
|
+
var l = "global", o = j + "global" + j, n = typeof self === o$1 && self.self === self && self || typeof global === o$1 && global.global === global && global || void 0;
|
|
10503
|
+
function a$2(t2) {
|
|
10504
|
+
return n[o][t2];
|
|
10505
|
+
}
|
|
10506
|
+
function f(t2, e2) {
|
|
10507
|
+
return n[o][t2] = e2;
|
|
10508
|
+
}
|
|
10509
|
+
function i$2(t2) {
|
|
10510
|
+
delete n[o][t2];
|
|
10511
|
+
}
|
|
10512
|
+
function u$1(t2, e2, r2) {
|
|
10513
|
+
var l2;
|
|
10514
|
+
try {
|
|
10515
|
+
if (b(t2)) {
|
|
10516
|
+
var o2 = window[t2];
|
|
10517
|
+
l2 = o2[e2].bind(o2);
|
|
10518
|
+
}
|
|
10519
|
+
} catch (t3) {
|
|
10520
|
+
}
|
|
10521
|
+
return l2 || r2;
|
|
10522
|
+
}
|
|
10523
|
+
n[o] || (n[o] = {});
|
|
10524
|
+
var c$1 = {};
|
|
10525
|
+
function b(t2) {
|
|
10526
|
+
if (typeof c$1[t2] !== e)
|
|
10527
|
+
return c$1[t2];
|
|
10528
|
+
try {
|
|
10529
|
+
var e$1 = window[t2];
|
|
10530
|
+
e$1.setItem(e, e), e$1.removeItem(e);
|
|
10531
|
+
} catch (e2) {
|
|
10532
|
+
return c$1[t2] = false;
|
|
10533
|
+
}
|
|
10534
|
+
return c$1[t2] = true;
|
|
10535
|
+
}
|
|
10536
|
+
var t = "cookie", i$1 = a$1(), r$1 = d$1, c = d$1;
|
|
10537
|
+
function u(o2) {
|
|
10538
|
+
return i$1 ? d$1(o2, "", -1) : i$2(o2);
|
|
10539
|
+
}
|
|
10540
|
+
function a$1() {
|
|
10541
|
+
if (i$1 !== void 0)
|
|
10542
|
+
return i$1;
|
|
10543
|
+
var e2 = "cookiecookie";
|
|
10544
|
+
try {
|
|
10545
|
+
d$1(e2, e2), i$1 = document.cookie.indexOf(e2) !== -1, u(e2);
|
|
10546
|
+
} catch (e3) {
|
|
10547
|
+
i$1 = false;
|
|
10548
|
+
}
|
|
10549
|
+
return i$1;
|
|
10550
|
+
}
|
|
10551
|
+
function d$1(e2, t2, r2, c2, u2, a2) {
|
|
10552
|
+
if (typeof window != "undefined") {
|
|
10553
|
+
var d2 = arguments.length > 1;
|
|
10554
|
+
return i$1 === false && (d2 ? f(e2, t2) : a$2(e2)), d2 ? document.cookie = e2 + "=" + encodeURIComponent(t2) + (r2 ? "; expires=" + new Date(+new Date() + 1e3 * r2).toUTCString() + (c2 ? "; path=" + c2 : "") + (u2 ? "; domain=" + u2 : "") + (a2 ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + e2 + "=")[1] || "").split(";")[0]);
|
|
10555
|
+
}
|
|
10556
|
+
}
|
|
10557
|
+
var r = "localStorage", g = b.bind(null, "localStorage");
|
|
10558
|
+
u$1("localStorage", "getItem", a$2);
|
|
10559
|
+
u$1("localStorage", "setItem", f);
|
|
10560
|
+
u$1("localStorage", "removeItem", i$2);
|
|
10561
|
+
var a = "sessionStorage", i = b.bind(null, "sessionStorage");
|
|
10562
|
+
u$1("sessionStorage", "getItem", a$2);
|
|
10563
|
+
u$1("sessionStorage", "setItem", f);
|
|
10564
|
+
u$1("sessionStorage", "removeItem", i$2);
|
|
10565
|
+
function I(t2) {
|
|
10566
|
+
var o2 = t2;
|
|
10567
|
+
try {
|
|
10568
|
+
if ((o2 = JSON.parse(t2)) === "true")
|
|
10569
|
+
return true;
|
|
10570
|
+
if (o2 === "false")
|
|
10571
|
+
return false;
|
|
10572
|
+
if (on(o2))
|
|
10573
|
+
return o2;
|
|
10574
|
+
parseFloat(o2) === o2 && (o2 = parseFloat(o2));
|
|
10575
|
+
} catch (t3) {
|
|
10576
|
+
}
|
|
10577
|
+
if (o2 !== null && o2 !== "")
|
|
10578
|
+
return o2;
|
|
10579
|
+
}
|
|
10580
|
+
var k = g(), O = i(), x = a$1();
|
|
10581
|
+
function C(o2, e2) {
|
|
10582
|
+
if (o2) {
|
|
10583
|
+
var r2 = A(e2), a2 = !N(r2), i2 = d(r2) ? I(localStorage.getItem(o2)) : void 0;
|
|
10584
|
+
if (a2 && !I$1(i2))
|
|
10585
|
+
return i2;
|
|
10586
|
+
var n2 = h(r2) ? I(r$1(o2)) : void 0;
|
|
10587
|
+
if (a2 && n2)
|
|
10588
|
+
return n2;
|
|
10589
|
+
var l2 = E(r2) ? I(sessionStorage.getItem(o2)) : void 0;
|
|
10590
|
+
if (a2 && l2)
|
|
10591
|
+
return l2;
|
|
10592
|
+
var u2 = a$2(o2);
|
|
10593
|
+
return a2 ? u2 : { localStorage: i2, sessionStorage: l2, cookie: n2, global: u2 };
|
|
10594
|
+
}
|
|
10595
|
+
}
|
|
10596
|
+
function L(r$2, a$12, l$1) {
|
|
10597
|
+
if (r$2 && !I$1(a$12)) {
|
|
10598
|
+
var u2 = {}, g2 = A(l$1), m2 = JSON.stringify(a$12), S = !N(g2);
|
|
10599
|
+
return d(g2) && (u2[r] = F(r, a$12, I(localStorage.getItem(r$2))), localStorage.setItem(r$2, m2), S) ? u2[r] : h(g2) && (u2[t] = F(t, a$12, I(r$1(r$2))), c(r$2, m2), S) ? u2[t] : E(g2) && (u2[a] = F(a, a$12, I(sessionStorage.getItem(r$2))), sessionStorage.setItem(r$2, m2), S) ? u2[a] : (u2[l] = F(l, a$12, a$2(r$2)), f(r$2, a$12), S ? u2[l] : u2);
|
|
10600
|
+
}
|
|
10601
|
+
}
|
|
10602
|
+
function A(t2) {
|
|
10603
|
+
return t2 ? q(t2) ? t2 : t2.storage : g$1;
|
|
10604
|
+
}
|
|
10605
|
+
function d(t2) {
|
|
10606
|
+
return k && G(t2, r);
|
|
10607
|
+
}
|
|
10608
|
+
function h(t$1) {
|
|
10609
|
+
return x && G(t$1, t);
|
|
10610
|
+
}
|
|
10611
|
+
function E(t2) {
|
|
10612
|
+
return O && G(t2, a);
|
|
10613
|
+
}
|
|
10614
|
+
function N(t2) {
|
|
10615
|
+
return t2 === m || t2 === "all";
|
|
10616
|
+
}
|
|
10617
|
+
function G(t2, o2) {
|
|
10618
|
+
return t2 === g$1 || t2 === o2 || N(t2);
|
|
10619
|
+
}
|
|
10620
|
+
function F(t2, o2, e2) {
|
|
10621
|
+
return { location: t2, current: o2, previous: e2 };
|
|
10622
|
+
}
|
|
10623
|
+
const EXPERIMENT_KEY = "__form_experiments";
|
|
10624
|
+
function chooseVariant(exp) {
|
|
10625
|
+
let variant = null, active = {}, fromCache = false;
|
|
10626
|
+
active = C(EXPERIMENT_KEY) || {};
|
|
10627
|
+
if (!exp.noCache && active && active[exp.name]) {
|
|
10628
|
+
variant = active[exp.name];
|
|
10629
|
+
fromCache = true;
|
|
10630
|
+
} else {
|
|
10631
|
+
const vs = exp.variants;
|
|
10632
|
+
variant = vs[Math.floor(Math.random() * vs.length)];
|
|
10633
|
+
active[exp.name] = variant;
|
|
10634
|
+
L(EXPERIMENT_KEY, active);
|
|
10635
|
+
}
|
|
10636
|
+
console.debug("Chose variant:", variant, "fromCache:", fromCache);
|
|
10637
|
+
return { variant, fromCache };
|
|
10638
|
+
}
|
|
10639
|
+
async function schemaFromUrl(url3) {
|
|
10640
|
+
console.debug("Fetching:", url3);
|
|
10641
|
+
const res = await fetch(url3);
|
|
10642
|
+
schemaObj = await res.json();
|
|
10643
|
+
console.debug("Got schema:", schemaObj);
|
|
10644
|
+
return schemaObj;
|
|
10645
|
+
}
|
|
10646
|
+
const flattenObj = (obj) => {
|
|
10647
|
+
const flattened = {};
|
|
10648
|
+
Object.keys(obj).forEach((key) => {
|
|
10649
|
+
const value = obj[key];
|
|
10650
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
10651
|
+
Object.assign(flattened, flattenObj(value));
|
|
10652
|
+
} else {
|
|
10653
|
+
flattened[key] = value;
|
|
10654
|
+
}
|
|
10655
|
+
});
|
|
10656
|
+
return flattened;
|
|
10657
|
+
};
|
|
10658
|
+
function prepData(formData) {
|
|
10659
|
+
const props2 = flattenObj(formData);
|
|
10660
|
+
props2.vid = "";
|
|
10661
|
+
props2.sid = "";
|
|
10662
|
+
props2.cid = "";
|
|
10663
|
+
if (typeof window.zar !== "undefined") {
|
|
10664
|
+
props2.vid = window.zar.getVID();
|
|
10665
|
+
props2.sid = window.zar.getSID();
|
|
10666
|
+
props2.cid = window.zar.getCID();
|
|
10667
|
+
}
|
|
10668
|
+
const data = {
|
|
10669
|
+
post_source: window.location.hostname,
|
|
10670
|
+
vertical: props2.vertical,
|
|
10671
|
+
properties: props2
|
|
10672
|
+
};
|
|
10673
|
+
return data;
|
|
10674
|
+
}
|
|
10288
10675
|
const textClassification = {
|
|
10289
10676
|
label: "block mb-1 font-bold text-sm formkit-invalid:text-red-500",
|
|
10290
10677
|
inner: `
|
|
@@ -10308,7 +10695,7 @@ const boxClassification = {
|
|
|
10308
10695
|
};
|
|
10309
10696
|
const buttonClassification = {
|
|
10310
10697
|
wrapper: "mb-1",
|
|
10311
|
-
input: "bg-
|
|
10698
|
+
input: "bg-red-500 hover:bg-blue-700 text-white text-lg font-normal py-3 px-5 rounded"
|
|
10312
10699
|
};
|
|
10313
10700
|
var theme = {
|
|
10314
10701
|
global: {
|
|
@@ -10360,9 +10747,28 @@ var index = "";
|
|
|
10360
10747
|
const classes = generateClasses(theme);
|
|
10361
10748
|
const forms = window.bhlForms || [];
|
|
10362
10749
|
const apps = {};
|
|
10363
|
-
forms.forEach(function(form2) {
|
|
10364
|
-
console.
|
|
10365
|
-
|
|
10750
|
+
forms.forEach(async function(form2) {
|
|
10751
|
+
console.debug("Mounting form:", form2);
|
|
10752
|
+
if (form2.schema && form2.experiment) {
|
|
10753
|
+
throw Error("Only one of schema and experiment allowed");
|
|
10754
|
+
}
|
|
10755
|
+
let schema;
|
|
10756
|
+
if (form2.schema) {
|
|
10757
|
+
schema = form2.schema;
|
|
10758
|
+
} else if (form2.experiment) {
|
|
10759
|
+
const res = chooseVariant(form2.experiment);
|
|
10760
|
+
schema = res.variant.schema;
|
|
10761
|
+
if (form2.experimentCallback) {
|
|
10762
|
+
experimentCallback(form2, res.variant, res.fromCache);
|
|
10763
|
+
}
|
|
10764
|
+
}
|
|
10765
|
+
let schemaObj2 = schema;
|
|
10766
|
+
if (typeof schema === "string") {
|
|
10767
|
+
schemaObj2 = await schemaFromUrl(schema);
|
|
10768
|
+
}
|
|
10769
|
+
const data = form2.data || {};
|
|
10770
|
+
data.prepData = data.prepData || prepData;
|
|
10771
|
+
const app = createApp(_sfc_main, { schema: schemaObj2, data }).use(plugin$1, defaultConfig({
|
|
10366
10772
|
config: {
|
|
10367
10773
|
classes
|
|
10368
10774
|
}
|
|
@@ -10370,4 +10776,5 @@ forms.forEach(function(form2) {
|
|
|
10370
10776
|
app.mount("#" + form2.target);
|
|
10371
10777
|
apps[form2.target] = app;
|
|
10372
10778
|
});
|
|
10373
|
-
|
|
10779
|
+
console.debug("Apps:", apps);
|
|
10780
|
+
export { apps as bhlForms };
|