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