buefy 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +242 -0
- package/dist/buefy.css +15895 -0
- package/dist/buefy.d.ts +11706 -0
- package/dist/buefy.esm.js +21082 -0
- package/dist/buefy.esm.min.js +2 -0
- package/dist/buefy.js +21227 -0
- package/dist/buefy.min.css +1 -0
- package/dist/buefy.min.js +2 -0
- package/dist/cjs/Autocomplete-BMmOsPiK.js +864 -0
- package/dist/cjs/Button-Cq7yqI8p.js +118 -0
- package/dist/cjs/CheckRadioMixin-CDu0SN3g.js +58 -0
- package/dist/cjs/Checkbox-GPzAMQqM.js +85 -0
- package/dist/cjs/CompatFallthroughMixin-hhK0Gkhr.js +48 -0
- package/dist/cjs/Datepicker-B-9ReBe6.js +2120 -0
- package/dist/cjs/Dropdown-DtpKU9qf.js +470 -0
- package/dist/cjs/DropdownItem-IMOKyRGV.js +110 -0
- package/dist/cjs/Field-19ZCJFF8.js +405 -0
- package/dist/cjs/FormElementMixin-DavX4iOv.js +170 -0
- package/dist/cjs/Icon-lsDKE2wQ.js +184 -0
- package/dist/cjs/Image-CocPwU3n.js +356 -0
- package/dist/cjs/InjectedChildMixin-CUKn09dB.js +150 -0
- package/dist/cjs/Input-BcloGeZ3.js +350 -0
- package/dist/cjs/Loading-GqqqjipO.js +145 -0
- package/dist/cjs/MessageMixin-bGuuzfev.js +136 -0
- package/dist/cjs/Modal-CYpSQe2Q.js +315 -0
- package/dist/cjs/NoticeMixin--3RjH43z.js +163 -0
- package/dist/cjs/Pagination-D1MVdiLp.js +547 -0
- package/dist/cjs/Progress-DT9Qc8Id.js +177 -0
- package/dist/cjs/Select-DayPKwCY.js +147 -0
- package/dist/cjs/SlotComponent-BruGdRW3.js +41 -0
- package/dist/cjs/TabbedChildMixin-B3JUUwcf.js +211 -0
- package/dist/cjs/Tag-BprnwJJ1.js +167 -0
- package/dist/cjs/Timepicker-CDZ3V-2J.js +283 -0
- package/dist/cjs/TimepickerMixin-C9WVvcUL.js +666 -0
- package/dist/cjs/Tooltip-Cgighv0j.js +393 -0
- package/dist/cjs/_plugin-vue_export-helper-Die8u8yB.js +11 -0
- package/dist/cjs/autocomplete.js +23 -0
- package/dist/cjs/breadcrumb.js +107 -0
- package/dist/cjs/button.js +20 -0
- package/dist/cjs/carousel.js +825 -0
- package/dist/cjs/checkbox.js +88 -0
- package/dist/cjs/clockpicker.js +668 -0
- package/dist/cjs/collapse.js +99 -0
- package/dist/cjs/colorpicker.js +25 -0
- package/dist/cjs/config-DR826Ki2.js +103 -0
- package/dist/cjs/config.js +18 -0
- package/dist/cjs/datepicker.js +28 -0
- package/dist/cjs/datetimepicker.js +483 -0
- package/dist/cjs/dialog.js +506 -0
- package/dist/cjs/dropdown.js +23 -0
- package/dist/cjs/field.js +19 -0
- package/dist/cjs/helpers.js +276 -0
- package/dist/cjs/icon.js +19 -0
- package/dist/cjs/image.js +19 -0
- package/dist/cjs/index-DiQy3SCb.js +1942 -0
- package/dist/cjs/index.js +274 -0
- package/dist/cjs/input.js +22 -0
- package/dist/cjs/loading.js +87 -0
- package/dist/cjs/menu.js +340 -0
- package/dist/cjs/message.js +119 -0
- package/dist/cjs/modal.js +103 -0
- package/dist/cjs/navbar.js +572 -0
- package/dist/cjs/notification.js +281 -0
- package/dist/cjs/numberinput.js +386 -0
- package/dist/cjs/pagination.js +22 -0
- package/dist/cjs/plugins-DbyYGVpp.js +16 -0
- package/dist/cjs/progress.js +91 -0
- package/dist/cjs/radio.js +137 -0
- package/dist/cjs/rate.js +197 -0
- package/dist/cjs/select.js +22 -0
- package/dist/cjs/sidebar.js +309 -0
- package/dist/cjs/skeleton.js +78 -0
- package/dist/cjs/slider.js +699 -0
- package/dist/cjs/snackbar.js +224 -0
- package/dist/cjs/ssr-DVRFTu_P.js +8 -0
- package/dist/cjs/steps.js +347 -0
- package/dist/cjs/switch.js +161 -0
- package/dist/cjs/table.js +2391 -0
- package/dist/cjs/tabs.js +258 -0
- package/dist/cjs/tag.js +44 -0
- package/dist/cjs/taginput.js +425 -0
- package/dist/cjs/timepicker.js +29 -0
- package/dist/cjs/toast.js +162 -0
- package/dist/cjs/tooltip.js +19 -0
- package/dist/cjs/trapFocus-BlX6xykt.js +53 -0
- package/dist/cjs/upload.js +195 -0
- package/dist/components/autocomplete/index.js +1647 -0
- package/dist/components/autocomplete/index.min.js +2 -0
- package/dist/components/breadcrumb/index.js +173 -0
- package/dist/components/breadcrumb/index.min.js +2 -0
- package/dist/components/button/index.js +334 -0
- package/dist/components/button/index.min.js +2 -0
- package/dist/components/carousel/index.js +1534 -0
- package/dist/components/carousel/index.min.js +2 -0
- package/dist/components/checkbox/index.js +236 -0
- package/dist/components/checkbox/index.min.js +2 -0
- package/dist/components/clockpicker/index.js +2636 -0
- package/dist/components/clockpicker/index.min.js +2 -0
- package/dist/components/collapse/index.js +111 -0
- package/dist/components/collapse/index.min.js +2 -0
- package/dist/components/colorpicker/index.js +4251 -0
- package/dist/components/colorpicker/index.min.js +2 -0
- package/dist/components/datepicker/index.js +4110 -0
- package/dist/components/datepicker/index.min.js +2 -0
- package/dist/components/datetimepicker/index.js +5479 -0
- package/dist/components/datetimepicker/index.min.js +2 -0
- package/dist/components/dialog/index.js +1202 -0
- package/dist/components/dialog/index.min.js +2 -0
- package/dist/components/dropdown/index.js +680 -0
- package/dist/components/dropdown/index.min.js +2 -0
- package/dist/components/field/index.js +439 -0
- package/dist/components/field/index.min.js +2 -0
- package/dist/components/icon/index.js +212 -0
- package/dist/components/icon/index.min.js +2 -0
- package/dist/components/image/index.js +396 -0
- package/dist/components/image/index.min.js +2 -0
- package/dist/components/input/index.js +764 -0
- package/dist/components/input/index.min.js +2 -0
- package/dist/components/loading/index.js +280 -0
- package/dist/components/loading/index.min.js +2 -0
- package/dist/components/menu/index.js +586 -0
- package/dist/components/menu/index.min.js +2 -0
- package/dist/components/message/index.js +611 -0
- package/dist/components/message/index.min.js +2 -0
- package/dist/components/modal/index.js +516 -0
- package/dist/components/modal/index.min.js +2 -0
- package/dist/components/navbar/index.js +634 -0
- package/dist/components/navbar/index.min.js +2 -0
- package/dist/components/notification/index.js +976 -0
- package/dist/components/notification/index.min.js +2 -0
- package/dist/components/numberinput/index.js +1128 -0
- package/dist/components/numberinput/index.min.js +2 -0
- package/dist/components/pagination/index.js +764 -0
- package/dist/components/pagination/index.min.js +2 -0
- package/dist/components/progress/index.js +280 -0
- package/dist/components/progress/index.min.js +2 -0
- package/dist/components/radio/index.js +208 -0
- package/dist/components/radio/index.min.js +2 -0
- package/dist/components/rate/index.js +391 -0
- package/dist/components/rate/index.min.js +2 -0
- package/dist/components/select/index.js +560 -0
- package/dist/components/select/index.min.js +2 -0
- package/dist/components/sidebar/index.js +337 -0
- package/dist/components/sidebar/index.min.js +2 -0
- package/dist/components/skeleton/index.js +87 -0
- package/dist/components/skeleton/index.min.js +2 -0
- package/dist/components/slider/index.js +1171 -0
- package/dist/components/slider/index.min.js +2 -0
- package/dist/components/snackbar/index.js +439 -0
- package/dist/components/snackbar/index.min.js +2 -0
- package/dist/components/steps/index.js +925 -0
- package/dist/components/steps/index.min.js +2 -0
- package/dist/components/switch/index.js +182 -0
- package/dist/components/switch/index.min.js +2 -0
- package/dist/components/table/index.js +4208 -0
- package/dist/components/table/index.min.js +2 -0
- package/dist/components/tabs/index.js +837 -0
- package/dist/components/tabs/index.min.js +2 -0
- package/dist/components/tag/index.js +396 -0
- package/dist/components/tag/index.min.js +2 -0
- package/dist/components/taginput/index.js +2209 -0
- package/dist/components/taginput/index.min.js +2 -0
- package/dist/components/timepicker/index.js +2906 -0
- package/dist/components/timepicker/index.min.js +2 -0
- package/dist/components/toast/index.js +377 -0
- package/dist/components/toast/index.min.js +2 -0
- package/dist/components/tooltip/index.js +445 -0
- package/dist/components/tooltip/index.min.js +2 -0
- package/dist/components/upload/index.js +426 -0
- package/dist/components/upload/index.min.js +2 -0
- package/dist/esm/Autocomplete-CjbTh9D8.js +862 -0
- package/dist/esm/Button-DyUYShTZ.js +116 -0
- package/dist/esm/CheckRadioMixin-DSD_rjC8.js +56 -0
- package/dist/esm/Checkbox-KUMz0sfA.js +83 -0
- package/dist/esm/CompatFallthroughMixin-C8LPuwDr.js +46 -0
- package/dist/esm/Datepicker-Bl8Wfdkn.js +2118 -0
- package/dist/esm/Dropdown-CGTYVyoL.js +467 -0
- package/dist/esm/DropdownItem-Cn3nM0A3.js +108 -0
- package/dist/esm/Field-B7bX_uUg.js +403 -0
- package/dist/esm/FormElementMixin-Dd_wkBN5.js +168 -0
- package/dist/esm/Icon-DPyGDeRK.js +182 -0
- package/dist/esm/Image-DhX-4hlV.js +354 -0
- package/dist/esm/InjectedChildMixin-D2K-FwuO.js +145 -0
- package/dist/esm/Input-C4L520az.js +348 -0
- package/dist/esm/Loading-tuQoo6TU.js +143 -0
- package/dist/esm/MessageMixin-CQ7LIdvq.js +134 -0
- package/dist/esm/Modal-tfvyhxw_.js +313 -0
- package/dist/esm/NoticeMixin-ByNlva3T.js +161 -0
- package/dist/esm/Pagination-B-LAJQay.js +543 -0
- package/dist/esm/Progress-BPGTVZgr.js +174 -0
- package/dist/esm/Select-bl4qUzij.js +145 -0
- package/dist/esm/SlotComponent-BwNpVnfH.js +39 -0
- package/dist/esm/TabbedChildMixin-C4i6WP9j.js +208 -0
- package/dist/esm/Tag-jS5Bcj6N.js +165 -0
- package/dist/esm/Timepicker-DnkqnOBT.js +281 -0
- package/dist/esm/TimepickerMixin-Bikh6_Fg.js +664 -0
- package/dist/esm/Tooltip-CtDSXAqa.js +391 -0
- package/dist/esm/_plugin-vue_export-helper-OJRSZE6i.js +9 -0
- package/dist/esm/autocomplete.js +18 -0
- package/dist/esm/breadcrumb.js +101 -0
- package/dist/esm/button.js +15 -0
- package/dist/esm/carousel.js +818 -0
- package/dist/esm/checkbox.js +82 -0
- package/dist/esm/clockpicker.js +663 -0
- package/dist/esm/collapse.js +94 -0
- package/dist/esm/colorpicker.js +16 -0
- package/dist/esm/config-CKuo-p6e.js +100 -0
- package/dist/esm/config.js +14 -0
- package/dist/esm/datepicker.js +23 -0
- package/dist/esm/datetimepicker.js +478 -0
- package/dist/esm/dialog.js +500 -0
- package/dist/esm/dropdown.js +17 -0
- package/dist/esm/field.js +14 -0
- package/dist/esm/helpers.js +247 -0
- package/dist/esm/icon.js +14 -0
- package/dist/esm/image.js +14 -0
- package/dist/esm/index-CQegEsxK.js +1938 -0
- package/dist/esm/index.js +164 -0
- package/dist/esm/input.js +17 -0
- package/dist/esm/loading.js +81 -0
- package/dist/esm/menu.js +333 -0
- package/dist/esm/message.js +114 -0
- package/dist/esm/modal.js +97 -0
- package/dist/esm/navbar.js +565 -0
- package/dist/esm/notification.js +275 -0
- package/dist/esm/numberinput.js +381 -0
- package/dist/esm/pagination.js +16 -0
- package/dist/esm/plugins-B172kuKE.js +13 -0
- package/dist/esm/progress.js +85 -0
- package/dist/esm/radio.js +131 -0
- package/dist/esm/rate.js +192 -0
- package/dist/esm/select.js +17 -0
- package/dist/esm/sidebar.js +304 -0
- package/dist/esm/skeleton.js +73 -0
- package/dist/esm/slider.js +693 -0
- package/dist/esm/snackbar.js +218 -0
- package/dist/esm/ssr-C7yEpGLm.js +5 -0
- package/dist/esm/steps.js +341 -0
- package/dist/esm/switch.js +156 -0
- package/dist/esm/table.js +2385 -0
- package/dist/esm/tabs.js +252 -0
- package/dist/esm/tag.js +38 -0
- package/dist/esm/taginput.js +420 -0
- package/dist/esm/timepicker.js +24 -0
- package/dist/esm/toast.js +156 -0
- package/dist/esm/tooltip.js +14 -0
- package/dist/esm/trapFocus-KHP_kCNE.js +51 -0
- package/dist/esm/upload.js +190 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +73 -6
- package/src/components/autocomplete/Autocomplete.spec.ts +783 -0
- package/src/components/autocomplete/Autocomplete.vue +966 -0
- package/src/components/autocomplete/__snapshots__/Autocomplete.spec.ts.snap +21 -0
- package/src/components/autocomplete/index.ts +16 -0
- package/src/components/breadcrumb/Breadcrumb.spec.ts +65 -0
- package/src/components/breadcrumb/Breadcrumb.vue +42 -0
- package/src/components/breadcrumb/BreadcrumbItem.spec.ts +74 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +34 -0
- package/src/components/breadcrumb/__snapshots__/Breadcrumb.spec.ts.snap +7 -0
- package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.ts.snap +3 -0
- package/src/components/breadcrumb/index.ts +19 -0
- package/src/components/button/Button.spec.ts +117 -0
- package/src/components/button/Button.vue +112 -0
- package/src/components/button/__snapshots__/Button.spec.ts.snap +9 -0
- package/src/components/button/index.ts +16 -0
- package/src/components/carousel/Carousel.spec.ts +304 -0
- package/src/components/carousel/Carousel.vue +389 -0
- package/src/components/carousel/CarouselItem.spec.ts +105 -0
- package/src/components/carousel/CarouselItem.vue +38 -0
- package/src/components/carousel/CarouselList.spec.ts +172 -0
- package/src/components/carousel/CarouselList.vue +364 -0
- package/src/components/carousel/__snapshots__/Carousel.spec.ts.snap +19 -0
- package/src/components/carousel/__snapshots__/CarouselItem.spec.ts.snap +7 -0
- package/src/components/carousel/__snapshots__/CarouselList.spec.ts.snap +36 -0
- package/src/components/carousel/index.ts +23 -0
- package/src/components/carousel/types.ts +17 -0
- package/src/components/checkbox/Checkbox.spec.ts +40 -0
- package/src/components/checkbox/Checkbox.vue +63 -0
- package/src/components/checkbox/CheckboxButton.spec.ts +46 -0
- package/src/components/checkbox/CheckboxButton.vue +59 -0
- package/src/components/checkbox/__snapshots__/Checkbox.spec.ts.snap +9 -0
- package/src/components/checkbox/__snapshots__/CheckboxButton.spec.ts.snap +3 -0
- package/src/components/checkbox/index.ts +20 -0
- package/src/components/clockpicker/Clockpicker.spec.ts +161 -0
- package/src/components/clockpicker/Clockpicker.vue +311 -0
- package/src/components/clockpicker/ClockpickerFace.spec.ts +99 -0
- package/src/components/clockpicker/ClockpickerFace.vue +272 -0
- package/src/components/clockpicker/__snapshots__/Clockpicker.spec.ts.snap +36 -0
- package/src/components/clockpicker/__snapshots__/ClockpickerFace.spec.ts.snap +9 -0
- package/src/components/clockpicker/index.ts +16 -0
- package/src/components/collapse/Collapse.spec.ts +106 -0
- package/src/components/collapse/Collapse.vue +98 -0
- package/src/components/collapse/__snapshots__/Collapse.spec.ts.snap +10 -0
- package/src/components/collapse/index.ts +16 -0
- package/src/components/colorpicker/Colorpicker.spec.ts +22 -0
- package/src/components/colorpicker/Colorpicker.vue +416 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.spec.ts +17 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.vue +205 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.spec.ts +23 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.vue +380 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.spec.ts +23 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +456 -0
- package/src/components/colorpicker/__snapshots__/Colorpicker.spec.ts.snap +77 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerAlphaSlider.spec.ts.snap +9 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationSquare.spec.ts.snap +12 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationTriangle.spec.ts.snap +36 -0
- package/src/components/colorpicker/index.ts +16 -0
- package/src/components/datepicker/Datepicker.spec.ts +482 -0
- package/src/components/datepicker/Datepicker.vue +908 -0
- package/src/components/datepicker/DatepickerMonth.spec.ts +346 -0
- package/src/components/datepicker/DatepickerMonth.vue +444 -0
- package/src/components/datepicker/DatepickerTable.spec.ts +290 -0
- package/src/components/datepicker/DatepickerTable.vue +398 -0
- package/src/components/datepicker/DatepickerTableRow.spec.ts +300 -0
- package/src/components/datepicker/DatepickerTableRow.vue +416 -0
- package/src/components/datepicker/__snapshots__/Datepicker.spec.ts.snap +54 -0
- package/src/components/datepicker/__snapshots__/DatepickerMonth.spec.ts.snap +33 -0
- package/src/components/datepicker/__snapshots__/DatepickerTable.spec.ts.snap +16 -0
- package/src/components/datepicker/__snapshots__/DatepickerTableRow.spec.ts.snap +23 -0
- package/src/components/datepicker/index.ts +17 -0
- package/src/components/datepicker/types.ts +41 -0
- package/src/components/datetimepicker/Datetimepicker.spec.ts +132 -0
- package/src/components/datetimepicker/Datetimepicker.vue +491 -0
- package/src/components/datetimepicker/index.ts +16 -0
- package/src/components/dialog/Dialog.spec.ts +108 -0
- package/src/components/dialog/Dialog.vue +300 -0
- package/src/components/dialog/index.ts +169 -0
- package/src/components/dropdown/Dropdown.spec.ts +229 -0
- package/src/components/dropdown/Dropdown.vue +491 -0
- package/src/components/dropdown/DropdownItem.spec.ts +78 -0
- package/src/components/dropdown/DropdownItem.vue +112 -0
- package/src/components/dropdown/__snapshots__/Dropdown.spec.ts.snap +15 -0
- package/src/components/dropdown/__snapshots__/DropdownItem.spec.ts.snap +3 -0
- package/src/components/dropdown/index.ts +20 -0
- package/src/components/field/Field.spec.ts +324 -0
- package/src/components/field/Field.vue +316 -0
- package/src/components/field/FieldBody.spec.ts +96 -0
- package/src/components/field/FieldBody.vue +74 -0
- package/src/components/field/__snapshots__/Field.spec.ts.snap +8 -0
- package/src/components/field/__snapshots__/FieldBody.spec.ts.snap +3 -0
- package/src/components/field/index.ts +16 -0
- package/src/components/icon/Icon.spec.ts +142 -0
- package/src/components/icon/Icon.vue +120 -0
- package/src/components/icon/__snapshots__/Icon.spec.ts.snap +3 -0
- package/src/components/icon/index.ts +17 -0
- package/src/components/image/Image.spec.ts +218 -0
- package/src/components/image/Image.vue +358 -0
- package/src/components/image/__snapshots__/Image.spec.ts.snap +37 -0
- package/src/components/image/index.ts +16 -0
- package/src/components/index.ts +179 -0
- package/src/components/input/Input.spec.ts +396 -0
- package/src/components/input/Input.vue +335 -0
- package/src/components/input/__snapshots__/Input.spec.ts.snap +9 -0
- package/src/components/input/index.ts +17 -0
- package/src/components/loading/Loading.spec.ts +151 -0
- package/src/components/loading/Loading.vue +135 -0
- package/src/components/loading/__snapshots__/Loading.spec.ts.snap +10 -0
- package/src/components/loading/index.ts +91 -0
- package/src/components/menu/Menu.spec.ts +21 -0
- package/src/components/menu/Menu.vue +31 -0
- package/src/components/menu/MenuItem.spec.ts +92 -0
- package/src/components/menu/MenuItem.vue +168 -0
- package/src/components/menu/MenuItemContainerMixin.ts +72 -0
- package/src/components/menu/MenuList.spec.ts +35 -0
- package/src/components/menu/MenuList.vue +47 -0
- package/src/components/menu/__snapshots__/Menu.spec.ts.snap +3 -0
- package/src/components/menu/__snapshots__/MenuItem.spec.ts.snap +9 -0
- package/src/components/menu/__snapshots__/MenuList.spec.ts.snap +8 -0
- package/src/components/menu/index.ts +25 -0
- package/src/components/message/Message.spec.ts +30 -0
- package/src/components/message/Message.vue +73 -0
- package/src/components/message/__snapshots__/Message.spec.ts.snap +11 -0
- package/src/components/message/index.ts +15 -0
- package/src/components/modal/Modal.spec.ts +167 -0
- package/src/components/modal/Modal.vue +335 -0
- package/src/components/modal/__snapshots__/Modal.spec.ts.snap +10 -0
- package/src/components/modal/index.ts +107 -0
- package/src/components/navbar/NavBar.spec.ts +78 -0
- package/src/components/navbar/NavBarBurger.spec.ts +30 -0
- package/src/components/navbar/NavBarItem.spec.ts +92 -0
- package/src/components/navbar/Navbar.vue +274 -0
- package/src/components/navbar/NavbarBurger.vue +29 -0
- package/src/components/navbar/NavbarDropdown.spec.ts +84 -0
- package/src/components/navbar/NavbarDropdown.vue +115 -0
- package/src/components/navbar/NavbarItem.vue +97 -0
- package/src/components/navbar/__snapshots__/NavBar.spec.ts.snap +11 -0
- package/src/components/navbar/__snapshots__/NavBarBurger.spec.ts.snap +3 -0
- package/src/components/navbar/__snapshots__/NavBarItem.spec.ts.snap +3 -0
- package/src/components/navbar/__snapshots__/NavbarDropdown.spec.ts.snap +7 -0
- package/src/components/navbar/index.ts +22 -0
- package/src/components/notification/Notification.spec.ts +21 -0
- package/src/components/notification/Notification.vue +77 -0
- package/src/components/notification/NotificationNotice.vue +76 -0
- package/src/components/notification/__snapshots__/Notification.spec.ts.snap +10 -0
- package/src/components/notification/index.ts +121 -0
- package/src/components/numberinput/Numberinput.spec.ts +445 -0
- package/src/components/numberinput/Numberinput.vue +372 -0
- package/src/components/numberinput/index.ts +16 -0
- package/src/components/pagination/Pagination.spec.ts +94 -0
- package/src/components/pagination/Pagination.vue +434 -0
- package/src/components/pagination/PaginationButton.spec.ts +42 -0
- package/src/components/pagination/PaginationButton.vue +59 -0
- package/src/components/pagination/__snapshots__/Pagination.spec.ts.snap +22 -0
- package/src/components/pagination/__snapshots__/PaginationButton.spec.ts.snap +3 -0
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/types.ts +11 -0
- package/src/components/progress/Progress.spec.ts +81 -0
- package/src/components/progress/Progress.vue +168 -0
- package/src/components/progress/ProgressBar.spec.ts +45 -0
- package/src/components/progress/ProgressBar.vue +74 -0
- package/src/components/progress/__snapshots__/Progress.spec.ts.snap +7 -0
- package/src/components/progress/__snapshots__/ProgressBar.spec.ts.snap +7 -0
- package/src/components/progress/index.ts +18 -0
- package/src/components/radio/Radio.spec.ts +40 -0
- package/src/components/radio/Radio.vue +35 -0
- package/src/components/radio/RadioButton.spec.ts +40 -0
- package/src/components/radio/RadioButton.vue +69 -0
- package/src/components/radio/__snapshots__/Radio.spec.ts.snap +3 -0
- package/src/components/radio/__snapshots__/RadioButton.spec.ts.snap +3 -0
- package/src/components/radio/index.ts +18 -0
- package/src/components/rate/Rate.spec.ts +90 -0
- package/src/components/rate/Rate.vue +158 -0
- package/src/components/rate/index.ts +15 -0
- package/src/components/select/Select.spec.ts +74 -0
- package/src/components/select/Select.vue +118 -0
- package/src/components/select/__snapshots__/Select.spec.ts.snap +7 -0
- package/src/components/select/index.ts +16 -0
- package/src/components/sidebar/Sidebar.spec.ts +107 -0
- package/src/components/sidebar/Sidebar.vue +316 -0
- package/src/components/sidebar/__snapshots__/Sidebar.spec.ts.snap +25 -0
- package/src/components/sidebar/index.ts +16 -0
- package/src/components/skeleton/Skeleton.spec.ts +16 -0
- package/src/components/skeleton/Skeleton.vue +98 -0
- package/src/components/skeleton/__snapshots__/Skeleton.spec.ts.snap +7 -0
- package/src/components/skeleton/index.ts +18 -0
- package/src/components/slider/Slider.spec.ts +115 -0
- package/src/components/slider/Slider.vue +374 -0
- package/src/components/slider/SliderThumb.spec.ts +176 -0
- package/src/components/slider/SliderThumb.vue +251 -0
- package/src/components/slider/SliderTick.spec.ts +33 -0
- package/src/components/slider/SliderTick.vue +50 -0
- package/src/components/slider/__snapshots__/Slider.spec.ts.snap +12 -0
- package/src/components/slider/__snapshots__/SliderThumb.spec.ts.snap +16 -0
- package/src/components/slider/__snapshots__/SliderTick.spec.ts.snap +7 -0
- package/src/components/slider/index.ts +19 -0
- package/src/components/slider/types.ts +34 -0
- package/src/components/snackbar/Snackbar.spec.ts +35 -0
- package/src/components/snackbar/Snackbar.vue +88 -0
- package/src/components/snackbar/__snapshots__/Snackbar.spec.ts.snap +12 -0
- package/src/components/snackbar/index.ts +118 -0
- package/src/components/steps/StepItem.spec.ts +114 -0
- package/src/components/steps/StepItem.vue +26 -0
- package/src/components/steps/Steps.spec.ts +125 -0
- package/src/components/steps/Steps.vue +273 -0
- package/src/components/steps/__snapshots__/StepItem.spec.ts.snap +7 -0
- package/src/components/steps/__snapshots__/Steps.spec.ts.snap +40 -0
- package/src/components/steps/index.ts +19 -0
- package/src/components/switch/Switch.spec.ts +74 -0
- package/src/components/switch/Switch.vue +146 -0
- package/src/components/switch/__snapshots__/Switch.spec.ts.snap +3 -0
- package/src/components/switch/index.ts +16 -0
- package/src/components/table/Table.spec.ts +622 -0
- package/src/components/table/Table.vue +1770 -0
- package/src/components/table/TableColumn.spec.ts +85 -0
- package/src/components/table/TableColumn.vue +140 -0
- package/src/components/table/TableMobileSort.spec.ts +47 -0
- package/src/components/table/TableMobileSort.vue +236 -0
- package/src/components/table/TablePagination.vue +86 -0
- package/src/components/table/__snapshots__/Table.spec.ts.snap +24 -0
- package/src/components/table/__snapshots__/TableMobileSort.spec.ts.snap +12 -0
- package/src/components/table/index.ts +32 -0
- package/src/components/table/mockTableColumn.ts +110 -0
- package/src/components/table/types.ts +110 -0
- package/src/components/tabs/TabItem.spec.ts +203 -0
- package/src/components/tabs/TabItem.vue +19 -0
- package/src/components/tabs/Tabs.spec.ts +122 -0
- package/src/components/tabs/Tabs.vue +204 -0
- package/src/components/tabs/__snapshots__/TabItem.spec.ts.snap +7 -0
- package/src/components/tabs/__snapshots__/Tabs.spec.ts.snap +33 -0
- package/src/components/tabs/index.ts +19 -0
- package/src/components/tag/Tag.spec.ts +32 -0
- package/src/components/tag/Tag.vue +132 -0
- package/src/components/tag/Taglist.spec.ts +21 -0
- package/src/components/tag/Taglist.vue +16 -0
- package/src/components/tag/__snapshots__/Tag.spec.ts.snap +6 -0
- package/src/components/tag/__snapshots__/Taglist.spec.ts.snap +3 -0
- package/src/components/tag/index.ts +19 -0
- package/src/components/taginput/Taginput.spec.ts +132 -0
- package/src/components/taginput/Taginput.vue +415 -0
- package/src/components/taginput/__snapshots__/Taginput.spec.ts.snap +10 -0
- package/src/components/taginput/index.ts +16 -0
- package/src/components/timepicker/Timepicker.spec.ts +108 -0
- package/src/components/timepicker/Timepicker.vue +183 -0
- package/src/components/timepicker/__snapshots__/Timepicker.spec.ts.snap +41 -0
- package/src/components/timepicker/index.ts +17 -0
- package/src/components/toast/Toast.spec.ts +74 -0
- package/src/components/toast/Toast.vue +46 -0
- package/src/components/toast/__snapshots__/Toast.spec.ts.snap +10 -0
- package/src/components/toast/index.ts +120 -0
- package/src/components/tooltip/Tooltip.spec.ts +64 -0
- package/src/components/tooltip/Tooltip.vue +393 -0
- package/src/components/tooltip/__snapshots__/Tooltip.spec.ts.snap +12 -0
- package/src/components/tooltip/index.ts +16 -0
- package/src/components/upload/Upload.spec.ts +62 -0
- package/src/components/upload/Upload.vue +188 -0
- package/src/components/upload/__snapshots__/Upload.spec.ts.snap +3 -0
- package/src/components/upload/index.ts +15 -0
- package/src/directives/clickOutside.ts +113 -0
- package/src/directives/trapFocus.ts +61 -0
- package/src/index.ts +43 -0
- package/src/scss/buefy-build.scss +6 -0
- package/src/scss/buefy.scss +39 -0
- package/src/scss/components/_autocomplete.scss +39 -0
- package/src/scss/components/_carousel.scss +204 -0
- package/src/scss/components/_checkbox.scss +106 -0
- package/src/scss/components/_clockpicker.scss +283 -0
- package/src/scss/components/_collapse.scss +9 -0
- package/src/scss/components/_colorpicker.scss +283 -0
- package/src/scss/components/_datepicker.scss +220 -0
- package/src/scss/components/_dialog.scss +54 -0
- package/src/scss/components/_dropdown.scss +143 -0
- package/src/scss/components/_form.scss +309 -0
- package/src/scss/components/_icon.scss +16 -0
- package/src/scss/components/_image.scss +20 -0
- package/src/scss/components/_loading.scss +45 -0
- package/src/scss/components/_menu.scss +11 -0
- package/src/scss/components/_message.scss +16 -0
- package/src/scss/components/_modal.scss +37 -0
- package/src/scss/components/_navbar.scss +22 -0
- package/src/scss/components/_notices.scss +144 -0
- package/src/scss/components/_notification.scss +8 -0
- package/src/scss/components/_numberinput.scss +33 -0
- package/src/scss/components/_pagination.scss +63 -0
- package/src/scss/components/_progress.scss +105 -0
- package/src/scss/components/_radio.scss +123 -0
- package/src/scss/components/_rate.scss +72 -0
- package/src/scss/components/_select.scss +38 -0
- package/src/scss/components/_sidebar.scss +107 -0
- package/src/scss/components/_skeleton.scss +66 -0
- package/src/scss/components/_slider.scss +162 -0
- package/src/scss/components/_steps.scss +491 -0
- package/src/scss/components/_switch.scss +214 -0
- package/src/scss/components/_table.scss +322 -0
- package/src/scss/components/_tabs.scss +197 -0
- package/src/scss/components/_tag.scss +36 -0
- package/src/scss/components/_taginput.scss +73 -0
- package/src/scss/components/_timepicker.scss +73 -0
- package/src/scss/components/_tooltip.scss +192 -0
- package/src/scss/components/_upload.scss +62 -0
- package/src/scss/utils/_all.scss +4 -0
- package/src/scss/utils/_animations.scss +183 -0
- package/src/scss/utils/_functions.scss +49 -0
- package/src/scss/utils/_helpers.scss +6 -0
- package/src/scss/utils/_variables-ext.scss +2 -0
- package/src/scss/utils/_variables.scss +16 -0
- package/src/utils/CheckRadioMixin.spec.ts +28 -0
- package/src/utils/CheckRadioMixin.ts +61 -0
- package/src/utils/CompatFallthroughMixin.ts +34 -0
- package/src/utils/ConfigComponent.ts +12 -0
- package/src/utils/FormElementMixin.spec.ts +41 -0
- package/src/utils/FormElementMixin.ts +206 -0
- package/src/utils/InjectedChildMixin.ts +139 -0
- package/src/utils/MessageMixin.spec.ts +51 -0
- package/src/utils/MessageMixin.ts +138 -0
- package/src/utils/NoticeMixin.spec.ts +55 -0
- package/src/utils/NoticeMixin.ts +181 -0
- package/src/utils/ProvideInjectTypes.ts +20 -0
- package/src/utils/ProviderParentMixin.ts +105 -0
- package/src/utils/SlotComponent.spec.ts +55 -0
- package/src/utils/SlotComponent.ts +38 -0
- package/src/utils/TabbedChildMixin.ts +96 -0
- package/src/utils/TabbedMixin.ts +166 -0
- package/src/utils/TabbedTypes.ts +33 -0
- package/src/utils/TimepickerMixin.spec.ts +75 -0
- package/src/utils/TimepickerMixin.ts +767 -0
- package/src/utils/color.spec.ts +55 -0
- package/src/utils/color.ts +507 -0
- package/src/utils/config.spec.ts +11 -0
- package/src/utils/config.ts +619 -0
- package/src/utils/debounce.spec.ts +52 -0
- package/src/utils/debounce.ts +20 -0
- package/src/utils/helpers.spec.ts +257 -0
- package/src/utils/helpers.ts +527 -0
- package/src/utils/icons.ts +73 -0
- package/src/utils/plugins.ts +20 -0
- package/src/utils/ssr.ts +6 -0
- package/src/utils/vue-augmentation.ts +35 -0
|
@@ -0,0 +1,4251 @@
|
|
|
1
|
+
/*! Buefy v1.0.2 | MIT License | github.com/buefy/buefy */
|
|
2
|
+
(function (global, factory) {
|
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
|
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
|
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Colorpicker = {}, global.Vue));
|
|
6
|
+
})(this, (function (exports, vue) { 'use strict';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __pow = Math.pow;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
12
|
+
const colorChannels = ["red", "green", "blue", "alpha"];
|
|
13
|
+
const colorsNammed = {
|
|
14
|
+
transparent: "#00000000",
|
|
15
|
+
black: "#000000",
|
|
16
|
+
silver: "#c0c0c0",
|
|
17
|
+
gray: "#808080",
|
|
18
|
+
white: "#ffffff",
|
|
19
|
+
maroon: "#800000",
|
|
20
|
+
red: "#ff0000",
|
|
21
|
+
purple: "#800080",
|
|
22
|
+
fuchsia: "#ff00ff",
|
|
23
|
+
green: "#008000",
|
|
24
|
+
lime: "#00ff00",
|
|
25
|
+
olive: "#808000",
|
|
26
|
+
yellow: "#ffff00",
|
|
27
|
+
navy: "#000080",
|
|
28
|
+
blue: "#0000ff",
|
|
29
|
+
teal: "#008080",
|
|
30
|
+
aqua: "#00ffff",
|
|
31
|
+
orange: "#ffa500",
|
|
32
|
+
aliceblue: "#f0f8ff",
|
|
33
|
+
antiquewhite: "#faebd7",
|
|
34
|
+
aquamarine: "#7fffd4",
|
|
35
|
+
azure: "#f0ffff",
|
|
36
|
+
beige: "#f5f5dc",
|
|
37
|
+
bisque: "#ffe4c4",
|
|
38
|
+
blanchedalmond: "#ffebcd",
|
|
39
|
+
blueviolet: "#8a2be2",
|
|
40
|
+
brown: "#a52a2a",
|
|
41
|
+
burlywood: "#deb887",
|
|
42
|
+
cadetblue: "#5f9ea0",
|
|
43
|
+
chartreuse: "#7fff00",
|
|
44
|
+
chocolate: "#d2691e",
|
|
45
|
+
coral: "#ff7f50",
|
|
46
|
+
cornflowerblue: "#6495ed",
|
|
47
|
+
cornsilk: "#fff8dc",
|
|
48
|
+
crimson: "#dc143c",
|
|
49
|
+
cyan: "#00ffff",
|
|
50
|
+
darkblue: "#00008b",
|
|
51
|
+
darkcyan: "#008b8b",
|
|
52
|
+
darkgoldenrod: "#b8860b",
|
|
53
|
+
darkgray: "#a9a9a9",
|
|
54
|
+
darkgreen: "#006400",
|
|
55
|
+
darkgrey: "#a9a9a9",
|
|
56
|
+
darkkhaki: "#bdb76b",
|
|
57
|
+
darkmagenta: "#8b008b",
|
|
58
|
+
darkolivegreen: "#556b2f",
|
|
59
|
+
darkorange: "#ff8c00",
|
|
60
|
+
darkorchid: "#9932cc",
|
|
61
|
+
darkred: "#8b0000",
|
|
62
|
+
darksalmon: "#e9967a",
|
|
63
|
+
darkseagreen: "#8fbc8f",
|
|
64
|
+
darkslateblue: "#483d8b",
|
|
65
|
+
darkslategray: "#2f4f4f",
|
|
66
|
+
darkslategrey: "#2f4f4f",
|
|
67
|
+
darkturquoise: "#00ced1",
|
|
68
|
+
darkviolet: "#9400d3",
|
|
69
|
+
deeppink: "#ff1493",
|
|
70
|
+
deepskyblue: "#00bfff",
|
|
71
|
+
dimgray: "#696969",
|
|
72
|
+
dimgrey: "#696969",
|
|
73
|
+
dodgerblue: "#1e90ff",
|
|
74
|
+
firebrick: "#b22222",
|
|
75
|
+
floralwhite: "#fffaf0",
|
|
76
|
+
forestgreen: "#228b22",
|
|
77
|
+
gainsboro: "#dcdcdc",
|
|
78
|
+
ghostwhite: "#f8f8ff",
|
|
79
|
+
gold: "#ffd700",
|
|
80
|
+
goldenrod: "#daa520",
|
|
81
|
+
greenyellow: "#adff2f",
|
|
82
|
+
grey: "#808080",
|
|
83
|
+
honeydew: "#f0fff0",
|
|
84
|
+
hotpink: "#ff69b4",
|
|
85
|
+
indianred: "#cd5c5c",
|
|
86
|
+
indigo: "#4b0082",
|
|
87
|
+
ivory: "#fffff0",
|
|
88
|
+
khaki: "#f0e68c",
|
|
89
|
+
lavender: "#e6e6fa",
|
|
90
|
+
lavenderblush: "#fff0f5",
|
|
91
|
+
lawngreen: "#7cfc00",
|
|
92
|
+
lemonchiffon: "#fffacd",
|
|
93
|
+
lightblue: "#add8e6",
|
|
94
|
+
lightcoral: "#f08080",
|
|
95
|
+
lightcyan: "#e0ffff",
|
|
96
|
+
lightgoldenrodyellow: "#fafad2",
|
|
97
|
+
lightgray: "#d3d3d3",
|
|
98
|
+
lightgreen: "#90ee90",
|
|
99
|
+
lightgrey: "#d3d3d3",
|
|
100
|
+
lightpink: "#ffb6c1",
|
|
101
|
+
lightsalmon: "#ffa07a",
|
|
102
|
+
lightseagreen: "#20b2aa",
|
|
103
|
+
lightskyblue: "#87cefa",
|
|
104
|
+
lightslategray: "#778899",
|
|
105
|
+
lightslategrey: "#778899",
|
|
106
|
+
lightsteelblue: "#b0c4de",
|
|
107
|
+
lightyellow: "#ffffe0",
|
|
108
|
+
limegreen: "#32cd32",
|
|
109
|
+
linen: "#faf0e6",
|
|
110
|
+
magenta: "#ff00ff",
|
|
111
|
+
mediumaquamarine: "#66cdaa",
|
|
112
|
+
mediumblue: "#0000cd",
|
|
113
|
+
mediumorchid: "#ba55d3",
|
|
114
|
+
mediumpurple: "#9370db",
|
|
115
|
+
mediumseagreen: "#3cb371",
|
|
116
|
+
mediumslateblue: "#7b68ee",
|
|
117
|
+
mediumspringgreen: "#00fa9a",
|
|
118
|
+
mediumturquoise: "#48d1cc",
|
|
119
|
+
mediumvioletred: "#c71585",
|
|
120
|
+
midnightblue: "#191970",
|
|
121
|
+
mintcream: "#f5fffa",
|
|
122
|
+
mistyrose: "#ffe4e1",
|
|
123
|
+
moccasin: "#ffe4b5",
|
|
124
|
+
navajowhite: "#ffdead",
|
|
125
|
+
oldlace: "#fdf5e6",
|
|
126
|
+
olivedrab: "#6b8e23",
|
|
127
|
+
orangered: "#ff4500",
|
|
128
|
+
orchid: "#da70d6",
|
|
129
|
+
palegoldenrod: "#eee8aa",
|
|
130
|
+
palegreen: "#98fb98",
|
|
131
|
+
paleturquoise: "#afeeee",
|
|
132
|
+
palevioletred: "#db7093",
|
|
133
|
+
papayawhip: "#ffefd5",
|
|
134
|
+
peachpuff: "#ffdab9",
|
|
135
|
+
peru: "#cd853f",
|
|
136
|
+
pink: "#ffc0cb",
|
|
137
|
+
plum: "#dda0dd",
|
|
138
|
+
powderblue: "#b0e0e6",
|
|
139
|
+
rosybrown: "#bc8f8f",
|
|
140
|
+
royalblue: "#4169e1",
|
|
141
|
+
saddlebrown: "#8b4513",
|
|
142
|
+
salmon: "#fa8072",
|
|
143
|
+
sandybrown: "#f4a460",
|
|
144
|
+
seagreen: "#2e8b57",
|
|
145
|
+
seashell: "#fff5ee",
|
|
146
|
+
sienna: "#a0522d",
|
|
147
|
+
skyblue: "#87ceeb",
|
|
148
|
+
slateblue: "#6a5acd",
|
|
149
|
+
slategray: "#708090",
|
|
150
|
+
slategrey: "#708090",
|
|
151
|
+
snow: "#fffafa",
|
|
152
|
+
springgreen: "#00ff7f",
|
|
153
|
+
steelblue: "#4682b4",
|
|
154
|
+
tan: "#d2b48c",
|
|
155
|
+
thistle: "#d8bfd8",
|
|
156
|
+
tomato: "#ff6347",
|
|
157
|
+
turquoise: "#40e0d0",
|
|
158
|
+
violet: "#ee82ee",
|
|
159
|
+
wheat: "#f5deb3",
|
|
160
|
+
whitesmoke: "#f5f5f5",
|
|
161
|
+
yellowgreen: "#9acd32",
|
|
162
|
+
rebeccapurple: "#663399"
|
|
163
|
+
};
|
|
164
|
+
class ColorTypeError extends Error {
|
|
165
|
+
constructor() {
|
|
166
|
+
super("ColorTypeError: type must be hex(a), rgb(a) or hsl(a)");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
class Color {
|
|
170
|
+
// Since getters and setters for the color channels, e.g., "alpha", are
|
|
171
|
+
// dynamically defined with `Object.defineProperty` in the constructor, we
|
|
172
|
+
// cannot write property declarations inside the class body. Instead, we
|
|
173
|
+
// augment the `Color` class with an ambient module declared in `color.ts`.
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
+
constructor(...args) {
|
|
176
|
+
// @ts-expect-error - TypeScript failed to inter the initialization of this property
|
|
177
|
+
__publicField(this, "$channels");
|
|
178
|
+
if (args.length > 0) {
|
|
179
|
+
return Color.parse(...args);
|
|
180
|
+
}
|
|
181
|
+
this.$channels = new Uint8Array(colorChannels.length);
|
|
182
|
+
}
|
|
183
|
+
get red() {
|
|
184
|
+
return this.$channels[0];
|
|
185
|
+
}
|
|
186
|
+
set red(byte) {
|
|
187
|
+
if (!Number.isNaN(byte / 1)) {
|
|
188
|
+
this.$channels[0] = Math.min(255, Math.max(0, byte));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
get green() {
|
|
192
|
+
return this.$channels[1];
|
|
193
|
+
}
|
|
194
|
+
set green(byte) {
|
|
195
|
+
if (!Number.isNaN(byte / 1)) {
|
|
196
|
+
this.$channels[1] = Math.min(255, Math.max(0, byte));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
get blue() {
|
|
200
|
+
return this.$channels[2];
|
|
201
|
+
}
|
|
202
|
+
set blue(byte) {
|
|
203
|
+
if (!Number.isNaN(byte / 1)) {
|
|
204
|
+
this.$channels[2] = Math.min(255, Math.max(0, byte));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
get alpha() {
|
|
208
|
+
return this.$channels[3];
|
|
209
|
+
}
|
|
210
|
+
set alpha(byte) {
|
|
211
|
+
if (!Number.isNaN(byte / 1)) {
|
|
212
|
+
this.$channels[3] = Math.min(255, Math.max(0, byte));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
get hue() {
|
|
216
|
+
return this.getHue();
|
|
217
|
+
}
|
|
218
|
+
set hue(value) {
|
|
219
|
+
if (!Number.isNaN(value / 1)) {
|
|
220
|
+
this.setHue(value);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
get saturation() {
|
|
224
|
+
return this.getSaturation();
|
|
225
|
+
}
|
|
226
|
+
set saturation(value) {
|
|
227
|
+
if (!Number.isNaN(value / 1)) {
|
|
228
|
+
this.setSaturation(value);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
get lightness() {
|
|
232
|
+
return this.getLightness();
|
|
233
|
+
}
|
|
234
|
+
set lightness(value) {
|
|
235
|
+
if (!Number.isNaN(value / 1)) {
|
|
236
|
+
this.setLightness(value);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
getHue() {
|
|
240
|
+
const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255);
|
|
241
|
+
const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)];
|
|
242
|
+
const delta = max - min;
|
|
243
|
+
let hue = 0;
|
|
244
|
+
if (delta === 0) {
|
|
245
|
+
return hue;
|
|
246
|
+
}
|
|
247
|
+
if (red === max) {
|
|
248
|
+
hue = (green - blue) / delta % 6;
|
|
249
|
+
} else if (green === max) {
|
|
250
|
+
hue = (blue - red) / delta + 2;
|
|
251
|
+
} else {
|
|
252
|
+
hue = (red - green) / delta + 4;
|
|
253
|
+
}
|
|
254
|
+
hue *= 60;
|
|
255
|
+
while (hue !== -Infinity && hue < 0) hue += 360;
|
|
256
|
+
return Math.round(hue % 360);
|
|
257
|
+
}
|
|
258
|
+
setHue(value) {
|
|
259
|
+
const color = Color.fromHSL(value, this.saturation, this.lightness, this.alpha / 255);
|
|
260
|
+
for (let i = 0; i < this.$channels.length; i++) {
|
|
261
|
+
this.$channels[i] = Number(color.$channels[i]);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
getSaturation() {
|
|
265
|
+
const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255);
|
|
266
|
+
const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)];
|
|
267
|
+
const delta = max - min;
|
|
268
|
+
return delta !== 0 ? Math.round(delta / (1 - Math.abs(2 * this.lightness - 1)) * 100) / 100 : 0;
|
|
269
|
+
}
|
|
270
|
+
setSaturation(value) {
|
|
271
|
+
const color = Color.fromHSL(this.hue, value, this.lightness, this.alpha / 255);
|
|
272
|
+
colorChannels.forEach((_, i) => this.$channels[i] = color.$channels[i]);
|
|
273
|
+
}
|
|
274
|
+
getLightness() {
|
|
275
|
+
const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255);
|
|
276
|
+
const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)];
|
|
277
|
+
return Math.round((max + min) / 2 * 100) / 100;
|
|
278
|
+
}
|
|
279
|
+
setLightness(value) {
|
|
280
|
+
const color = Color.fromHSL(this.hue, this.lightness, value, this.alpha / 255);
|
|
281
|
+
colorChannels.forEach((_, i) => this.$channels[i] = color.$channels[i]);
|
|
282
|
+
}
|
|
283
|
+
clone() {
|
|
284
|
+
const color = new Color();
|
|
285
|
+
colorChannels.forEach((_, i) => color.$channels[i] = this.$channels[i]);
|
|
286
|
+
return color;
|
|
287
|
+
}
|
|
288
|
+
toString(type = "hex") {
|
|
289
|
+
switch (String(type).toLowerCase()) {
|
|
290
|
+
case "hex":
|
|
291
|
+
return "#" + colorChannels.slice(0, 3).map((channel) => this[channel].toString(16).padStart(2, "0")).join("");
|
|
292
|
+
case "hexa":
|
|
293
|
+
return "#" + colorChannels.map((channel) => this[channel].toString(16).padStart(2, "0")).join("");
|
|
294
|
+
case "rgb":
|
|
295
|
+
return `rgb(${this.red}, ${this.green}, ${this.blue})`;
|
|
296
|
+
case "rgba":
|
|
297
|
+
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round(this.alpha / 2.55) / 100})`;
|
|
298
|
+
case "hsl":
|
|
299
|
+
return `hsl(${Math.round(this.hue)}deg, ${Math.round(this.saturation * 100)}%, ${Math.round(this.lightness * 100)}%)`;
|
|
300
|
+
case "hsla":
|
|
301
|
+
return `hsla(${Math.round(this.hue)}deg, ${Math.round(this.saturation * 100)}%, ${Math.round(this.lightness * 100)}%, ${Math.round(this.alpha / 2.55) / 100})`;
|
|
302
|
+
default:
|
|
303
|
+
throw new ColorTypeError();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
get [Symbol.toStringTag]() {
|
|
307
|
+
return this.toString("hex");
|
|
308
|
+
}
|
|
309
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
310
|
+
static parse(...args) {
|
|
311
|
+
if (typeof args[0] === "object") {
|
|
312
|
+
return Color.parseObject(args[0]);
|
|
313
|
+
} else if (args.every((arg) => !Number.isNaN(arg / 1))) {
|
|
314
|
+
const color = new Color();
|
|
315
|
+
if (args.length > 3) {
|
|
316
|
+
color.red = args[0];
|
|
317
|
+
color.green = args[1];
|
|
318
|
+
color.blue = args[2];
|
|
319
|
+
if (args[3]) {
|
|
320
|
+
color.alpha = args[3];
|
|
321
|
+
}
|
|
322
|
+
} else if (args.length === 1) {
|
|
323
|
+
const index = Number(args[0]);
|
|
324
|
+
return Color.parseIndex(index, index > __pow(2, 24) ? 3 : 4);
|
|
325
|
+
}
|
|
326
|
+
} else if (typeof args[0] === "string") {
|
|
327
|
+
let match = null;
|
|
328
|
+
if (typeof colorsNammed[args[0].toLowerCase()] === "string") {
|
|
329
|
+
return Color.parseHex(colorsNammed[args[0].toLowerCase()]);
|
|
330
|
+
} else if ((match = args[0].match(/^(#|&h|0x)?(([a-f0-9]{3,4}){1,2})$/i)) !== null) {
|
|
331
|
+
return Color.parseHex(match[2]);
|
|
332
|
+
} else if ((match = args[0].match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(\s*,\s*(\d*\.?\d+))?\s*\)$/i)) !== null) {
|
|
333
|
+
const channels = [
|
|
334
|
+
match[1],
|
|
335
|
+
match[2],
|
|
336
|
+
match[3],
|
|
337
|
+
typeof match[5] !== "undefined" ? match[5] : 1
|
|
338
|
+
];
|
|
339
|
+
return Color.fromRGB(...channels.map((value) => Number(value)));
|
|
340
|
+
} else if (args[0].match(/^(h(sl|wb)a?|lab|color|cmyk)\(/i)) {
|
|
341
|
+
throw new Error("Color expression not implemented yet");
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
throw new Error("Invalid color expression");
|
|
345
|
+
}
|
|
346
|
+
static parseObject(object) {
|
|
347
|
+
const color = new Color();
|
|
348
|
+
if (object === null || typeof object !== "object") {
|
|
349
|
+
return color;
|
|
350
|
+
}
|
|
351
|
+
if (Color.isColor(object)) {
|
|
352
|
+
return object.clone();
|
|
353
|
+
}
|
|
354
|
+
colorChannels.forEach((channel) => {
|
|
355
|
+
if (!Number.isNaN(object[channel])) {
|
|
356
|
+
color[channel] = object[channel];
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
return color;
|
|
360
|
+
}
|
|
361
|
+
static parseHex(hex) {
|
|
362
|
+
if (typeof hex !== "string") {
|
|
363
|
+
throw new Error("Hex expression must be a string");
|
|
364
|
+
}
|
|
365
|
+
hex = hex.trim().replace(/^(0x|&h|#)/i, "");
|
|
366
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
367
|
+
hex = hex.split("").map((c) => c.repeat(2)).join("");
|
|
368
|
+
}
|
|
369
|
+
if (!(hex.length === 6 || hex.length === 8)) {
|
|
370
|
+
throw new Error("Incorrect Hex expression length");
|
|
371
|
+
}
|
|
372
|
+
const chans = hex.split(/(..)/).filter((value) => value).map((value) => Number.parseInt(value, 16));
|
|
373
|
+
if (typeof chans[3] === "number") {
|
|
374
|
+
chans[3] /= 255;
|
|
375
|
+
}
|
|
376
|
+
return Color.fromRGB(...chans);
|
|
377
|
+
}
|
|
378
|
+
static parseIndex(value, channels = 3) {
|
|
379
|
+
const color = new Color();
|
|
380
|
+
for (let i = 0; i < 4; i++) {
|
|
381
|
+
color[colorChannels[i]] = value >> (channels - i) * 8 && 255;
|
|
382
|
+
}
|
|
383
|
+
return color;
|
|
384
|
+
}
|
|
385
|
+
static fromRGB(red, green, blue, alpha = 1) {
|
|
386
|
+
if ([red, green, blue, alpha].some((arg) => Number.isNaN(arg / 1))) {
|
|
387
|
+
throw new Error("Invalid arguments");
|
|
388
|
+
}
|
|
389
|
+
alpha *= 255;
|
|
390
|
+
const color = new Color();
|
|
391
|
+
[red, green, blue, alpha].forEach((value, index) => {
|
|
392
|
+
color[colorChannels[index]] = value;
|
|
393
|
+
});
|
|
394
|
+
return color;
|
|
395
|
+
}
|
|
396
|
+
static fromHSL(hue, saturation, lightness, alpha = 1) {
|
|
397
|
+
if ([hue, saturation, lightness, alpha].some((arg) => Number.isNaN(arg))) {
|
|
398
|
+
throw new Error("Invalid arguments");
|
|
399
|
+
}
|
|
400
|
+
while (hue < 0 && hue !== -Infinity) hue += 360;
|
|
401
|
+
hue = hue % 360;
|
|
402
|
+
saturation = Math.max(0, Math.min(1, saturation));
|
|
403
|
+
lightness = Math.max(0, Math.min(1, lightness));
|
|
404
|
+
alpha = Math.max(0, Math.min(1, alpha));
|
|
405
|
+
const c = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
406
|
+
const x = c * (1 - Math.abs(hue / 60 % 2 - 1));
|
|
407
|
+
const m = lightness - c / 2;
|
|
408
|
+
const [r, g, b] = hue < 60 ? [c, x, 0] : hue < 120 ? [x, c, 0] : hue < 180 ? [0, c, x] : hue < 240 ? [0, x, c] : hue < 300 ? [x, 0, c] : [c, 0, x];
|
|
409
|
+
return Color.fromRGB((r + m) * 255, (g + m) * 255, (b + m) * 255, alpha);
|
|
410
|
+
}
|
|
411
|
+
static isColor(arg) {
|
|
412
|
+
return arg instanceof Color;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
let config = {
|
|
417
|
+
defaultIconPack: "mdi",
|
|
418
|
+
defaultIconComponent: null,
|
|
419
|
+
defaultLocale: void 0,
|
|
420
|
+
defaultTooltipType: "is-primary",
|
|
421
|
+
defaultTooltipDelay: null,
|
|
422
|
+
defaultTooltipCloseDelay: null,
|
|
423
|
+
defaultInputAutocomplete: "on",
|
|
424
|
+
defaultInputHasCounter: true,
|
|
425
|
+
defaultCompatFallthrough: true,
|
|
426
|
+
defaultUseHtml5Validation: true,
|
|
427
|
+
defaultDropdownMobileModal: true,
|
|
428
|
+
defaultFieldLabelPosition: null,
|
|
429
|
+
defaultDatepickerMobileModal: true,
|
|
430
|
+
defaultTrapFocus: true,
|
|
431
|
+
defaultButtonRounded: false,
|
|
432
|
+
defaultStatusIcon: true,
|
|
433
|
+
defaultLinkTags: [
|
|
434
|
+
"a",
|
|
435
|
+
"button",
|
|
436
|
+
"input",
|
|
437
|
+
"router-link",
|
|
438
|
+
"nuxt-link",
|
|
439
|
+
"n-link",
|
|
440
|
+
"RouterLink",
|
|
441
|
+
"NuxtLink",
|
|
442
|
+
"NLink"
|
|
443
|
+
]};
|
|
444
|
+
|
|
445
|
+
const isMobile = {
|
|
446
|
+
Android: function() {
|
|
447
|
+
return typeof window !== "undefined" && window.navigator.userAgent.match(/Android/i);
|
|
448
|
+
},
|
|
449
|
+
BlackBerry: function() {
|
|
450
|
+
return typeof window !== "undefined" && window.navigator.userAgent.match(/BlackBerry/i);
|
|
451
|
+
},
|
|
452
|
+
iOS: function() {
|
|
453
|
+
return typeof window !== "undefined" && (window.navigator.userAgent.match(/iPhone|iPad|iPod/i) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1);
|
|
454
|
+
},
|
|
455
|
+
Opera: function() {
|
|
456
|
+
return typeof window !== "undefined" && window.navigator.userAgent.match(/Opera Mini/i);
|
|
457
|
+
},
|
|
458
|
+
Windows: function() {
|
|
459
|
+
return typeof window !== "undefined" && window.navigator.userAgent.match(/IEMobile/i);
|
|
460
|
+
},
|
|
461
|
+
any: function() {
|
|
462
|
+
return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows();
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
function removeElement(el) {
|
|
466
|
+
if (typeof el.remove !== "undefined") {
|
|
467
|
+
el.remove();
|
|
468
|
+
} else if (typeof el.parentNode !== "undefined" && el.parentNode !== null) {
|
|
469
|
+
el.parentNode.removeChild(el);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function createAbsoluteElement(el) {
|
|
473
|
+
const root = document.createElement("div");
|
|
474
|
+
root.style.position = "absolute";
|
|
475
|
+
root.style.left = "0px";
|
|
476
|
+
root.style.top = "0px";
|
|
477
|
+
root.style.width = "100%";
|
|
478
|
+
const wrapper = document.createElement("div");
|
|
479
|
+
root.appendChild(wrapper);
|
|
480
|
+
wrapper.appendChild(el);
|
|
481
|
+
document.body.appendChild(root);
|
|
482
|
+
return root;
|
|
483
|
+
}
|
|
484
|
+
function toCssWidth(width) {
|
|
485
|
+
return width === void 0 ? null : isNaN(+width) ? `${width}` : width + "px";
|
|
486
|
+
}
|
|
487
|
+
function isCustomElement(vm) {
|
|
488
|
+
return vm.$root != null && "shadowRoot" in vm.$root.$options;
|
|
489
|
+
}
|
|
490
|
+
function isTag(vnode) {
|
|
491
|
+
return vnode.type !== vue.Comment && vnode.type !== vue.Text && vnode.type !== vue.Static;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
var _sfc_main$a = vue.defineComponent({
|
|
495
|
+
name: "BFieldBody",
|
|
496
|
+
inject: {
|
|
497
|
+
parent: {
|
|
498
|
+
from: "BField",
|
|
499
|
+
default: null
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
props: {
|
|
503
|
+
message: {
|
|
504
|
+
type: [String, Array]
|
|
505
|
+
},
|
|
506
|
+
type: {
|
|
507
|
+
type: [String, Object]
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
render() {
|
|
511
|
+
let first = true;
|
|
512
|
+
let children = typeof this.$slots.default === "function" ? this.$slots.default() : this.$slots.default;
|
|
513
|
+
if (children != null && children.length === 1 && children[0].type === vue.Fragment) {
|
|
514
|
+
children = children[0].children;
|
|
515
|
+
}
|
|
516
|
+
return vue.h(
|
|
517
|
+
"div",
|
|
518
|
+
{ class: "field-body" },
|
|
519
|
+
{
|
|
520
|
+
default: () => {
|
|
521
|
+
return children != null && children.map((element) => {
|
|
522
|
+
if (element.type === vue.Comment || element.type === vue.Text) {
|
|
523
|
+
return element;
|
|
524
|
+
}
|
|
525
|
+
let message;
|
|
526
|
+
if (first) {
|
|
527
|
+
message = this.message;
|
|
528
|
+
first = false;
|
|
529
|
+
}
|
|
530
|
+
const parentField = this.parent;
|
|
531
|
+
return vue.h(
|
|
532
|
+
// parentField.$.type is supposed to be BField
|
|
533
|
+
// it falls back to `resolveComponent('b-field')`
|
|
534
|
+
// but won't work unless `BField` is globally registered
|
|
535
|
+
// should not be a problem as long as `BFieldBody` is properly used
|
|
536
|
+
parentField ? parentField.$.type : vue.resolveComponent("b-field"),
|
|
537
|
+
{
|
|
538
|
+
type: this.type,
|
|
539
|
+
message
|
|
540
|
+
},
|
|
541
|
+
() => element
|
|
542
|
+
);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
const Field = vue.defineComponent({
|
|
551
|
+
name: "BField",
|
|
552
|
+
components: { BFieldBody: _sfc_main$a },
|
|
553
|
+
provide() {
|
|
554
|
+
return {
|
|
555
|
+
BField: this
|
|
556
|
+
};
|
|
557
|
+
},
|
|
558
|
+
inject: {
|
|
559
|
+
parent: {
|
|
560
|
+
from: "BField",
|
|
561
|
+
default: false
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
// Used internally only when using Field in Field
|
|
565
|
+
props: {
|
|
566
|
+
type: {
|
|
567
|
+
type: [String, Object],
|
|
568
|
+
default: void 0
|
|
569
|
+
},
|
|
570
|
+
label: String,
|
|
571
|
+
labelFor: String,
|
|
572
|
+
message: {
|
|
573
|
+
type: [String, Array, Object],
|
|
574
|
+
default: void 0
|
|
575
|
+
},
|
|
576
|
+
grouped: Boolean,
|
|
577
|
+
groupMultiline: Boolean,
|
|
578
|
+
position: String,
|
|
579
|
+
expanded: Boolean,
|
|
580
|
+
horizontal: Boolean,
|
|
581
|
+
addons: {
|
|
582
|
+
type: Boolean,
|
|
583
|
+
default: true
|
|
584
|
+
},
|
|
585
|
+
customClass: String,
|
|
586
|
+
labelPosition: {
|
|
587
|
+
type: String,
|
|
588
|
+
default: () => {
|
|
589
|
+
return config.defaultFieldLabelPosition;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
data() {
|
|
594
|
+
return {
|
|
595
|
+
newType: this.type,
|
|
596
|
+
newMessage: this.message,
|
|
597
|
+
fieldLabelSize: null,
|
|
598
|
+
numberInputClasses: [],
|
|
599
|
+
_isField: true
|
|
600
|
+
// Used internally by Input and Select
|
|
601
|
+
};
|
|
602
|
+
},
|
|
603
|
+
computed: {
|
|
604
|
+
rootClasses() {
|
|
605
|
+
return [
|
|
606
|
+
{
|
|
607
|
+
"is-expanded": this.expanded,
|
|
608
|
+
"is-horizontal": this.horizontal,
|
|
609
|
+
"is-floating-in-label": this.hasLabel && !this.horizontal && this.labelPosition === "inside",
|
|
610
|
+
"is-floating-label": this.hasLabel && !this.horizontal && this.labelPosition === "on-border"
|
|
611
|
+
},
|
|
612
|
+
this.numberInputClasses
|
|
613
|
+
];
|
|
614
|
+
},
|
|
615
|
+
innerFieldClasses() {
|
|
616
|
+
return [
|
|
617
|
+
this.fieldType(),
|
|
618
|
+
this.newPosition,
|
|
619
|
+
{
|
|
620
|
+
"is-grouped-multiline": this.groupMultiline
|
|
621
|
+
}
|
|
622
|
+
];
|
|
623
|
+
},
|
|
624
|
+
hasInnerField() {
|
|
625
|
+
return this.grouped || this.groupMultiline || this.hasAddons();
|
|
626
|
+
},
|
|
627
|
+
/*
|
|
628
|
+
* Correct Bulma class for the side of the addon or group.
|
|
629
|
+
*
|
|
630
|
+
* This is not kept like the others (is-small, etc.),
|
|
631
|
+
* because since 'has-addons' is set automatically it
|
|
632
|
+
* doesn't make sense to teach users what addons are exactly.
|
|
633
|
+
*/
|
|
634
|
+
newPosition() {
|
|
635
|
+
if (this.position === void 0) return;
|
|
636
|
+
const position = this.position.split("-");
|
|
637
|
+
if (position.length < 1) return;
|
|
638
|
+
const prefix = this.grouped ? "is-grouped-" : "has-addons-";
|
|
639
|
+
if (this.position) return prefix + position[1];
|
|
640
|
+
return void 0;
|
|
641
|
+
},
|
|
642
|
+
/*
|
|
643
|
+
* Formatted message in case it's an array
|
|
644
|
+
* (each element is separated by <br> tag)
|
|
645
|
+
*/
|
|
646
|
+
formattedMessage() {
|
|
647
|
+
const parentField = this.parent;
|
|
648
|
+
if (parentField && parentField.hasInnerField) {
|
|
649
|
+
return "";
|
|
650
|
+
}
|
|
651
|
+
if (typeof this.newMessage === "string") {
|
|
652
|
+
return [this.newMessage];
|
|
653
|
+
}
|
|
654
|
+
const messages = [];
|
|
655
|
+
if (Array.isArray(this.newMessage)) {
|
|
656
|
+
this.newMessage.forEach((message) => {
|
|
657
|
+
if (typeof message === "string") {
|
|
658
|
+
messages.push(message);
|
|
659
|
+
} else {
|
|
660
|
+
for (const key in message) {
|
|
661
|
+
if (message[key]) {
|
|
662
|
+
messages.push(key);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
} else {
|
|
668
|
+
for (const key in this.newMessage) {
|
|
669
|
+
if (this.newMessage[key]) {
|
|
670
|
+
messages.push(key);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return messages.filter((m) => !!m);
|
|
675
|
+
},
|
|
676
|
+
hasLabel() {
|
|
677
|
+
return this.label || this.$slots.label;
|
|
678
|
+
},
|
|
679
|
+
hasMessage() {
|
|
680
|
+
const parentField = this.parent;
|
|
681
|
+
return (!parentField || !parentField.hasInnerField) && this.newMessage || this.$slots.message;
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
watch: {
|
|
685
|
+
/*
|
|
686
|
+
* Set internal type when prop change.
|
|
687
|
+
*/
|
|
688
|
+
type(value) {
|
|
689
|
+
this.newType = value;
|
|
690
|
+
},
|
|
691
|
+
/*
|
|
692
|
+
* Set internal message when prop change.
|
|
693
|
+
*/
|
|
694
|
+
message(value) {
|
|
695
|
+
if (JSON.stringify(value) !== JSON.stringify(this.newMessage)) {
|
|
696
|
+
this.newMessage = value;
|
|
697
|
+
}
|
|
698
|
+
},
|
|
699
|
+
/*
|
|
700
|
+
* Set parent message if we use Field in Field.
|
|
701
|
+
*/
|
|
702
|
+
newMessage(value) {
|
|
703
|
+
const parentField = this.parent;
|
|
704
|
+
if (parentField && parentField.hasInnerField) {
|
|
705
|
+
if (!parentField.type) {
|
|
706
|
+
parentField.newType = this.newType;
|
|
707
|
+
}
|
|
708
|
+
if (!parentField.message) {
|
|
709
|
+
parentField.newMessage = value;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
methods: {
|
|
715
|
+
/*
|
|
716
|
+
* Field has addons if there are more than one slot
|
|
717
|
+
* (element / component) in the Field.
|
|
718
|
+
* Or is grouped when prop is set.
|
|
719
|
+
* Is a method to be called when component re-render.
|
|
720
|
+
*/
|
|
721
|
+
fieldType() {
|
|
722
|
+
if (this.grouped) return "is-grouped";
|
|
723
|
+
if (this.hasAddons()) return "has-addons";
|
|
724
|
+
},
|
|
725
|
+
hasAddons() {
|
|
726
|
+
let renderedNode = 0;
|
|
727
|
+
if (this.$slots.default) {
|
|
728
|
+
renderedNode = this.$slots.default().reduce((i, node) => isTag(node) ? i + 1 : i, 0);
|
|
729
|
+
}
|
|
730
|
+
return renderedNode > 1 && this.addons && !this.horizontal;
|
|
731
|
+
},
|
|
732
|
+
// called by a number input if it is a direct child.
|
|
733
|
+
wrapNumberinput({ controlsPosition, size }) {
|
|
734
|
+
const classes = ["has-numberinput"];
|
|
735
|
+
if (controlsPosition) {
|
|
736
|
+
classes.push(`has-numberinput-${controlsPosition}`);
|
|
737
|
+
}
|
|
738
|
+
if (size) {
|
|
739
|
+
classes.push(`has-numberinput-${size}`);
|
|
740
|
+
}
|
|
741
|
+
this.numberInputClasses = classes;
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
mounted() {
|
|
745
|
+
if (this.horizontal) {
|
|
746
|
+
const elements = this.$el.querySelectorAll(".input, .select, .button, .textarea, .b-slider");
|
|
747
|
+
if (elements.length > 0) {
|
|
748
|
+
this.fieldLabelSize = "is-normal";
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
var _export_sfc = (sfc, props) => {
|
|
755
|
+
const target = sfc.__vccOpts || sfc;
|
|
756
|
+
for (const [key, val] of props) {
|
|
757
|
+
target[key] = val;
|
|
758
|
+
}
|
|
759
|
+
return target;
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
const _hoisted_1$8 = ["for"];
|
|
763
|
+
const _hoisted_2$6 = ["for"];
|
|
764
|
+
const _hoisted_3$5 = {
|
|
765
|
+
key: 3,
|
|
766
|
+
class: "field-body"
|
|
767
|
+
};
|
|
768
|
+
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
769
|
+
const _component_b_field_body = vue.resolveComponent("b-field-body");
|
|
770
|
+
const _component_b_field = vue.resolveComponent("b-field");
|
|
771
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
772
|
+
"div",
|
|
773
|
+
{
|
|
774
|
+
class: vue.normalizeClass(["field", _ctx.rootClasses])
|
|
775
|
+
},
|
|
776
|
+
[
|
|
777
|
+
_ctx.horizontal ? (vue.openBlock(), vue.createElementBlock(
|
|
778
|
+
"div",
|
|
779
|
+
{
|
|
780
|
+
key: 0,
|
|
781
|
+
class: vue.normalizeClass(["field-label", [_ctx.customClass, _ctx.fieldLabelSize]])
|
|
782
|
+
},
|
|
783
|
+
[
|
|
784
|
+
_ctx.hasLabel ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
785
|
+
key: 0,
|
|
786
|
+
for: _ctx.labelFor,
|
|
787
|
+
class: vue.normalizeClass([_ctx.customClass, "label"])
|
|
788
|
+
}, [
|
|
789
|
+
_ctx.$slots.label ? vue.renderSlot(_ctx.$slots, "label", { key: 0 }) : (vue.openBlock(), vue.createElementBlock(
|
|
790
|
+
vue.Fragment,
|
|
791
|
+
{ key: 1 },
|
|
792
|
+
[
|
|
793
|
+
vue.createTextVNode(
|
|
794
|
+
vue.toDisplayString(_ctx.label),
|
|
795
|
+
1
|
|
796
|
+
/* TEXT */
|
|
797
|
+
)
|
|
798
|
+
],
|
|
799
|
+
64
|
|
800
|
+
/* STABLE_FRAGMENT */
|
|
801
|
+
))
|
|
802
|
+
], 10, _hoisted_1$8)) : vue.createCommentVNode("v-if", true)
|
|
803
|
+
],
|
|
804
|
+
2
|
|
805
|
+
/* CLASS */
|
|
806
|
+
)) : (vue.openBlock(), vue.createElementBlock(
|
|
807
|
+
vue.Fragment,
|
|
808
|
+
{ key: 1 },
|
|
809
|
+
[
|
|
810
|
+
_ctx.hasLabel ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
811
|
+
key: 0,
|
|
812
|
+
for: _ctx.labelFor,
|
|
813
|
+
class: vue.normalizeClass([_ctx.customClass, "label"])
|
|
814
|
+
}, [
|
|
815
|
+
_ctx.$slots.label ? vue.renderSlot(_ctx.$slots, "label", { key: 0 }) : (vue.openBlock(), vue.createElementBlock(
|
|
816
|
+
vue.Fragment,
|
|
817
|
+
{ key: 1 },
|
|
818
|
+
[
|
|
819
|
+
vue.createTextVNode(
|
|
820
|
+
vue.toDisplayString(_ctx.label),
|
|
821
|
+
1
|
|
822
|
+
/* TEXT */
|
|
823
|
+
)
|
|
824
|
+
],
|
|
825
|
+
64
|
|
826
|
+
/* STABLE_FRAGMENT */
|
|
827
|
+
))
|
|
828
|
+
], 10, _hoisted_2$6)) : vue.createCommentVNode("v-if", true)
|
|
829
|
+
],
|
|
830
|
+
64
|
|
831
|
+
/* STABLE_FRAGMENT */
|
|
832
|
+
)),
|
|
833
|
+
_ctx.horizontal ? (vue.openBlock(), vue.createBlock(_component_b_field_body, {
|
|
834
|
+
key: 2,
|
|
835
|
+
message: _ctx.newMessage ? _ctx.formattedMessage : "",
|
|
836
|
+
type: _ctx.newType
|
|
837
|
+
}, {
|
|
838
|
+
default: vue.withCtx(() => [
|
|
839
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
840
|
+
]),
|
|
841
|
+
_: 3
|
|
842
|
+
/* FORWARDED */
|
|
843
|
+
}, 8, ["message", "type"])) : _ctx.hasInnerField ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
|
|
844
|
+
vue.createVNode(_component_b_field, {
|
|
845
|
+
addons: false,
|
|
846
|
+
type: _ctx.type,
|
|
847
|
+
class: vue.normalizeClass(_ctx.innerFieldClasses)
|
|
848
|
+
}, {
|
|
849
|
+
default: vue.withCtx(() => [
|
|
850
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
851
|
+
]),
|
|
852
|
+
_: 3
|
|
853
|
+
/* FORWARDED */
|
|
854
|
+
}, 8, ["type", "class"])
|
|
855
|
+
])) : vue.renderSlot(_ctx.$slots, "default", { key: 4 }),
|
|
856
|
+
_ctx.hasMessage && !_ctx.horizontal ? (vue.openBlock(), vue.createElementBlock(
|
|
857
|
+
"p",
|
|
858
|
+
{
|
|
859
|
+
key: 5,
|
|
860
|
+
class: vue.normalizeClass(["help", _ctx.newType])
|
|
861
|
+
},
|
|
862
|
+
[
|
|
863
|
+
_ctx.$slots.message ? vue.renderSlot(_ctx.$slots, "message", {
|
|
864
|
+
key: 0,
|
|
865
|
+
messages: _ctx.formattedMessage
|
|
866
|
+
}) : (vue.openBlock(true), vue.createElementBlock(
|
|
867
|
+
vue.Fragment,
|
|
868
|
+
{ key: 1 },
|
|
869
|
+
vue.renderList(_ctx.formattedMessage, (mess, i) => {
|
|
870
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
871
|
+
vue.Fragment,
|
|
872
|
+
null,
|
|
873
|
+
[
|
|
874
|
+
vue.createTextVNode(
|
|
875
|
+
vue.toDisplayString(mess) + " ",
|
|
876
|
+
1
|
|
877
|
+
/* TEXT */
|
|
878
|
+
),
|
|
879
|
+
i + 1 < _ctx.formattedMessage.length ? (vue.openBlock(), vue.createElementBlock("br", { key: i })) : vue.createCommentVNode("v-if", true)
|
|
880
|
+
],
|
|
881
|
+
64
|
|
882
|
+
/* STABLE_FRAGMENT */
|
|
883
|
+
);
|
|
884
|
+
}),
|
|
885
|
+
256
|
|
886
|
+
/* UNKEYED_FRAGMENT */
|
|
887
|
+
))
|
|
888
|
+
],
|
|
889
|
+
2
|
|
890
|
+
/* CLASS */
|
|
891
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
892
|
+
],
|
|
893
|
+
2
|
|
894
|
+
/* CLASS */
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
var BField = /* @__PURE__ */ _export_sfc(Field, [["render", _sfc_render$a]]);
|
|
898
|
+
|
|
899
|
+
const FormElementMixin = vue.defineComponent({
|
|
900
|
+
props: {
|
|
901
|
+
size: String,
|
|
902
|
+
expanded: Boolean,
|
|
903
|
+
loading: Boolean,
|
|
904
|
+
rounded: Boolean,
|
|
905
|
+
icon: String,
|
|
906
|
+
iconPack: String,
|
|
907
|
+
maxlength: [Number, String],
|
|
908
|
+
useHtml5Validation: {
|
|
909
|
+
type: Boolean,
|
|
910
|
+
default: () => config.defaultUseHtml5Validation
|
|
911
|
+
},
|
|
912
|
+
validationMessage: String,
|
|
913
|
+
locale: {
|
|
914
|
+
type: [String, Array],
|
|
915
|
+
default: () => {
|
|
916
|
+
return config.defaultLocale;
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
statusIcon: {
|
|
920
|
+
type: Boolean,
|
|
921
|
+
default: () => {
|
|
922
|
+
return config.defaultStatusIcon;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
emits: {
|
|
927
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
928
|
+
blur: (event) => true,
|
|
929
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
930
|
+
focus: (event) => true
|
|
931
|
+
},
|
|
932
|
+
data() {
|
|
933
|
+
return {
|
|
934
|
+
isValid: true,
|
|
935
|
+
isFocused: false,
|
|
936
|
+
newIconPack: this.iconPack || config.defaultIconPack,
|
|
937
|
+
// host component must override this
|
|
938
|
+
_elementRef: ""
|
|
939
|
+
};
|
|
940
|
+
},
|
|
941
|
+
computed: {
|
|
942
|
+
/*
|
|
943
|
+
* Find parent Field, max 3 levels deep.
|
|
944
|
+
*/
|
|
945
|
+
parentField() {
|
|
946
|
+
let parent = this.$parent;
|
|
947
|
+
for (let i = 0; i < 3; i++) {
|
|
948
|
+
if (parent && !parent.$data._isField) {
|
|
949
|
+
parent = parent.$parent;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
return parent;
|
|
953
|
+
},
|
|
954
|
+
/*
|
|
955
|
+
* Get the type prop from parent if it's a Field.
|
|
956
|
+
*/
|
|
957
|
+
statusType() {
|
|
958
|
+
const { newType } = this.parentField || {};
|
|
959
|
+
if (!newType) return;
|
|
960
|
+
if (typeof newType === "string") {
|
|
961
|
+
return newType;
|
|
962
|
+
} else {
|
|
963
|
+
for (const key in newType) {
|
|
964
|
+
if (newType[key]) {
|
|
965
|
+
return key;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
return void 0;
|
|
970
|
+
},
|
|
971
|
+
/*
|
|
972
|
+
* Get the message prop from parent if it's a Field.
|
|
973
|
+
*/
|
|
974
|
+
statusMessage() {
|
|
975
|
+
if (!this.parentField) return;
|
|
976
|
+
return this.parentField.newMessage || this.parentField.$slots.message;
|
|
977
|
+
},
|
|
978
|
+
/*
|
|
979
|
+
* Fix icon size for inputs, large was too big
|
|
980
|
+
*/
|
|
981
|
+
iconSize() {
|
|
982
|
+
switch (this.size) {
|
|
983
|
+
case "is-small":
|
|
984
|
+
return this.size;
|
|
985
|
+
case "is-medium":
|
|
986
|
+
return;
|
|
987
|
+
case "is-large":
|
|
988
|
+
return this.newIconPack === "mdi" ? "is-medium" : "";
|
|
989
|
+
}
|
|
990
|
+
return void 0;
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
methods: {
|
|
994
|
+
/*
|
|
995
|
+
* Focus method that work dynamically depending on the component.
|
|
996
|
+
*/
|
|
997
|
+
focus() {
|
|
998
|
+
const el = this.getElement();
|
|
999
|
+
if (el === void 0) return;
|
|
1000
|
+
this.$nextTick(() => {
|
|
1001
|
+
if (el) el.focus();
|
|
1002
|
+
});
|
|
1003
|
+
},
|
|
1004
|
+
onBlur($event) {
|
|
1005
|
+
this.isFocused = false;
|
|
1006
|
+
this.$emit("blur", $event);
|
|
1007
|
+
this.checkHtml5Validity();
|
|
1008
|
+
},
|
|
1009
|
+
onFocus($event) {
|
|
1010
|
+
this.isFocused = true;
|
|
1011
|
+
this.$emit("focus", $event);
|
|
1012
|
+
},
|
|
1013
|
+
getElement() {
|
|
1014
|
+
let el = this.$refs[this.$data._elementRef];
|
|
1015
|
+
while (el != null && typeof el === "object" && "$refs" in el) {
|
|
1016
|
+
const form = el;
|
|
1017
|
+
el = form.$refs[form.$data._elementRef];
|
|
1018
|
+
}
|
|
1019
|
+
return el;
|
|
1020
|
+
},
|
|
1021
|
+
setInvalid() {
|
|
1022
|
+
const type = "is-danger";
|
|
1023
|
+
const message = this.validationMessage || this.getElement().validationMessage;
|
|
1024
|
+
this.setValidity(type, message);
|
|
1025
|
+
},
|
|
1026
|
+
setValidity(type, message) {
|
|
1027
|
+
this.$nextTick(() => {
|
|
1028
|
+
if (this.parentField) {
|
|
1029
|
+
if (!this.parentField.type) {
|
|
1030
|
+
this.parentField.newType = type;
|
|
1031
|
+
}
|
|
1032
|
+
if (!this.parentField.message) {
|
|
1033
|
+
this.parentField.newMessage = message;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
},
|
|
1038
|
+
/*
|
|
1039
|
+
* Check HTML5 validation, set isValid property.
|
|
1040
|
+
* If validation fail, send 'is-danger' type,
|
|
1041
|
+
* and error message to parent if it's a Field.
|
|
1042
|
+
*/
|
|
1043
|
+
checkHtml5Validity() {
|
|
1044
|
+
if (!this.useHtml5Validation) {
|
|
1045
|
+
return false;
|
|
1046
|
+
}
|
|
1047
|
+
const el = this.getElement();
|
|
1048
|
+
if (el == null) {
|
|
1049
|
+
return false;
|
|
1050
|
+
}
|
|
1051
|
+
if (!el.checkValidity()) {
|
|
1052
|
+
this.setInvalid();
|
|
1053
|
+
this.isValid = false;
|
|
1054
|
+
} else {
|
|
1055
|
+
this.setValidity(null, null);
|
|
1056
|
+
this.isValid = true;
|
|
1057
|
+
}
|
|
1058
|
+
return this.isValid;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
const mdiIcons = {
|
|
1064
|
+
sizes: {
|
|
1065
|
+
default: "mdi-24px",
|
|
1066
|
+
"is-small": null,
|
|
1067
|
+
"is-medium": "mdi-36px",
|
|
1068
|
+
"is-large": "mdi-48px"
|
|
1069
|
+
},
|
|
1070
|
+
iconPrefix: "mdi-"
|
|
1071
|
+
};
|
|
1072
|
+
const faIcons = () => {
|
|
1073
|
+
const faIconPrefix = "fa-";
|
|
1074
|
+
return {
|
|
1075
|
+
sizes: {
|
|
1076
|
+
default: null,
|
|
1077
|
+
"is-small": null,
|
|
1078
|
+
"is-medium": faIconPrefix + "lg",
|
|
1079
|
+
"is-large": faIconPrefix + "2x"
|
|
1080
|
+
},
|
|
1081
|
+
iconPrefix: faIconPrefix,
|
|
1082
|
+
internalIcons: {
|
|
1083
|
+
information: "info-circle",
|
|
1084
|
+
alert: "exclamation-triangle",
|
|
1085
|
+
"alert-circle": "exclamation-circle",
|
|
1086
|
+
"chevron-right": "angle-right",
|
|
1087
|
+
"chevron-left": "angle-left",
|
|
1088
|
+
"chevron-down": "angle-down",
|
|
1089
|
+
"eye-off": "eye-slash",
|
|
1090
|
+
"menu-down": "caret-down",
|
|
1091
|
+
"menu-up": "caret-up",
|
|
1092
|
+
"close-circle": "times-circle"
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
const getIcons = () => {
|
|
1097
|
+
let icons = {
|
|
1098
|
+
mdi: mdiIcons,
|
|
1099
|
+
fa: faIcons(),
|
|
1100
|
+
fas: faIcons(),
|
|
1101
|
+
far: faIcons(),
|
|
1102
|
+
fad: faIcons(),
|
|
1103
|
+
fab: faIcons(),
|
|
1104
|
+
fal: faIcons(),
|
|
1105
|
+
"fa-solid": faIcons(),
|
|
1106
|
+
"fa-regular": faIcons(),
|
|
1107
|
+
"fa-light": faIcons(),
|
|
1108
|
+
"fa-thin": faIcons(),
|
|
1109
|
+
"fa-duotone": faIcons(),
|
|
1110
|
+
"fa-brands": faIcons()
|
|
1111
|
+
};
|
|
1112
|
+
return icons;
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
var _sfc_main$9 = vue.defineComponent({
|
|
1116
|
+
name: "BIcon",
|
|
1117
|
+
props: {
|
|
1118
|
+
type: [String, Object],
|
|
1119
|
+
component: String,
|
|
1120
|
+
pack: String,
|
|
1121
|
+
icon: {
|
|
1122
|
+
type: String,
|
|
1123
|
+
required: true
|
|
1124
|
+
},
|
|
1125
|
+
size: String,
|
|
1126
|
+
customSize: String,
|
|
1127
|
+
customClass: String,
|
|
1128
|
+
both: Boolean
|
|
1129
|
+
// This is used internally to show both MDI and FA icon
|
|
1130
|
+
},
|
|
1131
|
+
computed: {
|
|
1132
|
+
iconConfig() {
|
|
1133
|
+
const allIcons = getIcons();
|
|
1134
|
+
return allIcons[this.newPack];
|
|
1135
|
+
},
|
|
1136
|
+
iconPrefix() {
|
|
1137
|
+
if (this.iconConfig && this.iconConfig.iconPrefix) {
|
|
1138
|
+
return this.iconConfig.iconPrefix;
|
|
1139
|
+
}
|
|
1140
|
+
return "";
|
|
1141
|
+
},
|
|
1142
|
+
/*
|
|
1143
|
+
* Internal icon name based on the pack.
|
|
1144
|
+
* If pack is 'fa', gets the equivalent FA icon name of the MDI,
|
|
1145
|
+
* internal icons are always MDI.
|
|
1146
|
+
*/
|
|
1147
|
+
newIcon() {
|
|
1148
|
+
return `${this.iconPrefix}${this.getEquivalentIconOf(this.icon)}`;
|
|
1149
|
+
},
|
|
1150
|
+
newPack() {
|
|
1151
|
+
return this.pack || config.defaultIconPack;
|
|
1152
|
+
},
|
|
1153
|
+
newType() {
|
|
1154
|
+
if (!this.type) return;
|
|
1155
|
+
let splitType = [];
|
|
1156
|
+
if (typeof this.type === "string") {
|
|
1157
|
+
splitType = this.type.split("-");
|
|
1158
|
+
} else {
|
|
1159
|
+
for (const key in this.type) {
|
|
1160
|
+
if (this.type[key]) {
|
|
1161
|
+
splitType = key.split("-");
|
|
1162
|
+
break;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
if (splitType.length <= 1) return;
|
|
1167
|
+
const [, ...type] = splitType;
|
|
1168
|
+
return `has-text-${type.join("-")}`;
|
|
1169
|
+
},
|
|
1170
|
+
newCustomSize() {
|
|
1171
|
+
return this.customSize || this.customSizeByPack;
|
|
1172
|
+
},
|
|
1173
|
+
customSizeByPack() {
|
|
1174
|
+
if (this.iconConfig && this.iconConfig.sizes) {
|
|
1175
|
+
if (this.size && this.iconConfig.sizes[this.size] !== void 0) {
|
|
1176
|
+
return this.iconConfig.sizes[this.size];
|
|
1177
|
+
} else if (this.iconConfig.sizes.default) {
|
|
1178
|
+
return this.iconConfig.sizes.default;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
return null;
|
|
1182
|
+
},
|
|
1183
|
+
useIconComponent() {
|
|
1184
|
+
return this.component || config.defaultIconComponent;
|
|
1185
|
+
}
|
|
1186
|
+
},
|
|
1187
|
+
methods: {
|
|
1188
|
+
/*
|
|
1189
|
+
* Equivalent icon name of the MDI.
|
|
1190
|
+
*/
|
|
1191
|
+
getEquivalentIconOf(value) {
|
|
1192
|
+
if (!this.both) {
|
|
1193
|
+
return value;
|
|
1194
|
+
}
|
|
1195
|
+
if (this.iconConfig == null) {
|
|
1196
|
+
return value;
|
|
1197
|
+
}
|
|
1198
|
+
const maybeInternal = this.iconConfig;
|
|
1199
|
+
if (maybeInternal && maybeInternal.internalIcons && maybeInternal.internalIcons[value]) {
|
|
1200
|
+
return maybeInternal.internalIcons[value];
|
|
1201
|
+
}
|
|
1202
|
+
return value;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
|
|
1207
|
+
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1208
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
1209
|
+
"span",
|
|
1210
|
+
{
|
|
1211
|
+
class: vue.normalizeClass(["icon", [_ctx.newType, _ctx.size]])
|
|
1212
|
+
},
|
|
1213
|
+
[
|
|
1214
|
+
!_ctx.useIconComponent ? (vue.openBlock(), vue.createElementBlock(
|
|
1215
|
+
"i",
|
|
1216
|
+
{
|
|
1217
|
+
key: 0,
|
|
1218
|
+
class: vue.normalizeClass([_ctx.newPack, _ctx.newIcon, _ctx.newCustomSize, _ctx.customClass])
|
|
1219
|
+
},
|
|
1220
|
+
null,
|
|
1221
|
+
2
|
|
1222
|
+
/* CLASS */
|
|
1223
|
+
)) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.useIconComponent), {
|
|
1224
|
+
key: 1,
|
|
1225
|
+
icon: [_ctx.newPack, _ctx.newIcon],
|
|
1226
|
+
size: _ctx.newCustomSize,
|
|
1227
|
+
class: vue.normalizeClass([_ctx.customClass])
|
|
1228
|
+
}, null, 8, ["icon", "size", "class"]))
|
|
1229
|
+
],
|
|
1230
|
+
2
|
|
1231
|
+
/* CLASS */
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
var BIcon = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
|
|
1235
|
+
|
|
1236
|
+
const NATIVE_TYPES = [
|
|
1237
|
+
"button",
|
|
1238
|
+
"submit",
|
|
1239
|
+
"reset"
|
|
1240
|
+
];
|
|
1241
|
+
var _sfc_main$8 = vue.defineComponent({
|
|
1242
|
+
name: "BButton",
|
|
1243
|
+
components: { BIcon },
|
|
1244
|
+
inheritAttrs: false,
|
|
1245
|
+
props: {
|
|
1246
|
+
type: [String, Object],
|
|
1247
|
+
size: String,
|
|
1248
|
+
label: String,
|
|
1249
|
+
iconPack: String,
|
|
1250
|
+
iconLeft: String,
|
|
1251
|
+
iconRight: String,
|
|
1252
|
+
rounded: {
|
|
1253
|
+
type: Boolean,
|
|
1254
|
+
default: () => {
|
|
1255
|
+
return config.defaultButtonRounded;
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
loading: Boolean,
|
|
1259
|
+
outlined: Boolean,
|
|
1260
|
+
expanded: Boolean,
|
|
1261
|
+
inverted: Boolean,
|
|
1262
|
+
focused: Boolean,
|
|
1263
|
+
active: Boolean,
|
|
1264
|
+
hovered: Boolean,
|
|
1265
|
+
selected: Boolean,
|
|
1266
|
+
nativeType: {
|
|
1267
|
+
type: String,
|
|
1268
|
+
default: "button",
|
|
1269
|
+
validator: (value) => {
|
|
1270
|
+
return NATIVE_TYPES.indexOf(value) >= 0;
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1273
|
+
tag: {
|
|
1274
|
+
type: [String, Object],
|
|
1275
|
+
default: "button",
|
|
1276
|
+
validator: (value) => {
|
|
1277
|
+
return typeof value === "object" || config.defaultLinkTags.indexOf(value) >= 0;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
},
|
|
1281
|
+
computed: {
|
|
1282
|
+
computedTag() {
|
|
1283
|
+
if (this.$attrs.disabled !== void 0 && this.$attrs.disabled !== false) {
|
|
1284
|
+
return "button";
|
|
1285
|
+
}
|
|
1286
|
+
return this.tag;
|
|
1287
|
+
},
|
|
1288
|
+
iconSize() {
|
|
1289
|
+
if (!this.size || this.size === "is-medium") {
|
|
1290
|
+
return "is-small";
|
|
1291
|
+
} else if (this.size === "is-large") {
|
|
1292
|
+
return "is-medium";
|
|
1293
|
+
}
|
|
1294
|
+
return this.size;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
const _hoisted_1$7 = { key: 1 };
|
|
1300
|
+
const _hoisted_2$5 = { key: 2 };
|
|
1301
|
+
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1302
|
+
const _component_b_icon = vue.resolveComponent("b-icon");
|
|
1303
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.computedTag), vue.mergeProps({ class: "button" }, _ctx.$attrs, {
|
|
1304
|
+
type: typeof _ctx.computedTag === "string" && ["button", "input"].includes(_ctx.computedTag) ? _ctx.nativeType : void 0,
|
|
1305
|
+
class: [_ctx.size, _ctx.type, {
|
|
1306
|
+
"is-rounded": _ctx.rounded,
|
|
1307
|
+
"is-loading": _ctx.loading,
|
|
1308
|
+
"is-outlined": _ctx.outlined,
|
|
1309
|
+
"is-fullwidth": _ctx.expanded,
|
|
1310
|
+
"is-inverted": _ctx.inverted,
|
|
1311
|
+
"is-focused": _ctx.focused,
|
|
1312
|
+
"is-active": _ctx.active,
|
|
1313
|
+
"is-hovered": _ctx.hovered,
|
|
1314
|
+
"is-selected": _ctx.selected
|
|
1315
|
+
}]
|
|
1316
|
+
}), {
|
|
1317
|
+
default: vue.withCtx(() => [
|
|
1318
|
+
_ctx.iconLeft ? (vue.openBlock(), vue.createBlock(_component_b_icon, {
|
|
1319
|
+
key: 0,
|
|
1320
|
+
pack: _ctx.iconPack,
|
|
1321
|
+
icon: _ctx.iconLeft,
|
|
1322
|
+
size: _ctx.iconSize
|
|
1323
|
+
}, null, 8, ["pack", "icon", "size"])) : vue.createCommentVNode("v-if", true),
|
|
1324
|
+
_ctx.label ? (vue.openBlock(), vue.createElementBlock(
|
|
1325
|
+
"span",
|
|
1326
|
+
_hoisted_1$7,
|
|
1327
|
+
vue.toDisplayString(_ctx.label),
|
|
1328
|
+
1
|
|
1329
|
+
/* TEXT */
|
|
1330
|
+
)) : _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$5, [
|
|
1331
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
1332
|
+
])) : vue.createCommentVNode("v-if", true),
|
|
1333
|
+
_ctx.iconRight ? (vue.openBlock(), vue.createBlock(_component_b_icon, {
|
|
1334
|
+
key: 3,
|
|
1335
|
+
pack: _ctx.iconPack,
|
|
1336
|
+
icon: _ctx.iconRight,
|
|
1337
|
+
size: _ctx.iconSize
|
|
1338
|
+
}, null, 8, ["pack", "icon", "size"])) : vue.createCommentVNode("v-if", true)
|
|
1339
|
+
]),
|
|
1340
|
+
_: 3
|
|
1341
|
+
/* FORWARDED */
|
|
1342
|
+
}, 16, ["type", "class"]);
|
|
1343
|
+
}
|
|
1344
|
+
var BButton = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
|
|
1345
|
+
|
|
1346
|
+
const findFocusable = (element, programmatic = false) => {
|
|
1347
|
+
if (!element) {
|
|
1348
|
+
return null;
|
|
1349
|
+
}
|
|
1350
|
+
if (programmatic) {
|
|
1351
|
+
return element.querySelectorAll('*[tabindex="-1"]');
|
|
1352
|
+
}
|
|
1353
|
+
return element.querySelectorAll(`a[href]:not([tabindex="-1"]),
|
|
1354
|
+
area[href],
|
|
1355
|
+
input:not([disabled]),
|
|
1356
|
+
select:not([disabled]),
|
|
1357
|
+
textarea:not([disabled]),
|
|
1358
|
+
button:not([disabled]),
|
|
1359
|
+
iframe,
|
|
1360
|
+
object,
|
|
1361
|
+
embed,
|
|
1362
|
+
*[tabindex]:not([tabindex="-1"]),
|
|
1363
|
+
*[contenteditable]`);
|
|
1364
|
+
};
|
|
1365
|
+
let onKeyDown;
|
|
1366
|
+
const beforeMount = (el, { value = true }) => {
|
|
1367
|
+
if (value) {
|
|
1368
|
+
let focusable = findFocusable(el);
|
|
1369
|
+
let focusableProg = findFocusable(el, true);
|
|
1370
|
+
if (focusable && focusable.length > 0) {
|
|
1371
|
+
onKeyDown = (event) => {
|
|
1372
|
+
focusable = findFocusable(el);
|
|
1373
|
+
focusableProg = findFocusable(el, true);
|
|
1374
|
+
const firstFocusable = focusable[0];
|
|
1375
|
+
const lastFocusable = focusable[focusable.length - 1];
|
|
1376
|
+
if (event.target === firstFocusable && event.shiftKey && event.key === "Tab") {
|
|
1377
|
+
event.preventDefault();
|
|
1378
|
+
lastFocusable.focus();
|
|
1379
|
+
} else if ((event.target === lastFocusable || Array.from(focusableProg).indexOf(event.target) >= 0) && !event.shiftKey && event.key === "Tab") {
|
|
1380
|
+
event.preventDefault();
|
|
1381
|
+
firstFocusable.focus();
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
el.addEventListener("keydown", onKeyDown);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
const unmounted = (el) => {
|
|
1389
|
+
el.removeEventListener("keydown", onKeyDown);
|
|
1390
|
+
};
|
|
1391
|
+
const directive = {
|
|
1392
|
+
beforeMount,
|
|
1393
|
+
unmounted
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
const DEFAULT_CLOSE_OPTIONS = ["escape", "outside"];
|
|
1397
|
+
const DROPDOWN_INJECTION_KEY = Symbol("bdropdown");
|
|
1398
|
+
var _sfc_main$7 = vue.defineComponent({
|
|
1399
|
+
name: "BDropdown",
|
|
1400
|
+
directives: {
|
|
1401
|
+
trapFocus: directive
|
|
1402
|
+
},
|
|
1403
|
+
provide() {
|
|
1404
|
+
return {
|
|
1405
|
+
[DROPDOWN_INJECTION_KEY]: this
|
|
1406
|
+
};
|
|
1407
|
+
},
|
|
1408
|
+
props: {
|
|
1409
|
+
modelValue: {
|
|
1410
|
+
type: [
|
|
1411
|
+
String,
|
|
1412
|
+
Number,
|
|
1413
|
+
Boolean,
|
|
1414
|
+
Object,
|
|
1415
|
+
Array,
|
|
1416
|
+
Function
|
|
1417
|
+
],
|
|
1418
|
+
default: null
|
|
1419
|
+
},
|
|
1420
|
+
disabled: Boolean,
|
|
1421
|
+
inline: Boolean,
|
|
1422
|
+
scrollable: Boolean,
|
|
1423
|
+
maxHeight: {
|
|
1424
|
+
type: [String, Number],
|
|
1425
|
+
default: 200
|
|
1426
|
+
},
|
|
1427
|
+
position: {
|
|
1428
|
+
type: String,
|
|
1429
|
+
validator(value) {
|
|
1430
|
+
return [
|
|
1431
|
+
"is-top-right",
|
|
1432
|
+
"is-top-left",
|
|
1433
|
+
"is-bottom-left",
|
|
1434
|
+
"is-bottom-right"
|
|
1435
|
+
].indexOf(value) > -1;
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
triggers: {
|
|
1439
|
+
type: Array,
|
|
1440
|
+
default: () => ["click"]
|
|
1441
|
+
},
|
|
1442
|
+
mobileModal: {
|
|
1443
|
+
type: Boolean,
|
|
1444
|
+
default: () => {
|
|
1445
|
+
return config.defaultDropdownMobileModal;
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
ariaRole: {
|
|
1449
|
+
type: String,
|
|
1450
|
+
validator(value) {
|
|
1451
|
+
return [
|
|
1452
|
+
"menu",
|
|
1453
|
+
"list",
|
|
1454
|
+
"dialog"
|
|
1455
|
+
].indexOf(value) > -1;
|
|
1456
|
+
},
|
|
1457
|
+
default: null
|
|
1458
|
+
},
|
|
1459
|
+
animation: {
|
|
1460
|
+
type: String,
|
|
1461
|
+
default: "fade"
|
|
1462
|
+
},
|
|
1463
|
+
multiple: Boolean,
|
|
1464
|
+
trapFocus: {
|
|
1465
|
+
type: Boolean,
|
|
1466
|
+
default: () => {
|
|
1467
|
+
return config.defaultTrapFocus;
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
closeOnClick: {
|
|
1471
|
+
type: Boolean,
|
|
1472
|
+
default: true
|
|
1473
|
+
},
|
|
1474
|
+
canClose: {
|
|
1475
|
+
type: [Array, Boolean],
|
|
1476
|
+
default: true
|
|
1477
|
+
},
|
|
1478
|
+
expanded: Boolean,
|
|
1479
|
+
appendToBody: Boolean,
|
|
1480
|
+
appendToBodyCopyParent: Boolean,
|
|
1481
|
+
triggerTabindex: {
|
|
1482
|
+
type: Number,
|
|
1483
|
+
default: 0
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
emits: {
|
|
1487
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1488
|
+
"active-change": (_isActive) => true,
|
|
1489
|
+
change: (_selected) => true,
|
|
1490
|
+
"update:modelValue": (_value) => true
|
|
1491
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1492
|
+
},
|
|
1493
|
+
data() {
|
|
1494
|
+
return {
|
|
1495
|
+
selected: this.modelValue,
|
|
1496
|
+
style: {},
|
|
1497
|
+
isActive: false,
|
|
1498
|
+
isHoverable: false,
|
|
1499
|
+
maybeTap: false,
|
|
1500
|
+
isTouchEnabled: false,
|
|
1501
|
+
_bodyEl: void 0,
|
|
1502
|
+
// Used to append to body
|
|
1503
|
+
timeOutID: void 0,
|
|
1504
|
+
timeOutID2: void 0
|
|
1505
|
+
};
|
|
1506
|
+
},
|
|
1507
|
+
computed: {
|
|
1508
|
+
rootClasses() {
|
|
1509
|
+
return [this.position, {
|
|
1510
|
+
"is-disabled": this.disabled,
|
|
1511
|
+
"is-hoverable": this.hoverable,
|
|
1512
|
+
"is-inline": this.inline,
|
|
1513
|
+
"is-active": this.isActive || this.inline,
|
|
1514
|
+
"is-mobile-modal": this.isMobileModal,
|
|
1515
|
+
"is-expanded": this.expanded,
|
|
1516
|
+
"is-touch-enabled": this.isTouchEnabled
|
|
1517
|
+
}];
|
|
1518
|
+
},
|
|
1519
|
+
isMobileModal() {
|
|
1520
|
+
return this.mobileModal && !this.inline;
|
|
1521
|
+
},
|
|
1522
|
+
cancelOptions() {
|
|
1523
|
+
return typeof this.canClose === "boolean" ? this.canClose ? DEFAULT_CLOSE_OPTIONS : [] : this.canClose;
|
|
1524
|
+
},
|
|
1525
|
+
contentStyle() {
|
|
1526
|
+
var _a;
|
|
1527
|
+
return {
|
|
1528
|
+
maxHeight: this.scrollable ? (_a = toCssWidth(this.maxHeight)) != null ? _a : void 0 : void 0,
|
|
1529
|
+
overflow: this.scrollable ? "auto" : void 0
|
|
1530
|
+
};
|
|
1531
|
+
},
|
|
1532
|
+
hoverable() {
|
|
1533
|
+
return this.triggers.indexOf("hover") >= 0;
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
watch: {
|
|
1537
|
+
/*
|
|
1538
|
+
* When v-model is changed set the new selected item.
|
|
1539
|
+
*/
|
|
1540
|
+
modelValue(value) {
|
|
1541
|
+
this.selected = value;
|
|
1542
|
+
},
|
|
1543
|
+
/*
|
|
1544
|
+
* Emit event when isActive value is changed.
|
|
1545
|
+
*
|
|
1546
|
+
* Also resets `isTouchEnabled` when it turns inactive.
|
|
1547
|
+
*/
|
|
1548
|
+
isActive(value) {
|
|
1549
|
+
this.$emit("active-change", value);
|
|
1550
|
+
if (!value) {
|
|
1551
|
+
this.timeOutID = setTimeout(() => {
|
|
1552
|
+
if (!this.isActive) {
|
|
1553
|
+
this.isTouchEnabled = false;
|
|
1554
|
+
}
|
|
1555
|
+
}, 250);
|
|
1556
|
+
}
|
|
1557
|
+
this.handleScroll();
|
|
1558
|
+
if (this.appendToBody) {
|
|
1559
|
+
this.$nextTick(() => {
|
|
1560
|
+
this.updateAppendToBody();
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
isHoverable(value) {
|
|
1565
|
+
if (this.hoverable) {
|
|
1566
|
+
this.$emit("active-change", value);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
},
|
|
1570
|
+
methods: {
|
|
1571
|
+
handleScroll() {
|
|
1572
|
+
if (typeof window === "undefined") return;
|
|
1573
|
+
if (this.isMobileModal) {
|
|
1574
|
+
if (this.isActive) {
|
|
1575
|
+
document.documentElement.classList.add("is-clipped-touch");
|
|
1576
|
+
} else {
|
|
1577
|
+
document.documentElement.classList.remove("is-clipped-touch");
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
},
|
|
1581
|
+
/*
|
|
1582
|
+
* Click listener from DropdownItem.
|
|
1583
|
+
* 1. Set new selected item.
|
|
1584
|
+
* 2. Emit input event to update the user v-model.
|
|
1585
|
+
* 3. Close the dropdown.
|
|
1586
|
+
*/
|
|
1587
|
+
selectItem(value) {
|
|
1588
|
+
if (this.multiple) {
|
|
1589
|
+
if (this.selected) {
|
|
1590
|
+
const selected = this.selected;
|
|
1591
|
+
if (selected.indexOf(value) === -1) {
|
|
1592
|
+
this.selected = [...selected, value];
|
|
1593
|
+
} else {
|
|
1594
|
+
this.selected = selected.filter((val) => val !== value);
|
|
1595
|
+
}
|
|
1596
|
+
} else {
|
|
1597
|
+
this.selected = [value];
|
|
1598
|
+
}
|
|
1599
|
+
this.$emit("change", this.selected);
|
|
1600
|
+
} else {
|
|
1601
|
+
if (this.selected !== value) {
|
|
1602
|
+
this.selected = value;
|
|
1603
|
+
this.$emit("change", this.selected);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
this.$emit("update:modelValue", this.selected);
|
|
1607
|
+
if (!this.multiple) {
|
|
1608
|
+
this.isActive = !this.closeOnClick;
|
|
1609
|
+
if (this.hoverable && this.closeOnClick) {
|
|
1610
|
+
this.isHoverable = false;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
/*
|
|
1615
|
+
* White-listed items to not close when clicked.
|
|
1616
|
+
*/
|
|
1617
|
+
isInWhiteList(el) {
|
|
1618
|
+
if (el === this.$refs.dropdownMenu) return true;
|
|
1619
|
+
if (el === this.$refs.trigger) return true;
|
|
1620
|
+
if (this.$refs.dropdownMenu != null) {
|
|
1621
|
+
const children = this.$refs.dropdownMenu.querySelectorAll("*");
|
|
1622
|
+
for (const child of children) {
|
|
1623
|
+
if (el === child) {
|
|
1624
|
+
return true;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
if (this.$refs.trigger != null) {
|
|
1629
|
+
const children = this.$refs.trigger.querySelectorAll("*");
|
|
1630
|
+
for (const child of children) {
|
|
1631
|
+
if (el === child) {
|
|
1632
|
+
return true;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
return false;
|
|
1637
|
+
},
|
|
1638
|
+
/*
|
|
1639
|
+
* Close dropdown if clicked outside.
|
|
1640
|
+
*/
|
|
1641
|
+
clickedOutside(event) {
|
|
1642
|
+
if (this.cancelOptions.indexOf("outside") < 0) return;
|
|
1643
|
+
if (this.inline) return;
|
|
1644
|
+
const target = isCustomElement(this) ? event.composedPath()[0] : event.target;
|
|
1645
|
+
if (!this.isInWhiteList(target)) this.isActive = false;
|
|
1646
|
+
},
|
|
1647
|
+
/*
|
|
1648
|
+
* Keypress event that is bound to the document
|
|
1649
|
+
*/
|
|
1650
|
+
keyPress({ key }) {
|
|
1651
|
+
if (this.isActive && (key === "Escape" || key === "Esc")) {
|
|
1652
|
+
if (this.cancelOptions.indexOf("escape") < 0) return;
|
|
1653
|
+
this.isActive = false;
|
|
1654
|
+
}
|
|
1655
|
+
},
|
|
1656
|
+
onClick() {
|
|
1657
|
+
if (this.triggers.indexOf("hover") !== -1) return;
|
|
1658
|
+
if (this.triggers.indexOf("click") < 0) return;
|
|
1659
|
+
this.toggle();
|
|
1660
|
+
},
|
|
1661
|
+
onContextMenu() {
|
|
1662
|
+
if (this.triggers.indexOf("contextmenu") < 0) return;
|
|
1663
|
+
this.toggle();
|
|
1664
|
+
},
|
|
1665
|
+
onHover() {
|
|
1666
|
+
if (this.triggers.indexOf("hover") < 0) return;
|
|
1667
|
+
if (this.isTouchEnabled) return;
|
|
1668
|
+
this.isHoverable = true;
|
|
1669
|
+
},
|
|
1670
|
+
// takes care of touch-enabled devices
|
|
1671
|
+
// - does nothing if hover trigger is disabled
|
|
1672
|
+
// - suppresses hover trigger by setting isTouchEnabled
|
|
1673
|
+
// - handles only a tap; i.e., touchstart on the trigger immediately
|
|
1674
|
+
// folowed by touchend
|
|
1675
|
+
onTouchStart() {
|
|
1676
|
+
this.maybeTap = true;
|
|
1677
|
+
},
|
|
1678
|
+
onTouchMove() {
|
|
1679
|
+
this.maybeTap = false;
|
|
1680
|
+
},
|
|
1681
|
+
onTouchEnd(e) {
|
|
1682
|
+
if (this.triggers.indexOf("hover") === -1) return;
|
|
1683
|
+
if (!this.maybeTap) return;
|
|
1684
|
+
e.preventDefault();
|
|
1685
|
+
this.maybeTap = false;
|
|
1686
|
+
this.isTouchEnabled = true;
|
|
1687
|
+
this.toggle();
|
|
1688
|
+
},
|
|
1689
|
+
onFocus() {
|
|
1690
|
+
if (this.triggers.indexOf("focus") < 0) return;
|
|
1691
|
+
this.toggle();
|
|
1692
|
+
},
|
|
1693
|
+
/*
|
|
1694
|
+
* Toggle dropdown if it's not disabled.
|
|
1695
|
+
*/
|
|
1696
|
+
toggle() {
|
|
1697
|
+
if (this.disabled) return;
|
|
1698
|
+
if (!this.isActive) {
|
|
1699
|
+
this.timeOutID2 = setTimeout(() => {
|
|
1700
|
+
const value = !this.isActive;
|
|
1701
|
+
this.isActive = value;
|
|
1702
|
+
});
|
|
1703
|
+
} else {
|
|
1704
|
+
this.isActive = !this.isActive;
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
updateAppendToBody() {
|
|
1708
|
+
const dropdown = this.$refs.dropdown;
|
|
1709
|
+
const dropdownMenu = this.$refs.dropdownMenu;
|
|
1710
|
+
const trigger = this.$refs.trigger;
|
|
1711
|
+
if (dropdownMenu && trigger) {
|
|
1712
|
+
const dropdownWrapper = this.$data._bodyEl.children[0];
|
|
1713
|
+
dropdownWrapper.classList.forEach((item) => dropdownWrapper.classList.remove(item));
|
|
1714
|
+
dropdownWrapper.classList.add("dropdown");
|
|
1715
|
+
dropdownWrapper.classList.add("dropdown-menu-animation");
|
|
1716
|
+
this.rootClasses.forEach((item) => {
|
|
1717
|
+
if (item && typeof item === "object") {
|
|
1718
|
+
for (const key in item) {
|
|
1719
|
+
if (item[key]) {
|
|
1720
|
+
dropdownWrapper.classList.add(key);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
if (this.appendToBodyCopyParent) {
|
|
1726
|
+
const parentNode = this.$refs.dropdown.parentNode;
|
|
1727
|
+
const parent = this.$data._bodyEl;
|
|
1728
|
+
parent.classList.forEach((item) => parent.classList.remove(item));
|
|
1729
|
+
parentNode.classList.forEach((item) => {
|
|
1730
|
+
parent.classList.add(item);
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
const rect = trigger.getBoundingClientRect();
|
|
1734
|
+
let top = rect.top + window.scrollY;
|
|
1735
|
+
let left = rect.left + window.scrollX;
|
|
1736
|
+
if (!this.position || this.position.indexOf("bottom") >= 0) {
|
|
1737
|
+
top += trigger.clientHeight;
|
|
1738
|
+
} else {
|
|
1739
|
+
top -= dropdownMenu.clientHeight;
|
|
1740
|
+
}
|
|
1741
|
+
if (this.position && this.position.indexOf("left") >= 0) {
|
|
1742
|
+
left -= dropdownMenu.clientWidth - trigger.clientWidth;
|
|
1743
|
+
}
|
|
1744
|
+
this.style = {
|
|
1745
|
+
position: "absolute",
|
|
1746
|
+
top: `${top}px`,
|
|
1747
|
+
left: `${left}px`,
|
|
1748
|
+
zIndex: "99",
|
|
1749
|
+
width: this.expanded ? `${dropdown.offsetWidth}px` : void 0
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
mounted() {
|
|
1755
|
+
if (this.appendToBody) {
|
|
1756
|
+
this.$data._bodyEl = createAbsoluteElement(this.$refs.dropdownMenu);
|
|
1757
|
+
this.updateAppendToBody();
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
created() {
|
|
1761
|
+
if (typeof window !== "undefined") {
|
|
1762
|
+
document.addEventListener("click", this.clickedOutside);
|
|
1763
|
+
document.addEventListener("keyup", this.keyPress);
|
|
1764
|
+
}
|
|
1765
|
+
},
|
|
1766
|
+
beforeUnmount() {
|
|
1767
|
+
if (typeof window !== "undefined") {
|
|
1768
|
+
document.removeEventListener("click", this.clickedOutside);
|
|
1769
|
+
document.removeEventListener("keyup", this.keyPress);
|
|
1770
|
+
}
|
|
1771
|
+
if (this.appendToBody) {
|
|
1772
|
+
removeElement(this.$data._bodyEl);
|
|
1773
|
+
}
|
|
1774
|
+
clearTimeout(this.timeOutID);
|
|
1775
|
+
clearTimeout(this.timeOutID2);
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
|
|
1779
|
+
const _hoisted_1$6 = ["tabindex"];
|
|
1780
|
+
const _hoisted_2$4 = ["aria-hidden"];
|
|
1781
|
+
const _hoisted_3$4 = ["aria-hidden"];
|
|
1782
|
+
const _hoisted_4$3 = ["role", "aria-modal"];
|
|
1783
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1784
|
+
const _directive_trap_focus = vue.resolveDirective("trap-focus");
|
|
1785
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
1786
|
+
"div",
|
|
1787
|
+
{
|
|
1788
|
+
class: vue.normalizeClass(["dropdown dropdown-menu-animation", _ctx.rootClasses]),
|
|
1789
|
+
ref: "dropdown",
|
|
1790
|
+
onMouseleave: _cache[7] || (_cache[7] = ($event) => _ctx.isHoverable = false)
|
|
1791
|
+
},
|
|
1792
|
+
[
|
|
1793
|
+
!_ctx.inline ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1794
|
+
key: 0,
|
|
1795
|
+
tabindex: _ctx.disabled ? void 0 : _ctx.triggerTabindex,
|
|
1796
|
+
ref: "trigger",
|
|
1797
|
+
class: "dropdown-trigger",
|
|
1798
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
|
|
1799
|
+
onContextmenu: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.onContextMenu && _ctx.onContextMenu(...args), ["prevent"])),
|
|
1800
|
+
onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.onHover && _ctx.onHover(...args)),
|
|
1801
|
+
onFocusCapture: _cache[3] || (_cache[3] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
1802
|
+
onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
|
1803
|
+
onTouchmove: _cache[5] || (_cache[5] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
|
1804
|
+
onTouchend: _cache[6] || (_cache[6] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
|
1805
|
+
"aria-haspopup": "true"
|
|
1806
|
+
}, [
|
|
1807
|
+
vue.renderSlot(_ctx.$slots, "trigger", { active: _ctx.isActive })
|
|
1808
|
+
], 40, _hoisted_1$6)) : vue.createCommentVNode("v-if", true),
|
|
1809
|
+
vue.createVNode(vue.Transition, { name: _ctx.animation }, {
|
|
1810
|
+
default: vue.withCtx(() => [
|
|
1811
|
+
_ctx.isMobileModal ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
1812
|
+
key: 0,
|
|
1813
|
+
class: "background",
|
|
1814
|
+
"aria-hidden": !_ctx.isActive
|
|
1815
|
+
}, null, 8, _hoisted_2$4)), [
|
|
1816
|
+
[vue.vShow, _ctx.isActive]
|
|
1817
|
+
]) : vue.createCommentVNode("v-if", true)
|
|
1818
|
+
]),
|
|
1819
|
+
_: 1
|
|
1820
|
+
/* STABLE */
|
|
1821
|
+
}, 8, ["name"]),
|
|
1822
|
+
vue.createVNode(vue.Transition, {
|
|
1823
|
+
name: _ctx.animation,
|
|
1824
|
+
persisted: ""
|
|
1825
|
+
}, {
|
|
1826
|
+
default: vue.withCtx(() => [
|
|
1827
|
+
vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
1828
|
+
ref: "dropdownMenu",
|
|
1829
|
+
class: "dropdown-menu",
|
|
1830
|
+
style: vue.normalizeStyle(_ctx.style),
|
|
1831
|
+
"aria-hidden": !_ctx.isActive
|
|
1832
|
+
}, [
|
|
1833
|
+
vue.createElementVNode("div", {
|
|
1834
|
+
class: "dropdown-content",
|
|
1835
|
+
role: _ctx.ariaRole,
|
|
1836
|
+
"aria-modal": !_ctx.inline,
|
|
1837
|
+
style: vue.normalizeStyle(_ctx.contentStyle)
|
|
1838
|
+
}, [
|
|
1839
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
1840
|
+
], 12, _hoisted_4$3)
|
|
1841
|
+
], 12, _hoisted_3$4)), [
|
|
1842
|
+
[vue.vShow, !_ctx.disabled && (_ctx.isActive || _ctx.isHoverable) || _ctx.inline],
|
|
1843
|
+
[_directive_trap_focus, _ctx.trapFocus]
|
|
1844
|
+
])
|
|
1845
|
+
]),
|
|
1846
|
+
_: 3
|
|
1847
|
+
/* FORWARDED */
|
|
1848
|
+
}, 8, ["name"])
|
|
1849
|
+
],
|
|
1850
|
+
34
|
|
1851
|
+
/* CLASS, NEED_HYDRATION */
|
|
1852
|
+
);
|
|
1853
|
+
}
|
|
1854
|
+
var BDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
|
|
1855
|
+
|
|
1856
|
+
var _sfc_main$6 = vue.defineComponent({
|
|
1857
|
+
name: "BDropdownItem",
|
|
1858
|
+
inject: {
|
|
1859
|
+
parent: {
|
|
1860
|
+
from: DROPDOWN_INJECTION_KEY,
|
|
1861
|
+
default: void 0
|
|
1862
|
+
}
|
|
1863
|
+
},
|
|
1864
|
+
props: {
|
|
1865
|
+
value: {
|
|
1866
|
+
type: [String, Number, Boolean, Object, Array, Function],
|
|
1867
|
+
default: null
|
|
1868
|
+
},
|
|
1869
|
+
separator: Boolean,
|
|
1870
|
+
disabled: Boolean,
|
|
1871
|
+
custom: Boolean,
|
|
1872
|
+
focusable: {
|
|
1873
|
+
type: Boolean,
|
|
1874
|
+
default: true
|
|
1875
|
+
},
|
|
1876
|
+
paddingless: Boolean,
|
|
1877
|
+
hasLink: Boolean,
|
|
1878
|
+
ariaRole: {
|
|
1879
|
+
type: String,
|
|
1880
|
+
default: ""
|
|
1881
|
+
}
|
|
1882
|
+
},
|
|
1883
|
+
emits: {
|
|
1884
|
+
click: () => true
|
|
1885
|
+
},
|
|
1886
|
+
computed: {
|
|
1887
|
+
anchorClasses() {
|
|
1888
|
+
return {
|
|
1889
|
+
"is-disabled": this.parent.disabled || this.disabled,
|
|
1890
|
+
"is-paddingless": this.paddingless,
|
|
1891
|
+
"is-active": this.isActive
|
|
1892
|
+
};
|
|
1893
|
+
},
|
|
1894
|
+
itemClasses() {
|
|
1895
|
+
return {
|
|
1896
|
+
"dropdown-item": !this.hasLink,
|
|
1897
|
+
"is-disabled": this.disabled,
|
|
1898
|
+
"is-paddingless": this.paddingless,
|
|
1899
|
+
"is-active": this.isActive,
|
|
1900
|
+
"has-link": this.hasLink
|
|
1901
|
+
};
|
|
1902
|
+
},
|
|
1903
|
+
ariaRoleItem() {
|
|
1904
|
+
return this.ariaRole === "menuitem" || this.ariaRole === "listitem" ? this.ariaRole : void 0;
|
|
1905
|
+
},
|
|
1906
|
+
isClickable() {
|
|
1907
|
+
return !this.parent.disabled && !this.separator && !this.disabled && !this.custom;
|
|
1908
|
+
},
|
|
1909
|
+
isActive() {
|
|
1910
|
+
if (this.parent.selected === null) return false;
|
|
1911
|
+
if (this.parent.multiple) {
|
|
1912
|
+
return this.parent.selected.indexOf(this.value) >= 0;
|
|
1913
|
+
}
|
|
1914
|
+
return this.value === this.parent.selected;
|
|
1915
|
+
},
|
|
1916
|
+
isFocusable() {
|
|
1917
|
+
return this.hasLink ? false : this.focusable;
|
|
1918
|
+
}
|
|
1919
|
+
},
|
|
1920
|
+
methods: {
|
|
1921
|
+
/*
|
|
1922
|
+
* Click listener, select the item.
|
|
1923
|
+
*/
|
|
1924
|
+
selectItem() {
|
|
1925
|
+
if (!this.isClickable) return;
|
|
1926
|
+
this.parent.selectItem(this.value);
|
|
1927
|
+
this.$emit("click");
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
|
|
1932
|
+
const _hoisted_1$5 = {
|
|
1933
|
+
key: 0,
|
|
1934
|
+
class: "dropdown-divider"
|
|
1935
|
+
};
|
|
1936
|
+
const _hoisted_2$3 = ["role", "tabindex"];
|
|
1937
|
+
const _hoisted_3$3 = ["role", "tabindex"];
|
|
1938
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1939
|
+
return _ctx.separator ? (vue.openBlock(), vue.createElementBlock("hr", _hoisted_1$5)) : !_ctx.custom && !_ctx.hasLink ? (vue.openBlock(), vue.createElementBlock("a", {
|
|
1940
|
+
key: 1,
|
|
1941
|
+
class: vue.normalizeClass(["dropdown-item", _ctx.anchorClasses]),
|
|
1942
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.selectItem && _ctx.selectItem(...args)),
|
|
1943
|
+
role: _ctx.ariaRoleItem,
|
|
1944
|
+
tabindex: _ctx.isFocusable ? 0 : void 0
|
|
1945
|
+
}, [
|
|
1946
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
1947
|
+
], 10, _hoisted_2$3)) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
1948
|
+
key: 2,
|
|
1949
|
+
class: vue.normalizeClass(_ctx.itemClasses),
|
|
1950
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.selectItem && _ctx.selectItem(...args)),
|
|
1951
|
+
role: _ctx.ariaRoleItem,
|
|
1952
|
+
tabindex: _ctx.isFocusable ? 0 : void 0
|
|
1953
|
+
}, [
|
|
1954
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
1955
|
+
], 10, _hoisted_3$3));
|
|
1956
|
+
}
|
|
1957
|
+
var BDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
|
|
1958
|
+
|
|
1959
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1960
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1961
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1962
|
+
var __objRest = (source, exclude) => {
|
|
1963
|
+
var target = {};
|
|
1964
|
+
for (var prop in source)
|
|
1965
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1966
|
+
target[prop] = source[prop];
|
|
1967
|
+
if (source != null && __getOwnPropSymbols)
|
|
1968
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
1969
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
1970
|
+
target[prop] = source[prop];
|
|
1971
|
+
}
|
|
1972
|
+
return target;
|
|
1973
|
+
};
|
|
1974
|
+
var CompatFallthroughMixin = vue.defineComponent({
|
|
1975
|
+
inheritAttrs: false,
|
|
1976
|
+
props: {
|
|
1977
|
+
compatFallthrough: {
|
|
1978
|
+
type: Boolean,
|
|
1979
|
+
default: () => config.defaultCompatFallthrough
|
|
1980
|
+
}
|
|
1981
|
+
},
|
|
1982
|
+
computed: {
|
|
1983
|
+
rootAttrs() {
|
|
1984
|
+
return this.compatFallthrough ? {
|
|
1985
|
+
class: this.$attrs.class,
|
|
1986
|
+
style: this.$attrs.style,
|
|
1987
|
+
id: this.$attrs.id
|
|
1988
|
+
} : {};
|
|
1989
|
+
},
|
|
1990
|
+
fallthroughAttrs() {
|
|
1991
|
+
if (this.compatFallthrough) {
|
|
1992
|
+
const _a = this.$attrs, { style: _1, class: _2, id: _3 } = _a, rest = __objRest(_a, ["style", "class", "id"]);
|
|
1993
|
+
return rest;
|
|
1994
|
+
} else {
|
|
1995
|
+
return this.$attrs;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
|
|
2001
|
+
var _sfc_main$5 = vue.defineComponent({
|
|
2002
|
+
name: "BInput",
|
|
2003
|
+
components: { BIcon },
|
|
2004
|
+
mixins: [CompatFallthroughMixin, FormElementMixin],
|
|
2005
|
+
props: {
|
|
2006
|
+
modelValue: {
|
|
2007
|
+
type: [Number, String]
|
|
2008
|
+
},
|
|
2009
|
+
type: {
|
|
2010
|
+
type: String,
|
|
2011
|
+
default: "text"
|
|
2012
|
+
},
|
|
2013
|
+
lazy: {
|
|
2014
|
+
type: Boolean,
|
|
2015
|
+
default: false
|
|
2016
|
+
},
|
|
2017
|
+
passwordReveal: Boolean,
|
|
2018
|
+
iconClickable: Boolean,
|
|
2019
|
+
hasCounter: {
|
|
2020
|
+
type: Boolean,
|
|
2021
|
+
default: () => config.defaultInputHasCounter
|
|
2022
|
+
},
|
|
2023
|
+
customClass: {
|
|
2024
|
+
type: String,
|
|
2025
|
+
default: ""
|
|
2026
|
+
},
|
|
2027
|
+
iconRight: String,
|
|
2028
|
+
iconRightClickable: Boolean,
|
|
2029
|
+
iconRightType: String,
|
|
2030
|
+
// Native options to use in HTML5 validation
|
|
2031
|
+
autocomplete: String
|
|
2032
|
+
},
|
|
2033
|
+
emits: {
|
|
2034
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2035
|
+
"icon-click": (event) => true,
|
|
2036
|
+
"icon-right-click": (event) => true,
|
|
2037
|
+
"update:modelValue": (value) => true
|
|
2038
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
2039
|
+
},
|
|
2040
|
+
data() {
|
|
2041
|
+
return {
|
|
2042
|
+
newValue: this.modelValue,
|
|
2043
|
+
newType: this.type,
|
|
2044
|
+
newAutocomplete: this.autocomplete || config.defaultInputAutocomplete,
|
|
2045
|
+
isPasswordVisible: false,
|
|
2046
|
+
_elementRef: this.type === "textarea" ? "textarea" : "input"
|
|
2047
|
+
};
|
|
2048
|
+
},
|
|
2049
|
+
computed: {
|
|
2050
|
+
computedValue: {
|
|
2051
|
+
get() {
|
|
2052
|
+
return this.newValue;
|
|
2053
|
+
},
|
|
2054
|
+
set(value) {
|
|
2055
|
+
this.newValue = value;
|
|
2056
|
+
this.$emit("update:modelValue", value);
|
|
2057
|
+
}
|
|
2058
|
+
},
|
|
2059
|
+
rootClasses() {
|
|
2060
|
+
return [
|
|
2061
|
+
this.iconPosition,
|
|
2062
|
+
this.size,
|
|
2063
|
+
{
|
|
2064
|
+
"is-expanded": this.expanded,
|
|
2065
|
+
"is-loading": this.loading,
|
|
2066
|
+
"is-clearfix": !this.hasMessage
|
|
2067
|
+
}
|
|
2068
|
+
];
|
|
2069
|
+
},
|
|
2070
|
+
inputClasses() {
|
|
2071
|
+
return [
|
|
2072
|
+
this.statusType,
|
|
2073
|
+
this.size,
|
|
2074
|
+
{ "is-rounded": this.rounded }
|
|
2075
|
+
];
|
|
2076
|
+
},
|
|
2077
|
+
hasIconRight() {
|
|
2078
|
+
return this.passwordReveal || this.loading || this.statusIcon && this.statusTypeIcon || this.iconRight;
|
|
2079
|
+
},
|
|
2080
|
+
rightIcon() {
|
|
2081
|
+
if (this.passwordReveal) {
|
|
2082
|
+
return this.passwordVisibleIcon;
|
|
2083
|
+
} else if (this.iconRight) {
|
|
2084
|
+
return this.iconRight;
|
|
2085
|
+
}
|
|
2086
|
+
return this.statusTypeIcon;
|
|
2087
|
+
},
|
|
2088
|
+
rightIconType() {
|
|
2089
|
+
if (this.passwordReveal) {
|
|
2090
|
+
return "is-primary";
|
|
2091
|
+
} else if (this.iconRight) {
|
|
2092
|
+
return this.iconRightType || void 0;
|
|
2093
|
+
}
|
|
2094
|
+
return this.statusType;
|
|
2095
|
+
},
|
|
2096
|
+
/*
|
|
2097
|
+
* Position of the icon or if it's both sides.
|
|
2098
|
+
*/
|
|
2099
|
+
iconPosition() {
|
|
2100
|
+
let iconClasses = "";
|
|
2101
|
+
if (this.icon) {
|
|
2102
|
+
iconClasses += "has-icons-left ";
|
|
2103
|
+
}
|
|
2104
|
+
if (this.hasIconRight) {
|
|
2105
|
+
iconClasses += "has-icons-right";
|
|
2106
|
+
}
|
|
2107
|
+
return iconClasses;
|
|
2108
|
+
},
|
|
2109
|
+
/*
|
|
2110
|
+
* Icon name (MDI) based on the type.
|
|
2111
|
+
*/
|
|
2112
|
+
statusTypeIcon() {
|
|
2113
|
+
switch (this.statusType) {
|
|
2114
|
+
case "is-success":
|
|
2115
|
+
return "check";
|
|
2116
|
+
case "is-danger":
|
|
2117
|
+
return "alert-circle";
|
|
2118
|
+
case "is-info":
|
|
2119
|
+
return "information";
|
|
2120
|
+
case "is-warning":
|
|
2121
|
+
return "alert";
|
|
2122
|
+
default:
|
|
2123
|
+
return void 0;
|
|
2124
|
+
}
|
|
2125
|
+
},
|
|
2126
|
+
/*
|
|
2127
|
+
* Check if have any message prop from parent if it's a Field.
|
|
2128
|
+
*/
|
|
2129
|
+
hasMessage() {
|
|
2130
|
+
return !!this.statusMessage;
|
|
2131
|
+
},
|
|
2132
|
+
/*
|
|
2133
|
+
* Current password-reveal icon name.
|
|
2134
|
+
*/
|
|
2135
|
+
passwordVisibleIcon() {
|
|
2136
|
+
return !this.isPasswordVisible ? "eye" : "eye-off";
|
|
2137
|
+
},
|
|
2138
|
+
/*
|
|
2139
|
+
* Get value length
|
|
2140
|
+
*/
|
|
2141
|
+
valueLength() {
|
|
2142
|
+
if (typeof this.computedValue === "string") {
|
|
2143
|
+
return Array.from(this.computedValue).length;
|
|
2144
|
+
} else if (typeof this.computedValue === "number") {
|
|
2145
|
+
return this.computedValue.toString().length;
|
|
2146
|
+
}
|
|
2147
|
+
return 0;
|
|
2148
|
+
}
|
|
2149
|
+
},
|
|
2150
|
+
watch: {
|
|
2151
|
+
/*
|
|
2152
|
+
* When v-model is changed:
|
|
2153
|
+
* 1. Set internal value.
|
|
2154
|
+
* 2. Validate it if the value came from outside;
|
|
2155
|
+
* i.e., not equal to computedValue
|
|
2156
|
+
*/
|
|
2157
|
+
modelValue(value) {
|
|
2158
|
+
const fromOutside = this.computedValue != value;
|
|
2159
|
+
this.newValue = value;
|
|
2160
|
+
if (fromOutside) {
|
|
2161
|
+
this.$nextTick(() => {
|
|
2162
|
+
!this.isValid && this.checkHtml5Validity();
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
},
|
|
2166
|
+
type(type) {
|
|
2167
|
+
this.newType = type;
|
|
2168
|
+
}
|
|
2169
|
+
},
|
|
2170
|
+
methods: {
|
|
2171
|
+
/*
|
|
2172
|
+
* Toggle the visibility of a password-reveal input
|
|
2173
|
+
* by changing the type and focus the input right away.
|
|
2174
|
+
*/
|
|
2175
|
+
togglePasswordVisibility() {
|
|
2176
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
2177
|
+
this.newType = this.isPasswordVisible ? "text" : "password";
|
|
2178
|
+
this.$nextTick(() => {
|
|
2179
|
+
this.focus();
|
|
2180
|
+
});
|
|
2181
|
+
},
|
|
2182
|
+
iconClick(emit, event) {
|
|
2183
|
+
this.$emit(emit, event);
|
|
2184
|
+
this.$nextTick(() => {
|
|
2185
|
+
this.focus();
|
|
2186
|
+
});
|
|
2187
|
+
},
|
|
2188
|
+
rightIconClick(event) {
|
|
2189
|
+
if (this.passwordReveal) {
|
|
2190
|
+
this.togglePasswordVisibility();
|
|
2191
|
+
} else if (this.iconRightClickable) {
|
|
2192
|
+
this.iconClick("icon-right-click", event);
|
|
2193
|
+
}
|
|
2194
|
+
},
|
|
2195
|
+
onInput() {
|
|
2196
|
+
if (!this.lazy) {
|
|
2197
|
+
this.revalidate();
|
|
2198
|
+
}
|
|
2199
|
+
},
|
|
2200
|
+
onChange() {
|
|
2201
|
+
if (this.lazy) {
|
|
2202
|
+
this.revalidate();
|
|
2203
|
+
}
|
|
2204
|
+
},
|
|
2205
|
+
revalidate() {
|
|
2206
|
+
!this.isValid && this.checkHtml5Validity();
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
});
|
|
2210
|
+
|
|
2211
|
+
const _hoisted_1$4 = ["type", "autocomplete", "maxlength"];
|
|
2212
|
+
const _hoisted_2$2 = ["maxlength"];
|
|
2213
|
+
const _hoisted_3$2 = ["type", "autocomplete", "maxlength"];
|
|
2214
|
+
const _hoisted_4$2 = ["maxlength"];
|
|
2215
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2216
|
+
const _component_b_icon = vue.resolveComponent("b-icon");
|
|
2217
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
2218
|
+
"div",
|
|
2219
|
+
vue.mergeProps({
|
|
2220
|
+
class: ["control", _ctx.rootClasses]
|
|
2221
|
+
}, _ctx.rootAttrs),
|
|
2222
|
+
[
|
|
2223
|
+
_ctx.lazy ? (vue.openBlock(), vue.createElementBlock(
|
|
2224
|
+
vue.Fragment,
|
|
2225
|
+
{ key: 0 },
|
|
2226
|
+
[
|
|
2227
|
+
_ctx.type !== "textarea" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", vue.mergeProps({
|
|
2228
|
+
key: 0,
|
|
2229
|
+
ref: "input",
|
|
2230
|
+
class: ["input", [_ctx.inputClasses, _ctx.customClass]],
|
|
2231
|
+
type: _ctx.newType,
|
|
2232
|
+
autocomplete: _ctx.newAutocomplete,
|
|
2233
|
+
maxlength: _ctx.maxlength,
|
|
2234
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.computedValue = $event)
|
|
2235
|
+
}, _ctx.fallthroughAttrs, {
|
|
2236
|
+
onInput: _cache[1] || (_cache[1] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
|
|
2237
|
+
onChange: _cache[2] || (_cache[2] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
2238
|
+
onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
|
|
2239
|
+
onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.onFocus && _ctx.onFocus(...args))
|
|
2240
|
+
}), null, 16, _hoisted_1$4)), [
|
|
2241
|
+
[
|
|
2242
|
+
vue.vModelDynamic,
|
|
2243
|
+
_ctx.computedValue,
|
|
2244
|
+
void 0,
|
|
2245
|
+
{ lazy: true }
|
|
2246
|
+
]
|
|
2247
|
+
]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("textarea", vue.mergeProps({
|
|
2248
|
+
key: 1,
|
|
2249
|
+
ref: "textarea",
|
|
2250
|
+
class: ["textarea", [_ctx.inputClasses, _ctx.customClass]],
|
|
2251
|
+
maxlength: _ctx.maxlength,
|
|
2252
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.computedValue = $event)
|
|
2253
|
+
}, _ctx.fallthroughAttrs, {
|
|
2254
|
+
onInput: _cache[6] || (_cache[6] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
|
|
2255
|
+
onChange: _cache[7] || (_cache[7] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
2256
|
+
onBlur: _cache[8] || (_cache[8] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
|
|
2257
|
+
onFocus: _cache[9] || (_cache[9] = (...args) => _ctx.onFocus && _ctx.onFocus(...args))
|
|
2258
|
+
}), null, 16, _hoisted_2$2)), [
|
|
2259
|
+
[
|
|
2260
|
+
vue.vModelText,
|
|
2261
|
+
_ctx.computedValue,
|
|
2262
|
+
void 0,
|
|
2263
|
+
{ lazy: true }
|
|
2264
|
+
]
|
|
2265
|
+
])
|
|
2266
|
+
],
|
|
2267
|
+
64
|
|
2268
|
+
/* STABLE_FRAGMENT */
|
|
2269
|
+
)) : (vue.openBlock(), vue.createElementBlock(
|
|
2270
|
+
vue.Fragment,
|
|
2271
|
+
{ key: 1 },
|
|
2272
|
+
[
|
|
2273
|
+
_ctx.type !== "textarea" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", vue.mergeProps({
|
|
2274
|
+
key: 0,
|
|
2275
|
+
ref: "input",
|
|
2276
|
+
class: ["input", [_ctx.inputClasses, _ctx.customClass]],
|
|
2277
|
+
type: _ctx.newType,
|
|
2278
|
+
autocomplete: _ctx.newAutocomplete,
|
|
2279
|
+
maxlength: _ctx.maxlength,
|
|
2280
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.computedValue = $event)
|
|
2281
|
+
}, _ctx.fallthroughAttrs, {
|
|
2282
|
+
onInput: _cache[11] || (_cache[11] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
|
|
2283
|
+
onChange: _cache[12] || (_cache[12] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
2284
|
+
onBlur: _cache[13] || (_cache[13] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
|
|
2285
|
+
onFocus: _cache[14] || (_cache[14] = (...args) => _ctx.onFocus && _ctx.onFocus(...args))
|
|
2286
|
+
}), null, 16, _hoisted_3$2)), [
|
|
2287
|
+
[vue.vModelDynamic, _ctx.computedValue]
|
|
2288
|
+
]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("textarea", vue.mergeProps({
|
|
2289
|
+
key: 1,
|
|
2290
|
+
ref: "textarea",
|
|
2291
|
+
class: ["textarea", [_ctx.inputClasses, _ctx.customClass]],
|
|
2292
|
+
maxlength: _ctx.maxlength,
|
|
2293
|
+
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.computedValue = $event)
|
|
2294
|
+
}, _ctx.fallthroughAttrs, {
|
|
2295
|
+
onInput: _cache[16] || (_cache[16] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
|
|
2296
|
+
onChange: _cache[17] || (_cache[17] = (...args) => _ctx.onChange && _ctx.onChange(...args)),
|
|
2297
|
+
onBlur: _cache[18] || (_cache[18] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
|
|
2298
|
+
onFocus: _cache[19] || (_cache[19] = (...args) => _ctx.onFocus && _ctx.onFocus(...args))
|
|
2299
|
+
}), null, 16, _hoisted_4$2)), [
|
|
2300
|
+
[vue.vModelText, _ctx.computedValue]
|
|
2301
|
+
])
|
|
2302
|
+
],
|
|
2303
|
+
64
|
|
2304
|
+
/* STABLE_FRAGMENT */
|
|
2305
|
+
)),
|
|
2306
|
+
_ctx.icon ? (vue.openBlock(), vue.createBlock(_component_b_icon, {
|
|
2307
|
+
key: 2,
|
|
2308
|
+
class: vue.normalizeClass(["is-left", { "is-clickable": _ctx.iconClickable }]),
|
|
2309
|
+
icon: _ctx.icon,
|
|
2310
|
+
pack: _ctx.iconPack,
|
|
2311
|
+
size: _ctx.iconSize,
|
|
2312
|
+
onClick: _cache[20] || (_cache[20] = ($event) => _ctx.iconClick("icon-click", $event))
|
|
2313
|
+
}, null, 8, ["class", "icon", "pack", "size"])) : vue.createCommentVNode("v-if", true),
|
|
2314
|
+
!_ctx.loading && _ctx.hasIconRight && _ctx.rightIcon ? (vue.openBlock(), vue.createBlock(_component_b_icon, {
|
|
2315
|
+
key: 3,
|
|
2316
|
+
class: vue.normalizeClass(["is-right", { "is-clickable": _ctx.passwordReveal || _ctx.iconRightClickable }]),
|
|
2317
|
+
icon: _ctx.rightIcon,
|
|
2318
|
+
pack: _ctx.iconPack,
|
|
2319
|
+
size: _ctx.iconSize,
|
|
2320
|
+
type: _ctx.rightIconType,
|
|
2321
|
+
both: "",
|
|
2322
|
+
onClick: _ctx.rightIconClick
|
|
2323
|
+
}, null, 8, ["class", "icon", "pack", "size", "type", "onClick"])) : vue.createCommentVNode("v-if", true),
|
|
2324
|
+
_ctx.maxlength && _ctx.hasCounter && _ctx.type !== "number" ? (vue.openBlock(), vue.createElementBlock(
|
|
2325
|
+
"small",
|
|
2326
|
+
{
|
|
2327
|
+
key: 4,
|
|
2328
|
+
class: vue.normalizeClass(["help counter", { "is-invisible": !_ctx.isFocused }])
|
|
2329
|
+
},
|
|
2330
|
+
vue.toDisplayString(_ctx.valueLength) + " / " + vue.toDisplayString(_ctx.maxlength),
|
|
2331
|
+
3
|
|
2332
|
+
/* TEXT, CLASS */
|
|
2333
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
2334
|
+
],
|
|
2335
|
+
16
|
|
2336
|
+
/* FULL_PROPS */
|
|
2337
|
+
);
|
|
2338
|
+
}
|
|
2339
|
+
var BInput = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
|
|
2340
|
+
|
|
2341
|
+
const cos30 = 0.86602540378;
|
|
2342
|
+
const sin30 = 0.5;
|
|
2343
|
+
let id = 0;
|
|
2344
|
+
var _sfc_main$4 = vue.defineComponent({
|
|
2345
|
+
name: "BColorpickerHSLRepresentationTriangle",
|
|
2346
|
+
props: {
|
|
2347
|
+
value: {
|
|
2348
|
+
type: Object,
|
|
2349
|
+
required: true,
|
|
2350
|
+
validator(value) {
|
|
2351
|
+
return typeof value.hue === "number" && typeof value.saturation === "number" && typeof value.lightness === "number";
|
|
2352
|
+
}
|
|
2353
|
+
},
|
|
2354
|
+
size: {
|
|
2355
|
+
type: Number,
|
|
2356
|
+
default: 200
|
|
2357
|
+
},
|
|
2358
|
+
thickness: {
|
|
2359
|
+
type: Number,
|
|
2360
|
+
default: 20
|
|
2361
|
+
}
|
|
2362
|
+
},
|
|
2363
|
+
emits: {
|
|
2364
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2365
|
+
input: (_value) => true
|
|
2366
|
+
},
|
|
2367
|
+
data() {
|
|
2368
|
+
return {
|
|
2369
|
+
id: id++,
|
|
2370
|
+
hue: this.value.hue,
|
|
2371
|
+
saturation: this.value.saturation,
|
|
2372
|
+
lightness: this.value.lightness,
|
|
2373
|
+
captureMouse: false,
|
|
2374
|
+
captureType: "hue",
|
|
2375
|
+
clientOffset: {
|
|
2376
|
+
cx: -1,
|
|
2377
|
+
cy: -1,
|
|
2378
|
+
width: 0,
|
|
2379
|
+
height: 0
|
|
2380
|
+
},
|
|
2381
|
+
cos30,
|
|
2382
|
+
sin30,
|
|
2383
|
+
debounce: 0
|
|
2384
|
+
};
|
|
2385
|
+
},
|
|
2386
|
+
computed: {
|
|
2387
|
+
viewBox() {
|
|
2388
|
+
const { size } = this;
|
|
2389
|
+
return `0 0 ${size} ${size}`;
|
|
2390
|
+
},
|
|
2391
|
+
internalRadius() {
|
|
2392
|
+
return this.size / 2 - this.thickness;
|
|
2393
|
+
},
|
|
2394
|
+
haloPath() {
|
|
2395
|
+
const { size, thickness } = this;
|
|
2396
|
+
const radius = size / 2 - 2;
|
|
2397
|
+
const thicknessRadius = radius - thickness;
|
|
2398
|
+
const center = size / 2;
|
|
2399
|
+
return `M${center - radius} ${center}a${radius} ${radius} 0 1 1 ${2 * radius} 0h${-thickness}a${-thicknessRadius} ${thicknessRadius} 0 1 0 ${ -2 * thicknessRadius} 0a${thicknessRadius} ${thicknessRadius} 0 1 0 ${2 * thicknessRadius} 0h${thickness}a${radius} ${radius} 0 1 1 ${ -2 * radius} 0z`;
|
|
2400
|
+
},
|
|
2401
|
+
trianglePath() {
|
|
2402
|
+
const { size, thickness } = this;
|
|
2403
|
+
const radius = size - 4;
|
|
2404
|
+
const thicknessRadius = (radius - 2 * thickness) / 2;
|
|
2405
|
+
return `M0 ${-thicknessRadius}L${cos30 * thicknessRadius} ${sin30 * thicknessRadius}H${ -0.86602540378 * thicknessRadius}z`;
|
|
2406
|
+
}
|
|
2407
|
+
},
|
|
2408
|
+
watch: {
|
|
2409
|
+
captureMouse(newValue, oldValue) {
|
|
2410
|
+
if (oldValue === false && newValue !== false) {
|
|
2411
|
+
const rect = this.$el.getBoundingClientRect();
|
|
2412
|
+
this.clientOffset.cx = rect.x + rect.width / 2;
|
|
2413
|
+
this.clientOffset.cy = rect.y + rect.height / 2;
|
|
2414
|
+
this.clientOffset.width = rect.width;
|
|
2415
|
+
this.clientOffset.height = rect.height;
|
|
2416
|
+
}
|
|
2417
|
+
},
|
|
2418
|
+
value: {
|
|
2419
|
+
deep: true,
|
|
2420
|
+
handler(newColor) {
|
|
2421
|
+
const { hue, saturation, lightness } = newColor;
|
|
2422
|
+
window.clearTimeout(this.debounce);
|
|
2423
|
+
this.debounce = window.setTimeout(() => {
|
|
2424
|
+
if (lightness >= 0.03 && lightness <= 0.97 && saturation > 0) {
|
|
2425
|
+
this.hue = hue;
|
|
2426
|
+
}
|
|
2427
|
+
this.saturation = saturation;
|
|
2428
|
+
this.lightness = lightness;
|
|
2429
|
+
}, 200);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
methods: {
|
|
2434
|
+
increaseHue(value = 1) {
|
|
2435
|
+
this.hue = (this.hue + value) % 360;
|
|
2436
|
+
},
|
|
2437
|
+
decreaseHue(value = 1) {
|
|
2438
|
+
this.hue = (360 + this.hue - value) % 360;
|
|
2439
|
+
},
|
|
2440
|
+
increaseSaturation(value = 0.01) {
|
|
2441
|
+
this.saturation = Math.min(1, Math.max(0, this.saturation + value));
|
|
2442
|
+
this.lightness = Math.min(
|
|
2443
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2444
|
+
Math.max(
|
|
2445
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2446
|
+
this.lightness
|
|
2447
|
+
)
|
|
2448
|
+
);
|
|
2449
|
+
},
|
|
2450
|
+
decreaseSaturation(value = 0.01) {
|
|
2451
|
+
this.saturation = Math.min(1, Math.max(0, this.saturation - value));
|
|
2452
|
+
this.lightness = Math.min(
|
|
2453
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2454
|
+
Math.max(
|
|
2455
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2456
|
+
this.lightness
|
|
2457
|
+
)
|
|
2458
|
+
);
|
|
2459
|
+
},
|
|
2460
|
+
increaseLightness(value = 0.01) {
|
|
2461
|
+
this.lightness = Math.min(
|
|
2462
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2463
|
+
Math.max(
|
|
2464
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2465
|
+
this.lightness + value
|
|
2466
|
+
)
|
|
2467
|
+
);
|
|
2468
|
+
},
|
|
2469
|
+
decreaseLightness(value = 0.01) {
|
|
2470
|
+
this.lightness = Math.min(
|
|
2471
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2472
|
+
Math.max(
|
|
2473
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2474
|
+
this.lightness - value
|
|
2475
|
+
)
|
|
2476
|
+
);
|
|
2477
|
+
},
|
|
2478
|
+
hueKeyPress(event) {
|
|
2479
|
+
let handled = false;
|
|
2480
|
+
switch (event.key) {
|
|
2481
|
+
case "ArrowRight":
|
|
2482
|
+
case "ArrowUp":
|
|
2483
|
+
this.increaseHue();
|
|
2484
|
+
handled = true;
|
|
2485
|
+
break;
|
|
2486
|
+
case "ArrowLeft":
|
|
2487
|
+
case "ArrowDown":
|
|
2488
|
+
this.decreaseHue();
|
|
2489
|
+
handled = true;
|
|
2490
|
+
break;
|
|
2491
|
+
case "Home":
|
|
2492
|
+
this.increaseHue(360 - this.hue);
|
|
2493
|
+
handled = true;
|
|
2494
|
+
break;
|
|
2495
|
+
case "End":
|
|
2496
|
+
this.decreaseHue(this.hue);
|
|
2497
|
+
handled = true;
|
|
2498
|
+
break;
|
|
2499
|
+
case "PageUp":
|
|
2500
|
+
this.increaseHue(60 - this.hue % 60);
|
|
2501
|
+
handled = true;
|
|
2502
|
+
break;
|
|
2503
|
+
case "PageDown":
|
|
2504
|
+
this.decreaseHue(60 + this.hue % 60);
|
|
2505
|
+
handled = true;
|
|
2506
|
+
break;
|
|
2507
|
+
}
|
|
2508
|
+
if (handled) {
|
|
2509
|
+
event.preventDefault();
|
|
2510
|
+
event.stopPropagation();
|
|
2511
|
+
this.emitColor();
|
|
2512
|
+
}
|
|
2513
|
+
},
|
|
2514
|
+
slKeyPress(event) {
|
|
2515
|
+
let handled = false;
|
|
2516
|
+
switch (event.key) {
|
|
2517
|
+
case "ArrowRight":
|
|
2518
|
+
this.decreaseLightness();
|
|
2519
|
+
handled = true;
|
|
2520
|
+
break;
|
|
2521
|
+
case "ArrowUp":
|
|
2522
|
+
this.increaseSaturation();
|
|
2523
|
+
handled = true;
|
|
2524
|
+
break;
|
|
2525
|
+
case "ArrowLeft":
|
|
2526
|
+
this.increaseLightness();
|
|
2527
|
+
handled = true;
|
|
2528
|
+
break;
|
|
2529
|
+
case "ArrowDown":
|
|
2530
|
+
this.decreaseSaturation();
|
|
2531
|
+
handled = true;
|
|
2532
|
+
break;
|
|
2533
|
+
case "Home":
|
|
2534
|
+
this.increaseLightness(1 - this.lightness);
|
|
2535
|
+
handled = true;
|
|
2536
|
+
break;
|
|
2537
|
+
case "End":
|
|
2538
|
+
this.decreaseLightness(this.lightness);
|
|
2539
|
+
handled = true;
|
|
2540
|
+
break;
|
|
2541
|
+
case "PageUp":
|
|
2542
|
+
this.increaseSaturation(1 - this.saturation);
|
|
2543
|
+
handled = true;
|
|
2544
|
+
break;
|
|
2545
|
+
case "PageDown":
|
|
2546
|
+
this.decreaseSaturation(this.saturation);
|
|
2547
|
+
handled = true;
|
|
2548
|
+
break;
|
|
2549
|
+
}
|
|
2550
|
+
if (handled) {
|
|
2551
|
+
event.preventDefault();
|
|
2552
|
+
event.stopPropagation();
|
|
2553
|
+
this.emitColor();
|
|
2554
|
+
}
|
|
2555
|
+
},
|
|
2556
|
+
clickHue(event) {
|
|
2557
|
+
this.startMouseCapture(event);
|
|
2558
|
+
this.trackMouse(event);
|
|
2559
|
+
this.stopMouseCapture(event);
|
|
2560
|
+
this.$refs.hueCursor.focus();
|
|
2561
|
+
},
|
|
2562
|
+
clickSL(event) {
|
|
2563
|
+
this.startMouseCapture(event);
|
|
2564
|
+
this.trackMouse(event);
|
|
2565
|
+
this.stopMouseCapture(event);
|
|
2566
|
+
this.$refs.slCursor.focus();
|
|
2567
|
+
},
|
|
2568
|
+
trackMouse(event) {
|
|
2569
|
+
if (this.captureMouse === false) {
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
event.preventDefault();
|
|
2573
|
+
event.stopPropagation();
|
|
2574
|
+
const touches = event.touches;
|
|
2575
|
+
let [mouseX, mouseY] = [0, 0];
|
|
2576
|
+
if (typeof touches !== "undefined" && touches.length) {
|
|
2577
|
+
[mouseX, mouseY] = [touches[0].clientX, touches[0].clientY];
|
|
2578
|
+
} else {
|
|
2579
|
+
[mouseX, mouseY] = [event.clientX, event.clientY];
|
|
2580
|
+
}
|
|
2581
|
+
const angle = Math.atan2(
|
|
2582
|
+
mouseY - this.clientOffset.cy,
|
|
2583
|
+
mouseX - this.clientOffset.cx
|
|
2584
|
+
);
|
|
2585
|
+
if (this.captureType === "sl") {
|
|
2586
|
+
const d = Math.sqrt(
|
|
2587
|
+
Math.pow(mouseX - this.clientOffset.cx, 2) + Math.pow(mouseY - this.clientOffset.cy, 2)
|
|
2588
|
+
);
|
|
2589
|
+
const ratio = this.size / this.clientOffset.width;
|
|
2590
|
+
const dx = d * Math.cos(angle - this.hue / 180 * Math.PI) * ratio;
|
|
2591
|
+
const dy = d * Math.sin(angle - this.hue / 180 * Math.PI) * ratio;
|
|
2592
|
+
const radius = this.internalRadius;
|
|
2593
|
+
const saturation = 1 - (Math.min(
|
|
2594
|
+
radius * sin30,
|
|
2595
|
+
Math.max(
|
|
2596
|
+
-radius,
|
|
2597
|
+
dy
|
|
2598
|
+
)
|
|
2599
|
+
) + radius) / (radius + radius * sin30);
|
|
2600
|
+
const lightness = (Math.min(
|
|
2601
|
+
radius * cos30 * (1 - saturation),
|
|
2602
|
+
Math.max(
|
|
2603
|
+
-radius * cos30 * (1 - saturation),
|
|
2604
|
+
dx
|
|
2605
|
+
)
|
|
2606
|
+
) + radius * cos30) / (radius * 2 * cos30);
|
|
2607
|
+
this.saturation = Math.round(saturation * 1e3) / 1e3;
|
|
2608
|
+
this.lightness = 1 - Math.round(lightness * 1e3) / 1e3;
|
|
2609
|
+
} else {
|
|
2610
|
+
this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
|
|
2611
|
+
}
|
|
2612
|
+
this.emitColor();
|
|
2613
|
+
},
|
|
2614
|
+
startMouseCapture(event) {
|
|
2615
|
+
event.stopPropagation();
|
|
2616
|
+
this.captureMouse = true;
|
|
2617
|
+
if (event.target.closest(".colorpicker-triangle-slider-sl") !== null) {
|
|
2618
|
+
this.captureType = "sl";
|
|
2619
|
+
} else {
|
|
2620
|
+
this.captureType = "hue";
|
|
2621
|
+
}
|
|
2622
|
+
},
|
|
2623
|
+
stopMouseCapture(event) {
|
|
2624
|
+
if (this.captureMouse !== false) {
|
|
2625
|
+
event.preventDefault();
|
|
2626
|
+
event.stopPropagation();
|
|
2627
|
+
this.$refs[this.captureType === "sl" ? "slCursor" : "hueCursor"].focus();
|
|
2628
|
+
}
|
|
2629
|
+
this.captureMouse = false;
|
|
2630
|
+
},
|
|
2631
|
+
emitColor() {
|
|
2632
|
+
const { hue, saturation, lightness } = this;
|
|
2633
|
+
this.$emit("input", Color.fromHSL(hue, saturation, lightness));
|
|
2634
|
+
window.clearTimeout(this.debounce);
|
|
2635
|
+
}
|
|
2636
|
+
},
|
|
2637
|
+
mounted() {
|
|
2638
|
+
window.addEventListener("mousemove", this.trackMouse);
|
|
2639
|
+
window.addEventListener("touchmove", this.trackMouse, { passive: false });
|
|
2640
|
+
window.addEventListener("mouseup", this.stopMouseCapture);
|
|
2641
|
+
window.addEventListener("touchend", this.stopMouseCapture);
|
|
2642
|
+
},
|
|
2643
|
+
beforeUnmount() {
|
|
2644
|
+
window.removeEventListener("mousemove", this.trackMouse);
|
|
2645
|
+
window.removeEventListener("touchmove", this.trackMouse);
|
|
2646
|
+
window.removeEventListener("mouseup", this.stopMouseCapture);
|
|
2647
|
+
window.removeEventListener("touchend", this.stopMouseCapture);
|
|
2648
|
+
clearTimeout(this.debounce);
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2651
|
+
|
|
2652
|
+
const _hoisted_1$3 = ["viewBox"];
|
|
2653
|
+
const _hoisted_2$1 = ["id"];
|
|
2654
|
+
const _hoisted_3$1 = /* @__PURE__ */ vue.createElementVNode(
|
|
2655
|
+
"stop",
|
|
2656
|
+
{
|
|
2657
|
+
offset: "0%",
|
|
2658
|
+
"stop-color": "#fff"
|
|
2659
|
+
},
|
|
2660
|
+
null,
|
|
2661
|
+
-1
|
|
2662
|
+
/* HOISTED */
|
|
2663
|
+
);
|
|
2664
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode(
|
|
2665
|
+
"stop",
|
|
2666
|
+
{
|
|
2667
|
+
offset: "100%",
|
|
2668
|
+
"stop-color": "#000"
|
|
2669
|
+
},
|
|
2670
|
+
null,
|
|
2671
|
+
-1
|
|
2672
|
+
/* HOISTED */
|
|
2673
|
+
);
|
|
2674
|
+
const _hoisted_5 = [
|
|
2675
|
+
_hoisted_3$1,
|
|
2676
|
+
_hoisted_4$1
|
|
2677
|
+
];
|
|
2678
|
+
const _hoisted_6 = ["id"];
|
|
2679
|
+
const _hoisted_7 = ["stop-color"];
|
|
2680
|
+
const _hoisted_8 = ["stop-color"];
|
|
2681
|
+
const _hoisted_9 = ["id"];
|
|
2682
|
+
const _hoisted_10 = ["d"];
|
|
2683
|
+
const _hoisted_11 = { class: "colorpicker-triangle-slider-hue" };
|
|
2684
|
+
const _hoisted_12 = ["width", "height", "clip-path"];
|
|
2685
|
+
const _hoisted_13 = ["x", "height"];
|
|
2686
|
+
const _hoisted_14 = ["aria-valuenow"];
|
|
2687
|
+
const _hoisted_15 = ["d", "fill"];
|
|
2688
|
+
const _hoisted_16 = ["d", "fill"];
|
|
2689
|
+
const _hoisted_17 = ["x", "y"];
|
|
2690
|
+
const _hoisted_18 = ["aria-datavalues"];
|
|
2691
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2692
|
+
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
2693
|
+
viewBox: _ctx.viewBox,
|
|
2694
|
+
class: "b-colorpicker-triangle"
|
|
2695
|
+
}, [
|
|
2696
|
+
vue.createElementVNode("defs", null, [
|
|
2697
|
+
vue.createElementVNode("linearGradient", {
|
|
2698
|
+
id: `cp-triangle-gradient-ligthness-${_ctx.id}`,
|
|
2699
|
+
x1: "0",
|
|
2700
|
+
y1: "0",
|
|
2701
|
+
x2: "1",
|
|
2702
|
+
y2: "0"
|
|
2703
|
+
}, [..._hoisted_5], 8, _hoisted_2$1),
|
|
2704
|
+
vue.createElementVNode("linearGradient", {
|
|
2705
|
+
id: `cp-triangle-gradient-saturation-${_ctx.id}`,
|
|
2706
|
+
x1: "0",
|
|
2707
|
+
y1: "0",
|
|
2708
|
+
x2: "0",
|
|
2709
|
+
y2: "1"
|
|
2710
|
+
}, [
|
|
2711
|
+
vue.createElementVNode("stop", {
|
|
2712
|
+
offset: "0%",
|
|
2713
|
+
"stop-color": `hsl(${_ctx.hue}deg, 100%, 50%)`,
|
|
2714
|
+
"stop-opacity": "1"
|
|
2715
|
+
}, null, 8, _hoisted_7),
|
|
2716
|
+
vue.createElementVNode("stop", {
|
|
2717
|
+
offset: "100%",
|
|
2718
|
+
"stop-color": `hsl(${_ctx.hue}deg, 100%, 50%)`,
|
|
2719
|
+
"stop-opacity": "0"
|
|
2720
|
+
}, null, 8, _hoisted_8)
|
|
2721
|
+
], 8, _hoisted_6),
|
|
2722
|
+
vue.createElementVNode("clipPath", {
|
|
2723
|
+
id: `cp-triangle-clip-${_ctx.id}`
|
|
2724
|
+
}, [
|
|
2725
|
+
vue.createElementVNode("path", { d: _ctx.haloPath }, null, 8, _hoisted_10)
|
|
2726
|
+
], 8, _hoisted_9)
|
|
2727
|
+
]),
|
|
2728
|
+
vue.createElementVNode("g", _hoisted_11, [
|
|
2729
|
+
(vue.openBlock(), vue.createElementBlock("foreignObject", {
|
|
2730
|
+
x: 0,
|
|
2731
|
+
y: 0,
|
|
2732
|
+
width: _ctx.size,
|
|
2733
|
+
height: _ctx.size,
|
|
2734
|
+
"clip-path": `url(#cp-triangle-clip-${_ctx.id})`
|
|
2735
|
+
}, [
|
|
2736
|
+
vue.createElementVNode(
|
|
2737
|
+
"div",
|
|
2738
|
+
{
|
|
2739
|
+
class: "colorpicker-triangle-hue",
|
|
2740
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHue && _ctx.clickHue(...args)),
|
|
2741
|
+
onMousedown: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
|
|
2742
|
+
onTouchstart: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
2743
|
+
},
|
|
2744
|
+
null,
|
|
2745
|
+
32
|
|
2746
|
+
/* NEED_HYDRATION */
|
|
2747
|
+
)
|
|
2748
|
+
], 8, _hoisted_12)),
|
|
2749
|
+
vue.createElementVNode(
|
|
2750
|
+
"g",
|
|
2751
|
+
{
|
|
2752
|
+
style: vue.normalizeStyle(`transform: rotate(${_ctx.hue}deg)`)
|
|
2753
|
+
},
|
|
2754
|
+
[
|
|
2755
|
+
(vue.openBlock(), vue.createElementBlock("foreignObject", {
|
|
2756
|
+
x: _ctx.size / 2 - 4,
|
|
2757
|
+
y: 0,
|
|
2758
|
+
width: "8",
|
|
2759
|
+
height: _ctx.thickness + 4
|
|
2760
|
+
}, [
|
|
2761
|
+
vue.createElementVNode("div", {
|
|
2762
|
+
ref: "hueCursor",
|
|
2763
|
+
class: "hue-range-thumb",
|
|
2764
|
+
style: vue.normalizeStyle(`background-color: hsl(${_ctx.hue}deg, 100%, 50%)`),
|
|
2765
|
+
role: "slider",
|
|
2766
|
+
tabindex: "0",
|
|
2767
|
+
"aria-label": "Hue",
|
|
2768
|
+
"aria-valuemin": "0",
|
|
2769
|
+
"aria-valuenow": _ctx.hue,
|
|
2770
|
+
"aria-valuemax": "360",
|
|
2771
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.clickHue && _ctx.clickHue(...args)),
|
|
2772
|
+
onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.hueKeyPress && _ctx.hueKeyPress(...args)),
|
|
2773
|
+
onMousedown: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
|
|
2774
|
+
onTouchstart: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
2775
|
+
}, null, 44, _hoisted_14)
|
|
2776
|
+
], 8, _hoisted_13))
|
|
2777
|
+
],
|
|
2778
|
+
4
|
|
2779
|
+
/* STYLE */
|
|
2780
|
+
)
|
|
2781
|
+
]),
|
|
2782
|
+
vue.createElementVNode(
|
|
2783
|
+
"g",
|
|
2784
|
+
{
|
|
2785
|
+
class: "colorpicker-triangle-slider-sl",
|
|
2786
|
+
style: vue.normalizeStyle(`transform: rotate(${_ctx.hue}deg) translate(50%, 50%)`),
|
|
2787
|
+
role: "graphics-datagroup",
|
|
2788
|
+
"aria-datascales": "lightness, saturation"
|
|
2789
|
+
},
|
|
2790
|
+
[
|
|
2791
|
+
vue.createElementVNode("path", {
|
|
2792
|
+
d: _ctx.trianglePath,
|
|
2793
|
+
fill: `url(#cp-triangle-gradient-ligthness-${_ctx.id})`
|
|
2794
|
+
}, null, 8, _hoisted_15),
|
|
2795
|
+
vue.createElementVNode("path", {
|
|
2796
|
+
d: _ctx.trianglePath,
|
|
2797
|
+
fill: `url(#cp-triangle-gradient-saturation-${_ctx.id})`,
|
|
2798
|
+
style: { "mix-blend-mode": "overlay" },
|
|
2799
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
|
|
2800
|
+
onMousedown: _cache[8] || (_cache[8] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
|
|
2801
|
+
onTouchstart: _cache[9] || (_cache[9] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
2802
|
+
}, null, 40, _hoisted_16),
|
|
2803
|
+
(vue.openBlock(), vue.createElementBlock("foreignObject", {
|
|
2804
|
+
x: (_ctx.internalRadius - 3) * _ctx.cos30 * (-_ctx.lightness + 0.5) * 2 - 6,
|
|
2805
|
+
y: -_ctx.internalRadius + (1 - _ctx.saturation) * (_ctx.internalRadius - 3) * 1.5 - 3,
|
|
2806
|
+
width: "12",
|
|
2807
|
+
height: "12"
|
|
2808
|
+
}, [
|
|
2809
|
+
vue.createElementVNode("div", {
|
|
2810
|
+
ref: "slCursor",
|
|
2811
|
+
class: "sl-range-thumb",
|
|
2812
|
+
style: vue.normalizeStyle({
|
|
2813
|
+
backgroundColor: `hsl(${_ctx.hue}deg, ${_ctx.saturation * 100}%, ${_ctx.lightness * 100}%)`
|
|
2814
|
+
}),
|
|
2815
|
+
tabindex: "0",
|
|
2816
|
+
"aria-datavalues": `${_ctx.saturation * 100}%, ${_ctx.lightness * 100}%`,
|
|
2817
|
+
onClick: _cache[10] || (_cache[10] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
|
|
2818
|
+
onKeydown: _cache[11] || (_cache[11] = (...args) => _ctx.slKeyPress && _ctx.slKeyPress(...args)),
|
|
2819
|
+
onMousedown: _cache[12] || (_cache[12] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
|
|
2820
|
+
onTouchstart: _cache[13] || (_cache[13] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
2821
|
+
}, null, 44, _hoisted_18)
|
|
2822
|
+
], 8, _hoisted_17))
|
|
2823
|
+
],
|
|
2824
|
+
4
|
|
2825
|
+
/* STYLE */
|
|
2826
|
+
)
|
|
2827
|
+
], 8, _hoisted_1$3);
|
|
2828
|
+
}
|
|
2829
|
+
var BColorpickerHSLRepresentationTriangle = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
|
|
2830
|
+
|
|
2831
|
+
const precision = (strs, ...values) => {
|
|
2832
|
+
const tmp = [];
|
|
2833
|
+
strs.forEach((str, i) => {
|
|
2834
|
+
tmp.push(str);
|
|
2835
|
+
const value = values[i];
|
|
2836
|
+
if (value) {
|
|
2837
|
+
tmp.push(
|
|
2838
|
+
Number.isNaN(+value / 1) ? value : Math.round(+value * 10) / 10
|
|
2839
|
+
);
|
|
2840
|
+
}
|
|
2841
|
+
});
|
|
2842
|
+
return tmp.join("");
|
|
2843
|
+
};
|
|
2844
|
+
var _sfc_main$3 = vue.defineComponent({
|
|
2845
|
+
name: "BColorpickerHSLRepresentationSquare",
|
|
2846
|
+
props: {
|
|
2847
|
+
value: {
|
|
2848
|
+
type: Object,
|
|
2849
|
+
required: true,
|
|
2850
|
+
validator(value) {
|
|
2851
|
+
return typeof value.hue === "number" && typeof value.saturation === "number" && typeof value.lightness === "number";
|
|
2852
|
+
}
|
|
2853
|
+
},
|
|
2854
|
+
size: {
|
|
2855
|
+
type: Number,
|
|
2856
|
+
default: 200
|
|
2857
|
+
},
|
|
2858
|
+
thickness: {
|
|
2859
|
+
type: Number,
|
|
2860
|
+
default: 20
|
|
2861
|
+
}
|
|
2862
|
+
},
|
|
2863
|
+
emits: {
|
|
2864
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2865
|
+
input: (_value) => true
|
|
2866
|
+
},
|
|
2867
|
+
data() {
|
|
2868
|
+
return {
|
|
2869
|
+
hue: this.value.hue,
|
|
2870
|
+
saturation: this.value.saturation,
|
|
2871
|
+
lightness: this.value.lightness,
|
|
2872
|
+
captureMouse: false,
|
|
2873
|
+
captureType: "hue",
|
|
2874
|
+
clientOffset: {
|
|
2875
|
+
cx: -1,
|
|
2876
|
+
cy: -1,
|
|
2877
|
+
width: 0,
|
|
2878
|
+
height: 0
|
|
2879
|
+
},
|
|
2880
|
+
debounce: 0
|
|
2881
|
+
};
|
|
2882
|
+
},
|
|
2883
|
+
computed: {
|
|
2884
|
+
hueThumbStyle() {
|
|
2885
|
+
const { hue, size, thickness } = this;
|
|
2886
|
+
const side = size - thickness;
|
|
2887
|
+
const offset = size / 2;
|
|
2888
|
+
const angle = (hue + 720 + 90) % 360 / 180 * Math.PI;
|
|
2889
|
+
const ciq = 1 / Math.cos(Math.PI / 4);
|
|
2890
|
+
const { x, y } = {
|
|
2891
|
+
x: -Math.min(1, Math.max(-1, ciq * Math.cos(angle))) / 2 * side + offset,
|
|
2892
|
+
y: -Math.min(1, Math.max(-1, ciq * Math.sin(angle))) / 2 * side + offset
|
|
2893
|
+
};
|
|
2894
|
+
return {
|
|
2895
|
+
background: `hsl(${hue}deg, 100%, 50%)`,
|
|
2896
|
+
left: precision`${x}px`,
|
|
2897
|
+
top: precision`${y}px`,
|
|
2898
|
+
width: precision`${thickness - 2}px`
|
|
2899
|
+
};
|
|
2900
|
+
},
|
|
2901
|
+
slThumbStyle() {
|
|
2902
|
+
let { hue, saturation, lightness } = this;
|
|
2903
|
+
saturation = Math.max(0, Math.min(1, saturation));
|
|
2904
|
+
lightness = Math.max(0, Math.min(1, lightness));
|
|
2905
|
+
return {
|
|
2906
|
+
background: `hsl(${hue}deg, ${saturation * 100}%, ${lightness * 100}%)`,
|
|
2907
|
+
left: `${saturation * 100}%`,
|
|
2908
|
+
top: `${(1 - lightness) * 100}%`
|
|
2909
|
+
};
|
|
2910
|
+
},
|
|
2911
|
+
SLBackground() {
|
|
2912
|
+
const { hue } = this;
|
|
2913
|
+
return `linear-gradient(90deg, hsl(${hue}deg, 0%, 50%), hsl(${hue}deg, 100%, 50%))`;
|
|
2914
|
+
}
|
|
2915
|
+
},
|
|
2916
|
+
watch: {
|
|
2917
|
+
captureMouse(newValue, oldValue) {
|
|
2918
|
+
if (oldValue === false && newValue !== false) {
|
|
2919
|
+
const rect = this.$el.getBoundingClientRect();
|
|
2920
|
+
this.clientOffset.cx = rect.x + rect.width / 2;
|
|
2921
|
+
this.clientOffset.cy = rect.y + rect.height / 2;
|
|
2922
|
+
this.clientOffset.width = rect.width;
|
|
2923
|
+
this.clientOffset.height = rect.height;
|
|
2924
|
+
}
|
|
2925
|
+
},
|
|
2926
|
+
value: {
|
|
2927
|
+
deep: true,
|
|
2928
|
+
handler(newColor) {
|
|
2929
|
+
const { hue, saturation, lightness } = newColor;
|
|
2930
|
+
window.clearTimeout(this.debounce);
|
|
2931
|
+
this.debounce = window.setTimeout(() => {
|
|
2932
|
+
this.hue = hue;
|
|
2933
|
+
this.saturation = saturation;
|
|
2934
|
+
this.lightness = lightness;
|
|
2935
|
+
}, 200);
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
},
|
|
2939
|
+
methods: {
|
|
2940
|
+
increaseHue(value = 1) {
|
|
2941
|
+
this.hue = (this.hue + value) % 360;
|
|
2942
|
+
},
|
|
2943
|
+
decreaseHue(value = 1) {
|
|
2944
|
+
this.hue = (360 + this.hue - value) % 360;
|
|
2945
|
+
},
|
|
2946
|
+
increaseSaturation(value = 0.01) {
|
|
2947
|
+
this.saturation = Math.min(1, Math.max(0, this.saturation + value));
|
|
2948
|
+
this.lightness = Math.min(
|
|
2949
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2950
|
+
Math.max(
|
|
2951
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2952
|
+
this.lightness
|
|
2953
|
+
)
|
|
2954
|
+
);
|
|
2955
|
+
},
|
|
2956
|
+
decreaseSaturation(value = 0.01) {
|
|
2957
|
+
this.saturation = Math.min(1, Math.max(0, this.saturation - value));
|
|
2958
|
+
this.lightness = Math.min(
|
|
2959
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2960
|
+
Math.max(
|
|
2961
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2962
|
+
this.lightness
|
|
2963
|
+
)
|
|
2964
|
+
);
|
|
2965
|
+
},
|
|
2966
|
+
increaseLightness(value = 0.01) {
|
|
2967
|
+
this.lightness = Math.min(
|
|
2968
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2969
|
+
Math.max(
|
|
2970
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2971
|
+
this.lightness + value
|
|
2972
|
+
)
|
|
2973
|
+
);
|
|
2974
|
+
},
|
|
2975
|
+
decreaseLightness(value = 0.01) {
|
|
2976
|
+
this.lightness = Math.min(
|
|
2977
|
+
0.5 + (1 - this.saturation) * 0.5,
|
|
2978
|
+
Math.max(
|
|
2979
|
+
0.5 - (1 - this.saturation) * 0.5,
|
|
2980
|
+
this.lightness - value
|
|
2981
|
+
)
|
|
2982
|
+
);
|
|
2983
|
+
},
|
|
2984
|
+
hueKeyPress(event) {
|
|
2985
|
+
let handled = false;
|
|
2986
|
+
switch (event.key) {
|
|
2987
|
+
case "ArrowRight":
|
|
2988
|
+
case "ArrowUp":
|
|
2989
|
+
this.increaseHue();
|
|
2990
|
+
handled = true;
|
|
2991
|
+
break;
|
|
2992
|
+
case "ArrowLeft":
|
|
2993
|
+
case "ArrowDown":
|
|
2994
|
+
this.decreaseHue();
|
|
2995
|
+
handled = true;
|
|
2996
|
+
break;
|
|
2997
|
+
case "Home":
|
|
2998
|
+
this.increaseHue(360 - this.hue);
|
|
2999
|
+
handled = true;
|
|
3000
|
+
break;
|
|
3001
|
+
case "End":
|
|
3002
|
+
this.decreaseHue(this.hue);
|
|
3003
|
+
handled = true;
|
|
3004
|
+
break;
|
|
3005
|
+
case "PageUp":
|
|
3006
|
+
this.increaseHue(60 - this.hue % 60);
|
|
3007
|
+
handled = true;
|
|
3008
|
+
break;
|
|
3009
|
+
case "PageDown":
|
|
3010
|
+
this.decreaseHue(60 + this.hue % 60);
|
|
3011
|
+
handled = true;
|
|
3012
|
+
break;
|
|
3013
|
+
}
|
|
3014
|
+
if (handled) {
|
|
3015
|
+
event.preventDefault();
|
|
3016
|
+
event.stopPropagation();
|
|
3017
|
+
this.emitColor();
|
|
3018
|
+
}
|
|
3019
|
+
},
|
|
3020
|
+
slKeyPress(event) {
|
|
3021
|
+
let handled = false;
|
|
3022
|
+
switch (event.key) {
|
|
3023
|
+
case "ArrowRight":
|
|
3024
|
+
this.increaseSaturation();
|
|
3025
|
+
handled = true;
|
|
3026
|
+
break;
|
|
3027
|
+
case "ArrowUp":
|
|
3028
|
+
this.increaseLightness();
|
|
3029
|
+
handled = true;
|
|
3030
|
+
break;
|
|
3031
|
+
case "ArrowLeft":
|
|
3032
|
+
this.decreaseSaturation();
|
|
3033
|
+
handled = true;
|
|
3034
|
+
break;
|
|
3035
|
+
case "ArrowDown":
|
|
3036
|
+
this.decreaseLightness();
|
|
3037
|
+
handled = true;
|
|
3038
|
+
break;
|
|
3039
|
+
case "Home":
|
|
3040
|
+
this.increaseLightness(1 - this.lightness);
|
|
3041
|
+
handled = true;
|
|
3042
|
+
break;
|
|
3043
|
+
case "End":
|
|
3044
|
+
this.decreaseLightness(this.lightness);
|
|
3045
|
+
handled = true;
|
|
3046
|
+
break;
|
|
3047
|
+
case "PageUp":
|
|
3048
|
+
this.increaseSaturation(1 - this.saturation);
|
|
3049
|
+
handled = true;
|
|
3050
|
+
break;
|
|
3051
|
+
case "PageDown":
|
|
3052
|
+
this.decreaseSaturation(this.saturation);
|
|
3053
|
+
handled = true;
|
|
3054
|
+
break;
|
|
3055
|
+
}
|
|
3056
|
+
if (handled) {
|
|
3057
|
+
event.preventDefault();
|
|
3058
|
+
event.stopPropagation();
|
|
3059
|
+
this.emitColor();
|
|
3060
|
+
}
|
|
3061
|
+
},
|
|
3062
|
+
startMouseCapture(event) {
|
|
3063
|
+
event.stopPropagation();
|
|
3064
|
+
this.captureMouse = true;
|
|
3065
|
+
if (event.target.closest(".colorpicker-square-slider-sl") !== null) {
|
|
3066
|
+
this.captureType = "sl";
|
|
3067
|
+
} else {
|
|
3068
|
+
this.captureType = "hue";
|
|
3069
|
+
}
|
|
3070
|
+
},
|
|
3071
|
+
stopMouseCapture(event) {
|
|
3072
|
+
if (this.captureMouse !== false) {
|
|
3073
|
+
event.preventDefault();
|
|
3074
|
+
event.stopPropagation();
|
|
3075
|
+
this.$refs[this.captureType === "sl" ? "slCursor" : "hueCursor"].focus();
|
|
3076
|
+
}
|
|
3077
|
+
this.captureMouse = false;
|
|
3078
|
+
},
|
|
3079
|
+
clickHue(event) {
|
|
3080
|
+
this.startMouseCapture(event);
|
|
3081
|
+
this.trackMouse(event);
|
|
3082
|
+
this.stopMouseCapture(event);
|
|
3083
|
+
this.$refs.hueCursor.focus();
|
|
3084
|
+
},
|
|
3085
|
+
clickSL(event) {
|
|
3086
|
+
this.startMouseCapture(event);
|
|
3087
|
+
this.trackMouse(event);
|
|
3088
|
+
this.stopMouseCapture(event);
|
|
3089
|
+
this.$refs.slCursor.focus();
|
|
3090
|
+
},
|
|
3091
|
+
trackMouse(event) {
|
|
3092
|
+
if (this.captureMouse === false) {
|
|
3093
|
+
return;
|
|
3094
|
+
}
|
|
3095
|
+
event.preventDefault();
|
|
3096
|
+
event.stopPropagation();
|
|
3097
|
+
const touches = event.touches;
|
|
3098
|
+
let [mouseX, mouseY] = [0, 0];
|
|
3099
|
+
if (typeof touches !== "undefined" && touches.length) {
|
|
3100
|
+
[mouseX, mouseY] = [touches[0].clientX, touches[0].clientY];
|
|
3101
|
+
} else {
|
|
3102
|
+
[mouseX, mouseY] = [event.clientX, event.clientY];
|
|
3103
|
+
}
|
|
3104
|
+
const angle = Math.atan2(
|
|
3105
|
+
mouseY - this.clientOffset.cy,
|
|
3106
|
+
mouseX - this.clientOffset.cx
|
|
3107
|
+
);
|
|
3108
|
+
if (this.captureType === "sl") {
|
|
3109
|
+
const saturation = (mouseX - this.clientOffset.cx) / (this.clientOffset.width - this.thickness * 2) + 0.5;
|
|
3110
|
+
const lightness = (mouseY - this.clientOffset.cy) / (this.clientOffset.height - this.thickness * 2) + 0.5;
|
|
3111
|
+
this.saturation = Math.round(Math.min(1, Math.max(0, saturation)) * 1e3) / 1e3;
|
|
3112
|
+
this.lightness = 1 - Math.round(Math.min(1, Math.max(0, lightness)) * 1e3) / 1e3;
|
|
3113
|
+
} else {
|
|
3114
|
+
this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
|
|
3115
|
+
}
|
|
3116
|
+
this.emitColor();
|
|
3117
|
+
},
|
|
3118
|
+
emitColor() {
|
|
3119
|
+
const { hue, saturation, lightness } = this;
|
|
3120
|
+
this.$emit("input", Color.fromHSL(hue, saturation, lightness));
|
|
3121
|
+
window.clearTimeout(this.debounce);
|
|
3122
|
+
}
|
|
3123
|
+
},
|
|
3124
|
+
mounted() {
|
|
3125
|
+
window.addEventListener("mousemove", this.trackMouse);
|
|
3126
|
+
window.addEventListener("touchmove", this.trackMouse, { passive: false });
|
|
3127
|
+
window.addEventListener("mouseup", this.stopMouseCapture);
|
|
3128
|
+
window.addEventListener("touchend", this.stopMouseCapture);
|
|
3129
|
+
},
|
|
3130
|
+
beforeUnmount() {
|
|
3131
|
+
window.removeEventListener("mousemove", this.trackMouse);
|
|
3132
|
+
window.removeEventListener("touchmove", this.trackMouse);
|
|
3133
|
+
window.removeEventListener("mouseup", this.stopMouseCapture);
|
|
3134
|
+
window.removeEventListener("touchend", this.stopMouseCapture);
|
|
3135
|
+
clearTimeout(this.debounce);
|
|
3136
|
+
}
|
|
3137
|
+
});
|
|
3138
|
+
|
|
3139
|
+
const _hoisted_1$2 = ["aria-datavalues"];
|
|
3140
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3141
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
3142
|
+
"div",
|
|
3143
|
+
{
|
|
3144
|
+
class: "b-colorpicker-square",
|
|
3145
|
+
style: vue.normalizeStyle({ width: `${_ctx.size}px` })
|
|
3146
|
+
},
|
|
3147
|
+
[
|
|
3148
|
+
vue.createElementVNode(
|
|
3149
|
+
"div",
|
|
3150
|
+
{
|
|
3151
|
+
class: "colorpicker-square-slider-hue",
|
|
3152
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHue && _ctx.clickHue(...args)),
|
|
3153
|
+
onMousedown: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
|
|
3154
|
+
onTouchstart: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
3155
|
+
},
|
|
3156
|
+
[
|
|
3157
|
+
vue.createElementVNode(
|
|
3158
|
+
"div",
|
|
3159
|
+
{
|
|
3160
|
+
ref: "hueCursor",
|
|
3161
|
+
role: "slider",
|
|
3162
|
+
class: "hue-range-thumb",
|
|
3163
|
+
tabindex: "0",
|
|
3164
|
+
"aria-label": "Hue",
|
|
3165
|
+
"aria-valuemin": "0",
|
|
3166
|
+
"aria-valuemax": "359",
|
|
3167
|
+
style: vue.normalizeStyle(_ctx.hueThumbStyle)
|
|
3168
|
+
},
|
|
3169
|
+
null,
|
|
3170
|
+
4
|
|
3171
|
+
/* STYLE */
|
|
3172
|
+
)
|
|
3173
|
+
],
|
|
3174
|
+
32
|
|
3175
|
+
/* NEED_HYDRATION */
|
|
3176
|
+
),
|
|
3177
|
+
vue.createElementVNode(
|
|
3178
|
+
"div",
|
|
3179
|
+
{
|
|
3180
|
+
class: "colorpicker-square-slider-sl",
|
|
3181
|
+
style: vue.normalizeStyle({
|
|
3182
|
+
background: _ctx.SLBackground,
|
|
3183
|
+
margin: `${_ctx.thickness}px`
|
|
3184
|
+
}),
|
|
3185
|
+
"aria-datascales": "lightness, saturation",
|
|
3186
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
|
|
3187
|
+
onMousedown: _cache[8] || (_cache[8] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
|
|
3188
|
+
onTouchstart: _cache[9] || (_cache[9] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
3189
|
+
},
|
|
3190
|
+
[
|
|
3191
|
+
vue.createElementVNode("div", {
|
|
3192
|
+
ref: "slCursor",
|
|
3193
|
+
role: "slider",
|
|
3194
|
+
class: "sl-range-thumb",
|
|
3195
|
+
tabindex: "0",
|
|
3196
|
+
"aria-datavalues": `${_ctx.saturation * 100}%, ${_ctx.lightness * 100}%`,
|
|
3197
|
+
style: vue.normalizeStyle(_ctx.slThumbStyle),
|
|
3198
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
|
|
3199
|
+
onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.slKeyPress && _ctx.slKeyPress(...args)),
|
|
3200
|
+
onMousedown: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
|
|
3201
|
+
onTouchstart: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
3202
|
+
}, null, 44, _hoisted_1$2)
|
|
3203
|
+
],
|
|
3204
|
+
36
|
|
3205
|
+
/* STYLE, NEED_HYDRATION */
|
|
3206
|
+
)
|
|
3207
|
+
],
|
|
3208
|
+
4
|
|
3209
|
+
/* STYLE */
|
|
3210
|
+
);
|
|
3211
|
+
}
|
|
3212
|
+
var BColorpickerHSLRepresentationSquare = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
3213
|
+
|
|
3214
|
+
const TOOLTIP_POSITIONS = ["is-auto", "is-top", "is-bottom", "is-left", "is-right"];
|
|
3215
|
+
var _sfc_main$2 = vue.defineComponent({
|
|
3216
|
+
name: "BTooltip",
|
|
3217
|
+
props: {
|
|
3218
|
+
active: {
|
|
3219
|
+
type: Boolean,
|
|
3220
|
+
default: true
|
|
3221
|
+
},
|
|
3222
|
+
type: {
|
|
3223
|
+
type: String,
|
|
3224
|
+
default: () => config.defaultTooltipType
|
|
3225
|
+
},
|
|
3226
|
+
label: String,
|
|
3227
|
+
delay: {
|
|
3228
|
+
type: Number,
|
|
3229
|
+
default: () => config.defaultTooltipDelay
|
|
3230
|
+
},
|
|
3231
|
+
closeDelay: {
|
|
3232
|
+
type: Number,
|
|
3233
|
+
default: () => config.defaultTooltipCloseDelay
|
|
3234
|
+
},
|
|
3235
|
+
position: {
|
|
3236
|
+
type: String,
|
|
3237
|
+
default: "is-auto",
|
|
3238
|
+
validator(value) {
|
|
3239
|
+
return TOOLTIP_POSITIONS.indexOf(value) > -1;
|
|
3240
|
+
}
|
|
3241
|
+
},
|
|
3242
|
+
triggers: {
|
|
3243
|
+
type: Array,
|
|
3244
|
+
default: () => ["hover"]
|
|
3245
|
+
},
|
|
3246
|
+
always: Boolean,
|
|
3247
|
+
square: Boolean,
|
|
3248
|
+
dashed: Boolean,
|
|
3249
|
+
multilined: Boolean,
|
|
3250
|
+
size: {
|
|
3251
|
+
type: String,
|
|
3252
|
+
default: "is-medium"
|
|
3253
|
+
},
|
|
3254
|
+
appendToBody: Boolean,
|
|
3255
|
+
animated: {
|
|
3256
|
+
type: Boolean,
|
|
3257
|
+
default: true
|
|
3258
|
+
},
|
|
3259
|
+
animation: {
|
|
3260
|
+
type: String,
|
|
3261
|
+
default: "fade"
|
|
3262
|
+
},
|
|
3263
|
+
contentClass: String,
|
|
3264
|
+
autoClose: {
|
|
3265
|
+
type: [Array, Boolean],
|
|
3266
|
+
default: true
|
|
3267
|
+
}
|
|
3268
|
+
},
|
|
3269
|
+
emits: {
|
|
3270
|
+
close: () => true,
|
|
3271
|
+
open: () => true
|
|
3272
|
+
},
|
|
3273
|
+
data() {
|
|
3274
|
+
return {
|
|
3275
|
+
isActive: false,
|
|
3276
|
+
triggerStyle: {},
|
|
3277
|
+
timer: void 0,
|
|
3278
|
+
_bodyEl: void 0,
|
|
3279
|
+
// Used to append to body
|
|
3280
|
+
resizeObserver: void 0,
|
|
3281
|
+
resizeListener: void 0,
|
|
3282
|
+
timeOutID: void 0,
|
|
3283
|
+
controller: void 0,
|
|
3284
|
+
dynamicPosition: void 0
|
|
3285
|
+
// Computed once opened
|
|
3286
|
+
};
|
|
3287
|
+
},
|
|
3288
|
+
computed: {
|
|
3289
|
+
rootClasses() {
|
|
3290
|
+
return ["b-tooltip", this.type, this.dynamicPosition, this.size, {
|
|
3291
|
+
"is-square": this.square,
|
|
3292
|
+
"is-always": this.always,
|
|
3293
|
+
"is-multiline": this.multilined,
|
|
3294
|
+
"is-dashed": this.dashed
|
|
3295
|
+
}];
|
|
3296
|
+
},
|
|
3297
|
+
newAnimation() {
|
|
3298
|
+
return this.animated ? this.animation : void 0;
|
|
3299
|
+
}
|
|
3300
|
+
},
|
|
3301
|
+
watch: {
|
|
3302
|
+
isActive() {
|
|
3303
|
+
this.isActive ? this.$emit("open") : this.$emit("close");
|
|
3304
|
+
if (this.appendToBody) {
|
|
3305
|
+
this.updateAppendToBody();
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
},
|
|
3309
|
+
methods: {
|
|
3310
|
+
computePosition() {
|
|
3311
|
+
if (this.position !== "is-auto") return this.position;
|
|
3312
|
+
const trigger = this.$refs.trigger;
|
|
3313
|
+
const bounds = trigger.getBoundingClientRect();
|
|
3314
|
+
const dt = bounds.top;
|
|
3315
|
+
const db = window.innerHeight - bounds.bottom;
|
|
3316
|
+
const dl = bounds.left;
|
|
3317
|
+
const dr = window.innerWidth - bounds.right;
|
|
3318
|
+
const min = Math.min(dt, db, dl, dr);
|
|
3319
|
+
if (min === dt) {
|
|
3320
|
+
return "is-bottom";
|
|
3321
|
+
} else if (min === db) {
|
|
3322
|
+
return "is-top";
|
|
3323
|
+
} else if (min === dl) {
|
|
3324
|
+
return "is-right";
|
|
3325
|
+
} else {
|
|
3326
|
+
return "is-left";
|
|
3327
|
+
}
|
|
3328
|
+
},
|
|
3329
|
+
updateAppendToBody() {
|
|
3330
|
+
const tooltip = this.$refs.tooltip;
|
|
3331
|
+
const trigger = this.$refs.trigger;
|
|
3332
|
+
if (tooltip && trigger) {
|
|
3333
|
+
const tooltipEl = this.$data._bodyEl.children[0];
|
|
3334
|
+
tooltipEl.classList.forEach((item) => tooltipEl.classList.remove(item));
|
|
3335
|
+
this.rootClasses.forEach((item) => {
|
|
3336
|
+
if (typeof item === "object") {
|
|
3337
|
+
const record = item;
|
|
3338
|
+
for (const key in record) {
|
|
3339
|
+
if (record[key]) {
|
|
3340
|
+
tooltipEl.classList.add(key);
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
} else {
|
|
3344
|
+
tooltipEl.classList.add(item);
|
|
3345
|
+
}
|
|
3346
|
+
});
|
|
3347
|
+
const rect = trigger.getBoundingClientRect();
|
|
3348
|
+
const top = rect.top + window.scrollY;
|
|
3349
|
+
const left = rect.left + window.scrollX;
|
|
3350
|
+
tooltipEl.style.position = "absolute";
|
|
3351
|
+
this.dynamicPosition = this.computePosition();
|
|
3352
|
+
switch (this.dynamicPosition) {
|
|
3353
|
+
case "is-top":
|
|
3354
|
+
tooltipEl.style.width = `${trigger.clientWidth}px`;
|
|
3355
|
+
tooltipEl.style.height = "0px";
|
|
3356
|
+
tooltipEl.style.top = "0px";
|
|
3357
|
+
tooltipEl.style.left = "0px";
|
|
3358
|
+
break;
|
|
3359
|
+
case "is-bottom":
|
|
3360
|
+
tooltipEl.style.width = `${trigger.clientWidth}px`;
|
|
3361
|
+
tooltipEl.style.height = "0px";
|
|
3362
|
+
tooltipEl.style.top = `${trigger.clientHeight}px`;
|
|
3363
|
+
tooltipEl.style.left = "0px";
|
|
3364
|
+
break;
|
|
3365
|
+
case "is-left":
|
|
3366
|
+
tooltipEl.style.width = "0px";
|
|
3367
|
+
tooltipEl.style.height = `${trigger.clientHeight}px`;
|
|
3368
|
+
tooltipEl.style.top = "0px";
|
|
3369
|
+
tooltipEl.style.left = "0px";
|
|
3370
|
+
break;
|
|
3371
|
+
case "is-right":
|
|
3372
|
+
tooltipEl.style.width = "0px";
|
|
3373
|
+
tooltipEl.style.height = `${trigger.clientHeight}px`;
|
|
3374
|
+
tooltipEl.style.top = "0px";
|
|
3375
|
+
tooltipEl.style.left = `${trigger.clientWidth}px`;
|
|
3376
|
+
break;
|
|
3377
|
+
}
|
|
3378
|
+
const wrapper = this.$data._bodyEl;
|
|
3379
|
+
wrapper.style.position = "absolute";
|
|
3380
|
+
wrapper.style.top = `${top}px`;
|
|
3381
|
+
wrapper.style.left = `${left}px`;
|
|
3382
|
+
wrapper.style.width = "0px";
|
|
3383
|
+
wrapper.style.zIndex = this.isActive || this.always ? "99" : "-1";
|
|
3384
|
+
this.triggerStyle = {
|
|
3385
|
+
zIndex: this.isActive || this.always ? "100" : void 0
|
|
3386
|
+
};
|
|
3387
|
+
}
|
|
3388
|
+
},
|
|
3389
|
+
onClick() {
|
|
3390
|
+
if (this.triggers.indexOf("click") < 0) return;
|
|
3391
|
+
this.$nextTick(() => {
|
|
3392
|
+
this.timeOutID = setTimeout(() => this.open());
|
|
3393
|
+
});
|
|
3394
|
+
},
|
|
3395
|
+
onHover() {
|
|
3396
|
+
if (this.triggers.indexOf("hover") < 0) return;
|
|
3397
|
+
this.open();
|
|
3398
|
+
},
|
|
3399
|
+
onContextMenu(e) {
|
|
3400
|
+
if (this.triggers.indexOf("contextmenu") < 0) return;
|
|
3401
|
+
e.preventDefault();
|
|
3402
|
+
this.open();
|
|
3403
|
+
},
|
|
3404
|
+
onFocus() {
|
|
3405
|
+
if (this.triggers.indexOf("focus") < 0) return;
|
|
3406
|
+
this.open();
|
|
3407
|
+
},
|
|
3408
|
+
open() {
|
|
3409
|
+
this.dynamicPosition = this.computePosition();
|
|
3410
|
+
if (this.delay) {
|
|
3411
|
+
this.timer = setTimeout(() => {
|
|
3412
|
+
this.isActive = true;
|
|
3413
|
+
this.timer = void 0;
|
|
3414
|
+
}, this.delay);
|
|
3415
|
+
} else {
|
|
3416
|
+
this.isActive = true;
|
|
3417
|
+
}
|
|
3418
|
+
},
|
|
3419
|
+
close() {
|
|
3420
|
+
if (typeof this.autoClose === "boolean") {
|
|
3421
|
+
if (this.autoClose && this.timer) clearTimeout(this.timer);
|
|
3422
|
+
if (this.closeDelay) {
|
|
3423
|
+
this.timer = setTimeout(() => {
|
|
3424
|
+
this.isActive = !this.autoClose;
|
|
3425
|
+
this.timer = void 0;
|
|
3426
|
+
}, this.closeDelay);
|
|
3427
|
+
} else {
|
|
3428
|
+
this.isActive = !this.autoClose;
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
},
|
|
3432
|
+
/*
|
|
3433
|
+
* Close tooltip if clicked outside.
|
|
3434
|
+
*/
|
|
3435
|
+
clickedOutside(event) {
|
|
3436
|
+
if (this.isActive) {
|
|
3437
|
+
if (Array.isArray(this.autoClose)) {
|
|
3438
|
+
if (this.autoClose.includes("outside")) {
|
|
3439
|
+
if (!this.isInWhiteList(event.target)) {
|
|
3440
|
+
this.isActive = false;
|
|
3441
|
+
return;
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
if (this.autoClose.includes("inside")) {
|
|
3445
|
+
if (this.isInWhiteList(event.target)) this.isActive = false;
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
},
|
|
3450
|
+
/*
|
|
3451
|
+
* Keypress event that is bound to the document
|
|
3452
|
+
*/
|
|
3453
|
+
keyPress({ key }) {
|
|
3454
|
+
if (this.isActive && (key === "Escape" || key === "Esc")) {
|
|
3455
|
+
if (Array.isArray(this.autoClose)) {
|
|
3456
|
+
if (this.autoClose.indexOf("escape") >= 0) this.isActive = false;
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
},
|
|
3460
|
+
/*
|
|
3461
|
+
* White-listed items to not close when clicked.
|
|
3462
|
+
*/
|
|
3463
|
+
isInWhiteList(el) {
|
|
3464
|
+
if (el === this.$refs.content) return true;
|
|
3465
|
+
if (this.$refs.content != null) {
|
|
3466
|
+
const children = this.$refs.content.querySelectorAll("*");
|
|
3467
|
+
for (const child of children) {
|
|
3468
|
+
if (el === child) {
|
|
3469
|
+
return true;
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
return false;
|
|
3474
|
+
}
|
|
3475
|
+
},
|
|
3476
|
+
mounted() {
|
|
3477
|
+
if (this.appendToBody && typeof window !== "undefined") {
|
|
3478
|
+
this.controller = new window.AbortController();
|
|
3479
|
+
this.$data._bodyEl = createAbsoluteElement(this.$refs.content);
|
|
3480
|
+
this.updateAppendToBody();
|
|
3481
|
+
const animation = this.$el.closest(".animation-content");
|
|
3482
|
+
if (animation != null) {
|
|
3483
|
+
const listener = () => {
|
|
3484
|
+
this.updateAppendToBody();
|
|
3485
|
+
animation.removeEventListener("transitionend", listener);
|
|
3486
|
+
};
|
|
3487
|
+
animation.addEventListener("transitionend", listener, {
|
|
3488
|
+
signal: this.controller.signal
|
|
3489
|
+
});
|
|
3490
|
+
}
|
|
3491
|
+
this.resizeListener = () => this.updateAppendToBody();
|
|
3492
|
+
window.addEventListener("resize", this.resizeListener);
|
|
3493
|
+
this.resizeObserver = new ResizeObserver(this.resizeListener);
|
|
3494
|
+
if (this.$el.parentNode != null && this.$el.parentNode.nodeType === Node.ELEMENT_NODE) {
|
|
3495
|
+
this.resizeObserver.observe(this.$el.parentNode);
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
if (this.always) {
|
|
3499
|
+
this.dynamicPosition = this.computePosition();
|
|
3500
|
+
}
|
|
3501
|
+
},
|
|
3502
|
+
created() {
|
|
3503
|
+
if (typeof window !== "undefined") {
|
|
3504
|
+
document.addEventListener("click", this.clickedOutside);
|
|
3505
|
+
document.addEventListener("keyup", this.keyPress);
|
|
3506
|
+
}
|
|
3507
|
+
},
|
|
3508
|
+
beforeUnmount() {
|
|
3509
|
+
if (typeof window !== "undefined") {
|
|
3510
|
+
document.removeEventListener("click", this.clickedOutside);
|
|
3511
|
+
document.removeEventListener("keyup", this.keyPress);
|
|
3512
|
+
}
|
|
3513
|
+
if (this.resizeListener != null) {
|
|
3514
|
+
window.removeEventListener("resize", this.resizeListener);
|
|
3515
|
+
}
|
|
3516
|
+
if (this.resizeObserver != null) {
|
|
3517
|
+
this.resizeObserver.disconnect();
|
|
3518
|
+
}
|
|
3519
|
+
if (this.appendToBody) {
|
|
3520
|
+
removeElement(this.$data._bodyEl);
|
|
3521
|
+
}
|
|
3522
|
+
if (this.controller != null) {
|
|
3523
|
+
this.controller.abort();
|
|
3524
|
+
}
|
|
3525
|
+
clearTimeout(this.timer);
|
|
3526
|
+
clearTimeout(this.timeOutID);
|
|
3527
|
+
}
|
|
3528
|
+
});
|
|
3529
|
+
|
|
3530
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3531
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
3532
|
+
"div",
|
|
3533
|
+
{
|
|
3534
|
+
ref: "tooltip",
|
|
3535
|
+
class: vue.normalizeClass(_ctx.rootClasses)
|
|
3536
|
+
},
|
|
3537
|
+
[
|
|
3538
|
+
vue.createVNode(vue.Transition, {
|
|
3539
|
+
name: _ctx.newAnimation,
|
|
3540
|
+
persisted: ""
|
|
3541
|
+
}, {
|
|
3542
|
+
default: vue.withCtx(() => [
|
|
3543
|
+
vue.withDirectives(vue.createElementVNode(
|
|
3544
|
+
"div",
|
|
3545
|
+
{
|
|
3546
|
+
ref: "content",
|
|
3547
|
+
class: vue.normalizeClass(["tooltip-content", _ctx.contentClass])
|
|
3548
|
+
},
|
|
3549
|
+
[
|
|
3550
|
+
_ctx.label ? (vue.openBlock(), vue.createElementBlock(
|
|
3551
|
+
vue.Fragment,
|
|
3552
|
+
{ key: 0 },
|
|
3553
|
+
[
|
|
3554
|
+
vue.createTextVNode(
|
|
3555
|
+
vue.toDisplayString(_ctx.label),
|
|
3556
|
+
1
|
|
3557
|
+
/* TEXT */
|
|
3558
|
+
)
|
|
3559
|
+
],
|
|
3560
|
+
64
|
|
3561
|
+
/* STABLE_FRAGMENT */
|
|
3562
|
+
)) : _ctx.$slots.content ? vue.renderSlot(_ctx.$slots, "content", { key: 1 }) : vue.createCommentVNode("v-if", true)
|
|
3563
|
+
],
|
|
3564
|
+
2
|
|
3565
|
+
/* CLASS */
|
|
3566
|
+
), [
|
|
3567
|
+
[vue.vShow, _ctx.active && (_ctx.isActive || _ctx.always)]
|
|
3568
|
+
])
|
|
3569
|
+
]),
|
|
3570
|
+
_: 3
|
|
3571
|
+
/* FORWARDED */
|
|
3572
|
+
}, 8, ["name"]),
|
|
3573
|
+
vue.createElementVNode(
|
|
3574
|
+
"div",
|
|
3575
|
+
{
|
|
3576
|
+
ref: "trigger",
|
|
3577
|
+
class: "tooltip-trigger",
|
|
3578
|
+
style: vue.normalizeStyle(_ctx.triggerStyle),
|
|
3579
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
|
|
3580
|
+
onContextmenu: _cache[1] || (_cache[1] = (...args) => _ctx.onContextMenu && _ctx.onContextMenu(...args)),
|
|
3581
|
+
onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.onHover && _ctx.onHover(...args)),
|
|
3582
|
+
onFocusCapture: _cache[3] || (_cache[3] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
|
|
3583
|
+
onBlurCapture: _cache[4] || (_cache[4] = (...args) => _ctx.close && _ctx.close(...args)),
|
|
3584
|
+
onMouseleave: _cache[5] || (_cache[5] = (...args) => _ctx.close && _ctx.close(...args))
|
|
3585
|
+
},
|
|
3586
|
+
[
|
|
3587
|
+
vue.renderSlot(_ctx.$slots, "default", { ref: "slot" })
|
|
3588
|
+
],
|
|
3589
|
+
36
|
|
3590
|
+
/* STYLE, NEED_HYDRATION */
|
|
3591
|
+
)
|
|
3592
|
+
],
|
|
3593
|
+
2
|
|
3594
|
+
/* CLASS */
|
|
3595
|
+
);
|
|
3596
|
+
}
|
|
3597
|
+
var BTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
3598
|
+
|
|
3599
|
+
var _sfc_main$1 = vue.defineComponent({
|
|
3600
|
+
name: "BColorpickerAlphaSlider",
|
|
3601
|
+
components: {
|
|
3602
|
+
BTooltip
|
|
3603
|
+
},
|
|
3604
|
+
props: {
|
|
3605
|
+
value: {
|
|
3606
|
+
type: Number,
|
|
3607
|
+
validator: (value) => value >= 0 && value < 256
|
|
3608
|
+
},
|
|
3609
|
+
color: [String, Object]
|
|
3610
|
+
},
|
|
3611
|
+
emits: {
|
|
3612
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3613
|
+
input: (_value) => true
|
|
3614
|
+
},
|
|
3615
|
+
data() {
|
|
3616
|
+
const color = Color.parse(this.color);
|
|
3617
|
+
color.alpha = 0;
|
|
3618
|
+
return {
|
|
3619
|
+
startColor: color.toString("hex"),
|
|
3620
|
+
endColor: color.toString("hexa"),
|
|
3621
|
+
percent: Math.round((1 - this.value / 255) * 100),
|
|
3622
|
+
captureMouse: false,
|
|
3623
|
+
clientOffset: {
|
|
3624
|
+
cx: -1,
|
|
3625
|
+
cy: -1,
|
|
3626
|
+
width: 0,
|
|
3627
|
+
height: 0
|
|
3628
|
+
}
|
|
3629
|
+
};
|
|
3630
|
+
},
|
|
3631
|
+
computed: {
|
|
3632
|
+
style() {
|
|
3633
|
+
return {
|
|
3634
|
+
backgroundImage: `linear-gradient(90deg, ${this.startColor} 0%, ${this.endColor} 100%),
|
|
3635
|
+
linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7),
|
|
3636
|
+
linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7)`,
|
|
3637
|
+
backgroundSize: "100% 100%, 1em 1em, 1em 1em",
|
|
3638
|
+
backgroundPosition: "0 0, .5em .5em, 0 0"
|
|
3639
|
+
};
|
|
3640
|
+
}
|
|
3641
|
+
},
|
|
3642
|
+
watch: {
|
|
3643
|
+
value(newValue, oldValue) {
|
|
3644
|
+
if (newValue !== oldValue) {
|
|
3645
|
+
this.percent = Math.round((1 - newValue / 255) * 100);
|
|
3646
|
+
}
|
|
3647
|
+
},
|
|
3648
|
+
color(newColor) {
|
|
3649
|
+
const color = Color.parse(newColor);
|
|
3650
|
+
color.alpha = 0;
|
|
3651
|
+
this.startColor = color.toString("hex");
|
|
3652
|
+
this.endColor = color.toString("hexa");
|
|
3653
|
+
},
|
|
3654
|
+
captureMouse(newValue, oldValue) {
|
|
3655
|
+
if (oldValue === false && newValue !== false) {
|
|
3656
|
+
const rect = this.$el.getBoundingClientRect();
|
|
3657
|
+
this.clientOffset.cx = rect.x + rect.width / 2;
|
|
3658
|
+
this.clientOffset.cy = rect.y + rect.height / 2;
|
|
3659
|
+
this.clientOffset.width = rect.width;
|
|
3660
|
+
this.clientOffset.height = rect.height;
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
},
|
|
3664
|
+
methods: {
|
|
3665
|
+
increaseAlpha(value = 1) {
|
|
3666
|
+
this.percent = Math.max(0, Math.min(100, this.percent + value));
|
|
3667
|
+
},
|
|
3668
|
+
decreaseAlpha(value = 0.01) {
|
|
3669
|
+
this.increaseAlpha(-value);
|
|
3670
|
+
},
|
|
3671
|
+
alphaKeyPress(event) {
|
|
3672
|
+
let handled = false;
|
|
3673
|
+
switch (event.key) {
|
|
3674
|
+
case "ArrowRight":
|
|
3675
|
+
case "ArrowUp":
|
|
3676
|
+
this.increaseAlpha();
|
|
3677
|
+
handled = true;
|
|
3678
|
+
break;
|
|
3679
|
+
case "ArrowLeft":
|
|
3680
|
+
case "ArrowDown":
|
|
3681
|
+
this.decreaseAlpha();
|
|
3682
|
+
handled = true;
|
|
3683
|
+
break;
|
|
3684
|
+
case "Home":
|
|
3685
|
+
this.decreaseAlpha(this.percent);
|
|
3686
|
+
handled = true;
|
|
3687
|
+
break;
|
|
3688
|
+
case "End":
|
|
3689
|
+
this.increaseAlpha(100 - this.percent);
|
|
3690
|
+
handled = true;
|
|
3691
|
+
break;
|
|
3692
|
+
case "PageUp":
|
|
3693
|
+
this.increaseAlpha(10 - this.percent % 10);
|
|
3694
|
+
handled = true;
|
|
3695
|
+
break;
|
|
3696
|
+
case "PageDown":
|
|
3697
|
+
this.decreaseAlpha(this.percent % 10);
|
|
3698
|
+
handled = true;
|
|
3699
|
+
break;
|
|
3700
|
+
}
|
|
3701
|
+
if (handled) {
|
|
3702
|
+
event.preventDefault();
|
|
3703
|
+
event.stopPropagation();
|
|
3704
|
+
this.emitAlpha();
|
|
3705
|
+
}
|
|
3706
|
+
},
|
|
3707
|
+
clickAlpha(event) {
|
|
3708
|
+
this.startMouseCapture(event);
|
|
3709
|
+
this.trackMouse(event);
|
|
3710
|
+
this.stopMouseCapture(event);
|
|
3711
|
+
this.$refs.alphaCursor.focus();
|
|
3712
|
+
},
|
|
3713
|
+
startMouseCapture(event) {
|
|
3714
|
+
event.stopPropagation();
|
|
3715
|
+
this.captureMouse = true;
|
|
3716
|
+
},
|
|
3717
|
+
trackMouse(event) {
|
|
3718
|
+
if (this.captureMouse === false) {
|
|
3719
|
+
return;
|
|
3720
|
+
}
|
|
3721
|
+
event.preventDefault();
|
|
3722
|
+
event.stopPropagation();
|
|
3723
|
+
let [mouseX] = [0, 0];
|
|
3724
|
+
const touches = event.touches;
|
|
3725
|
+
if (typeof touches !== "undefined" && touches.length) {
|
|
3726
|
+
[mouseX] = [touches[0].clientX];
|
|
3727
|
+
} else {
|
|
3728
|
+
[mouseX] = [event.clientX];
|
|
3729
|
+
}
|
|
3730
|
+
const ratio = 0.5 + (this.clientOffset.cx - mouseX) / this.clientOffset.width;
|
|
3731
|
+
this.percent = Math.round(100 - Math.max(0, Math.min(1, ratio)) * 100);
|
|
3732
|
+
this.emitAlpha();
|
|
3733
|
+
},
|
|
3734
|
+
stopMouseCapture(event) {
|
|
3735
|
+
if (this.captureMouse !== false) {
|
|
3736
|
+
event.preventDefault();
|
|
3737
|
+
event.stopPropagation();
|
|
3738
|
+
this.$refs.alphaCursor.focus();
|
|
3739
|
+
}
|
|
3740
|
+
this.captureMouse = false;
|
|
3741
|
+
},
|
|
3742
|
+
emitAlpha() {
|
|
3743
|
+
this.$emit("input", (1 - this.percent / 100) * 255);
|
|
3744
|
+
}
|
|
3745
|
+
},
|
|
3746
|
+
mounted() {
|
|
3747
|
+
window.addEventListener("mousemove", this.trackMouse);
|
|
3748
|
+
window.addEventListener("touchmove", this.trackMouse, { passive: false });
|
|
3749
|
+
window.addEventListener("mouseup", this.stopMouseCapture);
|
|
3750
|
+
window.addEventListener("touchend", this.stopMouseCapture);
|
|
3751
|
+
},
|
|
3752
|
+
beforeUnmount() {
|
|
3753
|
+
window.removeEventListener("mousemove", this.trackMouse);
|
|
3754
|
+
window.removeEventListener("touchmove", this.trackMouse);
|
|
3755
|
+
window.removeEventListener("mouseup", this.stopMouseCapture);
|
|
3756
|
+
window.removeEventListener("touchend", this.stopMouseCapture);
|
|
3757
|
+
}
|
|
3758
|
+
});
|
|
3759
|
+
|
|
3760
|
+
const _hoisted_1$1 = ["aria-valuenow"];
|
|
3761
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3762
|
+
const _component_b_tooltip = vue.resolveComponent("b-tooltip");
|
|
3763
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
3764
|
+
"div",
|
|
3765
|
+
{
|
|
3766
|
+
class: "b-colorpicker-alpha-slider",
|
|
3767
|
+
style: vue.normalizeStyle(_ctx.style),
|
|
3768
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickAlpha && _ctx.clickAlpha(...args)),
|
|
3769
|
+
onKeydown: _cache[1] || (_cache[1] = (...args) => _ctx.alphaKeyPress && _ctx.alphaKeyPress(...args)),
|
|
3770
|
+
onMousedown: _cache[2] || (_cache[2] = (...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args)),
|
|
3771
|
+
onTouchstart: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
|
|
3772
|
+
},
|
|
3773
|
+
[
|
|
3774
|
+
vue.createElementVNode("div", {
|
|
3775
|
+
ref: "alphaCursor",
|
|
3776
|
+
role: "slider",
|
|
3777
|
+
class: "alpha-range-thumb",
|
|
3778
|
+
tabindex: "0",
|
|
3779
|
+
"aria-label": "Tranparency",
|
|
3780
|
+
"aria-valuemin": "0",
|
|
3781
|
+
"aria-valuenow": _ctx.percent,
|
|
3782
|
+
"aria-valuemax": "100",
|
|
3783
|
+
style: vue.normalizeStyle({ left: `${_ctx.percent}%` })
|
|
3784
|
+
}, [
|
|
3785
|
+
vue.createVNode(_component_b_tooltip, {
|
|
3786
|
+
label: `${_ctx.percent}%`,
|
|
3787
|
+
always: _ctx.captureMouse,
|
|
3788
|
+
position: "is-top"
|
|
3789
|
+
}, {
|
|
3790
|
+
default: vue.withCtx(() => [
|
|
3791
|
+
vue.createTextVNode(" ")
|
|
3792
|
+
]),
|
|
3793
|
+
_: 1
|
|
3794
|
+
/* STABLE */
|
|
3795
|
+
}, 8, ["label", "always"])
|
|
3796
|
+
], 12, _hoisted_1$1)
|
|
3797
|
+
],
|
|
3798
|
+
36
|
|
3799
|
+
/* STYLE, NEED_HYDRATION */
|
|
3800
|
+
);
|
|
3801
|
+
}
|
|
3802
|
+
var BColorpickerAlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
3803
|
+
|
|
3804
|
+
const defaultColorFormatter = (color) => {
|
|
3805
|
+
if (color.alpha < 1) {
|
|
3806
|
+
return color.toString("hexa");
|
|
3807
|
+
} else {
|
|
3808
|
+
return color.toString("hex");
|
|
3809
|
+
}
|
|
3810
|
+
};
|
|
3811
|
+
const defaultColorParser = (color) => {
|
|
3812
|
+
return Color.parse(color);
|
|
3813
|
+
};
|
|
3814
|
+
var _sfc_main = vue.defineComponent({
|
|
3815
|
+
name: "BColorpicker",
|
|
3816
|
+
components: {
|
|
3817
|
+
BColorpickerHSLRepresentationTriangle,
|
|
3818
|
+
BColorpickerHSLRepresentationSquare,
|
|
3819
|
+
BColorpickerAlphaSlider,
|
|
3820
|
+
BInput,
|
|
3821
|
+
BField,
|
|
3822
|
+
BButton,
|
|
3823
|
+
BDropdown,
|
|
3824
|
+
BDropdownItem
|
|
3825
|
+
},
|
|
3826
|
+
mixins: [FormElementMixin],
|
|
3827
|
+
inheritAttrs: false,
|
|
3828
|
+
provide() {
|
|
3829
|
+
return {
|
|
3830
|
+
$colorpicker: this
|
|
3831
|
+
};
|
|
3832
|
+
},
|
|
3833
|
+
props: {
|
|
3834
|
+
modelValue: {
|
|
3835
|
+
type: [String, Object],
|
|
3836
|
+
validator(value) {
|
|
3837
|
+
return typeof value === "string" || typeof value === "object" && typeof value.red === "number" && typeof value.green === "number" && typeof value.blue === "number";
|
|
3838
|
+
}
|
|
3839
|
+
},
|
|
3840
|
+
mobileNative: {
|
|
3841
|
+
type: Boolean,
|
|
3842
|
+
default: false
|
|
3843
|
+
},
|
|
3844
|
+
representation: {
|
|
3845
|
+
type: String,
|
|
3846
|
+
default: "triangle",
|
|
3847
|
+
value(value) {
|
|
3848
|
+
return ["triangle", "square"].some((r) => r === value);
|
|
3849
|
+
}
|
|
3850
|
+
},
|
|
3851
|
+
inline: Boolean,
|
|
3852
|
+
disabled: Boolean,
|
|
3853
|
+
horizontalColorPicker: {
|
|
3854
|
+
type: Boolean,
|
|
3855
|
+
default: false
|
|
3856
|
+
},
|
|
3857
|
+
colorFormatter: {
|
|
3858
|
+
type: Function,
|
|
3859
|
+
default: (color, vm) => {
|
|
3860
|
+
{
|
|
3861
|
+
return defaultColorFormatter(color);
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
},
|
|
3865
|
+
colorParser: {
|
|
3866
|
+
type: Function,
|
|
3867
|
+
default: (color, vm) => {
|
|
3868
|
+
{
|
|
3869
|
+
return defaultColorParser(color);
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
},
|
|
3873
|
+
alpha: {
|
|
3874
|
+
type: Boolean,
|
|
3875
|
+
default: false
|
|
3876
|
+
},
|
|
3877
|
+
expanded: Boolean,
|
|
3878
|
+
position: String,
|
|
3879
|
+
mobileModal: {
|
|
3880
|
+
type: Boolean,
|
|
3881
|
+
default: () => config.defaultDatepickerMobileModal
|
|
3882
|
+
},
|
|
3883
|
+
focusable: {
|
|
3884
|
+
type: Boolean,
|
|
3885
|
+
default: true
|
|
3886
|
+
},
|
|
3887
|
+
trapFocus: {
|
|
3888
|
+
type: Boolean,
|
|
3889
|
+
default: () => config.defaultTrapFocus
|
|
3890
|
+
},
|
|
3891
|
+
openOnFocus: Boolean,
|
|
3892
|
+
closeOnClick: Boolean,
|
|
3893
|
+
appendToBody: Boolean
|
|
3894
|
+
},
|
|
3895
|
+
emits: {
|
|
3896
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3897
|
+
"active-change": (_active) => true,
|
|
3898
|
+
"update:modelValue": (_value) => true
|
|
3899
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
3900
|
+
},
|
|
3901
|
+
data() {
|
|
3902
|
+
return {
|
|
3903
|
+
color: this.parseColor(this.modelValue)
|
|
3904
|
+
};
|
|
3905
|
+
},
|
|
3906
|
+
computed: {
|
|
3907
|
+
computedValue: {
|
|
3908
|
+
set(value) {
|
|
3909
|
+
this.color = this.parseColor(value);
|
|
3910
|
+
},
|
|
3911
|
+
get() {
|
|
3912
|
+
return this.color;
|
|
3913
|
+
}
|
|
3914
|
+
},
|
|
3915
|
+
background() {
|
|
3916
|
+
if (this.alpha) {
|
|
3917
|
+
return `linear-gradient(
|
|
3918
|
+
45deg,
|
|
3919
|
+
${this.computedValue.toString("hex")} 50%,
|
|
3920
|
+
${this.computedValue.toString("hexa")} 50%
|
|
3921
|
+
)`;
|
|
3922
|
+
} else {
|
|
3923
|
+
const hex = this.computedValue.toString("hex");
|
|
3924
|
+
return `linear-gradient(
|
|
3925
|
+
45deg,
|
|
3926
|
+
${hex} 50%,
|
|
3927
|
+
${hex} 50%
|
|
3928
|
+
)`;
|
|
3929
|
+
}
|
|
3930
|
+
},
|
|
3931
|
+
triggerStyle() {
|
|
3932
|
+
const { red, green, blue } = this.computedValue;
|
|
3933
|
+
const light = red * 0.299 + green * 0.587 + blue * 0.114 > 186;
|
|
3934
|
+
return {
|
|
3935
|
+
backgroundColor: "#ffffff",
|
|
3936
|
+
backgroundImage: `
|
|
3937
|
+
${this.background},
|
|
3938
|
+
linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7),
|
|
3939
|
+
linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7)
|
|
3940
|
+
`,
|
|
3941
|
+
backgroundSize: "100% 100%, 16px 16px, 16px 16px",
|
|
3942
|
+
backgroundPosition: "0 0, 8px 8px, 0 0",
|
|
3943
|
+
color: light ? "#000000" : "#FFFFFF",
|
|
3944
|
+
textShadow: `0 0 2px ${light ? "#FFFFFFAA" : "#000000AA"}`
|
|
3945
|
+
};
|
|
3946
|
+
},
|
|
3947
|
+
isMobile() {
|
|
3948
|
+
return this.mobileNative && isMobile.any();
|
|
3949
|
+
},
|
|
3950
|
+
ariaRole() {
|
|
3951
|
+
if (!this.inline) {
|
|
3952
|
+
return "dialog";
|
|
3953
|
+
} else {
|
|
3954
|
+
return void 0;
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
},
|
|
3958
|
+
watch: {
|
|
3959
|
+
modelValue(value) {
|
|
3960
|
+
this.computedValue = new Color(value);
|
|
3961
|
+
}
|
|
3962
|
+
},
|
|
3963
|
+
methods: {
|
|
3964
|
+
parseColor(color) {
|
|
3965
|
+
try {
|
|
3966
|
+
return this.colorParser(color);
|
|
3967
|
+
} catch (e) {
|
|
3968
|
+
return new Color();
|
|
3969
|
+
}
|
|
3970
|
+
},
|
|
3971
|
+
updateColor(value) {
|
|
3972
|
+
value.alpha = this.computedValue.alpha;
|
|
3973
|
+
this.computedValue = value;
|
|
3974
|
+
this.$emit("update:modelValue", value);
|
|
3975
|
+
},
|
|
3976
|
+
updateAlpha(alpha) {
|
|
3977
|
+
this.computedValue.alpha = alpha;
|
|
3978
|
+
this.$emit("update:modelValue", this.computedValue);
|
|
3979
|
+
},
|
|
3980
|
+
updateRGB() {
|
|
3981
|
+
this.$emit("update:modelValue", this.computedValue);
|
|
3982
|
+
},
|
|
3983
|
+
/*
|
|
3984
|
+
* Format color into string
|
|
3985
|
+
*/
|
|
3986
|
+
formatValue(value) {
|
|
3987
|
+
return value ? this.colorFormatter(value, this) : null;
|
|
3988
|
+
},
|
|
3989
|
+
/*
|
|
3990
|
+
* Toggle datepicker
|
|
3991
|
+
*/
|
|
3992
|
+
togglePicker(active) {
|
|
3993
|
+
if (this.$refs.dropdown) {
|
|
3994
|
+
const isActive = typeof active === "boolean" ? active : !this.$refs.dropdown.isActive;
|
|
3995
|
+
if (isActive) {
|
|
3996
|
+
this.$refs.dropdown.isActive = isActive;
|
|
3997
|
+
} else if (this.closeOnClick) {
|
|
3998
|
+
this.$refs.dropdown.isActive = isActive;
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
},
|
|
4002
|
+
/*
|
|
4003
|
+
* Call default onFocus method and show datepicker
|
|
4004
|
+
*/
|
|
4005
|
+
handleOnFocus(event) {
|
|
4006
|
+
this.onFocus(event);
|
|
4007
|
+
if (this.openOnFocus) {
|
|
4008
|
+
this.togglePicker(true);
|
|
4009
|
+
}
|
|
4010
|
+
},
|
|
4011
|
+
/*
|
|
4012
|
+
* Toggle dropdown
|
|
4013
|
+
*/
|
|
4014
|
+
// I decided to comment out the following unused method until we come
|
|
4015
|
+
// back to deal with the `open-on-focus` and `close-on-click` props
|
|
4016
|
+
/*
|
|
4017
|
+
toggle() {
|
|
4018
|
+
if (this.mobileNative && this.isMobile) {
|
|
4019
|
+
const input = this.$refs.input.$refs.input
|
|
4020
|
+
input.focus()
|
|
4021
|
+
input.click()
|
|
4022
|
+
return
|
|
4023
|
+
}
|
|
4024
|
+
(this.$refs.dropdown as BDropdownInstance).toggle()
|
|
4025
|
+
}, */
|
|
4026
|
+
/*
|
|
4027
|
+
* Avoid dropdown toggle when is already visible
|
|
4028
|
+
*/
|
|
4029
|
+
onInputClick(event) {
|
|
4030
|
+
if (this.$refs.dropdown.isActive) {
|
|
4031
|
+
event.stopPropagation();
|
|
4032
|
+
}
|
|
4033
|
+
},
|
|
4034
|
+
/*
|
|
4035
|
+
* Keypress event that is bound to the document.
|
|
4036
|
+
*/
|
|
4037
|
+
keyPress({ key }) {
|
|
4038
|
+
const dropdown = this.$refs.dropdown;
|
|
4039
|
+
if (dropdown && dropdown.isActive && (key === "Escape" || key === "Esc")) {
|
|
4040
|
+
this.togglePicker(false);
|
|
4041
|
+
}
|
|
4042
|
+
},
|
|
4043
|
+
/*
|
|
4044
|
+
* Emit 'blur' event on dropdown is not active (closed)
|
|
4045
|
+
*/
|
|
4046
|
+
onActiveChange(value) {
|
|
4047
|
+
if (!value) {
|
|
4048
|
+
this.onBlur();
|
|
4049
|
+
}
|
|
4050
|
+
this.$emit("active-change", value);
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
});
|
|
4054
|
+
|
|
4055
|
+
const _hoisted_1 = { class: "color-name" };
|
|
4056
|
+
const _hoisted_2 = { class: "colorpicker-header" };
|
|
4057
|
+
const _hoisted_3 = { class: "colorpicker-content" };
|
|
4058
|
+
const _hoisted_4 = { class: "colorpicker-footer" };
|
|
4059
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4060
|
+
const _component_b_button = vue.resolveComponent("b-button");
|
|
4061
|
+
const _component_b_colorpicker_h_s_l_representation_square = vue.resolveComponent("b-colorpicker-h-s-l-representation-square");
|
|
4062
|
+
const _component_b_colorpicker_h_s_l_representation_triangle = vue.resolveComponent("b-colorpicker-h-s-l-representation-triangle");
|
|
4063
|
+
const _component_b_colorpicker_alpha_slider = vue.resolveComponent("b-colorpicker-alpha-slider");
|
|
4064
|
+
const _component_b_input = vue.resolveComponent("b-input");
|
|
4065
|
+
const _component_b_field = vue.resolveComponent("b-field");
|
|
4066
|
+
const _component_b_dropdown_item = vue.resolveComponent("b-dropdown-item");
|
|
4067
|
+
const _component_b_dropdown = vue.resolveComponent("b-dropdown");
|
|
4068
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
4069
|
+
"div",
|
|
4070
|
+
{
|
|
4071
|
+
class: vue.normalizeClass(["colorpicker control", [_ctx.size, { "is-expanded": _ctx.expanded }]])
|
|
4072
|
+
},
|
|
4073
|
+
[
|
|
4074
|
+
!_ctx.isMobile || _ctx.inline ? (vue.openBlock(), vue.createBlock(_component_b_dropdown, {
|
|
4075
|
+
key: 0,
|
|
4076
|
+
ref: "dropdown",
|
|
4077
|
+
position: _ctx.position,
|
|
4078
|
+
expanded: _ctx.expanded,
|
|
4079
|
+
disabled: _ctx.disabled,
|
|
4080
|
+
inline: _ctx.inline,
|
|
4081
|
+
"mobile-modal": _ctx.mobileModal,
|
|
4082
|
+
"trap-focus": _ctx.trapFocus,
|
|
4083
|
+
"aria-role": _ctx.ariaRole,
|
|
4084
|
+
"append-to-body": _ctx.appendToBody,
|
|
4085
|
+
"append-to-body-copy-parent": "",
|
|
4086
|
+
onActiveChange: _ctx.onActiveChange
|
|
4087
|
+
}, vue.createSlots({
|
|
4088
|
+
default: vue.withCtx(() => [
|
|
4089
|
+
vue.createVNode(_component_b_dropdown_item, {
|
|
4090
|
+
disabled: _ctx.disabled,
|
|
4091
|
+
focusable: _ctx.focusable,
|
|
4092
|
+
custom: "",
|
|
4093
|
+
class: vue.normalizeClass({ "dropdown-horizontal-colorpicker": _ctx.horizontalColorPicker })
|
|
4094
|
+
}, {
|
|
4095
|
+
default: vue.withCtx(() => [
|
|
4096
|
+
vue.createElementVNode("div", null, [
|
|
4097
|
+
vue.createElementVNode("header", _hoisted_2, [
|
|
4098
|
+
_ctx.$slots.header !== void 0 && _ctx.$slots.header.length ? vue.renderSlot(_ctx.$slots, "header", { key: 0 }) : vue.createCommentVNode("v-if", true)
|
|
4099
|
+
]),
|
|
4100
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
4101
|
+
_ctx.representation === "square" ? (vue.openBlock(), vue.createBlock(_component_b_colorpicker_h_s_l_representation_square, {
|
|
4102
|
+
key: 0,
|
|
4103
|
+
value: _ctx.computedValue,
|
|
4104
|
+
onInput: _ctx.updateColor
|
|
4105
|
+
}, null, 8, ["value", "onInput"])) : (vue.openBlock(), vue.createBlock(_component_b_colorpicker_h_s_l_representation_triangle, {
|
|
4106
|
+
key: 1,
|
|
4107
|
+
value: _ctx.computedValue,
|
|
4108
|
+
onInput: _ctx.updateColor
|
|
4109
|
+
}, null, 8, ["value", "onInput"]))
|
|
4110
|
+
])
|
|
4111
|
+
]),
|
|
4112
|
+
vue.createElementVNode("footer", _hoisted_4, [
|
|
4113
|
+
_ctx.alpha ? (vue.openBlock(), vue.createBlock(_component_b_colorpicker_alpha_slider, {
|
|
4114
|
+
key: 0,
|
|
4115
|
+
value: _ctx.computedValue.alpha,
|
|
4116
|
+
onInput: _ctx.updateAlpha,
|
|
4117
|
+
color: _ctx.computedValue
|
|
4118
|
+
}, null, 8, ["value", "onInput", "color"])) : vue.createCommentVNode("v-if", true),
|
|
4119
|
+
vue.renderSlot(_ctx.$slots, "footer", { color: _ctx.computedValue }, () => [
|
|
4120
|
+
vue.createVNode(_component_b_field, {
|
|
4121
|
+
class: "colorpicker-fields",
|
|
4122
|
+
grouped: ""
|
|
4123
|
+
}, {
|
|
4124
|
+
default: vue.withCtx(() => [
|
|
4125
|
+
vue.createVNode(_component_b_field, {
|
|
4126
|
+
horizontal: "",
|
|
4127
|
+
label: "R"
|
|
4128
|
+
}, {
|
|
4129
|
+
default: vue.withCtx(() => [
|
|
4130
|
+
vue.createVNode(_component_b_input, {
|
|
4131
|
+
type: "number",
|
|
4132
|
+
modelValue: _ctx.computedValue.red,
|
|
4133
|
+
"onUpdate:modelValue": [
|
|
4134
|
+
_cache[0] || (_cache[0] = ($event) => _ctx.computedValue.red = $event),
|
|
4135
|
+
_ctx.updateRGB
|
|
4136
|
+
],
|
|
4137
|
+
modelModifiers: { number: true },
|
|
4138
|
+
size: "is-small",
|
|
4139
|
+
"aria-label": "Red"
|
|
4140
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
4141
|
+
]),
|
|
4142
|
+
_: 1
|
|
4143
|
+
/* STABLE */
|
|
4144
|
+
}),
|
|
4145
|
+
vue.createVNode(_component_b_field, {
|
|
4146
|
+
horizontal: "",
|
|
4147
|
+
label: "G"
|
|
4148
|
+
}, {
|
|
4149
|
+
default: vue.withCtx(() => [
|
|
4150
|
+
vue.createVNode(_component_b_input, {
|
|
4151
|
+
type: "number",
|
|
4152
|
+
modelValue: _ctx.computedValue.green,
|
|
4153
|
+
"onUpdate:modelValue": [
|
|
4154
|
+
_cache[1] || (_cache[1] = ($event) => _ctx.computedValue.green = $event),
|
|
4155
|
+
_ctx.updateRGB
|
|
4156
|
+
],
|
|
4157
|
+
modelModifiers: { number: true },
|
|
4158
|
+
size: "is-small",
|
|
4159
|
+
"aria-label": "Green"
|
|
4160
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
4161
|
+
]),
|
|
4162
|
+
_: 1
|
|
4163
|
+
/* STABLE */
|
|
4164
|
+
}),
|
|
4165
|
+
vue.createVNode(_component_b_field, {
|
|
4166
|
+
horizontal: "",
|
|
4167
|
+
label: "B"
|
|
4168
|
+
}, {
|
|
4169
|
+
default: vue.withCtx(() => [
|
|
4170
|
+
vue.createVNode(_component_b_input, {
|
|
4171
|
+
type: "number",
|
|
4172
|
+
modelValue: _ctx.computedValue.blue,
|
|
4173
|
+
"onUpdate:modelValue": [
|
|
4174
|
+
_cache[2] || (_cache[2] = ($event) => _ctx.computedValue.blue = $event),
|
|
4175
|
+
_ctx.updateRGB
|
|
4176
|
+
],
|
|
4177
|
+
modelModifiers: { number: true },
|
|
4178
|
+
size: "is-small",
|
|
4179
|
+
"aria-label": "Blue"
|
|
4180
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
4181
|
+
]),
|
|
4182
|
+
_: 1
|
|
4183
|
+
/* STABLE */
|
|
4184
|
+
})
|
|
4185
|
+
]),
|
|
4186
|
+
_: 1
|
|
4187
|
+
/* STABLE */
|
|
4188
|
+
})
|
|
4189
|
+
])
|
|
4190
|
+
])
|
|
4191
|
+
]),
|
|
4192
|
+
_: 3
|
|
4193
|
+
/* FORWARDED */
|
|
4194
|
+
}, 8, ["disabled", "focusable", "class"])
|
|
4195
|
+
]),
|
|
4196
|
+
_: 2
|
|
4197
|
+
/* DYNAMIC */
|
|
4198
|
+
}, [
|
|
4199
|
+
!_ctx.inline ? {
|
|
4200
|
+
name: "trigger",
|
|
4201
|
+
fn: vue.withCtx(() => [
|
|
4202
|
+
vue.renderSlot(_ctx.$slots, "trigger", {}, () => [
|
|
4203
|
+
vue.createVNode(_component_b_button, {
|
|
4204
|
+
style: vue.normalizeStyle(_ctx.triggerStyle),
|
|
4205
|
+
expanded: _ctx.expanded,
|
|
4206
|
+
disabled: _ctx.disabled
|
|
4207
|
+
}, {
|
|
4208
|
+
default: vue.withCtx(() => [
|
|
4209
|
+
vue.createElementVNode(
|
|
4210
|
+
"span",
|
|
4211
|
+
_hoisted_1,
|
|
4212
|
+
vue.toDisplayString(_ctx.colorFormatter(_ctx.computedValue)),
|
|
4213
|
+
1
|
|
4214
|
+
/* TEXT */
|
|
4215
|
+
)
|
|
4216
|
+
]),
|
|
4217
|
+
_: 1
|
|
4218
|
+
/* STABLE */
|
|
4219
|
+
}, 8, ["style", "expanded", "disabled"])
|
|
4220
|
+
])
|
|
4221
|
+
]),
|
|
4222
|
+
key: "0"
|
|
4223
|
+
} : void 0
|
|
4224
|
+
]), 1032, ["position", "expanded", "disabled", "inline", "mobile-modal", "trap-focus", "aria-role", "append-to-body", "onActiveChange"])) : vue.createCommentVNode("v-if", true)
|
|
4225
|
+
],
|
|
4226
|
+
2
|
|
4227
|
+
/* CLASS */
|
|
4228
|
+
);
|
|
4229
|
+
}
|
|
4230
|
+
var Colorpicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
4231
|
+
|
|
4232
|
+
const registerComponent = (Vue, component, name) => {
|
|
4233
|
+
const componentName = component.name;
|
|
4234
|
+
if (componentName == null) {
|
|
4235
|
+
throw new Error("Buefy.registerComponent: missing component name");
|
|
4236
|
+
}
|
|
4237
|
+
Vue.component(componentName, component);
|
|
4238
|
+
};
|
|
4239
|
+
|
|
4240
|
+
const Plugin = {
|
|
4241
|
+
install(Vue) {
|
|
4242
|
+
registerComponent(Vue, Colorpicker);
|
|
4243
|
+
}
|
|
4244
|
+
};
|
|
4245
|
+
|
|
4246
|
+
exports.BColorpicker = Colorpicker;
|
|
4247
|
+
exports.default = Plugin;
|
|
4248
|
+
|
|
4249
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4250
|
+
|
|
4251
|
+
}));
|