@lemon-fe/components 1.5.7-alpha.1 → 1.5.7-alpha.3

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.
@@ -114,6 +114,7 @@ var defaultColDef = {
114
114
  initialWidth: 140,
115
115
  suppressMenu: true
116
116
  };
117
+ var ESTIMATE_INITIAL_COLUMN_MAX_WIDTH = 400;
117
118
  var defaultComponents = {
118
119
  agColumnHeader: HeaderRenderer,
119
120
  agColumnGroupHeader: HeaderRenderer,
@@ -1021,7 +1022,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1021
1022
  key: "getFullColumnDef",
1022
1023
  value: function getFullColumnDef(col) {
1023
1024
  if (col.type === undefined) {
1024
- return _objectSpread({}, col);
1025
+ return col;
1025
1026
  }
1026
1027
  var _this$props7 = this.props,
1027
1028
  mColumnTypes = _this$props7.columnTypes,
@@ -1061,6 +1062,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1061
1062
  var map = function map(cols) {
1062
1063
  return cols.map(function (item) {
1063
1064
  if (isColumn(item)) {
1065
+ var _opts$headerName, _opts$sortable;
1064
1066
  var title = item.title,
1065
1067
  dataIndex = item.dataIndex,
1066
1068
  render = item.render,
@@ -1093,9 +1095,6 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1093
1095
  } else if (title !== undefined) {
1094
1096
  opts.headerName = title.toString();
1095
1097
  }
1096
- if (enableEstimateInitialColumnWidth && opts.headerName && !keepInitialWidthWhenEstimate) {
1097
- opts.initialWidth = getTextWidth(opts.headerName) * 14 + 36 + (opts.headerComponentParams !== undefined ? 24 : 0);
1098
- }
1099
1098
 
1100
1099
  // render
1101
1100
  if (render !== undefined) {
@@ -1122,6 +1121,11 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1122
1121
  opts.sortable = sorter;
1123
1122
  }
1124
1123
  }
1124
+ var headerName = (_opts$headerName = opts.headerName) !== null && _opts$headerName !== void 0 ? _opts$headerName : def.headerName;
1125
+ var sortable = (_opts$sortable = opts.sortable) !== null && _opts$sortable !== void 0 ? _opts$sortable : def.sortable;
1126
+ if (enableEstimateInitialColumnWidth && headerName && !keepInitialWidthWhenEstimate) {
1127
+ opts.initialWidth = Math.min(getTextWidth(headerName) * 14 + 36 + (sortable ? 10 : 0) + (opts.headerComponentParams !== undefined ? 24 : 0), ESTIMATE_INITIAL_COLUMN_MAX_WIDTH);
1128
+ }
1125
1129
 
1126
1130
  // editable
1127
1131
  if (_typeof(editable) === 'object') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.5.7-alpha.1",
3
+ "version": "1.5.7-alpha.3",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "71b81afd6fac9ca7e66b3f527c9e6f104e9e30bd"
61
+ "gitHead": "2ac91e3697f76af6883a124f78461e3e119da69f"
62
62
  }