@nokecy/qc-ui 1.1.92 → 1.1.93

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.
@@ -491,6 +491,7 @@ function isOldSchemeData(data) {
491
491
  * @returns AG-Grid columnState 数组
492
492
  */
493
493
  function flatConfigToColumnState(flatConfig, originalColumnDefs) {
494
+ var _originalColumnDefs;
494
495
  // 只做查询条件的列不进表格:方案里存过的剔除,也不当新增列补回 @author nokecy
495
496
  flatConfig = dropQueryOnlyItems(normalizeColumnConfig(flatConfig, originalColumnDefs), originalColumnDefs);
496
497
  originalColumnDefs = excludeQueryOnlyColumns(originalColumnDefs);
@@ -518,6 +519,15 @@ function flatConfigToColumnState(flatConfig, originalColumnDefs) {
518
519
  }
519
520
  return columns;
520
521
  }
522
+
523
+ // 已保存的用户列方案可能早于页面 minWidth 调整。恢复时只保留顺序、显隐等用户偏好,
524
+ // 对显式声明最小宽度的列把历史窄宽度抬到当前下限,避免重要表头和数值被压缩。@author nokecy
525
+ var minimumWidths = new Map();
526
+ collectAllColumns((_originalColumnDefs = originalColumnDefs) !== null && _originalColumnDefs !== void 0 ? _originalColumnDefs : []).forEach(function (column) {
527
+ var identity = getColumnIdentity(column);
528
+ var minWidth = Number(column.minWidth);
529
+ if (identity && Number.isFinite(minWidth) && minWidth > 0) minimumWidths.set(identity, minWidth);
530
+ });
521
531
  var result = flatConfig.filter(function (item) {
522
532
  return item.type === 'column';
523
533
  }) // 只处理列节点,分组不在 columnState 中
@@ -533,7 +543,10 @@ function flatConfigToColumnState(flatConfig, originalColumnDefs) {
533
543
  };
534
544
 
535
545
  // 只设置有值的属性,undefined 表示不改变该属性
536
- if (item.width !== undefined) state.width = item.width;
546
+ if (item.width !== undefined) {
547
+ var minWidth = minimumWidths.get(state.colId);
548
+ state.width = minWidth && Number.isFinite(item.width) ? Math.max(item.width, minWidth) : item.width;
549
+ }
537
550
  if (item.hide !== undefined) state.hide = item.hide;
538
551
  if (item.flex !== undefined) state.flex = item.flex;
539
552
 
@@ -473,6 +473,7 @@ export function isOldSchemeData(data) {
473
473
  * @returns AG-Grid columnState 数组
474
474
  */
475
475
  export function flatConfigToColumnState(flatConfig, originalColumnDefs) {
476
+ var _originalColumnDefs;
476
477
  // 只做查询条件的列不进表格:方案里存过的剔除,也不当新增列补回 @author nokecy
477
478
  flatConfig = dropQueryOnlyItems(normalizeColumnConfig(flatConfig, originalColumnDefs), originalColumnDefs);
478
479
  originalColumnDefs = excludeQueryOnlyColumns(originalColumnDefs);
@@ -500,6 +501,15 @@ export function flatConfigToColumnState(flatConfig, originalColumnDefs) {
500
501
  }
501
502
  return columns;
502
503
  }
504
+
505
+ // 已保存的用户列方案可能早于页面 minWidth 调整。恢复时只保留顺序、显隐等用户偏好,
506
+ // 对显式声明最小宽度的列把历史窄宽度抬到当前下限,避免重要表头和数值被压缩。@author nokecy
507
+ var minimumWidths = new Map();
508
+ collectAllColumns((_originalColumnDefs = originalColumnDefs) !== null && _originalColumnDefs !== void 0 ? _originalColumnDefs : []).forEach(function (column) {
509
+ var identity = getColumnIdentity(column);
510
+ var minWidth = Number(column.minWidth);
511
+ if (identity && Number.isFinite(minWidth) && minWidth > 0) minimumWidths.set(identity, minWidth);
512
+ });
503
513
  var result = flatConfig.filter(function (item) {
504
514
  return item.type === 'column';
505
515
  }) // 只处理列节点,分组不在 columnState 中
@@ -515,7 +525,10 @@ export function flatConfigToColumnState(flatConfig, originalColumnDefs) {
515
525
  };
516
526
 
517
527
  // 只设置有值的属性,undefined 表示不改变该属性
518
- if (item.width !== undefined) state.width = item.width;
528
+ if (item.width !== undefined) {
529
+ var minWidth = minimumWidths.get(state.colId);
530
+ state.width = minWidth && Number.isFinite(item.width) ? Math.max(item.width, minWidth) : item.width;
531
+ }
519
532
  if (item.hide !== undefined) state.hide = item.hide;
520
533
  if (item.flex !== undefined) state.flex = item.flex;
521
534