vue-devui 1.0.0-beta.15 → 1.0.0-beta.18
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 +187 -192
- package/accordion/index.es.js +8 -8
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.es.js +0 -3
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +2 -2
- package/back-top/index.es.js +1 -1
- package/back-top/index.umd.js +1 -1
- package/button/index.es.js +57 -83
- package/button/index.umd.js +1 -1
- package/button/style.css +1 -1
- package/cascader/index.es.js +5392 -772
- package/cascader/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/color-picker/index.es.js +5419 -191
- package/color-picker/index.umd.js +27 -1
- package/color-picker/style.css +1 -1
- package/countdown/index.es.js +7 -7
- package/date-picker/index.es.js +4 -5
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +5460 -46
- package/drawer/index.umd.js +27 -1
- package/drawer/style.css +1 -1
- package/editable-select/index.es.js +293 -5727
- package/editable-select/index.umd.js +1 -27
- package/editable-select/style.css +1 -1
- package/form/index.es.js +5432 -245
- package/form/index.umd.js +27 -1
- package/gantt/index.es.js +3 -15
- 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/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 +4 -5
- package/input-icon/index.umd.js +1 -1
- package/input-icon/style.css +1 -1
- package/loading/index.es.js +2 -2
- package/modal/index.es.js +56 -82
- 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/package.json +87 -88
- package/pagination/index.es.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +3 -3
- package/panel/index.umd.js +1 -1
- package/popover/index.es.js +1 -1
- package/quadrant-diagram/index.es.js +5405 -166
- package/quadrant-diagram/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/read-tip/style.css +1 -1
- package/ripple/index.es.js +1 -1
- package/search/index.es.js +5410 -172
- package/search/index.umd.js +27 -1
- package/search/style.css +1 -1
- package/select/index.es.js +1 -1
- package/select/style.css +1 -1
- package/splitter/index.es.js +2 -2
- package/splitter/index.umd.js +1 -1
- package/statistic/index.es.js +16 -29
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/style.css +1 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/table/index.es.js +92 -61
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/style.css +1 -1
- package/textarea/style.css +1 -1
- package/{theme → theme/theme.scss} +0 -0
- package/time-picker/index.es.js +56 -82
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.es.js +5373 -1518
- package/toast/index.umd.js +27 -1
- package/toast/style.css +1 -1
- package/tooltip/index.es.js +1 -1
- package/tooltip/index.umd.js +1 -1
- package/transfer/index.es.js +5466 -249
- package/transfer/index.umd.js +27 -1
- package/transfer/style.css +1 -1
- package/tree/index.es.js +5774 -192
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/tree-select/index.es.js +5 -5
- package/tree-select/index.umd.js +1 -1
- package/tree-select/style.css +1 -1
- package/upload/index.es.js +5373 -1518
- package/upload/index.umd.js +27 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +7928 -10069
- package/vue-devui.umd.js +16 -16
package/statistic/index.es.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { defineComponent, ref, computed, onMounted, watch, createVNode, mergeProps } from "vue";
|
|
7
|
+
import { defineComponent, ref, computed, onMounted, watch, createVNode, mergeProps, createTextVNode } from "vue";
|
|
8
8
|
const statisticProps = {
|
|
9
9
|
title: {
|
|
10
10
|
type: String,
|
|
@@ -26,14 +26,7 @@ const statisticProps = {
|
|
|
26
26
|
type: String,
|
|
27
27
|
default: ""
|
|
28
28
|
},
|
|
29
|
-
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: true
|
|
32
|
-
},
|
|
33
|
-
titleStyle: {
|
|
34
|
-
type: Object
|
|
35
|
-
},
|
|
36
|
-
contentStyle: {
|
|
29
|
+
valueStyle: {
|
|
37
30
|
type: Object
|
|
38
31
|
},
|
|
39
32
|
animationDuration: {
|
|
@@ -49,25 +42,17 @@ const statisticProps = {
|
|
|
49
42
|
},
|
|
50
43
|
start: {
|
|
51
44
|
type: Boolean,
|
|
52
|
-
default:
|
|
45
|
+
default: true
|
|
53
46
|
},
|
|
54
47
|
extra: {
|
|
55
48
|
type: String,
|
|
56
49
|
default: ""
|
|
57
|
-
},
|
|
58
|
-
easing: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: "easeOutCubic"
|
|
61
|
-
},
|
|
62
|
-
delay: {
|
|
63
|
-
type: Number,
|
|
64
|
-
default: 0
|
|
65
50
|
}
|
|
66
51
|
};
|
|
67
|
-
const separator = (SeparatorString, groupSeparator
|
|
52
|
+
const separator = (SeparatorString, groupSeparator) => {
|
|
68
53
|
const res = SeparatorString.replace(/\d+/, function(n) {
|
|
69
54
|
return n.replace(/(\d)(?=(\d{3})+$)/g, function($1) {
|
|
70
|
-
return $1 + `${
|
|
55
|
+
return $1 + `${groupSeparator}`;
|
|
71
56
|
});
|
|
72
57
|
});
|
|
73
58
|
return res;
|
|
@@ -77,13 +62,13 @@ const isHasDot = (value) => {
|
|
|
77
62
|
return (value + "").indexOf(".") !== -1;
|
|
78
63
|
}
|
|
79
64
|
};
|
|
80
|
-
const analysisValueType = (value, propsValue, groupSeparator, splitPrecisionNumber
|
|
65
|
+
const analysisValueType = (value, propsValue, groupSeparator, splitPrecisionNumber) => {
|
|
81
66
|
const fixedNumber = propsValue.toString().indexOf(".") !== -1 ? propsValue.toString().length - propsValue.toString().indexOf(".") - 1 : 0;
|
|
82
67
|
if (typeof value === "number") {
|
|
83
68
|
if (isHasDot(value)) {
|
|
84
|
-
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator
|
|
69
|
+
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator) : separator(value.toFixed(fixedNumber).toString(), groupSeparator);
|
|
85
70
|
} else {
|
|
86
|
-
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator
|
|
71
|
+
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator) : separator(value.toString(), groupSeparator);
|
|
87
72
|
}
|
|
88
73
|
} else {
|
|
89
74
|
return value;
|
|
@@ -220,9 +205,9 @@ var Statistic = defineComponent({
|
|
|
220
205
|
to: {
|
|
221
206
|
value: to
|
|
222
207
|
},
|
|
223
|
-
delay:
|
|
208
|
+
delay: 0,
|
|
224
209
|
duration: props.animationDuration,
|
|
225
|
-
easing:
|
|
210
|
+
easing: "easeOutCubic",
|
|
226
211
|
onUpdate: (keys) => {
|
|
227
212
|
innerValue.value = keys.value;
|
|
228
213
|
},
|
|
@@ -234,7 +219,7 @@ var Statistic = defineComponent({
|
|
|
234
219
|
}
|
|
235
220
|
};
|
|
236
221
|
const statisticValue = computed(() => {
|
|
237
|
-
return analysisValueType(innerValue.value, props.value, props.groupSeparator, props.precision
|
|
222
|
+
return analysisValueType(innerValue.value, props.value, props.groupSeparator, props.precision);
|
|
238
223
|
});
|
|
239
224
|
onMounted(() => {
|
|
240
225
|
if (props.animation && props.start) {
|
|
@@ -247,7 +232,7 @@ var Statistic = defineComponent({
|
|
|
247
232
|
}
|
|
248
233
|
});
|
|
249
234
|
return () => {
|
|
250
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
235
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
251
236
|
return createVNode("div", mergeProps({
|
|
252
237
|
"class": "devui-statistic"
|
|
253
238
|
}, ctx.attrs), [createVNode("div", {
|
|
@@ -255,14 +240,16 @@ var Statistic = defineComponent({
|
|
|
255
240
|
"style": props.titleStyle
|
|
256
241
|
}, [((_b = (_a2 = ctx.slots).title) == null ? void 0 : _b.call(_a2)) || props.title]), createVNode("div", {
|
|
257
242
|
"class": "devui-statistic-content",
|
|
258
|
-
"style": props.
|
|
243
|
+
"style": props.valueStyle
|
|
259
244
|
}, [props.prefix || ((_d = (_c = ctx.slots).prefix) == null ? void 0 : _d.call(_c)) ? createVNode("span", {
|
|
260
245
|
"class": "devui-statistic-prefix"
|
|
261
246
|
}, [((_f = (_e = ctx.slots).prefix) == null ? void 0 : _f.call(_e)) || props.prefix]) : null, createVNode("span", {
|
|
262
247
|
"class": "devui-statistic--value"
|
|
263
248
|
}, [statisticValue.value]), props.suffix || ((_h = (_g = ctx.slots).suffix) == null ? void 0 : _h.call(_g)) ? createVNode("span", {
|
|
264
249
|
"class": "devui-statistic-suffix"
|
|
265
|
-
}, [((_j = (_i = ctx.slots).suffix) == null ? void 0 : _j.call(_i)) || props.suffix]) : null]), ((_l = (_k = ctx.slots).extra) == null ? void 0 : _l.call(_k))
|
|
250
|
+
}, [((_j = (_i = ctx.slots).suffix) == null ? void 0 : _j.call(_i)) || props.suffix]) : null]), props.extra || ((_l = (_k = ctx.slots).extra) == null ? void 0 : _l.call(_k)) ? createVNode("div", {
|
|
251
|
+
"class": "devui-statistic-extra"
|
|
252
|
+
}, [createTextVNode(" "), ((_n = (_m = ctx.slots).extra) == null ? void 0 : _n.call(_m)) || props.extra]) : null]);
|
|
266
253
|
};
|
|
267
254
|
}
|
|
268
255
|
});
|
package/statistic/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $=Object.defineProperty;var z=(a,e,f)=>e in a?$(a,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[e]=f;var n=(a,e,f)=>(z(a,typeof e!="symbol"?e+"":e,f),f);(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 f={title:{type:String,default:""},value:{type:[Number,String]},prefix:{type:String},suffix:{type:String},precision:{type:Number},groupSeparator:{type:String,default:""},valueStyle:{type:Object},animationDuration:{type:Number,default:2e3},valueFrom:{type:Number},animation:{type:Boolean,default:!1},start:{type:Boolean,default:!0},extra:{type:String,default:""}},y=(t,i)=>t.replace(/\d+/,function(s){return s.replace(/(\d)(?=(\d{3})+$)/g,function(l){return l+`${i}`})}),C=t=>{if(!isNaN(t))return(t+"").indexOf(".")!==-1},D=(t,i,r,s)=>{const l=i.toString().indexOf(".")!==-1?i.toString().length-i.toString().indexOf(".")-1:0;return typeof t=="number"?C(t)?y(s?t.toFixed(s).toString():t.toFixed(l).toString(),r):y(s?t.toFixed(s).toString():t.toString(),r):t},c=Math.pow,v=Math.sqrt,E=function(t){return 1-c(1-t,3)},A=t=>t,I=function(t){return t===1?1:1-c(2,-10*t)},M=function(t){return t===0?0:t===1?1:t<.5?c(2,20*t-10)/2:(2-c(2,-20*t+10))/2},_=function(t){return t===0?0:c(2,10*t-10)},U=function(t){return t<.5?(1-v(1-c(2*t,2)))/2:(v(1-c(-2*t+2,2))+1)/2};var j=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",easeOutCubic:E,linear:A,easeOutExpo:I,easeInOutExpo:M,easeInExpo:_,easeInOutCirc:U});class q{constructor(i){n(this,"from");n(this,"to");n(this,"duration");n(this,"delay");n(this,"easing");n(this,"onStart");n(this,"onUpdate");n(this,"onFinish");n(this,"startTime");n(this,"started");n(this,"finished");n(this,"timer");n(this,"time");n(this,"elapsed");n(this,"keys");const{from:r,to:s,duration:l,delay:g,easing:S,onStart:u,onUpdate:d,onFinish:h}=i;for(const o in r)s[o]===void 0&&(s[o]=r[o]);for(const o in s)r[o]===void 0&&(r[o]=s[o]);this.from=r,this.to=s,this.duration=l,this.delay=g,this.easing=S,this.onStart=u,this.onUpdate=d,this.onFinish=h,this.startTime=Date.now()+this.delay,this.started=!1,this.finished=!1,this.timer=null,this.keys={}}update(){if(this.time=Date.now(),!(this.time<this.startTime)&&!this.finished){if(this.elapsed===this.duration){this.finished||(this.finished=!0,this.onFinish&&this.onFinish(this.keys));return}this.elapsed=this.time-this.startTime,this.elapsed=this.elapsed>this.duration?this.duration:this.elapsed;for(const i in this.to)this.keys[i]=this.from[i]+(this.to[i]-this.from[i])*j[this.easing](this.elapsed/this.duration);this.started||(this.onStart&&this.onStart(this.keys),this.started=!0),this.onUpdate(this.keys)}}start(){this.startTime=Date.now()+this.delay;const i=()=>{this.update(),this.timer=requestAnimationFrame(i),this.finished&&(cancelAnimationFrame(this.timer),this.timer=null)};i()}stop(){cancelAnimationFrame(this.timer),this.timer=null}}var H="",m=e.defineComponent({name:"DStatistic",inheritAttrs:!1,props:f,setup(t,i){var S;const r=e.ref((S=t.valueFrom)!=null?S:t.value),s=e.ref(null),l=(u=(h=>(h=t.valueFrom)!=null?h:0)(),d=typeof t.value=="number"?t.value:Number(t.value))=>{u!==d&&(s.value=new q({from:{value:u},to:{value:d},delay:0,duration:t.animationDuration,easing:"easeOutCubic",onUpdate:o=>{r.value=o.value},onFinish:()=>{r.value=d}}),s.value.start())},g=e.computed(()=>D(r.value,t.value,t.groupSeparator,t.precision));return e.onMounted(()=>{t.animation&&t.start&&l()}),e.watch(()=>t.start,u=>{u&&!s.value&&l()}),()=>{var u,d,h,o,x,F,p,O,b,N,T,k,V,w;return e.createVNode("div",e.mergeProps({class:"devui-statistic"},i.attrs),[e.createVNode("div",{class:"devui-statistic-title",style:t.titleStyle},[((d=(u=i.slots).title)==null?void 0:d.call(u))||t.title]),e.createVNode("div",{class:"devui-statistic-content",style:t.valueStyle},[t.prefix||((o=(h=i.slots).prefix)==null?void 0:o.call(h))?e.createVNode("span",{class:"devui-statistic-prefix"},[((F=(x=i.slots).prefix)==null?void 0:F.call(x))||t.prefix]):null,e.createVNode("span",{class:"devui-statistic--value"},[g.value]),t.suffix||((O=(p=i.slots).suffix)==null?void 0:O.call(p))?e.createVNode("span",{class:"devui-statistic-suffix"},[((N=(b=i.slots).suffix)==null?void 0:N.call(b))||t.suffix]):null]),t.extra||((k=(T=i.slots).extra)==null?void 0:k.call(T))?e.createVNode("div",{class:"devui-statistic-extra"},[e.createTextVNode(" "),((w=(V=i.slots).extra)==null?void 0:w.call(V))||t.extra]):null])}}});m.install=function(t){t.component(m.name,m)};var B={title:"Statistic \u7EDF\u8BA1\u6570\u503C",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.use(m)}};a.Statistic=m,a.default=B,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
package/statistic/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-statistic{box-sizing:border-box;margin:0;padding:0;font-size:14px;line-height:1.5715;list-style:none}.devui-statistic-title{margin-bottom:4px;
|
|
1
|
+
.devui-statistic{box-sizing:border-box;margin:0;padding:0;font-size:14px;line-height:1.5715;list-style:none}.devui-statistic-title{margin-bottom:4px;font-size:14px}.devui-statistic-content{font-size:24px;display:flex;align-items:center}.devui-statistic-prefix{margin-right:6px;display:flex;align-items:center}.devui-statistic-suffix{margin-left:6px;display:flex;align-items:center}.devui-statistic--value{display:inline-block}
|
package/status/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:
|
|
1
|
+
.devui-font-size-base{font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:var(--devui-font-size, 12px);font-weight:400;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:700;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:700;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:700;line-height:1.5}.devui-status{line-height:20px;height:20px;display:flex;align-items:center}.devui-status:before{display:inline-block;content:"";width:10px;height:10px;margin-right:5px;border-radius:100%}.devui-status.devui-status-bg-success:before{background-color:var(--devui-success, #50d4ab)}.devui-status.devui-status-bg-error:before{background-color:var(--devui-danger, #f66f6a)}.devui-status.devui-status-bg-warning:before{background-color:var(--devui-warning, #fac20a)}.devui-status.devui-status-bg-initial:before{background-color:var(--devui-initial, #e9edfa)}.devui-status.devui-status-bg-waiting:before{background-color:var(--devui-waiting, #9faad7)}.devui-status.devui-status-bg-running:before{background-color:var(--devui-info, #5e7ce0)}.devui-status.devui-status-bg-invalid:before{background-color:var(--devui-dividing-line, #dfe1e6)}
|
package/sticky/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(a=typeof globalThis!="undefined"?globalThis:a||self,i(a.index={},a.Vue))})(this,function(a,i){"use strict";var r=i.defineComponent({name:"DSticky",props:{zIndex:{type:Number},container:{type:Object},view:{type:Object,default:()=>({top:0,bottom:0})},scrollTarget:{type:Object}},emits:["statusChange"],setup(e,h){const{slots:C}=h;let c,d,f,g;const B=16,S=100;let u,R=0;const s=i.reactive({status:"normal"});i.watch(()=>e.zIndex,()=>{w()}),i.watch(()=>e.container,()=>{w()}),i.watch(()=>e.scrollTarget,()=>{w()}),i.watch(()=>s.status,()=>{h.emit("statusChange",s.status)},{immediate:!0});const w=()=>{u=p.value.parentElement,e.container?c=e.container:c=u,p.value.style.zIndex=e.zIndex,d=e.scrollTarget||window,d.addEventListener("scroll",x),I(d)},I=l=>{const t=l===window?[document.documentElement,document.body]:[l];let o=!1;t.forEach(n=>{n.scrollTop&&n.scrollTop>0&&(o=!0)}),o&&setTimeout(v)},y=l=>{const t=p.value||document.createElement("div");switch(l){case"normal":t.style.top="auto",t.style.left="auto",t.style.position="static";break;case"follow":const n=d&&d!==window?d.getBoundingClientRect().top:0;t.style.top=+n+(e.view&&e.view.top||0)+"px",t.style.left=t.getBoundingClientRect().left+"px",t.style.position="fixed";break;case"stay":t.style.top=T(t,u,"top")+"px",t.style.left="auto",t.style.position="relative";break;case"remain":t.style.position!=="fixed"&&t.style.position!=="absolute"&&(t.style.top=T(t,u,"top")+"px",t.style.left="auto",t.style.position="absolute"),t.style.top=k(t,u,c)+"px",t.style.left=T(t,u,"left")+"px",t.style.position="relative";break}},x=()=>{const l=E,t=Date.now();f&&clearTimeout(f),g||(g=t),t-g>S?(l(),g=null,f=null):f=setTimeout(()=>{l(),g=null,f=null},B)},E=()=>{c.getBoundingClientRect().left-(R||0)
|
|
1
|
+
(function(a,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(a=typeof globalThis!="undefined"?globalThis:a||self,i(a.index={},a.Vue))})(this,function(a,i){"use strict";var r=i.defineComponent({name:"DSticky",props:{zIndex:{type:Number},container:{type:Object},view:{type:Object,default:()=>({top:0,bottom:0})},scrollTarget:{type:Object}},emits:["statusChange"],setup(e,h){const{slots:C}=h;let c,d,f,g;const B=16,S=100;let u,R=0;const s=i.reactive({status:"normal"});i.watch(()=>e.zIndex,()=>{w()}),i.watch(()=>e.container,()=>{w()}),i.watch(()=>e.scrollTarget,()=>{w()}),i.watch(()=>s.status,()=>{h.emit("statusChange",s.status)},{immediate:!0});const w=()=>{u=p.value.parentElement,e.container?c=e.container:c=u,p.value.style.zIndex=e.zIndex,d=e.scrollTarget||window,d.addEventListener("scroll",x),I(d)},I=l=>{const t=l===window?[document.documentElement,document.body]:[l];let o=!1;t.forEach(n=>{n.scrollTop&&n.scrollTop>0&&(o=!0)}),o&&setTimeout(v)},y=l=>{const t=p.value||document.createElement("div");switch(l){case"normal":t.style.top="auto",t.style.left="auto",t.style.position="static";break;case"follow":const n=d&&d!==window?d.getBoundingClientRect().top:0;t.style.top=+n+(e.view&&e.view.top||0)+"px",t.style.left=t.getBoundingClientRect().left+"px",t.style.position="fixed";break;case"stay":t.style.top=T(t,u,"top")+"px",t.style.left="auto",t.style.position="relative";break;case"remain":t.style.position!=="fixed"&&t.style.position!=="absolute"&&(t.style.top=T(t,u,"top")+"px",t.style.left="auto",t.style.position="absolute"),t.style.top=k(t,u,c)+"px",t.style.left=T(t,u,"left")+"px",t.style.position="relative";break}},x=()=>{const l=E,t=Date.now();f&&clearTimeout(f),g||(g=t),t-g>S?(l(),g=null,f=null):f=setTimeout(()=>{l(),g=null,f=null},B)},E=()=>{c.getBoundingClientRect().left-(R||0)!==0?(s.status="stay",R=c.getBoundingClientRect().left):v()},v=()=>{const l=d,t=p.value||document.createElement("div"),o=d&&d!==window?l.getBoundingClientRect().top:0,n=window.getComputedStyle(c);u.getBoundingClientRect().top-o>(e.view&&e.view.top||0)||c.getBoundingClientRect().top+parseInt(n.paddingTop,10)+parseInt(n.borderTopWidth,10)-o>=(e.view&&e.view.top||0)?(s.status="normal",y(s.status)):c.getBoundingClientRect().bottom-parseInt(n.paddingBottom,10)-parseInt(n.borderBottomWidth,10)<o+(e.view&&e.view.top||0)+t.getBoundingClientRect().height+(e.view&&e.view.bottom||0)?(s.status="remain",y(s.status)):c.getBoundingClientRect().top+parseInt(n.paddingTop,10)-o<(e.view&&e.view.top||0)&&(s.status="follow",y(s.status))},T=(l,t,o)=>{const n={left:["left","Left"],top:["top","Top"]};if(window&&window.getComputedStyle){const m=window.getComputedStyle(t);return l.getBoundingClientRect()[n[o][0]]-t.getBoundingClientRect()[n[o][0]]-parseInt(m[o==="left"?"paddingLeft":"paddingTop"],10)-parseInt(m[o==="left"?"borderLeftWidth":"borderTopWidth"],10)}},k=(l,t,o)=>{if(window&&window.getComputedStyle){const n=window.getComputedStyle(o),m=o.getBoundingClientRect().height-l.getBoundingClientRect().height+o.getBoundingClientRect().top-t.getBoundingClientRect().top-parseInt(n.paddingTop,10)-parseInt(n.borderTopWidth,10)-parseInt(n.paddingBottom,10)-parseInt(n.borderBottomWidth,10);return m<0?0:m}};i.onMounted(()=>{w()});const p=i.ref();return()=>i.createVNode("div",{ref:p},[C.default?C.default():""])}});r.install=function(e){e.component(r.name,r)};var b={title:"Sticky \u4FBF\u8D34",category:"\u901A\u7528",status:"50%",install(e){e.use(r)}};a.Sticky=r,a.default=b,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|