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
|
@@ -1,35 +1,59 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="xt-scroll-arrow" :class="[`xt-scroll-arrow--${direction}`]" :style="containerStyle">
|
|
3
|
-
<div
|
|
4
|
-
v-if="showLeftArrow"
|
|
3
|
+
<div
|
|
4
|
+
v-if="showLeftArrow"
|
|
5
5
|
class="xt-scroll-arrow__btn xt-scroll-arrow__btn--left"
|
|
6
6
|
@click="scrollLeft"
|
|
7
7
|
>
|
|
8
8
|
<i class="el-icon-arrow-left"></i>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
<div
|
|
12
|
-
|
|
11
|
+
<div
|
|
12
|
+
v-if="showTopArrow && direction === 'vertical'"
|
|
13
|
+
class="xt-scroll-arrow__btn xt-scroll-arrow__btn--top"
|
|
14
|
+
@click="scrollTop"
|
|
15
|
+
>
|
|
16
|
+
<i class="el-icon-arrow-up"></i>
|
|
13
17
|
</div>
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
<!-- 使用 xt-scroll 作为滚动容器 -->
|
|
20
|
+
<xt-scroll
|
|
21
|
+
ref="scrollRef"
|
|
22
|
+
:class="['xt-scroll-arrow__content', scrollClass]"
|
|
23
|
+
:v-scroll="vScroll"
|
|
24
|
+
:data="vScrollData"
|
|
25
|
+
:item-size="itemSize"
|
|
26
|
+
:key-field="keyField"
|
|
27
|
+
:buffer-size="bufferSize"
|
|
28
|
+
:scroll-direction="direction"
|
|
29
|
+
:loading="vScrollLoading"
|
|
30
|
+
:load-more="loadMore"
|
|
31
|
+
:load-more-text="loadMoreText"
|
|
32
|
+
:load-more-loading="loadMoreLoading"
|
|
33
|
+
@scroll="onScroll"
|
|
34
|
+
@load-more="$emit('load-more')"
|
|
35
|
+
>
|
|
36
|
+
<!-- 虚拟滚动模式:使用 item 插槽 -->
|
|
37
|
+
<template v-if="vScroll" #item="{ item, index }">
|
|
38
|
+
<slot name="vitem" :item="item" :index="index">
|
|
39
|
+
<div class="xt-scroll-arrow__vitem">{{ item }}</div>
|
|
40
|
+
</slot>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<!-- 非虚拟滚动模式:默认插槽 -->
|
|
44
|
+
<slot v-else></slot>
|
|
45
|
+
</xt-scroll>
|
|
46
|
+
|
|
47
|
+
<div
|
|
48
|
+
v-if="showRightArrow"
|
|
17
49
|
class="xt-scroll-arrow__btn xt-scroll-arrow__btn--right"
|
|
18
50
|
@click="scrollRight"
|
|
19
51
|
>
|
|
20
52
|
<i class="el-icon-arrow-right"></i>
|
|
21
53
|
</div>
|
|
22
54
|
|
|
23
|
-
<div
|
|
24
|
-
v-if="
|
|
25
|
-
class="xt-scroll-arrow__btn xt-scroll-arrow__btn--top"
|
|
26
|
-
@click="scrollTop"
|
|
27
|
-
>
|
|
28
|
-
<i class="el-icon-arrow-up"></i>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div
|
|
32
|
-
v-if="showBottomArrow && direction === 'vertical'"
|
|
55
|
+
<div
|
|
56
|
+
v-if="showBottomArrow && direction === 'vertical'"
|
|
33
57
|
class="xt-scroll-arrow__btn xt-scroll-arrow__btn--bottom"
|
|
34
58
|
@click="scrollBottom"
|
|
35
59
|
>
|
|
@@ -39,22 +63,36 @@
|
|
|
39
63
|
</template>
|
|
40
64
|
|
|
41
65
|
<script>
|
|
66
|
+
import XtScroll from '../xt-scroll'
|
|
67
|
+
|
|
42
68
|
export default {
|
|
43
69
|
name: 'XtScrollArrow',
|
|
70
|
+
|
|
71
|
+
components: {
|
|
72
|
+
XtScroll
|
|
73
|
+
},
|
|
74
|
+
|
|
44
75
|
props: {
|
|
76
|
+
// ========== 滚动方向 ==========
|
|
45
77
|
direction: {
|
|
46
78
|
type: String,
|
|
47
79
|
default: 'horizontal',
|
|
48
80
|
validator: (val) => ['horizontal', 'vertical'].includes(val)
|
|
49
81
|
},
|
|
82
|
+
|
|
83
|
+
// ========== 滚动步长 ==========
|
|
50
84
|
scrollStep: {
|
|
51
85
|
type: Number,
|
|
52
86
|
default: 100
|
|
53
87
|
},
|
|
88
|
+
|
|
89
|
+
// ========== 箭头显示 ==========
|
|
54
90
|
autoHide: {
|
|
55
91
|
type: Boolean,
|
|
56
92
|
default: true
|
|
57
93
|
},
|
|
94
|
+
|
|
95
|
+
// ========== 容器尺寸 ==========
|
|
58
96
|
height: {
|
|
59
97
|
type: [String, Number],
|
|
60
98
|
default: ''
|
|
@@ -63,6 +101,8 @@ export default {
|
|
|
63
101
|
type: [String, Number],
|
|
64
102
|
default: ''
|
|
65
103
|
},
|
|
104
|
+
|
|
105
|
+
// ========== 模式 ==========
|
|
66
106
|
appendMode: {
|
|
67
107
|
type: Boolean,
|
|
68
108
|
default: false
|
|
@@ -70,16 +110,65 @@ export default {
|
|
|
70
110
|
clickMode: {
|
|
71
111
|
type: Boolean,
|
|
72
112
|
default: false
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
// ========== 虚拟滚动配置 ==========
|
|
116
|
+
/** 是否启用虚拟滚动 */
|
|
117
|
+
vScroll: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false
|
|
120
|
+
},
|
|
121
|
+
/** 虚拟滚动数据源 */
|
|
122
|
+
vScrollData: {
|
|
123
|
+
type: Array,
|
|
124
|
+
default: () => []
|
|
125
|
+
},
|
|
126
|
+
/** 每个 item 的固定尺寸(px) */
|
|
127
|
+
itemSize: {
|
|
128
|
+
type: Number,
|
|
129
|
+
default: 50
|
|
130
|
+
},
|
|
131
|
+
/** item 的唯一键字段名 */
|
|
132
|
+
keyField: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: 'id'
|
|
135
|
+
},
|
|
136
|
+
/** 预渲染缓冲区大小 */
|
|
137
|
+
bufferSize: {
|
|
138
|
+
type: Number,
|
|
139
|
+
default: 5
|
|
140
|
+
},
|
|
141
|
+
/** 虚拟滚动加载状态 */
|
|
142
|
+
vScrollLoading: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
default: false
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
// ========== 加载更多 ==========
|
|
148
|
+
loadMore: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: false
|
|
151
|
+
},
|
|
152
|
+
loadMoreText: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: '加载更多'
|
|
155
|
+
},
|
|
156
|
+
loadMoreLoading: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false
|
|
73
159
|
}
|
|
74
160
|
},
|
|
161
|
+
|
|
75
162
|
data() {
|
|
76
163
|
return {
|
|
77
164
|
showLeftArrow: false,
|
|
78
165
|
showRightArrow: false,
|
|
79
166
|
showTopArrow: false,
|
|
80
|
-
showBottomArrow: false
|
|
167
|
+
showBottomArrow: false,
|
|
168
|
+
mutationObserver: null
|
|
81
169
|
}
|
|
82
170
|
},
|
|
171
|
+
|
|
83
172
|
computed: {
|
|
84
173
|
containerStyle() {
|
|
85
174
|
const style = {}
|
|
@@ -90,27 +179,44 @@ export default {
|
|
|
90
179
|
style.width = typeof this.width === 'number' ? `${this.width}px` : this.width
|
|
91
180
|
}
|
|
92
181
|
return style
|
|
182
|
+
},
|
|
183
|
+
scrollClass() {
|
|
184
|
+
return this.vScroll ? 'xt-scroll-arrow__content--virtual' : ''
|
|
93
185
|
}
|
|
94
186
|
},
|
|
187
|
+
|
|
95
188
|
watch: {
|
|
96
189
|
direction() {
|
|
97
190
|
this.$nextTick(() => {
|
|
98
191
|
this.checkScroll()
|
|
99
192
|
})
|
|
193
|
+
},
|
|
194
|
+
vScrollData: {
|
|
195
|
+
handler() {
|
|
196
|
+
this.$nextTick(() => {
|
|
197
|
+
this.checkScroll()
|
|
198
|
+
})
|
|
199
|
+
}
|
|
100
200
|
}
|
|
101
201
|
},
|
|
202
|
+
|
|
102
203
|
mounted() {
|
|
103
204
|
this.$nextTick(() => {
|
|
104
205
|
this.checkScroll()
|
|
105
206
|
})
|
|
106
207
|
this.addResizeObserver()
|
|
107
|
-
this.
|
|
208
|
+
if (!this.vScroll) {
|
|
209
|
+
this.addMutationObserver()
|
|
210
|
+
}
|
|
108
211
|
},
|
|
212
|
+
|
|
109
213
|
beforeDestroy() {
|
|
110
214
|
this.removeResizeObserver()
|
|
111
215
|
this.removeMutationObserver()
|
|
112
216
|
},
|
|
217
|
+
|
|
113
218
|
methods: {
|
|
219
|
+
// ========== 尺寸监听 ==========
|
|
114
220
|
addResizeObserver() {
|
|
115
221
|
if (typeof ResizeObserver !== 'undefined') {
|
|
116
222
|
this.resizeObserver = new ResizeObserver(() => {
|
|
@@ -118,17 +224,19 @@ export default {
|
|
|
118
224
|
this.checkScroll()
|
|
119
225
|
})
|
|
120
226
|
})
|
|
121
|
-
const container = this.$
|
|
227
|
+
const container = this.$el
|
|
122
228
|
if (container) {
|
|
123
229
|
this.resizeObserver.observe(container)
|
|
124
230
|
}
|
|
125
231
|
}
|
|
126
232
|
},
|
|
233
|
+
|
|
127
234
|
removeResizeObserver() {
|
|
128
235
|
if (this.resizeObserver) {
|
|
129
236
|
this.resizeObserver.disconnect()
|
|
130
237
|
}
|
|
131
238
|
},
|
|
239
|
+
|
|
132
240
|
addMutationObserver() {
|
|
133
241
|
if (typeof MutationObserver !== 'undefined') {
|
|
134
242
|
this.mutationObserver = new MutationObserver(() => {
|
|
@@ -139,28 +247,37 @@ export default {
|
|
|
139
247
|
}
|
|
140
248
|
})
|
|
141
249
|
})
|
|
142
|
-
const container = this.$refs.
|
|
250
|
+
const container = this.$refs.scrollRef
|
|
143
251
|
if (container) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
252
|
+
const wrap = container.getScrollContainer && container.getScrollContainer()
|
|
253
|
+
if (wrap) {
|
|
254
|
+
this.mutationObserver.observe(wrap, {
|
|
255
|
+
childList: true,
|
|
256
|
+
subtree: true
|
|
257
|
+
})
|
|
258
|
+
}
|
|
148
259
|
}
|
|
149
260
|
}
|
|
150
261
|
},
|
|
262
|
+
|
|
151
263
|
removeMutationObserver() {
|
|
152
264
|
if (this.mutationObserver) {
|
|
153
265
|
this.mutationObserver.disconnect()
|
|
154
266
|
}
|
|
155
267
|
},
|
|
268
|
+
|
|
269
|
+
// ========== 滚动检测 ==========
|
|
156
270
|
checkScroll() {
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
271
|
+
const scrollRef = this.$refs.scrollRef
|
|
272
|
+
if (!scrollRef) return
|
|
273
|
+
|
|
274
|
+
const wrap = scrollRef.getScrollContainer && scrollRef.getScrollContainer()
|
|
275
|
+
if (!wrap) return
|
|
159
276
|
|
|
160
277
|
if (this.direction === 'horizontal') {
|
|
161
|
-
const scrollLeft =
|
|
162
|
-
const scrollWidth =
|
|
163
|
-
const clientWidth =
|
|
278
|
+
const scrollLeft = wrap.scrollLeft
|
|
279
|
+
const scrollWidth = wrap.scrollWidth
|
|
280
|
+
const clientWidth = wrap.clientWidth
|
|
164
281
|
const maxScroll = scrollWidth - clientWidth
|
|
165
282
|
|
|
166
283
|
this.showTopArrow = false
|
|
@@ -168,15 +285,15 @@ export default {
|
|
|
168
285
|
|
|
169
286
|
if (this.autoHide) {
|
|
170
287
|
this.showLeftArrow = scrollLeft > 0
|
|
171
|
-
this.showRightArrow = maxScroll > 0 && scrollLeft < maxScroll
|
|
288
|
+
this.showRightArrow = maxScroll > 0 && scrollLeft < maxScroll - 1
|
|
172
289
|
} else {
|
|
173
290
|
this.showLeftArrow = maxScroll > 0
|
|
174
291
|
this.showRightArrow = maxScroll > 0
|
|
175
292
|
}
|
|
176
293
|
} else {
|
|
177
|
-
const scrollTop =
|
|
178
|
-
const scrollHeight =
|
|
179
|
-
const clientHeight =
|
|
294
|
+
const scrollTop = wrap.scrollTop
|
|
295
|
+
const scrollHeight = wrap.scrollHeight
|
|
296
|
+
const clientHeight = wrap.clientHeight
|
|
180
297
|
const maxScroll = scrollHeight - clientHeight
|
|
181
298
|
|
|
182
299
|
this.showLeftArrow = false
|
|
@@ -184,77 +301,77 @@ export default {
|
|
|
184
301
|
|
|
185
302
|
if (this.autoHide) {
|
|
186
303
|
this.showTopArrow = scrollTop > 0
|
|
187
|
-
this.showBottomArrow = maxScroll > 0 && scrollTop < maxScroll
|
|
304
|
+
this.showBottomArrow = maxScroll > 0 && scrollTop < maxScroll - 1
|
|
188
305
|
} else {
|
|
189
306
|
this.showTopArrow = maxScroll > 0
|
|
190
307
|
this.showBottomArrow = maxScroll > 0
|
|
191
308
|
}
|
|
192
309
|
}
|
|
193
310
|
},
|
|
194
|
-
|
|
311
|
+
|
|
312
|
+
onScroll() {
|
|
195
313
|
this.checkScroll()
|
|
196
|
-
this.$emit('scroll', this.$refs.
|
|
197
|
-
},
|
|
198
|
-
handleClick(e) {
|
|
199
|
-
if (!this.clickMode) return
|
|
200
|
-
const container = this.$refs.scrollContainer
|
|
201
|
-
if (!container) return
|
|
202
|
-
|
|
203
|
-
const target = e.target
|
|
204
|
-
if (!target || target === container) return
|
|
205
|
-
|
|
206
|
-
const containerRect = container.getBoundingClientRect()
|
|
207
|
-
const targetRect = target.getBoundingClientRect()
|
|
208
|
-
|
|
209
|
-
const isVisible = (
|
|
210
|
-
targetRect.left >= containerRect.left &&
|
|
211
|
-
targetRect.right <= containerRect.right &&
|
|
212
|
-
targetRect.top >= containerRect.top &&
|
|
213
|
-
targetRect.bottom <= containerRect.bottom
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
if (!isVisible) {
|
|
217
|
-
if (this.direction === 'horizontal') {
|
|
218
|
-
const scrollLeft = target.offsetLeft - (container.clientWidth - targetRect.width) / 2
|
|
219
|
-
container.scrollTo({ left: scrollLeft, behavior: 'smooth' })
|
|
220
|
-
} else {
|
|
221
|
-
const scrollTop = target.offsetTop - (container.clientHeight - targetRect.height) / 2
|
|
222
|
-
container.scrollTo({ top: scrollTop, behavior: 'smooth' })
|
|
223
|
-
}
|
|
224
|
-
}
|
|
314
|
+
this.$emit('scroll', this.$refs.scrollRef)
|
|
225
315
|
},
|
|
316
|
+
|
|
317
|
+
// ========== 滚动操作 ==========
|
|
226
318
|
scrollLeft() {
|
|
227
|
-
|
|
228
|
-
if (container) {
|
|
229
|
-
container.scrollBy({ left: -this.scrollStep, behavior: 'smooth' })
|
|
230
|
-
}
|
|
319
|
+
this._scrollBy(-this.scrollStep)
|
|
231
320
|
},
|
|
321
|
+
|
|
232
322
|
scrollRight() {
|
|
233
|
-
|
|
234
|
-
if (container) {
|
|
235
|
-
container.scrollBy({ left: this.scrollStep, behavior: 'smooth' })
|
|
236
|
-
}
|
|
323
|
+
this._scrollBy(this.scrollStep)
|
|
237
324
|
},
|
|
325
|
+
|
|
238
326
|
scrollTop() {
|
|
239
|
-
|
|
240
|
-
if (container) {
|
|
241
|
-
container.scrollBy({ top: -this.scrollStep, behavior: 'smooth' })
|
|
242
|
-
}
|
|
327
|
+
this._scrollBy(-this.scrollStep, 'vertical')
|
|
243
328
|
},
|
|
329
|
+
|
|
244
330
|
scrollBottom() {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
331
|
+
this._scrollBy(this.scrollStep, 'vertical')
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
_scrollBy(delta, dir) {
|
|
335
|
+
const direction = dir || this.direction
|
|
336
|
+
const scrollRef = this.$refs.scrollRef
|
|
337
|
+
if (!scrollRef) return
|
|
338
|
+
|
|
339
|
+
const wrap = scrollRef.getScrollContainer && scrollRef.getScrollContainer()
|
|
340
|
+
if (!wrap) return
|
|
341
|
+
|
|
342
|
+
if (direction === 'horizontal') {
|
|
343
|
+
wrap.scrollBy({ left: delta, behavior: 'smooth' })
|
|
344
|
+
} else {
|
|
345
|
+
wrap.scrollBy({ top: delta, behavior: 'smooth' })
|
|
248
346
|
}
|
|
249
347
|
},
|
|
348
|
+
|
|
250
349
|
scrollToEnd() {
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
350
|
+
const scrollRef = this.$refs.scrollRef
|
|
351
|
+
if (!scrollRef) return
|
|
352
|
+
const wrap = scrollRef.getScrollContainer && scrollRef.getScrollContainer()
|
|
353
|
+
if (!wrap) return
|
|
354
|
+
|
|
253
355
|
if (this.direction === 'horizontal') {
|
|
254
|
-
|
|
356
|
+
wrap.scrollTo({ left: wrap.scrollWidth, behavior: 'smooth' })
|
|
255
357
|
} else {
|
|
256
|
-
|
|
358
|
+
wrap.scrollTo({ top: wrap.scrollHeight, behavior: 'smooth' })
|
|
257
359
|
}
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
// ========== 对外暴露方法 ==========
|
|
363
|
+
/** 获取滚动位置 */
|
|
364
|
+
getScrollPos() {
|
|
365
|
+
const scrollRef = this.$refs.scrollRef
|
|
366
|
+
if (!scrollRef) return 0
|
|
367
|
+
const wrap = scrollRef.getScrollContainer && scrollRef.getScrollContainer()
|
|
368
|
+
if (!wrap) return 0
|
|
369
|
+
return this.direction === 'horizontal' ? wrap.scrollLeft : wrap.scrollTop
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
/** 获取 xt-scroll 组件实例 */
|
|
373
|
+
getScrollInstance() {
|
|
374
|
+
return this.$refs.scrollRef
|
|
258
375
|
}
|
|
259
376
|
}
|
|
260
377
|
}
|
|
@@ -16,15 +16,26 @@
|
|
|
16
16
|
|
|
17
17
|
&__content {
|
|
18
18
|
flex: 1;
|
|
19
|
-
overflow:
|
|
20
|
-
scrollbar-width: none;
|
|
21
|
-
-ms-overflow-style: none;
|
|
19
|
+
overflow: hidden;
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
// 虚拟滚动模式下的内容容器
|
|
22
|
+
&--virtual {
|
|
23
|
+
width: 100%;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
|
|
27
|
+
// 虚拟滚动 item
|
|
28
|
+
&__vitem {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
height: 100%;
|
|
32
|
+
padding: 0 8px;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
white-space: nowrap;
|
|
36
|
+
text-overflow: ellipsis;
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
&__btn {
|
|
29
40
|
position: absolute;
|
|
30
41
|
z-index: 10;
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.xt-text--success {
|
|
39
|
-
color:
|
|
39
|
+
color: var(--xt-color-success);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.xt-text--warning {
|
|
43
|
-
color:
|
|
43
|
+
color: var(--xt-color-warning);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.xt-text--danger {
|
|
47
|
-
color:
|
|
47
|
+
color: var(--xt-color-danger);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// 粗体
|
|
@@ -81,15 +81,15 @@
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
&.xt-text--success {
|
|
84
|
-
color:
|
|
84
|
+
color: var(--xt-color-success);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
&.xt-text--warning {
|
|
88
|
-
color:
|
|
88
|
+
color: var(--xt-color-warning);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
&.xt-text--danger {
|
|
92
|
-
color:
|
|
92
|
+
color: var(--xt-color-danger);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
package/src/index.js
CHANGED
|
@@ -4,9 +4,6 @@ import './styles/css-variables.scss'
|
|
|
4
4
|
// 导入组件样式(统一入口)
|
|
5
5
|
import './components/index.scss'
|
|
6
6
|
|
|
7
|
-
// 导入 SCSS 变量(通过 CSS Modules :export 导出)
|
|
8
|
-
import variables from './styles/variables-export.scss'
|
|
9
|
-
|
|
10
7
|
import utilsModule from './utils/index'
|
|
11
8
|
|
|
12
9
|
// ES Module 默认导出需要通过 .default 访问
|
|
@@ -40,6 +37,7 @@ import XtIcon from './components/xt-icon' // XtIcon 组件(支持 el-icon /
|
|
|
40
37
|
import XtTable from './components/xt-table' // XtTable 组件(基于 ElementUI Table 封装)
|
|
41
38
|
import XtList from './components/xt-list' // XtList 组件(卡片列表)
|
|
42
39
|
import XtScrollArrow from './components/xt-scroll-arrow'
|
|
40
|
+
import XtScroll from './components/xt-scroll' // XtScroll 组件(虚拟滚动容器)
|
|
43
41
|
import XtBar from './components/xt-chart/XtBar.vue'
|
|
44
42
|
import XtLine from './components/xt-chart/XtLine.vue'
|
|
45
43
|
import XtPie from './components/xt-chart/XtPie.vue'
|
|
@@ -49,6 +47,8 @@ import XtSelectTree from './components/xt-select-tree'
|
|
|
49
47
|
import XtUpload from './components/xt-upload'
|
|
50
48
|
import XtTransferTree from './components/xt-transfer-tree' // XtTransferTree 组件(树形穿梭框)
|
|
51
49
|
import XtFormSchema from './components/xt-form-schema' // XtFormSchema 组件(表单配置化搜索)
|
|
50
|
+
import XtFlow from './components/xt-flow' // XtFlow 组件(审批流程轨迹)
|
|
51
|
+
import Theme from './components/theme' // Theme 模块(iframe 主题注入工具)
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
const components = [
|
|
@@ -76,6 +76,7 @@ const components = [
|
|
|
76
76
|
XtTable,
|
|
77
77
|
XtList,
|
|
78
78
|
XtScrollArrow,
|
|
79
|
+
XtScroll,
|
|
79
80
|
XtBar,
|
|
80
81
|
XtLine,
|
|
81
82
|
XtPie,
|
|
@@ -84,7 +85,8 @@ const components = [
|
|
|
84
85
|
XtSelectTree,
|
|
85
86
|
XtUpload,
|
|
86
87
|
XtTransferTree,
|
|
87
|
-
XtFormSchema
|
|
88
|
+
XtFormSchema,
|
|
89
|
+
XtFlow
|
|
88
90
|
]
|
|
89
91
|
|
|
90
92
|
const install = function (Vue, options = {}) {
|
|
@@ -155,6 +157,7 @@ export default {
|
|
|
155
157
|
XtTable,
|
|
156
158
|
XtList,
|
|
157
159
|
XtScrollArrow,
|
|
160
|
+
XtScroll,
|
|
158
161
|
XtBar,
|
|
159
162
|
XtLine,
|
|
160
163
|
XtPie,
|
|
@@ -163,19 +166,14 @@ export default {
|
|
|
163
166
|
XtSelectTree,
|
|
164
167
|
XtUpload,
|
|
165
168
|
XtTransferTree,
|
|
166
|
-
XtFormSchema
|
|
169
|
+
XtFormSchema,
|
|
170
|
+
XtFlow,
|
|
171
|
+
Theme
|
|
167
172
|
}
|
|
168
173
|
|
|
169
|
-
// XtChart 组件按需导出(使用时需自行安装 echarts 依赖)
|
|
170
|
-
export { default as XtChart } from './components/xt-chart'
|
|
171
|
-
|
|
172
|
-
// XtTable 虚拟滚动演示数据工具
|
|
173
|
-
export { createVirtualScrollData, virtualScrollColumns } from './components/xt-table/virtualScrollData'
|
|
174
|
-
|
|
175
174
|
// 导出工具函数和变量
|
|
176
175
|
export {
|
|
177
176
|
utils,
|
|
178
|
-
variables,
|
|
179
177
|
// 配置管理函数(从 utils 导入)
|
|
180
178
|
getConfig,
|
|
181
179
|
setConfig,
|
|
@@ -209,13 +207,17 @@ export {
|
|
|
209
207
|
XtTable,
|
|
210
208
|
XtList,
|
|
211
209
|
XtScrollArrow,
|
|
210
|
+
XtScroll,
|
|
212
211
|
XtBar,
|
|
213
212
|
XtLine,
|
|
213
|
+
XtChart,
|
|
214
214
|
XtPie,
|
|
215
215
|
XtMulti,
|
|
216
216
|
XtPage,
|
|
217
217
|
XtSelectTree,
|
|
218
218
|
XtUpload,
|
|
219
219
|
XtTransferTree,
|
|
220
|
-
XtFormSchema
|
|
220
|
+
XtFormSchema,
|
|
221
|
+
XtFlow,
|
|
222
|
+
Theme
|
|
221
223
|
}
|
|
@@ -239,4 +239,76 @@
|
|
|
239
239
|
|
|
240
240
|
[data-size="small"] {
|
|
241
241
|
--xt-font-size-increment: 0px;
|
|
242
|
-
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ============================
|
|
245
|
+
// 品牌色配置(水电气子系统 + 大屏分析)
|
|
246
|
+
// 品牌色与主题模式可叠加使用
|
|
247
|
+
// 示例:<div data-theme="dark" data-brand="water">
|
|
248
|
+
// ============================
|
|
249
|
+
|
|
250
|
+
// 水务系统 - 蓝色系
|
|
251
|
+
[data-brand="water"] {
|
|
252
|
+
--xt-color-primary: #0077be;
|
|
253
|
+
--xt-color-primary-light-3: rgb(51, 142, 206);
|
|
254
|
+
--xt-color-primary-light-5: rgb(102, 179, 229);
|
|
255
|
+
--xt-color-primary-light-7: rgb(153, 216, 252);
|
|
256
|
+
--xt-color-primary-light-8: rgb(178, 229, 253);
|
|
257
|
+
--xt-color-primary-light-9: rgb(204, 241, 255);
|
|
258
|
+
--xt-color-primary-dark-2: rgb(0, 92, 145);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
[data-theme="dark"][data-brand="water"],
|
|
262
|
+
[data-brand="water"][data-theme="dark"] {
|
|
263
|
+
--xt-color-primary: #0099cc;
|
|
264
|
+
--xt-color-primary-light-3: rgb(0, 124, 167);
|
|
265
|
+
--xt-color-primary-light-5: rgb(0, 93, 125);
|
|
266
|
+
--xt-color-primary-light-7: rgb(0, 62, 83);
|
|
267
|
+
--xt-color-primary-light-8: rgb(0, 47, 63);
|
|
268
|
+
--xt-color-primary-light-9: rgb(0, 31, 42);
|
|
269
|
+
--xt-color-primary-dark-2: rgb(0, 159, 204);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// 电力系统 - 绿色系
|
|
273
|
+
[data-brand="electricity"] {
|
|
274
|
+
--xt-color-primary: #2ecc71;
|
|
275
|
+
--xt-color-primary-light-3: rgb(95, 224, 146);
|
|
276
|
+
--xt-color-primary-light-5: rgb(140, 234, 176);
|
|
277
|
+
--xt-color-primary-light-7: rgb(185, 244, 206);
|
|
278
|
+
--xt-color-primary-light-8: rgb(208, 249, 221);
|
|
279
|
+
--xt-color-primary-light-9: rgb(230, 252, 238);
|
|
280
|
+
--xt-color-primary-dark-2: rgb(34, 181, 94);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
[data-theme="dark"][data-brand="electricity"],
|
|
284
|
+
[data-brand="electricity"][data-theme="dark"] {
|
|
285
|
+
--xt-color-primary: #27ae60;
|
|
286
|
+
--xt-color-primary-light-3: rgb(50, 168, 102);
|
|
287
|
+
--xt-color-primary-light-5: rgb(38, 126, 77);
|
|
288
|
+
--xt-color-primary-light-7: rgb(26, 84, 51);
|
|
289
|
+
--xt-color-primary-light-8: rgb(19, 63, 38);
|
|
290
|
+
--xt-color-primary-light-9: rgb(13, 42, 26);
|
|
291
|
+
--xt-color-primary-dark-2: rgb(73, 212, 131);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// 燃气系统 - 橙色系
|
|
295
|
+
[data-brand="gas"] {
|
|
296
|
+
--xt-color-primary: #f39c12;
|
|
297
|
+
--xt-color-primary-light-3: rgb(247, 176, 85);
|
|
298
|
+
--xt-color-primary-light-5: rgb(249, 199, 140);
|
|
299
|
+
--xt-color-primary-light-7: rgb(251, 222, 195);
|
|
300
|
+
--xt-color-primary-light-8: rgb(252, 233, 222);
|
|
301
|
+
--xt-color-primary-light-9: rgb(254, 244, 248);
|
|
302
|
+
--xt-color-primary-dark-2: rgb(194, 133, 0);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
[data-theme="dark"][data-brand="gas"],
|
|
306
|
+
[data-brand="gas"][data-theme="dark"] {
|
|
307
|
+
--xt-color-primary: #e67e22;
|
|
308
|
+
--xt-color-primary-light-3: rgb(214, 146, 75);
|
|
309
|
+
--xt-color-primary-light-5: rgb(161, 109, 56);
|
|
310
|
+
--xt-color-primary-light-7: rgb(107, 73, 38);
|
|
311
|
+
--xt-color-primary-light-8: rgb(80, 55, 28);
|
|
312
|
+
--xt-color-primary-light-9: rgb(54, 36, 19);
|
|
313
|
+
--xt-color-primary-dark-2: rgb(241, 152, 66);
|
|
314
|
+
}
|