calendar-view-engine.ts 1.3 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 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
import { MDViewEngine } from "./md-view-engine";

/**
 * 日历视图引擎
 *
 * @export
 * @class CalendarViewEngine
 * @extends {MDViewEngine}
 */
export class CalendarViewEngine extends MDViewEngine {

  /**
   * 日历部件
   *
   * @protected
   * @type {*}
   * @memberof CalendarViewEngine
   */
  protected calendar: any;

  /**
   * 引擎初始化
   *
   * @param {*} [options={}]
   * @memberof CalendarViewEngine
   */
  public init(options: any = {}): void {
    this.calendar = options.calendar;
    super.init(options);
  }

  /**
   * 部件事件处理
   *
   * @param {string} ctrlName 部件标识
   * @param {string} eventName 事件标识
   * @param {*} args 事件参数
   * @memberof CalendarViewEngine
   */
  public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
    if (Object.is(ctrlName, 'calendar')) {
      this.MDCtrlEvent(eventName, args);
    }
    super.onCtrlEvent(ctrlName, eventName, args);
  }

  /**
   * 获取日历部件
   *
   * @return {*}  {*}
   * @memberof CalendarViewEngine
   */
  public getMDCtrl(): any {
    return this.calendar;
  }

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