mediacube-ui 0.1.344 → 0.1.345
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/patterns/McTable/McTable/McTable.vue +16 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.345](https://github.com/MediaCubeCo/mcui/compare/v0.1.344...v0.1.345) (2024-12-10)
|
|
6
|
+
|
|
5
7
|
### [0.1.344](https://github.com/MediaCubeCo/mcui/compare/v0.1.343...v0.1.344) (2024-12-09)
|
|
6
8
|
|
|
7
9
|
### [0.1.343](https://github.com/MediaCubeCo/mcui/compare/v0.1.342...v0.1.343) (2024-12-06)
|
package/package.json
CHANGED
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
import noTableDataIcon from '../../../assets/img/no_table_data.png'
|
|
57
57
|
import _throttle from 'lodash/throttle'
|
|
58
58
|
import _isEmpty from 'lodash/isEmpty'
|
|
59
|
+
import _isEqual from 'lodash/isEqual'
|
|
59
60
|
|
|
60
61
|
import McTitle from '../../../elements/McTitle/McTitle'
|
|
61
62
|
import McSvgIcon from '../../../elements/McSvgIcon/McSvgIcon'
|
|
@@ -340,7 +341,7 @@ export default {
|
|
|
340
341
|
},
|
|
341
342
|
wrapperStyles() {
|
|
342
343
|
return {
|
|
343
|
-
width:
|
|
344
|
+
width: 'auto',
|
|
344
345
|
height: this.$attrs.height ? this.getFixedHeight(this.$attrs.height) : 'auto',
|
|
345
346
|
'max-height': this.$attrs['max-height'] ? this.getFixedHeight(this.$attrs['max-height']) : 'none',
|
|
346
347
|
}
|
|
@@ -388,9 +389,14 @@ export default {
|
|
|
388
389
|
deep: true,
|
|
389
390
|
},
|
|
390
391
|
items: {
|
|
391
|
-
handler: async function(newVal) {
|
|
392
|
-
|
|
393
|
-
newVal
|
|
392
|
+
handler: async function(newVal, oldVal) {
|
|
393
|
+
if (_isEqual(newVal, oldVal)) return
|
|
394
|
+
if (newVal.length !== oldVal.length) {
|
|
395
|
+
newVal && (await this.loadData(true))
|
|
396
|
+
} else {
|
|
397
|
+
newVal && (await this.setFirstColsWidth())
|
|
398
|
+
await this.reloadData()
|
|
399
|
+
}
|
|
394
400
|
},
|
|
395
401
|
deep: true,
|
|
396
402
|
},
|
|
@@ -424,8 +430,8 @@ export default {
|
|
|
424
430
|
reloadData() {
|
|
425
431
|
this.$refs.xTable.reloadData(this.items)
|
|
426
432
|
},
|
|
427
|
-
updateData() {
|
|
428
|
-
this.$refs.xTable.updateData()
|
|
433
|
+
async updateData() {
|
|
434
|
+
await this.$refs.xTable.updateData()
|
|
429
435
|
},
|
|
430
436
|
checkOccupancy() {
|
|
431
437
|
if (!this.$refs.xTable || !this.items?.length) return
|
|
@@ -513,29 +519,14 @@ export default {
|
|
|
513
519
|
toggleColumns(val) {
|
|
514
520
|
if (val) {
|
|
515
521
|
const columns = this.$refs.xTable.getColumns()
|
|
516
|
-
|
|
517
|
-
const hideColumns = columns.filter((col, i) => {
|
|
518
|
-
const isFixedCol = col.fixed === 'left'
|
|
519
|
-
/**
|
|
520
|
-
* Скрываем все столбцы кроме фиксированного и его соседа, чтобы не было рассинхрона при выходе из карточки
|
|
521
|
-
* т.к. когда остается 1 столбец, то фикс - размаунтится, а потом при выходе из карточки перерендеривается
|
|
522
|
-
* и скроллит в самый верх
|
|
523
|
-
* */
|
|
524
|
-
if (isFixedCol) fixedColNeigbhorIndex = i + 1
|
|
525
|
-
switch (true) {
|
|
526
|
-
case i === fixedColNeigbhorIndex:
|
|
527
|
-
return
|
|
528
|
-
default:
|
|
529
|
-
return !isFixedCol
|
|
530
|
-
}
|
|
531
|
-
})
|
|
522
|
+
const hideColumns = columns.filter(col => col.fixed !== 'left')
|
|
532
523
|
hideColumns.forEach(col => (col.visible = false))
|
|
533
524
|
this.$refs.xTable.refreshColumn()
|
|
534
525
|
} else {
|
|
535
526
|
this.$refs.xTable.resetColumn()
|
|
536
527
|
}
|
|
537
|
-
|
|
538
|
-
|
|
528
|
+
this.$refs.xTable.recalculate()
|
|
529
|
+
this.$refs.xTable.syncData() // Синхронит данные таблиц (фикс колонка === отдельная таблица)
|
|
539
530
|
this.checkHorizontalScroll()
|
|
540
531
|
},
|
|
541
532
|
getFixedHeight(val) {
|
|
@@ -693,6 +684,7 @@ export default {
|
|
|
693
684
|
.vxe-table--body-wrapper,
|
|
694
685
|
.vxe-table--footer-wrapper {
|
|
695
686
|
overflow-x: hidden;
|
|
687
|
+
width: fit-content;
|
|
696
688
|
}
|
|
697
689
|
.vxe-table--footer {
|
|
698
690
|
display: none;
|