vue-devui 1.0.0-rc.1 → 1.0.0-rc.4
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/README.md +132 -200
- package/auto-complete/index.es.js +150 -110
- package/auto-complete/index.umd.js +5 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +77 -81
- package/avatar/index.umd.js +1 -1
- package/button/index.es.js +23 -15
- package/button/index.umd.js +1 -1
- package/button/style.css +1 -1
- package/card/index.es.js +3 -6
- package/card/index.umd.js +1 -1
- package/checkbox/index.es.js +5 -11
- package/checkbox/index.umd.js +1 -1
- package/comment/index.es.js +4 -6
- package/comment/index.umd.js +1 -1
- package/countdown/index.es.js +3 -6
- package/countdown/index.umd.js +1 -1
- package/editable-select/index.es.js +120 -167
- package/editable-select/index.umd.js +1 -1
- package/grid/index.es.js +30 -36
- package/grid/index.umd.js +1 -1
- package/image-preview/index.es.js +19 -19
- package/image-preview/index.umd.js +1 -1
- package/input/index.es.js +2 -5
- package/input/index.umd.js +1 -1
- package/layout/index.es.js +9 -22
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +40 -25
- package/loading/index.umd.js +1 -1
- package/modal/index.es.js +55 -47
- package/modal/index.umd.js +1 -1
- package/notification/index.es.js +100 -10
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/commentProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/readTipProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tagInputProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/overlay/index.es.js +5 -5
- package/overlay/index.umd.js +1 -1
- package/package.json +1 -1
- package/pagination/index.es.js +14 -13
- package/pagination/index.umd.js +1 -1
- package/popover/index.es.js +7 -7
- package/popover/index.umd.js +12 -12
- package/progress/index.es.js +34 -36
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +8 -2
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +4 -7
- package/rate/index.umd.js +1 -1
- package/read-tip/index.es.js +34 -34
- package/read-tip/index.umd.js +1 -1
- package/read-tip/style.css +1 -1
- package/result/index.es.js +2 -5
- package/result/index.umd.js +1 -1
- package/ripple/index.es.js +43 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +11 -11
- package/search/index.umd.js +8 -8
- package/skeleton/index.es.js +9 -12
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +59 -62
- package/slider/index.umd.js +1 -1
- package/splitter/index.es.js +176 -136
- package/splitter/index.umd.js +13 -13
- package/statistic/index.es.js +7 -18
- package/statistic/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +4 -7
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/tag/index.es.js +13 -17
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/tag-input/index.es.js +3 -6
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.es.js +2 -5
- package/textarea/index.umd.js +1 -1
- package/timeline/index.es.js +10 -16
- package/timeline/index.umd.js +1 -1
- package/upload/index.es.js +160 -67
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +12182 -24718
- package/vue-devui.umd.js +24 -20
- package/accordion/index.d.ts +0 -7
- package/accordion/index.es.js +0 -723
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.d.ts +0 -7
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/package.json +0 -7
- package/anchor/style.css +0 -1
- package/back-top/index.d.ts +0 -7
- package/back-top/index.es.js +0 -130
- package/back-top/index.umd.js +0 -1
- package/back-top/package.json +0 -7
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -128
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/package.json +0 -7
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -314
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5971
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.es.js +0 -8196
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/date-picker/index.d.ts +0 -7
- package/date-picker/index.es.js +0 -1154
- package/date-picker/index.umd.js +0 -1
- package/date-picker/package.json +0 -7
- package/date-picker/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/drawer/index.d.ts +0 -7
- package/drawer/index.es.js +0 -234
- package/drawer/index.umd.js +0 -1
- package/drawer/package.json +0 -7
- package/drawer/style.css +0 -1
- package/dropdown/index.d.ts +0 -7
- package/dropdown/index.es.js +0 -693
- package/dropdown/index.umd.js +0 -1
- package/dropdown/package.json +0 -7
- package/dropdown/style.css +0 -1
- package/form/index.d.ts +0 -7
- package/form/index.es.js +0 -7876
- package/form/index.umd.js +0 -27
- package/form/package.json +0 -7
- package/form/style.css +0 -1
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -332
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/input-number/index.d.ts +0 -7
- package/input-number/index.es.js +0 -229
- package/input-number/index.umd.js +0 -1
- package/input-number/package.json +0 -7
- package/input-number/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Column.js +0 -3
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/Drawer.js +0 -3
- package/nuxt/components/DrawerService.js +0 -3
- package/nuxt/components/Dropdown.js +0 -3
- package/nuxt/components/DropdownMenu.js +0 -3
- package/nuxt/components/Form.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormItem.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/FormOperation.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/InputNumber.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/Select.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/Table.js +0 -3
- package/nuxt/components/Tabs.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Tooltip.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/Tree.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/dropdownMenuProps.js +0 -3
- package/nuxt/components/tooltipProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/select/index.d.ts +0 -7
- package/select/index.es.js +0 -706
- package/select/index.umd.js +0 -1
- package/select/package.json +0 -7
- package/select/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -242
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/table/index.d.ts +0 -7
- package/table/index.es.js +0 -2024
- package/table/index.umd.js +0 -1
- package/table/package.json +0 -7
- package/table/style.css +0 -1
- package/tabs/index.d.ts +0 -7
- package/tabs/index.es.js +0 -194
- package/tabs/index.umd.js +0 -1
- package/tabs/package.json +0 -7
- package/tabs/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1238
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/tooltip/index.d.ts +0 -7
- package/tooltip/index.es.js +0 -5835
- package/tooltip/index.umd.js +0 -27
- package/tooltip/package.json +0 -7
- package/tooltip/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7615
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree/index.d.ts +0 -7
- package/tree/index.es.js +0 -6495
- package/tree/index.umd.js +0 -27
- package/tree/package.json +0 -7
- package/tree/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -627
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
package/checkbox/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var q=Object.defineProperty,
|
|
1
|
+
var q=Object.defineProperty,K=Object.defineProperties;var M=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var F=(o,t,u)=>t in o?q(o,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):o[t]=u,S=(o,t)=>{for(var u in t||(t={}))_.call(t,u)&&F(o,u,t[u]);if(x)for(var u of x(t))z.call(t,u)&&F(o,u,t[u]);return o},C=(o,t)=>K(o,M(t));(function(o,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(o=typeof globalThis!="undefined"?globalThis:o||self,t(o.index={},o.Vue))})(this,function(o,t){"use strict";var u="";const P={name:{type:String,default:void 0},halfchecked:{type:Boolean,default:!1},isShowTitle:{type:Boolean,default:!0},title:{type:String},color:{type:String,default:void 0},showAnimation:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},beforeChange:{type:Function,default:void 0}},T=C(S({},P),{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}}),j=C(S({},P),{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}}),N=Symbol("d-checkbox-group");var k=t.defineComponent({name:"DCheckbox",props:T,emits:["change","update:checked","update:modelValue"],setup(n,a){const e=t.inject(N,null),c=t.computed(()=>n.checked||n.modelValue),m=t.computed(()=>(e==null?void 0:e.disabled.value)||n.disabled),h=t.computed(()=>{var i,g;return(g=(i=e==null?void 0:e.isItemChecked)==null?void 0:i.call(e,n.value))!=null?g:c.value}),l=t.computed(()=>{var i;return(i=e==null?void 0:e.isShowTitle.value)!=null?i:n.isShowTitle}),d=t.computed(()=>{var i;return(i=e==null?void 0:e.showAnimation.value)!=null?i:n.showAnimation}),r=t.computed(()=>{var i;return(i=e==null?void 0:e.color.value)!=null?i:n.color}),b=e==null?void 0:e.itemWidth.value,f=e==null?void 0:e.direction.value,y=(i,g)=>{var V;if(m.value)return Promise.resolve(!1);const w=(V=n.beforeChange)!=null?V:e==null?void 0:e.beforeChange;if(w){const v=w(i,g);return typeof v=="boolean"?Promise.resolve(v):v}return Promise.resolve(!0)},s=()=>{const i=!c.value;e==null||e.toggleGroupVal(n.value),a.emit("update:checked",i),a.emit("update:modelValue",i),a.emit("change",i)};return{itemWidth:b,direction:f,mergedColor:r,mergedDisabled:m,mergedIsShowTitle:l,mergedChecked:h,mergedShowAnimation:d,handleClick:()=>{y(!c.value,n.label).then(i=>i&&s())}}},render(){var B;const{itemWidth:n,direction:a,mergedChecked:e,mergedDisabled:c,mergedIsShowTitle:m,mergedShowAnimation:h,halfchecked:l,title:d,label:r,handleClick:b,name:f,value:y,mergedColor:s,$slots:p}=this,i={"devui-checkbox-column-margin":a==="column","devui-checkbox-wrap":typeof n!="undefined"},g=n?[`width: ${n}px`]:[],w={"devui-checkbox":!0,active:e,halfchecked:l,disabled:c,unchecked:!e},V=m?d||r:"",v=s&&l||s?`linear-gradient(${s}, ${s})`:"",R=[`border-color:${(e||l)&&s?s:""}`,`background-image:${v}`,`background-color:${s&&l?s:""}`],W={"devui-checkbox-material":!0,"custom-color":s,"devui-checkbox-no-label":!r&&!p.default,"devui-no-animation":!h,"devui-checkbox-default-background":!l},D={"devui-tick":!0,"devui-no-animation":!h},I=U=>U.stopPropagation(),$={indeterminate:l};return t.createVNode("div",{class:i,style:g},[t.createVNode("div",{class:w},[t.createVNode("label",{title:V,onClick:b},[t.createVNode("input",t.mergeProps({name:f||y,class:"devui-checkbox-input",type:"checkbox"},$,{checked:e,disabled:c,onClick:I,onChange:I}),null),t.createVNode("span",{style:R,class:W},[t.createVNode("span",{class:"devui-checkbox-halfchecked-bg"},null),t.createVNode("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",class:"devui-checkbox-tick"},[t.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[t.createVNode("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:D},null)])])]),r||((B=p.default)==null?void 0:B.call(p))])])])}}),E="",A=t.defineComponent({name:"DCheckboxGroup",props:j,emits:["change","update:modelValue"],setup(n,a){const e=t.toRef(n,"modelValue"),c={checked:!1,isShowTitle:!0,halfchecked:!1,showAnimation:!0,disabled:!1},m=l=>{let d=-1;if(typeof e.value[0]=="string"?d=e.value.findIndex(r=>r===l):typeof e.value[0]=="object"&&(d=e.value.findIndex(r=>r.value===l)),d===-1){if(typeof n.options[0]=="object"){const b=n.options.find(y=>y.value===l),f=[...e.value,b];a.emit("update:modelValue",f),a.emit("change",f);return}const r=[...e.value,l];a.emit("update:modelValue",r),a.emit("change",r);return}e.value.splice(d,1),a.emit("update:modelValue",e.value),a.emit("change",e.value)},h=l=>{if(typeof e.value[0]=="string")return e.value.includes(l);if(typeof e.value[0]=="object")return e.value.some(d=>d.value===l)};return t.provide(N,{disabled:t.toRef(n,"disabled"),isShowTitle:t.toRef(n,"isShowTitle"),color:t.toRef(n,"color"),showAnimation:t.toRef(n,"showAnimation"),beforeChange:n.beforeChange,isItemChecked:h,toggleGroupVal:m,itemWidth:t.toRef(n,"itemWidth"),direction:t.toRef(n,"direction")}),{defaultOpt:c}},render(){var h;const{direction:n,$slots:a,defaultOpt:e,options:c}=this;let m=(h=a.default)==null?void 0:h.call(a);return(c==null?void 0:c.length)>0&&(m=c.map(l=>{let d=null;return typeof l=="string"?d=Object.assign({},e,{label:l,value:l}):typeof l=="object"&&(d=Object.assign({},e,C(S({},l),{label:l.name}))),t.createVNode(k,d,null)})),t.createVNode("div",{class:"devui-checkbox-group"},[t.createVNode("div",{class:{"devui-checkbox-list-inline":n==="row"}},[m])])}}),O={title:"Checkbox \u590D\u9009\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(n){n.component(k.name,k),n.component(A.name,A)}};o.Checkbox=k,o.checkboxGroupInjectionKey=N,o.checkboxGroupProps=j,o.checkboxProps=T,o.default=O,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"});
|
package/comment/index.es.js
CHANGED
|
@@ -53,9 +53,10 @@ var Comment = defineComponent({
|
|
|
53
53
|
"src": avatar,
|
|
54
54
|
"alt": "comment-avatar"
|
|
55
55
|
}, null) : avatar]);
|
|
56
|
+
const actionsList = Array.isArray(actions) ? actions : [actions];
|
|
56
57
|
const actionDom = actions ? createVNode("ul", {
|
|
57
58
|
"class": `devui-comment-actions`
|
|
58
|
-
}, [getAction(
|
|
59
|
+
}, [getAction(actionsList)]) : null;
|
|
59
60
|
return createVNode("div", {
|
|
60
61
|
"class": "devui-comment"
|
|
61
62
|
}, [avatarDom, createVNode("div", {
|
|
@@ -72,15 +73,12 @@ var Comment = defineComponent({
|
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
|
-
Comment.install = function(app) {
|
|
76
|
-
app.component(Comment.name, Comment);
|
|
77
|
-
};
|
|
78
76
|
var index = {
|
|
79
77
|
title: "Comment \u8BC4\u8BBA",
|
|
80
78
|
category: "\u6570\u636E\u5C55\u793A",
|
|
81
79
|
status: "100%",
|
|
82
80
|
install(app) {
|
|
83
|
-
app.
|
|
81
|
+
app.component(Comment.name, Comment);
|
|
84
82
|
}
|
|
85
83
|
};
|
|
86
|
-
export { Comment, index as default };
|
|
84
|
+
export { Comment, commentProps, index as default };
|
package/comment/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.index={},n.Vue))})(this,function(n,e){"use strict";const
|
|
1
|
+
(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.index={},n.Vue))})(this,function(n,e){"use strict";const m={actions:{type:Object,default:null},author:{type:Object,default:null},avatar:{type:Object,default:null},content:{type:Object,default:null},datetime:{type:Object,default:null}};var P="",i=e.defineComponent({name:"DComment",props:m,emits:[],slots:["actions","author","avatar","content","datetime"],setup(a,{slots:t}){return()=>{var u,r,f,v,l,y,h,V,p,N;const j=d=>!d||!d.length?null:d.map((L,b)=>e.createVNode("li",{key:`devui-comment-action-${b}`,class:`devui-comment-action-${b}`},[L])),c=(r=a.actions)!=null?r:(u=t.actions)==null?void 0:u.call(t),C=(v=a.author)!=null?v:(f=t.author)==null?void 0:f.call(t),o=(y=a.avatar)!=null?y:(l=t.avatar)==null?void 0:l.call(t),O=(V=a.content)!=null?V:(h=t.content)==null?void 0:h.call(t),A=(N=a.datetime)!=null?N:(p=t.datetime)==null?void 0:p.call(t),s=e.createVNode("div",{class:"devui-comment-avatar"},[typeof o=="string"?e.createVNode("img",{src:o,alt:"comment-avatar"},null):o]),B=Array.isArray(c)?c:[c],D=c?e.createVNode("ul",{class:"devui-comment-actions"},[j(B)]):null;return e.createVNode("div",{class:"devui-comment"},[s,e.createVNode("div",{class:"devui-comment-right"},[e.createVNode("div",{class:"devui-comment-head"},[e.createVNode("div",{class:"devui-comment-author"},[C]),e.createVNode("div",{class:"devui-comment-datetime"},[A])]),e.createVNode("div",{class:"devui-comment-content"},[O]),D])])}}}),g={title:"Comment \u8BC4\u8BBA",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(a){a.component(i.name,i)}};n.Comment=i,n.commentProps=m,n.default=g,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"});
|
package/countdown/index.es.js
CHANGED
|
@@ -23,7 +23,6 @@ const countdownProps = {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
var countdown = "";
|
|
27
26
|
const getFormatTime = (leftTime) => {
|
|
28
27
|
const timeformat = /* @__PURE__ */ new Map([["Y", 0], ["M", 0], ["D", 0], ["H", 0], ["m", 0], ["s", 0], ["S", 0]]);
|
|
29
28
|
const year = Math.floor(leftTime / (365 * 24 * 60 * 60 * 1e3));
|
|
@@ -96,6 +95,7 @@ const numFormat = (n, len) => {
|
|
|
96
95
|
return str + n;
|
|
97
96
|
}
|
|
98
97
|
};
|
|
98
|
+
var countdown = "";
|
|
99
99
|
var Countdown = defineComponent({
|
|
100
100
|
name: "DCountdown",
|
|
101
101
|
props: countdownProps,
|
|
@@ -163,15 +163,12 @@ var Countdown = defineComponent({
|
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
|
-
Countdown.install = function(app) {
|
|
167
|
-
app.component(Countdown.name, Countdown);
|
|
168
|
-
};
|
|
169
166
|
var index = {
|
|
170
167
|
title: "Countdown \u5012\u8BA1\u65F6",
|
|
171
168
|
category: "\u6570\u636E\u5C55\u793A",
|
|
172
169
|
status: "100%",
|
|
173
170
|
install(app) {
|
|
174
|
-
app.
|
|
171
|
+
app.component(Countdown.name, Countdown);
|
|
175
172
|
}
|
|
176
173
|
};
|
|
177
|
-
export { Countdown, index as default };
|
|
174
|
+
export { Countdown, countdownProps, index as default };
|
package/countdown/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(u=typeof globalThis!="undefined"?globalThis:u||self,a(u.index={},u.Vue))})(this,function(u,a){"use strict";const w={value:{type:Number,required:!0},format:{type:String,default:"HH:mm:ss"},prefix:{type:String,default:""},suffix:{type:String,default:""},valueStyle:{type:Object,default:()=>({})}},M=e=>{const t=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),n=Math.floor(e/(365*24*60*60*1e3)),s=Math.floor(e/(30*24*60*60*1e3)%12),o=Math.floor(e/(24*60*60*1e3)%30),r=Math.floor(e/(60*60*1e3)%24),h=Math.floor(e/(60*1e3)%60),d=Math.floor(e/1e3%60),S=e%1e3;return t.set("Y",n),t.set("M",s),t.set("D",o),t.set("H",r),t.set("m",h),t.set("s",d),t.set("S",S),t},p=(e,t)=>{const n=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),s=new Map([["Y",12],["M",30],["D",24],["H",60],["m",60],["s",1e3],["S",1]]);let o=0;for(const r of n.keys())e.has(r)?(n.set(r,t.get(r)+o),o=0):o+=t.get(r)*s.get(r);return!e.has("S")&&t.get("S")>500&&n.set("s",n.get("s")+1),n},y=e=>{const t=new Set(["Y","M","D","H","m","s","S"]),n=[];for(let s=0;s<e.length;s++){const o=e[s];n.length===0||n[n.length-1].k!==o||!t.has(o)?n.push({k:o,n:1}):n[n.length-1].n++}return n},v=e=>{const t=new Set(["Y","M","D","H","m","s","S"]),n=new Set;for(let s=0;s<e.length;s++){const o=e[s];t.has(o)&&n.add(o)}return n},D=(e,t)=>{const n=10**t-1;if(e>=n)return e;{const s=t-e.toString().length;let o="";for(let r=0;r<s;r++)o+="0";return o+e}};var T="",g=a.defineComponent({name:"DCountdown",props:w,emits:["onChange","onFinish"],setup(e,t){const n=a.ref(),s=v(e.format),o=y(e.format),r=a.ref(""),h=c=>{const l=new Set(["Y","M","D","H","m","s","S"]),f=o.reduce((i,m)=>l.has(m.k)?i+D(c.get(m.k),m.n):i+m.k,"");r.value=f},d=()=>{const c=new Date(e.value).getTime(),l=c>new Date().getTime()?c-new Date().getTime():0,f=M(l),i=p(s,f);return!t.slots.default&&h(i),t.emit("onChange",{leftTime:l,formatTime:f,legalTime:i}),l},S=()=>{d(),!n.value&&(n.value=setInterval(()=>{d()===0&&(t.emit("onFinish"),clearInterval(n.value))},s.has("S")?100:1e3))};return a.onMounted(()=>{S()}),a.onUnmounted(()=>{clearInterval(n.value)}),()=>a.createVNode("div",{class:"devui-countdown"},[t.slots.default?t.slots.default():a.createVNode("div",{class:"countdown-content",style:e.valueStyle},[a.createVNode("span",{class:"countdown-prefix"},[e.prefix]),a.createVNode("span",{class:"countdown-value"},[r.value]),a.createVNode("span",{class:"countdown-suffix"},[e.suffix])])])}}),H={title:"Countdown \u5012\u8BA1\u65F6",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(e){e.component(g.name,g)}};u.Countdown=g,u.countdownProps=w,u.default=H,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
|
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { computed, nextTick, defineComponent, ref, reactive, watch, withDirectives, createVNode, withModifiers, resolveComponent, resolveDirective, vShow, Transition } from "vue";
|
|
1
|
+
import { computed, ref, nextTick, defineComponent, watch, withDirectives, createVNode, withModifiers, resolveComponent, vShow, resolveDirective } from "vue";
|
|
18
2
|
const editableSelectProps = {
|
|
19
|
-
appendToBody: {
|
|
20
|
-
type: Boolean
|
|
21
|
-
},
|
|
22
3
|
options: {
|
|
23
4
|
type: Array,
|
|
24
5
|
default: () => []
|
|
@@ -48,9 +29,6 @@ const editableSelectProps = {
|
|
|
48
29
|
},
|
|
49
30
|
filterOption: {
|
|
50
31
|
type: [Function, Boolean]
|
|
51
|
-
},
|
|
52
|
-
loadMore: {
|
|
53
|
-
type: Function
|
|
54
32
|
}
|
|
55
33
|
};
|
|
56
34
|
const inBrowser = typeof window !== "undefined";
|
|
@@ -145,18 +123,21 @@ const useInput = (inputValue, ctx2) => {
|
|
|
145
123
|
handleInput
|
|
146
124
|
};
|
|
147
125
|
};
|
|
148
|
-
const useLazyLoad = (dropdownRef, inputValue, filterOtion,
|
|
126
|
+
const useLazyLoad = (dropdownRef, inputValue, filterOtion, ctx2) => {
|
|
149
127
|
const loadMore = () => {
|
|
128
|
+
const dropdownVal = dropdownRef.value;
|
|
150
129
|
if (filterOtion !== false) {
|
|
151
130
|
return;
|
|
152
131
|
}
|
|
153
|
-
if (
|
|
154
|
-
|
|
132
|
+
if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight) {
|
|
133
|
+
ctx2.emit("loadMore", inputValue.value);
|
|
155
134
|
}
|
|
156
135
|
};
|
|
157
136
|
return { loadMore };
|
|
158
137
|
};
|
|
159
|
-
const useKeyboardSelect = (dropdownRef,
|
|
138
|
+
const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, optionDisabledKey, filterOption, loading, handleClick, closeMenu, toggleMenu) => {
|
|
139
|
+
const hoverIndex = ref(0);
|
|
140
|
+
const selectedIndex = ref(0);
|
|
160
141
|
const updateHoveringIndex = (index2) => {
|
|
161
142
|
hoverIndex.value = index2;
|
|
162
143
|
};
|
|
@@ -175,66 +156,71 @@ const useKeyboardSelect = (dropdownRef, disabled, visible, hoverIndex, selectedI
|
|
|
175
156
|
}
|
|
176
157
|
});
|
|
177
158
|
};
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
|
|
159
|
+
const handleEscape = () => {
|
|
160
|
+
if (inputValue.value) {
|
|
161
|
+
inputValue.value = "";
|
|
162
|
+
} else {
|
|
163
|
+
closeMenu();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const handleEnter = () => {
|
|
167
|
+
const len = filteredOptions.value.length;
|
|
168
|
+
if (!visible.value) {
|
|
169
|
+
toggleMenu();
|
|
170
|
+
} else if (!len || len === 1) {
|
|
171
|
+
closeMenu();
|
|
172
|
+
} else if (len && len !== 1) {
|
|
173
|
+
handleClick(filteredOptions.value[hoverIndex.value]);
|
|
174
|
+
closeMenu();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const handleKeyboardNavigation = (direction) => {
|
|
178
|
+
const len = filteredOptions.value.length;
|
|
179
|
+
if (!len || len === 1) {
|
|
180
|
+
return;
|
|
181
181
|
}
|
|
182
182
|
if (!["ArrowDown", "ArrowUp"].includes(direction)) {
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
+
if (filterOption === false && loading.value) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
let newIndex = 0;
|
|
189
|
+
newIndex = hoverIndex.value;
|
|
185
190
|
if (direction === "ArrowUp") {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
updateHoveringIndex(newIndex);
|
|
190
|
-
return;
|
|
191
|
+
newIndex -= 1;
|
|
192
|
+
if (newIndex === -1) {
|
|
193
|
+
newIndex = len - 1;
|
|
191
194
|
}
|
|
192
|
-
newIndex = newIndex - 1;
|
|
193
195
|
} else if (direction === "ArrowDown") {
|
|
194
|
-
|
|
196
|
+
newIndex += 1;
|
|
197
|
+
if (newIndex === len) {
|
|
195
198
|
newIndex = 0;
|
|
196
|
-
scrollToItem(newIndex);
|
|
197
|
-
updateHoveringIndex(newIndex);
|
|
198
|
-
return;
|
|
199
199
|
}
|
|
200
|
-
newIndex = newIndex + 1;
|
|
201
200
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
hoverIndex.value = newIndex;
|
|
202
|
+
const option = filteredOptions.value[newIndex];
|
|
203
|
+
if (option[optionDisabledKey]) {
|
|
204
|
+
return handleKeyboardNavigation(direction);
|
|
205
205
|
}
|
|
206
|
-
scrollToItem(newIndex);
|
|
207
206
|
updateHoveringIndex(newIndex);
|
|
207
|
+
scrollToItem(newIndex);
|
|
208
208
|
};
|
|
209
209
|
const handleKeydown = (event) => {
|
|
210
210
|
const keyCode = event.key || event.code;
|
|
211
|
-
if (options.value.length === 0) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (!visible.value) {
|
|
215
|
-
return toggleMenu();
|
|
216
|
-
}
|
|
217
|
-
const onKeydownEnter = () => {
|
|
218
|
-
handleClick(options.value[hoverIndex.value]);
|
|
219
|
-
closeMenu();
|
|
220
|
-
};
|
|
221
|
-
const onKeydownEsc = () => {
|
|
222
|
-
closeMenu();
|
|
223
|
-
};
|
|
224
211
|
switch (keyCode) {
|
|
225
|
-
case "Enter":
|
|
226
|
-
onKeydownEnter();
|
|
227
|
-
break;
|
|
228
212
|
case "Escape":
|
|
229
|
-
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
handleEscape();
|
|
215
|
+
break;
|
|
216
|
+
case "Enter":
|
|
217
|
+
handleEnter();
|
|
230
218
|
break;
|
|
231
219
|
default:
|
|
232
|
-
|
|
220
|
+
handleKeyboardNavigation(keyCode);
|
|
233
221
|
}
|
|
234
222
|
};
|
|
235
|
-
return {
|
|
236
|
-
handleKeydown
|
|
237
|
-
};
|
|
223
|
+
return { handleKeydown, hoverIndex, selectedIndex };
|
|
238
224
|
};
|
|
239
225
|
var EditableSelect = defineComponent({
|
|
240
226
|
name: "DEditableSelect",
|
|
@@ -244,101 +230,19 @@ var EditableSelect = defineComponent({
|
|
|
244
230
|
props: editableSelectProps,
|
|
245
231
|
emits: ["update:modelValue", "search", "loadMore"],
|
|
246
232
|
setup(props, ctx2) {
|
|
247
|
-
const
|
|
248
|
-
const {
|
|
249
|
-
optionDisabledKey: disabledKey
|
|
250
|
-
} = props;
|
|
251
|
-
return className("devui-dropdown-item", {
|
|
252
|
-
disabled: disabledKey ? !!option[disabledKey] : false,
|
|
253
|
-
selected: index2 === selectIndex.value,
|
|
254
|
-
"devui-dropdown-bg": index2 === hoverIndex.value
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
const renderDropdown = () => {
|
|
258
|
-
if (props.appendToBody) {
|
|
259
|
-
return createVNode(resolveComponent("d-flexible-overlay"), {
|
|
260
|
-
"origin": origin,
|
|
261
|
-
"visible": visible.value,
|
|
262
|
-
"onUpdate:visible": ($event) => visible.value = $event,
|
|
263
|
-
"position": position,
|
|
264
|
-
"hasBackdrop": false
|
|
265
|
-
}, {
|
|
266
|
-
default: () => [createVNode("div", {
|
|
267
|
-
"class": "devui-editable-select-dropdown",
|
|
268
|
-
"style": {
|
|
269
|
-
width: props.width + "px"
|
|
270
|
-
}
|
|
271
|
-
}, [withDirectives(createVNode("div", {
|
|
272
|
-
"class": "devui-dropdown-menu"
|
|
273
|
-
}, [createVNode("ul", {
|
|
274
|
-
"ref": dopdownRef,
|
|
275
|
-
"class": "devui-list-unstyled scroll-height",
|
|
276
|
-
"style": {
|
|
277
|
-
maxHeight: props.maxHeight + "px"
|
|
278
|
-
},
|
|
279
|
-
"onScroll": loadMore
|
|
280
|
-
}, [filteredOptions.value.map((option, index2) => {
|
|
281
|
-
return createVNode("li", {
|
|
282
|
-
"class": getItemCls(option, index2),
|
|
283
|
-
"onClick": (e) => {
|
|
284
|
-
e.stopPropagation();
|
|
285
|
-
handleClick(option);
|
|
286
|
-
}
|
|
287
|
-
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
|
|
288
|
-
}), withDirectives(createVNode("li", {
|
|
289
|
-
"class": "devui-no-result-template"
|
|
290
|
-
}, [createVNode("div", {
|
|
291
|
-
"class": "devui-no-data-tip"
|
|
292
|
-
}, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
|
|
293
|
-
});
|
|
294
|
-
} else {
|
|
295
|
-
return createVNode(Transition, {
|
|
296
|
-
"name": "fade"
|
|
297
|
-
}, {
|
|
298
|
-
default: () => [withDirectives(createVNode("div", {
|
|
299
|
-
"class": "devui-dropdown-menu"
|
|
300
|
-
}, [createVNode("ul", {
|
|
301
|
-
"ref": dopdownRef,
|
|
302
|
-
"class": "devui-list-unstyled scroll-height",
|
|
303
|
-
"style": {
|
|
304
|
-
maxHeight: props.maxHeight + "px"
|
|
305
|
-
},
|
|
306
|
-
"onScroll": loadMore
|
|
307
|
-
}, [filteredOptions.value.map((option, index2) => {
|
|
308
|
-
return createVNode("li", {
|
|
309
|
-
"class": getItemCls(option, index2),
|
|
310
|
-
"onClick": (e) => {
|
|
311
|
-
e.stopPropagation();
|
|
312
|
-
handleClick(option);
|
|
313
|
-
}
|
|
314
|
-
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
|
|
315
|
-
}), withDirectives(createVNode("li", {
|
|
316
|
-
"class": "devui-no-result-template"
|
|
317
|
-
}, [createVNode("div", {
|
|
318
|
-
"class": "devui-no-data-tip"
|
|
319
|
-
}, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[vShow, visible.value]])]
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
const dopdownRef = ref();
|
|
233
|
+
const dropdownRef = ref();
|
|
324
234
|
const origin = ref();
|
|
325
|
-
const position =
|
|
326
|
-
originX: "left",
|
|
327
|
-
originY: "bottom",
|
|
328
|
-
overlayX: "left",
|
|
329
|
-
overlayY: "top"
|
|
330
|
-
});
|
|
235
|
+
const position = ref(["bottom", "left"]);
|
|
331
236
|
const visible = ref(false);
|
|
332
|
-
const inputValue = ref(props.modelValue);
|
|
333
|
-
const
|
|
334
|
-
const selectIndex = ref(0);
|
|
237
|
+
const inputValue = ref(props.modelValue || "");
|
|
238
|
+
const loading = ref(props.loading);
|
|
335
239
|
const normalizeOptions = computed(() => {
|
|
336
240
|
return props.options.map((option) => {
|
|
337
241
|
if (typeof option === "object") {
|
|
338
|
-
return
|
|
242
|
+
return Object.assign({}, option, {
|
|
339
243
|
label: option.label ? option.label : option.value,
|
|
340
244
|
value: option.value
|
|
341
|
-
}
|
|
245
|
+
});
|
|
342
246
|
}
|
|
343
247
|
return {
|
|
344
248
|
label: option + "",
|
|
@@ -348,13 +252,16 @@ var EditableSelect = defineComponent({
|
|
|
348
252
|
});
|
|
349
253
|
const filteredOptions = userFilterOptions(normalizeOptions, inputValue, props.filterOption);
|
|
350
254
|
const emptyText = computed(() => {
|
|
351
|
-
let text;
|
|
255
|
+
let text = "";
|
|
352
256
|
if (props.filterOption !== false && !filteredOptions.value.length) {
|
|
353
257
|
text = "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55";
|
|
354
258
|
} else if (props.filterOption === false && !filteredOptions.value.length) {
|
|
355
259
|
text = "\u6CA1\u6709\u6570\u636E";
|
|
356
260
|
}
|
|
357
|
-
return
|
|
261
|
+
return text;
|
|
262
|
+
});
|
|
263
|
+
watch(() => props.loading, (newVal) => {
|
|
264
|
+
loading.value = newVal;
|
|
358
265
|
});
|
|
359
266
|
const toggleMenu = () => {
|
|
360
267
|
visible.value = !visible.value;
|
|
@@ -364,7 +271,7 @@ var EditableSelect = defineComponent({
|
|
|
364
271
|
};
|
|
365
272
|
const {
|
|
366
273
|
loadMore
|
|
367
|
-
} = useLazyLoad(
|
|
274
|
+
} = useLazyLoad(dropdownRef, inputValue, props.filterOption, ctx2);
|
|
368
275
|
const {
|
|
369
276
|
handleInput
|
|
370
277
|
} = useInput(inputValue, ctx2);
|
|
@@ -372,17 +279,32 @@ var EditableSelect = defineComponent({
|
|
|
372
279
|
const {
|
|
373
280
|
optionDisabledKey: disabledKey
|
|
374
281
|
} = props;
|
|
375
|
-
if (disabledKey && !!option[disabledKey])
|
|
282
|
+
if (disabledKey && !!option[disabledKey]) {
|
|
376
283
|
return;
|
|
284
|
+
}
|
|
377
285
|
ctx2.emit("update:modelValue", option.label);
|
|
378
286
|
closeMenu();
|
|
379
287
|
};
|
|
380
288
|
const {
|
|
381
|
-
handleKeydown
|
|
382
|
-
|
|
289
|
+
handleKeydown,
|
|
290
|
+
hoverIndex,
|
|
291
|
+
selectedIndex
|
|
292
|
+
} = useKeyboardSelect(dropdownRef, visible, inputValue, filteredOptions, props.optionDisabledKey, props.filterOption, loading, handleClick, closeMenu, toggleMenu);
|
|
383
293
|
watch(() => props.modelValue, (newVal) => {
|
|
384
|
-
|
|
294
|
+
if (newVal) {
|
|
295
|
+
inputValue.value = newVal;
|
|
296
|
+
}
|
|
385
297
|
});
|
|
298
|
+
const getItemCls = (option, index2) => {
|
|
299
|
+
const {
|
|
300
|
+
optionDisabledKey: disabledKey
|
|
301
|
+
} = props;
|
|
302
|
+
return className("devui-dropdown-item", {
|
|
303
|
+
disabled: disabledKey ? !!option[disabledKey] : false,
|
|
304
|
+
selected: index2 === selectedIndex.value,
|
|
305
|
+
"devui-dropdown-bg": index2 === hoverIndex.value
|
|
306
|
+
});
|
|
307
|
+
};
|
|
386
308
|
return () => {
|
|
387
309
|
const selectCls = className("devui-editable-select devui-form-group devui-has-feedback", {
|
|
388
310
|
"devui-select-open": visible.value === true
|
|
@@ -408,19 +330,50 @@ var EditableSelect = defineComponent({
|
|
|
408
330
|
"class": "devui-select-chevron-icon"
|
|
409
331
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
410
332
|
"name": "select-arrow"
|
|
411
|
-
}, null)])]),
|
|
333
|
+
}, null)])]), createVNode(resolveComponent("d-flexible-overlay"), {
|
|
334
|
+
"origin": origin.value,
|
|
335
|
+
"modelValue": visible.value,
|
|
336
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
337
|
+
"position": position.value,
|
|
338
|
+
"hasBackdrop": false
|
|
339
|
+
}, {
|
|
340
|
+
default: () => [createVNode("div", {
|
|
341
|
+
"class": "devui-editable-select-dropdown",
|
|
342
|
+
"style": {
|
|
343
|
+
width: props.width + "px"
|
|
344
|
+
}
|
|
345
|
+
}, [withDirectives(createVNode("div", {
|
|
346
|
+
"class": "devui-dropdown-menu"
|
|
347
|
+
}, [createVNode("ul", {
|
|
348
|
+
"ref": dropdownRef,
|
|
349
|
+
"class": "devui-list-unstyled scroll-height",
|
|
350
|
+
"style": {
|
|
351
|
+
maxHeight: props.maxHeight + "px"
|
|
352
|
+
},
|
|
353
|
+
"onScroll": loadMore
|
|
354
|
+
}, [filteredOptions.value.map((option, index2) => {
|
|
355
|
+
return createVNode("li", {
|
|
356
|
+
"class": getItemCls(option, index2),
|
|
357
|
+
"onClick": (e) => {
|
|
358
|
+
e.stopPropagation();
|
|
359
|
+
handleClick(option);
|
|
360
|
+
}
|
|
361
|
+
}, [ctx2.slots.item ? ctx2.slots.item(option) : option.label]);
|
|
362
|
+
}), withDirectives(createVNode("li", {
|
|
363
|
+
"class": "devui-no-result-template"
|
|
364
|
+
}, [createVNode("div", {
|
|
365
|
+
"class": "devui-no-data-tip"
|
|
366
|
+
}, [ctx2.slots.noResultItem ? ctx2.slots.noResultItem() : emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
|
|
367
|
+
})]), [[resolveDirective("click-outside"), closeMenu]]);
|
|
412
368
|
};
|
|
413
369
|
}
|
|
414
370
|
});
|
|
415
|
-
EditableSelect.install = function(app) {
|
|
416
|
-
app.component(EditableSelect.name, EditableSelect);
|
|
417
|
-
};
|
|
418
371
|
var index = {
|
|
419
372
|
title: "EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",
|
|
420
373
|
category: "\u6570\u636E\u5F55\u5165",
|
|
421
374
|
status: "100%",
|
|
422
375
|
install(app) {
|
|
423
|
-
app.
|
|
376
|
+
app.component(EditableSelect.name, EditableSelect);
|
|
424
377
|
}
|
|
425
378
|
};
|
|
426
|
-
export { EditableSelect, index as default };
|
|
379
|
+
export { EditableSelect, index as default, editableSelectProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(u,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(u=typeof globalThis!="undefined"?globalThis:u||self,t(u.index={},u.Vue))})(this,function(u,t){"use strict";const N={options:{type:Array,default:()=>[]},disabled:{type:Boolean},loading:{type:Boolean},optionDisabledKey:{type:String,default:""},placeholder:{type:String,default:"Search"},modelValue:{type:String},width:{type:Number},maxHeight:{type:Number},filterOption:{type:[Function,Boolean]}},B=typeof window!="undefined";function x(e,l,o){document.addEventListener?e&&l&&o&&e.addEventListener(l,o,!1):e&&l&&o&&e.attachEvent("on"+l,o)}const f=Symbol("@@clickoutside"),S=new Map;let F,E=0,K=!0;function H(e,l,o){return B&&K&&(K=!1,x(document,"mousedown",a=>{F=a}),x(document,"mouseup",a=>{for(const[c,i]of S)i[f].documentHandler(a,F)})),function(a,c){!o||!l.instance||!a.target||!c.target||e.contains(a.target)||e.contains(c.target)||e===a.target||e[f].bindingFn&&e[f].bindingFn()}}const O={beforeMount:function(e,l,o){E++,S.set(E,e),e[f]={nid:E,documentHandler:H(e,l,o),bindingFn:l.value}},updated:function(e,l,o){e[f].documentHandler=H(e,l,o),e[f].bindingFn=l.value},unmounted:function(e){S.delete(e[f].nid),delete e[f]}};function L(e,l){let o=e;return typeof l=="object"&&Object.keys(l).forEach(a=>{l[a]&&(o+=` ${a}`)}),o}var q="";const T=()=>(e,l)=>l.label.toLocaleLowerCase().indexOf(e.toLocaleLowerCase())>-1,j=(e,l,o)=>t.computed(()=>{const a=[];if(!l.value||o===!1)return e.value;const c=typeof o=="function"?o:T();return e.value.forEach(i=>{c(l.value,i)&&a.push(i)}),a}),A=(e,l)=>{const o=c=>{l.emit("search",c)};return{handleInput:c=>{const i=c.target.value;e.value=i,o(i)}}},R=(e,l,o,a)=>({loadMore:()=>{const i=e.value;o===!1&&i.clientHeight+i.scrollTop>=i.scrollHeight&&a.emit("loadMore",l.value)}}),P=(e,l,o,a,c,i,v,y,g,h)=>{const m=t.ref(0),p=t.ref(0),w=d=>{m.value=d},C=d=>{const r=e.value,n=r.children[d];t.nextTick(()=>{if(n.scrollIntoViewIfNeeded)n.scrollIntoViewIfNeeded(!1);else{const s=r.getBoundingClientRect(),b=n.getBoundingClientRect();(b.bottom>s.bottom||b.top<s.top)&&n.scrollIntoView(!1)}})},D=()=>{o.value?o.value="":g()},I=()=>{const d=a.value.length;l.value?!d||d===1?g():d&&d!==1&&(y(a.value[m.value]),g()):h()},V=d=>{const r=a.value.length;if(!r||r===1||!["ArrowDown","ArrowUp"].includes(d)||i===!1&&v.value)return;let n=0;if(n=m.value,d==="ArrowUp"?(n-=1,n===-1&&(n=r-1)):d==="ArrowDown"&&(n+=1,n===r&&(n=0)),m.value=n,a.value[n][c])return V(d);w(n),C(n)};return{handleKeydown:d=>{const r=d.key||d.code;switch(r){case"Escape":d.preventDefault(),D();break;case"Enter":I();break;default:V(r)}},hoverIndex:m,selectedIndex:p}};var k=t.defineComponent({name:"DEditableSelect",directives:{clickOutside:O},props:N,emits:["update:modelValue","search","loadMore"],setup(e,l){const o=t.ref(),a=t.ref(),c=t.ref(["bottom","left"]),i=t.ref(!1),v=t.ref(e.modelValue||""),y=t.ref(e.loading),g=t.computed(()=>e.options.map(n=>typeof n=="object"?Object.assign({},n,{label:n.label?n.label:n.value,value:n.value}):{label:n+"",value:n})),h=j(g,v,e.filterOption),m=t.computed(()=>{let n="";return e.filterOption!==!1&&!h.value.length?n="\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55":e.filterOption===!1&&!h.value.length&&(n="\u6CA1\u6709\u6570\u636E"),n});t.watch(()=>e.loading,n=>{y.value=n});const p=()=>{i.value=!i.value},w=()=>{i.value=!1},{loadMore:C}=R(o,v,e.filterOption,l),{handleInput:D}=A(v,l),I=n=>{const{optionDisabledKey:s}=e;s&&!!n[s]||(l.emit("update:modelValue",n.label),w())},{handleKeydown:V,hoverIndex:M,selectedIndex:d}=P(o,i,v,h,e.optionDisabledKey,e.filterOption,y,I,w,p);t.watch(()=>e.modelValue,n=>{n&&(v.value=n)});const r=(n,s)=>{const{optionDisabledKey:b}=e;return L("devui-dropdown-item",{disabled:b?!!n[b]:!1,selected:s===d.value,"devui-dropdown-bg":s===M.value})};return()=>{const n=L("devui-editable-select devui-form-group devui-has-feedback",{"devui-select-open":i.value===!0});return t.withDirectives(t.createVNode("div",{class:n,ref:a,style:{width:e.width+"px"}},[t.createVNode("input",{class:"devui-form-control devui-dropdown-origin devui-dropdown-origin-open",onClick:t.withModifiers(p,["self"]),onInput:D,onKeydown:V,value:v.value,disabled:e.disabled,placeholder:e.placeholder,type:"text"},null),t.createVNode("span",{class:"devui-form-control-feedback"},[t.createVNode("span",{class:"devui-select-chevron-icon"},[t.createVNode(t.resolveComponent("d-icon"),{name:"select-arrow"},null)])]),t.createVNode(t.resolveComponent("d-flexible-overlay"),{origin:a.value,modelValue:i.value,"onUpdate:modelValue":s=>i.value=s,position:c.value,hasBackdrop:!1},{default:()=>[t.createVNode("div",{class:"devui-editable-select-dropdown",style:{width:e.width+"px"}},[t.withDirectives(t.createVNode("div",{class:"devui-dropdown-menu"},[t.createVNode("ul",{ref:o,class:"devui-list-unstyled scroll-height",style:{maxHeight:e.maxHeight+"px"},onScroll:C},[h.value.map((s,b)=>t.createVNode("li",{class:r(s,b),onClick:_=>{_.stopPropagation(),I(s)}},[l.slots.item?l.slots.item(s):s.label])),t.withDirectives(t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[l.slots.noResultItem?l.slots.noResultItem():m.value])]),[[t.vShow,!h.value.length]])])]),[[t.resolveDirective("dLoading"),e.loading],[t.vShow,i.value]])])]})]),[[t.resolveDirective("click-outside"),w]])}}}),U={title:"EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(k.name,k)}};u.EditableSelect=k,u.default=U,u.editableSelectProps=N,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
|