vue-devui 1.0.0-alpha.1 → 1.0.0-alpha.12
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 +161 -172
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +204 -1
- 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 +9051 -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 +308 -1
- 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 +120 -1
- 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 +5964 -1
- 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 +89 -1
- 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 +8207 -1
- 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/{carousel → 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 +12031 -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 +248 -0
- package/drawer/index.umd.js +1 -0
- package/{anchor → drawer}/package.json +1 -1
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +743 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +991 -1
- 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 +7751 -0
- package/form/index.umd.js +38 -0
- package/{toast → form}/package.json +1 -1
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +166 -0
- package/fullscreen/index.umd.js +1 -0
- package/fullscreen/package.json +7 -0
- package/fullscreen/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +271 -0
- package/grid/index.umd.js +1 -0
- package/{sticky → grid}/package.json +1 -1
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +218 -1
- 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 +511 -1
- 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 +8311 -1
- 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 +308 -1
- 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 +115 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +272 -1
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/message/index.d.ts +7 -0
- package/message/index.es.js +534 -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 +741 -0
- package/modal/index.umd.js +1 -0
- package/modal/package.json +7 -0
- package/modal/style.css +1 -0
- 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/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/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/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/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 +293 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +19 -82
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +820 -1
- 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 +218 -1
- 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 +6062 -1
- 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 +207 -1
- package/progress/index.umd.js +3 -1
- package/progress/style.css +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +8056 -1
- 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 +242 -1
- 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/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +173 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +8504 -2
- package/search/index.umd.js +38 -10
- package/search/style.css +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +9423 -1
- 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 +145 -0
- package/skeleton/index.umd.js +1 -0
- package/skeleton/package.json +7 -0
- package/skeleton/style.css +1 -0
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +203 -1
- 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 +6754 -1
- 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 +63 -1
- 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 +7852 -1
- 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 +11527 -0
- package/table/index.umd.js +38 -0
- package/table/package.json +7 -0
- package/table/style.css +1 -0
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +407 -1
- 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 +7986 -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 +9556 -0
- package/time-picker/index.umd.js +38 -0
- package/{date-picker → time-picker}/package.json +1 -1
- package/time-picker/style.css +1 -0
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9604 -0
- package/time-select/index.umd.js +38 -0
- package/time-select/package.json +7 -0
- 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 +5900 -1
- 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 +10336 -1
- 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 +1398 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27443 -2
- package/vue-devui.umd.js +50 -10
- package/accordion/index.es.js +0 -1
- package/accordion/index.umd.js +0 -1
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -1
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/carousel/index.es.js +0 -1
- package/carousel/index.umd.js +0 -1
- package/carousel/style.css +0 -1
- package/date-picker/index.es.js +0 -1
- package/date-picker/index.umd.js +0 -1
- package/date-picker/style.css +0 -1
- package/quadrant-diagram/index.es.js +0 -10
- package/quadrant-diagram/index.umd.js +0 -10
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/sticky/index.es.js +0 -1
- package/sticky/index.umd.js +0 -1
- package/tag-input/index.es.js +0 -1
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/toast/index.es.js +0 -1
- package/toast/index.umd.js +0 -1
- package/toast/style.css +0 -1
- package/transfer/index.es.js +0 -10
- package/transfer/index.umd.js +0 -10
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, nextTick, unref, onMounted, Teleport, h, render } from "vue";
|
|
2
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
3
|
+
const modalProps = {
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: false
|
|
7
|
+
},
|
|
8
|
+
title: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: ""
|
|
11
|
+
},
|
|
12
|
+
lockScroll: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: true
|
|
15
|
+
},
|
|
16
|
+
closeOnClickOverlay: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: true
|
|
19
|
+
},
|
|
20
|
+
beforeClose: {
|
|
21
|
+
type: Function
|
|
22
|
+
},
|
|
23
|
+
escapable: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true
|
|
26
|
+
},
|
|
27
|
+
showClose: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
},
|
|
31
|
+
showOverlay: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true
|
|
34
|
+
},
|
|
35
|
+
appendToBody: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const DEFAULT_PREFIX = "icon";
|
|
41
|
+
const iconProps = {
|
|
42
|
+
name: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "",
|
|
45
|
+
required: true
|
|
46
|
+
},
|
|
47
|
+
size: {
|
|
48
|
+
type: [Number, String],
|
|
49
|
+
default: "inherit"
|
|
50
|
+
},
|
|
51
|
+
color: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "inherit"
|
|
54
|
+
},
|
|
55
|
+
component: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: null
|
|
58
|
+
},
|
|
59
|
+
classPrefix: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: DEFAULT_PREFIX
|
|
62
|
+
},
|
|
63
|
+
operable: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
rotate: {
|
|
72
|
+
type: [Number, String]
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const svgIconProps = {
|
|
76
|
+
name: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: "",
|
|
79
|
+
required: true
|
|
80
|
+
},
|
|
81
|
+
color: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "inherit"
|
|
84
|
+
},
|
|
85
|
+
size: {
|
|
86
|
+
type: [Number, String],
|
|
87
|
+
default: "inherit"
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
function createBem(namespace, element, modifier) {
|
|
91
|
+
let cls = namespace;
|
|
92
|
+
if (element) {
|
|
93
|
+
cls += `__${element}`;
|
|
94
|
+
}
|
|
95
|
+
if (modifier) {
|
|
96
|
+
cls += `--${modifier}`;
|
|
97
|
+
}
|
|
98
|
+
return cls;
|
|
99
|
+
}
|
|
100
|
+
function useNamespace(block, needDot = false) {
|
|
101
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
102
|
+
const b = () => createBem(namespace);
|
|
103
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
104
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
105
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
106
|
+
return {
|
|
107
|
+
b,
|
|
108
|
+
e,
|
|
109
|
+
m,
|
|
110
|
+
em
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
var icon = "";
|
|
114
|
+
var svgIcon = defineComponent({
|
|
115
|
+
name: "DSvgIcon",
|
|
116
|
+
props: svgIconProps,
|
|
117
|
+
setup(props) {
|
|
118
|
+
const {
|
|
119
|
+
name,
|
|
120
|
+
color,
|
|
121
|
+
size
|
|
122
|
+
} = toRefs(props);
|
|
123
|
+
const ns = useNamespace("svg-icon");
|
|
124
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
125
|
+
const iconSize = computed(() => {
|
|
126
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
127
|
+
});
|
|
128
|
+
const styles = {
|
|
129
|
+
width: iconSize.value,
|
|
130
|
+
height: iconSize.value
|
|
131
|
+
};
|
|
132
|
+
return () => {
|
|
133
|
+
return createVNode("svg", {
|
|
134
|
+
"class": ns.b(),
|
|
135
|
+
"style": styles
|
|
136
|
+
}, [createVNode("use", {
|
|
137
|
+
"xlink:href": iconName.value,
|
|
138
|
+
"fill": color.value
|
|
139
|
+
}, null)]);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
function isUrl(value) {
|
|
144
|
+
return /^((http|https):)?\/\//.test(value);
|
|
145
|
+
}
|
|
146
|
+
function useIconDom(props, ctx) {
|
|
147
|
+
const {
|
|
148
|
+
component,
|
|
149
|
+
name,
|
|
150
|
+
size,
|
|
151
|
+
color,
|
|
152
|
+
classPrefix,
|
|
153
|
+
rotate
|
|
154
|
+
} = toRefs(props);
|
|
155
|
+
const ns = useNamespace("icon");
|
|
156
|
+
const iconSize = computed(() => {
|
|
157
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
158
|
+
});
|
|
159
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
160
|
+
const imgIconDom = () => {
|
|
161
|
+
return createVNode("img", mergeProps({
|
|
162
|
+
"src": name.value,
|
|
163
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
164
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
165
|
+
"style": {
|
|
166
|
+
width: iconSize.value || "",
|
|
167
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
|
|
168
|
+
verticalAlign: "middle"
|
|
169
|
+
}
|
|
170
|
+
}, ctx.attrs), null);
|
|
171
|
+
};
|
|
172
|
+
const svgIconDom = () => {
|
|
173
|
+
return createVNode(IconComponent, mergeProps({
|
|
174
|
+
"name": name.value,
|
|
175
|
+
"color": color.value,
|
|
176
|
+
"size": iconSize.value,
|
|
177
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
178
|
+
"style": {
|
|
179
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
180
|
+
}
|
|
181
|
+
}, ctx.attrs), null);
|
|
182
|
+
};
|
|
183
|
+
const fontIconDom = () => {
|
|
184
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
185
|
+
return createVNode("i", mergeProps({
|
|
186
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
187
|
+
"style": {
|
|
188
|
+
fontSize: iconSize.value,
|
|
189
|
+
color: color.value,
|
|
190
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
191
|
+
}
|
|
192
|
+
}, ctx.attrs), null);
|
|
193
|
+
};
|
|
194
|
+
const iconDom = () => {
|
|
195
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
196
|
+
};
|
|
197
|
+
return {
|
|
198
|
+
iconDom
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
var Icon = defineComponent({
|
|
202
|
+
name: "DIcon",
|
|
203
|
+
props: iconProps,
|
|
204
|
+
emits: ["click"],
|
|
205
|
+
setup(props, ctx) {
|
|
206
|
+
const {
|
|
207
|
+
disabled,
|
|
208
|
+
operable
|
|
209
|
+
} = toRefs(props);
|
|
210
|
+
const {
|
|
211
|
+
iconDom
|
|
212
|
+
} = useIconDom(props, ctx);
|
|
213
|
+
const ns = useNamespace("icon");
|
|
214
|
+
const wrapClassed = computed(() => ({
|
|
215
|
+
[ns.e("container")]: true,
|
|
216
|
+
[ns.m("disabled")]: disabled.value,
|
|
217
|
+
[ns.m("operable")]: operable.value
|
|
218
|
+
}));
|
|
219
|
+
const onClick = (e) => {
|
|
220
|
+
if (disabled.value) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
ctx.emit("click", e);
|
|
224
|
+
};
|
|
225
|
+
return () => {
|
|
226
|
+
var _a, _b, _c, _d;
|
|
227
|
+
return createVNode("div", {
|
|
228
|
+
"class": wrapClassed.value,
|
|
229
|
+
"onClick": onClick
|
|
230
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
var iconGroup = "";
|
|
235
|
+
defineComponent({
|
|
236
|
+
name: "DIconGroup",
|
|
237
|
+
setup(_, ctx) {
|
|
238
|
+
const ns = useNamespace("icon-group");
|
|
239
|
+
return () => {
|
|
240
|
+
var _a, _b;
|
|
241
|
+
return createVNode("div", {
|
|
242
|
+
"class": ns.b()
|
|
243
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
const fixedOverlayProps = {
|
|
248
|
+
modelValue: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
default: false
|
|
251
|
+
},
|
|
252
|
+
lockScroll: {
|
|
253
|
+
type: Boolean,
|
|
254
|
+
default: true
|
|
255
|
+
},
|
|
256
|
+
closeOnClickOverlay: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: true
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
function lockScroll() {
|
|
262
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
263
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
264
|
+
const style = document.documentElement.getAttribute("style");
|
|
265
|
+
document.documentElement.style.position = "fixed";
|
|
266
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
267
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
268
|
+
document.documentElement.style.overflowY = "scroll";
|
|
269
|
+
return () => {
|
|
270
|
+
if (style) {
|
|
271
|
+
document.documentElement.setAttribute("style", style);
|
|
272
|
+
} else {
|
|
273
|
+
document.documentElement.removeAttribute("style");
|
|
274
|
+
}
|
|
275
|
+
document.documentElement.scrollTop = scrollTop;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
function useFixedOverlay(props, ctx) {
|
|
281
|
+
let lockScrollCb;
|
|
282
|
+
const onClick = (event) => {
|
|
283
|
+
event.preventDefault();
|
|
284
|
+
ctx.emit("click", event);
|
|
285
|
+
if (props.closeOnClickOverlay) {
|
|
286
|
+
ctx.emit("update:modelValue", false);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
const removeBodyAdditions = () => {
|
|
290
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
291
|
+
};
|
|
292
|
+
watch(() => props.modelValue, (val) => {
|
|
293
|
+
if (val) {
|
|
294
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
295
|
+
} else {
|
|
296
|
+
removeBodyAdditions();
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
onUnmounted(removeBodyAdditions);
|
|
300
|
+
return { onClick };
|
|
301
|
+
}
|
|
302
|
+
var fixedOverlay = "";
|
|
303
|
+
const FixedOverlay = defineComponent({
|
|
304
|
+
name: "DFixedOverlay",
|
|
305
|
+
inheritAttrs: false,
|
|
306
|
+
props: fixedOverlayProps,
|
|
307
|
+
emits: ["update:modelValue", "click"],
|
|
308
|
+
setup(props, ctx) {
|
|
309
|
+
const {
|
|
310
|
+
modelValue
|
|
311
|
+
} = toRefs(props);
|
|
312
|
+
const ns = useNamespace("fixed-overlay");
|
|
313
|
+
const {
|
|
314
|
+
onClick
|
|
315
|
+
} = useFixedOverlay(props, ctx);
|
|
316
|
+
return () => createVNode(Transition, {
|
|
317
|
+
"name": ns.m("fade")
|
|
318
|
+
}, {
|
|
319
|
+
default: () => {
|
|
320
|
+
var _a, _b;
|
|
321
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
322
|
+
"class": ns.b()
|
|
323
|
+
}, ctx.attrs, {
|
|
324
|
+
"onClick": onClick
|
|
325
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
const flexibleOverlayProps = {
|
|
331
|
+
modelValue: {
|
|
332
|
+
type: Boolean,
|
|
333
|
+
default: false
|
|
334
|
+
},
|
|
335
|
+
origin: {
|
|
336
|
+
type: Object,
|
|
337
|
+
require: true
|
|
338
|
+
},
|
|
339
|
+
position: {
|
|
340
|
+
type: Array,
|
|
341
|
+
default: ["bottom"]
|
|
342
|
+
},
|
|
343
|
+
offset: {
|
|
344
|
+
type: [Number, Object],
|
|
345
|
+
default: 8
|
|
346
|
+
},
|
|
347
|
+
shiftOffset: {
|
|
348
|
+
type: Number
|
|
349
|
+
},
|
|
350
|
+
align: {
|
|
351
|
+
type: String,
|
|
352
|
+
default: null
|
|
353
|
+
},
|
|
354
|
+
showArrow: {
|
|
355
|
+
type: Boolean,
|
|
356
|
+
default: false
|
|
357
|
+
},
|
|
358
|
+
isArrowCenter: {
|
|
359
|
+
type: Boolean,
|
|
360
|
+
default: true
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
function getScrollParent(element) {
|
|
364
|
+
const overflowRegex = /(auto|scroll|hidden)/;
|
|
365
|
+
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
366
|
+
const style = window.getComputedStyle(parent);
|
|
367
|
+
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
368
|
+
return parent;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return window;
|
|
372
|
+
}
|
|
373
|
+
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
374
|
+
let { x, y } = point;
|
|
375
|
+
if (!isArrowCenter) {
|
|
376
|
+
const { width, height } = originRect;
|
|
377
|
+
if (x && placement.includes("start")) {
|
|
378
|
+
x = 12;
|
|
379
|
+
}
|
|
380
|
+
if (x && placement.includes("end")) {
|
|
381
|
+
x = Math.round(width - 24);
|
|
382
|
+
}
|
|
383
|
+
if (y && placement.includes("start")) {
|
|
384
|
+
y = 10;
|
|
385
|
+
}
|
|
386
|
+
if (y && placement.includes("end")) {
|
|
387
|
+
y = height - 14;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return { x, y };
|
|
391
|
+
}
|
|
392
|
+
function useOverlay(props, emit) {
|
|
393
|
+
const overlayRef = ref();
|
|
394
|
+
const arrowRef = ref();
|
|
395
|
+
let originParent = null;
|
|
396
|
+
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
397
|
+
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
398
|
+
const staticSide = {
|
|
399
|
+
top: "bottom",
|
|
400
|
+
right: "left",
|
|
401
|
+
bottom: "top",
|
|
402
|
+
left: "right"
|
|
403
|
+
}[placement.split("-")[0]];
|
|
404
|
+
Object.assign(arrowEl.style, {
|
|
405
|
+
left: x ? `${x}px` : "",
|
|
406
|
+
top: y ? `${y}px` : "",
|
|
407
|
+
right: "",
|
|
408
|
+
bottom: "",
|
|
409
|
+
[staticSide]: "-4px"
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
const updatePosition = async () => {
|
|
413
|
+
const hostEl = props.origin;
|
|
414
|
+
const overlayEl = unref(overlayRef.value);
|
|
415
|
+
const arrowEl = unref(arrowRef.value);
|
|
416
|
+
const middleware = [
|
|
417
|
+
offset(props.offset),
|
|
418
|
+
autoPlacement({
|
|
419
|
+
alignment: props.align,
|
|
420
|
+
allowedPlacements: props.position
|
|
421
|
+
})
|
|
422
|
+
];
|
|
423
|
+
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
424
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
425
|
+
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
426
|
+
strategy: "fixed",
|
|
427
|
+
middleware
|
|
428
|
+
});
|
|
429
|
+
let applyX = x;
|
|
430
|
+
let applyY = y;
|
|
431
|
+
if (props.shiftOffset !== void 0) {
|
|
432
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
433
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
434
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
435
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
436
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
437
|
+
}
|
|
438
|
+
emit("positionChange", placement);
|
|
439
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
440
|
+
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
441
|
+
};
|
|
442
|
+
watch(() => props.modelValue, () => {
|
|
443
|
+
if (props.modelValue && props.origin) {
|
|
444
|
+
originParent = getScrollParent(props.origin);
|
|
445
|
+
nextTick(updatePosition);
|
|
446
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
447
|
+
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
448
|
+
window.addEventListener("resize", updatePosition);
|
|
449
|
+
} else {
|
|
450
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
451
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
452
|
+
window.removeEventListener("resize", updatePosition);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
onUnmounted(() => {
|
|
456
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
457
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
458
|
+
window.removeEventListener("resize", updatePosition);
|
|
459
|
+
});
|
|
460
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
461
|
+
}
|
|
462
|
+
var flexibleOverlay = "";
|
|
463
|
+
defineComponent({
|
|
464
|
+
name: "DFlexibleOverlay",
|
|
465
|
+
inheritAttrs: false,
|
|
466
|
+
props: flexibleOverlayProps,
|
|
467
|
+
emits: ["update:modelValue", "positionChange"],
|
|
468
|
+
setup(props, {
|
|
469
|
+
slots,
|
|
470
|
+
attrs,
|
|
471
|
+
emit,
|
|
472
|
+
expose
|
|
473
|
+
}) {
|
|
474
|
+
const ns = useNamespace("flexible-overlay");
|
|
475
|
+
const {
|
|
476
|
+
arrowRef,
|
|
477
|
+
overlayRef,
|
|
478
|
+
updatePosition
|
|
479
|
+
} = useOverlay(props, emit);
|
|
480
|
+
expose({
|
|
481
|
+
updatePosition
|
|
482
|
+
});
|
|
483
|
+
return () => {
|
|
484
|
+
var _a;
|
|
485
|
+
return props.modelValue && createVNode("div", mergeProps({
|
|
486
|
+
"ref": overlayRef,
|
|
487
|
+
"class": ns.b()
|
|
488
|
+
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
489
|
+
"ref": arrowRef,
|
|
490
|
+
"class": ns.e("arrow")
|
|
491
|
+
}, null)]);
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
const inBrowser = typeof window !== "undefined";
|
|
496
|
+
function useModal(props, emit) {
|
|
497
|
+
function close() {
|
|
498
|
+
emit("update:modelValue", false);
|
|
499
|
+
}
|
|
500
|
+
function execClose() {
|
|
501
|
+
props.beforeClose ? props.beforeClose(close) : close();
|
|
502
|
+
}
|
|
503
|
+
function onOverlayClick() {
|
|
504
|
+
props.closeOnClickOverlay && execClose();
|
|
505
|
+
}
|
|
506
|
+
function onCloseBtnClick() {
|
|
507
|
+
execClose();
|
|
508
|
+
}
|
|
509
|
+
function onKeydown(event) {
|
|
510
|
+
if (event["keyCode"] === 27) {
|
|
511
|
+
execClose();
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
onMounted(() => {
|
|
515
|
+
if (props.escapable) {
|
|
516
|
+
window.addEventListener("keydown", onKeydown);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
onUnmounted(() => {
|
|
520
|
+
if (props.escapable) {
|
|
521
|
+
window.addEventListener("keydown", onKeydown);
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
return { onCloseBtnClick, onOverlayClick };
|
|
525
|
+
}
|
|
526
|
+
function useModalRender(props) {
|
|
527
|
+
const showContainer = ref(false);
|
|
528
|
+
const showModal = ref(false);
|
|
529
|
+
let lockScrollCb;
|
|
530
|
+
const removeBodyAdditions = () => {
|
|
531
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
532
|
+
};
|
|
533
|
+
watch(() => props.modelValue, (val) => {
|
|
534
|
+
if (val) {
|
|
535
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
536
|
+
showContainer.value = true;
|
|
537
|
+
nextTick(() => {
|
|
538
|
+
showModal.value = true;
|
|
539
|
+
});
|
|
540
|
+
} else {
|
|
541
|
+
removeBodyAdditions();
|
|
542
|
+
showModal.value = false;
|
|
543
|
+
setTimeout(() => {
|
|
544
|
+
showContainer.value = false;
|
|
545
|
+
}, 100);
|
|
546
|
+
}
|
|
547
|
+
}, {
|
|
548
|
+
immediate: true
|
|
549
|
+
});
|
|
550
|
+
onUnmounted(removeBodyAdditions);
|
|
551
|
+
return { showContainer, showModal };
|
|
552
|
+
}
|
|
553
|
+
var Header = defineComponent({
|
|
554
|
+
name: "DModalHeader",
|
|
555
|
+
setup(props, {
|
|
556
|
+
slots
|
|
557
|
+
}) {
|
|
558
|
+
const ns = useNamespace("modal");
|
|
559
|
+
return () => {
|
|
560
|
+
var _a;
|
|
561
|
+
return createVNode("div", {
|
|
562
|
+
"class": ns.e("header")
|
|
563
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
var Body = defineComponent({
|
|
568
|
+
name: "DModalBody",
|
|
569
|
+
setup(props, {
|
|
570
|
+
slots
|
|
571
|
+
}) {
|
|
572
|
+
const ns = useNamespace("modal");
|
|
573
|
+
return () => {
|
|
574
|
+
var _a;
|
|
575
|
+
return createVNode("div", {
|
|
576
|
+
"class": ns.e("body")
|
|
577
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
var modal = "";
|
|
582
|
+
var Modal = defineComponent({
|
|
583
|
+
name: "DModal",
|
|
584
|
+
inheritAttrs: false,
|
|
585
|
+
props: modalProps,
|
|
586
|
+
emits: ["update:modelValue"],
|
|
587
|
+
setup(props, {
|
|
588
|
+
slots,
|
|
589
|
+
attrs,
|
|
590
|
+
emit
|
|
591
|
+
}) {
|
|
592
|
+
const ns = useNamespace("modal");
|
|
593
|
+
const {
|
|
594
|
+
modelValue,
|
|
595
|
+
title,
|
|
596
|
+
showClose,
|
|
597
|
+
showOverlay,
|
|
598
|
+
appendToBody
|
|
599
|
+
} = toRefs(props);
|
|
600
|
+
const {
|
|
601
|
+
onCloseBtnClick,
|
|
602
|
+
onOverlayClick
|
|
603
|
+
} = useModal(props, emit);
|
|
604
|
+
const {
|
|
605
|
+
showContainer,
|
|
606
|
+
showModal
|
|
607
|
+
} = useModalRender(props);
|
|
608
|
+
return () => createVNode(Teleport, {
|
|
609
|
+
"to": "body",
|
|
610
|
+
"disabled": !appendToBody.value
|
|
611
|
+
}, {
|
|
612
|
+
default: () => [showOverlay.value && createVNode(FixedOverlay, {
|
|
613
|
+
"modelValue": modelValue.value,
|
|
614
|
+
"onUpdate:modelValue": ($event) => modelValue.value = $event,
|
|
615
|
+
"lock-scroll": false,
|
|
616
|
+
"style": {
|
|
617
|
+
zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
|
|
618
|
+
}
|
|
619
|
+
}, null), showContainer.value && createVNode("div", {
|
|
620
|
+
"class": ns.e("container"),
|
|
621
|
+
"onClick": onOverlayClick
|
|
622
|
+
}, [createVNode(Transition, {
|
|
623
|
+
"name": ns.m("wipe")
|
|
624
|
+
}, {
|
|
625
|
+
default: () => {
|
|
626
|
+
var _a;
|
|
627
|
+
return [showModal.value && createVNode("div", mergeProps({
|
|
628
|
+
"class": ns.b()
|
|
629
|
+
}, attrs), [showClose.value && createVNode(Icon, {
|
|
630
|
+
"name": "close",
|
|
631
|
+
"class": "btn-close",
|
|
632
|
+
"size": "var(--devui-font-size-md,12px)",
|
|
633
|
+
"onClick": onCloseBtnClick
|
|
634
|
+
}, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
635
|
+
default: () => [title.value]
|
|
636
|
+
}), createVNode(Body, null, {
|
|
637
|
+
default: () => {
|
|
638
|
+
var _a2;
|
|
639
|
+
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
|
|
640
|
+
}
|
|
641
|
+
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
642
|
+
}
|
|
643
|
+
})])]
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
var Footer = defineComponent({
|
|
648
|
+
name: "DModalFooter",
|
|
649
|
+
setup(props, {
|
|
650
|
+
slots
|
|
651
|
+
}) {
|
|
652
|
+
const ns = useNamespace("modal");
|
|
653
|
+
return () => {
|
|
654
|
+
var _a;
|
|
655
|
+
return createVNode("div", {
|
|
656
|
+
"class": ns.e("footer")
|
|
657
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
class CommonModalService {
|
|
662
|
+
constructor(anchorContainer) {
|
|
663
|
+
this.anchorContainer = anchorContainer;
|
|
664
|
+
}
|
|
665
|
+
renderModal(anchor, props, children) {
|
|
666
|
+
const vnode = h(this.component(), props, children);
|
|
667
|
+
render(vnode, anchor);
|
|
668
|
+
return vnode;
|
|
669
|
+
}
|
|
670
|
+
renderNull(anchor) {
|
|
671
|
+
setTimeout(() => {
|
|
672
|
+
render(null, anchor);
|
|
673
|
+
}, 500);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
let vm;
|
|
677
|
+
class ModalService extends CommonModalService {
|
|
678
|
+
component() {
|
|
679
|
+
return Modal;
|
|
680
|
+
}
|
|
681
|
+
open(props = {}) {
|
|
682
|
+
const anchor = document.createElement("div");
|
|
683
|
+
this.anchorContainer.appendChild(anchor);
|
|
684
|
+
const { header, content, footer, ...resProps } = props;
|
|
685
|
+
const renderOrigin = (propsValue, onUpdateModelValue) => {
|
|
686
|
+
return this.renderModal(anchor, {
|
|
687
|
+
...propsValue,
|
|
688
|
+
modelValue: true,
|
|
689
|
+
"onUpdate:modelValue": onUpdateModelValue
|
|
690
|
+
}, { header, default: content, footer });
|
|
691
|
+
};
|
|
692
|
+
const hide = () => {
|
|
693
|
+
var _a, _b, _c;
|
|
694
|
+
const innerNeedHideOrNot = (value) => {
|
|
695
|
+
if (!value) {
|
|
696
|
+
hide();
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
renderOrigin(resProps, (value) => {
|
|
700
|
+
if (!value) {
|
|
701
|
+
this.renderModal(anchor, { ...resProps, modelValue: false });
|
|
702
|
+
this.renderNull(anchor);
|
|
703
|
+
} else {
|
|
704
|
+
renderOrigin(resProps, innerNeedHideOrNot);
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
(_c = (_b = (_a = vm == null ? void 0 : vm.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
|
|
708
|
+
};
|
|
709
|
+
const needHideOrNot = (value) => {
|
|
710
|
+
if (!value) {
|
|
711
|
+
hide();
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
this.renderModal(anchor, { modelValue: false });
|
|
715
|
+
vm = renderOrigin(resProps, needHideOrNot);
|
|
716
|
+
return { hide };
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
ModalService.token = "MODAL_SERVICE_TOKEN";
|
|
720
|
+
var index = {
|
|
721
|
+
title: "Modal \u5F39\u7A97",
|
|
722
|
+
category: "\u53CD\u9988",
|
|
723
|
+
status: "100%",
|
|
724
|
+
install(app) {
|
|
725
|
+
app.component(Modal.name, Modal);
|
|
726
|
+
app.component(Header.name, Header);
|
|
727
|
+
app.component(Body.name, Body);
|
|
728
|
+
app.component(Footer.name, Footer);
|
|
729
|
+
if (!inBrowser) {
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
let anchorsContainer = document.getElementById("d-modal-anchors-container");
|
|
733
|
+
if (!anchorsContainer) {
|
|
734
|
+
anchorsContainer = document.createElement("div");
|
|
735
|
+
anchorsContainer.setAttribute("id", "d-modal-anchors-container");
|
|
736
|
+
document.body.appendChild(anchorsContainer);
|
|
737
|
+
}
|
|
738
|
+
app.provide(ModalService.token, new ModalService(anchorsContainer));
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
export { Modal, index as default, modalProps };
|