@nanahoshi/mona-ui 0.27.1 → 0.28.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/docs/api/auto-complete.md +67 -0
- package/docs/api/avatar.md +31 -0
- package/docs/api/breadcrumb.md +74 -0
- package/docs/api/button-group.md +71 -0
- package/docs/api/button.md +84 -0
- package/docs/api/calendar.md +123 -0
- package/docs/api/card.md +97 -0
- package/docs/api/chart.md +4380 -0
- package/docs/api/check-box.md +70 -0
- package/docs/api/chip.md +55 -0
- package/docs/api/circular-progress-bar.md +71 -0
- package/docs/api/collapsible.md +71 -0
- package/docs/api/color-gradient.md +54 -0
- package/docs/api/color-palette.md +52 -0
- package/docs/api/color-picker.md +89 -0
- package/docs/api/combo-box.md +69 -0
- package/docs/api/command.md +282 -0
- package/docs/api/common.md +599 -0
- package/docs/api/contextmenu.md +239 -0
- package/docs/api/date-input.md +119 -0
- package/docs/api/date-picker.md +67 -0
- package/docs/api/datetime-picker.md +72 -0
- package/docs/api/dialog.md +291 -0
- package/docs/api/dropdown-button.md +248 -0
- package/docs/api/dropdown-list.md +72 -0
- package/docs/api/dropdowns.md +172 -0
- package/docs/api/editor.md +117 -0
- package/docs/api/expansion-panel.md +85 -0
- package/docs/api/fieldset.md +33 -0
- package/docs/api/filter.md +116 -0
- package/docs/api/grid.md +1445 -0
- package/docs/api/i18n.md +1699 -0
- package/docs/api/label.md +58 -0
- package/docs/api/list-box.md +301 -0
- package/docs/api/list-view.md +294 -0
- package/docs/api/list.md +119 -0
- package/docs/api/locales.md +134 -0
- package/docs/api/menubar.md +275 -0
- package/docs/api/multi-select.md +92 -0
- package/docs/api/notification.md +164 -0
- package/docs/api/numeric-text-box.md +130 -0
- package/docs/api/otp-input.md +100 -0
- package/docs/api/pager.md +371 -0
- package/docs/api/placeholder.md +18 -0
- package/docs/api/popover.md +170 -0
- package/docs/api/popup-menu.md +328 -0
- package/docs/api/popup.md +299 -0
- package/docs/api/progress-bar.md +79 -0
- package/docs/api/query.md +367 -0
- package/docs/api/radio-button.md +113 -0
- package/docs/api/rating.md +187 -0
- package/docs/api/scroll-view.md +93 -0
- package/docs/api/segmented.md +114 -0
- package/docs/api/sheet.md +65 -0
- package/docs/api/sidebar.md +583 -0
- package/docs/api/skeleton.md +26 -0
- package/docs/api/slider.md +173 -0
- package/docs/api/spinner.md +132 -0
- package/docs/api/split-button.md +261 -0
- package/docs/api/splitter.md +57 -0
- package/docs/api/stepper.md +148 -0
- package/docs/api/switch.md +78 -0
- package/docs/api/tabs.md +139 -0
- package/docs/api/text-area.md +20 -0
- package/docs/api/text-box.md +106 -0
- package/docs/api/theme.md +627 -0
- package/docs/api/time-picker.md +69 -0
- package/docs/api/time-selector.md +54 -0
- package/docs/api/tooltip.md +112 -0
- package/docs/api/tree-view.md +631 -0
- package/docs/api/window.md +245 -0
- package/docs/auto-complete.md +28 -329
- package/docs/avatar.md +4 -24
- package/docs/breadcrumb.md +10 -65
- package/docs/button-group.md +7 -60
- package/docs/button.md +8 -67
- package/docs/calendar.md +16 -121
- package/docs/card.md +16 -79
- package/docs/chart-bar.md +16 -234
- package/docs/chart-financial.md +10 -121
- package/docs/chart-funnel.md +13 -176
- package/docs/chart-heatmap.md +15 -131
- package/docs/chart-line-area.md +12 -137
- package/docs/chart-pie.md +17 -221
- package/docs/chart-radar.md +13 -129
- package/docs/chart-radial.md +13 -211
- package/docs/chart-scatter.md +6 -74
- package/docs/chart-treemap.md +14 -196
- package/docs/chart.md +168 -1892
- package/docs/checkbox.md +5 -61
- package/docs/chip.md +7 -42
- package/docs/circular-progress-bar.md +9 -61
- package/docs/collapsible.md +5 -87
- package/docs/color-gradient.md +8 -81
- package/docs/color-palette.md +7 -69
- package/docs/color-picker.md +9 -105
- package/docs/combo-box.md +28 -331
- package/docs/command.md +25 -236
- package/docs/contextmenu.md +15 -140
- package/docs/date-picker.md +7 -110
- package/docs/datetime-picker.md +7 -129
- package/docs/decimal-textbox.md +6 -69
- package/docs/dialog.md +23 -263
- package/docs/dropdown-button.md +15 -146
- package/docs/dropdown-list.md +29 -332
- package/docs/editor.md +10 -164
- package/docs/expansion-panel.md +7 -69
- package/docs/fieldset.md +5 -24
- package/docs/grid-columns.md +12 -92
- package/docs/grid-editing.md +29 -291
- package/docs/grid-grouping.md +11 -50
- package/docs/grid-rows.md +10 -74
- package/docs/grid-selection.md +7 -36
- package/docs/grid-server.md +8 -293
- package/docs/grid-sorting-filtering.md +10 -333
- package/docs/grid-state-export.md +17 -228
- package/docs/grid.md +23 -216
- package/docs/input.md +7 -19
- package/docs/installation.md +147 -15
- package/docs/introduction.md +37 -15
- package/docs/label.md +8 -39
- package/docs/list-box.md +21 -253
- package/docs/list-view.md +25 -232
- package/docs/menubar.md +21 -167
- package/docs/multi-select.md +31 -350
- package/docs/notification.md +17 -116
- package/docs/numeric-textbox.md +9 -78
- package/docs/otp-input.md +9 -95
- package/docs/pager.md +19 -239
- package/docs/placeholder.md +5 -18
- package/docs/popover.md +13 -123
- package/docs/popup-menu.md +22 -243
- package/docs/popup.md +24 -248
- package/docs/progress-bar.md +10 -75
- package/docs/radio-button.md +8 -96
- package/docs/range-slider.md +9 -82
- package/docs/rating.md +15 -163
- package/docs/scroll-view.md +9 -86
- package/docs/segmented.md +8 -90
- package/docs/sheet.md +10 -74
- package/docs/sidebar-menus.md +20 -155
- package/docs/sidebar-state.md +16 -134
- package/docs/sidebar.md +18 -218
- package/docs/skeleton.md +5 -26
- package/docs/slider.md +9 -97
- package/docs/spinner.md +15 -95
- package/docs/split-button.md +21 -166
- package/docs/splitter.md +9 -56
- package/docs/stepper.md +13 -127
- package/docs/switch.md +8 -58
- package/docs/tabs.md +13 -111
- package/docs/textarea.md +4 -13
- package/docs/textbox.md +10 -77
- package/docs/theming-built-in-themes.md +67 -0
- package/docs/theming-custom-colors.md +274 -0
- package/docs/theming-custom-themes.md +168 -0
- package/docs/theming.md +164 -248
- package/docs/time-picker.md +7 -112
- package/docs/tooltip-directive.md +12 -96
- package/docs/tooltip.md +12 -96
- package/docs/tree-view.md +42 -495
- package/docs/window.md +19 -230
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
- package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
- package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -389
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
- package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
- package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -740
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -254
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -729
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
- package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5068
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
- package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
- package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
- package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
- package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
- package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
- package/llms.txt +80 -2
- package/package.json +62 -23
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
- package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
- package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
- package/types/nanahoshi-mona-ui-button.d.ts +227 -166
- package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
- package/types/nanahoshi-mona-ui-card.d.ts +125 -111
- package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
- package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
- package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
- package/types/nanahoshi-mona-ui-collapsible.d.ts +105 -87
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
- package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
- package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
- package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
- package/types/nanahoshi-mona-ui-command.d.ts +279 -191
- package/types/nanahoshi-mona-ui-common.d.ts +360 -385
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
- package/types/nanahoshi-mona-ui-date-input.d.ts +97 -97
- package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
- package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +255 -235
- package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
- package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
- package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
- package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
- package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
- package/types/nanahoshi-mona-ui-i18n.d.ts +999 -1052
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
- package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
- package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
- package/types/nanahoshi-mona-ui-label.d.ts +108 -78
- package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
- package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
- package/types/nanahoshi-mona-ui-list.d.ts +2 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
- package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
- package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
- package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
- package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
- package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
- package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
- package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
- package/types/nanahoshi-mona-ui-query.d.ts +82 -88
- package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
- package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
- package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
- package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
- package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
- package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
- package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
- package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
- package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
- package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
- package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
- package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
- package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
- package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
- package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
- package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
- package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
- package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
- package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
- package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
- package/types/nanahoshi-mona-ui-window.d.ts +494 -399
- package/types/nanahoshi-mona-ui.d.ts +1 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
|
@@ -1,171 +1,221 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import { takeUntilDestroyed } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { twMerge } from
|
|
8
|
-
import {
|
|
9
|
-
import { cva } from
|
|
10
|
-
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, DOCUMENT, DestroyRef, Directive, ElementRef, NgZone, Pipe, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, inject, input, isDevMode, model, output, signal, viewChild } from "@angular/core";
|
|
4
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
5
|
+
import { filter, fromEvent, merge, switchMap, takeUntil, tap } from "rxjs";
|
|
6
|
+
import { createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeRaisedSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
8
|
+
import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
|
|
9
|
+
import { cva } from "class-variance-authority";
|
|
11
10
|
const valueToPosition = (value, min, max) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return 100;
|
|
17
|
-
}
|
|
18
|
-
if (max === min) {
|
|
19
|
-
return 0;
|
|
20
|
-
}
|
|
21
|
-
return ((value - min) / (max - min)) * 100;
|
|
11
|
+
if (value <= min) return 0;
|
|
12
|
+
if (value >= max) return 100;
|
|
13
|
+
if (max === min) return 0;
|
|
14
|
+
return (value - min) / (max - min) * 100;
|
|
22
15
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
16
|
+
var LabelStylePipe = class LabelStylePipe {
|
|
17
|
+
transform(tick, args) {
|
|
18
|
+
const styles = {};
|
|
19
|
+
const { labelPosition, min, max, orientation } = args;
|
|
20
|
+
const valuePosition = valueToPosition(tick.value, min, max);
|
|
21
|
+
const isRtl = args.direction === "rtl";
|
|
22
|
+
if (orientation === "horizontal") {
|
|
23
|
+
if (isRtl) {
|
|
24
|
+
styles.right = `${valuePosition}%`;
|
|
25
|
+
styles.transform = "translateX(50%)";
|
|
26
|
+
} else {
|
|
27
|
+
styles.left = `${valuePosition}%`;
|
|
28
|
+
styles.transform = "translateX(-50%)";
|
|
29
|
+
}
|
|
30
|
+
styles[labelPosition === "before" ? "bottom" : "top"] = "100%";
|
|
31
|
+
} else {
|
|
32
|
+
styles.bottom = `${valuePosition}%`;
|
|
33
|
+
const side = isRtl ? labelPosition === "before" ? "left" : "right" : labelPosition === "before" ? "right" : "left";
|
|
34
|
+
styles[side] = "100%";
|
|
35
|
+
styles.transform = "translateY(50%)";
|
|
36
|
+
}
|
|
37
|
+
return styles;
|
|
38
|
+
}
|
|
39
|
+
static {
|
|
40
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
41
|
+
minVersion: "12.0.0",
|
|
42
|
+
version: "22.2.6",
|
|
43
|
+
ngImport: i0,
|
|
44
|
+
type: LabelStylePipe,
|
|
45
|
+
deps: [],
|
|
46
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
static {
|
|
50
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
51
|
+
minVersion: "14.0.0",
|
|
52
|
+
version: "22.2.6",
|
|
53
|
+
ngImport: i0,
|
|
54
|
+
type: LabelStylePipe,
|
|
55
|
+
isStandalone: true,
|
|
56
|
+
name: "labelStyle"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
61
|
+
minVersion: "12.0.0",
|
|
62
|
+
version: "22.2.6",
|
|
63
|
+
ngImport: i0,
|
|
64
|
+
type: LabelStylePipe,
|
|
65
|
+
decorators: [{
|
|
66
|
+
type: Pipe,
|
|
67
|
+
args: [{ name: "labelStyle" }]
|
|
68
|
+
}]
|
|
69
|
+
});
|
|
70
|
+
var TickStylePipe = class TickStylePipe {
|
|
71
|
+
transform(tick, args) {
|
|
72
|
+
const { largeTickStep, min, max, orientation, smallTickStep } = args;
|
|
73
|
+
const position = valueToPosition(tick.value, min, max);
|
|
74
|
+
const height = this.getHeight(tick, smallTickStep, largeTickStep, orientation);
|
|
75
|
+
const width = this.getWidth(tick, smallTickStep, largeTickStep, orientation);
|
|
76
|
+
if (orientation === "horizontal") {
|
|
77
|
+
const isRtl = args.direction === "rtl";
|
|
78
|
+
return {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
...isRtl ? { right: `${position}%` } : { left: `${position}%` },
|
|
81
|
+
top: "50%",
|
|
82
|
+
transform: `${isRtl ? "translateX(50%)" : "translateX(-50%)"} translateY(-50%) translateZ(0)`,
|
|
83
|
+
width: "1px",
|
|
84
|
+
height: `${height}px`,
|
|
85
|
+
backfaceVisibility: "hidden",
|
|
86
|
+
willChange: "transform"
|
|
87
|
+
};
|
|
88
|
+
} else return {
|
|
89
|
+
position: "absolute",
|
|
90
|
+
bottom: `${position}%`,
|
|
91
|
+
left: "50%",
|
|
92
|
+
transform: "translateX(-50%) translateY(50%) translateZ(0)",
|
|
93
|
+
width: `${width}px`,
|
|
94
|
+
height: "1px",
|
|
95
|
+
backfaceVisibility: "hidden"
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
getHeight(tick, smallStep, largeStep, orientation) {
|
|
99
|
+
if (orientation === "vertical") return 8;
|
|
100
|
+
if (smallStep === 1 && largeStep === null) return 16;
|
|
101
|
+
if (smallStep === 1 && largeStep !== null) return tick.index % largeStep !== 0 ? 16 : 24;
|
|
102
|
+
if (smallStep > 1 && largeStep === null) return tick.index % smallStep !== 0 ? 0 : 16;
|
|
103
|
+
if (smallStep > 1 && largeStep !== null) return tick.index % smallStep !== 0 ? 0 : tick.index % largeStep !== 0 ? 16 : 24;
|
|
104
|
+
return 8;
|
|
105
|
+
}
|
|
106
|
+
getWidth(tick, smallStep, largeStep, orientation) {
|
|
107
|
+
if (orientation === "vertical") {
|
|
108
|
+
if (smallStep === 1) return 16;
|
|
109
|
+
return tick.index % smallStep !== 0 ? 0 : 16;
|
|
110
|
+
}
|
|
111
|
+
return 8;
|
|
112
|
+
}
|
|
113
|
+
static {
|
|
114
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
115
|
+
minVersion: "12.0.0",
|
|
116
|
+
version: "22.2.6",
|
|
117
|
+
ngImport: i0,
|
|
118
|
+
type: TickStylePipe,
|
|
119
|
+
deps: [],
|
|
120
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
static {
|
|
124
|
+
this.ɵpipe = i0.ɵɵngDeclarePipe({
|
|
125
|
+
minVersion: "14.0.0",
|
|
126
|
+
version: "22.2.6",
|
|
127
|
+
ngImport: i0,
|
|
128
|
+
type: TickStylePipe,
|
|
129
|
+
isStandalone: true,
|
|
130
|
+
name: "tickStyle"
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
135
|
+
minVersion: "12.0.0",
|
|
136
|
+
version: "22.2.6",
|
|
137
|
+
ngImport: i0,
|
|
138
|
+
type: TickStylePipe,
|
|
139
|
+
decorators: [{
|
|
140
|
+
type: Pipe,
|
|
141
|
+
args: [{ name: "tickStyle" }]
|
|
142
|
+
}]
|
|
143
|
+
});
|
|
135
144
|
const SLIDER_DEFAULT_MESSAGES = {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
maximumValue: "Maximum value",
|
|
146
|
+
minimumValue: "Minimum value",
|
|
147
|
+
sliderValue: "Slider value"
|
|
139
148
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
149
|
+
var SliderHandleTemplateDirective = class SliderHandleTemplateDirective {
|
|
150
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
static {
|
|
154
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
155
|
+
minVersion: "12.0.0",
|
|
156
|
+
version: "22.2.6",
|
|
157
|
+
ngImport: i0,
|
|
158
|
+
type: SliderHandleTemplateDirective,
|
|
159
|
+
deps: [],
|
|
160
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
static {
|
|
164
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
165
|
+
minVersion: "14.0.0",
|
|
166
|
+
version: "22.2.6",
|
|
167
|
+
type: SliderHandleTemplateDirective,
|
|
168
|
+
isStandalone: true,
|
|
169
|
+
selector: "ng-template[monaSliderHandleTemplate]",
|
|
170
|
+
ngImport: i0
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
175
|
+
minVersion: "12.0.0",
|
|
176
|
+
version: "22.2.6",
|
|
177
|
+
ngImport: i0,
|
|
178
|
+
type: SliderHandleTemplateDirective,
|
|
179
|
+
decorators: [{
|
|
180
|
+
type: Directive,
|
|
181
|
+
args: [{ selector: "ng-template[monaSliderHandleTemplate]" }]
|
|
182
|
+
}]
|
|
183
|
+
});
|
|
184
|
+
var SliderTickValueTemplateDirective = class SliderTickValueTemplateDirective {
|
|
185
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
static {
|
|
189
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
190
|
+
minVersion: "12.0.0",
|
|
191
|
+
version: "22.2.6",
|
|
192
|
+
ngImport: i0,
|
|
193
|
+
type: SliderTickValueTemplateDirective,
|
|
194
|
+
deps: [],
|
|
195
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
static {
|
|
199
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
200
|
+
minVersion: "14.0.0",
|
|
201
|
+
version: "22.2.6",
|
|
202
|
+
type: SliderTickValueTemplateDirective,
|
|
203
|
+
isStandalone: true,
|
|
204
|
+
selector: "ng-template[monaSliderTickValueTemplate]",
|
|
205
|
+
ngImport: i0
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
210
|
+
minVersion: "12.0.0",
|
|
211
|
+
version: "22.2.6",
|
|
212
|
+
ngImport: i0,
|
|
213
|
+
type: SliderTickValueTemplateDirective,
|
|
214
|
+
decorators: [{
|
|
215
|
+
type: Directive,
|
|
216
|
+
args: [{ selector: "ng-template[monaSliderTickValueTemplate]" }]
|
|
217
|
+
}]
|
|
218
|
+
});
|
|
169
219
|
const sliderBaseThemeVariants = cva(`
|
|
170
220
|
relative flex select-none
|
|
171
221
|
|
|
@@ -197,17 +247,13 @@ const sliderTrackThemeVariants = cva(`
|
|
|
197
247
|
data-[orientation="vertical"]:h-full
|
|
198
248
|
data-[orientation="vertical"]:w-1.5
|
|
199
249
|
|
|
200
|
-
`, {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
small: "rounded-sm"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
});
|
|
250
|
+
`, { variants: { rounded: {
|
|
251
|
+
full: "rounded-full",
|
|
252
|
+
large: "rounded-lg",
|
|
253
|
+
medium: "rounded-md",
|
|
254
|
+
none: "rounded-none",
|
|
255
|
+
small: "rounded-sm"
|
|
256
|
+
} } });
|
|
211
257
|
const sliderSelectionThemeVariants = cva(`
|
|
212
258
|
absolute
|
|
213
259
|
bg-[var(--mona-indicator-color,var(--color-primary))]
|
|
@@ -277,936 +323,1350 @@ const sliderHandleThemeVariants = cva(`
|
|
|
277
323
|
data-[invalid="true"]:ring-2 data-[invalid="true"]:ring-error/35
|
|
278
324
|
data-[invalid="true"]:data-[focused="true"]:border-error
|
|
279
325
|
data-[invalid="true"]:data-[focused="true"]:ring-error/35
|
|
280
|
-
`, {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
small: "rounded-sm"
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* @description Counts the decimal places a number is written with, including those of exponent notation such as `1e-7`.
|
|
294
|
-
*/
|
|
326
|
+
`, { variants: { rounded: {
|
|
327
|
+
full: "rounded-full",
|
|
328
|
+
large: "rounded-lg",
|
|
329
|
+
medium: "rounded-md",
|
|
330
|
+
none: "rounded-none",
|
|
331
|
+
small: "rounded-sm"
|
|
332
|
+
} } });
|
|
295
333
|
function decimalPlaces(value) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
const decimals = mantissa.split(".")[1]?.length ?? 0;
|
|
301
|
-
return Math.max(0, decimals - Number(exponent ?? 0));
|
|
334
|
+
if (!Number.isFinite(value)) return 0;
|
|
335
|
+
const [mantissa, exponent] = value.toString().split("e");
|
|
336
|
+
const decimals = mantissa.split(".")[1]?.length ?? 0;
|
|
337
|
+
return Math.max(0, decimals - Number(exponent ?? 0));
|
|
302
338
|
}
|
|
303
|
-
/**
|
|
304
|
-
* @description Rounds a number to a number of decimal places, which removes floating point noise such as
|
|
305
|
-
* `0.30000000000000004`.
|
|
306
|
-
*/
|
|
307
339
|
function roundToPlaces(value, places) {
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
class SliderBaseComponent {
|
|
312
|
-
#document;
|
|
313
|
-
#label;
|
|
314
|
-
#stepPlaces;
|
|
315
|
-
constructor() {
|
|
316
|
-
this.#document = inject(DOCUMENT);
|
|
317
|
-
this.#label = injectLabelAssociation({
|
|
318
|
-
activate: () => this.focus(),
|
|
319
|
-
ariaLabel: () => this.ariaLabel(),
|
|
320
|
-
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
321
|
-
});
|
|
322
|
-
this.#stepPlaces = computed(() => Math.max(decimalPlaces(this.step()), decimalPlaces(this.effectiveMin())), /* @ts-ignore */
|
|
323
|
-
...(ngDevMode ? [{ debugName: "#stepPlaces" }] : /* istanbul ignore next */ []));
|
|
324
|
-
this.baseClasses = computed(() => sliderBaseThemeVariants(), /* @ts-ignore */
|
|
325
|
-
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
326
|
-
this.destroyRef = inject(DestroyRef);
|
|
327
|
-
this.direction = injectComponentDirection();
|
|
328
|
-
this.dragging = signal(false, /* @ts-ignore */
|
|
329
|
-
...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
|
|
330
|
-
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
331
|
-
this.effectiveMax = computed(() => this.getMaxOverride() ?? this.maxValue(), /* @ts-ignore */
|
|
332
|
-
...(ngDevMode ? [{ debugName: "effectiveMax" }] : /* istanbul ignore next */ []));
|
|
333
|
-
this.effectiveMin = computed(() => this.getMinOverride() ?? this.minValue(), /* @ts-ignore */
|
|
334
|
-
...(ngDevMode ? [{ debugName: "effectiveMin" }] : /* istanbul ignore next */ []));
|
|
335
|
-
this.handleTemplate = contentChild(SliderHandleTemplateDirective, { ...(ngDevMode ? { debugName: "handleTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
336
|
-
this.handleTemplateStyles = computed(() => {
|
|
337
|
-
const template = this.handleTemplate();
|
|
338
|
-
if (!template) {
|
|
339
|
-
return {};
|
|
340
|
-
}
|
|
341
|
-
return { background: "transparent", border: "none", boxShadow: "none" };
|
|
342
|
-
}, /* @ts-ignore */
|
|
343
|
-
...(ngDevMode ? [{ debugName: "handleTemplateStyles" }] : /* istanbul ignore next */ []));
|
|
344
|
-
this.horizontalSelectionLeft = computed(() => {
|
|
345
|
-
if (this.orientation() !== "horizontal") {
|
|
346
|
-
return undefined;
|
|
347
|
-
}
|
|
348
|
-
return this.isRtl() ? 100 - this.selectionRight() : this.selectionLeft();
|
|
349
|
-
}, /* @ts-ignore */
|
|
350
|
-
...(ngDevMode ? [{ debugName: "horizontalSelectionLeft" }] : /* istanbul ignore next */ []));
|
|
351
|
-
this.horizontalSelectionRight = computed(() => {
|
|
352
|
-
if (this.orientation() !== "horizontal") {
|
|
353
|
-
return undefined;
|
|
354
|
-
}
|
|
355
|
-
return this.isRtl() ? this.selectionLeft() : 100 - this.selectionRight();
|
|
356
|
-
}, /* @ts-ignore */
|
|
357
|
-
...(ngDevMode ? [{ debugName: "horizontalSelectionRight" }] : /* istanbul ignore next */ []));
|
|
358
|
-
this.hostElementRef = inject(ElementRef);
|
|
359
|
-
this.i18n = inject(MonaI18nService);
|
|
360
|
-
this.interactionDisabled = computed(() => this.effectiveDisabled() || this.readonly(), /* @ts-ignore */
|
|
361
|
-
...(ngDevMode ? [{ debugName: "interactionDisabled" }] : /* istanbul ignore next */ []));
|
|
362
|
-
this.invalidState = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
|
|
363
|
-
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
364
|
-
this.isRtl = computed(() => this.direction() === "rtl", /* @ts-ignore */
|
|
365
|
-
...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
|
|
366
|
-
this.labelStyleArgs = computed(() => {
|
|
367
|
-
const direction = this.direction();
|
|
368
|
-
const labelPosition = this.labelPosition();
|
|
369
|
-
const max = this.effectiveMax();
|
|
370
|
-
const min = this.effectiveMin();
|
|
371
|
-
const orientation = this.orientation();
|
|
372
|
-
const tickCount = this.labelTicks().length;
|
|
373
|
-
return { direction, labelPosition, max, min, orientation, tickCount };
|
|
374
|
-
}, /* @ts-ignore */
|
|
375
|
-
...(ngDevMode ? [{ debugName: "labelStyleArgs" }] : /* istanbul ignore next */ []));
|
|
376
|
-
this.labelTicks = computed(() => {
|
|
377
|
-
const allTicks = this.ticks();
|
|
378
|
-
if (allTicks.length === 0) {
|
|
379
|
-
return [];
|
|
380
|
-
}
|
|
381
|
-
const tickStep = this.labelStep();
|
|
382
|
-
const lastTick = allTicks[allTicks.length - 1];
|
|
383
|
-
const labels = allTicks.filter(t => t.index % tickStep === 0);
|
|
384
|
-
if (labels.length === 0 || labels[labels.length - 1].value !== lastTick.value) {
|
|
385
|
-
labels.push(lastTick);
|
|
386
|
-
}
|
|
387
|
-
if (labels.length >= 2) {
|
|
388
|
-
const penultimate = labels[labels.length - 2];
|
|
389
|
-
const last = labels[labels.length - 1];
|
|
390
|
-
const penultimatePos = valueToPosition(penultimate.value, this.effectiveMin(), this.effectiveMax());
|
|
391
|
-
const lastPos = valueToPosition(last.value, this.effectiveMin(), this.effectiveMax());
|
|
392
|
-
if (this.step() !== 1 && lastPos - penultimatePos < 4) {
|
|
393
|
-
labels.splice(labels.length - 2, 1);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
const localeId = this.i18n.localeId();
|
|
397
|
-
return labels.map(tick => ({
|
|
398
|
-
...tick,
|
|
399
|
-
label: formatNumber(tick.value, localeId, { maximumFractionDigits: decimalPlaces(tick.value) })
|
|
400
|
-
}));
|
|
401
|
-
}, /* @ts-ignore */
|
|
402
|
-
...(ngDevMode ? [{ debugName: "labelTicks" }] : /* istanbul ignore next */ []));
|
|
403
|
-
this.labelledBy = this.#label.labelledBy;
|
|
404
|
-
this.renderTicks = computed(() => {
|
|
405
|
-
const ticks = this.ticks();
|
|
406
|
-
if (this.orientation() === "vertical") {
|
|
407
|
-
return ticks.slice().reverse();
|
|
408
|
-
}
|
|
409
|
-
return ticks;
|
|
410
|
-
}, /* @ts-ignore */
|
|
411
|
-
...(ngDevMode ? [{ debugName: "renderTicks" }] : /* istanbul ignore next */ []));
|
|
412
|
-
this.selectionBackgroundStyle = computed(() => {
|
|
413
|
-
const bg = this.selectionBackground();
|
|
414
|
-
if (!bg) {
|
|
415
|
-
return {};
|
|
416
|
-
}
|
|
417
|
-
return typeof bg === "string" ? { background: bg } : bg;
|
|
418
|
-
}, /* @ts-ignore */
|
|
419
|
-
...(ngDevMode ? [{ debugName: "selectionBackgroundStyle" }] : /* istanbul ignore next */ []));
|
|
420
|
-
this.selectionClasses = computed(() => sliderSelectionThemeVariants(), /* @ts-ignore */
|
|
421
|
-
...(ngDevMode ? [{ debugName: "selectionClasses" }] : /* istanbul ignore next */ []));
|
|
422
|
-
this.sliderHandleClasses = computed(() => {
|
|
423
|
-
const rounded = this.rounded();
|
|
424
|
-
const handleClasses = this.handleClasses();
|
|
425
|
-
const variants = sliderHandleThemeVariants({ rounded });
|
|
426
|
-
return twMerge(variants ?? "", Array.isArray(handleClasses) ? handleClasses.join(" ") : handleClasses);
|
|
427
|
-
}, /* @ts-ignore */
|
|
428
|
-
...(ngDevMode ? [{ debugName: "sliderHandleClasses" }] : /* istanbul ignore next */ []));
|
|
429
|
-
this.sliderTrackSize = computed(() => {
|
|
430
|
-
const trackSize = this.trackSize();
|
|
431
|
-
if (trackSize == null || trackSize === "") {
|
|
432
|
-
return null;
|
|
433
|
-
}
|
|
434
|
-
if (typeof trackSize === "number") {
|
|
435
|
-
return `${trackSize}px`;
|
|
436
|
-
}
|
|
437
|
-
const number = Number(trackSize);
|
|
438
|
-
if (isNaN(number)) {
|
|
439
|
-
return trackSize;
|
|
440
|
-
}
|
|
441
|
-
return `${number}px`;
|
|
442
|
-
}, /* @ts-ignore */
|
|
443
|
-
...(ngDevMode ? [{ debugName: "sliderTrackSize" }] : /* istanbul ignore next */ []));
|
|
444
|
-
this.tickClasses = computed(() => sliderTickThemeVariants(), /* @ts-ignore */
|
|
445
|
-
...(ngDevMode ? [{ debugName: "tickClasses" }] : /* istanbul ignore next */ []));
|
|
446
|
-
this.tickLabelClasses = computed(() => sliderTickLabelThemeVariants(), /* @ts-ignore */
|
|
447
|
-
...(ngDevMode ? [{ debugName: "tickLabelClasses" }] : /* istanbul ignore next */ []));
|
|
448
|
-
this.tickLabelListClasses = computed(() => sliderTickLabelListThemeVariants(), /* @ts-ignore */
|
|
449
|
-
...(ngDevMode ? [{ debugName: "tickLabelListClasses" }] : /* istanbul ignore next */ []));
|
|
450
|
-
this.tickListClasses = computed(() => sliderTickListThemeVariants(), /* @ts-ignore */
|
|
451
|
-
...(ngDevMode ? [{ debugName: "tickListClasses" }] : /* istanbul ignore next */ []));
|
|
452
|
-
this.tickStyleArgs = computed(() => {
|
|
453
|
-
const direction = this.direction();
|
|
454
|
-
const largeTickStep = this.largeTickStep();
|
|
455
|
-
const max = this.effectiveMax();
|
|
456
|
-
const min = this.effectiveMin();
|
|
457
|
-
const orientation = this.orientation();
|
|
458
|
-
const smallTickStep = this.smallTickStep();
|
|
459
|
-
return { direction, largeTickStep, max, min, orientation, smallTickStep };
|
|
460
|
-
}, /* @ts-ignore */
|
|
461
|
-
...(ngDevMode ? [{ debugName: "tickStyleArgs" }] : /* istanbul ignore next */ []));
|
|
462
|
-
this.tickValueTemplate = contentChild(SliderTickValueTemplateDirective, { ...(ngDevMode ? { debugName: "tickValueTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
463
|
-
this.ticks = computed(() => {
|
|
464
|
-
const min = this.effectiveMin();
|
|
465
|
-
const max = this.effectiveMax();
|
|
466
|
-
const step = this.step();
|
|
467
|
-
const ticks = [];
|
|
468
|
-
const count = this.#stepCount();
|
|
469
|
-
for (let i = 0; i <= count; i++) {
|
|
470
|
-
ticks.push({ index: i, value: this.#roundToStep(min + i * step) });
|
|
471
|
-
}
|
|
472
|
-
if (ticks.length === 0 || ticks[ticks.length - 1].value < max) {
|
|
473
|
-
ticks.push({ index: ticks.length, value: max });
|
|
474
|
-
}
|
|
475
|
-
return ticks;
|
|
476
|
-
}, /* @ts-ignore */
|
|
477
|
-
...(ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []));
|
|
478
|
-
this.trackBackgroundStyle = computed(() => {
|
|
479
|
-
const bg = this.trackBackground();
|
|
480
|
-
if (!bg) {
|
|
481
|
-
return {};
|
|
482
|
-
}
|
|
483
|
-
return typeof bg === "string" ? { background: bg } : bg;
|
|
484
|
-
}, /* @ts-ignore */
|
|
485
|
-
...(ngDevMode ? [{ debugName: "trackBackgroundStyle" }] : /* istanbul ignore next */ []));
|
|
486
|
-
this.trackClasses = computed(() => {
|
|
487
|
-
const rounded = this.rounded();
|
|
488
|
-
return sliderTrackThemeVariants({ rounded });
|
|
489
|
-
}, /* @ts-ignore */
|
|
490
|
-
...(ngDevMode ? [{ debugName: "trackClasses" }] : /* istanbul ignore next */ []));
|
|
491
|
-
this.zone = inject(NgZone);
|
|
492
|
-
/**
|
|
493
|
-
* @description Id of an element that describes the control, such as an error message. On a range slider it describes
|
|
494
|
-
* each handle.
|
|
495
|
-
* @default null
|
|
496
|
-
*/
|
|
497
|
-
this.ariaDescribedBy = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
|
|
498
|
-
/**
|
|
499
|
-
* @description Accessible name of the control. On a range slider it names the group holding both handles.
|
|
500
|
-
* @default null
|
|
501
|
-
*/
|
|
502
|
-
this.ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
503
|
-
/**
|
|
504
|
-
* @description Id of the element that labels the control. On a range slider each handle reads it before its own
|
|
505
|
-
* name.
|
|
506
|
-
* @default null
|
|
507
|
-
*/
|
|
508
|
-
this.ariaLabelledBy = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
|
|
509
|
-
/**
|
|
510
|
-
* @description Human-readable override for the `aria-valuenow` announcement. Pass a function that receives the current value and returns the string to announce.
|
|
511
|
-
* @default null
|
|
512
|
-
*/
|
|
513
|
-
this.ariaValueText = input(null, /* @ts-ignore */
|
|
514
|
-
...(ngDevMode ? [{ debugName: "ariaValueText" }] : /* istanbul ignore next */ []));
|
|
515
|
-
/**
|
|
516
|
-
* @description Renders the component with reduced visual emphasis and removes pointer interaction.
|
|
517
|
-
* @default false
|
|
518
|
-
*/
|
|
519
|
-
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
520
|
-
/**
|
|
521
|
-
* @description Additional CSS classes to apply to the slider handle.
|
|
522
|
-
* @default []
|
|
523
|
-
*/
|
|
524
|
-
this.handleClasses = input([], /* @ts-ignore */
|
|
525
|
-
...(ngDevMode ? [{ debugName: "handleClasses" }] : /* istanbul ignore next */ []));
|
|
526
|
-
/**
|
|
527
|
-
* @description Additional inline styles to apply to the slider handle.
|
|
528
|
-
* @default {}
|
|
529
|
-
*/
|
|
530
|
-
this.handleStyles = input({}, /* @ts-ignore */
|
|
531
|
-
...(ngDevMode ? [{ debugName: "handleStyles" }] : /* istanbul ignore next */ []));
|
|
532
|
-
/**
|
|
533
|
-
* @description Marks the control as invalid for form validation purposes, reflecting `aria-invalid` on the handle
|
|
534
|
-
* element once the control is touched.
|
|
535
|
-
* @default false
|
|
536
|
-
*/
|
|
537
|
-
this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
538
|
-
/**
|
|
539
|
-
* @description Position of the label relative to the component.
|
|
540
|
-
* @default "after"
|
|
541
|
-
*/
|
|
542
|
-
this.labelPosition = input("after", /* @ts-ignore */
|
|
543
|
-
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
544
|
-
/**
|
|
545
|
-
* @description Controls which tick labels are shown — only every n<sup>th</sup> label is rendered.
|
|
546
|
-
* @default 1
|
|
547
|
-
*/
|
|
548
|
-
this.labelStep = input(1, /* @ts-ignore */
|
|
549
|
-
...(ngDevMode ? [{ debugName: "labelStep" }] : /* istanbul ignore next */ []));
|
|
550
|
-
/**
|
|
551
|
-
* @description Controls which ticks render at large size — only every n<sup>th</sup> tick is enlarged. Pass `null` to disable large ticks.
|
|
552
|
-
* @default null
|
|
553
|
-
*/
|
|
554
|
-
this.largeTickStep = input(null, /* @ts-ignore */
|
|
555
|
-
...(ngDevMode ? [{ debugName: "largeTickStep" }] : /* istanbul ignore next */ []));
|
|
556
|
-
/**
|
|
557
|
-
* @description Upper bound of the value range. Must be greater than `minValue`.
|
|
558
|
-
* @default 10
|
|
559
|
-
*/
|
|
560
|
-
this.maxValue = input(10, /* @ts-ignore */
|
|
561
|
-
...(ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
562
|
-
/**
|
|
563
|
-
* @description Lower bound of the value range.
|
|
564
|
-
* @default 0
|
|
565
|
-
*/
|
|
566
|
-
this.minValue = input(0, /* @ts-ignore */
|
|
567
|
-
...(ngDevMode ? [{ debugName: "minValue" }] : /* istanbul ignore next */ []));
|
|
568
|
-
/**
|
|
569
|
-
* @description Layout orientation of the component.
|
|
570
|
-
* @default "horizontal"
|
|
571
|
-
*/
|
|
572
|
-
this.orientation = input("horizontal", /* @ts-ignore */
|
|
573
|
-
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
574
|
-
/**
|
|
575
|
-
* @description Prevents value changes while the control stays focusable and readable. When bound to a signal form
|
|
576
|
-
* field via `[formField]`, this is written by the `FormField` directive.
|
|
577
|
-
* @default false
|
|
578
|
-
*/
|
|
579
|
-
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
580
|
-
/**
|
|
581
|
-
* @description Border-radius preset applied to the slider handle.
|
|
582
|
-
* @default "full"
|
|
583
|
-
*/
|
|
584
|
-
this.rounded = input("full", /* @ts-ignore */
|
|
585
|
-
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
586
|
-
/**
|
|
587
|
-
* @description Background color of the filled selection area between the minimum and the current value. Accepts a CSS color string or a `CSSStyleDeclaration` partial.
|
|
588
|
-
* @default null
|
|
589
|
-
*/
|
|
590
|
-
this.selectionBackground = input(null, /* @ts-ignore */
|
|
591
|
-
...(ngDevMode ? [{ debugName: "selectionBackground" }] : /* istanbul ignore next */ []));
|
|
592
|
-
/**
|
|
593
|
-
* @description Multiplier applied to the step when the user holds Shift while pressing an arrow key.
|
|
594
|
-
* @default 10
|
|
595
|
-
*/
|
|
596
|
-
this.shiftMultiplier = input(10, /* @ts-ignore */
|
|
597
|
-
...(ngDevMode ? [{ debugName: "shiftMultiplier" }] : /* istanbul ignore next */ []));
|
|
598
|
-
/**
|
|
599
|
-
* @description Displays value labels alongside tick marks. Only takes effect when `showTicks` is `true`.
|
|
600
|
-
* @default false
|
|
601
|
-
*/
|
|
602
|
-
this.showLabels = input(false, { ...(ngDevMode ? { debugName: "showLabels" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
603
|
-
/**
|
|
604
|
-
* @description Displays tick marks at each step position along the track.
|
|
605
|
-
* @default false
|
|
606
|
-
*/
|
|
607
|
-
this.showTicks = input(false, { ...(ngDevMode ? { debugName: "showTicks" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
608
|
-
/**
|
|
609
|
-
* @description Controls how many ticks are visible — only every n<sup>th</sup> tick is rendered.
|
|
610
|
-
* @default 1
|
|
611
|
-
*/
|
|
612
|
-
this.smallTickStep = input(1, { ...(ngDevMode ? { debugName: "smallTickStep" } : /* istanbul ignore next */ {}), transform: (value) => Math.max(value, 1) });
|
|
613
|
-
/**
|
|
614
|
-
* @description Distance between the values the control can take. `maxValue` can always be reached, even when it
|
|
615
|
-
* isn't a whole number of steps from `minValue`.
|
|
616
|
-
* @default 1
|
|
617
|
-
*/
|
|
618
|
-
this.step = input(1, { ...(ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {}), transform: (value) => (value <= 0 ? 1 : value) });
|
|
619
|
-
/**
|
|
620
|
-
* @description Emitted when a handle loses focus. A click on the track moves focus to the handle first.
|
|
621
|
-
*/
|
|
622
|
-
this.touch = output();
|
|
623
|
-
/**
|
|
624
|
-
* @description Marks the slider as touched. Error styling requires both `invalid` and `touched` to be `true`.
|
|
625
|
-
* When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
|
|
626
|
-
* @default false
|
|
627
|
-
*/
|
|
628
|
-
this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
629
|
-
/**
|
|
630
|
-
* @description Background color of the unfilled track portion. Accepts a CSS color string or a `CSSStyleDeclaration` partial.
|
|
631
|
-
* @default null
|
|
632
|
-
*/
|
|
633
|
-
this.trackBackground = input(null, /* @ts-ignore */
|
|
634
|
-
...(ngDevMode ? [{ debugName: "trackBackground" }] : /* istanbul ignore next */ []));
|
|
635
|
-
/**
|
|
636
|
-
* @description Width (vertical orientation) or height (horizontal orientation) of the track. Accepts a pixel number or any CSS length string.
|
|
637
|
-
* @default undefined
|
|
638
|
-
*/
|
|
639
|
-
this.trackSize = input(/* @ts-ignore */
|
|
640
|
-
...(ngDevMode ? [undefined, { debugName: "trackSize" }] : /* istanbul ignore next */ []));
|
|
641
|
-
afterNextRender({
|
|
642
|
-
read: () => this.zone.runOutsideAngular(() => this.setSubscriptions())
|
|
643
|
-
});
|
|
644
|
-
if (isDevMode()) {
|
|
645
|
-
this.#warnWhenMisconfigured();
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* @internal
|
|
650
|
-
*/
|
|
651
|
-
setLabelledBy(id) {
|
|
652
|
-
this.#label.setLabelledBy(id);
|
|
653
|
-
}
|
|
654
|
-
calculateNewValue(currentValue, event) {
|
|
655
|
-
const min = this.effectiveMin();
|
|
656
|
-
const max = this.effectiveMax();
|
|
657
|
-
const step = this.step();
|
|
658
|
-
const isRtl = this.isRtl();
|
|
659
|
-
const amount = event.shiftKey ? step * this.shiftMultiplier() : step;
|
|
660
|
-
const page = Math.max((max - min) * 0.1, step);
|
|
661
|
-
// Max can sit off the step grid, and stepping down from it lands on the last value of the grid.
|
|
662
|
-
const lastGridValue = this.#roundToStep(min + this.#stepCount() * step);
|
|
663
|
-
const decreaseFrom = currentValue > lastGridValue ? lastGridValue + step : currentValue;
|
|
664
|
-
const decreaseKey = isRtl ? "ArrowRight" : "ArrowLeft";
|
|
665
|
-
const increaseKey = isRtl ? "ArrowLeft" : "ArrowRight";
|
|
666
|
-
let newValue = currentValue;
|
|
667
|
-
switch (event.key) {
|
|
668
|
-
case decreaseKey:
|
|
669
|
-
case "ArrowDown":
|
|
670
|
-
newValue = decreaseFrom - amount;
|
|
671
|
-
break;
|
|
672
|
-
case increaseKey:
|
|
673
|
-
case "ArrowUp":
|
|
674
|
-
newValue = currentValue + amount;
|
|
675
|
-
break;
|
|
676
|
-
case "Home":
|
|
677
|
-
newValue = min;
|
|
678
|
-
break;
|
|
679
|
-
case "End":
|
|
680
|
-
newValue = max;
|
|
681
|
-
break;
|
|
682
|
-
case "PageDown":
|
|
683
|
-
newValue = decreaseFrom - page;
|
|
684
|
-
break;
|
|
685
|
-
case "PageUp":
|
|
686
|
-
newValue = currentValue + page;
|
|
687
|
-
break;
|
|
688
|
-
}
|
|
689
|
-
return this.snapValue(newValue);
|
|
690
|
-
}
|
|
691
|
-
clampValue(value) {
|
|
692
|
-
return Math.max(this.effectiveMin(), Math.min(this.effectiveMax(), value));
|
|
693
|
-
}
|
|
694
|
-
getMaxOverride() {
|
|
695
|
-
return undefined;
|
|
696
|
-
}
|
|
697
|
-
getMinOverride() {
|
|
698
|
-
return undefined;
|
|
699
|
-
}
|
|
700
|
-
getValueFromPointerEvent(event) {
|
|
701
|
-
const containerRect = this.hostElementRef.nativeElement.getBoundingClientRect();
|
|
702
|
-
let normalizedHandlePos;
|
|
703
|
-
if (this.orientation() === "horizontal") {
|
|
704
|
-
const handlePos = this.isRtl()
|
|
705
|
-
? containerRect.right - event.clientX
|
|
706
|
-
: event.clientX - containerRect.left;
|
|
707
|
-
normalizedHandlePos = (handlePos / containerRect.width) * 100;
|
|
708
|
-
}
|
|
709
|
-
else {
|
|
710
|
-
const handlePos = event.clientY - containerRect.top;
|
|
711
|
-
normalizedHandlePos = 100 - (handlePos / containerRect.height) * 100;
|
|
712
|
-
}
|
|
713
|
-
normalizedHandlePos = Math.max(0, Math.min(normalizedHandlePos, 100));
|
|
714
|
-
return this.getValueFromPosition(normalizedHandlePos);
|
|
715
|
-
}
|
|
716
|
-
getValueFromPosition(position) {
|
|
717
|
-
const min = this.effectiveMin();
|
|
718
|
-
const max = this.effectiveMax();
|
|
719
|
-
if (position >= 100) {
|
|
720
|
-
return max;
|
|
721
|
-
}
|
|
722
|
-
if (position <= 0) {
|
|
723
|
-
return min;
|
|
724
|
-
}
|
|
725
|
-
const range = max - min;
|
|
726
|
-
const rawValue = min + (position / 100) * range;
|
|
727
|
-
return this.snapValue(rawValue);
|
|
728
|
-
}
|
|
729
|
-
isNavigationKey(event) {
|
|
730
|
-
return ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"].includes(event.key);
|
|
731
|
-
}
|
|
732
|
-
positionFromValue(value) {
|
|
733
|
-
return valueToPosition(value, this.effectiveMin(), this.effectiveMax());
|
|
734
|
-
}
|
|
735
|
-
snapValue(value) {
|
|
736
|
-
const min = this.effectiveMin();
|
|
737
|
-
const max = this.effectiveMax();
|
|
738
|
-
if (Number.isNaN(value) || max <= min) {
|
|
739
|
-
return min;
|
|
740
|
-
}
|
|
741
|
-
const step = this.step();
|
|
742
|
-
const clampedValue = this.clampValue(value);
|
|
743
|
-
const snappedValue = this.clampValue(this.#roundToStep(Math.round((clampedValue - min) / step) * step + min));
|
|
744
|
-
// Max counts as a value of the grid even when it's off it, as the last tick does.
|
|
745
|
-
return max - clampedValue < Math.abs(clampedValue - snappedValue) ? max : snappedValue;
|
|
746
|
-
}
|
|
747
|
-
/**
|
|
748
|
-
* Moves a value while the given handle is dragged with the primary button, one finger or a pen. The pointer is
|
|
749
|
-
* captured, so a release outside the page still ends the drag.
|
|
750
|
-
*/
|
|
751
|
-
trackHandleDrag(handle, startDrag) {
|
|
752
|
-
fromEvent(handle, "pointerdown")
|
|
753
|
-
.pipe(filter(event => event.button === 0 && event.isPrimary && !event.ctrlKey), filter(() => !this.dragging() && !this.interactionDisabled()), tap(event => {
|
|
754
|
-
this.zone.run(() => this.dragging.set(true));
|
|
755
|
-
handle.setPointerCapture?.(event.pointerId);
|
|
756
|
-
// A touch doesn't focus the element by itself, and touch only fires when focus leaves.
|
|
757
|
-
handle.focus({ preventScroll: true });
|
|
758
|
-
}), switchMap(down => {
|
|
759
|
-
const pointerEvents = (target, name) => fromEvent(target, name).pipe(filter(event => event.pointerId === down.pointerId));
|
|
760
|
-
const end$ = merge(pointerEvents(this.#document, "pointerup"), pointerEvents(this.#document, "pointercancel"), pointerEvents(handle, "lostpointercapture")).pipe(tap(() => this.zone.run(() => this.dragging.set(false))));
|
|
761
|
-
return pointerEvents(this.#document, "pointermove").pipe(tap(startDrag()), takeUntil(end$));
|
|
762
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
763
|
-
.subscribe();
|
|
764
|
-
}
|
|
765
|
-
#roundToStep(value) {
|
|
766
|
-
return roundToPlaces(value, this.#stepPlaces());
|
|
767
|
-
}
|
|
768
|
-
#stepCount() {
|
|
769
|
-
return Math.floor((this.effectiveMax() - this.effectiveMin()) / this.step());
|
|
770
|
-
}
|
|
771
|
-
#warnWhenMisconfigured() {
|
|
772
|
-
const host = this.hostElementRef.nativeElement;
|
|
773
|
-
let warnedAboutBounds = false;
|
|
774
|
-
let warnedAboutValue = false;
|
|
775
|
-
effect(() => {
|
|
776
|
-
if (!warnedAboutBounds && this.effectiveMin() >= this.effectiveMax()) {
|
|
777
|
-
warnedAboutBounds = true;
|
|
778
|
-
console.warn(`[Mona Slider] The minimum (${this.effectiveMin()}) must be lower than the maximum ` +
|
|
779
|
-
`(${this.effectiveMax()}).`, host);
|
|
780
|
-
}
|
|
781
|
-
});
|
|
782
|
-
effect(() => {
|
|
783
|
-
if (!warnedAboutValue && !this.valueIsShown()) {
|
|
784
|
-
warnedAboutValue = true;
|
|
785
|
-
console.warn("[Mona Slider] The value is out of range or off the step grid. The slider shows the nearest " +
|
|
786
|
-
"valid value, and the model keeps its own until the user changes it.", host);
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SliderBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
791
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.6", type: SliderBaseComponent, isStandalone: true, inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaValueText: { classPropertyName: "ariaValueText", publicName: "ariaValueText", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, handleClasses: { classPropertyName: "handleClasses", publicName: "handleClasses", isSignal: true, isRequired: false, transformFunction: null }, handleStyles: { classPropertyName: "handleStyles", publicName: "handleStyles", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, labelStep: { classPropertyName: "labelStep", publicName: "labelStep", isSignal: true, isRequired: false, transformFunction: null }, largeTickStep: { classPropertyName: "largeTickStep", publicName: "largeTickStep", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selectionBackground: { classPropertyName: "selectionBackground", publicName: "selectionBackground", isSignal: true, isRequired: false, transformFunction: null }, shiftMultiplier: { classPropertyName: "shiftMultiplier", publicName: "shiftMultiplier", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null }, smallTickStep: { classPropertyName: "smallTickStep", publicName: "smallTickStep", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, trackBackground: { classPropertyName: "trackBackground", publicName: "trackBackground", isSignal: true, isRequired: false, transformFunction: null }, trackSize: { classPropertyName: "trackSize", publicName: "trackSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch" }, queries: [{ propertyName: "handleTemplate", first: true, predicate: SliderHandleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "tickValueTemplate", first: true, predicate: SliderTickValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0 }); }
|
|
340
|
+
return Number(value.toFixed(Math.min(places, 100)));
|
|
792
341
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
342
|
+
var SliderBaseComponent = class SliderBaseComponent {
|
|
343
|
+
#document;
|
|
344
|
+
#label;
|
|
345
|
+
#stepPlaces;
|
|
346
|
+
constructor() {
|
|
347
|
+
this.#document = inject(DOCUMENT);
|
|
348
|
+
this.#label = injectLabelAssociation({
|
|
349
|
+
activate: () => this.focus(),
|
|
350
|
+
ariaLabel: () => this.ariaLabel(),
|
|
351
|
+
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
352
|
+
});
|
|
353
|
+
this.#stepPlaces = computed(() => Math.max(decimalPlaces(this.step()), decimalPlaces(this.effectiveMin())), ...ngDevMode ? [{ debugName: "#stepPlaces" }] : /* istanbul ignore next */ []);
|
|
354
|
+
this.baseClasses = computed(() => sliderBaseThemeVariants(), ...ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []);
|
|
355
|
+
this.destroyRef = inject(DestroyRef);
|
|
356
|
+
this.direction = injectComponentDirection();
|
|
357
|
+
this.dragging = signal(false, ...ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []);
|
|
358
|
+
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
359
|
+
this.effectiveMax = computed(() => this.getMaxOverride() ?? this.maxValue(), ...ngDevMode ? [{ debugName: "effectiveMax" }] : /* istanbul ignore next */ []);
|
|
360
|
+
this.effectiveMin = computed(() => this.getMinOverride() ?? this.minValue(), ...ngDevMode ? [{ debugName: "effectiveMin" }] : /* istanbul ignore next */ []);
|
|
361
|
+
this.handleTemplate = contentChild(SliderHandleTemplateDirective, {
|
|
362
|
+
...ngDevMode ? { debugName: "handleTemplate" } : /* istanbul ignore next */ {},
|
|
363
|
+
read: TemplateRef
|
|
364
|
+
});
|
|
365
|
+
this.handleTemplateStyles = computed(() => {
|
|
366
|
+
if (!this.handleTemplate()) return {};
|
|
367
|
+
return {
|
|
368
|
+
background: "transparent",
|
|
369
|
+
border: "none",
|
|
370
|
+
boxShadow: "none"
|
|
371
|
+
};
|
|
372
|
+
}, ...ngDevMode ? [{ debugName: "handleTemplateStyles" }] : /* istanbul ignore next */ []);
|
|
373
|
+
this.horizontalSelectionLeft = computed(() => {
|
|
374
|
+
if (this.orientation() !== "horizontal") return;
|
|
375
|
+
return this.isRtl() ? 100 - this.selectionRight() : this.selectionLeft();
|
|
376
|
+
}, ...ngDevMode ? [{ debugName: "horizontalSelectionLeft" }] : /* istanbul ignore next */ []);
|
|
377
|
+
this.horizontalSelectionRight = computed(() => {
|
|
378
|
+
if (this.orientation() !== "horizontal") return;
|
|
379
|
+
return this.isRtl() ? this.selectionLeft() : 100 - this.selectionRight();
|
|
380
|
+
}, ...ngDevMode ? [{ debugName: "horizontalSelectionRight" }] : /* istanbul ignore next */ []);
|
|
381
|
+
this.hostElementRef = inject(ElementRef);
|
|
382
|
+
this.i18n = inject(MonaI18nService);
|
|
383
|
+
this.interactionDisabled = computed(() => this.effectiveDisabled() || this.readonly(), ...ngDevMode ? [{ debugName: "interactionDisabled" }] : /* istanbul ignore next */ []);
|
|
384
|
+
this.invalidState = computed(() => this.touched() && this.invalid(), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
385
|
+
this.isRtl = computed(() => this.direction() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
|
|
386
|
+
this.labelStyleArgs = computed(() => {
|
|
387
|
+
return {
|
|
388
|
+
direction: this.direction(),
|
|
389
|
+
labelPosition: this.labelPosition(),
|
|
390
|
+
max: this.effectiveMax(),
|
|
391
|
+
min: this.effectiveMin(),
|
|
392
|
+
orientation: this.orientation(),
|
|
393
|
+
tickCount: this.labelTicks().length
|
|
394
|
+
};
|
|
395
|
+
}, ...ngDevMode ? [{ debugName: "labelStyleArgs" }] : /* istanbul ignore next */ []);
|
|
396
|
+
this.labelTicks = computed(() => {
|
|
397
|
+
const allTicks = this.ticks();
|
|
398
|
+
if (allTicks.length === 0) return [];
|
|
399
|
+
const tickStep = this.labelStep();
|
|
400
|
+
const lastTick = allTicks[allTicks.length - 1];
|
|
401
|
+
const labels = allTicks.filter((t) => t.index % tickStep === 0);
|
|
402
|
+
if (labels.length === 0 || labels[labels.length - 1].value !== lastTick.value) labels.push(lastTick);
|
|
403
|
+
if (labels.length >= 2) {
|
|
404
|
+
const penultimate = labels[labels.length - 2];
|
|
405
|
+
const last = labels[labels.length - 1];
|
|
406
|
+
const penultimatePos = valueToPosition(penultimate.value, this.effectiveMin(), this.effectiveMax());
|
|
407
|
+
const lastPos = valueToPosition(last.value, this.effectiveMin(), this.effectiveMax());
|
|
408
|
+
if (this.step() !== 1 && lastPos - penultimatePos < 4) labels.splice(labels.length - 2, 1);
|
|
409
|
+
}
|
|
410
|
+
const localeId = this.i18n.localeId();
|
|
411
|
+
return labels.map((tick) => ({
|
|
412
|
+
...tick,
|
|
413
|
+
label: formatNumber(tick.value, localeId, { maximumFractionDigits: decimalPlaces(tick.value) })
|
|
414
|
+
}));
|
|
415
|
+
}, ...ngDevMode ? [{ debugName: "labelTicks" }] : /* istanbul ignore next */ []);
|
|
416
|
+
this.labelledBy = this.#label.labelledBy;
|
|
417
|
+
this.renderTicks = computed(() => {
|
|
418
|
+
const ticks = this.ticks();
|
|
419
|
+
if (this.orientation() === "vertical") return ticks.slice().reverse();
|
|
420
|
+
return ticks;
|
|
421
|
+
}, ...ngDevMode ? [{ debugName: "renderTicks" }] : /* istanbul ignore next */ []);
|
|
422
|
+
this.selectionBackgroundStyle = computed(() => {
|
|
423
|
+
const bg = this.selectionBackground();
|
|
424
|
+
if (!bg) return {};
|
|
425
|
+
return typeof bg === "string" ? { background: bg } : bg;
|
|
426
|
+
}, ...ngDevMode ? [{ debugName: "selectionBackgroundStyle" }] : /* istanbul ignore next */ []);
|
|
427
|
+
this.selectionClasses = computed(() => sliderSelectionThemeVariants(), ...ngDevMode ? [{ debugName: "selectionClasses" }] : /* istanbul ignore next */ []);
|
|
428
|
+
this.sliderHandleClasses = computed(() => {
|
|
429
|
+
const rounded = this.rounded();
|
|
430
|
+
const handleClasses = this.handleClasses();
|
|
431
|
+
const variants = sliderHandleThemeVariants({ rounded });
|
|
432
|
+
return twMerge(variants ?? "", Array.isArray(handleClasses) ? handleClasses.join(" ") : handleClasses);
|
|
433
|
+
}, ...ngDevMode ? [{ debugName: "sliderHandleClasses" }] : /* istanbul ignore next */ []);
|
|
434
|
+
this.sliderTrackSize = computed(() => {
|
|
435
|
+
const trackSize = this.trackSize();
|
|
436
|
+
if (trackSize == null || trackSize === "") return null;
|
|
437
|
+
if (typeof trackSize === "number") return `${trackSize}px`;
|
|
438
|
+
const number = Number(trackSize);
|
|
439
|
+
if (isNaN(number)) return trackSize;
|
|
440
|
+
return `${number}px`;
|
|
441
|
+
}, ...ngDevMode ? [{ debugName: "sliderTrackSize" }] : /* istanbul ignore next */ []);
|
|
442
|
+
this.tickClasses = computed(() => sliderTickThemeVariants(), ...ngDevMode ? [{ debugName: "tickClasses" }] : /* istanbul ignore next */ []);
|
|
443
|
+
this.tickLabelClasses = computed(() => sliderTickLabelThemeVariants(), ...ngDevMode ? [{ debugName: "tickLabelClasses" }] : /* istanbul ignore next */ []);
|
|
444
|
+
this.tickLabelListClasses = computed(() => sliderTickLabelListThemeVariants(), ...ngDevMode ? [{ debugName: "tickLabelListClasses" }] : /* istanbul ignore next */ []);
|
|
445
|
+
this.tickListClasses = computed(() => sliderTickListThemeVariants(), ...ngDevMode ? [{ debugName: "tickListClasses" }] : /* istanbul ignore next */ []);
|
|
446
|
+
this.tickStyleArgs = computed(() => {
|
|
447
|
+
return {
|
|
448
|
+
direction: this.direction(),
|
|
449
|
+
largeTickStep: this.largeTickStep(),
|
|
450
|
+
max: this.effectiveMax(),
|
|
451
|
+
min: this.effectiveMin(),
|
|
452
|
+
orientation: this.orientation(),
|
|
453
|
+
smallTickStep: this.smallTickStep()
|
|
454
|
+
};
|
|
455
|
+
}, ...ngDevMode ? [{ debugName: "tickStyleArgs" }] : /* istanbul ignore next */ []);
|
|
456
|
+
this.tickValueTemplate = contentChild(SliderTickValueTemplateDirective, {
|
|
457
|
+
...ngDevMode ? { debugName: "tickValueTemplate" } : /* istanbul ignore next */ {},
|
|
458
|
+
read: TemplateRef
|
|
459
|
+
});
|
|
460
|
+
this.ticks = computed(() => {
|
|
461
|
+
const min = this.effectiveMin();
|
|
462
|
+
const max = this.effectiveMax();
|
|
463
|
+
const step = this.step();
|
|
464
|
+
const ticks = [];
|
|
465
|
+
const count = this.#stepCount();
|
|
466
|
+
for (let i = 0; i <= count; i++) ticks.push({
|
|
467
|
+
index: i,
|
|
468
|
+
value: this.#roundToStep(min + i * step)
|
|
469
|
+
});
|
|
470
|
+
if (ticks.length === 0 || ticks[ticks.length - 1].value < max) ticks.push({
|
|
471
|
+
index: ticks.length,
|
|
472
|
+
value: max
|
|
473
|
+
});
|
|
474
|
+
return ticks;
|
|
475
|
+
}, ...ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []);
|
|
476
|
+
this.trackBackgroundStyle = computed(() => {
|
|
477
|
+
const bg = this.trackBackground();
|
|
478
|
+
if (!bg) return {};
|
|
479
|
+
return typeof bg === "string" ? { background: bg } : bg;
|
|
480
|
+
}, ...ngDevMode ? [{ debugName: "trackBackgroundStyle" }] : /* istanbul ignore next */ []);
|
|
481
|
+
this.trackClasses = computed(() => {
|
|
482
|
+
const rounded = this.rounded();
|
|
483
|
+
return sliderTrackThemeVariants({ rounded });
|
|
484
|
+
}, ...ngDevMode ? [{ debugName: "trackClasses" }] : /* istanbul ignore next */ []);
|
|
485
|
+
this.zone = inject(NgZone);
|
|
486
|
+
this.ariaDescribedBy = input(null, {
|
|
487
|
+
...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
|
|
488
|
+
alias: "aria-describedby"
|
|
489
|
+
});
|
|
490
|
+
this.ariaLabel = input(null, {
|
|
491
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
492
|
+
alias: "aria-label"
|
|
493
|
+
});
|
|
494
|
+
this.ariaLabelledBy = input(null, {
|
|
495
|
+
...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
|
|
496
|
+
alias: "aria-labelledby"
|
|
497
|
+
});
|
|
498
|
+
this.ariaValueText = input(null, ...ngDevMode ? [{ debugName: "ariaValueText" }] : /* istanbul ignore next */ []);
|
|
499
|
+
this.disabled = input(false, {
|
|
500
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
501
|
+
transform: booleanAttribute
|
|
502
|
+
});
|
|
503
|
+
this.handleClasses = input([], ...ngDevMode ? [{ debugName: "handleClasses" }] : /* istanbul ignore next */ []);
|
|
504
|
+
this.handleStyles = input({}, ...ngDevMode ? [{ debugName: "handleStyles" }] : /* istanbul ignore next */ []);
|
|
505
|
+
this.invalid = input(false, {
|
|
506
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
507
|
+
transform: booleanAttribute
|
|
508
|
+
});
|
|
509
|
+
this.labelPosition = input("after", ...ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []);
|
|
510
|
+
this.labelStep = input(1, ...ngDevMode ? [{ debugName: "labelStep" }] : /* istanbul ignore next */ []);
|
|
511
|
+
this.largeTickStep = input(null, ...ngDevMode ? [{ debugName: "largeTickStep" }] : /* istanbul ignore next */ []);
|
|
512
|
+
this.maxValue = input(10, ...ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []);
|
|
513
|
+
this.minValue = input(0, ...ngDevMode ? [{ debugName: "minValue" }] : /* istanbul ignore next */ []);
|
|
514
|
+
this.orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
|
|
515
|
+
this.readonly = input(false, {
|
|
516
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
517
|
+
transform: booleanAttribute
|
|
518
|
+
});
|
|
519
|
+
this.rounded = input("full", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
520
|
+
this.selectionBackground = input(null, ...ngDevMode ? [{ debugName: "selectionBackground" }] : /* istanbul ignore next */ []);
|
|
521
|
+
this.shiftMultiplier = input(10, ...ngDevMode ? [{ debugName: "shiftMultiplier" }] : /* istanbul ignore next */ []);
|
|
522
|
+
this.showLabels = input(false, {
|
|
523
|
+
...ngDevMode ? { debugName: "showLabels" } : /* istanbul ignore next */ {},
|
|
524
|
+
transform: booleanAttribute
|
|
525
|
+
});
|
|
526
|
+
this.showTicks = input(false, {
|
|
527
|
+
...ngDevMode ? { debugName: "showTicks" } : /* istanbul ignore next */ {},
|
|
528
|
+
transform: booleanAttribute
|
|
529
|
+
});
|
|
530
|
+
this.smallTickStep = input(1, {
|
|
531
|
+
...ngDevMode ? { debugName: "smallTickStep" } : /* istanbul ignore next */ {},
|
|
532
|
+
transform: (value) => Math.max(value, 1)
|
|
533
|
+
});
|
|
534
|
+
this.step = input(1, {
|
|
535
|
+
...ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {},
|
|
536
|
+
transform: (value) => value <= 0 ? 1 : value
|
|
537
|
+
});
|
|
538
|
+
this.touch = output();
|
|
539
|
+
this.touched = input(false, {
|
|
540
|
+
...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
|
|
541
|
+
transform: booleanAttribute
|
|
542
|
+
});
|
|
543
|
+
this.trackBackground = input(null, ...ngDevMode ? [{ debugName: "trackBackground" }] : /* istanbul ignore next */ []);
|
|
544
|
+
this.trackSize = input(...ngDevMode ? [void 0, { debugName: "trackSize" }] : /* istanbul ignore next */ []);
|
|
545
|
+
afterNextRender({ read: () => this.zone.runOutsideAngular(() => this.setSubscriptions()) });
|
|
546
|
+
if (isDevMode()) this.#warnWhenMisconfigured();
|
|
547
|
+
}
|
|
548
|
+
setLabelledBy(id) {
|
|
549
|
+
this.#label.setLabelledBy(id);
|
|
550
|
+
}
|
|
551
|
+
calculateNewValue(currentValue, event) {
|
|
552
|
+
const min = this.effectiveMin();
|
|
553
|
+
const max = this.effectiveMax();
|
|
554
|
+
const step = this.step();
|
|
555
|
+
const isRtl = this.isRtl();
|
|
556
|
+
const amount = event.shiftKey ? step * this.shiftMultiplier() : step;
|
|
557
|
+
const page = Math.max((max - min) * .1, step);
|
|
558
|
+
const lastGridValue = this.#roundToStep(min + this.#stepCount() * step);
|
|
559
|
+
const decreaseFrom = currentValue > lastGridValue ? lastGridValue + step : currentValue;
|
|
560
|
+
const decreaseKey = isRtl ? "ArrowRight" : "ArrowLeft";
|
|
561
|
+
const increaseKey = isRtl ? "ArrowLeft" : "ArrowRight";
|
|
562
|
+
let newValue = currentValue;
|
|
563
|
+
switch (event.key) {
|
|
564
|
+
case decreaseKey:
|
|
565
|
+
case "ArrowDown":
|
|
566
|
+
newValue = decreaseFrom - amount;
|
|
567
|
+
break;
|
|
568
|
+
case increaseKey:
|
|
569
|
+
case "ArrowUp":
|
|
570
|
+
newValue = currentValue + amount;
|
|
571
|
+
break;
|
|
572
|
+
case "Home":
|
|
573
|
+
newValue = min;
|
|
574
|
+
break;
|
|
575
|
+
case "End":
|
|
576
|
+
newValue = max;
|
|
577
|
+
break;
|
|
578
|
+
case "PageDown":
|
|
579
|
+
newValue = decreaseFrom - page;
|
|
580
|
+
break;
|
|
581
|
+
case "PageUp": newValue = currentValue + page;
|
|
582
|
+
}
|
|
583
|
+
return this.snapValue(newValue);
|
|
584
|
+
}
|
|
585
|
+
clampValue(value) {
|
|
586
|
+
return Math.max(this.effectiveMin(), Math.min(this.effectiveMax(), value));
|
|
587
|
+
}
|
|
588
|
+
getMaxOverride() {}
|
|
589
|
+
getMinOverride() {}
|
|
590
|
+
getValueFromPointerEvent(event) {
|
|
591
|
+
const containerRect = this.hostElementRef.nativeElement.getBoundingClientRect();
|
|
592
|
+
let normalizedHandlePos;
|
|
593
|
+
if (this.orientation() === "horizontal") normalizedHandlePos = (this.isRtl() ? containerRect.right - event.clientX : event.clientX - containerRect.left) / containerRect.width * 100;
|
|
594
|
+
else normalizedHandlePos = 100 - (event.clientY - containerRect.top) / containerRect.height * 100;
|
|
595
|
+
normalizedHandlePos = Math.max(0, Math.min(normalizedHandlePos, 100));
|
|
596
|
+
return this.getValueFromPosition(normalizedHandlePos);
|
|
597
|
+
}
|
|
598
|
+
getValueFromPosition(position) {
|
|
599
|
+
const min = this.effectiveMin();
|
|
600
|
+
const max = this.effectiveMax();
|
|
601
|
+
if (position >= 100) return max;
|
|
602
|
+
if (position <= 0) return min;
|
|
603
|
+
const range = max - min;
|
|
604
|
+
const rawValue = min + position / 100 * range;
|
|
605
|
+
return this.snapValue(rawValue);
|
|
606
|
+
}
|
|
607
|
+
isNavigationKey(event) {
|
|
608
|
+
return [
|
|
609
|
+
"ArrowLeft",
|
|
610
|
+
"ArrowRight",
|
|
611
|
+
"ArrowUp",
|
|
612
|
+
"ArrowDown",
|
|
613
|
+
"Home",
|
|
614
|
+
"End",
|
|
615
|
+
"PageUp",
|
|
616
|
+
"PageDown"
|
|
617
|
+
].includes(event.key);
|
|
618
|
+
}
|
|
619
|
+
positionFromValue(value) {
|
|
620
|
+
return valueToPosition(value, this.effectiveMin(), this.effectiveMax());
|
|
621
|
+
}
|
|
622
|
+
snapValue(value) {
|
|
623
|
+
const min = this.effectiveMin();
|
|
624
|
+
const max = this.effectiveMax();
|
|
625
|
+
if (Number.isNaN(value) || max <= min) return min;
|
|
626
|
+
const step = this.step();
|
|
627
|
+
const clampedValue = this.clampValue(value);
|
|
628
|
+
const snappedValue = this.clampValue(this.#roundToStep(Math.round((clampedValue - min) / step) * step + min));
|
|
629
|
+
return max - clampedValue < Math.abs(clampedValue - snappedValue) ? max : snappedValue;
|
|
630
|
+
}
|
|
631
|
+
trackHandleDrag(handle, startDrag) {
|
|
632
|
+
fromEvent(handle, "pointerdown").pipe(filter((event) => event.button === 0 && event.isPrimary && !event.ctrlKey), filter(() => !this.dragging() && !this.interactionDisabled()), tap((event) => {
|
|
633
|
+
this.zone.run(() => this.dragging.set(true));
|
|
634
|
+
handle.setPointerCapture?.(event.pointerId);
|
|
635
|
+
handle.focus({ preventScroll: true });
|
|
636
|
+
}), switchMap((down) => {
|
|
637
|
+
const pointerEvents = (target, name) => fromEvent(target, name).pipe(filter((event) => event.pointerId === down.pointerId));
|
|
638
|
+
const end$ = merge(pointerEvents(this.#document, "pointerup"), pointerEvents(this.#document, "pointercancel"), pointerEvents(handle, "lostpointercapture")).pipe(tap(() => this.zone.run(() => this.dragging.set(false))));
|
|
639
|
+
return pointerEvents(this.#document, "pointermove").pipe(tap(startDrag()), takeUntil(end$));
|
|
640
|
+
}), takeUntilDestroyed(this.destroyRef)).subscribe();
|
|
641
|
+
}
|
|
642
|
+
#roundToStep(value) {
|
|
643
|
+
return roundToPlaces(value, this.#stepPlaces());
|
|
644
|
+
}
|
|
645
|
+
#stepCount() {
|
|
646
|
+
return Math.floor((this.effectiveMax() - this.effectiveMin()) / this.step());
|
|
647
|
+
}
|
|
648
|
+
#warnWhenMisconfigured() {
|
|
649
|
+
const host = this.hostElementRef.nativeElement;
|
|
650
|
+
let warnedAboutBounds = false;
|
|
651
|
+
let warnedAboutValue = false;
|
|
652
|
+
effect(() => {
|
|
653
|
+
if (!warnedAboutBounds && this.effectiveMin() >= this.effectiveMax()) {
|
|
654
|
+
warnedAboutBounds = true;
|
|
655
|
+
console.warn(`[Mona Slider] The minimum (${this.effectiveMin()}) must be lower than the maximum (${this.effectiveMax()}).`, host);
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
effect(() => {
|
|
659
|
+
if (!warnedAboutValue && !this.valueIsShown()) {
|
|
660
|
+
warnedAboutValue = true;
|
|
661
|
+
console.warn("[Mona Slider] The value is out of range or off the step grid. The slider shows the nearest valid value, and the model keeps its own until the user changes it.", host);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
static {
|
|
666
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
667
|
+
minVersion: "12.0.0",
|
|
668
|
+
version: "22.2.6",
|
|
669
|
+
ngImport: i0,
|
|
670
|
+
type: SliderBaseComponent,
|
|
671
|
+
deps: [],
|
|
672
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
static {
|
|
676
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
677
|
+
minVersion: "17.2.0",
|
|
678
|
+
version: "22.2.6",
|
|
679
|
+
type: SliderBaseComponent,
|
|
680
|
+
isStandalone: true,
|
|
681
|
+
inputs: {
|
|
682
|
+
ariaDescribedBy: {
|
|
683
|
+
classPropertyName: "ariaDescribedBy",
|
|
684
|
+
publicName: "aria-describedby",
|
|
685
|
+
isSignal: true,
|
|
686
|
+
isRequired: false,
|
|
687
|
+
transformFunction: null
|
|
688
|
+
},
|
|
689
|
+
ariaLabel: {
|
|
690
|
+
classPropertyName: "ariaLabel",
|
|
691
|
+
publicName: "aria-label",
|
|
692
|
+
isSignal: true,
|
|
693
|
+
isRequired: false,
|
|
694
|
+
transformFunction: null
|
|
695
|
+
},
|
|
696
|
+
ariaLabelledBy: {
|
|
697
|
+
classPropertyName: "ariaLabelledBy",
|
|
698
|
+
publicName: "aria-labelledby",
|
|
699
|
+
isSignal: true,
|
|
700
|
+
isRequired: false,
|
|
701
|
+
transformFunction: null
|
|
702
|
+
},
|
|
703
|
+
ariaValueText: {
|
|
704
|
+
classPropertyName: "ariaValueText",
|
|
705
|
+
publicName: "ariaValueText",
|
|
706
|
+
isSignal: true,
|
|
707
|
+
isRequired: false,
|
|
708
|
+
transformFunction: null
|
|
709
|
+
},
|
|
710
|
+
disabled: {
|
|
711
|
+
classPropertyName: "disabled",
|
|
712
|
+
publicName: "disabled",
|
|
713
|
+
isSignal: true,
|
|
714
|
+
isRequired: false,
|
|
715
|
+
transformFunction: null
|
|
716
|
+
},
|
|
717
|
+
handleClasses: {
|
|
718
|
+
classPropertyName: "handleClasses",
|
|
719
|
+
publicName: "handleClasses",
|
|
720
|
+
isSignal: true,
|
|
721
|
+
isRequired: false,
|
|
722
|
+
transformFunction: null
|
|
723
|
+
},
|
|
724
|
+
handleStyles: {
|
|
725
|
+
classPropertyName: "handleStyles",
|
|
726
|
+
publicName: "handleStyles",
|
|
727
|
+
isSignal: true,
|
|
728
|
+
isRequired: false,
|
|
729
|
+
transformFunction: null
|
|
730
|
+
},
|
|
731
|
+
invalid: {
|
|
732
|
+
classPropertyName: "invalid",
|
|
733
|
+
publicName: "invalid",
|
|
734
|
+
isSignal: true,
|
|
735
|
+
isRequired: false,
|
|
736
|
+
transformFunction: null
|
|
737
|
+
},
|
|
738
|
+
labelPosition: {
|
|
739
|
+
classPropertyName: "labelPosition",
|
|
740
|
+
publicName: "labelPosition",
|
|
741
|
+
isSignal: true,
|
|
742
|
+
isRequired: false,
|
|
743
|
+
transformFunction: null
|
|
744
|
+
},
|
|
745
|
+
labelStep: {
|
|
746
|
+
classPropertyName: "labelStep",
|
|
747
|
+
publicName: "labelStep",
|
|
748
|
+
isSignal: true,
|
|
749
|
+
isRequired: false,
|
|
750
|
+
transformFunction: null
|
|
751
|
+
},
|
|
752
|
+
largeTickStep: {
|
|
753
|
+
classPropertyName: "largeTickStep",
|
|
754
|
+
publicName: "largeTickStep",
|
|
755
|
+
isSignal: true,
|
|
756
|
+
isRequired: false,
|
|
757
|
+
transformFunction: null
|
|
758
|
+
},
|
|
759
|
+
maxValue: {
|
|
760
|
+
classPropertyName: "maxValue",
|
|
761
|
+
publicName: "maxValue",
|
|
762
|
+
isSignal: true,
|
|
763
|
+
isRequired: false,
|
|
764
|
+
transformFunction: null
|
|
765
|
+
},
|
|
766
|
+
minValue: {
|
|
767
|
+
classPropertyName: "minValue",
|
|
768
|
+
publicName: "minValue",
|
|
769
|
+
isSignal: true,
|
|
770
|
+
isRequired: false,
|
|
771
|
+
transformFunction: null
|
|
772
|
+
},
|
|
773
|
+
orientation: {
|
|
774
|
+
classPropertyName: "orientation",
|
|
775
|
+
publicName: "orientation",
|
|
776
|
+
isSignal: true,
|
|
777
|
+
isRequired: false,
|
|
778
|
+
transformFunction: null
|
|
779
|
+
},
|
|
780
|
+
readonly: {
|
|
781
|
+
classPropertyName: "readonly",
|
|
782
|
+
publicName: "readonly",
|
|
783
|
+
isSignal: true,
|
|
784
|
+
isRequired: false,
|
|
785
|
+
transformFunction: null
|
|
786
|
+
},
|
|
787
|
+
rounded: {
|
|
788
|
+
classPropertyName: "rounded",
|
|
789
|
+
publicName: "rounded",
|
|
790
|
+
isSignal: true,
|
|
791
|
+
isRequired: false,
|
|
792
|
+
transformFunction: null
|
|
793
|
+
},
|
|
794
|
+
selectionBackground: {
|
|
795
|
+
classPropertyName: "selectionBackground",
|
|
796
|
+
publicName: "selectionBackground",
|
|
797
|
+
isSignal: true,
|
|
798
|
+
isRequired: false,
|
|
799
|
+
transformFunction: null
|
|
800
|
+
},
|
|
801
|
+
shiftMultiplier: {
|
|
802
|
+
classPropertyName: "shiftMultiplier",
|
|
803
|
+
publicName: "shiftMultiplier",
|
|
804
|
+
isSignal: true,
|
|
805
|
+
isRequired: false,
|
|
806
|
+
transformFunction: null
|
|
807
|
+
},
|
|
808
|
+
showLabels: {
|
|
809
|
+
classPropertyName: "showLabels",
|
|
810
|
+
publicName: "showLabels",
|
|
811
|
+
isSignal: true,
|
|
812
|
+
isRequired: false,
|
|
813
|
+
transformFunction: null
|
|
814
|
+
},
|
|
815
|
+
showTicks: {
|
|
816
|
+
classPropertyName: "showTicks",
|
|
817
|
+
publicName: "showTicks",
|
|
818
|
+
isSignal: true,
|
|
819
|
+
isRequired: false,
|
|
820
|
+
transformFunction: null
|
|
821
|
+
},
|
|
822
|
+
smallTickStep: {
|
|
823
|
+
classPropertyName: "smallTickStep",
|
|
824
|
+
publicName: "smallTickStep",
|
|
825
|
+
isSignal: true,
|
|
826
|
+
isRequired: false,
|
|
827
|
+
transformFunction: null
|
|
828
|
+
},
|
|
829
|
+
step: {
|
|
830
|
+
classPropertyName: "step",
|
|
831
|
+
publicName: "step",
|
|
832
|
+
isSignal: true,
|
|
833
|
+
isRequired: false,
|
|
834
|
+
transformFunction: null
|
|
835
|
+
},
|
|
836
|
+
touched: {
|
|
837
|
+
classPropertyName: "touched",
|
|
838
|
+
publicName: "touched",
|
|
839
|
+
isSignal: true,
|
|
840
|
+
isRequired: false,
|
|
841
|
+
transformFunction: null
|
|
842
|
+
},
|
|
843
|
+
trackBackground: {
|
|
844
|
+
classPropertyName: "trackBackground",
|
|
845
|
+
publicName: "trackBackground",
|
|
846
|
+
isSignal: true,
|
|
847
|
+
isRequired: false,
|
|
848
|
+
transformFunction: null
|
|
849
|
+
},
|
|
850
|
+
trackSize: {
|
|
851
|
+
classPropertyName: "trackSize",
|
|
852
|
+
publicName: "trackSize",
|
|
853
|
+
isSignal: true,
|
|
854
|
+
isRequired: false,
|
|
855
|
+
transformFunction: null
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
outputs: { touch: "touch" },
|
|
859
|
+
queries: [{
|
|
860
|
+
propertyName: "handleTemplate",
|
|
861
|
+
first: true,
|
|
862
|
+
predicate: SliderHandleTemplateDirective,
|
|
863
|
+
descendants: true,
|
|
864
|
+
read: TemplateRef,
|
|
865
|
+
isSignal: true
|
|
866
|
+
}, {
|
|
867
|
+
propertyName: "tickValueTemplate",
|
|
868
|
+
first: true,
|
|
869
|
+
predicate: SliderTickValueTemplateDirective,
|
|
870
|
+
descendants: true,
|
|
871
|
+
read: TemplateRef,
|
|
872
|
+
isSignal: true
|
|
873
|
+
}],
|
|
874
|
+
ngImport: i0
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
879
|
+
minVersion: "12.0.0",
|
|
880
|
+
version: "22.2.6",
|
|
881
|
+
ngImport: i0,
|
|
882
|
+
type: SliderBaseComponent,
|
|
883
|
+
decorators: [{ type: Directive }],
|
|
884
|
+
ctorParameters: () => [],
|
|
885
|
+
propDecorators: {
|
|
886
|
+
handleTemplate: [{
|
|
887
|
+
type: i0.ContentChild,
|
|
888
|
+
args: [i0.forwardRef(() => SliderHandleTemplateDirective), {
|
|
889
|
+
read: TemplateRef,
|
|
890
|
+
isSignal: true
|
|
891
|
+
}]
|
|
892
|
+
}],
|
|
893
|
+
tickValueTemplate: [{
|
|
894
|
+
type: i0.ContentChild,
|
|
895
|
+
args: [i0.forwardRef(() => SliderTickValueTemplateDirective), {
|
|
896
|
+
read: TemplateRef,
|
|
897
|
+
isSignal: true
|
|
898
|
+
}]
|
|
899
|
+
}],
|
|
900
|
+
ariaDescribedBy: [{
|
|
901
|
+
type: i0.Input,
|
|
902
|
+
args: [{
|
|
903
|
+
isSignal: true,
|
|
904
|
+
alias: "aria-describedby",
|
|
905
|
+
required: false
|
|
906
|
+
}]
|
|
907
|
+
}],
|
|
908
|
+
ariaLabel: [{
|
|
909
|
+
type: i0.Input,
|
|
910
|
+
args: [{
|
|
911
|
+
isSignal: true,
|
|
912
|
+
alias: "aria-label",
|
|
913
|
+
required: false
|
|
914
|
+
}]
|
|
915
|
+
}],
|
|
916
|
+
ariaLabelledBy: [{
|
|
917
|
+
type: i0.Input,
|
|
918
|
+
args: [{
|
|
919
|
+
isSignal: true,
|
|
920
|
+
alias: "aria-labelledby",
|
|
921
|
+
required: false
|
|
922
|
+
}]
|
|
923
|
+
}],
|
|
924
|
+
ariaValueText: [{
|
|
925
|
+
type: i0.Input,
|
|
926
|
+
args: [{
|
|
927
|
+
isSignal: true,
|
|
928
|
+
alias: "ariaValueText",
|
|
929
|
+
required: false
|
|
930
|
+
}]
|
|
931
|
+
}],
|
|
932
|
+
disabled: [{
|
|
933
|
+
type: i0.Input,
|
|
934
|
+
args: [{
|
|
935
|
+
isSignal: true,
|
|
936
|
+
alias: "disabled",
|
|
937
|
+
required: false
|
|
938
|
+
}]
|
|
939
|
+
}],
|
|
940
|
+
handleClasses: [{
|
|
941
|
+
type: i0.Input,
|
|
942
|
+
args: [{
|
|
943
|
+
isSignal: true,
|
|
944
|
+
alias: "handleClasses",
|
|
945
|
+
required: false
|
|
946
|
+
}]
|
|
947
|
+
}],
|
|
948
|
+
handleStyles: [{
|
|
949
|
+
type: i0.Input,
|
|
950
|
+
args: [{
|
|
951
|
+
isSignal: true,
|
|
952
|
+
alias: "handleStyles",
|
|
953
|
+
required: false
|
|
954
|
+
}]
|
|
955
|
+
}],
|
|
956
|
+
invalid: [{
|
|
957
|
+
type: i0.Input,
|
|
958
|
+
args: [{
|
|
959
|
+
isSignal: true,
|
|
960
|
+
alias: "invalid",
|
|
961
|
+
required: false
|
|
962
|
+
}]
|
|
963
|
+
}],
|
|
964
|
+
labelPosition: [{
|
|
965
|
+
type: i0.Input,
|
|
966
|
+
args: [{
|
|
967
|
+
isSignal: true,
|
|
968
|
+
alias: "labelPosition",
|
|
969
|
+
required: false
|
|
970
|
+
}]
|
|
971
|
+
}],
|
|
972
|
+
labelStep: [{
|
|
973
|
+
type: i0.Input,
|
|
974
|
+
args: [{
|
|
975
|
+
isSignal: true,
|
|
976
|
+
alias: "labelStep",
|
|
977
|
+
required: false
|
|
978
|
+
}]
|
|
979
|
+
}],
|
|
980
|
+
largeTickStep: [{
|
|
981
|
+
type: i0.Input,
|
|
982
|
+
args: [{
|
|
983
|
+
isSignal: true,
|
|
984
|
+
alias: "largeTickStep",
|
|
985
|
+
required: false
|
|
986
|
+
}]
|
|
987
|
+
}],
|
|
988
|
+
maxValue: [{
|
|
989
|
+
type: i0.Input,
|
|
990
|
+
args: [{
|
|
991
|
+
isSignal: true,
|
|
992
|
+
alias: "maxValue",
|
|
993
|
+
required: false
|
|
994
|
+
}]
|
|
995
|
+
}],
|
|
996
|
+
minValue: [{
|
|
997
|
+
type: i0.Input,
|
|
998
|
+
args: [{
|
|
999
|
+
isSignal: true,
|
|
1000
|
+
alias: "minValue",
|
|
1001
|
+
required: false
|
|
1002
|
+
}]
|
|
1003
|
+
}],
|
|
1004
|
+
orientation: [{
|
|
1005
|
+
type: i0.Input,
|
|
1006
|
+
args: [{
|
|
1007
|
+
isSignal: true,
|
|
1008
|
+
alias: "orientation",
|
|
1009
|
+
required: false
|
|
1010
|
+
}]
|
|
1011
|
+
}],
|
|
1012
|
+
readonly: [{
|
|
1013
|
+
type: i0.Input,
|
|
1014
|
+
args: [{
|
|
1015
|
+
isSignal: true,
|
|
1016
|
+
alias: "readonly",
|
|
1017
|
+
required: false
|
|
1018
|
+
}]
|
|
1019
|
+
}],
|
|
1020
|
+
rounded: [{
|
|
1021
|
+
type: i0.Input,
|
|
1022
|
+
args: [{
|
|
1023
|
+
isSignal: true,
|
|
1024
|
+
alias: "rounded",
|
|
1025
|
+
required: false
|
|
1026
|
+
}]
|
|
1027
|
+
}],
|
|
1028
|
+
selectionBackground: [{
|
|
1029
|
+
type: i0.Input,
|
|
1030
|
+
args: [{
|
|
1031
|
+
isSignal: true,
|
|
1032
|
+
alias: "selectionBackground",
|
|
1033
|
+
required: false
|
|
1034
|
+
}]
|
|
1035
|
+
}],
|
|
1036
|
+
shiftMultiplier: [{
|
|
1037
|
+
type: i0.Input,
|
|
1038
|
+
args: [{
|
|
1039
|
+
isSignal: true,
|
|
1040
|
+
alias: "shiftMultiplier",
|
|
1041
|
+
required: false
|
|
1042
|
+
}]
|
|
1043
|
+
}],
|
|
1044
|
+
showLabels: [{
|
|
1045
|
+
type: i0.Input,
|
|
1046
|
+
args: [{
|
|
1047
|
+
isSignal: true,
|
|
1048
|
+
alias: "showLabels",
|
|
1049
|
+
required: false
|
|
1050
|
+
}]
|
|
1051
|
+
}],
|
|
1052
|
+
showTicks: [{
|
|
1053
|
+
type: i0.Input,
|
|
1054
|
+
args: [{
|
|
1055
|
+
isSignal: true,
|
|
1056
|
+
alias: "showTicks",
|
|
1057
|
+
required: false
|
|
1058
|
+
}]
|
|
1059
|
+
}],
|
|
1060
|
+
smallTickStep: [{
|
|
1061
|
+
type: i0.Input,
|
|
1062
|
+
args: [{
|
|
1063
|
+
isSignal: true,
|
|
1064
|
+
alias: "smallTickStep",
|
|
1065
|
+
required: false
|
|
1066
|
+
}]
|
|
1067
|
+
}],
|
|
1068
|
+
step: [{
|
|
1069
|
+
type: i0.Input,
|
|
1070
|
+
args: [{
|
|
1071
|
+
isSignal: true,
|
|
1072
|
+
alias: "step",
|
|
1073
|
+
required: false
|
|
1074
|
+
}]
|
|
1075
|
+
}],
|
|
1076
|
+
touch: [{
|
|
1077
|
+
type: i0.Output,
|
|
1078
|
+
args: ["touch"]
|
|
1079
|
+
}],
|
|
1080
|
+
touched: [{
|
|
1081
|
+
type: i0.Input,
|
|
1082
|
+
args: [{
|
|
1083
|
+
isSignal: true,
|
|
1084
|
+
alias: "touched",
|
|
1085
|
+
required: false
|
|
1086
|
+
}]
|
|
1087
|
+
}],
|
|
1088
|
+
trackBackground: [{
|
|
1089
|
+
type: i0.Input,
|
|
1090
|
+
args: [{
|
|
1091
|
+
isSignal: true,
|
|
1092
|
+
alias: "trackBackground",
|
|
1093
|
+
required: false
|
|
1094
|
+
}]
|
|
1095
|
+
}],
|
|
1096
|
+
trackSize: [{
|
|
1097
|
+
type: i0.Input,
|
|
1098
|
+
args: [{
|
|
1099
|
+
isSignal: true,
|
|
1100
|
+
alias: "trackSize",
|
|
1101
|
+
required: false
|
|
1102
|
+
}]
|
|
1103
|
+
}]
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
var SliderComponent = class SliderComponent extends SliderBaseComponent {
|
|
1107
|
+
constructor() {
|
|
1108
|
+
super(...arguments);
|
|
1109
|
+
this.computedAriaLabel = computed(() => this.ariaLabel() ?? (this.labelledBy() ? null : this.messages().sliderValue), ...ngDevMode ? [{ debugName: "computedAriaLabel" }] : /* istanbul ignore next */ []);
|
|
1110
|
+
this.handleFocused = signal(false, ...ngDevMode ? [{ debugName: "handleFocused" }] : /* istanbul ignore next */ []);
|
|
1111
|
+
this.handlePosition = computed(() => this.positionFromValue(this.normalizedValue()), ...ngDevMode ? [{ debugName: "handlePosition" }] : /* istanbul ignore next */ []);
|
|
1112
|
+
this.handleStyle = computed(() => ({
|
|
1113
|
+
...this.handleTemplateStyles(),
|
|
1114
|
+
...this.handleStyles()
|
|
1115
|
+
}), ...ngDevMode ? [{ debugName: "handleStyle" }] : /* istanbul ignore next */ []);
|
|
1116
|
+
this.messages = this.i18n.componentMessages("slider", SLIDER_DEFAULT_MESSAGES);
|
|
1117
|
+
this.normalizedValue = computed(() => this.snapValue(this.value()), ...ngDevMode ? [{ debugName: "normalizedValue" }] : /* istanbul ignore next */ []);
|
|
1118
|
+
this.selectionLeft = computed(() => 0, ...ngDevMode ? [{ debugName: "selectionLeft" }] : /* istanbul ignore next */ []);
|
|
1119
|
+
this.selectionRight = computed(() => this.handlePosition(), ...ngDevMode ? [{ debugName: "selectionRight" }] : /* istanbul ignore next */ []);
|
|
1120
|
+
this.sliderHandle = viewChild.required("sliderHandle", ...ngDevMode ? [{ debugName: "sliderHandle" }] : /* istanbul ignore next */ []);
|
|
1121
|
+
this.valueIsShown = computed(() => this.normalizedValue() === this.value(), ...ngDevMode ? [{ debugName: "valueIsShown" }] : /* istanbul ignore next */ []);
|
|
1122
|
+
this.max = input(void 0, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
|
|
1123
|
+
this.min = input(void 0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
|
|
1124
|
+
this.value = model(0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
1125
|
+
}
|
|
1126
|
+
focus(options) {
|
|
1127
|
+
if (!this.effectiveDisabled()) this.sliderHandle().nativeElement.focus(options);
|
|
1128
|
+
}
|
|
1129
|
+
getMaxOverride() {
|
|
1130
|
+
return this.max();
|
|
1131
|
+
}
|
|
1132
|
+
getMinOverride() {
|
|
1133
|
+
return this.min();
|
|
1134
|
+
}
|
|
1135
|
+
handleHandleMove(event) {
|
|
1136
|
+
this.updateValue(this.getValueFromPointerEvent(event));
|
|
1137
|
+
}
|
|
1138
|
+
setSubscriptions() {
|
|
1139
|
+
this.setClickSubscription();
|
|
1140
|
+
this.setKeydownSubscription();
|
|
1141
|
+
this.setPointerMoveSubscription();
|
|
1142
|
+
this.setFocusSubscription();
|
|
1143
|
+
}
|
|
1144
|
+
setClickSubscription() {
|
|
1145
|
+
fromEvent(this.hostElementRef.nativeElement, "click").pipe(takeUntilDestroyed(this.destroyRef), tap(() => this.dragging.set(false)), filter(() => !this.interactionDisabled())).subscribe((event) => {
|
|
1146
|
+
const handle = this.sliderHandle().nativeElement;
|
|
1147
|
+
if (!handle.contains(event.target)) this.handleHandleMove(event);
|
|
1148
|
+
handle.focus({ preventScroll: true });
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
setFocusSubscription() {
|
|
1152
|
+
fromEvent(this.sliderHandle().nativeElement, "focus").pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.zone.run(() => this.handleFocused.set(true)));
|
|
1153
|
+
fromEvent(this.sliderHandle().nativeElement, "blur").pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
1154
|
+
this.zone.run(() => {
|
|
1155
|
+
this.handleFocused.set(false);
|
|
1156
|
+
this.touch.emit();
|
|
1157
|
+
});
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
setKeydownSubscription() {
|
|
1161
|
+
fromEvent(this.sliderHandle().nativeElement, "keydown").pipe(takeUntilDestroyed(this.destroyRef), filter(() => !this.interactionDisabled()), filter((event) => this.isNavigationKey(event)), tap((event) => {
|
|
1162
|
+
event.preventDefault();
|
|
1163
|
+
event.stopPropagation();
|
|
1164
|
+
})).subscribe((event) => this.updateValue(this.calculateNewValue(this.normalizedValue(), event)));
|
|
1165
|
+
}
|
|
1166
|
+
setPointerMoveSubscription() {
|
|
1167
|
+
this.trackHandleDrag(this.sliderHandle().nativeElement, () => (event) => this.handleHandleMove(event));
|
|
1168
|
+
}
|
|
1169
|
+
updateValue(value) {
|
|
1170
|
+
const nextValue = this.snapValue(value);
|
|
1171
|
+
if (nextValue === this.normalizedValue()) return;
|
|
1172
|
+
this.zone.run(() => this.value.set(nextValue));
|
|
1173
|
+
}
|
|
1174
|
+
static {
|
|
1175
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1176
|
+
minVersion: "12.0.0",
|
|
1177
|
+
version: "22.2.6",
|
|
1178
|
+
ngImport: i0,
|
|
1179
|
+
type: SliderComponent,
|
|
1180
|
+
deps: null,
|
|
1181
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
static {
|
|
1185
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1186
|
+
minVersion: "17.0.0",
|
|
1187
|
+
version: "22.2.6",
|
|
1188
|
+
type: SliderComponent,
|
|
1189
|
+
isStandalone: true,
|
|
1190
|
+
selector: "mona-slider",
|
|
1191
|
+
inputs: {
|
|
1192
|
+
max: {
|
|
1193
|
+
classPropertyName: "max",
|
|
1194
|
+
publicName: "max",
|
|
1195
|
+
isSignal: true,
|
|
1196
|
+
isRequired: false,
|
|
1197
|
+
transformFunction: null
|
|
1198
|
+
},
|
|
1199
|
+
min: {
|
|
1200
|
+
classPropertyName: "min",
|
|
1201
|
+
publicName: "min",
|
|
1202
|
+
isSignal: true,
|
|
1203
|
+
isRequired: false,
|
|
1204
|
+
transformFunction: null
|
|
1205
|
+
},
|
|
1206
|
+
value: {
|
|
1207
|
+
classPropertyName: "value",
|
|
1208
|
+
publicName: "value",
|
|
1209
|
+
isSignal: true,
|
|
1210
|
+
isRequired: false,
|
|
1211
|
+
transformFunction: null
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
outputs: { value: "valueChange" },
|
|
1215
|
+
host: { properties: {
|
|
1216
|
+
"attr.aria-describedby": "null",
|
|
1217
|
+
"attr.aria-label": "null",
|
|
1218
|
+
"attr.aria-labelledby": "null",
|
|
1219
|
+
"class": "baseClasses()",
|
|
1220
|
+
"class.mona-slider": "true",
|
|
1221
|
+
"attr.data-disabled": "effectiveDisabled() || null",
|
|
1222
|
+
"attr.data-orientation": "orientation()",
|
|
1223
|
+
"attr.data-readonly": "readonly() || null"
|
|
1224
|
+
} },
|
|
1225
|
+
viewQueries: [{
|
|
1226
|
+
propertyName: "sliderHandle",
|
|
1227
|
+
first: true,
|
|
1228
|
+
predicate: ["sliderHandle"],
|
|
1229
|
+
descendants: true,
|
|
1230
|
+
isSignal: true
|
|
1231
|
+
}],
|
|
1232
|
+
usesInheritance: true,
|
|
1233
|
+
ngImport: i0,
|
|
1234
|
+
template: "<div\n [class]=\"trackClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style.height]=\"orientation() === 'horizontal' ? sliderTrackSize() : undefined\"\n [style.width]=\"orientation() === 'vertical' ? sliderTrackSize() : undefined\"\n [style]=\"trackBackgroundStyle()\">\n <div\n [class]=\"selectionClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [style.left.%]=\"horizontalSelectionLeft()\"\n [style.right.%]=\"horizontalSelectionRight()\"\n [style.bottom.%]=\"orientation() === 'vertical' ? selectionLeft() : undefined\"\n [style.top.%]=\"orientation() === 'vertical' ? 100 - selectionRight() : undefined\"\n [style]=\"selectionBackgroundStyle()\"></div>\n</div>\n@if (showTicks()) {\n <div [class]=\"tickListClasses()\" [attr.data-orientation]=\"orientation()\">\n @for (tick of renderTicks(); track tick.index) {\n <span\n [class]=\"tickClasses()\"\n [style]=\"tick | tickStyle: tickStyleArgs()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-value]=\"tick.value\"\n data-slider-tick>\n </span>\n }\n </div>\n}\n@if (showTicks() && showLabels()) {\n <div\n [class]=\"tickLabelListClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-label-position]=\"labelPosition()\">\n @for (tick of labelTicks(); track tick.index) {\n <span\n [class]=\"tickLabelClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style]=\"tick | labelStyle: labelStyleArgs()\">\n @if (!tickValueTemplate()) {\n <span>{{ tick.label }}</span>\n } @else {\n <span>\n <ng-container\n *ngTemplateOutlet=\"\n tickValueTemplate() ?? null;\n context: { $implicit: tick.value }\n \"></ng-container>\n </span>\n }\n </span>\n }\n </div>\n}\n<div\n [class]=\"sliderHandleClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [attr.data-rtl]=\"isRtl() || null\"\n [attr.data-focused]=\"handleFocused()\"\n [style]=\"handleStyle()\"\n [style.left.%]=\"orientation() === 'horizontal' && !isRtl() ? handlePosition() : undefined\"\n [style.right.%]=\"orientation() === 'horizontal' && isRtl() ? handlePosition() : undefined\"\n [style.bottom.%]=\"orientation() === 'vertical' ? handlePosition() : undefined\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-valuemin]=\"effectiveMin()\"\n [attr.aria-valuemax]=\"effectiveMax()\"\n [attr.aria-valuenow]=\"normalizedValue()\"\n [attr.aria-valuetext]=\"ariaValueText() ? ariaValueText()!(normalizedValue()) : null\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-label]=\"computedAriaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n #sliderHandle>\n @if (handleTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"handleTemplate() ?? null; context: { $implicit: normalizedValue() }\"></ng-container>\n }\n</div>\n",
|
|
1235
|
+
dependencies: [
|
|
1236
|
+
{
|
|
1237
|
+
kind: "directive",
|
|
1238
|
+
type: NgTemplateOutlet,
|
|
1239
|
+
selector: "[ngTemplateOutlet]",
|
|
1240
|
+
inputs: [
|
|
1241
|
+
"ngTemplateOutletContext",
|
|
1242
|
+
"ngTemplateOutlet",
|
|
1243
|
+
"ngTemplateOutletInjector"
|
|
1244
|
+
]
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
kind: "pipe",
|
|
1248
|
+
type: LabelStylePipe,
|
|
1249
|
+
name: "labelStyle"
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
kind: "pipe",
|
|
1253
|
+
type: TickStylePipe,
|
|
1254
|
+
name: "tickStyle"
|
|
1255
|
+
}
|
|
1256
|
+
]
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1261
|
+
minVersion: "12.0.0",
|
|
1262
|
+
version: "22.2.6",
|
|
1263
|
+
ngImport: i0,
|
|
1264
|
+
type: SliderComponent,
|
|
1265
|
+
decorators: [{
|
|
1266
|
+
type: Component,
|
|
1267
|
+
args: [{
|
|
1268
|
+
selector: "mona-slider",
|
|
1269
|
+
imports: [
|
|
1270
|
+
NgTemplateOutlet,
|
|
1271
|
+
LabelStylePipe,
|
|
1272
|
+
TickStylePipe
|
|
1273
|
+
],
|
|
1274
|
+
host: {
|
|
1275
|
+
"[attr.aria-describedby]": "null",
|
|
1276
|
+
"[attr.aria-label]": "null",
|
|
1277
|
+
"[attr.aria-labelledby]": "null",
|
|
1278
|
+
"[class]": "baseClasses()",
|
|
1279
|
+
"[class.mona-slider]": "true",
|
|
1280
|
+
"[attr.data-disabled]": "effectiveDisabled() || null",
|
|
1281
|
+
"[attr.data-orientation]": "orientation()",
|
|
1282
|
+
"[attr.data-readonly]": "readonly() || null"
|
|
1283
|
+
},
|
|
1284
|
+
template: "<div\n [class]=\"trackClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style.height]=\"orientation() === 'horizontal' ? sliderTrackSize() : undefined\"\n [style.width]=\"orientation() === 'vertical' ? sliderTrackSize() : undefined\"\n [style]=\"trackBackgroundStyle()\">\n <div\n [class]=\"selectionClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [style.left.%]=\"horizontalSelectionLeft()\"\n [style.right.%]=\"horizontalSelectionRight()\"\n [style.bottom.%]=\"orientation() === 'vertical' ? selectionLeft() : undefined\"\n [style.top.%]=\"orientation() === 'vertical' ? 100 - selectionRight() : undefined\"\n [style]=\"selectionBackgroundStyle()\"></div>\n</div>\n@if (showTicks()) {\n <div [class]=\"tickListClasses()\" [attr.data-orientation]=\"orientation()\">\n @for (tick of renderTicks(); track tick.index) {\n <span\n [class]=\"tickClasses()\"\n [style]=\"tick | tickStyle: tickStyleArgs()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-value]=\"tick.value\"\n data-slider-tick>\n </span>\n }\n </div>\n}\n@if (showTicks() && showLabels()) {\n <div\n [class]=\"tickLabelListClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-label-position]=\"labelPosition()\">\n @for (tick of labelTicks(); track tick.index) {\n <span\n [class]=\"tickLabelClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style]=\"tick | labelStyle: labelStyleArgs()\">\n @if (!tickValueTemplate()) {\n <span>{{ tick.label }}</span>\n } @else {\n <span>\n <ng-container\n *ngTemplateOutlet=\"\n tickValueTemplate() ?? null;\n context: { $implicit: tick.value }\n \"></ng-container>\n </span>\n }\n </span>\n }\n </div>\n}\n<div\n [class]=\"sliderHandleClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [attr.data-rtl]=\"isRtl() || null\"\n [attr.data-focused]=\"handleFocused()\"\n [style]=\"handleStyle()\"\n [style.left.%]=\"orientation() === 'horizontal' && !isRtl() ? handlePosition() : undefined\"\n [style.right.%]=\"orientation() === 'horizontal' && isRtl() ? handlePosition() : undefined\"\n [style.bottom.%]=\"orientation() === 'vertical' ? handlePosition() : undefined\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-valuemin]=\"effectiveMin()\"\n [attr.aria-valuemax]=\"effectiveMax()\"\n [attr.aria-valuenow]=\"normalizedValue()\"\n [attr.aria-valuetext]=\"ariaValueText() ? ariaValueText()!(normalizedValue()) : null\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-label]=\"computedAriaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n #sliderHandle>\n @if (handleTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"handleTemplate() ?? null; context: { $implicit: normalizedValue() }\"></ng-container>\n }\n</div>\n"
|
|
1285
|
+
}]
|
|
1286
|
+
}],
|
|
1287
|
+
propDecorators: {
|
|
1288
|
+
sliderHandle: [{
|
|
1289
|
+
type: i0.ViewChild,
|
|
1290
|
+
args: ["sliderHandle", { isSignal: true }]
|
|
1291
|
+
}],
|
|
1292
|
+
max: [{
|
|
1293
|
+
type: i0.Input,
|
|
1294
|
+
args: [{
|
|
1295
|
+
isSignal: true,
|
|
1296
|
+
alias: "max",
|
|
1297
|
+
required: false
|
|
1298
|
+
}]
|
|
1299
|
+
}],
|
|
1300
|
+
min: [{
|
|
1301
|
+
type: i0.Input,
|
|
1302
|
+
args: [{
|
|
1303
|
+
isSignal: true,
|
|
1304
|
+
alias: "min",
|
|
1305
|
+
required: false
|
|
1306
|
+
}]
|
|
1307
|
+
}],
|
|
1308
|
+
value: [{
|
|
1309
|
+
type: i0.Input,
|
|
1310
|
+
args: [{
|
|
1311
|
+
isSignal: true,
|
|
1312
|
+
alias: "value",
|
|
1313
|
+
required: false
|
|
1314
|
+
}]
|
|
1315
|
+
}, {
|
|
1316
|
+
type: i0.Output,
|
|
1317
|
+
args: ["valueChange"]
|
|
1318
|
+
}]
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
var RangeSliderComponent = class RangeSliderComponent extends SliderBaseComponent {
|
|
1322
|
+
constructor() {
|
|
1323
|
+
super(...arguments);
|
|
1324
|
+
this.computedAriaLabelEnd = computed(() => this.ariaLabelEnd() ?? this.messages().maximumValue, ...ngDevMode ? [{ debugName: "computedAriaLabelEnd" }] : /* istanbul ignore next */ []);
|
|
1325
|
+
this.computedAriaLabelStart = computed(() => this.ariaLabelStart() ?? this.messages().minimumValue, ...ngDevMode ? [{ debugName: "computedAriaLabelStart" }] : /* istanbul ignore next */ []);
|
|
1326
|
+
this.endHandleId = createElementControlId();
|
|
1327
|
+
this.endLabelledBy = computed(() => {
|
|
1328
|
+
const labelledBy = this.labelledBy();
|
|
1329
|
+
return labelledBy ? `${labelledBy} ${this.endHandleId}` : null;
|
|
1330
|
+
}, ...ngDevMode ? [{ debugName: "endLabelledBy" }] : /* istanbul ignore next */ []);
|
|
1331
|
+
this.handlePositions = computed(() => [this.positionFromValue(this.normalizedValue()[0]), this.positionFromValue(this.normalizedValue()[1])], ...ngDevMode ? [{ debugName: "handlePositions" }] : /* istanbul ignore next */ []);
|
|
1332
|
+
this.handlesOverlap = computed(() => {
|
|
1333
|
+
const values = this.normalizedValue();
|
|
1334
|
+
return values[0] === values[1];
|
|
1335
|
+
}, ...ngDevMode ? [{ debugName: "handlesOverlap" }] : /* istanbul ignore next */ []);
|
|
1336
|
+
this.messages = this.i18n.componentMessages("slider", SLIDER_DEFAULT_MESSAGES);
|
|
1337
|
+
this.normalizedValue = computed(() => {
|
|
1338
|
+
const value = this.value();
|
|
1339
|
+
const minValue = this.snapValue(value[0]);
|
|
1340
|
+
const maxValue = this.snapValue(value[1]);
|
|
1341
|
+
return [Math.min(minValue, maxValue), Math.max(minValue, maxValue)];
|
|
1342
|
+
}, ...ngDevMode ? [{ debugName: "normalizedValue" }] : /* istanbul ignore next */ []);
|
|
1343
|
+
this.primaryHandleFocused = signal(false, ...ngDevMode ? [{ debugName: "primaryHandleFocused" }] : /* istanbul ignore next */ []);
|
|
1344
|
+
this.primaryHandlePosition = computed(() => this.handlePositions()[0], ...ngDevMode ? [{ debugName: "primaryHandlePosition" }] : /* istanbul ignore next */ []);
|
|
1345
|
+
this.primaryHandleStyle = computed(() => {
|
|
1346
|
+
const style = {
|
|
1347
|
+
...this.handleTemplateStyles(),
|
|
1348
|
+
...this.handleStyles()
|
|
1349
|
+
};
|
|
1350
|
+
if (this.handlesOverlap()) return {
|
|
1351
|
+
...style,
|
|
1352
|
+
zIndex: this.secondaryHandleOnTop() ? "1" : "2"
|
|
1353
|
+
};
|
|
1354
|
+
return style;
|
|
1355
|
+
}, ...ngDevMode ? [{ debugName: "primaryHandleStyle" }] : /* istanbul ignore next */ []);
|
|
1356
|
+
this.secondaryHandleFocused = signal(false, ...ngDevMode ? [{ debugName: "secondaryHandleFocused" }] : /* istanbul ignore next */ []);
|
|
1357
|
+
this.secondaryHandleOnTop = signal(true, ...ngDevMode ? [{ debugName: "secondaryHandleOnTop" }] : /* istanbul ignore next */ []);
|
|
1358
|
+
this.secondaryHandlePosition = computed(() => this.handlePositions()[1], ...ngDevMode ? [{ debugName: "secondaryHandlePosition" }] : /* istanbul ignore next */ []);
|
|
1359
|
+
this.secondaryHandleStyle = computed(() => {
|
|
1360
|
+
const style = {
|
|
1361
|
+
...this.handleTemplateStyles(),
|
|
1362
|
+
...this.handleStyles()
|
|
1363
|
+
};
|
|
1364
|
+
if (this.handlesOverlap()) return {
|
|
1365
|
+
...style,
|
|
1366
|
+
zIndex: this.secondaryHandleOnTop() ? "2" : "1"
|
|
1367
|
+
};
|
|
1368
|
+
return style;
|
|
1369
|
+
}, ...ngDevMode ? [{ debugName: "secondaryHandleStyle" }] : /* istanbul ignore next */ []);
|
|
1370
|
+
this.secondarySliderHandle = viewChild.required("secondarySliderHandle", ...ngDevMode ? [{ debugName: "secondarySliderHandle" }] : /* istanbul ignore next */ []);
|
|
1371
|
+
this.selectionLeft = computed(() => this.handlePositions()[0], ...ngDevMode ? [{ debugName: "selectionLeft" }] : /* istanbul ignore next */ []);
|
|
1372
|
+
this.selectionRight = computed(() => this.handlePositions()[1], ...ngDevMode ? [{ debugName: "selectionRight" }] : /* istanbul ignore next */ []);
|
|
1373
|
+
this.sliderHandle = viewChild.required("sliderHandle", ...ngDevMode ? [{ debugName: "sliderHandle" }] : /* istanbul ignore next */ []);
|
|
1374
|
+
this.startHandleId = createElementControlId();
|
|
1375
|
+
this.startLabelledBy = computed(() => {
|
|
1376
|
+
const labelledBy = this.labelledBy();
|
|
1377
|
+
return labelledBy ? `${labelledBy} ${this.startHandleId}` : null;
|
|
1378
|
+
}, ...ngDevMode ? [{ debugName: "startLabelledBy" }] : /* istanbul ignore next */ []);
|
|
1379
|
+
this.valueIsShown = computed(() => {
|
|
1380
|
+
const [lower, upper] = this.normalizedValue();
|
|
1381
|
+
const [first, second] = this.value();
|
|
1382
|
+
return lower === first && upper === second;
|
|
1383
|
+
}, ...ngDevMode ? [{ debugName: "valueIsShown" }] : /* istanbul ignore next */ []);
|
|
1384
|
+
this.ariaLabelEnd = input(null, {
|
|
1385
|
+
...ngDevMode ? { debugName: "ariaLabelEnd" } : /* istanbul ignore next */ {},
|
|
1386
|
+
alias: "aria-label-end"
|
|
1387
|
+
});
|
|
1388
|
+
this.ariaLabelStart = input(null, {
|
|
1389
|
+
...ngDevMode ? { debugName: "ariaLabelStart" } : /* istanbul ignore next */ {},
|
|
1390
|
+
alias: "aria-label-start"
|
|
1391
|
+
});
|
|
1392
|
+
this.value = model([0, 10], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
1393
|
+
}
|
|
1394
|
+
focus(options) {
|
|
1395
|
+
if (!this.effectiveDisabled()) this.sliderHandle().nativeElement.focus(options);
|
|
1396
|
+
}
|
|
1397
|
+
handleHandleMove(event, isSecondary = false) {
|
|
1398
|
+
this.updateRangedValue(this.getValueFromPointerEvent(event), isSecondary);
|
|
1399
|
+
}
|
|
1400
|
+
setSubscriptions() {
|
|
1401
|
+
this.setClickSubscription();
|
|
1402
|
+
this.setKeydownSubscription();
|
|
1403
|
+
this.setPointerMoveSubscription();
|
|
1404
|
+
this.setFocusSubscription();
|
|
1405
|
+
}
|
|
1406
|
+
getClosestHandle(event) {
|
|
1407
|
+
const currentValues = this.normalizedValue();
|
|
1408
|
+
if (currentValues[0] === currentValues[1]) {
|
|
1409
|
+
const containerRect = this.hostElementRef.nativeElement.getBoundingClientRect();
|
|
1410
|
+
let normalizedClickPos;
|
|
1411
|
+
if (this.orientation() === "horizontal") normalizedClickPos = (this.isRtl() ? containerRect.right - event.clientX : event.clientX - containerRect.left) / containerRect.width * 100;
|
|
1412
|
+
else normalizedClickPos = 100 - (event.clientY - containerRect.top) / containerRect.height * 100;
|
|
1413
|
+
return this.getValueFromPosition(normalizedClickPos) > currentValues[0];
|
|
1414
|
+
}
|
|
1415
|
+
const primaryRect = this.sliderHandle().nativeElement.getBoundingClientRect();
|
|
1416
|
+
const secondaryRect = this.secondarySliderHandle().nativeElement.getBoundingClientRect();
|
|
1417
|
+
const primaryDistance = Math.sqrt(Math.pow(primaryRect.left + primaryRect.width / 2 - event.clientX, 2) + Math.pow(primaryRect.top + primaryRect.height / 2 - event.clientY, 2));
|
|
1418
|
+
return Math.sqrt(Math.pow(secondaryRect.left + secondaryRect.width / 2 - event.clientX, 2) + Math.pow(secondaryRect.top + secondaryRect.height / 2 - event.clientY, 2)) < primaryDistance;
|
|
1419
|
+
}
|
|
1420
|
+
setClickSubscription() {
|
|
1421
|
+
fromEvent(this.hostElementRef.nativeElement, "click").pipe(takeUntilDestroyed(this.destroyRef), tap(() => this.dragging.set(false)), filter(() => !this.interactionDisabled())).subscribe((event) => {
|
|
1422
|
+
const target = event.target;
|
|
1423
|
+
if (this.sliderHandle().nativeElement.contains(target) || this.secondarySliderHandle().nativeElement.contains(target)) return;
|
|
1424
|
+
const isSecondary = this.getClosestHandle(event);
|
|
1425
|
+
this.handleHandleMove(event, isSecondary);
|
|
1426
|
+
(isSecondary ? this.secondarySliderHandle() : this.sliderHandle()).nativeElement.focus({ preventScroll: true });
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
setFocusSubscription() {
|
|
1430
|
+
fromEvent(this.sliderHandle().nativeElement, "focus").pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
1431
|
+
this.zone.run(() => {
|
|
1432
|
+
this.primaryHandleFocused.set(true);
|
|
1433
|
+
this.secondaryHandleFocused.set(false);
|
|
1434
|
+
});
|
|
1435
|
+
});
|
|
1436
|
+
fromEvent(this.sliderHandle().nativeElement, "blur").pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
1437
|
+
this.zone.run(() => {
|
|
1438
|
+
this.primaryHandleFocused.set(false);
|
|
1439
|
+
this.touch.emit();
|
|
1440
|
+
});
|
|
1441
|
+
});
|
|
1442
|
+
fromEvent(this.secondarySliderHandle().nativeElement, "focus").pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
1443
|
+
this.zone.run(() => {
|
|
1444
|
+
this.secondaryHandleFocused.set(true);
|
|
1445
|
+
this.primaryHandleFocused.set(false);
|
|
1446
|
+
});
|
|
1447
|
+
});
|
|
1448
|
+
fromEvent(this.secondarySliderHandle().nativeElement, "blur").pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
1449
|
+
this.zone.run(() => {
|
|
1450
|
+
this.secondaryHandleFocused.set(false);
|
|
1451
|
+
this.touch.emit();
|
|
1452
|
+
});
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
setKeydownSubscription() {
|
|
1456
|
+
fromEvent(this.sliderHandle().nativeElement, "keydown").pipe(takeUntilDestroyed(this.destroyRef), filter(() => !this.interactionDisabled()), filter((event) => this.isNavigationKey(event)), tap((event) => {
|
|
1457
|
+
event.preventDefault();
|
|
1458
|
+
event.stopPropagation();
|
|
1459
|
+
})).subscribe((event) => {
|
|
1460
|
+
const newValue = this.calculateNewValue(this.normalizedValue()[0], event);
|
|
1461
|
+
this.updateRangedValue(newValue, false);
|
|
1462
|
+
});
|
|
1463
|
+
fromEvent(this.secondarySliderHandle().nativeElement, "keydown").pipe(takeUntilDestroyed(this.destroyRef), filter(() => !this.interactionDisabled()), filter((event) => this.isNavigationKey(event)), tap((event) => {
|
|
1464
|
+
event.preventDefault();
|
|
1465
|
+
event.stopPropagation();
|
|
1466
|
+
})).subscribe((event) => {
|
|
1467
|
+
const newValue = this.calculateNewValue(this.normalizedValue()[1], event);
|
|
1468
|
+
this.updateRangedValue(newValue, true);
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
setPointerMoveSubscription() {
|
|
1472
|
+
this.trackRangeHandle(this.sliderHandle().nativeElement, false);
|
|
1473
|
+
this.trackRangeHandle(this.secondarySliderHandle().nativeElement, true);
|
|
1474
|
+
}
|
|
1475
|
+
trackRangeHandle(handle, startsSecondary) {
|
|
1476
|
+
this.trackHandleDrag(handle, () => {
|
|
1477
|
+
let isSecondary = startsSecondary;
|
|
1478
|
+
return (event) => {
|
|
1479
|
+
const value = this.getValueFromPointerEvent(event);
|
|
1480
|
+
const [lower, upper] = this.normalizedValue();
|
|
1481
|
+
if (lower === upper && value !== lower && isSecondary !== value > lower) {
|
|
1482
|
+
isSecondary = value > lower;
|
|
1483
|
+
(isSecondary ? this.secondarySliderHandle() : this.sliderHandle()).nativeElement.focus({ preventScroll: true });
|
|
1484
|
+
}
|
|
1485
|
+
this.updateRangedValue(value, isSecondary);
|
|
1486
|
+
};
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
updateRangedValue(value, isSecondary) {
|
|
1490
|
+
const currentValues = this.normalizedValue();
|
|
1491
|
+
const currentMinValue = currentValues[0];
|
|
1492
|
+
const currentMaxValue = currentValues[1];
|
|
1493
|
+
let newMinValue = currentMinValue;
|
|
1494
|
+
let newMaxValue = currentMaxValue;
|
|
1495
|
+
if (isSecondary) {
|
|
1496
|
+
newMaxValue = Math.max(value, currentMinValue);
|
|
1497
|
+
if (newMaxValue === currentMinValue) this.secondaryHandleOnTop.set(true);
|
|
1498
|
+
} else {
|
|
1499
|
+
newMinValue = Math.min(value, currentMaxValue);
|
|
1500
|
+
if (newMinValue === currentMaxValue) this.secondaryHandleOnTop.set(false);
|
|
1501
|
+
}
|
|
1502
|
+
newMinValue = this.snapValue(newMinValue);
|
|
1503
|
+
newMaxValue = this.snapValue(newMaxValue);
|
|
1504
|
+
if (newMinValue === currentMinValue && newMaxValue === currentMaxValue) return;
|
|
1505
|
+
this.zone.run(() => this.value.set([newMinValue, newMaxValue]));
|
|
1506
|
+
}
|
|
1507
|
+
static {
|
|
1508
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1509
|
+
minVersion: "12.0.0",
|
|
1510
|
+
version: "22.2.6",
|
|
1511
|
+
ngImport: i0,
|
|
1512
|
+
type: RangeSliderComponent,
|
|
1513
|
+
deps: null,
|
|
1514
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
static {
|
|
1518
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1519
|
+
minVersion: "17.0.0",
|
|
1520
|
+
version: "22.2.6",
|
|
1521
|
+
type: RangeSliderComponent,
|
|
1522
|
+
isStandalone: true,
|
|
1523
|
+
selector: "mona-range-slider",
|
|
1524
|
+
inputs: {
|
|
1525
|
+
ariaLabelEnd: {
|
|
1526
|
+
classPropertyName: "ariaLabelEnd",
|
|
1527
|
+
publicName: "aria-label-end",
|
|
1528
|
+
isSignal: true,
|
|
1529
|
+
isRequired: false,
|
|
1530
|
+
transformFunction: null
|
|
1531
|
+
},
|
|
1532
|
+
ariaLabelStart: {
|
|
1533
|
+
classPropertyName: "ariaLabelStart",
|
|
1534
|
+
publicName: "aria-label-start",
|
|
1535
|
+
isSignal: true,
|
|
1536
|
+
isRequired: false,
|
|
1537
|
+
transformFunction: null
|
|
1538
|
+
},
|
|
1539
|
+
value: {
|
|
1540
|
+
classPropertyName: "value",
|
|
1541
|
+
publicName: "value",
|
|
1542
|
+
isSignal: true,
|
|
1543
|
+
isRequired: false,
|
|
1544
|
+
transformFunction: null
|
|
1545
|
+
}
|
|
1546
|
+
},
|
|
1547
|
+
outputs: { value: "valueChange" },
|
|
1548
|
+
host: { properties: {
|
|
1549
|
+
"attr.aria-describedby": "null",
|
|
1550
|
+
"attr.aria-label-end": "null",
|
|
1551
|
+
"attr.aria-label-start": "null",
|
|
1552
|
+
"class": "baseClasses()",
|
|
1553
|
+
"class.mona-slider": "true",
|
|
1554
|
+
"attr.data-disabled": "effectiveDisabled() || null",
|
|
1555
|
+
"attr.data-orientation": "orientation()",
|
|
1556
|
+
"attr.data-readonly": "readonly() || null",
|
|
1557
|
+
"attr.aria-label": "ariaLabel()",
|
|
1558
|
+
"attr.aria-labelledby": "labelledBy()",
|
|
1559
|
+
"attr.role": "'group'"
|
|
1560
|
+
} },
|
|
1561
|
+
viewQueries: [{
|
|
1562
|
+
propertyName: "secondarySliderHandle",
|
|
1563
|
+
first: true,
|
|
1564
|
+
predicate: ["secondarySliderHandle"],
|
|
1565
|
+
descendants: true,
|
|
1566
|
+
isSignal: true
|
|
1567
|
+
}, {
|
|
1568
|
+
propertyName: "sliderHandle",
|
|
1569
|
+
first: true,
|
|
1570
|
+
predicate: ["sliderHandle"],
|
|
1571
|
+
descendants: true,
|
|
1572
|
+
isSignal: true
|
|
1573
|
+
}],
|
|
1574
|
+
usesInheritance: true,
|
|
1575
|
+
ngImport: i0,
|
|
1576
|
+
template: "<div\n [class]=\"trackClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style.height]=\"orientation() === 'horizontal' ? sliderTrackSize() : undefined\"\n [style.width]=\"orientation() === 'vertical' ? sliderTrackSize() : undefined\"\n [style]=\"trackBackgroundStyle()\">\n <div\n [class]=\"selectionClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [style.left.%]=\"horizontalSelectionLeft()\"\n [style.right.%]=\"horizontalSelectionRight()\"\n [style.bottom.%]=\"orientation() === 'vertical' ? selectionLeft() : undefined\"\n [style.top.%]=\"orientation() === 'vertical' ? 100 - selectionRight() : undefined\"\n [style]=\"selectionBackgroundStyle()\"></div>\n</div>\n@if (showTicks()) {\n <div [class]=\"tickListClasses()\" [attr.data-orientation]=\"orientation()\">\n @for (tick of renderTicks(); track tick.index) {\n <span\n [class]=\"tickClasses()\"\n [style]=\"tick | tickStyle: tickStyleArgs()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-value]=\"tick.value\"\n data-slider-tick>\n </span>\n }\n </div>\n}\n@if (showTicks() && showLabels()) {\n <div\n [class]=\"tickLabelListClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-label-position]=\"labelPosition()\">\n @for (tick of labelTicks(); track tick.index) {\n <span\n [class]=\"tickLabelClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style]=\"tick | labelStyle: labelStyleArgs()\">\n @if (!tickValueTemplate()) {\n <span>{{ tick.label }}</span>\n } @else {\n <span>\n <ng-container\n *ngTemplateOutlet=\"\n tickValueTemplate() ?? null;\n context: { $implicit: tick.value }\n \"></ng-container>\n </span>\n }\n </span>\n }\n </div>\n}\n<div\n [class]=\"sliderHandleClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [attr.data-rtl]=\"isRtl() || null\"\n [attr.data-focused]=\"primaryHandleFocused()\"\n [style]=\"primaryHandleStyle()\"\n [style.left.%]=\"orientation() === 'horizontal' && !isRtl() ? primaryHandlePosition() : undefined\"\n [style.right.%]=\"orientation() === 'horizontal' && isRtl() ? primaryHandlePosition() : undefined\"\n [style.bottom.%]=\"orientation() === 'vertical' ? primaryHandlePosition() : undefined\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-valuemin]=\"effectiveMin()\"\n [attr.aria-valuemax]=\"normalizedValue()[1]\"\n [attr.aria-valuenow]=\"normalizedValue()[0]\"\n [attr.aria-valuetext]=\"ariaValueText() ? ariaValueText()!(normalizedValue()[0]) : null\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-label]=\"computedAriaLabelStart()\"\n [attr.aria-labelledby]=\"startLabelledBy()\"\n [attr.id]=\"startHandleId\"\n #sliderHandle>\n @if (handleTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"handleTemplate() ?? null; context: { $implicit: normalizedValue()[0] }\"></ng-container>\n }\n</div>\n<div\n [class]=\"sliderHandleClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [attr.data-rtl]=\"isRtl() || null\"\n [attr.data-focused]=\"secondaryHandleFocused()\"\n [style]=\"secondaryHandleStyle()\"\n [style.left.%]=\"orientation() === 'horizontal' && !isRtl() ? secondaryHandlePosition() : undefined\"\n [style.right.%]=\"orientation() === 'horizontal' && isRtl() ? secondaryHandlePosition() : undefined\"\n [style.bottom.%]=\"orientation() === 'vertical' ? secondaryHandlePosition() : undefined\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-valuemin]=\"normalizedValue()[0]\"\n [attr.aria-valuemax]=\"effectiveMax()\"\n [attr.aria-valuenow]=\"normalizedValue()[1]\"\n [attr.aria-valuetext]=\"ariaValueText() ? ariaValueText()!(normalizedValue()[1]) : null\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-label]=\"computedAriaLabelEnd()\"\n [attr.aria-labelledby]=\"endLabelledBy()\"\n [attr.id]=\"endHandleId\"\n #secondarySliderHandle>\n @if (handleTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"handleTemplate() ?? null; context: { $implicit: normalizedValue()[1] }\"></ng-container>\n }\n</div>\n",
|
|
1577
|
+
dependencies: [
|
|
1578
|
+
{
|
|
1579
|
+
kind: "directive",
|
|
1580
|
+
type: NgTemplateOutlet,
|
|
1581
|
+
selector: "[ngTemplateOutlet]",
|
|
1582
|
+
inputs: [
|
|
1583
|
+
"ngTemplateOutletContext",
|
|
1584
|
+
"ngTemplateOutlet",
|
|
1585
|
+
"ngTemplateOutletInjector"
|
|
1586
|
+
]
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
kind: "pipe",
|
|
1590
|
+
type: LabelStylePipe,
|
|
1591
|
+
name: "labelStyle"
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
kind: "pipe",
|
|
1595
|
+
type: TickStylePipe,
|
|
1596
|
+
name: "tickStyle"
|
|
1597
|
+
}
|
|
1598
|
+
]
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
};
|
|
1602
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1603
|
+
minVersion: "12.0.0",
|
|
1604
|
+
version: "22.2.6",
|
|
1605
|
+
ngImport: i0,
|
|
1606
|
+
type: RangeSliderComponent,
|
|
1607
|
+
decorators: [{
|
|
1608
|
+
type: Component,
|
|
1609
|
+
args: [{
|
|
1610
|
+
selector: "mona-range-slider",
|
|
1611
|
+
imports: [
|
|
1612
|
+
NgTemplateOutlet,
|
|
1613
|
+
LabelStylePipe,
|
|
1614
|
+
TickStylePipe
|
|
1615
|
+
],
|
|
1616
|
+
host: {
|
|
1617
|
+
"[attr.aria-describedby]": "null",
|
|
1618
|
+
"[attr.aria-label-end]": "null",
|
|
1619
|
+
"[attr.aria-label-start]": "null",
|
|
1620
|
+
"[class]": "baseClasses()",
|
|
1621
|
+
"[class.mona-slider]": "true",
|
|
1622
|
+
"[attr.data-disabled]": "effectiveDisabled() || null",
|
|
1623
|
+
"[attr.data-orientation]": "orientation()",
|
|
1624
|
+
"[attr.data-readonly]": "readonly() || null",
|
|
1625
|
+
"[attr.aria-label]": "ariaLabel()",
|
|
1626
|
+
"[attr.aria-labelledby]": "labelledBy()",
|
|
1627
|
+
"[attr.role]": "'group'"
|
|
1628
|
+
},
|
|
1629
|
+
template: "<div\n [class]=\"trackClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style.height]=\"orientation() === 'horizontal' ? sliderTrackSize() : undefined\"\n [style.width]=\"orientation() === 'vertical' ? sliderTrackSize() : undefined\"\n [style]=\"trackBackgroundStyle()\">\n <div\n [class]=\"selectionClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [style.left.%]=\"horizontalSelectionLeft()\"\n [style.right.%]=\"horizontalSelectionRight()\"\n [style.bottom.%]=\"orientation() === 'vertical' ? selectionLeft() : undefined\"\n [style.top.%]=\"orientation() === 'vertical' ? 100 - selectionRight() : undefined\"\n [style]=\"selectionBackgroundStyle()\"></div>\n</div>\n@if (showTicks()) {\n <div [class]=\"tickListClasses()\" [attr.data-orientation]=\"orientation()\">\n @for (tick of renderTicks(); track tick.index) {\n <span\n [class]=\"tickClasses()\"\n [style]=\"tick | tickStyle: tickStyleArgs()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-value]=\"tick.value\"\n data-slider-tick>\n </span>\n }\n </div>\n}\n@if (showTicks() && showLabels()) {\n <div\n [class]=\"tickLabelListClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-label-position]=\"labelPosition()\">\n @for (tick of labelTicks(); track tick.index) {\n <span\n [class]=\"tickLabelClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [style]=\"tick | labelStyle: labelStyleArgs()\">\n @if (!tickValueTemplate()) {\n <span>{{ tick.label }}</span>\n } @else {\n <span>\n <ng-container\n *ngTemplateOutlet=\"\n tickValueTemplate() ?? null;\n context: { $implicit: tick.value }\n \"></ng-container>\n </span>\n }\n </span>\n }\n </div>\n}\n<div\n [class]=\"sliderHandleClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [attr.data-rtl]=\"isRtl() || null\"\n [attr.data-focused]=\"primaryHandleFocused()\"\n [style]=\"primaryHandleStyle()\"\n [style.left.%]=\"orientation() === 'horizontal' && !isRtl() ? primaryHandlePosition() : undefined\"\n [style.right.%]=\"orientation() === 'horizontal' && isRtl() ? primaryHandlePosition() : undefined\"\n [style.bottom.%]=\"orientation() === 'vertical' ? primaryHandlePosition() : undefined\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-valuemin]=\"effectiveMin()\"\n [attr.aria-valuemax]=\"normalizedValue()[1]\"\n [attr.aria-valuenow]=\"normalizedValue()[0]\"\n [attr.aria-valuetext]=\"ariaValueText() ? ariaValueText()!(normalizedValue()[0]) : null\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-label]=\"computedAriaLabelStart()\"\n [attr.aria-labelledby]=\"startLabelledBy()\"\n [attr.id]=\"startHandleId\"\n #sliderHandle>\n @if (handleTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"handleTemplate() ?? null; context: { $implicit: normalizedValue()[0] }\"></ng-container>\n }\n</div>\n<div\n [class]=\"sliderHandleClasses()\"\n [attr.data-orientation]=\"orientation()\"\n [attr.data-dragging]=\"dragging()\"\n [attr.data-rtl]=\"isRtl() || null\"\n [attr.data-focused]=\"secondaryHandleFocused()\"\n [style]=\"secondaryHandleStyle()\"\n [style.left.%]=\"orientation() === 'horizontal' && !isRtl() ? secondaryHandlePosition() : undefined\"\n [style.right.%]=\"orientation() === 'horizontal' && isRtl() ? secondaryHandlePosition() : undefined\"\n [style.bottom.%]=\"orientation() === 'vertical' ? secondaryHandlePosition() : undefined\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-valuemin]=\"normalizedValue()[0]\"\n [attr.aria-valuemax]=\"effectiveMax()\"\n [attr.aria-valuenow]=\"normalizedValue()[1]\"\n [attr.aria-valuetext]=\"ariaValueText() ? ariaValueText()!(normalizedValue()[1]) : null\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-label]=\"computedAriaLabelEnd()\"\n [attr.aria-labelledby]=\"endLabelledBy()\"\n [attr.id]=\"endHandleId\"\n #secondarySliderHandle>\n @if (handleTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"handleTemplate() ?? null; context: { $implicit: normalizedValue()[1] }\"></ng-container>\n }\n</div>\n"
|
|
1630
|
+
}]
|
|
1631
|
+
}],
|
|
1632
|
+
propDecorators: {
|
|
1633
|
+
secondarySliderHandle: [{
|
|
1634
|
+
type: i0.ViewChild,
|
|
1635
|
+
args: ["secondarySliderHandle", { isSignal: true }]
|
|
1636
|
+
}],
|
|
1637
|
+
sliderHandle: [{
|
|
1638
|
+
type: i0.ViewChild,
|
|
1639
|
+
args: ["sliderHandle", { isSignal: true }]
|
|
1640
|
+
}],
|
|
1641
|
+
ariaLabelEnd: [{
|
|
1642
|
+
type: i0.Input,
|
|
1643
|
+
args: [{
|
|
1644
|
+
isSignal: true,
|
|
1645
|
+
alias: "aria-label-end",
|
|
1646
|
+
required: false
|
|
1647
|
+
}]
|
|
1648
|
+
}],
|
|
1649
|
+
ariaLabelStart: [{
|
|
1650
|
+
type: i0.Input,
|
|
1651
|
+
args: [{
|
|
1652
|
+
isSignal: true,
|
|
1653
|
+
alias: "aria-label-start",
|
|
1654
|
+
required: false
|
|
1655
|
+
}]
|
|
1656
|
+
}],
|
|
1657
|
+
value: [{
|
|
1658
|
+
type: i0.Input,
|
|
1659
|
+
args: [{
|
|
1660
|
+
isSignal: true,
|
|
1661
|
+
alias: "value",
|
|
1662
|
+
required: false
|
|
1663
|
+
}]
|
|
1664
|
+
}, {
|
|
1665
|
+
type: i0.Output,
|
|
1666
|
+
args: ["valueChange"]
|
|
1667
|
+
}]
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1211
1670
|
export { RangeSliderComponent, SLIDER_DEFAULT_MESSAGES, SliderComponent, SliderHandleTemplateDirective, SliderTickValueTemplateDirective };
|
|
1212
|
-
|
|
1671
|
+
|
|
1672
|
+
//# sourceMappingURL=nanahoshi-mona-ui-slider.mjs.map
|