import template from "./ImagePreviewGroup.html"; class ImagePreviewGroup { useModules = ["esNgAntd"]; template = template; state = { current: 0, visible: false, src: null, childrens: [], }; constructor() { this.handlePreview(); } addChildren(children) { this.state.childrens.push(children); return this.state.childrens.length - 1; } handleOpen(index) { this.state.current = index; this.state.src = this.state.childrens[index].state.src; this.state.visible = true; } handleClose() { this.state.visible = false; } handlePrev() { this.state.current = this.state.current > 0 ? this.state.current - 1 : 0; this.state.src = this.state.childrens[this.state.current].state.src; } handleNext() { this.state.current = this.state.current < this.state.childrens.length - 1 ? this.state.current + 1 : this.state.childrens.length - 1; this.state.src = this.state.childrens[this.state.current].state.src; } handlePreview() { esNgAntd.createLayer( `
`, $scope ); } }