@ptsecurity/mosaic 12.0.2 → 12.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_theming.scss +475 -101
- package/_visual.scss +131 -13
- package/bundles/ptsecurity-mosaic-autocomplete.umd.js +18 -20
- package/bundles/ptsecurity-mosaic-autocomplete.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-button-toggle.umd.js +15 -17
- package/bundles/ptsecurity-mosaic-button-toggle.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-button.umd.js +17 -19
- package/bundles/ptsecurity-mosaic-button.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-card.umd.js +11 -13
- package/bundles/ptsecurity-mosaic-card.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-checkbox.umd.js +14 -16
- package/bundles/ptsecurity-mosaic-checkbox.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-core.umd.js +259 -172
- package/bundles/ptsecurity-mosaic-core.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-datepicker.umd.js +47 -48
- package/bundles/ptsecurity-mosaic-datepicker.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-design-tokens.umd.js +231 -26
- package/bundles/ptsecurity-mosaic-design-tokens.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-divider.umd.js +11 -13
- package/bundles/ptsecurity-mosaic-divider.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-dropdown.umd.js +67 -59
- package/bundles/ptsecurity-mosaic-dropdown.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-form-field.umd.js +737 -738
- package/bundles/ptsecurity-mosaic-form-field.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-icon.umd.js +14 -16
- package/bundles/ptsecurity-mosaic-icon.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-input.umd.js +45 -33
- package/bundles/ptsecurity-mosaic-input.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-link.umd.js +11 -13
- package/bundles/ptsecurity-mosaic-link.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-list.umd.js +177 -89
- package/bundles/ptsecurity-mosaic-list.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-modal.umd.js +52 -44
- package/bundles/ptsecurity-mosaic-modal.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-navbar.umd.js +46 -43
- package/bundles/ptsecurity-mosaic-navbar.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-popover.umd.js +215 -34
- package/bundles/ptsecurity-mosaic-popover.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-progress-bar.umd.js +12 -14
- package/bundles/ptsecurity-mosaic-progress-bar.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-progress-spinner.umd.js +12 -14
- package/bundles/ptsecurity-mosaic-progress-spinner.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-radio.umd.js +14 -16
- package/bundles/ptsecurity-mosaic-radio.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-select.umd.js +22 -24
- package/bundles/ptsecurity-mosaic-select.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-sidebar.umd.js +17 -19
- package/bundles/ptsecurity-mosaic-sidebar.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-sidepanel.umd.js +62 -58
- package/bundles/ptsecurity-mosaic-sidepanel.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-splitter.umd.js +31 -21
- package/bundles/ptsecurity-mosaic-splitter.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-table.umd.js +11 -13
- package/bundles/ptsecurity-mosaic-table.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-tabs.umd.js +150 -74
- package/bundles/ptsecurity-mosaic-tabs.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-tags.umd.js +28 -29
- package/bundles/ptsecurity-mosaic-tags.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-textarea.umd.js +12 -14
- package/bundles/ptsecurity-mosaic-textarea.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-timepicker.umd.js +16 -17
- package/bundles/ptsecurity-mosaic-timepicker.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-toggle.umd.js +11 -13
- package/bundles/ptsecurity-mosaic-toggle.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-tooltip.umd.js +72 -23
- package/bundles/ptsecurity-mosaic-tooltip.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-tree-select.umd.js +24 -29
- package/bundles/ptsecurity-mosaic-tree-select.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic-tree.umd.js +1018 -261
- package/bundles/ptsecurity-mosaic-tree.umd.js.map +1 -1
- package/bundles/ptsecurity-mosaic.umd.js +2 -2
- package/core/option/action.d.ts +42 -0
- package/core/option/index.d.ts +1 -0
- package/core/option/option-module.d.ts +4 -3
- package/core/pop-up/pop-up-trigger.d.ts +9 -12
- package/design-tokens/style-dictionary/build.js +6 -0
- package/design-tokens/style-dictionary/configs/index.js +2 -1
- package/design-tokens/tokens/components/badge.json5 +177 -7
- package/design-tokens/tokens/components/list.json5 +0 -4
- package/design-tokens/tokens/components/tree.json5 +3 -3
- package/design-tokens/tokens/properties/globals.json5 +1 -1
- package/design-tokens/tokens/properties/typography.json5 +16 -0
- package/design-tokens/tokens.d.ts +115 -13
- package/dropdown/dropdown-item.component.d.ts +1 -0
- package/dropdown/dropdown-trigger.directive.d.ts +3 -8
- package/dropdown/dropdown.component.d.ts +1 -0
- package/esm2015/autocomplete/autocomplete-origin.directive.js +4 -4
- package/esm2015/autocomplete/autocomplete-trigger.directive.js +4 -4
- package/esm2015/autocomplete/autocomplete.component.js +4 -4
- package/esm2015/autocomplete/autocomplete.module.js +5 -5
- package/esm2015/button/button.component.js +10 -10
- package/esm2015/button/button.module.js +5 -5
- package/esm2015/button-toggle/button-toggle.component.js +7 -7
- package/esm2015/button-toggle/button-toggle.module.js +5 -5
- package/esm2015/card/card.component.js +4 -4
- package/esm2015/card/card.module.js +5 -5
- package/esm2015/checkbox/checkbox-module.js +5 -5
- package/esm2015/checkbox/checkbox-required-validator.js +4 -4
- package/esm2015/checkbox/checkbox.js +4 -4
- package/esm2015/core/common-behaviors/common-module.js +5 -5
- package/esm2015/core/error/error-options.js +7 -7
- package/esm2015/core/formatters/date/formatter.js +6 -5
- package/esm2015/core/formatters/index.js +5 -5
- package/esm2015/core/formatters/number/formatter.js +5 -5
- package/esm2015/core/forms/forms-module.js +5 -5
- package/esm2015/core/forms/forms.directive.js +7 -7
- package/esm2015/core/highlight/highlight.pipe.js +4 -4
- package/esm2015/core/highlight/index.js +5 -5
- package/esm2015/core/line/line.js +8 -8
- package/esm2015/core/option/action.js +131 -0
- package/esm2015/core/option/index.js +2 -1
- package/esm2015/core/option/optgroup.js +4 -4
- package/esm2015/core/option/option-module.js +8 -7
- package/esm2015/core/option/option.js +4 -4
- package/esm2015/core/pop-up/pop-up-trigger.js +32 -64
- package/esm2015/core/pop-up/pop-up.js +4 -4
- package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.js +4 -4
- package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.module.js +5 -5
- package/esm2015/core/services/measure-scrollbar.service.js +4 -4
- package/esm2015/datepicker/calendar-body.component.js +4 -4
- package/esm2015/datepicker/calendar.component.js +7 -7
- package/esm2015/datepicker/datepicker-input.directive.js +6 -5
- package/esm2015/datepicker/datepicker-intl.js +4 -4
- package/esm2015/datepicker/datepicker-module.js +5 -5
- package/esm2015/datepicker/datepicker-toggle.component.js +7 -7
- package/esm2015/datepicker/datepicker.component.js +7 -7
- package/esm2015/datepicker/month-view.component.js +4 -4
- package/esm2015/datepicker/multi-year-view.component.js +4 -4
- package/esm2015/datepicker/year-view.component.js +4 -4
- package/esm2015/design-tokens/tokens.js +116 -14
- package/esm2015/divider/divider.component.js +4 -4
- package/esm2015/divider/divider.module.js +5 -5
- package/esm2015/dropdown/dropdown-content.directive.js +4 -4
- package/esm2015/dropdown/dropdown-item.component.js +11 -4
- package/esm2015/dropdown/dropdown-trigger.directive.js +39 -39
- package/esm2015/dropdown/dropdown.component.js +9 -5
- package/esm2015/dropdown/dropdown.module.js +5 -5
- package/esm2015/form-field/cleaner.js +9 -5
- package/esm2015/form-field/form-field.js +7 -7
- package/esm2015/form-field/form-field.module.js +5 -5
- package/esm2015/form-field/hint.js +4 -4
- package/esm2015/form-field/prefix.js +4 -4
- package/esm2015/form-field/stepper.js +4 -4
- package/esm2015/form-field/suffix.js +4 -4
- package/esm2015/icon/icon.component.js +7 -7
- package/esm2015/icon/icon.module.js +5 -5
- package/esm2015/input/input-number-validators.js +28 -14
- package/esm2015/input/input-number.js +4 -4
- package/esm2015/input/input.js +7 -7
- package/esm2015/input/input.module.js +5 -5
- package/esm2015/link/link.component.js +4 -4
- package/esm2015/link/link.module.js +5 -5
- package/esm2015/list/list-selection.component.js +155 -66
- package/esm2015/list/list.component.js +7 -7
- package/esm2015/list/list.module.js +5 -5
- package/esm2015/modal/css-unit.pipe.js +4 -4
- package/esm2015/modal/modal-control.service.js +4 -4
- package/esm2015/modal/modal.component.js +6 -4
- package/esm2015/modal/modal.directive.js +13 -13
- package/esm2015/modal/modal.module.js +9 -7
- package/esm2015/modal/modal.service.js +16 -9
- package/esm2015/navbar/navbar-item.component.js +21 -21
- package/esm2015/navbar/navbar.component.js +7 -7
- package/esm2015/navbar/navbar.module.js +5 -5
- package/esm2015/navbar/vertical-navbar.component.js +14 -9
- package/esm2015/popover/popover-confirm.component.js +116 -0
- package/esm2015/popover/popover.component.js +63 -20
- package/esm2015/popover/popover.module.js +13 -10
- package/esm2015/popover/public-api.js +2 -1
- package/esm2015/progress-bar/progress-bar.component.js +4 -4
- package/esm2015/progress-bar/progress-bar.module.js +5 -5
- package/esm2015/progress-spinner/progress-spinner.component.js +4 -4
- package/esm2015/progress-spinner/progress-spinner.module.js +5 -5
- package/esm2015/radio/radio.component.js +7 -7
- package/esm2015/radio/radio.module.js +5 -5
- package/esm2015/select/select.component.js +14 -14
- package/esm2015/select/select.module.js +5 -5
- package/esm2015/sidebar/sidebar.component.js +10 -10
- package/esm2015/sidebar/sidebar.module.js +5 -5
- package/esm2015/sidepanel/sidepanel-container.component.js +14 -13
- package/esm2015/sidepanel/sidepanel-directives.js +22 -18
- package/esm2015/sidepanel/sidepanel.module.js +12 -8
- package/esm2015/sidepanel/sidepanel.service.js +6 -5
- package/esm2015/splitter/splitter.component.js +24 -13
- package/esm2015/splitter/splitter.module.js +5 -5
- package/esm2015/table/table.component.js +4 -4
- package/esm2015/table/table.module.js +5 -5
- package/esm2015/tabs/paginated-tab-header.js +5 -5
- package/esm2015/tabs/tab-body.component.js +7 -7
- package/esm2015/tabs/tab-content.directive.js +4 -4
- package/esm2015/tabs/tab-group.component.js +56 -26
- package/esm2015/tabs/tab-header.component.js +4 -4
- package/esm2015/tabs/tab-label-wrapper.directive.js +21 -6
- package/esm2015/tabs/tab-label.directive.js +4 -4
- package/esm2015/tabs/tab-nav-bar/tab-nav-bar.js +7 -7
- package/esm2015/tabs/tab.component.js +36 -13
- package/esm2015/tabs/tabs.module.js +5 -5
- package/esm2015/tags/tag-input.js +4 -4
- package/esm2015/tags/tag-list.component.js +4 -4
- package/esm2015/tags/tag.component.js +14 -13
- package/esm2015/tags/tag.module.js +5 -5
- package/esm2015/textarea/textarea.component.js +4 -4
- package/esm2015/textarea/textarea.module.js +5 -5
- package/esm2015/timepicker/timepicker.directive.js +9 -8
- package/esm2015/timepicker/timepicker.module.js +5 -5
- package/esm2015/toggle/toggle.component.js +4 -4
- package/esm2015/toggle/toggle.module.js +5 -5
- package/esm2015/tooltip/tooltip.component.js +55 -16
- package/esm2015/tooltip/tooltip.module.js +5 -5
- package/esm2015/tree/control/base-tree-control.js +60 -0
- package/esm2015/tree/control/flat-tree-control.js +123 -0
- package/esm2015/tree/control/nested-tree-control.js +41 -0
- package/esm2015/tree/control/tree-control.js +2 -0
- package/esm2015/tree/data-source/flat-data-source.js +1 -1
- package/esm2015/tree/node.js +31 -0
- package/esm2015/tree/outlet.js +15 -0
- package/esm2015/tree/padding.directive.js +90 -23
- package/esm2015/tree/public-api.js +9 -2
- package/esm2015/tree/toggle.js +46 -52
- package/esm2015/tree/tree-base.js +243 -0
- package/esm2015/tree/tree-errors.js +36 -0
- package/esm2015/tree/tree-option.component.js +75 -32
- package/esm2015/tree/tree-selection.component.js +122 -73
- package/esm2015/tree/tree.js +23 -0
- package/esm2015/tree/tree.module.js +24 -13
- package/esm2015/tree-select/tree-select.component.js +11 -12
- package/esm2015/tree-select/tree-select.module.js +5 -9
- package/fesm2015/ptsecurity-mosaic-autocomplete.js +13 -13
- package/fesm2015/ptsecurity-mosaic-autocomplete.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-button-toggle.js +10 -10
- package/fesm2015/ptsecurity-mosaic-button-toggle.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-button.js +13 -13
- package/fesm2015/ptsecurity-mosaic-button.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-card.js +7 -7
- package/fesm2015/ptsecurity-mosaic-card.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-checkbox.js +10 -10
- package/fesm2015/ptsecurity-mosaic-checkbox.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-core.js +231 -140
- package/fesm2015/ptsecurity-mosaic-core.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-datepicker.js +42 -41
- package/fesm2015/ptsecurity-mosaic-datepicker.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-design-tokens.js +116 -14
- package/fesm2015/ptsecurity-mosaic-design-tokens.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-divider.js +7 -7
- package/fesm2015/ptsecurity-mosaic-divider.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-dropdown.js +63 -52
- package/fesm2015/ptsecurity-mosaic-dropdown.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-form-field.js +30 -27
- package/fesm2015/ptsecurity-mosaic-form-field.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-icon.js +10 -10
- package/fesm2015/ptsecurity-mosaic-icon.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-input.js +40 -26
- package/fesm2015/ptsecurity-mosaic-input.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-link.js +7 -7
- package/fesm2015/ptsecurity-mosaic-link.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-list.js +164 -76
- package/fesm2015/ptsecurity-mosaic-list.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-modal.js +46 -35
- package/fesm2015/ptsecurity-mosaic-modal.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-navbar.js +43 -38
- package/fesm2015/ptsecurity-mosaic-navbar.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-popover.js +179 -30
- package/fesm2015/ptsecurity-mosaic-popover.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-progress-bar.js +7 -7
- package/fesm2015/ptsecurity-mosaic-progress-bar.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-progress-spinner.js +7 -7
- package/fesm2015/ptsecurity-mosaic-progress-spinner.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-radio.js +10 -10
- package/fesm2015/ptsecurity-mosaic-radio.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-select.js +17 -17
- package/fesm2015/ptsecurity-mosaic-select.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-sidebar.js +13 -13
- package/fesm2015/ptsecurity-mosaic-sidebar.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-sidepanel.js +50 -41
- package/fesm2015/ptsecurity-mosaic-sidepanel.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-splitter.js +27 -16
- package/fesm2015/ptsecurity-mosaic-splitter.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-table.js +7 -7
- package/fesm2015/ptsecurity-mosaic-table.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tabs.js +240 -174
- package/fesm2015/ptsecurity-mosaic-tabs.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tags.js +23 -22
- package/fesm2015/ptsecurity-mosaic-tags.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-textarea.js +7 -7
- package/fesm2015/ptsecurity-mosaic-textarea.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-timepicker.js +12 -11
- package/fesm2015/ptsecurity-mosaic-timepicker.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-toggle.js +7 -7
- package/fesm2015/ptsecurity-mosaic-toggle.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tooltip.js +57 -18
- package/fesm2015/ptsecurity-mosaic-tooltip.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tree-select.js +14 -18
- package/fesm2015/ptsecurity-mosaic-tree-select.js.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tree.js +874 -190
- package/fesm2015/ptsecurity-mosaic-tree.js.map +1 -1
- package/form-field/cleaner.d.ts +2 -0
- package/input/input-number-validators.d.ts +2 -2
- package/list/list-selection.component.d.ts +28 -6
- package/modal/modal.component.d.ts +2 -0
- package/modal/modal.module.d.ts +1 -1
- package/package.json +5 -5
- package/popover/popover-confirm.component.d.ts +33 -0
- package/popover/popover.component.d.ts +14 -4
- package/popover/popover.module.d.ts +6 -3
- package/popover/public-api.d.ts +1 -0
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/default-theme.css +1 -1
- package/prebuilt-visual/default-visual.css +1 -1
- package/select/select.component.d.ts +2 -7
- package/sidepanel/sidepanel-directives.d.ts +2 -0
- package/sidepanel/sidepanel.module.d.ts +2 -1
- package/splitter/splitter.component.d.ts +6 -3
- package/tabs/tab-group.component.d.ts +11 -4
- package/tabs/tab-label-wrapper.directive.d.ts +7 -1
- package/tabs/tab.component.d.ts +10 -4
- package/tooltip/tooltip.component.d.ts +12 -3
- package/tree/control/base-tree-control.d.ts +40 -0
- package/tree/control/flat-tree-control.d.ts +48 -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 +2 -1
- package/tree/node.d.ts +34 -0
- package/tree/outlet.d.ts +9 -0
- package/tree/padding.directive.d.ts +35 -7
- package/tree/public-api.d.ts +8 -1
- package/tree/toggle.d.ts +17 -17
- package/tree/tree-base.d.ts +97 -0
- package/tree/tree-errors.d.ts +25 -0
- package/tree/tree-option.component.d.ts +13 -5
- package/tree/tree-selection.component.d.ts +32 -13
- package/tree/tree.d.ts +6 -0
- package/tree/tree.module.d.ts +10 -8
- package/tree-select/tree-select.component.d.ts +2 -7
- package/tree-select/tree-select.module.d.ts +5 -6
- package/esm2015/tree/node.directive.js +0 -19
- package/tree/node.directive.d.ts +0 -7
@@ -1,8 +1,8 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@ptsecurity/cdk/
|
3
|
-
typeof define === 'function' && define.amd ? define('@ptsecurity/mosaic/tree', ['exports', '@angular/common', '@angular/core', '@ptsecurity/cdk/
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ptsecurity = global.ptsecurity || {}, global.ptsecurity.mosaic = global.ptsecurity.mosaic || {}, global.ptsecurity.mosaic.tree = {}), global.ng.common, global.ng.core, global.
|
5
|
-
}(this, (function (exports, i2, i0, i1,
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@ptsecurity/mosaic/core'), require('@angular/cdk/coercion'), require('@ptsecurity/mosaic/design-tokens'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/bidi'), require('@ptsecurity/cdk/keycodes'), require('@ptsecurity/mosaic/dropdown'), require('@ptsecurity/mosaic/tooltip'), require('@angular/cdk/collections'), require('@angular/forms'), require('@ptsecurity/cdk/a11y'), require('@angular/cdk/clipboard')) :
|
3
|
+
typeof define === 'function' && define.amd ? define('@ptsecurity/mosaic/tree', ['exports', '@angular/common', '@angular/core', '@ptsecurity/mosaic/core', '@angular/cdk/coercion', '@ptsecurity/mosaic/design-tokens', 'rxjs', 'rxjs/operators', '@angular/cdk/bidi', '@ptsecurity/cdk/keycodes', '@ptsecurity/mosaic/dropdown', '@ptsecurity/mosaic/tooltip', '@angular/cdk/collections', '@angular/forms', '@ptsecurity/cdk/a11y', '@angular/cdk/clipboard'], factory) :
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ptsecurity = global.ptsecurity || {}, global.ptsecurity.mosaic = global.ptsecurity.mosaic || {}, global.ptsecurity.mosaic.tree = {}), global.ng.common, global.ng.core, global.ptsecurity.mosaic.core, global.ng.cdk.coercion, global.ptsecurity.mosaic["design-tokens"], global.rxjs, global.rxjs.operators, global.ng.cdk.bidi, global.mc.cdk.keycodes, global.ptsecurity.mosaic.dropdown, global.ptsecurity.mosaic.tooltip, global.ng.cdk.collections, global.ng.forms, global.mc.cdk.a11y, global.ng.cdk.clipboard));
|
5
|
+
})(this, (function (exports, i2$1, i0, i1, coercion, designTokens, rxjs, operators, i2, keycodes, dropdown, tooltip, collections, forms, a11y, i1$1) { 'use strict';
|
6
6
|
|
7
7
|
function _interopNamespace(e) {
|
8
8
|
if (e && e.__esModule) return e;
|
@@ -13,22 +13,479 @@
|
|
13
13
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
14
14
|
Object.defineProperty(n, k, d.get ? d : {
|
15
15
|
enumerable: true,
|
16
|
-
get: function () {
|
17
|
-
return e[k];
|
18
|
-
}
|
16
|
+
get: function () { return e[k]; }
|
19
17
|
});
|
20
18
|
}
|
21
19
|
});
|
22
20
|
}
|
23
|
-
n[
|
21
|
+
n["default"] = e;
|
24
22
|
return Object.freeze(n);
|
25
23
|
}
|
26
24
|
|
27
|
-
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
25
|
+
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
|
28
26
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
29
27
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
28
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
30
29
|
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
31
30
|
|
31
|
+
/** Context provided to the tree node component. */
|
32
|
+
var McTreeNodeOutletContext = /** @class */ (function () {
|
33
|
+
function McTreeNodeOutletContext(data) {
|
34
|
+
this.$implicit = data;
|
35
|
+
}
|
36
|
+
return McTreeNodeOutletContext;
|
37
|
+
}());
|
38
|
+
/**
|
39
|
+
* Data node definition for the McTree.
|
40
|
+
* Captures the node's template and a when predicate that describes when this node should be used.
|
41
|
+
*/
|
42
|
+
var McTreeNodeDef = /** @class */ (function () {
|
43
|
+
/** @docs-private */
|
44
|
+
function McTreeNodeDef(template) {
|
45
|
+
this.template = template;
|
46
|
+
}
|
47
|
+
return McTreeNodeDef;
|
48
|
+
}());
|
49
|
+
/** @nocollapse */ McTreeNodeDef.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeDef, deps: [{ token: i0__namespace.TemplateRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
50
|
+
/** @nocollapse */ McTreeNodeDef.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeDef, selector: "[mcTreeNodeDef]", inputs: { when: ["mcTreeNodeDefWhen", "when"], data: ["mcTreeNode", "data"] }, ngImport: i0__namespace });
|
51
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeDef, decorators: [{
|
52
|
+
type: i0.Directive,
|
53
|
+
args: [{
|
54
|
+
selector: '[mcTreeNodeDef]',
|
55
|
+
inputs: ['when: mcTreeNodeDefWhen']
|
56
|
+
}]
|
57
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { data: [{
|
58
|
+
type: i0.Input,
|
59
|
+
args: ['mcTreeNode']
|
60
|
+
}] } });
|
61
|
+
|
62
|
+
var McTreeNodeOutlet = /** @class */ (function () {
|
63
|
+
function McTreeNodeOutlet(viewContainer, changeDetectorRef) {
|
64
|
+
this.viewContainer = viewContainer;
|
65
|
+
this.changeDetectorRef = changeDetectorRef;
|
66
|
+
}
|
67
|
+
return McTreeNodeOutlet;
|
68
|
+
}());
|
69
|
+
/** @nocollapse */ McTreeNodeOutlet.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeOutlet, deps: [{ token: i0__namespace.ViewContainerRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
70
|
+
/** @nocollapse */ McTreeNodeOutlet.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]", ngImport: i0__namespace });
|
71
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeOutlet, decorators: [{
|
72
|
+
type: i0.Directive,
|
73
|
+
args: [{ selector: '[mcTreeNodeOutlet]' }]
|
74
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ViewContainerRef }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Returns an error to be thrown when there is no usable data.
|
78
|
+
* @docs-private
|
79
|
+
*/
|
80
|
+
function getTreeNoValidDataSourceError() {
|
81
|
+
return Error("A valid data source must be provided.");
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* Returns an error to be thrown when there are multiple nodes that are missing a when function.
|
85
|
+
* @docs-private
|
86
|
+
*/
|
87
|
+
function getTreeMultipleDefaultNodeDefsError() {
|
88
|
+
return Error("There can only be one default row without a when predicate function.");
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* Returns an error to be thrown when there are no matching node defs for a particular set of data.
|
92
|
+
* @docs-private
|
93
|
+
*/
|
94
|
+
function getTreeMissingMatchingNodeDefError() {
|
95
|
+
return Error("Could not find a matching node definition for the provided node data.");
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* Returns an error to be thrown when there are tree control.
|
99
|
+
* @docs-private
|
100
|
+
*/
|
101
|
+
function getTreeControlMissingError() {
|
102
|
+
return Error("Could not find a tree control for the tree.");
|
103
|
+
}
|
104
|
+
/**
|
105
|
+
* Returns an error to be thrown when tree control did not implement functions for flat/nested node.
|
106
|
+
* @docs-private
|
107
|
+
*/
|
108
|
+
function getTreeControlFunctionsMissingError() {
|
109
|
+
return Error("Could not find functions for nested/flat tree in tree control.");
|
110
|
+
}
|
111
|
+
|
112
|
+
var McTreeBase = /** @class */ (function () {
|
113
|
+
function McTreeBase(differs, changeDetectorRef) {
|
114
|
+
this.differs = differs;
|
115
|
+
this.changeDetectorRef = changeDetectorRef;
|
116
|
+
// TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange.
|
117
|
+
// Remove the MAX_VALUE in viewChange
|
118
|
+
/**
|
119
|
+
* Stream containing the latest information on what rows are being displayed on screen.
|
120
|
+
* Can be used by the data source to as a heuristic of what data should be provided.
|
121
|
+
*/
|
122
|
+
this.viewChange = new rxjs.BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
|
123
|
+
/** Subject that emits when the component has been destroyed. */
|
124
|
+
this.onDestroy = new rxjs.Subject();
|
125
|
+
/** Level of nodes */
|
126
|
+
this.levels = new Map();
|
127
|
+
}
|
128
|
+
Object.defineProperty(McTreeBase.prototype, "dataSource", {
|
129
|
+
/**
|
130
|
+
* Provides a stream containing the latest data array to render. Influenced by the tree's
|
131
|
+
* stream of view window (what dataNodes are currently on screen).
|
132
|
+
* Data source can be an observable of data array, or a dara array to render.
|
133
|
+
*/
|
134
|
+
get: function () {
|
135
|
+
return this._dataSource;
|
136
|
+
},
|
137
|
+
set: function (dataSource) {
|
138
|
+
if (this._dataSource !== dataSource) {
|
139
|
+
this.switchDataSource(dataSource);
|
140
|
+
}
|
141
|
+
},
|
142
|
+
enumerable: false,
|
143
|
+
configurable: true
|
144
|
+
});
|
145
|
+
McTreeBase.prototype.ngOnInit = function () {
|
146
|
+
this.dataDiffer = this.differs.find([]).create(this.trackBy);
|
147
|
+
if (!this.treeControl) {
|
148
|
+
throw getTreeControlMissingError();
|
149
|
+
}
|
150
|
+
};
|
151
|
+
McTreeBase.prototype.ngOnDestroy = function () {
|
152
|
+
this.nodeOutlet.viewContainer.clear();
|
153
|
+
this.onDestroy.next();
|
154
|
+
this.onDestroy.complete();
|
155
|
+
// tslint:disable-next-line:no-unbound-method
|
156
|
+
if (this._dataSource && typeof this.dataSource.disconnect === 'function') {
|
157
|
+
this.dataSource.disconnect(this);
|
158
|
+
}
|
159
|
+
if (this.dataSubscription) {
|
160
|
+
this.dataSubscription.unsubscribe();
|
161
|
+
this.dataSubscription = null;
|
162
|
+
}
|
163
|
+
};
|
164
|
+
McTreeBase.prototype.ngAfterContentChecked = function () {
|
165
|
+
var defaultNodeDefs = this.nodeDefs.filter(function (def) { return !def.when; });
|
166
|
+
if (defaultNodeDefs.length > 1) {
|
167
|
+
throw getTreeMultipleDefaultNodeDefsError();
|
168
|
+
}
|
169
|
+
this.defaultNodeDef = defaultNodeDefs[0];
|
170
|
+
if (this.dataSource && this.nodeDefs && !this.dataSubscription) {
|
171
|
+
this.observeRenderChanges();
|
172
|
+
}
|
173
|
+
};
|
174
|
+
/** Check for changes made in the data and render each change (node added/removed/moved). */
|
175
|
+
McTreeBase.prototype.renderNodeChanges = function (data, dataDiffer, viewContainer, parentData) {
|
176
|
+
var _this = this;
|
177
|
+
if (dataDiffer === void 0) { dataDiffer = this.dataDiffer; }
|
178
|
+
if (viewContainer === void 0) { viewContainer = this.nodeOutlet.viewContainer; }
|
179
|
+
var changes = dataDiffer.diff(data);
|
180
|
+
if (!changes) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
|
184
|
+
if (item.previousIndex == null) {
|
185
|
+
_this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
|
186
|
+
}
|
187
|
+
else if (currentIndex == null) {
|
188
|
+
viewContainer.remove(adjustedPreviousIndex);
|
189
|
+
_this.levels.delete(item.item);
|
190
|
+
}
|
191
|
+
else {
|
192
|
+
var view = viewContainer.get(adjustedPreviousIndex);
|
193
|
+
viewContainer.move(view, currentIndex);
|
194
|
+
}
|
195
|
+
});
|
196
|
+
this.changeDetectorRef.detectChanges();
|
197
|
+
};
|
198
|
+
/**
|
199
|
+
* Finds the matching node definition that should be used for this node data. If there is only
|
200
|
+
* one node definition, it is returned. Otherwise, find the node definition that has a when
|
201
|
+
* predicate that returns true with the data. If none return true, return the default node
|
202
|
+
* definition.
|
203
|
+
*/
|
204
|
+
McTreeBase.prototype.getNodeDef = function (data, i) {
|
205
|
+
if (this.nodeDefs.length === 1) {
|
206
|
+
return this.nodeDefs.first;
|
207
|
+
}
|
208
|
+
var nodeDef = this.nodeDefs.find(function (def) { return def.when && def.when(i, data); }) || this.defaultNodeDef;
|
209
|
+
if (!nodeDef) {
|
210
|
+
throw getTreeMissingMatchingNodeDefError();
|
211
|
+
}
|
212
|
+
return nodeDef;
|
213
|
+
};
|
214
|
+
/**
|
215
|
+
* Create the embedded view for the data node template and place it in the correct index location
|
216
|
+
* within the data node view container.
|
217
|
+
*/
|
218
|
+
McTreeBase.prototype.insertNode = function (nodeData, index, viewContainer, parentData) {
|
219
|
+
var node = this.getNodeDef(nodeData, index);
|
220
|
+
// Node context that will be provided to created embedded view
|
221
|
+
var context = new McTreeNodeOutletContext(nodeData);
|
222
|
+
// If the tree is flat tree, then use the `getLevel` function in flat tree control
|
223
|
+
// Otherwise, use the level of parent node.
|
224
|
+
if (this.treeControl.getLevel) {
|
225
|
+
context.level = this.treeControl.getLevel(nodeData);
|
226
|
+
/* tslint:disable-next-line:no-typeof-undefined */
|
227
|
+
}
|
228
|
+
else if (typeof parentData !== 'undefined' && this.levels.has(parentData)) {
|
229
|
+
context.level = this.levels.get(parentData) + 1;
|
230
|
+
}
|
231
|
+
else {
|
232
|
+
context.level = 0;
|
233
|
+
}
|
234
|
+
this.levels.set(nodeData, context.level);
|
235
|
+
// Use default tree nodeOutlet, or nested node's nodeOutlet
|
236
|
+
var container = viewContainer ? viewContainer : this.nodeOutlet.viewContainer;
|
237
|
+
container.createEmbeddedView(node.template, context, index);
|
238
|
+
// Set the data to just created `McTreeNode`.
|
239
|
+
// The `McTreeNode` created from `createEmbeddedView` will be saved in static variable
|
240
|
+
// `mostRecentTreeNode`. We get it from static variable and pass the node data to it.
|
241
|
+
if (McTreeNode.mostRecentTreeNode) {
|
242
|
+
McTreeNode.mostRecentTreeNode.data = nodeData;
|
243
|
+
}
|
244
|
+
};
|
245
|
+
/** Set up a subscription for the data provided by the data source. */
|
246
|
+
McTreeBase.prototype.observeRenderChanges = function () {
|
247
|
+
var _this = this;
|
248
|
+
var dataStream;
|
249
|
+
// Cannot use `instanceof DataSource` since the data source could be a literal with
|
250
|
+
// `connect` function and may not extends DataSource.
|
251
|
+
// tslint:disable-next-line:no-unbound-method
|
252
|
+
if (typeof this._dataSource.connect === 'function') {
|
253
|
+
dataStream = this._dataSource.connect(this);
|
254
|
+
}
|
255
|
+
else if (this._dataSource instanceof rxjs.Observable) {
|
256
|
+
dataStream = this._dataSource;
|
257
|
+
}
|
258
|
+
else if (Array.isArray(this._dataSource)) {
|
259
|
+
dataStream = rxjs.of(this._dataSource);
|
260
|
+
}
|
261
|
+
if (dataStream) {
|
262
|
+
this.dataSubscription = dataStream
|
263
|
+
.pipe(operators.takeUntil(this.onDestroy))
|
264
|
+
.subscribe(function (data) { return _this.renderNodeChanges(data); });
|
265
|
+
}
|
266
|
+
else {
|
267
|
+
throw getTreeNoValidDataSourceError();
|
268
|
+
}
|
269
|
+
};
|
270
|
+
/**
|
271
|
+
* Switch to the provided data source by resetting the data and unsubscribing from the current
|
272
|
+
* render change subscription if one exists. If the data source is null, interpret this by
|
273
|
+
* clearing the node outlet. Otherwise start listening for new data.
|
274
|
+
*/
|
275
|
+
McTreeBase.prototype.switchDataSource = function (dataSource) {
|
276
|
+
// tslint:disable-next-line:no-unbound-method
|
277
|
+
if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
|
278
|
+
this.dataSource.disconnect(this);
|
279
|
+
}
|
280
|
+
if (this.dataSubscription) {
|
281
|
+
this.dataSubscription.unsubscribe();
|
282
|
+
this.dataSubscription = null;
|
283
|
+
}
|
284
|
+
// Remove the all dataNodes if there is now no data source
|
285
|
+
if (!dataSource) {
|
286
|
+
this.nodeOutlet.viewContainer.clear();
|
287
|
+
}
|
288
|
+
this._dataSource = dataSource;
|
289
|
+
if (this.nodeDefs) {
|
290
|
+
this.observeRenderChanges();
|
291
|
+
}
|
292
|
+
};
|
293
|
+
return McTreeBase;
|
294
|
+
}());
|
295
|
+
/** @nocollapse */ McTreeBase.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeBase, deps: [{ token: i0__namespace.IterableDiffers }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
296
|
+
/** @nocollapse */ McTreeBase.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeBase, inputs: { treeControl: "treeControl", trackBy: "trackBy", dataSource: "dataSource" }, queries: [{ propertyName: "nodeDefs", predicate: McTreeNodeDef }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: McTreeNodeOutlet, descendants: true, static: true }], ngImport: i0__namespace });
|
297
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeBase, decorators: [{
|
298
|
+
type: i0.Directive
|
299
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.IterableDiffers }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { treeControl: [{
|
300
|
+
type: i0.Input
|
301
|
+
}], trackBy: [{
|
302
|
+
type: i0.Input
|
303
|
+
}], nodeOutlet: [{
|
304
|
+
type: i0.ViewChild,
|
305
|
+
args: [McTreeNodeOutlet, { static: true }]
|
306
|
+
}], nodeDefs: [{
|
307
|
+
type: i0.ContentChildren,
|
308
|
+
args: [McTreeNodeDef]
|
309
|
+
}], dataSource: [{
|
310
|
+
type: i0.Input
|
311
|
+
}] } });
|
312
|
+
var McTreeNode = /** @class */ (function () {
|
313
|
+
function McTreeNode(elementRef, tree) {
|
314
|
+
this.elementRef = elementRef;
|
315
|
+
this.tree = tree;
|
316
|
+
this.destroyed = new rxjs.Subject();
|
317
|
+
McTreeNode.mostRecentTreeNode = this;
|
318
|
+
}
|
319
|
+
Object.defineProperty(McTreeNode.prototype, "data", {
|
320
|
+
get: function () {
|
321
|
+
return this._data;
|
322
|
+
},
|
323
|
+
set: function (value) {
|
324
|
+
this._data = value;
|
325
|
+
},
|
326
|
+
enumerable: false,
|
327
|
+
configurable: true
|
328
|
+
});
|
329
|
+
Object.defineProperty(McTreeNode.prototype, "isExpanded", {
|
330
|
+
get: function () {
|
331
|
+
return this.tree.treeControl.isExpanded(this.data);
|
332
|
+
},
|
333
|
+
enumerable: false,
|
334
|
+
configurable: true
|
335
|
+
});
|
336
|
+
Object.defineProperty(McTreeNode.prototype, "level", {
|
337
|
+
get: function () {
|
338
|
+
return this.tree.treeControl.getLevel ? this.tree.treeControl.getLevel(this._data) : 0;
|
339
|
+
},
|
340
|
+
enumerable: false,
|
341
|
+
configurable: true
|
342
|
+
});
|
343
|
+
McTreeNode.prototype.ngOnDestroy = function () {
|
344
|
+
this.destroyed.next();
|
345
|
+
this.destroyed.complete();
|
346
|
+
};
|
347
|
+
McTreeNode.prototype.focus = function () {
|
348
|
+
this.elementRef.nativeElement.focus();
|
349
|
+
};
|
350
|
+
return McTreeNode;
|
351
|
+
}());
|
352
|
+
/**
|
353
|
+
* The most recently created `McTreeNode`. We save it in static variable so we can retrieve it
|
354
|
+
* in `McTree` and set the data to it.
|
355
|
+
*/
|
356
|
+
McTreeNode.mostRecentTreeNode = null;
|
357
|
+
/** @nocollapse */ McTreeNode.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNode, deps: [{ token: i0__namespace.ElementRef }, { token: i0.forwardRef(function () { return McTreeBase; }) }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
358
|
+
/** @nocollapse */ McTreeNode.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNode, selector: "mc-tree-node", exportAs: ["mcTreeNode"], ngImport: i0__namespace });
|
359
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNode, decorators: [{
|
360
|
+
type: i0.Directive,
|
361
|
+
args: [{
|
362
|
+
selector: 'mc-tree-node',
|
363
|
+
exportAs: 'mcTreeNode'
|
364
|
+
}]
|
365
|
+
}], ctorParameters: function () {
|
366
|
+
return [{ type: i0__namespace.ElementRef }, { type: McTreeBase, decorators: [{
|
367
|
+
type: i0.Inject,
|
368
|
+
args: [i0.forwardRef(function () { return McTreeBase; })]
|
369
|
+
}] }];
|
370
|
+
} });
|
371
|
+
|
372
|
+
/** Regex used to split a string on its CSS units. */
|
373
|
+
var cssUnitPattern = /([A-Za-z%]+)$/;
|
374
|
+
var McTreeNodePadding = /** @class */ (function () {
|
375
|
+
function McTreeNodePadding(treeNode, tree, renderer, element, dir) {
|
376
|
+
var _this = this;
|
377
|
+
var _a, _b;
|
378
|
+
this.treeNode = treeNode;
|
379
|
+
this.tree = tree;
|
380
|
+
this.renderer = renderer;
|
381
|
+
this.element = element;
|
382
|
+
this.dir = dir;
|
383
|
+
this._indent = 20;
|
384
|
+
/** CSS units used for the indentation value. */
|
385
|
+
this.indentUnits = 'px';
|
386
|
+
this.baseLeftPadding = parseInt(designTokens.TreeSizePaddingLeft);
|
387
|
+
this.iconWidth = 24;
|
388
|
+
this.destroyed = new rxjs.Subject();
|
389
|
+
(_b = (_a = this.dir) === null || _a === void 0 ? void 0 : _a.change) === null || _b === void 0 ? void 0 : _b.pipe(operators.takeUntil(this.destroyed)).subscribe(function () { return _this.setPadding(); });
|
390
|
+
}
|
391
|
+
Object.defineProperty(McTreeNodePadding.prototype, "level", {
|
392
|
+
get: function () {
|
393
|
+
return this._level;
|
394
|
+
},
|
395
|
+
set: function (value) {
|
396
|
+
this.setLevelInput(value);
|
397
|
+
},
|
398
|
+
enumerable: false,
|
399
|
+
configurable: true
|
400
|
+
});
|
401
|
+
Object.defineProperty(McTreeNodePadding.prototype, "indent", {
|
402
|
+
get: function () {
|
403
|
+
return this._indent;
|
404
|
+
},
|
405
|
+
set: function (indent) {
|
406
|
+
this.setIndentInput(indent);
|
407
|
+
},
|
408
|
+
enumerable: false,
|
409
|
+
configurable: true
|
410
|
+
});
|
411
|
+
Object.defineProperty(McTreeNodePadding.prototype, "leftPadding", {
|
412
|
+
get: function () {
|
413
|
+
return (this.withIcon ? 0 : this.iconWidth) + this.baseLeftPadding;
|
414
|
+
},
|
415
|
+
enumerable: false,
|
416
|
+
configurable: true
|
417
|
+
});
|
418
|
+
McTreeNodePadding.prototype.ngOnInit = function () {
|
419
|
+
this.withIcon = this.tree.treeControl.isExpandable(this.treeNode.data);
|
420
|
+
this.setPadding();
|
421
|
+
};
|
422
|
+
McTreeNodePadding.prototype.ngOnDestroy = function () {
|
423
|
+
this.destroyed.next();
|
424
|
+
this.destroyed.complete();
|
425
|
+
};
|
426
|
+
McTreeNodePadding.prototype.paddingIndent = function () {
|
427
|
+
var nodeLevel = (this.treeNode.data && this.tree.treeControl.getLevel)
|
428
|
+
? this.tree.treeControl.getLevel(this.treeNode.data)
|
429
|
+
: 0;
|
430
|
+
var level = this.level || nodeLevel;
|
431
|
+
return level > 0 ? (level * this._indent) + this.leftPadding + "px" : this.leftPadding + "px";
|
432
|
+
};
|
433
|
+
/**
|
434
|
+
* This has been extracted to a util because of TS 4 and VE.
|
435
|
+
* View Engine doesn't support property rename inheritance.
|
436
|
+
* TS 4.0 doesn't allow properties to override accessors or vice-versa.
|
437
|
+
* @docs-private
|
438
|
+
*/
|
439
|
+
McTreeNodePadding.prototype.setLevelInput = function (value) {
|
440
|
+
// Set to null as the fallback value so that _setPadding can fall back to the node level if the
|
441
|
+
// consumer set the directive as `mcTreeNodePadding=""`. We still want to take this value if
|
442
|
+
// they set 0 explicitly.
|
443
|
+
this._level = coercion.coerceNumberProperty(value, null);
|
444
|
+
this.setPadding();
|
445
|
+
};
|
446
|
+
/**
|
447
|
+
* This has been extracted to a util because of TS 4 and VE.
|
448
|
+
* View Engine doesn't support property rename inheritance.
|
449
|
+
* TS 4.0 doesn't allow properties to override accessors or vice-versa.
|
450
|
+
* @docs-private
|
451
|
+
*/
|
452
|
+
McTreeNodePadding.prototype.setIndentInput = function (indent) {
|
453
|
+
var value = indent;
|
454
|
+
var units = 'px';
|
455
|
+
if (typeof indent === 'string') {
|
456
|
+
var parts = indent.split(cssUnitPattern);
|
457
|
+
value = parts[0];
|
458
|
+
units = parts[1] || units;
|
459
|
+
}
|
460
|
+
this.indentUnits = units;
|
461
|
+
this._indent = coercion.coerceNumberProperty(value);
|
462
|
+
this.setPadding();
|
463
|
+
};
|
464
|
+
McTreeNodePadding.prototype.setPadding = function () {
|
465
|
+
var _a;
|
466
|
+
var padding = this.paddingIndent();
|
467
|
+
var paddingProp = ((_a = this.dir) === null || _a === void 0 ? void 0 : _a.value) === 'rtl' ? 'paddingRight' : 'paddingLeft';
|
468
|
+
this.renderer.setStyle(this.element.nativeElement, paddingProp, padding);
|
469
|
+
};
|
470
|
+
return McTreeNodePadding;
|
471
|
+
}());
|
472
|
+
/** @nocollapse */ McTreeNodePadding.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodePadding, deps: [{ token: McTreeNode }, { token: McTreeBase }, { token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: i2__namespace.Directionality, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
473
|
+
/** @nocollapse */ McTreeNodePadding.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodePadding, selector: "[mcTreeNodePadding]", inputs: { indent: ["mcTreeNodePaddingIndent", "indent"] }, exportAs: ["mcTreeNodePadding"], ngImport: i0__namespace });
|
474
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodePadding, decorators: [{
|
475
|
+
type: i0.Directive,
|
476
|
+
args: [{
|
477
|
+
selector: '[mcTreeNodePadding]',
|
478
|
+
exportAs: 'mcTreeNodePadding'
|
479
|
+
}]
|
480
|
+
}], ctorParameters: function () {
|
481
|
+
return [{ type: McTreeNode }, { type: McTreeBase }, { type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }, { type: i2__namespace.Directionality, decorators: [{
|
482
|
+
type: i0.Optional
|
483
|
+
}] }];
|
484
|
+
}, propDecorators: { indent: [{
|
485
|
+
type: i0.Input,
|
486
|
+
args: ['mcTreeNodePaddingIndent']
|
487
|
+
}] } });
|
488
|
+
|
32
489
|
/*! *****************************************************************************
|
33
490
|
Copyright (c) Microsoft Corporation.
|
34
491
|
|
@@ -347,184 +804,135 @@
|
|
347
804
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
348
805
|
}
|
349
806
|
|
350
|
-
var
|
351
|
-
|
352
|
-
function McTreeNodeDef() {
|
353
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
354
|
-
}
|
355
|
-
return McTreeNodeDef;
|
356
|
-
}(i1.CdkTreeNodeDef));
|
357
|
-
/** @nocollapse */ McTreeNodeDef.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: McTreeNodeDef, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
|
358
|
-
/** @nocollapse */ McTreeNodeDef.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.5", type: McTreeNodeDef, selector: "[mcTreeNodeDef]", inputs: { when: ["mcTreeNodeDefWhen", "when"], data: ["mcTreeNode", "data"] }, providers: [{ provide: i1.CdkTreeNodeDef, useExisting: McTreeNodeDef }], usesInheritance: true, ngImport: i0__namespace });
|
359
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: McTreeNodeDef, decorators: [{
|
360
|
-
type: i0.Directive,
|
361
|
-
args: [{
|
362
|
-
selector: '[mcTreeNodeDef]',
|
363
|
-
inputs: ['when: mcTreeNodeDefWhen'],
|
364
|
-
providers: [{ provide: i1.CdkTreeNodeDef, useExisting: McTreeNodeDef }]
|
365
|
-
}]
|
366
|
-
}], propDecorators: { data: [{
|
367
|
-
type: i0.Input,
|
368
|
-
args: ['mcTreeNode']
|
369
|
-
}] } });
|
370
|
-
|
371
|
-
var McTreeNodePadding = /** @class */ (function (_super) {
|
372
|
-
__extends(McTreeNodePadding, _super);
|
373
|
-
function McTreeNodePadding() {
|
374
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
375
|
-
_this.baseLeftPadding = 12;
|
376
|
-
_this.iconWidth = 20;
|
377
|
-
return _this;
|
807
|
+
var McTreeNodeToggleBase = /** @class */ (function () {
|
808
|
+
function McTreeNodeToggleBase() {
|
378
809
|
}
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
get: function () {
|
393
|
-
return (this.withIcon ? 0 : this.iconWidth) + this.baseLeftPadding;
|
394
|
-
},
|
395
|
-
enumerable: false,
|
396
|
-
configurable: true
|
397
|
-
});
|
398
|
-
McTreeNodePadding.prototype.paddingIndent = function () {
|
399
|
-
var nodeLevel = (this.treeNode.data && this.tree.treeControl.getLevel)
|
400
|
-
? this.tree.treeControl.getLevel(this.treeNode.data)
|
401
|
-
: 0;
|
402
|
-
var level = this.level || nodeLevel;
|
403
|
-
return level > 0 ? (level * this._indent) + this.leftPadding + "px" : this.leftPadding + "px";
|
404
|
-
};
|
405
|
-
McTreeNodePadding.prototype.ngOnInit = function () {
|
406
|
-
this.withIcon = this.tree.treeControl.isExpandable(this.treeNode.data);
|
407
|
-
this.setPadding();
|
408
|
-
};
|
409
|
-
return McTreeNodePadding;
|
410
|
-
}(i1.CdkTreeNodePadding));
|
411
|
-
/** @nocollapse */ McTreeNodePadding.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: McTreeNodePadding, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
|
412
|
-
/** @nocollapse */ McTreeNodePadding.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.5", type: McTreeNodePadding, selector: "[mcTreeNodePadding]", inputs: { level: ["mcTreeNodePadding", "level"], indent: ["mcTreeNodePaddingIndent", "indent"] }, providers: [{ provide: i1.CdkTreeNodePadding, useExisting: McTreeNodePadding }], usesInheritance: true, ngImport: i0__namespace });
|
413
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: McTreeNodePadding, decorators: [{
|
414
|
-
type: i0.Directive,
|
415
|
-
args: [{
|
416
|
-
selector: '[mcTreeNodePadding]',
|
417
|
-
providers: [{ provide: i1.CdkTreeNodePadding, useExisting: McTreeNodePadding }]
|
418
|
-
}]
|
419
|
-
}], propDecorators: { level: [{
|
420
|
-
type: i0.Input,
|
421
|
-
args: ['mcTreeNodePadding']
|
422
|
-
}], indent: [{
|
423
|
-
type: i0.Input,
|
424
|
-
args: ['mcTreeNodePaddingIndent']
|
425
|
-
}] } });
|
426
|
-
|
427
|
-
var McTreeNodeToggleComponent = /** @class */ (function () {
|
428
|
-
function McTreeNodeToggleComponent(tree, treeNode) {
|
429
|
-
var _this = this;
|
430
|
-
this.tree = tree;
|
431
|
-
this.treeNode = treeNode;
|
432
|
-
this.disabled = false;
|
433
|
-
this._recursive = false;
|
434
|
-
this.tree.treeControl.filterValue
|
810
|
+
return McTreeNodeToggleBase;
|
811
|
+
}());
|
812
|
+
// tslint:disable-next-line:naming-convention
|
813
|
+
var McTreeNodeToggleMixinBase = i1.mixinDisabled(McTreeNodeToggleBase);
|
814
|
+
/** @docs-private */
|
815
|
+
var McTreeNodeToggleBaseDirective = /** @class */ (function (_super) {
|
816
|
+
__extends(McTreeNodeToggleBaseDirective, _super);
|
817
|
+
function McTreeNodeToggleBaseDirective(tree, treeNode) {
|
818
|
+
var _this = _super.call(this) || this;
|
819
|
+
_this.tree = tree;
|
820
|
+
_this.treeNode = treeNode;
|
821
|
+
_this._recursive = false;
|
822
|
+
_this.tree.treeControl.filterValue
|
435
823
|
.pipe(operators.map(function (value) { return (value === null || value === void 0 ? void 0 : value.length) > 0; }))
|
436
824
|
.subscribe(function (state) { return _this.disabled = state; });
|
825
|
+
return _this;
|
437
826
|
}
|
438
|
-
Object.defineProperty(
|
827
|
+
Object.defineProperty(McTreeNodeToggleBaseDirective.prototype, "recursive", {
|
439
828
|
get: function () {
|
440
829
|
return this._recursive;
|
441
830
|
},
|
442
831
|
set: function (value) {
|
443
|
-
this._recursive = value;
|
832
|
+
this._recursive = coercion.coerceBooleanProperty(value);
|
444
833
|
},
|
445
834
|
enumerable: false,
|
446
835
|
configurable: true
|
447
836
|
});
|
448
|
-
Object.defineProperty(
|
837
|
+
Object.defineProperty(McTreeNodeToggleBaseDirective.prototype, "iconState", {
|
449
838
|
get: function () {
|
450
|
-
return this.
|
839
|
+
return this.tree.treeControl.isExpanded(this.node);
|
451
840
|
},
|
452
841
|
enumerable: false,
|
453
842
|
configurable: true
|
454
843
|
});
|
455
|
-
|
844
|
+
McTreeNodeToggleBaseDirective.prototype.toggle = function (event) {
|
845
|
+
if (this.disabled) {
|
846
|
+
return;
|
847
|
+
}
|
456
848
|
this.recursive
|
457
849
|
? this.tree.treeControl.toggleDescendants(this.treeNode.data)
|
458
850
|
: this.tree.treeControl.toggle(this.treeNode.data);
|
459
851
|
event.stopPropagation();
|
460
852
|
};
|
853
|
+
return McTreeNodeToggleBaseDirective;
|
854
|
+
}(McTreeNodeToggleMixinBase));
|
855
|
+
/** @nocollapse */ McTreeNodeToggleBaseDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeToggleBaseDirective, deps: [{ token: McTreeBase }, { token: McTreeNode }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
856
|
+
/** @nocollapse */ McTreeNodeToggleBaseDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeToggleBaseDirective, inputs: { node: "node", recursive: ["mcTreeNodeToggleRecursive", "recursive"] }, usesInheritance: true, ngImport: i0__namespace });
|
857
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeToggleBaseDirective, decorators: [{
|
858
|
+
type: i0.Directive
|
859
|
+
}], ctorParameters: function () { return [{ type: McTreeBase }, { type: McTreeNode }]; }, propDecorators: { node: [{
|
860
|
+
type: i0.Input
|
861
|
+
}], recursive: [{
|
862
|
+
type: i0.Input,
|
863
|
+
args: ['mcTreeNodeToggleRecursive']
|
864
|
+
}] } });
|
865
|
+
var McTreeNodeToggleComponent = /** @class */ (function (_super) {
|
866
|
+
__extends(McTreeNodeToggleComponent, _super);
|
867
|
+
function McTreeNodeToggleComponent() {
|
868
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
869
|
+
}
|
461
870
|
return McTreeNodeToggleComponent;
|
462
|
-
}());
|
463
|
-
/** @nocollapse */ McTreeNodeToggleComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
464
|
-
/** @nocollapse */ McTreeNodeToggleComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
465
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
871
|
+
}(McTreeNodeToggleBaseDirective));
|
872
|
+
/** @nocollapse */ McTreeNodeToggleComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeToggleComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
873
|
+
/** @nocollapse */ McTreeNodeToggleComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeToggleComponent, selector: "mc-tree-node-toggle", inputs: { disabled: "disabled" }, host: { listeners: { "click": "toggle($event)" }, properties: { "class.mc-opened": "iconState", "attr.disabled": "disabled || null" }, classAttribute: "mc-tree-node-toggle" }, exportAs: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0__namespace, template: "<i class=\"mc mc-icon mc-angle-down-S_16\"></i>", isInline: true, styles: [".mc-tree-node-toggle{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:100%;cursor:pointer}.mc-tree-node-toggle .mc-icon{transform:rotate(-90deg)}.mc-tree-node-toggle.mc-opened .mc-icon{transform:rotate(0)}.mc-tree-node-toggle[disabled]{cursor:default}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.None });
|
874
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeToggleComponent, decorators: [{
|
466
875
|
type: i0.Component,
|
467
876
|
args: [{
|
468
877
|
selector: 'mc-tree-node-toggle',
|
469
|
-
|
878
|
+
exportAs: 'mcTreeNodeToggle',
|
879
|
+
template: "<i class=\"mc mc-icon mc-angle-down-S_16\"></i>",
|
880
|
+
styleUrls: ['./toggle.scss'],
|
470
881
|
host: {
|
471
882
|
class: 'mc-tree-node-toggle',
|
472
883
|
'[class.mc-opened]': 'iconState',
|
473
884
|
'[attr.disabled]': 'disabled || null',
|
474
885
|
'(click)': 'toggle($event)'
|
475
886
|
},
|
476
|
-
|
887
|
+
inputs: ['disabled'],
|
888
|
+
encapsulation: i0.ViewEncapsulation.None,
|
889
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
477
890
|
}]
|
478
|
-
}]
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
}] } });
|
484
|
-
var McTreeNodeToggleDirective = /** @class */ (function () {
|
485
|
-
function McTreeNodeToggleDirective(tree, treeNode) {
|
486
|
-
var _this = this;
|
487
|
-
this.tree = tree;
|
488
|
-
this.treeNode = treeNode;
|
489
|
-
this.disabled = false;
|
490
|
-
this._recursive = false;
|
491
|
-
this.tree.treeControl.filterValue
|
492
|
-
.pipe(operators.map(function (value) { return value.length > 0; }))
|
493
|
-
.subscribe(function (state) { return _this.disabled = state; });
|
891
|
+
}] });
|
892
|
+
var McTreeNodeToggleDirective = /** @class */ (function (_super) {
|
893
|
+
__extends(McTreeNodeToggleDirective, _super);
|
894
|
+
function McTreeNodeToggleDirective() {
|
895
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
494
896
|
}
|
495
|
-
Object.defineProperty(McTreeNodeToggleDirective.prototype, "recursive", {
|
496
|
-
get: function () {
|
497
|
-
return this._recursive;
|
498
|
-
},
|
499
|
-
set: function (value) {
|
500
|
-
this._recursive = value;
|
501
|
-
},
|
502
|
-
enumerable: false,
|
503
|
-
configurable: true
|
504
|
-
});
|
505
|
-
McTreeNodeToggleDirective.prototype.toggle = function (event) {
|
506
|
-
this.recursive
|
507
|
-
? this.tree.treeControl.toggleDescendants(this.treeNode.data)
|
508
|
-
: this.tree.treeControl.toggle(this.treeNode.data);
|
509
|
-
event.stopPropagation();
|
510
|
-
};
|
511
897
|
return McTreeNodeToggleDirective;
|
512
|
-
}());
|
513
|
-
/** @nocollapse */ McTreeNodeToggleDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
514
|
-
/** @nocollapse */ McTreeNodeToggleDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.
|
515
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
898
|
+
}(McTreeNodeToggleBaseDirective));
|
899
|
+
/** @nocollapse */ McTreeNodeToggleDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeToggleDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
|
900
|
+
/** @nocollapse */ McTreeNodeToggleDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: McTreeNodeToggleDirective, selector: "[mcTreeNodeToggle]", host: { listeners: { "click": "toggle($event)" }, properties: { "attr.disabled": "disabled || null" } }, exportAs: ["mcTreeNodeToggle"], usesInheritance: true, ngImport: i0__namespace });
|
901
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeNodeToggleDirective, decorators: [{
|
516
902
|
type: i0.Directive,
|
517
903
|
args: [{
|
518
904
|
selector: '[mcTreeNodeToggle]',
|
905
|
+
exportAs: 'mcTreeNodeToggle',
|
519
906
|
host: {
|
520
907
|
'[attr.disabled]': 'disabled || null',
|
521
908
|
'(click)': 'toggle($event)'
|
522
909
|
}
|
523
910
|
}]
|
524
|
-
}]
|
525
|
-
|
526
|
-
|
527
|
-
|
911
|
+
}] });
|
912
|
+
|
913
|
+
var McTree = /** @class */ (function (_super) {
|
914
|
+
__extends(McTree, _super);
|
915
|
+
function McTree() {
|
916
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
917
|
+
}
|
918
|
+
return McTree;
|
919
|
+
}(McTreeBase));
|
920
|
+
/** @nocollapse */ McTree.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTree, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
921
|
+
/** @nocollapse */ McTree.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTree, selector: "mc-tree", host: { classAttribute: "mc-tree" }, exportAs: ["mcTree"], usesInheritance: true, ngImport: i0__namespace, template: "<ng-container mcTreeNodeOutlet></ng-container>", isInline: true, styles: [".mc-tree{display:block}\n"], directives: [{ type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.None });
|
922
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTree, decorators: [{
|
923
|
+
type: i0.Component,
|
924
|
+
args: [{
|
925
|
+
selector: 'mc-tree',
|
926
|
+
exportAs: 'mcTree',
|
927
|
+
template: "<ng-container mcTreeNodeOutlet></ng-container>",
|
928
|
+
styleUrls: ['./tree.scss'],
|
929
|
+
host: {
|
930
|
+
class: 'mc-tree'
|
931
|
+
},
|
932
|
+
encapsulation: i0.ViewEncapsulation.None,
|
933
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
934
|
+
}]
|
935
|
+
}] });
|
528
936
|
|
529
937
|
/**
|
530
938
|
* Injection token used to provide the parent component to options.
|
@@ -567,7 +975,7 @@
|
|
567
975
|
});
|
568
976
|
Object.defineProperty(McTreeOption.prototype, "disabled", {
|
569
977
|
get: function () {
|
570
|
-
return this._disabled ||
|
978
|
+
return this._disabled || this.tree.disabled;
|
571
979
|
},
|
572
980
|
set: function (value) {
|
573
981
|
var newValue = coercion.coerceBooleanProperty(value);
|
@@ -608,17 +1016,18 @@
|
|
608
1016
|
enumerable: false,
|
609
1017
|
configurable: true
|
610
1018
|
});
|
611
|
-
Object.defineProperty(McTreeOption.prototype, "
|
1019
|
+
Object.defineProperty(McTreeOption.prototype, "viewValue", {
|
612
1020
|
get: function () {
|
613
|
-
|
1021
|
+
// TODO: Add input property alternative for node envs.
|
1022
|
+
return (this.getHostElement().textContent || '').trim();
|
614
1023
|
},
|
615
1024
|
enumerable: false,
|
616
1025
|
configurable: true
|
617
1026
|
});
|
618
|
-
Object.defineProperty(McTreeOption.prototype, "
|
1027
|
+
Object.defineProperty(McTreeOption.prototype, "isExpandable", {
|
619
1028
|
get: function () {
|
620
|
-
|
621
|
-
return (this.
|
1029
|
+
var _a;
|
1030
|
+
return !((_a = this.toggleElement) === null || _a === void 0 ? void 0 : _a.disabled) && this.tree.treeControl.isExpandable(this.data);
|
622
1031
|
},
|
623
1032
|
enumerable: false,
|
624
1033
|
configurable: true
|
@@ -644,10 +1053,11 @@
|
|
644
1053
|
};
|
645
1054
|
McTreeOption.prototype.focus = function (focusOrigin) {
|
646
1055
|
var _this = this;
|
1056
|
+
var _a;
|
647
1057
|
if (focusOrigin === 'program') {
|
648
1058
|
return;
|
649
1059
|
}
|
650
|
-
if (this.disabled || this.hasFocus) {
|
1060
|
+
if (this.disabled || this.hasFocus || ((_a = this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus)) {
|
651
1061
|
return;
|
652
1062
|
}
|
653
1063
|
this.elementRef.nativeElement.focus();
|
@@ -668,7 +1078,11 @@
|
|
668
1078
|
.pipe(operators.take(1))
|
669
1079
|
.subscribe(function () {
|
670
1080
|
_this.ngZone.run(function () {
|
1081
|
+
var _a;
|
671
1082
|
_this.hasFocus = false;
|
1083
|
+
if ((_a = _this.actionButton) === null || _a === void 0 ? void 0 : _a.hasFocus) {
|
1084
|
+
return;
|
1085
|
+
}
|
672
1086
|
_this.onBlur.next({ option: _this });
|
673
1087
|
});
|
674
1088
|
});
|
@@ -681,26 +1095,38 @@
|
|
681
1095
|
return 0;
|
682
1096
|
};
|
683
1097
|
McTreeOption.prototype.select = function () {
|
684
|
-
if (
|
685
|
-
|
686
|
-
this.changeDetectorRef.markForCheck();
|
687
|
-
this.emitSelectionChangeEvent();
|
1098
|
+
if (this._selected) {
|
1099
|
+
return;
|
688
1100
|
}
|
1101
|
+
this._selected = true;
|
1102
|
+
this.changeDetectorRef.markForCheck();
|
1103
|
+
this.emitSelectionChangeEvent();
|
689
1104
|
};
|
690
1105
|
McTreeOption.prototype.deselect = function () {
|
691
|
-
if (this._selected) {
|
692
|
-
|
693
|
-
|
1106
|
+
if (!this._selected) {
|
1107
|
+
return;
|
1108
|
+
}
|
1109
|
+
this._selected = false;
|
1110
|
+
this.changeDetectorRef.markForCheck();
|
1111
|
+
};
|
1112
|
+
McTreeOption.prototype.onKeydown = function ($event) {
|
1113
|
+
if (!this.actionButton) {
|
1114
|
+
return;
|
1115
|
+
}
|
1116
|
+
if ($event.keyCode === keycodes.TAB && !$event.shiftKey && !this.actionButton.hasFocus) {
|
1117
|
+
this.actionButton.focus();
|
1118
|
+
$event.preventDefault();
|
694
1119
|
}
|
695
1120
|
};
|
696
1121
|
McTreeOption.prototype.selectViaInteraction = function ($event) {
|
697
|
-
if (
|
698
|
-
|
699
|
-
this.emitSelectionChangeEvent(true);
|
700
|
-
var shiftKey = $event ? keycodes.hasModifierKey($event, 'shiftKey') : false;
|
701
|
-
var ctrlKey = $event ? keycodes.hasModifierKey($event, 'ctrlKey') : false;
|
702
|
-
this.tree.setSelectedOptionsByClick(this, shiftKey, ctrlKey);
|
1122
|
+
if (this.disabled) {
|
1123
|
+
return;
|
703
1124
|
}
|
1125
|
+
this.changeDetectorRef.markForCheck();
|
1126
|
+
this.emitSelectionChangeEvent(true);
|
1127
|
+
var shiftKey = $event ? keycodes.hasModifierKey($event, 'shiftKey') : false;
|
1128
|
+
var ctrlKey = $event ? keycodes.hasModifierKey($event, 'ctrlKey') : false;
|
1129
|
+
this.tree.setSelectedOptionsByClick(this, shiftKey, ctrlKey);
|
704
1130
|
};
|
705
1131
|
McTreeOption.prototype.emitSelectionChangeEvent = function (isUserInput) {
|
706
1132
|
if (isUserInput === void 0) { isUserInput = false; }
|
@@ -713,36 +1139,57 @@
|
|
713
1139
|
this.changeDetectorRef.markForCheck();
|
714
1140
|
};
|
715
1141
|
return McTreeOption;
|
716
|
-
}(
|
717
|
-
/** @nocollapse */ McTreeOption.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
718
|
-
/** @nocollapse */ McTreeOption.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
719
|
-
|
1142
|
+
}(McTreeNode));
|
1143
|
+
/** @nocollapse */ McTreeOption.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeOption, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }, { token: MC_TREE_OPTION_PARENT_COMPONENT }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
1144
|
+
/** @nocollapse */ McTreeOption.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTreeOption, selector: "mc-tree-option", inputs: { disabled: "disabled", showCheckbox: "showCheckbox" }, outputs: { onSelectionChange: "onSelectionChange" }, host: { listeners: { "focusin": "focus()", "blur": "blur()", "click": "selectViaInteraction($event)", "keydown": "onKeydown($event)" }, properties: { "class.mc-selected": "selected", "class.mc-focused": "hasFocus", "class.mc-action-button-focused": "actionButton?.active", "attr.id": "id", "attr.tabindex": "-1", "attr.disabled": "disabled || null" }, classAttribute: "mc-tree-option" }, providers: [
|
1145
|
+
{ provide: McTreeNode, useExisting: McTreeOption },
|
1146
|
+
{ provide: i1.MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
|
1147
|
+
], queries: [{ propertyName: "toggleElement", first: true, predicate: ["mcTreeNodeToggle"], descendants: true }, { propertyName: "actionButton", first: true, predicate: i1.McOptionActionComponent, descendants: true }, { propertyName: "tooltipTrigger", first: true, predicate: tooltip.McTooltipTrigger, descendants: true }, { propertyName: "dropdownTrigger", first: true, predicate: dropdown.McDropdownTrigger, descendants: true }], exportAs: ["mcTreeOption"], usesInheritance: true, ngImport: i0__namespace, template: "<ng-content select=\"mc-tree-node-toggle\"></ng-content>\n\n<mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n</mc-pseudo-checkbox>\n\n<ng-content select=\"mc-checkbox\"></ng-content>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<span class=\"mc-option-text mc-no-select\"><ng-content></ng-content></span>\n\n<ng-content select=\"mc-option-action\"></ng-content>\n\n<div class=\"mc-option-overlay\"></div>\n", styles: [".mc-tree-option{box-sizing:border-box;display:flex;align-items:center;height:32px;height:var(--mc-tree-size-node-height, 32px);word-wrap:break-word;border:2px solid transparent}.mc-tree-option .mc-option-text{display:inline-block;flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:16px;margin-right:var(--mc-tree-size-padding-right, 16px)}.mc-tree-option>.mc-icon{margin-right:8px;cursor:pointer}.mc-tree-option:focus{outline:none}.mc-tree-option:not([disabled]){cursor:pointer}.mc-tree-option>.mc-pseudo-checkbox,.mc-tree-option>.mc-checkbox{margin-right:8px}.mc-tree-option .mc-option-action{display:none}.mc-tree-option:not([disabled]):hover .mc-option-action,.mc-tree-option:not([disabled]).mc-focused .mc-option-action,.mc-tree-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}\n"], components: [{ type: i1__namespace.McPseudoCheckbox, selector: "mc-pseudo-checkbox", inputs: ["state", "disabled"] }], directives: [{ type: i2__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.None });
|
1148
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeOption, decorators: [{
|
720
1149
|
type: i0.Component,
|
721
1150
|
args: [{
|
722
1151
|
selector: 'mc-tree-option',
|
723
1152
|
exportAs: 'mcTreeOption',
|
724
1153
|
templateUrl: './tree-option.html',
|
1154
|
+
styleUrls: ['./tree-option.scss'],
|
725
1155
|
host: {
|
726
|
-
'[attr.id]': 'id',
|
727
|
-
'[attr.tabindex]': '-1',
|
728
|
-
'[attr.disabled]': 'disabled || null',
|
729
1156
|
class: 'mc-tree-option',
|
730
1157
|
'[class.mc-selected]': 'selected',
|
731
1158
|
'[class.mc-focused]': 'hasFocus',
|
1159
|
+
'[class.mc-action-button-focused]': 'actionButton?.active',
|
1160
|
+
'[attr.id]': 'id',
|
1161
|
+
'[attr.tabindex]': '-1',
|
1162
|
+
'[attr.disabled]': 'disabled || null',
|
732
1163
|
'(focusin)': 'focus()',
|
733
1164
|
'(blur)': 'blur()',
|
734
|
-
'(click)': 'selectViaInteraction($event)'
|
1165
|
+
'(click)': 'selectViaInteraction($event)',
|
1166
|
+
'(keydown)': 'onKeydown($event)'
|
735
1167
|
},
|
736
1168
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
737
1169
|
encapsulation: i0.ViewEncapsulation.None,
|
738
|
-
providers: [
|
1170
|
+
providers: [
|
1171
|
+
{ provide: McTreeNode, useExisting: McTreeOption },
|
1172
|
+
{ provide: i1.MC_OPTION_ACTION_PARENT, useExisting: McTreeOption }
|
1173
|
+
]
|
739
1174
|
}]
|
740
1175
|
}], ctorParameters: function () {
|
741
1176
|
return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
|
742
1177
|
type: i0.Inject,
|
743
1178
|
args: [MC_TREE_OPTION_PARENT_COMPONENT]
|
744
1179
|
}] }];
|
745
|
-
}, propDecorators: {
|
1180
|
+
}, propDecorators: { toggleElement: [{
|
1181
|
+
type: i0.ContentChild,
|
1182
|
+
args: ['mcTreeNodeToggle']
|
1183
|
+
}], actionButton: [{
|
1184
|
+
type: i0.ContentChild,
|
1185
|
+
args: [i1.McOptionActionComponent]
|
1186
|
+
}], tooltipTrigger: [{
|
1187
|
+
type: i0.ContentChild,
|
1188
|
+
args: [tooltip.McTooltipTrigger]
|
1189
|
+
}], dropdownTrigger: [{
|
1190
|
+
type: i0.ContentChild,
|
1191
|
+
args: [dropdown.McDropdownTrigger]
|
1192
|
+
}], disabled: [{
|
746
1193
|
type: i0.Input
|
747
1194
|
}], showCheckbox: [{
|
748
1195
|
type: i0.Input
|
@@ -755,6 +1202,20 @@
|
|
755
1202
|
useExisting: i0.forwardRef(function () { return McTreeSelection; }),
|
756
1203
|
multi: true
|
757
1204
|
};
|
1205
|
+
var McTreeSelectAllEvent = /** @class */ (function () {
|
1206
|
+
function McTreeSelectAllEvent(source, options) {
|
1207
|
+
this.source = source;
|
1208
|
+
this.options = options;
|
1209
|
+
}
|
1210
|
+
return McTreeSelectAllEvent;
|
1211
|
+
}());
|
1212
|
+
var McTreeCopyEvent = /** @class */ (function () {
|
1213
|
+
function McTreeCopyEvent(source, option) {
|
1214
|
+
this.source = source;
|
1215
|
+
this.option = option;
|
1216
|
+
}
|
1217
|
+
return McTreeCopyEvent;
|
1218
|
+
}());
|
758
1219
|
var McTreeNavigationChange = /** @class */ (function () {
|
759
1220
|
function McTreeNavigationChange(source, option) {
|
760
1221
|
this.source = source;
|
@@ -771,15 +1232,18 @@
|
|
771
1232
|
}());
|
772
1233
|
var McTreeSelection = /** @class */ (function (_super) {
|
773
1234
|
__extends(McTreeSelection, _super);
|
774
|
-
function McTreeSelection(elementRef, differs, changeDetectorRef, multiple) {
|
1235
|
+
function McTreeSelection(elementRef, differs, changeDetectorRef, multiple, clipboard) {
|
775
1236
|
var _this = _super.call(this, differs, changeDetectorRef) || this;
|
776
1237
|
_this.elementRef = elementRef;
|
1238
|
+
_this.clipboard = clipboard;
|
777
1239
|
_this.renderedOptions = new i0.QueryList();
|
778
1240
|
_this.resetFocusedItemOnBlur = true;
|
779
|
-
_this.navigationChange = new i0.EventEmitter();
|
780
|
-
_this.selectionChange = new i0.EventEmitter();
|
781
1241
|
_this.multipleMode = null;
|
782
1242
|
_this.userTabIndex = null;
|
1243
|
+
_this.navigationChange = new i0.EventEmitter();
|
1244
|
+
_this.selectionChange = new i0.EventEmitter();
|
1245
|
+
_this.onSelectAll = new i0.EventEmitter();
|
1246
|
+
_this.onCopy = new i0.EventEmitter();
|
783
1247
|
_this.sortedNodes = [];
|
784
1248
|
_this._autoSelect = true;
|
785
1249
|
_this._noUnselectLast = true;
|
@@ -800,14 +1264,15 @@
|
|
800
1264
|
});
|
801
1265
|
_this.renderedOptions.reset(orderedOptions);
|
802
1266
|
_this.renderedOptions.notifyOnChanges();
|
1267
|
+
_this.updateScrollSize();
|
803
1268
|
};
|
804
|
-
if (multiple === i1
|
1269
|
+
if (multiple === i1.MultipleMode.CHECKBOX || multiple === i1.MultipleMode.KEYBOARD) {
|
805
1270
|
_this.multipleMode = multiple;
|
806
1271
|
}
|
807
1272
|
else if (multiple !== null) {
|
808
|
-
_this.multipleMode = i1
|
1273
|
+
_this.multipleMode = i1.MultipleMode.CHECKBOX;
|
809
1274
|
}
|
810
|
-
if (_this.multipleMode === i1
|
1275
|
+
if (_this.multipleMode === i1.MultipleMode.CHECKBOX) {
|
811
1276
|
_this.autoSelect = false;
|
812
1277
|
_this.noUnselectLast = false;
|
813
1278
|
}
|
@@ -882,7 +1347,7 @@
|
|
882
1347
|
});
|
883
1348
|
Object.defineProperty(McTreeSelection.prototype, "showCheckbox", {
|
884
1349
|
get: function () {
|
885
|
-
return this.multipleMode === i1
|
1350
|
+
return this.multipleMode === i1.MultipleMode.CHECKBOX;
|
886
1351
|
},
|
887
1352
|
enumerable: false,
|
888
1353
|
configurable: true
|
@@ -939,7 +1404,9 @@
|
|
939
1404
|
if (this.renderedOptions.length === 0 || this.isFocusReceivedFromNestedOption($event)) {
|
940
1405
|
return;
|
941
1406
|
}
|
1407
|
+
this.keyManager.setFocusOrigin('keyboard');
|
942
1408
|
this.keyManager.setFirstItemActive();
|
1409
|
+
this.keyManager.setFocusOrigin('program');
|
943
1410
|
};
|
944
1411
|
McTreeSelection.prototype.blur = function () {
|
945
1412
|
if (!this.hasFocusedOption() && this.resetFocusedItemOnBlur) {
|
@@ -949,51 +1416,54 @@
|
|
949
1416
|
this.changeDetectorRef.markForCheck();
|
950
1417
|
};
|
951
1418
|
McTreeSelection.prototype.onKeyDown = function (event) {
|
1419
|
+
var _a, _b;
|
952
1420
|
this.keyManager.setFocusOrigin('keyboard');
|
953
1421
|
// tslint:disable-next-line: deprecation
|
954
1422
|
var keyCode = event.keyCode;
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
1423
|
+
if ([keycodes.SPACE, keycodes.LEFT_ARROW, keycodes.RIGHT_ARROW].includes(keyCode) || keycodes.isVerticalMovement(event)) {
|
1424
|
+
event.preventDefault();
|
1425
|
+
}
|
1426
|
+
if (this.multiple && keycodes.isSelectAll(event)) {
|
1427
|
+
this.selectAllOptions();
|
1428
|
+
return;
|
1429
|
+
}
|
1430
|
+
else if (keycodes.isCopy(event)) {
|
1431
|
+
this.copyActiveOption();
|
1432
|
+
return;
|
1433
|
+
}
|
1434
|
+
else if (keyCode === keycodes.TAB) {
|
1435
|
+
this.keyManager.tabOut.next();
|
1436
|
+
return;
|
1437
|
+
}
|
1438
|
+
else if (keyCode === keycodes.LEFT_ARROW && ((_a = this.keyManager.activeItem) === null || _a === void 0 ? void 0 : _a.isExpandable)) {
|
1439
|
+
this.treeControl.collapse(this.keyManager.activeItem.data);
|
1440
|
+
return;
|
1441
|
+
}
|
1442
|
+
else if (keyCode === keycodes.RIGHT_ARROW && ((_b = this.keyManager.activeItem) === null || _b === void 0 ? void 0 : _b.isExpandable)) {
|
1443
|
+
this.treeControl.expand(this.keyManager.activeItem.data);
|
1444
|
+
return;
|
1445
|
+
}
|
1446
|
+
else if (keyCode === keycodes.DOWN_ARROW) {
|
1447
|
+
this.keyManager.setNextItemActive();
|
1448
|
+
}
|
1449
|
+
else if (keyCode === keycodes.UP_ARROW) {
|
1450
|
+
this.keyManager.setPreviousItemActive();
|
1451
|
+
}
|
1452
|
+
else if ([keycodes.SPACE, keycodes.ENTER].includes(keyCode)) {
|
1453
|
+
this.toggleFocusedOption();
|
1454
|
+
return;
|
1455
|
+
}
|
1456
|
+
else if (keyCode === keycodes.HOME) {
|
1457
|
+
this.keyManager.setFirstItemActive();
|
1458
|
+
}
|
1459
|
+
else if (keyCode === keycodes.END) {
|
1460
|
+
this.keyManager.setLastItemActive();
|
1461
|
+
}
|
1462
|
+
else if (keyCode === keycodes.PAGE_UP) {
|
1463
|
+
this.keyManager.setPreviousPageItemActive();
|
1464
|
+
}
|
1465
|
+
else if (keyCode === keycodes.PAGE_DOWN) {
|
1466
|
+
this.keyManager.setNextPageItemActive();
|
997
1467
|
}
|
998
1468
|
if (this.keyManager.activeItem) {
|
999
1469
|
this.setSelectedOptionsByKey(this.keyManager.activeItem, keycodes.hasModifierKey(event, 'shiftKey'), keycodes.hasModifierKey(event, 'ctrlKey'));
|
@@ -1044,7 +1514,7 @@
|
|
1044
1514
|
this.emitChangeEvent(option);
|
1045
1515
|
};
|
1046
1516
|
McTreeSelection.prototype.setSelectedOptions = function (option) {
|
1047
|
-
var
|
1517
|
+
var _c;
|
1048
1518
|
var _this = this;
|
1049
1519
|
var selectedOptionState = option.selected;
|
1050
1520
|
var fromIndex = this.keyManager.previousActiveItemIndex;
|
@@ -1053,7 +1523,7 @@
|
|
1053
1523
|
return;
|
1054
1524
|
}
|
1055
1525
|
if (fromIndex > toIndex) {
|
1056
|
-
|
1526
|
+
_c = __read([toIndex, fromIndex], 2), fromIndex = _c[0], toIndex = _c[1];
|
1057
1527
|
}
|
1058
1528
|
this.renderedOptions
|
1059
1529
|
.toArray()
|
@@ -1082,28 +1552,32 @@
|
|
1082
1552
|
if (viewContainer === void 0) { viewContainer = this.nodeOutlet.viewContainer; }
|
1083
1553
|
_super.prototype.renderNodeChanges.call(this, data, dataDiffer, viewContainer, parentData);
|
1084
1554
|
this.sortedNodes = this.getSortedNodes(viewContainer);
|
1085
|
-
this.updateScrollSize();
|
1086
1555
|
this.nodeOutlet.changeDetectorRef.detectChanges();
|
1087
1556
|
};
|
1088
|
-
McTreeSelection.prototype.getHeight = function () {
|
1089
|
-
var clientRects = this.elementRef.nativeElement.getClientRects();
|
1090
|
-
if (clientRects.length) {
|
1091
|
-
return clientRects[0].height;
|
1092
|
-
}
|
1093
|
-
return 0;
|
1094
|
-
};
|
1095
|
-
McTreeSelection.prototype.getItemHeight = function () {
|
1096
|
-
return this.renderedOptions.first ? this.renderedOptions.first.getHeight() : 0;
|
1097
|
-
};
|
1098
1557
|
McTreeSelection.prototype.emitNavigationEvent = function (option) {
|
1099
1558
|
this.navigationChange.emit(new McTreeNavigationChange(this, option));
|
1100
1559
|
};
|
1101
1560
|
McTreeSelection.prototype.emitChangeEvent = function (option) {
|
1102
1561
|
this.selectionChange.emit(new McTreeNavigationChange(this, option));
|
1103
1562
|
};
|
1563
|
+
McTreeSelection.prototype.selectAllOptions = function () {
|
1564
|
+
var optionsToSelect = this.renderedOptions
|
1565
|
+
.filter(function (option) { return !option.disabled; });
|
1566
|
+
optionsToSelect
|
1567
|
+
.forEach(function (option) { return option.setSelected(true); });
|
1568
|
+
this.onSelectAll.emit(new McTreeSelectAllEvent(this, optionsToSelect));
|
1569
|
+
};
|
1570
|
+
McTreeSelection.prototype.copyActiveOption = function () {
|
1571
|
+
if (this.onCopy.observers.length) {
|
1572
|
+
this.onCopy.emit(new McTreeCopyEvent(this, this.keyManager.activeItem));
|
1573
|
+
}
|
1574
|
+
else {
|
1575
|
+
this.onCopyDefaultHandler();
|
1576
|
+
}
|
1577
|
+
};
|
1104
1578
|
McTreeSelection.prototype.writeValue = function (value) {
|
1105
1579
|
if (this.multiple && value && !Array.isArray(value)) {
|
1106
|
-
throw i1
|
1580
|
+
throw i1.getMcSelectNonArrayValueError();
|
1107
1581
|
}
|
1108
1582
|
if (value) {
|
1109
1583
|
this.setOptionsFromValues(this.multiple ? value : [value]);
|
@@ -1126,18 +1600,32 @@
|
|
1126
1600
|
this.changeDetectorRef.markForCheck();
|
1127
1601
|
};
|
1128
1602
|
McTreeSelection.prototype.setOptionsFromValues = function (values) {
|
1129
|
-
var
|
1603
|
+
var _c;
|
1130
1604
|
var _this = this;
|
1131
1605
|
this.selectionModel.clear();
|
1132
1606
|
var valuesToSelect = values.reduce(function (result, value) {
|
1133
1607
|
return _this.treeControl.hasValue(value) ? __spreadArray(__spreadArray([], __read(result)), [_this.treeControl.hasValue(value)]) : __spreadArray([], __read(result));
|
1134
1608
|
}, []);
|
1135
|
-
(
|
1609
|
+
(_c = this.selectionModel).select.apply(_c, __spreadArray([], __read(valuesToSelect)));
|
1136
1610
|
};
|
1137
1611
|
McTreeSelection.prototype.getSelectedValues = function () {
|
1138
1612
|
var _this = this;
|
1139
1613
|
return this.selectionModel.selected.map(function (selected) { return _this.treeControl.getValue(selected); });
|
1140
1614
|
};
|
1615
|
+
McTreeSelection.prototype.getItemHeight = function () {
|
1616
|
+
return this.renderedOptions.first ? this.renderedOptions.first.getHeight() : 0;
|
1617
|
+
};
|
1618
|
+
McTreeSelection.prototype.onCopyDefaultHandler = function () {
|
1619
|
+
var _a;
|
1620
|
+
(_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.copy(this.keyManager.activeItem.value);
|
1621
|
+
};
|
1622
|
+
McTreeSelection.prototype.getHeight = function () {
|
1623
|
+
var clientRects = this.elementRef.nativeElement.getClientRects();
|
1624
|
+
if (clientRects.length) {
|
1625
|
+
return clientRects[0].height;
|
1626
|
+
}
|
1627
|
+
return 0;
|
1628
|
+
};
|
1141
1629
|
McTreeSelection.prototype.updateTabIndex = function () {
|
1142
1630
|
this._tabIndex = this.renderedOptions.length === 0 ? -1 : 0;
|
1143
1631
|
};
|
@@ -1218,20 +1706,20 @@
|
|
1218
1706
|
return $event.relatedTarget.classList.contains('mc-tree-option');
|
1219
1707
|
};
|
1220
1708
|
return McTreeSelection;
|
1221
|
-
}(
|
1222
|
-
/** @nocollapse */ McTreeSelection.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1223
|
-
/** @nocollapse */ McTreeSelection.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
1709
|
+
}(McTreeBase));
|
1710
|
+
/** @nocollapse */ McTreeSelection.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeSelection, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.IterableDiffers }, { token: i0__namespace.ChangeDetectorRef }, { token: 'multiple', attribute: true }, { token: i1__namespace$1.Clipboard, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
1711
|
+
/** @nocollapse */ McTreeSelection.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: McTreeSelection, selector: "mc-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: "mc-tree-selection" }, providers: [
|
1224
1712
|
MC_SELECTION_TREE_VALUE_ACCESSOR,
|
1225
1713
|
{ provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
|
1226
|
-
{ provide:
|
1227
|
-
], queries: [{ propertyName: "unorderedOptions", predicate: McTreeOption }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate:
|
1228
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1714
|
+
{ provide: McTreeBase, useExisting: McTreeSelection }
|
1715
|
+
], queries: [{ propertyName: "unorderedOptions", predicate: McTreeOption }], viewQueries: [{ propertyName: "nodeOutlet", first: true, predicate: McTreeNodeOutlet, descendants: true, static: true }], exportAs: ["mcTreeSelection"], usesInheritance: true, ngImport: i0__namespace, template: '<ng-container mcTreeNodeOutlet></ng-container>', isInline: true, styles: [".mc-tree-selection{display:block}\n"], directives: [{ type: McTreeNodeOutlet, selector: "[mcTreeNodeOutlet]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.None });
|
1716
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeSelection, decorators: [{
|
1229
1717
|
type: i0.Component,
|
1230
1718
|
args: [{
|
1231
1719
|
selector: 'mc-tree-selection',
|
1232
1720
|
exportAs: 'mcTreeSelection',
|
1233
|
-
template: '<ng-container
|
1234
|
-
styleUrls: ['./tree.scss'],
|
1721
|
+
template: '<ng-container mcTreeNodeOutlet></ng-container>',
|
1722
|
+
styleUrls: ['./tree-selection.scss'],
|
1235
1723
|
host: {
|
1236
1724
|
class: 'mc-tree-selection',
|
1237
1725
|
'[attr.tabindex]': 'tabIndex',
|
@@ -1246,17 +1734,19 @@
|
|
1246
1734
|
providers: [
|
1247
1735
|
MC_SELECTION_TREE_VALUE_ACCESSOR,
|
1248
1736
|
{ provide: MC_TREE_OPTION_PARENT_COMPONENT, useExisting: McTreeSelection },
|
1249
|
-
{ provide:
|
1737
|
+
{ provide: McTreeBase, useExisting: McTreeSelection }
|
1250
1738
|
]
|
1251
1739
|
}]
|
1252
1740
|
}], ctorParameters: function () {
|
1253
|
-
return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.IterableDiffers }, { type: i0__namespace.ChangeDetectorRef }, { type: i1__namespace
|
1741
|
+
return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.IterableDiffers }, { type: i0__namespace.ChangeDetectorRef }, { type: i1__namespace.MultipleMode, decorators: [{
|
1254
1742
|
type: i0.Attribute,
|
1255
1743
|
args: ['multiple']
|
1744
|
+
}] }, { type: i1__namespace$1.Clipboard, decorators: [{
|
1745
|
+
type: i0.Optional
|
1256
1746
|
}] }];
|
1257
1747
|
}, propDecorators: { nodeOutlet: [{
|
1258
1748
|
type: i0.ViewChild,
|
1259
|
-
args: [
|
1749
|
+
args: [McTreeNodeOutlet, { static: true }]
|
1260
1750
|
}], unorderedOptions: [{
|
1261
1751
|
type: i0.ContentChildren,
|
1262
1752
|
args: [McTreeOption]
|
@@ -1266,6 +1756,10 @@
|
|
1266
1756
|
type: i0.Output
|
1267
1757
|
}], selectionChange: [{
|
1268
1758
|
type: i0.Output
|
1759
|
+
}], onSelectAll: [{
|
1760
|
+
type: i0.Output
|
1761
|
+
}], onCopy: [{
|
1762
|
+
type: i0.Output
|
1269
1763
|
}], autoSelect: [{
|
1270
1764
|
type: i0.Input
|
1271
1765
|
}], noUnselectLast: [{
|
@@ -1277,10 +1771,13 @@
|
|
1277
1771
|
}] } });
|
1278
1772
|
|
1279
1773
|
var MC_TREE_DIRECTIVES = [
|
1280
|
-
|
1281
|
-
McTreeOption,
|
1774
|
+
McTreeNodeOutlet,
|
1282
1775
|
McTreeNodeDef,
|
1776
|
+
McTreeNode,
|
1283
1777
|
McTreeNodePadding,
|
1778
|
+
McTree,
|
1779
|
+
McTreeSelection,
|
1780
|
+
McTreeOption,
|
1284
1781
|
McTreeNodeToggleComponent,
|
1285
1782
|
McTreeNodeToggleDirective
|
1286
1783
|
];
|
@@ -1289,28 +1786,273 @@
|
|
1289
1786
|
}
|
1290
1787
|
return McTreeModule;
|
1291
1788
|
}());
|
1292
|
-
/** @nocollapse */ McTreeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1293
|
-
/** @nocollapse */ McTreeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
1294
|
-
McTreeOption,
|
1789
|
+
/** @nocollapse */ McTreeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1790
|
+
/** @nocollapse */ McTreeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeModule, declarations: [McTreeNodeOutlet,
|
1295
1791
|
McTreeNodeDef,
|
1792
|
+
McTreeNode,
|
1296
1793
|
McTreeNodePadding,
|
1297
|
-
|
1298
|
-
|
1794
|
+
McTree,
|
1795
|
+
McTreeSelection,
|
1299
1796
|
McTreeOption,
|
1797
|
+
McTreeNodeToggleComponent,
|
1798
|
+
McTreeNodeToggleDirective], imports: [i2$1.CommonModule, i1.McPseudoCheckboxModule], exports: [McTreeNodeOutlet,
|
1300
1799
|
McTreeNodeDef,
|
1800
|
+
McTreeNode,
|
1301
1801
|
McTreeNodePadding,
|
1802
|
+
McTree,
|
1803
|
+
McTreeSelection,
|
1804
|
+
McTreeOption,
|
1302
1805
|
McTreeNodeToggleComponent,
|
1303
1806
|
McTreeNodeToggleDirective] });
|
1304
|
-
/** @nocollapse */ McTreeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
1305
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1807
|
+
/** @nocollapse */ McTreeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeModule, imports: [[i2$1.CommonModule, i1.McPseudoCheckboxModule]] });
|
1808
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: McTreeModule, decorators: [{
|
1306
1809
|
type: i0.NgModule,
|
1307
1810
|
args: [{
|
1308
|
-
imports: [i2.CommonModule, i1.
|
1811
|
+
imports: [i2$1.CommonModule, i1.McPseudoCheckboxModule],
|
1309
1812
|
exports: MC_TREE_DIRECTIVES,
|
1310
1813
|
declarations: MC_TREE_DIRECTIVES
|
1311
1814
|
}]
|
1312
1815
|
}] });
|
1313
1816
|
|
1817
|
+
/** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
|
1818
|
+
/* tslint:disable-next-line:naming-convention */
|
1819
|
+
var BaseTreeControl = /** @class */ (function () {
|
1820
|
+
function BaseTreeControl() {
|
1821
|
+
/** A selection model with multi-selection to track expansion status. */
|
1822
|
+
this.expansionModel = new collections.SelectionModel(true);
|
1823
|
+
this.filterModel = new collections.SelectionModel(true);
|
1824
|
+
this.filterValue = new rxjs.BehaviorSubject('');
|
1825
|
+
}
|
1826
|
+
/** Toggles one single data node's expanded/collapsed state. */
|
1827
|
+
BaseTreeControl.prototype.toggle = function (dataNode) {
|
1828
|
+
if (this.filterValue.value) {
|
1829
|
+
return;
|
1830
|
+
}
|
1831
|
+
this.expansionModel.toggle(dataNode);
|
1832
|
+
};
|
1833
|
+
/** Expands one single data node. */
|
1834
|
+
BaseTreeControl.prototype.expand = function (dataNode) {
|
1835
|
+
if (this.filterValue.value) {
|
1836
|
+
return;
|
1837
|
+
}
|
1838
|
+
this.expansionModel.select(dataNode);
|
1839
|
+
};
|
1840
|
+
/** Collapses one single data node. */
|
1841
|
+
BaseTreeControl.prototype.collapse = function (dataNode) {
|
1842
|
+
if (this.filterValue.value) {
|
1843
|
+
return;
|
1844
|
+
}
|
1845
|
+
this.expansionModel.deselect(dataNode);
|
1846
|
+
};
|
1847
|
+
/** Whether a given data node is expanded or not. Returns true if the data node is expanded. */
|
1848
|
+
BaseTreeControl.prototype.isExpanded = function (dataNode) {
|
1849
|
+
return this.expansionModel.isSelected(dataNode);
|
1850
|
+
};
|
1851
|
+
/** Toggles a subtree rooted at `node` recursively. */
|
1852
|
+
BaseTreeControl.prototype.toggleDescendants = function (dataNode) {
|
1853
|
+
this.expansionModel.isSelected(dataNode)
|
1854
|
+
? this.collapseDescendants(dataNode)
|
1855
|
+
: this.expandDescendants(dataNode);
|
1856
|
+
};
|
1857
|
+
/** Collapse all dataNodes in the tree. */
|
1858
|
+
BaseTreeControl.prototype.collapseAll = function () {
|
1859
|
+
this.expansionModel.clear();
|
1860
|
+
};
|
1861
|
+
/** Expands a subtree rooted at given data node recursively. */
|
1862
|
+
BaseTreeControl.prototype.expandDescendants = function (dataNode) {
|
1863
|
+
var _a;
|
1864
|
+
var toBeProcessed = [dataNode];
|
1865
|
+
toBeProcessed.push.apply(toBeProcessed, __spreadArray([], __read(this.getDescendants(dataNode))));
|
1866
|
+
(_a = this.expansionModel).select.apply(_a, __spreadArray([], __read(toBeProcessed)));
|
1867
|
+
};
|
1868
|
+
/** Collapses a subtree rooted at given data node recursively. */
|
1869
|
+
BaseTreeControl.prototype.collapseDescendants = function (dataNode) {
|
1870
|
+
var _a;
|
1871
|
+
var toBeProcessed = [dataNode];
|
1872
|
+
toBeProcessed.push.apply(toBeProcessed, __spreadArray([], __read(this.getDescendants(dataNode))));
|
1873
|
+
(_a = this.expansionModel).deselect.apply(_a, __spreadArray([], __read(toBeProcessed)));
|
1874
|
+
};
|
1875
|
+
return BaseTreeControl;
|
1876
|
+
}());
|
1877
|
+
|
1878
|
+
function defaultCompareValues(firstValue, secondValue) {
|
1879
|
+
return firstValue === secondValue;
|
1880
|
+
}
|
1881
|
+
function defaultCompareViewValues(firstViewValue, secondViewValue) {
|
1882
|
+
return RegExp(secondViewValue, 'gi').test(firstViewValue);
|
1883
|
+
}
|
1884
|
+
/** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
|
1885
|
+
var FlatTreeControl = /** @class */ (function (_super) {
|
1886
|
+
__extends(FlatTreeControl, _super);
|
1887
|
+
/** Construct with flat tree data node functions getLevel, isExpandable, getValue and getViewValue. */
|
1888
|
+
function FlatTreeControl(getLevel, isExpandable,
|
1889
|
+
/** getValue will be used to determine if the tree contains value or not. Used in method hasValue */
|
1890
|
+
getValue,
|
1891
|
+
/** getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction */
|
1892
|
+
getViewValue,
|
1893
|
+
/** compareValues will be used to comparing values. */
|
1894
|
+
compareValues,
|
1895
|
+
/** compareValues will be used to comparing values. */
|
1896
|
+
compareViewValues) {
|
1897
|
+
if (compareValues === void 0) { compareValues = defaultCompareValues; }
|
1898
|
+
if (compareViewValues === void 0) { compareViewValues = defaultCompareViewValues; }
|
1899
|
+
var _this = _super.call(this) || this;
|
1900
|
+
_this.getLevel = getLevel;
|
1901
|
+
_this.isExpandable = isExpandable;
|
1902
|
+
_this.getValue = getValue;
|
1903
|
+
_this.getViewValue = getViewValue;
|
1904
|
+
_this.compareValues = compareValues;
|
1905
|
+
_this.compareViewValues = compareViewValues;
|
1906
|
+
return _this;
|
1907
|
+
}
|
1908
|
+
/**
|
1909
|
+
* Gets a list of the data node's subtree of descendent data nodes.
|
1910
|
+
*
|
1911
|
+
* To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes
|
1912
|
+
* with correct levels.
|
1913
|
+
*/
|
1914
|
+
FlatTreeControl.prototype.getDescendants = function (dataNode) {
|
1915
|
+
var startIndex = this.dataNodes.indexOf(dataNode);
|
1916
|
+
var results = [];
|
1917
|
+
// Goes through flattened tree nodes in the `dataNodes` array, and get all descendants.
|
1918
|
+
// The level of descendants of a tree node must be greater than the level of the given
|
1919
|
+
// tree node.
|
1920
|
+
// If we reach a node whose level is equal to the level of the tree node, we hit a sibling.
|
1921
|
+
// If we reach a node whose level is greater than the level of the tree node, we hit a
|
1922
|
+
// sibling of an ancestor.
|
1923
|
+
for (var i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) {
|
1924
|
+
results.push(this.dataNodes[i]);
|
1925
|
+
}
|
1926
|
+
return results;
|
1927
|
+
};
|
1928
|
+
/**
|
1929
|
+
* Expands all data nodes in the tree.
|
1930
|
+
*
|
1931
|
+
* To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened
|
1932
|
+
* data nodes of the tree.
|
1933
|
+
*/
|
1934
|
+
FlatTreeControl.prototype.expandAll = function () {
|
1935
|
+
var _a;
|
1936
|
+
(_a = this.expansionModel).select.apply(_a, __spreadArray([], __read(this.dataNodes)));
|
1937
|
+
};
|
1938
|
+
FlatTreeControl.prototype.getParents = function (node, result) {
|
1939
|
+
if (node.parent) {
|
1940
|
+
result.unshift(node.parent);
|
1941
|
+
return this.getParents(node.parent, result);
|
1942
|
+
}
|
1943
|
+
else {
|
1944
|
+
return result;
|
1945
|
+
}
|
1946
|
+
};
|
1947
|
+
FlatTreeControl.prototype.hasValue = function (value) {
|
1948
|
+
var _this = this;
|
1949
|
+
return this.dataNodes.find(function (node) { return _this.compareValues(_this.getValue(node), value); });
|
1950
|
+
};
|
1951
|
+
FlatTreeControl.prototype.filterNodes = function (value) {
|
1952
|
+
var _a;
|
1953
|
+
var _this = this;
|
1954
|
+
this.saveExpansionState();
|
1955
|
+
this.filterModel.clear();
|
1956
|
+
this.expansionModel.clear();
|
1957
|
+
var filteredNodes = this.dataNodes
|
1958
|
+
.filter(function (node) { return _this.compareViewValues(_this.getViewValue(node), value); });
|
1959
|
+
var filteredNodesWithTheirParents = new Set();
|
1960
|
+
filteredNodes.forEach(function (filteredNode) {
|
1961
|
+
_this.getParents(filteredNode, [])
|
1962
|
+
.forEach(function (node) {
|
1963
|
+
filteredNodesWithTheirParents.add(node);
|
1964
|
+
_this.expandDataNode(node);
|
1965
|
+
});
|
1966
|
+
filteredNodesWithTheirParents.add(filteredNode);
|
1967
|
+
_this.expandDataNode(filteredNode);
|
1968
|
+
if (_this.isExpandable(filteredNode)) {
|
1969
|
+
var childNodeLevel_1 = _this.getLevel(filteredNode) + 1;
|
1970
|
+
_this.getDescendants(filteredNode)
|
1971
|
+
.filter(function (childNode) { return _this.getLevel(childNode) === childNodeLevel_1; })
|
1972
|
+
.filter(function (childNode) { return !_this.isExpandable(childNode) || !_this.hasFilteredDescendant(childNode, filteredNodes); })
|
1973
|
+
.forEach(function (childNode) {
|
1974
|
+
filteredNodesWithTheirParents.add(childNode);
|
1975
|
+
_this.expandDataNode(childNode);
|
1976
|
+
});
|
1977
|
+
}
|
1978
|
+
});
|
1979
|
+
(_a = this.filterModel).select.apply(_a, __spreadArray([], __read(Array.from(filteredNodesWithTheirParents))));
|
1980
|
+
this.filterValue.next(value);
|
1981
|
+
this.restoreExpansionState();
|
1982
|
+
};
|
1983
|
+
FlatTreeControl.prototype.expandDataNode = function (dataNode) {
|
1984
|
+
if (this.isExpandable(dataNode)) {
|
1985
|
+
this.expansionModel.select(dataNode);
|
1986
|
+
}
|
1987
|
+
};
|
1988
|
+
FlatTreeControl.prototype.saveExpansionState = function () {
|
1989
|
+
if (this.filterValue.value === '') {
|
1990
|
+
this.expandedItemsBeforeFiltration = this.expansionModel.selected;
|
1991
|
+
}
|
1992
|
+
};
|
1993
|
+
FlatTreeControl.prototype.restoreExpansionState = function () {
|
1994
|
+
var _a;
|
1995
|
+
if (this.filterValue.value === '') {
|
1996
|
+
this.expansionModel.clear();
|
1997
|
+
(_a = this.expansionModel).select.apply(_a, __spreadArray([], __read(this.expandedItemsBeforeFiltration)));
|
1998
|
+
}
|
1999
|
+
};
|
2000
|
+
FlatTreeControl.prototype.hasFilteredDescendant = function (dataNode, filteredNodes) {
|
2001
|
+
var _this = this;
|
2002
|
+
var filteredViewValues = filteredNodes
|
2003
|
+
.map(function (node) { return _this.getViewValue(node); });
|
2004
|
+
return this.getDescendants(dataNode)
|
2005
|
+
.filter(function (node) { return filteredViewValues.includes(_this.getViewValue(node)); })
|
2006
|
+
.length > 0;
|
2007
|
+
};
|
2008
|
+
return FlatTreeControl;
|
2009
|
+
}(BaseTreeControl));
|
2010
|
+
|
2011
|
+
/** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
|
2012
|
+
var NestedTreeControl = /** @class */ (function (_super) {
|
2013
|
+
__extends(NestedTreeControl, _super);
|
2014
|
+
/** Construct with nested tree function getChildren. */
|
2015
|
+
function NestedTreeControl(getChildren) {
|
2016
|
+
var _this = _super.call(this) || this;
|
2017
|
+
_this.getChildren = getChildren;
|
2018
|
+
return _this;
|
2019
|
+
}
|
2020
|
+
/**
|
2021
|
+
* Expands all dataNodes in the tree.
|
2022
|
+
*
|
2023
|
+
* To make this working, the `dataNodes` variable of the TreeControl must be set to all root level
|
2024
|
+
* data nodes of the tree.
|
2025
|
+
*/
|
2026
|
+
NestedTreeControl.prototype.expandAll = function () {
|
2027
|
+
var _a;
|
2028
|
+
var _this = this;
|
2029
|
+
this.expansionModel.clear();
|
2030
|
+
var allNodes = this.dataNodes.reduce(function (accumulator, dataNode) { return __spreadArray(__spreadArray(__spreadArray([], __read(accumulator)), __read(_this.getDescendants(dataNode))), [dataNode]); }, []);
|
2031
|
+
(_a = this.expansionModel).select.apply(_a, __spreadArray([], __read(allNodes)));
|
2032
|
+
};
|
2033
|
+
/** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
|
2034
|
+
NestedTreeControl.prototype.getDescendants = function (dataNode) {
|
2035
|
+
var descendants = [];
|
2036
|
+
this._getDescendants(descendants, dataNode);
|
2037
|
+
return descendants.splice(1);
|
2038
|
+
};
|
2039
|
+
/** A helper function to get descendants recursively. */
|
2040
|
+
// todo нужно придумать другое название и понять в чем отличие между getDescendants и _getDescendants
|
2041
|
+
/* tslint:disable-next-line:naming-convention */
|
2042
|
+
NestedTreeControl.prototype._getDescendants = function (descendants, dataNode) {
|
2043
|
+
var _this = this;
|
2044
|
+
descendants.push(dataNode);
|
2045
|
+
this.getChildren(dataNode)
|
2046
|
+
.pipe(operators.take(1))
|
2047
|
+
.subscribe(function (children) {
|
2048
|
+
if (children && children.length > 0) {
|
2049
|
+
children.forEach(function (child) { return _this._getDescendants(descendants, child); });
|
2050
|
+
}
|
2051
|
+
});
|
2052
|
+
};
|
2053
|
+
return NestedTreeControl;
|
2054
|
+
}(BaseTreeControl));
|
2055
|
+
|
1314
2056
|
/**
|
1315
2057
|
* Tree flattener to convert a normal type of node to node with children & level information.
|
1316
2058
|
* Transform nested nodes of type `T` to flattened nodes of type `F`.
|
@@ -1522,23 +2264,38 @@
|
|
1522
2264
|
* Generated bundle index. Do not edit.
|
1523
2265
|
*/
|
1524
2266
|
|
2267
|
+
exports.BaseTreeControl = BaseTreeControl;
|
2268
|
+
exports.FlatTreeControl = FlatTreeControl;
|
1525
2269
|
exports.MC_SELECTION_TREE_VALUE_ACCESSOR = MC_SELECTION_TREE_VALUE_ACCESSOR;
|
1526
2270
|
exports.MC_TREE_OPTION_PARENT_COMPONENT = MC_TREE_OPTION_PARENT_COMPONENT;
|
2271
|
+
exports.McTree = McTree;
|
2272
|
+
exports.McTreeBase = McTreeBase;
|
2273
|
+
exports.McTreeCopyEvent = McTreeCopyEvent;
|
1527
2274
|
exports.McTreeFlatDataSource = McTreeFlatDataSource;
|
1528
2275
|
exports.McTreeFlattener = McTreeFlattener;
|
1529
2276
|
exports.McTreeModule = McTreeModule;
|
1530
2277
|
exports.McTreeNavigationChange = McTreeNavigationChange;
|
1531
2278
|
exports.McTreeNestedDataSource = McTreeNestedDataSource;
|
2279
|
+
exports.McTreeNode = McTreeNode;
|
1532
2280
|
exports.McTreeNodeDef = McTreeNodeDef;
|
2281
|
+
exports.McTreeNodeOutlet = McTreeNodeOutlet;
|
2282
|
+
exports.McTreeNodeOutletContext = McTreeNodeOutletContext;
|
1533
2283
|
exports.McTreeNodePadding = McTreeNodePadding;
|
2284
|
+
exports.McTreeNodeToggleBase = McTreeNodeToggleBase;
|
2285
|
+
exports.McTreeNodeToggleBaseDirective = McTreeNodeToggleBaseDirective;
|
1534
2286
|
exports.McTreeNodeToggleComponent = McTreeNodeToggleComponent;
|
1535
2287
|
exports.McTreeNodeToggleDirective = McTreeNodeToggleDirective;
|
2288
|
+
exports.McTreeNodeToggleMixinBase = McTreeNodeToggleMixinBase;
|
1536
2289
|
exports.McTreeOption = McTreeOption;
|
1537
2290
|
exports.McTreeOptionChange = McTreeOptionChange;
|
2291
|
+
exports.McTreeSelectAllEvent = McTreeSelectAllEvent;
|
1538
2292
|
exports.McTreeSelection = McTreeSelection;
|
1539
2293
|
exports.McTreeSelectionChange = McTreeSelectionChange;
|
2294
|
+
exports.NestedTreeControl = NestedTreeControl;
|
2295
|
+
exports.defaultCompareValues = defaultCompareValues;
|
2296
|
+
exports.defaultCompareViewValues = defaultCompareViewValues;
|
1540
2297
|
|
1541
2298
|
Object.defineProperty(exports, '__esModule', { value: true });
|
1542
2299
|
|
1543
|
-
}))
|
2300
|
+
}));
|
1544
2301
|
//# sourceMappingURL=ptsecurity-mosaic-tree.umd.js.map
|