vue-devui 1.0.0-beta.9 → 1.0.0-rc.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 +100 -72
- package/accordion/index.es.js +525 -39
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.es.js +34 -37
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/{time-axis → auto-complete}/index.d.ts +0 -0
- package/auto-complete/index.es.js +983 -0
- package/auto-complete/index.umd.js +1 -0
- package/auto-complete/package.json +7 -0
- package/auto-complete/style.css +1 -0
- package/back-top/index.es.js +5 -3
- package/back-top/index.umd.js +1 -1
- package/badge/index.es.js +13 -19
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/breadcrumb/index.es.js +2 -1
- package/button/index.es.js +296 -117
- package/button/index.umd.js +1 -1
- package/button/style.css +1 -1
- package/carousel/index.es.js +43 -57
- package/carousel/index.umd.js +1 -1
- package/cascader/index.es.js +5412 -784
- package/cascader/index.umd.js +27 -1
- package/cascader/style.css +1 -1
- package/checkbox/style.css +1 -1
- package/{toast → color-picker}/index.d.ts +0 -0
- package/color-picker/index.es.js +8196 -0
- package/color-picker/index.umd.js +27 -0
- package/color-picker/package.json +7 -0
- package/color-picker/style.css +1 -0
- package/comment/index.es.js +42 -13
- package/comment/index.umd.js +1 -1
- package/comment/style.css +1 -1
- package/countdown/index.es.js +27 -17
- package/countdown/index.umd.js +1 -1
- package/countdown/style.css +1 -1
- package/date-picker/index.es.js +48 -66
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.es.js +135 -10
- package/dragdrop/index.umd.js +1 -1
- package/drawer/index.es.js +169 -223
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +463 -300
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +293 -5660
- package/editable-select/index.umd.js +1 -27
- package/editable-select/style.css +1 -1
- package/form/index.es.js +6210 -531
- package/form/index.umd.js +27 -1
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +112 -133
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/gantt/index.es.js +6 -18
- package/gantt/index.umd.js +1 -1
- package/gantt/style.css +1 -1
- package/grid/index.es.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +39 -56
- package/icon/index.umd.js +1 -1
- package/image-preview/index.es.js +35 -16
- package/image-preview/index.umd.js +1 -1
- package/input/index.es.js +4 -5
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-icon/index.es.js +42 -41
- package/input-icon/index.umd.js +1 -1
- package/input-icon/style.css +1 -1
- package/input-number/index.es.js +46 -56
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/list/index.d.ts +7 -0
- package/list/index.es.js +39 -0
- package/list/index.umd.js +1 -0
- package/{toast → list}/package.json +1 -1
- package/list/style.css +1 -0
- package/loading/index.es.js +2 -2
- package/modal/index.es.js +304 -765
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.es.js +1 -675
- package/nav-sprite/index.umd.js +1 -1
- package/notification/index.d.ts +7 -0
- package/notification/index.es.js +284 -0
- package/notification/index.umd.js +1 -0
- package/notification/package.json +7 -0
- package/notification/style.css +1 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/AutoComplete.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/CarouselItem.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/ColorPicker.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/DrawerService.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/DropdownMenu.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/IFileOptions.js +3 -0
- package/nuxt/components/IUploadOptions.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/List.js +3 -0
- package/nuxt/components/ListItem.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Notification.js +3 -0
- package/nuxt/components/NotificationService.js +3 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/UploadStatus.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/badgeProps.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/fixedOverlayProps.js +3 -0
- package/nuxt/components/flexibleOverlayProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +2 -0
- package/nuxt/components/notificationProps.js +3 -0
- package/nuxt/components/overlayEmits.js +3 -0
- package/nuxt/components/overlayProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/popoverProps.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/nuxt/components/uploadProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.es.js +156 -205
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +12 -55
- package/pagination/index.es.js +11 -13
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +48 -35
- package/panel/index.umd.js +1 -1
- package/popover/index.es.js +5954 -189
- package/popover/index.umd.js +27 -1
- package/popover/style.css +1 -1
- package/progress/index.es.js +8 -8
- package/progress/index.umd.js +3 -3
- package/quadrant-diagram/index.es.js +5405 -166
- package/quadrant-diagram/index.umd.js +27 -1
- package/radio/index.es.js +8 -14
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/read-tip/index.es.js +6 -3
- package/read-tip/style.css +1 -1
- package/result/index.es.js +38 -52
- package/result/index.umd.js +1 -1
- package/ripple/index.es.js +10 -6
- package/search/index.es.js +5428 -200
- package/search/index.umd.js +27 -1
- package/search/style.css +1 -1
- package/select/index.es.js +43 -42
- package/select/index.umd.js +1 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +17 -17
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +4 -6
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +5896 -39
- package/splitter/index.umd.js +27 -1
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +19 -32
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +1 -4
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps-guide/index.es.js +6 -3
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/table/index.es.js +753 -358
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +3 -4
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +4 -3
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/tag-input/index.es.js +4 -14
- package/tag-input/index.umd.js +1 -1
- package/textarea/style.css +1 -1
- package/{theme → theme/theme.scss} +0 -0
- package/time-picker/index.es.js +309 -123
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/timeline/index.d.ts +7 -0
- package/{time-axis → timeline}/index.es.js +65 -77
- package/timeline/index.umd.js +1 -0
- package/{time-axis → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +5805 -141
- package/tooltip/index.umd.js +27 -1
- package/tooltip/style.css +1 -1
- package/transfer/index.es.js +6521 -630
- package/transfer/index.umd.js +27 -1
- package/transfer/style.css +1 -1
- package/tree/index.es.js +5781 -193
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/tree-select/index.es.js +138 -39
- package/tree-select/index.umd.js +1 -1
- package/tree-select/style.css +1 -1
- package/upload/index.es.js +450 -2669
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +14414 -14096
- package/vue-devui.umd.js +19 -19
- package/time-axis/index.umd.js +0 -1
- package/time-axis/style.css +0 -1
- package/toast/index.es.js +0 -2059
- package/toast/index.umd.js +0 -1
- package/toast/style.css +0 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { defineComponent, toRefs, createVNode, computed, watch, Transition, reactive, createApp, onUnmounted, mergeProps, isVNode } from "vue";
|
|
21
|
+
const notificationProps = {
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ""
|
|
29
|
+
},
|
|
30
|
+
type: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "normal"
|
|
33
|
+
},
|
|
34
|
+
duration: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 3e3
|
|
37
|
+
},
|
|
38
|
+
onClose: {
|
|
39
|
+
type: Function
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const iconProps = {
|
|
43
|
+
name: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "",
|
|
46
|
+
required: true
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "inherit"
|
|
51
|
+
},
|
|
52
|
+
color: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "inherit"
|
|
55
|
+
},
|
|
56
|
+
classPrefix: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "icon"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var Icon = defineComponent({
|
|
62
|
+
name: "DIcon",
|
|
63
|
+
props: iconProps,
|
|
64
|
+
setup(props) {
|
|
65
|
+
const {
|
|
66
|
+
name,
|
|
67
|
+
size,
|
|
68
|
+
color,
|
|
69
|
+
classPrefix
|
|
70
|
+
} = toRefs(props);
|
|
71
|
+
return () => {
|
|
72
|
+
return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
|
|
73
|
+
"src": name.value,
|
|
74
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
75
|
+
"style": {
|
|
76
|
+
width: size.value,
|
|
77
|
+
verticalAlign: "text-bottom"
|
|
78
|
+
}
|
|
79
|
+
}, null) : createVNode("i", {
|
|
80
|
+
"class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
|
|
81
|
+
"style": {
|
|
82
|
+
fontSize: size.value,
|
|
83
|
+
color: color.value
|
|
84
|
+
}
|
|
85
|
+
}, null);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
var Close = defineComponent({
|
|
90
|
+
emits: ["click"],
|
|
91
|
+
setup(props, {
|
|
92
|
+
emit
|
|
93
|
+
}) {
|
|
94
|
+
return () => createVNode("div", {
|
|
95
|
+
"class": "devui-notification-icon-close",
|
|
96
|
+
"onClick": (e) => emit("click", e)
|
|
97
|
+
}, [createVNode(Icon, {
|
|
98
|
+
"name": "close",
|
|
99
|
+
"size": "14px"
|
|
100
|
+
}, null)]);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
var TypeIcon = defineComponent({
|
|
104
|
+
props: {
|
|
105
|
+
type: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: "normal"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
setup(props) {
|
|
111
|
+
const {
|
|
112
|
+
type
|
|
113
|
+
} = toRefs(props);
|
|
114
|
+
const classes = computed(() => ({
|
|
115
|
+
"devui-notification-image": true,
|
|
116
|
+
[`devui-notification-image-${type.value}`]: true
|
|
117
|
+
}));
|
|
118
|
+
const severityIconMap = {
|
|
119
|
+
info: "info-o",
|
|
120
|
+
success: "right-o",
|
|
121
|
+
warning: "warning-o",
|
|
122
|
+
error: "error-o"
|
|
123
|
+
};
|
|
124
|
+
return () => createVNode("span", {
|
|
125
|
+
"class": classes.value
|
|
126
|
+
}, [type.value !== "normal" && createVNode(Icon, {
|
|
127
|
+
"name": severityIconMap[type.value],
|
|
128
|
+
"size": "16px"
|
|
129
|
+
}, null)]);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
function useNotification(props) {
|
|
133
|
+
const classes = computed(() => ({
|
|
134
|
+
"devui-notification-item-container": true,
|
|
135
|
+
[`devui-notification-message-${props.type}`]: true
|
|
136
|
+
}));
|
|
137
|
+
return { classes };
|
|
138
|
+
}
|
|
139
|
+
function useEvent(props, emit) {
|
|
140
|
+
let timer = null;
|
|
141
|
+
let timestamp;
|
|
142
|
+
const close2 = () => {
|
|
143
|
+
var _a;
|
|
144
|
+
clearTimeout(timer);
|
|
145
|
+
timer = null;
|
|
146
|
+
(_a = props.onClose) == null ? void 0 : _a.call(props);
|
|
147
|
+
emit("update:modelValue", false);
|
|
148
|
+
};
|
|
149
|
+
const interrupt = () => {
|
|
150
|
+
if (timer) {
|
|
151
|
+
clearTimeout(timer);
|
|
152
|
+
timer = null;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const removeReset = () => {
|
|
156
|
+
if (!props.modelValue) {
|
|
157
|
+
const remainTime = props.duration - (Date.now() - timestamp);
|
|
158
|
+
timer = setTimeout(close2, remainTime);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const handleDestroy = () => {
|
|
162
|
+
emit("destroy");
|
|
163
|
+
};
|
|
164
|
+
watch(() => props.modelValue, (val) => {
|
|
165
|
+
if (val) {
|
|
166
|
+
timestamp = Date.now();
|
|
167
|
+
if (props.duration) {
|
|
168
|
+
timer = setTimeout(close2, props.duration);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return { interrupt, removeReset, close: close2, handleDestroy };
|
|
173
|
+
}
|
|
174
|
+
var notification = "";
|
|
175
|
+
var Notification = defineComponent({
|
|
176
|
+
name: "DNotification",
|
|
177
|
+
props: notificationProps,
|
|
178
|
+
emits: ["update:modelValue", "destroy"],
|
|
179
|
+
setup(props, {
|
|
180
|
+
emit,
|
|
181
|
+
slots
|
|
182
|
+
}) {
|
|
183
|
+
const {
|
|
184
|
+
modelValue,
|
|
185
|
+
title,
|
|
186
|
+
type
|
|
187
|
+
} = toRefs(props);
|
|
188
|
+
const {
|
|
189
|
+
classes
|
|
190
|
+
} = useNotification(props);
|
|
191
|
+
const {
|
|
192
|
+
interrupt,
|
|
193
|
+
removeReset,
|
|
194
|
+
close: close2,
|
|
195
|
+
handleDestroy
|
|
196
|
+
} = useEvent(props, emit);
|
|
197
|
+
return () => createVNode(Transition, {
|
|
198
|
+
"name": "notification-fade",
|
|
199
|
+
"onAfterLeave": handleDestroy
|
|
200
|
+
}, {
|
|
201
|
+
default: () => {
|
|
202
|
+
var _a;
|
|
203
|
+
return [modelValue.value && createVNode("div", {
|
|
204
|
+
"class": "devui-notification"
|
|
205
|
+
}, [createVNode("div", {
|
|
206
|
+
"class": classes.value,
|
|
207
|
+
"onMouseenter": interrupt,
|
|
208
|
+
"onMouseleave": removeReset
|
|
209
|
+
}, [createVNode("div", {
|
|
210
|
+
"class": "devui-notification-item"
|
|
211
|
+
}, [createVNode(Close, {
|
|
212
|
+
"onClick": close2
|
|
213
|
+
}, null), title.value && createVNode(TypeIcon, {
|
|
214
|
+
"type": type.value
|
|
215
|
+
}, null), createVNode("div", {
|
|
216
|
+
"class": "devui-notification-message"
|
|
217
|
+
}, [createVNode("span", {
|
|
218
|
+
"class": "devui-notification-title"
|
|
219
|
+
}, [title.value]), createVNode("span", {
|
|
220
|
+
"class": "devui-notification-content"
|
|
221
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])])])])])];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
function _isSlot(s) {
|
|
227
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
228
|
+
}
|
|
229
|
+
const defaultOptions = {
|
|
230
|
+
modelValue: false,
|
|
231
|
+
duration: 3e3,
|
|
232
|
+
type: "normal"
|
|
233
|
+
};
|
|
234
|
+
function initInstance(props, content) {
|
|
235
|
+
const container = document.createElement("div");
|
|
236
|
+
const app = createApp({
|
|
237
|
+
setup() {
|
|
238
|
+
onUnmounted(() => {
|
|
239
|
+
document.body.removeChild(container);
|
|
240
|
+
});
|
|
241
|
+
return () => createVNode(Notification, mergeProps(props, {
|
|
242
|
+
"onDestroy": app.unmount
|
|
243
|
+
}), _isSlot(content) ? content : {
|
|
244
|
+
default: () => [content]
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
document.body.appendChild(container);
|
|
249
|
+
app.mount(container);
|
|
250
|
+
return app;
|
|
251
|
+
}
|
|
252
|
+
function close(props, originOnClose) {
|
|
253
|
+
props.modelValue = false;
|
|
254
|
+
originOnClose == null ? void 0 : originOnClose();
|
|
255
|
+
}
|
|
256
|
+
class NotificationService {
|
|
257
|
+
static open(options) {
|
|
258
|
+
const originOnClose = options.onClose || null;
|
|
259
|
+
const content = options.content;
|
|
260
|
+
let timer;
|
|
261
|
+
delete options.content;
|
|
262
|
+
const props = reactive(__spreadProps(__spreadValues(__spreadValues({}, defaultOptions), options), {
|
|
263
|
+
onClose: () => {
|
|
264
|
+
close(props, originOnClose);
|
|
265
|
+
}
|
|
266
|
+
}));
|
|
267
|
+
initInstance(props, content);
|
|
268
|
+
props.modelValue = true;
|
|
269
|
+
clearTimeout(timer);
|
|
270
|
+
if (options.duration) {
|
|
271
|
+
timer = setTimeout(props.onClose, options.duration);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
var index = {
|
|
276
|
+
title: "Notification \u5168\u5C40\u901A\u77E5",
|
|
277
|
+
category: "\u53CD\u9988",
|
|
278
|
+
status: "100%",
|
|
279
|
+
install(app) {
|
|
280
|
+
app.component(Notification.name, Notification);
|
|
281
|
+
app.config.globalProperties.$notificationService = NotificationService;
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
export { Notification, NotificationService, index as default, notificationProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=Object.defineProperty,M=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var N=(i,e,l)=>e in i?I(i,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[e]=l,m=(i,e)=>{for(var l in e||(e={}))k.call(e,l)&&N(i,l,e[l]);if(v)for(var l of v(e))A.call(e,l)&&N(i,l,e[l]);return i},g=(i,e)=>M(i,R(e));(function(i,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.index={},i.Vue))})(this,function(i,e){"use strict";const l={modelValue:{type:Boolean,default:!1},title:{type:String,default:""},type:{type:String,default:"normal"},duration:{type:Number,default:3e3},onClose:{type:Function}},S={name:{type:String,default:"",required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}};var p=e.defineComponent({name:"DIcon",props:S,setup(n){const{name:t,size:o,color:a,classPrefix:c}=e.toRefs(n);return()=>/^((https?):)?\/\//.test(t.value)?e.createVNode("img",{src:t.value,alt:t.value.split("/")[t.value.split("/").length-1],style:{width:o.value,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${c.value} ${c.value}-${t.value}`,style:{fontSize:o.value,color:a.value}},null)}}),h=e.defineComponent({emits:["click"],setup(n,{emit:t}){return()=>e.createVNode("div",{class:"devui-notification-icon-close",onClick:o=>t("click",o)},[e.createVNode(p,{name:"close",size:"14px"},null)])}}),C=e.defineComponent({props:{type:{type:String,default:"normal"}},setup(n){const{type:t}=e.toRefs(n),o=e.computed(()=>({"devui-notification-image":!0,[`devui-notification-image-${t.value}`]:!0})),a={info:"info-o",success:"right-o",warning:"warning-o",error:"error-o"};return()=>e.createVNode("span",{class:o.value},[t.value!=="normal"&&e.createVNode(p,{name:a[t.value],size:"16px"},null)])}});function T(n){return{classes:e.computed(()=>({"devui-notification-item-container":!0,[`devui-notification-message-${n.type}`]:!0}))}}function b(n,t){let o=null,a;const c=()=>{var s;clearTimeout(o),o=null,(s=n.onClose)==null||s.call(n),t("update:modelValue",!1)},r=()=>{o&&(clearTimeout(o),o=null)},d=()=>{if(!n.modelValue){const s=n.duration-(Date.now()-a);o=setTimeout(c,s)}},f=()=>{t("destroy")};return e.watch(()=>n.modelValue,s=>{s&&(a=Date.now(),n.duration&&(o=setTimeout(c,n.duration)))}),{interrupt:r,removeReset:d,close:c,handleDestroy:f}}var E="",u=e.defineComponent({name:"DNotification",props:l,emits:["update:modelValue","destroy"],setup(n,{emit:t,slots:o}){const{modelValue:a,title:c,type:r}=e.toRefs(n),{classes:d}=T(n),{interrupt:f,removeReset:s,close:x,handleDestroy:z}=b(n,t);return()=>e.createVNode(e.Transition,{name:"notification-fade",onAfterLeave:z},{default:()=>{var V;return[a.value&&e.createVNode("div",{class:"devui-notification"},[e.createVNode("div",{class:d.value,onMouseenter:f,onMouseleave:s},[e.createVNode("div",{class:"devui-notification-item"},[e.createVNode(h,{onClick:x},null),c.value&&e.createVNode(C,{type:r.value},null),e.createVNode("div",{class:"devui-notification-message"},[e.createVNode("span",{class:"devui-notification-title"},[c.value]),e.createVNode("span",{class:"devui-notification-content"},[(V=o.default)==null?void 0:V.call(o)])])])])])]}})}});function D(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!e.isVNode(n)}const P={modelValue:!1,duration:3e3,type:"normal"};function w(n,t){const o=document.createElement("div"),a=e.createApp({setup(){return e.onUnmounted(()=>{document.body.removeChild(o)}),()=>e.createVNode(u,e.mergeProps(n,{onDestroy:a.unmount}),D(t)?t:{default:()=>[t]})}});return document.body.appendChild(o),a.mount(o),a}function $(n,t){n.modelValue=!1,t==null||t()}class y{static open(t){const o=t.onClose||null,a=t.content;let c;delete t.content;const r=e.reactive(g(m(m({},P),t),{onClose:()=>{$(r,o)}}));w(r,a),r.modelValue=!0,clearTimeout(c),t.duration&&(c=setTimeout(r.onClose,t.duration))}}var j={title:"Notification \u5168\u5C40\u901A\u77E5",category:"\u53CD\u9988",status:"100%",install(n){n.component(u.name,u),n.config.globalProperties.$notificationService=y}};i.Notification=u,i.NotificationService=y,i.default=j,i.notificationProps=l,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.devui-notification{position:fixed;top:50px;right:20px;width:20em;word-break:normal;word-wrap:break-word;z-index:1060}.devui-notification a:link,.devui-notification a:visited{color:var(--devui-link-light, #96adfa)}.devui-notification a:hover,.devui-notification a:active{color:var(--devui-link-light-active, #beccfa)}.devui-notification-item-container{position:relative;margin:0 0 8px;opacity:.95;filter:alpha(opacity=95);box-shadow:var(--devui-shadow-length-feedback-overlay, 0 4px 16px 0) var(--devui-shadow, rgba(0, 0, 0, .2));border-radius:var(--devui-border-radius-feedback, 4px);color:var(--devui-feedback-overlay-text, #dfe1e6);background-color:var(--devui-feedback-overlay-bg, #464d6e)}.devui-notification-item{position:relative;display:block;padding:12px 16px}.devui-notification-icon-close{position:absolute;top:7px;right:10px;cursor:pointer}.devui-notification-icon-close i.icon{color:var(--devui-light-text, #ffffff)!important}.devui-notification-title{font-size:var(--devui-font-size-card-title, 14px);padding:0 0 calc(.5em - 2px) 0;display:block;font-weight:700}.devui-notification-image{position:absolute;display:inline-block;width:16px;height:16px;border-radius:50%;left:16px;top:14px;padding:0;line-height:1}.devui-notification-image.devui-notification-image-warn i.icon{color:var(--devui-warning, #fac20a)!important}.devui-notification-image.devui-notification-image-info i.icon{color:var(--devui-info, #5e7ce0)!important}.devui-notification-image.devui-notification-image-error i.icon{color:var(--devui-danger, #f66f6a)!important}.devui-notification-image.devui-notification-image-success i.icon{color:var(--devui-success, #50d4ab)!important}.devui-notification-image .devui-notification-image-info-path,.devui-notification-image .devui-notification-image-error-path,.devui-notification-image .devui-notification-image-success-path{fill:var(--devui-light-text, #ffffff)}.devui-notification-message{margin-left:20px}.devui-notification-message .devui-notification-content{font-size:var(--devui-font-size, 12px);margin-top:4px}.devui-notification-message-common .devui-notification-message{margin-left:0}.devui-notification-message p{font-size:var(--devui-font-size, 12px);margin-top:4px}.notification-fade-enter-active,.notification-fade-leave-active{transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.notification-fade-enter-from,.notification-fade-leave-to{transform:translate(100%)}
|