vue-devui 1.0.0-alpha.5 → 1.0.0-beta.11
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 +31 -36
- package/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +508 -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/button/index.d.ts +7 -0
- package/button/index.es.js +392 -1
- package/button/index.umd.js +1 -1
- package/button/style.css +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 +287 -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 +5857 -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/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 +1225 -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/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 -34
- 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/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 +1828 -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 +1255 -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 +2834 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27743 -1
- package/vue-devui.umd.js +29 -1
package/select/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__spreadValues=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__require="undefined"!=typeof require?require:e=>{throw new Error('Dynamic require of "'+e+'" is not supported')};!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).index={},e.Vue)}(this,(function(e,t){"use strict";const o={modelValue:{type:[String,Number,Array],default:""},"onUpdate:modelValue":{type:Function,default:void 0},options:{type:Array,default:()=>[]},size:{type:String,default:"md"},overview:{type:String,default:"border"},placeholder:{type:String,default:"请选择"},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowClear:{type:Boolean,default:!1},optionDisabledKey:{type:String,default:""},onToggleChange:{type:Function,default:void 0},onValueChange:{type:Function,default:void 0}};var l=t.defineComponent({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=>__spreadValues({},e),render(){const{name:e,size:o,color:l,classPrefix:n}=this;return t.createVNode("i",{class:`${n} ${n}-${e}`,style:{fontSize:o,color:l}},null)}});l.install=function(e){e.component(l.name,l)};const n={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}},a=__spreadProps(__spreadValues({},n),{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}}),d=__spreadProps(__spreadValues({},n),{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}}),i=Symbol("d-checkbox-group");var r=t.defineComponent({name:"DCheckbox",props:a,emits:["change","update:checked","update:modelValue"],setup(e,o){const l=t.inject(i,null),n=t.computed((()=>e.checked||e.modelValue)),a=t.computed((()=>(null==l?void 0:l.disabled.value)||e.disabled)),d=t.computed((()=>{var t,o;return null!=(o=null==(t=null==l?void 0:l.isItemChecked)?void 0:t.call(l,e.value))?o:n.value})),r=t.computed((()=>{var t;return null!=(t=null==l?void 0:l.isShowTitle)?t:e.isShowTitle})),u=t.computed((()=>{var t;return null!=(t=null==l?void 0:l.showAnimation)?t:e.showAnimation})),c=t.computed((()=>{var t;return null!=(t=null==l?void 0:l.color)?t:e.color})),s=null==l?void 0:l.itemWidth.value,p=null==l?void 0:l.direction.value;return{itemWidth:s,direction:p,mergedColor:c,mergedDisabled:a,mergedIsShowTitle:r,mergedChecked:d,mergedShowAnimation:u,handleClick:()=>{((t,o)=>{var n;if(a.value)return Promise.resolve(!1);const d=null!=(n=e.beforeChange)?n:null==l?void 0:l.beforeChange;if(d){const e=d(t,o);return"boolean"==typeof e?Promise.resolve(e):e}return Promise.resolve(!0)})(!n.value,e.value).then((t=>t&&(()=>{const t=!n.value;null==l||l.toggleGroupVal(e.value),o.emit("update:checked",t),o.emit("update:modelValue",t),o.emit("change",t)})()))}}},render(){var e;const{itemWidth:o,direction:l,mergedChecked:n,mergedDisabled:a,mergedIsShowTitle:d,mergedShowAnimation:i,halfchecked:r,title:u,label:c,handleClick:s,name:p,value:m,mergedColor:v,$slots:f}=this,h={"devui-checkbox-column-margin":"column"===l,"devui-checkbox-wrap":void 0!==o},g=o?[`width: ${o}px`]:[],y={"devui-checkbox":!0,active:n,halfchecked:r,disabled:a,unchecked:!n},b=d?u||c:"",V=[`border-color:${(n||r)&&v?v:""}`,`background-image:${v&&r||v?`linear-gradient(${v}, ${v})`:""}`,`background-color:${v&&r?v:""}`],_={"devui-checkbox-material":!0,"custom-color":v,"devui-checkbox-no-label":!c&&!f.default,"devui-no-animation":!i,"devui-checkbox-default-background":!r},k={"devui-tick":!0,"devui-no-animation":!i},w=e=>e.stopPropagation(),C={indeterminate:r};return t.createVNode("div",{class:h,style:g},[t.createVNode("div",{class:y},[t.createVNode("label",{title:b,onClick:s},[t.createVNode("input",t.mergeProps({name:p||m,class:"devui-checkbox-input",type:"checkbox"},C,{checked:n,disabled:a,onClick:w,onChange:w}),null),t.createVNode("span",{style:V,class:_},[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:k},null)])])]),c||(null==(e=f.default)?void 0:e.call(f))])])])}}),u=t.defineComponent({name:"DCheckboxGroup",props:d,emits:["change","update:modelValue"],setup(e,o){const l=t.toRef(e,"modelValue");return t.provide(i,{disabled:t.toRef(e,"disabled"),isShowTitle:t.toRef(e,"isShowTitle"),color:t.toRef(e,"color"),showAnimation:t.toRef(e,"showAnimation"),beforeChange:e.beforeChange,isItemChecked:e=>l.value.includes(e),toggleGroupVal:e=>{const t=l.value.findIndex((t=>t===e));if(-1===t){const t=[...l.value,e];return o.emit("update:modelValue",t),void o.emit("change",t)}l.value.splice(t,1),o.emit("update:modelValue",l.value),o.emit("change",l.value)},itemWidth:t.toRef(e,"itemWidth"),direction:t.toRef(e,"direction")}),{defaultOpt:{checked:!1,isShowTitle:!0,halfchecked:!1,showAnimation:!0,disabled:!1}}},render(){var e;const{direction:o,$slots:l,defaultOpt:n,options:a}=this;let d=null==(e=l.default)?void 0:e.call(l);return(null==a?void 0:a.length)>0&&(d=a.map((e=>{const o=Object.assign({},n,e);return t.createVNode(r,o,null)}))),t.createVNode("div",{class:"devui-checkbox-group"},[t.createVNode("div",{class:{"devui-checkbox-list-inline":"row"===o}},[d])])}});function c(e,t){let o=e;return"object"==typeof t&&Object.keys(t).forEach((e=>{t[e]&&(o+=` ${e}`)})),o}r.install=function(e){e.component(r.name,r)},u.install=function(e){e.component(u.name,u)};var s=t.defineComponent({name:"DSelect",props:o,emits:["toggleChange","valueChange","update:modelValue"],setup(e,o){const l=t.ref(null),n=t.ref(null),a=t.ref(!1);function d(t){e.disabled||(a.value=t,o.emit("toggleChange",t))}!function(e,o,l){function n(t){var n,a;let d=t.target;d.shadowRoot&&t.composed&&(d=t.composedPath()[0]||d);const i=[null==(n=e[0])?void 0:n.value,null==(a=e[1])?void 0:a.value];o.value&&i.every((e=>e&&!e.contains(d)&&e!==d))&&l(!1)}t.onMounted((()=>{document.body.addEventListener("mousedown",n,!1)})),t.onBeforeUnmount((()=>{document.body.addEventListener("mousedown",n,!1)}))}([l,n],a,d);const i=t.computed((()=>{const{multiple:t,modelValue:o}=e;return e.options.map((e=>{let l;return l="object"==typeof e?__spreadValues({name:e.name?e.name:e.value+"",value:e.value,_checked:!1},e):{name:e+"",value:e,_checked:!1},t&&(Array.isArray(o)?l._checked=o.includes(l.value):l._checked=!1),l}))})),r=function(e){const o=t.computed((()=>{const t=new Map;return e.value.forEach((e=>{t.set(e.value,e)})),t}));return e=>e.map((e=>o.value.get(e)))}(i),u=t.computed((()=>{var t;if(e.multiple&&Array.isArray(e.modelValue)){return r(e.modelValue).map((e=>e.name)).join(",")}return Array.isArray(e.modelValue)?"":(null==(t=r([e.modelValue])[0])?void 0:t.name)||""})),s=t.computed((()=>!e.disabled&&e.allowClear&&u.value.length>0));return{isOpen:a,containerRef:l,dropdownRef:n,inputValue:u,mergeOptions:i,mergeClearable:s,valueChange:function(t,l){const{multiple:n,optionDisabledKey:a}=e;let{modelValue:r}=e;a&&t[a]||(n?(t._checked=!t._checked,r=i.value.filter((e=>e._checked)).map((e=>e.value)),o.emit("update:modelValue",r)):(o.emit("update:modelValue",t.value),d(!1)),o.emit("valueChange",t,l))},toggleChange:d,getItemClassName:function(t){const{optionDisabledKey:o}=e;return c("devui-select-item",{active:t.value===e.modelValue,disabled:!!o&&!!t[o]})},handleClear:function(t){t.preventDefault(),t.stopPropagation(),e.multiple?o.emit("update:modelValue",[]):o.emit("update:modelValue","")}}},render(){const{mergeOptions:e,isOpen:o,inputValue:n,size:a,multiple:d,disabled:i,optionDisabledKey:u,placeholder:s,overview:p,valueChange:m,toggleChange:v,getItemClassName:f,mergeClearable:h,handleClear:g}=this,y=c("devui-select",{"devui-select-open":o,"devui-dropdown-menu-multiple":d,"devui-select-lg":"lg"===a,"devui-select-sm":"sm"===a,"devui-select-underlined":"underlined"===p,"devui-select-disabled":i}),b=c("devui-select-input",{"devui-select-input-lg":"lg"===a,"devui-select-input-sm":"sm"===a}),V=c("devui-select-selection",{"devui-select-clearable":h});return t.createVNode("div",{class:y,ref:"containerRef"},[t.createVNode("div",{class:V,onClick:()=>v(!o)},[t.createVNode("input",{value:n,type:"text",class:b,placeholder:s,readonly:!0,disabled:i},null),t.createVNode("span",{onClick:g,class:"devui-select-clear"},[t.createVNode(l,{name:"close"},null)]),t.createVNode("span",{class:"devui-select-arrow"},[t.createVNode(l,{name:"select-arrow"},null)])]),t.createVNode(t.Transition,{name:"fade",ref:"dropdownRef"},{default:()=>[t.withDirectives(t.createVNode("div",{class:"devui-select-dropdown"},[t.createVNode("ul",{class:"devui-select-dropdown-list devui-scrollbar"},[e.map(((e,o)=>t.createVNode("li",{onClick:t=>{t.preventDefault(),t.stopPropagation(),m(e,o)},class:f(e),key:o},[d?t.createVNode(r,{modelValue:e._checked,label:e.name,disabled:!!u&&!!e[u]},null):e.name])))])]),[[t.vShow,o]])]})])}});s.install=function(e){e.component(s.name,s)};var p={title:"Select 下拉框",category:"数据录入",install(e){e.use(s)}};e.Select=s,e.default=p,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
|
|
1
|
+
var q=Object.defineProperty,L=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var F=(f,e,v)=>e in f?q(f,e,{enumerable:!0,configurable:!0,writable:!0,value:v}):f[e]=v,w=(f,e)=>{for(var v in e||(e={}))J.call(e,v)&&F(f,v,e[v]);if(R)for(var v of R(e))Q.call(e,v)&&F(f,v,e[v]);return f},P=(f,e)=>L(f,H(e));(function(f,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(f=typeof globalThis!="undefined"?globalThis:f||self,e(f.index={},f.Vue))})(this,function(f,e){"use strict";const v={modelValue:{type:[String,Number,Array],default:""},"onUpdate:modelValue":{type:Function,default:void 0},options:{type:Array,default:()=>[]},size:{type:String,default:"md"},overview:{type:String,default:"border"},placeholder:{type:String,default:"\u8BF7\u9009\u62E9"},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowClear:{type:Boolean,default:!1},optionDisabledKey:{type:String,default:""},onToggleChange:{type:Function,default:void 0},onValueChange:{type:Function,default:void 0}};var C=e.defineComponent({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup(t){return w({},t)},render(){const{name:t,size:n,color:l,classPrefix:a}=this;return/^((https?):)?\/\//.test(t)?e.createVNode("img",{src:t,alt:t.split("/")[t.split("/").length-1],style:{width:n,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${a} ${a}-${t}`,style:{fontSize:n,color:l}},null)}});C.install=function(t){t.component(C.name,C)};var X="";const B={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}},_=P(w({},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}}),K=P(w({},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}}),D=Symbol("d-checkbox-group");var S=e.defineComponent({name:"DCheckbox",props:_,emits:["change","update:checked","update:modelValue"],setup(t,n){const l=e.inject(D,null),a=e.computed(()=>t.checked||t.modelValue),c=e.computed(()=>(l==null?void 0:l.disabled.value)||t.disabled),s=e.computed(()=>{var i,r;return(r=(i=l==null?void 0:l.isItemChecked)==null?void 0:i.call(l,t.value))!=null?r:a.value}),o=e.computed(()=>{var i;return(i=l==null?void 0:l.isShowTitle.value)!=null?i:t.isShowTitle}),u=e.computed(()=>{var i;return(i=l==null?void 0:l.showAnimation.value)!=null?i:t.showAnimation}),m=e.computed(()=>{var i;return(i=l==null?void 0:l.color.value)!=null?i:t.color}),y=l==null?void 0:l.itemWidth.value,V=l==null?void 0:l.direction.value,k=(i,r)=>{var h;if(c.value)return Promise.resolve(!1);const g=(h=t.beforeChange)!=null?h:l==null?void 0:l.beforeChange;if(g){const b=g(i,r);return typeof b=="boolean"?Promise.resolve(b):b}return Promise.resolve(!0)},p=()=>{const i=!a.value;l==null||l.toggleGroupVal(t.value),n.emit("update:checked",i),n.emit("update:modelValue",i),n.emit("change",i)};return{itemWidth:y,direction:V,mergedColor:m,mergedDisabled:c,mergedIsShowTitle:o,mergedChecked:s,mergedShowAnimation:u,handleClick:()=>{k(!a.value,t.label).then(i=>i&&p())}}},render(){var I;const{itemWidth:t,direction:n,mergedChecked:l,mergedDisabled:a,mergedIsShowTitle:c,mergedShowAnimation:s,halfchecked:o,title:u,label:m,handleClick:y,name:V,value:k,mergedColor:p,$slots:d}=this,i={"devui-checkbox-column-margin":n==="column","devui-checkbox-wrap":typeof t!="undefined"},r=t?[`width: ${t}px`]:[],g={"devui-checkbox":!0,active:l,halfchecked:o,disabled:a,unchecked:!l},h=c?u||m:"",b=p&&o||p?`linear-gradient(${p}, ${p})`:"",O=[`border-color:${(l||o)&&p?p:""}`,`background-image:${b}`,`background-color:${p&&o?p:""}`],W={"devui-checkbox-material":!0,"custom-color":p,"devui-checkbox-no-label":!m&&!d.default,"devui-no-animation":!s,"devui-checkbox-default-background":!o},M={"devui-tick":!0,"devui-no-animation":!s},T=x=>x.stopPropagation(),U={indeterminate:o};return e.createVNode("div",{class:i,style:r},[e.createVNode("div",{class:g},[e.createVNode("label",{title:h,onClick:y},[e.createVNode("input",e.mergeProps({name:V||k,class:"devui-checkbox-input",type:"checkbox"},U,{checked:l,disabled:a,onClick:T,onChange:T}),null),e.createVNode("span",{style:O,class:W},[e.createVNode("span",{class:"devui-checkbox-halfchecked-bg"},null),e.createVNode("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",class:"devui-checkbox-tick"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.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:M},null)])])]),m||((I=d.default)==null?void 0:I.call(d))])])])}}),Y="",j=e.defineComponent({name:"DCheckboxGroup",props:K,emits:["change","update:modelValue"],setup(t,n){const l=e.toRef(t,"modelValue"),a={checked:!1,isShowTitle:!0,halfchecked:!1,showAnimation:!0,disabled:!1},c=o=>{let u=-1;if(typeof l.value[0]=="string"?u=l.value.findIndex(m=>m===o):typeof l.value[0]=="object"&&(u=l.value.findIndex(m=>m.value===o)),u===-1){if(typeof t.options[0]=="object"){const y=t.options.find(k=>k.value===o),V=[...l.value,y];n.emit("update:modelValue",V),n.emit("change",V);return}const m=[...l.value,o];n.emit("update:modelValue",m),n.emit("change",m);return}l.value.splice(u,1),n.emit("update:modelValue",l.value),n.emit("change",l.value)},s=o=>{if(typeof l.value[0]=="string")return l.value.includes(o);if(typeof l.value[0]=="object")return l.value.some(u=>u.value===o)};return e.provide(D,{disabled:e.toRef(t,"disabled"),isShowTitle:e.toRef(t,"isShowTitle"),color:e.toRef(t,"color"),showAnimation:e.toRef(t,"showAnimation"),beforeChange:t.beforeChange,isItemChecked:s,toggleGroupVal:c,itemWidth:e.toRef(t,"itemWidth"),direction:e.toRef(t,"direction")}),{defaultOpt:a}},render(){var s;const{direction:t,$slots:n,defaultOpt:l,options:a}=this;let c=(s=n.default)==null?void 0:s.call(n);return(a==null?void 0:a.length)>0&&(c=a.map(o=>{let u=null;return typeof o=="string"?u=Object.assign({},l,{label:o,value:o}):typeof o=="object"&&(u=Object.assign({},l,P(w({},o),{label:o.name}))),e.createVNode(S,u,null)})),e.createVNode("div",{class:"devui-checkbox-group"},[e.createVNode("div",{class:{"devui-checkbox-list-inline":t==="row"}},[c])])}});S.install=function(t){t.component(S.name,S)},j.install=function(t){t.component(j.name,j)};function A(t,n){let l=t;return typeof n=="object"&&Object.keys(n).forEach(a=>{n[a]&&(l+=` ${a}`)}),l}function $(t){const n=e.computed(()=>{const a=new Map;return t.value.forEach(c=>{a.set(c.value,c)}),a});return a=>a.map(c=>n.value.get(c))}function E(t,n,l){function a(c){var u,m;let s=c.target;s.shadowRoot&&c.composed&&(s=c.composedPath()[0]||s);const o=[(u=t[0])==null?void 0:u.value,(m=t[1])==null?void 0:m.value];n.value&&o.every(y=>y&&!y.contains(s)&&y!==s)&&l(!1)}e.onMounted(()=>{document.body.addEventListener("mousedown",a,!1)}),e.onBeforeUnmount(()=>{document.body.addEventListener("mousedown",a,!1)})}var Z="",N=e.defineComponent({name:"DSelect",props:v,emits:["toggleChange","valueChange","update:modelValue"],setup(t,n){const l=e.ref(null),a=e.ref(null),c=e.ref(!1);function s(d){t.disabled||(c.value=d,n.emit("toggleChange",d))}E([l,a],c,s);const o=e.computed(()=>{const{multiple:d,modelValue:i}=t;return t.options.map(r=>{let g;return typeof r=="object"?g=w({name:r.name?r.name:r.value+"",value:r.value,_checked:!1},r):g={name:r+"",value:r,_checked:!1},d&&(Array.isArray(i)?g._checked=i.includes(g.value):g._checked=!1),g})}),u=$(o),m=e.computed(()=>{var d;return t.multiple&&Array.isArray(t.modelValue)?u(t.modelValue).map(r=>r.name).join(","):Array.isArray(t.modelValue)?"":((d=u([t.modelValue])[0])==null?void 0:d.name)||""}),y=e.computed(()=>!t.disabled&&t.allowClear&&m.value.length>0);function V(d,i){const{multiple:r,optionDisabledKey:g}=t;let{modelValue:h}=t;g&&!!d[g]||(r?(d._checked=!d._checked,h=o.value.filter(b=>b._checked).map(b=>b.value),n.emit("update:modelValue",h)):(n.emit("update:modelValue",d.value),s(!1)),n.emit("valueChange",d,i))}function k(d){const{optionDisabledKey:i}=t;return A("devui-select-item",{active:d.value===t.modelValue,disabled:i?!!d[i]:!1})}function p(d){d.preventDefault(),d.stopPropagation(),t.multiple?n.emit("update:modelValue",[]):n.emit("update:modelValue","")}return{isOpen:c,containerRef:l,dropdownRef:a,inputValue:m,mergeOptions:o,mergeClearable:y,valueChange:V,toggleChange:s,getItemClassName:k,handleClear:p}},render(){const{mergeOptions:t,isOpen:n,inputValue:l,size:a,multiple:c,disabled:s,optionDisabledKey:o,placeholder:u,overview:m,valueChange:y,toggleChange:V,getItemClassName:k,mergeClearable:p,handleClear:d}=this,i=A("devui-select",{"devui-select-open":n,"devui-dropdown-menu-multiple":c,"devui-select-lg":a==="lg","devui-select-sm":a==="sm","devui-select-underlined":m==="underlined","devui-select-disabled":s}),r=A("devui-select-input",{"devui-select-input-lg":a==="lg","devui-select-input-sm":a==="sm"}),g=A("devui-select-selection",{"devui-select-clearable":p});return e.createVNode("div",{class:i,ref:"containerRef"},[e.createVNode("div",{class:g,onClick:()=>V(!n)},[e.createVNode("input",{value:l,type:"text",class:r,placeholder:u,readonly:!0,disabled:s},null),e.createVNode("span",{onClick:d,class:"devui-select-clear"},[e.createVNode(C,{name:"close"},null)]),e.createVNode("span",{class:"devui-select-arrow"},[e.createVNode(C,{name:"select-arrow"},null)])]),e.createVNode(e.Transition,{name:"fade",ref:"dropdownRef"},{default:()=>[e.withDirectives(e.createVNode("div",{class:"devui-select-dropdown"},[e.createVNode("ul",{class:"devui-select-dropdown-list devui-scrollbar"},[t.map((h,b)=>e.createVNode("li",{onClick:O=>{O.preventDefault(),O.stopPropagation(),y(h,b)},class:k(h),key:b},[c?e.createVNode(S,{modelValue:h._checked,label:h.name,disabled:o?!!h[o]:!1},null):h.name]))])]),[[e.vShow,n]])]})])}});N.install=function(t){t.component(N.name,N)};var z={title:"Select \u4E0B\u62C9\u6846",category:"\u6570\u636E\u5F55\u5165",status:"10%",install(t){t.use(N)}};f.Select=N,f.default=z,Object.defineProperty(f,"__esModule",{value:!0}),f[Symbol.toStringTag]="Module"});
|
package/skeleton/index.es.js
CHANGED
|
@@ -1 +1,297 @@
|
|
|
1
|
-
import{defineComponent
|
|
1
|
+
import { defineComponent, createVNode, Fragment, withDirectives, vShow, mergeProps } from "vue";
|
|
2
|
+
var skeleton = "";
|
|
3
|
+
const skeletonProps = {
|
|
4
|
+
row: {
|
|
5
|
+
type: Number,
|
|
6
|
+
default: 0
|
|
7
|
+
},
|
|
8
|
+
animate: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: true
|
|
11
|
+
},
|
|
12
|
+
round: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
16
|
+
loading: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: true
|
|
19
|
+
},
|
|
20
|
+
avatar: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
title: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
28
|
+
paragraph: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: true
|
|
31
|
+
},
|
|
32
|
+
avatarSize: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: "40px"
|
|
35
|
+
},
|
|
36
|
+
avatarShape: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "round"
|
|
39
|
+
},
|
|
40
|
+
titleWidth: {
|
|
41
|
+
type: [String, Number],
|
|
42
|
+
default: "40%"
|
|
43
|
+
},
|
|
44
|
+
rowWidth: {
|
|
45
|
+
type: [Number, String, Array],
|
|
46
|
+
default: ["100%"]
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var Skeleton = defineComponent({
|
|
50
|
+
name: "DSkeleton",
|
|
51
|
+
props: skeletonProps,
|
|
52
|
+
setup(props, ctx) {
|
|
53
|
+
const {
|
|
54
|
+
slots
|
|
55
|
+
} = ctx;
|
|
56
|
+
function renderAnimate(isAnimated) {
|
|
57
|
+
return isAnimated ? "devui-skeleton__animated" : "";
|
|
58
|
+
}
|
|
59
|
+
function renderBorderRadius(isRound) {
|
|
60
|
+
return isRound ? "border-radius: 1em;" : "";
|
|
61
|
+
}
|
|
62
|
+
function renderParagraph(isShown, rowNum, rowWidth, round) {
|
|
63
|
+
const arr = [];
|
|
64
|
+
function pushIntoArray(type) {
|
|
65
|
+
for (let index2 = 0; index2 < rowNum; index2++) {
|
|
66
|
+
arr.push({
|
|
67
|
+
width: type
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
(function handleRowWidth() {
|
|
72
|
+
if (rowWidth instanceof Array) {
|
|
73
|
+
for (let index2 = 0; index2 < rowNum; index2++) {
|
|
74
|
+
if (rowWidth[index2]) {
|
|
75
|
+
switch (typeof rowWidth[index2]) {
|
|
76
|
+
case "string":
|
|
77
|
+
arr.push({
|
|
78
|
+
width: rowWidth[index2]
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
case "number":
|
|
82
|
+
arr.push({
|
|
83
|
+
width: `${rowWidth[index2]}px`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
arr.push({
|
|
88
|
+
width: 1
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
switch (typeof rowWidth) {
|
|
94
|
+
case "string":
|
|
95
|
+
pushIntoArray(rowWidth);
|
|
96
|
+
break;
|
|
97
|
+
case "number":
|
|
98
|
+
pushIntoArray(`${rowWidth}px`);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
})();
|
|
103
|
+
return withDirectives(createVNode("div", {
|
|
104
|
+
"class": "devui-skeleton__paragraph"
|
|
105
|
+
}, [arr.map((item2) => {
|
|
106
|
+
return createVNode("div", {
|
|
107
|
+
"class": "devui-skeleton__item",
|
|
108
|
+
"style": round ? "border-radius: 1em;" : `width: ${item2.width}`
|
|
109
|
+
}, null);
|
|
110
|
+
})]), [[vShow, isShown]]);
|
|
111
|
+
}
|
|
112
|
+
function renderAvatarStyle(avatarSize, avatarShape) {
|
|
113
|
+
function renderAvatarShape(avatarShape2) {
|
|
114
|
+
return avatarShape2 === "square" ? "" : "border-radius:50%;";
|
|
115
|
+
}
|
|
116
|
+
function renderAvatarSize(avatarSize2) {
|
|
117
|
+
switch (typeof avatarSize2) {
|
|
118
|
+
case "string":
|
|
119
|
+
return `width:${avatarSize2};height:${avatarSize2};`;
|
|
120
|
+
case "number":
|
|
121
|
+
return `width:${avatarSize2}px;height:${avatarSize2}px;`;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return renderAvatarSize(avatarSize) + renderAvatarShape(avatarShape);
|
|
125
|
+
}
|
|
126
|
+
function renderTitle(isVisible, titleWidth, isRound) {
|
|
127
|
+
function renderTitleWidth(titleWidth2) {
|
|
128
|
+
switch (typeof titleWidth2) {
|
|
129
|
+
case "string":
|
|
130
|
+
return `width: ${titleWidth2};`;
|
|
131
|
+
case "number":
|
|
132
|
+
return `width: ${titleWidth2}px;`;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function renderTitleVisibility(isVisible2) {
|
|
136
|
+
return isVisible2 ? null : "visibility: hidden;";
|
|
137
|
+
}
|
|
138
|
+
return renderTitleWidth(titleWidth) + renderBorderRadius(isRound) + renderTitleVisibility(isVisible);
|
|
139
|
+
}
|
|
140
|
+
function renderDefaultSkeleton() {
|
|
141
|
+
return createVNode(Fragment, null, [withDirectives(createVNode("div", {
|
|
142
|
+
"class": "devui-skeleton__avatar"
|
|
143
|
+
}, [createVNode("div", {
|
|
144
|
+
"class": "avatar",
|
|
145
|
+
"style": renderAvatarStyle(props.avatarSize, props.avatarShape)
|
|
146
|
+
}, null)]), [[vShow, props.avatar]]), createVNode("div", {
|
|
147
|
+
"class": "devui-skeleton__group"
|
|
148
|
+
}, [createVNode("div", {
|
|
149
|
+
"class": "devui-skeleton__title",
|
|
150
|
+
"style": renderTitle(props.title, props.titleWidth, props.round)
|
|
151
|
+
}, null), renderParagraph(props.paragraph, props.row, props.rowWidth, props.round)])]);
|
|
152
|
+
}
|
|
153
|
+
return () => {
|
|
154
|
+
var _a;
|
|
155
|
+
if (props.loading) {
|
|
156
|
+
return createVNode("div", {
|
|
157
|
+
"class": `devui-skeleton ${renderAnimate(props.animate)}`
|
|
158
|
+
}, [renderDefaultSkeleton()]);
|
|
159
|
+
}
|
|
160
|
+
return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var item = "";
|
|
165
|
+
const itemProps = {
|
|
166
|
+
row: {
|
|
167
|
+
type: Number,
|
|
168
|
+
default: 0
|
|
169
|
+
},
|
|
170
|
+
animate: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: true
|
|
173
|
+
},
|
|
174
|
+
round: {
|
|
175
|
+
type: Boolean,
|
|
176
|
+
default: false
|
|
177
|
+
},
|
|
178
|
+
loading: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: true
|
|
181
|
+
},
|
|
182
|
+
avatarShape: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: "round"
|
|
185
|
+
},
|
|
186
|
+
titleWidth: {
|
|
187
|
+
type: [String, Number],
|
|
188
|
+
default: "40%"
|
|
189
|
+
},
|
|
190
|
+
rowWidth: {
|
|
191
|
+
type: [Number, String, Array],
|
|
192
|
+
default: ["100%"]
|
|
193
|
+
},
|
|
194
|
+
shape: {
|
|
195
|
+
type: String
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var SkeletonItem = defineComponent({
|
|
199
|
+
name: "DSkeletonItem",
|
|
200
|
+
props: itemProps,
|
|
201
|
+
setup(props, ctx) {
|
|
202
|
+
const {
|
|
203
|
+
slots
|
|
204
|
+
} = ctx;
|
|
205
|
+
function renderAnimate(isAnimated) {
|
|
206
|
+
return isAnimated ? "devui-skeleton__animated" : "";
|
|
207
|
+
}
|
|
208
|
+
function renderShapeParagraph(rowNum, rowWidth, round) {
|
|
209
|
+
const arr = [];
|
|
210
|
+
function pushIntoArray(type) {
|
|
211
|
+
for (let index2 = 0; index2 < rowNum; index2++) {
|
|
212
|
+
arr.push({
|
|
213
|
+
width: type
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
(function handleRowWidth() {
|
|
218
|
+
if (rowWidth instanceof Array) {
|
|
219
|
+
for (let index2 = 0; index2 < rowNum; index2++) {
|
|
220
|
+
if (rowWidth[index2]) {
|
|
221
|
+
switch (typeof rowWidth[index2]) {
|
|
222
|
+
case "string":
|
|
223
|
+
arr.push({
|
|
224
|
+
width: rowWidth[index2]
|
|
225
|
+
});
|
|
226
|
+
break;
|
|
227
|
+
case "number":
|
|
228
|
+
arr.push({
|
|
229
|
+
width: `${rowWidth[index2]}px`
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
arr.push({
|
|
234
|
+
width: 1
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
switch (typeof rowWidth) {
|
|
240
|
+
case "string":
|
|
241
|
+
pushIntoArray(rowWidth);
|
|
242
|
+
break;
|
|
243
|
+
case "number":
|
|
244
|
+
pushIntoArray(`${rowWidth}px`);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
})();
|
|
249
|
+
return createVNode("div", mergeProps({
|
|
250
|
+
"class": `devui-skeleton__shape__paragraph ${renderAnimate(props.animate)}`
|
|
251
|
+
}, ctx.attrs), [arr.map((item2) => {
|
|
252
|
+
return createVNode("div", {
|
|
253
|
+
"class": "devui-skeleton__shape__paragraph__item",
|
|
254
|
+
"style": round ? "border-radius: 1em;" : `width: ${item2.width}`
|
|
255
|
+
}, null);
|
|
256
|
+
})]);
|
|
257
|
+
}
|
|
258
|
+
function renderAvatarStyle(avatarShape) {
|
|
259
|
+
function renderAvatarShape(avatarShape2) {
|
|
260
|
+
return avatarShape2 === "square" ? "" : "border-radius:50%;";
|
|
261
|
+
}
|
|
262
|
+
return renderAvatarShape(avatarShape);
|
|
263
|
+
}
|
|
264
|
+
return () => {
|
|
265
|
+
var _a;
|
|
266
|
+
if (props.loading && props.shape) {
|
|
267
|
+
switch (props.shape) {
|
|
268
|
+
case "avatar":
|
|
269
|
+
return createVNode(Fragment, null, [createVNode("div", mergeProps({
|
|
270
|
+
"class": `devui-skeleton__shape__avatar ${renderAnimate(props.animate)}`,
|
|
271
|
+
"style": renderAvatarStyle(props.avatarShape)
|
|
272
|
+
}, ctx.attrs), null)]);
|
|
273
|
+
case "paragraph":
|
|
274
|
+
return createVNode(Fragment, null, [renderShapeParagraph(props.row, props.rowWidth, props.round)]);
|
|
275
|
+
default:
|
|
276
|
+
return createVNode(Fragment, null, [createVNode("div", mergeProps({
|
|
277
|
+
"class": `devui-skeleton__shape__${props.shape} ${renderAnimate(props.animate)}`
|
|
278
|
+
}, ctx.attrs), null)]);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
Skeleton.install = function(app) {
|
|
286
|
+
app.component(Skeleton.name, Skeleton);
|
|
287
|
+
app.component(SkeletonItem.name, SkeletonItem);
|
|
288
|
+
};
|
|
289
|
+
var index = {
|
|
290
|
+
title: "Skeleton \u9AA8\u67B6\u5C4F",
|
|
291
|
+
category: "\u6570\u636E\u5C55\u793A",
|
|
292
|
+
status: "100%",
|
|
293
|
+
install(app) {
|
|
294
|
+
app.use(Skeleton);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
export { Skeleton, SkeletonItem, index as default };
|
package/skeleton/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis!="undefined"?globalThis:u||self,e(u.index={},u.Vue))})(this,function(u,e){"use strict";var V="";const S={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatar:{type:Boolean,default:!1},title:{type:Boolean,default:!0},paragraph:{type:Boolean,default:!0},avatarSize:{type:[String,Number],default:"40px"},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]}};var m=e.defineComponent({name:"DSkeleton",props:S,setup(t,h){const{slots:f}=h;function p(a){return a?"devui-skeleton__animated":""}function b(a){return a?"border-radius: 1em;":""}function k(a,o,n,r){const i=[];function c(g){for(let s=0;s<o;s++)i.push({width:g})}return function(){if(n instanceof Array)for(let s=0;s<o;s++)if(n[s])switch(typeof n[s]){case"string":i.push({width:n[s]});break;case"number":i.push({width:`${n[s]}px`})}else i.push({width:1});else switch(typeof n){case"string":c(n);break;case"number":c(`${n}px`);break}}(),e.withDirectives(e.createVNode("div",{class:"devui-skeleton__paragraph"},[i.map(g=>e.createVNode("div",{class:"devui-skeleton__item",style:r?"border-radius: 1em;":`width: ${g.width}`},null))]),[[e.vShow,a]])}function l(a,o){function n(i){return i==="square"?"":"border-radius:50%;"}function r(i){switch(typeof i){case"string":return`width:${i};height:${i};`;case"number":return`width:${i}px;height:${i}px;`}}return r(a)+n(o)}function d(a,o,n){function r(c){switch(typeof c){case"string":return`width: ${c};`;case"number":return`width: ${c}px;`}}function i(c){return c?null:"visibility: hidden;"}return r(o)+b(n)+i(a)}function y(){return e.createVNode(e.Fragment,null,[e.withDirectives(e.createVNode("div",{class:"devui-skeleton__avatar"},[e.createVNode("div",{class:"avatar",style:l(t.avatarSize,t.avatarShape)},null)]),[[e.vShow,t.avatar]]),e.createVNode("div",{class:"devui-skeleton__group"},[e.createVNode("div",{class:"devui-skeleton__title",style:d(t.title,t.titleWidth,t.round)},null),k(t.paragraph,t.row,t.rowWidth,t.round)])])}return()=>{var a;return t.loading?e.createVNode("div",{class:`devui-skeleton ${p(t.animate)}`},[y()]):e.createVNode(e.Fragment,null,[(a=f.default)==null?void 0:a.call(f)])}}}),v="";const N={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]},shape:{type:String}};var _=e.defineComponent({name:"DSkeletonItem",props:N,setup(t,h){const{slots:f}=h;function p(l){return l?"devui-skeleton__animated":""}function b(l,d,y){const a=[];function o(n){for(let r=0;r<l;r++)a.push({width:n})}return function(){if(d instanceof Array)for(let r=0;r<l;r++)if(d[r])switch(typeof d[r]){case"string":a.push({width:d[r]});break;case"number":a.push({width:`${d[r]}px`})}else a.push({width:1});else switch(typeof d){case"string":o(d);break;case"number":o(`${d}px`);break}}(),e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__paragraph ${p(t.animate)}`},h.attrs),[a.map(n=>e.createVNode("div",{class:"devui-skeleton__shape__paragraph__item",style:y?"border-radius: 1em;":`width: ${n.width}`},null))])}function k(l){function d(y){return y==="square"?"":"border-radius:50%;"}return d(l)}return()=>{var l;if(t.loading&&t.shape)switch(t.shape){case"avatar":return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__avatar ${p(t.animate)}`,style:k(t.avatarShape)},h.attrs),null)]);case"paragraph":return e.createVNode(e.Fragment,null,[b(t.row,t.rowWidth,t.round)]);default:return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:`devui-skeleton__shape__${t.shape} ${p(t.animate)}`},h.attrs),null)])}return e.createVNode(e.Fragment,null,[(l=f.default)==null?void 0:l.call(f)])}}});m.install=function(t){t.component(m.name,m),t.component(_.name,_)};var w={title:"Skeleton \u9AA8\u67B6\u5C4F",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.use(m)}};u.Skeleton=m,u.SkeletonItem=_,u.default=w,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
|
package/skeleton/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-skeleton{display:flex;justify-content:space-between}.devui-
|
|
1
|
+
.devui-skeleton{display:flex;justify-content:space-between}.devui-skeleton__avatar{display:flex;flex:1;justify-content:center;padding-right:16px}.devui-skeleton__avatar .avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__group{flex:11}.devui-skeleton__item,.devui-skeleton__title{width:100%;height:16px;background-color:#f2f2f2}.devui-skeleton__title{margin-top:24px}.devui-skeleton__paragraph{margin-top:12px}.devui-skeleton__item:last-child{width:60%}.devui-skeleton__avatar>.avatar,.devui-skeleton__group>div>.devui-skeleton__item{margin-top:12px}.devui-skeleton__animated>.devui-skeleton__group>.devui-skeleton__title,.devui-skeleton__animated>.devui-skeleton__group>div>.devui-skeleton__item,.devui-skeleton__animated>.devui-skeleton__avatar>.avatar{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}.devui-skeleton__shape__avatar,.devui-skeleton__shape__image,.devui-skeleton__shape__title,.devui-skeleton__shape__button{background-color:#f2f2f2}.devui-skeleton__shape__avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__shape__image{width:200px;height:150px;border-radius:4px}.devui-skeleton__shape__title{width:40%;height:24px}.devui-skeleton__shape__paragraph__item{background-color:#f2f2f2;width:100%;height:16px;margin-bottom:10px}.devui-skeleton__shape__paragraph__item:last-child{width:60%}.devui-skeleton__shape__button{width:115px;height:32px}@keyframes skeletonLoading{to{background-position-x:-20%}}.devui-skeleton__animated .devui-skeleton__shape__avatar,.devui-skeleton__animated.devui-skeleton__shape__avatar,.devui-skeleton__animated.devui-skeleton__shape__image,.devui-skeleton__animated.devui-skeleton__shape__title,.devui-skeleton__animated.devui-skeleton__shape__paragraph>.devui-skeleton__shape__paragraph__item,.devui-skeleton__animated.devui-skeleton__shape__button{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}
|
package/slider/index.es.js
CHANGED
|
@@ -1 +1,199 @@
|
|
|
1
|
-
import{defineComponent
|
|
1
|
+
import { defineComponent, ref, onMounted, computed, createVNode } from "vue";
|
|
2
|
+
const sliderProps = {
|
|
3
|
+
disabled: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
default: false
|
|
6
|
+
},
|
|
7
|
+
max: {
|
|
8
|
+
type: Number,
|
|
9
|
+
default: 100
|
|
10
|
+
},
|
|
11
|
+
min: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 0
|
|
14
|
+
},
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 0
|
|
18
|
+
},
|
|
19
|
+
showInput: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
step: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 1
|
|
26
|
+
},
|
|
27
|
+
tipsRenderer: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var slider = "";
|
|
33
|
+
var Slider = defineComponent({
|
|
34
|
+
name: "DSlider",
|
|
35
|
+
props: sliderProps,
|
|
36
|
+
emits: ["update:modelValue"],
|
|
37
|
+
setup(props, ctx) {
|
|
38
|
+
let isClick = true;
|
|
39
|
+
let startPosition = 0;
|
|
40
|
+
let startX = 0;
|
|
41
|
+
const popoverShow = ref(false);
|
|
42
|
+
const sliderRunway = ref(null);
|
|
43
|
+
const inputValue = ref(props.modelValue);
|
|
44
|
+
const currentPosition = ref(0);
|
|
45
|
+
const newPostion = ref(0);
|
|
46
|
+
const percentDispaly = ref("");
|
|
47
|
+
const renderShowInput = () => {
|
|
48
|
+
return props.showInput ? createVNode("div", {
|
|
49
|
+
"class": "devui-input__out-wrap"
|
|
50
|
+
}, [createVNode("input", {
|
|
51
|
+
"onInput": handleOnInput,
|
|
52
|
+
"value": inputValue.value + ""
|
|
53
|
+
}, null)]) : "";
|
|
54
|
+
};
|
|
55
|
+
if (props.modelValue > props.max) {
|
|
56
|
+
percentDispaly.value = "100%";
|
|
57
|
+
} else if (props.modelValue < props.min) {
|
|
58
|
+
percentDispaly.value = "0%";
|
|
59
|
+
} else {
|
|
60
|
+
percentDispaly.value = (props.modelValue - props.min) * 100 / (props.max - props.min) + "%";
|
|
61
|
+
}
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
const sliderWidth = sliderRunway.value.clientWidth;
|
|
64
|
+
currentPosition.value = sliderWidth * (inputValue.value - props.min) / (props.max - props.min);
|
|
65
|
+
});
|
|
66
|
+
function handleButtonMousedown(event) {
|
|
67
|
+
popoverShow.value = true;
|
|
68
|
+
if (props.disabled)
|
|
69
|
+
return;
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
dragStart(event);
|
|
72
|
+
window.addEventListener("mousemove", onDragging);
|
|
73
|
+
window.addEventListener("mouseup", onDragEnd);
|
|
74
|
+
}
|
|
75
|
+
function dragStart(event) {
|
|
76
|
+
isClick = false;
|
|
77
|
+
startX = event.clientX;
|
|
78
|
+
startPosition = currentPosition.value;
|
|
79
|
+
newPostion.value = startPosition;
|
|
80
|
+
}
|
|
81
|
+
function onDragging(event) {
|
|
82
|
+
popoverShow.value = true;
|
|
83
|
+
const currentX = event.clientX;
|
|
84
|
+
const pxOffset = currentX - startX;
|
|
85
|
+
newPostion.value = startPosition + pxOffset;
|
|
86
|
+
setPostion(newPostion.value);
|
|
87
|
+
}
|
|
88
|
+
function onDragEnd() {
|
|
89
|
+
popoverShow.value = false;
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
isClick = true;
|
|
92
|
+
}, 100);
|
|
93
|
+
window.removeEventListener("mousemove", onDragging);
|
|
94
|
+
window.removeEventListener("mouseup", onDragEnd);
|
|
95
|
+
}
|
|
96
|
+
function setPostion(newPosition) {
|
|
97
|
+
const sliderWidth = Math.round(sliderRunway.value.clientWidth);
|
|
98
|
+
if (newPosition < 0) {
|
|
99
|
+
newPosition = 0;
|
|
100
|
+
}
|
|
101
|
+
const LengthPerStep = sliderWidth / ((props.max - props.min) / props.step);
|
|
102
|
+
const steps = Math.round(newPosition / LengthPerStep);
|
|
103
|
+
const value = steps * LengthPerStep;
|
|
104
|
+
if (Math.round(value) >= sliderWidth) {
|
|
105
|
+
currentPosition.value = sliderWidth;
|
|
106
|
+
inputValue.value = props.max;
|
|
107
|
+
percentDispaly.value = "100%";
|
|
108
|
+
ctx.emit("update:modelValue", props.max);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
percentDispaly.value = Math.round(value * 100 / sliderWidth) + "%";
|
|
112
|
+
inputValue.value = Math.round(value * (props.max - props.min) / sliderWidth) + props.min;
|
|
113
|
+
currentPosition.value = newPosition;
|
|
114
|
+
ctx.emit("update:modelValue", inputValue.value);
|
|
115
|
+
}
|
|
116
|
+
function handleRunwayMousedown(event) {
|
|
117
|
+
if (!props.disabled && isClick) {
|
|
118
|
+
startX = event.target.getBoundingClientRect().left;
|
|
119
|
+
const currentX = event.clientX;
|
|
120
|
+
setPostion(currentX - startX);
|
|
121
|
+
handleButtonMousedown(event);
|
|
122
|
+
} else {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function handleOnInput(event) {
|
|
127
|
+
inputValue.value = parseInt(event.target.value);
|
|
128
|
+
if (!inputValue.value) {
|
|
129
|
+
inputValue.value = props.min;
|
|
130
|
+
percentDispaly.value = "0%";
|
|
131
|
+
} else {
|
|
132
|
+
if (inputValue.value < props.min) {
|
|
133
|
+
inputValue.value = props.min;
|
|
134
|
+
}
|
|
135
|
+
if (inputValue.value > props.max) {
|
|
136
|
+
inputValue.value = props.max;
|
|
137
|
+
}
|
|
138
|
+
const re = /^(?:[1-9]?\d|100)$/;
|
|
139
|
+
if (re.test(`${inputValue.value}`)) {
|
|
140
|
+
percentDispaly.value = (inputValue.value - props.min) * 100 / (props.max - props.min) + "%";
|
|
141
|
+
ctx.emit("update:modelValue", inputValue.value);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const disableClass = computed(() => {
|
|
146
|
+
return props.disabled ? " disabled" : "";
|
|
147
|
+
});
|
|
148
|
+
const popover = () => {
|
|
149
|
+
return createVNode("div", {
|
|
150
|
+
"class": "devui-slider_popover",
|
|
151
|
+
"style": {
|
|
152
|
+
left: percentDispaly.value,
|
|
153
|
+
opacity: popoverShow.value ? 1 : 0
|
|
154
|
+
}
|
|
155
|
+
}, [createVNode("div", {
|
|
156
|
+
"class": "devui-slider_popover-arrow"
|
|
157
|
+
}, null), createVNode("div", {
|
|
158
|
+
"class": "devui-slider_popover-content"
|
|
159
|
+
}, [inputValue.value + " " + props.tipsRenderer])]);
|
|
160
|
+
};
|
|
161
|
+
return () => createVNode("div", {
|
|
162
|
+
"class": "devui-slider"
|
|
163
|
+
}, [createVNode("div", {
|
|
164
|
+
"ref": sliderRunway,
|
|
165
|
+
"class": "devui-slider__runway" + disableClass.value,
|
|
166
|
+
"onMousedown": handleRunwayMousedown,
|
|
167
|
+
"onMouseout": () => popoverShow.value = false
|
|
168
|
+
}, [createVNode("div", {
|
|
169
|
+
"class": "devui-slider__bar" + disableClass.value,
|
|
170
|
+
"style": {
|
|
171
|
+
width: percentDispaly.value
|
|
172
|
+
}
|
|
173
|
+
}, null), createVNode("div", {
|
|
174
|
+
"class": "devui-slider__button" + disableClass.value,
|
|
175
|
+
"style": {
|
|
176
|
+
left: percentDispaly.value
|
|
177
|
+
},
|
|
178
|
+
"onMousedown": handleButtonMousedown,
|
|
179
|
+
"onMouseenter": () => popoverShow.value = true,
|
|
180
|
+
"onMouseout": () => popoverShow.value = false
|
|
181
|
+
}, null), props.tipsRenderer === "null" ? "" : popover()]), createVNode("span", {
|
|
182
|
+
"class": "devui-min_count"
|
|
183
|
+
}, [props.min]), createVNode("span", {
|
|
184
|
+
"class": "devui-max_count"
|
|
185
|
+
}, [props.max]), renderShowInput()]);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
Slider.install = function(app) {
|
|
189
|
+
app.component(Slider.name, Slider);
|
|
190
|
+
};
|
|
191
|
+
var index = {
|
|
192
|
+
title: "Slider \u6ED1\u5757",
|
|
193
|
+
category: "\u6570\u636E\u5F55\u5165",
|
|
194
|
+
status: "100%",
|
|
195
|
+
install(app) {
|
|
196
|
+
app.use(Slider);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
export { Slider, index as default };
|
package/slider/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(a,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(a=typeof globalThis!="undefined"?globalThis:a||self,t(a.index={},a.Vue))})(this,function(a,t){"use strict";const x={disabled:{type:Boolean,default:!1},max:{type:Number,default:100},min:{type:Number,default:0},modelValue:{type:Number,default:0},showInput:{type:Boolean,default:!1},step:{type:Number,default:1},tipsRenderer:{type:String,default:""}};var R="",o=t.defineComponent({name:"DSlider",props:x,emits:["update:modelValue"],setup(e,v){let m=!0,f=0,s=0;const d=t.ref(!1),V=t.ref(null),l=t.ref(e.modelValue),r=t.ref(0),h=t.ref(0),u=t.ref(""),S=()=>e.showInput?t.createVNode("div",{class:"devui-input__out-wrap"},[t.createVNode("input",{onInput:D,value:l.value+""},null)]):"";e.modelValue>e.max?u.value="100%":e.modelValue<e.min?u.value="0%":u.value=(e.modelValue-e.min)*100/(e.max-e.min)+"%",t.onMounted(()=>{const n=V.value.clientWidth;r.value=n*(l.value-e.min)/(e.max-e.min)});function M(n){d.value=!0,!e.disabled&&(n.preventDefault(),E(n),window.addEventListener("mousemove",N),window.addEventListener("mouseup",_))}function E(n){m=!1,s=n.clientX,f=r.value,h.value=f}function N(n){d.value=!0;const c=n.clientX-s;h.value=f+c,b(h.value)}function _(){d.value=!1,setTimeout(()=>{m=!0},100),window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",_)}function b(n){const i=Math.round(V.value.clientWidth);n<0&&(n=0);const c=i/((e.max-e.min)/e.step),y=Math.round(n/c)*c;if(Math.round(y)>=i){r.value=i,l.value=e.max,u.value="100%",v.emit("update:modelValue",e.max);return}u.value=Math.round(y*100/i)+"%",l.value=Math.round(y*(e.max-e.min)/i)+e.min,r.value=n,v.emit("update:modelValue",l.value)}function X(n){if(!e.disabled&&m){s=n.target.getBoundingClientRect().left;const i=n.clientX;b(i-s),M(n)}else return}function D(n){l.value=parseInt(n.target.value),l.value?(l.value<e.min&&(l.value=e.min),l.value>e.max&&(l.value=e.max),/^(?:[1-9]?\d|100)$/.test(`${l.value}`)&&(u.value=(l.value-e.min)*100/(e.max-e.min)+"%",v.emit("update:modelValue",l.value))):(l.value=e.min,u.value="0%")}const w=t.computed(()=>e.disabled?" disabled":""),I=()=>t.createVNode("div",{class:"devui-slider_popover",style:{left:u.value,opacity:d.value?1:0}},[t.createVNode("div",{class:"devui-slider_popover-arrow"},null),t.createVNode("div",{class:"devui-slider_popover-content"},[l.value+" "+e.tipsRenderer])]);return()=>t.createVNode("div",{class:"devui-slider"},[t.createVNode("div",{ref:V,class:"devui-slider__runway"+w.value,onMousedown:X,onMouseout:()=>d.value=!1},[t.createVNode("div",{class:"devui-slider__bar"+w.value,style:{width:u.value}},null),t.createVNode("div",{class:"devui-slider__button"+w.value,style:{left:u.value},onMousedown:M,onMouseenter:()=>d.value=!0,onMouseout:()=>d.value=!1},null),e.tipsRenderer==="null"?"":I()]),t.createVNode("span",{class:"devui-min_count"},[e.min]),t.createVNode("span",{class:"devui-max_count"},[e.max]),S()])}});o.install=function(e){e.component(o.name,o)};var g={title:"Slider \u6ED1\u5757",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(o)}};a.Slider=o,a.default=g,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|