Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.parseOn(rule);
this.parseProps(rule);
} else {
parser = this.createParser(this.parseRule(_rule));
}
let children = parser.rule.children, rule = parser.rule;
if (!this.notField(parser.field))
return console.error(`${rule.field} 字段已存在` + errMsg());
this.setParser(parser);
if (!_rule.__fc__) {
bindParser(_rule, parser);
}
if (isValidChildren(children)) {
this.loadRule(children, true);
}
if (!child) {
this.sortList.push(parser.id);
}
if (!this.isNoVal(parser))
Object.defineProperty(parser.rule, 'value', {
get: () => {
return parser.toValue(this.getFormData(parser));
},
set: (value) => {
if (this.isChange(parser, value)) {
this.refresh();
this.$render.clearCache(parser, true);
}
let children = handler.rule.children;
if (!this.notField(handler.field)) return console.error(`${rule.field} 字段已存在` + errMsg());
if (this.switchMaker) {
rules[index] = rule;
if (!child) this.origin[index] = rule;
_rule = rule;
}
this.setHandler(handler);
if (!_rule.__handler__) {
bindHandler(_rule, handler);
}
if (isValidChildren(children)) this.createHandler(children, true);
if (!child) this.fieldList.push(handler.field);
return handler;
}).filter(h => h).forEach(h => {
h.root = rules;
childrenParse(form) {
let {rule, orgChildren, vm} = this.handler, children = rule.children, vn = [];
if (isValidChildren(children)) {
orgChildren.forEach(_rule => {
if (children.indexOf(_rule) === -1) {
vm._fComponent.removeField(_rule.__field__);
}
});
vn = children.map((child) => {
if (isString(child))
return [child];
if (child.__handler__) {
return child.__handler__.render.cacheParse(form, true);
}
$de(() => vm._fComponent.reload());
});
this.handler.orgChildren = [...children];
} else if (orgChildren.length > 0) {
clearCache() {
this.cache = null;
let children = this.handler.rule.children;
if (isValidChildren(children))
children.forEach(child => !isString(child) && child.__handler__.render.clearCache());
}
refresh() {
const rule = this.rule;
this.parseValue = this.toFormValue(rule.value);
this.orgChildren = isValidChildren(rule.children) ? [...rule.children] : [];
this.deleted = false;
return this;
}
this.orgChildren = Object.keys(parsers).reduce((initial, id) => {
const children = parsers[id].rule.children;
initial[id] = isValidChildren(children) ? [...children] : [];
return initial;
}, {});
}