ngwr 16.1.0 → 16.3.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/cascader/styles/_rules.scss +7 -0
- package/color-picker/styles/_index.scss +21 -0
- package/date-picker/styles/_index.scss +108 -1
- package/dropdown/styles/_index.scss +40 -10
- 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.mjs +6 -6
- package/fesm2022/ngwr-cascader.mjs +37 -16
- 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 +12 -12
- 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 +48 -4
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +492 -75
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +76 -12
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +144 -12
- 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 +48 -5
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +407 -116
- 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 +274 -15
- 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 +3 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +102 -42
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +6 -6
- package/fesm2022/ngwr-i18n-ar.mjs +26 -6
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +26 -6
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +26 -6
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +26 -6
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +26 -6
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +26 -6
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +26 -6
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +26 -6
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +26 -6
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +26 -6
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +26 -6
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +26 -6
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +26 -6
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +26 -6
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +26 -6
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +26 -6
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +26 -6
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +26 -6
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +26 -6
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +26 -6
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +26 -6
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +26 -6
- 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-testing.mjs +26 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +249 -13
- 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 +5 -3
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +57 -33
- 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 +418 -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 +263 -83
- 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 +23 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +108 -14
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
- package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sortable-list.mjs +284 -63
- 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 +88 -2
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +891 -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.mjs +6 -6
- 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 +966 -78
- 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 +34 -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/i18n/ar.json +28 -6
- package/i18n/cs.json +28 -6
- package/i18n/de.json +28 -6
- package/i18n/en.json +28 -6
- package/i18n/es.json +28 -6
- package/i18n/fr.json +28 -6
- package/i18n/he.json +28 -6
- package/i18n/hi.json +28 -6
- package/i18n/id.json +28 -6
- package/i18n/it.json +28 -6
- package/i18n/ja.json +28 -6
- package/i18n/ko.json +28 -6
- package/i18n/nl.json +28 -6
- package/i18n/pl.json +28 -6
- package/i18n/pt.json +28 -6
- package/i18n/ru.json +28 -6
- package/i18n/sv.json +28 -6
- package/i18n/tr.json +28 -6
- package/i18n/uk.json +28 -6
- package/i18n/vi.json +28 -6
- package/i18n/zh-TW.json +28 -6
- package/i18n/zh.json +28 -6
- package/input/styles/_index.scss +68 -1
- package/input-otp/styles/_index.scss +14 -0
- package/lightbox/styles/_rules.scss +96 -0
- package/llms-full.txt +61 -25
- package/llms.txt +12 -0
- package/overlay/styles/_arrow.scss +4 -4
- package/package.json +37 -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/use/rule.js +2 -0
- package/schematics/use/symbol-map.json +5 -0
- package/select/styles/_index.scss +114 -22
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +11 -2
- package/slider/styles/_index.scss +128 -0
- package/sortable-list/styles/_rules.scss +23 -1
- package/table/styles/_index.scss +167 -3
- package/textarea/styles/_index.scss +80 -0
- package/theme/styles/_focus.scss +5 -0
- 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-cascader.d.ts +10 -1
- 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-date-picker-testing.d.ts +40 -8
- package/types/ngwr-date-picker.d.ts +178 -10
- package/types/ngwr-date-stamp-testing.d.ts +1 -1
- package/types/ngwr-date-stamp.d.ts +53 -7
- package/types/ngwr-date.d.ts +188 -15
- package/types/ngwr-drawer.d.ts +9 -0
- package/types/ngwr-dropdown-testing.d.ts +73 -5
- package/types/ngwr-dropdown.d.ts +124 -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 +148 -1
- package/types/ngwr-form.d.ts +47 -3
- package/types/ngwr-graph-testing.d.ts +8 -3
- package/types/ngwr-graph.d.ts +147 -7
- 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-lightbox-testing.d.ts +27 -0
- package/types/ngwr-lightbox.d.ts +71 -6
- package/types/ngwr-overlay.d.ts +84 -5
- package/types/ngwr-pipes.d.ts +34 -13
- 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 +112 -11
- package/types/ngwr-sidebar-testing.d.ts +176 -0
- package/types/ngwr-slider-testing.d.ts +10 -1
- package/types/ngwr-slider.d.ts +109 -3
- package/types/ngwr-sortable-list-testing.d.ts +79 -0
- package/types/ngwr-sortable-list.d.ts +119 -10
- package/types/ngwr-stepper.d.ts +20 -11
- package/types/ngwr-table-testing.d.ts +70 -6
- package/types/ngwr-table.d.ts +480 -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-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 +333 -12
- package/types/ngwr-utils.d.ts +28 -0
- 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
5
|
import { wrCheckStyles, wrToClassList } 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,197 @@ 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 });
|
|
85
131
|
focusedIndex = signal(0, ...ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []);
|
|
86
132
|
cursorId = signal(null, ...ngDevMode ? [{ debugName: "cursorId" }] : /* istanbul ignore next */ []);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const
|
|
133
|
+
lazy = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "lazy" }] : /* istanbul ignore next */ []);
|
|
134
|
+
lookup = computed(() => {
|
|
135
|
+
const lazy = this.lazy();
|
|
136
|
+
const byId = /* @__PURE__ */ new Map();
|
|
137
|
+
const parents = /* @__PURE__ */ new Map();
|
|
138
|
+
const cached = /* @__PURE__ */ new Set();
|
|
139
|
+
const walk = (list, parent, inCache) => {
|
|
90
140
|
for (const n of list) {
|
|
91
|
-
|
|
92
|
-
if (
|
|
141
|
+
byId.set(n.id, n);
|
|
142
|
+
if (parent !== null) parents.set(n.id, parent.id);
|
|
143
|
+
if (inCache) cached.add(n.id);
|
|
144
|
+
const children = childrenOf(n, lazy);
|
|
145
|
+
if (children.length) walk(children, n, inCache || !n.children);
|
|
93
146
|
}
|
|
94
147
|
};
|
|
95
|
-
walk(this.nodes(), null);
|
|
96
|
-
return
|
|
97
|
-
|
|
148
|
+
walk(this.nodes(), null, false);
|
|
149
|
+
return {
|
|
150
|
+
byId,
|
|
151
|
+
parents,
|
|
152
|
+
cached
|
|
153
|
+
};
|
|
154
|
+
}, ...ngDevMode ? [{ debugName: "lookup" }] : /* istanbul ignore next */ []);
|
|
155
|
+
parentMap = computed(() => this.lookup().parents, ...ngDevMode ? [{ debugName: "parentMap" }] : /* istanbul ignore next */ []);
|
|
98
156
|
cursorIndex = computed(() => {
|
|
99
|
-
const flat = this.flat();
|
|
100
157
|
const cursor = this.cursorId();
|
|
101
158
|
if (cursor) {
|
|
159
|
+
const rows = this.flatIndex();
|
|
102
160
|
const parents = this.parentMap();
|
|
103
161
|
for (let id = cursor.id; id !== void 0; id = parents.get(id)) {
|
|
104
|
-
const at =
|
|
105
|
-
if (at !==
|
|
162
|
+
const at = rows.get(id);
|
|
163
|
+
if (at !== void 0) return at;
|
|
106
164
|
}
|
|
107
165
|
}
|
|
108
|
-
return Math.min(this.focusedIndex(), Math.max(0, flat.length - 1));
|
|
166
|
+
return Math.min(this.focusedIndex(), Math.max(0, this.flat().length - 1));
|
|
109
167
|
}, ...ngDevMode ? [{ debugName: "cursorIndex" }] : /* istanbul ignore next */ []);
|
|
110
|
-
|
|
111
|
-
expandLabel =
|
|
112
|
-
collapseLabel =
|
|
168
|
+
clearSelectionLabel = input(null, ...ngDevMode ? [{ debugName: "clearSelectionLabel" }] : /* istanbul ignore next */ []);
|
|
169
|
+
expandLabel = input(null, ...ngDevMode ? [{ debugName: "expandLabel" }] : /* istanbul ignore next */ []);
|
|
170
|
+
collapseLabel = input(null, ...ngDevMode ? [{ debugName: "collapseLabel" }] : /* istanbul ignore next */ []);
|
|
171
|
+
loadingLabel = input(null, ...ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []);
|
|
172
|
+
loadErrorLabel = input(null, ...ngDevMode ? [{ debugName: "loadErrorLabel" }] : /* istanbul ignore next */ []);
|
|
173
|
+
retryLabel = input(null, ...ngDevMode ? [{ debugName: "retryLabel" }] : /* istanbul ignore next */ []);
|
|
174
|
+
noMatchesLabel = input(null, ...ngDevMode ? [{ debugName: "noMatchesLabel" }] : /* istanbul ignore next */ []);
|
|
175
|
+
moveHelpLabel = input(null, ...ngDevMode ? [{ debugName: "moveHelpLabel" }] : /* istanbul ignore next */ []);
|
|
176
|
+
resolvedLoadingLabel = useI18nText(this.loadingLabel, "select.loading", "Loading…");
|
|
177
|
+
resolvedLoadErrorLabel = useI18nText(this.loadErrorLabel, "loadState.failed", "Could not load");
|
|
178
|
+
resolvedNoMatchesLabel = useI18nText(this.noMatchesLabel, "select.noResults", "No results");
|
|
179
|
+
resolvedRetryLabel = useI18nText(this.retryLabel, "loadState.retry", "Try again");
|
|
180
|
+
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.");
|
|
181
|
+
grabbedText = useI18nFormatter("sortableList.grabbed", "Grabbed. {{index}} of {{total}}.");
|
|
182
|
+
movedText = useI18nFormatter("sortableList.moved", "{{index}} of {{total}}.");
|
|
183
|
+
droppedText = useI18nFormatter("sortableList.dropped", "Dropped. {{index}} of {{total}}.");
|
|
184
|
+
cancelledText = wrReadI18nText("sortableList.cancelled", "Move cancelled.");
|
|
185
|
+
resolvedClearSelectionLabel = useI18nText(this.clearSelectionLabel, "tree.clearSelection", "Clear selection");
|
|
186
|
+
resolvedExpandLabel = useI18nText(this.expandLabel, "tree.expand", "Expand");
|
|
187
|
+
resolvedCollapseLabel = useI18nText(this.collapseLabel, "tree.collapse", "Collapse");
|
|
113
188
|
chipRemoveLabel = useI18nFormatter("tree.removeItem", "Remove {{label}}");
|
|
114
189
|
chipMoreLabel = useI18nFormatter("tree.more", "+{{count}} more");
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
190
|
+
filterQuery = computed(() => (this.filter() ?? "").trim(), ...ngDevMode ? [{ debugName: "filterQuery" }] : /* istanbul ignore next */ []);
|
|
191
|
+
filterView = computed(() => {
|
|
192
|
+
const query = this.filterQuery();
|
|
193
|
+
if (!query) return null;
|
|
194
|
+
const lazy = this.lazy();
|
|
195
|
+
const custom = this.filterFn();
|
|
196
|
+
const needle = query.toLowerCase();
|
|
197
|
+
const matches = (node) => custom ? custom(node, query) : node.label.toLowerCase().includes(needle);
|
|
198
|
+
const visible = /* @__PURE__ */ new Set();
|
|
199
|
+
const opened = /* @__PURE__ */ new Set();
|
|
200
|
+
const walk = (list) => {
|
|
201
|
+
let any = false;
|
|
202
|
+
for (const node of list) {
|
|
203
|
+
const below = walk(childrenOf(node, lazy));
|
|
204
|
+
if (below) opened.add(node.id);
|
|
205
|
+
if (below || matches(node)) {
|
|
206
|
+
visible.add(node.id);
|
|
207
|
+
any = true;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return any;
|
|
211
|
+
};
|
|
212
|
+
walk(this.nodes());
|
|
213
|
+
return {
|
|
214
|
+
visible,
|
|
215
|
+
opened
|
|
216
|
+
};
|
|
217
|
+
}, ...ngDevMode ? [{ debugName: "filterView" }] : /* istanbul ignore next */ []);
|
|
218
|
+
filterToggles = signal({
|
|
219
|
+
query: "",
|
|
220
|
+
open: /* @__PURE__ */ new Map()
|
|
221
|
+
}, ...ngDevMode ? [{ debugName: "filterToggles" }] : /* istanbul ignore next */ []);
|
|
222
|
+
statusKeys = /* @__PURE__ */ new Map();
|
|
223
|
+
view = computed(() => {
|
|
224
|
+
const expanded = this.expandedSet();
|
|
225
|
+
const lazy = this.lazy();
|
|
226
|
+
const visible = this.filterView()?.visible ?? null;
|
|
227
|
+
const canLoad = this.loadChildren() !== null;
|
|
228
|
+
const rows = [];
|
|
229
|
+
const toLoad = [];
|
|
118
230
|
const walk = (list, depth) => {
|
|
119
|
-
list.
|
|
120
|
-
|
|
121
|
-
|
|
231
|
+
const shown = visible ? list.filter((n) => visible.has(n.id)) : list;
|
|
232
|
+
shown.forEach((node, i) => {
|
|
233
|
+
const state = lazy.get(node.id)?.status;
|
|
234
|
+
const unloaded = isLazy(node) && state !== "loaded";
|
|
235
|
+
const children = childrenOf(node, lazy);
|
|
236
|
+
const hasChildren = unloaded || (visible ? children.some((c) => visible.has(c.id)) : children.length > 0);
|
|
237
|
+
rows.push({
|
|
122
238
|
node,
|
|
123
239
|
depth,
|
|
124
240
|
hasChildren,
|
|
125
|
-
index:
|
|
241
|
+
index: rows.length,
|
|
126
242
|
posinset: i + 1,
|
|
127
|
-
setsize:
|
|
243
|
+
setsize: shown.length,
|
|
244
|
+
key: node.id,
|
|
245
|
+
status: null,
|
|
246
|
+
busy: state === "loading"
|
|
247
|
+
});
|
|
248
|
+
if (!hasChildren || !expanded.has(node.id)) return;
|
|
249
|
+
if (!unloaded) {
|
|
250
|
+
walk(children, depth + 1);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const status = state === "error" ? "error" : canLoad ? "loading" : null;
|
|
254
|
+
if (!status) return;
|
|
255
|
+
if (!state) toLoad.push(node);
|
|
256
|
+
let key = this.statusKeys.get(node.id);
|
|
257
|
+
if (!key) this.statusKeys.set(node.id, key = {});
|
|
258
|
+
rows.push({
|
|
259
|
+
node,
|
|
260
|
+
depth: depth + 1,
|
|
261
|
+
hasChildren: false,
|
|
262
|
+
index: rows.length,
|
|
263
|
+
posinset: 1,
|
|
264
|
+
setsize: 1,
|
|
265
|
+
key,
|
|
266
|
+
status,
|
|
267
|
+
busy: false
|
|
128
268
|
});
|
|
129
|
-
if (hasChildren && expanded.has(node.id)) walk(node.children, depth + 1);
|
|
130
269
|
});
|
|
131
270
|
};
|
|
132
271
|
walk(this.nodes(), 0);
|
|
133
|
-
return
|
|
134
|
-
|
|
272
|
+
return {
|
|
273
|
+
rows,
|
|
274
|
+
toLoad
|
|
275
|
+
};
|
|
276
|
+
}, ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
277
|
+
flat = computed(() => this.view().rows, ...ngDevMode ? [{ debugName: "flat" }] : /* istanbul ignore next */ []);
|
|
278
|
+
flatIndex = computed(() => {
|
|
279
|
+
const map = /* @__PURE__ */ new Map();
|
|
280
|
+
for (const row of this.flat()) if (!row.status && !map.has(row.node.id)) map.set(row.node.id, row.index);
|
|
281
|
+
return map;
|
|
282
|
+
}, ...ngDevMode ? [{ debugName: "flatIndex" }] : /* istanbul ignore next */ []);
|
|
135
283
|
selectedSet = computed(() => new Set(this.selected()), ...ngDevMode ? [{ debugName: "selectedSet" }] : /* istanbul ignore next */ []);
|
|
136
|
-
expandedSet = computed(() =>
|
|
284
|
+
expandedSet = computed(() => {
|
|
285
|
+
const set = new Set(this.expanded());
|
|
286
|
+
const view = this.filterView();
|
|
287
|
+
if (!view) return set;
|
|
288
|
+
for (const id of view.opened) set.add(id);
|
|
289
|
+
const toggles = this.filterToggles();
|
|
290
|
+
if (toggles.query !== this.filterQuery()) return set;
|
|
291
|
+
for (const [id, open] of toggles.open) if (open) set.add(id);
|
|
292
|
+
else set.delete(id);
|
|
293
|
+
return set;
|
|
294
|
+
}, ...ngDevMode ? [{ debugName: "expandedSet" }] : /* istanbul ignore next */ []);
|
|
295
|
+
isCascade = computed(() => this.cascade() && this.selectionMode() === "multi", ...ngDevMode ? [{ debugName: "isCascade" }] : /* istanbul ignore next */ []);
|
|
296
|
+
mixedSet = computed(() => {
|
|
297
|
+
const mixed = /* @__PURE__ */ new Set();
|
|
298
|
+
if (!this.isCascade()) return mixed;
|
|
299
|
+
const selected = this.selectedSet();
|
|
300
|
+
const lazy = this.lazy();
|
|
301
|
+
const walk = (list) => {
|
|
302
|
+
let any = false;
|
|
303
|
+
for (const node of list) {
|
|
304
|
+
const below = walk(childrenOf(node, lazy));
|
|
305
|
+
const own = selected.has(node.id);
|
|
306
|
+
if (below && !own) mixed.add(node.id);
|
|
307
|
+
if (below || own) any = true;
|
|
308
|
+
}
|
|
309
|
+
return any;
|
|
310
|
+
};
|
|
311
|
+
walk(this.nodes());
|
|
312
|
+
return mixed;
|
|
313
|
+
}, ...ngDevMode ? [{ debugName: "mixedSet" }] : /* istanbul ignore next */ []);
|
|
137
314
|
isOverlay = computed(() => this.openOn() === "overlay", ...ngDevMode ? [{ debugName: "isOverlay" }] : /* istanbul ignore next */ []);
|
|
138
315
|
isMulti = computed(() => this.selectionMode() === "multi", ...ngDevMode ? [{ debugName: "isMulti" }] : /* istanbul ignore next */ []);
|
|
139
316
|
hasSelection = computed(() => this.selected().length > 0, ...ngDevMode ? [{ debugName: "hasSelection" }] : /* istanbul ignore next */ []);
|
|
140
317
|
labelMap = computed(() => {
|
|
141
318
|
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());
|
|
319
|
+
for (const [id, node] of this.lookup().byId) map.set(id, node.label);
|
|
149
320
|
return map;
|
|
150
321
|
}, ...ngDevMode ? [{ debugName: "labelMap" }] : /* istanbul ignore next */ []);
|
|
151
322
|
selectedChips = computed(() => {
|
|
@@ -171,7 +342,8 @@ var WrTree = class WrTree {
|
|
|
171
342
|
if (first == null) return null;
|
|
172
343
|
return this.labelMap().get(first) ?? null;
|
|
173
344
|
}, ...ngDevMode ? [{ debugName: "singleLabel" }] : /* istanbul ignore next */ []);
|
|
174
|
-
|
|
345
|
+
openState = signal(false, ...ngDevMode ? [{ debugName: "openState" }] : /* istanbul ignore next */ []);
|
|
346
|
+
isOpen = this.openState.asReadonly();
|
|
175
347
|
panelId = `wr-tree-panel-${++panelUid}`;
|
|
176
348
|
classes = computed(() => {
|
|
177
349
|
const parts = [];
|
|
@@ -278,7 +450,7 @@ var WrTree = class WrTree {
|
|
|
278
450
|
}
|
|
279
451
|
});
|
|
280
452
|
effect(() => {
|
|
281
|
-
if (this.disabled() || this.readonly()) this.
|
|
453
|
+
if (this.disabled() || this.readonly()) this.openState.set(false);
|
|
282
454
|
});
|
|
283
455
|
effect(() => {
|
|
284
456
|
const value = this.value();
|
|
@@ -331,15 +503,33 @@ var WrTree = class WrTree {
|
|
|
331
503
|
ro?.disconnect();
|
|
332
504
|
});
|
|
333
505
|
});
|
|
334
|
-
|
|
506
|
+
effect(() => {
|
|
507
|
+
if (!isPlatformBrowser(this.platformId)) return;
|
|
508
|
+
const pending = this.view().toLoad;
|
|
509
|
+
if (pending.length) untracked(() => pending.forEach((node) => this.load(node)));
|
|
510
|
+
});
|
|
511
|
+
this.destroyRef.onDestroy(() => {
|
|
512
|
+
this.clearHoverExpand();
|
|
513
|
+
this.closeOverlay(false);
|
|
514
|
+
});
|
|
335
515
|
}
|
|
336
516
|
onRowClick(flat, event) {
|
|
337
517
|
if (this.disabled() || flat.node.disabled) return;
|
|
518
|
+
if (flat.status) {
|
|
519
|
+
this.focusIndex(flat.index);
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
338
522
|
if (flat.hasChildren && event.target.closest(".wr-tree__toggle")) {
|
|
339
523
|
this.toggleExpanded(flat.node.id);
|
|
340
524
|
return;
|
|
341
525
|
}
|
|
342
526
|
this.focusIndex(flat.index);
|
|
527
|
+
if (flat.hasChildren && this.expandOnClick()) {
|
|
528
|
+
if (!(this.isCascade() && !!event.target.closest(".wr-tree__check"))) {
|
|
529
|
+
this.toggleExpanded(flat.node.id);
|
|
530
|
+
if (this.isCascade()) return;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
343
533
|
this.select(flat.node.id, event.ctrlKey || event.metaKey);
|
|
344
534
|
}
|
|
345
535
|
onToggleClick(node, event) {
|
|
@@ -359,6 +549,15 @@ var WrTree = class WrTree {
|
|
|
359
549
|
const i = this.cursorIndex();
|
|
360
550
|
const current = flat[i];
|
|
361
551
|
if (!current) return;
|
|
552
|
+
if (this.move()?.keyboard) {
|
|
553
|
+
this.onMoveKey(event);
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
if (this.draggable() && event.altKey && event.key === "Enter") {
|
|
557
|
+
event.preventDefault();
|
|
558
|
+
if (this.canDrag(current)) this.grab(current);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
362
561
|
switch (this.inlineKey(event.key)) {
|
|
363
562
|
case "ArrowDown":
|
|
364
563
|
event.preventDefault();
|
|
@@ -394,7 +593,9 @@ var WrTree = class WrTree {
|
|
|
394
593
|
case "Enter":
|
|
395
594
|
case " ":
|
|
396
595
|
event.preventDefault();
|
|
397
|
-
if (
|
|
596
|
+
if (current.status) {
|
|
597
|
+
if (current.status === "error") this.retryLoad(current.node);
|
|
598
|
+
} else if (!current.node.disabled) this.select(current.node.id, event.ctrlKey || event.metaKey);
|
|
398
599
|
}
|
|
399
600
|
}
|
|
400
601
|
focus(options) {
|
|
@@ -407,14 +608,14 @@ var WrTree = class WrTree {
|
|
|
407
608
|
}
|
|
408
609
|
open() {
|
|
409
610
|
if (!this.isOverlay() || this.disabled() || this.readonly()) return;
|
|
410
|
-
this.
|
|
611
|
+
this.openState.set(true);
|
|
411
612
|
}
|
|
412
613
|
close() {
|
|
413
|
-
this.
|
|
614
|
+
this.openState.set(false);
|
|
414
615
|
}
|
|
415
616
|
onTriggerClick() {
|
|
416
617
|
if (this.disabled() || this.readonly()) return;
|
|
417
|
-
this.
|
|
618
|
+
this.openState.update((v) => !v);
|
|
418
619
|
}
|
|
419
620
|
onFocusOut(event) {
|
|
420
621
|
const next = event.relatedTarget;
|
|
@@ -428,7 +629,7 @@ var WrTree = class WrTree {
|
|
|
428
629
|
if ((event.key === "ArrowDown" || event.key === "ArrowUp") && !this.isOpen()) {
|
|
429
630
|
if (this.disabled() || this.readonly()) return;
|
|
430
631
|
event.preventDefault();
|
|
431
|
-
this.
|
|
632
|
+
this.openState.set(true);
|
|
432
633
|
return;
|
|
433
634
|
}
|
|
434
635
|
if (event.key !== "Backspace") return;
|
|
@@ -448,8 +649,8 @@ var WrTree = class WrTree {
|
|
|
448
649
|
removeChip(id, event) {
|
|
449
650
|
event.stopPropagation();
|
|
450
651
|
if (this.disabled() || this.readonly()) return;
|
|
451
|
-
|
|
452
|
-
this.selected.set(
|
|
652
|
+
if (this.isCascade()) this.setChecked(id, false);
|
|
653
|
+
else this.selected.set(this.selected().filter((x) => x !== id));
|
|
453
654
|
this.emit();
|
|
454
655
|
}
|
|
455
656
|
clearSelection(event) {
|
|
@@ -459,20 +660,32 @@ var WrTree = class WrTree {
|
|
|
459
660
|
this.emit();
|
|
460
661
|
}
|
|
461
662
|
toggleExpanded(id) {
|
|
462
|
-
const
|
|
463
|
-
const
|
|
464
|
-
if (
|
|
465
|
-
|
|
466
|
-
|
|
663
|
+
const collapsing = this.expandedSet().has(id);
|
|
664
|
+
const query = this.filterQuery();
|
|
665
|
+
if (query) {
|
|
666
|
+
const toggles = this.filterToggles();
|
|
667
|
+
const open = new Map(toggles.query === query ? toggles.open : []);
|
|
668
|
+
open.set(id, !collapsing);
|
|
669
|
+
this.filterToggles.set({
|
|
670
|
+
query,
|
|
671
|
+
open
|
|
672
|
+
});
|
|
673
|
+
} else {
|
|
674
|
+
const set = new Set(this.expanded());
|
|
675
|
+
if (collapsing) set.delete(id);
|
|
676
|
+
else set.add(id);
|
|
677
|
+
this.expanded.set([...set]);
|
|
678
|
+
}
|
|
467
679
|
if (!collapsing) return;
|
|
468
680
|
const row = this.flat()[this.cursorIndex()];
|
|
469
|
-
if (row) this.cursorId.set({ id: row.node.id });
|
|
681
|
+
if (row && !row.status) this.cursorId.set({ id: row.node.id });
|
|
470
682
|
}
|
|
471
683
|
select(id, additive) {
|
|
472
684
|
if (this.readonly()) return;
|
|
473
685
|
const mode = this.selectionMode();
|
|
474
686
|
if (mode === "none") return;
|
|
475
687
|
if (mode === "single") this.selected.set([id]);
|
|
688
|
+
else if (this.isCascade()) this.setChecked(id, !this.selectedSet().has(id));
|
|
476
689
|
else {
|
|
477
690
|
const set = new Set(this.selected());
|
|
478
691
|
if (additive) {
|
|
@@ -486,17 +699,377 @@ var WrTree = class WrTree {
|
|
|
486
699
|
this.selected.set([...set]);
|
|
487
700
|
}
|
|
488
701
|
this.emit();
|
|
489
|
-
if (this.isOverlay() && mode === "single" && this.selected().length > 0) this.
|
|
702
|
+
if (this.isOverlay() && mode === "single" && this.selected().length > 0) this.openState.set(false);
|
|
490
703
|
}
|
|
491
704
|
emit() {
|
|
492
705
|
this.touch.emit();
|
|
706
|
+
this.writeValue();
|
|
707
|
+
}
|
|
708
|
+
writeValue() {
|
|
493
709
|
if (this.isMulti()) this.value.set(this.selected());
|
|
494
710
|
else this.value.set(this.selected()[0] ?? null);
|
|
495
711
|
}
|
|
712
|
+
setChecked(id, checked) {
|
|
713
|
+
const { byId, parents } = this.lookup();
|
|
714
|
+
const lazy = this.lazy();
|
|
715
|
+
const set = new Set(this.selected());
|
|
716
|
+
const apply = (node) => {
|
|
717
|
+
if (node.disabled) return;
|
|
718
|
+
if (checked) set.add(node.id);
|
|
719
|
+
else set.delete(node.id);
|
|
720
|
+
for (const child of childrenOf(node, lazy)) apply(child);
|
|
721
|
+
};
|
|
722
|
+
const node = byId.get(id);
|
|
723
|
+
if (node) apply(node);
|
|
724
|
+
else set.delete(id);
|
|
725
|
+
for (let up = parents.get(id); up !== void 0; up = parents.get(up)) {
|
|
726
|
+
const parent = byId.get(up);
|
|
727
|
+
if (!parent || parent.disabled) continue;
|
|
728
|
+
const children = childrenOf(parent, lazy).filter((child) => !child.disabled);
|
|
729
|
+
if (!children.length) continue;
|
|
730
|
+
if (children.every((child) => set.has(child.id))) set.add(up);
|
|
731
|
+
else set.delete(up);
|
|
732
|
+
}
|
|
733
|
+
this.selected.set([...set]);
|
|
734
|
+
}
|
|
735
|
+
load(node) {
|
|
736
|
+
const loader = this.loadChildren();
|
|
737
|
+
if (!loader) return;
|
|
738
|
+
const id = node.id;
|
|
739
|
+
const settle = (entry) => {
|
|
740
|
+
const cursor = this.flat()[this.cursorIndex()];
|
|
741
|
+
const active = this.host.nativeElement.ownerDocument.activeElement;
|
|
742
|
+
const held = !!cursor?.status && cursor.node.id === id && !!this.listElement?.contains(active);
|
|
743
|
+
this.lazy.update((map) => new Map(map).set(id, entry));
|
|
744
|
+
if (held && entry.status !== "loading") this.refocusCursor();
|
|
745
|
+
};
|
|
746
|
+
settle({ status: "loading" });
|
|
747
|
+
const done = this.pendingTasks.add();
|
|
748
|
+
let answer;
|
|
749
|
+
try {
|
|
750
|
+
answer = loader(node);
|
|
751
|
+
} catch {
|
|
752
|
+
settle({ status: "error" });
|
|
753
|
+
done();
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
(isObservable(answer) ? answer : from(Promise.resolve(answer))).pipe(take(1), takeUntilDestroyed(this.destroyRef), finalize(done)).subscribe({
|
|
757
|
+
next: (children) => {
|
|
758
|
+
settle({
|
|
759
|
+
status: "loaded",
|
|
760
|
+
children
|
|
761
|
+
});
|
|
762
|
+
if (this.isCascade() && this.selectedSet().has(id)) {
|
|
763
|
+
this.setChecked(id, true);
|
|
764
|
+
this.writeValue();
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
error: () => settle({ status: "error" }),
|
|
768
|
+
complete: () => {
|
|
769
|
+
if (this.lazy().get(id)?.status === "loading") settle({
|
|
770
|
+
status: "loaded",
|
|
771
|
+
children: []
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
retryLoad(node, event) {
|
|
777
|
+
event?.stopPropagation();
|
|
778
|
+
if (this.disabled()) return;
|
|
779
|
+
this.load(node);
|
|
780
|
+
}
|
|
781
|
+
move = signal(null, ...ngDevMode ? [{ debugName: "move" }] : /* istanbul ignore next */ []);
|
|
782
|
+
movingNode = computed(() => this.move()?.node ?? null, ...ngDevMode ? [{ debugName: "movingNode" }] : /* istanbul ignore next */ []);
|
|
783
|
+
announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
|
|
784
|
+
moveHelpId = `${this.panelId}-move-help`;
|
|
785
|
+
listDescribedBy = computed(() => {
|
|
786
|
+
return [this.isOverlay() ? null : this.fieldAria.describedBy(), this.draggable() ? this.moveHelpId : null].filter(Boolean).join(" ") || null;
|
|
787
|
+
}, ...ngDevMode ? [{ debugName: "listDescribedBy" }] : /* istanbul ignore next */ []);
|
|
788
|
+
hoverExpand = null;
|
|
789
|
+
movable = computed(() => this.draggable() && !this.disabled() && !this.filterQuery(), ...ngDevMode ? [{ debugName: "movable" }] : /* istanbul ignore next */ []);
|
|
790
|
+
canDrag(row) {
|
|
791
|
+
return this.movable() && !row.status && !row.node.disabled && !this.lookup().cached.has(row.node.id);
|
|
792
|
+
}
|
|
793
|
+
siblings(parentId, moving) {
|
|
794
|
+
return (parentId === null ? this.nodes() : this.lookup().byId.get(parentId)?.children ?? NO_NODES).filter((node) => node.id !== moving);
|
|
795
|
+
}
|
|
796
|
+
locate(node) {
|
|
797
|
+
const parentId = this.parentMap().get(node.id) ?? null;
|
|
798
|
+
return {
|
|
799
|
+
parentId,
|
|
800
|
+
index: (parentId === null ? this.nodes() : this.lookup().byId.get(parentId)?.children ?? NO_NODES).indexOf(node)
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
allows(node, target) {
|
|
804
|
+
const { byId, parents, cached } = this.lookup();
|
|
805
|
+
let parent = null;
|
|
806
|
+
if (target.parentId !== null) {
|
|
807
|
+
parent = byId.get(target.parentId) ?? null;
|
|
808
|
+
if (!parent || parent.disabled || isLazy(parent) || cached.has(parent.id)) return false;
|
|
809
|
+
for (let id = parent.id; id !== void 0; id = parents.get(id)) if (id === node.id) return false;
|
|
810
|
+
}
|
|
811
|
+
return this.canDrop()?.(node, {
|
|
812
|
+
...target,
|
|
813
|
+
parent
|
|
814
|
+
}) ?? true;
|
|
815
|
+
}
|
|
816
|
+
dropMark = computed(() => {
|
|
817
|
+
const move = this.move();
|
|
818
|
+
const target = move?.target;
|
|
819
|
+
if (!move || !target) return null;
|
|
820
|
+
const rows = this.flat();
|
|
821
|
+
const at = this.flatIndex();
|
|
822
|
+
const siblings = this.siblings(target.parentId, move.node.id);
|
|
823
|
+
let depth = 0;
|
|
824
|
+
if (target.parentId !== null) {
|
|
825
|
+
const parentRow = at.get(target.parentId);
|
|
826
|
+
if (parentRow === void 0) return null;
|
|
827
|
+
depth = rows[parentRow].depth + 1;
|
|
828
|
+
if (!siblings.length || !this.expandedSet().has(target.parentId)) return {
|
|
829
|
+
row: parentRow,
|
|
830
|
+
position: "inside",
|
|
831
|
+
depth
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
if (target.index < siblings.length) {
|
|
835
|
+
const row = at.get(siblings[target.index].id);
|
|
836
|
+
return row === void 0 ? null : {
|
|
837
|
+
row,
|
|
838
|
+
position: "before",
|
|
839
|
+
depth
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
const last = siblings[siblings.length - 1];
|
|
843
|
+
let row = last ? at.get(last.id) : void 0;
|
|
844
|
+
if (row === void 0) return null;
|
|
845
|
+
while (rows[row + 1] && rows[row + 1].depth > depth) row += 1;
|
|
846
|
+
return {
|
|
847
|
+
row,
|
|
848
|
+
position: "after",
|
|
849
|
+
depth
|
|
850
|
+
};
|
|
851
|
+
}, ...ngDevMode ? [{ debugName: "dropMark" }] : /* istanbul ignore next */ []);
|
|
852
|
+
rowOf(event) {
|
|
853
|
+
const target = event.target;
|
|
854
|
+
const el = (target instanceof Element ? target : target instanceof Node ? target.parentElement : null)?.closest("[data-tree-index]");
|
|
855
|
+
const row = el ? this.flat()[Number(el.getAttribute("data-tree-index"))] : void 0;
|
|
856
|
+
return el && row ? {
|
|
857
|
+
row,
|
|
858
|
+
el
|
|
859
|
+
} : null;
|
|
860
|
+
}
|
|
861
|
+
onDragStart(event) {
|
|
862
|
+
const hit = this.rowOf(event);
|
|
863
|
+
if (!hit || !this.canDrag(hit.row)) {
|
|
864
|
+
if (this.draggable()) event.preventDefault();
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
const node = hit.row.node;
|
|
868
|
+
if (event.dataTransfer) {
|
|
869
|
+
event.dataTransfer.effectAllowed = "move";
|
|
870
|
+
event.dataTransfer.setData("text/plain", node.label);
|
|
871
|
+
}
|
|
872
|
+
this.announcement.set("");
|
|
873
|
+
this.move.set({
|
|
874
|
+
node,
|
|
875
|
+
from: this.locate(node),
|
|
876
|
+
keyboard: false,
|
|
877
|
+
target: null
|
|
878
|
+
});
|
|
879
|
+
hit.el.addEventListener("dragend", () => this.endDrag(), { once: true });
|
|
880
|
+
}
|
|
881
|
+
onDragOver(event) {
|
|
882
|
+
const move = this.move();
|
|
883
|
+
if (!move || move.keyboard) return;
|
|
884
|
+
const hit = this.rowOf(event);
|
|
885
|
+
const target = hit && !hit.row.status ? this.pointerTarget(move, hit.row, hit.el, event.clientY) : null;
|
|
886
|
+
if (hit && !hit.row.status) this.restOn(move, hit.row);
|
|
887
|
+
else this.clearHoverExpand();
|
|
888
|
+
if (target) {
|
|
889
|
+
event.preventDefault();
|
|
890
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
891
|
+
}
|
|
892
|
+
if (!sameEnd(move.target, target)) this.move.set({
|
|
893
|
+
...move,
|
|
894
|
+
target
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
onDragLeave(event) {
|
|
898
|
+
const move = this.move();
|
|
899
|
+
if (!move || move.keyboard) return;
|
|
900
|
+
const next = event.relatedTarget;
|
|
901
|
+
if (next instanceof Node && this.listElement?.contains(next)) return;
|
|
902
|
+
this.clearHoverExpand();
|
|
903
|
+
if (move.target) this.move.set({
|
|
904
|
+
...move,
|
|
905
|
+
target: null
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
onDrop(event) {
|
|
909
|
+
const move = this.move();
|
|
910
|
+
if (!move || move.keyboard) return;
|
|
911
|
+
event.preventDefault();
|
|
912
|
+
this.endDrag();
|
|
913
|
+
if (move.target) this.commit(move, move.target);
|
|
914
|
+
}
|
|
915
|
+
endDrag() {
|
|
916
|
+
this.clearHoverExpand();
|
|
917
|
+
if (this.move() && !this.move().keyboard) this.move.set(null);
|
|
918
|
+
}
|
|
919
|
+
pointerTarget(move, row, el, clientY) {
|
|
920
|
+
const { node } = move;
|
|
921
|
+
const over = row.node;
|
|
922
|
+
const rect = el.getBoundingClientRect();
|
|
923
|
+
const ratio = rect.height > 0 ? (clientY - rect.top) / rect.height : .5;
|
|
924
|
+
const parentId = this.parentMap().get(over.id) ?? null;
|
|
925
|
+
const index = this.siblings(parentId, node.id).indexOf(over);
|
|
926
|
+
const open = row.hasChildren && this.expandedSet().has(over.id);
|
|
927
|
+
const inside = {
|
|
928
|
+
parentId: over.id,
|
|
929
|
+
index: this.siblings(over.id, node.id).length
|
|
930
|
+
};
|
|
931
|
+
const before = {
|
|
932
|
+
parentId,
|
|
933
|
+
index
|
|
934
|
+
};
|
|
935
|
+
const after = open ? {
|
|
936
|
+
parentId: over.id,
|
|
937
|
+
index: 0
|
|
938
|
+
} : {
|
|
939
|
+
parentId,
|
|
940
|
+
index: index + 1
|
|
941
|
+
};
|
|
942
|
+
const ok = (target) => (target.parentId === over.id || index >= 0) && !sameEnd(target, move.from) && this.allows(node, target);
|
|
943
|
+
return (ratio < .25 ? [before] : ratio > .75 ? [after] : ratio < .5 ? [inside, before] : [inside, after]).find(ok) ?? null;
|
|
944
|
+
}
|
|
945
|
+
restOn(move, row) {
|
|
946
|
+
const id = row.node.id;
|
|
947
|
+
if (this.hoverExpand?.id === id) return;
|
|
948
|
+
this.clearHoverExpand();
|
|
949
|
+
if (!row.hasChildren || row.node.disabled || id === move.node.id || this.expandedSet().has(id)) return;
|
|
950
|
+
const timer = setTimeout(() => {
|
|
951
|
+
this.hoverExpand = null;
|
|
952
|
+
if (this.move() && !this.expandedSet().has(id)) this.toggleExpanded(id);
|
|
953
|
+
}, HOVER_EXPAND_MS);
|
|
954
|
+
this.hoverExpand = {
|
|
955
|
+
id,
|
|
956
|
+
timer
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
clearHoverExpand() {
|
|
960
|
+
if (this.hoverExpand) clearTimeout(this.hoverExpand.timer);
|
|
961
|
+
this.hoverExpand = null;
|
|
962
|
+
}
|
|
963
|
+
commit(move, to) {
|
|
964
|
+
if (sameEnd(move.from, to)) return;
|
|
965
|
+
if (to.parentId !== null && !this.expanded().includes(to.parentId)) this.expanded.set([...this.expanded(), to.parentId]);
|
|
966
|
+
this.nodeMove.emit({
|
|
967
|
+
node: move.node,
|
|
968
|
+
from: move.from,
|
|
969
|
+
to
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
grab(row) {
|
|
973
|
+
const from = this.locate(row.node);
|
|
974
|
+
this.move.set({
|
|
975
|
+
node: row.node,
|
|
976
|
+
from,
|
|
977
|
+
keyboard: true,
|
|
978
|
+
target: from
|
|
979
|
+
});
|
|
980
|
+
this.announcement.set(this.grabbedText(this.position(row.node, from)));
|
|
981
|
+
}
|
|
982
|
+
onMoveKey(event) {
|
|
983
|
+
const move = this.move();
|
|
984
|
+
const target = move?.target;
|
|
985
|
+
if (!move || !target) return;
|
|
986
|
+
const { node, from } = move;
|
|
987
|
+
const key = this.inlineKey(event.key);
|
|
988
|
+
if (!MOVE_KEYS.has(key)) return;
|
|
989
|
+
event.preventDefault();
|
|
990
|
+
if (key === "Escape") {
|
|
991
|
+
event.stopPropagation();
|
|
992
|
+
this.cancelMove();
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
if (key === "Enter" || key === " ") {
|
|
996
|
+
this.move.set(null);
|
|
997
|
+
this.announcement.set(this.droppedText(this.position(node, target)));
|
|
998
|
+
this.commit(move, target);
|
|
999
|
+
this.refocusCursor();
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
const ok = (to) => sameEnd(to, from) || this.allows(node, to);
|
|
1003
|
+
const siblings = this.siblings(target.parentId, node.id);
|
|
1004
|
+
let next = null;
|
|
1005
|
+
if (key === "ArrowUp" || key === "ArrowDown") {
|
|
1006
|
+
const step = key === "ArrowDown" ? 1 : -1;
|
|
1007
|
+
for (let index = target.index + step; index >= 0 && index <= siblings.length; index += step) if (ok({
|
|
1008
|
+
parentId: target.parentId,
|
|
1009
|
+
index
|
|
1010
|
+
})) {
|
|
1011
|
+
next = {
|
|
1012
|
+
parentId: target.parentId,
|
|
1013
|
+
index
|
|
1014
|
+
};
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
} else if (key === "ArrowRight") {
|
|
1018
|
+
const above = siblings[target.index - 1];
|
|
1019
|
+
if (above) next = {
|
|
1020
|
+
parentId: above.id,
|
|
1021
|
+
index: this.siblings(above.id, node.id).length
|
|
1022
|
+
};
|
|
1023
|
+
} else if (key === "ArrowLeft" && target.parentId !== null) {
|
|
1024
|
+
const parentId = this.parentMap().get(target.parentId) ?? null;
|
|
1025
|
+
const parent = this.lookup().byId.get(target.parentId);
|
|
1026
|
+
if (parent) next = {
|
|
1027
|
+
parentId,
|
|
1028
|
+
index: this.siblings(parentId, node.id).indexOf(parent) + 1
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
if (!next || !ok(next)) return;
|
|
1032
|
+
if (next.parentId !== null && next.parentId !== target.parentId && !this.expandedSet().has(next.parentId)) this.expanded.set([...this.expanded(), next.parentId]);
|
|
1033
|
+
this.move.set({
|
|
1034
|
+
...move,
|
|
1035
|
+
target: next
|
|
1036
|
+
});
|
|
1037
|
+
const place = this.movedText(this.position(node, next));
|
|
1038
|
+
const parent = next.parentId === null ? void 0 : this.lookup().byId.get(next.parentId);
|
|
1039
|
+
this.announcement.set(parent && next.parentId !== target.parentId ? `${parent.label}. ${place}` : place);
|
|
1040
|
+
const mark = this.dropMark();
|
|
1041
|
+
if (mark && this.virtualized()) this.ensureVisible(mark.row);
|
|
1042
|
+
}
|
|
1043
|
+
cancelMove() {
|
|
1044
|
+
if (!this.move()?.keyboard) return;
|
|
1045
|
+
this.move.set(null);
|
|
1046
|
+
this.announcement.set(this.cancelledText());
|
|
1047
|
+
}
|
|
1048
|
+
onListFocusOut(event) {
|
|
1049
|
+
if (!this.move()?.keyboard) return;
|
|
1050
|
+
const next = event.relatedTarget;
|
|
1051
|
+
if (next instanceof Node && this.listElement?.contains(next)) return;
|
|
1052
|
+
this.cancelMove();
|
|
1053
|
+
}
|
|
1054
|
+
position(node, end) {
|
|
1055
|
+
return {
|
|
1056
|
+
index: end.index + 1,
|
|
1057
|
+
total: this.siblings(end.parentId, node.id).length + 1
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
refocusCursor() {
|
|
1061
|
+
if (this.virtualized()) return;
|
|
1062
|
+
afterNextRender(() => {
|
|
1063
|
+
const root = this.overlayRef?.overlayElement ?? this.host.nativeElement;
|
|
1064
|
+
const active = root.ownerDocument.activeElement;
|
|
1065
|
+
if (active && active !== root.ownerDocument.body && !root.contains(active)) return;
|
|
1066
|
+
root.querySelector(`[data-tree-index="${this.cursorIndex()}"]`)?.focus();
|
|
1067
|
+
}, { injector: this.injector });
|
|
1068
|
+
}
|
|
496
1069
|
focusIndex(i) {
|
|
497
1070
|
this.focusedIndex.set(i);
|
|
498
1071
|
const row = this.flat()[i];
|
|
499
|
-
this.cursorId.set(row ? { id: row.node.id } : null);
|
|
1072
|
+
this.cursorId.set(row && !row.status ? { id: row.node.id } : null);
|
|
500
1073
|
if (this.virtualized()) {
|
|
501
1074
|
this.ensureVisible(i);
|
|
502
1075
|
this.listElement?.focus();
|
|
@@ -509,9 +1082,12 @@ var WrTree = class WrTree {
|
|
|
509
1082
|
collectExpandableIds(list) {
|
|
510
1083
|
const out = [];
|
|
511
1084
|
const walk = (items) => {
|
|
512
|
-
for (const n of items)
|
|
513
|
-
|
|
514
|
-
|
|
1085
|
+
for (const n of items) {
|
|
1086
|
+
const children = childrenOf(n, this.lazy());
|
|
1087
|
+
if (children.length) {
|
|
1088
|
+
out.push(n.id);
|
|
1089
|
+
walk(children);
|
|
1090
|
+
}
|
|
515
1091
|
}
|
|
516
1092
|
};
|
|
517
1093
|
walk(list);
|
|
@@ -549,18 +1125,18 @@ var WrTree = class WrTree {
|
|
|
549
1125
|
}, { injector: this.injector });
|
|
550
1126
|
this.outsideClick.outsidePointerEvents(this.overlayRef).pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
551
1127
|
if (this.host.nativeElement.contains(event.target)) return;
|
|
552
|
-
this.
|
|
1128
|
+
this.openState.set(false);
|
|
553
1129
|
});
|
|
554
1130
|
this.overlayRef.keydownEvents().pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
555
1131
|
if (event.key === "Escape") {
|
|
556
1132
|
event.preventDefault();
|
|
557
|
-
this.
|
|
1133
|
+
this.openState.set(false);
|
|
558
1134
|
return;
|
|
559
1135
|
}
|
|
560
1136
|
if (event.key === "Tab") {
|
|
561
1137
|
const typedIn = event.target;
|
|
562
1138
|
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.
|
|
1139
|
+
this.openState.set(false);
|
|
564
1140
|
}
|
|
565
1141
|
});
|
|
566
1142
|
this.opened.emit();
|
|
@@ -577,7 +1153,7 @@ var WrTree = class WrTree {
|
|
|
577
1153
|
}
|
|
578
1154
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
579
1155
|
minVersion: "12.0.0",
|
|
580
|
-
version: "22.2.
|
|
1156
|
+
version: "22.2.6",
|
|
581
1157
|
ngImport: i0,
|
|
582
1158
|
type: WrTree,
|
|
583
1159
|
deps: [],
|
|
@@ -585,7 +1161,7 @@ var WrTree = class WrTree {
|
|
|
585
1161
|
});
|
|
586
1162
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
587
1163
|
minVersion: "17.0.0",
|
|
588
|
-
version: "22.2.
|
|
1164
|
+
version: "22.2.6",
|
|
589
1165
|
type: WrTree,
|
|
590
1166
|
isStandalone: true,
|
|
591
1167
|
selector: "wr-tree",
|
|
@@ -611,6 +1187,13 @@ var WrTree = class WrTree {
|
|
|
611
1187
|
isRequired: false,
|
|
612
1188
|
transformFunction: null
|
|
613
1189
|
},
|
|
1190
|
+
expandOnClick: {
|
|
1191
|
+
classPropertyName: "expandOnClick",
|
|
1192
|
+
publicName: "expandOnClick",
|
|
1193
|
+
isSignal: true,
|
|
1194
|
+
isRequired: false,
|
|
1195
|
+
transformFunction: null
|
|
1196
|
+
},
|
|
614
1197
|
selectionMode: {
|
|
615
1198
|
classPropertyName: "selectionMode",
|
|
616
1199
|
publicName: "selectionMode",
|
|
@@ -716,17 +1299,116 @@ var WrTree = class WrTree {
|
|
|
716
1299
|
isRequired: false,
|
|
717
1300
|
transformFunction: null
|
|
718
1301
|
},
|
|
1302
|
+
loadChildren: {
|
|
1303
|
+
classPropertyName: "loadChildren",
|
|
1304
|
+
publicName: "loadChildren",
|
|
1305
|
+
isSignal: true,
|
|
1306
|
+
isRequired: false,
|
|
1307
|
+
transformFunction: null
|
|
1308
|
+
},
|
|
1309
|
+
filter: {
|
|
1310
|
+
classPropertyName: "filter",
|
|
1311
|
+
publicName: "filter",
|
|
1312
|
+
isSignal: true,
|
|
1313
|
+
isRequired: false,
|
|
1314
|
+
transformFunction: null
|
|
1315
|
+
},
|
|
1316
|
+
filterFn: {
|
|
1317
|
+
classPropertyName: "filterFn",
|
|
1318
|
+
publicName: "filterFn",
|
|
1319
|
+
isSignal: true,
|
|
1320
|
+
isRequired: false,
|
|
1321
|
+
transformFunction: null
|
|
1322
|
+
},
|
|
1323
|
+
cascade: {
|
|
1324
|
+
classPropertyName: "cascade",
|
|
1325
|
+
publicName: "cascade",
|
|
1326
|
+
isSignal: true,
|
|
1327
|
+
isRequired: false,
|
|
1328
|
+
transformFunction: null
|
|
1329
|
+
},
|
|
1330
|
+
draggable: {
|
|
1331
|
+
classPropertyName: "draggable",
|
|
1332
|
+
publicName: "draggable",
|
|
1333
|
+
isSignal: true,
|
|
1334
|
+
isRequired: false,
|
|
1335
|
+
transformFunction: null
|
|
1336
|
+
},
|
|
1337
|
+
canDrop: {
|
|
1338
|
+
classPropertyName: "canDrop",
|
|
1339
|
+
publicName: "canDrop",
|
|
1340
|
+
isSignal: true,
|
|
1341
|
+
isRequired: false,
|
|
1342
|
+
transformFunction: null
|
|
1343
|
+
},
|
|
719
1344
|
value: {
|
|
720
1345
|
classPropertyName: "value",
|
|
721
1346
|
publicName: "value",
|
|
722
1347
|
isSignal: true,
|
|
723
1348
|
isRequired: false,
|
|
724
1349
|
transformFunction: null
|
|
1350
|
+
},
|
|
1351
|
+
clearSelectionLabel: {
|
|
1352
|
+
classPropertyName: "clearSelectionLabel",
|
|
1353
|
+
publicName: "clearSelectionLabel",
|
|
1354
|
+
isSignal: true,
|
|
1355
|
+
isRequired: false,
|
|
1356
|
+
transformFunction: null
|
|
1357
|
+
},
|
|
1358
|
+
expandLabel: {
|
|
1359
|
+
classPropertyName: "expandLabel",
|
|
1360
|
+
publicName: "expandLabel",
|
|
1361
|
+
isSignal: true,
|
|
1362
|
+
isRequired: false,
|
|
1363
|
+
transformFunction: null
|
|
1364
|
+
},
|
|
1365
|
+
collapseLabel: {
|
|
1366
|
+
classPropertyName: "collapseLabel",
|
|
1367
|
+
publicName: "collapseLabel",
|
|
1368
|
+
isSignal: true,
|
|
1369
|
+
isRequired: false,
|
|
1370
|
+
transformFunction: null
|
|
1371
|
+
},
|
|
1372
|
+
loadingLabel: {
|
|
1373
|
+
classPropertyName: "loadingLabel",
|
|
1374
|
+
publicName: "loadingLabel",
|
|
1375
|
+
isSignal: true,
|
|
1376
|
+
isRequired: false,
|
|
1377
|
+
transformFunction: null
|
|
1378
|
+
},
|
|
1379
|
+
loadErrorLabel: {
|
|
1380
|
+
classPropertyName: "loadErrorLabel",
|
|
1381
|
+
publicName: "loadErrorLabel",
|
|
1382
|
+
isSignal: true,
|
|
1383
|
+
isRequired: false,
|
|
1384
|
+
transformFunction: null
|
|
1385
|
+
},
|
|
1386
|
+
retryLabel: {
|
|
1387
|
+
classPropertyName: "retryLabel",
|
|
1388
|
+
publicName: "retryLabel",
|
|
1389
|
+
isSignal: true,
|
|
1390
|
+
isRequired: false,
|
|
1391
|
+
transformFunction: null
|
|
1392
|
+
},
|
|
1393
|
+
noMatchesLabel: {
|
|
1394
|
+
classPropertyName: "noMatchesLabel",
|
|
1395
|
+
publicName: "noMatchesLabel",
|
|
1396
|
+
isSignal: true,
|
|
1397
|
+
isRequired: false,
|
|
1398
|
+
transformFunction: null
|
|
1399
|
+
},
|
|
1400
|
+
moveHelpLabel: {
|
|
1401
|
+
classPropertyName: "moveHelpLabel",
|
|
1402
|
+
publicName: "moveHelpLabel",
|
|
1403
|
+
isSignal: true,
|
|
1404
|
+
isRequired: false,
|
|
1405
|
+
transformFunction: null
|
|
725
1406
|
}
|
|
726
1407
|
},
|
|
727
1408
|
outputs: {
|
|
728
1409
|
selected: "selectedChange",
|
|
729
1410
|
expanded: "expandedChange",
|
|
1411
|
+
nodeMove: "nodeMove",
|
|
730
1412
|
value: "valueChange",
|
|
731
1413
|
touch: "touch",
|
|
732
1414
|
opened: "opened",
|
|
@@ -734,7 +1416,10 @@ var WrTree = class WrTree {
|
|
|
734
1416
|
},
|
|
735
1417
|
host: {
|
|
736
1418
|
listeners: { "focusout": "onFocusOut($event)" },
|
|
737
|
-
properties: {
|
|
1419
|
+
properties: {
|
|
1420
|
+
"class": "classes()",
|
|
1421
|
+
"attr.draggable": "null"
|
|
1422
|
+
},
|
|
738
1423
|
classAttribute: "wr-tree"
|
|
739
1424
|
},
|
|
740
1425
|
viewQueries: [{
|
|
@@ -746,23 +1431,46 @@ var WrTree = class WrTree {
|
|
|
746
1431
|
isSignal: true
|
|
747
1432
|
}],
|
|
748
1433
|
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
|
-
|
|
1434
|
+
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",
|
|
1435
|
+
dependencies: [
|
|
1436
|
+
{
|
|
1437
|
+
kind: "directive",
|
|
1438
|
+
type: NgTemplateOutlet,
|
|
1439
|
+
selector: "[ngTemplateOutlet]",
|
|
1440
|
+
inputs: [
|
|
1441
|
+
"ngTemplateOutletContext",
|
|
1442
|
+
"ngTemplateOutlet",
|
|
1443
|
+
"ngTemplateOutletInjector"
|
|
1444
|
+
]
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
kind: "component",
|
|
1448
|
+
type: WrEmpty,
|
|
1449
|
+
selector: "wr-empty",
|
|
1450
|
+
inputs: [
|
|
1451
|
+
"icon",
|
|
1452
|
+
"iconName",
|
|
1453
|
+
"title"
|
|
1454
|
+
]
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
kind: "component",
|
|
1458
|
+
type: WrSpinner,
|
|
1459
|
+
selector: "wr-spinner",
|
|
1460
|
+
inputs: ["size", "ariaLabel"]
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
kind: "pipe",
|
|
1464
|
+
type: WrMark,
|
|
1465
|
+
name: "wrMark"
|
|
1466
|
+
}
|
|
1467
|
+
],
|
|
760
1468
|
encapsulation: i0.ViewEncapsulation.None
|
|
761
1469
|
});
|
|
762
1470
|
};
|
|
763
1471
|
i0.ɵɵngDeclareClassMetadata({
|
|
764
1472
|
minVersion: "12.0.0",
|
|
765
|
-
version: "22.2.
|
|
1473
|
+
version: "22.2.6",
|
|
766
1474
|
ngImport: i0,
|
|
767
1475
|
type: WrTree,
|
|
768
1476
|
decorators: [{
|
|
@@ -773,10 +1481,16 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
773
1481
|
host: {
|
|
774
1482
|
class: "wr-tree",
|
|
775
1483
|
"[class]": "classes()",
|
|
1484
|
+
"[attr.draggable]": "null",
|
|
776
1485
|
"(focusout)": "onFocusOut($event)"
|
|
777
1486
|
},
|
|
778
|
-
imports: [
|
|
779
|
-
|
|
1487
|
+
imports: [
|
|
1488
|
+
NgTemplateOutlet,
|
|
1489
|
+
WrEmpty,
|
|
1490
|
+
WrMark,
|
|
1491
|
+
WrSpinner
|
|
1492
|
+
],
|
|
1493
|
+
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
1494
|
}]
|
|
781
1495
|
}],
|
|
782
1496
|
ctorParameters: () => [],
|
|
@@ -811,6 +1525,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
811
1525
|
type: i0.Output,
|
|
812
1526
|
args: ["expandedChange"]
|
|
813
1527
|
}],
|
|
1528
|
+
expandOnClick: [{
|
|
1529
|
+
type: i0.Input,
|
|
1530
|
+
args: [{
|
|
1531
|
+
isSignal: true,
|
|
1532
|
+
alias: "expandOnClick",
|
|
1533
|
+
required: false
|
|
1534
|
+
}]
|
|
1535
|
+
}],
|
|
814
1536
|
selectionMode: [{
|
|
815
1537
|
type: i0.Input,
|
|
816
1538
|
args: [{
|
|
@@ -931,6 +1653,58 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
931
1653
|
required: false
|
|
932
1654
|
}]
|
|
933
1655
|
}],
|
|
1656
|
+
loadChildren: [{
|
|
1657
|
+
type: i0.Input,
|
|
1658
|
+
args: [{
|
|
1659
|
+
isSignal: true,
|
|
1660
|
+
alias: "loadChildren",
|
|
1661
|
+
required: false
|
|
1662
|
+
}]
|
|
1663
|
+
}],
|
|
1664
|
+
filter: [{
|
|
1665
|
+
type: i0.Input,
|
|
1666
|
+
args: [{
|
|
1667
|
+
isSignal: true,
|
|
1668
|
+
alias: "filter",
|
|
1669
|
+
required: false
|
|
1670
|
+
}]
|
|
1671
|
+
}],
|
|
1672
|
+
filterFn: [{
|
|
1673
|
+
type: i0.Input,
|
|
1674
|
+
args: [{
|
|
1675
|
+
isSignal: true,
|
|
1676
|
+
alias: "filterFn",
|
|
1677
|
+
required: false
|
|
1678
|
+
}]
|
|
1679
|
+
}],
|
|
1680
|
+
cascade: [{
|
|
1681
|
+
type: i0.Input,
|
|
1682
|
+
args: [{
|
|
1683
|
+
isSignal: true,
|
|
1684
|
+
alias: "cascade",
|
|
1685
|
+
required: false
|
|
1686
|
+
}]
|
|
1687
|
+
}],
|
|
1688
|
+
draggable: [{
|
|
1689
|
+
type: i0.Input,
|
|
1690
|
+
args: [{
|
|
1691
|
+
isSignal: true,
|
|
1692
|
+
alias: "draggable",
|
|
1693
|
+
required: false
|
|
1694
|
+
}]
|
|
1695
|
+
}],
|
|
1696
|
+
canDrop: [{
|
|
1697
|
+
type: i0.Input,
|
|
1698
|
+
args: [{
|
|
1699
|
+
isSignal: true,
|
|
1700
|
+
alias: "canDrop",
|
|
1701
|
+
required: false
|
|
1702
|
+
}]
|
|
1703
|
+
}],
|
|
1704
|
+
nodeMove: [{
|
|
1705
|
+
type: i0.Output,
|
|
1706
|
+
args: ["nodeMove"]
|
|
1707
|
+
}],
|
|
934
1708
|
value: [{
|
|
935
1709
|
type: i0.Input,
|
|
936
1710
|
args: [{
|
|
@@ -954,6 +1728,70 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
954
1728
|
type: i0.Output,
|
|
955
1729
|
args: ["closed"]
|
|
956
1730
|
}],
|
|
1731
|
+
clearSelectionLabel: [{
|
|
1732
|
+
type: i0.Input,
|
|
1733
|
+
args: [{
|
|
1734
|
+
isSignal: true,
|
|
1735
|
+
alias: "clearSelectionLabel",
|
|
1736
|
+
required: false
|
|
1737
|
+
}]
|
|
1738
|
+
}],
|
|
1739
|
+
expandLabel: [{
|
|
1740
|
+
type: i0.Input,
|
|
1741
|
+
args: [{
|
|
1742
|
+
isSignal: true,
|
|
1743
|
+
alias: "expandLabel",
|
|
1744
|
+
required: false
|
|
1745
|
+
}]
|
|
1746
|
+
}],
|
|
1747
|
+
collapseLabel: [{
|
|
1748
|
+
type: i0.Input,
|
|
1749
|
+
args: [{
|
|
1750
|
+
isSignal: true,
|
|
1751
|
+
alias: "collapseLabel",
|
|
1752
|
+
required: false
|
|
1753
|
+
}]
|
|
1754
|
+
}],
|
|
1755
|
+
loadingLabel: [{
|
|
1756
|
+
type: i0.Input,
|
|
1757
|
+
args: [{
|
|
1758
|
+
isSignal: true,
|
|
1759
|
+
alias: "loadingLabel",
|
|
1760
|
+
required: false
|
|
1761
|
+
}]
|
|
1762
|
+
}],
|
|
1763
|
+
loadErrorLabel: [{
|
|
1764
|
+
type: i0.Input,
|
|
1765
|
+
args: [{
|
|
1766
|
+
isSignal: true,
|
|
1767
|
+
alias: "loadErrorLabel",
|
|
1768
|
+
required: false
|
|
1769
|
+
}]
|
|
1770
|
+
}],
|
|
1771
|
+
retryLabel: [{
|
|
1772
|
+
type: i0.Input,
|
|
1773
|
+
args: [{
|
|
1774
|
+
isSignal: true,
|
|
1775
|
+
alias: "retryLabel",
|
|
1776
|
+
required: false
|
|
1777
|
+
}]
|
|
1778
|
+
}],
|
|
1779
|
+
noMatchesLabel: [{
|
|
1780
|
+
type: i0.Input,
|
|
1781
|
+
args: [{
|
|
1782
|
+
isSignal: true,
|
|
1783
|
+
alias: "noMatchesLabel",
|
|
1784
|
+
required: false
|
|
1785
|
+
}]
|
|
1786
|
+
}],
|
|
1787
|
+
moveHelpLabel: [{
|
|
1788
|
+
type: i0.Input,
|
|
1789
|
+
args: [{
|
|
1790
|
+
isSignal: true,
|
|
1791
|
+
alias: "moveHelpLabel",
|
|
1792
|
+
required: false
|
|
1793
|
+
}]
|
|
1794
|
+
}],
|
|
957
1795
|
panelTpl: [{
|
|
958
1796
|
type: i0.ViewChild,
|
|
959
1797
|
args: ["panelTpl", {
|
|
@@ -963,6 +1801,56 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
963
1801
|
}]
|
|
964
1802
|
}
|
|
965
1803
|
});
|
|
966
|
-
|
|
1804
|
+
/**
|
|
1805
|
+
* @license
|
|
1806
|
+
*
|
|
1807
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1808
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
1809
|
+
*/
|
|
1810
|
+
function without(list, id) {
|
|
1811
|
+
let changed = false;
|
|
1812
|
+
const out = [];
|
|
1813
|
+
for (const node of list) {
|
|
1814
|
+
if (node.id === id) {
|
|
1815
|
+
changed = true;
|
|
1816
|
+
continue;
|
|
1817
|
+
}
|
|
1818
|
+
const children = node.children && without(node.children, id);
|
|
1819
|
+
if (children !== node.children) {
|
|
1820
|
+
changed = true;
|
|
1821
|
+
out.push({
|
|
1822
|
+
...node,
|
|
1823
|
+
children
|
|
1824
|
+
});
|
|
1825
|
+
} else out.push(node);
|
|
1826
|
+
}
|
|
1827
|
+
return changed ? out : list;
|
|
1828
|
+
}
|
|
1829
|
+
function insert(list, parentId, index, node) {
|
|
1830
|
+
if (parentId === null) {
|
|
1831
|
+
const out = list.slice();
|
|
1832
|
+
out.splice(index, 0, node);
|
|
1833
|
+
return out;
|
|
1834
|
+
}
|
|
1835
|
+
let changed = false;
|
|
1836
|
+
const out = list.map((item) => {
|
|
1837
|
+
let next = item.children;
|
|
1838
|
+
if (item.id === parentId) next = insert(item.children ?? [], null, index, node);
|
|
1839
|
+
else if (item.children) next = insert(item.children, parentId, index, node);
|
|
1840
|
+
if (next === item.children) return item;
|
|
1841
|
+
changed = true;
|
|
1842
|
+
return {
|
|
1843
|
+
...item,
|
|
1844
|
+
children: next
|
|
1845
|
+
};
|
|
1846
|
+
});
|
|
1847
|
+
return changed ? out : list;
|
|
1848
|
+
}
|
|
1849
|
+
function wrMoveTreeNode(nodes, move) {
|
|
1850
|
+
const rest = without(nodes, move.node.id);
|
|
1851
|
+
const moved = insert(rest, move.to.parentId, move.to.index, move.node);
|
|
1852
|
+
return moved === rest ? nodes : moved;
|
|
1853
|
+
}
|
|
1854
|
+
export { WrTree, wrMoveTreeNode };
|
|
967
1855
|
|
|
968
1856
|
//# sourceMappingURL=ngwr-tree.mjs.map
|