vue-devui 1.0.0-beta.5 → 1.0.0-beta.6
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/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +186 -139
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/anchor/index.d.ts +7 -0
- package/avatar/index.d.ts +7 -0
- package/back-top/index.d.ts +7 -0
- package/badge/index.d.ts +7 -0
- package/breadcrumb/index.d.ts +7 -0
- package/button/index.d.ts +7 -0
- package/card/index.d.ts +7 -0
- package/carousel/index.d.ts +7 -0
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1239 -83
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/date-picker/index.d.ts +7 -0
- package/dragdrop/index.d.ts +7 -0
- package/drawer/index.d.ts +7 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +1 -1
- package/dropdown/index.umd.js +1 -1
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +49 -22
- package/editable-select/index.umd.js +10 -10
- package/form/index.d.ts +7 -0
- package/form/style.css +1 -1
- package/fullscreen/index.d.ts +7 -0
- package/gantt/index.d.ts +7 -0
- package/grid/index.d.ts +7 -0
- package/icon/index.d.ts +7 -0
- package/image-preview/index.d.ts +7 -0
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input-number/index.d.ts +7 -0
- package/layout/index.d.ts +7 -0
- package/loading/index.d.ts +7 -0
- package/modal/index.d.ts +7 -0
- package/nav-sprite/index.d.ts +7 -0
- package/overlay/index.d.ts +7 -0
- package/package.json +3 -2
- package/pagination/index.d.ts +7 -0
- package/panel/index.d.ts +7 -0
- package/popover/index.d.ts +7 -0
- package/progress/index.d.ts +7 -0
- package/quadrant-diagram/index.d.ts +7 -0
- package/radio/index.d.ts +7 -0
- package/rate/index.d.ts +7 -0
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +59 -23
- package/read-tip/index.umd.js +1 -1
- package/read-tip/style.css +1 -1
- package/ripple/index.d.ts +7 -0
- package/search/index.d.ts +7 -0
- package/select/index.d.ts +7 -0
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +147 -25
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/splitter/index.d.ts +7 -0
- package/status/index.d.ts +7 -0
- package/steps-guide/index.d.ts +7 -0
- package/sticky/index.d.ts +7 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/table/index.d.ts +7 -0
- package/tabs/index.d.ts +7 -0
- package/tag/index.d.ts +7 -0
- package/tag-input/index.d.ts +7 -0
- package/textarea/index.d.ts +7 -0
- package/time-axis/index.d.ts +7 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9 -4
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/tooltip/index.d.ts +7 -0
- package/transfer/index.d.ts +7 -0
- package/tree/index.d.ts +7 -0
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +435 -110
- package/tree-select/index.umd.js +1 -1
- package/tree-select/style.css +1 -1
- package/upload/index.d.ts +7 -0
- package/vue-devui.es.js +12067 -11394
- package/vue-devui.umd.js +11 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-devui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "DevUI components based on Vite and Vue3",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"serve": "vitepress serve docs",
|
|
28
28
|
"app:dev": "vite",
|
|
29
29
|
"app:build": "vite build",
|
|
30
|
-
"build:lib": "yarn predev && yarn build:components && yarn
|
|
30
|
+
"build:lib": "yarn predev && yarn build:components && yarn copy",
|
|
31
31
|
"test": "jest --config jest.config.js",
|
|
32
32
|
"ls-lint": "ls-lint",
|
|
33
33
|
"lint": "eslint \"{src,devui}/**/*.{vue,js,ts,jsx,tsx}\"",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"stylelint": "stylelint --fix \"{devui,src}/**/*.{scss,css}\"",
|
|
36
36
|
"build:components": "node ./devui-cli/index.js build",
|
|
37
37
|
"generate:theme": "node ./devui-cli/index.js generate:theme",
|
|
38
|
+
"generate:dts": "node ./devui-cli/index.js generate:dts",
|
|
38
39
|
"copy": "cp package.json build && cp README.md build && cp devui/theme/theme.scss build/theme",
|
|
39
40
|
"clean:cli": "npm uninstall -g devui-cli & npm uninstall -g vue-devui",
|
|
40
41
|
"cli:create": "node ./devui-cli/index.js create -t component",
|
package/panel/index.d.ts
ADDED
package/radio/index.d.ts
ADDED
package/rate/index.d.ts
ADDED
package/read-tip/index.es.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,8 +14,7 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
|
-
import { defineComponent, ref, onMounted, createVNode, Teleport, Fragment, reactive, onUnmounted } from "vue";
|
|
17
|
+
import { defineComponent, toRefs, reactive, ref, onMounted, createVNode, Teleport, Fragment, onUnmounted } from "vue";
|
|
21
18
|
const readTipProps = {
|
|
22
19
|
readTipOptions: {
|
|
23
20
|
type: Object
|
|
@@ -32,30 +29,66 @@ var TipsTemplate = defineComponent({
|
|
|
32
29
|
props: readTipProps,
|
|
33
30
|
emits: [],
|
|
34
31
|
setup(props, ctx) {
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
}
|
|
37
45
|
const temp = ref(null);
|
|
38
46
|
onMounted(() => {
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
const domBounding = document.querySelector(query).getBoundingClientRect();
|
|
48
|
+
const distance = 10;
|
|
49
|
+
let positionTop = 0;
|
|
50
|
+
let positionLeft = 0;
|
|
51
|
+
const targetDom = document.querySelector(".read-tip-container").getBoundingClientRect();
|
|
52
|
+
if (rule.appendToBody) {
|
|
53
|
+
positionTop = domBounding.y + document.documentElement.scrollTop;
|
|
54
|
+
positionLeft = domBounding.x;
|
|
55
|
+
}
|
|
56
|
+
switch (rule.position) {
|
|
57
|
+
case "top":
|
|
58
|
+
styles.top = positionTop - targetDom.height - distance + "px";
|
|
59
|
+
styles.left = positionLeft + "px";
|
|
60
|
+
break;
|
|
61
|
+
case "left":
|
|
62
|
+
styles.top = positionTop + "px";
|
|
63
|
+
styles.left = positionLeft - targetDom.width - distance + "px";
|
|
64
|
+
break;
|
|
65
|
+
case "bottom":
|
|
66
|
+
styles.top = positionTop + domBounding.height + distance + "px";
|
|
67
|
+
styles.left = positionLeft + "px";
|
|
68
|
+
break;
|
|
69
|
+
case "right":
|
|
70
|
+
styles.top = positionTop + "px";
|
|
71
|
+
styles.left = positionLeft + domBounding.width + distance + "px";
|
|
72
|
+
break;
|
|
41
73
|
}
|
|
42
74
|
});
|
|
43
75
|
return () => {
|
|
44
76
|
return createVNode(Teleport, {
|
|
45
|
-
"to": query
|
|
77
|
+
"to": rule.appendToBody ? "body" : query
|
|
46
78
|
}, {
|
|
47
79
|
default: () => {
|
|
48
|
-
var
|
|
80
|
+
var _a;
|
|
49
81
|
return [createVNode("div", {
|
|
50
82
|
"ref": temp,
|
|
51
|
-
"class": ["read-tip-container",
|
|
83
|
+
"class": ["read-tip-container", rule.position, rule.overlayClassName],
|
|
84
|
+
"style": styles
|
|
52
85
|
}, [createVNode("span", {
|
|
53
86
|
"class": "after"
|
|
54
|
-
}, null),
|
|
87
|
+
}, null), rule.contentTemplate ? (_a = ctx.slots) == null ? void 0 : _a.default() : createVNode(Fragment, null, [createVNode("div", {
|
|
55
88
|
"class": "title"
|
|
56
|
-
}, [
|
|
89
|
+
}, [rule.title]), createVNode("div", {
|
|
57
90
|
"class": "content"
|
|
58
|
-
}, [
|
|
91
|
+
}, [rule.content])])])];
|
|
59
92
|
}
|
|
60
93
|
});
|
|
61
94
|
};
|
|
@@ -78,7 +111,7 @@ var ReadTip = defineComponent({
|
|
|
78
111
|
selector: null
|
|
79
112
|
}
|
|
80
113
|
};
|
|
81
|
-
|
|
114
|
+
ref(0);
|
|
82
115
|
const options = __spreadValues(__spreadValues({}, defaultOptions), props.readTipOptions);
|
|
83
116
|
const defaultSlot = ref(null);
|
|
84
117
|
const onMouseenter = (rule) => () => {
|
|
@@ -103,17 +136,23 @@ var ReadTip = defineComponent({
|
|
|
103
136
|
rules2.map((rule) => {
|
|
104
137
|
rule.status = false;
|
|
105
138
|
trigger = rule.trigger || trigger;
|
|
139
|
+
rule.overlayClassName = rule.overlayClassName || options.overlayClassName;
|
|
140
|
+
rule.position = rule.position || options.position;
|
|
106
141
|
rule.contentTemplate = !!ctx.slots.contentTemplate;
|
|
142
|
+
if (!("appendToBody" in rule))
|
|
143
|
+
rule.appendToBody = options.appendToBody;
|
|
107
144
|
const doms = defaultSlot.value.querySelectorAll(rule.selector);
|
|
108
145
|
[...doms].map((dom, index2) => {
|
|
109
|
-
|
|
146
|
+
if (rule.appendToBody === false)
|
|
147
|
+
dom.style.position = "relative";
|
|
110
148
|
let newRule = reactive({
|
|
111
149
|
id: null
|
|
112
150
|
});
|
|
151
|
+
const id = rule.selector.slice(rule.selector[0] === "." ? 1 : 0) + index2;
|
|
113
152
|
if (index2 > 0) {
|
|
114
153
|
newRule = __spreadValues({}, rule);
|
|
115
|
-
dom.id =
|
|
116
|
-
newRule.id =
|
|
154
|
+
dom.id = id;
|
|
155
|
+
newRule.id = id;
|
|
117
156
|
rules2.push(newRule);
|
|
118
157
|
}
|
|
119
158
|
if (trigger === "hover") {
|
|
@@ -125,7 +164,6 @@ var ReadTip = defineComponent({
|
|
|
125
164
|
return rules2;
|
|
126
165
|
};
|
|
127
166
|
function show(dom, rule) {
|
|
128
|
-
dom.offsetTop;
|
|
129
167
|
rule.status = true;
|
|
130
168
|
}
|
|
131
169
|
const rules = (rules2) => {
|
|
@@ -182,9 +220,7 @@ var ReadTip = defineComponent({
|
|
|
182
220
|
"ref": defaultSlot,
|
|
183
221
|
"onClick": onClick
|
|
184
222
|
}, [(_a = ctx.slots) == null ? void 0 : _a.default()]), refRules.map((rule) => createVNode("div", null, [rule.status && createVNode(TipsTemplate, {
|
|
185
|
-
"defaultTemplateProps":
|
|
186
|
-
top: tempTop
|
|
187
|
-
})
|
|
223
|
+
"defaultTemplateProps": __spreadValues({}, rule)
|
|
188
224
|
}, {
|
|
189
225
|
default: () => {
|
|
190
226
|
var _a2;
|
|
@@ -200,7 +236,7 @@ ReadTip.install = function(app) {
|
|
|
200
236
|
var index = {
|
|
201
237
|
title: "ReadTip \u9605\u8BFB\u63D0\u793A",
|
|
202
238
|
category: "\u53CD\u9988",
|
|
203
|
-
status: "
|
|
239
|
+
status: "50%",
|
|
204
240
|
install(app) {
|
|
205
241
|
app.use(ReadTip);
|
|
206
242
|
}
|
package/read-tip/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var q=Object.defineProperty;var R=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var k=(a,e,i)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,y=(a,e)=>{for(var i in e||(e={}))w.call(e,i)&&k(a,i,e[i]);if(R)for(var i of R(e))E.call(e,i)&&k(a,i,e[i]);return a};(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";const i={readTipOptions:{type:Object},defaultTemplateProps:{type:Object}};var F="",x=e.defineComponent({name:"DReadTipTemplate",props:i,emits:[],setup(f,g){const{defaultTemplateProps:B}=e.toRefs(f);let o=B.value;const m=(o==null?void 0:o.id)?`#${o.id}`:o.selector,c=e.reactive({});if(typeof o.dataFn=="function"){const r=o.dataFn({element:document.querySelector(m),rule:o});o=y(y({},o),r)}const C=e.ref(null);return e.onMounted(()=>{const r=document.querySelector(m).getBoundingClientRect(),l=10;let u=0,d=0;const v=document.querySelector(".read-tip-container").getBoundingClientRect();switch(o.appendToBody&&(u=r.y+document.documentElement.scrollTop,d=r.x),o.position){case"top":c.top=u-v.height-l+"px",c.left=d+"px";break;case"left":c.top=u+"px",c.left=d-v.width-l+"px";break;case"bottom":c.top=u+r.height+l+"px",c.left=d+"px";break;case"right":c.top=u+"px",c.left=d+r.width+l+"px";break}}),()=>e.createVNode(e.Teleport,{to:o.appendToBody?"body":m},{default:()=>{var r;return[e.createVNode("div",{ref:C,class:["read-tip-container",o.position,o.overlayClassName],style:c},[e.createVNode("span",{class:"after"},null),o.contentTemplate?(r=g.slots)==null?void 0:r.default():e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"title"},[o.title]),e.createVNode("div",{class:"content"},[o.content])])])]}})}}),h=e.defineComponent({name:"DReadTip",props:i,emits:[],setup(f,g){const B={trigger:"hover",showAnimate:!1,mouseenterTime:100,mouseleaveTime:100,position:"top",overlayClassName:"",appendToBody:!0,rules:{selector:null}};e.ref(0);const o=y(y({},B),f.readTipOptions),m=e.ref(null),c=t=>()=>{setTimeout(()=>{if(t.id){const s=d.find(n=>n.id===t.id);s.status=!0}t.status=!0},t.mouseenterTime||o.mouseenterTime)},C=t=>()=>{setTimeout(()=>{if(t.id){const s=d.find(n=>n.id===t.id);s.status=!1}t.status=!1},t.mouseleaveTime||o.mouseleaveTime)},r=(t,s="hover")=>(t.map(n=>{n.status=!1,s=n.trigger||s,n.overlayClassName=n.overlayClassName||o.overlayClassName,n.position=n.position||o.position,n.contentTemplate=!!g.slots.contentTemplate,"appendToBody"in n||(n.appendToBody=o.appendToBody),[...m.value.querySelectorAll(n.selector)].map((N,b)=>{n.appendToBody===!1&&(N.style.position="relative");let T=e.reactive({id:null});const V=n.selector.slice(n.selector[0]==="."?1:0)+b;b>0&&(T=y({},n),N.id=V,T.id=V,t.push(T)),s==="hover"&&(N.addEventListener("mouseenter",c(T.id?T:n)),N.addEventListener("mouseleave",C(T.id?T:n)))})}),t);function l(t,s){s.status=!0}const u=t=>{if(t!==null)return typeof t=="object"&&!Array.isArray(t)&&(t=[t]),t=[...t],Array.isArray(t)&&t.map(s=>{s.status=!1}),t},d=e.reactive(u(o.rules)),v=()=>{d.forEach(t=>{t.status=!1})};e.onMounted(()=>{r(d,o.trigger),document.addEventListener("click",v,!0)}),e.onUnmounted(()=>{document.removeEventListener("click",v)});const S=t=>{for(const s of d){const n=m.value.querySelectorAll(s.selector);for(const p of n)if(n.length>1){if(p===t.target&&s.id){l(p,s);return}else if(p===t.target&&!s.id&&!p.id){l(p,s);return}}else if(p===t.target){l(p,s);return}else s.status=!1}};return()=>{var t;return e.createVNode("div",{class:"devui-read-tip"},[e.createVNode("div",{ref:m,onClick:S},[(t=g.slots)==null?void 0:t.default()]),d.map(s=>e.createVNode("div",null,[s.status&&e.createVNode(x,{defaultTemplateProps:y({},s)},{default:()=>{var n;return[s.contentTemplate&&((n=g.slots)==null?void 0:n.contentTemplate())]}})]))])}}});h.install=function(f){f.component(h.name,h)};var A={title:"ReadTip \u9605\u8BFB\u63D0\u793A",category:"\u53CD\u9988",status:"50%",install(f){f.use(h)}};a.ReadTip=h,a.default=A,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
package/read-tip/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-font-size-base{font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:var(--devui-font-size, 12px);font-weight:normal;line-height:1.5}.devui-font-size-modal-title{font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:var(--devui-font-size-modal-title, 18px);font-weight:bold;line-height:1.5}.devui-font-size-page-title{font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:var(--devui-font-size-page-title, 16px);font-weight:bold;line-height:1.5}.devui-font-size-secondary-title{font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:var(--devui-font-size-card-title, 14px);font-weight:bold;line-height:1.5}.devui-read-tip{position:relative}.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
|
|
1
|
+
.devui-font-size-base{font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:var(--devui-font-size, 12px);font-weight:normal;line-height:1.5}.devui-font-size-modal-title{font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:var(--devui-font-size-modal-title, 18px);font-weight:bold;line-height:1.5}.devui-font-size-page-title{font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:var(--devui-font-size-page-title, 16px);font-weight:bold;line-height:1.5}.devui-font-size-secondary-title{font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:var(--devui-font-size-card-title, 14px);font-weight:bold;line-height:1.5}.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}
|
package/skeleton/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, createVNode, Fragment, withDirectives, vShow } from "vue";
|
|
1
|
+
import { defineComponent, createVNode, Fragment, withDirectives, vShow, mergeProps } from "vue";
|
|
2
2
|
var skeleton = "";
|
|
3
3
|
const skeletonProps = {
|
|
4
4
|
row: {
|
|
@@ -34,7 +34,7 @@ const skeletonProps = {
|
|
|
34
34
|
default: "40px"
|
|
35
35
|
},
|
|
36
36
|
avatarShape: {
|
|
37
|
-
|
|
37
|
+
type: String,
|
|
38
38
|
default: "round"
|
|
39
39
|
},
|
|
40
40
|
titleWidth: {
|
|
@@ -54,7 +54,7 @@ var Skeleton = defineComponent({
|
|
|
54
54
|
slots
|
|
55
55
|
} = ctx;
|
|
56
56
|
function renderAnimate(isAnimated) {
|
|
57
|
-
return isAnimated ? "devui-
|
|
57
|
+
return isAnimated ? "devui-skeleton__animated" : "";
|
|
58
58
|
}
|
|
59
59
|
function renderBorderRadius(isRound) {
|
|
60
60
|
return isRound ? "border-radius: 1em;" : "";
|
|
@@ -102,14 +102,17 @@ var Skeleton = defineComponent({
|
|
|
102
102
|
})();
|
|
103
103
|
return withDirectives(createVNode("div", {
|
|
104
104
|
"class": "devui-skeleton__paragraph"
|
|
105
|
-
}, [arr.map((
|
|
105
|
+
}, [arr.map((item2) => {
|
|
106
106
|
return createVNode("div", {
|
|
107
107
|
"class": "devui-skeleton__item",
|
|
108
|
-
"style": round ? "border-radius: 1em;" : `width: ${
|
|
108
|
+
"style": round ? "border-radius: 1em;" : `width: ${item2.width}`
|
|
109
109
|
}, null);
|
|
110
110
|
})]), [[vShow, isShown]]);
|
|
111
111
|
}
|
|
112
112
|
function renderAvatarStyle(avatarSize, avatarShape) {
|
|
113
|
+
function renderAvatarShape(avatarShape2) {
|
|
114
|
+
return avatarShape2 === "square" ? "" : "border-radius:50%;";
|
|
115
|
+
}
|
|
113
116
|
function renderAvatarSize(avatarSize2) {
|
|
114
117
|
switch (typeof avatarSize2) {
|
|
115
118
|
case "string":
|
|
@@ -118,9 +121,6 @@ var Skeleton = defineComponent({
|
|
|
118
121
|
return `width:${avatarSize2}px;height:${avatarSize2}px;`;
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
|
-
function renderAvatarShape(avatarShape2) {
|
|
122
|
-
return avatarShape2 === "square" ? "" : "border-radius:50%;";
|
|
123
|
-
}
|
|
124
124
|
return renderAvatarSize(avatarSize) + renderAvatarShape(avatarShape);
|
|
125
125
|
}
|
|
126
126
|
function renderTitle(isVisible, titleWidth, isRound) {
|
|
@@ -137,32 +137,154 @@ var Skeleton = defineComponent({
|
|
|
137
137
|
}
|
|
138
138
|
return renderTitleWidth(titleWidth) + renderBorderRadius(isRound) + renderTitleVisibility(isVisible);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function renderDefaultSkeleton() {
|
|
141
|
+
return createVNode(Fragment, null, [withDirectives(createVNode("div", {
|
|
142
|
+
"class": "devui-skeleton__avatar"
|
|
143
|
+
}, [createVNode("div", {
|
|
144
|
+
"class": "avatar",
|
|
145
|
+
"style": renderAvatarStyle(props.avatarSize, props.avatarShape)
|
|
146
|
+
}, null)]), [[vShow, props.avatar]]), createVNode("div", {
|
|
147
|
+
"class": "devui-skeleton__group"
|
|
148
|
+
}, [createVNode("div", {
|
|
149
|
+
"class": "devui-skeleton__title",
|
|
150
|
+
"style": renderTitle(props.title, props.titleWidth, props.round)
|
|
151
|
+
}, null), renderParagraph(props.paragraph, props.row, props.rowWidth, props.round)])]);
|
|
152
|
+
}
|
|
153
|
+
return () => {
|
|
141
154
|
var _a;
|
|
142
|
-
if (
|
|
143
|
-
return createVNode(
|
|
144
|
-
"class":
|
|
145
|
-
}, [
|
|
146
|
-
"class": "avatar",
|
|
147
|
-
"style": renderAvatarStyle(props.avatarSize, props.avatarShape)
|
|
148
|
-
}, null)]), [[vShow, props.avatar]]), createVNode("div", {
|
|
149
|
-
"class": "devui-skeleton__item__group"
|
|
150
|
-
}, [createVNode("div", {
|
|
151
|
-
"class": "devui-skeleton__title",
|
|
152
|
-
"style": renderTitle(props.title, props.titleWidth, props.round)
|
|
153
|
-
}, null), renderParagraph(props.paragraph, props.row, props.rowWidth, props.round)])]);
|
|
155
|
+
if (props.loading) {
|
|
156
|
+
return createVNode("div", {
|
|
157
|
+
"class": `devui-skeleton ${renderAnimate(props.animate)}`
|
|
158
|
+
}, [renderDefaultSkeleton()]);
|
|
154
159
|
}
|
|
155
160
|
return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var item = "";
|
|
165
|
+
const itemProps = {
|
|
166
|
+
row: {
|
|
167
|
+
type: Number,
|
|
168
|
+
default: 0
|
|
169
|
+
},
|
|
170
|
+
animate: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: true
|
|
173
|
+
},
|
|
174
|
+
round: {
|
|
175
|
+
type: Boolean,
|
|
176
|
+
default: false
|
|
177
|
+
},
|
|
178
|
+
loading: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: true
|
|
181
|
+
},
|
|
182
|
+
avatarShape: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: "round"
|
|
185
|
+
},
|
|
186
|
+
titleWidth: {
|
|
187
|
+
type: [String, Number],
|
|
188
|
+
default: "40%"
|
|
189
|
+
},
|
|
190
|
+
rowWidth: {
|
|
191
|
+
type: [Number, String, Array],
|
|
192
|
+
default: ["100%"]
|
|
193
|
+
},
|
|
194
|
+
shape: {
|
|
195
|
+
type: String
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var SkeletonItem = defineComponent({
|
|
199
|
+
name: "DSkeletonItem",
|
|
200
|
+
props: itemProps,
|
|
201
|
+
setup(props, ctx) {
|
|
202
|
+
const {
|
|
203
|
+
slots
|
|
204
|
+
} = ctx;
|
|
205
|
+
function renderAnimate(isAnimated) {
|
|
206
|
+
return isAnimated ? "devui-skeleton__animated" : "";
|
|
207
|
+
}
|
|
208
|
+
function renderShapeParagraph(rowNum, rowWidth, round) {
|
|
209
|
+
const arr = [];
|
|
210
|
+
function pushIntoArray(type) {
|
|
211
|
+
for (let index2 = 0; index2 < rowNum; index2++) {
|
|
212
|
+
arr.push({
|
|
213
|
+
width: type
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
(function handleRowWidth() {
|
|
218
|
+
if (rowWidth instanceof Array) {
|
|
219
|
+
for (let index2 = 0; index2 < rowNum; index2++) {
|
|
220
|
+
if (rowWidth[index2]) {
|
|
221
|
+
switch (typeof rowWidth[index2]) {
|
|
222
|
+
case "string":
|
|
223
|
+
arr.push({
|
|
224
|
+
width: rowWidth[index2]
|
|
225
|
+
});
|
|
226
|
+
break;
|
|
227
|
+
case "number":
|
|
228
|
+
arr.push({
|
|
229
|
+
width: `${rowWidth[index2]}px`
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
arr.push({
|
|
234
|
+
width: 1
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
switch (typeof rowWidth) {
|
|
240
|
+
case "string":
|
|
241
|
+
pushIntoArray(rowWidth);
|
|
242
|
+
break;
|
|
243
|
+
case "number":
|
|
244
|
+
pushIntoArray(`${rowWidth}px`);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
})();
|
|
249
|
+
return createVNode("div", mergeProps({
|
|
250
|
+
"class": `devui-skeleton__shape__paragraph ${renderAnimate(props.animate)}`
|
|
251
|
+
}, ctx.attrs), [arr.map((item2) => {
|
|
252
|
+
return createVNode("div", {
|
|
253
|
+
"class": "devui-skeleton__shape__paragraph__item",
|
|
254
|
+
"style": round ? "border-radius: 1em;" : `width: ${item2.width}`
|
|
255
|
+
}, null);
|
|
256
|
+
})]);
|
|
257
|
+
}
|
|
258
|
+
function renderAvatarStyle(avatarShape) {
|
|
259
|
+
function renderAvatarShape(avatarShape2) {
|
|
260
|
+
return avatarShape2 === "square" ? "" : "border-radius:50%;";
|
|
261
|
+
}
|
|
262
|
+
return renderAvatarShape(avatarShape);
|
|
156
263
|
}
|
|
157
264
|
return () => {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
265
|
+
var _a;
|
|
266
|
+
if (props.loading && props.shape) {
|
|
267
|
+
switch (props.shape) {
|
|
268
|
+
case "avatar":
|
|
269
|
+
return createVNode(Fragment, null, [createVNode("div", mergeProps({
|
|
270
|
+
"class": `devui-skeleton__shape__avatar ${renderAnimate(props.animate)}`,
|
|
271
|
+
"style": renderAvatarStyle(props.avatarShape)
|
|
272
|
+
}, ctx.attrs), null)]);
|
|
273
|
+
case "paragraph":
|
|
274
|
+
return createVNode(Fragment, null, [renderShapeParagraph(props.row, props.rowWidth, props.round)]);
|
|
275
|
+
default:
|
|
276
|
+
return createVNode(Fragment, null, [createVNode("div", mergeProps({
|
|
277
|
+
"class": `devui-skeleton__shape__${props.shape} ${renderAnimate(props.animate)}`
|
|
278
|
+
}, ctx.attrs), null)]);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
161
282
|
};
|
|
162
283
|
}
|
|
163
284
|
});
|
|
164
285
|
Skeleton.install = function(app) {
|
|
165
286
|
app.component(Skeleton.name, Skeleton);
|
|
287
|
+
app.component(SkeletonItem.name, SkeletonItem);
|
|
166
288
|
};
|
|
167
289
|
var index = {
|
|
168
290
|
title: "Skeleton \u9AA8\u67B6\u5C4F",
|
|
@@ -172,4 +294,4 @@ var index = {
|
|
|
172
294
|
app.use(Skeleton);
|
|
173
295
|
}
|
|
174
296
|
};
|
|
175
|
-
export { Skeleton, index as default };
|
|
297
|
+
export { Skeleton, SkeletonItem, index as default };
|
package/skeleton/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(l,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis!="undefined"?globalThis:l||self,e(l.index={},l.Vue))})(this,function(l,e){"use strict";var V="";const S={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatar:{type:Boolean,default:!1},title:{type:Boolean,default:!0},paragraph:{type:Boolean,default:!0},avatarSize:{type:[String,Number],default:"40px"},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]}};var m=e.defineComponent({name:"DSkeleton",props:S,setup(t,h){const{slots:f}=h;function p(a){return a?"devui-skeleton__animated":""}function b(a){return a?"border-radius: 1em;":""}function k(a,o,n,r){const i=[];function c(g){for(let s=0;s<o;s++)i.push({width:g})}return function(){if(n instanceof Array)for(let s=0;s<o;s++)if(n[s])switch(typeof n[s]){case"string":i.push({width:n[s]});break;case"number":i.push({width:`${n[s]}px`})}else i.push({width:1});else switch(typeof n){case"string":c(n);break;case"number":c(`${n}px`);break}}(),e.withDirectives(e.createVNode("div",{class:"devui-skeleton__paragraph"},[i.map(g=>e.createVNode("div",{class:"devui-skeleton__item",style:r?"border-radius: 1em;":`width: ${g.width}`},null))]),[[e.vShow,a]])}function u(a,o){function n(i){return i==="square"?"":"border-radius:50%;"}function r(i){switch(typeof i){case"string":return`width:${i};height:${i};`;case"number":return`width:${i}px;height:${i}px;`}}return r(a)+n(o)}function d(a,o,n){function r(c){switch(typeof c){case"string":return`width: ${c};`;case"number":return`width: ${c}px;`}}function i(c){return c?null:"visibility: hidden;"}return r(o)+b(n)+i(a)}function y(){return e.createVNode(e.Fragment,null,[e.withDirectives(e.createVNode("div",{class:"devui-skeleton__avatar"},[e.createVNode("div",{class:"avatar",style:u(t.avatarSize,t.avatarShape)},null)]),[[e.vShow,t.avatar]]),e.createVNode("div",{class:"devui-skeleton__group"},[e.createVNode("div",{class:"devui-skeleton__title",style:d(t.title,t.titleWidth,t.round)},null),k(t.paragraph,t.row,t.rowWidth,t.round)])])}return()=>{var a;return t.loading?e.createVNode("div",{class:`devui-skeleton ${p(t.animate)}`},[y()]):e.createVNode(e.Fragment,null,[(a=f.default)==null?void 0:a.call(f)])}}}),v="";const N={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]},shape:{type:String}};var _=e.defineComponent({name:"DSkeletonItem",props:N,setup(t,h){const{slots:f}=h;function p(u){return u?"devui-skeleton__animated":""}function b(u,d,y){const a=[];function o(n){for(let r=0;r<u;r++)a.push({width:n})}return function(){if(d instanceof Array)for(let r=0;r<u;r++)if(d[r])switch(typeof d[r]){case"string":a.push({width:d[r]});break;case"number":a.push({width:`${d[r]}px`})}else a.push({width:1});else switch(typeof d){case"string":o(d);break;case"number":o(`${d}px`);break}}(),e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__paragraph ${p(t.animate)}`},h.attrs),[a.map(n=>e.createVNode("div",{class:"devui-skeleton__shape__paragraph__item",style:y?"border-radius: 1em;":`width: ${n.width}`},null))])}function k(u){function d(y){return y==="square"?"":"border-radius:50%;"}return d(u)}return()=>{var u;if(t.loading&&t.shape)switch(t.shape){case"avatar":return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__avatar ${p(t.animate)}`,style:k(t.avatarShape)},h.attrs),null)]);case"paragraph":return e.createVNode(e.Fragment,null,[b(t.row,t.rowWidth,t.round)]);default:return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__${t.shape} ${p(t.animate)}`},h.attrs),null)])}return e.createVNode(e.Fragment,null,[(u=f.default)==null?void 0:u.call(f)])}}});m.install=function(t){t.component(m.name,m),t.component(_.name,_)};var w={title:"Skeleton \u9AA8\u67B6\u5C4F",category:"\u6570\u636E\u5C55\u793A",status:"\u5DF2\u5B8C\u6210",install(t){t.use(m)}};l.Skeleton=m,l.SkeletonItem=_,l.default=w,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
|
package/skeleton/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-skeleton{display:flex;justify-content:space-between}.devui-
|
|
1
|
+
.devui-skeleton{display:flex;justify-content:space-between}.devui-skeleton__avatar{display:flex;flex:1;justify-content:center;padding-right:16px}.devui-skeleton__avatar .avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__group{flex:11}.devui-skeleton__item,.devui-skeleton__title{width:100%;height:16px;background-color:#f2f2f2}.devui-skeleton__title{margin-top:24px}.devui-skeleton__paragraph{margin-top:12px}.devui-skeleton__item:last-child{width:60%}.devui-skeleton__avatar>.avatar,.devui-skeleton__group>div>.devui-skeleton__item{margin-top:12px}.devui-skeleton__animated>.devui-skeleton__group>.devui-skeleton__title,.devui-skeleton__animated>.devui-skeleton__group>div>.devui-skeleton__item,.devui-skeleton__animated>.devui-skeleton__avatar>.avatar{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}.devui-skeleton__shape__avatar,.devui-skeleton__shape__image,.devui-skeleton__shape__title,.devui-skeleton__shape__button{background-color:#f2f2f2}.devui-skeleton__shape__avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__shape__image{width:200px;height:150px;border-radius:4px}.devui-skeleton__shape__title{width:40%;height:24px}.devui-skeleton__shape__paragraph__item{background-color:#f2f2f2;width:100%;height:16px;margin-bottom:10px}.devui-skeleton__shape__paragraph__item:last-child{width:60%}.devui-skeleton__shape__button{width:115px;height:32px}@keyframes skeletonLoading{to{background-position-x:-20%}}.devui-skeleton__animated .devui-skeleton__shape__avatar,.devui-skeleton__animated.devui-skeleton__shape__avatar,.devui-skeleton__animated.devui-skeleton__shape__image,.devui-skeleton__animated.devui-skeleton__shape__title,.devui-skeleton__animated.devui-skeleton__shape__paragraph>.devui-skeleton__shape__paragraph__item,.devui-skeleton__animated.devui-skeleton__shape__button{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}
|