@stsdti/funky-ui-kit 1.0.3 → 1.1.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/dist/funky-ui-kit.es.js +161 -258
- package/dist/funky-ui-kit.es.js.map +1 -1
- package/package.json +2 -1
package/dist/funky-ui-kit.es.js
CHANGED
|
@@ -5932,7 +5932,7 @@ let tuple = {
|
|
|
5932
5932
|
return ValidationError.formatError(mixed.notType, params);
|
|
5933
5933
|
}
|
|
5934
5934
|
};
|
|
5935
|
-
|
|
5935
|
+
Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
5936
5936
|
mixed,
|
|
5937
5937
|
string,
|
|
5938
5938
|
number,
|
|
@@ -5982,9 +5982,6 @@ const prefixes = {
|
|
|
5982
5982
|
context: "$",
|
|
5983
5983
|
value: "."
|
|
5984
5984
|
};
|
|
5985
|
-
function create$9(key, options) {
|
|
5986
|
-
return new Reference(key, options);
|
|
5987
|
-
}
|
|
5988
5985
|
class Reference {
|
|
5989
5986
|
constructor(key, options = {}) {
|
|
5990
5987
|
this.key = void 0;
|
|
@@ -7243,9 +7240,6 @@ class NumberSchema extends Schema {
|
|
|
7243
7240
|
create$5.prototype = NumberSchema.prototype;
|
|
7244
7241
|
let invalidDate = /* @__PURE__ */ new Date("");
|
|
7245
7242
|
let isDate$3 = (obj) => Object.prototype.toString.call(obj) === "[object Date]";
|
|
7246
|
-
function create$4() {
|
|
7247
|
-
return new DateSchema();
|
|
7248
|
-
}
|
|
7249
7243
|
class DateSchema extends Schema {
|
|
7250
7244
|
constructor() {
|
|
7251
7245
|
super({
|
|
@@ -7305,8 +7299,6 @@ class DateSchema extends Schema {
|
|
|
7305
7299
|
}
|
|
7306
7300
|
}
|
|
7307
7301
|
DateSchema.INVALID_DATE = invalidDate;
|
|
7308
|
-
create$4.prototype = DateSchema.prototype;
|
|
7309
|
-
create$4.INVALID_DATE = invalidDate;
|
|
7310
7302
|
function sortFields(fields, excludedEdges = []) {
|
|
7311
7303
|
let edges = [];
|
|
7312
7304
|
let nodes = /* @__PURE__ */ new Set();
|
|
@@ -7851,233 +7843,6 @@ class ArraySchema extends Schema {
|
|
|
7851
7843
|
}
|
|
7852
7844
|
}
|
|
7853
7845
|
create$2.prototype = ArraySchema.prototype;
|
|
7854
|
-
function create$1(schemas) {
|
|
7855
|
-
return new TupleSchema(schemas);
|
|
7856
|
-
}
|
|
7857
|
-
class TupleSchema extends Schema {
|
|
7858
|
-
constructor(schemas) {
|
|
7859
|
-
super({
|
|
7860
|
-
type: "tuple",
|
|
7861
|
-
spec: {
|
|
7862
|
-
types: schemas
|
|
7863
|
-
},
|
|
7864
|
-
check(v) {
|
|
7865
|
-
const types = this.spec.types;
|
|
7866
|
-
return Array.isArray(v) && v.length === types.length;
|
|
7867
|
-
}
|
|
7868
|
-
});
|
|
7869
|
-
this.withMutation(() => {
|
|
7870
|
-
this.typeError(tuple.notType);
|
|
7871
|
-
});
|
|
7872
|
-
}
|
|
7873
|
-
_cast(inputValue, options) {
|
|
7874
|
-
const {
|
|
7875
|
-
types
|
|
7876
|
-
} = this.spec;
|
|
7877
|
-
const value = super._cast(inputValue, options);
|
|
7878
|
-
if (!this._typeCheck(value)) {
|
|
7879
|
-
return value;
|
|
7880
|
-
}
|
|
7881
|
-
let isChanged = false;
|
|
7882
|
-
const castArray = types.map((type, idx) => {
|
|
7883
|
-
const castElement = type.cast(value[idx], Object.assign({}, options, {
|
|
7884
|
-
path: `${options.path || ""}[${idx}]`
|
|
7885
|
-
}));
|
|
7886
|
-
if (castElement !== value[idx]) isChanged = true;
|
|
7887
|
-
return castElement;
|
|
7888
|
-
});
|
|
7889
|
-
return isChanged ? castArray : value;
|
|
7890
|
-
}
|
|
7891
|
-
_validate(_value, options = {}, panic, next2) {
|
|
7892
|
-
let itemTypes = this.spec.types;
|
|
7893
|
-
super._validate(_value, options, panic, (tupleErrors, value) => {
|
|
7894
|
-
var _options$originalValu2;
|
|
7895
|
-
if (!this._typeCheck(value)) {
|
|
7896
|
-
next2(tupleErrors, value);
|
|
7897
|
-
return;
|
|
7898
|
-
}
|
|
7899
|
-
let tests = [];
|
|
7900
|
-
for (let [index, itemSchema] of itemTypes.entries()) {
|
|
7901
|
-
var _options$originalValu;
|
|
7902
|
-
tests[index] = itemSchema.asNestedTest({
|
|
7903
|
-
options,
|
|
7904
|
-
index,
|
|
7905
|
-
parent: value,
|
|
7906
|
-
parentPath: options.path,
|
|
7907
|
-
originalParent: (_options$originalValu = options.originalValue) != null ? _options$originalValu : _value
|
|
7908
|
-
});
|
|
7909
|
-
}
|
|
7910
|
-
this.runTests({
|
|
7911
|
-
value,
|
|
7912
|
-
tests,
|
|
7913
|
-
originalValue: (_options$originalValu2 = options.originalValue) != null ? _options$originalValu2 : _value,
|
|
7914
|
-
options
|
|
7915
|
-
}, panic, (innerTypeErrors) => next2(innerTypeErrors.concat(tupleErrors), value));
|
|
7916
|
-
});
|
|
7917
|
-
}
|
|
7918
|
-
describe(options) {
|
|
7919
|
-
const next2 = (options ? this.resolve(options) : this).clone();
|
|
7920
|
-
const base = super.describe(options);
|
|
7921
|
-
base.innerType = next2.spec.types.map((schema, index) => {
|
|
7922
|
-
var _innerOptions;
|
|
7923
|
-
let innerOptions = options;
|
|
7924
|
-
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
7925
|
-
innerOptions = Object.assign({}, innerOptions, {
|
|
7926
|
-
parent: innerOptions.value,
|
|
7927
|
-
value: innerOptions.value[index]
|
|
7928
|
-
});
|
|
7929
|
-
}
|
|
7930
|
-
return schema.describe(innerOptions);
|
|
7931
|
-
});
|
|
7932
|
-
return base;
|
|
7933
|
-
}
|
|
7934
|
-
}
|
|
7935
|
-
create$1.prototype = TupleSchema.prototype;
|
|
7936
|
-
function create$a(builder) {
|
|
7937
|
-
return new Lazy(builder);
|
|
7938
|
-
}
|
|
7939
|
-
function catchValidationError(fn7) {
|
|
7940
|
-
try {
|
|
7941
|
-
return fn7();
|
|
7942
|
-
} catch (err) {
|
|
7943
|
-
if (ValidationError.isError(err)) return Promise.reject(err);
|
|
7944
|
-
throw err;
|
|
7945
|
-
}
|
|
7946
|
-
}
|
|
7947
|
-
class Lazy {
|
|
7948
|
-
constructor(builder) {
|
|
7949
|
-
this.type = "lazy";
|
|
7950
|
-
this.__isYupSchema__ = true;
|
|
7951
|
-
this.spec = void 0;
|
|
7952
|
-
this._resolve = (value, options = {}) => {
|
|
7953
|
-
let schema = this.builder(value, options);
|
|
7954
|
-
if (!isSchema(schema)) throw new TypeError("lazy() functions must return a valid schema");
|
|
7955
|
-
if (this.spec.optional) schema = schema.optional();
|
|
7956
|
-
return schema.resolve(options);
|
|
7957
|
-
};
|
|
7958
|
-
this.builder = builder;
|
|
7959
|
-
this.spec = {
|
|
7960
|
-
meta: void 0,
|
|
7961
|
-
optional: false
|
|
7962
|
-
};
|
|
7963
|
-
}
|
|
7964
|
-
clone(spec) {
|
|
7965
|
-
const next2 = new Lazy(this.builder);
|
|
7966
|
-
next2.spec = Object.assign({}, this.spec, spec);
|
|
7967
|
-
return next2;
|
|
7968
|
-
}
|
|
7969
|
-
optionality(optional) {
|
|
7970
|
-
const next2 = this.clone({
|
|
7971
|
-
optional
|
|
7972
|
-
});
|
|
7973
|
-
return next2;
|
|
7974
|
-
}
|
|
7975
|
-
optional() {
|
|
7976
|
-
return this.optionality(true);
|
|
7977
|
-
}
|
|
7978
|
-
resolve(options) {
|
|
7979
|
-
return this._resolve(options.value, options);
|
|
7980
|
-
}
|
|
7981
|
-
cast(value, options) {
|
|
7982
|
-
return this._resolve(value, options).cast(value, options);
|
|
7983
|
-
}
|
|
7984
|
-
asNestedTest(config) {
|
|
7985
|
-
let {
|
|
7986
|
-
key,
|
|
7987
|
-
index,
|
|
7988
|
-
parent,
|
|
7989
|
-
options
|
|
7990
|
-
} = config;
|
|
7991
|
-
let value = parent[index != null ? index : key];
|
|
7992
|
-
return this._resolve(value, Object.assign({}, options, {
|
|
7993
|
-
value,
|
|
7994
|
-
parent
|
|
7995
|
-
})).asNestedTest(config);
|
|
7996
|
-
}
|
|
7997
|
-
validate(value, options) {
|
|
7998
|
-
return catchValidationError(() => this._resolve(value, options).validate(value, options));
|
|
7999
|
-
}
|
|
8000
|
-
validateSync(value, options) {
|
|
8001
|
-
return this._resolve(value, options).validateSync(value, options);
|
|
8002
|
-
}
|
|
8003
|
-
validateAt(path, value, options) {
|
|
8004
|
-
return catchValidationError(() => this._resolve(value, options).validateAt(path, value, options));
|
|
8005
|
-
}
|
|
8006
|
-
validateSyncAt(path, value, options) {
|
|
8007
|
-
return this._resolve(value, options).validateSyncAt(path, value, options);
|
|
8008
|
-
}
|
|
8009
|
-
isValid(value, options) {
|
|
8010
|
-
try {
|
|
8011
|
-
return this._resolve(value, options).isValid(value, options);
|
|
8012
|
-
} catch (err) {
|
|
8013
|
-
if (ValidationError.isError(err)) {
|
|
8014
|
-
return Promise.resolve(false);
|
|
8015
|
-
}
|
|
8016
|
-
throw err;
|
|
8017
|
-
}
|
|
8018
|
-
}
|
|
8019
|
-
isValidSync(value, options) {
|
|
8020
|
-
return this._resolve(value, options).isValidSync(value, options);
|
|
8021
|
-
}
|
|
8022
|
-
describe(options) {
|
|
8023
|
-
return options ? this.resolve(options).describe(options) : {
|
|
8024
|
-
type: "lazy",
|
|
8025
|
-
meta: this.spec.meta,
|
|
8026
|
-
label: void 0
|
|
8027
|
-
};
|
|
8028
|
-
}
|
|
8029
|
-
meta(...args) {
|
|
8030
|
-
if (args.length === 0) return this.spec.meta;
|
|
8031
|
-
let next2 = this.clone();
|
|
8032
|
-
next2.spec.meta = Object.assign(next2.spec.meta || {}, args[0]);
|
|
8033
|
-
return next2;
|
|
8034
|
-
}
|
|
8035
|
-
}
|
|
8036
|
-
function setLocale(custom) {
|
|
8037
|
-
Object.keys(custom).forEach((type) => {
|
|
8038
|
-
Object.keys(custom[type]).forEach((method) => {
|
|
8039
|
-
locale$2[type][method] = custom[type][method];
|
|
8040
|
-
});
|
|
8041
|
-
});
|
|
8042
|
-
}
|
|
8043
|
-
function addMethod(schemaType, name, fn7) {
|
|
8044
|
-
if (!schemaType || !isSchema(schemaType.prototype)) throw new TypeError("You must provide a yup schema constructor function");
|
|
8045
|
-
if (typeof name !== "string") throw new TypeError("A Method name must be provided");
|
|
8046
|
-
if (typeof fn7 !== "function") throw new TypeError("Method function must be provided");
|
|
8047
|
-
schemaType.prototype[name] = fn7;
|
|
8048
|
-
}
|
|
8049
|
-
const yup = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8050
|
-
__proto__: null,
|
|
8051
|
-
ArraySchema,
|
|
8052
|
-
BooleanSchema,
|
|
8053
|
-
DateSchema,
|
|
8054
|
-
LazySchema: Lazy,
|
|
8055
|
-
MixedSchema,
|
|
8056
|
-
NumberSchema,
|
|
8057
|
-
ObjectSchema,
|
|
8058
|
-
Schema,
|
|
8059
|
-
StringSchema,
|
|
8060
|
-
TupleSchema,
|
|
8061
|
-
ValidationError,
|
|
8062
|
-
addMethod,
|
|
8063
|
-
array: create$2,
|
|
8064
|
-
bool: create$7,
|
|
8065
|
-
boolean: create$7,
|
|
8066
|
-
date: create$4,
|
|
8067
|
-
defaultLocale: locale$2,
|
|
8068
|
-
getIn,
|
|
8069
|
-
isSchema,
|
|
8070
|
-
lazy: create$a,
|
|
8071
|
-
mixed: create$8,
|
|
8072
|
-
number: create$5,
|
|
8073
|
-
object: create$3,
|
|
8074
|
-
printValue,
|
|
8075
|
-
reach,
|
|
8076
|
-
ref: create$9,
|
|
8077
|
-
setLocale,
|
|
8078
|
-
string: create$6,
|
|
8079
|
-
tuple: create$1
|
|
8080
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
8081
7846
|
function generateComputedChildren(localVariable, newComputedSubKeys = []) {
|
|
8082
7847
|
const subItems = newComputedSubKeys.reduce((result, key) => {
|
|
8083
7848
|
if (!key) {
|
|
@@ -8123,8 +7888,12 @@ function generateComputedParent(data) {
|
|
|
8123
7888
|
}
|
|
8124
7889
|
const isFieldRequired = (schema, fieldName) => {
|
|
8125
7890
|
var _a3;
|
|
8126
|
-
|
|
8127
|
-
|
|
7891
|
+
try {
|
|
7892
|
+
const fieldSchema = reach(schema, fieldName);
|
|
7893
|
+
return ((_a3 = fieldSchema == null ? void 0 : fieldSchema.spec) == null ? void 0 : _a3.optional) === false;
|
|
7894
|
+
} catch {
|
|
7895
|
+
return false;
|
|
7896
|
+
}
|
|
8128
7897
|
};
|
|
8129
7898
|
function getStyleFromObject(style) {
|
|
8130
7899
|
return Object.keys(style).filter((key) => style[key]).join("; ");
|
|
@@ -20195,6 +19964,7 @@ __publicField(ResponseUtils, "STATUS_CODES", {
|
|
|
20195
19964
|
STATUS_CODE_UNAUTHORIZED: 401,
|
|
20196
19965
|
STATUS_CODE_FORBIDDEN: 403,
|
|
20197
19966
|
STATUS_CODE_CONFLICT: 409,
|
|
19967
|
+
STATUS_CODE_PRECONDITION_REQUIRED: 428,
|
|
20198
19968
|
STATUS_CODE_UNPROCESSABLE_ENTITY: 422,
|
|
20199
19969
|
STATUS_CODE_SERVER_ERROR: 500
|
|
20200
19970
|
});
|
|
@@ -85026,9 +84796,13 @@ function useFormValidation(config) {
|
|
|
85026
84796
|
element == null ? void 0 : element.scrollIntoView({ behavior: "smooth" });
|
|
85027
84797
|
};
|
|
85028
84798
|
const isFieldRequired2 = (fieldName) => {
|
|
85029
|
-
var _a3
|
|
85030
|
-
|
|
85031
|
-
|
|
84799
|
+
var _a3;
|
|
84800
|
+
try {
|
|
84801
|
+
const fieldSchema = reach(toValue$2(schema), fieldName);
|
|
84802
|
+
return ((_a3 = fieldSchema == null ? void 0 : fieldSchema.spec) == null ? void 0 : _a3.optional) === false;
|
|
84803
|
+
} catch {
|
|
84804
|
+
return false;
|
|
84805
|
+
}
|
|
85032
84806
|
};
|
|
85033
84807
|
const externalContext = {
|
|
85034
84808
|
errors,
|
|
@@ -85496,27 +85270,155 @@ const getComponentType = (node) => {
|
|
|
85496
85270
|
return node.component;
|
|
85497
85271
|
}
|
|
85498
85272
|
};
|
|
85499
|
-
const
|
|
85500
|
-
if (!
|
|
85501
|
-
|
|
85502
|
-
|
|
85503
|
-
|
|
85504
|
-
|
|
85505
|
-
|
|
85506
|
-
|
|
85273
|
+
const parseRuleString = (ruleString) => {
|
|
85274
|
+
if (!ruleString || typeof ruleString !== "string") return [];
|
|
85275
|
+
return ruleString.split("|").map((rule) => {
|
|
85276
|
+
const [name, ...rest] = rule.split(":");
|
|
85277
|
+
const params = rest.join(":");
|
|
85278
|
+
return { name: name.trim(), params: params || null };
|
|
85279
|
+
});
|
|
85280
|
+
};
|
|
85281
|
+
const buildFieldValidator = (rules) => {
|
|
85282
|
+
const typeRule = rules.find(
|
|
85283
|
+
(r) => ["string", "number", "integer", "boolean", "array", "mixed"].includes(r.name)
|
|
85284
|
+
);
|
|
85285
|
+
const typeName = (typeRule == null ? void 0 : typeRule.name) || "mixed";
|
|
85286
|
+
let validator2;
|
|
85287
|
+
switch (typeName) {
|
|
85288
|
+
case "string":
|
|
85289
|
+
validator2 = create$6();
|
|
85290
|
+
break;
|
|
85291
|
+
case "number":
|
|
85292
|
+
validator2 = create$5();
|
|
85293
|
+
break;
|
|
85294
|
+
case "integer":
|
|
85295
|
+
validator2 = create$5().integer();
|
|
85296
|
+
break;
|
|
85297
|
+
case "boolean":
|
|
85298
|
+
validator2 = create$7();
|
|
85299
|
+
break;
|
|
85300
|
+
case "array":
|
|
85301
|
+
validator2 = create$2();
|
|
85302
|
+
break;
|
|
85303
|
+
default:
|
|
85304
|
+
validator2 = create$8();
|
|
85305
|
+
}
|
|
85306
|
+
for (const rule of rules) {
|
|
85307
|
+
switch (rule.name) {
|
|
85308
|
+
// Type rules already handled above
|
|
85309
|
+
case "string":
|
|
85310
|
+
case "number":
|
|
85311
|
+
case "integer":
|
|
85312
|
+
case "boolean":
|
|
85313
|
+
case "array":
|
|
85314
|
+
case "mixed":
|
|
85315
|
+
break;
|
|
85316
|
+
case "required":
|
|
85317
|
+
validator2 = validator2.required();
|
|
85318
|
+
break;
|
|
85319
|
+
case "nullable":
|
|
85320
|
+
validator2 = validator2.nullable();
|
|
85321
|
+
break;
|
|
85322
|
+
case "email":
|
|
85323
|
+
validator2 = validator2.email();
|
|
85324
|
+
break;
|
|
85325
|
+
case "url":
|
|
85326
|
+
validator2 = validator2.url();
|
|
85327
|
+
break;
|
|
85328
|
+
case "min":
|
|
85329
|
+
validator2 = validator2.min(Number(rule.params));
|
|
85330
|
+
break;
|
|
85331
|
+
case "max":
|
|
85332
|
+
validator2 = validator2.max(Number(rule.params));
|
|
85333
|
+
break;
|
|
85334
|
+
case "between": {
|
|
85335
|
+
const [min2, max2] = rule.params.split(",").map(Number);
|
|
85336
|
+
validator2 = validator2.min(min2).max(max2);
|
|
85337
|
+
break;
|
|
85338
|
+
}
|
|
85339
|
+
case "in": {
|
|
85340
|
+
const allowed = rule.params.split(",").map((v) => v.trim());
|
|
85341
|
+
validator2 = validator2.oneOf(allowed);
|
|
85342
|
+
break;
|
|
85343
|
+
}
|
|
85344
|
+
case "not_in": {
|
|
85345
|
+
const disallowed = rule.params.split(",").map((v) => v.trim());
|
|
85346
|
+
validator2 = validator2.notOneOf(disallowed);
|
|
85347
|
+
break;
|
|
85348
|
+
}
|
|
85349
|
+
case "regex": {
|
|
85350
|
+
const match2 = rule.params.match(/^\/(.+)\/([gimsuy]*)$/);
|
|
85351
|
+
if (match2) {
|
|
85352
|
+
validator2 = validator2.matches(new RegExp(match2[1], match2[2]));
|
|
85353
|
+
}
|
|
85354
|
+
break;
|
|
85355
|
+
}
|
|
85356
|
+
default:
|
|
85357
|
+
console.warn(`[buildYupSchema] Unknown validation rule: "${rule.name}"`);
|
|
85358
|
+
}
|
|
85359
|
+
}
|
|
85360
|
+
return validator2;
|
|
85361
|
+
};
|
|
85362
|
+
const setNestedShape = (rootShape, path, validator2) => {
|
|
85363
|
+
const segments = path.split(".");
|
|
85364
|
+
let current = rootShape;
|
|
85365
|
+
for (let i2 = 0; i2 < segments.length - 1; i2++) {
|
|
85366
|
+
const seg = segments[i2];
|
|
85367
|
+
const nextSeg = segments[i2 + 1];
|
|
85368
|
+
if (nextSeg === "*") {
|
|
85369
|
+
const remainingPath = segments.slice(i2 + 2).join(".");
|
|
85370
|
+
if (!current[seg]) {
|
|
85371
|
+
current[seg] = { __type: "array", __shape: {} };
|
|
85372
|
+
}
|
|
85373
|
+
if (remainingPath) {
|
|
85374
|
+
setNestedShape(current[seg].__shape, remainingPath, validator2);
|
|
85375
|
+
} else {
|
|
85376
|
+
current[seg].__itemValidator = validator2;
|
|
85377
|
+
}
|
|
85378
|
+
return;
|
|
85507
85379
|
}
|
|
85508
|
-
if (
|
|
85509
|
-
|
|
85380
|
+
if (seg === "*") {
|
|
85381
|
+
continue;
|
|
85382
|
+
}
|
|
85383
|
+
if (!current[seg]) {
|
|
85384
|
+
current[seg] = { __type: "object", __shape: {} };
|
|
85510
85385
|
}
|
|
85511
|
-
|
|
85512
|
-
|
|
85386
|
+
current = current[seg].__shape;
|
|
85387
|
+
}
|
|
85388
|
+
const lastSeg = segments[segments.length - 1];
|
|
85389
|
+
if (lastSeg !== "*") {
|
|
85390
|
+
current[lastSeg] = validator2;
|
|
85391
|
+
}
|
|
85392
|
+
};
|
|
85393
|
+
const buildShapeToYup = (shape) => {
|
|
85394
|
+
const yupShape = {};
|
|
85395
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
85396
|
+
if (value && value.__type === "array") {
|
|
85397
|
+
const innerShape = buildShapeToYup(value.__shape);
|
|
85398
|
+
yupShape[key] = value.__itemValidator ? create$2().of(value.__itemValidator) : create$2().of(create$3().shape(innerShape));
|
|
85399
|
+
} else if (value && value.__type === "object") {
|
|
85400
|
+
const innerShape = buildShapeToYup(value.__shape);
|
|
85401
|
+
yupShape[key] = create$3().shape(innerShape);
|
|
85402
|
+
} else {
|
|
85403
|
+
yupShape[key] = value;
|
|
85513
85404
|
}
|
|
85514
|
-
|
|
85515
|
-
|
|
85405
|
+
}
|
|
85406
|
+
return yupShape;
|
|
85407
|
+
};
|
|
85408
|
+
const buildYupSchema = (validationConfig) => {
|
|
85409
|
+
if (!validationConfig) return create$3();
|
|
85410
|
+
const intermediateShape = {};
|
|
85411
|
+
for (const [field, ruleString] of Object.entries(validationConfig)) {
|
|
85412
|
+
const rules = parseRuleString(ruleString);
|
|
85413
|
+
const validator2 = buildFieldValidator(rules);
|
|
85414
|
+
if (field.includes(".")) {
|
|
85415
|
+
setNestedShape(intermediateShape, field, validator2);
|
|
85416
|
+
} else {
|
|
85417
|
+
intermediateShape[field] = validator2;
|
|
85516
85418
|
}
|
|
85517
|
-
shape[field] = validator2;
|
|
85518
85419
|
}
|
|
85519
|
-
|
|
85420
|
+
const yupShape = buildShapeToYup(intermediateShape);
|
|
85421
|
+
return create$3().shape(yupShape);
|
|
85520
85422
|
};
|
|
85521
85423
|
const evaluateVisibilityRules = (visibilityRules, item, formContext) => {
|
|
85522
85424
|
if (!Array.isArray(visibilityRules) || !formContext) return;
|
|
@@ -85646,7 +85548,8 @@ const _sfc_main = {
|
|
|
85646
85548
|
const modelValue = useModel(__props, "modelValue");
|
|
85647
85549
|
const props2 = __props;
|
|
85648
85550
|
const emits = __emit;
|
|
85649
|
-
const yupSchema = buildYupSchema(props2.schema.validation);
|
|
85551
|
+
const yupSchema = computed(() => buildYupSchema(props2.schema.validation));
|
|
85552
|
+
console.log("yup schema!");
|
|
85650
85553
|
const form = useForm({ schema: yupSchema }, emits);
|
|
85651
85554
|
const { formName, item } = form;
|
|
85652
85555
|
provide("formContext", form);
|