vue-devui 1.0.0-rc.8 → 1.0.1
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 +188 -149
- package/alert/index.es.js +14 -9
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8392 -418
- package/auto-complete/index.umd.js +29 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +59 -74
- package/avatar/index.umd.js +1 -1
- package/badge/index.es.js +10 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +191 -53
- package/button/index.umd.js +17 -17
- package/button/style.css +1 -1
- package/card/index.es.js +7 -3
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8050 -241
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{date-picker → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +213 -0
- package/collapse/index.umd.js +1 -0
- package/{date-picker → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +56 -13
- package/countdown/index.umd.js +1 -1
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12022 -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.es.js +24 -7
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +190 -165
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +785 -145
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +399 -300
- package/form/index.umd.js +16 -16
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +2 -2
- package/fullscreen/index.umd.js +1 -1
- package/grid/index.es.js +8 -6
- package/grid/index.umd.js +1 -1
- package/icon/index.es.js +185 -23
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +2 -2
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8220 -45
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +279 -204
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +3 -3
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +53 -53
- 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 +8319 -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 +921 -0
- package/menu/index.umd.js +1 -0
- package/menu/package.json +7 -0
- package/menu/style.css +1 -0
- package/message/index.d.ts +7 -0
- package/message/index.es.js +539 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.es.js +451 -173
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +212 -70
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.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/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/Option.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/RadioButton.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/TABLE_TOKEN.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.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/iconProps.js +1 -0
- package/nuxt/components/mentionProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/paginationInjectionKey.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/skeletonItemProps.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/tableProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/treeNodeProps.js +3 -0
- package/overlay/index.es.js +89 -142
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -4
- package/pagination/index.es.js +10180 -129
- package/pagination/index.umd.js +27 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +4 -0
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +262 -229
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +2 -2
- package/progress/index.umd.js +2 -2
- package/progress/style.css +1 -1
- package/radio/index.es.js +7954 -156
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +16 -8
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +170 -22
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3829 -1042
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9202 -495
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +89 -263
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +118 -145
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +454 -233
- package/splitter/index.umd.js +13 -13
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +34 -16
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +6 -2
- 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 +387 -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.es.js +7787 -62
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +5225 -1726
- package/table/index.umd.js +18 -18
- package/table/style.css +1 -1
- package/tabs/index.es.js +303 -102
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +11 -8
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7876 -41
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9549 -0
- package/time-picker/index.umd.js +27 -0
- package/time-picker/package.json +7 -0
- package/time-picker/style.css +1 -0
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9607 -0
- package/time-select/index.umd.js +27 -0
- package/time-select/package.json +7 -0
- package/time-select/style.css +1 -0
- package/timeline/index.es.js +170 -22
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +286 -238
- package/tooltip/index.umd.js +14 -14
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11342 -793
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +458 -102
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +20475 -11072
- package/vue-devui.umd.js +31 -24
- package/date-picker/index.es.js +0 -1097
- package/date-picker/index.umd.js +0 -1
- package/date-picker/style.css +0 -1
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Loading.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/formControlProps.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
package/modal/index.es.js
CHANGED
|
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
-
import { defineComponent, toRefs, createVNode,
|
|
36
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, unref, nextTick, withModifiers, onMounted, watchEffect, onBeforeUnmount, Teleport, h, render } from "vue";
|
|
37
37
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
38
38
|
const modalProps = {
|
|
39
39
|
modelValue: {
|
|
@@ -48,14 +48,43 @@ const modalProps = {
|
|
|
48
48
|
type: Boolean,
|
|
49
49
|
default: true
|
|
50
50
|
},
|
|
51
|
+
draggable: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
51
55
|
closeOnClickOverlay: {
|
|
52
56
|
type: Boolean,
|
|
53
57
|
default: true
|
|
54
58
|
},
|
|
55
59
|
beforeClose: {
|
|
56
60
|
type: Function
|
|
61
|
+
},
|
|
62
|
+
escapable: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
showClose: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
70
|
+
showAnimation: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
73
|
+
},
|
|
74
|
+
showOverlay: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true
|
|
77
|
+
},
|
|
78
|
+
appendToBody: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true
|
|
81
|
+
},
|
|
82
|
+
type: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: ""
|
|
57
85
|
}
|
|
58
86
|
};
|
|
87
|
+
const DEFAULT_PREFIX = "icon";
|
|
59
88
|
const iconProps = {
|
|
60
89
|
name: {
|
|
61
90
|
type: String,
|
|
@@ -63,46 +92,48 @@ const iconProps = {
|
|
|
63
92
|
required: true
|
|
64
93
|
},
|
|
65
94
|
size: {
|
|
66
|
-
type: String,
|
|
95
|
+
type: [Number, String],
|
|
67
96
|
default: "inherit"
|
|
68
97
|
},
|
|
69
98
|
color: {
|
|
70
99
|
type: String,
|
|
71
100
|
default: "inherit"
|
|
72
101
|
},
|
|
102
|
+
component: {
|
|
103
|
+
type: Object,
|
|
104
|
+
default: null
|
|
105
|
+
},
|
|
73
106
|
classPrefix: {
|
|
74
107
|
type: String,
|
|
75
|
-
default:
|
|
108
|
+
default: DEFAULT_PREFIX
|
|
109
|
+
},
|
|
110
|
+
operable: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false
|
|
113
|
+
},
|
|
114
|
+
disabled: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false
|
|
117
|
+
},
|
|
118
|
+
rotate: {
|
|
119
|
+
type: [Number, String]
|
|
76
120
|
}
|
|
77
121
|
};
|
|
78
|
-
|
|
79
|
-
name:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
92
|
-
"style": {
|
|
93
|
-
width: size.value,
|
|
94
|
-
verticalAlign: "text-bottom"
|
|
95
|
-
}
|
|
96
|
-
}, null) : createVNode("i", {
|
|
97
|
-
"class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
|
|
98
|
-
"style": {
|
|
99
|
-
fontSize: size.value,
|
|
100
|
-
color: color.value
|
|
101
|
-
}
|
|
102
|
-
}, null);
|
|
103
|
-
};
|
|
122
|
+
const svgIconProps = {
|
|
123
|
+
name: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "",
|
|
126
|
+
required: true
|
|
127
|
+
},
|
|
128
|
+
color: {
|
|
129
|
+
type: String,
|
|
130
|
+
default: "inherit"
|
|
131
|
+
},
|
|
132
|
+
size: {
|
|
133
|
+
type: [Number, String],
|
|
134
|
+
default: "inherit"
|
|
104
135
|
}
|
|
105
|
-
}
|
|
136
|
+
};
|
|
106
137
|
function createBem(namespace, element, modifier) {
|
|
107
138
|
let cls = namespace;
|
|
108
139
|
if (element) {
|
|
@@ -113,8 +144,8 @@ function createBem(namespace, element, modifier) {
|
|
|
113
144
|
}
|
|
114
145
|
return cls;
|
|
115
146
|
}
|
|
116
|
-
function useNamespace(block) {
|
|
117
|
-
const namespace = `devui-${block}`;
|
|
147
|
+
function useNamespace(block, needDot = false) {
|
|
148
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
118
149
|
const b = () => createBem(namespace);
|
|
119
150
|
const e = (element) => element ? createBem(namespace, element) : "";
|
|
120
151
|
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
@@ -126,130 +157,221 @@ function useNamespace(block) {
|
|
|
126
157
|
em
|
|
127
158
|
};
|
|
128
159
|
}
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
160
|
+
var icon = "";
|
|
161
|
+
var svgIcon = defineComponent({
|
|
162
|
+
name: "DSvgIcon",
|
|
163
|
+
props: svgIconProps,
|
|
164
|
+
setup(props) {
|
|
165
|
+
const {
|
|
166
|
+
name,
|
|
167
|
+
color,
|
|
168
|
+
size
|
|
169
|
+
} = toRefs(props);
|
|
170
|
+
const ns = useNamespace("svg-icon");
|
|
171
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
172
|
+
const iconSize = computed(() => {
|
|
173
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
174
|
+
});
|
|
175
|
+
const styles = {
|
|
176
|
+
width: iconSize.value,
|
|
177
|
+
height: iconSize.value
|
|
178
|
+
};
|
|
179
|
+
return () => {
|
|
180
|
+
return createVNode("svg", {
|
|
181
|
+
"class": ns.b(),
|
|
182
|
+
"style": styles
|
|
183
|
+
}, [createVNode("use", {
|
|
184
|
+
"xlink:href": iconName.value,
|
|
185
|
+
"fill": color.value
|
|
186
|
+
}, null)]);
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
function isUrl(value) {
|
|
191
|
+
return /^((http|https):)?\/\//.test(value);
|
|
192
|
+
}
|
|
193
|
+
function useIconDom(props, ctx) {
|
|
194
|
+
const {
|
|
195
|
+
component,
|
|
196
|
+
name,
|
|
197
|
+
size,
|
|
198
|
+
color,
|
|
199
|
+
classPrefix,
|
|
200
|
+
rotate
|
|
201
|
+
} = toRefs(props);
|
|
202
|
+
const ns = useNamespace("icon");
|
|
203
|
+
const iconSize = computed(() => {
|
|
204
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
205
|
+
});
|
|
206
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
207
|
+
const imgIconDom = () => {
|
|
208
|
+
return createVNode("img", mergeProps({
|
|
209
|
+
"src": name.value,
|
|
210
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
211
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
212
|
+
"style": {
|
|
213
|
+
width: iconSize.value || "",
|
|
214
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
|
|
215
|
+
verticalAlign: "middle"
|
|
216
|
+
}
|
|
217
|
+
}, ctx.attrs), null);
|
|
218
|
+
};
|
|
219
|
+
const svgIconDom = () => {
|
|
220
|
+
return createVNode(IconComponent, mergeProps({
|
|
221
|
+
"name": name.value,
|
|
222
|
+
"color": color.value,
|
|
223
|
+
"size": iconSize.value,
|
|
224
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
225
|
+
"style": {
|
|
226
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
227
|
+
}
|
|
228
|
+
}, ctx.attrs), null);
|
|
229
|
+
};
|
|
230
|
+
const fontIconDom = () => {
|
|
231
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
232
|
+
return createVNode("i", mergeProps({
|
|
233
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
234
|
+
"style": {
|
|
235
|
+
fontSize: iconSize.value,
|
|
236
|
+
color: color.value,
|
|
237
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
238
|
+
}
|
|
239
|
+
}, ctx.attrs), null);
|
|
240
|
+
};
|
|
241
|
+
const iconDom = () => {
|
|
242
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
iconDom
|
|
246
|
+
};
|
|
132
247
|
}
|
|
133
|
-
|
|
248
|
+
var Icon = defineComponent({
|
|
249
|
+
name: "DIcon",
|
|
250
|
+
props: iconProps,
|
|
251
|
+
emits: ["click"],
|
|
134
252
|
setup(props, ctx) {
|
|
135
|
-
const
|
|
253
|
+
const {
|
|
254
|
+
disabled,
|
|
255
|
+
operable
|
|
256
|
+
} = toRefs(props);
|
|
257
|
+
const {
|
|
258
|
+
iconDom
|
|
259
|
+
} = useIconDom(props, ctx);
|
|
260
|
+
const ns = useNamespace("icon");
|
|
261
|
+
const wrapClassed = computed(() => ({
|
|
262
|
+
[ns.e("container")]: true,
|
|
263
|
+
[ns.m("disabled")]: disabled.value,
|
|
264
|
+
[ns.m("operable")]: operable.value,
|
|
265
|
+
[ns.m("no-slots")]: !Object.keys(ctx.slots).length
|
|
266
|
+
}));
|
|
267
|
+
const onClick = (e) => {
|
|
268
|
+
if (disabled.value) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
ctx.emit("click", e);
|
|
272
|
+
};
|
|
136
273
|
return () => {
|
|
137
|
-
|
|
138
|
-
return createVNode(
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"name": ns.e("fade")
|
|
143
|
-
}, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
|
|
144
|
-
default: () => [_slot]
|
|
145
|
-
})]
|
|
146
|
-
});
|
|
274
|
+
var _a, _b, _c, _d;
|
|
275
|
+
return createVNode("div", {
|
|
276
|
+
"class": wrapClassed.value,
|
|
277
|
+
"onClick": onClick
|
|
278
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
147
279
|
};
|
|
148
280
|
}
|
|
149
281
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
282
|
+
var iconGroup = "";
|
|
283
|
+
defineComponent({
|
|
284
|
+
name: "DIconGroup",
|
|
285
|
+
setup(_, ctx) {
|
|
286
|
+
const ns = useNamespace("icon-group");
|
|
287
|
+
return () => {
|
|
288
|
+
var _a, _b;
|
|
289
|
+
return createVNode("div", {
|
|
290
|
+
"class": ns.b()
|
|
291
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
const fixedOverlayProps = {
|
|
296
|
+
modelValue: {
|
|
155
297
|
type: Boolean,
|
|
156
298
|
default: false
|
|
157
299
|
},
|
|
158
|
-
|
|
159
|
-
type: String,
|
|
160
|
-
default: ""
|
|
161
|
-
},
|
|
162
|
-
backgroundStyle: {
|
|
163
|
-
type: [String, Object]
|
|
164
|
-
},
|
|
165
|
-
onBackdropClick: {
|
|
166
|
-
type: Function
|
|
167
|
-
},
|
|
168
|
-
backdropClose: {
|
|
300
|
+
lockScroll: {
|
|
169
301
|
type: Boolean,
|
|
170
302
|
default: true
|
|
171
303
|
},
|
|
172
|
-
|
|
304
|
+
closeOnClickOverlay: {
|
|
173
305
|
type: Boolean,
|
|
174
306
|
default: true
|
|
175
307
|
}
|
|
176
308
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
309
|
+
function lockScroll() {
|
|
310
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
311
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
312
|
+
const style = document.documentElement.getAttribute("style");
|
|
313
|
+
document.documentElement.style.position = "fixed";
|
|
314
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
315
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
316
|
+
document.documentElement.style.overflowY = "scroll";
|
|
317
|
+
return () => {
|
|
318
|
+
if (style) {
|
|
319
|
+
document.documentElement.setAttribute("style", style);
|
|
320
|
+
} else {
|
|
321
|
+
document.documentElement.removeAttribute("style");
|
|
322
|
+
}
|
|
323
|
+
document.documentElement.scrollTop = scrollTop;
|
|
324
|
+
};
|
|
181
325
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
function
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
return [ns.e("background"), props.backgroundClass, !props.hasBackdrop ? ns.em("background", "disabled") : ns.em("background", "color")];
|
|
188
|
-
});
|
|
189
|
-
const overlayClass = computed(() => {
|
|
190
|
-
return ns.b();
|
|
191
|
-
});
|
|
192
|
-
const handleBackdropClick = (event) => {
|
|
193
|
-
var _a;
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
function useFixedOverlay(props, ctx) {
|
|
329
|
+
let lockScrollCb;
|
|
330
|
+
const onClick = (event) => {
|
|
194
331
|
event.preventDefault();
|
|
195
|
-
(
|
|
196
|
-
if (props.
|
|
197
|
-
ctx.emit("update:
|
|
332
|
+
ctx.emit("click", event);
|
|
333
|
+
if (props.closeOnClickOverlay) {
|
|
334
|
+
ctx.emit("update:modelValue", false);
|
|
198
335
|
}
|
|
199
336
|
};
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
const body = document.body;
|
|
203
|
-
const originOverflow = body.style.overflow;
|
|
204
|
-
const originPosition = body.style.position;
|
|
205
|
-
watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
|
|
206
|
-
if (backgroundBlock) {
|
|
207
|
-
const top = body.getBoundingClientRect().y;
|
|
208
|
-
if (visible) {
|
|
209
|
-
body.style.overflowY = "scroll";
|
|
210
|
-
body.style.position = visible ? "fixed" : "";
|
|
211
|
-
body.style.top = `${top}px`;
|
|
212
|
-
} else {
|
|
213
|
-
body.style.overflowY = originOverflow;
|
|
214
|
-
body.style.position = originPosition;
|
|
215
|
-
body.style.top = "";
|
|
216
|
-
window.scrollTo(0, -top);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
onUnmounted(() => {
|
|
221
|
-
document.body.style.overflow = originOverflow;
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
return {
|
|
225
|
-
backgroundClass,
|
|
226
|
-
overlayClass,
|
|
227
|
-
handleBackdropClick,
|
|
228
|
-
handleOverlayBubbleCancel
|
|
337
|
+
const removeBodyAdditions = () => {
|
|
338
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
229
339
|
};
|
|
340
|
+
watch(() => props.modelValue, (val) => {
|
|
341
|
+
if (val) {
|
|
342
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
343
|
+
} else {
|
|
344
|
+
removeBodyAdditions();
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
onUnmounted(removeBodyAdditions);
|
|
348
|
+
return { onClick };
|
|
230
349
|
}
|
|
231
350
|
var fixedOverlay = "";
|
|
232
351
|
const FixedOverlay = defineComponent({
|
|
233
352
|
name: "DFixedOverlay",
|
|
353
|
+
inheritAttrs: false,
|
|
234
354
|
props: fixedOverlayProps,
|
|
235
|
-
emits:
|
|
355
|
+
emits: ["update:modelValue", "click"],
|
|
236
356
|
setup(props, ctx) {
|
|
237
357
|
const {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
358
|
+
modelValue
|
|
359
|
+
} = toRefs(props);
|
|
360
|
+
const ns = useNamespace("fixed-overlay");
|
|
361
|
+
const {
|
|
362
|
+
onClick
|
|
363
|
+
} = useFixedOverlay(props, ctx);
|
|
364
|
+
return () => createVNode(Transition, {
|
|
365
|
+
"name": ns.m("fade")
|
|
366
|
+
}, {
|
|
367
|
+
default: () => {
|
|
368
|
+
var _a, _b;
|
|
369
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
370
|
+
"class": ns.b()
|
|
371
|
+
}, ctx.attrs, {
|
|
372
|
+
"onClick": onClick
|
|
373
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
374
|
+
}
|
|
253
375
|
});
|
|
254
376
|
}
|
|
255
377
|
});
|
|
@@ -284,6 +406,10 @@ const flexibleOverlayProps = {
|
|
|
284
406
|
isArrowCenter: {
|
|
285
407
|
type: Boolean,
|
|
286
408
|
default: true
|
|
409
|
+
},
|
|
410
|
+
clickEventBubble: {
|
|
411
|
+
type: Boolean,
|
|
412
|
+
default: false
|
|
287
413
|
}
|
|
288
414
|
};
|
|
289
415
|
function getScrollParent(element) {
|
|
@@ -398,6 +524,9 @@ defineComponent({
|
|
|
398
524
|
expose
|
|
399
525
|
}) {
|
|
400
526
|
const ns = useNamespace("flexible-overlay");
|
|
527
|
+
const {
|
|
528
|
+
clickEventBubble
|
|
529
|
+
} = toRefs(props);
|
|
401
530
|
const {
|
|
402
531
|
arrowRef,
|
|
403
532
|
overlayRef,
|
|
@@ -411,7 +540,10 @@ defineComponent({
|
|
|
411
540
|
return props.modelValue && createVNode("div", mergeProps({
|
|
412
541
|
"ref": overlayRef,
|
|
413
542
|
"class": ns.b()
|
|
414
|
-
}, attrs
|
|
543
|
+
}, attrs, {
|
|
544
|
+
"onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
|
|
545
|
+
"onPointerup": withModifiers(() => ({}), ["stop"])
|
|
546
|
+
}), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
415
547
|
"ref": arrowRef,
|
|
416
548
|
"class": ns.e("arrow")
|
|
417
549
|
}, null)]);
|
|
@@ -423,13 +555,113 @@ function useModal(props, emit) {
|
|
|
423
555
|
function close() {
|
|
424
556
|
emit("update:modelValue", false);
|
|
425
557
|
}
|
|
426
|
-
function
|
|
427
|
-
|
|
428
|
-
|
|
558
|
+
function execClose() {
|
|
559
|
+
props.beforeClose ? props.beforeClose(close) : close();
|
|
560
|
+
}
|
|
561
|
+
function onKeydown(event) {
|
|
562
|
+
if (event.code === "Escape") {
|
|
563
|
+
execClose();
|
|
429
564
|
}
|
|
430
565
|
}
|
|
431
|
-
|
|
566
|
+
onMounted(() => {
|
|
567
|
+
if (props.escapable) {
|
|
568
|
+
window.addEventListener("keydown", onKeydown);
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
onUnmounted(() => {
|
|
572
|
+
if (props.escapable) {
|
|
573
|
+
window.addEventListener("keydown", onKeydown);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
return { execClose };
|
|
432
577
|
}
|
|
578
|
+
function useModalRender(props) {
|
|
579
|
+
let lockScrollCb;
|
|
580
|
+
const removeBodyAdditions = () => {
|
|
581
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
582
|
+
};
|
|
583
|
+
watch(() => props.modelValue, (val) => {
|
|
584
|
+
if (val) {
|
|
585
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
586
|
+
} else {
|
|
587
|
+
removeBodyAdditions();
|
|
588
|
+
}
|
|
589
|
+
}, {
|
|
590
|
+
immediate: true
|
|
591
|
+
});
|
|
592
|
+
onUnmounted(removeBodyAdditions);
|
|
593
|
+
}
|
|
594
|
+
function addUnit(value, defaultUnit = "px") {
|
|
595
|
+
if (!value) {
|
|
596
|
+
return "";
|
|
597
|
+
}
|
|
598
|
+
if (typeof value === "string") {
|
|
599
|
+
return value;
|
|
600
|
+
} else if (typeof value === "number") {
|
|
601
|
+
return `${value}${defaultUnit}`;
|
|
602
|
+
} else {
|
|
603
|
+
return "";
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
const useDraggable = (targetRef, dragRef, draggable) => {
|
|
607
|
+
let transform = {
|
|
608
|
+
offsetX: 0,
|
|
609
|
+
offsetY: 0
|
|
610
|
+
};
|
|
611
|
+
const onMousedown = (e) => {
|
|
612
|
+
const downX = e.clientX;
|
|
613
|
+
const downY = e.clientY;
|
|
614
|
+
const { offsetX, offsetY } = transform;
|
|
615
|
+
const targetRect = targetRef.value.getBoundingClientRect();
|
|
616
|
+
const targetLeft = targetRect.left;
|
|
617
|
+
const targetTop = targetRect.top;
|
|
618
|
+
const targetWidth = targetRect.width;
|
|
619
|
+
const targetHeight = targetRect.height;
|
|
620
|
+
const clientWidth = document.documentElement.clientWidth;
|
|
621
|
+
const clientHeight = document.documentElement.clientHeight;
|
|
622
|
+
const minLeft = -targetLeft + offsetX;
|
|
623
|
+
const minTop = -targetTop + offsetY;
|
|
624
|
+
const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
|
|
625
|
+
const maxTop = clientHeight - targetTop - targetHeight + offsetY;
|
|
626
|
+
const onMousemove = (ev) => {
|
|
627
|
+
const moveX = Math.min(Math.max(offsetX + ev.clientX - downX, minLeft), maxLeft);
|
|
628
|
+
const moveY = Math.min(Math.max(offsetY + ev.clientY - downY, minTop), maxTop);
|
|
629
|
+
transform = {
|
|
630
|
+
offsetX: moveX,
|
|
631
|
+
offsetY: moveY
|
|
632
|
+
};
|
|
633
|
+
targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
|
|
634
|
+
};
|
|
635
|
+
const onMouseup = () => {
|
|
636
|
+
document.removeEventListener("mousemove", onMousemove);
|
|
637
|
+
document.removeEventListener("mouseup", onMouseup);
|
|
638
|
+
};
|
|
639
|
+
document.addEventListener("mousemove", onMousemove);
|
|
640
|
+
document.addEventListener("mouseup", onMouseup);
|
|
641
|
+
};
|
|
642
|
+
const onDraggable = () => {
|
|
643
|
+
if (dragRef.value && targetRef.value) {
|
|
644
|
+
dragRef.value.addEventListener("mousedown", onMousedown);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
const offDraggable = () => {
|
|
648
|
+
if (dragRef.value && targetRef.value) {
|
|
649
|
+
dragRef.value.removeEventListener("mousedown", onMousedown);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
onMounted(() => {
|
|
653
|
+
watchEffect(() => {
|
|
654
|
+
if (draggable.value) {
|
|
655
|
+
onDraggable();
|
|
656
|
+
} else {
|
|
657
|
+
offDraggable();
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
onBeforeUnmount(() => {
|
|
662
|
+
offDraggable();
|
|
663
|
+
});
|
|
664
|
+
};
|
|
433
665
|
var Header = defineComponent({
|
|
434
666
|
name: "DModalHeader",
|
|
435
667
|
setup(props, {
|
|
@@ -467,55 +699,101 @@ var Modal = defineComponent({
|
|
|
467
699
|
setup(props, {
|
|
468
700
|
slots,
|
|
469
701
|
attrs,
|
|
470
|
-
emit
|
|
471
|
-
expose
|
|
702
|
+
emit
|
|
472
703
|
}) {
|
|
473
704
|
const ns = useNamespace("modal");
|
|
474
705
|
const {
|
|
475
706
|
modelValue,
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
707
|
+
title,
|
|
708
|
+
showClose,
|
|
709
|
+
showOverlay,
|
|
710
|
+
appendToBody,
|
|
711
|
+
closeOnClickOverlay
|
|
479
712
|
} = toRefs(props);
|
|
480
713
|
const {
|
|
481
|
-
|
|
714
|
+
execClose
|
|
482
715
|
} = useModal(props, emit);
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
"
|
|
492
|
-
"
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
})]
|
|
716
|
+
useModalRender(props);
|
|
717
|
+
const dialogRef = ref();
|
|
718
|
+
const headerRef = ref();
|
|
719
|
+
const draggable = computed(() => props.draggable);
|
|
720
|
+
useDraggable(dialogRef, headerRef, draggable);
|
|
721
|
+
const renderType = () => {
|
|
722
|
+
const typeList = [{
|
|
723
|
+
type: "success",
|
|
724
|
+
text: "\u6210\u529F",
|
|
725
|
+
icon: "right-o"
|
|
726
|
+
}, {
|
|
727
|
+
type: "failed",
|
|
728
|
+
text: "\u9519\u8BEF",
|
|
729
|
+
icon: "error-o"
|
|
730
|
+
}, {
|
|
731
|
+
type: "warning",
|
|
732
|
+
text: "\u8B66\u544A",
|
|
733
|
+
icon: "warning-o"
|
|
734
|
+
}, {
|
|
735
|
+
type: "info",
|
|
736
|
+
text: "\u4FE1\u606F",
|
|
737
|
+
icon: "info-o"
|
|
738
|
+
}];
|
|
739
|
+
const item = typeList.find((i) => i.type === props.type);
|
|
740
|
+
return createVNode(Header, null, {
|
|
741
|
+
default: () => [createVNode("div", {
|
|
742
|
+
"class": "type-content"
|
|
743
|
+
}, [createVNode("div", {
|
|
744
|
+
"class": "type-content-icon"
|
|
745
|
+
}, [createVNode(Icon, {
|
|
746
|
+
"name": item == null ? void 0 : item.icon
|
|
747
|
+
}, null)]), createVNode("div", {
|
|
748
|
+
"class": "type-content-text"
|
|
749
|
+
}, [item == null ? void 0 : item.text])])]
|
|
517
750
|
});
|
|
518
751
|
};
|
|
752
|
+
return () => createVNode(Teleport, {
|
|
753
|
+
"to": "body",
|
|
754
|
+
"disabled": !appendToBody.value
|
|
755
|
+
}, {
|
|
756
|
+
default: () => [showOverlay.value && createVNode(FixedOverlay, {
|
|
757
|
+
"modelValue": modelValue.value,
|
|
758
|
+
"onUpdate:modelValue": execClose,
|
|
759
|
+
"class": ns.e("overlay"),
|
|
760
|
+
"lock-scroll": false,
|
|
761
|
+
"close-on-click-overlay": closeOnClickOverlay.value,
|
|
762
|
+
"style": {
|
|
763
|
+
zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
|
|
764
|
+
}
|
|
765
|
+
}, null), createVNode(Transition, {
|
|
766
|
+
"name": props.showAnimation ? ns.m("wipe") : ""
|
|
767
|
+
}, {
|
|
768
|
+
default: () => {
|
|
769
|
+
var _a;
|
|
770
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
771
|
+
"ref": dialogRef,
|
|
772
|
+
"class": ns.b()
|
|
773
|
+
}, attrs, {
|
|
774
|
+
"onClick": (e) => e.stopPropagation()
|
|
775
|
+
}), [showClose.value && createVNode("div", {
|
|
776
|
+
"onClick": execClose,
|
|
777
|
+
"class": "btn-close"
|
|
778
|
+
}, [createVNode(Icon, {
|
|
779
|
+
"name": "close",
|
|
780
|
+
"size": "20px"
|
|
781
|
+
}, null)]), props.type ? renderType() : createVNode("div", {
|
|
782
|
+
"style": {
|
|
783
|
+
cursor: props.draggable ? "move" : "default"
|
|
784
|
+
},
|
|
785
|
+
"ref": headerRef
|
|
786
|
+
}, [slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
787
|
+
default: () => [title.value]
|
|
788
|
+
})]), createVNode(Body, null, {
|
|
789
|
+
default: () => {
|
|
790
|
+
var _a2;
|
|
791
|
+
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
|
|
792
|
+
}
|
|
793
|
+
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
794
|
+
}
|
|
795
|
+
})]
|
|
796
|
+
});
|
|
519
797
|
}
|
|
520
798
|
});
|
|
521
799
|
var Footer = defineComponent({
|