index-pickup-data-view-engine.ts 1.6 KB
Newer Older
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
import { MDViewEngine } from "./md-view-engine";

/**
 * 实体索引选择数据视图引擎
 *
 * @export
 * @class IndexPickupDataViewEngine
 * @extends {MDViewEngine}
 */
export class IndexPickupDataViewEngine extends MDViewEngine {

  /**
   * 数据视图部件
   *
   * @protected
   * @type {*}
   * @memberof IndexPickupDataViewEngine
   */
  protected dataView: any;

  /**
   * 引擎初始化
   *
   * @param {*} options
   * @memberof IndexPickupDataViewEngine
   */
  init(options: any) {
    this.dataView = options.dataview;
    super.init(options);
  }

  /**
   * 处理部件事件
   *
   * @param {string} ctrlName
   * @param {string} eventName
   * @param {*} args
   * @memberof IndexPickupDataViewEngine
   */
  public onCtrlEvent(ctrlName: string, eventName: string, args: any) {
41
    if (Object.is(ctrlName, 'dataview')) {
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
      this.MDCtrlEvent(eventName, args);
    }
    super.onCtrlEvent(ctrlName, eventName, args);
  }

  /**
   * 多数据部件事件处理
   *
   * @param {string} eventName
   * @param {*} args
   * @memberof IndexPickupDataViewEngine
   */
  public MDCtrlEvent(eventName: string, args: any) {
    if (Object.is(eventName, 'selectionchange')) {
      this.emitViewEvent('viewdataschange', args);
    }
  }

  /**
   * 获取多数据部件
   *
   * @return {*} 
   * @memberof IndexPickupDataViewEngine
   */
  getMDCtrl() {
    return this.dataView;
  }
69 70 71 72 73 74 75 76 77

    /**
     * @description 视图销毁
     * @memberof IndexPickupDataViewEngine
     */
    public destroyed() {
        super.destroyed();
        this.dataView = null;
    }
78
}