-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathTableHeader.js
151 lines (142 loc) · 5.86 KB
/
TableHeader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = TableHeader;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _includes = require('lodash/includes');
var _includes2 = _interopRequireDefault(_includes);
var _style = require('../style');
var _style2 = _interopRequireDefault(_style);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function TableHeader(props) {
console.log(props);
if (props.config.show_length_menu == true || props.config.show_filter == true || props.config.button.excel == true || props.config.button.csv == true || props.config.button.print == true) {
return _react2.default.createElement(
'div',
{ className: 'row table-head asrt-table-head', id: props.id ? props.id + "-table-head" : "" },
_react2.default.createElement(
'div',
{ className: 'col-md-6' },
props.config.show_length_menu ? _react2.default.createElement(
'div',
{ className: 'input-group asrt-page-length' },
_react2.default.createElement(
'div',
{ className: 'input-group-addon input-group-prepend' },
_react2.default.createElement(
'span',
{ className: 'input-group-text', style: _style2.default.table_size },
props.lengthMenuText[0] ? props.lengthMenuText[0] : ''
)
),
(0, _includes2.default)(props.config.language.length_menu, '_MENU_') ? _react2.default.createElement(
'select',
{ type: 'text', className: 'form-control', style: _style2.default.table_size_dropdown,
onChange: props.changePageSize },
props.config.length_menu.map(function (value, key) {
return _react2.default.createElement(
'option',
{ key: value },
value
);
}),
_react2.default.createElement(
'option',
{ value: props.recordLength },
'All'
)
) : null,
_react2.default.createElement(
'div',
{ className: 'input-group-addon input-group-prepend' },
_react2.default.createElement(
'span',
{ className: 'input-group-text', style: _style2.default.table_size },
props.lengthMenuText[1] ? props.lengthMenuText[1] : ''
)
)
) : null
),
_react2.default.createElement(
'div',
{ className: 'col-md-6 float-right text-right' },
props.config.show_filter ? _react2.default.createElement(
'div',
{ className: 'table_filter', style: _style2.default.table_filter },
_react2.default.createElement('input', {
type: 'search',
className: 'form-control',
placeholder: props.config.language.filter,
onChange: props.filterRecords })
) : null,
_react2.default.createElement(
'div',
{ className: 'table_tools', style: _style2.default.table_tool },
props.config.button.excel ? _react2.default.createElement(
'button',
{ className: 'btn btn-primary buttons-excel',
tabIndex: '0',
'aria-controls': 'configuration_tbl',
title: 'Export to Excel',
style: _style2.default.table_tool_btn,
onClick: props.exportToExcel },
_react2.default.createElement(
'span',
null,
_react2.default.createElement('i', { className: props && props.config && props.config.fa5_support ? "fas fa-file-excel" : "fa fa-file-excel-o", 'aria-hidden': 'true' })
)
) : null,
props.config.button.csv ? _react2.default.createElement(
'button',
{ className: 'btn btn-primary buttons-csv',
tabIndex: '0',
'aria-controls': 'configuration_tbl',
title: 'Export to CSV',
style: _style2.default.table_tool_btn,
onClick: props.exportToCSV },
_react2.default.createElement(
'span',
null,
_react2.default.createElement('i', { className: props && props.config && props.config.fa5_support ? "fas fa-file-csv" : "fa fa-file-text-o", 'aria-hidden': 'true' })
)
) : null,
props.config.button.print ? _react2.default.createElement(
'button',
{ className: 'btn btn-primary buttons-pdf',
tabIndex: '0',
'aria-controls': 'configuration_tbl',
title: 'Export to PDF',
style: _style2.default.table_tool_btn,
onClick: props.exportToPDF },
_react2.default.createElement(
'span',
null,
_react2.default.createElement('i', { className: "glyphicon glyphicon-print " + (props && props.config && props.config.fa5_support ? "fas fa-print" : "fa fa-print"), 'aria-hidden': 'true' })
)
) : null,
props.config.button.extra == true ? props.extraButtons.map(function (elem, index) {
elem.clickCount = 0;
elem.singleClickTimer = '';
return _react2.default.createElement(
'button',
{ className: elem.className ? elem.className : "btn btn-primary buttons-pdf",
tabIndex: '0',
'aria-controls': 'configuration_tbl',
title: elem.title ? elem.title : "Export to PDF",
style: _style2.default.table_tool_btn,
onClick: function onClick(event) {
elem.onClick(event);
},
key: index },
elem.children
);
}) : null
)
)
);
} else {
return null;
}
}