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
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
module.exports =
|
|
2
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
3
|
+
/******/ // The module cache
|
|
4
|
+
/******/ var installedModules = {};
|
|
5
|
+
/******/
|
|
6
|
+
/******/ // The require function
|
|
7
|
+
/******/ function __webpack_require__(moduleId) {
|
|
8
|
+
/******/
|
|
9
|
+
/******/ // Check if module is in cache
|
|
10
|
+
/******/ if(installedModules[moduleId]) {
|
|
11
|
+
/******/ return installedModules[moduleId].exports;
|
|
12
|
+
/******/ }
|
|
13
|
+
/******/ // Create a new module (and put it into the cache)
|
|
14
|
+
/******/ var module = installedModules[moduleId] = {
|
|
15
|
+
/******/ i: moduleId,
|
|
16
|
+
/******/ l: false,
|
|
17
|
+
/******/ exports: {}
|
|
18
|
+
/******/ };
|
|
19
|
+
/******/
|
|
20
|
+
/******/ // Execute the module function
|
|
21
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
22
|
+
/******/
|
|
23
|
+
/******/ // Flag the module as loaded
|
|
24
|
+
/******/ module.l = true;
|
|
25
|
+
/******/
|
|
26
|
+
/******/ // Return the exports of the module
|
|
27
|
+
/******/ return module.exports;
|
|
28
|
+
/******/ }
|
|
29
|
+
/******/
|
|
30
|
+
/******/
|
|
31
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
32
|
+
/******/ __webpack_require__.m = modules;
|
|
33
|
+
/******/
|
|
34
|
+
/******/ // expose the module cache
|
|
35
|
+
/******/ __webpack_require__.c = installedModules;
|
|
36
|
+
/******/
|
|
37
|
+
/******/ // define getter function for harmony exports
|
|
38
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
39
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
40
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
41
|
+
/******/ }
|
|
42
|
+
/******/ };
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // define __esModule on exports
|
|
45
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
46
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
/******/ }
|
|
49
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
/******/ };
|
|
51
|
+
/******/
|
|
52
|
+
/******/ // create a fake namespace object
|
|
53
|
+
/******/ // mode & 1: value is a module id, require it
|
|
54
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
55
|
+
/******/ // mode & 4: return value when already ns object
|
|
56
|
+
/******/ // mode & 8|1: behave like require
|
|
57
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
58
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
59
|
+
/******/ if(mode & 8) return value;
|
|
60
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
61
|
+
/******/ var ns = Object.create(null);
|
|
62
|
+
/******/ __webpack_require__.r(ns);
|
|
63
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
64
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
65
|
+
/******/ return ns;
|
|
66
|
+
/******/ };
|
|
67
|
+
/******/
|
|
68
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
69
|
+
/******/ __webpack_require__.n = function(module) {
|
|
70
|
+
/******/ var getter = module && module.__esModule ?
|
|
71
|
+
/******/ function getDefault() { return module['default']; } :
|
|
72
|
+
/******/ function getModuleExports() { return module; };
|
|
73
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
74
|
+
/******/ return getter;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
78
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
79
|
+
/******/
|
|
80
|
+
/******/ // __webpack_public_path__
|
|
81
|
+
/******/ __webpack_require__.p = "";
|
|
82
|
+
/******/
|
|
83
|
+
/******/
|
|
84
|
+
/******/ // Load entry module and return exports
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
|
|
86
|
+
/******/ })
|
|
87
|
+
/************************************************************************/
|
|
88
|
+
/******/ ({
|
|
89
|
+
|
|
90
|
+
/***/ "f699":
|
|
91
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
92
|
+
|
|
93
|
+
// extracted by mini-css-extract-plugin
|
|
94
|
+
|
|
95
|
+
/***/ }),
|
|
96
|
+
|
|
97
|
+
/***/ "fb15":
|
|
98
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
99
|
+
|
|
100
|
+
"use strict";
|
|
101
|
+
// ESM COMPAT FLAG
|
|
102
|
+
__webpack_require__.r(__webpack_exports__);
|
|
103
|
+
|
|
104
|
+
// EXPORTS
|
|
105
|
+
__webpack_require__.d(__webpack_exports__, "XtScroll", function() { return /* reexport */ xt_scroll; });
|
|
106
|
+
|
|
107
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
108
|
+
// This file is imported into lib/wc client bundles.
|
|
109
|
+
|
|
110
|
+
if (typeof window !== 'undefined') {
|
|
111
|
+
var currentScript = window.document.currentScript
|
|
112
|
+
if (false) { var getCurrentScript; }
|
|
113
|
+
|
|
114
|
+
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
|
|
115
|
+
if (src) {
|
|
116
|
+
__webpack_require__.p = src[1] // eslint-disable-line
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Indicate to webpack that this file can be concatenated
|
|
121
|
+
/* harmony default export */ var setPublicPath = (null);
|
|
122
|
+
|
|
123
|
+
// EXTERNAL MODULE: ./src/components/xt-scroll/style/index.scss
|
|
124
|
+
var style = __webpack_require__("f699");
|
|
125
|
+
|
|
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-scroll/index.vue?vue&type=template&id=74170e40
|
|
127
|
+
var 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()])])
|
|
128
|
+
}
|
|
129
|
+
var staticRenderFns = []
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.vue?vue&type=template&id=74170e40
|
|
133
|
+
|
|
134
|
+
// 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
|
|
135
|
+
|
|
136
|
+
/* harmony default export */ var xt_scrollvue_type_script_lang_js = ({
|
|
137
|
+
name: 'XtScroll',
|
|
138
|
+
|
|
139
|
+
props: {
|
|
140
|
+
// ========== 虚拟滚动配置 ==========
|
|
141
|
+
/** 是否启用虚拟滚动 */
|
|
142
|
+
vScroll: { type: Boolean, default: false },
|
|
143
|
+
/** 数据源 */
|
|
144
|
+
data: { type: Array, default: () => [] },
|
|
145
|
+
/** 每个 item 的固定尺寸(px),纵向为高度,横向为宽度 */
|
|
146
|
+
itemSize: { type: Number, default: 50 },
|
|
147
|
+
/** item 的唯一键字段名 */
|
|
148
|
+
keyField: { type: String, default: 'id' },
|
|
149
|
+
/** 预渲染缓冲区大小(item 数量) */
|
|
150
|
+
bufferSize: { type: Number, default: 5 },
|
|
151
|
+
/** 虚拟滚动方向 */
|
|
152
|
+
scrollDirection: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: 'vertical',
|
|
155
|
+
validator: (v) => ['vertical', 'horizontal'].includes(v)
|
|
156
|
+
},
|
|
157
|
+
/** item 的自定义 CSS 类名 */
|
|
158
|
+
itemClassName: { type: String, default: '' },
|
|
159
|
+
|
|
160
|
+
// ========== 容器尺寸 ==========
|
|
161
|
+
height: { type: [Number, String], default: '' },
|
|
162
|
+
maxHeight: { type: [Number, String], default: '' },
|
|
163
|
+
width: { type: [Number, String], default: '' },
|
|
164
|
+
maxWidth: { type: [Number, String], default: '' },
|
|
165
|
+
|
|
166
|
+
// ========== 状态 ==========
|
|
167
|
+
loading: { type: Boolean, default: false },
|
|
168
|
+
emptyText: { type: String, default: '暂无数据' },
|
|
169
|
+
|
|
170
|
+
// ========== 加载更多 ==========
|
|
171
|
+
loadMore: { type: Boolean, default: false },
|
|
172
|
+
loadMoreText: { type: String, default: '加载更多' },
|
|
173
|
+
loadMoreLoading: { type: Boolean, default: false }
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
data() {
|
|
177
|
+
return {
|
|
178
|
+
scrollPos: 0,
|
|
179
|
+
containerSize: 0,
|
|
180
|
+
resizeObserver: null,
|
|
181
|
+
rafId: null
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
computed: {
|
|
186
|
+
containerStyle() {
|
|
187
|
+
const style = {}
|
|
188
|
+
if (this.height) {
|
|
189
|
+
style.height = typeof this.height === 'number' ? this.height + 'px' : this.height
|
|
190
|
+
}
|
|
191
|
+
if (this.maxHeight) {
|
|
192
|
+
style.maxHeight = typeof this.maxHeight === 'number' ? this.maxHeight + 'px' : this.maxHeight
|
|
193
|
+
}
|
|
194
|
+
if (this.width) {
|
|
195
|
+
style.width = typeof this.width === 'number' ? this.width + 'px' : this.width
|
|
196
|
+
}
|
|
197
|
+
if (this.maxWidth) {
|
|
198
|
+
style.maxWidth = typeof this.maxWidth === 'number' ? this.maxWidth + 'px' : this.maxWidth
|
|
199
|
+
}
|
|
200
|
+
return style
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
virtualWrapperStyle() {
|
|
204
|
+
const style = {}
|
|
205
|
+
if (this.scrollDirection === 'horizontal') {
|
|
206
|
+
style.height = '100%'
|
|
207
|
+
}
|
|
208
|
+
return style
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
itemStyle() {
|
|
212
|
+
return this.scrollDirection === 'vertical'
|
|
213
|
+
? { height: this.itemSize + 'px' }
|
|
214
|
+
: { width: this.itemSize + 'px', display: 'inline-block' }
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
/** 数据总条数 */
|
|
218
|
+
dataCount() {
|
|
219
|
+
return (this.data && this.data.length) || 0
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
/** 总滚动尺寸 */
|
|
223
|
+
totalSize() {
|
|
224
|
+
return this.dataCount * this.itemSize
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
/** 虚拟滚动:可见范围起始索引 */
|
|
228
|
+
visibleStartIndex() {
|
|
229
|
+
if (!this.vScroll) return 0
|
|
230
|
+
const start = Math.floor(this.scrollPos / this.itemSize)
|
|
231
|
+
return Math.max(0, start - this.bufferSize)
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
/** 虚拟滚动:可见范围结束索引 */
|
|
235
|
+
visibleEndIndex() {
|
|
236
|
+
if (!this.vScroll) return this.dataCount
|
|
237
|
+
const visibleCount = Math.ceil(this.containerSize / this.itemSize)
|
|
238
|
+
const end = Math.ceil(this.scrollPos / this.itemSize) + visibleCount
|
|
239
|
+
return Math.min(this.dataCount, end + this.bufferSize)
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
/** 可见数据 */
|
|
243
|
+
visibleData() {
|
|
244
|
+
if (!this.vScroll || !this.data) return this.data || []
|
|
245
|
+
return this.data.slice(this.visibleStartIndex, this.visibleEndIndex)
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
/** 偏移量(px) */
|
|
249
|
+
offsetStart() {
|
|
250
|
+
return this.visibleStartIndex * this.itemSize
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
/** 是否显示加载更多 */
|
|
254
|
+
showLoadMore() {
|
|
255
|
+
if (!this.loadMore || !this.dataCount) return false
|
|
256
|
+
if (this.scrollDirection === 'vertical') {
|
|
257
|
+
return this.scrollPos + this.containerSize >= this.totalSize - this.itemSize * 2
|
|
258
|
+
}
|
|
259
|
+
return false
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
watch: {
|
|
264
|
+
data: {
|
|
265
|
+
handler() {
|
|
266
|
+
this.$nextTick(() => {
|
|
267
|
+
this.updateContainerSize()
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
vScroll(val) {
|
|
272
|
+
if (val) {
|
|
273
|
+
this.$nextTick(() => {
|
|
274
|
+
this.updateContainerSize()
|
|
275
|
+
this.bindResizeObserver()
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
mounted() {
|
|
282
|
+
this.$nextTick(() => {
|
|
283
|
+
this.updateContainerSize()
|
|
284
|
+
if (this.vScroll) {
|
|
285
|
+
this.bindResizeObserver()
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
beforeDestroy() {
|
|
291
|
+
this.unbindResizeObserver()
|
|
292
|
+
if (this.rafId && typeof cancelAnimationFrame !== 'undefined') {
|
|
293
|
+
cancelAnimationFrame(this.rafId)
|
|
294
|
+
this.rafId = null
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
methods: {
|
|
299
|
+
// ========== 虚拟滚动 ==========
|
|
300
|
+
onScroll() {
|
|
301
|
+
const wrap = this.$refs.scrollWrap
|
|
302
|
+
if (!wrap) return
|
|
303
|
+
|
|
304
|
+
const pos = this.scrollDirection === 'vertical' ? wrap.scrollTop : wrap.scrollLeft
|
|
305
|
+
this.scrollPos = pos
|
|
306
|
+
|
|
307
|
+
// 对外 emit scroll 事件,传递 scrollTop/scrollLeft 方便父组件使用
|
|
308
|
+
this.$emit('scroll', {
|
|
309
|
+
scrollTop: wrap.scrollTop,
|
|
310
|
+
scrollLeft: wrap.scrollLeft
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
if (this.rafId) return
|
|
314
|
+
if (typeof requestAnimationFrame === 'undefined') return
|
|
315
|
+
this.rafId = requestAnimationFrame(() => {
|
|
316
|
+
this.$forceUpdate()
|
|
317
|
+
this.rafId = null
|
|
318
|
+
})
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
getItemKey(item, index) {
|
|
322
|
+
if (item && typeof item === 'object' && this.keyField && item[this.keyField] != null) {
|
|
323
|
+
return item[this.keyField]
|
|
324
|
+
}
|
|
325
|
+
return `vitem_${this.visibleStartIndex + index}`
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
getOriginalIndex(index) {
|
|
329
|
+
return this.visibleStartIndex + index
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
// ========== 容器尺寸 ==========
|
|
333
|
+
updateContainerSize() {
|
|
334
|
+
const wrap = this.$refs.scrollWrap
|
|
335
|
+
if (!wrap) return
|
|
336
|
+
|
|
337
|
+
this.containerSize = this.scrollDirection === 'vertical'
|
|
338
|
+
? wrap.clientHeight
|
|
339
|
+
: wrap.clientWidth
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
bindResizeObserver() {
|
|
343
|
+
if (typeof ResizeObserver === 'undefined') return
|
|
344
|
+
this.unbindResizeObserver()
|
|
345
|
+
|
|
346
|
+
const wrap = this.$refs.scrollWrap
|
|
347
|
+
if (!wrap) return
|
|
348
|
+
|
|
349
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
350
|
+
this.updateContainerSize()
|
|
351
|
+
})
|
|
352
|
+
this.resizeObserver.observe(wrap)
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
unbindResizeObserver() {
|
|
356
|
+
if (this.resizeObserver) {
|
|
357
|
+
this.resizeObserver.disconnect()
|
|
358
|
+
this.resizeObserver = null
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
// ========== 加载更多 ==========
|
|
363
|
+
onLoadMore() {
|
|
364
|
+
this.$emit('load-more')
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
// ========== 对外暴露方法 ==========
|
|
368
|
+
/** 获取原生滚动容器 DOM 元素 */
|
|
369
|
+
getScrollContainer() {
|
|
370
|
+
return this.$refs.scrollWrap
|
|
371
|
+
},
|
|
372
|
+
|
|
373
|
+
/** 滚动到指定位置 */
|
|
374
|
+
scrollTo(pos, behavior) {
|
|
375
|
+
const wrap = this.$refs.scrollWrap
|
|
376
|
+
if (!wrap) return
|
|
377
|
+
|
|
378
|
+
const opts = behavior && typeof behavior === 'string'
|
|
379
|
+
? { behavior }
|
|
380
|
+
: { behavior: 'smooth' }
|
|
381
|
+
|
|
382
|
+
if (this.scrollDirection === 'vertical') {
|
|
383
|
+
wrap.scrollTo({ top: pos, ...opts })
|
|
384
|
+
} else {
|
|
385
|
+
wrap.scrollTo({ left: pos, ...opts })
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
/** 滚动到指定索引的 item */
|
|
390
|
+
scrollToItem(index) {
|
|
391
|
+
const pos = index * this.itemSize
|
|
392
|
+
this.scrollTo(pos)
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
/** 滚动到顶部/左侧 */
|
|
396
|
+
scrollToStart() {
|
|
397
|
+
this.scrollTo(0)
|
|
398
|
+
},
|
|
399
|
+
|
|
400
|
+
/** 滚动到底部/右侧 */
|
|
401
|
+
scrollToEnd() {
|
|
402
|
+
this.scrollTo(this.totalSize)
|
|
403
|
+
},
|
|
404
|
+
|
|
405
|
+
/** 获取当前滚动位置 */
|
|
406
|
+
getScrollPos() {
|
|
407
|
+
return this.scrollPos
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.vue?vue&type=script&lang=js
|
|
413
|
+
/* harmony default export */ var components_xt_scrollvue_type_script_lang_js = (xt_scrollvue_type_script_lang_js);
|
|
414
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
415
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
416
|
+
|
|
417
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
418
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
419
|
+
// be included in the final webpack user bundle.
|
|
420
|
+
|
|
421
|
+
function normalizeComponent(
|
|
422
|
+
scriptExports,
|
|
423
|
+
render,
|
|
424
|
+
staticRenderFns,
|
|
425
|
+
functionalTemplate,
|
|
426
|
+
injectStyles,
|
|
427
|
+
scopeId,
|
|
428
|
+
moduleIdentifier /* server only */,
|
|
429
|
+
shadowMode /* vue-cli only */
|
|
430
|
+
) {
|
|
431
|
+
// Vue.extend constructor export interop
|
|
432
|
+
var options =
|
|
433
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
434
|
+
|
|
435
|
+
// render functions
|
|
436
|
+
if (render) {
|
|
437
|
+
options.render = render
|
|
438
|
+
options.staticRenderFns = staticRenderFns
|
|
439
|
+
options._compiled = true
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// functional template
|
|
443
|
+
if (functionalTemplate) {
|
|
444
|
+
options.functional = true
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// scopedId
|
|
448
|
+
if (scopeId) {
|
|
449
|
+
options._scopeId = 'data-v-' + scopeId
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
var hook
|
|
453
|
+
if (moduleIdentifier) {
|
|
454
|
+
// server build
|
|
455
|
+
hook = function (context) {
|
|
456
|
+
// 2.3 injection
|
|
457
|
+
context =
|
|
458
|
+
context || // cached call
|
|
459
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
460
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
461
|
+
// 2.2 with runInNewContext: true
|
|
462
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
463
|
+
context = __VUE_SSR_CONTEXT__
|
|
464
|
+
}
|
|
465
|
+
// inject component styles
|
|
466
|
+
if (injectStyles) {
|
|
467
|
+
injectStyles.call(this, context)
|
|
468
|
+
}
|
|
469
|
+
// register component module identifier for async chunk inferrence
|
|
470
|
+
if (context && context._registeredComponents) {
|
|
471
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
// used by ssr in case component is cached and beforeCreate
|
|
475
|
+
// never gets called
|
|
476
|
+
options._ssrRegister = hook
|
|
477
|
+
} else if (injectStyles) {
|
|
478
|
+
hook = shadowMode
|
|
479
|
+
? function () {
|
|
480
|
+
injectStyles.call(
|
|
481
|
+
this,
|
|
482
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
483
|
+
)
|
|
484
|
+
}
|
|
485
|
+
: injectStyles
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (hook) {
|
|
489
|
+
if (options.functional) {
|
|
490
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
491
|
+
// go through the normalizer
|
|
492
|
+
options._injectStyles = hook
|
|
493
|
+
// register for functional component in vue file
|
|
494
|
+
var originalRender = options.render
|
|
495
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
496
|
+
hook.call(context)
|
|
497
|
+
return originalRender(h, context)
|
|
498
|
+
}
|
|
499
|
+
} else {
|
|
500
|
+
// inject component registration as beforeCreate hook
|
|
501
|
+
var existing = options.beforeCreate
|
|
502
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return {
|
|
507
|
+
exports: scriptExports,
|
|
508
|
+
options: options
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.vue
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
/* normalize component */
|
|
519
|
+
|
|
520
|
+
var component = normalizeComponent(
|
|
521
|
+
components_xt_scrollvue_type_script_lang_js,
|
|
522
|
+
render,
|
|
523
|
+
staticRenderFns,
|
|
524
|
+
false,
|
|
525
|
+
null,
|
|
526
|
+
null,
|
|
527
|
+
null
|
|
528
|
+
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
/* harmony default export */ var xt_scroll = (component.exports);
|
|
532
|
+
// CONCATENATED MODULE: ./src/components/xt-scroll/index.js
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
xt_scroll.install = function (Vue) {
|
|
537
|
+
Vue.component(xt_scroll.name, xt_scroll)
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/* harmony default export */ var components_xt_scroll = (xt_scroll);
|
|
541
|
+
|
|
542
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (components_xt_scroll);
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
/***/ })
|
|
550
|
+
|
|
551
|
+
/******/ });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.xt-scroll,.xt-scroll__wrap{width:100%;height:100%}.xt-scroll__wrap{overflow:auto}.xt-scroll__wrap--vertical{overflow-x:hidden;overflow-y:auto}.xt-scroll__wrap--horizontal{overflow-x:auto;overflow-y:hidden}.xt-scroll__virtual{width:100%;position:relative}.xt-scroll__phantom{position:relative;box-sizing:border-box}.xt-scroll__item{box-sizing:border-box;overflow:hidden}.xt-scroll__default{width:100%}.xt-scroll__empty,.xt-scroll__loading{display:flex;align-items:center;justify-content:center;padding:48px 0;color:#909399;font-size:14px}.xt-scroll__loading{gap:8px}.xt-scroll__loading .el-icon-loading{font-size:20px;animation:xt-scroll-rotating 2s linear infinite}.xt-scroll__loadmore{display:flex;justify-content:center;padding:16px 0}.xt-scroll--horizontal .xt-scroll__virtual{height:100%}.xt-scroll--horizontal .xt-scroll__phantom{white-space:nowrap}.xt-scroll--horizontal .xt-scroll__item{display:inline-block;vertical-align:top}.xt-scroll--vertical .xt-scroll__item{width:100%}@keyframes xt-scroll-rotating{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|