guided-operation.ts 969 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import XEUtils from "xe-utils";
  2. export declare type GuidedOperationMap = {
  3. title: string,
  4. index: number;
  5. id: string
  6. }
  7. export class guidedOperation {
  8. private readonly list: GuidedOperationMap[];
  9. private readonly total: number = 0;
  10. private current: number = 0;
  11. private mask: HTMLElement;
  12. constructor(map: GuidedOperationMap[]) {
  13. this.list = XEUtils.orderBy(map, 'index')
  14. this.total = this.list.length
  15. this.renderMask()
  16. this.next()
  17. }
  18. private renderMask() {
  19. this.mask = document.createElement('div')
  20. this.mask.className = 'el-overlay'
  21. }
  22. private next() {
  23. if (this.current >= this.total) {
  24. return
  25. }
  26. const currentDocument = window.document.getElementById(this.list[this.current].id)
  27. document.body.append(this.mask)
  28. this.current++
  29. }
  30. private render() {
  31. }
  32. getElement() {
  33. return this.list
  34. }
  35. }