import { __decorate } from "tslib";
import { Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '../../../decorators';
import { EditorBase } from '../editor-base/editor-base';
import { Util } from '@ibizstudio/runtime';
/**
 * ip地址编辑器
 *
 * @export
 * @class IpAddressEditor
 * @extends {EditorBase}
 */
let IpAddressEditor = class IpAddressEditor extends EditorBase {
    /**
     * 编辑器change事件
     *
     * @param {*} value
     * @memberof IpAddressEditor
     */
    handleChange($event) {
        this.editorChange({ name: this.editorInstance.name, value: $event });
    }
    /**
     * 设置编辑器的自定义高宽
     *
     * @memberof EditorBase
     */
    setCustomStyle() {
        let { editorWidth, editorHeight } = this.editorInstance;
        this.customStyle = {
            width: '300px',
        };
        if (!Util.isEmpty(editorWidth) && editorWidth != 0) {
            this.customStyle.width = editorWidth > 1 ? editorWidth + "px" : editorWidth * 100 + "%";
        }
        if (!Util.isEmpty(editorHeight) && editorHeight != 0) {
            this.customStyle.height = editorHeight > 1 ? editorHeight + "px" : editorHeight * 100 + "%";
        }
    }
    /**
     * 绘制内容
     *
     * @returns {*}
     * @memberof IpAddressEditor
     */
    render() {
        if (!this.editorIsLoaded) {
            return null;
        }
        return this.$createElement(this.editorComponentName, {
            props: Object.assign({ name: this.editorInstance.name, ipdata: this.value, disabled: this.disabled, context: this.context, viewparams: this.viewparams }, this.customProps),
            on: { change: this.handleChange },
            style: this.customStyle
        });
    }
};
IpAddressEditor = __decorate([
    Component({}),
    VueLifeCycleProcessing()
], IpAddressEditor);
export default IpAddressEditor;
