xt-element-ui 2.2.2 → 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 -81
- package/docs/components/base/theme.md +248 -0
- package/docs/components/base/xt-button.md +11 -4
- package/docs/components/base/xt-card.md +5 -11
- package/docs/components/base/xt-config-provider.md +2 -0
- package/docs/components/base/xt-flow.md +404 -0
- package/docs/components/base/xt-list.md +1 -1
- package/docs/components/base/xt-multi.md +5 -5
- package/docs/components/base/xt-scroll-arrow.md +87 -1
- package/docs/components/base/xt-scroll.md +237 -0
- package/docs/components/business/xt-chart.md +1 -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 +4577 -109925
- 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 +4583 -109930
- 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.css +1 -1
- package/lib/xt-badge/xt-badge.umd.js +1 -1
- package/lib/xt-button/xt-button.common.js +13 -8
- package/lib/xt-button/xt-button.css +1 -1
- package/lib/xt-button/xt-button.umd.js +13 -8
- package/lib/xt-button/xt-button.umd.min.js +1 -1
- package/lib/xt-card/xt-card.common.js +5 -5
- package/lib/xt-card/xt-card.umd.js +5 -5
- package/lib/xt-card/xt-card.umd.min.js +1 -1
- package/lib/xt-card-item/xt-card-item.common.js +4 -4
- package/lib/xt-card-item/xt-card-item.umd.js +4 -4
- package/lib/xt-card-item/xt-card-item.umd.min.js +1 -1
- package/lib/xt-chart/xt-chart.common.js +1969 -108924
- package/lib/xt-chart/xt-chart.css +1 -1
- package/lib/xt-chart/xt-chart.umd.js +1975 -108929
- package/lib/xt-chart/xt-chart.umd.min.js +1 -1
- package/lib/xt-config-provider/xt-config-provider.common.js +561 -107504
- package/lib/xt-config-provider/xt-config-provider.css +1 -1
- package/lib/xt-config-provider/xt-config-provider.umd.js +567 -107509
- package/lib/xt-config-provider/xt-config-provider.umd.min.js +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/demo.html +10 -0
- package/lib/xt-flow/index.js +1 -0
- package/lib/xt-flow/xt-flow.common.js +638 -0
- package/lib/xt-flow/xt-flow.css +1 -0
- package/lib/xt-flow/xt-flow.umd.js +648 -0
- package/lib/xt-flow/xt-flow.umd.min.js +1 -0
- 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.css +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 +11 -11
- package/lib/xt-upload/xt-upload.umd.js +12 -12
- package/lib/xt-upload/xt-upload.umd.min.js +1 -1
- package/package.json +6 -5
- package/src/components/index.scss +7 -1
- 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-badge/style/index.scss +6 -6
- package/src/components/xt-button/index.vue +11 -6
- package/src/components/xt-button/style/index.scss +7 -5
- package/src/components/xt-card/index.vue +3 -3
- package/src/components/xt-card-item/index.vue +2 -2
- package/src/components/xt-chart/XtMulti.vue +8 -18
- package/src/components/xt-chart/XtPie.vue +1 -0
- package/src/components/xt-chart/utils.js +84 -50
- package/src/components/xt-config-provider/index.vue +56 -54
- 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 +79 -54
- package/src/components/xt-flow/flowable-parser.js +244 -0
- package/src/components/xt-flow/index.js +8 -0
- package/src/components/xt-flow/index.vue +226 -0
- package/src/components/xt-flow/style/index.scss +359 -0
- 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/components/xt-text/style/index.scss +6 -6
- package/src/index.js +15 -13
- package/src/styles/css-variables.scss +73 -1
- 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
|
@@ -87,18 +87,25 @@ module.exports =
|
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
|
-
/***/ "
|
|
90
|
+
/***/ "3ae0":
|
|
91
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
92
|
+
|
|
93
|
+
// extracted by mini-css-extract-plugin
|
|
94
|
+
|
|
95
|
+
/***/ }),
|
|
96
|
+
|
|
97
|
+
/***/ "52fd":
|
|
91
98
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
92
99
|
|
|
93
100
|
"use strict";
|
|
94
|
-
/* harmony import */ var
|
|
95
|
-
/* harmony import */ var
|
|
101
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_084d1476_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("3ae0");
|
|
102
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_084d1476_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_084d1476_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__);
|
|
96
103
|
/* unused harmony reexport * */
|
|
97
104
|
|
|
98
105
|
|
|
99
106
|
/***/ }),
|
|
100
107
|
|
|
101
|
-
/***/ "
|
|
108
|
+
/***/ "f699":
|
|
102
109
|
/***/ (function(module, exports, __webpack_require__) {
|
|
103
110
|
|
|
104
111
|
// extracted by mini-css-extract-plugin
|
|
@@ -131,22 +138,447 @@ if (typeof window !== 'undefined') {
|
|
|
131
138
|
// Indicate to webpack that this file can be concatenated
|
|
132
139
|
/* harmony default export */ var setPublicPath = (null);
|
|
133
140
|
|
|
134
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
135
|
-
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-list",class:{ 'xt-list--loading': _vm.loading }},[(_vm.title || _vm.filterable || _vm.sortable || _vm.$slots.toolbar)?_c('div',{staticClass:"xt-list__header"},[(_vm.title)?_c('span',{staticClass:"xt-list__title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_c('div',{staticClass:"xt-list__toolbar"},[(_vm.filterable)?_c('div',{staticClass:"xt-list__search"},[_c('el-input',{attrs:{"placeholder":_vm.filterPlaceholder,"size":"small","clearable":"","prefix-icon":"el-icon-search"},on:{"input":_vm.handleSearch},model:{value:(_vm.searchText),callback:function ($$v) {_vm.searchText=$$v},expression:"searchText"}})],1):_vm._e(),(_vm.sortable && _vm.sortBy)?_c('el-button',{attrs:{"size":"small","icon":"el-icon-sort","type":_vm.currentSortOrder ? 'primary' : 'default',"plain":""},on:{"click":_vm.handleSortToggle}},[_vm._v(" "+_vm._s(_vm.sortLabel)+" ")]):_vm._e(),_vm._t("toolbar")],2)]):_vm._e(),_c('
|
|
141
|
+
// 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-list/index.vue?vue&type=template&id=084d1476&scoped=true
|
|
142
|
+
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-list",class:{ 'xt-list--loading': _vm.loading }},[(_vm.title || _vm.filterable || _vm.sortable || _vm.$slots.toolbar)?_c('div',{staticClass:"xt-list__header"},[(_vm.title)?_c('span',{staticClass:"xt-list__title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_c('div',{staticClass:"xt-list__toolbar"},[(_vm.filterable)?_c('div',{staticClass:"xt-list__search"},[_c('el-input',{attrs:{"placeholder":_vm.filterPlaceholder,"size":"small","clearable":"","prefix-icon":"el-icon-search"},on:{"input":_vm.handleSearch},model:{value:(_vm.searchText),callback:function ($$v) {_vm.searchText=$$v},expression:"searchText"}})],1):_vm._e(),(_vm.sortable && _vm.sortBy)?_c('el-button',{attrs:{"size":"small","icon":"el-icon-sort","type":_vm.currentSortOrder ? 'primary' : 'default',"plain":""},on:{"click":_vm.handleSortToggle}},[_vm._v(" "+_vm._s(_vm.sortLabel)+" ")]):_vm._e(),_vm._t("toolbar")],2)]):_vm._e(),_c('xt-scroll',{ref:"scrollContainer",class:['xt-list__body', { 'xt-list__body--virtual': _vm.virtualScroll }],style:(_vm.bodyStyle),on:{"scroll":_vm.onScroll}},[(_vm.virtualScroll)?_c('div',{staticClass:"xt-list__phantom",style:({ height: _vm.totalHeight + 'px' })},[_c('div',{style:({ paddingTop: _vm.offsetY + 'px' })},[(_vm.groupedData.length)?[_vm._l((_vm.visibleGroups),function(group,gIdx){return [_c('div',{key:group._key,staticClass:"xt-list__group"},[_c('div',{staticClass:"xt-list__group-title",on:{"click":function($event){return _vm.toggleGroup(group._key)}}},[_c('span',{staticClass:"xt-list__group-arrow",class:{ 'is-expanded': group._expanded }},[_c('i',{staticClass:"el-icon-arrow-right"})]),_vm._t("group-title",function(){return [_c('span',{staticClass:"xt-list__group-label"},[_vm._v(_vm._s(_vm.getGroupLabel(group)))]),_c('span',{staticClass:"xt-list__group-count"},[_vm._v("("+_vm._s(group._items.length)+")")])]},{"group":group,"items":group._items,"expanded":group._expanded})],2),(group._expanded)?_c('div',{class:['xt-list__cards', 'xt-list__cols-' + _vm.columns]},_vm._l((_vm.getVisibleItems(group)),function(item,idx){return _c('div',{key:item._id || idx,staticClass:"xt-list__item",on:{"click":function($event){return _vm.handleItemClick(item, group._key)}}},[_c('el-card',{attrs:{"shadow":_vm.shadow,"body-style":_vm.cardBodyStyle}},[_vm._t("default",function(){return [(_vm.getImage(item))?_c('div',{staticClass:"xt-list__image"},[_c('img',{attrs:{"src":_vm.getImage(item),"alt":_vm.getConfigValue(_vm.cardConfig.title, item)}})]):_vm._e(),(_vm.getTag(item))?_c('div',{staticClass:"xt-list__tag"},[_c('el-tag',{attrs:{"size":"small","type":_vm.getTagType(item)}},[_vm._v(_vm._s(_vm.getTag(item)))])],1):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.title, item))?_c('div',{staticClass:"xt-list__card-title"},[_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.title, item))+" ")]):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.subtitle, item))?_c('div',{staticClass:"xt-list__card-subtitle"},[_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.subtitle, item))+" ")]):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.content, item))?_c('div',{staticClass:"xt-list__card-content"},[_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.content, item))+" ")]):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.footer, item))?_c('div',{staticClass:"xt-list__card-footer"},[_vm._t("card-footer",function(){return [_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.footer, item))+" ")]},{"item":item,"index":_vm.getItemIndex(item, group)})],2):_vm._e()]},{"item":item,"index":_vm.getItemIndex(item, group),"group":group})],2)],1)}),0):_vm._e()])]})]:(!_vm.loading)?_c('div',{staticClass:"xt-list__empty"},[_vm._t("empty",function(){return [_c('span',[_vm._v(_vm._s(_vm.emptyText))])]})],2):_vm._e()],2)]):(_vm.groupedData.length)?[_vm._l((_vm.groupedData),function(group){return [_c('div',{key:group._key,staticClass:"xt-list__group"},[_c('div',{staticClass:"xt-list__group-title",on:{"click":function($event){return _vm.toggleGroup(group._key)}}},[_c('span',{staticClass:"xt-list__group-arrow",class:{ 'is-expanded': group._expanded }},[_c('i',{staticClass:"el-icon-arrow-right"})]),_vm._t("group-title",function(){return [_c('span',{staticClass:"xt-list__group-label"},[_vm._v(_vm._s(_vm.getGroupLabel(group)))]),_c('span',{staticClass:"xt-list__group-count"},[_vm._v("("+_vm._s(group._items.length)+")")])]},{"group":group,"items":group._items,"expanded":group._expanded})],2),(group._expanded)?_c('div',{class:['xt-list__cards', 'xt-list__cols-' + _vm.columns]},_vm._l((group._items),function(item,idx){return _c('div',{key:item._id || idx,staticClass:"xt-list__item",on:{"click":function($event){return _vm.handleItemClick(item, group._key)}}},[_c('el-card',{attrs:{"shadow":_vm.shadow,"body-style":_vm.cardBodyStyle}},[_vm._t("default",function(){return [(_vm.getImage(item))?_c('div',{staticClass:"xt-list__image"},[_c('img',{attrs:{"src":_vm.getImage(item),"alt":_vm.getConfigValue(_vm.cardConfig.title, item)}})]):_vm._e(),(_vm.getTag(item))?_c('div',{staticClass:"xt-list__tag"},[_c('el-tag',{attrs:{"size":"small","type":_vm.getTagType(item)}},[_vm._v(_vm._s(_vm.getTag(item)))])],1):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.title, item))?_c('div',{staticClass:"xt-list__card-title"},[_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.title, item))+" ")]):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.subtitle, item))?_c('div',{staticClass:"xt-list__card-subtitle"},[_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.subtitle, item))+" ")]):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.content, item))?_c('div',{staticClass:"xt-list__card-content"},[_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.content, item))+" ")]):_vm._e(),(_vm.getConfigValue(_vm.cardConfig.footer, item))?_c('div',{staticClass:"xt-list__card-footer"},[_vm._t("card-footer",function(){return [_vm._v(" "+_vm._s(_vm.getConfigValue(_vm.cardConfig.footer, item))+" ")]},{"item":item,"index":idx})],2):_vm._e()]},{"item":item,"index":idx,"group":group})],2)],1)}),0):_vm._e()])]})]:(!_vm.loading)?_c('div',{staticClass:"xt-list__empty"},[_vm._t("empty",function(){return [_c('span',[_vm._v(_vm._s(_vm.emptyText))])]})],2):_vm._e(),(_vm.loadMore && _vm.hasMore && !_vm.loading)?_c('div',{staticClass:"xt-list__loadmore"},[_c('el-button',{attrs:{"type":"text","loading":_vm.loadMoreLoading},on:{"click":_vm.handleLoadMore}},[_vm._v(" "+_vm._s(_vm.loadMoreText)+" ")])],1):_vm._e()],2),(_vm.loading)?_c('div',{staticClass:"xt-list__loading"},[_vm._t("loading",function(){return [_c('i',{staticClass:"el-icon-loading"}),_c('span',[_vm._v("加载中...")])]})],2):_vm._e(),(_vm.showPagination)?_c('div',{staticClass:"xt-list__footer"},[_c('el-pagination',{attrs:{"background":"","small":"","current-page":_vm.pagination.pageNum,"page-size":_vm.pagination.pageSize,"total":_vm.total,"page-sizes":_vm.pagination.pageSizes || [10, 20, 50],"layout":"total, prev, pager, next"},on:{"size-change":_vm.handleSizeChange,"current-change":_vm.handleCurrentChange}})],1):_vm._e()],1)
|
|
136
143
|
}
|
|
137
144
|
var staticRenderFns = []
|
|
138
145
|
|
|
139
146
|
|
|
140
|
-
// CONCATENATED MODULE: ./src/components/xt-list/index.vue?vue&type=template&id=
|
|
147
|
+
// CONCATENATED MODULE: ./src/components/xt-list/index.vue?vue&type=template&id=084d1476&scoped=true
|
|
148
|
+
|
|
149
|
+
// EXTERNAL MODULE: ./src/components/xt-scroll/style/index.scss
|
|
150
|
+
var style = __webpack_require__("f699");
|
|
151
|
+
|
|
152
|
+
// 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-scroll/index.vue?vue&type=template&id=74170e40
|
|
153
|
+
var xt_scrollvue_type_template_id_74170e40_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-scroll",class:[`xt-scroll--${_vm.scrollDirection}`],style:(_vm.containerStyle)},[_c('div',{ref:"scrollWrap",staticClass:"xt-scroll__wrap",class:[`xt-scroll__wrap--${_vm.scrollDirection}`],on:{"scroll":_vm.onScroll}},[(_vm.vScroll)?_c('div',{staticClass:"xt-scroll__virtual",style:(_vm.virtualWrapperStyle)},[(_vm.scrollDirection === 'vertical')?_c('div',{staticClass:"xt-scroll__phantom",style:({ height: _vm.totalSize + 'px' })},[_c('div',{style:({ transform: `translateY(${_vm.offsetStart}px)` })},[_vm._l((_vm.visibleData),function(item,index){return [_c('div',{key:_vm.getItemKey(item, index),staticClass:"xt-scroll__item",class:_vm.itemClassName,style:(_vm.itemStyle)},[_vm._t("item",function(){return [_vm._v(" "+_vm._s(item)+" ")]},{"item":item,"index":_vm.getOriginalIndex(index)})],2)]})],2)]):(_vm.scrollDirection === 'horizontal')?_c('div',{staticClass:"xt-scroll__phantom",style:({ width: _vm.totalSize + 'px' })},[_c('div',{style:({ transform: `translateX(${_vm.offsetStart}px)` })},[_vm._l((_vm.visibleData),function(item,index){return [_c('div',{key:_vm.getItemKey(item, index),staticClass:"xt-scroll__item",class:_vm.itemClassName,style:(_vm.itemStyle)},[_vm._t("item",function(){return [_vm._v(" "+_vm._s(item)+" ")]},{"item":item,"index":_vm.getOriginalIndex(index)})],2)]})],2)]):_vm._e()]):_vm._e(),(_vm.vScroll && (!_vm.data || !_vm.data.length) && !_vm.loading)?_c('div',{staticClass:"xt-scroll__empty"},[_vm._t("empty",function(){return [_c('span',[_vm._v(_vm._s(_vm.emptyText))])]})],2):_vm._e(),(_vm.loading)?_c('div',{staticClass:"xt-scroll__loading"},[_vm._t("loading",function(){return [_c('i',{staticClass:"el-icon-loading"}),_c('span',[_vm._v("加载中...")])]})],2):_vm._e(),(!_vm.vScroll)?_c('div',{staticClass:"xt-scroll__default"},[_vm._t("default")],2):_vm._e(),(_vm.vScroll && _vm.showLoadMore && !_vm.loading)?_c('div',{staticClass:"xt-scroll__loadmore",on:{"click":_vm.onLoadMore}},[_c('el-button',{attrs:{"type":"text","loading":_vm.loadMoreLoading}},[_vm._v(" "+_vm._s(_vm.loadMoreText)+" ")])],1):_vm._e()])])
|
|
154
|
+
}
|
|
155
|
+
var xt_scrollvue_type_template_id_74170e40_staticRenderFns = []
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.vue?vue&type=template&id=74170e40
|
|
159
|
+
|
|
160
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-scroll/index.vue?vue&type=script&lang=js
|
|
161
|
+
|
|
162
|
+
/* harmony default export */ var xt_scrollvue_type_script_lang_js = ({
|
|
163
|
+
name: 'XtScroll',
|
|
164
|
+
|
|
165
|
+
props: {
|
|
166
|
+
// ========== 虚拟滚动配置 ==========
|
|
167
|
+
/** 是否启用虚拟滚动 */
|
|
168
|
+
vScroll: { type: Boolean, default: false },
|
|
169
|
+
/** 数据源 */
|
|
170
|
+
data: { type: Array, default: () => [] },
|
|
171
|
+
/** 每个 item 的固定尺寸(px),纵向为高度,横向为宽度 */
|
|
172
|
+
itemSize: { type: Number, default: 50 },
|
|
173
|
+
/** item 的唯一键字段名 */
|
|
174
|
+
keyField: { type: String, default: 'id' },
|
|
175
|
+
/** 预渲染缓冲区大小(item 数量) */
|
|
176
|
+
bufferSize: { type: Number, default: 5 },
|
|
177
|
+
/** 虚拟滚动方向 */
|
|
178
|
+
scrollDirection: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: 'vertical',
|
|
181
|
+
validator: (v) => ['vertical', 'horizontal'].includes(v)
|
|
182
|
+
},
|
|
183
|
+
/** item 的自定义 CSS 类名 */
|
|
184
|
+
itemClassName: { type: String, default: '' },
|
|
185
|
+
|
|
186
|
+
// ========== 容器尺寸 ==========
|
|
187
|
+
height: { type: [Number, String], default: '' },
|
|
188
|
+
maxHeight: { type: [Number, String], default: '' },
|
|
189
|
+
width: { type: [Number, String], default: '' },
|
|
190
|
+
maxWidth: { type: [Number, String], default: '' },
|
|
191
|
+
|
|
192
|
+
// ========== 状态 ==========
|
|
193
|
+
loading: { type: Boolean, default: false },
|
|
194
|
+
emptyText: { type: String, default: '暂无数据' },
|
|
195
|
+
|
|
196
|
+
// ========== 加载更多 ==========
|
|
197
|
+
loadMore: { type: Boolean, default: false },
|
|
198
|
+
loadMoreText: { type: String, default: '加载更多' },
|
|
199
|
+
loadMoreLoading: { type: Boolean, default: false }
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
data() {
|
|
203
|
+
return {
|
|
204
|
+
scrollPos: 0,
|
|
205
|
+
containerSize: 0,
|
|
206
|
+
resizeObserver: null,
|
|
207
|
+
rafId: null
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
computed: {
|
|
212
|
+
containerStyle() {
|
|
213
|
+
const style = {}
|
|
214
|
+
if (this.height) {
|
|
215
|
+
style.height = typeof this.height === 'number' ? this.height + 'px' : this.height
|
|
216
|
+
}
|
|
217
|
+
if (this.maxHeight) {
|
|
218
|
+
style.maxHeight = typeof this.maxHeight === 'number' ? this.maxHeight + 'px' : this.maxHeight
|
|
219
|
+
}
|
|
220
|
+
if (this.width) {
|
|
221
|
+
style.width = typeof this.width === 'number' ? this.width + 'px' : this.width
|
|
222
|
+
}
|
|
223
|
+
if (this.maxWidth) {
|
|
224
|
+
style.maxWidth = typeof this.maxWidth === 'number' ? this.maxWidth + 'px' : this.maxWidth
|
|
225
|
+
}
|
|
226
|
+
return style
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
virtualWrapperStyle() {
|
|
230
|
+
const style = {}
|
|
231
|
+
if (this.scrollDirection === 'horizontal') {
|
|
232
|
+
style.height = '100%'
|
|
233
|
+
}
|
|
234
|
+
return style
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
itemStyle() {
|
|
238
|
+
return this.scrollDirection === 'vertical'
|
|
239
|
+
? { height: this.itemSize + 'px' }
|
|
240
|
+
: { width: this.itemSize + 'px', display: 'inline-block' }
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
/** 数据总条数 */
|
|
244
|
+
dataCount() {
|
|
245
|
+
return (this.data && this.data.length) || 0
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
/** 总滚动尺寸 */
|
|
249
|
+
totalSize() {
|
|
250
|
+
return this.dataCount * this.itemSize
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
/** 虚拟滚动:可见范围起始索引 */
|
|
254
|
+
visibleStartIndex() {
|
|
255
|
+
if (!this.vScroll) return 0
|
|
256
|
+
const start = Math.floor(this.scrollPos / this.itemSize)
|
|
257
|
+
return Math.max(0, start - this.bufferSize)
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
/** 虚拟滚动:可见范围结束索引 */
|
|
261
|
+
visibleEndIndex() {
|
|
262
|
+
if (!this.vScroll) return this.dataCount
|
|
263
|
+
const visibleCount = Math.ceil(this.containerSize / this.itemSize)
|
|
264
|
+
const end = Math.ceil(this.scrollPos / this.itemSize) + visibleCount
|
|
265
|
+
return Math.min(this.dataCount, end + this.bufferSize)
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
/** 可见数据 */
|
|
269
|
+
visibleData() {
|
|
270
|
+
if (!this.vScroll || !this.data) return this.data || []
|
|
271
|
+
return this.data.slice(this.visibleStartIndex, this.visibleEndIndex)
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
/** 偏移量(px) */
|
|
275
|
+
offsetStart() {
|
|
276
|
+
return this.visibleStartIndex * this.itemSize
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
/** 是否显示加载更多 */
|
|
280
|
+
showLoadMore() {
|
|
281
|
+
if (!this.loadMore || !this.dataCount) return false
|
|
282
|
+
if (this.scrollDirection === 'vertical') {
|
|
283
|
+
return this.scrollPos + this.containerSize >= this.totalSize - this.itemSize * 2
|
|
284
|
+
}
|
|
285
|
+
return false
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
watch: {
|
|
290
|
+
data: {
|
|
291
|
+
handler() {
|
|
292
|
+
this.$nextTick(() => {
|
|
293
|
+
this.updateContainerSize()
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
vScroll(val) {
|
|
298
|
+
if (val) {
|
|
299
|
+
this.$nextTick(() => {
|
|
300
|
+
this.updateContainerSize()
|
|
301
|
+
this.bindResizeObserver()
|
|
302
|
+
})
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
mounted() {
|
|
308
|
+
this.$nextTick(() => {
|
|
309
|
+
this.updateContainerSize()
|
|
310
|
+
if (this.vScroll) {
|
|
311
|
+
this.bindResizeObserver()
|
|
312
|
+
}
|
|
313
|
+
})
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
beforeDestroy() {
|
|
317
|
+
this.unbindResizeObserver()
|
|
318
|
+
if (this.rafId && typeof cancelAnimationFrame !== 'undefined') {
|
|
319
|
+
cancelAnimationFrame(this.rafId)
|
|
320
|
+
this.rafId = null
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
methods: {
|
|
325
|
+
// ========== 虚拟滚动 ==========
|
|
326
|
+
onScroll() {
|
|
327
|
+
const wrap = this.$refs.scrollWrap
|
|
328
|
+
if (!wrap) return
|
|
329
|
+
|
|
330
|
+
const pos = this.scrollDirection === 'vertical' ? wrap.scrollTop : wrap.scrollLeft
|
|
331
|
+
this.scrollPos = pos
|
|
332
|
+
|
|
333
|
+
// 对外 emit scroll 事件,传递 scrollTop/scrollLeft 方便父组件使用
|
|
334
|
+
this.$emit('scroll', {
|
|
335
|
+
scrollTop: wrap.scrollTop,
|
|
336
|
+
scrollLeft: wrap.scrollLeft
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
if (this.rafId) return
|
|
340
|
+
if (typeof requestAnimationFrame === 'undefined') return
|
|
341
|
+
this.rafId = requestAnimationFrame(() => {
|
|
342
|
+
this.$forceUpdate()
|
|
343
|
+
this.rafId = null
|
|
344
|
+
})
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
getItemKey(item, index) {
|
|
348
|
+
if (item && typeof item === 'object' && this.keyField && item[this.keyField] != null) {
|
|
349
|
+
return item[this.keyField]
|
|
350
|
+
}
|
|
351
|
+
return `vitem_${this.visibleStartIndex + index}`
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
getOriginalIndex(index) {
|
|
355
|
+
return this.visibleStartIndex + index
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
// ========== 容器尺寸 ==========
|
|
359
|
+
updateContainerSize() {
|
|
360
|
+
const wrap = this.$refs.scrollWrap
|
|
361
|
+
if (!wrap) return
|
|
362
|
+
|
|
363
|
+
this.containerSize = this.scrollDirection === 'vertical'
|
|
364
|
+
? wrap.clientHeight
|
|
365
|
+
: wrap.clientWidth
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
bindResizeObserver() {
|
|
369
|
+
if (typeof ResizeObserver === 'undefined') return
|
|
370
|
+
this.unbindResizeObserver()
|
|
371
|
+
|
|
372
|
+
const wrap = this.$refs.scrollWrap
|
|
373
|
+
if (!wrap) return
|
|
374
|
+
|
|
375
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
376
|
+
this.updateContainerSize()
|
|
377
|
+
})
|
|
378
|
+
this.resizeObserver.observe(wrap)
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
unbindResizeObserver() {
|
|
382
|
+
if (this.resizeObserver) {
|
|
383
|
+
this.resizeObserver.disconnect()
|
|
384
|
+
this.resizeObserver = null
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
// ========== 加载更多 ==========
|
|
389
|
+
onLoadMore() {
|
|
390
|
+
this.$emit('load-more')
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
// ========== 对外暴露方法 ==========
|
|
394
|
+
/** 获取原生滚动容器 DOM 元素 */
|
|
395
|
+
getScrollContainer() {
|
|
396
|
+
return this.$refs.scrollWrap
|
|
397
|
+
},
|
|
398
|
+
|
|
399
|
+
/** 滚动到指定位置 */
|
|
400
|
+
scrollTo(pos, behavior) {
|
|
401
|
+
const wrap = this.$refs.scrollWrap
|
|
402
|
+
if (!wrap) return
|
|
403
|
+
|
|
404
|
+
const opts = behavior && typeof behavior === 'string'
|
|
405
|
+
? { behavior }
|
|
406
|
+
: { behavior: 'smooth' }
|
|
407
|
+
|
|
408
|
+
if (this.scrollDirection === 'vertical') {
|
|
409
|
+
wrap.scrollTo({ top: pos, ...opts })
|
|
410
|
+
} else {
|
|
411
|
+
wrap.scrollTo({ left: pos, ...opts })
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
/** 滚动到指定索引的 item */
|
|
416
|
+
scrollToItem(index) {
|
|
417
|
+
const pos = index * this.itemSize
|
|
418
|
+
this.scrollTo(pos)
|
|
419
|
+
},
|
|
420
|
+
|
|
421
|
+
/** 滚动到顶部/左侧 */
|
|
422
|
+
scrollToStart() {
|
|
423
|
+
this.scrollTo(0)
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
/** 滚动到底部/右侧 */
|
|
427
|
+
scrollToEnd() {
|
|
428
|
+
this.scrollTo(this.totalSize)
|
|
429
|
+
},
|
|
430
|
+
|
|
431
|
+
/** 获取当前滚动位置 */
|
|
432
|
+
getScrollPos() {
|
|
433
|
+
return this.scrollPos
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.vue?vue&type=script&lang=js
|
|
439
|
+
/* harmony default export */ var components_xt_scrollvue_type_script_lang_js = (xt_scrollvue_type_script_lang_js);
|
|
440
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
441
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
442
|
+
|
|
443
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
444
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
445
|
+
// be included in the final webpack user bundle.
|
|
446
|
+
|
|
447
|
+
function normalizeComponent(
|
|
448
|
+
scriptExports,
|
|
449
|
+
render,
|
|
450
|
+
staticRenderFns,
|
|
451
|
+
functionalTemplate,
|
|
452
|
+
injectStyles,
|
|
453
|
+
scopeId,
|
|
454
|
+
moduleIdentifier /* server only */,
|
|
455
|
+
shadowMode /* vue-cli only */
|
|
456
|
+
) {
|
|
457
|
+
// Vue.extend constructor export interop
|
|
458
|
+
var options =
|
|
459
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
460
|
+
|
|
461
|
+
// render functions
|
|
462
|
+
if (render) {
|
|
463
|
+
options.render = render
|
|
464
|
+
options.staticRenderFns = staticRenderFns
|
|
465
|
+
options._compiled = true
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// functional template
|
|
469
|
+
if (functionalTemplate) {
|
|
470
|
+
options.functional = true
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// scopedId
|
|
474
|
+
if (scopeId) {
|
|
475
|
+
options._scopeId = 'data-v-' + scopeId
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
var hook
|
|
479
|
+
if (moduleIdentifier) {
|
|
480
|
+
// server build
|
|
481
|
+
hook = function (context) {
|
|
482
|
+
// 2.3 injection
|
|
483
|
+
context =
|
|
484
|
+
context || // cached call
|
|
485
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
486
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
487
|
+
// 2.2 with runInNewContext: true
|
|
488
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
489
|
+
context = __VUE_SSR_CONTEXT__
|
|
490
|
+
}
|
|
491
|
+
// inject component styles
|
|
492
|
+
if (injectStyles) {
|
|
493
|
+
injectStyles.call(this, context)
|
|
494
|
+
}
|
|
495
|
+
// register component module identifier for async chunk inferrence
|
|
496
|
+
if (context && context._registeredComponents) {
|
|
497
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// used by ssr in case component is cached and beforeCreate
|
|
501
|
+
// never gets called
|
|
502
|
+
options._ssrRegister = hook
|
|
503
|
+
} else if (injectStyles) {
|
|
504
|
+
hook = shadowMode
|
|
505
|
+
? function () {
|
|
506
|
+
injectStyles.call(
|
|
507
|
+
this,
|
|
508
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
509
|
+
)
|
|
510
|
+
}
|
|
511
|
+
: injectStyles
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (hook) {
|
|
515
|
+
if (options.functional) {
|
|
516
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
517
|
+
// go through the normalizer
|
|
518
|
+
options._injectStyles = hook
|
|
519
|
+
// register for functional component in vue file
|
|
520
|
+
var originalRender = options.render
|
|
521
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
522
|
+
hook.call(context)
|
|
523
|
+
return originalRender(h, context)
|
|
524
|
+
}
|
|
525
|
+
} else {
|
|
526
|
+
// inject component registration as beforeCreate hook
|
|
527
|
+
var existing = options.beforeCreate
|
|
528
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
return {
|
|
533
|
+
exports: scriptExports,
|
|
534
|
+
options: options
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.vue
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
/* normalize component */
|
|
545
|
+
|
|
546
|
+
var component = normalizeComponent(
|
|
547
|
+
components_xt_scrollvue_type_script_lang_js,
|
|
548
|
+
xt_scrollvue_type_template_id_74170e40_render,
|
|
549
|
+
xt_scrollvue_type_template_id_74170e40_staticRenderFns,
|
|
550
|
+
false,
|
|
551
|
+
null,
|
|
552
|
+
null,
|
|
553
|
+
null
|
|
554
|
+
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
/* harmony default export */ var xt_scroll = (component.exports);
|
|
558
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.js
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
xt_scroll.install = function (Vue) {
|
|
563
|
+
Vue.component(xt_scroll.name, xt_scroll)
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/* harmony default export */ var components_xt_scroll = (xt_scroll);
|
|
141
567
|
|
|
142
568
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-list/index.vue?vue&type=script&lang=js
|
|
143
569
|
|
|
570
|
+
|
|
571
|
+
|
|
144
572
|
const CARD_ITEM_HEIGHT = 160
|
|
145
573
|
const GROUP_HEADER_HEIGHT = 44
|
|
146
574
|
|
|
147
575
|
/* harmony default export */ var xt_listvue_type_script_lang_js = ({
|
|
148
576
|
name: 'XtList',
|
|
149
577
|
|
|
578
|
+
components: {
|
|
579
|
+
XtScroll: components_xt_scroll
|
|
580
|
+
},
|
|
581
|
+
|
|
150
582
|
props: {
|
|
151
583
|
data: { type: Array, default: () => [] },
|
|
152
584
|
// 分组配置
|
|
@@ -476,9 +908,10 @@ const GROUP_HEADER_HEIGHT = 44
|
|
|
476
908
|
return group._items.indexOf(item)
|
|
477
909
|
},
|
|
478
910
|
|
|
479
|
-
onScroll() {
|
|
911
|
+
onScroll(e) {
|
|
480
912
|
if (!this.virtualScroll) return
|
|
481
|
-
|
|
913
|
+
// xt-scroll 传递的是 { scrollTop, scrollLeft } 对象
|
|
914
|
+
this.scrollTop = e && e.scrollTop != null ? e.scrollTop : 0
|
|
482
915
|
if (this.rafId) return
|
|
483
916
|
if (typeof requestAnimationFrame === 'undefined') return
|
|
484
917
|
this.rafId = requestAnimationFrame(() => {
|
|
@@ -489,18 +922,22 @@ const GROUP_HEADER_HEIGHT = 44
|
|
|
489
922
|
|
|
490
923
|
updateContainerHeight() {
|
|
491
924
|
if (this.$refs.scrollContainer) {
|
|
492
|
-
|
|
925
|
+
const scrollCmp = this.$refs.scrollContainer
|
|
926
|
+
const wrap = scrollCmp.getScrollContainer && scrollCmp.getScrollContainer()
|
|
927
|
+
this.containerHeight = wrap ? wrap.clientHeight : 0
|
|
493
928
|
}
|
|
494
929
|
},
|
|
495
930
|
|
|
496
931
|
bindResizeObserver() {
|
|
497
932
|
if (typeof ResizeObserver === 'undefined') return
|
|
498
|
-
const
|
|
499
|
-
if (!
|
|
933
|
+
const scrollCmp = this.$refs.scrollContainer
|
|
934
|
+
if (!scrollCmp) return
|
|
935
|
+
const wrap = scrollCmp.getScrollContainer && scrollCmp.getScrollContainer()
|
|
936
|
+
if (!wrap) return
|
|
500
937
|
this.resizeObserver = new ResizeObserver(() => {
|
|
501
938
|
this.updateContainerHeight()
|
|
502
939
|
})
|
|
503
|
-
this.resizeObserver.observe(
|
|
940
|
+
this.resizeObserver.observe(wrap)
|
|
504
941
|
},
|
|
505
942
|
|
|
506
943
|
unbindResizeObserver() {
|
|
@@ -540,8 +977,8 @@ const GROUP_HEADER_HEIGHT = 44
|
|
|
540
977
|
|
|
541
978
|
// ========== 对外暴露方法 ==========
|
|
542
979
|
scrollToTop() {
|
|
543
|
-
if (this.$refs.scrollContainer) {
|
|
544
|
-
this.$refs.scrollContainer.
|
|
980
|
+
if (this.$refs.scrollContainer && this.$refs.scrollContainer.scrollToStart) {
|
|
981
|
+
this.$refs.scrollContainer.scrollToStart()
|
|
545
982
|
}
|
|
546
983
|
},
|
|
547
984
|
|
|
@@ -571,106 +1008,8 @@ const GROUP_HEADER_HEIGHT = 44
|
|
|
571
1008
|
|
|
572
1009
|
// CONCATENATED MODULE: ./src/components/xt-list/index.vue?vue&type=script&lang=js
|
|
573
1010
|
/* harmony default export */ var components_xt_listvue_type_script_lang_js = (xt_listvue_type_script_lang_js);
|
|
574
|
-
// EXTERNAL MODULE: ./src/components/xt-list/index.vue?vue&type=style&index=0&id=
|
|
575
|
-
var
|
|
576
|
-
|
|
577
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
578
|
-
/* globals __VUE_SSR_CONTEXT__ */
|
|
579
|
-
|
|
580
|
-
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
581
|
-
// This module is a runtime utility for cleaner component module output and will
|
|
582
|
-
// be included in the final webpack user bundle.
|
|
583
|
-
|
|
584
|
-
function normalizeComponent(
|
|
585
|
-
scriptExports,
|
|
586
|
-
render,
|
|
587
|
-
staticRenderFns,
|
|
588
|
-
functionalTemplate,
|
|
589
|
-
injectStyles,
|
|
590
|
-
scopeId,
|
|
591
|
-
moduleIdentifier /* server only */,
|
|
592
|
-
shadowMode /* vue-cli only */
|
|
593
|
-
) {
|
|
594
|
-
// Vue.extend constructor export interop
|
|
595
|
-
var options =
|
|
596
|
-
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
597
|
-
|
|
598
|
-
// render functions
|
|
599
|
-
if (render) {
|
|
600
|
-
options.render = render
|
|
601
|
-
options.staticRenderFns = staticRenderFns
|
|
602
|
-
options._compiled = true
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// functional template
|
|
606
|
-
if (functionalTemplate) {
|
|
607
|
-
options.functional = true
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
// scopedId
|
|
611
|
-
if (scopeId) {
|
|
612
|
-
options._scopeId = 'data-v-' + scopeId
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
var hook
|
|
616
|
-
if (moduleIdentifier) {
|
|
617
|
-
// server build
|
|
618
|
-
hook = function (context) {
|
|
619
|
-
// 2.3 injection
|
|
620
|
-
context =
|
|
621
|
-
context || // cached call
|
|
622
|
-
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
623
|
-
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
624
|
-
// 2.2 with runInNewContext: true
|
|
625
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
626
|
-
context = __VUE_SSR_CONTEXT__
|
|
627
|
-
}
|
|
628
|
-
// inject component styles
|
|
629
|
-
if (injectStyles) {
|
|
630
|
-
injectStyles.call(this, context)
|
|
631
|
-
}
|
|
632
|
-
// register component module identifier for async chunk inferrence
|
|
633
|
-
if (context && context._registeredComponents) {
|
|
634
|
-
context._registeredComponents.add(moduleIdentifier)
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
// used by ssr in case component is cached and beforeCreate
|
|
638
|
-
// never gets called
|
|
639
|
-
options._ssrRegister = hook
|
|
640
|
-
} else if (injectStyles) {
|
|
641
|
-
hook = shadowMode
|
|
642
|
-
? function () {
|
|
643
|
-
injectStyles.call(
|
|
644
|
-
this,
|
|
645
|
-
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
646
|
-
)
|
|
647
|
-
}
|
|
648
|
-
: injectStyles
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
if (hook) {
|
|
652
|
-
if (options.functional) {
|
|
653
|
-
// for template-only hot-reload because in that case the render fn doesn't
|
|
654
|
-
// go through the normalizer
|
|
655
|
-
options._injectStyles = hook
|
|
656
|
-
// register for functional component in vue file
|
|
657
|
-
var originalRender = options.render
|
|
658
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
659
|
-
hook.call(context)
|
|
660
|
-
return originalRender(h, context)
|
|
661
|
-
}
|
|
662
|
-
} else {
|
|
663
|
-
// inject component registration as beforeCreate hook
|
|
664
|
-
var existing = options.beforeCreate
|
|
665
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
return {
|
|
670
|
-
exports: scriptExports,
|
|
671
|
-
options: options
|
|
672
|
-
}
|
|
673
|
-
}
|
|
1011
|
+
// EXTERNAL MODULE: ./src/components/xt-list/index.vue?vue&type=style&index=0&id=084d1476&prod&scoped=true&lang=css
|
|
1012
|
+
var xt_listvue_type_style_index_0_id_084d1476_prod_scoped_true_lang_css = __webpack_require__("52fd");
|
|
674
1013
|
|
|
675
1014
|
// CONCATENATED MODULE: ./src/components/xt-list/index.vue
|
|
676
1015
|
|
|
@@ -681,18 +1020,18 @@ function normalizeComponent(
|
|
|
681
1020
|
|
|
682
1021
|
/* normalize component */
|
|
683
1022
|
|
|
684
|
-
var
|
|
1023
|
+
var xt_list_component = normalizeComponent(
|
|
685
1024
|
components_xt_listvue_type_script_lang_js,
|
|
686
1025
|
render,
|
|
687
1026
|
staticRenderFns,
|
|
688
1027
|
false,
|
|
689
1028
|
null,
|
|
690
|
-
"
|
|
1029
|
+
"084d1476",
|
|
691
1030
|
null
|
|
692
1031
|
|
|
693
1032
|
)
|
|
694
1033
|
|
|
695
|
-
/* harmony default export */ var xt_list = (
|
|
1034
|
+
/* harmony default export */ var xt_list = (xt_list_component.exports);
|
|
696
1035
|
// CONCATENATED MODULE: ./src/components/xt-list/index.js
|
|
697
1036
|
|
|
698
1037
|
|