"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var react_1 = tslib_1.__importDefault(require("react"));
var classnames_1 = tslib_1.__importDefault(require("classnames"));
var Tree_1 = tslib_1.__importDefault(require("../../components/Tree"));
var Options_1 = require("./Options");
;
var TreeControl = /** @class */ (function (_super) {
    tslib_1.__extends(TreeControl, _super);
    function TreeControl() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TreeControl.prototype.render = function () {
        var _a = this.props, className = _a.className, ns = _a.classPrefix, value = _a.value, onChange = _a.onChange, disabled = _a.disabled, joinValues = _a.joinValues, extractValue = _a.extractValue, delimiter = _a.delimiter, placeholder = _a.placeholder, options = _a.options, inline = _a.inline, multiple = _a.multiple, valueField = _a.valueField, initiallyOpen = _a.initiallyOpen, unfoldedLevel = _a.unfoldedLevel, withChildren = _a.withChildren, onlyChildren = _a.onlyChildren, loading = _a.loading, hideRoot = _a.hideRoot, rootLabel = _a.rootLabel, cascade = _a.cascade, rootValue = _a.rootValue, showIcon = _a.showIcon, showRadio = _a.showRadio, render = _a.render;
        return (react_1.default.createElement("div", { className: classnames_1.default(ns + "TreeControl", className) }, loading ? render('loading', {
            type: 'spinner'
        }) :
            (react_1.default.createElement(Tree_1.default, { classPrefix: ns, valueField: valueField, disabled: disabled, onChange: onChange, joinValues: joinValues, extractValue: extractValue, delimiter: delimiter, placeholder: placeholder, data: options, multiple: multiple, initiallyOpen: initiallyOpen, unfoldedLevel: unfoldedLevel, withChildren: withChildren, onlyChildren: onlyChildren, hideRoot: hideRoot, rootLabel: rootLabel, rootValue: rootValue, showIcon: showIcon, showRadio: showRadio, cascade: cascade, foldedField: "collapsed", value: value || '', nameField: "label", selfDisabledAffectChildren: false }))));
    };
    TreeControl.defaultProps = {
        placeholder: '选项加载中...',
        multiple: false,
        hideRoot: false,
        rootLabel: '顶级',
        rootValue: '',
        showIcon: true,
    };
    return TreeControl;
}(react_1.default.Component));
exports.default = TreeControl;
var TreeControlRenderer = /** @class */ (function (_super) {
    tslib_1.__extends(TreeControlRenderer, _super);
    function TreeControlRenderer() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TreeControlRenderer = tslib_1.__decorate([
        Options_1.OptionsControl({
            type: 'tree',
        })
    ], TreeControlRenderer);
    return TreeControlRenderer;
}(TreeControl));
exports.TreeControlRenderer = TreeControlRenderer;
;
//# sourceMappingURL=./renderers/Form/Tree.js.map
