@clake/react-bootstrap4-window 0.7.4 → 0.7.5
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/dist/react-bootstrap4-window.js +3 -3
- package/lib/CTable.js +119 -116
- package/lib/CTable.js.map +3 -3
- package/lib/CTableInput.js +2 -2
- package/lib/CTableInput.js.map +2 -2
- package/lib/Drag.js +2 -2
- package/lib/Drag.js.map +2 -2
- package/lib/IconButton.js +2 -2
- package/lib/IconButton.js.map +2 -2
- package/lib/PageBar.js +2 -2
- package/lib/PageBar.js.map +2 -2
- package/lib/TopMenu.js +2 -2
- package/lib/TopMenu.js.map +2 -2
- package/lib/WCalendar.js +2 -2
- package/lib/WCalendar.js.map +2 -2
- package/lib/WCombo.js +2 -2
- package/lib/WCombo.js.map +2 -2
- package/lib/WModal.js +2 -2
- package/lib/WModal.js.map +2 -2
- package/lib/Window.js +2 -2
- package/lib/Window.js.map +2 -2
- package/lib/WindowGroup.js +2 -2
- package/lib/WindowGroup.js.map +2 -2
- package/lib/i18n/CTable.js +2 -2
- package/lib/i18n/CTable.js.map +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/lib/CTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @clake/react-bootstrap4-window v0.7.
|
|
1
|
+
/* @clake/react-bootstrap4-window v0.7.5 | by Clake
|
|
2
2
|
* Copyright (c) 2024 Clake,
|
|
3
|
-
* 2024-03-
|
|
3
|
+
* 2024-03-15T10:28:01+0800
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
@@ -86,11 +86,7 @@ function (_React$Component) {
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
_defineProperty(_assertThisInitialized(_this), "selectAll", function (checked) {
|
|
89
|
-
_this.select_all = checked;
|
|
90
|
-
// item.setChecked(this.select_all);
|
|
91
|
-
// this.setRowCheck(this.select_all,idx);
|
|
92
|
-
// });
|
|
93
|
-
|
|
89
|
+
_this.select_all = checked;
|
|
94
90
|
var selectRows = [];
|
|
95
91
|
|
|
96
92
|
if (checked) {
|
|
@@ -103,6 +99,10 @@ function (_React$Component) {
|
|
|
103
99
|
selectRows: selectRows,
|
|
104
100
|
selectAll: checked,
|
|
105
101
|
selectHalf: false
|
|
102
|
+
}, function () {
|
|
103
|
+
if (typeof _this.props.onCheckAll === 'function') {
|
|
104
|
+
_this.props.onCheckAll(_this.state.selectAll, _this.state.data);
|
|
105
|
+
}
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -803,33 +803,31 @@ function (_React$Component) {
|
|
|
803
803
|
value: function getSelectRows() {
|
|
804
804
|
var _this10 = this;
|
|
805
805
|
|
|
806
|
-
return this.selectRows.map(function (item) {
|
|
806
|
+
return this.state.selectRows.map(function (item) {
|
|
807
807
|
return _this10.state.data[item];
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
810
|
/**
|
|
811
811
|
* 设置选中的行
|
|
812
|
-
* @param key 对应行数据的KEY值
|
|
813
|
-
* @param list 要选中的数据值
|
|
812
|
+
* @param {string} key 对应行数据的KEY值
|
|
813
|
+
* @param {array} list 要选中的数据值
|
|
814
814
|
*/
|
|
815
815
|
|
|
816
816
|
}, {
|
|
817
817
|
key: "setSelectRows",
|
|
818
818
|
value: function setSelectRows(key, list) {
|
|
819
|
-
var
|
|
820
|
-
|
|
819
|
+
var selectRows = [];
|
|
821
820
|
this.state.data.forEach(function (row, i) {
|
|
822
|
-
if (list.
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
_this11.setRowCheck(true, i);
|
|
826
|
-
} else {
|
|
827
|
-
_this11.refs['row_' + i].setChecked(false);
|
|
828
|
-
|
|
829
|
-
_this11.setRowCheck(false, i);
|
|
821
|
+
if (list.includes(row[key])) {
|
|
822
|
+
selectRows.push(i);
|
|
830
823
|
}
|
|
831
824
|
});
|
|
832
|
-
this.
|
|
825
|
+
var selectAll = selectRows.length > 1 && selectRows.length === this.state.data.length;
|
|
826
|
+
this.setState({
|
|
827
|
+
selectRows: selectRows,
|
|
828
|
+
selectHalf: !selectAll,
|
|
829
|
+
selectAll: selectAll
|
|
830
|
+
});
|
|
833
831
|
}
|
|
834
832
|
/**
|
|
835
833
|
* binding column split
|
|
@@ -838,50 +836,50 @@ function (_React$Component) {
|
|
|
838
836
|
}, {
|
|
839
837
|
key: "bindSplit",
|
|
840
838
|
value: function bindSplit() {
|
|
841
|
-
var
|
|
839
|
+
var _this11 = this;
|
|
842
840
|
|
|
843
841
|
if (this.props.move) {
|
|
844
842
|
this.headerSplits.forEach(function (split) {
|
|
845
|
-
if (!
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
843
|
+
if (!_this11.drag) {
|
|
844
|
+
_this11.dragColumnLeft = 0;
|
|
845
|
+
_this11.dragWidth = 0;
|
|
846
|
+
_this11.drag = new _Drag["default"](_this11.split, split, {
|
|
849
847
|
start: function start(dragDom, eventDom) {
|
|
850
|
-
var xy = _reactBootstrap.Common.GetDomXY(eventDom,
|
|
848
|
+
var xy = _reactBootstrap.Common.GetDomXY(eventDom, _this11.mainDom);
|
|
851
849
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
dragDom.style.left =
|
|
850
|
+
_this11.dragWidth = parseInt(eventDom.parentNode.style.width);
|
|
851
|
+
_this11.dragColumnLeft = xy.left - _this11.table_rows.scrollLeft;
|
|
852
|
+
dragDom.style.left = _this11.dragColumnLeft + 'px';
|
|
855
853
|
dragDom.classList.remove('d-none');
|
|
856
854
|
return true;
|
|
857
855
|
},
|
|
858
856
|
move: function move(_move, dragDom, eventDom) {
|
|
859
|
-
if (
|
|
860
|
-
_move.x =
|
|
857
|
+
if (_this11.dragWidth + (_move.x - _this11.dragColumnLeft) < 50) {
|
|
858
|
+
_move.x = _this11.dragColumnLeft - _this11.dragWidth + 50;
|
|
861
859
|
}
|
|
862
860
|
},
|
|
863
861
|
end: function end(dragDom, eventDom) {
|
|
864
862
|
dragDom.classList.add('d-none');
|
|
865
863
|
var column_key = eventDom.dataset.key;
|
|
866
864
|
|
|
867
|
-
var diff = parseInt(dragDom.style.left) -
|
|
865
|
+
var diff = parseInt(dragDom.style.left) - _this11.dragColumnLeft;
|
|
868
866
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
867
|
+
_this11.width = parseInt(_this11.width) + diff + 'px';
|
|
868
|
+
_this11.table_head.style.width = _this11.width;
|
|
869
|
+
_this11.table_body.style.width = _this11.width;
|
|
872
870
|
|
|
873
|
-
if (
|
|
874
|
-
|
|
871
|
+
if (_this11.table_total) {
|
|
872
|
+
_this11.table_total.style.width = _this11.width;
|
|
875
873
|
}
|
|
876
874
|
|
|
877
875
|
document.querySelectorAll("#".concat(column_key)).forEach(function (item) {
|
|
878
|
-
item.style.width = "".concat(
|
|
876
|
+
item.style.width = "".concat(_this11.dragWidth + diff, "px");
|
|
879
877
|
});
|
|
880
878
|
return true;
|
|
881
879
|
}
|
|
882
880
|
});
|
|
883
881
|
} else {
|
|
884
|
-
|
|
882
|
+
_this11.drag.setEventDom(split);
|
|
885
883
|
}
|
|
886
884
|
});
|
|
887
885
|
}
|
|
@@ -1020,20 +1018,20 @@ function (_React$Component) {
|
|
|
1020
1018
|
}, {
|
|
1021
1019
|
key: "calcLocalTotal",
|
|
1022
1020
|
value: function calcLocalTotal(field) {
|
|
1023
|
-
var
|
|
1021
|
+
var _this12 = this;
|
|
1024
1022
|
|
|
1025
1023
|
return function (e) {
|
|
1026
|
-
var list =
|
|
1024
|
+
var list = _this12.state.data;
|
|
1027
1025
|
var total = 0;
|
|
1028
1026
|
list.forEach(function (item) {
|
|
1029
1027
|
if (!!parseFloat(item[field])) {
|
|
1030
1028
|
total += parseFloat(item[field]);
|
|
1031
1029
|
}
|
|
1032
1030
|
});
|
|
1033
|
-
var totalData = Object.assign({},
|
|
1031
|
+
var totalData = Object.assign({}, _this12.state.total);
|
|
1034
1032
|
totalData[field] = total.toFixed(2);
|
|
1035
1033
|
|
|
1036
|
-
|
|
1034
|
+
_this12.setState({
|
|
1037
1035
|
total: totalData
|
|
1038
1036
|
});
|
|
1039
1037
|
};
|
|
@@ -1041,11 +1039,11 @@ function (_React$Component) {
|
|
|
1041
1039
|
}, {
|
|
1042
1040
|
key: "render",
|
|
1043
1041
|
value: function render() {
|
|
1044
|
-
var
|
|
1042
|
+
var _this13 = this;
|
|
1045
1043
|
|
|
1046
1044
|
return _react["default"].createElement("div", {
|
|
1047
1045
|
ref: function ref(c) {
|
|
1048
|
-
return
|
|
1046
|
+
return _this13.mainDom = c;
|
|
1049
1047
|
},
|
|
1050
1048
|
className: this.getMainClasses(),
|
|
1051
1049
|
style: this.getStyles()
|
|
@@ -1057,7 +1055,7 @@ function (_React$Component) {
|
|
|
1057
1055
|
selector: "#table-body-com-".concat(this.domId)
|
|
1058
1056
|
})), this.renderFoot(), _react["default"].createElement("div", {
|
|
1059
1057
|
ref: function ref(c) {
|
|
1060
|
-
return
|
|
1058
|
+
return _this13.split = c;
|
|
1061
1059
|
},
|
|
1062
1060
|
className: "ck-split d-none"
|
|
1063
1061
|
}));
|
|
@@ -1065,15 +1063,15 @@ function (_React$Component) {
|
|
|
1065
1063
|
}, {
|
|
1066
1064
|
key: "renderHeader",
|
|
1067
1065
|
value: function renderHeader() {
|
|
1068
|
-
var
|
|
1066
|
+
var _this14 = this;
|
|
1069
1067
|
|
|
1070
1068
|
return _react["default"].createElement("div", {
|
|
1071
1069
|
ref: function ref(c) {
|
|
1072
|
-
return
|
|
1070
|
+
return _this14.tableHeader = c;
|
|
1073
1071
|
}
|
|
1074
1072
|
}, _react["default"].createElement("table", {
|
|
1075
1073
|
ref: function ref(c) {
|
|
1076
|
-
return
|
|
1074
|
+
return _this14.table_head = c;
|
|
1077
1075
|
},
|
|
1078
1076
|
id: "table-head-".concat(this.domId),
|
|
1079
1077
|
className: this.getClasses(),
|
|
@@ -1089,13 +1087,13 @@ function (_React$Component) {
|
|
|
1089
1087
|
icon: "list"
|
|
1090
1088
|
}) : _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1091
1089
|
ref: function ref(c) {
|
|
1092
|
-
return
|
|
1090
|
+
return _this14.allchk = c;
|
|
1093
1091
|
},
|
|
1094
1092
|
onChange: this.selectAll,
|
|
1095
1093
|
checked: this.state.selectAll,
|
|
1096
1094
|
half: this.state.selectHalf
|
|
1097
1095
|
})) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1098
|
-
|
|
1096
|
+
_this14.cacheRow[item.props.field] = '';
|
|
1099
1097
|
|
|
1100
1098
|
if (!item || item.props.hide) {
|
|
1101
1099
|
return null;
|
|
@@ -1112,28 +1110,28 @@ function (_React$Component) {
|
|
|
1112
1110
|
|
|
1113
1111
|
var sort_icon = '';
|
|
1114
1112
|
|
|
1115
|
-
if (
|
|
1116
|
-
sort_icon = 'sort-alpha-' + (
|
|
1113
|
+
if (_this14.sortList[item.props.field]) {
|
|
1114
|
+
sort_icon = 'sort-alpha-' + (_this14.sortList[item.props.field] === 'asc' ? 'down' : 'up');
|
|
1117
1115
|
}
|
|
1118
1116
|
|
|
1119
1117
|
return _react["default"].createElement("th", {
|
|
1120
|
-
onContextMenu:
|
|
1121
|
-
id:
|
|
1118
|
+
onContextMenu: _this14.menuContextHandler,
|
|
1119
|
+
id: _this14.domId + '-' + key,
|
|
1122
1120
|
"data-key": 'head_' + key,
|
|
1123
1121
|
style: style
|
|
1124
|
-
},
|
|
1122
|
+
}, _this14.is_sort ? _react["default"].createElement("a", {
|
|
1125
1123
|
className: "ck-ctable-sort",
|
|
1126
1124
|
href: "javascript://",
|
|
1127
|
-
id: "".concat(
|
|
1125
|
+
id: "".concat(_this14.domId, "-sort-").concat(item.props.field),
|
|
1128
1126
|
"data-field": item.props.field,
|
|
1129
|
-
onClick:
|
|
1127
|
+
onClick: _this14.sortHandler
|
|
1130
1128
|
}, item.props.text, " ", _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1131
1129
|
icon: sort_icon
|
|
1132
|
-
})) : item.props.text,
|
|
1130
|
+
})) : item.props.text, _this14.props.move ? _react["default"].createElement("span", {
|
|
1133
1131
|
ref: function ref(c) {
|
|
1134
|
-
return
|
|
1132
|
+
return _this14.headerSplits.push(c);
|
|
1135
1133
|
},
|
|
1136
|
-
"data-key":
|
|
1134
|
+
"data-key": _this14.domId + '-' + key,
|
|
1137
1135
|
className: "ck-column-split"
|
|
1138
1136
|
}) : null);
|
|
1139
1137
|
})))));
|
|
@@ -1141,34 +1139,34 @@ function (_React$Component) {
|
|
|
1141
1139
|
}, {
|
|
1142
1140
|
key: "renderRows",
|
|
1143
1141
|
value: function renderRows() {
|
|
1144
|
-
var
|
|
1142
|
+
var _this15 = this;
|
|
1145
1143
|
|
|
1146
1144
|
return _react["default"].createElement("div", {
|
|
1147
1145
|
ref: function ref(c) {
|
|
1148
|
-
return
|
|
1146
|
+
return _this15.table_rows = c;
|
|
1149
1147
|
},
|
|
1150
1148
|
id: "table-body-com-".concat(this.domId),
|
|
1151
1149
|
className: "flex-grow-1 rows",
|
|
1152
1150
|
onScroll: this.scrollHandler
|
|
1153
1151
|
}, _react["default"].createElement("table", {
|
|
1154
1152
|
ref: function ref(c) {
|
|
1155
|
-
return
|
|
1153
|
+
return _this15.table_body = c;
|
|
1156
1154
|
},
|
|
1157
1155
|
id: "table-body-".concat(this.domId),
|
|
1158
1156
|
className: this.getClasses(),
|
|
1159
1157
|
style: this.getTableStyles()
|
|
1160
1158
|
}, _react["default"].createElement("tbody", null, this.state.data.map(function (row, i) {
|
|
1161
|
-
if (
|
|
1162
|
-
return
|
|
1159
|
+
if (_this15.props.edit) {
|
|
1160
|
+
return _this15.renderEditRow(row, i);
|
|
1163
1161
|
}
|
|
1164
1162
|
|
|
1165
|
-
return
|
|
1163
|
+
return _this15.renderRow(row, i);
|
|
1166
1164
|
}), this.props.edit ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
|
|
1167
1165
|
}
|
|
1168
1166
|
}, {
|
|
1169
1167
|
key: "renderRow",
|
|
1170
1168
|
value: function renderRow(row, i, parentRow) {
|
|
1171
|
-
var
|
|
1169
|
+
var _this16 = this;
|
|
1172
1170
|
|
|
1173
1171
|
var checked = this.state.selectRows.indexOf(i) !== -1;
|
|
1174
1172
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
@@ -1189,9 +1187,9 @@ function (_React$Component) {
|
|
|
1189
1187
|
} //set style
|
|
1190
1188
|
|
|
1191
1189
|
|
|
1192
|
-
var style = _objectSpread({},
|
|
1190
|
+
var style = _objectSpread({}, _this16.props.columnStyle);
|
|
1193
1191
|
|
|
1194
|
-
style.textAlign = item.props.align ||
|
|
1192
|
+
style.textAlign = item.props.align || _this16.props.align;
|
|
1195
1193
|
|
|
1196
1194
|
if (item.props.width) {
|
|
1197
1195
|
style.width = item.props.width;
|
|
@@ -1214,8 +1212,8 @@ function (_React$Component) {
|
|
|
1214
1212
|
|
|
1215
1213
|
if (item.props.children) {
|
|
1216
1214
|
return _react["default"].createElement("td", {
|
|
1217
|
-
onContextMenu:
|
|
1218
|
-
id:
|
|
1215
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1216
|
+
id: _this16.domId + '-' + key,
|
|
1219
1217
|
"data-row": "".concat(i),
|
|
1220
1218
|
"data-field": item.props.field,
|
|
1221
1219
|
className: item.props.className,
|
|
@@ -1234,8 +1232,8 @@ function (_React$Component) {
|
|
|
1234
1232
|
}
|
|
1235
1233
|
|
|
1236
1234
|
return _react["default"].createElement("td", {
|
|
1237
|
-
onContextMenu:
|
|
1238
|
-
id:
|
|
1235
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1236
|
+
id: _this16.domId + '-' + key,
|
|
1239
1237
|
"data-field": item.props.field,
|
|
1240
1238
|
style: style,
|
|
1241
1239
|
onClick: function onClick(e) {
|
|
@@ -1249,14 +1247,14 @@ function (_React$Component) {
|
|
|
1249
1247
|
}
|
|
1250
1248
|
},
|
|
1251
1249
|
"data-row": "".concat(i)
|
|
1252
|
-
}, item.props.type ?
|
|
1250
|
+
}, item.props.type ? _this16.renderEditComponent(item.props, row, i) : item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field]);
|
|
1253
1251
|
}
|
|
1254
1252
|
})));
|
|
1255
1253
|
}
|
|
1256
1254
|
}, {
|
|
1257
1255
|
key: "renderEditRow",
|
|
1258
1256
|
value: function renderEditRow(row, i) {
|
|
1259
|
-
var
|
|
1257
|
+
var _this17 = this;
|
|
1260
1258
|
|
|
1261
1259
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1262
1260
|
className: this.props.onClick ? 'click-row' : null,
|
|
@@ -1276,9 +1274,9 @@ function (_React$Component) {
|
|
|
1276
1274
|
} //set style
|
|
1277
1275
|
|
|
1278
1276
|
|
|
1279
|
-
var style = _objectSpread({},
|
|
1277
|
+
var style = _objectSpread({}, _this17.props.columnStyle);
|
|
1280
1278
|
|
|
1281
|
-
style.textAlign = item.props.align ||
|
|
1279
|
+
style.textAlign = item.props.align || _this17.props.align;
|
|
1282
1280
|
|
|
1283
1281
|
if (item.props.width) {
|
|
1284
1282
|
style.width = item.props.width;
|
|
@@ -1286,9 +1284,9 @@ function (_React$Component) {
|
|
|
1286
1284
|
|
|
1287
1285
|
var dataType = 'text';
|
|
1288
1286
|
return _react["default"].createElement("td", {
|
|
1289
|
-
onContextMenu:
|
|
1287
|
+
onContextMenu: _this17.menuContextHandler(dataType),
|
|
1290
1288
|
className: item.props.disabled ? 'disabled' : '',
|
|
1291
|
-
id:
|
|
1289
|
+
id: _this17.domId + '-' + key,
|
|
1292
1290
|
"data-field": item.props.field,
|
|
1293
1291
|
style: style,
|
|
1294
1292
|
onClick: function onClick(e) {
|
|
@@ -1302,13 +1300,13 @@ function (_React$Component) {
|
|
|
1302
1300
|
}
|
|
1303
1301
|
},
|
|
1304
1302
|
"data-row": "".concat(i)
|
|
1305
|
-
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] :
|
|
1303
|
+
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] : _this17.renderEditComponent(item.props, row, i));
|
|
1306
1304
|
})));
|
|
1307
1305
|
}
|
|
1308
1306
|
}, {
|
|
1309
1307
|
key: "renderEditAddRow",
|
|
1310
1308
|
value: function renderEditAddRow() {
|
|
1311
|
-
var
|
|
1309
|
+
var _this18 = this;
|
|
1312
1310
|
|
|
1313
1311
|
return _react["default"].createElement("tr", {
|
|
1314
1312
|
id: this.domId + '-edit'
|
|
@@ -1330,14 +1328,14 @@ function (_React$Component) {
|
|
|
1330
1328
|
return _react["default"].createElement("td", {
|
|
1331
1329
|
style: style
|
|
1332
1330
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1333
|
-
onFocus:
|
|
1331
|
+
onFocus: _this18.addNewHandler
|
|
1334
1332
|
}));
|
|
1335
1333
|
}));
|
|
1336
1334
|
}
|
|
1337
1335
|
}, {
|
|
1338
1336
|
key: "renderEditComponent",
|
|
1339
1337
|
value: function renderEditComponent(item, row, i) {
|
|
1340
|
-
var
|
|
1338
|
+
var _this19 = this;
|
|
1341
1339
|
|
|
1342
1340
|
switch (item.type) {
|
|
1343
1341
|
case "combo":
|
|
@@ -1369,7 +1367,7 @@ function (_React$Component) {
|
|
|
1369
1367
|
className: "d-inline",
|
|
1370
1368
|
width: "20px",
|
|
1371
1369
|
onChange: function onChange(chk, e) {
|
|
1372
|
-
|
|
1370
|
+
_this19.editHandler(e, chk, 'chk');
|
|
1373
1371
|
},
|
|
1374
1372
|
"data-row": i,
|
|
1375
1373
|
"data-field": item.field,
|
|
@@ -1409,7 +1407,7 @@ function (_React$Component) {
|
|
|
1409
1407
|
}, {
|
|
1410
1408
|
key: "renderTotal",
|
|
1411
1409
|
value: function renderTotal() {
|
|
1412
|
-
var
|
|
1410
|
+
var _this20 = this;
|
|
1413
1411
|
|
|
1414
1412
|
if (!this.state.total) {
|
|
1415
1413
|
return null;
|
|
@@ -1418,12 +1416,12 @@ function (_React$Component) {
|
|
|
1418
1416
|
var total = this.state.total;
|
|
1419
1417
|
return _react["default"].createElement("div", {
|
|
1420
1418
|
ref: function ref(c) {
|
|
1421
|
-
return
|
|
1419
|
+
return _this20.tableTotal = c;
|
|
1422
1420
|
},
|
|
1423
1421
|
className: "ck-ctable-total"
|
|
1424
1422
|
}, _react["default"].createElement("table", {
|
|
1425
1423
|
ref: function ref(c) {
|
|
1426
|
-
return
|
|
1424
|
+
return _this20.table_total = c;
|
|
1427
1425
|
},
|
|
1428
1426
|
id: "table-total-".concat(this.domId),
|
|
1429
1427
|
className: this.getClasses(),
|
|
@@ -1437,7 +1435,7 @@ function (_React$Component) {
|
|
|
1437
1435
|
return null;
|
|
1438
1436
|
}
|
|
1439
1437
|
|
|
1440
|
-
var align = item.props.align ||
|
|
1438
|
+
var align = item.props.align || _this20.props.align;
|
|
1441
1439
|
var style = {
|
|
1442
1440
|
'textAlign': align
|
|
1443
1441
|
};
|
|
@@ -1447,7 +1445,7 @@ function (_React$Component) {
|
|
|
1447
1445
|
}
|
|
1448
1446
|
|
|
1449
1447
|
return _react["default"].createElement("td", {
|
|
1450
|
-
id:
|
|
1448
|
+
id: _this20.domId + '-' + key,
|
|
1451
1449
|
"data-field": item.props.field,
|
|
1452
1450
|
style: style
|
|
1453
1451
|
}, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
|
|
@@ -1456,7 +1454,7 @@ function (_React$Component) {
|
|
|
1456
1454
|
}, {
|
|
1457
1455
|
key: "renderMenu",
|
|
1458
1456
|
value: function renderMenu() {
|
|
1459
|
-
var
|
|
1457
|
+
var _this21 = this;
|
|
1460
1458
|
|
|
1461
1459
|
var lang;
|
|
1462
1460
|
|
|
@@ -1475,7 +1473,7 @@ function (_React$Component) {
|
|
|
1475
1473
|
|
|
1476
1474
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1477
1475
|
ref: function ref(c) {
|
|
1478
|
-
return
|
|
1476
|
+
return _this21.mainMenu = c;
|
|
1479
1477
|
},
|
|
1480
1478
|
onClick: this.menuClickHandler
|
|
1481
1479
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1493,7 +1491,7 @@ function (_React$Component) {
|
|
|
1493
1491
|
onClick: function onClick(e, field, data) {
|
|
1494
1492
|
var select = document.getSelection();
|
|
1495
1493
|
|
|
1496
|
-
|
|
1494
|
+
_this21.filterHandler(select.toString(), data.field, 'contain');
|
|
1497
1495
|
}
|
|
1498
1496
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1499
1497
|
className: "me-1",
|
|
@@ -1503,7 +1501,7 @@ function (_React$Component) {
|
|
|
1503
1501
|
onClick: function onClick(e, field, data) {
|
|
1504
1502
|
var select = document.getSelection();
|
|
1505
1503
|
|
|
1506
|
-
|
|
1504
|
+
_this21.filterHandler(select.toString(), data.field, 'exclude');
|
|
1507
1505
|
}
|
|
1508
1506
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1509
1507
|
className: "me-1",
|
|
@@ -1511,7 +1509,7 @@ function (_React$Component) {
|
|
|
1511
1509
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1512
1510
|
field: "clear_filter",
|
|
1513
1511
|
onClick: function onClick() {
|
|
1514
|
-
|
|
1512
|
+
_this21.clearFilter();
|
|
1515
1513
|
}
|
|
1516
1514
|
}, _react["default"].createElement("span", {
|
|
1517
1515
|
className: "text-danger"
|
|
@@ -1533,13 +1531,13 @@ function (_React$Component) {
|
|
|
1533
1531
|
onChange: this.filterChangeHandler('equal'),
|
|
1534
1532
|
onMouseDown: stopEvent,
|
|
1535
1533
|
onEnter: function onEnter() {
|
|
1536
|
-
|
|
1534
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1537
1535
|
}
|
|
1538
1536
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1539
1537
|
size: "xs",
|
|
1540
1538
|
onMouseDown: stopEvent,
|
|
1541
1539
|
onClick: function onClick(e) {
|
|
1542
|
-
|
|
1540
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1543
1541
|
},
|
|
1544
1542
|
icon: "search"
|
|
1545
1543
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1555,13 +1553,13 @@ function (_React$Component) {
|
|
|
1555
1553
|
onChange: this.filterChangeHandler('start'),
|
|
1556
1554
|
onMouseDown: stopEvent,
|
|
1557
1555
|
onEnter: function onEnter() {
|
|
1558
|
-
|
|
1556
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1559
1557
|
}
|
|
1560
1558
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1561
1559
|
size: "xs",
|
|
1562
1560
|
onMouseDown: stopEvent,
|
|
1563
1561
|
onClick: function onClick(e) {
|
|
1564
|
-
|
|
1562
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1565
1563
|
},
|
|
1566
1564
|
icon: "search"
|
|
1567
1565
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1577,13 +1575,13 @@ function (_React$Component) {
|
|
|
1577
1575
|
onChange: this.filterChangeHandler('end'),
|
|
1578
1576
|
onMouseDown: stopEvent,
|
|
1579
1577
|
onEnter: function onEnter() {
|
|
1580
|
-
|
|
1578
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1581
1579
|
}
|
|
1582
1580
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1583
1581
|
size: "xs",
|
|
1584
1582
|
onMouseDown: stopEvent,
|
|
1585
1583
|
onClick: function onClick(e) {
|
|
1586
|
-
|
|
1584
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1587
1585
|
},
|
|
1588
1586
|
icon: "search"
|
|
1589
1587
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1599,13 +1597,13 @@ function (_React$Component) {
|
|
|
1599
1597
|
onChange: this.filterChangeHandler('contain'),
|
|
1600
1598
|
onMouseDown: stopEvent,
|
|
1601
1599
|
onEnter: function onEnter() {
|
|
1602
|
-
|
|
1600
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1603
1601
|
}
|
|
1604
1602
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1605
1603
|
size: "xs",
|
|
1606
1604
|
onMouseDown: stopEvent,
|
|
1607
1605
|
onClick: function onClick(e) {
|
|
1608
|
-
|
|
1606
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1609
1607
|
},
|
|
1610
1608
|
icon: "search"
|
|
1611
1609
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1622,7 +1620,7 @@ function (_React$Component) {
|
|
|
1622
1620
|
onChange: this.filterChangeHandler('condition'),
|
|
1623
1621
|
onMouseDown: stopEvent,
|
|
1624
1622
|
onEnter: function onEnter() {
|
|
1625
|
-
|
|
1623
|
+
_this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
|
|
1626
1624
|
}
|
|
1627
1625
|
})) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1628
1626
|
step: true
|
|
@@ -1633,13 +1631,13 @@ function (_React$Component) {
|
|
|
1633
1631
|
}, lang['Clone Row']) : null, this.props.customMenu ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1634
1632
|
step: true
|
|
1635
1633
|
}) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
|
|
1636
|
-
return
|
|
1634
|
+
return _this21.explainCustomMenu(menu);
|
|
1637
1635
|
}) : null));
|
|
1638
1636
|
}
|
|
1639
1637
|
}, {
|
|
1640
1638
|
key: "renderNumberMenu",
|
|
1641
1639
|
value: function renderNumberMenu() {
|
|
1642
|
-
var
|
|
1640
|
+
var _this22 = this;
|
|
1643
1641
|
|
|
1644
1642
|
var lang;
|
|
1645
1643
|
|
|
@@ -1658,7 +1656,7 @@ function (_React$Component) {
|
|
|
1658
1656
|
|
|
1659
1657
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1660
1658
|
ref: function ref(c) {
|
|
1661
|
-
return
|
|
1659
|
+
return _this22.numMenu = c;
|
|
1662
1660
|
},
|
|
1663
1661
|
onClick: this.menuClickHandler
|
|
1664
1662
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1676,7 +1674,7 @@ function (_React$Component) {
|
|
|
1676
1674
|
onClick: function onClick(e, field, data) {
|
|
1677
1675
|
var select = document.getSelection();
|
|
1678
1676
|
|
|
1679
|
-
|
|
1677
|
+
_this22.filterHandler(select.toString(), data.field, 'contain');
|
|
1680
1678
|
}
|
|
1681
1679
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1682
1680
|
className: "me-1",
|
|
@@ -1686,7 +1684,7 @@ function (_React$Component) {
|
|
|
1686
1684
|
onClick: function onClick(e, field, data) {
|
|
1687
1685
|
var select = document.getSelection();
|
|
1688
1686
|
|
|
1689
|
-
|
|
1687
|
+
_this22.filterHandler(select.toString(), data.field, 'exclude');
|
|
1690
1688
|
}
|
|
1691
1689
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1692
1690
|
className: "me-1",
|
|
@@ -1694,7 +1692,7 @@ function (_React$Component) {
|
|
|
1694
1692
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1695
1693
|
field: "clear_filter",
|
|
1696
1694
|
onClick: function onClick() {
|
|
1697
|
-
|
|
1695
|
+
_this22.clearFilter();
|
|
1698
1696
|
}
|
|
1699
1697
|
}, _react["default"].createElement("span", {
|
|
1700
1698
|
className: "text-danger"
|
|
@@ -1715,14 +1713,14 @@ function (_React$Component) {
|
|
|
1715
1713
|
onChange: this.filterChangeHandler('condition'),
|
|
1716
1714
|
onMouseDown: stopEvent,
|
|
1717
1715
|
onEnter: function onEnter() {
|
|
1718
|
-
|
|
1716
|
+
_this22.filterHandler(_this22.state.filter.condition, _this22.numMenu.data.field, 'condition');
|
|
1719
1717
|
}
|
|
1720
1718
|
}), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
|
|
1721
1719
|
}
|
|
1722
1720
|
}, {
|
|
1723
1721
|
key: "explainCustomMenu",
|
|
1724
1722
|
value: function explainCustomMenu(menu) {
|
|
1725
|
-
var
|
|
1723
|
+
var _this23 = this;
|
|
1726
1724
|
|
|
1727
1725
|
if (menu.children && menu.children instanceof Array) {
|
|
1728
1726
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1730,7 +1728,7 @@ function (_React$Component) {
|
|
|
1730
1728
|
text: menu.text,
|
|
1731
1729
|
child: true
|
|
1732
1730
|
}, menu.children.map(function (item) {
|
|
1733
|
-
return
|
|
1731
|
+
return _this23.explainCustomMenu(item);
|
|
1734
1732
|
}));
|
|
1735
1733
|
} else {
|
|
1736
1734
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1796,6 +1794,8 @@ CTable.propTypes = {
|
|
|
1796
1794
|
onClick: _propTypes["default"].func,
|
|
1797
1795
|
//选择事件
|
|
1798
1796
|
onCheck: _propTypes["default"].func,
|
|
1797
|
+
//选择所有
|
|
1798
|
+
onCheckAll: _propTypes["default"].func,
|
|
1799
1799
|
//过滤事件
|
|
1800
1800
|
onFilter: _propTypes["default"].func,
|
|
1801
1801
|
//排序事件
|
|
@@ -1846,7 +1846,9 @@ CTable.propTypes = {
|
|
|
1846
1846
|
//自定义显示语言
|
|
1847
1847
|
lang: _propTypes["default"].object,
|
|
1848
1848
|
source: _propTypes["default"].string,
|
|
1849
|
-
sourceFunc: _propTypes["default"].func
|
|
1849
|
+
sourceFunc: _propTypes["default"].func,
|
|
1850
|
+
//是否显示全部选取
|
|
1851
|
+
allSelect: _propTypes["default"].bool
|
|
1850
1852
|
};
|
|
1851
1853
|
CTable.defaultProps = {
|
|
1852
1854
|
data: [],
|
|
@@ -1869,7 +1871,8 @@ CTable.defaultProps = {
|
|
|
1869
1871
|
showPages: 10,
|
|
1870
1872
|
source: null,
|
|
1871
1873
|
total: null,
|
|
1872
|
-
lang: 'en'
|
|
1874
|
+
lang: 'en',
|
|
1875
|
+
allSelect: true
|
|
1873
1876
|
};
|
|
1874
1877
|
var _default = CTable;
|
|
1875
1878
|
exports["default"] = _default;
|