@koobiq/components 17.0.0-rc.9 → 17.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/alert/_alert-theme.scss +0 -1
- package/alert/alert.component.d.ts +3 -1
- package/alert/alert.component.scss +14 -14
- package/alert/public-api.d.ts +1 -1
- package/autocomplete/_autocomplete-theme.scss +0 -1
- package/autocomplete/autocomplete.scss +3 -6
- package/autocomplete/public-api.d.ts +2 -2
- package/badge/_badge-theme.scss +1 -2
- package/badge/badge.component.scss +0 -1
- package/badge/public-api.d.ts +1 -1
- package/button/_button-base.scss +0 -1
- package/button/_button-theme.scss +5 -3
- package/button/button.component.d.ts +2 -2
- package/button/button.scss +0 -1
- package/button/public-api.d.ts +1 -1
- package/button-toggle/_button-toggle-theme.scss +2 -3
- package/button-toggle/button-toggle.scss +2 -9
- package/button-toggle/public-api.d.ts +1 -1
- package/card/_card-theme.scss +0 -1
- package/card/card.component.d.ts +1 -1
- package/card/card.component.scss +1 -2
- package/card/public-api.d.ts +1 -1
- package/checkbox/_checkbox-theme.scss +10 -11
- package/checkbox/checkbox.scss +13 -19
- package/code-block/README.md +17 -14
- package/code-block/_code-block-theme.scss +23 -16
- package/code-block/actionbar.component.d.ts +2 -1
- package/code-block/actionbar.component.scss +5 -13
- package/code-block/code-block.component.d.ts +4 -3
- package/code-block/code-block.scss +8 -14
- package/code-block/public-api.d.ts +1 -1
- package/core/animation/index.d.ts +1 -1
- package/core/common-behaviors/index.d.ts +3 -3
- package/core/datetime/index.d.ts +1 -1
- package/core/formatters/index.d.ts +1 -1
- package/core/forms/_forms-theme.scss +0 -1
- package/core/forms/_forms.scss +0 -1
- package/core/forms/index.d.ts +1 -1
- package/core/locales/index.d.ts +1 -1
- package/core/option/_optgroup-theme.scss +0 -1
- package/core/option/_option-action-theme.scss +0 -1
- package/core/option/_option-theme.scss +0 -1
- package/core/option/action.scss +4 -2
- package/core/option/index.d.ts +2 -2
- package/core/option/optgroup.scss +2 -3
- package/core/option/option.scss +0 -1
- package/core/pop-up/_pop-up.scss +0 -1
- package/core/pop-up/pop-up-trigger.d.ts +3 -3
- package/core/public-api.d.ts +3 -3
- package/core/select/constants.d.ts +1 -1
- package/core/select/index.d.ts +3 -3
- package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +0 -2
- package/core/selection/pseudo-checkbox/pseudo-checkbox.scss +0 -1
- package/core/services/theme.service.d.ts +3 -2
- package/core/styles/_core.scss +0 -1
- package/core/styles/_koobiq-theme.scss +5 -3
- package/core/styles/common/_animation.scss +11 -10
- package/core/styles/common/_button.scss +0 -2
- package/core/styles/common/_clearfix.scss +1 -1
- package/core/styles/common/_groups.scss +0 -4
- package/core/styles/common/_list.scss +23 -61
- package/core/styles/common/_overlay.scss +4 -3
- package/core/styles/common/_popup.scss +0 -1
- package/core/styles/common/_rtl.scss +4 -4
- package/core/styles/common/_select.scss +37 -26
- package/core/styles/common/_tokens.scss +0 -2
- package/core/styles/functions/_number.scss +14 -19
- package/core/styles/functions/_string.scss +18 -19
- package/core/styles/functions/_timing.scss +24 -24
- package/core/styles/theming/_components-theming.scss +1120 -1208
- package/core/styles/theming/_scrollbar-theme.scss +8 -5
- package/core/styles/theming/_theming.scss +22 -20
- package/core/styles/typography/_typography-utils.scss +9 -3
- package/core/styles/typography/_typography.scss +114 -94
- package/core/styles/visual/_body.scss +0 -2
- package/core/styles/visual/_layout.scss +30 -22
- package/core/utils/data-size/index.d.ts +1 -1
- package/core/utils/public-api.d.ts +1 -1
- package/datepicker/_datepicker-theme.scss +21 -8
- package/datepicker/calendar-body.scss +0 -3
- package/datepicker/calendar-header.scss +0 -1
- package/datepicker/calendar.scss +1 -2
- package/datepicker/datepicker-content.scss +1 -3
- package/datepicker/datepicker-input.directive.d.ts +1 -0
- package/datepicker/datepicker-input.scss +0 -1
- package/datepicker/datepicker-toggle.scss +0 -1
- package/datepicker/datepicker.component.d.ts +2 -2
- package/datepicker/public-api.d.ts +4 -4
- package/divider/_divider-theme.scss +0 -1
- package/divider/divider.scss +0 -1
- package/dl/_dl-theme.scss +0 -2
- package/dl/dl.scss +0 -1
- package/dl/public-api.d.ts +1 -1
- package/dropdown/_dropdown-theme.scss +4 -2
- package/dropdown/dropdown-content.directive.d.ts +1 -1
- package/dropdown/dropdown-item.component.d.ts +1 -1
- package/dropdown/dropdown-item.scss +9 -7
- package/dropdown/dropdown.component.d.ts +1 -1
- package/dropdown/dropdown.scss +0 -1
- package/dropdown/public-api.d.ts +5 -5
- package/ellipsis-center/ellipsis-center.directive.d.ts +1 -1
- package/empty-state/README.md +0 -0
- package/empty-state/_empty-state-theme.scss +56 -0
- package/empty-state/empty-state.component.d.ts +31 -0
- package/empty-state/empty-state.module.d.ts +10 -0
- package/empty-state/empty-state.scss +81 -0
- package/empty-state/index.d.ts +1 -0
- package/empty-state/public-api.d.ts +2 -0
- package/esm2022/alert/alert.component.mjs +7 -3
- package/esm2022/alert/alert.module.mjs +1 -1
- package/esm2022/alert/public-api.mjs +2 -2
- package/esm2022/autocomplete/autocomplete-origin.directive.mjs +1 -1
- package/esm2022/autocomplete/autocomplete-trigger.directive.mjs +25 -42
- package/esm2022/autocomplete/autocomplete.component.mjs +14 -9
- package/esm2022/autocomplete/autocomplete.module.mjs +3 -3
- package/esm2022/autocomplete/public-api.mjs +3 -3
- package/esm2022/badge/badge.component.mjs +8 -6
- package/esm2022/badge/badge.module.mjs +1 -1
- package/esm2022/badge/public-api.mjs +2 -2
- package/esm2022/button/button.component.mjs +12 -9
- package/esm2022/button/button.module.mjs +1 -1
- package/esm2022/button/public-api.mjs +2 -2
- package/esm2022/button-toggle/button-toggle.component.mjs +26 -20
- package/esm2022/button-toggle/button-toggle.module.mjs +1 -1
- package/esm2022/button-toggle/public-api.mjs +2 -2
- package/esm2022/card/card.component.mjs +4 -5
- package/esm2022/card/card.module.mjs +1 -1
- package/esm2022/card/public-api.mjs +2 -2
- package/esm2022/checkbox/checkbox-config.mjs +1 -1
- package/esm2022/checkbox/checkbox-module.mjs +1 -1
- package/esm2022/checkbox/checkbox-required-validator.mjs +1 -1
- package/esm2022/checkbox/checkbox.mjs +6 -8
- package/esm2022/checkbox/public-api.mjs +1 -1
- package/esm2022/code-block/actionbar.component.mjs +6 -6
- package/esm2022/code-block/code-block.component.mjs +20 -19
- package/esm2022/code-block/code-block.module.mjs +9 -5
- package/esm2022/code-block/public-api.mjs +2 -2
- package/esm2022/core/animation/fade-animations.mjs +1 -1
- package/esm2022/core/animation/index.mjs +2 -2
- package/esm2022/core/animation/select-animations.mjs +2 -2
- package/esm2022/core/common-behaviors/color.mjs +4 -2
- package/esm2022/core/common-behaviors/common-module.mjs +2 -5
- package/esm2022/core/common-behaviors/constructor.mjs +1 -1
- package/esm2022/core/common-behaviors/disabled.mjs +2 -2
- package/esm2022/core/common-behaviors/error-state.mjs +1 -1
- package/esm2022/core/common-behaviors/index.mjs +4 -4
- package/esm2022/core/common-behaviors/tabindex.mjs +1 -1
- package/esm2022/core/datetime/date-adapter.mjs +1 -2
- package/esm2022/core/datetime/date-formats.mjs +1 -1
- package/esm2022/core/datetime/index.mjs +2 -2
- package/esm2022/core/error/error-options.mjs +1 -1
- package/esm2022/core/form-field/form-field-ref.mjs +1 -1
- package/esm2022/core/formatters/date/formatter.mjs +1 -1
- package/esm2022/core/formatters/date/formatter.pipe.mjs +1 -1
- package/esm2022/core/formatters/index.mjs +2 -2
- package/esm2022/core/formatters/number/formatter.mjs +19 -24
- package/esm2022/core/forms/forms-module.mjs +1 -1
- package/esm2022/core/forms/forms.directive.mjs +1 -1
- package/esm2022/core/forms/index.mjs +2 -2
- package/esm2022/core/highlight/highlight.pipe.mjs +1 -1
- package/esm2022/core/highlight/index.mjs +1 -1
- package/esm2022/core/label/label-options.mjs +1 -1
- package/esm2022/core/line/line.mjs +2 -2
- package/esm2022/core/locales/en-US.mjs +1 -1
- package/esm2022/core/locales/es-LA.mjs +1 -1
- package/esm2022/core/locales/fa-IR.mjs +1 -1
- package/esm2022/core/locales/formatters.mjs +1 -3
- package/esm2022/core/locales/index.mjs +2 -2
- package/esm2022/core/locales/locale-service.mjs +8 -5
- package/esm2022/core/locales/locale-service.module.mjs +1 -1
- package/esm2022/core/locales/pt-BR.mjs +1 -1
- package/esm2022/core/locales/ru-RU.mjs +3 -3
- package/esm2022/core/locales/zh-CN.mjs +1 -1
- package/esm2022/core/option/action.mjs +22 -14
- package/esm2022/core/option/index.mjs +3 -3
- package/esm2022/core/option/optgroup.mjs +4 -5
- package/esm2022/core/option/option-module.mjs +1 -1
- package/esm2022/core/option/option.mjs +13 -10
- package/esm2022/core/overlay/overlay-position-map.mjs +1 -1
- package/esm2022/core/pop-up/pop-up-trigger.mjs +14 -24
- package/esm2022/core/pop-up/pop-up.mjs +1 -2
- package/esm2022/core/public-api.mjs +4 -4
- package/esm2022/core/select/common.mjs +2 -5
- package/esm2022/core/select/constants.mjs +1 -2
- package/esm2022/core/select/index.mjs +4 -4
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +3 -3
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.module.mjs +1 -1
- package/esm2022/core/services/measure-scrollbar.service.mjs +1 -2
- package/esm2022/core/services/theme.service.mjs +5 -4
- package/esm2022/core/title/title-text-ref.mjs +1 -1
- package/esm2022/core/utils/data-size/config.mjs +1 -1
- package/esm2022/core/utils/data-size/data-size.pipe.mjs +2 -3
- package/esm2022/core/utils/data-size/index.mjs +2 -2
- package/esm2022/core/utils/data-size/size.mjs +3 -6
- package/esm2022/core/utils/public-api.mjs +2 -2
- package/esm2022/core/utils/utils.mjs +4 -2
- package/esm2022/core/validation/validation.mjs +4 -2
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/datepicker/calendar-body.component.mjs +3 -5
- package/esm2022/datepicker/calendar-header.component.mjs +8 -8
- package/esm2022/datepicker/calendar.component.mjs +6 -6
- package/esm2022/datepicker/datepicker-animations.mjs +1 -1
- package/esm2022/datepicker/datepicker-errors.mjs +1 -1
- package/esm2022/datepicker/datepicker-input.directive.mjs +47 -49
- package/esm2022/datepicker/datepicker-intl.mjs +1 -1
- package/esm2022/datepicker/datepicker-module.mjs +2 -2
- package/esm2022/datepicker/datepicker-toggle.component.mjs +11 -10
- package/esm2022/datepicker/datepicker.component.mjs +15 -18
- package/esm2022/datepicker/month-view.component.mjs +14 -14
- package/esm2022/datepicker/public-api.mjs +5 -5
- package/esm2022/divider/divider.component.mjs +1 -1
- package/esm2022/divider/divider.module.mjs +1 -1
- package/esm2022/dl/dl.component.mjs +7 -7
- package/esm2022/dl/dl.module.mjs +2 -2
- package/esm2022/dl/public-api.mjs +2 -2
- package/esm2022/dropdown/dropdown-animations.mjs +2 -2
- package/esm2022/dropdown/dropdown-content.directive.mjs +3 -3
- package/esm2022/dropdown/dropdown-item.component.mjs +5 -8
- package/esm2022/dropdown/dropdown-trigger.directive.mjs +24 -33
- package/esm2022/dropdown/dropdown.component.mjs +10 -19
- package/esm2022/dropdown/dropdown.module.mjs +1 -1
- package/esm2022/dropdown/dropdown.types.mjs +1 -2
- package/esm2022/dropdown/public-api.mjs +6 -6
- package/esm2022/ellipsis-center/ellipsis-center.directive.mjs +6 -5
- package/esm2022/empty-state/empty-state.component.mjs +104 -0
- package/esm2022/empty-state/empty-state.module.mjs +50 -0
- package/esm2022/empty-state/index.mjs +2 -0
- package/esm2022/empty-state/koobiq-components-empty-state.mjs +5 -0
- package/esm2022/empty-state/public-api.mjs +3 -0
- package/esm2022/file-upload/file-drop.mjs +3 -2
- package/esm2022/file-upload/file-upload.mjs +1 -1
- package/esm2022/file-upload/file-upload.module.mjs +2 -2
- package/esm2022/file-upload/index.mjs +1 -1
- package/esm2022/file-upload/multiple-file-upload.component.mjs +16 -14
- package/esm2022/file-upload/public-api.mjs +2 -2
- package/esm2022/file-upload/single-file-upload.component.mjs +14 -12
- package/esm2022/form-field/cleaner.mjs +13 -3
- package/esm2022/form-field/form-field-control.mjs +1 -2
- package/esm2022/form-field/form-field-errors.mjs +1 -1
- package/esm2022/form-field/form-field.mjs +8 -15
- package/esm2022/form-field/form-field.module.mjs +1 -1
- package/esm2022/form-field/hint.mjs +6 -6
- package/esm2022/form-field/password-hint.mjs +15 -15
- package/esm2022/form-field/password-toggle.mjs +4 -7
- package/esm2022/form-field/prefix.mjs +1 -1
- package/esm2022/form-field/public-api.mjs +4 -4
- package/esm2022/form-field/stepper.mjs +33 -29
- package/esm2022/form-field/suffix.mjs +1 -1
- package/esm2022/form-field/validate.directive.mjs +6 -7
- package/esm2022/icon/icon-button.component.mjs +4 -4
- package/esm2022/icon/icon-item.component.mjs +3 -3
- package/esm2022/icon/icon.component.mjs +5 -6
- package/esm2022/icon/icon.module.mjs +1 -1
- package/esm2022/icon/public-api.mjs +3 -3
- package/esm2022/input/input-number-validators.mjs +1 -1
- package/esm2022/input/input-number.mjs +29 -41
- package/esm2022/input/input-password.mjs +13 -8
- package/esm2022/input/input-value-accessor.mjs +1 -1
- package/esm2022/input/input.mjs +13 -10
- package/esm2022/input/input.module.mjs +1 -1
- package/esm2022/input/public-api.mjs +3 -3
- package/esm2022/link/link.component.mjs +2 -2
- package/esm2022/link/link.module.mjs +1 -1
- package/esm2022/link/public-api.mjs +2 -2
- package/esm2022/list/list-selection.component.mjs +36 -41
- package/esm2022/list/list.component.mjs +5 -6
- package/esm2022/list/list.module.mjs +2 -2
- package/esm2022/list/public-api.mjs +3 -3
- package/esm2022/loader-overlay/loader-overlay.component.mjs +3 -3
- package/esm2022/loader-overlay/loader-overlay.module.mjs +1 -1
- package/esm2022/loader-overlay/public-api.mjs +2 -2
- package/esm2022/markdown/markdown.component.mjs +20 -6
- package/esm2022/markdown/markdown.module.mjs +1 -1
- package/esm2022/markdown/markdown.service.mjs +1 -1
- package/esm2022/modal/css-unit.pipe.mjs +1 -1
- package/esm2022/modal/modal-control.service.mjs +6 -2
- package/esm2022/modal/modal-ref.class.mjs +1 -2
- package/esm2022/modal/modal-util.mjs +1 -1
- package/esm2022/modal/modal.component.mjs +60 -33
- package/esm2022/modal/modal.directive.mjs +27 -11
- package/esm2022/modal/modal.module.mjs +2 -2
- package/esm2022/modal/modal.service.mjs +3 -6
- package/esm2022/modal/modal.type.mjs +1 -1
- package/esm2022/modal/public-api.mjs +3 -3
- package/esm2022/navbar/index.mjs +1 -1
- package/esm2022/navbar/navbar-item.component.mjs +41 -33
- package/esm2022/navbar/navbar.component.mjs +19 -29
- package/esm2022/navbar/navbar.module.mjs +2 -2
- package/esm2022/navbar/public-api.mjs +3 -3
- package/esm2022/navbar/vertical-navbar.component.mjs +21 -23
- package/esm2022/popover/popover-animations.mjs +1 -1
- package/esm2022/popover/popover-confirm.component.mjs +3 -3
- package/esm2022/popover/popover.component.mjs +5 -5
- package/esm2022/popover/popover.module.mjs +1 -1
- package/esm2022/popover/public-api.mjs +3 -3
- package/esm2022/progress-bar/progress-bar.component.mjs +4 -4
- package/esm2022/progress-bar/progress-bar.module.mjs +2 -2
- package/esm2022/progress-bar/public-api.mjs +2 -2
- package/esm2022/progress-spinner/progress-spinner.component.mjs +4 -4
- package/esm2022/progress-spinner/progress-spinner.module.mjs +1 -1
- package/esm2022/progress-spinner/public-api.mjs +2 -2
- package/esm2022/radio/public-api.mjs +2 -2
- package/esm2022/radio/radio.component.mjs +9 -14
- package/esm2022/radio/radio.module.mjs +1 -1
- package/esm2022/risk-level/public-api.mjs +2 -2
- package/esm2022/risk-level/risk-level.component.mjs +3 -3
- package/esm2022/risk-level/risk-level.module.mjs +1 -1
- package/esm2022/scrollbar/public-api.mjs +2 -2
- package/esm2022/scrollbar/scrollbar.component.mjs +19 -21
- package/esm2022/scrollbar/scrollbar.directive.mjs +4 -5
- package/esm2022/scrollbar/scrollbar.module.mjs +2 -2
- package/esm2022/scrollbar/scrollbar.types.mjs +3 -2
- package/esm2022/select/public-api.mjs +3 -3
- package/esm2022/select/select-option.directive.mjs +8 -5
- package/esm2022/select/select.component.mjs +45 -71
- package/esm2022/select/select.module.mjs +1 -1
- package/esm2022/sidebar/public-api.mjs +2 -2
- package/esm2022/sidebar/sidebar-animations.mjs +1 -1
- package/esm2022/sidebar/sidebar.component.mjs +5 -7
- package/esm2022/sidebar/sidebar.module.mjs +1 -1
- package/esm2022/sidepanel/public-api.mjs +4 -4
- package/esm2022/sidepanel/sidepanel-animations.mjs +7 -4
- package/esm2022/sidepanel/sidepanel-config.mjs +1 -1
- package/esm2022/sidepanel/sidepanel-container.component.mjs +4 -4
- package/esm2022/sidepanel/sidepanel-directives.mjs +33 -20
- package/esm2022/sidepanel/sidepanel-ref.mjs +10 -5
- package/esm2022/sidepanel/sidepanel.module.mjs +1 -1
- package/esm2022/sidepanel/sidepanel.service.mjs +11 -15
- package/esm2022/splitter/public-api.mjs +2 -2
- package/esm2022/splitter/splitter.component.mjs +13 -24
- package/esm2022/splitter/splitter.module.mjs +1 -1
- package/esm2022/table/public-api.mjs +2 -2
- package/esm2022/table/table.component.mjs +3 -3
- package/esm2022/table/table.module.mjs +1 -1
- package/esm2022/tabs/paginated-tab-header.mjs +9 -14
- package/esm2022/tabs/public-api.mjs +6 -6
- package/esm2022/tabs/tab-body.component.mjs +10 -11
- package/esm2022/tabs/tab-content.directive.mjs +1 -1
- package/esm2022/tabs/tab-group.component.mjs +11 -13
- package/esm2022/tabs/tab-header.component.mjs +4 -4
- package/esm2022/tabs/tab-label-wrapper.directive.mjs +1 -1
- package/esm2022/tabs/tab-label.directive.mjs +1 -1
- package/esm2022/tabs/tab-nav-bar/index.mjs +1 -1
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +46 -49
- package/esm2022/tabs/tab.component.mjs +7 -10
- package/esm2022/tabs/tabs-animations.mjs +1 -1
- package/esm2022/tabs/tabs.module.mjs +2 -2
- package/esm2022/tags/public-api.mjs +5 -5
- package/esm2022/tags/tag-default-options.mjs +1 -1
- package/esm2022/tags/tag-input.mjs +12 -16
- package/esm2022/tags/tag-list.component.mjs +15 -27
- package/esm2022/tags/tag-text-control.mjs +1 -1
- package/esm2022/tags/tag.component.mjs +5 -8
- package/esm2022/tags/tag.module.mjs +9 -7
- package/esm2022/textarea/index.mjs +1 -1
- package/esm2022/textarea/textarea.component.mjs +4 -7
- package/esm2022/textarea/textarea.module.mjs +1 -1
- package/esm2022/timepicker/public-api.mjs +2 -2
- package/esm2022/timepicker/timepicker.constants.mjs +6 -2
- package/esm2022/timepicker/timepicker.directive.mjs +62 -31
- package/esm2022/timepicker/timepicker.module.mjs +1 -1
- package/esm2022/timezone/cities-by-filter.pipe.mjs +1 -1
- package/esm2022/timezone/timezone-option.component.mjs +12 -11
- package/esm2022/timezone/timezone-option.directive.mjs +3 -3
- package/esm2022/timezone/timezone-select.component.mjs +5 -5
- package/esm2022/timezone/timezone.models.mjs +1 -2
- package/esm2022/timezone/timezone.module.mjs +1 -1
- package/esm2022/timezone/timezone.utils.mjs +5 -9
- package/esm2022/timezone/utc-offset.pipe.mjs +1 -1
- package/esm2022/title/public-api.mjs +2 -2
- package/esm2022/title/title.directive.mjs +9 -5
- package/esm2022/title/title.module.mjs +1 -1
- package/esm2022/toast/public-api.mjs +4 -4
- package/esm2022/toast/toast-animations.mjs +2 -2
- package/esm2022/toast/toast-container.component.mjs +5 -6
- package/esm2022/toast/toast.component.mjs +6 -6
- package/esm2022/toast/toast.module.mjs +1 -1
- package/esm2022/toast/toast.service.mjs +18 -30
- package/esm2022/toast/toast.type.mjs +1 -1
- package/esm2022/toggle/public-api.mjs +2 -2
- package/esm2022/toggle/toggle.component.mjs +17 -11
- package/esm2022/toggle/toggle.module.mjs +1 -1
- package/esm2022/tooltip/public-api.mjs +2 -2
- package/esm2022/tooltip/tooltip.animations.mjs +1 -1
- package/esm2022/tooltip/tooltip.component.mjs +7 -7
- package/esm2022/tooltip/tooltip.module.mjs +2 -2
- package/esm2022/tree/control/base-tree-control.mjs +1 -2
- package/esm2022/tree/control/flat-tree-control.filters.mjs +4 -7
- package/esm2022/tree/control/flat-tree-control.mjs +4 -7
- package/esm2022/tree/control/nested-tree-control.mjs +1 -2
- package/esm2022/tree/control/tree-control.mjs +1 -1
- package/esm2022/tree/data-source/flat-data-source.mjs +3 -8
- package/esm2022/tree/data-source/nested-data-source.mjs +2 -4
- package/esm2022/tree/node.mjs +1 -1
- package/esm2022/tree/outlet.mjs +1 -1
- package/esm2022/tree/padding.directive.mjs +4 -5
- package/esm2022/tree/public-api.mjs +11 -11
- package/esm2022/tree/toggle.mjs +8 -5
- package/esm2022/tree/tree-base.mjs +3 -7
- package/esm2022/tree/tree-errors.mjs +1 -1
- package/esm2022/tree/tree-option.component.mjs +9 -13
- package/esm2022/tree/tree-selection.component.mjs +20 -36
- package/esm2022/tree/tree.mjs +7 -3
- package/esm2022/tree/tree.module.mjs +2 -3
- package/esm2022/tree-select/public-api.mjs +2 -2
- package/esm2022/tree-select/tree-select.component.mjs +59 -72
- package/esm2022/tree-select/tree-select.module.mjs +1 -1
- package/fesm2022/koobiq-components-alert.mjs +10 -6
- package/fesm2022/koobiq-components-alert.mjs.map +1 -1
- package/fesm2022/koobiq-components-autocomplete.mjs +60 -72
- package/fesm2022/koobiq-components-autocomplete.mjs.map +1 -1
- package/fesm2022/koobiq-components-badge.mjs +10 -8
- package/fesm2022/koobiq-components-badge.mjs.map +1 -1
- package/fesm2022/koobiq-components-button-toggle.mjs +30 -24
- package/fesm2022/koobiq-components-button-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-button.mjs +14 -11
- package/fesm2022/koobiq-components-button.mjs.map +1 -1
- package/fesm2022/koobiq-components-card.mjs +4 -5
- package/fesm2022/koobiq-components-card.mjs.map +1 -1
- package/fesm2022/koobiq-components-checkbox.mjs +3 -5
- package/fesm2022/koobiq-components-checkbox.mjs.map +1 -1
- package/fesm2022/koobiq-components-code-block.mjs +39 -34
- package/fesm2022/koobiq-components-code-block.mjs.map +1 -1
- package/fesm2022/koobiq-components-core.mjs +325 -336
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-datepicker.mjs +105 -111
- package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-divider.mjs.map +1 -1
- package/fesm2022/koobiq-components-dl.mjs +9 -9
- package/fesm2022/koobiq-components-dl.mjs.map +1 -1
- package/fesm2022/koobiq-components-dropdown.mjs +125 -147
- package/fesm2022/koobiq-components-dropdown.mjs.map +1 -1
- package/fesm2022/koobiq-components-ellipsis-center.mjs +3 -2
- package/fesm2022/koobiq-components-ellipsis-center.mjs.map +1 -1
- package/fesm2022/koobiq-components-empty-state.mjs +157 -0
- package/fesm2022/koobiq-components-empty-state.mjs.map +1 -0
- package/fesm2022/koobiq-components-file-upload.mjs +46 -41
- package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
- package/fesm2022/koobiq-components-form-field.mjs +75 -73
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
- package/fesm2022/koobiq-components-icon.mjs +9 -10
- package/fesm2022/koobiq-components-icon.mjs.map +1 -1
- package/fesm2022/koobiq-components-input.mjs +56 -60
- package/fesm2022/koobiq-components-input.mjs.map +1 -1
- package/fesm2022/koobiq-components-link.mjs +1 -1
- package/fesm2022/koobiq-components-link.mjs.map +1 -1
- package/fesm2022/koobiq-components-list.mjs +43 -49
- package/fesm2022/koobiq-components-list.mjs.map +1 -1
- package/fesm2022/koobiq-components-loader-overlay.mjs +6 -6
- package/fesm2022/koobiq-components-loader-overlay.mjs.map +1 -1
- package/fesm2022/koobiq-components-markdown.mjs +18 -4
- package/fesm2022/koobiq-components-markdown.mjs.map +1 -1
- package/fesm2022/koobiq-components-modal.mjs +96 -54
- package/fesm2022/koobiq-components-modal.mjs.map +1 -1
- package/fesm2022/koobiq-components-navbar.mjs +82 -86
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-popover.mjs +12 -12
- package/fesm2022/koobiq-components-popover.mjs.map +1 -1
- package/fesm2022/koobiq-components-progress-bar.mjs +5 -5
- package/fesm2022/koobiq-components-progress-bar.mjs.map +1 -1
- package/fesm2022/koobiq-components-progress-spinner.mjs +5 -5
- package/fesm2022/koobiq-components-progress-spinner.mjs.map +1 -1
- package/fesm2022/koobiq-components-radio.mjs +11 -16
- package/fesm2022/koobiq-components-radio.mjs.map +1 -1
- package/fesm2022/koobiq-components-risk-level.mjs +4 -4
- package/fesm2022/koobiq-components-risk-level.mjs.map +1 -1
- package/fesm2022/koobiq-components-scrollbar.mjs +22 -24
- package/fesm2022/koobiq-components-scrollbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-select.mjs +55 -78
- package/fesm2022/koobiq-components-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-sidebar.mjs +5 -7
- package/fesm2022/koobiq-components-sidebar.mjs.map +1 -1
- package/fesm2022/koobiq-components-sidepanel.mjs +110 -93
- package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -1
- package/fesm2022/koobiq-components-splitter.mjs +15 -26
- package/fesm2022/koobiq-components-splitter.mjs.map +1 -1
- package/fesm2022/koobiq-components-table.mjs +5 -5
- package/fesm2022/koobiq-components-table.mjs.map +1 -1
- package/fesm2022/koobiq-components-tabs.mjs +85 -98
- package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
- package/fesm2022/koobiq-components-tags.mjs +39 -56
- package/fesm2022/koobiq-components-tags.mjs.map +1 -1
- package/fesm2022/koobiq-components-textarea.mjs +2 -5
- package/fesm2022/koobiq-components-textarea.mjs.map +1 -1
- package/fesm2022/koobiq-components-timepicker.mjs +69 -34
- package/fesm2022/koobiq-components-timepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-timezone.mjs +16 -21
- package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
- package/fesm2022/koobiq-components-title.mjs +11 -7
- package/fesm2022/koobiq-components-title.mjs.map +1 -1
- package/fesm2022/koobiq-components-toast.mjs +74 -87
- package/fesm2022/koobiq-components-toast.mjs.map +1 -1
- package/fesm2022/koobiq-components-toggle.mjs +17 -11
- package/fesm2022/koobiq-components-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-tooltip.mjs +10 -10
- package/fesm2022/koobiq-components-tooltip.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree-select.mjs +67 -80
- package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree.mjs +509 -541
- package/fesm2022/koobiq-components-tree.mjs.map +1 -1
- package/file-upload/_file-upload-theme.scss +28 -18
- package/file-upload/file-upload.scss +0 -1
- package/file-upload/multiple-file-upload.component.d.ts +2 -2
- package/file-upload/multiple-file-upload.component.scss +17 -27
- package/file-upload/public-api.d.ts +1 -1
- package/file-upload/single-file-upload.component.d.ts +2 -2
- package/file-upload/single-file-upload.component.scss +1 -7
- package/form-field/_form-field-theme.scss +24 -12
- package/form-field/_hint-theme.scss +0 -2
- package/form-field/cleaner.scss +0 -1
- package/form-field/form-field.scss +12 -14
- package/form-field/hint.scss +0 -1
- package/form-field/password-toggle.scss +0 -1
- package/form-field/public-api.d.ts +3 -3
- package/form-field/stepper.scss +0 -1
- package/icon/_icon-button-theme.scss +18 -7
- package/icon/_icon-theme.scss +0 -1
- package/icon/icon-button.scss +2 -5
- package/icon/icon-item.scss +2 -5
- package/icon/icon.scss +0 -1
- package/icon/public-api.d.ts +2 -2
- package/input/_input-theme.scss +0 -1
- package/input/input.scss +9 -9
- package/input/public-api.d.ts +2 -2
- package/link/_link-theme.scss +12 -18
- package/link/link.component.d.ts +1 -1
- package/link/public-api.d.ts +1 -1
- package/list/_list-theme.scss +0 -1
- package/list/list-selection.component.d.ts +3 -3
- package/list/list.scss +1 -3
- package/list/public-api.d.ts +2 -2
- package/loader-overlay/_loader-overlay-theme.scss +6 -4
- package/loader-overlay/loader-overlay.scss +0 -1
- package/loader-overlay/public-api.d.ts +1 -1
- package/markdown/_markdown-theme.scss +11 -8
- package/markdown/markdown.scss +3 -3
- package/modal/README.md +4 -3
- package/modal/_modal-animation.scss +0 -1
- package/modal/_modal-confirm.scss +0 -1
- package/modal/_modal-theme.scss +8 -9
- package/modal/modal.directive.d.ts +3 -3
- package/modal/modal.scss +9 -15
- package/modal/modal.type.d.ts +2 -2
- package/modal/public-api.d.ts +2 -2
- package/navbar/README.md +21 -20
- package/navbar/_navbar-item_horizontal.scss +31 -24
- package/navbar/_navbar-item_vertical.scss +0 -3
- package/navbar/_navbar-theme.scss +3 -6
- package/navbar/navbar-brand.scss +0 -1
- package/navbar/navbar-divider.scss +0 -1
- package/navbar/navbar-item.component.d.ts +1 -1
- package/navbar/navbar-item.scss +9 -2
- package/navbar/navbar.scss +0 -1
- package/navbar/public-api.d.ts +2 -2
- package/navbar/vertical-navbar.scss +0 -1
- package/package.json +12 -6
- package/popover/README.md +17 -14
- package/popover/_popover-theme.scss +0 -1
- package/popover/popover.component.d.ts +1 -1
- package/popover/popover.scss +5 -13
- package/popover/public-api.d.ts +2 -2
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/light-theme.css +1 -1
- package/progress-bar/_progress-bar-theme.scss +0 -1
- package/progress-bar/progress-bar.scss +0 -1
- package/progress-bar/public-api.d.ts +1 -1
- package/progress-spinner/_progress-spinner-theme.scss +0 -1
- package/progress-spinner/progress-spinner.scss +0 -1
- package/progress-spinner/public-api.d.ts +1 -1
- package/radio/_radio-theme.scss +13 -5
- package/radio/public-api.d.ts +1 -1
- package/radio/radio.scss +20 -6
- package/risk-level/_risk-level-theme.scss +0 -1
- package/risk-level/public-api.d.ts +1 -1
- package/risk-level/risk-level.component.scss +1 -4
- package/schematics/ng-add/index.js +4 -4
- package/scrollbar/_scrollbar-component-theme.scss +2 -3
- package/scrollbar/public-api.d.ts +1 -1
- package/scrollbar/scrollbar.component.scss +56 -44
- package/scrollbar/scrollbar.directive.d.ts +1 -1
- package/scrollbar/scrollbar.types.d.ts +1 -1
- package/select/_select-theme.scss +0 -1
- package/select/public-api.d.ts +2 -2
- package/select/select.component.d.ts +4 -1
- package/select/select.scss +0 -1
- package/sidebar/public-api.d.ts +1 -1
- package/sidepanel/_sidepanel-theme.scss +0 -1
- package/sidepanel/public-api.d.ts +3 -3
- package/sidepanel/sidepanel.scss +6 -12
- package/splitter/_splitter-theme.scss +0 -1
- package/splitter/public-api.d.ts +1 -1
- package/splitter/splitter.component.d.ts +2 -2
- package/splitter/splitter.scss +0 -1
- package/table/_table-theme.scss +7 -7
- package/table/public-api.d.ts +1 -1
- package/table/table.scss +2 -2
- package/tabs/_tabs-common.scss +10 -8
- package/tabs/_tabs-theme.scss +0 -1
- package/tabs/paginated-tab-header.d.ts +1 -1
- package/tabs/public-api.d.ts +5 -5
- package/tabs/tab-body.component.d.ts +3 -3
- package/tabs/tab-group.component.d.ts +1 -1
- package/tabs/tab-group.scss +0 -1
- package/tabs/tab-header.scss +0 -6
- package/tabs/tab-nav-bar/tab-nav-bar.d.ts +17 -17
- package/tabs/tab-nav-bar/tab-nav-bar.scss +0 -1
- package/tags/_tag-theme.scss +0 -2
- package/tags/public-api.d.ts +4 -4
- package/tags/tag-input.d.ts +1 -1
- package/tags/tag-list.scss +9 -7
- package/tags/tag.component.d.ts +2 -2
- package/tags/tag.scss +1 -4
- package/textarea/_textarea-theme.scss +0 -1
- package/textarea/textarea.component.d.ts +1 -1
- package/textarea/textarea.scss +1 -4
- package/timepicker/public-api.d.ts +1 -1
- package/timepicker/timepicker.constants.d.ts +2 -0
- package/timepicker/timepicker.directive.d.ts +10 -3
- package/timepicker/timepicker.scss +0 -1
- package/timezone/_timezone-option-theme.scss +0 -1
- package/timezone/timezone-option.component.scss +0 -1
- package/timezone/timezone-option.directive.d.ts +1 -1
- package/timezone/timezone-select.component.scss +0 -1
- package/timezone/timezone.utils.d.ts +1 -1
- package/title/public-api.d.ts +1 -1
- package/title/title.directive.d.ts +2 -2
- package/toast/_toast-theme.scss +0 -2
- package/toast/public-api.d.ts +3 -3
- package/toast/toast-container.component.scss +0 -1
- package/toast/toast.component.scss +4 -2
- package/toast/toast.service.d.ts +2 -2
- package/toast/toast.type.d.ts +1 -1
- package/toggle/_toggle-theme.scss +10 -9
- package/toggle/public-api.d.ts +1 -1
- package/toggle/toggle.component.d.ts +2 -2
- package/toggle/toggle.scss +0 -1
- package/tooltip/_tooltip-theme.scss +0 -1
- package/tooltip/public-api.d.ts +1 -1
- package/tooltip/tooltip.component.d.ts +2 -2
- package/tooltip/tooltip.scss +1 -5
- package/tree/_tree-theme.scss +2 -3
- package/tree/public-api.d.ts +10 -10
- package/tree/toggle.scss +0 -1
- package/tree/tree-base.d.ts +1 -1
- package/tree/tree-option.component.d.ts +1 -1
- package/tree/tree-option.scss +12 -8
- package/tree/tree-selection.component.d.ts +3 -2
- package/tree-select/_tree-select-theme.scss +0 -1
- package/tree-select/public-api.d.ts +1 -1
- package/tree-select/tree-select.component.d.ts +9 -4
- package/tree-select/tree-select.scss +0 -1
|
@@ -1,25 +1,449 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { SelectionModel, DataSource } from '@angular/cdk/collections';
|
|
2
|
+
import { BehaviorSubject, merge, Subject, Observable, of, asyncScheduler } from 'rxjs';
|
|
3
|
+
import * as i2$1 from '@koobiq/components/core';
|
|
4
|
+
import { escapeRegExp, mixinDisabled, KBQ_TITLE_TEXT_REF, KBQ_OPTION_ACTION_PARENT, KbqPseudoCheckbox, KbqOptionActionComponent, MultipleMode, getKbqSelectNonArrayValueError, KbqPseudoCheckboxModule } from '@koobiq/components/core';
|
|
5
|
+
import { take, map, takeUntil, delay } from 'rxjs/operators';
|
|
3
6
|
import * as i0 from '@angular/core';
|
|
4
7
|
import { Directive, Input, ViewChild, ContentChildren, forwardRef, Inject, Component, ViewEncapsulation, ChangeDetectionStrategy, InjectionToken, EventEmitter, ContentChild, Output, Optional, QueryList, Attribute, NgModule } from '@angular/core';
|
|
5
|
-
import * as i2$1 from '@koobiq/components/core';
|
|
6
|
-
import { mixinDisabled, KBQ_TITLE_TEXT_REF, KBQ_OPTION_ACTION_PARENT, KbqPseudoCheckbox, KbqOptionActionComponent, escapeRegExp, MultipleMode, getKbqSelectNonArrayValueError, KbqPseudoCheckboxModule } from '@koobiq/components/core';
|
|
7
|
-
import * as i2 from '@koobiq/components/icon';
|
|
8
|
-
import { KbqIconModule } from '@koobiq/components/icon';
|
|
9
|
-
import { BehaviorSubject, Subject, Observable, of, merge, asyncScheduler } from 'rxjs';
|
|
10
|
-
import * as i1$1 from 'rxjs/internal/scheduler/AsyncScheduler';
|
|
11
|
-
import { AsyncScheduler } from 'rxjs/internal/scheduler/AsyncScheduler';
|
|
12
8
|
import * as i3 from '@angular/cdk/bidi';
|
|
13
9
|
import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
14
10
|
import { TreeSizeIndentLevel } from '@koobiq/design-tokens';
|
|
15
|
-
import { takeUntil, take, delay, map } from 'rxjs/operators';
|
|
16
11
|
import { TAB, hasModifierKey, SPACE, LEFT_ARROW, RIGHT_ARROW, isVerticalMovement, isSelectAll, isCopy, DOWN_ARROW, UP_ARROW, ENTER, HOME, END, PAGE_UP, PAGE_DOWN } from '@koobiq/cdk/keycodes';
|
|
17
12
|
import { KbqDropdownTrigger } from '@koobiq/components/dropdown';
|
|
18
13
|
import { KbqTooltipTrigger } from '@koobiq/components/tooltip';
|
|
14
|
+
import * as i2 from '@koobiq/components/icon';
|
|
15
|
+
import { KbqIconModule } from '@koobiq/components/icon';
|
|
16
|
+
import * as i1 from '@angular/common';
|
|
17
|
+
import { CommonModule } from '@angular/common';
|
|
19
18
|
import * as i2$2 from '@angular/cdk/clipboard';
|
|
20
|
-
import { SelectionModel, DataSource } from '@angular/cdk/collections';
|
|
21
19
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
22
20
|
import { FocusKeyManager } from '@koobiq/cdk/a11y';
|
|
21
|
+
import * as i1$1 from 'rxjs/internal/scheduler/AsyncScheduler';
|
|
22
|
+
import { AsyncScheduler } from 'rxjs/internal/scheduler/AsyncScheduler';
|
|
23
|
+
|
|
24
|
+
/** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
|
|
25
|
+
class BaseTreeControl {
|
|
26
|
+
constructor() {
|
|
27
|
+
/** A selection model with multi-selection to track expansion status. */
|
|
28
|
+
this.expansionModel = new SelectionModel(true);
|
|
29
|
+
this.filterModel = new SelectionModel(true);
|
|
30
|
+
this.filterValue = new BehaviorSubject('');
|
|
31
|
+
}
|
|
32
|
+
/** Toggles one single data node's expanded/collapsed state. */
|
|
33
|
+
toggle(dataNode) {
|
|
34
|
+
if (this.filterValue.value?.length) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.expansionModel.toggle(dataNode);
|
|
38
|
+
}
|
|
39
|
+
/** Expands one single data node. */
|
|
40
|
+
expand(dataNode) {
|
|
41
|
+
if (this.filterValue.value?.length) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.expansionModel.select(dataNode);
|
|
45
|
+
}
|
|
46
|
+
/** Collapses one single data node. */
|
|
47
|
+
collapse(dataNode) {
|
|
48
|
+
if (this.filterValue.value?.length) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.expansionModel.deselect(dataNode);
|
|
52
|
+
}
|
|
53
|
+
/** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
|
|
54
|
+
isExpanded(dataNode) {
|
|
55
|
+
return this.expansionModel.isSelected(dataNode);
|
|
56
|
+
}
|
|
57
|
+
/** Toggles a subtree rooted at `node` recursively. */
|
|
58
|
+
toggleDescendants(dataNode) {
|
|
59
|
+
this.expansionModel.isSelected(dataNode)
|
|
60
|
+
? this.collapseDescendants(dataNode)
|
|
61
|
+
: this.expandDescendants(dataNode);
|
|
62
|
+
}
|
|
63
|
+
/** Collapse all dataNodes in the tree. */
|
|
64
|
+
collapseAll() {
|
|
65
|
+
this.expansionModel.clear();
|
|
66
|
+
}
|
|
67
|
+
/** Expands a subtree rooted at given data node recursively. */
|
|
68
|
+
expandDescendants(dataNode) {
|
|
69
|
+
const toBeProcessed = [dataNode];
|
|
70
|
+
toBeProcessed.push(...this.getDescendants(dataNode));
|
|
71
|
+
this.expansionModel.select(...toBeProcessed);
|
|
72
|
+
}
|
|
73
|
+
/** Collapses a subtree rooted at given data node recursively. */
|
|
74
|
+
collapseDescendants(dataNode) {
|
|
75
|
+
const toBeProcessed = [dataNode];
|
|
76
|
+
toBeProcessed.push(...this.getDescendants(dataNode));
|
|
77
|
+
this.expansionModel.deselect(...toBeProcessed);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
class FilterByViewValue {
|
|
82
|
+
constructor(control) {
|
|
83
|
+
this.control = control;
|
|
84
|
+
}
|
|
85
|
+
handle(value) {
|
|
86
|
+
const viewValue = value || null;
|
|
87
|
+
this.result = this.control.dataNodes.filter((node) => this.control.compareViewValues(this.control.getViewValue(node), viewValue));
|
|
88
|
+
return this.result;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
class FilterParentsForNodes {
|
|
92
|
+
constructor(control) {
|
|
93
|
+
this.control = control;
|
|
94
|
+
}
|
|
95
|
+
handle(_, prevFilter) {
|
|
96
|
+
const result = new Set();
|
|
97
|
+
this.control.dataNodes
|
|
98
|
+
.filter((node) => prevFilter?.result.includes(node))
|
|
99
|
+
.forEach((node) => {
|
|
100
|
+
this.control.getParents(node, []).forEach((parent) => result.add(parent));
|
|
101
|
+
result.add(node);
|
|
102
|
+
});
|
|
103
|
+
this.result = Array.from(result);
|
|
104
|
+
return this.result;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class FilterByValues {
|
|
108
|
+
constructor(control) {
|
|
109
|
+
this.control = control;
|
|
110
|
+
this.values = [];
|
|
111
|
+
this.setValues = (values) => {
|
|
112
|
+
this.values = values;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
handle(_, prevFilter) {
|
|
116
|
+
const found = this.control.dataNodes.filter((node) => this.values.includes(this.control.getValue(node)));
|
|
117
|
+
this.result = Array.from(new Set([...(prevFilter?.result || []), ...found]));
|
|
118
|
+
return this.result;
|
|
119
|
+
}
|
|
120
|
+
getValues() {
|
|
121
|
+
return this.values;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function defaultCompareValues(firstValue, secondValue) {
|
|
126
|
+
return firstValue === secondValue;
|
|
127
|
+
}
|
|
128
|
+
function defaultCompareViewValues(firstViewValue, secondViewValue) {
|
|
129
|
+
return RegExp(escapeRegExp(secondViewValue), 'gi').test(firstViewValue);
|
|
130
|
+
}
|
|
131
|
+
/** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
|
|
132
|
+
class FlatTreeControl extends BaseTreeControl {
|
|
133
|
+
/** Construct with flat tree data node functions getLevel, isExpandable, getValue and getViewValue. */
|
|
134
|
+
constructor(getLevel, isExpandable,
|
|
135
|
+
/** getValue will be used to determine if the tree contains value or not. Used in method hasValue */
|
|
136
|
+
getValue,
|
|
137
|
+
/** getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction */
|
|
138
|
+
getViewValue,
|
|
139
|
+
/** compareValues will be used to comparing values. */
|
|
140
|
+
compareValues = defaultCompareValues,
|
|
141
|
+
/** compareValues will be used to comparing values. */
|
|
142
|
+
compareViewValues = defaultCompareViewValues,
|
|
143
|
+
/** isDisabled will be used to determine if the node is disabled. */
|
|
144
|
+
isDisabled = () => false) {
|
|
145
|
+
super();
|
|
146
|
+
this.getLevel = getLevel;
|
|
147
|
+
this.isExpandable = isExpandable;
|
|
148
|
+
this.getValue = getValue;
|
|
149
|
+
this.getViewValue = getViewValue;
|
|
150
|
+
this.compareValues = compareValues;
|
|
151
|
+
this.compareViewValues = compareViewValues;
|
|
152
|
+
this.isDisabled = isDisabled;
|
|
153
|
+
this.setFilters(new FilterByViewValue(this), new FilterParentsForNodes(this));
|
|
154
|
+
}
|
|
155
|
+
getFilters() {
|
|
156
|
+
return this.filters;
|
|
157
|
+
}
|
|
158
|
+
setFilters(...filters) {
|
|
159
|
+
this.filters = filters;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets a list of the data node's subtree of descendent data nodes.
|
|
163
|
+
*
|
|
164
|
+
* To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
|
|
165
|
+
* with correct levels.
|
|
166
|
+
*/
|
|
167
|
+
getDescendants(dataNode) {
|
|
168
|
+
const startIndex = this.dataNodes.indexOf(dataNode);
|
|
169
|
+
const results = [];
|
|
170
|
+
// Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
|
|
171
|
+
// The level of descendants of a tree node must be greater than the level of the given
|
|
172
|
+
// tree node.
|
|
173
|
+
// If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
|
|
174
|
+
// If we reach a node whose level is greater than the level of the tree node, we hit a
|
|
175
|
+
// sibling of an ancestor.
|
|
176
|
+
for (let i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
|
|
177
|
+
results.push(this.dataNodes[i]);
|
|
178
|
+
}
|
|
179
|
+
return results;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Expands all data nodes in the tree.
|
|
183
|
+
*
|
|
184
|
+
* To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
|
|
185
|
+
* data nodes of the tree.
|
|
186
|
+
*/
|
|
187
|
+
expandAll() {
|
|
188
|
+
this.expansionModel.select(...this.dataNodes);
|
|
189
|
+
}
|
|
190
|
+
getParents(node, result) {
|
|
191
|
+
if (node.parent) {
|
|
192
|
+
result.unshift(node.parent);
|
|
193
|
+
return this.getParents(node.parent, result);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
hasValue(value) {
|
|
200
|
+
return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
|
|
201
|
+
}
|
|
202
|
+
filterNodes(value = null) {
|
|
203
|
+
this.saveExpansionState();
|
|
204
|
+
let result = [];
|
|
205
|
+
this.filters.forEach((filter, index, filters) => {
|
|
206
|
+
const prevFilter = filters[index - 1] || null;
|
|
207
|
+
result = filter.handle(value, prevFilter);
|
|
208
|
+
});
|
|
209
|
+
this.filterModel.clear();
|
|
210
|
+
this.filterModel.select(...result);
|
|
211
|
+
// set current expansion state according to filtered tree
|
|
212
|
+
this.expansionModel.setSelection(...result.filter((node) => this.isExpandable(node)));
|
|
213
|
+
this.updateFilterValue(value || result);
|
|
214
|
+
Promise.resolve().then(() => this.restoreExpansionState());
|
|
215
|
+
}
|
|
216
|
+
updateFilterValue(value) {
|
|
217
|
+
Promise.resolve().then(() => this.filterValue.next(value));
|
|
218
|
+
}
|
|
219
|
+
saveExpansionState() {
|
|
220
|
+
if (!this.filterValue.value?.length) {
|
|
221
|
+
this.expandedItemsBeforeFiltration = this.expansionModel.selected;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
restoreExpansionState() {
|
|
225
|
+
if (!this.filterValue.value?.length) {
|
|
226
|
+
this.expansionModel.setSelection(...this.expandedItemsBeforeFiltration);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
|
|
232
|
+
class NestedTreeControl extends BaseTreeControl {
|
|
233
|
+
/** Construct with nested tree function getChildren. */
|
|
234
|
+
constructor(getChildren) {
|
|
235
|
+
super();
|
|
236
|
+
this.getChildren = getChildren;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Expands all dataNodes in the tree.
|
|
240
|
+
*
|
|
241
|
+
* To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
|
|
242
|
+
* data nodes of the tree.
|
|
243
|
+
*/
|
|
244
|
+
expandAll() {
|
|
245
|
+
this.expansionModel.clear();
|
|
246
|
+
const allNodes = this.dataNodes.reduce((accumulator, dataNode) => [...accumulator, ...this.getDescendants(dataNode), dataNode], []);
|
|
247
|
+
this.expansionModel.select(...allNodes);
|
|
248
|
+
}
|
|
249
|
+
/** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
|
|
250
|
+
getDescendants(dataNode) {
|
|
251
|
+
const descendants = [];
|
|
252
|
+
this._getDescendants(descendants, dataNode);
|
|
253
|
+
return descendants.splice(1);
|
|
254
|
+
}
|
|
255
|
+
/** A helper function to get descendants recursively. */
|
|
256
|
+
// todo нужно придумать другое название и понять в чем отличие между getDescendants и _getDescendants
|
|
257
|
+
_getDescendants(descendants, dataNode) {
|
|
258
|
+
descendants.push(dataNode);
|
|
259
|
+
this.getChildren(dataNode)
|
|
260
|
+
.pipe(take(1))
|
|
261
|
+
.subscribe((children) => {
|
|
262
|
+
if (children && children.length > 0) {
|
|
263
|
+
children.forEach((child) => this._getDescendants(descendants, child));
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Tree flattener to convert a normal type of node to node with children & level information.
|
|
271
|
+
* Transform nested nodes of type `T` to flattened nodes of type `F`.
|
|
272
|
+
*
|
|
273
|
+
* For example, the input data of type `T` is nested, and contains its children data:
|
|
274
|
+
* SomeNode: {
|
|
275
|
+
* key: 'Fruits',
|
|
276
|
+
* children: [
|
|
277
|
+
* NodeOne: {
|
|
278
|
+
* key: 'Apple',
|
|
279
|
+
* },
|
|
280
|
+
* NodeTwo: {
|
|
281
|
+
* key: 'Pear',
|
|
282
|
+
* }
|
|
283
|
+
* ]
|
|
284
|
+
* }
|
|
285
|
+
* After flattener flatten the tree, the structure will become
|
|
286
|
+
* SomeNode: {
|
|
287
|
+
* key: 'Fruits',
|
|
288
|
+
* expandable: true,
|
|
289
|
+
* level: 1
|
|
290
|
+
* },
|
|
291
|
+
* NodeOne: {
|
|
292
|
+
* key: 'Apple',
|
|
293
|
+
* expandable: false,
|
|
294
|
+
* level: 2
|
|
295
|
+
* },
|
|
296
|
+
* NodeTwo: {
|
|
297
|
+
* key: 'Pear',
|
|
298
|
+
* expandable: false,
|
|
299
|
+
* level: 2
|
|
300
|
+
* }
|
|
301
|
+
* and the output flattened type is `F` with additional information.
|
|
302
|
+
*/
|
|
303
|
+
class KbqTreeFlattener {
|
|
304
|
+
constructor(transformFunction, getLevel, isExpandable, getChildren) {
|
|
305
|
+
this.transformFunction = transformFunction;
|
|
306
|
+
this.getLevel = getLevel;
|
|
307
|
+
this.isExpandable = isExpandable;
|
|
308
|
+
this.getChildren = getChildren;
|
|
309
|
+
}
|
|
310
|
+
flattenNode(node, level, resultNodes, parent) {
|
|
311
|
+
const flatNode = this.transformFunction(node, level, parent);
|
|
312
|
+
resultNodes.push(flatNode);
|
|
313
|
+
if (this.isExpandable(flatNode)) {
|
|
314
|
+
const childrenNodes = this.getChildren(node);
|
|
315
|
+
if (childrenNodes) {
|
|
316
|
+
if (Array.isArray(childrenNodes)) {
|
|
317
|
+
this.flattenChildren(childrenNodes, level, resultNodes, flatNode);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
childrenNodes.pipe(take(1)).subscribe((children) => {
|
|
321
|
+
this.flattenChildren(children, level, resultNodes, flatNode);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return resultNodes;
|
|
327
|
+
}
|
|
328
|
+
flattenChildren(children, level, resultNodes, parent) {
|
|
329
|
+
children.forEach((child) => {
|
|
330
|
+
this.flattenNode(child, level + 1, resultNodes, parent);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Flatten a list of node type T to flattened version of node F.
|
|
335
|
+
* Please note that type T may be nested, and the length of `structuredData` may be different
|
|
336
|
+
* from that of returned list `F[]`.
|
|
337
|
+
*/
|
|
338
|
+
flattenNodes(structuredData) {
|
|
339
|
+
const resultNodes = [];
|
|
340
|
+
structuredData.forEach((node) => this.flattenNode(node, 0, resultNodes, null));
|
|
341
|
+
return resultNodes;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Expand flattened node with current expansion status.
|
|
345
|
+
* The returned list may have different length.
|
|
346
|
+
*/
|
|
347
|
+
expandFlattenedNodes(nodes, treeControl) {
|
|
348
|
+
const results = [];
|
|
349
|
+
const currentExpand = [];
|
|
350
|
+
currentExpand[0] = true;
|
|
351
|
+
nodes.forEach((node) => {
|
|
352
|
+
let expand = true;
|
|
353
|
+
for (let i = 0; i <= this.getLevel(node); i++) {
|
|
354
|
+
expand = expand && currentExpand[i];
|
|
355
|
+
}
|
|
356
|
+
if (expand) {
|
|
357
|
+
results.push(node);
|
|
358
|
+
}
|
|
359
|
+
if (this.isExpandable(node)) {
|
|
360
|
+
currentExpand[this.getLevel(node) + 1] = treeControl.isExpanded(node);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
return results;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
var KbqTreeDataSourceChangeTypes;
|
|
367
|
+
(function (KbqTreeDataSourceChangeTypes) {
|
|
368
|
+
KbqTreeDataSourceChangeTypes["Expansion"] = "expansion";
|
|
369
|
+
KbqTreeDataSourceChangeTypes["Filter"] = "filter";
|
|
370
|
+
})(KbqTreeDataSourceChangeTypes || (KbqTreeDataSourceChangeTypes = {}));
|
|
371
|
+
/**
|
|
372
|
+
* Data source for flat tree.
|
|
373
|
+
* The data source need to handle expansion/collapsion of the tree node and change the data feed
|
|
374
|
+
* to `KbqTree`.
|
|
375
|
+
* The nested tree nodes of type `T` are flattened through `MсTreeFlattener`, and converted
|
|
376
|
+
* to type `F` for `KbqTree` to consume.
|
|
377
|
+
*/
|
|
378
|
+
class KbqTreeFlatDataSource extends DataSource {
|
|
379
|
+
get data() {
|
|
380
|
+
return this._data.value;
|
|
381
|
+
}
|
|
382
|
+
set data(value) {
|
|
383
|
+
this._data.next(value);
|
|
384
|
+
this.flattenedData.next(this.treeFlattener.flattenNodes(this.data));
|
|
385
|
+
this.treeControl.dataNodes = this.flattenedData.value;
|
|
386
|
+
}
|
|
387
|
+
constructor(treeControl, treeFlattener, initialData = []) {
|
|
388
|
+
super();
|
|
389
|
+
this.treeControl = treeControl;
|
|
390
|
+
this.treeFlattener = treeFlattener;
|
|
391
|
+
this.flattenedData = new BehaviorSubject([]);
|
|
392
|
+
this.expandedData = new BehaviorSubject([]);
|
|
393
|
+
this.filteredData = new BehaviorSubject([]);
|
|
394
|
+
this._data = new BehaviorSubject(initialData);
|
|
395
|
+
}
|
|
396
|
+
connect(collectionViewer) {
|
|
397
|
+
return merge(collectionViewer.viewChange, this.treeControl.expansionModel.changed.pipe(map((value) => ({ type: KbqTreeDataSourceChangeTypes.Expansion, value }))), this.treeControl.filterValue.pipe(map((value) => ({ type: KbqTreeDataSourceChangeTypes.Filter, value }))), this.flattenedData).pipe(map((changeObj) => {
|
|
398
|
+
if (changeObj.type === KbqTreeDataSourceChangeTypes.Filter) {
|
|
399
|
+
if (changeObj.value && changeObj.value.length > 0) {
|
|
400
|
+
return this.filterHandler();
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
return this.expansionHandler(changeObj.value);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return this.expansionHandler(changeObj.value);
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
filterHandler() {
|
|
410
|
+
this.filteredData.next(this.treeControl.filterModel.selected);
|
|
411
|
+
return this.filteredData.value;
|
|
412
|
+
}
|
|
413
|
+
expansionHandler(_change) {
|
|
414
|
+
const expandedNodes = this.treeFlattener.expandFlattenedNodes(this.flattenedData.value, this.treeControl);
|
|
415
|
+
this.expandedData.next(expandedNodes);
|
|
416
|
+
return this.expandedData.value;
|
|
417
|
+
}
|
|
418
|
+
disconnect() {
|
|
419
|
+
// no op
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Data source for nested tree.
|
|
425
|
+
*
|
|
426
|
+
* The data source for nested tree doesn't have to consider node flattener, or the way to expand
|
|
427
|
+
* or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
|
|
428
|
+
*/
|
|
429
|
+
class KbqTreeNestedDataSource extends DataSource {
|
|
430
|
+
constructor() {
|
|
431
|
+
super(...arguments);
|
|
432
|
+
this._data = new BehaviorSubject([]);
|
|
433
|
+
}
|
|
434
|
+
get data() {
|
|
435
|
+
return this._data.value;
|
|
436
|
+
}
|
|
437
|
+
set data(value) {
|
|
438
|
+
this._data.next(value);
|
|
439
|
+
}
|
|
440
|
+
connect(collectionViewer) {
|
|
441
|
+
return merge(...[collectionViewer.viewChange, this._data]).pipe(map(() => this.data));
|
|
442
|
+
}
|
|
443
|
+
disconnect() {
|
|
444
|
+
// no op
|
|
445
|
+
}
|
|
446
|
+
}
|
|
23
447
|
|
|
24
448
|
/** Context provided to the tree node component. */
|
|
25
449
|
class KbqTreeNodeOutletContext {
|
|
@@ -138,7 +562,6 @@ class KbqTreeBase {
|
|
|
138
562
|
this.nodeOutlet.viewContainer.clear();
|
|
139
563
|
this.onDestroy.next();
|
|
140
564
|
this.onDestroy.complete();
|
|
141
|
-
// tslint:disable-next-line:no-unbound-method
|
|
142
565
|
if (this._dataSource && typeof this.dataSource.disconnect === 'function') {
|
|
143
566
|
this.dataSource.disconnect(this);
|
|
144
567
|
}
|
|
@@ -206,7 +629,6 @@ class KbqTreeBase {
|
|
|
206
629
|
// Otherwise, use the level of parent node.
|
|
207
630
|
if (this.treeControl.getLevel) {
|
|
208
631
|
context.level = this.treeControl.getLevel(nodeData);
|
|
209
|
-
/* tslint:disable-next-line:no-typeof-undefined */
|
|
210
632
|
}
|
|
211
633
|
else if (typeof parentData !== 'undefined' && this.levels.has(parentData)) {
|
|
212
634
|
context.level = this.levels.get(parentData) + 1;
|
|
@@ -230,7 +652,6 @@ class KbqTreeBase {
|
|
|
230
652
|
let dataStream;
|
|
231
653
|
// Cannot use `instanceof DataSource` since the data source could be a literal with
|
|
232
654
|
// `connect` function and may not extends DataSource.
|
|
233
|
-
// tslint:disable-next-line:no-unbound-method
|
|
234
655
|
if (typeof this._dataSource.connect === 'function') {
|
|
235
656
|
dataStream = this._dataSource.connect(this);
|
|
236
657
|
}
|
|
@@ -255,7 +676,6 @@ class KbqTreeBase {
|
|
|
255
676
|
* clearing the node outlet. Otherwise start listening for new data.
|
|
256
677
|
*/
|
|
257
678
|
switchDataSource(dataSource) {
|
|
258
|
-
// tslint:disable-next-line:no-unbound-method
|
|
259
679
|
if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
|
|
260
680
|
this.dataSource.disconnect(this);
|
|
261
681
|
}
|
|
@@ -356,8 +776,7 @@ class KbqTreeNodeToggleBaseDirective extends KbqTreeNodeToggleMixinBase {
|
|
|
356
776
|
this.tree = tree;
|
|
357
777
|
this.treeNode = treeNode;
|
|
358
778
|
this._recursive = false;
|
|
359
|
-
this.tree.treeControl.filterValue
|
|
360
|
-
.subscribe((value) => this.disabled = !!value?.length);
|
|
779
|
+
this.tree.treeControl.filterValue.subscribe((value) => (this.disabled = !!value?.length));
|
|
361
780
|
}
|
|
362
781
|
toggle(event) {
|
|
363
782
|
if (this.disabled) {
|
|
@@ -381,11 +800,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
|
|
|
381
800
|
}] } });
|
|
382
801
|
class KbqTreeNodeToggleComponent extends KbqTreeNodeToggleBaseDirective {
|
|
383
802
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeNodeToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
384
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: KbqTreeNodeToggleComponent, selector: "kbq-tree-node-toggle", inputs: { disabled: "disabled" }, host: { listeners: { "click": "toggle($event)" }, properties: { "class.kbq-expanded": "iconState", "attr.disabled": "disabled || null" }, classAttribute: "kbq-tree-node-toggle" }, exportAs: ["kbqTreeNodeToggle"], usesInheritance: true, ngImport: i0, template:
|
|
803
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: KbqTreeNodeToggleComponent, selector: "kbq-tree-node-toggle", inputs: { disabled: "disabled" }, host: { listeners: { "click": "toggle($event)" }, properties: { "class.kbq-expanded": "iconState", "attr.disabled": "disabled || null" }, classAttribute: "kbq-tree-node-toggle" }, exportAs: ["kbqTreeNodeToggle"], usesInheritance: true, ngImport: i0, template: `
|
|
804
|
+
<i kbq-icon="mc-angle-down-S_16"></i>
|
|
805
|
+
`, isInline: true, styles: [".kbq-tree-node-toggle{display:flex;align-items:center;justify-content:center;flex-shrink:0;height:100%;padding-left:var(--kbq-tree-size-toggle-padding, );padding-right:var(--kbq-tree-size-toggle-padding, );cursor:pointer}.kbq-tree-node-toggle .kbq-icon{transform:rotate(-90deg)}.kbq-tree-node-toggle.kbq-expanded .kbq-icon{transform:rotate(0)}.kbq-tree-node-toggle[disabled]{cursor:default}\n"], dependencies: [{ kind: "component", type: i2.KbqIcon, selector: "[kbq-icon]", inputs: ["color", "small", "autoColor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
385
806
|
}
|
|
386
807
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeNodeToggleComponent, decorators: [{
|
|
387
808
|
type: Component,
|
|
388
|
-
args: [{ selector: 'kbq-tree-node-toggle', exportAs: 'kbqTreeNodeToggle', template:
|
|
809
|
+
args: [{ selector: 'kbq-tree-node-toggle', exportAs: 'kbqTreeNodeToggle', template: `
|
|
810
|
+
<i kbq-icon="mc-angle-down-S_16"></i>
|
|
811
|
+
`, host: {
|
|
389
812
|
class: 'kbq-tree-node-toggle',
|
|
390
813
|
'[class.kbq-expanded]': 'iconState',
|
|
391
814
|
'[attr.disabled]': 'disabled || null',
|
|
@@ -502,8 +925,7 @@ class KbqTreeOption extends KbqTreeNode {
|
|
|
502
925
|
};
|
|
503
926
|
}
|
|
504
927
|
ngAfterContentInit() {
|
|
505
|
-
Promise.resolve()
|
|
506
|
-
.then(this.updateCheckboxState);
|
|
928
|
+
Promise.resolve().then(this.updateCheckboxState);
|
|
507
929
|
this.value = this.tree.treeControl.getValue(this.data);
|
|
508
930
|
}
|
|
509
931
|
descendantsAllSelected() {
|
|
@@ -515,11 +937,8 @@ class KbqTreeOption extends KbqTreeNode {
|
|
|
515
937
|
return descendants.some((child) => this.tree?.selectionModel.isSelected(child));
|
|
516
938
|
}
|
|
517
939
|
updateParentsCheckboxState(node) {
|
|
518
|
-
this.tree.treeControl
|
|
519
|
-
.
|
|
520
|
-
.forEach((parent) => {
|
|
521
|
-
const parentOption = this.tree.unorderedOptions
|
|
522
|
-
.find((option) => option.data === parent);
|
|
940
|
+
this.tree.treeControl.getParents(node, []).forEach((parent) => {
|
|
941
|
+
const parentOption = this.tree.unorderedOptions.find((option) => option.data === parent);
|
|
523
942
|
parentOption?.updateCheckboxState();
|
|
524
943
|
});
|
|
525
944
|
}
|
|
@@ -643,7 +1062,7 @@ class KbqTreeOption extends KbqTreeNode {
|
|
|
643
1062
|
{ provide: KbqTreeNode, useExisting: KbqTreeOption },
|
|
644
1063
|
{ provide: KBQ_TITLE_TEXT_REF, useExisting: KbqTreeOption },
|
|
645
1064
|
{ provide: KBQ_OPTION_ACTION_PARENT, useExisting: KbqTreeOption }
|
|
646
|
-
], queries: [{ propertyName: "toggleElementDirective", first: true, predicate: KbqTreeNodeToggleDirective, descendants: true }, { propertyName: "toggleElementComponent", first: true, predicate: KbqTreeNodeToggleComponent, descendants: true }, { propertyName: "pseudoCheckbox", first: true, predicate: KbqPseudoCheckbox, descendants: true }, { propertyName: "actionButton", first: true, predicate: KbqOptionActionComponent, descendants: true }, { propertyName: "tooltipTrigger", first: true, predicate: KbqTooltipTrigger, descendants: true }, { propertyName: "dropdownTrigger", first: true, predicate: KbqDropdownTrigger, descendants: true }], viewQueries: [{ propertyName: "parentTextElement", first: true, predicate: ["kbqTitleContainer"], descendants: true }], exportAs: ["kbqTreeOption"], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"kbq-tree-node-toggle, [kbq-tree-node-toggle], [kbqTreeNodeToggle]\"
|
|
1065
|
+
], queries: [{ propertyName: "toggleElementDirective", first: true, predicate: KbqTreeNodeToggleDirective, descendants: true }, { propertyName: "toggleElementComponent", first: true, predicate: KbqTreeNodeToggleComponent, descendants: true }, { propertyName: "pseudoCheckbox", first: true, predicate: KbqPseudoCheckbox, descendants: true }, { propertyName: "actionButton", first: true, predicate: KbqOptionActionComponent, descendants: true }, { propertyName: "tooltipTrigger", first: true, predicate: KbqTooltipTrigger, descendants: true }, { propertyName: "dropdownTrigger", first: true, predicate: KbqDropdownTrigger, descendants: true }], viewQueries: [{ propertyName: "parentTextElement", first: true, predicate: ["kbqTitleContainer"], descendants: true }], exportAs: ["kbqTreeOption"], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"kbq-tree-node-toggle, [kbq-tree-node-toggle], [kbqTreeNodeToggle]\" />\n\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\n <ng-content\n *ngSwitchCase=\"true\"\n select=\"kbq-pseudo-checkbox\"\n />\n\n <ng-container *ngSwitchCase=\"false\">\n <kbq-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [disabled]=\"disabled\"\n [state]=\"checkboxState\"\n />\n </ng-container>\n</ng-container>\n\n<ng-content select=\"kbq-checkbox\" />\n\n<ng-content select=\"[kbq-icon]\" />\n\n<ng-content select=\"kbq-progress-spinner\" />\n\n<span\n #kbqTitleContainer\n class=\"kbq-option-text\"\n>\n <ng-content />\n</span>\n\n<ng-content select=\"kbq-option-action\" />\n", styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-button-size-border-width, 1px))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-button-size-border-radius, 8px)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-button-size-border-radius, 8px)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-button-size-border-width, 1px))}.kbq-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-tree-option{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;display:flex;align-items:center;min-height:32px;word-wrap:break-word;border-width:var(--kbq-tree-size-container-focus-outline-width, 2px);border-style:solid;border-color:transparent;padding-top:calc(var(--kbq-tree-size-container-padding-vertical, 4px) - var(--kbq-tree-size-container-focus-outline-width, 2px));padding-right:calc(var(--kbq-tree-size-container-padding-right, 8px) - var(--kbq-tree-size-container-focus-outline-width, 2px));padding-bottom:calc(var(--kbq-tree-size-container-padding-vertical, 4px) - var(--kbq-tree-size-container-focus-outline-width, 2px));gap:var(--kbq-tree-size-container-content-gap-horizontal, 8px)}.kbq-tree-option .kbq-option-text{display:flex;flex-direction:column;width:100%;box-sizing:content-box;display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-top:var(--kbq-list-size-text-padding-vertical, 0);padding-bottom:var(--kbq-list-size-text-padding-vertical, 0)}.kbq-tree-option .kbq-option-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.kbq-tree-option .kbq-option-text:empty{display:none}.kbq-tree-option:focus{outline:none}.kbq-tree-option:not(.kbq-disabled){cursor:pointer}.kbq-tree-option .kbq-option-action{display:none}.kbq-tree-option:not(.kbq-disabled):hover .kbq-option-action,.kbq-tree-option:not(.kbq-disabled).kbq-focused .kbq-option-action,.kbq-tree-option:not(.kbq-disabled).kbq-action-button-focused .kbq-option-action{display:flex}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i2$1.KbqPseudoCheckbox, selector: "kbq-pseudo-checkbox", inputs: ["color", "big", "state", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
647
1066
|
}
|
|
648
1067
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeOption, decorators: [{
|
|
649
1068
|
type: Component,
|
|
@@ -664,7 +1083,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
|
|
|
664
1083
|
{ provide: KbqTreeNode, useExisting: KbqTreeOption },
|
|
665
1084
|
{ provide: KBQ_TITLE_TEXT_REF, useExisting: KbqTreeOption },
|
|
666
1085
|
{ provide: KBQ_OPTION_ACTION_PARENT, useExisting: KbqTreeOption }
|
|
667
|
-
], template: "<ng-content select=\"kbq-tree-node-toggle, [kbq-tree-node-toggle], [kbqTreeNodeToggle]\"
|
|
1086
|
+
], template: "<ng-content select=\"kbq-tree-node-toggle, [kbq-tree-node-toggle], [kbqTreeNodeToggle]\" />\n\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\n <ng-content\n *ngSwitchCase=\"true\"\n select=\"kbq-pseudo-checkbox\"\n />\n\n <ng-container *ngSwitchCase=\"false\">\n <kbq-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [disabled]=\"disabled\"\n [state]=\"checkboxState\"\n />\n </ng-container>\n</ng-container>\n\n<ng-content select=\"kbq-checkbox\" />\n\n<ng-content select=\"[kbq-icon]\" />\n\n<ng-content select=\"kbq-progress-spinner\" />\n\n<span\n #kbqTitleContainer\n class=\"kbq-option-text\"\n>\n <ng-content />\n</span>\n\n<ng-content select=\"kbq-option-action\" />\n", styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-button-size-border-width, 1px))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-button-size-border-radius, 8px)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-button-size-border-radius, 8px)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-button-size-border-width, 1px))}.kbq-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-tree-option{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;display:flex;align-items:center;min-height:32px;word-wrap:break-word;border-width:var(--kbq-tree-size-container-focus-outline-width, 2px);border-style:solid;border-color:transparent;padding-top:calc(var(--kbq-tree-size-container-padding-vertical, 4px) - var(--kbq-tree-size-container-focus-outline-width, 2px));padding-right:calc(var(--kbq-tree-size-container-padding-right, 8px) - var(--kbq-tree-size-container-focus-outline-width, 2px));padding-bottom:calc(var(--kbq-tree-size-container-padding-vertical, 4px) - var(--kbq-tree-size-container-focus-outline-width, 2px));gap:var(--kbq-tree-size-container-content-gap-horizontal, 8px)}.kbq-tree-option .kbq-option-text{display:flex;flex-direction:column;width:100%;box-sizing:content-box;display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-top:var(--kbq-list-size-text-padding-vertical, 0);padding-bottom:var(--kbq-list-size-text-padding-vertical, 0)}.kbq-tree-option .kbq-option-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.kbq-tree-option .kbq-option-text:empty{display:none}.kbq-tree-option:focus{outline:none}.kbq-tree-option:not(.kbq-disabled){cursor:pointer}.kbq-tree-option .kbq-option-action{display:none}.kbq-tree-option:not(.kbq-disabled):hover .kbq-option-action,.kbq-tree-option:not(.kbq-disabled).kbq-focused .kbq-option-action,.kbq-tree-option:not(.kbq-disabled).kbq-action-button-focused .kbq-option-action{display:flex}\n"] }]
|
|
668
1087
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
669
1088
|
type: Inject,
|
|
670
1089
|
args: [KBQ_TREE_OPTION_PARENT_COMPONENT]
|
|
@@ -730,8 +1149,7 @@ class KbqTreeNodePadding {
|
|
|
730
1149
|
this.baseLeftPadding = 8;
|
|
731
1150
|
this.iconWidth = 24;
|
|
732
1151
|
this.destroyed = new Subject();
|
|
733
|
-
this.dir?.change?.pipe(takeUntil(this.destroyed))
|
|
734
|
-
.subscribe(() => this.setPadding());
|
|
1152
|
+
this.dir?.change?.pipe(takeUntil(this.destroyed)).subscribe(() => this.setPadding());
|
|
735
1153
|
}
|
|
736
1154
|
ngAfterViewInit() {
|
|
737
1155
|
this.withIcon = this.option.isToggleInDefaultPlace;
|
|
@@ -742,11 +1160,11 @@ class KbqTreeNodePadding {
|
|
|
742
1160
|
this.destroyed.complete();
|
|
743
1161
|
}
|
|
744
1162
|
paddingIndent() {
|
|
745
|
-
const nodeLevel =
|
|
1163
|
+
const nodeLevel = this.treeNode.data && this.tree.treeControl.getLevel
|
|
746
1164
|
? this.tree.treeControl.getLevel(this.treeNode.data)
|
|
747
1165
|
: 0;
|
|
748
1166
|
const level = this.level || nodeLevel;
|
|
749
|
-
return level > 0 ? `${
|
|
1167
|
+
return level > 0 ? `${level * this._indent + this.leftPadding}px` : `${this.leftPadding}px`;
|
|
750
1168
|
}
|
|
751
1169
|
/**
|
|
752
1170
|
* This has been extracted to a util because of TS 4 and VE.
|
|
@@ -769,263 +1187,52 @@ class KbqTreeNodePadding {
|
|
|
769
1187
|
*/
|
|
770
1188
|
setIndentInput(indent) {
|
|
771
1189
|
let value = indent;
|
|
772
|
-
let units = 'px';
|
|
773
|
-
if (typeof indent === 'string') {
|
|
774
|
-
const parts = indent.split(cssUnitPattern);
|
|
775
|
-
value = parts[0];
|
|
776
|
-
units = parts[1] || units;
|
|
777
|
-
}
|
|
778
|
-
this.indentUnits = units;
|
|
779
|
-
this._indent = coerceNumberProperty(value);
|
|
780
|
-
this.setPadding();
|
|
781
|
-
}
|
|
782
|
-
setPadding() {
|
|
783
|
-
const padding = this.paddingIndent();
|
|
784
|
-
const paddingProp = this.dir?.value === 'rtl' ? 'paddingRight' : 'paddingLeft';
|
|
785
|
-
this.renderer.setStyle(this.element.nativeElement, paddingProp, padding);
|
|
786
|
-
}
|
|
787
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeNodePadding, deps: [{ token: KbqTreeNode }, { token: KbqTreeBase }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: KbqTreeOption }, { token: i3.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
788
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0", type: KbqTreeNodePadding, selector: "[kbqTreeNodePadding]", inputs: { indent: ["kbqTreeNodePaddingIndent", "indent"] }, exportAs: ["kbqTreeNodePadding"], ngImport: i0 }); }
|
|
789
|
-
}
|
|
790
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeNodePadding, decorators: [{
|
|
791
|
-
type: Directive,
|
|
792
|
-
args: [{
|
|
793
|
-
selector: '[kbqTreeNodePadding]',
|
|
794
|
-
exportAs: 'kbqTreeNodePadding'
|
|
795
|
-
}]
|
|
796
|
-
}], ctorParameters: () => [{ type: KbqTreeNode }, { type: KbqTreeBase }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: KbqTreeOption }, { type: i3.Directionality, decorators: [{
|
|
797
|
-
type: Optional
|
|
798
|
-
}] }], propDecorators: { indent: [{
|
|
799
|
-
type: Input,
|
|
800
|
-
args: ['kbqTreeNodePaddingIndent']
|
|
801
|
-
}] } });
|
|
802
|
-
|
|
803
|
-
class KbqTree extends KbqTreeBase {
|
|
804
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTree, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
805
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: KbqTree, selector: "kbq-tree", host: { classAttribute: "kbq-tree" }, exportAs: ["kbqTree"], usesInheritance: true, ngImport: i0, template: `<ng-container kbqTreeNodeOutlet></ng-container>`, isInline: true, styles: [".kbq-tree{display:block}\n"], dependencies: [{ kind: "directive", type: KbqTreeNodeOutlet, selector: "[kbqTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
806
|
-
}
|
|
807
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTree, decorators: [{
|
|
808
|
-
type: Component,
|
|
809
|
-
args: [{ selector: 'kbq-tree', exportAs: 'kbqTree', template: `<ng-container kbqTreeNodeOutlet></ng-container>`, host: {
|
|
810
|
-
class: 'kbq-tree'
|
|
811
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".kbq-tree{display:block}\n"] }]
|
|
812
|
-
}] });
|
|
813
|
-
|
|
814
|
-
/** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
|
|
815
|
-
/* tslint:disable-next-line:naming-convention */
|
|
816
|
-
class BaseTreeControl {
|
|
817
|
-
constructor() {
|
|
818
|
-
/** A selection model with multi-selection to track expansion status. */
|
|
819
|
-
this.expansionModel = new SelectionModel(true);
|
|
820
|
-
this.filterModel = new SelectionModel(true);
|
|
821
|
-
this.filterValue = new BehaviorSubject('');
|
|
822
|
-
}
|
|
823
|
-
/** Toggles one single data node's expanded/collapsed state. */
|
|
824
|
-
toggle(dataNode) {
|
|
825
|
-
if (this.filterValue.value?.length) {
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
this.expansionModel.toggle(dataNode);
|
|
829
|
-
}
|
|
830
|
-
/** Expands one single data node. */
|
|
831
|
-
expand(dataNode) {
|
|
832
|
-
if (this.filterValue.value?.length) {
|
|
833
|
-
return;
|
|
834
|
-
}
|
|
835
|
-
this.expansionModel.select(dataNode);
|
|
836
|
-
}
|
|
837
|
-
/** Collapses one single data node. */
|
|
838
|
-
collapse(dataNode) {
|
|
839
|
-
if (this.filterValue.value?.length) {
|
|
840
|
-
return;
|
|
841
|
-
}
|
|
842
|
-
this.expansionModel.deselect(dataNode);
|
|
843
|
-
}
|
|
844
|
-
/** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
|
|
845
|
-
isExpanded(dataNode) {
|
|
846
|
-
return this.expansionModel.isSelected(dataNode);
|
|
847
|
-
}
|
|
848
|
-
/** Toggles a subtree rooted at `node` recursively. */
|
|
849
|
-
toggleDescendants(dataNode) {
|
|
850
|
-
this.expansionModel.isSelected(dataNode)
|
|
851
|
-
? this.collapseDescendants(dataNode)
|
|
852
|
-
: this.expandDescendants(dataNode);
|
|
853
|
-
}
|
|
854
|
-
/** Collapse all dataNodes in the tree. */
|
|
855
|
-
collapseAll() {
|
|
856
|
-
this.expansionModel.clear();
|
|
857
|
-
}
|
|
858
|
-
/** Expands a subtree rooted at given data node recursively. */
|
|
859
|
-
expandDescendants(dataNode) {
|
|
860
|
-
const toBeProcessed = [dataNode];
|
|
861
|
-
toBeProcessed.push(...this.getDescendants(dataNode));
|
|
862
|
-
this.expansionModel.select(...toBeProcessed);
|
|
863
|
-
}
|
|
864
|
-
/** Collapses a subtree rooted at given data node recursively. */
|
|
865
|
-
collapseDescendants(dataNode) {
|
|
866
|
-
const toBeProcessed = [dataNode];
|
|
867
|
-
toBeProcessed.push(...this.getDescendants(dataNode));
|
|
868
|
-
this.expansionModel.deselect(...toBeProcessed);
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
class FilterByViewValue {
|
|
873
|
-
constructor(control) {
|
|
874
|
-
this.control = control;
|
|
875
|
-
}
|
|
876
|
-
handle(value) {
|
|
877
|
-
const viewValue = value || null;
|
|
878
|
-
this.result = this.control.dataNodes
|
|
879
|
-
.filter((node) => this.control.compareViewValues(this.control.getViewValue(node), viewValue));
|
|
880
|
-
return this.result;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
class FilterParentsForNodes {
|
|
884
|
-
constructor(control) {
|
|
885
|
-
this.control = control;
|
|
886
|
-
}
|
|
887
|
-
handle(_, prevFilter) {
|
|
888
|
-
const result = new Set();
|
|
889
|
-
this.control.dataNodes
|
|
890
|
-
.filter((node) => prevFilter?.result.includes(node))
|
|
891
|
-
.forEach((node) => {
|
|
892
|
-
this.control.getParents(node, [])
|
|
893
|
-
.forEach((parent) => result.add(parent));
|
|
894
|
-
result.add(node);
|
|
895
|
-
});
|
|
896
|
-
this.result = Array.from(result);
|
|
897
|
-
return this.result;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
class FilterByValues {
|
|
901
|
-
constructor(control) {
|
|
902
|
-
this.control = control;
|
|
903
|
-
this.values = [];
|
|
904
|
-
this.setValues = (values) => {
|
|
905
|
-
this.values = values;
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
handle(_, prevFilter) {
|
|
909
|
-
const found = this.control.dataNodes
|
|
910
|
-
.filter((node) => this.values.includes(this.control.getValue(node)));
|
|
911
|
-
this.result = Array.from(new Set([...(prevFilter?.result || []), ...found]));
|
|
912
|
-
return this.result;
|
|
913
|
-
}
|
|
914
|
-
getValues() {
|
|
915
|
-
return this.values;
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
function defaultCompareValues(firstValue, secondValue) {
|
|
920
|
-
return firstValue === secondValue;
|
|
921
|
-
}
|
|
922
|
-
function defaultCompareViewValues(firstViewValue, secondViewValue) {
|
|
923
|
-
return RegExp(escapeRegExp(secondViewValue), 'gi').test(firstViewValue);
|
|
924
|
-
}
|
|
925
|
-
/** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
|
|
926
|
-
class FlatTreeControl extends BaseTreeControl {
|
|
927
|
-
/** Construct with flat tree data node functions getLevel, isExpandable, getValue and getViewValue. */
|
|
928
|
-
constructor(getLevel, isExpandable,
|
|
929
|
-
/** getValue will be used to determine if the tree contains value or not. Used in method hasValue */
|
|
930
|
-
getValue,
|
|
931
|
-
/** getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction */
|
|
932
|
-
getViewValue,
|
|
933
|
-
/** compareValues will be used to comparing values. */
|
|
934
|
-
compareValues = defaultCompareValues,
|
|
935
|
-
/** compareValues will be used to comparing values. */
|
|
936
|
-
compareViewValues = defaultCompareViewValues,
|
|
937
|
-
/** isDisabled will be used to determine if the node is disabled. */
|
|
938
|
-
isDisabled = () => false) {
|
|
939
|
-
super();
|
|
940
|
-
this.getLevel = getLevel;
|
|
941
|
-
this.isExpandable = isExpandable;
|
|
942
|
-
this.getValue = getValue;
|
|
943
|
-
this.getViewValue = getViewValue;
|
|
944
|
-
this.compareValues = compareValues;
|
|
945
|
-
this.compareViewValues = compareViewValues;
|
|
946
|
-
this.isDisabled = isDisabled;
|
|
947
|
-
this.setFilters(new FilterByViewValue(this), new FilterParentsForNodes(this));
|
|
948
|
-
}
|
|
949
|
-
getFilters() {
|
|
950
|
-
return this.filters;
|
|
951
|
-
}
|
|
952
|
-
setFilters(...filters) {
|
|
953
|
-
this.filters = filters;
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Gets a list of the data node's subtree of descendent data nodes.
|
|
957
|
-
*
|
|
958
|
-
* To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
|
|
959
|
-
* with correct levels.
|
|
960
|
-
*/
|
|
961
|
-
getDescendants(dataNode) {
|
|
962
|
-
const startIndex = this.dataNodes.indexOf(dataNode);
|
|
963
|
-
const results = [];
|
|
964
|
-
// Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
|
|
965
|
-
// The level of descendants of a tree node must be greater than the level of the given
|
|
966
|
-
// tree node.
|
|
967
|
-
// If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
|
|
968
|
-
// If we reach a node whose level is greater than the level of the tree node, we hit a
|
|
969
|
-
// sibling of an ancestor.
|
|
970
|
-
for (let i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
|
|
971
|
-
results.push(this.dataNodes[i]);
|
|
972
|
-
}
|
|
973
|
-
return results;
|
|
974
|
-
}
|
|
975
|
-
/**
|
|
976
|
-
* Expands all data nodes in the tree.
|
|
977
|
-
*
|
|
978
|
-
* To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
|
|
979
|
-
* data nodes of the tree.
|
|
980
|
-
*/
|
|
981
|
-
expandAll() {
|
|
982
|
-
this.expansionModel.select(...this.dataNodes);
|
|
983
|
-
}
|
|
984
|
-
getParents(node, result) {
|
|
985
|
-
if (node.parent) {
|
|
986
|
-
result.unshift(node.parent);
|
|
987
|
-
return this.getParents(node.parent, result);
|
|
988
|
-
}
|
|
989
|
-
else {
|
|
990
|
-
return result;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
hasValue(value) {
|
|
994
|
-
return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
|
|
995
|
-
}
|
|
996
|
-
filterNodes(value = null) {
|
|
997
|
-
this.saveExpansionState();
|
|
998
|
-
let result = [];
|
|
999
|
-
this.filters
|
|
1000
|
-
.forEach((filter, index, filters) => {
|
|
1001
|
-
const prevFilter = filters[index - 1] || null;
|
|
1002
|
-
result = filter.handle(value, prevFilter);
|
|
1003
|
-
});
|
|
1004
|
-
this.filterModel.clear();
|
|
1005
|
-
this.filterModel.select(...result);
|
|
1006
|
-
// set current expansion state according to filtered tree
|
|
1007
|
-
this.expansionModel.setSelection(...result.filter((node) => this.isExpandable(node)));
|
|
1008
|
-
this.updateFilterValue(value || result);
|
|
1009
|
-
Promise.resolve()
|
|
1010
|
-
.then(() => this.restoreExpansionState());
|
|
1011
|
-
}
|
|
1012
|
-
updateFilterValue(value) {
|
|
1013
|
-
Promise.resolve()
|
|
1014
|
-
.then(() => this.filterValue.next(value));
|
|
1015
|
-
}
|
|
1016
|
-
saveExpansionState() {
|
|
1017
|
-
if (!this.filterValue.value?.length) {
|
|
1018
|
-
this.expandedItemsBeforeFiltration = this.expansionModel.selected;
|
|
1190
|
+
let units = 'px';
|
|
1191
|
+
if (typeof indent === 'string') {
|
|
1192
|
+
const parts = indent.split(cssUnitPattern);
|
|
1193
|
+
value = parts[0];
|
|
1194
|
+
units = parts[1] || units;
|
|
1019
1195
|
}
|
|
1196
|
+
this.indentUnits = units;
|
|
1197
|
+
this._indent = coerceNumberProperty(value);
|
|
1198
|
+
this.setPadding();
|
|
1020
1199
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1200
|
+
setPadding() {
|
|
1201
|
+
const padding = this.paddingIndent();
|
|
1202
|
+
const paddingProp = this.dir?.value === 'rtl' ? 'paddingRight' : 'paddingLeft';
|
|
1203
|
+
this.renderer.setStyle(this.element.nativeElement, paddingProp, padding);
|
|
1025
1204
|
}
|
|
1205
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeNodePadding, deps: [{ token: KbqTreeNode }, { token: KbqTreeBase }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: KbqTreeOption }, { token: i3.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1206
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0", type: KbqTreeNodePadding, selector: "[kbqTreeNodePadding]", inputs: { indent: ["kbqTreeNodePaddingIndent", "indent"] }, exportAs: ["kbqTreeNodePadding"], ngImport: i0 }); }
|
|
1207
|
+
}
|
|
1208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeNodePadding, decorators: [{
|
|
1209
|
+
type: Directive,
|
|
1210
|
+
args: [{
|
|
1211
|
+
selector: '[kbqTreeNodePadding]',
|
|
1212
|
+
exportAs: 'kbqTreeNodePadding'
|
|
1213
|
+
}]
|
|
1214
|
+
}], ctorParameters: () => [{ type: KbqTreeNode }, { type: KbqTreeBase }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: KbqTreeOption }, { type: i3.Directionality, decorators: [{
|
|
1215
|
+
type: Optional
|
|
1216
|
+
}] }], propDecorators: { indent: [{
|
|
1217
|
+
type: Input,
|
|
1218
|
+
args: ['kbqTreeNodePaddingIndent']
|
|
1219
|
+
}] } });
|
|
1220
|
+
|
|
1221
|
+
class KbqTree extends KbqTreeBase {
|
|
1222
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTree, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1223
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: KbqTree, selector: "kbq-tree", host: { classAttribute: "kbq-tree" }, exportAs: ["kbqTree"], usesInheritance: true, ngImport: i0, template: `
|
|
1224
|
+
<ng-container kbqTreeNodeOutlet />
|
|
1225
|
+
`, isInline: true, styles: [".kbq-tree{display:block}\n"], dependencies: [{ kind: "directive", type: KbqTreeNodeOutlet, selector: "[kbqTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1026
1226
|
}
|
|
1227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTree, decorators: [{
|
|
1228
|
+
type: Component,
|
|
1229
|
+
args: [{ selector: 'kbq-tree', exportAs: 'kbqTree', template: `
|
|
1230
|
+
<ng-container kbqTreeNodeOutlet />
|
|
1231
|
+
`, host: {
|
|
1232
|
+
class: 'kbq-tree'
|
|
1233
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".kbq-tree{display:block}\n"] }]
|
|
1234
|
+
}] });
|
|
1027
1235
|
|
|
1028
|
-
/* tslint:disable:no-empty */
|
|
1029
1236
|
const KBQ_SELECTION_TREE_VALUE_ACCESSOR = {
|
|
1030
1237
|
provide: NG_VALUE_ACCESSOR,
|
|
1031
1238
|
useExisting: forwardRef(() => KbqTreeSelection),
|
|
@@ -1149,14 +1356,11 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1149
1356
|
this.selectionModel = new SelectionModel(this.multiple);
|
|
1150
1357
|
}
|
|
1151
1358
|
ngAfterContentInit() {
|
|
1152
|
-
this.unorderedOptions.changes
|
|
1153
|
-
.subscribe(this.updateRenderedOptions);
|
|
1359
|
+
this.unorderedOptions.changes.subscribe(this.updateRenderedOptions);
|
|
1154
1360
|
this.keyManager = new FocusKeyManager(this.renderedOptions)
|
|
1155
1361
|
.withVerticalOrientation(true)
|
|
1156
1362
|
.withHorizontalOrientation(null);
|
|
1157
|
-
this.keyManager.change
|
|
1158
|
-
.pipe(takeUntil(this.destroy))
|
|
1159
|
-
.subscribe(() => {
|
|
1363
|
+
this.keyManager.change.pipe(takeUntil(this.destroy)).subscribe(() => {
|
|
1160
1364
|
if (this.keyManager.activeItem) {
|
|
1161
1365
|
this.emitNavigationEvent(this.keyManager.activeItem);
|
|
1162
1366
|
// todo need check this logic
|
|
@@ -1165,18 +1369,12 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1165
1369
|
}
|
|
1166
1370
|
}
|
|
1167
1371
|
});
|
|
1168
|
-
this.keyManager.tabOut
|
|
1169
|
-
|
|
1170
|
-
.subscribe(() => this.allowFocusEscape());
|
|
1171
|
-
this.selectionModel.changed
|
|
1172
|
-
.pipe(takeUntil(this.destroy))
|
|
1173
|
-
.subscribe(() => {
|
|
1372
|
+
this.keyManager.tabOut.pipe(takeUntil(this.destroy)).subscribe(() => this.allowFocusEscape());
|
|
1373
|
+
this.selectionModel.changed.pipe(takeUntil(this.destroy)).subscribe(() => {
|
|
1174
1374
|
this.onChange(this.getSelectedValues());
|
|
1175
1375
|
this.renderedOptions.notifyOnChanges();
|
|
1176
1376
|
});
|
|
1177
|
-
this.renderedOptions.changes
|
|
1178
|
-
.pipe(takeUntil(this.destroy), delay(0, this.scheduler))
|
|
1179
|
-
.subscribe((options) => {
|
|
1377
|
+
this.renderedOptions.changes.pipe(delay(0, this.scheduler), takeUntil(this.destroy)).subscribe((options) => {
|
|
1180
1378
|
this.resetOptions();
|
|
1181
1379
|
// Check to see if we need to update our tab index
|
|
1182
1380
|
this.updateTabIndex();
|
|
@@ -1205,6 +1403,9 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1205
1403
|
this.keyManager.setFirstItemActive();
|
|
1206
1404
|
this.keyManager.setFocusOrigin('program');
|
|
1207
1405
|
}
|
|
1406
|
+
highlightSelectedOption() {
|
|
1407
|
+
this.renderedOptions.find((item) => item.data === this.selectionModel.selected[0])?.focus();
|
|
1408
|
+
}
|
|
1208
1409
|
blur() {
|
|
1209
1410
|
if (!this.hasFocusedOption() && this.resetFocusedItemOnBlur) {
|
|
1210
1411
|
this.keyManager.setActiveItem(-1);
|
|
@@ -1214,7 +1415,6 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1214
1415
|
}
|
|
1215
1416
|
onKeyDown(event) {
|
|
1216
1417
|
this.keyManager.setFocusOrigin('keyboard');
|
|
1217
|
-
// tslint:disable-next-line: deprecation
|
|
1218
1418
|
const keyCode = event.keyCode;
|
|
1219
1419
|
if ([SPACE, LEFT_ARROW, RIGHT_ARROW].includes(keyCode) || isVerticalMovement(event)) {
|
|
1220
1420
|
event.preventDefault();
|
|
@@ -1314,7 +1514,7 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1314
1514
|
selectActiveOptions() {
|
|
1315
1515
|
const options = this.renderedOptions.toArray();
|
|
1316
1516
|
let fromIndex = this.keyManager.previousActiveItemIndex;
|
|
1317
|
-
let toIndex = this.keyManager.previousActiveItemIndex = this.keyManager.activeItemIndex;
|
|
1517
|
+
let toIndex = (this.keyManager.previousActiveItemIndex = this.keyManager.activeItemIndex);
|
|
1318
1518
|
const selectedOptionState = options[fromIndex]?.selected;
|
|
1319
1519
|
if (toIndex === fromIndex || fromIndex === -1) {
|
|
1320
1520
|
options[toIndex].toggle();
|
|
@@ -1355,11 +1555,9 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1355
1555
|
this.selectionChange.emit(new KbqTreeNavigationChange(this, option));
|
|
1356
1556
|
}
|
|
1357
1557
|
selectAllOptions() {
|
|
1358
|
-
const optionsToSelect = this.renderedOptions
|
|
1359
|
-
.filter((option) => !option.disabled);
|
|
1558
|
+
const optionsToSelect = this.renderedOptions.filter((option) => !option.disabled);
|
|
1360
1559
|
const hasDeselectedOptions = optionsToSelect.some((option) => !option.selected);
|
|
1361
|
-
optionsToSelect
|
|
1362
|
-
.forEach((option) => option.setSelected(hasDeselectedOptions));
|
|
1560
|
+
optionsToSelect.forEach((option) => option.setSelected(hasDeselectedOptions));
|
|
1363
1561
|
this.onSelectAll.emit(new KbqTreeSelectAllEvent(this, optionsToSelect));
|
|
1364
1562
|
}
|
|
1365
1563
|
copyActiveOption() {
|
|
@@ -1390,6 +1588,7 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1390
1588
|
registerOnChange(fn) {
|
|
1391
1589
|
this.onChange = fn;
|
|
1392
1590
|
}
|
|
1591
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1393
1592
|
registerOnTouched(fn) {
|
|
1394
1593
|
this.onTouched = fn;
|
|
1395
1594
|
}
|
|
@@ -1468,18 +1667,14 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1468
1667
|
}
|
|
1469
1668
|
}
|
|
1470
1669
|
listenToOptionsFocus() {
|
|
1471
|
-
this.optionFocusSubscription = this.optionFocusChanges
|
|
1472
|
-
.subscribe((event) => {
|
|
1670
|
+
this.optionFocusSubscription = this.optionFocusChanges.subscribe((event) => {
|
|
1473
1671
|
const index = this.renderedOptions.toArray().indexOf(event.option);
|
|
1474
|
-
this.renderedOptions
|
|
1475
|
-
.filter((option) => option.hasFocus)
|
|
1476
|
-
.forEach((option) => option.hasFocus = false);
|
|
1672
|
+
this.renderedOptions.filter((option) => option.hasFocus).forEach((option) => (option.hasFocus = false));
|
|
1477
1673
|
if (this.isValidIndex(index)) {
|
|
1478
1674
|
this.keyManager.updateActiveItem(index);
|
|
1479
1675
|
}
|
|
1480
1676
|
});
|
|
1481
|
-
this.optionBlurSubscription = this.optionBlurChanges
|
|
1482
|
-
.subscribe(() => this.blur());
|
|
1677
|
+
this.optionBlurSubscription = this.optionBlurChanges.subscribe(() => this.blur());
|
|
1483
1678
|
}
|
|
1484
1679
|
/**
|
|
1485
1680
|
* Utility to ensure all indexes are valid.
|
|
@@ -1497,9 +1692,7 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1497
1692
|
this.renderedOptions.forEach((option) => option.markForCheck());
|
|
1498
1693
|
}
|
|
1499
1694
|
updateOptionsFocus() {
|
|
1500
|
-
this.renderedOptions
|
|
1501
|
-
.filter((option) => option.hasFocus)
|
|
1502
|
-
.forEach((option) => option.hasFocus = false);
|
|
1695
|
+
this.renderedOptions.filter((option) => option.hasFocus).forEach((option) => (option.hasFocus = false));
|
|
1503
1696
|
}
|
|
1504
1697
|
canDeselectLast(option) {
|
|
1505
1698
|
return !(this.noUnselectLast && this.selectionModel.selected.length === 1 && option.selected);
|
|
@@ -1515,11 +1708,11 @@ class KbqTreeSelection extends KbqTreeBase {
|
|
|
1515
1708
|
KBQ_SELECTION_TREE_VALUE_ACCESSOR,
|
|
1516
1709
|
{ provide: KBQ_TREE_OPTION_PARENT_COMPONENT, useExisting: KbqTreeSelection },
|
|
1517
1710
|
{ provide: KbqTreeBase, useExisting: KbqTreeSelection }
|
|
1518
|
-
], queries: [{ propertyName: "unorderedOptions", predicate: KbqTreeOption }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: KbqTreeNodeOutlet, descendants: true, static: true }], exportAs: ["kbqTreeSelection"], usesInheritance: true, ngImport: i0, template: '<ng-container kbqTreeNodeOutlet
|
|
1711
|
+
], queries: [{ propertyName: "unorderedOptions", predicate: KbqTreeOption }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: KbqTreeNodeOutlet, descendants: true, static: true }], exportAs: ["kbqTreeSelection"], usesInheritance: true, ngImport: i0, template: '<ng-container kbqTreeNodeOutlet />', isInline: true, styles: [".kbq-tree-selection{display:block}\n"], dependencies: [{ kind: "directive", type: KbqTreeNodeOutlet, selector: "[kbqTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1519
1712
|
}
|
|
1520
1713
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: KbqTreeSelection, decorators: [{
|
|
1521
1714
|
type: Component,
|
|
1522
|
-
args: [{ selector: 'kbq-tree-selection', exportAs: 'kbqTreeSelection', template: '<ng-container kbqTreeNodeOutlet
|
|
1715
|
+
args: [{ selector: 'kbq-tree-selection', exportAs: 'kbqTreeSelection', template: '<ng-container kbqTreeNodeOutlet />', host: {
|
|
1523
1716
|
class: 'kbq-tree-selection',
|
|
1524
1717
|
'[attr.tabindex]': 'tabIndex',
|
|
1525
1718
|
'[attr.disabled]': 'disabled || null',
|
|
@@ -1613,231 +1806,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
|
|
|
1613
1806
|
}]
|
|
1614
1807
|
}] });
|
|
1615
1808
|
|
|
1616
|
-
/** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
|
|
1617
|
-
class NestedTreeControl extends BaseTreeControl {
|
|
1618
|
-
/** Construct with nested tree function getChildren. */
|
|
1619
|
-
constructor(getChildren) {
|
|
1620
|
-
super();
|
|
1621
|
-
this.getChildren = getChildren;
|
|
1622
|
-
}
|
|
1623
|
-
/**
|
|
1624
|
-
* Expands all dataNodes in the tree.
|
|
1625
|
-
*
|
|
1626
|
-
* To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
|
|
1627
|
-
* data nodes of the tree.
|
|
1628
|
-
*/
|
|
1629
|
-
expandAll() {
|
|
1630
|
-
this.expansionModel.clear();
|
|
1631
|
-
const allNodes = this.dataNodes.reduce((accumulator, dataNode) => [...accumulator, ...this.getDescendants(dataNode), dataNode], []);
|
|
1632
|
-
this.expansionModel.select(...allNodes);
|
|
1633
|
-
}
|
|
1634
|
-
/** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
|
|
1635
|
-
getDescendants(dataNode) {
|
|
1636
|
-
const descendants = [];
|
|
1637
|
-
this._getDescendants(descendants, dataNode);
|
|
1638
|
-
return descendants.splice(1);
|
|
1639
|
-
}
|
|
1640
|
-
/** A helper function to get descendants recursively. */
|
|
1641
|
-
// todo нужно придумать другое название и понять в чем отличие между getDescendants и _getDescendants
|
|
1642
|
-
/* tslint:disable-next-line:naming-convention */
|
|
1643
|
-
_getDescendants(descendants, dataNode) {
|
|
1644
|
-
descendants.push(dataNode);
|
|
1645
|
-
this.getChildren(dataNode)
|
|
1646
|
-
.pipe(take(1))
|
|
1647
|
-
.subscribe((children) => {
|
|
1648
|
-
if (children && children.length > 0) {
|
|
1649
|
-
children.forEach((child) => this._getDescendants(descendants, child));
|
|
1650
|
-
}
|
|
1651
|
-
});
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
/**
|
|
1656
|
-
* Tree flattener to convert a normal type of node to node with children & level information.
|
|
1657
|
-
* Transform nested nodes of type `T` to flattened nodes of type `F`.
|
|
1658
|
-
*
|
|
1659
|
-
* For example, the input data of type `T` is nested, and contains its children data:
|
|
1660
|
-
* SomeNode: {
|
|
1661
|
-
* key: 'Fruits',
|
|
1662
|
-
* children: [
|
|
1663
|
-
* NodeOne: {
|
|
1664
|
-
* key: 'Apple',
|
|
1665
|
-
* },
|
|
1666
|
-
* NodeTwo: {
|
|
1667
|
-
* key: 'Pear',
|
|
1668
|
-
* }
|
|
1669
|
-
* ]
|
|
1670
|
-
* }
|
|
1671
|
-
* After flattener flatten the tree, the structure will become
|
|
1672
|
-
* SomeNode: {
|
|
1673
|
-
* key: 'Fruits',
|
|
1674
|
-
* expandable: true,
|
|
1675
|
-
* level: 1
|
|
1676
|
-
* },
|
|
1677
|
-
* NodeOne: {
|
|
1678
|
-
* key: 'Apple',
|
|
1679
|
-
* expandable: false,
|
|
1680
|
-
* level: 2
|
|
1681
|
-
* },
|
|
1682
|
-
* NodeTwo: {
|
|
1683
|
-
* key: 'Pear',
|
|
1684
|
-
* expandable: false,
|
|
1685
|
-
* level: 2
|
|
1686
|
-
* }
|
|
1687
|
-
* and the output flattened type is `F` with additional information.
|
|
1688
|
-
*/
|
|
1689
|
-
class KbqTreeFlattener {
|
|
1690
|
-
constructor(transformFunction, getLevel, isExpandable, getChildren) {
|
|
1691
|
-
this.transformFunction = transformFunction;
|
|
1692
|
-
this.getLevel = getLevel;
|
|
1693
|
-
this.isExpandable = isExpandable;
|
|
1694
|
-
this.getChildren = getChildren;
|
|
1695
|
-
}
|
|
1696
|
-
flattenNode(node, level, resultNodes, parent) {
|
|
1697
|
-
const flatNode = this.transformFunction(node, level, parent);
|
|
1698
|
-
resultNodes.push(flatNode);
|
|
1699
|
-
if (this.isExpandable(flatNode)) {
|
|
1700
|
-
const childrenNodes = this.getChildren(node);
|
|
1701
|
-
if (childrenNodes) {
|
|
1702
|
-
if (Array.isArray(childrenNodes)) {
|
|
1703
|
-
this.flattenChildren(childrenNodes, level, resultNodes, flatNode);
|
|
1704
|
-
}
|
|
1705
|
-
else {
|
|
1706
|
-
childrenNodes
|
|
1707
|
-
.pipe(take(1))
|
|
1708
|
-
.subscribe((children) => {
|
|
1709
|
-
this.flattenChildren(children, level, resultNodes, flatNode);
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
return resultNodes;
|
|
1715
|
-
}
|
|
1716
|
-
flattenChildren(children, level, resultNodes, parent) {
|
|
1717
|
-
children.forEach((child) => {
|
|
1718
|
-
this.flattenNode(child, level + 1, resultNodes, parent);
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
/**
|
|
1722
|
-
* Flatten a list of node type T to flattened version of node F.
|
|
1723
|
-
* Please note that type T may be nested, and the length of `structuredData` may be different
|
|
1724
|
-
* from that of returned list `F[]`.
|
|
1725
|
-
*/
|
|
1726
|
-
flattenNodes(structuredData) {
|
|
1727
|
-
const resultNodes = [];
|
|
1728
|
-
structuredData.forEach((node) => this.flattenNode(node, 0, resultNodes, null));
|
|
1729
|
-
return resultNodes;
|
|
1730
|
-
}
|
|
1731
|
-
/**
|
|
1732
|
-
* Expand flattened node with current expansion status.
|
|
1733
|
-
* The returned list may have different length.
|
|
1734
|
-
*/
|
|
1735
|
-
expandFlattenedNodes(nodes, treeControl) {
|
|
1736
|
-
const results = [];
|
|
1737
|
-
const currentExpand = [];
|
|
1738
|
-
currentExpand[0] = true;
|
|
1739
|
-
nodes.forEach((node) => {
|
|
1740
|
-
let expand = true;
|
|
1741
|
-
for (let i = 0; i <= this.getLevel(node); i++) {
|
|
1742
|
-
expand = expand && currentExpand[i];
|
|
1743
|
-
}
|
|
1744
|
-
if (expand) {
|
|
1745
|
-
results.push(node);
|
|
1746
|
-
}
|
|
1747
|
-
if (this.isExpandable(node)) {
|
|
1748
|
-
currentExpand[this.getLevel(node) + 1] = treeControl.isExpanded(node);
|
|
1749
|
-
}
|
|
1750
|
-
});
|
|
1751
|
-
return results;
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
var KbqTreeDataSourceChangeTypes;
|
|
1755
|
-
(function (KbqTreeDataSourceChangeTypes) {
|
|
1756
|
-
KbqTreeDataSourceChangeTypes["Expansion"] = "expansion";
|
|
1757
|
-
KbqTreeDataSourceChangeTypes["Filter"] = "filter";
|
|
1758
|
-
})(KbqTreeDataSourceChangeTypes || (KbqTreeDataSourceChangeTypes = {}));
|
|
1759
|
-
/**
|
|
1760
|
-
* Data source for flat tree.
|
|
1761
|
-
* The data source need to handle expansion/collapsion of the tree node and change the data feed
|
|
1762
|
-
* to `KbqTree`.
|
|
1763
|
-
* The nested tree nodes of type `T` are flattened through `MсTreeFlattener`, and converted
|
|
1764
|
-
* to type `F` for `KbqTree` to consume.
|
|
1765
|
-
*/
|
|
1766
|
-
class KbqTreeFlatDataSource extends DataSource {
|
|
1767
|
-
get data() {
|
|
1768
|
-
return this._data.value;
|
|
1769
|
-
}
|
|
1770
|
-
set data(value) {
|
|
1771
|
-
this._data.next(value);
|
|
1772
|
-
this.flattenedData.next(this.treeFlattener.flattenNodes(this.data));
|
|
1773
|
-
this.treeControl.dataNodes = this.flattenedData.value;
|
|
1774
|
-
}
|
|
1775
|
-
constructor(treeControl, treeFlattener, initialData = []) {
|
|
1776
|
-
super();
|
|
1777
|
-
this.treeControl = treeControl;
|
|
1778
|
-
this.treeFlattener = treeFlattener;
|
|
1779
|
-
this.flattenedData = new BehaviorSubject([]);
|
|
1780
|
-
this.expandedData = new BehaviorSubject([]);
|
|
1781
|
-
this.filteredData = new BehaviorSubject([]);
|
|
1782
|
-
this._data = new BehaviorSubject(initialData);
|
|
1783
|
-
}
|
|
1784
|
-
connect(collectionViewer) {
|
|
1785
|
-
return merge(collectionViewer.viewChange, this.treeControl.expansionModel.changed
|
|
1786
|
-
.pipe(map((value) => ({ type: KbqTreeDataSourceChangeTypes.Expansion, value }))), this.treeControl.filterValue
|
|
1787
|
-
.pipe(map((value) => ({ type: KbqTreeDataSourceChangeTypes.Filter, value }))), this.flattenedData)
|
|
1788
|
-
.pipe(map((changeObj) => {
|
|
1789
|
-
if (changeObj.type === KbqTreeDataSourceChangeTypes.Filter) {
|
|
1790
|
-
if (changeObj.value && changeObj.value.length > 0) {
|
|
1791
|
-
return this.filterHandler();
|
|
1792
|
-
}
|
|
1793
|
-
else {
|
|
1794
|
-
return this.expansionHandler(changeObj.value);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
return this.expansionHandler(changeObj.value);
|
|
1798
|
-
}));
|
|
1799
|
-
}
|
|
1800
|
-
filterHandler() {
|
|
1801
|
-
this.filteredData.next(this.treeControl.filterModel.selected);
|
|
1802
|
-
return this.filteredData.value;
|
|
1803
|
-
}
|
|
1804
|
-
expansionHandler(_change) {
|
|
1805
|
-
const expandedNodes = this.treeFlattener.expandFlattenedNodes(this.flattenedData.value, this.treeControl);
|
|
1806
|
-
this.expandedData.next(expandedNodes);
|
|
1807
|
-
return this.expandedData.value;
|
|
1808
|
-
}
|
|
1809
|
-
disconnect() {
|
|
1810
|
-
// no op
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
/**
|
|
1815
|
-
* Data source for nested tree.
|
|
1816
|
-
*
|
|
1817
|
-
* The data source for nested tree doesn't have to consider node flattener, or the way to expand
|
|
1818
|
-
* or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
|
|
1819
|
-
*/
|
|
1820
|
-
class KbqTreeNestedDataSource extends DataSource {
|
|
1821
|
-
constructor() {
|
|
1822
|
-
super(...arguments);
|
|
1823
|
-
/* tslint:disable-next-line:naming-convention */
|
|
1824
|
-
this._data = new BehaviorSubject([]);
|
|
1825
|
-
}
|
|
1826
|
-
get data() {
|
|
1827
|
-
return this._data.value;
|
|
1828
|
-
}
|
|
1829
|
-
set data(value) {
|
|
1830
|
-
this._data.next(value);
|
|
1831
|
-
}
|
|
1832
|
-
connect(collectionViewer) {
|
|
1833
|
-
return merge(...[collectionViewer.viewChange, this._data])
|
|
1834
|
-
.pipe(map(() => this.data));
|
|
1835
|
-
}
|
|
1836
|
-
disconnect() {
|
|
1837
|
-
// no op
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
1809
|
/**
|
|
1842
1810
|
* Generated bundle index. Do not edit.
|
|
1843
1811
|
*/
|