@lemon-fe/components 1.1.0-alpha.6 → 1.1.0-alpha.7

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.
@@ -42,6 +42,8 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
42
42
  node?: IRowNode<any>;
43
43
  }): boolean;
44
44
  constructor(props: DataGridProps<TData>);
45
+ /** TODO目前只应用在部分地方,临时解决一下获取的columnTypes不正确的问题,考虑未来转成函数组件 */
46
+ private getProps;
45
47
  setField(field: FieldCol): void;
46
48
  getField(id: string): FieldCol | undefined;
47
49
  getFields(): FieldCol[];
@@ -436,7 +436,16 @@ var DataGrid = /*#__PURE__*/function (_Component) {
436
436
  _this.syncColRender();
437
437
  return _this;
438
438
  }
439
+
440
+ /** TODO目前只应用在部分地方,临时解决一下获取的columnTypes不正确的问题,考虑未来转成函数组件 */
439
441
  _createClass(DataGrid, [{
442
+ key: "getProps",
443
+ value: function getProps(props) {
444
+ var reactCtx = this.context;
445
+ var target = props || this.props;
446
+ return _objectSpread(_objectSpread({}, reactCtx), target);
447
+ }
448
+ }, {
440
449
  key: "setField",
441
450
  value: function setField(field) {
442
451
  var newFields = _toConsumableArray(this.fields);
@@ -516,9 +525,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
516
525
  }, {
517
526
  key: "getPagination",
518
527
  value: function getPagination() {
519
- var _this$props3 = this.props,
520
- pagination = _this$props3.pagination,
521
- fetch = _this$props3.fetch;
528
+ var _this$getProps = this.getProps(),
529
+ pagination = _this$getProps.pagination,
530
+ fetch = _this$getProps.fetch;
522
531
  var page = 1;
523
532
  var pageSize = 50;
524
533
  var total = 0;
@@ -549,11 +558,11 @@ var DataGrid = /*#__PURE__*/function (_Component) {
549
558
  value: function componentDidUpdate(prevProps) {
550
559
  var _this2 = this,
551
560
  _prevProps$rowSelecti;
552
- var _this$props4 = this.props,
553
- columns = _this$props4.columns,
554
- rowSelection = _this$props4.rowSelection,
555
- dataSource = _this$props4.dataSource,
556
- context = _this$props4.context;
561
+ var _this$props3 = this.props,
562
+ columns = _this$props3.columns,
563
+ rowSelection = _this$props3.rowSelection,
564
+ dataSource = _this$props3.dataSource,
565
+ context = _this$props3.context;
557
566
  if (columns !== prevProps.columns) {
558
567
  this.syncColRender();
559
568
  this.afterReady(function () {
@@ -589,14 +598,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
589
598
  key: "componentDidMount",
590
599
  value: function () {
591
600
  var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
592
- var _this$props5, customColumnPanelStorage, autoLoad, state, data;
601
+ var _this$props4, customColumnPanelStorage, autoLoad, state, data;
593
602
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
594
603
  while (1) switch (_context3.prev = _context3.next) {
595
604
  case 0:
596
605
  window.addEventListener('blur', this.handleFocus);
597
606
 
598
607
  /** 加载定制列数据如果接口很慢的话,可能会存在列更新的时序问题,尝试过阻塞其他操作,但在明细页面依旧会出现2个加载动画的情况。未来尝试解决 */
599
- _this$props5 = this.props, customColumnPanelStorage = _this$props5.customColumnPanelStorage, autoLoad = _this$props5.autoLoad;
608
+ _this$props4 = this.props, customColumnPanelStorage = _this$props4.customColumnPanelStorage, autoLoad = _this$props4.autoLoad;
600
609
  if (!customColumnPanelStorage) {
601
610
  _context3.next = 16;
602
611
  break;
@@ -775,9 +784,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
775
784
  if (col.type === undefined) {
776
785
  return _objectSpread({}, col);
777
786
  }
778
- var _this$props6 = this.props,
779
- mColumnTypes = _this$props6.columnTypes,
780
- mDefaultColDef = _this$props6.defaultColDef;
787
+ var _this$getProps2 = this.getProps(),
788
+ mColumnTypes = _this$getProps2.columnTypes,
789
+ mDefaultColDef = _this$getProps2.defaultColDef;
781
790
  var colTypes = this.getMemoizedColumnTypes(mColumnTypes);
782
791
  var result = {};
783
792
  var types;
@@ -800,11 +809,11 @@ var DataGrid = /*#__PURE__*/function (_Component) {
800
809
  value: function getColumnDefs() {
801
810
  var _this5 = this,
802
811
  _this$props$customCol;
803
- var _this$props7 = this.props,
804
- _this$props7$columns = _this$props7.columns,
805
- columns = _this$props7$columns === void 0 ? [] : _this$props7$columns,
806
- rowActions = _this$props7.rowActions,
807
- rowSelection = _this$props7.rowSelection;
812
+ var _this$props5 = this.props,
813
+ _this$props5$columns = _this$props5.columns,
814
+ columns = _this$props5$columns === void 0 ? [] : _this$props5$columns,
815
+ rowActions = _this$props5.rowActions,
816
+ rowSelection = _this$props5.rowSelection;
808
817
  var leafColIds = [];
809
818
  var map = function map(cols) {
810
819
  return cols.map(function (item) {
@@ -1497,28 +1506,27 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1497
1506
  key: "render",
1498
1507
  value: function render() {
1499
1508
  var _this12 = this;
1500
- var reactCtx = this.context;
1501
- var _reactCtx$DataGrid$th = _objectSpread(_objectSpread({}, reactCtx.DataGrid), this.props),
1502
- rowKey = _reactCtx$DataGrid$th.rowKey,
1503
- fetch = _reactCtx$DataGrid$th.fetch,
1504
- dataSource = _reactCtx$DataGrid$th.dataSource,
1505
- rowActions = _reactCtx$DataGrid$th.rowActions,
1506
- columns = _reactCtx$DataGrid$th.columns,
1507
- autoLoad = _reactCtx$DataGrid$th.autoLoad,
1508
- loadingProp = _reactCtx$DataGrid$th.loading,
1509
- summary = _reactCtx$DataGrid$th.summary,
1510
- detailCell = _reactCtx$DataGrid$th.detailCell,
1511
- pagination = _reactCtx$DataGrid$th.pagination,
1512
- rowSelection = _reactCtx$DataGrid$th.rowSelection,
1513
- columnTypesProp = _reactCtx$DataGrid$th.columnTypes,
1514
- defaultColDefProp = _reactCtx$DataGrid$th.defaultColDef,
1515
- componentsProp = _reactCtx$DataGrid$th.components,
1516
- sideBarProp = _reactCtx$DataGrid$th.sideBar,
1517
- detailCellRendererParams = _reactCtx$DataGrid$th.detailCellRendererParams,
1518
- context = _reactCtx$DataGrid$th.context,
1519
- showSearch = _reactCtx$DataGrid$th.showSearch,
1520
- cellDisplayFlex = _reactCtx$DataGrid$th.cellDisplayFlex,
1521
- restProps = _objectWithoutProperties(_reactCtx$DataGrid$th, _excluded4);
1509
+ var _this$getProps3 = this.getProps(),
1510
+ rowKey = _this$getProps3.rowKey,
1511
+ fetch = _this$getProps3.fetch,
1512
+ dataSource = _this$getProps3.dataSource,
1513
+ rowActions = _this$getProps3.rowActions,
1514
+ columns = _this$getProps3.columns,
1515
+ autoLoad = _this$getProps3.autoLoad,
1516
+ loadingProp = _this$getProps3.loading,
1517
+ summary = _this$getProps3.summary,
1518
+ detailCell = _this$getProps3.detailCell,
1519
+ pagination = _this$getProps3.pagination,
1520
+ rowSelection = _this$getProps3.rowSelection,
1521
+ columnTypesProp = _this$getProps3.columnTypes,
1522
+ defaultColDefProp = _this$getProps3.defaultColDef,
1523
+ componentsProp = _this$getProps3.components,
1524
+ sideBarProp = _this$getProps3.sideBar,
1525
+ detailCellRendererParams = _this$getProps3.detailCellRendererParams,
1526
+ context = _this$getProps3.context,
1527
+ showSearch = _this$getProps3.showSearch,
1528
+ cellDisplayFlex = _this$getProps3.cellDisplayFlex,
1529
+ restProps = _objectWithoutProperties(_this$getProps3, _excluded4);
1522
1530
  var _this$state2 = this.state,
1523
1531
  enablePagination = _this$state2.pagination,
1524
1532
  page = _this$state2.page,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.1.0-alpha.6",
3
+ "version": "1.1.0-alpha.7",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "registry": "https://registry.npmjs.org"
64
64
  },
65
- "gitHead": "2e851869a32c6606e09a1fce15cc4000efb519ce"
65
+ "gitHead": "bf302718b70e867276efdf0f059c34e310c09545"
66
66
  }