vue-devui 1.0.0-beta.2 → 1.0.0-beta.220801
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 +9044 -0
- package/auto-complete/index.umd.js +29 -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 +5927 -131
- 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 +8082 -232
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/collapse/index.d.ts +7 -0
- package/collapse/index.es.js +213 -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 +12018 -0
- package/date-picker-pro/index.umd.js +27 -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 +203 -139
- 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 +754 -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 +912 -442
- 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 +2415 -1985
- package/form/index.umd.js +18 -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 +284 -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 +142 -39
- 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 +8255 -145
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +270 -186
- 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 +77 -38
- 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 +8310 -0
- package/mention/index.umd.js +36 -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 +870 -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 +538 -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 +607 -841
- 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 +545 -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 +7976 -159
- package/radio/index.umd.js +27 -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 +51 -43
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +8411 -450
- package/search/index.umd.js +27 -1
- package/search/style.css +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +9295 -561
- package/select/index.umd.js +27 -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 +6301 -167
- 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 +274 -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 +7805 -65
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +11423 -207
- package/table/index.umd.js +27 -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 +7973 -0
- package/textarea/index.umd.js +35 -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 +9101 -581
- package/time-picker/index.umd.js +27 -1
- package/time-picker/style.css +1 -1
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9585 -0
- package/time-select/index.umd.js +27 -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 +11438 -654
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +981 -2719
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +22794 -16605
- package/vue-devui.umd.js +31 -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/modal/index.es.js
CHANGED
|
@@ -33,966 +33,733 @@ var __publicField = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
-
import { defineComponent,
|
|
36
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, unref, nextTick, onMounted, Teleport, h, render } from "vue";
|
|
37
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
37
38
|
const modalProps = {
|
|
38
|
-
|
|
39
|
-
type:
|
|
40
|
-
default:
|
|
41
|
-
},
|
|
42
|
-
maxHeight: {
|
|
43
|
-
type: String
|
|
44
|
-
},
|
|
45
|
-
zIndex: {
|
|
46
|
-
type: Number,
|
|
47
|
-
default: 1050
|
|
48
|
-
},
|
|
49
|
-
backdropZIndex: {
|
|
50
|
-
type: Number,
|
|
51
|
-
default: 1049
|
|
39
|
+
modelValue: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
52
42
|
},
|
|
53
|
-
|
|
43
|
+
title: {
|
|
54
44
|
type: String,
|
|
55
|
-
default: "
|
|
45
|
+
default: ""
|
|
56
46
|
},
|
|
57
|
-
|
|
58
|
-
type:
|
|
59
|
-
default:
|
|
47
|
+
lockScroll: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true
|
|
60
50
|
},
|
|
61
|
-
|
|
62
|
-
type:
|
|
63
|
-
default:
|
|
51
|
+
closeOnClickOverlay: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
55
|
+
beforeClose: {
|
|
56
|
+
type: Function
|
|
64
57
|
},
|
|
65
|
-
|
|
58
|
+
escapable: {
|
|
66
59
|
type: Boolean,
|
|
67
60
|
default: true
|
|
68
61
|
},
|
|
69
|
-
|
|
62
|
+
showClose: {
|
|
70
63
|
type: Boolean,
|
|
71
|
-
default:
|
|
64
|
+
default: true
|
|
72
65
|
},
|
|
73
|
-
|
|
66
|
+
showOverlay: {
|
|
74
67
|
type: Boolean,
|
|
75
68
|
default: true
|
|
76
69
|
},
|
|
77
|
-
|
|
70
|
+
appendToBody: {
|
|
78
71
|
type: Boolean,
|
|
79
72
|
default: true
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const DEFAULT_PREFIX = "icon";
|
|
76
|
+
const iconProps = {
|
|
77
|
+
name: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "",
|
|
80
|
+
required: true
|
|
80
81
|
},
|
|
81
|
-
|
|
82
|
-
type:
|
|
82
|
+
size: {
|
|
83
|
+
type: [Number, String],
|
|
84
|
+
default: "inherit"
|
|
83
85
|
},
|
|
84
|
-
|
|
85
|
-
type:
|
|
86
|
+
color: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "inherit"
|
|
86
89
|
},
|
|
87
|
-
|
|
88
|
-
type:
|
|
90
|
+
component: {
|
|
91
|
+
type: Object,
|
|
92
|
+
default: null
|
|
89
93
|
},
|
|
90
|
-
|
|
91
|
-
type:
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
var overlay = "";
|
|
95
|
-
function _isSlot$1(s) {
|
|
96
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
97
|
-
}
|
|
98
|
-
const CommonOverlay = defineComponent({
|
|
99
|
-
setup(props, ctx) {
|
|
100
|
-
return () => {
|
|
101
|
-
let _slot;
|
|
102
|
-
return createVNode(Teleport, {
|
|
103
|
-
"to": "#d-overlay-anchor"
|
|
104
|
-
}, {
|
|
105
|
-
default: () => [createVNode(Transition, {
|
|
106
|
-
"name": "devui-overlay-fade"
|
|
107
|
-
}, _isSlot$1(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
|
|
108
|
-
default: () => [_slot]
|
|
109
|
-
})]
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
const overlayProps = {
|
|
115
|
-
visible: {
|
|
116
|
-
type: Boolean
|
|
94
|
+
classPrefix: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: DEFAULT_PREFIX
|
|
117
97
|
},
|
|
118
|
-
|
|
119
|
-
type:
|
|
98
|
+
operable: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false
|
|
120
101
|
},
|
|
121
|
-
|
|
102
|
+
disabled: {
|
|
122
103
|
type: Boolean,
|
|
123
104
|
default: false
|
|
124
105
|
},
|
|
125
|
-
|
|
106
|
+
rotate: {
|
|
107
|
+
type: [Number, String]
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const svgIconProps = {
|
|
111
|
+
name: {
|
|
126
112
|
type: String,
|
|
127
|
-
default: ""
|
|
128
|
-
|
|
129
|
-
backgroundStyle: {
|
|
130
|
-
type: [String, Object]
|
|
113
|
+
default: "",
|
|
114
|
+
required: true
|
|
131
115
|
},
|
|
132
|
-
|
|
133
|
-
type:
|
|
116
|
+
color: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: "inherit"
|
|
134
119
|
},
|
|
135
|
-
|
|
136
|
-
type:
|
|
137
|
-
default:
|
|
120
|
+
size: {
|
|
121
|
+
type: [Number, String],
|
|
122
|
+
default: "inherit"
|
|
138
123
|
}
|
|
139
124
|
};
|
|
140
|
-
function
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
onMounted(() => {
|
|
157
|
-
const body = document.body;
|
|
158
|
-
const originOverflow = body.style.overflow;
|
|
159
|
-
const originPosition = body.style.position;
|
|
160
|
-
watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
|
|
161
|
-
if (backgroundBlock) {
|
|
162
|
-
const top = body.getBoundingClientRect().y;
|
|
163
|
-
if (visible) {
|
|
164
|
-
body.style.overflowY = "scroll";
|
|
165
|
-
body.style.position = visible ? "fixed" : "";
|
|
166
|
-
body.style.top = `${top}px`;
|
|
167
|
-
} else {
|
|
168
|
-
body.style.overflowY = originOverflow;
|
|
169
|
-
body.style.position = originPosition;
|
|
170
|
-
body.style.top = "";
|
|
171
|
-
window.scrollTo(0, -top);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
onUnmounted(() => {
|
|
176
|
-
document.body.style.overflow = originOverflow;
|
|
177
|
-
});
|
|
178
|
-
});
|
|
125
|
+
function createBem(namespace, element, modifier) {
|
|
126
|
+
let cls = namespace;
|
|
127
|
+
if (element) {
|
|
128
|
+
cls += `__${element}`;
|
|
129
|
+
}
|
|
130
|
+
if (modifier) {
|
|
131
|
+
cls += `--${modifier}`;
|
|
132
|
+
}
|
|
133
|
+
return cls;
|
|
134
|
+
}
|
|
135
|
+
function useNamespace(block, needDot = false) {
|
|
136
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
137
|
+
const b = () => createBem(namespace);
|
|
138
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
139
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
140
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
179
141
|
return {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
142
|
+
b,
|
|
143
|
+
e,
|
|
144
|
+
m,
|
|
145
|
+
em
|
|
184
146
|
};
|
|
185
147
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
default: void 0
|
|
192
|
-
}
|
|
193
|
-
}),
|
|
194
|
-
setup(props, ctx) {
|
|
148
|
+
var icon = "";
|
|
149
|
+
var svgIcon = defineComponent({
|
|
150
|
+
name: "DSvgIcon",
|
|
151
|
+
props: svgIconProps,
|
|
152
|
+
setup(props) {
|
|
195
153
|
const {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
"style": props.backgroundStyle,
|
|
205
|
-
"onClick": handleBackdropClick
|
|
206
|
-
}, [createVNode("div", {
|
|
207
|
-
"class": overlayClass.value,
|
|
208
|
-
"style": props.overlayStyle,
|
|
209
|
-
"onClick": handleOverlayBubbleCancel
|
|
210
|
-
}, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
|
|
154
|
+
name,
|
|
155
|
+
color,
|
|
156
|
+
size
|
|
157
|
+
} = toRefs(props);
|
|
158
|
+
const ns = useNamespace("svg-icon");
|
|
159
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
160
|
+
const iconSize = computed(() => {
|
|
161
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
211
162
|
});
|
|
163
|
+
const styles = {
|
|
164
|
+
width: iconSize.value,
|
|
165
|
+
height: iconSize.value
|
|
166
|
+
};
|
|
167
|
+
return () => {
|
|
168
|
+
return createVNode("svg", {
|
|
169
|
+
"class": ns.b(),
|
|
170
|
+
"style": styles
|
|
171
|
+
}, [createVNode("use", {
|
|
172
|
+
"xlink:href": iconName.value,
|
|
173
|
+
"fill": color.value
|
|
174
|
+
}, null)]);
|
|
175
|
+
};
|
|
212
176
|
}
|
|
213
177
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const overlay2 = overlayRef.value;
|
|
241
|
-
if (!overlay2) {
|
|
242
|
-
return;
|
|
178
|
+
function isUrl(value) {
|
|
179
|
+
return /^((http|https):)?\/\//.test(value);
|
|
180
|
+
}
|
|
181
|
+
function useIconDom(props, ctx) {
|
|
182
|
+
const {
|
|
183
|
+
component,
|
|
184
|
+
name,
|
|
185
|
+
size,
|
|
186
|
+
color,
|
|
187
|
+
classPrefix,
|
|
188
|
+
rotate
|
|
189
|
+
} = toRefs(props);
|
|
190
|
+
const ns = useNamespace("icon");
|
|
191
|
+
const iconSize = computed(() => {
|
|
192
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
193
|
+
});
|
|
194
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
195
|
+
const imgIconDom = () => {
|
|
196
|
+
return createVNode("img", mergeProps({
|
|
197
|
+
"src": name.value,
|
|
198
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
199
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
200
|
+
"style": {
|
|
201
|
+
width: iconSize.value || "",
|
|
202
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
|
|
203
|
+
verticalAlign: "middle"
|
|
243
204
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
205
|
+
}, ctx.attrs), null);
|
|
206
|
+
};
|
|
207
|
+
const svgIconDom = () => {
|
|
208
|
+
return createVNode(IconComponent, mergeProps({
|
|
209
|
+
"name": name.value,
|
|
210
|
+
"color": color.value,
|
|
211
|
+
"size": iconSize.value,
|
|
212
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
213
|
+
"style": {
|
|
214
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
247
215
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
unsbscribeLayoutEvent(handleChange);
|
|
259
|
-
}
|
|
260
|
-
onInvalidate(() => {
|
|
261
|
-
unsbscribeLayoutEvent(handleChange);
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
watch(toRef(props, "position"), () => {
|
|
265
|
-
handleChange();
|
|
266
|
-
});
|
|
267
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
268
|
-
handleRectChange(entries[0].contentRect);
|
|
269
|
-
});
|
|
270
|
-
resizeObserver.observe(overlay2);
|
|
271
|
-
onBeforeUnmount(() => {
|
|
272
|
-
resizeObserver.disconnect();
|
|
273
|
-
}, instance);
|
|
274
|
-
if (origin instanceof Element) {
|
|
275
|
-
const observer = new MutationObserver(handleChange);
|
|
276
|
-
observer.observe(origin, {
|
|
277
|
-
attributeFilter: ["style"]
|
|
278
|
-
});
|
|
279
|
-
onBeforeUnmount(() => {
|
|
280
|
-
observer.disconnect();
|
|
281
|
-
}, instance);
|
|
216
|
+
}, ctx.attrs), null);
|
|
217
|
+
};
|
|
218
|
+
const fontIconDom = () => {
|
|
219
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
220
|
+
return createVNode("i", mergeProps({
|
|
221
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
222
|
+
"style": {
|
|
223
|
+
fontSize: iconSize.value,
|
|
224
|
+
color: color.value,
|
|
225
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
282
226
|
}
|
|
283
|
-
},
|
|
284
|
-
const {
|
|
285
|
-
backgroundClass,
|
|
286
|
-
overlayClass,
|
|
287
|
-
handleBackdropClick,
|
|
288
|
-
handleOverlayBubbleCancel
|
|
289
|
-
} = useOverlayLogic(props);
|
|
290
|
-
return () => createVNode(CommonOverlay, null, {
|
|
291
|
-
default: () => [withDirectives(createVNode("div", {
|
|
292
|
-
"class": backgroundClass.value,
|
|
293
|
-
"onClick": handleBackdropClick
|
|
294
|
-
}, [createVNode("div", {
|
|
295
|
-
"ref": overlayRef,
|
|
296
|
-
"class": overlayClass.value,
|
|
297
|
-
"style": positionedStyle,
|
|
298
|
-
"onClick": handleOverlayBubbleCancel
|
|
299
|
-
}, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
function getElement(element) {
|
|
304
|
-
if (element instanceof Element) {
|
|
305
|
-
return element;
|
|
306
|
-
}
|
|
307
|
-
if (element && typeof element === "object" && element.$el instanceof Element) {
|
|
308
|
-
return element.$el;
|
|
309
|
-
}
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
function getOrigin(origin) {
|
|
313
|
-
if (origin instanceof Element) {
|
|
314
|
-
return origin;
|
|
315
|
-
}
|
|
316
|
-
if (isRef(origin)) {
|
|
317
|
-
return getElement(origin.value);
|
|
318
|
-
}
|
|
319
|
-
return origin;
|
|
320
|
-
}
|
|
321
|
-
function calculatePosition(position, panelOrRect, origin) {
|
|
322
|
-
const originRect = getOriginRect(origin);
|
|
323
|
-
const originPoint = getOriginRelativePoint(originRect, position);
|
|
324
|
-
let rect;
|
|
325
|
-
if (panelOrRect instanceof HTMLElement) {
|
|
326
|
-
rect = panelOrRect.getBoundingClientRect();
|
|
327
|
-
} else {
|
|
328
|
-
rect = panelOrRect;
|
|
329
|
-
}
|
|
330
|
-
return getOverlayPoint(originPoint, rect, position);
|
|
331
|
-
}
|
|
332
|
-
function getOriginRect(origin) {
|
|
333
|
-
if (origin instanceof Element) {
|
|
334
|
-
return origin.getBoundingClientRect();
|
|
335
|
-
}
|
|
336
|
-
const width = origin.width || 0;
|
|
337
|
-
const height = origin.height || 0;
|
|
338
|
-
return {
|
|
339
|
-
top: origin.y,
|
|
340
|
-
bottom: origin.y + height,
|
|
341
|
-
left: origin.x,
|
|
342
|
-
right: origin.x + width,
|
|
343
|
-
height,
|
|
344
|
-
width
|
|
227
|
+
}, ctx.attrs), null);
|
|
345
228
|
};
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
let x;
|
|
349
|
-
const {
|
|
350
|
-
width,
|
|
351
|
-
height
|
|
352
|
-
} = rect;
|
|
353
|
-
if (position.overlayX == "center") {
|
|
354
|
-
x = originPoint.x - width / 2;
|
|
355
|
-
} else {
|
|
356
|
-
x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
|
|
357
|
-
}
|
|
358
|
-
let y;
|
|
359
|
-
if (position.overlayY == "center") {
|
|
360
|
-
y = originPoint.y - height / 2;
|
|
361
|
-
} else {
|
|
362
|
-
y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
|
|
363
|
-
}
|
|
364
|
-
return {
|
|
365
|
-
x,
|
|
366
|
-
y
|
|
229
|
+
const iconDom = () => {
|
|
230
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
367
231
|
};
|
|
368
|
-
}
|
|
369
|
-
function getOriginRelativePoint(originRect, position) {
|
|
370
|
-
let x;
|
|
371
|
-
if (position.originX == "center") {
|
|
372
|
-
x = originRect.left + originRect.width / 2;
|
|
373
|
-
} else {
|
|
374
|
-
const startX = originRect.left;
|
|
375
|
-
const endX = originRect.right;
|
|
376
|
-
x = position.originX == "left" ? startX : endX;
|
|
377
|
-
}
|
|
378
|
-
let y;
|
|
379
|
-
if (position.originY == "center") {
|
|
380
|
-
y = originRect.top + originRect.height / 2;
|
|
381
|
-
} else {
|
|
382
|
-
y = position.originY == "top" ? originRect.top : originRect.bottom;
|
|
383
|
-
}
|
|
384
232
|
return {
|
|
385
|
-
|
|
386
|
-
y
|
|
233
|
+
iconDom
|
|
387
234
|
};
|
|
388
235
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
function unsbscribeLayoutEvent(event) {
|
|
395
|
-
window.removeEventListener("scroll", event, true);
|
|
396
|
-
window.removeEventListener("resize", event);
|
|
397
|
-
window.removeEventListener("orientationchange", event);
|
|
398
|
-
}
|
|
399
|
-
const inBrowser = typeof window !== "undefined";
|
|
400
|
-
FlexibleOverlay.install = function(app) {
|
|
401
|
-
app.component(FlexibleOverlay.name, FlexibleOverlay);
|
|
402
|
-
};
|
|
403
|
-
FixedOverlay.install = function(app) {
|
|
404
|
-
app.component(FixedOverlay.name, FixedOverlay);
|
|
405
|
-
};
|
|
406
|
-
var modal = "";
|
|
407
|
-
var Modal = defineComponent({
|
|
408
|
-
name: "DModal",
|
|
409
|
-
props: modalProps,
|
|
410
|
-
emits: ["onUpdate:modelValue"],
|
|
236
|
+
var Icon = defineComponent({
|
|
237
|
+
name: "DIcon",
|
|
238
|
+
props: iconProps,
|
|
239
|
+
emits: ["click"],
|
|
411
240
|
setup(props, ctx) {
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
};
|
|
429
|
-
const result = (_a = typeof beforeHidden === "function" ? beforeHidden() : beforeHidden) != null ? _a : true;
|
|
430
|
-
if (result instanceof Promise) {
|
|
431
|
-
result.then(close);
|
|
432
|
-
} else {
|
|
433
|
-
close(result);
|
|
434
|
-
}
|
|
241
|
+
const {
|
|
242
|
+
disabled,
|
|
243
|
+
operable
|
|
244
|
+
} = toRefs(props);
|
|
245
|
+
const {
|
|
246
|
+
iconDom
|
|
247
|
+
} = useIconDom(props, ctx);
|
|
248
|
+
const ns = useNamespace("icon");
|
|
249
|
+
const wrapClassed = computed(() => ({
|
|
250
|
+
[ns.e("container")]: true,
|
|
251
|
+
[ns.m("disabled")]: disabled.value,
|
|
252
|
+
[ns.m("operable")]: operable.value
|
|
253
|
+
}));
|
|
254
|
+
const onClick = (e) => {
|
|
255
|
+
if (disabled.value) {
|
|
256
|
+
return;
|
|
435
257
|
}
|
|
258
|
+
ctx.emit("click", e);
|
|
259
|
+
};
|
|
260
|
+
return () => {
|
|
261
|
+
var _a, _b, _c, _d;
|
|
262
|
+
return createVNode("div", {
|
|
263
|
+
"class": wrapClassed.value,
|
|
264
|
+
"onClick": onClick
|
|
265
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
436
266
|
};
|
|
437
|
-
ctx.expose({
|
|
438
|
-
onVisibleChange
|
|
439
|
-
});
|
|
440
|
-
return () => createVNode(FixedOverlay, {
|
|
441
|
-
"visible": props.modelValue,
|
|
442
|
-
"onUpdate:visible": onVisibleChange,
|
|
443
|
-
"backgroundClass": "devui-modal-wrapper",
|
|
444
|
-
"backgroundBlock": !props.bodyScrollable,
|
|
445
|
-
"backdropClose": props.backdropCloseable
|
|
446
|
-
}, {
|
|
447
|
-
default: () => [createVNode(Transition, {
|
|
448
|
-
"name": "devui-modal-wipe"
|
|
449
|
-
}, {
|
|
450
|
-
default: () => {
|
|
451
|
-
var _a, _b;
|
|
452
|
-
return [animatedVisible.value ? (_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a) : null];
|
|
453
|
-
}
|
|
454
|
-
})]
|
|
455
|
-
});
|
|
456
267
|
}
|
|
457
268
|
});
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
setTimeout(() => {
|
|
469
|
-
render(null, anchor);
|
|
470
|
-
}, 500);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
class ModalService extends CommonModalService {
|
|
474
|
-
component() {
|
|
475
|
-
return Modal;
|
|
476
|
-
}
|
|
477
|
-
open(props = {}) {
|
|
478
|
-
const anchor = document.createElement("div");
|
|
479
|
-
this.anchorContainer.appendChild(anchor);
|
|
480
|
-
const _a = props, { content } = _a, resProps = __objRest(_a, ["content"]);
|
|
481
|
-
const needHideOrNot = (value) => {
|
|
482
|
-
if (!value) {
|
|
483
|
-
hide();
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
|
|
487
|
-
return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
|
|
488
|
-
modelValue: true,
|
|
489
|
-
"onUpdate:modelValue": onUpdateModelValue
|
|
490
|
-
}), { default: content });
|
|
491
|
-
};
|
|
492
|
-
const hide = () => {
|
|
493
|
-
var _a2, _b;
|
|
494
|
-
const vnode = renderOrigin(resProps, (value) => {
|
|
495
|
-
if (!value) {
|
|
496
|
-
this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
|
|
497
|
-
this.renderNull(anchor);
|
|
498
|
-
} else {
|
|
499
|
-
renderOrigin(resProps);
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
(_b = (_a2 = vnode.component.exposed).onVisibleChange) == null ? void 0 : _b.call(_a2, false);
|
|
269
|
+
var iconGroup = "";
|
|
270
|
+
defineComponent({
|
|
271
|
+
name: "DIconGroup",
|
|
272
|
+
setup(_, ctx) {
|
|
273
|
+
const ns = useNamespace("icon-group");
|
|
274
|
+
return () => {
|
|
275
|
+
var _a, _b;
|
|
276
|
+
return createVNode("div", {
|
|
277
|
+
"class": ns.b()
|
|
278
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
503
279
|
};
|
|
504
|
-
this.renderModal(anchor, { modelValue: false });
|
|
505
|
-
renderOrigin(resProps);
|
|
506
|
-
return { hide };
|
|
507
280
|
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
width: {
|
|
512
|
-
type: String,
|
|
513
|
-
default: "300px"
|
|
514
|
-
},
|
|
515
|
-
maxHeight: {
|
|
516
|
-
type: String
|
|
517
|
-
},
|
|
518
|
-
zIndex: {
|
|
519
|
-
type: Number,
|
|
520
|
-
default: 1050
|
|
521
|
-
},
|
|
522
|
-
backdropZIndex: {
|
|
523
|
-
type: Number,
|
|
524
|
-
default: 1049
|
|
525
|
-
},
|
|
526
|
-
placement: {
|
|
527
|
-
type: String,
|
|
528
|
-
default: "center"
|
|
529
|
-
},
|
|
530
|
-
offsetX: {
|
|
531
|
-
type: String,
|
|
532
|
-
default: "0px"
|
|
533
|
-
},
|
|
534
|
-
offsetY: {
|
|
535
|
-
type: String,
|
|
536
|
-
default: "0px"
|
|
537
|
-
},
|
|
538
|
-
title: {
|
|
539
|
-
type: String
|
|
540
|
-
},
|
|
541
|
-
showAnimation: {
|
|
542
|
-
type: Boolean,
|
|
543
|
-
default: true
|
|
544
|
-
},
|
|
545
|
-
backdropCloseable: {
|
|
281
|
+
});
|
|
282
|
+
const fixedOverlayProps = {
|
|
283
|
+
modelValue: {
|
|
546
284
|
type: Boolean,
|
|
547
285
|
default: false
|
|
548
286
|
},
|
|
549
|
-
|
|
287
|
+
lockScroll: {
|
|
550
288
|
type: Boolean,
|
|
551
289
|
default: true
|
|
552
290
|
},
|
|
553
|
-
|
|
291
|
+
closeOnClickOverlay: {
|
|
554
292
|
type: Boolean,
|
|
555
293
|
default: true
|
|
556
|
-
},
|
|
557
|
-
onClose: {
|
|
558
|
-
type: Function
|
|
559
|
-
},
|
|
560
|
-
beforeHidden: {
|
|
561
|
-
type: [Promise, Function]
|
|
562
|
-
},
|
|
563
|
-
buttons: {
|
|
564
|
-
type: Array,
|
|
565
|
-
default: []
|
|
566
|
-
},
|
|
567
|
-
dialogType: {
|
|
568
|
-
type: String,
|
|
569
|
-
default: "standard"
|
|
570
|
-
},
|
|
571
|
-
modelValue: {
|
|
572
|
-
type: Boolean
|
|
573
|
-
},
|
|
574
|
-
"onUpdate:modelValue": {
|
|
575
|
-
type: Function
|
|
576
294
|
}
|
|
577
295
|
};
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
target.style.cursor = "all-scroll";
|
|
593
|
-
let startX = 0;
|
|
594
|
-
let startY = 0;
|
|
595
|
-
let prevMovingX = 0;
|
|
596
|
-
let prevMovingY = 0;
|
|
597
|
-
let containerRect = container.getBoundingClientRect();
|
|
598
|
-
let bodyRect = document.body.getBoundingClientRect();
|
|
599
|
-
let isDown = false;
|
|
600
|
-
const handleMouseDown = (event) => {
|
|
601
|
-
event.preventDefault();
|
|
602
|
-
if (!enabledMoving.value) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
startX = event.clientX;
|
|
606
|
-
startY = event.clientY;
|
|
607
|
-
const targetRect = target.getBoundingClientRect();
|
|
608
|
-
if ((target === event.target || target.contains(event.target)) && targetRect.x < startX && targetRect.y < startY && targetRect.width + targetRect.x >= startX && targetRect.height + targetRect.y >= startY) {
|
|
609
|
-
isDown = true;
|
|
610
|
-
prevMovingX = movingX.value;
|
|
611
|
-
prevMovingY = movingY.value;
|
|
612
|
-
bodyRect = document.body.getBoundingClientRect();
|
|
613
|
-
containerRect = container.getBoundingClientRect();
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
const handleMouseMove = (event) => {
|
|
617
|
-
event.preventDefault();
|
|
618
|
-
if (!isDown) {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
const currentX = prevMovingX + event.clientX - startX;
|
|
622
|
-
const currentY = prevMovingY + event.clientY - startY;
|
|
623
|
-
const containerOriginX = containerRect.x - prevMovingX;
|
|
624
|
-
const containerOriginY = containerRect.y - prevMovingY;
|
|
625
|
-
movingX.value = getRangeValueOf(currentX, -containerOriginX, bodyRect.width - containerRect.width - containerOriginX);
|
|
626
|
-
movingY.value = getRangeValueOf(currentY, -containerOriginY, bodyRect.height - containerRect.height - containerOriginY);
|
|
627
|
-
};
|
|
628
|
-
const handleMouseUp = (event) => {
|
|
629
|
-
event.preventDefault();
|
|
630
|
-
if (!isDown) {
|
|
631
|
-
return;
|
|
296
|
+
function lockScroll() {
|
|
297
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
298
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
299
|
+
const style = document.documentElement.getAttribute("style");
|
|
300
|
+
document.documentElement.style.position = "fixed";
|
|
301
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
302
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
303
|
+
document.documentElement.style.overflowY = "scroll";
|
|
304
|
+
return () => {
|
|
305
|
+
if (style) {
|
|
306
|
+
document.documentElement.setAttribute("style", style);
|
|
307
|
+
} else {
|
|
308
|
+
document.documentElement.removeAttribute("style");
|
|
632
309
|
}
|
|
633
|
-
|
|
310
|
+
document.documentElement.scrollTop = scrollTop;
|
|
634
311
|
};
|
|
635
|
-
window.addEventListener("mousedown", handleMouseDown);
|
|
636
|
-
window.addEventListener("mousemove", handleMouseMove);
|
|
637
|
-
window.addEventListener("mouseup", handleMouseUp);
|
|
638
|
-
onInvalidate(() => {
|
|
639
|
-
window.removeEventListener("mousedown", handleMouseDown);
|
|
640
|
-
window.removeEventListener("mousemove", handleMouseMove);
|
|
641
|
-
window.removeEventListener("mouseup", handleMouseUp);
|
|
642
|
-
});
|
|
643
|
-
});
|
|
644
|
-
return {
|
|
645
|
-
movingX: readonly(movingX),
|
|
646
|
-
movingY: readonly(movingY),
|
|
647
|
-
handleRef,
|
|
648
|
-
moveElRef,
|
|
649
|
-
reset
|
|
650
|
-
};
|
|
651
|
-
};
|
|
652
|
-
const getRangeValueOf = (value, min, max) => {
|
|
653
|
-
if (value < min) {
|
|
654
|
-
return min;
|
|
655
|
-
}
|
|
656
|
-
if (value > max) {
|
|
657
|
-
return max;
|
|
658
312
|
}
|
|
659
|
-
return
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
size: {
|
|
669
|
-
type: String,
|
|
670
|
-
default: "inherit"
|
|
671
|
-
},
|
|
672
|
-
color: {
|
|
673
|
-
type: String,
|
|
674
|
-
default: "inherit"
|
|
675
|
-
},
|
|
676
|
-
classPrefix: {
|
|
677
|
-
type: String,
|
|
678
|
-
default: "icon"
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
function useFixedOverlay(props, ctx) {
|
|
316
|
+
let lockScrollCb;
|
|
317
|
+
const onClick = (event) => {
|
|
318
|
+
event.preventDefault();
|
|
319
|
+
ctx.emit("click", event);
|
|
320
|
+
if (props.closeOnClickOverlay) {
|
|
321
|
+
ctx.emit("update:modelValue", false);
|
|
679
322
|
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
|
|
323
|
+
};
|
|
324
|
+
const removeBodyAdditions = () => {
|
|
325
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
326
|
+
};
|
|
327
|
+
watch(() => props.modelValue, (val) => {
|
|
328
|
+
if (val) {
|
|
329
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
330
|
+
} else {
|
|
331
|
+
removeBodyAdditions();
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
onUnmounted(removeBodyAdditions);
|
|
335
|
+
return { onClick };
|
|
336
|
+
}
|
|
337
|
+
var fixedOverlay = "";
|
|
338
|
+
const FixedOverlay = defineComponent({
|
|
339
|
+
name: "DFixedOverlay",
|
|
340
|
+
inheritAttrs: false,
|
|
341
|
+
props: fixedOverlayProps,
|
|
342
|
+
emits: ["update:modelValue", "click"],
|
|
343
|
+
setup(props, ctx) {
|
|
685
344
|
const {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
"
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
345
|
+
modelValue
|
|
346
|
+
} = toRefs(props);
|
|
347
|
+
const ns = useNamespace("fixed-overlay");
|
|
348
|
+
const {
|
|
349
|
+
onClick
|
|
350
|
+
} = useFixedOverlay(props, ctx);
|
|
351
|
+
return () => createVNode(Transition, {
|
|
352
|
+
"name": ns.m("fade")
|
|
353
|
+
}, {
|
|
354
|
+
default: () => {
|
|
355
|
+
var _a, _b;
|
|
356
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
357
|
+
"class": ns.b()
|
|
358
|
+
}, ctx.attrs, {
|
|
359
|
+
"onClick": onClick
|
|
360
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
702
361
|
}
|
|
703
|
-
}
|
|
362
|
+
});
|
|
704
363
|
}
|
|
705
364
|
});
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
type: {
|
|
711
|
-
type: String,
|
|
712
|
-
default: "button"
|
|
713
|
-
},
|
|
714
|
-
btnStyle: {
|
|
715
|
-
type: String,
|
|
716
|
-
default: "primary"
|
|
365
|
+
const flexibleOverlayProps = {
|
|
366
|
+
modelValue: {
|
|
367
|
+
type: Boolean,
|
|
368
|
+
default: false
|
|
717
369
|
},
|
|
718
|
-
|
|
719
|
-
type:
|
|
720
|
-
|
|
370
|
+
origin: {
|
|
371
|
+
type: Object,
|
|
372
|
+
require: true
|
|
721
373
|
},
|
|
722
374
|
position: {
|
|
723
|
-
type:
|
|
724
|
-
default: "
|
|
375
|
+
type: Array,
|
|
376
|
+
default: ["bottom"]
|
|
725
377
|
},
|
|
726
|
-
|
|
727
|
-
type:
|
|
728
|
-
default:
|
|
378
|
+
offset: {
|
|
379
|
+
type: [Number, Object],
|
|
380
|
+
default: 8
|
|
729
381
|
},
|
|
730
|
-
|
|
731
|
-
type:
|
|
732
|
-
default: ""
|
|
733
|
-
},
|
|
734
|
-
showLoading: {
|
|
735
|
-
type: Boolean,
|
|
736
|
-
default: false
|
|
382
|
+
shiftOffset: {
|
|
383
|
+
type: Number
|
|
737
384
|
},
|
|
738
|
-
|
|
739
|
-
type: String
|
|
385
|
+
align: {
|
|
386
|
+
type: String,
|
|
387
|
+
default: null
|
|
740
388
|
},
|
|
741
|
-
|
|
389
|
+
showArrow: {
|
|
742
390
|
type: Boolean,
|
|
743
391
|
default: false
|
|
744
392
|
},
|
|
745
|
-
|
|
393
|
+
isArrowCenter: {
|
|
746
394
|
type: Boolean,
|
|
747
|
-
default:
|
|
748
|
-
},
|
|
749
|
-
onClick: {
|
|
750
|
-
type: Function
|
|
395
|
+
default: true
|
|
751
396
|
}
|
|
752
397
|
};
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
398
|
+
function getScrollParent(element) {
|
|
399
|
+
const overflowRegex = /(auto|scroll|hidden)/;
|
|
400
|
+
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
401
|
+
const style = window.getComputedStyle(parent);
|
|
402
|
+
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
403
|
+
return parent;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return window;
|
|
407
|
+
}
|
|
408
|
+
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
409
|
+
let { x, y } = point;
|
|
410
|
+
if (!isArrowCenter) {
|
|
411
|
+
const { width, height } = originRect;
|
|
412
|
+
if (x && placement.includes("start")) {
|
|
413
|
+
x = 12;
|
|
414
|
+
}
|
|
415
|
+
if (x && placement.includes("end")) {
|
|
416
|
+
x = Math.round(width - 24);
|
|
417
|
+
}
|
|
418
|
+
if (y && placement.includes("start")) {
|
|
419
|
+
y = 10;
|
|
420
|
+
}
|
|
421
|
+
if (y && placement.includes("end")) {
|
|
422
|
+
y = height - 14;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return { x, y };
|
|
426
|
+
}
|
|
427
|
+
function useOverlay(props, emit) {
|
|
428
|
+
const overlayRef = ref();
|
|
429
|
+
const arrowRef = ref();
|
|
430
|
+
let originParent = null;
|
|
431
|
+
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
432
|
+
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
433
|
+
const staticSide = {
|
|
434
|
+
top: "bottom",
|
|
435
|
+
right: "left",
|
|
436
|
+
bottom: "top",
|
|
437
|
+
left: "right"
|
|
438
|
+
}[placement.split("-")[0]];
|
|
439
|
+
Object.assign(arrowEl.style, {
|
|
440
|
+
left: x ? `${x}px` : "",
|
|
441
|
+
top: y ? `${y}px` : "",
|
|
442
|
+
right: "",
|
|
443
|
+
bottom: "",
|
|
444
|
+
[staticSide]: "-4px"
|
|
780
445
|
});
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
446
|
+
};
|
|
447
|
+
const updatePosition = async () => {
|
|
448
|
+
const hostEl = props.origin;
|
|
449
|
+
const overlayEl = unref(overlayRef.value);
|
|
450
|
+
const arrowEl = unref(arrowRef.value);
|
|
451
|
+
const middleware = [
|
|
452
|
+
offset(props.offset),
|
|
453
|
+
autoPlacement({
|
|
454
|
+
alignment: props.align,
|
|
455
|
+
allowedPlacements: props.position
|
|
456
|
+
})
|
|
457
|
+
];
|
|
458
|
+
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
459
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
460
|
+
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
461
|
+
strategy: "fixed",
|
|
462
|
+
middleware
|
|
463
|
+
});
|
|
464
|
+
let applyX = x;
|
|
465
|
+
let applyY = y;
|
|
466
|
+
if (props.shiftOffset !== void 0) {
|
|
467
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
468
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
469
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
470
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
471
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
472
|
+
}
|
|
473
|
+
emit("positionChange", placement);
|
|
474
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
475
|
+
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
476
|
+
};
|
|
477
|
+
watch(() => props.modelValue, () => {
|
|
478
|
+
if (props.modelValue && props.origin) {
|
|
479
|
+
originParent = getScrollParent(props.origin);
|
|
480
|
+
nextTick(updatePosition);
|
|
481
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
482
|
+
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
483
|
+
window.addEventListener("resize", updatePosition);
|
|
484
|
+
} else {
|
|
485
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
486
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
487
|
+
window.removeEventListener("resize", updatePosition);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
onUnmounted(() => {
|
|
491
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
492
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
493
|
+
window.removeEventListener("resize", updatePosition);
|
|
494
|
+
});
|
|
495
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
496
|
+
}
|
|
497
|
+
var flexibleOverlay = "";
|
|
498
|
+
defineComponent({
|
|
499
|
+
name: "DFlexibleOverlay",
|
|
500
|
+
inheritAttrs: false,
|
|
501
|
+
props: flexibleOverlayProps,
|
|
502
|
+
emits: ["update:modelValue", "positionChange"],
|
|
503
|
+
setup(props, {
|
|
504
|
+
slots,
|
|
505
|
+
attrs,
|
|
506
|
+
emit,
|
|
507
|
+
expose
|
|
508
|
+
}) {
|
|
509
|
+
const ns = useNamespace("flexible-overlay");
|
|
510
|
+
const {
|
|
511
|
+
arrowRef,
|
|
512
|
+
overlayRef,
|
|
513
|
+
updatePosition
|
|
514
|
+
} = useOverlay(props, emit);
|
|
515
|
+
expose({
|
|
516
|
+
updatePosition
|
|
791
517
|
});
|
|
792
518
|
return () => {
|
|
793
|
-
var _a
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
801
|
-
return createVNode("div", mergeProps({
|
|
802
|
-
"class": "devui-btn-host"
|
|
803
|
-
}, ctx.attrs), [createVNode("button", {
|
|
804
|
-
"class": btnClass.value,
|
|
805
|
-
"type": type,
|
|
806
|
-
"disabled": disabled,
|
|
807
|
-
"style": {
|
|
808
|
-
width
|
|
809
|
-
},
|
|
810
|
-
"onClick": onClick
|
|
811
|
-
}, [!!icon ? createVNode(Icon, {
|
|
812
|
-
"name": props.icon,
|
|
813
|
-
"class": iconClass.value
|
|
814
|
-
}, null) : null, createVNode("span", {
|
|
815
|
-
"class": "button-content",
|
|
816
|
-
"ref": buttonContent
|
|
817
|
-
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]);
|
|
519
|
+
var _a;
|
|
520
|
+
return props.modelValue && createVNode("div", mergeProps({
|
|
521
|
+
"ref": overlayRef,
|
|
522
|
+
"class": ns.b()
|
|
523
|
+
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
524
|
+
"ref": arrowRef,
|
|
525
|
+
"class": ns.e("arrow")
|
|
526
|
+
}, null)]);
|
|
818
527
|
};
|
|
819
528
|
}
|
|
820
529
|
});
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
530
|
+
const inBrowser = typeof window !== "undefined";
|
|
531
|
+
function useModal(props, emit) {
|
|
532
|
+
function close() {
|
|
533
|
+
emit("update:modelValue", false);
|
|
534
|
+
}
|
|
535
|
+
function execClose() {
|
|
536
|
+
props.beforeClose ? props.beforeClose(close) : close();
|
|
537
|
+
}
|
|
538
|
+
function onOverlayClick() {
|
|
539
|
+
props.closeOnClickOverlay && execClose();
|
|
540
|
+
}
|
|
541
|
+
function onCloseBtnClick() {
|
|
542
|
+
execClose();
|
|
543
|
+
}
|
|
544
|
+
function onKeydown(event) {
|
|
545
|
+
if (event["keyCode"] === 27) {
|
|
546
|
+
execClose();
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
onMounted(() => {
|
|
550
|
+
if (props.escapable) {
|
|
551
|
+
window.addEventListener("keydown", onKeydown);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
onUnmounted(() => {
|
|
555
|
+
if (props.escapable) {
|
|
556
|
+
window.addEventListener("keydown", onKeydown);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
return { onCloseBtnClick, onOverlayClick };
|
|
826
560
|
}
|
|
827
|
-
|
|
561
|
+
function useModalRender(props) {
|
|
562
|
+
const showContainer = ref(false);
|
|
563
|
+
const showModal = ref(false);
|
|
564
|
+
let lockScrollCb;
|
|
565
|
+
const removeBodyAdditions = () => {
|
|
566
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
567
|
+
};
|
|
568
|
+
watch(() => props.modelValue, (val) => {
|
|
569
|
+
if (val) {
|
|
570
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
571
|
+
showContainer.value = true;
|
|
572
|
+
nextTick(() => {
|
|
573
|
+
showModal.value = true;
|
|
574
|
+
});
|
|
575
|
+
} else {
|
|
576
|
+
removeBodyAdditions();
|
|
577
|
+
showModal.value = false;
|
|
578
|
+
setTimeout(() => {
|
|
579
|
+
showContainer.value = false;
|
|
580
|
+
}, 100);
|
|
581
|
+
}
|
|
582
|
+
}, {
|
|
583
|
+
immediate: true
|
|
584
|
+
});
|
|
585
|
+
onUnmounted(removeBodyAdditions);
|
|
586
|
+
return { showContainer, showModal };
|
|
587
|
+
}
|
|
588
|
+
var Header = defineComponent({
|
|
589
|
+
name: "DModalHeader",
|
|
590
|
+
setup(props, {
|
|
591
|
+
slots
|
|
592
|
+
}) {
|
|
593
|
+
const ns = useNamespace("modal");
|
|
594
|
+
return () => {
|
|
595
|
+
var _a;
|
|
596
|
+
return createVNode("div", {
|
|
597
|
+
"class": ns.e("header")
|
|
598
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
var Body = defineComponent({
|
|
603
|
+
name: "DModalBody",
|
|
604
|
+
setup(props, {
|
|
605
|
+
slots
|
|
606
|
+
}) {
|
|
607
|
+
const ns = useNamespace("modal");
|
|
608
|
+
return () => {
|
|
609
|
+
var _a;
|
|
610
|
+
return createVNode("div", {
|
|
611
|
+
"class": ns.e("body")
|
|
612
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
var modal = "";
|
|
617
|
+
var Modal = defineComponent({
|
|
828
618
|
name: "DModal",
|
|
829
619
|
inheritAttrs: false,
|
|
830
|
-
props:
|
|
831
|
-
emits: ["
|
|
832
|
-
setup(props,
|
|
620
|
+
props: modalProps,
|
|
621
|
+
emits: ["update:modelValue"],
|
|
622
|
+
setup(props, {
|
|
623
|
+
slots,
|
|
624
|
+
attrs,
|
|
625
|
+
emit
|
|
626
|
+
}) {
|
|
627
|
+
const ns = useNamespace("modal");
|
|
833
628
|
const {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
} =
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
width: props.width,
|
|
852
|
-
maxHeight: props.maxHeight,
|
|
853
|
-
transform: `translate(${props.offsetX}, ${props.offsetY})`,
|
|
854
|
-
zIndex: props.zIndex
|
|
855
|
-
}));
|
|
856
|
-
const iconName = computed(() => {
|
|
857
|
-
switch (props.dialogType) {
|
|
858
|
-
case "standard":
|
|
859
|
-
return "";
|
|
860
|
-
case "info":
|
|
861
|
-
return "icon-info-o";
|
|
862
|
-
case "success":
|
|
863
|
-
return "icon-right-o";
|
|
864
|
-
case "warning":
|
|
865
|
-
return "icon-warning-o";
|
|
866
|
-
case "failed":
|
|
867
|
-
return "icon-error-o";
|
|
868
|
-
default:
|
|
869
|
-
return "";
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
const buttonsRef = computed(() => {
|
|
873
|
-
return props.buttons.map((buttonProps2, index2) => {
|
|
874
|
-
const {
|
|
875
|
-
btnStyle,
|
|
876
|
-
disabled,
|
|
877
|
-
handler,
|
|
878
|
-
text
|
|
879
|
-
} = buttonProps2;
|
|
880
|
-
return createVNode(Button, {
|
|
881
|
-
"key": index2,
|
|
882
|
-
"style": {
|
|
883
|
-
display: "inline-block",
|
|
884
|
-
margin: "0 5px"
|
|
885
|
-
},
|
|
886
|
-
"btnStyle": btnStyle,
|
|
887
|
-
"disabled": disabled,
|
|
888
|
-
"onClick": handler
|
|
889
|
-
}, _isSlot(text) ? text : {
|
|
890
|
-
default: () => [text]
|
|
891
|
-
});
|
|
892
|
-
});
|
|
893
|
-
});
|
|
894
|
-
const modalRef = ref();
|
|
895
|
-
const closeModal = () => {
|
|
896
|
-
var _a, _b;
|
|
897
|
-
(_b = (_a = modalRef.value) == null ? void 0 : _a.onVisibleChange) == null ? void 0 : _b.call(_a, false);
|
|
898
|
-
};
|
|
899
|
-
ctx.expose({
|
|
900
|
-
closeModal
|
|
901
|
-
});
|
|
902
|
-
return () => createVNode(Modal, {
|
|
903
|
-
"ref": modalRef,
|
|
904
|
-
"width": props.width,
|
|
905
|
-
"maxHeight": props.maxHeight,
|
|
906
|
-
"offsetX": props.offsetX,
|
|
907
|
-
"offsetY": props.offsetY,
|
|
908
|
-
"zIndex": props.zIndex,
|
|
909
|
-
"backdropZIndex": props.backdropZIndex,
|
|
910
|
-
"backdropCloseable": props.backdropCloseable,
|
|
911
|
-
"bodyScrollable": props.bodyScrollable,
|
|
912
|
-
"placement": props.placement,
|
|
913
|
-
"onClose": props.onClose,
|
|
914
|
-
"beforeHidden": props.beforeHidden,
|
|
915
|
-
"modelValue": props.modelValue,
|
|
916
|
-
"onUpdate:modelValue": props["onUpdate:modelValue"]
|
|
629
|
+
modelValue,
|
|
630
|
+
title,
|
|
631
|
+
showClose,
|
|
632
|
+
showOverlay,
|
|
633
|
+
appendToBody
|
|
634
|
+
} = toRefs(props);
|
|
635
|
+
const {
|
|
636
|
+
onCloseBtnClick,
|
|
637
|
+
onOverlayClick
|
|
638
|
+
} = useModal(props, emit);
|
|
639
|
+
const {
|
|
640
|
+
showContainer,
|
|
641
|
+
showModal
|
|
642
|
+
} = useModalRender(props);
|
|
643
|
+
return () => createVNode(Teleport, {
|
|
644
|
+
"to": "body",
|
|
645
|
+
"disabled": !appendToBody.value
|
|
917
646
|
}, {
|
|
918
|
-
default: () => {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
"
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
647
|
+
default: () => [showOverlay.value && createVNode(FixedOverlay, {
|
|
648
|
+
"modelValue": modelValue.value,
|
|
649
|
+
"onUpdate:modelValue": ($event) => modelValue.value = $event,
|
|
650
|
+
"lock-scroll": false,
|
|
651
|
+
"style": {
|
|
652
|
+
zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
|
|
653
|
+
}
|
|
654
|
+
}, null), showContainer.value && createVNode("div", {
|
|
655
|
+
"class": ns.e("container"),
|
|
656
|
+
"onClick": onOverlayClick
|
|
657
|
+
}, [createVNode(Transition, {
|
|
658
|
+
"name": ns.m("wipe")
|
|
659
|
+
}, {
|
|
660
|
+
default: () => {
|
|
661
|
+
var _a;
|
|
662
|
+
return [showModal.value && createVNode("div", mergeProps({
|
|
663
|
+
"class": ns.b()
|
|
664
|
+
}, attrs), [showClose.value && createVNode(Icon, {
|
|
665
|
+
"name": "close",
|
|
666
|
+
"class": "btn-close",
|
|
667
|
+
"size": "var(--devui-font-size-md,12px)",
|
|
668
|
+
"onClick": onCloseBtnClick
|
|
669
|
+
}, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
670
|
+
default: () => [title.value]
|
|
671
|
+
}), createVNode(Body, null, {
|
|
672
|
+
default: () => {
|
|
673
|
+
var _a2;
|
|
674
|
+
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
|
|
675
|
+
}
|
|
676
|
+
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
677
|
+
}
|
|
678
|
+
})])]
|
|
942
679
|
});
|
|
943
680
|
}
|
|
944
681
|
});
|
|
945
|
-
|
|
682
|
+
var Footer = defineComponent({
|
|
683
|
+
name: "DModalFooter",
|
|
684
|
+
setup(props, {
|
|
685
|
+
slots
|
|
686
|
+
}) {
|
|
687
|
+
const ns = useNamespace("modal");
|
|
688
|
+
return () => {
|
|
689
|
+
var _a;
|
|
690
|
+
return createVNode("div", {
|
|
691
|
+
"class": ns.e("footer")
|
|
692
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
class CommonModalService {
|
|
697
|
+
constructor(anchorContainer) {
|
|
698
|
+
this.anchorContainer = anchorContainer;
|
|
699
|
+
}
|
|
700
|
+
renderModal(anchor, props, children) {
|
|
701
|
+
const vnode = h(this.component(), props, children);
|
|
702
|
+
render(vnode, anchor);
|
|
703
|
+
return vnode;
|
|
704
|
+
}
|
|
705
|
+
renderNull(anchor) {
|
|
706
|
+
setTimeout(() => {
|
|
707
|
+
render(null, anchor);
|
|
708
|
+
}, 500);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
let vm;
|
|
712
|
+
class ModalService extends CommonModalService {
|
|
946
713
|
component() {
|
|
947
|
-
return
|
|
714
|
+
return Modal;
|
|
948
715
|
}
|
|
949
716
|
open(props = {}) {
|
|
950
717
|
const anchor = document.createElement("div");
|
|
951
718
|
this.anchorContainer.appendChild(anchor);
|
|
952
|
-
const _a = props, { content } = _a, resProps = __objRest(_a, ["content"]);
|
|
953
|
-
const
|
|
954
|
-
|
|
955
|
-
hide();
|
|
956
|
-
}
|
|
957
|
-
};
|
|
958
|
-
const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
|
|
959
|
-
return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
|
|
719
|
+
const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
|
|
720
|
+
const renderOrigin = (propsValue, onUpdateModelValue) => {
|
|
721
|
+
return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
|
|
960
722
|
modelValue: true,
|
|
961
723
|
"onUpdate:modelValue": onUpdateModelValue
|
|
962
|
-
}), { default: content });
|
|
724
|
+
}), { header, default: content, footer });
|
|
963
725
|
};
|
|
964
726
|
const hide = () => {
|
|
965
|
-
var _a2, _b;
|
|
966
|
-
const
|
|
727
|
+
var _a2, _b, _c;
|
|
728
|
+
const innerNeedHideOrNot = (value) => {
|
|
729
|
+
if (!value) {
|
|
730
|
+
hide();
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
renderOrigin(resProps, (value) => {
|
|
967
734
|
if (!value) {
|
|
968
735
|
this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
|
|
969
736
|
this.renderNull(anchor);
|
|
970
737
|
} else {
|
|
971
|
-
renderOrigin(resProps);
|
|
738
|
+
renderOrigin(resProps, innerNeedHideOrNot);
|
|
972
739
|
}
|
|
973
740
|
});
|
|
974
|
-
(_b = (_a2 =
|
|
741
|
+
(_c = (_b = (_a2 = vm == null ? void 0 : vm.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
|
|
975
742
|
};
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
743
|
+
const needHideOrNot = (value) => {
|
|
744
|
+
if (!value) {
|
|
745
|
+
hide();
|
|
746
|
+
}
|
|
980
747
|
};
|
|
981
748
|
this.renderModal(anchor, { modelValue: false });
|
|
982
|
-
renderOrigin(resProps);
|
|
983
|
-
return { hide
|
|
749
|
+
vm = renderOrigin(resProps, needHideOrNot);
|
|
750
|
+
return { hide };
|
|
984
751
|
}
|
|
985
752
|
}
|
|
986
|
-
__publicField(
|
|
987
|
-
Modal.install = function(app) {
|
|
988
|
-
app.component(Modal.name, Modal);
|
|
989
|
-
};
|
|
753
|
+
__publicField(ModalService, "token", "MODAL_SERVICE_TOKEN");
|
|
990
754
|
var index = {
|
|
991
755
|
title: "Modal \u5F39\u7A97",
|
|
992
756
|
category: "\u53CD\u9988",
|
|
993
|
-
status: "
|
|
757
|
+
status: "100%",
|
|
994
758
|
install(app) {
|
|
995
|
-
app.
|
|
759
|
+
app.component(Modal.name, Modal);
|
|
760
|
+
app.component(Header.name, Header);
|
|
761
|
+
app.component(Body.name, Body);
|
|
762
|
+
app.component(Footer.name, Footer);
|
|
996
763
|
if (!inBrowser) {
|
|
997
764
|
return;
|
|
998
765
|
}
|
|
@@ -1003,7 +770,6 @@ var index = {
|
|
|
1003
770
|
document.body.appendChild(anchorsContainer);
|
|
1004
771
|
}
|
|
1005
772
|
app.provide(ModalService.token, new ModalService(anchorsContainer));
|
|
1006
|
-
app.provide(DialogService.token, new DialogService(anchorsContainer));
|
|
1007
773
|
}
|
|
1008
774
|
};
|
|
1009
|
-
export { Modal, index as default };
|
|
775
|
+
export { Modal, index as default, modalProps };
|