xt-element-ui 1.2.3 → 1.2.5
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/docs/README.md +201 -0
- package/docs/components/base/xt-button.md +114 -0
- package/docs/components/base/xt-card-item.md +104 -0
- package/docs/components/base/xt-card.md +108 -0
- package/docs/components/base/xt-config-provider.md +199 -0
- package/docs/components/base/xt-flex-box.md +115 -0
- package/docs/components/base/xt-grid-box.md +303 -0
- package/docs/components/base/xt-input.md +150 -0
- package/docs/components/base/xt-text.md +212 -0
- package/docs/components/extend/ex-bar.md +68 -0
- package/docs/components/extend/ex-button.md +62 -0
- package/docs/components/extend/ex-card.md +86 -0
- package/docs/components/extend/ex-chart.md +355 -0
- package/docs/components/extend/ex-icon.md +190 -0
- package/docs/components/extend/ex-line.md +71 -0
- package/docs/components/extend/ex-multi.md +156 -0
- package/docs/components/extend/ex-page.md +75 -0
- package/docs/components/extend/ex-pie.md +70 -0
- package/docs/components/extend/ex-select-tree.md +210 -0
- package/docs/components/extend/ex-table.md +591 -0
- package/docs/components/extend/ex-upload.md +134 -0
- package/docs/components/utils/size.md +148 -0
- package/docs/components/utils/theme.md +183 -0
- package/lib/index.common.js +449 -429
- package/lib/index.css +1 -1
- package/lib/index.umd.js +449 -429
- package/lib/index.umd.min.js +4 -4
- package/package.json +4 -2
- package/src/components/ex-chart/ExMulti.vue +44 -32
- package/src/components/ex-chart/ExPie.vue +6 -8
- package/src/components/ex-chart/index.vue +1 -4
- package/src/components/ex-chart/theme/dark.js +14 -12
- package/src/components/ex-chart/utils.js +1 -1
- package/src/components/ex-icon/index.js +2 -0
- package/src/components/ex-icon/index.vue +168 -0
- package/src/components/ex-icon/style/index.scss +7 -0
- package/src/components/ex-table/index.vue +3 -3
- package/src/components/index.scss +4 -1
- package/src/components/xt-button/index.vue +2 -2
- package/src/components/xt-button/style/index.scss +524 -614
- package/src/components/xt-card-item/images/bar.svg +1 -0
- package/src/components/xt-card-item/images/line.svg +1 -0
- package/src/components/xt-card-item/images/pie.svg +1 -0
- package/src/components/xt-card-item/index copy.vue +93 -0
- package/src/components/xt-card-item/index.vue +23 -83
- package/src/components/xt-card-item/style/index copy.scss +72 -0
- package/src/components/xt-card-item/style/index.scss +51 -40
- package/src/components/xt-config-provider/index.vue +2 -2
- package/src/components/xt-text/index.vue +58 -29
- package/src/index.js +3 -0
- package/src/components/ex-chart/ExTrend.vue +0 -124
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1781571276852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="35671" data-spm-anchor-id="a313x.search_index.0.i17.53a93a81J5fQhI" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M0 346.453333h179.2v611.84H0z" fill="#C0D6FF" p-id="35672" data-spm-anchor-id="a313x.search_index.0.i14.53a93a81J5fQhI" class=""></path><path d="M281.6 113.777778H460.8v844.8H281.6z" fill="#035DFF" p-id="35673" data-spm-anchor-id="a313x.search_index.0.i16.53a93a81J5fQhI" class="selected"></path><path d="M563.2 229.376h179.2v729.088H563.2z" fill="#32C894" p-id="35674"></path><path d="M844.8 338.716444H1024v620.032h-179.2z" fill="#CCF1E4" p-id="35675" data-spm-anchor-id="a313x.search_index.0.i13.53a93a81J5fQhI" class="selected"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1781571535496" class="icon" viewBox="0 0 1228 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="54623" data-spm-anchor-id="a313x.search_index.0.i19.53a93a81J5fQhI" xmlns:xlink="http://www.w3.org/1999/xlink" width="239.84375" height="200"><path d="M25.4464 679.296C137.3696 957.952 264.3968 1061.4528 405.8624 985.088c41.5744-22.4256 85.1712-81.0752 138.24-179.5584 21.3504-39.5776 43.8272-84.736 72.448-144.7168 12.9536-27.1872 63.5392-134.8096 75.6992-160.4096 97.6128-205.1328 165.2224-323.9168 238.7456-403.2768 92.5184-99.8912 180.1216-113.4592 271.2576-27.392l8.8064-9.2928c-96.896-91.4944-192.512-76.672-289.4592 27.9808-74.7008 80.64-142.7456 200.1408-240.896 406.5024-12.2112 25.6-62.7712 133.2224-75.7248 160.384-28.5184 59.8016-50.9184 104.7808-72.1408 144.128-51.8912 96.3328-94.464 153.5488-133.0688 174.3872C267.3664 1045.2992 146.7904 947.0976 37.3504 674.56l-11.8784 4.7616z" fill="#67c8fb" p-id="54624" data-spm-anchor-id="a313x.search_index.0.i20.53a93a81J5fQhI" class="selected"></path><path d="M0.1024 472.3968c95.0272 187.1616 234.496 238.72 415.744 153.4976 69.632-32.768 118.8864-87.6288 209.3312-215.7056l9.728-13.7984 9.728-13.7216c92.3648-130.3552 146.2272-184.4736 218.6496-199.8592 93.1328-19.7632 201.8816 44.5696 340.736 215.936l9.984-8.064c-141.568-174.6944-254.3616-241.408-353.3568-220.3904-76.8512 16.3328-132.1728 71.8848-226.4576 204.9792l-9.728 13.7472-9.728 13.7984c-89.088 126.1568-137.472 180.0448-204.3392 211.4816-174.848 82.2528-306.944 33.408-398.8736-147.712L0.1024 472.4224z" fill="#5483FC" p-id="54625"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1781571036529" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15689" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M463.368 835.6c-139.688-23.544-278.456-159-278.456-323.256 6.512-159.328 121.848-293.224 278.456-323.256V0.648C230.768 24.192 0.008 244.08 0.008 511.704c0 267.616 230.624 488.16 463.352 511.048V835.6z m0 0" fill="#83a9fd" p-id="15690"></path><path d="M837.352 511.704a322.96 322.96 0 0 1-21.6 121.048l161.832 93.592a520.536 520.536 0 0 0 44.528-214.64m0 0c6.728-267.888-199.096-493.376-466.488-511.056l0.648 187.8c186.088 23.576 281.08 159 281.08 323.256" fill="#2e65f3" p-id="15691" data-spm-anchor-id="a313x.search_index.0.i8.53a93a81J5fQhI" class="selected"></path><path d="M770.336 711.928a315.104 315.104 0 0 1-212.056 121.832v188a533.704 533.704 0 0 0 371.096-216.168l-159.04-93.664z m0 0" fill="#83a9fd" p-id="15692"></path></svg>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FlexBox
|
|
3
|
+
v-if="iconType=='border'"
|
|
4
|
+
class="xt-card-item is-border"
|
|
5
|
+
:class="[iconType=='border'?`is-${type}`:'']"
|
|
6
|
+
:style="cardItemStyle"
|
|
7
|
+
content="between"
|
|
8
|
+
>
|
|
9
|
+
<span class="item__label" v-if="title">
|
|
10
|
+
<slot name="label">{{ label }}</slot>
|
|
11
|
+
</span>
|
|
12
|
+
<span class="item__value">
|
|
13
|
+
<slot name="value">{{ value }}</slot>
|
|
14
|
+
</span>
|
|
15
|
+
<span class="item__unit">
|
|
16
|
+
<slot name="unit">{{ unit }}</slot>
|
|
17
|
+
</span>
|
|
18
|
+
</FlexBox>
|
|
19
|
+
<FlexBox
|
|
20
|
+
v-else
|
|
21
|
+
class="xt-card-item"
|
|
22
|
+
:direction="direction"
|
|
23
|
+
:content="contentAlign"
|
|
24
|
+
>
|
|
25
|
+
<slot name="icon">
|
|
26
|
+
<el-button :type="type" :circle="circle" :round="round" plain :icon="icon"></el-button>
|
|
27
|
+
</slot>
|
|
28
|
+
<div class="item__value">
|
|
29
|
+
<span class="value" :style="valueStyle">
|
|
30
|
+
<slot name="value">{{ label }}</slot>
|
|
31
|
+
</span>
|
|
32
|
+
<div class="unit">{{ value }}</div>
|
|
33
|
+
</div>
|
|
34
|
+
</FlexBox>
|
|
35
|
+
</template>
|
|
36
|
+
<script>
|
|
37
|
+
import FlexBox from '../xt-flex-box/index.vue'
|
|
38
|
+
export default {
|
|
39
|
+
name: "XtCardItem",
|
|
40
|
+
components: {
|
|
41
|
+
FlexBox
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
iconType: { default: "border" },
|
|
45
|
+
type: { default: "primary" },
|
|
46
|
+
label: {},
|
|
47
|
+
value: {},
|
|
48
|
+
unit: {},
|
|
49
|
+
icon: {},
|
|
50
|
+
iconAt: { default: "right" },
|
|
51
|
+
color: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: ''
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
circle: false,
|
|
59
|
+
round: false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
computed: {
|
|
63
|
+
contentAlign() {
|
|
64
|
+
return this.iconAt == 'center' ? 'center' : 'start'
|
|
65
|
+
},
|
|
66
|
+
direction() {
|
|
67
|
+
const iconAtMap = {
|
|
68
|
+
left: 'row',
|
|
69
|
+
right: 'row-reverse',
|
|
70
|
+
top: 'column',
|
|
71
|
+
bottom: 'column-reverse'
|
|
72
|
+
}
|
|
73
|
+
return iconAtMap[this.iconAt]
|
|
74
|
+
},
|
|
75
|
+
cardItemStyle() {
|
|
76
|
+
if (this.iconType === 'border' && this.type === 'primary' && this.color) {
|
|
77
|
+
return {
|
|
78
|
+
'--xt-card-item-color': this.color
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {}
|
|
82
|
+
},
|
|
83
|
+
valueStyle() {
|
|
84
|
+
if (this.iconType !== 'border' && this.type === 'primary' && this.color) {
|
|
85
|
+
return {
|
|
86
|
+
color: this.color
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
@@ -1,93 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</span>
|
|
18
|
-
</FlexBox>
|
|
19
|
-
<FlexBox
|
|
20
|
-
v-else
|
|
21
|
-
class="xt-card-item"
|
|
22
|
-
:direction="direction"
|
|
23
|
-
:content="contentAlign"
|
|
24
|
-
>
|
|
25
|
-
<slot name="icon">
|
|
26
|
-
<el-button :type="type" :circle="circle" :round="round" plain :icon="icon"></el-button>
|
|
27
|
-
</slot>
|
|
28
|
-
<div class="item__value">
|
|
29
|
-
<span class="value" :style="valueStyle">
|
|
30
|
-
<slot name="value">{{ label }}</slot>
|
|
31
|
-
</span>
|
|
32
|
-
<div class="unit">{{ value }}</div>
|
|
33
|
-
</div>
|
|
34
|
-
</FlexBox>
|
|
2
|
+
<ex-card class="xt-card-item" :bordered="false" :class="{ [`is-${type}`]: type ? true : false}">
|
|
3
|
+
<xt-text bold size="medium">{{ title }}</xt-text>
|
|
4
|
+
<xt-flex-box>
|
|
5
|
+
<div style="width: 50%;margin-bottom: 5px;">
|
|
6
|
+
<xt-text bold size="large" v-model="value" format="thousand" :type="type" :decimals="0"></xt-text>
|
|
7
|
+
<div style="margin: 5px 0;">
|
|
8
|
+
<xt-text size="small">较昨日</xt-text>
|
|
9
|
+
<xt-text v-model="change" format="normal" :type="diff > 0 ? 'success' : 'danger'" :suffix="diff > 0 ? '↑' : '↓'"></xt-text>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
<div style="flex: 1; height: 100%;">
|
|
13
|
+
<xt-text size="extra-large" :type="type"><i class="el-icon-user"></i></xt-text>
|
|
14
|
+
</div>
|
|
15
|
+
</xt-flex-box>
|
|
16
|
+
</ex-card>
|
|
35
17
|
</template>
|
|
36
18
|
<script>
|
|
37
|
-
import FlexBox from '../xt-flex-box/index.vue'
|
|
38
19
|
export default {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
label: {},
|
|
47
|
-
value: {},
|
|
48
|
-
unit: {},
|
|
49
|
-
icon: {},
|
|
50
|
-
iconAt: { default: "right" },
|
|
51
|
-
color: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: ''
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
data() {
|
|
57
|
-
return {
|
|
58
|
-
circle: false,
|
|
59
|
-
round: false
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
computed: {
|
|
63
|
-
contentAlign() {
|
|
64
|
-
return this.iconAt == 'center' ? 'center' : 'start'
|
|
65
|
-
},
|
|
66
|
-
direction() {
|
|
67
|
-
const iconAtMap = {
|
|
68
|
-
left: 'row',
|
|
69
|
-
right: 'row-reverse',
|
|
70
|
-
top: 'column',
|
|
71
|
-
bottom: 'column-reverse'
|
|
72
|
-
}
|
|
73
|
-
return iconAtMap[this.iconAt]
|
|
74
|
-
},
|
|
75
|
-
cardItemStyle() {
|
|
76
|
-
if (this.iconType === 'border' && this.type === 'primary' && this.color) {
|
|
77
|
-
return {
|
|
78
|
-
'--xt-card-item-color': this.color
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return {}
|
|
20
|
+
name: "XtCardItem",
|
|
21
|
+
props: {
|
|
22
|
+
type: { type: String, default: "primary" },
|
|
23
|
+
title: { type: String, default: '' },
|
|
24
|
+
diff: { type: Number, default: 0 },
|
|
25
|
+
value: { type: Number, default: 0 },
|
|
26
|
+
change: { type: Number, default: 0 },
|
|
82
27
|
},
|
|
83
|
-
|
|
84
|
-
if (this.iconType !== 'border' && this.type === 'primary' && this.color) {
|
|
28
|
+
data() {
|
|
85
29
|
return {
|
|
86
|
-
color: this.color
|
|
87
30
|
}
|
|
88
|
-
}
|
|
89
|
-
return {}
|
|
90
31
|
}
|
|
91
|
-
}
|
|
92
32
|
}
|
|
93
33
|
</script>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@import '../../../styles/variables.scss';
|
|
2
|
+
|
|
3
|
+
.xt-card-item {
|
|
4
|
+
--xt-card-item-color: var(--xt-color-primary, #1890ff);
|
|
5
|
+
|
|
6
|
+
min-height: var(--xt-card-item-min-height, 40px);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.xt-card-item + .xt-card-item {
|
|
10
|
+
margin-top: var(--xt-card-item-gap, 10px);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.xt-card-item.is-border {
|
|
14
|
+
border-right: var(--xt-card-item-border-width, 3px) solid transparent;
|
|
15
|
+
background-color: var(--xt-color-bg-secondary, #f5f7fa);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.xt-card-item.is-border.is-primary {
|
|
19
|
+
border-right-color: var(--xt-card-item-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.xt-card-item.is-border.is-primary .item__value .value {
|
|
23
|
+
color: var(--xt-card-item-color);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.xt-card-item.is-border.is-success {
|
|
27
|
+
border-right-color: var(--xt-color-success, #67C23A);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.xt-card-item.is-border.is-success .item__value .value {
|
|
31
|
+
color: var(--xt-color-success, #67C23A);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.xt-card-item.is-border.is-warning {
|
|
35
|
+
border-right-color: var(--xt-color-warning, #E6A23C);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.xt-card-item.is-border.is-warning .item__value .value {
|
|
39
|
+
color: var(--xt-color-warning, #E6A23C);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.xt-card-item.is-border.is-danger {
|
|
43
|
+
border-right-color: var(--xt-color-danger, #F56C6C);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.xt-card-item.is-border.is-danger .item__value .value {
|
|
47
|
+
color: var(--xt-color-danger, #F56C6C);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.xt-card-item .item__value {
|
|
51
|
+
padding-right: 10px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.xt-card-item .item__value .value {
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
font-size: var(--xt-font-size-base, 14px);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.xt-card-item .item__value .unit {
|
|
60
|
+
font-size: var(--xt-font-size-small, 13px);
|
|
61
|
+
color: var(--xt-color-text-secondary, #909399);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.xt-card-item .item__label {
|
|
65
|
+
padding-left: 10px;
|
|
66
|
+
color: var(--xt-color-text-secondary, #909399);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.xt-card-item .item__unit {
|
|
70
|
+
padding-left: 5px;
|
|
71
|
+
color: var(--xt-color-text-secondary, #909399);
|
|
72
|
+
}
|
|
@@ -1,72 +1,83 @@
|
|
|
1
1
|
@import '../../../styles/variables.scss';
|
|
2
2
|
|
|
3
3
|
.xt-card-item {
|
|
4
|
-
--xt-card-
|
|
4
|
+
--xt-card-bg-color: var(--xt-card-bg-color, #ffffff);
|
|
5
|
+
--xt-card-border-color: var(--xt-card-border-color, #EBEEF5);
|
|
6
|
+
--xt-card-text-color: var(--xt-color-text-primary, #303133);
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
border-radius: var(--xt-card-border-radius, 4px);
|
|
9
|
+
box-shadow: var(--xt-card-shadow, 0 2px 12px 0 rgba(0, 0, 0, 0.1));
|
|
10
|
+
background-color: var(--xt-card-bg-color);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
color: var(--xt-card-text-color);
|
|
13
|
+
transition: var(--xt-transition-duration, 0.3s);
|
|
7
14
|
}
|
|
8
15
|
|
|
9
|
-
.xt-card-item
|
|
10
|
-
|
|
16
|
+
.xt-card-item.is-primary {
|
|
17
|
+
--xt-card-bg-color: var(--xt-color-primary, #1890ff);
|
|
18
|
+
.card__header {
|
|
19
|
+
color: var(--xt-color-white, #ffffff);
|
|
20
|
+
}
|
|
11
21
|
}
|
|
12
22
|
|
|
13
|
-
.xt-card-item.is-border {
|
|
14
|
-
border-right: var(--xt-card-item-border-width, 3px) solid transparent;
|
|
15
|
-
background-color: var(--xt-color-bg-secondary, #f5f7fa);
|
|
16
|
-
}
|
|
17
23
|
|
|
18
|
-
.xt-card-item.is-
|
|
19
|
-
|
|
24
|
+
.xt-card-item.is-success {
|
|
25
|
+
--xt-card-bg-color: var(--xt-color-success, #67c039);
|
|
26
|
+
.card__header {
|
|
27
|
+
color: var(--xt-color-white, #ffffff);
|
|
28
|
+
}
|
|
20
29
|
}
|
|
21
30
|
|
|
22
|
-
.xt-card-item.is-border.is-primary .item__value .value {
|
|
23
|
-
color: var(--xt-card-item-color);
|
|
24
|
-
}
|
|
25
31
|
|
|
26
|
-
.xt-card-item.is-border.is-success {
|
|
27
|
-
border-right-color: var(--xt-color-success, #67C23A);
|
|
28
|
-
}
|
|
29
32
|
|
|
30
|
-
.xt-card-item.is-
|
|
31
|
-
color: var(--xt-color-
|
|
33
|
+
.xt-card-item.is-danger {
|
|
34
|
+
--xt-card-bg-color: var(--xt-color-danger, #f56c6c);
|
|
35
|
+
.card__header {
|
|
36
|
+
color: var(--xt-color-white, #ffffff);
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
.xt-card-item.is-border.is-warning {
|
|
35
|
-
border-right-color: var(--xt-color-warning, #E6A23C);
|
|
36
|
-
}
|
|
37
40
|
|
|
38
|
-
.xt-card-item.is-border.is-warning .item__value .value {
|
|
39
|
-
color: var(--xt-color-warning, #E6A23C);
|
|
40
|
-
}
|
|
41
41
|
|
|
42
|
-
.xt-card-item.is-
|
|
43
|
-
|
|
42
|
+
.xt-card-item.is-warning {
|
|
43
|
+
--xt-card-bg-color: var(--xt-color-warning, #e6a23c);
|
|
44
|
+
.card__header {
|
|
45
|
+
color: var(--xt-color-white, #ffffff);
|
|
46
|
+
}
|
|
44
47
|
}
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
|
|
50
|
+
.xt-card-item .card__header {
|
|
51
|
+
padding: var(--xt-card-header-padding, 18px 20px);
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
font-size: var(--xt-font-size-medium, 16px);
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
.xt-card-item .
|
|
51
|
-
padding
|
|
57
|
+
.xt-card-item .card__body {
|
|
58
|
+
padding: var(--xt-card-padding, 20px);
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
.xt-card-item .
|
|
61
|
+
.xt-card-item .card__body .value {
|
|
62
|
+
font-size: var(--xt-font-size-large, 18px);
|
|
55
63
|
font-weight: 600;
|
|
56
|
-
|
|
64
|
+
color: var(--xt-color-primary, #1890ff);
|
|
57
65
|
}
|
|
58
66
|
|
|
59
|
-
.xt-card-item .
|
|
60
|
-
font-size: var(--xt-font-size-
|
|
67
|
+
.xt-card-item .card__body .unit {
|
|
68
|
+
font-size: var(--xt-font-size-base, 14px);
|
|
61
69
|
color: var(--xt-color-text-secondary, #909399);
|
|
70
|
+
margin-left: 4px;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
.xt-card-item .
|
|
65
|
-
|
|
66
|
-
color: var(--xt-color-text-secondary, #909399);
|
|
73
|
+
.xt-card-item .value {
|
|
74
|
+
font-weight: 600;
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
.xt-card-item .
|
|
70
|
-
padding-
|
|
71
|
-
|
|
77
|
+
.xt-card-item .card__header + .card__body {
|
|
78
|
+
padding-top: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.xt-card-item.noPadding .card__body {
|
|
82
|
+
padding: 0;
|
|
72
83
|
}
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
type ? 'xt-text--' + type : '',
|
|
6
6
|
'xt-text--' + size,
|
|
7
7
|
{ 'xt-text--bold': bold },
|
|
8
|
-
{ 'xt-text--money': money }
|
|
8
|
+
{ 'xt-text--money': format === 'money' }
|
|
9
9
|
]"
|
|
10
10
|
:style="customStyle"
|
|
11
11
|
>
|
|
12
|
+
<slot name="prefix">{{ prefix }}</slot>
|
|
12
13
|
<slot>
|
|
13
|
-
<template v-if="
|
|
14
|
+
<template v-if="formattedValue !== undefined">{{ formattedValue }}</template>
|
|
14
15
|
</slot>
|
|
16
|
+
<slot name="suffix">{{ suffix }}</slot>
|
|
15
17
|
</span>
|
|
16
18
|
</template>
|
|
17
19
|
|
|
@@ -41,7 +43,15 @@ export default {
|
|
|
41
43
|
type: [String, Number],
|
|
42
44
|
default: ''
|
|
43
45
|
},
|
|
44
|
-
|
|
46
|
+
|
|
47
|
+
// 格式化模式:normal 普通 | thousand 千分位 | money 金额
|
|
48
|
+
format: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'normal',
|
|
51
|
+
validator: (val) => ['normal', 'thousand', 'money'].includes(val)
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// 兼容旧属性 money(老项目继续使用)
|
|
45
55
|
money: {
|
|
46
56
|
type: Boolean,
|
|
47
57
|
default: false
|
|
@@ -78,6 +88,11 @@ export default {
|
|
|
78
88
|
}
|
|
79
89
|
},
|
|
80
90
|
computed: {
|
|
91
|
+
// 兼容旧 money 属性:如果传了 money=true,自动切为金额模式
|
|
92
|
+
realFormat() {
|
|
93
|
+
return this.money ? 'money' : this.format
|
|
94
|
+
},
|
|
95
|
+
|
|
81
96
|
customStyle() {
|
|
82
97
|
const style = {}
|
|
83
98
|
if (this.letterSpacing) {
|
|
@@ -85,41 +100,55 @@ export default {
|
|
|
85
100
|
}
|
|
86
101
|
return style
|
|
87
102
|
},
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
|
|
104
|
+
formattedValue() {
|
|
105
|
+
const fmt = this.realFormat
|
|
106
|
+
const { value } = this
|
|
107
|
+
|
|
108
|
+
if (value === '' || value === undefined || value === null) {
|
|
90
109
|
return undefined
|
|
91
110
|
}
|
|
92
|
-
|
|
93
|
-
const numValue = typeof
|
|
94
|
-
|
|
111
|
+
|
|
112
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value
|
|
95
113
|
if (isNaN(numValue)) {
|
|
96
|
-
return
|
|
114
|
+
return value
|
|
97
115
|
}
|
|
98
|
-
|
|
116
|
+
|
|
99
117
|
try {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
let result = ''
|
|
119
|
+
const signOpt = this.showSign ? 'always' : 'auto'
|
|
120
|
+
|
|
121
|
+
switch (fmt) {
|
|
122
|
+
// 千分位格式化(纯数字)
|
|
123
|
+
case 'thousand':
|
|
124
|
+
result = new Intl.NumberFormat(this.locale, {
|
|
125
|
+
minimumFractionDigits: this.decimals,
|
|
126
|
+
maximumFractionDigits: this.decimals,
|
|
127
|
+
signDisplay: signOpt
|
|
128
|
+
}).format(numValue)
|
|
129
|
+
break
|
|
130
|
+
|
|
131
|
+
// 金额格式化(原有逻辑)
|
|
132
|
+
case 'money':
|
|
133
|
+
result = new Intl.NumberFormat(this.locale, {
|
|
134
|
+
style: 'currency',
|
|
135
|
+
currency: this.currency,
|
|
136
|
+
minimumFractionDigits: this.decimals,
|
|
137
|
+
maximumFractionDigits: this.decimals,
|
|
138
|
+
signDisplay: signOpt
|
|
139
|
+
}).format(numValue)
|
|
140
|
+
break
|
|
141
|
+
|
|
142
|
+
// 普通文本,直接返回原值
|
|
143
|
+
default:
|
|
144
|
+
return undefined
|
|
116
145
|
}
|
|
117
|
-
|
|
146
|
+
|
|
118
147
|
return result
|
|
119
148
|
} catch (e) {
|
|
120
|
-
return
|
|
149
|
+
return value
|
|
121
150
|
}
|
|
122
151
|
}
|
|
123
152
|
}
|
|
124
153
|
}
|
|
125
|
-
</script>
|
|
154
|
+
</script>ss
|
package/src/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import XtDatePicker from './components/xt-date-picker'
|
|
|
29
29
|
import ExButton from './components/ex-button'
|
|
30
30
|
import ExChart from './components/ex-chart' // ExChart 组件(基于 ECharts 封装)
|
|
31
31
|
import ExCard from './components/ex-card'
|
|
32
|
+
import ExIcon from './components/ex-icon' // ExIcon 组件(支持 el-icon / svg / 自定义字体)
|
|
32
33
|
import ExTable from './components/ex-table' // ExTable 组件(基于 ElementUI Table 封装)
|
|
33
34
|
|
|
34
35
|
// 导入 Element UI 组件注册配置
|
|
@@ -49,6 +50,7 @@ const components = [
|
|
|
49
50
|
ExButton,
|
|
50
51
|
ExChart,
|
|
51
52
|
ExCard,
|
|
53
|
+
ExIcon,
|
|
52
54
|
ExTable
|
|
53
55
|
]
|
|
54
56
|
|
|
@@ -134,6 +136,7 @@ export default {
|
|
|
134
136
|
XtDatePicker,
|
|
135
137
|
ExButton,
|
|
136
138
|
ExCard,
|
|
139
|
+
ExIcon,
|
|
137
140
|
ExTable
|
|
138
141
|
}
|
|
139
142
|
|