UNPKG

@ciebit/calendario

Version:

Representa um calendário visual

73 lines (63 loc) 2.03 kB
///<reference path="../../cb-js/classes/Hermes.ts"/> module Ciebit.Calendario { export class Layout { private Hermes: Hermes; private container: HTMLElement; private seletor_ano: string; private seletor_mes: string; private seletor_dias: string; public constructor(container: HTMLElement) { this.container = container; this.seletor_ano = ".cb-calendario-ano"; this.seletor_mes = ".cb-calendario-mes"; this.seletor_dias = ".cb-calendario-dias"; } public aviseMe(evento:string, funcao:Function,): this { return this; } public definirContainer(container:HTMLElement):this { this.container = container; return this; } public definirSeletorAno(seletor:string):this { this.seletor_ano = seletor; return this; } public definirSeletorMes(seletor:string):this { this.seletor_mes = seletor; return this; } public definirSeletorDias(seletor:string):this { this.seletor_dias = seletor; return this; } public definirAno(ano:number): this { let tag_ano = document.querySelector(this.seletor_ano); tag_ano.appendChild(document.createTextNode(ano.toString())); return this; } public definirMes(mes:string): this { let tag_mes = document.querySelector(this.seletor_mes); tag_mes.appendChild(document.createTextNode(mes)); return this; } public definirDias(array:Array<number>): this { let tag_dias = document.querySelectorAll(this.seletor_dias); for (let i = 0; i < tag_dias.length; i++) { tag_dias[i].appendChild(document.createTextNode(array[i].toString())); } return this; } } }