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/splitter/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__require="undefined"!=typeof require?require:e=>{throw new Error('Dynamic require of "'+e+'" is not supported')},__publicField=(e,n,t)=>(__defNormalProp(e,"symbol"!=typeof n?n+"":n,t),t);!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).index={},e.Vue)}(this,(function(e,n){"use strict";const t={orientation:{type:String,default:"horizontal"},splitBarSize:{type:String,default:"2px"},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean,default:!0}};function i(e,n){const t={},i=Object.keys(n);return i.forEach((n=>{t[n]=e.style[n]})),i.forEach((t=>{e.style[t]=n[t]})),t}function o(e,n){if(e.classList)return e.classList.contains(n);return` ${e.className} `.indexOf(` ${n} `)>-1}function l(e,n){e.classList?e.classList.add(n):o(e,n)||(e.className=`${e.className} ${n}`)}function s(e,n){if(e.classList)e.classList.remove(n);else if(o(e,n)){const t=e.className;e.className=` ${t} `.replace(` ${n} `," ")}}const a={mounted(e,{value:n}){e.$value=n,n.enableResize&&function(e){r(e,"mousedown",d)}(e)},unmounted(e,{value:n}){n.enableResize&&p(e,"mousedown",d)}};function r(e,n,t){e.addEventListener&&e.addEventListener(n,t)}function p(e,n,t){e.removeEventListener&&e.removeEventListener(n,t)}function d(e){var n;const t=null==(n=null==e?void 0:e.target)?void 0:n.$value;function i(e){t.onDragEvent(u(e))}t&&(r(document,"mousemove",i),r(document,"mouseup",(function e(n){p(document,"mousemove",i),p(document,"mouseup",e),t.onReleaseEvent(u(n))})),t.onPressEvent(u(e)))}function u(e){return{pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY,offsetX:e.offsetX,offsetY:e.offsetY,type:e.type,originalEvent:e}}const c={index:{type:Number},orientation:{type:String,required:!0},splitBarSize:{type:String,required:!0},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean}};var v=n.defineComponent({name:"DSplitterBar",props:c,setup(e){const t=n.inject("splitterStore"),o=n.reactive({wrapperClass:`devui-splitter-bar devui-splitter-bar-${e.orientation}`}),r=n.ref();n.onMounted((()=>{n.watch([()=>e.splitBarSize,r],(([e,n])=>{n instanceof HTMLElement&&i(n,{flexBasis:e})}),{immediate:!0}),n.watch([()=>t.state.panes,r],(([n,l])=>{t.isStaticBar(e.index)?i(l,{flexBasis:e.disabledBarSize}):o.wrapperClass+=" resizable"}),{deep:!0})}));const p={pageX:0,pageY:0,originalX:0,originalY:0};let d;const u={enableResize:!0,onPressEvent:function({originalEvent:n}){n.stopPropagation(),t.isResizable(e.index)&&(d=t.dragState(e.index),p.originalX=n.pageX,p.originalY=n.pageY)},onDragEvent:function({originalEvent:n}){if(n.stopPropagation(),!t.isResizable(e.index))return;let i;p.pageX=n.pageX,p.pageY=n.pageY,i="vertical"===e.orientation?p.pageY-p.originalY:p.pageX-p.originalX,t.setSize(d,i)},onReleaseEvent:function({originalEvent:n}){if(n.stopPropagation(),!t.isResizable(e.index))return;let i;p.pageX=n.pageX,p.pageY=n.pageY,i="vertical"===e.orientation?p.pageY-p.originalY:p.pageX-p.originalX,t.setSize(d,i)}},c=(e,n)=>({pane:t.getPane(e),nearPane:t.getPane(n)}),v=(e,n,t)=>{var i,o,l,s;return{"devui-collapse":(null==(o=null==(i=null==e?void 0:e.component)?void 0:i.props)?void 0:o.collapsible)&&t,collapsed:null==(s=null==(l=null==e?void 0:e.component)?void 0:l.props)?void 0:s.collapsed,hidden:n.collapsed}},m=n.computed((()=>{var n,t;const{pane:i,nearPane:o}=c(e.index,e.index+1),l="after"!==(null==(t=null==(n=null==i?void 0:i.component)?void 0:n.props)?void 0:t.collapseDirection)||0===e.index;return v(i,o,l)})),f=n.computed((()=>{var n,i;const{pane:o,nearPane:l}=c(e.index+1,e.index),s="before"!==(null==(i=null==(n=null==o?void 0:o.component)?void 0:n.props)?void 0:i.collapseDirection)||e.index+1===t.state.paneCount-1;return v(o,l,s)})),g=()=>{var n,t,i,o;const{pane:a,nearPane:p}=c(e.index,e.index+1);(null==(t=null==(n=null==a?void 0:a.component)?void 0:n.props)?void 0:t.collapsed)||(null==(o=null==(i=null==p?void 0:p.component)?void 0:i.props)?void 0:o.collapsed)?l(r.value,"none-resizable"):s(r.value,"none-resizable")},h=n=>{t.tooglePane(e.index,e.index+1,n),g()},z=n=>{t.tooglePane(e.index+1,e.index,n),g()};return n.onMounted((()=>{h(!0),z(!0)})),()=>n.withDirectives(n.createVNode("div",{class:o.wrapperClass,ref:r},[e.showCollapseButton?n.createVNode("div",{class:["prev",m.value],onClick:()=>{h()}},null):null,n.createVNode("div",{class:"devui-resize-handle"},null),e.showCollapseButton?n.createVNode("div",{class:["next",f.value],onClick:()=>z()},null):null]),[[a,u]])}});class m{constructor(){__publicField(this,"state"),this.state=n.reactive({panes:[],splitterContainerSize:0,paneCount:0})}setPanes({panes:e}){this.state.panes=e.map(((e,n)=>{var t;return e.component&&(e.component.exposed.order.value=2*n),e.getPaneSize=null==(t=null==e?void 0:e.component)?void 0:t.exposed.getPaneSize,e})),this.state.paneCount=e.length}setSplitter({containerSize:e}){this.state.splitterContainerSize=e}getPane(e){if(!this.state.panes||e<0||e>=this.state.panes.length)throw new Error("no pane can return.");return this.state.panes[e]}dragState(e){const n=this.getPane(e),t=this.getPane(e+1),i=n.getPaneSize()+t.getPaneSize();return{prev:{index:e,initialSize:n.getPaneSize(),minSize:this.toPixels(n.component.props.minSize)||i-this.toPixels(t.component.props.maxSize)||0,maxSize:this.toPixels(n.component.props.maxSize)||i-this.toPixels(t.component.props.minSize)||i},next:{index:e+1,initialSize:t.getPaneSize(),minSize:this.toPixels(t.component.props.minSize)||i-this.toPixels(n.component.props.maxSize)||0,maxSize:this.toPixels(t.component.props.maxSize)||i-this.toPixels(n.component.props.minSize)||i}}}clamp(e,n,t){return Math.min(n,Math.max(e,t))}resize(e,n){const t=this.getPane(e.index),i=this.state.splitterContainerSize,o=this.clamp(e.minSize,e.maxSize,e.initialSize+n);let l="";l=this.isPercent(t.component.props.size)?o/i*100+"%":o+"px",t.component.props.size=l,t.component.emit("sizeChange",l)}isResizable(e){var n,t,i,o,l,s,a,r;const p=this.getPane(e),d=this.getPane(e+1),u=(null==(t=null==(n=null==p?void 0:p.component)?void 0:n.props)?void 0:t.collapsed)||(null==(o=null==(i=null==d?void 0:d.component)?void 0:i.props)?void 0:o.collapsed);return(null==(s=null==(l=null==p?void 0:p.component)?void 0:l.props)?void 0:s.resizable)&&(null==(r=null==(a=null==d?void 0:d.component)?void 0:a.props)?void 0:r.resizable)&&!u}isStaticBar(e){var n,t,i,o;const l=this.getPane(e),s=this.getPane(e+1);return!((null==(t=null==(n=null==l?void 0:l.component)?void 0:n.props)?void 0:t.resizable)&&(null==(o=null==(i=null==s?void 0:s.component)?void 0:i.props)?void 0:o.resizable))}isPercent(e){return/%$/.test(e)}toPixels(e){let n=parseFloat(e);return this.isPercent(e)&&(n=this.state.splitterContainerSize*n/100),n}tooglePane(e,n,t){var i,o,l,s,a,r,p,d,u,c,v,m,f;const g=this.getPane(e),h=this.getPane(n);(null==(o=null==(i=null==g?void 0:g.component)?void 0:i.props)?void 0:o.collapsible)&&(g.component.props.collapsed=t?null==(s=null==(l=null==g?void 0:g.component)?void 0:l.props)?void 0:s.collapsed:!(null==(r=null==(a=null==g?void 0:g.component)?void 0:a.props)?void 0:r.collapsed),null==(c=null==(p=null==h?void 0:h.component)?void 0:p.exposed)||c.toggleNearPaneFlexGrow(null==(u=null==(d=null==g?void 0:g.component)?void 0:d.props)?void 0:u.collapsed),null==(f=null==g?void 0:g.component)||f.emit("collapsedChange",null==(m=null==(v=null==g?void 0:g.component)?void 0:v.props)?void 0:m.collapsed))}setSize(e,n){const t=this.getPane(e.prev.index),i=this.getPane(e.next.index);t.component.props.size&&i.component.props.size?(this.resize(e.prev,n),this.resize(e.next,-n)):i.component.props.size?this.resize(e.next,-n):this.resize(e.prev,n)}}var f=n.defineComponent({name:"DSplitter",components:{DSplitterBar:v},props:t,emits:[],setup(e,t){var i,o;const l=new m,s=n.reactive({panes:[]});s.panes=(null==(o=(i=t.slots).DSplitterPane)?void 0:o.call(i))||[],l.setPanes({panes:s.panes});const a=n.ref();return n.provide("orientation",e.orientation),n.provide("splitterStore",l),n.onMounted((()=>{n.nextTick((()=>{let n=0;n="vertical"===e.orientation?a.value.clientHeight:a.value.clientWidth,l.setSplitter({containerSize:n})}))})),()=>{const{splitBarSize:t,orientation:i,showCollapseButton:o}=e,l=["devui-splitter",`devui-splitter-${i}`];return n.createVNode("div",{class:l,ref:a},[s.panes,s.panes.filter(((e,n,t)=>n!==t.length-1)).map(((e,l)=>n.createVNode(n.resolveComponent("d-splitter-bar"),{key:l,style:"order: "+(2*l+1),splitBarSize:t,orientation:i,index:l,showCollapseButton:o},null)))])}}});const g={size:{type:String},minSize:{type:String},maxSize:{type:String},resizable:{type:Boolean,default:!0},collapsible:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapseDirection:{type:String,default:"both"},shrink:{type:Boolean,default:!1},shrinkWidth:{type:Number,default:36}};var h=n.defineComponent({name:"DSplitterPane",props:g,emits:["sizeChange","collapsedChange"],setup(e,{slots:t,expose:a}){const r=n.inject("splitterStore"),p=n.ref(),d=n.ref(),u=n.inject("orientation");let c="";n.onMounted((()=>{c=e.size,r.setPanes({panes:r.state.panes})})),n.onUpdated((()=>{r.setPanes({panes:r.state.panes})}));n.onMounted((()=>{n.watch([d,p],(([e,n])=>{n instanceof HTMLElement&&i(n,{order:e})})),n.watch((()=>e.size),(e=>{const n=p.value;n.style.flexBasis=e;const t="devui-splitter-pane-fixed";e?l(n,t):s(n,t)}),{immediate:!0}),n.watch((()=>e.collapsed),(t=>{const o="devui-splitter-pane-hidden";n.nextTick((()=>{const n=p.value;t?l(n,o):s(n,o),t&&e.shrink?(s(n,o),i(n,{flexBasis:`${e.shrinkWidth}px`})):i(n,{flexBasis:c})}))}),{immediate:!0})}));return a({order:d,getPaneSize:()=>{const e=null==p?void 0:p.value;return"vertical"===u?e.offsetHeight:e.offsetWidth},toggleNearPaneFlexGrow:e=>{n.nextTick((()=>{const n="devui-splitter-pane-grow";o(p.value,n)?s(p.value,n):e&&l(p.value,n)}))}}),()=>{var e;return n.createVNode("div",{class:"devui-splitter-pane",ref:p},[null==(e=t.default)?void 0:e.call(t)])}}});f.install=function(e){e.component(f.name,f),e.component(h.name,h)};var z={title:"Splitter 分割器",category:"布局",install(e){e.use(f)}};e.Splitter=f,e.default=z,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
|
|
1
|
+
var U=Object.defineProperty;var _=(g,o,v)=>o in g?U(g,o,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[o]=v;var k=(g,o,v)=>(_(g,typeof o!="symbol"?o+"":o,v),v);(function(g,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(g=typeof globalThis!="undefined"?globalThis:g||self,o(g.index={},g.Vue))})(this,function(g,o){"use strict";const v={orientation:{type:String,default:"horizontal"},splitBarSize:{type:String,default:"2px"},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean,default:!0}};function b(t,e){const i={},s=Object.keys(e);return s.forEach(n=>{i[n]=t.style[n]}),s.forEach(n=>{t.style[n]=e[n]}),i}function R(t,e){return t.classList?t.classList.contains(e):` ${t.className} `.indexOf(` ${e} `)>-1}function X(t,e){t.classList?t.classList.add(e):R(t,e)||(t.className=`${t.className} ${e}`)}function y(t,e){if(t.classList)t.classList.remove(e);else if(R(t,e)){const i=t.className;t.className=` ${i} `.replace(` ${e} `," ")}}const F={mounted(t,{value:e}){t.$value=e,e.enableResize&&H(t)},unmounted(t,{value:e}){e.enableResize&&$(t,"mousedown",L)}};function H(t){N(t,"mousedown",L)}function N(t,e,i){t.addEventListener&&t.addEventListener(e,i)}function $(t,e,i){t.removeEventListener&&t.removeEventListener(e,i)}function L(t){var n;const e=(n=t==null?void 0:t.target)==null?void 0:n.$value;if(!e)return;N(document,"mousemove",i),N(document,"mouseup",s),e.onPressEvent(E(t));function i(p){e.onDragEvent(E(p))}function s(p){$(document,"mousemove",i),$(document,"mouseup",s),e.onReleaseEvent(E(p))}}function E(t){return{pageX:t.pageX,pageY:t.pageY,clientX:t.clientX,clientY:t.clientY,offsetX:t.offsetX,offsetY:t.offsetY,type:t.type,originalEvent:t}}var K="";const T={index:{type:Number},orientation:{type:String,required:!0},splitBarSize:{type:String,required:!0},disabledBarSize:{type:String,default:"1px"},showCollapseButton:{type:Boolean}};var q=o.defineComponent({name:"DSplitterBar",props:T,setup(t){const e=o.inject("splitterStore"),i=o.reactive({wrapperClass:`devui-splitter-bar devui-splitter-bar-${t.orientation}`}),s=o.ref();o.watch([()=>t.splitBarSize,s],([a,c])=>{c instanceof HTMLElement&&b(c,{flexBasis:a})},{immediate:!0}),o.watch([()=>e.state.panes,s],([a,c])=>{e.isStaticBar(t.index)?b(c,{flexBasis:t.disabledBarSize}):i.wrapperClass+=" resizable"},{deep:!0});const n={pageX:0,pageY:0,originalX:0,originalY:0};let p;const d={enableResize:!0,onPressEvent:function({originalEvent:a}){a.stopPropagation(),!!e.isResizable(t.index)&&(p=e.dragState(t.index),n.originalX=a.pageX,n.originalY=a.pageY)},onDragEvent:function({originalEvent:a}){if(a.stopPropagation(),!e.isResizable(t.index))return;n.pageX=a.pageX,n.pageY=a.pageY;let c;t.orientation==="vertical"?c=n.pageY-n.originalY:c=n.pageX-n.originalX,e.setSize(p,c)},onReleaseEvent:function({originalEvent:a}){if(a.stopPropagation(),!e.isResizable(t.index))return;n.pageX=a.pageX,n.pageY=a.pageY;let c;t.orientation==="vertical"?c=n.pageY-n.originalY:c=n.pageX-n.originalX,e.setSize(p,c)}},f=(a,c)=>{const x=e.getPane(a),h=e.getPane(c);return{pane:x,nearPane:h}},z=(a,c,x)=>{var B,M,V,j;const h=((M=(B=a==null?void 0:a.component)==null?void 0:B.props)==null?void 0:M.collapsible)&&x,C=(j=(V=a==null?void 0:a.component)==null?void 0:V.props)==null?void 0:j.collapsed,Y=c.collapsed;return{"devui-collapse":h,collapsed:C,hidden:Y}},m=o.computed(()=>{var h,C;const{pane:a,nearPane:c}=f(t.index,t.index+1),x=((C=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:C.collapseDirection)!=="after"||t.index===0;return z(a,c,x)}),S=o.computed(()=>{var h,C;const{pane:a,nearPane:c}=f(t.index+1,t.index),x=((C=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:C.collapseDirection)!=="before"||t.index+1===e.state.paneCount-1;return z(a,c,x)}),l=()=>{var h,C,Y,B;const{pane:a,nearPane:c}=f(t.index,t.index+1);((C=(h=a==null?void 0:a.component)==null?void 0:h.props)==null?void 0:C.collapsed)||((B=(Y=c==null?void 0:c.component)==null?void 0:Y.props)==null?void 0:B.collapsed)?X(s.value,"none-resizable"):y(s.value,"none-resizable")},r=a=>{e.tooglePane(t.index,t.index+1,a),l()},u=a=>{e.tooglePane(t.index+1,t.index,a),l()},P=()=>{r(!0),u(!0)};return o.onMounted(()=>{P()}),()=>o.withDirectives(o.createVNode("div",{class:i.wrapperClass,ref:s},[t.showCollapseButton?o.createVNode("div",{class:["prev",m.value],onClick:()=>{r()}},null):null,o.createVNode("div",{class:"devui-resize-handle"},null),t.showCollapseButton?o.createVNode("div",{class:["next",S.value],onClick:()=>u()},null):null]),[[F,d]])}});class G{constructor(){k(this,"state");this.state=o.reactive({panes:[],splitterContainerSize:0,paneCount:0})}setPanes({panes:e}){this.state.panes=e.map((i,s)=>{var n;return i.component&&(i.component.exposed.order.value=s*2),i.getPaneSize=(n=i==null?void 0:i.component)==null?void 0:n.exposed.getPaneSize,i}),this.state.paneCount=e.length}setSplitter({containerSize:e}){this.state.splitterContainerSize=e}getPane(e){if(!this.state.panes||e<0||e>=this.state.panes.length)throw new Error("no pane can return.");return this.state.panes[e]}dragState(e){const i=this.getPane(e),s=this.getPane(e+1),n=i.getPaneSize()+s.getPaneSize();return{prev:{index:e,initialSize:i.getPaneSize(),minSize:this.toPixels(i.component.props.minSize)||n-this.toPixels(s.component.props.maxSize)||0,maxSize:this.toPixels(i.component.props.maxSize)||n-this.toPixels(s.component.props.minSize)||n},next:{index:e+1,initialSize:s.getPaneSize(),minSize:this.toPixels(s.component.props.minSize)||n-this.toPixels(i.component.props.maxSize)||0,maxSize:this.toPixels(s.component.props.maxSize)||n-this.toPixels(i.component.props.minSize)||n}}}clamp(e,i,s){return Math.min(i,Math.max(e,s))}resize(e,i){const s=this.getPane(e.index),n=this.state.splitterContainerSize,p=this.clamp(e.minSize,e.maxSize,e.initialSize+i);let d="";this.isPercent(s.component.props.size)?d=p/n*100+"%":d=p+"px",s.component.props.size=d,s.component.emit("sizeChange",d)}isResizable(e){var p,d,f,z,m,S,l,r;const i=this.getPane(e),s=this.getPane(e+1),n=((d=(p=i==null?void 0:i.component)==null?void 0:p.props)==null?void 0:d.collapsed)||((z=(f=s==null?void 0:s.component)==null?void 0:f.props)==null?void 0:z.collapsed);return((S=(m=i==null?void 0:i.component)==null?void 0:m.props)==null?void 0:S.resizable)&&((r=(l=s==null?void 0:s.component)==null?void 0:l.props)==null?void 0:r.resizable)&&!n}isStaticBar(e){var n,p,d,f;const i=this.getPane(e),s=this.getPane(e+1);return!(((p=(n=i==null?void 0:i.component)==null?void 0:n.props)==null?void 0:p.resizable)&&((f=(d=s==null?void 0:s.component)==null?void 0:d.props)==null?void 0:f.resizable))}isPercent(e){return/%$/.test(e)}toPixels(e){let i=parseFloat(e);return this.isPercent(e)&&(i=this.state.splitterContainerSize*i/100),i}tooglePane(e,i,s){var d,f,z,m,S,l,r,u,P,a,c,x,h;const n=this.getPane(e),p=this.getPane(i);((f=(d=n==null?void 0:n.component)==null?void 0:d.props)==null?void 0:f.collapsible)&&(n.component.props.collapsed=s?(m=(z=n==null?void 0:n.component)==null?void 0:z.props)==null?void 0:m.collapsed:!((l=(S=n==null?void 0:n.component)==null?void 0:S.props)==null?void 0:l.collapsed),(a=(r=p==null?void 0:p.component)==null?void 0:r.exposed)==null||a.toggleNearPaneFlexGrow((P=(u=n==null?void 0:n.component)==null?void 0:u.props)==null?void 0:P.collapsed),(h=n==null?void 0:n.component)==null||h.emit("collapsedChange",(x=(c=n==null?void 0:n.component)==null?void 0:c.props)==null?void 0:x.collapsed))}setSize(e,i){const s=this.getPane(e.prev.index),n=this.getPane(e.next.index);s.component.props.size&&n.component.props.size?(this.resize(e.prev,i),this.resize(e.next,-i)):n.component.props.size?this.resize(e.next,-i):this.resize(e.prev,i)}}var A="",w=o.defineComponent({name:"DSplitter",components:{DSplitterBar:q},props:v,emits:[],setup(t,e){var f,z;const i=new G,s=o.reactive({panes:[]});s.panes=((z=(f=e.slots).DSplitterPane)==null?void 0:z.call(f))||[],i.setPanes({panes:s.panes}),o.provide("orientation",t.orientation),o.provide("splitterStore",i);const n=o.ref(),p=()=>{if(!n)return;let m=0;t.orientation==="vertical"?m=n.value.clientHeight:m=n.value.clientWidth,i.setSplitter({containerSize:m})},d=new ResizeObserver(p);return o.watch(n,m=>{!m||(p(),d.observe(n.value))}),o.onUnmounted(()=>{d.disconnect()}),()=>{const{splitBarSize:m,orientation:S,showCollapseButton:l}=t,r=["devui-splitter",`devui-splitter-${S}`];return o.createVNode("div",{class:r,ref:n},[s.panes,s.panes.filter((u,P,a)=>P!==a.length-1).map((u,P)=>o.createVNode(o.resolveComponent("d-splitter-bar"),{key:P,style:`order: ${P*2+1}`,splitBarSize:m,orientation:S,index:P,showCollapseButton:l},null))])}}});const O={size:{type:String},minSize:{type:String},maxSize:{type:String},resizable:{type:Boolean,default:!0},collapsible:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!1},collapseDirection:{type:String,default:"both"},shrink:{type:Boolean,default:!1},shrinkWidth:{type:Number,default:36}};var J="",D=o.defineComponent({name:"DSplitterPane",props:O,emits:["sizeChange","collapsedChange"],setup(t,{slots:e,expose:i}){const s=o.inject("splitterStore"),n=o.ref(),p=o.ref();o.watch([p,n],([l,r])=>{!r||b(r,{order:l})});const d=(l,r)=>{if(!r)return;r.style.flexBasis=l;const u="devui-splitter-pane-fixed";l?X(r,u):y(r,u)};o.watch([()=>t.size,n],([l,r])=>{d(l,r)},{immediate:!0});const f=o.inject("orientation");let z="";o.onMounted(()=>{z=t.size,s.setPanes({panes:s.state.panes})}),o.onUpdated(()=>{s.setPanes({panes:s.state.panes})});const m=()=>{const l=n.value;if(!!l)return f==="vertical"?l.offsetHeight:l.offsetWidth};return o.watch(()=>t.collapsed,l=>{const r=n.value;if(!r)return;const u="devui-splitter-pane-hidden";l?X(r,u):y(r,u),l&&t.shrink?(y(r,u),b(r,{flexBasis:`${t.shrinkWidth}px`})):b(r,{flexBasis:z})},{immediate:!0}),i({order:p,getPaneSize:m,toggleNearPaneFlexGrow:l=>{const r=n.value;if(!(r instanceof HTMLElement))return;const u="devui-splitter-pane-grow";R(r,u)?y(r,u):l&&X(r,u)}}),()=>{var l;return o.createVNode("div",{class:"devui-splitter-pane",ref:n},[(l=e.default)==null?void 0:l.call(e)])}}});w.install=function(t){t.component(w.name,w),t.component(D.name,D)};var W={title:"Splitter \u5206\u5272\u5668",category:"\u5E03\u5C40",status:"100%",install(t){t.use(w)}};g.Splitter=w,g.default=W,Object.defineProperty(g,"__esModule",{value:!0}),g[Symbol.toStringTag]="Module"});
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { defineComponent, ref, computed, onMounted, watch, createVNode, mergeProps } from "vue";
|
|
8
|
+
const statisticProps = {
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
value: {
|
|
14
|
+
type: [Number, String]
|
|
15
|
+
},
|
|
16
|
+
prefix: {
|
|
17
|
+
type: String
|
|
18
|
+
},
|
|
19
|
+
suffix: {
|
|
20
|
+
type: String
|
|
21
|
+
},
|
|
22
|
+
precision: {
|
|
23
|
+
type: Number
|
|
24
|
+
},
|
|
25
|
+
groupSeparator: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ","
|
|
28
|
+
},
|
|
29
|
+
showGroupSeparator: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
titleStyle: {
|
|
34
|
+
type: Object
|
|
35
|
+
},
|
|
36
|
+
contentStyle: {
|
|
37
|
+
type: Object
|
|
38
|
+
},
|
|
39
|
+
animationDuration: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 2e3
|
|
42
|
+
},
|
|
43
|
+
valueFrom: {
|
|
44
|
+
type: Number
|
|
45
|
+
},
|
|
46
|
+
animation: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
start: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
extra: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ""
|
|
57
|
+
},
|
|
58
|
+
easing: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "easeOutCubic"
|
|
61
|
+
},
|
|
62
|
+
delay: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 0
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const separator = (SeparatorString, groupSeparator, showGroupSeparator) => {
|
|
68
|
+
const res = SeparatorString.replace(/\d+/, function(n) {
|
|
69
|
+
return n.replace(/(\d)(?=(\d{3})+$)/g, function($1) {
|
|
70
|
+
return $1 + `${showGroupSeparator ? groupSeparator : ""}`;
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return res;
|
|
74
|
+
};
|
|
75
|
+
const isHasDot = (value) => {
|
|
76
|
+
if (!isNaN(value)) {
|
|
77
|
+
return (value + "").indexOf(".") !== -1;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const analysisValueType = (value, propsValue, groupSeparator, splitPrecisionNumber, showGroupSeparator) => {
|
|
81
|
+
const fixedNumber = propsValue.toString().indexOf(".") !== -1 ? propsValue.toString().length - propsValue.toString().indexOf(".") - 1 : 0;
|
|
82
|
+
if (typeof value === "number") {
|
|
83
|
+
if (isHasDot(value)) {
|
|
84
|
+
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toFixed(fixedNumber).toString(), groupSeparator, showGroupSeparator);
|
|
85
|
+
} else {
|
|
86
|
+
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toString(), groupSeparator, showGroupSeparator);
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const pow = Math.pow;
|
|
93
|
+
const sqrt = Math.sqrt;
|
|
94
|
+
const easeOutCubic = function(x) {
|
|
95
|
+
return 1 - pow(1 - x, 3);
|
|
96
|
+
};
|
|
97
|
+
const linear = (x) => x;
|
|
98
|
+
const easeOutExpo = function(x) {
|
|
99
|
+
return x === 1 ? 1 : 1 - pow(2, -10 * x);
|
|
100
|
+
};
|
|
101
|
+
const easeInOutExpo = function(x) {
|
|
102
|
+
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
|
|
103
|
+
};
|
|
104
|
+
const easeInExpo = function(x) {
|
|
105
|
+
return x === 0 ? 0 : pow(2, 10 * x - 10);
|
|
106
|
+
};
|
|
107
|
+
const easeInOutCirc = function(x) {
|
|
108
|
+
return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
|
|
109
|
+
};
|
|
110
|
+
var easing = /* @__PURE__ */ Object.freeze({
|
|
111
|
+
__proto__: null,
|
|
112
|
+
[Symbol.toStringTag]: "Module",
|
|
113
|
+
easeOutCubic,
|
|
114
|
+
linear,
|
|
115
|
+
easeOutExpo,
|
|
116
|
+
easeInOutExpo,
|
|
117
|
+
easeInExpo,
|
|
118
|
+
easeInOutCirc
|
|
119
|
+
});
|
|
120
|
+
class Tween {
|
|
121
|
+
constructor(options) {
|
|
122
|
+
__publicField(this, "from");
|
|
123
|
+
__publicField(this, "to");
|
|
124
|
+
__publicField(this, "duration");
|
|
125
|
+
__publicField(this, "delay");
|
|
126
|
+
__publicField(this, "easing");
|
|
127
|
+
__publicField(this, "onStart");
|
|
128
|
+
__publicField(this, "onUpdate");
|
|
129
|
+
__publicField(this, "onFinish");
|
|
130
|
+
__publicField(this, "startTime");
|
|
131
|
+
__publicField(this, "started");
|
|
132
|
+
__publicField(this, "finished");
|
|
133
|
+
__publicField(this, "timer");
|
|
134
|
+
__publicField(this, "time");
|
|
135
|
+
__publicField(this, "elapsed");
|
|
136
|
+
__publicField(this, "keys");
|
|
137
|
+
const { from, to, duration, delay, easing: easing2, onStart, onUpdate, onFinish } = options;
|
|
138
|
+
for (const key in from) {
|
|
139
|
+
if (to[key] === void 0) {
|
|
140
|
+
to[key] = from[key];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (const key in to) {
|
|
144
|
+
if (from[key] === void 0) {
|
|
145
|
+
from[key] = to[key];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
this.from = from;
|
|
149
|
+
this.to = to;
|
|
150
|
+
this.duration = duration;
|
|
151
|
+
this.delay = delay;
|
|
152
|
+
this.easing = easing2;
|
|
153
|
+
this.onStart = onStart;
|
|
154
|
+
this.onUpdate = onUpdate;
|
|
155
|
+
this.onFinish = onFinish;
|
|
156
|
+
this.startTime = Date.now() + this.delay;
|
|
157
|
+
this.started = false;
|
|
158
|
+
this.finished = false;
|
|
159
|
+
this.timer = null;
|
|
160
|
+
this.keys = {};
|
|
161
|
+
}
|
|
162
|
+
update() {
|
|
163
|
+
this.time = Date.now();
|
|
164
|
+
if (this.time < this.startTime) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (this.finished) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (this.elapsed === this.duration) {
|
|
171
|
+
if (!this.finished) {
|
|
172
|
+
this.finished = true;
|
|
173
|
+
this.onFinish && this.onFinish(this.keys);
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.elapsed = this.time - this.startTime;
|
|
178
|
+
this.elapsed = this.elapsed > this.duration ? this.duration : this.elapsed;
|
|
179
|
+
for (const key in this.to) {
|
|
180
|
+
this.keys[key] = this.from[key] + (this.to[key] - this.from[key]) * easing[this.easing](this.elapsed / this.duration);
|
|
181
|
+
}
|
|
182
|
+
if (!this.started) {
|
|
183
|
+
this.onStart && this.onStart(this.keys);
|
|
184
|
+
this.started = true;
|
|
185
|
+
}
|
|
186
|
+
this.onUpdate(this.keys);
|
|
187
|
+
}
|
|
188
|
+
start() {
|
|
189
|
+
this.startTime = Date.now() + this.delay;
|
|
190
|
+
const tick = () => {
|
|
191
|
+
this.update();
|
|
192
|
+
this.timer = requestAnimationFrame(tick);
|
|
193
|
+
if (this.finished) {
|
|
194
|
+
cancelAnimationFrame(this.timer);
|
|
195
|
+
this.timer = null;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
tick();
|
|
199
|
+
}
|
|
200
|
+
stop() {
|
|
201
|
+
cancelAnimationFrame(this.timer);
|
|
202
|
+
this.timer = null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var statistic = "";
|
|
206
|
+
var Statistic = defineComponent({
|
|
207
|
+
name: "DStatistic",
|
|
208
|
+
inheritAttrs: false,
|
|
209
|
+
props: statisticProps,
|
|
210
|
+
setup(props, ctx) {
|
|
211
|
+
var _a;
|
|
212
|
+
const innerValue = ref((_a = props.valueFrom) != null ? _a : props.value);
|
|
213
|
+
const tween = ref(null);
|
|
214
|
+
const animation = (from = ((_b) => (_b = props.valueFrom) != null ? _b : 0)(), to = typeof props.value === "number" ? props.value : Number(props.value)) => {
|
|
215
|
+
if (from !== to) {
|
|
216
|
+
tween.value = new Tween({
|
|
217
|
+
from: {
|
|
218
|
+
value: from
|
|
219
|
+
},
|
|
220
|
+
to: {
|
|
221
|
+
value: to
|
|
222
|
+
},
|
|
223
|
+
delay: props.delay,
|
|
224
|
+
duration: props.animationDuration,
|
|
225
|
+
easing: props.easing,
|
|
226
|
+
onUpdate: (keys) => {
|
|
227
|
+
innerValue.value = keys.value;
|
|
228
|
+
},
|
|
229
|
+
onFinish: () => {
|
|
230
|
+
innerValue.value = to;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
tween.value.start();
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const statisticValue = computed(() => {
|
|
237
|
+
return analysisValueType(innerValue.value, props.value, props.groupSeparator, props.precision, props.showGroupSeparator);
|
|
238
|
+
});
|
|
239
|
+
onMounted(() => {
|
|
240
|
+
if (props.animation && props.start) {
|
|
241
|
+
animation();
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
watch(() => props.start, (value) => {
|
|
245
|
+
if (value && !tween.value) {
|
|
246
|
+
animation();
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
return () => {
|
|
250
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
251
|
+
return createVNode("div", mergeProps({
|
|
252
|
+
"class": "devui-statistic"
|
|
253
|
+
}, ctx.attrs), [createVNode("div", {
|
|
254
|
+
"class": "devui-statistic-title",
|
|
255
|
+
"style": props.titleStyle
|
|
256
|
+
}, [((_b = (_a2 = ctx.slots).title) == null ? void 0 : _b.call(_a2)) || props.title]), createVNode("div", {
|
|
257
|
+
"class": "devui-statistic-content",
|
|
258
|
+
"style": props.contentStyle
|
|
259
|
+
}, [props.prefix || ((_d = (_c = ctx.slots).prefix) == null ? void 0 : _d.call(_c)) ? createVNode("span", {
|
|
260
|
+
"class": "devui-statistic-prefix"
|
|
261
|
+
}, [((_f = (_e = ctx.slots).prefix) == null ? void 0 : _f.call(_e)) || props.prefix]) : null, createVNode("span", {
|
|
262
|
+
"class": "devui-statistic--value"
|
|
263
|
+
}, [statisticValue.value]), props.suffix || ((_h = (_g = ctx.slots).suffix) == null ? void 0 : _h.call(_g)) ? createVNode("span", {
|
|
264
|
+
"class": "devui-statistic-suffix"
|
|
265
|
+
}, [((_j = (_i = ctx.slots).suffix) == null ? void 0 : _j.call(_i)) || props.suffix]) : null]), ((_l = (_k = ctx.slots).extra) == null ? void 0 : _l.call(_k)) || props.extra]);
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
Statistic.install = function(app) {
|
|
270
|
+
app.component(Statistic.name, Statistic);
|
|
271
|
+
};
|
|
272
|
+
var index = {
|
|
273
|
+
title: "Statistic \u7EDF\u8BA1\u6570\u503C",
|
|
274
|
+
category: "\u6570\u636E\u5C55\u793A",
|
|
275
|
+
status: "100%",
|
|
276
|
+
install(app) {
|
|
277
|
+
app.use(Statistic);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
export { Statistic, index as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var q=Object.defineProperty;var B=(a,e,f)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[e]=f;var s=(a,e,f)=>(B(a,typeof e!="symbol"?e+"":e,f),f);(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";const f={title:{type:String,default:""},value:{type:[Number,String]},prefix:{type:String},suffix:{type:String},precision:{type:Number},groupSeparator:{type:String,default:","},showGroupSeparator:{type:Boolean,default:!1},titleStyle:{type:Object},contentStyle:{type:Object},animationDuration:{type:Number,default:2e3},valueFrom:{type:Number},animation:{type:Boolean,default:!1},start:{type:Boolean,default:!1},extra:{type:String,default:""},easing:{type:String,default:"easeOutCubic"},delay:{type:Number,default:0}},g=(t,i,n)=>t.replace(/\d+/,function(u){return u.replace(/(\d)(?=(\d{3})+$)/g,function(h){return h+`${n?i:""}`})}),w=t=>{if(!isNaN(t))return(t+"").indexOf(".")!==-1},C=(t,i,n,r,u)=>{const h=i.toString().indexOf(".")!==-1?i.toString().length-i.toString().indexOf(".")-1:0;return typeof t=="number"?w(t)?g(r?t.toFixed(r).toString():t.toFixed(h).toString(),n,u):g(r?t.toFixed(r).toString():t.toString(),n,u):t},c=Math.pow,v=Math.sqrt,D=function(t){return 1-c(1-t,3)},E=t=>t,V=function(t){return t===1?1:1-c(2,-10*t)},A=function(t){return t===0?0:t===1?1:t<.5?c(2,20*t-10)/2:(2-c(2,-20*t+10))/2},I=function(t){return t===0?0:c(2,10*t-10)},M=function(t){return t<.5?(1-v(1-c(2*t,2)))/2:(v(1-c(-2*t+2,2))+1)/2};var _=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",easeOutCubic:D,linear:E,easeOutExpo:V,easeInOutExpo:A,easeInExpo:I,easeInOutCirc:M});class j{constructor(i){s(this,"from");s(this,"to");s(this,"duration");s(this,"delay");s(this,"easing");s(this,"onStart");s(this,"onUpdate");s(this,"onFinish");s(this,"startTime");s(this,"started");s(this,"finished");s(this,"timer");s(this,"time");s(this,"elapsed");s(this,"keys");const{from:n,to:r,duration:u,delay:h,easing:S,onStart:l,onUpdate:d,onFinish:m}=i;for(const o in n)r[o]===void 0&&(r[o]=n[o]);for(const o in r)n[o]===void 0&&(n[o]=r[o]);this.from=n,this.to=r,this.duration=u,this.delay=h,this.easing=S,this.onStart=l,this.onUpdate=d,this.onFinish=m,this.startTime=Date.now()+this.delay,this.started=!1,this.finished=!1,this.timer=null,this.keys={}}update(){if(this.time=Date.now(),!(this.time<this.startTime)&&!this.finished){if(this.elapsed===this.duration){this.finished||(this.finished=!0,this.onFinish&&this.onFinish(this.keys));return}this.elapsed=this.time-this.startTime,this.elapsed=this.elapsed>this.duration?this.duration:this.elapsed;for(const i in this.to)this.keys[i]=this.from[i]+(this.to[i]-this.from[i])*_[this.easing](this.elapsed/this.duration);this.started||(this.onStart&&this.onStart(this.keys),this.started=!0),this.onUpdate(this.keys)}}start(){this.startTime=Date.now()+this.delay;const i=()=>{this.update(),this.timer=requestAnimationFrame(i),this.finished&&(cancelAnimationFrame(this.timer),this.timer=null)};i()}stop(){cancelAnimationFrame(this.timer),this.timer=null}}var $="",y=e.defineComponent({name:"DStatistic",inheritAttrs:!1,props:f,setup(t,i){var S;const n=e.ref((S=t.valueFrom)!=null?S:t.value),r=e.ref(null),u=(l=(m=>(m=t.valueFrom)!=null?m:0)(),d=typeof t.value=="number"?t.value:Number(t.value))=>{l!==d&&(r.value=new j({from:{value:l},to:{value:d},delay:t.delay,duration:t.animationDuration,easing:t.easing,onUpdate:o=>{n.value=o.value},onFinish:()=>{n.value=d}}),r.value.start())},h=e.computed(()=>C(n.value,t.value,t.groupSeparator,t.precision,t.showGroupSeparator));return e.onMounted(()=>{t.animation&&t.start&&u()}),e.watch(()=>t.start,l=>{l&&!r.value&&u()}),()=>{var l,d,m,o,x,F,O,b,p,N,T,k;return e.createVNode("div",e.mergeProps({class:"devui-statistic"},i.attrs),[e.createVNode("div",{class:"devui-statistic-title",style:t.titleStyle},[((d=(l=i.slots).title)==null?void 0:d.call(l))||t.title]),e.createVNode("div",{class:"devui-statistic-content",style:t.contentStyle},[t.prefix||((o=(m=i.slots).prefix)==null?void 0:o.call(m))?e.createVNode("span",{class:"devui-statistic-prefix"},[((F=(x=i.slots).prefix)==null?void 0:F.call(x))||t.prefix]):null,e.createVNode("span",{class:"devui-statistic--value"},[h.value]),t.suffix||((b=(O=i.slots).suffix)==null?void 0:b.call(O))?e.createVNode("span",{class:"devui-statistic-suffix"},[((N=(p=i.slots).suffix)==null?void 0:N.call(p))||t.suffix]):null]),((k=(T=i.slots).extra)==null?void 0:k.call(T))||t.extra])}}});y.install=function(t){t.component(y.name,y)};var U={title:"Statistic \u7EDF\u8BA1\u6570\u503C",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.use(y)}};a.Statistic=y,a.default=U,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.devui-statistic{box-sizing:border-box;margin:0;padding:0;font-size:14px;line-height:1.5715;list-style:none}.devui-statistic-title{margin-bottom:4px;opacity:.7;font-size:14px}.devui-statistic-content{font-size:24px;display:flex;align-items:center}.devui-statistic-prefix{margin-right:6px;display:flex}.devui-statistic-suffix{margin-left:6px;display:flex}.devui-statistic--value{display:inline-block}
|
package/status/index.es.js
CHANGED
|
@@ -1 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, computed, createVNode } from "vue";
|
|
2
|
+
var status = "";
|
|
3
|
+
var Status = defineComponent({
|
|
4
|
+
name: "DStatus",
|
|
5
|
+
props: {
|
|
6
|
+
type: {
|
|
7
|
+
default: "invalid",
|
|
8
|
+
type: String
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
setup(props, ctx) {
|
|
12
|
+
const typeClass = computed(() => {
|
|
13
|
+
const {
|
|
14
|
+
type
|
|
15
|
+
} = props;
|
|
16
|
+
const typeStatus = ["success", "error", "initial", "warning", "waiting", "running", "invalid"];
|
|
17
|
+
let typeClassStr = `devui-status devui-status-bg-invalid`;
|
|
18
|
+
if (typeStatus.includes(type)) {
|
|
19
|
+
typeClassStr = `devui-status devui-status-bg-${type}`;
|
|
20
|
+
}
|
|
21
|
+
return typeClassStr;
|
|
22
|
+
});
|
|
23
|
+
return () => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return createVNode("span", {
|
|
26
|
+
"class": typeClass.value
|
|
27
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Status.install = function(app) {
|
|
32
|
+
app.component(Status.name, Status);
|
|
33
|
+
};
|
|
34
|
+
var index = {
|
|
35
|
+
title: "Status \u72B6\u6001",
|
|
36
|
+
category: "\u901A\u7528",
|
|
37
|
+
status: "100%",
|
|
38
|
+
install(app) {
|
|
39
|
+
app.use(Status);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export { Status, index as default };
|
package/status/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";var l="",n=e.defineComponent({name:"DStatus",props:{type:{default:"invalid",type:String}},setup(u,o){const r=e.computed(()=>{const{type:s}=u,i=["success","error","initial","warning","waiting","running","invalid"];let a="devui-status devui-status-bg-invalid";return i.includes(s)&&(a=`devui-status devui-status-bg-${s}`),a});return()=>{var s,i;return e.createVNode("span",{class:r.value},[(i=(s=o.slots).default)==null?void 0:i.call(s)])}}});n.install=function(u){u.component(n.name,n)};var d={title:"Status \u72B6\u6001",category:"\u901A\u7528",status:"100%",install(u){u.use(n)}};t.Status=n,t.default=d,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
|