all files / dui/src/plugin/ PluginTemplate.js

61.9% Statements 13/21
30% Branches 3/10
25% Functions 2/8
61.9% Lines 13/21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102                                                                                                                                                                                 
/**
 * XXX插件
 *
 * @file XXX插件
 * @author Brian Li(lbxxlht@163.com)
 *
 * 数据结构:
 *
 *
 * 宿主fire的事件:
 *
 *
 * 暴露的API:
 *
 */
var define = typeof define === 'function' && define.amd ? define : function (factory) {
    typeof module === 'object' ? (module.exports = factory(require)) : '';
};
 
define(function (require) {
 
    var util = require('../core/util');
    var Plugin = require('../core/plugin');
 
    // public /////////////////////////////////////////////////////////////////
 
    /**
     * 构造函数
     *
     * @constructor
     * @param {Object} param 初始化对象
     * @param {boolean} param.changeSelectStyle 选中行后时候改变背景色
     */
    function PluginTemplate(param) {
        if (!(this instanceof PluginTemplate)) {
            return new PluginTemplate(param);
        }
        this.required = [];
        param = param || {};
        Plugin.call(this, param);
    }
 
    util.inherit(PluginTemplate, Plugin);
 
    /**
     * @override
     *
     * @param {Object} param 宿主UI初始化时的参数引用,***操作请小心***
     * @return {boolean} 是否初始化成功
     */
    PluginTemplate.prototype.load = function (param) {
        // param.pluginSkin = util.joinClassName(param.pluginSkin, '');
        // param.tpl = extendTPL(param.tpl);
        // util.appendHandler(param, 'click', mouseHandler);
        // extendAPI(this.host, this);
        return true;
    };
 
    /**
     * @override
     *
     * 宿主渲染完成后回调
     */
    PluginTemplate.prototype.hostRendered = function () {
 
    };
 
    // private /////////////////////////////////////////////////////////////////
 
    /**
     * 扩展宿主对象API
     *
     * @param {Object} host 宿主实例
     * @param {Object} plugin 插件实例
     */
    function extendAPI(host, plugin) {
 
    }
 
    /**
     * 对模版进行扩充
     *
     * @param {Array.<string>} tpl 原始模板
     * @return {Array.<string>} 扩展后的模板
     */
    function extendTPL(tpl) {
        var picker = new util.Picker(tpl);
        return picker.export();
    }
 
    /**
     * 处理一切鼠标事件
     *
     * @param {Event} evt 鼠标事件句柄
     */
    function mouseHandler(evt) {
 
    }
 
    return PluginTemplate;
});