@clake/react-bootstrap4-window 0.4.9 → 0.5.0
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/lib/CTable.js +263 -136
- 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 +6 -4
- package/lib/i18n/CTable.js.map +3 -3
- package/lib/index.js +2 -2
- package/lib/index.js.map +2 -2
- package/package.json +4 -3
package/lib/CTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @clake/react-bootstrap4-window v0.
|
|
1
|
+
/* @clake/react-bootstrap4-window v0.5.0 | by Clake
|
|
2
2
|
* Copyright (c) 2021 Clake,
|
|
3
|
-
* 2021-
|
|
3
|
+
* 2021-12-29T15:26:43+0800
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
@@ -97,22 +97,6 @@ function (_React$Component) {
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
_defineProperty(_assertThisInitialized(_this), "menuContextHandler", function (e) {
|
|
101
|
-
e.preventDefault();
|
|
102
|
-
e.stopPropagation();
|
|
103
|
-
var data = {
|
|
104
|
-
field: e.currentTarget.dataset.field || '',
|
|
105
|
-
data: _this.state.data[e.currentTarget.dataset.row],
|
|
106
|
-
index: e.currentTarget.dataset.row
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
_this.mainMenu.show({
|
|
110
|
-
evt: e,
|
|
111
|
-
type: 'mouse',
|
|
112
|
-
data: data
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
100
|
_defineProperty(_assertThisInitialized(_this), "menuClickHandler", function (field, data) {
|
|
117
101
|
switch (field) {
|
|
118
102
|
case "asc":
|
|
@@ -160,7 +144,11 @@ function (_React$Component) {
|
|
|
160
144
|
|
|
161
145
|
_defineProperty(_assertThisInitialized(_this), "editHandler", function (e, val, row) {
|
|
162
146
|
var index = parseInt(e.target.dataset.row);
|
|
163
|
-
var field = e.target.dataset.field;
|
|
147
|
+
var field = e.target.dataset.field; //如果是check组件
|
|
148
|
+
|
|
149
|
+
if (row === 'chk') {
|
|
150
|
+
val = val ? 1 : 0;
|
|
151
|
+
}
|
|
164
152
|
|
|
165
153
|
if (_this.editRows.indexOf(index) === -1) {
|
|
166
154
|
_this.editRows.push(index);
|
|
@@ -510,6 +498,40 @@ function (_React$Component) {
|
|
|
510
498
|
* @param e
|
|
511
499
|
*/
|
|
512
500
|
|
|
501
|
+
}, {
|
|
502
|
+
key: "menuContextHandler",
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* show menu list
|
|
506
|
+
* @param dataType
|
|
507
|
+
*/
|
|
508
|
+
value: function menuContextHandler(dataType) {
|
|
509
|
+
var _this7 = this;
|
|
510
|
+
|
|
511
|
+
return function (e) {
|
|
512
|
+
e.preventDefault();
|
|
513
|
+
e.stopPropagation();
|
|
514
|
+
var data = {
|
|
515
|
+
field: e.currentTarget.dataset.field || '',
|
|
516
|
+
data: _this7.state.data[e.currentTarget.dataset.row],
|
|
517
|
+
index: e.currentTarget.dataset.row
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
if (dataType === "text") {
|
|
521
|
+
_this7.mainMenu.show({
|
|
522
|
+
evt: e,
|
|
523
|
+
type: 'mouse',
|
|
524
|
+
data: data
|
|
525
|
+
});
|
|
526
|
+
} else {
|
|
527
|
+
_this7.numMenu.show({
|
|
528
|
+
evt: e,
|
|
529
|
+
type: 'mouse',
|
|
530
|
+
data: data
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
}
|
|
513
535
|
}, {
|
|
514
536
|
key: "localFilter",
|
|
515
537
|
|
|
@@ -565,6 +587,7 @@ function (_React$Component) {
|
|
|
565
587
|
}
|
|
566
588
|
});
|
|
567
589
|
this.mainMenu.hide();
|
|
590
|
+
this.numMenu.hide();
|
|
568
591
|
|
|
569
592
|
if (typeof this.props.onFilter === 'function') {
|
|
570
593
|
this.props.onFilter(text, field, type);
|
|
@@ -598,13 +621,13 @@ function (_React$Component) {
|
|
|
598
621
|
}, {
|
|
599
622
|
key: "filterChangeHandler",
|
|
600
623
|
value: function filterChangeHandler(field) {
|
|
601
|
-
var
|
|
624
|
+
var _this8 = this;
|
|
602
625
|
|
|
603
626
|
return function (val) {
|
|
604
|
-
var filter =
|
|
627
|
+
var filter = _this8.state.filter;
|
|
605
628
|
filter[field] = val;
|
|
606
629
|
|
|
607
|
-
|
|
630
|
+
_this8.setState({
|
|
608
631
|
filter: filter
|
|
609
632
|
});
|
|
610
633
|
};
|
|
@@ -660,7 +683,7 @@ function (_React$Component) {
|
|
|
660
683
|
}, {
|
|
661
684
|
key: "deleteRow",
|
|
662
685
|
value: function deleteRow(row_index) {
|
|
663
|
-
var
|
|
686
|
+
var _this9 = this;
|
|
664
687
|
|
|
665
688
|
if (row_index < 0 || row_index >= this.state.data.length) {
|
|
666
689
|
return;
|
|
@@ -675,7 +698,7 @@ function (_React$Component) {
|
|
|
675
698
|
|
|
676
699
|
this.editRows.forEach(function (item, index) {
|
|
677
700
|
if (item > row_index) {
|
|
678
|
-
|
|
701
|
+
_this9.editRows[index] = item - 1;
|
|
679
702
|
}
|
|
680
703
|
});
|
|
681
704
|
this.setState({
|
|
@@ -707,10 +730,10 @@ function (_React$Component) {
|
|
|
707
730
|
* @returns {*}
|
|
708
731
|
*/
|
|
709
732
|
value: function getSelectRows() {
|
|
710
|
-
var
|
|
733
|
+
var _this10 = this;
|
|
711
734
|
|
|
712
735
|
return this.selectRows.map(function (item) {
|
|
713
|
-
return
|
|
736
|
+
return _this10.state.data[item];
|
|
714
737
|
});
|
|
715
738
|
}
|
|
716
739
|
/**
|
|
@@ -722,17 +745,17 @@ function (_React$Component) {
|
|
|
722
745
|
}, {
|
|
723
746
|
key: "setSelectRows",
|
|
724
747
|
value: function setSelectRows(key, list) {
|
|
725
|
-
var
|
|
748
|
+
var _this11 = this;
|
|
726
749
|
|
|
727
750
|
this.state.data.forEach(function (row, i) {
|
|
728
751
|
if (list.indexOf(row[key]) !== -1) {
|
|
729
|
-
|
|
752
|
+
_this11.refs['row_' + i].setChecked(true);
|
|
730
753
|
|
|
731
|
-
|
|
754
|
+
_this11.setRowCheck(true, i);
|
|
732
755
|
} else {
|
|
733
|
-
|
|
756
|
+
_this11.refs['row_' + i].setChecked(false);
|
|
734
757
|
|
|
735
|
-
|
|
758
|
+
_this11.setRowCheck(false, i);
|
|
736
759
|
}
|
|
737
760
|
});
|
|
738
761
|
this.checkAllCheckHalf();
|
|
@@ -744,50 +767,50 @@ function (_React$Component) {
|
|
|
744
767
|
}, {
|
|
745
768
|
key: "bindSplit",
|
|
746
769
|
value: function bindSplit() {
|
|
747
|
-
var
|
|
770
|
+
var _this12 = this;
|
|
748
771
|
|
|
749
772
|
if (this.props.move) {
|
|
750
773
|
this.headerSplits.forEach(function (split) {
|
|
751
|
-
if (!
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
774
|
+
if (!_this12.drag) {
|
|
775
|
+
_this12.dragColumnLeft = 0;
|
|
776
|
+
_this12.dragWidth = 0;
|
|
777
|
+
_this12.drag = new _Drag["default"](_this12.split, split, {
|
|
755
778
|
start: function start(dragDom, eventDom) {
|
|
756
|
-
var xy = _reactBootstrap.Common.GetDomXY(eventDom,
|
|
779
|
+
var xy = _reactBootstrap.Common.GetDomXY(eventDom, _this12.mainDom);
|
|
757
780
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
dragDom.style.left =
|
|
781
|
+
_this12.dragWidth = parseInt(eventDom.parentNode.style.width);
|
|
782
|
+
_this12.dragColumnLeft = xy.left - _this12.table_rows.scrollLeft;
|
|
783
|
+
dragDom.style.left = _this12.dragColumnLeft + 'px';
|
|
761
784
|
dragDom.classList.remove('d-none');
|
|
762
785
|
return true;
|
|
763
786
|
},
|
|
764
787
|
move: function move(_move, dragDom, eventDom) {
|
|
765
|
-
if (
|
|
766
|
-
_move.x =
|
|
788
|
+
if (_this12.dragWidth + (_move.x - _this12.dragColumnLeft) < 50) {
|
|
789
|
+
_move.x = _this12.dragColumnLeft - _this12.dragWidth + 50;
|
|
767
790
|
}
|
|
768
791
|
},
|
|
769
792
|
end: function end(dragDom, eventDom) {
|
|
770
793
|
dragDom.classList.add('d-none');
|
|
771
794
|
var column_key = eventDom.dataset.key;
|
|
772
795
|
|
|
773
|
-
var diff = parseInt(dragDom.style.left) -
|
|
796
|
+
var diff = parseInt(dragDom.style.left) - _this12.dragColumnLeft;
|
|
774
797
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
798
|
+
_this12.width = parseInt(_this12.width) + diff + 'px';
|
|
799
|
+
_this12.table_head.style.width = _this12.width;
|
|
800
|
+
_this12.table_body.style.width = _this12.width;
|
|
778
801
|
|
|
779
|
-
if (
|
|
780
|
-
|
|
802
|
+
if (_this12.table_total) {
|
|
803
|
+
_this12.table_total.style.width = _this12.width;
|
|
781
804
|
}
|
|
782
805
|
|
|
783
806
|
document.querySelectorAll("#".concat(column_key)).forEach(function (item) {
|
|
784
|
-
item.style.width = "".concat(
|
|
807
|
+
item.style.width = "".concat(_this12.dragWidth + diff, "px");
|
|
785
808
|
});
|
|
786
809
|
return true;
|
|
787
810
|
}
|
|
788
811
|
});
|
|
789
812
|
} else {
|
|
790
|
-
|
|
813
|
+
_this12.drag.setEventDom(split);
|
|
791
814
|
}
|
|
792
815
|
});
|
|
793
816
|
}
|
|
@@ -921,11 +944,11 @@ function (_React$Component) {
|
|
|
921
944
|
}, {
|
|
922
945
|
key: "render",
|
|
923
946
|
value: function render() {
|
|
924
|
-
var
|
|
947
|
+
var _this13 = this;
|
|
925
948
|
|
|
926
949
|
return _react["default"].createElement("div", {
|
|
927
950
|
ref: function ref(c) {
|
|
928
|
-
return
|
|
951
|
+
return _this13.mainDom = c;
|
|
929
952
|
},
|
|
930
953
|
className: this.getMainClasses(),
|
|
931
954
|
style: this.getStyles()
|
|
@@ -937,7 +960,7 @@ function (_React$Component) {
|
|
|
937
960
|
selector: "#table-body-com-".concat(this.domId)
|
|
938
961
|
})), this.renderFoot(), _react["default"].createElement("div", {
|
|
939
962
|
ref: function ref(c) {
|
|
940
|
-
return
|
|
963
|
+
return _this13.split = c;
|
|
941
964
|
},
|
|
942
965
|
className: "ck-split d-none"
|
|
943
966
|
}));
|
|
@@ -945,15 +968,15 @@ function (_React$Component) {
|
|
|
945
968
|
}, {
|
|
946
969
|
key: "renderHeader",
|
|
947
970
|
value: function renderHeader() {
|
|
948
|
-
var
|
|
971
|
+
var _this14 = this;
|
|
949
972
|
|
|
950
973
|
return _react["default"].createElement("div", {
|
|
951
974
|
ref: function ref(c) {
|
|
952
|
-
return
|
|
975
|
+
return _this14.tableHeader = c;
|
|
953
976
|
}
|
|
954
977
|
}, _react["default"].createElement("table", {
|
|
955
978
|
ref: function ref(c) {
|
|
956
|
-
return
|
|
979
|
+
return _this14.table_head = c;
|
|
957
980
|
},
|
|
958
981
|
id: "table-head-".concat(this.domId),
|
|
959
982
|
className: this.getClasses(),
|
|
@@ -969,11 +992,11 @@ function (_React$Component) {
|
|
|
969
992
|
icon: "list"
|
|
970
993
|
}) : _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
971
994
|
ref: function ref(c) {
|
|
972
|
-
return
|
|
995
|
+
return _this14.allchk = c;
|
|
973
996
|
},
|
|
974
997
|
onChange: this.selectAll
|
|
975
998
|
})) : null, _react["default"].Children.map(this.props.children, function (item, key) {
|
|
976
|
-
|
|
999
|
+
_this14.cacheRow[item.props.field] = '';
|
|
977
1000
|
|
|
978
1001
|
if (!item || item.props.hide) {
|
|
979
1002
|
return null;
|
|
@@ -990,28 +1013,28 @@ function (_React$Component) {
|
|
|
990
1013
|
|
|
991
1014
|
var sort_icon = '';
|
|
992
1015
|
|
|
993
|
-
if (
|
|
994
|
-
sort_icon = 'sort-alpha-' + (
|
|
1016
|
+
if (_this14.sortList[item.props.field]) {
|
|
1017
|
+
sort_icon = 'sort-alpha-' + (_this14.sortList[item.props.field] === 'asc' ? 'down' : 'up');
|
|
995
1018
|
}
|
|
996
1019
|
|
|
997
1020
|
return _react["default"].createElement("th", {
|
|
998
|
-
onContextMenu:
|
|
999
|
-
id:
|
|
1021
|
+
onContextMenu: _this14.menuContextHandler,
|
|
1022
|
+
id: _this14.domId + '-' + key,
|
|
1000
1023
|
"data-key": 'head_' + key,
|
|
1001
1024
|
style: style
|
|
1002
|
-
},
|
|
1025
|
+
}, _this14.is_sort ? _react["default"].createElement("a", {
|
|
1003
1026
|
className: "ck-ctable-sort",
|
|
1004
1027
|
href: "javascript://",
|
|
1005
|
-
id: "".concat(
|
|
1028
|
+
id: "".concat(_this14.domId, "-sort-").concat(item.props.field),
|
|
1006
1029
|
"data-field": item.props.field,
|
|
1007
|
-
onClick:
|
|
1030
|
+
onClick: _this14.sortHandler
|
|
1008
1031
|
}, item.props.text, " ", _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1009
1032
|
icon: sort_icon
|
|
1010
|
-
})) : item.props.text,
|
|
1033
|
+
})) : item.props.text, _this14.props.move ? _react["default"].createElement("span", {
|
|
1011
1034
|
ref: function ref(c) {
|
|
1012
|
-
return
|
|
1035
|
+
return _this14.headerSplits.push(c);
|
|
1013
1036
|
},
|
|
1014
|
-
"data-key":
|
|
1037
|
+
"data-key": _this14.domId + '-' + key,
|
|
1015
1038
|
className: "ck-column-split"
|
|
1016
1039
|
}) : null);
|
|
1017
1040
|
})))));
|
|
@@ -1019,34 +1042,34 @@ function (_React$Component) {
|
|
|
1019
1042
|
}, {
|
|
1020
1043
|
key: "renderRows",
|
|
1021
1044
|
value: function renderRows() {
|
|
1022
|
-
var
|
|
1045
|
+
var _this15 = this;
|
|
1023
1046
|
|
|
1024
1047
|
return _react["default"].createElement("div", {
|
|
1025
1048
|
ref: function ref(c) {
|
|
1026
|
-
return
|
|
1049
|
+
return _this15.table_rows = c;
|
|
1027
1050
|
},
|
|
1028
1051
|
id: "table-body-com-".concat(this.domId),
|
|
1029
1052
|
className: "flex-grow-1 rows",
|
|
1030
1053
|
onScroll: this.scrollHandler
|
|
1031
1054
|
}, _react["default"].createElement("table", {
|
|
1032
1055
|
ref: function ref(c) {
|
|
1033
|
-
return
|
|
1056
|
+
return _this15.table_body = c;
|
|
1034
1057
|
},
|
|
1035
1058
|
id: "table-body-".concat(this.domId),
|
|
1036
1059
|
className: this.getClasses(),
|
|
1037
1060
|
style: this.getTableStyles()
|
|
1038
1061
|
}, _react["default"].createElement("tbody", null, this.state.data.map(function (row, i) {
|
|
1039
|
-
if (
|
|
1040
|
-
return
|
|
1062
|
+
if (_this15.props.edit) {
|
|
1063
|
+
return _this15.renderEditRow(row, i);
|
|
1041
1064
|
}
|
|
1042
1065
|
|
|
1043
|
-
return
|
|
1044
|
-
}), this.props.edit ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null);
|
|
1066
|
+
return _this15.renderRow(row, i);
|
|
1067
|
+
}), this.props.edit ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
|
|
1045
1068
|
}
|
|
1046
1069
|
}, {
|
|
1047
1070
|
key: "renderRow",
|
|
1048
1071
|
value: function renderRow(row, i, parentRow) {
|
|
1049
|
-
var
|
|
1072
|
+
var _this16 = this;
|
|
1050
1073
|
|
|
1051
1074
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1052
1075
|
className: this.props.onClick ? 'click-row' : null,
|
|
@@ -1065,18 +1088,33 @@ function (_React$Component) {
|
|
|
1065
1088
|
} //set style
|
|
1066
1089
|
|
|
1067
1090
|
|
|
1068
|
-
var style = _objectSpread({},
|
|
1091
|
+
var style = _objectSpread({}, _this16.props.columnStyle);
|
|
1069
1092
|
|
|
1070
|
-
style.textAlign = item.props.align ||
|
|
1093
|
+
style.textAlign = item.props.align || _this16.props.align;
|
|
1071
1094
|
|
|
1072
1095
|
if (item.props.width) {
|
|
1073
1096
|
style.width = item.props.width;
|
|
1074
1097
|
}
|
|
1075
1098
|
|
|
1099
|
+
var dataType;
|
|
1100
|
+
|
|
1101
|
+
switch (item.props.dataType) {
|
|
1102
|
+
case "number":
|
|
1103
|
+
dataType = "number";
|
|
1104
|
+
break;
|
|
1105
|
+
|
|
1106
|
+
case "date":
|
|
1107
|
+
dataType = "date";
|
|
1108
|
+
break;
|
|
1109
|
+
|
|
1110
|
+
default:
|
|
1111
|
+
dataType = "text";
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1076
1114
|
if (item.props.children) {
|
|
1077
1115
|
return _react["default"].createElement("td", {
|
|
1078
|
-
onContextMenu:
|
|
1079
|
-
id:
|
|
1116
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1117
|
+
id: _this16.domId + '-' + key,
|
|
1080
1118
|
"data-row": "".concat(i),
|
|
1081
1119
|
"data-field": item.props.field,
|
|
1082
1120
|
className: item.props.className,
|
|
@@ -1090,9 +1128,13 @@ function (_React$Component) {
|
|
|
1090
1128
|
value: row[item.props.field]
|
|
1091
1129
|
}));
|
|
1092
1130
|
} else {
|
|
1131
|
+
if (item.props.type) {
|
|
1132
|
+
item.props.disabled = true;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1093
1135
|
return _react["default"].createElement("td", {
|
|
1094
|
-
onContextMenu:
|
|
1095
|
-
id:
|
|
1136
|
+
onContextMenu: _this16.menuContextHandler(dataType),
|
|
1137
|
+
id: _this16.domId + '-' + key,
|
|
1096
1138
|
"data-field": item.props.field,
|
|
1097
1139
|
style: style,
|
|
1098
1140
|
onClick: function onClick(e) {
|
|
@@ -1106,14 +1148,14 @@ function (_React$Component) {
|
|
|
1106
1148
|
}
|
|
1107
1149
|
},
|
|
1108
1150
|
"data-row": "".concat(i)
|
|
1109
|
-
}, item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field]);
|
|
1151
|
+
}, 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]);
|
|
1110
1152
|
}
|
|
1111
1153
|
})));
|
|
1112
1154
|
}
|
|
1113
1155
|
}, {
|
|
1114
1156
|
key: "renderEditRow",
|
|
1115
1157
|
value: function renderEditRow(row, i) {
|
|
1116
|
-
var
|
|
1158
|
+
var _this17 = this;
|
|
1117
1159
|
|
|
1118
1160
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
|
|
1119
1161
|
className: this.props.onClick ? 'click-row' : null,
|
|
@@ -1133,18 +1175,19 @@ function (_React$Component) {
|
|
|
1133
1175
|
} //set style
|
|
1134
1176
|
|
|
1135
1177
|
|
|
1136
|
-
var style = _objectSpread({},
|
|
1178
|
+
var style = _objectSpread({}, _this17.props.columnStyle);
|
|
1137
1179
|
|
|
1138
|
-
style.textAlign = item.props.align ||
|
|
1180
|
+
style.textAlign = item.props.align || _this17.props.align;
|
|
1139
1181
|
|
|
1140
1182
|
if (item.props.width) {
|
|
1141
1183
|
style.width = item.props.width;
|
|
1142
1184
|
}
|
|
1143
1185
|
|
|
1186
|
+
var dataType = 'text';
|
|
1144
1187
|
return _react["default"].createElement("td", {
|
|
1145
|
-
onContextMenu:
|
|
1188
|
+
onContextMenu: _this17.menuContextHandler(dataType),
|
|
1146
1189
|
className: item.props.disabled ? 'disabled' : '',
|
|
1147
|
-
id:
|
|
1190
|
+
id: _this17.domId + '-' + key,
|
|
1148
1191
|
"data-field": item.props.field,
|
|
1149
1192
|
style: style,
|
|
1150
1193
|
onClick: function onClick(e) {
|
|
@@ -1158,13 +1201,13 @@ function (_React$Component) {
|
|
|
1158
1201
|
}
|
|
1159
1202
|
},
|
|
1160
1203
|
"data-row": "".concat(i)
|
|
1161
|
-
}, item.props.disabled ? item.props.onFormat ? item.props.onFormat(row[item.props.field], row, item.props.field) : row[item.props.field] :
|
|
1204
|
+
}, 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));
|
|
1162
1205
|
})));
|
|
1163
1206
|
}
|
|
1164
1207
|
}, {
|
|
1165
1208
|
key: "renderEditAddRow",
|
|
1166
1209
|
value: function renderEditAddRow() {
|
|
1167
|
-
var
|
|
1210
|
+
var _this18 = this;
|
|
1168
1211
|
|
|
1169
1212
|
return _react["default"].createElement("tr", {
|
|
1170
1213
|
id: this.domId + '-edit'
|
|
@@ -1186,13 +1229,15 @@ function (_React$Component) {
|
|
|
1186
1229
|
return _react["default"].createElement("td", {
|
|
1187
1230
|
style: style
|
|
1188
1231
|
}, _react["default"].createElement(_CTableInput["default"], {
|
|
1189
|
-
onFocus:
|
|
1232
|
+
onFocus: _this18.addNewHandler
|
|
1190
1233
|
}));
|
|
1191
1234
|
}));
|
|
1192
1235
|
}
|
|
1193
1236
|
}, {
|
|
1194
1237
|
key: "renderEditComponent",
|
|
1195
1238
|
value: function renderEditComponent(item, row, i) {
|
|
1239
|
+
var _this19 = this;
|
|
1240
|
+
|
|
1196
1241
|
switch (item.type) {
|
|
1197
1242
|
case "combo":
|
|
1198
1243
|
return _react["default"].createElement(_CTableInput["default"], {
|
|
@@ -1219,7 +1264,16 @@ function (_React$Component) {
|
|
|
1219
1264
|
});
|
|
1220
1265
|
|
|
1221
1266
|
case "checkbox":
|
|
1222
|
-
|
|
1267
|
+
return _react["default"].createElement(_reactBootstrap.CCheckbox, {
|
|
1268
|
+
width: "20px",
|
|
1269
|
+
onChange: function onChange(chk, e) {
|
|
1270
|
+
_this19.editHandler(e, chk, 'chk');
|
|
1271
|
+
},
|
|
1272
|
+
"data-row": i,
|
|
1273
|
+
"data-field": item.field,
|
|
1274
|
+
checked: !!row[item.field],
|
|
1275
|
+
disabled: item.disabled
|
|
1276
|
+
});
|
|
1223
1277
|
|
|
1224
1278
|
default:
|
|
1225
1279
|
return _react["default"].createElement(_CTableInput["default"], {
|
|
@@ -1251,7 +1305,7 @@ function (_React$Component) {
|
|
|
1251
1305
|
}, {
|
|
1252
1306
|
key: "renderTotal",
|
|
1253
1307
|
value: function renderTotal() {
|
|
1254
|
-
var
|
|
1308
|
+
var _this20 = this;
|
|
1255
1309
|
|
|
1256
1310
|
if (!this.state.total) {
|
|
1257
1311
|
return null;
|
|
@@ -1260,11 +1314,11 @@ function (_React$Component) {
|
|
|
1260
1314
|
var total = this.state.total;
|
|
1261
1315
|
return _react["default"].createElement("div", {
|
|
1262
1316
|
ref: function ref(c) {
|
|
1263
|
-
return
|
|
1317
|
+
return _this20.tableTotal = c;
|
|
1264
1318
|
}
|
|
1265
1319
|
}, _react["default"].createElement("table", {
|
|
1266
1320
|
ref: function ref(c) {
|
|
1267
|
-
return
|
|
1321
|
+
return _this20.table_total = c;
|
|
1268
1322
|
},
|
|
1269
1323
|
id: "table-total-".concat(this.domId),
|
|
1270
1324
|
className: this.getClasses(),
|
|
@@ -1278,7 +1332,7 @@ function (_React$Component) {
|
|
|
1278
1332
|
return null;
|
|
1279
1333
|
}
|
|
1280
1334
|
|
|
1281
|
-
var align = item.props.align ||
|
|
1335
|
+
var align = item.props.align || _this20.props.align;
|
|
1282
1336
|
var style = {
|
|
1283
1337
|
'textAlign': align
|
|
1284
1338
|
};
|
|
@@ -1288,7 +1342,7 @@ function (_React$Component) {
|
|
|
1288
1342
|
}
|
|
1289
1343
|
|
|
1290
1344
|
return _react["default"].createElement("td", {
|
|
1291
|
-
id:
|
|
1345
|
+
id: _this20.domId + '-' + key,
|
|
1292
1346
|
"data-field": item.props.field,
|
|
1293
1347
|
style: style
|
|
1294
1348
|
}, item.props.onFormat ? item.props.onFormat(total[item.props.field], total, item.props.field) : total[item.props.field]);
|
|
@@ -1297,7 +1351,7 @@ function (_React$Component) {
|
|
|
1297
1351
|
}, {
|
|
1298
1352
|
key: "renderMenu",
|
|
1299
1353
|
value: function renderMenu() {
|
|
1300
|
-
var
|
|
1354
|
+
var _this21 = this;
|
|
1301
1355
|
|
|
1302
1356
|
var lang = this.props.lang;
|
|
1303
1357
|
|
|
@@ -1308,9 +1362,9 @@ function (_React$Component) {
|
|
|
1308
1362
|
lang = _CTable2["default"][langStr];
|
|
1309
1363
|
}
|
|
1310
1364
|
|
|
1311
|
-
return _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1365
|
+
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1312
1366
|
ref: function ref(c) {
|
|
1313
|
-
return
|
|
1367
|
+
return _this21.mainMenu = c;
|
|
1314
1368
|
},
|
|
1315
1369
|
onClick: this.menuClickHandler
|
|
1316
1370
|
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1321,22 +1375,14 @@ function (_React$Component) {
|
|
|
1321
1375
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1322
1376
|
className: "mr-1",
|
|
1323
1377
|
icon: "copy"
|
|
1324
|
-
}), lang['Copy']), _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1325
|
-
field: "cut",
|
|
1326
|
-
onClick: function onClick() {
|
|
1327
|
-
document.execCommand("cut");
|
|
1328
|
-
}
|
|
1329
|
-
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1330
|
-
className: "mr-1",
|
|
1331
|
-
icon: "cut"
|
|
1332
|
-
}), lang['Cut']), this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1378
|
+
}), lang['Copy']), this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1333
1379
|
step: true
|
|
1334
1380
|
}) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1335
1381
|
field: "select_filter",
|
|
1336
1382
|
onClick: function onClick(e, field, data) {
|
|
1337
1383
|
var select = document.getSelection();
|
|
1338
1384
|
|
|
1339
|
-
|
|
1385
|
+
_this21.filterHandler(select.toString(), data.field, 'contain');
|
|
1340
1386
|
}
|
|
1341
1387
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1342
1388
|
className: "mr-1",
|
|
@@ -1346,7 +1392,7 @@ function (_React$Component) {
|
|
|
1346
1392
|
onClick: function onClick(e, field, data) {
|
|
1347
1393
|
var select = document.getSelection();
|
|
1348
1394
|
|
|
1349
|
-
|
|
1395
|
+
_this21.filterHandler(select.toString(), data.field, 'exclude');
|
|
1350
1396
|
}
|
|
1351
1397
|
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1352
1398
|
className: "mr-1",
|
|
@@ -1354,7 +1400,7 @@ function (_React$Component) {
|
|
|
1354
1400
|
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1355
1401
|
field: "clear_filter",
|
|
1356
1402
|
onClick: function onClick() {
|
|
1357
|
-
|
|
1403
|
+
_this21.clearFilter();
|
|
1358
1404
|
}
|
|
1359
1405
|
}, _react["default"].createElement("span", {
|
|
1360
1406
|
className: "text-danger"
|
|
@@ -1376,13 +1422,13 @@ function (_React$Component) {
|
|
|
1376
1422
|
onChange: this.filterChangeHandler('equal'),
|
|
1377
1423
|
onMouseDown: stopEvent,
|
|
1378
1424
|
onEnter: function onEnter() {
|
|
1379
|
-
|
|
1425
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1380
1426
|
}
|
|
1381
1427
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1382
1428
|
size: "xs",
|
|
1383
1429
|
onMouseDown: stopEvent,
|
|
1384
1430
|
onClick: function onClick(e) {
|
|
1385
|
-
|
|
1431
|
+
_this21.filterHandler(_this21.state.filter.equal, _this21.mainMenu.data.field, 'equal');
|
|
1386
1432
|
},
|
|
1387
1433
|
icon: "search"
|
|
1388
1434
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1398,13 +1444,13 @@ function (_React$Component) {
|
|
|
1398
1444
|
onChange: this.filterChangeHandler('start'),
|
|
1399
1445
|
onMouseDown: stopEvent,
|
|
1400
1446
|
onEnter: function onEnter() {
|
|
1401
|
-
|
|
1447
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1402
1448
|
}
|
|
1403
1449
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1404
1450
|
size: "xs",
|
|
1405
1451
|
onMouseDown: stopEvent,
|
|
1406
1452
|
onClick: function onClick(e) {
|
|
1407
|
-
|
|
1453
|
+
_this21.filterHandler(_this21.state.filter.start, _this21.mainMenu.data.field, 'start');
|
|
1408
1454
|
},
|
|
1409
1455
|
icon: "search"
|
|
1410
1456
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1420,13 +1466,13 @@ function (_React$Component) {
|
|
|
1420
1466
|
onChange: this.filterChangeHandler('end'),
|
|
1421
1467
|
onMouseDown: stopEvent,
|
|
1422
1468
|
onEnter: function onEnter() {
|
|
1423
|
-
|
|
1469
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1424
1470
|
}
|
|
1425
1471
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1426
1472
|
size: "xs",
|
|
1427
1473
|
onMouseDown: stopEvent,
|
|
1428
1474
|
onClick: function onClick(e) {
|
|
1429
|
-
|
|
1475
|
+
_this21.filterHandler(_this21.state.filter.end, _this21.mainMenu.data.field, 'end');
|
|
1430
1476
|
},
|
|
1431
1477
|
icon: "search"
|
|
1432
1478
|
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1442,28 +1488,32 @@ function (_React$Component) {
|
|
|
1442
1488
|
onChange: this.filterChangeHandler('contain'),
|
|
1443
1489
|
onMouseDown: stopEvent,
|
|
1444
1490
|
onEnter: function onEnter() {
|
|
1445
|
-
|
|
1491
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1446
1492
|
}
|
|
1447
1493
|
}), _react["default"].createElement(_reactBootstrap.Button, {
|
|
1448
1494
|
size: "xs",
|
|
1449
1495
|
onMouseDown: stopEvent,
|
|
1450
1496
|
onClick: function onClick(e) {
|
|
1451
|
-
|
|
1497
|
+
_this21.filterHandler(_this21.state.filter.contain, _this21.mainMenu.data.field, 'contain');
|
|
1452
1498
|
},
|
|
1453
1499
|
icon: "search"
|
|
1454
|
-
})) : null, this.
|
|
1500
|
+
})) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1455
1501
|
step: true
|
|
1456
|
-
}) : null, this.
|
|
1457
|
-
field: "
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1502
|
+
}) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1503
|
+
field: "filter",
|
|
1504
|
+
className: "flex-column"
|
|
1505
|
+
}, _react["default"].createElement("div", {
|
|
1506
|
+
className: "w-100"
|
|
1507
|
+
}, lang['Condition Filter']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1508
|
+
size: "xs",
|
|
1509
|
+
width: "100%",
|
|
1510
|
+
data: this.state.filter.condition,
|
|
1511
|
+
onChange: this.filterChangeHandler('condition'),
|
|
1512
|
+
onMouseDown: stopEvent,
|
|
1513
|
+
onEnter: function onEnter() {
|
|
1514
|
+
_this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
|
|
1515
|
+
}
|
|
1516
|
+
})) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1467
1517
|
step: true
|
|
1468
1518
|
}) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1469
1519
|
field: "delete_row"
|
|
@@ -1472,13 +1522,90 @@ function (_React$Component) {
|
|
|
1472
1522
|
}, lang['Clone Row']) : null, this.props.customMenu ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1473
1523
|
step: true
|
|
1474
1524
|
}) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
|
|
1475
|
-
return
|
|
1476
|
-
}) : null);
|
|
1525
|
+
return _this21.explainCustomMenu(menu);
|
|
1526
|
+
}) : null));
|
|
1527
|
+
}
|
|
1528
|
+
}, {
|
|
1529
|
+
key: "renderNumberMenu",
|
|
1530
|
+
value: function renderNumberMenu() {
|
|
1531
|
+
var _this22 = this;
|
|
1532
|
+
|
|
1533
|
+
var lang = this.props.lang;
|
|
1534
|
+
|
|
1535
|
+
if (!lang) {
|
|
1536
|
+
var i18 = _reactBootstrap.i18n.getLang();
|
|
1537
|
+
|
|
1538
|
+
var langStr = typeof lang === 'string' ? lang : i18["short"];
|
|
1539
|
+
lang = _CTable2["default"][langStr];
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_reactBootstrap.Menu, {
|
|
1543
|
+
ref: function ref(c) {
|
|
1544
|
+
return _this22.numMenu = c;
|
|
1545
|
+
},
|
|
1546
|
+
onClick: this.menuClickHandler
|
|
1547
|
+
}, _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1548
|
+
field: "copy",
|
|
1549
|
+
onClick: function onClick() {
|
|
1550
|
+
document.execCommand("copy");
|
|
1551
|
+
}
|
|
1552
|
+
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1553
|
+
className: "mr-1",
|
|
1554
|
+
icon: "copy"
|
|
1555
|
+
}), lang['Copy']), this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1556
|
+
step: true
|
|
1557
|
+
}) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1558
|
+
field: "select_filter",
|
|
1559
|
+
onClick: function onClick(e, field, data) {
|
|
1560
|
+
var select = document.getSelection();
|
|
1561
|
+
|
|
1562
|
+
_this22.filterHandler(select.toString(), data.field, 'contain');
|
|
1563
|
+
}
|
|
1564
|
+
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1565
|
+
className: "mr-1",
|
|
1566
|
+
icon: "filter"
|
|
1567
|
+
}), lang['Filter By Selection']) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1568
|
+
field: "select_exclude",
|
|
1569
|
+
onClick: function onClick(e, field, data) {
|
|
1570
|
+
var select = document.getSelection();
|
|
1571
|
+
|
|
1572
|
+
_this22.filterHandler(select.toString(), data.field, 'exclude');
|
|
1573
|
+
}
|
|
1574
|
+
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1575
|
+
className: "mr-1",
|
|
1576
|
+
icon: "filter"
|
|
1577
|
+
}), lang['Filter Excluding Selection']) : null, this.is_filter || this.is_sort ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1578
|
+
field: "clear_filter",
|
|
1579
|
+
onClick: function onClick() {
|
|
1580
|
+
_this22.clearFilter();
|
|
1581
|
+
}
|
|
1582
|
+
}, _react["default"].createElement("span", {
|
|
1583
|
+
className: "text-danger"
|
|
1584
|
+
}, _react["default"].createElement(_reactBootstrap.Icon, {
|
|
1585
|
+
className: "mr-1",
|
|
1586
|
+
icon: "brush"
|
|
1587
|
+
}), lang['Clear Filter / Sort'])) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1588
|
+
step: true
|
|
1589
|
+
}) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
1590
|
+
field: "filter",
|
|
1591
|
+
className: "flex-column"
|
|
1592
|
+
}, _react["default"].createElement("div", {
|
|
1593
|
+
className: "w-100"
|
|
1594
|
+
}, lang['Condition Filter']), _react["default"].createElement(_reactBootstrap.Input, {
|
|
1595
|
+
size: "xs",
|
|
1596
|
+
width: "100%",
|
|
1597
|
+
data: this.state.filter.condition,
|
|
1598
|
+
onChange: this.filterChangeHandler('condition'),
|
|
1599
|
+
onMouseDown: stopEvent,
|
|
1600
|
+
onEnter: function onEnter() {
|
|
1601
|
+
_this22.filterHandler(_this22.state.filter.condition, _this22.numMenu.data.field, 'condition');
|
|
1602
|
+
}
|
|
1603
|
+
}), _react["default"].createElement("div", null, "and,or,between,>,>=,<,<=,=")) : null));
|
|
1477
1604
|
}
|
|
1478
1605
|
}, {
|
|
1479
1606
|
key: "explainCustomMenu",
|
|
1480
1607
|
value: function explainCustomMenu(menu) {
|
|
1481
|
-
var
|
|
1608
|
+
var _this23 = this;
|
|
1482
1609
|
|
|
1483
1610
|
if (menu.children && menu.children instanceof Array) {
|
|
1484
1611
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|
|
@@ -1486,7 +1613,7 @@ function (_React$Component) {
|
|
|
1486
1613
|
text: menu.text,
|
|
1487
1614
|
child: true
|
|
1488
1615
|
}, menu.children.map(function (item) {
|
|
1489
|
-
return
|
|
1616
|
+
return _this23.explainCustomMenu(item);
|
|
1490
1617
|
}));
|
|
1491
1618
|
} else {
|
|
1492
1619
|
return _react["default"].createElement(_reactBootstrap.Menu.Item, {
|