@clake/react-bootstrap4-window 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-bootstrap4-window.js +4 -23
- package/lib/CTable.js +120 -123
- package/lib/CTable.js.map +3 -3
- package/lib/CTableInput.js +2 -2
- package/lib/CTableInput.js.map +2 -2
- package/lib/Drag.js +2 -2
- package/lib/Drag.js.map +2 -2
- package/lib/IconButton.js +2 -2
- package/lib/IconButton.js.map +2 -2
- package/lib/PageBar.js +2 -2
- package/lib/PageBar.js.map +2 -2
- package/lib/TopMenu.js +2 -2
- package/lib/TopMenu.js.map +2 -2
- package/lib/WCalendar.js +2 -2
- package/lib/WCalendar.js.map +2 -2
- package/lib/WCombo.js +2 -2
- package/lib/WCombo.js.map +2 -2
- package/lib/WModal.js +2 -2
- package/lib/WModal.js.map +2 -2
- package/lib/Window.js +2 -2
- package/lib/Window.js.map +2 -2
- package/lib/WindowGroup.js +2 -2
- package/lib/WindowGroup.js.map +2 -2
- package/lib/i18n/CTable.js +2 -2
- package/lib/i18n/CTable.js.map +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/lib/CTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @clake/react-bootstrap4-window v0.7.
|
|
1
|
+
/* @clake/react-bootstrap4-window v0.7.5 | by Clake
|
|
2
2
|
* Copyright (c) 2024 Clake,
|
|
3
|
-
* 2024-03-
|
|
3
|
+
* 2024-03-15T10:28:01+0800
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
|
14
|
-
var _propTypes =
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
|
|
16
16
|
var _bind = _interopRequireDefault(require("classnames/bind"));
|
|
17
17
|
|
|
@@ -27,12 +27,6 @@ var _CTable2 = _interopRequireDefault(require("./i18n/CTable"));
|
|
|
27
27
|
|
|
28
28
|
var _PageBar = _interopRequireDefault(require("./PageBar"));
|
|
29
29
|
|
|
30
|
-
var _gulpUtil = require("gulp-util");
|
|
31
|
-
|
|
32
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
31
|
|
|
38
32
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -92,11 +86,7 @@ function (_React$Component) {
|
|
|
92
86
|
});
|
|
93
87
|
|
|
94
88
|
_defineProperty(_assertThisInitialized(_this), "selectAll", function (checked) {
|
|
95
|
-
_this.select_all = checked;
|
|
96
|
-
// item.setChecked(this.select_all);
|
|
97
|
-
// this.setRowCheck(this.select_all,idx);
|
|
98
|
-
// });
|
|
99
|
-
|
|
89
|
+
_this.select_all = checked;
|
|
100
90
|
var selectRows = [];
|
|
101
91
|
|
|
102
92
|
if (checked) {
|
|
@@ -109,6 +99,10 @@ function (_React$Component) {
|
|
|
109
99
|
selectRows: selectRows,
|
|
110
100
|
selectAll: checked,
|
|
111
101
|
selectHalf: false
|
|
102
|
+
}, function () {
|
|
103
|
+
if (typeof _this.props.onCheckAll === 'function') {
|
|
104
|
+
_this.props.onCheckAll(_this.state.selectAll, _this.state.data);
|
|
105
|
+
}
|
|
112
106
|
});
|
|
113
107
|
});
|
|
114
108
|
|
|
@@ -809,33 +803,31 @@ function (_React$Component) {
|
|
|
809
803
|
value: function getSelectRows() {
|
|
810
804
|
var _this10 = this;
|
|
811
805
|
|
|
812
|
-
return this.selectRows.map(function (item) {
|
|
806
|
+
return this.state.selectRows.map(function (item) {
|
|
813
807
|
return _this10.state.data[item];
|
|
814
808
|
});
|
|
815
809
|
}
|
|
816
810
|
/**
|
|
817
811
|
* 设置选中的行
|
|
818
|
-
* @param key 对应行数据的KEY值
|
|
819
|
-
* @param list 要选中的数据值
|
|
812
|
+
* @param {string} key 对应行数据的KEY值
|
|
813
|
+
* @param {array} list 要选中的数据值
|
|
820
814
|
*/
|
|
821
815
|
|
|
822
816
|
}, {
|
|
823
817
|
key: "setSelectRows",
|
|
824
818
|
value: function setSelectRows(key, list) {
|
|
825
|
-
var
|
|
826
|
-
|
|
819
|
+
var selectRows = [];
|
|
827
820
|
this.state.data.forEach(function (row, i) {
|
|
828
|
-
if (list.
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
_this11.setRowCheck(true, i);
|
|
832
|
-
} else {
|
|
833
|
-
_this11.refs['row_' + i].setChecked(false);
|
|
834
|
-
|
|
835
|
-
_this11.setRowCheck(false, i);
|
|
821
|
+
if (list.includes(row[key])) {
|
|
822
|
+
selectRows.push(i);
|
|
836
823
|
}
|
|
837
824
|
});
|
|
838
|
-
this.
|
|
825
|
+
var selectAll = selectRows.length > 1 && selectRows.length === this.state.data.length;
|
|
826
|
+
this.setState({
|
|
827
|
+
selectRows: selectRows,
|
|
828
|
+
selectHalf: !selectAll,
|
|
829
|
+
selectAll: selectAll
|
|
830
|
+
});
|
|
839
831
|
}
|
|
840
832
|
/**
|
|
841
833
|
* binding column split
|
|
@@ -844,50 +836,50 @@ function (_React$Component) {
|
|
|
844
836
|
}, {
|
|
845
837
|
key: "bindSplit",
|
|
846
838
|
value: function bindSplit() {
|
|
847
|
-
var
|
|
839
|
+
var _this11 = this;
|
|
848
840
|
|
|
849
841
|
if (this.props.move) {
|
|
850
842
|
this.headerSplits.forEach(function (split) {
|
|
851
|
-
if (!
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
843
|
+
if (!_this11.drag) {
|
|
844
|
+
_this11.dragColumnLeft = 0;
|
|
845
|
+
_this11.dragWidth = 0;
|
|
846
|
+
_this11.drag = new _Drag["default"](_this11.split, split, {
|
|
855
847
|
start: function start(dragDom, eventDom) {
|
|
856
|
-
var xy = _reactBootstrap.Common.GetDomXY(eventDom,
|
|
848
|
+
var xy = _reactBootstrap.Common.GetDomXY(eventDom, _this11.mainDom);
|
|
857
849
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
dragDom.style.left =
|
|
850
|
+
_this11.dragWidth = parseInt(eventDom.parentNode.style.width);
|
|
851
|
+
_this11.dragColumnLeft = xy.left - _this11.table_rows.scrollLeft;
|
|
852
|
+
dragDom.style.left = _this11.dragColumnLeft + 'px';
|
|
861
853
|
dragDom.classList.remove('d-none');
|
|
862
854
|
return true;
|
|
863
855
|
},
|
|
864
856
|
move: function move(_move, dragDom, eventDom) {
|
|
865
|
-
if (
|
|
866
|
-
_move.x =
|
|
857
|
+
if (_this11.dragWidth + (_move.x - _this11.dragColumnLeft) < 50) {
|
|
858
|
+
_move.x = _this11.dragColumnLeft - _this11.dragWidth + 50;
|
|
867
859
|
}
|
|
868
860
|
},
|
|
869
861
|
end: function end(dragDom, eventDom) {
|
|
870
862
|
dragDom.classList.add('d-none');
|
|
871
863
|
var column_key = eventDom.dataset.key;
|
|
872
864
|
|
|
873
|
-
var diff = parseInt(dragDom.style.left) -
|
|
865
|
+
var diff = parseInt(dragDom.style.left) - _this11.dragColumnLeft;
|
|
874
866
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
867
|
+
_this11.width = parseInt(_this11.width) + diff + 'px';
|
|
868
|
+
_this11.table_head.style.width = _this11.width;
|
|
869
|
+
_this11.table_body.style.width = _this11.width;
|
|
878
870
|
|
|
879
|
-
if (
|
|
880
|
-
|
|
871
|
+
if (_this11.table_total) {
|
|
872
|
+
_this11.table_total.style.width = _this11.width;
|
|
881
873
|
}
|
|
882
874
|
|
|
883
875
|
document.querySelectorAll("#".concat(column_key)).forEach(function (item) {
|
|
884
|
-
item.style.width = "".concat(
|
|
876
|
+
item.style.width = "".concat(_this11.dragWidth + diff, "px");
|
|
885
877
|
});
|
|
886
878
|
return true;
|
|
887
879
|
}
|
|
888
880
|
});
|
|
889
881
|
} else {
|
|
890
|
-
|
|
882
|
+
_this11.drag.setEventDom(split);
|
|
891
883
|
}
|
|
892
884
|
});
|
|
893
885
|
}
|
|
@@ -1026,20 +1018,20 @@ function (_React$Component) {
|
|
|
1026
1018
|
}, {
|
|
1027
1019
|
key: "calcLocalTotal",
|
|
1028
1020
|
value: function calcLocalTotal(field) {
|
|
1029
|
-
var
|
|
1021
|
+
var _this12 = this;
|
|
1030
1022
|
|
|
1031
1023
|
return function (e) {
|
|
1032
|
-
var list =
|
|
1024
|
+
var list = _this12.state.data;
|
|
1033
1025
|
var total = 0;
|
|
1034
1026
|
list.forEach(function (item) {
|
|
1035
1027
|
if (!!parseFloat(item[field])) {
|
|
1036
1028
|
total += parseFloat(item[field]);
|
|
1037
1029
|
}
|
|
1038
1030
|
});
|
|
1039
|
-
var totalData = Object.assign({},
|
|
1031
|
+
var totalData = Object.assign({}, _this12.state.total);
|
|
1040
1032
|
totalData[field] = total.toFixed(2);
|
|
1041
1033
|
|
|
1042
|
-
|
|
1034
|
+
_this12.setState({
|
|
1043
1035
|
total: totalData
|
|
1044
1036
|
});
|
|
1045
1037
|
};
|
|
@@ -1047,11 +1039,11 @@ function (_React$Component) {
|
|
|
1047
1039
|
}, {
|
|
1048
1040
|
key: "render",
|
|
1049
1041
|
value: function render() {
|
|
1050
|
-
var
|
|
1042
|
+
var _this13 = this;
|
|
1051
1043
|
|
|
1052
1044
|
return _react["default"].createElement("div", {
|
|
1053
1045
|
ref: function ref(c) {
|
|
1054
|
-
return
|
|
1046
|
+
return _this13.mainDom = c;
|
|
1055
1047
|
},
|
|
1056
1048
|
className: this.getMainClasses(),
|
|
1057
1049
|
style: this.getStyles()
|
|
@@ -1063,7 +1055,7 @@ function (_React$Component) {
|
|
|
1063
1055
|
selector: "#table-body-com-".concat(this.domId)
|
|
1064
1056
|
})), this.renderFoot(), _react["default"].createElement("div", {
|
|
1065
1057
|
ref: function ref(c) {
|
|
1066
|
-
return
|
|
1058
|
+
return _this13.split = c;
|
|
1067
1059
|
},
|
|
1068
1060
|
className: "ck-split d-none"
|
|
1069
1061
|
}));
|
|
@@ -1071,15 +1063,15 @@ function (_React$Component) {
|
|
|
1071
1063
|
}, {
|
|
1072
1064
|
key: "renderHeader",
|
|
1073
1065
|
value: function renderHeader() {
|
|
1074
|
-
var
|
|
1066
|
+
var _this14 = this;
|
|
1075
1067
|
|
|
1076
1068
|
return _react["default"].createElement("div", {
|
|
1077
1069
|
ref: function ref(c) {
|
|
1078
|
-
return
|
|
1070
|
+
return _this14.tableHeader = c;
|
|
1079
1071
|
}
|
|
1080
1072
|
}, _react["default"].createElement("table", {
|
|
1081
1073
|
ref: function ref(c) {
|
|
1082
|
-
return
|
|
1074
|
+
return _this14.table_head = c;
|
|
1083
1075
|
},
|
|
1084
1076
|
id: "table-head-".concat(this.domId),
|
|
1085
1077
|
className: this.getClasses(),
|
|
@@ -1095,13 +1087,13 @@ function (_React$Component) {
|
|
|
1095
1087
|
icon: "list"
|
|
1096
1088
|
}) : _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1097
1089
|
ref: function ref(c) {
|
|
1098
|
-
return
|
|
1090
|
+
return _this14.allchk = c;
|
|
1099
1091
|
},
|
|
1100
1092
|
onChange: this.selectAll,
|
|
1101
1093
|
checked: this.state.selectAll,
|
|
1102
1094
|
half: this.state.selectHalf
|
|
1103
1095
|
})) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1104
|
-
|
|
1096
|
+
_this14.cacheRow[item.props.field] = '';
|
|
1105
1097
|
|
|
1106
1098
|
if (!item || item.props.hide) {
|
|
1107
1099
|
return null;
|
|
@@ -1118,28 +1110,28 @@ function (_React$Component) {
|
|
|
1118
1110
|
|
|
1119
1111
|
var sort_icon = '';
|
|
1120
1112
|
|
|
1121
|
-
if (
|
|
1122
|
-
sort_icon = 'sort-alpha-' + (
|
|
1113
|
+
if (_this14.sortList[item.props.field]) {
|
|
1114
|
+
sort_icon = 'sort-alpha-' + (_this14.sortList[item.props.field] === 'asc' ? 'down' : 'up');
|
|
1123
1115
|
}
|
|
1124
1116
|
|
|
1125
1117
|
return _react["default"].createElement("th", {
|
|
1126
|
-
onContextMenu:
|
|
1127
|
-
id:
|
|
1118
|
+
onContextMenu: _this14.menuContextHandler,
|
|
1119
|
+
id: _this14.domId + '-' + key,
|
|
1128
1120
|
"data-key": 'head_' + key,
|
|
1129
1121
|
style: style
|
|
1130
|
-
},
|
|
1122
|
+
}, _this14.is_sort ? _react["default"].createElement("a", {
|
|
1131
1123
|
className: "ck-ctable-sort",
|
|
1132
1124
|
href: "javascript://",
|
|
1133
|
-
id: "".concat(
|
|
1125
|
+
id: "".concat(_this14.domId, "-sort-").concat(item.props.field),
|
|
1134
1126
|
"data-field": item.props.field,
|
|
1135
|
-
onClick:
|
|
1127
|
+
onClick: _this14.sortHandler
|
|
1136
1128
|
}, item.props.text, " ", _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1137
1129
|
icon: sort_icon
|
|
1138
|
-
})) : item.props.text,
|
|
1130
|
+
})) : item.props.text, _this14.props.move ? _react["default"].createElement("span", {
|
|
1139
1131
|
ref: function ref(c) {
|
|
1140
|
-
return
|
|
1132
|
+
return _this14.headerSplits.push(c);
|
|
1141
1133
|
},
|
|
1142
|
-
"data-key":
|
|
1134
|
+
"data-key": _this14.domId + '-' + key,
|
|
1143
1135
|
className: "ck-column-split"
|
|
1144
1136
|
}) : null);
|
|
1145
1137
|
})))));
|
|
@@ -1147,34 +1139,34 @@ function (_React$Component) {
|
|
|
1147
1139
|
}, {
|
|
1148
1140
|
key: "renderRows",
|
|
1149
1141
|
value: function renderRows() {
|
|
1150
|
-
var
|
|
1142
|
+
var _this15 = this;
|
|
1151
1143
|
|
|
1152
1144
|
return _react["default"].createElement("div", {
|
|
1153
1145
|
ref: function ref(c) {
|
|
1154
|
-
return
|
|
1146
|
+
return _this15.table_rows = c;
|
|
1155
1147
|
},
|
|
1156
1148
|
id: "table-body-com-".concat(this.domId),
|
|
1157
1149
|
className: "flex-grow-1 rows",
|
|
1158
1150
|
onScroll: this.scrollHandler
|
|
1159
1151
|
}, _react["default"].createElement("table", {
|
|
1160
1152
|
ref: function ref(c) {
|
|
1161
|
-
return
|
|
1153
|
+
return _this15.table_body = c;
|
|
1162
1154
|
},
|
|
1163
1155
|
id: "table-body-".concat(this.domId),
|
|
1164
1156
|
className: this.getClasses(),
|
|
1165
1157
|
style: this.getTableStyles()
|
|
1166
1158
|
}, _react["default"].createElement("tbody", null, this.state.data.map(function (row, i) {
|
|
1167
|
-
if (
|
|
1168
|
-
return
|
|
1159
|
+
if (_this15.props.edit) {
|
|
1160
|
+
return _this15.renderEditRow(row, i);
|
|
1169
1161
|
}
|
|
1170
1162
|
|
|
1171
|
-
return
|
|
1163
|
+
return _this15.renderRow(row, i);
|
|
1172
1164
|
}), this.props.edit ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
|
|
1173
1165
|
}
|
|
1174
1166
|
}, {
|
|
1175
1167
|
key: "renderRow",
|
|
1176
1168
|
value: function renderRow(row, i, parentRow) {
|
|
1177
|
-
var
|
|
1169
|
+
var _this16 = this;
|
|
1178
1170
|
|
|
1179
1171
|
var checked = this.state.selectRows.indexOf(i) !== -1;
|
|
1180
1172
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
@@ -1195,9 +1187,9 @@ function (_React$Component) {
|
|
|
1195
1187
|
} //set style
|
|
1196
1188
|
|
|
1197
1189
|
|
|
1198
|
-
var style = _objectSpread({},
|
|
1190
|
+
var style = _objectSpread({}, _this16.props.columnStyle);
|
|
1199
1191
|
|
|
1200
|
-
style.textAlign = item.props.align ||
|
|
1192
|
+
style.textAlign = item.props.align || _this16.props.align;
|
|
1201
1193
|
|
|
1202
1194
|
if (item.props.width) {
|
|
1203
1195
|
style.width = item.props.width;
|
|
@@ -1220,8 +1212,8 @@ function (_React$Component) {
|
|
|
1220
1212
|
|
|
1221
1213
|
if (item.props.children) {
|
|
1222
1214
|
return _react["default"].createElement("td", {
|
|
1223
|
-
onContextMenu:
|
|
1224
|
-
id:
|
|
1215
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1216
|
+
id: _this16.domId + '-' + key,
|
|
1225
1217
|
"data-row": "".concat(i),
|
|
1226
1218
|
"data-field": item.props.field,
|
|
1227
1219
|
className: item.props.className,
|
|
@@ -1240,8 +1232,8 @@ function (_React$Component) {
|
|
|
1240
1232
|
}
|
|
1241
1233
|
|
|
1242
1234
|
return _react["default"].createElement("td", {
|
|
1243
|
-
onContextMenu:
|
|
1244
|
-
id:
|
|
1235
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1236
|
+
id: _this16.domId + '-' + key,
|
|
1245
1237
|
"data-field": item.props.field,
|
|
1246
1238
|
style: style,
|
|
1247
1239
|
onClick: function onClick(e) {
|
|
@@ -1255,14 +1247,14 @@ function (_React$Component) {
|
|
|
1255
1247
|
}
|
|
1256
1248
|
},
|
|
1257
1249
|
"data-row": "".concat(i)
|
|
1258
|
-
}, item.props.type ?
|
|
1250
|
+
}, item.props.type ? _this16.renderEditComponent(item.props, row, i) : item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field]);
|
|
1259
1251
|
}
|
|
1260
1252
|
})));
|
|
1261
1253
|
}
|
|
1262
1254
|
}, {
|
|
1263
1255
|
key: "renderEditRow",
|
|
1264
1256
|
value: function renderEditRow(row, i) {
|
|
1265
|
-
var
|
|
1257
|
+
var _this17 = this;
|
|
1266
1258
|
|
|
1267
1259
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1268
1260
|
className: this.props.onClick ? 'click-row' : null,
|
|
@@ -1282,9 +1274,9 @@ function (_React$Component) {
|
|
|
1282
1274
|
} //set style
|
|
1283
1275
|
|
|
1284
1276
|
|
|
1285
|
-
var style = _objectSpread({},
|
|
1277
|
+
var style = _objectSpread({}, _this17.props.columnStyle);
|
|
1286
1278
|
|
|
1287
|
-
style.textAlign = item.props.align ||
|
|
1279
|
+
style.textAlign = item.props.align || _this17.props.align;
|
|
1288
1280
|
|
|
1289
1281
|
if (item.props.width) {
|
|
1290
1282
|
style.width = item.props.width;
|
|
@@ -1292,9 +1284,9 @@ function (_React$Component) {
|
|
|
1292
1284
|
|
|
1293
1285
|
var dataType = 'text';
|
|
1294
1286
|
return _react["default"].createElement("td", {
|
|
1295
|
-
onContextMenu:
|
|
1287
|
+
onContextMenu: _this17.menuContextHandler(dataType),
|
|
1296
1288
|
className: item.props.disabled ? 'disabled' : '',
|
|
1297
|
-
id:
|
|
1289
|
+
id: _this17.domId + '-' + key,
|
|
1298
1290
|
"data-field": item.props.field,
|
|
1299
1291
|
style: style,
|
|
1300
1292
|
onClick: function onClick(e) {
|
|
@@ -1308,13 +1300,13 @@ function (_React$Component) {
|
|
|
1308
1300
|
}
|
|
1309
1301
|
},
|
|
1310
1302
|
"data-row": "".concat(i)
|
|
1311
|
-
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] :
|
|
1303
|
+
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] : _this17.renderEditComponent(item.props, row, i));
|
|
1312
1304
|
})));
|
|
1313
1305
|
}
|
|
1314
1306
|
}, {
|
|
1315
1307
|
key: "renderEditAddRow",
|
|
1316
1308
|
value: function renderEditAddRow() {
|
|
1317
|
-
var
|
|
1309
|
+
var _this18 = this;
|
|
1318
1310
|
|
|
1319
1311
|
return _react["default"].createElement("tr", {
|
|
1320
1312
|
id: this.domId + '-edit'
|
|
@@ -1336,14 +1328,14 @@ function (_React$Component) {
|
|
|
1336
1328
|
return _react["default"].createElement("td", {
|
|
1337
1329
|
style: style
|
|
1338
1330
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1339
|
-
onFocus:
|
|
1331
|
+
onFocus: _this18.addNewHandler
|
|
1340
1332
|
}));
|
|
1341
1333
|
}));
|
|
1342
1334
|
}
|
|
1343
1335
|
}, {
|
|
1344
1336
|
key: "renderEditComponent",
|
|
1345
1337
|
value: function renderEditComponent(item, row, i) {
|
|
1346
|
-
var
|
|
1338
|
+
var _this19 = this;
|
|
1347
1339
|
|
|
1348
1340
|
switch (item.type) {
|
|
1349
1341
|
case "combo":
|
|
@@ -1375,7 +1367,7 @@ function (_React$Component) {
|
|
|
1375
1367
|
className: "d-inline",
|
|
1376
1368
|
width: "20px",
|
|
1377
1369
|
onChange: function onChange(chk, e) {
|
|
1378
|
-
|
|
1370
|
+
_this19.editHandler(e, chk, 'chk');
|
|
1379
1371
|
},
|
|
1380
1372
|
"data-row": i,
|
|
1381
1373
|
"data-field": item.field,
|
|
@@ -1415,7 +1407,7 @@ function (_React$Component) {
|
|
|
1415
1407
|
}, {
|
|
1416
1408
|
key: "renderTotal",
|
|
1417
1409
|
value: function renderTotal() {
|
|
1418
|
-
var
|
|
1410
|
+
var _this20 = this;
|
|
1419
1411
|
|
|
1420
1412
|
if (!this.state.total) {
|
|
1421
1413
|
return null;
|
|
@@ -1424,12 +1416,12 @@ function (_React$Component) {
|
|
|
1424
1416
|
var total = this.state.total;
|
|
1425
1417
|
return _react["default"].createElement("div", {
|
|
1426
1418
|
ref: function ref(c) {
|
|
1427
|
-
return
|
|
1419
|
+
return _this20.tableTotal = c;
|
|
1428
1420
|
},
|
|
1429
1421
|
className: "ck-ctable-total"
|
|
1430
1422
|
}, _react["default"].createElement("table", {
|
|
1431
1423
|
ref: function ref(c) {
|
|
1432
|
-
return
|
|
1424
|
+
return _this20.table_total = c;
|
|
1433
1425
|
},
|
|
1434
1426
|
id: "table-total-".concat(this.domId),
|
|
1435
1427
|
className: this.getClasses(),
|
|
@@ -1443,7 +1435,7 @@ function (_React$Component) {
|
|
|
1443
1435
|
return null;
|
|
1444
1436
|
}
|
|
1445
1437
|
|
|
1446
|
-
var align = item.props.align ||
|
|
1438
|
+
var align = item.props.align || _this20.props.align;
|
|
1447
1439
|
var style = {
|
|
1448
1440
|
'textAlign': align
|
|
1449
1441
|
};
|
|
@@ -1453,7 +1445,7 @@ function (_React$Component) {
|
|
|
1453
1445
|
}
|
|
1454
1446
|
|
|
1455
1447
|
return _react["default"].createElement("td", {
|
|
1456
|
-
id:
|
|
1448
|
+
id: _this20.domId + '-' + key,
|
|
1457
1449
|
"data-field": item.props.field,
|
|
1458
1450
|
style: style
|
|
1459
1451
|
}, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
|
|
@@ -1462,7 +1454,7 @@ function (_React$Component) {
|
|
|
1462
1454
|
}, {
|
|
1463
1455
|
key: "renderMenu",
|
|
1464
1456
|
value: function renderMenu() {
|
|
1465
|
-
var
|
|
1457
|
+
var _this21 = this;
|
|
1466
1458
|
|
|
1467
1459
|
var lang;
|
|
1468
1460
|
|
|
@@ -1481,7 +1473,7 @@ function (_React$Component) {
|
|
|
1481
1473
|
|
|
1482
1474
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1483
1475
|
ref: function ref(c) {
|
|
1484
|
-
return
|
|
1476
|
+
return _this21.mainMenu = c;
|
|
1485
1477
|
},
|
|
1486
1478
|
onClick: this.menuClickHandler
|
|
1487
1479
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1499,7 +1491,7 @@ function (_React$Component) {
|
|
|
1499
1491
|
onClick: function onClick(e, field, data) {
|
|
1500
1492
|
var select = document.getSelection();
|
|
1501
1493
|
|
|
1502
|
-
|
|
1494
|
+
_this21.filterHandler(select.toString(), data.field, 'contain');
|
|
1503
1495
|
}
|
|
1504
1496
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1505
1497
|
className: "me-1",
|
|
@@ -1509,7 +1501,7 @@ function (_React$Component) {
|
|
|
1509
1501
|
onClick: function onClick(e, field, data) {
|
|
1510
1502
|
var select = document.getSelection();
|
|
1511
1503
|
|
|
1512
|
-
|
|
1504
|
+
_this21.filterHandler(select.toString(), data.field, 'exclude');
|
|
1513
1505
|
}
|
|
1514
1506
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1515
1507
|
className: "me-1",
|
|
@@ -1517,7 +1509,7 @@ function (_React$Component) {
|
|
|
1517
1509
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1518
1510
|
field: "clear_filter",
|
|
1519
1511
|
onClick: function onClick() {
|
|
1520
|
-
|
|
1512
|
+
_this21.clearFilter();
|
|
1521
1513
|
}
|
|
1522
1514
|
}, _react["default"].createElement("span", {
|
|
1523
1515
|
className: "text-danger"
|
|
@@ -1539,13 +1531,13 @@ function (_React$Component) {
|
|
|
1539
1531
|
onChange: this.filterChangeHandler('equal'),
|
|
1540
1532
|
onMouseDown: stopEvent,
|
|
1541
1533
|
onEnter: function onEnter() {
|
|
1542
|
-
|
|
1534
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1543
1535
|
}
|
|
1544
1536
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1545
1537
|
size: "xs",
|
|
1546
1538
|
onMouseDown: stopEvent,
|
|
1547
1539
|
onClick: function onClick(e) {
|
|
1548
|
-
|
|
1540
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1549
1541
|
},
|
|
1550
1542
|
icon: "search"
|
|
1551
1543
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1561,13 +1553,13 @@ function (_React$Component) {
|
|
|
1561
1553
|
onChange: this.filterChangeHandler('start'),
|
|
1562
1554
|
onMouseDown: stopEvent,
|
|
1563
1555
|
onEnter: function onEnter() {
|
|
1564
|
-
|
|
1556
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1565
1557
|
}
|
|
1566
1558
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1567
1559
|
size: "xs",
|
|
1568
1560
|
onMouseDown: stopEvent,
|
|
1569
1561
|
onClick: function onClick(e) {
|
|
1570
|
-
|
|
1562
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1571
1563
|
},
|
|
1572
1564
|
icon: "search"
|
|
1573
1565
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1583,13 +1575,13 @@ function (_React$Component) {
|
|
|
1583
1575
|
onChange: this.filterChangeHandler('end'),
|
|
1584
1576
|
onMouseDown: stopEvent,
|
|
1585
1577
|
onEnter: function onEnter() {
|
|
1586
|
-
|
|
1578
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1587
1579
|
}
|
|
1588
1580
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1589
1581
|
size: "xs",
|
|
1590
1582
|
onMouseDown: stopEvent,
|
|
1591
1583
|
onClick: function onClick(e) {
|
|
1592
|
-
|
|
1584
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1593
1585
|
},
|
|
1594
1586
|
icon: "search"
|
|
1595
1587
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1605,13 +1597,13 @@ function (_React$Component) {
|
|
|
1605
1597
|
onChange: this.filterChangeHandler('contain'),
|
|
1606
1598
|
onMouseDown: stopEvent,
|
|
1607
1599
|
onEnter: function onEnter() {
|
|
1608
|
-
|
|
1600
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1609
1601
|
}
|
|
1610
1602
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1611
1603
|
size: "xs",
|
|
1612
1604
|
onMouseDown: stopEvent,
|
|
1613
1605
|
onClick: function onClick(e) {
|
|
1614
|
-
|
|
1606
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1615
1607
|
},
|
|
1616
1608
|
icon: "search"
|
|
1617
1609
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1628,7 +1620,7 @@ function (_React$Component) {
|
|
|
1628
1620
|
onChange: this.filterChangeHandler('condition'),
|
|
1629
1621
|
onMouseDown: stopEvent,
|
|
1630
1622
|
onEnter: function onEnter() {
|
|
1631
|
-
|
|
1623
|
+
_this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
|
|
1632
1624
|
}
|
|
1633
1625
|
})) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1634
1626
|
step: true
|
|
@@ -1639,13 +1631,13 @@ function (_React$Component) {
|
|
|
1639
1631
|
}, lang['Clone Row']) : null, this.props.customMenu ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1640
1632
|
step: true
|
|
1641
1633
|
}) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
|
|
1642
|
-
return
|
|
1634
|
+
return _this21.explainCustomMenu(menu);
|
|
1643
1635
|
}) : null));
|
|
1644
1636
|
}
|
|
1645
1637
|
}, {
|
|
1646
1638
|
key: "renderNumberMenu",
|
|
1647
1639
|
value: function renderNumberMenu() {
|
|
1648
|
-
var
|
|
1640
|
+
var _this22 = this;
|
|
1649
1641
|
|
|
1650
1642
|
var lang;
|
|
1651
1643
|
|
|
@@ -1664,7 +1656,7 @@ function (_React$Component) {
|
|
|
1664
1656
|
|
|
1665
1657
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1666
1658
|
ref: function ref(c) {
|
|
1667
|
-
return
|
|
1659
|
+
return _this22.numMenu = c;
|
|
1668
1660
|
},
|
|
1669
1661
|
onClick: this.menuClickHandler
|
|
1670
1662
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1682,7 +1674,7 @@ function (_React$Component) {
|
|
|
1682
1674
|
onClick: function onClick(e, field, data) {
|
|
1683
1675
|
var select = document.getSelection();
|
|
1684
1676
|
|
|
1685
|
-
|
|
1677
|
+
_this22.filterHandler(select.toString(), data.field, 'contain');
|
|
1686
1678
|
}
|
|
1687
1679
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1688
1680
|
className: "me-1",
|
|
@@ -1692,7 +1684,7 @@ function (_React$Component) {
|
|
|
1692
1684
|
onClick: function onClick(e, field, data) {
|
|
1693
1685
|
var select = document.getSelection();
|
|
1694
1686
|
|
|
1695
|
-
|
|
1687
|
+
_this22.filterHandler(select.toString(), data.field, 'exclude');
|
|
1696
1688
|
}
|
|
1697
1689
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1698
1690
|
className: "me-1",
|
|
@@ -1700,7 +1692,7 @@ function (_React$Component) {
|
|
|
1700
1692
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1701
1693
|
field: "clear_filter",
|
|
1702
1694
|
onClick: function onClick() {
|
|
1703
|
-
|
|
1695
|
+
_this22.clearFilter();
|
|
1704
1696
|
}
|
|
1705
1697
|
}, _react["default"].createElement("span", {
|
|
1706
1698
|
className: "text-danger"
|
|
@@ -1721,14 +1713,14 @@ function (_React$Component) {
|
|
|
1721
1713
|
onChange: this.filterChangeHandler('condition'),
|
|
1722
1714
|
onMouseDown: stopEvent,
|
|
1723
1715
|
onEnter: function onEnter() {
|
|
1724
|
-
|
|
1716
|
+
_this22.filterHandler(_this22.state.filter.condition, _this22.numMenu.data.field, 'condition');
|
|
1725
1717
|
}
|
|
1726
1718
|
}), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
|
|
1727
1719
|
}
|
|
1728
1720
|
}, {
|
|
1729
1721
|
key: "explainCustomMenu",
|
|
1730
1722
|
value: function explainCustomMenu(menu) {
|
|
1731
|
-
var
|
|
1723
|
+
var _this23 = this;
|
|
1732
1724
|
|
|
1733
1725
|
if (menu.children && menu.children instanceof Array) {
|
|
1734
1726
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1736,7 +1728,7 @@ function (_React$Component) {
|
|
|
1736
1728
|
text: menu.text,
|
|
1737
1729
|
child: true
|
|
1738
1730
|
}, menu.children.map(function (item) {
|
|
1739
|
-
return
|
|
1731
|
+
return _this23.explainCustomMenu(item);
|
|
1740
1732
|
}));
|
|
1741
1733
|
} else {
|
|
1742
1734
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1802,6 +1794,8 @@ CTable.propTypes = {
|
|
|
1802
1794
|
onClick: _propTypes["default"].func,
|
|
1803
1795
|
//选择事件
|
|
1804
1796
|
onCheck: _propTypes["default"].func,
|
|
1797
|
+
//选择所有
|
|
1798
|
+
onCheckAll: _propTypes["default"].func,
|
|
1805
1799
|
//过滤事件
|
|
1806
1800
|
onFilter: _propTypes["default"].func,
|
|
1807
1801
|
//排序事件
|
|
@@ -1852,7 +1846,9 @@ CTable.propTypes = {
|
|
|
1852
1846
|
//自定义显示语言
|
|
1853
1847
|
lang: _propTypes["default"].object,
|
|
1854
1848
|
source: _propTypes["default"].string,
|
|
1855
|
-
sourceFunc: _propTypes["default"].func
|
|
1849
|
+
sourceFunc: _propTypes["default"].func,
|
|
1850
|
+
//是否显示全部选取
|
|
1851
|
+
allSelect: _propTypes["default"].bool
|
|
1856
1852
|
};
|
|
1857
1853
|
CTable.defaultProps = {
|
|
1858
1854
|
data: [],
|
|
@@ -1875,7 +1871,8 @@ CTable.defaultProps = {
|
|
|
1875
1871
|
showPages: 10,
|
|
1876
1872
|
source: null,
|
|
1877
1873
|
total: null,
|
|
1878
|
-
lang: 'en'
|
|
1874
|
+
lang: 'en',
|
|
1875
|
+
allSelect: true
|
|
1879
1876
|
};
|
|
1880
1877
|
var _default = CTable;
|
|
1881
1878
|
exports["default"] = _default;
|