vue-devui 1.0.0-beta.2 → 1.0.0-beta.20220808
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/README.md +163 -172
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +79 -51
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.d.ts +7 -0
- package/auto-complete/index.es.js +9053 -0
- package/auto-complete/index.umd.js +40 -0
- package/auto-complete/package.json +7 -0
- package/auto-complete/style.css +1 -0
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +154 -147
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +46 -21
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +5921 -146
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +64 -36
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +8122 -255
- package/checkbox/index.umd.js +38 -1
- package/checkbox/style.css +1 -1
- package/collapse/index.d.ts +7 -0
- package/collapse/index.es.js +195 -0
- package/collapse/index.umd.js +1 -0
- package/{cascader → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +217 -0
- package/countdown/index.umd.js +1 -0
- package/{accordion → countdown}/package.json +1 -1
- package/countdown/style.css +1 -0
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12035 -0
- package/date-picker-pro/index.umd.js +38 -0
- package/date-picker-pro/package.json +7 -0
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +205 -154
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +736 -0
- package/dropdown/index.umd.js +1 -0
- package/{carousel → dropdown}/package.json +1 -1
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +908 -461
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2439 -1995
- package/form/index.umd.js +29 -18
- package/form/style.css +1 -1
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +138 -125
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +271 -0
- package/grid/index.umd.js +1 -0
- package/{toast → grid}/package.json +1 -1
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +200 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +154 -62
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +8269 -145
- package/input/index.umd.js +38 -1
- package/input/style.css +1 -1
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +260 -191
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +41 -26
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +89 -73
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8326 -0
- package/mention/index.umd.js +47 -0
- package/mention/package.json +7 -0
- package/mention/style.css +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/index.es.js +891 -0
- package/menu/index.umd.js +1 -0
- package/{anchor → menu}/package.json +1 -1
- package/menu/style.css +1 -0
- package/message/index.d.ts +7 -0
- package/message/index.es.js +533 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +611 -877
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.d.ts +7 -0
- package/notification/index.es.js +528 -0
- package/notification/index.umd.js +1 -0
- package/notification/package.json +7 -0
- package/notification/style.css +1 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/AutoComplete.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/DrawerService.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/DropdownMenu.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/IFileOptions.js +3 -0
- package/nuxt/components/IUploadOptions.js +3 -0
- package/nuxt/components/Icon.js +3 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Mention.js +3 -0
- package/nuxt/components/Menu.js +3 -0
- package/nuxt/components/MenuItem.js +3 -0
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/Notification.js +3 -0
- package/nuxt/components/NotificationService.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/SubMenu.js +3 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/UploadStatus.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/badgeProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/fixedOverlayProps.js +3 -0
- package/nuxt/components/flexibleOverlayProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/mentionProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/notificationProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/popoverProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/nuxt/components/treeNodeProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/nuxt/components/uploadProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +245 -303
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +16 -84
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +333 -155
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +48 -35
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +6035 -204
- package/popover/index.umd.js +27 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +111 -57
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +8015 -182
- package/radio/index.umd.js +38 -1
- package/radio/style.css +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +78 -56
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.d.ts +7 -0
- package/result/index.es.js +248 -0
- package/result/index.umd.js +1 -0
- package/{sticky → result}/package.json +1 -1
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +56 -61
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +8381 -406
- package/search/index.umd.js +38 -1
- package/search/style.css +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +9331 -576
- package/select/index.umd.js +38 -1
- package/select/style.css +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +115 -145
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +148 -142
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +6308 -181
- package/splitter/index.umd.js +27 -1
- package/splitter/style.css +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +253 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +29 -8
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +386 -0
- package/steps/index.umd.js +1 -0
- package/steps/package.json +7 -0
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +7819 -65
- package/switch/index.umd.js +38 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +11435 -204
- package/table/index.umd.js +38 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +356 -143
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +156 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +7989 -0
- package/textarea/index.umd.js +46 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/{theme → theme/theme.scss} +0 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9126 -597
- package/time-picker/index.umd.js +38 -1
- package/time-picker/style.css +1 -1
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9606 -0
- package/time-select/index.umd.js +38 -0
- package/{breadcrumb → time-select}/package.json +1 -1
- package/time-select/style.css +1 -0
- package/timeline/index.d.ts +7 -0
- package/timeline/index.es.js +427 -0
- package/timeline/index.umd.js +1 -0
- package/timeline/package.json +7 -0
- package/timeline/style.css +1 -0
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +5870 -141
- package/tooltip/index.umd.js +27 -1
- package/tooltip/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +11504 -692
- package/tree/index.umd.js +38 -1
- package/tree/style.css +1 -1
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +968 -2748
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +22816 -16568
- package/vue-devui.umd.js +42 -20
- package/accordion/index.es.js +0 -190
- package/accordion/index.umd.js +0 -1
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/style.css +0 -1
- package/carousel/index.es.js +0 -328
- package/carousel/index.umd.js +0 -1
- package/carousel/style.css +0 -1
- package/cascader/index.es.js +0 -187
- package/cascader/index.umd.js +0 -1
- package/cascader/style.css +0 -1
- package/date-picker/index.es.js +0 -1171
- package/date-picker/index.umd.js +0 -1
- package/date-picker/package.json +0 -7
- package/date-picker/style.css +0 -1
- package/nav-sprite/index.es.js +0 -742
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/quadrant-diagram/index.es.js +0 -489
- package/quadrant-diagram/index.umd.js +0 -1
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/steps-guide/index.es.js +0 -211
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/tag-input/index.es.js +0 -341
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/time-axis/index.es.js +0 -79
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/toast/index.es.js +0 -2059
- package/toast/index.umd.js +0 -1
- package/toast/style.css +0 -1
- package/transfer/index.es.js +0 -1446
- package/transfer/index.umd.js +0 -1
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.es.js +0 -203
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
package/overlay/index.es.js
CHANGED
|
@@ -1,342 +1,284 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, getCurrentInstance, nextTick, toRef, onBeforeUnmount, isRef } from "vue";
|
|
21
|
-
var overlay = "";
|
|
22
|
-
function _isSlot(s) {
|
|
23
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
24
|
-
}
|
|
25
|
-
const CommonOverlay = defineComponent({
|
|
26
|
-
setup(props, ctx) {
|
|
27
|
-
return () => {
|
|
28
|
-
let _slot;
|
|
29
|
-
return createVNode(Teleport, {
|
|
30
|
-
"to": "#d-overlay-anchor"
|
|
31
|
-
}, {
|
|
32
|
-
default: () => [createVNode(Transition, {
|
|
33
|
-
"name": "devui-overlay-fade"
|
|
34
|
-
}, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
|
|
35
|
-
default: () => [_slot]
|
|
36
|
-
})]
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const overlayProps = {
|
|
42
|
-
visible: {
|
|
43
|
-
type: Boolean
|
|
44
|
-
},
|
|
45
|
-
"onUpdate:visible": {
|
|
46
|
-
type: Function
|
|
47
|
-
},
|
|
48
|
-
backgroundBlock: {
|
|
1
|
+
import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, nextTick, unref } from "vue";
|
|
2
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
3
|
+
const fixedOverlayProps = {
|
|
4
|
+
modelValue: {
|
|
49
5
|
type: Boolean,
|
|
50
6
|
default: false
|
|
51
7
|
},
|
|
52
|
-
|
|
53
|
-
type:
|
|
54
|
-
default:
|
|
55
|
-
},
|
|
56
|
-
backgroundStyle: {
|
|
57
|
-
type: [String, Object]
|
|
58
|
-
},
|
|
59
|
-
backdropClick: {
|
|
60
|
-
type: Function
|
|
8
|
+
lockScroll: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: true
|
|
61
11
|
},
|
|
62
|
-
|
|
12
|
+
closeOnClickOverlay: {
|
|
63
13
|
type: Boolean,
|
|
64
14
|
default: true
|
|
65
15
|
}
|
|
66
16
|
};
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
17
|
+
function lockScroll() {
|
|
18
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
19
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
20
|
+
const style = document.documentElement.getAttribute("style");
|
|
21
|
+
document.documentElement.style.position = "fixed";
|
|
22
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
23
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
24
|
+
document.documentElement.style.overflowY = "scroll";
|
|
25
|
+
return () => {
|
|
26
|
+
if (style) {
|
|
27
|
+
document.documentElement.setAttribute("style", style);
|
|
28
|
+
} else {
|
|
29
|
+
document.documentElement.removeAttribute("style");
|
|
30
|
+
}
|
|
31
|
+
document.documentElement.scrollTop = scrollTop;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
function useFixedOverlay(props, ctx) {
|
|
37
|
+
let lockScrollCb;
|
|
38
|
+
const onClick = (event) => {
|
|
76
39
|
event.preventDefault();
|
|
77
|
-
(
|
|
78
|
-
if (props.
|
|
79
|
-
(
|
|
40
|
+
ctx.emit("click", event);
|
|
41
|
+
if (props.closeOnClickOverlay) {
|
|
42
|
+
ctx.emit("update:modelValue", false);
|
|
80
43
|
}
|
|
81
44
|
};
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
body.style.overflowY = "scroll";
|
|
92
|
-
body.style.position = visible ? "fixed" : "";
|
|
93
|
-
body.style.top = `${top}px`;
|
|
94
|
-
} else {
|
|
95
|
-
body.style.overflowY = originOverflow;
|
|
96
|
-
body.style.position = originPosition;
|
|
97
|
-
body.style.top = "";
|
|
98
|
-
window.scrollTo(0, -top);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
onUnmounted(() => {
|
|
103
|
-
document.body.style.overflow = originOverflow;
|
|
104
|
-
});
|
|
45
|
+
const removeBodyAdditions = () => {
|
|
46
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
47
|
+
};
|
|
48
|
+
watch(() => props.modelValue, (val) => {
|
|
49
|
+
if (val) {
|
|
50
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
51
|
+
} else {
|
|
52
|
+
removeBodyAdditions();
|
|
53
|
+
}
|
|
105
54
|
});
|
|
55
|
+
onUnmounted(removeBodyAdditions);
|
|
56
|
+
return { onClick };
|
|
57
|
+
}
|
|
58
|
+
function createBem(namespace, element, modifier) {
|
|
59
|
+
let cls = namespace;
|
|
60
|
+
if (element) {
|
|
61
|
+
cls += `__${element}`;
|
|
62
|
+
}
|
|
63
|
+
if (modifier) {
|
|
64
|
+
cls += `--${modifier}`;
|
|
65
|
+
}
|
|
66
|
+
return cls;
|
|
67
|
+
}
|
|
68
|
+
function useNamespace(block, needDot = false) {
|
|
69
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
70
|
+
const b = () => createBem(namespace);
|
|
71
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
72
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
73
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
106
74
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
75
|
+
b,
|
|
76
|
+
e,
|
|
77
|
+
m,
|
|
78
|
+
em
|
|
111
79
|
};
|
|
112
80
|
}
|
|
81
|
+
var fixedOverlay = "";
|
|
113
82
|
const FixedOverlay = defineComponent({
|
|
114
83
|
name: "DFixedOverlay",
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
default: void 0
|
|
119
|
-
}
|
|
120
|
-
}),
|
|
84
|
+
inheritAttrs: false,
|
|
85
|
+
props: fixedOverlayProps,
|
|
86
|
+
emits: ["update:modelValue", "click"],
|
|
121
87
|
setup(props, ctx) {
|
|
122
88
|
const {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
handleOverlayBubbleCancel
|
|
127
|
-
} = useOverlayLogic(props);
|
|
128
|
-
return () => createVNode(CommonOverlay, null, {
|
|
129
|
-
default: () => [withDirectives(createVNode("div", {
|
|
130
|
-
"class": backgroundClass.value,
|
|
131
|
-
"style": props.backgroundStyle,
|
|
132
|
-
"onClick": handleBackdropClick
|
|
133
|
-
}, [createVNode("div", {
|
|
134
|
-
"class": overlayClass.value,
|
|
135
|
-
"style": props.overlayStyle,
|
|
136
|
-
"onClick": handleOverlayBubbleCancel
|
|
137
|
-
}, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
const FlexibleOverlay = defineComponent({
|
|
142
|
-
name: "DFlexibleOverlay",
|
|
143
|
-
props: __spreadValues({
|
|
144
|
-
origin: {
|
|
145
|
-
type: Object,
|
|
146
|
-
require: true
|
|
147
|
-
},
|
|
148
|
-
position: {
|
|
149
|
-
type: Object,
|
|
150
|
-
default: () => ({
|
|
151
|
-
originX: "left",
|
|
152
|
-
originY: "top",
|
|
153
|
-
overlayX: "left",
|
|
154
|
-
overlayY: "top"
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
}, overlayProps),
|
|
158
|
-
emits: ["onUpdate:visible"],
|
|
159
|
-
setup(props, ctx) {
|
|
160
|
-
const overlayRef = ref(null);
|
|
161
|
-
const positionedStyle = reactive({
|
|
162
|
-
position: "absolute"
|
|
163
|
-
});
|
|
164
|
-
const instance = getCurrentInstance();
|
|
165
|
-
onMounted(async () => {
|
|
166
|
-
await nextTick();
|
|
167
|
-
const overlay2 = overlayRef.value;
|
|
168
|
-
if (!overlay2) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const origin = getOrigin(props.origin);
|
|
172
|
-
if (!origin) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
const handleRectChange = (rect) => {
|
|
176
|
-
const point = calculatePosition(props.position, rect, origin);
|
|
177
|
-
positionedStyle.left = `${point.x}px`;
|
|
178
|
-
positionedStyle.top = `${point.y}px`;
|
|
179
|
-
};
|
|
180
|
-
const handleChange = () => handleRectChange(overlay2.getBoundingClientRect());
|
|
181
|
-
watch(toRef(props, "visible"), (visible, ov, onInvalidate) => {
|
|
182
|
-
if (visible) {
|
|
183
|
-
subscribeLayoutEvent(handleChange);
|
|
184
|
-
} else {
|
|
185
|
-
unsbscribeLayoutEvent(handleChange);
|
|
186
|
-
}
|
|
187
|
-
onInvalidate(() => {
|
|
188
|
-
unsbscribeLayoutEvent(handleChange);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
watch(toRef(props, "position"), () => {
|
|
192
|
-
handleChange();
|
|
193
|
-
});
|
|
194
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
195
|
-
handleRectChange(entries[0].contentRect);
|
|
196
|
-
});
|
|
197
|
-
resizeObserver.observe(overlay2);
|
|
198
|
-
onBeforeUnmount(() => {
|
|
199
|
-
resizeObserver.disconnect();
|
|
200
|
-
}, instance);
|
|
201
|
-
if (origin instanceof Element) {
|
|
202
|
-
const observer = new MutationObserver(handleChange);
|
|
203
|
-
observer.observe(origin, {
|
|
204
|
-
attributeFilter: ["style"]
|
|
205
|
-
});
|
|
206
|
-
onBeforeUnmount(() => {
|
|
207
|
-
observer.disconnect();
|
|
208
|
-
}, instance);
|
|
209
|
-
}
|
|
210
|
-
}, instance);
|
|
89
|
+
modelValue
|
|
90
|
+
} = toRefs(props);
|
|
91
|
+
const ns = useNamespace("fixed-overlay");
|
|
211
92
|
const {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"onClick": handleOverlayBubbleCancel
|
|
226
|
-
}, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
|
|
93
|
+
onClick
|
|
94
|
+
} = useFixedOverlay(props, ctx);
|
|
95
|
+
return () => createVNode(Transition, {
|
|
96
|
+
"name": ns.m("fade")
|
|
97
|
+
}, {
|
|
98
|
+
default: () => {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
101
|
+
"class": ns.b()
|
|
102
|
+
}, ctx.attrs, {
|
|
103
|
+
"onClick": onClick
|
|
104
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
105
|
+
}
|
|
227
106
|
});
|
|
228
107
|
}
|
|
229
108
|
});
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
109
|
+
const flexibleOverlayProps = {
|
|
110
|
+
modelValue: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false
|
|
113
|
+
},
|
|
114
|
+
origin: {
|
|
115
|
+
type: Object,
|
|
116
|
+
require: true
|
|
117
|
+
},
|
|
118
|
+
position: {
|
|
119
|
+
type: Array,
|
|
120
|
+
default: ["bottom"]
|
|
121
|
+
},
|
|
122
|
+
offset: {
|
|
123
|
+
type: [Number, Object],
|
|
124
|
+
default: 8
|
|
125
|
+
},
|
|
126
|
+
shiftOffset: {
|
|
127
|
+
type: Number
|
|
128
|
+
},
|
|
129
|
+
align: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: null
|
|
132
|
+
},
|
|
133
|
+
showArrow: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: false
|
|
136
|
+
},
|
|
137
|
+
isArrowCenter: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: true
|
|
242
140
|
}
|
|
243
|
-
|
|
244
|
-
|
|
141
|
+
};
|
|
142
|
+
function getScrollParent(element) {
|
|
143
|
+
const overflowRegex = /(auto|scroll|hidden)/;
|
|
144
|
+
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
145
|
+
const style = window.getComputedStyle(parent);
|
|
146
|
+
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
147
|
+
return parent;
|
|
148
|
+
}
|
|
245
149
|
}
|
|
246
|
-
return
|
|
150
|
+
return window;
|
|
247
151
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
152
|
+
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
153
|
+
let { x, y } = point;
|
|
154
|
+
if (!isArrowCenter) {
|
|
155
|
+
const { width, height } = originRect;
|
|
156
|
+
if (x && placement.includes("start")) {
|
|
157
|
+
x = 12;
|
|
158
|
+
}
|
|
159
|
+
if (x && placement.includes("end")) {
|
|
160
|
+
x = Math.round(width - 24);
|
|
161
|
+
}
|
|
162
|
+
if (y && placement.includes("start")) {
|
|
163
|
+
y = 10;
|
|
164
|
+
}
|
|
165
|
+
if (y && placement.includes("end")) {
|
|
166
|
+
y = height - 14;
|
|
167
|
+
}
|
|
256
168
|
}
|
|
257
|
-
return
|
|
169
|
+
return { x, y };
|
|
258
170
|
}
|
|
259
|
-
function
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
171
|
+
function useOverlay(props, emit) {
|
|
172
|
+
const overlayRef = ref();
|
|
173
|
+
const arrowRef = ref();
|
|
174
|
+
let originParent = null;
|
|
175
|
+
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
176
|
+
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
177
|
+
const staticSide = {
|
|
178
|
+
top: "bottom",
|
|
179
|
+
right: "left",
|
|
180
|
+
bottom: "top",
|
|
181
|
+
left: "right"
|
|
182
|
+
}[placement.split("-")[0]];
|
|
183
|
+
Object.assign(arrowEl.style, {
|
|
184
|
+
left: x ? `${x}px` : "",
|
|
185
|
+
top: y ? `${y}px` : "",
|
|
186
|
+
right: "",
|
|
187
|
+
bottom: "",
|
|
188
|
+
[staticSide]: "-4px"
|
|
189
|
+
});
|
|
272
190
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
191
|
+
const updatePosition = async () => {
|
|
192
|
+
const hostEl = props.origin;
|
|
193
|
+
const overlayEl = unref(overlayRef.value);
|
|
194
|
+
const arrowEl = unref(arrowRef.value);
|
|
195
|
+
const middleware = [
|
|
196
|
+
offset(props.offset),
|
|
197
|
+
autoPlacement({
|
|
198
|
+
alignment: props.align,
|
|
199
|
+
allowedPlacements: props.position
|
|
200
|
+
})
|
|
201
|
+
];
|
|
202
|
+
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
203
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
204
|
+
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
205
|
+
strategy: "fixed",
|
|
206
|
+
middleware
|
|
207
|
+
});
|
|
208
|
+
let applyX = x;
|
|
209
|
+
let applyY = y;
|
|
210
|
+
if (props.shiftOffset !== void 0) {
|
|
211
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
212
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
213
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
214
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
215
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
216
|
+
}
|
|
217
|
+
emit("positionChange", placement);
|
|
218
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
219
|
+
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
294
220
|
};
|
|
221
|
+
watch(() => props.modelValue, () => {
|
|
222
|
+
if (props.modelValue && props.origin) {
|
|
223
|
+
originParent = getScrollParent(props.origin);
|
|
224
|
+
nextTick(updatePosition);
|
|
225
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
226
|
+
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
227
|
+
window.addEventListener("resize", updatePosition);
|
|
228
|
+
} else {
|
|
229
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
230
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
231
|
+
window.removeEventListener("resize", updatePosition);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
onUnmounted(() => {
|
|
235
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
236
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
237
|
+
window.removeEventListener("resize", updatePosition);
|
|
238
|
+
});
|
|
239
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
295
240
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
241
|
+
var flexibleOverlay = "";
|
|
242
|
+
const FlexibleOverlay = defineComponent({
|
|
243
|
+
name: "DFlexibleOverlay",
|
|
244
|
+
inheritAttrs: false,
|
|
245
|
+
props: flexibleOverlayProps,
|
|
246
|
+
emits: ["update:modelValue", "positionChange"],
|
|
247
|
+
setup(props, {
|
|
248
|
+
slots,
|
|
249
|
+
attrs,
|
|
250
|
+
emit,
|
|
251
|
+
expose
|
|
252
|
+
}) {
|
|
253
|
+
const ns = useNamespace("flexible-overlay");
|
|
254
|
+
const {
|
|
255
|
+
arrowRef,
|
|
256
|
+
overlayRef,
|
|
257
|
+
updatePosition
|
|
258
|
+
} = useOverlay(props, emit);
|
|
259
|
+
expose({
|
|
260
|
+
updatePosition
|
|
261
|
+
});
|
|
262
|
+
return () => {
|
|
263
|
+
var _a;
|
|
264
|
+
return props.modelValue && createVNode("div", mergeProps({
|
|
265
|
+
"ref": overlayRef,
|
|
266
|
+
"class": ns.b()
|
|
267
|
+
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
268
|
+
"ref": arrowRef,
|
|
269
|
+
"class": ns.e("arrow")
|
|
270
|
+
}, null)]);
|
|
271
|
+
};
|
|
310
272
|
}
|
|
311
|
-
|
|
312
|
-
x,
|
|
313
|
-
y
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
function subscribeLayoutEvent(event) {
|
|
317
|
-
window.addEventListener("scroll", event, true);
|
|
318
|
-
window.addEventListener("resize", event);
|
|
319
|
-
window.addEventListener("orientationchange", event);
|
|
320
|
-
}
|
|
321
|
-
function unsbscribeLayoutEvent(event) {
|
|
322
|
-
window.removeEventListener("scroll", event, true);
|
|
323
|
-
window.removeEventListener("resize", event);
|
|
324
|
-
window.removeEventListener("orientationchange", event);
|
|
325
|
-
}
|
|
273
|
+
});
|
|
326
274
|
const inBrowser = typeof window !== "undefined";
|
|
327
|
-
FlexibleOverlay.install = function(app) {
|
|
328
|
-
app.component(FlexibleOverlay.name, FlexibleOverlay);
|
|
329
|
-
};
|
|
330
|
-
FixedOverlay.install = function(app) {
|
|
331
|
-
app.component(FixedOverlay.name, FixedOverlay);
|
|
332
|
-
};
|
|
333
275
|
var index = {
|
|
334
276
|
title: "Overlay \u906E\u7F69\u5C42",
|
|
335
277
|
category: "\u901A\u7528",
|
|
336
|
-
status: "
|
|
278
|
+
status: "100%",
|
|
337
279
|
install(app) {
|
|
338
|
-
app.
|
|
339
|
-
app.
|
|
280
|
+
app.component(FixedOverlay.name, FixedOverlay);
|
|
281
|
+
app.component(FlexibleOverlay.name, FlexibleOverlay);
|
|
340
282
|
if (inBrowser && !document.getElementById("d-overlay-anchor")) {
|
|
341
283
|
const overlayAnchor = document.createElement("div");
|
|
342
284
|
overlayAnchor.setAttribute("id", "d-overlay-anchor");
|
|
@@ -348,4 +290,4 @@ var index = {
|
|
|
348
290
|
}
|
|
349
291
|
}
|
|
350
292
|
};
|
|
351
|
-
export { FixedOverlay, FlexibleOverlay, index as default };
|
|
293
|
+
export { FixedOverlay, FlexibleOverlay, index as default, fixedOverlayProps, flexibleOverlayProps };
|
package/overlay/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(a,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],l):(a=typeof globalThis!="undefined"?globalThis:a||self,l(a.index={},a.Vue,a.dom))})(this,function(a,l,f){"use strict";const b={modelValue:{type:Boolean,default:!1},lockScroll:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0}};function P(){if(document.documentElement.scrollHeight>document.documentElement.clientHeight){const e=document.documentElement.scrollTop,t=document.documentElement.getAttribute("style");return document.documentElement.style.position="fixed",document.documentElement.style.top=`-${e}px`,document.documentElement.style.width=document.documentElement.style.width||"100%",document.documentElement.style.overflowY="scroll",()=>{t?document.documentElement.setAttribute("style",t):document.documentElement.removeAttribute("style"),document.documentElement.scrollTop=e}}}function k(e,t){let o;const i=s=>{s.preventDefault(),t.emit("click",s),e.closeOnClickOverlay&&t.emit("update:modelValue",!1)},n=()=>{o==null||o()};return l.watch(()=>e.modelValue,s=>{s?e.lockScroll&&(o=P()):n()}),l.onUnmounted(n),{onClick:i}}function y(e,t,o){let i=e;return t&&(i+=`__${t}`),o&&(i+=`--${o}`),i}function g(e,t=!1){const o=t?`.devui-${e}`:`devui-${e}`;return{b:()=>y(o),e:d=>d?y(o,d):"",m:d=>d?y(o,"",d):"",em:(d,c)=>d&&c?y(o,d,c):""}}var j="";const O=l.defineComponent({name:"DFixedOverlay",inheritAttrs:!1,props:b,emits:["update:modelValue","click"],setup(e,t){const{modelValue:o}=l.toRefs(e),i=g("fixed-overlay"),{onClick:n}=k(e,t);return()=>l.createVNode(l.Transition,{name:i.m("fade")},{default:()=>{var s,r;return[o.value&&l.createVNode("div",l.mergeProps({class:i.b()},t.attrs,{onClick:n}),[(r=(s=t.slots).default)==null?void 0:r.call(s)])]}})}}),A={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},shiftOffset:{type:Number},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function L(e){const t=/(auto|scroll|hidden)/;for(let o=e;o=o.parentElement;o.parentElement!==document.body){const i=window.getComputedStyle(o);if(t.test(i.overflow+i.overflowX+i.overflowY))return o}return window}function $(e,t,o,i){let{x:n,y:s}=t;if(!e){const{width:r,height:d}=i;n&&o.includes("start")&&(n=12),n&&o.includes("end")&&(n=Math.round(r-24)),s&&o.includes("start")&&(s=10),s&&o.includes("end")&&(s=d-14)}return{x:n,y:s}}function F(e,t){const o=l.ref(),i=l.ref();let n=null;const s=(d,c,u,m)=>{const{x:w,y:v}=$(e.isArrowCenter,u,c,m.getBoundingClientRect()),h={top:"bottom",right:"left",bottom:"top",left:"right"}[c.split("-")[0]];Object.assign(d.style,{left:w?`${w}px`:"",top:v?`${v}px`:"",right:"",bottom:"",[h]:"-4px"})},r=async()=>{const d=e.origin,c=l.unref(o.value),u=l.unref(i.value),m=[f.offset(e.offset),f.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&m.push(f.arrow({element:u})),e.shiftOffset!==void 0&&m.push(f.shift());const{x:w,y:v,placement:h,middlewareData:V}=await f.computePosition(d,c,{strategy:"fixed",middleware:m});let p=w,x=v;if(e.shiftOffset!==void 0){const{x:C,y:B}=V.shift;C<0&&(p-=e.shiftOffset),C>0&&(p+=e.shiftOffset),B<0&&(x-=e.shiftOffset),B>0&&(x+=e.shiftOffset)}t("positionChange",h),Object.assign(c.style,{top:`${x}px`,left:`${p}px`}),e.showArrow&&s(u,h,V.arrow,c)};return l.watch(()=>e.modelValue,()=>{e.modelValue&&e.origin?(n=L(e.origin),l.nextTick(r),n==null||n.addEventListener("scroll",r),n!==window&&window.addEventListener("scroll",r),window.addEventListener("resize",r)):(n==null||n.removeEventListener("scroll",r),n!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r))}),l.onUnmounted(()=>{n==null||n.removeEventListener("scroll",r),n!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}),{arrowRef:i,overlayRef:o,updatePosition:r}}var N="";const E=l.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:A,emits:["update:modelValue","positionChange"],setup(e,{slots:t,attrs:o,emit:i,expose:n}){const s=g("flexible-overlay"),{arrowRef:r,overlayRef:d,updatePosition:c}=F(e,i);return n({updatePosition:c}),()=>{var u;return e.modelValue&&l.createVNode("div",l.mergeProps({ref:d,class:s.b()},o),[(u=t.default)==null?void 0:u.call(t),e.showArrow&&l.createVNode("div",{ref:r,class:s.e("arrow")},null)])}}}),S=typeof window!="undefined";var T={title:"Overlay \u906E\u7F69\u5C42",category:"\u901A\u7528",status:"100%",install(e){if(e.component(O.name,O),e.component(E.name,E),S&&!document.getElementById("d-overlay-anchor")){const t=document.createElement("div");t.setAttribute("id","d-overlay-anchor"),t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="1000",document.body.appendChild(t)}}};a.FixedOverlay=O,a.FlexibleOverlay=E,a.default=T,a.fixedOverlayProps=b,a.flexibleOverlayProps=A,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/overlay/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-overlay
|
|
1
|
+
.devui-fixed-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--devui-shadow, rgba(37, 43, 58, .2));z-index:1050}.devui-fixed-overlay--fade-enter-active,.devui-fixed-overlay--fade-leave-active{transition:opacity .1s cubic-bezier(0,0,1,1)}.devui-fixed-overlay--fade-enter-from,.devui-fixed-overlay--fade-leave-to{opacity:0}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 4px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-length-connected-overlay, 0 4px 8px 0) var(--devui-shadow, rgba(37, 43, 58, .2));z-index:1000}.devui-flexible-overlay__arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}
|