@clake/react-bootstrap4-window 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-bootstrap4-window.js +3 -3
- package/lib/CTable.js +149 -134
- package/lib/CTable.js.map +3 -3
- package/lib/CTableInput.js +2 -2
- package/lib/CTableInput.js.map +2 -2
- package/lib/Drag.js +2 -2
- package/lib/Drag.js.map +2 -2
- package/lib/IconButton.js +2 -2
- package/lib/IconButton.js.map +2 -2
- package/lib/PageBar.js +2 -2
- package/lib/PageBar.js.map +2 -2
- package/lib/TopMenu.js +2 -2
- package/lib/TopMenu.js.map +2 -2
- package/lib/WCalendar.js +2 -2
- package/lib/WCalendar.js.map +2 -2
- package/lib/WCombo.js +2 -2
- package/lib/WCombo.js.map +2 -2
- package/lib/WModal.js +2 -2
- package/lib/WModal.js.map +2 -2
- package/lib/Window.js +2 -2
- package/lib/Window.js.map +2 -2
- package/lib/WindowGroup.js +2 -2
- package/lib/WindowGroup.js.map +2 -2
- package/lib/css/Window.less +5 -0
- 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/src/CTable.d.ts +1 -4
- package/lib/types/src/CTable.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/CTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @clake/react-bootstrap4-window v1.0.
|
|
1
|
+
/* @clake/react-bootstrap4-window v1.0.5 | by Clake
|
|
2
2
|
* Copyright (c) 2024 Clake,
|
|
3
|
-
* 2024-
|
|
3
|
+
* 2024-06-06T17:05:39+0800
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
@@ -315,6 +315,7 @@ function (_React$Component) {
|
|
|
315
315
|
_this.is_filter = typeof _this.props.onFilter === 'function' || !!_this.props.filter;
|
|
316
316
|
_this.current_sort = null;
|
|
317
317
|
_this.filter_list = [];
|
|
318
|
+
_this.filter = {};
|
|
318
319
|
_this.editRows = [];
|
|
319
320
|
_this.cacheRow = {}; //列头数据
|
|
320
321
|
|
|
@@ -347,15 +348,15 @@ function (_React$Component) {
|
|
|
347
348
|
}
|
|
348
349
|
|
|
349
350
|
this.editRows = [];
|
|
350
|
-
|
|
351
|
-
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
this.originalData = _reactBootstrap.Common.Clone(nextProps.data); // if (this.allchk) {
|
|
352
354
|
// this.allchk.setHalf(false);
|
|
353
355
|
// this.selectRows = [];
|
|
354
356
|
// }
|
|
355
357
|
// this.select_all = false;
|
|
356
358
|
// this.selectRows = [];
|
|
357
359
|
|
|
358
|
-
|
|
359
360
|
var selectRows = [];
|
|
360
361
|
var isHalf = false;
|
|
361
362
|
var allchk = false;
|
|
@@ -462,8 +463,6 @@ function (_React$Component) {
|
|
|
462
463
|
}, {
|
|
463
464
|
key: "sourceFilter",
|
|
464
465
|
value: function sourceFilter() {
|
|
465
|
-
var _this4 = this;
|
|
466
|
-
|
|
467
466
|
return this.filter_list.map(function (item) {
|
|
468
467
|
switch (item.type) {
|
|
469
468
|
case "start":
|
|
@@ -481,7 +480,7 @@ function (_React$Component) {
|
|
|
481
480
|
};
|
|
482
481
|
|
|
483
482
|
case "clear":
|
|
484
|
-
|
|
483
|
+
// this.filter = {};
|
|
485
484
|
break;
|
|
486
485
|
|
|
487
486
|
case "":
|
|
@@ -508,24 +507,24 @@ function (_React$Component) {
|
|
|
508
507
|
}, {
|
|
509
508
|
key: "changeHandler",
|
|
510
509
|
value: function changeHandler(row, i) {
|
|
511
|
-
var
|
|
510
|
+
var _this4 = this;
|
|
512
511
|
|
|
513
512
|
return function (checked, e) {
|
|
514
|
-
var selectRows =
|
|
513
|
+
var selectRows = _this4.setRowCheck(checked, i);
|
|
515
514
|
|
|
516
|
-
var
|
|
517
|
-
|
|
518
|
-
allChecked =
|
|
519
|
-
half =
|
|
515
|
+
var _this4$checkAllCheckH = _this4.checkAllCheckHalf(selectRows),
|
|
516
|
+
_this4$checkAllCheckH2 = _slicedToArray(_this4$checkAllCheckH, 2),
|
|
517
|
+
allChecked = _this4$checkAllCheckH2[0],
|
|
518
|
+
half = _this4$checkAllCheckH2[1];
|
|
520
519
|
|
|
521
|
-
|
|
520
|
+
_this4.setState({
|
|
522
521
|
selectRows: selectRows,
|
|
523
522
|
selectAll: allChecked,
|
|
524
523
|
selectHalf: half
|
|
525
524
|
});
|
|
526
525
|
|
|
527
|
-
if (typeof
|
|
528
|
-
|
|
526
|
+
if (typeof _this4.props.onCheck === "function") {
|
|
527
|
+
_this4.props.onCheck(checked, row, _this4.props.jsxId);
|
|
529
528
|
}
|
|
530
529
|
};
|
|
531
530
|
}
|
|
@@ -568,24 +567,24 @@ function (_React$Component) {
|
|
|
568
567
|
}, {
|
|
569
568
|
key: "clickHandler",
|
|
570
569
|
value: function clickHandler(row, i) {
|
|
571
|
-
var
|
|
570
|
+
var _this5 = this;
|
|
572
571
|
|
|
573
572
|
return function () {
|
|
574
|
-
if (typeof
|
|
575
|
-
|
|
573
|
+
if (typeof _this5.props.onClick === 'function') {
|
|
574
|
+
_this5.props.onClick(row, i, _this5.props.jsxId);
|
|
576
575
|
}
|
|
577
576
|
|
|
578
|
-
if (
|
|
579
|
-
var _row =
|
|
577
|
+
if (_this5.props.select && _this5.props.rowCheck) {
|
|
578
|
+
var _row = _this5.refs['row_' + i];
|
|
580
579
|
|
|
581
580
|
_row.changeHandler(null); // this.setRowCheck(!row.getChecked(),i);
|
|
582
581
|
// this.checkAllCheckHalf();
|
|
583
582
|
|
|
584
583
|
}
|
|
585
584
|
|
|
586
|
-
if (
|
|
587
|
-
|
|
588
|
-
focus: i ===
|
|
585
|
+
if (_this5.props.focus) {
|
|
586
|
+
_this5.setState({
|
|
587
|
+
focus: i === _this5.state.focus ? -1 : i
|
|
589
588
|
});
|
|
590
589
|
}
|
|
591
590
|
};
|
|
@@ -673,25 +672,25 @@ function (_React$Component) {
|
|
|
673
672
|
* @param dataType
|
|
674
673
|
*/
|
|
675
674
|
value: function menuContextHandler(dataType) {
|
|
676
|
-
var
|
|
675
|
+
var _this6 = this;
|
|
677
676
|
|
|
678
677
|
return function (e) {
|
|
679
678
|
e.preventDefault();
|
|
680
679
|
e.stopPropagation();
|
|
681
680
|
var data = {
|
|
682
681
|
field: e.currentTarget.dataset.field || '',
|
|
683
|
-
data:
|
|
682
|
+
data: _this6.state.data[e.currentTarget.dataset.row],
|
|
684
683
|
index: e.currentTarget.dataset.row
|
|
685
684
|
};
|
|
686
685
|
|
|
687
686
|
if (dataType === "text") {
|
|
688
|
-
|
|
687
|
+
_this6.mainMenu.show({
|
|
689
688
|
evt: e,
|
|
690
689
|
type: 'mouse',
|
|
691
690
|
data: data
|
|
692
691
|
});
|
|
693
692
|
} else {
|
|
694
|
-
|
|
693
|
+
_this6.numMenu.show({
|
|
695
694
|
evt: e,
|
|
696
695
|
type: 'mouse',
|
|
697
696
|
data: data
|
|
@@ -767,11 +766,17 @@ function (_React$Component) {
|
|
|
767
766
|
value: function clearFilter() {
|
|
768
767
|
this.filter_list = [];
|
|
769
768
|
var is_clean = this.clearSort(true);
|
|
769
|
+
|
|
770
|
+
_reactBootstrap.Common.map(this.filter, function (item) {
|
|
771
|
+
item.setValue('');
|
|
772
|
+
});
|
|
773
|
+
|
|
770
774
|
this.setState({
|
|
771
775
|
filter: {
|
|
772
776
|
start: '',
|
|
773
777
|
end: '',
|
|
774
|
-
contain: ''
|
|
778
|
+
contain: '',
|
|
779
|
+
equal: ''
|
|
775
780
|
}
|
|
776
781
|
});
|
|
777
782
|
|
|
@@ -788,13 +793,14 @@ function (_React$Component) {
|
|
|
788
793
|
}, {
|
|
789
794
|
key: "filterChangeHandler",
|
|
790
795
|
value: function filterChangeHandler(field) {
|
|
791
|
-
var
|
|
796
|
+
var _this7 = this;
|
|
792
797
|
|
|
793
798
|
return function (val) {
|
|
794
|
-
var filter =
|
|
799
|
+
var filter = _objectSpread({}, _this7.state.filter);
|
|
800
|
+
|
|
795
801
|
filter[field] = val;
|
|
796
802
|
|
|
797
|
-
|
|
803
|
+
_this7.setState({
|
|
798
804
|
filter: filter
|
|
799
805
|
});
|
|
800
806
|
};
|
|
@@ -850,7 +856,7 @@ function (_React$Component) {
|
|
|
850
856
|
}, {
|
|
851
857
|
key: "deleteRow",
|
|
852
858
|
value: function deleteRow(row_index) {
|
|
853
|
-
var
|
|
859
|
+
var _this8 = this;
|
|
854
860
|
|
|
855
861
|
if (row_index < 0 || row_index >= this.state.data.length) {
|
|
856
862
|
return;
|
|
@@ -865,7 +871,7 @@ function (_React$Component) {
|
|
|
865
871
|
|
|
866
872
|
this.editRows.forEach(function (item, index) {
|
|
867
873
|
if (item > row_index) {
|
|
868
|
-
|
|
874
|
+
_this8.editRows[index] = item - 1;
|
|
869
875
|
}
|
|
870
876
|
});
|
|
871
877
|
this.setState({
|
|
@@ -891,22 +897,19 @@ function (_React$Component) {
|
|
|
891
897
|
|
|
892
898
|
/**
|
|
893
899
|
* 得到所有选中的行
|
|
894
|
-
* @returns {*}
|
|
895
900
|
*/
|
|
896
901
|
|
|
897
902
|
}, {
|
|
898
903
|
key: "getSelectRows",
|
|
899
904
|
value: function getSelectRows() {
|
|
900
|
-
var
|
|
905
|
+
var _this9 = this;
|
|
901
906
|
|
|
902
907
|
return this.state.selectRows.map(function (item) {
|
|
903
|
-
return
|
|
908
|
+
return _this9.state.data[item];
|
|
904
909
|
});
|
|
905
910
|
}
|
|
906
911
|
/**
|
|
907
912
|
* 设置选中的行
|
|
908
|
-
* @param {string} key 对应行数据的KEY值
|
|
909
|
-
* @param {array} list 要选中的数据值
|
|
910
913
|
*/
|
|
911
914
|
|
|
912
915
|
}, {
|
|
@@ -932,50 +935,50 @@ function (_React$Component) {
|
|
|
932
935
|
}, {
|
|
933
936
|
key: "bindSplit",
|
|
934
937
|
value: function bindSplit() {
|
|
935
|
-
var
|
|
938
|
+
var _this10 = this;
|
|
936
939
|
|
|
937
940
|
if (this.props.move) {
|
|
938
941
|
this.headerSplits.forEach(function (split) {
|
|
939
|
-
if (!
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
942
|
+
if (!_this10.drag) {
|
|
943
|
+
_this10.dragColumnLeft = 0;
|
|
944
|
+
_this10.dragWidth = 0;
|
|
945
|
+
_this10.drag = new _Drag["default"](_this10.split, split, {
|
|
943
946
|
start: function start(dragDom, eventDom) {
|
|
944
|
-
var xy = _reactBootstrap.Common.GetDomXY(eventDom,
|
|
947
|
+
var xy = _reactBootstrap.Common.GetDomXY(eventDom, _this10.mainDom);
|
|
945
948
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
dragDom.style.left =
|
|
949
|
+
_this10.dragWidth = parseInt((eventDom === null || eventDom === void 0 ? void 0 : eventDom.parentNode).style.width);
|
|
950
|
+
_this10.dragColumnLeft = xy.left - _this10.table_rows.scrollLeft;
|
|
951
|
+
dragDom.style.left = _this10.dragColumnLeft + 'px';
|
|
949
952
|
dragDom.classList.remove('d-none');
|
|
950
953
|
return true;
|
|
951
954
|
},
|
|
952
955
|
move: function move(_move, dragDom, eventDom) {
|
|
953
|
-
if (
|
|
954
|
-
_move.x =
|
|
956
|
+
if (_this10.dragWidth + (_move.x - _this10.dragColumnLeft) < 50) {
|
|
957
|
+
_move.x = _this10.dragColumnLeft - _this10.dragWidth + 50;
|
|
955
958
|
}
|
|
956
959
|
},
|
|
957
960
|
end: function end(dragDom, eventDom) {
|
|
958
961
|
dragDom.classList.add('d-none');
|
|
959
962
|
var column_key = eventDom.dataset.key;
|
|
960
963
|
|
|
961
|
-
var diff = parseInt(dragDom.style.left) -
|
|
964
|
+
var diff = parseInt(dragDom.style.left) - _this10.dragColumnLeft;
|
|
962
965
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
+
_this10.width = parseInt(_this10.width) + diff + 'px';
|
|
967
|
+
_this10.table_head.style.width = _this10.width;
|
|
968
|
+
_this10.table_body.style.width = _this10.width;
|
|
966
969
|
|
|
967
|
-
if (
|
|
968
|
-
|
|
970
|
+
if (_this10.table_total) {
|
|
971
|
+
_this10.table_total.style.width = _this10.width;
|
|
969
972
|
}
|
|
970
973
|
|
|
971
974
|
document.querySelectorAll("#".concat(column_key)).forEach(function (item) {
|
|
972
|
-
item.style.width = "".concat(
|
|
975
|
+
item.style.width = "".concat(_this10.dragWidth + diff, "px");
|
|
973
976
|
});
|
|
974
977
|
return true;
|
|
975
978
|
}
|
|
976
979
|
});
|
|
977
980
|
} else {
|
|
978
|
-
|
|
981
|
+
_this10.drag.setEventDom(split);
|
|
979
982
|
}
|
|
980
983
|
});
|
|
981
984
|
}
|
|
@@ -1114,20 +1117,20 @@ function (_React$Component) {
|
|
|
1114
1117
|
}, {
|
|
1115
1118
|
key: "calcLocalTotal",
|
|
1116
1119
|
value: function calcLocalTotal(field) {
|
|
1117
|
-
var
|
|
1120
|
+
var _this11 = this;
|
|
1118
1121
|
|
|
1119
1122
|
return function (e) {
|
|
1120
|
-
var list =
|
|
1123
|
+
var list = _this11.state.data;
|
|
1121
1124
|
var total = 0;
|
|
1122
1125
|
list.forEach(function (item) {
|
|
1123
1126
|
if (!!parseFloat(item[field])) {
|
|
1124
1127
|
total += parseFloat(item[field]);
|
|
1125
1128
|
}
|
|
1126
1129
|
});
|
|
1127
|
-
var totalData = Object.assign({},
|
|
1130
|
+
var totalData = Object.assign({}, _this11.state.total);
|
|
1128
1131
|
totalData[field] = total.toFixed(2);
|
|
1129
1132
|
|
|
1130
|
-
|
|
1133
|
+
_this11.setState({
|
|
1131
1134
|
total: totalData
|
|
1132
1135
|
});
|
|
1133
1136
|
};
|
|
@@ -1135,11 +1138,11 @@ function (_React$Component) {
|
|
|
1135
1138
|
}, {
|
|
1136
1139
|
key: "render",
|
|
1137
1140
|
value: function render() {
|
|
1138
|
-
var
|
|
1141
|
+
var _this12 = this;
|
|
1139
1142
|
|
|
1140
1143
|
return _react["default"].createElement("div", {
|
|
1141
1144
|
ref: function ref(c) {
|
|
1142
|
-
return
|
|
1145
|
+
return _this12.mainDom = c;
|
|
1143
1146
|
},
|
|
1144
1147
|
className: this.getMainClasses(),
|
|
1145
1148
|
style: this.getStyles()
|
|
@@ -1151,7 +1154,7 @@ function (_React$Component) {
|
|
|
1151
1154
|
selector: "#table-body-com-".concat(this.domId)
|
|
1152
1155
|
})), this.renderFoot(), _react["default"].createElement("div", {
|
|
1153
1156
|
ref: function ref(c) {
|
|
1154
|
-
return
|
|
1157
|
+
return _this12.split = c;
|
|
1155
1158
|
},
|
|
1156
1159
|
className: "ck-split d-none"
|
|
1157
1160
|
}));
|
|
@@ -1159,15 +1162,15 @@ function (_React$Component) {
|
|
|
1159
1162
|
}, {
|
|
1160
1163
|
key: "renderHeader",
|
|
1161
1164
|
value: function renderHeader() {
|
|
1162
|
-
var
|
|
1165
|
+
var _this13 = this;
|
|
1163
1166
|
|
|
1164
1167
|
return _react["default"].createElement("div", {
|
|
1165
1168
|
ref: function ref(c) {
|
|
1166
|
-
return
|
|
1169
|
+
return _this13.tableHeader = c;
|
|
1167
1170
|
}
|
|
1168
1171
|
}, _react["default"].createElement("table", {
|
|
1169
1172
|
ref: function ref(c) {
|
|
1170
|
-
return
|
|
1173
|
+
return _this13.table_head = c;
|
|
1171
1174
|
},
|
|
1172
1175
|
id: "table-head-".concat(this.domId),
|
|
1173
1176
|
className: this.getClasses(''),
|
|
@@ -1183,13 +1186,13 @@ function (_React$Component) {
|
|
|
1183
1186
|
icon: "list"
|
|
1184
1187
|
}) : _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1185
1188
|
ref: function ref(c) {
|
|
1186
|
-
return
|
|
1189
|
+
return _this13.allchk = c;
|
|
1187
1190
|
},
|
|
1188
1191
|
onChange: this.selectAll,
|
|
1189
1192
|
checked: this.state.selectAll,
|
|
1190
1193
|
half: this.state.selectHalf
|
|
1191
1194
|
})) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
1192
|
-
|
|
1195
|
+
_this13.cacheRow[item.props.field] = '';
|
|
1193
1196
|
|
|
1194
1197
|
if (!item || item.props.hide) {
|
|
1195
1198
|
return null;
|
|
@@ -1206,28 +1209,28 @@ function (_React$Component) {
|
|
|
1206
1209
|
|
|
1207
1210
|
var sort_icon = '';
|
|
1208
1211
|
|
|
1209
|
-
if (
|
|
1210
|
-
sort_icon = 'sort-alpha-' + (
|
|
1212
|
+
if (_this13.sortList[item.props.field]) {
|
|
1213
|
+
sort_icon = 'sort-alpha-' + (_this13.sortList[item.props.field] === 'asc' ? 'down' : 'up');
|
|
1211
1214
|
}
|
|
1212
1215
|
|
|
1213
1216
|
return _react["default"].createElement("th", {
|
|
1214
|
-
onContextMenu:
|
|
1215
|
-
id:
|
|
1217
|
+
onContextMenu: _this13.menuContextHandler(''),
|
|
1218
|
+
id: _this13.domId + '-' + key,
|
|
1216
1219
|
"data-key": 'head_' + key,
|
|
1217
1220
|
style: style
|
|
1218
|
-
},
|
|
1221
|
+
}, _this13.is_sort ? _react["default"].createElement("a", {
|
|
1219
1222
|
className: "ck-ctable-sort",
|
|
1220
1223
|
href: "javascript://",
|
|
1221
|
-
id: "".concat(
|
|
1224
|
+
id: "".concat(_this13.domId, "-sort-").concat(item.props.field),
|
|
1222
1225
|
"data-field": item.props.field,
|
|
1223
|
-
onClick:
|
|
1226
|
+
onClick: _this13.sortHandler
|
|
1224
1227
|
}, item.props.text, " ", _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1225
1228
|
icon: sort_icon
|
|
1226
|
-
})) : item.props.text,
|
|
1229
|
+
})) : item.props.text, _this13.props.move ? _react["default"].createElement("span", {
|
|
1227
1230
|
ref: function ref(c) {
|
|
1228
|
-
return
|
|
1231
|
+
return _this13.headerSplits.push(c);
|
|
1229
1232
|
},
|
|
1230
|
-
"data-key":
|
|
1233
|
+
"data-key": _this13.domId + '-' + key,
|
|
1231
1234
|
className: "ck-column-split"
|
|
1232
1235
|
}) : null);
|
|
1233
1236
|
})))));
|
|
@@ -1235,34 +1238,34 @@ function (_React$Component) {
|
|
|
1235
1238
|
}, {
|
|
1236
1239
|
key: "renderRows",
|
|
1237
1240
|
value: function renderRows() {
|
|
1238
|
-
var
|
|
1241
|
+
var _this14 = this;
|
|
1239
1242
|
|
|
1240
1243
|
return _react["default"].createElement("div", {
|
|
1241
1244
|
ref: function ref(c) {
|
|
1242
|
-
return
|
|
1245
|
+
return _this14.table_rows = c;
|
|
1243
1246
|
},
|
|
1244
1247
|
id: "table-body-com-".concat(this.domId),
|
|
1245
1248
|
className: "flex-grow-1 rows",
|
|
1246
1249
|
onScroll: this.scrollHandler
|
|
1247
1250
|
}, _react["default"].createElement("table", {
|
|
1248
1251
|
ref: function ref(c) {
|
|
1249
|
-
return
|
|
1252
|
+
return _this14.table_body = c;
|
|
1250
1253
|
},
|
|
1251
1254
|
id: "table-body-".concat(this.domId),
|
|
1252
1255
|
className: this.getClasses(),
|
|
1253
1256
|
style: this.getTableStyles()
|
|
1254
1257
|
}, _react["default"].createElement("tbody", null, this.state.data.map(function (row, i) {
|
|
1255
|
-
if (
|
|
1256
|
-
return
|
|
1258
|
+
if (_this14.props.edit) {
|
|
1259
|
+
return _this14.renderEditRow(row, i);
|
|
1257
1260
|
}
|
|
1258
1261
|
|
|
1259
|
-
return
|
|
1262
|
+
return _this14.renderRow(row, i, null);
|
|
1260
1263
|
}), this.props.edit ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
|
|
1261
1264
|
}
|
|
1262
1265
|
}, {
|
|
1263
1266
|
key: "renderRow",
|
|
1264
1267
|
value: function renderRow(row, i, parentRow) {
|
|
1265
|
-
var
|
|
1268
|
+
var _this15 = this;
|
|
1266
1269
|
|
|
1267
1270
|
var checked = this.state.selectRows.indexOf(i) !== -1;
|
|
1268
1271
|
var focus = i === this.state.focus && this.props.focus;
|
|
@@ -1285,9 +1288,9 @@ function (_React$Component) {
|
|
|
1285
1288
|
} //set style
|
|
1286
1289
|
|
|
1287
1290
|
|
|
1288
|
-
var style = _objectSpread({},
|
|
1291
|
+
var style = _objectSpread({}, _this15.props.columnStyle);
|
|
1289
1292
|
|
|
1290
|
-
style.textAlign = item.props.align ||
|
|
1293
|
+
style.textAlign = item.props.align || _this15.props.align;
|
|
1291
1294
|
|
|
1292
1295
|
if (item.props.width) {
|
|
1293
1296
|
style.width = item.props.width;
|
|
@@ -1310,8 +1313,8 @@ function (_React$Component) {
|
|
|
1310
1313
|
|
|
1311
1314
|
if (item.props.children) {
|
|
1312
1315
|
return _react["default"].createElement("td", {
|
|
1313
|
-
onContextMenu:
|
|
1314
|
-
id:
|
|
1316
|
+
onContextMenu: _this15.menuContextHandler(dataType),
|
|
1317
|
+
id: _this15.domId + '-' + key,
|
|
1315
1318
|
"data-row": "".concat(i),
|
|
1316
1319
|
"data-field": item.props.field,
|
|
1317
1320
|
className: item.props.className,
|
|
@@ -1327,8 +1330,8 @@ function (_React$Component) {
|
|
|
1327
1330
|
}
|
|
1328
1331
|
|
|
1329
1332
|
return _react["default"].createElement("td", {
|
|
1330
|
-
onContextMenu:
|
|
1331
|
-
id:
|
|
1333
|
+
onContextMenu: _this15.menuContextHandler(dataType),
|
|
1334
|
+
id: _this15.domId + '-' + key,
|
|
1332
1335
|
"data-field": item.props.field,
|
|
1333
1336
|
style: style,
|
|
1334
1337
|
onClick: function onClick(e) {
|
|
@@ -1342,14 +1345,14 @@ function (_React$Component) {
|
|
|
1342
1345
|
}
|
|
1343
1346
|
},
|
|
1344
1347
|
"data-row": "".concat(i)
|
|
1345
|
-
}, item.props.type ?
|
|
1348
|
+
}, 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]);
|
|
1346
1349
|
}
|
|
1347
1350
|
})));
|
|
1348
1351
|
}
|
|
1349
1352
|
}, {
|
|
1350
1353
|
key: "renderEditRow",
|
|
1351
1354
|
value: function renderEditRow(row, i) {
|
|
1352
|
-
var
|
|
1355
|
+
var _this16 = this;
|
|
1353
1356
|
|
|
1354
1357
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1355
1358
|
className: this.props.onClick ? 'click-row' : undefined,
|
|
@@ -1369,9 +1372,9 @@ function (_React$Component) {
|
|
|
1369
1372
|
} //set style
|
|
1370
1373
|
|
|
1371
1374
|
|
|
1372
|
-
var style = _objectSpread({},
|
|
1375
|
+
var style = _objectSpread({}, _this16.props.columnStyle);
|
|
1373
1376
|
|
|
1374
|
-
style.textAlign = item.props.align ||
|
|
1377
|
+
style.textAlign = item.props.align || _this16.props.align;
|
|
1375
1378
|
|
|
1376
1379
|
if (item.props.width) {
|
|
1377
1380
|
style.width = item.props.width;
|
|
@@ -1379,9 +1382,9 @@ function (_React$Component) {
|
|
|
1379
1382
|
|
|
1380
1383
|
var dataType = 'text';
|
|
1381
1384
|
return _react["default"].createElement("td", {
|
|
1382
|
-
onContextMenu:
|
|
1385
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1383
1386
|
className: item.props.disabled ? 'disabled' : '',
|
|
1384
|
-
id:
|
|
1387
|
+
id: _this16.domId + '-' + key,
|
|
1385
1388
|
"data-field": item.props.field,
|
|
1386
1389
|
style: style,
|
|
1387
1390
|
onClick: function onClick(e) {
|
|
@@ -1395,13 +1398,13 @@ function (_React$Component) {
|
|
|
1395
1398
|
}
|
|
1396
1399
|
},
|
|
1397
1400
|
"data-row": "".concat(i)
|
|
1398
|
-
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] :
|
|
1401
|
+
}, 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));
|
|
1399
1402
|
})));
|
|
1400
1403
|
}
|
|
1401
1404
|
}, {
|
|
1402
1405
|
key: "renderEditAddRow",
|
|
1403
1406
|
value: function renderEditAddRow() {
|
|
1404
|
-
var
|
|
1407
|
+
var _this17 = this;
|
|
1405
1408
|
|
|
1406
1409
|
return _react["default"].createElement("tr", {
|
|
1407
1410
|
id: this.domId + '-edit'
|
|
@@ -1423,14 +1426,14 @@ function (_React$Component) {
|
|
|
1423
1426
|
return _react["default"].createElement("td", {
|
|
1424
1427
|
style: style
|
|
1425
1428
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1426
|
-
onFocus:
|
|
1429
|
+
onFocus: _this17.addNewHandler
|
|
1427
1430
|
}));
|
|
1428
1431
|
}));
|
|
1429
1432
|
}
|
|
1430
1433
|
}, {
|
|
1431
1434
|
key: "renderEditComponent",
|
|
1432
1435
|
value: function renderEditComponent(item, row, i) {
|
|
1433
|
-
var
|
|
1436
|
+
var _this18 = this;
|
|
1434
1437
|
|
|
1435
1438
|
switch (item.type) {
|
|
1436
1439
|
case "combo":
|
|
@@ -1462,7 +1465,7 @@ function (_React$Component) {
|
|
|
1462
1465
|
className: "d-inline",
|
|
1463
1466
|
width: "20px",
|
|
1464
1467
|
onChange: function onChange(chk, e) {
|
|
1465
|
-
|
|
1468
|
+
_this18.editHandler(e, chk, 'chk');
|
|
1466
1469
|
},
|
|
1467
1470
|
"data-row": i,
|
|
1468
1471
|
"data-field": item.field,
|
|
@@ -1504,7 +1507,7 @@ function (_React$Component) {
|
|
|
1504
1507
|
}, {
|
|
1505
1508
|
key: "renderTotal",
|
|
1506
1509
|
value: function renderTotal() {
|
|
1507
|
-
var
|
|
1510
|
+
var _this19 = this;
|
|
1508
1511
|
|
|
1509
1512
|
if (!this.state.total) {
|
|
1510
1513
|
return null;
|
|
@@ -1513,12 +1516,12 @@ function (_React$Component) {
|
|
|
1513
1516
|
var total = this.state.total;
|
|
1514
1517
|
return _react["default"].createElement("div", {
|
|
1515
1518
|
ref: function ref(c) {
|
|
1516
|
-
return
|
|
1519
|
+
return _this19.tableTotal = c;
|
|
1517
1520
|
},
|
|
1518
1521
|
className: "ck-ctable-total"
|
|
1519
1522
|
}, _react["default"].createElement("table", {
|
|
1520
1523
|
ref: function ref(c) {
|
|
1521
|
-
return
|
|
1524
|
+
return _this19.table_total = c;
|
|
1522
1525
|
},
|
|
1523
1526
|
id: "table-total-".concat(this.domId),
|
|
1524
1527
|
className: this.getClasses(),
|
|
@@ -1532,7 +1535,7 @@ function (_React$Component) {
|
|
|
1532
1535
|
return null;
|
|
1533
1536
|
}
|
|
1534
1537
|
|
|
1535
|
-
var align = item.props.align ||
|
|
1538
|
+
var align = item.props.align || _this19.props.align;
|
|
1536
1539
|
var style = {
|
|
1537
1540
|
'textAlign': align
|
|
1538
1541
|
};
|
|
@@ -1542,7 +1545,7 @@ function (_React$Component) {
|
|
|
1542
1545
|
}
|
|
1543
1546
|
|
|
1544
1547
|
return _react["default"].createElement("td", {
|
|
1545
|
-
id:
|
|
1548
|
+
id: _this19.domId + '-' + key,
|
|
1546
1549
|
"data-field": item.props.field,
|
|
1547
1550
|
style: style
|
|
1548
1551
|
}, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
|
|
@@ -1551,7 +1554,7 @@ function (_React$Component) {
|
|
|
1551
1554
|
}, {
|
|
1552
1555
|
key: "renderMenu",
|
|
1553
1556
|
value: function renderMenu() {
|
|
1554
|
-
var
|
|
1557
|
+
var _this20 = this;
|
|
1555
1558
|
|
|
1556
1559
|
var lang;
|
|
1557
1560
|
|
|
@@ -1570,7 +1573,7 @@ function (_React$Component) {
|
|
|
1570
1573
|
|
|
1571
1574
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1572
1575
|
ref: function ref(c) {
|
|
1573
|
-
return
|
|
1576
|
+
return _this20.mainMenu = c;
|
|
1574
1577
|
},
|
|
1575
1578
|
onClick: this.menuClickHandler
|
|
1576
1579
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1590,7 +1593,7 @@ function (_React$Component) {
|
|
|
1590
1593
|
var select = document.getSelection();
|
|
1591
1594
|
if (!select) return;
|
|
1592
1595
|
|
|
1593
|
-
|
|
1596
|
+
_this20.filterHandler(select.toString(), data.field, 'contain');
|
|
1594
1597
|
}
|
|
1595
1598
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1596
1599
|
className: "me-1",
|
|
@@ -1601,7 +1604,7 @@ function (_React$Component) {
|
|
|
1601
1604
|
var select = document.getSelection();
|
|
1602
1605
|
if (!select) return;
|
|
1603
1606
|
|
|
1604
|
-
|
|
1607
|
+
_this20.filterHandler(select.toString(), data.field, 'exclude');
|
|
1605
1608
|
}
|
|
1606
1609
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1607
1610
|
className: "me-1",
|
|
@@ -1609,7 +1612,7 @@ function (_React$Component) {
|
|
|
1609
1612
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1610
1613
|
field: "clear_filter",
|
|
1611
1614
|
onClick: function onClick() {
|
|
1612
|
-
|
|
1615
|
+
_this20.clearFilter();
|
|
1613
1616
|
}
|
|
1614
1617
|
}, _react["default"].createElement("span", {
|
|
1615
1618
|
className: "text-danger"
|
|
@@ -1621,10 +1624,13 @@ function (_React$Component) {
|
|
|
1621
1624
|
step: true
|
|
1622
1625
|
}) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1623
1626
|
field: "equal"
|
|
1624
|
-
}, _react["default"].createElement("span", {
|
|
1627
|
+
}, this.state.filter.equal, _react["default"].createElement("span", {
|
|
1625
1628
|
className: "me-1",
|
|
1626
1629
|
style: inputStyle
|
|
1627
1630
|
}, lang['Equal With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1631
|
+
ref: function ref(c) {
|
|
1632
|
+
return _this20.filter.equal = c;
|
|
1633
|
+
},
|
|
1628
1634
|
className: "me-1",
|
|
1629
1635
|
size: "xs",
|
|
1630
1636
|
width: "120px",
|
|
@@ -1632,13 +1638,13 @@ function (_React$Component) {
|
|
|
1632
1638
|
onChange: this.filterChangeHandler('equal'),
|
|
1633
1639
|
onMouseDown: stopEvent,
|
|
1634
1640
|
onEnter: function onEnter() {
|
|
1635
|
-
|
|
1641
|
+
_this20.filterHandler(_this20.state.filter.equal, _this20.mainMenu.data.field, 'equal');
|
|
1636
1642
|
}
|
|
1637
1643
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1638
1644
|
size: "xs",
|
|
1639
1645
|
onMouseDown: stopEvent,
|
|
1640
1646
|
onClick: function onClick(e) {
|
|
1641
|
-
|
|
1647
|
+
_this20.filterHandler(_this20.state.filter.equal, _this20.mainMenu.data.field, 'equal');
|
|
1642
1648
|
},
|
|
1643
1649
|
icon: "search"
|
|
1644
1650
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1647,6 +1653,9 @@ function (_React$Component) {
|
|
|
1647
1653
|
className: "me-1",
|
|
1648
1654
|
style: inputStyle
|
|
1649
1655
|
}, lang['Start With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1656
|
+
ref: function ref(c) {
|
|
1657
|
+
return _this20.filter.start = c;
|
|
1658
|
+
},
|
|
1650
1659
|
className: "me-1",
|
|
1651
1660
|
size: "xs",
|
|
1652
1661
|
width: "120px",
|
|
@@ -1654,13 +1663,13 @@ function (_React$Component) {
|
|
|
1654
1663
|
onChange: this.filterChangeHandler('start'),
|
|
1655
1664
|
onMouseDown: stopEvent,
|
|
1656
1665
|
onEnter: function onEnter() {
|
|
1657
|
-
|
|
1666
|
+
_this20.filterHandler(_this20.state.filter.start, _this20.mainMenu.data.field, 'start');
|
|
1658
1667
|
}
|
|
1659
1668
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1660
1669
|
size: "xs",
|
|
1661
1670
|
onMouseDown: stopEvent,
|
|
1662
1671
|
onClick: function onClick(e) {
|
|
1663
|
-
|
|
1672
|
+
_this20.filterHandler(_this20.state.filter.start, _this20.mainMenu.data.field, 'start');
|
|
1664
1673
|
},
|
|
1665
1674
|
icon: "search"
|
|
1666
1675
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1669,6 +1678,9 @@ function (_React$Component) {
|
|
|
1669
1678
|
className: "me-1",
|
|
1670
1679
|
style: inputStyle
|
|
1671
1680
|
}, lang['End With']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1681
|
+
ref: function ref(c) {
|
|
1682
|
+
return _this20.filter.end = c;
|
|
1683
|
+
},
|
|
1672
1684
|
className: "me-1",
|
|
1673
1685
|
size: "xs",
|
|
1674
1686
|
width: "120px",
|
|
@@ -1676,13 +1688,13 @@ function (_React$Component) {
|
|
|
1676
1688
|
onChange: this.filterChangeHandler('end'),
|
|
1677
1689
|
onMouseDown: stopEvent,
|
|
1678
1690
|
onEnter: function onEnter() {
|
|
1679
|
-
|
|
1691
|
+
_this20.filterHandler(_this20.state.filter.end, _this20.mainMenu.data.field, 'end');
|
|
1680
1692
|
}
|
|
1681
1693
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1682
1694
|
size: "xs",
|
|
1683
1695
|
onMouseDown: stopEvent,
|
|
1684
1696
|
onClick: function onClick(e) {
|
|
1685
|
-
|
|
1697
|
+
_this20.filterHandler(_this20.state.filter.end, _this20.mainMenu.data.field, 'end');
|
|
1686
1698
|
},
|
|
1687
1699
|
icon: "search"
|
|
1688
1700
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1691,6 +1703,9 @@ function (_React$Component) {
|
|
|
1691
1703
|
className: "me-1",
|
|
1692
1704
|
style: inputStyle
|
|
1693
1705
|
}, lang['Contain with']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1706
|
+
ref: function ref(c) {
|
|
1707
|
+
return _this20.filter.contain = c;
|
|
1708
|
+
},
|
|
1694
1709
|
className: "me-1",
|
|
1695
1710
|
size: "xs",
|
|
1696
1711
|
width: "120px",
|
|
@@ -1698,13 +1713,13 @@ function (_React$Component) {
|
|
|
1698
1713
|
onChange: this.filterChangeHandler('contain'),
|
|
1699
1714
|
onMouseDown: stopEvent,
|
|
1700
1715
|
onEnter: function onEnter() {
|
|
1701
|
-
|
|
1716
|
+
_this20.filterHandler(_this20.state.filter.contain, _this20.mainMenu.data.field, 'contain');
|
|
1702
1717
|
}
|
|
1703
1718
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1704
1719
|
size: "xs",
|
|
1705
1720
|
onMouseDown: stopEvent,
|
|
1706
1721
|
onClick: function onClick(e) {
|
|
1707
|
-
|
|
1722
|
+
_this20.filterHandler(_this20.state.filter.contain, _this20.mainMenu.data.field, 'contain');
|
|
1708
1723
|
},
|
|
1709
1724
|
icon: "search"
|
|
1710
1725
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1722,7 +1737,7 @@ function (_React$Component) {
|
|
|
1722
1737
|
onChange: this.filterChangeHandler('condition'),
|
|
1723
1738
|
onMouseDown: stopEvent,
|
|
1724
1739
|
onEnter: function onEnter() {
|
|
1725
|
-
|
|
1740
|
+
_this20.filterHandler(_this20.state.filter.condition, _this20.mainMenu.data.field, 'condition');
|
|
1726
1741
|
}
|
|
1727
1742
|
})) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1728
1743
|
field: "",
|
|
@@ -1735,13 +1750,13 @@ function (_React$Component) {
|
|
|
1735
1750
|
field: "",
|
|
1736
1751
|
step: true
|
|
1737
1752
|
}) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
|
|
1738
|
-
return
|
|
1753
|
+
return _this20.explainCustomMenu(menu);
|
|
1739
1754
|
}) : null));
|
|
1740
1755
|
}
|
|
1741
1756
|
}, {
|
|
1742
1757
|
key: "renderNumberMenu",
|
|
1743
1758
|
value: function renderNumberMenu() {
|
|
1744
|
-
var
|
|
1759
|
+
var _this21 = this;
|
|
1745
1760
|
|
|
1746
1761
|
var lang;
|
|
1747
1762
|
|
|
@@ -1760,7 +1775,7 @@ function (_React$Component) {
|
|
|
1760
1775
|
|
|
1761
1776
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1762
1777
|
ref: function ref(c) {
|
|
1763
|
-
return
|
|
1778
|
+
return _this21.numMenu = c;
|
|
1764
1779
|
},
|
|
1765
1780
|
onClick: this.menuClickHandler
|
|
1766
1781
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1780,7 +1795,7 @@ function (_React$Component) {
|
|
|
1780
1795
|
var select = document.getSelection();
|
|
1781
1796
|
if (!select) return;
|
|
1782
1797
|
|
|
1783
|
-
|
|
1798
|
+
_this21.filterHandler(select.toString(), data.field, 'contain');
|
|
1784
1799
|
}
|
|
1785
1800
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1786
1801
|
className: "me-1",
|
|
@@ -1791,7 +1806,7 @@ function (_React$Component) {
|
|
|
1791
1806
|
var select = document.getSelection();
|
|
1792
1807
|
if (!select) return;
|
|
1793
1808
|
|
|
1794
|
-
|
|
1809
|
+
_this21.filterHandler(select.toString(), data.field, 'exclude');
|
|
1795
1810
|
}
|
|
1796
1811
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1797
1812
|
className: "me-1",
|
|
@@ -1799,7 +1814,7 @@ function (_React$Component) {
|
|
|
1799
1814
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1800
1815
|
field: "clear_filter",
|
|
1801
1816
|
onClick: function onClick() {
|
|
1802
|
-
|
|
1817
|
+
_this21.clearFilter();
|
|
1803
1818
|
}
|
|
1804
1819
|
}, _react["default"].createElement("span", {
|
|
1805
1820
|
className: "text-danger"
|
|
@@ -1821,14 +1836,14 @@ function (_React$Component) {
|
|
|
1821
1836
|
onChange: this.filterChangeHandler('condition'),
|
|
1822
1837
|
onMouseDown: stopEvent,
|
|
1823
1838
|
onEnter: function onEnter() {
|
|
1824
|
-
|
|
1839
|
+
_this21.filterHandler(_this21.state.filter.condition, _this21.numMenu.data.field, 'condition');
|
|
1825
1840
|
}
|
|
1826
1841
|
}), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
|
|
1827
1842
|
}
|
|
1828
1843
|
}, {
|
|
1829
1844
|
key: "explainCustomMenu",
|
|
1830
1845
|
value: function explainCustomMenu(menu) {
|
|
1831
|
-
var
|
|
1846
|
+
var _this22 = this;
|
|
1832
1847
|
|
|
1833
1848
|
if (menu.children && menu.children instanceof Array) {
|
|
1834
1849
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1836,7 +1851,7 @@ function (_React$Component) {
|
|
|
1836
1851
|
text: menu.text,
|
|
1837
1852
|
child: true
|
|
1838
1853
|
}, menu.children.map(function (item) {
|
|
1839
|
-
return
|
|
1854
|
+
return _this22.explainCustomMenu(item);
|
|
1840
1855
|
}));
|
|
1841
1856
|
} else {
|
|
1842
1857
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|