vant 3.4.5 → 4.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/action-bar/index.css +1 -1
- package/es/action-bar/index.less +4 -6
- package/es/action-bar-button/index.css +1 -1
- package/es/action-bar-button/index.less +9 -11
- package/es/action-bar-icon/index.css +1 -1
- package/es/action-bar-icon/index.less +10 -12
- package/es/action-sheet/index.css +1 -1
- package/es/action-sheet/index.less +23 -24
- package/es/address-edit/AddressEdit.d.ts +6 -6
- package/es/address-edit/AddressEdit.js +29 -33
- package/es/address-edit/AddressEditDetail.d.ts +2 -2
- package/es/address-edit/AddressEditDetail.js +5 -14
- package/es/address-edit/index.css +1 -1
- package/es/address-edit/index.d.ts +6 -6
- package/es/address-edit/index.less +8 -15
- package/es/address-edit/types.d.ts +2 -4
- package/es/address-list/AddressList.d.ts +4 -4
- package/es/address-list/AddressList.js +5 -5
- package/es/address-list/AddressListItem.js +3 -3
- package/es/address-list/index.css +1 -1
- package/es/address-list/index.d.ts +4 -4
- package/es/address-list/index.less +20 -22
- package/es/area/Area.d.ts +13 -25
- package/es/area/Area.js +43 -208
- package/es/area/index.d.ts +11 -19
- package/es/area/types.d.ts +2 -17
- package/es/area/utils.d.ts +6 -0
- package/es/area/utils.js +85 -0
- package/es/badge/index.css +1 -1
- package/es/badge/index.less +15 -17
- package/es/button/index.css +1 -1
- package/es/button/index.less +55 -52
- package/es/calendar/Calendar.d.ts +6 -6
- package/es/calendar/Calendar.js +5 -5
- package/es/calendar/CalendarHeader.d.ts +2 -2
- package/es/calendar/CalendarHeader.js +2 -2
- package/es/calendar/CalendarMonth.d.ts +1 -2
- package/es/calendar/CalendarMonth.js +2 -2
- package/es/calendar/index.css +1 -1
- package/es/calendar/index.d.ts +6 -6
- package/es/calendar/index.less +40 -37
- package/es/card/Card.d.ts +2 -2
- package/es/card/Card.js +3 -3
- package/es/card/index.css +1 -1
- package/es/card/index.d.ts +2 -2
- package/es/card/index.less +23 -25
- package/es/cascader/Cascader.d.ts +2 -2
- package/es/cascader/Cascader.js +3 -3
- package/es/cascader/index.css +1 -1
- package/es/cascader/index.d.ts +2 -2
- package/es/cascader/index.less +17 -19
- package/es/cell/Cell.js +1 -4
- package/es/cell/index.css +1 -1
- package/es/cell/index.less +21 -27
- package/es/cell-group/index.css +1 -1
- package/es/cell-group/index.less +12 -13
- package/es/checkbox/index.css +1 -1
- package/es/checkbox/index.less +12 -14
- package/es/circle/index.css +1 -1
- package/es/circle/index.less +8 -10
- package/es/collapse-item/index.css +1 -1
- package/es/collapse-item/index.less +12 -12
- package/es/config-provider/ConfigProvider.d.ts +14 -0
- package/es/config-provider/ConfigProvider.js +9 -2
- package/es/config-provider/index.d.ts +10 -1
- package/es/contact-card/ContactCard.js +2 -2
- package/es/contact-card/index.css +1 -1
- package/es/contact-card/index.less +7 -9
- package/es/contact-edit/ContactEdit.d.ts +2 -2
- package/es/contact-edit/ContactEdit.js +3 -4
- package/es/contact-edit/index.css +1 -1
- package/es/contact-edit/index.d.ts +2 -2
- package/es/contact-edit/index.less +7 -9
- package/es/contact-list/ContactList.js +4 -4
- package/es/contact-list/index.css +1 -1
- package/es/contact-list/index.less +9 -11
- package/es/count-down/index.css +1 -1
- package/es/count-down/index.less +4 -6
- package/es/coupon/index.css +1 -1
- package/es/coupon/index.less +28 -31
- package/es/coupon-cell/index.css +1 -1
- package/es/coupon-cell/index.less +2 -4
- package/es/coupon-list/CouponList.js +2 -2
- package/es/coupon-list/index.css +1 -1
- package/es/coupon-list/index.less +15 -17
- package/es/date-picker/DatePicker.d.ts +168 -0
- package/es/date-picker/DatePicker.js +111 -0
- package/es/{datetime-picker/DatePicker.d.ts → date-picker/index.d.ts} +40 -28
- package/es/date-picker/index.js +8 -0
- package/es/{datetime-picker → date-picker}/style/index.d.ts +0 -0
- package/es/{datetime-picker → date-picker}/style/index.js +0 -0
- package/es/{datetime-picker → date-picker}/style/less.d.ts +0 -0
- package/es/{datetime-picker → date-picker}/style/less.js +0 -0
- package/es/{datetime-picker → date-picker}/utils.d.ts +15 -11
- package/es/date-picker/utils.js +40 -0
- package/es/dialog/index.css +1 -1
- package/es/dialog/index.less +22 -24
- package/es/divider/index.css +1 -1
- package/es/divider/index.less +10 -12
- package/es/dropdown-item/index.css +1 -1
- package/es/dropdown-item/index.less +2 -5
- package/es/dropdown-menu/index.css +1 -1
- package/es/dropdown-menu/index.less +14 -17
- package/es/empty/index.css +1 -1
- package/es/empty/index.less +9 -11
- package/es/field/Field.d.ts +4 -4
- package/es/field/Field.js +4 -4
- package/es/field/index.css +1 -1
- package/es/field/index.d.ts +4 -4
- package/es/field/index.less +20 -23
- package/es/grid-item/index.css +1 -1
- package/es/grid-item/index.less +10 -13
- package/es/image/index.css +1 -1
- package/es/image/index.less +10 -12
- package/es/image-preview/index.css +1 -1
- package/es/image-preview/index.less +11 -13
- package/es/index-anchor/index.css +1 -1
- package/es/index-anchor/index.less +12 -14
- package/es/index-bar/index.css +1 -1
- package/es/index-bar/index.less +7 -8
- package/es/index.d.ts +3 -2
- package/es/index.js +7 -4
- package/es/list/index.css +1 -1
- package/es/list/index.less +5 -7
- package/es/loading/index.css +1 -1
- package/es/loading/index.less +7 -10
- package/es/nav-bar/NavBar.d.ts +3 -3
- package/es/nav-bar/NavBar.js +3 -3
- package/es/nav-bar/index.css +1 -1
- package/es/nav-bar/index.d.ts +3 -3
- package/es/nav-bar/index.less +11 -13
- package/es/notice-bar/index.css +1 -1
- package/es/notice-bar/index.less +11 -13
- package/es/notify/index.css +1 -1
- package/es/notify/index.less +13 -15
- package/es/number-keyboard/NumberKeyboard.d.ts +1 -1
- package/es/number-keyboard/index.css +1 -1
- package/es/number-keyboard/index.d.ts +1 -1
- package/es/number-keyboard/index.less +26 -22
- package/es/overlay/index.css +1 -1
- package/es/overlay/index.less +4 -6
- package/es/pagination/index.css +1 -1
- package/es/pagination/index.less +13 -15
- package/es/password-input/index.css +1 -1
- package/es/password-input/index.less +20 -22
- package/es/picker/Picker.d.ts +26 -28
- package/es/picker/Picker.js +91 -196
- package/es/picker/PickerColumn.d.ts +21 -30
- package/es/picker/PickerColumn.js +61 -111
- package/es/picker/index.css +1 -1
- package/es/picker/index.d.ts +19 -20
- package/es/picker/index.less +31 -19
- package/es/picker/types.d.ts +13 -19
- package/es/picker/utils.d.ts +10 -0
- package/es/picker/utils.js +73 -0
- package/es/popover/Popover.d.ts +1 -1
- package/es/popover/index.css +1 -1
- package/es/popover/index.d.ts +1 -1
- package/es/popover/index.less +21 -23
- package/es/popup/Popup.d.ts +3 -3
- package/es/popup/Popup.js +3 -3
- package/es/popup/index.css +1 -1
- package/es/popup/index.d.ts +3 -3
- package/es/popup/index.less +20 -22
- package/es/progress/index.css +1 -1
- package/es/progress/index.less +14 -18
- package/es/pull-refresh/index.css +1 -1
- package/es/pull-refresh/index.less +5 -7
- package/es/radio/index.css +1 -1
- package/es/radio/index.less +12 -14
- package/es/rate/index.css +1 -1
- package/es/rate/index.less +6 -8
- package/es/search/Search.d.ts +4 -4
- package/es/search/Search.js +7 -7
- package/es/search/index.css +1 -1
- package/es/search/index.d.ts +4 -4
- package/es/search/index.less +16 -18
- package/es/share-sheet/index.css +1 -1
- package/es/share-sheet/index.less +17 -18
- package/es/sidebar/index.css +1 -1
- package/es/sidebar/index.less +2 -4
- package/es/sidebar-item/index.css +1 -1
- package/es/sidebar-item/index.less +17 -19
- package/es/skeleton/index.css +1 -1
- package/es/skeleton/index.less +14 -16
- package/es/slider/Slider.d.ts +4 -4
- package/es/slider/Slider.js +4 -5
- package/es/slider/index.css +1 -1
- package/es/slider/index.d.ts +4 -4
- package/es/slider/index.less +20 -18
- package/es/step/index.css +1 -1
- package/es/step/index.less +15 -17
- package/es/stepper/Stepper.d.ts +1 -1
- package/es/stepper/index.css +1 -1
- package/es/stepper/index.d.ts +1 -1
- package/es/stepper/index.less +20 -24
- package/es/steps/Steps.d.ts +2 -2
- package/es/steps/Steps.js +2 -2
- package/es/steps/index.css +1 -1
- package/es/steps/index.d.ts +2 -2
- package/es/steps/index.less +3 -5
- package/es/sticky/index.css +1 -1
- package/es/sticky/index.less +2 -4
- package/es/style/animation.css +1 -1
- package/es/style/animation.less +18 -22
- package/es/style/base.css +1 -1
- package/es/style/base.less +6 -7
- package/es/style/css-variables.css +1 -1
- package/es/style/css-variables.less +76 -61
- package/es/style/mixins/hairline.less +0 -2
- package/es/style/normalize.css +1 -1
- package/es/style/normalize.less +1 -3
- package/es/submit-bar/index.css +1 -1
- package/es/submit-bar/index.less +26 -28
- package/es/swipe/index.css +1 -1
- package/es/swipe/index.less +11 -13
- package/es/switch/index.css +1 -1
- package/es/switch/index.less +24 -24
- package/es/tabbar/index.css +1 -1
- package/es/tabbar/index.less +5 -7
- package/es/tabbar-item/index.css +1 -1
- package/es/tabbar-item/index.less +9 -11
- package/es/tabs/Tabs.d.ts +2 -4
- package/es/tabs/Tabs.js +14 -27
- package/es/tabs/index.css +1 -1
- package/es/tabs/index.d.ts +2 -4
- package/es/tabs/index.less +17 -20
- package/es/tag/index.css +1 -1
- package/es/tag/index.less +22 -25
- package/es/time-picker/TimePicker.d.ts +214 -0
- package/es/time-picker/TimePicker.js +71 -0
- package/{lib/datetime-picker/TimePicker.d.ts → es/time-picker/index.d.ts} +60 -20
- package/es/time-picker/index.js +8 -0
- package/{lib/datetime-picker → es/time-picker}/style/index.d.ts +0 -0
- package/es/time-picker/style/index.js +3 -0
- package/{lib/datetime-picker → es/time-picker}/style/less.d.ts +0 -0
- package/es/time-picker/style/less.js +3 -0
- package/es/toast/index.css +1 -1
- package/es/toast/index.less +19 -21
- package/es/tree-select/TreeSelect.d.ts +3 -3
- package/es/tree-select/TreeSelect.js +3 -3
- package/es/tree-select/index.css +1 -1
- package/es/tree-select/index.d.ts +3 -3
- package/es/tree-select/index.less +12 -14
- package/es/uploader/Uploader.d.ts +4 -4
- package/es/uploader/Uploader.js +4 -4
- package/es/uploader/index.css +1 -1
- package/es/uploader/index.d.ts +4 -4
- package/es/uploader/index.less +31 -33
- package/es/utils/basic.d.ts +1 -0
- package/es/utils/basic.js +2 -0
- package/lib/action-bar/index.css +1 -1
- package/lib/action-bar/index.less +4 -6
- package/lib/action-bar-button/index.css +1 -1
- package/lib/action-bar-button/index.less +9 -11
- package/lib/action-bar-icon/index.css +1 -1
- package/lib/action-bar-icon/index.less +10 -12
- package/lib/action-sheet/index.css +1 -1
- package/lib/action-sheet/index.less +23 -24
- package/lib/address-edit/AddressEdit.d.ts +6 -6
- package/lib/address-edit/AddressEdit.js +29 -33
- package/lib/address-edit/AddressEditDetail.d.ts +2 -2
- package/lib/address-edit/AddressEditDetail.js +5 -14
- package/lib/address-edit/index.css +1 -1
- package/lib/address-edit/index.d.ts +6 -6
- package/lib/address-edit/index.less +8 -15
- package/lib/address-edit/types.d.ts +2 -4
- package/lib/address-list/AddressList.d.ts +4 -4
- package/lib/address-list/AddressList.js +5 -5
- package/lib/address-list/AddressListItem.js +3 -3
- package/lib/address-list/index.css +1 -1
- package/lib/address-list/index.d.ts +4 -4
- package/lib/address-list/index.less +20 -22
- package/lib/area/Area.d.ts +13 -25
- package/lib/area/Area.js +42 -207
- package/lib/area/index.d.ts +11 -19
- package/lib/area/types.d.ts +2 -17
- package/lib/area/utils.d.ts +6 -0
- package/lib/area/utils.js +109 -0
- package/lib/badge/index.css +1 -1
- package/lib/badge/index.less +15 -17
- package/lib/button/index.css +1 -1
- package/lib/button/index.less +55 -52
- package/lib/calendar/Calendar.d.ts +6 -6
- package/lib/calendar/Calendar.js +5 -5
- package/lib/calendar/CalendarHeader.d.ts +2 -2
- package/lib/calendar/CalendarHeader.js +2 -2
- package/lib/calendar/CalendarMonth.d.ts +1 -2
- package/lib/calendar/CalendarMonth.js +2 -2
- package/lib/calendar/index.css +1 -1
- package/lib/calendar/index.d.ts +6 -6
- package/lib/calendar/index.less +40 -37
- package/lib/card/Card.d.ts +2 -2
- package/lib/card/Card.js +3 -3
- package/lib/card/index.css +1 -1
- package/lib/card/index.d.ts +2 -2
- package/lib/card/index.less +23 -25
- package/lib/cascader/Cascader.d.ts +2 -2
- package/lib/cascader/Cascader.js +3 -3
- package/lib/cascader/index.css +1 -1
- package/lib/cascader/index.d.ts +2 -2
- package/lib/cascader/index.less +17 -19
- package/lib/cell/Cell.js +1 -4
- package/lib/cell/index.css +1 -1
- package/lib/cell/index.less +21 -27
- package/lib/cell-group/index.css +1 -1
- package/lib/cell-group/index.less +12 -13
- package/lib/checkbox/index.css +1 -1
- package/lib/checkbox/index.less +12 -14
- package/lib/circle/index.css +1 -1
- package/lib/circle/index.less +8 -10
- package/lib/collapse-item/index.css +1 -1
- package/lib/collapse-item/index.less +12 -12
- package/lib/config-provider/ConfigProvider.d.ts +14 -0
- package/lib/config-provider/ConfigProvider.js +7 -0
- package/lib/config-provider/index.d.ts +10 -1
- package/lib/contact-card/ContactCard.js +2 -2
- package/lib/contact-card/index.css +1 -1
- package/lib/contact-card/index.less +7 -9
- package/lib/contact-edit/ContactEdit.d.ts +2 -2
- package/lib/contact-edit/ContactEdit.js +3 -4
- package/lib/contact-edit/index.css +1 -1
- package/lib/contact-edit/index.d.ts +2 -2
- package/lib/contact-edit/index.less +7 -9
- package/lib/contact-list/ContactList.js +4 -4
- package/lib/contact-list/index.css +1 -1
- package/lib/contact-list/index.less +9 -11
- package/lib/count-down/index.css +1 -1
- package/lib/count-down/index.less +4 -6
- package/lib/coupon/index.css +1 -1
- package/lib/coupon/index.less +28 -31
- package/lib/coupon-cell/index.css +1 -1
- package/lib/coupon-cell/index.less +2 -4
- package/lib/coupon-list/CouponList.js +2 -2
- package/lib/coupon-list/index.css +1 -1
- package/lib/coupon-list/index.less +15 -17
- package/lib/date-picker/DatePicker.d.ts +168 -0
- package/lib/date-picker/DatePicker.js +135 -0
- package/lib/{datetime-picker/DatePicker.d.ts → date-picker/index.d.ts} +40 -28
- package/lib/{datetime-picker → date-picker}/index.js +4 -4
- package/lib/date-picker/style/index.d.ts +1 -0
- package/lib/{datetime-picker → date-picker}/style/index.js +0 -0
- package/lib/date-picker/style/less.d.ts +1 -0
- package/lib/{datetime-picker → date-picker}/style/less.js +0 -0
- package/lib/{datetime-picker → date-picker}/utils.d.ts +15 -11
- package/lib/{datetime-picker → date-picker}/utils.js +11 -34
- package/lib/dialog/index.css +1 -1
- package/lib/dialog/index.less +22 -24
- package/lib/divider/index.css +1 -1
- package/lib/divider/index.less +10 -12
- package/lib/dropdown-item/index.css +1 -1
- package/lib/dropdown-item/index.less +2 -5
- package/lib/dropdown-menu/index.css +1 -1
- package/lib/dropdown-menu/index.less +14 -17
- package/lib/empty/index.css +1 -1
- package/lib/empty/index.less +9 -11
- package/lib/field/Field.d.ts +4 -4
- package/lib/field/Field.js +4 -4
- package/lib/field/index.css +1 -1
- package/lib/field/index.d.ts +4 -4
- package/lib/field/index.less +20 -23
- package/lib/grid-item/index.css +1 -1
- package/lib/grid-item/index.less +10 -13
- package/lib/image/index.css +1 -1
- package/lib/image/index.less +10 -12
- package/lib/image-preview/index.css +1 -1
- package/lib/image-preview/index.less +11 -13
- package/lib/index-anchor/index.css +1 -1
- package/lib/index-anchor/index.less +12 -14
- package/lib/index-bar/index.css +1 -1
- package/lib/index-bar/index.less +7 -8
- package/lib/index.css +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +7 -4
- package/lib/list/index.css +1 -1
- package/lib/list/index.less +5 -7
- package/lib/loading/index.css +1 -1
- package/lib/loading/index.less +7 -10
- package/lib/nav-bar/NavBar.d.ts +3 -3
- package/lib/nav-bar/NavBar.js +3 -3
- package/lib/nav-bar/index.css +1 -1
- package/lib/nav-bar/index.d.ts +3 -3
- package/lib/nav-bar/index.less +11 -13
- package/lib/notice-bar/index.css +1 -1
- package/lib/notice-bar/index.less +11 -13
- package/lib/notify/index.css +1 -1
- package/lib/notify/index.less +13 -15
- package/lib/number-keyboard/NumberKeyboard.d.ts +1 -1
- package/lib/number-keyboard/index.css +1 -1
- package/lib/number-keyboard/index.d.ts +1 -1
- package/lib/number-keyboard/index.less +26 -22
- package/lib/overlay/index.css +1 -1
- package/lib/overlay/index.less +4 -6
- package/lib/pagination/index.css +1 -1
- package/lib/pagination/index.less +13 -15
- package/lib/password-input/index.css +1 -1
- package/lib/password-input/index.less +20 -22
- package/lib/picker/Picker.d.ts +26 -28
- package/lib/picker/Picker.js +90 -195
- package/lib/picker/PickerColumn.d.ts +21 -30
- package/lib/picker/PickerColumn.js +60 -110
- package/lib/picker/index.css +1 -1
- package/lib/picker/index.d.ts +19 -20
- package/lib/picker/index.less +31 -19
- package/lib/picker/types.d.ts +13 -19
- package/lib/picker/utils.d.ts +10 -0
- package/lib/picker/utils.js +97 -0
- package/lib/popover/Popover.d.ts +1 -1
- package/lib/popover/index.css +1 -1
- package/lib/popover/index.d.ts +1 -1
- package/lib/popover/index.less +21 -23
- package/lib/popup/Popup.d.ts +3 -3
- package/lib/popup/Popup.js +3 -3
- package/lib/popup/index.css +1 -1
- package/lib/popup/index.d.ts +3 -3
- package/lib/popup/index.less +20 -22
- package/lib/progress/index.css +1 -1
- package/lib/progress/index.less +14 -18
- package/lib/pull-refresh/index.css +1 -1
- package/lib/pull-refresh/index.less +5 -7
- package/lib/radio/index.css +1 -1
- package/lib/radio/index.less +12 -14
- package/lib/rate/index.css +1 -1
- package/lib/rate/index.less +6 -8
- package/lib/search/Search.d.ts +4 -4
- package/lib/search/Search.js +7 -7
- package/lib/search/index.css +1 -1
- package/lib/search/index.d.ts +4 -4
- package/lib/search/index.less +16 -18
- package/lib/share-sheet/index.css +1 -1
- package/lib/share-sheet/index.less +17 -18
- package/lib/sidebar/index.css +1 -1
- package/lib/sidebar/index.less +2 -4
- package/lib/sidebar-item/index.css +1 -1
- package/lib/sidebar-item/index.less +17 -19
- package/lib/skeleton/index.css +1 -1
- package/lib/skeleton/index.less +14 -16
- package/lib/slider/Slider.d.ts +4 -4
- package/lib/slider/Slider.js +5 -6
- package/lib/slider/index.css +1 -1
- package/lib/slider/index.d.ts +4 -4
- package/lib/slider/index.less +20 -18
- package/lib/step/index.css +1 -1
- package/lib/step/index.less +15 -17
- package/lib/stepper/Stepper.d.ts +1 -1
- package/lib/stepper/index.css +1 -1
- package/lib/stepper/index.d.ts +1 -1
- package/lib/stepper/index.less +20 -24
- package/lib/steps/Steps.d.ts +2 -2
- package/lib/steps/Steps.js +2 -2
- package/lib/steps/index.css +1 -1
- package/lib/steps/index.d.ts +2 -2
- package/lib/steps/index.less +3 -5
- package/lib/sticky/index.css +1 -1
- package/lib/sticky/index.less +2 -4
- package/lib/style/animation.css +1 -1
- package/lib/style/animation.less +18 -22
- package/lib/style/base.css +1 -1
- package/lib/style/base.less +6 -7
- package/lib/style/css-variables.css +1 -1
- package/lib/style/css-variables.less +76 -61
- package/lib/style/mixins/hairline.less +0 -2
- package/lib/style/normalize.css +1 -1
- package/lib/style/normalize.less +1 -3
- package/lib/submit-bar/index.css +1 -1
- package/lib/submit-bar/index.less +26 -28
- package/lib/swipe/index.css +1 -1
- package/lib/swipe/index.less +11 -13
- package/lib/switch/index.css +1 -1
- package/lib/switch/index.less +24 -24
- package/lib/tabbar/index.css +1 -1
- package/lib/tabbar/index.less +5 -7
- package/lib/tabbar-item/index.css +1 -1
- package/lib/tabbar-item/index.less +9 -11
- package/lib/tabs/Tabs.d.ts +2 -4
- package/lib/tabs/Tabs.js +13 -26
- package/lib/tabs/index.css +1 -1
- package/lib/tabs/index.d.ts +2 -4
- package/lib/tabs/index.less +17 -20
- package/lib/tag/index.css +1 -1
- package/lib/tag/index.less +22 -25
- package/lib/time-picker/TimePicker.d.ts +214 -0
- package/lib/time-picker/TimePicker.js +95 -0
- package/{es/datetime-picker/TimePicker.d.ts → lib/time-picker/index.d.ts} +60 -20
- package/lib/{datetime-picker/types.js → time-picker/index.js} +17 -0
- package/lib/time-picker/style/index.d.ts +1 -0
- package/lib/time-picker/style/index.js +3 -0
- package/lib/time-picker/style/less.d.ts +1 -0
- package/lib/time-picker/style/less.js +3 -0
- package/lib/toast/index.css +1 -1
- package/lib/toast/index.less +19 -21
- package/lib/tree-select/TreeSelect.d.ts +3 -3
- package/lib/tree-select/TreeSelect.js +3 -3
- package/lib/tree-select/index.css +1 -1
- package/lib/tree-select/index.d.ts +3 -3
- package/lib/tree-select/index.less +12 -14
- package/lib/uploader/Uploader.d.ts +4 -4
- package/lib/uploader/Uploader.js +4 -4
- package/lib/uploader/index.css +1 -1
- package/lib/uploader/index.d.ts +4 -4
- package/lib/uploader/index.less +31 -33
- package/lib/utils/basic.d.ts +1 -0
- package/lib/utils/basic.js +2 -0
- package/lib/vant.cjs.js +1194 -1629
- package/lib/vant.cjs.min.js +1 -1
- package/lib/vant.es.js +1194 -1630
- package/lib/vant.es.min.js +1194 -1630
- package/lib/vant.js +1193 -1628
- package/lib/vant.min.js +1 -1
- package/package.json +4 -1
- package/vetur/attributes.json +242 -186
- package/vetur/tags.json +82 -72
- package/vetur/web-types.json +826 -651
- package/es/action-bar/var.css +0 -0
- package/es/action-bar/var.less +0 -4
- package/es/action-bar-button/var.css +0 -0
- package/es/action-bar-button/var.less +0 -5
- package/es/action-bar-icon/var.css +0 -0
- package/es/action-bar-icon/var.less +0 -10
- package/es/action-sheet/var.css +0 -0
- package/es/action-sheet/var.less +0 -23
- package/es/address-edit/var.css +0 -0
- package/es/address-edit/var.less +0 -6
- package/es/address-list/var.css +0 -0
- package/es/address-list/var.less +0 -16
- package/es/badge/var.css +0 -0
- package/es/badge/var.less +0 -12
- package/es/button/var.css +0 -0
- package/es/button/var.less +0 -36
- package/es/calendar/var.css +0 -0
- package/es/calendar/var.less +0 -27
- package/es/card/var.css +0 -0
- package/es/card/var.less +0 -18
- package/es/cascader/var.css +0 -0
- package/es/cascader/var.less +0 -15
- package/es/cell/var.css +0 -0
- package/es/cell/var.less +0 -21
- package/es/cell-group/var.css +0 -0
- package/es/cell-group/var.less +0 -12
- package/es/checkbox/var.css +0 -0
- package/es/checkbox/var.less +0 -11
- package/es/circle/var.css +0 -0
- package/es/circle/var.less +0 -9
- package/es/collapse-item/var.css +0 -0
- package/es/collapse-item/var.less +0 -9
- package/es/contact-card/var.css +0 -0
- package/es/contact-card/var.less +0 -6
- package/es/contact-edit/var.css +0 -0
- package/es/contact-edit/var.less +0 -8
- package/es/contact-list/var.css +0 -0
- package/es/contact-list/var.less +0 -6
- package/es/count-down/var.css +0 -0
- package/es/count-down/var.less +0 -5
- package/es/coupon/var.css +0 -0
- package/es/coupon/var.less +0 -19
- package/es/coupon-cell/var.css +0 -0
- package/es/coupon-cell/var.less +0 -3
- package/es/coupon-list/var.css +0 -0
- package/es/coupon-list/var.less +0 -10
- package/es/datetime-picker/DatePicker.js +0 -250
- package/es/datetime-picker/DatetimePicker.d.ts +0 -7
- package/es/datetime-picker/DatetimePicker.js +0 -40
- package/es/datetime-picker/TimePicker.js +0 -117
- package/es/datetime-picker/index.d.ts +0 -12
- package/es/datetime-picker/index.js +0 -8
- package/es/datetime-picker/types.d.ts +0 -9
- package/es/datetime-picker/types.js +0 -0
- package/es/datetime-picker/utils.js +0 -63
- package/es/dialog/var.css +0 -0
- package/es/dialog/var.less +0 -21
- package/es/divider/var.css +0 -0
- package/es/divider/var.less +0 -10
- package/es/dropdown-item/var.css +0 -0
- package/es/dropdown-item/var.less +0 -3
- package/es/dropdown-menu/var.css +0 -0
- package/es/dropdown-menu/var.less +0 -13
- package/es/empty/var.css +0 -0
- package/es/empty/var.less +0 -10
- package/es/field/var.css +0 -0
- package/es/field/var.less +0 -21
- package/es/grid-item/var.css +0 -0
- package/es/grid-item/var.less +0 -8
- package/es/image/var.css +0 -0
- package/es/image/var.less +0 -9
- package/es/image-preview/var.css +0 -0
- package/es/image-preview/var.less +0 -11
- package/es/index-anchor/var.css +0 -0
- package/es/index-anchor/var.less +0 -11
- package/es/index-bar/var.css +0 -0
- package/es/index-bar/var.less +0 -6
- package/es/list/var.css +0 -0
- package/es/list/var.less +0 -6
- package/es/loading/var.css +0 -0
- package/es/loading/var.less +0 -7
- package/es/nav-bar/var.css +0 -0
- package/es/nav-bar/var.less +0 -10
- package/es/notice-bar/var.css +0 -0
- package/es/notice-bar/var.less +0 -11
- package/es/notify/var.css +0 -0
- package/es/notify/var.less +0 -10
- package/es/number-keyboard/var.css +0 -0
- package/es/number-keyboard/var.less +0 -17
- package/es/overlay/var.css +0 -0
- package/es/overlay/var.less +0 -4
- package/es/pagination/var.css +0 -0
- package/es/pagination/var.less +0 -11
- package/es/password-input/var.css +0 -0
- package/es/password-input/var.less +0 -17
- package/es/picker/var.css +0 -0
- package/es/picker/var.less +0 -22
- package/es/popover/var.css +0 -0
- package/es/popover/var.less +0 -15
- package/es/popup/var.css +0 -0
- package/es/popup/var.less +0 -9
- package/es/progress/var.css +0 -0
- package/es/progress/var.less +0 -11
- package/es/pull-refresh/var.css +0 -0
- package/es/pull-refresh/var.less +0 -6
- package/es/radio/var.css +0 -0
- package/es/radio/var.less +0 -11
- package/es/rate/var.css +0 -0
- package/es/rate/var.less +0 -7
- package/es/search/var.css +0 -0
- package/es/search/var.less +0 -13
- package/es/share-sheet/var.css +0 -0
- package/es/share-sheet/var.less +0 -18
- package/es/sidebar/var.css +0 -0
- package/es/sidebar/var.less +0 -3
- package/es/sidebar-item/var.css +0 -0
- package/es/sidebar-item/var.less +0 -15
- package/es/skeleton/var.css +0 -0
- package/es/skeleton/var.less +0 -9
- package/es/slider/var.css +0 -0
- package/es/slider/var.less +0 -11
- package/es/step/var.css +0 -0
- package/es/step/var.less +0 -13
- package/es/stepper/var.css +0 -0
- package/es/stepper/var.less +0 -15
- package/es/steps/var.css +0 -0
- package/es/steps/var.less +0 -3
- package/es/sticky/var.css +0 -0
- package/es/sticky/var.less +0 -3
- package/es/style/var.css +0 -0
- package/es/style/var.less +0 -74
- package/es/submit-bar/var.css +0 -0
- package/es/submit-bar/var.less +0 -22
- package/es/swipe/var.css +0 -0
- package/es/swipe/var.less +0 -8
- package/es/switch/var.css +0 -0
- package/es/switch/var.less +0 -14
- package/es/tabbar/var.css +0 -0
- package/es/tabbar/var.less +0 -5
- package/es/tabbar-item/var.css +0 -0
- package/es/tabbar-item/var.less +0 -9
- package/es/tabs/var.css +0 -0
- package/es/tabs/var.less +0 -14
- package/es/tag/var.css +0 -0
- package/es/tag/var.less +0 -18
- package/es/toast/var.css +0 -0
- package/es/toast/var.less +0 -17
- package/es/tree-select/var.css +0 -0
- package/es/tree-select/var.less +0 -10
- package/es/uploader/var.css +0 -0
- package/es/uploader/var.less +0 -27
- package/lib/action-bar/var.css +0 -0
- package/lib/action-bar/var.less +0 -4
- package/lib/action-bar-button/var.css +0 -0
- package/lib/action-bar-button/var.less +0 -5
- package/lib/action-bar-icon/var.css +0 -0
- package/lib/action-bar-icon/var.less +0 -10
- package/lib/action-sheet/var.css +0 -0
- package/lib/action-sheet/var.less +0 -23
- package/lib/address-edit/var.css +0 -0
- package/lib/address-edit/var.less +0 -6
- package/lib/address-list/var.css +0 -0
- package/lib/address-list/var.less +0 -16
- package/lib/badge/var.css +0 -0
- package/lib/badge/var.less +0 -12
- package/lib/button/var.css +0 -0
- package/lib/button/var.less +0 -36
- package/lib/calendar/var.css +0 -0
- package/lib/calendar/var.less +0 -27
- package/lib/card/var.css +0 -0
- package/lib/card/var.less +0 -18
- package/lib/cascader/var.css +0 -0
- package/lib/cascader/var.less +0 -15
- package/lib/cell/var.css +0 -0
- package/lib/cell/var.less +0 -21
- package/lib/cell-group/var.css +0 -0
- package/lib/cell-group/var.less +0 -12
- package/lib/checkbox/var.css +0 -0
- package/lib/checkbox/var.less +0 -11
- package/lib/circle/var.css +0 -0
- package/lib/circle/var.less +0 -9
- package/lib/collapse-item/var.css +0 -0
- package/lib/collapse-item/var.less +0 -9
- package/lib/contact-card/var.css +0 -0
- package/lib/contact-card/var.less +0 -6
- package/lib/contact-edit/var.css +0 -0
- package/lib/contact-edit/var.less +0 -8
- package/lib/contact-list/var.css +0 -0
- package/lib/contact-list/var.less +0 -6
- package/lib/count-down/var.css +0 -0
- package/lib/count-down/var.less +0 -5
- package/lib/coupon/var.css +0 -0
- package/lib/coupon/var.less +0 -19
- package/lib/coupon-cell/var.css +0 -0
- package/lib/coupon-cell/var.less +0 -3
- package/lib/coupon-list/var.css +0 -0
- package/lib/coupon-list/var.less +0 -10
- package/lib/datetime-picker/DatePicker.js +0 -274
- package/lib/datetime-picker/DatetimePicker.d.ts +0 -7
- package/lib/datetime-picker/DatetimePicker.js +0 -69
- package/lib/datetime-picker/TimePicker.js +0 -141
- package/lib/datetime-picker/index.d.ts +0 -12
- package/lib/datetime-picker/types.d.ts +0 -9
- package/lib/dialog/var.css +0 -0
- package/lib/dialog/var.less +0 -21
- package/lib/divider/var.css +0 -0
- package/lib/divider/var.less +0 -10
- package/lib/dropdown-item/var.css +0 -0
- package/lib/dropdown-item/var.less +0 -3
- package/lib/dropdown-menu/var.css +0 -0
- package/lib/dropdown-menu/var.less +0 -13
- package/lib/empty/var.css +0 -0
- package/lib/empty/var.less +0 -10
- package/lib/field/var.css +0 -0
- package/lib/field/var.less +0 -21
- package/lib/grid-item/var.css +0 -0
- package/lib/grid-item/var.less +0 -8
- package/lib/image/var.css +0 -0
- package/lib/image/var.less +0 -9
- package/lib/image-preview/var.css +0 -0
- package/lib/image-preview/var.less +0 -11
- package/lib/index-anchor/var.css +0 -0
- package/lib/index-anchor/var.less +0 -11
- package/lib/index-bar/var.css +0 -0
- package/lib/index-bar/var.less +0 -6
- package/lib/list/var.css +0 -0
- package/lib/list/var.less +0 -6
- package/lib/loading/var.css +0 -0
- package/lib/loading/var.less +0 -7
- package/lib/nav-bar/var.css +0 -0
- package/lib/nav-bar/var.less +0 -10
- package/lib/notice-bar/var.css +0 -0
- package/lib/notice-bar/var.less +0 -11
- package/lib/notify/var.css +0 -0
- package/lib/notify/var.less +0 -10
- package/lib/number-keyboard/var.css +0 -0
- package/lib/number-keyboard/var.less +0 -17
- package/lib/overlay/var.css +0 -0
- package/lib/overlay/var.less +0 -4
- package/lib/pagination/var.css +0 -0
- package/lib/pagination/var.less +0 -11
- package/lib/password-input/var.css +0 -0
- package/lib/password-input/var.less +0 -17
- package/lib/picker/var.css +0 -0
- package/lib/picker/var.less +0 -22
- package/lib/popover/var.css +0 -0
- package/lib/popover/var.less +0 -15
- package/lib/popup/var.css +0 -0
- package/lib/popup/var.less +0 -9
- package/lib/progress/var.css +0 -0
- package/lib/progress/var.less +0 -11
- package/lib/pull-refresh/var.css +0 -0
- package/lib/pull-refresh/var.less +0 -6
- package/lib/radio/var.css +0 -0
- package/lib/radio/var.less +0 -11
- package/lib/rate/var.css +0 -0
- package/lib/rate/var.less +0 -7
- package/lib/search/var.css +0 -0
- package/lib/search/var.less +0 -13
- package/lib/share-sheet/var.css +0 -0
- package/lib/share-sheet/var.less +0 -18
- package/lib/sidebar/var.css +0 -0
- package/lib/sidebar/var.less +0 -3
- package/lib/sidebar-item/var.css +0 -0
- package/lib/sidebar-item/var.less +0 -15
- package/lib/skeleton/var.css +0 -0
- package/lib/skeleton/var.less +0 -9
- package/lib/slider/var.css +0 -0
- package/lib/slider/var.less +0 -11
- package/lib/step/var.css +0 -0
- package/lib/step/var.less +0 -13
- package/lib/stepper/var.css +0 -0
- package/lib/stepper/var.less +0 -15
- package/lib/steps/var.css +0 -0
- package/lib/steps/var.less +0 -3
- package/lib/sticky/var.css +0 -0
- package/lib/sticky/var.less +0 -3
- package/lib/style/var.css +0 -0
- package/lib/style/var.less +0 -74
- package/lib/submit-bar/var.css +0 -0
- package/lib/submit-bar/var.less +0 -22
- package/lib/swipe/var.css +0 -0
- package/lib/swipe/var.less +0 -8
- package/lib/switch/var.css +0 -0
- package/lib/switch/var.less +0 -14
- package/lib/tabbar/var.css +0 -0
- package/lib/tabbar/var.less +0 -5
- package/lib/tabbar-item/var.css +0 -0
- package/lib/tabbar-item/var.less +0 -9
- package/lib/tabs/var.css +0 -0
- package/lib/tabs/var.less +0 -14
- package/lib/tag/var.css +0 -0
- package/lib/tag/var.less +0 -18
- package/lib/toast/var.css +0 -0
- package/lib/toast/var.less +0 -17
- package/lib/tree-select/var.css +0 -0
- package/lib/tree-select/var.less +0 -10
- package/lib/uploader/var.css +0 -0
- package/lib/uploader/var.less +0 -27
@@ -27,36 +27,27 @@ __export(stdin_exports, {
|
|
27
27
|
});
|
28
28
|
var import_vue = require("vue");
|
29
29
|
var import_vue2 = require("vue");
|
30
|
-
var import_deep_clone = require("../utils/deep-clone");
|
31
30
|
var import_utils = require("../utils");
|
31
|
+
var import_utils2 = require("./utils");
|
32
32
|
var import_use = require("@vant/use");
|
33
33
|
var import_use_touch = require("../composables/use-touch");
|
34
34
|
var import_use_expose = require("../composables/use-expose");
|
35
35
|
const DEFAULT_DURATION = 200;
|
36
|
-
const
|
37
|
-
const
|
36
|
+
const MOMENTUM_TIME = 300;
|
37
|
+
const MOMENTUM_DISTANCE = 15;
|
38
38
|
const [name, bem] = (0, import_utils.createNamespace)("picker-column");
|
39
|
-
function getElementTranslateY(element) {
|
40
|
-
const {
|
41
|
-
transform
|
42
|
-
} = window.getComputedStyle(element);
|
43
|
-
const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
|
44
|
-
return Number(translateY);
|
45
|
-
}
|
46
39
|
const PICKER_KEY = Symbol(name);
|
47
|
-
const isOptionDisabled = (option) => (0, import_utils.isObject)(option) && option.disabled;
|
48
40
|
var stdin_default = (0, import_vue2.defineComponent)({
|
49
41
|
name,
|
50
42
|
props: {
|
51
|
-
|
43
|
+
value: import_utils.numericProp,
|
44
|
+
fields: (0, import_utils.makeRequiredProp)(Object),
|
45
|
+
options: (0, import_utils.makeArrayProp)(),
|
52
46
|
readonly: Boolean,
|
53
47
|
allowHtml: Boolean,
|
54
|
-
|
55
|
-
itemHeight: (0, import_utils.makeRequiredProp)(Number),
|
56
|
-
defaultIndex: (0, import_utils.makeNumberProp)(0),
|
48
|
+
optionHeight: (0, import_utils.makeRequiredProp)(Number),
|
57
49
|
swipeDuration: (0, import_utils.makeRequiredProp)(import_utils.numericProp),
|
58
|
-
|
59
|
-
visibleItemCount: (0, import_utils.makeRequiredProp)(import_utils.numericProp)
|
50
|
+
visibleOptionNum: (0, import_utils.makeRequiredProp)(import_utils.numericProp)
|
60
51
|
},
|
61
52
|
emits: ["change"],
|
62
53
|
setup(props, {
|
@@ -69,75 +60,46 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
69
60
|
let momentumOffset;
|
70
61
|
let transitionEndTrigger;
|
71
62
|
const wrapper = (0, import_vue2.ref)();
|
72
|
-
const
|
73
|
-
|
74
|
-
offset: 0,
|
75
|
-
duration: 0,
|
76
|
-
options: (0, import_deep_clone.deepClone)(props.initialOptions)
|
77
|
-
});
|
63
|
+
const currentOffset = (0, import_vue2.ref)(0);
|
64
|
+
const currentDuration = (0, import_vue2.ref)(0);
|
78
65
|
const touch = (0, import_use_touch.useTouch)();
|
79
|
-
const count = () =>
|
80
|
-
const baseOffset = () => props.
|
81
|
-
const
|
82
|
-
|
83
|
-
|
84
|
-
if (!isOptionDisabled(state.options[i]))
|
85
|
-
return i;
|
86
|
-
}
|
87
|
-
for (let i = index - 1; i >= 0; i--) {
|
88
|
-
if (!isOptionDisabled(state.options[i]))
|
89
|
-
return i;
|
90
|
-
}
|
91
|
-
};
|
92
|
-
const setIndex = (index, emitChange) => {
|
93
|
-
index = adjustIndex(index) || 0;
|
94
|
-
const offset = -index * props.itemHeight;
|
66
|
+
const count = () => props.options.length;
|
67
|
+
const baseOffset = () => props.optionHeight * (+props.visibleOptionNum - 1) / 2;
|
68
|
+
const updateValueByIndex = (index) => {
|
69
|
+
const enabledIndex = (0, import_utils2.findIndexOfEnabledOption)(props.options, index);
|
70
|
+
const offset = -enabledIndex * props.optionHeight;
|
95
71
|
const trigger = () => {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
emit("change", index);
|
100
|
-
}
|
72
|
+
const value = props.options[enabledIndex][props.fields.value];
|
73
|
+
if (value !== props.value) {
|
74
|
+
emit("change", value);
|
101
75
|
}
|
102
76
|
};
|
103
|
-
if (moving && offset !==
|
77
|
+
if (moving && offset !== currentOffset.value) {
|
104
78
|
transitionEndTrigger = trigger;
|
105
79
|
} else {
|
106
80
|
trigger();
|
107
81
|
}
|
108
|
-
|
109
|
-
};
|
110
|
-
const setOptions = (options) => {
|
111
|
-
if (JSON.stringify(options) !== JSON.stringify(state.options)) {
|
112
|
-
state.options = (0, import_deep_clone.deepClone)(options);
|
113
|
-
setIndex(props.defaultIndex);
|
114
|
-
}
|
82
|
+
currentOffset.value = offset;
|
115
83
|
};
|
116
84
|
const onClickItem = (index) => {
|
117
85
|
if (moving || props.readonly) {
|
118
86
|
return;
|
119
87
|
}
|
120
88
|
transitionEndTrigger = null;
|
121
|
-
|
122
|
-
|
89
|
+
currentDuration.value = DEFAULT_DURATION;
|
90
|
+
updateValueByIndex(index);
|
123
91
|
};
|
124
|
-
const
|
125
|
-
if ((0, import_utils.isObject)(option) && props.textKey in option) {
|
126
|
-
return option[props.textKey];
|
127
|
-
}
|
128
|
-
return option;
|
129
|
-
};
|
130
|
-
const getIndexByOffset = (offset) => (0, import_utils.clamp)(Math.round(-offset / props.itemHeight), 0, count() - 1);
|
92
|
+
const getIndexByOffset = (offset) => (0, import_utils.clamp)(Math.round(-offset / props.optionHeight), 0, count() - 1);
|
131
93
|
const momentum = (distance, duration) => {
|
132
94
|
const speed = Math.abs(distance / duration);
|
133
|
-
distance =
|
95
|
+
distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
|
134
96
|
const index = getIndexByOffset(distance);
|
135
|
-
|
136
|
-
|
97
|
+
currentDuration.value = +props.swipeDuration;
|
98
|
+
updateValueByIndex(index);
|
137
99
|
};
|
138
100
|
const stopMomentum = () => {
|
139
101
|
moving = false;
|
140
|
-
|
102
|
+
currentDuration.value = 0;
|
141
103
|
if (transitionEndTrigger) {
|
142
104
|
transitionEndTrigger();
|
143
105
|
transitionEndTrigger = null;
|
@@ -149,13 +111,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
149
111
|
}
|
150
112
|
touch.start(event);
|
151
113
|
if (moving) {
|
152
|
-
const translateY = getElementTranslateY(wrapper.value);
|
153
|
-
|
154
|
-
startOffset = state.offset;
|
155
|
-
} else {
|
156
|
-
startOffset = state.offset;
|
114
|
+
const translateY = (0, import_utils2.getElementTranslateY)(wrapper.value);
|
115
|
+
currentOffset.value = Math.min(0, translateY - baseOffset());
|
157
116
|
}
|
158
|
-
|
117
|
+
currentDuration.value = 0;
|
118
|
+
startOffset = currentOffset.value;
|
159
119
|
touchStartTime = Date.now();
|
160
120
|
momentumOffset = startOffset;
|
161
121
|
transitionEndTrigger = null;
|
@@ -169,46 +129,49 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
169
129
|
moving = true;
|
170
130
|
(0, import_utils.preventDefault)(event, true);
|
171
131
|
}
|
172
|
-
|
132
|
+
currentOffset.value = (0, import_utils.clamp)(startOffset + touch.deltaY.value, -(count() * props.optionHeight), props.optionHeight);
|
173
133
|
const now = Date.now();
|
174
|
-
if (now - touchStartTime >
|
134
|
+
if (now - touchStartTime > MOMENTUM_TIME) {
|
175
135
|
touchStartTime = now;
|
176
|
-
momentumOffset =
|
136
|
+
momentumOffset = currentOffset.value;
|
177
137
|
}
|
178
138
|
};
|
179
139
|
const onTouchEnd = () => {
|
180
140
|
if (props.readonly) {
|
181
141
|
return;
|
182
142
|
}
|
183
|
-
const distance =
|
143
|
+
const distance = currentOffset.value - momentumOffset;
|
184
144
|
const duration = Date.now() - touchStartTime;
|
185
|
-
const
|
186
|
-
if (
|
145
|
+
const startMomentum = duration < MOMENTUM_TIME && Math.abs(distance) > MOMENTUM_DISTANCE;
|
146
|
+
if (startMomentum) {
|
187
147
|
momentum(distance, duration);
|
188
148
|
return;
|
189
149
|
}
|
190
|
-
const index = getIndexByOffset(
|
191
|
-
|
192
|
-
|
150
|
+
const index = getIndexByOffset(currentOffset.value);
|
151
|
+
currentDuration.value = DEFAULT_DURATION;
|
152
|
+
updateValueByIndex(index);
|
193
153
|
setTimeout(() => {
|
194
154
|
moving = false;
|
195
155
|
}, 0);
|
196
156
|
};
|
197
157
|
const renderOptions = () => {
|
198
158
|
const optionStyle = {
|
199
|
-
height: `${props.
|
159
|
+
height: `${props.optionHeight}px`
|
200
160
|
};
|
201
|
-
return
|
202
|
-
const text =
|
203
|
-
const
|
161
|
+
return props.options.map((option, index) => {
|
162
|
+
const text = option[props.fields.text];
|
163
|
+
const {
|
164
|
+
disabled
|
165
|
+
} = option;
|
166
|
+
const value = option[props.fields.value];
|
204
167
|
const data = {
|
205
168
|
role: "button",
|
206
169
|
style: optionStyle,
|
207
170
|
tabindex: disabled ? -1 : 0,
|
208
|
-
class: bem("item", {
|
171
|
+
class: [bem("item", {
|
209
172
|
disabled,
|
210
|
-
selected:
|
211
|
-
}),
|
173
|
+
selected: value === props.value
|
174
|
+
}), option.className],
|
212
175
|
onClick: () => onClickItem(index)
|
213
176
|
};
|
214
177
|
const childData = {
|
@@ -218,31 +181,18 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
218
181
|
return (0, import_vue.createVNode)("li", data, [slots.option ? slots.option(option) : (0, import_vue.createVNode)("div", childData, null)]);
|
219
182
|
});
|
220
183
|
};
|
221
|
-
const setValue = (value) => {
|
222
|
-
const {
|
223
|
-
options
|
224
|
-
} = state;
|
225
|
-
for (let i = 0; i < options.length; i++) {
|
226
|
-
if (getOptionText(options[i]) === value) {
|
227
|
-
return setIndex(i);
|
228
|
-
}
|
229
|
-
}
|
230
|
-
};
|
231
|
-
const getValue = () => state.options[state.index];
|
232
|
-
setIndex(state.index);
|
233
184
|
(0, import_use.useParent)(PICKER_KEY);
|
234
185
|
(0, import_use_expose.useExpose)({
|
235
|
-
state,
|
236
|
-
setIndex,
|
237
|
-
getValue,
|
238
|
-
setValue,
|
239
|
-
setOptions,
|
240
186
|
stopMomentum
|
241
187
|
});
|
242
|
-
(0, import_vue2.
|
243
|
-
|
188
|
+
(0, import_vue2.watchEffect)(() => {
|
189
|
+
const index = props.options.findIndex((option) => option[props.fields.value] === props.value);
|
190
|
+
const enabledIndex = (0, import_utils2.findIndexOfEnabledOption)(props.options, index);
|
191
|
+
const offset = -enabledIndex * props.optionHeight;
|
192
|
+
currentOffset.value = offset;
|
193
|
+
});
|
244
194
|
return () => (0, import_vue.createVNode)("div", {
|
245
|
-
"class":
|
195
|
+
"class": bem(),
|
246
196
|
"onTouchstart": onTouchStart,
|
247
197
|
"onTouchmove": onTouchMove,
|
248
198
|
"onTouchend": onTouchEnd,
|
@@ -250,9 +200,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
250
200
|
}, [(0, import_vue.createVNode)("ul", {
|
251
201
|
"ref": wrapper,
|
252
202
|
"style": {
|
253
|
-
transform: `translate3d(0, ${
|
254
|
-
transitionDuration: `${
|
255
|
-
transitionProperty:
|
203
|
+
transform: `translate3d(0, ${currentOffset.value + baseOffset()}px, 0)`,
|
204
|
+
transitionDuration: `${currentDuration.value}ms`,
|
205
|
+
transitionProperty: currentDuration.value ? "all" : "none"
|
256
206
|
},
|
257
207
|
"class": bem("wrapper"),
|
258
208
|
"onTransitionend": stopMomentum
|
package/lib/picker/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
body{--van-picker-background: var(--van-background-2);--van-picker-toolbar-height: 44px;--van-picker-title-font-size: var(--van-font-size-lg);--van-picker-title-line-height: var(--van-line-height-md);--van-picker-action-padding: 0 var(--van-padding-md);--van-picker-action-font-size: var(--van-font-size-md);--van-picker-confirm-action-color: var(--van-link-color);--van-picker-cancel-action-color: var(--van-text-color-2);--van-picker-option-font-size: var(--van-font-size-lg);--van-picker-option-padding: 0 var(--van-padding-base);--van-picker-option-text-color: var(--van-text-color);--van-picker-option-disabled-opacity: .3;--van-picker-loading-icon-color: var(--van-primary-color);--van-picker-loading-mask-color: rgba(255, 255, 255, .9);--van-picker-mask-color: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4)), linear-gradient(0deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4))}.van-theme-dark{--van-picker-mask-color: linear-gradient(180deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .1)), linear-gradient(0deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .1))}.van-picker{position:relative;background:var(--van-picker-background);-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:flex;align-items:center;justify-content:space-between;height:var(--van-picker-toolbar-height)}.van-picker__cancel,.van-picker__confirm{height:100%;padding:var(--van-picker-action-padding);font-size:var(--van-picker-action-font-size);background-color:transparent;border:none}.van-picker__confirm{color:var(--van-picker-confirm-action-color)}.van-picker__cancel{color:var(--van-picker-cancel-action-color)}.van-picker__title{max-width:50%;font-weight:var(--van-font-bold);font-size:var(--van-picker-title-font-size);line-height:var(--van-picker-title-line-height);text-align:center}.van-picker__columns{position:relative;display:flex;cursor:-webkit-grab;cursor:grab}.van-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:3;display:flex;align-items:center;justify-content:center;color:var(--van-picker-loading-icon-color);background:var(--van-picker-loading-mask-color)}.van-picker__frame{position:absolute;top:50%;right:var(--van-padding-md);left:var(--van-padding-md);z-index:2;transform:translateY(-50%);pointer-events:none}.van-picker__mask{position:absolute;top:0;left:0;z-index:1;width:100%;height:100%;background-image:var(--van-picker-mask-color);background-repeat:no-repeat;background-position:top,bottom;transform:translateZ(0);pointer-events:none}.van-picker-column{flex:1;overflow:hidden;font-size:var(--van-picker-option-font-size)}.van-picker-column__wrapper{transition-timing-function:cubic-bezier(.23,1,.68,1)}.van-picker-column__item{display:flex;align-items:center;justify-content:center;padding:var(--van-picker-option-padding);color:var(--van-picker-option-text-color)}.van-picker-column__item--disabled{cursor:not-allowed;opacity:var(--van-picker-option-disabled-opacity)}
|
package/lib/picker/index.d.ts
CHANGED
@@ -4,7 +4,7 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
4
4
|
loading: BooleanConstructor;
|
5
5
|
readonly: BooleanConstructor;
|
6
6
|
allowHtml: BooleanConstructor;
|
7
|
-
|
7
|
+
optionHeight: {
|
8
8
|
type: (NumberConstructor | StringConstructor)[];
|
9
9
|
default: number;
|
10
10
|
};
|
@@ -16,7 +16,7 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
16
16
|
type: (NumberConstructor | StringConstructor)[];
|
17
17
|
default: number;
|
18
18
|
};
|
19
|
-
|
19
|
+
visibleOptionNum: {
|
20
20
|
type: (NumberConstructor | StringConstructor)[];
|
21
21
|
default: number;
|
22
22
|
};
|
@@ -24,25 +24,24 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
24
24
|
confirmButtonText: StringConstructor;
|
25
25
|
} & {
|
26
26
|
columns: {
|
27
|
-
type: import("vue").PropType<(import("./types").
|
27
|
+
type: import("vue").PropType<(import("./types").PickerColumn | import("./types").PickerOption)[]>;
|
28
28
|
default: () => never[];
|
29
29
|
};
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
default: number;
|
30
|
+
modelValue: {
|
31
|
+
type: import("vue").PropType<(string | number)[]>;
|
32
|
+
default: () => never[];
|
34
33
|
};
|
35
34
|
toolbarPosition: {
|
36
35
|
type: import("vue").PropType<import("./types").PickerToolbarPosition>;
|
37
36
|
default: import("./types").PickerToolbarPosition;
|
38
37
|
};
|
39
38
|
columnsFieldNames: import("vue").PropType<import("./types").PickerFieldNames>;
|
40
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "cancel" | "confirm")[], "change" | "cancel" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
39
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change" | "cancel" | "confirm")[], "update:modelValue" | "change" | "cancel" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
41
40
|
title: StringConstructor;
|
42
41
|
loading: BooleanConstructor;
|
43
42
|
readonly: BooleanConstructor;
|
44
43
|
allowHtml: BooleanConstructor;
|
45
|
-
|
44
|
+
optionHeight: {
|
46
45
|
type: (NumberConstructor | StringConstructor)[];
|
47
46
|
default: number;
|
48
47
|
};
|
@@ -54,7 +53,7 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
54
53
|
type: (NumberConstructor | StringConstructor)[];
|
55
54
|
default: number;
|
56
55
|
};
|
57
|
-
|
56
|
+
visibleOptionNum: {
|
58
57
|
type: (NumberConstructor | StringConstructor)[];
|
59
58
|
default: number;
|
60
59
|
};
|
@@ -62,13 +61,12 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
62
61
|
confirmButtonText: StringConstructor;
|
63
62
|
} & {
|
64
63
|
columns: {
|
65
|
-
type: import("vue").PropType<(import("./types").
|
64
|
+
type: import("vue").PropType<(import("./types").PickerColumn | import("./types").PickerOption)[]>;
|
66
65
|
default: () => never[];
|
67
66
|
};
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
default: number;
|
67
|
+
modelValue: {
|
68
|
+
type: import("vue").PropType<(string | number)[]>;
|
69
|
+
default: () => never[];
|
72
70
|
};
|
73
71
|
toolbarPosition: {
|
74
72
|
type: import("vue").PropType<import("./types").PickerToolbarPosition>;
|
@@ -77,23 +75,24 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
77
75
|
columnsFieldNames: import("vue").PropType<import("./types").PickerFieldNames>;
|
78
76
|
}>> & {
|
79
77
|
onChange?: ((...args: any[]) => any) | undefined;
|
78
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
80
79
|
onCancel?: ((...args: any[]) => any) | undefined;
|
81
80
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
82
81
|
}, {
|
82
|
+
modelValue: (string | number)[];
|
83
83
|
readonly: boolean;
|
84
84
|
loading: boolean;
|
85
|
-
defaultIndex: string | number;
|
86
85
|
allowHtml: boolean;
|
87
|
-
|
86
|
+
optionHeight: string | number;
|
88
87
|
showToolbar: boolean;
|
89
88
|
swipeDuration: string | number;
|
90
|
-
|
91
|
-
columns: (import("./types").
|
89
|
+
visibleOptionNum: string | number;
|
90
|
+
columns: (import("./types").PickerColumn | import("./types").PickerOption)[];
|
92
91
|
toolbarPosition: import("./types").PickerToolbarPosition;
|
93
92
|
}>>;
|
94
93
|
export default Picker;
|
95
94
|
export type { PickerProps };
|
96
|
-
export type { PickerColumn, PickerOption, PickerInstance, PickerFieldNames,
|
95
|
+
export type { PickerColumn, PickerOption, PickerInstance, PickerFieldNames, PickerToolbarPosition, PickerCancelEventParams, PickerChangeEventParams, PickerConfirmEventParams, } from './types';
|
97
96
|
declare module 'vue' {
|
98
97
|
interface GlobalComponents {
|
99
98
|
VanPicker: typeof Picker;
|
package/lib/picker/index.less
CHANGED
@@ -1,26 +1,38 @@
|
|
1
|
-
|
1
|
+
body {
|
2
|
+
--van-picker-background: var(--van-background-2);
|
3
|
+
--van-picker-toolbar-height: 44px;
|
4
|
+
--van-picker-title-font-size: var(--van-font-size-lg);
|
5
|
+
--van-picker-title-line-height: var(--van-line-height-md);
|
6
|
+
--van-picker-action-padding: 0 var(--van-padding-md);
|
7
|
+
--van-picker-action-font-size: var(--van-font-size-md);
|
8
|
+
--van-picker-confirm-action-color: var(--van-link-color);
|
9
|
+
--van-picker-cancel-action-color: var(--van-text-color-2);
|
10
|
+
--van-picker-option-font-size: var(--van-font-size-lg);
|
11
|
+
--van-picker-option-padding: 0 var(--van-padding-base);
|
12
|
+
--van-picker-option-text-color: var(--van-text-color);
|
13
|
+
--van-picker-option-disabled-opacity: 0.3;
|
14
|
+
--van-picker-loading-icon-color: var(--van-primary-color);
|
15
|
+
--van-picker-loading-mask-color: rgba(255, 255, 255, 0.9);
|
16
|
+
--van-picker-mask-color: linear-gradient(
|
17
|
+
180deg,
|
18
|
+
rgba(255, 255, 255, 0.9),
|
19
|
+
rgba(255, 255, 255, 0.4)
|
20
|
+
),
|
21
|
+
linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.4));
|
22
|
+
}
|
2
23
|
|
3
|
-
|
4
|
-
--van-picker-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
--van-picker-confirm-action-color: @picker-confirm-action-color;
|
11
|
-
--van-picker-cancel-action-color: @picker-cancel-action-color;
|
12
|
-
--van-picker-option-font-size: @picker-option-font-size;
|
13
|
-
--van-picker-option-padding: @picker-option-padding;
|
14
|
-
--van-picker-option-text-color: @picker-option-text-color;
|
15
|
-
--van-picker-option-disabled-opacity: @picker-option-disabled-opacity;
|
16
|
-
--van-picker-loading-icon-color: @picker-loading-icon-color;
|
17
|
-
--van-picker-loading-mask-color: @picker-loading-mask-color;
|
18
|
-
--van-picker-mask-color: @picker-mask-color;
|
24
|
+
.van-theme-dark {
|
25
|
+
--van-picker-mask-color: linear-gradient(
|
26
|
+
180deg,
|
27
|
+
rgba(0, 0, 0, 0.6),
|
28
|
+
rgba(0, 0, 0, 0.1)
|
29
|
+
),
|
30
|
+
linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.1));
|
19
31
|
}
|
20
32
|
|
21
33
|
.van-picker {
|
22
34
|
position: relative;
|
23
|
-
background: var(--van-picker-background
|
35
|
+
background: var(--van-picker-background);
|
24
36
|
user-select: none;
|
25
37
|
|
26
38
|
&__toolbar {
|
@@ -49,7 +61,7 @@
|
|
49
61
|
|
50
62
|
&__title {
|
51
63
|
max-width: 50%;
|
52
|
-
font-weight: var(--van-font-
|
64
|
+
font-weight: var(--van-font-bold);
|
53
65
|
font-size: var(--van-picker-title-font-size);
|
54
66
|
line-height: var(--van-picker-title-line-height);
|
55
67
|
text-align: center;
|
package/lib/picker/types.d.ts
CHANGED
@@ -3,35 +3,21 @@ import type { PickerProps } from './Picker';
|
|
3
3
|
export declare type PickerToolbarPosition = 'top' | 'bottom';
|
4
4
|
export declare type PickerFieldNames = {
|
5
5
|
text?: string;
|
6
|
-
|
6
|
+
value?: string;
|
7
7
|
children?: string;
|
8
8
|
};
|
9
|
-
export declare type
|
9
|
+
export declare type PickerOption = {
|
10
10
|
text?: string | number;
|
11
|
+
value?: string | number;
|
11
12
|
disabled?: boolean;
|
12
|
-
[key: PropertyKey]: any;
|
13
|
-
};
|
14
|
-
export declare type PickerOption = string | number | PickerObjectOption;
|
15
|
-
export declare type PickerObjectColumn = {
|
16
|
-
values?: PickerOption[];
|
17
13
|
children?: PickerColumn;
|
18
14
|
className?: unknown;
|
19
|
-
defaultIndex?: number;
|
20
15
|
[key: PropertyKey]: any;
|
21
16
|
};
|
22
|
-
export declare type PickerColumn = PickerOption[]
|
17
|
+
export declare type PickerColumn = PickerOption[];
|
23
18
|
export declare type PickerExpose = {
|
24
19
|
confirm: () => void;
|
25
|
-
|
26
|
-
setValues: (values: string[]) => void;
|
27
|
-
getIndexes: () => number[];
|
28
|
-
setIndexes: (indexes: number[]) => void;
|
29
|
-
getColumnIndex: (index: number) => number;
|
30
|
-
setColumnIndex: (columnIndex: number, optionIndex: number) => void;
|
31
|
-
getColumnValue: <T = PickerOption>(index: number) => T;
|
32
|
-
setColumnValue: (index: number, value: string) => void;
|
33
|
-
getColumnValues: <T = PickerOption>(index: number) => T[];
|
34
|
-
setColumnValues: (index: number, options: PickerOption[]) => void;
|
20
|
+
getSelectedOptions: () => Array<PickerOption | undefined>;
|
35
21
|
};
|
36
22
|
export declare type PickerColumnProvide = {
|
37
23
|
state: {
|
@@ -47,3 +33,11 @@ export declare type PickerColumnProvide = {
|
|
47
33
|
stopMomentum: () => void;
|
48
34
|
};
|
49
35
|
export declare type PickerInstance = ComponentPublicInstance<PickerProps, PickerExpose>;
|
36
|
+
export declare type PickerConfirmEventParams = {
|
37
|
+
selectedValues: Array<number | string>;
|
38
|
+
selectedOptions: Array<PickerOption | undefined>;
|
39
|
+
};
|
40
|
+
export declare type PickerCancelEventParams = PickerConfirmEventParams;
|
41
|
+
export declare type PickerChangeEventParams = PickerConfirmEventParams & {
|
42
|
+
columnIndex: number;
|
43
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { Ref } from 'vue';
|
2
|
+
import type { PickerOption, PickerColumn, PickerFieldNames } from './types';
|
3
|
+
export declare const getFirstEnabledOption: (options: PickerOption[]) => PickerOption | undefined;
|
4
|
+
export declare function getColumnsType(columns: PickerColumn | PickerColumn[], fields: Required<PickerFieldNames>): "default" | "multiple" | "cascade";
|
5
|
+
export declare function findIndexOfEnabledOption(options: PickerOption[], index: number): number;
|
6
|
+
export declare const isOptionExist: (options: PickerOption[], value: number | string | undefined, fields: Required<PickerFieldNames>) => boolean;
|
7
|
+
export declare function findOptionByValue(options: PickerOption[], value: number | string, fields: Required<PickerFieldNames>): PickerOption | undefined;
|
8
|
+
export declare function formatCascadeColumns(columns: PickerColumn | PickerColumn[], fields: Required<PickerFieldNames>, selectedValues: Ref<Array<number | string>>): PickerColumn[];
|
9
|
+
export declare function getElementTranslateY(element: Element): number;
|
10
|
+
export declare function assignDefaultFields(fields: PickerFieldNames | undefined): Required<PickerFieldNames>;
|
@@ -0,0 +1,97 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
11
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
12
|
+
for (let key of __getOwnPropNames(module2))
|
13
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
14
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return target;
|
17
|
+
};
|
18
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
19
|
+
return (module2, temp) => {
|
20
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
21
|
+
};
|
22
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
23
|
+
var stdin_exports = {};
|
24
|
+
__export(stdin_exports, {
|
25
|
+
assignDefaultFields: () => assignDefaultFields,
|
26
|
+
findIndexOfEnabledOption: () => findIndexOfEnabledOption,
|
27
|
+
findOptionByValue: () => findOptionByValue,
|
28
|
+
formatCascadeColumns: () => formatCascadeColumns,
|
29
|
+
getColumnsType: () => getColumnsType,
|
30
|
+
getElementTranslateY: () => getElementTranslateY,
|
31
|
+
getFirstEnabledOption: () => getFirstEnabledOption,
|
32
|
+
isOptionExist: () => isOptionExist
|
33
|
+
});
|
34
|
+
var import_utils = require("../utils");
|
35
|
+
const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
|
36
|
+
function getColumnsType(columns, fields) {
|
37
|
+
const firstColumn = columns[0];
|
38
|
+
if (firstColumn) {
|
39
|
+
if (Array.isArray(firstColumn)) {
|
40
|
+
return "multiple";
|
41
|
+
}
|
42
|
+
if (fields.children in firstColumn) {
|
43
|
+
return "cascade";
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return "default";
|
47
|
+
}
|
48
|
+
function findIndexOfEnabledOption(options, index) {
|
49
|
+
index = (0, import_utils.clamp)(index, 0, options.length);
|
50
|
+
for (let i = index; i < options.length; i++) {
|
51
|
+
if (!options[i].disabled)
|
52
|
+
return i;
|
53
|
+
}
|
54
|
+
for (let i = index - 1; i >= 0; i--) {
|
55
|
+
if (!options[i].disabled)
|
56
|
+
return i;
|
57
|
+
}
|
58
|
+
return 0;
|
59
|
+
}
|
60
|
+
const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
|
61
|
+
function findOptionByValue(options, value, fields) {
|
62
|
+
const index = options.findIndex((option) => option[fields.value] === value);
|
63
|
+
const enabledIndex = findIndexOfEnabledOption(options, index);
|
64
|
+
return options[enabledIndex];
|
65
|
+
}
|
66
|
+
function formatCascadeColumns(columns, fields, selectedValues) {
|
67
|
+
const formatted = [];
|
68
|
+
let cursor = {
|
69
|
+
[fields.children]: columns
|
70
|
+
};
|
71
|
+
let columnIndex = 0;
|
72
|
+
while (cursor && cursor[fields.children]) {
|
73
|
+
const options = cursor[fields.children];
|
74
|
+
const value = selectedValues.value[columnIndex];
|
75
|
+
cursor = (0, import_utils.isDef)(value) ? findOptionByValue(options, value, fields) : void 0;
|
76
|
+
if (!cursor && options.length) {
|
77
|
+
const firstValue = getFirstEnabledOption(options)[fields.value];
|
78
|
+
cursor = findOptionByValue(options, firstValue, fields);
|
79
|
+
}
|
80
|
+
columnIndex++;
|
81
|
+
formatted.push(options);
|
82
|
+
}
|
83
|
+
return formatted;
|
84
|
+
}
|
85
|
+
function getElementTranslateY(element) {
|
86
|
+
const { transform } = window.getComputedStyle(element);
|
87
|
+
const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
|
88
|
+
return Number(translateY);
|
89
|
+
}
|
90
|
+
function assignDefaultFields(fields) {
|
91
|
+
return (0, import_utils.extend)({
|
92
|
+
text: "text",
|
93
|
+
value: "value",
|
94
|
+
children: "children"
|
95
|
+
}, fields);
|
96
|
+
}
|
97
|
+
module.exports = __toCommonJS(stdin_exports);
|
package/lib/popover/Popover.d.ts
CHANGED
@@ -149,13 +149,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
149
149
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
150
150
|
}, {
|
151
151
|
offset: [number, number];
|
152
|
+
theme: PopoverTheme;
|
152
153
|
overlay: boolean;
|
153
154
|
show: boolean;
|
154
155
|
teleport: string | import("vue").RendererElement | null | undefined;
|
155
156
|
closeOnClickOverlay: boolean;
|
156
157
|
actions: PopoverAction[];
|
157
158
|
closeOnClickAction: boolean;
|
158
|
-
theme: PopoverTheme;
|
159
159
|
closeOnClickOutside: boolean;
|
160
160
|
trigger: PopoverTrigger;
|
161
161
|
showArrow: boolean;
|