lw-cdp-ui 1.3.62 → 1.3.64

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.
@@ -4,36 +4,30 @@
4
4
  <div v-for="(item, index) in parsedData"
5
5
  :key="index"
6
6
  class="chart-title-card"
7
- :style="{ height }">
8
- <el-statistic :value="item.current">
9
- <template #title>
10
- <div class="title-container"
11
- :style="{ textAlign: item.setting.title?.left || 'right' }">
12
- <div class="left"
13
- v-if="item.setting.title?.show">
14
- <span :style="{
7
+ :style="{ height,textAlign: item.setting?.title?.left || 'left' }">
8
+ <div class="title-top"
9
+ :style="{ ...titleLeftRight, padding: item.setting?.title?.padding?.map(num => num + 'px').join(' ') || 0 }"
10
+ v-if="item.setting.title?.show">
11
+ <span :style="{
15
12
  color: item.setting.title?.textStyle?.color || item.color,
16
- padding: item.setting?.title?.padding?.map(num => num + 'px').join(' ') || 0,
17
13
  fontWeight: item.setting.title?.textStyle?.fontWeight || 'normal',
18
14
  fontSize: item.setting.title?.textStyle?.fontSize + 'px' || '17px' }">{{ item.title }}</span>
19
- <el-tooltip v-if="item.tooltip"
20
- effect="dark"
21
- :content="item.tooltip"
22
- placement="top">
23
- <el-icon class="icon-tooltip"><el-icon-warning /></el-icon>
24
- </el-tooltip>
25
- </div>
26
-
27
- <strong v-if="item.setting.legend?.show"
28
- class="title"
29
- :style="{
15
+ <el-tooltip v-if="item.tooltip"
16
+ effect="dark"
17
+ :content="item.tooltip"
18
+ placement="top">
19
+ <el-icon class="icon-tooltip"><el-icon-warning /></el-icon>
20
+ </el-tooltip>
21
+ </div>
22
+ <div class="statistic-current"
23
+ :style="{
24
+ ...legendLeftRight,
30
25
  color: item.setting.legend?.textStyle?.color || item.color,
31
26
  padding: item.setting?.legend?.padding?.map(num => num + 'px').join(' ') || 0,
32
27
  fontWeight: item.setting.legend?.textStyle?.fontWeight || 'bold',
33
- fontSize: item.setting.legend?.textStyle?.fontSize + 'px' || '17px'}">{{ item.index }}</strong>
34
- </div>
35
- </template>
36
- </el-statistic>
28
+ fontSize: item.setting.legend?.textStyle?.fontSize + 'px' || '17px'}">
29
+ {{ item.current?.toLocaleString('en-US') }}
30
+ </div>
37
31
 
38
32
  <div v-if="parsedData.length > 1"
39
33
  class="statistic-footer">
@@ -103,6 +97,45 @@ export default {
103
97
  return this.parsedData?.length < this.rawData.setting.columnCount
104
98
  ? this.parsedData?.length
105
99
  : this.rawData.setting.columnCount
100
+ },
101
+ titleLeftRight() {
102
+ let {left} = this.rawData.setting?.title || {}
103
+ let params = {}
104
+ if (left == 'left') {
105
+ params.left = 0
106
+ } else if (left == 'center') {
107
+ params.left = '50%'
108
+ params.transform = 'translateX(-50%)'
109
+ } else {
110
+ params.left = 'auto'
111
+ params.right = 0
112
+ }
113
+ return params
114
+ },
115
+ legendLeftRight() {
116
+ let {left, top} = this.rawData.setting?.legend || {}
117
+ let params = {}
118
+ if (left == 'left') {
119
+ params.left = 0
120
+ params.right = 'auto'
121
+ } else if (left == 'center') {
122
+ params.right = '50%'
123
+ params.transform = 'translateX(50%)'
124
+ } else {
125
+ params.left = 'auto'
126
+ params.right = 0
127
+ }
128
+
129
+ if (top == 'top') {
130
+ params.top = 0
131
+ } else if (top == 'bottom') {
132
+ params.bottom = 0
133
+ } else if (top == 'middle') {
134
+ params.top = '50%'
135
+ params.transform = 'translateY(-50%)'
136
+ }
137
+
138
+ return params
106
139
  }
107
140
  }
108
141
  }
@@ -116,7 +149,6 @@ export default {
116
149
  width: 100%;
117
150
  justify-content: center;
118
151
  .chart-title-card {
119
- padding: 15px;
120
152
  flex: 1;
121
153
  border-radius: 5px;
122
154
  min-height: 110px;
@@ -130,24 +162,16 @@ export default {
130
162
  justify-content: space-between;
131
163
  background-color: var(--el-bg-color-overlay);
132
164
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.0509803922);
165
+ position: relative;
133
166
  }
134
167
  :deep(.el-statistic__number) {
135
168
  line-height: 50px;
136
169
  font-size: 40px;
137
170
  }
138
- .title-container {
139
- position: relative;
140
- font-size: 14px;
141
- min-height: 20px;
142
- .left {
143
- position: absolute;
144
- left: 0;
145
- }
146
- .title {
147
- font-size: 17px;
148
- position: absolute;
149
- right: 0;
150
- }
171
+ .statistic-current {
172
+ font-size: 17px;
173
+ position: absolute;
174
+ right: 0;
151
175
  }
152
176
 
153
177
  .statistic-footer {