easy3wui 1.5.49-beta3 → 1.5.49-beta6

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,7 +114,6 @@ var Easy3wGridPage = function (_Component) {
114
114
  _this.state = {
115
115
  // 数据
116
116
  arrData: arrData, // 列表
117
- arrColumns: [], // 列
118
117
  // 选择
119
118
  selectedRowKeysState: selectedKey || [],
120
119
  selectedRowsState: selectedVal || [],
@@ -125,31 +124,15 @@ var Easy3wGridPage = function (_Component) {
125
124
  }
126
125
 
127
126
  Easy3wGridPage.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
128
- var _props = this.props,
129
- _props$dataList = _props.dataList,
130
- dataList = _props$dataList === undefined ? [] : _props$dataList,
131
- _props$columns = _props.columns,
132
- columns = _props$columns === undefined ? [] : _props$columns;
133
-
134
- var arrDataFlag = false;
135
- var arrColumnsFlag = false;
136
- var objSetData = {};
137
- if (nextProps.dataList && nextProps.dataList.length !== dataList.length || JSON.stringify(nextProps.dataList) !== JSON.stringify(dataList)) {
138
- arrDataFlag = true;
139
- objSetData.arrData = nextProps.dataList && nextProps.dataList.length ? JSON.parse(JSON.stringify(nextProps.dataList)) : [];
140
- // this.setState({
141
- // arrData: nextProps.dataList && nextProps.dataList.length ? JSON.parse(JSON.stringify(nextProps.dataList)) : [],
142
- // });
143
- }
144
- if (nextProps.columns && nextProps.columns.length !== columns.length) {
145
- arrColumnsFlag = true;
146
- objSetData.arrColumns = nextProps.columns && nextProps.columns.length ? this.touchCreateColumns((0, _cloneDeep2['default'])(nextProps.columns)) : [];
147
- // this.setState({
148
- // arrColumns: nextProps.columns && nextProps.columns.length ? this.touchCreateColumns(cloneDeep(nextProps.columns)) : [],
149
- // });
150
- }
151
- if (arrColumnsFlag || arrDataFlag) {
152
- this.setState((0, _extends3['default'])({}, objSetData));
127
+ var _props$dataList = this.props.dataList,
128
+ dataList = _props$dataList === undefined ? [] : _props$dataList;
129
+ var _nextProps$dataList = nextProps.dataList,
130
+ nextDataList = _nextProps$dataList === undefined ? [] : _nextProps$dataList;
131
+
132
+ if (nextDataList.length !== dataList.length || JSON.stringify(nextDataList) !== JSON.stringify(dataList)) {
133
+ this.setState({
134
+ arrData: nextDataList.length ? JSON.parse(JSON.stringify(nextDataList)) : []
135
+ });
153
136
  }
154
137
  if (nextProps.cleanFlag === '1') {
155
138
  this.delAll();
@@ -167,26 +150,26 @@ var Easy3wGridPage = function (_Component) {
167
150
  Easy3wGridPage.prototype.render = function render() {
168
151
  var _this2 = this;
169
152
 
170
- var _props2 = this.props,
171
- columns = _props2.columns,
172
- loading = _props2.loading,
173
- getCheckboxProps = _props2.getCheckboxProps,
174
- needPaginationFlag = _props2.needPaginationFlag,
175
- gridProps = _props2.gridProps,
176
- totalResult = _props2.totalResult,
177
- rowKey = _props2.rowKey,
178
- checkType = _props2.checkType,
179
- bordered = _props2.bordered,
180
- chooseFlag = _props2.chooseFlag,
181
- scroll = _props2.scroll,
182
- className = _props2.className,
183
- paginationInfo = _props2.paginationInfo;
153
+ var _props = this.props,
154
+ columns = _props.columns,
155
+ loading = _props.loading,
156
+ getCheckboxProps = _props.getCheckboxProps,
157
+ needPaginationFlag = _props.needPaginationFlag,
158
+ gridProps = _props.gridProps,
159
+ totalResult = _props.totalResult,
160
+ rowKey = _props.rowKey,
161
+ checkType = _props.checkType,
162
+ bordered = _props.bordered,
163
+ chooseFlag = _props.chooseFlag,
164
+ scroll = _props.scroll,
165
+ className = _props.className,
166
+ paginationInfo = _props.paginationInfo;
184
167
  var arrData = this.state.arrData;
185
168
  // [].concat(arrA)
186
169
  // const arrColumns = this.touchCreateColumns([].concat(columns));
187
170
  // const arrColumns = this.touchCreateColumns(JSON.parse(JSON.stringify(columns)));
188
171
 
189
- var arrColumns = this.touchCreateColumns((0, _cloneDeep2['default'])(columns));
172
+ var arrColumns = this.touchCreateColumns(columns);
190
173
  // const arrColumns = this.touchCreateColumns(columns);
191
174
  var _state = this.state,
192
175
  selectedRowKeysState = _state.selectedRowKeysState,
@@ -261,7 +244,7 @@ var Easy3wGridPage = function (_Component) {
261
244
  { className: gridProps || this.props.rowType ? gridProps.onRow || this.props.rowType ? 'onRow' : null : null },
262
245
  _react2['default'].createElement(_table2['default'], (0, _extends3['default'])({
263
246
  className: printFlag ? 'scrollPrint' : className || 'scrollX',
264
- columns: this.state.arrColumns && this.state.arrColumns.length ? this.state.arrColumns : arrColumns,
247
+ columns: arrColumns,
265
248
  dataSource: arrData,
266
249
  pagination: paginationProps,
267
250
  loading: loading,
@@ -302,11 +285,11 @@ var _initialiseProps = function _initialiseProps() {
302
285
  var _state2 = _this3.state,
303
286
  selectedRowKeysState = _state2.selectedRowKeysState,
304
287
  selectedRowsState = _state2.selectedRowsState;
305
- var _props3 = _this3.props,
306
- rowKey = _props3.rowKey,
307
- rowKeyCname = _props3.rowKeyCname,
308
- selectChangeCallback = _props3.selectChangeCallback,
309
- chooseFlag = _props3.chooseFlag;
288
+ var _props2 = _this3.props,
289
+ rowKey = _props2.rowKey,
290
+ rowKeyCname = _props2.rowKeyCname,
291
+ selectChangeCallback = _props2.selectChangeCallback,
292
+ chooseFlag = _props2.chooseFlag;
310
293
 
311
294
  selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
312
295
  return selectedRowKey === closeKey;
@@ -343,11 +326,11 @@ var _initialiseProps = function _initialiseProps() {
343
326
 
344
327
  var selectedRowKeysStateArr = selectedRowKeysState;
345
328
  var selectedRowsStateArr = selectedRowsState;
346
- var _props4 = _this3.props,
347
- rowKey = _props4.rowKey,
348
- rowKeyCname = _props4.rowKeyCname,
349
- selectChangeCallback = _props4.selectChangeCallback,
350
- chooseFlag = _props4.chooseFlag;
329
+ var _props3 = _this3.props,
330
+ rowKey = _props3.rowKey,
331
+ rowKeyCname = _props3.rowKeyCname,
332
+ selectChangeCallback = _props3.selectChangeCallback,
333
+ chooseFlag = _props3.chooseFlag;
351
334
 
352
335
  var newSelRowKeysTags = [];
353
336
  selectedRowKeysStateArr.splice(selectedRowKeysStateArr.findIndex(function (selectedRowKey) {
@@ -394,12 +377,12 @@ var _initialiseProps = function _initialiseProps() {
394
377
  var _state4 = _this3.state,
395
378
  selectedRowKeysState = _state4.selectedRowKeysState,
396
379
  selectedRowsState = _state4.selectedRowsState;
397
- var _props5 = _this3.props,
398
- rowKey = _props5.rowKey,
399
- rowKeyCname = _props5.rowKeyCname,
400
- selectChangeCallback = _props5.selectChangeCallback,
401
- chooseFlag = _props5.chooseFlag,
402
- checkType = _props5.checkType;
380
+ var _props4 = _this3.props,
381
+ rowKey = _props4.rowKey,
382
+ rowKeyCname = _props4.rowKeyCname,
383
+ selectChangeCallback = _props4.selectChangeCallback,
384
+ chooseFlag = _props4.chooseFlag,
385
+ checkType = _props4.checkType;
403
386
 
404
387
  if (checkType === 'radio') {
405
388
  selectedRowKeysState = [];
@@ -435,11 +418,11 @@ var _initialiseProps = function _initialiseProps() {
435
418
  var _state5 = _this3.state,
436
419
  selectedRowKeysState = _state5.selectedRowKeysState,
437
420
  selectedRowsState = _state5.selectedRowsState;
438
- var _props6 = _this3.props,
439
- rowKey = _props6.rowKey,
440
- rowKeyCname = _props6.rowKeyCname,
441
- selectChangeCallback = _props6.selectChangeCallback,
442
- chooseFlag = _props6.chooseFlag;
421
+ var _props5 = _this3.props,
422
+ rowKey = _props5.rowKey,
423
+ rowKeyCname = _props5.rowKeyCname,
424
+ selectChangeCallback = _props5.selectChangeCallback,
425
+ chooseFlag = _props5.chooseFlag;
443
426
 
444
427
  removeRows.forEach(function (removeRow) {
445
428
  selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
@@ -512,11 +495,11 @@ var _initialiseProps = function _initialiseProps() {
512
495
 
513
496
  var selectedRowKeysStateArr = selectedRowKeysState;
514
497
  var selectedRowsStateArr = selectedRowsState;
515
- var _props7 = _this3.props,
516
- rowKey = _props7.rowKey,
517
- rowKeyCname = _props7.rowKeyCname,
518
- selectChangeCallback = _props7.selectChangeCallback,
519
- chooseFlag = _props7.chooseFlag;
498
+ var _props6 = _this3.props,
499
+ rowKey = _props6.rowKey,
500
+ rowKeyCname = _props6.rowKeyCname,
501
+ selectChangeCallback = _props6.selectChangeCallback,
502
+ chooseFlag = _props6.chooseFlag;
520
503
 
521
504
  var flag = false;
522
505
  var newSelRowKeysTags = [];
@@ -585,10 +568,10 @@ var _initialiseProps = function _initialiseProps() {
585
568
  };
586
569
 
587
570
  this.handleTableChange = function (pagination) {
588
- var _props8 = _this3.props,
589
- selfDealPageChangeFunc = _props8.selfDealPageChangeFunc,
590
- getSearchCondition = _props8.getSearchCondition,
591
- handleSearch = _props8.handleSearch;
571
+ var _props7 = _this3.props,
572
+ selfDealPageChangeFunc = _props7.selfDealPageChangeFunc,
573
+ getSearchCondition = _props7.getSearchCondition,
574
+ handleSearch = _props7.handleSearch;
592
575
 
593
576
  var formVal = getSearchCondition();
594
577
  var paginationInfo = { offset: pagination.current, limit: pagination.pageSize };
@@ -677,10 +660,10 @@ var _initialiseProps = function _initialiseProps() {
677
660
  };
678
661
 
679
662
  this.touchCreateColumns = function (columns) {
680
- var _props9 = _this3.props,
681
- dataList = _props9.dataList,
682
- autoAddNumber = _props9.autoAddNumber,
683
- paginationInfo = _props9.paginationInfo;
663
+ var _props8 = _this3.props,
664
+ dataList = _props8.dataList,
665
+ autoAddNumber = _props8.autoAddNumber,
666
+ paginationInfo = _props8.paginationInfo;
684
667
  var arrData = _this3.state.arrData;
685
668
 
686
669
  var current = paginationInfo ? paginationInfo.offset : _this3.state.pagination.offset;
@@ -689,7 +672,8 @@ var _initialiseProps = function _initialiseProps() {
689
672
  var printValue = _this3.props.printValue || 'print';
690
673
  var printFlag = printArr[1] === printValue;
691
674
  var recursion = function recursion(arr) {
692
- arr.forEach(function (item) {
675
+ return arr.map(function (item) {
676
+ var itemNew = {};
693
677
  var columnsType = item.type;
694
678
  if (item.fixed && printFlag) {
695
679
  item.fixed = null;
@@ -710,12 +694,15 @@ var _initialiseProps = function _initialiseProps() {
710
694
  break;
711
695
  }
712
696
  if (item.children) {
713
- recursion(item.children);
697
+ itemNew.children = [].concat(recursion(item.children));
714
698
  }
699
+ itemNew = (0, _extends3['default'])({}, item);
700
+ return itemNew;
715
701
  });
716
702
  };
717
703
  var recursionT = function recursionT(arr) {
718
- arr.forEach(function (item) {
704
+ return arr.map(function (item) {
705
+ var itemNew = {};
719
706
  if (item.fixed && printFlag) {
720
707
  item.fixed = null;
721
708
  }
@@ -797,19 +784,21 @@ var _initialiseProps = function _initialiseProps() {
797
784
  item.minWidth = 5;
798
785
  }
799
786
  if (item.children) {
800
- recursionT(item.children);
787
+ itemNew.children = [].concat(recursionT(item.children));
801
788
  }
789
+ itemNew = (0, _extends3['default'])({}, item);
790
+ return itemNew;
802
791
  });
803
792
  };
804
- recursion(columns);
793
+ var columnsNew = recursion(columns);
805
794
  if (dataList) {
806
795
  if (dataList.length > 0) {
807
- recursionT(columns);
796
+ columnsNew = recursionT(columns);
808
797
  }
809
798
  }
810
- var columnsNew = columns;
799
+ // let columnsNew = columns;
811
800
  if (autoAddNumber) {
812
- if (columns.length > 0) {
801
+ if (columnsNew.length > 0) {
813
802
  columnsNew = [{
814
803
  title: '序号',
815
804
  dataIndex: 'number',
@@ -822,7 +811,7 @@ var _initialiseProps = function _initialiseProps() {
822
811
  ' '
823
812
  );
824
813
  }
825
- }].concat(columns);
814
+ }].concat(columnsNew);
826
815
  }
827
816
  }
828
817
  return columnsNew;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wui",
3
- "version": "1.5.49-beta3",
3
+ "version": "1.5.49-beta6",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",