xt-element-ui 1.2.4 → 1.2.6

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/LICENSE +21 -0
  3. package/README.md +240 -104
  4. package/docs/README.md +100 -0
  5. package/docs/components/base/xt-button.md +114 -0
  6. package/docs/components/base/xt-card-item.md +104 -0
  7. package/docs/components/base/xt-card.md +108 -0
  8. package/docs/components/base/xt-config-provider.md +199 -0
  9. package/docs/components/base/xt-flex-box.md +115 -0
  10. package/docs/components/base/xt-grid-box.md +303 -0
  11. package/docs/components/base/xt-input.md +150 -0
  12. package/docs/components/base/xt-text.md +212 -0
  13. package/docs/components/extend/ex-bar.md +68 -0
  14. package/docs/components/extend/ex-button.md +62 -0
  15. package/docs/components/extend/ex-card.md +86 -0
  16. package/docs/components/extend/ex-chart.md +463 -0
  17. package/docs/components/extend/ex-icon.md +189 -0
  18. package/docs/components/extend/ex-line.md +71 -0
  19. package/docs/components/extend/ex-multi.md +156 -0
  20. package/docs/components/extend/ex-page.md +0 -0
  21. package/docs/components/extend/ex-pie.md +70 -0
  22. package/docs/components/extend/ex-select-tree.md +210 -0
  23. package/docs/components/extend/ex-table.md +591 -0
  24. package/docs/components/extend/ex-upload.md +134 -0
  25. package/docs/components/utils/size.md +148 -0
  26. package/docs/components/utils/theme.md +183 -0
  27. package/lib/index.common.js +640 -758
  28. package/lib/index.css +1 -1
  29. package/lib/index.umd.js +640 -758
  30. package/lib/index.umd.min.js +5 -5
  31. package/package.json +80 -39
  32. package/src/components/ex-chart/ExBar.vue +35 -29
  33. package/src/components/ex-chart/ExLine.vue +23 -14
  34. package/src/components/ex-chart/ExMulti.vue +66 -76
  35. package/src/components/ex-chart/ExPie.vue +26 -18
  36. package/src/components/ex-chart/index.vue +1 -4
  37. package/src/components/ex-chart/utils.js +149 -8
  38. package/src/components/ex-icon/index.js +2 -0
  39. package/src/components/ex-icon/index.vue +168 -0
  40. package/src/components/ex-icon/style/index.scss +7 -0
  41. package/src/components/ex-table/index.vue +3 -3
  42. package/src/components/index.scss +4 -1
  43. package/src/components/xt-card-item/images/bar.svg +1 -0
  44. package/src/components/xt-card-item/images/line.svg +1 -0
  45. package/src/components/xt-card-item/images/pie.svg +1 -0
  46. package/src/index.js +3 -0
  47. package/src/components/ex-chart/ExTrend.vue +0 -124
  48. package/src/components/ex-chart/theme/blue.js +0 -91
  49. package/src/components/ex-chart/theme/orange.js +0 -92
  50. package/src/components/ex-chart/theme/starry.js +0 -106
@@ -15,12 +15,16 @@ export default {
15
15
  type: Array,
16
16
  default: () => {
17
17
  return [
18
- { value: 53, name: "张三" },
19
- { value: 10, name: "李四" },
20
- { value: 60, name: "宋五" }
18
+ { value: 53, label: "张三" },
19
+ { value: 10, label: "李四" },
20
+ { value: 60, label: "宋五" }
21
21
  ];
22
22
  }
23
23
  },
24
+ fieldKeys: {
25
+ type: Object,
26
+ default: () => ({ label: "label", value: "value", data: "data" })
27
+ },
24
28
  colors: {
25
29
  type: Array,
26
30
  default: () => { return []; }
@@ -33,10 +37,11 @@ export default {
33
37
  type: Boolean,
34
38
  default: true
35
39
  },
36
- chartMode: {
37
- type: String,
38
- default: "dark"
40
+ simpleMode: {
41
+ type: Boolean,
42
+ default: false
39
43
  },
44
+ highlightKey: String,
40
45
  roseType: {
41
46
  type: String,
42
47
  default: ""
@@ -57,7 +62,11 @@ export default {
57
62
  },
58
63
  computed: {
59
64
  totalNum() {
60
- return this.chartData.map(it => parseFloat(it.value)).reduce((pre, aft) => { return pre + aft; }, 0);
65
+ const keys = Object.assign(
66
+ { label: "label", value: "value", data: "data" },
67
+ this.fieldKeys || {}
68
+ );
69
+ return this.chartData.map(it => parseFloat(it[keys.value])).reduce((pre, aft) => { return pre + aft; }, 0);
61
70
  }
62
71
  },
63
72
  watch: {
@@ -76,24 +85,19 @@ export default {
76
85
  this.$nextTick(() => {
77
86
  this.initChart();
78
87
  });
79
- /* setTimeout(() => {
80
- this.initChart();
81
- }, 1000); */
82
88
  },
83
89
  methods: {
84
90
  initChart() {
85
91
  const _self = this;
86
- console.log(this.chartMode);
87
- // 数据处理
92
+ const keys = Object.assign(
93
+ { label: "label", value: "value", data: "data" },
94
+ _self.fieldKeys || {}
95
+ );
88
96
  const option = {
89
97
  title: {
90
98
  text: `${_self.totalLabel}:${_self.totalNum}`,
91
99
  textStyle: {
92
- color: "#808080",
93
- fontSize: 20
94
100
  },
95
- // left: "40%",
96
- // top: "45%",
97
101
  top: "middle",
98
102
  left: "center"
99
103
  },
@@ -121,10 +125,11 @@ export default {
121
125
  minAngle: 5,
122
126
  avoidLabelOverlap: true,
123
127
  data: _self.chartData.map((item, ind) => {
124
- const { name, value } = item;
128
+ const label = item[keys.label];
129
+ const value = item[keys.value];
125
130
  return {
126
131
  value,
127
- name,
132
+ name: label,
128
133
  labelLine: {
129
134
  show: this.showLabel
130
135
  },
@@ -145,6 +150,9 @@ export default {
145
150
  })
146
151
  }]
147
152
  };
153
+ if (this.simpleMode) {
154
+ EchartsUtil.applySimpleMode(option, "pie");
155
+ }
148
156
  this.myChart = EchartsUtil.init(_self.$refs.piechart, this.theme, option, this.size);
149
157
  }
150
158
  }
@@ -3,14 +3,12 @@
3
3
  <ex-line v-else-if="type=='line'" v-bind="$attrs" :theme="myTheme" :size="mySize"></ex-line>
4
4
  <ex-pie v-else-if="type=='pie'" v-bind="$attrs" :theme="myTheme" :size="mySize"></ex-pie>
5
5
  <ex-multi v-else-if="type=='multi'" v-bind="$attrs" :theme="myTheme" :size="mySize"></ex-multi>
6
- <ex-trend v-else-if="type=='trend'" v-bind="$attrs" :theme="myTheme" :size="mySize"></ex-trend>
7
6
  </template>
8
7
  <script>
9
8
  import ExBar from "./ExBar.vue"
10
9
  import ExLine from "./ExLine.vue"
11
10
  import ExPie from "./ExPie.vue"
12
11
  import ExMulti from "./ExMulti.vue"
13
- import ExTrend from "./ExTrend.vue"
14
12
 
15
13
  export default {
16
14
  name: "ExChart",
@@ -18,8 +16,7 @@ export default {
18
16
  ExBar,
19
17
  ExLine,
20
18
  ExPie,
21
- ExMulti,
22
- ExTrend
19
+ ExMulti
23
20
  },
24
21
  props: {
25
22
  theme: {
@@ -1,16 +1,10 @@
1
1
  import themeWhite from "./theme/white";
2
2
  import themeDark from "./theme/dark";
3
- import themeBlue from "./theme/blue";
4
- import themeStarry from "./theme/starry";
5
- import themeOrange from "./theme/orange";
6
3
 
7
4
  const themeKeys = {
8
5
  "default": themeWhite,
9
6
  "white": themeWhite,
10
- "dark": themeDark,
11
- "blue": themeBlue,
12
- "starry": themeStarry,
13
- "orange": themeOrange
7
+ "dark": themeDark
14
8
  };
15
9
 
16
10
  // echarts 仅在客户端加载,避免 SSR 编译/渲染报错
@@ -121,8 +115,155 @@ EchartsUtil.EchartsUtil = {
121
115
 
122
116
  EchartsUtil.chartInstanceList = [];
123
117
 
118
+ // === 极简模式(simpleMode)预设配置 ===
119
+ // 极简模式:隐藏图例、隐藏坐标轴/网格线、缩小内边距、简化 tooltip、去除动画装饰
120
+
121
+ EchartsUtil.simpleModeOption = {
122
+ legend: { show: false },
123
+ tooltip: {
124
+ borderWidth: 0,
125
+ extraCssText: "box-shadow: 0 2px 8px rgba(0,0,0,0.12);"
126
+ },
127
+ grid: {
128
+ top: "5%",
129
+ left: "5%",
130
+ right: "5%",
131
+ bottom: "5%",
132
+ containLabel: true
133
+ },
134
+ xAxis: {
135
+ axisLine: { show: false },
136
+ axisTick: { show: false },
137
+ splitLine: { show: false }
138
+ },
139
+ yAxis: {
140
+ axisLine: { show: false },
141
+ axisTick: { show: false },
142
+ splitLine: { show: false },
143
+ axisLabel: { show: false }
144
+ },
145
+ animationDuration: 300,
146
+ animationEasing: "linear"
147
+ };
148
+
149
+ // 各类图表的极简模式特殊配置
150
+ EchartsUtil.simpleModeByType = {
151
+ bar: {
152
+ series: {
153
+ barWidth: "60%",
154
+ label: { show: false },
155
+ markPoint: null,
156
+ emphasis: {
157
+ itemStyle: {
158
+ shadowBlur: 6,
159
+ shadowOffsetX: 0,
160
+ shadowColor: "rgba(0,0,0,0.15)"
161
+ }
162
+ }
163
+ }
164
+ },
165
+ line: {
166
+ series: {
167
+ symbol: "none",
168
+ smooth: true,
169
+ symbolSize: 0,
170
+ label: { show: false },
171
+ areaStyle: null
172
+ }
173
+ },
174
+ pie: {
175
+ legend: { show: false },
176
+ title: { show: false },
177
+ series: {
178
+ radius: ["40%", "72%"],
179
+ label: { show: false },
180
+ labelLine: { show: false }
181
+ }
182
+ },
183
+ multi: {
184
+ legend: { show: false },
185
+ grid: {
186
+ top: "8%",
187
+ left: "5%",
188
+ right: "5%",
189
+ bottom: "5%",
190
+ containLabel: true
191
+ }
192
+ }
193
+ };
194
+
195
+ // 深拷贝 + 深合并工具
196
+ function deepMerge(target, source) {
197
+ if (source == null) return target;
198
+ if (Array.isArray(source)) return source.slice();
199
+ if (typeof source !== "object") return source;
200
+ if (target == null || typeof target !== "object") {
201
+ return JSON.parse(JSON.stringify(source));
202
+ }
203
+ const result = Array.isArray(target) ? target.slice() : Object.assign({}, target);
204
+ Object.keys(source).forEach(key => {
205
+ const src = source[key];
206
+ if (src === null || src === undefined) {
207
+ if (source.hasOwnProperty(key)) result[key] = src;
208
+ return;
209
+ }
210
+ if (typeof src === "object") {
211
+ result[key] = deepMerge(result[key], src);
212
+ } else {
213
+ result[key] = src;
214
+ }
215
+ });
216
+ return result;
217
+ }
218
+
219
+ // 对 option 应用极简模式(会保留调用方显式设置的值)
220
+ EchartsUtil.applySimpleMode = function(option, type) {
221
+ if (!option || typeof option !== "object") return option;
222
+
223
+ const base = JSON.parse(JSON.stringify(EchartsUtil.simpleModeOption));
224
+ const typeConfig = EchartsUtil.simpleModeByType[type] || {};
225
+ const merged = deepMerge(base, typeConfig);
226
+
227
+ // 合并 base 与 typeConfig 到当前 option
228
+ Object.keys(merged).forEach(key => {
229
+ if (key === "series") return; // series 单独处理
230
+ if (option[key] == null) {
231
+ option[key] = merged[key];
232
+ } else if (typeof option[key] === "object" && typeof merged[key] === "object" && !Array.isArray(option[key])) {
233
+ option[key] = deepMerge(merged[key], option[key]);
234
+ }
235
+ // 若调用方已有原始值则保留(不覆盖)
236
+ });
237
+
238
+ // series 处理:若存在则对每个 series 应用简化配置
239
+ if (option.series && Array.isArray(option.series)) {
240
+ const simpleSeries = (merged.series || {});
241
+ option.series = option.series.map(s => {
242
+ if (s == null || typeof s !== "object") return s;
243
+ return deepMerge(simpleSeries, s); // 调用方的值优先级更高
244
+ });
245
+ }
246
+
247
+ // 特殊:xAxis / yAxis 可能是数组
248
+ ["xAxis", "yAxis"].forEach(axisKey => {
249
+ if (option[axisKey] != null && typeof option[axisKey] === "object") {
250
+ const simpleAxis = merged[axisKey] || {};
251
+ if (Array.isArray(option[axisKey])) {
252
+ option[axisKey] = option[axisKey].map(axis => {
253
+ if (axis == null || typeof axis !== "object") return axis;
254
+ return deepMerge(simpleAxis, axis);
255
+ });
256
+ } else {
257
+ option[axisKey] = deepMerge(simpleAxis, option[axisKey]);
258
+ }
259
+ }
260
+ });
261
+
262
+ return option;
263
+ };
264
+
124
265
  EchartsUtil.mergeOptions = function(themeOption, customOption) {
125
- return Object.assign({}, this.baseOption, themeOption, customOption);
266
+ return Object.assign({}, themeOption, customOption);
126
267
  };
127
268
 
128
269
  // 根据字体大小调整主题配置
@@ -0,0 +1,2 @@
1
+ import ExIcon from './index.vue'
2
+ export default ExIcon
@@ -0,0 +1,168 @@
1
+ <template>
2
+ <component
3
+ :is="tag"
4
+ :class="iconClasses"
5
+ :style="iconStyle"
6
+ v-on="$listeners"
7
+ @click="handleClick"
8
+ >
9
+ <svg v-if="isSvgSprite" :style="svgStyle" aria-hidden="true">
10
+ <use :href="svgHref" />
11
+ </svg>
12
+ <slot v-else-if="hasDefaultSlot" />
13
+ </component>
14
+ </template>
15
+
16
+ <script>
17
+ const customPrefixes = {}
18
+
19
+ const ExIcon = {
20
+ name: 'ExIcon',
21
+ inheritAttrs: false,
22
+
23
+ props: {
24
+ name: {
25
+ type: String,
26
+ default: ''
27
+ },
28
+ size: {
29
+ type: [String, Number],
30
+ default: ''
31
+ },
32
+ color: {
33
+ type: String,
34
+ default: ''
35
+ },
36
+ spin: {
37
+ type: Boolean,
38
+ default: false
39
+ }
40
+ },
41
+
42
+ computed: {
43
+ hasDefaultSlot() {
44
+ return !!this.$slots.default
45
+ },
46
+ iconName() {
47
+ return (this.name || '').trim()
48
+ },
49
+ isElIcon() {
50
+ return /^el-icon-/.test(this.iconName)
51
+ },
52
+ isSvgInline() {
53
+ return this.iconName.indexOf('<svg') > -1
54
+ },
55
+ isSvgSprite() {
56
+ return /^(#|svg:)/.test(this.iconName)
57
+ },
58
+ isCustomFont() {
59
+ if (!this.iconName) return false
60
+ return !this.isElIcon && !this.isSvgInline && !this.isSvgSprite
61
+ },
62
+ svgHref() {
63
+ if (!this.isSvgSprite) return ''
64
+ const name = this.iconName.replace(/^svg:/, '').replace(/^#/, '')
65
+ return `#${name}`
66
+ },
67
+ needsExIconPrefix() {
68
+ if (!this.isCustomFont) return false
69
+ for (const prefix of Object.keys(customPrefixes)) {
70
+ if (this.iconName.indexOf(prefix) === 0) {
71
+ return false
72
+ }
73
+ }
74
+ return true
75
+ },
76
+ tag() {
77
+ if (this.isSvgInline) return 'span'
78
+ return 'i'
79
+ },
80
+ iconClasses() {
81
+ const classes = []
82
+ if (this.isElIcon) {
83
+ classes.push(this.iconName)
84
+ } else if (this.isSvgSprite) {
85
+ classes.push('ex-icon-svg')
86
+ } else if (this.isCustomFont) {
87
+ if (this.needsExIconPrefix) classes.push('ex-icon')
88
+ classes.push(this.iconName)
89
+ } else if (this.isSvgInline) {
90
+ classes.push('ex-icon-inline-svg')
91
+ }
92
+ if (this.spin) classes.push('ex-icon-spin')
93
+ return classes
94
+ },
95
+ iconStyle() {
96
+ const style = {}
97
+ if (this.size) {
98
+ const s = typeof this.size === 'number' ? `${this.size}px` : this.size
99
+ style.fontSize = s
100
+ style.width = s
101
+ style.height = s
102
+ }
103
+ if (this.color) {
104
+ style.color = this.color
105
+ }
106
+ if (this.isSvgInline) {
107
+ style.display = 'inline-block'
108
+ style.verticalAlign = 'middle'
109
+ }
110
+ return style
111
+ },
112
+ svgStyle() {
113
+ return {
114
+ width: '1em',
115
+ height: '1em',
116
+ verticalAlign: '-0.15em',
117
+ fill: 'currentColor',
118
+ overflow: 'hidden'
119
+ }
120
+ }
121
+ },
122
+
123
+ mounted() {
124
+ if (this.isSvgInline && this.$el) {
125
+ this.$el.innerHTML = this.iconName
126
+ }
127
+ },
128
+
129
+ beforeUpdate() {
130
+ if (this.isSvgInline && this.$el) {
131
+ this.$el.innerHTML = this.iconName
132
+ }
133
+ },
134
+
135
+ methods: {
136
+ handleClick(e) {
137
+ this.$emit('click', e)
138
+ }
139
+ }
140
+ }
141
+
142
+ ExIcon.registerPrefix = function (prefix) {
143
+ if (prefix && typeof prefix === 'string') {
144
+ customPrefixes[prefix] = true
145
+ }
146
+ }
147
+
148
+ export default ExIcon
149
+ </script>
150
+
151
+ <style lang="scss" scoped>
152
+ .ex-icon-svg {
153
+ display: inline-flex;
154
+ align-items: center;
155
+ justify-content: center;
156
+ vertical-align: middle;
157
+ font-size: inherit;
158
+ }
159
+
160
+ .ex-icon-spin {
161
+ animation: ex-icon-spin-rotate 1s linear infinite;
162
+ }
163
+
164
+ @keyframes ex-icon-spin-rotate {
165
+ from { transform: rotate(0deg); }
166
+ to { transform: rotate(360deg); }
167
+ }
168
+ </style>
@@ -0,0 +1,7 @@
1
+ .ex-icon {
2
+ display: inline-block;
3
+ font-style: normal;
4
+ -webkit-font-smoothing: antialiased;
5
+ -moz-osx-font-smoothing: grayscale;
6
+ vertical-align: -0.15em;
7
+ }
@@ -97,10 +97,10 @@
97
97
  <!-- 分页 -->
98
98
  <div class="ex-table-footer" v-if="showPagination">
99
99
  <el-pagination
100
- :current-page="pagination.PageNum"
101
- :page-size="pagination.PageSize"
100
+ :current-page="pagination.ppageNum"
101
+ :page-size="pagination.pageSize"
102
102
  :total="total"
103
- :page-sizes="pagination.PageSizes || [10, 20, 50, 100]"
103
+ :page-sizes="pagination.pageSizes || [10, 20, 50, 100]"
104
104
  layout="total, sizes, prev, pager, next, jumper"
105
105
  @size-change="handleSizeChange"
106
106
  @current-change="handleCurrentChange"
@@ -28,4 +28,7 @@
28
28
  @import './ex-card/style/index.scss';
29
29
 
30
30
  // GridBox 组件样式
31
- @import './xt-grid-box/style/index.scss';
31
+ @import './xt-grid-box/style/index.scss';
32
+
33
+ // ExIcon 组件样式
34
+ @import './ex-icon/style/index.scss';
@@ -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>
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
 
@@ -1,124 +0,0 @@
1
- <template>
2
- <div ref="barchart" class="bar-box" :style="{width:width}"></div>
3
- </template>
4
- <script>
5
- import EchartsUtil from "./utils";
6
- export default {
7
- name: "XtTrend",
8
- props: {
9
- type: {
10
- type: String,
11
- default: "bar"
12
- },
13
- theme: {},
14
- size: {
15
- type: String,
16
- default: "medium"
17
- },
18
- chartData: {
19
- type: Array,
20
- default: () => {
21
- return [
22
- { value: 53, label: "正常设备" },
23
- { value: 10, label: "正常设备" },
24
- { value: 60, label: "离线设备" }
25
- ];
26
- }
27
- },
28
- width: {
29
- type: String,
30
- default: "100%"
31
- },
32
- energyType: {
33
- type: String,
34
- default: "m³"
35
- }
36
- },
37
- data() {
38
- return {
39
- myChart: null
40
- };
41
- },
42
- watch: {
43
- type: {
44
- handler() {
45
- const _self = this;
46
- const option = _self.getOption();
47
- _self.myChart.setOption(option);
48
- }
49
- },
50
- chartData: {
51
- deep: true,
52
- handler(newVal, oldVal) {
53
- const _self = this;
54
- _self.initChart();
55
- }
56
- },
57
- theme(newVal) {
58
- this.initChart();
59
- }
60
- },
61
- mounted() {
62
- this.initChart();
63
- },
64
- methods: {
65
- getOption() {
66
- const _self = this;
67
- // 数据处理
68
- const option = {
69
- xAxis: {
70
- type: "category",
71
- axisTick: {
72
- show: false,
73
- splitLine: {
74
- lineStyle: {
75
- }
76
- }
77
- },
78
- axisLabel: {
79
- }
80
- },
81
- tooltip: {
82
- borderWidth: 1,
83
- trigger: "item"
84
- },
85
- grid: {
86
- top: "10",
87
- left: "10",
88
- right: "10",
89
- bottom: "20"
90
- },
91
- yAxis: {
92
- show: false,
93
- type: "value"
94
- },
95
- series: {
96
- type: _self.type || "bar",
97
- areaStyle: {},
98
- showSymbol: false,
99
- smooth: true,
100
- data: _self.chartData.map((item, ind) => {
101
- const { label, value } = item;
102
- return {
103
- value,
104
- label
105
- };
106
- })
107
- }
108
- };
109
- return option;
110
- },
111
- initChart() {
112
- const _self = this;
113
- // 数据处理
114
- const option = this.getOption();
115
- this.myChart = EchartsUtil.init(_self.$refs.barchart, this.theme, option, this.size);
116
- }
117
- }
118
- };
119
- </script>
120
- <style lang="scss" scoped>
121
- .bar-box{
122
- position: relative;
123
- }
124
- </style>