import { __decorate } from "tslib";
import { Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '../../../decorators';
import { EditorBase } from '../editor-base/editor-base';
/**
 * 评分器编辑器
 *
 * @export
 * @class RateEditor
 * @extends {EditorBase}
 */
let RateEditor = class RateEditor extends EditorBase {
    constructor() {
        super(...arguments);
        /**
         * 编辑器模型是否加载完成
         *
         * @memberof RateEditor
         */
        this.editorIsLoaded = false;
    }
    /**
     * 编辑器初始化
     *
     * @memberof RateEditor
     */
    async initEditor() {
        var _a, _b, _c, _d, _e;
        await super.initEditor();
        let codeList = (_b = (_a = this.editorInstance) === null || _a === void 0 ? void 0 : _a.getPSAppCodeList) === null || _b === void 0 ? void 0 : _b.call(_a);
        if ((_c = this.editorInstance.editorParams) === null || _c === void 0 ? void 0 : _c['MAXVALUE']) {
            Object.assign(this.customProps, {
                max: !isNaN(Number((_d = this.editorInstance.editorParams) === null || _d === void 0 ? void 0 : _d['MAXVALUE'])) ? Number((_e = this.editorInstance.editorParams) === null || _e === void 0 ? void 0 : _e['MAXVALUE']) : 5,
            });
        }
        if (codeList) {
            Object.assign(this.customProps, {
                tag: codeList.codeName,
                codeList: codeList,
                codelistType: codeList.codeListType
            });
        }
    }
    /**
     * 编辑器change事件
     *
     * @param {*} value
     * @memberof RateEditor
     */
    handleChange($event) {
        this.editorChange({ name: this.editorInstance.name, value: $event });
    }
    /**
     * 绘制内容
     *
     * @returns {*}
     * @memberof RateEditor
     */
    render() {
        if (!this.editorIsLoaded) {
            return null;
        }
        return this.$createElement(this.editorComponentName, {
            props: Object.assign({ name: this.editorInstance.name, value: this.value, disabled: this.disabled }, this.customProps),
            on: { change: this.handleChange },
            style: this.customStyle
        });
    }
};
RateEditor = __decorate([
    Component({}),
    VueLifeCycleProcessing()
], RateEditor);
export default RateEditor;
