xt-element-ui 1.2.1 → 1.2.3
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/lib/index.common.js +1306 -1398
- package/lib/index.css +1 -1
- package/lib/index.umd.js +1311 -1403
- package/lib/index.umd.min.js +5 -5
- package/package.json +3 -4
- package/src/components/ex-button/index.vue +8 -2
- package/src/components/ex-button/style/index.scss +42 -6
- package/src/components/ex-card/index.vue +0 -82
- package/src/components/ex-card/style/index.scss +7 -3
- package/src/components/ex-chart/theme/dark.js +1 -1
- package/src/components/ex-chart/utils.js +1 -1
- package/src/components/ex-page/index.js +2 -0
- package/src/components/ex-select-tree/index.js +2 -0
- package/src/components/{xt-select-tree → ex-select-tree}/index.vue +1 -1
- package/src/components/ex-table/ExTableCell.vue +3 -2
- package/src/components/ex-table/VirtualElTable.vue +234 -0
- package/src/components/ex-table/index.vue +188 -625
- package/src/components/ex-table/virtualScrollData.js +35 -0
- package/src/components/ex-upload/index.js +2 -0
- package/src/components/xt-config-provider/index.js +2 -2
- package/src/components/xt-config-provider/index.vue +17 -13
- package/src/components/xt-text/style/index.scss +13 -13
- package/src/index.js +4 -1
- package/src/styles/css-variables.scss +1 -2
- package/src/styles/element-theme.scss +12 -4
- package/src/utils/index.js +11 -2
- package/src/components/xt-page/index.js +0 -0
- package/src/components/xt-select-tree/index.js +0 -0
- package/src/components/xt-upload/index.js +0 -2
- /package/src/components/{xt-page → ex-page}/index.vue +0 -0
- /package/src/components/{xt-upload → ex-upload}/index.vue +0 -0
- /package/src/components/{xt-upload → ex-upload}/preview.vue +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 生成虚拟滚动演示数据
|
|
3
|
+
* @param {number} count 数据条数,默认 10000
|
|
4
|
+
* @returns {Array}
|
|
5
|
+
*/
|
|
6
|
+
export function createVirtualScrollData(count = 10000) {
|
|
7
|
+
const departments = ['研发部', '产品部', '运营部', '财务部', '市场部']
|
|
8
|
+
const positions = ['工程师', '产品经理', '运营专员', '财务主管', '市场经理']
|
|
9
|
+
const statuses = ['在职', '休假', '离职']
|
|
10
|
+
|
|
11
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
12
|
+
id: i + 1,
|
|
13
|
+
name: `用户${i + 1}`,
|
|
14
|
+
department: departments[i % departments.length],
|
|
15
|
+
position: positions[i % positions.length],
|
|
16
|
+
email: `user${i + 1}@example.com`,
|
|
17
|
+
phone: `13800138${String(i).padStart(4, '0')}`,
|
|
18
|
+
address: `北京市朝阳区第${i + 1}号街道`,
|
|
19
|
+
salary: 5000 + Math.floor(Math.random() * 10000),
|
|
20
|
+
status: statuses[i % statuses.length]
|
|
21
|
+
}))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 虚拟滚动演示列配置 */
|
|
25
|
+
export const virtualScrollColumns = [
|
|
26
|
+
{ prop: 'id', label: 'ID', fixed: 'left', width: 80 },
|
|
27
|
+
{ prop: 'name', label: '姓名', fixed: 'left', width: 120 },
|
|
28
|
+
{ prop: 'department', label: '部门', width: 150 },
|
|
29
|
+
{ prop: 'position', label: '职位', width: 150 },
|
|
30
|
+
{ prop: 'email', label: '邮箱', width: 200 },
|
|
31
|
+
{ prop: 'phone', label: '电话', width: 130 },
|
|
32
|
+
{ prop: 'address', label: '地址', width: 200 },
|
|
33
|
+
{ prop: 'salary', label: '薪资', width: 120 },
|
|
34
|
+
{ prop: 'status', label: '状态', fixed: 'right', width: 100 }
|
|
35
|
+
]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default
|
|
1
|
+
import XtConfigProvider from './index.vue'
|
|
2
|
+
export default XtConfigProvider
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import EchartsUtil from '../ex-chart/utils.js'
|
|
2
3
|
export default {
|
|
3
4
|
name: 'XtConfigProvider',
|
|
4
5
|
inheritAttrs: false,
|
|
@@ -13,25 +14,25 @@ export default {
|
|
|
13
14
|
},
|
|
14
15
|
watch: {
|
|
15
16
|
theme(newVal) {
|
|
16
|
-
this
|
|
17
|
+
this.xtConfig ={
|
|
17
18
|
theme: newVal,
|
|
18
19
|
size: this.size,
|
|
19
20
|
primaryColor: this.primaryColor
|
|
20
|
-
}
|
|
21
|
+
}
|
|
21
22
|
},
|
|
22
23
|
size(newVal) {
|
|
23
|
-
this
|
|
24
|
-
theme:
|
|
25
|
-
size:
|
|
24
|
+
this.xtConfig ={
|
|
25
|
+
theme: newVal,
|
|
26
|
+
size: this.size,
|
|
26
27
|
primaryColor: this.primaryColor
|
|
27
|
-
}
|
|
28
|
+
}
|
|
28
29
|
},
|
|
29
30
|
primaryColor(newVal) {
|
|
30
|
-
this
|
|
31
|
-
theme:
|
|
31
|
+
this.xtConfig ={
|
|
32
|
+
theme: newVal,
|
|
32
33
|
size: this.size,
|
|
33
|
-
primaryColor:
|
|
34
|
-
}
|
|
34
|
+
primaryColor: this.primaryColor
|
|
35
|
+
}
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
render(h) {
|
|
@@ -139,9 +140,9 @@ export default {
|
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
const sizeMap = {
|
|
142
|
-
small: '
|
|
143
|
-
medium: '
|
|
144
|
-
large: '
|
|
143
|
+
small: '14px',
|
|
144
|
+
medium: '16px',
|
|
145
|
+
large: '18px'
|
|
145
146
|
}
|
|
146
147
|
if (sizeMap[this.size]) {
|
|
147
148
|
result['--xt-font-size-base'] = sizeMap[this.size]
|
|
@@ -308,6 +309,9 @@ export default {
|
|
|
308
309
|
|
|
309
310
|
// 设置 data-theme 属性
|
|
310
311
|
element.setAttribute('data-theme', this.theme)
|
|
312
|
+
|
|
313
|
+
// 更新图表颜色
|
|
314
|
+
EchartsUtil.changeAllTheme(this.theme, this.size, this.primaryColor)
|
|
311
315
|
|
|
312
316
|
// 触发主题改变钩子(当主题实际发生变化时)
|
|
313
317
|
if (prevTheme !== this.theme && typeof this.onThemeChange === 'function') {
|
|
@@ -76,17 +76,17 @@
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// 暗色主题
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
[data-theme='dark'], html.dark {
|
|
80
|
+
.xt-text--primary {
|
|
81
|
+
color: $xt-dark-color-primary;
|
|
82
|
+
}
|
|
83
|
+
.xt-text--success {
|
|
84
|
+
color: $xt-dark-color-success;
|
|
85
|
+
}
|
|
86
|
+
.xt-text--warning {
|
|
87
|
+
color: $xt-dark-color-warning;
|
|
88
|
+
}
|
|
89
|
+
.xt-text--danger {
|
|
90
|
+
color: $xt-dark-color-danger;
|
|
91
|
+
}
|
|
92
92
|
}
|
package/src/index.js
CHANGED
|
@@ -96,6 +96,7 @@ const install = function (Vue, options = {}) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
if (process.env.NODE_ENV === 'development') {
|
|
99
100
|
// 导入内部 element-ui 依赖(作为内部依赖,不与外部冲突)
|
|
100
101
|
const ElementUI = require('element-ui')
|
|
101
102
|
|
|
@@ -104,7 +105,6 @@ const install = function (Vue, options = {}) {
|
|
|
104
105
|
// ex-table 等组件内部会直接使用 element-ui 的组件
|
|
105
106
|
|
|
106
107
|
// 在开发环境下注册 ElementUI 组件为 Ex 开头(方便文档和示例使用)
|
|
107
|
-
if (process.env.NODE_ENV === 'development') {
|
|
108
108
|
registerElementExComponents(Vue, ElementUI)
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -140,6 +140,9 @@ export default {
|
|
|
140
140
|
// ExChart 组件按需导出(使用时需自行安装 echarts 依赖)
|
|
141
141
|
export { default as ExChart } from './components/ex-chart'
|
|
142
142
|
|
|
143
|
+
// ExTable 虚拟滚动演示数据工具
|
|
144
|
+
export { createVirtualScrollData, virtualScrollColumns } from './components/ex-table/virtualScrollData'
|
|
145
|
+
|
|
143
146
|
// 导出工具函数和变量
|
|
144
147
|
export {
|
|
145
148
|
utils,
|
|
@@ -183,8 +183,7 @@
|
|
|
183
183
|
// 暗色主题(参考 Element Plus)
|
|
184
184
|
// ============================
|
|
185
185
|
:root[data-theme="dark"],
|
|
186
|
-
|
|
187
|
-
[data-theme="dark"] {
|
|
186
|
+
[data-theme="dark"], html.dark {
|
|
188
187
|
color-scheme: dark;
|
|
189
188
|
--xt-color-primary: #409eff;
|
|
190
189
|
--xt-color-primary-light-3: rgb(51, 117, 185);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@
|
|
1
|
+
@import './variables.scss';
|
|
2
2
|
|
|
3
3
|
/* Element UI 风格主题 */
|
|
4
4
|
:root {
|
|
@@ -21,10 +21,13 @@
|
|
|
21
21
|
--el-text-color-secondary: #909399;
|
|
22
22
|
--el-text-color-placeholder: #c0c4cc;
|
|
23
23
|
--el-text-color-disabled: #c0c4cc;
|
|
24
|
+
--el-text-color-white: #ffffff;
|
|
24
25
|
|
|
25
26
|
/* 背景色 */
|
|
26
27
|
--el-bg-color: #ffffff;
|
|
27
28
|
--el-bg-color-page: #f5f7fa;
|
|
29
|
+
--el-bg-color-block: #ffffff;
|
|
30
|
+
--el-bg-color-block-head: #ffffff;
|
|
28
31
|
--el-bg-color-overlay: #ffffff;
|
|
29
32
|
|
|
30
33
|
/* 边框颜色 */
|
|
@@ -64,9 +67,12 @@
|
|
|
64
67
|
--el-transition-duration-fast: 0.2s;
|
|
65
68
|
}
|
|
66
69
|
|
|
70
|
+
|
|
67
71
|
/* 深色主题 */
|
|
68
|
-
[data-theme="dark"]
|
|
72
|
+
:root[data-theme="dark"],
|
|
73
|
+
[data-theme="dark"], html.dark {
|
|
69
74
|
--el-color-primary: #409eff;
|
|
75
|
+
--el-text-color-primary: #ffffff;
|
|
70
76
|
--el-color-primary-light-9: #1d1e1f;
|
|
71
77
|
|
|
72
78
|
--el-text-color-primary: #e5eaf3;
|
|
@@ -75,10 +81,12 @@
|
|
|
75
81
|
--el-text-color-placeholder: #8d9095;
|
|
76
82
|
|
|
77
83
|
--el-bg-color: #1d1e1f;
|
|
78
|
-
--el-bg-color-page: #
|
|
84
|
+
--el-bg-color-page: #0b141d;
|
|
85
|
+
--el-bg-color-block: #15222e;
|
|
86
|
+
--el-bg-color-block-head: #2b4155;
|
|
79
87
|
--el-bg-color-overlay: #1d1e1f;
|
|
80
88
|
|
|
81
|
-
--el-border-color: #
|
|
89
|
+
--el-border-color: #2b4155;
|
|
82
90
|
--el-border-color-light: #515253;
|
|
83
91
|
--el-border-color-lighter: #565758;
|
|
84
92
|
--el-border-color-extra-light: #5c5c5d;
|
package/src/utils/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import EchartsUtil from '../components/ex-chart/utils'
|
|
1
2
|
// 默认配置
|
|
2
3
|
const defaultConfig = {
|
|
3
4
|
theme: 'white',
|
|
@@ -44,7 +45,7 @@ export const setConfig = function(config) {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
|
|
47
|
-
// 设置主题
|
|
48
|
+
// 设置主题 并更新图表主题
|
|
48
49
|
export const setTheme = function(theme) {
|
|
49
50
|
const validThemes = ['white', 'dark']
|
|
50
51
|
if (!validThemes.includes(theme)) {
|
|
@@ -59,9 +60,13 @@ export const setTheme = function(theme) {
|
|
|
59
60
|
if (theme === 'dark') {
|
|
60
61
|
root.setAttribute('data-theme', 'dark')
|
|
61
62
|
} else {
|
|
62
|
-
root.
|
|
63
|
+
root.setAttribute('data-theme', theme)
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
// 更新图表主题
|
|
67
|
+
EchartsUtil.changeAllTheme(currentConfig.theme, currentConfig.size)
|
|
68
|
+
console.log('更新图表主题')
|
|
69
|
+
|
|
65
70
|
emitConfigChange('theme', theme)
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -75,6 +80,10 @@ export const setSize = function(size) {
|
|
|
75
80
|
|
|
76
81
|
currentConfig.size = size
|
|
77
82
|
document.documentElement.setAttribute('data-size', size)
|
|
83
|
+
// 更新图表主题
|
|
84
|
+
EchartsUtil.changeAllTheme(currentConfig.theme, currentConfig.size)
|
|
85
|
+
console.log('更新图表字体')
|
|
86
|
+
|
|
78
87
|
emitConfigChange('size', size)
|
|
79
88
|
}
|
|
80
89
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|