@type-dom/ui 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -44
- package/package.json +4 -10
- package/src/aria.d.ts +2 -2
- package/src/components/basic/td-button/td-button.abstract.d.ts +5 -5
- package/src/components/basic/td-button/td-button.abstract.js +46 -42
- package/src/components/basic/td-button/td-button.interface.d.ts +3 -6
- package/src/components/basic/td-button/td-button.style.d.ts +16 -5
- package/src/components/basic/td-button/td-button.style.js +43 -17
- package/src/components/basic/td-button-group/td-button-group.class.d.ts +3 -2
- package/src/components/basic/td-button-group/td-button-group.class.js +34 -37
- package/src/components/basic/td-button-group/td-button-group.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-aside/td-aside.class.d.ts +2 -2
- package/src/components/basic/td-container/td-aside/td-aside.class.js +6 -5
- package/src/components/basic/td-container/td-aside/td-aside.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-container.class.d.ts +2 -3
- package/src/components/basic/td-container/td-container.class.js +9 -7
- package/src/components/basic/td-container/td-container.interface.d.ts +3 -4
- package/src/components/basic/td-container/td-container.js +3 -2
- package/src/components/basic/td-container/td-footer/td-footer.class.d.ts +2 -2
- package/src/components/basic/td-container/td-footer/td-footer.class.js +4 -3
- package/src/components/basic/td-container/td-footer/td-footer.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-header/td-header.class.d.ts +2 -2
- package/src/components/basic/td-container/td-header/td-header.class.js +3 -3
- package/src/components/basic/td-container/td-header/td-header.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-main/td-main.class.d.ts +4 -2
- package/src/components/basic/td-container/td-main/td-main.class.js +8 -5
- package/src/components/basic/td-container/td-main/td-main.interface.d.ts +3 -3
- package/src/components/basic/td-icon/td-icon.class.d.ts +4 -6
- package/src/components/basic/td-icon/td-icon.class.js +32 -29
- package/src/components/basic/td-icon/td-icon.interface.d.ts +3 -4
- package/src/components/basic/td-layout/td-col/td-col.class.d.ts +2 -3
- package/src/components/basic/td-layout/td-col/td-col.class.js +4 -4
- package/src/components/basic/td-layout/td-col/td-col.interface.d.ts +3 -3
- package/src/components/basic/td-layout/td-row/td-row.class.d.ts +2 -2
- package/src/components/basic/td-layout/td-row/td-row.class.js +5 -4
- package/src/components/basic/td-layout/td-row/td-row.interface.d.ts +3 -3
- package/src/components/basic/td-link/td-link.class.d.ts +2 -2
- package/src/components/basic/td-link/td-link.class.js +6 -10
- package/src/components/basic/td-link/td-link.interface.d.ts +3 -3
- package/src/components/basic/td-link/td-link.style.js +1 -1
- package/src/components/basic/td-scrollbar/bar/bar.class.d.ts +2 -2
- package/src/components/basic/td-scrollbar/bar/bar.class.js +4 -4
- package/src/components/basic/td-scrollbar/bar/bar.interface.d.ts +3 -3
- package/src/components/basic/td-scrollbar/td-scrollbar.class.d.ts +4 -2
- package/src/components/basic/td-scrollbar/td-scrollbar.class.js +4 -3
- package/src/components/basic/td-scrollbar/td-scrollbar.interface.d.ts +3 -4
- package/src/components/basic/td-scrollbar/td-scrollbar.interface.js +1 -1
- package/src/components/basic/td-scrollbar/thumb/thumb.class.d.ts +2 -2
- package/src/components/basic/td-scrollbar/thumb/thumb.class.js +2 -3
- package/src/components/basic/td-scrollbar/thumb/thumb.interface.d.ts +3 -3
- package/src/components/basic/td-space/td-space.class.d.ts +2 -2
- package/src/components/basic/td-space/td-space.class.js +11 -5
- package/src/components/basic/td-space/td-space.interface.d.ts +3 -4
- package/src/components/basic/td-text/td-text.class.d.ts +4 -2
- package/src/components/basic/td-text/td-text.class.js +6 -4
- package/src/components/basic/td-text/td-text.interface.d.ts +3 -3
- package/src/components/data/td-avatar/td-avatar.class.d.ts +2 -2
- package/src/components/data/td-avatar/td-avatar.class.js +19 -25
- package/src/components/data/td-avatar/td-avatar.interface.d.ts +3 -3
- package/src/components/data/td-avatar/td-avatar.style.d.ts +2 -0
- package/src/components/data/td-avatar/td-avatar.style.js +19 -1
- package/src/components/data/td-badge/td-badge.class.d.ts +2 -2
- package/src/components/data/td-badge/td-badge.class.js +4 -4
- package/src/components/data/td-badge/td-badge.interface.d.ts +3 -3
- package/src/components/data/td-card/td-card.class.d.ts +4 -5
- package/src/components/data/td-card/td-card.class.js +16 -30
- package/src/components/data/td-card/td-card.interface.d.ts +3 -3
- package/src/components/data/td-card/td-card.style.d.ts +3 -2
- package/src/components/data/td-card/td-card.style.js +17 -3
- package/src/components/data/td-check-tag/td-check-tag.class.d.ts +2 -2
- package/src/components/data/td-check-tag/td-check-tag.class.js +5 -5
- package/src/components/data/td-check-tag/td-check-tag.interface.d.ts +3 -3
- package/src/components/data/td-check-tag/td-check-tag.style.d.ts +2 -2
- package/src/components/data/td-check-tag/td-check-tag.style.js +3 -3
- package/src/components/data/td-collapse/td-collapse.class.d.ts +2 -2
- package/src/components/data/td-collapse/td-collapse.class.js +20 -20
- package/src/components/data/td-collapse/td-collapse.interface.d.ts +3 -3
- package/src/components/data/td-collapse/td-collapse.style.d.ts +2 -0
- package/src/components/data/td-collapse/td-collapse.style.js +9 -1
- package/src/components/data/td-collapse-item/td-collapse-item.class.d.ts +4 -5
- package/src/components/data/td-collapse-item/td-collapse-item.class.js +16 -16
- package/src/components/data/td-collapse-item/td-collapse-item.interface.d.ts +3 -3
- package/src/components/data/td-count-down/td-count-down.class.d.ts +1 -1
- package/src/components/data/td-count-down/td-count-down.class.js +1 -1
- package/src/components/data/td-descriptions/td-descriptions-row.d.ts +4 -5
- package/src/components/data/td-descriptions/td-descriptions-row.js +1 -1
- package/src/components/data/td-descriptions/td-descriptions.class.d.ts +3 -3
- package/src/components/data/td-descriptions/td-descriptions.class.js +2 -3
- package/src/components/data/td-descriptions/td-descriptions.interface.d.ts +3 -4
- package/src/components/data/td-descriptions/td-descritions-cell.d.ts +6 -5
- package/src/components/data/td-descriptions/td-descritions-cell.js +5 -4
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.d.ts +2 -3
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +5 -4
- package/src/components/data/td-descriptions-item/td-descriptions-item.interface.d.ts +3 -4
- package/src/components/data/td-empty/td-empty.class.d.ts +2 -2
- package/src/components/data/td-empty/td-empty.class.js +2 -3
- package/src/components/data/td-empty/td-empty.interface.d.ts +3 -4
- package/src/components/data/td-image/td-image.class.d.ts +2 -3
- package/src/components/data/td-image/td-image.class.js +4 -22
- package/src/components/data/td-image/td-image.interface.d.ts +3 -3
- package/src/components/data/td-image/td-image.style.d.ts +2 -0
- package/src/components/data/td-image/td-image.style.js +19 -1
- package/src/components/data/td-image-viewer/td-image-viewer.class.d.ts +3 -5
- package/src/components/data/td-image-viewer/td-image-viewer.class.js +20 -17
- package/src/components/data/td-image-viewer/td-image-viewer.interface.d.ts +3 -3
- package/src/components/data/td-result/td-result.class.d.ts +2 -2
- package/src/components/data/td-result/td-result.class.js +4 -3
- package/src/components/data/td-result/td-result.interface.d.ts +3 -4
- package/src/components/data/td-segmented/td-segmented.class.d.ts +2 -3
- package/src/components/data/td-segmented/td-segmented.class.js +7 -8
- package/src/components/data/td-segmented/td-segmented.interface.d.ts +2 -3
- package/src/components/data/td-statistic/td-statistic.abstract.d.ts +3 -4
- package/src/components/data/td-statistic/td-statistic.abstract.js +15 -14
- package/src/components/data/td-statistic/td-statistic.class.js +1 -0
- package/src/components/data/td-statistic/td-statistic.interface.d.ts +3 -4
- package/src/components/data/td-tag/td-tag.class.d.ts +3 -4
- package/src/components/data/td-tag/td-tag.class.js +13 -13
- package/src/components/data/td-tag/td-tag.interface.d.ts +3 -3
- package/src/components/feedback/index.d.ts +4 -0
- package/src/components/feedback/index.js +5 -2
- package/src/components/feedback/td-alert/td-alert.class.d.ts +2 -3
- package/src/components/feedback/td-alert/td-alert.class.js +19 -17
- package/src/components/feedback/td-alert/td-alert.interface.d.ts +3 -3
- package/src/components/feedback/td-dialog/td-dialog.class.d.ts +3 -3
- package/src/components/feedback/td-dialog/td-dialog.class.js +25 -29
- package/src/components/feedback/td-dialog/td-dialog.interface.d.ts +3 -3
- package/src/components/feedback/td-dialog/td-dialog.interface.js +1 -1
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.d.ts +2 -3
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +10 -7
- package/src/components/feedback/td-dialog-content/td-dialog-content.interface.d.ts +3 -4
- package/src/components/feedback/td-drawer/td-drawer.class.d.ts +3 -3
- package/src/components/feedback/td-drawer/td-drawer.class.js +5 -5
- package/src/components/feedback/td-drawer/td-drawer.interface.d.ts +2 -2
- package/src/components/feedback/td-focus-trap/focus-trap.d.ts +15 -0
- package/src/components/feedback/td-focus-trap/focus-trap.js +71 -0
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +8 -7
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +129 -129
- package/src/components/feedback/td-focus-trap/td-focus-trap.interface.d.ts +3 -3
- package/src/components/feedback/td-loading/td-loading.class.d.ts +4 -3
- package/src/components/feedback/td-loading/td-loading.class.js +27 -17
- package/src/components/feedback/td-loading/td-loading.interface.d.ts +3 -4
- package/src/components/feedback/td-message/td-message.class.d.ts +4 -4
- package/src/components/feedback/td-message/td-message.class.js +31 -31
- package/src/components/feedback/td-message/td-message.interface.d.ts +3 -4
- package/src/components/feedback/td-message-box/td-message-box.class.d.ts +10 -12
- package/src/components/feedback/td-message-box/td-message-box.class.js +30 -52
- package/src/components/feedback/td-message-box/td-message-box.interface.d.ts +4 -5
- package/src/components/feedback/td-notification/td-notification.class.d.ts +4 -5
- package/src/components/feedback/td-notification/td-notification.class.js +17 -18
- package/src/components/feedback/td-notification/td-notification.interface.d.ts +3 -4
- package/src/components/feedback/td-notification/td-notification.style.js +6 -6
- package/src/components/feedback/td-only-child/td-only-child.class.d.ts +3 -3
- package/src/components/feedback/td-only-child/td-only-child.class.js +3 -3
- package/src/components/feedback/td-overlay/td-overlay.class.d.ts +2 -3
- package/src/components/feedback/td-overlay/td-overlay.class.js +6 -5
- package/src/components/feedback/td-overlay/td-overlay.interface.d.ts +3 -3
- package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +2 -2
- package/src/components/feedback/td-popper/arrow/arrow.class.js +7 -6
- package/src/components/feedback/td-popper/arrow/arrow.const.d.ts +3 -0
- package/src/components/feedback/td-popper/arrow/arrow.const.js +6 -0
- package/src/components/feedback/td-popper/arrow/arrow.interface.d.ts +3 -4
- package/src/components/feedback/td-popper/constants.d.ts +25 -0
- package/src/components/feedback/td-popper/constants.js +5 -0
- package/src/components/feedback/td-popper/content/content.class.d.ts +2 -2
- package/src/components/feedback/td-popper/content/content.class.js +7 -13
- package/src/components/feedback/td-popper/content/content.const.d.ts +2 -2
- package/src/components/feedback/td-popper/content/content.const.js +3 -4
- package/src/components/feedback/td-popper/content/content.interface.d.ts +24 -11
- package/src/components/feedback/td-popper/content/content.interface.js +4 -0
- package/src/components/feedback/td-popper/td-popper.class.d.ts +3 -2
- package/src/components/feedback/td-popper/td-popper.class.js +9 -7
- package/src/components/feedback/td-popper/td-popper.const.d.ts +5 -20
- package/src/components/feedback/td-popper/td-popper.const.js +8 -3
- package/src/components/feedback/td-popper/td-popper.interface.d.ts +6 -4
- package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +2 -2
- package/src/components/feedback/td-popper/trigger/trigger.class.js +6 -6
- package/src/components/feedback/td-popper/trigger/trigger.const.d.ts +1 -0
- package/src/components/feedback/td-popper/trigger/trigger.const.js +4 -1
- package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +3 -3
- package/src/components/feedback/td-tooltip/content/content.class.d.ts +2 -2
- package/src/components/feedback/td-tooltip/content/content.class.js +4 -3
- package/src/components/feedback/td-tooltip/content/content.const.d.ts +55 -0
- package/src/components/feedback/td-tooltip/content/content.const.js +6 -0
- package/src/components/feedback/td-tooltip/content/content.interface.d.ts +19 -3
- package/src/components/feedback/td-tooltip/td-tooltip.class.d.ts +5 -3
- package/src/components/feedback/td-tooltip/td-tooltip.class.js +84 -9
- package/src/components/feedback/td-tooltip/td-tooltip.const.d.ts +77 -0
- package/src/components/feedback/td-tooltip/td-tooltip.const.js +9 -0
- package/src/components/feedback/td-tooltip/td-tooltip.interface.d.ts +6 -3
- package/src/components/feedback/td-tooltip/trigger/trigger.class.d.ts +3 -2
- package/src/components/feedback/td-tooltip/trigger/trigger.class.js +56 -3
- package/src/components/feedback/td-tooltip/trigger/trigger.const.d.ts +4 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.const.js +6 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.interface.d.ts +7 -2
- package/src/components/form/index.d.ts +17 -16
- package/src/components/form/index.js +19 -17
- package/src/components/form/td-checkbox/composables/use-checkbox-status.js +1 -1
- package/src/components/form/td-checkbox/composables/use-checkbox.js +1 -1
- package/src/components/form/td-checkbox/td-checkbox.class.d.ts +18 -3
- package/src/components/form/td-checkbox/td-checkbox.class.js +231 -9
- package/src/components/form/td-checkbox/td-checkbox.const.d.ts +63 -0
- package/src/components/form/td-checkbox/td-checkbox.const.js +88 -0
- package/src/components/form/td-checkbox/td-checkbox.interface.d.ts +5 -5
- package/src/components/form/td-checkbox/td-checkbox.style.d.ts +9 -0
- package/src/components/form/td-checkbox/td-checkbox.style.js +167 -14
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.d.ts +9 -3
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +114 -26
- package/src/components/form/td-checkbox-button/td-checkbox-button.interface.d.ts +2 -4
- package/src/components/form/td-checkbox-button/td-checkbox-button.style.d.ts +8 -1
- package/src/components/form/td-checkbox-button/td-checkbox-button.style.js +89 -12
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.d.ts +11 -3
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +118 -5
- package/src/components/form/td-checkbox-group/td-checkbox-group.interface.d.ts +8 -5
- package/src/components/form/td-form/td-form.class.d.ts +4 -2
- package/src/components/form/td-form/td-form.class.js +9 -5
- package/src/components/form/td-form/td-form.interface.d.ts +7 -4
- package/src/components/form/td-form-item/td-form-item.class.d.ts +4 -5
- package/src/components/form/td-form-item/td-form-item.class.js +34 -27
- package/src/components/form/td-form-item/td-form-item.interface.d.ts +3 -3
- package/src/components/form/td-input/td-input.class.d.ts +3 -4
- package/src/components/form/td-input/td-input.class.js +30 -26
- package/src/components/form/td-input/td-input.interface.d.ts +3 -4
- package/src/components/form/td-input/widget/suffix.d.ts +1 -0
- package/src/components/form/td-input/widget/suffix.js +6 -1
- package/src/components/form/td-input/widget/td-input-wrapper.class.js +5 -5
- package/src/components/form/td-input/widget/utils.js +8 -8
- package/src/components/form/td-option/td-option.class.d.ts +2 -2
- package/src/components/form/td-option/td-option.class.js +3 -3
- package/src/components/form/td-option/td-option.interface.d.ts +3 -3
- package/src/components/form/td-option-group/td-option-group.class.d.ts +2 -2
- package/src/components/form/td-option-group/td-option-group.class.js +2 -3
- package/src/components/form/td-option-group/td-option-group.interface.d.ts +3 -3
- package/src/components/form/td-radio/td-radio.class.d.ts +2 -3
- package/src/components/form/td-radio/td-radio.class.js +8 -5
- package/src/components/form/td-radio/td-radio.interface.d.ts +3 -3
- package/src/components/form/td-radio-button/td-radio-button.class.d.ts +2 -3
- package/src/components/form/td-radio-button/td-radio-button.class.js +9 -9
- package/src/components/form/td-radio-button/td-radio-button.interface.d.ts +3 -3
- package/src/components/form/td-radio-group/td-radio-group.class.d.ts +2 -5
- package/src/components/form/td-radio-group/td-radio-group.class.js +14 -11
- package/src/components/form/td-radio-group/td-radio-group.interface.d.ts +3 -4
- package/src/components/form/td-select/dropdown/dropdown.class.d.ts +2 -2
- package/src/components/form/td-select/dropdown/dropdown.class.js +2 -3
- package/src/components/form/td-select/dropdown/dropdown.interface.d.ts +3 -4
- package/src/components/form/td-select/td-select.class.d.ts +4 -6
- package/src/components/form/td-select/td-select.class.js +4 -6
- package/src/components/form/td-select/td-select.interface.d.ts +13 -5
- package/src/components/form/td-select/td-select.style.d.ts +23 -0
- package/src/components/form/td-select/td-select.style.js +170 -1
- package/src/components/form/td-switch/td-switch.class.d.ts +2 -3
- package/src/components/form/td-switch/td-switch.class.js +2 -3
- package/src/components/form/td-switch/td-switch.interface.d.ts +3 -4
- package/src/components/form/td-switch/widget/td-switch-core.js +4 -4
- package/src/components/navigation/td-affix/td-affix.class.d.ts +2 -3
- package/src/components/navigation/td-affix/td-affix.class.js +2 -3
- package/src/components/navigation/td-affix/td-affix.interface.d.ts +3 -4
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.d.ts +2 -2
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +2 -3
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.interface.d.ts +3 -4
- package/src/components/navigation/td-anchor/td-anchor.class.d.ts +2 -2
- package/src/components/navigation/td-anchor/td-anchor.class.js +6 -4
- package/src/components/navigation/td-anchor/td-anchor.function.js +1 -1
- package/src/components/navigation/td-anchor/td-anchor.interface.d.ts +3 -3
- package/src/components/navigation/td-backtop/td-backtop.class.d.ts +5 -6
- package/src/components/navigation/td-backtop/td-backtop.class.js +36 -59
- package/src/components/navigation/td-backtop/td-backtop.const.d.ts +18 -0
- package/src/components/navigation/td-backtop/td-backtop.const.js +21 -0
- package/src/components/navigation/td-backtop/td-backtop.interface.d.ts +3 -3
- package/src/components/navigation/td-backtop/td-backtop.style.d.ts +2 -0
- package/src/components/navigation/td-backtop/td-backtop.style.js +19 -1
- package/src/components/navigation/td-backtop/use-backtop.d.ts +2 -3
- package/src/components/navigation/td-backtop/use-backtop.js +2 -2
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.d.ts +3 -3
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +12 -8
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.interface.d.ts +3 -4
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.d.ts +2 -2
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +2 -3
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.interface.d.ts +3 -4
- package/src/components/navigation/td-menu/td-menu.class.d.ts +2 -2
- package/src/components/navigation/td-menu/td-menu.class.js +4 -3
- package/src/components/navigation/td-menu/td-menu.interface.d.ts +3 -4
- package/src/components/navigation/td-tabs/td-tab-bar.class.d.ts +2 -2
- package/src/components/navigation/td-tabs/td-tab-bar.class.js +3 -3
- package/src/components/navigation/td-tabs/td-tab-bar.interface.d.ts +3 -3
- package/src/components/navigation/td-tabs/td-tab-nav.class.d.ts +2 -3
- package/src/components/navigation/td-tabs/td-tab-nav.class.js +3 -4
- package/src/components/navigation/td-tabs/td-tab-nav.interface.d.ts +3 -3
- package/src/components/navigation/td-tabs/td-tab-pane.class.d.ts +2 -3
- package/src/components/navigation/td-tabs/td-tab-pane.class.js +12 -16
- package/src/components/navigation/td-tabs/td-tab-pane.interface.d.ts +3 -4
- package/src/components/navigation/td-tabs/td-tabs.class.d.ts +2 -2
- package/src/components/navigation/td-tabs/td-tabs.class.js +6 -4
- package/src/components/navigation/td-tabs/td-tabs.interface.d.ts +3 -3
- package/src/components/others/example/example-source-wrapper.js +2 -1
- package/src/components/others/td-divider/td-divider.class.d.ts +2 -2
- package/src/components/others/td-divider/td-divider.class.js +2 -3
- package/src/components/others/td-divider/td-divider.interface.d.ts +3 -3
- package/src/constants/aria.d.ts +17 -0
- package/src/constants/aria.js +20 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/use-delayed-toggle.d.ts +23 -0
- package/src/hooks/use-delayed-toggle.js +52 -0
- package/src/styles/var.d.ts +2 -16
- package/src/styles/var.js +7 -17
- package/src/utils/dom/event.d.ts +6 -0
- package/src/utils/dom/event.js +17 -0
- package/src/ui/ui.abstract.d.ts +0 -18
- package/src/ui/ui.abstract.js +0 -50
- package/src/ui/ui.interface.d.ts +0 -12
- package/src/ui/ui.interface.js +0 -2
|
@@ -5,13 +5,139 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const utils_1 = require("@type-dom/utils");
|
|
6
6
|
const framework_1 = require("@type-dom/framework");
|
|
7
7
|
const use_escape_keydown_1 = require("../../../hooks/use-escape-keydown");
|
|
8
|
-
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
9
8
|
const utils_2 = require("./utils");
|
|
10
9
|
const tokens_1 = require("./tokens");
|
|
11
|
-
class TdFocusTrap extends
|
|
10
|
+
class TdFocusTrap extends framework_1.TypeFragment {
|
|
12
11
|
constructor(params = {}) {
|
|
13
|
-
super(
|
|
12
|
+
super();
|
|
13
|
+
this.onKeydown = (e) => {
|
|
14
|
+
var _a;
|
|
15
|
+
if (!this.props.loop && !this.props.trapped) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
|
|
22
|
+
const { loop } = this.props;
|
|
23
|
+
const isTabbing = key === utils_1.EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
|
|
24
|
+
const currentFocusingEl = document.activeElement;
|
|
25
|
+
if (isTabbing && currentFocusingEl) {
|
|
26
|
+
const container = currentTarget;
|
|
27
|
+
const [first, last] = (0, utils_2.getEdges)(container);
|
|
28
|
+
const isTabbable = first && last;
|
|
29
|
+
if (isTabbable) {
|
|
30
|
+
if (!shiftKey && currentFocusingEl === last) {
|
|
31
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
32
|
+
focusReason: this.focusReason
|
|
33
|
+
});
|
|
34
|
+
this.emit('focusout-prevented', focusoutPreventedEvent);
|
|
35
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
if (loop) {
|
|
38
|
+
(0, utils_2.tryFocus)(first, true);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (shiftKey &&
|
|
43
|
+
[first, container].includes(currentFocusingEl)) {
|
|
44
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
45
|
+
focusReason: this.focusReason
|
|
46
|
+
});
|
|
47
|
+
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
48
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
if (loop) {
|
|
51
|
+
(0, utils_2.tryFocus)(last, true);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (currentFocusingEl === container) {
|
|
58
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
59
|
+
focusReason: this.focusReason
|
|
60
|
+
});
|
|
61
|
+
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
62
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this.trapOnFocus = (e) => {
|
|
70
|
+
this.emit(tokens_1.ON_TRAP_FOCUS_EVT, e);
|
|
71
|
+
};
|
|
72
|
+
this.releaseOnFocus = (e) => {
|
|
73
|
+
this.emit(tokens_1.ON_RELEASE_FOCUS_EVT, e);
|
|
74
|
+
};
|
|
75
|
+
this.onFocusIn = (e) => {
|
|
76
|
+
var _a;
|
|
77
|
+
const trapContainer = this.forwardRef;
|
|
78
|
+
if (!trapContainer) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const target = e.target;
|
|
82
|
+
const relatedTarget = e.relatedTarget;
|
|
83
|
+
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
84
|
+
if (!this.props.trapped) {
|
|
85
|
+
const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
|
|
86
|
+
if (!isPrevFocusedInTrap) {
|
|
87
|
+
this.lastFocusBeforeTrapped = relatedTarget;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (isFocusedInTrap) {
|
|
91
|
+
this.emit('focusin', e);
|
|
92
|
+
}
|
|
93
|
+
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (this.props.trapped) {
|
|
97
|
+
if (isFocusedInTrap) {
|
|
98
|
+
this.lastFocusAfterTrapped = target;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
this.onFocusOut = (e) => {
|
|
106
|
+
var _a;
|
|
107
|
+
const trapContainer = this.forwardRef;
|
|
108
|
+
if (((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) || !trapContainer) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (this.props.trapped) {
|
|
112
|
+
const relatedTarget = e
|
|
113
|
+
.relatedTarget;
|
|
114
|
+
if (!(0, utils_1.isNil)(relatedTarget) && !trapContainer.contains(relatedTarget)) {
|
|
115
|
+
// Give embedded focus layer time to pause this layer before reclaiming focus
|
|
116
|
+
// And only reclaim focus if it should currently be trapping
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
var _a;
|
|
119
|
+
if (!((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) && this.props.trapped) {
|
|
120
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
121
|
+
focusReason: this.focusReason
|
|
122
|
+
});
|
|
123
|
+
this.emit('focusout-prevented', focusoutPreventedEvent);
|
|
124
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
125
|
+
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, 0);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const target = e.target;
|
|
133
|
+
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
134
|
+
if (!isFocusedInTrap)
|
|
135
|
+
this.emit('focusout', e);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
// this.useTag('fragment');
|
|
14
139
|
this.className = 'TdFocusTrap';
|
|
140
|
+
this.content = params.slot;
|
|
15
141
|
this.inheritAttrs = false;
|
|
16
142
|
this.props = this.useParams(params);
|
|
17
143
|
}
|
|
@@ -50,62 +176,6 @@ class TdFocusTrap extends ui_abstract_1.UI {
|
|
|
50
176
|
var _a;
|
|
51
177
|
(_a = this.escapeKeydown) === null || _a === void 0 ? void 0 : _a.beforeDestroy();
|
|
52
178
|
}
|
|
53
|
-
onKeydown(e) {
|
|
54
|
-
var _a;
|
|
55
|
-
if (!this.props.loop && !this.props.trapped) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
|
|
62
|
-
const { loop } = this.props;
|
|
63
|
-
const isTabbing = key === utils_1.EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
|
|
64
|
-
const currentFocusingEl = document.activeElement;
|
|
65
|
-
if (isTabbing && currentFocusingEl) {
|
|
66
|
-
const container = currentTarget;
|
|
67
|
-
const [first, last] = (0, utils_2.getEdges)(container);
|
|
68
|
-
const isTabbable = first && last;
|
|
69
|
-
if (isTabbable) {
|
|
70
|
-
if (!shiftKey && currentFocusingEl === last) {
|
|
71
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
72
|
-
focusReason: this.focusReason
|
|
73
|
-
});
|
|
74
|
-
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
75
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
76
|
-
e.preventDefault();
|
|
77
|
-
if (loop) {
|
|
78
|
-
(0, utils_2.tryFocus)(first, true);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else if (shiftKey &&
|
|
83
|
-
[first, container].includes(currentFocusingEl)) {
|
|
84
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
85
|
-
focusReason: this.focusReason
|
|
86
|
-
});
|
|
87
|
-
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
88
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
if (loop) {
|
|
91
|
-
(0, utils_2.tryFocus)(last, true);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
if (currentFocusingEl === container) {
|
|
98
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
99
|
-
focusReason: this.focusReason
|
|
100
|
-
});
|
|
101
|
-
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
102
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
179
|
setFocusTrapEl(el) {
|
|
110
180
|
if (el) {
|
|
111
181
|
this.props.focusTrapEl = el;
|
|
@@ -124,76 +194,6 @@ class TdFocusTrap extends ui_abstract_1.UI {
|
|
|
124
194
|
oldEl.removeEventListener('focusout', this.onFocusOut);
|
|
125
195
|
}
|
|
126
196
|
}
|
|
127
|
-
trapOnFocus(e) {
|
|
128
|
-
this.emit(tokens_1.ON_TRAP_FOCUS_EVT, e);
|
|
129
|
-
}
|
|
130
|
-
releaseOnFocus(e) {
|
|
131
|
-
this.emit(tokens_1.ON_RELEASE_FOCUS_EVT, e);
|
|
132
|
-
}
|
|
133
|
-
onFocusIn(e) {
|
|
134
|
-
var _a;
|
|
135
|
-
const trapContainer = this.forwardRef;
|
|
136
|
-
if (!trapContainer) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const target = e.target;
|
|
140
|
-
const relatedTarget = e.relatedTarget;
|
|
141
|
-
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
142
|
-
if (!this.props.trapped) {
|
|
143
|
-
const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
|
|
144
|
-
if (!isPrevFocusedInTrap) {
|
|
145
|
-
this.lastFocusBeforeTrapped = relatedTarget;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (isFocusedInTrap) {
|
|
149
|
-
this.emit('focusin', e);
|
|
150
|
-
}
|
|
151
|
-
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
if (this.props.trapped) {
|
|
155
|
-
if (isFocusedInTrap) {
|
|
156
|
-
this.lastFocusAfterTrapped = target;
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
;
|
|
164
|
-
onFocusOut(e) {
|
|
165
|
-
var _a;
|
|
166
|
-
const trapContainer = this.forwardRef;
|
|
167
|
-
if (((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) || !trapContainer) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (this.props.trapped) {
|
|
171
|
-
const relatedTarget = e
|
|
172
|
-
.relatedTarget;
|
|
173
|
-
if (!(0, utils_1.isNil)(relatedTarget) && !trapContainer.contains(relatedTarget)) {
|
|
174
|
-
// Give embedded focus layer time to pause this layer before reclaiming focus
|
|
175
|
-
// And only reclaim focus if it should currently be trapping
|
|
176
|
-
setTimeout(() => {
|
|
177
|
-
var _a;
|
|
178
|
-
if (!((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) && this.props.trapped) {
|
|
179
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
180
|
-
focusReason: this.focusReason
|
|
181
|
-
});
|
|
182
|
-
this.emit('focusout-prevented', focusoutPreventedEvent);
|
|
183
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
184
|
-
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}, 0);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
const target = e.target;
|
|
192
|
-
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
193
|
-
if (!isFocusedInTrap)
|
|
194
|
-
this.emit('focusout', e);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
197
|
startTrap() {
|
|
198
198
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
199
199
|
// Wait for forwardRef to resolve
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITypeConfig, ITypeElement } from '@type-dom/framework';
|
|
2
2
|
import { ON_RELEASE_FOCUS_EVT, ON_TRAP_FOCUS_EVT } from './tokens';
|
|
3
|
-
export interface ITdFocusTrap extends
|
|
3
|
+
export interface ITdFocusTrap extends ITypeElement {
|
|
4
4
|
className: 'TdFocusTrap';
|
|
5
5
|
}
|
|
6
|
-
export interface ITdFocusTrapConfig extends
|
|
6
|
+
export interface ITdFocusTrapConfig extends ITypeConfig {
|
|
7
7
|
loop?: boolean;
|
|
8
8
|
trapped?: boolean;
|
|
9
9
|
focusTrapEl?: HTMLElement;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeTransition } from '@type-dom/framework';
|
|
2
2
|
import { ITdLoading, ITdLoadingConfig } from './td-loading.interface';
|
|
3
|
-
export declare class TdLoading extends
|
|
3
|
+
export declare class TdLoading extends TypeTransition implements ITdLoading {
|
|
4
4
|
className: 'TdLoading';
|
|
5
5
|
props: ITdLoadingConfig;
|
|
6
|
-
private transition;
|
|
7
6
|
private mask;
|
|
8
7
|
private svg;
|
|
9
8
|
private spinner;
|
|
10
9
|
private spinnerText?;
|
|
11
10
|
constructor(params?: ITdLoadingConfig);
|
|
11
|
+
static service(params: ITdLoadingConfig): TdLoading;
|
|
12
|
+
close(): void;
|
|
12
13
|
}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdLoading = void 0;
|
|
4
|
-
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
5
4
|
const framework_1 = require("@type-dom/framework");
|
|
6
5
|
const svgs_1 = require("@type-dom/svgs");
|
|
7
|
-
class TdLoading extends
|
|
6
|
+
class TdLoading extends framework_1.TypeTransition {
|
|
8
7
|
constructor(params = {}) {
|
|
9
|
-
super(
|
|
8
|
+
super();
|
|
10
9
|
this.className = 'TdLoading';
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
// this.content = new Transition({
|
|
11
|
+
// name: 'td-loading-fade',
|
|
12
|
+
// emits: {
|
|
13
|
+
// afterLeave: () => {
|
|
14
|
+
// console.log('afterLeave');
|
|
15
|
+
// }
|
|
16
|
+
// }
|
|
17
|
+
// });
|
|
18
|
+
this.addEmits({
|
|
19
|
+
afterLeave: () => {
|
|
20
|
+
console.log('afterLeave');
|
|
17
21
|
}
|
|
18
22
|
});
|
|
23
|
+
// this.addChild(this.content);
|
|
19
24
|
this.svg = (params === null || params === void 0 ? void 0 : params.spinner) || (params === null || params === void 0 ? void 0 : params.svg);
|
|
20
25
|
this.spinner = new svgs_1.SvgSvg({
|
|
21
26
|
name: 'spinner',
|
|
@@ -46,20 +51,25 @@ class TdLoading extends ui_abstract_1.UI {
|
|
|
46
51
|
childNodes: [
|
|
47
52
|
new framework_1.Div({
|
|
48
53
|
name: 'spinner',
|
|
49
|
-
|
|
54
|
+
init: (element) => {
|
|
55
|
+
console.log('element is ', element);
|
|
56
|
+
element === null || element === void 0 ? void 0 : element.addChild(this.spinner);
|
|
50
57
|
if (this.spinnerText) {
|
|
51
|
-
|
|
58
|
+
element === null || element === void 0 ? void 0 : element.addChild(this.spinnerText);
|
|
52
59
|
}
|
|
53
|
-
|
|
54
|
-
return [this.spinner];
|
|
55
|
-
}
|
|
56
|
-
})()
|
|
60
|
+
},
|
|
57
61
|
})
|
|
58
62
|
]
|
|
59
63
|
});
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
64
|
+
// this.content.addChild(this.mask);
|
|
65
|
+
this.setContent(this.mask);
|
|
62
66
|
this.props = this.useParams(params);
|
|
63
67
|
}
|
|
68
|
+
static service(params) {
|
|
69
|
+
return new TdLoading(params);
|
|
70
|
+
}
|
|
71
|
+
close() {
|
|
72
|
+
// todo close
|
|
73
|
+
}
|
|
64
74
|
}
|
|
65
75
|
exports.TdLoading = TdLoading;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { TypeElement } from '@type-dom/framework';
|
|
2
|
-
|
|
3
|
-
export interface ITdLoading extends IUI {
|
|
1
|
+
import { ITypeElement, ITypeTransitionConfig, TypeElement } from '@type-dom/framework';
|
|
2
|
+
export interface ITdLoading extends ITypeElement {
|
|
4
3
|
className: 'TdLoading';
|
|
5
4
|
}
|
|
6
|
-
export interface ITdLoadingConfig extends
|
|
5
|
+
export interface ITdLoadingConfig extends ITypeTransitionConfig {
|
|
7
6
|
parent?: TypeElement;
|
|
8
7
|
/**
|
|
9
8
|
* @description background color of the mask
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { TypeNode } from '@type-dom/framework';
|
|
2
|
-
import { UI } from '../../../ui/ui.abstract';
|
|
1
|
+
import { Transition, TypeFragment, TypeNode } from '@type-dom/framework';
|
|
3
2
|
import { ITdMessage, ITdMessageConfig } from './td-message.interface';
|
|
4
|
-
export declare class TdMessage extends
|
|
3
|
+
export declare class TdMessage extends TypeFragment implements ITdMessage {
|
|
5
4
|
className: 'TdMessage';
|
|
6
|
-
|
|
5
|
+
content: Transition;
|
|
7
6
|
private message;
|
|
8
7
|
props: ITdMessageConfig;
|
|
9
8
|
private visible?;
|
|
10
9
|
private stopTimer;
|
|
11
10
|
static msgId: number;
|
|
12
11
|
static msgList: TdMessage[];
|
|
12
|
+
static groupList: TdMessage[];
|
|
13
13
|
private repeatNum?;
|
|
14
14
|
private badge?;
|
|
15
15
|
constructor(option?: string | ITdMessageConfig);
|
|
@@ -4,14 +4,20 @@ exports.TdMessage = void 0;
|
|
|
4
4
|
const utils_1 = require("@type-dom/utils");
|
|
5
5
|
const framework_1 = require("@type-dom/framework");
|
|
6
6
|
const svgs_1 = require("@type-dom/svgs");
|
|
7
|
-
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
8
7
|
const td_badge_class_1 = require("../../data/td-badge/td-badge.class");
|
|
9
8
|
const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
|
|
10
9
|
const td_message_interface_1 = require("./td-message.interface");
|
|
11
10
|
const td_message_style_1 = require("./td-message.style");
|
|
12
|
-
class TdMessage extends
|
|
11
|
+
class TdMessage extends framework_1.TypeFragment {
|
|
13
12
|
constructor(option) {
|
|
14
13
|
var _a;
|
|
14
|
+
super();
|
|
15
|
+
this.keydown = ({ code }) => {
|
|
16
|
+
if (code === utils_1.EVENT_CODE.esc) {
|
|
17
|
+
// press esc to close the message
|
|
18
|
+
this.close();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
15
21
|
let params = {};
|
|
16
22
|
if (typeof option === 'string') {
|
|
17
23
|
params.message = option;
|
|
@@ -19,35 +25,11 @@ class TdMessage extends ui_abstract_1.UI {
|
|
|
19
25
|
else {
|
|
20
26
|
params = option || {};
|
|
21
27
|
}
|
|
22
|
-
super(params, 'fragment');
|
|
23
|
-
this.keydown = ({ code }) => {
|
|
24
|
-
if (code === utils_1.EVENT_CODE.esc) {
|
|
25
|
-
// press esc to close the message
|
|
26
|
-
this.close();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
28
|
this.className = 'TdMessage';
|
|
30
29
|
this.visible = false;
|
|
31
30
|
this.stopTimer = undefined;
|
|
32
31
|
(0, td_message_style_1.useStyle)(params);
|
|
33
32
|
this.to = (params === null || params === void 0 ? void 0 : params.appendTo) || document.body;
|
|
34
|
-
this.transition = new framework_1.Transition({
|
|
35
|
-
name: 'td-message-fade',
|
|
36
|
-
emits: {
|
|
37
|
-
beforeLeave: () => {
|
|
38
|
-
var _a;
|
|
39
|
-
console.log('beforeLeave');
|
|
40
|
-
(_a = params.onClose) === null || _a === void 0 ? void 0 : _a.call(params);
|
|
41
|
-
},
|
|
42
|
-
afterLeave: () => {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
console.log('afterLeave');
|
|
45
|
-
(_b = (_a = params.emits) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a); // destroy ???
|
|
46
|
-
this.message.dom.remove();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
this.addChild(this.transition);
|
|
51
33
|
this.message = new framework_1.Div({
|
|
52
34
|
attrObj: {
|
|
53
35
|
role: 'alert'
|
|
@@ -64,9 +46,25 @@ class TdMessage extends ui_abstract_1.UI {
|
|
|
64
46
|
}
|
|
65
47
|
}
|
|
66
48
|
});
|
|
49
|
+
this.content = new framework_1.Transition({
|
|
50
|
+
name: 'td-message-fade',
|
|
51
|
+
slot: this.message,
|
|
52
|
+
emits: {
|
|
53
|
+
beforeLeave: () => {
|
|
54
|
+
var _a;
|
|
55
|
+
console.log('beforeLeave');
|
|
56
|
+
(_a = params.onClose) === null || _a === void 0 ? void 0 : _a.call(params);
|
|
57
|
+
},
|
|
58
|
+
afterLeave: () => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
console.log('afterLeave');
|
|
61
|
+
(_b = (_a = params.emits) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a); // destroy ???
|
|
62
|
+
this.message.dom.remove();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.addChild(this.content);
|
|
67
67
|
// this.message.style.hide();
|
|
68
|
-
// this.transition.setSlot(this.message);
|
|
69
|
-
this.transition.addChild(this.message);
|
|
70
68
|
const type = (params === null || params === void 0 ? void 0 : params.type) || 'info';
|
|
71
69
|
const iconComponent = (params === null || params === void 0 ? void 0 : params.icon) || (new svgs_1.TypeComponentsMap[type]()) || '';
|
|
72
70
|
console.log('iconComponent', iconComponent);
|
|
@@ -136,14 +134,14 @@ class TdMessage extends ui_abstract_1.UI {
|
|
|
136
134
|
top: offset
|
|
137
135
|
});
|
|
138
136
|
if (params.grouping) {
|
|
139
|
-
if (TdMessage.
|
|
137
|
+
if (TdMessage.groupList.length === 0) {
|
|
140
138
|
TdMessage.msgId = TdMessage.msgId + 1;
|
|
141
|
-
TdMessage.
|
|
139
|
+
TdMessage.groupList.push(this);
|
|
142
140
|
// 特殊类,需要直接渲染。事件触发的类。
|
|
143
141
|
this.mount(this.to);
|
|
144
142
|
}
|
|
145
143
|
else {
|
|
146
|
-
const msg = TdMessage.
|
|
144
|
+
const msg = TdMessage.groupList[0];
|
|
147
145
|
msg.repeatNum = (msg.repeatNum || 1) + 1;
|
|
148
146
|
console.log('msg.repeatNum is ', msg.repeatNum);
|
|
149
147
|
if (msg.repeatNum > 1) {
|
|
@@ -229,6 +227,7 @@ class TdMessage extends ui_abstract_1.UI {
|
|
|
229
227
|
this.message.style.hide();
|
|
230
228
|
this.clearTimer();
|
|
231
229
|
TdMessage.msgId = (TdMessage.msgId || 1) - 1;
|
|
230
|
+
TdMessage.groupList = TdMessage.groupList.filter(item => item !== this);
|
|
232
231
|
TdMessage.msgList = TdMessage.msgList.filter(item => item !== this);
|
|
233
232
|
console.log('TdMessage.msgList is ', TdMessage.msgList, TdMessage.msgList.length);
|
|
234
233
|
TdMessage.msgList.forEach((msg, index) => {
|
|
@@ -244,3 +243,4 @@ class TdMessage extends ui_abstract_1.UI {
|
|
|
244
243
|
exports.TdMessage = TdMessage;
|
|
245
244
|
TdMessage.msgId = 0;
|
|
246
245
|
TdMessage.msgList = [];
|
|
246
|
+
TdMessage.groupList = [];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface ITdMessage extends IUI {
|
|
1
|
+
import { ITypeConfig, ITypeElement, TypeElement, TypeSvgSvg } from '@type-dom/framework';
|
|
2
|
+
export interface ITdMessage extends ITypeElement {
|
|
4
3
|
className: 'TdMessage';
|
|
5
4
|
}
|
|
6
5
|
export declare const messageDefaults: {
|
|
@@ -22,7 +21,7 @@ export declare const messageDefaults: {
|
|
|
22
21
|
readonly appendTo: HTMLElement;
|
|
23
22
|
};
|
|
24
23
|
export type IMessageTypes = 'success' | 'info' | 'warning' | 'error';
|
|
25
|
-
export interface ITdMessageConfig extends
|
|
24
|
+
export interface ITdMessageConfig extends ITypeConfig {
|
|
26
25
|
/**
|
|
27
26
|
* @description custom class name for Message
|
|
28
27
|
* default: messageDefaults.customClass,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare class TdMessageBox extends UI<undefined> implements ITdMessageBox {
|
|
1
|
+
import { Transition, TypeFragment } from '@type-dom/framework';
|
|
2
|
+
import { IAction, ITdMessageBox, ITdMessageBoxConfig } from './td-message-box.interface';
|
|
3
|
+
export declare class TdMessageBox extends TypeFragment implements ITdMessageBox {
|
|
5
4
|
className: 'TdMessageBox';
|
|
5
|
+
content: Transition;
|
|
6
6
|
props: ITdMessageBoxConfig;
|
|
7
|
-
private transition;
|
|
8
7
|
private overlay;
|
|
9
8
|
private dialog;
|
|
10
9
|
private messageBox;
|
|
@@ -12,7 +11,7 @@ export declare class TdMessageBox extends UI<undefined> implements ITdMessageBox
|
|
|
12
11
|
private title?;
|
|
13
12
|
private visible;
|
|
14
13
|
private state;
|
|
15
|
-
private
|
|
14
|
+
private msgContent;
|
|
16
15
|
private container;
|
|
17
16
|
private inputDiv?;
|
|
18
17
|
private btns;
|
|
@@ -27,17 +26,16 @@ export declare class TdMessageBox extends UI<undefined> implements ITdMessageBox
|
|
|
27
26
|
constructor(params?: ITdMessageBoxConfig);
|
|
28
27
|
mounted(): void;
|
|
29
28
|
beforeDestroy(): void;
|
|
30
|
-
static
|
|
29
|
+
static info(params?: ITdMessageBoxConfig): TdMessageBox;
|
|
31
30
|
static alert(message: string, title?: string, params?: ITdMessageBoxConfig): void;
|
|
32
|
-
static confirm(message: string, title?: string, params?: ITdMessageBoxConfig):
|
|
33
|
-
static prompt(message: string, title?: string, params?: ITdMessageBoxConfig):
|
|
34
|
-
promise(input?: TdInput): Promise<IMessageBoxInputData | undefined>;
|
|
31
|
+
static confirm(message: string, title?: string, params?: ITdMessageBoxConfig): TdMessageBox;
|
|
32
|
+
static prompt(message: string, title?: string, params?: ITdMessageBoxConfig): TdMessageBox;
|
|
35
33
|
doClose(): void;
|
|
36
|
-
handleWrapperClick()
|
|
34
|
+
handleWrapperClick: () => void;
|
|
37
35
|
handleInputEnter: (e: KeyboardEvent) => void;
|
|
38
36
|
handleAction(action: IAction): void;
|
|
39
37
|
validate(): boolean;
|
|
40
|
-
getInputElement():
|
|
38
|
+
getInputElement(): HTMLTextAreaElement | HTMLInputElement | undefined;
|
|
41
39
|
handleClose(): void;
|
|
42
40
|
onCloseRequested(): void;
|
|
43
41
|
getAppendToElement(props?: ITdMessageBoxConfig): HTMLElement;
|