@koobiq/components 16.0.0-beta.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/LICENSE +21 -0
- package/README.md +6 -0
- package/_index.scss +3 -0
- package/alert/README.md +0 -0
- package/alert/_alert-theme.scss +61 -0
- package/alert/alert.component.d.ts +22 -0
- package/alert/alert.component.scss +81 -0
- package/alert/alert.module.d.ts +10 -0
- package/alert/index.d.ts +1 -0
- package/alert/public-api.d.ts +2 -0
- package/autocomplete/README.md +0 -0
- package/autocomplete/_autocomplete-theme.scss +21 -0
- package/autocomplete/autocomplete-origin.directive.d.ts +12 -0
- package/autocomplete/autocomplete-trigger.directive.d.ts +167 -0
- package/autocomplete/autocomplete.component.d.ts +73 -0
- package/autocomplete/autocomplete.module.d.ts +12 -0
- package/autocomplete/autocomplete.scss +63 -0
- package/autocomplete/index.d.ts +1 -0
- package/autocomplete/public-api.d.ts +4 -0
- package/button/README.md +0 -0
- package/button/_button-base.scss +69 -0
- package/button/_button-theme.scss +180 -0
- package/button/button.component.d.ts +58 -0
- package/button/button.module.d.ts +11 -0
- package/button/button.scss +59 -0
- package/button/index.d.ts +1 -0
- package/button/public-api.d.ts +2 -0
- package/button-toggle/README.md +0 -0
- package/button-toggle/_button-toggle-theme.scss +92 -0
- package/button-toggle/button-toggle.component.d.ts +145 -0
- package/button-toggle/button-toggle.module.d.ts +10 -0
- package/button-toggle/button-toggle.scss +163 -0
- package/button-toggle/index.d.ts +1 -0
- package/button-toggle/public-api.d.ts +2 -0
- package/card/README.md +0 -0
- package/card/_card-theme.scss +61 -0
- package/card/card.component.d.ts +28 -0
- package/card/card.component.scss +40 -0
- package/card/card.module.d.ts +10 -0
- package/card/index.d.ts +1 -0
- package/card/public-api.d.ts +2 -0
- package/checkbox/README.md +1 -0
- package/checkbox/_checkbox-theme.scss +120 -0
- package/checkbox/checkbox-config.d.ts +13 -0
- package/checkbox/checkbox-module.d.ts +9 -0
- package/checkbox/checkbox-required-validator.d.ts +13 -0
- package/checkbox/checkbox.d.ts +133 -0
- package/checkbox/checkbox.scss +177 -0
- package/checkbox/index.d.ts +1 -0
- package/checkbox/public-api.d.ts +4 -0
- package/code-block/README.md +32 -0
- package/code-block/_code-block-theme.scss +326 -0
- package/code-block/actionbar.component.d.ts +22 -0
- package/code-block/actionbar.component.scss +27 -0
- package/code-block/code-block.component.d.ts +74 -0
- package/code-block/code-block.module.d.ts +14 -0
- package/code-block/code-block.scss +128 -0
- package/code-block/code-block.types.d.ts +16 -0
- package/code-block/index.d.ts +1 -0
- package/code-block/public-api.d.ts +3 -0
- package/core/_index.scss +1 -0
- package/core/animation/animation.d.ts +6 -0
- package/core/animation/fade-animations.d.ts +2 -0
- package/core/animation/index.d.ts +3 -0
- package/core/animation/select-animations.d.ts +12 -0
- package/core/common-behaviors/color.d.ts +33 -0
- package/core/common-behaviors/common-module.d.ts +25 -0
- package/core/common-behaviors/constructor.d.ts +9 -0
- package/core/common-behaviors/disabled.d.ts +8 -0
- package/core/common-behaviors/error-state.d.ts +28 -0
- package/core/common-behaviors/index.d.ts +5 -0
- package/core/common-behaviors/tabindex.d.ts +8 -0
- package/core/datetime/date-adapter.d.ts +12 -0
- package/core/datetime/date-formats.d.ts +4 -0
- package/core/datetime/index.d.ts +2 -0
- package/core/error/error-options.d.ts +14 -0
- package/core/form-field/form-field-ref.d.ts +11 -0
- package/core/form-field/index.d.ts +1 -0
- package/core/formatters/date/formatter.d.ts +9 -0
- package/core/formatters/date/formatter.pipe.d.ts +109 -0
- package/core/formatters/index.d.ts +11 -0
- package/core/formatters/number/formatter.d.ts +37 -0
- package/core/forms/_forms-theme.scss +34 -0
- package/core/forms/_forms.scss +114 -0
- package/core/forms/forms-module.d.ts +7 -0
- package/core/forms/forms.directive.d.ts +22 -0
- package/core/forms/index.d.ts +2 -0
- package/core/highlight/_highlight-theme.scss +8 -0
- package/core/highlight/highlight.pipe.d.ts +8 -0
- package/core/highlight/index.d.ts +9 -0
- package/core/index.d.ts +1 -0
- package/core/label/label-options.d.ts +13 -0
- package/core/line/line.d.ts +28 -0
- package/core/locales/en-US.d.ts +11 -0
- package/core/locales/es-LA.d.ts +7 -0
- package/core/locales/fa-IR.d.ts +7 -0
- package/core/locales/index.d.ts +4 -0
- package/core/locales/locale-service.d.ts +63 -0
- package/core/locales/locale-service.module.d.ts +6 -0
- package/core/locales/pt-BR.d.ts +7 -0
- package/core/locales/ru-RU.d.ts +11 -0
- package/core/locales/zh-CN.d.ts +7 -0
- package/core/option/_optgroup-theme.scss +25 -0
- package/core/option/_option-action-theme.scss +41 -0
- package/core/option/_option-theme.scss +44 -0
- package/core/option/action.d.ts +44 -0
- package/core/option/action.scss +28 -0
- package/core/option/index.d.ts +4 -0
- package/core/option/optgroup.d.ts +16 -0
- package/core/option/optgroup.scss +16 -0
- package/core/option/option-module.d.ts +11 -0
- package/core/option/option.d.ts +116 -0
- package/core/option/option.scss +62 -0
- package/core/overlay/overlay-position-map.d.ts +34 -0
- package/core/pop-up/_pop-up.scss +129 -0
- package/core/pop-up/constants.d.ts +30 -0
- package/core/pop-up/index.d.ts +3 -0
- package/core/pop-up/pop-up-trigger.d.ts +71 -0
- package/core/pop-up/pop-up.d.ts +36 -0
- package/core/public-api.d.ts +21 -0
- package/core/select/constants.d.ts +23 -0
- package/core/select/errors.d.ts +19 -0
- package/core/select/events.d.ts +1 -0
- package/core/select/index.d.ts +3 -0
- package/core/selection/constants.d.ts +4 -0
- package/core/selection/index.d.ts +3 -0
- package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +48 -0
- package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +32 -0
- package/core/selection/pseudo-checkbox/pseudo-checkbox.module.d.ts +8 -0
- package/core/selection/pseudo-checkbox/pseudo-checkbox.scss +77 -0
- package/core/services/measure-scrollbar.service.d.ts +11 -0
- package/core/styles/_core.scss +11 -0
- package/core/styles/_koobiq-theme.scss +153 -0
- package/core/styles/_tokens.kbq.import.scss +4 -0
- package/core/styles/_tokens.scss +6 -0
- package/core/styles/_variables.scss +9 -0
- package/core/styles/common/_animation.scss +35 -0
- package/core/styles/common/_button.scss +10 -0
- package/core/styles/common/_clearfix.scss +13 -0
- package/core/styles/common/_groups.scss +119 -0
- package/core/styles/common/_index.scss +13 -0
- package/core/styles/common/_input.scss +28 -0
- package/core/styles/common/_layout.scss +8 -0
- package/core/styles/common/_list.scss +46 -0
- package/core/styles/common/_overlay.scss +173 -0
- package/core/styles/common/_popup.scss +11 -0
- package/core/styles/common/_rtl.scss +33 -0
- package/core/styles/common/_size.scss +8 -0
- package/core/styles/common/_vendor-prefixes.scss +24 -0
- package/core/styles/common/_visually-hidden.scss +36 -0
- package/core/styles/functions/_index.scss +3 -0
- package/core/styles/functions/_number.scss +65 -0
- package/core/styles/functions/_string.scss +19 -0
- package/core/styles/functions/_timing.scss +30 -0
- package/core/styles/theming/_badges-theme.scss +118 -0
- package/core/styles/theming/_badges.scss +57 -0
- package/core/styles/theming/_components-theming.scss +1218 -0
- package/core/styles/theming/_index.scss +2 -0
- package/core/styles/theming/_scrollbars-theme.scss +77 -0
- package/core/styles/theming/_theming.scss +144 -0
- package/core/styles/theming/prebuilt/light-theme.scss +20 -0
- package/core/styles/typography/_index.scss +2 -0
- package/core/styles/typography/_typography-utils.scss +78 -0
- package/core/styles/typography/_typography.scss +191 -0
- package/core/styles/visual/_body.scss +35 -0
- package/core/styles/visual/_index.scss +3 -0
- package/core/styles/visual/_layout-media.scss +7 -0
- package/core/styles/visual/_layout.scss +527 -0
- package/core/title/index.d.ts +1 -0
- package/core/title/title-text-ref.d.ts +6 -0
- package/core/utils/data-size/config.d.ts +20 -0
- package/core/utils/data-size/data-size.pipe.d.ts +13 -0
- package/core/utils/data-size/index.d.ts +3 -0
- package/core/utils/data-size/size.d.ts +16 -0
- package/core/utils/index.d.ts +1 -0
- package/core/utils/public-api.d.ts +2 -0
- package/core/utils/utils.d.ts +2 -0
- package/core/validation/index.d.ts +1 -0
- package/core/validation/validation.d.ts +7 -0
- package/core/version.d.ts +2 -0
- package/datepicker/README.md +0 -0
- package/datepicker/_datepicker-theme.scss +101 -0
- package/datepicker/calendar-body.component.d.ts +55 -0
- package/datepicker/calendar-body.scss +61 -0
- package/datepicker/calendar-header.component.d.ts +45 -0
- package/datepicker/calendar-header.scss +75 -0
- package/datepicker/calendar.component.d.ts +81 -0
- package/datepicker/calendar.scss +68 -0
- package/datepicker/datepicker-animations.d.ts +9 -0
- package/datepicker/datepicker-content.scss +33 -0
- package/datepicker/datepicker-errors.d.ts +2 -0
- package/datepicker/datepicker-input.directive.d.ts +180 -0
- package/datepicker/datepicker-input.scss +15 -0
- package/datepicker/datepicker-intl.d.ts +32 -0
- package/datepicker/datepicker-module.d.ts +20 -0
- package/datepicker/datepicker-toggle.component.d.ts +35 -0
- package/datepicker/datepicker-toggle.scss +41 -0
- package/datepicker/datepicker.component.d.ts +148 -0
- package/datepicker/index.d.ts +1 -0
- package/datepicker/month-view.component.d.ts +74 -0
- package/datepicker/public-api.d.ts +10 -0
- package/divider/README.md +0 -0
- package/divider/_divider-theme.scss +10 -0
- package/divider/divider.component.d.ts +14 -0
- package/divider/divider.module.d.ts +8 -0
- package/divider/divider.scss +47 -0
- package/divider/index.d.ts +1 -0
- package/divider/public-api.d.ts +2 -0
- package/dl/README.md +0 -0
- package/dl/_dl-theme.scss +86 -0
- package/dl/dl.component.d.ts +27 -0
- package/dl/dl.module.d.ts +10 -0
- package/dl/dl.scss +99 -0
- package/dl/index.d.ts +1 -0
- package/dl/public-api.d.ts +2 -0
- package/dropdown/_dropdown-theme.scss +85 -0
- package/dropdown/dropdown-animations.d.ts +11 -0
- package/dropdown/dropdown-content.directive.d.ts +32 -0
- package/dropdown/dropdown-errors.d.ts +17 -0
- package/dropdown/dropdown-item.component.d.ts +52 -0
- package/dropdown/dropdown-item.scss +82 -0
- package/dropdown/dropdown-trigger.directive.d.ts +136 -0
- package/dropdown/dropdown.component.d.ts +121 -0
- package/dropdown/dropdown.module.d.ts +13 -0
- package/dropdown/dropdown.scss +79 -0
- package/dropdown/dropdown.types.d.ts +53 -0
- package/dropdown/index.d.ts +1 -0
- package/dropdown/public-api.d.ts +8 -0
- package/ellipsis-center/ellipsis-center.directive.d.ts +27 -0
- package/ellipsis-center/index.d.ts +1 -0
- package/ellipsis-center/public-api.d.ts +1 -0
- package/esm2022/alert/alert.component.mjs +67 -0
- package/esm2022/alert/alert.module.mjs +44 -0
- package/esm2022/alert/index.mjs +2 -0
- package/esm2022/alert/koobiq-components-alert.mjs +5 -0
- package/esm2022/alert/public-api.mjs +3 -0
- package/esm2022/autocomplete/autocomplete-origin.directive.mjs +21 -0
- package/esm2022/autocomplete/autocomplete-trigger.directive.mjs +552 -0
- package/esm2022/autocomplete/autocomplete.component.mjs +153 -0
- package/esm2022/autocomplete/autocomplete.module.mjs +34 -0
- package/esm2022/autocomplete/index.mjs +2 -0
- package/esm2022/autocomplete/koobiq-components-autocomplete.mjs +5 -0
- package/esm2022/autocomplete/public-api.mjs +5 -0
- package/esm2022/button/button.component.mjs +164 -0
- package/esm2022/button/button.module.mjs +40 -0
- package/esm2022/button/index.mjs +2 -0
- package/esm2022/button/koobiq-components-button.mjs +5 -0
- package/esm2022/button/public-api.mjs +3 -0
- package/esm2022/button-toggle/button-toggle.component.mjs +381 -0
- package/esm2022/button-toggle/button-toggle.module.mjs +20 -0
- package/esm2022/button-toggle/index.mjs +2 -0
- package/esm2022/button-toggle/koobiq-components-button-toggle.mjs +5 -0
- package/esm2022/button-toggle/public-api.mjs +3 -0
- package/esm2022/card/card.component.mjs +80 -0
- package/esm2022/card/card.module.mjs +28 -0
- package/esm2022/card/index.mjs +2 -0
- package/esm2022/card/koobiq-components-card.mjs +5 -0
- package/esm2022/card/public-api.mjs +3 -0
- package/esm2022/checkbox/checkbox-config.mjs +6 -0
- package/esm2022/checkbox/checkbox-module.mjs +19 -0
- package/esm2022/checkbox/checkbox-required-validator.mjs +27 -0
- package/esm2022/checkbox/checkbox.mjs +304 -0
- package/esm2022/checkbox/index.mjs +2 -0
- package/esm2022/checkbox/koobiq-components-checkbox.mjs +5 -0
- package/esm2022/checkbox/public-api.mjs +5 -0
- package/esm2022/code-block/actionbar.component.mjs +67 -0
- package/esm2022/code-block/code-block.component.mjs +157 -0
- package/esm2022/code-block/code-block.module.mjs +60 -0
- package/esm2022/code-block/code-block.types.mjs +2 -0
- package/esm2022/code-block/index.mjs +2 -0
- package/esm2022/code-block/koobiq-components-code-block.mjs +5 -0
- package/esm2022/code-block/public-api.mjs +4 -0
- package/esm2022/core/animation/animation.mjs +8 -0
- package/esm2022/core/animation/fade-animations.mjs +9 -0
- package/esm2022/core/animation/index.mjs +4 -0
- package/esm2022/core/animation/select-animations.mjs +45 -0
- package/esm2022/core/common-behaviors/color.mjs +45 -0
- package/esm2022/core/common-behaviors/common-module.mjs +83 -0
- package/esm2022/core/common-behaviors/constructor.mjs +2 -0
- package/esm2022/core/common-behaviors/disabled.mjs +17 -0
- package/esm2022/core/common-behaviors/error-state.mjs +21 -0
- package/esm2022/core/common-behaviors/index.mjs +6 -0
- package/esm2022/core/common-behaviors/tabindex.mjs +18 -0
- package/esm2022/core/datetime/date-adapter.mjs +15 -0
- package/esm2022/core/datetime/date-formats.mjs +3 -0
- package/esm2022/core/datetime/index.mjs +3 -0
- package/esm2022/core/error/error-options.mjs +26 -0
- package/esm2022/core/form-field/form-field-ref.mjs +8 -0
- package/esm2022/core/form-field/index.mjs +2 -0
- package/esm2022/core/formatters/date/formatter.mjs +21 -0
- package/esm2022/core/formatters/date/formatter.pipe.mjs +220 -0
- package/esm2022/core/formatters/index.mjs +78 -0
- package/esm2022/core/formatters/number/formatter.mjs +129 -0
- package/esm2022/core/forms/forms-module.mjs +24 -0
- package/esm2022/core/forms/forms.directive.mjs +66 -0
- package/esm2022/core/forms/index.mjs +3 -0
- package/esm2022/core/highlight/highlight.pipe.mjs +23 -0
- package/esm2022/core/highlight/index.mjs +19 -0
- package/esm2022/core/index.mjs +2 -0
- package/esm2022/core/koobiq-components-core.mjs +5 -0
- package/esm2022/core/label/label-options.mjs +4 -0
- package/esm2022/core/line/line.mjs +70 -0
- package/esm2022/core/locales/en-US.mjs +10 -0
- package/esm2022/core/locales/es-LA.mjs +6 -0
- package/esm2022/core/locales/fa-IR.mjs +6 -0
- package/esm2022/core/locales/index.mjs +5 -0
- package/esm2022/core/locales/locale-service.mjs +70 -0
- package/esm2022/core/locales/locale-service.module.mjs +19 -0
- package/esm2022/core/locales/pt-BR.mjs +6 -0
- package/esm2022/core/locales/ru-RU.mjs +10 -0
- package/esm2022/core/locales/zh-CN.mjs +6 -0
- package/esm2022/core/option/action.mjs +122 -0
- package/esm2022/core/option/index.mjs +5 -0
- package/esm2022/core/option/optgroup.mjs +31 -0
- package/esm2022/core/option/option-module.mjs +21 -0
- package/esm2022/core/option/option.mjs +262 -0
- package/esm2022/core/overlay/overlay-position-map.mjs +244 -0
- package/esm2022/core/pop-up/constants.mjs +36 -0
- package/esm2022/core/pop-up/index.mjs +4 -0
- package/esm2022/core/pop-up/pop-up-trigger.mjs +247 -0
- package/esm2022/core/pop-up/pop-up.mjs +94 -0
- package/esm2022/core/public-api.mjs +22 -0
- package/esm2022/core/select/constants.mjs +27 -0
- package/esm2022/core/select/errors.mjs +26 -0
- package/esm2022/core/select/events.mjs +2 -0
- package/esm2022/core/select/index.mjs +4 -0
- package/esm2022/core/selection/constants.mjs +6 -0
- package/esm2022/core/selection/index.mjs +4 -0
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +52 -0
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.module.mjs +18 -0
- package/esm2022/core/services/measure-scrollbar.service.mjs +48 -0
- package/esm2022/core/title/index.mjs +2 -0
- package/esm2022/core/title/title-text-ref.mjs +3 -0
- package/esm2022/core/utils/data-size/config.mjs +22 -0
- package/esm2022/core/utils/data-size/data-size.pipe.mjs +32 -0
- package/esm2022/core/utils/data-size/index.mjs +4 -0
- package/esm2022/core/utils/data-size/size.mjs +50 -0
- package/esm2022/core/utils/index.mjs +2 -0
- package/esm2022/core/utils/public-api.mjs +3 -0
- package/esm2022/core/utils/utils.mjs +5 -0
- package/esm2022/core/validation/index.mjs +2 -0
- package/esm2022/core/validation/validation.mjs +5 -0
- package/esm2022/core/version.mjs +3 -0
- package/esm2022/datepicker/calendar-body.component.mjs +87 -0
- package/esm2022/datepicker/calendar-header.component.mjs +134 -0
- package/esm2022/datepicker/calendar.component.mjs +175 -0
- package/esm2022/datepicker/datepicker-animations.mjs +32 -0
- package/esm2022/datepicker/datepicker-errors.mjs +6 -0
- package/esm2022/datepicker/datepicker-input.directive.mjs +954 -0
- package/esm2022/datepicker/datepicker-intl.mjs +40 -0
- package/esm2022/datepicker/datepicker-module.mjs +97 -0
- package/esm2022/datepicker/datepicker-toggle.component.mjs +86 -0
- package/esm2022/datepicker/datepicker.component.mjs +393 -0
- package/esm2022/datepicker/index.mjs +2 -0
- package/esm2022/datepicker/koobiq-components-datepicker.mjs +5 -0
- package/esm2022/datepicker/month-view.component.mjs +158 -0
- package/esm2022/datepicker/public-api.mjs +11 -0
- package/esm2022/divider/divider.component.mjs +49 -0
- package/esm2022/divider/divider.module.mjs +18 -0
- package/esm2022/divider/index.mjs +2 -0
- package/esm2022/divider/koobiq-components-divider.mjs +5 -0
- package/esm2022/divider/public-api.mjs +3 -0
- package/esm2022/dl/dl.component.mjs +82 -0
- package/esm2022/dl/dl.module.mjs +40 -0
- package/esm2022/dl/index.mjs +2 -0
- package/esm2022/dl/koobiq-components-dl.mjs +5 -0
- package/esm2022/dl/public-api.mjs +3 -0
- package/esm2022/dropdown/dropdown-animations.mjs +41 -0
- package/esm2022/dropdown/dropdown-content.directive.mjs +64 -0
- package/esm2022/dropdown/dropdown-errors.mjs +29 -0
- package/esm2022/dropdown/dropdown-item.component.mjs +146 -0
- package/esm2022/dropdown/dropdown-trigger.directive.mjs +489 -0
- package/esm2022/dropdown/dropdown.component.mjs +292 -0
- package/esm2022/dropdown/dropdown.module.mjs +48 -0
- package/esm2022/dropdown/dropdown.types.mjs +24 -0
- package/esm2022/dropdown/index.mjs +2 -0
- package/esm2022/dropdown/koobiq-components-dropdown.mjs +5 -0
- package/esm2022/dropdown/public-api.mjs +9 -0
- package/esm2022/ellipsis-center/ellipsis-center.directive.mjs +106 -0
- package/esm2022/ellipsis-center/index.mjs +2 -0
- package/esm2022/ellipsis-center/koobiq-components-ellipsis-center.mjs +5 -0
- package/esm2022/ellipsis-center/public-api.mjs +2 -0
- package/esm2022/file-upload/file-drop.mjs +43 -0
- package/esm2022/file-upload/file-upload.mjs +4 -0
- package/esm2022/file-upload/file-upload.module.mjs +66 -0
- package/esm2022/file-upload/index.mjs +2 -0
- package/esm2022/file-upload/koobiq-components-file-upload.mjs +5 -0
- package/esm2022/file-upload/multiple-file-upload.component.mjs +161 -0
- package/esm2022/file-upload/public-api.mjs +6 -0
- package/esm2022/file-upload/single-file-upload.component.mjs +130 -0
- package/esm2022/form-field/cleaner.mjs +14 -0
- package/esm2022/form-field/form-field-control.mjs +5 -0
- package/esm2022/form-field/form-field-errors.mjs +7 -0
- package/esm2022/form-field/form-field.mjs +276 -0
- package/esm2022/form-field/form-field.module.mjs +71 -0
- package/esm2022/form-field/hint.mjs +34 -0
- package/esm2022/form-field/index.mjs +2 -0
- package/esm2022/form-field/koobiq-components-form-field.mjs +5 -0
- package/esm2022/form-field/password-hint.mjs +144 -0
- package/esm2022/form-field/password-toggle.mjs +64 -0
- package/esm2022/form-field/prefix.mjs +13 -0
- package/esm2022/form-field/public-api.mjs +13 -0
- package/esm2022/form-field/stepper.mjs +71 -0
- package/esm2022/form-field/suffix.mjs +13 -0
- package/esm2022/form-field/validate.directive.mjs +158 -0
- package/esm2022/icon/icon.component.mjs +145 -0
- package/esm2022/icon/icon.module.mjs +40 -0
- package/esm2022/icon/index.mjs +2 -0
- package/esm2022/icon/koobiq-components-icon.mjs +5 -0
- package/esm2022/icon/public-api.mjs +3 -0
- package/esm2022/index.mjs +2 -0
- package/esm2022/input/index.mjs +2 -0
- package/esm2022/input/input-errors.mjs +4 -0
- package/esm2022/input/input-number-validators.mjs +88 -0
- package/esm2022/input/input-number.mjs +168 -0
- package/esm2022/input/input-password.mjs +233 -0
- package/esm2022/input/input-value-accessor.mjs +3 -0
- package/esm2022/input/input.mjs +297 -0
- package/esm2022/input/input.module.mjs +63 -0
- package/esm2022/input/koobiq-components-input.mjs +5 -0
- package/esm2022/input/public-api.mjs +7 -0
- package/esm2022/koobiq-components.mjs +5 -0
- package/esm2022/link/index.mjs +2 -0
- package/esm2022/link/koobiq-components-link.mjs +5 -0
- package/esm2022/link/link.component.mjs +132 -0
- package/esm2022/link/link.module.mjs +24 -0
- package/esm2022/link/public-api.mjs +3 -0
- package/esm2022/list/index.mjs +2 -0
- package/esm2022/list/koobiq-components-list.mjs +5 -0
- package/esm2022/list/list-selection.component.mjs +705 -0
- package/esm2022/list/list.component.mjs +44 -0
- package/esm2022/list/list.module.mjs +53 -0
- package/esm2022/list/public-api.mjs +4 -0
- package/esm2022/loader-overlay/index.mjs +2 -0
- package/esm2022/loader-overlay/koobiq-components-loader-overlay.mjs +5 -0
- package/esm2022/loader-overlay/loader-overlay.component.mjs +103 -0
- package/esm2022/loader-overlay/loader-overlay.module.mjs +48 -0
- package/esm2022/loader-overlay/public-api.mjs +3 -0
- package/esm2022/markdown/index.mjs +2 -0
- package/esm2022/markdown/koobiq-components-markdown.mjs +5 -0
- package/esm2022/markdown/markdown.component.mjs +53 -0
- package/esm2022/markdown/markdown.module.mjs +23 -0
- package/esm2022/markdown/markdown.service.mjs +25 -0
- package/esm2022/markdown/markdown.values.mjs +29 -0
- package/esm2022/markdown/public-api.mjs +5 -0
- package/esm2022/modal/css-unit.pipe.mjs +17 -0
- package/esm2022/modal/index.mjs +2 -0
- package/esm2022/modal/koobiq-components-modal.mjs +5 -0
- package/esm2022/modal/modal-control.service.mjs +85 -0
- package/esm2022/modal/modal-ref.class.mjs +8 -0
- package/esm2022/modal/modal-util.mjs +17 -0
- package/esm2022/modal/modal.component.mjs +509 -0
- package/esm2022/modal/modal.directive.mjs +52 -0
- package/esm2022/modal/modal.module.mjs +69 -0
- package/esm2022/modal/modal.service.mjs +124 -0
- package/esm2022/modal/modal.type.mjs +9 -0
- package/esm2022/modal/public-api.mjs +7 -0
- package/esm2022/navbar/index.mjs +2 -0
- package/esm2022/navbar/koobiq-components-navbar.mjs +5 -0
- package/esm2022/navbar/navbar-item.component.mjs +605 -0
- package/esm2022/navbar/navbar.component.mjs +239 -0
- package/esm2022/navbar/navbar.module.mjs +90 -0
- package/esm2022/navbar/public-api.mjs +5 -0
- package/esm2022/navbar/vertical-navbar.animation.mjs +10 -0
- package/esm2022/navbar/vertical-navbar.component.mjs +114 -0
- package/esm2022/popover/index.mjs +2 -0
- package/esm2022/popover/koobiq-components-popover.mjs +5 -0
- package/esm2022/popover/popover-animations.mjs +16 -0
- package/esm2022/popover/popover-confirm.component.mjs +108 -0
- package/esm2022/popover/popover.component.mjs +266 -0
- package/esm2022/popover/popover.module.mjs +29 -0
- package/esm2022/popover/public-api.mjs +5 -0
- package/esm2022/progress-bar/index.mjs +2 -0
- package/esm2022/progress-bar/koobiq-components-progress-bar.mjs +5 -0
- package/esm2022/progress-bar/progress-bar.component.mjs +70 -0
- package/esm2022/progress-bar/progress-bar.module.mjs +36 -0
- package/esm2022/progress-bar/public-api.mjs +3 -0
- package/esm2022/progress-spinner/index.mjs +2 -0
- package/esm2022/progress-spinner/koobiq-components-progress-spinner.mjs +5 -0
- package/esm2022/progress-spinner/progress-spinner.component.mjs +85 -0
- package/esm2022/progress-spinner/progress-spinner.module.mjs +36 -0
- package/esm2022/progress-spinner/public-api.mjs +3 -0
- package/esm2022/public-api.mjs +2 -0
- package/esm2022/radio/index.mjs +2 -0
- package/esm2022/radio/koobiq-components-radio.mjs +5 -0
- package/esm2022/radio/public-api.mjs +3 -0
- package/esm2022/radio/radio.component.mjs +460 -0
- package/esm2022/radio/radio.module.mjs +20 -0
- package/esm2022/select/index.mjs +2 -0
- package/esm2022/select/koobiq-components-select.mjs +5 -0
- package/esm2022/select/public-api.mjs +4 -0
- package/esm2022/select/select-option.directive.mjs +65 -0
- package/esm2022/select/select.component.mjs +1146 -0
- package/esm2022/select/select.module.mjs +79 -0
- package/esm2022/sidebar/index.mjs +2 -0
- package/esm2022/sidebar/koobiq-components-sidebar.mjs +5 -0
- package/esm2022/sidebar/public-api.mjs +3 -0
- package/esm2022/sidebar/sidebar-animations.mjs +23 -0
- package/esm2022/sidebar/sidebar.component.mjs +146 -0
- package/esm2022/sidebar/sidebar.module.mjs +30 -0
- package/esm2022/sidepanel/index.mjs +2 -0
- package/esm2022/sidepanel/koobiq-components-sidepanel.mjs +5 -0
- package/esm2022/sidepanel/public-api.mjs +7 -0
- package/esm2022/sidepanel/sidepanel-animations.mjs +26 -0
- package/esm2022/sidepanel/sidepanel-config.mjs +33 -0
- package/esm2022/sidepanel/sidepanel-container.component.mjs +110 -0
- package/esm2022/sidepanel/sidepanel-directives.mjs +167 -0
- package/esm2022/sidepanel/sidepanel-ref.mjs +53 -0
- package/esm2022/sidepanel/sidepanel.module.mjs +75 -0
- package/esm2022/sidepanel/sidepanel.service.mjs +171 -0
- package/esm2022/splitter/index.mjs +2 -0
- package/esm2022/splitter/koobiq-components-splitter.mjs +5 -0
- package/esm2022/splitter/public-api.mjs +3 -0
- package/esm2022/splitter/splitter.component.mjs +482 -0
- package/esm2022/splitter/splitter.module.mjs +38 -0
- package/esm2022/table/index.mjs +2 -0
- package/esm2022/table/koobiq-components-table.mjs +5 -0
- package/esm2022/table/public-api.mjs +3 -0
- package/esm2022/table/table.component.mjs +13 -0
- package/esm2022/table/table.module.mjs +28 -0
- package/esm2022/tabs/index.mjs +2 -0
- package/esm2022/tabs/koobiq-components-tabs.mjs +5 -0
- package/esm2022/tabs/paginated-tab-header.mjs +479 -0
- package/esm2022/tabs/public-api.mjs +11 -0
- package/esm2022/tabs/tab-body.component.mjs +179 -0
- package/esm2022/tabs/tab-content.directive.mjs +15 -0
- package/esm2022/tabs/tab-group.component.mjs +349 -0
- package/esm2022/tabs/tab-header.component.mjs +67 -0
- package/esm2022/tabs/tab-label-wrapper.directive.mjs +78 -0
- package/esm2022/tabs/tab-label.directive.mjs +17 -0
- package/esm2022/tabs/tab-nav-bar/index.mjs +2 -0
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +111 -0
- package/esm2022/tabs/tab.component.mjs +134 -0
- package/esm2022/tabs/tabs-animations.mjs +24 -0
- package/esm2022/tabs/tabs.module.mjs +106 -0
- package/esm2022/tags/index.mjs +2 -0
- package/esm2022/tags/koobiq-components-tags.mjs +5 -0
- package/esm2022/tags/public-api.mjs +6 -0
- package/esm2022/tags/tag-default-options.mjs +4 -0
- package/esm2022/tags/tag-input.mjs +248 -0
- package/esm2022/tags/tag-list.component.mjs +714 -0
- package/esm2022/tags/tag-text-control.mjs +2 -0
- package/esm2022/tags/tag.component.mjs +381 -0
- package/esm2022/tags/tag.module.mjs +56 -0
- package/esm2022/textarea/index.mjs +2 -0
- package/esm2022/textarea/koobiq-components-textarea.mjs +5 -0
- package/esm2022/textarea/public-api.mjs +3 -0
- package/esm2022/textarea/textarea.component.mjs +254 -0
- package/esm2022/textarea/textarea.module.mjs +21 -0
- package/esm2022/timepicker/index.mjs +2 -0
- package/esm2022/timepicker/koobiq-components-timepicker.mjs +5 -0
- package/esm2022/timepicker/public-api.mjs +4 -0
- package/esm2022/timepicker/timepicker.constants.mjs +25 -0
- package/esm2022/timepicker/timepicker.directive.mjs +647 -0
- package/esm2022/timepicker/timepicker.module.mjs +32 -0
- package/esm2022/timezone/cities-by-filter.pipe.mjs +17 -0
- package/esm2022/timezone/index.mjs +2 -0
- package/esm2022/timezone/koobiq-components-timezone.mjs +5 -0
- package/esm2022/timezone/public-api.mjs +7 -0
- package/esm2022/timezone/timezone-option.component.mjs +48 -0
- package/esm2022/timezone/timezone-option.directive.mjs +60 -0
- package/esm2022/timezone/timezone-select.component.mjs +40 -0
- package/esm2022/timezone/timezone.models.mjs +3 -0
- package/esm2022/timezone/timezone.module.mjs +75 -0
- package/esm2022/timezone/timezone.utils.mjs +79 -0
- package/esm2022/timezone/utc-offset.pipe.mjs +17 -0
- package/esm2022/title/index.mjs +2 -0
- package/esm2022/title/koobiq-components-title.mjs +5 -0
- package/esm2022/title/public-api.mjs +3 -0
- package/esm2022/title/title.directive.mjs +107 -0
- package/esm2022/title/title.module.mjs +18 -0
- package/esm2022/toast/index.mjs +2 -0
- package/esm2022/toast/koobiq-components-toast.mjs +5 -0
- package/esm2022/toast/public-api.mjs +6 -0
- package/esm2022/toast/toast-animations.mjs +9 -0
- package/esm2022/toast/toast-container.component.mjs +44 -0
- package/esm2022/toast/toast.component.mjs +92 -0
- package/esm2022/toast/toast.module.mjs +42 -0
- package/esm2022/toast/toast.service.mjs +188 -0
- package/esm2022/toast/toast.type.mjs +15 -0
- package/esm2022/toggle/index.mjs +2 -0
- package/esm2022/toggle/koobiq-components-toggle.mjs +5 -0
- package/esm2022/toggle/public-api.mjs +3 -0
- package/esm2022/toggle/toggle.component.mjs +160 -0
- package/esm2022/toggle/toggle.module.mjs +20 -0
- package/esm2022/tooltip/index.mjs +2 -0
- package/esm2022/tooltip/koobiq-components-tooltip.mjs +5 -0
- package/esm2022/tooltip/public-api.mjs +3 -0
- package/esm2022/tooltip/tooltip.animations.mjs +19 -0
- package/esm2022/tooltip/tooltip.component.mjs +308 -0
- package/esm2022/tooltip/tooltip.module.mjs +42 -0
- package/esm2022/tree/control/base-tree-control.mjs +60 -0
- package/esm2022/tree/control/flat-tree-control.mjs +130 -0
- package/esm2022/tree/control/nested-tree-control.mjs +41 -0
- package/esm2022/tree/control/tree-control.mjs +2 -0
- package/esm2022/tree/data-source/flat-data-source.mjs +162 -0
- package/esm2022/tree/data-source/nested-data-source.mjs +30 -0
- package/esm2022/tree/index.mjs +2 -0
- package/esm2022/tree/koobiq-components-tree.mjs +5 -0
- package/esm2022/tree/node.mjs +31 -0
- package/esm2022/tree/outlet.mjs +15 -0
- package/esm2022/tree/padding.directive.mjs +113 -0
- package/esm2022/tree/public-api.mjs +16 -0
- package/esm2022/tree/toggle.mjs +81 -0
- package/esm2022/tree/tree-base.mjs +243 -0
- package/esm2022/tree/tree-errors.mjs +36 -0
- package/esm2022/tree/tree-option.component.mjs +299 -0
- package/esm2022/tree/tree-selection.component.mjs +557 -0
- package/esm2022/tree/tree.mjs +15 -0
- package/esm2022/tree/tree.module.mjs +57 -0
- package/esm2022/tree-select/index.mjs +2 -0
- package/esm2022/tree-select/koobiq-components-tree-select.mjs +5 -0
- package/esm2022/tree-select/public-api.mjs +3 -0
- package/esm2022/tree-select/tree-select.component.mjs +936 -0
- package/esm2022/tree-select/tree-select.module.mjs +45 -0
- package/fesm2022/koobiq-components-alert.mjs +115 -0
- package/fesm2022/koobiq-components-alert.mjs.map +1 -0
- package/fesm2022/koobiq-components-autocomplete.mjs +748 -0
- package/fesm2022/koobiq-components-autocomplete.mjs.map +1 -0
- package/fesm2022/koobiq-components-button-toggle.mjs +403 -0
- package/fesm2022/koobiq-components-button-toggle.mjs.map +1 -0
- package/fesm2022/koobiq-components-button.mjs +207 -0
- package/fesm2022/koobiq-components-button.mjs.map +1 -0
- package/fesm2022/koobiq-components-card.mjs +111 -0
- package/fesm2022/koobiq-components-card.mjs.map +1 -0
- package/fesm2022/koobiq-components-checkbox.mjs +353 -0
- package/fesm2022/koobiq-components-checkbox.mjs.map +1 -0
- package/fesm2022/koobiq-components-code-block.mjs +278 -0
- package/fesm2022/koobiq-components-code-block.mjs.map +1 -0
- package/fesm2022/koobiq-components-core.mjs +2338 -0
- package/fesm2022/koobiq-components-core.mjs.map +1 -0
- package/fesm2022/koobiq-components-datepicker.mjs +2101 -0
- package/fesm2022/koobiq-components-datepicker.mjs.map +1 -0
- package/fesm2022/koobiq-components-divider.mjs +71 -0
- package/fesm2022/koobiq-components-divider.mjs.map +1 -0
- package/fesm2022/koobiq-components-dl.mjs +126 -0
- package/fesm2022/koobiq-components-dl.mjs.map +1 -0
- package/fesm2022/koobiq-components-dropdown.mjs +1102 -0
- package/fesm2022/koobiq-components-dropdown.mjs.map +1 -0
- package/fesm2022/koobiq-components-ellipsis-center.mjs +111 -0
- package/fesm2022/koobiq-components-ellipsis-center.mjs.map +1 -0
- package/fesm2022/koobiq-components-file-upload.mjs +388 -0
- package/fesm2022/koobiq-components-file-upload.mjs.map +1 -0
- package/fesm2022/koobiq-components-form-field.mjs +825 -0
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -0
- package/fesm2022/koobiq-components-icon.mjs +188 -0
- package/fesm2022/koobiq-components-icon.mjs.map +1 -0
- package/fesm2022/koobiq-components-input.mjs +831 -0
- package/fesm2022/koobiq-components-input.mjs.map +1 -0
- package/fesm2022/koobiq-components-link.mjs +159 -0
- package/fesm2022/koobiq-components-link.mjs.map +1 -0
- package/fesm2022/koobiq-components-list.mjs +800 -0
- package/fesm2022/koobiq-components-list.mjs.map +1 -0
- package/fesm2022/koobiq-components-loader-overlay.mjs +155 -0
- package/fesm2022/koobiq-components-loader-overlay.mjs.map +1 -0
- package/fesm2022/koobiq-components-markdown.mjs +127 -0
- package/fesm2022/koobiq-components-markdown.mjs.map +1 -0
- package/fesm2022/koobiq-components-modal.mjs +868 -0
- package/fesm2022/koobiq-components-modal.mjs.map +1 -0
- package/fesm2022/koobiq-components-navbar.mjs +1037 -0
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -0
- package/fesm2022/koobiq-components-popover.mjs +407 -0
- package/fesm2022/koobiq-components-popover.mjs.map +1 -0
- package/fesm2022/koobiq-components-progress-bar.mjs +110 -0
- package/fesm2022/koobiq-components-progress-bar.mjs.map +1 -0
- package/fesm2022/koobiq-components-progress-spinner.mjs +125 -0
- package/fesm2022/koobiq-components-progress-spinner.mjs.map +1 -0
- package/fesm2022/koobiq-components-radio.mjs +481 -0
- package/fesm2022/koobiq-components-radio.mjs.map +1 -0
- package/fesm2022/koobiq-components-select.mjs +1278 -0
- package/fesm2022/koobiq-components-select.mjs.map +1 -0
- package/fesm2022/koobiq-components-sidebar.mjs +202 -0
- package/fesm2022/koobiq-components-sidebar.mjs.map +1 -0
- package/fesm2022/koobiq-components-sidepanel.mjs +613 -0
- package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -0
- package/fesm2022/koobiq-components-splitter.mjs +524 -0
- package/fesm2022/koobiq-components-splitter.mjs.map +1 -0
- package/fesm2022/koobiq-components-table.mjs +45 -0
- package/fesm2022/koobiq-components-table.mjs.map +1 -0
- package/fesm2022/koobiq-components-tabs.mjs +1499 -0
- package/fesm2022/koobiq-components-tabs.mjs.map +1 -0
- package/fesm2022/koobiq-components-tags.mjs +1383 -0
- package/fesm2022/koobiq-components-tags.mjs.map +1 -0
- package/fesm2022/koobiq-components-textarea.mjs +277 -0
- package/fesm2022/koobiq-components-textarea.mjs.map +1 -0
- package/fesm2022/koobiq-components-timepicker.mjs +706 -0
- package/fesm2022/koobiq-components-timepicker.mjs.map +1 -0
- package/fesm2022/koobiq-components-timezone.mjs +314 -0
- package/fesm2022/koobiq-components-timezone.mjs.map +1 -0
- package/fesm2022/koobiq-components-title.mjs +125 -0
- package/fesm2022/koobiq-components-title.mjs.map +1 -0
- package/fesm2022/koobiq-components-toast.mjs +375 -0
- package/fesm2022/koobiq-components-toast.mjs.map +1 -0
- package/fesm2022/koobiq-components-toggle.mjs +182 -0
- package/fesm2022/koobiq-components-toggle.mjs.map +1 -0
- package/fesm2022/koobiq-components-tooltip.mjs +370 -0
- package/fesm2022/koobiq-components-tooltip.mjs.map +1 -0
- package/fesm2022/koobiq-components-tree-select.mjs +978 -0
- package/fesm2022/koobiq-components-tree-select.mjs.map +1 -0
- package/fesm2022/koobiq-components-tree.mjs +1802 -0
- package/fesm2022/koobiq-components-tree.mjs.map +1 -0
- package/fesm2022/koobiq-components.mjs +4 -0
- package/fesm2022/koobiq-components.mjs.map +1 -0
- package/file-upload/README.md +0 -0
- package/file-upload/_file-upload-theme.scss +174 -0
- package/file-upload/file-drop.d.ts +11 -0
- package/file-upload/file-upload.d.ts +22 -0
- package/file-upload/file-upload.module.d.ts +18 -0
- package/file-upload/file-upload.scss +46 -0
- package/file-upload/index.d.ts +1 -0
- package/file-upload/multiple-file-upload.component.d.ts +51 -0
- package/file-upload/multiple-file-upload.component.scss +148 -0
- package/file-upload/public-api.d.ts +5 -0
- package/file-upload/single-file-upload.component.d.ts +34 -0
- package/file-upload/single-file-upload.component.scss +60 -0
- package/form-field/README.md +0 -0
- package/form-field/_form-field-theme.scss +112 -0
- package/form-field/_hint-theme.scss +67 -0
- package/form-field/cleaner.d.ts +5 -0
- package/form-field/cleaner.scss +22 -0
- package/form-field/form-field-control.d.ts +37 -0
- package/form-field/form-field-errors.d.ts +2 -0
- package/form-field/form-field.d.ts +84 -0
- package/form-field/form-field.module.d.ts +17 -0
- package/form-field/form-field.scss +143 -0
- package/form-field/hint.d.ts +17 -0
- package/form-field/hint.scss +15 -0
- package/form-field/index.d.ts +1 -0
- package/form-field/password-hint.d.ts +40 -0
- package/form-field/password-hint.scss +11 -0
- package/form-field/password-toggle.d.ts +18 -0
- package/form-field/password-toggle.scss +29 -0
- package/form-field/prefix.d.ts +5 -0
- package/form-field/public-api.d.ts +12 -0
- package/form-field/stepper.d.ts +11 -0
- package/form-field/stepper.scss +33 -0
- package/form-field/suffix.d.ts +5 -0
- package/form-field/validate.directive.d.ts +33 -0
- package/icon/README.md +0 -0
- package/icon/_icon-theme.scss +267 -0
- package/icon/icon.component.d.ts +47 -0
- package/icon/icon.module.d.ts +10 -0
- package/icon/icon.scss +73 -0
- package/icon/index.d.ts +1 -0
- package/icon/public-api.d.ts +2 -0
- package/index.d.ts +1 -0
- package/input/_input-theme.scss +13 -0
- package/input/index.d.ts +1 -0
- package/input/input-errors.d.ts +1 -0
- package/input/input-number-validators.d.ts +35 -0
- package/input/input-number.d.ts +33 -0
- package/input/input-password.d.ts +92 -0
- package/input/input-value-accessor.d.ts +4 -0
- package/input/input.d.ts +117 -0
- package/input/input.module.d.ts +15 -0
- package/input/input.scss +48 -0
- package/input/public-api.d.ts +6 -0
- package/link/README.md +0 -0
- package/link/_link-theme.scss +178 -0
- package/link/index.d.ts +1 -0
- package/link/link.component.d.ts +47 -0
- package/link/link.module.d.ts +9 -0
- package/link/public-api.d.ts +2 -0
- package/list/README.md +0 -0
- package/list/_list-base.scss +54 -0
- package/list/_list-theme.scss +47 -0
- package/list/index.d.ts +1 -0
- package/list/list-selection.component.d.ts +172 -0
- package/list/list.component.d.ts +18 -0
- package/list/list.module.d.ts +11 -0
- package/list/list.scss +52 -0
- package/list/public-api.d.ts +3 -0
- package/loader-overlay/README.md +0 -0
- package/loader-overlay/_loader-overlay-theme.scss +34 -0
- package/loader-overlay/index.d.ts +1 -0
- package/loader-overlay/loader-overlay.component.d.ts +34 -0
- package/loader-overlay/loader-overlay.module.d.ts +11 -0
- package/loader-overlay/loader-overlay.scss +64 -0
- package/loader-overlay/public-api.d.ts +2 -0
- package/markdown/README.md +0 -0
- package/markdown/_markdown-theme.scss +142 -0
- package/markdown/index.d.ts +1 -0
- package/markdown/markdown.component.d.ts +19 -0
- package/markdown/markdown.module.d.ts +11 -0
- package/markdown/markdown.scss +249 -0
- package/markdown/markdown.service.d.ts +7 -0
- package/markdown/markdown.values.d.ts +3 -0
- package/markdown/public-api.d.ts +4 -0
- package/modal/README.md +34 -0
- package/modal/_modal-animation.scss +114 -0
- package/modal/_modal-confirm.scss +53 -0
- package/modal/_modal-theme.scss +90 -0
- package/modal/css-unit.pipe.d.ts +7 -0
- package/modal/index.d.ts +1 -0
- package/modal/modal-control.service.d.ts +20 -0
- package/modal/modal-ref.class.d.ts +36 -0
- package/modal/modal-util.d.ts +12 -0
- package/modal/modal.component.d.ts +128 -0
- package/modal/modal.directive.d.ts +17 -0
- package/modal/modal.module.d.ts +14 -0
- package/modal/modal.scss +143 -0
- package/modal/modal.service.d.ts +33 -0
- package/modal/modal.type.d.ts +61 -0
- package/modal/public-api.d.ts +6 -0
- package/navbar/README.md +41 -0
- package/navbar/_navbar-theme.scss +123 -0
- package/navbar/index.d.ts +1 -0
- package/navbar/navbar-brand.scss +70 -0
- package/navbar/navbar-divider.scss +18 -0
- package/navbar/navbar-item.component.d.ts +167 -0
- package/navbar/navbar-item.scss +159 -0
- package/navbar/navbar.component.d.ts +58 -0
- package/navbar/navbar.module.d.ts +14 -0
- package/navbar/navbar.scss +20 -0
- package/navbar/public-api.d.ts +4 -0
- package/navbar/vertical-navbar.animation.d.ts +2 -0
- package/navbar/vertical-navbar.component.d.ts +23 -0
- package/navbar/vertical-navbar.scss +46 -0
- package/package.json +323 -0
- package/popover/README.md +32 -0
- package/popover/_popover-theme.scss +111 -0
- package/popover/index.d.ts +1 -0
- package/popover/popover-animations.d.ts +4 -0
- package/popover/popover-confirm.component.d.ts +33 -0
- package/popover/popover.component.d.ts +75 -0
- package/popover/popover.module.d.ts +12 -0
- package/popover/popover.scss +114 -0
- package/popover/public-api.d.ts +4 -0
- package/prebuilt-themes/dark-theme.css +1 -0
- package/prebuilt-themes/light-theme.css +1 -0
- package/progress-bar/README.md +0 -0
- package/progress-bar/_progress-bar-theme.scss +41 -0
- package/progress-bar/index.d.ts +1 -0
- package/progress-bar/progress-bar.component.d.ts +28 -0
- package/progress-bar/progress-bar.module.d.ts +9 -0
- package/progress-bar/progress-bar.scss +68 -0
- package/progress-bar/public-api.d.ts +2 -0
- package/progress-spinner/README.md +0 -0
- package/progress-spinner/_progress-spinner-theme.scss +35 -0
- package/progress-spinner/index.d.ts +1 -0
- package/progress-spinner/progress-spinner.component.d.ts +34 -0
- package/progress-spinner/progress-spinner.module.d.ts +9 -0
- package/progress-spinner/progress-spinner.scss +72 -0
- package/progress-spinner/public-api.d.ts +2 -0
- package/public-api.d.ts +1 -0
- package/radio/_radio-theme.scss +95 -0
- package/radio/index.d.ts +1 -0
- package/radio/public-api.d.ts +2 -0
- package/radio/radio.component.d.ts +204 -0
- package/radio/radio.module.d.ts +10 -0
- package/radio/radio.scss +143 -0
- package/select/README.md +0 -0
- package/select/_select-theme.scss +55 -0
- package/select/index.d.ts +1 -0
- package/select/public-api.d.ts +3 -0
- package/select/select-option.directive.d.ts +20 -0
- package/select/select.component.d.ts +330 -0
- package/select/select.module.d.ts +15 -0
- package/select/select.scss +222 -0
- package/sidebar/index.d.ts +1 -0
- package/sidebar/public-api.d.ts +2 -0
- package/sidebar/sidebar-animations.d.ts +8 -0
- package/sidebar/sidebar.component.d.ts +53 -0
- package/sidebar/sidebar.module.d.ts +8 -0
- package/sidebar/sidebar.scss +12 -0
- package/sidepanel/_sidepanel-theme.scss +67 -0
- package/sidepanel/index.d.ts +1 -0
- package/sidepanel/public-api.d.ts +6 -0
- package/sidepanel/sidepanel-animations.d.ts +14 -0
- package/sidepanel/sidepanel-config.d.ts +31 -0
- package/sidepanel/sidepanel-container.component.d.ts +46 -0
- package/sidepanel/sidepanel-directives.d.ts +50 -0
- package/sidepanel/sidepanel-ref.d.ts +24 -0
- package/sidepanel/sidepanel.module.d.ts +16 -0
- package/sidepanel/sidepanel.scss +203 -0
- package/sidepanel/sidepanel.service.d.ts +57 -0
- package/splitter/_splitter-theme.scss +31 -0
- package/splitter/index.d.ts +1 -0
- package/splitter/public-api.d.ts +2 -0
- package/splitter/splitter.component.d.ts +130 -0
- package/splitter/splitter.module.d.ts +9 -0
- package/splitter/splitter.scss +48 -0
- package/table/README.md +0 -0
- package/table/_table-theme.scss +65 -0
- package/table/index.d.ts +1 -0
- package/table/public-api.d.ts +2 -0
- package/table/table.component.d.ts +5 -0
- package/table/table.module.d.ts +10 -0
- package/table/table.scss +76 -0
- package/tabs/README.md +0 -0
- package/tabs/_tabs-common.scss +197 -0
- package/tabs/_tabs-theme.scss +240 -0
- package/tabs/index.d.ts +1 -0
- package/tabs/paginated-tab-header.d.ts +179 -0
- package/tabs/public-api.d.ts +10 -0
- package/tabs/tab-body.component.d.ts +95 -0
- package/tabs/tab-body.scss +8 -0
- package/tabs/tab-content.directive.d.ts +9 -0
- package/tabs/tab-group.component.d.ts +134 -0
- package/tabs/tab-group.scss +63 -0
- package/tabs/tab-header.component.d.ts +35 -0
- package/tabs/tab-header.scss +106 -0
- package/tabs/tab-label-wrapper.directive.d.ts +31 -0
- package/tabs/tab-label.directive.d.ts +9 -0
- package/tabs/tab-nav-bar/index.d.ts +1 -0
- package/tabs/tab-nav-bar/tab-nav-bar.d.ts +40 -0
- package/tabs/tab-nav-bar/tab-nav-bar.scss +54 -0
- package/tabs/tab.component.d.ts +68 -0
- package/tabs/tabs-animations.d.ts +4 -0
- package/tabs/tabs.module.d.ts +21 -0
- package/tags/README.md +0 -0
- package/tags/_tag-theme.scss +100 -0
- package/tags/index.d.ts +1 -0
- package/tags/public-api.d.ts +5 -0
- package/tags/tag-default-options.d.ts +8 -0
- package/tags/tag-input.d.ts +87 -0
- package/tags/tag-list.component.d.ts +246 -0
- package/tags/tag-list.scss +66 -0
- package/tags/tag-text-control.d.ts +10 -0
- package/tags/tag.component.d.ts +140 -0
- package/tags/tag.module.d.ts +11 -0
- package/tags/tag.scss +67 -0
- package/textarea/README.md +0 -0
- package/textarea/_textarea-theme.scss +13 -0
- package/textarea/index.d.ts +1 -0
- package/textarea/public-api.d.ts +2 -0
- package/textarea/textarea.component.d.ts +114 -0
- package/textarea/textarea.module.d.ts +11 -0
- package/textarea/textarea.scss +45 -0
- package/timepicker/README.md +0 -0
- package/timepicker/index.d.ts +1 -0
- package/timepicker/public-api.d.ts +3 -0
- package/timepicker/timepicker.constants.d.ts +20 -0
- package/timepicker/timepicker.directive.d.ts +141 -0
- package/timepicker/timepicker.module.d.ts +11 -0
- package/timepicker/timepicker.scss +18 -0
- package/timezone/README.md +0 -0
- package/timezone/_timezone-option-theme.scss +34 -0
- package/timezone/cities-by-filter.pipe.d.ts +7 -0
- package/timezone/index.d.ts +1 -0
- package/timezone/public-api.d.ts +6 -0
- package/timezone/timezone-option.component.d.ts +15 -0
- package/timezone/timezone-option.component.scss +35 -0
- package/timezone/timezone-option.directive.d.ts +20 -0
- package/timezone/timezone-select.component.d.ts +14 -0
- package/timezone/timezone.models.d.ts +16 -0
- package/timezone/timezone.module.d.ts +19 -0
- package/timezone/timezone.utils.d.ts +18 -0
- package/timezone/utc-offset.pipe.d.ts +7 -0
- package/title/index.d.ts +1 -0
- package/title/public-api.d.ts +2 -0
- package/title/title.directive.d.ts +31 -0
- package/title/title.module.d.ts +8 -0
- package/toast/_toast-theme.scss +61 -0
- package/toast/index.d.ts +1 -0
- package/toast/public-api.d.ts +5 -0
- package/toast/toast-animations.d.ts +4 -0
- package/toast/toast-container.component.d.ts +15 -0
- package/toast/toast-container.component.scss +23 -0
- package/toast/toast.component.d.ts +35 -0
- package/toast/toast.component.scss +76 -0
- package/toast/toast.module.d.ts +13 -0
- package/toast/toast.service.d.ts +51 -0
- package/toast/toast.type.d.ts +27 -0
- package/toggle/_toggle-theme.scss +98 -0
- package/toggle/index.d.ts +1 -0
- package/toggle/public-api.d.ts +2 -0
- package/toggle/toggle.component.d.ts +57 -0
- package/toggle/toggle.module.d.ts +10 -0
- package/toggle/toggle.scss +99 -0
- package/tooltip/_tooltip-theme.scss +49 -0
- package/tooltip/index.d.ts +1 -0
- package/tooltip/public-api.d.ts +2 -0
- package/tooltip/tooltip.animations.d.ts +8 -0
- package/tooltip/tooltip.component.d.ts +94 -0
- package/tooltip/tooltip.module.d.ts +9 -0
- package/tooltip/tooltip.scss +54 -0
- package/tree/_tree-theme.scss +69 -0
- package/tree/control/base-tree-control.d.ts +40 -0
- package/tree/control/flat-tree-control.d.ts +53 -0
- package/tree/control/nested-tree-control.d.ts +19 -0
- package/tree/control/tree-control.d.ts +44 -0
- package/tree/data-source/flat-data-source.d.ts +80 -0
- package/tree/data-source/nested-data-source.d.ts +15 -0
- package/tree/index.d.ts +1 -0
- package/tree/node.d.ts +34 -0
- package/tree/outlet.d.ts +9 -0
- package/tree/padding.directive.d.ts +47 -0
- package/tree/public-api.d.ts +15 -0
- package/tree/toggle.d.ts +30 -0
- package/tree/toggle.scss +35 -0
- package/tree/tree-base.d.ts +97 -0
- package/tree/tree-errors.d.ts +25 -0
- package/tree/tree-option.component.d.ts +80 -0
- package/tree/tree-option.scss +67 -0
- package/tree/tree-selection.component.d.ts +134 -0
- package/tree/tree-selection.scss +3 -0
- package/tree/tree.d.ts +6 -0
- package/tree/tree.module.d.ts +16 -0
- package/tree/tree.scss +3 -0
- package/tree-select/README.md +0 -0
- package/tree-select/_tree-select-theme.scss +41 -0
- package/tree-select/index.d.ts +1 -0
- package/tree-select/public-api.d.ts +2 -0
- package/tree-select/tree-select.component.d.ts +283 -0
- package/tree-select/tree-select.module.d.ts +14 -0
- package/tree-select/tree-select.scss +225 -0
|
@@ -0,0 +1,1802 @@
|
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
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 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 { BehaviorSubject, Subject, Observable, of, merge, asyncScheduler } from 'rxjs';
|
|
8
|
+
import * as i1$1 from 'rxjs/internal/scheduler/AsyncScheduler';
|
|
9
|
+
import { AsyncScheduler } from 'rxjs/internal/scheduler/AsyncScheduler';
|
|
10
|
+
import * as i3 from '@angular/cdk/bidi';
|
|
11
|
+
import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
12
|
+
import { TreeSizePaddingLeft } from '@koobiq/tokens-koobiq/web';
|
|
13
|
+
import { takeUntil, map, take, delay } from 'rxjs/operators';
|
|
14
|
+
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';
|
|
15
|
+
import { KbqDropdownTrigger } from '@koobiq/components/dropdown';
|
|
16
|
+
import { KbqTooltipTrigger } from '@koobiq/components/tooltip';
|
|
17
|
+
import * as i2$1 from '@angular/cdk/clipboard';
|
|
18
|
+
import { SelectionModel, DataSource } from '@angular/cdk/collections';
|
|
19
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
20
|
+
import { FocusKeyManager } from '@koobiq/cdk/a11y';
|
|
21
|
+
|
|
22
|
+
/** Context provided to the tree node component. */
|
|
23
|
+
class KbqTreeNodeOutletContext {
|
|
24
|
+
constructor(data) {
|
|
25
|
+
this.$implicit = data;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Data node definition for the KbqTree.
|
|
30
|
+
* Captures the node's template and a when predicate that describes when this node should be used.
|
|
31
|
+
*/
|
|
32
|
+
class KbqTreeNodeDef {
|
|
33
|
+
/** @docs-private */
|
|
34
|
+
constructor(template) {
|
|
35
|
+
this.template = template;
|
|
36
|
+
}
|
|
37
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeDef, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
38
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeNodeDef, selector: "[mcTreeNodeDef]", inputs: { when: ["mcTreeNodeDefWhen", "when"], data: ["mcTreeNode", "data"] }, ngImport: i0 }); }
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeDef, decorators: [{
|
|
41
|
+
type: Directive,
|
|
42
|
+
args: [{
|
|
43
|
+
selector: '[mcTreeNodeDef]',
|
|
44
|
+
inputs: ['when: mcTreeNodeDefWhen']
|
|
45
|
+
}]
|
|
46
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { data: [{
|
|
47
|
+
type: Input,
|
|
48
|
+
args: ['mcTreeNode']
|
|
49
|
+
}] } });
|
|
50
|
+
|
|
51
|
+
class KbqTreeNodeOutlet {
|
|
52
|
+
constructor(viewContainer, changeDetectorRef) {
|
|
53
|
+
this.viewContainer = viewContainer;
|
|
54
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
55
|
+
}
|
|
56
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeOutlet, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
57
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeNodeOutlet, selector: "[mcTreeNodeOutlet]", ngImport: i0 }); }
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeOutlet, decorators: [{
|
|
60
|
+
type: Directive,
|
|
61
|
+
args: [{ selector: '[mcTreeNodeOutlet]' }]
|
|
62
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; } });
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns an error to be thrown when there is no usable data.
|
|
66
|
+
* @docs-private
|
|
67
|
+
*/
|
|
68
|
+
function getTreeNoValidDataSourceError() {
|
|
69
|
+
return Error(`A valid data source must be provided.`);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns an error to be thrown when there are multiple nodes that are missing a when function.
|
|
73
|
+
* @docs-private
|
|
74
|
+
*/
|
|
75
|
+
function getTreeMultipleDefaultNodeDefsError() {
|
|
76
|
+
return Error(`There can only be one default row without a when predicate function.`);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns an error to be thrown when there are no matching node defs for a particular set of data.
|
|
80
|
+
* @docs-private
|
|
81
|
+
*/
|
|
82
|
+
function getTreeMissingMatchingNodeDefError() {
|
|
83
|
+
return Error(`Could not find a matching node definition for the provided node data.`);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns an error to be thrown when there are tree control.
|
|
87
|
+
* @docs-private
|
|
88
|
+
*/
|
|
89
|
+
function getTreeControlMissingError() {
|
|
90
|
+
return Error(`Could not find a tree control for the tree.`);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Returns an error to be thrown when tree control did not implement functions for flat/nested node.
|
|
94
|
+
* @docs-private
|
|
95
|
+
*/
|
|
96
|
+
function getTreeControlFunctionsMissingError() {
|
|
97
|
+
return Error(`Could not find functions for nested/flat tree in tree control.`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
class KbqTreeBase {
|
|
101
|
+
/**
|
|
102
|
+
* Provides a stream containing the latest data array to render. Influenced by the tree's
|
|
103
|
+
* stream of view window (what dataNodes are currently on screen).
|
|
104
|
+
* Data source can be an observable of data array, or a dara array to render.
|
|
105
|
+
*/
|
|
106
|
+
get dataSource() {
|
|
107
|
+
return this._dataSource;
|
|
108
|
+
}
|
|
109
|
+
set dataSource(dataSource) {
|
|
110
|
+
if (this._dataSource !== dataSource) {
|
|
111
|
+
this.switchDataSource(dataSource);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
constructor(differs, changeDetectorRef) {
|
|
115
|
+
this.differs = differs;
|
|
116
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
117
|
+
// TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange.
|
|
118
|
+
// Remove the MAX_VALUE in viewChange
|
|
119
|
+
/**
|
|
120
|
+
* Stream containing the latest information on what rows are being displayed on screen.
|
|
121
|
+
* Can be used by the data source to as a heuristic of what data should be provided.
|
|
122
|
+
*/
|
|
123
|
+
this.viewChange = new BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
|
|
124
|
+
/** Subject that emits when the component has been destroyed. */
|
|
125
|
+
this.onDestroy = new Subject();
|
|
126
|
+
/** Level of nodes */
|
|
127
|
+
this.levels = new Map();
|
|
128
|
+
}
|
|
129
|
+
ngOnInit() {
|
|
130
|
+
this.dataDiffer = this.differs.find([]).create(this.trackBy);
|
|
131
|
+
if (!this.treeControl) {
|
|
132
|
+
throw getTreeControlMissingError();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
ngOnDestroy() {
|
|
136
|
+
this.nodeOutlet.viewContainer.clear();
|
|
137
|
+
this.onDestroy.next();
|
|
138
|
+
this.onDestroy.complete();
|
|
139
|
+
// tslint:disable-next-line:no-unbound-method
|
|
140
|
+
if (this._dataSource && typeof this.dataSource.disconnect === 'function') {
|
|
141
|
+
this.dataSource.disconnect(this);
|
|
142
|
+
}
|
|
143
|
+
if (this.dataSubscription) {
|
|
144
|
+
this.dataSubscription.unsubscribe();
|
|
145
|
+
this.dataSubscription = null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
ngAfterContentChecked() {
|
|
149
|
+
const defaultNodeDefs = this.nodeDefs.filter((def) => !def.when);
|
|
150
|
+
if (defaultNodeDefs.length > 1) {
|
|
151
|
+
throw getTreeMultipleDefaultNodeDefsError();
|
|
152
|
+
}
|
|
153
|
+
this.defaultNodeDef = defaultNodeDefs[0];
|
|
154
|
+
if (this.dataSource && this.nodeDefs && !this.dataSubscription) {
|
|
155
|
+
this.observeRenderChanges();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Check for changes made in the data and render each change (node added/removed/moved). */
|
|
159
|
+
renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
|
|
160
|
+
const changes = dataDiffer.diff(data);
|
|
161
|
+
if (!changes) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
|
|
165
|
+
if (item.previousIndex == null) {
|
|
166
|
+
this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
|
|
167
|
+
}
|
|
168
|
+
else if (currentIndex == null) {
|
|
169
|
+
viewContainer.remove(adjustedPreviousIndex);
|
|
170
|
+
this.levels.delete(item.item);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
const view = viewContainer.get(adjustedPreviousIndex);
|
|
174
|
+
viewContainer.move(view, currentIndex);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
this.changeDetectorRef.detectChanges();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Finds the matching node definition that should be used for this node data. If there is only
|
|
181
|
+
* one node definition, it is returned. Otherwise, find the node definition that has a when
|
|
182
|
+
* predicate that returns true with the data. If none return true, return the default node
|
|
183
|
+
* definition.
|
|
184
|
+
*/
|
|
185
|
+
getNodeDef(data, i) {
|
|
186
|
+
if (this.nodeDefs.length === 1) {
|
|
187
|
+
return this.nodeDefs.first;
|
|
188
|
+
}
|
|
189
|
+
const nodeDef = this.nodeDefs.find((def) => def.when && def.when(i, data)) || this.defaultNodeDef;
|
|
190
|
+
if (!nodeDef) {
|
|
191
|
+
throw getTreeMissingMatchingNodeDefError();
|
|
192
|
+
}
|
|
193
|
+
return nodeDef;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Create the embedded view for the data node template and place it in the correct index location
|
|
197
|
+
* within the data node view container.
|
|
198
|
+
*/
|
|
199
|
+
insertNode(nodeData, index, viewContainer, parentData) {
|
|
200
|
+
const node = this.getNodeDef(nodeData, index);
|
|
201
|
+
// Node context that will be provided to created embedded view
|
|
202
|
+
const context = new KbqTreeNodeOutletContext(nodeData);
|
|
203
|
+
// If the tree is flat tree, then use the `getLevel` function in flat tree control
|
|
204
|
+
// Otherwise, use the level of parent node.
|
|
205
|
+
if (this.treeControl.getLevel) {
|
|
206
|
+
context.level = this.treeControl.getLevel(nodeData);
|
|
207
|
+
/* tslint:disable-next-line:no-typeof-undefined */
|
|
208
|
+
}
|
|
209
|
+
else if (typeof parentData !== 'undefined' && this.levels.has(parentData)) {
|
|
210
|
+
context.level = this.levels.get(parentData) + 1;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
context.level = 0;
|
|
214
|
+
}
|
|
215
|
+
this.levels.set(nodeData, context.level);
|
|
216
|
+
// Use default tree nodeOutlet, or nested node's nodeOutlet
|
|
217
|
+
const container = viewContainer ? viewContainer : this.nodeOutlet.viewContainer;
|
|
218
|
+
container.createEmbeddedView(node.template, context, index);
|
|
219
|
+
// Set the data to just created `KbqTreeNode`.
|
|
220
|
+
// The `KbqTreeNode` created from `createEmbeddedView` will be saved in static variable
|
|
221
|
+
// `mostRecentTreeNode`. We get it from static variable and pass the node data to it.
|
|
222
|
+
if (KbqTreeNode.mostRecentTreeNode) {
|
|
223
|
+
KbqTreeNode.mostRecentTreeNode.data = nodeData;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** Set up a subscription for the data provided by the data source. */
|
|
227
|
+
observeRenderChanges() {
|
|
228
|
+
let dataStream;
|
|
229
|
+
// Cannot use `instanceof DataSource` since the data source could be a literal with
|
|
230
|
+
// `connect` function and may not extends DataSource.
|
|
231
|
+
// tslint:disable-next-line:no-unbound-method
|
|
232
|
+
if (typeof this._dataSource.connect === 'function') {
|
|
233
|
+
dataStream = this._dataSource.connect(this);
|
|
234
|
+
}
|
|
235
|
+
else if (this._dataSource instanceof Observable) {
|
|
236
|
+
dataStream = this._dataSource;
|
|
237
|
+
}
|
|
238
|
+
else if (Array.isArray(this._dataSource)) {
|
|
239
|
+
dataStream = of(this._dataSource);
|
|
240
|
+
}
|
|
241
|
+
if (dataStream) {
|
|
242
|
+
this.dataSubscription = dataStream
|
|
243
|
+
.pipe(takeUntil(this.onDestroy))
|
|
244
|
+
.subscribe((data) => this.renderNodeChanges(data));
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
throw getTreeNoValidDataSourceError();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Switch to the provided data source by resetting the data and unsubscribing from the current
|
|
252
|
+
* render change subscription if one exists. If the data source is null, interpret this by
|
|
253
|
+
* clearing the node outlet. Otherwise start listening for new data.
|
|
254
|
+
*/
|
|
255
|
+
switchDataSource(dataSource) {
|
|
256
|
+
// tslint:disable-next-line:no-unbound-method
|
|
257
|
+
if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
|
|
258
|
+
this.dataSource.disconnect(this);
|
|
259
|
+
}
|
|
260
|
+
if (this.dataSubscription) {
|
|
261
|
+
this.dataSubscription.unsubscribe();
|
|
262
|
+
this.dataSubscription = null;
|
|
263
|
+
}
|
|
264
|
+
// Remove the all dataNodes if there is now no data source
|
|
265
|
+
if (!dataSource) {
|
|
266
|
+
this.nodeOutlet.viewContainer.clear();
|
|
267
|
+
}
|
|
268
|
+
this._dataSource = dataSource;
|
|
269
|
+
if (this.nodeDefs) {
|
|
270
|
+
this.observeRenderChanges();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeBase, deps: [{ token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
274
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeBase, inputs: { treeControl: "treeControl", trackBy: "trackBy", dataSource: "dataSource" }, queries: [{ propertyName: "nodeDefs", predicate: KbqTreeNodeDef }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: KbqTreeNodeOutlet, descendants: true, static: true }], ngImport: i0 }); }
|
|
275
|
+
}
|
|
276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeBase, decorators: [{
|
|
277
|
+
type: Directive
|
|
278
|
+
}], ctorParameters: function () { return [{ type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { treeControl: [{
|
|
279
|
+
type: Input
|
|
280
|
+
}], trackBy: [{
|
|
281
|
+
type: Input
|
|
282
|
+
}], nodeOutlet: [{
|
|
283
|
+
type: ViewChild,
|
|
284
|
+
args: [KbqTreeNodeOutlet, { static: true }]
|
|
285
|
+
}], nodeDefs: [{
|
|
286
|
+
type: ContentChildren,
|
|
287
|
+
args: [KbqTreeNodeDef]
|
|
288
|
+
}], dataSource: [{
|
|
289
|
+
type: Input
|
|
290
|
+
}] } });
|
|
291
|
+
class KbqTreeNode {
|
|
292
|
+
/**
|
|
293
|
+
* The most recently created `KbqTreeNode`. We save it in static variable so we can retrieve it
|
|
294
|
+
* in `KbqTree` and set the data to it.
|
|
295
|
+
*/
|
|
296
|
+
static { this.mostRecentTreeNode = null; }
|
|
297
|
+
get data() {
|
|
298
|
+
return this._data;
|
|
299
|
+
}
|
|
300
|
+
set data(value) {
|
|
301
|
+
this._data = value;
|
|
302
|
+
}
|
|
303
|
+
get isExpanded() {
|
|
304
|
+
return this.tree.treeControl.isExpanded(this.data);
|
|
305
|
+
}
|
|
306
|
+
get level() {
|
|
307
|
+
return this.tree.treeControl.getLevel ? this.tree.treeControl.getLevel(this._data) : 0;
|
|
308
|
+
}
|
|
309
|
+
constructor(elementRef, tree) {
|
|
310
|
+
this.elementRef = elementRef;
|
|
311
|
+
this.tree = tree;
|
|
312
|
+
this.destroyed = new Subject();
|
|
313
|
+
KbqTreeNode.mostRecentTreeNode = this;
|
|
314
|
+
}
|
|
315
|
+
ngOnDestroy() {
|
|
316
|
+
this.destroyed.next();
|
|
317
|
+
this.destroyed.complete();
|
|
318
|
+
}
|
|
319
|
+
focus() {
|
|
320
|
+
this.elementRef.nativeElement.focus();
|
|
321
|
+
}
|
|
322
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNode, deps: [{ token: i0.ElementRef }, { token: forwardRef(() => KbqTreeBase) }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
323
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeNode, selector: "kbq-tree-node", exportAs: ["mcTreeNode"], ngImport: i0 }); }
|
|
324
|
+
}
|
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNode, decorators: [{
|
|
326
|
+
type: Directive,
|
|
327
|
+
args: [{
|
|
328
|
+
selector: 'kbq-tree-node',
|
|
329
|
+
exportAs: 'mcTreeNode'
|
|
330
|
+
}]
|
|
331
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: KbqTreeBase, decorators: [{
|
|
332
|
+
type: Inject,
|
|
333
|
+
args: [forwardRef(() => KbqTreeBase)]
|
|
334
|
+
}] }]; } });
|
|
335
|
+
|
|
336
|
+
/** @docs-private */
|
|
337
|
+
class KbqTreeNodeToggleBase {
|
|
338
|
+
}
|
|
339
|
+
/** @docs-private */
|
|
340
|
+
const KbqTreeNodeToggleMixinBase = mixinDisabled(KbqTreeNodeToggleBase);
|
|
341
|
+
/** @docs-private */
|
|
342
|
+
class KbqTreeNodeToggleBaseDirective extends KbqTreeNodeToggleMixinBase {
|
|
343
|
+
get recursive() {
|
|
344
|
+
return this._recursive;
|
|
345
|
+
}
|
|
346
|
+
set recursive(value) {
|
|
347
|
+
this._recursive = coerceBooleanProperty(value);
|
|
348
|
+
}
|
|
349
|
+
get iconState() {
|
|
350
|
+
return this.tree.treeControl.isExpanded(this.node);
|
|
351
|
+
}
|
|
352
|
+
constructor(tree, treeNode) {
|
|
353
|
+
super();
|
|
354
|
+
this.tree = tree;
|
|
355
|
+
this.treeNode = treeNode;
|
|
356
|
+
this._recursive = false;
|
|
357
|
+
this.tree.treeControl.filterValue
|
|
358
|
+
.pipe(map((value) => value?.length > 0))
|
|
359
|
+
.subscribe((state) => this.disabled = state);
|
|
360
|
+
}
|
|
361
|
+
toggle(event) {
|
|
362
|
+
if (this.disabled) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
this.recursive
|
|
366
|
+
? this.tree.treeControl.toggleDescendants(this.treeNode.data)
|
|
367
|
+
: this.tree.treeControl.toggle(this.treeNode.data);
|
|
368
|
+
event.stopPropagation();
|
|
369
|
+
}
|
|
370
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeToggleBaseDirective, deps: [{ token: KbqTreeBase }, { token: KbqTreeNode }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
371
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeNodeToggleBaseDirective, inputs: { node: "node", recursive: ["mcTreeNodeToggleRecursive", "recursive"] }, usesInheritance: true, ngImport: i0 }); }
|
|
372
|
+
}
|
|
373
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeToggleBaseDirective, decorators: [{
|
|
374
|
+
type: Directive
|
|
375
|
+
}], ctorParameters: function () { return [{ type: KbqTreeBase }, { type: KbqTreeNode }]; }, propDecorators: { node: [{
|
|
376
|
+
type: Input
|
|
377
|
+
}], recursive: [{
|
|
378
|
+
type: Input,
|
|
379
|
+
args: ['mcTreeNodeToggleRecursive']
|
|
380
|
+
}] } });
|
|
381
|
+
class KbqTreeNodeToggleComponent extends KbqTreeNodeToggleBaseDirective {
|
|
382
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
383
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", 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: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0, template: `<i class="mc kbq-icon kbq-angle-down-S_16"></i>`, 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, 4px);padding-right:var(--kbq-tree-size-toggle-padding, 4px);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"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
384
|
+
}
|
|
385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeToggleComponent, decorators: [{
|
|
386
|
+
type: Component,
|
|
387
|
+
args: [{ selector: 'kbq-tree-node-toggle', exportAs: 'mcTreeNodeToggle', template: `<i class="mc kbq-icon kbq-angle-down-S_16"></i>`, host: {
|
|
388
|
+
class: 'kbq-tree-node-toggle',
|
|
389
|
+
'[class.kbq-expanded]': 'iconState',
|
|
390
|
+
'[attr.disabled]': 'disabled || null',
|
|
391
|
+
'(click)': 'toggle($event)'
|
|
392
|
+
}, inputs: ['disabled'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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, 4px);padding-right:var(--kbq-tree-size-toggle-padding, 4px);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"] }]
|
|
393
|
+
}] });
|
|
394
|
+
class KbqTreeNodeToggleDirective extends KbqTreeNodeToggleBaseDirective {
|
|
395
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeToggleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
396
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeNodeToggleDirective, selector: "[kbq-tree-node-toggle], [mcTreeNodeToggle]", host: { listeners: { "click": "toggle($event)" }, properties: { "attr.disabled": "disabled || null" } }, exportAs: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0 }); }
|
|
397
|
+
}
|
|
398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodeToggleDirective, decorators: [{
|
|
399
|
+
type: Directive,
|
|
400
|
+
args: [{
|
|
401
|
+
selector: '[kbq-tree-node-toggle], [mcTreeNodeToggle]',
|
|
402
|
+
exportAs: 'mcTreeNodeToggle',
|
|
403
|
+
host: {
|
|
404
|
+
'[attr.disabled]': 'disabled || null',
|
|
405
|
+
'(click)': 'toggle($event)'
|
|
406
|
+
}
|
|
407
|
+
}]
|
|
408
|
+
}] });
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Injection token used to provide the parent component to options.
|
|
412
|
+
*/
|
|
413
|
+
const KBQ_TREE_OPTION_PARENT_COMPONENT = new InjectionToken('KBQ_TREE_OPTION_PARENT_COMPONENT');
|
|
414
|
+
class KbqTreeOptionChange {
|
|
415
|
+
constructor(source, isUserInput = false) {
|
|
416
|
+
this.source = source;
|
|
417
|
+
this.isUserInput = isUserInput;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
let uniqueIdCounter = 0;
|
|
421
|
+
class KbqTreeOption extends KbqTreeNode {
|
|
422
|
+
get externalPseudoCheckbox() {
|
|
423
|
+
return !!this.pseudoCheckbox;
|
|
424
|
+
}
|
|
425
|
+
get value() {
|
|
426
|
+
return this._value;
|
|
427
|
+
}
|
|
428
|
+
set value(value) {
|
|
429
|
+
this._value = value;
|
|
430
|
+
}
|
|
431
|
+
get disabled() {
|
|
432
|
+
return this._disabled || this.tree.disabled || this.tree.treeControl.isDisabled(this.data);
|
|
433
|
+
}
|
|
434
|
+
set disabled(value) {
|
|
435
|
+
const newValue = coerceBooleanProperty(value);
|
|
436
|
+
if (newValue !== this._disabled) {
|
|
437
|
+
this._disabled = newValue;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
get showCheckbox() {
|
|
441
|
+
return this._showCheckbox !== undefined ? this._showCheckbox : this.tree.showCheckbox;
|
|
442
|
+
}
|
|
443
|
+
set showCheckbox(value) {
|
|
444
|
+
this._showCheckbox = coerceBooleanProperty(value);
|
|
445
|
+
}
|
|
446
|
+
get selected() {
|
|
447
|
+
return this._selected;
|
|
448
|
+
}
|
|
449
|
+
set selected(value) {
|
|
450
|
+
const isSelected = coerceBooleanProperty(value);
|
|
451
|
+
if (isSelected !== this._selected) {
|
|
452
|
+
this.setSelected(isSelected);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
get id() {
|
|
456
|
+
return this._id;
|
|
457
|
+
}
|
|
458
|
+
get viewValue() {
|
|
459
|
+
// TODO: Add input property alternative for node envs.
|
|
460
|
+
return (this.getHostElement().textContent || '').trim();
|
|
461
|
+
}
|
|
462
|
+
get isExpandable() {
|
|
463
|
+
return !this.toggleElement?.disabled && this.tree.treeControl.isExpandable(this.data);
|
|
464
|
+
}
|
|
465
|
+
get toggleElement() {
|
|
466
|
+
return this.toggleElementComponent || this.toggleElementDirective;
|
|
467
|
+
}
|
|
468
|
+
get isToggleInDefaultPlace() {
|
|
469
|
+
return this.toggleWrapper.nativeElement.childNodes.length > 0;
|
|
470
|
+
}
|
|
471
|
+
constructor(elementRef, changeDetectorRef, ngZone, tree) {
|
|
472
|
+
super(elementRef, tree);
|
|
473
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
474
|
+
this.ngZone = ngZone;
|
|
475
|
+
this.tree = tree;
|
|
476
|
+
this.onFocus = new Subject();
|
|
477
|
+
this.onBlur = new Subject();
|
|
478
|
+
this.preventBlur = false;
|
|
479
|
+
this.checkboxThirdState = false;
|
|
480
|
+
this._disabled = false;
|
|
481
|
+
this.onSelectionChange = new EventEmitter();
|
|
482
|
+
this._selected = false;
|
|
483
|
+
this._id = `kbq-tree-option-${uniqueIdCounter++}`;
|
|
484
|
+
this.hasFocus = false;
|
|
485
|
+
this.updateCheckboxState = () => {
|
|
486
|
+
if (this.checkboxThirdState && this.isExpandable) {
|
|
487
|
+
if (this.descendantsAllSelected()) {
|
|
488
|
+
this.checkboxState = 'checked';
|
|
489
|
+
}
|
|
490
|
+
else if (this.descendantsPartiallySelected()) {
|
|
491
|
+
this.checkboxState = 'indeterminate';
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
this.checkboxState = this.selected ? 'checked' : 'unchecked';
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
this.checkboxState = this.selected ? 'checked' : 'unchecked';
|
|
499
|
+
}
|
|
500
|
+
this.updateParentsCheckboxState(this.data);
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
ngAfterContentInit() {
|
|
504
|
+
Promise.resolve()
|
|
505
|
+
.then(this.updateCheckboxState);
|
|
506
|
+
this.value = this.tree.treeControl.getValue(this.data);
|
|
507
|
+
}
|
|
508
|
+
descendantsAllSelected() {
|
|
509
|
+
const descendants = this.tree.treeControl.getDescendants(this.data);
|
|
510
|
+
return descendants.every((child) => this.tree?.selectionModel.isSelected(child));
|
|
511
|
+
}
|
|
512
|
+
descendantsPartiallySelected() {
|
|
513
|
+
const descendants = this.tree.treeControl.getDescendants(this.data);
|
|
514
|
+
return descendants.some((child) => this.tree?.selectionModel.isSelected(child));
|
|
515
|
+
}
|
|
516
|
+
updateParentsCheckboxState(node) {
|
|
517
|
+
this.tree.treeControl
|
|
518
|
+
.getParents(node, [])
|
|
519
|
+
.forEach((parent) => {
|
|
520
|
+
const parentOption = this.tree.unorderedOptions
|
|
521
|
+
.find((option) => option.data === parent);
|
|
522
|
+
parentOption?.updateCheckboxState();
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
toggle() {
|
|
526
|
+
this.selected = !this.selected;
|
|
527
|
+
}
|
|
528
|
+
setSelected(selected) {
|
|
529
|
+
if (this._selected === selected || !this.tree.selectionModel) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
this._selected = selected;
|
|
533
|
+
if (selected) {
|
|
534
|
+
this.tree.selectionModel.select(this.data);
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
this.tree.selectionModel.deselect(this.data);
|
|
538
|
+
}
|
|
539
|
+
this.markForCheck();
|
|
540
|
+
}
|
|
541
|
+
focus(focusOrigin) {
|
|
542
|
+
if (focusOrigin === 'program') {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
if (this.disabled || this.actionButton?.hasFocus) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
this.elementRef.nativeElement.focus();
|
|
549
|
+
if (!this.hasFocus) {
|
|
550
|
+
this.onFocus.next({ option: this });
|
|
551
|
+
Promise.resolve().then(() => {
|
|
552
|
+
this.hasFocus = true;
|
|
553
|
+
this.markForCheck();
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
blur() {
|
|
558
|
+
if (this.preventBlur) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
// When animations are enabled, Angular may end up removing the option from the DOM a little
|
|
562
|
+
// earlier than usual, causing it to be blurred and throwing off the logic in the tree
|
|
563
|
+
// that moves focus not the next item. To work around the issue, we defer marking the option
|
|
564
|
+
// as not focused until the next time the zone stabilizes.
|
|
565
|
+
this.ngZone.onStable
|
|
566
|
+
.asObservable()
|
|
567
|
+
.pipe(take(1))
|
|
568
|
+
.subscribe(() => {
|
|
569
|
+
this.ngZone.run(() => {
|
|
570
|
+
if (this.actionButton?.hasFocus || this.tree.optionShouldHoldFocusOnBlur) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
this.hasFocus = false;
|
|
574
|
+
this.onBlur.next({ option: this });
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
getHeight() {
|
|
579
|
+
const clientRects = this.elementRef.nativeElement.getClientRects();
|
|
580
|
+
if (clientRects.length) {
|
|
581
|
+
return clientRects[0].height;
|
|
582
|
+
}
|
|
583
|
+
return 0;
|
|
584
|
+
}
|
|
585
|
+
select(setFocus = true) {
|
|
586
|
+
if (this._selected) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
this._selected = true;
|
|
590
|
+
if (setFocus && !this.hasFocus) {
|
|
591
|
+
this.focus();
|
|
592
|
+
}
|
|
593
|
+
this.updateCheckboxState();
|
|
594
|
+
this.markForCheck();
|
|
595
|
+
this.emitSelectionChangeEvent();
|
|
596
|
+
}
|
|
597
|
+
deselect() {
|
|
598
|
+
if (!this._selected) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
this._selected = false;
|
|
602
|
+
this.updateCheckboxState();
|
|
603
|
+
this.markForCheck();
|
|
604
|
+
}
|
|
605
|
+
onKeydown($event) {
|
|
606
|
+
if (!this.actionButton) {
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
if ($event.keyCode === TAB && !$event.shiftKey && !this.actionButton.hasFocus) {
|
|
610
|
+
this.actionButton.focus();
|
|
611
|
+
$event.preventDefault();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
selectViaInteraction($event) {
|
|
615
|
+
if (this.disabled) {
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
this.markForCheck();
|
|
619
|
+
this.emitSelectionChangeEvent(true);
|
|
620
|
+
const shiftKey = $event ? hasModifierKey($event, 'shiftKey') : false;
|
|
621
|
+
const ctrlKey = $event ? hasModifierKey($event, 'ctrlKey') : false;
|
|
622
|
+
this.tree.setSelectedOptionsByClick(this, shiftKey, ctrlKey);
|
|
623
|
+
}
|
|
624
|
+
emitSelectionChangeEvent(isUserInput = false) {
|
|
625
|
+
this.onSelectionChange.emit(new KbqTreeOptionChange(this, isUserInput));
|
|
626
|
+
}
|
|
627
|
+
getHostElement() {
|
|
628
|
+
return this.elementRef.nativeElement;
|
|
629
|
+
}
|
|
630
|
+
markForCheck() {
|
|
631
|
+
this.changeDetectorRef.markForCheck();
|
|
632
|
+
}
|
|
633
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: KBQ_TREE_OPTION_PARENT_COMPONENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
634
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeOption, selector: "kbq-tree-option", inputs: { checkboxThirdState: "checkboxThirdState", disabled: "disabled", showCheckbox: "showCheckbox" }, outputs: { onSelectionChange: "onSelectionChange" }, host: { listeners: { "focusin": "focus()", "blur": "blur()", "click": "selectViaInteraction($event)", "keydown": "onKeydown($event)" }, properties: { "class.kbq-selected": "selected", "class.kbq-focused": "hasFocus", "class.kbq-action-button-focused": "actionButton?.active", "attr.id": "id", "attr.tabindex": "-1", "attr.disabled": "disabled || null" }, classAttribute: "kbq-tree-option" }, providers: [
|
|
635
|
+
{ provide: KbqTreeNode, useExisting: KbqTreeOption },
|
|
636
|
+
{ provide: KBQ_TITLE_TEXT_REF, useExisting: KbqTreeOption },
|
|
637
|
+
{ provide: KBQ_OPTION_ACTION_PARENT, useExisting: KbqTreeOption }
|
|
638
|
+
], 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: ["mcTitleContainer"], descendants: true }, { propertyName: "toggleWrapper", first: true, predicate: ["toggleWrapper"], descendants: true }], exportAs: ["mcTreeOption"], usesInheritance: true, ngImport: i0, template: "<div class=\"toggle-wrapper\" #toggleWrapper>\n <ng-content select=\"kbq-tree-node-toggle, [kbq-tree-node-toggle], [mcTreeNodeToggle]\"></ng-content>\n</div>\n\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\n <ng-content *ngSwitchCase=\"true\" select=\"kbq-pseudo-checkbox\"></ng-content>\n\n <ng-container *ngSwitchCase=\"false\">\n <kbq-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"checkboxState\"\n [disabled]=\"disabled\">\n </kbq-pseudo-checkbox>\n </ng-container>\n</ng-container>\n\n<ng-content select=\"kbq-checkbox\"></ng-content>\n\n<ng-content select=\"[kbq-icon]\"></ng-content>\n\n<ng-content select=\"kbq-progress-spinner\"></ng-content>\n\n<span class=\"kbq-option-text\" #mcTitleContainer><ng-content></ng-content></span>\n\n<ng-content select=\"kbq-option-action\"></ng-content>\n\n<div class=\"kbq-option-overlay\"></div>\n", styles: [".kbq-tree-option{box-sizing:border-box;display:flex;align-items:center;height:var(--kbq-tree-size-node-height, 32px);word-wrap:break-word;border:2px solid transparent}.kbq-tree-option .kbq-option-text{display:inline-block;flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:var(--kbq-tree-size-padding-right, 16px)}.kbq-tree-option>.kbq-icon,.kbq-tree-option>.toggle-wrapper>.kbq-icon{margin-right:var(--kbq-tree-size-icon-padding, 8px);cursor:pointer}.kbq-tree-option>.kbq-progress-spinner{margin-right:8px}.kbq-tree-option:focus{outline:none}.kbq-tree-option:not([disabled]){cursor:pointer}.kbq-tree-option>.kbq-pseudo-checkbox,.kbq-tree-option>.kbq-checkbox{margin-right:var(--kbq-tree-size-icon-padding, 8px)}.kbq-tree-option .kbq-option-action{display:none}.kbq-tree-option:not([disabled]):hover .kbq-option-action,.kbq-tree-option:not([disabled]).kbq-focused .kbq-option-action,.kbq-tree-option:not([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.KbqPseudoCheckbox, selector: "kbq-pseudo-checkbox", inputs: ["color", "big", "state", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
639
|
+
}
|
|
640
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeOption, decorators: [{
|
|
641
|
+
type: Component,
|
|
642
|
+
args: [{ selector: 'kbq-tree-option', exportAs: 'mcTreeOption', host: {
|
|
643
|
+
class: 'kbq-tree-option',
|
|
644
|
+
'[class.kbq-selected]': 'selected',
|
|
645
|
+
'[class.kbq-focused]': 'hasFocus',
|
|
646
|
+
'[class.kbq-action-button-focused]': 'actionButton?.active',
|
|
647
|
+
'[attr.id]': 'id',
|
|
648
|
+
'[attr.tabindex]': '-1',
|
|
649
|
+
'[attr.disabled]': 'disabled || null',
|
|
650
|
+
'(focusin)': 'focus()',
|
|
651
|
+
'(blur)': 'blur()',
|
|
652
|
+
'(click)': 'selectViaInteraction($event)',
|
|
653
|
+
'(keydown)': 'onKeydown($event)'
|
|
654
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
655
|
+
{ provide: KbqTreeNode, useExisting: KbqTreeOption },
|
|
656
|
+
{ provide: KBQ_TITLE_TEXT_REF, useExisting: KbqTreeOption },
|
|
657
|
+
{ provide: KBQ_OPTION_ACTION_PARENT, useExisting: KbqTreeOption }
|
|
658
|
+
], template: "<div class=\"toggle-wrapper\" #toggleWrapper>\n <ng-content select=\"kbq-tree-node-toggle, [kbq-tree-node-toggle], [mcTreeNodeToggle]\"></ng-content>\n</div>\n\n<ng-container [ngSwitch]=\"externalPseudoCheckbox\">\n <ng-content *ngSwitchCase=\"true\" select=\"kbq-pseudo-checkbox\"></ng-content>\n\n <ng-container *ngSwitchCase=\"false\">\n <kbq-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"checkboxState\"\n [disabled]=\"disabled\">\n </kbq-pseudo-checkbox>\n </ng-container>\n</ng-container>\n\n<ng-content select=\"kbq-checkbox\"></ng-content>\n\n<ng-content select=\"[kbq-icon]\"></ng-content>\n\n<ng-content select=\"kbq-progress-spinner\"></ng-content>\n\n<span class=\"kbq-option-text\" #mcTitleContainer><ng-content></ng-content></span>\n\n<ng-content select=\"kbq-option-action\"></ng-content>\n\n<div class=\"kbq-option-overlay\"></div>\n", styles: [".kbq-tree-option{box-sizing:border-box;display:flex;align-items:center;height:var(--kbq-tree-size-node-height, 32px);word-wrap:break-word;border:2px solid transparent}.kbq-tree-option .kbq-option-text{display:inline-block;flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:var(--kbq-tree-size-padding-right, 16px)}.kbq-tree-option>.kbq-icon,.kbq-tree-option>.toggle-wrapper>.kbq-icon{margin-right:var(--kbq-tree-size-icon-padding, 8px);cursor:pointer}.kbq-tree-option>.kbq-progress-spinner{margin-right:8px}.kbq-tree-option:focus{outline:none}.kbq-tree-option:not([disabled]){cursor:pointer}.kbq-tree-option>.kbq-pseudo-checkbox,.kbq-tree-option>.kbq-checkbox{margin-right:var(--kbq-tree-size-icon-padding, 8px)}.kbq-tree-option .kbq-option-action{display:none}.kbq-tree-option:not([disabled]):hover .kbq-option-action,.kbq-tree-option:not([disabled]).kbq-focused .kbq-option-action,.kbq-tree-option:not([disabled]).kbq-action-button-focused .kbq-option-action{display:flex}\n"] }]
|
|
659
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
660
|
+
type: Inject,
|
|
661
|
+
args: [KBQ_TREE_OPTION_PARENT_COMPONENT]
|
|
662
|
+
}] }]; }, propDecorators: { parentTextElement: [{
|
|
663
|
+
type: ViewChild,
|
|
664
|
+
args: ['mcTitleContainer']
|
|
665
|
+
}], toggleWrapper: [{
|
|
666
|
+
type: ViewChild,
|
|
667
|
+
args: ['toggleWrapper']
|
|
668
|
+
}], toggleElementDirective: [{
|
|
669
|
+
type: ContentChild,
|
|
670
|
+
args: [KbqTreeNodeToggleDirective]
|
|
671
|
+
}], toggleElementComponent: [{
|
|
672
|
+
type: ContentChild,
|
|
673
|
+
args: [KbqTreeNodeToggleComponent]
|
|
674
|
+
}], pseudoCheckbox: [{
|
|
675
|
+
type: ContentChild,
|
|
676
|
+
args: [KbqPseudoCheckbox]
|
|
677
|
+
}], actionButton: [{
|
|
678
|
+
type: ContentChild,
|
|
679
|
+
args: [KbqOptionActionComponent]
|
|
680
|
+
}], tooltipTrigger: [{
|
|
681
|
+
type: ContentChild,
|
|
682
|
+
args: [KbqTooltipTrigger]
|
|
683
|
+
}], dropdownTrigger: [{
|
|
684
|
+
type: ContentChild,
|
|
685
|
+
args: [KbqDropdownTrigger]
|
|
686
|
+
}], checkboxThirdState: [{
|
|
687
|
+
type: Input
|
|
688
|
+
}], disabled: [{
|
|
689
|
+
type: Input
|
|
690
|
+
}], showCheckbox: [{
|
|
691
|
+
type: Input
|
|
692
|
+
}], onSelectionChange: [{
|
|
693
|
+
type: Output
|
|
694
|
+
}] } });
|
|
695
|
+
|
|
696
|
+
/** Regex used to split a string on its CSS units. */
|
|
697
|
+
const cssUnitPattern = /([A-Za-z%]+)$/;
|
|
698
|
+
class KbqTreeNodePadding {
|
|
699
|
+
get level() {
|
|
700
|
+
return this._level;
|
|
701
|
+
}
|
|
702
|
+
set level(value) {
|
|
703
|
+
this.setLevelInput(value);
|
|
704
|
+
}
|
|
705
|
+
get indent() {
|
|
706
|
+
return this._indent;
|
|
707
|
+
}
|
|
708
|
+
set indent(indent) {
|
|
709
|
+
this.setIndentInput(indent);
|
|
710
|
+
}
|
|
711
|
+
get leftPadding() {
|
|
712
|
+
return (this.withIcon ? 0 : this.iconWidth) + this.baseLeftPadding;
|
|
713
|
+
}
|
|
714
|
+
constructor(treeNode, tree, renderer, element, option, dir) {
|
|
715
|
+
this.treeNode = treeNode;
|
|
716
|
+
this.tree = tree;
|
|
717
|
+
this.renderer = renderer;
|
|
718
|
+
this.element = element;
|
|
719
|
+
this.option = option;
|
|
720
|
+
this.dir = dir;
|
|
721
|
+
this._indent = 20;
|
|
722
|
+
/** CSS units used for the indentation value. */
|
|
723
|
+
this.indentUnits = 'px';
|
|
724
|
+
this.baseLeftPadding = parseInt(TreeSizePaddingLeft);
|
|
725
|
+
this.iconWidth = 24;
|
|
726
|
+
this.destroyed = new Subject();
|
|
727
|
+
this.dir?.change?.pipe(takeUntil(this.destroyed))
|
|
728
|
+
.subscribe(() => this.setPadding());
|
|
729
|
+
}
|
|
730
|
+
ngAfterViewInit() {
|
|
731
|
+
this.withIcon = this.option.isToggleInDefaultPlace;
|
|
732
|
+
this.setPadding();
|
|
733
|
+
}
|
|
734
|
+
ngOnDestroy() {
|
|
735
|
+
this.destroyed.next();
|
|
736
|
+
this.destroyed.complete();
|
|
737
|
+
}
|
|
738
|
+
paddingIndent() {
|
|
739
|
+
const nodeLevel = (this.treeNode.data && this.tree.treeControl.getLevel)
|
|
740
|
+
? this.tree.treeControl.getLevel(this.treeNode.data)
|
|
741
|
+
: 0;
|
|
742
|
+
const level = this.level || nodeLevel;
|
|
743
|
+
return level > 0 ? `${(level * this._indent) + this.leftPadding}px` : `${this.leftPadding}px`;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* This has been extracted to a util because of TS 4 and VE.
|
|
747
|
+
* View Engine doesn't support property rename inheritance.
|
|
748
|
+
* TS 4.0 doesn't allow properties to override accessors or vice-versa.
|
|
749
|
+
* @docs-private
|
|
750
|
+
*/
|
|
751
|
+
setLevelInput(value) {
|
|
752
|
+
// Set to null as the fallback value so that _setPadding can fall back to the node level if the
|
|
753
|
+
// consumer set the directive as `mcTreeNodePadding=""`. We still want to take this value if
|
|
754
|
+
// they set 0 explicitly.
|
|
755
|
+
this._level = coerceNumberProperty(value, null);
|
|
756
|
+
this.setPadding();
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* This has been extracted to a util because of TS 4 and VE.
|
|
760
|
+
* View Engine doesn't support property rename inheritance.
|
|
761
|
+
* TS 4.0 doesn't allow properties to override accessors or vice-versa.
|
|
762
|
+
* @docs-private
|
|
763
|
+
*/
|
|
764
|
+
setIndentInput(indent) {
|
|
765
|
+
let value = indent;
|
|
766
|
+
let units = 'px';
|
|
767
|
+
if (typeof indent === 'string') {
|
|
768
|
+
const parts = indent.split(cssUnitPattern);
|
|
769
|
+
value = parts[0];
|
|
770
|
+
units = parts[1] || units;
|
|
771
|
+
}
|
|
772
|
+
this.indentUnits = units;
|
|
773
|
+
this._indent = coerceNumberProperty(value);
|
|
774
|
+
this.setPadding();
|
|
775
|
+
}
|
|
776
|
+
setPadding() {
|
|
777
|
+
const padding = this.paddingIndent();
|
|
778
|
+
const paddingProp = this.dir?.value === 'rtl' ? 'paddingRight' : 'paddingLeft';
|
|
779
|
+
this.renderer.setStyle(this.element.nativeElement, paddingProp, padding);
|
|
780
|
+
}
|
|
781
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", 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 }); }
|
|
782
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeNodePadding, selector: "[mcTreeNodePadding]", inputs: { indent: ["mcTreeNodePaddingIndent", "indent"] }, exportAs: ["mcTreeNodePadding"], ngImport: i0 }); }
|
|
783
|
+
}
|
|
784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeNodePadding, decorators: [{
|
|
785
|
+
type: Directive,
|
|
786
|
+
args: [{
|
|
787
|
+
selector: '[mcTreeNodePadding]',
|
|
788
|
+
exportAs: 'mcTreeNodePadding'
|
|
789
|
+
}]
|
|
790
|
+
}], ctorParameters: function () { return [{ type: KbqTreeNode }, { type: KbqTreeBase }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: KbqTreeOption }, { type: i3.Directionality, decorators: [{
|
|
791
|
+
type: Optional
|
|
792
|
+
}] }]; }, propDecorators: { indent: [{
|
|
793
|
+
type: Input,
|
|
794
|
+
args: ['mcTreeNodePaddingIndent']
|
|
795
|
+
}] } });
|
|
796
|
+
|
|
797
|
+
class KbqTree extends KbqTreeBase {
|
|
798
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTree, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
799
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: KbqTree, selector: "kbq-tree", host: { classAttribute: "kbq-tree" }, exportAs: ["mcTree"], usesInheritance: true, ngImport: i0, template: `<ng-container mcTreeNodeOutlet></ng-container>`, isInline: true, styles: [".kbq-tree{display:block}\n"], dependencies: [{ kind: "directive", type: KbqTreeNodeOutlet, selector: "[mcTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
800
|
+
}
|
|
801
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTree, decorators: [{
|
|
802
|
+
type: Component,
|
|
803
|
+
args: [{ selector: 'kbq-tree', exportAs: 'mcTree', template: `<ng-container mcTreeNodeOutlet></ng-container>`, host: {
|
|
804
|
+
class: 'kbq-tree'
|
|
805
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".kbq-tree{display:block}\n"] }]
|
|
806
|
+
}] });
|
|
807
|
+
|
|
808
|
+
/** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
|
|
809
|
+
/* tslint:disable-next-line:naming-convention */
|
|
810
|
+
class BaseTreeControl {
|
|
811
|
+
constructor() {
|
|
812
|
+
/** A selection model with multi-selection to track expansion status. */
|
|
813
|
+
this.expansionModel = new SelectionModel(true);
|
|
814
|
+
this.filterModel = new SelectionModel(true);
|
|
815
|
+
this.filterValue = new BehaviorSubject('');
|
|
816
|
+
}
|
|
817
|
+
/** Toggles one single data node's expanded/collapsed state. */
|
|
818
|
+
toggle(dataNode) {
|
|
819
|
+
if (this.filterValue.value) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
this.expansionModel.toggle(dataNode);
|
|
823
|
+
}
|
|
824
|
+
/** Expands one single data node. */
|
|
825
|
+
expand(dataNode) {
|
|
826
|
+
if (this.filterValue.value) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
this.expansionModel.select(dataNode);
|
|
830
|
+
}
|
|
831
|
+
/** Collapses one single data node. */
|
|
832
|
+
collapse(dataNode) {
|
|
833
|
+
if (this.filterValue.value) {
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
this.expansionModel.deselect(dataNode);
|
|
837
|
+
}
|
|
838
|
+
/** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
|
|
839
|
+
isExpanded(dataNode) {
|
|
840
|
+
return this.expansionModel.isSelected(dataNode);
|
|
841
|
+
}
|
|
842
|
+
/** Toggles a subtree rooted at `node` recursively. */
|
|
843
|
+
toggleDescendants(dataNode) {
|
|
844
|
+
this.expansionModel.isSelected(dataNode)
|
|
845
|
+
? this.collapseDescendants(dataNode)
|
|
846
|
+
: this.expandDescendants(dataNode);
|
|
847
|
+
}
|
|
848
|
+
/** Collapse all dataNodes in the tree. */
|
|
849
|
+
collapseAll() {
|
|
850
|
+
this.expansionModel.clear();
|
|
851
|
+
}
|
|
852
|
+
/** Expands a subtree rooted at given data node recursively. */
|
|
853
|
+
expandDescendants(dataNode) {
|
|
854
|
+
const toBeProcessed = [dataNode];
|
|
855
|
+
toBeProcessed.push(...this.getDescendants(dataNode));
|
|
856
|
+
this.expansionModel.select(...toBeProcessed);
|
|
857
|
+
}
|
|
858
|
+
/** Collapses a subtree rooted at given data node recursively. */
|
|
859
|
+
collapseDescendants(dataNode) {
|
|
860
|
+
const toBeProcessed = [dataNode];
|
|
861
|
+
toBeProcessed.push(...this.getDescendants(dataNode));
|
|
862
|
+
this.expansionModel.deselect(...toBeProcessed);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
function defaultCompareValues(firstValue, secondValue) {
|
|
867
|
+
return firstValue === secondValue;
|
|
868
|
+
}
|
|
869
|
+
function defaultCompareViewValues(firstViewValue, secondViewValue) {
|
|
870
|
+
return RegExp(escapeRegExp(secondViewValue), 'gi').test(firstViewValue);
|
|
871
|
+
}
|
|
872
|
+
/** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
|
|
873
|
+
class FlatTreeControl extends BaseTreeControl {
|
|
874
|
+
/** Construct with flat tree data node functions getLevel, isExpandable, getValue and getViewValue. */
|
|
875
|
+
constructor(getLevel, isExpandable,
|
|
876
|
+
/** getValue will be used to determine if the tree contains value or not. Used in method hasValue */
|
|
877
|
+
getValue,
|
|
878
|
+
/** getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction */
|
|
879
|
+
getViewValue,
|
|
880
|
+
/** compareValues will be used to comparing values. */
|
|
881
|
+
compareValues = defaultCompareValues,
|
|
882
|
+
/** compareValues will be used to comparing values. */
|
|
883
|
+
compareViewValues = defaultCompareViewValues,
|
|
884
|
+
/** isDisabled will be used to determine if the node is disabled. */
|
|
885
|
+
isDisabled = () => false) {
|
|
886
|
+
super();
|
|
887
|
+
this.getLevel = getLevel;
|
|
888
|
+
this.isExpandable = isExpandable;
|
|
889
|
+
this.getValue = getValue;
|
|
890
|
+
this.getViewValue = getViewValue;
|
|
891
|
+
this.compareValues = compareValues;
|
|
892
|
+
this.compareViewValues = compareViewValues;
|
|
893
|
+
this.isDisabled = isDisabled;
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Gets a list of the data node's subtree of descendent data nodes.
|
|
897
|
+
*
|
|
898
|
+
* To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
|
|
899
|
+
* with correct levels.
|
|
900
|
+
*/
|
|
901
|
+
getDescendants(dataNode) {
|
|
902
|
+
const startIndex = this.dataNodes.indexOf(dataNode);
|
|
903
|
+
const results = [];
|
|
904
|
+
// Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
|
|
905
|
+
// The level of descendants of a tree node must be greater than the level of the given
|
|
906
|
+
// tree node.
|
|
907
|
+
// If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
|
|
908
|
+
// If we reach a node whose level is greater than the level of the tree node, we hit a
|
|
909
|
+
// sibling of an ancestor.
|
|
910
|
+
for (let i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
|
|
911
|
+
results.push(this.dataNodes[i]);
|
|
912
|
+
}
|
|
913
|
+
return results;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Expands all data nodes in the tree.
|
|
917
|
+
*
|
|
918
|
+
* To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
|
|
919
|
+
* data nodes of the tree.
|
|
920
|
+
*/
|
|
921
|
+
expandAll() {
|
|
922
|
+
this.expansionModel.select(...this.dataNodes);
|
|
923
|
+
}
|
|
924
|
+
getParents(node, result) {
|
|
925
|
+
if (node.parent) {
|
|
926
|
+
result.unshift(node.parent);
|
|
927
|
+
return this.getParents(node.parent, result);
|
|
928
|
+
}
|
|
929
|
+
else {
|
|
930
|
+
return result;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
hasValue(value) {
|
|
934
|
+
return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
|
|
935
|
+
}
|
|
936
|
+
filterNodes(value) {
|
|
937
|
+
this.saveExpansionState();
|
|
938
|
+
this.filterModel.clear();
|
|
939
|
+
this.expansionModel.clear();
|
|
940
|
+
const filteredNodes = this.dataNodes
|
|
941
|
+
.filter((node) => this.compareViewValues(this.getViewValue(node), value));
|
|
942
|
+
const filteredNodesWithTheirParents = new Set();
|
|
943
|
+
filteredNodes.forEach((filteredNode) => {
|
|
944
|
+
this.getParents(filteredNode, [])
|
|
945
|
+
.forEach((node) => {
|
|
946
|
+
filteredNodesWithTheirParents.add(node);
|
|
947
|
+
this.expandDataNode(node);
|
|
948
|
+
});
|
|
949
|
+
filteredNodesWithTheirParents.add(filteredNode);
|
|
950
|
+
this.expandDataNode(filteredNode);
|
|
951
|
+
if (this.isExpandable(filteredNode)) {
|
|
952
|
+
const childNodeLevel = this.getLevel(filteredNode) + 1;
|
|
953
|
+
this.getDescendants(filteredNode)
|
|
954
|
+
.filter((childNode) => this.getLevel(childNode) === childNodeLevel)
|
|
955
|
+
.filter((childNode) => !this.isExpandable(childNode) || !this.hasFilteredDescendant(childNode, filteredNodes))
|
|
956
|
+
.forEach((childNode) => {
|
|
957
|
+
filteredNodesWithTheirParents.add(childNode);
|
|
958
|
+
this.expandDataNode(childNode);
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
this.filterModel.select(...Array.from(filteredNodesWithTheirParents));
|
|
963
|
+
this.updateFilterValue(value);
|
|
964
|
+
this.restoreExpansionState();
|
|
965
|
+
}
|
|
966
|
+
updateFilterValue(value) {
|
|
967
|
+
Promise.resolve().then(() => this.filterValue.next(value));
|
|
968
|
+
}
|
|
969
|
+
expandDataNode(dataNode) {
|
|
970
|
+
if (this.isExpandable(dataNode)) {
|
|
971
|
+
this.expansionModel.select(dataNode);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
saveExpansionState() {
|
|
975
|
+
if (this.filterValue.value === '') {
|
|
976
|
+
this.expandedItemsBeforeFiltration = this.expansionModel.selected;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
restoreExpansionState() {
|
|
980
|
+
if (this.filterValue.value === '') {
|
|
981
|
+
this.expansionModel.clear();
|
|
982
|
+
this.expansionModel.select(...this.expandedItemsBeforeFiltration);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
hasFilteredDescendant(dataNode, filteredNodes) {
|
|
986
|
+
const filteredViewValues = filteredNodes
|
|
987
|
+
.map((node) => this.getViewValue(node));
|
|
988
|
+
return this.getDescendants(dataNode)
|
|
989
|
+
.filter((node) => filteredViewValues.includes(this.getViewValue(node)))
|
|
990
|
+
.length > 0;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/* tslint:disable:no-empty */
|
|
995
|
+
const KBQ_SELECTION_TREE_VALUE_ACCESSOR = {
|
|
996
|
+
provide: NG_VALUE_ACCESSOR,
|
|
997
|
+
useExisting: forwardRef(() => KbqTreeSelection),
|
|
998
|
+
multi: true
|
|
999
|
+
};
|
|
1000
|
+
class KbqTreeSelectAllEvent {
|
|
1001
|
+
constructor(source, options) {
|
|
1002
|
+
this.source = source;
|
|
1003
|
+
this.options = options;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
class KbqTreeCopyEvent {
|
|
1007
|
+
constructor(source, option) {
|
|
1008
|
+
this.source = source;
|
|
1009
|
+
this.option = option;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
class KbqTreeNavigationChange {
|
|
1013
|
+
constructor(source, option) {
|
|
1014
|
+
this.source = source;
|
|
1015
|
+
this.option = option;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
class KbqTreeSelectionChange {
|
|
1019
|
+
constructor(source, option) {
|
|
1020
|
+
this.source = source;
|
|
1021
|
+
this.option = option;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
class KbqTreeSelection extends KbqTreeBase {
|
|
1025
|
+
get autoSelect() {
|
|
1026
|
+
return this._autoSelect;
|
|
1027
|
+
}
|
|
1028
|
+
set autoSelect(value) {
|
|
1029
|
+
this._autoSelect = coerceBooleanProperty(value);
|
|
1030
|
+
}
|
|
1031
|
+
get optionFocusChanges() {
|
|
1032
|
+
return merge(...this.renderedOptions.map((option) => option.onFocus));
|
|
1033
|
+
}
|
|
1034
|
+
get optionBlurChanges() {
|
|
1035
|
+
return merge(...this.renderedOptions.map((option) => option.onBlur));
|
|
1036
|
+
}
|
|
1037
|
+
get multiple() {
|
|
1038
|
+
return !!this.multipleMode;
|
|
1039
|
+
}
|
|
1040
|
+
get noUnselectLast() {
|
|
1041
|
+
return this._noUnselectLast;
|
|
1042
|
+
}
|
|
1043
|
+
set noUnselectLast(value) {
|
|
1044
|
+
this._noUnselectLast = coerceBooleanProperty(value);
|
|
1045
|
+
}
|
|
1046
|
+
get disabled() {
|
|
1047
|
+
return this._disabled;
|
|
1048
|
+
}
|
|
1049
|
+
set disabled(rawValue) {
|
|
1050
|
+
const value = coerceBooleanProperty(rawValue);
|
|
1051
|
+
if (this._disabled !== value) {
|
|
1052
|
+
this._disabled = value;
|
|
1053
|
+
this.markOptionsForCheck();
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
get tabIndex() {
|
|
1057
|
+
return this.disabled ? -1 : this._tabIndex;
|
|
1058
|
+
}
|
|
1059
|
+
set tabIndex(value) {
|
|
1060
|
+
this._tabIndex = value;
|
|
1061
|
+
this.userTabIndex = value;
|
|
1062
|
+
}
|
|
1063
|
+
get showCheckbox() {
|
|
1064
|
+
return this.multipleMode === MultipleMode.CHECKBOX;
|
|
1065
|
+
}
|
|
1066
|
+
get isEmpty() {
|
|
1067
|
+
return this.sortedNodes.length === 0;
|
|
1068
|
+
}
|
|
1069
|
+
constructor(elementRef, scheduler, differs, changeDetectorRef, multiple, clipboard) {
|
|
1070
|
+
super(differs, changeDetectorRef);
|
|
1071
|
+
this.elementRef = elementRef;
|
|
1072
|
+
this.scheduler = scheduler;
|
|
1073
|
+
this.clipboard = clipboard;
|
|
1074
|
+
this.renderedOptions = new QueryList();
|
|
1075
|
+
this.resetFocusedItemOnBlur = true;
|
|
1076
|
+
this.multipleMode = null;
|
|
1077
|
+
this.userTabIndex = null;
|
|
1078
|
+
this.optionShouldHoldFocusOnBlur = false;
|
|
1079
|
+
this.navigationChange = new EventEmitter();
|
|
1080
|
+
this.selectionChange = new EventEmitter();
|
|
1081
|
+
this.onSelectAll = new EventEmitter();
|
|
1082
|
+
this.onCopy = new EventEmitter();
|
|
1083
|
+
this.sortedNodes = [];
|
|
1084
|
+
this._autoSelect = true;
|
|
1085
|
+
this._noUnselectLast = true;
|
|
1086
|
+
this._disabled = false;
|
|
1087
|
+
this._tabIndex = 0;
|
|
1088
|
+
this.destroy = new Subject();
|
|
1089
|
+
/** `View -> model callback called when value changes` */
|
|
1090
|
+
this.onChange = () => { };
|
|
1091
|
+
/** `View -> model callback called when select has been touched` */
|
|
1092
|
+
this.onTouched = () => { };
|
|
1093
|
+
this.updateRenderedOptions = () => {
|
|
1094
|
+
const orderedOptions = [];
|
|
1095
|
+
this.sortedNodes.forEach((node) => {
|
|
1096
|
+
const found = this.unorderedOptions.find((option) => option.value === this.treeControl.getValue(node));
|
|
1097
|
+
if (found) {
|
|
1098
|
+
orderedOptions.push(found);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
this.renderedOptions.reset(orderedOptions);
|
|
1102
|
+
this.renderedOptions.notifyOnChanges();
|
|
1103
|
+
this.updateScrollSize();
|
|
1104
|
+
};
|
|
1105
|
+
if (multiple === MultipleMode.CHECKBOX || multiple === MultipleMode.KEYBOARD) {
|
|
1106
|
+
this.multipleMode = multiple;
|
|
1107
|
+
}
|
|
1108
|
+
else if (multiple !== null) {
|
|
1109
|
+
this.multipleMode = MultipleMode.CHECKBOX;
|
|
1110
|
+
}
|
|
1111
|
+
if (this.multipleMode === MultipleMode.CHECKBOX) {
|
|
1112
|
+
this.autoSelect = false;
|
|
1113
|
+
this.noUnselectLast = false;
|
|
1114
|
+
}
|
|
1115
|
+
this.selectionModel = new SelectionModel(this.multiple);
|
|
1116
|
+
}
|
|
1117
|
+
ngAfterContentInit() {
|
|
1118
|
+
this.unorderedOptions.changes
|
|
1119
|
+
.subscribe(this.updateRenderedOptions);
|
|
1120
|
+
this.keyManager = new FocusKeyManager(this.renderedOptions)
|
|
1121
|
+
.withVerticalOrientation(true)
|
|
1122
|
+
.withHorizontalOrientation(null);
|
|
1123
|
+
this.keyManager.change
|
|
1124
|
+
.pipe(takeUntil(this.destroy))
|
|
1125
|
+
.subscribe(() => {
|
|
1126
|
+
if (this.keyManager.activeItem) {
|
|
1127
|
+
this.emitNavigationEvent(this.keyManager.activeItem);
|
|
1128
|
+
// todo need check this logic
|
|
1129
|
+
if (this.autoSelect && !this.keyManager.activeItem.disabled) {
|
|
1130
|
+
this.updateOptionsFocus();
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
});
|
|
1134
|
+
this.keyManager.tabOut
|
|
1135
|
+
.pipe(takeUntil(this.destroy))
|
|
1136
|
+
.subscribe(() => this.allowFocusEscape());
|
|
1137
|
+
this.selectionModel.changed
|
|
1138
|
+
.pipe(takeUntil(this.destroy))
|
|
1139
|
+
.subscribe(() => {
|
|
1140
|
+
this.onChange(this.getSelectedValues());
|
|
1141
|
+
this.renderedOptions.notifyOnChanges();
|
|
1142
|
+
});
|
|
1143
|
+
this.renderedOptions.changes
|
|
1144
|
+
.pipe(takeUntil(this.destroy), delay(0, this.scheduler))
|
|
1145
|
+
.subscribe((options) => {
|
|
1146
|
+
this.resetOptions();
|
|
1147
|
+
// Check to see if we need to update our tab index
|
|
1148
|
+
this.updateTabIndex();
|
|
1149
|
+
const selectedValues = this.multiple ? this.getSelectedValues() : [this.getSelectedValues()];
|
|
1150
|
+
options.forEach((option) => {
|
|
1151
|
+
if (selectedValues.includes(option.value)) {
|
|
1152
|
+
option.select(false);
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
option.deselect();
|
|
1156
|
+
}
|
|
1157
|
+
option.markForCheck();
|
|
1158
|
+
});
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
ngOnDestroy() {
|
|
1162
|
+
super.ngOnDestroy();
|
|
1163
|
+
this.destroy.next();
|
|
1164
|
+
this.destroy.complete();
|
|
1165
|
+
}
|
|
1166
|
+
focus($event) {
|
|
1167
|
+
if (this.renderedOptions.length === 0 || this.isFocusReceivedFromNestedOption($event)) {
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
this.keyManager.setFocusOrigin('keyboard');
|
|
1171
|
+
this.keyManager.setFirstItemActive();
|
|
1172
|
+
this.keyManager.setFocusOrigin('program');
|
|
1173
|
+
}
|
|
1174
|
+
blur() {
|
|
1175
|
+
if (!this.hasFocusedOption() && this.resetFocusedItemOnBlur) {
|
|
1176
|
+
this.keyManager.setActiveItem(-1);
|
|
1177
|
+
}
|
|
1178
|
+
this.onTouched();
|
|
1179
|
+
this.changeDetectorRef.markForCheck();
|
|
1180
|
+
}
|
|
1181
|
+
onKeyDown(event) {
|
|
1182
|
+
this.keyManager.setFocusOrigin('keyboard');
|
|
1183
|
+
// tslint:disable-next-line: deprecation
|
|
1184
|
+
const keyCode = event.keyCode;
|
|
1185
|
+
if ([SPACE, LEFT_ARROW, RIGHT_ARROW].includes(keyCode) || isVerticalMovement(event)) {
|
|
1186
|
+
event.preventDefault();
|
|
1187
|
+
}
|
|
1188
|
+
if (this.multiple && isSelectAll(event)) {
|
|
1189
|
+
this.selectAllOptions();
|
|
1190
|
+
event.preventDefault();
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
else if (isCopy(event)) {
|
|
1194
|
+
this.copyActiveOption();
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
else if (keyCode === TAB) {
|
|
1198
|
+
this.keyManager.tabOut.next();
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
else if (keyCode === LEFT_ARROW && this.keyManager.activeItem?.isExpandable) {
|
|
1202
|
+
this.treeControl.collapse(this.keyManager.activeItem.data);
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
else if (keyCode === RIGHT_ARROW && this.keyManager.activeItem?.isExpandable) {
|
|
1206
|
+
this.treeControl.expand(this.keyManager.activeItem.data);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
else if (keyCode === DOWN_ARROW) {
|
|
1210
|
+
this.keyManager.setNextItemActive();
|
|
1211
|
+
}
|
|
1212
|
+
else if (keyCode === UP_ARROW) {
|
|
1213
|
+
this.keyManager.setPreviousItemActive();
|
|
1214
|
+
}
|
|
1215
|
+
else if ([SPACE, ENTER].includes(keyCode)) {
|
|
1216
|
+
this.toggleFocusedOption();
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
else if (keyCode === HOME) {
|
|
1220
|
+
this.keyManager.setFirstItemActive();
|
|
1221
|
+
}
|
|
1222
|
+
else if (keyCode === END) {
|
|
1223
|
+
this.keyManager.setLastItemActive();
|
|
1224
|
+
}
|
|
1225
|
+
else if (keyCode === PAGE_UP) {
|
|
1226
|
+
this.keyManager.setPreviousPageItemActive();
|
|
1227
|
+
}
|
|
1228
|
+
else if (keyCode === PAGE_DOWN) {
|
|
1229
|
+
this.keyManager.setNextPageItemActive();
|
|
1230
|
+
}
|
|
1231
|
+
if (this.keyManager.activeItem && isVerticalMovement(event)) {
|
|
1232
|
+
this.setSelectedOptionsByKey(this.keyManager.activeItem, hasModifierKey(event, 'shiftKey'), hasModifierKey(event, 'ctrlKey'));
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
updateScrollSize() {
|
|
1236
|
+
if (!this.renderedOptions.first) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
this.keyManager.withScrollSize(Math.floor(this.getHeight() / this.renderedOptions.first.getHeight()));
|
|
1240
|
+
}
|
|
1241
|
+
setSelectedOptionsByKey(option, shiftKey, ctrlKey) {
|
|
1242
|
+
if (shiftKey && this.multiple) {
|
|
1243
|
+
this.selectActiveOptions();
|
|
1244
|
+
this.emitChangeEvent(option);
|
|
1245
|
+
}
|
|
1246
|
+
else if (ctrlKey) {
|
|
1247
|
+
if (!this.canDeselectLast(option)) {
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
else if (this.autoSelect) {
|
|
1252
|
+
this.selectionModel.clear();
|
|
1253
|
+
this.selectionModel.toggle(option.data);
|
|
1254
|
+
this.emitChangeEvent(option);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
setSelectedOptionsByClick(option, shiftKey, ctrlKey) {
|
|
1258
|
+
if (!shiftKey && !ctrlKey) {
|
|
1259
|
+
this.keyManager.setActiveItem(option);
|
|
1260
|
+
}
|
|
1261
|
+
if (shiftKey && this.multiple) {
|
|
1262
|
+
this.selectActiveOptions();
|
|
1263
|
+
}
|
|
1264
|
+
else if (ctrlKey) {
|
|
1265
|
+
if (!this.canDeselectLast(option)) {
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
this.selectionModel.toggle(option.data);
|
|
1269
|
+
this.keyManager.setActiveItem(option);
|
|
1270
|
+
}
|
|
1271
|
+
else if (this.autoSelect) {
|
|
1272
|
+
this.selectionModel.clear();
|
|
1273
|
+
this.selectionModel.toggle(option.data);
|
|
1274
|
+
}
|
|
1275
|
+
else {
|
|
1276
|
+
this.selectionModel.toggle(option.data);
|
|
1277
|
+
}
|
|
1278
|
+
this.emitChangeEvent(option);
|
|
1279
|
+
}
|
|
1280
|
+
selectActiveOptions() {
|
|
1281
|
+
const options = this.renderedOptions.toArray();
|
|
1282
|
+
let fromIndex = this.keyManager.previousActiveItemIndex;
|
|
1283
|
+
let toIndex = this.keyManager.previousActiveItemIndex = this.keyManager.activeItemIndex;
|
|
1284
|
+
const selectedOptionState = options[fromIndex].selected;
|
|
1285
|
+
if (toIndex === fromIndex) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
if (fromIndex > toIndex) {
|
|
1289
|
+
[fromIndex, toIndex] = [toIndex, fromIndex];
|
|
1290
|
+
}
|
|
1291
|
+
options
|
|
1292
|
+
.slice(fromIndex, toIndex + 1)
|
|
1293
|
+
.filter((item) => !item.disabled)
|
|
1294
|
+
.forEach((renderedOption) => {
|
|
1295
|
+
if (!selectedOptionState && this.noUnselectLast && this.selectionModel.selected.length === 1) {
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
renderedOption.setSelected(selectedOptionState);
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
setFocusedOption(option) {
|
|
1302
|
+
this.keyManager.setActiveItem(option);
|
|
1303
|
+
}
|
|
1304
|
+
toggleFocusedOption() {
|
|
1305
|
+
const focusedOption = this.keyManager.activeItem;
|
|
1306
|
+
if (focusedOption && (!focusedOption.selected || this.canDeselectLast(focusedOption))) {
|
|
1307
|
+
this.selectionModel.toggle(focusedOption.data);
|
|
1308
|
+
this.emitChangeEvent(focusedOption);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
renderNodeChanges(data, dataDiffer = this.dataDiffer, viewContainer = this.nodeOutlet.viewContainer, parentData) {
|
|
1312
|
+
super.renderNodeChanges(data, dataDiffer, viewContainer, parentData);
|
|
1313
|
+
this.sortedNodes = this.getSortedNodes(viewContainer);
|
|
1314
|
+
this.nodeOutlet.changeDetectorRef.detectChanges();
|
|
1315
|
+
}
|
|
1316
|
+
emitNavigationEvent(option) {
|
|
1317
|
+
this.navigationChange.emit(new KbqTreeNavigationChange(this, option));
|
|
1318
|
+
}
|
|
1319
|
+
emitChangeEvent(option) {
|
|
1320
|
+
this.selectionChange.emit(new KbqTreeNavigationChange(this, option));
|
|
1321
|
+
}
|
|
1322
|
+
selectAllOptions() {
|
|
1323
|
+
const optionsToSelect = this.renderedOptions
|
|
1324
|
+
.filter((option) => !option.disabled);
|
|
1325
|
+
optionsToSelect
|
|
1326
|
+
.forEach((option) => option.setSelected(true));
|
|
1327
|
+
this.onSelectAll.emit(new KbqTreeSelectAllEvent(this, optionsToSelect));
|
|
1328
|
+
}
|
|
1329
|
+
copyActiveOption() {
|
|
1330
|
+
if (!this.keyManager.activeItem) {
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
const option = this.keyManager.activeItem;
|
|
1334
|
+
option.preventBlur = true;
|
|
1335
|
+
if (this.onCopy.observers.length) {
|
|
1336
|
+
this.onCopy.emit(new KbqTreeCopyEvent(this, this.keyManager.activeItem));
|
|
1337
|
+
}
|
|
1338
|
+
else {
|
|
1339
|
+
this.onCopyDefaultHandler();
|
|
1340
|
+
}
|
|
1341
|
+
option.preventBlur = false;
|
|
1342
|
+
}
|
|
1343
|
+
writeValue(value) {
|
|
1344
|
+
if (this.multiple && value && !Array.isArray(value)) {
|
|
1345
|
+
throw getKbqSelectNonArrayValueError();
|
|
1346
|
+
}
|
|
1347
|
+
if (value) {
|
|
1348
|
+
this.setOptionsFromValues(this.multiple ? value : [value]);
|
|
1349
|
+
}
|
|
1350
|
+
else {
|
|
1351
|
+
this.selectionModel.clear();
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
registerOnChange(fn) {
|
|
1355
|
+
this.onChange = fn;
|
|
1356
|
+
}
|
|
1357
|
+
registerOnTouched(fn) {
|
|
1358
|
+
this.onTouched = fn;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
|
|
1362
|
+
*/
|
|
1363
|
+
setDisabledState(isDisabled) {
|
|
1364
|
+
this._disabled = isDisabled;
|
|
1365
|
+
this.changeDetectorRef.markForCheck();
|
|
1366
|
+
}
|
|
1367
|
+
setOptionsFromValues(values) {
|
|
1368
|
+
this.selectionModel.clear();
|
|
1369
|
+
const valuesToSelect = values.reduce((result, value) => {
|
|
1370
|
+
return this.treeControl.hasValue(value) ? [...result, this.treeControl.hasValue(value)] : [...result];
|
|
1371
|
+
}, []);
|
|
1372
|
+
this.selectionModel.select(...valuesToSelect);
|
|
1373
|
+
}
|
|
1374
|
+
getSelectedValues() {
|
|
1375
|
+
const selectedValues = this.selectionModel.selected.map((selected) => this.treeControl.getValue(selected));
|
|
1376
|
+
return this.multiple ? selectedValues : selectedValues[0];
|
|
1377
|
+
}
|
|
1378
|
+
getItemHeight() {
|
|
1379
|
+
return this.renderedOptions.first ? this.renderedOptions.first.getHeight() : 0;
|
|
1380
|
+
}
|
|
1381
|
+
setStateChildren(option, state) {
|
|
1382
|
+
const valuesToChange = this.treeControl.getDescendants(option.data);
|
|
1383
|
+
if (state) {
|
|
1384
|
+
this.selectionModel.select(...valuesToChange);
|
|
1385
|
+
}
|
|
1386
|
+
else {
|
|
1387
|
+
this.selectionModel.deselect(...valuesToChange);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
onCopyDefaultHandler() {
|
|
1391
|
+
this.clipboard?.copy(this.keyManager.activeItem.value);
|
|
1392
|
+
}
|
|
1393
|
+
getHeight() {
|
|
1394
|
+
const clientRects = this.elementRef.nativeElement.getClientRects();
|
|
1395
|
+
if (clientRects.length) {
|
|
1396
|
+
return clientRects[0].height;
|
|
1397
|
+
}
|
|
1398
|
+
return 0;
|
|
1399
|
+
}
|
|
1400
|
+
updateTabIndex() {
|
|
1401
|
+
this._tabIndex = this.renderedOptions.length === 0 ? -1 : 0;
|
|
1402
|
+
}
|
|
1403
|
+
getSortedNodes(viewContainer) {
|
|
1404
|
+
const array = [];
|
|
1405
|
+
for (let i = 0; i < viewContainer.length; i++) {
|
|
1406
|
+
const viewRef = viewContainer.get(i);
|
|
1407
|
+
array.push(viewRef.context.$implicit);
|
|
1408
|
+
}
|
|
1409
|
+
return array;
|
|
1410
|
+
}
|
|
1411
|
+
allowFocusEscape() {
|
|
1412
|
+
if (this._tabIndex !== -1) {
|
|
1413
|
+
this._tabIndex = -1;
|
|
1414
|
+
setTimeout(() => {
|
|
1415
|
+
this._tabIndex = this.userTabIndex || 0;
|
|
1416
|
+
this.changeDetectorRef.markForCheck();
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
resetOptions() {
|
|
1421
|
+
this.dropSubscriptions();
|
|
1422
|
+
this.listenToOptionsFocus();
|
|
1423
|
+
}
|
|
1424
|
+
dropSubscriptions() {
|
|
1425
|
+
if (this.optionFocusSubscription) {
|
|
1426
|
+
this.optionFocusSubscription.unsubscribe();
|
|
1427
|
+
this.optionFocusSubscription = null;
|
|
1428
|
+
}
|
|
1429
|
+
if (this.optionBlurSubscription) {
|
|
1430
|
+
this.optionBlurSubscription.unsubscribe();
|
|
1431
|
+
this.optionBlurSubscription = null;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
listenToOptionsFocus() {
|
|
1435
|
+
this.optionFocusSubscription = this.optionFocusChanges
|
|
1436
|
+
.subscribe((event) => {
|
|
1437
|
+
const index = this.renderedOptions.toArray().indexOf(event.option);
|
|
1438
|
+
this.renderedOptions
|
|
1439
|
+
.filter((option) => option.hasFocus)
|
|
1440
|
+
.forEach((option) => option.hasFocus = false);
|
|
1441
|
+
if (this.isValidIndex(index)) {
|
|
1442
|
+
this.keyManager.updateActiveItem(index);
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
this.optionBlurSubscription = this.optionBlurChanges
|
|
1446
|
+
.subscribe(() => this.blur());
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Utility to ensure all indexes are valid.
|
|
1450
|
+
* @param index The index to be checked.
|
|
1451
|
+
* @returns True if the index is valid for our list of options.
|
|
1452
|
+
*/
|
|
1453
|
+
isValidIndex(index) {
|
|
1454
|
+
return index >= 0 && index < this.renderedOptions.length;
|
|
1455
|
+
}
|
|
1456
|
+
/** Checks whether any of the options is focused. */
|
|
1457
|
+
hasFocusedOption() {
|
|
1458
|
+
return this.renderedOptions.some((option) => option.hasFocus);
|
|
1459
|
+
}
|
|
1460
|
+
markOptionsForCheck() {
|
|
1461
|
+
this.renderedOptions.forEach((option) => option.markForCheck());
|
|
1462
|
+
}
|
|
1463
|
+
updateOptionsFocus() {
|
|
1464
|
+
this.renderedOptions
|
|
1465
|
+
.filter((option) => option.hasFocus)
|
|
1466
|
+
.forEach((option) => option.hasFocus = false);
|
|
1467
|
+
}
|
|
1468
|
+
canDeselectLast(option) {
|
|
1469
|
+
return !(this.noUnselectLast && this.selectionModel.selected.length === 1 && option.selected);
|
|
1470
|
+
}
|
|
1471
|
+
isFocusReceivedFromNestedOption($event) {
|
|
1472
|
+
if (!$event || !$event.relatedTarget) {
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
return $event.relatedTarget.classList.contains('kbq-tree-option');
|
|
1476
|
+
}
|
|
1477
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeSelection, deps: [{ token: i0.ElementRef }, { token: i1$1.AsyncScheduler }, { token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }, { token: 'multiple', attribute: true }, { token: i2$1.Clipboard, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1478
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeSelection, selector: "kbq-tree-selection", inputs: { treeControl: "treeControl", autoSelect: "autoSelect", noUnselectLast: "noUnselectLast", disabled: "disabled", tabIndex: "tabIndex" }, outputs: { navigationChange: "navigationChange", selectionChange: "selectionChange", onSelectAll: "onSelectAll", onCopy: "onCopy" }, host: { listeners: { "blur": "blur()", "focus": "focus($event)", "keydown": "onKeyDown($event)", "window:resize": "updateScrollSize()" }, properties: { "attr.tabindex": "tabIndex", "attr.disabled": "disabled || null" }, classAttribute: "kbq-tree-selection" }, providers: [
|
|
1479
|
+
KBQ_SELECTION_TREE_VALUE_ACCESSOR,
|
|
1480
|
+
{ provide: KBQ_TREE_OPTION_PARENT_COMPONENT, useExisting: KbqTreeSelection },
|
|
1481
|
+
{ provide: KbqTreeBase, useExisting: KbqTreeSelection }
|
|
1482
|
+
], queries: [{ propertyName: "unorderedOptions", predicate: KbqTreeOption }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: KbqTreeNodeOutlet, descendants: true, static: true }], exportAs: ["mcTreeSelection"], usesInheritance: true, ngImport: i0, template: '<ng-container mcTreeNodeOutlet></ng-container>', isInline: true, styles: [".kbq-tree-selection{display:block}\n"], dependencies: [{ kind: "directive", type: KbqTreeNodeOutlet, selector: "[mcTreeNodeOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1483
|
+
}
|
|
1484
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeSelection, decorators: [{
|
|
1485
|
+
type: Component,
|
|
1486
|
+
args: [{ selector: 'kbq-tree-selection', exportAs: 'mcTreeSelection', template: '<ng-container mcTreeNodeOutlet></ng-container>', host: {
|
|
1487
|
+
class: 'kbq-tree-selection',
|
|
1488
|
+
'[attr.tabindex]': 'tabIndex',
|
|
1489
|
+
'[attr.disabled]': 'disabled || null',
|
|
1490
|
+
'(blur)': 'blur()',
|
|
1491
|
+
'(focus)': 'focus($event)',
|
|
1492
|
+
'(keydown)': 'onKeyDown($event)',
|
|
1493
|
+
'(window:resize)': 'updateScrollSize()'
|
|
1494
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1495
|
+
KBQ_SELECTION_TREE_VALUE_ACCESSOR,
|
|
1496
|
+
{ provide: KBQ_TREE_OPTION_PARENT_COMPONENT, useExisting: KbqTreeSelection },
|
|
1497
|
+
{ provide: KbqTreeBase, useExisting: KbqTreeSelection }
|
|
1498
|
+
], styles: [".kbq-tree-selection{display:block}\n"] }]
|
|
1499
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.AsyncScheduler }, { type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }, { type: i2.MultipleMode, decorators: [{
|
|
1500
|
+
type: Attribute,
|
|
1501
|
+
args: ['multiple']
|
|
1502
|
+
}] }, { type: i2$1.Clipboard, decorators: [{
|
|
1503
|
+
type: Optional
|
|
1504
|
+
}] }]; }, propDecorators: { nodeOutlet: [{
|
|
1505
|
+
type: ViewChild,
|
|
1506
|
+
args: [KbqTreeNodeOutlet, { static: true }]
|
|
1507
|
+
}], unorderedOptions: [{
|
|
1508
|
+
type: ContentChildren,
|
|
1509
|
+
args: [KbqTreeOption]
|
|
1510
|
+
}], treeControl: [{
|
|
1511
|
+
type: Input
|
|
1512
|
+
}], navigationChange: [{
|
|
1513
|
+
type: Output
|
|
1514
|
+
}], selectionChange: [{
|
|
1515
|
+
type: Output
|
|
1516
|
+
}], onSelectAll: [{
|
|
1517
|
+
type: Output
|
|
1518
|
+
}], onCopy: [{
|
|
1519
|
+
type: Output
|
|
1520
|
+
}], autoSelect: [{
|
|
1521
|
+
type: Input
|
|
1522
|
+
}], noUnselectLast: [{
|
|
1523
|
+
type: Input
|
|
1524
|
+
}], disabled: [{
|
|
1525
|
+
type: Input
|
|
1526
|
+
}], tabIndex: [{
|
|
1527
|
+
type: Input
|
|
1528
|
+
}] } });
|
|
1529
|
+
|
|
1530
|
+
const KBQ_TREE_DIRECTIVES = [
|
|
1531
|
+
KbqTreeNodeOutlet,
|
|
1532
|
+
KbqTreeNodeDef,
|
|
1533
|
+
KbqTreeNode,
|
|
1534
|
+
KbqTreeNodePadding,
|
|
1535
|
+
KbqTree,
|
|
1536
|
+
KbqTreeSelection,
|
|
1537
|
+
KbqTreeOption,
|
|
1538
|
+
KbqTreeNodeToggleComponent,
|
|
1539
|
+
KbqTreeNodeToggleDirective
|
|
1540
|
+
];
|
|
1541
|
+
class KbqTreeModule {
|
|
1542
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1543
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeModule, declarations: [KbqTreeNodeOutlet,
|
|
1544
|
+
KbqTreeNodeDef,
|
|
1545
|
+
KbqTreeNode,
|
|
1546
|
+
KbqTreeNodePadding,
|
|
1547
|
+
KbqTree,
|
|
1548
|
+
KbqTreeSelection,
|
|
1549
|
+
KbqTreeOption,
|
|
1550
|
+
KbqTreeNodeToggleComponent,
|
|
1551
|
+
KbqTreeNodeToggleDirective], imports: [CommonModule, KbqPseudoCheckboxModule], exports: [KbqTreeNodeOutlet,
|
|
1552
|
+
KbqTreeNodeDef,
|
|
1553
|
+
KbqTreeNode,
|
|
1554
|
+
KbqTreeNodePadding,
|
|
1555
|
+
KbqTree,
|
|
1556
|
+
KbqTreeSelection,
|
|
1557
|
+
KbqTreeOption,
|
|
1558
|
+
KbqTreeNodeToggleComponent,
|
|
1559
|
+
KbqTreeNodeToggleDirective] }); }
|
|
1560
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeModule, providers: [{ provide: AsyncScheduler, useValue: asyncScheduler }], imports: [CommonModule, KbqPseudoCheckboxModule] }); }
|
|
1561
|
+
}
|
|
1562
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeModule, decorators: [{
|
|
1563
|
+
type: NgModule,
|
|
1564
|
+
args: [{
|
|
1565
|
+
imports: [CommonModule, KbqPseudoCheckboxModule],
|
|
1566
|
+
exports: KBQ_TREE_DIRECTIVES,
|
|
1567
|
+
declarations: KBQ_TREE_DIRECTIVES,
|
|
1568
|
+
providers: [{ provide: AsyncScheduler, useValue: asyncScheduler }]
|
|
1569
|
+
}]
|
|
1570
|
+
}] });
|
|
1571
|
+
|
|
1572
|
+
/** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
|
|
1573
|
+
class NestedTreeControl extends BaseTreeControl {
|
|
1574
|
+
/** Construct with nested tree function getChildren. */
|
|
1575
|
+
constructor(getChildren) {
|
|
1576
|
+
super();
|
|
1577
|
+
this.getChildren = getChildren;
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Expands all dataNodes in the tree.
|
|
1581
|
+
*
|
|
1582
|
+
* To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
|
|
1583
|
+
* data nodes of the tree.
|
|
1584
|
+
*/
|
|
1585
|
+
expandAll() {
|
|
1586
|
+
this.expansionModel.clear();
|
|
1587
|
+
const allNodes = this.dataNodes.reduce((accumulator, dataNode) => [...accumulator, ...this.getDescendants(dataNode), dataNode], []);
|
|
1588
|
+
this.expansionModel.select(...allNodes);
|
|
1589
|
+
}
|
|
1590
|
+
/** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
|
|
1591
|
+
getDescendants(dataNode) {
|
|
1592
|
+
const descendants = [];
|
|
1593
|
+
this._getDescendants(descendants, dataNode);
|
|
1594
|
+
return descendants.splice(1);
|
|
1595
|
+
}
|
|
1596
|
+
/** A helper function to get descendants recursively. */
|
|
1597
|
+
// todo нужно придумать другое название и понять в чем отличие между getDescendants и _getDescendants
|
|
1598
|
+
/* tslint:disable-next-line:naming-convention */
|
|
1599
|
+
_getDescendants(descendants, dataNode) {
|
|
1600
|
+
descendants.push(dataNode);
|
|
1601
|
+
this.getChildren(dataNode)
|
|
1602
|
+
.pipe(take(1))
|
|
1603
|
+
.subscribe((children) => {
|
|
1604
|
+
if (children && children.length > 0) {
|
|
1605
|
+
children.forEach((child) => this._getDescendants(descendants, child));
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Tree flattener to convert a normal type of node to node with children & level information.
|
|
1613
|
+
* Transform nested nodes of type `T` to flattened nodes of type `F`.
|
|
1614
|
+
*
|
|
1615
|
+
* For example, the input data of type `T` is nested, and contains its children data:
|
|
1616
|
+
* SomeNode: {
|
|
1617
|
+
* key: 'Fruits',
|
|
1618
|
+
* children: [
|
|
1619
|
+
* NodeOne: {
|
|
1620
|
+
* key: 'Apple',
|
|
1621
|
+
* },
|
|
1622
|
+
* NodeTwo: {
|
|
1623
|
+
* key: 'Pear',
|
|
1624
|
+
* }
|
|
1625
|
+
* ]
|
|
1626
|
+
* }
|
|
1627
|
+
* After flattener flatten the tree, the structure will become
|
|
1628
|
+
* SomeNode: {
|
|
1629
|
+
* key: 'Fruits',
|
|
1630
|
+
* expandable: true,
|
|
1631
|
+
* level: 1
|
|
1632
|
+
* },
|
|
1633
|
+
* NodeOne: {
|
|
1634
|
+
* key: 'Apple',
|
|
1635
|
+
* expandable: false,
|
|
1636
|
+
* level: 2
|
|
1637
|
+
* },
|
|
1638
|
+
* NodeTwo: {
|
|
1639
|
+
* key: 'Pear',
|
|
1640
|
+
* expandable: false,
|
|
1641
|
+
* level: 2
|
|
1642
|
+
* }
|
|
1643
|
+
* and the output flattened type is `F` with additional information.
|
|
1644
|
+
*/
|
|
1645
|
+
class KbqTreeFlattener {
|
|
1646
|
+
constructor(transformFunction, getLevel, isExpandable, getChildren) {
|
|
1647
|
+
this.transformFunction = transformFunction;
|
|
1648
|
+
this.getLevel = getLevel;
|
|
1649
|
+
this.isExpandable = isExpandable;
|
|
1650
|
+
this.getChildren = getChildren;
|
|
1651
|
+
}
|
|
1652
|
+
flattenNode(node, level, resultNodes, parent) {
|
|
1653
|
+
const flatNode = this.transformFunction(node, level, parent);
|
|
1654
|
+
resultNodes.push(flatNode);
|
|
1655
|
+
if (this.isExpandable(flatNode)) {
|
|
1656
|
+
const childrenNodes = this.getChildren(node);
|
|
1657
|
+
if (childrenNodes) {
|
|
1658
|
+
if (Array.isArray(childrenNodes)) {
|
|
1659
|
+
this.flattenChildren(childrenNodes, level, resultNodes, flatNode);
|
|
1660
|
+
}
|
|
1661
|
+
else {
|
|
1662
|
+
childrenNodes
|
|
1663
|
+
.pipe(take(1))
|
|
1664
|
+
.subscribe((children) => {
|
|
1665
|
+
this.flattenChildren(children, level, resultNodes, flatNode);
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
return resultNodes;
|
|
1671
|
+
}
|
|
1672
|
+
flattenChildren(children, level, resultNodes, parent) {
|
|
1673
|
+
children.forEach((child) => {
|
|
1674
|
+
this.flattenNode(child, level + 1, resultNodes, parent);
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Flatten a list of node type T to flattened version of node F.
|
|
1679
|
+
* Please note that type T may be nested, and the length of `structuredData` may be different
|
|
1680
|
+
* from that of returned list `F[]`.
|
|
1681
|
+
*/
|
|
1682
|
+
flattenNodes(structuredData) {
|
|
1683
|
+
const resultNodes = [];
|
|
1684
|
+
structuredData.forEach((node) => this.flattenNode(node, 0, resultNodes, null));
|
|
1685
|
+
return resultNodes;
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Expand flattened node with current expansion status.
|
|
1689
|
+
* The returned list may have different length.
|
|
1690
|
+
*/
|
|
1691
|
+
expandFlattenedNodes(nodes, treeControl) {
|
|
1692
|
+
const results = [];
|
|
1693
|
+
const currentExpand = [];
|
|
1694
|
+
currentExpand[0] = true;
|
|
1695
|
+
nodes.forEach((node) => {
|
|
1696
|
+
let expand = true;
|
|
1697
|
+
for (let i = 0; i <= this.getLevel(node); i++) {
|
|
1698
|
+
expand = expand && currentExpand[i];
|
|
1699
|
+
}
|
|
1700
|
+
if (expand) {
|
|
1701
|
+
results.push(node);
|
|
1702
|
+
}
|
|
1703
|
+
if (this.isExpandable(node)) {
|
|
1704
|
+
currentExpand[this.getLevel(node) + 1] = treeControl.isExpanded(node);
|
|
1705
|
+
}
|
|
1706
|
+
});
|
|
1707
|
+
return results;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
var KbqTreeDataSourceChangeTypes;
|
|
1711
|
+
(function (KbqTreeDataSourceChangeTypes) {
|
|
1712
|
+
KbqTreeDataSourceChangeTypes["Expansion"] = "expansion";
|
|
1713
|
+
KbqTreeDataSourceChangeTypes["Filter"] = "filter";
|
|
1714
|
+
})(KbqTreeDataSourceChangeTypes || (KbqTreeDataSourceChangeTypes = {}));
|
|
1715
|
+
/**
|
|
1716
|
+
* Data source for flat tree.
|
|
1717
|
+
* The data source need to handle expansion/collapsion of the tree node and change the data feed
|
|
1718
|
+
* to `KbqTree`.
|
|
1719
|
+
* The nested tree nodes of type `T` are flattened through `MсTreeFlattener`, and converted
|
|
1720
|
+
* to type `F` for `KbqTree` to consume.
|
|
1721
|
+
*/
|
|
1722
|
+
class KbqTreeFlatDataSource extends DataSource {
|
|
1723
|
+
get data() {
|
|
1724
|
+
return this._data.value;
|
|
1725
|
+
}
|
|
1726
|
+
set data(value) {
|
|
1727
|
+
this._data.next(value);
|
|
1728
|
+
this.flattenedData.next(this.treeFlattener.flattenNodes(this.data));
|
|
1729
|
+
this.treeControl.dataNodes = this.flattenedData.value;
|
|
1730
|
+
}
|
|
1731
|
+
constructor(treeControl, treeFlattener, initialData = []) {
|
|
1732
|
+
super();
|
|
1733
|
+
this.treeControl = treeControl;
|
|
1734
|
+
this.treeFlattener = treeFlattener;
|
|
1735
|
+
this.flattenedData = new BehaviorSubject([]);
|
|
1736
|
+
this.expandedData = new BehaviorSubject([]);
|
|
1737
|
+
this.filteredData = new BehaviorSubject([]);
|
|
1738
|
+
this._data = new BehaviorSubject(initialData);
|
|
1739
|
+
}
|
|
1740
|
+
connect(collectionViewer) {
|
|
1741
|
+
return merge(collectionViewer.viewChange, this.treeControl.expansionModel.changed
|
|
1742
|
+
.pipe(map((value) => ({ type: KbqTreeDataSourceChangeTypes.Expansion, value }))), this.treeControl.filterValue
|
|
1743
|
+
.pipe(map((value) => ({ type: KbqTreeDataSourceChangeTypes.Filter, value }))), this.flattenedData)
|
|
1744
|
+
.pipe(map((changeObj) => {
|
|
1745
|
+
if (changeObj.type === KbqTreeDataSourceChangeTypes.Filter) {
|
|
1746
|
+
if (changeObj.value && changeObj.value.length > 0) {
|
|
1747
|
+
return this.filterHandler();
|
|
1748
|
+
}
|
|
1749
|
+
else {
|
|
1750
|
+
return this.expansionHandler(changeObj.value);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
return this.expansionHandler(changeObj.value);
|
|
1754
|
+
}));
|
|
1755
|
+
}
|
|
1756
|
+
filterHandler() {
|
|
1757
|
+
this.filteredData.next(this.treeControl.filterModel.selected);
|
|
1758
|
+
return this.filteredData.value;
|
|
1759
|
+
}
|
|
1760
|
+
expansionHandler(_change) {
|
|
1761
|
+
const expandedNodes = this.treeFlattener.expandFlattenedNodes(this.flattenedData.value, this.treeControl);
|
|
1762
|
+
this.expandedData.next(expandedNodes);
|
|
1763
|
+
return this.expandedData.value;
|
|
1764
|
+
}
|
|
1765
|
+
disconnect() {
|
|
1766
|
+
// no op
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* Data source for nested tree.
|
|
1772
|
+
*
|
|
1773
|
+
* The data source for nested tree doesn't have to consider node flattener, or the way to expand
|
|
1774
|
+
* or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
|
|
1775
|
+
*/
|
|
1776
|
+
class KbqTreeNestedDataSource extends DataSource {
|
|
1777
|
+
constructor() {
|
|
1778
|
+
super(...arguments);
|
|
1779
|
+
/* tslint:disable-next-line:naming-convention */
|
|
1780
|
+
this._data = new BehaviorSubject([]);
|
|
1781
|
+
}
|
|
1782
|
+
get data() {
|
|
1783
|
+
return this._data.value;
|
|
1784
|
+
}
|
|
1785
|
+
set data(value) {
|
|
1786
|
+
this._data.next(value);
|
|
1787
|
+
}
|
|
1788
|
+
connect(collectionViewer) {
|
|
1789
|
+
return merge(...[collectionViewer.viewChange, this._data])
|
|
1790
|
+
.pipe(map(() => this.data));
|
|
1791
|
+
}
|
|
1792
|
+
disconnect() {
|
|
1793
|
+
// no op
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* Generated bundle index. Do not edit.
|
|
1799
|
+
*/
|
|
1800
|
+
|
|
1801
|
+
export { BaseTreeControl, FlatTreeControl, KBQ_SELECTION_TREE_VALUE_ACCESSOR, KBQ_TREE_OPTION_PARENT_COMPONENT, KbqTree, KbqTreeBase, KbqTreeCopyEvent, KbqTreeFlatDataSource, KbqTreeFlattener, KbqTreeModule, KbqTreeNavigationChange, KbqTreeNestedDataSource, KbqTreeNode, KbqTreeNodeDef, KbqTreeNodeOutlet, KbqTreeNodeOutletContext, KbqTreeNodePadding, KbqTreeNodeToggleBase, KbqTreeNodeToggleBaseDirective, KbqTreeNodeToggleComponent, KbqTreeNodeToggleDirective, KbqTreeNodeToggleMixinBase, KbqTreeOption, KbqTreeOptionChange, KbqTreeSelectAllEvent, KbqTreeSelection, KbqTreeSelectionChange, NestedTreeControl, defaultCompareValues, defaultCompareViewValues };
|
|
1802
|
+
//# sourceMappingURL=koobiq-components-tree.mjs.map
|