ngwr 16.2.0 → 16.4.0
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/badge/styles/_tag.scss +73 -1
- package/calendar/styles/_index.scss +22 -0
- package/carousel/styles/_index.scss +53 -1
- package/cascader/styles/_rules.scss +7 -0
- package/color-picker/styles/_index.scss +21 -0
- package/date-picker/styles/_index.scss +19 -0
- package/dropdown/styles/_index.scss +13 -19
- package/fesm2022/ngwr-affix.mjs +3 -3
- package/fesm2022/ngwr-alert-testing.mjs +70 -0
- package/fesm2022/ngwr-alert-testing.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +3 -3
- package/fesm2022/ngwr-anchor.mjs +17 -6
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
- package/fesm2022/ngwr-animations-confetti.mjs +3 -3
- package/fesm2022/ngwr-animations-decode.mjs +3 -3
- package/fesm2022/ngwr-animations-destruct.mjs +3 -3
- package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
- package/fesm2022/ngwr-animations-glitch.mjs +3 -3
- package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
- package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
- package/fesm2022/ngwr-animations-marquee.mjs +3 -3
- package/fesm2022/ngwr-animations-orbit.mjs +3 -3
- package/fesm2022/ngwr-animations-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
- package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
- package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-back-top.mjs +3 -3
- package/fesm2022/ngwr-badge.mjs +129 -11
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs-testing.mjs +83 -0
- package/fesm2022/ngwr-breadcrumbs-testing.mjs.map +1 -0
- package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger-testing.mjs +45 -0
- package/fesm2022/ngwr-burger-testing.mjs.map +1 -0
- package/fesm2022/ngwr-burger.mjs +3 -3
- package/fesm2022/ngwr-button.mjs +6 -6
- package/fesm2022/ngwr-calendar-testing.mjs +18 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +500 -73
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -9
- package/fesm2022/ngwr-carousel-testing.mjs +24 -1
- package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +73 -10
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +45 -37
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-chart-legend.mjs +26 -11
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +3 -3
- package/fesm2022/ngwr-charts-donut-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-line-chart-testing.mjs +3 -2
- package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +17 -7
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +5 -4
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
- package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
- package/fesm2022/ngwr-checkbox.mjs +6 -6
- package/fesm2022/ngwr-clipboard.mjs +3 -3
- package/fesm2022/ngwr-collapse.mjs +9 -9
- package/fesm2022/ngwr-color-picker-testing.mjs +11 -1
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +153 -37
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +3 -3
- package/fesm2022/ngwr-comment.mjs +10 -6
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare-testing.mjs +84 -0
- package/fesm2022/ngwr-compare-testing.mjs.map +1 -0
- package/fesm2022/ngwr-compare.mjs +3 -3
- package/fesm2022/ngwr-context-menu.mjs +28 -13
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-cookie.mjs +3 -3
- package/fesm2022/ngwr-copy-value.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs +6 -6
- package/fesm2022/ngwr-date-picker-testing.mjs +30 -4
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +342 -69
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +3 -3
- package/fesm2022/ngwr-date.mjs +59 -8
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +6 -6
- package/fesm2022/ngwr-descriptions.mjs +6 -6
- package/fesm2022/ngwr-dialog.mjs +18 -18
- package/fesm2022/ngwr-directives.mjs +15 -15
- package/fesm2022/ngwr-divider.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs +51 -29
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +11 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +70 -99
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +4 -3
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar.mjs +186 -33
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload-testing.mjs +34 -2
- package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +279 -16
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +9 -9
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +30 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +664 -43
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +6 -6
- package/fesm2022/ngwr-i18n-ar.mjs +27 -8
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +27 -8
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +27 -8
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +27 -8
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +27 -8
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +27 -8
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +27 -8
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +27 -8
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +27 -8
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +27 -8
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +27 -8
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +27 -8
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +27 -8
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +27 -8
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +27 -8
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +27 -8
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +27 -8
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +27 -8
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +27 -8
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +27 -8
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +27 -8
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +27 -8
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +9 -9
- package/fesm2022/ngwr-icon.mjs +6 -6
- package/fesm2022/ngwr-image-cropper.mjs +3 -3
- package/fesm2022/ngwr-input-number-testing.mjs +11 -0
- package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +68 -7
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +23 -3
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input-testing.mjs +24 -1
- package/fesm2022/ngwr-input-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +152 -36
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +3 -3
- package/fesm2022/ngwr-knob.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-lightbox.mjs +8 -8
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +8 -8
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +15 -15
- package/fesm2022/ngwr-loading-bar.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-meta.mjs +6 -6
- package/fesm2022/ngwr-overlay.mjs +175 -13
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +3 -3
- package/fesm2022/ngwr-pagination.mjs +6 -3
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +31 -29
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +9 -9
- package/fesm2022/ngwr-popconfirm-testing.mjs +5 -2
- package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +44 -63
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover-testing.mjs +7 -1
- package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +58 -156
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +50 -9
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs +57 -0
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs.map +1 -0
- package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
- package/fesm2022/ngwr-qr.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs +6 -6
- package/fesm2022/ngwr-rating.mjs +3 -3
- package/fesm2022/ngwr-resizable-testing.mjs +113 -0
- package/fesm2022/ngwr-resizable-testing.mjs.map +1 -0
- package/fesm2022/ngwr-resizable.mjs +3 -3
- package/fesm2022/ngwr-result.mjs +12 -12
- package/fesm2022/ngwr-schema-form-testing.mjs +336 -0
- package/fesm2022/ngwr-schema-form-testing.mjs.map +1 -0
- package/fesm2022/ngwr-schema-form.mjs +416 -19
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +3 -3
- package/fesm2022/ngwr-segmented.mjs +3 -3
- package/fesm2022/ngwr-select-testing.mjs +19 -0
- package/fesm2022/ngwr-select-testing.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +361 -84
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar-testing.mjs +176 -0
- package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-skeleton.mjs +3 -3
- package/fesm2022/ngwr-slider-testing.mjs +6 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +21 -3
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +29 -12
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +3 -3
- package/fesm2022/ngwr-spinner.mjs +3 -3
- package/fesm2022/ngwr-splitter.mjs +3 -3
- package/fesm2022/ngwr-statistic.mjs +9 -9
- package/fesm2022/ngwr-stepper.mjs +42 -11
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +3 -3
- package/fesm2022/ngwr-switch.mjs +3 -3
- package/fesm2022/ngwr-table-testing.mjs +157 -3
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +1051 -74
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +3 -3
- package/fesm2022/ngwr-tabs-testing.mjs +1 -1
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +15 -10
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea-testing.mjs +11 -0
- package/fesm2022/ngwr-textarea-testing.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +128 -16
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +3 -3
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +40 -19
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- package/fesm2022/ngwr-tour-testing.mjs +13 -1
- package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +19 -15
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer-testing.mjs +6 -0
- package/fesm2022/ngwr-transfer-testing.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +24 -5
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree-testing.mjs +62 -2
- package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +978 -79
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +3 -3
- package/fesm2022/ngwr-utils-router.mjs +3 -3
- package/fesm2022/ngwr-utils.mjs +97 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
- package/fesm2022/ngwr-window.mjs +33 -22
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +156 -0
- package/graph/styles/_index.scss +87 -0
- package/i18n/ar.json +29 -8
- package/i18n/cs.json +29 -8
- package/i18n/de.json +29 -8
- package/i18n/en.json +29 -8
- package/i18n/es.json +29 -8
- package/i18n/fr.json +29 -8
- package/i18n/he.json +29 -8
- package/i18n/hi.json +29 -8
- package/i18n/id.json +29 -8
- package/i18n/it.json +29 -8
- package/i18n/ja.json +29 -8
- package/i18n/ko.json +29 -8
- package/i18n/nl.json +29 -8
- package/i18n/pl.json +29 -8
- package/i18n/pt.json +29 -8
- package/i18n/ru.json +29 -8
- package/i18n/sv.json +29 -8
- package/i18n/tr.json +29 -8
- package/i18n/uk.json +29 -8
- package/i18n/vi.json +29 -8
- package/i18n/zh-TW.json +29 -8
- package/i18n/zh.json +29 -8
- package/input/styles/_index.scss +68 -1
- package/input-otp/styles/_index.scss +14 -0
- package/llms-full.txt +53 -21
- package/llms.txt +57 -24
- package/overlay/styles/_arrow.scss +4 -4
- package/package.json +33 -1
- package/popconfirm/styles/_index.scss +3 -11
- package/progress/styles/_index.scss +32 -0
- package/schema-form/styles/_index.scss +78 -0
- package/schematics/collection.json +5 -0
- package/schematics/eject/index.js +158 -0
- package/schematics/eject/schema.js +8 -0
- package/schematics/eject/schema.json +24 -0
- package/schematics/eject/source.js +295 -0
- package/schematics/use/rule.js +2 -0
- package/schematics/use/symbol-map.json +5 -0
- package/select/styles/_index.scss +127 -22
- package/skills/ngwr/SKILL.md +31 -4
- package/skills/ngwr/references/catalog.md +9 -1
- package/slider/styles/_index.scss +22 -0
- package/table/styles/_index.scss +191 -3
- package/textarea/styles/_index.scss +80 -0
- package/theme/styles/_focus.scss +16 -1
- package/theme/styles/_motion.scss +5 -0
- package/transfer/styles/_index.scss +84 -0
- package/tree/styles/_index.scss +138 -5
- package/types/ngwr-alert-testing.d.ts +88 -0
- package/types/ngwr-badge.d.ts +72 -2
- package/types/ngwr-breadcrumbs-testing.d.ts +92 -0
- package/types/ngwr-burger-testing.d.ts +51 -0
- package/types/ngwr-calendar-testing.d.ts +18 -6
- package/types/ngwr-calendar.d.ts +272 -22
- package/types/ngwr-carousel-testing.d.ts +27 -6
- package/types/ngwr-carousel.d.ts +42 -6
- package/types/ngwr-cascader.d.ts +13 -6
- package/types/ngwr-charts-chart-legend.d.ts +9 -4
- package/types/ngwr-charts-line-chart-testing.d.ts +4 -1
- package/types/ngwr-charts-line-chart.d.ts +7 -4
- package/types/ngwr-color-picker-testing.d.ts +15 -4
- package/types/ngwr-color-picker.d.ts +76 -6
- package/types/ngwr-compare-testing.d.ts +72 -0
- package/types/ngwr-context-menu.d.ts +2 -0
- package/types/ngwr-date-picker-testing.d.ts +23 -8
- package/types/ngwr-date-picker.d.ts +100 -9
- package/types/ngwr-date.d.ts +71 -1
- package/types/ngwr-drawer.d.ts +9 -0
- package/types/ngwr-dropdown-testing.d.ts +20 -0
- package/types/ngwr-dropdown.d.ts +26 -6
- package/types/ngwr-event-calendar.d.ts +66 -8
- package/types/ngwr-file-upload-testing.d.ts +31 -2
- package/types/ngwr-file-upload.d.ts +156 -3
- package/types/ngwr-form.d.ts +47 -3
- package/types/ngwr-graph-testing.d.ts +36 -3
- package/types/ngwr-graph.d.ts +309 -13
- package/types/ngwr-input-number-testing.d.ts +10 -0
- package/types/ngwr-input-number.d.ts +30 -1
- package/types/ngwr-input-otp.d.ts +10 -0
- package/types/ngwr-input-testing.d.ts +30 -0
- package/types/ngwr-input.d.ts +54 -3
- package/types/ngwr-overlay.d.ts +84 -5
- package/types/ngwr-pipes.d.ts +2 -1
- package/types/ngwr-popconfirm-testing.d.ts +12 -3
- package/types/ngwr-popconfirm.d.ts +28 -3
- package/types/ngwr-popover-testing.d.ts +19 -2
- package/types/ngwr-popover.d.ts +22 -2
- package/types/ngwr-progress.d.ts +29 -1
- package/types/ngwr-pull-to-refresh-testing.d.ts +83 -0
- package/types/ngwr-resizable-testing.d.ts +116 -0
- package/types/ngwr-schema-form-testing.d.ts +260 -0
- package/types/ngwr-schema-form.d.ts +76 -6
- package/types/ngwr-select-testing.d.ts +20 -0
- package/types/ngwr-select.d.ts +149 -11
- package/types/ngwr-sidebar-testing.d.ts +176 -0
- package/types/ngwr-slider-testing.d.ts +3 -1
- package/types/ngwr-slider.d.ts +21 -1
- package/types/ngwr-sortable-list.d.ts +6 -0
- package/types/ngwr-stepper.d.ts +20 -11
- package/types/ngwr-table-testing.d.ts +122 -7
- package/types/ngwr-table.d.ts +572 -50
- package/types/ngwr-tabs-testing.d.ts +14 -17
- package/types/ngwr-tabs.d.ts +6 -0
- package/types/ngwr-textarea-testing.d.ts +10 -0
- package/types/ngwr-textarea.d.ts +48 -2
- package/types/ngwr-toast.d.ts +8 -1
- package/types/ngwr-tour-testing.d.ts +10 -0
- package/types/ngwr-tour.d.ts +11 -2
- package/types/ngwr-transfer-testing.d.ts +3 -0
- package/types/ngwr-transfer.d.ts +24 -1
- package/types/ngwr-tree-testing.d.ts +65 -1
- package/types/ngwr-tree.d.ts +335 -12
- package/types/ngwr-utils.d.ts +107 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window.d.ts +7 -4
package/fesm2022/ngwr-tree.mjs
CHANGED
|
@@ -1,26 +1,58 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Component, DestroyRef, ElementRef, Injector, PLATFORM_ID, TemplateRef, ViewContainerRef, ViewEncapsulation, afterNextRender, computed, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, ElementRef, Injector, PLATFORM_ID, PendingTasks, TemplateRef, ViewContainerRef, ViewEncapsulation, afterNextRender, computed, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
|
|
5
|
-
import { wrCheckStyles, wrToClassList } from "ngwr/utils";
|
|
5
|
+
import { WR_LIVE_LOCALE, wrCheckStyles, wrToClassList, wrTypeahead } from "ngwr/utils";
|
|
6
6
|
import { useI18nFormatter, useI18nText, wrReadI18nText } from "ngwr/i18n";
|
|
7
7
|
import { Directionality } from "@angular/cdk/bidi";
|
|
8
|
+
import { WrSpinner } from "ngwr/spinner";
|
|
9
|
+
import { useFormFieldAria } from "ngwr/form";
|
|
8
10
|
import { ScrollStrategyOptions } from "@angular/cdk/overlay";
|
|
9
11
|
import { TemplatePortal } from "@angular/cdk/portal";
|
|
10
12
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
11
|
-
import { useFormFieldAria } from "ngwr/form";
|
|
12
13
|
import { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from "ngwr/overlay";
|
|
14
|
+
import { finalize, from, isObservable, take } from "rxjs";
|
|
15
|
+
import { WrEmpty } from "ngwr/empty";
|
|
16
|
+
import { WrMark } from "ngwr/pipes";
|
|
13
17
|
/**
|
|
14
18
|
* @license
|
|
15
19
|
*
|
|
16
20
|
* Use of this source code is governed by an MIT-style license that can be
|
|
17
21
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
18
22
|
*/
|
|
23
|
+
const NO_NODES = [];
|
|
24
|
+
const MOVE_KEYS = /* @__PURE__ */ new Set([
|
|
25
|
+
"Escape",
|
|
26
|
+
"Enter",
|
|
27
|
+
" ",
|
|
28
|
+
"ArrowUp",
|
|
29
|
+
"ArrowDown",
|
|
30
|
+
"ArrowLeft",
|
|
31
|
+
"ArrowRight",
|
|
32
|
+
"Home",
|
|
33
|
+
"End"
|
|
34
|
+
]);
|
|
35
|
+
const HOVER_EXPAND_MS = 700;
|
|
36
|
+
function isLazy(node) {
|
|
37
|
+
return node.children === void 0 && node.hasChildren === true;
|
|
38
|
+
}
|
|
39
|
+
function childrenOf(node, lazy) {
|
|
40
|
+
if (node.children) return node.children;
|
|
41
|
+
const entry = lazy.get(node.id);
|
|
42
|
+
return entry?.status === "loaded" ? entry.children : NO_NODES;
|
|
43
|
+
}
|
|
44
|
+
function sameEnd(a, b) {
|
|
45
|
+
return a === b || !!a && !!b && a.parentId === b.parentId && a.index === b.index;
|
|
46
|
+
}
|
|
19
47
|
let panelUid = 0;
|
|
20
48
|
var WrTree = class WrTree {
|
|
21
49
|
nodes = input([], ...ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []);
|
|
22
50
|
selected = model([], ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
23
51
|
expanded = model([], ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
52
|
+
expandOnClick = input(true, {
|
|
53
|
+
...ngDevMode ? { debugName: "expandOnClick" } : /* istanbul ignore next */ {},
|
|
54
|
+
transform: coerceBooleanProperty
|
|
55
|
+
});
|
|
24
56
|
selectionMode = input("single", ...ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []);
|
|
25
57
|
disabled = input(false, {
|
|
26
58
|
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
@@ -69,6 +101,19 @@ var WrTree = class WrTree {
|
|
|
69
101
|
transform: (v) => Math.max(0, coerceNumberProperty(v, 6))
|
|
70
102
|
});
|
|
71
103
|
panelClass = input(null, ...ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []);
|
|
104
|
+
loadChildren = input(null, ...ngDevMode ? [{ debugName: "loadChildren" }] : /* istanbul ignore next */ []);
|
|
105
|
+
filter = input("", ...ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []);
|
|
106
|
+
filterFn = input(null, ...ngDevMode ? [{ debugName: "filterFn" }] : /* istanbul ignore next */ []);
|
|
107
|
+
cascade = input(false, {
|
|
108
|
+
...ngDevMode ? { debugName: "cascade" } : /* istanbul ignore next */ {},
|
|
109
|
+
transform: coerceBooleanProperty
|
|
110
|
+
});
|
|
111
|
+
draggable = input(false, {
|
|
112
|
+
...ngDevMode ? { debugName: "draggable" } : /* istanbul ignore next */ {},
|
|
113
|
+
transform: coerceBooleanProperty
|
|
114
|
+
});
|
|
115
|
+
canDrop = input(null, ...ngDevMode ? [{ debugName: "canDrop" }] : /* istanbul ignore next */ []);
|
|
116
|
+
nodeMove = output();
|
|
72
117
|
value = model(void 0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
73
118
|
touch = output();
|
|
74
119
|
opened = output();
|
|
@@ -81,71 +126,199 @@ var WrTree = class WrTree {
|
|
|
81
126
|
destroyRef = inject(DestroyRef);
|
|
82
127
|
platformId = inject(PLATFORM_ID);
|
|
83
128
|
injector = inject(Injector);
|
|
129
|
+
pendingTasks = inject(PendingTasks);
|
|
84
130
|
dir = inject(Directionality, { optional: true });
|
|
131
|
+
liveLocale = inject(WR_LIVE_LOCALE, { optional: true });
|
|
132
|
+
typeahead = wrTypeahead({ locale: () => this.liveLocale?.() });
|
|
85
133
|
focusedIndex = signal(0, ...ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []);
|
|
86
134
|
cursorId = signal(null, ...ngDevMode ? [{ debugName: "cursorId" }] : /* istanbul ignore next */ []);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const
|
|
135
|
+
lazy = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "lazy" }] : /* istanbul ignore next */ []);
|
|
136
|
+
lookup = computed(() => {
|
|
137
|
+
const lazy = this.lazy();
|
|
138
|
+
const byId = /* @__PURE__ */ new Map();
|
|
139
|
+
const parents = /* @__PURE__ */ new Map();
|
|
140
|
+
const cached = /* @__PURE__ */ new Set();
|
|
141
|
+
const walk = (list, parent, inCache) => {
|
|
90
142
|
for (const n of list) {
|
|
91
|
-
|
|
92
|
-
if (
|
|
143
|
+
byId.set(n.id, n);
|
|
144
|
+
if (parent !== null) parents.set(n.id, parent.id);
|
|
145
|
+
if (inCache) cached.add(n.id);
|
|
146
|
+
const children = childrenOf(n, lazy);
|
|
147
|
+
if (children.length) walk(children, n, inCache || !n.children);
|
|
93
148
|
}
|
|
94
149
|
};
|
|
95
|
-
walk(this.nodes(), null);
|
|
96
|
-
return
|
|
97
|
-
|
|
150
|
+
walk(this.nodes(), null, false);
|
|
151
|
+
return {
|
|
152
|
+
byId,
|
|
153
|
+
parents,
|
|
154
|
+
cached
|
|
155
|
+
};
|
|
156
|
+
}, ...ngDevMode ? [{ debugName: "lookup" }] : /* istanbul ignore next */ []);
|
|
157
|
+
parentMap = computed(() => this.lookup().parents, ...ngDevMode ? [{ debugName: "parentMap" }] : /* istanbul ignore next */ []);
|
|
98
158
|
cursorIndex = computed(() => {
|
|
99
|
-
const flat = this.flat();
|
|
100
159
|
const cursor = this.cursorId();
|
|
101
160
|
if (cursor) {
|
|
161
|
+
const rows = this.flatIndex();
|
|
102
162
|
const parents = this.parentMap();
|
|
103
163
|
for (let id = cursor.id; id !== void 0; id = parents.get(id)) {
|
|
104
|
-
const at =
|
|
105
|
-
if (at !==
|
|
164
|
+
const at = rows.get(id);
|
|
165
|
+
if (at !== void 0) return at;
|
|
106
166
|
}
|
|
107
167
|
}
|
|
108
|
-
return Math.min(this.focusedIndex(), Math.max(0, flat.length - 1));
|
|
168
|
+
return Math.min(this.focusedIndex(), Math.max(0, this.flat().length - 1));
|
|
109
169
|
}, ...ngDevMode ? [{ debugName: "cursorIndex" }] : /* istanbul ignore next */ []);
|
|
110
|
-
|
|
111
|
-
expandLabel =
|
|
112
|
-
collapseLabel =
|
|
170
|
+
clearSelectionLabel = input(null, ...ngDevMode ? [{ debugName: "clearSelectionLabel" }] : /* istanbul ignore next */ []);
|
|
171
|
+
expandLabel = input(null, ...ngDevMode ? [{ debugName: "expandLabel" }] : /* istanbul ignore next */ []);
|
|
172
|
+
collapseLabel = input(null, ...ngDevMode ? [{ debugName: "collapseLabel" }] : /* istanbul ignore next */ []);
|
|
173
|
+
loadingLabel = input(null, ...ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []);
|
|
174
|
+
loadErrorLabel = input(null, ...ngDevMode ? [{ debugName: "loadErrorLabel" }] : /* istanbul ignore next */ []);
|
|
175
|
+
retryLabel = input(null, ...ngDevMode ? [{ debugName: "retryLabel" }] : /* istanbul ignore next */ []);
|
|
176
|
+
noMatchesLabel = input(null, ...ngDevMode ? [{ debugName: "noMatchesLabel" }] : /* istanbul ignore next */ []);
|
|
177
|
+
moveHelpLabel = input(null, ...ngDevMode ? [{ debugName: "moveHelpLabel" }] : /* istanbul ignore next */ []);
|
|
178
|
+
resolvedLoadingLabel = useI18nText(this.loadingLabel, "select.loading", "Loading…");
|
|
179
|
+
resolvedLoadErrorLabel = useI18nText(this.loadErrorLabel, "loadState.failed", "Could not load");
|
|
180
|
+
resolvedNoMatchesLabel = useI18nText(this.noMatchesLabel, "select.noResults", "No results");
|
|
181
|
+
resolvedRetryLabel = useI18nText(this.retryLabel, "loadState.retry", "Try again");
|
|
182
|
+
resolvedMoveHelp = useI18nText(this.moveHelpLabel, "tree.moveKeyHelp", "Press Alt+Enter to pick this item up, then use the arrow keys to move it. Press Enter to drop it, or Escape to put it back.");
|
|
183
|
+
grabbedText = useI18nFormatter("sortableList.grabbed", "Grabbed. {{index}} of {{total}}.");
|
|
184
|
+
movedText = useI18nFormatter("sortableList.moved", "{{index}} of {{total}}.");
|
|
185
|
+
droppedText = useI18nFormatter("sortableList.dropped", "Dropped. {{index}} of {{total}}.");
|
|
186
|
+
cancelledText = wrReadI18nText("sortableList.cancelled", "Move cancelled.");
|
|
187
|
+
resolvedClearSelectionLabel = useI18nText(this.clearSelectionLabel, "tree.clearSelection", "Clear selection");
|
|
188
|
+
resolvedExpandLabel = useI18nText(this.expandLabel, "tree.expand", "Expand");
|
|
189
|
+
resolvedCollapseLabel = useI18nText(this.collapseLabel, "tree.collapse", "Collapse");
|
|
113
190
|
chipRemoveLabel = useI18nFormatter("tree.removeItem", "Remove {{label}}");
|
|
114
191
|
chipMoreLabel = useI18nFormatter("tree.more", "+{{count}} more");
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
192
|
+
filterQuery = computed(() => (this.filter() ?? "").trim(), ...ngDevMode ? [{ debugName: "filterQuery" }] : /* istanbul ignore next */ []);
|
|
193
|
+
filterView = computed(() => {
|
|
194
|
+
const query = this.filterQuery();
|
|
195
|
+
if (!query) return null;
|
|
196
|
+
const lazy = this.lazy();
|
|
197
|
+
const custom = this.filterFn();
|
|
198
|
+
const needle = query.toLowerCase();
|
|
199
|
+
const matches = (node) => custom ? custom(node, query) : node.label.toLowerCase().includes(needle);
|
|
200
|
+
const visible = /* @__PURE__ */ new Set();
|
|
201
|
+
const opened = /* @__PURE__ */ new Set();
|
|
202
|
+
const walk = (list) => {
|
|
203
|
+
let any = false;
|
|
204
|
+
for (const node of list) {
|
|
205
|
+
const below = walk(childrenOf(node, lazy));
|
|
206
|
+
if (below) opened.add(node.id);
|
|
207
|
+
if (below || matches(node)) {
|
|
208
|
+
visible.add(node.id);
|
|
209
|
+
any = true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return any;
|
|
213
|
+
};
|
|
214
|
+
walk(this.nodes());
|
|
215
|
+
return {
|
|
216
|
+
visible,
|
|
217
|
+
opened
|
|
218
|
+
};
|
|
219
|
+
}, ...ngDevMode ? [{ debugName: "filterView" }] : /* istanbul ignore next */ []);
|
|
220
|
+
filterToggles = signal({
|
|
221
|
+
query: "",
|
|
222
|
+
open: /* @__PURE__ */ new Map()
|
|
223
|
+
}, ...ngDevMode ? [{ debugName: "filterToggles" }] : /* istanbul ignore next */ []);
|
|
224
|
+
statusKeys = /* @__PURE__ */ new Map();
|
|
225
|
+
view = computed(() => {
|
|
226
|
+
const expanded = this.expandedSet();
|
|
227
|
+
const lazy = this.lazy();
|
|
228
|
+
const visible = this.filterView()?.visible ?? null;
|
|
229
|
+
const canLoad = this.loadChildren() !== null;
|
|
230
|
+
const rows = [];
|
|
231
|
+
const toLoad = [];
|
|
118
232
|
const walk = (list, depth) => {
|
|
119
|
-
list.
|
|
120
|
-
|
|
121
|
-
|
|
233
|
+
const shown = visible ? list.filter((n) => visible.has(n.id)) : list;
|
|
234
|
+
shown.forEach((node, i) => {
|
|
235
|
+
const state = lazy.get(node.id)?.status;
|
|
236
|
+
const unloaded = isLazy(node) && state !== "loaded";
|
|
237
|
+
const children = childrenOf(node, lazy);
|
|
238
|
+
const hasChildren = unloaded || (visible ? children.some((c) => visible.has(c.id)) : children.length > 0);
|
|
239
|
+
rows.push({
|
|
122
240
|
node,
|
|
123
241
|
depth,
|
|
124
242
|
hasChildren,
|
|
125
|
-
index:
|
|
243
|
+
index: rows.length,
|
|
126
244
|
posinset: i + 1,
|
|
127
|
-
setsize:
|
|
245
|
+
setsize: shown.length,
|
|
246
|
+
key: node.id,
|
|
247
|
+
status: null,
|
|
248
|
+
busy: state === "loading"
|
|
249
|
+
});
|
|
250
|
+
if (!hasChildren || !expanded.has(node.id)) return;
|
|
251
|
+
if (!unloaded) {
|
|
252
|
+
walk(children, depth + 1);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const status = state === "error" ? "error" : canLoad ? "loading" : null;
|
|
256
|
+
if (!status) return;
|
|
257
|
+
if (!state) toLoad.push(node);
|
|
258
|
+
let key = this.statusKeys.get(node.id);
|
|
259
|
+
if (!key) this.statusKeys.set(node.id, key = {});
|
|
260
|
+
rows.push({
|
|
261
|
+
node,
|
|
262
|
+
depth: depth + 1,
|
|
263
|
+
hasChildren: false,
|
|
264
|
+
index: rows.length,
|
|
265
|
+
posinset: 1,
|
|
266
|
+
setsize: 1,
|
|
267
|
+
key,
|
|
268
|
+
status,
|
|
269
|
+
busy: false
|
|
128
270
|
});
|
|
129
|
-
if (hasChildren && expanded.has(node.id)) walk(node.children, depth + 1);
|
|
130
271
|
});
|
|
131
272
|
};
|
|
132
273
|
walk(this.nodes(), 0);
|
|
133
|
-
return
|
|
134
|
-
|
|
274
|
+
return {
|
|
275
|
+
rows,
|
|
276
|
+
toLoad
|
|
277
|
+
};
|
|
278
|
+
}, ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
279
|
+
flat = computed(() => this.view().rows, ...ngDevMode ? [{ debugName: "flat" }] : /* istanbul ignore next */ []);
|
|
280
|
+
flatIndex = computed(() => {
|
|
281
|
+
const map = /* @__PURE__ */ new Map();
|
|
282
|
+
for (const row of this.flat()) if (!row.status && !map.has(row.node.id)) map.set(row.node.id, row.index);
|
|
283
|
+
return map;
|
|
284
|
+
}, ...ngDevMode ? [{ debugName: "flatIndex" }] : /* istanbul ignore next */ []);
|
|
135
285
|
selectedSet = computed(() => new Set(this.selected()), ...ngDevMode ? [{ debugName: "selectedSet" }] : /* istanbul ignore next */ []);
|
|
136
|
-
expandedSet = computed(() =>
|
|
286
|
+
expandedSet = computed(() => {
|
|
287
|
+
const set = new Set(this.expanded());
|
|
288
|
+
const view = this.filterView();
|
|
289
|
+
if (!view) return set;
|
|
290
|
+
for (const id of view.opened) set.add(id);
|
|
291
|
+
const toggles = this.filterToggles();
|
|
292
|
+
if (toggles.query !== this.filterQuery()) return set;
|
|
293
|
+
for (const [id, open] of toggles.open) if (open) set.add(id);
|
|
294
|
+
else set.delete(id);
|
|
295
|
+
return set;
|
|
296
|
+
}, ...ngDevMode ? [{ debugName: "expandedSet" }] : /* istanbul ignore next */ []);
|
|
297
|
+
isCascade = computed(() => this.cascade() && this.selectionMode() === "multi", ...ngDevMode ? [{ debugName: "isCascade" }] : /* istanbul ignore next */ []);
|
|
298
|
+
mixedSet = computed(() => {
|
|
299
|
+
const mixed = /* @__PURE__ */ new Set();
|
|
300
|
+
if (!this.isCascade()) return mixed;
|
|
301
|
+
const selected = this.selectedSet();
|
|
302
|
+
const lazy = this.lazy();
|
|
303
|
+
const walk = (list) => {
|
|
304
|
+
let any = false;
|
|
305
|
+
for (const node of list) {
|
|
306
|
+
const below = walk(childrenOf(node, lazy));
|
|
307
|
+
const own = selected.has(node.id);
|
|
308
|
+
if (below && !own) mixed.add(node.id);
|
|
309
|
+
if (below || own) any = true;
|
|
310
|
+
}
|
|
311
|
+
return any;
|
|
312
|
+
};
|
|
313
|
+
walk(this.nodes());
|
|
314
|
+
return mixed;
|
|
315
|
+
}, ...ngDevMode ? [{ debugName: "mixedSet" }] : /* istanbul ignore next */ []);
|
|
137
316
|
isOverlay = computed(() => this.openOn() === "overlay", ...ngDevMode ? [{ debugName: "isOverlay" }] : /* istanbul ignore next */ []);
|
|
138
317
|
isMulti = computed(() => this.selectionMode() === "multi", ...ngDevMode ? [{ debugName: "isMulti" }] : /* istanbul ignore next */ []);
|
|
139
318
|
hasSelection = computed(() => this.selected().length > 0, ...ngDevMode ? [{ debugName: "hasSelection" }] : /* istanbul ignore next */ []);
|
|
140
319
|
labelMap = computed(() => {
|
|
141
320
|
const map = /* @__PURE__ */ new Map();
|
|
142
|
-
const
|
|
143
|
-
for (const n of list) {
|
|
144
|
-
map.set(n.id, n.label);
|
|
145
|
-
if (n.children?.length) walk(n.children);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
walk(this.nodes());
|
|
321
|
+
for (const [id, node] of this.lookup().byId) map.set(id, node.label);
|
|
149
322
|
return map;
|
|
150
323
|
}, ...ngDevMode ? [{ debugName: "labelMap" }] : /* istanbul ignore next */ []);
|
|
151
324
|
selectedChips = computed(() => {
|
|
@@ -171,7 +344,8 @@ var WrTree = class WrTree {
|
|
|
171
344
|
if (first == null) return null;
|
|
172
345
|
return this.labelMap().get(first) ?? null;
|
|
173
346
|
}, ...ngDevMode ? [{ debugName: "singleLabel" }] : /* istanbul ignore next */ []);
|
|
174
|
-
|
|
347
|
+
openState = signal(false, ...ngDevMode ? [{ debugName: "openState" }] : /* istanbul ignore next */ []);
|
|
348
|
+
isOpen = this.openState.asReadonly();
|
|
175
349
|
panelId = `wr-tree-panel-${++panelUid}`;
|
|
176
350
|
classes = computed(() => {
|
|
177
351
|
const parts = [];
|
|
@@ -278,7 +452,7 @@ var WrTree = class WrTree {
|
|
|
278
452
|
}
|
|
279
453
|
});
|
|
280
454
|
effect(() => {
|
|
281
|
-
if (this.disabled() || this.readonly()) this.
|
|
455
|
+
if (this.disabled() || this.readonly()) this.openState.set(false);
|
|
282
456
|
});
|
|
283
457
|
effect(() => {
|
|
284
458
|
const value = this.value();
|
|
@@ -331,15 +505,33 @@ var WrTree = class WrTree {
|
|
|
331
505
|
ro?.disconnect();
|
|
332
506
|
});
|
|
333
507
|
});
|
|
334
|
-
|
|
508
|
+
effect(() => {
|
|
509
|
+
if (!isPlatformBrowser(this.platformId)) return;
|
|
510
|
+
const pending = this.view().toLoad;
|
|
511
|
+
if (pending.length) untracked(() => pending.forEach((node) => this.load(node)));
|
|
512
|
+
});
|
|
513
|
+
this.destroyRef.onDestroy(() => {
|
|
514
|
+
this.clearHoverExpand();
|
|
515
|
+
this.closeOverlay(false);
|
|
516
|
+
});
|
|
335
517
|
}
|
|
336
518
|
onRowClick(flat, event) {
|
|
337
519
|
if (this.disabled() || flat.node.disabled) return;
|
|
520
|
+
if (flat.status) {
|
|
521
|
+
this.focusIndex(flat.index);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
338
524
|
if (flat.hasChildren && event.target.closest(".wr-tree__toggle")) {
|
|
339
525
|
this.toggleExpanded(flat.node.id);
|
|
340
526
|
return;
|
|
341
527
|
}
|
|
342
528
|
this.focusIndex(flat.index);
|
|
529
|
+
if (flat.hasChildren && this.expandOnClick()) {
|
|
530
|
+
if (!(this.isCascade() && !!event.target.closest(".wr-tree__check"))) {
|
|
531
|
+
this.toggleExpanded(flat.node.id);
|
|
532
|
+
if (this.isCascade()) return;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
343
535
|
this.select(flat.node.id, event.ctrlKey || event.metaKey);
|
|
344
536
|
}
|
|
345
537
|
onToggleClick(node, event) {
|
|
@@ -359,6 +551,24 @@ var WrTree = class WrTree {
|
|
|
359
551
|
const i = this.cursorIndex();
|
|
360
552
|
const current = flat[i];
|
|
361
553
|
if (!current) return;
|
|
554
|
+
if (this.move()?.keyboard) {
|
|
555
|
+
this.onMoveKey(event);
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
if (this.draggable() && event.altKey && event.key === "Enter") {
|
|
559
|
+
event.preventDefault();
|
|
560
|
+
if (this.canDrag(current)) this.grab(current);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (this.typeahead.type(event)) {
|
|
564
|
+
event.preventDefault();
|
|
565
|
+
const match = this.typeahead.find(flat.map((row) => ({
|
|
566
|
+
label: row.node.label,
|
|
567
|
+
disabled: row.status !== null
|
|
568
|
+
})), i);
|
|
569
|
+
if (match >= 0) this.focusIndex(match);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
362
572
|
switch (this.inlineKey(event.key)) {
|
|
363
573
|
case "ArrowDown":
|
|
364
574
|
event.preventDefault();
|
|
@@ -394,7 +604,9 @@ var WrTree = class WrTree {
|
|
|
394
604
|
case "Enter":
|
|
395
605
|
case " ":
|
|
396
606
|
event.preventDefault();
|
|
397
|
-
if (
|
|
607
|
+
if (current.status) {
|
|
608
|
+
if (current.status === "error") this.retryLoad(current.node);
|
|
609
|
+
} else if (!current.node.disabled) this.select(current.node.id, event.ctrlKey || event.metaKey);
|
|
398
610
|
}
|
|
399
611
|
}
|
|
400
612
|
focus(options) {
|
|
@@ -407,14 +619,14 @@ var WrTree = class WrTree {
|
|
|
407
619
|
}
|
|
408
620
|
open() {
|
|
409
621
|
if (!this.isOverlay() || this.disabled() || this.readonly()) return;
|
|
410
|
-
this.
|
|
622
|
+
this.openState.set(true);
|
|
411
623
|
}
|
|
412
624
|
close() {
|
|
413
|
-
this.
|
|
625
|
+
this.openState.set(false);
|
|
414
626
|
}
|
|
415
627
|
onTriggerClick() {
|
|
416
628
|
if (this.disabled() || this.readonly()) return;
|
|
417
|
-
this.
|
|
629
|
+
this.openState.update((v) => !v);
|
|
418
630
|
}
|
|
419
631
|
onFocusOut(event) {
|
|
420
632
|
const next = event.relatedTarget;
|
|
@@ -428,7 +640,7 @@ var WrTree = class WrTree {
|
|
|
428
640
|
if ((event.key === "ArrowDown" || event.key === "ArrowUp") && !this.isOpen()) {
|
|
429
641
|
if (this.disabled() || this.readonly()) return;
|
|
430
642
|
event.preventDefault();
|
|
431
|
-
this.
|
|
643
|
+
this.openState.set(true);
|
|
432
644
|
return;
|
|
433
645
|
}
|
|
434
646
|
if (event.key !== "Backspace") return;
|
|
@@ -448,8 +660,8 @@ var WrTree = class WrTree {
|
|
|
448
660
|
removeChip(id, event) {
|
|
449
661
|
event.stopPropagation();
|
|
450
662
|
if (this.disabled() || this.readonly()) return;
|
|
451
|
-
|
|
452
|
-
this.selected.set(
|
|
663
|
+
if (this.isCascade()) this.setChecked(id, false);
|
|
664
|
+
else this.selected.set(this.selected().filter((x) => x !== id));
|
|
453
665
|
this.emit();
|
|
454
666
|
}
|
|
455
667
|
clearSelection(event) {
|
|
@@ -459,20 +671,32 @@ var WrTree = class WrTree {
|
|
|
459
671
|
this.emit();
|
|
460
672
|
}
|
|
461
673
|
toggleExpanded(id) {
|
|
462
|
-
const
|
|
463
|
-
const
|
|
464
|
-
if (
|
|
465
|
-
|
|
466
|
-
|
|
674
|
+
const collapsing = this.expandedSet().has(id);
|
|
675
|
+
const query = this.filterQuery();
|
|
676
|
+
if (query) {
|
|
677
|
+
const toggles = this.filterToggles();
|
|
678
|
+
const open = new Map(toggles.query === query ? toggles.open : []);
|
|
679
|
+
open.set(id, !collapsing);
|
|
680
|
+
this.filterToggles.set({
|
|
681
|
+
query,
|
|
682
|
+
open
|
|
683
|
+
});
|
|
684
|
+
} else {
|
|
685
|
+
const set = new Set(this.expanded());
|
|
686
|
+
if (collapsing) set.delete(id);
|
|
687
|
+
else set.add(id);
|
|
688
|
+
this.expanded.set([...set]);
|
|
689
|
+
}
|
|
467
690
|
if (!collapsing) return;
|
|
468
691
|
const row = this.flat()[this.cursorIndex()];
|
|
469
|
-
if (row) this.cursorId.set({ id: row.node.id });
|
|
692
|
+
if (row && !row.status) this.cursorId.set({ id: row.node.id });
|
|
470
693
|
}
|
|
471
694
|
select(id, additive) {
|
|
472
695
|
if (this.readonly()) return;
|
|
473
696
|
const mode = this.selectionMode();
|
|
474
697
|
if (mode === "none") return;
|
|
475
698
|
if (mode === "single") this.selected.set([id]);
|
|
699
|
+
else if (this.isCascade()) this.setChecked(id, !this.selectedSet().has(id));
|
|
476
700
|
else {
|
|
477
701
|
const set = new Set(this.selected());
|
|
478
702
|
if (additive) {
|
|
@@ -486,17 +710,377 @@ var WrTree = class WrTree {
|
|
|
486
710
|
this.selected.set([...set]);
|
|
487
711
|
}
|
|
488
712
|
this.emit();
|
|
489
|
-
if (this.isOverlay() && mode === "single" && this.selected().length > 0) this.
|
|
713
|
+
if (this.isOverlay() && mode === "single" && this.selected().length > 0) this.openState.set(false);
|
|
490
714
|
}
|
|
491
715
|
emit() {
|
|
492
716
|
this.touch.emit();
|
|
717
|
+
this.writeValue();
|
|
718
|
+
}
|
|
719
|
+
writeValue() {
|
|
493
720
|
if (this.isMulti()) this.value.set(this.selected());
|
|
494
721
|
else this.value.set(this.selected()[0] ?? null);
|
|
495
722
|
}
|
|
723
|
+
setChecked(id, checked) {
|
|
724
|
+
const { byId, parents } = this.lookup();
|
|
725
|
+
const lazy = this.lazy();
|
|
726
|
+
const set = new Set(this.selected());
|
|
727
|
+
const apply = (node) => {
|
|
728
|
+
if (node.disabled) return;
|
|
729
|
+
if (checked) set.add(node.id);
|
|
730
|
+
else set.delete(node.id);
|
|
731
|
+
for (const child of childrenOf(node, lazy)) apply(child);
|
|
732
|
+
};
|
|
733
|
+
const node = byId.get(id);
|
|
734
|
+
if (node) apply(node);
|
|
735
|
+
else set.delete(id);
|
|
736
|
+
for (let up = parents.get(id); up !== void 0; up = parents.get(up)) {
|
|
737
|
+
const parent = byId.get(up);
|
|
738
|
+
if (!parent || parent.disabled) continue;
|
|
739
|
+
const children = childrenOf(parent, lazy).filter((child) => !child.disabled);
|
|
740
|
+
if (!children.length) continue;
|
|
741
|
+
if (children.every((child) => set.has(child.id))) set.add(up);
|
|
742
|
+
else set.delete(up);
|
|
743
|
+
}
|
|
744
|
+
this.selected.set([...set]);
|
|
745
|
+
}
|
|
746
|
+
load(node) {
|
|
747
|
+
const loader = this.loadChildren();
|
|
748
|
+
if (!loader) return;
|
|
749
|
+
const id = node.id;
|
|
750
|
+
const settle = (entry) => {
|
|
751
|
+
const cursor = this.flat()[this.cursorIndex()];
|
|
752
|
+
const active = this.host.nativeElement.ownerDocument.activeElement;
|
|
753
|
+
const held = !!cursor?.status && cursor.node.id === id && !!this.listElement?.contains(active);
|
|
754
|
+
this.lazy.update((map) => new Map(map).set(id, entry));
|
|
755
|
+
if (held && entry.status !== "loading") this.refocusCursor();
|
|
756
|
+
};
|
|
757
|
+
settle({ status: "loading" });
|
|
758
|
+
const done = this.pendingTasks.add();
|
|
759
|
+
let answer;
|
|
760
|
+
try {
|
|
761
|
+
answer = loader(node);
|
|
762
|
+
} catch {
|
|
763
|
+
settle({ status: "error" });
|
|
764
|
+
done();
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
(isObservable(answer) ? answer : from(Promise.resolve(answer))).pipe(take(1), takeUntilDestroyed(this.destroyRef), finalize(done)).subscribe({
|
|
768
|
+
next: (children) => {
|
|
769
|
+
settle({
|
|
770
|
+
status: "loaded",
|
|
771
|
+
children
|
|
772
|
+
});
|
|
773
|
+
if (this.isCascade() && this.selectedSet().has(id)) {
|
|
774
|
+
this.setChecked(id, true);
|
|
775
|
+
this.writeValue();
|
|
776
|
+
}
|
|
777
|
+
},
|
|
778
|
+
error: () => settle({ status: "error" }),
|
|
779
|
+
complete: () => {
|
|
780
|
+
if (this.lazy().get(id)?.status === "loading") settle({
|
|
781
|
+
status: "loaded",
|
|
782
|
+
children: []
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
retryLoad(node, event) {
|
|
788
|
+
event?.stopPropagation();
|
|
789
|
+
if (this.disabled()) return;
|
|
790
|
+
this.load(node);
|
|
791
|
+
}
|
|
792
|
+
move = signal(null, ...ngDevMode ? [{ debugName: "move" }] : /* istanbul ignore next */ []);
|
|
793
|
+
movingNode = computed(() => this.move()?.node ?? null, ...ngDevMode ? [{ debugName: "movingNode" }] : /* istanbul ignore next */ []);
|
|
794
|
+
announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
|
|
795
|
+
moveHelpId = `${this.panelId}-move-help`;
|
|
796
|
+
listDescribedBy = computed(() => {
|
|
797
|
+
return [this.isOverlay() ? null : this.fieldAria.describedBy(), this.draggable() ? this.moveHelpId : null].filter(Boolean).join(" ") || null;
|
|
798
|
+
}, ...ngDevMode ? [{ debugName: "listDescribedBy" }] : /* istanbul ignore next */ []);
|
|
799
|
+
hoverExpand = null;
|
|
800
|
+
movable = computed(() => this.draggable() && !this.disabled() && !this.filterQuery(), ...ngDevMode ? [{ debugName: "movable" }] : /* istanbul ignore next */ []);
|
|
801
|
+
canDrag(row) {
|
|
802
|
+
return this.movable() && !row.status && !row.node.disabled && !this.lookup().cached.has(row.node.id);
|
|
803
|
+
}
|
|
804
|
+
siblings(parentId, moving) {
|
|
805
|
+
return (parentId === null ? this.nodes() : this.lookup().byId.get(parentId)?.children ?? NO_NODES).filter((node) => node.id !== moving);
|
|
806
|
+
}
|
|
807
|
+
locate(node) {
|
|
808
|
+
const parentId = this.parentMap().get(node.id) ?? null;
|
|
809
|
+
return {
|
|
810
|
+
parentId,
|
|
811
|
+
index: (parentId === null ? this.nodes() : this.lookup().byId.get(parentId)?.children ?? NO_NODES).indexOf(node)
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
allows(node, target) {
|
|
815
|
+
const { byId, parents, cached } = this.lookup();
|
|
816
|
+
let parent = null;
|
|
817
|
+
if (target.parentId !== null) {
|
|
818
|
+
parent = byId.get(target.parentId) ?? null;
|
|
819
|
+
if (!parent || parent.disabled || isLazy(parent) || cached.has(parent.id)) return false;
|
|
820
|
+
for (let id = parent.id; id !== void 0; id = parents.get(id)) if (id === node.id) return false;
|
|
821
|
+
}
|
|
822
|
+
return this.canDrop()?.(node, {
|
|
823
|
+
...target,
|
|
824
|
+
parent
|
|
825
|
+
}) ?? true;
|
|
826
|
+
}
|
|
827
|
+
dropMark = computed(() => {
|
|
828
|
+
const move = this.move();
|
|
829
|
+
const target = move?.target;
|
|
830
|
+
if (!move || !target) return null;
|
|
831
|
+
const rows = this.flat();
|
|
832
|
+
const at = this.flatIndex();
|
|
833
|
+
const siblings = this.siblings(target.parentId, move.node.id);
|
|
834
|
+
let depth = 0;
|
|
835
|
+
if (target.parentId !== null) {
|
|
836
|
+
const parentRow = at.get(target.parentId);
|
|
837
|
+
if (parentRow === void 0) return null;
|
|
838
|
+
depth = rows[parentRow].depth + 1;
|
|
839
|
+
if (!siblings.length || !this.expandedSet().has(target.parentId)) return {
|
|
840
|
+
row: parentRow,
|
|
841
|
+
position: "inside",
|
|
842
|
+
depth
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
if (target.index < siblings.length) {
|
|
846
|
+
const row = at.get(siblings[target.index].id);
|
|
847
|
+
return row === void 0 ? null : {
|
|
848
|
+
row,
|
|
849
|
+
position: "before",
|
|
850
|
+
depth
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
const last = siblings[siblings.length - 1];
|
|
854
|
+
let row = last ? at.get(last.id) : void 0;
|
|
855
|
+
if (row === void 0) return null;
|
|
856
|
+
while (rows[row + 1] && rows[row + 1].depth > depth) row += 1;
|
|
857
|
+
return {
|
|
858
|
+
row,
|
|
859
|
+
position: "after",
|
|
860
|
+
depth
|
|
861
|
+
};
|
|
862
|
+
}, ...ngDevMode ? [{ debugName: "dropMark" }] : /* istanbul ignore next */ []);
|
|
863
|
+
rowOf(event) {
|
|
864
|
+
const target = event.target;
|
|
865
|
+
const el = (target instanceof Element ? target : target instanceof Node ? target.parentElement : null)?.closest("[data-tree-index]");
|
|
866
|
+
const row = el ? this.flat()[Number(el.getAttribute("data-tree-index"))] : void 0;
|
|
867
|
+
return el && row ? {
|
|
868
|
+
row,
|
|
869
|
+
el
|
|
870
|
+
} : null;
|
|
871
|
+
}
|
|
872
|
+
onDragStart(event) {
|
|
873
|
+
const hit = this.rowOf(event);
|
|
874
|
+
if (!hit || !this.canDrag(hit.row)) {
|
|
875
|
+
if (this.draggable()) event.preventDefault();
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const node = hit.row.node;
|
|
879
|
+
if (event.dataTransfer) {
|
|
880
|
+
event.dataTransfer.effectAllowed = "move";
|
|
881
|
+
event.dataTransfer.setData("text/plain", node.label);
|
|
882
|
+
}
|
|
883
|
+
this.announcement.set("");
|
|
884
|
+
this.move.set({
|
|
885
|
+
node,
|
|
886
|
+
from: this.locate(node),
|
|
887
|
+
keyboard: false,
|
|
888
|
+
target: null
|
|
889
|
+
});
|
|
890
|
+
hit.el.addEventListener("dragend", () => this.endDrag(), { once: true });
|
|
891
|
+
}
|
|
892
|
+
onDragOver(event) {
|
|
893
|
+
const move = this.move();
|
|
894
|
+
if (!move || move.keyboard) return;
|
|
895
|
+
const hit = this.rowOf(event);
|
|
896
|
+
const target = hit && !hit.row.status ? this.pointerTarget(move, hit.row, hit.el, event.clientY) : null;
|
|
897
|
+
if (hit && !hit.row.status) this.restOn(move, hit.row);
|
|
898
|
+
else this.clearHoverExpand();
|
|
899
|
+
if (target) {
|
|
900
|
+
event.preventDefault();
|
|
901
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
902
|
+
}
|
|
903
|
+
if (!sameEnd(move.target, target)) this.move.set({
|
|
904
|
+
...move,
|
|
905
|
+
target
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
onDragLeave(event) {
|
|
909
|
+
const move = this.move();
|
|
910
|
+
if (!move || move.keyboard) return;
|
|
911
|
+
const next = event.relatedTarget;
|
|
912
|
+
if (next instanceof Node && this.listElement?.contains(next)) return;
|
|
913
|
+
this.clearHoverExpand();
|
|
914
|
+
if (move.target) this.move.set({
|
|
915
|
+
...move,
|
|
916
|
+
target: null
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
onDrop(event) {
|
|
920
|
+
const move = this.move();
|
|
921
|
+
if (!move || move.keyboard) return;
|
|
922
|
+
event.preventDefault();
|
|
923
|
+
this.endDrag();
|
|
924
|
+
if (move.target) this.commit(move, move.target);
|
|
925
|
+
}
|
|
926
|
+
endDrag() {
|
|
927
|
+
this.clearHoverExpand();
|
|
928
|
+
if (this.move() && !this.move().keyboard) this.move.set(null);
|
|
929
|
+
}
|
|
930
|
+
pointerTarget(move, row, el, clientY) {
|
|
931
|
+
const { node } = move;
|
|
932
|
+
const over = row.node;
|
|
933
|
+
const rect = el.getBoundingClientRect();
|
|
934
|
+
const ratio = rect.height > 0 ? (clientY - rect.top) / rect.height : .5;
|
|
935
|
+
const parentId = this.parentMap().get(over.id) ?? null;
|
|
936
|
+
const index = this.siblings(parentId, node.id).indexOf(over);
|
|
937
|
+
const open = row.hasChildren && this.expandedSet().has(over.id);
|
|
938
|
+
const inside = {
|
|
939
|
+
parentId: over.id,
|
|
940
|
+
index: this.siblings(over.id, node.id).length
|
|
941
|
+
};
|
|
942
|
+
const before = {
|
|
943
|
+
parentId,
|
|
944
|
+
index
|
|
945
|
+
};
|
|
946
|
+
const after = open ? {
|
|
947
|
+
parentId: over.id,
|
|
948
|
+
index: 0
|
|
949
|
+
} : {
|
|
950
|
+
parentId,
|
|
951
|
+
index: index + 1
|
|
952
|
+
};
|
|
953
|
+
const ok = (target) => (target.parentId === over.id || index >= 0) && !sameEnd(target, move.from) && this.allows(node, target);
|
|
954
|
+
return (ratio < .25 ? [before] : ratio > .75 ? [after] : ratio < .5 ? [inside, before] : [inside, after]).find(ok) ?? null;
|
|
955
|
+
}
|
|
956
|
+
restOn(move, row) {
|
|
957
|
+
const id = row.node.id;
|
|
958
|
+
if (this.hoverExpand?.id === id) return;
|
|
959
|
+
this.clearHoverExpand();
|
|
960
|
+
if (!row.hasChildren || row.node.disabled || id === move.node.id || this.expandedSet().has(id)) return;
|
|
961
|
+
const timer = setTimeout(() => {
|
|
962
|
+
this.hoverExpand = null;
|
|
963
|
+
if (this.move() && !this.expandedSet().has(id)) this.toggleExpanded(id);
|
|
964
|
+
}, HOVER_EXPAND_MS);
|
|
965
|
+
this.hoverExpand = {
|
|
966
|
+
id,
|
|
967
|
+
timer
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
clearHoverExpand() {
|
|
971
|
+
if (this.hoverExpand) clearTimeout(this.hoverExpand.timer);
|
|
972
|
+
this.hoverExpand = null;
|
|
973
|
+
}
|
|
974
|
+
commit(move, to) {
|
|
975
|
+
if (sameEnd(move.from, to)) return;
|
|
976
|
+
if (to.parentId !== null && !this.expanded().includes(to.parentId)) this.expanded.set([...this.expanded(), to.parentId]);
|
|
977
|
+
this.nodeMove.emit({
|
|
978
|
+
node: move.node,
|
|
979
|
+
from: move.from,
|
|
980
|
+
to
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
grab(row) {
|
|
984
|
+
const from = this.locate(row.node);
|
|
985
|
+
this.move.set({
|
|
986
|
+
node: row.node,
|
|
987
|
+
from,
|
|
988
|
+
keyboard: true,
|
|
989
|
+
target: from
|
|
990
|
+
});
|
|
991
|
+
this.announcement.set(this.grabbedText(this.position(row.node, from)));
|
|
992
|
+
}
|
|
993
|
+
onMoveKey(event) {
|
|
994
|
+
const move = this.move();
|
|
995
|
+
const target = move?.target;
|
|
996
|
+
if (!move || !target) return;
|
|
997
|
+
const { node, from } = move;
|
|
998
|
+
const key = this.inlineKey(event.key);
|
|
999
|
+
if (!MOVE_KEYS.has(key)) return;
|
|
1000
|
+
event.preventDefault();
|
|
1001
|
+
if (key === "Escape") {
|
|
1002
|
+
event.stopPropagation();
|
|
1003
|
+
this.cancelMove();
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
if (key === "Enter" || key === " ") {
|
|
1007
|
+
this.move.set(null);
|
|
1008
|
+
this.announcement.set(this.droppedText(this.position(node, target)));
|
|
1009
|
+
this.commit(move, target);
|
|
1010
|
+
this.refocusCursor();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
const ok = (to) => sameEnd(to, from) || this.allows(node, to);
|
|
1014
|
+
const siblings = this.siblings(target.parentId, node.id);
|
|
1015
|
+
let next = null;
|
|
1016
|
+
if (key === "ArrowUp" || key === "ArrowDown") {
|
|
1017
|
+
const step = key === "ArrowDown" ? 1 : -1;
|
|
1018
|
+
for (let index = target.index + step; index >= 0 && index <= siblings.length; index += step) if (ok({
|
|
1019
|
+
parentId: target.parentId,
|
|
1020
|
+
index
|
|
1021
|
+
})) {
|
|
1022
|
+
next = {
|
|
1023
|
+
parentId: target.parentId,
|
|
1024
|
+
index
|
|
1025
|
+
};
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
} else if (key === "ArrowRight") {
|
|
1029
|
+
const above = siblings[target.index - 1];
|
|
1030
|
+
if (above) next = {
|
|
1031
|
+
parentId: above.id,
|
|
1032
|
+
index: this.siblings(above.id, node.id).length
|
|
1033
|
+
};
|
|
1034
|
+
} else if (key === "ArrowLeft" && target.parentId !== null) {
|
|
1035
|
+
const parentId = this.parentMap().get(target.parentId) ?? null;
|
|
1036
|
+
const parent = this.lookup().byId.get(target.parentId);
|
|
1037
|
+
if (parent) next = {
|
|
1038
|
+
parentId,
|
|
1039
|
+
index: this.siblings(parentId, node.id).indexOf(parent) + 1
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
if (!next || !ok(next)) return;
|
|
1043
|
+
if (next.parentId !== null && next.parentId !== target.parentId && !this.expandedSet().has(next.parentId)) this.expanded.set([...this.expanded(), next.parentId]);
|
|
1044
|
+
this.move.set({
|
|
1045
|
+
...move,
|
|
1046
|
+
target: next
|
|
1047
|
+
});
|
|
1048
|
+
const place = this.movedText(this.position(node, next));
|
|
1049
|
+
const parent = next.parentId === null ? void 0 : this.lookup().byId.get(next.parentId);
|
|
1050
|
+
this.announcement.set(parent && next.parentId !== target.parentId ? `${parent.label}. ${place}` : place);
|
|
1051
|
+
const mark = this.dropMark();
|
|
1052
|
+
if (mark && this.virtualized()) this.ensureVisible(mark.row);
|
|
1053
|
+
}
|
|
1054
|
+
cancelMove() {
|
|
1055
|
+
if (!this.move()?.keyboard) return;
|
|
1056
|
+
this.move.set(null);
|
|
1057
|
+
this.announcement.set(this.cancelledText());
|
|
1058
|
+
}
|
|
1059
|
+
onListFocusOut(event) {
|
|
1060
|
+
if (!this.move()?.keyboard) return;
|
|
1061
|
+
const next = event.relatedTarget;
|
|
1062
|
+
if (next instanceof Node && this.listElement?.contains(next)) return;
|
|
1063
|
+
this.cancelMove();
|
|
1064
|
+
}
|
|
1065
|
+
position(node, end) {
|
|
1066
|
+
return {
|
|
1067
|
+
index: end.index + 1,
|
|
1068
|
+
total: this.siblings(end.parentId, node.id).length + 1
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
refocusCursor() {
|
|
1072
|
+
if (this.virtualized()) return;
|
|
1073
|
+
afterNextRender(() => {
|
|
1074
|
+
const root = this.overlayRef?.overlayElement ?? this.host.nativeElement;
|
|
1075
|
+
const active = root.ownerDocument.activeElement;
|
|
1076
|
+
if (active && active !== root.ownerDocument.body && !root.contains(active)) return;
|
|
1077
|
+
root.querySelector(`[data-tree-index="${this.cursorIndex()}"]`)?.focus();
|
|
1078
|
+
}, { injector: this.injector });
|
|
1079
|
+
}
|
|
496
1080
|
focusIndex(i) {
|
|
497
1081
|
this.focusedIndex.set(i);
|
|
498
1082
|
const row = this.flat()[i];
|
|
499
|
-
this.cursorId.set(row ? { id: row.node.id } : null);
|
|
1083
|
+
this.cursorId.set(row && !row.status ? { id: row.node.id } : null);
|
|
500
1084
|
if (this.virtualized()) {
|
|
501
1085
|
this.ensureVisible(i);
|
|
502
1086
|
this.listElement?.focus();
|
|
@@ -509,9 +1093,12 @@ var WrTree = class WrTree {
|
|
|
509
1093
|
collectExpandableIds(list) {
|
|
510
1094
|
const out = [];
|
|
511
1095
|
const walk = (items) => {
|
|
512
|
-
for (const n of items)
|
|
513
|
-
|
|
514
|
-
|
|
1096
|
+
for (const n of items) {
|
|
1097
|
+
const children = childrenOf(n, this.lazy());
|
|
1098
|
+
if (children.length) {
|
|
1099
|
+
out.push(n.id);
|
|
1100
|
+
walk(children);
|
|
1101
|
+
}
|
|
515
1102
|
}
|
|
516
1103
|
};
|
|
517
1104
|
walk(list);
|
|
@@ -549,18 +1136,18 @@ var WrTree = class WrTree {
|
|
|
549
1136
|
}, { injector: this.injector });
|
|
550
1137
|
this.outsideClick.outsidePointerEvents(this.overlayRef).pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
551
1138
|
if (this.host.nativeElement.contains(event.target)) return;
|
|
552
|
-
this.
|
|
1139
|
+
this.openState.set(false);
|
|
553
1140
|
});
|
|
554
1141
|
this.overlayRef.keydownEvents().pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
555
1142
|
if (event.key === "Escape") {
|
|
556
1143
|
event.preventDefault();
|
|
557
|
-
this.
|
|
1144
|
+
this.openState.set(false);
|
|
558
1145
|
return;
|
|
559
1146
|
}
|
|
560
1147
|
if (event.key === "Tab") {
|
|
561
1148
|
const typedIn = event.target;
|
|
562
1149
|
if (typedIn instanceof Node && (this.host.nativeElement.contains(typedIn) || (this.overlayRef?.overlayElement.contains(typedIn) ?? false))) this.host.nativeElement.querySelector(".wr-tree__trigger")?.focus();
|
|
563
|
-
this.
|
|
1150
|
+
this.openState.set(false);
|
|
564
1151
|
}
|
|
565
1152
|
});
|
|
566
1153
|
this.opened.emit();
|
|
@@ -577,7 +1164,7 @@ var WrTree = class WrTree {
|
|
|
577
1164
|
}
|
|
578
1165
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
579
1166
|
minVersion: "12.0.0",
|
|
580
|
-
version: "22.2.
|
|
1167
|
+
version: "22.2.6",
|
|
581
1168
|
ngImport: i0,
|
|
582
1169
|
type: WrTree,
|
|
583
1170
|
deps: [],
|
|
@@ -585,7 +1172,7 @@ var WrTree = class WrTree {
|
|
|
585
1172
|
});
|
|
586
1173
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
587
1174
|
minVersion: "17.0.0",
|
|
588
|
-
version: "22.2.
|
|
1175
|
+
version: "22.2.6",
|
|
589
1176
|
type: WrTree,
|
|
590
1177
|
isStandalone: true,
|
|
591
1178
|
selector: "wr-tree",
|
|
@@ -611,6 +1198,13 @@ var WrTree = class WrTree {
|
|
|
611
1198
|
isRequired: false,
|
|
612
1199
|
transformFunction: null
|
|
613
1200
|
},
|
|
1201
|
+
expandOnClick: {
|
|
1202
|
+
classPropertyName: "expandOnClick",
|
|
1203
|
+
publicName: "expandOnClick",
|
|
1204
|
+
isSignal: true,
|
|
1205
|
+
isRequired: false,
|
|
1206
|
+
transformFunction: null
|
|
1207
|
+
},
|
|
614
1208
|
selectionMode: {
|
|
615
1209
|
classPropertyName: "selectionMode",
|
|
616
1210
|
publicName: "selectionMode",
|
|
@@ -716,17 +1310,116 @@ var WrTree = class WrTree {
|
|
|
716
1310
|
isRequired: false,
|
|
717
1311
|
transformFunction: null
|
|
718
1312
|
},
|
|
1313
|
+
loadChildren: {
|
|
1314
|
+
classPropertyName: "loadChildren",
|
|
1315
|
+
publicName: "loadChildren",
|
|
1316
|
+
isSignal: true,
|
|
1317
|
+
isRequired: false,
|
|
1318
|
+
transformFunction: null
|
|
1319
|
+
},
|
|
1320
|
+
filter: {
|
|
1321
|
+
classPropertyName: "filter",
|
|
1322
|
+
publicName: "filter",
|
|
1323
|
+
isSignal: true,
|
|
1324
|
+
isRequired: false,
|
|
1325
|
+
transformFunction: null
|
|
1326
|
+
},
|
|
1327
|
+
filterFn: {
|
|
1328
|
+
classPropertyName: "filterFn",
|
|
1329
|
+
publicName: "filterFn",
|
|
1330
|
+
isSignal: true,
|
|
1331
|
+
isRequired: false,
|
|
1332
|
+
transformFunction: null
|
|
1333
|
+
},
|
|
1334
|
+
cascade: {
|
|
1335
|
+
classPropertyName: "cascade",
|
|
1336
|
+
publicName: "cascade",
|
|
1337
|
+
isSignal: true,
|
|
1338
|
+
isRequired: false,
|
|
1339
|
+
transformFunction: null
|
|
1340
|
+
},
|
|
1341
|
+
draggable: {
|
|
1342
|
+
classPropertyName: "draggable",
|
|
1343
|
+
publicName: "draggable",
|
|
1344
|
+
isSignal: true,
|
|
1345
|
+
isRequired: false,
|
|
1346
|
+
transformFunction: null
|
|
1347
|
+
},
|
|
1348
|
+
canDrop: {
|
|
1349
|
+
classPropertyName: "canDrop",
|
|
1350
|
+
publicName: "canDrop",
|
|
1351
|
+
isSignal: true,
|
|
1352
|
+
isRequired: false,
|
|
1353
|
+
transformFunction: null
|
|
1354
|
+
},
|
|
719
1355
|
value: {
|
|
720
1356
|
classPropertyName: "value",
|
|
721
1357
|
publicName: "value",
|
|
722
1358
|
isSignal: true,
|
|
723
1359
|
isRequired: false,
|
|
724
1360
|
transformFunction: null
|
|
1361
|
+
},
|
|
1362
|
+
clearSelectionLabel: {
|
|
1363
|
+
classPropertyName: "clearSelectionLabel",
|
|
1364
|
+
publicName: "clearSelectionLabel",
|
|
1365
|
+
isSignal: true,
|
|
1366
|
+
isRequired: false,
|
|
1367
|
+
transformFunction: null
|
|
1368
|
+
},
|
|
1369
|
+
expandLabel: {
|
|
1370
|
+
classPropertyName: "expandLabel",
|
|
1371
|
+
publicName: "expandLabel",
|
|
1372
|
+
isSignal: true,
|
|
1373
|
+
isRequired: false,
|
|
1374
|
+
transformFunction: null
|
|
1375
|
+
},
|
|
1376
|
+
collapseLabel: {
|
|
1377
|
+
classPropertyName: "collapseLabel",
|
|
1378
|
+
publicName: "collapseLabel",
|
|
1379
|
+
isSignal: true,
|
|
1380
|
+
isRequired: false,
|
|
1381
|
+
transformFunction: null
|
|
1382
|
+
},
|
|
1383
|
+
loadingLabel: {
|
|
1384
|
+
classPropertyName: "loadingLabel",
|
|
1385
|
+
publicName: "loadingLabel",
|
|
1386
|
+
isSignal: true,
|
|
1387
|
+
isRequired: false,
|
|
1388
|
+
transformFunction: null
|
|
1389
|
+
},
|
|
1390
|
+
loadErrorLabel: {
|
|
1391
|
+
classPropertyName: "loadErrorLabel",
|
|
1392
|
+
publicName: "loadErrorLabel",
|
|
1393
|
+
isSignal: true,
|
|
1394
|
+
isRequired: false,
|
|
1395
|
+
transformFunction: null
|
|
1396
|
+
},
|
|
1397
|
+
retryLabel: {
|
|
1398
|
+
classPropertyName: "retryLabel",
|
|
1399
|
+
publicName: "retryLabel",
|
|
1400
|
+
isSignal: true,
|
|
1401
|
+
isRequired: false,
|
|
1402
|
+
transformFunction: null
|
|
1403
|
+
},
|
|
1404
|
+
noMatchesLabel: {
|
|
1405
|
+
classPropertyName: "noMatchesLabel",
|
|
1406
|
+
publicName: "noMatchesLabel",
|
|
1407
|
+
isSignal: true,
|
|
1408
|
+
isRequired: false,
|
|
1409
|
+
transformFunction: null
|
|
1410
|
+
},
|
|
1411
|
+
moveHelpLabel: {
|
|
1412
|
+
classPropertyName: "moveHelpLabel",
|
|
1413
|
+
publicName: "moveHelpLabel",
|
|
1414
|
+
isSignal: true,
|
|
1415
|
+
isRequired: false,
|
|
1416
|
+
transformFunction: null
|
|
725
1417
|
}
|
|
726
1418
|
},
|
|
727
1419
|
outputs: {
|
|
728
1420
|
selected: "selectedChange",
|
|
729
1421
|
expanded: "expandedChange",
|
|
1422
|
+
nodeMove: "nodeMove",
|
|
730
1423
|
value: "valueChange",
|
|
731
1424
|
touch: "touch",
|
|
732
1425
|
opened: "opened",
|
|
@@ -734,7 +1427,10 @@ var WrTree = class WrTree {
|
|
|
734
1427
|
},
|
|
735
1428
|
host: {
|
|
736
1429
|
listeners: { "focusout": "onFocusOut($event)" },
|
|
737
|
-
properties: {
|
|
1430
|
+
properties: {
|
|
1431
|
+
"class": "classes()",
|
|
1432
|
+
"attr.draggable": "null"
|
|
1433
|
+
},
|
|
738
1434
|
classAttribute: "wr-tree"
|
|
739
1435
|
},
|
|
740
1436
|
viewQueries: [{
|
|
@@ -746,23 +1442,46 @@ var WrTree = class WrTree {
|
|
|
746
1442
|
isSignal: true
|
|
747
1443
|
}],
|
|
748
1444
|
ngImport: i0,
|
|
749
|
-
template: "@if (isOverlay()) {\n <button\n type=\"button\"\n class=\"wr-tree__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKey($event)\"\n (blur)=\"onBlur()\"\n >\n @if (isMulti()) {\n @if (hasSelection()) {\n <span class=\"wr-tree__chips\">\n @for (chip of visibleChips(); track chip.id) {\n <span class=\"wr-tree__chip\">\n <span class=\"wr-tree__chip-label\">{{ chip.label }}</span>\n <span\n class=\"wr-tree__chip-remove\"\n role=\"button\"\n [attr.aria-label]=\"chipRemoveLabel({ label: chip.label })\"\n tabindex=\"-1\"\n (click)=\"removeChip(chip.id, $event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n </span>\n }\n @if (hiddenChipCount(); as extra) {\n <span class=\"wr-tree__chip wr-tree__chip--more\">{{ chipMoreLabel({ count: extra }) }}</span>\n }\n </span>\n } @else {\n <span class=\"wr-tree__placeholder\">{{ resolvedPlaceholder() }}</span>\n }\n } @else {\n @if (singleLabel(); as label) {\n <span class=\"wr-tree__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-tree__placeholder\">{{ resolvedPlaceholder() }}</span>\n }\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-tree__clear\"\n role=\"button\"\n [attr.aria-label]=\"clearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-tree__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n <!-- Tree list lives inside the overlay panel. -->\n <ng-template #panelTpl>\n <div class=\"wr-tree-panel\" [class.wr-tree-panel--virtual]=\"virtualized()\" [attr.id]=\"panelId\">\n <ng-container [ngTemplateOutlet]=\"listTpl\" />\n </div>\n </ng-template>\n} @else {\n <ng-container [ngTemplateOutlet]=\"listTpl\" />\n}\n\n<!-- Shared row list — rendered inline (default) or projected into the\n overlay panel (when openOn=\"overlay\"). -->\n<ng-template #listTpl>\n <!-- Roving tabindex (non-virtual) / aria-activedescendant (virtual): the tree\n owns keyboard focus and routes arrow keys to its currently-focused row.\n The field's error state is bound here for the INLINE shape only — in\n overlay mode the trigger carries it, and the panel would otherwise\n describe the same error a second time. -->\n <ul\n class=\"wr-tree__list\"\n role=\"tree\"\n [attr.aria-multiselectable]=\"isMulti() ? 'true' : null\"\n [attr.aria-label]=\"isOverlay() ? null : ariaLabel()\"\n [attr.aria-labelledby]=\"isOverlay() ? null : fieldAria.labelledBy()\"\n [attr.aria-invalid]=\"isOverlay() ? null : fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"isOverlay() ? null : fieldAria.describedBy()\"\n [class.wr-tree__list--virtual]=\"virtualized()\"\n [attr.tabindex]=\"virtualized() ? 0 : null\"\n [attr.aria-activedescendant]=\"activeRowId()\"\n [style.max-height]=\"virtualized() ? resolvedViewportHeight() : null\"\n [style.overflow-y]=\"virtualized() ? 'auto' : null\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (virtualized() && virtualWindow().padTop > 0) {\n <!-- `aria-setsize` / `aria-posinset` in BOTH shapes: the list is flat with no\n `role=\"group\"` either way, so the set a row belongs to is never expressed\n by the DOM. Gated behind the virtual flag, the same tree announced a\n position with windowing on and nothing with it off. -->\n <li\n class=\"wr-tree__spacer\"\n role=\"presentation\"\n aria-hidden=\"true\"\n [style.height.px]=\"virtualWindow().padTop\"\n ></li>\n }\n @for (entry of windowRows(); track entry.node.id) {\n <!-- Click handler lives on focusable rows; keyboard handling is owned\n by the parent <ul> via the roving-tabindex pattern. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"wr-tree__row\"\n role=\"treeitem\"\n [attr.id]=\"virtualized() ? rowId(entry.index) : null\"\n [class.wr-tree__row--selected]=\"selectedSet().has(entry.node.id)\"\n [class.wr-tree__row--active]=\"virtualized() && entry.index === cursorIndex()\"\n [class.wr-tree__row--disabled]=\"entry.node.disabled\"\n [attr.aria-level]=\"entry.depth + 1\"\n [attr.aria-setsize]=\"entry.setsize\"\n [attr.aria-posinset]=\"entry.posinset\"\n [attr.aria-expanded]=\"entry.hasChildren ? expandedSet().has(entry.node.id) : null\"\n [attr.aria-selected]=\"selectionMode() === 'none' ? null : selectedSet().has(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled || disabled() || null\"\n [attr.data-tree-index]=\"entry.index\"\n [attr.tabindex]=\"virtualized() ? null : entry.index === cursorIndex() ? 0 : -1\"\n [style.--wr-tree-depth]=\"entry.depth\"\n (click)=\"onRowClick(entry, $event)\"\n >\n @if (entry.hasChildren) {\n <button\n type=\"button\"\n class=\"wr-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"expandedSet().has(entry.node.id) ? collapseLabel() : expandLabel()\"\n (click)=\"onToggleClick(entry.node, $event)\"\n >\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M3 1 L7 5 L3 9 Z\" fill=\"currentColor\" />\n </svg>\n </button>\n } @else {\n <span class=\"wr-tree__toggle wr-tree__toggle--leaf\" aria-hidden=\"true\"></span>\n }\n <span class=\"wr-tree__label\">{{ entry.node.label }}</span>\n </li>\n }\n @if (virtualized() && virtualWindow().padBottom > 0) {\n <li\n class=\"wr-tree__spacer\"\n role=\"presentation\"\n aria-hidden=\"true\"\n [style.height.px]=\"virtualWindow().padBottom\"\n ></li>\n }\n </ul>\n</ng-template>\n",
|
|
750
|
-
dependencies: [
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
1445
|
+
template: "@if (isOverlay()) {\n <button\n type=\"button\"\n class=\"wr-tree__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKey($event)\"\n (blur)=\"onBlur()\"\n >\n @if (isMulti()) {\n @if (hasSelection()) {\n <span class=\"wr-tree__chips\">\n @for (chip of visibleChips(); track chip.id) {\n <span class=\"wr-tree__chip\">\n <span class=\"wr-tree__chip-label\">{{ chip.label }}</span>\n <span\n class=\"wr-tree__chip-remove\"\n role=\"button\"\n [attr.aria-label]=\"chipRemoveLabel({ label: chip.label })\"\n tabindex=\"-1\"\n (click)=\"removeChip(chip.id, $event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n </span>\n }\n @if (hiddenChipCount(); as extra) {\n <span class=\"wr-tree__chip wr-tree__chip--more\">{{ chipMoreLabel({ count: extra }) }}</span>\n }\n </span>\n } @else {\n <span class=\"wr-tree__placeholder\">{{ resolvedPlaceholder() }}</span>\n }\n } @else {\n @if (singleLabel(); as label) {\n <span class=\"wr-tree__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-tree__placeholder\">{{ resolvedPlaceholder() }}</span>\n }\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-tree__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearSelectionLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-tree__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n <!-- Tree list lives inside the overlay panel. -->\n <ng-template #panelTpl>\n <div class=\"wr-tree-panel\" [class.wr-tree-panel--virtual]=\"virtualized()\" [attr.id]=\"panelId\">\n <ng-container [ngTemplateOutlet]=\"listTpl\" />\n </div>\n </ng-template>\n} @else {\n <ng-container [ngTemplateOutlet]=\"listTpl\" />\n}\n\n<!-- Shared row list — rendered inline (default) or projected into the\n overlay panel (when openOn=\"overlay\"). -->\n<ng-template #listTpl>\n <!-- Roving tabindex (non-virtual) / aria-activedescendant (virtual): the tree\n owns keyboard focus and routes arrow keys to its currently-focused row.\n The field's error state is bound here for the INLINE shape only — in\n overlay mode the trigger carries it, and the panel would otherwise\n describe the same error a second time. -->\n <ul\n class=\"wr-tree__list\"\n role=\"tree\"\n [attr.aria-multiselectable]=\"isMulti() ? 'true' : null\"\n [attr.aria-label]=\"isOverlay() ? null : ariaLabel()\"\n [attr.aria-labelledby]=\"isOverlay() ? null : fieldAria.labelledBy()\"\n [attr.aria-invalid]=\"isOverlay() ? null : fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"listDescribedBy()\"\n [class.wr-tree__list--virtual]=\"virtualized()\"\n [attr.tabindex]=\"virtualized() ? 0 : null\"\n [attr.aria-activedescendant]=\"activeRowId()\"\n [style.max-height]=\"virtualized() ? resolvedViewportHeight() : null\"\n [style.overflow-y]=\"virtualized() ? 'auto' : null\"\n (keydown)=\"onKeydown($event)\"\n (focusout)=\"onListFocusOut($event)\"\n (dragstart)=\"onDragStart($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n (dragend)=\"endDrag()\"\n >\n @let mark = dropMark();\n @let moving = movingNode();\n @let query = filterQuery();\n @if (virtualized() && virtualWindow().padTop > 0) {\n <!-- `aria-setsize` / `aria-posinset` in BOTH shapes: the list is flat with no\n `role=\"group\"` either way, so the set a row belongs to is never expressed\n by the DOM. Gated behind the virtual flag, the same tree announced a\n position with windowing on and nothing with it off. -->\n <li\n class=\"wr-tree__spacer\"\n role=\"presentation\"\n aria-hidden=\"true\"\n [style.height.px]=\"virtualWindow().padTop\"\n ></li>\n }\n @for (entry of windowRows(); track entry.key) {\n @if (entry.status) {\n <!-- A branch's pending or failed load, as a row of its own: the cursor\n can land on it, which is how the keyboard reaches the retry. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"wr-tree__status\"\n role=\"treeitem\"\n [class.wr-tree__status--error]=\"entry.status === 'error'\"\n [class.wr-tree__status--active]=\"virtualized() && entry.index === cursorIndex()\"\n [attr.id]=\"virtualized() ? rowId(entry.index) : null\"\n [attr.aria-level]=\"entry.depth + 1\"\n [attr.aria-selected]=\"selectionMode() === 'none' || isCascade() ? null : false\"\n [attr.data-tree-index]=\"entry.index\"\n [attr.tabindex]=\"virtualized() ? null : entry.index === cursorIndex() ? 0 : -1\"\n [style.--wr-tree-depth]=\"entry.depth\"\n (click)=\"onRowClick(entry, $event)\"\n >\n @if (entry.status === 'loading') {\n <wr-spinner class=\"wr-tree__spinner\" size=\"sm\" aria-hidden=\"true\" />\n <span class=\"wr-tree__status-text\">{{ resolvedLoadingLabel() }}</span>\n } @else {\n <span class=\"wr-tree__status-text\">{{ resolvedLoadErrorLabel() }}</span>\n <button type=\"button\" class=\"wr-tree__retry\" tabindex=\"-1\" (click)=\"retryLoad(entry.node, $event)\">\n {{ resolvedRetryLabel() }}\n </button>\n }\n </li>\n } @else {\n <!-- Click handler lives on focusable rows; keyboard handling is owned\n by the parent <ul> via the roving-tabindex pattern. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"wr-tree__row\"\n role=\"treeitem\"\n [attr.id]=\"virtualized() ? rowId(entry.index) : null\"\n [class.wr-tree__row--selected]=\"selectedSet().has(entry.node.id)\"\n [class.wr-tree__row--mixed]=\"mixedSet().has(entry.node.id)\"\n [class.wr-tree__row--active]=\"virtualized() && entry.index === cursorIndex()\"\n [class.wr-tree__row--disabled]=\"entry.node.disabled\"\n [class.wr-tree__row--dragging]=\"moving === entry.node\"\n [class.wr-tree__row--drop-before]=\"mark?.row === entry.index && mark?.position === 'before'\"\n [class.wr-tree__row--drop-after]=\"mark?.row === entry.index && mark?.position === 'after'\"\n [class.wr-tree__row--drop-inside]=\"mark?.row === entry.index && mark?.position === 'inside'\"\n [attr.aria-level]=\"entry.depth + 1\"\n [attr.aria-setsize]=\"entry.setsize\"\n [attr.aria-posinset]=\"entry.posinset\"\n [attr.aria-expanded]=\"entry.hasChildren ? expandedSet().has(entry.node.id) : null\"\n [attr.aria-busy]=\"entry.busy ? 'true' : null\"\n [attr.aria-selected]=\"selectionMode() === 'none' || isCascade() ? null : selectedSet().has(entry.node.id)\"\n [attr.aria-checked]=\"\n isCascade() ? (mixedSet().has(entry.node.id) ? 'mixed' : selectedSet().has(entry.node.id)) : null\n \"\n [attr.aria-disabled]=\"entry.node.disabled || disabled() || null\"\n [attr.data-tree-index]=\"entry.index\"\n [attr.draggable]=\"canDrag(entry) ? 'true' : null\"\n [attr.tabindex]=\"virtualized() ? null : entry.index === cursorIndex() ? 0 : -1\"\n [style.--wr-tree-depth]=\"entry.depth\"\n [style.--wr-tree-drop-depth]=\"mark?.row === entry.index ? mark?.depth : null\"\n (click)=\"onRowClick(entry, $event)\"\n >\n @if (entry.hasChildren) {\n <button\n type=\"button\"\n class=\"wr-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"expandedSet().has(entry.node.id) ? resolvedCollapseLabel() : resolvedExpandLabel()\"\n (click)=\"onToggleClick(entry.node, $event)\"\n >\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M3 1 L7 5 L3 9 Z\" fill=\"currentColor\" />\n </svg>\n </button>\n } @else {\n <span class=\"wr-tree__toggle wr-tree__toggle--leaf\" aria-hidden=\"true\"></span>\n }\n @if (isCascade()) {\n <!-- The checkbox's own box, drawn from its classes: the row is the\n control and announces `aria-checked`, so a second focusable\n input inside it would be one tab stop too many. -->\n <span\n class=\"wr-checkbox wr-checkbox--sm wr-tree__check\"\n aria-hidden=\"true\"\n [class.wr-checkbox--checked]=\"selectedSet().has(entry.node.id)\"\n [class.wr-checkbox--indeterminate]=\"mixedSet().has(entry.node.id)\"\n >\n <span class=\"wr-checkbox__box\">\n @if (mixedSet().has(entry.node.id)) {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__dash\">\n <line\n x1=\"3.5\"\n y1=\"8\"\n x2=\"12.5\"\n y2=\"8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n </span>\n }\n @if (query) {\n <span class=\"wr-tree__label\" [innerHTML]=\"entry.node.label | wrMark: query\"></span>\n } @else {\n <span class=\"wr-tree__label\">{{ entry.node.label }}</span>\n }\n </li>\n }\n }\n @if (virtualized() && virtualWindow().padBottom > 0) {\n <li\n class=\"wr-tree__spacer\"\n role=\"presentation\"\n aria-hidden=\"true\"\n [style.height.px]=\"virtualWindow().padBottom\"\n ></li>\n }\n </ul>\n @if (filterQuery() && flat().length === 0) {\n <wr-empty class=\"wr-tree__empty\" [title]=\"resolvedNoMatchesLabel()\" />\n }\n @if (draggable()) {\n <!-- The keyboard move: its description hangs off the tree, and the live\n region is written by the keyboard path only. -->\n <p class=\"wr-tree__sr-only\" [id]=\"moveHelpId\">{{ resolvedMoveHelp() }}</p>\n <p class=\"wr-tree__sr-only\" role=\"status\">{{ announcement() }}</p>\n }\n</ng-template>\n",
|
|
1446
|
+
dependencies: [
|
|
1447
|
+
{
|
|
1448
|
+
kind: "directive",
|
|
1449
|
+
type: NgTemplateOutlet,
|
|
1450
|
+
selector: "[ngTemplateOutlet]",
|
|
1451
|
+
inputs: [
|
|
1452
|
+
"ngTemplateOutletContext",
|
|
1453
|
+
"ngTemplateOutlet",
|
|
1454
|
+
"ngTemplateOutletInjector"
|
|
1455
|
+
]
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
kind: "component",
|
|
1459
|
+
type: WrEmpty,
|
|
1460
|
+
selector: "wr-empty",
|
|
1461
|
+
inputs: [
|
|
1462
|
+
"icon",
|
|
1463
|
+
"iconName",
|
|
1464
|
+
"title"
|
|
1465
|
+
]
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
kind: "component",
|
|
1469
|
+
type: WrSpinner,
|
|
1470
|
+
selector: "wr-spinner",
|
|
1471
|
+
inputs: ["size", "ariaLabel"]
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
kind: "pipe",
|
|
1475
|
+
type: WrMark,
|
|
1476
|
+
name: "wrMark"
|
|
1477
|
+
}
|
|
1478
|
+
],
|
|
760
1479
|
encapsulation: i0.ViewEncapsulation.None
|
|
761
1480
|
});
|
|
762
1481
|
};
|
|
763
1482
|
i0.ɵɵngDeclareClassMetadata({
|
|
764
1483
|
minVersion: "12.0.0",
|
|
765
|
-
version: "22.2.
|
|
1484
|
+
version: "22.2.6",
|
|
766
1485
|
ngImport: i0,
|
|
767
1486
|
type: WrTree,
|
|
768
1487
|
decorators: [{
|
|
@@ -773,10 +1492,16 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
773
1492
|
host: {
|
|
774
1493
|
class: "wr-tree",
|
|
775
1494
|
"[class]": "classes()",
|
|
1495
|
+
"[attr.draggable]": "null",
|
|
776
1496
|
"(focusout)": "onFocusOut($event)"
|
|
777
1497
|
},
|
|
778
|
-
imports: [
|
|
779
|
-
|
|
1498
|
+
imports: [
|
|
1499
|
+
NgTemplateOutlet,
|
|
1500
|
+
WrEmpty,
|
|
1501
|
+
WrMark,
|
|
1502
|
+
WrSpinner
|
|
1503
|
+
],
|
|
1504
|
+
template: "@if (isOverlay()) {\n <button\n type=\"button\"\n class=\"wr-tree__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKey($event)\"\n (blur)=\"onBlur()\"\n >\n @if (isMulti()) {\n @if (hasSelection()) {\n <span class=\"wr-tree__chips\">\n @for (chip of visibleChips(); track chip.id) {\n <span class=\"wr-tree__chip\">\n <span class=\"wr-tree__chip-label\">{{ chip.label }}</span>\n <span\n class=\"wr-tree__chip-remove\"\n role=\"button\"\n [attr.aria-label]=\"chipRemoveLabel({ label: chip.label })\"\n tabindex=\"-1\"\n (click)=\"removeChip(chip.id, $event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n </span>\n }\n @if (hiddenChipCount(); as extra) {\n <span class=\"wr-tree__chip wr-tree__chip--more\">{{ chipMoreLabel({ count: extra }) }}</span>\n }\n </span>\n } @else {\n <span class=\"wr-tree__placeholder\">{{ resolvedPlaceholder() }}</span>\n }\n } @else {\n @if (singleLabel(); as label) {\n <span class=\"wr-tree__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-tree__placeholder\">{{ resolvedPlaceholder() }}</span>\n }\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-tree__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearSelectionLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-tree__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n <!-- Tree list lives inside the overlay panel. -->\n <ng-template #panelTpl>\n <div class=\"wr-tree-panel\" [class.wr-tree-panel--virtual]=\"virtualized()\" [attr.id]=\"panelId\">\n <ng-container [ngTemplateOutlet]=\"listTpl\" />\n </div>\n </ng-template>\n} @else {\n <ng-container [ngTemplateOutlet]=\"listTpl\" />\n}\n\n<!-- Shared row list — rendered inline (default) or projected into the\n overlay panel (when openOn=\"overlay\"). -->\n<ng-template #listTpl>\n <!-- Roving tabindex (non-virtual) / aria-activedescendant (virtual): the tree\n owns keyboard focus and routes arrow keys to its currently-focused row.\n The field's error state is bound here for the INLINE shape only — in\n overlay mode the trigger carries it, and the panel would otherwise\n describe the same error a second time. -->\n <ul\n class=\"wr-tree__list\"\n role=\"tree\"\n [attr.aria-multiselectable]=\"isMulti() ? 'true' : null\"\n [attr.aria-label]=\"isOverlay() ? null : ariaLabel()\"\n [attr.aria-labelledby]=\"isOverlay() ? null : fieldAria.labelledBy()\"\n [attr.aria-invalid]=\"isOverlay() ? null : fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"listDescribedBy()\"\n [class.wr-tree__list--virtual]=\"virtualized()\"\n [attr.tabindex]=\"virtualized() ? 0 : null\"\n [attr.aria-activedescendant]=\"activeRowId()\"\n [style.max-height]=\"virtualized() ? resolvedViewportHeight() : null\"\n [style.overflow-y]=\"virtualized() ? 'auto' : null\"\n (keydown)=\"onKeydown($event)\"\n (focusout)=\"onListFocusOut($event)\"\n (dragstart)=\"onDragStart($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n (dragend)=\"endDrag()\"\n >\n @let mark = dropMark();\n @let moving = movingNode();\n @let query = filterQuery();\n @if (virtualized() && virtualWindow().padTop > 0) {\n <!-- `aria-setsize` / `aria-posinset` in BOTH shapes: the list is flat with no\n `role=\"group\"` either way, so the set a row belongs to is never expressed\n by the DOM. Gated behind the virtual flag, the same tree announced a\n position with windowing on and nothing with it off. -->\n <li\n class=\"wr-tree__spacer\"\n role=\"presentation\"\n aria-hidden=\"true\"\n [style.height.px]=\"virtualWindow().padTop\"\n ></li>\n }\n @for (entry of windowRows(); track entry.key) {\n @if (entry.status) {\n <!-- A branch's pending or failed load, as a row of its own: the cursor\n can land on it, which is how the keyboard reaches the retry. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"wr-tree__status\"\n role=\"treeitem\"\n [class.wr-tree__status--error]=\"entry.status === 'error'\"\n [class.wr-tree__status--active]=\"virtualized() && entry.index === cursorIndex()\"\n [attr.id]=\"virtualized() ? rowId(entry.index) : null\"\n [attr.aria-level]=\"entry.depth + 1\"\n [attr.aria-selected]=\"selectionMode() === 'none' || isCascade() ? null : false\"\n [attr.data-tree-index]=\"entry.index\"\n [attr.tabindex]=\"virtualized() ? null : entry.index === cursorIndex() ? 0 : -1\"\n [style.--wr-tree-depth]=\"entry.depth\"\n (click)=\"onRowClick(entry, $event)\"\n >\n @if (entry.status === 'loading') {\n <wr-spinner class=\"wr-tree__spinner\" size=\"sm\" aria-hidden=\"true\" />\n <span class=\"wr-tree__status-text\">{{ resolvedLoadingLabel() }}</span>\n } @else {\n <span class=\"wr-tree__status-text\">{{ resolvedLoadErrorLabel() }}</span>\n <button type=\"button\" class=\"wr-tree__retry\" tabindex=\"-1\" (click)=\"retryLoad(entry.node, $event)\">\n {{ resolvedRetryLabel() }}\n </button>\n }\n </li>\n } @else {\n <!-- Click handler lives on focusable rows; keyboard handling is owned\n by the parent <ul> via the roving-tabindex pattern. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n <li\n class=\"wr-tree__row\"\n role=\"treeitem\"\n [attr.id]=\"virtualized() ? rowId(entry.index) : null\"\n [class.wr-tree__row--selected]=\"selectedSet().has(entry.node.id)\"\n [class.wr-tree__row--mixed]=\"mixedSet().has(entry.node.id)\"\n [class.wr-tree__row--active]=\"virtualized() && entry.index === cursorIndex()\"\n [class.wr-tree__row--disabled]=\"entry.node.disabled\"\n [class.wr-tree__row--dragging]=\"moving === entry.node\"\n [class.wr-tree__row--drop-before]=\"mark?.row === entry.index && mark?.position === 'before'\"\n [class.wr-tree__row--drop-after]=\"mark?.row === entry.index && mark?.position === 'after'\"\n [class.wr-tree__row--drop-inside]=\"mark?.row === entry.index && mark?.position === 'inside'\"\n [attr.aria-level]=\"entry.depth + 1\"\n [attr.aria-setsize]=\"entry.setsize\"\n [attr.aria-posinset]=\"entry.posinset\"\n [attr.aria-expanded]=\"entry.hasChildren ? expandedSet().has(entry.node.id) : null\"\n [attr.aria-busy]=\"entry.busy ? 'true' : null\"\n [attr.aria-selected]=\"selectionMode() === 'none' || isCascade() ? null : selectedSet().has(entry.node.id)\"\n [attr.aria-checked]=\"\n isCascade() ? (mixedSet().has(entry.node.id) ? 'mixed' : selectedSet().has(entry.node.id)) : null\n \"\n [attr.aria-disabled]=\"entry.node.disabled || disabled() || null\"\n [attr.data-tree-index]=\"entry.index\"\n [attr.draggable]=\"canDrag(entry) ? 'true' : null\"\n [attr.tabindex]=\"virtualized() ? null : entry.index === cursorIndex() ? 0 : -1\"\n [style.--wr-tree-depth]=\"entry.depth\"\n [style.--wr-tree-drop-depth]=\"mark?.row === entry.index ? mark?.depth : null\"\n (click)=\"onRowClick(entry, $event)\"\n >\n @if (entry.hasChildren) {\n <button\n type=\"button\"\n class=\"wr-tree__toggle\"\n tabindex=\"-1\"\n [attr.aria-label]=\"expandedSet().has(entry.node.id) ? resolvedCollapseLabel() : resolvedExpandLabel()\"\n (click)=\"onToggleClick(entry.node, $event)\"\n >\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M3 1 L7 5 L3 9 Z\" fill=\"currentColor\" />\n </svg>\n </button>\n } @else {\n <span class=\"wr-tree__toggle wr-tree__toggle--leaf\" aria-hidden=\"true\"></span>\n }\n @if (isCascade()) {\n <!-- The checkbox's own box, drawn from its classes: the row is the\n control and announces `aria-checked`, so a second focusable\n input inside it would be one tab stop too many. -->\n <span\n class=\"wr-checkbox wr-checkbox--sm wr-tree__check\"\n aria-hidden=\"true\"\n [class.wr-checkbox--checked]=\"selectedSet().has(entry.node.id)\"\n [class.wr-checkbox--indeterminate]=\"mixedSet().has(entry.node.id)\"\n >\n <span class=\"wr-checkbox__box\">\n @if (mixedSet().has(entry.node.id)) {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__dash\">\n <line\n x1=\"3.5\"\n y1=\"8\"\n x2=\"12.5\"\n y2=\"8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n </span>\n }\n @if (query) {\n <span class=\"wr-tree__label\" [innerHTML]=\"entry.node.label | wrMark: query\"></span>\n } @else {\n <span class=\"wr-tree__label\">{{ entry.node.label }}</span>\n }\n </li>\n }\n }\n @if (virtualized() && virtualWindow().padBottom > 0) {\n <li\n class=\"wr-tree__spacer\"\n role=\"presentation\"\n aria-hidden=\"true\"\n [style.height.px]=\"virtualWindow().padBottom\"\n ></li>\n }\n </ul>\n @if (filterQuery() && flat().length === 0) {\n <wr-empty class=\"wr-tree__empty\" [title]=\"resolvedNoMatchesLabel()\" />\n }\n @if (draggable()) {\n <!-- The keyboard move: its description hangs off the tree, and the live\n region is written by the keyboard path only. -->\n <p class=\"wr-tree__sr-only\" [id]=\"moveHelpId\">{{ resolvedMoveHelp() }}</p>\n <p class=\"wr-tree__sr-only\" role=\"status\">{{ announcement() }}</p>\n }\n</ng-template>\n"
|
|
780
1505
|
}]
|
|
781
1506
|
}],
|
|
782
1507
|
ctorParameters: () => [],
|
|
@@ -811,6 +1536,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
811
1536
|
type: i0.Output,
|
|
812
1537
|
args: ["expandedChange"]
|
|
813
1538
|
}],
|
|
1539
|
+
expandOnClick: [{
|
|
1540
|
+
type: i0.Input,
|
|
1541
|
+
args: [{
|
|
1542
|
+
isSignal: true,
|
|
1543
|
+
alias: "expandOnClick",
|
|
1544
|
+
required: false
|
|
1545
|
+
}]
|
|
1546
|
+
}],
|
|
814
1547
|
selectionMode: [{
|
|
815
1548
|
type: i0.Input,
|
|
816
1549
|
args: [{
|
|
@@ -931,6 +1664,58 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
931
1664
|
required: false
|
|
932
1665
|
}]
|
|
933
1666
|
}],
|
|
1667
|
+
loadChildren: [{
|
|
1668
|
+
type: i0.Input,
|
|
1669
|
+
args: [{
|
|
1670
|
+
isSignal: true,
|
|
1671
|
+
alias: "loadChildren",
|
|
1672
|
+
required: false
|
|
1673
|
+
}]
|
|
1674
|
+
}],
|
|
1675
|
+
filter: [{
|
|
1676
|
+
type: i0.Input,
|
|
1677
|
+
args: [{
|
|
1678
|
+
isSignal: true,
|
|
1679
|
+
alias: "filter",
|
|
1680
|
+
required: false
|
|
1681
|
+
}]
|
|
1682
|
+
}],
|
|
1683
|
+
filterFn: [{
|
|
1684
|
+
type: i0.Input,
|
|
1685
|
+
args: [{
|
|
1686
|
+
isSignal: true,
|
|
1687
|
+
alias: "filterFn",
|
|
1688
|
+
required: false
|
|
1689
|
+
}]
|
|
1690
|
+
}],
|
|
1691
|
+
cascade: [{
|
|
1692
|
+
type: i0.Input,
|
|
1693
|
+
args: [{
|
|
1694
|
+
isSignal: true,
|
|
1695
|
+
alias: "cascade",
|
|
1696
|
+
required: false
|
|
1697
|
+
}]
|
|
1698
|
+
}],
|
|
1699
|
+
draggable: [{
|
|
1700
|
+
type: i0.Input,
|
|
1701
|
+
args: [{
|
|
1702
|
+
isSignal: true,
|
|
1703
|
+
alias: "draggable",
|
|
1704
|
+
required: false
|
|
1705
|
+
}]
|
|
1706
|
+
}],
|
|
1707
|
+
canDrop: [{
|
|
1708
|
+
type: i0.Input,
|
|
1709
|
+
args: [{
|
|
1710
|
+
isSignal: true,
|
|
1711
|
+
alias: "canDrop",
|
|
1712
|
+
required: false
|
|
1713
|
+
}]
|
|
1714
|
+
}],
|
|
1715
|
+
nodeMove: [{
|
|
1716
|
+
type: i0.Output,
|
|
1717
|
+
args: ["nodeMove"]
|
|
1718
|
+
}],
|
|
934
1719
|
value: [{
|
|
935
1720
|
type: i0.Input,
|
|
936
1721
|
args: [{
|
|
@@ -954,6 +1739,70 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
954
1739
|
type: i0.Output,
|
|
955
1740
|
args: ["closed"]
|
|
956
1741
|
}],
|
|
1742
|
+
clearSelectionLabel: [{
|
|
1743
|
+
type: i0.Input,
|
|
1744
|
+
args: [{
|
|
1745
|
+
isSignal: true,
|
|
1746
|
+
alias: "clearSelectionLabel",
|
|
1747
|
+
required: false
|
|
1748
|
+
}]
|
|
1749
|
+
}],
|
|
1750
|
+
expandLabel: [{
|
|
1751
|
+
type: i0.Input,
|
|
1752
|
+
args: [{
|
|
1753
|
+
isSignal: true,
|
|
1754
|
+
alias: "expandLabel",
|
|
1755
|
+
required: false
|
|
1756
|
+
}]
|
|
1757
|
+
}],
|
|
1758
|
+
collapseLabel: [{
|
|
1759
|
+
type: i0.Input,
|
|
1760
|
+
args: [{
|
|
1761
|
+
isSignal: true,
|
|
1762
|
+
alias: "collapseLabel",
|
|
1763
|
+
required: false
|
|
1764
|
+
}]
|
|
1765
|
+
}],
|
|
1766
|
+
loadingLabel: [{
|
|
1767
|
+
type: i0.Input,
|
|
1768
|
+
args: [{
|
|
1769
|
+
isSignal: true,
|
|
1770
|
+
alias: "loadingLabel",
|
|
1771
|
+
required: false
|
|
1772
|
+
}]
|
|
1773
|
+
}],
|
|
1774
|
+
loadErrorLabel: [{
|
|
1775
|
+
type: i0.Input,
|
|
1776
|
+
args: [{
|
|
1777
|
+
isSignal: true,
|
|
1778
|
+
alias: "loadErrorLabel",
|
|
1779
|
+
required: false
|
|
1780
|
+
}]
|
|
1781
|
+
}],
|
|
1782
|
+
retryLabel: [{
|
|
1783
|
+
type: i0.Input,
|
|
1784
|
+
args: [{
|
|
1785
|
+
isSignal: true,
|
|
1786
|
+
alias: "retryLabel",
|
|
1787
|
+
required: false
|
|
1788
|
+
}]
|
|
1789
|
+
}],
|
|
1790
|
+
noMatchesLabel: [{
|
|
1791
|
+
type: i0.Input,
|
|
1792
|
+
args: [{
|
|
1793
|
+
isSignal: true,
|
|
1794
|
+
alias: "noMatchesLabel",
|
|
1795
|
+
required: false
|
|
1796
|
+
}]
|
|
1797
|
+
}],
|
|
1798
|
+
moveHelpLabel: [{
|
|
1799
|
+
type: i0.Input,
|
|
1800
|
+
args: [{
|
|
1801
|
+
isSignal: true,
|
|
1802
|
+
alias: "moveHelpLabel",
|
|
1803
|
+
required: false
|
|
1804
|
+
}]
|
|
1805
|
+
}],
|
|
957
1806
|
panelTpl: [{
|
|
958
1807
|
type: i0.ViewChild,
|
|
959
1808
|
args: ["panelTpl", {
|
|
@@ -963,6 +1812,56 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
963
1812
|
}]
|
|
964
1813
|
}
|
|
965
1814
|
});
|
|
966
|
-
|
|
1815
|
+
/**
|
|
1816
|
+
* @license
|
|
1817
|
+
*
|
|
1818
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1819
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
1820
|
+
*/
|
|
1821
|
+
function without(list, id) {
|
|
1822
|
+
let changed = false;
|
|
1823
|
+
const out = [];
|
|
1824
|
+
for (const node of list) {
|
|
1825
|
+
if (node.id === id) {
|
|
1826
|
+
changed = true;
|
|
1827
|
+
continue;
|
|
1828
|
+
}
|
|
1829
|
+
const children = node.children && without(node.children, id);
|
|
1830
|
+
if (children !== node.children) {
|
|
1831
|
+
changed = true;
|
|
1832
|
+
out.push({
|
|
1833
|
+
...node,
|
|
1834
|
+
children
|
|
1835
|
+
});
|
|
1836
|
+
} else out.push(node);
|
|
1837
|
+
}
|
|
1838
|
+
return changed ? out : list;
|
|
1839
|
+
}
|
|
1840
|
+
function insert(list, parentId, index, node) {
|
|
1841
|
+
if (parentId === null) {
|
|
1842
|
+
const out = list.slice();
|
|
1843
|
+
out.splice(index, 0, node);
|
|
1844
|
+
return out;
|
|
1845
|
+
}
|
|
1846
|
+
let changed = false;
|
|
1847
|
+
const out = list.map((item) => {
|
|
1848
|
+
let next = item.children;
|
|
1849
|
+
if (item.id === parentId) next = insert(item.children ?? [], null, index, node);
|
|
1850
|
+
else if (item.children) next = insert(item.children, parentId, index, node);
|
|
1851
|
+
if (next === item.children) return item;
|
|
1852
|
+
changed = true;
|
|
1853
|
+
return {
|
|
1854
|
+
...item,
|
|
1855
|
+
children: next
|
|
1856
|
+
};
|
|
1857
|
+
});
|
|
1858
|
+
return changed ? out : list;
|
|
1859
|
+
}
|
|
1860
|
+
function wrMoveTreeNode(nodes, move) {
|
|
1861
|
+
const rest = without(nodes, move.node.id);
|
|
1862
|
+
const moved = insert(rest, move.to.parentId, move.to.index, move.node);
|
|
1863
|
+
return moved === rest ? nodes : moved;
|
|
1864
|
+
}
|
|
1865
|
+
export { WrTree, wrMoveTreeNode };
|
|
967
1866
|
|
|
968
1867
|
//# sourceMappingURL=ngwr-tree.mjs.map
|