@clake/react-bootstrap4-window 1.1.8 → 1.1.10
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 +167 -141
- package/lib/CTable.js.map +3 -3
- package/lib/CTableInput.js +4 -3
- package/lib/CTableInput.js.map +3 -3
- package/lib/CTableTextArea.js +2 -2
- package/lib/CTableTextArea.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/lib/types/expsrc/view/Main.d.ts.map +1 -1
- package/lib/types/expsrc/view/test/CTableTest.d.ts +1 -0
- package/lib/types/expsrc/view/test/CTableTest.d.ts.map +1 -1
- package/lib/types/src/CTable.d.ts +1 -1
- package/lib/types/src/CTable.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/CTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @clake/react-bootstrap4-window v1.1.
|
|
1
|
+
/* @clake/react-bootstrap4-window v1.1.10 | by Clake
|
|
2
2
|
* Copyright (c) 2024 Clake,
|
|
3
|
-
* 2024-12-
|
|
3
|
+
* 2024-12-19T11:06:41+0800
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
@@ -304,6 +304,31 @@ function (_React$Component) {
|
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
306
|
|
|
307
|
+
_defineProperty(_assertThisInitialized(_this), "deleteRow", function (row_index) {
|
|
308
|
+
if (row_index < 0 || row_index >= _this.state.data.length) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
var data = _this.state.data.slice(0);
|
|
313
|
+
|
|
314
|
+
data.splice(row_index, 1);
|
|
315
|
+
|
|
316
|
+
if (_this.editRows.indexOf(row_index) !== -1) {
|
|
317
|
+
_this.editRows.splice(_this.editRows.indexOf(row_index), 1);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
_this.editRows.forEach(function (item, index) {
|
|
321
|
+
if (item > row_index) {
|
|
322
|
+
_this.editRows[index] = item - 1;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
_this.setState({
|
|
327
|
+
data: data,
|
|
328
|
+
dataCount: data.length
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
307
332
|
//全屏查看
|
|
308
333
|
_defineProperty(_assertThisInitialized(_this), "fullHandler", function () {
|
|
309
334
|
if (_this.isFull) {
|
|
@@ -769,13 +794,35 @@ function (_React$Component) {
|
|
|
769
794
|
_this7.mainMenu.show({
|
|
770
795
|
evt: e,
|
|
771
796
|
type: 'mouse',
|
|
772
|
-
data: data
|
|
797
|
+
data: data,
|
|
798
|
+
close: function close() {
|
|
799
|
+
_this7.setState({
|
|
800
|
+
filter: {
|
|
801
|
+
start: '',
|
|
802
|
+
end: '',
|
|
803
|
+
contain: '',
|
|
804
|
+
equal: '',
|
|
805
|
+
condition: ''
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
773
809
|
});
|
|
774
810
|
} else {
|
|
775
811
|
_this7.numMenu.show({
|
|
776
812
|
evt: e,
|
|
777
813
|
type: 'mouse',
|
|
778
|
-
data: data
|
|
814
|
+
data: data,
|
|
815
|
+
close: function close() {
|
|
816
|
+
_this7.setState({
|
|
817
|
+
filter: {
|
|
818
|
+
start: '',
|
|
819
|
+
end: '',
|
|
820
|
+
contain: '',
|
|
821
|
+
equal: '',
|
|
822
|
+
condition: ''
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
}
|
|
779
826
|
});
|
|
780
827
|
}
|
|
781
828
|
};
|
|
@@ -832,6 +879,7 @@ function (_React$Component) {
|
|
|
832
879
|
start: '',
|
|
833
880
|
end: '',
|
|
834
881
|
contain: '',
|
|
882
|
+
equal: '',
|
|
835
883
|
condition: ''
|
|
836
884
|
}
|
|
837
885
|
});
|
|
@@ -859,7 +907,8 @@ function (_React$Component) {
|
|
|
859
907
|
start: '',
|
|
860
908
|
end: '',
|
|
861
909
|
contain: '',
|
|
862
|
-
equal: ''
|
|
910
|
+
equal: '',
|
|
911
|
+
condition: ''
|
|
863
912
|
}
|
|
864
913
|
});
|
|
865
914
|
|
|
@@ -948,32 +997,6 @@ function (_React$Component) {
|
|
|
948
997
|
this.deleteRow(row_index);
|
|
949
998
|
}
|
|
950
999
|
}
|
|
951
|
-
}, {
|
|
952
|
-
key: "deleteRow",
|
|
953
|
-
value: function deleteRow(row_index) {
|
|
954
|
-
var _this9 = this;
|
|
955
|
-
|
|
956
|
-
if (row_index < 0 || row_index >= this.state.data.length) {
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
var data = this.state.data.slice(0);
|
|
961
|
-
data.splice(row_index, 1);
|
|
962
|
-
|
|
963
|
-
if (this.editRows.indexOf(row_index) !== -1) {
|
|
964
|
-
this.editRows.splice(this.editRows.indexOf(row_index), 1);
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
this.editRows.forEach(function (item, index) {
|
|
968
|
-
if (item > row_index) {
|
|
969
|
-
_this9.editRows[index] = item - 1;
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
|
-
this.setState({
|
|
973
|
-
data: data,
|
|
974
|
-
dataCount: data.length
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
1000
|
}, {
|
|
978
1001
|
key: "cloneRow",
|
|
979
1002
|
value: function cloneRow(row_index) {
|
|
@@ -999,10 +1022,10 @@ function (_React$Component) {
|
|
|
999
1022
|
* 得到所有选中的行
|
|
1000
1023
|
*/
|
|
1001
1024
|
value: function getSelectRows() {
|
|
1002
|
-
var
|
|
1025
|
+
var _this9 = this;
|
|
1003
1026
|
|
|
1004
1027
|
return this.state.selectRows.map(function (item) {
|
|
1005
|
-
return
|
|
1028
|
+
return _this9.state.data[item];
|
|
1006
1029
|
});
|
|
1007
1030
|
}
|
|
1008
1031
|
/**
|
|
@@ -1032,50 +1055,50 @@ function (_React$Component) {
|
|
|
1032
1055
|
}, {
|
|
1033
1056
|
key: "bindSplit",
|
|
1034
1057
|
value: function bindSplit() {
|
|
1035
|
-
var
|
|
1058
|
+
var _this10 = this;
|
|
1036
1059
|
|
|
1037
1060
|
if (this.props.move) {
|
|
1038
1061
|
this.headerSplits.forEach(function (split) {
|
|
1039
|
-
if (!
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1062
|
+
if (!_this10.drag) {
|
|
1063
|
+
_this10.dragColumnLeft = 0;
|
|
1064
|
+
_this10.dragWidth = 0;
|
|
1065
|
+
_this10.drag = new _Drag["default"](_this10.split, split, {
|
|
1043
1066
|
start: function start(dragDom, eventDom) {
|
|
1044
|
-
var xy = _reactBootstrap.Common.GetDomXY(eventDom,
|
|
1067
|
+
var xy = _reactBootstrap.Common.GetDomXY(eventDom, _this10.mainDom);
|
|
1045
1068
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
dragDom.style.left =
|
|
1069
|
+
_this10.dragWidth = parseInt((eventDom === null || eventDom === void 0 ? void 0 : eventDom.parentNode).style.width);
|
|
1070
|
+
_this10.dragColumnLeft = xy.left - _this10.table_rows.scrollLeft;
|
|
1071
|
+
dragDom.style.left = _this10.dragColumnLeft + 'px';
|
|
1049
1072
|
dragDom.classList.remove('d-none');
|
|
1050
1073
|
return true;
|
|
1051
1074
|
},
|
|
1052
1075
|
move: function move(_move, dragDom, eventDom) {
|
|
1053
|
-
if (
|
|
1054
|
-
_move.x =
|
|
1076
|
+
if (_this10.dragWidth + (_move.x - _this10.dragColumnLeft) < 50) {
|
|
1077
|
+
_move.x = _this10.dragColumnLeft - _this10.dragWidth + 50;
|
|
1055
1078
|
}
|
|
1056
1079
|
},
|
|
1057
1080
|
end: function end(dragDom, eventDom) {
|
|
1058
1081
|
dragDom.classList.add('d-none');
|
|
1059
1082
|
var column_key = eventDom.dataset.key;
|
|
1060
1083
|
|
|
1061
|
-
var diff = parseInt(dragDom.style.left) -
|
|
1084
|
+
var diff = parseInt(dragDom.style.left) - _this10.dragColumnLeft;
|
|
1062
1085
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1086
|
+
_this10.width = parseInt(_this10.width) + diff + 'px';
|
|
1087
|
+
_this10.table_head.style.width = _this10.width;
|
|
1088
|
+
_this10.table_body.style.width = _this10.width;
|
|
1066
1089
|
|
|
1067
|
-
if (
|
|
1068
|
-
|
|
1090
|
+
if (_this10.table_total) {
|
|
1091
|
+
_this10.table_total.style.width = _this10.width;
|
|
1069
1092
|
}
|
|
1070
1093
|
|
|
1071
1094
|
document.querySelectorAll("#".concat(column_key)).forEach(function (item) {
|
|
1072
|
-
item.style.width = "".concat(
|
|
1095
|
+
item.style.width = "".concat(_this10.dragWidth + diff, "px");
|
|
1073
1096
|
});
|
|
1074
1097
|
return true;
|
|
1075
1098
|
}
|
|
1076
1099
|
});
|
|
1077
1100
|
} else {
|
|
1078
|
-
|
|
1101
|
+
_this10.drag.setEventDom(split);
|
|
1079
1102
|
}
|
|
1080
1103
|
});
|
|
1081
1104
|
}
|
|
@@ -1214,20 +1237,20 @@ function (_React$Component) {
|
|
|
1214
1237
|
}, {
|
|
1215
1238
|
key: "calcLocalTotal",
|
|
1216
1239
|
value: function calcLocalTotal(field) {
|
|
1217
|
-
var
|
|
1240
|
+
var _this11 = this;
|
|
1218
1241
|
|
|
1219
1242
|
return function (e) {
|
|
1220
|
-
var list =
|
|
1243
|
+
var list = _this11.state.data;
|
|
1221
1244
|
var total = 0;
|
|
1222
1245
|
list.forEach(function (item) {
|
|
1223
1246
|
if (!!parseFloat(item[field])) {
|
|
1224
1247
|
total += parseFloat(item[field]);
|
|
1225
1248
|
}
|
|
1226
1249
|
});
|
|
1227
|
-
var totalData = Object.assign({},
|
|
1250
|
+
var totalData = Object.assign({}, _this11.state.total);
|
|
1228
1251
|
totalData[field] = total.toFixed(2);
|
|
1229
1252
|
|
|
1230
|
-
|
|
1253
|
+
_this11.setState({
|
|
1231
1254
|
total: totalData
|
|
1232
1255
|
});
|
|
1233
1256
|
};
|
|
@@ -1235,17 +1258,17 @@ function (_React$Component) {
|
|
|
1235
1258
|
}, {
|
|
1236
1259
|
key: "render",
|
|
1237
1260
|
value: function render() {
|
|
1238
|
-
var
|
|
1261
|
+
var _this12 = this;
|
|
1239
1262
|
|
|
1240
1263
|
return _react["default"].createElement("div", {
|
|
1241
1264
|
ref: function ref(c) {
|
|
1242
|
-
return
|
|
1265
|
+
return _this12.mainDom = c;
|
|
1243
1266
|
},
|
|
1244
1267
|
className: this.getMainClasses(),
|
|
1245
1268
|
style: this.getStyles()
|
|
1246
1269
|
}, _react["default"].createElement("div", {
|
|
1247
1270
|
ref: function ref(c) {
|
|
1248
|
-
return
|
|
1271
|
+
return _this12.conDom = c;
|
|
1249
1272
|
},
|
|
1250
1273
|
className: this.getBodyClasses()
|
|
1251
1274
|
}, this.renderHeader(), this.renderRows(), this.renderTotal(), _react["default"].createElement(_reactBootstrap.Scroll, {
|
|
@@ -1254,7 +1277,7 @@ function (_React$Component) {
|
|
|
1254
1277
|
selector: "#table-body-com-".concat(this.domId)
|
|
1255
1278
|
})), this.renderFoot(), _react["default"].createElement("div", {
|
|
1256
1279
|
ref: function ref(c) {
|
|
1257
|
-
return
|
|
1280
|
+
return _this12.split = c;
|
|
1258
1281
|
},
|
|
1259
1282
|
className: "ck-split d-none"
|
|
1260
1283
|
}));
|
|
@@ -1262,15 +1285,15 @@ function (_React$Component) {
|
|
|
1262
1285
|
}, {
|
|
1263
1286
|
key: "renderHeader",
|
|
1264
1287
|
value: function renderHeader() {
|
|
1265
|
-
var
|
|
1288
|
+
var _this13 = this;
|
|
1266
1289
|
|
|
1267
1290
|
return _react["default"].createElement("div", {
|
|
1268
1291
|
ref: function ref(c) {
|
|
1269
|
-
return
|
|
1292
|
+
return _this13.tableHeader = c;
|
|
1270
1293
|
}
|
|
1271
1294
|
}, _react["default"].createElement("table", {
|
|
1272
1295
|
ref: function ref(c) {
|
|
1273
|
-
return
|
|
1296
|
+
return _this13.table_head = c;
|
|
1274
1297
|
},
|
|
1275
1298
|
id: "table-head-".concat(this.domId),
|
|
1276
1299
|
className: this.getClasses(''),
|
|
@@ -1286,7 +1309,7 @@ function (_React$Component) {
|
|
|
1286
1309
|
icon: "list"
|
|
1287
1310
|
}) : _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1288
1311
|
ref: function ref(c) {
|
|
1289
|
-
return
|
|
1312
|
+
return _this13.allchk = c;
|
|
1290
1313
|
},
|
|
1291
1314
|
onChange: this.selectAll,
|
|
1292
1315
|
checked: this.state.selectAll,
|
|
@@ -1299,7 +1322,7 @@ function (_React$Component) {
|
|
|
1299
1322
|
}) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1300
1323
|
var _ref, _item$props;
|
|
1301
1324
|
|
|
1302
|
-
|
|
1325
|
+
_this13.cacheRow[item.props.field] = (_ref = (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.def) !== null && _ref !== void 0 ? _ref : '';
|
|
1303
1326
|
|
|
1304
1327
|
if (!item || item.props.hide) {
|
|
1305
1328
|
return null;
|
|
@@ -1316,28 +1339,28 @@ function (_React$Component) {
|
|
|
1316
1339
|
|
|
1317
1340
|
var sort_icon = '';
|
|
1318
1341
|
|
|
1319
|
-
if (
|
|
1320
|
-
sort_icon = 'sort-alpha-' + (
|
|
1342
|
+
if (_this13.sortList[item.props.field]) {
|
|
1343
|
+
sort_icon = 'sort-alpha-' + (_this13.sortList[item.props.field] === 'asc' ? 'down' : 'up');
|
|
1321
1344
|
}
|
|
1322
1345
|
|
|
1323
1346
|
return _react["default"].createElement("th", {
|
|
1324
|
-
onContextMenu:
|
|
1325
|
-
id:
|
|
1347
|
+
onContextMenu: _this13.menuContextHandler(''),
|
|
1348
|
+
id: _this13.domId + '-' + key,
|
|
1326
1349
|
"data-key": 'head_' + key,
|
|
1327
1350
|
style: style
|
|
1328
|
-
},
|
|
1351
|
+
}, _this13.is_sort ? _react["default"].createElement("a", {
|
|
1329
1352
|
className: "ck-ctable-sort",
|
|
1330
1353
|
href: "javascript://",
|
|
1331
|
-
id: "".concat(
|
|
1354
|
+
id: "".concat(_this13.domId, "-sort-").concat(item.props.field),
|
|
1332
1355
|
"data-field": item.props.field,
|
|
1333
|
-
onClick:
|
|
1356
|
+
onClick: _this13.sortHandler
|
|
1334
1357
|
}, item.props.text, " ", _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1335
1358
|
icon: sort_icon
|
|
1336
|
-
})) : item.props.text,
|
|
1359
|
+
})) : item.props.text, _this13.props.move ? _react["default"].createElement("span", {
|
|
1337
1360
|
ref: function ref(c) {
|
|
1338
|
-
return
|
|
1361
|
+
return _this13.headerSplits.push(c);
|
|
1339
1362
|
},
|
|
1340
|
-
"data-key":
|
|
1363
|
+
"data-key": _this13.domId + '-' + key,
|
|
1341
1364
|
className: "ck-column-split"
|
|
1342
1365
|
}) : null);
|
|
1343
1366
|
})))));
|
|
@@ -1345,34 +1368,34 @@ function (_React$Component) {
|
|
|
1345
1368
|
}, {
|
|
1346
1369
|
key: "renderRows",
|
|
1347
1370
|
value: function renderRows() {
|
|
1348
|
-
var
|
|
1371
|
+
var _this14 = this;
|
|
1349
1372
|
|
|
1350
1373
|
return _react["default"].createElement("div", {
|
|
1351
1374
|
ref: function ref(c) {
|
|
1352
|
-
return
|
|
1375
|
+
return _this14.table_rows = c;
|
|
1353
1376
|
},
|
|
1354
1377
|
id: "table-body-com-".concat(this.domId),
|
|
1355
1378
|
className: "flex-grow-1 rows",
|
|
1356
1379
|
onScroll: this.scrollHandler
|
|
1357
1380
|
}, _react["default"].createElement("table", {
|
|
1358
1381
|
ref: function ref(c) {
|
|
1359
|
-
return
|
|
1382
|
+
return _this14.table_body = c;
|
|
1360
1383
|
},
|
|
1361
1384
|
id: "table-body-".concat(this.domId),
|
|
1362
1385
|
className: this.getClasses(),
|
|
1363
1386
|
style: this.getTableStyles()
|
|
1364
1387
|
}, _react["default"].createElement("tbody", null, this.state.data.map(function (row, i) {
|
|
1365
|
-
if (
|
|
1366
|
-
return
|
|
1388
|
+
if (_this14.props.edit) {
|
|
1389
|
+
return _this14.renderEditRow(row, i);
|
|
1367
1390
|
}
|
|
1368
1391
|
|
|
1369
|
-
return
|
|
1392
|
+
return _this14.renderRow(row, i, null);
|
|
1370
1393
|
}), this.props.edit && this.props.newBar ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
|
|
1371
1394
|
}
|
|
1372
1395
|
}, {
|
|
1373
1396
|
key: "renderRow",
|
|
1374
1397
|
value: function renderRow(row, i, parentRow) {
|
|
1375
|
-
var
|
|
1398
|
+
var _this15 = this;
|
|
1376
1399
|
|
|
1377
1400
|
var checked = this.state.selectRows.indexOf(i) !== -1;
|
|
1378
1401
|
var focus = i === this.state.focus && this.props.focus;
|
|
@@ -1395,9 +1418,9 @@ function (_React$Component) {
|
|
|
1395
1418
|
} //set style
|
|
1396
1419
|
|
|
1397
1420
|
|
|
1398
|
-
var style = _objectSpread({},
|
|
1421
|
+
var style = _objectSpread({}, _this15.props.columnStyle);
|
|
1399
1422
|
|
|
1400
|
-
style.textAlign = item.props.align ||
|
|
1423
|
+
style.textAlign = item.props.align || _this15.props.align;
|
|
1401
1424
|
|
|
1402
1425
|
if (item.props.width) {
|
|
1403
1426
|
style.width = item.props.width;
|
|
@@ -1429,8 +1452,8 @@ function (_React$Component) {
|
|
|
1429
1452
|
|
|
1430
1453
|
if (item.props.children) {
|
|
1431
1454
|
return _react["default"].createElement("td", {
|
|
1432
|
-
onContextMenu:
|
|
1433
|
-
id:
|
|
1455
|
+
onContextMenu: _this15.menuContextHandler(dataType),
|
|
1456
|
+
id: _this15.domId + '-' + key,
|
|
1434
1457
|
"data-row": "".concat(i),
|
|
1435
1458
|
"data-field": item.props.field,
|
|
1436
1459
|
className: item.props.className,
|
|
@@ -1446,8 +1469,8 @@ function (_React$Component) {
|
|
|
1446
1469
|
}
|
|
1447
1470
|
|
|
1448
1471
|
return _react["default"].createElement("td", {
|
|
1449
|
-
onContextMenu:
|
|
1450
|
-
id:
|
|
1472
|
+
onContextMenu: _this15.menuContextHandler(dataType),
|
|
1473
|
+
id: _this15.domId + '-' + key,
|
|
1451
1474
|
"data-field": item.props.field,
|
|
1452
1475
|
style: style,
|
|
1453
1476
|
onClick: function onClick(e) {
|
|
@@ -1461,14 +1484,14 @@ function (_React$Component) {
|
|
|
1461
1484
|
}
|
|
1462
1485
|
},
|
|
1463
1486
|
"data-row": "".concat(i)
|
|
1464
|
-
}, item.props.type ?
|
|
1487
|
+
}, item.props.type ? _this15.renderEditComponent(item.props, row, i) : item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field]);
|
|
1465
1488
|
}
|
|
1466
1489
|
})));
|
|
1467
1490
|
}
|
|
1468
1491
|
}, {
|
|
1469
1492
|
key: "renderEditRow",
|
|
1470
1493
|
value: function renderEditRow(row, i) {
|
|
1471
|
-
var
|
|
1494
|
+
var _this16 = this;
|
|
1472
1495
|
|
|
1473
1496
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1474
1497
|
className: this.props.onClick ? 'click-row' : undefined,
|
|
@@ -1493,7 +1516,7 @@ function (_React$Component) {
|
|
|
1493
1516
|
className: this.props.disabled ? 'text-secondary' : 'text-danger',
|
|
1494
1517
|
text: "delete",
|
|
1495
1518
|
onClick: function onClick() {
|
|
1496
|
-
|
|
1519
|
+
_this16.deleteRowHandler(i);
|
|
1497
1520
|
}
|
|
1498
1521
|
})) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1499
1522
|
if (!item || item.props.hide) {
|
|
@@ -1501,9 +1524,9 @@ function (_React$Component) {
|
|
|
1501
1524
|
} //set style
|
|
1502
1525
|
|
|
1503
1526
|
|
|
1504
|
-
var style = _objectSpread({},
|
|
1527
|
+
var style = _objectSpread({}, _this16.props.columnStyle);
|
|
1505
1528
|
|
|
1506
|
-
style.textAlign = item.props.align ||
|
|
1529
|
+
style.textAlign = item.props.align || _this16.props.align;
|
|
1507
1530
|
|
|
1508
1531
|
if (item.props.width) {
|
|
1509
1532
|
style.width = item.props.width;
|
|
@@ -1511,9 +1534,9 @@ function (_React$Component) {
|
|
|
1511
1534
|
|
|
1512
1535
|
var dataType = 'text';
|
|
1513
1536
|
return _react["default"].createElement("td", {
|
|
1514
|
-
onContextMenu:
|
|
1537
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1515
1538
|
className: item.props.disabled ? 'disabled' : '',
|
|
1516
|
-
id:
|
|
1539
|
+
id: _this16.domId + '-' + key,
|
|
1517
1540
|
"data-field": item.props.field,
|
|
1518
1541
|
style: style,
|
|
1519
1542
|
onClick: function onClick(e) {
|
|
@@ -1527,13 +1550,13 @@ function (_React$Component) {
|
|
|
1527
1550
|
}
|
|
1528
1551
|
},
|
|
1529
1552
|
"data-row": "".concat(i)
|
|
1530
|
-
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] :
|
|
1553
|
+
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] : _this16.renderEditComponent(item.props, row, i));
|
|
1531
1554
|
})));
|
|
1532
1555
|
}
|
|
1533
1556
|
}, {
|
|
1534
1557
|
key: "renderEditAddRow",
|
|
1535
1558
|
value: function renderEditAddRow() {
|
|
1536
|
-
var
|
|
1559
|
+
var _this17 = this;
|
|
1537
1560
|
|
|
1538
1561
|
if (this.props.disabled) {
|
|
1539
1562
|
return null;
|
|
@@ -1563,9 +1586,9 @@ function (_React$Component) {
|
|
|
1563
1586
|
};
|
|
1564
1587
|
return _react["default"].createElement("td", {
|
|
1565
1588
|
style: style,
|
|
1566
|
-
id:
|
|
1589
|
+
id: _this17.domId + '-' + key
|
|
1567
1590
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1568
|
-
onFocus:
|
|
1591
|
+
onFocus: _this17.addNewHandler
|
|
1569
1592
|
}));
|
|
1570
1593
|
}));
|
|
1571
1594
|
}
|
|
@@ -1574,7 +1597,7 @@ function (_React$Component) {
|
|
|
1574
1597
|
value: function renderEditComponent(item, row, i) {
|
|
1575
1598
|
var _item$disabled,
|
|
1576
1599
|
_item$disabled2,
|
|
1577
|
-
|
|
1600
|
+
_this18 = this,
|
|
1578
1601
|
_item$disabled3,
|
|
1579
1602
|
_item$disabled4,
|
|
1580
1603
|
_item$disabled5;
|
|
@@ -1609,7 +1632,7 @@ function (_React$Component) {
|
|
|
1609
1632
|
className: "d-inline",
|
|
1610
1633
|
width: "20px",
|
|
1611
1634
|
onChange: function onChange(chk, e) {
|
|
1612
|
-
|
|
1635
|
+
_this18.editHandler(e, chk, 'chk');
|
|
1613
1636
|
},
|
|
1614
1637
|
"data-row": i,
|
|
1615
1638
|
"data-field": item.field,
|
|
@@ -1646,7 +1669,7 @@ function (_React$Component) {
|
|
|
1646
1669
|
var _this$props$showNumbe,
|
|
1647
1670
|
_this$props$showPages,
|
|
1648
1671
|
_this$props$edit,
|
|
1649
|
-
|
|
1672
|
+
_this19 = this;
|
|
1650
1673
|
|
|
1651
1674
|
if (!this.props.foot) {
|
|
1652
1675
|
return null;
|
|
@@ -1663,21 +1686,21 @@ function (_React$Component) {
|
|
|
1663
1686
|
noPage: (_this$props$edit = this.props.edit) !== null && _this$props$edit !== void 0 ? _this$props$edit : false
|
|
1664
1687
|
}), _react["default"].createElement("div", {
|
|
1665
1688
|
ref: function ref(c) {
|
|
1666
|
-
|
|
1689
|
+
_this19.fullButton = c;
|
|
1667
1690
|
},
|
|
1668
1691
|
className: "full-btn align-self-center ms-auto pe-2 text-primary",
|
|
1669
1692
|
onClick: function onClick() {
|
|
1670
|
-
|
|
1693
|
+
_this19.fullHandler();
|
|
1671
1694
|
}
|
|
1672
1695
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1673
1696
|
icon: "expand"
|
|
1674
1697
|
})), _react["default"].createElement("div", {
|
|
1675
1698
|
ref: function ref(c) {
|
|
1676
|
-
|
|
1699
|
+
_this19.fullButton2 = c;
|
|
1677
1700
|
},
|
|
1678
1701
|
className: "right-full-btn d-none",
|
|
1679
1702
|
onClick: function onClick() {
|
|
1680
|
-
|
|
1703
|
+
_this19.fullHandler();
|
|
1681
1704
|
}
|
|
1682
1705
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1683
1706
|
icon: "times"
|
|
@@ -1686,7 +1709,7 @@ function (_React$Component) {
|
|
|
1686
1709
|
}, {
|
|
1687
1710
|
key: "renderTotal",
|
|
1688
1711
|
value: function renderTotal() {
|
|
1689
|
-
var
|
|
1712
|
+
var _this20 = this;
|
|
1690
1713
|
|
|
1691
1714
|
if (!this.state.total) {
|
|
1692
1715
|
return null;
|
|
@@ -1695,12 +1718,12 @@ function (_React$Component) {
|
|
|
1695
1718
|
var total = this.state.total;
|
|
1696
1719
|
return _react["default"].createElement("div", {
|
|
1697
1720
|
ref: function ref(c) {
|
|
1698
|
-
return
|
|
1721
|
+
return _this20.tableTotal = c;
|
|
1699
1722
|
},
|
|
1700
1723
|
className: "ck-ctable-total"
|
|
1701
1724
|
}, _react["default"].createElement("table", {
|
|
1702
1725
|
ref: function ref(c) {
|
|
1703
|
-
return
|
|
1726
|
+
return _this20.table_total = c;
|
|
1704
1727
|
},
|
|
1705
1728
|
id: "table-total-".concat(this.domId),
|
|
1706
1729
|
className: this.getClasses(),
|
|
@@ -1719,7 +1742,7 @@ function (_React$Component) {
|
|
|
1719
1742
|
return null;
|
|
1720
1743
|
}
|
|
1721
1744
|
|
|
1722
|
-
var align = item.props.align ||
|
|
1745
|
+
var align = item.props.align || _this20.props.align;
|
|
1723
1746
|
var style = {
|
|
1724
1747
|
'textAlign': align
|
|
1725
1748
|
};
|
|
@@ -1729,7 +1752,7 @@ function (_React$Component) {
|
|
|
1729
1752
|
}
|
|
1730
1753
|
|
|
1731
1754
|
return _react["default"].createElement("td", {
|
|
1732
|
-
id:
|
|
1755
|
+
id: _this20.domId + '-' + key,
|
|
1733
1756
|
"data-field": item.props.field,
|
|
1734
1757
|
style: style
|
|
1735
1758
|
}, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
|
|
@@ -1738,7 +1761,7 @@ function (_React$Component) {
|
|
|
1738
1761
|
}, {
|
|
1739
1762
|
key: "renderMenu",
|
|
1740
1763
|
value: function renderMenu() {
|
|
1741
|
-
var
|
|
1764
|
+
var _this21 = this;
|
|
1742
1765
|
|
|
1743
1766
|
var lang;
|
|
1744
1767
|
|
|
@@ -1757,7 +1780,7 @@ function (_React$Component) {
|
|
|
1757
1780
|
|
|
1758
1781
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1759
1782
|
ref: function ref(c) {
|
|
1760
|
-
return
|
|
1783
|
+
return _this21.mainMenu = c;
|
|
1761
1784
|
},
|
|
1762
1785
|
onClick: this.menuClickHandler
|
|
1763
1786
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1777,7 +1800,7 @@ function (_React$Component) {
|
|
|
1777
1800
|
var select = document.getSelection();
|
|
1778
1801
|
if (!select) return;
|
|
1779
1802
|
|
|
1780
|
-
|
|
1803
|
+
_this21.filterHandler(select.toString(), data.field, 'contain');
|
|
1781
1804
|
}
|
|
1782
1805
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1783
1806
|
className: "me-1",
|
|
@@ -1788,7 +1811,7 @@ function (_React$Component) {
|
|
|
1788
1811
|
var select = document.getSelection();
|
|
1789
1812
|
if (!select) return;
|
|
1790
1813
|
|
|
1791
|
-
|
|
1814
|
+
_this21.filterHandler(select.toString(), data.field, 'exclude');
|
|
1792
1815
|
}
|
|
1793
1816
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1794
1817
|
className: "me-1",
|
|
@@ -1796,7 +1819,7 @@ function (_React$Component) {
|
|
|
1796
1819
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1797
1820
|
field: "clear_filter",
|
|
1798
1821
|
onClick: function onClick() {
|
|
1799
|
-
|
|
1822
|
+
_this21.clearFilter();
|
|
1800
1823
|
}
|
|
1801
1824
|
}, _react["default"].createElement("span", {
|
|
1802
1825
|
className: "text-danger"
|
|
@@ -1813,7 +1836,7 @@ function (_React$Component) {
|
|
|
1813
1836
|
style: inputStyle
|
|
1814
1837
|
}, lang['Equal With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1815
1838
|
ref: function ref(c) {
|
|
1816
|
-
return
|
|
1839
|
+
return _this21.filter.equal = c;
|
|
1817
1840
|
},
|
|
1818
1841
|
className: "me-1",
|
|
1819
1842
|
size: "xs",
|
|
@@ -1822,13 +1845,13 @@ function (_React$Component) {
|
|
|
1822
1845
|
onChange: this.filterChangeHandler('equal'),
|
|
1823
1846
|
onMouseDown: stopEvent,
|
|
1824
1847
|
onEnter: function onEnter() {
|
|
1825
|
-
|
|
1848
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1826
1849
|
}
|
|
1827
1850
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1828
1851
|
size: "xs",
|
|
1829
1852
|
onMouseDown: stopEvent,
|
|
1830
1853
|
onClick: function onClick(e) {
|
|
1831
|
-
|
|
1854
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1832
1855
|
},
|
|
1833
1856
|
icon: "search"
|
|
1834
1857
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1838,7 +1861,7 @@ function (_React$Component) {
|
|
|
1838
1861
|
style: inputStyle
|
|
1839
1862
|
}, lang['Start With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1840
1863
|
ref: function ref(c) {
|
|
1841
|
-
return
|
|
1864
|
+
return _this21.filter.start = c;
|
|
1842
1865
|
},
|
|
1843
1866
|
className: "me-1",
|
|
1844
1867
|
size: "xs",
|
|
@@ -1847,13 +1870,13 @@ function (_React$Component) {
|
|
|
1847
1870
|
onChange: this.filterChangeHandler('start'),
|
|
1848
1871
|
onMouseDown: stopEvent,
|
|
1849
1872
|
onEnter: function onEnter() {
|
|
1850
|
-
|
|
1873
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1851
1874
|
}
|
|
1852
1875
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1853
1876
|
size: "xs",
|
|
1854
1877
|
onMouseDown: stopEvent,
|
|
1855
1878
|
onClick: function onClick(e) {
|
|
1856
|
-
|
|
1879
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1857
1880
|
},
|
|
1858
1881
|
icon: "search"
|
|
1859
1882
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1863,7 +1886,7 @@ function (_React$Component) {
|
|
|
1863
1886
|
style: inputStyle
|
|
1864
1887
|
}, lang['End With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1865
1888
|
ref: function ref(c) {
|
|
1866
|
-
return
|
|
1889
|
+
return _this21.filter.end = c;
|
|
1867
1890
|
},
|
|
1868
1891
|
className: "me-1",
|
|
1869
1892
|
size: "xs",
|
|
@@ -1872,13 +1895,13 @@ function (_React$Component) {
|
|
|
1872
1895
|
onChange: this.filterChangeHandler('end'),
|
|
1873
1896
|
onMouseDown: stopEvent,
|
|
1874
1897
|
onEnter: function onEnter() {
|
|
1875
|
-
|
|
1898
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1876
1899
|
}
|
|
1877
1900
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1878
1901
|
size: "xs",
|
|
1879
1902
|
onMouseDown: stopEvent,
|
|
1880
1903
|
onClick: function onClick(e) {
|
|
1881
|
-
|
|
1904
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1882
1905
|
},
|
|
1883
1906
|
icon: "search"
|
|
1884
1907
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1888,7 +1911,7 @@ function (_React$Component) {
|
|
|
1888
1911
|
style: inputStyle
|
|
1889
1912
|
}, lang['Contain with']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1890
1913
|
ref: function ref(c) {
|
|
1891
|
-
return
|
|
1914
|
+
return _this21.filter.contain = c;
|
|
1892
1915
|
},
|
|
1893
1916
|
className: "me-1",
|
|
1894
1917
|
size: "xs",
|
|
@@ -1897,13 +1920,13 @@ function (_React$Component) {
|
|
|
1897
1920
|
onChange: this.filterChangeHandler('contain'),
|
|
1898
1921
|
onMouseDown: stopEvent,
|
|
1899
1922
|
onEnter: function onEnter() {
|
|
1900
|
-
|
|
1923
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1901
1924
|
}
|
|
1902
1925
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1903
1926
|
size: "xs",
|
|
1904
1927
|
onMouseDown: stopEvent,
|
|
1905
1928
|
onClick: function onClick(e) {
|
|
1906
|
-
|
|
1929
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1907
1930
|
},
|
|
1908
1931
|
icon: "search"
|
|
1909
1932
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1915,13 +1938,16 @@ function (_React$Component) {
|
|
|
1915
1938
|
}, _react["default"].createElement("div", {
|
|
1916
1939
|
className: "w-100"
|
|
1917
1940
|
}, lang['Condition Filter']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1941
|
+
ref: function ref(c) {
|
|
1942
|
+
return _this21.filter.condition = c;
|
|
1943
|
+
},
|
|
1918
1944
|
size: "xs",
|
|
1919
1945
|
width: "100%",
|
|
1920
1946
|
data: this.state.filter.condition,
|
|
1921
1947
|
onChange: this.filterChangeHandler('condition'),
|
|
1922
1948
|
onMouseDown: stopEvent,
|
|
1923
1949
|
onEnter: function onEnter() {
|
|
1924
|
-
|
|
1950
|
+
_this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
|
|
1925
1951
|
}
|
|
1926
1952
|
})) : null, this.props.edit && (!this.props.nodel || this.props.newBar) ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1927
1953
|
field: "",
|
|
@@ -1934,14 +1960,14 @@ function (_React$Component) {
|
|
|
1934
1960
|
field: "",
|
|
1935
1961
|
step: true
|
|
1936
1962
|
}) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
|
|
1937
|
-
return
|
|
1963
|
+
return _this21.explainCustomMenu(menu);
|
|
1938
1964
|
}) : null));
|
|
1939
1965
|
} // MARK:-生成数字菜单
|
|
1940
1966
|
|
|
1941
1967
|
}, {
|
|
1942
1968
|
key: "renderNumberMenu",
|
|
1943
1969
|
value: function renderNumberMenu() {
|
|
1944
|
-
var
|
|
1970
|
+
var _this22 = this;
|
|
1945
1971
|
|
|
1946
1972
|
var lang;
|
|
1947
1973
|
|
|
@@ -1960,7 +1986,7 @@ function (_React$Component) {
|
|
|
1960
1986
|
|
|
1961
1987
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1962
1988
|
ref: function ref(c) {
|
|
1963
|
-
return
|
|
1989
|
+
return _this22.numMenu = c;
|
|
1964
1990
|
},
|
|
1965
1991
|
onClick: this.menuClickHandler
|
|
1966
1992
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1980,7 +2006,7 @@ function (_React$Component) {
|
|
|
1980
2006
|
var select = document.getSelection();
|
|
1981
2007
|
if (!select) return;
|
|
1982
2008
|
|
|
1983
|
-
|
|
2009
|
+
_this22.filterHandler(select.toString(), data.field, 'contain');
|
|
1984
2010
|
}
|
|
1985
2011
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1986
2012
|
className: "me-1",
|
|
@@ -1991,7 +2017,7 @@ function (_React$Component) {
|
|
|
1991
2017
|
var select = document.getSelection();
|
|
1992
2018
|
if (!select) return;
|
|
1993
2019
|
|
|
1994
|
-
|
|
2020
|
+
_this22.filterHandler(select.toString(), data.field, 'exclude');
|
|
1995
2021
|
}
|
|
1996
2022
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1997
2023
|
className: "me-1",
|
|
@@ -1999,7 +2025,7 @@ function (_React$Component) {
|
|
|
1999
2025
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
2000
2026
|
field: "clear_filter",
|
|
2001
2027
|
onClick: function onClick() {
|
|
2002
|
-
|
|
2028
|
+
_this22.clearFilter();
|
|
2003
2029
|
}
|
|
2004
2030
|
}, _react["default"].createElement("span", {
|
|
2005
2031
|
className: "text-danger"
|
|
@@ -2022,20 +2048,20 @@ function (_React$Component) {
|
|
|
2022
2048
|
onMouseDown: stopEvent,
|
|
2023
2049
|
onEnter: function onEnter() {
|
|
2024
2050
|
var reg = /(>=|<=|<|>|=|!=)+\s*(\d+)/i;
|
|
2025
|
-
var m = String(
|
|
2051
|
+
var m = String(_this22.state.filter.condition).match(reg);
|
|
2026
2052
|
|
|
2027
2053
|
if (m) {
|
|
2028
|
-
|
|
2054
|
+
_this22.filterHandler(m[2], _this22.numMenu.data.field, numberCondition[m[1]]);
|
|
2029
2055
|
} else {
|
|
2030
|
-
|
|
2056
|
+
_this22.filterHandler(_this22.state.filter.condition, _this22.numMenu.data.field, 'condition');
|
|
2031
2057
|
}
|
|
2032
2058
|
}
|
|
2033
|
-
})
|
|
2059
|
+
})) : null));
|
|
2034
2060
|
}
|
|
2035
2061
|
}, {
|
|
2036
2062
|
key: "explainCustomMenu",
|
|
2037
2063
|
value: function explainCustomMenu(menu) {
|
|
2038
|
-
var
|
|
2064
|
+
var _this23 = this;
|
|
2039
2065
|
|
|
2040
2066
|
if (menu.children && menu.children instanceof Array) {
|
|
2041
2067
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -2043,7 +2069,7 @@ function (_React$Component) {
|
|
|
2043
2069
|
text: menu.text,
|
|
2044
2070
|
child: true
|
|
2045
2071
|
}, menu.children.map(function (item) {
|
|
2046
|
-
return
|
|
2072
|
+
return _this23.explainCustomMenu(item);
|
|
2047
2073
|
}));
|
|
2048
2074
|
} else {
|
|
2049
2075
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|