xt-element-ui 1.1.3 → 1.1.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/lib/css/2.9f53fb10.css +1 -0
- package/lib/css/3.f955b130.css +1 -0
- package/lib/css/4.04feac2c.css +1 -0
- package/lib/css/5.6a8558e0.css +1 -0
- package/lib/css/6.e474b334.css +1 -0
- package/lib/index.common.0.js +16448 -15696
- package/lib/index.common.2.js +298 -270
- package/lib/index.common.3.js +82 -54
- package/lib/index.common.4.js +519 -489
- package/lib/index.common.5.js +74 -46
- package/lib/index.common.6.js +76 -48
- package/lib/index.common.js +1741 -316
- package/lib/index.css +1 -1
- package/lib/index.umd.0.js +16448 -15696
- package/lib/index.umd.2.js +298 -270
- package/lib/index.umd.3.js +82 -54
- package/lib/index.umd.4.js +519 -489
- package/lib/index.umd.5.js +74 -46
- package/lib/index.umd.6.js +76 -48
- package/lib/index.umd.js +1747 -321
- package/lib/index.umd.min.0.js +3 -3
- package/lib/index.umd.min.2.js +1 -1
- package/lib/index.umd.min.3.js +1 -1
- package/lib/index.umd.min.4.js +1 -1
- package/lib/index.umd.min.5.js +1 -1
- package/lib/index.umd.min.6.js +1 -1
- package/lib/index.umd.min.js +1 -1
- package/package.json +2 -1
- package/src/components/ex-button/index.js +2 -0
- package/src/components/ex-button/index.vue +61 -0
- package/src/components/ex-button/style/index.scss +31 -0
- package/src/components/ex-card/index.js +7 -0
- package/src/components/ex-card/index.vue +150 -0
- package/src/components/ex-card/style/index.scss +69 -0
- package/src/components/{chart → ex-chart}/ExBar.vue +3 -0
- package/src/components/{chart → ex-chart}/ExLine.vue +3 -0
- package/src/components/{chart → ex-chart}/ExMulti.vue +5 -0
- package/src/components/{chart → ex-chart}/ExPie.vue +3 -0
- package/src/components/{chart → ex-chart}/ExTrend.vue +3 -0
- package/src/components/ex-chart/index.js +2 -0
- package/src/components/ex-chart/index.vue +134 -0
- package/src/components/{chart → ex-chart}/theme/dark.js +1 -1
- package/src/components/{chart → ex-chart}/utils.js +40 -12
- package/src/components/{table → ex-table}/index.vue +62 -116
- package/src/components/index.scss +16 -7
- package/src/components/{button → xt-button}/index.vue +1 -1
- package/src/components/{card-item → xt-card-item}/index.vue +1 -1
- package/src/components/{config-provider → xt-config-provider}/index.vue +66 -0
- package/src/components/{date-picker → xt-date-picker}/index.vue +1 -1
- package/src/components/{date-picker → xt-date-picker}/quarter.vue +4 -2
- package/src/components/xt-grid-box/index.vue +135 -0
- package/src/components/xt-grid-box/style/index.scss +93 -0
- package/src/components/xt-grid-item/index.js +2 -0
- package/src/components/xt-grid-item/index.vue +107 -0
- package/src/components/{text → xt-text}/index.vue +6 -0
- package/src/components/{text → xt-text}/style/index.scss +26 -1
- package/src/config/element-registry.js +136 -0
- package/src/index.js +62 -32
- package/src/styles/theme/colors.scss +1 -0
- package/src/styles/theme/font.scss +6 -3
- package/lib/css/2.3f7aa432.css +0 -1
- package/lib/css/3.ffcc175d.css +0 -1
- package/lib/css/4.9abd1f2b.css +0 -1
- package/lib/css/5.1a31ed8a.css +0 -1
- package/lib/css/6.c2d0d77e.css +0 -1
- package/src/components/chart/index.js +0 -2
- package/src/components/chart/index.vue +0 -51
- package/src/components/grid-box/index.vue +0 -42
- /package/src/components/{chart → ex-chart}/pieList.vue +0 -0
- /package/src/components/{chart → ex-chart}/theme/blue.js +0 -0
- /package/src/components/{chart → ex-chart}/theme/orange.js +0 -0
- /package/src/components/{chart → ex-chart}/theme/starry.js +0 -0
- /package/src/components/{chart → ex-chart}/theme/white.js +0 -0
- /package/src/components/{table → ex-table}/ExCell.vue +0 -0
- /package/src/components/{table → ex-table}/ExColumn.vue +0 -0
- /package/src/components/{table → ex-table}/index.js +0 -0
- /package/src/components/{table → ex-table}/processor.js +0 -0
- /package/src/components/{button → xt-button}/index.js +0 -0
- /package/src/components/{button → xt-button}/style/index.scss +0 -0
- /package/src/components/{card → xt-card}/index.js +0 -0
- /package/src/components/{card → xt-card}/index.vue +0 -0
- /package/src/components/{card → xt-card}/style/index.scss +0 -0
- /package/src/components/{card-item → xt-card-item}/index.js +0 -0
- /package/src/components/{card-item → xt-card-item}/style/index.scss +0 -0
- /package/src/components/{config-provider → xt-config-provider}/index.js +0 -0
- /package/src/components/{config-provider → xt-config-provider}/style/index.scss +0 -0
- /package/src/components/{date-picker → xt-date-picker}/SearchDate.vue +0 -0
- /package/src/components/{date-picker → xt-date-picker}/index.js +0 -0
- /package/src/components/{flex-box → xt-flex-box}/index.js +0 -0
- /package/src/components/{flex-box → xt-flex-box}/index.vue +0 -0
- /package/src/components/{flex-box → xt-flex-box}/style/index.scss +0 -0
- /package/src/components/{grid-box → xt-grid-box}/index.js +0 -0
- /package/src/components/{input → xt-input}/index.js +0 -0
- /package/src/components/{input → xt-input}/index.vue +0 -0
- /package/src/components/{input → xt-input}/style/index.scss +0 -0
- /package/src/components/{layout → xt-layout}/BaseCollapse.vue +0 -0
- /package/src/components/{layout → xt-layout}/ExFieldset.vue +0 -0
- /package/src/components/{page → xt-page}/index.js +0 -0
- /package/src/components/{page → xt-page}/index.vue +0 -0
- /package/src/components/{select-tree → xt-select-tree}/index.js +0 -0
- /package/src/components/{select-tree → xt-select-tree}/index.vue +0 -0
- /package/src/components/{text → xt-text}/index.js +0 -0
- /package/src/components/{upload → xt-upload}/index.js +0 -0
- /package/src/components/{upload → xt-upload}/index.vue +0 -0
- /package/src/components/{upload → xt-upload}/preview.vue +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ExTable">
|
|
3
3
|
<slot name="title">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<el-button size="small" type="primary" plain v-if="toolExport" icon="el-icon-download" @click="exportTableData">导出</el-button>
|
|
7
|
-
</
|
|
4
|
+
<XtFlexBox content="between" style="padding: 0 10px;">
|
|
5
|
+
<ExText size="medium" style="padding: 10px" v-if="title">{{ title }}</ExText>
|
|
6
|
+
<el-button size="small" type="primary" plain v-if="typeof toolExport === 'function'" icon="el-icon-download" @click="exportTableData">导出</el-button>
|
|
7
|
+
</XtFlexBox>
|
|
8
8
|
</slot>
|
|
9
9
|
<el-table
|
|
10
10
|
ref="ExtendTable"
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
</template>
|
|
80
80
|
<template v-slot:empty>
|
|
81
81
|
<div style="text-align:center" v-show="hasLoadData&&!loading">
|
|
82
|
-
<img :src="emptyIcon" height="150px" />
|
|
83
82
|
<div class="empty-title">暂无数据</div>
|
|
84
83
|
<div class="empty-subtitle">{{emptSubTitle}}</div>
|
|
85
84
|
</div>
|
|
@@ -87,7 +86,7 @@
|
|
|
87
86
|
</el-table>
|
|
88
87
|
<div ref="toolBar" class="toolBar left">
|
|
89
88
|
<slot name="pagination">
|
|
90
|
-
<
|
|
89
|
+
<el-pagination v-if="pagination" :total="total" :page-sizes="pageSizes" :page-size="pagination.PageSize" :current-page="pagination.PageNum" @current-change="pageChange" @size-change="sizeChange"></el-pagination>
|
|
91
90
|
</slot>
|
|
92
91
|
</div>
|
|
93
92
|
</div>
|
|
@@ -95,15 +94,16 @@
|
|
|
95
94
|
<script>
|
|
96
95
|
import ExColumn from "./ExColumn";
|
|
97
96
|
import ExCell from "./ExCell";
|
|
98
|
-
import
|
|
99
|
-
import
|
|
97
|
+
import ExText from "../xt-text";
|
|
98
|
+
import XtFlexBox from "../xt-flex-box";
|
|
100
99
|
export default {
|
|
101
100
|
name: "ExTable",
|
|
102
101
|
components: {
|
|
103
102
|
ExCell,
|
|
104
|
-
ExColumn
|
|
103
|
+
ExColumn,
|
|
104
|
+
ExText,
|
|
105
|
+
XtFlexBox
|
|
105
106
|
},
|
|
106
|
-
mixins: [exportExcell],
|
|
107
107
|
inheritAttrs: false,
|
|
108
108
|
props: {
|
|
109
109
|
tbId: {
|
|
@@ -155,7 +155,6 @@ export default {
|
|
|
155
155
|
return [];
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
|
-
// 自定义 插入列
|
|
159
158
|
insertColumns: {
|
|
160
159
|
type: Array,
|
|
161
160
|
default() {
|
|
@@ -208,23 +207,17 @@ export default {
|
|
|
208
207
|
spanFields: {
|
|
209
208
|
type: Object
|
|
210
209
|
},
|
|
211
|
-
groupColumns: {
|
|
210
|
+
groupColumns: {
|
|
212
211
|
type: Array,
|
|
213
212
|
default() {
|
|
214
213
|
return [];
|
|
215
214
|
}
|
|
216
215
|
},
|
|
217
|
-
emptyIcon: {
|
|
218
|
-
type: String,
|
|
219
|
-
default: () => {
|
|
220
|
-
return require("@/assets/images/common/noData.png");
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
216
|
title: {},
|
|
224
217
|
emptSubTitle: {},
|
|
225
218
|
toolExport: {
|
|
226
|
-
type:
|
|
227
|
-
default:
|
|
219
|
+
type: Function,
|
|
220
|
+
default: null
|
|
228
221
|
}
|
|
229
222
|
},
|
|
230
223
|
data() {
|
|
@@ -232,9 +225,9 @@ export default {
|
|
|
232
225
|
startIndex: 0,
|
|
233
226
|
inTableHeight: 0,
|
|
234
227
|
dropvisible: false,
|
|
235
|
-
hasLoad:
|
|
228
|
+
hasLoad: true,
|
|
236
229
|
hasLoadData: false,
|
|
237
|
-
diyColumns: this.columns || [],
|
|
230
|
+
diyColumns: this.columns || [],
|
|
238
231
|
checkedColumns: [],
|
|
239
232
|
tableColumns: []
|
|
240
233
|
};
|
|
@@ -299,7 +292,6 @@ export default {
|
|
|
299
292
|
},
|
|
300
293
|
mounted() {
|
|
301
294
|
this.$nextTick(() => {
|
|
302
|
-
// 表格高度自适应浏览器大小
|
|
303
295
|
this.changeTableHight();
|
|
304
296
|
if (!this.height) {
|
|
305
297
|
window.onresize = () => {
|
|
@@ -336,41 +328,8 @@ export default {
|
|
|
336
328
|
const _columns = [];
|
|
337
329
|
return new Promise((resolve, reject) => {
|
|
338
330
|
if (!this.hasLoad && this.tbId) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}).then((res) => {
|
|
342
|
-
const { code, data } = res;
|
|
343
|
-
if (code === 200 && data.Result) {
|
|
344
|
-
const _resColumns = JSON.parse(data.Data);
|
|
345
|
-
// 解决 slotName问题 接口数据根据DATAFIELD 匹配 slotName
|
|
346
|
-
this.columns.map((item, ind) => {
|
|
347
|
-
const _fItem = _resColumns.find(it => item.prop == it.DATAFIELD);
|
|
348
|
-
if (_fItem && item.prop) {
|
|
349
|
-
_columns.push({
|
|
350
|
-
...item,
|
|
351
|
-
label: _fItem.HEADERTEXT,
|
|
352
|
-
show: _fItem.ISSHOW || false,
|
|
353
|
-
OrderNum: _fItem.ORDERNUM || ind
|
|
354
|
-
});
|
|
355
|
-
} else if (item.label == "操作") {
|
|
356
|
-
_columns.push(item);
|
|
357
|
-
} else {
|
|
358
|
-
return item;
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
resolve(_columns.sort((pre, aft) => {
|
|
362
|
-
return pre.OrderNum - aft.OrderNum;
|
|
363
|
-
}));
|
|
364
|
-
} else {
|
|
365
|
-
resolve(this.columns);
|
|
366
|
-
this.$emit("update:showColumsFilter", false);
|
|
367
|
-
}
|
|
368
|
-
this.hasLoad = true;
|
|
369
|
-
}).catch(() => {
|
|
370
|
-
this.hasLoad = true;
|
|
371
|
-
resolve(this.columns);
|
|
372
|
-
this.$emit("update:showColumsFilter", false);
|
|
373
|
-
});
|
|
331
|
+
resolve(this.columns);
|
|
332
|
+
this.$emit("update:showColumsFilter", false);
|
|
374
333
|
} else {
|
|
375
334
|
resolve(this.columns);
|
|
376
335
|
this.$emit("update:showColumsFilter", false);
|
|
@@ -394,7 +353,7 @@ export default {
|
|
|
394
353
|
},
|
|
395
354
|
handleToggle(show, item) {
|
|
396
355
|
if (this.checkedColumns.length === 0) {
|
|
397
|
-
this.$
|
|
356
|
+
this.$message.warning("至少选择一列显示!");
|
|
398
357
|
return;
|
|
399
358
|
}
|
|
400
359
|
this.$emit("update:loading", true);
|
|
@@ -402,29 +361,10 @@ export default {
|
|
|
402
361
|
this.tableColumns = this.diyColumns.filter(item => (item.show === undefined ? true : item.show));
|
|
403
362
|
this.checkedColumns = this.updateCheckColumns(this.tableColumns);
|
|
404
363
|
this.dropvisible = false;
|
|
405
|
-
// 设置定制列
|
|
406
364
|
this.changeTableHight();
|
|
407
365
|
this.$nextTick(() => {
|
|
408
366
|
this.doLayout();
|
|
409
367
|
});
|
|
410
|
-
if (this.tbId) {
|
|
411
|
-
const params = {
|
|
412
|
-
dataField: item.prop,
|
|
413
|
-
isShow: show ? 1 : 0,
|
|
414
|
-
gridviewTypeId: this.tbId
|
|
415
|
-
};
|
|
416
|
-
SaveIsShowInfo(params).then((res) => {
|
|
417
|
-
const { code } = res;
|
|
418
|
-
this.$emit("update:loading", false);
|
|
419
|
-
if (code !== 200) {
|
|
420
|
-
// 取消勾选处理
|
|
421
|
-
} else {
|
|
422
|
-
this.$Message.MessageSuccess("设置成功");
|
|
423
|
-
}
|
|
424
|
-
}).catch(() => {
|
|
425
|
-
this.$emit("update:loading", false);
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
368
|
},
|
|
429
369
|
doLayout() {
|
|
430
370
|
this.$refs.ExtendTable && this.$refs.ExtendTable.doLayout();
|
|
@@ -481,7 +421,6 @@ export default {
|
|
|
481
421
|
|
|
482
422
|
if (rowCount === 0) return spans;
|
|
483
423
|
|
|
484
|
-
// 初始化数组
|
|
485
424
|
for (let i = 0; i < rowCount; i++) {
|
|
486
425
|
spans[i] = [];
|
|
487
426
|
for (let j = 0; j < this.groupColumns.length; j++) {
|
|
@@ -489,8 +428,6 @@ export default {
|
|
|
489
428
|
}
|
|
490
429
|
}
|
|
491
430
|
|
|
492
|
-
// 分级计算合并
|
|
493
|
-
|
|
494
431
|
for (let level = 0; level < this.groupColumns.length; level++) {
|
|
495
432
|
let pos = 0;
|
|
496
433
|
while (pos < rowCount) {
|
|
@@ -499,8 +436,6 @@ export default {
|
|
|
499
436
|
let endPos = startPos;
|
|
500
437
|
const currentValue = this.tableData[startPos][this.groupColumns[level].prop];
|
|
501
438
|
|
|
502
|
-
// 检查上级是否相同
|
|
503
|
-
|
|
504
439
|
let sameParent = true;
|
|
505
440
|
|
|
506
441
|
for (let parentLevel = 0; parentLevel < level; parentLevel++) {
|
|
@@ -571,7 +506,6 @@ export default {
|
|
|
571
506
|
try {
|
|
572
507
|
if (!this.autoSetHeight) return;
|
|
573
508
|
if (this.height) {
|
|
574
|
-
// 如果有传进来高度就取消自适应
|
|
575
509
|
this.inTableHeight = (this.height - 1 - (this.title ? 40 : 0));
|
|
576
510
|
this.$nextTick(() => {
|
|
577
511
|
this.doLayout();
|
|
@@ -579,12 +513,10 @@ export default {
|
|
|
579
513
|
return;
|
|
580
514
|
}
|
|
581
515
|
let tableHeight = window.innerHeight || document.body.clientHeight;
|
|
582
|
-
// 高度设置
|
|
583
516
|
const disTop = this.$refs.ExtendTable.$el;
|
|
584
517
|
tableHeight -= (disTop.getBoundingClientRect().top + 20 + 1);
|
|
585
518
|
tableHeight -= this.$refs.toolBar.offsetHeight;
|
|
586
519
|
this.inTableHeight = tableHeight;
|
|
587
|
-
// 重绘表格
|
|
588
520
|
this.doLayout();
|
|
589
521
|
} catch (err) {
|
|
590
522
|
console.log(err);
|
|
@@ -595,15 +527,11 @@ export default {
|
|
|
595
527
|
if (!options.align) {
|
|
596
528
|
options.align = "center";
|
|
597
529
|
}
|
|
598
|
-
// if (!options.resizable) {
|
|
599
|
-
// options.resizable = true;
|
|
600
|
-
// }
|
|
601
530
|
if (options.showTip) {
|
|
602
531
|
options.showOverflowTooltip = true;
|
|
603
532
|
}
|
|
604
533
|
return { ...options };
|
|
605
534
|
},
|
|
606
|
-
// 排序
|
|
607
535
|
changeTableSort(column) {
|
|
608
536
|
const sortingType = column.order;
|
|
609
537
|
const sidx = sortingType ? column.prop : "";
|
|
@@ -653,13 +581,15 @@ export default {
|
|
|
653
581
|
},
|
|
654
582
|
exportTableData() {
|
|
655
583
|
const title = this.title;
|
|
656
|
-
const list = [];
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
584
|
+
const list = [...this.tableData];
|
|
585
|
+
|
|
586
|
+
if (typeof this.toolExport === 'function') {
|
|
587
|
+
try {
|
|
588
|
+
this.toolExport(list, title, this.columns);
|
|
589
|
+
} catch (error) {
|
|
590
|
+
console.error('Export hook error:', error);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
663
593
|
}
|
|
664
594
|
}
|
|
665
595
|
};
|
|
@@ -679,10 +609,9 @@ export default {
|
|
|
679
609
|
&.right{
|
|
680
610
|
justify-content: flex-end;
|
|
681
611
|
}
|
|
682
|
-
|
|
612
|
+
::v-deep .pagination {
|
|
683
613
|
padding: 15px 10px;
|
|
684
614
|
width: 100%;
|
|
685
|
-
// background-color: #ffffff;
|
|
686
615
|
}
|
|
687
616
|
}
|
|
688
617
|
.drop-body{
|
|
@@ -703,29 +632,46 @@ export default {
|
|
|
703
632
|
color: #999999;
|
|
704
633
|
}
|
|
705
634
|
}
|
|
706
|
-
|
|
707
|
-
color: $color;
|
|
708
|
-
&.effect-light{
|
|
709
|
-
background-color: rgba($color: $color, $alpha: .2);
|
|
710
|
-
}
|
|
711
|
-
&.effect-dark{
|
|
712
|
-
color: #ffffff;
|
|
713
|
-
background-color: $color;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
/deep/.el-table__cell,/deep/.el-table__row{
|
|
635
|
+
::v-deep .el-table__cell, ::v-deep .el-table__row{
|
|
718
636
|
&.warn{
|
|
719
|
-
|
|
637
|
+
color: #E6A23C;
|
|
638
|
+
&.effect-light{
|
|
639
|
+
background-color: rgba(230, 162, 60, .2);
|
|
640
|
+
}
|
|
641
|
+
&.effect-dark{
|
|
642
|
+
color: #ffffff;
|
|
643
|
+
background-color: #E6A23C;
|
|
644
|
+
}
|
|
720
645
|
}
|
|
721
646
|
&.error{
|
|
722
|
-
|
|
647
|
+
color: #F56C6C;
|
|
648
|
+
&.effect-light{
|
|
649
|
+
background-color: rgba(245, 108, 108, .2);
|
|
650
|
+
}
|
|
651
|
+
&.effect-dark{
|
|
652
|
+
color: #ffffff;
|
|
653
|
+
background-color: #F56C6C;
|
|
654
|
+
}
|
|
723
655
|
}
|
|
724
656
|
&.info{
|
|
725
|
-
|
|
657
|
+
color: #409EFF;
|
|
658
|
+
&.effect-light{
|
|
659
|
+
background-color: rgba(64, 158, 255, .2);
|
|
660
|
+
}
|
|
661
|
+
&.effect-dark{
|
|
662
|
+
color: #ffffff;
|
|
663
|
+
background-color: #409EFF;
|
|
664
|
+
}
|
|
726
665
|
}
|
|
727
666
|
&.success{
|
|
728
|
-
|
|
667
|
+
color: #67C23A;
|
|
668
|
+
&.effect-light{
|
|
669
|
+
background-color: rgba(103, 194, 58, .2);
|
|
670
|
+
}
|
|
671
|
+
&.effect-dark{
|
|
672
|
+
color: #ffffff;
|
|
673
|
+
background-color: #67C23A;
|
|
674
|
+
}
|
|
729
675
|
}
|
|
730
676
|
}
|
|
731
|
-
</style>
|
|
677
|
+
</style>
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
// 组件样式统一入口文件
|
|
2
2
|
|
|
3
3
|
// Button 组件样式
|
|
4
|
-
@import './button/style/index.scss';
|
|
4
|
+
@import './xt-button/style/index.scss';
|
|
5
5
|
|
|
6
6
|
// Card 组件样式
|
|
7
|
-
@import './card/style/index.scss';
|
|
7
|
+
@import './xt-card/style/index.scss';
|
|
8
8
|
|
|
9
9
|
// CardItem 组件样式
|
|
10
|
-
@import './card-item/style/index.scss';
|
|
10
|
+
@import './xt-card-item/style/index.scss';
|
|
11
11
|
|
|
12
12
|
// Input 组件样式
|
|
13
|
-
@import './input/style/index.scss';
|
|
13
|
+
@import './xt-input/style/index.scss';
|
|
14
14
|
|
|
15
15
|
// FlexBox 组件样式
|
|
16
|
-
@import './flex-box/style/index.scss';
|
|
16
|
+
@import './xt-flex-box/style/index.scss';
|
|
17
17
|
|
|
18
18
|
// ConfigProvider 组件样式
|
|
19
|
-
@import './config-provider/style/index.scss';
|
|
19
|
+
@import './xt-config-provider/style/index.scss';
|
|
20
20
|
|
|
21
21
|
// Text 组件样式
|
|
22
|
-
@import './text/style/index.scss';
|
|
22
|
+
@import './xt-text/style/index.scss';
|
|
23
|
+
|
|
24
|
+
// ExButton 组件样式
|
|
25
|
+
@import './ex-button/style/index.scss';
|
|
26
|
+
|
|
27
|
+
// ExCard 组件样式
|
|
28
|
+
@import './ex-card/style/index.scss';
|
|
29
|
+
|
|
30
|
+
// GridBox 组件样式
|
|
31
|
+
@import './xt-grid-box/style/index.scss';
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
type: {
|
|
24
24
|
type: String,
|
|
25
25
|
default: '',
|
|
26
|
-
validator: (val) => ['primary', 'success', 'warning', 'danger'].includes(val)
|
|
26
|
+
validator: (val) => ['', 'primary', 'success', 'warning', 'danger'].includes(val)
|
|
27
27
|
},
|
|
28
28
|
size: {
|
|
29
29
|
type: String,
|
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
export default {
|
|
3
3
|
name: 'XtConfigProvider',
|
|
4
4
|
inheritAttrs: false,
|
|
5
|
+
provide() {
|
|
6
|
+
return {
|
|
7
|
+
xtConfig: {
|
|
8
|
+
theme: this.theme,
|
|
9
|
+
size: this.size,
|
|
10
|
+
primaryColor: this.primaryColor
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
watch: {
|
|
15
|
+
theme(newVal) {
|
|
16
|
+
this.$provide('xtConfig', {
|
|
17
|
+
theme: newVal,
|
|
18
|
+
size: this.size,
|
|
19
|
+
primaryColor: this.primaryColor
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
size(newVal) {
|
|
23
|
+
this.$provide('xtConfig', {
|
|
24
|
+
theme: this.theme,
|
|
25
|
+
size: newVal,
|
|
26
|
+
primaryColor: this.primaryColor
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
primaryColor(newVal) {
|
|
30
|
+
this.$provide('xtConfig', {
|
|
31
|
+
theme: this.theme,
|
|
32
|
+
size: this.size,
|
|
33
|
+
primaryColor: newVal
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
},
|
|
5
37
|
render(h) {
|
|
6
38
|
// Vue 2 不支持 Fragment,当 tag="template" 时需要特殊处理
|
|
7
39
|
// 如果设置了 proxyElement,则不渲染包裹元素,只渲染 slot 内容
|
|
@@ -77,6 +109,16 @@ export default {
|
|
|
77
109
|
type: [HTMLElement, String, Object],
|
|
78
110
|
default: null,
|
|
79
111
|
description: '代理元素,将样式应用到该元素上。支持 HTMLElement、CSS选择器字符串或 ref 对象'
|
|
112
|
+
},
|
|
113
|
+
onThemeChange: {
|
|
114
|
+
type: Function,
|
|
115
|
+
default: null,
|
|
116
|
+
description: '主题改变时的钩子函数,接收参数: { theme, size, primaryColor }'
|
|
117
|
+
},
|
|
118
|
+
onStyleApplied: {
|
|
119
|
+
type: Function,
|
|
120
|
+
default: null,
|
|
121
|
+
description: '样式应用完成时的钩子函数,接收参数: { element, style, theme }'
|
|
80
122
|
}
|
|
81
123
|
},
|
|
82
124
|
computed: {
|
|
@@ -257,13 +299,37 @@ export default {
|
|
|
257
299
|
if (!element) return
|
|
258
300
|
|
|
259
301
|
const style = this.mergedStyle
|
|
302
|
+
const prevTheme = element.getAttribute('data-theme')
|
|
260
303
|
|
|
304
|
+
// 应用样式到代理元素
|
|
261
305
|
for (const key in style) {
|
|
262
306
|
element.style.setProperty(key, style[key])
|
|
263
307
|
}
|
|
264
308
|
|
|
265
309
|
// 设置 data-theme 属性
|
|
266
310
|
element.setAttribute('data-theme', this.theme)
|
|
311
|
+
|
|
312
|
+
// 触发主题改变钩子(当主题实际发生变化时)
|
|
313
|
+
if (prevTheme !== this.theme && typeof this.onThemeChange === 'function') {
|
|
314
|
+
this.onThemeChange({
|
|
315
|
+
theme: this.theme,
|
|
316
|
+
size: this.size,
|
|
317
|
+
primaryColor: this.primaryColor,
|
|
318
|
+
prevTheme: prevTheme
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 触发样式应用完成钩子
|
|
323
|
+
if (typeof this.onStyleApplied === 'function') {
|
|
324
|
+
this.onStyleApplied({
|
|
325
|
+
element: element,
|
|
326
|
+
style: style,
|
|
327
|
+
theme: this.theme,
|
|
328
|
+
size: this.size,
|
|
329
|
+
primaryColor: this.primaryColor
|
|
330
|
+
})
|
|
331
|
+
}
|
|
332
|
+
|
|
267
333
|
},
|
|
268
334
|
|
|
269
335
|
clearProxyElementStyle() {
|
|
@@ -17,7 +17,7 @@ const typeFormatEnum = {
|
|
|
17
17
|
datetime: "yyyy-MM-dd HH:mm", month: "yyyy-MM", year: "yyyy", date: "yyyy-MM-dd", quarter: "yyyy-Qq", week: "yyyy-WW"
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
import FlexBox from '../flex-box/index.vue'
|
|
20
|
+
import FlexBox from '../xt-flex-box/index.vue'
|
|
21
21
|
import Quarter from "./quarter.vue";
|
|
22
22
|
export default {
|
|
23
23
|
name: "XtDatePicker",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<template>
|
|
2
4
|
<el-popover v-model="popoverVisible" trigger="click" :disabled="disabled" transition="el-zoom-in-top" :placement="placement" :width="popoverWidth" @hide="handleBlur">
|
|
3
5
|
<div class="quarter-wrapper">
|
|
4
6
|
<BaseFlexBox content="between">
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
</template>
|
|
16
18
|
|
|
17
19
|
<script>
|
|
18
|
-
import BaseFlexBox from "../flex-box/index.vue";
|
|
20
|
+
import BaseFlexBox from "../xt-flex-box/index.vue";
|
|
19
21
|
import dateFns from "date-fns";
|
|
20
22
|
export default {
|
|
21
23
|
name: "DateQuarter",
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="xt-grid-box" :style="styleAttrs">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: "XtGridBox",
|
|
10
|
+
props: {
|
|
11
|
+
// 列配置
|
|
12
|
+
columns: {
|
|
13
|
+
type: [String, Array, Number],
|
|
14
|
+
default: "1fr"
|
|
15
|
+
},
|
|
16
|
+
// 行配置
|
|
17
|
+
rows: {
|
|
18
|
+
type: [String, Array],
|
|
19
|
+
default: "auto"
|
|
20
|
+
},
|
|
21
|
+
// 间距(同时控制行列间距)
|
|
22
|
+
gap: { type: String, default: "" },
|
|
23
|
+
// 行间距
|
|
24
|
+
rowGap: { type: String, default: "" },
|
|
25
|
+
// 列间距
|
|
26
|
+
colGap: { type: String, default: "" },
|
|
27
|
+
// 排列方向
|
|
28
|
+
flow: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "row",
|
|
31
|
+
validator: (val) => ['row', 'column', 'row dense', 'column dense'].includes(val)
|
|
32
|
+
},
|
|
33
|
+
// 命名区域
|
|
34
|
+
areas: { type: [String, Array], default: "" },
|
|
35
|
+
// 子项对齐(place-items)
|
|
36
|
+
align: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "stretch",
|
|
39
|
+
validator: (val) => ['start', 'end', 'center', 'stretch', 'baseline'].includes(val)
|
|
40
|
+
},
|
|
41
|
+
// 内容对齐(place-content)
|
|
42
|
+
justify: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "start",
|
|
45
|
+
validator: (val) => ['start', 'end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch'].includes(val)
|
|
46
|
+
},
|
|
47
|
+
// 响应式配置 { sm: 2, md: 3, lg: 4 }
|
|
48
|
+
responsive: { type: Object, default: () => ({}) },
|
|
49
|
+
// 是否自动填充
|
|
50
|
+
autoFlow: { type: String, default: "" }
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
styleAttrs() {
|
|
54
|
+
const styles = {
|
|
55
|
+
display: "grid"
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// 处理列配置
|
|
59
|
+
if (typeof this.columns === 'number') {
|
|
60
|
+
styles.gridTemplateColumns = `repeat(${this.columns}, 1fr)`;
|
|
61
|
+
} else if (Array.isArray(this.columns)) {
|
|
62
|
+
styles.gridTemplateColumns = this.columns.join(" ");
|
|
63
|
+
} else {
|
|
64
|
+
styles.gridTemplateColumns = this.columns;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 处理行配置
|
|
68
|
+
if (Array.isArray(this.rows)) {
|
|
69
|
+
styles.gridTemplateRows = this.rows.join(" ");
|
|
70
|
+
} else {
|
|
71
|
+
styles.gridTemplateRows = this.rows;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 处理间距
|
|
75
|
+
if (this.gap) {
|
|
76
|
+
styles.gap = this.gap;
|
|
77
|
+
} else {
|
|
78
|
+
if (this.rowGap) styles.rowGap = this.rowGap;
|
|
79
|
+
if (this.colGap) styles.columnGap = this.colGap;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 处理排列方向
|
|
83
|
+
if (this.flow) {
|
|
84
|
+
styles.gridAutoFlow = this.flow;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 处理命名区域
|
|
88
|
+
if (this.areas) {
|
|
89
|
+
if (Array.isArray(this.areas)) {
|
|
90
|
+
styles.gridTemplateAreas = this.areas.map(row => `"${row}"`).join(" ");
|
|
91
|
+
} else {
|
|
92
|
+
styles.gridTemplateAreas = this.areas;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 处理子项对齐
|
|
97
|
+
if (this.align) {
|
|
98
|
+
styles.placeItems = this.align;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 处理内容对齐
|
|
102
|
+
if (this.justify) {
|
|
103
|
+
styles.placeContent = this.justify;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 处理响应式断点
|
|
107
|
+
if (Object.keys(this.responsive).length > 0) {
|
|
108
|
+
this.addResponsiveStyles(styles);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return styles;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
methods: {
|
|
115
|
+
addResponsiveStyles(styles) {
|
|
116
|
+
// 响应式断点映射
|
|
117
|
+
const breakpoints = {
|
|
118
|
+
xs: '(max-width: 575px)',
|
|
119
|
+
sm: '(min-width: 576px)',
|
|
120
|
+
md: '(min-width: 768px)',
|
|
121
|
+
lg: '(min-width: 992px)',
|
|
122
|
+
xl: '(min-width: 1200px)'
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
Object.entries(this.responsive).forEach(([key, value]) => {
|
|
126
|
+
if (breakpoints[key]) {
|
|
127
|
+
const mediaQuery = `@media ${breakpoints[key]}`;
|
|
128
|
+
// 注意:内联样式不支持媒体查询,这里预留接口
|
|
129
|
+
// 实际响应式需要通过 CSS 类或其他方式实现
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
</script>
|