Source: container/Dialog.js

/**
 * Created by seeker910 on 2017/4/7.
 */
Rsd.define('Rsd.container.Dialog', {
    extend: 'Rsd.container.Component',
    xtype: 'dialog',
    headerTagName:'nobr',
    cls: 'x-dialog',
    bodyCls:'x-dialog-body', 
    /** 
     * @description 可拖动
     * */ 
    draggable: true,
    /**
     * @description 是否显示关闭按钮
     */
    closeBtn: true,
    maxBtn: true,
    minBtn: true,
    "width": '100%',
    "height": 300,
    /**
     * @description 页面展示后自动加载数据
     */
    autoLoad:true,
    "style":{overflow:'hidden'}, 
    overflow:'auto',
    title:'无标题',
    isDialog:true,
     /**
     * 
     * @description 当前页面的menu
     */
    //menu:null,
    /**
     * 
     * @param {*} config 
     */
    constructor: function Dialog(config) {

        config = config || {};
        this.apply(config);
    },

    

    /**
     * @description 参数格式: (parent),(animate,speed), (parent,x, y), (parent,x, y,animate), (parent,x, y,animate,speed)
    *  @description 展示页面,指定x,y值可以提高页面加载速度;页面展示后自动加载数据(autoLoad==true)。
     * @param {*} parent 
     * @param {*} x 
     * @param {*} y 
     * @param {*} animate 
     * @param {*} speed 
     */
    showDialog:function showDialog(parent,position,animate,speed){

        var _parent = parent;
        var _position = position; 
        var _animate = animate;
        var _speed = arguments.length == 0?400:speed;
        if(arguments.length == 2)
        {
            _animate = arguments[0];
            _speed = arguments[1];
        }
        if(arguments.length == 4)
        {
            _parent = arguments[0];
            _position = arguments[1]; 
            _animate = arguments[2];
            _speed =arguments[3];
        }
        this.callParent(_parent, _position,_animate,_speed);

        if(this.autoLoad && !this.isLoaded)
        {
            var me = this;
            setTimeout(function () {
                me.funApplyByIOC('load');
                me.isLoaded = true;
            },10);

        }
        if(Rsd.Logger)
        {
            Rsd.Logger.pv(this.$className,this.Title);
        }
        return this;
    },
    /**
     * @description 在页面右侧打开
     */
    showDialogOnRight:function showDialogOnRight(parent)
    {
        this.header.style = this.header.style||{};
        this.header.style.backgroundColor = '#f2f2f2';
        this.header.style.color = '#000';
        this.style.maxHeight = '100%';
        this.style.borderRadius = '0px';
        this.showDialog(parent||document.body,{right:0-this.width,top:0},{right:0,top:0},500);
    },
    /**
     * @description 在页面左侧打开
     */
    showDialogOnLeft:function showDialogOnLeft(parent)
    {
        this.showDialog(parent||document.body,{left:0-this.width,top:0},{left:0,top:0},500);
    },
    /**
     * @description 加载页面数据
     * @param {*} callback  回调函数
     * @returns 
     */
    load:function load(callback) {

        if(callback)
        {
            callback.call(this);
        }
        return this;
    }
    
},function(type) {
     //menu
     var _menuGetter = function () {

        return this.__menu||{};
    };
    var _menuSetter = function (menu) {

        this.__menu = menu;
    }

    this.defineProperty(type, "menu", _menuGetter, _menuSetter, true);
});