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.
Files changed (58) hide show
  1. package/back-top/index.es.js +61 -5
  2. package/back-top/index.umd.js +1 -1
  3. package/back-top/style.css +1 -1
  4. package/button/index.es.js +3 -3
  5. package/button/index.umd.js +1 -1
  6. package/carousel/index.es.js +3 -3
  7. package/carousel/index.umd.js +1 -1
  8. package/comment/index.d.ts +7 -0
  9. package/comment/index.es.js +57 -0
  10. package/comment/index.umd.js +1 -0
  11. package/comment/package.json +7 -0
  12. package/comment/style.css +1 -0
  13. package/date-picker/index.es.js +14 -14
  14. package/date-picker/index.umd.js +1 -1
  15. package/editable-select/index.es.js +3 -3
  16. package/editable-select/index.umd.js +9 -9
  17. package/form/index.es.js +22 -7
  18. package/form/index.umd.js +1 -1
  19. package/icon/index.es.js +3 -3
  20. package/icon/index.umd.js +1 -1
  21. package/input/index.es.js +11 -11
  22. package/input/index.umd.js +1 -1
  23. package/input-icon/index.d.ts +7 -0
  24. package/input-icon/index.es.js +331 -0
  25. package/input-icon/index.umd.js +1 -0
  26. package/input-icon/package.json +7 -0
  27. package/input-icon/style.css +1 -0
  28. package/input-number/index.es.js +3 -3
  29. package/input-number/index.umd.js +1 -1
  30. package/modal/index.es.js +3 -3
  31. package/modal/index.umd.js +1 -1
  32. package/package.json +2 -32
  33. package/search/index.es.js +11 -11
  34. package/search/index.umd.js +1 -1
  35. package/select/index.es.js +3 -3
  36. package/select/index.umd.js +1 -1
  37. package/steps-guide/index.es.js +97 -74
  38. package/steps-guide/index.umd.js +1 -1
  39. package/style.css +1 -1
  40. package/table/index.es.js +1490 -157
  41. package/table/index.umd.js +1 -1
  42. package/table/style.css +1 -1
  43. package/tag/index.es.js +65 -9
  44. package/tag/index.umd.js +1 -1
  45. package/tag/style.css +1 -1
  46. package/time-axis/index.es.js +3 -3
  47. package/time-axis/index.umd.js +1 -1
  48. package/time-picker/index.es.js +3 -3
  49. package/time-picker/index.umd.js +1 -1
  50. package/toast/index.es.js +3 -3
  51. package/toast/index.umd.js +1 -1
  52. package/transfer/index.es.js +299 -60
  53. package/transfer/index.umd.js +1 -1
  54. package/transfer/style.css +1 -1
  55. package/upload/index.es.js +4 -4
  56. package/upload/index.umd.js +1 -1
  57. package/vue-devui.es.js +1153 -324
  58. package/vue-devui.umd.js +17 -17
@@ -1,7 +1,11 @@
1
- import { computed, ref, reactive, nextTick, defineComponent, onMounted, createVNode, Teleport } from "vue";
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 useStepsGuideNav(steps, stepIndex) {
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: 1100
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
- nextTick(() => {
74
- stepGuideElement.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
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(stepsCount, stepIndex, updateGuidePosition) {
86
- const showSteps = ref(true);
87
- const closeSteps = () => {
88
- showSteps.value = false;
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 > stepsCount.value || index2 < 0)
92
- index2 = 0;
93
- stepIndex.value = index2;
94
- if (!showSteps.value) {
95
- showSteps.value = true;
96
- nextTick(() => {
97
- updateGuidePosition();
98
- });
99
- } else {
100
- updateGuidePosition();
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
- showSteps,
105
- closeSteps,
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
- const stepsCount = computed(() => props.steps.length - 1);
115
- const stepIndex = ref(0);
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
- } = useStepsGuideNav(props.steps, stepIndex);
159
+ } = useStepsGuidePosition(props, currentStep);
123
160
  const {
124
- showSteps,
125
- closeSteps,
161
+ stepsCount,
162
+ closeGuide,
126
163
  setCurrentIndex
127
- } = useStepsGuideCtrl(stepsCount, stepIndex, updateGuidePosition);
164
+ } = useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex);
128
165
  onMounted(() => {
129
166
  updateGuidePosition();
130
167
  });
131
- return {
132
- stepsCount,
133
- stepIndex,
134
- showSteps,
135
- guidePosition,
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": "stepsRef"
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": closeSteps
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(--props.stepIndex)
192
- }, ["\u4E0A\u4E00\u6B65"]) : null, stepIndex === stepsCount ? createVNode("div", {
193
- "onClick": closeSteps
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(++props.stepIndex);
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: "50%",
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 };
@@ -1 +1 @@
1
- (function(d,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d.index={},d.Vue))})(this,function(d,e){"use strict";var y="";const V={steps:Array,showClose:{type:Boolean,default:!0},showDots:{type:Boolean,default:!0}};function N(t,h){const o=e.computed(()=>{const l=t[h.value];return l.position=l.position||"top",l}),i=["devui-steps-guide"],r=e.ref(null),u=e.reactive({left:"",top:"",zIndex:1100});return{currentStep:o,stepsRef:r,guidePosition:u,guideClassList:i,updateGuidePosition:()=>{const l=window.pageYOffset-document.documentElement.clientTop,g=window.pageXOffset-document.documentElement.clientLeft,f=o.value.position,s=r.value;let c,p;if(typeof f!="string"){const{top:C=0,left:n=0,type:v="top"}=f;i.splice(1,1,v),c=n,p=C}else{i.splice(1,1,f);const C=o.value.target||o.value.trigger,n=document.querySelector(C),v=n.getBoundingClientRect();c=v.left+n.clientWidth/2-s.clientWidth/2+g,p=v.top+n.clientHeight/2-s.clientHeight/2+l;const S=f.split("-");switch(S[0]){case"top":p+=-s.clientHeight/2-n.clientHeight;break;case"bottom":p+=s.clientHeight/2+n.clientHeight;break;case"left":p+=s.clientHeight/2-n.clientHeight,c+=-s.clientWidth/2-n.clientWidth/2;break;case"right":p+=s.clientHeight/2-n.clientHeight,c+=s.clientWidth/2+n.clientWidth/2;break}switch(S[1]){case"left":c+=s.clientWidth/2-n.clientWidth/2;break;case"right":c+=-s.clientWidth/2+n.clientWidth/2;break}}u.left=c+"px",u.top=p+"px",e.nextTick(()=>{s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})}}}function b(t,h,o){const i=e.ref(!0);return{showSteps:i,closeSteps:()=>{i.value=!1},setCurrentIndex:a=>{(a>t.value||a<0)&&(a=0),h.value=a,i.value?o():(i.value=!0,e.nextTick(()=>{o()}))}}}var m=e.defineComponent({name:"DStepsGuide",props:V,emits:[],setup(t,h){const o=e.computed(()=>t.steps.length-1),i=e.ref(0),{currentStep:r,stepsRef:u,guidePosition:a,guideClassList:l,updateGuidePosition:g}=N(t.steps,i),{showSteps:f,closeSteps:s,setCurrentIndex:c}=b(o,i,g);return e.onMounted(()=>{g()}),{stepsCount:o,stepIndex:i,showSteps:f,guidePosition:a,guideClassList:l,stepsRef:u,currentStep:r,setCurrentIndex:c,closeSteps:s}},render(t){const{showSteps:h,guidePosition:o,guideClassList:i,currentStep:r,stepIndex:u,stepsCount:a,setCurrentIndex:l,closeSteps:g,showClose:f,showDots:s}=t;return h?e.createVNode(e.Teleport,{to:"body"},{default:()=>[e.createVNode("div",{style:o,class:i,ref:"stepsRef"},[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"},[r.title]),f?e.createVNode("div",{class:"icon icon-close",onClick:g},null):null,e.createVNode("div",{class:"devui-content"},[r.content]),e.createVNode("div",{class:"devui-ctrl"},[s?e.createVNode("div",{class:"devui-dots"},[t.steps.map((c,p)=>e.createVNode("em",{class:["icon icon-dot-status",r===c?"devui-active":""],key:p},null))]):null,e.createVNode("div",{class:"devui-guide-btn"},[u>0?e.createVNode("div",{class:"devui-prev-step",onClick:()=>l(--t.stepIndex)},["\u4E0A\u4E00\u6B65"]):null,u===a?e.createVNode("div",{onClick:g},["\u6211\u77E5\u9053\u5566"]):e.createVNode("div",{class:"devui-next-step",onClick:()=>{l(++t.stepIndex)}},["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]}):null}});m.install=function(t){t.component(m.name,m)};var w={title:"StepsGuide \u64CD\u4F5C\u6307\u5F15",category:"\u5BFC\u822A",status:"50%",install(t){t.use(m)}};d.StepsGuide=m,d.default=w,Object.defineProperty(d,"__esModule",{value:!0}),d[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 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"});