vue-devui 1.0.0-beta.4 → 1.0.0-beta.8
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/alert/index.es.js +1 -1
- package/alert/index.umd.js +1 -1
- package/anchor/index.d.ts +7 -0
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +1 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +1 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/button/index.d.ts +7 -0
- package/button/index.es.js +4 -4
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +1 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +3 -3
- package/carousel/index.umd.js +1 -1
- 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/checkbox/index.es.js +1 -1
- package/checkbox/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/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +167 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +15 -15
- package/date-picker/index.umd.js +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +33 -9
- package/drawer/index.umd.js +1 -1
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +61 -61
- package/dropdown/index.umd.js +1 -1
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +53 -26
- package/editable-select/index.umd.js +9 -9
- package/form/index.d.ts +7 -0
- package/form/index.es.js +175 -80
- package/form/index.umd.js +1 -1
- package/form/style.css +1 -1
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +1 -1
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +2 -2
- package/grid/index.umd.js +1 -1
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +4 -4
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +23 -2
- package/image-preview/index.umd.js +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +12 -12
- 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.d.ts +7 -0
- package/input-number/index.es.js +3 -3
- package/input-number/index.umd.js +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +1 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +58 -57
- package/modal/index.umd.js +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +56 -55
- package/overlay/index.umd.js +1 -1
- package/package.json +2 -31
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +3 -3
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +1 -1
- package/popover/index.umd.js +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +1 -1
- package/progress/index.umd.js +2 -2
- package/quadrant-diagram/index.d.ts +7 -0
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +1 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +1 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +61 -24
- package/read-tip/index.umd.js +1 -1
- package/read-tip/style.css +1 -1
- package/result/index.d.ts +7 -0
- package/result/index.es.js +118 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +5 -2
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +14 -14
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +3 -3
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +148 -26
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +1 -1
- package/slider/index.umd.js +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +24 -25
- package/splitter/index.umd.js +1 -1
- package/status/index.d.ts +7 -0
- package/status/index.es.js +1 -1
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +97 -74
- package/steps-guide/index.umd.js +1 -1
- package/sticky/index.d.ts +7 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +1 -1
- package/switch/index.umd.js +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1492 -157
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +1 -0
- package/tabs/index.umd.js +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +94 -12
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +1 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +1 -1
- package/textarea/index.umd.js +1 -1
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +240 -21
- package/time-axis/index.umd.js +1 -1
- package/time-axis/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +12 -7
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +4 -4
- package/toast/index.umd.js +1 -1
- package/tooltip/index.d.ts +7 -0
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +301 -62
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +160 -31
- package/tree/index.umd.js +1 -1
- 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/upload/index.es.js +4 -4
- package/upload/index.umd.js +1 -1
- package/vue-devui.es.js +14014 -11820
- package/vue-devui.umd.js +19 -19
package/splitter/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, inject, reactive, ref,
|
|
7
|
+
import { defineComponent, inject, reactive, ref, watch, computed, onMounted, withDirectives, createVNode, provide, resolveComponent, onUpdated } from "vue";
|
|
8
8
|
const splitterProps = {
|
|
9
9
|
orientation: {
|
|
10
10
|
type: String,
|
|
@@ -141,28 +141,26 @@ var DSplitterBar = defineComponent({
|
|
|
141
141
|
wrapperClass: `devui-splitter-bar devui-splitter-bar-${props.orientation}`
|
|
142
142
|
});
|
|
143
143
|
const domRef = ref();
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
watch([() => props.splitBarSize, domRef], ([curSplitBarSize, ele]) => {
|
|
145
|
+
if (!(ele instanceof HTMLElement)) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
setStyle(ele, {
|
|
149
|
+
flexBasis: curSplitBarSize
|
|
150
|
+
});
|
|
151
|
+
}, {
|
|
152
|
+
immediate: true
|
|
153
|
+
});
|
|
154
|
+
watch([() => store.state.panes, domRef], ([panes, ele]) => {
|
|
155
|
+
if (!store.isStaticBar(props.index)) {
|
|
156
|
+
state.wrapperClass += " resizable";
|
|
157
|
+
} else {
|
|
149
158
|
setStyle(ele, {
|
|
150
|
-
flexBasis:
|
|
159
|
+
flexBasis: props.disabledBarSize
|
|
151
160
|
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
watch([() => store.state.panes, domRef], ([panes, ele]) => {
|
|
156
|
-
if (!store.isStaticBar(props.index)) {
|
|
157
|
-
state.wrapperClass += " resizable";
|
|
158
|
-
} else {
|
|
159
|
-
setStyle(ele, {
|
|
160
|
-
flexBasis: props.disabledBarSize
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
deep: true
|
|
165
|
-
});
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
deep: true
|
|
166
164
|
});
|
|
167
165
|
const coordinate = {
|
|
168
166
|
pageX: 0,
|
|
@@ -522,8 +520,7 @@ var SplitterPane = defineComponent({
|
|
|
522
520
|
order
|
|
523
521
|
});
|
|
524
522
|
});
|
|
525
|
-
const setSizeStyle = (curSize) => {
|
|
526
|
-
const ele = domRef.value;
|
|
523
|
+
const setSizeStyle = (curSize, ele) => {
|
|
527
524
|
if (!ele) {
|
|
528
525
|
return;
|
|
529
526
|
}
|
|
@@ -535,7 +532,9 @@ var SplitterPane = defineComponent({
|
|
|
535
532
|
removeClass(ele, paneFixedClass);
|
|
536
533
|
}
|
|
537
534
|
};
|
|
538
|
-
watch(() => props.size,
|
|
535
|
+
watch([() => props.size, domRef], ([size, ele]) => {
|
|
536
|
+
setSizeStyle(size, ele);
|
|
537
|
+
}, {
|
|
539
538
|
immediate: true
|
|
540
539
|
});
|
|
541
540
|
const orientation = inject("orientation");
|
|
@@ -619,7 +618,7 @@ Splitter.install = function(app) {
|
|
|
619
618
|
var index = {
|
|
620
619
|
title: "Splitter \u5206\u5272\u5668",
|
|
621
620
|
category: "\u5E03\u5C40",
|
|
622
|
-
status: "
|
|
621
|
+
status: "100%",
|
|
623
622
|
install(app) {
|
|
624
623
|
app.use(Splitter);
|
|
625
624
|
}
|
package/splitter/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _=Object.defineProperty;var K=(g,o,C)=>o in g?_(g,o,{enumerable:!0,configurable:!0,writable:!0,value:C}):g[o]=C;var k=(g,o,C)=>(K(g,typeof o!="symbol"?o+"":o,C),C);(function(g,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(g=typeof globalThis!="undefined"?globalThis:g||self,o(g.index={},g.Vue))})(this,function(g,o){"use strict";const C={orientation:{type:String,default:"horizontal"},splitBarSize:{type:String,default:"2px"},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean,default:!0}};function y(t,e){const i={},s=Object.keys(e);return s.forEach(n=>{i[n]=t.style[n]}),s.forEach(n=>{t.style[n]=e[n]}),i}function N(t,e){return t.classList?t.classList.contains(e):` ${t.className} `.indexOf(` ${e} `)>-1}function B(t,e){t.classList?t.classList.add(e):N(t,e)||(t.className=`${t.className} ${e}`)}function b(t,e){if(t.classList)t.classList.remove(e);else if(N(t,e)){const i=t.className;t.className=` ${i} `.replace(` ${e} `," ")}}const F={mounted(t,{value:e}){t.$value=e,e.enableResize&&H(t)},unmounted(t,{value:e}){e.enableResize&&$(t,"mousedown",D)}};function H(t){R(t,"mousedown",D)}function R(t,e,i){t.addEventListener&&t.addEventListener(e,i)}function $(t,e,i){t.removeEventListener&&t.removeEventListener(e,i)}function D(t){var n;const e=(n=t==null?void 0:t.target)==null?void 0:n.$value;if(!e)return;R(document,"mousemove",i),R(document,"mouseup",s),e.onPressEvent(E(t));function i(p){e.onDragEvent(E(p))}function s(p){$(document,"mousemove",i),$(document,"mouseup",s),e.onReleaseEvent(E(p))}}function E(t){return{pageX:t.pageX,pageY:t.pageY,clientX:t.clientX,clientY:t.clientY,offsetX:t.offsetX,offsetY:t.offsetY,type:t.type,originalEvent:t}}var U="";const T={index:{type:Number},orientation:{type:String,required:!0},splitBarSize:{type:String,required:!0},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean}};var q=o.defineComponent({name:"DSplitterBar",props:T,setup(t){const e=o.inject("splitterStore"),i=o.reactive({wrapperClass:`devui-splitter-bar devui-splitter-bar-${t.orientation}`}),s=o.ref();o.onMounted(()=>{o.watch([()=>t.splitBarSize,s],([a,c])=>{c instanceof HTMLElement&&y(c,{flexBasis:a})},{immediate:!0}),o.watch([()=>e.state.panes,s],([a,c])=>{e.isStaticBar(t.index)?y(c,{flexBasis:t.disabledBarSize}):i.wrapperClass+=" resizable"},{deep:!0})});const n={pageX:0,pageY:0,originalX:0,originalY:0};let p;const d={enableResize:!0,onPressEvent:function({originalEvent:a}){a.stopPropagation(),!!e.isResizable(t.index)&&(p=e.dragState(t.index),n.originalX=a.pageX,n.originalY=a.pageY)},onDragEvent:function({originalEvent:a}){if(a.stopPropagation(),!e.isResizable(t.index))return;n.pageX=a.pageX,n.pageY=a.pageY;let c;t.orientation==="vertical"?c=n.pageY-n.originalY:c=n.pageX-n.originalX,e.setSize(p,c)},onReleaseEvent:function({originalEvent:a}){if(a.stopPropagation(),!e.isResizable(t.index))return;n.pageX=a.pageX,n.pageY=a.pageY;let c;t.orientation==="vertical"?c=n.pageY-n.originalY:c=n.pageX-n.originalX,e.setSize(p,c)}},u=(a,c)=>{const S=e.getPane(a),h=e.getPane(c);return{pane:S,nearPane:h}},f=(a,c,S)=>{var w,M,V,j;const h=((M=(w=a==null?void 0:a.component)==null?void 0:w.props)==null?void 0:M.collapsible)&&S,P=(j=(V=a==null?void 0:a.component)==null?void 0:V.props)==null?void 0:j.collapsed,Y=c.collapsed;return{"devui-collapse":h,collapsed:P,hidden:Y}},z=o.computed(()=>{var h,P;const{pane:a,nearPane:c}=u(t.index,t.index+1),S=((P=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:P.collapseDirection)!=="after"||t.index===0;return f(a,c,S)}),x=o.computed(()=>{var h,P;const{pane:a,nearPane:c}=u(t.index+1,t.index),S=((P=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:P.collapseDirection)!=="before"||t.index+1===e.state.paneCount-1;return f(a,c,S)}),l=()=>{var h,P,Y,w;const{pane:a,nearPane:c}=u(t.index,t.index+1);((P=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:P.collapsed)||((w=(Y=c==null?void 0:c.component)==null?void 0:Y.props)==null?void 0:w.collapsed)?B(s.value,"none-resizable"):b(s.value,"none-resizable")},r=a=>{e.tooglePane(t.index,t.index+1,a),l()},m=a=>{e.tooglePane(t.index+1,t.index,a),l()},X=()=>{r(!0),m(!0)};return o.onMounted(()=>{X()}),()=>o.withDirectives(o.createVNode("div",{class:i.wrapperClass,ref:s},[t.showCollapseButton?o.createVNode("div",{class:["prev",z.value],onClick:()=>{r()}},null):null,o.createVNode("div",{class:"devui-resize-handle"},null),t.showCollapseButton?o.createVNode("div",{class:["next",x.value],onClick:()=>m()},null):null]),[[F,d]])}});class G{constructor(){k(this,"state");this.state=o.reactive({panes:[],splitterContainerSize:0,paneCount:0})}setPanes({panes:e}){this.state.panes=e.map((i,s)=>{var n;return i.component&&(i.component.exposed.order.value=s*2),i.getPaneSize=(n=i==null?void 0:i.component)==null?void 0:n.exposed.getPaneSize,i}),this.state.paneCount=e.length}setSplitter({containerSize:e}){this.state.splitterContainerSize=e}getPane(e){if(!this.state.panes||e<0||e>=this.state.panes.length)throw new Error("no pane can return.");return this.state.panes[e]}dragState(e){const i=this.getPane(e),s=this.getPane(e+1),n=i.getPaneSize()+s.getPaneSize();return{prev:{index:e,initialSize:i.getPaneSize(),minSize:this.toPixels(i.component.props.minSize)||n-this.toPixels(s.component.props.maxSize)||0,maxSize:this.toPixels(i.component.props.maxSize)||n-this.toPixels(s.component.props.minSize)||n},next:{index:e+1,initialSize:s.getPaneSize(),minSize:this.toPixels(s.component.props.minSize)||n-this.toPixels(i.component.props.maxSize)||0,maxSize:this.toPixels(s.component.props.maxSize)||n-this.toPixels(i.component.props.minSize)||n}}}clamp(e,i,s){return Math.min(i,Math.max(e,s))}resize(e,i){const s=this.getPane(e.index),n=this.state.splitterContainerSize,p=this.clamp(e.minSize,e.maxSize,e.initialSize+i);let d="";this.isPercent(s.component.props.size)?d=p/n*100+"%":d=p+"px",s.component.props.size=d,s.component.emit("sizeChange",d)}isResizable(e){var p,d,u,f,z,x,l,r;const i=this.getPane(e),s=this.getPane(e+1),n=((d=(p=i==null?void 0:i.component)==null?void 0:p.props)==null?void 0:d.collapsed)||((f=(u=s==null?void 0:s.component)==null?void 0:u.props)==null?void 0:f.collapsed);return((x=(z=i==null?void 0:i.component)==null?void 0:z.props)==null?void 0:x.resizable)&&((r=(l=s==null?void 0:s.component)==null?void 0:l.props)==null?void 0:r.resizable)&&!n}isStaticBar(e){var n,p,d,u;const i=this.getPane(e),s=this.getPane(e+1);return!(((p=(n=i==null?void 0:i.component)==null?void 0:n.props)==null?void 0:p.resizable)&&((u=(d=s==null?void 0:s.component)==null?void 0:d.props)==null?void 0:u.resizable))}isPercent(e){return/%$/.test(e)}toPixels(e){let i=parseFloat(e);return this.isPercent(e)&&(i=this.state.splitterContainerSize*i/100),i}tooglePane(e,i,s){var d,u,f,z,x,l,r,m,X,a,c,S,h;const n=this.getPane(e),p=this.getPane(i);((u=(d=n==null?void 0:n.component)==null?void 0:d.props)==null?void 0:u.collapsible)&&(n.component.props.collapsed=s?(z=(f=n==null?void 0:n.component)==null?void 0:f.props)==null?void 0:z.collapsed:!((l=(x=n==null?void 0:n.component)==null?void 0:x.props)==null?void 0:l.collapsed),(a=(r=p==null?void 0:p.component)==null?void 0:r.exposed)==null||a.toggleNearPaneFlexGrow((X=(m=n==null?void 0:n.component)==null?void 0:m.props)==null?void 0:X.collapsed),(h=n==null?void 0:n.component)==null||h.emit("collapsedChange",(S=(c=n==null?void 0:n.component)==null?void 0:c.props)==null?void 0:S.collapsed))}setSize(e,i){const s=this.getPane(e.prev.index),n=this.getPane(e.next.index);s.component.props.size&&n.component.props.size?(this.resize(e.prev,i),this.resize(e.next,-i)):n.component.props.size?this.resize(e.next,-i):this.resize(e.prev,i)}}var A="",v=o.defineComponent({name:"DSplitter",components:{DSplitterBar:q},props:C,emits:[],setup(t,e){var p,d;const i=new G,s=o.reactive({panes:[]});s.panes=((d=(p=e.slots).DSplitterPane)==null?void 0:d.call(p))||[],i.setPanes({panes:s.panes}),o.provide("orientation",t.orientation),o.provide("splitterStore",i);const n=o.ref();return o.watch(n,u=>{if(!u)return;let f=0;t.orientation==="vertical"?f=u.clientHeight:f=u.clientWidth,i.setSplitter({containerSize:f})}),()=>{const{splitBarSize:u,orientation:f,showCollapseButton:z}=t,x=["devui-splitter",`devui-splitter-${f}`];return o.createVNode("div",{class:x,ref:n},[s.panes,s.panes.filter((l,r,m)=>r!==m.length-1).map((l,r)=>o.createVNode(o.resolveComponent("d-splitter-bar"),{key:r,style:`order: ${r*2+1}`,splitBarSize:u,orientation:f,index:r,showCollapseButton:z},null))])}}});const W={size:{type:String},minSize:{type:String},maxSize:{type:String},resizable:{type:Boolean,default:!0},collapsible:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapseDirection:{type:String,default:"both"},shrink:{type:Boolean,default:!1},shrinkWidth:{type:Number,default:36}};var J="",L=o.defineComponent({name:"DSplitterPane",props:W,emits:["sizeChange","collapsedChange"],setup(t,{slots:e,expose:i}){const s=o.inject("splitterStore"),n=o.ref(),p=o.ref();o.watch([p,n],([l,r])=>{!r||y(r,{order:l})});const d=l=>{const r=n.value;if(!r)return;r.style.flexBasis=l;const m="devui-splitter-pane-fixed";l?B(r,m):b(r,m)};o.watch(()=>t.size,d,{immediate:!0});const u=o.inject("orientation");let f="";o.onMounted(()=>{f=t.size,s.setPanes({panes:s.state.panes})}),o.onUpdated(()=>{s.setPanes({panes:s.state.panes})});const z=()=>{const l=n.value;if(!!l)return u==="vertical"?l.offsetHeight:l.offsetWidth};return o.watch(()=>t.collapsed,l=>{const r=n.value;if(!r)return;const m="devui-splitter-pane-hidden";l?B(r,m):b(r,m),l&&t.shrink?(b(r,m),y(r,{flexBasis:`${t.shrinkWidth}px`})):y(r,{flexBasis:f})},{immediate:!0}),i({order:p,getPaneSize:z,toggleNearPaneFlexGrow:l=>{const r=n.value;if(!(r instanceof HTMLElement))return;const m="devui-splitter-pane-grow";N(r,m)?b(r,m):l&&B(r,m)}}),()=>{var l;return o.createVNode("div",{class:"devui-splitter-pane",ref:n},[(l=e.default)==null?void 0:l.call(e)])}}});v.install=function(t){t.component(v.name,v),t.component(L.name,L)};var O={title:"Splitter \u5206\u5272\u5668",category:"\u5E03\u5C40",status:"\u5DF2\u5B8C\u6210",install(t){t.use(v)}};g.Splitter=v,g.default=O,Object.defineProperty(g,"__esModule",{value:!0}),g[Symbol.toStringTag]="Module"});
|
|
1
|
+
var _=Object.defineProperty;var K=(g,o,C)=>o in g?_(g,o,{enumerable:!0,configurable:!0,writable:!0,value:C}):g[o]=C;var k=(g,o,C)=>(K(g,typeof o!="symbol"?o+"":o,C),C);(function(g,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(g=typeof globalThis!="undefined"?globalThis:g||self,o(g.index={},g.Vue))})(this,function(g,o){"use strict";const C={orientation:{type:String,default:"horizontal"},splitBarSize:{type:String,default:"2px"},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean,default:!0}};function y(t,e){const i={},s=Object.keys(e);return s.forEach(n=>{i[n]=t.style[n]}),s.forEach(n=>{t.style[n]=e[n]}),i}function N(t,e){return t.classList?t.classList.contains(e):` ${t.className} `.indexOf(` ${e} `)>-1}function B(t,e){t.classList?t.classList.add(e):N(t,e)||(t.className=`${t.className} ${e}`)}function b(t,e){if(t.classList)t.classList.remove(e);else if(N(t,e)){const i=t.className;t.className=` ${i} `.replace(` ${e} `," ")}}const F={mounted(t,{value:e}){t.$value=e,e.enableResize&&H(t)},unmounted(t,{value:e}){e.enableResize&&$(t,"mousedown",L)}};function H(t){R(t,"mousedown",L)}function R(t,e,i){t.addEventListener&&t.addEventListener(e,i)}function $(t,e,i){t.removeEventListener&&t.removeEventListener(e,i)}function L(t){var n;const e=(n=t==null?void 0:t.target)==null?void 0:n.$value;if(!e)return;R(document,"mousemove",i),R(document,"mouseup",s),e.onPressEvent(E(t));function i(p){e.onDragEvent(E(p))}function s(p){$(document,"mousemove",i),$(document,"mouseup",s),e.onReleaseEvent(E(p))}}function E(t){return{pageX:t.pageX,pageY:t.pageY,clientX:t.clientX,clientY:t.clientY,offsetX:t.offsetX,offsetY:t.offsetY,type:t.type,originalEvent:t}}var U="";const T={index:{type:Number},orientation:{type:String,required:!0},splitBarSize:{type:String,required:!0},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean}};var q=o.defineComponent({name:"DSplitterBar",props:T,setup(t){const e=o.inject("splitterStore"),i=o.reactive({wrapperClass:`devui-splitter-bar devui-splitter-bar-${t.orientation}`}),s=o.ref();o.watch([()=>t.splitBarSize,s],([a,c])=>{c instanceof HTMLElement&&y(c,{flexBasis:a})},{immediate:!0}),o.watch([()=>e.state.panes,s],([a,c])=>{e.isStaticBar(t.index)?y(c,{flexBasis:t.disabledBarSize}):i.wrapperClass+=" resizable"},{deep:!0});const n={pageX:0,pageY:0,originalX:0,originalY:0};let p;const d={enableResize:!0,onPressEvent:function({originalEvent:a}){a.stopPropagation(),!!e.isResizable(t.index)&&(p=e.dragState(t.index),n.originalX=a.pageX,n.originalY=a.pageY)},onDragEvent:function({originalEvent:a}){if(a.stopPropagation(),!e.isResizable(t.index))return;n.pageX=a.pageX,n.pageY=a.pageY;let c;t.orientation==="vertical"?c=n.pageY-n.originalY:c=n.pageX-n.originalX,e.setSize(p,c)},onReleaseEvent:function({originalEvent:a}){if(a.stopPropagation(),!e.isResizable(t.index))return;n.pageX=a.pageX,n.pageY=a.pageY;let c;t.orientation==="vertical"?c=n.pageY-n.originalY:c=n.pageX-n.originalX,e.setSize(p,c)}},u=(a,c)=>{const S=e.getPane(a),h=e.getPane(c);return{pane:S,nearPane:h}},f=(a,c,S)=>{var w,M,V,j;const h=((M=(w=a==null?void 0:a.component)==null?void 0:w.props)==null?void 0:M.collapsible)&&S,P=(j=(V=a==null?void 0:a.component)==null?void 0:V.props)==null?void 0:j.collapsed,Y=c.collapsed;return{"devui-collapse":h,collapsed:P,hidden:Y}},z=o.computed(()=>{var h,P;const{pane:a,nearPane:c}=u(t.index,t.index+1),S=((P=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:P.collapseDirection)!=="after"||t.index===0;return f(a,c,S)}),x=o.computed(()=>{var h,P;const{pane:a,nearPane:c}=u(t.index+1,t.index),S=((P=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:P.collapseDirection)!=="before"||t.index+1===e.state.paneCount-1;return f(a,c,S)}),l=()=>{var h,P,Y,w;const{pane:a,nearPane:c}=u(t.index,t.index+1);((P=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:P.collapsed)||((w=(Y=c==null?void 0:c.component)==null?void 0:Y.props)==null?void 0:w.collapsed)?B(s.value,"none-resizable"):b(s.value,"none-resizable")},r=a=>{e.tooglePane(t.index,t.index+1,a),l()},m=a=>{e.tooglePane(t.index+1,t.index,a),l()},X=()=>{r(!0),m(!0)};return o.onMounted(()=>{X()}),()=>o.withDirectives(o.createVNode("div",{class:i.wrapperClass,ref:s},[t.showCollapseButton?o.createVNode("div",{class:["prev",z.value],onClick:()=>{r()}},null):null,o.createVNode("div",{class:"devui-resize-handle"},null),t.showCollapseButton?o.createVNode("div",{class:["next",x.value],onClick:()=>m()},null):null]),[[F,d]])}});class G{constructor(){k(this,"state");this.state=o.reactive({panes:[],splitterContainerSize:0,paneCount:0})}setPanes({panes:e}){this.state.panes=e.map((i,s)=>{var n;return i.component&&(i.component.exposed.order.value=s*2),i.getPaneSize=(n=i==null?void 0:i.component)==null?void 0:n.exposed.getPaneSize,i}),this.state.paneCount=e.length}setSplitter({containerSize:e}){this.state.splitterContainerSize=e}getPane(e){if(!this.state.panes||e<0||e>=this.state.panes.length)throw new Error("no pane can return.");return this.state.panes[e]}dragState(e){const i=this.getPane(e),s=this.getPane(e+1),n=i.getPaneSize()+s.getPaneSize();return{prev:{index:e,initialSize:i.getPaneSize(),minSize:this.toPixels(i.component.props.minSize)||n-this.toPixels(s.component.props.maxSize)||0,maxSize:this.toPixels(i.component.props.maxSize)||n-this.toPixels(s.component.props.minSize)||n},next:{index:e+1,initialSize:s.getPaneSize(),minSize:this.toPixels(s.component.props.minSize)||n-this.toPixels(i.component.props.maxSize)||0,maxSize:this.toPixels(s.component.props.maxSize)||n-this.toPixels(i.component.props.minSize)||n}}}clamp(e,i,s){return Math.min(i,Math.max(e,s))}resize(e,i){const s=this.getPane(e.index),n=this.state.splitterContainerSize,p=this.clamp(e.minSize,e.maxSize,e.initialSize+i);let d="";this.isPercent(s.component.props.size)?d=p/n*100+"%":d=p+"px",s.component.props.size=d,s.component.emit("sizeChange",d)}isResizable(e){var p,d,u,f,z,x,l,r;const i=this.getPane(e),s=this.getPane(e+1),n=((d=(p=i==null?void 0:i.component)==null?void 0:p.props)==null?void 0:d.collapsed)||((f=(u=s==null?void 0:s.component)==null?void 0:u.props)==null?void 0:f.collapsed);return((x=(z=i==null?void 0:i.component)==null?void 0:z.props)==null?void 0:x.resizable)&&((r=(l=s==null?void 0:s.component)==null?void 0:l.props)==null?void 0:r.resizable)&&!n}isStaticBar(e){var n,p,d,u;const i=this.getPane(e),s=this.getPane(e+1);return!(((p=(n=i==null?void 0:i.component)==null?void 0:n.props)==null?void 0:p.resizable)&&((u=(d=s==null?void 0:s.component)==null?void 0:d.props)==null?void 0:u.resizable))}isPercent(e){return/%$/.test(e)}toPixels(e){let i=parseFloat(e);return this.isPercent(e)&&(i=this.state.splitterContainerSize*i/100),i}tooglePane(e,i,s){var d,u,f,z,x,l,r,m,X,a,c,S,h;const n=this.getPane(e),p=this.getPane(i);((u=(d=n==null?void 0:n.component)==null?void 0:d.props)==null?void 0:u.collapsible)&&(n.component.props.collapsed=s?(z=(f=n==null?void 0:n.component)==null?void 0:f.props)==null?void 0:z.collapsed:!((l=(x=n==null?void 0:n.component)==null?void 0:x.props)==null?void 0:l.collapsed),(a=(r=p==null?void 0:p.component)==null?void 0:r.exposed)==null||a.toggleNearPaneFlexGrow((X=(m=n==null?void 0:n.component)==null?void 0:m.props)==null?void 0:X.collapsed),(h=n==null?void 0:n.component)==null||h.emit("collapsedChange",(S=(c=n==null?void 0:n.component)==null?void 0:c.props)==null?void 0:S.collapsed))}setSize(e,i){const s=this.getPane(e.prev.index),n=this.getPane(e.next.index);s.component.props.size&&n.component.props.size?(this.resize(e.prev,i),this.resize(e.next,-i)):n.component.props.size?this.resize(e.next,-i):this.resize(e.prev,i)}}var A="",v=o.defineComponent({name:"DSplitter",components:{DSplitterBar:q},props:C,emits:[],setup(t,e){var p,d;const i=new G,s=o.reactive({panes:[]});s.panes=((d=(p=e.slots).DSplitterPane)==null?void 0:d.call(p))||[],i.setPanes({panes:s.panes}),o.provide("orientation",t.orientation),o.provide("splitterStore",i);const n=o.ref();return o.watch(n,u=>{if(!u)return;let f=0;t.orientation==="vertical"?f=u.clientHeight:f=u.clientWidth,i.setSplitter({containerSize:f})}),()=>{const{splitBarSize:u,orientation:f,showCollapseButton:z}=t,x=["devui-splitter",`devui-splitter-${f}`];return o.createVNode("div",{class:x,ref:n},[s.panes,s.panes.filter((l,r,m)=>r!==m.length-1).map((l,r)=>o.createVNode(o.resolveComponent("d-splitter-bar"),{key:r,style:`order: ${r*2+1}`,splitBarSize:u,orientation:f,index:r,showCollapseButton:z},null))])}}});const W={size:{type:String},minSize:{type:String},maxSize:{type:String},resizable:{type:Boolean,default:!0},collapsible:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapseDirection:{type:String,default:"both"},shrink:{type:Boolean,default:!1},shrinkWidth:{type:Number,default:36}};var J="",D=o.defineComponent({name:"DSplitterPane",props:W,emits:["sizeChange","collapsedChange"],setup(t,{slots:e,expose:i}){const s=o.inject("splitterStore"),n=o.ref(),p=o.ref();o.watch([p,n],([l,r])=>{!r||y(r,{order:l})});const d=(l,r)=>{if(!r)return;r.style.flexBasis=l;const m="devui-splitter-pane-fixed";l?B(r,m):b(r,m)};o.watch([()=>t.size,n],([l,r])=>{d(l,r)},{immediate:!0});const u=o.inject("orientation");let f="";o.onMounted(()=>{f=t.size,s.setPanes({panes:s.state.panes})}),o.onUpdated(()=>{s.setPanes({panes:s.state.panes})});const z=()=>{const l=n.value;if(!!l)return u==="vertical"?l.offsetHeight:l.offsetWidth};return o.watch(()=>t.collapsed,l=>{const r=n.value;if(!r)return;const m="devui-splitter-pane-hidden";l?B(r,m):b(r,m),l&&t.shrink?(b(r,m),y(r,{flexBasis:`${t.shrinkWidth}px`})):y(r,{flexBasis:f})},{immediate:!0}),i({order:p,getPaneSize:z,toggleNearPaneFlexGrow:l=>{const r=n.value;if(!(r instanceof HTMLElement))return;const m="devui-splitter-pane-grow";N(r,m)?b(r,m):l&&B(r,m)}}),()=>{var l;return o.createVNode("div",{class:"devui-splitter-pane",ref:n},[(l=e.default)==null?void 0:l.call(e)])}}});v.install=function(t){t.component(v.name,v),t.component(D.name,D)};var O={title:"Splitter \u5206\u5272\u5668",category:"\u5E03\u5C40",status:"100%",install(t){t.use(v)}};g.Splitter=v,g.default=O,Object.defineProperty(g,"__esModule",{value:!0}),g[Symbol.toStringTag]="Module"});
|
package/status/index.es.js
CHANGED
package/status/index.umd.js
CHANGED
|
@@ -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="",
|
|
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"});
|
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"});
|