vue-devui 1.0.0-rc.5 → 1.0.0-rc.8
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 +22 -8
- package/alert/index.es.js +37 -11
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +72 -26
- package/auto-complete/index.umd.js +5 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +32 -6
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +29 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5548 -76
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +56 -29
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +48 -30
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +91 -145
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +28 -3
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +39 -13
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +14 -14
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +958 -1200
- package/form/index.umd.js +18 -18
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +29 -5
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +68 -49
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- 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 +91 -145
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +27 -5
- 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/modal/index.es.js +41 -15
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +40 -13
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/formControlProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/overlay/index.es.js +31 -9
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +1 -1
- package/pagination/index.es.js +135 -124
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/popover/index.es.js +53 -24
- package/popover/index.umd.js +13 -13
- package/popover/style.css +1 -1
- package/progress/index.es.js +76 -20
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +32 -7
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +34 -10
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/search/index.es.js +103 -153
- package/search/index.umd.js +14 -14
- package/search/style.css +1 -1
- package/select/index.es.js +74 -51
- package/select/index.umd.js +1 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +37 -12
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +52 -16
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +52 -24
- package/splitter/index.umd.js +15 -15
- package/splitter/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/style.css +1 -1
- package/switch/index.es.js +30 -6
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +6267 -536
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +32 -8
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +27 -2
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +93 -76
- package/textarea/index.umd.js +1 -1
- package/textarea/style.css +1 -1
- package/tooltip/index.es.js +42 -15
- package/tooltip/index.umd.js +12 -12
- package/tooltip/style.css +1 -1
- package/{comment → tree}/index.d.ts +0 -0
- package/tree/index.es.js +1030 -0
- package/tree/index.umd.js +1 -0
- package/{comment → tree}/package.json +1 -1
- package/tree/style.css +1 -0
- package/upload/index.es.js +53 -22
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +5296 -4916
- package/vue-devui.umd.js +22 -22
- package/comment/index.es.js +0 -84
- package/comment/index.umd.js +0 -1
- package/comment/style.css +0 -1
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/commentProps.js +0 -3
- package/nuxt/components/readTipProps.js +0 -3
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -261
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
package/comment/index.es.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { defineComponent, createVNode } from "vue";
|
|
2
|
-
const commentProps = {
|
|
3
|
-
actions: {
|
|
4
|
-
type: Object,
|
|
5
|
-
default: null
|
|
6
|
-
},
|
|
7
|
-
author: {
|
|
8
|
-
type: Object,
|
|
9
|
-
default: null
|
|
10
|
-
},
|
|
11
|
-
avatar: {
|
|
12
|
-
type: Object,
|
|
13
|
-
default: null
|
|
14
|
-
},
|
|
15
|
-
content: {
|
|
16
|
-
type: Object,
|
|
17
|
-
default: null
|
|
18
|
-
},
|
|
19
|
-
datetime: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: null
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
var comment = "";
|
|
25
|
-
var Comment = defineComponent({
|
|
26
|
-
name: "DComment",
|
|
27
|
-
props: commentProps,
|
|
28
|
-
emits: [],
|
|
29
|
-
slots: ["actions", "author", "avatar", "content", "datetime"],
|
|
30
|
-
setup(props, {
|
|
31
|
-
slots
|
|
32
|
-
}) {
|
|
33
|
-
return () => {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
35
|
-
const getAction = (actions2) => {
|
|
36
|
-
if (!actions2 || !actions2.length) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const actionList = actions2.map((action, index2) => createVNode("li", {
|
|
40
|
-
"key": `devui-comment-action-${index2}`,
|
|
41
|
-
"class": `devui-comment-action-${index2}`
|
|
42
|
-
}, [action]));
|
|
43
|
-
return actionList;
|
|
44
|
-
};
|
|
45
|
-
const actions = (_b = props.actions) != null ? _b : (_a = slots.actions) == null ? void 0 : _a.call(slots);
|
|
46
|
-
const author = (_d = props.author) != null ? _d : (_c = slots.author) == null ? void 0 : _c.call(slots);
|
|
47
|
-
const avatar = (_f = props.avatar) != null ? _f : (_e = slots.avatar) == null ? void 0 : _e.call(slots);
|
|
48
|
-
const content = (_h = props.content) != null ? _h : (_g = slots.content) == null ? void 0 : _g.call(slots);
|
|
49
|
-
const datetime = (_j = props.datetime) != null ? _j : (_i = slots.datetime) == null ? void 0 : _i.call(slots);
|
|
50
|
-
const avatarDom = createVNode("div", {
|
|
51
|
-
"class": `devui-comment-avatar`
|
|
52
|
-
}, [typeof avatar === "string" ? createVNode("img", {
|
|
53
|
-
"src": avatar,
|
|
54
|
-
"alt": "comment-avatar"
|
|
55
|
-
}, null) : avatar]);
|
|
56
|
-
const actionsList = Array.isArray(actions) ? actions : [actions];
|
|
57
|
-
const actionDom = actions ? createVNode("ul", {
|
|
58
|
-
"class": `devui-comment-actions`
|
|
59
|
-
}, [getAction(actionsList)]) : null;
|
|
60
|
-
return createVNode("div", {
|
|
61
|
-
"class": "devui-comment"
|
|
62
|
-
}, [avatarDom, createVNode("div", {
|
|
63
|
-
"class": "devui-comment-right"
|
|
64
|
-
}, [createVNode("div", {
|
|
65
|
-
"class": "devui-comment-head"
|
|
66
|
-
}, [createVNode("div", {
|
|
67
|
-
"class": "devui-comment-author"
|
|
68
|
-
}, [author]), createVNode("div", {
|
|
69
|
-
"class": "devui-comment-datetime"
|
|
70
|
-
}, [datetime])]), createVNode("div", {
|
|
71
|
-
"class": "devui-comment-content"
|
|
72
|
-
}, [content]), actionDom])]);
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
var index = {
|
|
77
|
-
title: "Comment \u8BC4\u8BBA",
|
|
78
|
-
category: "\u6570\u636E\u5C55\u793A",
|
|
79
|
-
status: "100%",
|
|
80
|
-
install(app) {
|
|
81
|
-
app.component(Comment.name, Comment);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
export { Comment, commentProps, index as default };
|
package/comment/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.index={},n.Vue))})(this,function(n,e){"use strict";const m={actions:{type:Object,default:null},author:{type:Object,default:null},avatar:{type:Object,default:null},content:{type:Object,default:null},datetime:{type:Object,default:null}};var P="",i=e.defineComponent({name:"DComment",props:m,emits:[],slots:["actions","author","avatar","content","datetime"],setup(a,{slots:t}){return()=>{var u,r,f,v,l,y,h,V,p,N;const j=d=>!d||!d.length?null:d.map((L,b)=>e.createVNode("li",{key:`devui-comment-action-${b}`,class:`devui-comment-action-${b}`},[L])),c=(r=a.actions)!=null?r:(u=t.actions)==null?void 0:u.call(t),C=(v=a.author)!=null?v:(f=t.author)==null?void 0:f.call(t),o=(y=a.avatar)!=null?y:(l=t.avatar)==null?void 0:l.call(t),O=(V=a.content)!=null?V:(h=t.content)==null?void 0:h.call(t),A=(N=a.datetime)!=null?N:(p=t.datetime)==null?void 0:p.call(t),s=e.createVNode("div",{class:"devui-comment-avatar"},[typeof o=="string"?e.createVNode("img",{src:o,alt:"comment-avatar"},null):o]),B=Array.isArray(c)?c:[c],D=c?e.createVNode("ul",{class:"devui-comment-actions"},[j(B)]):null;return e.createVNode("div",{class:"devui-comment"},[s,e.createVNode("div",{class:"devui-comment-right"},[e.createVNode("div",{class:"devui-comment-head"},[e.createVNode("div",{class:"devui-comment-author"},[C]),e.createVNode("div",{class:"devui-comment-datetime"},[A])]),e.createVNode("div",{class:"devui-comment-content"},[O]),D])])}}}),g={title:"Comment \u8BC4\u8BBA",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(a){a.component(i.name,i)}};n.Comment=i,n.commentProps=m,n.default=g,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"});
|
package/comment/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.devui-comment{display:flex;align-items:flex-start}.devui-comment-avatar{margin:0 16px 0 0}.devui-comment-head{display:flex;align-items:center}.devui-comment-author{padding:0 8px 0 0;font-size:var(--devui-font-size, 12px);color:var(--devui-text-weak, #575d6c)}.devui-comment-datetime{font-size:var(--devui-font-size, 12px);color:var(--devui-aide-text, #8a8e99)}.devui-comment-content{font-size:var(--devui-text, #252b3a)}.devui-comment-actions{padding:0;list-style-type:none;margin:12px 0 0}
|
package/read-tip/index.d.ts
DELETED
package/read-tip/index.es.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { defineComponent, toRefs, reactive, ref, onMounted, createVNode, Teleport, Fragment, onUnmounted } from "vue";
|
|
18
|
-
const readTipProps = {
|
|
19
|
-
readTipOptions: {
|
|
20
|
-
type: Object
|
|
21
|
-
},
|
|
22
|
-
defaultTemplateProps: {
|
|
23
|
-
type: Object
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var readTip = "";
|
|
27
|
-
var TipsTemplate = defineComponent({
|
|
28
|
-
name: "DReadTipTemplate",
|
|
29
|
-
props: readTipProps,
|
|
30
|
-
emits: [],
|
|
31
|
-
setup(props, ctx) {
|
|
32
|
-
const {
|
|
33
|
-
defaultTemplateProps
|
|
34
|
-
} = toRefs(props);
|
|
35
|
-
let rule = defaultTemplateProps.value;
|
|
36
|
-
const query = (rule == null ? void 0 : rule.id) ? `#${rule.id}` : rule.selector;
|
|
37
|
-
const styles = reactive({});
|
|
38
|
-
if (typeof rule.dataFn === "function") {
|
|
39
|
-
const dataFn = rule.dataFn({
|
|
40
|
-
element: document.querySelector(query),
|
|
41
|
-
rule
|
|
42
|
-
});
|
|
43
|
-
rule = __spreadValues(__spreadValues({}, rule), dataFn);
|
|
44
|
-
}
|
|
45
|
-
const temp = ref(null);
|
|
46
|
-
const deviation = (x) => {
|
|
47
|
-
let deviationConstant = x > 24 ? 0 : -(x / 2) + 2;
|
|
48
|
-
if (x <= 10) {
|
|
49
|
-
deviationConstant = -10;
|
|
50
|
-
}
|
|
51
|
-
return deviationConstant;
|
|
52
|
-
};
|
|
53
|
-
onMounted(() => {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
const domBounding = (_a = document.querySelector(query)) == null ? void 0 : _a.getBoundingClientRect();
|
|
56
|
-
const {
|
|
57
|
-
width,
|
|
58
|
-
height
|
|
59
|
-
} = domBounding;
|
|
60
|
-
const distance = 10;
|
|
61
|
-
let positionTop = 0;
|
|
62
|
-
const heightDeviation = deviation(height);
|
|
63
|
-
const widthDeviation = deviation(width);
|
|
64
|
-
let positionLeft = 0;
|
|
65
|
-
const targetDom = (_b = document.querySelector(".read-tip-container")) == null ? void 0 : _b.getBoundingClientRect();
|
|
66
|
-
if (rule.appendToBody) {
|
|
67
|
-
positionTop = domBounding.y + document.documentElement.scrollTop;
|
|
68
|
-
positionLeft = domBounding.x;
|
|
69
|
-
}
|
|
70
|
-
switch (rule.position) {
|
|
71
|
-
case "top":
|
|
72
|
-
styles.top = positionTop - targetDom.height - distance + "px";
|
|
73
|
-
styles.left = positionLeft + widthDeviation + "px";
|
|
74
|
-
break;
|
|
75
|
-
case "left":
|
|
76
|
-
styles.top = positionTop + heightDeviation + "px";
|
|
77
|
-
styles.left = positionLeft - targetDom.width - distance + "px";
|
|
78
|
-
break;
|
|
79
|
-
case "bottom":
|
|
80
|
-
styles.top = positionTop + domBounding.height + distance + "px";
|
|
81
|
-
styles.left = positionLeft + widthDeviation + "px";
|
|
82
|
-
break;
|
|
83
|
-
case "right":
|
|
84
|
-
styles.top = positionTop + heightDeviation + "px";
|
|
85
|
-
styles.left = positionLeft + domBounding.width + distance + "px";
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
return () => {
|
|
90
|
-
return createVNode(Teleport, {
|
|
91
|
-
"to": rule.appendToBody ? "body" : query
|
|
92
|
-
}, {
|
|
93
|
-
default: () => {
|
|
94
|
-
var _a, _b;
|
|
95
|
-
return [createVNode("div", {
|
|
96
|
-
"ref": temp,
|
|
97
|
-
"class": ["read-tip-container", rule.position, rule.overlayClassName],
|
|
98
|
-
"style": styles
|
|
99
|
-
}, [createVNode("span", {
|
|
100
|
-
"class": "after"
|
|
101
|
-
}, null), rule.contentTemplate ? (_b = (_a = ctx.slots) == null ? void 0 : _a.default) == null ? void 0 : _b.call(_a) : createVNode(Fragment, null, [createVNode("div", {
|
|
102
|
-
"class": "title"
|
|
103
|
-
}, [rule.title]), createVNode("div", {
|
|
104
|
-
"class": "content"
|
|
105
|
-
}, [rule.content])])])];
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const rules = (ruleList) => {
|
|
112
|
-
if (ruleList === null) {
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
if (typeof ruleList === "object" && !Array.isArray(ruleList)) {
|
|
116
|
-
ruleList = [ruleList];
|
|
117
|
-
}
|
|
118
|
-
ruleList = [...ruleList];
|
|
119
|
-
Array.isArray(ruleList) && ruleList.map((rule) => {
|
|
120
|
-
rule.status = false;
|
|
121
|
-
});
|
|
122
|
-
return ruleList;
|
|
123
|
-
};
|
|
124
|
-
var ReadTip = defineComponent({
|
|
125
|
-
name: "DReadTip",
|
|
126
|
-
props: readTipProps,
|
|
127
|
-
emits: [],
|
|
128
|
-
setup(props, ctx) {
|
|
129
|
-
const defaultOptions = {
|
|
130
|
-
trigger: "hover",
|
|
131
|
-
showAnimate: false,
|
|
132
|
-
mouseenterTime: 100,
|
|
133
|
-
mouseleaveTime: 100,
|
|
134
|
-
position: "top",
|
|
135
|
-
overlayClassName: "",
|
|
136
|
-
appendToBody: true,
|
|
137
|
-
rules: {
|
|
138
|
-
selector: null
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
const options = __spreadValues(__spreadValues({}, defaultOptions), props.readTipOptions);
|
|
142
|
-
const defaultSlot = ref(null);
|
|
143
|
-
const refRules = reactive(rules(options.rules));
|
|
144
|
-
const onMouseenter = (rule) => () => {
|
|
145
|
-
setTimeout(() => {
|
|
146
|
-
if (rule.id) {
|
|
147
|
-
const a = refRules.find((u) => u.id === rule.id);
|
|
148
|
-
a.status = true;
|
|
149
|
-
}
|
|
150
|
-
rule.status = true;
|
|
151
|
-
}, rule.mouseenterTime || options.mouseenterTime);
|
|
152
|
-
};
|
|
153
|
-
const onMouseleave = (rule) => () => {
|
|
154
|
-
setTimeout(() => {
|
|
155
|
-
if (rule.id) {
|
|
156
|
-
const a = refRules.find((u) => u.id === rule.id);
|
|
157
|
-
a.status = false;
|
|
158
|
-
}
|
|
159
|
-
rule.status = false;
|
|
160
|
-
}, rule.mouseleaveTime || options.mouseleaveTime);
|
|
161
|
-
};
|
|
162
|
-
const init = (ruleList, trigger = "hover") => {
|
|
163
|
-
ruleList.map((rule) => {
|
|
164
|
-
var _a;
|
|
165
|
-
rule.status = false;
|
|
166
|
-
trigger = rule.trigger || trigger;
|
|
167
|
-
rule.overlayClassName = rule.overlayClassName || options.overlayClassName;
|
|
168
|
-
rule.position = rule.position || options.position;
|
|
169
|
-
rule.contentTemplate = !!ctx.slots.contentTemplate;
|
|
170
|
-
if (!("appendToBody" in rule)) {
|
|
171
|
-
rule.appendToBody = options.appendToBody;
|
|
172
|
-
}
|
|
173
|
-
const doms = (_a = defaultSlot.value) == null ? void 0 : _a.querySelectorAll(rule.selector);
|
|
174
|
-
[...doms].map((dom, index2) => {
|
|
175
|
-
if (rule.appendToBody === false) {
|
|
176
|
-
dom.style.position = "relative";
|
|
177
|
-
}
|
|
178
|
-
let newRule = reactive({
|
|
179
|
-
id: null
|
|
180
|
-
});
|
|
181
|
-
const id = rule.selector.slice(rule.selector[0] === "." ? 1 : 0) + index2;
|
|
182
|
-
if (index2 > 0) {
|
|
183
|
-
newRule = __spreadValues({}, rule);
|
|
184
|
-
dom.id = id;
|
|
185
|
-
newRule.id = id;
|
|
186
|
-
ruleList.push(newRule);
|
|
187
|
-
}
|
|
188
|
-
if (trigger === "hover") {
|
|
189
|
-
dom.addEventListener("mouseenter", onMouseenter(newRule.id ? newRule : rule));
|
|
190
|
-
dom.addEventListener("mouseleave", onMouseleave(newRule.id ? newRule : rule));
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
return ruleList;
|
|
195
|
-
};
|
|
196
|
-
function show(_, rule) {
|
|
197
|
-
rule.status = true;
|
|
198
|
-
}
|
|
199
|
-
const clickFn = () => {
|
|
200
|
-
refRules.forEach((element) => {
|
|
201
|
-
element.status = false;
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
onMounted(() => {
|
|
205
|
-
init(refRules, options.trigger);
|
|
206
|
-
document.addEventListener("click", clickFn, true);
|
|
207
|
-
});
|
|
208
|
-
onUnmounted(() => {
|
|
209
|
-
document.removeEventListener("click", clickFn);
|
|
210
|
-
});
|
|
211
|
-
const onClick = (e) => {
|
|
212
|
-
var _a;
|
|
213
|
-
for (const rule of refRules) {
|
|
214
|
-
const doms = (_a = defaultSlot.value) == null ? void 0 : _a.querySelectorAll(rule.selector);
|
|
215
|
-
for (const dom of doms) {
|
|
216
|
-
if (doms.length > 1) {
|
|
217
|
-
if (dom === e.target && rule.id) {
|
|
218
|
-
show(dom, rule);
|
|
219
|
-
return;
|
|
220
|
-
} else if (dom === e.target && !rule.id && !dom.id) {
|
|
221
|
-
show(dom, rule);
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
} else if (dom === e.target) {
|
|
225
|
-
show(dom, rule);
|
|
226
|
-
return;
|
|
227
|
-
} else {
|
|
228
|
-
rule.status = false;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
return () => {
|
|
234
|
-
var _a, _b;
|
|
235
|
-
return createVNode("div", {
|
|
236
|
-
"class": "devui-read-tip"
|
|
237
|
-
}, [createVNode("div", {
|
|
238
|
-
"ref": defaultSlot,
|
|
239
|
-
"onClick": onClick
|
|
240
|
-
}, [(_b = (_a = ctx.slots) == null ? void 0 : _a.default) == null ? void 0 : _b.call(_a)]), refRules.map((rule) => createVNode("div", {
|
|
241
|
-
"data-test": "todo"
|
|
242
|
-
}, [rule.status && createVNode(TipsTemplate, {
|
|
243
|
-
"defaultTemplateProps": __spreadValues({}, rule)
|
|
244
|
-
}, {
|
|
245
|
-
default: () => {
|
|
246
|
-
var _a2, _b2;
|
|
247
|
-
return [rule.contentTemplate && ((_b2 = (_a2 = ctx.slots) == null ? void 0 : _a2.contentTemplate) == null ? void 0 : _b2.call(_a2))];
|
|
248
|
-
}
|
|
249
|
-
})]))]);
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
var index = {
|
|
254
|
-
title: "ReadTip \u9605\u8BFB\u63D0\u793A",
|
|
255
|
-
category: "\u53CD\u9988",
|
|
256
|
-
status: "100%",
|
|
257
|
-
install(app) {
|
|
258
|
-
app.component(ReadTip.name, ReadTip);
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
export { ReadTip, index as default, readTipProps };
|
package/read-tip/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var D=Object.defineProperty;var k=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var w=(s,e,p)=>e in s?D(s,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):s[e]=p,h=(s,e)=>{for(var p in e||(e={}))O.call(e,p)&&w(s,p,e[p]);if(k)for(var p of k(e))E.call(e,p)&&w(s,p,e[p]);return s};(function(s,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,e(s.index={},s.Vue))})(this,function(s,e){"use strict";const p={readTipOptions:{type:Object},defaultTemplateProps:{type:Object}};var F="",A=e.defineComponent({name:"DReadTipTemplate",props:p,emits:[],setup(d,m){const{defaultTemplateProps:V}=e.toRefs(d);let n=V.value;const u=(n==null?void 0:n.id)?`#${n.id}`:n.selector,c=e.reactive({});if(typeof n.dataFn=="function"){const a=n.dataFn({element:document.querySelector(u),rule:n});n=h(h({},n),a)}const b=e.ref(null),N=a=>{let f=a>24?0:-(a/2)+2;return a<=10&&(f=-10),f};return e.onMounted(()=>{var T,g;const a=(T=document.querySelector(u))==null?void 0:T.getBoundingClientRect(),{width:f,height:C}=a,v=10;let o=0;const i=N(C),t=N(f);let l=0;const r=(g=document.querySelector(".read-tip-container"))==null?void 0:g.getBoundingClientRect();switch(n.appendToBody&&(o=a.y+document.documentElement.scrollTop,l=a.x),n.position){case"top":c.top=o-r.height-v+"px",c.left=l+t+"px";break;case"left":c.top=o+i+"px",c.left=l-r.width-v+"px";break;case"bottom":c.top=o+a.height+v+"px",c.left=l+t+"px";break;case"right":c.top=o+i+"px",c.left=l+a.width+v+"px";break}}),()=>e.createVNode(e.Teleport,{to:n.appendToBody?"body":u},{default:()=>{var a,f;return[e.createVNode("div",{ref:b,class:["read-tip-container",n.position,n.overlayClassName],style:c},[e.createVNode("span",{class:"after"},null),n.contentTemplate?(f=(a=m.slots)==null?void 0:a.default)==null?void 0:f.call(a):e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"title"},[n.title]),e.createVNode("div",{class:"content"},[n.content])])])]}})}});const S=d=>d===null?[]:(typeof d=="object"&&!Array.isArray(d)&&(d=[d]),d=[...d],Array.isArray(d)&&d.map(m=>{m.status=!1}),d);var B=e.defineComponent({name:"DReadTip",props:p,emits:[],setup(d,m){const n=h(h({},{trigger:"hover",showAnimate:!1,mouseenterTime:100,mouseleaveTime:100,position:"top",overlayClassName:"",appendToBody:!0,rules:{selector:null}}),d.readTipOptions),u=e.ref(null),c=e.reactive(S(n.rules)),b=o=>()=>{setTimeout(()=>{if(o.id){const i=c.find(t=>t.id===o.id);i.status=!0}o.status=!0},o.mouseenterTime||n.mouseenterTime)},N=o=>()=>{setTimeout(()=>{if(o.id){const i=c.find(t=>t.id===o.id);i.status=!1}o.status=!1},o.mouseleaveTime||n.mouseleaveTime)},a=(o,i="hover")=>(o.map(t=>{var r;t.status=!1,i=t.trigger||i,t.overlayClassName=t.overlayClassName||n.overlayClassName,t.position=t.position||n.position,t.contentTemplate=!!m.slots.contentTemplate,"appendToBody"in t||(t.appendToBody=n.appendToBody),[...(r=u.value)==null?void 0:r.querySelectorAll(t.selector)].map((T,g)=>{t.appendToBody===!1&&(T.style.position="relative");let y=e.reactive({id:null});const R=t.selector.slice(t.selector[0]==="."?1:0)+g;g>0&&(y=h({},t),T.id=R,y.id=R,o.push(y)),i==="hover"&&(T.addEventListener("mouseenter",b(y.id?y:t)),T.addEventListener("mouseleave",N(y.id?y:t)))})}),o);function f(o,i){i.status=!0}const C=()=>{c.forEach(o=>{o.status=!1})};e.onMounted(()=>{a(c,n.trigger),document.addEventListener("click",C,!0)}),e.onUnmounted(()=>{document.removeEventListener("click",C)});const v=o=>{var i;for(const t of c){const l=(i=u.value)==null?void 0:i.querySelectorAll(t.selector);for(const r of l)if(l.length>1){if(r===o.target&&t.id){f(r,t);return}else if(r===o.target&&!t.id&&!r.id){f(r,t);return}}else if(r===o.target){f(r,t);return}else t.status=!1}};return()=>{var o,i;return e.createVNode("div",{class:"devui-read-tip"},[e.createVNode("div",{ref:u,onClick:v},[(i=(o=m.slots)==null?void 0:o.default)==null?void 0:i.call(o)]),c.map(t=>e.createVNode("div",{"data-test":"todo"},[t.status&&e.createVNode(A,{defaultTemplateProps:h({},t)},{default:()=>{var l,r;return[t.contentTemplate&&((r=(l=m.slots)==null?void 0:l.contentTemplate)==null?void 0:r.call(l))]}})]))])}}}),q={title:"ReadTip \u9605\u8BFB\u63D0\u793A",category:"\u53CD\u9988",status:"100%",install(d){d.component(B.name,B)}};s.ReadTip=B,s.default=q,s.readTipProps=p,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
|
package/read-tip/package.json
DELETED
package/read-tip/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.devui-read-tip{position:relative}.devui-read-tip .title{font-size:16px}.source{overflow:initial}.read-tip-container{font-size:var(--devui-font-size, 12px);position:absolute;width:max-content;height:max-content;line-height:1.5;border:none;border-radius:var(--devui-border-radius-feedback, 4px);background-color:var(--devui-feedback-overlay-bg, #464d6e);color:var(--devui-feedback-overlay-text, #dfe1e6);overflow-wrap:break-word;padding:10px;z-index:50}.read-tip-container .after{content:"";width:12px;height:12px;transform:rotate(45deg);position:absolute;background-color:var(--devui-feedback-overlay-bg, #464d6e)}.read-tip-container.top .after{bottom:-4px}.read-tip-container.left .after{right:-4px}.read-tip-container.right .after{left:-4px}.read-tip-container.bottom .after{top:-4px}
|