@weitutech/by-components 1.1.130 → 1.1.132
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/by-components.common.js +94 -36
- package/lib/by-components.umd.js +94 -36
- package/lib/by-components.umd.min.js +1 -1
- package/package.json +1 -1
|
@@ -60751,8 +60751,8 @@ var component = normalizeComponent(
|
|
|
60751
60751
|
)
|
|
60752
60752
|
|
|
60753
60753
|
/* harmony default export */ var pager = (component.exports);
|
|
60754
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=
|
|
60755
|
-
var
|
|
60754
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=22f2fb85
|
|
60755
|
+
var tablevue_type_template_id_22f2fb85_render = function render() {
|
|
60756
60756
|
var _vm = this,
|
|
60757
60757
|
_c = _vm._self._c;
|
|
60758
60758
|
return _c('div', [_c('vxe-grid', _vm._g(_vm._b({
|
|
@@ -60826,7 +60826,7 @@ var tablevue_type_template_id_3aefd0b0_render = function render() {
|
|
|
60826
60826
|
}
|
|
60827
60827
|
}) : _vm._e()], 1);
|
|
60828
60828
|
};
|
|
60829
|
-
var
|
|
60829
|
+
var tablevue_type_template_id_22f2fb85_staticRenderFns = [];
|
|
60830
60830
|
|
|
60831
60831
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
60832
60832
|
var es_array_push = __webpack_require__(4114);
|
|
@@ -61899,7 +61899,7 @@ var custom_column_component = normalizeComponent(
|
|
|
61899
61899
|
handler() {
|
|
61900
61900
|
this.$nextTick(() => {
|
|
61901
61901
|
setTimeout(() => {
|
|
61902
|
-
var _this$gridOptions$pag;
|
|
61902
|
+
var _this$gridOptions$pag, _this$gridOptions$sor;
|
|
61903
61903
|
if (this.$refs.xGrid && this.$refs.xGrid.refreshScroll) {
|
|
61904
61904
|
this.$refs.xGrid.refreshScroll(); // 刷新滚动布局
|
|
61905
61905
|
}
|
|
@@ -61910,11 +61910,11 @@ var custom_column_component = normalizeComponent(
|
|
|
61910
61910
|
});
|
|
61911
61911
|
}
|
|
61912
61912
|
|
|
61913
|
-
//
|
|
61914
|
-
if ((_this$gridOptions$pag = this.gridOptions.pagerConfig) !== null && _this$gridOptions$pag !== void 0 && _this$gridOptions$pag.frontendPagination) {
|
|
61913
|
+
// 前端分页或前端排序模式下,数据变化时确保默认排序高亮
|
|
61914
|
+
if ((_this$gridOptions$pag = this.gridOptions.pagerConfig) !== null && _this$gridOptions$pag !== void 0 && _this$gridOptions$pag.frontendPagination || (_this$gridOptions$sor = this.gridOptions.sortConfig) !== null && _this$gridOptions$sor !== void 0 && _this$gridOptions$sor.frontendSort) {
|
|
61915
61915
|
this.ensureDefaultSortHighlight();
|
|
61916
61916
|
} else {
|
|
61917
|
-
//
|
|
61917
|
+
// 后端模式,恢复之前的排序高亮
|
|
61918
61918
|
if (this.sortState.field && this.sortState.order && this.$refs.xGrid) {
|
|
61919
61919
|
setTimeout(() => {
|
|
61920
61920
|
this.$refs.xGrid.sort(this.sortState.field, this.sortState.order, {
|
|
@@ -61931,7 +61931,7 @@ var custom_column_component = normalizeComponent(
|
|
|
61931
61931
|
},
|
|
61932
61932
|
computed: {
|
|
61933
61933
|
options() {
|
|
61934
|
-
var _others$pagerConfig, _others$sortConfig, _others$pagerConfig2, _others$pagerConfig3, _others$
|
|
61934
|
+
var _others$pagerConfig, _others$sortConfig, _others$pagerConfig2, _others$sortConfig2, _others$pagerConfig3, _others$sortConfig3, _sortConfig$remote;
|
|
61935
61935
|
const {
|
|
61936
61936
|
customColumnConfig,
|
|
61937
61937
|
columns,
|
|
@@ -61950,15 +61950,18 @@ var custom_column_component = normalizeComponent(
|
|
|
61950
61950
|
newColumns = this.removeFixedColumns(newColumns);
|
|
61951
61951
|
}
|
|
61952
61952
|
|
|
61953
|
-
//
|
|
61953
|
+
// 处理前端分页和虚拟滚动
|
|
61954
61954
|
let data = others.data || [];
|
|
61955
61955
|
if ((_others$pagerConfig = others.pagerConfig) !== null && _others$pagerConfig !== void 0 && _others$pagerConfig.frontendPagination || (_others$sortConfig = others.sortConfig) !== null && _others$sortConfig !== void 0 && _others$sortConfig.frontendSort) {
|
|
61956
61956
|
// 保存完整数据
|
|
61957
61957
|
this.allData = [...data];
|
|
61958
61958
|
}
|
|
61959
61959
|
if ((_others$pagerConfig2 = others.pagerConfig) !== null && _others$pagerConfig2 !== void 0 && _others$pagerConfig2.frontendPagination) {
|
|
61960
|
-
//
|
|
61960
|
+
// 前端分页:截取当前页数据
|
|
61961
61961
|
data = this.spliteListData(this.allData, others.pagerConfig.currentPage, others.pagerConfig.pageSize);
|
|
61962
|
+
} else if ((_others$sortConfig2 = others.sortConfig) !== null && _others$sortConfig2 !== void 0 && _others$sortConfig2.frontendSort) {
|
|
61963
|
+
// 虚拟滚动:处理置顶行和默认排序
|
|
61964
|
+
data = this.spliteListData(this.allData, null, null);
|
|
61962
61965
|
}
|
|
61963
61966
|
|
|
61964
61967
|
// 移除 others 中的 data,避免覆盖
|
|
@@ -62010,9 +62013,12 @@ var custom_column_component = normalizeComponent(
|
|
|
62010
62013
|
},
|
|
62011
62014
|
sortConfig: {
|
|
62012
62015
|
...sortConfig,
|
|
62013
|
-
//
|
|
62014
|
-
//
|
|
62015
|
-
|
|
62016
|
+
// 🔧 排序模式配置:
|
|
62017
|
+
// - 前端分页:remote: true(数据已在 spliteListData 中排序)
|
|
62018
|
+
// - 虚拟滚动 + 前端排序:remote: true(手动处理置顶行,类似前端分页)
|
|
62019
|
+
// - 后端排序:remote: 外部配置或 false
|
|
62020
|
+
remote: (_others$pagerConfig3 = others.pagerConfig) !== null && _others$pagerConfig3 !== void 0 && _others$pagerConfig3.frontendPagination || (_others$sortConfig3 = others.sortConfig) !== null && _others$sortConfig3 !== void 0 && _others$sortConfig3.frontendSort ? true // 前端分页或虚拟滚动:都使用 remote: true,手动处理排序(支持置顶行)
|
|
62021
|
+
: (_sortConfig$remote = sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.remote) !== null && _sortConfig$remote !== void 0 ? _sortConfig$remote : false,
|
|
62016
62022
|
trigger: 'cell',
|
|
62017
62023
|
...this.gridOptions.sortConfig
|
|
62018
62024
|
},
|
|
@@ -62357,19 +62363,24 @@ var custom_column_component = normalizeComponent(
|
|
|
62357
62363
|
* @param event
|
|
62358
62364
|
*/
|
|
62359
62365
|
handleSortChange(event) {
|
|
62360
|
-
var _this$gridOptions$pag3, _this$gridOptions$
|
|
62366
|
+
var _this$gridOptions$pag3, _this$gridOptions$sor2;
|
|
62361
62367
|
const {
|
|
62362
62368
|
property,
|
|
62363
62369
|
order
|
|
62364
62370
|
} = event;
|
|
62365
|
-
const shouldHandleSort = ((_this$gridOptions$pag3 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag3 === void 0 ? void 0 : _this$gridOptions$pag3.frontendPagination) || ((_this$gridOptions$sor = this.gridOptions.sortConfig) === null || _this$gridOptions$sor === void 0 ? void 0 : _this$gridOptions$sor.frontendSort);
|
|
62366
62371
|
|
|
62367
|
-
//
|
|
62372
|
+
// 🔧 区分前端分页和虚拟滚动:
|
|
62373
|
+
// - 前端分页(frontendPagination):手动排序 + 分页
|
|
62374
|
+
// - 虚拟滚动(frontendSort 但无 frontendPagination):手动排序 + 虚拟滚动(支持置顶行)
|
|
62375
|
+
const isFrontendPagination = (_this$gridOptions$pag3 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag3 === void 0 ? void 0 : _this$gridOptions$pag3.frontendPagination;
|
|
62376
|
+
const isVirtualScrollWithSort = ((_this$gridOptions$sor2 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor2 === void 0 ? void 0 : _this$gridOptions$sor2.frontendSort) && !isFrontendPagination;
|
|
62377
|
+
|
|
62378
|
+
// 无论哪种模式,都保存排序状态用于恢复箭头高亮
|
|
62368
62379
|
this.sortState.field = property;
|
|
62369
62380
|
this.sortState.order = order;
|
|
62370
|
-
if (
|
|
62371
|
-
|
|
62372
|
-
const newData = this.spliteListData(this.allData,
|
|
62381
|
+
if (isFrontendPagination) {
|
|
62382
|
+
// 前端分页模式:手动处理排序和分页
|
|
62383
|
+
const newData = this.spliteListData(this.allData, this.gridOptions.pagerConfig.currentPage, this.gridOptions.pagerConfig.pageSize);
|
|
62373
62384
|
if (this.$refs.xGrid) {
|
|
62374
62385
|
this.$refs.xGrid.reloadData(newData);
|
|
62375
62386
|
this.$nextTick(() => {
|
|
@@ -62382,8 +62393,7 @@ var custom_column_component = normalizeComponent(
|
|
|
62382
62393
|
}, 100);
|
|
62383
62394
|
}
|
|
62384
62395
|
setTimeout(() => {
|
|
62385
|
-
|
|
62386
|
-
if ((_this$gridOptions$pag6 = this.gridOptions.pagerConfig) !== null && _this$gridOptions$pag6 !== void 0 && _this$gridOptions$pag6.frontendPagination && this.$refs.xGrid) {
|
|
62396
|
+
if (this.$refs.xGrid) {
|
|
62387
62397
|
// 前端分页时,排序状态变化,回到第一页
|
|
62388
62398
|
const currentPage = this.gridOptions.pagerConfig.currentPage;
|
|
62389
62399
|
if (currentPage !== 1) {
|
|
@@ -62400,8 +62410,30 @@ var custom_column_component = normalizeComponent(
|
|
|
62400
62410
|
}, 0);
|
|
62401
62411
|
});
|
|
62402
62412
|
}
|
|
62413
|
+
} else if (isVirtualScrollWithSort) {
|
|
62414
|
+
// 虚拟滚动模式:手动处理排序(支持置顶行)
|
|
62415
|
+
const newData = this.spliteListData(this.allData, null, null);
|
|
62416
|
+
if (this.$refs.xGrid) {
|
|
62417
|
+
this.$refs.xGrid.reloadData(newData);
|
|
62418
|
+
this.$nextTick(() => {
|
|
62419
|
+
if (property && order) {
|
|
62420
|
+
setTimeout(() => {
|
|
62421
|
+
// 只高亮箭头,表格内部不排序(因为数据已经排序好)
|
|
62422
|
+
this.$refs.xGrid.sort(property, order, {
|
|
62423
|
+
silent: true
|
|
62424
|
+
});
|
|
62425
|
+
}, 100);
|
|
62426
|
+
}
|
|
62427
|
+
setTimeout(() => {
|
|
62428
|
+
if (this.$refs.xGrid) {
|
|
62429
|
+
// 排序后滚动到顶部
|
|
62430
|
+
this.$refs.xGrid.scrollTo(0, 0);
|
|
62431
|
+
}
|
|
62432
|
+
}, 0);
|
|
62433
|
+
});
|
|
62434
|
+
}
|
|
62403
62435
|
} else {
|
|
62404
|
-
//
|
|
62436
|
+
// 后端模式:确保排序箭头高亮
|
|
62405
62437
|
this.$nextTick(() => {
|
|
62406
62438
|
if (property && order && this.$refs.xGrid) {
|
|
62407
62439
|
setTimeout(() => {
|
|
@@ -62426,27 +62458,48 @@ var custom_column_component = normalizeComponent(
|
|
|
62426
62458
|
silent: true
|
|
62427
62459
|
});
|
|
62428
62460
|
}, 100);
|
|
62461
|
+
|
|
62462
|
+
// 🔧 修复:重置后自动应用默认排序(支持虚拟滚动和前端分页)
|
|
62463
|
+
this.$nextTick(() => {
|
|
62464
|
+
var _this$gridOptions$sor3;
|
|
62465
|
+
const defaultSort = (_this$gridOptions$sor3 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor3 === void 0 ? void 0 : _this$gridOptions$sor3.defaultSort;
|
|
62466
|
+
if (defaultSort && defaultSort.field && defaultSort.order) {
|
|
62467
|
+
this.sortState.field = defaultSort.field;
|
|
62468
|
+
this.sortState.order = defaultSort.order;
|
|
62469
|
+
setTimeout(() => {
|
|
62470
|
+
if (this.$refs.xGrid) {
|
|
62471
|
+
// 🔧 两种模式都使用手动排序(支持置顶行)
|
|
62472
|
+
this.$refs.xGrid.sort(defaultSort.field, defaultSort.order, {
|
|
62473
|
+
silent: true
|
|
62474
|
+
});
|
|
62475
|
+
}
|
|
62476
|
+
}, 150);
|
|
62477
|
+
}
|
|
62478
|
+
});
|
|
62429
62479
|
},
|
|
62430
62480
|
/**
|
|
62431
|
-
*
|
|
62481
|
+
* 初始化默认排序(支持前端分页和虚拟滚动)
|
|
62432
62482
|
*/
|
|
62433
62483
|
initDefaultSortForFrontendPagination() {
|
|
62434
|
-
var _this$gridOptions$
|
|
62435
|
-
//
|
|
62436
|
-
|
|
62484
|
+
var _this$gridOptions$pag4, _this$gridOptions$sor4, _this$gridOptions$sor5;
|
|
62485
|
+
// 支持前端分页或前端排序模式(包括虚拟滚动)
|
|
62486
|
+
const shouldInitSort = ((_this$gridOptions$pag4 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag4 === void 0 ? void 0 : _this$gridOptions$pag4.frontendPagination) || ((_this$gridOptions$sor4 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor4 === void 0 ? void 0 : _this$gridOptions$sor4.frontendSort);
|
|
62487
|
+
if (!shouldInitSort) {
|
|
62437
62488
|
return;
|
|
62438
62489
|
}
|
|
62439
|
-
const defaultSort = (_this$gridOptions$
|
|
62490
|
+
const defaultSort = (_this$gridOptions$sor5 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor5 === void 0 ? void 0 : _this$gridOptions$sor5.defaultSort;
|
|
62440
62491
|
if (defaultSort && defaultSort.field && defaultSort.order) {
|
|
62441
62492
|
// 设置排序状态
|
|
62442
62493
|
this.sortState.field = defaultSort.field;
|
|
62443
62494
|
this.sortState.order = defaultSort.order;
|
|
62444
62495
|
|
|
62445
|
-
// 在下一个tick
|
|
62496
|
+
// 在下一个tick中应用排序
|
|
62446
62497
|
this.$nextTick(() => {
|
|
62447
62498
|
if (this.$refs.xGrid) {
|
|
62448
62499
|
setTimeout(() => {
|
|
62449
|
-
//
|
|
62500
|
+
// 🔧 两种模式都使用手动排序(支持置顶行):
|
|
62501
|
+
// - 前端分页:数据在 spliteListData 中排序,只需UI高亮
|
|
62502
|
+
// - 虚拟滚动:数据在 spliteListData 中排序,只需UI高亮
|
|
62450
62503
|
this.$refs.xGrid.sort(defaultSort.field, defaultSort.order, {
|
|
62451
62504
|
silent: true
|
|
62452
62505
|
});
|
|
@@ -62456,22 +62509,27 @@ var custom_column_component = normalizeComponent(
|
|
|
62456
62509
|
}
|
|
62457
62510
|
},
|
|
62458
62511
|
/**
|
|
62459
|
-
*
|
|
62512
|
+
* 确保默认排序高亮(数据变化时调用,支持前端分页和虚拟滚动)
|
|
62460
62513
|
*/
|
|
62461
62514
|
ensureDefaultSortHighlight() {
|
|
62462
|
-
var _this$gridOptions$
|
|
62463
|
-
|
|
62515
|
+
var _this$gridOptions$pag5, _this$gridOptions$sor6, _this$gridOptions$sor7;
|
|
62516
|
+
// 支持前端分页或前端排序模式(包括虚拟滚动)
|
|
62517
|
+
const shouldEnsureSort = ((_this$gridOptions$pag5 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag5 === void 0 ? void 0 : _this$gridOptions$pag5.frontendPagination) || ((_this$gridOptions$sor6 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor6 === void 0 ? void 0 : _this$gridOptions$sor6.frontendSort);
|
|
62518
|
+
if (!shouldEnsureSort) {
|
|
62464
62519
|
return;
|
|
62465
62520
|
}
|
|
62466
|
-
const defaultSort = (_this$gridOptions$
|
|
62521
|
+
const defaultSort = (_this$gridOptions$sor7 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor7 === void 0 ? void 0 : _this$gridOptions$sor7.defaultSort;
|
|
62467
62522
|
if (defaultSort && defaultSort.field && defaultSort.order) {
|
|
62468
62523
|
// 确保排序状态与默认排序一致
|
|
62469
62524
|
this.sortState.field = defaultSort.field;
|
|
62470
62525
|
this.sortState.order = defaultSort.order;
|
|
62471
62526
|
|
|
62472
|
-
//
|
|
62527
|
+
// 应用排序
|
|
62473
62528
|
if (this.$refs.xGrid) {
|
|
62474
62529
|
setTimeout(() => {
|
|
62530
|
+
// 🔧 两种模式都使用手动排序(支持置顶行):
|
|
62531
|
+
// - 前端分页:数据已在 spliteListData 中排序,只需UI高亮(silent: true)
|
|
62532
|
+
// - 虚拟滚动:数据已在 spliteListData 中排序,只需UI高亮(silent: true)
|
|
62475
62533
|
this.$refs.xGrid.sort(defaultSort.field, defaultSort.order, {
|
|
62476
62534
|
silent: true
|
|
62477
62535
|
});
|
|
@@ -62493,8 +62551,8 @@ var custom_column_component = normalizeComponent(
|
|
|
62493
62551
|
;
|
|
62494
62552
|
var table_component = normalizeComponent(
|
|
62495
62553
|
components_tablevue_type_script_lang_js,
|
|
62496
|
-
|
|
62497
|
-
|
|
62554
|
+
tablevue_type_template_id_22f2fb85_render,
|
|
62555
|
+
tablevue_type_template_id_22f2fb85_staticRenderFns,
|
|
62498
62556
|
false,
|
|
62499
62557
|
null,
|
|
62500
62558
|
null,
|
package/lib/by-components.umd.js
CHANGED
|
@@ -60761,8 +60761,8 @@ var component = normalizeComponent(
|
|
|
60761
60761
|
)
|
|
60762
60762
|
|
|
60763
60763
|
/* harmony default export */ var pager = (component.exports);
|
|
60764
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=
|
|
60765
|
-
var
|
|
60764
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=22f2fb85
|
|
60765
|
+
var tablevue_type_template_id_22f2fb85_render = function render() {
|
|
60766
60766
|
var _vm = this,
|
|
60767
60767
|
_c = _vm._self._c;
|
|
60768
60768
|
return _c('div', [_c('vxe-grid', _vm._g(_vm._b({
|
|
@@ -60836,7 +60836,7 @@ var tablevue_type_template_id_3aefd0b0_render = function render() {
|
|
|
60836
60836
|
}
|
|
60837
60837
|
}) : _vm._e()], 1);
|
|
60838
60838
|
};
|
|
60839
|
-
var
|
|
60839
|
+
var tablevue_type_template_id_22f2fb85_staticRenderFns = [];
|
|
60840
60840
|
|
|
60841
60841
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
60842
60842
|
var es_array_push = __webpack_require__(4114);
|
|
@@ -61909,7 +61909,7 @@ var custom_column_component = normalizeComponent(
|
|
|
61909
61909
|
handler() {
|
|
61910
61910
|
this.$nextTick(() => {
|
|
61911
61911
|
setTimeout(() => {
|
|
61912
|
-
var _this$gridOptions$pag;
|
|
61912
|
+
var _this$gridOptions$pag, _this$gridOptions$sor;
|
|
61913
61913
|
if (this.$refs.xGrid && this.$refs.xGrid.refreshScroll) {
|
|
61914
61914
|
this.$refs.xGrid.refreshScroll(); // 刷新滚动布局
|
|
61915
61915
|
}
|
|
@@ -61920,11 +61920,11 @@ var custom_column_component = normalizeComponent(
|
|
|
61920
61920
|
});
|
|
61921
61921
|
}
|
|
61922
61922
|
|
|
61923
|
-
//
|
|
61924
|
-
if ((_this$gridOptions$pag = this.gridOptions.pagerConfig) !== null && _this$gridOptions$pag !== void 0 && _this$gridOptions$pag.frontendPagination) {
|
|
61923
|
+
// 前端分页或前端排序模式下,数据变化时确保默认排序高亮
|
|
61924
|
+
if ((_this$gridOptions$pag = this.gridOptions.pagerConfig) !== null && _this$gridOptions$pag !== void 0 && _this$gridOptions$pag.frontendPagination || (_this$gridOptions$sor = this.gridOptions.sortConfig) !== null && _this$gridOptions$sor !== void 0 && _this$gridOptions$sor.frontendSort) {
|
|
61925
61925
|
this.ensureDefaultSortHighlight();
|
|
61926
61926
|
} else {
|
|
61927
|
-
//
|
|
61927
|
+
// 后端模式,恢复之前的排序高亮
|
|
61928
61928
|
if (this.sortState.field && this.sortState.order && this.$refs.xGrid) {
|
|
61929
61929
|
setTimeout(() => {
|
|
61930
61930
|
this.$refs.xGrid.sort(this.sortState.field, this.sortState.order, {
|
|
@@ -61941,7 +61941,7 @@ var custom_column_component = normalizeComponent(
|
|
|
61941
61941
|
},
|
|
61942
61942
|
computed: {
|
|
61943
61943
|
options() {
|
|
61944
|
-
var _others$pagerConfig, _others$sortConfig, _others$pagerConfig2, _others$pagerConfig3, _others$
|
|
61944
|
+
var _others$pagerConfig, _others$sortConfig, _others$pagerConfig2, _others$sortConfig2, _others$pagerConfig3, _others$sortConfig3, _sortConfig$remote;
|
|
61945
61945
|
const {
|
|
61946
61946
|
customColumnConfig,
|
|
61947
61947
|
columns,
|
|
@@ -61960,15 +61960,18 @@ var custom_column_component = normalizeComponent(
|
|
|
61960
61960
|
newColumns = this.removeFixedColumns(newColumns);
|
|
61961
61961
|
}
|
|
61962
61962
|
|
|
61963
|
-
//
|
|
61963
|
+
// 处理前端分页和虚拟滚动
|
|
61964
61964
|
let data = others.data || [];
|
|
61965
61965
|
if ((_others$pagerConfig = others.pagerConfig) !== null && _others$pagerConfig !== void 0 && _others$pagerConfig.frontendPagination || (_others$sortConfig = others.sortConfig) !== null && _others$sortConfig !== void 0 && _others$sortConfig.frontendSort) {
|
|
61966
61966
|
// 保存完整数据
|
|
61967
61967
|
this.allData = [...data];
|
|
61968
61968
|
}
|
|
61969
61969
|
if ((_others$pagerConfig2 = others.pagerConfig) !== null && _others$pagerConfig2 !== void 0 && _others$pagerConfig2.frontendPagination) {
|
|
61970
|
-
//
|
|
61970
|
+
// 前端分页:截取当前页数据
|
|
61971
61971
|
data = this.spliteListData(this.allData, others.pagerConfig.currentPage, others.pagerConfig.pageSize);
|
|
61972
|
+
} else if ((_others$sortConfig2 = others.sortConfig) !== null && _others$sortConfig2 !== void 0 && _others$sortConfig2.frontendSort) {
|
|
61973
|
+
// 虚拟滚动:处理置顶行和默认排序
|
|
61974
|
+
data = this.spliteListData(this.allData, null, null);
|
|
61972
61975
|
}
|
|
61973
61976
|
|
|
61974
61977
|
// 移除 others 中的 data,避免覆盖
|
|
@@ -62020,9 +62023,12 @@ var custom_column_component = normalizeComponent(
|
|
|
62020
62023
|
},
|
|
62021
62024
|
sortConfig: {
|
|
62022
62025
|
...sortConfig,
|
|
62023
|
-
//
|
|
62024
|
-
//
|
|
62025
|
-
|
|
62026
|
+
// 🔧 排序模式配置:
|
|
62027
|
+
// - 前端分页:remote: true(数据已在 spliteListData 中排序)
|
|
62028
|
+
// - 虚拟滚动 + 前端排序:remote: true(手动处理置顶行,类似前端分页)
|
|
62029
|
+
// - 后端排序:remote: 外部配置或 false
|
|
62030
|
+
remote: (_others$pagerConfig3 = others.pagerConfig) !== null && _others$pagerConfig3 !== void 0 && _others$pagerConfig3.frontendPagination || (_others$sortConfig3 = others.sortConfig) !== null && _others$sortConfig3 !== void 0 && _others$sortConfig3.frontendSort ? true // 前端分页或虚拟滚动:都使用 remote: true,手动处理排序(支持置顶行)
|
|
62031
|
+
: (_sortConfig$remote = sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.remote) !== null && _sortConfig$remote !== void 0 ? _sortConfig$remote : false,
|
|
62026
62032
|
trigger: 'cell',
|
|
62027
62033
|
...this.gridOptions.sortConfig
|
|
62028
62034
|
},
|
|
@@ -62367,19 +62373,24 @@ var custom_column_component = normalizeComponent(
|
|
|
62367
62373
|
* @param event
|
|
62368
62374
|
*/
|
|
62369
62375
|
handleSortChange(event) {
|
|
62370
|
-
var _this$gridOptions$pag3, _this$gridOptions$
|
|
62376
|
+
var _this$gridOptions$pag3, _this$gridOptions$sor2;
|
|
62371
62377
|
const {
|
|
62372
62378
|
property,
|
|
62373
62379
|
order
|
|
62374
62380
|
} = event;
|
|
62375
|
-
const shouldHandleSort = ((_this$gridOptions$pag3 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag3 === void 0 ? void 0 : _this$gridOptions$pag3.frontendPagination) || ((_this$gridOptions$sor = this.gridOptions.sortConfig) === null || _this$gridOptions$sor === void 0 ? void 0 : _this$gridOptions$sor.frontendSort);
|
|
62376
62381
|
|
|
62377
|
-
//
|
|
62382
|
+
// 🔧 区分前端分页和虚拟滚动:
|
|
62383
|
+
// - 前端分页(frontendPagination):手动排序 + 分页
|
|
62384
|
+
// - 虚拟滚动(frontendSort 但无 frontendPagination):手动排序 + 虚拟滚动(支持置顶行)
|
|
62385
|
+
const isFrontendPagination = (_this$gridOptions$pag3 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag3 === void 0 ? void 0 : _this$gridOptions$pag3.frontendPagination;
|
|
62386
|
+
const isVirtualScrollWithSort = ((_this$gridOptions$sor2 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor2 === void 0 ? void 0 : _this$gridOptions$sor2.frontendSort) && !isFrontendPagination;
|
|
62387
|
+
|
|
62388
|
+
// 无论哪种模式,都保存排序状态用于恢复箭头高亮
|
|
62378
62389
|
this.sortState.field = property;
|
|
62379
62390
|
this.sortState.order = order;
|
|
62380
|
-
if (
|
|
62381
|
-
|
|
62382
|
-
const newData = this.spliteListData(this.allData,
|
|
62391
|
+
if (isFrontendPagination) {
|
|
62392
|
+
// 前端分页模式:手动处理排序和分页
|
|
62393
|
+
const newData = this.spliteListData(this.allData, this.gridOptions.pagerConfig.currentPage, this.gridOptions.pagerConfig.pageSize);
|
|
62383
62394
|
if (this.$refs.xGrid) {
|
|
62384
62395
|
this.$refs.xGrid.reloadData(newData);
|
|
62385
62396
|
this.$nextTick(() => {
|
|
@@ -62392,8 +62403,7 @@ var custom_column_component = normalizeComponent(
|
|
|
62392
62403
|
}, 100);
|
|
62393
62404
|
}
|
|
62394
62405
|
setTimeout(() => {
|
|
62395
|
-
|
|
62396
|
-
if ((_this$gridOptions$pag6 = this.gridOptions.pagerConfig) !== null && _this$gridOptions$pag6 !== void 0 && _this$gridOptions$pag6.frontendPagination && this.$refs.xGrid) {
|
|
62406
|
+
if (this.$refs.xGrid) {
|
|
62397
62407
|
// 前端分页时,排序状态变化,回到第一页
|
|
62398
62408
|
const currentPage = this.gridOptions.pagerConfig.currentPage;
|
|
62399
62409
|
if (currentPage !== 1) {
|
|
@@ -62410,8 +62420,30 @@ var custom_column_component = normalizeComponent(
|
|
|
62410
62420
|
}, 0);
|
|
62411
62421
|
});
|
|
62412
62422
|
}
|
|
62423
|
+
} else if (isVirtualScrollWithSort) {
|
|
62424
|
+
// 虚拟滚动模式:手动处理排序(支持置顶行)
|
|
62425
|
+
const newData = this.spliteListData(this.allData, null, null);
|
|
62426
|
+
if (this.$refs.xGrid) {
|
|
62427
|
+
this.$refs.xGrid.reloadData(newData);
|
|
62428
|
+
this.$nextTick(() => {
|
|
62429
|
+
if (property && order) {
|
|
62430
|
+
setTimeout(() => {
|
|
62431
|
+
// 只高亮箭头,表格内部不排序(因为数据已经排序好)
|
|
62432
|
+
this.$refs.xGrid.sort(property, order, {
|
|
62433
|
+
silent: true
|
|
62434
|
+
});
|
|
62435
|
+
}, 100);
|
|
62436
|
+
}
|
|
62437
|
+
setTimeout(() => {
|
|
62438
|
+
if (this.$refs.xGrid) {
|
|
62439
|
+
// 排序后滚动到顶部
|
|
62440
|
+
this.$refs.xGrid.scrollTo(0, 0);
|
|
62441
|
+
}
|
|
62442
|
+
}, 0);
|
|
62443
|
+
});
|
|
62444
|
+
}
|
|
62413
62445
|
} else {
|
|
62414
|
-
//
|
|
62446
|
+
// 后端模式:确保排序箭头高亮
|
|
62415
62447
|
this.$nextTick(() => {
|
|
62416
62448
|
if (property && order && this.$refs.xGrid) {
|
|
62417
62449
|
setTimeout(() => {
|
|
@@ -62436,27 +62468,48 @@ var custom_column_component = normalizeComponent(
|
|
|
62436
62468
|
silent: true
|
|
62437
62469
|
});
|
|
62438
62470
|
}, 100);
|
|
62471
|
+
|
|
62472
|
+
// 🔧 修复:重置后自动应用默认排序(支持虚拟滚动和前端分页)
|
|
62473
|
+
this.$nextTick(() => {
|
|
62474
|
+
var _this$gridOptions$sor3;
|
|
62475
|
+
const defaultSort = (_this$gridOptions$sor3 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor3 === void 0 ? void 0 : _this$gridOptions$sor3.defaultSort;
|
|
62476
|
+
if (defaultSort && defaultSort.field && defaultSort.order) {
|
|
62477
|
+
this.sortState.field = defaultSort.field;
|
|
62478
|
+
this.sortState.order = defaultSort.order;
|
|
62479
|
+
setTimeout(() => {
|
|
62480
|
+
if (this.$refs.xGrid) {
|
|
62481
|
+
// 🔧 两种模式都使用手动排序(支持置顶行)
|
|
62482
|
+
this.$refs.xGrid.sort(defaultSort.field, defaultSort.order, {
|
|
62483
|
+
silent: true
|
|
62484
|
+
});
|
|
62485
|
+
}
|
|
62486
|
+
}, 150);
|
|
62487
|
+
}
|
|
62488
|
+
});
|
|
62439
62489
|
},
|
|
62440
62490
|
/**
|
|
62441
|
-
*
|
|
62491
|
+
* 初始化默认排序(支持前端分页和虚拟滚动)
|
|
62442
62492
|
*/
|
|
62443
62493
|
initDefaultSortForFrontendPagination() {
|
|
62444
|
-
var _this$gridOptions$
|
|
62445
|
-
//
|
|
62446
|
-
|
|
62494
|
+
var _this$gridOptions$pag4, _this$gridOptions$sor4, _this$gridOptions$sor5;
|
|
62495
|
+
// 支持前端分页或前端排序模式(包括虚拟滚动)
|
|
62496
|
+
const shouldInitSort = ((_this$gridOptions$pag4 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag4 === void 0 ? void 0 : _this$gridOptions$pag4.frontendPagination) || ((_this$gridOptions$sor4 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor4 === void 0 ? void 0 : _this$gridOptions$sor4.frontendSort);
|
|
62497
|
+
if (!shouldInitSort) {
|
|
62447
62498
|
return;
|
|
62448
62499
|
}
|
|
62449
|
-
const defaultSort = (_this$gridOptions$
|
|
62500
|
+
const defaultSort = (_this$gridOptions$sor5 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor5 === void 0 ? void 0 : _this$gridOptions$sor5.defaultSort;
|
|
62450
62501
|
if (defaultSort && defaultSort.field && defaultSort.order) {
|
|
62451
62502
|
// 设置排序状态
|
|
62452
62503
|
this.sortState.field = defaultSort.field;
|
|
62453
62504
|
this.sortState.order = defaultSort.order;
|
|
62454
62505
|
|
|
62455
|
-
// 在下一个tick
|
|
62506
|
+
// 在下一个tick中应用排序
|
|
62456
62507
|
this.$nextTick(() => {
|
|
62457
62508
|
if (this.$refs.xGrid) {
|
|
62458
62509
|
setTimeout(() => {
|
|
62459
|
-
//
|
|
62510
|
+
// 🔧 两种模式都使用手动排序(支持置顶行):
|
|
62511
|
+
// - 前端分页:数据在 spliteListData 中排序,只需UI高亮
|
|
62512
|
+
// - 虚拟滚动:数据在 spliteListData 中排序,只需UI高亮
|
|
62460
62513
|
this.$refs.xGrid.sort(defaultSort.field, defaultSort.order, {
|
|
62461
62514
|
silent: true
|
|
62462
62515
|
});
|
|
@@ -62466,22 +62519,27 @@ var custom_column_component = normalizeComponent(
|
|
|
62466
62519
|
}
|
|
62467
62520
|
},
|
|
62468
62521
|
/**
|
|
62469
|
-
*
|
|
62522
|
+
* 确保默认排序高亮(数据变化时调用,支持前端分页和虚拟滚动)
|
|
62470
62523
|
*/
|
|
62471
62524
|
ensureDefaultSortHighlight() {
|
|
62472
|
-
var _this$gridOptions$
|
|
62473
|
-
|
|
62525
|
+
var _this$gridOptions$pag5, _this$gridOptions$sor6, _this$gridOptions$sor7;
|
|
62526
|
+
// 支持前端分页或前端排序模式(包括虚拟滚动)
|
|
62527
|
+
const shouldEnsureSort = ((_this$gridOptions$pag5 = this.gridOptions.pagerConfig) === null || _this$gridOptions$pag5 === void 0 ? void 0 : _this$gridOptions$pag5.frontendPagination) || ((_this$gridOptions$sor6 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor6 === void 0 ? void 0 : _this$gridOptions$sor6.frontendSort);
|
|
62528
|
+
if (!shouldEnsureSort) {
|
|
62474
62529
|
return;
|
|
62475
62530
|
}
|
|
62476
|
-
const defaultSort = (_this$gridOptions$
|
|
62531
|
+
const defaultSort = (_this$gridOptions$sor7 = this.gridOptions.sortConfig) === null || _this$gridOptions$sor7 === void 0 ? void 0 : _this$gridOptions$sor7.defaultSort;
|
|
62477
62532
|
if (defaultSort && defaultSort.field && defaultSort.order) {
|
|
62478
62533
|
// 确保排序状态与默认排序一致
|
|
62479
62534
|
this.sortState.field = defaultSort.field;
|
|
62480
62535
|
this.sortState.order = defaultSort.order;
|
|
62481
62536
|
|
|
62482
|
-
//
|
|
62537
|
+
// 应用排序
|
|
62483
62538
|
if (this.$refs.xGrid) {
|
|
62484
62539
|
setTimeout(() => {
|
|
62540
|
+
// 🔧 两种模式都使用手动排序(支持置顶行):
|
|
62541
|
+
// - 前端分页:数据已在 spliteListData 中排序,只需UI高亮(silent: true)
|
|
62542
|
+
// - 虚拟滚动:数据已在 spliteListData 中排序,只需UI高亮(silent: true)
|
|
62485
62543
|
this.$refs.xGrid.sort(defaultSort.field, defaultSort.order, {
|
|
62486
62544
|
silent: true
|
|
62487
62545
|
});
|
|
@@ -62503,8 +62561,8 @@ var custom_column_component = normalizeComponent(
|
|
|
62503
62561
|
;
|
|
62504
62562
|
var table_component = normalizeComponent(
|
|
62505
62563
|
components_tablevue_type_script_lang_js,
|
|
62506
|
-
|
|
62507
|
-
|
|
62564
|
+
tablevue_type_template_id_22f2fb85_render,
|
|
62565
|
+
tablevue_type_template_id_22f2fb85_staticRenderFns,
|
|
62508
62566
|
false,
|
|
62509
62567
|
null,
|
|
62510
62568
|
null,
|