vue-devui 1.0.0-beta.8 → 1.0.0-beta.9

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.
@@ -0,0 +1,280 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { defineComponent, ref, computed, onMounted, watch, createVNode, mergeProps } from "vue";
8
+ const statisticProps = {
9
+ title: {
10
+ type: String,
11
+ default: ""
12
+ },
13
+ value: {
14
+ type: [Number, String]
15
+ },
16
+ prefix: {
17
+ type: String
18
+ },
19
+ suffix: {
20
+ type: String
21
+ },
22
+ precision: {
23
+ type: Number
24
+ },
25
+ groupSeparator: {
26
+ type: String,
27
+ default: ","
28
+ },
29
+ showGroupSeparator: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ titleStyle: {
34
+ type: Object
35
+ },
36
+ contentStyle: {
37
+ type: Object
38
+ },
39
+ animationDuration: {
40
+ type: Number,
41
+ default: 2e3
42
+ },
43
+ valueFrom: {
44
+ type: Number
45
+ },
46
+ animation: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ start: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ extra: {
55
+ type: String,
56
+ default: ""
57
+ },
58
+ easing: {
59
+ type: String,
60
+ default: "easeOutCubic"
61
+ },
62
+ delay: {
63
+ type: Number,
64
+ default: 0
65
+ }
66
+ };
67
+ const separator = (SeparatorString, groupSeparator, showGroupSeparator) => {
68
+ const res = SeparatorString.replace(/\d+/, function(n) {
69
+ return n.replace(/(\d)(?=(\d{3})+$)/g, function($1) {
70
+ return $1 + `${showGroupSeparator ? groupSeparator : ""}`;
71
+ });
72
+ });
73
+ return res;
74
+ };
75
+ const isHasDot = (value) => {
76
+ if (!isNaN(value)) {
77
+ return (value + "").indexOf(".") !== -1;
78
+ }
79
+ };
80
+ const analysisValueType = (value, propsValue, groupSeparator, splitPrecisionNumber, showGroupSeparator) => {
81
+ const fixedNumber = propsValue.toString().indexOf(".") !== -1 ? propsValue.toString().length - propsValue.toString().indexOf(".") - 1 : 0;
82
+ if (typeof value === "number") {
83
+ if (isHasDot(value)) {
84
+ return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toFixed(fixedNumber).toString(), groupSeparator, showGroupSeparator);
85
+ } else {
86
+ return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toString(), groupSeparator, showGroupSeparator);
87
+ }
88
+ } else {
89
+ return value;
90
+ }
91
+ };
92
+ const pow = Math.pow;
93
+ const sqrt = Math.sqrt;
94
+ const easeOutCubic = function(x) {
95
+ return 1 - pow(1 - x, 3);
96
+ };
97
+ const linear = (x) => x;
98
+ const easeOutExpo = function(x) {
99
+ return x === 1 ? 1 : 1 - pow(2, -10 * x);
100
+ };
101
+ const easeInOutExpo = function(x) {
102
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
103
+ };
104
+ const easeInExpo = function(x) {
105
+ return x === 0 ? 0 : pow(2, 10 * x - 10);
106
+ };
107
+ const easeInOutCirc = function(x) {
108
+ return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
109
+ };
110
+ var easing = /* @__PURE__ */ Object.freeze({
111
+ __proto__: null,
112
+ [Symbol.toStringTag]: "Module",
113
+ easeOutCubic,
114
+ linear,
115
+ easeOutExpo,
116
+ easeInOutExpo,
117
+ easeInExpo,
118
+ easeInOutCirc
119
+ });
120
+ class Tween {
121
+ constructor(options) {
122
+ __publicField(this, "from");
123
+ __publicField(this, "to");
124
+ __publicField(this, "duration");
125
+ __publicField(this, "delay");
126
+ __publicField(this, "easing");
127
+ __publicField(this, "onStart");
128
+ __publicField(this, "onUpdate");
129
+ __publicField(this, "onFinish");
130
+ __publicField(this, "startTime");
131
+ __publicField(this, "started");
132
+ __publicField(this, "finished");
133
+ __publicField(this, "timer");
134
+ __publicField(this, "time");
135
+ __publicField(this, "elapsed");
136
+ __publicField(this, "keys");
137
+ const { from, to, duration, delay, easing: easing2, onStart, onUpdate, onFinish } = options;
138
+ for (const key in from) {
139
+ if (to[key] === void 0) {
140
+ to[key] = from[key];
141
+ }
142
+ }
143
+ for (const key in to) {
144
+ if (from[key] === void 0) {
145
+ from[key] = to[key];
146
+ }
147
+ }
148
+ this.from = from;
149
+ this.to = to;
150
+ this.duration = duration;
151
+ this.delay = delay;
152
+ this.easing = easing2;
153
+ this.onStart = onStart;
154
+ this.onUpdate = onUpdate;
155
+ this.onFinish = onFinish;
156
+ this.startTime = Date.now() + this.delay;
157
+ this.started = false;
158
+ this.finished = false;
159
+ this.timer = null;
160
+ this.keys = {};
161
+ }
162
+ update() {
163
+ this.time = Date.now();
164
+ if (this.time < this.startTime) {
165
+ return;
166
+ }
167
+ if (this.finished) {
168
+ return;
169
+ }
170
+ if (this.elapsed === this.duration) {
171
+ if (!this.finished) {
172
+ this.finished = true;
173
+ this.onFinish && this.onFinish(this.keys);
174
+ }
175
+ return;
176
+ }
177
+ this.elapsed = this.time - this.startTime;
178
+ this.elapsed = this.elapsed > this.duration ? this.duration : this.elapsed;
179
+ for (const key in this.to) {
180
+ this.keys[key] = this.from[key] + (this.to[key] - this.from[key]) * easing[this.easing](this.elapsed / this.duration);
181
+ }
182
+ if (!this.started) {
183
+ this.onStart && this.onStart(this.keys);
184
+ this.started = true;
185
+ }
186
+ this.onUpdate(this.keys);
187
+ }
188
+ start() {
189
+ this.startTime = Date.now() + this.delay;
190
+ const tick = () => {
191
+ this.update();
192
+ this.timer = requestAnimationFrame(tick);
193
+ if (this.finished) {
194
+ cancelAnimationFrame(this.timer);
195
+ this.timer = null;
196
+ }
197
+ };
198
+ tick();
199
+ }
200
+ stop() {
201
+ cancelAnimationFrame(this.timer);
202
+ this.timer = null;
203
+ }
204
+ }
205
+ var statistic = "";
206
+ var Statistic = defineComponent({
207
+ name: "DStatistic",
208
+ props: statisticProps,
209
+ inheritAttrs: false,
210
+ setup(props, ctx) {
211
+ var _a;
212
+ const innerValue = ref((_a = props.valueFrom) != null ? _a : props.value);
213
+ const tween = ref(null);
214
+ const animation = (from = ((_b) => (_b = props.valueFrom) != null ? _b : 0)(), to = typeof props.value === "number" ? props.value : Number(props.value)) => {
215
+ if (from !== to) {
216
+ tween.value = new Tween({
217
+ from: {
218
+ value: from
219
+ },
220
+ to: {
221
+ value: to
222
+ },
223
+ delay: props.delay,
224
+ duration: props.animationDuration,
225
+ easing: props.easing,
226
+ onUpdate: (keys) => {
227
+ innerValue.value = keys.value;
228
+ },
229
+ onFinish: () => {
230
+ innerValue.value = to;
231
+ }
232
+ });
233
+ tween.value.start();
234
+ }
235
+ };
236
+ const statisticValue = computed(() => {
237
+ return analysisValueType(innerValue.value, props.value, props.groupSeparator, props.precision, props.showGroupSeparator, props.animation);
238
+ });
239
+ onMounted(() => {
240
+ if (props.animation && props.start) {
241
+ animation();
242
+ }
243
+ });
244
+ watch(() => props.start, (value) => {
245
+ if (value && !tween.value) {
246
+ animation();
247
+ }
248
+ });
249
+ return () => {
250
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
251
+ return createVNode("div", mergeProps({
252
+ "class": "devui-statistic"
253
+ }, ctx.attrs), [createVNode("div", {
254
+ "class": "devui-statistic-title",
255
+ "style": props.titleStyle
256
+ }, [((_b = (_a2 = ctx.slots).title) == null ? void 0 : _b.call(_a2)) || props.title]), createVNode("div", {
257
+ "class": "devui-statistic-content",
258
+ "style": props.contentStyle
259
+ }, [props.prefix || ((_d = (_c = ctx.slots).prefix) == null ? void 0 : _d.call(_c)) ? createVNode("span", {
260
+ "class": "devui-statistic-prefix"
261
+ }, [((_f = (_e = ctx.slots).prefix) == null ? void 0 : _f.call(_e)) || props.prefix]) : null, createVNode("span", {
262
+ "class": "devui-statistic--value"
263
+ }, [statisticValue.value]), props.suffix || ((_h = (_g = ctx.slots).suffix) == null ? void 0 : _h.call(_g)) ? createVNode("span", {
264
+ "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)) || props.extra]);
266
+ };
267
+ }
268
+ });
269
+ Statistic.install = function(app) {
270
+ app.component(Statistic.name, Statistic);
271
+ };
272
+ var index = {
273
+ title: "Statistic \u7EDF\u8BA1\u6570\u503C",
274
+ category: "\u6570\u636E\u5C55\u793A",
275
+ status: void 0,
276
+ install(app) {
277
+ app.use(Statistic);
278
+ }
279
+ };
280
+ export { Statistic, index as default };
@@ -0,0 +1 @@
1
+ var q=Object.defineProperty;var B=(a,e,f)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[e]=f;var s=(a,e,f)=>(B(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:","},showGroupSeparator:{type:Boolean,default:!1},titleStyle:{type:Object},contentStyle:{type:Object},animationDuration:{type:Number,default:2e3},valueFrom:{type:Number},animation:{type:Boolean,default:!1},start:{type:Boolean,default:!1},extra:{type:String,default:""},easing:{type:String,default:"easeOutCubic"},delay:{type:Number,default:0}},g=(t,i,n)=>t.replace(/\d+/,function(u){return u.replace(/(\d)(?=(\d{3})+$)/g,function(h){return h+`${n?i:""}`})}),w=t=>{if(!isNaN(t))return(t+"").indexOf(".")!==-1},C=(t,i,n,o,u)=>{const h=i.toString().indexOf(".")!==-1?i.toString().length-i.toString().indexOf(".")-1:0;return typeof t=="number"?w(t)?g(o?t.toFixed(o).toString():t.toFixed(h).toString(),n,u):g(o?t.toFixed(o).toString():t.toString(),n,u):t},c=Math.pow,v=Math.sqrt,D=function(t){return 1-c(1-t,3)},E=t=>t,V=function(t){return t===1?1:1-c(2,-10*t)},A=function(t){return t===0?0:t===1?1:t<.5?c(2,20*t-10)/2:(2-c(2,-20*t+10))/2},I=function(t){return t===0?0:c(2,10*t-10)},M=function(t){return t<.5?(1-v(1-c(2*t,2)))/2:(v(1-c(-2*t+2,2))+1)/2};var _=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",easeOutCubic:D,linear:E,easeOutExpo:V,easeInOutExpo:A,easeInExpo:I,easeInOutCirc:M});class j{constructor(i){s(this,"from");s(this,"to");s(this,"duration");s(this,"delay");s(this,"easing");s(this,"onStart");s(this,"onUpdate");s(this,"onFinish");s(this,"startTime");s(this,"started");s(this,"finished");s(this,"timer");s(this,"time");s(this,"elapsed");s(this,"keys");const{from:n,to:o,duration:u,delay:h,easing:S,onStart:l,onUpdate:d,onFinish:m}=i;for(const r in n)o[r]===void 0&&(o[r]=n[r]);for(const r in o)n[r]===void 0&&(n[r]=o[r]);this.from=n,this.to=o,this.duration=u,this.delay=h,this.easing=S,this.onStart=l,this.onUpdate=d,this.onFinish=m,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])*_[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 $="",y=e.defineComponent({name:"DStatistic",props:f,inheritAttrs:!1,setup(t,i){var S;const n=e.ref((S=t.valueFrom)!=null?S:t.value),o=e.ref(null),u=(l=(m=>(m=t.valueFrom)!=null?m:0)(),d=typeof t.value=="number"?t.value:Number(t.value))=>{l!==d&&(o.value=new j({from:{value:l},to:{value:d},delay:t.delay,duration:t.animationDuration,easing:t.easing,onUpdate:r=>{n.value=r.value},onFinish:()=>{n.value=d}}),o.value.start())},h=e.computed(()=>C(n.value,t.value,t.groupSeparator,t.precision,t.showGroupSeparator,t.animation));return e.onMounted(()=>{t.animation&&t.start&&u()}),e.watch(()=>t.start,l=>{l&&!o.value&&u()}),()=>{var l,d,m,r,x,F,O,b,N,p,T,k;return e.createVNode("div",e.mergeProps({class:"devui-statistic"},i.attrs),[e.createVNode("div",{class:"devui-statistic-title",style:t.titleStyle},[((d=(l=i.slots).title)==null?void 0:d.call(l))||t.title]),e.createVNode("div",{class:"devui-statistic-content",style:t.contentStyle},[t.prefix||((r=(m=i.slots).prefix)==null?void 0:r.call(m))?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"},[h.value]),t.suffix||((b=(O=i.slots).suffix)==null?void 0:b.call(O))?e.createVNode("span",{class:"devui-statistic-suffix"},[((p=(N=i.slots).suffix)==null?void 0:p.call(N))||t.suffix]):null]),((k=(T=i.slots).extra)==null?void 0:k.call(T))||t.extra])}}});y.install=function(t){t.component(y.name,y)};var U={title:"Statistic \u7EDF\u8BA1\u6570\u503C",category:"\u6570\u636E\u5C55\u793A",status:void 0,install(t){t.use(y)}};a.Statistic=y,a.default=U,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "statistic",
3
+ "version": "0.0.0",
4
+ "main": "index.umd.js",
5
+ "module": "index.es.js",
6
+ "style": "style.css"
7
+ }
@@ -0,0 +1 @@
1
+ .devui-statistic{box-sizing:border-box;margin:0;padding:0;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none}.devui-statistic-title{margin-bottom:4 px;opacity:.7;font-size:14px}.devui-statistic-content{font-size:24px;display:flex;align-items:center;vertical-align:center}.devui-statistic-prefix{margin-right:6px}.devui-statistic-suffix{margin-left:6px}.devui-statistic--value{display:inline-block}
@@ -4,7 +4,7 @@ var Status = defineComponent({
4
4
  name: "DStatus",
5
5
  props: {
6
6
  type: {
7
- default: "initial",
7
+ default: "invalid",
8
8
  type: String
9
9
  }
10
10
  },
@@ -1 +1 @@
1
- (function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";var l="",n=e.defineComponent({name:"DStatus",props:{type:{default:"initial",type:String}},setup(u,o){const r=e.computed(()=>{const{type:s}=u,i=["success","error","initial","warning","waiting","running","invalid"];let a="devui-status devui-status-bg-invalid";return i.includes(s)&&(a=`devui-status devui-status-bg-${s}`),a});return()=>{var s,i;return e.createVNode("span",{class:r.value},[(i=(s=o.slots).default)==null?void 0:i.call(s)])}}});n.install=function(u){u.component(n.name,n)};var d={title:"Status \u72B6\u6001",category:"\u901A\u7528",status:"100%",install(u){u.use(n)}};t.Status=n,t.default=d,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
1
+ (function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";var l="",n=e.defineComponent({name:"DStatus",props:{type:{default:"invalid",type:String}},setup(u,o){const r=e.computed(()=>{const{type:s}=u,i=["success","error","initial","warning","waiting","running","invalid"];let a="devui-status devui-status-bg-invalid";return i.includes(s)&&(a=`devui-status devui-status-bg-${s}`),a});return()=>{var s,i;return e.createVNode("span",{class:r.value},[(i=(s=o.slots).default)==null?void 0:i.call(s)])}}});n.install=function(u){u.component(n.name,n)};var d={title:"Status \u72B6\u6001",category:"\u901A\u7528",status:"100%",install(u){u.use(n)}};t.Status=n,t.default=d,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
@@ -1,4 +1,4 @@
1
- import { ref, reactive, nextTick, computed, defineComponent, onMounted, createVNode, Teleport } from "vue";
1
+ import { reactive, ref, nextTick, computed, defineComponent, onMounted, createVNode, Teleport } from "vue";
2
2
  var stepsGuide = "";
3
3
  const stepsGuideProps = {
4
4
  steps: Array,
@@ -30,7 +30,7 @@ const stepsGuideProps = {
30
30
  }
31
31
  };
32
32
  function useStepsGuidePosition(props, currentStep) {
33
- const guideClassList = ["devui-steps-guide"];
33
+ const guideClassList = reactive(["devui-steps-guide"]);
34
34
  const stepsRef = ref(null);
35
35
  const guidePosition = reactive({
36
36
  left: "",
@@ -38,7 +38,7 @@ function useStepsGuidePosition(props, currentStep) {
38
38
  zIndex: props.zIndex
39
39
  });
40
40
  const updateGuidePosition = () => {
41
- if (!currentStep.value)
41
+ if (!currentStep.value || !stepsRef.value)
42
42
  return;
43
43
  const baseTop = window.pageYOffset - document.documentElement.clientTop;
44
44
  const baseLeft = window.pageXOffset - document.documentElement.clientLeft;
@@ -54,6 +54,10 @@ function useStepsGuidePosition(props, currentStep) {
54
54
  guideClassList.splice(1, 1, currentStepPosition);
55
55
  const triggerSelector = currentStep.value.target || currentStep.value.trigger;
56
56
  const triggerElement = document.querySelector(triggerSelector);
57
+ if (!triggerElement) {
58
+ console.warn(`${triggerSelector} \u4E0D\u5B58\u5728!`);
59
+ return false;
60
+ }
57
61
  const targetRect = triggerElement.getBoundingClientRect();
58
62
  _left = targetRect.left + triggerElement.clientWidth / 2 - stepGuideElement.clientWidth / 2 + baseLeft;
59
63
  _top = targetRect.top + triggerElement.clientHeight / 2 - stepGuideElement.clientHeight / 2 + baseTop;
@@ -85,7 +89,7 @@ function useStepsGuidePosition(props, currentStep) {
85
89
  }
86
90
  guidePosition.left = _left + "px";
87
91
  guidePosition.top = _top + "px";
88
- if (props.scrollToTargetSwitch) {
92
+ if (props.scrollToTargetSwitch && typeof stepGuideElement.scrollIntoView === "function") {
89
93
  nextTick(() => {
90
94
  stepGuideElement.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
91
95
  });
@@ -111,9 +115,7 @@ function useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex) {
111
115
  if (index2 !== -1 && props.stepChange()) {
112
116
  if (index2 > -1 && index2 < stepsCount.value) {
113
117
  stepIndex.value = index2;
114
- console.log(stepIndex.value, index2, stepsCount.value);
115
118
  nextTick(() => {
116
- console.log(stepIndex.value, index2, stepsCount.value);
117
119
  updateGuidePosition();
118
120
  });
119
121
  } else {
@@ -1 +1 @@
1
- (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";var k="";const b={steps:Array,stepIndex:{type:Number,default:void 0},showClose:{type:Boolean,default:!0},showDots:{type:Boolean,default:!0},scrollToTargetSwitch:{type:Boolean,default:!0},zIndex:{type:Number,default:1100},stepChange:{type:Function,default(){return!0}}};function y(i,c){const r=["devui-steps-guide"],n=e.ref(null),o=e.reactive({left:"",top:"",zIndex:i.zIndex});return{stepsRef:n,guidePosition:o,guideClassList:r,updateGuidePosition:()=>{if(!c.value)return;const m=window.pageYOffset-document.documentElement.clientTop,l=window.pageXOffset-document.documentElement.clientLeft,p=c.value.position,s=n.value;let d,u;if(typeof p!="string"){const{top:f=0,left:t=0,type:g="top"}=p;r.splice(1,1,g),d=t,u=f}else{r.splice(1,1,p);const f=c.value.target||c.value.trigger,t=document.querySelector(f),g=t.getBoundingClientRect();d=g.left+t.clientWidth/2-s.clientWidth/2+l,u=g.top+t.clientHeight/2-s.clientHeight/2+m;const C=p.split("-");switch(C[0]){case"top":u+=-s.clientHeight/2-t.clientHeight;break;case"bottom":u+=s.clientHeight/2+t.clientHeight;break;case"left":u+=s.clientHeight/2-t.clientHeight,d+=-s.clientWidth/2-t.clientWidth/2;break;case"right":u+=s.clientHeight/2-t.clientHeight,d+=s.clientWidth/2+t.clientWidth/2;break}switch(C[1]){case"left":d+=s.clientWidth/2-t.clientWidth/2;break;case"right":d+=-s.clientWidth/2+t.clientWidth/2;break}}o.left=d+"px",o.top=u+"px",i.scrollToTargetSwitch&&e.nextTick(()=>{s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})}}}function N(i,c,r,n){const o=e.computed(()=>i.steps.length),v=()=>{const l=n.value;n.value=-1,e.nextTick(()=>{c.emit("guide-close",l)})};return{stepsCount:o,closeGuide:v,setCurrentIndex:l=>{l!==-1&&i.stepChange()&&(l>-1&&l<o.value?(n.value=l,console.log(n.value,l,o.value),e.nextTick(()=>{console.log(n.value,l,o.value),r()})):console.error("stepIndex is not within the value range")),l===-1&&v()}}}var h=e.defineComponent({name:"DStepsGuide",props:b,emits:["guide-close","update:stepIndex"],setup(i,c){var f;const r=e.ref((f=i.stepIndex)!=null?f:0),n=e.computed({set:t=>{i.stepIndex!=null&&c.emit("update:stepIndex",t),r.value=t},get:()=>r.value}),o=e.computed(()=>{const t=i.steps[n.value];return t&&(t.position=t.position||"top"),t}),{stepsRef:v,guidePosition:m,guideClassList:l,updateGuidePosition:p}=y(i,o),{stepsCount:s,closeGuide:d,setCurrentIndex:u}=N(i,c,p,n);return e.onMounted(()=>{p()}),c.expose({closeGuide:d,setCurrentIndex:u}),()=>n.value>-1&&s.value>0?e.createVNode(e.Teleport,{to:"body"},{default:()=>[e.createVNode("div",{style:m,class:l,ref:v},[e.createVNode("div",{class:"devui-shining-dot"},null),e.createVNode("div",{class:"devui-shining-plus"},null),e.createVNode("div",{class:"devui-arrow"},null),e.createVNode("div",{class:"devui-guide-container"},[e.createVNode("p",{class:"devui-title"},[o.value.title]),i.showClose?e.createVNode("div",{class:"icon icon-close",onClick:d},null):null,e.createVNode("div",{class:"devui-content"},[o.value.content]),e.createVNode("div",{class:"devui-ctrl"},[i.showDots?e.createVNode("div",{class:"devui-dots"},[i.steps.map((t,g)=>e.createVNode("em",{class:["icon icon-dot-status",o.value===t?"devui-active":""],key:g},null))]):null,e.createVNode("div",{class:"devui-guide-btn"},[n.value>0?e.createVNode("div",{class:"devui-prev-step",onClick:()=>u(n.value-1)},["\u4E0A\u4E00\u6B65"]):null,n.value===s.value-1?e.createVNode("div",{onClick:d},["\u6211\u77E5\u9053\u5566"]):e.createVNode("div",{class:"devui-next-step",onClick:()=>{u(n.value+1)}},["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]}):null}}),V={mounted(i,c,r){},updated(i,c){}};h.install=function(i){i.component(h.name,h)};var G={title:"StepsGuide \u64CD\u4F5C\u6307\u5F15",category:"\u5BFC\u822A",status:"80%",install(i){i.use(h),i.directive("StepsGuide",V)}};a.StepsGuide=h,a.default=G,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
1
+ (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";var x="";const y={steps:Array,stepIndex:{type:Number,default:void 0},showClose:{type:Boolean,default:!0},showDots:{type:Boolean,default:!0},scrollToTargetSwitch:{type:Boolean,default:!0},zIndex:{type:Number,default:1100},stepChange:{type:Function,default(){return!0}}};function b(i,o){const r=e.reactive(["devui-steps-guide"]),n=e.ref(null),l=e.reactive({left:"",top:"",zIndex:i.zIndex});return{stepsRef:n,guidePosition:l,guideClassList:r,updateGuidePosition:()=>{if(!o.value||!n.value)return;const m=window.pageYOffset-document.documentElement.clientTop,c=window.pageXOffset-document.documentElement.clientLeft,p=o.value.position,s=n.value;let d,u;if(typeof p!="string"){const{top:f=0,left:t=0,type:g="top"}=p;r.splice(1,1,g),d=t,u=f}else{r.splice(1,1,p);const f=o.value.target||o.value.trigger,t=document.querySelector(f);if(!t)return console.warn(`${f} \u4E0D\u5B58\u5728!`),!1;const g=t.getBoundingClientRect();d=g.left+t.clientWidth/2-s.clientWidth/2+c,u=g.top+t.clientHeight/2-s.clientHeight/2+m;const C=p.split("-");switch(C[0]){case"top":u+=-s.clientHeight/2-t.clientHeight;break;case"bottom":u+=s.clientHeight/2+t.clientHeight;break;case"left":u+=s.clientHeight/2-t.clientHeight,d+=-s.clientWidth/2-t.clientWidth/2;break;case"right":u+=s.clientHeight/2-t.clientHeight,d+=s.clientWidth/2+t.clientWidth/2;break}switch(C[1]){case"left":d+=s.clientWidth/2-t.clientWidth/2;break;case"right":d+=-s.clientWidth/2+t.clientWidth/2;break}}l.left=d+"px",l.top=u+"px",i.scrollToTargetSwitch&&typeof s.scrollIntoView=="function"&&e.nextTick(()=>{s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})}}}function N(i,o,r,n){const l=e.computed(()=>i.steps.length),v=()=>{const c=n.value;n.value=-1,e.nextTick(()=>{o.emit("guide-close",c)})};return{stepsCount:l,closeGuide:v,setCurrentIndex:c=>{c!==-1&&i.stepChange()&&(c>-1&&c<l.value?(n.value=c,e.nextTick(()=>{r()})):console.error("stepIndex is not within the value range")),c===-1&&v()}}}var h=e.defineComponent({name:"DStepsGuide",props:y,emits:["guide-close","update:stepIndex"],setup(i,o){var f;const r=e.ref((f=i.stepIndex)!=null?f:0),n=e.computed({set:t=>{i.stepIndex!=null&&o.emit("update:stepIndex",t),r.value=t},get:()=>r.value}),l=e.computed(()=>{const t=i.steps[n.value];return t&&(t.position=t.position||"top"),t}),{stepsRef:v,guidePosition:m,guideClassList:c,updateGuidePosition:p}=b(i,l),{stepsCount:s,closeGuide:d,setCurrentIndex:u}=N(i,o,p,n);return e.onMounted(()=>{p()}),o.expose({closeGuide:d,setCurrentIndex:u}),()=>n.value>-1&&s.value>0?e.createVNode(e.Teleport,{to:"body"},{default:()=>[e.createVNode("div",{style:m,class:c,ref:v},[e.createVNode("div",{class:"devui-shining-dot"},null),e.createVNode("div",{class:"devui-shining-plus"},null),e.createVNode("div",{class:"devui-arrow"},null),e.createVNode("div",{class:"devui-guide-container"},[e.createVNode("p",{class:"devui-title"},[l.value.title]),i.showClose?e.createVNode("div",{class:"icon icon-close",onClick:d},null):null,e.createVNode("div",{class:"devui-content"},[l.value.content]),e.createVNode("div",{class:"devui-ctrl"},[i.showDots?e.createVNode("div",{class:"devui-dots"},[i.steps.map((t,g)=>e.createVNode("em",{class:["icon icon-dot-status",l.value===t?"devui-active":""],key:g},null))]):null,e.createVNode("div",{class:"devui-guide-btn"},[n.value>0?e.createVNode("div",{class:"devui-prev-step",onClick:()=>u(n.value-1)},["\u4E0A\u4E00\u6B65"]):null,n.value===s.value-1?e.createVNode("div",{onClick:d},["\u6211\u77E5\u9053\u5566"]):e.createVNode("div",{class:"devui-next-step",onClick:()=>{u(n.value+1)}},["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]}):null}}),V={mounted(i,o,r){},updated(i,o){}};h.install=function(i){i.component(h.name,h)};var w={title:"StepsGuide \u64CD\u4F5C\u6307\u5F15",category:"\u5BFC\u822A",status:"80%",install(i){i.use(h),i.directive("StepsGuide",V)}};a.StepsGuide=h,a.default=w,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});