react-mutation-mapper 0.9.2 → 0.9.4
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/component/StatusHelpers.d.ts +1 -0
- package/dist/component/clinvar/ClinvarSummary.d.ts +1 -0
- package/dist/component/column/MyVariantInfoHelper.d.ts +1 -0
- package/dist/component/filter/ProteinImpactTypeHelper.d.ts +1 -0
- package/dist/component/lollipopPlot/DomainTooltip.d.ts +1 -0
- package/dist/component/mutationTable/MutationColumnHelper.d.ts +1 -0
- package/dist/index.es.js +3905 -31
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3900 -27
- package/dist/index.js.map +1 -1
- package/dist/model/DomainSpec.d.ts +1 -0
- package/dist/model/LollipopSpec.d.ts +1 -0
- package/dist/model/SequenceSpec.d.ts +1 -0
- package/dist/styles.css +3 -3
- package/package.json +16 -17
package/dist/index.js
CHANGED
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var _ = require('lodash');
|
|
6
|
+
var _$1 = require('lodash');
|
|
7
7
|
var mobx = require('mobx');
|
|
8
8
|
var mobxReact = require('mobx-react');
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var cbioportalFrontendCommons = require('cbioportal-frontend-commons');
|
|
11
|
-
var
|
|
11
|
+
var classnames = require('classnames');
|
|
12
12
|
var cbioportalUtils = require('cbioportal-utils');
|
|
13
13
|
var oncokbFrontendCommons = require('oncokb-frontend-commons');
|
|
14
14
|
var genomeNexusTsApiClient = require('genome-nexus-ts-api-client');
|
|
15
15
|
var oncokbTsApiClient = require('oncokb-ts-api-client');
|
|
16
16
|
var autobind = require('autobind-decorator');
|
|
17
|
-
var ReactTable = require('react-table');
|
|
18
17
|
require('rc-tooltip/assets/bootstrap_white.css');
|
|
19
18
|
var Select = require('react-select');
|
|
20
19
|
var $ = require('jquery');
|
|
@@ -48,13 +47,12 @@ function _interopNamespace(e) {
|
|
|
48
47
|
return Object.freeze(n);
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
52
|
-
var ___namespace = /*#__PURE__*/_interopNamespace(_);
|
|
50
|
+
var ___default = /*#__PURE__*/_interopDefaultLegacy(_$1);
|
|
51
|
+
var ___namespace = /*#__PURE__*/_interopNamespace(_$1);
|
|
53
52
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
54
53
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
55
|
-
var
|
|
54
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
56
55
|
var autobind__default = /*#__PURE__*/_interopDefaultLegacy(autobind);
|
|
57
|
-
var ReactTable__default = /*#__PURE__*/_interopDefaultLegacy(ReactTable);
|
|
58
56
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
59
57
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
60
58
|
var numeral__default = /*#__PURE__*/_interopDefaultLegacy(numeral);
|
|
@@ -66,7 +64,7 @@ var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
|
|
|
66
64
|
var annotationStyles = {"annotation-item-load":"annotation-module_annotation-item-load__1pDN0","annotation-item-text":"annotation-module_annotation-item-text__Gy_Jv","annotation-item-error":"annotation-module_annotation-item-error__5BhTo","annotation-item":"annotation-module_annotation-item__2EgnB"};
|
|
67
65
|
|
|
68
66
|
function loaderIcon(className) {
|
|
69
|
-
return (React__namespace.createElement("span", { className:
|
|
67
|
+
return (React__namespace.createElement("span", { className: classnames__default["default"]("".concat(annotationStyles['annotation-item']), "".concat(annotationStyles['annotation-item-load']), className) },
|
|
70
68
|
React__namespace.createElement("i", { className: "fa fa-spinner fa-pulse" })));
|
|
71
69
|
}
|
|
72
70
|
function errorIcon(errorMessage) {
|
|
@@ -1104,6 +1102,3856 @@ function generateGnomadUrl(chromosome, position, reference, variant) {
|
|
|
1104
1102
|
}
|
|
1105
1103
|
}
|
|
1106
1104
|
|
|
1105
|
+
var _extends$4 = Object.assign || 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; };
|
|
1106
|
+
|
|
1107
|
+
function _objectWithoutProperties$1(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
1108
|
+
//
|
|
1109
|
+
var _ = {
|
|
1110
|
+
get: get,
|
|
1111
|
+
set: set,
|
|
1112
|
+
takeRight: takeRight,
|
|
1113
|
+
last: last,
|
|
1114
|
+
orderBy: orderBy,
|
|
1115
|
+
range: range,
|
|
1116
|
+
remove: remove,
|
|
1117
|
+
clone: clone,
|
|
1118
|
+
getFirstDefined: getFirstDefined,
|
|
1119
|
+
sum: sum,
|
|
1120
|
+
makeTemplateComponent: makeTemplateComponent,
|
|
1121
|
+
groupBy: groupBy,
|
|
1122
|
+
isArray: isArray,
|
|
1123
|
+
splitProps: splitProps,
|
|
1124
|
+
compactObject: compactObject,
|
|
1125
|
+
isSortingDesc: isSortingDesc,
|
|
1126
|
+
normalizeComponent: normalizeComponent,
|
|
1127
|
+
asPx: asPx
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
function get(obj, path, def) {
|
|
1131
|
+
if (!path) {
|
|
1132
|
+
return obj;
|
|
1133
|
+
}
|
|
1134
|
+
var pathObj = makePathArray(path);
|
|
1135
|
+
var val = void 0;
|
|
1136
|
+
try {
|
|
1137
|
+
val = pathObj.reduce(function (current, pathPart) {
|
|
1138
|
+
return current[pathPart];
|
|
1139
|
+
}, obj);
|
|
1140
|
+
} catch (e) {
|
|
1141
|
+
// continue regardless of error
|
|
1142
|
+
}
|
|
1143
|
+
return typeof val !== 'undefined' ? val : def;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
function set() {
|
|
1147
|
+
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1148
|
+
var path = arguments[1];
|
|
1149
|
+
var value = arguments[2];
|
|
1150
|
+
|
|
1151
|
+
var keys = makePathArray(path);
|
|
1152
|
+
var keyPart = void 0;
|
|
1153
|
+
var cursor = obj;
|
|
1154
|
+
while ((keyPart = keys.shift()) && keys.length) {
|
|
1155
|
+
if (!cursor[keyPart]) {
|
|
1156
|
+
cursor[keyPart] = {};
|
|
1157
|
+
}
|
|
1158
|
+
cursor = cursor[keyPart];
|
|
1159
|
+
}
|
|
1160
|
+
cursor[keyPart] = value;
|
|
1161
|
+
return obj;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
function takeRight(arr, n) {
|
|
1165
|
+
var start = n > arr.length ? 0 : arr.length - n;
|
|
1166
|
+
return arr.slice(start);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
function last(arr) {
|
|
1170
|
+
return arr[arr.length - 1];
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
function range(n) {
|
|
1174
|
+
var arr = [];
|
|
1175
|
+
for (var i = 0; i < n; i += 1) {
|
|
1176
|
+
arr.push(n);
|
|
1177
|
+
}
|
|
1178
|
+
return arr;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function orderBy(arr, funcs, dirs, indexKey) {
|
|
1182
|
+
return arr.sort(function (rowA, rowB) {
|
|
1183
|
+
for (var i = 0; i < funcs.length; i += 1) {
|
|
1184
|
+
var comp = funcs[i];
|
|
1185
|
+
var desc = dirs[i] === false || dirs[i] === 'desc';
|
|
1186
|
+
var sortInt = comp(rowA, rowB);
|
|
1187
|
+
if (sortInt) {
|
|
1188
|
+
return desc ? -sortInt : sortInt;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
// Use the row index for tie breakers
|
|
1192
|
+
return dirs[0] ? rowA[indexKey] - rowB[indexKey] : rowB[indexKey] - rowA[indexKey];
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
function remove(a, b) {
|
|
1197
|
+
return a.filter(function (o, i) {
|
|
1198
|
+
var r = b(o);
|
|
1199
|
+
if (r) {
|
|
1200
|
+
a.splice(i, 1);
|
|
1201
|
+
return true;
|
|
1202
|
+
}
|
|
1203
|
+
return false;
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
function clone(a) {
|
|
1208
|
+
try {
|
|
1209
|
+
return JSON.parse(JSON.stringify(a, function (key, value) {
|
|
1210
|
+
if (typeof value === 'function') {
|
|
1211
|
+
return value.toString();
|
|
1212
|
+
}
|
|
1213
|
+
return value;
|
|
1214
|
+
}));
|
|
1215
|
+
} catch (e) {
|
|
1216
|
+
return a;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
function getFirstDefined() {
|
|
1221
|
+
for (var i = 0; i < arguments.length; i += 1) {
|
|
1222
|
+
if (typeof (arguments.length <= i ? undefined : arguments[i]) !== 'undefined') {
|
|
1223
|
+
return arguments.length <= i ? undefined : arguments[i];
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
function sum(arr) {
|
|
1229
|
+
return arr.reduce(function (a, b) {
|
|
1230
|
+
return a + b;
|
|
1231
|
+
}, 0);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
function makeTemplateComponent(compClass, displayName) {
|
|
1235
|
+
if (!displayName) {
|
|
1236
|
+
throw new Error('No displayName found for template component:', compClass);
|
|
1237
|
+
}
|
|
1238
|
+
var cmp = function cmp(_ref) {
|
|
1239
|
+
var children = _ref.children,
|
|
1240
|
+
className = _ref.className,
|
|
1241
|
+
rest = _objectWithoutProperties$1(_ref, ['children', 'className']);
|
|
1242
|
+
|
|
1243
|
+
return React__default["default"].createElement(
|
|
1244
|
+
'div',
|
|
1245
|
+
_extends$4({ className: classnames__default["default"](compClass, className) }, rest),
|
|
1246
|
+
children
|
|
1247
|
+
);
|
|
1248
|
+
};
|
|
1249
|
+
cmp.displayName = displayName;
|
|
1250
|
+
return cmp;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
function groupBy(xs, key) {
|
|
1254
|
+
return xs.reduce(function (rv, x, i) {
|
|
1255
|
+
var resKey = typeof key === 'function' ? key(x, i) : x[key];
|
|
1256
|
+
rv[resKey] = isArray(rv[resKey]) ? rv[resKey] : [];
|
|
1257
|
+
rv[resKey].push(x);
|
|
1258
|
+
return rv;
|
|
1259
|
+
}, {});
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
function asPx(value) {
|
|
1263
|
+
value = Number(value);
|
|
1264
|
+
return Number.isNaN(value) ? null : value + 'px';
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
function isArray(a) {
|
|
1268
|
+
return Array.isArray(a);
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
// ########################################################################
|
|
1272
|
+
// Non-exported Helpers
|
|
1273
|
+
// ########################################################################
|
|
1274
|
+
|
|
1275
|
+
function makePathArray(obj) {
|
|
1276
|
+
return flattenDeep(obj).join('.').replace(/\[/g, '.').replace(/\]/g, '').split('.');
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
function flattenDeep(arr) {
|
|
1280
|
+
var newArr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1281
|
+
|
|
1282
|
+
if (!isArray(arr)) {
|
|
1283
|
+
newArr.push(arr);
|
|
1284
|
+
} else {
|
|
1285
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
1286
|
+
flattenDeep(arr[i], newArr);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
return newArr;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
function splitProps(_ref2) {
|
|
1293
|
+
var className = _ref2.className,
|
|
1294
|
+
style = _ref2.style,
|
|
1295
|
+
rest = _objectWithoutProperties$1(_ref2, ['className', 'style']);
|
|
1296
|
+
|
|
1297
|
+
return {
|
|
1298
|
+
className: className,
|
|
1299
|
+
style: style,
|
|
1300
|
+
rest: rest || {}
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
function compactObject(obj) {
|
|
1305
|
+
var newObj = {};
|
|
1306
|
+
if (obj) {
|
|
1307
|
+
Object.keys(obj).map(function (key) {
|
|
1308
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key] !== undefined && typeof obj[key] !== 'undefined') {
|
|
1309
|
+
newObj[key] = obj[key];
|
|
1310
|
+
}
|
|
1311
|
+
return true;
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
return newObj;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
function isSortingDesc(d) {
|
|
1318
|
+
return !!(d.sort === 'desc' || d.desc === true || d.asc === false);
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
function normalizeComponent(Comp) {
|
|
1322
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1323
|
+
var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Comp;
|
|
1324
|
+
|
|
1325
|
+
return typeof Comp === 'function' ? React__default["default"].createElement(Comp, params) : fallback;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
var _createClass$3 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1329
|
+
|
|
1330
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1331
|
+
|
|
1332
|
+
function _possibleConstructorReturn$3(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1333
|
+
|
|
1334
|
+
function _inherits$3(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1335
|
+
|
|
1336
|
+
var Lifecycle = (function (Base) {
|
|
1337
|
+
return function (_Base) {
|
|
1338
|
+
_inherits$3(_class, _Base);
|
|
1339
|
+
|
|
1340
|
+
function _class() {
|
|
1341
|
+
_classCallCheck$3(this, _class);
|
|
1342
|
+
|
|
1343
|
+
return _possibleConstructorReturn$3(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
_createClass$3(_class, [{
|
|
1347
|
+
key: 'componentWillMount',
|
|
1348
|
+
value: function componentWillMount() {
|
|
1349
|
+
this.setStateWithData(this.getDataModel(this.getResolvedState(), true));
|
|
1350
|
+
}
|
|
1351
|
+
}, {
|
|
1352
|
+
key: 'componentDidMount',
|
|
1353
|
+
value: function componentDidMount() {
|
|
1354
|
+
this.fireFetchData();
|
|
1355
|
+
}
|
|
1356
|
+
}, {
|
|
1357
|
+
key: 'componentWillReceiveProps',
|
|
1358
|
+
value: function componentWillReceiveProps(nextProps, nextState) {
|
|
1359
|
+
var oldState = this.getResolvedState();
|
|
1360
|
+
var newState = this.getResolvedState(nextProps, nextState);
|
|
1361
|
+
|
|
1362
|
+
// Do a deep compare of new and old `defaultOption` and
|
|
1363
|
+
// if they are different reset `option = defaultOption`
|
|
1364
|
+
var defaultableOptions = ['sorted', 'filtered', 'resized', 'expanded'];
|
|
1365
|
+
defaultableOptions.forEach(function (x) {
|
|
1366
|
+
var defaultName = 'default' + (x.charAt(0).toUpperCase() + x.slice(1));
|
|
1367
|
+
if (JSON.stringify(oldState[defaultName]) !== JSON.stringify(newState[defaultName])) {
|
|
1368
|
+
newState[x] = newState[defaultName];
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
// If they change these table options, we need to reset defaults
|
|
1373
|
+
// or else we could get into a state where the user has changed the UI
|
|
1374
|
+
// and then disabled the ability to change it back.
|
|
1375
|
+
// e.g. If `filterable` has changed, set `filtered = defaultFiltered`
|
|
1376
|
+
var resettableOptions = ['sortable', 'filterable', 'resizable'];
|
|
1377
|
+
resettableOptions.forEach(function (x) {
|
|
1378
|
+
if (oldState[x] !== newState[x]) {
|
|
1379
|
+
var baseName = x.replace('able', '');
|
|
1380
|
+
var optionName = baseName + 'ed';
|
|
1381
|
+
var defaultName = 'default' + (optionName.charAt(0).toUpperCase() + optionName.slice(1));
|
|
1382
|
+
newState[optionName] = newState[defaultName];
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
|
|
1386
|
+
// Props that trigger a data update
|
|
1387
|
+
if (oldState.data !== newState.data || oldState.columns !== newState.columns || oldState.pivotBy !== newState.pivotBy || oldState.sorted !== newState.sorted || oldState.filtered !== newState.filtered) {
|
|
1388
|
+
this.setStateWithData(this.getDataModel(newState, oldState.data !== newState.data));
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}, {
|
|
1392
|
+
key: 'setStateWithData',
|
|
1393
|
+
value: function setStateWithData(newState, cb) {
|
|
1394
|
+
var _this2 = this;
|
|
1395
|
+
|
|
1396
|
+
var oldState = this.getResolvedState();
|
|
1397
|
+
var newResolvedState = this.getResolvedState({}, newState);
|
|
1398
|
+
var freezeWhenExpanded = newResolvedState.freezeWhenExpanded;
|
|
1399
|
+
|
|
1400
|
+
// Default to unfrozen state
|
|
1401
|
+
|
|
1402
|
+
newResolvedState.frozen = false;
|
|
1403
|
+
|
|
1404
|
+
// If freezeWhenExpanded is set, check for frozen conditions
|
|
1405
|
+
if (freezeWhenExpanded) {
|
|
1406
|
+
// if any rows are expanded, freeze the existing data and sorting
|
|
1407
|
+
var keys = Object.keys(newResolvedState.expanded);
|
|
1408
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
1409
|
+
if (newResolvedState.expanded[keys[i]]) {
|
|
1410
|
+
newResolvedState.frozen = true;
|
|
1411
|
+
break;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
// If the data isn't frozen and either the data or
|
|
1417
|
+
// sorting model has changed, update the data
|
|
1418
|
+
if (oldState.frozen && !newResolvedState.frozen || oldState.sorted !== newResolvedState.sorted || oldState.filtered !== newResolvedState.filtered || oldState.showFilters !== newResolvedState.showFilters || !newResolvedState.frozen && oldState.resolvedData !== newResolvedState.resolvedData) {
|
|
1419
|
+
// Handle collapseOnsortedChange & collapseOnDataChange
|
|
1420
|
+
if (oldState.sorted !== newResolvedState.sorted && this.props.collapseOnSortingChange || oldState.filtered !== newResolvedState.filtered || oldState.showFilters !== newResolvedState.showFilters || oldState.sortedData && !newResolvedState.frozen && oldState.resolvedData !== newResolvedState.resolvedData && this.props.collapseOnDataChange) {
|
|
1421
|
+
newResolvedState.expanded = {};
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
Object.assign(newResolvedState, this.getSortedData(newResolvedState));
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
// Set page to 0 if filters change
|
|
1428
|
+
if (oldState.filtered !== newResolvedState.filtered) {
|
|
1429
|
+
newResolvedState.page = 0;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
// Calculate pageSize all the time
|
|
1433
|
+
if (newResolvedState.sortedData) {
|
|
1434
|
+
newResolvedState.pages = newResolvedState.manual ? newResolvedState.pages : Math.ceil(newResolvedState.sortedData.length / newResolvedState.pageSize);
|
|
1435
|
+
newResolvedState.page = newResolvedState.manual ? newResolvedState.page : Math.max(newResolvedState.page >= newResolvedState.pages ? newResolvedState.pages - 1 : newResolvedState.page, 0);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
return this.setState(newResolvedState, function () {
|
|
1439
|
+
if (cb) {
|
|
1440
|
+
cb();
|
|
1441
|
+
}
|
|
1442
|
+
if (oldState.page !== newResolvedState.page || oldState.pageSize !== newResolvedState.pageSize || oldState.sorted !== newResolvedState.sorted || oldState.filtered !== newResolvedState.filtered) {
|
|
1443
|
+
_this2.fireFetchData();
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
}]);
|
|
1448
|
+
|
|
1449
|
+
return _class;
|
|
1450
|
+
}(Base);
|
|
1451
|
+
});
|
|
1452
|
+
|
|
1453
|
+
var _slicedToArray$1 = function () { function sliceIterator(arr, i) { 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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
1454
|
+
|
|
1455
|
+
var _extends$3 = Object.assign || 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; };
|
|
1456
|
+
|
|
1457
|
+
var _createClass$2 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1458
|
+
|
|
1459
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1460
|
+
|
|
1461
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
1462
|
+
|
|
1463
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1464
|
+
|
|
1465
|
+
function _possibleConstructorReturn$2(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1466
|
+
|
|
1467
|
+
function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1468
|
+
|
|
1469
|
+
var Methods = (function (Base) {
|
|
1470
|
+
return function (_Base) {
|
|
1471
|
+
_inherits$2(_class, _Base);
|
|
1472
|
+
|
|
1473
|
+
function _class() {
|
|
1474
|
+
_classCallCheck$2(this, _class);
|
|
1475
|
+
|
|
1476
|
+
return _possibleConstructorReturn$2(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
_createClass$2(_class, [{
|
|
1480
|
+
key: 'getResolvedState',
|
|
1481
|
+
value: function getResolvedState(props, state) {
|
|
1482
|
+
var resolvedState = _extends$3({}, _.compactObject(this.state), _.compactObject(this.props), _.compactObject(state), _.compactObject(props));
|
|
1483
|
+
return resolvedState;
|
|
1484
|
+
}
|
|
1485
|
+
}, {
|
|
1486
|
+
key: 'getDataModel',
|
|
1487
|
+
value: function getDataModel(newState, dataChanged) {
|
|
1488
|
+
var _this2 = this;
|
|
1489
|
+
|
|
1490
|
+
var columns = newState.columns,
|
|
1491
|
+
_newState$pivotBy = newState.pivotBy,
|
|
1492
|
+
pivotBy = _newState$pivotBy === undefined ? [] : _newState$pivotBy,
|
|
1493
|
+
data = newState.data,
|
|
1494
|
+
resolveData = newState.resolveData,
|
|
1495
|
+
pivotIDKey = newState.pivotIDKey,
|
|
1496
|
+
pivotValKey = newState.pivotValKey,
|
|
1497
|
+
subRowsKey = newState.subRowsKey,
|
|
1498
|
+
aggregatedKey = newState.aggregatedKey,
|
|
1499
|
+
nestingLevelKey = newState.nestingLevelKey,
|
|
1500
|
+
originalKey = newState.originalKey,
|
|
1501
|
+
indexKey = newState.indexKey,
|
|
1502
|
+
groupedByPivotKey = newState.groupedByPivotKey,
|
|
1503
|
+
SubComponent = newState.SubComponent;
|
|
1504
|
+
|
|
1505
|
+
// Determine Header Groups
|
|
1506
|
+
|
|
1507
|
+
var hasHeaderGroups = false;
|
|
1508
|
+
columns.forEach(function (column) {
|
|
1509
|
+
if (column.columns) {
|
|
1510
|
+
hasHeaderGroups = true;
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1514
|
+
var columnsWithExpander = [].concat(_toConsumableArray(columns));
|
|
1515
|
+
|
|
1516
|
+
var expanderColumn = columns.find(function (col) {
|
|
1517
|
+
return col.expander || col.columns && col.columns.some(function (col2) {
|
|
1518
|
+
return col2.expander;
|
|
1519
|
+
});
|
|
1520
|
+
});
|
|
1521
|
+
// The actual expander might be in the columns field of a group column
|
|
1522
|
+
if (expanderColumn && !expanderColumn.expander) {
|
|
1523
|
+
expanderColumn = expanderColumn.columns.find(function (col) {
|
|
1524
|
+
return col.expander;
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
// If we have SubComponent's we need to make sure we have an expander column
|
|
1529
|
+
if (SubComponent && !expanderColumn) {
|
|
1530
|
+
expanderColumn = { expander: true };
|
|
1531
|
+
columnsWithExpander = [expanderColumn].concat(_toConsumableArray(columnsWithExpander));
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
var makeDecoratedColumn = function makeDecoratedColumn(column, parentColumn) {
|
|
1535
|
+
var dcol = void 0;
|
|
1536
|
+
if (column.expander) {
|
|
1537
|
+
dcol = _extends$3({}, _this2.props.column, _this2.props.expanderDefaults, column);
|
|
1538
|
+
} else {
|
|
1539
|
+
dcol = _extends$3({}, _this2.props.column, column);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// Ensure minWidth is not greater than maxWidth if set
|
|
1543
|
+
if (dcol.maxWidth < dcol.minWidth) {
|
|
1544
|
+
dcol.minWidth = dcol.maxWidth;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
if (parentColumn) {
|
|
1548
|
+
dcol.parentColumn = parentColumn;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
// First check for string accessor
|
|
1552
|
+
if (typeof dcol.accessor === 'string') {
|
|
1553
|
+
dcol.id = dcol.id || dcol.accessor;
|
|
1554
|
+
var accessorString = dcol.accessor;
|
|
1555
|
+
dcol.accessor = function (row) {
|
|
1556
|
+
return _.get(row, accessorString);
|
|
1557
|
+
};
|
|
1558
|
+
return dcol;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
// Fall back to functional accessor (but require an ID)
|
|
1562
|
+
if (dcol.accessor && !dcol.id) {
|
|
1563
|
+
console.warn(dcol);
|
|
1564
|
+
throw new Error('A column id is required if using a non-string accessor for column above.');
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
// Fall back to an undefined accessor
|
|
1568
|
+
if (!dcol.accessor) {
|
|
1569
|
+
dcol.accessor = function () {
|
|
1570
|
+
return undefined;
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
return dcol;
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
var allDecoratedColumns = [];
|
|
1578
|
+
|
|
1579
|
+
// Decorate the columns
|
|
1580
|
+
var decorateAndAddToAll = function decorateAndAddToAll(column, parentColumn) {
|
|
1581
|
+
var decoratedColumn = makeDecoratedColumn(column, parentColumn);
|
|
1582
|
+
allDecoratedColumns.push(decoratedColumn);
|
|
1583
|
+
return decoratedColumn;
|
|
1584
|
+
};
|
|
1585
|
+
|
|
1586
|
+
var decoratedColumns = columnsWithExpander.map(function (column) {
|
|
1587
|
+
if (column.columns) {
|
|
1588
|
+
return _extends$3({}, column, {
|
|
1589
|
+
columns: column.columns.map(function (d) {
|
|
1590
|
+
return decorateAndAddToAll(d, column);
|
|
1591
|
+
})
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
return decorateAndAddToAll(column);
|
|
1595
|
+
});
|
|
1596
|
+
|
|
1597
|
+
// Build the visible columns, headers and flat column list
|
|
1598
|
+
var visibleColumns = decoratedColumns.slice();
|
|
1599
|
+
var allVisibleColumns = [];
|
|
1600
|
+
|
|
1601
|
+
visibleColumns = visibleColumns.map(function (column) {
|
|
1602
|
+
if (column.columns) {
|
|
1603
|
+
var visibleSubColumns = column.columns.filter(function (d) {
|
|
1604
|
+
return pivotBy.indexOf(d.id) > -1 ? false : _.getFirstDefined(d.show, true);
|
|
1605
|
+
});
|
|
1606
|
+
return _extends$3({}, column, {
|
|
1607
|
+
columns: visibleSubColumns
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
return column;
|
|
1611
|
+
});
|
|
1612
|
+
|
|
1613
|
+
visibleColumns = visibleColumns.filter(function (column) {
|
|
1614
|
+
return column.columns ? column.columns.length : pivotBy.indexOf(column.id) > -1 ? false : _.getFirstDefined(column.show, true);
|
|
1615
|
+
});
|
|
1616
|
+
|
|
1617
|
+
// Find any custom pivot location
|
|
1618
|
+
var pivotIndex = visibleColumns.findIndex(function (col) {
|
|
1619
|
+
return col.pivot;
|
|
1620
|
+
});
|
|
1621
|
+
|
|
1622
|
+
// Handle Pivot Columns
|
|
1623
|
+
if (pivotBy.length) {
|
|
1624
|
+
// Retrieve the pivot columns in the correct pivot order
|
|
1625
|
+
var pivotColumns = [];
|
|
1626
|
+
pivotBy.forEach(function (pivotID) {
|
|
1627
|
+
var found = allDecoratedColumns.find(function (d) {
|
|
1628
|
+
return d.id === pivotID;
|
|
1629
|
+
});
|
|
1630
|
+
if (found) {
|
|
1631
|
+
pivotColumns.push(found);
|
|
1632
|
+
}
|
|
1633
|
+
});
|
|
1634
|
+
|
|
1635
|
+
var PivotParentColumn = pivotColumns.reduce(function (prev, current) {
|
|
1636
|
+
return prev && prev === current.parentColumn && current.parentColumn;
|
|
1637
|
+
}, pivotColumns[0].parentColumn);
|
|
1638
|
+
|
|
1639
|
+
var PivotGroupHeader = hasHeaderGroups && PivotParentColumn.Header;
|
|
1640
|
+
PivotGroupHeader = PivotGroupHeader || function () {
|
|
1641
|
+
return React__default["default"].createElement(
|
|
1642
|
+
'strong',
|
|
1643
|
+
null,
|
|
1644
|
+
'Pivoted'
|
|
1645
|
+
);
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
var pivotColumnGroup = {
|
|
1649
|
+
Header: PivotGroupHeader,
|
|
1650
|
+
columns: pivotColumns.map(function (col) {
|
|
1651
|
+
return _extends$3({}, _this2.props.pivotDefaults, col, {
|
|
1652
|
+
pivoted: true
|
|
1653
|
+
});
|
|
1654
|
+
})
|
|
1655
|
+
|
|
1656
|
+
// Place the pivotColumns back into the visibleColumns
|
|
1657
|
+
};if (pivotIndex >= 0) {
|
|
1658
|
+
pivotColumnGroup = _extends$3({}, visibleColumns[pivotIndex], pivotColumnGroup);
|
|
1659
|
+
visibleColumns.splice(pivotIndex, 1, pivotColumnGroup);
|
|
1660
|
+
} else {
|
|
1661
|
+
visibleColumns.unshift(pivotColumnGroup);
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
// Build Header Groups
|
|
1666
|
+
var headerGroups = [];
|
|
1667
|
+
var currentSpan = [];
|
|
1668
|
+
|
|
1669
|
+
// A convenience function to add a header and reset the currentSpan
|
|
1670
|
+
var addHeader = function addHeader(columns, column) {
|
|
1671
|
+
headerGroups.push(_extends$3({}, _this2.props.column, column, {
|
|
1672
|
+
columns: columns
|
|
1673
|
+
}));
|
|
1674
|
+
currentSpan = [];
|
|
1675
|
+
};
|
|
1676
|
+
|
|
1677
|
+
// Build flast list of allVisibleColumns and HeaderGroups
|
|
1678
|
+
visibleColumns.forEach(function (column) {
|
|
1679
|
+
if (column.columns) {
|
|
1680
|
+
allVisibleColumns = allVisibleColumns.concat(column.columns);
|
|
1681
|
+
if (currentSpan.length > 0) {
|
|
1682
|
+
addHeader(currentSpan);
|
|
1683
|
+
}
|
|
1684
|
+
addHeader(column.columns, column);
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
allVisibleColumns.push(column);
|
|
1688
|
+
currentSpan.push(column);
|
|
1689
|
+
});
|
|
1690
|
+
if (hasHeaderGroups && currentSpan.length > 0) {
|
|
1691
|
+
addHeader(currentSpan);
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// Access the data
|
|
1695
|
+
var accessRow = function accessRow(d, i) {
|
|
1696
|
+
var _row;
|
|
1697
|
+
|
|
1698
|
+
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1699
|
+
|
|
1700
|
+
var row = (_row = {}, _defineProperty(_row, originalKey, d), _defineProperty(_row, indexKey, i), _defineProperty(_row, subRowsKey, d[subRowsKey]), _defineProperty(_row, nestingLevelKey, level), _row);
|
|
1701
|
+
allDecoratedColumns.forEach(function (column) {
|
|
1702
|
+
if (column.expander) return;
|
|
1703
|
+
row[column.id] = column.accessor(d);
|
|
1704
|
+
});
|
|
1705
|
+
if (row[subRowsKey]) {
|
|
1706
|
+
row[subRowsKey] = row[subRowsKey].map(function (d, i) {
|
|
1707
|
+
return accessRow(d, i, level + 1);
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
return row;
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
// // If the data hasn't changed, just use the cached data
|
|
1714
|
+
var resolvedData = this.resolvedData;
|
|
1715
|
+
// If the data has changed, run the data resolver and cache the result
|
|
1716
|
+
if (!this.resolvedData || dataChanged) {
|
|
1717
|
+
resolvedData = resolveData(data);
|
|
1718
|
+
this.resolvedData = resolvedData;
|
|
1719
|
+
}
|
|
1720
|
+
// Use the resolved data
|
|
1721
|
+
resolvedData = resolvedData.map(function (d, i) {
|
|
1722
|
+
return accessRow(d, i);
|
|
1723
|
+
});
|
|
1724
|
+
|
|
1725
|
+
// TODO: Make it possible to fabricate nested rows without pivoting
|
|
1726
|
+
var aggregatingColumns = allVisibleColumns.filter(function (d) {
|
|
1727
|
+
return !d.expander && d.aggregate;
|
|
1728
|
+
});
|
|
1729
|
+
|
|
1730
|
+
// If pivoting, recursively group the data
|
|
1731
|
+
var aggregate = function aggregate(rows) {
|
|
1732
|
+
var aggregationValues = {};
|
|
1733
|
+
aggregatingColumns.forEach(function (column) {
|
|
1734
|
+
var values = rows.map(function (d) {
|
|
1735
|
+
return d[column.id];
|
|
1736
|
+
});
|
|
1737
|
+
aggregationValues[column.id] = column.aggregate(values, rows);
|
|
1738
|
+
});
|
|
1739
|
+
return aggregationValues;
|
|
1740
|
+
};
|
|
1741
|
+
if (pivotBy.length) {
|
|
1742
|
+
var groupRecursively = function groupRecursively(rows, keys) {
|
|
1743
|
+
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1744
|
+
|
|
1745
|
+
// This is the last level, just return the rows
|
|
1746
|
+
if (i === keys.length) {
|
|
1747
|
+
return rows;
|
|
1748
|
+
}
|
|
1749
|
+
// Group the rows together for this level
|
|
1750
|
+
var groupedRows = Object.entries(_.groupBy(rows, keys[i])).map(function (_ref) {
|
|
1751
|
+
var _ref3;
|
|
1752
|
+
|
|
1753
|
+
var _ref2 = _slicedToArray$1(_ref, 2),
|
|
1754
|
+
key = _ref2[0],
|
|
1755
|
+
value = _ref2[1];
|
|
1756
|
+
|
|
1757
|
+
return _ref3 = {}, _defineProperty(_ref3, pivotIDKey, keys[i]), _defineProperty(_ref3, pivotValKey, key), _defineProperty(_ref3, keys[i], key), _defineProperty(_ref3, subRowsKey, value), _defineProperty(_ref3, nestingLevelKey, i), _defineProperty(_ref3, groupedByPivotKey, true), _ref3;
|
|
1758
|
+
});
|
|
1759
|
+
// Recurse into the subRows
|
|
1760
|
+
groupedRows = groupedRows.map(function (rowGroup) {
|
|
1761
|
+
var _extends2;
|
|
1762
|
+
|
|
1763
|
+
var subRows = groupRecursively(rowGroup[subRowsKey], keys, i + 1);
|
|
1764
|
+
return _extends$3({}, rowGroup, (_extends2 = {}, _defineProperty(_extends2, subRowsKey, subRows), _defineProperty(_extends2, aggregatedKey, true), _extends2), aggregate(subRows));
|
|
1765
|
+
});
|
|
1766
|
+
return groupedRows;
|
|
1767
|
+
};
|
|
1768
|
+
resolvedData = groupRecursively(resolvedData, pivotBy);
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
return _extends$3({}, newState, {
|
|
1772
|
+
resolvedData: resolvedData,
|
|
1773
|
+
allVisibleColumns: allVisibleColumns,
|
|
1774
|
+
headerGroups: headerGroups,
|
|
1775
|
+
allDecoratedColumns: allDecoratedColumns,
|
|
1776
|
+
hasHeaderGroups: hasHeaderGroups
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
}, {
|
|
1780
|
+
key: 'getSortedData',
|
|
1781
|
+
value: function getSortedData(resolvedState) {
|
|
1782
|
+
var manual = resolvedState.manual,
|
|
1783
|
+
sorted = resolvedState.sorted,
|
|
1784
|
+
filtered = resolvedState.filtered,
|
|
1785
|
+
defaultFilterMethod = resolvedState.defaultFilterMethod,
|
|
1786
|
+
resolvedData = resolvedState.resolvedData,
|
|
1787
|
+
allDecoratedColumns = resolvedState.allDecoratedColumns;
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
var sortMethodsByColumnID = {};
|
|
1791
|
+
|
|
1792
|
+
allDecoratedColumns.filter(function (col) {
|
|
1793
|
+
return col.sortMethod;
|
|
1794
|
+
}).forEach(function (col) {
|
|
1795
|
+
sortMethodsByColumnID[col.id] = col.sortMethod;
|
|
1796
|
+
});
|
|
1797
|
+
|
|
1798
|
+
// Resolve the data from either manual data or sorted data
|
|
1799
|
+
return {
|
|
1800
|
+
sortedData: manual ? resolvedData : this.sortData(this.filterData(resolvedData, filtered, defaultFilterMethod, allDecoratedColumns), sorted, sortMethodsByColumnID)
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
}, {
|
|
1804
|
+
key: 'fireFetchData',
|
|
1805
|
+
value: function fireFetchData() {
|
|
1806
|
+
// determine the current state, preferring certain state values over props
|
|
1807
|
+
var currentState = _extends$3({}, this.getResolvedState(), {
|
|
1808
|
+
page: this.getStateOrProp('page'),
|
|
1809
|
+
pageSize: this.getStateOrProp('pageSize'),
|
|
1810
|
+
filter: this.getStateOrProp('filter')
|
|
1811
|
+
});
|
|
1812
|
+
|
|
1813
|
+
this.props.onFetchData(currentState, this);
|
|
1814
|
+
}
|
|
1815
|
+
}, {
|
|
1816
|
+
key: 'getPropOrState',
|
|
1817
|
+
value: function getPropOrState(key) {
|
|
1818
|
+
return _.getFirstDefined(this.props[key], this.state[key]);
|
|
1819
|
+
}
|
|
1820
|
+
}, {
|
|
1821
|
+
key: 'getStateOrProp',
|
|
1822
|
+
value: function getStateOrProp(key) {
|
|
1823
|
+
return _.getFirstDefined(this.state[key], this.props[key]);
|
|
1824
|
+
}
|
|
1825
|
+
}, {
|
|
1826
|
+
key: 'filterData',
|
|
1827
|
+
value: function filterData(data, filtered, defaultFilterMethod, allVisibleColumns) {
|
|
1828
|
+
var _this3 = this;
|
|
1829
|
+
|
|
1830
|
+
var filteredData = data;
|
|
1831
|
+
|
|
1832
|
+
if (filtered.length) {
|
|
1833
|
+
filteredData = filtered.reduce(function (filteredSoFar, nextFilter) {
|
|
1834
|
+
var column = allVisibleColumns.find(function (x) {
|
|
1835
|
+
return x.id === nextFilter.id;
|
|
1836
|
+
});
|
|
1837
|
+
|
|
1838
|
+
// Don't filter hidden columns or columns that have had their filters disabled
|
|
1839
|
+
if (!column || column.filterable === false) {
|
|
1840
|
+
return filteredSoFar;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
var filterMethod = column.filterMethod || defaultFilterMethod;
|
|
1844
|
+
|
|
1845
|
+
// If 'filterAll' is set to true, pass the entire dataset to the filter method
|
|
1846
|
+
if (column.filterAll) {
|
|
1847
|
+
return filterMethod(nextFilter, filteredSoFar, column);
|
|
1848
|
+
}
|
|
1849
|
+
return filteredSoFar.filter(function (row) {
|
|
1850
|
+
return filterMethod(nextFilter, row, column);
|
|
1851
|
+
});
|
|
1852
|
+
}, filteredData);
|
|
1853
|
+
|
|
1854
|
+
// Apply the filter to the subrows if we are pivoting, and then
|
|
1855
|
+
// filter any rows without subcolumns because it would be strange to show
|
|
1856
|
+
filteredData = filteredData.map(function (row) {
|
|
1857
|
+
if (!row[_this3.props.subRowsKey]) {
|
|
1858
|
+
return row;
|
|
1859
|
+
}
|
|
1860
|
+
return _extends$3({}, row, _defineProperty({}, _this3.props.subRowsKey, _this3.filterData(row[_this3.props.subRowsKey], filtered, defaultFilterMethod, allVisibleColumns)));
|
|
1861
|
+
}).filter(function (row) {
|
|
1862
|
+
if (!row[_this3.props.subRowsKey]) {
|
|
1863
|
+
return true;
|
|
1864
|
+
}
|
|
1865
|
+
return row[_this3.props.subRowsKey].length > 0;
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
return filteredData;
|
|
1870
|
+
}
|
|
1871
|
+
}, {
|
|
1872
|
+
key: 'sortData',
|
|
1873
|
+
value: function sortData(data, sorted) {
|
|
1874
|
+
var _this4 = this;
|
|
1875
|
+
|
|
1876
|
+
var sortMethodsByColumnID = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1877
|
+
|
|
1878
|
+
if (!sorted.length) {
|
|
1879
|
+
return data;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
var sortedData = (this.props.orderByMethod || _.orderBy)(data, sorted.map(function (sort) {
|
|
1883
|
+
// Support custom sorting methods for each column
|
|
1884
|
+
if (sortMethodsByColumnID[sort.id]) {
|
|
1885
|
+
return function (a, b) {
|
|
1886
|
+
return sortMethodsByColumnID[sort.id](a[sort.id], b[sort.id], sort.desc);
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
return function (a, b) {
|
|
1890
|
+
return _this4.props.defaultSortMethod(a[sort.id], b[sort.id], sort.desc);
|
|
1891
|
+
};
|
|
1892
|
+
}), sorted.map(function (d) {
|
|
1893
|
+
return !d.desc;
|
|
1894
|
+
}), this.props.indexKey);
|
|
1895
|
+
|
|
1896
|
+
sortedData.forEach(function (row) {
|
|
1897
|
+
if (!row[_this4.props.subRowsKey]) {
|
|
1898
|
+
return;
|
|
1899
|
+
}
|
|
1900
|
+
row[_this4.props.subRowsKey] = _this4.sortData(row[_this4.props.subRowsKey], sorted, sortMethodsByColumnID);
|
|
1901
|
+
});
|
|
1902
|
+
|
|
1903
|
+
return sortedData;
|
|
1904
|
+
}
|
|
1905
|
+
}, {
|
|
1906
|
+
key: 'getMinRows',
|
|
1907
|
+
value: function getMinRows() {
|
|
1908
|
+
return _.getFirstDefined(this.props.minRows, this.getStateOrProp('pageSize'));
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// User actions
|
|
1912
|
+
|
|
1913
|
+
}, {
|
|
1914
|
+
key: 'onPageChange',
|
|
1915
|
+
value: function onPageChange(page) {
|
|
1916
|
+
var _props = this.props,
|
|
1917
|
+
onPageChange = _props.onPageChange,
|
|
1918
|
+
collapseOnPageChange = _props.collapseOnPageChange;
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
var newState = { page: page };
|
|
1922
|
+
if (collapseOnPageChange) {
|
|
1923
|
+
newState.expanded = {};
|
|
1924
|
+
}
|
|
1925
|
+
this.setStateWithData(newState, function () {
|
|
1926
|
+
return onPageChange && onPageChange(page);
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
}, {
|
|
1930
|
+
key: 'onPageSizeChange',
|
|
1931
|
+
value: function onPageSizeChange(newPageSize) {
|
|
1932
|
+
var onPageSizeChange = this.props.onPageSizeChange;
|
|
1933
|
+
|
|
1934
|
+
var _getResolvedState = this.getResolvedState(),
|
|
1935
|
+
pageSize = _getResolvedState.pageSize,
|
|
1936
|
+
page = _getResolvedState.page;
|
|
1937
|
+
|
|
1938
|
+
// Normalize the page to display
|
|
1939
|
+
|
|
1940
|
+
|
|
1941
|
+
var currentRow = pageSize * page;
|
|
1942
|
+
var newPage = Math.floor(currentRow / newPageSize);
|
|
1943
|
+
|
|
1944
|
+
this.setStateWithData({
|
|
1945
|
+
pageSize: newPageSize,
|
|
1946
|
+
page: newPage
|
|
1947
|
+
}, function () {
|
|
1948
|
+
return onPageSizeChange && onPageSizeChange(newPageSize, newPage);
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
}, {
|
|
1952
|
+
key: 'sortColumn',
|
|
1953
|
+
value: function sortColumn(column, additive) {
|
|
1954
|
+
var _getResolvedState2 = this.getResolvedState(),
|
|
1955
|
+
sorted = _getResolvedState2.sorted,
|
|
1956
|
+
skipNextSort = _getResolvedState2.skipNextSort,
|
|
1957
|
+
defaultSortDesc = _getResolvedState2.defaultSortDesc;
|
|
1958
|
+
|
|
1959
|
+
var firstSortDirection = Object.prototype.hasOwnProperty.call(column, 'defaultSortDesc') ? column.defaultSortDesc : defaultSortDesc;
|
|
1960
|
+
var secondSortDirection = !firstSortDirection;
|
|
1961
|
+
|
|
1962
|
+
// we can't stop event propagation from the column resize move handlers
|
|
1963
|
+
// attached to the document because of react's synthetic events
|
|
1964
|
+
// so we have to prevent the sort function from actually sorting
|
|
1965
|
+
// if we click on the column resize element within a header.
|
|
1966
|
+
if (skipNextSort) {
|
|
1967
|
+
this.setStateWithData({
|
|
1968
|
+
skipNextSort: false
|
|
1969
|
+
});
|
|
1970
|
+
return;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
var onSortedChange = this.props.onSortedChange;
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
var newSorted = _.clone(sorted || []).map(function (d) {
|
|
1977
|
+
d.desc = _.isSortingDesc(d);
|
|
1978
|
+
return d;
|
|
1979
|
+
});
|
|
1980
|
+
if (!_.isArray(column)) {
|
|
1981
|
+
// Single-Sort
|
|
1982
|
+
var existingIndex = newSorted.findIndex(function (d) {
|
|
1983
|
+
return d.id === column.id;
|
|
1984
|
+
});
|
|
1985
|
+
if (existingIndex > -1) {
|
|
1986
|
+
var existing = newSorted[existingIndex];
|
|
1987
|
+
if (existing.desc === secondSortDirection) {
|
|
1988
|
+
if (additive) {
|
|
1989
|
+
newSorted.splice(existingIndex, 1);
|
|
1990
|
+
} else {
|
|
1991
|
+
existing.desc = firstSortDirection;
|
|
1992
|
+
newSorted = [existing];
|
|
1993
|
+
}
|
|
1994
|
+
} else {
|
|
1995
|
+
existing.desc = secondSortDirection;
|
|
1996
|
+
if (!additive) {
|
|
1997
|
+
newSorted = [existing];
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
} else if (additive) {
|
|
2001
|
+
newSorted.push({
|
|
2002
|
+
id: column.id,
|
|
2003
|
+
desc: firstSortDirection
|
|
2004
|
+
});
|
|
2005
|
+
} else {
|
|
2006
|
+
newSorted = [{
|
|
2007
|
+
id: column.id,
|
|
2008
|
+
desc: firstSortDirection
|
|
2009
|
+
}];
|
|
2010
|
+
}
|
|
2011
|
+
} else {
|
|
2012
|
+
// Multi-Sort
|
|
2013
|
+
var _existingIndex = newSorted.findIndex(function (d) {
|
|
2014
|
+
return d.id === column[0].id;
|
|
2015
|
+
});
|
|
2016
|
+
// Existing Sorted Column
|
|
2017
|
+
if (_existingIndex > -1) {
|
|
2018
|
+
var _existing = newSorted[_existingIndex];
|
|
2019
|
+
if (_existing.desc === secondSortDirection) {
|
|
2020
|
+
if (additive) {
|
|
2021
|
+
newSorted.splice(_existingIndex, column.length);
|
|
2022
|
+
} else {
|
|
2023
|
+
column.forEach(function (d, i) {
|
|
2024
|
+
newSorted[_existingIndex + i].desc = firstSortDirection;
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
} else {
|
|
2028
|
+
column.forEach(function (d, i) {
|
|
2029
|
+
newSorted[_existingIndex + i].desc = secondSortDirection;
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
if (!additive) {
|
|
2033
|
+
newSorted = newSorted.slice(_existingIndex, column.length);
|
|
2034
|
+
}
|
|
2035
|
+
// New Sort Column
|
|
2036
|
+
} else if (additive) {
|
|
2037
|
+
newSorted = newSorted.concat(column.map(function (d) {
|
|
2038
|
+
return {
|
|
2039
|
+
id: d.id,
|
|
2040
|
+
desc: firstSortDirection
|
|
2041
|
+
};
|
|
2042
|
+
}));
|
|
2043
|
+
} else {
|
|
2044
|
+
newSorted = column.map(function (d) {
|
|
2045
|
+
return {
|
|
2046
|
+
id: d.id,
|
|
2047
|
+
desc: firstSortDirection
|
|
2048
|
+
};
|
|
2049
|
+
});
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
this.setStateWithData({
|
|
2054
|
+
page: !sorted.length && newSorted.length || !additive ? 0 : this.state.page,
|
|
2055
|
+
sorted: newSorted
|
|
2056
|
+
}, function () {
|
|
2057
|
+
return onSortedChange && onSortedChange(newSorted, column, additive);
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
}, {
|
|
2061
|
+
key: 'filterColumn',
|
|
2062
|
+
value: function filterColumn(column, value) {
|
|
2063
|
+
var _getResolvedState3 = this.getResolvedState(),
|
|
2064
|
+
filtered = _getResolvedState3.filtered;
|
|
2065
|
+
|
|
2066
|
+
var onFilteredChange = this.props.onFilteredChange;
|
|
2067
|
+
|
|
2068
|
+
// Remove old filter first if it exists
|
|
2069
|
+
|
|
2070
|
+
var newFiltering = (filtered || []).filter(function (x) {
|
|
2071
|
+
return x.id !== column.id;
|
|
2072
|
+
});
|
|
2073
|
+
|
|
2074
|
+
if (value !== '') {
|
|
2075
|
+
newFiltering.push({
|
|
2076
|
+
id: column.id,
|
|
2077
|
+
value: value
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
this.setStateWithData({
|
|
2082
|
+
filtered: newFiltering
|
|
2083
|
+
}, function () {
|
|
2084
|
+
return onFilteredChange && onFilteredChange(newFiltering, column, value);
|
|
2085
|
+
});
|
|
2086
|
+
}
|
|
2087
|
+
}, {
|
|
2088
|
+
key: 'resizeColumnStart',
|
|
2089
|
+
value: function resizeColumnStart(event, column, isTouch) {
|
|
2090
|
+
var _this5 = this;
|
|
2091
|
+
|
|
2092
|
+
event.stopPropagation();
|
|
2093
|
+
var parentWidth = event.target.parentElement.getBoundingClientRect().width;
|
|
2094
|
+
|
|
2095
|
+
var pageX = void 0;
|
|
2096
|
+
if (isTouch) {
|
|
2097
|
+
pageX = event.changedTouches[0].pageX;
|
|
2098
|
+
} else {
|
|
2099
|
+
pageX = event.pageX;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
this.trapEvents = true;
|
|
2103
|
+
this.setStateWithData({
|
|
2104
|
+
currentlyResizing: {
|
|
2105
|
+
id: column.id,
|
|
2106
|
+
startX: pageX,
|
|
2107
|
+
parentWidth: parentWidth
|
|
2108
|
+
}
|
|
2109
|
+
}, function () {
|
|
2110
|
+
if (isTouch) {
|
|
2111
|
+
document.addEventListener('touchmove', _this5.resizeColumnMoving);
|
|
2112
|
+
document.addEventListener('touchcancel', _this5.resizeColumnEnd);
|
|
2113
|
+
document.addEventListener('touchend', _this5.resizeColumnEnd);
|
|
2114
|
+
} else {
|
|
2115
|
+
document.addEventListener('mousemove', _this5.resizeColumnMoving);
|
|
2116
|
+
document.addEventListener('mouseup', _this5.resizeColumnEnd);
|
|
2117
|
+
document.addEventListener('mouseleave', _this5.resizeColumnEnd);
|
|
2118
|
+
}
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
}, {
|
|
2122
|
+
key: 'resizeColumnMoving',
|
|
2123
|
+
value: function resizeColumnMoving(event) {
|
|
2124
|
+
event.stopPropagation();
|
|
2125
|
+
var _props2 = this.props,
|
|
2126
|
+
onResizedChange = _props2.onResizedChange,
|
|
2127
|
+
column = _props2.column;
|
|
2128
|
+
|
|
2129
|
+
var _getResolvedState4 = this.getResolvedState(),
|
|
2130
|
+
resized = _getResolvedState4.resized,
|
|
2131
|
+
currentlyResizing = _getResolvedState4.currentlyResizing,
|
|
2132
|
+
columns = _getResolvedState4.columns;
|
|
2133
|
+
|
|
2134
|
+
var currentColumn = columns.find(function (c) {
|
|
2135
|
+
return c.accessor === currentlyResizing.id || c.id === currentlyResizing.id;
|
|
2136
|
+
});
|
|
2137
|
+
var minResizeWidth = currentColumn && currentColumn.minResizeWidth != null ? currentColumn.minResizeWidth : column.minResizeWidth;
|
|
2138
|
+
|
|
2139
|
+
// Delete old value
|
|
2140
|
+
var newResized = resized.filter(function (x) {
|
|
2141
|
+
return x.id !== currentlyResizing.id;
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2144
|
+
var pageX = void 0;
|
|
2145
|
+
|
|
2146
|
+
if (event.type === 'touchmove') {
|
|
2147
|
+
pageX = event.changedTouches[0].pageX;
|
|
2148
|
+
} else if (event.type === 'mousemove') {
|
|
2149
|
+
pageX = event.pageX;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
var newWidth = Math.max(currentlyResizing.parentWidth + pageX - currentlyResizing.startX, minResizeWidth);
|
|
2153
|
+
|
|
2154
|
+
newResized.push({
|
|
2155
|
+
id: currentlyResizing.id,
|
|
2156
|
+
value: newWidth
|
|
2157
|
+
});
|
|
2158
|
+
|
|
2159
|
+
this.setStateWithData({
|
|
2160
|
+
resized: newResized
|
|
2161
|
+
}, function () {
|
|
2162
|
+
return onResizedChange && onResizedChange(newResized, event);
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
}, {
|
|
2166
|
+
key: 'resizeColumnEnd',
|
|
2167
|
+
value: function resizeColumnEnd(event) {
|
|
2168
|
+
event.stopPropagation();
|
|
2169
|
+
var isTouch = event.type === 'touchend' || event.type === 'touchcancel';
|
|
2170
|
+
|
|
2171
|
+
if (isTouch) {
|
|
2172
|
+
document.removeEventListener('touchmove', this.resizeColumnMoving);
|
|
2173
|
+
document.removeEventListener('touchcancel', this.resizeColumnEnd);
|
|
2174
|
+
document.removeEventListener('touchend', this.resizeColumnEnd);
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
// If its a touch event clear the mouse one's as well because sometimes
|
|
2178
|
+
// the mouseDown event gets called as well, but the mouseUp event doesn't
|
|
2179
|
+
document.removeEventListener('mousemove', this.resizeColumnMoving);
|
|
2180
|
+
document.removeEventListener('mouseup', this.resizeColumnEnd);
|
|
2181
|
+
document.removeEventListener('mouseleave', this.resizeColumnEnd);
|
|
2182
|
+
|
|
2183
|
+
// The touch events don't propagate up to the sorting's onMouseDown event so
|
|
2184
|
+
// no need to prevent it from happening or else the first click after a touch
|
|
2185
|
+
// event resize will not sort the column.
|
|
2186
|
+
if (!isTouch) {
|
|
2187
|
+
this.setStateWithData({
|
|
2188
|
+
skipNextSort: true,
|
|
2189
|
+
currentlyResizing: false
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
}]);
|
|
2194
|
+
|
|
2195
|
+
return _class;
|
|
2196
|
+
}(Base);
|
|
2197
|
+
});
|
|
2198
|
+
|
|
2199
|
+
var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2200
|
+
|
|
2201
|
+
var _extends$2 = Object.assign || 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; };
|
|
2202
|
+
|
|
2203
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2204
|
+
|
|
2205
|
+
function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
2206
|
+
|
|
2207
|
+
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
2208
|
+
|
|
2209
|
+
var defaultButton = function defaultButton(props) {
|
|
2210
|
+
return React__default["default"].createElement(
|
|
2211
|
+
'button',
|
|
2212
|
+
_extends$2({ type: 'button' }, props, { className: '-btn' }),
|
|
2213
|
+
props.children
|
|
2214
|
+
);
|
|
2215
|
+
};
|
|
2216
|
+
|
|
2217
|
+
var ReactTablePagination = function (_Component) {
|
|
2218
|
+
_inherits$1(ReactTablePagination, _Component);
|
|
2219
|
+
|
|
2220
|
+
function ReactTablePagination(props) {
|
|
2221
|
+
_classCallCheck$1(this, ReactTablePagination);
|
|
2222
|
+
|
|
2223
|
+
var _this = _possibleConstructorReturn$1(this, (ReactTablePagination.__proto__ || Object.getPrototypeOf(ReactTablePagination)).call(this, props));
|
|
2224
|
+
|
|
2225
|
+
_this.getSafePage = _this.getSafePage.bind(_this);
|
|
2226
|
+
_this.changePage = _this.changePage.bind(_this);
|
|
2227
|
+
_this.applyPage = _this.applyPage.bind(_this);
|
|
2228
|
+
|
|
2229
|
+
_this.state = {
|
|
2230
|
+
page: props.page
|
|
2231
|
+
};
|
|
2232
|
+
return _this;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
_createClass$1(ReactTablePagination, [{
|
|
2236
|
+
key: 'componentWillReceiveProps',
|
|
2237
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
2238
|
+
if (this.props.page !== nextProps.page) {
|
|
2239
|
+
this.setState({ page: nextProps.page });
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
}, {
|
|
2243
|
+
key: 'getSafePage',
|
|
2244
|
+
value: function getSafePage(page) {
|
|
2245
|
+
if (Number.isNaN(page)) {
|
|
2246
|
+
page = this.props.page;
|
|
2247
|
+
}
|
|
2248
|
+
return Math.min(Math.max(page, 0), this.props.pages - 1);
|
|
2249
|
+
}
|
|
2250
|
+
}, {
|
|
2251
|
+
key: 'changePage',
|
|
2252
|
+
value: function changePage(page) {
|
|
2253
|
+
page = this.getSafePage(page);
|
|
2254
|
+
this.setState({ page: page });
|
|
2255
|
+
if (this.props.page !== page) {
|
|
2256
|
+
this.props.onPageChange(page);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}, {
|
|
2260
|
+
key: 'applyPage',
|
|
2261
|
+
value: function applyPage(e) {
|
|
2262
|
+
if (e) {
|
|
2263
|
+
e.preventDefault();
|
|
2264
|
+
}
|
|
2265
|
+
var page = this.state.page;
|
|
2266
|
+
this.changePage(page === '' ? this.props.page : page);
|
|
2267
|
+
}
|
|
2268
|
+
}, {
|
|
2269
|
+
key: 'getPageJumpProperties',
|
|
2270
|
+
value: function getPageJumpProperties() {
|
|
2271
|
+
var _this2 = this;
|
|
2272
|
+
|
|
2273
|
+
return {
|
|
2274
|
+
onKeyPress: function onKeyPress(e) {
|
|
2275
|
+
if (e.which === 13 || e.keyCode === 13) {
|
|
2276
|
+
_this2.applyPage();
|
|
2277
|
+
}
|
|
2278
|
+
},
|
|
2279
|
+
onBlur: this.applyPage,
|
|
2280
|
+
value: this.state.page === '' ? '' : this.state.page + 1,
|
|
2281
|
+
onChange: function onChange(e) {
|
|
2282
|
+
var val = e.target.value;
|
|
2283
|
+
var page = val - 1;
|
|
2284
|
+
if (val === '') {
|
|
2285
|
+
return _this2.setState({ page: val });
|
|
2286
|
+
}
|
|
2287
|
+
_this2.setState({ page: _this2.getSafePage(page) });
|
|
2288
|
+
},
|
|
2289
|
+
inputType: this.state.page === '' ? 'text' : 'number',
|
|
2290
|
+
pageJumpText: this.props.pageJumpText
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2293
|
+
}, {
|
|
2294
|
+
key: 'render',
|
|
2295
|
+
value: function render() {
|
|
2296
|
+
var _this3 = this;
|
|
2297
|
+
|
|
2298
|
+
var _props = this.props,
|
|
2299
|
+
pages = _props.pages,
|
|
2300
|
+
page = _props.page,
|
|
2301
|
+
showPageSizeOptions = _props.showPageSizeOptions,
|
|
2302
|
+
pageSizeOptions = _props.pageSizeOptions,
|
|
2303
|
+
pageSize = _props.pageSize,
|
|
2304
|
+
showPageJump = _props.showPageJump,
|
|
2305
|
+
canPrevious = _props.canPrevious,
|
|
2306
|
+
canNext = _props.canNext,
|
|
2307
|
+
onPageSizeChange = _props.onPageSizeChange,
|
|
2308
|
+
className = _props.className,
|
|
2309
|
+
PreviousComponent = _props.PreviousComponent,
|
|
2310
|
+
NextComponent = _props.NextComponent,
|
|
2311
|
+
renderPageJump = _props.renderPageJump,
|
|
2312
|
+
renderCurrentPage = _props.renderCurrentPage,
|
|
2313
|
+
renderTotalPagesCount = _props.renderTotalPagesCount,
|
|
2314
|
+
renderPageSizeOptions = _props.renderPageSizeOptions;
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
return React__default["default"].createElement(
|
|
2318
|
+
'div',
|
|
2319
|
+
{ className: classnames__default["default"](className, '-pagination'), style: this.props.style },
|
|
2320
|
+
React__default["default"].createElement(
|
|
2321
|
+
'div',
|
|
2322
|
+
{ className: '-previous' },
|
|
2323
|
+
React__default["default"].createElement(
|
|
2324
|
+
PreviousComponent,
|
|
2325
|
+
{
|
|
2326
|
+
onClick: function onClick() {
|
|
2327
|
+
if (!canPrevious) return;
|
|
2328
|
+
_this3.changePage(page - 1);
|
|
2329
|
+
},
|
|
2330
|
+
disabled: !canPrevious
|
|
2331
|
+
},
|
|
2332
|
+
this.props.previousText
|
|
2333
|
+
)
|
|
2334
|
+
),
|
|
2335
|
+
React__default["default"].createElement(
|
|
2336
|
+
'div',
|
|
2337
|
+
{ className: '-center' },
|
|
2338
|
+
React__default["default"].createElement(
|
|
2339
|
+
'span',
|
|
2340
|
+
{ className: '-pageInfo' },
|
|
2341
|
+
this.props.pageText,
|
|
2342
|
+
' ',
|
|
2343
|
+
showPageJump ? renderPageJump(this.getPageJumpProperties()) : renderCurrentPage(page),
|
|
2344
|
+
' ',
|
|
2345
|
+
this.props.ofText,
|
|
2346
|
+
' ',
|
|
2347
|
+
renderTotalPagesCount(pages)
|
|
2348
|
+
),
|
|
2349
|
+
showPageSizeOptions && renderPageSizeOptions({
|
|
2350
|
+
pageSize: pageSize,
|
|
2351
|
+
rowsSelectorText: this.props.rowsSelectorText,
|
|
2352
|
+
pageSizeOptions: pageSizeOptions,
|
|
2353
|
+
onPageSizeChange: onPageSizeChange,
|
|
2354
|
+
rowsText: this.props.rowsText
|
|
2355
|
+
})
|
|
2356
|
+
),
|
|
2357
|
+
React__default["default"].createElement(
|
|
2358
|
+
'div',
|
|
2359
|
+
{ className: '-next' },
|
|
2360
|
+
React__default["default"].createElement(
|
|
2361
|
+
NextComponent,
|
|
2362
|
+
{
|
|
2363
|
+
onClick: function onClick() {
|
|
2364
|
+
if (!canNext) return;
|
|
2365
|
+
_this3.changePage(page + 1);
|
|
2366
|
+
},
|
|
2367
|
+
disabled: !canNext
|
|
2368
|
+
},
|
|
2369
|
+
this.props.nextText
|
|
2370
|
+
)
|
|
2371
|
+
)
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
}]);
|
|
2375
|
+
|
|
2376
|
+
return ReactTablePagination;
|
|
2377
|
+
}(React.Component);
|
|
2378
|
+
|
|
2379
|
+
ReactTablePagination.defaultProps = {
|
|
2380
|
+
PreviousComponent: defaultButton,
|
|
2381
|
+
NextComponent: defaultButton,
|
|
2382
|
+
renderPageJump: function renderPageJump(_ref) {
|
|
2383
|
+
var onChange = _ref.onChange,
|
|
2384
|
+
value = _ref.value,
|
|
2385
|
+
onBlur = _ref.onBlur,
|
|
2386
|
+
onKeyPress = _ref.onKeyPress,
|
|
2387
|
+
inputType = _ref.inputType,
|
|
2388
|
+
pageJumpText = _ref.pageJumpText;
|
|
2389
|
+
return React__default["default"].createElement(
|
|
2390
|
+
'div',
|
|
2391
|
+
{ className: '-pageJump' },
|
|
2392
|
+
React__default["default"].createElement('input', {
|
|
2393
|
+
'aria-label': pageJumpText,
|
|
2394
|
+
type: inputType,
|
|
2395
|
+
onChange: onChange,
|
|
2396
|
+
value: value,
|
|
2397
|
+
onBlur: onBlur,
|
|
2398
|
+
onKeyPress: onKeyPress
|
|
2399
|
+
})
|
|
2400
|
+
);
|
|
2401
|
+
},
|
|
2402
|
+
renderCurrentPage: function renderCurrentPage(page) {
|
|
2403
|
+
return React__default["default"].createElement(
|
|
2404
|
+
'span',
|
|
2405
|
+
{ className: '-currentPage' },
|
|
2406
|
+
page + 1
|
|
2407
|
+
);
|
|
2408
|
+
},
|
|
2409
|
+
renderTotalPagesCount: function renderTotalPagesCount(pages) {
|
|
2410
|
+
return React__default["default"].createElement(
|
|
2411
|
+
'span',
|
|
2412
|
+
{ className: '-totalPages' },
|
|
2413
|
+
pages || 1
|
|
2414
|
+
);
|
|
2415
|
+
},
|
|
2416
|
+
renderPageSizeOptions: function renderPageSizeOptions(_ref2) {
|
|
2417
|
+
var pageSize = _ref2.pageSize,
|
|
2418
|
+
pageSizeOptions = _ref2.pageSizeOptions,
|
|
2419
|
+
rowsSelectorText = _ref2.rowsSelectorText,
|
|
2420
|
+
onPageSizeChange = _ref2.onPageSizeChange,
|
|
2421
|
+
rowsText = _ref2.rowsText;
|
|
2422
|
+
return React__default["default"].createElement(
|
|
2423
|
+
'span',
|
|
2424
|
+
{ className: 'select-wrap -pageSizeOptions' },
|
|
2425
|
+
React__default["default"].createElement(
|
|
2426
|
+
'select',
|
|
2427
|
+
{
|
|
2428
|
+
'aria-label': rowsSelectorText,
|
|
2429
|
+
onChange: function onChange(e) {
|
|
2430
|
+
return onPageSizeChange(Number(e.target.value));
|
|
2431
|
+
},
|
|
2432
|
+
value: pageSize
|
|
2433
|
+
},
|
|
2434
|
+
pageSizeOptions.map(function (option, i) {
|
|
2435
|
+
return (
|
|
2436
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
2437
|
+
React__default["default"].createElement(
|
|
2438
|
+
'option',
|
|
2439
|
+
{ key: i, value: option },
|
|
2440
|
+
option + ' ' + rowsText
|
|
2441
|
+
)
|
|
2442
|
+
);
|
|
2443
|
+
})
|
|
2444
|
+
)
|
|
2445
|
+
);
|
|
2446
|
+
}
|
|
2447
|
+
};
|
|
2448
|
+
|
|
2449
|
+
var _extends$1 = Object.assign || 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; };
|
|
2450
|
+
|
|
2451
|
+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
2452
|
+
|
|
2453
|
+
var emptyObj = function emptyObj() {
|
|
2454
|
+
return {};
|
|
2455
|
+
};
|
|
2456
|
+
|
|
2457
|
+
var defaultProps = {
|
|
2458
|
+
// General
|
|
2459
|
+
data: [],
|
|
2460
|
+
resolveData: function resolveData(data) {
|
|
2461
|
+
return data;
|
|
2462
|
+
},
|
|
2463
|
+
loading: false,
|
|
2464
|
+
showPagination: true,
|
|
2465
|
+
showPaginationTop: false,
|
|
2466
|
+
showPaginationBottom: true,
|
|
2467
|
+
showPageSizeOptions: true,
|
|
2468
|
+
pageSizeOptions: [5, 10, 20, 25, 50, 100],
|
|
2469
|
+
defaultPage: 0,
|
|
2470
|
+
defaultPageSize: 20,
|
|
2471
|
+
showPageJump: true,
|
|
2472
|
+
collapseOnSortingChange: true,
|
|
2473
|
+
collapseOnPageChange: true,
|
|
2474
|
+
collapseOnDataChange: true,
|
|
2475
|
+
freezeWhenExpanded: false,
|
|
2476
|
+
sortable: true,
|
|
2477
|
+
multiSort: true,
|
|
2478
|
+
resizable: true,
|
|
2479
|
+
filterable: false,
|
|
2480
|
+
defaultSortDesc: false,
|
|
2481
|
+
defaultSorted: [],
|
|
2482
|
+
defaultFiltered: [],
|
|
2483
|
+
defaultResized: [],
|
|
2484
|
+
defaultExpanded: {},
|
|
2485
|
+
// eslint-disable-next-line no-unused-vars
|
|
2486
|
+
defaultFilterMethod: function defaultFilterMethod(filter, row, column) {
|
|
2487
|
+
var id = filter.pivotId || filter.id;
|
|
2488
|
+
return row[id] !== undefined ? String(row[id]).startsWith(filter.value) : true;
|
|
2489
|
+
},
|
|
2490
|
+
// eslint-disable-next-line no-unused-vars
|
|
2491
|
+
defaultSortMethod: function defaultSortMethod(a, b, desc) {
|
|
2492
|
+
// force null and undefined to the bottom
|
|
2493
|
+
a = a === null || a === undefined ? '' : a;
|
|
2494
|
+
b = b === null || b === undefined ? '' : b;
|
|
2495
|
+
// force any string values to lowercase
|
|
2496
|
+
a = typeof a === 'string' ? a.toLowerCase() : a;
|
|
2497
|
+
b = typeof b === 'string' ? b.toLowerCase() : b;
|
|
2498
|
+
// Return either 1 or -1 to indicate a sort priority
|
|
2499
|
+
if (a > b) {
|
|
2500
|
+
return 1;
|
|
2501
|
+
}
|
|
2502
|
+
if (a < b) {
|
|
2503
|
+
return -1;
|
|
2504
|
+
}
|
|
2505
|
+
// returning 0, undefined or any falsey value will use subsequent sorts or
|
|
2506
|
+
// the index as a tiebreaker
|
|
2507
|
+
return 0;
|
|
2508
|
+
},
|
|
2509
|
+
|
|
2510
|
+
// Controlled State Props
|
|
2511
|
+
// page: undefined,
|
|
2512
|
+
// pageSize: undefined,
|
|
2513
|
+
// sorted: [],
|
|
2514
|
+
// filtered: [],
|
|
2515
|
+
// resized: [],
|
|
2516
|
+
// expanded: {},
|
|
2517
|
+
|
|
2518
|
+
// Controlled State Callbacks
|
|
2519
|
+
onPageChange: undefined,
|
|
2520
|
+
onPageSizeChange: undefined,
|
|
2521
|
+
onSortedChange: undefined,
|
|
2522
|
+
onFilteredChange: undefined,
|
|
2523
|
+
onResizedChange: undefined,
|
|
2524
|
+
onExpandedChange: undefined,
|
|
2525
|
+
|
|
2526
|
+
// Pivoting
|
|
2527
|
+
pivotBy: undefined,
|
|
2528
|
+
|
|
2529
|
+
// Key Constants
|
|
2530
|
+
pivotValKey: '_pivotVal',
|
|
2531
|
+
pivotIDKey: '_pivotID',
|
|
2532
|
+
subRowsKey: '_subRows',
|
|
2533
|
+
aggregatedKey: '_aggregated',
|
|
2534
|
+
nestingLevelKey: '_nestingLevel',
|
|
2535
|
+
originalKey: '_original',
|
|
2536
|
+
indexKey: '_index',
|
|
2537
|
+
groupedByPivotKey: '_groupedByPivot',
|
|
2538
|
+
|
|
2539
|
+
// Server-side Callbacks
|
|
2540
|
+
onFetchData: function onFetchData() {
|
|
2541
|
+
return null;
|
|
2542
|
+
},
|
|
2543
|
+
|
|
2544
|
+
// Classes
|
|
2545
|
+
className: '',
|
|
2546
|
+
style: {},
|
|
2547
|
+
|
|
2548
|
+
// Component decorators
|
|
2549
|
+
getProps: emptyObj,
|
|
2550
|
+
getTableProps: emptyObj,
|
|
2551
|
+
getTheadGroupProps: emptyObj,
|
|
2552
|
+
getTheadGroupTrProps: emptyObj,
|
|
2553
|
+
getTheadGroupThProps: emptyObj,
|
|
2554
|
+
getTheadProps: emptyObj,
|
|
2555
|
+
getTheadTrProps: emptyObj,
|
|
2556
|
+
getTheadThProps: emptyObj,
|
|
2557
|
+
getTheadFilterProps: emptyObj,
|
|
2558
|
+
getTheadFilterTrProps: emptyObj,
|
|
2559
|
+
getTheadFilterThProps: emptyObj,
|
|
2560
|
+
getTbodyProps: emptyObj,
|
|
2561
|
+
getTrGroupProps: emptyObj,
|
|
2562
|
+
getTrProps: emptyObj,
|
|
2563
|
+
getTdProps: emptyObj,
|
|
2564
|
+
getTfootProps: emptyObj,
|
|
2565
|
+
getTfootTrProps: emptyObj,
|
|
2566
|
+
getTfootTdProps: emptyObj,
|
|
2567
|
+
getPaginationProps: emptyObj,
|
|
2568
|
+
getLoadingProps: emptyObj,
|
|
2569
|
+
getNoDataProps: emptyObj,
|
|
2570
|
+
getResizerProps: emptyObj,
|
|
2571
|
+
|
|
2572
|
+
// Global Column Defaults
|
|
2573
|
+
column: {
|
|
2574
|
+
// Renderers
|
|
2575
|
+
Cell: undefined,
|
|
2576
|
+
Header: undefined,
|
|
2577
|
+
Footer: undefined,
|
|
2578
|
+
Aggregated: undefined,
|
|
2579
|
+
Pivot: undefined,
|
|
2580
|
+
PivotValue: undefined,
|
|
2581
|
+
Expander: undefined,
|
|
2582
|
+
Filter: undefined,
|
|
2583
|
+
Placeholder: undefined,
|
|
2584
|
+
// All Columns
|
|
2585
|
+
sortable: undefined, // use table default
|
|
2586
|
+
resizable: undefined, // use table default
|
|
2587
|
+
filterable: undefined, // use table default
|
|
2588
|
+
show: true,
|
|
2589
|
+
minWidth: 100,
|
|
2590
|
+
minResizeWidth: 11,
|
|
2591
|
+
// Cells only
|
|
2592
|
+
className: '',
|
|
2593
|
+
style: {},
|
|
2594
|
+
getProps: emptyObj,
|
|
2595
|
+
// Pivot only
|
|
2596
|
+
aggregate: undefined,
|
|
2597
|
+
// Headers only
|
|
2598
|
+
headerClassName: '',
|
|
2599
|
+
headerStyle: {},
|
|
2600
|
+
getHeaderProps: emptyObj,
|
|
2601
|
+
// Footers only
|
|
2602
|
+
footerClassName: '',
|
|
2603
|
+
footerStyle: {},
|
|
2604
|
+
getFooterProps: emptyObj,
|
|
2605
|
+
filterMethod: undefined,
|
|
2606
|
+
filterAll: false,
|
|
2607
|
+
sortMethod: undefined
|
|
2608
|
+
},
|
|
2609
|
+
|
|
2610
|
+
// Global Expander Column Defaults
|
|
2611
|
+
expanderDefaults: {
|
|
2612
|
+
sortable: false,
|
|
2613
|
+
resizable: false,
|
|
2614
|
+
filterable: false,
|
|
2615
|
+
width: 35
|
|
2616
|
+
},
|
|
2617
|
+
|
|
2618
|
+
pivotDefaults: {
|
|
2619
|
+
// extend the defaults for pivoted columns here
|
|
2620
|
+
},
|
|
2621
|
+
|
|
2622
|
+
// Text
|
|
2623
|
+
previousText: 'Previous',
|
|
2624
|
+
nextText: 'Next',
|
|
2625
|
+
loadingText: 'Loading...',
|
|
2626
|
+
noDataText: 'No rows found',
|
|
2627
|
+
pageText: 'Page',
|
|
2628
|
+
ofText: 'of',
|
|
2629
|
+
rowsText: 'rows',
|
|
2630
|
+
pageJumpText: 'jump to page',
|
|
2631
|
+
rowsSelectorText: 'rows per page',
|
|
2632
|
+
|
|
2633
|
+
// Components
|
|
2634
|
+
TableComponent: function TableComponent(_ref) {
|
|
2635
|
+
var children = _ref.children,
|
|
2636
|
+
className = _ref.className,
|
|
2637
|
+
rest = _objectWithoutProperties(_ref, ['children', 'className']);
|
|
2638
|
+
|
|
2639
|
+
return React__default["default"].createElement(
|
|
2640
|
+
'div',
|
|
2641
|
+
_extends$1({
|
|
2642
|
+
className: classnames__default["default"]('rt-table', className),
|
|
2643
|
+
role: 'grid'
|
|
2644
|
+
// tabIndex='0'
|
|
2645
|
+
}, rest),
|
|
2646
|
+
children
|
|
2647
|
+
);
|
|
2648
|
+
},
|
|
2649
|
+
TheadComponent: _.makeTemplateComponent('rt-thead', 'Thead'),
|
|
2650
|
+
TbodyComponent: _.makeTemplateComponent('rt-tbody', 'Tbody'),
|
|
2651
|
+
TrGroupComponent: function TrGroupComponent(_ref2) {
|
|
2652
|
+
var children = _ref2.children,
|
|
2653
|
+
className = _ref2.className,
|
|
2654
|
+
rest = _objectWithoutProperties(_ref2, ['children', 'className']);
|
|
2655
|
+
|
|
2656
|
+
return React__default["default"].createElement(
|
|
2657
|
+
'div',
|
|
2658
|
+
_extends$1({ className: classnames__default["default"]('rt-tr-group', className), role: 'rowgroup' }, rest),
|
|
2659
|
+
children
|
|
2660
|
+
);
|
|
2661
|
+
},
|
|
2662
|
+
TrComponent: function TrComponent(_ref3) {
|
|
2663
|
+
var children = _ref3.children,
|
|
2664
|
+
className = _ref3.className,
|
|
2665
|
+
rest = _objectWithoutProperties(_ref3, ['children', 'className']);
|
|
2666
|
+
|
|
2667
|
+
return React__default["default"].createElement(
|
|
2668
|
+
'div',
|
|
2669
|
+
_extends$1({ className: classnames__default["default"]('rt-tr', className), role: 'row' }, rest),
|
|
2670
|
+
children
|
|
2671
|
+
);
|
|
2672
|
+
},
|
|
2673
|
+
ThComponent: function ThComponent(_ref4) {
|
|
2674
|
+
var toggleSort = _ref4.toggleSort,
|
|
2675
|
+
className = _ref4.className,
|
|
2676
|
+
children = _ref4.children,
|
|
2677
|
+
rest = _objectWithoutProperties(_ref4, ['toggleSort', 'className', 'children']);
|
|
2678
|
+
|
|
2679
|
+
return (
|
|
2680
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
2681
|
+
React__default["default"].createElement(
|
|
2682
|
+
'div',
|
|
2683
|
+
_extends$1({
|
|
2684
|
+
className: classnames__default["default"]('rt-th', className),
|
|
2685
|
+
onClick: function onClick(e) {
|
|
2686
|
+
return toggleSort && toggleSort(e);
|
|
2687
|
+
},
|
|
2688
|
+
role: 'columnheader',
|
|
2689
|
+
tabIndex: '-1' // Resolves eslint issues without implementing keyboard navigation incorrectly
|
|
2690
|
+
}, rest),
|
|
2691
|
+
children
|
|
2692
|
+
)
|
|
2693
|
+
);
|
|
2694
|
+
},
|
|
2695
|
+
TdComponent: function TdComponent(_ref5) {
|
|
2696
|
+
_ref5.toggleSort;
|
|
2697
|
+
var className = _ref5.className,
|
|
2698
|
+
children = _ref5.children,
|
|
2699
|
+
rest = _objectWithoutProperties(_ref5, ['toggleSort', 'className', 'children']);
|
|
2700
|
+
|
|
2701
|
+
return React__default["default"].createElement(
|
|
2702
|
+
'div',
|
|
2703
|
+
_extends$1({ className: classnames__default["default"]('rt-td', className), role: 'gridcell' }, rest),
|
|
2704
|
+
children
|
|
2705
|
+
);
|
|
2706
|
+
},
|
|
2707
|
+
TfootComponent: _.makeTemplateComponent('rt-tfoot', 'Tfoot'),
|
|
2708
|
+
FilterComponent: function FilterComponent(_ref6) {
|
|
2709
|
+
var filter = _ref6.filter,
|
|
2710
|
+
_onChange = _ref6.onChange,
|
|
2711
|
+
column = _ref6.column;
|
|
2712
|
+
return React__default["default"].createElement('input', {
|
|
2713
|
+
type: 'text',
|
|
2714
|
+
style: {
|
|
2715
|
+
width: '100%'
|
|
2716
|
+
},
|
|
2717
|
+
placeholder: column.Placeholder,
|
|
2718
|
+
value: filter ? filter.value : '',
|
|
2719
|
+
onChange: function onChange(event) {
|
|
2720
|
+
return _onChange(event.target.value);
|
|
2721
|
+
}
|
|
2722
|
+
});
|
|
2723
|
+
},
|
|
2724
|
+
ExpanderComponent: function ExpanderComponent(_ref7) {
|
|
2725
|
+
var isExpanded = _ref7.isExpanded;
|
|
2726
|
+
return React__default["default"].createElement(
|
|
2727
|
+
'div',
|
|
2728
|
+
{ className: classnames__default["default"]('rt-expander', isExpanded && '-open') },
|
|
2729
|
+
'\u2022'
|
|
2730
|
+
);
|
|
2731
|
+
},
|
|
2732
|
+
PivotValueComponent: function PivotValueComponent(_ref8) {
|
|
2733
|
+
var subRows = _ref8.subRows,
|
|
2734
|
+
value = _ref8.value;
|
|
2735
|
+
return React__default["default"].createElement(
|
|
2736
|
+
'span',
|
|
2737
|
+
null,
|
|
2738
|
+
value,
|
|
2739
|
+
' ',
|
|
2740
|
+
subRows && '(' + subRows.length + ')'
|
|
2741
|
+
);
|
|
2742
|
+
},
|
|
2743
|
+
AggregatedComponent: function AggregatedComponent(_ref9) {
|
|
2744
|
+
var subRows = _ref9.subRows,
|
|
2745
|
+
column = _ref9.column;
|
|
2746
|
+
|
|
2747
|
+
var previewValues = subRows.filter(function (d) {
|
|
2748
|
+
return typeof d[column.id] !== 'undefined';
|
|
2749
|
+
}).map(function (row, i) {
|
|
2750
|
+
return (
|
|
2751
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
2752
|
+
React__default["default"].createElement(
|
|
2753
|
+
'span',
|
|
2754
|
+
{ key: i },
|
|
2755
|
+
row[column.id],
|
|
2756
|
+
i < subRows.length - 1 ? ', ' : ''
|
|
2757
|
+
)
|
|
2758
|
+
);
|
|
2759
|
+
});
|
|
2760
|
+
return React__default["default"].createElement(
|
|
2761
|
+
'span',
|
|
2762
|
+
null,
|
|
2763
|
+
previewValues
|
|
2764
|
+
);
|
|
2765
|
+
},
|
|
2766
|
+
PivotComponent: undefined, // this is a computed default generated using
|
|
2767
|
+
// the ExpanderComponent and PivotValueComponent at run-time in methods.js
|
|
2768
|
+
PaginationComponent: ReactTablePagination,
|
|
2769
|
+
PreviousComponent: undefined,
|
|
2770
|
+
NextComponent: undefined,
|
|
2771
|
+
LoadingComponent: function LoadingComponent(_ref10) {
|
|
2772
|
+
var className = _ref10.className,
|
|
2773
|
+
loading = _ref10.loading,
|
|
2774
|
+
loadingText = _ref10.loadingText,
|
|
2775
|
+
rest = _objectWithoutProperties(_ref10, ['className', 'loading', 'loadingText']);
|
|
2776
|
+
|
|
2777
|
+
return React__default["default"].createElement(
|
|
2778
|
+
'div',
|
|
2779
|
+
_extends$1({ className: classnames__default["default"]('-loading', { '-active': loading }, className) }, rest),
|
|
2780
|
+
React__default["default"].createElement(
|
|
2781
|
+
'div',
|
|
2782
|
+
{ className: '-loading-inner' },
|
|
2783
|
+
loadingText
|
|
2784
|
+
)
|
|
2785
|
+
);
|
|
2786
|
+
},
|
|
2787
|
+
NoDataComponent: _.makeTemplateComponent('rt-noData', 'NoData'),
|
|
2788
|
+
ResizerComponent: _.makeTemplateComponent('rt-resizer', 'Resizer'),
|
|
2789
|
+
PadRowComponent: function PadRowComponent() {
|
|
2790
|
+
return React__default["default"].createElement(
|
|
2791
|
+
'span',
|
|
2792
|
+
null,
|
|
2793
|
+
'\xA0'
|
|
2794
|
+
);
|
|
2795
|
+
}
|
|
2796
|
+
};
|
|
2797
|
+
|
|
2798
|
+
var propTypes$1 = {exports: {}};
|
|
2799
|
+
|
|
2800
|
+
var reactIs = {exports: {}};
|
|
2801
|
+
|
|
2802
|
+
var reactIs_production_min = {};
|
|
2803
|
+
|
|
2804
|
+
/** @license React v16.8.6
|
|
2805
|
+
* react-is.production.min.js
|
|
2806
|
+
*
|
|
2807
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2808
|
+
*
|
|
2809
|
+
* This source code is licensed under the MIT license found in the
|
|
2810
|
+
* LICENSE file in the root directory of this source tree.
|
|
2811
|
+
*/
|
|
2812
|
+
|
|
2813
|
+
var hasRequiredReactIs_production_min;
|
|
2814
|
+
|
|
2815
|
+
function requireReactIs_production_min () {
|
|
2816
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
2817
|
+
hasRequiredReactIs_production_min = 1;
|
|
2818
|
+
Object.defineProperty(reactIs_production_min,"__esModule",{value:!0});
|
|
2819
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"):
|
|
2820
|
+
60115,r=b?Symbol.for("react.lazy"):60116;function t(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case r:case q:case d:return u}}}function v(a){return t(a)===m}reactIs_production_min.typeOf=t;reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;
|
|
2821
|
+
reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=r;reactIs_production_min.Memo=q;reactIs_production_min.Portal=d;reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};reactIs_production_min.isAsyncMode=function(a){return v(a)||t(a)===l};reactIs_production_min.isConcurrentMode=v;reactIs_production_min.isContextConsumer=function(a){return t(a)===k};
|
|
2822
|
+
reactIs_production_min.isContextProvider=function(a){return t(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return t(a)===n};reactIs_production_min.isFragment=function(a){return t(a)===e};reactIs_production_min.isLazy=function(a){return t(a)===r};reactIs_production_min.isMemo=function(a){return t(a)===q};reactIs_production_min.isPortal=function(a){return t(a)===d};reactIs_production_min.isProfiler=function(a){return t(a)===g};reactIs_production_min.isStrictMode=function(a){return t(a)===f};
|
|
2823
|
+
reactIs_production_min.isSuspense=function(a){return t(a)===p};
|
|
2824
|
+
return reactIs_production_min;
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
var reactIs_development = {};
|
|
2828
|
+
|
|
2829
|
+
/** @license React v16.8.6
|
|
2830
|
+
* react-is.development.js
|
|
2831
|
+
*
|
|
2832
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2833
|
+
*
|
|
2834
|
+
* This source code is licensed under the MIT license found in the
|
|
2835
|
+
* LICENSE file in the root directory of this source tree.
|
|
2836
|
+
*/
|
|
2837
|
+
|
|
2838
|
+
var hasRequiredReactIs_development;
|
|
2839
|
+
|
|
2840
|
+
function requireReactIs_development () {
|
|
2841
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
2842
|
+
hasRequiredReactIs_development = 1;
|
|
2843
|
+
(function (exports) {
|
|
2844
|
+
|
|
2845
|
+
|
|
2846
|
+
|
|
2847
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2848
|
+
(function() {
|
|
2849
|
+
|
|
2850
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2851
|
+
|
|
2852
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
2853
|
+
// nor polyfill, then a plain number is used for performance.
|
|
2854
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
2855
|
+
|
|
2856
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
2857
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
2858
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
2859
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
2860
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
2861
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
2862
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
2863
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
2864
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2865
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2866
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2867
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2868
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2869
|
+
|
|
2870
|
+
function isValidElementType(type) {
|
|
2871
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
|
2872
|
+
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
2873
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
/**
|
|
2877
|
+
* Forked from fbjs/warning:
|
|
2878
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
2879
|
+
*
|
|
2880
|
+
* Only change is we use console.warn instead of console.error,
|
|
2881
|
+
* and do nothing when 'console' is not supported.
|
|
2882
|
+
* This really simplifies the code.
|
|
2883
|
+
* ---
|
|
2884
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
2885
|
+
* This can be used to log issues in development environments in critical
|
|
2886
|
+
* paths. Removing the logging code for production environments will keep the
|
|
2887
|
+
* same logic and follow the same code paths.
|
|
2888
|
+
*/
|
|
2889
|
+
|
|
2890
|
+
var lowPriorityWarning = function () {};
|
|
2891
|
+
|
|
2892
|
+
{
|
|
2893
|
+
var printWarning = function (format) {
|
|
2894
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2895
|
+
args[_key - 1] = arguments[_key];
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
var argIndex = 0;
|
|
2899
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
2900
|
+
return args[argIndex++];
|
|
2901
|
+
});
|
|
2902
|
+
if (typeof console !== 'undefined') {
|
|
2903
|
+
console.warn(message);
|
|
2904
|
+
}
|
|
2905
|
+
try {
|
|
2906
|
+
// --- Welcome to debugging React ---
|
|
2907
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
2908
|
+
// to find the callsite that caused this warning to fire.
|
|
2909
|
+
throw new Error(message);
|
|
2910
|
+
} catch (x) {}
|
|
2911
|
+
};
|
|
2912
|
+
|
|
2913
|
+
lowPriorityWarning = function (condition, format) {
|
|
2914
|
+
if (format === undefined) {
|
|
2915
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
2916
|
+
}
|
|
2917
|
+
if (!condition) {
|
|
2918
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
2919
|
+
args[_key2 - 2] = arguments[_key2];
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
2928
|
+
|
|
2929
|
+
function typeOf(object) {
|
|
2930
|
+
if (typeof object === 'object' && object !== null) {
|
|
2931
|
+
var $$typeof = object.$$typeof;
|
|
2932
|
+
switch ($$typeof) {
|
|
2933
|
+
case REACT_ELEMENT_TYPE:
|
|
2934
|
+
var type = object.type;
|
|
2935
|
+
|
|
2936
|
+
switch (type) {
|
|
2937
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
2938
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
2939
|
+
case REACT_FRAGMENT_TYPE:
|
|
2940
|
+
case REACT_PROFILER_TYPE:
|
|
2941
|
+
case REACT_STRICT_MODE_TYPE:
|
|
2942
|
+
case REACT_SUSPENSE_TYPE:
|
|
2943
|
+
return type;
|
|
2944
|
+
default:
|
|
2945
|
+
var $$typeofType = type && type.$$typeof;
|
|
2946
|
+
|
|
2947
|
+
switch ($$typeofType) {
|
|
2948
|
+
case REACT_CONTEXT_TYPE:
|
|
2949
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2950
|
+
case REACT_PROVIDER_TYPE:
|
|
2951
|
+
return $$typeofType;
|
|
2952
|
+
default:
|
|
2953
|
+
return $$typeof;
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
case REACT_LAZY_TYPE:
|
|
2957
|
+
case REACT_MEMO_TYPE:
|
|
2958
|
+
case REACT_PORTAL_TYPE:
|
|
2959
|
+
return $$typeof;
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
return undefined;
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
// AsyncMode is deprecated along with isAsyncMode
|
|
2967
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
2968
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
2969
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
2970
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
2971
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
2972
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
2973
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
2974
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
2975
|
+
var Memo = REACT_MEMO_TYPE;
|
|
2976
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
2977
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
2978
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2979
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
2980
|
+
|
|
2981
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
2982
|
+
|
|
2983
|
+
// AsyncMode should be deprecated
|
|
2984
|
+
function isAsyncMode(object) {
|
|
2985
|
+
{
|
|
2986
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
2987
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
2988
|
+
lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
2992
|
+
}
|
|
2993
|
+
function isConcurrentMode(object) {
|
|
2994
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
2995
|
+
}
|
|
2996
|
+
function isContextConsumer(object) {
|
|
2997
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
2998
|
+
}
|
|
2999
|
+
function isContextProvider(object) {
|
|
3000
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
3001
|
+
}
|
|
3002
|
+
function isElement(object) {
|
|
3003
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
3004
|
+
}
|
|
3005
|
+
function isForwardRef(object) {
|
|
3006
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
3007
|
+
}
|
|
3008
|
+
function isFragment(object) {
|
|
3009
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
3010
|
+
}
|
|
3011
|
+
function isLazy(object) {
|
|
3012
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
3013
|
+
}
|
|
3014
|
+
function isMemo(object) {
|
|
3015
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
3016
|
+
}
|
|
3017
|
+
function isPortal(object) {
|
|
3018
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
3019
|
+
}
|
|
3020
|
+
function isProfiler(object) {
|
|
3021
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
3022
|
+
}
|
|
3023
|
+
function isStrictMode(object) {
|
|
3024
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
3025
|
+
}
|
|
3026
|
+
function isSuspense(object) {
|
|
3027
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
exports.typeOf = typeOf;
|
|
3031
|
+
exports.AsyncMode = AsyncMode;
|
|
3032
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
3033
|
+
exports.ContextConsumer = ContextConsumer;
|
|
3034
|
+
exports.ContextProvider = ContextProvider;
|
|
3035
|
+
exports.Element = Element;
|
|
3036
|
+
exports.ForwardRef = ForwardRef;
|
|
3037
|
+
exports.Fragment = Fragment;
|
|
3038
|
+
exports.Lazy = Lazy;
|
|
3039
|
+
exports.Memo = Memo;
|
|
3040
|
+
exports.Portal = Portal;
|
|
3041
|
+
exports.Profiler = Profiler;
|
|
3042
|
+
exports.StrictMode = StrictMode;
|
|
3043
|
+
exports.Suspense = Suspense;
|
|
3044
|
+
exports.isValidElementType = isValidElementType;
|
|
3045
|
+
exports.isAsyncMode = isAsyncMode;
|
|
3046
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
3047
|
+
exports.isContextConsumer = isContextConsumer;
|
|
3048
|
+
exports.isContextProvider = isContextProvider;
|
|
3049
|
+
exports.isElement = isElement;
|
|
3050
|
+
exports.isForwardRef = isForwardRef;
|
|
3051
|
+
exports.isFragment = isFragment;
|
|
3052
|
+
exports.isLazy = isLazy;
|
|
3053
|
+
exports.isMemo = isMemo;
|
|
3054
|
+
exports.isPortal = isPortal;
|
|
3055
|
+
exports.isProfiler = isProfiler;
|
|
3056
|
+
exports.isStrictMode = isStrictMode;
|
|
3057
|
+
exports.isSuspense = isSuspense;
|
|
3058
|
+
})();
|
|
3059
|
+
}
|
|
3060
|
+
} (reactIs_development));
|
|
3061
|
+
return reactIs_development;
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
var hasRequiredReactIs;
|
|
3065
|
+
|
|
3066
|
+
function requireReactIs () {
|
|
3067
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
3068
|
+
hasRequiredReactIs = 1;
|
|
3069
|
+
(function (module) {
|
|
3070
|
+
|
|
3071
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3072
|
+
module.exports = requireReactIs_production_min();
|
|
3073
|
+
} else {
|
|
3074
|
+
module.exports = requireReactIs_development();
|
|
3075
|
+
}
|
|
3076
|
+
} (reactIs));
|
|
3077
|
+
return reactIs.exports;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
/*
|
|
3081
|
+
object-assign
|
|
3082
|
+
(c) Sindre Sorhus
|
|
3083
|
+
@license MIT
|
|
3084
|
+
*/
|
|
3085
|
+
|
|
3086
|
+
var objectAssign;
|
|
3087
|
+
var hasRequiredObjectAssign;
|
|
3088
|
+
|
|
3089
|
+
function requireObjectAssign () {
|
|
3090
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
3091
|
+
hasRequiredObjectAssign = 1;
|
|
3092
|
+
/* eslint-disable no-unused-vars */
|
|
3093
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
3094
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3095
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
3096
|
+
|
|
3097
|
+
function toObject(val) {
|
|
3098
|
+
if (val === null || val === undefined) {
|
|
3099
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
return Object(val);
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
function shouldUseNative() {
|
|
3106
|
+
try {
|
|
3107
|
+
if (!Object.assign) {
|
|
3108
|
+
return false;
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
3112
|
+
|
|
3113
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
3114
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
3115
|
+
test1[5] = 'de';
|
|
3116
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
3117
|
+
return false;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
3121
|
+
var test2 = {};
|
|
3122
|
+
for (var i = 0; i < 10; i++) {
|
|
3123
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
3124
|
+
}
|
|
3125
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
3126
|
+
return test2[n];
|
|
3127
|
+
});
|
|
3128
|
+
if (order2.join('') !== '0123456789') {
|
|
3129
|
+
return false;
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
3133
|
+
var test3 = {};
|
|
3134
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
3135
|
+
test3[letter] = letter;
|
|
3136
|
+
});
|
|
3137
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
3138
|
+
'abcdefghijklmnopqrst') {
|
|
3139
|
+
return false;
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
return true;
|
|
3143
|
+
} catch (err) {
|
|
3144
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
3145
|
+
return false;
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
3150
|
+
var from;
|
|
3151
|
+
var to = toObject(target);
|
|
3152
|
+
var symbols;
|
|
3153
|
+
|
|
3154
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
3155
|
+
from = Object(arguments[s]);
|
|
3156
|
+
|
|
3157
|
+
for (var key in from) {
|
|
3158
|
+
if (hasOwnProperty.call(from, key)) {
|
|
3159
|
+
to[key] = from[key];
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
if (getOwnPropertySymbols) {
|
|
3164
|
+
symbols = getOwnPropertySymbols(from);
|
|
3165
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
3166
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
3167
|
+
to[symbols[i]] = from[symbols[i]];
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
return to;
|
|
3174
|
+
};
|
|
3175
|
+
return objectAssign;
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
/**
|
|
3179
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3180
|
+
*
|
|
3181
|
+
* This source code is licensed under the MIT license found in the
|
|
3182
|
+
* LICENSE file in the root directory of this source tree.
|
|
3183
|
+
*/
|
|
3184
|
+
|
|
3185
|
+
var ReactPropTypesSecret_1;
|
|
3186
|
+
var hasRequiredReactPropTypesSecret;
|
|
3187
|
+
|
|
3188
|
+
function requireReactPropTypesSecret () {
|
|
3189
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
3190
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
3191
|
+
|
|
3192
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
3193
|
+
|
|
3194
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
3195
|
+
return ReactPropTypesSecret_1;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3200
|
+
*
|
|
3201
|
+
* This source code is licensed under the MIT license found in the
|
|
3202
|
+
* LICENSE file in the root directory of this source tree.
|
|
3203
|
+
*/
|
|
3204
|
+
|
|
3205
|
+
var checkPropTypes_1;
|
|
3206
|
+
var hasRequiredCheckPropTypes;
|
|
3207
|
+
|
|
3208
|
+
function requireCheckPropTypes () {
|
|
3209
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
3210
|
+
hasRequiredCheckPropTypes = 1;
|
|
3211
|
+
|
|
3212
|
+
var printWarning = function() {};
|
|
3213
|
+
|
|
3214
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3215
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
3216
|
+
var loggedTypeFailures = {};
|
|
3217
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
3218
|
+
|
|
3219
|
+
printWarning = function(text) {
|
|
3220
|
+
var message = 'Warning: ' + text;
|
|
3221
|
+
if (typeof console !== 'undefined') {
|
|
3222
|
+
console.error(message);
|
|
3223
|
+
}
|
|
3224
|
+
try {
|
|
3225
|
+
// --- Welcome to debugging React ---
|
|
3226
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
3227
|
+
// to find the callsite that caused this warning to fire.
|
|
3228
|
+
throw new Error(message);
|
|
3229
|
+
} catch (x) {}
|
|
3230
|
+
};
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
/**
|
|
3234
|
+
* Assert that the values match with the type specs.
|
|
3235
|
+
* Error messages are memorized and will only be shown once.
|
|
3236
|
+
*
|
|
3237
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
3238
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
3239
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
3240
|
+
* @param {string} componentName Name of the component for error messages.
|
|
3241
|
+
* @param {?Function} getStack Returns the component stack.
|
|
3242
|
+
* @private
|
|
3243
|
+
*/
|
|
3244
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
3245
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3246
|
+
for (var typeSpecName in typeSpecs) {
|
|
3247
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
3248
|
+
var error;
|
|
3249
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
3250
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
3251
|
+
// After these have been cleaned up, we'll let them throw.
|
|
3252
|
+
try {
|
|
3253
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
3254
|
+
// behavior as without this statement except with a better message.
|
|
3255
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
3256
|
+
var err = Error(
|
|
3257
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
3258
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
3259
|
+
);
|
|
3260
|
+
err.name = 'Invariant Violation';
|
|
3261
|
+
throw err;
|
|
3262
|
+
}
|
|
3263
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
3264
|
+
} catch (ex) {
|
|
3265
|
+
error = ex;
|
|
3266
|
+
}
|
|
3267
|
+
if (error && !(error instanceof Error)) {
|
|
3268
|
+
printWarning(
|
|
3269
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
3270
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
3271
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
3272
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
3273
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
3274
|
+
'shape all require an argument).'
|
|
3275
|
+
);
|
|
3276
|
+
}
|
|
3277
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
3278
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
3279
|
+
// same error.
|
|
3280
|
+
loggedTypeFailures[error.message] = true;
|
|
3281
|
+
|
|
3282
|
+
var stack = getStack ? getStack() : '';
|
|
3283
|
+
|
|
3284
|
+
printWarning(
|
|
3285
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
3286
|
+
);
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
/**
|
|
3294
|
+
* Resets warning cache when testing.
|
|
3295
|
+
*
|
|
3296
|
+
* @private
|
|
3297
|
+
*/
|
|
3298
|
+
checkPropTypes.resetWarningCache = function() {
|
|
3299
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3300
|
+
loggedTypeFailures = {};
|
|
3301
|
+
}
|
|
3302
|
+
};
|
|
3303
|
+
|
|
3304
|
+
checkPropTypes_1 = checkPropTypes;
|
|
3305
|
+
return checkPropTypes_1;
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
/**
|
|
3309
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3310
|
+
*
|
|
3311
|
+
* This source code is licensed under the MIT license found in the
|
|
3312
|
+
* LICENSE file in the root directory of this source tree.
|
|
3313
|
+
*/
|
|
3314
|
+
|
|
3315
|
+
var factoryWithTypeCheckers;
|
|
3316
|
+
var hasRequiredFactoryWithTypeCheckers;
|
|
3317
|
+
|
|
3318
|
+
function requireFactoryWithTypeCheckers () {
|
|
3319
|
+
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
3320
|
+
hasRequiredFactoryWithTypeCheckers = 1;
|
|
3321
|
+
|
|
3322
|
+
var ReactIs = requireReactIs();
|
|
3323
|
+
var assign = requireObjectAssign();
|
|
3324
|
+
|
|
3325
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
3326
|
+
var checkPropTypes = requireCheckPropTypes();
|
|
3327
|
+
|
|
3328
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
3329
|
+
var printWarning = function() {};
|
|
3330
|
+
|
|
3331
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3332
|
+
printWarning = function(text) {
|
|
3333
|
+
var message = 'Warning: ' + text;
|
|
3334
|
+
if (typeof console !== 'undefined') {
|
|
3335
|
+
console.error(message);
|
|
3336
|
+
}
|
|
3337
|
+
try {
|
|
3338
|
+
// --- Welcome to debugging React ---
|
|
3339
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
3340
|
+
// to find the callsite that caused this warning to fire.
|
|
3341
|
+
throw new Error(message);
|
|
3342
|
+
} catch (x) {}
|
|
3343
|
+
};
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
function emptyFunctionThatReturnsNull() {
|
|
3347
|
+
return null;
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
3351
|
+
/* global Symbol */
|
|
3352
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
3353
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
3354
|
+
|
|
3355
|
+
/**
|
|
3356
|
+
* Returns the iterator method function contained on the iterable object.
|
|
3357
|
+
*
|
|
3358
|
+
* Be sure to invoke the function with the iterable as context:
|
|
3359
|
+
*
|
|
3360
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
3361
|
+
* if (iteratorFn) {
|
|
3362
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
3363
|
+
* ...
|
|
3364
|
+
* }
|
|
3365
|
+
*
|
|
3366
|
+
* @param {?object} maybeIterable
|
|
3367
|
+
* @return {?function}
|
|
3368
|
+
*/
|
|
3369
|
+
function getIteratorFn(maybeIterable) {
|
|
3370
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
3371
|
+
if (typeof iteratorFn === 'function') {
|
|
3372
|
+
return iteratorFn;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
/**
|
|
3377
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
3378
|
+
* supplied to React components. Example usage:
|
|
3379
|
+
*
|
|
3380
|
+
* var Props = require('ReactPropTypes');
|
|
3381
|
+
* var MyArticle = React.createClass({
|
|
3382
|
+
* propTypes: {
|
|
3383
|
+
* // An optional string prop named "description".
|
|
3384
|
+
* description: Props.string,
|
|
3385
|
+
*
|
|
3386
|
+
* // A required enum prop named "category".
|
|
3387
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
3388
|
+
*
|
|
3389
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
3390
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
3391
|
+
* },
|
|
3392
|
+
* render: function() { ... }
|
|
3393
|
+
* });
|
|
3394
|
+
*
|
|
3395
|
+
* A more formal specification of how these methods are used:
|
|
3396
|
+
*
|
|
3397
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
3398
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
3399
|
+
*
|
|
3400
|
+
* Each and every declaration produces a function with the same signature. This
|
|
3401
|
+
* allows the creation of custom validation functions. For example:
|
|
3402
|
+
*
|
|
3403
|
+
* var MyLink = React.createClass({
|
|
3404
|
+
* propTypes: {
|
|
3405
|
+
* // An optional string or URI prop named "href".
|
|
3406
|
+
* href: function(props, propName, componentName) {
|
|
3407
|
+
* var propValue = props[propName];
|
|
3408
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
3409
|
+
* !(propValue instanceof URI)) {
|
|
3410
|
+
* return new Error(
|
|
3411
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
3412
|
+
* componentName
|
|
3413
|
+
* );
|
|
3414
|
+
* }
|
|
3415
|
+
* }
|
|
3416
|
+
* },
|
|
3417
|
+
* render: function() {...}
|
|
3418
|
+
* });
|
|
3419
|
+
*
|
|
3420
|
+
* @internal
|
|
3421
|
+
*/
|
|
3422
|
+
|
|
3423
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
3424
|
+
|
|
3425
|
+
// Important!
|
|
3426
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
3427
|
+
var ReactPropTypes = {
|
|
3428
|
+
array: createPrimitiveTypeChecker('array'),
|
|
3429
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
3430
|
+
func: createPrimitiveTypeChecker('function'),
|
|
3431
|
+
number: createPrimitiveTypeChecker('number'),
|
|
3432
|
+
object: createPrimitiveTypeChecker('object'),
|
|
3433
|
+
string: createPrimitiveTypeChecker('string'),
|
|
3434
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
3435
|
+
|
|
3436
|
+
any: createAnyTypeChecker(),
|
|
3437
|
+
arrayOf: createArrayOfTypeChecker,
|
|
3438
|
+
element: createElementTypeChecker(),
|
|
3439
|
+
elementType: createElementTypeTypeChecker(),
|
|
3440
|
+
instanceOf: createInstanceTypeChecker,
|
|
3441
|
+
node: createNodeChecker(),
|
|
3442
|
+
objectOf: createObjectOfTypeChecker,
|
|
3443
|
+
oneOf: createEnumTypeChecker,
|
|
3444
|
+
oneOfType: createUnionTypeChecker,
|
|
3445
|
+
shape: createShapeTypeChecker,
|
|
3446
|
+
exact: createStrictShapeTypeChecker,
|
|
3447
|
+
};
|
|
3448
|
+
|
|
3449
|
+
/**
|
|
3450
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
3451
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
3452
|
+
*/
|
|
3453
|
+
/*eslint-disable no-self-compare*/
|
|
3454
|
+
function is(x, y) {
|
|
3455
|
+
// SameValue algorithm
|
|
3456
|
+
if (x === y) {
|
|
3457
|
+
// Steps 1-5, 7-10
|
|
3458
|
+
// Steps 6.b-6.e: +0 != -0
|
|
3459
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
3460
|
+
} else {
|
|
3461
|
+
// Step 6.a: NaN == NaN
|
|
3462
|
+
return x !== x && y !== y;
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
/*eslint-enable no-self-compare*/
|
|
3466
|
+
|
|
3467
|
+
/**
|
|
3468
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
3469
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
3470
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
3471
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
3472
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
3473
|
+
*/
|
|
3474
|
+
function PropTypeError(message) {
|
|
3475
|
+
this.message = message;
|
|
3476
|
+
this.stack = '';
|
|
3477
|
+
}
|
|
3478
|
+
// Make `instanceof Error` still work for returned errors.
|
|
3479
|
+
PropTypeError.prototype = Error.prototype;
|
|
3480
|
+
|
|
3481
|
+
function createChainableTypeChecker(validate) {
|
|
3482
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3483
|
+
var manualPropTypeCallCache = {};
|
|
3484
|
+
var manualPropTypeWarningCount = 0;
|
|
3485
|
+
}
|
|
3486
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
3487
|
+
componentName = componentName || ANONYMOUS;
|
|
3488
|
+
propFullName = propFullName || propName;
|
|
3489
|
+
|
|
3490
|
+
if (secret !== ReactPropTypesSecret) {
|
|
3491
|
+
if (throwOnDirectAccess) {
|
|
3492
|
+
// New behavior only for users of `prop-types` package
|
|
3493
|
+
var err = new Error(
|
|
3494
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
3495
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
3496
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
3497
|
+
);
|
|
3498
|
+
err.name = 'Invariant Violation';
|
|
3499
|
+
throw err;
|
|
3500
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
3501
|
+
// Old behavior for people using React.PropTypes
|
|
3502
|
+
var cacheKey = componentName + ':' + propName;
|
|
3503
|
+
if (
|
|
3504
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
3505
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
3506
|
+
manualPropTypeWarningCount < 3
|
|
3507
|
+
) {
|
|
3508
|
+
printWarning(
|
|
3509
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
3510
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
3511
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
3512
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
3513
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
3514
|
+
);
|
|
3515
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
3516
|
+
manualPropTypeWarningCount++;
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
if (props[propName] == null) {
|
|
3521
|
+
if (isRequired) {
|
|
3522
|
+
if (props[propName] === null) {
|
|
3523
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
3524
|
+
}
|
|
3525
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
3526
|
+
}
|
|
3527
|
+
return null;
|
|
3528
|
+
} else {
|
|
3529
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
3534
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
3535
|
+
|
|
3536
|
+
return chainedCheckType;
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
3540
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
3541
|
+
var propValue = props[propName];
|
|
3542
|
+
var propType = getPropType(propValue);
|
|
3543
|
+
if (propType !== expectedType) {
|
|
3544
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
3545
|
+
// check, but we can offer a more precise error message here rather than
|
|
3546
|
+
// 'of type `object`'.
|
|
3547
|
+
var preciseType = getPreciseType(propValue);
|
|
3548
|
+
|
|
3549
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
3550
|
+
}
|
|
3551
|
+
return null;
|
|
3552
|
+
}
|
|
3553
|
+
return createChainableTypeChecker(validate);
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
function createAnyTypeChecker() {
|
|
3557
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
3561
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3562
|
+
if (typeof typeChecker !== 'function') {
|
|
3563
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
3564
|
+
}
|
|
3565
|
+
var propValue = props[propName];
|
|
3566
|
+
if (!Array.isArray(propValue)) {
|
|
3567
|
+
var propType = getPropType(propValue);
|
|
3568
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
3569
|
+
}
|
|
3570
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
3571
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
3572
|
+
if (error instanceof Error) {
|
|
3573
|
+
return error;
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
return null;
|
|
3577
|
+
}
|
|
3578
|
+
return createChainableTypeChecker(validate);
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
function createElementTypeChecker() {
|
|
3582
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3583
|
+
var propValue = props[propName];
|
|
3584
|
+
if (!isValidElement(propValue)) {
|
|
3585
|
+
var propType = getPropType(propValue);
|
|
3586
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
3587
|
+
}
|
|
3588
|
+
return null;
|
|
3589
|
+
}
|
|
3590
|
+
return createChainableTypeChecker(validate);
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
function createElementTypeTypeChecker() {
|
|
3594
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3595
|
+
var propValue = props[propName];
|
|
3596
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
3597
|
+
var propType = getPropType(propValue);
|
|
3598
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
3599
|
+
}
|
|
3600
|
+
return null;
|
|
3601
|
+
}
|
|
3602
|
+
return createChainableTypeChecker(validate);
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
3606
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3607
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
3608
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
3609
|
+
var actualClassName = getClassName(props[propName]);
|
|
3610
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
3611
|
+
}
|
|
3612
|
+
return null;
|
|
3613
|
+
}
|
|
3614
|
+
return createChainableTypeChecker(validate);
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
function createEnumTypeChecker(expectedValues) {
|
|
3618
|
+
if (!Array.isArray(expectedValues)) {
|
|
3619
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3620
|
+
if (arguments.length > 1) {
|
|
3621
|
+
printWarning(
|
|
3622
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
3623
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
3624
|
+
);
|
|
3625
|
+
} else {
|
|
3626
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
return emptyFunctionThatReturnsNull;
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3633
|
+
var propValue = props[propName];
|
|
3634
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
3635
|
+
if (is(propValue, expectedValues[i])) {
|
|
3636
|
+
return null;
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3640
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
3641
|
+
var type = getPreciseType(value);
|
|
3642
|
+
if (type === 'symbol') {
|
|
3643
|
+
return String(value);
|
|
3644
|
+
}
|
|
3645
|
+
return value;
|
|
3646
|
+
});
|
|
3647
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
3648
|
+
}
|
|
3649
|
+
return createChainableTypeChecker(validate);
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
3653
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3654
|
+
if (typeof typeChecker !== 'function') {
|
|
3655
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
3656
|
+
}
|
|
3657
|
+
var propValue = props[propName];
|
|
3658
|
+
var propType = getPropType(propValue);
|
|
3659
|
+
if (propType !== 'object') {
|
|
3660
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
3661
|
+
}
|
|
3662
|
+
for (var key in propValue) {
|
|
3663
|
+
if (has(propValue, key)) {
|
|
3664
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
3665
|
+
if (error instanceof Error) {
|
|
3666
|
+
return error;
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
return null;
|
|
3671
|
+
}
|
|
3672
|
+
return createChainableTypeChecker(validate);
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3675
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
3676
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
3677
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
3678
|
+
return emptyFunctionThatReturnsNull;
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
3682
|
+
var checker = arrayOfTypeCheckers[i];
|
|
3683
|
+
if (typeof checker !== 'function') {
|
|
3684
|
+
printWarning(
|
|
3685
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
3686
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
3687
|
+
);
|
|
3688
|
+
return emptyFunctionThatReturnsNull;
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3692
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3693
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
3694
|
+
var checker = arrayOfTypeCheckers[i];
|
|
3695
|
+
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
|
3696
|
+
return null;
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
3701
|
+
}
|
|
3702
|
+
return createChainableTypeChecker(validate);
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
function createNodeChecker() {
|
|
3706
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3707
|
+
if (!isNode(props[propName])) {
|
|
3708
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
3709
|
+
}
|
|
3710
|
+
return null;
|
|
3711
|
+
}
|
|
3712
|
+
return createChainableTypeChecker(validate);
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3715
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
3716
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3717
|
+
var propValue = props[propName];
|
|
3718
|
+
var propType = getPropType(propValue);
|
|
3719
|
+
if (propType !== 'object') {
|
|
3720
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
3721
|
+
}
|
|
3722
|
+
for (var key in shapeTypes) {
|
|
3723
|
+
var checker = shapeTypes[key];
|
|
3724
|
+
if (!checker) {
|
|
3725
|
+
continue;
|
|
3726
|
+
}
|
|
3727
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
3728
|
+
if (error) {
|
|
3729
|
+
return error;
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
return null;
|
|
3733
|
+
}
|
|
3734
|
+
return createChainableTypeChecker(validate);
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
3738
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3739
|
+
var propValue = props[propName];
|
|
3740
|
+
var propType = getPropType(propValue);
|
|
3741
|
+
if (propType !== 'object') {
|
|
3742
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
3743
|
+
}
|
|
3744
|
+
// We need to check all keys in case some are required but missing from
|
|
3745
|
+
// props.
|
|
3746
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
3747
|
+
for (var key in allKeys) {
|
|
3748
|
+
var checker = shapeTypes[key];
|
|
3749
|
+
if (!checker) {
|
|
3750
|
+
return new PropTypeError(
|
|
3751
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
3752
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
3753
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
3754
|
+
);
|
|
3755
|
+
}
|
|
3756
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
3757
|
+
if (error) {
|
|
3758
|
+
return error;
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
return null;
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
return createChainableTypeChecker(validate);
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
function isNode(propValue) {
|
|
3768
|
+
switch (typeof propValue) {
|
|
3769
|
+
case 'number':
|
|
3770
|
+
case 'string':
|
|
3771
|
+
case 'undefined':
|
|
3772
|
+
return true;
|
|
3773
|
+
case 'boolean':
|
|
3774
|
+
return !propValue;
|
|
3775
|
+
case 'object':
|
|
3776
|
+
if (Array.isArray(propValue)) {
|
|
3777
|
+
return propValue.every(isNode);
|
|
3778
|
+
}
|
|
3779
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
3780
|
+
return true;
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
3784
|
+
if (iteratorFn) {
|
|
3785
|
+
var iterator = iteratorFn.call(propValue);
|
|
3786
|
+
var step;
|
|
3787
|
+
if (iteratorFn !== propValue.entries) {
|
|
3788
|
+
while (!(step = iterator.next()).done) {
|
|
3789
|
+
if (!isNode(step.value)) {
|
|
3790
|
+
return false;
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
} else {
|
|
3794
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
3795
|
+
while (!(step = iterator.next()).done) {
|
|
3796
|
+
var entry = step.value;
|
|
3797
|
+
if (entry) {
|
|
3798
|
+
if (!isNode(entry[1])) {
|
|
3799
|
+
return false;
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
} else {
|
|
3805
|
+
return false;
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3808
|
+
return true;
|
|
3809
|
+
default:
|
|
3810
|
+
return false;
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3814
|
+
function isSymbol(propType, propValue) {
|
|
3815
|
+
// Native Symbol.
|
|
3816
|
+
if (propType === 'symbol') {
|
|
3817
|
+
return true;
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
// falsy value can't be a Symbol
|
|
3821
|
+
if (!propValue) {
|
|
3822
|
+
return false;
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
3826
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
3827
|
+
return true;
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
3831
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
3832
|
+
return true;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
return false;
|
|
3836
|
+
}
|
|
3837
|
+
|
|
3838
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
3839
|
+
function getPropType(propValue) {
|
|
3840
|
+
var propType = typeof propValue;
|
|
3841
|
+
if (Array.isArray(propValue)) {
|
|
3842
|
+
return 'array';
|
|
3843
|
+
}
|
|
3844
|
+
if (propValue instanceof RegExp) {
|
|
3845
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
3846
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
3847
|
+
// passes PropTypes.object.
|
|
3848
|
+
return 'object';
|
|
3849
|
+
}
|
|
3850
|
+
if (isSymbol(propType, propValue)) {
|
|
3851
|
+
return 'symbol';
|
|
3852
|
+
}
|
|
3853
|
+
return propType;
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
3857
|
+
// See `createPrimitiveTypeChecker`.
|
|
3858
|
+
function getPreciseType(propValue) {
|
|
3859
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
3860
|
+
return '' + propValue;
|
|
3861
|
+
}
|
|
3862
|
+
var propType = getPropType(propValue);
|
|
3863
|
+
if (propType === 'object') {
|
|
3864
|
+
if (propValue instanceof Date) {
|
|
3865
|
+
return 'date';
|
|
3866
|
+
} else if (propValue instanceof RegExp) {
|
|
3867
|
+
return 'regexp';
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
return propType;
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
3874
|
+
// For example, "undefined" or "of type array"
|
|
3875
|
+
function getPostfixForTypeWarning(value) {
|
|
3876
|
+
var type = getPreciseType(value);
|
|
3877
|
+
switch (type) {
|
|
3878
|
+
case 'array':
|
|
3879
|
+
case 'object':
|
|
3880
|
+
return 'an ' + type;
|
|
3881
|
+
case 'boolean':
|
|
3882
|
+
case 'date':
|
|
3883
|
+
case 'regexp':
|
|
3884
|
+
return 'a ' + type;
|
|
3885
|
+
default:
|
|
3886
|
+
return type;
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
// Returns class name of the object, if any.
|
|
3891
|
+
function getClassName(propValue) {
|
|
3892
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
3893
|
+
return ANONYMOUS;
|
|
3894
|
+
}
|
|
3895
|
+
return propValue.constructor.name;
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
3899
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
3900
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
3901
|
+
|
|
3902
|
+
return ReactPropTypes;
|
|
3903
|
+
};
|
|
3904
|
+
return factoryWithTypeCheckers;
|
|
3905
|
+
}
|
|
3906
|
+
|
|
3907
|
+
/**
|
|
3908
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3909
|
+
*
|
|
3910
|
+
* This source code is licensed under the MIT license found in the
|
|
3911
|
+
* LICENSE file in the root directory of this source tree.
|
|
3912
|
+
*/
|
|
3913
|
+
|
|
3914
|
+
var factoryWithThrowingShims;
|
|
3915
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
3916
|
+
|
|
3917
|
+
function requireFactoryWithThrowingShims () {
|
|
3918
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
3919
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
3920
|
+
|
|
3921
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
3922
|
+
|
|
3923
|
+
function emptyFunction() {}
|
|
3924
|
+
function emptyFunctionWithReset() {}
|
|
3925
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
3926
|
+
|
|
3927
|
+
factoryWithThrowingShims = function() {
|
|
3928
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
3929
|
+
if (secret === ReactPropTypesSecret) {
|
|
3930
|
+
// It is still safe when called from React.
|
|
3931
|
+
return;
|
|
3932
|
+
}
|
|
3933
|
+
var err = new Error(
|
|
3934
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
3935
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
3936
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
3937
|
+
);
|
|
3938
|
+
err.name = 'Invariant Violation';
|
|
3939
|
+
throw err;
|
|
3940
|
+
} shim.isRequired = shim;
|
|
3941
|
+
function getShim() {
|
|
3942
|
+
return shim;
|
|
3943
|
+
} // Important!
|
|
3944
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
3945
|
+
var ReactPropTypes = {
|
|
3946
|
+
array: shim,
|
|
3947
|
+
bool: shim,
|
|
3948
|
+
func: shim,
|
|
3949
|
+
number: shim,
|
|
3950
|
+
object: shim,
|
|
3951
|
+
string: shim,
|
|
3952
|
+
symbol: shim,
|
|
3953
|
+
|
|
3954
|
+
any: shim,
|
|
3955
|
+
arrayOf: getShim,
|
|
3956
|
+
element: shim,
|
|
3957
|
+
elementType: shim,
|
|
3958
|
+
instanceOf: getShim,
|
|
3959
|
+
node: shim,
|
|
3960
|
+
objectOf: getShim,
|
|
3961
|
+
oneOf: getShim,
|
|
3962
|
+
oneOfType: getShim,
|
|
3963
|
+
shape: getShim,
|
|
3964
|
+
exact: getShim,
|
|
3965
|
+
|
|
3966
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
3967
|
+
resetWarningCache: emptyFunction
|
|
3968
|
+
};
|
|
3969
|
+
|
|
3970
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
3971
|
+
|
|
3972
|
+
return ReactPropTypes;
|
|
3973
|
+
};
|
|
3974
|
+
return factoryWithThrowingShims;
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
/**
|
|
3978
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3979
|
+
*
|
|
3980
|
+
* This source code is licensed under the MIT license found in the
|
|
3981
|
+
* LICENSE file in the root directory of this source tree.
|
|
3982
|
+
*/
|
|
3983
|
+
|
|
3984
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3985
|
+
var ReactIs = requireReactIs();
|
|
3986
|
+
|
|
3987
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
3988
|
+
// http://fb.me/prop-types-in-prod
|
|
3989
|
+
var throwOnDirectAccess = true;
|
|
3990
|
+
propTypes$1.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
3991
|
+
} else {
|
|
3992
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
3993
|
+
// http://fb.me/prop-types-in-prod
|
|
3994
|
+
propTypes$1.exports = requireFactoryWithThrowingShims()();
|
|
3995
|
+
}
|
|
3996
|
+
|
|
3997
|
+
var propTypes = {
|
|
3998
|
+
// General
|
|
3999
|
+
data: propTypes$1.exports.any,
|
|
4000
|
+
loading: propTypes$1.exports.bool,
|
|
4001
|
+
showPagination: propTypes$1.exports.bool,
|
|
4002
|
+
showPaginationTop: propTypes$1.exports.bool,
|
|
4003
|
+
showPaginationBottom: propTypes$1.exports.bool,
|
|
4004
|
+
showPageSizeOptions: propTypes$1.exports.bool,
|
|
4005
|
+
pageSizeOptions: propTypes$1.exports.array,
|
|
4006
|
+
defaultPageSize: propTypes$1.exports.number,
|
|
4007
|
+
showPageJump: propTypes$1.exports.bool,
|
|
4008
|
+
collapseOnSortingChange: propTypes$1.exports.bool,
|
|
4009
|
+
collapseOnPageChange: propTypes$1.exports.bool,
|
|
4010
|
+
collapseOnDataChange: propTypes$1.exports.bool,
|
|
4011
|
+
freezeWhenExpanded: propTypes$1.exports.bool,
|
|
4012
|
+
sortable: propTypes$1.exports.bool,
|
|
4013
|
+
resizable: propTypes$1.exports.bool,
|
|
4014
|
+
filterable: propTypes$1.exports.bool,
|
|
4015
|
+
defaultSortDesc: propTypes$1.exports.bool,
|
|
4016
|
+
defaultSorted: propTypes$1.exports.array,
|
|
4017
|
+
defaultFiltered: propTypes$1.exports.array,
|
|
4018
|
+
defaultResized: propTypes$1.exports.array,
|
|
4019
|
+
defaultExpanded: propTypes$1.exports.object,
|
|
4020
|
+
defaultFilterMethod: propTypes$1.exports.func,
|
|
4021
|
+
defaultSortMethod: propTypes$1.exports.func,
|
|
4022
|
+
|
|
4023
|
+
// Controlled State Callbacks
|
|
4024
|
+
onPageChange: propTypes$1.exports.func,
|
|
4025
|
+
onPageSizeChange: propTypes$1.exports.func,
|
|
4026
|
+
onSortedChange: propTypes$1.exports.func,
|
|
4027
|
+
onFilteredChange: propTypes$1.exports.func,
|
|
4028
|
+
onResizedChange: propTypes$1.exports.func,
|
|
4029
|
+
onExpandedChange: propTypes$1.exports.func,
|
|
4030
|
+
|
|
4031
|
+
// Pivoting
|
|
4032
|
+
pivotBy: propTypes$1.exports.array,
|
|
4033
|
+
|
|
4034
|
+
// Key Constants
|
|
4035
|
+
pivotValKey: propTypes$1.exports.string,
|
|
4036
|
+
pivotIDKey: propTypes$1.exports.string,
|
|
4037
|
+
subRowsKey: propTypes$1.exports.string,
|
|
4038
|
+
aggregatedKey: propTypes$1.exports.string,
|
|
4039
|
+
nestingLevelKey: propTypes$1.exports.string,
|
|
4040
|
+
originalKey: propTypes$1.exports.string,
|
|
4041
|
+
indexKey: propTypes$1.exports.string,
|
|
4042
|
+
groupedByPivotKey: propTypes$1.exports.string,
|
|
4043
|
+
|
|
4044
|
+
// Server-side Callbacks
|
|
4045
|
+
onFetchData: propTypes$1.exports.func,
|
|
4046
|
+
|
|
4047
|
+
// Classes
|
|
4048
|
+
className: propTypes$1.exports.string,
|
|
4049
|
+
style: propTypes$1.exports.object,
|
|
4050
|
+
|
|
4051
|
+
// Component decorators
|
|
4052
|
+
getProps: propTypes$1.exports.func,
|
|
4053
|
+
getTableProps: propTypes$1.exports.func,
|
|
4054
|
+
getTheadGroupProps: propTypes$1.exports.func,
|
|
4055
|
+
getTheadGroupTrProps: propTypes$1.exports.func,
|
|
4056
|
+
getTheadGroupThProps: propTypes$1.exports.func,
|
|
4057
|
+
getTheadProps: propTypes$1.exports.func,
|
|
4058
|
+
getTheadTrProps: propTypes$1.exports.func,
|
|
4059
|
+
getTheadThProps: propTypes$1.exports.func,
|
|
4060
|
+
getTheadFilterProps: propTypes$1.exports.func,
|
|
4061
|
+
getTheadFilterTrProps: propTypes$1.exports.func,
|
|
4062
|
+
getTheadFilterThProps: propTypes$1.exports.func,
|
|
4063
|
+
getTbodyProps: propTypes$1.exports.func,
|
|
4064
|
+
getTrGroupProps: propTypes$1.exports.func,
|
|
4065
|
+
getTrProps: propTypes$1.exports.func,
|
|
4066
|
+
getTdProps: propTypes$1.exports.func,
|
|
4067
|
+
getTfootProps: propTypes$1.exports.func,
|
|
4068
|
+
getTfootTrProps: propTypes$1.exports.func,
|
|
4069
|
+
getTfootTdProps: propTypes$1.exports.func,
|
|
4070
|
+
getPaginationProps: propTypes$1.exports.func,
|
|
4071
|
+
getLoadingProps: propTypes$1.exports.func,
|
|
4072
|
+
getNoDataProps: propTypes$1.exports.func,
|
|
4073
|
+
getResizerProps: propTypes$1.exports.func,
|
|
4074
|
+
|
|
4075
|
+
// Global Column Defaults
|
|
4076
|
+
columns: propTypes$1.exports.arrayOf(propTypes$1.exports.shape({
|
|
4077
|
+
// Renderers
|
|
4078
|
+
Cell: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.string, propTypes$1.exports.func]),
|
|
4079
|
+
Header: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.string, propTypes$1.exports.func]),
|
|
4080
|
+
Footer: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.string, propTypes$1.exports.func]),
|
|
4081
|
+
Aggregated: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.string, propTypes$1.exports.func]),
|
|
4082
|
+
Pivot: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.string, propTypes$1.exports.func]),
|
|
4083
|
+
PivotValue: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.string, propTypes$1.exports.func]),
|
|
4084
|
+
Expander: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.string, propTypes$1.exports.func]),
|
|
4085
|
+
Filter: propTypes$1.exports.oneOfType([propTypes$1.exports.element, propTypes$1.exports.func]),
|
|
4086
|
+
|
|
4087
|
+
// All Columns
|
|
4088
|
+
sortable: propTypes$1.exports.bool, // use table default
|
|
4089
|
+
resizable: propTypes$1.exports.bool, // use table default
|
|
4090
|
+
filterable: propTypes$1.exports.bool, // use table default
|
|
4091
|
+
show: propTypes$1.exports.bool,
|
|
4092
|
+
minWidth: propTypes$1.exports.number,
|
|
4093
|
+
minResizeWidth: propTypes$1.exports.number,
|
|
4094
|
+
|
|
4095
|
+
// Cells only
|
|
4096
|
+
className: propTypes$1.exports.string,
|
|
4097
|
+
style: propTypes$1.exports.object,
|
|
4098
|
+
getProps: propTypes$1.exports.func,
|
|
4099
|
+
|
|
4100
|
+
// Pivot only
|
|
4101
|
+
aggregate: propTypes$1.exports.func,
|
|
4102
|
+
|
|
4103
|
+
// Headers only
|
|
4104
|
+
headerClassName: propTypes$1.exports.string,
|
|
4105
|
+
headerStyle: propTypes$1.exports.object,
|
|
4106
|
+
getHeaderProps: propTypes$1.exports.func,
|
|
4107
|
+
|
|
4108
|
+
// Footers only
|
|
4109
|
+
footerClassName: propTypes$1.exports.string,
|
|
4110
|
+
footerStyle: propTypes$1.exports.object,
|
|
4111
|
+
getFooterProps: propTypes$1.exports.func,
|
|
4112
|
+
filterMethod: propTypes$1.exports.func,
|
|
4113
|
+
filterAll: propTypes$1.exports.bool,
|
|
4114
|
+
sortMethod: propTypes$1.exports.func
|
|
4115
|
+
})),
|
|
4116
|
+
|
|
4117
|
+
// Global Expander Column Defaults
|
|
4118
|
+
expanderDefaults: propTypes$1.exports.shape({
|
|
4119
|
+
sortable: propTypes$1.exports.bool,
|
|
4120
|
+
resizable: propTypes$1.exports.bool,
|
|
4121
|
+
filterable: propTypes$1.exports.bool,
|
|
4122
|
+
width: propTypes$1.exports.number
|
|
4123
|
+
}),
|
|
4124
|
+
|
|
4125
|
+
pivotDefaults: propTypes$1.exports.object,
|
|
4126
|
+
|
|
4127
|
+
// Text
|
|
4128
|
+
previousText: propTypes$1.exports.node,
|
|
4129
|
+
nextText: propTypes$1.exports.node,
|
|
4130
|
+
loadingText: propTypes$1.exports.node,
|
|
4131
|
+
noDataText: propTypes$1.exports.node,
|
|
4132
|
+
pageText: propTypes$1.exports.node,
|
|
4133
|
+
ofText: propTypes$1.exports.node,
|
|
4134
|
+
rowsText: propTypes$1.exports.node,
|
|
4135
|
+
pageJumpText: propTypes$1.exports.node,
|
|
4136
|
+
rowsSelectorText: propTypes$1.exports.node,
|
|
4137
|
+
|
|
4138
|
+
// Components
|
|
4139
|
+
TableComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4140
|
+
TheadComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4141
|
+
TbodyComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4142
|
+
TrGroupComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4143
|
+
TrComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4144
|
+
ThComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4145
|
+
TdComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4146
|
+
TfootComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4147
|
+
FilterComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4148
|
+
ExpanderComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4149
|
+
PivotValueComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4150
|
+
AggregatedComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4151
|
+
// this is a computed default generated using
|
|
4152
|
+
PivotComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4153
|
+
// the ExpanderComponent and PivotValueComponent at run-time in methods.js
|
|
4154
|
+
PaginationComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4155
|
+
PreviousComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4156
|
+
NextComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4157
|
+
LoadingComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4158
|
+
NoDataComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4159
|
+
ResizerComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element]),
|
|
4160
|
+
PadRowComponent: propTypes$1.exports.oneOfType([propTypes$1.exports.func, propTypes$1.exports.element])
|
|
4161
|
+
};
|
|
4162
|
+
|
|
4163
|
+
var _slicedToArray = function () { function sliceIterator(arr, i) { 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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
4164
|
+
|
|
4165
|
+
var _extends = Object.assign || 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; };
|
|
4166
|
+
|
|
4167
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
4168
|
+
|
|
4169
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4170
|
+
|
|
4171
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
4172
|
+
|
|
4173
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
4174
|
+
|
|
4175
|
+
var ReactTable = function (_Methods) {
|
|
4176
|
+
_inherits(ReactTable, _Methods);
|
|
4177
|
+
|
|
4178
|
+
function ReactTable(props) {
|
|
4179
|
+
_classCallCheck(this, ReactTable);
|
|
4180
|
+
|
|
4181
|
+
var _this = _possibleConstructorReturn(this, (ReactTable.__proto__ || Object.getPrototypeOf(ReactTable)).call(this));
|
|
4182
|
+
|
|
4183
|
+
_this.getResolvedState = _this.getResolvedState.bind(_this);
|
|
4184
|
+
_this.getDataModel = _this.getDataModel.bind(_this);
|
|
4185
|
+
_this.getSortedData = _this.getSortedData.bind(_this);
|
|
4186
|
+
_this.fireFetchData = _this.fireFetchData.bind(_this);
|
|
4187
|
+
_this.getPropOrState = _this.getPropOrState.bind(_this);
|
|
4188
|
+
_this.getStateOrProp = _this.getStateOrProp.bind(_this);
|
|
4189
|
+
_this.filterData = _this.filterData.bind(_this);
|
|
4190
|
+
_this.sortData = _this.sortData.bind(_this);
|
|
4191
|
+
_this.getMinRows = _this.getMinRows.bind(_this);
|
|
4192
|
+
_this.onPageChange = _this.onPageChange.bind(_this);
|
|
4193
|
+
_this.onPageSizeChange = _this.onPageSizeChange.bind(_this);
|
|
4194
|
+
_this.sortColumn = _this.sortColumn.bind(_this);
|
|
4195
|
+
_this.filterColumn = _this.filterColumn.bind(_this);
|
|
4196
|
+
_this.resizeColumnStart = _this.resizeColumnStart.bind(_this);
|
|
4197
|
+
_this.resizeColumnEnd = _this.resizeColumnEnd.bind(_this);
|
|
4198
|
+
_this.resizeColumnMoving = _this.resizeColumnMoving.bind(_this);
|
|
4199
|
+
|
|
4200
|
+
_this.state = {
|
|
4201
|
+
page: props.defaultPage,
|
|
4202
|
+
pageSize: props.defaultPageSize,
|
|
4203
|
+
sorted: props.defaultSorted,
|
|
4204
|
+
expanded: props.defaultExpanded,
|
|
4205
|
+
filtered: props.defaultFiltered,
|
|
4206
|
+
resized: props.defaultResized,
|
|
4207
|
+
currentlyResizing: false,
|
|
4208
|
+
skipNextSort: false
|
|
4209
|
+
};
|
|
4210
|
+
return _this;
|
|
4211
|
+
}
|
|
4212
|
+
|
|
4213
|
+
_createClass(ReactTable, [{
|
|
4214
|
+
key: 'render',
|
|
4215
|
+
value: function render() {
|
|
4216
|
+
var _this2 = this;
|
|
4217
|
+
|
|
4218
|
+
var resolvedState = this.getResolvedState();
|
|
4219
|
+
var children = resolvedState.children,
|
|
4220
|
+
className = resolvedState.className,
|
|
4221
|
+
style = resolvedState.style,
|
|
4222
|
+
getProps = resolvedState.getProps,
|
|
4223
|
+
getTableProps = resolvedState.getTableProps,
|
|
4224
|
+
getTheadGroupProps = resolvedState.getTheadGroupProps,
|
|
4225
|
+
getTheadGroupTrProps = resolvedState.getTheadGroupTrProps,
|
|
4226
|
+
getTheadGroupThProps = resolvedState.getTheadGroupThProps,
|
|
4227
|
+
getTheadProps = resolvedState.getTheadProps,
|
|
4228
|
+
getTheadTrProps = resolvedState.getTheadTrProps,
|
|
4229
|
+
getTheadThProps = resolvedState.getTheadThProps,
|
|
4230
|
+
getTheadFilterProps = resolvedState.getTheadFilterProps,
|
|
4231
|
+
getTheadFilterTrProps = resolvedState.getTheadFilterTrProps,
|
|
4232
|
+
getTheadFilterThProps = resolvedState.getTheadFilterThProps,
|
|
4233
|
+
getTbodyProps = resolvedState.getTbodyProps,
|
|
4234
|
+
getTrGroupProps = resolvedState.getTrGroupProps,
|
|
4235
|
+
getTrProps = resolvedState.getTrProps,
|
|
4236
|
+
getTdProps = resolvedState.getTdProps,
|
|
4237
|
+
getTfootProps = resolvedState.getTfootProps,
|
|
4238
|
+
getTfootTrProps = resolvedState.getTfootTrProps,
|
|
4239
|
+
getTfootTdProps = resolvedState.getTfootTdProps,
|
|
4240
|
+
getPaginationProps = resolvedState.getPaginationProps,
|
|
4241
|
+
getLoadingProps = resolvedState.getLoadingProps,
|
|
4242
|
+
getNoDataProps = resolvedState.getNoDataProps,
|
|
4243
|
+
getResizerProps = resolvedState.getResizerProps,
|
|
4244
|
+
showPagination = resolvedState.showPagination,
|
|
4245
|
+
showPaginationTop = resolvedState.showPaginationTop,
|
|
4246
|
+
showPaginationBottom = resolvedState.showPaginationBottom,
|
|
4247
|
+
manual = resolvedState.manual,
|
|
4248
|
+
loadingText = resolvedState.loadingText,
|
|
4249
|
+
noDataText = resolvedState.noDataText,
|
|
4250
|
+
sortable = resolvedState.sortable,
|
|
4251
|
+
multiSort = resolvedState.multiSort,
|
|
4252
|
+
resizable = resolvedState.resizable,
|
|
4253
|
+
filterable = resolvedState.filterable,
|
|
4254
|
+
pivotIDKey = resolvedState.pivotIDKey,
|
|
4255
|
+
pivotValKey = resolvedState.pivotValKey,
|
|
4256
|
+
pivotBy = resolvedState.pivotBy,
|
|
4257
|
+
subRowsKey = resolvedState.subRowsKey,
|
|
4258
|
+
aggregatedKey = resolvedState.aggregatedKey,
|
|
4259
|
+
originalKey = resolvedState.originalKey,
|
|
4260
|
+
indexKey = resolvedState.indexKey,
|
|
4261
|
+
groupedByPivotKey = resolvedState.groupedByPivotKey,
|
|
4262
|
+
loading = resolvedState.loading,
|
|
4263
|
+
pageSize = resolvedState.pageSize,
|
|
4264
|
+
page = resolvedState.page,
|
|
4265
|
+
sorted = resolvedState.sorted,
|
|
4266
|
+
filtered = resolvedState.filtered,
|
|
4267
|
+
resized = resolvedState.resized,
|
|
4268
|
+
expanded = resolvedState.expanded,
|
|
4269
|
+
pages = resolvedState.pages,
|
|
4270
|
+
onExpandedChange = resolvedState.onExpandedChange,
|
|
4271
|
+
TableComponent = resolvedState.TableComponent,
|
|
4272
|
+
TheadComponent = resolvedState.TheadComponent,
|
|
4273
|
+
TbodyComponent = resolvedState.TbodyComponent,
|
|
4274
|
+
TrGroupComponent = resolvedState.TrGroupComponent,
|
|
4275
|
+
TrComponent = resolvedState.TrComponent,
|
|
4276
|
+
ThComponent = resolvedState.ThComponent,
|
|
4277
|
+
TdComponent = resolvedState.TdComponent,
|
|
4278
|
+
TfootComponent = resolvedState.TfootComponent,
|
|
4279
|
+
PaginationComponent = resolvedState.PaginationComponent,
|
|
4280
|
+
LoadingComponent = resolvedState.LoadingComponent,
|
|
4281
|
+
SubComponent = resolvedState.SubComponent,
|
|
4282
|
+
NoDataComponent = resolvedState.NoDataComponent,
|
|
4283
|
+
ResizerComponent = resolvedState.ResizerComponent,
|
|
4284
|
+
ExpanderComponent = resolvedState.ExpanderComponent,
|
|
4285
|
+
PivotValueComponent = resolvedState.PivotValueComponent,
|
|
4286
|
+
PivotComponent = resolvedState.PivotComponent,
|
|
4287
|
+
AggregatedComponent = resolvedState.AggregatedComponent,
|
|
4288
|
+
FilterComponent = resolvedState.FilterComponent,
|
|
4289
|
+
PadRowComponent = resolvedState.PadRowComponent,
|
|
4290
|
+
resolvedData = resolvedState.resolvedData,
|
|
4291
|
+
allVisibleColumns = resolvedState.allVisibleColumns,
|
|
4292
|
+
headerGroups = resolvedState.headerGroups,
|
|
4293
|
+
hasHeaderGroups = resolvedState.hasHeaderGroups,
|
|
4294
|
+
sortedData = resolvedState.sortedData,
|
|
4295
|
+
currentlyResizing = resolvedState.currentlyResizing;
|
|
4296
|
+
|
|
4297
|
+
// Pagination
|
|
4298
|
+
|
|
4299
|
+
var startRow = pageSize * page;
|
|
4300
|
+
var endRow = startRow + pageSize;
|
|
4301
|
+
var pageRows = manual ? resolvedData : sortedData.slice(startRow, endRow);
|
|
4302
|
+
var minRows = this.getMinRows();
|
|
4303
|
+
var padRows = _.range(Math.max(minRows - pageRows.length, 0));
|
|
4304
|
+
|
|
4305
|
+
var hasColumnFooter = allVisibleColumns.some(function (d) {
|
|
4306
|
+
return d.Footer;
|
|
4307
|
+
});
|
|
4308
|
+
var hasFilters = filterable || allVisibleColumns.some(function (d) {
|
|
4309
|
+
return d.filterable;
|
|
4310
|
+
});
|
|
4311
|
+
|
|
4312
|
+
var recurseRowsViewIndex = function recurseRowsViewIndex(rows) {
|
|
4313
|
+
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4314
|
+
var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
4315
|
+
return [rows.map(function (row, i) {
|
|
4316
|
+
index += 1;
|
|
4317
|
+
var rowWithViewIndex = _extends({}, row, {
|
|
4318
|
+
_viewIndex: index
|
|
4319
|
+
});
|
|
4320
|
+
var newPath = path.concat([i]);
|
|
4321
|
+
if (rowWithViewIndex[subRowsKey] && _.get(expanded, newPath)) {
|
|
4322
|
+
var _recurseRowsViewIndex = recurseRowsViewIndex(rowWithViewIndex[subRowsKey], newPath, index);
|
|
4323
|
+
|
|
4324
|
+
var _recurseRowsViewIndex2 = _slicedToArray(_recurseRowsViewIndex, 2);
|
|
4325
|
+
|
|
4326
|
+
rowWithViewIndex[subRowsKey] = _recurseRowsViewIndex2[0];
|
|
4327
|
+
index = _recurseRowsViewIndex2[1];
|
|
4328
|
+
}
|
|
4329
|
+
return rowWithViewIndex;
|
|
4330
|
+
}), index];
|
|
4331
|
+
};
|
|
4332
|
+
|
|
4333
|
+
var _recurseRowsViewIndex3 = recurseRowsViewIndex(pageRows);
|
|
4334
|
+
|
|
4335
|
+
var _recurseRowsViewIndex4 = _slicedToArray(_recurseRowsViewIndex3, 1);
|
|
4336
|
+
|
|
4337
|
+
pageRows = _recurseRowsViewIndex4[0];
|
|
4338
|
+
|
|
4339
|
+
|
|
4340
|
+
var canPrevious = page > 0;
|
|
4341
|
+
var canNext = page + 1 < pages;
|
|
4342
|
+
|
|
4343
|
+
var rowMinWidth = _.sum(allVisibleColumns.map(function (d) {
|
|
4344
|
+
var resizedColumn = resized.find(function (x) {
|
|
4345
|
+
return x.id === d.id;
|
|
4346
|
+
}) || {};
|
|
4347
|
+
return _.getFirstDefined(resizedColumn.value, d.width, d.minWidth);
|
|
4348
|
+
}));
|
|
4349
|
+
|
|
4350
|
+
var rowIndex = -1;
|
|
4351
|
+
|
|
4352
|
+
var finalState = _extends({}, resolvedState, {
|
|
4353
|
+
startRow: startRow,
|
|
4354
|
+
endRow: endRow,
|
|
4355
|
+
pageRows: pageRows,
|
|
4356
|
+
minRows: minRows,
|
|
4357
|
+
padRows: padRows,
|
|
4358
|
+
hasColumnFooter: hasColumnFooter,
|
|
4359
|
+
canPrevious: canPrevious,
|
|
4360
|
+
canNext: canNext,
|
|
4361
|
+
rowMinWidth: rowMinWidth
|
|
4362
|
+
});
|
|
4363
|
+
|
|
4364
|
+
var rootProps = _.splitProps(getProps(finalState, undefined, undefined, this));
|
|
4365
|
+
var tableProps = _.splitProps(getTableProps(finalState, undefined, undefined, this));
|
|
4366
|
+
var tBodyProps = _.splitProps(getTbodyProps(finalState, undefined, undefined, this));
|
|
4367
|
+
var loadingProps = getLoadingProps(finalState, undefined, undefined, this);
|
|
4368
|
+
var noDataProps = getNoDataProps(finalState, undefined, undefined, this);
|
|
4369
|
+
|
|
4370
|
+
// Visual Components
|
|
4371
|
+
|
|
4372
|
+
var makeHeaderGroup = function makeHeaderGroup(column, i) {
|
|
4373
|
+
var resizedValue = function resizedValue(col) {
|
|
4374
|
+
return (resized.find(function (x) {
|
|
4375
|
+
return x.id === col.id;
|
|
4376
|
+
}) || {}).value;
|
|
4377
|
+
};
|
|
4378
|
+
var flex = _.sum(column.columns.map(function (col) {
|
|
4379
|
+
return col.width || resizedValue(col) ? 0 : col.minWidth;
|
|
4380
|
+
}));
|
|
4381
|
+
var width = _.sum(column.columns.map(function (col) {
|
|
4382
|
+
return _.getFirstDefined(resizedValue(col), col.width, col.minWidth);
|
|
4383
|
+
}));
|
|
4384
|
+
var maxWidth = _.sum(column.columns.map(function (col) {
|
|
4385
|
+
return _.getFirstDefined(resizedValue(col), col.width, col.maxWidth);
|
|
4386
|
+
}));
|
|
4387
|
+
|
|
4388
|
+
var theadGroupThProps = _.splitProps(getTheadGroupThProps(finalState, undefined, column, _this2));
|
|
4389
|
+
var columnHeaderProps = _.splitProps(column.getHeaderProps(finalState, undefined, column, _this2));
|
|
4390
|
+
|
|
4391
|
+
var classes = [column.headerClassName, theadGroupThProps.className, columnHeaderProps.className];
|
|
4392
|
+
|
|
4393
|
+
var styles = _extends({}, column.headerStyle, theadGroupThProps.style, columnHeaderProps.style);
|
|
4394
|
+
|
|
4395
|
+
var rest = _extends({}, theadGroupThProps.rest, columnHeaderProps.rest);
|
|
4396
|
+
|
|
4397
|
+
var flexStyles = {
|
|
4398
|
+
flex: flex + ' 0 auto',
|
|
4399
|
+
width: _.asPx(width),
|
|
4400
|
+
maxWidth: _.asPx(maxWidth)
|
|
4401
|
+
};
|
|
4402
|
+
|
|
4403
|
+
return React__default["default"].createElement(
|
|
4404
|
+
ThComponent,
|
|
4405
|
+
_extends({
|
|
4406
|
+
key: i + '-' + column.id,
|
|
4407
|
+
className: classnames__default["default"](classes),
|
|
4408
|
+
style: _extends({}, styles, flexStyles)
|
|
4409
|
+
}, rest),
|
|
4410
|
+
_.normalizeComponent(column.Header, {
|
|
4411
|
+
data: sortedData,
|
|
4412
|
+
column: column
|
|
4413
|
+
})
|
|
4414
|
+
);
|
|
4415
|
+
};
|
|
4416
|
+
|
|
4417
|
+
var makeHeaderGroups = function makeHeaderGroups() {
|
|
4418
|
+
var theadGroupProps = _.splitProps(getTheadGroupProps(finalState, undefined, undefined, _this2));
|
|
4419
|
+
var theadGroupTrProps = _.splitProps(getTheadGroupTrProps(finalState, undefined, undefined, _this2));
|
|
4420
|
+
return React__default["default"].createElement(
|
|
4421
|
+
TheadComponent,
|
|
4422
|
+
_extends({
|
|
4423
|
+
className: classnames__default["default"]('-headerGroups', theadGroupProps.className),
|
|
4424
|
+
style: _extends({}, theadGroupProps.style, {
|
|
4425
|
+
minWidth: rowMinWidth + 'px'
|
|
4426
|
+
})
|
|
4427
|
+
}, theadGroupProps.rest),
|
|
4428
|
+
React__default["default"].createElement(
|
|
4429
|
+
TrComponent,
|
|
4430
|
+
_extends({
|
|
4431
|
+
className: theadGroupTrProps.className,
|
|
4432
|
+
style: theadGroupTrProps.style
|
|
4433
|
+
}, theadGroupTrProps.rest),
|
|
4434
|
+
headerGroups.map(makeHeaderGroup)
|
|
4435
|
+
)
|
|
4436
|
+
);
|
|
4437
|
+
};
|
|
4438
|
+
|
|
4439
|
+
var makeHeader = function makeHeader(column, i) {
|
|
4440
|
+
var resizedCol = resized.find(function (x) {
|
|
4441
|
+
return x.id === column.id;
|
|
4442
|
+
}) || {};
|
|
4443
|
+
var sort = sorted.find(function (d) {
|
|
4444
|
+
return d.id === column.id;
|
|
4445
|
+
});
|
|
4446
|
+
var show = typeof column.show === 'function' ? column.show() : column.show;
|
|
4447
|
+
var width = _.getFirstDefined(resizedCol.value, column.width, column.minWidth);
|
|
4448
|
+
var maxWidth = _.getFirstDefined(resizedCol.value, column.width, column.maxWidth);
|
|
4449
|
+
var theadThProps = _.splitProps(getTheadThProps(finalState, undefined, column, _this2));
|
|
4450
|
+
var columnHeaderProps = _.splitProps(column.getHeaderProps(finalState, undefined, column, _this2));
|
|
4451
|
+
|
|
4452
|
+
var classes = [column.headerClassName, theadThProps.className, columnHeaderProps.className];
|
|
4453
|
+
|
|
4454
|
+
var styles = _extends({}, column.headerStyle, theadThProps.style, columnHeaderProps.style);
|
|
4455
|
+
|
|
4456
|
+
var rest = _extends({}, theadThProps.rest, columnHeaderProps.rest);
|
|
4457
|
+
|
|
4458
|
+
var isResizable = _.getFirstDefined(column.resizable, resizable, false);
|
|
4459
|
+
var resizer = isResizable ? React__default["default"].createElement(ResizerComponent, _extends({
|
|
4460
|
+
onMouseDown: function onMouseDown(e) {
|
|
4461
|
+
return _this2.resizeColumnStart(e, column, false);
|
|
4462
|
+
},
|
|
4463
|
+
onTouchStart: function onTouchStart(e) {
|
|
4464
|
+
return _this2.resizeColumnStart(e, column, true);
|
|
4465
|
+
}
|
|
4466
|
+
}, getResizerProps('finalState', undefined, column, _this2))) : null;
|
|
4467
|
+
|
|
4468
|
+
var isSortable = _.getFirstDefined(column.sortable, sortable, false);
|
|
4469
|
+
|
|
4470
|
+
return React__default["default"].createElement(
|
|
4471
|
+
ThComponent,
|
|
4472
|
+
_extends({
|
|
4473
|
+
key: i + '-' + column.id,
|
|
4474
|
+
className: classnames__default["default"](classes, isResizable && 'rt-resizable-header', sort ? sort.desc ? '-sort-desc' : '-sort-asc' : '', isSortable && '-cursor-pointer', !show && '-hidden', pivotBy && pivotBy.slice(0, -1).includes(column.id) && 'rt-header-pivot'),
|
|
4475
|
+
style: _extends({}, styles, {
|
|
4476
|
+
flex: width + ' 0 auto',
|
|
4477
|
+
width: _.asPx(width),
|
|
4478
|
+
maxWidth: _.asPx(maxWidth)
|
|
4479
|
+
}),
|
|
4480
|
+
toggleSort: function toggleSort(e) {
|
|
4481
|
+
if (isSortable) _this2.sortColumn(column, multiSort ? e.shiftKey : false);
|
|
4482
|
+
}
|
|
4483
|
+
}, rest),
|
|
4484
|
+
React__default["default"].createElement(
|
|
4485
|
+
'div',
|
|
4486
|
+
{ className: classnames__default["default"](isResizable && 'rt-resizable-header-content') },
|
|
4487
|
+
_.normalizeComponent(column.Header, {
|
|
4488
|
+
data: sortedData,
|
|
4489
|
+
column: column
|
|
4490
|
+
})
|
|
4491
|
+
),
|
|
4492
|
+
resizer
|
|
4493
|
+
);
|
|
4494
|
+
};
|
|
4495
|
+
|
|
4496
|
+
var makeHeaders = function makeHeaders() {
|
|
4497
|
+
var theadProps = _.splitProps(getTheadProps(finalState, undefined, undefined, _this2));
|
|
4498
|
+
var theadTrProps = _.splitProps(getTheadTrProps(finalState, undefined, undefined, _this2));
|
|
4499
|
+
return React__default["default"].createElement(
|
|
4500
|
+
TheadComponent,
|
|
4501
|
+
_extends({
|
|
4502
|
+
className: classnames__default["default"]('-header', theadProps.className),
|
|
4503
|
+
style: _extends({}, theadProps.style, {
|
|
4504
|
+
minWidth: rowMinWidth + 'px'
|
|
4505
|
+
})
|
|
4506
|
+
}, theadProps.rest),
|
|
4507
|
+
React__default["default"].createElement(
|
|
4508
|
+
TrComponent,
|
|
4509
|
+
_extends({
|
|
4510
|
+
className: theadTrProps.className,
|
|
4511
|
+
style: theadTrProps.style
|
|
4512
|
+
}, theadTrProps.rest),
|
|
4513
|
+
allVisibleColumns.map(makeHeader)
|
|
4514
|
+
)
|
|
4515
|
+
);
|
|
4516
|
+
};
|
|
4517
|
+
|
|
4518
|
+
var makeFilter = function makeFilter(column, i) {
|
|
4519
|
+
var resizedCol = resized.find(function (x) {
|
|
4520
|
+
return x.id === column.id;
|
|
4521
|
+
}) || {};
|
|
4522
|
+
var width = _.getFirstDefined(resizedCol.value, column.width, column.minWidth);
|
|
4523
|
+
var maxWidth = _.getFirstDefined(resizedCol.value, column.width, column.maxWidth);
|
|
4524
|
+
var theadFilterThProps = _.splitProps(getTheadFilterThProps(finalState, undefined, column, _this2));
|
|
4525
|
+
var columnHeaderProps = _.splitProps(column.getHeaderProps(finalState, undefined, column, _this2));
|
|
4526
|
+
|
|
4527
|
+
var classes = [column.headerClassName, theadFilterThProps.className, columnHeaderProps.className];
|
|
4528
|
+
|
|
4529
|
+
var styles = _extends({}, column.headerStyle, theadFilterThProps.style, columnHeaderProps.style);
|
|
4530
|
+
|
|
4531
|
+
var rest = _extends({}, theadFilterThProps.rest, columnHeaderProps.rest);
|
|
4532
|
+
|
|
4533
|
+
var filter = filtered.find(function (filter) {
|
|
4534
|
+
return filter.id === column.id;
|
|
4535
|
+
});
|
|
4536
|
+
|
|
4537
|
+
var ResolvedFilterComponent = column.Filter || FilterComponent;
|
|
4538
|
+
|
|
4539
|
+
var isFilterable = _.getFirstDefined(column.filterable, filterable, false);
|
|
4540
|
+
|
|
4541
|
+
return React__default["default"].createElement(
|
|
4542
|
+
ThComponent,
|
|
4543
|
+
_extends({
|
|
4544
|
+
key: i + '-' + column.id,
|
|
4545
|
+
className: classnames__default["default"](classes),
|
|
4546
|
+
style: _extends({}, styles, {
|
|
4547
|
+
flex: width + ' 0 auto',
|
|
4548
|
+
width: _.asPx(width),
|
|
4549
|
+
maxWidth: _.asPx(maxWidth)
|
|
4550
|
+
})
|
|
4551
|
+
}, rest),
|
|
4552
|
+
isFilterable ? _.normalizeComponent(ResolvedFilterComponent, {
|
|
4553
|
+
column: column,
|
|
4554
|
+
filter: filter,
|
|
4555
|
+
onChange: function onChange(value) {
|
|
4556
|
+
return _this2.filterColumn(column, value);
|
|
4557
|
+
}
|
|
4558
|
+
}, defaultProps.column.Filter) : null
|
|
4559
|
+
);
|
|
4560
|
+
};
|
|
4561
|
+
|
|
4562
|
+
var makeFilters = function makeFilters() {
|
|
4563
|
+
var theadFilterProps = _.splitProps(getTheadFilterProps(finalState, undefined, undefined, _this2));
|
|
4564
|
+
var theadFilterTrProps = _.splitProps(getTheadFilterTrProps(finalState, undefined, undefined, _this2));
|
|
4565
|
+
return React__default["default"].createElement(
|
|
4566
|
+
TheadComponent,
|
|
4567
|
+
_extends({
|
|
4568
|
+
className: classnames__default["default"]('-filters', theadFilterProps.className),
|
|
4569
|
+
style: _extends({}, theadFilterProps.style, {
|
|
4570
|
+
minWidth: rowMinWidth + 'px'
|
|
4571
|
+
})
|
|
4572
|
+
}, theadFilterProps.rest),
|
|
4573
|
+
React__default["default"].createElement(
|
|
4574
|
+
TrComponent,
|
|
4575
|
+
_extends({
|
|
4576
|
+
className: theadFilterTrProps.className,
|
|
4577
|
+
style: theadFilterTrProps.style
|
|
4578
|
+
}, theadFilterTrProps.rest),
|
|
4579
|
+
allVisibleColumns.map(makeFilter)
|
|
4580
|
+
)
|
|
4581
|
+
);
|
|
4582
|
+
};
|
|
4583
|
+
|
|
4584
|
+
var makePageRow = function makePageRow(row, i) {
|
|
4585
|
+
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
4586
|
+
|
|
4587
|
+
var rowInfo = {
|
|
4588
|
+
original: row[originalKey],
|
|
4589
|
+
row: row,
|
|
4590
|
+
index: row[indexKey],
|
|
4591
|
+
viewIndex: rowIndex += 1,
|
|
4592
|
+
pageSize: pageSize,
|
|
4593
|
+
page: page,
|
|
4594
|
+
level: path.length,
|
|
4595
|
+
nestingPath: path.concat([i]),
|
|
4596
|
+
aggregated: row[aggregatedKey],
|
|
4597
|
+
groupedByPivot: row[groupedByPivotKey],
|
|
4598
|
+
subRows: row[subRowsKey]
|
|
4599
|
+
};
|
|
4600
|
+
var isExpanded = _.get(expanded, rowInfo.nestingPath);
|
|
4601
|
+
var trGroupProps = getTrGroupProps(finalState, rowInfo, undefined, _this2);
|
|
4602
|
+
var trProps = _.splitProps(getTrProps(finalState, rowInfo, undefined, _this2));
|
|
4603
|
+
return React__default["default"].createElement(
|
|
4604
|
+
TrGroupComponent,
|
|
4605
|
+
_extends({ key: rowInfo.nestingPath.join('_') }, trGroupProps),
|
|
4606
|
+
React__default["default"].createElement(
|
|
4607
|
+
TrComponent,
|
|
4608
|
+
_extends({
|
|
4609
|
+
className: classnames__default["default"](trProps.className, row._viewIndex % 2 ? '-even' : '-odd'),
|
|
4610
|
+
style: trProps.style
|
|
4611
|
+
}, trProps.rest),
|
|
4612
|
+
allVisibleColumns.map(function (column, i2) {
|
|
4613
|
+
var resizedCol = resized.find(function (x) {
|
|
4614
|
+
return x.id === column.id;
|
|
4615
|
+
}) || {};
|
|
4616
|
+
var show = typeof column.show === 'function' ? column.show() : column.show;
|
|
4617
|
+
var width = _.getFirstDefined(resizedCol.value, column.width, column.minWidth);
|
|
4618
|
+
var maxWidth = _.getFirstDefined(resizedCol.value, column.width, column.maxWidth);
|
|
4619
|
+
var tdProps = _.splitProps(getTdProps(finalState, rowInfo, column, _this2));
|
|
4620
|
+
var columnProps = _.splitProps(column.getProps(finalState, rowInfo, column, _this2));
|
|
4621
|
+
|
|
4622
|
+
var classes = [tdProps.className, column.className, columnProps.className];
|
|
4623
|
+
|
|
4624
|
+
var styles = _extends({}, tdProps.style, column.style, columnProps.style);
|
|
4625
|
+
|
|
4626
|
+
var cellInfo = _extends({}, rowInfo, {
|
|
4627
|
+
isExpanded: isExpanded,
|
|
4628
|
+
column: _extends({}, column),
|
|
4629
|
+
value: rowInfo.row[column.id],
|
|
4630
|
+
pivoted: column.pivoted,
|
|
4631
|
+
expander: column.expander,
|
|
4632
|
+
resized: resized,
|
|
4633
|
+
show: show,
|
|
4634
|
+
width: width,
|
|
4635
|
+
maxWidth: maxWidth,
|
|
4636
|
+
tdProps: tdProps,
|
|
4637
|
+
columnProps: columnProps,
|
|
4638
|
+
classes: classes,
|
|
4639
|
+
styles: styles
|
|
4640
|
+
});
|
|
4641
|
+
|
|
4642
|
+
var value = cellInfo.value;
|
|
4643
|
+
|
|
4644
|
+
var useOnExpanderClick = void 0;
|
|
4645
|
+
var isBranch = void 0;
|
|
4646
|
+
var isPreview = void 0;
|
|
4647
|
+
|
|
4648
|
+
var onExpanderClick = function onExpanderClick(e) {
|
|
4649
|
+
var newExpanded = _.clone(expanded);
|
|
4650
|
+
if (isExpanded) {
|
|
4651
|
+
newExpanded = _.set(newExpanded, cellInfo.nestingPath, false);
|
|
4652
|
+
} else {
|
|
4653
|
+
newExpanded = _.set(newExpanded, cellInfo.nestingPath, {});
|
|
4654
|
+
}
|
|
4655
|
+
|
|
4656
|
+
return _this2.setStateWithData({
|
|
4657
|
+
expanded: newExpanded
|
|
4658
|
+
}, function () {
|
|
4659
|
+
return onExpandedChange && onExpandedChange(newExpanded, cellInfo.nestingPath, e, cellInfo);
|
|
4660
|
+
});
|
|
4661
|
+
};
|
|
4662
|
+
|
|
4663
|
+
// Default to a standard cell
|
|
4664
|
+
var resolvedCell = _.normalizeComponent(column.Cell, cellInfo, value);
|
|
4665
|
+
|
|
4666
|
+
// Resolve Renderers
|
|
4667
|
+
var ResolvedAggregatedComponent = column.Aggregated || (!column.aggregate ? AggregatedComponent : column.Cell);
|
|
4668
|
+
var ResolvedExpanderComponent = column.Expander || ExpanderComponent;
|
|
4669
|
+
var ResolvedPivotValueComponent = column.PivotValue || PivotValueComponent;
|
|
4670
|
+
var DefaultResolvedPivotComponent = PivotComponent || function (props) {
|
|
4671
|
+
return React__default["default"].createElement(
|
|
4672
|
+
'div',
|
|
4673
|
+
null,
|
|
4674
|
+
React__default["default"].createElement(ResolvedExpanderComponent, props),
|
|
4675
|
+
React__default["default"].createElement(ResolvedPivotValueComponent, props)
|
|
4676
|
+
);
|
|
4677
|
+
};
|
|
4678
|
+
var ResolvedPivotComponent = column.Pivot || DefaultResolvedPivotComponent;
|
|
4679
|
+
|
|
4680
|
+
// Is this cell expandable?
|
|
4681
|
+
if (cellInfo.pivoted || cellInfo.expander) {
|
|
4682
|
+
// Make it expandable by defualt
|
|
4683
|
+
cellInfo.expandable = true;
|
|
4684
|
+
useOnExpanderClick = true;
|
|
4685
|
+
// If pivoted, has no subRows, and does not have a subComponent,
|
|
4686
|
+
// do not make expandable
|
|
4687
|
+
if (cellInfo.pivoted && !cellInfo.subRows && !SubComponent) {
|
|
4688
|
+
cellInfo.expandable = false;
|
|
4689
|
+
}
|
|
4690
|
+
}
|
|
4691
|
+
|
|
4692
|
+
if (cellInfo.pivoted) {
|
|
4693
|
+
// Is this column a branch?
|
|
4694
|
+
isBranch = rowInfo.row[pivotIDKey] === column.id && cellInfo.subRows;
|
|
4695
|
+
// Should this column be blank?
|
|
4696
|
+
isPreview = pivotBy.indexOf(column.id) > pivotBy.indexOf(rowInfo.row[pivotIDKey]) && cellInfo.subRows;
|
|
4697
|
+
// Pivot Cell Render Override
|
|
4698
|
+
if (isBranch) {
|
|
4699
|
+
// isPivot
|
|
4700
|
+
resolvedCell = _.normalizeComponent(ResolvedPivotComponent, _extends({}, cellInfo, {
|
|
4701
|
+
value: row[pivotValKey]
|
|
4702
|
+
}), row[pivotValKey]);
|
|
4703
|
+
} else if (isPreview) {
|
|
4704
|
+
// Show the pivot preview
|
|
4705
|
+
resolvedCell = _.normalizeComponent(ResolvedAggregatedComponent, cellInfo, value);
|
|
4706
|
+
} else {
|
|
4707
|
+
resolvedCell = null;
|
|
4708
|
+
}
|
|
4709
|
+
} else if (cellInfo.aggregated) {
|
|
4710
|
+
resolvedCell = _.normalizeComponent(ResolvedAggregatedComponent, cellInfo, value);
|
|
4711
|
+
}
|
|
4712
|
+
|
|
4713
|
+
if (cellInfo.expander) {
|
|
4714
|
+
resolvedCell = _.normalizeComponent(ResolvedExpanderComponent, cellInfo, row[pivotValKey]);
|
|
4715
|
+
if (pivotBy) {
|
|
4716
|
+
if (cellInfo.groupedByPivot) {
|
|
4717
|
+
resolvedCell = null;
|
|
4718
|
+
}
|
|
4719
|
+
if (!cellInfo.subRows && !SubComponent) {
|
|
4720
|
+
resolvedCell = null;
|
|
4721
|
+
}
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4724
|
+
|
|
4725
|
+
var resolvedOnExpanderClick = useOnExpanderClick ? onExpanderClick : function () {};
|
|
4726
|
+
|
|
4727
|
+
// If there are multiple onClick events, make sure they don't
|
|
4728
|
+
// override eachother. This should maybe be expanded to handle all
|
|
4729
|
+
// function attributes
|
|
4730
|
+
var interactionProps = {
|
|
4731
|
+
onClick: resolvedOnExpanderClick
|
|
4732
|
+
};
|
|
4733
|
+
|
|
4734
|
+
if (tdProps.rest.onClick) {
|
|
4735
|
+
interactionProps.onClick = function (e) {
|
|
4736
|
+
tdProps.rest.onClick(e, function () {
|
|
4737
|
+
return resolvedOnExpanderClick(e);
|
|
4738
|
+
});
|
|
4739
|
+
};
|
|
4740
|
+
}
|
|
4741
|
+
|
|
4742
|
+
if (columnProps.rest.onClick) {
|
|
4743
|
+
interactionProps.onClick = function (e) {
|
|
4744
|
+
columnProps.rest.onClick(e, function () {
|
|
4745
|
+
return resolvedOnExpanderClick(e);
|
|
4746
|
+
});
|
|
4747
|
+
};
|
|
4748
|
+
}
|
|
4749
|
+
|
|
4750
|
+
// Return the cell
|
|
4751
|
+
return React__default["default"].createElement(
|
|
4752
|
+
TdComponent
|
|
4753
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
4754
|
+
,
|
|
4755
|
+
_extends({ key: i2 + '-' + column.id,
|
|
4756
|
+
className: classnames__default["default"](classes, !cellInfo.expandable && !show && 'hidden', cellInfo.expandable && 'rt-expandable', (isBranch || isPreview) && 'rt-pivot'),
|
|
4757
|
+
style: _extends({}, styles, {
|
|
4758
|
+
flex: width + ' 0 auto',
|
|
4759
|
+
width: _.asPx(width),
|
|
4760
|
+
maxWidth: _.asPx(maxWidth)
|
|
4761
|
+
})
|
|
4762
|
+
}, tdProps.rest, columnProps.rest, interactionProps),
|
|
4763
|
+
resolvedCell
|
|
4764
|
+
);
|
|
4765
|
+
})
|
|
4766
|
+
),
|
|
4767
|
+
rowInfo.subRows && isExpanded && rowInfo.subRows.map(function (d, i) {
|
|
4768
|
+
return makePageRow(d, i, rowInfo.nestingPath);
|
|
4769
|
+
}),
|
|
4770
|
+
SubComponent && !rowInfo.subRows && isExpanded && SubComponent(rowInfo, function () {
|
|
4771
|
+
var newExpanded = _.clone(expanded);
|
|
4772
|
+
|
|
4773
|
+
_.set(newExpanded, rowInfo.nestingPath, false);
|
|
4774
|
+
})
|
|
4775
|
+
);
|
|
4776
|
+
};
|
|
4777
|
+
|
|
4778
|
+
var makePadColumn = function makePadColumn(column, i) {
|
|
4779
|
+
var resizedCol = resized.find(function (x) {
|
|
4780
|
+
return x.id === column.id;
|
|
4781
|
+
}) || {};
|
|
4782
|
+
var show = typeof column.show === 'function' ? column.show() : column.show;
|
|
4783
|
+
var width = _.getFirstDefined(resizedCol.value, column.width, column.minWidth);
|
|
4784
|
+
var flex = width;
|
|
4785
|
+
var maxWidth = _.getFirstDefined(resizedCol.value, column.width, column.maxWidth);
|
|
4786
|
+
var tdProps = _.splitProps(getTdProps(finalState, undefined, column, _this2));
|
|
4787
|
+
var columnProps = _.splitProps(column.getProps(finalState, undefined, column, _this2));
|
|
4788
|
+
|
|
4789
|
+
var classes = [tdProps.className, column.className, columnProps.className];
|
|
4790
|
+
|
|
4791
|
+
var styles = _extends({}, tdProps.style, column.style, columnProps.style);
|
|
4792
|
+
|
|
4793
|
+
return React__default["default"].createElement(
|
|
4794
|
+
TdComponent,
|
|
4795
|
+
_extends({
|
|
4796
|
+
key: i + '-' + column.id,
|
|
4797
|
+
className: classnames__default["default"](classes, !show && 'hidden'),
|
|
4798
|
+
style: _extends({}, styles, {
|
|
4799
|
+
flex: flex + ' 0 auto',
|
|
4800
|
+
width: _.asPx(width),
|
|
4801
|
+
maxWidth: _.asPx(maxWidth)
|
|
4802
|
+
})
|
|
4803
|
+
}, tdProps.rest),
|
|
4804
|
+
_.normalizeComponent(PadRowComponent)
|
|
4805
|
+
);
|
|
4806
|
+
};
|
|
4807
|
+
|
|
4808
|
+
var makePadRow = function makePadRow(row, i) {
|
|
4809
|
+
var trGroupProps = getTrGroupProps(finalState, undefined, undefined, _this2);
|
|
4810
|
+
var trProps = _.splitProps(getTrProps(finalState, undefined, undefined, _this2));
|
|
4811
|
+
return React__default["default"].createElement(
|
|
4812
|
+
TrGroupComponent,
|
|
4813
|
+
_extends({ key: 'pad-' + i }, trGroupProps),
|
|
4814
|
+
React__default["default"].createElement(
|
|
4815
|
+
TrComponent,
|
|
4816
|
+
{
|
|
4817
|
+
className: classnames__default["default"]('-padRow', (pageRows.length + i) % 2 ? '-even' : '-odd', trProps.className),
|
|
4818
|
+
style: trProps.style || {}
|
|
4819
|
+
},
|
|
4820
|
+
allVisibleColumns.map(makePadColumn)
|
|
4821
|
+
)
|
|
4822
|
+
);
|
|
4823
|
+
};
|
|
4824
|
+
|
|
4825
|
+
var makeColumnFooter = function makeColumnFooter(column, i) {
|
|
4826
|
+
var resizedCol = resized.find(function (x) {
|
|
4827
|
+
return x.id === column.id;
|
|
4828
|
+
}) || {};
|
|
4829
|
+
var show = typeof column.show === 'function' ? column.show() : column.show;
|
|
4830
|
+
var width = _.getFirstDefined(resizedCol.value, column.width, column.minWidth);
|
|
4831
|
+
var maxWidth = _.getFirstDefined(resizedCol.value, column.width, column.maxWidth);
|
|
4832
|
+
var tFootTdProps = _.splitProps(getTfootTdProps(finalState, undefined, undefined, _this2));
|
|
4833
|
+
var columnProps = _.splitProps(column.getProps(finalState, undefined, column, _this2));
|
|
4834
|
+
var columnFooterProps = _.splitProps(column.getFooterProps(finalState, undefined, column, _this2));
|
|
4835
|
+
|
|
4836
|
+
var classes = [tFootTdProps.className, column.className, columnProps.className, columnFooterProps.className];
|
|
4837
|
+
|
|
4838
|
+
var styles = _extends({}, tFootTdProps.style, column.style, columnProps.style, columnFooterProps.style);
|
|
4839
|
+
|
|
4840
|
+
return React__default["default"].createElement(
|
|
4841
|
+
TdComponent,
|
|
4842
|
+
_extends({
|
|
4843
|
+
key: i + '-' + column.id,
|
|
4844
|
+
className: classnames__default["default"](classes, !show && 'hidden'),
|
|
4845
|
+
style: _extends({}, styles, {
|
|
4846
|
+
flex: width + ' 0 auto',
|
|
4847
|
+
width: _.asPx(width),
|
|
4848
|
+
maxWidth: _.asPx(maxWidth)
|
|
4849
|
+
})
|
|
4850
|
+
}, columnProps.rest, tFootTdProps.rest, columnFooterProps.rest),
|
|
4851
|
+
_.normalizeComponent(column.Footer, {
|
|
4852
|
+
data: sortedData,
|
|
4853
|
+
column: column
|
|
4854
|
+
})
|
|
4855
|
+
);
|
|
4856
|
+
};
|
|
4857
|
+
|
|
4858
|
+
var makeColumnFooters = function makeColumnFooters() {
|
|
4859
|
+
var tFootProps = _.splitProps(getTfootProps(finalState, undefined, undefined, _this2));
|
|
4860
|
+
var tFootTrProps = _.splitProps(getTfootTrProps(finalState, undefined, undefined, _this2));
|
|
4861
|
+
return React__default["default"].createElement(
|
|
4862
|
+
TfootComponent,
|
|
4863
|
+
_extends({
|
|
4864
|
+
className: tFootProps.className,
|
|
4865
|
+
style: _extends({}, tFootProps.style, {
|
|
4866
|
+
minWidth: rowMinWidth + 'px'
|
|
4867
|
+
})
|
|
4868
|
+
}, tFootProps.rest),
|
|
4869
|
+
React__default["default"].createElement(
|
|
4870
|
+
TrComponent,
|
|
4871
|
+
_extends({
|
|
4872
|
+
className: classnames__default["default"](tFootTrProps.className),
|
|
4873
|
+
style: tFootTrProps.style
|
|
4874
|
+
}, tFootTrProps.rest),
|
|
4875
|
+
allVisibleColumns.map(makeColumnFooter)
|
|
4876
|
+
)
|
|
4877
|
+
);
|
|
4878
|
+
};
|
|
4879
|
+
|
|
4880
|
+
var makePagination = function makePagination(isTop) {
|
|
4881
|
+
var paginationProps = _.splitProps(getPaginationProps(finalState, undefined, undefined, _this2));
|
|
4882
|
+
return React__default["default"].createElement(PaginationComponent, _extends({}, resolvedState, {
|
|
4883
|
+
pages: pages,
|
|
4884
|
+
canPrevious: canPrevious,
|
|
4885
|
+
canNext: canNext,
|
|
4886
|
+
onPageChange: _this2.onPageChange,
|
|
4887
|
+
onPageSizeChange: _this2.onPageSizeChange,
|
|
4888
|
+
className: paginationProps.className,
|
|
4889
|
+
style: paginationProps.style,
|
|
4890
|
+
isTop: isTop
|
|
4891
|
+
}, paginationProps.rest));
|
|
4892
|
+
};
|
|
4893
|
+
|
|
4894
|
+
var makeTable = function makeTable() {
|
|
4895
|
+
return React__default["default"].createElement(
|
|
4896
|
+
'div',
|
|
4897
|
+
_extends({
|
|
4898
|
+
className: classnames__default["default"]('ReactTable', className, rootProps.className),
|
|
4899
|
+
style: _extends({}, style, rootProps.style)
|
|
4900
|
+
}, rootProps.rest),
|
|
4901
|
+
showPagination && showPaginationTop ? React__default["default"].createElement(
|
|
4902
|
+
'div',
|
|
4903
|
+
{ className: 'pagination-top' },
|
|
4904
|
+
makePagination(true)
|
|
4905
|
+
) : null,
|
|
4906
|
+
React__default["default"].createElement(
|
|
4907
|
+
TableComponent,
|
|
4908
|
+
_extends({
|
|
4909
|
+
className: classnames__default["default"](tableProps.className, currentlyResizing ? 'rt-resizing' : ''),
|
|
4910
|
+
style: tableProps.style
|
|
4911
|
+
}, tableProps.rest),
|
|
4912
|
+
hasHeaderGroups ? makeHeaderGroups() : null,
|
|
4913
|
+
makeHeaders(),
|
|
4914
|
+
hasFilters ? makeFilters() : null,
|
|
4915
|
+
React__default["default"].createElement(
|
|
4916
|
+
TbodyComponent,
|
|
4917
|
+
_extends({
|
|
4918
|
+
className: classnames__default["default"](tBodyProps.className),
|
|
4919
|
+
style: _extends({}, tBodyProps.style, {
|
|
4920
|
+
minWidth: rowMinWidth + 'px'
|
|
4921
|
+
})
|
|
4922
|
+
}, tBodyProps.rest),
|
|
4923
|
+
pageRows.map(function (d, i) {
|
|
4924
|
+
return makePageRow(d, i);
|
|
4925
|
+
}),
|
|
4926
|
+
padRows.map(makePadRow)
|
|
4927
|
+
),
|
|
4928
|
+
hasColumnFooter ? makeColumnFooters() : null
|
|
4929
|
+
),
|
|
4930
|
+
showPagination && showPaginationBottom ? React__default["default"].createElement(
|
|
4931
|
+
'div',
|
|
4932
|
+
{ className: 'pagination-bottom' },
|
|
4933
|
+
makePagination(false)
|
|
4934
|
+
) : null,
|
|
4935
|
+
!pageRows.length && React__default["default"].createElement(
|
|
4936
|
+
NoDataComponent,
|
|
4937
|
+
noDataProps,
|
|
4938
|
+
_.normalizeComponent(noDataText)
|
|
4939
|
+
),
|
|
4940
|
+
React__default["default"].createElement(LoadingComponent, _extends({ loading: loading, loadingText: loadingText }, loadingProps))
|
|
4941
|
+
);
|
|
4942
|
+
};
|
|
4943
|
+
|
|
4944
|
+
// childProps are optionally passed to a function-as-a-child
|
|
4945
|
+
return children ? children(finalState, makeTable, this) : makeTable();
|
|
4946
|
+
}
|
|
4947
|
+
}]);
|
|
4948
|
+
|
|
4949
|
+
return ReactTable;
|
|
4950
|
+
}(Methods(Lifecycle(React.Component)));
|
|
4951
|
+
|
|
4952
|
+
ReactTable.propTypes = propTypes;
|
|
4953
|
+
ReactTable.defaultProps = defaultProps;
|
|
4954
|
+
|
|
1107
4955
|
var _a$2;
|
|
1108
4956
|
function frequencyOutput(frequency) {
|
|
1109
4957
|
if (frequency === 0) {
|
|
@@ -1158,7 +5006,7 @@ var GnomadFrequencyTable = /** @class */ (function (_super) {
|
|
|
1158
5006
|
writable: true,
|
|
1159
5007
|
value: function () {
|
|
1160
5008
|
return (React__namespace.createElement("div", { className: "gnomad-frequency-table", "data-test": "gnomad-table" },
|
|
1161
|
-
React__namespace.createElement(
|
|
5009
|
+
React__namespace.createElement(ReactTable, { data: this.props.data, showPagination: false, pageSize: this.props.data.length, sortable: false, className: "-striped -highlight", getTrProps: this.getTrProps, columns: [
|
|
1162
5010
|
{
|
|
1163
5011
|
id: GnomadTableColumnName.population,
|
|
1164
5012
|
accessor: 'population',
|
|
@@ -1788,7 +5636,7 @@ var DropdownSelector = /** @class */ (function (_super) {
|
|
|
1788
5636
|
var _a;
|
|
1789
5637
|
var allValuesSelected = this.allValues.length === this.selectedValues.length;
|
|
1790
5638
|
var classes = this.props.selectionIndicatorClassNames;
|
|
1791
|
-
return
|
|
5639
|
+
return classnames__default["default"](classes.base, (_a = {},
|
|
1792
5640
|
_a[classes.allSelected] = allValuesSelected,
|
|
1793
5641
|
_a[classes.partiallySelected] = !allValuesSelected,
|
|
1794
5642
|
_a));
|
|
@@ -2574,8 +6422,8 @@ var FilterResetPanel = /** @class */ (function (_super) {
|
|
|
2574
6422
|
writable: true,
|
|
2575
6423
|
value: {
|
|
2576
6424
|
buttonText: 'Remove filter',
|
|
2577
|
-
buttonClass:
|
|
2578
|
-
className:
|
|
6425
|
+
buttonClass: classnames__default["default"]('btn', 'btn-secondary', 'btn-sm'),
|
|
6426
|
+
className: classnames__default["default"]('alert', 'alert-success', styles$7.filterResetPanel),
|
|
2579
6427
|
}
|
|
2580
6428
|
});
|
|
2581
6429
|
FilterResetPanel = tslib.__decorate([
|
|
@@ -2997,8 +6845,8 @@ var DataTable = /** @class */ (function (_super) {
|
|
|
2997
6845
|
value: function () {
|
|
2998
6846
|
return (React__namespace.createElement("div", { className: "cbioportal-frontend" },
|
|
2999
6847
|
React__namespace.createElement(DataTableToolbar, { visibilityToggle: this.onVisibilityToggle, showSearchBox: this.props.showSearchBox, onSearch: this.onSearch, filterInputRef: this.filterInputRef, searchDelay: this.props.searchDelay, searchPlaceHolder: this.props.searchPlaceholder, info: this.props.info, showColumnVisibility: this.props.showColumnVisibility, columnVisibility: this.columnVisibilityDef, columnSelectorProps: this.props.columnSelectorProps }),
|
|
3000
|
-
React__namespace.createElement("div", { className:
|
|
3001
|
-
React__namespace.createElement(
|
|
6848
|
+
React__namespace.createElement("div", { className: classnames__default["default"](this.props.className, 'cbioportal-frontend', 'default-data-table') },
|
|
6849
|
+
React__namespace.createElement(ReactTable, tslib.__assign({ data: this.tableData, columns: this.columns, getTrProps: this.needToCustomizeRowStyle
|
|
3002
6850
|
? this.getTrProps
|
|
3003
6851
|
: undefined, defaultSorted: this.defaultSorted, defaultPageSize: this.props.initialItemsPerPage, showPagination: this.showPagination, className: "-striped -highlight", previousText: "<", nextText: ">", expanded: this.expanded, onExpandedChange: this.onExpandedChange, onPageChange: this.resetExpander, onPageSizeChange: this.resetExpander, onSortedChange: this.resetExpander, minRows: 1 }, this.props.reactTableProps)))));
|
|
3004
6852
|
}
|
|
@@ -5870,7 +9718,7 @@ var AxisScaleSwitch = /** @class */ (function (_super) {
|
|
|
5870
9718
|
configurable: true,
|
|
5871
9719
|
writable: true,
|
|
5872
9720
|
value: function (scale, onClick) {
|
|
5873
|
-
return (React__namespace.createElement("button", { className:
|
|
9721
|
+
return (React__namespace.createElement("button", { className: classnames__default["default"]({
|
|
5874
9722
|
'btn-secondary': this.props.selectedScale === scale,
|
|
5875
9723
|
'btn-outline-secondary': this.props.selectedScale !== scale,
|
|
5876
9724
|
}, 'btn', 'btn-sm', 'btn-axis-switch'), "data-test": "AxisScaleSwitch".concat(scale), style: {
|
|
@@ -6035,7 +9883,7 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
|
|
|
6035
9883
|
});
|
|
6036
9884
|
Object.defineProperty(LollipopMutationPlotControls.prototype, "trackSelector", {
|
|
6037
9885
|
get: function () {
|
|
6038
|
-
return (React__namespace.createElement("div", { className:
|
|
9886
|
+
return (React__namespace.createElement("div", { className: classnames__default["default"]('annotation-track-selector', 'small'), style: { width: 180, marginRight: 7 } },
|
|
6039
9887
|
React__namespace.createElement(TrackSelector, { tracks: this.props.tracks, trackVisibility: this.props.trackVisibility, trackDataStatus: this.props.trackDataStatus, onChange: this.props.onTrackVisibilityChange })));
|
|
6040
9888
|
},
|
|
6041
9889
|
enumerable: false,
|
|
@@ -6069,7 +9917,7 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
|
|
|
6069
9917
|
configurable: true,
|
|
6070
9918
|
writable: true,
|
|
6071
9919
|
value: function () {
|
|
6072
|
-
return (React__namespace.createElement("div", { className:
|
|
9920
|
+
return (React__namespace.createElement("div", { className: classnames__default["default"]('lollipop_mutation_plot__controls', this.props.showControls
|
|
6073
9921
|
? styles$5['fade-in']
|
|
6074
9922
|
: styles$5['fade-out']) },
|
|
6075
9923
|
React__namespace.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
|
|
@@ -6686,7 +10534,7 @@ var Track = /** @class */ (function (_super) {
|
|
|
6686
10534
|
position: 'relative',
|
|
6687
10535
|
display: 'flex',
|
|
6688
10536
|
} },
|
|
6689
|
-
React__namespace.createElement("span", { className:
|
|
10537
|
+
React__namespace.createElement("span", { className: classnames__default["default"](styles$4.trackTitle, 'small', "".concat(this.props.isSubTrack ? 'subtrack-' : '', "trackTitle")) }, this.props.trackTitle),
|
|
6690
10538
|
React__namespace.createElement("span", null,
|
|
6691
10539
|
React__namespace.createElement(cbioportalFrontendCommons.DefaultTooltip, tslib.__assign({ placement: this.getOverlayPlacement(), overlay: this.getOverlay, onVisibleChange: this.onTooltipVisibleChange, destroyTooltipOnHide: true }, this.tooltipVisibleProps), this.hitZone),
|
|
6692
10540
|
React__namespace.createElement("span", { style: { marginLeft: this.props.xOffset }, onMouseOver: this.onMouseOver },
|
|
@@ -7292,8 +11140,8 @@ var PtmAnnotationTable = /** @class */ (function (_super) {
|
|
|
7292
11140
|
var showPagination = data.length >
|
|
7293
11141
|
(this.props.initialItemsPerPage ||
|
|
7294
11142
|
PtmAnnotationTable_1.defaultProps.initialItemsPerPage);
|
|
7295
|
-
return (React__namespace.createElement("div", { className:
|
|
7296
|
-
React__namespace.createElement(
|
|
11143
|
+
return (React__namespace.createElement("div", { className: classnames__default["default"]('cbioportal-frontend', 'default-track-tooltip-table') },
|
|
11144
|
+
React__namespace.createElement(ReactTable, { data: data, columns: this.columns, defaultSorted: [
|
|
7297
11145
|
{
|
|
7298
11146
|
id: initialSortColumn ||
|
|
7299
11147
|
PtmAnnotationTable_1.defaultProps
|
|
@@ -7898,9 +11746,19 @@ var TrackPanel = /** @class */ (function (_super) {
|
|
|
7898
11746
|
configurable: true,
|
|
7899
11747
|
writable: true,
|
|
7900
11748
|
value: function (trackName, ptmSource) {
|
|
11749
|
+
var _this = this;
|
|
7901
11750
|
var _a;
|
|
7902
11751
|
return !this.props.trackVisibility ||
|
|
7903
|
-
this.props.trackVisibility[trackName] === 'visible' ? (React__namespace.createElement(PtmTrack, { store: this.props.store, pubMedCache: this.props.pubMedCache, ensemblTranscriptId: (_a = this.props.store.activeTranscript) === null || _a === void 0 ? void 0 : _a.result
|
|
11752
|
+
this.props.trackVisibility[trackName] === 'visible' ? (React__namespace.createElement(PtmTrack, { store: this.props.store, pubMedCache: this.props.pubMedCache, ensemblTranscriptId: ((_a = this.props.store.activeTranscript) === null || _a === void 0 ? void 0 : _a.result)
|
|
11753
|
+
? (function () {
|
|
11754
|
+
var _a;
|
|
11755
|
+
var tid = _this.props.store.activeTranscript
|
|
11756
|
+
.result;
|
|
11757
|
+
var ver = (_a = _this.props.store
|
|
11758
|
+
.transcriptsByTranscriptId[tid]) === null || _a === void 0 ? void 0 : _a.transcriptIdVersion;
|
|
11759
|
+
return ver ? "".concat(tid, ".").concat(ver) : tid;
|
|
11760
|
+
})()
|
|
11761
|
+
: undefined, dataStore: this.props.store.dataStore, width: this.props.geneWidth, xOffset: this.props.geneXOffset, proteinLength: this.proteinLength, dataSource: ptmSource, dataSourceUrl: cbioportalUtils.PTM_SOURCE_URL[ptmSource], ptmTooltipColumnOverrides: this.getPtmTooltipColumnOverrides(ptmSource), collapsed: this.props.collapsePtmTrack })) : null;
|
|
7904
11762
|
}
|
|
7905
11763
|
});
|
|
7906
11764
|
Object.defineProperty(TrackPanel.prototype, "getPtmTooltipColumnOverrides", {
|
|
@@ -10822,7 +14680,7 @@ var TranscriptDropdown = /** @class */ (function (_super) {
|
|
|
10822
14680
|
canonicalTranscriptId &&
|
|
10823
14681
|
transcriptsWithAnnotations.result &&
|
|
10824
14682
|
transcriptsWithAnnotations.result.length > 0;
|
|
10825
|
-
return (React__namespace.createElement("div", { className:
|
|
14683
|
+
return (React__namespace.createElement("div", { className: classnames__default["default"]('small', styles$1.dropDown) },
|
|
10826
14684
|
this.loadingIndicator(isLoading),
|
|
10827
14685
|
!isLoading &&
|
|
10828
14686
|
requiredData &&
|
|
@@ -10835,7 +14693,7 @@ var TranscriptDropdown = /** @class */ (function (_super) {
|
|
|
10835
14693
|
var requiredData = transcriptsWithProteinLength.result &&
|
|
10836
14694
|
transcriptsWithProteinLength.result.length > 0 &&
|
|
10837
14695
|
canonicalTranscriptId;
|
|
10838
|
-
return (React__namespace.createElement("div", { className:
|
|
14696
|
+
return (React__namespace.createElement("div", { className: classnames__default["default"]('small', styles$1.dropDown) },
|
|
10839
14697
|
this.loadingIndicator(isLoading),
|
|
10840
14698
|
!isLoading &&
|
|
10841
14699
|
requiredData &&
|
|
@@ -10850,11 +14708,15 @@ var TranscriptDropdown = /** @class */ (function (_super) {
|
|
|
10850
14708
|
value: function (activeTranscript, allTranscripts, canonicalTranscript, transcriptsByTranscriptId, mutationsByTranscriptId) {
|
|
10851
14709
|
var _this = this;
|
|
10852
14710
|
var activeRefseqMrnaId = transcriptsByTranscriptId[activeTranscript].refseqMrnaId;
|
|
14711
|
+
var activeVersionSuffix = transcriptsByTranscriptId[activeTranscript].transcriptIdVersion;
|
|
14712
|
+
var activeVersionedId = activeVersionSuffix
|
|
14713
|
+
? "".concat(activeTranscript, ".").concat(activeVersionSuffix)
|
|
14714
|
+
: activeTranscript;
|
|
10853
14715
|
return (React__namespace.createElement("div", null,
|
|
10854
14716
|
React__namespace.createElement(Select__default["default"], { "aria-label": "Transcript Dropdown", value: {
|
|
10855
14717
|
label: activeRefseqMrnaId
|
|
10856
14718
|
? activeRefseqMrnaId
|
|
10857
|
-
:
|
|
14719
|
+
: activeVersionedId,
|
|
10858
14720
|
value: activeTranscript,
|
|
10859
14721
|
}, clearable: false,
|
|
10860
14722
|
// need to explicitly set deleteRemoves for clearable
|
|
@@ -10862,11 +14724,16 @@ var TranscriptDropdown = /** @class */ (function (_super) {
|
|
|
10862
14724
|
deleteRemoves: false, options: this.sortTranscripts(allTranscripts).map(function (t) {
|
|
10863
14725
|
var length = transcriptsByTranscriptId[t].proteinLength;
|
|
10864
14726
|
var refseqMrnaId = transcriptsByTranscriptId[t].refseqMrnaId;
|
|
14727
|
+
var versionSuffix = transcriptsByTranscriptId[t]
|
|
14728
|
+
.transcriptIdVersion;
|
|
14729
|
+
var versionedId = versionSuffix
|
|
14730
|
+
? "".concat(t, ".").concat(versionSuffix)
|
|
14731
|
+
: t;
|
|
10865
14732
|
var ccdsId = transcriptsByTranscriptId[t].ccdsId;
|
|
10866
14733
|
var nrOfMutations = mutationsByTranscriptId &&
|
|
10867
14734
|
mutationsByTranscriptId[t] &&
|
|
10868
14735
|
mutationsByTranscriptId[t].length;
|
|
10869
|
-
var label = "".concat(refseqMrnaId ? "".concat(refseqMrnaId, " / ") : '').concat(
|
|
14736
|
+
var label = "".concat(refseqMrnaId ? "".concat(refseqMrnaId, " / ") : '').concat(versionedId, " ").concat(ccdsId ? "(".concat(ccdsId, ")") : '', " ").concat(length ? "(".concat(length, " amino acids)") : '', " ").concat(nrOfMutations
|
|
10870
14737
|
? "(".concat(nrOfMutations, " mutations)")
|
|
10871
14738
|
: '', " ").concat(t === canonicalTranscript ? ' (default)' : '');
|
|
10872
14739
|
return { label: label, value: t };
|
|
@@ -10921,23 +14788,29 @@ var TranscriptDropdown = /** @class */ (function (_super) {
|
|
|
10921
14788
|
var styles = {"geneSummary":"geneSummary-module_geneSummary__2baMD","geneSummaryCompact":"geneSummary-module_geneSummaryCompact__3_qUv","hugoSymbol":"geneSummary-module_hugoSymbol__KSt5x"};
|
|
10922
14789
|
|
|
10923
14790
|
var GeneSummaryInfo = function (_a) {
|
|
14791
|
+
var _b;
|
|
10924
14792
|
var uniprotId = _a.uniprotId, showDropDown = _a.showDropDown, canonicalTranscript = _a.canonicalTranscript, compactStyle = _a.compactStyle, activeTranscript = _a.activeTranscript, transcriptsByTranscriptId = _a.transcriptsByTranscriptId, transcriptSummaryUrlTemplate = _a.transcriptSummaryUrlTemplate;
|
|
10925
14793
|
var canonicalTranscriptId = canonicalTranscript.result && canonicalTranscript.result.transcriptId;
|
|
10926
14794
|
var transcript = activeTranscript && activeTranscript === canonicalTranscriptId
|
|
10927
14795
|
? canonicalTranscript.result
|
|
10928
14796
|
: transcriptsByTranscriptId[activeTranscript];
|
|
10929
14797
|
var refseqMrnaId = transcript && transcript.refseqMrnaId;
|
|
14798
|
+
var versionedTranscriptId = transcript && transcript.transcriptIdVersion
|
|
14799
|
+
? "".concat(transcript.transcriptId, ".").concat(transcript.transcriptIdVersion)
|
|
14800
|
+
: null;
|
|
10930
14801
|
var ccdsId = transcript && transcript.ccdsId;
|
|
10931
14802
|
var refSeq = refseqMrnaId ? (React__namespace.createElement("a", { href: cbioportalFrontendCommons.getNCBIlink("/nuccore/".concat(refseqMrnaId)), target: "_blank" }, refseqMrnaId)) : ('-');
|
|
10932
14803
|
var ensembl = showDropDown
|
|
10933
14804
|
? activeTranscript && (React__namespace.createElement("a", { href: getUrl(transcriptSummaryUrlTemplate, {
|
|
10934
14805
|
transcriptId: activeTranscript,
|
|
10935
|
-
}), target: "_blank" }, activeTranscript))
|
|
14806
|
+
}), target: "_blank" }, versionedTranscriptId || activeTranscript))
|
|
10936
14807
|
: canonicalTranscriptId && (
|
|
10937
14808
|
// down't show drop down, only the canonical transcript
|
|
10938
14809
|
React__namespace.createElement("a", { href: getUrl(transcriptSummaryUrlTemplate, {
|
|
10939
14810
|
transcriptId: canonicalTranscriptId,
|
|
10940
|
-
}), target: "_blank" },
|
|
14811
|
+
}), target: "_blank" }, ((_b = canonicalTranscript.result) === null || _b === void 0 ? void 0 : _b.transcriptIdVersion)
|
|
14812
|
+
? "".concat(canonicalTranscriptId, ".").concat(canonicalTranscript.result.transcriptIdVersion)
|
|
14813
|
+
: canonicalTranscriptId));
|
|
10941
14814
|
var ccds = ccdsId ? (React__namespace.createElement("a", { href: cbioportalFrontendCommons.getNCBIlink({
|
|
10942
14815
|
pathname: '/CCDS/CcdsBrowse.cgi',
|
|
10943
14816
|
query: {
|