easy3wui 1.5.55-beta6 → 1.5.55-beta8
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/lib/Easy3wEditBigTable/index.js +43 -20
- package/package.json +1 -1
|
@@ -96,37 +96,53 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
_this.onRowsSelected = function (rows) {
|
|
99
|
-
var
|
|
99
|
+
var _this$state = _this.state,
|
|
100
|
+
arrValues = _this$state.arrValues,
|
|
101
|
+
arrValuesInfo = _this$state.arrValuesInfo;
|
|
100
102
|
var rowKey = _this.props.rowKey;
|
|
101
103
|
|
|
102
|
-
var arrValuesNew =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
var arrValuesNew = []; // 表格选择行索引
|
|
105
|
+
var arrValuesInfoNew = []; // 表格选择行数据
|
|
106
|
+
rows.map(function (r) {
|
|
107
|
+
arrValuesNew.push(r.row[rowKey]);
|
|
108
|
+
arrValuesInfoNew.push(r.row);
|
|
109
|
+
return r;
|
|
110
|
+
});
|
|
111
|
+
arrValues = arrValues.concat(arrValuesNew); // 表格选择行索引
|
|
112
|
+
arrValuesInfo = arrValuesInfo.concat(arrValuesInfoNew); // 表格选择行数据
|
|
113
|
+
_this.onSelectedRowsChange(arrValues, arrValuesInfo);
|
|
106
114
|
};
|
|
107
115
|
|
|
108
116
|
_this.onRowsDeselected = function (rows) {
|
|
109
|
-
var
|
|
117
|
+
var _this$state2 = _this.state,
|
|
118
|
+
arrValues = _this$state2.arrValues,
|
|
119
|
+
arrValuesInfo = _this$state2.arrValuesInfo;
|
|
110
120
|
var rowKey = _this.props.rowKey;
|
|
111
121
|
|
|
112
|
-
var arrValuesNew =
|
|
122
|
+
var arrValuesNew = []; // 表格选择行索引
|
|
123
|
+
var arrValuesInfoNew = []; // 表格选择行数据
|
|
124
|
+
arrValuesInfo.filter(function (item) {
|
|
113
125
|
var flag = true;
|
|
114
126
|
rows.map(function (r) {
|
|
115
127
|
var row = r.row;
|
|
116
128
|
|
|
117
|
-
if (
|
|
129
|
+
if (item[rowKey] === row[rowKey]) {
|
|
118
130
|
// 删除已取消选择的行
|
|
119
131
|
flag = false;
|
|
120
132
|
}
|
|
121
133
|
return r;
|
|
122
134
|
});
|
|
135
|
+
if (flag) {
|
|
136
|
+
arrValuesNew.push(item[rowKey]);
|
|
137
|
+
arrValuesInfoNew.push(item);
|
|
138
|
+
}
|
|
123
139
|
return flag;
|
|
124
140
|
});
|
|
125
|
-
_this.onSelectedRowsChange(
|
|
141
|
+
_this.onSelectedRowsChange(arrValues, arrValuesInfo);
|
|
126
142
|
};
|
|
127
143
|
|
|
128
|
-
_this.onSelectedRowsChange = function (arrValues) {
|
|
129
|
-
_this.setState({ arrValues: arrValues });
|
|
144
|
+
_this.onSelectedRowsChange = function (arrValues, arrValuesInfo) {
|
|
145
|
+
_this.setState({ arrValues: arrValues, arrValuesInfo: arrValuesInfo });
|
|
130
146
|
};
|
|
131
147
|
|
|
132
148
|
_this.touchAddRow = function () {
|
|
@@ -199,7 +215,7 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
199
215
|
// 数据变更-回调函数
|
|
200
216
|
onGridRowsUpdated('deleteRow', dataListNew);
|
|
201
217
|
}
|
|
202
|
-
_this.onSelectedRowsChange([]); // 选择行清空
|
|
218
|
+
_this.onSelectedRowsChange([], []); // 选择行清空
|
|
203
219
|
} else {
|
|
204
220
|
_modal2['default'].error({
|
|
205
221
|
title: '错误',
|
|
@@ -318,10 +334,10 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
318
334
|
};
|
|
319
335
|
|
|
320
336
|
_this.getRows = function () {
|
|
321
|
-
var _this$
|
|
322
|
-
filters = _this$
|
|
323
|
-
sortColumn = _this$
|
|
324
|
-
sortDirection = _this$
|
|
337
|
+
var _this$state3 = _this.state,
|
|
338
|
+
filters = _this$state3.filters,
|
|
339
|
+
sortColumn = _this$state3.sortColumn,
|
|
340
|
+
sortDirection = _this$state3.sortDirection;
|
|
325
341
|
var _this$props6 = _this.props,
|
|
326
342
|
dataList = _this$props6.dataList,
|
|
327
343
|
enableCellSelect = _this$props6.enableCellSelect,
|
|
@@ -522,14 +538,20 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
522
538
|
// rowIdx:当前行的索引
|
|
523
539
|
|
|
524
540
|
var editable = column.editable,
|
|
525
|
-
editor = column.editor
|
|
541
|
+
editor = column.editor,
|
|
542
|
+
onCheckCellIsEditable = column.onCheckCellIsEditable;
|
|
526
543
|
|
|
544
|
+
var editableFlag = false; // 单元格是否可编辑 true 允许编辑 false 禁止编辑
|
|
527
545
|
if (editable || editor) {
|
|
528
546
|
// 单元格可编辑
|
|
529
|
-
|
|
547
|
+
editableFlag = true;
|
|
548
|
+
if (onCheckCellIsEditable && typeof onCheckCellIsEditable === 'function') {
|
|
549
|
+
editableFlag = onCheckCellIsEditable(obj); // 自定义单元格是否可编辑
|
|
550
|
+
}
|
|
530
551
|
} else {
|
|
531
|
-
|
|
552
|
+
editableFlag = false;
|
|
532
553
|
}
|
|
554
|
+
return editableFlag;
|
|
533
555
|
};
|
|
534
556
|
|
|
535
557
|
_this.touchRowRenderer = function (obj) {
|
|
@@ -582,7 +604,7 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
582
604
|
objReactDataGridProps.enableCellSelect = enableCellSelect;
|
|
583
605
|
objReactDataGridProps.onGridRowsUpdated = _this.onGridRowsUpdated; // 表格编辑
|
|
584
606
|
if (onCheckCellIsEditable) {
|
|
585
|
-
objReactDataGridProps.onCheckCellIsEditable = onCheckCellIsEditable; // 单元格是否可编辑
|
|
607
|
+
objReactDataGridProps.onCheckCellIsEditable = onCheckCellIsEditable || _this.onCheckCellIsEditable; // 单元格是否可编辑
|
|
586
608
|
}
|
|
587
609
|
objReactDataGridProps.rowRenderer = touchRowRenderer || _this.touchRowRenderer; // 表格行渲染
|
|
588
610
|
}
|
|
@@ -703,6 +725,7 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
703
725
|
_this.state = {
|
|
704
726
|
// 表格选择
|
|
705
727
|
arrValues: [], // 表格选择行索引
|
|
728
|
+
arrValuesInfo: [], // 表格选择行数据
|
|
706
729
|
// 查询条件
|
|
707
730
|
filters: {},
|
|
708
731
|
// 排序--sort
|