@type-dom/ui 0.0.4 → 0.0.6
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 -45
- package/package.json +4 -3
- package/src/aria.d.ts +15 -0
- package/src/components/basic/td-button/td-button.abstract.d.ts +19 -0
- package/src/components/basic/td-button/td-button.abstract.js +175 -0
- package/src/components/basic/td-button/td-button.class.d.ts +3 -14
- package/src/components/basic/td-button/td-button.class.js +4 -172
- package/src/components/basic/td-button/td-button.const.d.ts +7 -0
- package/src/components/basic/td-button/td-button.const.js +4 -0
- package/src/components/basic/td-button/td-button.interface.d.ts +16 -6
- package/src/components/basic/td-button/td-button.interface.js +4 -0
- package/src/components/basic/td-button/td-button.style.d.ts +8 -3
- package/src/components/basic/td-button/td-button.style.js +28 -10
- package/src/components/basic/td-button-group/td-button-group.class.d.ts +2 -2
- package/src/components/basic/td-button-group/td-button-group.class.js +28 -25
- package/src/components/basic/td-container/td-aside/td-aside.class.d.ts +3 -2
- package/src/components/basic/td-container/td-aside/td-aside.class.js +7 -16
- package/src/components/basic/td-container/td-container.class.d.ts +4 -3
- package/src/components/basic/td-container/td-container.class.js +9 -8
- package/src/components/basic/td-container/td-container.interface.d.ts +2 -2
- 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 -3
- package/src/components/basic/td-container/td-footer/td-footer.class.js +9 -11
- 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 +10 -10
- package/src/components/basic/td-container/td-main/td-main.class.d.ts +2 -1
- package/src/components/basic/td-container/td-main/td-main.class.js +6 -4
- package/src/components/basic/td-icon/td-icon.class.d.ts +30 -6
- package/src/components/basic/td-icon/td-icon.class.js +111 -47
- package/src/components/basic/td-icon/td-icon.interface.d.ts +36 -6
- package/src/components/basic/td-icon/td-icon.style.d.ts +5 -14
- package/src/components/basic/td-icon/td-icon.style.js +5 -6
- package/src/components/basic/td-layout/td-col/td-col.class.d.ts +4 -4
- package/src/components/basic/td-layout/td-col/td-col.class.js +48 -45
- package/src/components/basic/td-layout/td-col/td-col.interface.d.ts +0 -4
- package/src/components/basic/td-layout/td-row/td-row.class.d.ts +4 -3
- package/src/components/basic/td-layout/td-row/td-row.class.js +31 -30
- package/src/components/basic/td-layout/td-row/td-row.interface.d.ts +0 -1
- package/src/components/basic/td-link/td-link.class.d.ts +5 -5
- package/src/components/basic/td-link/td-link.class.js +53 -55
- package/src/components/basic/td-link/td-link.interface.d.ts +14 -6
- package/src/components/basic/td-link/td-link.style.d.ts +14 -3
- package/src/components/basic/td-link/td-link.style.js +40 -10
- package/src/components/basic/td-scrollbar/bar/bar.class.d.ts +2 -1
- package/src/components/basic/td-scrollbar/bar/bar.class.js +8 -7
- package/src/components/basic/td-scrollbar/td-scrollbar.class.d.ts +3 -3
- package/src/components/basic/td-scrollbar/td-scrollbar.class.js +18 -20
- package/src/components/basic/td-scrollbar/td-scrollbar.interface.d.ts +3 -2
- package/src/components/basic/td-scrollbar/thumb/thumb.class.d.ts +2 -1
- package/src/components/basic/td-scrollbar/thumb/thumb.class.js +12 -12
- package/src/components/basic/td-space/td-space.class.d.ts +5 -5
- package/src/components/basic/td-space/td-space.class.js +32 -30
- package/src/components/basic/td-space/td-space.interface.d.ts +1 -0
- package/src/components/basic/td-text/td-text.class.d.ts +3 -3
- package/src/components/basic/td-text/td-text.class.js +22 -19
- package/src/components/basic/td-text/td-text.interface.d.ts +4 -2
- package/src/components/basic/td-text/td-text.style.d.ts +1 -1
- package/src/components/basic/td-text/td-text.style.js +13 -4
- package/src/components/data/index.d.ts +30 -0
- package/src/components/data/index.js +34 -0
- package/src/components/data/td-avatar/td-avatar.class.d.ts +12 -0
- package/src/components/data/td-avatar/td-avatar.class.js +120 -0
- package/src/components/data/td-avatar/td-avatar.interface.d.ts +41 -0
- package/src/components/data/td-avatar/td-avatar.style.d.ts +13 -0
- package/src/components/data/td-avatar/td-avatar.style.js +20 -0
- package/src/components/data/td-badge/td-badge.class.d.ts +9 -0
- package/src/components/data/td-badge/td-badge.class.js +104 -0
- package/src/components/data/td-badge/td-badge.interface.d.ts +52 -0
- package/src/components/data/td-badge/td-badge.style.d.ts +7 -0
- package/src/components/data/td-badge/td-badge.style.js +12 -0
- package/src/components/data/td-card/td-card.class.d.ts +14 -0
- package/src/components/data/td-card/td-card.class.js +102 -0
- package/src/components/data/td-card/td-card.interface.d.ts +26 -0
- package/src/components/data/td-card/td-card.interface.js +2 -0
- package/src/components/data/td-card/td-card.style.d.ts +9 -0
- package/src/components/data/td-card/td-card.style.js +29 -0
- package/src/components/data/td-carousel/td-carousel.class.d.ts +0 -0
- package/src/components/data/td-carousel/td-carousel.class.js +1 -0
- package/src/components/data/td-carousel/td-carousel.interface.d.ts +0 -0
- package/src/components/data/td-carousel/td-carousel.interface.js +1 -0
- package/src/components/data/td-check-tag/td-check-tag.class.d.ts +12 -0
- package/src/components/data/td-check-tag/td-check-tag.class.js +75 -0
- package/src/components/data/td-check-tag/td-check-tag.interface.d.ts +22 -0
- package/src/components/data/td-check-tag/td-check-tag.interface.js +3 -0
- package/src/components/data/td-check-tag/td-check-tag.style.d.ts +7 -0
- package/src/components/data/td-check-tag/td-check-tag.style.js +39 -0
- package/src/components/data/td-collapse/td-collapse.class.d.ts +13 -0
- package/src/components/data/td-collapse/td-collapse.class.js +85 -0
- package/src/components/data/td-collapse/td-collapse.interface.d.ts +18 -0
- package/src/components/data/td-collapse/td-collapse.interface.js +2 -0
- package/src/components/data/td-collapse/td-collapse.style.d.ts +11 -0
- package/src/components/data/td-collapse/td-collapse.style.js +22 -0
- package/src/components/data/td-collapse-item/td-collapse-item.class.d.ts +25 -0
- package/src/components/data/td-collapse-item/td-collapse-item.class.js +222 -0
- package/src/components/data/td-collapse-item/td-collapse-item.interface.d.ts +20 -0
- package/src/components/data/td-collapse-item/td-collapse-item.interface.js +2 -0
- package/src/components/data/td-collapse-transition/td-collapse-transition.class.d.ts +6 -0
- package/src/components/data/td-collapse-transition/td-collapse-transition.class.js +12 -0
- package/src/components/data/td-collapse-transition/td-collapse-transition.interface.d.ts +4 -0
- package/src/components/data/td-collapse-transition/td-collapse-transition.interface.js +2 -0
- package/src/components/data/td-collapse-transition/td-collapse-transition.util.d.ts +2 -0
- package/src/components/data/td-collapse-transition/td-collapse-transition.util.js +147 -0
- package/src/components/data/td-count-down/td-count-down.class.d.ts +13 -0
- package/src/components/data/td-count-down/td-count-down.class.js +57 -0
- package/src/components/data/td-count-down/td-count-down.function.d.ts +0 -0
- package/src/components/data/td-count-down/td-count-down.function.js +1 -0
- package/src/components/data/td-count-down/td-count-down.interface.d.ts +11 -0
- package/src/components/data/td-count-down/td-count-down.interface.js +2 -0
- package/src/components/data/td-count-down/utils.d.ts +3 -0
- package/src/components/data/td-count-down/utils.js +32 -0
- package/src/components/data/td-descriptions/td-descriptions-row.d.ts +21 -0
- package/src/components/data/td-descriptions/td-descriptions-row.js +80 -0
- package/src/components/data/td-descriptions/td-descriptions.class.d.ts +18 -0
- package/src/components/data/td-descriptions/td-descriptions.class.js +156 -0
- package/src/components/data/td-descriptions/td-descriptions.interface.d.ts +43 -0
- package/src/components/data/td-descriptions/td-descriptions.interface.js +2 -0
- package/src/components/data/td-descriptions/td-descriptions.style.d.ts +51 -0
- package/src/components/data/td-descriptions/td-descriptions.style.js +142 -0
- package/src/components/data/td-descriptions/td-descritions-cell.d.ts +15 -0
- package/src/components/data/td-descriptions/td-descritions-cell.js +110 -0
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.d.ts +10 -0
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +20 -0
- package/src/components/data/td-descriptions-item/td-descriptions-item.interface.d.ts +51 -0
- package/src/components/data/td-descriptions-item/td-descriptions-item.interface.js +2 -0
- package/src/components/data/td-descriptions-item/td-descriptions-item.style.d.ts +10 -0
- package/src/components/data/td-descriptions-item/td-descriptions-item.style.js +13 -0
- package/src/components/data/td-empty/img-empty.class.d.ts +5 -0
- package/src/components/data/td-empty/img-empty.class.js +204 -0
- package/src/components/data/td-empty/td-empty.class.d.ts +13 -0
- package/src/components/data/td-empty/td-empty.class.js +77 -0
- package/src/components/data/td-empty/td-empty.interface.d.ts +25 -0
- package/src/components/data/td-empty/td-empty.interface.js +2 -0
- package/src/components/data/td-empty/td-empty.style.d.ts +24 -0
- package/src/components/data/td-empty/td-empty.style.js +65 -0
- package/src/components/data/td-image/td-image.class.d.ts +16 -0
- package/src/components/data/td-image/td-image.class.js +95 -0
- package/src/components/data/td-image/td-image.interface.d.ts +78 -0
- package/src/components/data/td-image/td-image.interface.js +2 -0
- package/src/components/data/td-image/td-image.style.d.ts +11 -0
- package/src/components/data/td-image/td-image.style.js +18 -0
- package/src/components/data/td-image/util.d.ts +1 -0
- package/src/components/data/td-image/util.js +18 -0
- package/src/components/data/td-image-viewer/td-image-viewer.class.d.ts +20 -0
- package/src/components/data/td-image-viewer/td-image-viewer.class.js +261 -0
- package/src/components/data/td-image-viewer/td-image-viewer.interface.d.ts +63 -0
- package/src/components/data/td-image-viewer/td-image-viewer.interface.js +2 -0
- package/src/components/data/td-image-viewer/td-image-viewer.style.d.ts +9 -0
- package/src/components/data/td-image-viewer/td-image-viewer.style.js +67 -0
- package/src/components/data/td-pagination/td-pagination.class.d.ts +0 -0
- package/src/components/data/td-pagination/td-pagination.class.js +1 -0
- package/src/components/data/td-pagination/td-pagination.interface.d.ts +0 -0
- package/src/components/data/td-pagination/td-pagination.interface.js +1 -0
- package/src/components/data/td-progress/td-progress.class.d.ts +0 -0
- package/src/components/data/td-progress/td-progress.class.js +1 -0
- package/src/components/data/td-progress/td-progress.interface.d.ts +0 -0
- package/src/components/data/td-progress/td-progress.interface.js +1 -0
- package/src/components/data/td-result/td-result.class.d.ts +8 -0
- package/src/components/data/td-result/td-result.class.js +87 -0
- package/src/components/data/td-result/td-result.constant.d.ts +8 -0
- package/src/components/data/td-result/td-result.constant.js +41 -0
- package/src/components/data/td-result/td-result.interface.d.ts +28 -0
- package/src/components/data/td-result/td-result.interface.js +2 -0
- package/src/components/data/td-result/td-result.style.d.ts +16 -0
- package/src/components/data/td-result/td-result.style.js +46 -0
- package/src/components/data/td-segmented/td-segmented.class.d.ts +22 -0
- package/src/components/data/td-segmented/td-segmented.class.js +172 -0
- package/src/components/data/td-segmented/td-segmented.interface.d.ts +51 -0
- package/src/components/data/td-segmented/td-segmented.interface.js +2 -0
- package/src/components/data/td-segmented/td-segmented.style.d.ts +37 -0
- package/src/components/data/td-segmented/td-segmented.style.js +142 -0
- package/src/components/data/td-statistic/td-statistic.abstract.d.ts +15 -0
- package/src/components/data/td-statistic/td-statistic.abstract.js +113 -0
- package/src/components/data/td-statistic/td-statistic.class.d.ts +6 -0
- package/src/components/data/td-statistic/td-statistic.class.js +11 -0
- package/src/components/data/td-statistic/td-statistic.interface.d.ts +58 -0
- package/src/components/data/td-statistic/td-statistic.interface.js +2 -0
- package/src/components/data/td-statistic/td-statistic.style.d.ts +9 -0
- package/src/components/data/td-statistic/td-statistic.style.js +16 -0
- package/src/components/data/td-table/td-table.class.d.ts +0 -0
- package/src/components/data/td-table/td-table.class.js +1 -0
- package/src/components/data/td-table/td-table.interface.d.ts +0 -0
- package/src/components/data/td-table/td-table.interface.js +1 -0
- package/src/components/data/td-tag/td-tag.class.d.ts +12 -0
- package/src/components/data/td-tag/td-tag.class.js +144 -0
- package/src/components/data/td-tag/td-tag.interface.d.ts +42 -0
- package/src/components/data/td-tag/td-tag.interface.js +2 -0
- package/src/components/data/td-tag/td-tag.style.d.ts +45 -0
- package/src/components/data/td-tag/td-tag.style.js +80 -0
- package/src/components/data/td-timeline/td-timeline.class.d.ts +0 -0
- package/src/components/data/td-timeline/td-timeline.class.js +1 -0
- package/src/components/data/td-timeline/td-timeline.interface.d.ts +0 -0
- package/src/components/data/td-timeline/td-timeline.interface.js +1 -0
- package/src/components/data/td-tree/td-tree.class.d.ts +0 -0
- package/src/components/data/td-tree/td-tree.class.js +1 -0
- package/src/components/data/td-tree/td-tree.interface.d.ts +0 -0
- package/src/components/data/td-tree/td-tree.interface.js +1 -0
- package/src/components/feedback/dialog/dialog.class.d.ts +2 -1
- package/src/components/feedback/dialog/dialog.class.js +5 -5
- package/src/components/feedback/dialog/dialog.interface.d.ts +2 -3
- package/src/components/feedback/index.d.ts +11 -0
- package/src/components/feedback/index.js +15 -1
- package/src/components/feedback/message-box/message-box.d.ts +2 -1
- package/src/components/feedback/message-box/message-box.interface.d.ts +2 -2
- package/src/components/feedback/message-box/message-box.js +6 -6
- package/src/components/feedback/overlay/container/body/body.js +3 -5
- package/src/components/feedback/overlay/container/container.js +4 -6
- package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.js +3 -3
- package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.js +4 -6
- package/src/components/feedback/overlay/container/footer/footer.d.ts +1 -2
- package/src/components/feedback/overlay/container/footer/footer.js +24 -26
- package/src/components/feedback/overlay/container/header/close-button/close-button.js +6 -8
- package/src/components/feedback/overlay/container/header/header.js +2 -2
- package/src/components/feedback/overlay/container/header/title/title.js +3 -5
- package/src/components/feedback/overlay/overlay.abstract.js +6 -8
- package/src/components/feedback/td-alert/td-alert.class.d.ts +15 -0
- package/src/components/feedback/td-alert/td-alert.class.js +111 -0
- package/src/components/feedback/td-alert/td-alert.interface.d.ts +41 -0
- package/src/components/feedback/td-alert/td-alert.interface.js +2 -0
- package/src/components/feedback/td-alert/td-alert.style.d.ts +21 -0
- package/src/components/feedback/td-alert/td-alert.style.js +102 -0
- package/src/components/feedback/td-dialog/td-dialog.class.d.ts +12 -0
- package/src/components/feedback/td-dialog/td-dialog.class.js +70 -0
- package/src/components/feedback/td-dialog/td-dialog.interface.d.ts +79 -0
- package/src/components/feedback/td-dialog/td-dialog.interface.js +2 -0
- package/src/components/feedback/td-dialog/td-dialog.style.d.ts +20 -0
- package/src/components/feedback/td-dialog/td-dialog.style.js +89 -0
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.d.ts +12 -0
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +79 -0
- package/src/components/feedback/td-dialog-content/td-dialog-content.interface.d.ts +51 -0
- package/src/components/feedback/td-dialog-content/td-dialog-content.interface.js +2 -0
- package/src/components/feedback/td-drawer/td-drawer.class.d.ts +8 -0
- package/src/components/feedback/td-drawer/td-drawer.class.js +39 -0
- package/src/components/feedback/td-drawer/td-drawer.interface.d.ts +12 -0
- package/src/components/feedback/td-drawer/td-drawer.interface.js +2 -0
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +4 -3
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +11 -11
- package/src/components/feedback/td-focus-trap/td-focus-trap.interface.d.ts +9 -0
- package/src/components/feedback/td-focus-trap/td-focus-trap.interface.js +1 -0
- package/src/components/feedback/td-focus-trap/tokens.d.ts +5 -0
- package/src/components/feedback/td-focus-trap/tokens.js +4 -10
- package/src/components/feedback/td-focus-trap/utils.d.ts +2 -2
- package/src/components/feedback/td-focus-trap/utils.js +3 -3
- package/src/components/feedback/td-loading/td-loading.class.d.ts +12 -0
- package/src/components/feedback/td-loading/td-loading.class.js +65 -0
- package/src/components/feedback/td-loading/td-loading.interface.d.ts +37 -0
- package/src/components/feedback/td-loading/td-loading.interface.js +2 -0
- package/src/components/feedback/td-message/td-message.class.d.ts +24 -0
- package/src/components/feedback/td-message/td-message.class.js +239 -0
- package/src/components/feedback/td-message/td-message.interface.d.ts +105 -0
- package/src/components/feedback/td-message/td-message.interface.js +22 -0
- package/src/components/feedback/td-message/td-message.style.d.ts +17 -0
- package/src/components/feedback/td-message/td-message.style.js +104 -0
- package/src/components/feedback/td-message-box/td-message-box.class.d.ts +42 -0
- package/src/components/feedback/td-message-box/td-message-box.class.js +531 -0
- package/src/components/feedback/td-message-box/td-message-box.interface.d.ts +142 -0
- package/src/components/feedback/td-message-box/td-message-box.interface.js +2 -0
- package/src/components/feedback/td-message-box/td-message-box.style.d.ts +36 -0
- package/src/components/feedback/td-message-box/td-message-box.style.js +182 -0
- package/src/components/feedback/td-notification/td-notification.class.d.ts +30 -0
- package/src/components/feedback/td-notification/td-notification.class.js +234 -0
- package/src/components/feedback/td-notification/td-notification.interface.d.ts +76 -0
- package/src/components/feedback/td-notification/td-notification.interface.js +2 -0
- package/src/components/feedback/td-notification/td-notification.style.d.ts +28 -0
- package/src/components/feedback/td-notification/td-notification.style.js +138 -0
- package/src/components/feedback/td-overlay/td-overlay.class.d.ts +10 -0
- package/src/components/feedback/td-overlay/td-overlay.class.js +35 -0
- package/src/components/feedback/td-overlay/td-overlay.interface.d.ts +13 -0
- package/src/components/feedback/td-overlay/td-overlay.interface.js +2 -0
- package/src/components/feedback/td-overlay/td-overlay.style.d.ts +2 -0
- package/src/components/feedback/td-overlay/td-overlay.style.js +16 -0
- package/src/components/feedback/td-popconfirm/td-popconfirm.class.d.ts +0 -0
- package/src/components/feedback/td-popconfirm/td-popconfirm.class.js +1 -0
- package/src/components/feedback/td-popconfirm/td-popconfirm.interface.d.ts +0 -0
- package/src/components/feedback/td-popconfirm/td-popconfirm.interface.js +1 -0
- package/src/components/feedback/td-popover/td-popover.class.d.ts +0 -0
- package/src/components/feedback/td-popover/td-popover.class.js +1 -0
- package/src/components/feedback/td-popover/td-popover.interface.d.ts +0 -0
- package/src/components/feedback/td-popover/td-popover.interface.js +1 -0
- package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +2 -1
- package/src/components/feedback/td-popper/arrow/arrow.class.js +6 -6
- package/src/components/feedback/td-popper/content/content.class.d.ts +2 -1
- package/src/components/feedback/td-popper/content/content.class.js +7 -7
- package/src/components/feedback/td-popper/td-popper.class.d.ts +3 -2
- package/src/components/feedback/td-popper/td-popper.class.js +3 -3
- package/src/components/feedback/td-popper/td-popper.interface.d.ts +2 -3
- package/src/components/feedback/td-popper/td-popper.interface.js +0 -11
- package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +2 -1
- package/src/components/feedback/td-popper/trigger/trigger.class.js +3 -2
- package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +10 -0
- package/src/components/feedback/td-tooltip/content/content.class.d.ts +2 -1
- package/src/components/feedback/td-tooltip/content/content.class.js +3 -3
- package/src/components/feedback/td-tooltip/td-tooltip.class.d.ts +2 -1
- package/src/components/feedback/td-tooltip/td-tooltip.class.js +7 -13
- package/src/components/feedback/td-tooltip/trigger/trigger.class.d.ts +2 -1
- package/src/components/feedback/td-tooltip/trigger/trigger.class.js +3 -3
- package/src/components/feedback/td-tooltip/utils.d.ts +4 -0
- package/src/components/feedback/td-tooltip/utils.js +23 -0
- package/src/components/form/checkbox-group/checkbox-group.class.js +9 -8
- package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.js +3 -3
- package/src/components/form/field-item/cascade/field-cascade.abstract.js +25 -17
- package/src/components/form/field-item/field-item.abstract.d.ts +7 -3
- package/src/components/form/field-item/field-item.abstract.js +14 -9
- package/src/components/form/field-item/field-item.style.d.ts +1 -1
- package/src/components/form/field-item/field-item.style.js +1 -2
- package/src/components/form/field-item/input/field-input.abstract.d.ts +1 -2
- package/src/components/form/field-item/input/field-input.abstract.js +6 -6
- package/src/components/form/field-item/options/field-options.abstract.js +31 -27
- package/src/components/form/field-item/radio/field-radio.abstract.d.ts +2 -2
- package/src/components/form/field-item/radio/field-radio.abstract.js +30 -21
- package/src/components/form/field-item/select/field-select.abstract.d.ts +1 -2
- package/src/components/form/field-item/select/field-select.abstract.js +3 -3
- package/src/components/form/field-item/span/field-span.abstract.js +4 -4
- package/src/components/form/field-item/textarea/field-textarea.abstract.d.ts +1 -2
- package/src/components/form/field-item/textarea/field-textarea.abstract.js +6 -6
- package/src/components/form/field-select/field-select.class.js +10 -9
- package/src/components/form/field-select/option/option.class.js +1 -1
- package/src/components/form/index.d.ts +10 -0
- package/src/components/form/index.js +11 -1
- package/src/components/form/radio-group/radio-group.class.d.ts +3 -2
- package/src/components/form/radio-group/radio-group.class.js +13 -12
- package/src/components/form/radio-group/radio-option/radio-option.class.d.ts +3 -2
- package/src/components/form/radio-group/radio-option/radio-option.class.js +8 -9
- package/src/components/form/select/select.class.js +4 -4
- package/src/components/form/td-autocomplete/td-autocomplete.class.d.ts +0 -0
- package/src/components/form/td-autocomplete/td-autocomplete.class.js +1 -0
- package/src/components/form/td-autocomplete/td-autocomplete.interface.d.ts +0 -0
- package/src/components/form/td-autocomplete/td-autocomplete.interface.js +1 -0
- package/src/components/form/td-cascader/td-cascader.class.d.ts +0 -0
- package/src/components/form/td-cascader/td-cascader.class.js +1 -0
- package/src/components/form/td-cascader/td-cascader.interface.d.ts +0 -0
- package/src/components/form/td-cascader/td-cascader.interface.js +1 -0
- package/src/components/form/td-checkbox/composables/use-checkbox-status.d.ts +6 -0
- package/src/components/form/td-checkbox/composables/use-checkbox-status.js +52 -0
- package/src/components/form/td-checkbox/composables/use-checkbox.d.ts +6 -0
- package/src/components/form/td-checkbox/composables/use-checkbox.js +85 -0
- package/src/components/form/td-checkbox/td-checkbox.class.d.ts +8 -2
- package/src/components/form/td-checkbox/td-checkbox.class.js +54 -75
- package/src/components/form/td-checkbox/td-checkbox.interface.d.ts +2 -1
- package/src/components/form/td-checkbox/td-checkbox.style.d.ts +46 -0
- package/src/components/form/td-checkbox/td-checkbox.style.js +144 -10
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.d.ts +9 -2
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +56 -6
- package/src/components/form/td-checkbox-button/td-checkbox-button.style.d.ts +9 -0
- package/src/components/form/td-checkbox-button/td-checkbox-button.style.js +55 -0
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.d.ts +2 -2
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +10 -10
- package/src/components/form/td-checkbox-group/td-checkbox-group.interface.d.ts +1 -1
- package/src/components/form/td-color-picker/td-color-picker.class.d.ts +0 -0
- package/src/components/form/td-color-picker/td-color-picker.class.js +1 -0
- package/src/components/form/td-color-picker/td-color-picker.interface.d.ts +0 -0
- package/src/components/form/td-color-picker/td-color-picker.interface.js +1 -0
- package/src/components/form/td-date-picker/td-date-picker.class.d.ts +0 -0
- package/src/components/form/td-date-picker/td-date-picker.class.js +1 -0
- package/src/components/form/td-date-picker/td-date-picker.interface.d.ts +0 -0
- package/src/components/form/td-date-picker/td-date-picker.interface.js +1 -0
- package/src/components/form/td-date-time-picker/td-date-time-picker.class.d.ts +0 -0
- package/src/components/form/td-date-time-picker/td-date-time-picker.class.js +1 -0
- package/src/components/form/td-date-time-picker/td-date-time-picker.interface.d.ts +0 -0
- package/src/components/form/td-date-time-picker/td-date-time-picker.interface.js +1 -0
- package/src/components/form/td-form/hooks/use-form-item.d.ts +5 -0
- package/src/components/form/td-form/hooks/use-form-item.js +65 -0
- package/src/components/form/td-form/td-form.class.d.ts +3 -8
- package/src/components/form/td-form/td-form.class.js +10 -34
- package/src/components/form/td-form/td-form.const.d.ts +5 -0
- package/src/components/form/td-form/td-form.const.js +5 -0
- package/src/components/form/td-form/td-form.interface.js +33 -0
- package/src/components/form/td-form-item/td-form-item.class.d.ts +7 -4
- package/src/components/form/td-form-item/td-form-item.class.js +83 -60
- package/src/components/form/td-form-item/td-form-item.interface.d.ts +1 -3
- package/src/components/form/td-form-item/td-form-item.style.js +15 -15
- package/src/components/form/td-input/td-input-field.class.d.ts +1 -1
- package/src/components/form/td-input/td-input-field.class.js +13 -13
- package/src/components/form/td-input/td-input-field.interface.d.ts +2 -2
- package/src/components/form/td-input/td-input.class.d.ts +4 -3
- package/src/components/form/td-input/td-input.class.js +83 -49
- package/src/components/form/td-input/td-input.interface.d.ts +13 -0
- package/src/components/form/td-input/widget/prefix.js +2 -2
- package/src/components/form/td-input/widget/suffix.d.ts +1 -1
- package/src/components/form/td-input/widget/suffix.js +10 -10
- package/src/components/form/td-input/widget/td-input-wrapper.class.d.ts +3 -3
- package/src/components/form/td-input/widget/td-input-wrapper.class.js +64 -67
- package/src/components/form/td-input/widget/td-textarea-wrapper.d.ts +2 -2
- package/src/components/form/td-input/widget/td-textarea-wrapper.js +8 -9
- package/src/components/form/td-input/widget/utils.js +9 -10
- package/src/components/form/td-input-number/td-input-number.class.d.ts +0 -0
- package/src/components/form/td-input-number/td-input-number.class.js +1 -0
- package/src/components/form/td-input-number/td-input-number.interface.d.ts +0 -0
- package/src/components/form/td-input-number/td-input-number.interface.js +1 -0
- package/src/components/form/td-option/td-option.class.d.ts +7 -0
- package/src/components/form/{td-select/option/option.class.js → td-option/td-option.class.js} +9 -10
- package/src/components/form/{td-select/option/option.interface.d.ts → td-option/td-option.interface.d.ts} +1 -1
- package/src/components/form/td-option/td-option.interface.js +2 -0
- package/src/components/form/td-option-group/td-option-group.class.d.ts +7 -0
- package/src/components/form/{td-select/option-group/option-group.class.js → td-option-group/td-option-group.class.js} +11 -11
- package/src/components/form/{td-select/option-group/option-group.interface.d.ts → td-option-group/td-option-group.interface.d.ts} +1 -1
- package/src/components/form/td-option-group/td-option-group.interface.js +2 -0
- package/src/components/form/td-radio/td-radio.class.d.ts +3 -3
- package/src/components/form/td-radio/td-radio.class.js +58 -55
- package/src/components/form/td-radio-button/td-radio-button.class.d.ts +3 -3
- package/src/components/form/td-radio-button/td-radio-button.class.js +47 -45
- package/src/components/form/td-radio-group/td-radio-group.class.d.ts +3 -3
- package/src/components/form/td-radio-group/td-radio-group.class.js +21 -19
- package/src/components/form/td-rate/td-rate.class.d.ts +0 -0
- package/src/components/form/td-rate/td-rate.class.js +1 -0
- package/src/components/form/td-rate/td-rate.interface.d.ts +0 -0
- package/src/components/form/td-rate/td-rate.interface.js +1 -0
- package/src/components/form/td-select/dropdown/dropdown.class.d.ts +3 -2
- package/src/components/form/td-select/dropdown/dropdown.class.js +15 -15
- package/src/components/form/td-select/td-select.class.d.ts +3 -1
- package/src/components/form/td-select/td-select.class.js +6 -6
- package/src/components/form/td-select/td-select.style.js +8 -8
- package/src/components/form/td-slider/td-slider.class.d.ts +0 -0
- package/src/components/form/td-slider/td-slider.class.js +1 -0
- package/src/components/form/td-slider/td-slider.interface.d.ts +0 -0
- package/src/components/form/td-slider/td-slider.interface.js +1 -0
- package/src/components/form/td-switch/td-switch.class.d.ts +8 -4
- package/src/components/form/td-switch/td-switch.class.js +92 -63
- package/src/components/form/td-switch/td-switch.interface.d.ts +7 -1
- package/src/components/form/td-switch/td-switch.interface.js +1 -0
- package/src/components/form/td-switch/td-switch.style.d.ts +1 -2
- package/src/components/form/td-switch/td-switch.style.js +1 -2
- package/src/components/form/td-switch/widget/td-switch-core.d.ts +2 -2
- package/src/components/form/td-switch/widget/td-switch-core.js +73 -71
- package/src/components/form/td-switch/widget/td-switch-left.d.ts +2 -2
- package/src/components/form/td-switch/widget/td-switch-left.js +8 -8
- package/src/components/form/td-switch/widget/td-switch-right.d.ts +3 -3
- package/src/components/form/td-switch/widget/td-switch-right.js +9 -9
- package/src/components/form/td-time-picker/td-time-picker.class.d.ts +0 -0
- package/src/components/form/td-time-picker/td-time-picker.class.js +1 -0
- package/src/components/form/td-time-picker/td-time-picker.interface.d.ts +0 -0
- package/src/components/form/td-time-picker/td-time-picker.interface.js +1 -0
- package/src/components/form/td-time-select/td-time-select.class.d.ts +0 -0
- package/src/components/form/td-time-select/td-time-select.class.js +1 -0
- package/src/components/form/td-time-select/td-time-select.interface.d.ts +0 -0
- package/src/components/form/td-time-select/td-time-select.interface.js +1 -0
- package/src/components/form/td-transfer/td-transfer.class.d.ts +0 -0
- package/src/components/form/td-transfer/td-transfer.class.js +1 -0
- package/src/components/form/td-transfer/td-transfer.interface.d.ts +0 -0
- package/src/components/form/td-transfer/td-transfer.interface.js +1 -0
- package/src/components/form/td-upload/td-upload.class.d.ts +0 -0
- package/src/components/form/td-upload/td-upload.class.js +1 -0
- package/src/components/form/td-upload/td-upload.interface.d.ts +0 -0
- package/src/components/form/td-upload/td-upload.interface.js +1 -0
- package/src/components/navigation/index.d.ts +16 -0
- package/src/components/navigation/index.js +17 -1
- package/src/components/navigation/td-affix/td-affix.class.d.ts +25 -0
- package/src/components/navigation/td-affix/td-affix.class.js +134 -0
- package/src/components/navigation/td-affix/td-affix.interface.d.ts +27 -0
- package/src/components/navigation/td-affix/td-affix.interface.js +2 -0
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.d.ts +8 -0
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +30 -0
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.interface.d.ts +16 -0
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.interface.js +2 -0
- package/src/components/navigation/td-anchor/td-anchor.class.d.ts +10 -0
- package/src/components/navigation/td-anchor/td-anchor.class.js +118 -0
- package/src/components/navigation/td-anchor/td-anchor.function.d.ts +2 -0
- package/src/components/navigation/td-anchor/td-anchor.function.js +91 -0
- package/src/components/navigation/td-anchor/td-anchor.interface.d.ts +44 -0
- package/src/components/navigation/td-anchor/td-anchor.interface.js +2 -0
- package/src/components/navigation/td-anchor/td-anchor.style.d.ts +14 -0
- package/src/components/navigation/td-anchor/td-anchor.style.js +17 -0
- package/src/components/navigation/td-backtop/td-backtop.class.d.ts +17 -0
- package/src/components/navigation/td-backtop/td-backtop.class.js +145 -0
- package/src/components/navigation/td-backtop/td-backtop.interface.d.ts +26 -0
- package/src/components/navigation/td-backtop/td-backtop.interface.js +2 -0
- package/src/components/navigation/td-backtop/td-backtop.style.d.ts +5 -0
- package/src/components/navigation/td-backtop/td-backtop.style.js +13 -0
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.d.ts +11 -0
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +37 -0
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.interface.d.ts +16 -0
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.interface.js +2 -0
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.d.ts +8 -0
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +71 -0
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.interface.d.ts +18 -0
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.interface.js +2 -0
- package/src/components/navigation/td-dropdown/td-dropdown.class.d.ts +0 -0
- package/src/components/navigation/td-dropdown/td-dropdown.class.js +1 -0
- package/src/components/navigation/td-dropdown/td-dropdown.interface.d.ts +0 -0
- package/src/components/navigation/td-dropdown/td-dropdown.interface.js +1 -0
- package/src/components/navigation/td-menu/td-menu.class.d.ts +3 -2
- package/src/components/navigation/td-menu/td-menu.class.js +11 -10
- package/src/components/navigation/td-page-header/td-page-header.class.d.ts +0 -0
- package/src/components/navigation/td-page-header/td-page-header.class.js +1 -0
- package/src/components/navigation/td-page-header/td-page-header.interface.d.ts +0 -0
- package/src/components/navigation/td-page-header/td-page-header.interface.js +1 -0
- package/src/components/navigation/td-steps/td-steps.class.d.ts +0 -0
- package/src/components/navigation/td-steps/td-steps.class.js +1 -0
- package/src/components/navigation/td-steps/td-steps.interface.d.ts +0 -0
- package/src/components/navigation/td-steps/td-steps.interface.js +1 -0
- package/src/components/navigation/td-tabs/td-tab-bar.class.d.ts +12 -0
- package/src/components/navigation/td-tabs/td-tab-bar.class.js +62 -0
- package/src/components/navigation/td-tabs/td-tab-bar.interface.d.ts +10 -0
- package/src/components/navigation/td-tabs/td-tab-bar.interface.js +2 -0
- package/src/components/navigation/td-tabs/td-tab-nav.class.d.ts +31 -0
- package/src/components/navigation/td-tabs/td-tab-nav.class.js +355 -0
- package/src/components/navigation/td-tabs/td-tab-nav.interface.d.ts +23 -0
- package/src/components/navigation/td-tabs/td-tab-nav.interface.js +2 -0
- package/src/components/navigation/td-tabs/td-tab-pane.class.d.ts +13 -0
- package/src/components/navigation/td-tabs/td-tab-pane.class.js +41 -0
- package/src/components/navigation/td-tabs/td-tab-pane.interface.d.ts +31 -0
- package/src/components/navigation/td-tabs/td-tab-pane.interface.js +2 -0
- package/src/components/navigation/td-tabs/td-tabs.class.d.ts +18 -0
- package/src/components/navigation/td-tabs/td-tabs.class.js +159 -0
- package/src/components/navigation/td-tabs/td-tabs.interface.d.ts +74 -0
- package/src/components/navigation/td-tabs/td-tabs.interface.js +5 -0
- package/src/components/navigation/td-tabs/td-tabs.style.d.ts +19 -0
- package/src/components/navigation/td-tabs/td-tabs.style.js +128 -0
- package/src/components/others/collapsible-box/collapsible-box.d.ts +2 -3
- package/src/components/others/collapsible-box/collapsible-box.js +5 -7
- package/src/components/others/collapsible-box/contents/contents.d.ts +2 -2
- package/src/components/others/collapsible-box/contents/contents.js +6 -8
- package/src/components/others/collapsible-box/heading/expand-heading.d.ts +2 -3
- package/src/components/others/collapsible-box/heading/expand-heading.js +13 -15
- package/src/components/others/td-divider/td-divider.class.d.ts +2 -2
- package/src/components/others/td-divider/td-divider.class.js +16 -15
- package/src/components/others/td-watermark/td-watermark.class.d.ts +0 -0
- package/src/components/others/td-watermark/td-watermark.class.js +1 -0
- package/src/components/others/td-watermark/td-watermark.interface.d.ts +0 -0
- package/src/components/others/td-watermark/td-watermark.interface.js +1 -0
- package/src/constants/event.d.ts +3 -0
- package/src/constants/event.js +6 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/styles/color-scheme.js +19 -19
- package/src/styles/function.js +13 -14
- package/src/styles/index.d.ts +1 -0
- package/src/styles/size.d.ts +0 -5
- package/src/styles/size.js +3 -3
- package/src/styles/transition.d.ts +32 -0
- package/src/styles/transition.js +222 -0
- package/src/styles/var.d.ts +10 -1
- package/src/styles/var.js +17 -3
- package/src/ui/ui.abstract.d.ts +16 -6
- package/src/ui/ui.abstract.js +39 -11
- package/src/ui/ui.interface.d.ts +7 -3
- package/src/utils/types.d.ts +8 -0
- package/src/utils/types.js +35 -0
- package/src/components/basic/td-layout/td-row/td-row.style.d.ts +0 -1
- package/src/components/basic/td-layout/td-row/td-row.style.js +0 -8
- package/src/components/form/td-select/option/option.class.d.ts +0 -6
- package/src/components/form/td-select/option-group/option-group.class.d.ts +0 -6
- /package/src/components/{form/td-select/option-group/option-group.interface.js → data/td-avatar/td-avatar.interface.js} +0 -0
- /package/src/components/{form/td-select/option/option.interface.js → data/td-badge/td-badge.interface.js} +0 -0
|
@@ -5,28 +5,37 @@ const utils_1 = require("@type-dom/utils");
|
|
|
5
5
|
const framework_1 = require("@type-dom/framework");
|
|
6
6
|
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
7
7
|
const var_1 = require("../../../styles/var");
|
|
8
|
-
const
|
|
8
|
+
const event_1 = require("../../../constants/event");
|
|
9
9
|
const td_switch_core_1 = require("./widget/td-switch-core");
|
|
10
10
|
const td_switch_left_1 = require("./widget/td-switch-left");
|
|
11
11
|
const td_switch_right_1 = require("./widget/td-switch-right");
|
|
12
|
+
const td_switch_style_1 = require("./td-switch.style");
|
|
12
13
|
class TdSwitch extends ui_abstract_1.UI {
|
|
13
|
-
constructor(
|
|
14
|
-
var _a, _b, _c;
|
|
15
|
-
super();
|
|
14
|
+
constructor(params) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16
|
+
super(params);
|
|
16
17
|
this.className = 'TdSwitch';
|
|
17
|
-
this.
|
|
18
|
-
this.addStyleObj({
|
|
18
|
+
this.ctrl.addStyleObj({
|
|
19
19
|
display: 'inline-flex',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
position: 'relative',
|
|
22
22
|
verticalAlign: 'middle',
|
|
23
|
-
fontSize: td_switch_style_1.$switchFontSize[(
|
|
24
|
-
lineHeight: td_switch_style_1.$switchCoreHeight[(
|
|
25
|
-
height: td_switch_style_1.$switchHeight[(
|
|
23
|
+
fontSize: td_switch_style_1.$switchFontSize[(params === null || params === void 0 ? void 0 : params.size) || 'default'],
|
|
24
|
+
lineHeight: td_switch_style_1.$switchCoreHeight[(params === null || params === void 0 ? void 0 : params.size) || 'default'],
|
|
25
|
+
height: td_switch_style_1.$switchHeight[(params === null || params === void 0 ? void 0 : params.size) || 'default']
|
|
26
26
|
});
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
27
|
+
this.isControlled = (params === null || params === void 0 ? void 0 : params.modelValue) !== false;
|
|
28
|
+
this.modelValue = (_a = params === null || params === void 0 ? void 0 : params.modelValue) !== null && _a !== void 0 ? _a : false;
|
|
29
|
+
this.activeValue = (_b = params === null || params === void 0 ? void 0 : params.activeValue) !== null && _b !== void 0 ? _b : true;
|
|
30
|
+
this.inactiveValue = (_c = params === null || params === void 0 ? void 0 : params.inactiveValue) !== null && _c !== void 0 ? _c : false;
|
|
31
|
+
if (![params === null || params === void 0 ? void 0 : params.activeValue, params === null || params === void 0 ? void 0 : params.inactiveValue].includes(this.actualValue)) {
|
|
32
|
+
// emit(UPDATE_MODEL_EVENT, params?.inactiveValue)
|
|
33
|
+
(_e = (_d = params === null || params === void 0 ? void 0 : params.emits) === null || _d === void 0 ? void 0 : _d[event_1.UPDATE_MODEL_EVENT]) === null || _e === void 0 ? void 0 : _e.call(_d, params === null || params === void 0 ? void 0 : params.inactiveValue);
|
|
34
|
+
// emit(CHANGE_EVENT, params?.inactiveValue)
|
|
35
|
+
(_g = (_f = params === null || params === void 0 ? void 0 : params.emits) === null || _f === void 0 ? void 0 : _f[event_1.CHANGE_EVENT]) === null || _g === void 0 ? void 0 : _g.call(_f, params === null || params === void 0 ? void 0 : params.inactiveValue);
|
|
36
|
+
// emit(INPUT_EVENT, params?.inactiveValue)
|
|
37
|
+
(_j = (_h = params === null || params === void 0 ? void 0 : params.emits) === null || _h === void 0 ? void 0 : _h[event_1.INPUT_EVENT]) === null || _j === void 0 ? void 0 : _j.call(_h, params === null || params === void 0 ? void 0 : params.inactiveValue);
|
|
38
|
+
}
|
|
30
39
|
this.input = new framework_1.Input({
|
|
31
40
|
attrObj: {
|
|
32
41
|
type: 'checkbox',
|
|
@@ -37,30 +46,38 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
37
46
|
}
|
|
38
47
|
});
|
|
39
48
|
this.addChild(this.input);
|
|
40
|
-
if (!(
|
|
41
|
-
|
|
49
|
+
if (!(params === null || params === void 0 ? void 0 : params.inlinePrompt) &&
|
|
50
|
+
((params === null || params === void 0 ? void 0 : params.inactiveIcon) || (params === null || params === void 0 ? void 0 : params.inactiveText))) {
|
|
51
|
+
this.left = new td_switch_left_1.TdSwitchLeft(params);
|
|
42
52
|
this.addChild(this.left);
|
|
43
53
|
}
|
|
44
|
-
this.core = new td_switch_core_1.TdSwitchCore(Object.assign({},
|
|
54
|
+
this.core = new td_switch_core_1.TdSwitchCore(Object.assign({}, params, {
|
|
45
55
|
modelValue: this.modelValue,
|
|
46
56
|
activeValue: this.activeValue,
|
|
47
57
|
inactiveValue: this.inactiveValue
|
|
48
58
|
}));
|
|
49
59
|
this.addChild(this.core);
|
|
50
|
-
if (!(
|
|
60
|
+
if (!(params === null || params === void 0 ? void 0 : params.inlinePrompt) && ((params === null || params === void 0 ? void 0 : params.activeIcon) || (params === null || params === void 0 ? void 0 : params.activeText))) {
|
|
51
61
|
console.log('td-switch right .');
|
|
52
|
-
this.right = new td_switch_right_1.TdSwitchRight(
|
|
62
|
+
this.right = new td_switch_right_1.TdSwitchRight(params);
|
|
53
63
|
this.addChild(this.right);
|
|
54
64
|
}
|
|
55
|
-
this.
|
|
56
|
-
|
|
65
|
+
this.props = this.setParams(params);
|
|
66
|
+
}
|
|
67
|
+
get actualValue() {
|
|
68
|
+
return this.isControlled ? this.props.modelValue : false;
|
|
57
69
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
get checked() {
|
|
71
|
+
return this.actualValue === this.props.activeValue;
|
|
72
|
+
}
|
|
73
|
+
mounted() {
|
|
74
|
+
const props = this.props;
|
|
75
|
+
this.setChecked(this.modelValue === this.activeValue);
|
|
76
|
+
if (props === null || props === void 0 ? void 0 : props.disabled) {
|
|
77
|
+
this.setDisabled(props === null || props === void 0 ? void 0 : props.disabled);
|
|
78
|
+
}
|
|
79
|
+
if (props.loading) {
|
|
80
|
+
this.setLoading(props === null || props === void 0 ? void 0 : props.loading);
|
|
64
81
|
}
|
|
65
82
|
}
|
|
66
83
|
initEvents() {
|
|
@@ -73,15 +90,19 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
73
90
|
});
|
|
74
91
|
}
|
|
75
92
|
handleChange() {
|
|
93
|
+
var _a, _b, _c, _d, _e, _f;
|
|
76
94
|
console.log('handleChange . ');
|
|
77
|
-
const
|
|
95
|
+
const props = this.props;
|
|
78
96
|
const checked = this.modelValue === this.activeValue;
|
|
79
97
|
// this.modelValue = !this.modelValue;
|
|
80
98
|
this.modelValue = checked ? this.inactiveValue : this.activeValue;
|
|
81
99
|
const val = checked ? this.inactiveValue : this.activeValue;
|
|
82
100
|
// emit(UPDATE_MODEL_EVENT, val)
|
|
101
|
+
(_b = (_a = this.props.emits) === null || _a === void 0 ? void 0 : _a[event_1.UPDATE_MODEL_EVENT]) === null || _b === void 0 ? void 0 : _b.call(_a, val);
|
|
83
102
|
// emit(CHANGE_EVENT, val)
|
|
103
|
+
(_d = (_c = this.props.emits) === null || _c === void 0 ? void 0 : _c[event_1.CHANGE_EVENT]) === null || _d === void 0 ? void 0 : _d.call(_c, val);
|
|
84
104
|
// emit(INPUT_EVENT, val)
|
|
105
|
+
(_f = (_e = this.props.emits) === null || _e === void 0 ? void 0 : _e[event_1.INPUT_EVENT]) === null || _f === void 0 ? void 0 : _f.call(_e, val);
|
|
85
106
|
(0, framework_1.nextTick)(() => {
|
|
86
107
|
this.input.dom.checked = !checked;
|
|
87
108
|
console.log('handleChange . this.input.dom.checked is ', checked);
|
|
@@ -92,103 +113,111 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
92
113
|
setDisabled(disabled) {
|
|
93
114
|
var _a, _b;
|
|
94
115
|
if (disabled) {
|
|
95
|
-
this.
|
|
116
|
+
this.ctrl.setStyleObj({
|
|
96
117
|
opacity: 0.6
|
|
97
118
|
});
|
|
98
|
-
this.input.
|
|
119
|
+
this.input.ctrl.setAttrObj({
|
|
99
120
|
disabled: true,
|
|
100
121
|
ariaDisabled: true
|
|
101
122
|
});
|
|
102
|
-
(_a = this.left) === null || _a === void 0 ? void 0 : _a.setStyleObj({
|
|
103
|
-
cursor:
|
|
123
|
+
(_a = this.left) === null || _a === void 0 ? void 0 : _a.ctrl.setStyleObj({
|
|
124
|
+
cursor: 'not-allowed'
|
|
104
125
|
});
|
|
105
|
-
this.core.setStyleObj({
|
|
106
|
-
cursor:
|
|
126
|
+
this.core.ctrl.setStyleObj({
|
|
127
|
+
cursor: 'not-allowed'
|
|
107
128
|
});
|
|
108
129
|
}
|
|
109
130
|
else {
|
|
110
|
-
this.
|
|
131
|
+
this.ctrl.setStyleObj({
|
|
111
132
|
opacity: 1
|
|
112
133
|
});
|
|
113
|
-
this.input.
|
|
134
|
+
this.input.ctrl.setAttrObj({
|
|
114
135
|
disabled: false,
|
|
115
136
|
ariaDisabled: false
|
|
116
137
|
});
|
|
117
|
-
(_b = this.left) === null || _b === void 0 ? void 0 : _b.setStyleObj({
|
|
118
|
-
cursor:
|
|
138
|
+
(_b = this.left) === null || _b === void 0 ? void 0 : _b.ctrl.setStyleObj({
|
|
139
|
+
cursor: 'auto'
|
|
119
140
|
});
|
|
120
|
-
this.core.setStyleObj({
|
|
121
|
-
cursor:
|
|
141
|
+
this.core.ctrl.setStyleObj({
|
|
142
|
+
cursor: 'auto'
|
|
122
143
|
});
|
|
123
144
|
}
|
|
124
145
|
}
|
|
146
|
+
// setStyleObj 应该在渲染后执行。
|
|
125
147
|
setChecked(checked) {
|
|
126
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
148
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
127
149
|
if (checked) {
|
|
128
|
-
this.core.setStyleObj({
|
|
129
|
-
backgroundColor: (
|
|
150
|
+
this.core.ctrl.setStyleObj({
|
|
151
|
+
backgroundColor: (_a = this.props.switchOnColor) !== null && _a !== void 0 ? _a : td_switch_style_1.$switchOnColor
|
|
130
152
|
});
|
|
131
|
-
this.core.action.setStyleObj({
|
|
153
|
+
this.core.action.ctrl.setStyleObj({
|
|
132
154
|
color: td_switch_style_1.$switchOnColor,
|
|
133
155
|
// left: calc(100% - #{map.get($switch-button-size, 'default') + 1px});
|
|
134
|
-
left: 'calc(100% - ' +
|
|
156
|
+
left: 'calc(100% - ' +
|
|
157
|
+
td_switch_style_1.$switchButtonSize[this.props.size || 'default'] +
|
|
158
|
+
' - 1px)'
|
|
135
159
|
});
|
|
136
160
|
if (this.right) {
|
|
137
|
-
this.right.setStyleObj({
|
|
161
|
+
this.right.ctrl.setStyleObj({
|
|
138
162
|
color: var_1.$colors.primary.base
|
|
139
163
|
});
|
|
140
164
|
}
|
|
141
165
|
if (this.left) {
|
|
142
|
-
this.left.setStyleObj({
|
|
166
|
+
this.left.ctrl.setStyleObj({
|
|
143
167
|
color: var_1.$colors.default.base
|
|
144
168
|
});
|
|
145
169
|
}
|
|
146
|
-
if (
|
|
170
|
+
if (this.props.inlinePrompt) {
|
|
147
171
|
this.core.setInnerChecked(true);
|
|
148
172
|
}
|
|
149
|
-
if (
|
|
150
|
-
(
|
|
173
|
+
if (this.props.activeActionIcon) {
|
|
174
|
+
(_b = this.core.actionIcon) === null || _b === void 0 ? void 0 : _b.replaceSvg(this.props.activeActionIcon);
|
|
151
175
|
}
|
|
152
|
-
else if (
|
|
153
|
-
(
|
|
176
|
+
else if (this.props.activeActionText) {
|
|
177
|
+
(_d = (_c = this.core.actionSpan) === null || _c === void 0 ? void 0 : _c.textNode) === null || _d === void 0 ? void 0 : _d.setText(this.props.activeActionText);
|
|
154
178
|
}
|
|
155
179
|
}
|
|
156
180
|
else {
|
|
157
|
-
this.core.setStyleObj({
|
|
158
|
-
backgroundColor: (
|
|
181
|
+
this.core.ctrl.setStyleObj({
|
|
182
|
+
backgroundColor: (_e = this.props.switchOffColor) !== null && _e !== void 0 ? _e : td_switch_style_1.$switchOffColor
|
|
159
183
|
});
|
|
160
|
-
this.core.action.setStyleObj({
|
|
184
|
+
this.core.action.ctrl.setStyleObj({
|
|
161
185
|
left: '1px',
|
|
162
186
|
color: td_switch_style_1.$switchOffColor
|
|
163
187
|
});
|
|
164
188
|
if (this.left) {
|
|
165
|
-
this.left.setStyleObj({
|
|
189
|
+
this.left.ctrl.setStyleObj({
|
|
166
190
|
color: var_1.$colors.primary.base
|
|
167
191
|
});
|
|
168
192
|
}
|
|
169
193
|
if (this.right) {
|
|
170
|
-
this.right.setStyleObj({
|
|
194
|
+
this.right.ctrl.setStyleObj({
|
|
171
195
|
color: var_1.$colors.default.base
|
|
172
196
|
});
|
|
173
197
|
}
|
|
174
|
-
if (
|
|
198
|
+
if (this.props.inlinePrompt) {
|
|
175
199
|
this.core.setInnerChecked(false);
|
|
176
200
|
}
|
|
177
|
-
if (
|
|
178
|
-
(
|
|
201
|
+
if (this.props.inactiveActionIcon) {
|
|
202
|
+
(_f = this.core.actionIcon) === null || _f === void 0 ? void 0 : _f.replaceSvg(this.props.inactiveActionIcon);
|
|
179
203
|
}
|
|
180
|
-
else if (
|
|
181
|
-
(
|
|
204
|
+
else if (this.props.inactiveActionText) {
|
|
205
|
+
(_h = (_g = this.core.actionSpan) === null || _g === void 0 ? void 0 : _g.textNode) === null || _h === void 0 ? void 0 : _h.setText(this.props.inactiveActionText);
|
|
182
206
|
}
|
|
183
207
|
}
|
|
184
208
|
}
|
|
209
|
+
setLoading(loading) {
|
|
210
|
+
if (loading) {
|
|
211
|
+
this.setDisabled(true);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
185
214
|
switchValue() {
|
|
186
215
|
console.log('switchValue . ');
|
|
187
|
-
const
|
|
188
|
-
if ((
|
|
216
|
+
const props = this.props;
|
|
217
|
+
if ((props === null || props === void 0 ? void 0 : props.loading) || (props === null || props === void 0 ? void 0 : props.disabled)) {
|
|
189
218
|
return;
|
|
190
219
|
}
|
|
191
|
-
const beforeChange =
|
|
220
|
+
const beforeChange = props === null || props === void 0 ? void 0 : props.beforeChange;
|
|
192
221
|
if (!beforeChange) {
|
|
193
222
|
this.handleChange();
|
|
194
223
|
return;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IUI, IUIConfig } from '../../../ui/ui.interface';
|
|
2
1
|
import { TypeSvgSvg } from '@type-dom/framework';
|
|
2
|
+
import { IUI, IUIConfig } from '../../../ui/ui.interface';
|
|
3
|
+
import { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event';
|
|
3
4
|
export interface ITdSwitch extends IUI {
|
|
4
5
|
className: 'TdSwitch';
|
|
5
6
|
}
|
|
@@ -89,6 +90,11 @@ export interface ITdSwitchConfig extends IUIConfig {
|
|
|
89
90
|
* @description native input aria-label
|
|
90
91
|
*/
|
|
91
92
|
label?: string;
|
|
93
|
+
emits?: {
|
|
94
|
+
[UPDATE_MODEL_EVENT]?: (val?: boolean | string | number) => void;
|
|
95
|
+
[CHANGE_EVENT]?: (val?: boolean | string | number) => void;
|
|
96
|
+
[INPUT_EVENT]?: (val?: boolean | string | number) => void;
|
|
97
|
+
};
|
|
92
98
|
switchOnColor?: string;
|
|
93
99
|
switchOffColor?: string;
|
|
94
100
|
activeActionText?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StyleCursor } from '@type-dom/framework';
|
|
2
1
|
export declare const $switchOnColor: string;
|
|
3
2
|
export declare const $switchOffColor: string;
|
|
4
3
|
export declare const $switchBorderColor: string;
|
|
@@ -41,7 +40,7 @@ export declare const $switchLabel: {
|
|
|
41
40
|
transition: string;
|
|
42
41
|
display: string;
|
|
43
42
|
fontWeight: string;
|
|
44
|
-
cursor:
|
|
43
|
+
cursor: string;
|
|
45
44
|
verticalAlign: string;
|
|
46
45
|
color: string;
|
|
47
46
|
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.$switchLabel = exports.$switchContentPadding = exports.$switchButtonSize = exports.$switchCoreHeight = exports.$switchCoreWidth = exports.$switchCoreBorderRadius = exports.$switchFontSize = exports.$switchHeight = exports.$switchBorderColor = exports.$switchOffColor = exports.$switchOnColor = void 0;
|
|
4
4
|
const var_1 = require("../../../styles/var");
|
|
5
|
-
const framework_1 = require("@type-dom/framework");
|
|
6
5
|
exports.$switchOnColor = var_1.$colors.primary.base;
|
|
7
6
|
// -switch-on-color: var(--el-color-primary);
|
|
8
7
|
exports.$switchOffColor = var_1.$borderColor.base;
|
|
@@ -50,7 +49,7 @@ exports.$switchLabel = {
|
|
|
50
49
|
display: 'inline-flex',
|
|
51
50
|
// font-size: map.get($switch-font-size, 'default'),
|
|
52
51
|
fontWeight: exports.$switchFontSize['default'],
|
|
53
|
-
cursor:
|
|
52
|
+
cursor: 'pointer',
|
|
54
53
|
verticalAlign: 'middle',
|
|
55
54
|
// color: getCssVar('text-color', 'primary'),
|
|
56
55
|
color: var_1.$textColor.primary
|
|
@@ -6,12 +6,12 @@ export declare class TdSwitchCore extends TypeSpan {
|
|
|
6
6
|
className: 'TdSwitchCore';
|
|
7
7
|
action: Div;
|
|
8
8
|
parent?: TdSwitch;
|
|
9
|
-
|
|
9
|
+
props: ITdSwitchConfig;
|
|
10
10
|
inner?: Div;
|
|
11
11
|
private innerText?;
|
|
12
12
|
private innerIcon?;
|
|
13
13
|
actionIcon?: TdIcon;
|
|
14
14
|
actionSpan?: Span;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(params?: ITdSwitchConfig);
|
|
16
16
|
setInnerChecked(checked: boolean): void;
|
|
17
17
|
}
|
|
@@ -7,14 +7,13 @@ const var_1 = require("../../../../styles/var");
|
|
|
7
7
|
const td_icon_class_1 = require("../../../basic/td-icon/td-icon.class");
|
|
8
8
|
const td_switch_style_1 = require("../td-switch.style");
|
|
9
9
|
class TdSwitchCore extends framework_1.TypeSpan {
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(params) {
|
|
11
11
|
super();
|
|
12
|
-
this.config = config;
|
|
13
12
|
this.className = 'TdSwitchCore';
|
|
14
|
-
this.addAttrObj({
|
|
13
|
+
this.ctrl.addAttrObj({
|
|
15
14
|
name: 'switch-core'
|
|
16
15
|
});
|
|
17
|
-
this.addStyleObj({
|
|
16
|
+
this.ctrl.addStyleObj({
|
|
18
17
|
display: 'inline-flex',
|
|
19
18
|
position: 'relative',
|
|
20
19
|
alignItems: 'center',
|
|
@@ -25,25 +24,27 @@ class TdSwitchCore extends framework_1.TypeSpan {
|
|
|
25
24
|
boxSizing: 'border-box',
|
|
26
25
|
background: td_switch_style_1.$switchOffColor, // 'var(--el-switch-off-color)',
|
|
27
26
|
// backgroundColor: $switchOnColor,
|
|
28
|
-
cursor:
|
|
27
|
+
cursor: 'pointer',
|
|
29
28
|
// transition: border-color var(--el-transition-duration), background-color var(--el-transition-duration);
|
|
30
|
-
transition: var_1.$borderColor.base +
|
|
29
|
+
transition: var_1.$borderColor.base +
|
|
30
|
+
' ' +
|
|
31
|
+
var_1.$transitionDuration +
|
|
32
|
+
', background-color ' +
|
|
33
|
+
var_1.$transitionDuration,
|
|
31
34
|
// minWidth: map.get($switch-core-width, 'default');
|
|
32
|
-
minWidth: td_switch_style_1.$switchCoreWidth[(
|
|
35
|
+
minWidth: td_switch_style_1.$switchCoreWidth[(params === null || params === void 0 ? void 0 : params.size) || 'default'],
|
|
33
36
|
// height: map.get($switch-core-height, 'default');
|
|
34
|
-
height: td_switch_style_1.$switchCoreHeight[(
|
|
37
|
+
height: td_switch_style_1.$switchCoreHeight[(params === null || params === void 0 ? void 0 : params.size) || 'default']
|
|
35
38
|
});
|
|
36
|
-
if (
|
|
39
|
+
if (params === null || params === void 0 ? void 0 : params.inlinePrompt) {
|
|
37
40
|
this.inner = new framework_1.Div({
|
|
38
|
-
|
|
39
|
-
name: 'switch-inner'
|
|
40
|
-
},
|
|
41
|
+
name: 'switch-inner',
|
|
41
42
|
styleObj: {
|
|
42
43
|
width: '100%',
|
|
43
44
|
// transition: all getCssVar('transition-duration'),
|
|
44
45
|
transition: 'all ' + var_1.$transitionDuration,
|
|
45
46
|
// height: map.get($switch-button-size, 'default'),
|
|
46
|
-
height: td_switch_style_1.$switchButtonSize[(
|
|
47
|
+
height: td_switch_style_1.$switchButtonSize[(params === null || params === void 0 ? void 0 : params.size) || 'default'],
|
|
47
48
|
display: 'flex',
|
|
48
49
|
justifyContent: 'center',
|
|
49
50
|
alignItems: 'center',
|
|
@@ -52,16 +53,20 @@ class TdSwitchCore extends framework_1.TypeSpan {
|
|
|
52
53
|
// $switch-button-size,
|
|
53
54
|
// 'default'
|
|
54
55
|
// )} + 2px);
|
|
55
|
-
padding: '0 ' +
|
|
56
|
+
padding: '0 ' +
|
|
57
|
+
td_switch_style_1.$switchContentPadding[(params === null || params === void 0 ? void 0 : params.size) || 'default'] +
|
|
58
|
+
' 0 calc(' +
|
|
59
|
+
td_switch_style_1.$switchButtonSize[(params === null || params === void 0 ? void 0 : params.size) || 'default'] +
|
|
60
|
+
' + 2px)'
|
|
56
61
|
}
|
|
57
62
|
});
|
|
58
63
|
this.addChild(this.inner);
|
|
59
|
-
if ((
|
|
64
|
+
if ((params === null || params === void 0 ? void 0 : params.activeIcon) || (params === null || params === void 0 ? void 0 : params.inactiveIcon)) {
|
|
60
65
|
this.innerIcon = new td_icon_class_1.TdIcon({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
name: 'switch-inner-icon',
|
|
67
|
+
svgObj: (params === null || params === void 0 ? void 0 : params.modelValue) === (params === null || params === void 0 ? void 0 : params.activeValue)
|
|
68
|
+
? params === null || params === void 0 ? void 0 : params.activeIcon
|
|
69
|
+
: params === null || params === void 0 ? void 0 : params.inactiveIcon,
|
|
65
70
|
styleObj: {
|
|
66
71
|
fontSize: '12px', // $fontSizes.base,
|
|
67
72
|
// color: var(--el-color-white),
|
|
@@ -74,14 +79,14 @@ class TdSwitchCore extends framework_1.TypeSpan {
|
|
|
74
79
|
});
|
|
75
80
|
this.inner.addChild(this.innerIcon);
|
|
76
81
|
}
|
|
77
|
-
else if ((
|
|
82
|
+
else if ((params === null || params === void 0 ? void 0 : params.activeText) || (params === null || params === void 0 ? void 0 : params.inactiveText)) {
|
|
78
83
|
this.innerText = new framework_1.Span({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
name: 'switch-inner-text',
|
|
85
|
+
text: (params === null || params === void 0 ? void 0 : params.modelValue) === (params === null || params === void 0 ? void 0 : params.activeValue)
|
|
86
|
+
? params === null || params === void 0 ? void 0 : params.activeText
|
|
87
|
+
: params === null || params === void 0 ? void 0 : params.inactiveText,
|
|
83
88
|
styleObj: {
|
|
84
|
-
// fontSize: $switchFontSize[
|
|
89
|
+
// fontSize: $switchFontSize[params?.size || 'default'],
|
|
85
90
|
fontSize: '12px', // $fontSizes.base,
|
|
86
91
|
// color: var(--el-color-white),
|
|
87
92
|
color: var_1.$colorWhite,
|
|
@@ -95,9 +100,7 @@ class TdSwitchCore extends framework_1.TypeSpan {
|
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
this.action = new framework_1.Div({
|
|
98
|
-
|
|
99
|
-
name: 'switch-action'
|
|
100
|
-
},
|
|
103
|
+
name: 'switch-action',
|
|
101
104
|
styleObj: {
|
|
102
105
|
position: 'absolute',
|
|
103
106
|
left: '1px',
|
|
@@ -106,9 +109,9 @@ class TdSwitchCore extends framework_1.TypeSpan {
|
|
|
106
109
|
borderRadius: var_1.$borderRadius.circle,
|
|
107
110
|
// transition: all var(--el-transition-duration),
|
|
108
111
|
transition: 'all ' + var_1.$transitionDuration,
|
|
109
|
-
width: td_switch_style_1.$switchButtonSize[(
|
|
112
|
+
width: td_switch_style_1.$switchButtonSize[(params === null || params === void 0 ? void 0 : params.size) || 'default'],
|
|
110
113
|
// width: map.get($switch-button-size, 'default');
|
|
111
|
-
height: td_switch_style_1.$switchButtonSize[(
|
|
114
|
+
height: td_switch_style_1.$switchButtonSize[(params === null || params === void 0 ? void 0 : params.size) || 'default'],
|
|
112
115
|
// height: map.get($switch-button-size, 'default');
|
|
113
116
|
// backgroundColor: var(--el-color-white),
|
|
114
117
|
backgroundColor: var_1.$colorWhite,
|
|
@@ -119,92 +122,91 @@ class TdSwitchCore extends framework_1.TypeSpan {
|
|
|
119
122
|
color: td_switch_style_1.$switchOffColor
|
|
120
123
|
}
|
|
121
124
|
});
|
|
122
|
-
if (
|
|
125
|
+
if (params === null || params === void 0 ? void 0 : params.loading) {
|
|
123
126
|
const loadingIcon = new td_icon_class_1.TdIcon({
|
|
127
|
+
name: 'switch-loading-icon',
|
|
124
128
|
svgObj: new svgs_1.ElLoadingSvg(),
|
|
125
|
-
attrObj: {
|
|
126
|
-
name: 'switch-loading-icon'
|
|
127
|
-
},
|
|
128
129
|
loading: true
|
|
129
130
|
});
|
|
130
131
|
this.action.addChild(loadingIcon);
|
|
131
132
|
}
|
|
132
|
-
else if ((
|
|
133
|
-
this.action.addStyleObj({
|
|
133
|
+
else if ((params === null || params === void 0 ? void 0 : params.modelValue) === (params === null || params === void 0 ? void 0 : params.activeValue)) {
|
|
134
|
+
this.action.ctrl.addStyleObj({
|
|
134
135
|
color: td_switch_style_1.$switchOnColor
|
|
135
136
|
});
|
|
136
|
-
if (
|
|
137
|
+
if (params === null || params === void 0 ? void 0 : params.activeActionIcon) {
|
|
137
138
|
this.actionIcon = new td_icon_class_1.TdIcon({
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
name: 'switch-action-icon'
|
|
141
|
-
}
|
|
139
|
+
name: 'switch-action-icon',
|
|
140
|
+
svgObj: params.activeActionIcon
|
|
142
141
|
});
|
|
143
142
|
this.action.addChild(this.actionIcon);
|
|
144
143
|
}
|
|
145
|
-
else if (
|
|
144
|
+
else if (params === null || params === void 0 ? void 0 : params.activeActionText) {
|
|
146
145
|
this.actionSpan = new framework_1.Span({
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
name: 'switch-action-text'
|
|
150
|
-
}
|
|
146
|
+
name: 'switch-action-text',
|
|
147
|
+
text: params.activeActionText
|
|
151
148
|
});
|
|
152
149
|
this.action.addChild(this.actionSpan);
|
|
153
150
|
}
|
|
154
151
|
}
|
|
155
|
-
else if ((
|
|
156
|
-
if (
|
|
152
|
+
else if ((params === null || params === void 0 ? void 0 : params.modelValue) !== (params === null || params === void 0 ? void 0 : params.activeValue)) {
|
|
153
|
+
if (params === null || params === void 0 ? void 0 : params.inactiveActionIcon) {
|
|
157
154
|
this.actionIcon = new td_icon_class_1.TdIcon({
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
name: 'switch-action-icon'
|
|
161
|
-
}
|
|
155
|
+
name: 'switch-action-icon',
|
|
156
|
+
svgObj: params.inactiveActionIcon
|
|
162
157
|
});
|
|
163
158
|
this.action.addChild(this.actionIcon);
|
|
164
159
|
}
|
|
165
|
-
else if (
|
|
160
|
+
else if (params === null || params === void 0 ? void 0 : params.inactiveActionText) {
|
|
166
161
|
this.actionSpan = new framework_1.Span({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
name: 'switch-action-text'
|
|
170
|
-
}
|
|
162
|
+
name: 'switch-action-text',
|
|
163
|
+
text: params.inactiveActionText
|
|
171
164
|
});
|
|
172
165
|
this.action.addChild(this.actionSpan);
|
|
173
166
|
}
|
|
174
167
|
}
|
|
175
168
|
this.addChild(this.action);
|
|
169
|
+
this.props = this.setParams(params);
|
|
176
170
|
}
|
|
177
171
|
setInnerChecked(checked) {
|
|
178
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
179
173
|
if (checked) {
|
|
180
|
-
(_a = this.inner) === null || _a === void 0 ? void 0 : _a.setStyleObj({
|
|
174
|
+
(_a = this.inner) === null || _a === void 0 ? void 0 : _a.ctrl.setStyleObj({
|
|
181
175
|
// padding: 0 calc(#{map.get($switch-button-size, 'default')} + 2px) 0 #{map.get(
|
|
182
176
|
// $switch-content-padding,
|
|
183
177
|
// 'default'
|
|
184
178
|
// )};
|
|
185
|
-
padding: '0 ' +
|
|
186
|
-
|
|
179
|
+
padding: '0 ' +
|
|
180
|
+
'calc(' +
|
|
181
|
+
td_switch_style_1.$switchButtonSize[this.props.size || 'default'] +
|
|
182
|
+
' + 2px)' +
|
|
183
|
+
'0 ' +
|
|
184
|
+
td_switch_style_1.$switchContentPadding[this.props.size || 'default']
|
|
187
185
|
});
|
|
188
|
-
if (
|
|
189
|
-
(
|
|
186
|
+
if (this.props.activeIcon || this.props.inactiveIcon) {
|
|
187
|
+
(_b = this.innerIcon) === null || _b === void 0 ? void 0 : _b.replaceSvg(this.props.activeIcon);
|
|
190
188
|
}
|
|
191
|
-
else if (
|
|
192
|
-
(
|
|
189
|
+
else if (this.props.activeText || this.props.inactiveText) {
|
|
190
|
+
(_d = (_c = this.innerText) === null || _c === void 0 ? void 0 : _c.textNode) === null || _d === void 0 ? void 0 : _d.setText(this.props.activeText || '');
|
|
193
191
|
}
|
|
194
192
|
}
|
|
195
193
|
else {
|
|
196
|
-
(
|
|
194
|
+
(_e = this.inner) === null || _e === void 0 ? void 0 : _e.ctrl.setStyleObj({
|
|
197
195
|
// padding: 0 #{map.get($switch-content-padding, 'default')} 0 calc(#{map.get(
|
|
198
196
|
// $switch-button-size,
|
|
199
197
|
// 'default'
|
|
200
198
|
// )} + 2px);
|
|
201
|
-
padding: '0 ' +
|
|
199
|
+
padding: '0 ' +
|
|
200
|
+
td_switch_style_1.$switchContentPadding[this.props.size || 'default'] +
|
|
201
|
+
' 0 calc(' +
|
|
202
|
+
td_switch_style_1.$switchButtonSize[this.props.size || 'default'] +
|
|
203
|
+
' + 2px)'
|
|
202
204
|
});
|
|
203
|
-
if (
|
|
204
|
-
(
|
|
205
|
+
if (this.props.activeIcon || this.props.inactiveIcon) {
|
|
206
|
+
(_f = this.innerIcon) === null || _f === void 0 ? void 0 : _f.replaceSvg(this.props.inactiveIcon);
|
|
205
207
|
}
|
|
206
|
-
else if (
|
|
207
|
-
(
|
|
208
|
+
else if (this.props.activeText || this.props.inactiveText) {
|
|
209
|
+
(_h = (_g = this.innerText) === null || _g === void 0 ? void 0 : _g.textNode) === null || _h === void 0 ? void 0 : _h.setText(this.props.inactiveText || '');
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
}
|
|
@@ -2,6 +2,6 @@ import { TypeSpan } from '@type-dom/framework';
|
|
|
2
2
|
import { ITdSwitchConfig } from '../td-switch.interface';
|
|
3
3
|
export declare class TdSwitchLeft extends TypeSpan {
|
|
4
4
|
className: 'TdSwitchLeft';
|
|
5
|
-
|
|
6
|
-
constructor(
|
|
5
|
+
props: ITdSwitchConfig;
|
|
6
|
+
constructor(params?: ITdSwitchConfig);
|
|
7
7
|
}
|