@agilemotion/oui-react-js 1.3.0 → 1.3.2
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/ApplicationContext.js +151 -38
- package/dist/BasicApp.js +16 -9
- package/dist/BasicAppHome.js +6 -4
- package/dist/BusinessPortalApp.css +37 -0
- package/dist/BusinessPortalApp.js +115 -0
- package/dist/BusinessPortalAppHome.js +167 -0
- package/dist/RestUtils.js +12 -9
- package/dist/assets/css/black-dashboard-react.css +1 -2
- package/dist/assets/jss/components/footerStyle.js +7 -4
- package/dist/assets/jss/views/loginBasicStyle.js +0 -1
- package/dist/assets/jss/views/loginBusinessPortalStyle.js +76 -0
- package/dist/assets/scss/black-dashboard-react/bootstrap/_reboot.scss +0 -1
- package/dist/components/DocumentView.css +4 -0
- package/dist/components/DocumentViewer.js +93 -37
- package/dist/components/DocumentViewerComponent.js +93 -0
- package/dist/components/ElementResizeHandler.js +232 -0
- package/dist/components/Graph.js +120 -16
- package/dist/components/GraphNode.js +0 -2
- package/dist/components/HtmlPanel.js +45 -4
- package/dist/components/Icon.js +8 -0
- package/dist/components/SignaturePanel.js +118 -0
- package/dist/components/StepperTitleBar.css +85 -0
- package/dist/components/StepperTitleBar.js +190 -0
- package/dist/components/TitleBar.js +1 -1
- package/dist/components/Toolbar.js +6 -3
- package/dist/components/dashboard/{BasicBusinessApp.js → BasicBusinessAppDashboard.js} +17 -16
- package/dist/components/dashboard/BusinessPortalAppDashboard.css +5 -0
- package/dist/components/dashboard/BusinessPortalAppDashboard.js +191 -0
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +23 -12
- package/dist/components/dashboard/components/portal/Timeline.js +17 -0
- package/dist/components/dashboard/components/portal/Workspace.css +25 -0
- package/dist/components/dashboard/components/portal/Workspace.js +48 -0
- package/dist/components/dashboard/components/portal/portal-dashboard.css +25 -0
- package/dist/components/footer/Footer.js +43 -10
- package/dist/components/form/BaseField.js +11 -2
- package/dist/components/form/DatePicker.js +62 -1
- package/dist/components/form/FieldSet.js +1 -1
- package/dist/components/form/Form.js +28 -8
- package/dist/components/form/SelectItem.js +10 -3
- package/dist/components/form/UploadField.js +122 -44
- package/dist/components/layout/Layout.js +30 -15
- package/dist/components/layout/ViewPort.js +3 -2
- package/dist/components/menu/MenuLink.js +7 -0
- package/dist/components/navbars/HomeNavbar.js +0 -10
- package/dist/components/navbars/PortalNavbar.css +75 -0
- package/dist/components/navbars/PortalNavbar.js +138 -0
- package/dist/components/signatures/AlertItem.js +71 -0
- package/dist/components/signatures/Card.js +39 -0
- package/dist/components/signatures/MenuButton.js +108 -0
- package/dist/components/signatures/Prompt.js +78 -0
- package/dist/components/signatures/ResponsiveTable.css +91 -0
- package/dist/components/signatures/ResponsiveTable.js +568 -0
- package/dist/components/signatures/SearchView.js +236 -0
- package/dist/components/signatures/SignatorySearch.js +115 -0
- package/dist/components/signatures/SignatorySearchForm.js +77 -0
- package/dist/components/signatures/SignatureInputProps.js +336 -0
- package/dist/components/signatures/SignatureTemplateDesigner.js +890 -0
- package/dist/components/signatures/Toolbar.js +208 -0
- package/dist/components/signatures/ViewUtils.js +309 -0
- package/dist/components/signatures/widgets.css +126 -0
- package/dist/event/RouteActionHandler.js +1 -1
- package/dist/view/Dashboard.js +17 -13
- package/dist/view/PortalDashboard.js +33 -0
- package/dist/view/security/ChangePasswordBasic.js +1 -0
- package/dist/view/security/ForgotPasswordBasic.js +1 -0
- package/dist/view/security/LoginBasic.js +6 -1
- package/dist/view/security/LoginBusinessPortal.js +267 -0
- package/dist/view/security/ResetPasswordBasic.js +1 -0
- package/package.json +26 -24
- package/dist/assets/img/flogo.png +0 -0
- package/dist/components/SignatureTemplateDesigner.js +0 -168
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = EnhancedTable;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styles = require("@material-ui/core/styles");
|
|
13
|
+
|
|
14
|
+
var _reactSuperResponsiveTable = require("react-super-responsive-table");
|
|
15
|
+
|
|
16
|
+
require("react-super-responsive-table/dist/SuperResponsiveTableStyle.css");
|
|
17
|
+
|
|
18
|
+
var _TablePagination = _interopRequireDefault(require("@material-ui/core/TablePagination"));
|
|
19
|
+
|
|
20
|
+
var _TableSortLabel = _interopRequireDefault(require("@material-ui/core/TableSortLabel"));
|
|
21
|
+
|
|
22
|
+
var _Toolbar = _interopRequireDefault(require("./Toolbar"));
|
|
23
|
+
|
|
24
|
+
var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
|
|
25
|
+
|
|
26
|
+
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
27
|
+
|
|
28
|
+
var _ViewUtils = _interopRequireDefault(require("./ViewUtils"));
|
|
29
|
+
|
|
30
|
+
require("./ResponsiveTable.css");
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
+
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
+
|
|
40
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
41
|
+
|
|
42
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
const utils = new _ViewUtils.default();
|
|
47
|
+
const MULTI_SELECT_CHECKBOX_COL_WIDTH = 64;
|
|
48
|
+
|
|
49
|
+
function evaluateTableCellWidth(multiSelect, headCell, headCellCount) {
|
|
50
|
+
return multiSelect === true ? "calc(" + (typeof headCell.widthRatio !== 'undefined' ? 100 * headCell.widthRatio + "%" : 100 / headCellCount + "%") + " - " + MULTI_SELECT_CHECKBOX_COL_WIDTH / headCellCount + "px)" : typeof headCell.widthRatio !== 'undefined' ? 100 * headCell.widthRatio + "%" : 100 / headCellCount + "%";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function desc(a, b, orderBy) {
|
|
54
|
+
if (b[orderBy] < a[orderBy]) {
|
|
55
|
+
return -1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (b[orderBy] > a[orderBy]) {
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function stableSort(array, cmp) {
|
|
66
|
+
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
67
|
+
stabilizedThis.sort((a, b) => {
|
|
68
|
+
const order = cmp(a[0], b[0]);
|
|
69
|
+
if (order !== 0) return order;
|
|
70
|
+
return a[1] - b[1];
|
|
71
|
+
});
|
|
72
|
+
return stabilizedThis.map(el => el[0]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getSorting(order, orderBy) {
|
|
76
|
+
return order === 'desc' ? (a, b) => desc(a, b, orderBy) : (a, b) => -desc(a, b, orderBy);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function EnhancedTableHead(props) {
|
|
80
|
+
const classes = props.classes,
|
|
81
|
+
onSelectAllClick = props.onSelectAllClick,
|
|
82
|
+
order = props.order,
|
|
83
|
+
orderBy = props.orderBy,
|
|
84
|
+
numSelected = props.numSelected,
|
|
85
|
+
rowCount = props.rowCount,
|
|
86
|
+
onRequestSort = props.onRequestSort,
|
|
87
|
+
headCells = props.headCells;
|
|
88
|
+
|
|
89
|
+
const createSortHandler = property => event => {
|
|
90
|
+
onRequestSort(event, property);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Thead, {
|
|
94
|
+
className: classes.tableHead,
|
|
95
|
+
style: {
|
|
96
|
+
width: "calc(100% - " + props.scrollWidth + "px)"
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Tr, {
|
|
99
|
+
style: {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
flexWrap: 'wrap'
|
|
102
|
+
}
|
|
103
|
+
}, props.multiSelect === true ? /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Th, {
|
|
104
|
+
padding: "checkbox",
|
|
105
|
+
width: MULTI_SELECT_CHECKBOX_COL_WIDTH + "px",
|
|
106
|
+
className: "selectCell"
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
108
|
+
indeterminate: numSelected > 0 && numSelected < rowCount,
|
|
109
|
+
checked: numSelected === rowCount,
|
|
110
|
+
onChange: onSelectAllClick,
|
|
111
|
+
inputProps: {
|
|
112
|
+
'aria-label': 'select all'
|
|
113
|
+
}
|
|
114
|
+
})) : null, headCells.map(headCell => /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Th, {
|
|
115
|
+
key: headCell.id,
|
|
116
|
+
align: headCell.numeric === true ? 'right' : 'left',
|
|
117
|
+
padding: headCell.disablePadding ? 'none' : 'default',
|
|
118
|
+
sortDirection: orderBy === headCell.id ? order : false,
|
|
119
|
+
className: classes.tableHeaderCell,
|
|
120
|
+
style: {
|
|
121
|
+
width: headCell.width
|
|
122
|
+
}
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement(_TableSortLabel.default, {
|
|
124
|
+
active: orderBy === headCell.id,
|
|
125
|
+
direction: order,
|
|
126
|
+
onClick: createSortHandler(headCell.id)
|
|
127
|
+
}, headCell.label, orderBy === headCell.id ? /*#__PURE__*/_react.default.createElement("span", {
|
|
128
|
+
className: classes.visuallyHidden
|
|
129
|
+
}, order === 'desc' ? 'sorted descending' : 'sorted ascending') : null)))));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
EnhancedTableHead.propTypes = {
|
|
133
|
+
classes: _propTypes.default.object.isRequired,
|
|
134
|
+
numSelected: _propTypes.default.number.isRequired,
|
|
135
|
+
onRequestSort: _propTypes.default.func.isRequired,
|
|
136
|
+
onSelectAllClick: _propTypes.default.func.isRequired,
|
|
137
|
+
order: _propTypes.default.oneOf(['asc', 'desc']).isRequired,
|
|
138
|
+
orderBy: _propTypes.default.string.isRequired,
|
|
139
|
+
rowCount: _propTypes.default.number.isRequired
|
|
140
|
+
};
|
|
141
|
+
const useStyles = (0, _styles.makeStyles)(theme => ({
|
|
142
|
+
root: {
|
|
143
|
+
width: '100%',
|
|
144
|
+
marginTop: theme.spacing(3)
|
|
145
|
+
},
|
|
146
|
+
paper: {
|
|
147
|
+
width: '100%',
|
|
148
|
+
height: '100%',
|
|
149
|
+
position: 'relative',
|
|
150
|
+
zIndex: '0'
|
|
151
|
+
},
|
|
152
|
+
scrollPadding: {
|
|
153
|
+
padding: '8px !important'
|
|
154
|
+
},
|
|
155
|
+
noScrollPadding: {
|
|
156
|
+
padding: '0 !important',
|
|
157
|
+
width: '1px !important'
|
|
158
|
+
},
|
|
159
|
+
tableBody: {
|
|
160
|
+
display: 'block',
|
|
161
|
+
overflowY: 'auto'
|
|
162
|
+
},
|
|
163
|
+
tableHeaderCell: {
|
|
164
|
+
overflow: 'inherit',
|
|
165
|
+
textAlign: 'left !important'
|
|
166
|
+
},
|
|
167
|
+
tableHead: {
|
|
168
|
+
fontSize: '14px !important',
|
|
169
|
+
display: 'block',
|
|
170
|
+
overflow: 'inherit'
|
|
171
|
+
},
|
|
172
|
+
tableSelected: {
|
|
173
|
+
backgroundColor: '#e1e1e1'
|
|
174
|
+
},
|
|
175
|
+
tableRow: {},
|
|
176
|
+
tableWrapper: {
|
|
177
|
+
height: '100%'
|
|
178
|
+
},
|
|
179
|
+
table: {
|
|
180
|
+
height: '100%'
|
|
181
|
+
},
|
|
182
|
+
visuallyHidden: {
|
|
183
|
+
border: 0,
|
|
184
|
+
clip: 'rect(0 0 0 0)',
|
|
185
|
+
height: 1,
|
|
186
|
+
margin: -1,
|
|
187
|
+
padding: 0,
|
|
188
|
+
position: 'absolute',
|
|
189
|
+
top: 20,
|
|
190
|
+
width: 1
|
|
191
|
+
}
|
|
192
|
+
}));
|
|
193
|
+
|
|
194
|
+
function EnhancedTable(props) {
|
|
195
|
+
const utils = new _ViewUtils.default();
|
|
196
|
+
const classes = useStyles();
|
|
197
|
+
|
|
198
|
+
const _React$useState = _react.default.useState('asc'),
|
|
199
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
200
|
+
order = _React$useState2[0],
|
|
201
|
+
setOrder = _React$useState2[1];
|
|
202
|
+
|
|
203
|
+
const _React$useState3 = _react.default.useState('id'),
|
|
204
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
205
|
+
orderBy = _React$useState4[0],
|
|
206
|
+
setOrderBy = _React$useState4[1];
|
|
207
|
+
|
|
208
|
+
const _React$useState5 = _react.default.useState([]),
|
|
209
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
210
|
+
selected = _React$useState6[0],
|
|
211
|
+
setSelected = _React$useState6[1];
|
|
212
|
+
|
|
213
|
+
const _React$useState7 = _react.default.useState(0),
|
|
214
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
215
|
+
totalNumberOfRows = _React$useState8[0],
|
|
216
|
+
setTotalNumberOfRows = _React$useState8[1];
|
|
217
|
+
|
|
218
|
+
const _React$useState9 = _react.default.useState(""),
|
|
219
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
220
|
+
selectedRow = _React$useState10[0],
|
|
221
|
+
setSelectedRow = _React$useState10[1];
|
|
222
|
+
|
|
223
|
+
const _React$useState11 = _react.default.useState(0),
|
|
224
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
225
|
+
page = _React$useState12[0],
|
|
226
|
+
setPage = _React$useState12[1];
|
|
227
|
+
|
|
228
|
+
const _React$useState13 = _react.default.useState(!utils.isNull(props.rows) ? props.rows : []),
|
|
229
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
230
|
+
rows = _React$useState14[0],
|
|
231
|
+
setRows = _React$useState14[1];
|
|
232
|
+
|
|
233
|
+
const _React$useState15 = _react.default.useState(0),
|
|
234
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
235
|
+
scrollWidth = _React$useState16[0],
|
|
236
|
+
setScrollWidth = _React$useState16[1];
|
|
237
|
+
|
|
238
|
+
const _React$useState17 = _react.default.useState(true),
|
|
239
|
+
_React$useState18 = _slicedToArray(_React$useState17, 2),
|
|
240
|
+
dense = _React$useState18[0],
|
|
241
|
+
setDense = _React$useState18[1];
|
|
242
|
+
|
|
243
|
+
const _React$useState19 = _react.default.useState(utils.isNull(props.autoFetchData) || props.autoFetchData === true),
|
|
244
|
+
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
245
|
+
fetchEnabled = _React$useState20[0],
|
|
246
|
+
setFetchEnabled = _React$useState20[1];
|
|
247
|
+
|
|
248
|
+
const _React$useState21 = _react.default.useState(10),
|
|
249
|
+
_React$useState22 = _slicedToArray(_React$useState21, 2),
|
|
250
|
+
rowsPerPage = _React$useState22[0],
|
|
251
|
+
setRowsPerPage = _React$useState22[1];
|
|
252
|
+
|
|
253
|
+
const headCells = props.headCells;
|
|
254
|
+
const actionsToolbar = props.actionsToolbar;
|
|
255
|
+
|
|
256
|
+
const _React$useState23 = _react.default.useState(props.searchParameters),
|
|
257
|
+
_React$useState24 = _slicedToArray(_React$useState23, 2),
|
|
258
|
+
searchParameters = _React$useState24[0],
|
|
259
|
+
setSearchParameters = _React$useState24[1];
|
|
260
|
+
|
|
261
|
+
for (let i = 0; i < props.headCells.length; i++) {
|
|
262
|
+
let headCell = props.headCells[i];
|
|
263
|
+
headCell.width = evaluateTableCellWidth(props.multiSelect, headCell, props.headCells.length);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
_react.default.useEffect(() => {
|
|
267
|
+
if (!utils.isNull(props.rows)) {
|
|
268
|
+
setRows(props.rows);
|
|
269
|
+
}
|
|
270
|
+
}, [props.rows]);
|
|
271
|
+
|
|
272
|
+
_react.default.useEffect(() => {
|
|
273
|
+
if (fetchEnabled && !utils.isNull(props.searchParameters) && !utils.isNull(props.dataUrl)) {
|
|
274
|
+
setSearchParameters(props.searchParameters);
|
|
275
|
+
utils.invokeUrl(props.dataUrl, JSON.stringify(utils.getRequest(page + 1, rowsPerPage, props.searchParameters, props.paged)), data => {
|
|
276
|
+
var result;
|
|
277
|
+
|
|
278
|
+
if (typeof data === "string") {
|
|
279
|
+
result = JSON.parse(data);
|
|
280
|
+
} else {
|
|
281
|
+
result = data;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (!utils.isNull(result)) {
|
|
285
|
+
setRows(result.records);
|
|
286
|
+
setTotalNumberOfRows(result.totalNumberOfRecords);
|
|
287
|
+
|
|
288
|
+
if (!utils.isNull(props.onDataArrive)) {
|
|
289
|
+
props.onDataArrive(result);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
updateScrollBarPadding();
|
|
293
|
+
}
|
|
294
|
+
}, null);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
setFetchEnabled(true);
|
|
298
|
+
}, [props.searchParameters]);
|
|
299
|
+
|
|
300
|
+
_react.default.useEffect(() => {
|
|
301
|
+
updateScrollBarPadding();
|
|
302
|
+
}, [rows]);
|
|
303
|
+
|
|
304
|
+
function updateScrollBarPadding() {
|
|
305
|
+
var tbody = document.getElementById('mainTableBody');
|
|
306
|
+
|
|
307
|
+
if (tbody !== null && typeof tbody !== 'undefined') {
|
|
308
|
+
setScrollWidth(tbody.offsetWidth - tbody.clientWidth);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
window.onresize = function onresize() {
|
|
313
|
+
updateScrollBarPadding();
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
function getRequestJson(currentPage, curretRowsPerPage, paged) {
|
|
317
|
+
return utils.getRequest(currentPage, curretRowsPerPage, searchParameters, paged);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function handleRequestSort(event, property) {
|
|
321
|
+
const isDesc = orderBy === property && order === 'desc';
|
|
322
|
+
setOrder(isDesc ? 'asc' : 'desc');
|
|
323
|
+
setOrderBy(property);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function handleSelectAllClick(event) {
|
|
327
|
+
if (event.target.checked) {
|
|
328
|
+
const newSelecteds = rows.map(n => n.name);
|
|
329
|
+
setSelected(newSelecteds);
|
|
330
|
+
props.onSelectionChange(newSelecteds);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
setSelected([]);
|
|
335
|
+
props.onSelectionChange([]);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function doHandleClick(event, id) {
|
|
339
|
+
const selectedIndex = selected.indexOf(id);
|
|
340
|
+
let newSelected = [];
|
|
341
|
+
|
|
342
|
+
if (props.multiSelect === true) {
|
|
343
|
+
if (selectedIndex === -1) {
|
|
344
|
+
newSelected = newSelected.concat(selected, id);
|
|
345
|
+
} else if (selectedIndex === 0) {
|
|
346
|
+
newSelected = newSelected.concat(selected.slice(1));
|
|
347
|
+
} else if (selectedIndex === selected.length - 1) {
|
|
348
|
+
newSelected = newSelected.concat(selected.slice(0, -1));
|
|
349
|
+
} else if (selectedIndex > 0) {
|
|
350
|
+
newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
newSelected.push(id);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
let selectedRows = [];
|
|
357
|
+
|
|
358
|
+
for (var i = 0; i < rows.length; i++) {
|
|
359
|
+
let row = rows[i];
|
|
360
|
+
|
|
361
|
+
for (var j = 0; j < newSelected.length; j++) {
|
|
362
|
+
if (row.map.id === newSelected[j]) {
|
|
363
|
+
selectedRows.push(row);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
setSelected(newSelected);
|
|
369
|
+
|
|
370
|
+
if (!utils.isNull(props.onSelectionChange)) {
|
|
371
|
+
props.onSelectionChange(selectedRows);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
setSelectedRow(id);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function handleClick(event, id) {
|
|
378
|
+
if (!utils.isNull(props.onCellSelectionChange)) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
doHandleClick(event, id);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function handleCellClick(event, id, headCell) {
|
|
386
|
+
if (headCell.contentType !== "document") {
|
|
387
|
+
// TODO : Evaluate if this call is necessary
|
|
388
|
+
doHandleClick(event, id);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (!utils.isNull(props.onCellSelectionChange)) {
|
|
392
|
+
props.onCellSelectionChange(id, headCell);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function handleChangePage(event, newPage) {
|
|
397
|
+
utils.invokeUrl(props.dataUrl + "?request=" + getRequestJson(newPage + 1, rowsPerPage, true), data => {
|
|
398
|
+
setRows(data.Data);
|
|
399
|
+
setPage(newPage);
|
|
400
|
+
|
|
401
|
+
if (!utils.isNull(props.onDataArrive)) {
|
|
402
|
+
props.onDataArrive(data);
|
|
403
|
+
}
|
|
404
|
+
}, null);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function handleChangeRowsPerPage(event) {
|
|
408
|
+
var curretRowsPerPage = +event.target.value;
|
|
409
|
+
utils.invokeUrl(props.dataUrl + "?request=" + getRequestJson(1, curretRowsPerPage, true), result => {
|
|
410
|
+
setRows(result.Data);
|
|
411
|
+
setRowsPerPage(curretRowsPerPage);
|
|
412
|
+
setPage(0);
|
|
413
|
+
|
|
414
|
+
if (!utils.isNull(props.onDataArrive)) {
|
|
415
|
+
props.onDataArrive(result);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
updateScrollBarPadding();
|
|
419
|
+
}, null);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function handleChangeDense(event) {
|
|
423
|
+
setDense(event.target.checked);
|
|
424
|
+
updateScrollBarPadding();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const isSelected = id => selected.indexOf(id) !== -1;
|
|
428
|
+
|
|
429
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Paper.default, {
|
|
430
|
+
className: classes.paper
|
|
431
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
432
|
+
className: "responsive-table",
|
|
433
|
+
style: {
|
|
434
|
+
height: props.height
|
|
435
|
+
}
|
|
436
|
+
}, /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Table, {
|
|
437
|
+
className: "table table-hover",
|
|
438
|
+
cellspacing: "0",
|
|
439
|
+
"aria-labelledby": "tableTitle",
|
|
440
|
+
size: dense ? 'small' : 'medium',
|
|
441
|
+
style: {
|
|
442
|
+
width: '100%'
|
|
443
|
+
}
|
|
444
|
+
}, /*#__PURE__*/_react.default.createElement(EnhancedTableHead, {
|
|
445
|
+
classes: classes,
|
|
446
|
+
numSelected: selected.length,
|
|
447
|
+
scrollWidth: scrollWidth,
|
|
448
|
+
order: order,
|
|
449
|
+
orderBy: orderBy,
|
|
450
|
+
onSelectAllClick: handleSelectAllClick,
|
|
451
|
+
onRequestSort: handleRequestSort,
|
|
452
|
+
rowCount: totalNumberOfRows,
|
|
453
|
+
headCells: headCells,
|
|
454
|
+
multiSelect: props.multiSelect
|
|
455
|
+
}), !utils.isNull(rows) ? /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Tbody, {
|
|
456
|
+
className: classes.tableBody,
|
|
457
|
+
style: {
|
|
458
|
+
maxHeight: utils.isNull(props.bodyMaxHeight) ? props.bodyMaxHeight : "42vh"
|
|
459
|
+
},
|
|
460
|
+
id: "mainTableBody"
|
|
461
|
+
}, stableSort(rows, getSorting(order, orderBy)).map((row, index) => {
|
|
462
|
+
const isItemSelected = isSelected(row.map.id);
|
|
463
|
+
const labelId = "enhanced-table-checkbox-".concat(index);
|
|
464
|
+
let counter = 0;
|
|
465
|
+
return /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Tr, {
|
|
466
|
+
style: {
|
|
467
|
+
display: 'flex',
|
|
468
|
+
flexWrap: 'wrap'
|
|
469
|
+
},
|
|
470
|
+
hover: true,
|
|
471
|
+
onClick: event => handleClick(event, row.map.id),
|
|
472
|
+
role: "checkbox",
|
|
473
|
+
"aria-checked": isItemSelected,
|
|
474
|
+
tabIndex: -1,
|
|
475
|
+
key: row.map.id,
|
|
476
|
+
selected: isItemSelected,
|
|
477
|
+
className: selectedRow === row.map.id ? classes.tableSelected : classes.tableRow
|
|
478
|
+
}, props.multiSelect === true ? /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Td, {
|
|
479
|
+
padding: "checkbox",
|
|
480
|
+
width: MULTI_SELECT_CHECKBOX_COL_WIDTH + "px",
|
|
481
|
+
className: "selectCell"
|
|
482
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
483
|
+
checked: isItemSelected,
|
|
484
|
+
inputProps: {
|
|
485
|
+
'aria-labelledby': labelId
|
|
486
|
+
}
|
|
487
|
+
})) : null, headCells.map(headCell => counter++ === headCells.length - 1 && actionsToolbar !== null && typeof actionsToolbar !== "undefined" ? /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Td, {
|
|
488
|
+
style: {
|
|
489
|
+
width: headCell.width
|
|
490
|
+
},
|
|
491
|
+
align: "left",
|
|
492
|
+
key: headCell.id
|
|
493
|
+
}, /*#__PURE__*/_react.default.createElement(_Toolbar.default, {
|
|
494
|
+
highlight: false,
|
|
495
|
+
title: "",
|
|
496
|
+
buttonClickHandler: buttonId => props.buttonClickHandler(buttonId),
|
|
497
|
+
config: actionsToolbar
|
|
498
|
+
})) : headCell.numeric === true ? /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Td, {
|
|
499
|
+
style: {
|
|
500
|
+
width: headCell.width
|
|
501
|
+
},
|
|
502
|
+
align: "right",
|
|
503
|
+
key: headCell.id,
|
|
504
|
+
onClick: event => handleCellClick(event, row.map.id, headCell)
|
|
505
|
+
}, /*#__PURE__*/_react.default.createElement(TableCellContent, {
|
|
506
|
+
contentValue: row.map[headCell.id],
|
|
507
|
+
contentType: headCell.contentType
|
|
508
|
+
})) : /*#__PURE__*/_react.default.createElement(_reactSuperResponsiveTable.Td, {
|
|
509
|
+
style: {
|
|
510
|
+
width: headCell.width
|
|
511
|
+
},
|
|
512
|
+
align: "left",
|
|
513
|
+
key: headCell.id,
|
|
514
|
+
onClick: event => handleCellClick(event, row.map.id, headCell)
|
|
515
|
+
}, /*#__PURE__*/_react.default.createElement(TableCellContent, {
|
|
516
|
+
contentValue: row.map[headCell.id],
|
|
517
|
+
contentType: headCell.contentType
|
|
518
|
+
}))));
|
|
519
|
+
})) : null)), props.paged === false ? "" : /*#__PURE__*/_react.default.createElement(_TablePagination.default, {
|
|
520
|
+
rowsPerPageOptions: [5, 10, 25],
|
|
521
|
+
component: "div",
|
|
522
|
+
count: totalNumberOfRows,
|
|
523
|
+
rowsPerPage: rowsPerPage,
|
|
524
|
+
page: page,
|
|
525
|
+
backIconButtonProps: {
|
|
526
|
+
'aria-label': 'previous page'
|
|
527
|
+
},
|
|
528
|
+
nextIconButtonProps: {
|
|
529
|
+
'aria-label': 'next page'
|
|
530
|
+
},
|
|
531
|
+
onChangePage: handleChangePage,
|
|
532
|
+
onChangeRowsPerPage: handleChangeRowsPerPage
|
|
533
|
+
})));
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
class TableCellContent extends _react.default.Component {
|
|
537
|
+
constructor(props) {
|
|
538
|
+
super(props);
|
|
539
|
+
this.state = {
|
|
540
|
+
contentValue: props.contentValue ? props.contentValue : null,
|
|
541
|
+
contentType: props.contentType,
|
|
542
|
+
className: props.className
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
render() {
|
|
547
|
+
let displayValue;
|
|
548
|
+
const linkStyle = {
|
|
549
|
+
cursor: 'pointer',
|
|
550
|
+
textDecoration: 'underline'
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
if (this.state.contentType !== 'undefined') {
|
|
554
|
+
if (this.state.contentType === 'document') {
|
|
555
|
+
displayValue = /*#__PURE__*/_react.default.createElement("span", {
|
|
556
|
+
style: linkStyle
|
|
557
|
+
}, this.state.contentValue);
|
|
558
|
+
} else {
|
|
559
|
+
displayValue = this.state.contentValue;
|
|
560
|
+
}
|
|
561
|
+
} else {
|
|
562
|
+
displayValue = this.state.contentValue;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
return displayValue;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
}
|