@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.
- package/es/data-grid/index.d.ts +2 -0
- package/es/data-grid/index.js +48 -40
- package/package.json +2 -2
package/es/data-grid/index.d.ts
CHANGED
|
@@ -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[];
|
package/es/data-grid/index.js
CHANGED
|
@@ -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$
|
|
520
|
-
pagination = _this$
|
|
521
|
-
fetch = _this$
|
|
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$
|
|
553
|
-
columns = _this$
|
|
554
|
-
rowSelection = _this$
|
|
555
|
-
dataSource = _this$
|
|
556
|
-
context = _this$
|
|
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$
|
|
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$
|
|
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$
|
|
779
|
-
mColumnTypes = _this$
|
|
780
|
-
mDefaultColDef = _this$
|
|
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$
|
|
804
|
-
_this$
|
|
805
|
-
columns = _this$
|
|
806
|
-
rowActions = _this$
|
|
807
|
-
rowSelection = _this$
|
|
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
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
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.
|
|
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": "
|
|
65
|
+
"gitHead": "bf302718b70e867276efdf0f059c34e310c09545"
|
|
66
66
|
}
|