easy3wui 1.5.55-beta5 → 1.5.55-beta7
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 +37 -19
- 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,9 +538,10 @@ 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
|
|
|
527
|
-
if (editable || editor) {
|
|
544
|
+
if (editable || editor || onCheckCellIsEditable(obj)) {
|
|
528
545
|
// 单元格可编辑
|
|
529
546
|
return true; // 返回 true 表示允许编辑
|
|
530
547
|
} else {
|
|
@@ -582,7 +599,7 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
582
599
|
objReactDataGridProps.enableCellSelect = enableCellSelect;
|
|
583
600
|
objReactDataGridProps.onGridRowsUpdated = _this.onGridRowsUpdated; // 表格编辑
|
|
584
601
|
if (onCheckCellIsEditable) {
|
|
585
|
-
objReactDataGridProps.onCheckCellIsEditable = onCheckCellIsEditable; // 单元格是否可编辑
|
|
602
|
+
objReactDataGridProps.onCheckCellIsEditable = onCheckCellIsEditable || _this.onCheckCellIsEditable; // 单元格是否可编辑
|
|
586
603
|
}
|
|
587
604
|
objReactDataGridProps.rowRenderer = touchRowRenderer || _this.touchRowRenderer; // 表格行渲染
|
|
588
605
|
}
|
|
@@ -703,6 +720,7 @@ var Easy3wEditBigTable = function (_Component) {
|
|
|
703
720
|
_this.state = {
|
|
704
721
|
// 表格选择
|
|
705
722
|
arrValues: [], // 表格选择行索引
|
|
723
|
+
arrValuesInfo: [], // 表格选择行数据
|
|
706
724
|
// 查询条件
|
|
707
725
|
filters: {},
|
|
708
726
|
// 排序--sort
|