vue-devui 1.0.0-beta.6 → 1.0.0-beta.7
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/back-top/index.es.js +61 -5
- package/back-top/index.umd.js +1 -1
- package/back-top/style.css +1 -1
- package/button/index.es.js +3 -3
- package/button/index.umd.js +1 -1
- package/carousel/index.es.js +3 -3
- package/carousel/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +57 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/date-picker/index.es.js +14 -14
- package/date-picker/index.umd.js +1 -1
- package/editable-select/index.es.js +3 -3
- package/editable-select/index.umd.js +9 -9
- package/form/index.es.js +22 -7
- package/form/index.umd.js +1 -1
- package/icon/index.es.js +3 -3
- package/icon/index.umd.js +1 -1
- package/input/index.es.js +11 -11
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +331 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.es.js +3 -3
- package/input-number/index.umd.js +1 -1
- package/modal/index.es.js +3 -3
- package/modal/index.umd.js +1 -1
- package/package.json +2 -32
- package/search/index.es.js +11 -11
- package/search/index.umd.js +1 -1
- package/select/index.es.js +3 -3
- package/select/index.umd.js +1 -1
- package/steps-guide/index.es.js +97 -74
- package/steps-guide/index.umd.js +1 -1
- package/style.css +1 -1
- package/table/index.es.js +1490 -157
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tag/index.es.js +65 -9
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/time-axis/index.es.js +3 -3
- package/time-axis/index.umd.js +1 -1
- package/time-picker/index.es.js +3 -3
- package/time-picker/index.umd.js +1 -1
- package/toast/index.es.js +3 -3
- package/toast/index.umd.js +1 -1
- package/transfer/index.es.js +299 -60
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/upload/index.es.js +4 -4
- package/upload/index.umd.js +1 -1
- package/vue-devui.es.js +1153 -324
- package/vue-devui.umd.js +17 -17
package/steps-guide/index.es.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, reactive, nextTick, computed, defineComponent, onMounted, createVNode, Teleport } from "vue";
|
|
2
2
|
var stepsGuide = "";
|
|
3
3
|
const stepsGuideProps = {
|
|
4
4
|
steps: Array,
|
|
5
|
+
stepIndex: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: void 0
|
|
8
|
+
},
|
|
5
9
|
showClose: {
|
|
6
10
|
type: Boolean,
|
|
7
11
|
default: true
|
|
@@ -9,22 +13,33 @@ const stepsGuideProps = {
|
|
|
9
13
|
showDots: {
|
|
10
14
|
type: Boolean,
|
|
11
15
|
default: true
|
|
16
|
+
},
|
|
17
|
+
scrollToTargetSwitch: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
21
|
+
zIndex: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 1100
|
|
24
|
+
},
|
|
25
|
+
stepChange: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default() {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
12
30
|
}
|
|
13
31
|
};
|
|
14
|
-
function
|
|
15
|
-
const currentStep = computed(() => {
|
|
16
|
-
const _step = steps[stepIndex.value];
|
|
17
|
-
_step.position = _step.position || "top";
|
|
18
|
-
return _step;
|
|
19
|
-
});
|
|
32
|
+
function useStepsGuidePosition(props, currentStep) {
|
|
20
33
|
const guideClassList = ["devui-steps-guide"];
|
|
21
34
|
const stepsRef = ref(null);
|
|
22
35
|
const guidePosition = reactive({
|
|
23
36
|
left: "",
|
|
24
37
|
top: "",
|
|
25
|
-
zIndex:
|
|
38
|
+
zIndex: props.zIndex
|
|
26
39
|
});
|
|
27
40
|
const updateGuidePosition = () => {
|
|
41
|
+
if (!currentStep.value)
|
|
42
|
+
return;
|
|
28
43
|
const baseTop = window.pageYOffset - document.documentElement.clientTop;
|
|
29
44
|
const baseLeft = window.pageXOffset - document.documentElement.clientLeft;
|
|
30
45
|
const currentStepPosition = currentStep.value.position;
|
|
@@ -70,96 +85,97 @@ function useStepsGuideNav(steps, stepIndex) {
|
|
|
70
85
|
}
|
|
71
86
|
guidePosition.left = _left + "px";
|
|
72
87
|
guidePosition.top = _top + "px";
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
if (props.scrollToTargetSwitch) {
|
|
89
|
+
nextTick(() => {
|
|
90
|
+
stepGuideElement.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
91
|
+
});
|
|
92
|
+
}
|
|
76
93
|
};
|
|
77
94
|
return {
|
|
78
|
-
currentStep,
|
|
79
95
|
stepsRef,
|
|
80
96
|
guidePosition,
|
|
81
97
|
guideClassList,
|
|
82
98
|
updateGuidePosition
|
|
83
99
|
};
|
|
84
100
|
}
|
|
85
|
-
function useStepsGuideCtrl(
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
101
|
+
function useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex) {
|
|
102
|
+
const stepsCount = computed(() => props.steps.length);
|
|
103
|
+
const closeGuide = () => {
|
|
104
|
+
const _index = stepIndex.value;
|
|
105
|
+
stepIndex.value = -1;
|
|
106
|
+
nextTick(() => {
|
|
107
|
+
ctx.emit("guide-close", _index);
|
|
108
|
+
});
|
|
89
109
|
};
|
|
90
110
|
const setCurrentIndex = (index2) => {
|
|
91
|
-
if (index2
|
|
92
|
-
index2
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
if (index2 !== -1 && props.stepChange()) {
|
|
112
|
+
if (index2 > -1 && index2 < stepsCount.value) {
|
|
113
|
+
stepIndex.value = index2;
|
|
114
|
+
console.log(stepIndex.value, index2, stepsCount.value);
|
|
115
|
+
nextTick(() => {
|
|
116
|
+
console.log(stepIndex.value, index2, stepsCount.value);
|
|
117
|
+
updateGuidePosition();
|
|
118
|
+
});
|
|
119
|
+
} else {
|
|
120
|
+
console.error(`stepIndex is not within the value range`);
|
|
121
|
+
}
|
|
101
122
|
}
|
|
123
|
+
if (index2 === -1)
|
|
124
|
+
closeGuide();
|
|
102
125
|
};
|
|
103
126
|
return {
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
stepsCount,
|
|
128
|
+
closeGuide,
|
|
106
129
|
setCurrentIndex
|
|
107
130
|
};
|
|
108
131
|
}
|
|
109
132
|
var StepsGuide = defineComponent({
|
|
110
133
|
name: "DStepsGuide",
|
|
111
134
|
props: stepsGuideProps,
|
|
112
|
-
emits: [],
|
|
135
|
+
emits: ["guide-close", "update:stepIndex"],
|
|
113
136
|
setup(props, ctx) {
|
|
114
|
-
|
|
115
|
-
const
|
|
137
|
+
var _a;
|
|
138
|
+
const stepIndexData = ref((_a = props.stepIndex) != null ? _a : 0);
|
|
139
|
+
const stepIndex = computed({
|
|
140
|
+
set: (val) => {
|
|
141
|
+
if (props.stepIndex != null) {
|
|
142
|
+
ctx.emit("update:stepIndex", val);
|
|
143
|
+
}
|
|
144
|
+
stepIndexData.value = val;
|
|
145
|
+
},
|
|
146
|
+
get: () => stepIndexData.value
|
|
147
|
+
});
|
|
148
|
+
const currentStep = computed(() => {
|
|
149
|
+
const _step = props.steps[stepIndex.value];
|
|
150
|
+
if (_step)
|
|
151
|
+
_step.position = _step.position || "top";
|
|
152
|
+
return _step;
|
|
153
|
+
});
|
|
116
154
|
const {
|
|
117
|
-
currentStep,
|
|
118
155
|
stepsRef,
|
|
119
156
|
guidePosition,
|
|
120
157
|
guideClassList,
|
|
121
158
|
updateGuidePosition
|
|
122
|
-
} =
|
|
159
|
+
} = useStepsGuidePosition(props, currentStep);
|
|
123
160
|
const {
|
|
124
|
-
|
|
125
|
-
|
|
161
|
+
stepsCount,
|
|
162
|
+
closeGuide,
|
|
126
163
|
setCurrentIndex
|
|
127
|
-
} = useStepsGuideCtrl(
|
|
164
|
+
} = useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex);
|
|
128
165
|
onMounted(() => {
|
|
129
166
|
updateGuidePosition();
|
|
130
167
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
guideClassList,
|
|
137
|
-
stepsRef,
|
|
138
|
-
currentStep,
|
|
139
|
-
setCurrentIndex,
|
|
140
|
-
closeSteps
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
render(props) {
|
|
144
|
-
const {
|
|
145
|
-
showSteps,
|
|
146
|
-
guidePosition,
|
|
147
|
-
guideClassList,
|
|
148
|
-
currentStep,
|
|
149
|
-
stepIndex,
|
|
150
|
-
stepsCount,
|
|
151
|
-
setCurrentIndex,
|
|
152
|
-
closeSteps,
|
|
153
|
-
showClose,
|
|
154
|
-
showDots
|
|
155
|
-
} = props;
|
|
156
|
-
return showSteps ? createVNode(Teleport, {
|
|
168
|
+
ctx.expose({
|
|
169
|
+
closeGuide,
|
|
170
|
+
setCurrentIndex
|
|
171
|
+
});
|
|
172
|
+
return () => stepIndex.value > -1 && stepsCount.value > 0 ? createVNode(Teleport, {
|
|
157
173
|
"to": "body"
|
|
158
174
|
}, {
|
|
159
175
|
default: () => [createVNode("div", {
|
|
160
176
|
"style": guidePosition,
|
|
161
177
|
"class": guideClassList,
|
|
162
|
-
"ref":
|
|
178
|
+
"ref": stepsRef
|
|
163
179
|
}, [createVNode("div", {
|
|
164
180
|
"class": "devui-shining-dot"
|
|
165
181
|
}, null), createVNode("div", {
|
|
@@ -170,45 +186,52 @@ var StepsGuide = defineComponent({
|
|
|
170
186
|
"class": "devui-guide-container"
|
|
171
187
|
}, [createVNode("p", {
|
|
172
188
|
"class": "devui-title"
|
|
173
|
-
}, [currentStep.title]), showClose ? createVNode("div", {
|
|
189
|
+
}, [currentStep.value.title]), props.showClose ? createVNode("div", {
|
|
174
190
|
"class": "icon icon-close",
|
|
175
|
-
"onClick":
|
|
191
|
+
"onClick": closeGuide
|
|
176
192
|
}, null) : null, createVNode("div", {
|
|
177
193
|
"class": "devui-content"
|
|
178
|
-
}, [currentStep.content]), createVNode("div", {
|
|
194
|
+
}, [currentStep.value.content]), createVNode("div", {
|
|
179
195
|
"class": "devui-ctrl"
|
|
180
|
-
}, [showDots ? createVNode("div", {
|
|
196
|
+
}, [props.showDots ? createVNode("div", {
|
|
181
197
|
"class": "devui-dots"
|
|
182
198
|
}, [props.steps.map((step, index2) => {
|
|
183
199
|
return createVNode("em", {
|
|
184
|
-
"class": ["icon icon-dot-status", currentStep === step ? "devui-active" : ""],
|
|
200
|
+
"class": ["icon icon-dot-status", currentStep.value === step ? "devui-active" : ""],
|
|
185
201
|
"key": index2
|
|
186
202
|
}, null);
|
|
187
203
|
})]) : null, createVNode("div", {
|
|
188
204
|
"class": "devui-guide-btn"
|
|
189
|
-
}, [stepIndex > 0 ? createVNode("div", {
|
|
205
|
+
}, [stepIndex.value > 0 ? createVNode("div", {
|
|
190
206
|
"class": "devui-prev-step",
|
|
191
|
-
"onClick": () => setCurrentIndex(
|
|
192
|
-
}, ["\u4E0A\u4E00\u6B65"]) : null, stepIndex === stepsCount ? createVNode("div", {
|
|
193
|
-
"onClick":
|
|
207
|
+
"onClick": () => setCurrentIndex(stepIndex.value - 1)
|
|
208
|
+
}, ["\u4E0A\u4E00\u6B65"]) : null, stepIndex.value === stepsCount.value - 1 ? createVNode("div", {
|
|
209
|
+
"onClick": closeGuide
|
|
194
210
|
}, ["\u6211\u77E5\u9053\u5566"]) : createVNode("div", {
|
|
195
211
|
"class": "devui-next-step",
|
|
196
212
|
"onClick": () => {
|
|
197
|
-
setCurrentIndex(
|
|
213
|
+
setCurrentIndex(stepIndex.value + 1);
|
|
198
214
|
}
|
|
199
215
|
}, ["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]
|
|
200
216
|
}) : null;
|
|
201
217
|
}
|
|
202
218
|
});
|
|
219
|
+
var StepsGuideDirective = {
|
|
220
|
+
mounted(el, binding, vNode) {
|
|
221
|
+
},
|
|
222
|
+
updated(el, binding) {
|
|
223
|
+
}
|
|
224
|
+
};
|
|
203
225
|
StepsGuide.install = function(app) {
|
|
204
226
|
app.component(StepsGuide.name, StepsGuide);
|
|
205
227
|
};
|
|
206
228
|
var index = {
|
|
207
229
|
title: "StepsGuide \u64CD\u4F5C\u6307\u5F15",
|
|
208
230
|
category: "\u5BFC\u822A",
|
|
209
|
-
status: "
|
|
231
|
+
status: "80%",
|
|
210
232
|
install(app) {
|
|
211
233
|
app.use(StepsGuide);
|
|
234
|
+
app.directive("StepsGuide", StepsGuideDirective);
|
|
212
235
|
}
|
|
213
236
|
};
|
|
214
237
|
export { StepsGuide, index as default };
|
package/steps-guide/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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"});
|