@aurelia-mdc-web/all 9.3.1-au2 → 9.3.3-au2
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/dist/alert/alert-configuration.js +15 -0
- package/dist/alert/alert-configuration.js.map +1 -0
- package/dist/alert/alert-modal/alert-modal.html +27 -0
- package/dist/alert/alert-modal/alert-modal.js +30 -0
- package/dist/alert/alert-modal/alert-modal.js.map +1 -0
- package/dist/alert/alert-modal/i-alert-modal-payload.js +14 -0
- package/dist/alert/alert-modal/i-alert-modal-payload.js.map +1 -0
- package/dist/alert/alert-service.js +106 -0
- package/dist/alert/alert-service.js.map +1 -0
- package/dist/alert/decorators/confirm-action.js +17 -0
- package/dist/alert/decorators/confirm-action.js.map +1 -0
- package/dist/alert/decorators/using-progress.js +27 -0
- package/dist/alert/decorators/using-progress.js.map +1 -0
- package/dist/alert/exceptions-tracker.js +8 -0
- package/dist/alert/exceptions-tracker.js.map +1 -0
- package/dist/alert/global-progress/global-progress.html +9 -0
- package/dist/alert/global-progress/global-progress.js +64 -0
- package/dist/alert/global-progress/global-progress.js.map +1 -0
- package/dist/alert/prompt-dialog/prompt-dialog.html +15 -0
- package/dist/alert/prompt-dialog/prompt-dialog.js +44 -0
- package/dist/alert/prompt-dialog/prompt-dialog.js.map +1 -0
- package/dist/banner/mdc-banner.html +21 -21
- package/dist/banner/mdc-banner.js +45 -42
- package/dist/banner/mdc-banner.js.map +1 -1
- package/dist/base/attributes/mdc-focus-trap.js +25 -22
- package/dist/base/attributes/mdc-focus-trap.js.map +1 -1
- package/dist/base/elements/i-validated-element.js +2 -1
- package/dist/base/elements/i-validated-element.js.map +1 -1
- package/dist/base/elements/mdc-promisify-reference.js +16 -13
- package/dist/base/elements/mdc-promisify-reference.js.map +1 -1
- package/dist/base/index.js +21 -9
- package/dist/base/index.js.map +1 -1
- package/dist/base/interceptors.js +12 -5
- package/dist/base/interceptors.js.map +1 -1
- package/dist/base/material-palette.js +4 -1
- package/dist/base/material-palette.js.map +1 -1
- package/dist/base/mdc-component.js +5 -1
- package/dist/base/mdc-component.js.map +1 -1
- package/dist/base/next-element.js +4 -1
- package/dist/base/next-element.js.map +1 -1
- package/dist/button/enhance-mdc-button.js +9 -6
- package/dist/button/enhance-mdc-button.js.map +1 -1
- package/dist/button/mdc-button-label.js +9 -6
- package/dist/button/mdc-button-label.js.map +1 -1
- package/dist/button/mdc-button.html +12 -12
- package/dist/button/mdc-button.js +30 -27
- package/dist/button/mdc-button.js.map +1 -1
- package/dist/card/mdc-card-action-buttons.js +9 -6
- package/dist/card/mdc-card-action-buttons.js.map +1 -1
- package/dist/card/mdc-card-action-icons.js +9 -6
- package/dist/card/mdc-card-action-icons.js.map +1 -1
- package/dist/card/mdc-card-actions/mdc-card-actions.html +3 -3
- package/dist/card/mdc-card-actions/mdc-card-actions.js +15 -12
- package/dist/card/mdc-card-actions/mdc-card-actions.js.map +1 -1
- package/dist/card/mdc-card-media/mdc-card-media.html +5 -5
- package/dist/card/mdc-card-media/mdc-card-media.js +18 -15
- package/dist/card/mdc-card-media/mdc-card-media.js.map +1 -1
- package/dist/card/mdc-card-primary-action.html +5 -5
- package/dist/card/mdc-card-primary-action.js +15 -12
- package/dist/card/mdc-card-primary-action.js.map +1 -1
- package/dist/card/mdc-card.html +3 -3
- package/dist/card/mdc-card.js +15 -12
- package/dist/card/mdc-card.js.map +1 -1
- package/dist/checkbox/mdc-checkbox.html +12 -12
- package/dist/checkbox/mdc-checkbox.js +38 -35
- package/dist/checkbox/mdc-checkbox.js.map +1 -1
- package/dist/chips/mdc-chip/mdc-chip.html +24 -24
- package/dist/chips/mdc-chip/mdc-chip.js +37 -34
- package/dist/chips/mdc-chip/mdc-chip.js.map +1 -1
- package/dist/chips/mdc-chip-action/enhance-mdc-chip-action.js +9 -6
- package/dist/chips/mdc-chip-action/enhance-mdc-chip-action.js.map +1 -1
- package/dist/chips/mdc-chip-action/mdc-chip-action.html +25 -25
- package/dist/chips/mdc-chip-action/mdc-chip-action.js +40 -37
- package/dist/chips/mdc-chip-action/mdc-chip-action.js.map +1 -1
- package/dist/chips/mdc-chip-set/mdc-chip-set.html +10 -10
- package/dist/chips/mdc-chip-set/mdc-chip-set.js +27 -24
- package/dist/chips/mdc-chip-set/mdc-chip-set.js.map +1 -1
- package/dist/circular-progress/mdc-circular-progress.html +38 -38
- package/dist/circular-progress/mdc-circular-progress.js +25 -22
- package/dist/circular-progress/mdc-circular-progress.js.map +1 -1
- package/dist/data-table/mdc-data-table-row.js +13 -10
- package/dist/data-table/mdc-data-table-row.js.map +1 -1
- package/dist/data-table/mdc-data-table.html +50 -49
- package/dist/data-table/mdc-data-table.js +183 -91
- package/dist/data-table/mdc-data-table.js.map +1 -1
- package/dist/dialog/mdc-dialog-actions.js +13 -10
- package/dist/dialog/mdc-dialog-actions.js.map +1 -1
- package/dist/dialog/mdc-dialog-content.js +9 -6
- package/dist/dialog/mdc-dialog-content.js.map +1 -1
- package/dist/dialog/mdc-dialog-service.js +20 -13
- package/dist/dialog/mdc-dialog-service.js.map +1 -1
- package/dist/dialog/mdc-dialog-title.js +9 -6
- package/dist/dialog/mdc-dialog-title.js.map +1 -1
- package/dist/dialog/mdc-dialog.html +14 -14
- package/dist/dialog/mdc-dialog.js +49 -46
- package/dist/dialog/mdc-dialog.js.map +1 -1
- package/dist/drawer/mdc-drawer-app-content.js +9 -6
- package/dist/drawer/mdc-drawer-app-content.js.map +1 -1
- package/dist/drawer/mdc-drawer-content.js +9 -6
- package/dist/drawer/mdc-drawer-content.js.map +1 -1
- package/dist/drawer/mdc-drawer-header/mdc-drawer-header.html +5 -5
- package/dist/drawer/mdc-drawer-header/mdc-drawer-header.js +17 -14
- package/dist/drawer/mdc-drawer-header/mdc-drawer-header.js.map +1 -1
- package/dist/drawer/mdc-drawer.html +6 -6
- package/dist/drawer/mdc-drawer.js +24 -21
- package/dist/drawer/mdc-drawer.js.map +1 -1
- package/dist/elevation/mdc-elevation.js +9 -6
- package/dist/elevation/mdc-elevation.js.map +1 -1
- package/dist/expandable/mdc-expandable.html +28 -28
- package/dist/expandable/mdc-expandable.js +20 -17
- package/dist/expandable/mdc-expandable.js.map +1 -1
- package/dist/fab/enhance-mdc-fab.js +9 -6
- package/dist/fab/enhance-mdc-fab.js.map +1 -1
- package/dist/fab/mdc-fab-icon.js +9 -6
- package/dist/fab/mdc-fab-icon.js.map +1 -1
- package/dist/fab/mdc-fab.html +13 -13
- package/dist/fab/mdc-fab.js +33 -30
- package/dist/fab/mdc-fab.js.map +1 -1
- package/dist/floating-label/mdc-floating-label.html +1 -1
- package/dist/floating-label/mdc-floating-label.js +16 -13
- package/dist/floating-label/mdc-floating-label.js.map +1 -1
- package/dist/form-field/mdc-form-field.html +6 -6
- package/dist/form-field/mdc-form-field.js +27 -24
- package/dist/form-field/mdc-form-field.js.map +1 -1
- package/dist/icon/mdc-icon.html +3 -3
- package/dist/icon/mdc-icon.js +10 -7
- package/dist/icon/mdc-icon.js.map +1 -1
- package/dist/icon-button/enhance-mdc-icon-button.js +9 -6
- package/dist/icon-button/enhance-mdc-icon-button.js.map +1 -1
- package/dist/icon-button/mdc-icon-button-icon/mdc-icon-button-icon.html +4 -4
- package/dist/icon-button/mdc-icon-button-icon/mdc-icon-button-icon.js +18 -15
- package/dist/icon-button/mdc-icon-button-icon/mdc-icon-button-icon.js.map +1 -1
- package/dist/icon-button/mdc-icon-button.html +11 -11
- package/dist/icon-button/mdc-icon-button.js +28 -25
- package/dist/icon-button/mdc-icon-button.js.map +1 -1
- package/dist/image-list/mdc-image-list-item/mdc-image-list-item.html +9 -9
- package/dist/image-list/mdc-image-list-item/mdc-image-list-item.js +22 -19
- package/dist/image-list/mdc-image-list-item/mdc-image-list-item.js.map +1 -1
- package/dist/image-list/mdc-image-list.html +7 -7
- package/dist/image-list/mdc-image-list.js +35 -32
- package/dist/image-list/mdc-image-list.js.map +1 -1
- package/dist/index.js +297 -139
- package/dist/index.js.map +1 -1
- package/dist/layout-grid/mdc-layout-grid-cell/mdc-layout-grid-cell.html +12 -12
- package/dist/layout-grid/mdc-layout-grid-cell/mdc-layout-grid-cell.js +36 -33
- package/dist/layout-grid/mdc-layout-grid-cell/mdc-layout-grid-cell.js.map +1 -1
- package/dist/layout-grid/mdc-layout-grid-inner.js +9 -6
- package/dist/layout-grid/mdc-layout-grid-inner.js.map +1 -1
- package/dist/layout-grid/mdc-layout-grid.html +8 -8
- package/dist/layout-grid/mdc-layout-grid.js +33 -30
- package/dist/layout-grid/mdc-layout-grid.js.map +1 -1
- package/dist/line-ripple/mdc-line-ripple.js +13 -10
- package/dist/line-ripple/mdc-line-ripple.js.map +1 -1
- package/dist/linear-progress/mdc-linear-progress.html +12 -12
- package/dist/linear-progress/mdc-linear-progress.js +26 -23
- package/dist/linear-progress/mdc-linear-progress.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-divider/mdc-deprecated-list-divider.html +4 -4
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-divider/mdc-deprecated-list-divider.js +18 -15
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-divider/mdc-deprecated-list-divider.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-group.js +17 -14
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-group.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/enhance-mdc-deprecated-list-item.js +9 -6
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/enhance-mdc-deprecated-list-item.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item-graphic.js +9 -6
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item-graphic.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item-meta.js +9 -6
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item-meta.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item.html +8 -8
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item.js +28 -25
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item-primary-text.js +9 -6
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item-primary-text.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item-secondary-text.js +9 -6
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item-secondary-text.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list.html +15 -15
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list.js +78 -75
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list.js.map +1 -1
- package/dist/list/mdc-list-divider/mdc-list-divider.html +7 -7
- package/dist/list/mdc-list-divider/mdc-list-divider.js +21 -18
- package/dist/list/mdc-list-divider/mdc-list-divider.js.map +1 -1
- package/dist/list/mdc-list-group.js +17 -14
- package/dist/list/mdc-list-group.js.map +1 -1
- package/dist/list/mdc-list-item/enhance-mdc-list-item.js +9 -6
- package/dist/list/mdc-list-item/enhance-mdc-list-item.js.map +1 -1
- package/dist/list/mdc-list-item/mdc-list-item-leading.js +9 -6
- package/dist/list/mdc-list-item/mdc-list-item-leading.js.map +1 -1
- package/dist/list/mdc-list-item/mdc-list-item-trailing.js +9 -6
- package/dist/list/mdc-list-item/mdc-list-item-trailing.js.map +1 -1
- package/dist/list/mdc-list-item/mdc-list-item.html +13 -13
- package/dist/list/mdc-list-item/mdc-list-item.js +40 -37
- package/dist/list/mdc-list-item/mdc-list-item.js.map +1 -1
- package/dist/list/mdc-list-item-overline-text.js +9 -6
- package/dist/list/mdc-list-item-overline-text.js.map +1 -1
- package/dist/list/mdc-list-item-primary-text.js +9 -6
- package/dist/list/mdc-list-item-primary-text.js.map +1 -1
- package/dist/list/mdc-list-item-secondary-text.js +9 -6
- package/dist/list/mdc-list-item-secondary-text.js.map +1 -1
- package/dist/list/mdc-list.html +5 -5
- package/dist/list/mdc-list.js +58 -55
- package/dist/list/mdc-list.js.map +1 -1
- package/dist/lookup/discardable-promise.js +5 -1
- package/dist/lookup/discardable-promise.js.map +1 -1
- package/dist/lookup/mdc-lookup-configuration.js +5 -1
- package/dist/lookup/mdc-lookup-configuration.js.map +1 -1
- package/dist/lookup/mdc-lookup.html +27 -27
- package/dist/lookup/mdc-lookup.js +74 -71
- package/dist/lookup/mdc-lookup.js.map +1 -1
- package/dist/mdc-configuration.js +15 -9
- package/dist/mdc-configuration.js.map +1 -1
- package/dist/menu/mdc-menu-selection-group-icon.js +9 -6
- package/dist/menu/mdc-menu-selection-group-icon.js.map +1 -1
- package/dist/menu/mdc-menu-selection-group.js +9 -6
- package/dist/menu/mdc-menu-selection-group.js.map +1 -1
- package/dist/menu/mdc-menu.html +6 -6
- package/dist/menu/mdc-menu.js +71 -68
- package/dist/menu/mdc-menu.js.map +1 -1
- package/dist/menu-surface/mdc-menu-surface-anchor.js +11 -8
- package/dist/menu-surface/mdc-menu-surface-anchor.js.map +1 -1
- package/dist/menu-surface/mdc-menu-surface.js +61 -58
- package/dist/menu-surface/mdc-menu-surface.js.map +1 -1
- package/dist/notched-outline/mdc-notched-outline.html +7 -7
- package/dist/notched-outline/mdc-notched-outline.js +20 -17
- package/dist/notched-outline/mdc-notched-outline.js.map +1 -1
- package/dist/radio/mdc-radio.html +9 -9
- package/dist/radio/mdc-radio.js +27 -24
- package/dist/radio/mdc-radio.js.map +1 -1
- package/dist/ripple/mdc-ripple.js +51 -48
- package/dist/ripple/mdc-ripple.js.map +1 -1
- package/dist/segmented-button/mdc-segmented-button-segment/enhance-mdc-segmented-button-segment.js +9 -6
- package/dist/segmented-button/mdc-segmented-button-segment/enhance-mdc-segmented-button-segment.js.map +1 -1
- package/dist/segmented-button/mdc-segmented-button-segment/mdc-segmented-button-segment.html +11 -11
- package/dist/segmented-button/mdc-segmented-button-segment/mdc-segmented-button-segment.js +27 -24
- package/dist/segmented-button/mdc-segmented-button-segment/mdc-segmented-button-segment.js.map +1 -1
- package/dist/segmented-button/mdc-segmented-button.html +3 -3
- package/dist/segmented-button/mdc-segmented-button.js +24 -21
- package/dist/segmented-button/mdc-segmented-button.js.map +1 -1
- package/dist/select/mdc-default-select-configuration.js +5 -1
- package/dist/select/mdc-default-select-configuration.js.map +1 -1
- package/dist/select/mdc-select-adapter-aurelia.js +2 -1
- package/dist/select/mdc-select-adapter-aurelia.js.map +1 -1
- package/dist/select/mdc-select-foundation-aurelia.js +47 -43
- package/dist/select/mdc-select-foundation-aurelia.js.map +1 -1
- package/dist/select/mdc-select-helper-text/mdc-select-helper-text.html +7 -7
- package/dist/select/mdc-select-helper-text/mdc-select-helper-text.js +27 -24
- package/dist/select/mdc-select-helper-text/mdc-select-helper-text.js.map +1 -1
- package/dist/select/mdc-select-icon.js +16 -13
- package/dist/select/mdc-select-icon.js.map +1 -1
- package/dist/select/mdc-select-value-observer.js +16 -12
- package/dist/select/mdc-select-value-observer.js.map +1 -1
- package/dist/select/mdc-select.html +38 -38
- package/dist/select/mdc-select.js +71 -68
- package/dist/select/mdc-select.js.map +1 -1
- package/dist/slider/mdc-slider-foundation-aurelia.js +6 -2
- package/dist/slider/mdc-slider-foundation-aurelia.js.map +1 -1
- package/dist/slider/mdc-slider.html +36 -36
- package/dist/slider/mdc-slider.js +79 -76
- package/dist/slider/mdc-slider.js.map +1 -1
- package/dist/snackbar/mdc-snackbar-service.js +8 -4
- package/dist/snackbar/mdc-snackbar-service.js.map +1 -1
- package/dist/snackbar/mdc-snackbar.html +14 -14
- package/dist/snackbar/mdc-snackbar.js +55 -52
- package/dist/snackbar/mdc-snackbar.js.map +1 -1
- package/dist/switch/enhance-mdc-switch.js +9 -6
- package/dist/switch/enhance-mdc-switch.js.map +1 -1
- package/dist/switch/mdc-switch.html +21 -21
- package/dist/switch/mdc-switch.js +16 -13
- package/dist/switch/mdc-switch.js.map +1 -1
- package/dist/tab-bar/indicator/mdc-tab-indicator.html +9 -9
- package/dist/tab-bar/indicator/mdc-tab-indicator.js +26 -23
- package/dist/tab-bar/indicator/mdc-tab-indicator.js.map +1 -1
- package/dist/tab-bar/mdc-tab-bar.html +6 -6
- package/dist/tab-bar/mdc-tab-bar.js +29 -26
- package/dist/tab-bar/mdc-tab-bar.js.map +1 -1
- package/dist/tab-bar/scroller/mdc-tab-scroller.html +11 -11
- package/dist/tab-bar/scroller/mdc-tab-scroller.js +25 -22
- package/dist/tab-bar/scroller/mdc-tab-scroller.js.map +1 -1
- package/dist/tab-bar/tab/mdc-tab.html +20 -20
- package/dist/tab-bar/tab/mdc-tab.js +44 -41
- package/dist/tab-bar/tab/mdc-tab.js.map +1 -1
- package/dist/text-field/enhance-mdc-text-field.js +9 -6
- package/dist/text-field/enhance-mdc-text-field.js.map +1 -1
- package/dist/text-field/mdc-default-text-field-configuration.js +5 -1
- package/dist/text-field/mdc-default-text-field-configuration.js.map +1 -1
- package/dist/text-field/mdc-inputmask.js +76 -0
- package/dist/text-field/mdc-inputmask.js.map +1 -0
- package/dist/text-field/mdc-text-field-character-counter.js +13 -10
- package/dist/text-field/mdc-text-field-character-counter.js.map +1 -1
- package/dist/text-field/mdc-text-field-helper-line/mdc-text-field-helper-line.html +7 -7
- package/dist/text-field/mdc-text-field-helper-line/mdc-text-field-helper-line.js +14 -11
- package/dist/text-field/mdc-text-field-helper-line/mdc-text-field-helper-line.js.map +1 -1
- package/dist/text-field/mdc-text-field-helper-text/mdc-text-field-helper-text.html +6 -6
- package/dist/text-field/mdc-text-field-helper-text/mdc-text-field-helper-text.js +22 -19
- package/dist/text-field/mdc-text-field-helper-text/mdc-text-field-helper-text.js.map +1 -1
- package/dist/text-field/mdc-text-field-icon.js +22 -19
- package/dist/text-field/mdc-text-field-icon.js.map +1 -1
- package/dist/text-field/mdc-text-field.html +29 -29
- package/dist/text-field/mdc-text-field.js +116 -113
- package/dist/text-field/mdc-text-field.js.map +1 -1
- package/dist/tooltip/mdc-default-tooltip-configuration.js +5 -1
- package/dist/tooltip/mdc-default-tooltip-configuration.js.map +1 -1
- package/dist/tooltip/mdc-tooltip-attribute.js +39 -36
- package/dist/tooltip/mdc-tooltip-attribute.js.map +1 -1
- package/dist/tooltip/mdc-tooltip.html +7 -7
- package/dist/tooltip/mdc-tooltip.js +66 -63
- package/dist/tooltip/mdc-tooltip.js.map +1 -1
- package/dist/top-app-bar/enhance-top-app-bar-actions.js +9 -6
- package/dist/top-app-bar/enhance-top-app-bar-actions.js.map +1 -1
- package/dist/top-app-bar/mdc-top-app-bar-action-item.js +9 -6
- package/dist/top-app-bar/mdc-top-app-bar-action-item.js.map +1 -1
- package/dist/top-app-bar/mdc-top-app-bar-fixed-adjust.js +9 -6
- package/dist/top-app-bar/mdc-top-app-bar-fixed-adjust.js.map +1 -1
- package/dist/top-app-bar/mdc-top-app-bar-nav-icon.js +9 -6
- package/dist/top-app-bar/mdc-top-app-bar-nav-icon.js.map +1 -1
- package/dist/top-app-bar/mdc-top-app-bar-row.js +9 -6
- package/dist/top-app-bar/mdc-top-app-bar-row.js.map +1 -1
- package/dist/top-app-bar/mdc-top-app-bar-section/mdc-top-app-bar-section.html +3 -3
- package/dist/top-app-bar/mdc-top-app-bar-section/mdc-top-app-bar-section.js +15 -12
- package/dist/top-app-bar/mdc-top-app-bar-section/mdc-top-app-bar-section.js.map +1 -1
- package/dist/top-app-bar/mdc-top-app-bar-title.js +9 -6
- package/dist/top-app-bar/mdc-top-app-bar-title.js.map +1 -1
- package/dist/top-app-bar/mdc-top-app-bar.html +9 -9
- package/dist/top-app-bar/mdc-top-app-bar.js +43 -40
- package/dist/top-app-bar/mdc-top-app-bar.js.map +1 -1
- package/dist/tree-view/i-tree-node.js +2 -1
- package/dist/tree-view/i-tree-node.js.map +1 -1
- package/dist/tree-view/mdc-tree-node-meta.js +9 -6
- package/dist/tree-view/mdc-tree-node-meta.js.map +1 -1
- package/dist/tree-view/mdc-tree-node.js +9 -6
- package/dist/tree-view/mdc-tree-node.js.map +1 -1
- package/dist/tree-view/mdc-tree-view.js +29 -25
- package/dist/tree-view/mdc-tree-view.js.map +1 -1
- package/dist/tree-view/node-filter.js +9 -6
- package/dist/tree-view/node-filter.js.map +1 -1
- package/dist/types/alert/alert-configuration.d.ts +8 -0
- package/dist/types/alert/alert-modal/alert-modal.d.ts +6 -0
- package/dist/types/alert/alert-modal/i-alert-modal-payload.d.ts +9 -0
- package/dist/types/alert/alert-service.d.ts +27 -0
- package/dist/types/alert/decorators/confirm-action.d.ts +3 -0
- package/dist/types/alert/decorators/using-progress.d.ts +6 -0
- package/dist/types/alert/exceptions-tracker.d.ts +3 -0
- package/dist/types/alert/global-progress/global-progress.d.ts +11 -0
- package/dist/types/alert/prompt-dialog/prompt-dialog.d.ts +21 -0
- package/dist/types/data-table/mdc-data-table.d.ts +16 -4
- package/dist/types/index.d.ts +11 -1
- package/dist/types/lookup/mdc-lookup.d.ts +3 -3
- package/dist/types/mdc-configuration.d.ts +2 -0
- package/dist/types/select/mdc-select.d.ts +3 -3
- package/dist/types/text-field/mdc-inputmask.d.ts +11 -0
- package/dist/types/text-field/mdc-text-field.d.ts +3 -3
- package/dist/types/tooltip/mdc-tooltip.d.ts +3 -3
- package/dist/types/validation/validate.d.ts +10 -0
- package/dist/typography/mdc-typography.js +60 -57
- package/dist/typography/mdc-typography.js.map +1 -1
- package/dist/validation/mdc-validation-controller-factory.js +10 -6
- package/dist/validation/mdc-validation-controller-factory.js.map +1 -1
- package/dist/validation/mdc-validation-result-presenter.js +5 -1
- package/dist/validation/mdc-validation-result-presenter.js.map +1 -1
- package/dist/validation/validate.js +27 -0
- package/dist/validation/validate.js.map +1 -0
- package/package.json +4 -2
- package/src/alert/alert-configuration.ts +11 -0
- package/src/alert/alert-modal/alert-modal.html +27 -0
- package/src/alert/alert-modal/alert-modal.scss +10 -0
- package/src/alert/alert-modal/alert-modal.ts +13 -0
- package/src/alert/alert-modal/i-alert-modal-payload.ts +9 -0
- package/src/alert/alert-service.ts +113 -0
- package/src/alert/decorators/confirm-action.ts +18 -0
- package/src/alert/decorators/using-progress.ts +30 -0
- package/src/alert/exceptions-tracker.ts +3 -0
- package/src/alert/global-progress/global-progress.html +9 -0
- package/src/alert/global-progress/global-progress.scss +38 -0
- package/src/alert/global-progress/global-progress.ts +27 -0
- package/src/alert/prompt-dialog/prompt-dialog.html +15 -0
- package/src/alert/prompt-dialog/prompt-dialog.ts +35 -0
- package/src/banner/mdc-banner.html +21 -21
- package/src/banner/mdc-banner.ts +116 -116
- package/src/base/attributes/mdc-focus-trap.ts +42 -42
- package/src/base/elements/i-validated-element.ts +12 -12
- package/src/base/elements/mdc-promisify-reference.ts +21 -21
- package/src/base/interceptors.ts +25 -25
- package/src/base/material-palette.md +7 -7
- package/src/base/material-palette.ts +22 -22
- package/src/base/mdc-component.ts +69 -69
- package/src/base/next-element.ts +39 -39
- package/src/button/enhance-mdc-button.ts +8 -8
- package/src/button/mdc-button-label.ts +15 -15
- package/src/button/mdc-button.html +12 -12
- package/src/button/mdc-button.ts +62 -62
- package/src/card/mdc-card-action-buttons.ts +19 -19
- package/src/card/mdc-card-action-icons.ts +19 -19
- package/src/card/mdc-card-actions/mdc-card-actions.html +3 -3
- package/src/card/mdc-card-actions/mdc-card-actions.ts +15 -15
- package/src/card/mdc-card-media/mdc-card-media.html +5 -5
- package/src/card/mdc-card-media/mdc-card-media.ts +21 -21
- package/src/card/mdc-card-primary-action.html +5 -5
- package/src/card/mdc-card-primary-action.ts +16 -16
- package/src/card/mdc-card.html +3 -3
- package/src/card/mdc-card.ts +16 -16
- package/src/checkbox/mdc-checkbox.html +12 -12
- package/src/checkbox/mdc-checkbox.ts +217 -217
- package/src/chips/mdc-chip/mdc-chip.html +24 -24
- package/src/chips/mdc-chip-action/enhance-mdc-chip-action.ts +8 -8
- package/src/chips/mdc-chip-action/mdc-chip-action.html +25 -25
- package/src/chips/mdc-chip-action/mdc-chip-action.ts +143 -143
- package/src/chips/mdc-chip-set/mdc-chip-set.html +10 -10
- package/src/chips/mdc-chip-set/mdc-chip-set.ts +117 -117
- package/src/circular-progress/mdc-circular-progress.html +38 -38
- package/src/circular-progress/mdc-circular-progress.ts +91 -91
- package/src/circular-progress/styles/_index.scss +1 -1
- package/src/circular-progress/styles/mdc-circular-progress.import.scss +1 -1
- package/src/circular-progress/styles/mdc-circular-progress.scss +14 -14
- package/src/data-table/mdc-data-table-row.ts +24 -24
- package/src/data-table/mdc-data-table.html +50 -49
- package/src/data-table/mdc-data-table.ts +111 -13
- package/src/data-table/styles/_index.scss +1 -0
- package/src/data-table/styles/mdc-data-table.import.scss +1 -0
- package/src/data-table/styles/mdc-data-table.scss +64 -0
- package/src/dialog/mdc-dialog-actions.ts +23 -23
- package/src/dialog/mdc-dialog-content.ts +11 -11
- package/src/dialog/mdc-dialog-service.ts +83 -80
- package/src/dialog/mdc-dialog-title.ts +8 -8
- package/src/dialog/mdc-dialog.html +14 -14
- package/src/dialog/mdc-dialog.ts +224 -224
- package/src/drawer/mdc-drawer-app-content.ts +11 -11
- package/src/drawer/mdc-drawer-content.ts +11 -11
- package/src/drawer/mdc-drawer-header/mdc-drawer-header.html +5 -5
- package/src/drawer/mdc-drawer-header/mdc-drawer-header.ts +18 -18
- package/src/drawer/mdc-drawer.html +6 -6
- package/src/drawer/mdc-drawer.ts +125 -125
- package/src/elevation/mdc-elevation.ts +23 -23
- package/src/expandable/mdc-expandable.html +28 -28
- package/src/expandable/styles/_icon-variables.scss +3 -3
- package/src/expandable/styles/_index.scss +1 -1
- package/src/expandable/styles/_mixins.scss +287 -287
- package/src/expandable/styles/_variables.scss +17 -17
- package/src/expandable/styles/mdc-expandable.import.scss +1 -1
- package/src/expandable/styles/mdc-expandable.scss +3 -3
- package/src/fab/enhance-mdc-fab.ts +8 -8
- package/src/fab/mdc-fab-icon.ts +15 -15
- package/src/fab/mdc-fab.html +13 -13
- package/src/fab/mdc-fab.ts +50 -50
- package/src/floating-label/mdc-floating-label.html +1 -1
- package/src/floating-label/mdc-floating-label.ts +44 -44
- package/src/form-field/mdc-form-field.html +6 -6
- package/src/icon/mdc-icon.html +3 -3
- package/src/icon/mdc-icon.ts +11 -11
- package/src/icon-button/enhance-mdc-icon-button.ts +8 -8
- package/src/icon-button/mdc-icon-button-icon/mdc-icon-button-icon.html +4 -4
- package/src/icon-button/mdc-icon-button-icon/mdc-icon-button-icon.ts +29 -29
- package/src/icon-button/mdc-icon-button.html +11 -11
- package/src/icon-button/mdc-icon-button.ts +69 -69
- package/src/image-list/mdc-image-list-item/mdc-image-list-item.html +9 -9
- package/src/image-list/mdc-image-list-item/mdc-image-list-item.ts +31 -31
- package/src/image-list/mdc-image-list.html +7 -7
- package/src/image-list/mdc-image-list.ts +73 -73
- package/src/image-list/styles/_index.scss +1 -1
- package/src/image-list/styles/mdc-image-list.import.scss +1 -1
- package/src/image-list/styles/mdc-image-list.scss +7 -7
- package/src/index.ts +17 -3
- package/src/layout-grid/mdc-layout-grid-cell/mdc-layout-grid-cell.html +12 -12
- package/src/layout-grid/mdc-layout-grid-cell/mdc-layout-grid-cell.ts +49 -49
- package/src/layout-grid/mdc-layout-grid-inner.ts +8 -8
- package/src/layout-grid/mdc-layout-grid.html +8 -8
- package/src/layout-grid/mdc-layout-grid.ts +67 -67
- package/src/layout-grid/styles/_index.scss +1 -1
- package/src/layout-grid/styles/mdc-layout-grid.import.scss +1 -1
- package/src/layout-grid/styles/mdc-layout-grid.scss +11 -11
- package/src/line-ripple/mdc-line-ripple.ts +41 -41
- package/src/linear-progress/mdc-linear-progress.html +12 -12
- package/src/linear-progress/mdc-linear-progress.ts +103 -103
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-divider/mdc-deprecated-list-divider.html +4 -4
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-divider/mdc-deprecated-list-divider.ts +18 -18
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-group.ts +27 -27
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-item/enhance-mdc-deprecated-list-item.ts +8 -8
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item-graphic.ts +15 -15
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item-meta.ts +15 -15
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item.html +8 -8
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-item-primary-text.ts +11 -11
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-item-secondary-text.ts +11 -11
- package/src/list/mdc-deprecated-list/mdc-deprecated-list.html +15 -15
- package/src/list/mdc-deprecated-list/mdc-deprecated-list.ts +331 -331
- package/src/list/mdc-list-divider/mdc-list-divider.html +7 -7
- package/src/list/mdc-list-divider/mdc-list-divider.ts +24 -24
- package/src/list/mdc-list-group.ts +27 -27
- package/src/list/mdc-list-item/enhance-mdc-list-item.ts +8 -8
- package/src/list/mdc-list-item/mdc-list-item-leading.ts +34 -34
- package/src/list/mdc-list-item/mdc-list-item-trailing.ts +36 -36
- package/src/list/mdc-list-item/mdc-list-item.html +13 -13
- package/src/list/mdc-list-item-overline-text.ts +8 -8
- package/src/list/mdc-list-item-primary-text.ts +11 -11
- package/src/list/mdc-list-item-secondary-text.ts +11 -11
- package/src/list/mdc-list.html +5 -5
- package/src/list/mdc-list.ts +300 -300
- package/src/lookup/discardable-promise.ts +24 -24
- package/src/lookup/mdc-lookup-configuration.ts +11 -11
- package/src/lookup/mdc-lookup.html +27 -27
- package/src/lookup/mdc-lookup.ts +5 -5
- package/src/mdc-configuration.ts +2 -0
- package/src/menu/mdc-menu-selection-group-icon.ts +11 -11
- package/src/menu/mdc-menu-selection-group.ts +4 -4
- package/src/menu/mdc-menu.html +6 -6
- package/src/menu-surface/mdc-menu-surface-anchor.ts +12 -12
- package/src/menu-surface/mdc-menu-surface.ts +275 -275
- package/src/notched-outline/mdc-notched-outline.html +7 -7
- package/src/notched-outline/mdc-notched-outline.ts +60 -60
- package/src/radio/mdc-radio.html +9 -9
- package/src/radio/mdc-radio.ts +162 -162
- package/src/resource.d.ts +22 -22
- package/src/ripple/mdc-ripple.ts +114 -114
- package/src/segmented-button/mdc-segmented-button-segment/enhance-mdc-segmented-button-segment.ts +8 -8
- package/src/segmented-button/mdc-segmented-button-segment/mdc-segmented-button-segment.html +11 -11
- package/src/segmented-button/mdc-segmented-button.html +3 -3
- package/src/segmented-button/mdc-segmented-button.ts +89 -89
- package/src/select/mdc-default-select-configuration.ts +3 -3
- package/src/select/mdc-select-adapter-aurelia.ts +213 -213
- package/src/select/mdc-select-foundation-aurelia.ts +484 -484
- package/src/select/mdc-select-helper-text/mdc-select-helper-text.html +7 -7
- package/src/select/mdc-select-helper-text/mdc-select-helper-text.ts +55 -55
- package/src/select/mdc-select-icon.ts +41 -41
- package/src/select/mdc-select-value-observer.ts +347 -346
- package/src/select/mdc-select.html +38 -38
- package/src/select/mdc-select.ts +480 -480
- package/src/slider/mdc-slider-foundation-aurelia.ts +13 -13
- package/src/slider/mdc-slider.html +36 -36
- package/src/slider/mdc-slider.ts +409 -409
- package/src/slider/styles/_index.scss +1 -1
- package/src/slider/styles/mdc-slider.import.scss +1 -1
- package/src/slider/styles/mdc-slider.scss +8 -8
- package/src/snackbar/mdc-snackbar-service.ts +48 -48
- package/src/snackbar/mdc-snackbar.html +14 -14
- package/src/snackbar/mdc-snackbar.ts +109 -109
- package/src/switch/enhance-mdc-switch.ts +8 -8
- package/src/switch/mdc-switch.html +21 -21
- package/src/switch/mdc-switch.ts +86 -86
- package/src/tab-bar/indicator/mdc-tab-indicator.html +9 -9
- package/src/tab-bar/indicator/mdc-tab-indicator.ts +51 -51
- package/src/tab-bar/mdc-tab-bar.html +6 -6
- package/src/tab-bar/mdc-tab-bar.ts +119 -119
- package/src/tab-bar/scroller/mdc-tab-scroller.html +11 -11
- package/src/tab-bar/scroller/mdc-tab-scroller.ts +85 -85
- package/src/tab-bar/tab/mdc-tab.html +20 -20
- package/src/tab-bar/tab/mdc-tab.ts +118 -118
- package/src/text-field/enhance-mdc-text-field.ts +12 -12
- package/src/text-field/mdc-default-text-field-configuration.ts +3 -3
- package/src/text-field/mdc-inputmask.ts +45 -0
- package/src/text-field/mdc-text-field-character-counter.ts +32 -32
- package/src/text-field/mdc-text-field-helper-line/mdc-text-field-helper-line.html +7 -7
- package/src/text-field/mdc-text-field-helper-line/mdc-text-field-helper-line.ts +37 -37
- package/src/text-field/mdc-text-field-helper-text/mdc-text-field-helper-text.html +6 -6
- package/src/text-field/mdc-text-field-helper-text/mdc-text-field-helper-text.ts +47 -47
- package/src/text-field/mdc-text-field-icon.ts +59 -59
- package/src/text-field/mdc-text-field.html +29 -29
- package/src/text-field/mdc-text-field.ts +535 -535
- package/src/tooltip/mdc-default-tooltip-configuration.ts +5 -5
- package/src/tooltip/mdc-tooltip-attribute.ts +118 -118
- package/src/tooltip/mdc-tooltip.html +7 -7
- package/src/tooltip/mdc-tooltip.ts +6 -6
- package/src/top-app-bar/enhance-top-app-bar-actions.ts +9 -9
- package/src/top-app-bar/mdc-top-app-bar-action-item.ts +12 -12
- package/src/top-app-bar/mdc-top-app-bar-fixed-adjust.ts +13 -13
- package/src/top-app-bar/mdc-top-app-bar-nav-icon.ts +12 -12
- package/src/top-app-bar/mdc-top-app-bar-row.ts +7 -7
- package/src/top-app-bar/mdc-top-app-bar-section/mdc-top-app-bar-section.html +3 -3
- package/src/top-app-bar/mdc-top-app-bar-section/mdc-top-app-bar-section.ts +9 -9
- package/src/top-app-bar/mdc-top-app-bar-title.ts +7 -7
- package/src/top-app-bar/mdc-top-app-bar.html +9 -9
- package/src/top-app-bar/mdc-top-app-bar.ts +93 -93
- package/src/tree-view/i-tree-node.ts +8 -8
- package/src/tree-view/mdc-tree-node-meta.ts +11 -11
- package/src/tree-view/mdc-tree-node.ts +4 -4
- package/src/tree-view/node-filter.ts +12 -12
- package/src/tree-view/styles/_index.scss +1 -1
- package/src/tree-view/styles/_mixins.scss +145 -145
- package/src/tree-view/styles/_variables.scss +8 -8
- package/src/tree-view/styles/mdc-tree-view.import.scss +1 -1
- package/src/tree-view/styles/mdc-tree-view.scss +3 -3
- package/src/typography/mdc-typography.ts +130 -130
- package/src/validation/mdc-validation-controller-factory.ts +20 -20
- package/src/validation/mdc-validation-result-presenter.ts +36 -36
- package/src/validation/validate.ts +32 -0
- package/styles/mdc-all.scss +53 -52
- package/src/banner/doc/api.json +0 -1106
- package/src/base/doc/api.json +0 -1408
- package/src/button/doc/api.json +0 -621
- package/src/card/doc/api.json +0 -214
- package/src/checkbox/doc/api.json +0 -1320
- package/src/chips/doc/api.json +0 -2533
- package/src/circular-progress/doc/api.json +0 -1085
- package/src/data-table/doc/api.json +0 -2064
- package/src/dialog/doc/api.json +0 -1667
- package/src/drawer/doc/api.json +0 -1416
- package/src/elevation/doc/api.json +0 -317
- package/src/expandable/doc/api.json +0 -677
- package/src/fab/doc/api.json +0 -396
- package/src/floating-label/doc/api.json +0 -914
- package/src/form-field/doc/api.json +0 -948
- package/src/icon/doc/api.json +0 -224
- package/src/icon-button/doc/api.json +0 -1109
- package/src/image-list/doc/api.json +0 -438
- package/src/layout-grid/doc/api.json +0 -600
- package/src/line-ripple/doc/api.json +0 -857
- package/src/linear-progress/doc/api.json +0 -949
- package/src/list/doc/api.json +0 -5725
- package/src/lookup/doc/api.json +0 -2370
- package/src/menu/doc/api.json +0 -2246
- package/src/menu-surface/doc/api.json +0 -1800
- package/src/notched-outline/doc/api.json +0 -943
- package/src/radio/doc/api.json +0 -1159
- package/src/ripple/doc/api.json +0 -1212
- package/src/segmented-button/doc/api.json +0 -1937
- package/src/select/doc/api.json +0 -4247
- package/src/slider/doc/api.json +0 -1954
- package/src/snackbar/doc/api.json +0 -1699
- package/src/switch/doc/api.json +0 -899
- package/src/tab-bar/doc/api.json +0 -4253
- package/src/text-field/doc/api.json +0 -3179
- package/src/tooltip/doc/api.json +0 -2531
- package/src/top-app-bar/doc/api.json +0 -1752
- package/src/tree-view/doc/api.json +0 -1710
- package/src/typography/doc/api.json +0 -3058
- package/src/validation/doc/api.json +0 -371
|
@@ -1,535 +1,535 @@
|
|
|
1
|
-
import { inject, customElement, INode, bindable } from 'aurelia';
|
|
2
|
-
import {
|
|
3
|
-
MDCTextFieldFoundation, MDCTextFieldRootAdapter, MDCTextFieldInputAdapter, MDCTextFieldLabelAdapter, MDCTextFieldAdapter, MDCTextFieldFoundationMap,
|
|
4
|
-
MDCTextFieldLineRippleAdapter, MDCTextFieldOutlineAdapter, cssClasses, helperTextStrings, characterCountStrings
|
|
5
|
-
} from '@material/textfield';
|
|
6
|
-
import { applyPassive } from '@material/dom/events';
|
|
7
|
-
import { MdcComponent, IValidatedElement, IError, booleanAttr, number } from '../base';
|
|
8
|
-
import { MdcTextFieldIcon, mdcIconStrings, IMdcTextFieldIconElement } from './mdc-text-field-icon';
|
|
9
|
-
import { MdcTextFieldHelperText } from './mdc-text-field-helper-text/mdc-text-field-helper-text';
|
|
10
|
-
import { MdcTextFieldCharacterCounter } from './mdc-text-field-character-counter';
|
|
11
|
-
import { MdcTextFieldHelperLine } from './mdc-text-field-helper-line/mdc-text-field-helper-line';
|
|
12
|
-
import { processContent, IPlatform, CustomAttribute, CustomElement } from '@aurelia/runtime-html';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
let textFieldId = 0;
|
|
20
|
-
const leadingIconSelector = '.mdc-text-field__icon--leading';
|
|
21
|
-
const trailingIconSelector = '.mdc-text-field__icon--trailing';
|
|
22
|
-
|
|
23
|
-
@inject(Element, IPlatform,
|
|
24
|
-
@customElement({ name: 'mdc-text-field', template })
|
|
25
|
-
@processContent(function processContent(node: INode) {
|
|
26
|
-
const element = node as HTMLElement;
|
|
27
|
-
// move icons to slots - this allows omitting slot specification
|
|
28
|
-
const leadingIcon = element.querySelector(`[${mdcIconStrings.ATTRIBUTE}][${mdcIconStrings.LEADING}]`);
|
|
29
|
-
leadingIcon?.setAttribute('au-slot', 'leading-icon');
|
|
30
|
-
const trailingIcon = element.querySelector(`[${mdcIconStrings.ATTRIBUTE}][${mdcIconStrings.TRAILING}]`);
|
|
31
|
-
trailingIcon?.setAttribute('au-slot', 'trailing-icon');
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
export class MdcTextField extends MdcComponent<MDCTextFieldFoundation> {
|
|
35
|
-
constructor(root: HTMLElement, private platform: IPlatform, private
|
|
36
|
-
super(root);
|
|
37
|
-
this.outlined = this.
|
|
38
|
-
defineMdcTextFieldElementApis(this.root);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
id: string = `mdc-text-field-${++textFieldId}`;
|
|
42
|
-
id1: string = `mdc-text-field-${textFieldId}`;
|
|
43
|
-
input_: HTMLInputElement;
|
|
44
|
-
label_?: MdcFloatingLabel = undefined;
|
|
45
|
-
lineRipple_: MdcLineRipple;
|
|
46
|
-
outline_!: MdcNotchedOutline | null; // assigned in html
|
|
47
|
-
helperText_: MdcTextFieldHelperText | undefined;
|
|
48
|
-
characterCounter_?: MdcTextFieldCharacterCounter;
|
|
49
|
-
errors = new Map<IError, boolean>();
|
|
50
|
-
leadingIcon_: MdcTextFieldIcon | undefined;
|
|
51
|
-
trailingIcon_: MdcTextFieldIcon | undefined;
|
|
52
|
-
mutationObserver = new MutationObserver(mutations => this.mutated(mutations));
|
|
53
|
-
|
|
54
|
-
@bindable()
|
|
55
|
-
label: string;
|
|
56
|
-
labelChanged() {
|
|
57
|
-
this.platform.domQueue.queueTask(() => {
|
|
58
|
-
if (this.foundation) {
|
|
59
|
-
const openNotch = this.foundation.shouldFloat;
|
|
60
|
-
this.foundation.notchOutline(openNotch);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@bindable({ set: booleanAttr })
|
|
66
|
-
textarea: boolean;
|
|
67
|
-
|
|
68
|
-
@bindable({ set: booleanAttr })
|
|
69
|
-
endAligned: boolean;
|
|
70
|
-
|
|
71
|
-
@bindable({ set: booleanAttr })
|
|
72
|
-
ltrText: boolean;
|
|
73
|
-
|
|
74
|
-
@bindable({ set: booleanAttr })
|
|
75
|
-
outlined?: boolean;
|
|
76
|
-
|
|
77
|
-
@bindable()
|
|
78
|
-
prefix: string;
|
|
79
|
-
|
|
80
|
-
@bindable()
|
|
81
|
-
suffix: string;
|
|
82
|
-
|
|
83
|
-
@bindable({ set: booleanAttr })
|
|
84
|
-
required?: boolean;
|
|
85
|
-
requiredChanged() {
|
|
86
|
-
if (this.required !== undefined) {
|
|
87
|
-
this.input_.required = this.required;
|
|
88
|
-
this.foundation?.setUseNativeValidation(true);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@bindable({ set: booleanAttr })
|
|
93
|
-
disabled: boolean;
|
|
94
|
-
disabledChanged() {
|
|
95
|
-
this.input_.disabled = this.disabled;
|
|
96
|
-
this.foundation?.setDisabled(this.disabled);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@bindable({ set: booleanAttr })
|
|
100
|
-
readonly: boolean;
|
|
101
|
-
readonlyChanged() {
|
|
102
|
-
this.input_.readOnly = this.readonly;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** Makes the element blur on Enter key press */
|
|
106
|
-
@bindable({ set: booleanAttr })
|
|
107
|
-
blurOnEnter: boolean;
|
|
108
|
-
|
|
109
|
-
@bindable()
|
|
110
|
-
maxlength: string;
|
|
111
|
-
maxlengthChanged() {
|
|
112
|
-
if (this.maxlength) {
|
|
113
|
-
this.input_.setAttribute('maxlength', this.maxlength);
|
|
114
|
-
} else {
|
|
115
|
-
this.input_.removeAttribute('maxlength');
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@bindable()
|
|
120
|
-
rows: string;
|
|
121
|
-
rowsChanged() {
|
|
122
|
-
if (this.rows) {
|
|
123
|
-
this.input_.setAttribute('rows', this.rows);
|
|
124
|
-
} else {
|
|
125
|
-
this.input_.removeAttribute('rows');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@bindable()
|
|
130
|
-
cols: string;
|
|
131
|
-
colsChanged() {
|
|
132
|
-
if (this.rows) {
|
|
133
|
-
this.input_.setAttribute('cols', this.cols);
|
|
134
|
-
} else {
|
|
135
|
-
this.input_.removeAttribute('cols');
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@bindable()
|
|
140
|
-
max: string;
|
|
141
|
-
maxChanged() {
|
|
142
|
-
if (this.max === undefined) {
|
|
143
|
-
this.input_.removeAttribute('max');
|
|
144
|
-
} else {
|
|
145
|
-
this.input_.max = this.max;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
@bindable()
|
|
150
|
-
min: string;
|
|
151
|
-
minChanged() {
|
|
152
|
-
if (this.min === undefined) {
|
|
153
|
-
this.input_.removeAttribute('min');
|
|
154
|
-
} else {
|
|
155
|
-
this.input_.min = this.min;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
@bindable()
|
|
160
|
-
step: string;
|
|
161
|
-
stepChanged() {
|
|
162
|
-
if (this.step === undefined) {
|
|
163
|
-
this.input_.removeAttribute('step');
|
|
164
|
-
} else {
|
|
165
|
-
this.input_.step = this.step;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
@bindable()
|
|
170
|
-
autocomplete: AutoFill;
|
|
171
|
-
autocompleteChanged() {
|
|
172
|
-
if (this.autocomplete === undefined) {
|
|
173
|
-
this.input_.removeAttribute('autocomplete');
|
|
174
|
-
} else {
|
|
175
|
-
this.input_.autocomplete = this.autocomplete;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@bindable({ set: number })
|
|
180
|
-
tabindex: number;
|
|
181
|
-
tabindexChanged() {
|
|
182
|
-
if (isNaN(this.tabindex)) {
|
|
183
|
-
this.input_.removeAttribute('tabindex');
|
|
184
|
-
} else {
|
|
185
|
-
this.input_.tabIndex = this.tabindex;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
@bindable()
|
|
190
|
-
type: string;
|
|
191
|
-
typeChanged() {
|
|
192
|
-
if (!this.textarea) {
|
|
193
|
-
if (this.type === undefined) {
|
|
194
|
-
this.input_.removeAttribute('type');
|
|
195
|
-
} else {
|
|
196
|
-
this.input_.type = this.type;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
@bindable()
|
|
202
|
-
name: string;
|
|
203
|
-
nameChanged() {
|
|
204
|
-
if (this.name === undefined) {
|
|
205
|
-
this.input_.removeAttribute('name');
|
|
206
|
-
} else {
|
|
207
|
-
this.input_.name = this.name;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
@bindable()
|
|
212
|
-
placeholder: string = ' '; // non empty placeholder solves the issue of misplaced labels in Safari
|
|
213
|
-
|
|
214
|
-
private initialValue: string;
|
|
215
|
-
get value(): string {
|
|
216
|
-
if (this.foundation) {
|
|
217
|
-
return this.foundation.getValue();
|
|
218
|
-
} else {
|
|
219
|
-
return this.initialValue;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
set value(value: string) {
|
|
223
|
-
if (this.foundation) {
|
|
224
|
-
if (this.foundation.getValue() !== value) {
|
|
225
|
-
this.foundation.setValue(value === null || value === undefined ? '' : value.toString());
|
|
226
|
-
}
|
|
227
|
-
} else {
|
|
228
|
-
this.initialValue = value;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
addError(error: IError) {
|
|
233
|
-
this.errors.set(error, true);
|
|
234
|
-
this.valid = false;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
removeError(error: IError) {
|
|
238
|
-
this.errors.delete(error);
|
|
239
|
-
this.valid = this.errors.size === 0;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
get valid(): boolean {
|
|
243
|
-
return this.foundation?.isValid() ?? true;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
set valid(value: boolean) {
|
|
247
|
-
this.foundation?.setUseNativeValidation(false);
|
|
248
|
-
this.foundation?.setValid(value);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
renderErrors() {
|
|
252
|
-
const helperLine = this.root.nextElementSibling;
|
|
253
|
-
if (helperLine?.tagName === 'MDC-TEXT-FIELD-HELPER-LINE') {
|
|
254
|
-
CustomElement.for<MdcTextFieldHelperLine>(helperLine).viewModel.errors = Array.from(this.errors.keys())
|
|
255
|
-
.filter(x => x.message !== null).map(x => x.message!);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
async attaching() {
|
|
260
|
-
const nextSibling = this.root.nextElementSibling;
|
|
261
|
-
if (nextSibling?.tagName === cssClasses.HELPER_LINE.toUpperCase()) {
|
|
262
|
-
await CustomElement.for<MdcTextFieldHelperLine>(nextSibling).viewModel.attachedPromise;
|
|
263
|
-
const helperTextEl = nextSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
|
|
264
|
-
this.helperText_ = helperTextEl ? CustomElement.for<MdcTextFieldHelperText>(nextSibling).viewModel : undefined;
|
|
265
|
-
const characterCounterEl = nextSibling.querySelector(characterCountStrings.ROOT_SELECTOR);
|
|
266
|
-
this.characterCounter_ = characterCounterEl ? CustomElement.for<MdcTextFieldCharacterCounter>(characterCounterEl).viewModel : undefined;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
beforeFoundationCreated() {
|
|
271
|
-
this.maxlengthChanged();
|
|
272
|
-
this.typeChanged();
|
|
273
|
-
this.mutationObserver.observe(this.root, { subtree: true, childList: true });
|
|
274
|
-
this.leadingIconChanged();
|
|
275
|
-
this.trailingIconChanged();
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
mutated(mutations: MutationRecord[]) {
|
|
279
|
-
if (mutations.find(x => [...Array.from(x.addedNodes), ...Array.from(x.removedNodes)].find(y => y instanceof HTMLElement && y.matches(leadingIconSelector)))) {
|
|
280
|
-
this.leadingIconChanged();
|
|
281
|
-
}
|
|
282
|
-
if (mutations.find(x => [...Array.from(x.addedNodes), ...Array.from(x.removedNodes)].find(y => y instanceof HTMLElement && y.matches(trailingIconSelector)))) {
|
|
283
|
-
this.trailingIconChanged();
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
trailingIconChanged() {
|
|
288
|
-
const el = this.root.querySelector<IMdcTextFieldIconElement>(trailingIconSelector);
|
|
289
|
-
this.trailingIcon_ = el ? CustomAttribute.for<MdcTextFieldIcon>(el, mdcIconStrings.ATTRIBUTE)?.viewModel : undefined;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
leadingIconChanged() {
|
|
293
|
-
const el = this.root.querySelector<IMdcTextFieldIconElement>(leadingIconSelector);
|
|
294
|
-
this.leadingIcon_ = el ? CustomAttribute.for<MdcTextFieldIcon>(el, mdcIconStrings.ATTRIBUTE)?.viewModel : undefined;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
override destroy() {
|
|
298
|
-
this.mutationObserver.disconnect();
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
initialSyncWithDOM() {
|
|
302
|
-
this.value = this.initialValue;
|
|
303
|
-
this.errors = new Map<IError, boolean>();
|
|
304
|
-
this.valid = true;
|
|
305
|
-
|
|
306
|
-
this.requiredChanged();
|
|
307
|
-
this.disabledChanged();
|
|
308
|
-
this.readonlyChanged();
|
|
309
|
-
this.tabindexChanged();
|
|
310
|
-
this.rowsChanged();
|
|
311
|
-
this.colsChanged();
|
|
312
|
-
this.minChanged();
|
|
313
|
-
this.maxChanged();
|
|
314
|
-
this.stepChanged();
|
|
315
|
-
this.autocompleteChanged();
|
|
316
|
-
this.nameChanged();
|
|
317
|
-
// handle the case when attribute value was set, not bound, in html
|
|
318
|
-
if (this.root.hasAttribute('value')) {
|
|
319
|
-
this.value = this.root.getAttribute('value') ?? '';
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
getDefaultFoundation() {
|
|
324
|
-
const adapter: Partial<MDCTextFieldAdapter> = {
|
|
325
|
-
...this.getRootAdapterMethods_(),
|
|
326
|
-
...this.getInputAdapterMethods_(),
|
|
327
|
-
...this.getLabelAdapterMethods_(),
|
|
328
|
-
...this.getLineRippleAdapterMethods_(),
|
|
329
|
-
...this.getOutlineAdapterMethods_(),
|
|
330
|
-
};
|
|
331
|
-
return new MDCTextFieldFoundation(adapter, this.getFoundationMap_());
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
private getRootAdapterMethods_(): MDCTextFieldRootAdapter {
|
|
335
|
-
return {
|
|
336
|
-
addClass: (className) => this.root.classList.add(className),
|
|
337
|
-
removeClass: (className) => this.root.classList.remove(className),
|
|
338
|
-
hasClass: (className) => this.root.classList.contains(className),
|
|
339
|
-
registerTextFieldInteractionHandler: (evtType, handler) => this.listen(evtType, handler),
|
|
340
|
-
deregisterTextFieldInteractionHandler: (evtType, handler) => this.unlisten(evtType, handler),
|
|
341
|
-
registerValidationAttributeChangeHandler: (handler) => {
|
|
342
|
-
const getAttributesList = (mutationsList: MutationRecord[]): string[] => {
|
|
343
|
-
return mutationsList
|
|
344
|
-
.map((mutation) => mutation.attributeName)
|
|
345
|
-
.filter((attributeName) => attributeName) as string[];
|
|
346
|
-
};
|
|
347
|
-
const observer = new MutationObserver((mutationsList) => handler(getAttributesList(mutationsList)));
|
|
348
|
-
const config = { attributes: true };
|
|
349
|
-
observer.observe(this.input_, config);
|
|
350
|
-
return observer;
|
|
351
|
-
},
|
|
352
|
-
deregisterValidationAttributeChangeHandler: (observer) => observer.disconnect(),
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
private getInputAdapterMethods_(): MDCTextFieldInputAdapter {
|
|
357
|
-
return {
|
|
358
|
-
getNativeInput: () => this.input_,
|
|
359
|
-
setInputAttr: (attr, value) => {
|
|
360
|
-
this.input_.setAttribute(attr, value);
|
|
361
|
-
},
|
|
362
|
-
removeInputAttr: (attr) => {
|
|
363
|
-
this.input_.removeAttribute(attr);
|
|
364
|
-
},
|
|
365
|
-
isFocused: () => document.activeElement === this.input_,
|
|
366
|
-
registerInputInteractionHandler: (evtType, handler) => this.input_.addEventListener(evtType, handler, applyPassive()),
|
|
367
|
-
deregisterInputInteractionHandler: (evtType, handler) => this.input_?.removeEventListener(evtType, handler, applyPassive()),
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
private getLabelAdapterMethods_(): MDCTextFieldLabelAdapter {
|
|
372
|
-
return {
|
|
373
|
-
floatLabel: (shouldFloat) => this.label_?.float(shouldFloat),
|
|
374
|
-
getLabelWidth: () => this.label_ ? this.label_.getWidth() : 0,
|
|
375
|
-
hasLabel: () => Boolean(this.label_),
|
|
376
|
-
shakeLabel: (shouldShake) => this.label_?.shake(shouldShake),
|
|
377
|
-
setLabelRequired: (isRequired) => this.label_?.setRequired(isRequired),
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
private getLineRippleAdapterMethods_(): MDCTextFieldLineRippleAdapter {
|
|
382
|
-
return {
|
|
383
|
-
activateLineRipple: () => this.lineRipple_?.activate(),
|
|
384
|
-
deactivateLineRipple: () => this.lineRipple_?.deactivate(),
|
|
385
|
-
setLineRippleTransformOrigin: (normalizedX) => this.lineRipple_?.setRippleCenter(normalizedX)
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
private getOutlineAdapterMethods_(): MDCTextFieldOutlineAdapter {
|
|
390
|
-
return {
|
|
391
|
-
closeOutline: () => this.outline_?.closeNotch(),
|
|
392
|
-
hasOutline: () => Boolean(this.outline_),
|
|
393
|
-
notchOutline: (labelWidth) => this.outline_?.notch(labelWidth),
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* @return A map of all subcomponents to subfoundations.
|
|
399
|
-
*/
|
|
400
|
-
private getFoundationMap_(): Partial<MDCTextFieldFoundationMap> {
|
|
401
|
-
return {
|
|
402
|
-
characterCounter: this.characterCounter_ ? this.characterCounter_?.foundationForTextField : undefined,
|
|
403
|
-
helperText: this.helperText_ ? this.helperText_.foundationForTextField : undefined,
|
|
404
|
-
leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundationForTextField : undefined,
|
|
405
|
-
trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundationForTextField : undefined,
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
onInput(evt: Event): void {
|
|
410
|
-
const value = (evt.target as HTMLInputElement).value;
|
|
411
|
-
this.value = value;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
onFocus() {
|
|
415
|
-
this.foundation?.activateFocus();
|
|
416
|
-
this.emit('focus', {}, true);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
onChange(evt: Event): void {
|
|
420
|
-
const value = (evt.target as HTMLInputElement).value;
|
|
421
|
-
this.value = value;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
onBlur(): void {
|
|
425
|
-
this.foundation?.deactivateFocus();
|
|
426
|
-
this.emit('blur', {}, true);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
focus() {
|
|
430
|
-
this.input_.focus();
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
blur() {
|
|
434
|
-
this.input_.blur();
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
onKeyup(e: KeyboardEvent) {
|
|
438
|
-
if (this.blurOnEnter && e.keyCode === 13) {
|
|
439
|
-
this.blur();
|
|
440
|
-
}
|
|
441
|
-
return true;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/** @hidden */
|
|
446
|
-
export interface IMdcTextFieldElement extends IValidatedElement {
|
|
447
|
-
$au: {
|
|
448
|
-
'au:resource:custom-element': {
|
|
449
|
-
viewModel: MdcTextField;
|
|
450
|
-
};
|
|
451
|
-
};
|
|
452
|
-
value: string;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function defineMdcTextFieldElementApis(element: HTMLElement) {
|
|
456
|
-
Object.defineProperties(element, {
|
|
457
|
-
tagName: {
|
|
458
|
-
get() {
|
|
459
|
-
return 'MDC-TEXT-FIELD';
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
value: {
|
|
463
|
-
get(this: IMdcTextFieldElement) {
|
|
464
|
-
return CustomElement.for<MdcTextField>(this).viewModel.value;
|
|
465
|
-
},
|
|
466
|
-
set(this: IMdcTextFieldElement, value: string) {
|
|
467
|
-
CustomElement.for<MdcTextField>(this).viewModel.value = value;
|
|
468
|
-
},
|
|
469
|
-
configurable: true
|
|
470
|
-
},
|
|
471
|
-
disabled: {
|
|
472
|
-
get(this: IMdcTextFieldElement) {
|
|
473
|
-
return CustomElement.for<MdcTextField>(this).viewModel.disabled;
|
|
474
|
-
},
|
|
475
|
-
set(this: IMdcTextFieldElement, value: boolean) {
|
|
476
|
-
CustomElement.for<MdcTextField>(this).viewModel.disabled = value;
|
|
477
|
-
},
|
|
478
|
-
configurable: true
|
|
479
|
-
},
|
|
480
|
-
readOnly: {
|
|
481
|
-
get(this: IMdcTextFieldElement) {
|
|
482
|
-
return CustomElement.for<MdcTextField>(this).viewModel.readonly;
|
|
483
|
-
},
|
|
484
|
-
set(this: IMdcTextFieldElement, value: boolean) {
|
|
485
|
-
CustomElement.for<MdcTextField>(this).viewModel.readonly = value;
|
|
486
|
-
},
|
|
487
|
-
configurable: true
|
|
488
|
-
},
|
|
489
|
-
valid: {
|
|
490
|
-
get(this: IMdcTextFieldElement) {
|
|
491
|
-
return CustomElement.for<MdcTextField>(this).viewModel.valid;
|
|
492
|
-
},
|
|
493
|
-
set(this: IMdcTextFieldElement, value: boolean) {
|
|
494
|
-
CustomElement.for<MdcTextField>(this).viewModel.valid = value;
|
|
495
|
-
},
|
|
496
|
-
configurable: true
|
|
497
|
-
},
|
|
498
|
-
addError: {
|
|
499
|
-
value(this: IMdcTextFieldElement, error: IError) {
|
|
500
|
-
CustomElement.for<MdcTextField>(this).viewModel.addError(error);
|
|
501
|
-
},
|
|
502
|
-
configurable: true
|
|
503
|
-
},
|
|
504
|
-
removeError: {
|
|
505
|
-
value(this: IMdcTextFieldElement, error: IError) {
|
|
506
|
-
CustomElement.for<MdcTextField>(this).viewModel.removeError(error);
|
|
507
|
-
},
|
|
508
|
-
configurable: true
|
|
509
|
-
},
|
|
510
|
-
renderErrors: {
|
|
511
|
-
value(this: IMdcTextFieldElement): void {
|
|
512
|
-
CustomElement.for<MdcTextField>(this).viewModel.renderErrors();
|
|
513
|
-
},
|
|
514
|
-
configurable: true
|
|
515
|
-
},
|
|
516
|
-
focus: {
|
|
517
|
-
value(this: IMdcTextFieldElement) {
|
|
518
|
-
CustomElement.for<MdcTextField>(this).viewModel.focus();
|
|
519
|
-
},
|
|
520
|
-
configurable: true
|
|
521
|
-
},
|
|
522
|
-
blur: {
|
|
523
|
-
value(this: IMdcTextFieldElement) {
|
|
524
|
-
CustomElement.for<MdcTextField>(this).viewModel.blur();
|
|
525
|
-
},
|
|
526
|
-
configurable: true
|
|
527
|
-
},
|
|
528
|
-
isFocused: {
|
|
529
|
-
get(this: IMdcTextFieldElement) {
|
|
530
|
-
return document.activeElement === CustomElement.for<MdcTextField>(this).viewModel.input_;
|
|
531
|
-
},
|
|
532
|
-
configurable: true
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
}
|
|
1
|
+
import { inject, customElement, INode, bindable } from 'aurelia';
|
|
2
|
+
import {
|
|
3
|
+
MDCTextFieldFoundation, MDCTextFieldRootAdapter, MDCTextFieldInputAdapter, MDCTextFieldLabelAdapter, MDCTextFieldAdapter, MDCTextFieldFoundationMap,
|
|
4
|
+
MDCTextFieldLineRippleAdapter, MDCTextFieldOutlineAdapter, cssClasses, helperTextStrings, characterCountStrings
|
|
5
|
+
} from '@material/textfield';
|
|
6
|
+
import { applyPassive } from '@material/dom/events';
|
|
7
|
+
import { MdcComponent, IValidatedElement, IError, booleanAttr, number } from '../base';
|
|
8
|
+
import { MdcTextFieldIcon, mdcIconStrings, IMdcTextFieldIconElement } from './mdc-text-field-icon';
|
|
9
|
+
import { MdcTextFieldHelperText } from './mdc-text-field-helper-text/mdc-text-field-helper-text';
|
|
10
|
+
import { MdcTextFieldCharacterCounter } from './mdc-text-field-character-counter';
|
|
11
|
+
import { MdcTextFieldHelperLine } from './mdc-text-field-helper-line/mdc-text-field-helper-line';
|
|
12
|
+
import { processContent, IPlatform, CustomAttribute, CustomElement } from '@aurelia/runtime-html';
|
|
13
|
+
import template from './mdc-text-field.html?raw';
|
|
14
|
+
import { MdcFloatingLabel } from '../floating-label/mdc-floating-label';
|
|
15
|
+
import { MdcLineRipple } from '../line-ripple/mdc-line-ripple';
|
|
16
|
+
import { MdcNotchedOutline } from '../notched-outline/mdc-notched-outline';
|
|
17
|
+
import { MdcConfiguration } from '../mdc-configuration';
|
|
18
|
+
|
|
19
|
+
let textFieldId = 0;
|
|
20
|
+
const leadingIconSelector = '.mdc-text-field__icon--leading';
|
|
21
|
+
const trailingIconSelector = '.mdc-text-field__icon--trailing';
|
|
22
|
+
|
|
23
|
+
@inject(Element, IPlatform, MdcConfiguration)
|
|
24
|
+
@customElement({ name: 'mdc-text-field', template })
|
|
25
|
+
@processContent(function processContent(node: INode) {
|
|
26
|
+
const element = node as HTMLElement;
|
|
27
|
+
// move icons to slots - this allows omitting slot specification
|
|
28
|
+
const leadingIcon = element.querySelector(`[${mdcIconStrings.ATTRIBUTE}][${mdcIconStrings.LEADING}]`);
|
|
29
|
+
leadingIcon?.setAttribute('au-slot', 'leading-icon');
|
|
30
|
+
const trailingIcon = element.querySelector(`[${mdcIconStrings.ATTRIBUTE}][${mdcIconStrings.TRAILING}]`);
|
|
31
|
+
trailingIcon?.setAttribute('au-slot', 'trailing-icon');
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
export class MdcTextField extends MdcComponent<MDCTextFieldFoundation> {
|
|
35
|
+
constructor(root: HTMLElement, private platform: IPlatform, private configuration: MdcConfiguration) {
|
|
36
|
+
super(root);
|
|
37
|
+
this.outlined = this.configuration.textField.outlined;
|
|
38
|
+
defineMdcTextFieldElementApis(this.root);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
id: string = `mdc-text-field-${++textFieldId}`;
|
|
42
|
+
id1: string = `mdc-text-field-${textFieldId}`;
|
|
43
|
+
input_: HTMLInputElement;
|
|
44
|
+
label_?: MdcFloatingLabel = undefined;
|
|
45
|
+
lineRipple_: MdcLineRipple;
|
|
46
|
+
outline_!: MdcNotchedOutline | null; // assigned in html
|
|
47
|
+
helperText_: MdcTextFieldHelperText | undefined;
|
|
48
|
+
characterCounter_?: MdcTextFieldCharacterCounter;
|
|
49
|
+
errors = new Map<IError, boolean>();
|
|
50
|
+
leadingIcon_: MdcTextFieldIcon | undefined;
|
|
51
|
+
trailingIcon_: MdcTextFieldIcon | undefined;
|
|
52
|
+
mutationObserver = new MutationObserver(mutations => this.mutated(mutations));
|
|
53
|
+
|
|
54
|
+
@bindable()
|
|
55
|
+
label: string;
|
|
56
|
+
labelChanged() {
|
|
57
|
+
this.platform.domQueue.queueTask(() => {
|
|
58
|
+
if (this.foundation) {
|
|
59
|
+
const openNotch = this.foundation.shouldFloat;
|
|
60
|
+
this.foundation.notchOutline(openNotch);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@bindable({ set: booleanAttr })
|
|
66
|
+
textarea: boolean;
|
|
67
|
+
|
|
68
|
+
@bindable({ set: booleanAttr })
|
|
69
|
+
endAligned: boolean;
|
|
70
|
+
|
|
71
|
+
@bindable({ set: booleanAttr })
|
|
72
|
+
ltrText: boolean;
|
|
73
|
+
|
|
74
|
+
@bindable({ set: booleanAttr })
|
|
75
|
+
outlined?: boolean;
|
|
76
|
+
|
|
77
|
+
@bindable()
|
|
78
|
+
prefix: string;
|
|
79
|
+
|
|
80
|
+
@bindable()
|
|
81
|
+
suffix: string;
|
|
82
|
+
|
|
83
|
+
@bindable({ set: booleanAttr })
|
|
84
|
+
required?: boolean;
|
|
85
|
+
requiredChanged() {
|
|
86
|
+
if (this.required !== undefined) {
|
|
87
|
+
this.input_.required = this.required;
|
|
88
|
+
this.foundation?.setUseNativeValidation(true);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@bindable({ set: booleanAttr })
|
|
93
|
+
disabled: boolean;
|
|
94
|
+
disabledChanged() {
|
|
95
|
+
this.input_.disabled = this.disabled;
|
|
96
|
+
this.foundation?.setDisabled(this.disabled);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@bindable({ set: booleanAttr })
|
|
100
|
+
readonly: boolean;
|
|
101
|
+
readonlyChanged() {
|
|
102
|
+
this.input_.readOnly = this.readonly;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Makes the element blur on Enter key press */
|
|
106
|
+
@bindable({ set: booleanAttr })
|
|
107
|
+
blurOnEnter: boolean;
|
|
108
|
+
|
|
109
|
+
@bindable()
|
|
110
|
+
maxlength: string;
|
|
111
|
+
maxlengthChanged() {
|
|
112
|
+
if (this.maxlength) {
|
|
113
|
+
this.input_.setAttribute('maxlength', this.maxlength);
|
|
114
|
+
} else {
|
|
115
|
+
this.input_.removeAttribute('maxlength');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@bindable()
|
|
120
|
+
rows: string;
|
|
121
|
+
rowsChanged() {
|
|
122
|
+
if (this.rows) {
|
|
123
|
+
this.input_.setAttribute('rows', this.rows);
|
|
124
|
+
} else {
|
|
125
|
+
this.input_.removeAttribute('rows');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@bindable()
|
|
130
|
+
cols: string;
|
|
131
|
+
colsChanged() {
|
|
132
|
+
if (this.rows) {
|
|
133
|
+
this.input_.setAttribute('cols', this.cols);
|
|
134
|
+
} else {
|
|
135
|
+
this.input_.removeAttribute('cols');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@bindable()
|
|
140
|
+
max: string;
|
|
141
|
+
maxChanged() {
|
|
142
|
+
if (this.max === undefined) {
|
|
143
|
+
this.input_.removeAttribute('max');
|
|
144
|
+
} else {
|
|
145
|
+
this.input_.max = this.max;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@bindable()
|
|
150
|
+
min: string;
|
|
151
|
+
minChanged() {
|
|
152
|
+
if (this.min === undefined) {
|
|
153
|
+
this.input_.removeAttribute('min');
|
|
154
|
+
} else {
|
|
155
|
+
this.input_.min = this.min;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@bindable()
|
|
160
|
+
step: string;
|
|
161
|
+
stepChanged() {
|
|
162
|
+
if (this.step === undefined) {
|
|
163
|
+
this.input_.removeAttribute('step');
|
|
164
|
+
} else {
|
|
165
|
+
this.input_.step = this.step;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@bindable()
|
|
170
|
+
autocomplete: AutoFill;
|
|
171
|
+
autocompleteChanged() {
|
|
172
|
+
if (this.autocomplete === undefined) {
|
|
173
|
+
this.input_.removeAttribute('autocomplete');
|
|
174
|
+
} else {
|
|
175
|
+
this.input_.autocomplete = this.autocomplete;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@bindable({ set: number })
|
|
180
|
+
tabindex: number;
|
|
181
|
+
tabindexChanged() {
|
|
182
|
+
if (isNaN(this.tabindex)) {
|
|
183
|
+
this.input_.removeAttribute('tabindex');
|
|
184
|
+
} else {
|
|
185
|
+
this.input_.tabIndex = this.tabindex;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@bindable()
|
|
190
|
+
type: string;
|
|
191
|
+
typeChanged() {
|
|
192
|
+
if (!this.textarea) {
|
|
193
|
+
if (this.type === undefined) {
|
|
194
|
+
this.input_.removeAttribute('type');
|
|
195
|
+
} else {
|
|
196
|
+
this.input_.type = this.type;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@bindable()
|
|
202
|
+
name: string;
|
|
203
|
+
nameChanged() {
|
|
204
|
+
if (this.name === undefined) {
|
|
205
|
+
this.input_.removeAttribute('name');
|
|
206
|
+
} else {
|
|
207
|
+
this.input_.name = this.name;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@bindable()
|
|
212
|
+
placeholder: string = ' '; // non empty placeholder solves the issue of misplaced labels in Safari
|
|
213
|
+
|
|
214
|
+
private initialValue: string;
|
|
215
|
+
get value(): string {
|
|
216
|
+
if (this.foundation) {
|
|
217
|
+
return this.foundation.getValue();
|
|
218
|
+
} else {
|
|
219
|
+
return this.initialValue;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
set value(value: string) {
|
|
223
|
+
if (this.foundation) {
|
|
224
|
+
if (this.foundation.getValue() !== value) {
|
|
225
|
+
this.foundation.setValue(value === null || value === undefined ? '' : value.toString());
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
this.initialValue = value;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
addError(error: IError) {
|
|
233
|
+
this.errors.set(error, true);
|
|
234
|
+
this.valid = false;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
removeError(error: IError) {
|
|
238
|
+
this.errors.delete(error);
|
|
239
|
+
this.valid = this.errors.size === 0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
get valid(): boolean {
|
|
243
|
+
return this.foundation?.isValid() ?? true;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
set valid(value: boolean) {
|
|
247
|
+
this.foundation?.setUseNativeValidation(false);
|
|
248
|
+
this.foundation?.setValid(value);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
renderErrors() {
|
|
252
|
+
const helperLine = this.root.nextElementSibling;
|
|
253
|
+
if (helperLine?.tagName === 'MDC-TEXT-FIELD-HELPER-LINE') {
|
|
254
|
+
CustomElement.for<MdcTextFieldHelperLine>(helperLine).viewModel.errors = Array.from(this.errors.keys())
|
|
255
|
+
.filter(x => x.message !== null).map(x => x.message!);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
async attaching() {
|
|
260
|
+
const nextSibling = this.root.nextElementSibling;
|
|
261
|
+
if (nextSibling?.tagName === cssClasses.HELPER_LINE.toUpperCase()) {
|
|
262
|
+
await CustomElement.for<MdcTextFieldHelperLine>(nextSibling).viewModel.attachedPromise;
|
|
263
|
+
const helperTextEl = nextSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
|
|
264
|
+
this.helperText_ = helperTextEl ? CustomElement.for<MdcTextFieldHelperText>(nextSibling).viewModel : undefined;
|
|
265
|
+
const characterCounterEl = nextSibling.querySelector(characterCountStrings.ROOT_SELECTOR);
|
|
266
|
+
this.characterCounter_ = characterCounterEl ? CustomElement.for<MdcTextFieldCharacterCounter>(characterCounterEl).viewModel : undefined;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
beforeFoundationCreated() {
|
|
271
|
+
this.maxlengthChanged();
|
|
272
|
+
this.typeChanged();
|
|
273
|
+
this.mutationObserver.observe(this.root, { subtree: true, childList: true });
|
|
274
|
+
this.leadingIconChanged();
|
|
275
|
+
this.trailingIconChanged();
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
mutated(mutations: MutationRecord[]) {
|
|
279
|
+
if (mutations.find(x => [...Array.from(x.addedNodes), ...Array.from(x.removedNodes)].find(y => y instanceof HTMLElement && y.matches(leadingIconSelector)))) {
|
|
280
|
+
this.leadingIconChanged();
|
|
281
|
+
}
|
|
282
|
+
if (mutations.find(x => [...Array.from(x.addedNodes), ...Array.from(x.removedNodes)].find(y => y instanceof HTMLElement && y.matches(trailingIconSelector)))) {
|
|
283
|
+
this.trailingIconChanged();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
trailingIconChanged() {
|
|
288
|
+
const el = this.root.querySelector<IMdcTextFieldIconElement>(trailingIconSelector);
|
|
289
|
+
this.trailingIcon_ = el ? CustomAttribute.for<MdcTextFieldIcon>(el, mdcIconStrings.ATTRIBUTE)?.viewModel : undefined;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
leadingIconChanged() {
|
|
293
|
+
const el = this.root.querySelector<IMdcTextFieldIconElement>(leadingIconSelector);
|
|
294
|
+
this.leadingIcon_ = el ? CustomAttribute.for<MdcTextFieldIcon>(el, mdcIconStrings.ATTRIBUTE)?.viewModel : undefined;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
override destroy() {
|
|
298
|
+
this.mutationObserver.disconnect();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
initialSyncWithDOM() {
|
|
302
|
+
this.value = this.initialValue;
|
|
303
|
+
this.errors = new Map<IError, boolean>();
|
|
304
|
+
this.valid = true;
|
|
305
|
+
|
|
306
|
+
this.requiredChanged();
|
|
307
|
+
this.disabledChanged();
|
|
308
|
+
this.readonlyChanged();
|
|
309
|
+
this.tabindexChanged();
|
|
310
|
+
this.rowsChanged();
|
|
311
|
+
this.colsChanged();
|
|
312
|
+
this.minChanged();
|
|
313
|
+
this.maxChanged();
|
|
314
|
+
this.stepChanged();
|
|
315
|
+
this.autocompleteChanged();
|
|
316
|
+
this.nameChanged();
|
|
317
|
+
// handle the case when attribute value was set, not bound, in html
|
|
318
|
+
if (this.root.hasAttribute('value')) {
|
|
319
|
+
this.value = this.root.getAttribute('value') ?? '';
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
getDefaultFoundation() {
|
|
324
|
+
const adapter: Partial<MDCTextFieldAdapter> = {
|
|
325
|
+
...this.getRootAdapterMethods_(),
|
|
326
|
+
...this.getInputAdapterMethods_(),
|
|
327
|
+
...this.getLabelAdapterMethods_(),
|
|
328
|
+
...this.getLineRippleAdapterMethods_(),
|
|
329
|
+
...this.getOutlineAdapterMethods_(),
|
|
330
|
+
};
|
|
331
|
+
return new MDCTextFieldFoundation(adapter, this.getFoundationMap_());
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
private getRootAdapterMethods_(): MDCTextFieldRootAdapter {
|
|
335
|
+
return {
|
|
336
|
+
addClass: (className) => this.root.classList.add(className),
|
|
337
|
+
removeClass: (className) => this.root.classList.remove(className),
|
|
338
|
+
hasClass: (className) => this.root.classList.contains(className),
|
|
339
|
+
registerTextFieldInteractionHandler: (evtType, handler) => this.listen(evtType, handler),
|
|
340
|
+
deregisterTextFieldInteractionHandler: (evtType, handler) => this.unlisten(evtType, handler),
|
|
341
|
+
registerValidationAttributeChangeHandler: (handler) => {
|
|
342
|
+
const getAttributesList = (mutationsList: MutationRecord[]): string[] => {
|
|
343
|
+
return mutationsList
|
|
344
|
+
.map((mutation) => mutation.attributeName)
|
|
345
|
+
.filter((attributeName) => attributeName) as string[];
|
|
346
|
+
};
|
|
347
|
+
const observer = new MutationObserver((mutationsList) => handler(getAttributesList(mutationsList)));
|
|
348
|
+
const config = { attributes: true };
|
|
349
|
+
observer.observe(this.input_, config);
|
|
350
|
+
return observer;
|
|
351
|
+
},
|
|
352
|
+
deregisterValidationAttributeChangeHandler: (observer) => observer.disconnect(),
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
private getInputAdapterMethods_(): MDCTextFieldInputAdapter {
|
|
357
|
+
return {
|
|
358
|
+
getNativeInput: () => this.input_,
|
|
359
|
+
setInputAttr: (attr, value) => {
|
|
360
|
+
this.input_.setAttribute(attr, value);
|
|
361
|
+
},
|
|
362
|
+
removeInputAttr: (attr) => {
|
|
363
|
+
this.input_.removeAttribute(attr);
|
|
364
|
+
},
|
|
365
|
+
isFocused: () => document.activeElement === this.input_,
|
|
366
|
+
registerInputInteractionHandler: (evtType, handler) => this.input_.addEventListener(evtType, handler, applyPassive()),
|
|
367
|
+
deregisterInputInteractionHandler: (evtType, handler) => this.input_?.removeEventListener(evtType, handler, applyPassive()),
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
private getLabelAdapterMethods_(): MDCTextFieldLabelAdapter {
|
|
372
|
+
return {
|
|
373
|
+
floatLabel: (shouldFloat) => this.label_?.float(shouldFloat),
|
|
374
|
+
getLabelWidth: () => this.label_ ? this.label_.getWidth() : 0,
|
|
375
|
+
hasLabel: () => Boolean(this.label_),
|
|
376
|
+
shakeLabel: (shouldShake) => this.label_?.shake(shouldShake),
|
|
377
|
+
setLabelRequired: (isRequired) => this.label_?.setRequired(isRequired),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
private getLineRippleAdapterMethods_(): MDCTextFieldLineRippleAdapter {
|
|
382
|
+
return {
|
|
383
|
+
activateLineRipple: () => this.lineRipple_?.activate(),
|
|
384
|
+
deactivateLineRipple: () => this.lineRipple_?.deactivate(),
|
|
385
|
+
setLineRippleTransformOrigin: (normalizedX) => this.lineRipple_?.setRippleCenter(normalizedX)
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
private getOutlineAdapterMethods_(): MDCTextFieldOutlineAdapter {
|
|
390
|
+
return {
|
|
391
|
+
closeOutline: () => this.outline_?.closeNotch(),
|
|
392
|
+
hasOutline: () => Boolean(this.outline_),
|
|
393
|
+
notchOutline: (labelWidth) => this.outline_?.notch(labelWidth),
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* @return A map of all subcomponents to subfoundations.
|
|
399
|
+
*/
|
|
400
|
+
private getFoundationMap_(): Partial<MDCTextFieldFoundationMap> {
|
|
401
|
+
return {
|
|
402
|
+
characterCounter: this.characterCounter_ ? this.characterCounter_?.foundationForTextField : undefined,
|
|
403
|
+
helperText: this.helperText_ ? this.helperText_.foundationForTextField : undefined,
|
|
404
|
+
leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundationForTextField : undefined,
|
|
405
|
+
trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundationForTextField : undefined,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
onInput(evt: Event): void {
|
|
410
|
+
const value = (evt.target as HTMLInputElement).value;
|
|
411
|
+
this.value = value;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
onFocus() {
|
|
415
|
+
this.foundation?.activateFocus();
|
|
416
|
+
this.emit('focus', {}, true);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
onChange(evt: Event): void {
|
|
420
|
+
const value = (evt.target as HTMLInputElement).value;
|
|
421
|
+
this.value = value;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
onBlur(): void {
|
|
425
|
+
this.foundation?.deactivateFocus();
|
|
426
|
+
this.emit('blur', {}, true);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
focus() {
|
|
430
|
+
this.input_.focus();
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
blur() {
|
|
434
|
+
this.input_.blur();
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
onKeyup(e: KeyboardEvent) {
|
|
438
|
+
if (this.blurOnEnter && e.keyCode === 13) {
|
|
439
|
+
this.blur();
|
|
440
|
+
}
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/** @hidden */
|
|
446
|
+
export interface IMdcTextFieldElement extends IValidatedElement {
|
|
447
|
+
$au: {
|
|
448
|
+
'au:resource:custom-element': {
|
|
449
|
+
viewModel: MdcTextField;
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
value: string;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function defineMdcTextFieldElementApis(element: HTMLElement) {
|
|
456
|
+
Object.defineProperties(element, {
|
|
457
|
+
tagName: {
|
|
458
|
+
get() {
|
|
459
|
+
return 'MDC-TEXT-FIELD';
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
value: {
|
|
463
|
+
get(this: IMdcTextFieldElement) {
|
|
464
|
+
return CustomElement.for<MdcTextField>(this).viewModel.value;
|
|
465
|
+
},
|
|
466
|
+
set(this: IMdcTextFieldElement, value: string) {
|
|
467
|
+
CustomElement.for<MdcTextField>(this).viewModel.value = value;
|
|
468
|
+
},
|
|
469
|
+
configurable: true
|
|
470
|
+
},
|
|
471
|
+
disabled: {
|
|
472
|
+
get(this: IMdcTextFieldElement) {
|
|
473
|
+
return CustomElement.for<MdcTextField>(this).viewModel.disabled;
|
|
474
|
+
},
|
|
475
|
+
set(this: IMdcTextFieldElement, value: boolean) {
|
|
476
|
+
CustomElement.for<MdcTextField>(this).viewModel.disabled = value;
|
|
477
|
+
},
|
|
478
|
+
configurable: true
|
|
479
|
+
},
|
|
480
|
+
readOnly: {
|
|
481
|
+
get(this: IMdcTextFieldElement) {
|
|
482
|
+
return CustomElement.for<MdcTextField>(this).viewModel.readonly;
|
|
483
|
+
},
|
|
484
|
+
set(this: IMdcTextFieldElement, value: boolean) {
|
|
485
|
+
CustomElement.for<MdcTextField>(this).viewModel.readonly = value;
|
|
486
|
+
},
|
|
487
|
+
configurable: true
|
|
488
|
+
},
|
|
489
|
+
valid: {
|
|
490
|
+
get(this: IMdcTextFieldElement) {
|
|
491
|
+
return CustomElement.for<MdcTextField>(this).viewModel.valid;
|
|
492
|
+
},
|
|
493
|
+
set(this: IMdcTextFieldElement, value: boolean) {
|
|
494
|
+
CustomElement.for<MdcTextField>(this).viewModel.valid = value;
|
|
495
|
+
},
|
|
496
|
+
configurable: true
|
|
497
|
+
},
|
|
498
|
+
addError: {
|
|
499
|
+
value(this: IMdcTextFieldElement, error: IError) {
|
|
500
|
+
CustomElement.for<MdcTextField>(this).viewModel.addError(error);
|
|
501
|
+
},
|
|
502
|
+
configurable: true
|
|
503
|
+
},
|
|
504
|
+
removeError: {
|
|
505
|
+
value(this: IMdcTextFieldElement, error: IError) {
|
|
506
|
+
CustomElement.for<MdcTextField>(this).viewModel.removeError(error);
|
|
507
|
+
},
|
|
508
|
+
configurable: true
|
|
509
|
+
},
|
|
510
|
+
renderErrors: {
|
|
511
|
+
value(this: IMdcTextFieldElement): void {
|
|
512
|
+
CustomElement.for<MdcTextField>(this).viewModel.renderErrors();
|
|
513
|
+
},
|
|
514
|
+
configurable: true
|
|
515
|
+
},
|
|
516
|
+
focus: {
|
|
517
|
+
value(this: IMdcTextFieldElement) {
|
|
518
|
+
CustomElement.for<MdcTextField>(this).viewModel.focus();
|
|
519
|
+
},
|
|
520
|
+
configurable: true
|
|
521
|
+
},
|
|
522
|
+
blur: {
|
|
523
|
+
value(this: IMdcTextFieldElement) {
|
|
524
|
+
CustomElement.for<MdcTextField>(this).viewModel.blur();
|
|
525
|
+
},
|
|
526
|
+
configurable: true
|
|
527
|
+
},
|
|
528
|
+
isFocused: {
|
|
529
|
+
get(this: IMdcTextFieldElement) {
|
|
530
|
+
return document.activeElement === CustomElement.for<MdcTextField>(this).viewModel.input_;
|
|
531
|
+
},
|
|
532
|
+
configurable: true
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|