xt-element-ui 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -192
- package/docs/README.md +162 -88
- package/docs/components/base/theme.md +248 -0
- package/docs/components/base/xt-list.md +1 -1
- package/docs/components/base/xt-scroll-arrow.md +87 -1
- package/docs/components/base/xt-scroll.md +237 -0
- package/docs/components/utils/config.md +18 -4
- package/docs/components/utils/theme.md +280 -183
- package/lib/index.common.1.js +4 -26
- package/lib/index.common.2.js +1 -1
- package/lib/index.common.js +1871 -671
- package/lib/index.css +1 -1
- package/lib/index.umd.1.js +4 -26
- package/lib/index.umd.2.js +1 -1
- package/lib/index.umd.js +1871 -671
- package/lib/index.umd.min.1.js +1 -1
- package/lib/index.umd.min.js +1 -1
- package/lib/theme/element-overrides.css +607 -0
- package/lib/theme/element-vars.css +280 -0
- package/lib/xt-badge/xt-badge.common.js +1 -1
- package/lib/xt-badge/xt-badge.umd.js +1 -1
- package/lib/xt-button/xt-button.common.js +1 -1
- package/lib/xt-button/xt-button.umd.js +1 -1
- package/lib/xt-card/xt-card.common.js +1 -1
- package/lib/xt-card/xt-card.umd.js +1 -1
- package/lib/xt-card-item/xt-card-item.common.js +1 -1
- package/lib/xt-card-item/xt-card-item.umd.js +1 -1
- package/lib/xt-chart/xt-chart.common.js +5 -5
- package/lib/xt-chart/xt-chart.umd.js +5 -5
- package/lib/xt-config-provider/xt-config-provider.css +1 -1
- package/lib/xt-date-picker/xt-date-picker.common.1.js +4 -26
- package/lib/xt-date-picker/xt-date-picker.common.2.js +1 -1
- package/lib/xt-date-picker/xt-date-picker.common.js +1 -47
- package/lib/xt-date-picker/xt-date-picker.css +1 -1
- package/lib/xt-date-picker/xt-date-picker.umd.1.js +4 -26
- package/lib/xt-date-picker/xt-date-picker.umd.2.js +1 -1
- package/lib/xt-date-picker/xt-date-picker.umd.js +1 -47
- package/lib/xt-date-picker/xt-date-picker.umd.min.1.js +1 -1
- package/lib/xt-date-picker/xt-date-picker.umd.min.js +1 -1
- package/lib/xt-flex-box/xt-flex-box.common.js +1 -1
- package/lib/xt-flex-box/xt-flex-box.umd.js +1 -1
- package/lib/xt-flow/xt-flow.common.js +1 -1
- package/lib/xt-flow/xt-flow.umd.js +1 -1
- package/lib/xt-form-schema/xt-form-schema.common.js +1 -1
- package/lib/xt-form-schema/xt-form-schema.umd.js +1 -1
- package/lib/xt-grid-box/xt-grid-box.common.js +1 -1
- package/lib/xt-grid-box/xt-grid-box.umd.js +1 -1
- package/lib/xt-grid-item/xt-grid-item.common.js +1 -1
- package/lib/xt-grid-item/xt-grid-item.umd.js +1 -1
- package/lib/xt-icon/xt-icon.common.js +1 -1
- package/lib/xt-icon/xt-icon.umd.js +1 -1
- package/lib/xt-input/xt-input.common.js +1 -1
- package/lib/xt-input/xt-input.umd.js +1 -1
- package/lib/xt-list/xt-list.common.js +457 -118
- package/lib/xt-list/xt-list.css +1 -1
- package/lib/xt-list/xt-list.umd.js +457 -118
- package/lib/xt-list/xt-list.umd.min.js +1 -1
- package/lib/xt-map/xt-map.common.js +1 -1
- package/lib/xt-map/xt-map.umd.js +1 -1
- package/lib/xt-map-provider/xt-map-provider.common.js +1 -1
- package/lib/xt-map-provider/xt-map-provider.umd.js +1 -1
- package/lib/xt-page/xt-page.common.js +1 -1
- package/lib/xt-page/xt-page.umd.js +1 -1
- package/lib/xt-progress/xt-progress.common.js +1 -1
- package/lib/xt-progress/xt-progress.umd.js +1 -1
- package/lib/xt-scroll/demo.html +10 -0
- package/lib/xt-scroll/index.js +1 -0
- package/lib/xt-scroll/xt-scroll.common.js +551 -0
- package/lib/xt-scroll/xt-scroll.css +1 -0
- package/lib/xt-scroll/xt-scroll.umd.js +561 -0
- package/lib/xt-scroll/xt-scroll.umd.min.js +1 -0
- package/lib/xt-scroll-arrow/xt-scroll-arrow.common.js +591 -170
- package/lib/xt-scroll-arrow/xt-scroll-arrow.css +1 -1
- package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.js +591 -170
- package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.min.js +1 -1
- package/lib/xt-select-tree/xt-select-tree.common.js +1 -1
- package/lib/xt-select-tree/xt-select-tree.umd.js +1 -1
- package/lib/xt-step-price/xt-step-price.common.js +2 -2
- package/lib/xt-step-price/xt-step-price.umd.js +2 -2
- package/lib/xt-step-price-item/xt-step-price-item.common.js +1 -1
- package/lib/xt-step-price-item/xt-step-price-item.umd.js +1 -1
- package/lib/xt-tab-pane/xt-tab-pane.common.js +1 -1
- package/lib/xt-tab-pane/xt-tab-pane.umd.js +1 -1
- package/lib/xt-table/xt-table.common.js +2 -2
- package/lib/xt-table/xt-table.umd.js +2 -2
- package/lib/xt-tabs/xt-tabs.common.js +1 -1
- package/lib/xt-tabs/xt-tabs.umd.js +1 -1
- package/lib/xt-text/xt-text.common.js +1 -1
- package/lib/xt-text/xt-text.umd.js +1 -1
- package/lib/xt-time/xt-time.common.js +1 -1
- package/lib/xt-time/xt-time.umd.js +1 -1
- package/lib/xt-transfer-tree/xt-transfer-tree.common.js +1 -1
- package/lib/xt-transfer-tree/xt-transfer-tree.umd.js +1 -1
- package/lib/xt-upload/xt-upload.common.js +2 -2
- package/lib/xt-upload/xt-upload.umd.js +2 -2
- package/package.json +5 -3
- package/src/components/index.scss +3 -0
- package/src/components/theme/element-overrides.css +607 -0
- package/src/components/theme/element-vars.css +280 -0
- package/src/components/theme/iframe-injector.js +502 -0
- package/src/components/theme/index.js +64 -0
- package/src/components/xt-config-provider/style/index.scss +0 -11
- package/src/components/xt-date-picker/component/RangeDate.vue +1 -29
- package/src/components/xt-date-picker/style/index.scss +80 -53
- package/src/components/xt-list/index.vue +23 -12
- package/src/components/xt-scroll/index.js +9 -0
- package/src/components/xt-scroll/index.vue +363 -0
- package/src/components/xt-scroll/style/index.scss +107 -0
- package/src/components/xt-scroll-arrow/index.vue +200 -83
- package/src/components/xt-scroll-arrow/style/index.scss +16 -5
- package/src/index.js +9 -2
- package/src/utils/color.js +105 -0
- package/src/utils/index.js +456 -468
- package/src/utils/theme-vars.js +134 -0
- package/lib/css/1.87a493be.css +0 -1
- package/lib/xt-date-picker/css/1.87a493be.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["xt-list"]=e():t["xt-list"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(r,s,function(e){return t[e]}.bind(null,s));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s="fb15")}({"732a":function(t,e,i){"use strict";i("e895")},e895:function(t,e,i){},fb15:function(t,e,i){"use strict";if(i.r(e),i.d(e,"XtList",(function(){return h})),"undefined"!==typeof window){var r=window.document.currentScript,s=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);s&&(i.p=s[1])}var a=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-list",class:{"xt-list--loading":t.loading}},[t.title||t.filterable||t.sortable||t.$slots.toolbar?e("div",{staticClass:"xt-list__header"},[t.title?e("span",{staticClass:"xt-list__title"},[t._v(t._s(t.title))]):t._e(),e("div",{staticClass:"xt-list__toolbar"},[t.filterable?e("div",{staticClass:"xt-list__search"},[e("el-input",{attrs:{placeholder:t.filterPlaceholder,size:"small",clearable:"","prefix-icon":"el-icon-search"},on:{input:t.handleSearch},model:{value:t.searchText,callback:function(e){t.searchText=e},expression:"searchText"}})],1):t._e(),t.sortable&&t.sortBy?e("el-button",{attrs:{size:"small",icon:"el-icon-sort",type:t.currentSortOrder?"primary":"default",plain:""},on:{click:t.handleSortToggle}},[t._v(" "+t._s(t.sortLabel)+" ")]):t._e(),t._t("toolbar")],2)]):t._e(),e("div",{ref:"scrollContainer",staticClass:"xt-list__body",style:t.bodyStyle,on:{scroll:t.onScroll}},[t.virtualScroll?e("div",{staticClass:"xt-list__phantom",style:{height:t.totalHeight+"px"}},[e("div",{style:{paddingTop:t.offsetY+"px"}},[t.groupedData.length?[t._l(t.visibleGroups,(function(i,r){return[e("div",{key:i._key,staticClass:"xt-list__group"},[e("div",{staticClass:"xt-list__group-title",on:{click:function(e){return t.toggleGroup(i._key)}}},[e("span",{staticClass:"xt-list__group-arrow",class:{"is-expanded":i._expanded}},[e("i",{staticClass:"el-icon-arrow-right"})]),t._t("group-title",(function(){return[e("span",{staticClass:"xt-list__group-label"},[t._v(t._s(t.getGroupLabel(i)))]),e("span",{staticClass:"xt-list__group-count"},[t._v("("+t._s(i._items.length)+")")])]}),{group:i,items:i._items,expanded:i._expanded})],2),i._expanded?e("div",{class:["xt-list__cards","xt-list__cols-"+t.columns]},t._l(t.getVisibleItems(i),(function(r,s){return e("div",{key:r._id||s,staticClass:"xt-list__item",on:{click:function(e){return t.handleItemClick(r,i._key)}}},[e("el-card",{attrs:{shadow:t.shadow,"body-style":t.cardBodyStyle}},[t._t("default",(function(){return[t.getImage(r)?e("div",{staticClass:"xt-list__image"},[e("img",{attrs:{src:t.getImage(r),alt:t.getConfigValue(t.cardConfig.title,r)}})]):t._e(),t.getTag(r)?e("div",{staticClass:"xt-list__tag"},[e("el-tag",{attrs:{size:"small",type:t.getTagType(r)}},[t._v(t._s(t.getTag(r)))])],1):t._e(),t.getConfigValue(t.cardConfig.title,r)?e("div",{staticClass:"xt-list__card-title"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.title,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.subtitle,r)?e("div",{staticClass:"xt-list__card-subtitle"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.subtitle,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.content,r)?e("div",{staticClass:"xt-list__card-content"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.content,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.footer,r)?e("div",{staticClass:"xt-list__card-footer"},[t._t("card-footer",(function(){return[t._v(" "+t._s(t.getConfigValue(t.cardConfig.footer,r))+" ")]}),{item:r,index:t.getItemIndex(r,i)})],2):t._e()]}),{item:r,index:t.getItemIndex(r,i),group:i})],2)],1)})),0):t._e()])]}))]:t.loading?t._e():e("div",{staticClass:"xt-list__empty"},[t._t("empty",(function(){return[e("span",[t._v(t._s(t.emptyText))])]}))],2)],2)]):t.groupedData.length?[t._l(t.groupedData,(function(i){return[e("div",{key:i._key,staticClass:"xt-list__group"},[e("div",{staticClass:"xt-list__group-title",on:{click:function(e){return t.toggleGroup(i._key)}}},[e("span",{staticClass:"xt-list__group-arrow",class:{"is-expanded":i._expanded}},[e("i",{staticClass:"el-icon-arrow-right"})]),t._t("group-title",(function(){return[e("span",{staticClass:"xt-list__group-label"},[t._v(t._s(t.getGroupLabel(i)))]),e("span",{staticClass:"xt-list__group-count"},[t._v("("+t._s(i._items.length)+")")])]}),{group:i,items:i._items,expanded:i._expanded})],2),i._expanded?e("div",{class:["xt-list__cards","xt-list__cols-"+t.columns]},t._l(i._items,(function(r,s){return e("div",{key:r._id||s,staticClass:"xt-list__item",on:{click:function(e){return t.handleItemClick(r,i._key)}}},[e("el-card",{attrs:{shadow:t.shadow,"body-style":t.cardBodyStyle}},[t._t("default",(function(){return[t.getImage(r)?e("div",{staticClass:"xt-list__image"},[e("img",{attrs:{src:t.getImage(r),alt:t.getConfigValue(t.cardConfig.title,r)}})]):t._e(),t.getTag(r)?e("div",{staticClass:"xt-list__tag"},[e("el-tag",{attrs:{size:"small",type:t.getTagType(r)}},[t._v(t._s(t.getTag(r)))])],1):t._e(),t.getConfigValue(t.cardConfig.title,r)?e("div",{staticClass:"xt-list__card-title"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.title,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.subtitle,r)?e("div",{staticClass:"xt-list__card-subtitle"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.subtitle,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.content,r)?e("div",{staticClass:"xt-list__card-content"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.content,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.footer,r)?e("div",{staticClass:"xt-list__card-footer"},[t._t("card-footer",(function(){return[t._v(" "+t._s(t.getConfigValue(t.cardConfig.footer,r))+" ")]}),{item:r,index:s})],2):t._e()]}),{item:r,index:s,group:i})],2)],1)})),0):t._e()])]}))]:t.loading?t._e():e("div",{staticClass:"xt-list__empty"},[t._t("empty",(function(){return[e("span",[t._v(t._s(t.emptyText))])]}))],2),t.loadMore&&t.hasMore&&!t.loading?e("div",{staticClass:"xt-list__loadmore"},[e("el-button",{attrs:{type:"text",loading:t.loadMoreLoading},on:{click:t.handleLoadMore}},[t._v(" "+t._s(t.loadMoreText)+" ")])],1):t._e()],2),t.loading?e("div",{staticClass:"xt-list__loading"},[t._t("loading",(function(){return[e("i",{staticClass:"el-icon-loading"}),e("span",[t._v("加载中...")])]}))],2):t._e(),t.showPagination?e("div",{staticClass:"xt-list__footer"},[e("el-pagination",{attrs:{background:"",small:"","current-page":t.pagination.pageNum,"page-size":t.pagination.pageSize,total:t.total,"page-sizes":t.pagination.pageSizes||[10,20,50],layout:"total, prev, pager, next"},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}})],1):t._e()])},n=[];const o=160,l=44;var d={name:"XtList",props:{data:{type:Array,default:()=>[]},groupBy:{type:String,default:""},groupLabel:{type:[String,Function],default:""},cardConfig:{type:Object,default:()=>({title:"title",subtitle:"",content:"",image:"",tag:"",tagType:"",footer:""})},title:{type:String,default:""},columns:{type:Number,default:1},shadow:{type:String,default:"hover"},cardBodyStyle:{type:Object,default:()=>({})},virtualScroll:{type:Boolean,default:!1},itemHeight:{type:Number,default:o},bufferSize:{type:Number,default:3},height:{type:[Number,String],default:null},maxHeight:{type:[Number,String],default:null},expandAll:{type:Boolean,default:!0},accordion:{type:Boolean,default:!1},pagination:{type:Object,default:null},total:{type:Number,default:0},loadMore:{type:Boolean,default:!1},hasMore:{type:Boolean,default:!1},loadMoreText:{type:String,default:"加载更多"},loadMoreLoading:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},emptyText:{type:String,default:"暂无数据"},filterable:{type:Boolean,default:!1},filterPlaceholder:{type:String,default:"请输入搜索内容"},filterMethod:{type:Function,default:null},sortable:{type:Boolean,default:!1},sortBy:{type:String,default:""},sortOrder:{type:String,default:""},sortMethod:{type:Function,default:null}},data(){return{groupExpandState:{},scrollTop:0,containerHeight:0,resizeObserver:null,rafId:null,searchText:"",currentSortOrder:this.sortOrder||""}},computed:{showPagination(){return this.pagination&&this.total>0},sortLabel(){return this.currentSortOrder?"ascending"===this.currentSortOrder?"升序":"降序":"排序"},bodyStyle(){const t={};return this.height&&(t.height="number"===typeof this.height?this.height+"px":this.height),this.maxHeight&&(t.maxHeight="number"===typeof this.maxHeight?this.maxHeight+"px":this.maxHeight),this.virtualScroll&&(t.overflowY="auto",t.overflowX="hidden"),t},filteredData(){return this.filterable&&this.searchText?this.data.filter(t=>"function"===typeof this.filterMethod?this.filterMethod(t,this.searchText):Object.values(t).some(t=>null!=t&&String(t).toLowerCase().includes(this.searchText.toLowerCase()))):this.data},sortedData(){if(!this.sortable||!this.sortBy||!this.currentSortOrder)return this.filteredData;const t="ascending"===this.currentSortOrder?1:-1,e="function"===typeof this.sortMethod?this.sortMethod:(t,e)=>{const i=t[this.sortBy],r=e[this.sortBy];return null==i&&null==r?0:null==i?-1:null==r?1:"number"===typeof i&&"number"===typeof r?i-r:String(i).localeCompare(String(r),void 0,{numeric:!0})};return[...this.filteredData].sort((i,r)=>e(i,r)*t)},groupedData(){const t=this.sortedData;if(!t||!t.length)return[];if(!this.groupBy)return[{_key:"_default",_items:t.map((t,e)=>({...t,_id:t._id||"item_"+e})),_expanded:!0}];const e={};t.forEach((t,i)=>{const r=t[this.groupBy],s=null!=r?String(r):"_undefined";e[s]||(e[s]={_key:s,_value:r,_items:[]}),e[s]._items.push({...t,_id:t._id||"item_"+i})});const i=Object.keys(e).sort().map(t=>{const i=e[t];return i._expanded=void 0!==this.groupExpandState[t]?this.groupExpandState[t]:this.expandAll,i});return i},totalHeight(){if(!this.virtualScroll)return 0;let t=0;return this.groupedData.forEach(e=>{if(t+=l,e._expanded){const i=Math.ceil(e._items.length/this.columns);t+=i*this.itemHeight}}),t},visibleGroups(){if(!this.virtualScroll)return this.groupedData;const t=Math.max(0,this.scrollTop-this.bufferSize*this.itemHeight),e=t+this.containerHeight+this.bufferSize*this.itemHeight*2,i=[];let r=0;return this.groupedData.forEach(s=>{const a=l+(s._expanded?Math.ceil(s._items.length/this.columns)*this.itemHeight:0),n=r+a;n>=t&&r<=e&&i.push(s),r=n}),i},offsetY(){if(!this.virtualScroll)return 0;let t=0;const e=Math.max(0,this.scrollTop-this.bufferSize*this.itemHeight);for(let i=0;i<this.groupedData.length;i++){const r=this.groupedData[i],s=l+(r._expanded?Math.ceil(r._items.length/this.columns)*this.itemHeight:0);if(!(t+s<=e))break;t+=s}return t}},watch:{data:{handler(){this.$nextTick(()=>{this.updateContainerHeight()})}},expandAll(t){const e={};this.groupedData.forEach(i=>{e[i._key]=t}),this.groupExpandState=e}},mounted(){this.$nextTick(()=>{this.updateContainerHeight(),this.bindResizeObserver()})},beforeDestroy(){this.unbindResizeObserver(),this.rafId&&"undefined"!==typeof cancelAnimationFrame&&(cancelAnimationFrame(this.rafId),this.rafId=null)},methods:{toggleGroup(t){const e={...this.groupExpandState},i=void 0!==e[t]?e[t]:this.expandAll;this.accordion&&!i&&Object.keys(e).forEach(t=>{e[t]=!1}),e[t]=!i,this.groupExpandState=e,this.$nextTick(()=>{this.updateContainerHeight(),this.$emit("group-toggle",{key:t,expanded:e[t]})})},getGroupLabel(t){return""===this.groupLabel?t._value:"function"===typeof this.groupLabel?this.groupLabel(t):"string"===typeof this.groupLabel&&t._items[0]&&t._items[0][this.groupLabel]||t._value},getConfigValue(t,e){return t?"function"===typeof t?t(e):"string"===typeof t&&e[t]||"":""},getImage(t){return this.getConfigValue(this.cardConfig.image,t)},getTag(t){return this.getConfigValue(this.cardConfig.tag,t)},getTagType(t){return this.cardConfig.tagType?"function"===typeof this.cardConfig.tagType?this.cardConfig.tagType(t):this.cardConfig.tagType:""},getVisibleItems(t){if(!this.virtualScroll)return t._items;const e=this.bufferSize*this.itemHeight,i=Math.max(0,this.scrollTop-e),r=i+this.containerHeight+2*e;let s=0,a=0;for(let u=0;u<this.groupedData.length;u++){const e=this.groupedData[u];if(e._key===t._key){a=s+l;break}s+=l+(e._expanded?Math.ceil(e._items.length/this.columns)*this.itemHeight:0)}const n=a+Math.ceil(t._items.length/this.columns)*this.itemHeight;if(n<=i||a>=r)return[];const o=Math.max(0,Math.floor((i-a)/this.itemHeight)*this.columns),d=Math.min(t._items.length,Math.ceil((r-a)/this.itemHeight)*this.columns+e);return t._items.slice(Math.max(0,o),d)},getItemIndex(t,e){return e._items.indexOf(t)},onScroll(){this.virtualScroll&&(this.scrollTop=this.$refs.scrollContainer.scrollTop,this.rafId||"undefined"!==typeof requestAnimationFrame&&(this.rafId=requestAnimationFrame(()=>{this.$forceUpdate(),this.rafId=null})))},updateContainerHeight(){this.$refs.scrollContainer&&(this.containerHeight=this.$refs.scrollContainer.clientHeight)},bindResizeObserver(){if("undefined"===typeof ResizeObserver)return;const t=this.$refs.scrollContainer;t&&(this.resizeObserver=new ResizeObserver(()=>{this.updateContainerHeight()}),this.resizeObserver.observe(t))},unbindResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},handleSearch(){this.$emit("search",this.searchText)},handleSortToggle(){const t=["","ascending","descending"],e=t.indexOf(this.currentSortOrder);this.currentSortOrder=t[(e+1)%3],this.$emit("sort-change",{prop:this.sortBy,order:this.currentSortOrder})},handleItemClick(t,e){this.$emit("click-item",{item:t,groupKey:e})},handleLoadMore(){this.$emit("load-more")},handleSizeChange(t){this.$emit("size-change",t)},handleCurrentChange(t){this.$emit("page-change",t)},scrollToTop(){this.$refs.scrollContainer&&this.$refs.scrollContainer.scrollTo({top:0,behavior:"smooth"})},expandGroup(t){const e={...this.groupExpandState};e[t]=!0,this.groupExpandState=e},collapseGroup(t){const e={...this.groupExpandState};e[t]=!1,this.groupExpandState=e},collapseAll(){const t={};this.groupedData.forEach(e=>{t[e._key]=!1}),this.groupExpandState=t},expandAllGroups(){this.groupExpandState={}}}},u=d;i("732a");function c(t,e,i,r,s,a,n,o){var l,d="function"===typeof t?t.options:t;if(e&&(d.render=e,d.staticRenderFns=i,d._compiled=!0),r&&(d.functional=!0),a&&(d._scopeId="data-v-"+a),n?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=l):s&&(l=o?function(){s.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:s),l)if(d.functional){d._injectStyles=l;var u=d.render;d.render=function(t,e){return l.call(e),u(t,e)}}else{var c=d.beforeCreate;d.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:d}}var g=c(u,a,n,!1,null,"53c7db00",null),h=g.exports;h.install=function(t){t.component(h.name,h)};var p=h;e["default"]=p}})}));
|
|
1
|
+
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["xt-list"]=e():t["xt-list"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(r,s,function(e){return t[e]}.bind(null,s));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s="fb15")}({"3ae0":function(t,e,i){},"52fd":function(t,e,i){"use strict";i("3ae0")},f699:function(t,e,i){},fb15:function(t,e,i){"use strict";if(i.r(e),i.d(e,"XtList",(function(){return v})),"undefined"!==typeof window){var r=window.document.currentScript,s=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);s&&(i.p=s[1])}var a=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-list",class:{"xt-list--loading":t.loading}},[t.title||t.filterable||t.sortable||t.$slots.toolbar?e("div",{staticClass:"xt-list__header"},[t.title?e("span",{staticClass:"xt-list__title"},[t._v(t._s(t.title))]):t._e(),e("div",{staticClass:"xt-list__toolbar"},[t.filterable?e("div",{staticClass:"xt-list__search"},[e("el-input",{attrs:{placeholder:t.filterPlaceholder,size:"small",clearable:"","prefix-icon":"el-icon-search"},on:{input:t.handleSearch},model:{value:t.searchText,callback:function(e){t.searchText=e},expression:"searchText"}})],1):t._e(),t.sortable&&t.sortBy?e("el-button",{attrs:{size:"small",icon:"el-icon-sort",type:t.currentSortOrder?"primary":"default",plain:""},on:{click:t.handleSortToggle}},[t._v(" "+t._s(t.sortLabel)+" ")]):t._e(),t._t("toolbar")],2)]):t._e(),e("xt-scroll",{ref:"scrollContainer",class:["xt-list__body",{"xt-list__body--virtual":t.virtualScroll}],style:t.bodyStyle,on:{scroll:t.onScroll}},[t.virtualScroll?e("div",{staticClass:"xt-list__phantom",style:{height:t.totalHeight+"px"}},[e("div",{style:{paddingTop:t.offsetY+"px"}},[t.groupedData.length?[t._l(t.visibleGroups,(function(i,r){return[e("div",{key:i._key,staticClass:"xt-list__group"},[e("div",{staticClass:"xt-list__group-title",on:{click:function(e){return t.toggleGroup(i._key)}}},[e("span",{staticClass:"xt-list__group-arrow",class:{"is-expanded":i._expanded}},[e("i",{staticClass:"el-icon-arrow-right"})]),t._t("group-title",(function(){return[e("span",{staticClass:"xt-list__group-label"},[t._v(t._s(t.getGroupLabel(i)))]),e("span",{staticClass:"xt-list__group-count"},[t._v("("+t._s(i._items.length)+")")])]}),{group:i,items:i._items,expanded:i._expanded})],2),i._expanded?e("div",{class:["xt-list__cards","xt-list__cols-"+t.columns]},t._l(t.getVisibleItems(i),(function(r,s){return e("div",{key:r._id||s,staticClass:"xt-list__item",on:{click:function(e){return t.handleItemClick(r,i._key)}}},[e("el-card",{attrs:{shadow:t.shadow,"body-style":t.cardBodyStyle}},[t._t("default",(function(){return[t.getImage(r)?e("div",{staticClass:"xt-list__image"},[e("img",{attrs:{src:t.getImage(r),alt:t.getConfigValue(t.cardConfig.title,r)}})]):t._e(),t.getTag(r)?e("div",{staticClass:"xt-list__tag"},[e("el-tag",{attrs:{size:"small",type:t.getTagType(r)}},[t._v(t._s(t.getTag(r)))])],1):t._e(),t.getConfigValue(t.cardConfig.title,r)?e("div",{staticClass:"xt-list__card-title"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.title,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.subtitle,r)?e("div",{staticClass:"xt-list__card-subtitle"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.subtitle,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.content,r)?e("div",{staticClass:"xt-list__card-content"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.content,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.footer,r)?e("div",{staticClass:"xt-list__card-footer"},[t._t("card-footer",(function(){return[t._v(" "+t._s(t.getConfigValue(t.cardConfig.footer,r))+" ")]}),{item:r,index:t.getItemIndex(r,i)})],2):t._e()]}),{item:r,index:t.getItemIndex(r,i),group:i})],2)],1)})),0):t._e()])]}))]:t.loading?t._e():e("div",{staticClass:"xt-list__empty"},[t._t("empty",(function(){return[e("span",[t._v(t._s(t.emptyText))])]}))],2)],2)]):t.groupedData.length?[t._l(t.groupedData,(function(i){return[e("div",{key:i._key,staticClass:"xt-list__group"},[e("div",{staticClass:"xt-list__group-title",on:{click:function(e){return t.toggleGroup(i._key)}}},[e("span",{staticClass:"xt-list__group-arrow",class:{"is-expanded":i._expanded}},[e("i",{staticClass:"el-icon-arrow-right"})]),t._t("group-title",(function(){return[e("span",{staticClass:"xt-list__group-label"},[t._v(t._s(t.getGroupLabel(i)))]),e("span",{staticClass:"xt-list__group-count"},[t._v("("+t._s(i._items.length)+")")])]}),{group:i,items:i._items,expanded:i._expanded})],2),i._expanded?e("div",{class:["xt-list__cards","xt-list__cols-"+t.columns]},t._l(i._items,(function(r,s){return e("div",{key:r._id||s,staticClass:"xt-list__item",on:{click:function(e){return t.handleItemClick(r,i._key)}}},[e("el-card",{attrs:{shadow:t.shadow,"body-style":t.cardBodyStyle}},[t._t("default",(function(){return[t.getImage(r)?e("div",{staticClass:"xt-list__image"},[e("img",{attrs:{src:t.getImage(r),alt:t.getConfigValue(t.cardConfig.title,r)}})]):t._e(),t.getTag(r)?e("div",{staticClass:"xt-list__tag"},[e("el-tag",{attrs:{size:"small",type:t.getTagType(r)}},[t._v(t._s(t.getTag(r)))])],1):t._e(),t.getConfigValue(t.cardConfig.title,r)?e("div",{staticClass:"xt-list__card-title"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.title,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.subtitle,r)?e("div",{staticClass:"xt-list__card-subtitle"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.subtitle,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.content,r)?e("div",{staticClass:"xt-list__card-content"},[t._v(" "+t._s(t.getConfigValue(t.cardConfig.content,r))+" ")]):t._e(),t.getConfigValue(t.cardConfig.footer,r)?e("div",{staticClass:"xt-list__card-footer"},[t._t("card-footer",(function(){return[t._v(" "+t._s(t.getConfigValue(t.cardConfig.footer,r))+" ")]}),{item:r,index:s})],2):t._e()]}),{item:r,index:s,group:i})],2)],1)})),0):t._e()])]}))]:t.loading?t._e():e("div",{staticClass:"xt-list__empty"},[t._t("empty",(function(){return[e("span",[t._v(t._s(t.emptyText))])]}))],2),t.loadMore&&t.hasMore&&!t.loading?e("div",{staticClass:"xt-list__loadmore"},[e("el-button",{attrs:{type:"text",loading:t.loadMoreLoading},on:{click:t.handleLoadMore}},[t._v(" "+t._s(t.loadMoreText)+" ")])],1):t._e()],2),t.loading?e("div",{staticClass:"xt-list__loading"},[t._t("loading",(function(){return[e("i",{staticClass:"el-icon-loading"}),e("span",[t._v("加载中...")])]}))],2):t._e(),t.showPagination?e("div",{staticClass:"xt-list__footer"},[e("el-pagination",{attrs:{background:"",small:"","current-page":t.pagination.pageNum,"page-size":t.pagination.pageSize,total:t.total,"page-sizes":t.pagination.pageSizes||[10,20,50],layout:"total, prev, pager, next"},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}})],1):t._e()],1)},l=[],o=(i("f699"),function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-scroll",class:["xt-scroll--"+t.scrollDirection],style:t.containerStyle},[e("div",{ref:"scrollWrap",staticClass:"xt-scroll__wrap",class:["xt-scroll__wrap--"+t.scrollDirection],on:{scroll:t.onScroll}},[t.vScroll?e("div",{staticClass:"xt-scroll__virtual",style:t.virtualWrapperStyle},["vertical"===t.scrollDirection?e("div",{staticClass:"xt-scroll__phantom",style:{height:t.totalSize+"px"}},[e("div",{style:{transform:`translateY(${t.offsetStart}px)`}},[t._l(t.visibleData,(function(i,r){return[e("div",{key:t.getItemKey(i,r),staticClass:"xt-scroll__item",class:t.itemClassName,style:t.itemStyle},[t._t("item",(function(){return[t._v(" "+t._s(i)+" ")]}),{item:i,index:t.getOriginalIndex(r)})],2)]}))],2)]):"horizontal"===t.scrollDirection?e("div",{staticClass:"xt-scroll__phantom",style:{width:t.totalSize+"px"}},[e("div",{style:{transform:`translateX(${t.offsetStart}px)`}},[t._l(t.visibleData,(function(i,r){return[e("div",{key:t.getItemKey(i,r),staticClass:"xt-scroll__item",class:t.itemClassName,style:t.itemStyle},[t._t("item",(function(){return[t._v(" "+t._s(i)+" ")]}),{item:i,index:t.getOriginalIndex(r)})],2)]}))],2)]):t._e()]):t._e(),!t.vScroll||t.data&&t.data.length||t.loading?t._e():e("div",{staticClass:"xt-scroll__empty"},[t._t("empty",(function(){return[e("span",[t._v(t._s(t.emptyText))])]}))],2),t.loading?e("div",{staticClass:"xt-scroll__loading"},[t._t("loading",(function(){return[e("i",{staticClass:"el-icon-loading"}),e("span",[t._v("加载中...")])]}))],2):t._e(),t.vScroll?t._e():e("div",{staticClass:"xt-scroll__default"},[t._t("default")],2),t.vScroll&&t.showLoadMore&&!t.loading?e("div",{staticClass:"xt-scroll__loadmore",on:{click:t.onLoadMore}},[e("el-button",{attrs:{type:"text",loading:t.loadMoreLoading}},[t._v(" "+t._s(t.loadMoreText)+" ")])],1):t._e()])])}),n=[],c={name:"XtScroll",props:{vScroll:{type:Boolean,default:!1},data:{type:Array,default:()=>[]},itemSize:{type:Number,default:50},keyField:{type:String,default:"id"},bufferSize:{type:Number,default:5},scrollDirection:{type:String,default:"vertical",validator:t=>["vertical","horizontal"].includes(t)},itemClassName:{type:String,default:""},height:{type:[Number,String],default:""},maxHeight:{type:[Number,String],default:""},width:{type:[Number,String],default:""},maxWidth:{type:[Number,String],default:""},loading:{type:Boolean,default:!1},emptyText:{type:String,default:"暂无数据"},loadMore:{type:Boolean,default:!1},loadMoreText:{type:String,default:"加载更多"},loadMoreLoading:{type:Boolean,default:!1}},data(){return{scrollPos:0,containerSize:0,resizeObserver:null,rafId:null}},computed:{containerStyle(){const t={};return this.height&&(t.height="number"===typeof this.height?this.height+"px":this.height),this.maxHeight&&(t.maxHeight="number"===typeof this.maxHeight?this.maxHeight+"px":this.maxHeight),this.width&&(t.width="number"===typeof this.width?this.width+"px":this.width),this.maxWidth&&(t.maxWidth="number"===typeof this.maxWidth?this.maxWidth+"px":this.maxWidth),t},virtualWrapperStyle(){const t={};return"horizontal"===this.scrollDirection&&(t.height="100%"),t},itemStyle(){return"vertical"===this.scrollDirection?{height:this.itemSize+"px"}:{width:this.itemSize+"px",display:"inline-block"}},dataCount(){return this.data&&this.data.length||0},totalSize(){return this.dataCount*this.itemSize},visibleStartIndex(){if(!this.vScroll)return 0;const t=Math.floor(this.scrollPos/this.itemSize);return Math.max(0,t-this.bufferSize)},visibleEndIndex(){if(!this.vScroll)return this.dataCount;const t=Math.ceil(this.containerSize/this.itemSize),e=Math.ceil(this.scrollPos/this.itemSize)+t;return Math.min(this.dataCount,e+this.bufferSize)},visibleData(){return this.vScroll&&this.data?this.data.slice(this.visibleStartIndex,this.visibleEndIndex):this.data||[]},offsetStart(){return this.visibleStartIndex*this.itemSize},showLoadMore(){return!(!this.loadMore||!this.dataCount)&&("vertical"===this.scrollDirection&&this.scrollPos+this.containerSize>=this.totalSize-2*this.itemSize)}},watch:{data:{handler(){this.$nextTick(()=>{this.updateContainerSize()})}},vScroll(t){t&&this.$nextTick(()=>{this.updateContainerSize(),this.bindResizeObserver()})}},mounted(){this.$nextTick(()=>{this.updateContainerSize(),this.vScroll&&this.bindResizeObserver()})},beforeDestroy(){this.unbindResizeObserver(),this.rafId&&"undefined"!==typeof cancelAnimationFrame&&(cancelAnimationFrame(this.rafId),this.rafId=null)},methods:{onScroll(){const t=this.$refs.scrollWrap;if(!t)return;const e="vertical"===this.scrollDirection?t.scrollTop:t.scrollLeft;this.scrollPos=e,this.$emit("scroll",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),this.rafId||"undefined"!==typeof requestAnimationFrame&&(this.rafId=requestAnimationFrame(()=>{this.$forceUpdate(),this.rafId=null}))},getItemKey(t,e){return t&&"object"===typeof t&&this.keyField&&null!=t[this.keyField]?t[this.keyField]:"vitem_"+(this.visibleStartIndex+e)},getOriginalIndex(t){return this.visibleStartIndex+t},updateContainerSize(){const t=this.$refs.scrollWrap;t&&(this.containerSize="vertical"===this.scrollDirection?t.clientHeight:t.clientWidth)},bindResizeObserver(){if("undefined"===typeof ResizeObserver)return;this.unbindResizeObserver();const t=this.$refs.scrollWrap;t&&(this.resizeObserver=new ResizeObserver(()=>{this.updateContainerSize()}),this.resizeObserver.observe(t))},unbindResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},onLoadMore(){this.$emit("load-more")},getScrollContainer(){return this.$refs.scrollWrap},scrollTo(t,e){const i=this.$refs.scrollWrap;if(!i)return;const r=e&&"string"===typeof e?{behavior:e}:{behavior:"smooth"};"vertical"===this.scrollDirection?i.scrollTo({top:t,...r}):i.scrollTo({left:t,...r})},scrollToItem(t){const e=t*this.itemSize;this.scrollTo(e)},scrollToStart(){this.scrollTo(0)},scrollToEnd(){this.scrollTo(this.totalSize)},getScrollPos(){return this.scrollPos}}},d=c;function u(t,e,i,r,s,a,l,o){var n,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=i,c._compiled=!0),r&&(c.functional=!0),a&&(c._scopeId="data-v-"+a),l?(n=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(l)},c._ssrRegister=n):s&&(n=o?function(){s.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:s),n)if(c.functional){c._injectStyles=n;var d=c.render;c.render=function(t,e){return n.call(e),d(t,e)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,n):[n]}return{exports:t,options:c}}var h=u(d,o,n,!1,null,null,null),g=h.exports;g.install=function(t){t.component(g.name,g)};var f=g;const p=160,_=44;var m={name:"XtList",components:{XtScroll:f},props:{data:{type:Array,default:()=>[]},groupBy:{type:String,default:""},groupLabel:{type:[String,Function],default:""},cardConfig:{type:Object,default:()=>({title:"title",subtitle:"",content:"",image:"",tag:"",tagType:"",footer:""})},title:{type:String,default:""},columns:{type:Number,default:1},shadow:{type:String,default:"hover"},cardBodyStyle:{type:Object,default:()=>({})},virtualScroll:{type:Boolean,default:!1},itemHeight:{type:Number,default:p},bufferSize:{type:Number,default:3},height:{type:[Number,String],default:null},maxHeight:{type:[Number,String],default:null},expandAll:{type:Boolean,default:!0},accordion:{type:Boolean,default:!1},pagination:{type:Object,default:null},total:{type:Number,default:0},loadMore:{type:Boolean,default:!1},hasMore:{type:Boolean,default:!1},loadMoreText:{type:String,default:"加载更多"},loadMoreLoading:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},emptyText:{type:String,default:"暂无数据"},filterable:{type:Boolean,default:!1},filterPlaceholder:{type:String,default:"请输入搜索内容"},filterMethod:{type:Function,default:null},sortable:{type:Boolean,default:!1},sortBy:{type:String,default:""},sortOrder:{type:String,default:""},sortMethod:{type:Function,default:null}},data(){return{groupExpandState:{},scrollTop:0,containerHeight:0,resizeObserver:null,rafId:null,searchText:"",currentSortOrder:this.sortOrder||""}},computed:{showPagination(){return this.pagination&&this.total>0},sortLabel(){return this.currentSortOrder?"ascending"===this.currentSortOrder?"升序":"降序":"排序"},bodyStyle(){const t={};return this.height&&(t.height="number"===typeof this.height?this.height+"px":this.height),this.maxHeight&&(t.maxHeight="number"===typeof this.maxHeight?this.maxHeight+"px":this.maxHeight),this.virtualScroll&&(t.overflowY="auto",t.overflowX="hidden"),t},filteredData(){return this.filterable&&this.searchText?this.data.filter(t=>"function"===typeof this.filterMethod?this.filterMethod(t,this.searchText):Object.values(t).some(t=>null!=t&&String(t).toLowerCase().includes(this.searchText.toLowerCase()))):this.data},sortedData(){if(!this.sortable||!this.sortBy||!this.currentSortOrder)return this.filteredData;const t="ascending"===this.currentSortOrder?1:-1,e="function"===typeof this.sortMethod?this.sortMethod:(t,e)=>{const i=t[this.sortBy],r=e[this.sortBy];return null==i&&null==r?0:null==i?-1:null==r?1:"number"===typeof i&&"number"===typeof r?i-r:String(i).localeCompare(String(r),void 0,{numeric:!0})};return[...this.filteredData].sort((i,r)=>e(i,r)*t)},groupedData(){const t=this.sortedData;if(!t||!t.length)return[];if(!this.groupBy)return[{_key:"_default",_items:t.map((t,e)=>({...t,_id:t._id||"item_"+e})),_expanded:!0}];const e={};t.forEach((t,i)=>{const r=t[this.groupBy],s=null!=r?String(r):"_undefined";e[s]||(e[s]={_key:s,_value:r,_items:[]}),e[s]._items.push({...t,_id:t._id||"item_"+i})});const i=Object.keys(e).sort().map(t=>{const i=e[t];return i._expanded=void 0!==this.groupExpandState[t]?this.groupExpandState[t]:this.expandAll,i});return i},totalHeight(){if(!this.virtualScroll)return 0;let t=0;return this.groupedData.forEach(e=>{if(t+=_,e._expanded){const i=Math.ceil(e._items.length/this.columns);t+=i*this.itemHeight}}),t},visibleGroups(){if(!this.virtualScroll)return this.groupedData;const t=Math.max(0,this.scrollTop-this.bufferSize*this.itemHeight),e=t+this.containerHeight+this.bufferSize*this.itemHeight*2,i=[];let r=0;return this.groupedData.forEach(s=>{const a=_+(s._expanded?Math.ceil(s._items.length/this.columns)*this.itemHeight:0),l=r+a;l>=t&&r<=e&&i.push(s),r=l}),i},offsetY(){if(!this.virtualScroll)return 0;let t=0;const e=Math.max(0,this.scrollTop-this.bufferSize*this.itemHeight);for(let i=0;i<this.groupedData.length;i++){const r=this.groupedData[i],s=_+(r._expanded?Math.ceil(r._items.length/this.columns)*this.itemHeight:0);if(!(t+s<=e))break;t+=s}return t}},watch:{data:{handler(){this.$nextTick(()=>{this.updateContainerHeight()})}},expandAll(t){const e={};this.groupedData.forEach(i=>{e[i._key]=t}),this.groupExpandState=e}},mounted(){this.$nextTick(()=>{this.updateContainerHeight(),this.bindResizeObserver()})},beforeDestroy(){this.unbindResizeObserver(),this.rafId&&"undefined"!==typeof cancelAnimationFrame&&(cancelAnimationFrame(this.rafId),this.rafId=null)},methods:{toggleGroup(t){const e={...this.groupExpandState},i=void 0!==e[t]?e[t]:this.expandAll;this.accordion&&!i&&Object.keys(e).forEach(t=>{e[t]=!1}),e[t]=!i,this.groupExpandState=e,this.$nextTick(()=>{this.updateContainerHeight(),this.$emit("group-toggle",{key:t,expanded:e[t]})})},getGroupLabel(t){return""===this.groupLabel?t._value:"function"===typeof this.groupLabel?this.groupLabel(t):"string"===typeof this.groupLabel&&t._items[0]&&t._items[0][this.groupLabel]||t._value},getConfigValue(t,e){return t?"function"===typeof t?t(e):"string"===typeof t&&e[t]||"":""},getImage(t){return this.getConfigValue(this.cardConfig.image,t)},getTag(t){return this.getConfigValue(this.cardConfig.tag,t)},getTagType(t){return this.cardConfig.tagType?"function"===typeof this.cardConfig.tagType?this.cardConfig.tagType(t):this.cardConfig.tagType:""},getVisibleItems(t){if(!this.virtualScroll)return t._items;const e=this.bufferSize*this.itemHeight,i=Math.max(0,this.scrollTop-e),r=i+this.containerHeight+2*e;let s=0,a=0;for(let c=0;c<this.groupedData.length;c++){const e=this.groupedData[c];if(e._key===t._key){a=s+_;break}s+=_+(e._expanded?Math.ceil(e._items.length/this.columns)*this.itemHeight:0)}const l=a+Math.ceil(t._items.length/this.columns)*this.itemHeight;if(l<=i||a>=r)return[];const o=Math.max(0,Math.floor((i-a)/this.itemHeight)*this.columns),n=Math.min(t._items.length,Math.ceil((r-a)/this.itemHeight)*this.columns+e);return t._items.slice(Math.max(0,o),n)},getItemIndex(t,e){return e._items.indexOf(t)},onScroll(t){this.virtualScroll&&(this.scrollTop=t&&null!=t.scrollTop?t.scrollTop:0,this.rafId||"undefined"!==typeof requestAnimationFrame&&(this.rafId=requestAnimationFrame(()=>{this.$forceUpdate(),this.rafId=null})))},updateContainerHeight(){if(this.$refs.scrollContainer){const t=this.$refs.scrollContainer,e=t.getScrollContainer&&t.getScrollContainer();this.containerHeight=e?e.clientHeight:0}},bindResizeObserver(){if("undefined"===typeof ResizeObserver)return;const t=this.$refs.scrollContainer;if(!t)return;const e=t.getScrollContainer&&t.getScrollContainer();e&&(this.resizeObserver=new ResizeObserver(()=>{this.updateContainerHeight()}),this.resizeObserver.observe(e))},unbindResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},handleSearch(){this.$emit("search",this.searchText)},handleSortToggle(){const t=["","ascending","descending"],e=t.indexOf(this.currentSortOrder);this.currentSortOrder=t[(e+1)%3],this.$emit("sort-change",{prop:this.sortBy,order:this.currentSortOrder})},handleItemClick(t,e){this.$emit("click-item",{item:t,groupKey:e})},handleLoadMore(){this.$emit("load-more")},handleSizeChange(t){this.$emit("size-change",t)},handleCurrentChange(t){this.$emit("page-change",t)},scrollToTop(){this.$refs.scrollContainer&&this.$refs.scrollContainer.scrollToStart&&this.$refs.scrollContainer.scrollToStart()},expandGroup(t){const e={...this.groupExpandState};e[t]=!0,this.groupExpandState=e},collapseGroup(t){const e={...this.groupExpandState};e[t]=!1,this.groupExpandState=e},collapseAll(){const t={};this.groupedData.forEach(e=>{t[e._key]=!1}),this.groupExpandState=t},expandAllGroups(){this.groupExpandState={}}}},x=m,y=(i("52fd"),u(x,a,l,!1,null,"084d1476",null)),v=y.exports;v.install=function(t){t.component(v.name,v)};var b=v;e["default"]=b}})}));
|
|
@@ -123,7 +123,7 @@ if (typeof window !== 'undefined') {
|
|
|
123
123
|
// EXTERNAL MODULE: ./src/components/xt-map/style/index.scss
|
|
124
124
|
var style = __webpack_require__("c759");
|
|
125
125
|
|
|
126
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
126
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-map/index.vue?vue&type=template&id=0c15823e
|
|
127
127
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-map-wrapper"},[_c('div',{ref:"mapContainer",staticClass:"xt-map-container",attrs:{"data-theme":_vm.mergedTheme}}),(_vm.loading)?_c('div',{staticClass:"xt-map-loading"},[_c('span',[_vm._v("地图加载中...")])]):_vm._e(),(_vm.errorMessage)?_c('div',{staticClass:"xt-map-error"},[_c('span',[_vm._v(_vm._s(_vm.errorMessage))])]):_vm._e(),_vm._t("overlay")],2)
|
|
128
128
|
}
|
|
129
129
|
var staticRenderFns = []
|
package/lib/xt-map/xt-map.umd.js
CHANGED
|
@@ -132,7 +132,7 @@ if (typeof window !== 'undefined') {
|
|
|
132
132
|
// EXTERNAL MODULE: ./src/components/xt-map/style/index.scss
|
|
133
133
|
var style = __webpack_require__("c759");
|
|
134
134
|
|
|
135
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
135
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-map/index.vue?vue&type=template&id=0c15823e
|
|
136
136
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-map-wrapper"},[_c('div',{ref:"mapContainer",staticClass:"xt-map-container",attrs:{"data-theme":_vm.mergedTheme}}),(_vm.loading)?_c('div',{staticClass:"xt-map-loading"},[_c('span',[_vm._v("地图加载中...")])]):_vm._e(),(_vm.errorMessage)?_c('div',{staticClass:"xt-map-error"},[_c('span',[_vm._v(_vm._s(_vm.errorMessage))])]):_vm._e(),_vm._t("overlay")],2)
|
|
137
137
|
}
|
|
138
138
|
var staticRenderFns = []
|
|
@@ -131,7 +131,7 @@ if (typeof window !== 'undefined') {
|
|
|
131
131
|
// Indicate to webpack that this file can be concatenated
|
|
132
132
|
/* harmony default export */ var setPublicPath = (null);
|
|
133
133
|
|
|
134
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
134
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-map/provider.vue?vue&type=template&id=16f243b0&scoped=true
|
|
135
135
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{class:['xt-map-provider', { 'xt-map-provider--dark': _vm.mergedTheme === 'dark' }],style:(_vm.wrapperStyle)},[_vm._t("default")],2)
|
|
136
136
|
}
|
|
137
137
|
var staticRenderFns = []
|
|
@@ -140,7 +140,7 @@ if (typeof window !== 'undefined') {
|
|
|
140
140
|
// Indicate to webpack that this file can be concatenated
|
|
141
141
|
/* harmony default export */ var setPublicPath = (null);
|
|
142
142
|
|
|
143
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
143
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-map/provider.vue?vue&type=template&id=16f243b0&scoped=true
|
|
144
144
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{class:['xt-map-provider', { 'xt-map-provider--dark': _vm.mergedTheme === 'dark' }],style:(_vm.wrapperStyle)},[_vm._t("default")],2)
|
|
145
145
|
}
|
|
146
146
|
var staticRenderFns = []
|
|
@@ -131,7 +131,7 @@ if (typeof window !== 'undefined') {
|
|
|
131
131
|
// Indicate to webpack that this file can be concatenated
|
|
132
132
|
/* harmony default export */ var setPublicPath = (null);
|
|
133
133
|
|
|
134
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
134
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-page/index.vue?vue&type=template&id=a1f6b910&scoped=true
|
|
135
135
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-page-container",class:_vm.containerClass,style:(_vm.rootCssVars)},[_c('el-container',{staticClass:"xt-page-main-wrap"},[(_vm.$slots.header && _vm.showHeader)?_c('el-header',{ref:"header",staticClass:"xt-page-header",class:_vm.headerClass},[_vm._t("header")],2):_vm._e(),_c('el-main',{ref:"main",staticClass:"xt-page-main",class:_vm.mainClass},[_vm._t("default",null,{"tableHeight":_vm.tableContentHeight})],2),(_vm.$slots.footer && _vm.showFooter)?_c('el-footer',{ref:"footer",staticClass:"xt-page-footer",class:_vm.footerClass},[_vm._t("footer")],2):_vm._e()],1),(_vm.$slots.aside && _vm.showAside)?_c('el-aside',{ref:"aside",staticClass:"xt-page-aside",class:_vm.asideClass,attrs:{"width":_vm.asideWidth}},[_vm._t("aside")],2):_vm._e(),_vm._t("dialog")],2)
|
|
136
136
|
}
|
|
137
137
|
var staticRenderFns = []
|
|
@@ -140,7 +140,7 @@ if (typeof window !== 'undefined') {
|
|
|
140
140
|
// Indicate to webpack that this file can be concatenated
|
|
141
141
|
/* harmony default export */ var setPublicPath = (null);
|
|
142
142
|
|
|
143
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
143
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-page/index.vue?vue&type=template&id=a1f6b910&scoped=true
|
|
144
144
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-page-container",class:_vm.containerClass,style:(_vm.rootCssVars)},[_c('el-container',{staticClass:"xt-page-main-wrap"},[(_vm.$slots.header && _vm.showHeader)?_c('el-header',{ref:"header",staticClass:"xt-page-header",class:_vm.headerClass},[_vm._t("header")],2):_vm._e(),_c('el-main',{ref:"main",staticClass:"xt-page-main",class:_vm.mainClass},[_vm._t("default",null,{"tableHeight":_vm.tableContentHeight})],2),(_vm.$slots.footer && _vm.showFooter)?_c('el-footer',{ref:"footer",staticClass:"xt-page-footer",class:_vm.footerClass},[_vm._t("footer")],2):_vm._e()],1),(_vm.$slots.aside && _vm.showAside)?_c('el-aside',{ref:"aside",staticClass:"xt-page-aside",class:_vm.asideClass,attrs:{"width":_vm.asideWidth}},[_vm._t("aside")],2):_vm._e(),_vm._t("dialog")],2)
|
|
145
145
|
}
|
|
146
146
|
var staticRenderFns = []
|
|
@@ -120,7 +120,7 @@ if (typeof window !== 'undefined') {
|
|
|
120
120
|
// EXTERNAL MODULE: ./src/components/xt-progress/style/index.scss
|
|
121
121
|
var style = __webpack_require__("2e12");
|
|
122
122
|
|
|
123
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
123
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-progress/index.vue?vue&type=template&id=76c95a92
|
|
124
124
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-progress",class:[
|
|
125
125
|
`xt-progress--${_vm.type}`,
|
|
126
126
|
`xt-progress--${_vm.size}`
|
|
@@ -129,7 +129,7 @@ if (typeof window !== 'undefined') {
|
|
|
129
129
|
// EXTERNAL MODULE: ./src/components/xt-progress/style/index.scss
|
|
130
130
|
var style = __webpack_require__("2e12");
|
|
131
131
|
|
|
132
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
132
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d9e3ae5-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-progress/index.vue?vue&type=template&id=76c95a92
|
|
133
133
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-progress",class:[
|
|
134
134
|
`xt-progress--${_vm.type}`,
|
|
135
135
|
`xt-progress--${_vm.size}`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./xt-scroll.common.js');
|