@lemon-fe/components 1.5.7-alpha.2 → 1.5.7-alpha.4

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.
@@ -17,7 +17,7 @@ declare const Editors: {
17
17
  Text: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").TextEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
18
18
  Date: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").DateEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
19
19
  Number: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").NumberEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
20
- Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "showSearch" | "virtual" | "optionFilterProp" | "options" | "listHeight"> & {
20
+ Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "virtual" | "allowClear" | "showSearch" | "optionFilterProp" | "options" | "listHeight"> & {
21
21
  fieldNames?: {
22
22
  label: string;
23
23
  value: string;
@@ -1021,26 +1021,25 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1021
1021
  }, {
1022
1022
  key: "getFullColumnDef",
1023
1023
  value: function getFullColumnDef(col) {
1024
- if (col.type === undefined) {
1025
- return _objectSpread({}, col);
1026
- }
1027
1024
  var _this$props7 = this.props,
1028
1025
  mColumnTypes = _this$props7.columnTypes,
1029
1026
  mDefaultColDef = _this$props7.defaultColDef;
1030
- var colTypes = this.getMemoizedColumnTypes(mColumnTypes);
1031
1027
  var result = {};
1032
- var types;
1033
- if (typeof col.type === 'string') {
1034
- types = [col.type];
1035
- } else {
1036
- types = col.type;
1037
- }
1038
- types.forEach(function (type) {
1039
- var colType = colTypes[type];
1040
- if (colType !== undefined) {
1041
- Object.assign(result, colType);
1028
+ if (col.type !== undefined) {
1029
+ var colTypes = this.getMemoizedColumnTypes(mColumnTypes);
1030
+ var types;
1031
+ if (typeof col.type === 'string') {
1032
+ types = [col.type];
1033
+ } else {
1034
+ types = col.type;
1042
1035
  }
1043
- });
1036
+ types.forEach(function (type) {
1037
+ var colType = colTypes[type];
1038
+ if (colType !== undefined) {
1039
+ Object.assign(result, colType);
1040
+ }
1041
+ });
1042
+ }
1044
1043
  Object.assign(result, mDefaultColDef);
1045
1044
  return _objectSpread(_objectSpread({}, result), col);
1046
1045
  }
@@ -1062,6 +1061,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1062
1061
  var map = function map(cols) {
1063
1062
  return cols.map(function (item) {
1064
1063
  if (isColumn(item)) {
1064
+ var _opts$headerName, _opts$sortable;
1065
1065
  var title = item.title,
1066
1066
  dataIndex = item.dataIndex,
1067
1067
  render = item.render,
@@ -1094,9 +1094,6 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1094
1094
  } else if (title !== undefined) {
1095
1095
  opts.headerName = title.toString();
1096
1096
  }
1097
- if (enableEstimateInitialColumnWidth && opts.headerName && !keepInitialWidthWhenEstimate) {
1098
- opts.initialWidth = Math.min(getTextWidth(opts.headerName) * 14 + 36 + (opts.headerComponentParams !== undefined ? 24 : 0), ESTIMATE_INITIAL_COLUMN_MAX_WIDTH);
1099
- }
1100
1097
 
1101
1098
  // render
1102
1099
  if (render !== undefined) {
@@ -1123,6 +1120,11 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1123
1120
  opts.sortable = sorter;
1124
1121
  }
1125
1122
  }
1123
+ var headerName = (_opts$headerName = opts.headerName) !== null && _opts$headerName !== void 0 ? _opts$headerName : def.headerName;
1124
+ var sortable = (_opts$sortable = opts.sortable) !== null && _opts$sortable !== void 0 ? _opts$sortable : def.sortable;
1125
+ if (enableEstimateInitialColumnWidth && headerName && !keepInitialWidthWhenEstimate) {
1126
+ opts.initialWidth = Math.min(getTextWidth(headerName) * 14 + 36 + (sortable ? 10 : 0) + (opts.headerComponentParams !== undefined ? 24 : 0), ESTIMATE_INITIAL_COLUMN_MAX_WIDTH);
1127
+ }
1126
1128
 
1127
1129
  // editable
1128
1130
  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.2",
3
+ "version": "1.5.7-alpha.4",
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": "f4344479e739f297b7901b3ed3f3d91e45b5074a"
61
+ "gitHead": "90aec9c179f56f47c778bf38e663ccc7fedb2889"
62
62
  }