@gridsuite/commons-ui 0.31.0 → 0.32.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/components/AuthenticationRouter/AuthenticationRouter.js +7 -22
- package/lib/components/AuthenticationRouter/index.js +0 -4
- package/lib/components/CardErrorBoundary/card-error-boundary.js +13 -39
- package/lib/components/CardErrorBoundary/index.js +0 -4
- package/lib/components/ElementSearchDialog/element-search-dialog.js +18 -29
- package/lib/components/ElementSearchDialog/equipment-item.js +12 -22
- package/lib/components/ElementSearchDialog/index.js +0 -5
- package/lib/components/ElementSearchDialog/tag-renderer.js +8 -13
- package/lib/components/FlatParameters/FlatParameters.js +312 -0
- package/lib/components/FlatParameters/index.js +8 -0
- package/lib/components/Login/Login.js +2 -17
- package/lib/components/Login/Logout.js +2 -17
- package/lib/components/Login/index.js +0 -4
- package/lib/components/MuiVirtualizedTable/ColumnHeader.js +18 -32
- package/lib/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +104 -153
- package/lib/components/MuiVirtualizedTable/MuiVirtualizedTable.js +63 -189
- package/lib/components/MuiVirtualizedTable/index.js +0 -5
- package/lib/components/OverflowableText/index.js +0 -4
- package/lib/components/OverflowableText/overflowable-text.js +15 -25
- package/lib/components/ReportViewer/index.js +0 -4
- package/lib/components/ReportViewer/log-report-item.js +11 -22
- package/lib/components/ReportViewer/log-report.js +0 -17
- package/lib/components/ReportViewer/log-table.js +7 -28
- package/lib/components/ReportViewer/report-item.js +9 -22
- package/lib/components/ReportViewer/report-tree-view-context.js +1 -4
- package/lib/components/ReportViewer/report-viewer.js +18 -47
- package/lib/components/ReportViewerDialog/index.js +0 -4
- package/lib/components/ReportViewerDialog/report-viewer-dialog.js +6 -25
- package/lib/components/SignInCallbackHandler/SignInCallbackHandler.js +2 -6
- package/lib/components/SignInCallbackHandler/index.js +0 -4
- package/lib/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +2 -6
- package/lib/components/SilentRenewCallbackHandler/index.js +0 -4
- package/lib/components/SnackbarProvider/SnackbarProvider.js +6 -10
- package/lib/components/SnackbarProvider/index.js +0 -4
- package/lib/components/TopBar/TopBar.js +38 -101
- package/lib/components/TopBar/index.js +0 -4
- package/lib/components/TreeViewFinder/TreeViewFinder.js +73 -84
- package/lib/components/TreeViewFinder/index.js +0 -4
- package/lib/components/translations/card-error-boundary-en.js +1 -1
- package/lib/components/translations/card-error-boundary-fr.js +1 -1
- package/lib/components/translations/element-search-en.js +1 -1
- package/lib/components/translations/element-search-fr.js +1 -1
- package/lib/components/translations/equipment-search-en.js +1 -1
- package/lib/components/translations/equipment-search-fr.js +2 -2
- package/lib/components/translations/login-en.js +1 -1
- package/lib/components/translations/login-fr.js +1 -1
- package/lib/components/translations/report-viewer-en.js +1 -1
- package/lib/components/translations/report-viewer-fr.js +1 -1
- package/lib/components/translations/table-en.js +1 -1
- package/lib/components/translations/table-fr.js +1 -1
- package/lib/components/translations/top-bar-en.js +1 -1
- package/lib/components/translations/top-bar-fr.js +2 -2
- package/lib/components/translations/treeview-finder-en.js +1 -1
- package/lib/components/translations/treeview-finder-fr.js +1 -1
- package/lib/hooks/useImportExportParams.js +126 -168
- package/lib/hooks/useIntlRef.js +1 -3
- package/lib/hooks/useSnackMessage.js +5 -18
- package/lib/index.js +5 -76
- package/lib/utils/AuthService.js +14 -49
- package/lib/utils/ElementType.js +5 -15
- package/lib/utils/EquipmentType.js +3 -7
- package/lib/utils/UserManagerMock.js +8 -23
- package/lib/utils/actions.js +1 -14
- package/lib/utils/algos.js +13 -7
- package/package.json +5 -2
|
@@ -2,70 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = exports.DEFAULT_ROW_HEIGHT = exports.DEFAULT_HEADER_HEIGHT = exports.DEFAULT_CELL_PADDING = void 0;
|
|
5
|
-
|
|
6
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
-
|
|
8
6
|
var _reactIntl = require("react-intl");
|
|
9
|
-
|
|
10
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
8
|
var _clsx3 = _interopRequireDefault(require("clsx"));
|
|
13
|
-
|
|
14
9
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
15
|
-
|
|
16
10
|
var _material = require("@mui/material");
|
|
17
|
-
|
|
18
11
|
var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
|
|
19
|
-
|
|
20
12
|
var _GetApp = _interopRequireDefault(require("@mui/icons-material/GetApp"));
|
|
21
|
-
|
|
22
13
|
var _reactVirtualized = require("react-virtualized");
|
|
23
|
-
|
|
24
14
|
var _reactCsvDownloader = _interopRequireDefault(require("react-csv-downloader"));
|
|
25
|
-
|
|
26
15
|
var _overflowableText = _interopRequireDefault(require("../OverflowableText/overflowable-text"));
|
|
27
|
-
|
|
28
16
|
var _KeyedColumnsRowIndexer = require("./KeyedColumnsRowIndexer");
|
|
29
|
-
|
|
30
17
|
var _ColumnHeader = _interopRequireDefault(require("./ColumnHeader"));
|
|
31
|
-
|
|
32
18
|
var _excluded = ["sort"],
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
_excluded2 = ["dataKey"];
|
|
35
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
36
|
-
|
|
37
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
38
|
-
|
|
39
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
40
|
-
|
|
41
23
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
42
|
-
|
|
43
24
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
44
|
-
|
|
45
25
|
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); }
|
|
46
|
-
|
|
47
|
-
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; }
|
|
48
|
-
|
|
26
|
+
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; }
|
|
49
27
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
50
|
-
|
|
51
28
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
52
|
-
|
|
53
29
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
54
|
-
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
58
|
-
|
|
30
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
32
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
33
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
|
|
34
|
+
* Copyright (c) 2022, RTE (http://www.rte-france.com)
|
|
35
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
36
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
37
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
38
|
+
*/ /**
|
|
39
|
+
* This class has been taken from 'Virtualized Table' example at https://material-ui.com/components/tables/
|
|
40
|
+
*/
|
|
59
41
|
function getTextWidth(text) {
|
|
60
42
|
// re-use canvas object for better performance
|
|
61
43
|
var canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement('canvas'));
|
|
62
|
-
var context = canvas.getContext('2d');
|
|
63
|
-
|
|
44
|
+
var context = canvas.getContext('2d');
|
|
45
|
+
// TODO find a better way to find Material UI style
|
|
64
46
|
context.font = '14px "Roboto", "Helvetica", "Arial", sans-serif';
|
|
65
47
|
var metrics = context.measureText(text);
|
|
66
48
|
return metrics.width;
|
|
67
49
|
}
|
|
68
|
-
|
|
69
50
|
var DEFAULT_CELL_PADDING = 16;
|
|
70
51
|
exports.DEFAULT_CELL_PADDING = DEFAULT_CELL_PADDING;
|
|
71
52
|
var DEFAULT_HEADER_HEIGHT = 48;
|
|
@@ -107,13 +88,12 @@ var defaultStyles = {
|
|
|
107
88
|
fontSize: '0.9rem'
|
|
108
89
|
}
|
|
109
90
|
};
|
|
110
|
-
|
|
111
91
|
var AmongChooser = function AmongChooser(props) {
|
|
112
92
|
var options = props.options,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
93
|
+
value = props.value,
|
|
94
|
+
setValue = props.setValue,
|
|
95
|
+
id = props.id,
|
|
96
|
+
onDropDownVisibility = props.onDropDownVisibility;
|
|
117
97
|
return /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_material.Autocomplete, {
|
|
118
98
|
id: id,
|
|
119
99
|
value: value !== null && value !== void 0 ? value : [],
|
|
@@ -146,7 +126,6 @@ var AmongChooser = function AmongChooser(props) {
|
|
|
146
126
|
}
|
|
147
127
|
}));
|
|
148
128
|
};
|
|
149
|
-
|
|
150
129
|
function makeIndexRecord(viewIndexToModel, rows) {
|
|
151
130
|
return {
|
|
152
131
|
viewIndexToModel: viewIndexToModel,
|
|
@@ -156,44 +135,39 @@ function makeIndexRecord(viewIndexToModel, rows) {
|
|
|
156
135
|
if (viewIndex >= viewIndexToModel.length || viewIndex < 0) {
|
|
157
136
|
return {};
|
|
158
137
|
}
|
|
159
|
-
|
|
160
138
|
var modelIndex = viewIndexToModel[viewIndex];
|
|
161
139
|
return rows[modelIndex];
|
|
162
140
|
}
|
|
163
141
|
};
|
|
164
142
|
}
|
|
165
|
-
|
|
166
143
|
var initIndexer = function initIndexer(props, oldProps, versionSetter) {
|
|
167
144
|
if (!props.sortable) {
|
|
168
145
|
return null;
|
|
169
146
|
}
|
|
170
|
-
|
|
171
147
|
if (props.indexer) {
|
|
172
148
|
return props.indexer;
|
|
173
149
|
}
|
|
174
|
-
|
|
175
150
|
return new _KeyedColumnsRowIndexer.KeyedColumnsRowIndexer(true, true, null, versionSetter);
|
|
176
151
|
};
|
|
177
|
-
|
|
178
152
|
var preFilterData = (0, _memoizeOne["default"])(function (columns, rows, filterFromProps, indexer, filterVersion // filterVersion is unused directly, used only as a workaround just to reset the memoization
|
|
179
153
|
) {
|
|
180
154
|
return indexer.preFilterRowMapping(columns, rows, filterFromProps);
|
|
181
155
|
});
|
|
182
156
|
var reorderIndex = (0, _memoizeOne["default"])(function (indexer, indirectionVersion, rows, columns, filterFromProps, sortFromProps) {
|
|
183
|
-
if (!rows)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
157
|
+
if (!rows) {
|
|
158
|
+
return {
|
|
159
|
+
viewIndexToModel: [],
|
|
160
|
+
rowGetter: function rowGetter(viewIndex) {
|
|
161
|
+
return viewIndex;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
189
165
|
var highestCodedColumn = !indexer ? 0 : indexer.highestCodedColumn(columns);
|
|
190
|
-
|
|
191
166
|
if (sortFromProps && highestCodedColumn) {
|
|
192
167
|
var colIdx = Math.abs(highestCodedColumn) - 1;
|
|
193
168
|
var reorderedIndex = sortFromProps(columns[colIdx].dataKey, highestCodedColumn > 0, !!columns[colIdx].numeric);
|
|
194
169
|
return makeIndexRecord(reorderedIndex, rows);
|
|
195
170
|
}
|
|
196
|
-
|
|
197
171
|
if (sortFromProps) {
|
|
198
172
|
try {
|
|
199
173
|
var viewIndexToModel = sortFromProps(null, false, false);
|
|
@@ -204,52 +178,40 @@ var reorderIndex = (0, _memoizeOne["default"])(function (indexer, indirectionVer
|
|
|
204
178
|
console.warn('error in external sort. consider adding support for datakey=null in your external sort function');
|
|
205
179
|
}
|
|
206
180
|
}
|
|
207
|
-
|
|
208
181
|
if (indexer) {
|
|
209
182
|
var prefiltered = preFilterData(columns, rows, filterFromProps, indexer, indirectionVersion);
|
|
210
|
-
|
|
211
183
|
var _reorderedIndex = indexer.makeGroupAndSortIndirector(prefiltered, columns);
|
|
212
|
-
|
|
213
184
|
return makeIndexRecord(_reorderedIndex, rows);
|
|
214
185
|
}
|
|
215
|
-
|
|
216
186
|
if (filterFromProps) {
|
|
217
187
|
var _viewIndexToModel = rows.map(function (r, i) {
|
|
218
188
|
return [r, i];
|
|
219
189
|
}).filter(function (_ref) {
|
|
220
190
|
var r = _ref[0],
|
|
221
|
-
|
|
191
|
+
idx = _ref[1];
|
|
222
192
|
return filterFromProps(r);
|
|
223
193
|
}).map(function (_ref2) {
|
|
224
194
|
var r = _ref2[0],
|
|
225
|
-
|
|
195
|
+
j = _ref2[1];
|
|
226
196
|
return j;
|
|
227
197
|
});
|
|
228
|
-
|
|
229
198
|
return makeIndexRecord(_viewIndexToModel, rows);
|
|
230
199
|
}
|
|
231
|
-
|
|
232
200
|
return makeIndexRecord(null, rows);
|
|
233
201
|
});
|
|
234
|
-
|
|
235
202
|
var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
236
203
|
_inheritsLoose(MuiVirtualizedTable, _React$PureComponent);
|
|
237
|
-
|
|
238
204
|
function MuiVirtualizedTable(props, context) {
|
|
239
205
|
var _this;
|
|
240
|
-
|
|
241
206
|
_this = _React$PureComponent.call(this, props, context) || this;
|
|
242
|
-
|
|
243
207
|
_defineProperty(_assertThisInitialized(_this), "setVersion", function (v) {
|
|
244
208
|
_this.setState({
|
|
245
209
|
indirectionVersion: v
|
|
246
210
|
});
|
|
247
211
|
});
|
|
248
|
-
|
|
249
212
|
_defineProperty(_assertThisInitialized(_this), "computeDataWidth", function (text) {
|
|
250
213
|
return getTextWidth(text || '') + 2 * DEFAULT_CELL_PADDING;
|
|
251
214
|
});
|
|
252
|
-
|
|
253
215
|
_defineProperty(_assertThisInitialized(_this), "sizes", (0, _memoizeOne["default"])(function (columns, rows, rowGetter) {
|
|
254
216
|
var sizes = {};
|
|
255
217
|
columns.forEach(function (col) {
|
|
@@ -261,52 +223,42 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
261
223
|
*/
|
|
262
224
|
var size = Math.max(col.minWidth || 0, _this.computeDataWidth(col.label));
|
|
263
225
|
/* calculate for each row the width, and keep the max */
|
|
264
|
-
|
|
265
226
|
for (var i = 0; i < rows.length; ++i) {
|
|
266
227
|
var gotRow = rowGetter(i);
|
|
267
|
-
|
|
268
228
|
var text = _this.getDisplayValue(col, gotRow[col.dataKey]);
|
|
269
|
-
|
|
270
229
|
size = Math.max(size, _this.computeDataWidth(text));
|
|
271
230
|
}
|
|
272
|
-
|
|
273
|
-
|
|
231
|
+
if (col.maxWidth) {
|
|
232
|
+
size = Math.min(col.maxWidth, size);
|
|
233
|
+
}
|
|
274
234
|
sizes[col.dataKey] = Math.ceil(size);
|
|
275
235
|
}
|
|
276
236
|
});
|
|
277
237
|
return sizes;
|
|
278
238
|
}));
|
|
279
|
-
|
|
280
239
|
_defineProperty(_assertThisInitialized(_this), "openPopover", function (popoverTarget, colKey) {
|
|
281
240
|
var col = _this.props.columns.find(function (c) {
|
|
282
241
|
return c.dataKey === colKey;
|
|
283
242
|
});
|
|
284
|
-
|
|
285
243
|
if ((0, _KeyedColumnsRowIndexer.getHelper)(col) !== _KeyedColumnsRowIndexer.collectibleHelper) {
|
|
286
244
|
return;
|
|
287
245
|
}
|
|
288
|
-
|
|
289
246
|
_this.dropDownVisible = false;
|
|
290
|
-
|
|
291
247
|
_this.setState({
|
|
292
248
|
popoverAnchorEl: popoverTarget,
|
|
293
249
|
popoverColKey: colKey
|
|
294
250
|
});
|
|
295
251
|
});
|
|
296
|
-
|
|
297
252
|
_defineProperty(_assertThisInitialized(_this), "handleKeyDownOnPopover", function (evt) {
|
|
298
253
|
if (evt.key === 'Enter' && !_this.dropDownVisible) {
|
|
299
254
|
_this.closePopover(evt, 'enterKeyDown');
|
|
300
255
|
}
|
|
301
256
|
});
|
|
302
|
-
|
|
303
257
|
_defineProperty(_assertThisInitialized(_this), "closePopover", function (evt, reason) {
|
|
304
258
|
var bumpsVersion = false;
|
|
305
|
-
|
|
306
259
|
if (reason === 'backdropClick' || reason === 'enterKeyDown') {
|
|
307
260
|
bumpsVersion = _this._commitFilterChange();
|
|
308
261
|
}
|
|
309
|
-
|
|
310
262
|
_this.setState(function (state, props) {
|
|
311
263
|
return {
|
|
312
264
|
popoverAnchorEl: null,
|
|
@@ -316,46 +268,34 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
316
268
|
};
|
|
317
269
|
});
|
|
318
270
|
});
|
|
319
|
-
|
|
320
271
|
_defineProperty(_assertThisInitialized(_this), "makeColumnFilterEditor", function () {
|
|
321
272
|
var _prefiltered$colsStat, _col$label;
|
|
322
|
-
|
|
323
273
|
var colKey = _this.state.popoverColKey;
|
|
324
|
-
|
|
325
274
|
var outerParams = _this.state.indexer.getColFilterOuterParams(colKey);
|
|
326
|
-
|
|
327
275
|
var userParams = !_this.props.defersFilterChanges || !_this.state.deferredFilterChange ? _this.state.indexer.getColFilterUserParams(colKey) : _this.state.deferredFilterChange.newVal;
|
|
328
276
|
var prefiltered = preFilterData(_this.props.columns, _this.props.rows, _this.props.filter, _this.state.indexer, _this.state.indirectionVersion);
|
|
329
277
|
var options = [];
|
|
330
|
-
|
|
331
278
|
if (outerParams) {
|
|
332
279
|
options.push.apply(options, outerParams);
|
|
333
280
|
}
|
|
334
|
-
|
|
335
281
|
var colStat = prefiltered === null || prefiltered === void 0 ? void 0 : (_prefiltered$colsStat = prefiltered.colsStats) === null || _prefiltered$colsStat === void 0 ? void 0 : _prefiltered$colsStat[colKey];
|
|
336
|
-
|
|
337
282
|
if (colStat === null || colStat === void 0 ? void 0 : colStat.seen) {
|
|
338
283
|
var _loop = function _loop() {
|
|
339
284
|
var key = _step.value;
|
|
340
|
-
|
|
341
285
|
if (options.findIndex(function (o) {
|
|
342
286
|
return o === key;
|
|
343
287
|
}) < 0) {
|
|
344
288
|
options.push(key);
|
|
345
289
|
}
|
|
346
290
|
};
|
|
347
|
-
|
|
348
291
|
for (var _iterator = _createForOfIteratorHelperLoose(Object.getOwnPropertyNames(colStat.seen)), _step; !(_step = _iterator()).done;) {
|
|
349
292
|
_loop();
|
|
350
293
|
}
|
|
351
294
|
}
|
|
352
|
-
|
|
353
295
|
options.sort();
|
|
354
|
-
|
|
355
296
|
var col = _this.props.columns.find(function (c) {
|
|
356
297
|
return c.dataKey === colKey;
|
|
357
298
|
});
|
|
358
|
-
|
|
359
299
|
return /*#__PURE__*/_react["default"].createElement(AmongChooser, {
|
|
360
300
|
options: options,
|
|
361
301
|
value: userParams,
|
|
@@ -370,37 +310,27 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
370
310
|
}
|
|
371
311
|
});
|
|
372
312
|
});
|
|
373
|
-
|
|
374
313
|
_defineProperty(_assertThisInitialized(_this), "_commitFilterChange", function () {
|
|
375
314
|
if (_this.state.deferredFilterChange) {
|
|
376
315
|
var _newVal;
|
|
377
|
-
|
|
378
316
|
var colKey = _this.state.deferredFilterChange.colKey;
|
|
379
317
|
var newVal = _this.state.deferredFilterChange.newVal;
|
|
380
|
-
|
|
381
318
|
if (((_newVal = newVal) === null || _newVal === void 0 ? void 0 : _newVal.length) === 0) {
|
|
382
319
|
newVal = null;
|
|
383
320
|
}
|
|
384
|
-
|
|
385
321
|
if (_this.state.indexer.setColFilterUserParams(colKey, newVal)) {
|
|
386
322
|
return true;
|
|
387
323
|
}
|
|
388
324
|
}
|
|
389
|
-
|
|
390
325
|
return false;
|
|
391
326
|
});
|
|
392
|
-
|
|
393
327
|
_defineProperty(_assertThisInitialized(_this), "sortClickHandler", function (evt, name, columnIndex) {
|
|
394
328
|
var colKey = _this.props.columns[columnIndex].dataKey;
|
|
395
|
-
|
|
396
329
|
if (evt.altKey) {
|
|
397
330
|
_this.openPopover(evt.target, colKey);
|
|
398
|
-
|
|
399
331
|
return;
|
|
400
332
|
}
|
|
401
|
-
|
|
402
333
|
var way = _KeyedColumnsRowIndexer.CHANGE_WAYS.SIMPLE;
|
|
403
|
-
|
|
404
334
|
if (evt.ctrlKey && evt.shiftKey) {
|
|
405
335
|
way = _KeyedColumnsRowIndexer.CHANGE_WAYS.AMEND;
|
|
406
336
|
} else if (evt.ctrlKey) {
|
|
@@ -408,29 +338,23 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
408
338
|
} else if (evt.shiftKey) {
|
|
409
339
|
way = _KeyedColumnsRowIndexer.CHANGE_WAYS.TAIL;
|
|
410
340
|
}
|
|
411
|
-
|
|
412
341
|
if (_this.state.indexer.updateSortingFromUser(colKey, way)) {
|
|
413
342
|
_this.setState({
|
|
414
343
|
indirectionVersion: _this.state.indirectionVersion + 1
|
|
415
344
|
});
|
|
416
345
|
}
|
|
417
346
|
});
|
|
418
|
-
|
|
419
347
|
_defineProperty(_assertThisInitialized(_this), "filterClickHandler", function (evt, target, columnIndex) {
|
|
420
348
|
var _target$parentNode;
|
|
421
|
-
|
|
422
349
|
// ColumnHeader to (header) TableCell
|
|
423
350
|
var retargeted = (_target$parentNode = target.parentNode) !== null && _target$parentNode !== void 0 ? _target$parentNode : target;
|
|
424
351
|
var colKey = _this.props.columns[columnIndex].dataKey;
|
|
425
|
-
|
|
426
352
|
_this.openPopover(retargeted, colKey);
|
|
427
353
|
});
|
|
428
|
-
|
|
429
354
|
_defineProperty(_assertThisInitialized(_this), "sortableHeader", function (_ref3) {
|
|
430
355
|
var _prefiltered$colsStat2;
|
|
431
|
-
|
|
432
356
|
var label = _ref3.label,
|
|
433
|
-
|
|
357
|
+
columnIndex = _ref3.columnIndex;
|
|
434
358
|
var columns = _this.props.columns;
|
|
435
359
|
var indexer = _this.state.indexer;
|
|
436
360
|
var colKey = columns[columnIndex].dataKey;
|
|
@@ -440,18 +364,17 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
440
364
|
var prefiltered = preFilterData(columns, _this.props.rows, _this.props.filter, indexer, indexer.filterVersion);
|
|
441
365
|
var colStat = prefiltered === null || prefiltered === void 0 ? void 0 : (_prefiltered$colsStat2 = prefiltered.colsStats) === null || _prefiltered$colsStat2 === void 0 ? void 0 : _prefiltered$colsStat2[colKey];
|
|
442
366
|
var filterLevel = 0;
|
|
443
|
-
|
|
444
367
|
if (colStat === null || colStat === void 0 ? void 0 : colStat.seen) {
|
|
445
368
|
var countSeen = Object.getOwnPropertyNames(colStat.seen).length;
|
|
446
369
|
var userSelectedCount = userParams === null || userParams === void 0 ? void 0 : userParams.length;
|
|
447
370
|
filterLevel += userSelectedCount ? 1 : 0;
|
|
448
371
|
filterLevel += userSelectedCount >= countSeen ? 2 : 0;
|
|
449
|
-
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// disable filtering when either:
|
|
450
375
|
// - the column is numeric, we only handle tags for string values
|
|
451
376
|
// - a cellRenderer is defined, as we have no simple way to match for chosen value(s)
|
|
452
377
|
// - using an external sort, because it would hardly know about the indexer filtering
|
|
453
|
-
|
|
454
|
-
|
|
455
378
|
var onFilterClick = numeric || _this.props.sort || columns[columnIndex].cellRenderer ? undefined : function (ev, retargeted) {
|
|
456
379
|
_this.filterClickHandler(ev, retargeted, columnIndex);
|
|
457
380
|
};
|
|
@@ -469,7 +392,6 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
469
392
|
onFilterClick: onFilterClick
|
|
470
393
|
});
|
|
471
394
|
});
|
|
472
|
-
|
|
473
395
|
_defineProperty(_assertThisInitialized(_this), "simpleHeaderRenderer", function (_ref4) {
|
|
474
396
|
var label = _ref4.label;
|
|
475
397
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -478,41 +400,33 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
478
400
|
}
|
|
479
401
|
}, label);
|
|
480
402
|
});
|
|
481
|
-
|
|
482
403
|
_defineProperty(_assertThisInitialized(_this), "getRowClassName", function (_ref5) {
|
|
483
404
|
var _rowGetter, _rowGetter2, _clsx;
|
|
484
|
-
|
|
485
405
|
var index = _ref5.index,
|
|
486
|
-
|
|
406
|
+
rowGetter = _ref5.rowGetter;
|
|
487
407
|
var _this$props = _this.props,
|
|
488
|
-
|
|
489
|
-
|
|
408
|
+
classes = _this$props.classes,
|
|
409
|
+
onRowClick = _this$props.onRowClick;
|
|
490
410
|
return (0, _clsx3["default"])(classes.tableRow, classes.flexContainer, index % 2 === 0 && classes.rowBackgroundDark, index % 2 !== 0 && classes.rowBackgroundLight, ((_rowGetter = rowGetter(index)) === null || _rowGetter === void 0 ? void 0 : _rowGetter.notClickable) === true && classes.noClick, (_clsx = {}, _clsx[classes.tableRowHover] = index !== -1 && onRowClick != null && !(((_rowGetter2 = rowGetter(index)) === null || _rowGetter2 === void 0 ? void 0 : _rowGetter2.notClickable) === true), _clsx));
|
|
491
411
|
});
|
|
492
|
-
|
|
493
412
|
_defineProperty(_assertThisInitialized(_this), "onClickableRowClick", function (event) {
|
|
494
413
|
var _event$rowData;
|
|
495
|
-
|
|
496
414
|
if (!(((_event$rowData = event.rowData) === null || _event$rowData === void 0 ? void 0 : _event$rowData.notClickable) === true)) {
|
|
497
415
|
_this.props.onRowClick(event);
|
|
498
416
|
}
|
|
499
417
|
});
|
|
500
|
-
|
|
501
418
|
_defineProperty(_assertThisInitialized(_this), "cellRenderer", function (_ref6) {
|
|
502
419
|
var _rows$rowIndex, _rows$rowIndex2, _clsx2;
|
|
503
|
-
|
|
504
420
|
var cellData = _ref6.cellData,
|
|
505
|
-
|
|
506
|
-
|
|
421
|
+
columnIndex = _ref6.columnIndex,
|
|
422
|
+
rowIndex = _ref6.rowIndex;
|
|
507
423
|
var _this$props2 = _this.props,
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
424
|
+
columns = _this$props2.columns,
|
|
425
|
+
classes = _this$props2.classes,
|
|
426
|
+
rowHeight = _this$props2.rowHeight,
|
|
427
|
+
onCellClick = _this$props2.onCellClick,
|
|
428
|
+
rows = _this$props2.rows;
|
|
514
429
|
var displayedValue = _this.getDisplayValue(columns[columnIndex], cellData);
|
|
515
|
-
|
|
516
430
|
return /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
517
431
|
component: "div",
|
|
518
432
|
className: (0, _clsx3["default"])(classes.tableCell, classes.flexContainer, (_clsx2 = {}, _clsx2[classes.noClick] = displayedValue === undefined || ((_rows$rowIndex = rows[rowIndex]) === null || _rows$rowIndex === void 0 ? void 0 : _rows$rowIndex.notClickable) === true || onCellClick == null || columns[columnIndex].clickable === undefined || !columns[columnIndex].clickable, _clsx2[classes.tableCellColor] = displayedValue === undefined || onCellClick !== null && !((_rows$rowIndex2 = rows[rowIndex]) === null || _rows$rowIndex2 === void 0 ? void 0 : _rows$rowIndex2.notClickable) === true && columns[columnIndex].clickable !== undefined && columns[columnIndex].clickable, _clsx2)),
|
|
@@ -524,7 +438,6 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
524
438
|
align: columnIndex != null && columns[columnIndex].numeric || false ? 'right' : 'left',
|
|
525
439
|
onClick: function onClick() {
|
|
526
440
|
var _rows$rowIndex3;
|
|
527
|
-
|
|
528
441
|
if (onCellClick && columns[columnIndex].clickable !== undefined && !((_rows$rowIndex3 = rows[rowIndex]) === null || _rows$rowIndex3 === void 0 ? void 0 : _rows$rowIndex3.notClickable) === true && columns[columnIndex].clickable) {
|
|
529
442
|
onCellClick(rows[rowIndex], columns[columnIndex]);
|
|
530
443
|
}
|
|
@@ -534,14 +447,11 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
534
447
|
tooltipStyle: classes.cellTooltip
|
|
535
448
|
}));
|
|
536
449
|
});
|
|
537
|
-
|
|
538
450
|
_defineProperty(_assertThisInitialized(_this), "makeSizedTable", function (height, width, sizes, reorderedIndex, _rowGetter3) {
|
|
539
451
|
var _reorderedIndex$lengt;
|
|
540
|
-
|
|
541
452
|
var _this$props3 = _this.props,
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
453
|
+
sort = _this$props3.sort,
|
|
454
|
+
otherProps = _objectWithoutPropertiesLoose(_this$props3, _excluded);
|
|
545
455
|
return /*#__PURE__*/_react["default"].createElement(_reactVirtualized.Table, _extends({}, otherProps, {
|
|
546
456
|
height: height,
|
|
547
457
|
width: width,
|
|
@@ -551,8 +461,7 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
551
461
|
},
|
|
552
462
|
headerHeight: _this.state.headerHeight,
|
|
553
463
|
className: otherProps.classes.table,
|
|
554
|
-
onRowClick: _this.props.onRowClick &&
|
|
555
|
-
/* The {...otherProps} just above would hold the slot onRowClick */
|
|
464
|
+
onRowClick: _this.props.onRowClick && /* The {...otherProps} just above would hold the slot onRowClick */
|
|
556
465
|
_this.onClickableRowClick,
|
|
557
466
|
rowCount: (_reorderedIndex$lengt = reorderedIndex === null || reorderedIndex === void 0 ? void 0 : reorderedIndex.length) !== null && _reorderedIndex$lengt !== void 0 ? _reorderedIndex$lengt : otherProps.rows.length,
|
|
558
467
|
rowClassName: function rowClassName(_ref7) {
|
|
@@ -568,8 +477,7 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
568
477
|
}
|
|
569
478
|
}), otherProps.columns.map(function (_ref9, index) {
|
|
570
479
|
var dataKey = _ref9.dataKey,
|
|
571
|
-
|
|
572
|
-
|
|
480
|
+
other = _objectWithoutPropertiesLoose(_ref9, _excluded2);
|
|
573
481
|
return /*#__PURE__*/_react["default"].createElement(_reactVirtualized.Column, _extends({
|
|
574
482
|
key: dataKey,
|
|
575
483
|
headerRenderer: _this.makeHeaderRenderer(dataKey, index),
|
|
@@ -581,10 +489,8 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
581
489
|
}, other));
|
|
582
490
|
}));
|
|
583
491
|
});
|
|
584
|
-
|
|
585
492
|
_defineProperty(_assertThisInitialized(_this), "getCSVFilename", function () {
|
|
586
493
|
var _this$props$name;
|
|
587
|
-
|
|
588
494
|
if (((_this$props$name = _this.props.name) === null || _this$props$name === void 0 ? void 0 : _this$props$name.length) > 0) {
|
|
589
495
|
return _this.props.name.replace(/\s/g, '_');
|
|
590
496
|
} else {
|
|
@@ -594,19 +500,15 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
594
500
|
return filename;
|
|
595
501
|
}
|
|
596
502
|
});
|
|
597
|
-
|
|
598
503
|
_defineProperty(_assertThisInitialized(_this), "getCSVData", function () {
|
|
599
504
|
var _reorderedIndex$viewI, _reorderedIndex$viewI2;
|
|
600
|
-
|
|
601
505
|
var reorderedIndex = reorderIndex(_this.state.indexer, _this.state.indirectionVersion, _this.props.rows, _this.props.columns, _this.props.filter, _this.props.sort);
|
|
602
506
|
var rowsCount = (_reorderedIndex$viewI = (_reorderedIndex$viewI2 = reorderedIndex.viewIndexToModel) === null || _reorderedIndex$viewI2 === void 0 ? void 0 : _reorderedIndex$viewI2.length) !== null && _reorderedIndex$viewI !== void 0 ? _reorderedIndex$viewI : _this.props.rows.length;
|
|
603
507
|
var csvData = [];
|
|
604
|
-
|
|
605
|
-
var _loop2 = function _loop2(index) {
|
|
508
|
+
var _loop2 = function _loop2() {
|
|
606
509
|
var myobj = {};
|
|
607
510
|
var sortedRow = reorderedIndex.rowGetter(index);
|
|
608
511
|
var exportedKeys = _this.props.exportCSVDataKeys;
|
|
609
|
-
|
|
610
512
|
_this.props.columns.forEach(function (col) {
|
|
611
513
|
if (exportedKeys === null || exportedKeys === void 0 ? void 0 : exportedKeys.find(function (el) {
|
|
612
514
|
return el === col.dataKey;
|
|
@@ -614,17 +516,13 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
614
516
|
myobj[col.dataKey] = sortedRow[col.dataKey];
|
|
615
517
|
}
|
|
616
518
|
});
|
|
617
|
-
|
|
618
519
|
csvData.push(myobj);
|
|
619
520
|
};
|
|
620
|
-
|
|
621
521
|
for (var index = 0; index < rowsCount; ++index) {
|
|
622
|
-
_loop2(
|
|
522
|
+
_loop2();
|
|
623
523
|
}
|
|
624
|
-
|
|
625
524
|
return Promise.resolve(csvData);
|
|
626
525
|
});
|
|
627
|
-
|
|
628
526
|
_defineProperty(_assertThisInitialized(_this), "csvHeaders", (0, _memoizeOne["default"])(function (columns, exportCSVDataKeys) {
|
|
629
527
|
var tempHeaders = [];
|
|
630
528
|
columns.forEach(function (col) {
|
|
@@ -639,7 +537,6 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
639
537
|
});
|
|
640
538
|
return tempHeaders;
|
|
641
539
|
}));
|
|
642
|
-
|
|
643
540
|
_this._computeHeaderSize = _this._computeHeaderSize.bind(_assertThisInitialized(_this));
|
|
644
541
|
_this._registerHeader = _this._registerHeader.bind(_assertThisInitialized(_this));
|
|
645
542
|
_this._registerObserver = _this._registerObserver.bind(_assertThisInitialized(_this));
|
|
@@ -661,52 +558,41 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
661
558
|
};
|
|
662
559
|
return _this;
|
|
663
560
|
}
|
|
664
|
-
|
|
665
561
|
var _proto = MuiVirtualizedTable.prototype;
|
|
666
|
-
|
|
667
562
|
_proto.componentDidUpdate = function componentDidUpdate(oldProps) {
|
|
668
563
|
var _this2 = this;
|
|
669
|
-
|
|
670
564
|
if (oldProps.indexer !== this.props.indexer || oldProps.sortable !== this.props.sortable) {
|
|
671
565
|
this.setState(function (state) {
|
|
672
566
|
var _state$indirectionVer;
|
|
673
|
-
|
|
674
567
|
return {
|
|
675
568
|
indexer: initIndexer(_this2.props, oldProps, _this2.setVersion),
|
|
676
569
|
indirectionVersion: ((_state$indirectionVer = state === null || state === void 0 ? void 0 : state.indirectionVersion) !== null && _state$indirectionVer !== void 0 ? _state$indirectionVer : 0) + 1
|
|
677
570
|
};
|
|
678
571
|
});
|
|
679
572
|
}
|
|
680
|
-
|
|
681
573
|
if (oldProps.headerHeight !== this.props.headerHeight) {
|
|
682
574
|
this._computeHeaderSize();
|
|
683
575
|
}
|
|
684
576
|
};
|
|
685
|
-
|
|
686
577
|
_proto.componentDidMount = function componentDidMount() {
|
|
687
578
|
window.addEventListener('resize', this._computeHeaderSize);
|
|
688
579
|
};
|
|
689
|
-
|
|
690
580
|
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
691
581
|
window.removeEventListener('resize', this._computeHeaderSize);
|
|
692
582
|
this.observer.disconnect();
|
|
693
583
|
};
|
|
694
|
-
|
|
695
584
|
_proto._registerHeader = function _registerHeader(label, header) {
|
|
696
585
|
if (header !== null) {
|
|
697
586
|
this.headers.current[label] = header;
|
|
698
587
|
}
|
|
699
588
|
};
|
|
700
|
-
|
|
701
589
|
_proto._registerObserver = function _registerObserver(element) {
|
|
702
590
|
if (element !== null) {
|
|
703
591
|
this.observer.observe(element);
|
|
704
592
|
}
|
|
705
593
|
};
|
|
706
|
-
|
|
707
594
|
_proto.onFilterParamsChange = function onFilterParamsChange(newVal, colKey) {
|
|
708
595
|
var nonEmpty = newVal.length === 0 ? null : newVal;
|
|
709
|
-
|
|
710
596
|
if (this.props.defersFilterChanges) {
|
|
711
597
|
this.setState({
|
|
712
598
|
deferredFilterChange: {
|
|
@@ -720,10 +606,8 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
720
606
|
});
|
|
721
607
|
}
|
|
722
608
|
};
|
|
723
|
-
|
|
724
609
|
_proto.getDisplayValue = function getDisplayValue(column, cellData) {
|
|
725
610
|
var displayedValue;
|
|
726
|
-
|
|
727
611
|
if (!column.numeric) {
|
|
728
612
|
displayedValue = cellData;
|
|
729
613
|
} else if (isNaN(cellData)) {
|
|
@@ -733,25 +617,25 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
733
617
|
} else {
|
|
734
618
|
displayedValue = Number(cellData).toFixed(column.fractionDigits);
|
|
735
619
|
}
|
|
736
|
-
|
|
737
620
|
if (column.unit !== undefined) {
|
|
738
621
|
displayedValue += ' ';
|
|
739
622
|
displayedValue += column.unit;
|
|
740
623
|
}
|
|
741
|
-
|
|
742
624
|
return displayedValue;
|
|
743
625
|
};
|
|
744
|
-
|
|
745
626
|
_proto._computeHeaderSize = function _computeHeaderSize() {
|
|
746
627
|
var headers = Object.values(this.headers.current);
|
|
747
|
-
if (headers.length === 0)
|
|
628
|
+
if (headers.length === 0) {
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
// for now keep 'historical' use of scrollHeight,
|
|
748
632
|
// though it can not make a difference from clientHeight,
|
|
749
633
|
// as overflow-y as no scroll value
|
|
750
|
-
|
|
751
634
|
var scrollHeights = headers.map(function (header) {
|
|
752
635
|
return header.scrollHeight;
|
|
753
636
|
});
|
|
754
|
-
var headerHeight = Math.max(Math.max.apply(Math, scrollHeights) + DEFAULT_CELL_PADDING, this.props.headerHeight
|
|
637
|
+
var headerHeight = Math.max(Math.max.apply(Math, scrollHeights) + DEFAULT_CELL_PADDING, this.props.headerHeight
|
|
638
|
+
// hides (most often) padding override by forcing height
|
|
755
639
|
);
|
|
756
640
|
|
|
757
641
|
if (headerHeight !== this.state.headerHeight) {
|
|
@@ -760,13 +644,11 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
760
644
|
});
|
|
761
645
|
}
|
|
762
646
|
};
|
|
763
|
-
|
|
764
647
|
_proto.makeHeaderRenderer = function makeHeaderRenderer(dataKey, columnIndex) {
|
|
765
648
|
var _this3 = this;
|
|
766
|
-
|
|
767
649
|
var _this$props4 = this.props,
|
|
768
|
-
|
|
769
|
-
|
|
650
|
+
columns = _this$props4.columns,
|
|
651
|
+
classes = _this$props4.classes;
|
|
770
652
|
return function (headerProps) {
|
|
771
653
|
return /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
772
654
|
component: "div",
|
|
@@ -787,14 +669,11 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
787
669
|
})) : _this3.simpleHeaderRenderer(_extends({}, headerProps)));
|
|
788
670
|
};
|
|
789
671
|
};
|
|
790
|
-
|
|
791
672
|
_proto.render = function render() {
|
|
792
673
|
var _this4 = this;
|
|
793
|
-
|
|
794
674
|
var _reorderIndex = reorderIndex(this.state.indexer, this.state.indirectionVersion, this.props.rows, this.props.columns, this.props.filter, this.props.sort),
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
675
|
+
viewIndexToModel = _reorderIndex.viewIndexToModel,
|
|
676
|
+
rowGetter = _reorderIndex.rowGetter;
|
|
798
677
|
var sizes = this.sizes(this.props.columns, this.props.rows, rowGetter);
|
|
799
678
|
var csvHeaders = this.csvHeaders(this.props.columns, this.props.exportCSVDataKeys);
|
|
800
679
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -824,7 +703,7 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
824
703
|
}
|
|
825
704
|
}, /*#__PURE__*/_react["default"].createElement(_reactVirtualized.AutoSizer, null, function (_ref10) {
|
|
826
705
|
var height = _ref10.height,
|
|
827
|
-
|
|
706
|
+
width = _ref10.width;
|
|
828
707
|
return _this4.makeSizedTable(height, width, sizes, viewIndexToModel, rowGetter);
|
|
829
708
|
})), this.state.popoverAnchorEl && /*#__PURE__*/_react["default"].createElement(_material.Popover, {
|
|
830
709
|
anchorEl: this.state.popoverAnchorEl,
|
|
@@ -846,16 +725,13 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
846
725
|
}
|
|
847
726
|
}, this.makeColumnFilterEditor()));
|
|
848
727
|
};
|
|
849
|
-
|
|
850
728
|
return MuiVirtualizedTable;
|
|
851
729
|
}(_react["default"].PureComponent);
|
|
852
|
-
|
|
853
730
|
_defineProperty(MuiVirtualizedTable, "defaultProps", {
|
|
854
731
|
headerHeight: DEFAULT_HEADER_HEIGHT,
|
|
855
732
|
rowHeight: DEFAULT_ROW_HEIGHT,
|
|
856
733
|
enableExportCSV: false
|
|
857
734
|
});
|
|
858
|
-
|
|
859
735
|
MuiVirtualizedTable.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
860
736
|
name: _propTypes["default"].string,
|
|
861
737
|
classes: _propTypes["default"].object.isRequired,
|
|
@@ -881,7 +757,5 @@ MuiVirtualizedTable.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
881
757
|
rowHeight: _propTypes["default"].number,
|
|
882
758
|
filter: _propTypes["default"].func
|
|
883
759
|
} : {};
|
|
884
|
-
|
|
885
760
|
var _default = (0, _withStyles["default"])(defaultStyles)(MuiVirtualizedTable);
|
|
886
|
-
|
|
887
761
|
exports["default"] = _default;
|