@clake/react-bootstrap4-window 0.6.1 → 0.6.3
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 -82
- 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/css/CTable.less +7 -0
- package/lib/css/PageBar.less +1 -1
- 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.6.
|
|
1
|
+
/* @clake/react-bootstrap4-window v0.6.3 | by Clake
|
|
2
2
|
* Copyright (c) 2023 Clake,
|
|
3
|
-
* 2023-06-
|
|
3
|
+
* 2023-06-16T14:07:02+0800
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
@@ -143,8 +143,9 @@ function (_React$Component) {
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
_defineProperty(_assertThisInitialized(_this), "editHandler", function (e, val, row) {
|
|
146
|
-
var
|
|
147
|
-
var
|
|
146
|
+
var dataset = row === 'chk' ? e.currentTarget.dataset : e.target.dataset;
|
|
147
|
+
var index = parseInt(dataset.row);
|
|
148
|
+
var field = dataset.field; //如果是check组件
|
|
148
149
|
|
|
149
150
|
if (row === 'chk') {
|
|
150
151
|
val = val ? 1 : 0;
|
|
@@ -256,7 +257,8 @@ function (_React$Component) {
|
|
|
256
257
|
this.setState({
|
|
257
258
|
data: nextProps.data,
|
|
258
259
|
dataCount: nextProps.dataCount,
|
|
259
|
-
page: nextProps.page
|
|
260
|
+
page: nextProps.page,
|
|
261
|
+
total: nextProps.total
|
|
260
262
|
});
|
|
261
263
|
}
|
|
262
264
|
}
|
|
@@ -267,6 +269,10 @@ function (_React$Component) {
|
|
|
267
269
|
return true;
|
|
268
270
|
}
|
|
269
271
|
|
|
272
|
+
if (nextState.total !== this.state.total) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
|
|
270
276
|
return nextState.data !== this.state.data;
|
|
271
277
|
}
|
|
272
278
|
}, {
|
|
@@ -830,8 +836,13 @@ function (_React$Component) {
|
|
|
830
836
|
}
|
|
831
837
|
}, {
|
|
832
838
|
key: "getClasses",
|
|
833
|
-
value: function getClasses() {
|
|
834
|
-
var base = 'table ck-table';
|
|
839
|
+
value: function getClasses(name) {
|
|
840
|
+
var base = 'table ck-table';
|
|
841
|
+
|
|
842
|
+
if (!!name) {
|
|
843
|
+
base = (0, _bind["default"])(base, name);
|
|
844
|
+
} //striped
|
|
845
|
+
|
|
835
846
|
|
|
836
847
|
if (this.props.striped && !this.props.edit) {
|
|
837
848
|
base = (0, _bind["default"])(base, 'table-striped');
|
|
@@ -954,14 +965,35 @@ function (_React$Component) {
|
|
|
954
965
|
var base = 'ck-ctable-body flex-grow-1 d-flex flex-column';
|
|
955
966
|
return base;
|
|
956
967
|
}
|
|
968
|
+
}, {
|
|
969
|
+
key: "calcLocalTotal",
|
|
970
|
+
value: function calcLocalTotal(field) {
|
|
971
|
+
var _this13 = this;
|
|
972
|
+
|
|
973
|
+
return function (e) {
|
|
974
|
+
var list = _this13.state.data;
|
|
975
|
+
var total = 0;
|
|
976
|
+
list.forEach(function (item) {
|
|
977
|
+
if (!!parseFloat(item[field])) {
|
|
978
|
+
total += parseFloat(item[field]);
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
var totalData = Object.assign({}, _this13.state.total);
|
|
982
|
+
totalData[field] = total.toFixed(2);
|
|
983
|
+
|
|
984
|
+
_this13.setState({
|
|
985
|
+
total: totalData
|
|
986
|
+
});
|
|
987
|
+
};
|
|
988
|
+
}
|
|
957
989
|
}, {
|
|
958
990
|
key: "render",
|
|
959
991
|
value: function render() {
|
|
960
|
-
var
|
|
992
|
+
var _this14 = this;
|
|
961
993
|
|
|
962
994
|
return _react["default"].createElement("div", {
|
|
963
995
|
ref: function ref(c) {
|
|
964
|
-
return
|
|
996
|
+
return _this14.mainDom = c;
|
|
965
997
|
},
|
|
966
998
|
className: this.getMainClasses(),
|
|
967
999
|
style: this.getStyles()
|
|
@@ -973,7 +1005,7 @@ function (_React$Component) {
|
|
|
973
1005
|
selector: "#table-body-com-".concat(this.domId)
|
|
974
1006
|
})), this.renderFoot(), _react["default"].createElement("div", {
|
|
975
1007
|
ref: function ref(c) {
|
|
976
|
-
return
|
|
1008
|
+
return _this14.split = c;
|
|
977
1009
|
},
|
|
978
1010
|
className: "ck-split d-none"
|
|
979
1011
|
}));
|
|
@@ -981,15 +1013,15 @@ function (_React$Component) {
|
|
|
981
1013
|
}, {
|
|
982
1014
|
key: "renderHeader",
|
|
983
1015
|
value: function renderHeader() {
|
|
984
|
-
var
|
|
1016
|
+
var _this15 = this;
|
|
985
1017
|
|
|
986
1018
|
return _react["default"].createElement("div", {
|
|
987
1019
|
ref: function ref(c) {
|
|
988
|
-
return
|
|
1020
|
+
return _this15.tableHeader = c;
|
|
989
1021
|
}
|
|
990
1022
|
}, _react["default"].createElement("table", {
|
|
991
1023
|
ref: function ref(c) {
|
|
992
|
-
return
|
|
1024
|
+
return _this15.table_head = c;
|
|
993
1025
|
},
|
|
994
1026
|
id: "table-head-".concat(this.domId),
|
|
995
1027
|
className: this.getClasses(),
|
|
@@ -1005,11 +1037,11 @@ function (_React$Component) {
|
|
|
1005
1037
|
icon: "list"
|
|
1006
1038
|
}) : _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1007
1039
|
ref: function ref(c) {
|
|
1008
|
-
return
|
|
1040
|
+
return _this15.allchk = c;
|
|
1009
1041
|
},
|
|
1010
1042
|
onChange: this.selectAll
|
|
1011
1043
|
})) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1012
|
-
|
|
1044
|
+
_this15.cacheRow[item.props.field] = '';
|
|
1013
1045
|
|
|
1014
1046
|
if (!item || item.props.hide) {
|
|
1015
1047
|
return null;
|
|
@@ -1026,28 +1058,28 @@ function (_React$Component) {
|
|
|
1026
1058
|
|
|
1027
1059
|
var sort_icon = '';
|
|
1028
1060
|
|
|
1029
|
-
if (
|
|
1030
|
-
sort_icon = 'sort-alpha-' + (
|
|
1061
|
+
if (_this15.sortList[item.props.field]) {
|
|
1062
|
+
sort_icon = 'sort-alpha-' + (_this15.sortList[item.props.field] === 'asc' ? 'down' : 'up');
|
|
1031
1063
|
}
|
|
1032
1064
|
|
|
1033
1065
|
return _react["default"].createElement("th", {
|
|
1034
|
-
onContextMenu:
|
|
1035
|
-
id:
|
|
1066
|
+
onContextMenu: _this15.menuContextHandler,
|
|
1067
|
+
id: _this15.domId + '-' + key,
|
|
1036
1068
|
"data-key": 'head_' + key,
|
|
1037
1069
|
style: style
|
|
1038
|
-
},
|
|
1070
|
+
}, _this15.is_sort ? _react["default"].createElement("a", {
|
|
1039
1071
|
className: "ck-ctable-sort",
|
|
1040
1072
|
href: "javascript://",
|
|
1041
|
-
id: "".concat(
|
|
1073
|
+
id: "".concat(_this15.domId, "-sort-").concat(item.props.field),
|
|
1042
1074
|
"data-field": item.props.field,
|
|
1043
|
-
onClick:
|
|
1075
|
+
onClick: _this15.sortHandler
|
|
1044
1076
|
}, item.props.text, " ", _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1045
1077
|
icon: sort_icon
|
|
1046
|
-
})) : item.props.text,
|
|
1078
|
+
})) : item.props.text, _this15.props.move ? _react["default"].createElement("span", {
|
|
1047
1079
|
ref: function ref(c) {
|
|
1048
|
-
return
|
|
1080
|
+
return _this15.headerSplits.push(c);
|
|
1049
1081
|
},
|
|
1050
|
-
"data-key":
|
|
1082
|
+
"data-key": _this15.domId + '-' + key,
|
|
1051
1083
|
className: "ck-column-split"
|
|
1052
1084
|
}) : null);
|
|
1053
1085
|
})))));
|
|
@@ -1055,34 +1087,34 @@ function (_React$Component) {
|
|
|
1055
1087
|
}, {
|
|
1056
1088
|
key: "renderRows",
|
|
1057
1089
|
value: function renderRows() {
|
|
1058
|
-
var
|
|
1090
|
+
var _this16 = this;
|
|
1059
1091
|
|
|
1060
1092
|
return _react["default"].createElement("div", {
|
|
1061
1093
|
ref: function ref(c) {
|
|
1062
|
-
return
|
|
1094
|
+
return _this16.table_rows = c;
|
|
1063
1095
|
},
|
|
1064
1096
|
id: "table-body-com-".concat(this.domId),
|
|
1065
1097
|
className: "flex-grow-1 rows",
|
|
1066
1098
|
onScroll: this.scrollHandler
|
|
1067
1099
|
}, _react["default"].createElement("table", {
|
|
1068
1100
|
ref: function ref(c) {
|
|
1069
|
-
return
|
|
1101
|
+
return _this16.table_body = c;
|
|
1070
1102
|
},
|
|
1071
1103
|
id: "table-body-".concat(this.domId),
|
|
1072
1104
|
className: this.getClasses(),
|
|
1073
1105
|
style: this.getTableStyles()
|
|
1074
1106
|
}, _react["default"].createElement("tbody", null, this.state.data.map(function (row, i) {
|
|
1075
|
-
if (
|
|
1076
|
-
return
|
|
1107
|
+
if (_this16.props.edit) {
|
|
1108
|
+
return _this16.renderEditRow(row, i);
|
|
1077
1109
|
}
|
|
1078
1110
|
|
|
1079
|
-
return
|
|
1111
|
+
return _this16.renderRow(row, i);
|
|
1080
1112
|
}), this.props.edit ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
|
|
1081
1113
|
}
|
|
1082
1114
|
}, {
|
|
1083
1115
|
key: "renderRow",
|
|
1084
1116
|
value: function renderRow(row, i, parentRow) {
|
|
1085
|
-
var
|
|
1117
|
+
var _this17 = this;
|
|
1086
1118
|
|
|
1087
1119
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1088
1120
|
className: this.props.onClick ? 'click-row' : null,
|
|
@@ -1101,9 +1133,9 @@ function (_React$Component) {
|
|
|
1101
1133
|
} //set style
|
|
1102
1134
|
|
|
1103
1135
|
|
|
1104
|
-
var style = _objectSpread({},
|
|
1136
|
+
var style = _objectSpread({}, _this17.props.columnStyle);
|
|
1105
1137
|
|
|
1106
|
-
style.textAlign = item.props.align ||
|
|
1138
|
+
style.textAlign = item.props.align || _this17.props.align;
|
|
1107
1139
|
|
|
1108
1140
|
if (item.props.width) {
|
|
1109
1141
|
style.width = item.props.width;
|
|
@@ -1126,8 +1158,8 @@ function (_React$Component) {
|
|
|
1126
1158
|
|
|
1127
1159
|
if (item.props.children) {
|
|
1128
1160
|
return _react["default"].createElement("td", {
|
|
1129
|
-
onContextMenu:
|
|
1130
|
-
id:
|
|
1161
|
+
onContextMenu: _this17.menuContextHandler(dataType),
|
|
1162
|
+
id: _this17.domId + '-' + key,
|
|
1131
1163
|
"data-row": "".concat(i),
|
|
1132
1164
|
"data-field": item.props.field,
|
|
1133
1165
|
className: item.props.className,
|
|
@@ -1146,8 +1178,8 @@ function (_React$Component) {
|
|
|
1146
1178
|
}
|
|
1147
1179
|
|
|
1148
1180
|
return _react["default"].createElement("td", {
|
|
1149
|
-
onContextMenu:
|
|
1150
|
-
id:
|
|
1181
|
+
onContextMenu: _this17.menuContextHandler(dataType),
|
|
1182
|
+
id: _this17.domId + '-' + key,
|
|
1151
1183
|
"data-field": item.props.field,
|
|
1152
1184
|
style: style,
|
|
1153
1185
|
onClick: function onClick(e) {
|
|
@@ -1161,14 +1193,14 @@ function (_React$Component) {
|
|
|
1161
1193
|
}
|
|
1162
1194
|
},
|
|
1163
1195
|
"data-row": "".concat(i)
|
|
1164
|
-
}, item.props.type ?
|
|
1196
|
+
}, item.props.type ? _this17.renderEditComponent(item.props, row, i) : item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field]);
|
|
1165
1197
|
}
|
|
1166
1198
|
})));
|
|
1167
1199
|
}
|
|
1168
1200
|
}, {
|
|
1169
1201
|
key: "renderEditRow",
|
|
1170
1202
|
value: function renderEditRow(row, i) {
|
|
1171
|
-
var
|
|
1203
|
+
var _this18 = this;
|
|
1172
1204
|
|
|
1173
1205
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1174
1206
|
className: this.props.onClick ? 'click-row' : null,
|
|
@@ -1188,9 +1220,9 @@ function (_React$Component) {
|
|
|
1188
1220
|
} //set style
|
|
1189
1221
|
|
|
1190
1222
|
|
|
1191
|
-
var style = _objectSpread({},
|
|
1223
|
+
var style = _objectSpread({}, _this18.props.columnStyle);
|
|
1192
1224
|
|
|
1193
|
-
style.textAlign = item.props.align ||
|
|
1225
|
+
style.textAlign = item.props.align || _this18.props.align;
|
|
1194
1226
|
|
|
1195
1227
|
if (item.props.width) {
|
|
1196
1228
|
style.width = item.props.width;
|
|
@@ -1198,9 +1230,9 @@ function (_React$Component) {
|
|
|
1198
1230
|
|
|
1199
1231
|
var dataType = 'text';
|
|
1200
1232
|
return _react["default"].createElement("td", {
|
|
1201
|
-
onContextMenu:
|
|
1233
|
+
onContextMenu: _this18.menuContextHandler(dataType),
|
|
1202
1234
|
className: item.props.disabled ? 'disabled' : '',
|
|
1203
|
-
id:
|
|
1235
|
+
id: _this18.domId + '-' + key,
|
|
1204
1236
|
"data-field": item.props.field,
|
|
1205
1237
|
style: style,
|
|
1206
1238
|
onClick: function onClick(e) {
|
|
@@ -1214,13 +1246,13 @@ function (_React$Component) {
|
|
|
1214
1246
|
}
|
|
1215
1247
|
},
|
|
1216
1248
|
"data-row": "".concat(i)
|
|
1217
|
-
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] :
|
|
1249
|
+
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] : _this18.renderEditComponent(item.props, row, i));
|
|
1218
1250
|
})));
|
|
1219
1251
|
}
|
|
1220
1252
|
}, {
|
|
1221
1253
|
key: "renderEditAddRow",
|
|
1222
1254
|
value: function renderEditAddRow() {
|
|
1223
|
-
var
|
|
1255
|
+
var _this19 = this;
|
|
1224
1256
|
|
|
1225
1257
|
return _react["default"].createElement("tr", {
|
|
1226
1258
|
id: this.domId + '-edit'
|
|
@@ -1242,14 +1274,14 @@ function (_React$Component) {
|
|
|
1242
1274
|
return _react["default"].createElement("td", {
|
|
1243
1275
|
style: style
|
|
1244
1276
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1245
|
-
onFocus:
|
|
1277
|
+
onFocus: _this19.addNewHandler
|
|
1246
1278
|
}));
|
|
1247
1279
|
}));
|
|
1248
1280
|
}
|
|
1249
1281
|
}, {
|
|
1250
1282
|
key: "renderEditComponent",
|
|
1251
1283
|
value: function renderEditComponent(item, row, i) {
|
|
1252
|
-
var
|
|
1284
|
+
var _this20 = this;
|
|
1253
1285
|
|
|
1254
1286
|
switch (item.type) {
|
|
1255
1287
|
case "combo":
|
|
@@ -1278,14 +1310,16 @@ function (_React$Component) {
|
|
|
1278
1310
|
|
|
1279
1311
|
case "checkbox":
|
|
1280
1312
|
return _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1313
|
+
className: "d-inline",
|
|
1281
1314
|
width: "20px",
|
|
1282
1315
|
onChange: function onChange(chk, e) {
|
|
1283
|
-
|
|
1316
|
+
_this20.editHandler(e, chk, 'chk');
|
|
1284
1317
|
},
|
|
1285
1318
|
"data-row": i,
|
|
1286
1319
|
"data-field": item.field,
|
|
1287
1320
|
checked: !!row[item.field],
|
|
1288
|
-
disabled: item.disabled
|
|
1321
|
+
disabled: item.disabled,
|
|
1322
|
+
tabIndex: "0"
|
|
1289
1323
|
});
|
|
1290
1324
|
|
|
1291
1325
|
default:
|
|
@@ -1295,7 +1329,8 @@ function (_React$Component) {
|
|
|
1295
1329
|
"data-field": item.field,
|
|
1296
1330
|
data: row[item.field],
|
|
1297
1331
|
align: item.align,
|
|
1298
|
-
disabled: item.disabled
|
|
1332
|
+
disabled: item.disabled,
|
|
1333
|
+
onBlur: this.state.total && this.state.total.hasOwnProperty(item.field) ? this.calcLocalTotal(item.field) : null
|
|
1299
1334
|
});
|
|
1300
1335
|
}
|
|
1301
1336
|
}
|
|
@@ -1318,7 +1353,7 @@ function (_React$Component) {
|
|
|
1318
1353
|
}, {
|
|
1319
1354
|
key: "renderTotal",
|
|
1320
1355
|
value: function renderTotal() {
|
|
1321
|
-
var
|
|
1356
|
+
var _this21 = this;
|
|
1322
1357
|
|
|
1323
1358
|
if (!this.state.total) {
|
|
1324
1359
|
return null;
|
|
@@ -1327,16 +1362,17 @@ function (_React$Component) {
|
|
|
1327
1362
|
var total = this.state.total;
|
|
1328
1363
|
return _react["default"].createElement("div", {
|
|
1329
1364
|
ref: function ref(c) {
|
|
1330
|
-
return
|
|
1331
|
-
}
|
|
1365
|
+
return _this21.tableTotal = c;
|
|
1366
|
+
},
|
|
1367
|
+
className: "ck-ctable-total"
|
|
1332
1368
|
}, _react["default"].createElement("table", {
|
|
1333
1369
|
ref: function ref(c) {
|
|
1334
|
-
return
|
|
1370
|
+
return _this21.table_total = c;
|
|
1335
1371
|
},
|
|
1336
1372
|
id: "table-total-".concat(this.domId),
|
|
1337
1373
|
className: this.getClasses(),
|
|
1338
1374
|
style: this.getTableStyles()
|
|
1339
|
-
}, _react["default"].createElement("tbody", null, _react["default"].createElement("tr", null, this.state.select ? _react["default"].createElement("td", {
|
|
1375
|
+
}, _react["default"].createElement("tbody", null, _react["default"].createElement("tr", null, this.state.select || this.props.edit ? _react["default"].createElement("td", {
|
|
1340
1376
|
width: "20px"
|
|
1341
1377
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1342
1378
|
icon: "chart-line"
|
|
@@ -1345,7 +1381,7 @@ function (_React$Component) {
|
|
|
1345
1381
|
return null;
|
|
1346
1382
|
}
|
|
1347
1383
|
|
|
1348
|
-
var align = item.props.align ||
|
|
1384
|
+
var align = item.props.align || _this21.props.align;
|
|
1349
1385
|
var style = {
|
|
1350
1386
|
'textAlign': align
|
|
1351
1387
|
};
|
|
@@ -1355,7 +1391,7 @@ function (_React$Component) {
|
|
|
1355
1391
|
}
|
|
1356
1392
|
|
|
1357
1393
|
return _react["default"].createElement("td", {
|
|
1358
|
-
id:
|
|
1394
|
+
id: _this21.domId + '-' + key,
|
|
1359
1395
|
"data-field": item.props.field,
|
|
1360
1396
|
style: style
|
|
1361
1397
|
}, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
|
|
@@ -1364,7 +1400,7 @@ function (_React$Component) {
|
|
|
1364
1400
|
}, {
|
|
1365
1401
|
key: "renderMenu",
|
|
1366
1402
|
value: function renderMenu() {
|
|
1367
|
-
var
|
|
1403
|
+
var _this22 = this;
|
|
1368
1404
|
|
|
1369
1405
|
var lang = this.props.lang;
|
|
1370
1406
|
|
|
@@ -1377,7 +1413,7 @@ function (_React$Component) {
|
|
|
1377
1413
|
|
|
1378
1414
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1379
1415
|
ref: function ref(c) {
|
|
1380
|
-
return
|
|
1416
|
+
return _this22.mainMenu = c;
|
|
1381
1417
|
},
|
|
1382
1418
|
onClick: this.menuClickHandler
|
|
1383
1419
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1395,7 +1431,7 @@ function (_React$Component) {
|
|
|
1395
1431
|
onClick: function onClick(e, field, data) {
|
|
1396
1432
|
var select = document.getSelection();
|
|
1397
1433
|
|
|
1398
|
-
|
|
1434
|
+
_this22.filterHandler(select.toString(), data.field, 'contain');
|
|
1399
1435
|
}
|
|
1400
1436
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1401
1437
|
className: "mr-1",
|
|
@@ -1405,7 +1441,7 @@ function (_React$Component) {
|
|
|
1405
1441
|
onClick: function onClick(e, field, data) {
|
|
1406
1442
|
var select = document.getSelection();
|
|
1407
1443
|
|
|
1408
|
-
|
|
1444
|
+
_this22.filterHandler(select.toString(), data.field, 'exclude');
|
|
1409
1445
|
}
|
|
1410
1446
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1411
1447
|
className: "mr-1",
|
|
@@ -1413,7 +1449,7 @@ function (_React$Component) {
|
|
|
1413
1449
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1414
1450
|
field: "clear_filter",
|
|
1415
1451
|
onClick: function onClick() {
|
|
1416
|
-
|
|
1452
|
+
_this22.clearFilter();
|
|
1417
1453
|
}
|
|
1418
1454
|
}, _react["default"].createElement("span", {
|
|
1419
1455
|
className: "text-danger"
|
|
@@ -1435,13 +1471,13 @@ function (_React$Component) {
|
|
|
1435
1471
|
onChange: this.filterChangeHandler('equal'),
|
|
1436
1472
|
onMouseDown: stopEvent,
|
|
1437
1473
|
onEnter: function onEnter() {
|
|
1438
|
-
|
|
1474
|
+
_this22.filterHandler(_this22.state.filter.equal, _this22.mainMenu.data.field, 'equal');
|
|
1439
1475
|
}
|
|
1440
1476
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1441
1477
|
size: "xs",
|
|
1442
1478
|
onMouseDown: stopEvent,
|
|
1443
1479
|
onClick: function onClick(e) {
|
|
1444
|
-
|
|
1480
|
+
_this22.filterHandler(_this22.state.filter.equal, _this22.mainMenu.data.field, 'equal');
|
|
1445
1481
|
},
|
|
1446
1482
|
icon: "search"
|
|
1447
1483
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1457,13 +1493,13 @@ function (_React$Component) {
|
|
|
1457
1493
|
onChange: this.filterChangeHandler('start'),
|
|
1458
1494
|
onMouseDown: stopEvent,
|
|
1459
1495
|
onEnter: function onEnter() {
|
|
1460
|
-
|
|
1496
|
+
_this22.filterHandler(_this22.state.filter.start, _this22.mainMenu.data.field, 'start');
|
|
1461
1497
|
}
|
|
1462
1498
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1463
1499
|
size: "xs",
|
|
1464
1500
|
onMouseDown: stopEvent,
|
|
1465
1501
|
onClick: function onClick(e) {
|
|
1466
|
-
|
|
1502
|
+
_this22.filterHandler(_this22.state.filter.start, _this22.mainMenu.data.field, 'start');
|
|
1467
1503
|
},
|
|
1468
1504
|
icon: "search"
|
|
1469
1505
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1479,13 +1515,13 @@ function (_React$Component) {
|
|
|
1479
1515
|
onChange: this.filterChangeHandler('end'),
|
|
1480
1516
|
onMouseDown: stopEvent,
|
|
1481
1517
|
onEnter: function onEnter() {
|
|
1482
|
-
|
|
1518
|
+
_this22.filterHandler(_this22.state.filter.end, _this22.mainMenu.data.field, 'end');
|
|
1483
1519
|
}
|
|
1484
1520
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1485
1521
|
size: "xs",
|
|
1486
1522
|
onMouseDown: stopEvent,
|
|
1487
1523
|
onClick: function onClick(e) {
|
|
1488
|
-
|
|
1524
|
+
_this22.filterHandler(_this22.state.filter.end, _this22.mainMenu.data.field, 'end');
|
|
1489
1525
|
},
|
|
1490
1526
|
icon: "search"
|
|
1491
1527
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1501,13 +1537,13 @@ function (_React$Component) {
|
|
|
1501
1537
|
onChange: this.filterChangeHandler('contain'),
|
|
1502
1538
|
onMouseDown: stopEvent,
|
|
1503
1539
|
onEnter: function onEnter() {
|
|
1504
|
-
|
|
1540
|
+
_this22.filterHandler(_this22.state.filter.contain, _this22.mainMenu.data.field, 'contain');
|
|
1505
1541
|
}
|
|
1506
1542
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1507
1543
|
size: "xs",
|
|
1508
1544
|
onMouseDown: stopEvent,
|
|
1509
1545
|
onClick: function onClick(e) {
|
|
1510
|
-
|
|
1546
|
+
_this22.filterHandler(_this22.state.filter.contain, _this22.mainMenu.data.field, 'contain');
|
|
1511
1547
|
},
|
|
1512
1548
|
icon: "search"
|
|
1513
1549
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1524,7 +1560,7 @@ function (_React$Component) {
|
|
|
1524
1560
|
onChange: this.filterChangeHandler('condition'),
|
|
1525
1561
|
onMouseDown: stopEvent,
|
|
1526
1562
|
onEnter: function onEnter() {
|
|
1527
|
-
|
|
1563
|
+
_this22.filterHandler(_this22.state.filter.condition, _this22.mainMenu.data.field, 'condition');
|
|
1528
1564
|
}
|
|
1529
1565
|
})) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1530
1566
|
step: true
|
|
@@ -1535,13 +1571,13 @@ function (_React$Component) {
|
|
|
1535
1571
|
}, lang['Clone Row']) : null, this.props.customMenu ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1536
1572
|
step: true
|
|
1537
1573
|
}) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
|
|
1538
|
-
return
|
|
1574
|
+
return _this22.explainCustomMenu(menu);
|
|
1539
1575
|
}) : null));
|
|
1540
1576
|
}
|
|
1541
1577
|
}, {
|
|
1542
1578
|
key: "renderNumberMenu",
|
|
1543
1579
|
value: function renderNumberMenu() {
|
|
1544
|
-
var
|
|
1580
|
+
var _this23 = this;
|
|
1545
1581
|
|
|
1546
1582
|
var lang = this.props.lang;
|
|
1547
1583
|
|
|
@@ -1554,7 +1590,7 @@ function (_React$Component) {
|
|
|
1554
1590
|
|
|
1555
1591
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1556
1592
|
ref: function ref(c) {
|
|
1557
|
-
return
|
|
1593
|
+
return _this23.numMenu = c;
|
|
1558
1594
|
},
|
|
1559
1595
|
onClick: this.menuClickHandler
|
|
1560
1596
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1572,7 +1608,7 @@ function (_React$Component) {
|
|
|
1572
1608
|
onClick: function onClick(e, field, data) {
|
|
1573
1609
|
var select = document.getSelection();
|
|
1574
1610
|
|
|
1575
|
-
|
|
1611
|
+
_this23.filterHandler(select.toString(), data.field, 'contain');
|
|
1576
1612
|
}
|
|
1577
1613
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1578
1614
|
className: "mr-1",
|
|
@@ -1582,7 +1618,7 @@ function (_React$Component) {
|
|
|
1582
1618
|
onClick: function onClick(e, field, data) {
|
|
1583
1619
|
var select = document.getSelection();
|
|
1584
1620
|
|
|
1585
|
-
|
|
1621
|
+
_this23.filterHandler(select.toString(), data.field, 'exclude');
|
|
1586
1622
|
}
|
|
1587
1623
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1588
1624
|
className: "mr-1",
|
|
@@ -1590,7 +1626,7 @@ function (_React$Component) {
|
|
|
1590
1626
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1591
1627
|
field: "clear_filter",
|
|
1592
1628
|
onClick: function onClick() {
|
|
1593
|
-
|
|
1629
|
+
_this23.clearFilter();
|
|
1594
1630
|
}
|
|
1595
1631
|
}, _react["default"].createElement("span", {
|
|
1596
1632
|
className: "text-danger"
|
|
@@ -1611,14 +1647,14 @@ function (_React$Component) {
|
|
|
1611
1647
|
onChange: this.filterChangeHandler('condition'),
|
|
1612
1648
|
onMouseDown: stopEvent,
|
|
1613
1649
|
onEnter: function onEnter() {
|
|
1614
|
-
|
|
1650
|
+
_this23.filterHandler(_this23.state.filter.condition, _this23.numMenu.data.field, 'condition');
|
|
1615
1651
|
}
|
|
1616
1652
|
}), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
|
|
1617
1653
|
}
|
|
1618
1654
|
}, {
|
|
1619
1655
|
key: "explainCustomMenu",
|
|
1620
1656
|
value: function explainCustomMenu(menu) {
|
|
1621
|
-
var
|
|
1657
|
+
var _this24 = this;
|
|
1622
1658
|
|
|
1623
1659
|
if (menu.children && menu.children instanceof Array) {
|
|
1624
1660
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1626,7 +1662,7 @@ function (_React$Component) {
|
|
|
1626
1662
|
text: menu.text,
|
|
1627
1663
|
child: true
|
|
1628
1664
|
}, menu.children.map(function (item) {
|
|
1629
|
-
return
|
|
1665
|
+
return _this24.explainCustomMenu(item);
|
|
1630
1666
|
}));
|
|
1631
1667
|
} else {
|
|
1632
1668
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1763,7 +1799,8 @@ CTable.defaultProps = {
|
|
|
1763
1799
|
menu: true,
|
|
1764
1800
|
showNumbers: 30,
|
|
1765
1801
|
showPages: 10,
|
|
1766
|
-
source: null
|
|
1802
|
+
source: null,
|
|
1803
|
+
total: null
|
|
1767
1804
|
};
|
|
1768
1805
|
var _default = CTable;
|
|
1769
1806
|
exports["default"] = _default;
|