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.
Files changed (51) hide show
  1. package/docs/README.md +201 -0
  2. package/docs/components/base/xt-button.md +114 -0
  3. package/docs/components/base/xt-card-item.md +104 -0
  4. package/docs/components/base/xt-card.md +108 -0
  5. package/docs/components/base/xt-config-provider.md +199 -0
  6. package/docs/components/base/xt-flex-box.md +115 -0
  7. package/docs/components/base/xt-grid-box.md +303 -0
  8. package/docs/components/base/xt-input.md +150 -0
  9. package/docs/components/base/xt-text.md +212 -0
  10. package/docs/components/extend/ex-bar.md +68 -0
  11. package/docs/components/extend/ex-button.md +62 -0
  12. package/docs/components/extend/ex-card.md +86 -0
  13. package/docs/components/extend/ex-chart.md +355 -0
  14. package/docs/components/extend/ex-icon.md +190 -0
  15. package/docs/components/extend/ex-line.md +71 -0
  16. package/docs/components/extend/ex-multi.md +156 -0
  17. package/docs/components/extend/ex-page.md +75 -0
  18. package/docs/components/extend/ex-pie.md +70 -0
  19. package/docs/components/extend/ex-select-tree.md +210 -0
  20. package/docs/components/extend/ex-table.md +591 -0
  21. package/docs/components/extend/ex-upload.md +134 -0
  22. package/docs/components/utils/size.md +148 -0
  23. package/docs/components/utils/theme.md +183 -0
  24. package/lib/index.common.js +449 -429
  25. package/lib/index.css +1 -1
  26. package/lib/index.umd.js +449 -429
  27. package/lib/index.umd.min.js +4 -4
  28. package/package.json +4 -2
  29. package/src/components/ex-chart/ExMulti.vue +44 -32
  30. package/src/components/ex-chart/ExPie.vue +6 -8
  31. package/src/components/ex-chart/index.vue +1 -4
  32. package/src/components/ex-chart/theme/dark.js +14 -12
  33. package/src/components/ex-chart/utils.js +1 -1
  34. package/src/components/ex-icon/index.js +2 -0
  35. package/src/components/ex-icon/index.vue +168 -0
  36. package/src/components/ex-icon/style/index.scss +7 -0
  37. package/src/components/ex-table/index.vue +3 -3
  38. package/src/components/index.scss +4 -1
  39. package/src/components/xt-button/index.vue +2 -2
  40. package/src/components/xt-button/style/index.scss +524 -614
  41. package/src/components/xt-card-item/images/bar.svg +1 -0
  42. package/src/components/xt-card-item/images/line.svg +1 -0
  43. package/src/components/xt-card-item/images/pie.svg +1 -0
  44. package/src/components/xt-card-item/index copy.vue +93 -0
  45. package/src/components/xt-card-item/index.vue +23 -83
  46. package/src/components/xt-card-item/style/index copy.scss +72 -0
  47. package/src/components/xt-card-item/style/index.scss +51 -40
  48. package/src/components/xt-config-provider/index.vue +2 -2
  49. package/src/components/xt-text/index.vue +58 -29
  50. package/src/index.js +3 -0
  51. package/src/components/ex-chart/ExTrend.vue +0 -124
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xt-element-ui",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "基于 Vue2.7 + ElementUI 的组件库",
5
5
  "main": "lib/index.common.js",
6
6
  "module": "lib/index.esm.js",
@@ -27,7 +27,9 @@
27
27
  "files": [
28
28
  "lib",
29
29
  "src",
30
- "README.md"
30
+ "README.md",
31
+ "docs/components/**/*md",
32
+ "docs/README.md"
31
33
  ],
32
34
  "dependencies": {
33
35
  "echarts": "^6.1.0",
@@ -15,6 +15,12 @@ export default {
15
15
  type: String,
16
16
  default: "medium"
17
17
  },
18
+ // 新增极简模式开关
19
+ simpleMode: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ highlightKey: String,// 需要高亮的日期/标识
18
24
  config: {
19
25
  type: Object,
20
26
  default() {
@@ -33,6 +39,7 @@ export default {
33
39
  return [
34
40
  {
35
41
  label: "入户数",
42
+ unit: "户",
36
43
  data: [
37
44
  { label: "01月", value: 980 },
38
45
  { label: "02月", value: 806 },
@@ -50,6 +57,7 @@ export default {
50
57
  },
51
58
  {
52
59
  label: "隐患数",
60
+ unit: "个",
53
61
  data: [
54
62
  { label: "01月", value: 200 },
55
63
  { label: "02月", value: 120 },
@@ -67,6 +75,7 @@ export default {
67
75
  },
68
76
  {
69
77
  label: "整改数",
78
+ unit: "个",
70
79
  data: [
71
80
  { label: "01月", value: 25 },
72
81
  { label: "02月", value: 19 },
@@ -89,10 +98,6 @@ export default {
89
98
  type: Array,
90
99
  default: () => { return []; }
91
100
  },
92
- selectedNew: {
93
- type: Object,
94
- default: null
95
- },
96
101
  energyType: {
97
102
  type: [String, Array],
98
103
  default: ""
@@ -138,9 +143,19 @@ export default {
138
143
  methods: {
139
144
  initChart() {
140
145
  const _self = this;
141
- // 数据处理
142
- const groupYAxis = (unit) => {
143
- return {
146
+
147
+ // chartData 中收集所有 unit,并保持首次出现顺序去重
148
+ const uniqueUnits = [];
149
+ (_self.chartData || []).forEach(item => {
150
+ const u = item.unit || "";
151
+ if (uniqueUnits.indexOf(u) === -1) {
152
+ uniqueUnits.push(u);
153
+ }
154
+ });
155
+
156
+ // 单个 yAxis 的生成函数
157
+ const groupYAxis = (unit, index) => {
158
+ const yAxis = {
144
159
  type: "value",
145
160
  name: unit,
146
161
  axisLine: {
@@ -167,7 +182,24 @@ export default {
167
182
  }
168
183
  }
169
184
  };
185
+ if (index > 0) {
186
+ yAxis.position = "right";
187
+ yAxis.splitLine = { show: false };
188
+ }
189
+ return yAxis;
170
190
  };
191
+
192
+ // 根据去重后的 unit 生成 yAxis
193
+ const yAxisList = uniqueUnits.length
194
+ ? uniqueUnits.map((unit, idx) => groupYAxis(unit, idx))
195
+ : [groupYAxis("", 0)];
196
+
197
+ // unit -> yAxisIndex 的映射,便于 series 绑定
198
+ const unitToYAxisIndex = {};
199
+ uniqueUnits.forEach((unit, idx) => {
200
+ unitToYAxisIndex[unit] = idx;
201
+ });
202
+
171
203
  const option = {
172
204
  legend: {
173
205
  right: 20,
@@ -176,10 +208,7 @@ export default {
176
208
  data: _self.chartData.map((item) => {
177
209
  return item.label;
178
210
  }),
179
- selectedMode: "multiple",
180
- selected: _self.selectedNew,
181
211
  textStyle: {
182
- fontSize: 12
183
212
  }
184
213
  },
185
214
  tooltip: {
@@ -197,12 +226,6 @@ export default {
197
226
  },
198
227
  xAxis: {
199
228
  type: "category",
200
- // splitLine: {
201
- // show: true,
202
- // lineStyle: {
203
- // type: "dashed"
204
- // }
205
- // },
206
229
  axisLabel: {
207
230
  rotate: this.config.rotate
208
231
  },
@@ -210,7 +233,7 @@ export default {
210
233
  return item.label;
211
234
  }) : []
212
235
  },
213
- yAxis: typeof _self.energyType == "string" ? groupYAxis(_self.energyType) : this.energyType.map(unit => groupYAxis(unit)),
236
+ yAxis: yAxisList,
214
237
  dataZoom: [
215
238
  {
216
239
  type: "inside",
@@ -219,33 +242,22 @@ export default {
219
242
  end: 100
220
243
  }
221
244
  ],
222
- series: this.getSeriesData()
245
+ series: this.getSeriesData(unitToYAxisIndex)
223
246
  };
224
247
  this.myChart = EchartsUtil.init(_self.$refs.multilinechart, this.theme, option, this.size);
225
248
  },
226
- getSeriesData() {
227
- // 创建 24小时 时间数据填充对象
249
+ getSeriesData(unitToYAxisIndex) {
228
250
  const _self = this;
229
251
 
230
252
  const _seriesData = [];
231
253
  _self.chartData.map((item, ind) => {
232
- // debugger;
233
- const _isNUll = item.data.some(it => !it.value || it.value == "--");
234
- const _itemNull = {
235
- type: "",
236
- name: item.label,
237
- connectNulls: true, // 断点连线,true-连接,false-不连接
238
- data: item.data.map(it => it.value),
239
- tooltip: {
240
- show: false
241
- }
242
- };
243
254
  const _item = {
244
255
  animation: true,
245
256
  name: item.label,
246
257
  type: item.type || "bar",
247
258
  avoidLabelOverlap: true,
248
- data: item.data.map(it => it.value)
259
+ data: item.data.map(it => it.value),
260
+ yAxisIndex: unitToYAxisIndex[item.unit || ""] != null ? unitToYAxisIndex[item.unit || ""] : 0
249
261
  };
250
262
  _seriesData.push(_item);
251
263
  });
@@ -33,10 +33,12 @@ export default {
33
33
  type: Boolean,
34
34
  default: true
35
35
  },
36
- chartMode: {
37
- type: String,
38
- default: "dark"
36
+ // 新增极简模式开关
37
+ simpleMode: {
38
+ type: Boolean,
39
+ default: false
39
40
  },
41
+ highlightKey: String,// 需要高亮的日期/标识
40
42
  roseType: {
41
43
  type: String,
42
44
  default: ""
@@ -83,7 +85,6 @@ export default {
83
85
  methods: {
84
86
  initChart() {
85
87
  const _self = this;
86
- console.log(this.chartMode);
87
88
  // 数据处理
88
89
  const option = {
89
90
  title: {
@@ -103,10 +104,7 @@ export default {
103
104
  legend: this.showLegend ? {
104
105
  top: "top",
105
106
  right: "20",
106
- type: "scroll",
107
- textStyle: {
108
- color: "#808080"
109
- }
107
+ type: "scroll"
110
108
  } : null,
111
109
  grid: {
112
110
  left: 30,
@@ -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,3 +1,5 @@
1
+
2
+ import variables from '../../../styles/variables-export.scss'
1
3
  export default {
2
4
  color: ["#0de7ff", "#a782ff", "#fcdd60", "#0de7ff", "#ffc5a1", "#6291ae", "#13ce66"],
3
5
  backgroundColor: "#000",
@@ -6,10 +8,10 @@ export default {
6
8
  },
7
9
  title: {
8
10
  textStyle: {
9
- color: "#333"
11
+ color: "#ffffff"
10
12
  },
11
13
  subtextStyle: {
12
- color: "#666666"
14
+ color: "#ffffff"
13
15
  }
14
16
  },
15
17
  line: {
@@ -27,20 +29,20 @@ export default {
27
29
  pie: {
28
30
  roseType: "radius",
29
31
  label: {
30
- color: "#333"
32
+ color: "#ffffff"
31
33
  }
32
34
  },
33
35
  radar: {
34
36
  indicator: {
35
- color: "#666666"
37
+ color: "#ffffff"
36
38
  }
37
39
  },
38
40
  map: {
39
41
  label: {
40
- color: "#333"
42
+ color: "#ffffff"
41
43
  },
42
44
  itemStyle: {
43
- borderColor: "#fff"
45
+ borderColor: variables.xtColorBorder
44
46
  }
45
47
  },
46
48
  gauge: {
@@ -52,7 +54,7 @@ export default {
52
54
  },
53
55
  toolbox: {
54
56
  iconStyle: {
55
- borderColor: "#666666"
57
+ borderColor: "#ffffff"
56
58
  }
57
59
  },
58
60
  axisLine: {
@@ -72,20 +74,20 @@ export default {
72
74
  },
73
75
  splitArea: {
74
76
  areaStyle: {
75
- color: ["#f7f8fa", "#ffffff"]
77
+ color: ["#666666", "#666666"]
76
78
  }
77
79
  },
78
80
  legend: {
79
81
  textStyle: {
80
- color: "#666"
82
+ color: "#ffffff"
81
83
  }
82
84
  },
83
85
  tooltip: {
84
- backgroundColor: "rgba(255, 255, 255, 0.95)",
85
- borderColor: "#DCDFE6",
86
+ backgroundColor: variables.xtColorBgOverlay,
87
+ borderColor: variables.xtColorBorder,
86
88
  borderWidth: 1,
87
89
  textStyle: {
88
- color: "#333"
90
+ color: "#fff"
89
91
  }
90
92
  }
91
93
  };
@@ -122,7 +122,7 @@ EchartsUtil.EchartsUtil = {
122
122
  EchartsUtil.chartInstanceList = [];
123
123
 
124
124
  EchartsUtil.mergeOptions = function(themeOption, customOption) {
125
- return Object.assign({}, this.baseOption, themeOption, customOption);
125
+ return Object.assign({}, themeOption, customOption);
126
126
  };
127
127
 
128
128
  // 根据字体大小调整主题配置
@@ -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';
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <button
3
- class="el-button xt-button"
3
+ class="xt-button"
4
4
  :class="[
5
5
  type ?'xt-button--' + type: '',
6
6
  size ? 'xt-button--' + size : '',
@@ -28,7 +28,7 @@ export default {
28
28
  size: {
29
29
  type: String,
30
30
  default: '',
31
- validator: (val) => ['', 'large', 'medium', 'small', 'mini'].includes(val)
31
+ validator: (val) => ['', 'large', 'medium', 'small'].includes(val)
32
32
  },
33
33
  plain: {
34
34
  type: Boolean,