vue-devui 1.0.0-rc.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -146
- package/alert/index.es.js +46 -15
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8230 -231
- package/auto-complete/index.umd.js +29 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +81 -70
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +34 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5706 -98
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +38 -13
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8066 -245
- 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 +12020 -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 +29 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +178 -142
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +742 -107
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +544 -316
- package/form/index.umd.js +17 -17
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +28 -4
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +71 -50
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +184 -23
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +34 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8250 -131
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +275 -203
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +34 -6
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +34 -10
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8310 -0
- package/mention/index.umd.js +36 -0
- package/mention/package.json +7 -0
- package/mention/style.css +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/index.es.js +934 -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 +538 -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 +359 -170
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +236 -65
- 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/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/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.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/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 +84 -125
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +7 -3
- package/pagination/index.es.js +234 -39
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +274 -220
- package/popover/index.umd.js +13 -13
- package/popover/style.css +1 -1
- package/progress/index.es.js +31 -9
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7969 -152
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +46 -14
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +169 -22
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3823 -1090
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9186 -478
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +110 -259
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +143 -146
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +433 -207
- package/splitter/index.umd.js +17 -17
- 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 +26 -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 +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.es.js +7802 -59
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +9769 -919
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +309 -96
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +35 -7
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7922 -78
- 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 +9585 -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 +169 -22
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +265 -212
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11343 -795
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +494 -106
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +22849 -13614
- package/vue-devui.umd.js +30 -23
- package/date-picker/index.es.js +0 -1145
- 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/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,
|
|
36
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, unref, nextTick, onMounted, Teleport, h, render } from "vue";
|
|
37
37
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
38
38
|
const modalProps = {
|
|
39
39
|
modelValue: {
|
|
@@ -54,8 +54,25 @@ 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
|
};
|
|
75
|
+
const DEFAULT_PREFIX = "icon";
|
|
59
76
|
const iconProps = {
|
|
60
77
|
name: {
|
|
61
78
|
type: String,
|
|
@@ -63,172 +80,285 @@ const iconProps = {
|
|
|
63
80
|
required: true
|
|
64
81
|
},
|
|
65
82
|
size: {
|
|
66
|
-
type: String,
|
|
83
|
+
type: [Number, String],
|
|
67
84
|
default: "inherit"
|
|
68
85
|
},
|
|
69
86
|
color: {
|
|
70
87
|
type: String,
|
|
71
88
|
default: "inherit"
|
|
72
89
|
},
|
|
90
|
+
component: {
|
|
91
|
+
type: Object,
|
|
92
|
+
default: null
|
|
93
|
+
},
|
|
73
94
|
classPrefix: {
|
|
74
95
|
type: String,
|
|
75
|
-
default:
|
|
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]
|
|
76
108
|
}
|
|
77
109
|
};
|
|
78
|
-
|
|
79
|
-
name:
|
|
80
|
-
|
|
110
|
+
const svgIconProps = {
|
|
111
|
+
name: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: "",
|
|
114
|
+
required: true
|
|
115
|
+
},
|
|
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,
|
|
81
152
|
setup(props) {
|
|
82
153
|
const {
|
|
83
154
|
name,
|
|
84
|
-
size,
|
|
85
155
|
color,
|
|
86
|
-
|
|
156
|
+
size
|
|
87
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
|
+
};
|
|
88
167
|
return () => {
|
|
89
|
-
return
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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);
|
|
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)]);
|
|
103
175
|
};
|
|
104
176
|
}
|
|
105
177
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
178
|
+
function isUrl(value) {
|
|
179
|
+
return /^((http|https):)?\/\//.test(value);
|
|
109
180
|
}
|
|
110
|
-
|
|
181
|
+
function useIconDom(props, ctx) {
|
|
182
|
+
const {
|
|
183
|
+
component,
|
|
184
|
+
name,
|
|
185
|
+
size,
|
|
186
|
+
color,
|
|
187
|
+
classPrefix,
|
|
188
|
+
rotate
|
|
189
|
+
} = toRefs(props);
|
|
190
|
+
const ns = useNamespace("icon");
|
|
191
|
+
const iconSize = computed(() => {
|
|
192
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
193
|
+
});
|
|
194
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
195
|
+
const imgIconDom = () => {
|
|
196
|
+
return createVNode("img", mergeProps({
|
|
197
|
+
"src": name.value,
|
|
198
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
199
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
200
|
+
"style": {
|
|
201
|
+
width: iconSize.value || "",
|
|
202
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
|
|
203
|
+
verticalAlign: "middle"
|
|
204
|
+
}
|
|
205
|
+
}, ctx.attrs), null);
|
|
206
|
+
};
|
|
207
|
+
const svgIconDom = () => {
|
|
208
|
+
return createVNode(IconComponent, mergeProps({
|
|
209
|
+
"name": name.value,
|
|
210
|
+
"color": color.value,
|
|
211
|
+
"size": iconSize.value,
|
|
212
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
213
|
+
"style": {
|
|
214
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
215
|
+
}
|
|
216
|
+
}, ctx.attrs), null);
|
|
217
|
+
};
|
|
218
|
+
const fontIconDom = () => {
|
|
219
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
220
|
+
return createVNode("i", mergeProps({
|
|
221
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
222
|
+
"style": {
|
|
223
|
+
fontSize: iconSize.value,
|
|
224
|
+
color: color.value,
|
|
225
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
226
|
+
}
|
|
227
|
+
}, ctx.attrs), null);
|
|
228
|
+
};
|
|
229
|
+
const iconDom = () => {
|
|
230
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
231
|
+
};
|
|
232
|
+
return {
|
|
233
|
+
iconDom
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
var Icon = defineComponent({
|
|
237
|
+
name: "DIcon",
|
|
238
|
+
props: iconProps,
|
|
239
|
+
emits: ["click"],
|
|
111
240
|
setup(props, ctx) {
|
|
241
|
+
const {
|
|
242
|
+
disabled,
|
|
243
|
+
operable
|
|
244
|
+
} = toRefs(props);
|
|
245
|
+
const {
|
|
246
|
+
iconDom
|
|
247
|
+
} = useIconDom(props, ctx);
|
|
248
|
+
const ns = useNamespace("icon");
|
|
249
|
+
const wrapClassed = computed(() => ({
|
|
250
|
+
[ns.e("container")]: true,
|
|
251
|
+
[ns.m("disabled")]: disabled.value,
|
|
252
|
+
[ns.m("operable")]: operable.value
|
|
253
|
+
}));
|
|
254
|
+
const onClick = (e) => {
|
|
255
|
+
if (disabled.value) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
ctx.emit("click", e);
|
|
259
|
+
};
|
|
112
260
|
return () => {
|
|
113
|
-
|
|
114
|
-
return createVNode(
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"name": "devui-overlay-fade"
|
|
119
|
-
}, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
|
|
120
|
-
default: () => [_slot]
|
|
121
|
-
})]
|
|
122
|
-
});
|
|
261
|
+
var _a, _b, _c, _d;
|
|
262
|
+
return createVNode("div", {
|
|
263
|
+
"class": wrapClassed.value,
|
|
264
|
+
"onClick": onClick
|
|
265
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
123
266
|
};
|
|
124
267
|
}
|
|
125
268
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
269
|
+
var iconGroup = "";
|
|
270
|
+
defineComponent({
|
|
271
|
+
name: "DIconGroup",
|
|
272
|
+
setup(_, ctx) {
|
|
273
|
+
const ns = useNamespace("icon-group");
|
|
274
|
+
return () => {
|
|
275
|
+
var _a, _b;
|
|
276
|
+
return createVNode("div", {
|
|
277
|
+
"class": ns.b()
|
|
278
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
const fixedOverlayProps = {
|
|
283
|
+
modelValue: {
|
|
131
284
|
type: Boolean,
|
|
132
285
|
default: false
|
|
133
286
|
},
|
|
134
|
-
|
|
135
|
-
type: String,
|
|
136
|
-
default: ""
|
|
137
|
-
},
|
|
138
|
-
backgroundStyle: {
|
|
139
|
-
type: [String, Object]
|
|
140
|
-
},
|
|
141
|
-
onBackdropClick: {
|
|
142
|
-
type: Function
|
|
143
|
-
},
|
|
144
|
-
backdropClose: {
|
|
287
|
+
lockScroll: {
|
|
145
288
|
type: Boolean,
|
|
146
289
|
default: true
|
|
147
290
|
},
|
|
148
|
-
|
|
291
|
+
closeOnClickOverlay: {
|
|
149
292
|
type: Boolean,
|
|
150
293
|
default: true
|
|
151
294
|
}
|
|
152
295
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
296
|
+
function lockScroll() {
|
|
297
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
298
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
299
|
+
const style = document.documentElement.getAttribute("style");
|
|
300
|
+
document.documentElement.style.position = "fixed";
|
|
301
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
302
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
303
|
+
document.documentElement.style.overflowY = "scroll";
|
|
304
|
+
return () => {
|
|
305
|
+
if (style) {
|
|
306
|
+
document.documentElement.setAttribute("style", style);
|
|
307
|
+
} else {
|
|
308
|
+
document.documentElement.removeAttribute("style");
|
|
309
|
+
}
|
|
310
|
+
document.documentElement.scrollTop = scrollTop;
|
|
311
|
+
};
|
|
157
312
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
function
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
"devui-overlay-background",
|
|
164
|
-
props.backgroundClass,
|
|
165
|
-
!props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
|
|
166
|
-
];
|
|
167
|
-
});
|
|
168
|
-
const overlayClass = computed(() => {
|
|
169
|
-
return "devui-overlay";
|
|
170
|
-
});
|
|
171
|
-
const handleBackdropClick = (event) => {
|
|
172
|
-
var _a;
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
function useFixedOverlay(props, ctx) {
|
|
316
|
+
let lockScrollCb;
|
|
317
|
+
const onClick = (event) => {
|
|
173
318
|
event.preventDefault();
|
|
174
|
-
(
|
|
175
|
-
if (props.
|
|
176
|
-
ctx.emit("update:
|
|
319
|
+
ctx.emit("click", event);
|
|
320
|
+
if (props.closeOnClickOverlay) {
|
|
321
|
+
ctx.emit("update:modelValue", false);
|
|
177
322
|
}
|
|
178
323
|
};
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
const body = document.body;
|
|
182
|
-
const originOverflow = body.style.overflow;
|
|
183
|
-
const originPosition = body.style.position;
|
|
184
|
-
watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
|
|
185
|
-
if (backgroundBlock) {
|
|
186
|
-
const top = body.getBoundingClientRect().y;
|
|
187
|
-
if (visible) {
|
|
188
|
-
body.style.overflowY = "scroll";
|
|
189
|
-
body.style.position = visible ? "fixed" : "";
|
|
190
|
-
body.style.top = `${top}px`;
|
|
191
|
-
} else {
|
|
192
|
-
body.style.overflowY = originOverflow;
|
|
193
|
-
body.style.position = originPosition;
|
|
194
|
-
body.style.top = "";
|
|
195
|
-
window.scrollTo(0, -top);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
onUnmounted(() => {
|
|
200
|
-
document.body.style.overflow = originOverflow;
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
return {
|
|
204
|
-
backgroundClass,
|
|
205
|
-
overlayClass,
|
|
206
|
-
handleBackdropClick,
|
|
207
|
-
handleOverlayBubbleCancel
|
|
324
|
+
const removeBodyAdditions = () => {
|
|
325
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
208
326
|
};
|
|
327
|
+
watch(() => props.modelValue, (val) => {
|
|
328
|
+
if (val) {
|
|
329
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
330
|
+
} else {
|
|
331
|
+
removeBodyAdditions();
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
onUnmounted(removeBodyAdditions);
|
|
335
|
+
return { onClick };
|
|
209
336
|
}
|
|
210
337
|
var fixedOverlay = "";
|
|
211
338
|
const FixedOverlay = defineComponent({
|
|
212
339
|
name: "DFixedOverlay",
|
|
340
|
+
inheritAttrs: false,
|
|
213
341
|
props: fixedOverlayProps,
|
|
214
|
-
emits:
|
|
342
|
+
emits: ["update:modelValue", "click"],
|
|
215
343
|
setup(props, ctx) {
|
|
216
344
|
const {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
345
|
+
modelValue
|
|
346
|
+
} = toRefs(props);
|
|
347
|
+
const ns = useNamespace("fixed-overlay");
|
|
348
|
+
const {
|
|
349
|
+
onClick
|
|
350
|
+
} = useFixedOverlay(props, ctx);
|
|
351
|
+
return () => createVNode(Transition, {
|
|
352
|
+
"name": ns.m("fade")
|
|
353
|
+
}, {
|
|
354
|
+
default: () => {
|
|
355
|
+
var _a, _b;
|
|
356
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
357
|
+
"class": ns.b()
|
|
358
|
+
}, ctx.attrs, {
|
|
359
|
+
"onClick": onClick
|
|
360
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
361
|
+
}
|
|
232
362
|
});
|
|
233
363
|
}
|
|
234
364
|
});
|
|
@@ -376,6 +506,7 @@ defineComponent({
|
|
|
376
506
|
emit,
|
|
377
507
|
expose
|
|
378
508
|
}) {
|
|
509
|
+
const ns = useNamespace("flexible-overlay");
|
|
379
510
|
const {
|
|
380
511
|
arrowRef,
|
|
381
512
|
overlayRef,
|
|
@@ -388,10 +519,10 @@ defineComponent({
|
|
|
388
519
|
var _a;
|
|
389
520
|
return props.modelValue && createVNode("div", mergeProps({
|
|
390
521
|
"ref": overlayRef,
|
|
391
|
-
"class":
|
|
522
|
+
"class": ns.b()
|
|
392
523
|
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
393
524
|
"ref": arrowRef,
|
|
394
|
-
"class": "
|
|
525
|
+
"class": ns.e("arrow")
|
|
395
526
|
}, null)]);
|
|
396
527
|
};
|
|
397
528
|
}
|
|
@@ -401,22 +532,69 @@ function useModal(props, emit) {
|
|
|
401
532
|
function close() {
|
|
402
533
|
emit("update:modelValue", false);
|
|
403
534
|
}
|
|
404
|
-
function
|
|
405
|
-
|
|
406
|
-
|
|
535
|
+
function execClose() {
|
|
536
|
+
props.beforeClose ? props.beforeClose(close) : close();
|
|
537
|
+
}
|
|
538
|
+
function onOverlayClick() {
|
|
539
|
+
props.closeOnClickOverlay && execClose();
|
|
540
|
+
}
|
|
541
|
+
function onCloseBtnClick() {
|
|
542
|
+
execClose();
|
|
543
|
+
}
|
|
544
|
+
function onKeydown(event) {
|
|
545
|
+
if (event["keyCode"] === 27) {
|
|
546
|
+
execClose();
|
|
407
547
|
}
|
|
408
548
|
}
|
|
409
|
-
|
|
549
|
+
onMounted(() => {
|
|
550
|
+
if (props.escapable) {
|
|
551
|
+
window.addEventListener("keydown", onKeydown);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
onUnmounted(() => {
|
|
555
|
+
if (props.escapable) {
|
|
556
|
+
window.addEventListener("keydown", onKeydown);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
return { onCloseBtnClick, onOverlayClick };
|
|
560
|
+
}
|
|
561
|
+
function useModalRender(props) {
|
|
562
|
+
const showContainer = ref(false);
|
|
563
|
+
const showModal = ref(false);
|
|
564
|
+
let lockScrollCb;
|
|
565
|
+
const removeBodyAdditions = () => {
|
|
566
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
567
|
+
};
|
|
568
|
+
watch(() => props.modelValue, (val) => {
|
|
569
|
+
if (val) {
|
|
570
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
571
|
+
showContainer.value = true;
|
|
572
|
+
nextTick(() => {
|
|
573
|
+
showModal.value = true;
|
|
574
|
+
});
|
|
575
|
+
} else {
|
|
576
|
+
removeBodyAdditions();
|
|
577
|
+
showModal.value = false;
|
|
578
|
+
setTimeout(() => {
|
|
579
|
+
showContainer.value = false;
|
|
580
|
+
}, 100);
|
|
581
|
+
}
|
|
582
|
+
}, {
|
|
583
|
+
immediate: true
|
|
584
|
+
});
|
|
585
|
+
onUnmounted(removeBodyAdditions);
|
|
586
|
+
return { showContainer, showModal };
|
|
410
587
|
}
|
|
411
588
|
var Header = defineComponent({
|
|
412
589
|
name: "DModalHeader",
|
|
413
590
|
setup(props, {
|
|
414
591
|
slots
|
|
415
592
|
}) {
|
|
593
|
+
const ns = useNamespace("modal");
|
|
416
594
|
return () => {
|
|
417
595
|
var _a;
|
|
418
596
|
return createVNode("div", {
|
|
419
|
-
"class": "
|
|
597
|
+
"class": ns.e("header")
|
|
420
598
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
421
599
|
};
|
|
422
600
|
}
|
|
@@ -426,10 +604,11 @@ var Body = defineComponent({
|
|
|
426
604
|
setup(props, {
|
|
427
605
|
slots
|
|
428
606
|
}) {
|
|
607
|
+
const ns = useNamespace("modal");
|
|
429
608
|
return () => {
|
|
430
609
|
var _a;
|
|
431
610
|
return createVNode("div", {
|
|
432
|
-
"class": "
|
|
611
|
+
"class": ns.e("body")
|
|
433
612
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
434
613
|
};
|
|
435
614
|
}
|
|
@@ -443,54 +622,63 @@ var Modal = defineComponent({
|
|
|
443
622
|
setup(props, {
|
|
444
623
|
slots,
|
|
445
624
|
attrs,
|
|
446
|
-
emit
|
|
447
|
-
expose
|
|
625
|
+
emit
|
|
448
626
|
}) {
|
|
627
|
+
const ns = useNamespace("modal");
|
|
449
628
|
const {
|
|
450
629
|
modelValue,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
630
|
+
title,
|
|
631
|
+
showClose,
|
|
632
|
+
showOverlay,
|
|
633
|
+
appendToBody
|
|
454
634
|
} = toRefs(props);
|
|
455
635
|
const {
|
|
456
|
-
|
|
636
|
+
onCloseBtnClick,
|
|
637
|
+
onOverlayClick
|
|
457
638
|
} = useModal(props, emit);
|
|
458
|
-
|
|
459
|
-
|
|
639
|
+
const {
|
|
640
|
+
showContainer,
|
|
641
|
+
showModal
|
|
642
|
+
} = useModalRender(props);
|
|
643
|
+
return () => createVNode(Teleport, {
|
|
644
|
+
"to": "body",
|
|
645
|
+
"disabled": !appendToBody.value
|
|
646
|
+
}, {
|
|
647
|
+
default: () => [showOverlay.value && createVNode(FixedOverlay, {
|
|
648
|
+
"modelValue": modelValue.value,
|
|
649
|
+
"onUpdate:modelValue": ($event) => modelValue.value = $event,
|
|
650
|
+
"lock-scroll": false,
|
|
651
|
+
"style": {
|
|
652
|
+
zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
|
|
653
|
+
}
|
|
654
|
+
}, null), showContainer.value && createVNode("div", {
|
|
655
|
+
"class": ns.e("container"),
|
|
656
|
+
"onClick": onOverlayClick
|
|
657
|
+
}, [createVNode(Transition, {
|
|
658
|
+
"name": ns.m("wipe")
|
|
659
|
+
}, {
|
|
660
|
+
default: () => {
|
|
661
|
+
var _a;
|
|
662
|
+
return [showModal.value && createVNode("div", mergeProps({
|
|
663
|
+
"class": ns.b()
|
|
664
|
+
}, attrs, {
|
|
665
|
+
"onClick": (e) => e.stopPropagation()
|
|
666
|
+
}), [showClose.value && createVNode(Icon, {
|
|
667
|
+
"name": "close",
|
|
668
|
+
"class": "btn-close",
|
|
669
|
+
"size": "var(--devui-font-size-md,12px)",
|
|
670
|
+
"onClick": onCloseBtnClick
|
|
671
|
+
}, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
672
|
+
default: () => [title.value]
|
|
673
|
+
}), createVNode(Body, null, {
|
|
674
|
+
default: () => {
|
|
675
|
+
var _a2;
|
|
676
|
+
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
|
|
677
|
+
}
|
|
678
|
+
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
679
|
+
}
|
|
680
|
+
})])]
|
|
460
681
|
});
|
|
461
|
-
return () => {
|
|
462
|
-
const fixedOverlayProps2 = {
|
|
463
|
-
visible: modelValue.value,
|
|
464
|
-
"onUpdate:visible": handleVisibleChange,
|
|
465
|
-
"background-class": "devui-modal-mask",
|
|
466
|
-
"background-block": lockScroll.value,
|
|
467
|
-
"backdrop-close": closeOnClickOverlay.value
|
|
468
|
-
};
|
|
469
|
-
return createVNode(FixedOverlay, fixedOverlayProps2, {
|
|
470
|
-
default: () => [createVNode(Transition, {
|
|
471
|
-
"name": "devui-modal-wipe"
|
|
472
|
-
}, {
|
|
473
|
-
default: () => {
|
|
474
|
-
var _a;
|
|
475
|
-
return [createVNode("div", mergeProps({
|
|
476
|
-
"class": "devui-modal"
|
|
477
|
-
}, attrs), [createVNode(Icon, {
|
|
478
|
-
"name": "close",
|
|
479
|
-
"class": "btn-close",
|
|
480
|
-
"size": "var(--devui-font-size-md,12px)",
|
|
481
|
-
"onClick": () => handleVisibleChange(false)
|
|
482
|
-
}, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
483
|
-
default: () => [title.value]
|
|
484
|
-
}), createVNode(Body, null, {
|
|
485
|
-
default: () => {
|
|
486
|
-
var _a2;
|
|
487
|
-
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
|
|
488
|
-
}
|
|
489
|
-
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
490
|
-
}
|
|
491
|
-
})]
|
|
492
|
-
});
|
|
493
|
-
};
|
|
494
682
|
}
|
|
495
683
|
});
|
|
496
684
|
var Footer = defineComponent({
|
|
@@ -498,10 +686,11 @@ var Footer = defineComponent({
|
|
|
498
686
|
setup(props, {
|
|
499
687
|
slots
|
|
500
688
|
}) {
|
|
689
|
+
const ns = useNamespace("modal");
|
|
501
690
|
return () => {
|
|
502
691
|
var _a;
|
|
503
692
|
return createVNode("div", {
|
|
504
|
-
"class": "
|
|
693
|
+
"class": ns.e("footer")
|
|
505
694
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
506
695
|
};
|
|
507
696
|
}
|