@skyux/layout 5.7.2 → 6.0.0-beta.2
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/documentation.json +4 -4
- package/esm2020/index.mjs +74 -0
- package/esm2020/lib/modules/action-button/action-button-adapter-service.mjs +43 -0
- package/esm2020/lib/modules/action-button/action-button-container.component.mjs +139 -0
- package/esm2020/lib/modules/action-button/action-button-details.component.mjs +14 -0
- package/esm2020/lib/modules/action-button/action-button-header.component.mjs +15 -0
- package/esm2020/lib/modules/action-button/action-button-icon.component.mjs +40 -0
- package/esm2020/lib/modules/action-button/action-button-permalink.mjs +2 -0
- package/esm2020/lib/modules/action-button/action-button.component.mjs +34 -0
- package/esm2020/lib/modules/action-button/action-button.module.mjs +62 -0
- package/esm2020/lib/modules/action-button/types/action-button-container-align-items-type.mjs +2 -0
- package/esm2020/lib/modules/action-button/types/action-button-container-align-items.mjs +2 -0
- package/esm2020/lib/modules/back-to-top/back-to-top-adapter.service.mjs +84 -0
- package/esm2020/lib/modules/back-to-top/back-to-top.component.mjs +26 -0
- package/esm2020/lib/modules/back-to-top/back-to-top.directive.mjs +114 -0
- package/esm2020/lib/modules/back-to-top/back-to-top.module.mjs +35 -0
- package/esm2020/lib/modules/back-to-top/models/back-to-top-message-type.mjs +11 -0
- package/esm2020/lib/modules/back-to-top/models/back-to-top-message.mjs +2 -0
- package/esm2020/lib/modules/back-to-top/models/back-to-top-options.mjs +2 -0
- package/esm2020/lib/modules/box/box-content.component.mjs +15 -0
- package/esm2020/lib/modules/box/box-controls.component.mjs +14 -0
- package/esm2020/lib/modules/box/box-header.component.mjs +14 -0
- package/esm2020/lib/modules/box/box.component.mjs +21 -0
- package/esm2020/lib/modules/box/box.module.mjs +38 -0
- package/esm2020/lib/modules/card/card-actions.component.mjs +14 -0
- package/esm2020/lib/modules/card/card-content.component.mjs +14 -0
- package/esm2020/lib/modules/card/card-title.component.mjs +14 -0
- package/esm2020/lib/modules/card/card.component.mjs +75 -0
- package/esm2020/lib/modules/card/card.module.mjs +61 -0
- package/esm2020/lib/modules/definition-list/definition-list-content.component.mjs +14 -0
- package/esm2020/lib/modules/definition-list/definition-list-heading.component.mjs +14 -0
- package/esm2020/lib/modules/definition-list/definition-list-label.component.mjs +20 -0
- package/esm2020/lib/modules/definition-list/definition-list-value.component.mjs +21 -0
- package/esm2020/lib/modules/definition-list/definition-list.component.mjs +38 -0
- package/esm2020/lib/modules/definition-list/definition-list.module.mjs +44 -0
- package/esm2020/lib/modules/definition-list/definition-list.service.mjs +18 -0
- package/esm2020/lib/modules/description-list/description-list-adapter-service.mjs +43 -0
- package/esm2020/lib/modules/description-list/description-list-content.component.mjs +22 -0
- package/esm2020/lib/modules/description-list/description-list-description.component.mjs +49 -0
- package/esm2020/lib/modules/description-list/description-list-term.component.mjs +20 -0
- package/esm2020/lib/modules/description-list/description-list.component.mjs +101 -0
- package/esm2020/lib/modules/description-list/description-list.module.mjs +53 -0
- package/esm2020/lib/modules/description-list/description-list.service.mjs +26 -0
- package/esm2020/lib/modules/description-list/types/description-list-mode-type.mjs +2 -0
- package/esm2020/lib/modules/description-list/types/description-list-mode.mjs +24 -0
- package/esm2020/lib/modules/fluid-grid/column.component.mjs +53 -0
- package/esm2020/lib/modules/fluid-grid/fluid-grid-gutter-size.mjs +20 -0
- package/esm2020/lib/modules/fluid-grid/fluid-grid.component.mjs +62 -0
- package/esm2020/lib/modules/fluid-grid/fluid-grid.module.mjs +20 -0
- package/esm2020/lib/modules/fluid-grid/row.component.mjs +25 -0
- package/esm2020/lib/modules/fluid-grid/types/fluid-grid-gutter-size-type.mjs +2 -0
- package/esm2020/lib/modules/format/format-item.mjs +2 -0
- package/esm2020/lib/modules/format/format.component.mjs +59 -0
- package/esm2020/lib/modules/format/format.module.mjs +18 -0
- package/esm2020/lib/modules/inline-delete/inline-delete-adapter.service.mjs +115 -0
- package/esm2020/lib/modules/inline-delete/inline-delete-type.mjs +16 -0
- package/esm2020/lib/modules/inline-delete/inline-delete.component.mjs +161 -0
- package/esm2020/lib/modules/inline-delete/inline-delete.module.mjs +34 -0
- package/esm2020/lib/modules/page/page-theme-adapter.service.mjs +26 -0
- package/esm2020/lib/modules/page/page.component.mjs +27 -0
- package/esm2020/lib/modules/page/page.module.mjs +16 -0
- package/esm2020/lib/modules/page-summary/page-summary-adapter.service.mjs +23 -0
- package/esm2020/lib/modules/page-summary/page-summary-alert.component.mjs +17 -0
- package/esm2020/lib/modules/page-summary/page-summary-content.component.mjs +16 -0
- package/esm2020/lib/modules/page-summary/page-summary-image.component.mjs +17 -0
- package/esm2020/lib/modules/page-summary/page-summary-key-info.component.mjs +15 -0
- package/esm2020/lib/modules/page-summary/page-summary-status.component.mjs +17 -0
- package/esm2020/lib/modules/page-summary/page-summary-subtitle.component.mjs +16 -0
- package/esm2020/lib/modules/page-summary/page-summary-title.component.mjs +16 -0
- package/esm2020/lib/modules/page-summary/page-summary.component.mjs +45 -0
- package/esm2020/lib/modules/page-summary/page-summary.module.mjs +57 -0
- package/esm2020/lib/modules/shared/sky-layout-resources.module.mjs +60 -0
- package/esm2020/lib/modules/text-expand/text-expand-adapter.service.mjs +31 -0
- package/esm2020/lib/modules/text-expand/text-expand-modal-context.mjs +6 -0
- package/esm2020/lib/modules/text-expand/text-expand-modal.component.mjs +26 -0
- package/esm2020/lib/modules/text-expand/text-expand.component.mjs +247 -0
- package/esm2020/lib/modules/text-expand/text-expand.module.mjs +35 -0
- package/esm2020/lib/modules/text-expand-repeater/text-expand-repeater-adapter.service.mjs +37 -0
- package/esm2020/lib/modules/text-expand-repeater/text-expand-repeater.component.mjs +171 -0
- package/esm2020/lib/modules/text-expand-repeater/text-expand-repeater.module.mjs +20 -0
- package/esm2020/lib/modules/text-expand-repeater/types/text-expand-repeater-list-style-type.mjs +2 -0
- package/esm2020/lib/modules/toolbar/toolbar-item.component.mjs +14 -0
- package/esm2020/lib/modules/toolbar/toolbar-section.component.mjs +14 -0
- package/esm2020/lib/modules/toolbar/toolbar-view-actions.component.mjs +15 -0
- package/esm2020/lib/modules/toolbar/toolbar.component.mjs +25 -0
- package/esm2020/lib/modules/toolbar/toolbar.module.mjs +37 -0
- package/esm2020/skyux-layout.mjs +5 -0
- package/esm2020/testing/action-button-fixture.mjs +44 -0
- package/esm2020/testing/card-fixture.mjs +63 -0
- package/esm2020/testing/page-summary-fixture.mjs +29 -0
- package/esm2020/testing/public-api.mjs +4 -0
- package/esm2020/testing/skyux-layout-testing.mjs +5 -0
- package/fesm2015/{skyux-layout-testing.js → skyux-layout-testing.mjs} +1 -1
- package/fesm2015/skyux-layout-testing.mjs.map +1 -0
- package/fesm2015/skyux-layout.mjs +2724 -0
- package/fesm2015/skyux-layout.mjs.map +1 -0
- package/fesm2020/skyux-layout-testing.mjs +139 -0
- package/fesm2020/skyux-layout-testing.mjs.map +1 -0
- package/fesm2020/skyux-layout.mjs +2722 -0
- package/fesm2020/skyux-layout.mjs.map +1 -0
- package/package.json +45 -21
- package/testing/package.json +5 -5
- package/bundles/skyux-layout-testing.umd.js +0 -191
- package/bundles/skyux-layout.umd.js +0 -3570
- package/esm2015/index.js +0 -74
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button-adapter-service.js +0 -43
- package/esm2015/lib/modules/action-button/action-button-adapter-service.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button-container.component.js +0 -145
- package/esm2015/lib/modules/action-button/action-button-container.component.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button-details.component.js +0 -17
- package/esm2015/lib/modules/action-button/action-button-details.component.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button-header.component.js +0 -19
- package/esm2015/lib/modules/action-button/action-button-header.component.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button-icon.component.js +0 -44
- package/esm2015/lib/modules/action-button/action-button-icon.component.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button-permalink.js +0 -2
- package/esm2015/lib/modules/action-button/action-button-permalink.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button.component.js +0 -39
- package/esm2015/lib/modules/action-button/action-button.component.js.map +0 -1
- package/esm2015/lib/modules/action-button/action-button.module.js +0 -62
- package/esm2015/lib/modules/action-button/action-button.module.js.map +0 -1
- package/esm2015/lib/modules/action-button/types/action-button-container-align-items-type.js +0 -2
- package/esm2015/lib/modules/action-button/types/action-button-container-align-items-type.js.map +0 -1
- package/esm2015/lib/modules/action-button/types/action-button-container-align-items.js +0 -2
- package/esm2015/lib/modules/action-button/types/action-button-container-align-items.js.map +0 -1
- package/esm2015/lib/modules/back-to-top/back-to-top-adapter.service.js +0 -84
- package/esm2015/lib/modules/back-to-top/back-to-top-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/back-to-top/back-to-top.component.js +0 -31
- package/esm2015/lib/modules/back-to-top/back-to-top.component.js.map +0 -1
- package/esm2015/lib/modules/back-to-top/back-to-top.directive.js +0 -114
- package/esm2015/lib/modules/back-to-top/back-to-top.directive.js.map +0 -1
- package/esm2015/lib/modules/back-to-top/back-to-top.module.js +0 -36
- package/esm2015/lib/modules/back-to-top/back-to-top.module.js.map +0 -1
- package/esm2015/lib/modules/back-to-top/models/back-to-top-message-type.js +0 -11
- package/esm2015/lib/modules/back-to-top/models/back-to-top-message-type.js.map +0 -1
- package/esm2015/lib/modules/back-to-top/models/back-to-top-message.js +0 -2
- package/esm2015/lib/modules/back-to-top/models/back-to-top-message.js.map +0 -1
- package/esm2015/lib/modules/back-to-top/models/back-to-top-options.js +0 -2
- package/esm2015/lib/modules/back-to-top/models/back-to-top-options.js.map +0 -1
- package/esm2015/lib/modules/box/box-content.component.js +0 -18
- package/esm2015/lib/modules/box/box-content.component.js.map +0 -1
- package/esm2015/lib/modules/box/box-controls.component.js +0 -17
- package/esm2015/lib/modules/box/box-controls.component.js.map +0 -1
- package/esm2015/lib/modules/box/box-header.component.js +0 -17
- package/esm2015/lib/modules/box/box-header.component.js.map +0 -1
- package/esm2015/lib/modules/box/box.component.js +0 -26
- package/esm2015/lib/modules/box/box.component.js.map +0 -1
- package/esm2015/lib/modules/box/box.module.js +0 -38
- package/esm2015/lib/modules/box/box.module.js.map +0 -1
- package/esm2015/lib/modules/card/card-actions.component.js +0 -18
- package/esm2015/lib/modules/card/card-actions.component.js.map +0 -1
- package/esm2015/lib/modules/card/card-content.component.js +0 -17
- package/esm2015/lib/modules/card/card-content.component.js.map +0 -1
- package/esm2015/lib/modules/card/card-title.component.js +0 -17
- package/esm2015/lib/modules/card/card-title.component.js.map +0 -1
- package/esm2015/lib/modules/card/card.component.js +0 -79
- package/esm2015/lib/modules/card/card.component.js.map +0 -1
- package/esm2015/lib/modules/card/card.module.js +0 -61
- package/esm2015/lib/modules/card/card.module.js.map +0 -1
- package/esm2015/lib/modules/definition-list/definition-list-content.component.js +0 -19
- package/esm2015/lib/modules/definition-list/definition-list-content.component.js.map +0 -1
- package/esm2015/lib/modules/definition-list/definition-list-heading.component.js +0 -19
- package/esm2015/lib/modules/definition-list/definition-list-heading.component.js.map +0 -1
- package/esm2015/lib/modules/definition-list/definition-list-label.component.js +0 -25
- package/esm2015/lib/modules/definition-list/definition-list-label.component.js.map +0 -1
- package/esm2015/lib/modules/definition-list/definition-list-value.component.js +0 -25
- package/esm2015/lib/modules/definition-list/definition-list-value.component.js.map +0 -1
- package/esm2015/lib/modules/definition-list/definition-list.component.js +0 -44
- package/esm2015/lib/modules/definition-list/definition-list.component.js.map +0 -1
- package/esm2015/lib/modules/definition-list/definition-list.module.js +0 -44
- package/esm2015/lib/modules/definition-list/definition-list.module.js.map +0 -1
- package/esm2015/lib/modules/definition-list/definition-list.service.js +0 -18
- package/esm2015/lib/modules/definition-list/definition-list.service.js.map +0 -1
- package/esm2015/lib/modules/description-list/description-list-adapter-service.js +0 -43
- package/esm2015/lib/modules/description-list/description-list-adapter-service.js.map +0 -1
- package/esm2015/lib/modules/description-list/description-list-content.component.js +0 -25
- package/esm2015/lib/modules/description-list/description-list-content.component.js.map +0 -1
- package/esm2015/lib/modules/description-list/description-list-description.component.js +0 -53
- package/esm2015/lib/modules/description-list/description-list-description.component.js.map +0 -1
- package/esm2015/lib/modules/description-list/description-list-term.component.js +0 -24
- package/esm2015/lib/modules/description-list/description-list-term.component.js.map +0 -1
- package/esm2015/lib/modules/description-list/description-list.component.js +0 -107
- package/esm2015/lib/modules/description-list/description-list.component.js.map +0 -1
- package/esm2015/lib/modules/description-list/description-list.module.js +0 -53
- package/esm2015/lib/modules/description-list/description-list.module.js.map +0 -1
- package/esm2015/lib/modules/description-list/description-list.service.js +0 -26
- package/esm2015/lib/modules/description-list/description-list.service.js.map +0 -1
- package/esm2015/lib/modules/description-list/types/description-list-mode-type.js +0 -2
- package/esm2015/lib/modules/description-list/types/description-list-mode-type.js.map +0 -1
- package/esm2015/lib/modules/description-list/types/description-list-mode.js +0 -24
- package/esm2015/lib/modules/description-list/types/description-list-mode.js.map +0 -1
- package/esm2015/lib/modules/fluid-grid/column.component.js +0 -58
- package/esm2015/lib/modules/fluid-grid/column.component.js.map +0 -1
- package/esm2015/lib/modules/fluid-grid/fluid-grid-gutter-size.js +0 -20
- package/esm2015/lib/modules/fluid-grid/fluid-grid-gutter-size.js.map +0 -1
- package/esm2015/lib/modules/fluid-grid/fluid-grid.component.js +0 -66
- package/esm2015/lib/modules/fluid-grid/fluid-grid.component.js.map +0 -1
- package/esm2015/lib/modules/fluid-grid/fluid-grid.module.js +0 -20
- package/esm2015/lib/modules/fluid-grid/fluid-grid.module.js.map +0 -1
- package/esm2015/lib/modules/fluid-grid/row.component.js +0 -29
- package/esm2015/lib/modules/fluid-grid/row.component.js.map +0 -1
- package/esm2015/lib/modules/fluid-grid/types/fluid-grid-gutter-size-type.js +0 -2
- package/esm2015/lib/modules/fluid-grid/types/fluid-grid-gutter-size-type.js.map +0 -1
- package/esm2015/lib/modules/format/format-item.js +0 -2
- package/esm2015/lib/modules/format/format-item.js.map +0 -1
- package/esm2015/lib/modules/format/format.component.js +0 -63
- package/esm2015/lib/modules/format/format.component.js.map +0 -1
- package/esm2015/lib/modules/format/format.module.js +0 -18
- package/esm2015/lib/modules/format/format.module.js.map +0 -1
- package/esm2015/lib/modules/inline-delete/inline-delete-adapter.service.js +0 -115
- package/esm2015/lib/modules/inline-delete/inline-delete-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/inline-delete/inline-delete-type.js +0 -16
- package/esm2015/lib/modules/inline-delete/inline-delete-type.js.map +0 -1
- package/esm2015/lib/modules/inline-delete/inline-delete.component.js +0 -167
- package/esm2015/lib/modules/inline-delete/inline-delete.component.js.map +0 -1
- package/esm2015/lib/modules/inline-delete/inline-delete.module.js +0 -34
- package/esm2015/lib/modules/inline-delete/inline-delete.module.js.map +0 -1
- package/esm2015/lib/modules/page/page-theme-adapter.service.js +0 -26
- package/esm2015/lib/modules/page/page-theme-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/page/page.component.js +0 -31
- package/esm2015/lib/modules/page/page.component.js.map +0 -1
- package/esm2015/lib/modules/page/page.module.js +0 -16
- package/esm2015/lib/modules/page/page.module.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-adapter.service.js +0 -23
- package/esm2015/lib/modules/page-summary/page-summary-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-alert.component.js +0 -21
- package/esm2015/lib/modules/page-summary/page-summary-alert.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-content.component.js +0 -20
- package/esm2015/lib/modules/page-summary/page-summary-content.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-image.component.js +0 -21
- package/esm2015/lib/modules/page-summary/page-summary-image.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-key-info.component.js +0 -19
- package/esm2015/lib/modules/page-summary/page-summary-key-info.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-status.component.js +0 -21
- package/esm2015/lib/modules/page-summary/page-summary-status.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-subtitle.component.js +0 -20
- package/esm2015/lib/modules/page-summary/page-summary-subtitle.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary-title.component.js +0 -20
- package/esm2015/lib/modules/page-summary/page-summary-title.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary.component.js +0 -50
- package/esm2015/lib/modules/page-summary/page-summary.component.js.map +0 -1
- package/esm2015/lib/modules/page-summary/page-summary.module.js +0 -57
- package/esm2015/lib/modules/page-summary/page-summary.module.js.map +0 -1
- package/esm2015/lib/modules/shared/sky-layout-resources.module.js +0 -60
- package/esm2015/lib/modules/shared/sky-layout-resources.module.js.map +0 -1
- package/esm2015/lib/modules/text-expand/text-expand-adapter.service.js +0 -31
- package/esm2015/lib/modules/text-expand/text-expand-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/text-expand/text-expand-modal-context.js +0 -6
- package/esm2015/lib/modules/text-expand/text-expand-modal-context.js.map +0 -1
- package/esm2015/lib/modules/text-expand/text-expand-modal.component.js +0 -30
- package/esm2015/lib/modules/text-expand/text-expand-modal.component.js.map +0 -1
- package/esm2015/lib/modules/text-expand/text-expand.component.js +0 -252
- package/esm2015/lib/modules/text-expand/text-expand.component.js.map +0 -1
- package/esm2015/lib/modules/text-expand/text-expand.module.js +0 -36
- package/esm2015/lib/modules/text-expand/text-expand.module.js.map +0 -1
- package/esm2015/lib/modules/text-expand-repeater/text-expand-repeater-adapter.service.js +0 -37
- package/esm2015/lib/modules/text-expand-repeater/text-expand-repeater-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/text-expand-repeater/text-expand-repeater.component.js +0 -176
- package/esm2015/lib/modules/text-expand-repeater/text-expand-repeater.component.js.map +0 -1
- package/esm2015/lib/modules/text-expand-repeater/text-expand-repeater.module.js +0 -20
- package/esm2015/lib/modules/text-expand-repeater/text-expand-repeater.module.js.map +0 -1
- package/esm2015/lib/modules/text-expand-repeater/types/text-expand-repeater-list-style-type.js +0 -2
- package/esm2015/lib/modules/text-expand-repeater/types/text-expand-repeater-list-style-type.js.map +0 -1
- package/esm2015/lib/modules/toolbar/toolbar-item.component.js +0 -18
- package/esm2015/lib/modules/toolbar/toolbar-item.component.js.map +0 -1
- package/esm2015/lib/modules/toolbar/toolbar-section.component.js +0 -18
- package/esm2015/lib/modules/toolbar/toolbar-section.component.js.map +0 -1
- package/esm2015/lib/modules/toolbar/toolbar-view-actions.component.js +0 -20
- package/esm2015/lib/modules/toolbar/toolbar-view-actions.component.js.map +0 -1
- package/esm2015/lib/modules/toolbar/toolbar.component.js +0 -29
- package/esm2015/lib/modules/toolbar/toolbar.component.js.map +0 -1
- package/esm2015/lib/modules/toolbar/toolbar.module.js +0 -37
- package/esm2015/lib/modules/toolbar/toolbar.module.js.map +0 -1
- package/esm2015/skyux-layout.js +0 -5
- package/esm2015/skyux-layout.js.map +0 -1
- package/esm2015/testing/action-button-fixture.js +0 -44
- package/esm2015/testing/action-button-fixture.js.map +0 -1
- package/esm2015/testing/card-fixture.js +0 -63
- package/esm2015/testing/card-fixture.js.map +0 -1
- package/esm2015/testing/page-summary-fixture.js +0 -29
- package/esm2015/testing/page-summary-fixture.js.map +0 -1
- package/esm2015/testing/public-api.js +0 -4
- package/esm2015/testing/public-api.js.map +0 -1
- package/esm2015/testing/skyux-layout-testing.js +0 -5
- package/esm2015/testing/skyux-layout-testing.js.map +0 -1
- package/fesm2015/skyux-layout-testing.js.map +0 -1
- package/fesm2015/skyux-layout.js +0 -2912
- package/fesm2015/skyux-layout.js.map +0 -1
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { Component, ElementRef, Input, ViewChild, } from '@angular/core';
|
|
2
|
-
import { SkyLibResourcesService } from '@skyux/i18n';
|
|
3
|
-
import { SkyModalService } from '@skyux/modals';
|
|
4
|
-
import { forkJoin as observableForkJoin } from 'rxjs';
|
|
5
|
-
import { take } from 'rxjs/operators';
|
|
6
|
-
import { SkyTextExpandAdapterService } from './text-expand-adapter.service';
|
|
7
|
-
import { SkyTextExpandModalContext } from './text-expand-modal-context';
|
|
8
|
-
import { SkyTextExpandModalComponent } from './text-expand-modal.component';
|
|
9
|
-
import * as i0 from "@angular/core";
|
|
10
|
-
import * as i1 from "@skyux/i18n";
|
|
11
|
-
import * as i2 from "@skyux/modals";
|
|
12
|
-
import * as i3 from "./text-expand-adapter.service";
|
|
13
|
-
import * as i4 from "@angular/common";
|
|
14
|
-
/**
|
|
15
|
-
* Auto-incrementing integer used to generate unique ids for text expand components.
|
|
16
|
-
*/
|
|
17
|
-
let nextId = 0;
|
|
18
|
-
export class SkyTextExpandComponent {
|
|
19
|
-
constructor(resources, modalService, textExpandAdapter) {
|
|
20
|
-
this.resources = resources;
|
|
21
|
-
this.modalService = modalService;
|
|
22
|
-
this.textExpandAdapter = textExpandAdapter;
|
|
23
|
-
/**
|
|
24
|
-
* Specifies the maximum number of text characters to display inline when users select the link
|
|
25
|
-
* to expand the full text. If the text exceeds this limit, then the component expands
|
|
26
|
-
* the full text in a modal instead.
|
|
27
|
-
*/
|
|
28
|
-
this.maxExpandedLength = 600;
|
|
29
|
-
/**
|
|
30
|
-
* Specifies the maximum number of newline characters to display inline when users select
|
|
31
|
-
* the link to expand the full text. If the text exceeds this limit, then
|
|
32
|
-
* the component expands the full text in a modal view instead.
|
|
33
|
-
*/
|
|
34
|
-
this.maxExpandedNewlines = 2;
|
|
35
|
-
/**
|
|
36
|
-
* Indicates whether to replace newline characters in truncated text with spaces.
|
|
37
|
-
*/
|
|
38
|
-
this.truncateNewlines = true;
|
|
39
|
-
this.contentSectionId = `sky-text-expand-content-${++nextId}`;
|
|
40
|
-
this.isExpanded = false;
|
|
41
|
-
this._maxLength = 200;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Specifies the number of text characters to display before truncating the text.
|
|
45
|
-
* To avoid truncating text in the middle of a word, the component looks for a space
|
|
46
|
-
* in the 10 characters before the last character.
|
|
47
|
-
* @default 200
|
|
48
|
-
*/
|
|
49
|
-
set maxLength(value) {
|
|
50
|
-
this._maxLength = value;
|
|
51
|
-
/* istanbul ignore else */
|
|
52
|
-
if (this.textEl) {
|
|
53
|
-
this.setup(this.expandedText);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
get maxLength() {
|
|
57
|
-
return this._maxLength;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Specifies the text to truncate.
|
|
61
|
-
*/
|
|
62
|
-
set text(value) {
|
|
63
|
-
/* istanbul ignore else */
|
|
64
|
-
if (this.textEl) {
|
|
65
|
-
this.setup(value);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
textExpand() {
|
|
69
|
-
if (this.isModal) {
|
|
70
|
-
// Modal View
|
|
71
|
-
/* istanbul ignore else */
|
|
72
|
-
/* sanity check */
|
|
73
|
-
if (!this.isExpanded) {
|
|
74
|
-
this.modalService.open(SkyTextExpandModalComponent, [
|
|
75
|
-
{
|
|
76
|
-
provide: SkyTextExpandModalContext,
|
|
77
|
-
useValue: {
|
|
78
|
-
header: this.expandModalTitle,
|
|
79
|
-
text: this.expandedText,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
]);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
// Normal View
|
|
87
|
-
if (!this.isExpanded) {
|
|
88
|
-
this.setContainerMaxHeight();
|
|
89
|
-
setTimeout(() => {
|
|
90
|
-
this.isExpanded = true;
|
|
91
|
-
this.animateText(this.collapsedText, this.expandedText, true);
|
|
92
|
-
}, 10);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
this.setContainerMaxHeight();
|
|
96
|
-
setTimeout(() => {
|
|
97
|
-
this.isExpanded = false;
|
|
98
|
-
this.animateText(this.expandedText, this.collapsedText, false);
|
|
99
|
-
}, 10);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
animationEnd() {
|
|
104
|
-
// Ensure the correct text is displayed
|
|
105
|
-
this.textExpandAdapter.setText(this.textEl, this.textToShow);
|
|
106
|
-
// Set height back to auto so the browser can change the height as needed with window changes
|
|
107
|
-
this.textExpandAdapter.setContainerHeight(this.containerEl, undefined);
|
|
108
|
-
}
|
|
109
|
-
ngAfterContentInit() {
|
|
110
|
-
observableForkJoin([
|
|
111
|
-
this.resources.getString('skyux_text_expand_see_more'),
|
|
112
|
-
this.resources.getString('skyux_text_expand_see_less'),
|
|
113
|
-
])
|
|
114
|
-
.pipe(take(1))
|
|
115
|
-
.subscribe((resources) => {
|
|
116
|
-
this.seeMoreText = resources[0];
|
|
117
|
-
this.seeLessText = resources[1];
|
|
118
|
-
this.setup(this.expandedText);
|
|
119
|
-
/* istanbul ignore else */
|
|
120
|
-
if (!this.expandModalTitle) {
|
|
121
|
-
this.resources
|
|
122
|
-
.getString('skyux_text_expand_modal_title')
|
|
123
|
-
.pipe(take(1))
|
|
124
|
-
.subscribe((resource) => {
|
|
125
|
-
this.expandModalTitle = resource;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
setContainerMaxHeight() {
|
|
131
|
-
// ensure everything is reset
|
|
132
|
-
this.animationEnd();
|
|
133
|
-
/* Before animation is kicked off, ensure that a maxHeight exists */
|
|
134
|
-
/* Once we have support for angular v4 animations with parameters we can use that instead */
|
|
135
|
-
const currentHeight = this.textExpandAdapter.getContainerHeight(this.containerEl);
|
|
136
|
-
this.textExpandAdapter.setContainerHeight(this.containerEl, `${currentHeight}px`);
|
|
137
|
-
}
|
|
138
|
-
setup(value) {
|
|
139
|
-
if (value) {
|
|
140
|
-
this.newlineCount = this.getNewlineCount(value);
|
|
141
|
-
this.collapsedText = this.getTruncatedText(value, this.maxLength);
|
|
142
|
-
this.expandedText = value;
|
|
143
|
-
if (this.collapsedText !== value) {
|
|
144
|
-
this.buttonText = this.seeMoreText;
|
|
145
|
-
this.isExpanded = false;
|
|
146
|
-
this.expandable = true;
|
|
147
|
-
this.isModal =
|
|
148
|
-
this.newlineCount > this.maxExpandedNewlines ||
|
|
149
|
-
this.expandedText.length > this.maxExpandedLength;
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
this.expandable = false;
|
|
153
|
-
}
|
|
154
|
-
this.textToShow = this.collapsedText;
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
this.textToShow = '';
|
|
158
|
-
this.expandable = false;
|
|
159
|
-
}
|
|
160
|
-
this.textExpandAdapter.setText(this.textEl, this.textToShow);
|
|
161
|
-
}
|
|
162
|
-
getNewlineCount(value) {
|
|
163
|
-
const matches = value.match(/\n/gi);
|
|
164
|
-
if (matches) {
|
|
165
|
-
return matches.length;
|
|
166
|
-
}
|
|
167
|
-
return 0;
|
|
168
|
-
}
|
|
169
|
-
getTruncatedText(value, length) {
|
|
170
|
-
let i;
|
|
171
|
-
if (this.truncateNewlines) {
|
|
172
|
-
value = value.replace(/\n+/gi, ' ');
|
|
173
|
-
}
|
|
174
|
-
// Jump ahead one character and see if it's a space, and if it isn't,
|
|
175
|
-
// back up to the first space and break there so a word doesn't get cut
|
|
176
|
-
// in half.
|
|
177
|
-
if (length < value.length) {
|
|
178
|
-
for (i = length; i > length - 10; i--) {
|
|
179
|
-
if (/\s/.test(value.charAt(i))) {
|
|
180
|
-
length = i;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return value.substr(0, length);
|
|
186
|
-
}
|
|
187
|
-
animateText(previousText, newText, expanding) {
|
|
188
|
-
const adapter = this.textExpandAdapter;
|
|
189
|
-
const container = this.containerEl;
|
|
190
|
-
// Reset max height
|
|
191
|
-
adapter.setContainerHeight(container, undefined);
|
|
192
|
-
// Measure the current height so we can animate from it.
|
|
193
|
-
const currentHeight = adapter.getContainerHeight(container);
|
|
194
|
-
this.textToShow = newText;
|
|
195
|
-
adapter.setText(this.textEl, this.textToShow);
|
|
196
|
-
this.buttonText = expanding ? this.seeLessText : this.seeMoreText;
|
|
197
|
-
// Measure the new height so we can animate to it.
|
|
198
|
-
const newHeight = adapter.getContainerHeight(container);
|
|
199
|
-
/* istanbul ignore if */
|
|
200
|
-
if (newHeight < currentHeight) {
|
|
201
|
-
// The new text is smaller than the old text, so put the old text back before doing
|
|
202
|
-
// the collapse animation to avoid showing a big chunk of whitespace.
|
|
203
|
-
adapter.setText(this.textEl, previousText);
|
|
204
|
-
}
|
|
205
|
-
adapter.setContainerHeight(container, `${currentHeight}px`);
|
|
206
|
-
// This timeout is necessary due to the browser needing to pick up the non-auto height being set
|
|
207
|
-
// in order to do the transtion in height correctly. Without it the transition does not fire.
|
|
208
|
-
setTimeout(() => {
|
|
209
|
-
adapter.setContainerHeight(container, `${newHeight}px`);
|
|
210
|
-
/* This resets values if the transition does not get kicked off */
|
|
211
|
-
setTimeout(() => {
|
|
212
|
-
this.animationEnd();
|
|
213
|
-
}, 500);
|
|
214
|
-
}, 10);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
SkyTextExpandComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandComponent, deps: [{ token: i1.SkyLibResourcesService }, { token: i2.SkyModalService }, { token: i3.SkyTextExpandAdapterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
218
|
-
SkyTextExpandComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyTextExpandComponent, selector: "sky-text-expand", inputs: { expandModalTitle: "expandModalTitle", maxExpandedLength: "maxExpandedLength", maxExpandedNewlines: "maxExpandedNewlines", maxLength: "maxLength", text: "text", truncateNewlines: "truncateNewlines" }, providers: [SkyTextExpandAdapterService], viewQueries: [{ propertyName: "containerEl", first: true, predicate: ["container"], descendants: true, read: ElementRef, static: true }, { propertyName: "textEl", first: true, predicate: ["text"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div\n class=\"sky-text-expand-container\"\n (transitionend)=\"animationEnd()\"\n #container\n>\n <span class=\"sky-text-expand-text\" [id]=\"contentSectionId\" #text></span>\n <span class=\"sky-text-expand-ellipsis\" *ngIf=\"!isExpanded && expandable\"\n >...\n </span>\n <button\n *ngIf=\"expandable\"\n type=\"button\"\n class=\"sky-btn sky-btn-link-inline sky-text-expand-see-more\"\n [attr.aria-expanded]=\"isModal ? undefined : isExpanded\"\n [attr.aria-controls]=\"isModal ? undefined : contentSectionId\"\n [attr.aria-haspopup]=\"isModal ? 'dialog' : undefined\"\n (click)=\"textExpand()\"\n >\n {{ buttonText }}\n </button>\n</div>\n", styles: [".sky-text-expand-ellipsis{letter-spacing:2px;white-space:nowrap}.sky-text-expand-space{white-space:normal}.sky-text-expand-see-more{white-space:nowrap;margin-left:5px}.sky-text-expand-text{margin:0;white-space:pre-wrap}.sky-text-expand-container{word-break:break-word;word-wrap:break-word;overflow:hidden;height:auto;transition:max-height .25s}.sky-text-expand-modal-content{white-space:pre-line;word-wrap:break-word}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
219
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandComponent, decorators: [{
|
|
220
|
-
type: Component,
|
|
221
|
-
args: [{
|
|
222
|
-
selector: 'sky-text-expand',
|
|
223
|
-
templateUrl: './text-expand.component.html',
|
|
224
|
-
styleUrls: ['./text-expand.component.scss'],
|
|
225
|
-
providers: [SkyTextExpandAdapterService],
|
|
226
|
-
}]
|
|
227
|
-
}], ctorParameters: function () { return [{ type: i1.SkyLibResourcesService }, { type: i2.SkyModalService }, { type: i3.SkyTextExpandAdapterService }]; }, propDecorators: { expandModalTitle: [{
|
|
228
|
-
type: Input
|
|
229
|
-
}], maxExpandedLength: [{
|
|
230
|
-
type: Input
|
|
231
|
-
}], maxExpandedNewlines: [{
|
|
232
|
-
type: Input
|
|
233
|
-
}], maxLength: [{
|
|
234
|
-
type: Input
|
|
235
|
-
}], text: [{
|
|
236
|
-
type: Input
|
|
237
|
-
}], truncateNewlines: [{
|
|
238
|
-
type: Input
|
|
239
|
-
}], containerEl: [{
|
|
240
|
-
type: ViewChild,
|
|
241
|
-
args: ['container', {
|
|
242
|
-
read: ElementRef,
|
|
243
|
-
static: true,
|
|
244
|
-
}]
|
|
245
|
-
}], textEl: [{
|
|
246
|
-
type: ViewChild,
|
|
247
|
-
args: ['text', {
|
|
248
|
-
read: ElementRef,
|
|
249
|
-
static: true,
|
|
250
|
-
}]
|
|
251
|
-
}] } });
|
|
252
|
-
//# sourceMappingURL=text-expand.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-expand.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/layout/src/lib/modules/text-expand/text-expand.component.ts","../../../../../../../../libs/components/layout/src/lib/modules/text-expand/text-expand.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,UAAU,EACV,KAAK,EACL,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;;;;;;AAE5E;;GAEG;AACH,IAAI,MAAM,GAAG,CAAC,CAAC;AAQf,MAAM,OAAO,sBAAsB;IAiGjC,YACU,SAAiC,EACjC,YAA6B,EAC7B,iBAA8C;QAF9C,cAAS,GAAT,SAAS,CAAwB;QACjC,iBAAY,GAAZ,YAAY,CAAiB;QAC7B,sBAAiB,GAAjB,iBAAiB,CAA6B;QA5FxD;;;;WAIG;QAE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C,mBAAmB;sBADzB,KAAK;gBAUK,SAAS;sBADnB,KAAK;gBAkBK,IAAI;sBADd,KAAK;gBAYC,gBAAgB;sBADtB,KAAK;gBAiBE,WAAW;sBAJlB,SAAS;uBAAC,WAAW,EAAE;wBACtB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb;gBAOO,MAAM;sBAJb,SAAS;uBAAC,MAAM,EAAE;wBACjB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb","sourcesContent":["import {\n AfterContentInit,\n Component,\n ElementRef,\n Input,\n ViewChild,\n} from '@angular/core';\nimport { SkyLibResourcesService } from '@skyux/i18n';\nimport { SkyModalService } from '@skyux/modals';\n\nimport { forkJoin as observableForkJoin } from 'rxjs';\nimport { take } from 'rxjs/operators';\n\nimport { SkyTextExpandAdapterService } from './text-expand-adapter.service';\nimport { SkyTextExpandModalContext } from './text-expand-modal-context';\nimport { SkyTextExpandModalComponent } from './text-expand-modal.component';\n\n/**\n * Auto-incrementing integer used to generate unique ids for text expand components.\n */\nlet nextId = 0;\n\n@Component({\n selector: 'sky-text-expand',\n templateUrl: './text-expand.component.html',\n styleUrls: ['./text-expand.component.scss'],\n providers: [SkyTextExpandAdapterService],\n})\nexport class SkyTextExpandComponent implements AfterContentInit {\n /**\n * Specifies a title to display when the component expands the full text in a modal.\n * @default \"Expanded view\"\n */\n @Input()\n public expandModalTitle: string;\n\n /**\n * Specifies the maximum number of text characters to display inline when users select the link\n * to expand the full text. If the text exceeds this limit, then the component expands\n * the full text in a modal instead.\n */\n @Input()\n public maxExpandedLength = 600;\n\n /**\n * Specifies the maximum number of newline characters to display inline when users select\n * the link to expand the full text. If the text exceeds this limit, then\n * the component expands the full text in a modal view instead.\n */\n @Input()\n public maxExpandedNewlines = 2;\n\n /**\n * Specifies the number of text characters to display before truncating the text.\n * To avoid truncating text in the middle of a word, the component looks for a space\n * in the 10 characters before the last character.\n * @default 200\n */\n @Input()\n public set maxLength(value: number) {\n this._maxLength = value;\n\n /* istanbul ignore else */\n if (this.textEl) {\n this.setup(this.expandedText);\n }\n }\n\n public get maxLength(): number {\n return this._maxLength;\n }\n\n /**\n * Specifies the text to truncate.\n */\n @Input()\n public set text(value: string) {\n /* istanbul ignore else */\n if (this.textEl) {\n this.setup(value);\n }\n }\n\n /**\n * Indicates whether to replace newline characters in truncated text with spaces.\n */\n @Input()\n public truncateNewlines = true;\n\n public buttonText: string;\n\n public contentSectionId = `sky-text-expand-content-${++nextId}`;\n\n public expandable: boolean;\n\n public isExpanded = false;\n\n public isModal: boolean;\n\n @ViewChild('container', {\n read: ElementRef,\n static: true,\n })\n private containerEl: ElementRef;\n\n @ViewChild('text', {\n read: ElementRef,\n static: true,\n })\n private textEl: ElementRef;\n\n private collapsedText: string;\n\n private expandedText: string;\n\n private newlineCount: number;\n\n private seeMoreText: string;\n\n private seeLessText: string;\n\n private textToShow: string;\n\n private _maxLength = 200;\n\n constructor(\n private resources: SkyLibResourcesService,\n private modalService: SkyModalService,\n private textExpandAdapter: SkyTextExpandAdapterService\n ) {}\n\n public textExpand(): void {\n if (this.isModal) {\n // Modal View\n /* istanbul ignore else */\n /* sanity check */\n if (!this.isExpanded) {\n this.modalService.open(SkyTextExpandModalComponent, [\n {\n provide: SkyTextExpandModalContext,\n useValue: {\n header: this.expandModalTitle,\n text: this.expandedText,\n },\n },\n ]);\n }\n } else {\n // Normal View\n if (!this.isExpanded) {\n this.setContainerMaxHeight();\n setTimeout(() => {\n this.isExpanded = true;\n this.animateText(this.collapsedText, this.expandedText, true);\n }, 10);\n } else {\n this.setContainerMaxHeight();\n setTimeout(() => {\n this.isExpanded = false;\n this.animateText(this.expandedText, this.collapsedText, false);\n }, 10);\n }\n }\n }\n\n public animationEnd(): void {\n // Ensure the correct text is displayed\n this.textExpandAdapter.setText(this.textEl, this.textToShow);\n // Set height back to auto so the browser can change the height as needed with window changes\n this.textExpandAdapter.setContainerHeight(this.containerEl, undefined);\n }\n\n public ngAfterContentInit(): void {\n observableForkJoin([\n this.resources.getString('skyux_text_expand_see_more'),\n this.resources.getString('skyux_text_expand_see_less'),\n ])\n .pipe(take(1))\n .subscribe((resources) => {\n this.seeMoreText = resources[0];\n this.seeLessText = resources[1];\n this.setup(this.expandedText);\n\n /* istanbul ignore else */\n if (!this.expandModalTitle) {\n this.resources\n .getString('skyux_text_expand_modal_title')\n .pipe(take(1))\n .subscribe((resource) => {\n this.expandModalTitle = resource;\n });\n }\n });\n }\n\n private setContainerMaxHeight(): void {\n // ensure everything is reset\n this.animationEnd();\n /* Before animation is kicked off, ensure that a maxHeight exists */\n /* Once we have support for angular v4 animations with parameters we can use that instead */\n const currentHeight = this.textExpandAdapter.getContainerHeight(\n this.containerEl\n );\n this.textExpandAdapter.setContainerHeight(\n this.containerEl,\n `${currentHeight}px`\n );\n }\n\n private setup(value: string): void {\n if (value) {\n this.newlineCount = this.getNewlineCount(value);\n this.collapsedText = this.getTruncatedText(value, this.maxLength);\n this.expandedText = value;\n if (this.collapsedText !== value) {\n this.buttonText = this.seeMoreText;\n this.isExpanded = false;\n this.expandable = true;\n this.isModal =\n this.newlineCount > this.maxExpandedNewlines ||\n this.expandedText.length > this.maxExpandedLength;\n } else {\n this.expandable = false;\n }\n this.textToShow = this.collapsedText;\n } else {\n this.textToShow = '';\n this.expandable = false;\n }\n this.textExpandAdapter.setText(this.textEl, this.textToShow);\n }\n\n private getNewlineCount(value: string): number {\n const matches = value.match(/\\n/gi);\n\n if (matches) {\n return matches.length;\n }\n\n return 0;\n }\n\n private getTruncatedText(value: string, length: number): string {\n let i: number;\n if (this.truncateNewlines) {\n value = value.replace(/\\n+/gi, ' ');\n }\n // Jump ahead one character and see if it's a space, and if it isn't,\n // back up to the first space and break there so a word doesn't get cut\n // in half.\n if (length < value.length) {\n for (i = length; i > length - 10; i--) {\n if (/\\s/.test(value.charAt(i))) {\n length = i;\n break;\n }\n }\n }\n return value.substr(0, length);\n }\n\n private animateText(\n previousText: string,\n newText: string,\n expanding: boolean\n ): void {\n const adapter = this.textExpandAdapter;\n const container = this.containerEl;\n // Reset max height\n adapter.setContainerHeight(container, undefined);\n // Measure the current height so we can animate from it.\n const currentHeight = adapter.getContainerHeight(container);\n this.textToShow = newText;\n adapter.setText(this.textEl, this.textToShow);\n this.buttonText = expanding ? this.seeLessText : this.seeMoreText;\n // Measure the new height so we can animate to it.\n const newHeight = adapter.getContainerHeight(container);\n /* istanbul ignore if */\n if (newHeight < currentHeight) {\n // The new text is smaller than the old text, so put the old text back before doing\n // the collapse animation to avoid showing a big chunk of whitespace.\n adapter.setText(this.textEl, previousText);\n }\n\n adapter.setContainerHeight(container, `${currentHeight}px`);\n // This timeout is necessary due to the browser needing to pick up the non-auto height being set\n // in order to do the transtion in height correctly. Without it the transition does not fire.\n setTimeout(() => {\n adapter.setContainerHeight(container, `${newHeight}px`);\n /* This resets values if the transition does not get kicked off */\n setTimeout(() => {\n this.animationEnd();\n }, 500);\n }, 10);\n }\n}\n","<div\n class=\"sky-text-expand-container\"\n (transitionend)=\"animationEnd()\"\n #container\n>\n <span class=\"sky-text-expand-text\" [id]=\"contentSectionId\" #text></span>\n <span class=\"sky-text-expand-ellipsis\" *ngIf=\"!isExpanded && expandable\"\n >...\n </span>\n <button\n *ngIf=\"expandable\"\n type=\"button\"\n class=\"sky-btn sky-btn-link-inline sky-text-expand-see-more\"\n [attr.aria-expanded]=\"isModal ? undefined : isExpanded\"\n [attr.aria-controls]=\"isModal ? undefined : contentSectionId\"\n [attr.aria-haspopup]=\"isModal ? 'dialog' : undefined\"\n (click)=\"textExpand()\"\n >\n {{ buttonText }}\n </button>\n</div>\n"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { SkyI18nModule } from '@skyux/i18n';
|
|
4
|
-
import { SkyModalModule } from '@skyux/modals';
|
|
5
|
-
import { SkyLayoutResourcesModule } from '../shared/sky-layout-resources.module';
|
|
6
|
-
import { SkyTextExpandModalComponent } from './text-expand-modal.component';
|
|
7
|
-
import { SkyTextExpandComponent } from './text-expand.component';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
export class SkyTextExpandModule {
|
|
10
|
-
}
|
|
11
|
-
SkyTextExpandModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
12
|
-
SkyTextExpandModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandModule, declarations: [SkyTextExpandComponent, SkyTextExpandModalComponent], imports: [SkyI18nModule,
|
|
13
|
-
SkyLayoutResourcesModule,
|
|
14
|
-
SkyModalModule,
|
|
15
|
-
CommonModule], exports: [SkyTextExpandComponent] });
|
|
16
|
-
SkyTextExpandModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandModule, imports: [[
|
|
17
|
-
SkyI18nModule,
|
|
18
|
-
SkyLayoutResourcesModule,
|
|
19
|
-
SkyModalModule,
|
|
20
|
-
CommonModule,
|
|
21
|
-
]] });
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandModule, decorators: [{
|
|
23
|
-
type: NgModule,
|
|
24
|
-
args: [{
|
|
25
|
-
declarations: [SkyTextExpandComponent, SkyTextExpandModalComponent],
|
|
26
|
-
imports: [
|
|
27
|
-
SkyI18nModule,
|
|
28
|
-
SkyLayoutResourcesModule,
|
|
29
|
-
SkyModalModule,
|
|
30
|
-
CommonModule,
|
|
31
|
-
],
|
|
32
|
-
exports: [SkyTextExpandComponent],
|
|
33
|
-
entryComponents: [SkyTextExpandModalComponent],
|
|
34
|
-
}]
|
|
35
|
-
}] });
|
|
36
|
-
//# sourceMappingURL=text-expand.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-expand.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/layout/src/lib/modules/text-expand/text-expand.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;;AAajE,MAAM,OAAO,mBAAmB;;iHAAnB,mBAAmB;kHAAnB,mBAAmB,iBAVf,sBAAsB,EAAE,2BAA2B,aAEhE,aAAa;QACb,wBAAwB;QACxB,cAAc;QACd,YAAY,aAEJ,sBAAsB;kHAGrB,mBAAmB,YATrB;YACP,aAAa;YACb,wBAAwB;YACxB,cAAc;YACd,YAAY;SACb;4FAIU,mBAAmB;kBAX/B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;oBACnE,OAAO,EAAE;wBACP,aAAa;wBACb,wBAAwB;wBACxB,cAAc;wBACd,YAAY;qBACb;oBACD,OAAO,EAAE,CAAC,sBAAsB,CAAC;oBACjC,eAAe,EAAE,CAAC,2BAA2B,CAAC;iBAC/C","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SkyI18nModule } from '@skyux/i18n';\nimport { SkyModalModule } from '@skyux/modals';\n\nimport { SkyLayoutResourcesModule } from '../shared/sky-layout-resources.module';\n\nimport { SkyTextExpandModalComponent } from './text-expand-modal.component';\nimport { SkyTextExpandComponent } from './text-expand.component';\n\n@NgModule({\n declarations: [SkyTextExpandComponent, SkyTextExpandModalComponent],\n imports: [\n SkyI18nModule,\n SkyLayoutResourcesModule,\n SkyModalModule,\n CommonModule,\n ],\n exports: [SkyTextExpandComponent],\n entryComponents: [SkyTextExpandModalComponent],\n})\nexport class SkyTextExpandModule {}\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Injectable, RendererFactory2, } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export class SkyTextExpandRepeaterAdapterService {
|
|
7
|
-
constructor(rendererFactory) {
|
|
8
|
-
this.rendererFactory = rendererFactory;
|
|
9
|
-
this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
|
|
10
|
-
}
|
|
11
|
-
getItems(elRef) {
|
|
12
|
-
return elRef.nativeElement.querySelectorAll('.sky-text-expand-repeater-item');
|
|
13
|
-
}
|
|
14
|
-
hideItem(item) {
|
|
15
|
-
this.renderer.setStyle(item, 'display', 'none');
|
|
16
|
-
}
|
|
17
|
-
showItem(item) {
|
|
18
|
-
this.renderer.setStyle(item, 'display', 'list-item');
|
|
19
|
-
}
|
|
20
|
-
getContainerHeight(containerEl) {
|
|
21
|
-
return containerEl.nativeElement.offsetHeight;
|
|
22
|
-
}
|
|
23
|
-
setContainerHeight(containerEl, height) {
|
|
24
|
-
if (height === undefined) {
|
|
25
|
-
this.renderer.removeStyle(containerEl.nativeElement, 'max-height');
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.renderer.setStyle(containerEl.nativeElement, 'max-height', height);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
SkyTextExpandRepeaterAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
33
|
-
SkyTextExpandRepeaterAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterAdapterService });
|
|
34
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterAdapterService, decorators: [{
|
|
35
|
-
type: Injectable
|
|
36
|
-
}], ctorParameters: function () { return [{ type: i0.RendererFactory2 }]; } });
|
|
37
|
-
//# sourceMappingURL=text-expand-repeater-adapter.service.js.map
|
package/esm2015/lib/modules/text-expand-repeater/text-expand-repeater-adapter.service.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-expand-repeater-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/layout/src/lib/modules/text-expand-repeater/text-expand-repeater-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,gBAAgB,GACjB,MAAM,eAAe,CAAC;;AAEvB;;GAEG;AAEH,MAAM,OAAO,mCAAmC;IAG9C,YAAoB,eAAiC;QAAjC,oBAAe,GAAf,eAAe,CAAkB;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;IAEM,QAAQ,CAAC,KAAiB;QAC/B,OAAO,KAAK,CAAC,aAAa,CAAC,gBAAgB,CACzC,gCAAgC,CACjC,CAAC;IACJ,CAAC;IAEM,QAAQ,CAAC,IAAiB;QAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAEM,QAAQ,CAAC,IAAiB;QAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC;IAEM,kBAAkB,CAAC,WAAuB;QAC/C,OAAO,WAAW,CAAC,aAAa,CAAC,YAAY,CAAC;IAChD,CAAC;IAEM,kBAAkB,CAAC,WAAuB,EAAE,MAAc;QAC/D,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;SACpE;aAAM;YACL,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;SACzE;IACH,CAAC;;iIA/BU,mCAAmC;qIAAnC,mCAAmC;4FAAnC,mCAAmC;kBAD/C,UAAU","sourcesContent":["import {\n ElementRef,\n Injectable,\n Renderer2,\n RendererFactory2,\n} from '@angular/core';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyTextExpandRepeaterAdapterService {\n private renderer: Renderer2;\n\n constructor(private rendererFactory: RendererFactory2) {\n this.renderer = this.rendererFactory.createRenderer(undefined, undefined);\n }\n\n public getItems(elRef: ElementRef) {\n return elRef.nativeElement.querySelectorAll(\n '.sky-text-expand-repeater-item'\n );\n }\n\n public hideItem(item: HTMLElement) {\n this.renderer.setStyle(item, 'display', 'none');\n }\n\n public showItem(item: HTMLElement) {\n this.renderer.setStyle(item, 'display', 'list-item');\n }\n\n public getContainerHeight(containerEl: ElementRef) {\n return containerEl.nativeElement.offsetHeight;\n }\n\n public setContainerHeight(containerEl: ElementRef, height: string) {\n if (height === undefined) {\n this.renderer.removeStyle(containerEl.nativeElement, 'max-height');\n } else {\n this.renderer.setStyle(containerEl.nativeElement, 'max-height', height);\n }\n }\n}\n"]}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, ElementRef, Input, TemplateRef, ViewChild, } from '@angular/core';
|
|
2
|
-
import { SkyLibResourcesService } from '@skyux/i18n';
|
|
3
|
-
import { forkJoin as observableForkJoin } from 'rxjs';
|
|
4
|
-
import { take } from 'rxjs/operators';
|
|
5
|
-
import { SkyTextExpandRepeaterAdapterService } from './text-expand-repeater-adapter.service';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
import * as i1 from "@skyux/i18n";
|
|
8
|
-
import * as i2 from "./text-expand-repeater-adapter.service";
|
|
9
|
-
import * as i3 from "@angular/common";
|
|
10
|
-
/**
|
|
11
|
-
* Auto-incrementing integer used to generate unique ids for text expand repeater components.
|
|
12
|
-
*/
|
|
13
|
-
let nextId = 0;
|
|
14
|
-
export class SkyTextExpandRepeaterComponent {
|
|
15
|
-
constructor(resources, elRef, textExpandRepeaterAdapter, changeDetector) {
|
|
16
|
-
this.resources = resources;
|
|
17
|
-
this.elRef = elRef;
|
|
18
|
-
this.textExpandRepeaterAdapter = textExpandRepeaterAdapter;
|
|
19
|
-
this.changeDetector = changeDetector;
|
|
20
|
-
/**
|
|
21
|
-
* Specifies the style of bullet to use
|
|
22
|
-
* @default "unordered"
|
|
23
|
-
*/
|
|
24
|
-
this.listStyle = 'unordered';
|
|
25
|
-
this.contentSectionId = `sky-text-expand-repeater-content-${++nextId}`;
|
|
26
|
-
this.isExpanded = false;
|
|
27
|
-
}
|
|
28
|
-
ngAfterViewInit() {
|
|
29
|
-
if (this.contentItems) {
|
|
30
|
-
this.items = this.textExpandRepeaterAdapter.getItems(this.elRef);
|
|
31
|
-
for (let i = this.maxItems; i < this.contentItems.length; i++) {
|
|
32
|
-
this.textExpandRepeaterAdapter.hideItem(this.items[i]);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
observableForkJoin([
|
|
36
|
-
this.resources.getString('skyux_text_expand_see_more'),
|
|
37
|
-
this.resources.getString('skyux_text_expand_see_less'),
|
|
38
|
-
])
|
|
39
|
-
.pipe(take(1))
|
|
40
|
-
.subscribe((resources) => {
|
|
41
|
-
this.seeMoreText = resources[0];
|
|
42
|
-
this.seeLessText = resources[1];
|
|
43
|
-
/* sanity check */
|
|
44
|
-
/* istanbul ignore else */
|
|
45
|
-
if (!this.isExpanded) {
|
|
46
|
-
this.buttonText = this.seeMoreText;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
this.buttonText = this.seeLessText;
|
|
50
|
-
}
|
|
51
|
-
this.changeDetector.detectChanges();
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
ngOnChanges(changes) {
|
|
55
|
-
/* istanbul ignore else */
|
|
56
|
-
if (changes.maxItems || changes.data) {
|
|
57
|
-
this.setup(this.data);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
animationEnd() {
|
|
61
|
-
// Ensure the correct items are displayed
|
|
62
|
-
if (!this.isExpanded) {
|
|
63
|
-
for (let i = this.maxItems; i < this.contentItems.length; i++) {
|
|
64
|
-
this.textExpandRepeaterAdapter.hideItem(this.items[i]);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Set height back to auto so the browser can change the height as needed with window changes
|
|
68
|
-
this.textExpandRepeaterAdapter.setContainerHeight(this.containerEl, undefined);
|
|
69
|
-
}
|
|
70
|
-
repeaterExpand() {
|
|
71
|
-
if (!this.isExpanded) {
|
|
72
|
-
this.setContainerMaxHeight();
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
this.isExpanded = true;
|
|
75
|
-
this.animateRepeater(true);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.setContainerMaxHeight();
|
|
80
|
-
setTimeout(() => {
|
|
81
|
-
this.isExpanded = false;
|
|
82
|
-
this.animateRepeater(false);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
setContainerMaxHeight() {
|
|
87
|
-
// ensure everything is reset
|
|
88
|
-
this.animationEnd();
|
|
89
|
-
/* Before animation is kicked off, ensure that a maxHeight exists */
|
|
90
|
-
/* Once we have support for angular v4 animations with parameters we can use that instead */
|
|
91
|
-
const currentHeight = this.textExpandRepeaterAdapter.getContainerHeight(this.containerEl);
|
|
92
|
-
this.textExpandRepeaterAdapter.setContainerHeight(this.containerEl, `${currentHeight}px`);
|
|
93
|
-
}
|
|
94
|
-
animateRepeater(expanding) {
|
|
95
|
-
const adapter = this.textExpandRepeaterAdapter;
|
|
96
|
-
const container = this.containerEl;
|
|
97
|
-
adapter.setContainerHeight(container, undefined);
|
|
98
|
-
const currentHeight = adapter.getContainerHeight(container);
|
|
99
|
-
for (let i = this.maxItems; i < this.contentItems.length; i++) {
|
|
100
|
-
if (!expanding) {
|
|
101
|
-
adapter.hideItem(this.items[i]);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
adapter.showItem(this.items[i]);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const newHeight = adapter.getContainerHeight(container);
|
|
108
|
-
if (!expanding) {
|
|
109
|
-
this.buttonText = this.seeMoreText;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this.buttonText = this.seeLessText;
|
|
113
|
-
}
|
|
114
|
-
if (newHeight < currentHeight) {
|
|
115
|
-
// The new text is smaller than the old text, so put the old text back before doing
|
|
116
|
-
// the collapse animation to avoid showing a big chunk of whitespace.
|
|
117
|
-
for (let i = this.maxItems; i < this.contentItems.length; i++) {
|
|
118
|
-
adapter.showItem(this.items[i]);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
adapter.setContainerHeight(container, `${currentHeight}px`);
|
|
122
|
-
// This timeout is necessary due to the browser needing to pick up the non-auto height being set
|
|
123
|
-
// in order to do the transtion in height correctly. Without it the transition does not fire.
|
|
124
|
-
setTimeout(() => {
|
|
125
|
-
adapter.setContainerHeight(container, `${newHeight}px`);
|
|
126
|
-
/* This resets values if the transition does not get kicked off */
|
|
127
|
-
setTimeout(() => {
|
|
128
|
-
this.animationEnd();
|
|
129
|
-
}, 500);
|
|
130
|
-
}, 10);
|
|
131
|
-
}
|
|
132
|
-
setup(value) {
|
|
133
|
-
if (value) {
|
|
134
|
-
const length = value.length;
|
|
135
|
-
if (length > this.maxItems) {
|
|
136
|
-
this.expandable = true;
|
|
137
|
-
this.buttonText = this.seeMoreText;
|
|
138
|
-
this.isExpanded = false;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
this.expandable = false;
|
|
142
|
-
}
|
|
143
|
-
this.contentItems = value;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.contentItems = undefined;
|
|
147
|
-
this.expandable = false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
SkyTextExpandRepeaterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterComponent, deps: [{ token: i1.SkyLibResourcesService }, { token: i0.ElementRef }, { token: i2.SkyTextExpandRepeaterAdapterService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
152
|
-
SkyTextExpandRepeaterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyTextExpandRepeaterComponent, selector: "sky-text-expand-repeater", inputs: { data: "data", itemTemplate: "itemTemplate", listStyle: "listStyle", maxItems: "maxItems" }, providers: [SkyTextExpandRepeaterAdapterService], viewQueries: [{ propertyName: "containerEl", first: true, predicate: ["container"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: "<div class=\"sky-text-expand-repeater\">\n <ul\n *ngIf=\"listStyle !== 'ordered'\"\n class=\"sky-text-expand-repeater-container\"\n [id]=\"contentSectionId\"\n (transitionend)=\"animationEnd()\"\n [ngClass]=\"{\n 'sky-text-expand-repeater-list-style-none': listStyle === 'unstyled'\n }\"\n #container\n >\n <ng-template [ngTemplateOutlet]=\"listItemTemplate\"></ng-template>\n </ul>\n <ol\n *ngIf=\"listStyle === 'ordered'\"\n class=\"sky-text-expand-repeater-container\"\n [id]=\"contentSectionId\"\n (transitionend)=\"animationEnd()\"\n #container\n >\n <ng-template [ngTemplateOutlet]=\"listItemTemplate\"></ng-template>\n </ol>\n <button\n *ngIf=\"expandable\"\n type=\"button\"\n class=\"sky-btn sky-btn-link-inline sky-text-expand-repeater-see-more\"\n [attr.aria-expanded]=\"isExpanded\"\n [attr.aria-controls]=\"contentSectionId\"\n (click)=\"repeaterExpand()\"\n [ngClass]=\"{\n 'sky-text-expand-repeater-see-more-list-style-none':\n listStyle === 'unstyled'\n }\"\n >\n {{ buttonText }}\n </button>\n</div>\n\n<ng-template let-item #defaultItemTemplate>\n {{ item }}\n</ng-template>\n\n<ng-template #listItemTemplate>\n <li *ngFor=\"let item of contentItems\" class=\"sky-text-expand-repeater-item\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate || defaultItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-template>\n </li>\n</ng-template>\n", styles: [".sky-text-expand-repeater-container{overflow-y:hidden;height:auto;margin-bottom:0;transition:max-height .25s}.sky-text-expand-repeater-see-more{white-space:nowrap;margin-left:40px}.sky-text-expand-repeater-list-style-none{list-style-type:none;padding-left:0}.sky-text-expand-repeater-see-more-list-style-none{margin-left:0}\n"], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterComponent, decorators: [{
|
|
154
|
-
type: Component,
|
|
155
|
-
args: [{
|
|
156
|
-
selector: 'sky-text-expand-repeater',
|
|
157
|
-
templateUrl: './text-expand-repeater.component.html',
|
|
158
|
-
styleUrls: ['./text-expand-repeater.component.scss'],
|
|
159
|
-
providers: [SkyTextExpandRepeaterAdapterService],
|
|
160
|
-
}]
|
|
161
|
-
}], ctorParameters: function () { return [{ type: i1.SkyLibResourcesService }, { type: i0.ElementRef }, { type: i2.SkyTextExpandRepeaterAdapterService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { data: [{
|
|
162
|
-
type: Input
|
|
163
|
-
}], itemTemplate: [{
|
|
164
|
-
type: Input
|
|
165
|
-
}], listStyle: [{
|
|
166
|
-
type: Input
|
|
167
|
-
}], maxItems: [{
|
|
168
|
-
type: Input
|
|
169
|
-
}], containerEl: [{
|
|
170
|
-
type: ViewChild,
|
|
171
|
-
args: ['container', {
|
|
172
|
-
read: ElementRef,
|
|
173
|
-
static: false,
|
|
174
|
-
}]
|
|
175
|
-
}] } });
|
|
176
|
-
//# sourceMappingURL=text-expand-repeater.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-expand-repeater.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/layout/src/lib/modules/text-expand-repeater/text-expand-repeater.component.ts","../../../../../../../../libs/components/layout/src/lib/modules/text-expand-repeater/text-expand-repeater.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,KAAK,EAGL,WAAW,EACX,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;;;;;AAG7F;;GAEG;AACH,IAAI,MAAM,GAAG,CAAC,CAAC;AAQf,MAAM,OAAO,8BAA8B;IA8CzC,YACU,SAAiC,EACjC,KAAiB,EACjB,yBAA8D,EAC9D,cAAiC;QAHjC,cAAS,GAAT,SAAS,CAAwB;QACjC,UAAK,GAAL,KAAK,CAAY;QACjB,8BAAyB,GAAzB,y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;sBAJlB,SAAS;uBAAC,WAAW,EAAE;wBACtB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,KAAK;qBACd","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n OnChanges,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n} from '@angular/core';\nimport { SkyLibResourcesService } from '@skyux/i18n';\n\nimport { forkJoin as observableForkJoin } from 'rxjs';\nimport { take } from 'rxjs/operators';\n\nimport { SkyTextExpandRepeaterAdapterService } from './text-expand-repeater-adapter.service';\nimport { SkyTextExpandRepeaterListStyleType } from './types/text-expand-repeater-list-style-type';\n\n/**\n * Auto-incrementing integer used to generate unique ids for text expand repeater components.\n */\nlet nextId = 0;\n\n@Component({\n selector: 'sky-text-expand-repeater',\n templateUrl: './text-expand-repeater.component.html',\n styleUrls: ['./text-expand-repeater.component.scss'],\n providers: [SkyTextExpandRepeaterAdapterService],\n})\nexport class SkyTextExpandRepeaterComponent\n implements AfterViewInit, OnChanges\n{\n /**\n * Specifies the data to truncate.\n */\n @Input()\n public data: any[];\n\n /**\n * Specifies a template for items in the list.\n */\n @Input()\n public itemTemplate: TemplateRef<any>;\n\n /**\n * Specifies the style of bullet to use\n * @default \"unordered\"\n */\n @Input()\n public listStyle: SkyTextExpandRepeaterListStyleType = 'unordered';\n\n /**\n * Specifies the number of items to display before truncating the list.\n */\n @Input()\n public maxItems: number;\n\n public buttonText: string;\n public contentItems: Array<any>;\n public expandable: boolean;\n public contentSectionId = `sky-text-expand-repeater-content-${++nextId}`;\n\n public isExpanded = false;\n\n private seeMoreText: string;\n private seeLessText: string;\n\n @ViewChild('container', {\n read: ElementRef,\n static: false,\n })\n private containerEl: ElementRef;\n\n private items: Array<HTMLElement>;\n\n constructor(\n private resources: SkyLibResourcesService,\n private elRef: ElementRef,\n private textExpandRepeaterAdapter: SkyTextExpandRepeaterAdapterService,\n private changeDetector: ChangeDetectorRef\n ) {}\n\n public ngAfterViewInit() {\n if (this.contentItems) {\n this.items = this.textExpandRepeaterAdapter.getItems(this.elRef);\n for (let i = this.maxItems; i < this.contentItems.length; i++) {\n this.textExpandRepeaterAdapter.hideItem(this.items[i]);\n }\n }\n\n observableForkJoin([\n this.resources.getString('skyux_text_expand_see_more'),\n this.resources.getString('skyux_text_expand_see_less'),\n ])\n .pipe(take(1))\n .subscribe((resources) => {\n this.seeMoreText = resources[0];\n this.seeLessText = resources[1];\n /* sanity check */\n /* istanbul ignore else */\n if (!this.isExpanded) {\n this.buttonText = this.seeMoreText;\n } else {\n this.buttonText = this.seeLessText;\n }\n this.changeDetector.detectChanges();\n });\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n /* istanbul ignore else */\n if (changes.maxItems || changes.data) {\n this.setup(this.data);\n }\n }\n\n public animationEnd() {\n // Ensure the correct items are displayed\n if (!this.isExpanded) {\n for (let i = this.maxItems; i < this.contentItems.length; i++) {\n this.textExpandRepeaterAdapter.hideItem(this.items[i]);\n }\n }\n // Set height back to auto so the browser can change the height as needed with window changes\n this.textExpandRepeaterAdapter.setContainerHeight(\n this.containerEl,\n undefined\n );\n }\n\n public repeaterExpand() {\n if (!this.isExpanded) {\n this.setContainerMaxHeight();\n setTimeout(() => {\n this.isExpanded = true;\n this.animateRepeater(true);\n });\n } else {\n this.setContainerMaxHeight();\n setTimeout(() => {\n this.isExpanded = false;\n this.animateRepeater(false);\n });\n }\n }\n\n private setContainerMaxHeight() {\n // ensure everything is reset\n this.animationEnd();\n /* Before animation is kicked off, ensure that a maxHeight exists */\n /* Once we have support for angular v4 animations with parameters we can use that instead */\n const currentHeight = this.textExpandRepeaterAdapter.getContainerHeight(\n this.containerEl\n );\n this.textExpandRepeaterAdapter.setContainerHeight(\n this.containerEl,\n `${currentHeight}px`\n );\n }\n\n private animateRepeater(expanding: boolean) {\n const adapter = this.textExpandRepeaterAdapter;\n const container = this.containerEl;\n\n adapter.setContainerHeight(container, undefined);\n const currentHeight = adapter.getContainerHeight(container);\n for (let i = this.maxItems; i < this.contentItems.length; i++) {\n if (!expanding) {\n adapter.hideItem(this.items[i]);\n } else {\n adapter.showItem(this.items[i]);\n }\n }\n const newHeight = adapter.getContainerHeight(container);\n if (!expanding) {\n this.buttonText = this.seeMoreText;\n } else {\n this.buttonText = this.seeLessText;\n }\n if (newHeight < currentHeight) {\n // The new text is smaller than the old text, so put the old text back before doing\n // the collapse animation to avoid showing a big chunk of whitespace.\n for (let i = this.maxItems; i < this.contentItems.length; i++) {\n adapter.showItem(this.items[i]);\n }\n }\n\n adapter.setContainerHeight(container, `${currentHeight}px`);\n // This timeout is necessary due to the browser needing to pick up the non-auto height being set\n // in order to do the transtion in height correctly. Without it the transition does not fire.\n setTimeout(() => {\n adapter.setContainerHeight(container, `${newHeight}px`);\n /* This resets values if the transition does not get kicked off */\n setTimeout(() => {\n this.animationEnd();\n }, 500);\n }, 10);\n }\n\n private setup(value: Array<any>) {\n if (value) {\n const length = value.length;\n if (length > this.maxItems) {\n this.expandable = true;\n this.buttonText = this.seeMoreText;\n this.isExpanded = false;\n } else {\n this.expandable = false;\n }\n this.contentItems = value;\n } else {\n this.contentItems = undefined;\n this.expandable = false;\n }\n }\n}\n","<div class=\"sky-text-expand-repeater\">\n <ul\n *ngIf=\"listStyle !== 'ordered'\"\n class=\"sky-text-expand-repeater-container\"\n [id]=\"contentSectionId\"\n (transitionend)=\"animationEnd()\"\n [ngClass]=\"{\n 'sky-text-expand-repeater-list-style-none': listStyle === 'unstyled'\n }\"\n #container\n >\n <ng-template [ngTemplateOutlet]=\"listItemTemplate\"></ng-template>\n </ul>\n <ol\n *ngIf=\"listStyle === 'ordered'\"\n class=\"sky-text-expand-repeater-container\"\n [id]=\"contentSectionId\"\n (transitionend)=\"animationEnd()\"\n #container\n >\n <ng-template [ngTemplateOutlet]=\"listItemTemplate\"></ng-template>\n </ol>\n <button\n *ngIf=\"expandable\"\n type=\"button\"\n class=\"sky-btn sky-btn-link-inline sky-text-expand-repeater-see-more\"\n [attr.aria-expanded]=\"isExpanded\"\n [attr.aria-controls]=\"contentSectionId\"\n (click)=\"repeaterExpand()\"\n [ngClass]=\"{\n 'sky-text-expand-repeater-see-more-list-style-none':\n listStyle === 'unstyled'\n }\"\n >\n {{ buttonText }}\n </button>\n</div>\n\n<ng-template let-item #defaultItemTemplate>\n {{ item }}\n</ng-template>\n\n<ng-template #listItemTemplate>\n <li *ngFor=\"let item of contentItems\" class=\"sky-text-expand-repeater-item\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate || defaultItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-template>\n </li>\n</ng-template>\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { SkyI18nModule } from '@skyux/i18n';
|
|
4
|
-
import { SkyLayoutResourcesModule } from '../shared/sky-layout-resources.module';
|
|
5
|
-
import { SkyTextExpandRepeaterComponent } from './text-expand-repeater.component';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
export class SkyTextExpandRepeaterModule {
|
|
8
|
-
}
|
|
9
|
-
SkyTextExpandRepeaterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
10
|
-
SkyTextExpandRepeaterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterModule, declarations: [SkyTextExpandRepeaterComponent], imports: [SkyI18nModule, SkyLayoutResourcesModule, CommonModule], exports: [SkyTextExpandRepeaterComponent] });
|
|
11
|
-
SkyTextExpandRepeaterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterModule, imports: [[SkyI18nModule, SkyLayoutResourcesModule, CommonModule]] });
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextExpandRepeaterModule, decorators: [{
|
|
13
|
-
type: NgModule,
|
|
14
|
-
args: [{
|
|
15
|
-
declarations: [SkyTextExpandRepeaterComponent],
|
|
16
|
-
imports: [SkyI18nModule, SkyLayoutResourcesModule, CommonModule],
|
|
17
|
-
exports: [SkyTextExpandRepeaterComponent],
|
|
18
|
-
}]
|
|
19
|
-
}] });
|
|
20
|
-
//# sourceMappingURL=text-expand-repeater.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-expand-repeater.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/layout/src/lib/modules/text-expand-repeater/text-expand-repeater.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;;AAOlF,MAAM,OAAO,2BAA2B;;yHAA3B,2BAA2B;0HAA3B,2BAA2B,iBAJvB,8BAA8B,aACnC,aAAa,EAAE,wBAAwB,EAAE,YAAY,aACrD,8BAA8B;0HAE7B,2BAA2B,YAH7B,CAAC,aAAa,EAAE,wBAAwB,EAAE,YAAY,CAAC;4FAGrD,2BAA2B;kBALvC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,8BAA8B,CAAC;oBAC9C,OAAO,EAAE,CAAC,aAAa,EAAE,wBAAwB,EAAE,YAAY,CAAC;oBAChE,OAAO,EAAE,CAAC,8BAA8B,CAAC;iBAC1C","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SkyI18nModule } from '@skyux/i18n';\n\nimport { SkyLayoutResourcesModule } from '../shared/sky-layout-resources.module';\n\nimport { SkyTextExpandRepeaterComponent } from './text-expand-repeater.component';\n\n@NgModule({\n declarations: [SkyTextExpandRepeaterComponent],\n imports: [SkyI18nModule, SkyLayoutResourcesModule, CommonModule],\n exports: [SkyTextExpandRepeaterComponent],\n})\nexport class SkyTextExpandRepeaterModule {}\n"]}
|
package/esm2015/lib/modules/text-expand-repeater/types/text-expand-repeater-list-style-type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-expand-repeater-list-style-type.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/layout/src/lib/modules/text-expand-repeater/types/text-expand-repeater-list-style-type.ts"],"names":[],"mappings":"","sourcesContent":["export type SkyTextExpandRepeaterListStyleType =\n | 'unordered'\n | 'ordered'\n | 'unstyled';\n"]}
|