vue-devui 1.0.0-pre.0 → 1.0.0-rc.10
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 +149 -187
- package/alert/index.es.js +74 -45
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8182 -296
- package/auto-complete/index.umd.js +29 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +153 -146
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +30 -5
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5741 -127
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +59 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8060 -255
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{accordion → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +379 -0
- package/collapse/index.umd.js +1 -0
- package/{anchor → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +5 -7
- package/countdown/index.umd.js +1 -1
- package/date-picker/index.es.js +8159 -288
- package/date-picker/index.umd.js +27 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +31 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +297 -181
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +525 -154
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +1039 -1175
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +42 -21
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +101 -86
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +197 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +55 -31
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8066 -144
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +269 -183
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +40 -25
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +74 -35
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +412 -204
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +307 -57
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/Option.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/RadioButton.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.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/editableSelectProps.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/modalProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.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/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.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/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.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/treeProps.js +3 -0
- package/overlay/index.es.js +127 -149
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +10 -44
- package/pagination/index.es.js +158 -148
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +317 -246
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +110 -56
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7964 -157
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +77 -55
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +184 -57
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +47 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +3644 -1122
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9144 -597
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +63 -41
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +109 -75
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +469 -349
- package/splitter/index.umd.js +15 -15
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +7 -18
- package/statistic/index.umd.js +1 -1
- package/status/index.es.js +27 -6
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +7794 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10119 -1206
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +342 -141
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +49 -24
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7913 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/{anchor → timeline}/index.d.ts +0 -0
- package/timeline/index.es.js +425 -0
- package/timeline/index.umd.js +1 -0
- package/{back-top → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +308 -236
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +4189 -1851
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +380 -123
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +18121 -23161
- package/vue-devui.umd.js +25 -15
- package/accordion/index.es.js +0 -720
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- 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/back-top/index.d.ts +0 -7
- package/back-top/index.es.js +0 -128
- package/back-top/index.umd.js +0 -1
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/package.json +0 -7
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -329
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5963
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.es.js +0 -8187
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -86
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -331
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/TagInput.js +0 -3
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -258
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -239
- 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.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/tag-input/index.d.ts +0 -7
- package/tag-input/index.es.js +0 -329
- 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.d.ts +0 -7
- package/time-axis/index.es.js +0 -299
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1237
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7608
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -623
- 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,8 +33,8 @@ var __publicField = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
-
import { defineComponent,
|
|
37
|
-
import { offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
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";
|
|
38
38
|
const modalProps = {
|
|
39
39
|
modelValue: {
|
|
40
40
|
type: Boolean,
|
|
@@ -54,109 +54,310 @@ const modalProps = {
|
|
|
54
54
|
},
|
|
55
55
|
beforeClose: {
|
|
56
56
|
type: Function
|
|
57
|
+
},
|
|
58
|
+
escapable: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
showClose: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
showOverlay: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
70
|
+
appendToBody: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
57
73
|
}
|
|
58
74
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
size: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: "inherit"
|
|
69
|
-
},
|
|
70
|
-
color: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: "inherit"
|
|
73
|
-
},
|
|
74
|
-
classPrefix: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: "icon"
|
|
77
|
-
}
|
|
75
|
+
const DEFAULT_PREFIX = "icon";
|
|
76
|
+
const iconProps = {
|
|
77
|
+
name: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "",
|
|
80
|
+
required: true
|
|
78
81
|
},
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
size: {
|
|
83
|
+
type: [Number, String],
|
|
84
|
+
default: "inherit"
|
|
85
|
+
},
|
|
86
|
+
color: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "inherit"
|
|
89
|
+
},
|
|
90
|
+
component: {
|
|
91
|
+
type: Object,
|
|
92
|
+
default: null
|
|
93
|
+
},
|
|
94
|
+
classPrefix: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: DEFAULT_PREFIX
|
|
97
|
+
},
|
|
98
|
+
operable: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false
|
|
101
|
+
},
|
|
102
|
+
disabled: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false
|
|
105
|
+
},
|
|
106
|
+
rotate: {
|
|
107
|
+
type: [Number, String]
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const svgIconProps = {
|
|
111
|
+
name: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: "",
|
|
114
|
+
required: true
|
|
81
115
|
},
|
|
82
|
-
|
|
116
|
+
color: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: "inherit"
|
|
119
|
+
},
|
|
120
|
+
size: {
|
|
121
|
+
type: [Number, String],
|
|
122
|
+
default: "inherit"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
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) : "";
|
|
141
|
+
return {
|
|
142
|
+
b,
|
|
143
|
+
e,
|
|
144
|
+
m,
|
|
145
|
+
em
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
var icon = "";
|
|
149
|
+
var svgIcon = defineComponent({
|
|
150
|
+
name: "DSvgIcon",
|
|
151
|
+
props: svgIconProps,
|
|
152
|
+
setup(props) {
|
|
83
153
|
const {
|
|
84
154
|
name,
|
|
85
|
-
size,
|
|
86
155
|
color,
|
|
87
|
-
|
|
88
|
-
} =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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;
|
|
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
|
+
};
|
|
176
|
+
}
|
|
177
|
+
});
|
|
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")],
|
|
92
200
|
"style": {
|
|
93
|
-
width:
|
|
94
|
-
|
|
201
|
+
width: iconSize.value || "",
|
|
202
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
95
203
|
}
|
|
96
|
-
},
|
|
97
|
-
|
|
204
|
+
}, ctx.attrs), null);
|
|
205
|
+
};
|
|
206
|
+
const svgIconDom = () => {
|
|
207
|
+
return createVNode(IconComponent, mergeProps({
|
|
208
|
+
"name": name.value,
|
|
209
|
+
"color": color.value,
|
|
210
|
+
"size": iconSize.value,
|
|
211
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
98
212
|
"style": {
|
|
99
|
-
|
|
100
|
-
color
|
|
213
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
101
214
|
}
|
|
102
|
-
}, null);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
215
|
+
}, ctx.attrs), null);
|
|
216
|
+
};
|
|
217
|
+
const fontIconDom = () => {
|
|
218
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
219
|
+
return createVNode("i", mergeProps({
|
|
220
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
221
|
+
"style": {
|
|
222
|
+
fontSize: iconSize.value,
|
|
223
|
+
color: color.value,
|
|
224
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
225
|
+
}
|
|
226
|
+
}, ctx.attrs), null);
|
|
227
|
+
};
|
|
228
|
+
const iconDom = () => {
|
|
229
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
230
|
+
};
|
|
231
|
+
return {
|
|
232
|
+
iconDom
|
|
233
|
+
};
|
|
111
234
|
}
|
|
112
|
-
|
|
235
|
+
var Icon = defineComponent({
|
|
236
|
+
name: "DIcon",
|
|
237
|
+
props: iconProps,
|
|
113
238
|
setup(props, ctx) {
|
|
239
|
+
const {
|
|
240
|
+
disabled,
|
|
241
|
+
operable
|
|
242
|
+
} = toRefs(props);
|
|
243
|
+
const {
|
|
244
|
+
iconDom
|
|
245
|
+
} = useIconDom(props, ctx);
|
|
246
|
+
const ns = useNamespace("icon");
|
|
247
|
+
const wrapClassed = computed(() => ({
|
|
248
|
+
[ns.e("container")]: true,
|
|
249
|
+
[ns.m("disabled")]: disabled.value,
|
|
250
|
+
[ns.m("operable")]: operable.value
|
|
251
|
+
}));
|
|
252
|
+
const onClick = (e) => {
|
|
253
|
+
if (disabled.value) {
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
e.stopImmediatePropagation();
|
|
256
|
+
}
|
|
257
|
+
};
|
|
114
258
|
return () => {
|
|
115
|
-
|
|
116
|
-
return createVNode(
|
|
117
|
-
"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"name": "devui-overlay-fade"
|
|
121
|
-
}, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
|
|
122
|
-
default: () => [_slot]
|
|
123
|
-
})]
|
|
124
|
-
});
|
|
259
|
+
var _a, _b, _c, _d;
|
|
260
|
+
return createVNode("div", {
|
|
261
|
+
"class": wrapClassed.value,
|
|
262
|
+
"onClick": onClick
|
|
263
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
125
264
|
};
|
|
126
265
|
}
|
|
127
266
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
267
|
+
var iconGroup = "";
|
|
268
|
+
defineComponent({
|
|
269
|
+
name: "DIconGroup",
|
|
270
|
+
setup(_, ctx) {
|
|
271
|
+
const ns = useNamespace("icon-group");
|
|
272
|
+
return () => {
|
|
273
|
+
var _a, _b;
|
|
274
|
+
return createVNode("div", {
|
|
275
|
+
"class": ns.b()
|
|
276
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
const fixedOverlayProps = {
|
|
281
|
+
modelValue: {
|
|
133
282
|
type: Boolean,
|
|
134
283
|
default: false
|
|
135
284
|
},
|
|
136
|
-
|
|
137
|
-
type: String,
|
|
138
|
-
default: ""
|
|
139
|
-
},
|
|
140
|
-
backgroundStyle: {
|
|
141
|
-
type: [String, Object]
|
|
142
|
-
},
|
|
143
|
-
onBackdropClick: {
|
|
144
|
-
type: Function
|
|
145
|
-
},
|
|
146
|
-
backdropClose: {
|
|
285
|
+
lockScroll: {
|
|
147
286
|
type: Boolean,
|
|
148
287
|
default: true
|
|
149
288
|
},
|
|
150
|
-
|
|
289
|
+
closeOnClickOverlay: {
|
|
151
290
|
type: Boolean,
|
|
152
291
|
default: true
|
|
153
292
|
}
|
|
154
293
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
294
|
+
function lockScroll() {
|
|
295
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
296
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
297
|
+
const style = document.documentElement.getAttribute("style");
|
|
298
|
+
document.documentElement.style.position = "fixed";
|
|
299
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
300
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
301
|
+
document.documentElement.style.overflowY = "scroll";
|
|
302
|
+
return () => {
|
|
303
|
+
if (style) {
|
|
304
|
+
document.documentElement.setAttribute("style", style);
|
|
305
|
+
} else {
|
|
306
|
+
document.documentElement.removeAttribute("style");
|
|
307
|
+
}
|
|
308
|
+
document.documentElement.scrollTop = scrollTop;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
function useFixedOverlay(props, ctx) {
|
|
314
|
+
let lockScrollCb;
|
|
315
|
+
const onClick = (event) => {
|
|
316
|
+
event.preventDefault();
|
|
317
|
+
ctx.emit("click", event);
|
|
318
|
+
if (props.closeOnClickOverlay) {
|
|
319
|
+
ctx.emit("update:modelValue", false);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const removeBodyAdditions = () => {
|
|
323
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
324
|
+
};
|
|
325
|
+
watch(() => props.modelValue, (val) => {
|
|
326
|
+
if (val) {
|
|
327
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
328
|
+
} else {
|
|
329
|
+
removeBodyAdditions();
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
onUnmounted(removeBodyAdditions);
|
|
333
|
+
return { onClick };
|
|
334
|
+
}
|
|
335
|
+
var fixedOverlay = "";
|
|
336
|
+
const FixedOverlay = defineComponent({
|
|
337
|
+
name: "DFixedOverlay",
|
|
338
|
+
inheritAttrs: false,
|
|
339
|
+
props: fixedOverlayProps,
|
|
340
|
+
emits: ["update:modelValue", "click"],
|
|
341
|
+
setup(props, ctx) {
|
|
342
|
+
const {
|
|
343
|
+
modelValue
|
|
344
|
+
} = toRefs(props);
|
|
345
|
+
const ns = useNamespace("fixed-overlay");
|
|
346
|
+
const {
|
|
347
|
+
onClick
|
|
348
|
+
} = useFixedOverlay(props, ctx);
|
|
349
|
+
return () => createVNode(Transition, {
|
|
350
|
+
"name": ns.m("fade")
|
|
351
|
+
}, {
|
|
352
|
+
default: () => {
|
|
353
|
+
var _a, _b;
|
|
354
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
355
|
+
"class": ns.b()
|
|
356
|
+
}, ctx.attrs, {
|
|
357
|
+
"onClick": onClick
|
|
358
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
359
|
+
}
|
|
360
|
+
});
|
|
160
361
|
}
|
|
161
362
|
});
|
|
162
363
|
const flexibleOverlayProps = {
|
|
@@ -176,6 +377,9 @@ const flexibleOverlayProps = {
|
|
|
176
377
|
type: [Number, Object],
|
|
177
378
|
default: 8
|
|
178
379
|
},
|
|
380
|
+
shiftOffset: {
|
|
381
|
+
type: Number
|
|
382
|
+
},
|
|
179
383
|
align: {
|
|
180
384
|
type: String,
|
|
181
385
|
default: null
|
|
@@ -189,80 +393,6 @@ const flexibleOverlayProps = {
|
|
|
189
393
|
default: true
|
|
190
394
|
}
|
|
191
395
|
};
|
|
192
|
-
function useOverlayLogic(props, ctx) {
|
|
193
|
-
const backgroundClass = computed(() => {
|
|
194
|
-
return [
|
|
195
|
-
"devui-overlay-background",
|
|
196
|
-
props.backgroundClass,
|
|
197
|
-
!props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
|
|
198
|
-
];
|
|
199
|
-
});
|
|
200
|
-
const overlayClass = computed(() => {
|
|
201
|
-
return "devui-overlay";
|
|
202
|
-
});
|
|
203
|
-
const handleBackdropClick = (event) => {
|
|
204
|
-
var _a;
|
|
205
|
-
event.preventDefault();
|
|
206
|
-
(_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
|
|
207
|
-
if (props.backdropClose) {
|
|
208
|
-
ctx.emit("update:visible", false);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
|
|
212
|
-
onMounted(() => {
|
|
213
|
-
const body = document.body;
|
|
214
|
-
const originOverflow = body.style.overflow;
|
|
215
|
-
const originPosition = body.style.position;
|
|
216
|
-
watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
|
|
217
|
-
if (backgroundBlock) {
|
|
218
|
-
const top = body.getBoundingClientRect().y;
|
|
219
|
-
if (visible) {
|
|
220
|
-
body.style.overflowY = "scroll";
|
|
221
|
-
body.style.position = visible ? "fixed" : "";
|
|
222
|
-
body.style.top = `${top}px`;
|
|
223
|
-
} else {
|
|
224
|
-
body.style.overflowY = originOverflow;
|
|
225
|
-
body.style.position = originPosition;
|
|
226
|
-
body.style.top = "";
|
|
227
|
-
window.scrollTo(0, -top);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
onUnmounted(() => {
|
|
232
|
-
document.body.style.overflow = originOverflow;
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
return {
|
|
236
|
-
backgroundClass,
|
|
237
|
-
overlayClass,
|
|
238
|
-
handleBackdropClick,
|
|
239
|
-
handleOverlayBubbleCancel
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
const FixedOverlay = defineComponent({
|
|
243
|
-
name: "DFixedOverlay",
|
|
244
|
-
props: fixedOverlayProps,
|
|
245
|
-
emits: overlayEmits,
|
|
246
|
-
setup(props, ctx) {
|
|
247
|
-
const {
|
|
248
|
-
backgroundClass,
|
|
249
|
-
overlayClass,
|
|
250
|
-
handleBackdropClick,
|
|
251
|
-
handleOverlayBubbleCancel
|
|
252
|
-
} = useOverlayLogic(props, ctx);
|
|
253
|
-
return () => createVNode(CommonOverlay, null, {
|
|
254
|
-
default: () => [props.visible && createVNode("div", {
|
|
255
|
-
"class": backgroundClass.value,
|
|
256
|
-
"style": props.backgroundStyle,
|
|
257
|
-
"onClick": handleBackdropClick
|
|
258
|
-
}, [createVNode("div", {
|
|
259
|
-
"class": overlayClass.value,
|
|
260
|
-
"style": props.overlayStyle,
|
|
261
|
-
"onClick": handleOverlayBubbleCancel
|
|
262
|
-
}, [renderSlot(ctx.slots, "default")])])]
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
396
|
function getScrollParent(element) {
|
|
267
397
|
const overflowRegex = /(auto|scroll|hidden)/;
|
|
268
398
|
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
@@ -295,6 +425,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
295
425
|
function useOverlay(props, emit) {
|
|
296
426
|
const overlayRef = ref();
|
|
297
427
|
const arrowRef = ref();
|
|
428
|
+
let originParent = null;
|
|
298
429
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
299
430
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
300
431
|
const staticSide = {
|
|
@@ -323,34 +454,43 @@ function useOverlay(props, emit) {
|
|
|
323
454
|
})
|
|
324
455
|
];
|
|
325
456
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
457
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
326
458
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
327
459
|
strategy: "fixed",
|
|
328
460
|
middleware
|
|
329
461
|
});
|
|
462
|
+
let applyX = x;
|
|
463
|
+
let applyY = y;
|
|
464
|
+
if (props.shiftOffset !== void 0) {
|
|
465
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
466
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
467
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
468
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
469
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
470
|
+
}
|
|
330
471
|
emit("positionChange", placement);
|
|
331
|
-
Object.assign(overlayEl.style, { top: `${
|
|
472
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
332
473
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
333
474
|
};
|
|
334
475
|
watch(() => props.modelValue, () => {
|
|
335
|
-
const originParent = getScrollParent(props.origin);
|
|
336
476
|
if (props.modelValue && props.origin) {
|
|
477
|
+
originParent = getScrollParent(props.origin);
|
|
337
478
|
nextTick(updatePosition);
|
|
338
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
479
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
339
480
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
340
481
|
window.addEventListener("resize", updatePosition);
|
|
341
482
|
} else {
|
|
342
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
483
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
343
484
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
344
485
|
window.removeEventListener("resize", updatePosition);
|
|
345
486
|
}
|
|
346
487
|
});
|
|
347
488
|
onUnmounted(() => {
|
|
348
|
-
|
|
349
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
489
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
350
490
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
351
491
|
window.removeEventListener("resize", updatePosition);
|
|
352
492
|
});
|
|
353
|
-
return { arrowRef, overlayRef };
|
|
493
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
354
494
|
}
|
|
355
495
|
var flexibleOverlay = "";
|
|
356
496
|
defineComponent({
|
|
@@ -361,20 +501,26 @@ defineComponent({
|
|
|
361
501
|
setup(props, {
|
|
362
502
|
slots,
|
|
363
503
|
attrs,
|
|
364
|
-
emit
|
|
504
|
+
emit,
|
|
505
|
+
expose
|
|
365
506
|
}) {
|
|
507
|
+
const ns = useNamespace("flexible-overlay");
|
|
366
508
|
const {
|
|
367
509
|
arrowRef,
|
|
368
|
-
overlayRef
|
|
510
|
+
overlayRef,
|
|
511
|
+
updatePosition
|
|
369
512
|
} = useOverlay(props, emit);
|
|
513
|
+
expose({
|
|
514
|
+
updatePosition
|
|
515
|
+
});
|
|
370
516
|
return () => {
|
|
371
517
|
var _a;
|
|
372
518
|
return props.modelValue && createVNode("div", mergeProps({
|
|
373
519
|
"ref": overlayRef,
|
|
374
|
-
"class":
|
|
520
|
+
"class": ns.b()
|
|
375
521
|
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
376
522
|
"ref": arrowRef,
|
|
377
|
-
"class": "
|
|
523
|
+
"class": ns.e("arrow")
|
|
378
524
|
}, null)]);
|
|
379
525
|
};
|
|
380
526
|
}
|
|
@@ -384,22 +530,67 @@ function useModal(props, emit) {
|
|
|
384
530
|
function close() {
|
|
385
531
|
emit("update:modelValue", false);
|
|
386
532
|
}
|
|
387
|
-
function
|
|
388
|
-
|
|
389
|
-
|
|
533
|
+
function execClose() {
|
|
534
|
+
props.beforeClose ? props.beforeClose(close) : close();
|
|
535
|
+
}
|
|
536
|
+
function onOverlayClick() {
|
|
537
|
+
props.closeOnClickOverlay && execClose();
|
|
538
|
+
}
|
|
539
|
+
function onCloseBtnClick() {
|
|
540
|
+
execClose();
|
|
541
|
+
}
|
|
542
|
+
function onKeydown(event) {
|
|
543
|
+
if (event["keyCode"] === 27) {
|
|
544
|
+
execClose();
|
|
390
545
|
}
|
|
391
546
|
}
|
|
392
|
-
|
|
547
|
+
onMounted(() => {
|
|
548
|
+
if (props.escapable) {
|
|
549
|
+
window.addEventListener("keydown", onKeydown);
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
onUnmounted(() => {
|
|
553
|
+
if (props.escapable) {
|
|
554
|
+
window.addEventListener("keydown", onKeydown);
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
return { onCloseBtnClick, onOverlayClick };
|
|
558
|
+
}
|
|
559
|
+
function useModalRender(props) {
|
|
560
|
+
const showContainer = ref(false);
|
|
561
|
+
const showModal = ref(false);
|
|
562
|
+
let lockScrollCb;
|
|
563
|
+
const removeBodyAdditions = () => {
|
|
564
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
565
|
+
};
|
|
566
|
+
watch(() => props.modelValue, (val) => {
|
|
567
|
+
if (val) {
|
|
568
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
569
|
+
showContainer.value = true;
|
|
570
|
+
nextTick(() => {
|
|
571
|
+
showModal.value = true;
|
|
572
|
+
});
|
|
573
|
+
} else {
|
|
574
|
+
removeBodyAdditions();
|
|
575
|
+
showModal.value = false;
|
|
576
|
+
setTimeout(() => {
|
|
577
|
+
showContainer.value = false;
|
|
578
|
+
}, 100);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
onUnmounted(removeBodyAdditions);
|
|
582
|
+
return { showContainer, showModal };
|
|
393
583
|
}
|
|
394
584
|
var Header = defineComponent({
|
|
395
585
|
name: "DModalHeader",
|
|
396
586
|
setup(props, {
|
|
397
587
|
slots
|
|
398
588
|
}) {
|
|
589
|
+
const ns = useNamespace("modal");
|
|
399
590
|
return () => {
|
|
400
591
|
var _a;
|
|
401
592
|
return createVNode("div", {
|
|
402
|
-
"class": "
|
|
593
|
+
"class": ns.e("header")
|
|
403
594
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
404
595
|
};
|
|
405
596
|
}
|
|
@@ -409,10 +600,11 @@ var Body = defineComponent({
|
|
|
409
600
|
setup(props, {
|
|
410
601
|
slots
|
|
411
602
|
}) {
|
|
603
|
+
const ns = useNamespace("modal");
|
|
412
604
|
return () => {
|
|
413
605
|
var _a;
|
|
414
606
|
return createVNode("div", {
|
|
415
|
-
"class": "
|
|
607
|
+
"class": ns.e("body")
|
|
416
608
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
417
609
|
};
|
|
418
610
|
}
|
|
@@ -426,40 +618,50 @@ var Modal = defineComponent({
|
|
|
426
618
|
setup(props, {
|
|
427
619
|
slots,
|
|
428
620
|
attrs,
|
|
429
|
-
emit
|
|
430
|
-
expose
|
|
621
|
+
emit
|
|
431
622
|
}) {
|
|
623
|
+
const ns = useNamespace("modal");
|
|
432
624
|
const {
|
|
433
625
|
modelValue,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
626
|
+
title,
|
|
627
|
+
showClose,
|
|
628
|
+
showOverlay,
|
|
629
|
+
appendToBody
|
|
437
630
|
} = toRefs(props);
|
|
438
631
|
const {
|
|
439
|
-
|
|
632
|
+
onCloseBtnClick,
|
|
633
|
+
onOverlayClick
|
|
440
634
|
} = useModal(props, emit);
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
"
|
|
447
|
-
"
|
|
448
|
-
"background-block": lockScroll.value,
|
|
449
|
-
"backdrop-close": closeOnClickOverlay.value
|
|
635
|
+
const {
|
|
636
|
+
showContainer,
|
|
637
|
+
showModal
|
|
638
|
+
} = useModalRender(props);
|
|
639
|
+
return () => createVNode(Teleport, {
|
|
640
|
+
"to": "body",
|
|
641
|
+
"disabled": !appendToBody.value
|
|
450
642
|
}, {
|
|
451
|
-
default: () => [createVNode(
|
|
452
|
-
"
|
|
643
|
+
default: () => [showOverlay.value && createVNode(FixedOverlay, {
|
|
644
|
+
"modelValue": modelValue.value,
|
|
645
|
+
"onUpdate:modelValue": ($event) => modelValue.value = $event,
|
|
646
|
+
"lock-scroll": false,
|
|
647
|
+
"style": {
|
|
648
|
+
zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
|
|
649
|
+
}
|
|
650
|
+
}, null), showContainer.value && createVNode("div", {
|
|
651
|
+
"class": ns.e("container"),
|
|
652
|
+
"onClick": onOverlayClick
|
|
653
|
+
}, [createVNode(Transition, {
|
|
654
|
+
"name": ns.m("wipe")
|
|
453
655
|
}, {
|
|
454
656
|
default: () => {
|
|
455
657
|
var _a;
|
|
456
|
-
return [createVNode("div", mergeProps({
|
|
457
|
-
"class":
|
|
458
|
-
}, attrs), [createVNode(Icon, {
|
|
658
|
+
return [showModal.value && createVNode("div", mergeProps({
|
|
659
|
+
"class": ns.b()
|
|
660
|
+
}, attrs), [showClose.value && createVNode(Icon, {
|
|
459
661
|
"name": "close",
|
|
460
662
|
"class": "btn-close",
|
|
461
663
|
"size": "var(--devui-font-size-md,12px)",
|
|
462
|
-
"onClick":
|
|
664
|
+
"onClick": onCloseBtnClick
|
|
463
665
|
}, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
464
666
|
default: () => [title.value]
|
|
465
667
|
}), createVNode(Body, null, {
|
|
@@ -469,7 +671,7 @@ var Modal = defineComponent({
|
|
|
469
671
|
}
|
|
470
672
|
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
471
673
|
}
|
|
472
|
-
})]
|
|
674
|
+
})])]
|
|
473
675
|
});
|
|
474
676
|
}
|
|
475
677
|
});
|
|
@@ -478,10 +680,11 @@ var Footer = defineComponent({
|
|
|
478
680
|
setup(props, {
|
|
479
681
|
slots
|
|
480
682
|
}) {
|
|
683
|
+
const ns = useNamespace("modal");
|
|
481
684
|
return () => {
|
|
482
685
|
var _a;
|
|
483
686
|
return createVNode("div", {
|
|
484
|
-
"class": "
|
|
687
|
+
"class": ns.e("footer")
|
|
485
688
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
486
689
|
};
|
|
487
690
|
}
|
|
@@ -510,31 +713,36 @@ class ModalService extends CommonModalService {
|
|
|
510
713
|
const anchor = document.createElement("div");
|
|
511
714
|
this.anchorContainer.appendChild(anchor);
|
|
512
715
|
const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
hide();
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
|
|
519
|
-
return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
|
|
716
|
+
const renderOrigin = (propsValue, onUpdateModelValue) => {
|
|
717
|
+
return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
|
|
520
718
|
modelValue: true,
|
|
521
719
|
"onUpdate:modelValue": onUpdateModelValue
|
|
522
720
|
}), { header, default: content, footer });
|
|
523
721
|
};
|
|
524
722
|
const hide = () => {
|
|
525
|
-
var _a2, _b;
|
|
723
|
+
var _a2, _b, _c;
|
|
724
|
+
const innerNeedHideOrNot = (value) => {
|
|
725
|
+
if (!value) {
|
|
726
|
+
hide();
|
|
727
|
+
}
|
|
728
|
+
};
|
|
526
729
|
renderOrigin(resProps, (value) => {
|
|
527
730
|
if (!value) {
|
|
528
731
|
this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
|
|
529
732
|
this.renderNull(anchor);
|
|
530
733
|
} else {
|
|
531
|
-
renderOrigin(resProps);
|
|
734
|
+
renderOrigin(resProps, innerNeedHideOrNot);
|
|
532
735
|
}
|
|
533
736
|
});
|
|
534
|
-
(_b = (_a2 = vm.component.exposed).handleVisibleChange) == null ? void 0 :
|
|
737
|
+
(_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);
|
|
738
|
+
};
|
|
739
|
+
const needHideOrNot = (value) => {
|
|
740
|
+
if (!value) {
|
|
741
|
+
hide();
|
|
742
|
+
}
|
|
535
743
|
};
|
|
536
744
|
this.renderModal(anchor, { modelValue: false });
|
|
537
|
-
vm = renderOrigin(resProps);
|
|
745
|
+
vm = renderOrigin(resProps, needHideOrNot);
|
|
538
746
|
return { hide };
|
|
539
747
|
}
|
|
540
748
|
}
|
|
@@ -560,4 +768,4 @@ var index = {
|
|
|
560
768
|
app.provide(ModalService.token, new ModalService(anchorsContainer));
|
|
561
769
|
}
|
|
562
770
|
};
|
|
563
|
-
export { Modal, index as default };
|
|
771
|
+
export { Modal, index as default, modalProps };
|