@clake/react-bootstrap4-window 1.1.8 → 1.1.9
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 +136 -137
- package/lib/CTable.js.map +3 -3
- package/lib/CTableInput.js +2 -2
- package/lib/CTableInput.js.map +2 -2
- 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/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 +1 -1
package/lib/CTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @clake/react-bootstrap4-window v1.1.
|
|
1
|
+
/* @clake/react-bootstrap4-window v1.1.9 | by Clake
|
|
2
2
|
* Copyright (c) 2024 Clake,
|
|
3
|
-
* 2024-12-
|
|
3
|
+
* 2024-12-10T09:36:02+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) {
|
|
@@ -948,32 +973,6 @@ function (_React$Component) {
|
|
|
948
973
|
this.deleteRow(row_index);
|
|
949
974
|
}
|
|
950
975
|
}
|
|
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
976
|
}, {
|
|
978
977
|
key: "cloneRow",
|
|
979
978
|
value: function cloneRow(row_index) {
|
|
@@ -999,10 +998,10 @@ function (_React$Component) {
|
|
|
999
998
|
* 得到所有选中的行
|
|
1000
999
|
*/
|
|
1001
1000
|
value: function getSelectRows() {
|
|
1002
|
-
var
|
|
1001
|
+
var _this9 = this;
|
|
1003
1002
|
|
|
1004
1003
|
return this.state.selectRows.map(function (item) {
|
|
1005
|
-
return
|
|
1004
|
+
return _this9.state.data[item];
|
|
1006
1005
|
});
|
|
1007
1006
|
}
|
|
1008
1007
|
/**
|
|
@@ -1032,50 +1031,50 @@ function (_React$Component) {
|
|
|
1032
1031
|
}, {
|
|
1033
1032
|
key: "bindSplit",
|
|
1034
1033
|
value: function bindSplit() {
|
|
1035
|
-
var
|
|
1034
|
+
var _this10 = this;
|
|
1036
1035
|
|
|
1037
1036
|
if (this.props.move) {
|
|
1038
1037
|
this.headerSplits.forEach(function (split) {
|
|
1039
|
-
if (!
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1038
|
+
if (!_this10.drag) {
|
|
1039
|
+
_this10.dragColumnLeft = 0;
|
|
1040
|
+
_this10.dragWidth = 0;
|
|
1041
|
+
_this10.drag = new _Drag["default"](_this10.split, split, {
|
|
1043
1042
|
start: function start(dragDom, eventDom) {
|
|
1044
|
-
var xy = _reactBootstrap.Common.GetDomXY(eventDom,
|
|
1043
|
+
var xy = _reactBootstrap.Common.GetDomXY(eventDom, _this10.mainDom);
|
|
1045
1044
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
dragDom.style.left =
|
|
1045
|
+
_this10.dragWidth = parseInt((eventDom === null || eventDom === void 0 ? void 0 : eventDom.parentNode).style.width);
|
|
1046
|
+
_this10.dragColumnLeft = xy.left - _this10.table_rows.scrollLeft;
|
|
1047
|
+
dragDom.style.left = _this10.dragColumnLeft + 'px';
|
|
1049
1048
|
dragDom.classList.remove('d-none');
|
|
1050
1049
|
return true;
|
|
1051
1050
|
},
|
|
1052
1051
|
move: function move(_move, dragDom, eventDom) {
|
|
1053
|
-
if (
|
|
1054
|
-
_move.x =
|
|
1052
|
+
if (_this10.dragWidth + (_move.x - _this10.dragColumnLeft) < 50) {
|
|
1053
|
+
_move.x = _this10.dragColumnLeft - _this10.dragWidth + 50;
|
|
1055
1054
|
}
|
|
1056
1055
|
},
|
|
1057
1056
|
end: function end(dragDom, eventDom) {
|
|
1058
1057
|
dragDom.classList.add('d-none');
|
|
1059
1058
|
var column_key = eventDom.dataset.key;
|
|
1060
1059
|
|
|
1061
|
-
var diff = parseInt(dragDom.style.left) -
|
|
1060
|
+
var diff = parseInt(dragDom.style.left) - _this10.dragColumnLeft;
|
|
1062
1061
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1062
|
+
_this10.width = parseInt(_this10.width) + diff + 'px';
|
|
1063
|
+
_this10.table_head.style.width = _this10.width;
|
|
1064
|
+
_this10.table_body.style.width = _this10.width;
|
|
1066
1065
|
|
|
1067
|
-
if (
|
|
1068
|
-
|
|
1066
|
+
if (_this10.table_total) {
|
|
1067
|
+
_this10.table_total.style.width = _this10.width;
|
|
1069
1068
|
}
|
|
1070
1069
|
|
|
1071
1070
|
document.querySelectorAll("#".concat(column_key)).forEach(function (item) {
|
|
1072
|
-
item.style.width = "".concat(
|
|
1071
|
+
item.style.width = "".concat(_this10.dragWidth + diff, "px");
|
|
1073
1072
|
});
|
|
1074
1073
|
return true;
|
|
1075
1074
|
}
|
|
1076
1075
|
});
|
|
1077
1076
|
} else {
|
|
1078
|
-
|
|
1077
|
+
_this10.drag.setEventDom(split);
|
|
1079
1078
|
}
|
|
1080
1079
|
});
|
|
1081
1080
|
}
|
|
@@ -1214,20 +1213,20 @@ function (_React$Component) {
|
|
|
1214
1213
|
}, {
|
|
1215
1214
|
key: "calcLocalTotal",
|
|
1216
1215
|
value: function calcLocalTotal(field) {
|
|
1217
|
-
var
|
|
1216
|
+
var _this11 = this;
|
|
1218
1217
|
|
|
1219
1218
|
return function (e) {
|
|
1220
|
-
var list =
|
|
1219
|
+
var list = _this11.state.data;
|
|
1221
1220
|
var total = 0;
|
|
1222
1221
|
list.forEach(function (item) {
|
|
1223
1222
|
if (!!parseFloat(item[field])) {
|
|
1224
1223
|
total += parseFloat(item[field]);
|
|
1225
1224
|
}
|
|
1226
1225
|
});
|
|
1227
|
-
var totalData = Object.assign({},
|
|
1226
|
+
var totalData = Object.assign({}, _this11.state.total);
|
|
1228
1227
|
totalData[field] = total.toFixed(2);
|
|
1229
1228
|
|
|
1230
|
-
|
|
1229
|
+
_this11.setState({
|
|
1231
1230
|
total: totalData
|
|
1232
1231
|
});
|
|
1233
1232
|
};
|
|
@@ -1235,17 +1234,17 @@ function (_React$Component) {
|
|
|
1235
1234
|
}, {
|
|
1236
1235
|
key: "render",
|
|
1237
1236
|
value: function render() {
|
|
1238
|
-
var
|
|
1237
|
+
var _this12 = this;
|
|
1239
1238
|
|
|
1240
1239
|
return _react["default"].createElement("div", {
|
|
1241
1240
|
ref: function ref(c) {
|
|
1242
|
-
return
|
|
1241
|
+
return _this12.mainDom = c;
|
|
1243
1242
|
},
|
|
1244
1243
|
className: this.getMainClasses(),
|
|
1245
1244
|
style: this.getStyles()
|
|
1246
1245
|
}, _react["default"].createElement("div", {
|
|
1247
1246
|
ref: function ref(c) {
|
|
1248
|
-
return
|
|
1247
|
+
return _this12.conDom = c;
|
|
1249
1248
|
},
|
|
1250
1249
|
className: this.getBodyClasses()
|
|
1251
1250
|
}, this.renderHeader(), this.renderRows(), this.renderTotal(), _react["default"].createElement(_reactBootstrap.Scroll, {
|
|
@@ -1254,7 +1253,7 @@ function (_React$Component) {
|
|
|
1254
1253
|
selector: "#table-body-com-".concat(this.domId)
|
|
1255
1254
|
})), this.renderFoot(), _react["default"].createElement("div", {
|
|
1256
1255
|
ref: function ref(c) {
|
|
1257
|
-
return
|
|
1256
|
+
return _this12.split = c;
|
|
1258
1257
|
},
|
|
1259
1258
|
className: "ck-split d-none"
|
|
1260
1259
|
}));
|
|
@@ -1262,15 +1261,15 @@ function (_React$Component) {
|
|
|
1262
1261
|
}, {
|
|
1263
1262
|
key: "renderHeader",
|
|
1264
1263
|
value: function renderHeader() {
|
|
1265
|
-
var
|
|
1264
|
+
var _this13 = this;
|
|
1266
1265
|
|
|
1267
1266
|
return _react["default"].createElement("div", {
|
|
1268
1267
|
ref: function ref(c) {
|
|
1269
|
-
return
|
|
1268
|
+
return _this13.tableHeader = c;
|
|
1270
1269
|
}
|
|
1271
1270
|
}, _react["default"].createElement("table", {
|
|
1272
1271
|
ref: function ref(c) {
|
|
1273
|
-
return
|
|
1272
|
+
return _this13.table_head = c;
|
|
1274
1273
|
},
|
|
1275
1274
|
id: "table-head-".concat(this.domId),
|
|
1276
1275
|
className: this.getClasses(''),
|
|
@@ -1286,7 +1285,7 @@ function (_React$Component) {
|
|
|
1286
1285
|
icon: "list"
|
|
1287
1286
|
}) : _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1288
1287
|
ref: function ref(c) {
|
|
1289
|
-
return
|
|
1288
|
+
return _this13.allchk = c;
|
|
1290
1289
|
},
|
|
1291
1290
|
onChange: this.selectAll,
|
|
1292
1291
|
checked: this.state.selectAll,
|
|
@@ -1299,7 +1298,7 @@ function (_React$Component) {
|
|
|
1299
1298
|
}) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1300
1299
|
var _ref, _item$props;
|
|
1301
1300
|
|
|
1302
|
-
|
|
1301
|
+
_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
1302
|
|
|
1304
1303
|
if (!item || item.props.hide) {
|
|
1305
1304
|
return null;
|
|
@@ -1316,28 +1315,28 @@ function (_React$Component) {
|
|
|
1316
1315
|
|
|
1317
1316
|
var sort_icon = '';
|
|
1318
1317
|
|
|
1319
|
-
if (
|
|
1320
|
-
sort_icon = 'sort-alpha-' + (
|
|
1318
|
+
if (_this13.sortList[item.props.field]) {
|
|
1319
|
+
sort_icon = 'sort-alpha-' + (_this13.sortList[item.props.field] === 'asc' ? 'down' : 'up');
|
|
1321
1320
|
}
|
|
1322
1321
|
|
|
1323
1322
|
return _react["default"].createElement("th", {
|
|
1324
|
-
onContextMenu:
|
|
1325
|
-
id:
|
|
1323
|
+
onContextMenu: _this13.menuContextHandler(''),
|
|
1324
|
+
id: _this13.domId + '-' + key,
|
|
1326
1325
|
"data-key": 'head_' + key,
|
|
1327
1326
|
style: style
|
|
1328
|
-
},
|
|
1327
|
+
}, _this13.is_sort ? _react["default"].createElement("a", {
|
|
1329
1328
|
className: "ck-ctable-sort",
|
|
1330
1329
|
href: "javascript://",
|
|
1331
|
-
id: "".concat(
|
|
1330
|
+
id: "".concat(_this13.domId, "-sort-").concat(item.props.field),
|
|
1332
1331
|
"data-field": item.props.field,
|
|
1333
|
-
onClick:
|
|
1332
|
+
onClick: _this13.sortHandler
|
|
1334
1333
|
}, item.props.text, " ", _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1335
1334
|
icon: sort_icon
|
|
1336
|
-
})) : item.props.text,
|
|
1335
|
+
})) : item.props.text, _this13.props.move ? _react["default"].createElement("span", {
|
|
1337
1336
|
ref: function ref(c) {
|
|
1338
|
-
return
|
|
1337
|
+
return _this13.headerSplits.push(c);
|
|
1339
1338
|
},
|
|
1340
|
-
"data-key":
|
|
1339
|
+
"data-key": _this13.domId + '-' + key,
|
|
1341
1340
|
className: "ck-column-split"
|
|
1342
1341
|
}) : null);
|
|
1343
1342
|
})))));
|
|
@@ -1345,34 +1344,34 @@ function (_React$Component) {
|
|
|
1345
1344
|
}, {
|
|
1346
1345
|
key: "renderRows",
|
|
1347
1346
|
value: function renderRows() {
|
|
1348
|
-
var
|
|
1347
|
+
var _this14 = this;
|
|
1349
1348
|
|
|
1350
1349
|
return _react["default"].createElement("div", {
|
|
1351
1350
|
ref: function ref(c) {
|
|
1352
|
-
return
|
|
1351
|
+
return _this14.table_rows = c;
|
|
1353
1352
|
},
|
|
1354
1353
|
id: "table-body-com-".concat(this.domId),
|
|
1355
1354
|
className: "flex-grow-1 rows",
|
|
1356
1355
|
onScroll: this.scrollHandler
|
|
1357
1356
|
}, _react["default"].createElement("table", {
|
|
1358
1357
|
ref: function ref(c) {
|
|
1359
|
-
return
|
|
1358
|
+
return _this14.table_body = c;
|
|
1360
1359
|
},
|
|
1361
1360
|
id: "table-body-".concat(this.domId),
|
|
1362
1361
|
className: this.getClasses(),
|
|
1363
1362
|
style: this.getTableStyles()
|
|
1364
1363
|
}, _react["default"].createElement("tbody", null, this.state.data.map(function (row, i) {
|
|
1365
|
-
if (
|
|
1366
|
-
return
|
|
1364
|
+
if (_this14.props.edit) {
|
|
1365
|
+
return _this14.renderEditRow(row, i);
|
|
1367
1366
|
}
|
|
1368
1367
|
|
|
1369
|
-
return
|
|
1368
|
+
return _this14.renderRow(row, i, null);
|
|
1370
1369
|
}), this.props.edit && this.props.newBar ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
|
|
1371
1370
|
}
|
|
1372
1371
|
}, {
|
|
1373
1372
|
key: "renderRow",
|
|
1374
1373
|
value: function renderRow(row, i, parentRow) {
|
|
1375
|
-
var
|
|
1374
|
+
var _this15 = this;
|
|
1376
1375
|
|
|
1377
1376
|
var checked = this.state.selectRows.indexOf(i) !== -1;
|
|
1378
1377
|
var focus = i === this.state.focus && this.props.focus;
|
|
@@ -1395,9 +1394,9 @@ function (_React$Component) {
|
|
|
1395
1394
|
} //set style
|
|
1396
1395
|
|
|
1397
1396
|
|
|
1398
|
-
var style = _objectSpread({},
|
|
1397
|
+
var style = _objectSpread({}, _this15.props.columnStyle);
|
|
1399
1398
|
|
|
1400
|
-
style.textAlign = item.props.align ||
|
|
1399
|
+
style.textAlign = item.props.align || _this15.props.align;
|
|
1401
1400
|
|
|
1402
1401
|
if (item.props.width) {
|
|
1403
1402
|
style.width = item.props.width;
|
|
@@ -1429,8 +1428,8 @@ function (_React$Component) {
|
|
|
1429
1428
|
|
|
1430
1429
|
if (item.props.children) {
|
|
1431
1430
|
return _react["default"].createElement("td", {
|
|
1432
|
-
onContextMenu:
|
|
1433
|
-
id:
|
|
1431
|
+
onContextMenu: _this15.menuContextHandler(dataType),
|
|
1432
|
+
id: _this15.domId + '-' + key,
|
|
1434
1433
|
"data-row": "".concat(i),
|
|
1435
1434
|
"data-field": item.props.field,
|
|
1436
1435
|
className: item.props.className,
|
|
@@ -1446,8 +1445,8 @@ function (_React$Component) {
|
|
|
1446
1445
|
}
|
|
1447
1446
|
|
|
1448
1447
|
return _react["default"].createElement("td", {
|
|
1449
|
-
onContextMenu:
|
|
1450
|
-
id:
|
|
1448
|
+
onContextMenu: _this15.menuContextHandler(dataType),
|
|
1449
|
+
id: _this15.domId + '-' + key,
|
|
1451
1450
|
"data-field": item.props.field,
|
|
1452
1451
|
style: style,
|
|
1453
1452
|
onClick: function onClick(e) {
|
|
@@ -1461,14 +1460,14 @@ function (_React$Component) {
|
|
|
1461
1460
|
}
|
|
1462
1461
|
},
|
|
1463
1462
|
"data-row": "".concat(i)
|
|
1464
|
-
}, item.props.type ?
|
|
1463
|
+
}, 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
1464
|
}
|
|
1466
1465
|
})));
|
|
1467
1466
|
}
|
|
1468
1467
|
}, {
|
|
1469
1468
|
key: "renderEditRow",
|
|
1470
1469
|
value: function renderEditRow(row, i) {
|
|
1471
|
-
var
|
|
1470
|
+
var _this16 = this;
|
|
1472
1471
|
|
|
1473
1472
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1474
1473
|
className: this.props.onClick ? 'click-row' : undefined,
|
|
@@ -1493,7 +1492,7 @@ function (_React$Component) {
|
|
|
1493
1492
|
className: this.props.disabled ? 'text-secondary' : 'text-danger',
|
|
1494
1493
|
text: "delete",
|
|
1495
1494
|
onClick: function onClick() {
|
|
1496
|
-
|
|
1495
|
+
_this16.deleteRowHandler(i);
|
|
1497
1496
|
}
|
|
1498
1497
|
})) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1499
1498
|
if (!item || item.props.hide) {
|
|
@@ -1501,9 +1500,9 @@ function (_React$Component) {
|
|
|
1501
1500
|
} //set style
|
|
1502
1501
|
|
|
1503
1502
|
|
|
1504
|
-
var style = _objectSpread({},
|
|
1503
|
+
var style = _objectSpread({}, _this16.props.columnStyle);
|
|
1505
1504
|
|
|
1506
|
-
style.textAlign = item.props.align ||
|
|
1505
|
+
style.textAlign = item.props.align || _this16.props.align;
|
|
1507
1506
|
|
|
1508
1507
|
if (item.props.width) {
|
|
1509
1508
|
style.width = item.props.width;
|
|
@@ -1511,9 +1510,9 @@ function (_React$Component) {
|
|
|
1511
1510
|
|
|
1512
1511
|
var dataType = 'text';
|
|
1513
1512
|
return _react["default"].createElement("td", {
|
|
1514
|
-
onContextMenu:
|
|
1513
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1515
1514
|
className: item.props.disabled ? 'disabled' : '',
|
|
1516
|
-
id:
|
|
1515
|
+
id: _this16.domId + '-' + key,
|
|
1517
1516
|
"data-field": item.props.field,
|
|
1518
1517
|
style: style,
|
|
1519
1518
|
onClick: function onClick(e) {
|
|
@@ -1527,13 +1526,13 @@ function (_React$Component) {
|
|
|
1527
1526
|
}
|
|
1528
1527
|
},
|
|
1529
1528
|
"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] :
|
|
1529
|
+
}, 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
1530
|
})));
|
|
1532
1531
|
}
|
|
1533
1532
|
}, {
|
|
1534
1533
|
key: "renderEditAddRow",
|
|
1535
1534
|
value: function renderEditAddRow() {
|
|
1536
|
-
var
|
|
1535
|
+
var _this17 = this;
|
|
1537
1536
|
|
|
1538
1537
|
if (this.props.disabled) {
|
|
1539
1538
|
return null;
|
|
@@ -1563,9 +1562,9 @@ function (_React$Component) {
|
|
|
1563
1562
|
};
|
|
1564
1563
|
return _react["default"].createElement("td", {
|
|
1565
1564
|
style: style,
|
|
1566
|
-
id:
|
|
1565
|
+
id: _this17.domId + '-' + key
|
|
1567
1566
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1568
|
-
onFocus:
|
|
1567
|
+
onFocus: _this17.addNewHandler
|
|
1569
1568
|
}));
|
|
1570
1569
|
}));
|
|
1571
1570
|
}
|
|
@@ -1574,7 +1573,7 @@ function (_React$Component) {
|
|
|
1574
1573
|
value: function renderEditComponent(item, row, i) {
|
|
1575
1574
|
var _item$disabled,
|
|
1576
1575
|
_item$disabled2,
|
|
1577
|
-
|
|
1576
|
+
_this18 = this,
|
|
1578
1577
|
_item$disabled3,
|
|
1579
1578
|
_item$disabled4,
|
|
1580
1579
|
_item$disabled5;
|
|
@@ -1609,7 +1608,7 @@ function (_React$Component) {
|
|
|
1609
1608
|
className: "d-inline",
|
|
1610
1609
|
width: "20px",
|
|
1611
1610
|
onChange: function onChange(chk, e) {
|
|
1612
|
-
|
|
1611
|
+
_this18.editHandler(e, chk, 'chk');
|
|
1613
1612
|
},
|
|
1614
1613
|
"data-row": i,
|
|
1615
1614
|
"data-field": item.field,
|
|
@@ -1646,7 +1645,7 @@ function (_React$Component) {
|
|
|
1646
1645
|
var _this$props$showNumbe,
|
|
1647
1646
|
_this$props$showPages,
|
|
1648
1647
|
_this$props$edit,
|
|
1649
|
-
|
|
1648
|
+
_this19 = this;
|
|
1650
1649
|
|
|
1651
1650
|
if (!this.props.foot) {
|
|
1652
1651
|
return null;
|
|
@@ -1663,21 +1662,21 @@ function (_React$Component) {
|
|
|
1663
1662
|
noPage: (_this$props$edit = this.props.edit) !== null && _this$props$edit !== void 0 ? _this$props$edit : false
|
|
1664
1663
|
}), _react["default"].createElement("div", {
|
|
1665
1664
|
ref: function ref(c) {
|
|
1666
|
-
|
|
1665
|
+
_this19.fullButton = c;
|
|
1667
1666
|
},
|
|
1668
1667
|
className: "full-btn align-self-center ms-auto pe-2 text-primary",
|
|
1669
1668
|
onClick: function onClick() {
|
|
1670
|
-
|
|
1669
|
+
_this19.fullHandler();
|
|
1671
1670
|
}
|
|
1672
1671
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1673
1672
|
icon: "expand"
|
|
1674
1673
|
})), _react["default"].createElement("div", {
|
|
1675
1674
|
ref: function ref(c) {
|
|
1676
|
-
|
|
1675
|
+
_this19.fullButton2 = c;
|
|
1677
1676
|
},
|
|
1678
1677
|
className: "right-full-btn d-none",
|
|
1679
1678
|
onClick: function onClick() {
|
|
1680
|
-
|
|
1679
|
+
_this19.fullHandler();
|
|
1681
1680
|
}
|
|
1682
1681
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1683
1682
|
icon: "times"
|
|
@@ -1686,7 +1685,7 @@ function (_React$Component) {
|
|
|
1686
1685
|
}, {
|
|
1687
1686
|
key: "renderTotal",
|
|
1688
1687
|
value: function renderTotal() {
|
|
1689
|
-
var
|
|
1688
|
+
var _this20 = this;
|
|
1690
1689
|
|
|
1691
1690
|
if (!this.state.total) {
|
|
1692
1691
|
return null;
|
|
@@ -1695,12 +1694,12 @@ function (_React$Component) {
|
|
|
1695
1694
|
var total = this.state.total;
|
|
1696
1695
|
return _react["default"].createElement("div", {
|
|
1697
1696
|
ref: function ref(c) {
|
|
1698
|
-
return
|
|
1697
|
+
return _this20.tableTotal = c;
|
|
1699
1698
|
},
|
|
1700
1699
|
className: "ck-ctable-total"
|
|
1701
1700
|
}, _react["default"].createElement("table", {
|
|
1702
1701
|
ref: function ref(c) {
|
|
1703
|
-
return
|
|
1702
|
+
return _this20.table_total = c;
|
|
1704
1703
|
},
|
|
1705
1704
|
id: "table-total-".concat(this.domId),
|
|
1706
1705
|
className: this.getClasses(),
|
|
@@ -1719,7 +1718,7 @@ function (_React$Component) {
|
|
|
1719
1718
|
return null;
|
|
1720
1719
|
}
|
|
1721
1720
|
|
|
1722
|
-
var align = item.props.align ||
|
|
1721
|
+
var align = item.props.align || _this20.props.align;
|
|
1723
1722
|
var style = {
|
|
1724
1723
|
'textAlign': align
|
|
1725
1724
|
};
|
|
@@ -1729,7 +1728,7 @@ function (_React$Component) {
|
|
|
1729
1728
|
}
|
|
1730
1729
|
|
|
1731
1730
|
return _react["default"].createElement("td", {
|
|
1732
|
-
id:
|
|
1731
|
+
id: _this20.domId + '-' + key,
|
|
1733
1732
|
"data-field": item.props.field,
|
|
1734
1733
|
style: style
|
|
1735
1734
|
}, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
|
|
@@ -1738,7 +1737,7 @@ function (_React$Component) {
|
|
|
1738
1737
|
}, {
|
|
1739
1738
|
key: "renderMenu",
|
|
1740
1739
|
value: function renderMenu() {
|
|
1741
|
-
var
|
|
1740
|
+
var _this21 = this;
|
|
1742
1741
|
|
|
1743
1742
|
var lang;
|
|
1744
1743
|
|
|
@@ -1757,7 +1756,7 @@ function (_React$Component) {
|
|
|
1757
1756
|
|
|
1758
1757
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1759
1758
|
ref: function ref(c) {
|
|
1760
|
-
return
|
|
1759
|
+
return _this21.mainMenu = c;
|
|
1761
1760
|
},
|
|
1762
1761
|
onClick: this.menuClickHandler
|
|
1763
1762
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1777,7 +1776,7 @@ function (_React$Component) {
|
|
|
1777
1776
|
var select = document.getSelection();
|
|
1778
1777
|
if (!select) return;
|
|
1779
1778
|
|
|
1780
|
-
|
|
1779
|
+
_this21.filterHandler(select.toString(), data.field, 'contain');
|
|
1781
1780
|
}
|
|
1782
1781
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1783
1782
|
className: "me-1",
|
|
@@ -1788,7 +1787,7 @@ function (_React$Component) {
|
|
|
1788
1787
|
var select = document.getSelection();
|
|
1789
1788
|
if (!select) return;
|
|
1790
1789
|
|
|
1791
|
-
|
|
1790
|
+
_this21.filterHandler(select.toString(), data.field, 'exclude');
|
|
1792
1791
|
}
|
|
1793
1792
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1794
1793
|
className: "me-1",
|
|
@@ -1796,7 +1795,7 @@ function (_React$Component) {
|
|
|
1796
1795
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1797
1796
|
field: "clear_filter",
|
|
1798
1797
|
onClick: function onClick() {
|
|
1799
|
-
|
|
1798
|
+
_this21.clearFilter();
|
|
1800
1799
|
}
|
|
1801
1800
|
}, _react["default"].createElement("span", {
|
|
1802
1801
|
className: "text-danger"
|
|
@@ -1813,7 +1812,7 @@ function (_React$Component) {
|
|
|
1813
1812
|
style: inputStyle
|
|
1814
1813
|
}, lang['Equal With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1815
1814
|
ref: function ref(c) {
|
|
1816
|
-
return
|
|
1815
|
+
return _this21.filter.equal = c;
|
|
1817
1816
|
},
|
|
1818
1817
|
className: "me-1",
|
|
1819
1818
|
size: "xs",
|
|
@@ -1822,13 +1821,13 @@ function (_React$Component) {
|
|
|
1822
1821
|
onChange: this.filterChangeHandler('equal'),
|
|
1823
1822
|
onMouseDown: stopEvent,
|
|
1824
1823
|
onEnter: function onEnter() {
|
|
1825
|
-
|
|
1824
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1826
1825
|
}
|
|
1827
1826
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1828
1827
|
size: "xs",
|
|
1829
1828
|
onMouseDown: stopEvent,
|
|
1830
1829
|
onClick: function onClick(e) {
|
|
1831
|
-
|
|
1830
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1832
1831
|
},
|
|
1833
1832
|
icon: "search"
|
|
1834
1833
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1838,7 +1837,7 @@ function (_React$Component) {
|
|
|
1838
1837
|
style: inputStyle
|
|
1839
1838
|
}, lang['Start With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1840
1839
|
ref: function ref(c) {
|
|
1841
|
-
return
|
|
1840
|
+
return _this21.filter.start = c;
|
|
1842
1841
|
},
|
|
1843
1842
|
className: "me-1",
|
|
1844
1843
|
size: "xs",
|
|
@@ -1847,13 +1846,13 @@ function (_React$Component) {
|
|
|
1847
1846
|
onChange: this.filterChangeHandler('start'),
|
|
1848
1847
|
onMouseDown: stopEvent,
|
|
1849
1848
|
onEnter: function onEnter() {
|
|
1850
|
-
|
|
1849
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1851
1850
|
}
|
|
1852
1851
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1853
1852
|
size: "xs",
|
|
1854
1853
|
onMouseDown: stopEvent,
|
|
1855
1854
|
onClick: function onClick(e) {
|
|
1856
|
-
|
|
1855
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1857
1856
|
},
|
|
1858
1857
|
icon: "search"
|
|
1859
1858
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1863,7 +1862,7 @@ function (_React$Component) {
|
|
|
1863
1862
|
style: inputStyle
|
|
1864
1863
|
}, lang['End With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1865
1864
|
ref: function ref(c) {
|
|
1866
|
-
return
|
|
1865
|
+
return _this21.filter.end = c;
|
|
1867
1866
|
},
|
|
1868
1867
|
className: "me-1",
|
|
1869
1868
|
size: "xs",
|
|
@@ -1872,13 +1871,13 @@ function (_React$Component) {
|
|
|
1872
1871
|
onChange: this.filterChangeHandler('end'),
|
|
1873
1872
|
onMouseDown: stopEvent,
|
|
1874
1873
|
onEnter: function onEnter() {
|
|
1875
|
-
|
|
1874
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1876
1875
|
}
|
|
1877
1876
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1878
1877
|
size: "xs",
|
|
1879
1878
|
onMouseDown: stopEvent,
|
|
1880
1879
|
onClick: function onClick(e) {
|
|
1881
|
-
|
|
1880
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1882
1881
|
},
|
|
1883
1882
|
icon: "search"
|
|
1884
1883
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1888,7 +1887,7 @@ function (_React$Component) {
|
|
|
1888
1887
|
style: inputStyle
|
|
1889
1888
|
}, lang['Contain with']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1890
1889
|
ref: function ref(c) {
|
|
1891
|
-
return
|
|
1890
|
+
return _this21.filter.contain = c;
|
|
1892
1891
|
},
|
|
1893
1892
|
className: "me-1",
|
|
1894
1893
|
size: "xs",
|
|
@@ -1897,13 +1896,13 @@ function (_React$Component) {
|
|
|
1897
1896
|
onChange: this.filterChangeHandler('contain'),
|
|
1898
1897
|
onMouseDown: stopEvent,
|
|
1899
1898
|
onEnter: function onEnter() {
|
|
1900
|
-
|
|
1899
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1901
1900
|
}
|
|
1902
1901
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1903
1902
|
size: "xs",
|
|
1904
1903
|
onMouseDown: stopEvent,
|
|
1905
1904
|
onClick: function onClick(e) {
|
|
1906
|
-
|
|
1905
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1907
1906
|
},
|
|
1908
1907
|
icon: "search"
|
|
1909
1908
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1921,7 +1920,7 @@ function (_React$Component) {
|
|
|
1921
1920
|
onChange: this.filterChangeHandler('condition'),
|
|
1922
1921
|
onMouseDown: stopEvent,
|
|
1923
1922
|
onEnter: function onEnter() {
|
|
1924
|
-
|
|
1923
|
+
_this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
|
|
1925
1924
|
}
|
|
1926
1925
|
})) : null, this.props.edit && (!this.props.nodel || this.props.newBar) ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1927
1926
|
field: "",
|
|
@@ -1934,14 +1933,14 @@ function (_React$Component) {
|
|
|
1934
1933
|
field: "",
|
|
1935
1934
|
step: true
|
|
1936
1935
|
}) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
|
|
1937
|
-
return
|
|
1936
|
+
return _this21.explainCustomMenu(menu);
|
|
1938
1937
|
}) : null));
|
|
1939
1938
|
} // MARK:-生成数字菜单
|
|
1940
1939
|
|
|
1941
1940
|
}, {
|
|
1942
1941
|
key: "renderNumberMenu",
|
|
1943
1942
|
value: function renderNumberMenu() {
|
|
1944
|
-
var
|
|
1943
|
+
var _this22 = this;
|
|
1945
1944
|
|
|
1946
1945
|
var lang;
|
|
1947
1946
|
|
|
@@ -1960,7 +1959,7 @@ function (_React$Component) {
|
|
|
1960
1959
|
|
|
1961
1960
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1962
1961
|
ref: function ref(c) {
|
|
1963
|
-
return
|
|
1962
|
+
return _this22.numMenu = c;
|
|
1964
1963
|
},
|
|
1965
1964
|
onClick: this.menuClickHandler
|
|
1966
1965
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1980,7 +1979,7 @@ function (_React$Component) {
|
|
|
1980
1979
|
var select = document.getSelection();
|
|
1981
1980
|
if (!select) return;
|
|
1982
1981
|
|
|
1983
|
-
|
|
1982
|
+
_this22.filterHandler(select.toString(), data.field, 'contain');
|
|
1984
1983
|
}
|
|
1985
1984
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1986
1985
|
className: "me-1",
|
|
@@ -1991,7 +1990,7 @@ function (_React$Component) {
|
|
|
1991
1990
|
var select = document.getSelection();
|
|
1992
1991
|
if (!select) return;
|
|
1993
1992
|
|
|
1994
|
-
|
|
1993
|
+
_this22.filterHandler(select.toString(), data.field, 'exclude');
|
|
1995
1994
|
}
|
|
1996
1995
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1997
1996
|
className: "me-1",
|
|
@@ -1999,7 +1998,7 @@ function (_React$Component) {
|
|
|
1999
1998
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
2000
1999
|
field: "clear_filter",
|
|
2001
2000
|
onClick: function onClick() {
|
|
2002
|
-
|
|
2001
|
+
_this22.clearFilter();
|
|
2003
2002
|
}
|
|
2004
2003
|
}, _react["default"].createElement("span", {
|
|
2005
2004
|
className: "text-danger"
|
|
@@ -2022,12 +2021,12 @@ function (_React$Component) {
|
|
|
2022
2021
|
onMouseDown: stopEvent,
|
|
2023
2022
|
onEnter: function onEnter() {
|
|
2024
2023
|
var reg = /(>=|<=|<|>|=|!=)+\s*(\d+)/i;
|
|
2025
|
-
var m = String(
|
|
2024
|
+
var m = String(_this22.state.filter.condition).match(reg);
|
|
2026
2025
|
|
|
2027
2026
|
if (m) {
|
|
2028
|
-
|
|
2027
|
+
_this22.filterHandler(m[2], _this22.numMenu.data.field, numberCondition[m[1]]);
|
|
2029
2028
|
} else {
|
|
2030
|
-
|
|
2029
|
+
_this22.filterHandler(_this22.state.filter.condition, _this22.numMenu.data.field, 'condition');
|
|
2031
2030
|
}
|
|
2032
2031
|
}
|
|
2033
2032
|
}), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
|
|
@@ -2035,7 +2034,7 @@ function (_React$Component) {
|
|
|
2035
2034
|
}, {
|
|
2036
2035
|
key: "explainCustomMenu",
|
|
2037
2036
|
value: function explainCustomMenu(menu) {
|
|
2038
|
-
var
|
|
2037
|
+
var _this23 = this;
|
|
2039
2038
|
|
|
2040
2039
|
if (menu.children && menu.children instanceof Array) {
|
|
2041
2040
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -2043,7 +2042,7 @@ function (_React$Component) {
|
|
|
2043
2042
|
text: menu.text,
|
|
2044
2043
|
child: true
|
|
2045
2044
|
}, menu.children.map(function (item) {
|
|
2046
|
-
return
|
|
2045
|
+
return _this23.explainCustomMenu(item);
|
|
2047
2046
|
}));
|
|
2048
2047
|
} else {
|
|
2049
2048
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|