How to use the @form-create/utils.isValidChildren function in @form-create/utils

To help you get started, we’ve selected a few @form-create/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xaboy / form-create / packages / core / src / core / handle.js View on Github external
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);
github xaboy / form-create / packages / core / src2 / formCreate.js View on Github external
}

                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;
github xaboy / form-create / packages / core / src2 / factory / render.js View on Github external
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) {
github xaboy / form-create / packages / core / src2 / factory / render.js View on Github external
clearCache() {
        this.cache = null;
        let children = this.handler.rule.children;

        if (isValidChildren(children))
            children.forEach(child => !isString(child) && child.__handler__.render.clearCache());
    }
github xaboy / form-create / packages / core / src2 / factory / handler.js View on Github external
refresh() {
        const rule = this.rule;
        this.parseValue = this.toFormValue(rule.value);
        this.orgChildren = isValidChildren(rule.children) ? [...rule.children] : [];
        this.deleted = false;

        return this;
    }
github xaboy / form-create / packages / core / src / core / render.js View on Github external
this.orgChildren = Object.keys(parsers).reduce((initial, id) => {
            const children = parsers[id].rule.children;
            initial[id] = isValidChildren(children) ? [...children] : [];

            return initial;
        }, {});
    }