vue-devui 1.0.0-alpha.4 → 1.0.0-beta.10
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 +237 -1
- 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 +175 -1
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/anchor/index.es.js +263 -1
- package/anchor/index.umd.js +1 -1
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +301 -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 +95 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/breadcrumb/index.es.js +127 -1
- package/breadcrumb/index.umd.js +1 -1
- package/breadcrumb/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +190 -1
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +61 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +329 -1
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1343 -1
- 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 +377 -1
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -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 +176 -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 +1172 -1
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +288 -0
- package/drawer/index.umd.js +1 -0
- package/drawer/package.json +7 -0
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +527 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5793 -1
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +163 -1
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +75 -1
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +480 -1
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +190 -1
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -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 +240 -1
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +100 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +256 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +1027 -1
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nav-sprite/index.es.js +742 -0
- package/nav-sprite/index.umd.js +1 -0
- package/nav-sprite/package.json +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/MultiUpload.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +368 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -33
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +642 -1
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +205 -1
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +236 -1
- package/popover/index.umd.js +1 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +153 -1
- package/progress/index.umd.js +3 -1
- package/quadrant-diagram/index.d.ts +7 -0
- package/quadrant-diagram/index.es.js +489 -1
- package/quadrant-diagram/index.umd.js +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +225 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +220 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -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 +181 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +543 -1
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +706 -1
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +297 -1
- 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 +199 -1
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +636 -1
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +42 -1
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +239 -1
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/sticky/index.es.js +197 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +100 -1
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1626 -1
- 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 +195 -1
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +329 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +299 -0
- package/time-axis/index.umd.js +1 -0
- package/time-axis/package.json +7 -0
- package/time-axis/style.css +1 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +1053 -1
- 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 +2060 -1
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +171 -1
- package/tooltip/index.umd.js +1 -1
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +1725 -1
- 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 +907 -1
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +3179 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27755 -1
- package/vue-devui.umd.js +29 -1
package/transfer/index.es.js
CHANGED
|
@@ -1 +1,1725 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,i=(t,a,l)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l,r=(e,t)=>{for(var a in t||(t={}))o.call(t,a)&&i(e,a,t[a]);if(l)for(var a of l(t))n.call(t,a)&&i(e,a,t[a]);return e},u=(e,l)=>t(e,a(l));"undefined"!=typeof require&&require;import{computed as d,defineComponent as s,inject as c,createVNode as p,mergeProps as h,toRef as v,provide as f,ref as y,watch as m,withDirectives as g,resolveDirective as b,resolveComponent as k,isVNode as C,createTextVNode as w,reactive as S}from"vue";const x={sourceOption:{type:Array,default:()=>[]},targetOption:{type:Array,default:()=>[]},type:{type:String,default:()=>"source"},title:{type:String,default:()=>"Source"},search:{type:Boolean,default:()=>!1},allChecked:{type:Boolean,default:()=>!1},query:{type:String,default:()=>""},alltargetState:{type:Boolean,default:()=>!1},checkedNum:{type:Number,default:()=>0},checkedValues:{type:Array,default:()=>[]},allCount:{type:Number,default:()=>0},scopedSlots:{type:Object},onChangeAllSource:{type:Function},onChangeQuery:{type:Function},onUpdateCheckeds:{type:Function}},V=(e,t)=>{const a=((e,t)=>{const a=[],l=("source"===t?e.sourceOption:e.targetOption).map((t=>(e.modelValue.some((e=>e===t.value))&&a.push(t.value),t)));return{model:a,data:l}})(e,t);return{data:a.data,allChecked:!1,disabled:!1,checkedNum:a.model.length,query:"",checkedValues:a.model,filterData:a.data}};const B={name:{type:String,default:void 0},isShowTitle:{type:Boolean,default:!0},color:{type:String,default:void 0},showAnimation:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},beforeChange:{type:Function,default:void 0}},D=u(r({},B),{halfchecked:{type:Boolean,default:!1},checked:{type:Boolean,default:!1},value:{type:String},label:{type:String,default:void 0},title:{type:String,default:void 0},"onUpdate:checked":{type:Function,default:void 0},onChange:{type:Function,default:void 0},modelValue:{type:Boolean},"onUpdate:modelValue":{type:Function}}),O=u(r({},B),{modelValue:{type:Array,required:!0},direction:{type:String,default:"column"},itemWidth:{type:Number,default:void 0},options:{type:Array,default:()=>[]},onChange:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0}}),$=Symbol("d-checkbox-group");var T=s({name:"DCheckbox",props:D,emits:["change","update:checked","update:modelValue"],setup(e,t){const a=c($,null),l=d((()=>e.checked||e.modelValue)),o=d((()=>(null==a?void 0:a.disabled.value)||e.disabled)),n=d((()=>{var t,o;return null!=(o=null==(t=null==a?void 0:a.isItemChecked)?void 0:t.call(a,e.value))?o:l.value})),i=d((()=>{var t;return null!=(t=null==a?void 0:a.isShowTitle)?t:e.isShowTitle})),r=d((()=>{var t;return null!=(t=null==a?void 0:a.showAnimation)?t:e.showAnimation})),u=d((()=>{var t;return null!=(t=null==a?void 0:a.color)?t:e.color})),s=null==a?void 0:a.itemWidth.value,p=null==a?void 0:a.direction.value;return{itemWidth:s,direction:p,mergedColor:u,mergedDisabled:o,mergedIsShowTitle:i,mergedChecked:n,mergedShowAnimation:r,handleClick:()=>{((t,l)=>{var n;if(o.value)return Promise.resolve(!1);const i=null!=(n=e.beforeChange)?n:null==a?void 0:a.beforeChange;if(i){const e=i(t,l);return"boolean"==typeof e?Promise.resolve(e):e}return Promise.resolve(!0)})(!l.value,e.value).then((o=>o&&(()=>{const o=!l.value;null==a||a.toggleGroupVal(e.value),t.emit("update:checked",o),t.emit("update:modelValue",o),t.emit("change",o)})()))}}},render(){var e;const{itemWidth:t,direction:a,mergedChecked:l,mergedDisabled:o,mergedIsShowTitle:n,mergedShowAnimation:i,halfchecked:r,title:u,label:d,handleClick:s,name:c,value:v,mergedColor:f,$slots:y}=this,m={"devui-checkbox-column-margin":"column"===a,"devui-checkbox-wrap":void 0!==t},g=t?[`width: ${t}px`]:[],b={"devui-checkbox":!0,active:l,halfchecked:r,disabled:o,unchecked:!l},k=n?u||d:"",C=[`border-color:${(l||r)&&f?f:""}`,`background-image:${f&&r||f?`linear-gradient(${f}, ${f})`:""}`,`background-color:${f&&r?f:""}`],w={"devui-checkbox-material":!0,"custom-color":f,"devui-checkbox-no-label":!d&&!y.default,"devui-no-animation":!i,"devui-checkbox-default-background":!r},S={"devui-tick":!0,"devui-no-animation":!i},x=e=>e.stopPropagation();return p("div",{class:m,style:g},[p("div",{class:b},[p("label",{title:k,onClick:s},[p("input",h({name:c||v,class:"devui-checkbox-input",type:"checkbox"},{indeterminate:r},{checked:l,disabled:o,onClick:x,onChange:x}),null),p("span",{style:C,class:w},[p("span",{class:"devui-checkbox-halfchecked-bg"},null),p("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",class:"devui-checkbox-tick"},[p("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[p("polygon",{"fill-rule":"nonzero",points:"5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",class:S},null)])])]),d||(null==(e=y.default)?void 0:e.call(y))])])])}}),F=s({name:"DCheckboxGroup",props:O,emits:["change","update:modelValue"],setup(e,t){const a=v(e,"modelValue");return f($,{disabled:v(e,"disabled"),isShowTitle:v(e,"isShowTitle"),color:v(e,"color"),showAnimation:v(e,"showAnimation"),beforeChange:e.beforeChange,isItemChecked:e=>a.value.includes(e),toggleGroupVal:e=>{const l=a.value.findIndex((t=>t===e));if(-1===l){const l=[...a.value,e];return t.emit("update:modelValue",l),void t.emit("change",l)}a.value.splice(l,1),t.emit("update:modelValue",a.value),t.emit("change",a.value)},itemWidth:v(e,"itemWidth"),direction:v(e,"direction")}),{defaultOpt:{checked:!1,isShowTitle:!0,halfchecked:!1,showAnimation:!0,disabled:!1}}},render(){var e;const{direction:t,$slots:a,defaultOpt:l,options:o}=this;let n=null==(e=a.default)?void 0:e.call(a);return(null==o?void 0:o.length)>0&&(n=o.map((e=>{const t=Object.assign({},l,e);return p(T,t,null)}))),p("div",{class:"devui-checkbox-group"},[p("div",{class:{"devui-checkbox-list-inline":"row"===t}},[n])])}});const j={size:{type:String,default:""},placeholder:{type:String,default:"请输入关键字"},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},delay:{type:Number,default:300},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},isKeyupSearch:{type:Boolean,default:!1},iconPosition:{type:String,default:"right"},noBorder:{type:Boolean,default:!1},cssClass:{type:String,default:""},modelValue:{type:String,default:""},searchFn:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0}},A={lg:"lg",sm:"sm"},N={right:"right",left:"left"};var I="object"==typeof global&&global&&global.Object===Object&&global,P="object"==typeof self&&self&&self.Object===Object&&self,_=I||P||Function("return this")(),z=_.Symbol,q=Object.prototype,U=q.hasOwnProperty,E=q.toString,K=z?z.toStringTag:void 0;var L=Object.prototype.toString;var Q=z?z.toStringTag:void 0;function W(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Q&&Q in Object(e)?function(e){var t=U.call(e,K),a=e[K];try{e[K]=void 0;var l=!0}catch(n){}var o=E.call(e);return l&&(t?e[K]=a:delete e[K]),o}(e):function(e){return L.call(e)}(e)}var G=/\s/;var H=/^\s+/;function M(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&G.test(e.charAt(t)););return t}(e)+1).replace(H,""):e}function R(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var X=/^[-+]0x[0-9a-f]+$/i,J=/^0b[01]+$/i,Y=/^0o[0-7]+$/i,Z=parseInt;function ee(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==W(e)}(e))return NaN;if(R(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=R(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=M(e);var a=J.test(e);return a||Y.test(e)?Z(e.slice(2),a?2:8):X.test(e)?NaN:+e}var te=function(){return _.Date.now()},ae=Math.max,le=Math.min;function oe(e,t,a){var l,o,n,i,r,u,d=0,s=!1,c=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var a=l,n=o;return l=o=void 0,d=t,i=e.apply(n,a)}function v(e){return d=e,r=setTimeout(y,t),s?h(e):i}function f(e){var a=e-u;return void 0===u||a>=t||a<0||c&&e-d>=n}function y(){var e=te();if(f(e))return m(e);r=setTimeout(y,function(e){var a=t-(e-u);return c?le(a,n-(e-d)):a}(e))}function m(e){return r=void 0,p&&l?h(e):(l=o=void 0,i)}function g(){var e=te(),a=f(e);if(l=arguments,o=this,u=e,a){if(void 0===r)return v(u);if(c)return clearTimeout(r),r=setTimeout(y,t),h(u)}return void 0===r&&(r=setTimeout(y,t)),i}return t=ee(t)||0,R(a)&&(s=!!a.leading,n=(c="maxWait"in a)?ae(ee(a.maxWait)||0,t):n,p="trailing"in a?!!a.trailing:p),g.cancel=function(){void 0!==r&&clearTimeout(r),d=0,l=u=o=r=void 0},g.flush=function(){return void 0===r?i:m(te())},g}const ne="Enter";var ie=s({name:"DInput",directives:{focus:{mounted:function(e,t){t.value&&e.focus()}}},props:{placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},cssClass:{type:String,default:""},error:{type:Boolean,default:!1},size:{type:String,default:""},showPassword:{type:Boolean,default:!1},value:{type:String,default:""},"onUpdate:value":{type:Function,default:void 0},onChange:{type:Function,default:void 0},onKeydown:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onBlur:{type:Function,default:void 0}},emits:["update:value","focus","blur","change","keydown"],setup(e,t){const a=d((()=>`devui-input-${e.size}`)),l=y(!1),o=y("text"),n=d((()=>({error:e.error,[e.cssClass]:!0,[a.value]:""!==e.size}))),i=d((()=>"password"===o.value));m((()=>e.showPassword),(e=>{o.value=e?"password":"text"}),{immediate:!0}),m((()=>e.value),(e=>{e&&e.length>0&&i.value?l.value=!0:l.value=!1}));return{inputCls:n,inputType:o,showPreviewIcon:i,showPwdIcon:l,onInput:e=>{t.emit("update:value",e.target.value)},onFocus:()=>{t.emit("focus")},onBlur:()=>{t.emit("blur")},onChange:e=>{t.emit("change",e.target.value)},onKeydown:e=>{t.emit("keydown",e)},onChangeInputType:()=>{o.value="password"===o.value?"text":"password"}}},render(){const{value:e,showPreviewIcon:t,showPwdIcon:a,inputCls:l,inputType:o,maxLength:n,autoFocus:i,placeholder:r,disabled:u,onInput:d,onFocus:s,onBlur:c,onChange:v,onKeydown:f,onChangeInputType:y}=this;return p("div",{class:"devui-input__wrap"},[g(p("input",h({dinput:!0},{value:e,disabled:u,type:o,maxlength:n,placeholder:r,class:l,onInput:d,onFocus:s,onBlur:c,onChange:v,onKeydown:f}),null),[[b("focus"),i]]),a&&p("div",{class:"devui-input__preview",onClick:y},[p(k("d-icon"),t?{name:"preview",size:"12px",key:1}:{name:"preview-forbidden",size:"12px",key:2},null)])])}}),re=s({name:"DSearch",props:j,emits:["update:modelValue","searchFn"],setup(e,t){const a=(e=>d((()=>({"devui-search":!0,"devui-search__disbaled":e.disabled,"devui-search__no-border":e.noBorder,[`devui-search__${e.size}`]:A[e.size],[`devui-search__${e.iconPosition}`]:N[e.iconPosition]}))))(e),{keywords:l,clearIconShow:o,onClearHandle:n}=((e,t)=>{const a=y("");m((()=>t.modelValue),(e=>{a.value=e}),{immediate:!0});const l=d((()=>a.value.length>0));return{keywords:a,clearIconShow:l,onClearHandle:()=>{a.value="",e.emit("update:modelValue","")}}})(t,e),{onInputKeydown:i,onClickHandle:r,useEmitKeyword:u}=((e,t,a)=>{const l=e=>{if(e.target instanceof HTMLInputElement){const t=e.target.value;o(t)}},o=oe((t=>{e.emit("searchFn",t)}),a);return{onInputKeydown:e=>{switch(e.key){case ne:l(e)}},useEmitKeyword:o,onClickHandle:()=>{o(t.value)}}})(t,l,e.delay),s=a=>{e.isKeyupSearch&&u(a),l.value=a,t.emit("update:modelValue",a)};return()=>p("div",{class:a.value},["left"===e.iconPosition&&p("div",{class:"devui-search__icon",onClick:r},[p(k("d-icon"),{name:"search",size:"inherit"},null)]),p(ie,{size:e.size,disabled:e.disabled,autoFocus:e.autoFocus,value:l.value,maxLength:e.maxLength,placeholder:e.placeholder,cssClass:e.cssClass,onKeydown:i,"onUpdate:value":s},null),o.value&&p("div",{class:"devui-search__clear",onClick:n},[p(k("d-icon"),{name:"close",size:"inherit"},null)]),"right"===e.iconPosition&&p("div",{class:"devui-search__icon",onClick:r},[p(k("d-icon"),{name:"search",size:"inherit"},null)])])}});function ue(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!C(e)}var de=s({name:"DTransferBase",components:{DSearch:re,DCheckboxGroup:F,DCheckbox:T},props:x,setup(e,t){const a=d((()=>e.checkedValues)),l=d((()=>e.query));return{baseClass:(e=>d((()=>`devui-transfer-panel devui-transfer-${e.type}`)))(e),searchQuery:l,modelValues:a,updateSearchQuery:e=>t.emit("changeQuery",e)}},render(){let e;const{title:t,baseClass:a,checkedNum:l,allChecked:o,sourceOption:n,allCount:i,updateSearchQuery:r,search:u,searchQuery:d,modelValues:s}=this;return p("div",{class:a},[this.$slots.header?this.$slots.header():p("div",{class:"devui-transfer-panel-header"},[p("div",{class:"devui-transfer-panel-header-allChecked"},[p(T,{modelValue:o,onChange:e=>this.$emit("changeAllSource",e)},ue(t)?t:{default:()=>[t]})]),p("div",{class:"devui-transfer-panel-header-num"},[l,w("/"),i])]),this.$slots.body?this.$slots.body():p("div",{class:"devui-transfer-panel-body"},[u&&p("div",{class:"devui-transfer-panel-body-search"},[p(re,{modelValue:d,"onUpdate:modelValue":r},null)]),p("div",{class:"devui-transfer-panel-body-list",style:{height:`calc(100% - 40px - ${u?42:0}px)`}},[n.length?p(F,{modelValue:s,onChange:e=>this.$emit("updateCheckeds",e)},ue(e=n.map(((e,t)=>p(T,{class:"devui-transfer-panel-body-list-item",label:e.key,value:e.value,disabled:e.disabled,key:t},null))))?e:{default:()=>[e]}):p("div",{class:"devui-transfer-panel-body-list-empty"},[w("无数据")])])])])}}),se=s({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup:e=>r({},e),render(){const{name:e,size:t,color:a,classPrefix:l}=this;return p("i",{class:`${l} ${l}-${e}`,style:{fontSize:t,color:a}},null)}});se.install=function(e){e.component(se.name,se)};var ce=s({name:"DButton",props:{type:{type:String,default:"button"},btnStyle:{type:String,default:"primary"},size:{type:String,default:"md"},position:{type:String,default:"default"},bordered:{type:Boolean,default:!1},icon:{type:String,default:""},showLoading:{type:Boolean,default:!1},width:{type:String},disabled:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},onClick:{type:Function}},setup(e,t){const a=y(null),l=t=>{var a;e.showLoading||null==(a=e.onClick)||a.call(e,t)},o=d((()=>t.slots.default)),n=d((()=>{const{btnStyle:t,size:a,position:l,bordered:n,icon:i}=e;return`${`devui-btn devui-btn-${t} devui-btn-${a} devui-btn-${l}`} ${n?"bordered":""} ${i&&!o.value&&"primary"!==t?"d-btn-icon":""} ${i?"d-btn-icon-wrap":""}`})),i=d((()=>{if(!e.icon)return;const t="devui-icon-fix icon";return o.value?`${t} clear-right-5`:t}));return()=>{var o,r;const{icon:u,type:d,disabled:s,showLoading:c,width:v}=e;return p("div",h({class:"devui-btn-host"},t.attrs),[p("button",{class:n.value,type:d,disabled:s,style:{width:v},onClick:l},[u?p(se,{name:e.icon,class:i.value},null):null,p("span",{class:"button-content",ref:a},[null==(r=(o=t.slots).default)?void 0:r.call(o)])])])}}});const pe={sourceDisabled:{type:Boolean,default:()=>!0},targetDisabled:{type:Boolean,default:()=>!0},disabled:{type:Boolean,default:()=>!1},onUpdateSourceData:{type:Function},onUpdateTargetData:{type:Function}};var he=s({name:"DTransferOperation",components:{DButton:ce},props:pe,setup:(e,t)=>()=>t.slots.operation&&t.slots.operation()||p("div",{class:"devui-transfer-panel-operation"},[p("div",{class:"devui-transfer-panel-operation-group"},[p(ce,{class:"devui-transfer-panel-operation-group-left icon-collapse",disabled:e.disabled?e.disabled:e.sourceDisabled,btnClick:()=>t.emit("updateSourceData")},null),p(ce,{class:"devui-transfer-panel-operation-group-right icon-chevron-right",disabled:e.disabled?e.disabled:e.targetDisabled,btnClick:()=>t.emit("updateTargetData")},null)])])});const ve={sourceOption:{type:Array,require:!0,default:()=>[]},targetOption:{type:Array,require:!0,default:()=>[]},titles:{type:Array,default:()=>()=>["Source","Target"]},modelValue:{type:Array,default:()=>()=>[]},height:{type:String,default:"320px"},isSearch:{type:Boolean,default:!1},isSourceDroppable:{type:Boolean,default:!1},isTargetDroppable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},showOptionTitle:{type:Boolean,default:!1},slots:{type:Object}},fe=(e,t)=>e.slots[`${t}-header`]?()=>e.slots[`${t}-header`]&&e.slots[`${t}-header`]():null,ye=(e,t)=>e.slots[`${t}-body`]?()=>e.slots[`${t}-body`]&&e.slots[`${t}-body`]():null,me=e=>e.slots&&e.slots.operation&&e.slots.operation()||null;var ge=s({name:"DTransfer",components:{DTransferBase:de,DTransferOperation:he,DCheckbox:T},props:ve,setup(e,t){const a=S(V(e,"source")),l=S(V(e,"target")),o=y(null);m((()=>a.query),(e=>{s(a)})),m((()=>a.checkedValues),(e=>{a.checkedNum=e.length,n(a,e)}),{deep:!0}),m((()=>l.query),(e=>{s(l)})),m((()=>l.checkedValues),(e=>{l.checkedNum=e.length,n(l,e)}),{deep:!0});const n=(e,t)=>{"click"===o.value?e.allChecked=!1:e.allChecked=t.length===e.data.filter((e=>!e.disabled)).length},i=(e,t)=>{const a=[];e.data=e.data.filter((t=>{const l=e.checkedValues.includes(t.value);return l&&a.push(t),!l})),t.data=t.data.concat(a),e.checkedValues=[],t.disabled=!t.disabled,s(e,t),s(t,e),c("click")},r=(e,t)=>{e.filterData.every((e=>e.disabled))||(e.allChecked=t,e.checkedValues=t?e.filterData.filter((e=>!e.disabled)).map((e=>e.value)):[],c("change"))},u=e=>{a.checkedValues=e,c("change")},d=e=>{l.checkedValues=e,c("change")},s=(e,t)=>{e.filterData=e.data.filter((t=>-1!==t.key.indexOf(e.query))),t&&(t.allChecked=!1)},c=e=>{o.value=e};return()=>p("div",{class:"devui-transfer"},[p(de,{style:{height:e.height},sourceOption:a.filterData,title:e.titles[0],type:"source",search:e.isSearch,allChecked:a.allChecked,checkedNum:a.checkedNum,query:a.query,checkedValues:a.checkedValues,allCount:a.data.length,onChangeAllSource:e=>r(a,e),onUpdateCheckeds:u,onChangeQuery:e=>a.query=e},{header:fe(t,"left"),body:ye(t,"left")}),p(he,{disabled:e.disabled,sourceDisabled:!(l.checkedNum>0),targetDisabled:!(a.checkedNum>0),onUpdateSourceData:()=>{i(l,a)},onUpdateTargetData:()=>{i(a,l)}},{operation:me(t)}),p(de,{style:{height:e.height},sourceOption:l.filterData,title:e.titles[1],type:"target",search:e.isSearch,allChecked:l.allChecked,checkedNum:l.checkedNum,query:l.query,checkedValues:l.checkedValues,allCount:l.data.length,onChangeAllSource:e=>r(l,e),onUpdateCheckeds:d,onChangeQuery:e=>l.query=e},{header:fe(t,"right"),body:ye(t,"right")})])}});ge.install=function(e){e.component(ge.name,ge)};var be={title:"Transfer 穿梭框",category:"数据录入",install(e){e.use(ge)}};export{ge as Transfer,be as default};
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { computed, defineComponent, inject, createVNode, mergeProps, toRef, provide, ref, watch, withDirectives, resolveDirective, resolveComponent, reactive, onMounted, onBeforeUnmount, renderSlot, useSlots, isVNode, createTextVNode } from "vue";
|
|
21
|
+
const transferBaseProps = {
|
|
22
|
+
sourceOption: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default() {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
targetOption: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default() {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: () => "source"
|
|
37
|
+
},
|
|
38
|
+
title: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: () => "Source"
|
|
41
|
+
},
|
|
42
|
+
search: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: () => false
|
|
45
|
+
},
|
|
46
|
+
allChecked: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: () => false
|
|
49
|
+
},
|
|
50
|
+
filter: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: () => ""
|
|
53
|
+
},
|
|
54
|
+
height: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: () => "320px"
|
|
57
|
+
},
|
|
58
|
+
alltargetState: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: () => false
|
|
61
|
+
},
|
|
62
|
+
checkedNum: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: () => 0
|
|
65
|
+
},
|
|
66
|
+
checkedValues: {
|
|
67
|
+
type: Array,
|
|
68
|
+
default: () => []
|
|
69
|
+
},
|
|
70
|
+
allCount: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: () => 0
|
|
73
|
+
},
|
|
74
|
+
showTooltip: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: () => false
|
|
77
|
+
},
|
|
78
|
+
tooltipPosition: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: () => "top"
|
|
81
|
+
},
|
|
82
|
+
scopedSlots: {
|
|
83
|
+
type: Object
|
|
84
|
+
},
|
|
85
|
+
onChangeAllSource: {
|
|
86
|
+
type: Function
|
|
87
|
+
},
|
|
88
|
+
onChangeQuery: {
|
|
89
|
+
type: Function
|
|
90
|
+
},
|
|
91
|
+
onUpdateCheckeds: {
|
|
92
|
+
type: Function
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const getFilterData = (props, type) => {
|
|
96
|
+
const newModel = [];
|
|
97
|
+
const data = type === "source" ? props.sourceOption : props.targetOption;
|
|
98
|
+
const resultData = data.map((item) => {
|
|
99
|
+
const checked = props.modelValue.some((cur) => cur === item.value);
|
|
100
|
+
checked && newModel.push(item.value);
|
|
101
|
+
return item;
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
model: newModel,
|
|
105
|
+
data: resultData
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
const initState = (props, type) => {
|
|
109
|
+
const initModel = getFilterData(props, type);
|
|
110
|
+
const state = {
|
|
111
|
+
data: initModel.data,
|
|
112
|
+
allChecked: false,
|
|
113
|
+
disabled: false,
|
|
114
|
+
checkedNum: initModel.model.length,
|
|
115
|
+
keyword: "",
|
|
116
|
+
checkedValues: initModel.model,
|
|
117
|
+
filterData: initModel.data
|
|
118
|
+
};
|
|
119
|
+
return state;
|
|
120
|
+
};
|
|
121
|
+
const TransferBaseClass = (props) => {
|
|
122
|
+
return computed(() => {
|
|
123
|
+
return `devui-transfer-panel devui-transfer-${props.type}`;
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
var checkbox = "";
|
|
127
|
+
const commonProps = {
|
|
128
|
+
name: {
|
|
129
|
+
type: String,
|
|
130
|
+
default: void 0
|
|
131
|
+
},
|
|
132
|
+
halfchecked: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: false
|
|
135
|
+
},
|
|
136
|
+
isShowTitle: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: true
|
|
139
|
+
},
|
|
140
|
+
title: {
|
|
141
|
+
type: String
|
|
142
|
+
},
|
|
143
|
+
color: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: void 0
|
|
146
|
+
},
|
|
147
|
+
showAnimation: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: true
|
|
150
|
+
},
|
|
151
|
+
disabled: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: false
|
|
154
|
+
},
|
|
155
|
+
beforeChange: {
|
|
156
|
+
type: Function,
|
|
157
|
+
default: void 0
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
161
|
+
halfchecked: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false
|
|
164
|
+
},
|
|
165
|
+
checked: {
|
|
166
|
+
type: Boolean,
|
|
167
|
+
default: false
|
|
168
|
+
},
|
|
169
|
+
value: {
|
|
170
|
+
type: String
|
|
171
|
+
},
|
|
172
|
+
label: {
|
|
173
|
+
type: String,
|
|
174
|
+
default: void 0
|
|
175
|
+
},
|
|
176
|
+
title: {
|
|
177
|
+
type: String,
|
|
178
|
+
default: void 0
|
|
179
|
+
},
|
|
180
|
+
"onUpdate:checked": {
|
|
181
|
+
type: Function,
|
|
182
|
+
default: void 0
|
|
183
|
+
},
|
|
184
|
+
onChange: {
|
|
185
|
+
type: Function,
|
|
186
|
+
default: void 0
|
|
187
|
+
},
|
|
188
|
+
modelValue: {
|
|
189
|
+
type: Boolean
|
|
190
|
+
},
|
|
191
|
+
"onUpdate:modelValue": {
|
|
192
|
+
type: Function
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
196
|
+
modelValue: {
|
|
197
|
+
type: Array,
|
|
198
|
+
required: true
|
|
199
|
+
},
|
|
200
|
+
direction: {
|
|
201
|
+
type: String,
|
|
202
|
+
default: "column"
|
|
203
|
+
},
|
|
204
|
+
itemWidth: {
|
|
205
|
+
type: Number,
|
|
206
|
+
default: void 0
|
|
207
|
+
},
|
|
208
|
+
options: {
|
|
209
|
+
type: Array,
|
|
210
|
+
default: () => []
|
|
211
|
+
},
|
|
212
|
+
onChange: {
|
|
213
|
+
type: Function,
|
|
214
|
+
default: void 0
|
|
215
|
+
},
|
|
216
|
+
"onUpdate:modelValue": {
|
|
217
|
+
type: Function,
|
|
218
|
+
default: void 0
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
|
|
222
|
+
var DCheckbox = defineComponent({
|
|
223
|
+
name: "DCheckbox",
|
|
224
|
+
props: checkboxProps,
|
|
225
|
+
emits: ["change", "update:checked", "update:modelValue"],
|
|
226
|
+
setup(props, ctx) {
|
|
227
|
+
const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
|
|
228
|
+
const isChecked = computed(() => props.checked || props.modelValue);
|
|
229
|
+
const mergedDisabled = computed(() => {
|
|
230
|
+
return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
|
|
231
|
+
});
|
|
232
|
+
const mergedChecked = computed(() => {
|
|
233
|
+
var _a, _b;
|
|
234
|
+
return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
|
|
235
|
+
});
|
|
236
|
+
const mergedIsShowTitle = computed(() => {
|
|
237
|
+
var _a;
|
|
238
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
|
|
239
|
+
});
|
|
240
|
+
const mergedShowAnimation = computed(() => {
|
|
241
|
+
var _a;
|
|
242
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
|
|
243
|
+
});
|
|
244
|
+
const mergedColor = computed(() => {
|
|
245
|
+
var _a;
|
|
246
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
|
|
247
|
+
});
|
|
248
|
+
const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
|
|
249
|
+
const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
|
|
250
|
+
const canChange = (isChecked2, val) => {
|
|
251
|
+
var _a;
|
|
252
|
+
if (mergedDisabled.value) {
|
|
253
|
+
return Promise.resolve(false);
|
|
254
|
+
}
|
|
255
|
+
const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
|
|
256
|
+
if (beforeChange) {
|
|
257
|
+
const res = beforeChange(isChecked2, val);
|
|
258
|
+
if (typeof res === "boolean") {
|
|
259
|
+
return Promise.resolve(res);
|
|
260
|
+
}
|
|
261
|
+
return res;
|
|
262
|
+
}
|
|
263
|
+
return Promise.resolve(true);
|
|
264
|
+
};
|
|
265
|
+
const toggle = () => {
|
|
266
|
+
const current = !isChecked.value;
|
|
267
|
+
checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
|
|
268
|
+
ctx.emit("update:checked", current);
|
|
269
|
+
ctx.emit("update:modelValue", current);
|
|
270
|
+
ctx.emit("change", current);
|
|
271
|
+
};
|
|
272
|
+
const handleClick = () => {
|
|
273
|
+
canChange(!isChecked.value, props.label).then((res) => res && toggle());
|
|
274
|
+
};
|
|
275
|
+
return {
|
|
276
|
+
itemWidth,
|
|
277
|
+
direction,
|
|
278
|
+
mergedColor,
|
|
279
|
+
mergedDisabled,
|
|
280
|
+
mergedIsShowTitle,
|
|
281
|
+
mergedChecked,
|
|
282
|
+
mergedShowAnimation,
|
|
283
|
+
handleClick
|
|
284
|
+
};
|
|
285
|
+
},
|
|
286
|
+
render() {
|
|
287
|
+
var _a;
|
|
288
|
+
const {
|
|
289
|
+
itemWidth,
|
|
290
|
+
direction,
|
|
291
|
+
mergedChecked,
|
|
292
|
+
mergedDisabled,
|
|
293
|
+
mergedIsShowTitle,
|
|
294
|
+
mergedShowAnimation,
|
|
295
|
+
halfchecked,
|
|
296
|
+
title,
|
|
297
|
+
label,
|
|
298
|
+
handleClick,
|
|
299
|
+
name,
|
|
300
|
+
value,
|
|
301
|
+
mergedColor,
|
|
302
|
+
$slots
|
|
303
|
+
} = this;
|
|
304
|
+
const wrapperCls = {
|
|
305
|
+
"devui-checkbox-column-margin": direction === "column",
|
|
306
|
+
"devui-checkbox-wrap": typeof itemWidth !== "undefined"
|
|
307
|
+
};
|
|
308
|
+
const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
|
|
309
|
+
const checkboxCls = {
|
|
310
|
+
"devui-checkbox": true,
|
|
311
|
+
active: mergedChecked,
|
|
312
|
+
halfchecked,
|
|
313
|
+
disabled: mergedDisabled,
|
|
314
|
+
unchecked: !mergedChecked
|
|
315
|
+
};
|
|
316
|
+
const labelTitle = mergedIsShowTitle ? title || label : "";
|
|
317
|
+
const bgImgStyle = mergedColor && halfchecked || mergedColor ? `linear-gradient(${mergedColor}, ${mergedColor})` : "";
|
|
318
|
+
const spanStyle = [`border-color:${(mergedChecked || halfchecked) && mergedColor ? mergedColor : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor && halfchecked ? mergedColor : ""}`];
|
|
319
|
+
const spanCls = {
|
|
320
|
+
"devui-checkbox-material": true,
|
|
321
|
+
"custom-color": mergedColor,
|
|
322
|
+
"devui-checkbox-no-label": !label && !$slots.default,
|
|
323
|
+
"devui-no-animation": !mergedShowAnimation,
|
|
324
|
+
"devui-checkbox-default-background": !halfchecked
|
|
325
|
+
};
|
|
326
|
+
const polygonCls = {
|
|
327
|
+
"devui-tick": true,
|
|
328
|
+
"devui-no-animation": !mergedShowAnimation
|
|
329
|
+
};
|
|
330
|
+
const stopPropagation = ($event) => $event.stopPropagation();
|
|
331
|
+
const inputProps2 = {
|
|
332
|
+
indeterminate: halfchecked
|
|
333
|
+
};
|
|
334
|
+
return createVNode("div", {
|
|
335
|
+
"class": wrapperCls,
|
|
336
|
+
"style": wrapperStyle
|
|
337
|
+
}, [createVNode("div", {
|
|
338
|
+
"class": checkboxCls
|
|
339
|
+
}, [createVNode("label", {
|
|
340
|
+
"title": labelTitle,
|
|
341
|
+
"onClick": handleClick
|
|
342
|
+
}, [createVNode("input", mergeProps({
|
|
343
|
+
"name": name || value,
|
|
344
|
+
"class": "devui-checkbox-input",
|
|
345
|
+
"type": "checkbox"
|
|
346
|
+
}, inputProps2, {
|
|
347
|
+
"checked": mergedChecked,
|
|
348
|
+
"disabled": mergedDisabled,
|
|
349
|
+
"onClick": stopPropagation,
|
|
350
|
+
"onChange": stopPropagation
|
|
351
|
+
}), null), createVNode("span", {
|
|
352
|
+
"style": spanStyle,
|
|
353
|
+
"class": spanCls
|
|
354
|
+
}, [createVNode("span", {
|
|
355
|
+
"class": "devui-checkbox-halfchecked-bg"
|
|
356
|
+
}, null), createVNode("svg", {
|
|
357
|
+
"viewBox": "0 0 16 16",
|
|
358
|
+
"version": "1.1",
|
|
359
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
360
|
+
"class": "devui-checkbox-tick"
|
|
361
|
+
}, [createVNode("g", {
|
|
362
|
+
"stroke": "none",
|
|
363
|
+
"stroke-width": "1",
|
|
364
|
+
"fill": "none",
|
|
365
|
+
"fill-rule": "evenodd"
|
|
366
|
+
}, [createVNode("polygon", {
|
|
367
|
+
"fill-rule": "nonzero",
|
|
368
|
+
"points": "5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",
|
|
369
|
+
"class": polygonCls
|
|
370
|
+
}, null)])])]), label || ((_a = $slots.default) == null ? void 0 : _a.call($slots))])])]);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
var checkboxGroup = "";
|
|
374
|
+
var DCheckboxGroup = defineComponent({
|
|
375
|
+
name: "DCheckboxGroup",
|
|
376
|
+
props: checkboxGroupProps,
|
|
377
|
+
emits: ["change", "update:modelValue"],
|
|
378
|
+
setup(props, ctx) {
|
|
379
|
+
const valList = toRef(props, "modelValue");
|
|
380
|
+
const defaultOpt = {
|
|
381
|
+
checked: false,
|
|
382
|
+
isShowTitle: true,
|
|
383
|
+
halfchecked: false,
|
|
384
|
+
showAnimation: true,
|
|
385
|
+
disabled: false
|
|
386
|
+
};
|
|
387
|
+
const toggleGroupVal = (val) => {
|
|
388
|
+
let index2 = -1;
|
|
389
|
+
if (typeof valList.value[0] === "string") {
|
|
390
|
+
index2 = valList.value.findIndex((item) => item === val);
|
|
391
|
+
} else if (typeof valList.value[0] === "object") {
|
|
392
|
+
index2 = valList.value.findIndex((item) => item.value === val);
|
|
393
|
+
}
|
|
394
|
+
if (index2 === -1) {
|
|
395
|
+
if (typeof props.options[0] === "object") {
|
|
396
|
+
const newOne = props.options.find((item) => item.value === val);
|
|
397
|
+
const res2 = [...valList.value, newOne];
|
|
398
|
+
ctx.emit("update:modelValue", res2);
|
|
399
|
+
ctx.emit("change", res2);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const res = [...valList.value, val];
|
|
403
|
+
ctx.emit("update:modelValue", res);
|
|
404
|
+
ctx.emit("change", res);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
valList.value.splice(index2, 1);
|
|
408
|
+
ctx.emit("update:modelValue", valList.value);
|
|
409
|
+
ctx.emit("change", valList.value);
|
|
410
|
+
};
|
|
411
|
+
const isItemChecked = (itemVal) => {
|
|
412
|
+
if (typeof valList.value[0] === "string") {
|
|
413
|
+
return valList.value.includes(itemVal);
|
|
414
|
+
} else if (typeof valList.value[0] === "object") {
|
|
415
|
+
return valList.value.some((item) => item.value === itemVal);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
provide(checkboxGroupInjectionKey, {
|
|
419
|
+
disabled: toRef(props, "disabled"),
|
|
420
|
+
isShowTitle: toRef(props, "isShowTitle"),
|
|
421
|
+
color: toRef(props, "color"),
|
|
422
|
+
showAnimation: toRef(props, "showAnimation"),
|
|
423
|
+
beforeChange: props.beforeChange,
|
|
424
|
+
isItemChecked,
|
|
425
|
+
toggleGroupVal,
|
|
426
|
+
itemWidth: toRef(props, "itemWidth"),
|
|
427
|
+
direction: toRef(props, "direction")
|
|
428
|
+
});
|
|
429
|
+
return {
|
|
430
|
+
defaultOpt
|
|
431
|
+
};
|
|
432
|
+
},
|
|
433
|
+
render() {
|
|
434
|
+
var _a;
|
|
435
|
+
const {
|
|
436
|
+
direction,
|
|
437
|
+
$slots,
|
|
438
|
+
defaultOpt,
|
|
439
|
+
options
|
|
440
|
+
} = this;
|
|
441
|
+
let children = (_a = $slots.default) == null ? void 0 : _a.call($slots);
|
|
442
|
+
if ((options == null ? void 0 : options.length) > 0) {
|
|
443
|
+
children = options.map((opt) => {
|
|
444
|
+
let mergedOpt = null;
|
|
445
|
+
if (typeof opt === "string") {
|
|
446
|
+
mergedOpt = Object.assign({}, defaultOpt, {
|
|
447
|
+
label: opt,
|
|
448
|
+
value: opt
|
|
449
|
+
});
|
|
450
|
+
} else if (typeof opt === "object") {
|
|
451
|
+
mergedOpt = Object.assign({}, defaultOpt, __spreadProps(__spreadValues({}, opt), {
|
|
452
|
+
label: opt.name
|
|
453
|
+
}));
|
|
454
|
+
}
|
|
455
|
+
return createVNode(DCheckbox, mergedOpt, null);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
return createVNode("div", {
|
|
459
|
+
"class": "devui-checkbox-group"
|
|
460
|
+
}, [createVNode("div", {
|
|
461
|
+
"class": {
|
|
462
|
+
"devui-checkbox-list-inline": direction === "row"
|
|
463
|
+
}
|
|
464
|
+
}, [children])]);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
const searchProps = {
|
|
468
|
+
size: {
|
|
469
|
+
type: String,
|
|
470
|
+
default: ""
|
|
471
|
+
},
|
|
472
|
+
placeholder: {
|
|
473
|
+
type: String,
|
|
474
|
+
default: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
475
|
+
},
|
|
476
|
+
maxLength: {
|
|
477
|
+
type: Number,
|
|
478
|
+
default: Number.MAX_SAFE_INTEGER
|
|
479
|
+
},
|
|
480
|
+
delay: {
|
|
481
|
+
type: Number,
|
|
482
|
+
default: 300
|
|
483
|
+
},
|
|
484
|
+
disabled: {
|
|
485
|
+
type: Boolean,
|
|
486
|
+
default: false
|
|
487
|
+
},
|
|
488
|
+
autoFocus: {
|
|
489
|
+
type: Boolean,
|
|
490
|
+
default: false
|
|
491
|
+
},
|
|
492
|
+
isKeyupSearch: {
|
|
493
|
+
type: Boolean,
|
|
494
|
+
default: false
|
|
495
|
+
},
|
|
496
|
+
iconPosition: {
|
|
497
|
+
type: String,
|
|
498
|
+
default: "right"
|
|
499
|
+
},
|
|
500
|
+
noBorder: {
|
|
501
|
+
type: Boolean,
|
|
502
|
+
default: false
|
|
503
|
+
},
|
|
504
|
+
cssClass: {
|
|
505
|
+
type: String,
|
|
506
|
+
default: ""
|
|
507
|
+
},
|
|
508
|
+
modelValue: {
|
|
509
|
+
type: String,
|
|
510
|
+
default: ""
|
|
511
|
+
},
|
|
512
|
+
onSearch: {
|
|
513
|
+
type: Function,
|
|
514
|
+
default: void 0
|
|
515
|
+
},
|
|
516
|
+
"onUpdate:modelValue": {
|
|
517
|
+
type: Function,
|
|
518
|
+
default: void 0
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
const SIZE_CLASS = {
|
|
522
|
+
lg: "lg",
|
|
523
|
+
sm: "sm"
|
|
524
|
+
};
|
|
525
|
+
const ICON_POSITION = {
|
|
526
|
+
right: "right",
|
|
527
|
+
left: "left"
|
|
528
|
+
};
|
|
529
|
+
const getRootClass = (props) => {
|
|
530
|
+
return computed(() => ({
|
|
531
|
+
"devui-search": true,
|
|
532
|
+
"devui-search__disbaled": props.disabled,
|
|
533
|
+
"devui-search__no-border": props.noBorder,
|
|
534
|
+
[`devui-search__${props.size}`]: SIZE_CLASS[props.size],
|
|
535
|
+
[`devui-search__${props.iconPosition}`]: ICON_POSITION[props.iconPosition]
|
|
536
|
+
}));
|
|
537
|
+
};
|
|
538
|
+
const keywordsHandles = (ctx, props) => {
|
|
539
|
+
const keywords = ref("");
|
|
540
|
+
watch(() => props.modelValue, (val) => {
|
|
541
|
+
keywords.value = val;
|
|
542
|
+
}, { immediate: true });
|
|
543
|
+
const onClearHandle = () => {
|
|
544
|
+
keywords.value = "";
|
|
545
|
+
ctx.emit("update:modelValue", "");
|
|
546
|
+
};
|
|
547
|
+
const clearIconShow = computed(() => {
|
|
548
|
+
return keywords.value.length > 0;
|
|
549
|
+
});
|
|
550
|
+
return {
|
|
551
|
+
keywords,
|
|
552
|
+
clearIconShow,
|
|
553
|
+
onClearHandle
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
557
|
+
var freeGlobal$1 = freeGlobal;
|
|
558
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
559
|
+
var root = freeGlobal$1 || freeSelf || Function("return this")();
|
|
560
|
+
var root$1 = root;
|
|
561
|
+
var Symbol$1 = root$1.Symbol;
|
|
562
|
+
var Symbol$2 = Symbol$1;
|
|
563
|
+
var objectProto$1 = Object.prototype;
|
|
564
|
+
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
565
|
+
var nativeObjectToString$1 = objectProto$1.toString;
|
|
566
|
+
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
567
|
+
function getRawTag(value) {
|
|
568
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
569
|
+
try {
|
|
570
|
+
value[symToStringTag$1] = void 0;
|
|
571
|
+
var unmasked = true;
|
|
572
|
+
} catch (e) {
|
|
573
|
+
}
|
|
574
|
+
var result = nativeObjectToString$1.call(value);
|
|
575
|
+
if (unmasked) {
|
|
576
|
+
if (isOwn) {
|
|
577
|
+
value[symToStringTag$1] = tag;
|
|
578
|
+
} else {
|
|
579
|
+
delete value[symToStringTag$1];
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return result;
|
|
583
|
+
}
|
|
584
|
+
var objectProto = Object.prototype;
|
|
585
|
+
var nativeObjectToString = objectProto.toString;
|
|
586
|
+
function objectToString(value) {
|
|
587
|
+
return nativeObjectToString.call(value);
|
|
588
|
+
}
|
|
589
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
590
|
+
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
591
|
+
function baseGetTag(value) {
|
|
592
|
+
if (value == null) {
|
|
593
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
594
|
+
}
|
|
595
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
596
|
+
}
|
|
597
|
+
function isObjectLike(value) {
|
|
598
|
+
return value != null && typeof value == "object";
|
|
599
|
+
}
|
|
600
|
+
var symbolTag = "[object Symbol]";
|
|
601
|
+
function isSymbol(value) {
|
|
602
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
603
|
+
}
|
|
604
|
+
var reWhitespace = /\s/;
|
|
605
|
+
function trimmedEndIndex(string) {
|
|
606
|
+
var index2 = string.length;
|
|
607
|
+
while (index2-- && reWhitespace.test(string.charAt(index2))) {
|
|
608
|
+
}
|
|
609
|
+
return index2;
|
|
610
|
+
}
|
|
611
|
+
var reTrimStart = /^\s+/;
|
|
612
|
+
function baseTrim(string) {
|
|
613
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
614
|
+
}
|
|
615
|
+
function isObject(value) {
|
|
616
|
+
var type = typeof value;
|
|
617
|
+
return value != null && (type == "object" || type == "function");
|
|
618
|
+
}
|
|
619
|
+
var NAN = 0 / 0;
|
|
620
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
621
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
622
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
623
|
+
var freeParseInt = parseInt;
|
|
624
|
+
function toNumber(value) {
|
|
625
|
+
if (typeof value == "number") {
|
|
626
|
+
return value;
|
|
627
|
+
}
|
|
628
|
+
if (isSymbol(value)) {
|
|
629
|
+
return NAN;
|
|
630
|
+
}
|
|
631
|
+
if (isObject(value)) {
|
|
632
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
633
|
+
value = isObject(other) ? other + "" : other;
|
|
634
|
+
}
|
|
635
|
+
if (typeof value != "string") {
|
|
636
|
+
return value === 0 ? value : +value;
|
|
637
|
+
}
|
|
638
|
+
value = baseTrim(value);
|
|
639
|
+
var isBinary = reIsBinary.test(value);
|
|
640
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
641
|
+
}
|
|
642
|
+
var now = function() {
|
|
643
|
+
return root$1.Date.now();
|
|
644
|
+
};
|
|
645
|
+
var now$1 = now;
|
|
646
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
647
|
+
var nativeMax = Math.max, nativeMin = Math.min;
|
|
648
|
+
function debounce(func, wait, options) {
|
|
649
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
650
|
+
if (typeof func != "function") {
|
|
651
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
652
|
+
}
|
|
653
|
+
wait = toNumber(wait) || 0;
|
|
654
|
+
if (isObject(options)) {
|
|
655
|
+
leading = !!options.leading;
|
|
656
|
+
maxing = "maxWait" in options;
|
|
657
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
658
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
659
|
+
}
|
|
660
|
+
function invokeFunc(time) {
|
|
661
|
+
var args = lastArgs, thisArg = lastThis;
|
|
662
|
+
lastArgs = lastThis = void 0;
|
|
663
|
+
lastInvokeTime = time;
|
|
664
|
+
result = func.apply(thisArg, args);
|
|
665
|
+
return result;
|
|
666
|
+
}
|
|
667
|
+
function leadingEdge(time) {
|
|
668
|
+
lastInvokeTime = time;
|
|
669
|
+
timerId = setTimeout(timerExpired, wait);
|
|
670
|
+
return leading ? invokeFunc(time) : result;
|
|
671
|
+
}
|
|
672
|
+
function remainingWait(time) {
|
|
673
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
674
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
675
|
+
}
|
|
676
|
+
function shouldInvoke(time) {
|
|
677
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
|
|
678
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
679
|
+
}
|
|
680
|
+
function timerExpired() {
|
|
681
|
+
var time = now$1();
|
|
682
|
+
if (shouldInvoke(time)) {
|
|
683
|
+
return trailingEdge(time);
|
|
684
|
+
}
|
|
685
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
686
|
+
}
|
|
687
|
+
function trailingEdge(time) {
|
|
688
|
+
timerId = void 0;
|
|
689
|
+
if (trailing && lastArgs) {
|
|
690
|
+
return invokeFunc(time);
|
|
691
|
+
}
|
|
692
|
+
lastArgs = lastThis = void 0;
|
|
693
|
+
return result;
|
|
694
|
+
}
|
|
695
|
+
function cancel() {
|
|
696
|
+
if (timerId !== void 0) {
|
|
697
|
+
clearTimeout(timerId);
|
|
698
|
+
}
|
|
699
|
+
lastInvokeTime = 0;
|
|
700
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
701
|
+
}
|
|
702
|
+
function flush() {
|
|
703
|
+
return timerId === void 0 ? result : trailingEdge(now$1());
|
|
704
|
+
}
|
|
705
|
+
function debounced() {
|
|
706
|
+
var time = now$1(), isInvoking = shouldInvoke(time);
|
|
707
|
+
lastArgs = arguments;
|
|
708
|
+
lastThis = this;
|
|
709
|
+
lastCallTime = time;
|
|
710
|
+
if (isInvoking) {
|
|
711
|
+
if (timerId === void 0) {
|
|
712
|
+
return leadingEdge(lastCallTime);
|
|
713
|
+
}
|
|
714
|
+
if (maxing) {
|
|
715
|
+
clearTimeout(timerId);
|
|
716
|
+
timerId = setTimeout(timerExpired, wait);
|
|
717
|
+
return invokeFunc(lastCallTime);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
if (timerId === void 0) {
|
|
721
|
+
timerId = setTimeout(timerExpired, wait);
|
|
722
|
+
}
|
|
723
|
+
return result;
|
|
724
|
+
}
|
|
725
|
+
debounced.cancel = cancel;
|
|
726
|
+
debounced.flush = flush;
|
|
727
|
+
return debounced;
|
|
728
|
+
}
|
|
729
|
+
const KEYS_MAP = {
|
|
730
|
+
enter: "Enter"
|
|
731
|
+
};
|
|
732
|
+
const keydownHandles = (ctx, keywords, delay) => {
|
|
733
|
+
const onInputKeydown = ($event) => {
|
|
734
|
+
switch ($event.key) {
|
|
735
|
+
case KEYS_MAP.enter:
|
|
736
|
+
handleEnter($event);
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
const handleEnter = ($event) => {
|
|
741
|
+
if ($event.target instanceof HTMLInputElement) {
|
|
742
|
+
const value = $event.target.value;
|
|
743
|
+
useEmitKeyword(value);
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
const onClickHandle = () => {
|
|
747
|
+
useEmitKeyword(keywords.value);
|
|
748
|
+
};
|
|
749
|
+
const useEmitKeyword = debounce((value) => {
|
|
750
|
+
ctx.emit("onSearch", value);
|
|
751
|
+
}, delay);
|
|
752
|
+
return {
|
|
753
|
+
onInputKeydown,
|
|
754
|
+
useEmitKeyword,
|
|
755
|
+
onClickHandle
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
const inputProps = {
|
|
759
|
+
placeholder: {
|
|
760
|
+
type: String,
|
|
761
|
+
default: void 0
|
|
762
|
+
},
|
|
763
|
+
disabled: {
|
|
764
|
+
type: Boolean,
|
|
765
|
+
default: false
|
|
766
|
+
},
|
|
767
|
+
autoFocus: {
|
|
768
|
+
type: Boolean,
|
|
769
|
+
default: false
|
|
770
|
+
},
|
|
771
|
+
maxLength: {
|
|
772
|
+
type: Number,
|
|
773
|
+
default: Number.MAX_SAFE_INTEGER
|
|
774
|
+
},
|
|
775
|
+
cssClass: {
|
|
776
|
+
type: String,
|
|
777
|
+
default: ""
|
|
778
|
+
},
|
|
779
|
+
error: {
|
|
780
|
+
type: Boolean,
|
|
781
|
+
default: false
|
|
782
|
+
},
|
|
783
|
+
size: {
|
|
784
|
+
type: String,
|
|
785
|
+
default: ""
|
|
786
|
+
},
|
|
787
|
+
showPassword: {
|
|
788
|
+
type: Boolean,
|
|
789
|
+
default: false
|
|
790
|
+
},
|
|
791
|
+
modelValue: {
|
|
792
|
+
type: String,
|
|
793
|
+
default: ""
|
|
794
|
+
},
|
|
795
|
+
"update:modelValue": {
|
|
796
|
+
type: Function,
|
|
797
|
+
default: void 0
|
|
798
|
+
},
|
|
799
|
+
onChange: {
|
|
800
|
+
type: Function,
|
|
801
|
+
default: void 0
|
|
802
|
+
},
|
|
803
|
+
onKeydown: {
|
|
804
|
+
type: Function,
|
|
805
|
+
default: void 0
|
|
806
|
+
},
|
|
807
|
+
onFocus: {
|
|
808
|
+
type: Function,
|
|
809
|
+
default: void 0
|
|
810
|
+
},
|
|
811
|
+
onBlur: {
|
|
812
|
+
type: Function,
|
|
813
|
+
default: void 0
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
var input = "";
|
|
817
|
+
const formItemInjectionKey = Symbol("dFormItem");
|
|
818
|
+
const dFormItemEvents = {
|
|
819
|
+
blur: "d.form.blur",
|
|
820
|
+
change: "d.form.change",
|
|
821
|
+
input: "d.form.input"
|
|
822
|
+
};
|
|
823
|
+
var DInput = defineComponent({
|
|
824
|
+
name: "DInput",
|
|
825
|
+
directives: {
|
|
826
|
+
focus: {
|
|
827
|
+
mounted: function(el, binding) {
|
|
828
|
+
if (binding.value) {
|
|
829
|
+
el.focus();
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
props: inputProps,
|
|
835
|
+
emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
|
|
836
|
+
setup(props, ctx) {
|
|
837
|
+
const formItem = inject(formItemInjectionKey, {});
|
|
838
|
+
const hasFormItem = Object.keys(formItem).length > 0;
|
|
839
|
+
const sizeCls = computed(() => `devui-input-${props.size}`);
|
|
840
|
+
const showPwdIcon = ref(false);
|
|
841
|
+
const inputType = ref("text");
|
|
842
|
+
const inputCls = computed(() => {
|
|
843
|
+
return {
|
|
844
|
+
error: props.error,
|
|
845
|
+
[props.cssClass]: true,
|
|
846
|
+
[sizeCls.value]: props.size !== ""
|
|
847
|
+
};
|
|
848
|
+
});
|
|
849
|
+
const showPreviewIcon = computed(() => inputType.value === "password");
|
|
850
|
+
watch(() => props.showPassword, (flg) => {
|
|
851
|
+
inputType.value = flg ? "password" : "text";
|
|
852
|
+
}, {
|
|
853
|
+
immediate: true
|
|
854
|
+
});
|
|
855
|
+
watch(() => props.modelValue, (value) => {
|
|
856
|
+
value && value.length > 0 && showPreviewIcon.value ? showPwdIcon.value = true : showPwdIcon.value = false;
|
|
857
|
+
});
|
|
858
|
+
const onInput = ($event) => {
|
|
859
|
+
ctx.emit("update:modelValue", $event.target.value);
|
|
860
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
|
|
861
|
+
}, onFocus = () => {
|
|
862
|
+
ctx.emit("focus");
|
|
863
|
+
}, onBlur = () => {
|
|
864
|
+
ctx.emit("blur");
|
|
865
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
|
|
866
|
+
}, onChange = ($event) => {
|
|
867
|
+
ctx.emit("change", $event.target.value);
|
|
868
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
|
|
869
|
+
}, onKeydown = ($event) => {
|
|
870
|
+
ctx.emit("keydown", $event);
|
|
871
|
+
}, onChangeInputType = () => {
|
|
872
|
+
inputType.value = inputType.value === "password" ? "text" : "password";
|
|
873
|
+
};
|
|
874
|
+
return {
|
|
875
|
+
inputCls,
|
|
876
|
+
inputType,
|
|
877
|
+
showPreviewIcon,
|
|
878
|
+
showPwdIcon,
|
|
879
|
+
onInput,
|
|
880
|
+
onFocus,
|
|
881
|
+
onBlur,
|
|
882
|
+
onChange,
|
|
883
|
+
onKeydown,
|
|
884
|
+
onChangeInputType
|
|
885
|
+
};
|
|
886
|
+
},
|
|
887
|
+
render() {
|
|
888
|
+
const {
|
|
889
|
+
modelValue,
|
|
890
|
+
showPreviewIcon,
|
|
891
|
+
showPwdIcon,
|
|
892
|
+
inputCls,
|
|
893
|
+
inputType,
|
|
894
|
+
maxLength,
|
|
895
|
+
autoFocus,
|
|
896
|
+
placeholder,
|
|
897
|
+
disabled,
|
|
898
|
+
onInput,
|
|
899
|
+
onFocus,
|
|
900
|
+
onBlur,
|
|
901
|
+
onChange,
|
|
902
|
+
onKeydown,
|
|
903
|
+
onChangeInputType
|
|
904
|
+
} = this;
|
|
905
|
+
return createVNode("div", {
|
|
906
|
+
"class": "devui-input__wrap"
|
|
907
|
+
}, [withDirectives(createVNode("input", mergeProps({
|
|
908
|
+
dinput: true
|
|
909
|
+
}, {
|
|
910
|
+
"value": modelValue,
|
|
911
|
+
"disabled": disabled,
|
|
912
|
+
"type": inputType,
|
|
913
|
+
"maxlength": maxLength,
|
|
914
|
+
"placeholder": placeholder,
|
|
915
|
+
"class": inputCls,
|
|
916
|
+
"onInput": onInput,
|
|
917
|
+
"onFocus": onFocus,
|
|
918
|
+
"onBlur": onBlur,
|
|
919
|
+
"onChange": onChange,
|
|
920
|
+
"onKeydown": onKeydown
|
|
921
|
+
}), null), [[resolveDirective("focus"), autoFocus]]), showPwdIcon && createVNode("div", {
|
|
922
|
+
"class": "devui-input__preview",
|
|
923
|
+
"onClick": onChangeInputType
|
|
924
|
+
}, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
|
|
925
|
+
"name": "preview",
|
|
926
|
+
"size": "12px",
|
|
927
|
+
"key": 1
|
|
928
|
+
}, null) : createVNode(resolveComponent("d-icon"), {
|
|
929
|
+
"name": "preview-forbidden",
|
|
930
|
+
"size": "12px",
|
|
931
|
+
"key": 2
|
|
932
|
+
}, null)])]);
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
var search = "";
|
|
936
|
+
var DSearch = defineComponent({
|
|
937
|
+
name: "DSearch",
|
|
938
|
+
props: searchProps,
|
|
939
|
+
emits: ["update:modelValue", "onSearch"],
|
|
940
|
+
setup(props, ctx) {
|
|
941
|
+
const rootClasses = getRootClass(props);
|
|
942
|
+
const {
|
|
943
|
+
keywords,
|
|
944
|
+
clearIconShow,
|
|
945
|
+
onClearHandle
|
|
946
|
+
} = keywordsHandles(ctx, props);
|
|
947
|
+
const {
|
|
948
|
+
onInputKeydown,
|
|
949
|
+
onClickHandle,
|
|
950
|
+
useEmitKeyword
|
|
951
|
+
} = keydownHandles(ctx, keywords, props.delay);
|
|
952
|
+
const onInputUpdate = (event) => {
|
|
953
|
+
if (props.isKeyupSearch) {
|
|
954
|
+
useEmitKeyword(event);
|
|
955
|
+
}
|
|
956
|
+
keywords.value = event;
|
|
957
|
+
ctx.emit("update:modelValue", event);
|
|
958
|
+
};
|
|
959
|
+
return () => {
|
|
960
|
+
return createVNode("div", {
|
|
961
|
+
"class": rootClasses.value
|
|
962
|
+
}, [props.iconPosition === "left" && createVNode("div", {
|
|
963
|
+
"class": "devui-search__icon",
|
|
964
|
+
"onClick": onClickHandle
|
|
965
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
966
|
+
"name": "search",
|
|
967
|
+
"size": "inherit",
|
|
968
|
+
"key": "search"
|
|
969
|
+
}, null)]), createVNode(DInput, {
|
|
970
|
+
"size": props.size,
|
|
971
|
+
"disabled": props.disabled,
|
|
972
|
+
"autoFocus": props.autoFocus,
|
|
973
|
+
"modelValue": keywords.value,
|
|
974
|
+
"maxLength": props.maxLength,
|
|
975
|
+
"placeholder": props.placeholder,
|
|
976
|
+
"cssClass": props.cssClass,
|
|
977
|
+
"onKeydown": onInputKeydown,
|
|
978
|
+
"onUpdate:modelValue": onInputUpdate
|
|
979
|
+
}, null), clearIconShow.value && createVNode("div", {
|
|
980
|
+
"class": "devui-search__clear",
|
|
981
|
+
"onClick": onClearHandle
|
|
982
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
983
|
+
"name": "close",
|
|
984
|
+
"size": "inherit",
|
|
985
|
+
"key": "close"
|
|
986
|
+
}, null)]), props.iconPosition === "right" && createVNode("div", {
|
|
987
|
+
"class": "devui-search__icon",
|
|
988
|
+
"onClick": onClickHandle
|
|
989
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
990
|
+
"name": "search",
|
|
991
|
+
"size": "inherit",
|
|
992
|
+
"key": "search"
|
|
993
|
+
}, null)])]);
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
const tooltipProps = {
|
|
998
|
+
position: {
|
|
999
|
+
type: String,
|
|
1000
|
+
default: "top"
|
|
1001
|
+
},
|
|
1002
|
+
showAnimation: {
|
|
1003
|
+
type: Boolean,
|
|
1004
|
+
default: true
|
|
1005
|
+
},
|
|
1006
|
+
content: {
|
|
1007
|
+
type: String
|
|
1008
|
+
},
|
|
1009
|
+
mouseLeaveDelay: {
|
|
1010
|
+
type: String,
|
|
1011
|
+
default: "150"
|
|
1012
|
+
},
|
|
1013
|
+
mouseEnterDelay: {
|
|
1014
|
+
type: String,
|
|
1015
|
+
default: "100"
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
const EventListener = {
|
|
1019
|
+
listen: function(target, eventType, callback) {
|
|
1020
|
+
if (target.addEventListener) {
|
|
1021
|
+
target.addEventListener(eventType, callback, false);
|
|
1022
|
+
return {
|
|
1023
|
+
remove() {
|
|
1024
|
+
target.removeEventListener(target, callback, false);
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
} else {
|
|
1028
|
+
target.attchEvent(eventType, callback);
|
|
1029
|
+
return {
|
|
1030
|
+
remove() {
|
|
1031
|
+
target.detachEvent(eventType, callback);
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
var tooltip = "";
|
|
1038
|
+
var DTooltip = defineComponent({
|
|
1039
|
+
name: "DTooltip",
|
|
1040
|
+
props: tooltipProps,
|
|
1041
|
+
setup(props, ctx) {
|
|
1042
|
+
const position = reactive({
|
|
1043
|
+
left: 0,
|
|
1044
|
+
top: 0
|
|
1045
|
+
});
|
|
1046
|
+
const show = ref(false);
|
|
1047
|
+
const slotElement = ref(null);
|
|
1048
|
+
const tooltip2 = ref(null);
|
|
1049
|
+
const arrow = ref(null);
|
|
1050
|
+
const tooltipcontent = ref(null);
|
|
1051
|
+
let enterEvent;
|
|
1052
|
+
let leaveEvent;
|
|
1053
|
+
const arrowStyle = (attr, value) => {
|
|
1054
|
+
arrow.value.style[attr] = value;
|
|
1055
|
+
};
|
|
1056
|
+
const delayShowTrue = function(fn, delay = props.mouseEnterDelay) {
|
|
1057
|
+
let start;
|
|
1058
|
+
if (parseInt(delay) >= 0) {
|
|
1059
|
+
return function() {
|
|
1060
|
+
if (start) {
|
|
1061
|
+
clearTimeout(start);
|
|
1062
|
+
}
|
|
1063
|
+
start = setTimeout(fn, parseInt(delay));
|
|
1064
|
+
};
|
|
1065
|
+
} else {
|
|
1066
|
+
console.error("the value of delay is bigger than 0 and the type of delay must be string!");
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
onMounted(() => {
|
|
1071
|
+
if (!show.value) {
|
|
1072
|
+
tooltip2.value.style.opacity = "0";
|
|
1073
|
+
}
|
|
1074
|
+
enterEvent = EventListener.listen(slotElement.value.children[0], "mouseenter", delayShowTrue(function() {
|
|
1075
|
+
show.value = true;
|
|
1076
|
+
}, props.mouseEnterDelay));
|
|
1077
|
+
leaveEvent = EventListener.listen(slotElement.value.children[0], "mouseleave", function() {
|
|
1078
|
+
if (show.value) {
|
|
1079
|
+
setTimeout(function() {
|
|
1080
|
+
show.value = false;
|
|
1081
|
+
}, props.mouseLeaveDelay);
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
watch(show, function(newValue, oldValue) {
|
|
1086
|
+
if (newValue) {
|
|
1087
|
+
tooltip2.value.style.opacity = "1";
|
|
1088
|
+
tooltip2.value.style.zIndex = "999";
|
|
1089
|
+
arrow.value.style.border = "5px solid transparent";
|
|
1090
|
+
switch (props.position) {
|
|
1091
|
+
case "top":
|
|
1092
|
+
position.left = slotElement.value.children[0].offsetLeft - tooltip2.value.offsetWidth / 2 + slotElement.value.children[0].offsetWidth / 2 - 5;
|
|
1093
|
+
position.top = slotElement.value.children[0].offsetTop - 10 - tooltipcontent.value.offsetHeight;
|
|
1094
|
+
arrowStyle("borderTop", "5px solid rgb(70, 77, 110)");
|
|
1095
|
+
arrow.value.style.top = `${tooltipcontent.value.offsetHeight}px`;
|
|
1096
|
+
arrow.value.style.left = `${tooltipcontent.value.offsetWidth / 2 + 5}px`;
|
|
1097
|
+
break;
|
|
1098
|
+
case "right":
|
|
1099
|
+
position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth;
|
|
1100
|
+
position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.value.offsetHeight / 2;
|
|
1101
|
+
arrowStyle("borderRight", "5px solid rgb(70, 77, 110)");
|
|
1102
|
+
arrow.value.style.top = `${tooltipcontent.value.offsetHeight / 2 - 5}px`;
|
|
1103
|
+
arrow.value.style.left = "-0px";
|
|
1104
|
+
break;
|
|
1105
|
+
case "bottom":
|
|
1106
|
+
position.top = slotElement.value.children[0].offsetHeight + slotElement.value.children[0].offsetTop + 10;
|
|
1107
|
+
position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth / 2 - tooltipcontent.value.offsetWidth / 2 - 5;
|
|
1108
|
+
arrowStyle("borderBottom", "5px solid rgb(70, 77, 110)");
|
|
1109
|
+
arrow.value.style.top = "-10px";
|
|
1110
|
+
arrow.value.style.left = `${tooltipcontent.value.offsetWidth / 2 + 5}px`;
|
|
1111
|
+
break;
|
|
1112
|
+
case "left":
|
|
1113
|
+
position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.value.offsetHeight / 2;
|
|
1114
|
+
position.left = slotElement.value.children[0].offsetLeft - 20 - tooltipcontent.value.offsetWidth;
|
|
1115
|
+
arrowStyle("borderLeft", "5px solid rgb(70, 77, 110)");
|
|
1116
|
+
arrow.value.style.left = `${tooltipcontent.value.offsetWidth + 10}px`;
|
|
1117
|
+
arrow.value.style.top = `${tooltipcontent.value.offsetHeight / 2 - 5}px`;
|
|
1118
|
+
break;
|
|
1119
|
+
default:
|
|
1120
|
+
console.error("The attribute position value is wrong, the value is one of top\u3001right\u3001left\u3001bottom");
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
tooltip2.value.style.top = position.top + "px";
|
|
1124
|
+
tooltip2.value.style.left = position.left + "px";
|
|
1125
|
+
} else {
|
|
1126
|
+
position.top = 0;
|
|
1127
|
+
position.left = 0;
|
|
1128
|
+
tooltip2.value.style.opacity = "0";
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
onBeforeUnmount(() => {
|
|
1132
|
+
enterEvent.remove();
|
|
1133
|
+
leaveEvent.remove();
|
|
1134
|
+
});
|
|
1135
|
+
return () => {
|
|
1136
|
+
const defaultSlot = renderSlot(useSlots(), "default");
|
|
1137
|
+
return createVNode("div", {
|
|
1138
|
+
"class": "devui-tooltip"
|
|
1139
|
+
}, [createVNode("div", {
|
|
1140
|
+
"class": "slotElement",
|
|
1141
|
+
"ref": slotElement
|
|
1142
|
+
}, [defaultSlot]), createVNode("div", {
|
|
1143
|
+
"class": "tooltip",
|
|
1144
|
+
"ref": tooltip2
|
|
1145
|
+
}, [createVNode("div", {
|
|
1146
|
+
"class": "arrow",
|
|
1147
|
+
"ref": arrow
|
|
1148
|
+
}, null), createVNode("div", {
|
|
1149
|
+
"class": "tooltipcontent",
|
|
1150
|
+
"ref": tooltipcontent
|
|
1151
|
+
}, [props.content])])]);
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
function _isSlot(s) {
|
|
1156
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
1157
|
+
}
|
|
1158
|
+
var DTransferBase = defineComponent({
|
|
1159
|
+
name: "DTransferBase",
|
|
1160
|
+
components: {
|
|
1161
|
+
DSearch,
|
|
1162
|
+
DCheckboxGroup,
|
|
1163
|
+
DCheckbox,
|
|
1164
|
+
DTooltip
|
|
1165
|
+
},
|
|
1166
|
+
props: transferBaseProps,
|
|
1167
|
+
setup(props, ctx) {
|
|
1168
|
+
const modelValues = computed(() => props.checkedValues);
|
|
1169
|
+
const searchQuery = computed(() => props.filter);
|
|
1170
|
+
const baseClass = TransferBaseClass(props);
|
|
1171
|
+
const updateSearchQuery = (val) => ctx.emit("changeQuery", val);
|
|
1172
|
+
const renderCheckbox = (props2, key, showTooltip = false, tooltipPosition = "top") => {
|
|
1173
|
+
const checkbox2 = createVNode(DCheckbox, {
|
|
1174
|
+
"class": "devui-transfer-panel-body-list-item",
|
|
1175
|
+
"label": props2.key,
|
|
1176
|
+
"value": props2.value,
|
|
1177
|
+
"disabled": props2.disabled,
|
|
1178
|
+
"key": key
|
|
1179
|
+
}, null);
|
|
1180
|
+
return !showTooltip ? checkbox2 : createVNode(DTooltip, {
|
|
1181
|
+
"position": tooltipPosition,
|
|
1182
|
+
"content": props2.key
|
|
1183
|
+
}, _isSlot(checkbox2) ? checkbox2 : {
|
|
1184
|
+
default: () => [checkbox2]
|
|
1185
|
+
});
|
|
1186
|
+
};
|
|
1187
|
+
return {
|
|
1188
|
+
baseClass,
|
|
1189
|
+
searchQuery,
|
|
1190
|
+
modelValues,
|
|
1191
|
+
updateSearchQuery,
|
|
1192
|
+
renderCheckbox
|
|
1193
|
+
};
|
|
1194
|
+
},
|
|
1195
|
+
render() {
|
|
1196
|
+
let _slot;
|
|
1197
|
+
const {
|
|
1198
|
+
title,
|
|
1199
|
+
baseClass,
|
|
1200
|
+
checkedNum,
|
|
1201
|
+
allChecked,
|
|
1202
|
+
sourceOption,
|
|
1203
|
+
allCount,
|
|
1204
|
+
updateSearchQuery,
|
|
1205
|
+
search: search2,
|
|
1206
|
+
searchQuery,
|
|
1207
|
+
modelValues,
|
|
1208
|
+
height,
|
|
1209
|
+
showTooltip,
|
|
1210
|
+
tooltipPosition,
|
|
1211
|
+
renderCheckbox
|
|
1212
|
+
} = this;
|
|
1213
|
+
return createVNode("div", {
|
|
1214
|
+
"class": baseClass
|
|
1215
|
+
}, [this.$slots.header ? this.$slots.header() : createVNode("div", {
|
|
1216
|
+
"class": "devui-transfer-panel-header"
|
|
1217
|
+
}, [createVNode("div", {
|
|
1218
|
+
"class": "devui-transfer-panel-header-allChecked"
|
|
1219
|
+
}, [createVNode(DCheckbox, {
|
|
1220
|
+
"modelValue": allChecked,
|
|
1221
|
+
"onChange": (value) => this.$emit("changeAllSource", value)
|
|
1222
|
+
}, _isSlot(title) ? title : {
|
|
1223
|
+
default: () => [title]
|
|
1224
|
+
})]), createVNode("div", {
|
|
1225
|
+
"class": "devui-transfer-panel-header-num"
|
|
1226
|
+
}, [checkedNum, createTextVNode("/"), allCount])]), this.$slots.body ? this.$slots.body() : createVNode("div", {
|
|
1227
|
+
"class": "devui-transfer-panel-body"
|
|
1228
|
+
}, [search2 && createVNode("div", {
|
|
1229
|
+
"class": "devui-transfer-panel-body-search"
|
|
1230
|
+
}, [createVNode(DSearch, {
|
|
1231
|
+
"modelValue": searchQuery,
|
|
1232
|
+
"onUpdate:modelValue": updateSearchQuery
|
|
1233
|
+
}, null)]), createVNode("div", {
|
|
1234
|
+
"class": "devui-transfer-panel-body-list",
|
|
1235
|
+
"style": {
|
|
1236
|
+
height
|
|
1237
|
+
}
|
|
1238
|
+
}, [sourceOption.length ? createVNode(DCheckboxGroup, {
|
|
1239
|
+
"modelValue": modelValues,
|
|
1240
|
+
"onChange": (values) => this.$emit("updateCheckeds", values)
|
|
1241
|
+
}, _isSlot(_slot = sourceOption.map((item, idx) => {
|
|
1242
|
+
return renderCheckbox(item, idx, showTooltip, tooltipPosition);
|
|
1243
|
+
})) ? _slot : {
|
|
1244
|
+
default: () => [_slot]
|
|
1245
|
+
}) : createVNode("div", {
|
|
1246
|
+
"class": "devui-transfer-panel-body-list-empty"
|
|
1247
|
+
}, [createTextVNode("\u65E0\u6570\u636E")])])])]);
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
var Icon = defineComponent({
|
|
1251
|
+
name: "DIcon",
|
|
1252
|
+
props: {
|
|
1253
|
+
name: {
|
|
1254
|
+
type: String,
|
|
1255
|
+
required: true
|
|
1256
|
+
},
|
|
1257
|
+
size: {
|
|
1258
|
+
type: String,
|
|
1259
|
+
default: "inherit"
|
|
1260
|
+
},
|
|
1261
|
+
color: {
|
|
1262
|
+
type: String,
|
|
1263
|
+
default: "inherit"
|
|
1264
|
+
},
|
|
1265
|
+
classPrefix: {
|
|
1266
|
+
type: String,
|
|
1267
|
+
default: "icon"
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
setup(props) {
|
|
1271
|
+
return __spreadValues({}, props);
|
|
1272
|
+
},
|
|
1273
|
+
render() {
|
|
1274
|
+
const {
|
|
1275
|
+
name,
|
|
1276
|
+
size,
|
|
1277
|
+
color,
|
|
1278
|
+
classPrefix
|
|
1279
|
+
} = this;
|
|
1280
|
+
return /^((https?):)?\/\//.test(name) ? createVNode("img", {
|
|
1281
|
+
"src": name,
|
|
1282
|
+
"alt": name.split("/")[name.split("/").length - 1],
|
|
1283
|
+
"style": {
|
|
1284
|
+
width: size,
|
|
1285
|
+
verticalAlign: "text-bottom"
|
|
1286
|
+
}
|
|
1287
|
+
}, null) : createVNode("i", {
|
|
1288
|
+
"class": `${classPrefix} ${classPrefix}-${name}`,
|
|
1289
|
+
"style": {
|
|
1290
|
+
fontSize: size,
|
|
1291
|
+
color
|
|
1292
|
+
}
|
|
1293
|
+
}, null);
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
Icon.install = function(app) {
|
|
1297
|
+
app.component(Icon.name, Icon);
|
|
1298
|
+
};
|
|
1299
|
+
const buttonProps = {
|
|
1300
|
+
type: {
|
|
1301
|
+
type: String,
|
|
1302
|
+
default: "button"
|
|
1303
|
+
},
|
|
1304
|
+
btnStyle: {
|
|
1305
|
+
type: String,
|
|
1306
|
+
default: "primary"
|
|
1307
|
+
},
|
|
1308
|
+
size: {
|
|
1309
|
+
type: String,
|
|
1310
|
+
default: "md"
|
|
1311
|
+
},
|
|
1312
|
+
position: {
|
|
1313
|
+
type: String,
|
|
1314
|
+
default: "default"
|
|
1315
|
+
},
|
|
1316
|
+
bordered: {
|
|
1317
|
+
type: Boolean,
|
|
1318
|
+
default: false
|
|
1319
|
+
},
|
|
1320
|
+
icon: {
|
|
1321
|
+
type: String,
|
|
1322
|
+
default: ""
|
|
1323
|
+
},
|
|
1324
|
+
showLoading: {
|
|
1325
|
+
type: Boolean,
|
|
1326
|
+
default: false
|
|
1327
|
+
},
|
|
1328
|
+
width: {
|
|
1329
|
+
type: String
|
|
1330
|
+
},
|
|
1331
|
+
disabled: {
|
|
1332
|
+
type: Boolean,
|
|
1333
|
+
default: false
|
|
1334
|
+
},
|
|
1335
|
+
autofocus: {
|
|
1336
|
+
type: Boolean,
|
|
1337
|
+
default: false
|
|
1338
|
+
},
|
|
1339
|
+
onClick: {
|
|
1340
|
+
type: Function
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
var button = "";
|
|
1344
|
+
var DButton = defineComponent({
|
|
1345
|
+
name: "DButton",
|
|
1346
|
+
props: buttonProps,
|
|
1347
|
+
setup(props, ctx) {
|
|
1348
|
+
const buttonContent = ref(null);
|
|
1349
|
+
const onClick = (e) => {
|
|
1350
|
+
var _a;
|
|
1351
|
+
if (props.showLoading) {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
(_a = props.onClick) == null ? void 0 : _a.call(props, e);
|
|
1355
|
+
};
|
|
1356
|
+
const hasContent = computed(() => ctx.slots.default);
|
|
1357
|
+
const btnClass = computed(() => {
|
|
1358
|
+
const {
|
|
1359
|
+
btnStyle,
|
|
1360
|
+
size,
|
|
1361
|
+
position,
|
|
1362
|
+
bordered,
|
|
1363
|
+
icon
|
|
1364
|
+
} = props;
|
|
1365
|
+
const origin = `devui-btn devui-btn-${btnStyle} devui-btn-${size} devui-btn-${position}`;
|
|
1366
|
+
const borderedClass = bordered ? "bordered" : "";
|
|
1367
|
+
const btnIcon = !!icon && !hasContent.value && btnStyle !== "primary" ? "d-btn-icon" : "";
|
|
1368
|
+
const btnIconWrap = !!icon ? "d-btn-icon-wrap" : "";
|
|
1369
|
+
return `${origin} ${borderedClass} ${btnIcon} ${btnIconWrap}`;
|
|
1370
|
+
});
|
|
1371
|
+
const iconClass = computed(() => {
|
|
1372
|
+
if (!props.icon) {
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
const origin = "devui-icon-fix icon";
|
|
1376
|
+
if (hasContent.value) {
|
|
1377
|
+
return `${origin} clear-right-5`;
|
|
1378
|
+
} else {
|
|
1379
|
+
return origin;
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
return () => {
|
|
1383
|
+
var _a, _b;
|
|
1384
|
+
const {
|
|
1385
|
+
icon,
|
|
1386
|
+
type,
|
|
1387
|
+
disabled,
|
|
1388
|
+
showLoading,
|
|
1389
|
+
width
|
|
1390
|
+
} = props;
|
|
1391
|
+
return withDirectives(createVNode("div", mergeProps({
|
|
1392
|
+
"class": "devui-btn-host"
|
|
1393
|
+
}, ctx.attrs), [createVNode("button", {
|
|
1394
|
+
"class": btnClass.value,
|
|
1395
|
+
"type": type,
|
|
1396
|
+
"disabled": disabled,
|
|
1397
|
+
"style": {
|
|
1398
|
+
width
|
|
1399
|
+
},
|
|
1400
|
+
"onClick": onClick
|
|
1401
|
+
}, [!!icon ? createVNode(Icon, {
|
|
1402
|
+
"name": icon,
|
|
1403
|
+
"class": iconClass.value
|
|
1404
|
+
}, null) : null, createVNode("span", {
|
|
1405
|
+
"class": "button-content",
|
|
1406
|
+
"ref": buttonContent
|
|
1407
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]), [[resolveDirective("dLoading"), showLoading]]);
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
const transferOperationProps = {
|
|
1412
|
+
sourceDisabled: {
|
|
1413
|
+
type: Boolean,
|
|
1414
|
+
default: () => true
|
|
1415
|
+
},
|
|
1416
|
+
targetDisabled: {
|
|
1417
|
+
type: Boolean,
|
|
1418
|
+
default: () => true
|
|
1419
|
+
},
|
|
1420
|
+
disabled: {
|
|
1421
|
+
type: Boolean,
|
|
1422
|
+
default: () => false
|
|
1423
|
+
},
|
|
1424
|
+
onUpdateSourceData: {
|
|
1425
|
+
type: Function
|
|
1426
|
+
},
|
|
1427
|
+
onUpdateTargetData: {
|
|
1428
|
+
type: Function
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
var DTransferOperation = defineComponent({
|
|
1432
|
+
name: "DTransferOperation",
|
|
1433
|
+
components: {
|
|
1434
|
+
DButton
|
|
1435
|
+
},
|
|
1436
|
+
props: transferOperationProps,
|
|
1437
|
+
setup(props, ctx) {
|
|
1438
|
+
return () => {
|
|
1439
|
+
return ctx.slots.operation && ctx.slots.operation() || createVNode("div", {
|
|
1440
|
+
"class": "devui-transfer-panel-operation"
|
|
1441
|
+
}, [createVNode("div", {
|
|
1442
|
+
"class": "devui-transfer-panel-operation-group"
|
|
1443
|
+
}, [createVNode(DButton, {
|
|
1444
|
+
"class": "devui-transfer-panel-operation-group-left",
|
|
1445
|
+
"disabled": props.disabled ? props.disabled : props.sourceDisabled,
|
|
1446
|
+
"onClick": () => ctx.emit("updateSourceData")
|
|
1447
|
+
}, {
|
|
1448
|
+
default: () => [createVNode("span", {
|
|
1449
|
+
"class": "icon-collapse"
|
|
1450
|
+
}, null)]
|
|
1451
|
+
}), createVNode(DButton, {
|
|
1452
|
+
"class": "devui-transfer-panel-operation-group-right",
|
|
1453
|
+
"disabled": props.disabled ? props.disabled : props.targetDisabled,
|
|
1454
|
+
"onClick": () => ctx.emit("updateTargetData")
|
|
1455
|
+
}, {
|
|
1456
|
+
default: () => [createVNode("span", {
|
|
1457
|
+
"class": "icon-chevron-right"
|
|
1458
|
+
}, null)]
|
|
1459
|
+
})])]);
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
});
|
|
1463
|
+
const transferProps = {
|
|
1464
|
+
sourceOption: {
|
|
1465
|
+
type: Array,
|
|
1466
|
+
require: true,
|
|
1467
|
+
default() {
|
|
1468
|
+
return [];
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
targetOption: {
|
|
1472
|
+
type: Array,
|
|
1473
|
+
require: true,
|
|
1474
|
+
default() {
|
|
1475
|
+
return [];
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
titles: {
|
|
1479
|
+
type: Array,
|
|
1480
|
+
default: () => () => ["Source", "Target"]
|
|
1481
|
+
},
|
|
1482
|
+
modelValue: {
|
|
1483
|
+
type: Array,
|
|
1484
|
+
default: () => () => []
|
|
1485
|
+
},
|
|
1486
|
+
height: {
|
|
1487
|
+
type: String,
|
|
1488
|
+
default: () => "320px"
|
|
1489
|
+
},
|
|
1490
|
+
isSearch: {
|
|
1491
|
+
type: Boolean,
|
|
1492
|
+
default: () => false
|
|
1493
|
+
},
|
|
1494
|
+
isSourceDroppable: {
|
|
1495
|
+
type: Boolean,
|
|
1496
|
+
default: () => false
|
|
1497
|
+
},
|
|
1498
|
+
isTargetDroppable: {
|
|
1499
|
+
type: Boolean,
|
|
1500
|
+
default: () => false
|
|
1501
|
+
},
|
|
1502
|
+
disabled: {
|
|
1503
|
+
type: Boolean,
|
|
1504
|
+
default: () => false
|
|
1505
|
+
},
|
|
1506
|
+
showTooltip: {
|
|
1507
|
+
type: Boolean,
|
|
1508
|
+
default: () => false
|
|
1509
|
+
},
|
|
1510
|
+
tooltipPosition: {
|
|
1511
|
+
type: String,
|
|
1512
|
+
default: () => "top"
|
|
1513
|
+
},
|
|
1514
|
+
beforeTransfer: {
|
|
1515
|
+
type: Function
|
|
1516
|
+
},
|
|
1517
|
+
slots: {
|
|
1518
|
+
type: Object
|
|
1519
|
+
},
|
|
1520
|
+
searching: {
|
|
1521
|
+
type: Function
|
|
1522
|
+
},
|
|
1523
|
+
transferToSource: {
|
|
1524
|
+
type: Function
|
|
1525
|
+
},
|
|
1526
|
+
transferToTarget: {
|
|
1527
|
+
type: Function
|
|
1528
|
+
},
|
|
1529
|
+
transferring: {
|
|
1530
|
+
type: Function
|
|
1531
|
+
},
|
|
1532
|
+
afterTransfer: {
|
|
1533
|
+
type: Function
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
const headerSlot = (ctx, name) => {
|
|
1537
|
+
return !ctx.slots[`${name}-header`] ? null : () => ctx.slots[`${name}-header`] && ctx.slots[`${name}-header`]();
|
|
1538
|
+
};
|
|
1539
|
+
const bodySlot = (ctx, name) => {
|
|
1540
|
+
return !ctx.slots[`${name}-body`] ? null : () => ctx.slots[`${name}-body`] && ctx.slots[`${name}-body`]();
|
|
1541
|
+
};
|
|
1542
|
+
const opeartionSlot = (ctx) => {
|
|
1543
|
+
return ctx.slots && ctx.slots.operation && ctx.slots.operation() || null;
|
|
1544
|
+
};
|
|
1545
|
+
var transfer = "";
|
|
1546
|
+
var Transfer = defineComponent({
|
|
1547
|
+
name: "DTransfer",
|
|
1548
|
+
components: {
|
|
1549
|
+
DTransferBase,
|
|
1550
|
+
DTransferOperation,
|
|
1551
|
+
DCheckbox
|
|
1552
|
+
},
|
|
1553
|
+
props: transferProps,
|
|
1554
|
+
setup(props, ctx) {
|
|
1555
|
+
let leftOptions = reactive(initState(props, "source"));
|
|
1556
|
+
let rightOptions = reactive(initState(props, "target"));
|
|
1557
|
+
const origin = ref(null);
|
|
1558
|
+
watch(() => props.sourceOption, () => {
|
|
1559
|
+
leftOptions = reactive(initState(props, "source"));
|
|
1560
|
+
});
|
|
1561
|
+
watch(() => props.targetOption, () => {
|
|
1562
|
+
rightOptions = reactive(initState(props, "target"));
|
|
1563
|
+
});
|
|
1564
|
+
watch(() => leftOptions.keyword, (nVal) => {
|
|
1565
|
+
searchFilterData(leftOptions);
|
|
1566
|
+
});
|
|
1567
|
+
watch(() => leftOptions.checkedValues, (values) => {
|
|
1568
|
+
leftOptions.checkedNum = values.length;
|
|
1569
|
+
setAllCheckedState(leftOptions, values);
|
|
1570
|
+
}, {
|
|
1571
|
+
deep: true
|
|
1572
|
+
});
|
|
1573
|
+
watch(() => rightOptions.keyword, (nVal) => {
|
|
1574
|
+
searchFilterData(rightOptions);
|
|
1575
|
+
});
|
|
1576
|
+
watch(() => rightOptions.checkedValues, (values) => {
|
|
1577
|
+
rightOptions.checkedNum = values.length;
|
|
1578
|
+
setAllCheckedState(rightOptions, values);
|
|
1579
|
+
}, {
|
|
1580
|
+
deep: true
|
|
1581
|
+
});
|
|
1582
|
+
const setAllCheckedState = (source, value) => {
|
|
1583
|
+
if (origin.value === "click") {
|
|
1584
|
+
source.allChecked = false;
|
|
1585
|
+
} else {
|
|
1586
|
+
source.allChecked = value.length === source.data.filter((item) => !item.disabled).length ? true : false;
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
const updateFilterData = async (source, target, direction) => {
|
|
1590
|
+
if (isFunction("beforeTransfer")) {
|
|
1591
|
+
const res = await props.beforeTransfer.call(null, source, target);
|
|
1592
|
+
if (typeof res === "boolean" && res === false) {
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
const hasToSource = isFunction("transferToSource");
|
|
1597
|
+
const hasToTarget = isFunction("transferToTarget");
|
|
1598
|
+
const hasTransfering = isFunction("transferring");
|
|
1599
|
+
if (hasToSource || hasToTarget) {
|
|
1600
|
+
direction === "right" && props.transferToSource.call(null, source, target);
|
|
1601
|
+
direction === "left" && props.transferToTarget.call(null, source, target);
|
|
1602
|
+
} else {
|
|
1603
|
+
source.data = source.data.filter((item) => {
|
|
1604
|
+
const hasInclues = source.checkedValues.includes(item.value);
|
|
1605
|
+
hasInclues && target.data.push(item);
|
|
1606
|
+
return !hasInclues;
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
if (hasTransfering) {
|
|
1610
|
+
props.transferring.call(null, target);
|
|
1611
|
+
}
|
|
1612
|
+
source.checkedValues = [];
|
|
1613
|
+
target.disabled = !target.disabled;
|
|
1614
|
+
searchFilterData(source, target);
|
|
1615
|
+
searchFilterData(target, source);
|
|
1616
|
+
setOrigin("click");
|
|
1617
|
+
isFunction("afterTransfer") && props.afterTransfer.call(null, target);
|
|
1618
|
+
};
|
|
1619
|
+
const changeAllSource = (source, value) => {
|
|
1620
|
+
if (source.filterData.every((item) => item.disabled))
|
|
1621
|
+
return;
|
|
1622
|
+
source.allChecked = value;
|
|
1623
|
+
if (value) {
|
|
1624
|
+
source.checkedValues = source.filterData.filter((item) => !item.disabled).map((item) => item.value);
|
|
1625
|
+
} else {
|
|
1626
|
+
source.checkedValues = [];
|
|
1627
|
+
}
|
|
1628
|
+
setOrigin("change");
|
|
1629
|
+
};
|
|
1630
|
+
const updateLeftCheckeds = (values) => {
|
|
1631
|
+
leftOptions.checkedValues = values;
|
|
1632
|
+
setOrigin("change");
|
|
1633
|
+
};
|
|
1634
|
+
const updateRightCheckeds = (values) => {
|
|
1635
|
+
rightOptions.checkedValues = values;
|
|
1636
|
+
setOrigin("change");
|
|
1637
|
+
};
|
|
1638
|
+
const searchFilterData = (source, target) => {
|
|
1639
|
+
source.filterData = source.data.filter((item) => item.key.indexOf(source.keyword) !== -1);
|
|
1640
|
+
if (target) {
|
|
1641
|
+
target.allChecked = false;
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
const setOrigin = (value) => {
|
|
1645
|
+
origin.value = value;
|
|
1646
|
+
};
|
|
1647
|
+
const changeQueryHandle = (source, direction, value) => {
|
|
1648
|
+
if ((props == null ? void 0 : props.searching) && typeof props.searching === "function") {
|
|
1649
|
+
props.searching.call(null, direction, value, source);
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
source.keyword = value;
|
|
1653
|
+
};
|
|
1654
|
+
const isFunction = (type) => {
|
|
1655
|
+
return props[type] && typeof props[type] === "function";
|
|
1656
|
+
};
|
|
1657
|
+
return () => {
|
|
1658
|
+
return createVNode("div", {
|
|
1659
|
+
"class": "devui-transfer"
|
|
1660
|
+
}, [createVNode(DTransferBase, {
|
|
1661
|
+
"sourceOption": leftOptions.filterData,
|
|
1662
|
+
"title": props.titles[0],
|
|
1663
|
+
"type": "source",
|
|
1664
|
+
"search": props.isSearch,
|
|
1665
|
+
"allChecked": leftOptions.allChecked,
|
|
1666
|
+
"checkedNum": leftOptions.checkedNum,
|
|
1667
|
+
"filter": leftOptions.keyword,
|
|
1668
|
+
"height": props.height,
|
|
1669
|
+
"checkedValues": leftOptions.checkedValues,
|
|
1670
|
+
"allCount": leftOptions.data.length,
|
|
1671
|
+
"showTooltip": props.showTooltip,
|
|
1672
|
+
"tooltipPosition": props.tooltipPosition,
|
|
1673
|
+
"onChangeAllSource": (value) => changeAllSource(leftOptions, value),
|
|
1674
|
+
"onUpdateCheckeds": updateLeftCheckeds,
|
|
1675
|
+
"onChangeQuery": (value) => changeQueryHandle(leftOptions, "left", value)
|
|
1676
|
+
}, {
|
|
1677
|
+
header: headerSlot(ctx, "left"),
|
|
1678
|
+
body: bodySlot(ctx, "left")
|
|
1679
|
+
}), createVNode(DTransferOperation, {
|
|
1680
|
+
"disabled": props.disabled,
|
|
1681
|
+
"sourceDisabled": rightOptions.checkedNum > 0 ? false : true,
|
|
1682
|
+
"targetDisabled": leftOptions.checkedNum > 0 ? false : true,
|
|
1683
|
+
"onUpdateSourceData": () => {
|
|
1684
|
+
updateFilterData(rightOptions, leftOptions, "left");
|
|
1685
|
+
},
|
|
1686
|
+
"onUpdateTargetData": () => {
|
|
1687
|
+
updateFilterData(leftOptions, rightOptions, "right");
|
|
1688
|
+
}
|
|
1689
|
+
}, {
|
|
1690
|
+
operation: opeartionSlot(ctx)
|
|
1691
|
+
}), createVNode(DTransferBase, {
|
|
1692
|
+
"sourceOption": rightOptions.filterData,
|
|
1693
|
+
"title": props.titles[1],
|
|
1694
|
+
"type": "target",
|
|
1695
|
+
"search": props.isSearch,
|
|
1696
|
+
"allChecked": rightOptions.allChecked,
|
|
1697
|
+
"checkedNum": rightOptions.checkedNum,
|
|
1698
|
+
"filter": rightOptions.keyword,
|
|
1699
|
+
"height": props.height,
|
|
1700
|
+
"checkedValues": rightOptions.checkedValues,
|
|
1701
|
+
"allCount": rightOptions.data.length,
|
|
1702
|
+
"showTooltip": props.showTooltip,
|
|
1703
|
+
"tooltipPosition": props.tooltipPosition,
|
|
1704
|
+
"onChangeAllSource": (value) => changeAllSource(rightOptions, value),
|
|
1705
|
+
"onUpdateCheckeds": updateRightCheckeds,
|
|
1706
|
+
"onChangeQuery": (value) => changeQueryHandle(rightOptions, "right", value)
|
|
1707
|
+
}, {
|
|
1708
|
+
header: headerSlot(ctx, "right"),
|
|
1709
|
+
body: bodySlot(ctx, "right")
|
|
1710
|
+
})]);
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
Transfer.install = function(app) {
|
|
1715
|
+
app.component(Transfer.name, Transfer);
|
|
1716
|
+
};
|
|
1717
|
+
var index = {
|
|
1718
|
+
title: "Transfer \u7A7F\u68AD\u6846",
|
|
1719
|
+
category: "\u6570\u636E\u5F55\u5165",
|
|
1720
|
+
status: "10%",
|
|
1721
|
+
install(app) {
|
|
1722
|
+
app.use(Transfer);
|
|
1723
|
+
}
|
|
1724
|
+
};
|
|
1725
|
+
export { Transfer, index as default };
|