diff --git a/es/components/browse/EmbeddedSearchView.js b/es/components/browse/EmbeddedSearchView.js index 425d036d..f7115a6d 100644 --- a/es/components/browse/EmbeddedSearchView.js +++ b/es/components/browse/EmbeddedSearchView.js @@ -1,23 +1,27 @@ +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["href", "context", "navigate", "currentAction", "searchHref", "renderSearchResultTable", "columns", "hideColumns", "facets", "aboveTableComponent", "aboveFacetListComponent", "facetListComponent", "columnExtensionMap", "onLoad", "filterFacetFxn", "filterColumnFxn", "windowWidth", "embeddedTableHeader", "embeddedTableFooter", "onClearFiltersVirtual", "isClearFiltersBtnVisible", "facetColumnClassName", "tableColumnClassName", "allowPostRequest", "clearSelectedItemsOnFilter", "selectedItems", "onSelectItem", "onResetSelectedItems"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -36,19 +40,18 @@ import { SearchResponse, Item, ColumnDefinition, URLParts } from './../util/type import { VirtualHrefController } from './components/VirtualHrefController'; export { SortController, SelectedItemsController, ColumnCombiner, CustomColumnController }; export var EmbeddedSearchView = /*#__PURE__*/function (_React$PureComponent) { - _inherits(EmbeddedSearchView, _React$PureComponent); - var _super = _createSuper(EmbeddedSearchView); function EmbeddedSearchView(props) { - var _this; + var _this2; _classCallCheck(this, EmbeddedSearchView); - _this = _super.call(this, props); - _this.filterFacetFxn = _this.filterFacetFxn.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, EmbeddedSearchView, [props]); + _this2.filterFacetFxn = _this2.filterFacetFxn.bind(_this2); + _this2.memoized = { listToObj: memoize(EmbeddedSearchView.listToObj) }; - return _this; + return _this2; } - _createClass(EmbeddedSearchView, [{ + _inherits(EmbeddedSearchView, _React$PureComponent); + return _createClass(EmbeddedSearchView, [{ key: "componentDidMount", value: function componentDidMount() { ReactTooltip.rebuild(); @@ -171,7 +174,6 @@ export var EmbeddedSearchView = /*#__PURE__*/function (_React$PureComponent) { }))); } }]); - return EmbeddedSearchView; }(React.PureComponent); /** * @property {string} searchHref - Base URI to search on. diff --git a/es/components/browse/SearchView.js b/es/components/browse/SearchView.js index 94045a0e..d2d535d1 100644 --- a/es/components/browse/SearchView.js +++ b/es/components/browse/SearchView.js @@ -1,22 +1,26 @@ +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["href", "context", "showClearFiltersButton", "schemas", "currentAction", "facets", "navigate", "columns", "columnExtensionMap", "placeholderReplacementFxn", "keepSelectionInStorage", "searchViewHeader", "windowWidth", "hideFacets"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -37,19 +41,18 @@ import { ControlsAndResults } from './components/ControlsAndResults'; import { SearchResponse, Item, ColumnDefinition, URLParts } from './../util/typedefs'; export { SortController, SelectedItemsController, ColumnCombiner, CustomColumnController }; export var SearchView = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SearchView, _React$PureComponent); - var _super = _createSuper(SearchView); function SearchView(props) { - var _this; + var _this2; _classCallCheck(this, SearchView); - _this = _super.call(this, props); - _this.filterFacetFxn = _this.filterFacetFxn.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, SearchView, [props]); + _this2.filterFacetFxn = _this2.filterFacetFxn.bind(_this2); + _this2.memoized = { listToObj: memoize(SearchView.listToObj) }; - return _this; + return _this2; } - _createClass(SearchView, [{ + _inherits(SearchView, _React$PureComponent); + return _createClass(SearchView, [{ key: "componentDidMount", value: function componentDidMount() { ReactTooltip.rebuild(); @@ -159,7 +162,6 @@ export var SearchView = /*#__PURE__*/function (_React$PureComponent) { return obj; } }]); - return SearchView; }(React.PureComponent); _defineProperty(SearchView, "propTypes", { 'context': PropTypes.object.isRequired, diff --git a/es/components/browse/components/AboveSearchTablePanel.js b/es/components/browse/components/AboveSearchTablePanel.js index 38d82eb4..006aad9a 100644 --- a/es/components/browse/components/AboveSearchTablePanel.js +++ b/es/components/browse/components/AboveSearchTablePanel.js @@ -1,4 +1,4 @@ -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +import _extends from "@babel/runtime/helpers/extends"; import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; diff --git a/es/components/browse/components/ActiveFiltersBar.js b/es/components/browse/components/ActiveFiltersBar.js index 4a4e945f..bf51af11 100644 --- a/es/components/browse/components/ActiveFiltersBar.js +++ b/es/components/browse/components/ActiveFiltersBar.js @@ -1,50 +1,51 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import _ from 'underscore'; import memoize from "memoize-one"; import * as vizUtil from './../../viz/utilities'; import { console, searchFilters } from './../../util'; export var ActiveFiltersBar = /*#__PURE__*/function (_React$PureComponent) { - _inherits(ActiveFiltersBar, _React$PureComponent); - var _super = _createSuper(ActiveFiltersBar); function ActiveFiltersBar(props) { - var _this; + var _this2; _classCallCheck(this, ActiveFiltersBar); - _this = _super.call(this, props); - _this.updateHoverNodes = _.throttle(_this.updateHoverNodes.bind(_assertThisInitialized(_this)), 200); - _this.renderCrumbs = _this.renderCrumbs.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, ActiveFiltersBar, [props]); + _this2.updateHoverNodes = _.throttle(_this2.updateHoverNodes.bind(_this2), 200); + _this2.renderCrumbs = _this2.renderCrumbs.bind(_this2); + _this2.memoized = { getSearchItemType: memoize(searchFilters.getSearchItemType) }; - return _this; + return _this2; } - _createClass(ActiveFiltersBar, [{ + _inherits(ActiveFiltersBar, _React$PureComponent); + return _createClass(ActiveFiltersBar, [{ key: "updateHoverNodes", value: function updateHoverNodes() { - var _this2 = this; + var _this3 = this; var sequence = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; vizUtil.requestAnimationFrame(function () { - _this2.setState({ + _this3.setState({ 'highlighted': sequence }); }); @@ -133,7 +134,6 @@ export var ActiveFiltersBar = /*#__PURE__*/function (_React$PureComponent) { }, this.renderCrumbs()); } }]); - return ActiveFiltersBar; }(React.PureComponent); _defineProperty(ActiveFiltersBar, "defaultProps", { 'schemas': null, diff --git a/es/components/browse/components/ControlsAndResults.js b/es/components/browse/components/ControlsAndResults.js index 17aa87d4..0fcf1723 100644 --- a/es/components/browse/components/ControlsAndResults.js +++ b/es/components/browse/components/ControlsAndResults.js @@ -1,20 +1,25 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +import _extends from "@babel/runtime/helpers/extends"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import memoize from 'memoize-one'; import { isSelectAction } from './../../util/misc'; @@ -26,22 +31,21 @@ import { FacetList, FacetListHeader } from './FacetList'; import { SearchResultDetailPane } from './SearchResultDetailPane'; import { SelectStickyFooter } from './SelectedItemsController'; export var ControlsAndResults = /*#__PURE__*/function (_React$PureComponent) { - _inherits(ControlsAndResults, _React$PureComponent); - var _super = _createSuper(ControlsAndResults); function ControlsAndResults(props) { - var _this; + var _this2; _classCallCheck(this, ControlsAndResults); - _this = _super.call(this, props); - _this.onClearFiltersClick = _this.onClearFiltersClick.bind(_assertThisInitialized(_this)); - _this.renderSearchDetailPane = _this.renderSearchDetailPane.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, ControlsAndResults, [props]); + _this2.onClearFiltersClick = _this2.onClearFiltersClick.bind(_this2); + _this2.renderSearchDetailPane = _this2.renderSearchDetailPane.bind(_this2); + _this2.memoized = { getSchemaTypeFromSearchContext: memoize(getSchemaTypeFromSearchContext), getAbstractTypeForType: memoize(getAbstractTypeForType) }; - _this.searchResultTableRef = /*#__PURE__*/React.createRef(); - return _this; + _this2.searchResultTableRef = /*#__PURE__*/React.createRef(); + return _this2; } - _createClass(ControlsAndResults, [{ + _inherits(ControlsAndResults, _React$PureComponent); + return _createClass(ControlsAndResults, [{ key: "onClearFiltersClick", value: function onClearFiltersClick(evt) { var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; @@ -254,7 +258,6 @@ export var ControlsAndResults = /*#__PURE__*/function (_React$PureComponent) { }) : null)); } }]); - return ControlsAndResults; }(React.PureComponent); /** diff --git a/es/components/browse/components/CustomColumnController.js b/es/components/browse/components/CustomColumnController.js index aab2f707..f455aab4 100644 --- a/es/components/browse/components/CustomColumnController.js +++ b/es/components/browse/components/CustomColumnController.js @@ -1,23 +1,27 @@ +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["children", "hiddenColumns", "columnDefinitions", "filterColumnFxn"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import memoize from 'memoize-one'; @@ -36,28 +40,27 @@ import { listToObj } from './../../util/object'; * @prop {Object.} [defaultHiddenColumns] - Initial hidden columns state object, if any. */ export var CustomColumnController = /*#__PURE__*/function (_React$Component) { - _inherits(CustomColumnController, _React$Component); - var _super = _createSuper(CustomColumnController); function CustomColumnController(props) { - var _this; + var _this2; _classCallCheck(this, CustomColumnController); - _this = _super.call(this, props); + _this2 = _callSuper(this, CustomColumnController, [props]); //this.getResetWidths = this.getResetWidths.bind(this); - _this.setColumnWidths = _this.setColumnWidths.bind(_assertThisInitialized(_this)); - _this.addHiddenColumn = _this.addHiddenColumn.bind(_assertThisInitialized(_this)); - _this.removeHiddenColumn = _this.removeHiddenColumn.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2.setColumnWidths = _this2.setColumnWidths.bind(_this2); + _this2.addHiddenColumn = _this2.addHiddenColumn.bind(_this2); + _this2.removeHiddenColumn = _this2.removeHiddenColumn.bind(_this2); + _this2.memoized = { hiddenColsListToObj: memoize(listToObj), filterOutStateHiddenCols: memoize(CustomColumnController.filterOutHiddenCols), filterOutPropHiddenCols: memoize(CustomColumnController.filterOutHiddenCols) }; - _this.state = { + _this2.state = { 'hiddenColumns': props.defaultHiddenColumns ? _objectSpread({}, props.defaultHiddenColumns) : {}, 'columnWidths': {} }; - return _this; + return _this2; } - _createClass(CustomColumnController, [{ + _inherits(CustomColumnController, _React$Component); + return _createClass(CustomColumnController, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps, pastState) { var defaultHiddenColumns = this.props.defaultHiddenColumns; @@ -158,7 +161,6 @@ export var CustomColumnController = /*#__PURE__*/function (_React$Component) { return columnDefinitions; } }]); - return CustomColumnController; }(React.Component); _defineProperty(CustomColumnController, "propTypes", { "children": PropTypes.element, @@ -168,19 +170,18 @@ _defineProperty(CustomColumnController, "propTypes", { "defaultHiddenColumns": PropTypes.object }); export var CustomColumnSelector = /*#__PURE__*/function (_React$PureComponent) { - _inherits(CustomColumnSelector, _React$PureComponent); - var _super2 = _createSuper(CustomColumnSelector); function CustomColumnSelector(props) { - var _this2; + var _this3; _classCallCheck(this, CustomColumnSelector); - _this2 = _super2.call(this, props); - _this2.handleOptionVisibilityChange = _.throttle(_this2.handleOptionVisibilityChange.bind(_assertThisInitialized(_this2)), 300); - _this2.memoized = { + _this3 = _callSuper(this, CustomColumnSelector, [props]); + _this3.handleOptionVisibilityChange = _.throttle(_this3.handleOptionVisibilityChange.bind(_this3), 300); + _this3.memoized = { columnDefinitionsWithHiddenState: memoize(CustomColumnSelector.columnDefinitionsWithHiddenState) }; - return _this2; + return _this3; } - _createClass(CustomColumnSelector, [{ + _inherits(CustomColumnSelector, _React$PureComponent); + return _createClass(CustomColumnSelector, [{ key: "handleOptionVisibilityChange", value: function handleOptionVisibilityChange(evt) { evt.stopPropagation(); @@ -198,7 +199,7 @@ export var CustomColumnSelector = /*#__PURE__*/function (_React$PureComponent) { }, { key: "render", value: function render() { - var _this3 = this; + var _this4 = this; var _this$props3 = this.props, columnDefinitions = _this$props3.columnDefinitions, hiddenColumns = _this$props3.hiddenColumns; @@ -209,7 +210,7 @@ export var CustomColumnSelector = /*#__PURE__*/function (_React$PureComponent) { key: colDef.field || idx, allColumns: all, index: idx, - handleOptionVisibilityChange: _this3.handleOptionVisibilityChange + handleOptionVisibilityChange: _this4.handleOptionVisibilityChange })); })); } @@ -234,7 +235,6 @@ export var CustomColumnSelector = /*#__PURE__*/function (_React$PureComponent) { }); } }]); - return CustomColumnSelector; }(React.PureComponent); CustomColumnSelector.propTypes = { 'hiddenColumns': PropTypes.object.isRequired, diff --git a/es/components/browse/components/DetailPaneStateCache.js b/es/components/browse/components/DetailPaneStateCache.js index dc8f806f..edf45722 100644 --- a/es/components/browse/components/DetailPaneStateCache.js +++ b/es/components/browse/components/DetailPaneStateCache.js @@ -1,12 +1,8 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["children"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React, { useMemo } from 'react'; /** diff --git a/es/components/browse/components/FacetList/ExtendedDescriptionPopoverIcon.js b/es/components/browse/components/FacetList/ExtendedDescriptionPopoverIcon.js index 04cbe78e..8e7cea00 100644 --- a/es/components/browse/components/FacetList/ExtendedDescriptionPopoverIcon.js +++ b/es/components/browse/components/FacetList/ExtendedDescriptionPopoverIcon.js @@ -1,9 +1,4 @@ -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; import React, { useMemo, useState, useRef } from 'react'; import memoize from 'memoize-one'; import PropTypes from 'prop-types'; diff --git a/es/components/browse/components/FacetList/FacetOfFacets.js b/es/components/browse/components/FacetList/FacetOfFacets.js index 1758635a..65761aa8 100644 --- a/es/components/browse/components/FacetList/FacetOfFacets.js +++ b/es/components/browse/components/FacetList/FacetOfFacets.js @@ -1,16 +1,21 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import memoize from 'memoize-one'; @@ -21,19 +26,18 @@ import Fade from 'react-bootstrap/esm/Fade'; * Used to render individual facet fields and their available terms in FacetList. */ export var FacetOfFacets = /*#__PURE__*/function (_React$PureComponent) { - _inherits(FacetOfFacets, _React$PureComponent); - var _super = _createSuper(FacetOfFacets); function FacetOfFacets(props) { - var _this; + var _this2; _classCallCheck(this, FacetOfFacets); - _this = _super.call(this, props); - _this.handleOpenToggleClick = _this.handleOpenToggleClick.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, FacetOfFacets, [props]); + _this2.handleOpenToggleClick = _this2.handleOpenToggleClick.bind(_this2); + _this2.memoized = { anyFacetsHaveSelection: memoize(FacetOfFacets.anyFacetsHaveSelection) }; - return _this; + return _this2; } - _createClass(FacetOfFacets, [{ + _inherits(FacetOfFacets, _React$PureComponent); + return _createClass(FacetOfFacets, [{ key: "handleOpenToggleClick", value: function handleOpenToggleClick(e) { e.preventDefault(); @@ -113,7 +117,6 @@ export var FacetOfFacets = /*#__PURE__*/function (_React$PureComponent) { return false; } }]); - return FacetOfFacets; }(React.PureComponent); FacetOfFacets.propTypes = { 'defaultGroupOpen': PropTypes.bool, diff --git a/es/components/browse/components/FacetList/FacetTermsList.js b/es/components/browse/components/FacetList/FacetTermsList.js index e08c03d9..a5af35c3 100644 --- a/es/components/browse/components/FacetList/FacetTermsList.js +++ b/es/components/browse/components/FacetList/FacetTermsList.js @@ -1,27 +1,26 @@ +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _extends from "@babel/runtime/helpers/extends"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["count", "countActive", "height", "width", "ltr", "className"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -132,16 +131,15 @@ export function segmentComponentsByStatus(termComponents) { * Used to render individual terms in FacetList. */ export var Term = /*#__PURE__*/function (_React$PureComponent) { - _inherits(Term, _React$PureComponent); - var _super = _createSuper(Term); function Term(props) { - var _this; + var _this2; _classCallCheck(this, Term); - _this = _super.call(this, props); - _this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this)); - return _this; + _this2 = _callSuper(this, Term, [props]); + _this2.handleClick = _this2.handleClick.bind(_this2); + return _this2; } - _createClass(Term, [{ + _inherits(Term, _React$PureComponent); + return _createClass(Term, [{ key: "handleClick", value: function handleClick(e) { var _this$props = this.props, @@ -275,7 +273,6 @@ export var Term = /*#__PURE__*/function (_React$PureComponent) { }, count))), subTermComponents); } }]); - return Term; }(React.PureComponent); /** @@ -357,21 +354,20 @@ export function getFilteredTerms(facetTerms, searchText, includeSubTerms) { }; } export var FacetTermsList = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(FacetTermsList, _React$PureComponent2); - var _super2 = _createSuper(FacetTermsList); function FacetTermsList(props) { - var _this2; + var _this3; _classCallCheck(this, FacetTermsList); - _this2 = _super2.call(this, props); - _this2.handleOpenToggleClick = _this2.handleOpenToggleClick.bind(_assertThisInitialized(_this2)); - _this2.handleExpandListToggleClick = _this2.handleExpandListToggleClick.bind(_assertThisInitialized(_this2)); - _this2.handleSaytTermSearch = _this2.handleSaytTermSearch.bind(_assertThisInitialized(_this2)); - _this2.state = { + _this3 = _callSuper(this, FacetTermsList, [props]); + _this3.handleOpenToggleClick = _this3.handleOpenToggleClick.bind(_this3); + _this3.handleExpandListToggleClick = _this3.handleExpandListToggleClick.bind(_this3); + _this3.handleSaytTermSearch = _this3.handleSaytTermSearch.bind(_this3); + _this3.state = { 'expanded': false }; - return _this2; + return _this3; } - _createClass(FacetTermsList, [{ + _inherits(FacetTermsList, _React$PureComponent2); + return _createClass(FacetTermsList, [{ key: "handleOpenToggleClick", value: function handleOpenToggleClick(e) { e.preventDefault(); @@ -521,7 +517,6 @@ export var FacetTermsList = /*#__PURE__*/function (_React$PureComponent2) { })); } }]); - return FacetTermsList; }(React.PureComponent); FacetTermsList.defaultProps = { 'persistentCount': 10, diff --git a/es/components/browse/components/FacetList/RangeFacet.js b/es/components/browse/components/FacetList/RangeFacet.js index 41a7ed91..723ddee1 100644 --- a/es/components/browse/components/FacetList/RangeFacet.js +++ b/es/components/browse/components/FacetList/RangeFacet.js @@ -1,26 +1,26 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _extends from "@babel/runtime/helpers/extends"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -128,36 +128,35 @@ export function formatRangeVal(termTransformFxn, fieldFacetObj, rangeValue) { return valToShow; } export var RangeFacet = /*#__PURE__*/function (_React$PureComponent) { - _inherits(RangeFacet, _React$PureComponent); - var _super = _createSuper(RangeFacet); function RangeFacet(props) { - var _this; + var _this2; _classCallCheck(this, RangeFacet); - _this = _super.call(this, props); - _this.handleOpenToggleClick = _this.handleOpenToggleClick.bind(_assertThisInitialized(_this)); - _this.handleExpandListToggleClick = _this.handleExpandListToggleClick.bind(_assertThisInitialized(_this)); - _this.setFrom = _this.setFrom.bind(_assertThisInitialized(_this)); - _this.setTo = _this.setTo.bind(_assertThisInitialized(_this)); - _this.setToAndFrom = _this.setToAndFrom.bind(_assertThisInitialized(_this)); - _this.selectRange = _this.selectRange.bind(_assertThisInitialized(_this)); - _this.resetAll = _this.selectRange.bind(_assertThisInitialized(_this), null, null); - _this.resetFrom = _this.resetFrom.bind(_assertThisInitialized(_this)); - _this.resetTo = _this.resetTo.bind(_assertThisInitialized(_this)); - _this.performUpdateFrom = _this.performUpdateFrom.bind(_assertThisInitialized(_this)); - _this.performUpdateTo = _this.performUpdateTo.bind(_assertThisInitialized(_this)); - _this.performUpdateToAndFrom = _this.performUpdateToAndFrom.bind(_assertThisInitialized(_this)); - _this.termTitle = _this.termTitle.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, RangeFacet, [props]); + _this2.handleOpenToggleClick = _this2.handleOpenToggleClick.bind(_this2); + _this2.handleExpandListToggleClick = _this2.handleExpandListToggleClick.bind(_this2); + _this2.setFrom = _this2.setFrom.bind(_this2); + _this2.setTo = _this2.setTo.bind(_this2); + _this2.setToAndFrom = _this2.setToAndFrom.bind(_this2); + _this2.selectRange = _this2.selectRange.bind(_this2); + _this2.resetAll = _this2.selectRange.bind(_this2, null, null); + _this2.resetFrom = _this2.resetFrom.bind(_this2); + _this2.resetTo = _this2.resetTo.bind(_this2); + _this2.performUpdateFrom = _this2.performUpdateFrom.bind(_this2); + _this2.performUpdateTo = _this2.performUpdateTo.bind(_this2); + _this2.performUpdateToAndFrom = _this2.performUpdateToAndFrom.bind(_this2); + _this2.termTitle = _this2.termTitle.bind(_this2); + _this2.memoized = { fieldSchema: memoize(getSchemaProperty), validIncrements: memoize(RangeFacet.validIncrements) }; - _this.state = _objectSpread(_objectSpread({}, RangeFacet.initialStateValues(props)), {}, { + _this2.state = _objectSpread(_objectSpread({}, RangeFacet.initialStateValues(props)), {}, { "facetClosing": false, "expanded": false }); - return _this; + return _this2; } - _createClass(RangeFacet, [{ + _inherits(RangeFacet, _React$PureComponent); + return _createClass(RangeFacet, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps) { var previousToVal = pastProps.toVal, @@ -288,25 +287,25 @@ export var RangeFacet = /*#__PURE__*/function (_React$PureComponent) { }, { key: "resetFrom", value: function resetFrom(callback) { - var _this2 = this; + var _this3 = this; this.setFrom(null, function () { - _this2.performUpdateFrom(callback); + _this3.performUpdateFrom(callback); }); } }, { key: "resetTo", value: function resetTo(callback) { - var _this3 = this; + var _this4 = this; this.setTo(null, function () { - _this3.performUpdateTo(callback); + _this4.performUpdateTo(callback); }); } }, { key: "selectRange", value: function selectRange(to, from, callback) { - var _this4 = this; + var _this5 = this; this.setToAndFrom(to, from, function () { - _this4.performUpdateToAndFrom(callback); + _this5.performUpdateToAndFrom(callback); }); } }, { @@ -620,7 +619,6 @@ export var RangeFacet = /*#__PURE__*/function (_React$PureComponent) { return state; } }]); - return RangeFacet; }(React.PureComponent); var ListOfRanges = /*#__PURE__*/React.memo(function (props) { var facet = props.facet, @@ -769,16 +767,15 @@ var ListOfRanges = /*#__PURE__*/React.memo(function (props) { * Used to render a term with range functionality in FacetList. Basically same as FacetTermsList > Term... maybe merge later */ export var RangeTerm = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(RangeTerm, _React$PureComponent2); - var _super2 = _createSuper(RangeTerm); function RangeTerm(props) { - var _this5; + var _this6; _classCallCheck(this, RangeTerm); - _this5 = _super2.call(this, props); - _this5.handleClick = _this5.handleClick.bind(_assertThisInitialized(_this5)); - return _this5; + _this6 = _callSuper(this, RangeTerm, [props]); + _this6.handleClick = _this6.handleClick.bind(_this6); + return _this6; } - _createClass(RangeTerm, [{ + _inherits(RangeTerm, _React$PureComponent2); + return _createClass(RangeTerm, [{ key: "handleClick", value: function handleClick(e) { var _this$props8 = this.props, @@ -855,7 +852,6 @@ export var RangeTerm = /*#__PURE__*/function (_React$PureComponent2) { }, doc_count || 0) : null)); } }]); - return RangeTerm; }(React.PureComponent); RangeTerm.propTypes = { 'facet': PropTypes.shape({ @@ -960,25 +956,24 @@ var RangeClear = /*#__PURE__*/React.memo(function (props) { })))); }); var RangeDropdown = /*#__PURE__*/function (_React$PureComponent3) { - _inherits(RangeDropdown, _React$PureComponent3); - var _super3 = _createSuper(RangeDropdown); function RangeDropdown(props) { - var _this6; + var _this7; _classCallCheck(this, RangeDropdown); - _this6 = _super3.call(this, props); - _this6.state = { + _this7 = _callSuper(this, RangeDropdown, [props]); + _this7.state = { showMenu: false, toggling: false }; - _this6.onTextInputChange = _this6.onTextInputChange.bind(_assertThisInitialized(_this6)); - _this6.onDropdownSelect = _this6.onDropdownSelect.bind(_assertThisInitialized(_this6)); - _this6.onTextInputFormSubmit = _this6.onTextInputFormSubmit.bind(_assertThisInitialized(_this6)); - _this6.onTextInputKeyDown = _this6.onTextInputKeyDown.bind(_assertThisInitialized(_this6)); - _this6.toggleDrop = _this6.toggleDrop.bind(_assertThisInitialized(_this6)); - _this6.onBlur = _this6.onBlur.bind(_assertThisInitialized(_this6)); - return _this6; + _this7.onTextInputChange = _this7.onTextInputChange.bind(_this7); + _this7.onDropdownSelect = _this7.onDropdownSelect.bind(_this7); + _this7.onTextInputFormSubmit = _this7.onTextInputFormSubmit.bind(_this7); + _this7.onTextInputKeyDown = _this7.onTextInputKeyDown.bind(_this7); + _this7.toggleDrop = _this7.toggleDrop.bind(_this7); + _this7.onBlur = _this7.onBlur.bind(_this7); + return _this7; } - _createClass(RangeDropdown, [{ + _inherits(RangeDropdown, _React$PureComponent3); + return _createClass(RangeDropdown, [{ key: "onTextInputChange", value: function onTextInputChange(evt) { var onSelect = this.props.onSelect; @@ -1032,7 +1027,7 @@ var RangeDropdown = /*#__PURE__*/function (_React$PureComponent3) { }, { key: "toggleDrop", value: function toggleDrop() { - var _this7 = this; + var _this8 = this; var _this$state3 = this.state, showMenu = _this$state3.showMenu, toggling = _this$state3.toggling; @@ -1042,7 +1037,7 @@ var RangeDropdown = /*#__PURE__*/function (_React$PureComponent3) { showMenu: !showMenu, toggling: true }, function () { - _this7.setState({ + _this8.setState({ toggling: false }); }); @@ -1191,5 +1186,4 @@ var RangeDropdown = /*#__PURE__*/function (_React$PureComponent3) { } } }]); - return RangeDropdown; }(React.PureComponent); \ No newline at end of file diff --git a/es/components/browse/components/FacetList/TermsFacet.js b/es/components/browse/components/FacetList/TermsFacet.js index af22a312..a337c215 100644 --- a/es/components/browse/components/FacetList/TermsFacet.js +++ b/es/components/browse/components/FacetList/TermsFacet.js @@ -1,19 +1,24 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -37,23 +42,21 @@ import { StaticSingleTerm } from './StaticSingleTerm'; * Used to render individual facet fields and their available terms in FacetList. */ export var TermsFacet = /*#__PURE__*/function (_React$PureComponent) { - _inherits(TermsFacet, _React$PureComponent); - var _super = _createSuper(TermsFacet); function TermsFacet(props) { - var _this; + var _this2; _classCallCheck(this, TermsFacet); - _this = _super.call(this, props); - _this.handleStaticClick = _this.handleStaticClick.bind(_assertThisInitialized(_this)); - _this.handleTermClick = _this.handleTermClick.bind(_assertThisInitialized(_this)); - _this.handleBasicTermSearch = _this.handleBasicTermSearch.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, TermsFacet, [props]); + _this2.handleStaticClick = _this2.handleStaticClick.bind(_this2); + _this2.handleTermClick = _this2.handleTermClick.bind(_this2); + _this2.handleBasicTermSearch = _this2.handleBasicTermSearch.bind(_this2); + _this2.state = { 'filtering': false, 'searchText': '' }; - _this.memoized = { + _this2.memoized = { fieldSchema: memoize(getSchemaProperty) }; - return _this; + return _this2; } /** @@ -63,10 +66,11 @@ export var TermsFacet = /*#__PURE__*/function (_React$PureComponent) { * * @todo Allow to specify interval for histogram & date_histogram in schema instead of hard-coding 'month' interval. */ - _createClass(TermsFacet, [{ + _inherits(TermsFacet, _React$PureComponent); + return _createClass(TermsFacet, [{ key: "handleStaticClick", value: function handleStaticClick(e) { - var _this2 = this; + var _this3 = this; var _this$props = this.props, facet = _this$props.facet, isStatic = _this$props.isStatic; @@ -77,8 +81,8 @@ export var TermsFacet = /*#__PURE__*/function (_React$PureComponent) { this.setState({ 'filtering': true }, function () { - _this2.handleTermClick(facet, term, e, function () { - return _this2.setState({ + _this3.handleTermClick(facet, term, e, function () { + return _this3.setState({ 'filtering': false }); }); @@ -151,7 +155,6 @@ export var TermsFacet = /*#__PURE__*/function (_React$PureComponent) { } } }]); - return TermsFacet; }(React.PureComponent); TermsFacet.propTypes = { 'facet': PropTypes.shape({ diff --git a/es/components/browse/components/FacetList/index.js b/es/components/browse/components/FacetList/index.js index b90162ef..247ecde9 100644 --- a/es/components/browse/components/FacetList/index.js +++ b/es/components/browse/components/FacetList/index.js @@ -1,31 +1,28 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _extends from "@babel/runtime/helpers/extends"; +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _toArray from "@babel/runtime/helpers/toArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import memoize from 'memoize-one'; import PropTypes from 'prop-types'; @@ -135,22 +132,20 @@ export function generateNextHref(currentHref, contextFilters, facet, term) { return targetSearchHref.replaceAll("%20", "+"); } export var FacetList = /*#__PURE__*/function (_React$PureComponent) { - _inherits(FacetList, _React$PureComponent); - var _super = _createSuper(FacetList); function FacetList(props) { - var _this; + var _this2; _classCallCheck(this, FacetList); - _this = _super.call(this, props); + _this2 = _callSuper(this, FacetList, [props]); console.log("FacetList props,", props); - _this.onFilterExtended = _this.onFilterExtended.bind(_assertThisInitialized(_this)); - _this.onFilterMultipleExtended = _this.onFilterMultipleExtended.bind(_assertThisInitialized(_this)); - _this.getTermStatus = _this.getTermStatus.bind(_assertThisInitialized(_this)); - _this.handleToggleFacetOpen = _this.handleToggleFacetOpen.bind(_assertThisInitialized(_this)); - _this.handleCollapseAllFacets = _this.handleCollapseAllFacets.bind(_assertThisInitialized(_this)); - _this.setOpenPopover = _this.setOpenPopover.bind(_assertThisInitialized(_this)); - _this.renderFacetComponents = _this.renderFacetComponents.bind(_assertThisInitialized(_this)); - _this.onToggleIncluding = _this.onToggleIncluding.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2.onFilterExtended = _this2.onFilterExtended.bind(_this2); + _this2.onFilterMultipleExtended = _this2.onFilterMultipleExtended.bind(_this2); + _this2.getTermStatus = _this2.getTermStatus.bind(_this2); + _this2.handleToggleFacetOpen = _this2.handleToggleFacetOpen.bind(_this2); + _this2.handleCollapseAllFacets = _this2.handleCollapseAllFacets.bind(_this2); + _this2.setOpenPopover = _this2.setOpenPopover.bind(_this2); + _this2.renderFacetComponents = _this2.renderFacetComponents.bind(_this2); + _this2.onToggleIncluding = _this2.onToggleIncluding.bind(_this2); + _this2.memoized = { countActiveTermsByField: memoize(countActiveTermsByField), getRangeValuesFromFiltersByField: memoize(getRangeValuesFromFiltersByField), sortedFinalFacetObjects: memoize(FacetList.sortedFinalFacetObjects), @@ -180,7 +175,7 @@ export var FacetList = /*#__PURE__*/function (_React$PureComponent) { extendComponentsWithFacetOpen: memoize(FacetList.extendComponentsWithFacetOpen), getInitialOpenFacetsAfterMount: memoize(FacetList.getInitialOpenFacetsAfterMount) }; - _this.state = { + _this2.state = { including: true, // if false, show "not facets" or exclude facets openFacets: {}, @@ -189,9 +184,10 @@ export var FacetList = /*#__PURE__*/function (_React$PureComponent) { // will contain `{ ref: React Ref, popover: JSX element/component }`. We might want to move this functionality up into like App.js. filteringFieldTerm: null // will contain `{ field: string, term: string|[from, to] }`. Used to show loading indicators on clicked-on terms. }; - return _this; + return _this2; } - _createClass(FacetList, [{ + _inherits(FacetList, _React$PureComponent); + return _createClass(FacetList, [{ key: "componentDidMount", value: function componentDidMount() { var _this$props = this.props, @@ -824,7 +820,6 @@ export var FacetList = /*#__PURE__*/function (_React$PureComponent) { }); } }]); - return FacetList; }(React.PureComponent); _defineProperty(FacetList, "propTypes", { 'facets': PropTypes.arrayOf(PropTypes.shape({ diff --git a/es/components/browse/components/SearchResultDetailPane.js b/es/components/browse/components/SearchResultDetailPane.js index 8b94f143..ed5724c1 100644 --- a/es/components/browse/components/SearchResultDetailPane.js +++ b/es/components/browse/components/SearchResultDetailPane.js @@ -1,30 +1,34 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import ReactTooltip from 'react-tooltip'; import { Detail } from './../../ui/ItemDetailList'; import { FlexibleDescriptionBox } from './../../ui/FlexibleDescriptionBox'; export var SearchResultDetailPane = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SearchResultDetailPane, _React$PureComponent); - var _super = _createSuper(SearchResultDetailPane); function SearchResultDetailPane() { _classCallCheck(this, SearchResultDetailPane); - return _super.apply(this, arguments); + return _callSuper(this, SearchResultDetailPane, arguments); } - _createClass(SearchResultDetailPane, [{ + _inherits(SearchResultDetailPane, _React$PureComponent); + return _createClass(SearchResultDetailPane, [{ key: "componentDidMount", value: function componentDidMount() { ReactTooltip.rebuild(); @@ -75,7 +79,6 @@ export var SearchResultDetailPane = /*#__PURE__*/function (_React$PureComponent) }))); } }]); - return SearchResultDetailPane; }(React.PureComponent); _defineProperty(SearchResultDetailPane, "propTypes", { 'result': PropTypes.shape({ diff --git a/es/components/browse/components/SearchResultTable.js b/es/components/browse/components/SearchResultTable.js index 29b8fc7c..e7fea322 100644 --- a/es/components/browse/components/SearchResultTable.js +++ b/es/components/browse/components/SearchResultTable.js @@ -1,23 +1,27 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _extends from "@babel/runtime/helpers/extends"; var _excluded = ["columnDefinitions", "mounted", "columnWidths", "windowWidth", "defaultColAlignment"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import url from 'url'; @@ -90,32 +94,31 @@ var DefaultDetailPane = /*#__PURE__*/React.memo(function (_ref) { }))); }); var ResultDetail = /*#__PURE__*/function (_React$PureComponent) { - _inherits(ResultDetail, _React$PureComponent); - var _super = _createSuper(ResultDetail); function ResultDetail(props) { - var _this; + var _this2; _classCallCheck(this, ResultDetail); - _this = _super.call(this, props); - _this.setDetailHeightFromPane = _this.setDetailHeightFromPane.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, ResultDetail, [props]); + _this2.setDetailHeightFromPane = _this2.setDetailHeightFromPane.bind(_this2); + _this2.state = { 'closing': false }; - _this.detailRef = /*#__PURE__*/React.createRef(); + _this2.detailRef = /*#__PURE__*/React.createRef(); // Unsure if worth keeping/using still? // Is potentially relevant but not ideally-implemented for BrowseView // which has DetailPane which itself has collapsible areas and the height // can thus vary outside of the open/closed toggle state in this table. // Ideally, those things could hook into `setDetailHeight` maybe... - _this.lastFoundHeight = null; - return _this; + _this2.lastFoundHeight = null; + return _this2; } /** * @todo Call this function in ExperimentSetDetailPane to keep heights up-to-date * when Processed Files or Raw Files sections are expanded/collapsed as well as just row itself. */ - _createClass(ResultDetail, [{ + _inherits(ResultDetail, _React$PureComponent); + return _createClass(ResultDetail, [{ key: "setDetailHeightFromPane", value: function setDetailHeightFromPane() { var height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; @@ -216,7 +219,6 @@ var ResultDetail = /*#__PURE__*/function (_React$PureComponent) { })), detailPane) : /*#__PURE__*/React.createElement("div", null)); } }]); - return ResultDetail; }(React.PureComponent); _defineProperty(ResultDetail, "propTypes", { 'result': PropTypes.object.isRequired, @@ -234,19 +236,17 @@ _defineProperty(ResultDetail, "propTypes", { 'context': PropTypes.object // For analyitics }); var ResultRow = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(ResultRow, _React$PureComponent2); - var _super2 = _createSuper(ResultRow); function ResultRow(props) { - var _this2; + var _this3; _classCallCheck(this, ResultRow); - _this2 = _super2.call(this, props); - _this2.toggleDetailOpen = _.throttle(_this2.toggleDetailOpen.bind(_assertThisInitialized(_this2)), 250); - _this2.setDetailHeight = _this2.setDetailHeight.bind(_assertThisInitialized(_this2)); - _this2.handleDragStart = _this2.handleDragStart.bind(_assertThisInitialized(_this2)); - _this2.memoized = { + _this3 = _callSuper(this, ResultRow, [props]); + _this3.toggleDetailOpen = _.throttle(_this3.toggleDetailOpen.bind(_this3), 250); + _this3.setDetailHeight = _this3.setDetailHeight.bind(_this3); + _this3.handleDragStart = _this3.handleDragStart.bind(_this3); + _this3.memoized = { getStyles: memoize(ResultRow.getStyles) }; - return _this2; + return _this3; } // componentDidUpdate(pastProps){ @@ -256,7 +256,8 @@ var ResultRow = /*#__PURE__*/function (_React$PureComponent2) { // } // }); // } - _createClass(ResultRow, [{ + _inherits(ResultRow, _React$PureComponent2); + return _createClass(ResultRow, [{ key: "setDetailHeight", value: function setDetailHeight() { var _this$props3 = this.props, @@ -316,7 +317,7 @@ var ResultRow = /*#__PURE__*/function (_React$PureComponent2) { }, { key: "renderColumns", value: function renderColumns() { - var _this3 = this; + var _this4 = this; // TODO (?) prop func to do this to control which columns get which props. var _this$props6 = this.props, columnDefinitions = _this$props6.columnDefinitions, @@ -335,7 +336,7 @@ var ResultRow = /*#__PURE__*/function (_React$PureComponent2) { columnNumber: columnNumber, defaultColAlignment: defaultColAlignment, // Only needed on first column (contains title, checkbox) - 'toggleDetailOpen': columnNumber === 0 ? _this3.toggleDetailOpen : null + 'toggleDetailOpen': columnNumber === 0 ? _this4.toggleDetailOpen : null }); var width; if (mounted) { @@ -412,7 +413,6 @@ var ResultRow = /*#__PURE__*/function (_React$PureComponent2) { }; } }]); - return ResultRow; }(React.PureComponent); _defineProperty(ResultRow, "propTypes", { 'result': PropTypes.shape({ @@ -437,29 +437,28 @@ _defineProperty(ResultRow, "propTypes", { 'context': PropTypes.object.isRequired }); var LoadMoreAsYouScroll = /*#__PURE__*/function (_React$Component) { - _inherits(LoadMoreAsYouScroll, _React$Component); - var _super3 = _createSuper(LoadMoreAsYouScroll); function LoadMoreAsYouScroll(props) { - var _this4; + var _this5; _classCallCheck(this, LoadMoreAsYouScroll); - _this4 = _super3.call(this, props); - _this4.handleLoad = _.throttle(_this4.handleLoad.bind(_assertThisInitialized(_this4)), 3000); - _this4.state = { + _this5 = _callSuper(this, LoadMoreAsYouScroll, [props]); + _this5.handleLoad = _.throttle(_this5.handleLoad.bind(_this5), 3000); + _this5.state = { 'isLoading': false }; if (typeof props.mounted === 'undefined') { - _this4.state.mounted = false; + _this5.state.mounted = false; } - _this4.memoized = { + _this5.memoized = { getStyles: memoize(LoadMoreAsYouScroll.getStyles), getElementHeight: memoize(LoadMoreAsYouScroll.getElementHeight) }; - _this4.lastIsScrolling = false; - _this4.infiniteComponentRef = /*#__PURE__*/React.createRef(); - _this4.currRequest = null; - return _this4; + _this5.lastIsScrolling = false; + _this5.infiniteComponentRef = /*#__PURE__*/React.createRef(); + _this5.currRequest = null; + return _this5; } - _createClass(LoadMoreAsYouScroll, [{ + _inherits(LoadMoreAsYouScroll, _React$Component); + return _createClass(LoadMoreAsYouScroll, [{ key: "componentDidMount", value: function componentDidMount() { if (typeof this.state.mounted === 'boolean') { @@ -471,7 +470,7 @@ var LoadMoreAsYouScroll = /*#__PURE__*/function (_React$Component) { }, { key: "handleLoad", value: function handleLoad() { - var _this5 = this; + var _this6 = this; var _this$props8 = this.props, origHref = _this$props8.href, _this$props8$requeste = _this$props8.requestedCompoundFilterSet, @@ -504,7 +503,7 @@ var LoadMoreAsYouScroll = /*#__PURE__*/function (_React$Component) { this.currRequest.abort(); } var loadCallback = function (resp) { - if (requestInThisScope !== _this5.currRequest) { + if (requestInThisScope !== _this6.currRequest) { // Shouldn't occur - extra redundancy console.warn("Throwing out outdated load-more-as-you-scroll request."); return false; @@ -520,7 +519,7 @@ var LoadMoreAsYouScroll = /*#__PURE__*/function (_React$Component) { if (keyIntersection.length > 0) { logger.error("FOUND ALREADY-PRESENT RESULT IN NEW RESULTS.'", keyIntersection, newKeys); // We can refresh current page to get newest results. - _this5.setState({ + _this6.setState({ 'isLoading': false }, function () { if (origCompoundFilterSet) { @@ -536,7 +535,7 @@ var LoadMoreAsYouScroll = /*#__PURE__*/function (_React$Component) { } }); } else { - _this5.setState({ + _this6.setState({ 'isLoading': false }, function () { var impressionedItems = analytics.impressionListOfItems(nextResults, nextHref || window.location.href, isOwnPage ? analytics.hrefToListName(nextHref) : "Embedded Search View"); @@ -549,16 +548,16 @@ var LoadMoreAsYouScroll = /*#__PURE__*/function (_React$Component) { }); } } else { - _this5.setState({ + _this6.setState({ 'isLoading': false }); } - _this5.currRequest = null; + _this6.currRequest = null; }; this.setState({ 'isLoading': true }, function () { - _this5.currRequest = requestInThisScope = load(nextCompoundFilterSetRequest ? "/compound_search" : nextHref, loadCallback, nextCompoundFilterSetRequest ? "POST" : "GET", loadCallback, nextCompoundFilterSetRequest ? JSON.stringify(nextCompoundFilterSetRequest) : null); + _this6.currRequest = requestInThisScope = load(nextCompoundFilterSetRequest ? "/compound_search" : nextHref, loadCallback, nextCompoundFilterSetRequest ? "POST" : "GET", loadCallback, nextCompoundFilterSetRequest ? JSON.stringify(nextCompoundFilterSetRequest) : null); }); } }, { @@ -646,7 +645,6 @@ var LoadMoreAsYouScroll = /*#__PURE__*/function (_React$Component) { }); } }]); - return LoadMoreAsYouScroll; }(React.Component); _defineProperty(LoadMoreAsYouScroll, "propTypes", { 'href': PropTypes.string, @@ -700,23 +698,22 @@ var LoadingSpinner = /*#__PURE__*/React.memo(function (_ref3) { }), "\xA0 Loading...")); }); var ShadowBorderLayer = /*#__PURE__*/function (_React$Component2) { - _inherits(ShadowBorderLayer, _React$Component2); - var _super4 = _createSuper(ShadowBorderLayer); function ShadowBorderLayer(props) { - var _this6; + var _this7; _classCallCheck(this, ShadowBorderLayer); - _this6 = _super4.call(this, props); - _this6.scrolling = false; - _this6.performScrollAction = _this6.performScrollAction.bind(_assertThisInitialized(_this6)); - _this6.handleLeftScrollButtonMouseDown = _this6.handleScrollButtonMouseDown.bind(_assertThisInitialized(_this6), 'left'); - _this6.handleRightScrollButtonMouseDown = _this6.handleScrollButtonMouseDown.bind(_assertThisInitialized(_this6), 'right'); - _this6.handleScrollButtonUp = _this6.handleScrollButtonUp.bind(_assertThisInitialized(_this6)); - _this6.memoized = { + _this7 = _callSuper(this, ShadowBorderLayer, [props]); + _this7.scrolling = false; + _this7.performScrollAction = _this7.performScrollAction.bind(_this7); + _this7.handleLeftScrollButtonMouseDown = _this7.handleScrollButtonMouseDown.bind(_this7, 'left'); + _this7.handleRightScrollButtonMouseDown = _this7.handleScrollButtonMouseDown.bind(_this7, 'right'); + _this7.handleScrollButtonUp = _this7.handleScrollButtonUp.bind(_this7); + _this7.memoized = { edgeHiddenContentWidths: memoize(ShadowBorderLayer.edgeHiddenContentWidths) }; - return _this6; + return _this7; } - _createClass(ShadowBorderLayer, [{ + _inherits(ShadowBorderLayer, _React$Component2); + return _createClass(ShadowBorderLayer, [{ key: "shouldComponentUpdate", value: function shouldComponentUpdate(nextProps) { var _this$props10 = this.props, @@ -746,7 +743,7 @@ var ShadowBorderLayer = /*#__PURE__*/function (_React$Component2) { }, { key: "performScrollAction", value: function performScrollAction() { - var _this7 = this; + var _this8 = this; var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "right"; var _this$props11 = this.props, horizontalScrollRateOnEdgeButton = _this$props11.horizontalScrollRateOnEdgeButton, @@ -766,7 +763,7 @@ var ShadowBorderLayer = /*#__PURE__*/function (_React$Component2) { logger.error("Reached depth 10k on a recursive function 'performScrollAction.'"); return; } - if (_this7.scrolling) { + if (_this8.scrolling) { raf(function () { scrollAction(depth + 1); }); @@ -838,31 +835,28 @@ var ShadowBorderLayer = /*#__PURE__*/function (_React$Component2) { return edges; } }]); - return ShadowBorderLayer; }(React.Component); _defineProperty(ShadowBorderLayer, "defaultProps", { 'horizontalScrollRateOnEdgeButton': 10 }); var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { - _inherits(DimensioningContainer, _React$PureComponent3); - var _super5 = _createSuper(DimensioningContainer); function DimensioningContainer(props) { - var _this8; + var _this9; _classCallCheck(this, DimensioningContainer); - _this8 = _super5.call(this, props); - _this8.getScrollContainer = _this8.getScrollContainer.bind(_assertThisInitialized(_this8)); - _this8.getScrollableElement = _this8.getScrollableElement.bind(_assertThisInitialized(_this8)); - _this8.throttledUpdate = _.debounce(_this8.forceUpdate.bind(_assertThisInitialized(_this8)), 500); - _this8.toggleDetailPaneOpen = _.throttle(_this8.toggleDetailPaneOpen.bind(_assertThisInitialized(_this8)), 500); - _this8.setDetailHeight = _this8.setDetailHeight.bind(_assertThisInitialized(_this8)); + _this9 = _callSuper(this, DimensioningContainer, [props]); + _this9.getScrollContainer = _this9.getScrollContainer.bind(_this9); + _this9.getScrollableElement = _this9.getScrollableElement.bind(_this9); + _this9.throttledUpdate = _.debounce(_this9.forceUpdate.bind(_this9), 500); + _this9.toggleDetailPaneOpen = _.throttle(_this9.toggleDetailPaneOpen.bind(_this9), 500); + _this9.setDetailHeight = _this9.setDetailHeight.bind(_this9); //this.setContainerScrollLeft = this.setContainerScrollLeft.bind(this); - _this8.setContainerScrollLeft = _.throttle(_this8.setContainerScrollLeft.bind(_assertThisInitialized(_this8)), 250); - _this8.onHorizontalScroll = _this8.onHorizontalScroll.bind(_assertThisInitialized(_this8)); - _this8.setResults = _this8.setResults.bind(_assertThisInitialized(_this8)); - _this8.canLoadMore = _this8.canLoadMore.bind(_assertThisInitialized(_this8)); + _this9.setContainerScrollLeft = _.throttle(_this9.setContainerScrollLeft.bind(_this9), 250); + _this9.onHorizontalScroll = _this9.onHorizontalScroll.bind(_this9); + _this9.setResults = _this9.setResults.bind(_this9); + _this9.canLoadMore = _this9.canLoadMore.bind(_this9); var _props$results = props.results, originalResults = _props$results === void 0 ? [] : _props$results; - _this8.state = { + _this9.state = { 'mounted': false, 'results': originalResults.slice(0), // { row key : detail pane height } used for determining if detail pane is open + height for Infinite listview @@ -872,18 +866,19 @@ var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { originalResults: originalResults // Reference to original results in order to utilize getDerivedStateFromProps. }; - if (_this8.state.results.length > 0 && Array.isArray(props.defaultOpenIndices) && props.defaultOpenIndices.length > 0) { - _this8.state.openDetailPanes[itemUtil.atId(_this8.state.results[0])] = true; + if (_this9.state.results.length > 0 && Array.isArray(props.defaultOpenIndices) && props.defaultOpenIndices.length > 0) { + _this9.state.openDetailPanes[itemUtil.atId(_this9.state.results[0])] = true; } - _this8.outerRef = /*#__PURE__*/React.createRef(); - _this8.outerContainerSizeInterval = null; - _this8.scrollHandlerUnsubscribeFxn = null; - _this8.memoized = { + _this9.outerRef = /*#__PURE__*/React.createRef(); + _this9.outerContainerSizeInterval = null; + _this9.scrollHandlerUnsubscribeFxn = null; + _this9.memoized = { fullRowWidth: memoize(DimensioningContainer.fullRowWidth) }; - return _this8; + return _this9; } - _createClass(DimensioningContainer, [{ + _inherits(DimensioningContainer, _React$PureComponent3); + return _createClass(DimensioningContainer, [{ key: "getScrollContainer", value: function getScrollContainer() { var outerContainerElem = this.outerRef.current; @@ -908,7 +903,7 @@ var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { }, { key: "componentDidMount", value: function componentDidMount() { - var _this9 = this; + var _this10 = this; // Maybe todo: play with 'experimental technology' for controlling columing widths (& compare performance), // see https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/styleSheets // and https://developer.mozilla.org/en-US/docs/Web/API/CSSStylesheet. @@ -927,10 +922,10 @@ var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { // and element might change width independent of window (e.g. open/hide // facetlist in future, expand table to fullscreen, etc.) this.outerContainerSizeInterval = setInterval(function () { - _this9.setState(function (_ref4, _ref5) { + _this10.setState(function (_ref4, _ref5) { var pastWidth = _ref4.tableContainerWidth; var windowWidth = _ref5.windowWidth; - var currDims = DimensioningContainer.getTableDims(_this9.getScrollContainer(), windowWidth); + var currDims = DimensioningContainer.getTableDims(_this10.getScrollContainer(), windowWidth); if (pastWidth !== currDims.tableContainerWidth) { return currDims; } @@ -1022,7 +1017,7 @@ var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { }, { key: "onHorizontalScroll", value: function onHorizontalScroll(e) { - var _this10 = this; + var _this11 = this; var innerElem = e.target; // ( Shouldn't need to do commented out stuff if layout is within width ) @@ -1038,7 +1033,7 @@ var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { caf(this.horizScrollRAF); } this.horizScrollRAF = raf(function () { - var tableContainerScrollLeft = _this10.state.tableContainerScrollLeft; + var tableContainerScrollLeft = _this11.state.tableContainerScrollLeft; var nextScrollLeft = innerElem.scrollLeft; if (nextScrollLeft < 0) { nextScrollLeft = 0; // Might occur right after changing column widths or something. @@ -1048,9 +1043,9 @@ var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { columnsWrapperElement.style.left = "-".concat(nextScrollLeft, "px"); if (nextScrollLeft !== tableContainerScrollLeft) { // Shouldn't occur or matter but presence of this seems to improve smoothness (?) - _this10.setContainerScrollLeft(nextScrollLeft); + _this11.setContainerScrollLeft(nextScrollLeft); } - delete _this10.horizScrollRAF; + delete _this11.horizScrollRAF; }); return false; } @@ -1277,7 +1272,6 @@ var DimensioningContainer = /*#__PURE__*/function (_React$PureComponent3) { return null; } }]); - return DimensioningContainer; }(React.PureComponent); var EndOfListItem = /*#__PURE__*/React.memo(function (_ref10) { var tableContainerWidth = _ref10.tableContainerWidth, @@ -1318,13 +1312,12 @@ var EndOfListItem = /*#__PURE__*/React.memo(function (_ref10) { * @prop {function} termTransformFxn Function passed from parent portal to transform system values into human readable values. Is portal-specific; not used if `render` for field in columnExtensionMap/columnDefinition exists/used. */ export var SearchResultTable = /*#__PURE__*/function (_React$Component3) { - _inherits(SearchResultTable, _React$Component3); - var _super6 = _createSuper(SearchResultTable); function SearchResultTable() { _classCallCheck(this, SearchResultTable); - return _super6.apply(this, arguments); + return _callSuper(this, SearchResultTable, arguments); } - _createClass(SearchResultTable, [{ + _inherits(SearchResultTable, _React$Component3); + return _createClass(SearchResultTable, [{ key: "render", value: function render() { var _this$props15 = this.props, @@ -1360,7 +1353,6 @@ export var SearchResultTable = /*#__PURE__*/function (_React$Component3) { return !isServerSide() && responsiveGridState(windowWidth) !== 'xs'; } }]); - return SearchResultTable; }(React.Component); _defineProperty(SearchResultTable, "propTypes", { 'results': PropTypes.arrayOf(ResultRow.propTypes.result), diff --git a/es/components/browse/components/SelectedItemsController.js b/es/components/browse/components/SelectedItemsController.js index 3e24d002..d5b706ca 100644 --- a/es/components/browse/components/SelectedItemsController.js +++ b/es/components/browse/components/SelectedItemsController.js @@ -1,31 +1,32 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _extends from "@babel/runtime/helpers/extends"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; var _excluded = ["children"], _excluded2 = ["children"]; -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo, useCallback } from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -72,20 +73,19 @@ export function sendDataToParentWindow(itemsListWrappedWithID) { })); } export var SelectedItemsController = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SelectedItemsController, _React$PureComponent); - var _super = _createSuper(SelectedItemsController); function SelectedItemsController(props) { - var _this; + var _this2; _classCallCheck(this, SelectedItemsController); - _this = _super.call(this, props); - _this.handleSelectItem = _this.handleSelectItem.bind(_assertThisInitialized(_this)); - _this.handleResetSelectedItems = _this.handleResetSelectedItems.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, SelectedItemsController, [props]); + _this2.handleSelectItem = _this2.handleSelectItem.bind(_this2); + _this2.handleResetSelectedItems = _this2.handleResetSelectedItems.bind(_this2); + _this2.state = { "selectedItems": new Map() }; - return _this; + return _this2; } - _createClass(SelectedItemsController, [{ + _inherits(SelectedItemsController, _React$PureComponent); + return _createClass(SelectedItemsController, [{ key: "componentDidMount", value: function componentDidMount() { var keepSelectionInStorage = this.props.keepSelectionInStorage; @@ -163,7 +163,7 @@ export var SelectedItemsController = /*#__PURE__*/function (_React$PureComponent }, { key: "columnExtensionMapWithSelectButton", value: function columnExtensionMapWithSelectButton() { - var _this2 = this; + var _this3 = this; var _this$props = this.props, originalColumnExtensionMap = _this$props.columnExtensionMap, _this$props$currentAc = _this$props.currentAction, @@ -185,7 +185,7 @@ export var SelectedItemsController = /*#__PURE__*/function (_React$PureComponent newColumnExtensionMap.display_title = _objectSpread(_objectSpread({}, newColumnExtensionMap.display_title), {}, { 'minColumnWidth': (originalColumnExtensionMap.display_title.minColumnWidth || 100) + 20, 'render': function render(result, parentProps) { - var selectedItems = _this2.state.selectedItems; + var selectedItems = _this3.state.selectedItems; var rowNumber = parentProps.rowNumber, detailOpen = parentProps.detailOpen, toggleDetailOpen = parentProps.toggleDetailOpen, @@ -200,7 +200,7 @@ export var SelectedItemsController = /*#__PURE__*/function (_React$PureComponent toggleDetailOpen: toggleDetailOpen }, /*#__PURE__*/React.createElement(SelectionItemCheckbox, { selectedItems: selectedItems, - onSelectItem: _this2.handleSelectItem, + onSelectItem: _this3.handleSelectItem, isMultiSelect: currentAction === 'multiselect' }), /*#__PURE__*/React.createElement(DisplayTitleColumnDefault, null)); } @@ -228,7 +228,6 @@ export var SelectedItemsController = /*#__PURE__*/function (_React$PureComponent }); } }]); - return SelectedItemsController; }(React.PureComponent); export var SelectionItemCheckbox = /*#__PURE__*/React.memo(function (props) { var selectedItems = props.selectedItems, diff --git a/es/components/browse/components/SortController.js b/es/components/browse/components/SortController.js index fbaefabc..1f7b2182 100644 --- a/es/components/browse/components/SortController.js +++ b/es/components/browse/components/SortController.js @@ -1,34 +1,30 @@ +import _extends from "@babel/runtime/helpers/extends"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["query"], _excluded2 = ["children", "context"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useCallback } from 'react'; import DropdownButton from 'react-bootstrap/esm/DropdownButton'; import DropdownItem from 'react-bootstrap/esm/DropdownItem'; @@ -40,21 +36,19 @@ import _ from 'underscore'; import { navigate as _navigate } from './../../util/navigate'; import { flattenColumnsDefinitionsSortFields, HeadersRow } from './table-commons'; export var SortController = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SortController, _React$PureComponent); - var _super = _createSuper(SortController); function SortController(props) { - var _this; + var _this2; _classCallCheck(this, SortController); - _this = _super.call(this, props); - _this.sortBy = _this.sortBy.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, SortController, [props]); + _this2.sortBy = _this2.sortBy.bind(_this2); + _this2.state = { 'changingPage': false }; // 'changingPage' = historical name, analogous of 'loading' - _this.memoized = { + _this2.memoized = { getSortColumnAndOrderPairs: memoize(MultiColumnSortSelector.getSortColumnAndOrderPairs) }; - return _this; + return _this2; } /** @@ -63,10 +57,11 @@ export var SortController = /*#__PURE__*/function (_React$PureComponent) { * to make into POST request if needed. Else will operate w. `requestedCompoundFilterSet` * for compound filter-blocks requests. */ - _createClass(SortController, [{ + _inherits(SortController, _React$PureComponent); + return _createClass(SortController, [{ key: "sortBy", value: function sortBy(sortingPairs, callback) { - var _this2 = this; + var _this3 = this; var _this$props = this.props, propNavigate = _this$props.navigate, _this$props$href = _this$props.href, @@ -116,7 +111,7 @@ export var SortController = /*#__PURE__*/function (_React$PureComponent) { propNavigate(navTarget, { 'replace': true }, function () { - _this2.setState({ + _this3.setState({ 'changingPage': false }, callback); }); @@ -143,7 +138,6 @@ export var SortController = /*#__PURE__*/function (_React$PureComponent) { }); } }]); - return SortController; }(React.PureComponent); _defineProperty(SortController, "propTypes", { /** One of 'href' or 'requestedCompoundFilterSet' is required */ @@ -160,31 +154,30 @@ _defineProperty(SortController, "defaultProps", { } }); export var MultiColumnSortSelector = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(MultiColumnSortSelector, _React$PureComponent2); - var _super2 = _createSuper(MultiColumnSortSelector); function MultiColumnSortSelector(props) { - var _this3; + var _this4; _classCallCheck(this, MultiColumnSortSelector); - _this3 = _super2.call(this, props); - _this3.handleSortColumnSelection = _this3.handleSortColumnSelection.bind(_assertThisInitialized(_this3)); - _this3.handleSortOrderSelection = _this3.handleSortOrderSelection.bind(_assertThisInitialized(_this3)); - _this3.handleSortRowDelete = _this3.handleSortRowDelete.bind(_assertThisInitialized(_this3)); - _this3.handleSettingsApply = _this3.handleSettingsApply.bind(_assertThisInitialized(_this3)); - _this3.memoized = { + _this4 = _callSuper(this, MultiColumnSortSelector, [props]); + _this4.handleSortColumnSelection = _this4.handleSortColumnSelection.bind(_this4); + _this4.handleSortOrderSelection = _this4.handleSortOrderSelection.bind(_this4); + _this4.handleSortRowDelete = _this4.handleSortRowDelete.bind(_this4); + _this4.handleSettingsApply = _this4.handleSettingsApply.bind(_this4); + _this4.memoized = { flattenColumnsDefinitionsSortFields: memoize(flattenColumnsDefinitionsSortFields) }; var _props$sortColumns = props.sortColumns, sortColumns = _props$sortColumns === void 0 ? [] : _props$sortColumns; - _this3.state = { + _this4.state = { /** @type {{ column: string, direction: "asc"|"desc" }[]} */ 'sortingPairs': [].concat(_toConsumableArray(sortColumns), [{ 'column': null, 'direction': 'asc' }]) }; - return _this3; + return _this4; } - _createClass(MultiColumnSortSelector, [{ + _inherits(MultiColumnSortSelector, _React$PureComponent2); + return _createClass(MultiColumnSortSelector, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps) { var _pastProps$sortColumn = pastProps.sortColumns, @@ -324,7 +317,6 @@ export var MultiColumnSortSelector = /*#__PURE__*/function (_React$PureComponent return columns; } }]); - return MultiColumnSortSelector; }(React.PureComponent); MultiColumnSortSelector.propTypes = { 'columnDefinitions': PropTypes.arrayOf(PropTypes.object).isRequired, diff --git a/es/components/browse/components/StackedBlockTable.js b/es/components/browse/components/StackedBlockTable.js index f31a86c8..2562a49e 100644 --- a/es/components/browse/components/StackedBlockTable.js +++ b/es/components/browse/components/StackedBlockTable.js @@ -1,18 +1,23 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _extends from "@babel/runtime/helpers/extends"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import memoize from 'memoize-one'; @@ -65,13 +70,12 @@ StackedBlockNameLabel.propTypes = { /** Name element to be put inside of StackedBlocks as the first child. */ export var StackedBlockName = /*#__PURE__*/function (_React$PureComponent) { - _inherits(StackedBlockName, _React$PureComponent); - var _super = _createSuper(StackedBlockName); function StackedBlockName() { _classCallCheck(this, StackedBlockName); - return _super.apply(this, arguments); + return _callSuper(this, StackedBlockName, arguments); } - _createClass(StackedBlockName, [{ + _inherits(StackedBlockName, _React$PureComponent); + return _createClass(StackedBlockName, [{ key: "render", value: function render() { var _this$props = this.props, @@ -93,7 +97,6 @@ export var StackedBlockName = /*#__PURE__*/function (_React$PureComponent) { }, label, children); } }]); - return StackedBlockName; }(React.PureComponent); /** @@ -101,13 +104,12 @@ export var StackedBlockName = /*#__PURE__*/function (_React$PureComponent) { */ _defineProperty(StackedBlockName, "Label", StackedBlockNameLabel); export var StackedBlockListViewMoreButton = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(StackedBlockListViewMoreButton, _React$PureComponent2); - var _super2 = _createSuper(StackedBlockListViewMoreButton); function StackedBlockListViewMoreButton() { _classCallCheck(this, StackedBlockListViewMoreButton); - return _super2.apply(this, arguments); + return _callSuper(this, StackedBlockListViewMoreButton, arguments); } - _createClass(StackedBlockListViewMoreButton, [{ + _inherits(StackedBlockListViewMoreButton, _React$PureComponent2); + return _createClass(StackedBlockListViewMoreButton, [{ key: "render", value: function render() { var _this$props2 = this.props, @@ -142,7 +144,6 @@ export var StackedBlockListViewMoreButton = /*#__PURE__*/function (_React$PureCo }, " ", showMoreExtTitle) : null); } }]); - return StackedBlockListViewMoreButton; }(React.PureComponent); /** @@ -158,24 +159,23 @@ _defineProperty(StackedBlockListViewMoreButton, "propTypes", { }); export var StackedBlockList = /*#__PURE__*/function (_React$PureComponent3) { - _inherits(StackedBlockList, _React$PureComponent3); - var _super3 = _createSuper(StackedBlockList); function StackedBlockList(props) { - var _this; + var _this2; _classCallCheck(this, StackedBlockList); - _this = _super3.call(this, props); - _this.adjustedChildren = _this.adjustedChildren.bind(_assertThisInitialized(_this)); - _this.handleCollapseToggle = _this.handleCollapseToggle.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, StackedBlockList, [props]); + _this2.adjustedChildren = _this2.adjustedChildren.bind(_this2); + _this2.handleCollapseToggle = _this2.handleCollapseToggle.bind(_this2); + _this2.state = { 'collapsed': props.defaultCollapsed, 'incrementalExpandVisibleCount': props.collapseShow }; - return _this; + return _this2; } - _createClass(StackedBlockList, [{ + _inherits(StackedBlockList, _React$PureComponent3); + return _createClass(StackedBlockList, [{ key: "adjustedChildren", value: function adjustedChildren() { - var _this2 = this; + var _this3 = this; var _this$props3 = this.props, children = _this$props3.children, stackDepth = _this$props3.stackDepth, @@ -194,12 +194,12 @@ export var StackedBlockList = /*#__PURE__*/function (_React$PureComponent3) { _.forEach(['collapseLongLists', 'collapseLimit', 'collapseShow', 'defaultCollapsed', 'incrementalExpandLimit'], function (prop) { if (typeof c.props[prop] === 'undefined') { - childProps[prop] = _this2.props[prop] || null; + childProps[prop] = _this3.props[prop] || null; } }); - _.forEach(_.keys(_this2.props), function (prop) { + _.forEach(_.keys(_this3.props), function (prop) { if (typeof c.props[prop] === 'undefined' && typeof childProps[prop] === 'undefined' && !StackedBlock.excludedPassedProps.has(prop)) { - childProps[prop] = _this2.props[prop]; + childProps[prop] = _this3.props[prop]; } }); return /*#__PURE__*/React.cloneElement(c, childProps, c.props.children); @@ -309,7 +309,6 @@ export var StackedBlockList = /*#__PURE__*/function (_React$PureComponent3) { }, children.slice(0, collapseShow), collapsibleChildrenElemsList, viewMoreButton); } }]); - return StackedBlockList; }(React.PureComponent); _defineProperty(StackedBlockList, "ViewMoreButton", StackedBlockListViewMoreButton); _defineProperty(StackedBlockList, "propTypes", { @@ -325,19 +324,18 @@ _defineProperty(StackedBlockList, "propTypes", { 'incrementalExpandStep': PropTypes.number }); export var StackedBlock = /*#__PURE__*/function (_React$PureComponent4) { - _inherits(StackedBlock, _React$PureComponent4); - var _super4 = _createSuper(StackedBlock); function StackedBlock(props) { - var _this3; + var _this4; _classCallCheck(this, StackedBlock); - _this3 = _super4.call(this, props); - _this3.adjustedChildren = _this3.adjustedChildren.bind(_assertThisInitialized(_this3)); - return _this3; + _this4 = _callSuper(this, StackedBlock, [props]); + _this4.adjustedChildren = _this4.adjustedChildren.bind(_this4); + return _this4; } - _createClass(StackedBlock, [{ + _inherits(StackedBlock, _React$PureComponent4); + return _createClass(StackedBlock, [{ key: "adjustedChildren", value: function adjustedChildren() { - var _this4 = this; + var _this5 = this; var _this$props5 = this.props, children = _this$props5.children, columnClass = _this$props5.columnClass, @@ -363,12 +361,12 @@ export var StackedBlock = /*#__PURE__*/function (_React$PureComponent4) { _.forEach(['collapseLongLists', 'collapseLimit', 'collapseShow', 'defaultCollapsed', 'preventExpand', 'incrementalExpandLimit'], function (prop) { if (typeof c.props[prop] === 'undefined') { - childProps[prop] = _this4.props[prop]; + childProps[prop] = _this5.props[prop]; } }); - _.forEach(_.keys(_this4.props), function (prop) { + _.forEach(_.keys(_this5.props), function (prop) { if (typeof c.props[prop] === 'undefined' && typeof childProps[prop] === 'undefined' && !StackedBlock.excludedPassedProps.has(prop)) { - childProps[prop] = _this4.props[prop]; + childProps[prop] = _this5.props[prop]; } }); if (_.keys(childProps).length > 0) { @@ -392,7 +390,6 @@ export var StackedBlock = /*#__PURE__*/function (_React$PureComponent4) { }, this.adjustedChildren()); } }]); - return StackedBlock; }(React.PureComponent); /** @@ -410,24 +407,23 @@ _defineProperty(StackedBlock, "List", StackedBlockList); /** TODO MAYBE USE HERE & ON LIST */ _defineProperty(StackedBlock, "excludedPassedProps", new Set(['stripe', 'hideNameOnHover', 'keepLabelOnHover', 'className', 'children', 'showMoreExtTitle'])); export var StackedBlockTable = /*#__PURE__*/function (_React$PureComponent5) { - _inherits(StackedBlockTable, _React$PureComponent5); - var _super5 = _createSuper(StackedBlockTable); function StackedBlockTable(props) { - var _this5; + var _this6; _classCallCheck(this, StackedBlockTable); - _this5 = _super5.call(this, props); - _this5.adjustedChildren = _this5.adjustedChildren.bind(_assertThisInitialized(_this5)); - _this5.setCollapsingState = _.throttle(_this5.setCollapsingState.bind(_assertThisInitialized(_this5))); - _this5.memoized = { + _this6 = _callSuper(this, StackedBlockTable, [props]); + _this6.adjustedChildren = _this6.adjustedChildren.bind(_this6); + _this6.setCollapsingState = _.throttle(_this6.setCollapsingState.bind(_this6)); + _this6.memoized = { totalColumnsMinWidth: memoize(StackedBlockTable.totalColumnsMinWidth), colWidthStyles: memoize(StackedBlockTable.colWidthStyles) }; - _this5.state = { + _this6.state = { 'mounted': false }; - return _this5; + return _this6; } - _createClass(StackedBlockTable, [{ + _inherits(StackedBlockTable, _React$PureComponent5); + return _createClass(StackedBlockTable, [{ key: "componentDidMount", value: function componentDidMount() { this.setState({ @@ -444,7 +440,7 @@ export var StackedBlockTable = /*#__PURE__*/function (_React$PureComponent5) { }, { key: "adjustedChildren", value: function adjustedChildren() { - var _this6 = this; + var _this7 = this; var _this$props7 = this.props, children = _this$props7.children, columnHeaders = _this$props7.columnHeaders, @@ -452,7 +448,7 @@ export var StackedBlockTable = /*#__PURE__*/function (_React$PureComponent5) { var colWidthStyles = this.memoized.colWidthStyles(columnHeaders, defaultInitialColumnWidth); return React.Children.map(children, function (c) { // Includes handleFileCheckboxChange, selectedFiles, etc. if present - var addedProps = _.omit(_this6.props, 'columnHeaders', 'stackDepth', 'colWidthStyles', 'width'); + var addedProps = _.omit(_this7.props, 'columnHeaders', 'stackDepth', 'colWidthStyles', 'width'); // REQUIRED & PASSED DOWN TO STACKEDBLOCKLIST addedProps.colWidthStyles = colWidthStyles; @@ -544,7 +540,6 @@ export var StackedBlockTable = /*#__PURE__*/function (_React$PureComponent5) { return retObj; } }]); - return StackedBlockTable; }(React.PureComponent); _defineProperty(StackedBlockTable, "StackedBlock", StackedBlock); _defineProperty(StackedBlockTable, "propTypes", { diff --git a/es/components/browse/components/VirtualHrefController.js b/es/components/browse/components/VirtualHrefController.js index d2d5770d..c0f1ce47 100644 --- a/es/components/browse/components/VirtualHrefController.js +++ b/es/components/browse/components/VirtualHrefController.js @@ -1,28 +1,27 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; var _excluded = ["children", "facets", "filterFacetFxn", "columns", "searchHref"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo } from 'react'; import memoize from 'memoize-one'; import _ from 'underscore'; @@ -45,25 +44,23 @@ import { SearchResponse, Item, ColumnDefinition, URLParts } from './../../util/t * navigate to new href. */ export var VirtualHrefController = /*#__PURE__*/function (_React$PureComponent) { - _inherits(VirtualHrefController, _React$PureComponent); - var _super = _createSuper(VirtualHrefController); function VirtualHrefController(props) { - var _this; + var _this2; _classCallCheck(this, VirtualHrefController); - _this = _super.call(this, props); - _this.onFilter = _this.onFilter.bind(_assertThisInitialized(_this)); - _this.onFilterMultiple = _this.onFilterMultiple.bind(_assertThisInitialized(_this)); - _this.onClearFilters = _this.onClearFilters.bind(_assertThisInitialized(_this)); - _this.getTermStatus = _this.getTermStatus.bind(_assertThisInitialized(_this)); - _this.virtualNavigate = _this.virtualNavigate.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, VirtualHrefController, [props]); + _this2.onFilter = _this2.onFilter.bind(_this2); + _this2.onFilterMultiple = _this2.onFilterMultiple.bind(_this2); + _this2.onClearFilters = _this2.onClearFilters.bind(_this2); + _this2.getTermStatus = _this2.getTermStatus.bind(_this2); + _this2.virtualNavigate = _this2.virtualNavigate.bind(_this2); + _this2.memoized = { transformedFacets: memoize(VirtualHrefController.transformedFacets), isClearFiltersBtnVisible: memoize(props.isClearFiltersBtnVisible || function (currentVirtualSearcHref) { // We assume props.searchHref doesn't ever change (we don't handle a change of this in any case) VirtualHrefController.isClearFiltersBtnVisible(currentVirtualSearcHref, props.searchHref); }) }; - _this.state = { + _this2.state = { "virtualHref": props.searchHref || null, // Takes precedence over virtualHref, if present. // TODO: Allow props.compoundFilterSet to init with perhaps. @@ -71,11 +68,12 @@ export var VirtualHrefController = /*#__PURE__*/function (_React$PureComponent) "isContextLoading": false, "virtualContext": undefined // Let downstream components use defaultProps to fallback }; - return _this; + return _this2; } /** Will not be called if EmbeddedSearchView is not initialized with a `props.searchHref` */ - _createClass(VirtualHrefController, [{ + _inherits(VirtualHrefController, _React$PureComponent); + return _createClass(VirtualHrefController, [{ key: "componentDidMount", value: function componentDidMount() { var _this$state = this.state, @@ -102,7 +100,7 @@ export var VirtualHrefController = /*#__PURE__*/function (_React$PureComponent) }, { key: "virtualNavigate", value: function virtualNavigate(navigationTarget, navOpts, callback) { - var _this2 = this; + var _this3 = this; var _this$props = this.props, _this$props$onLoad = _this$props.onLoad, onLoad = _this$props$onLoad === void 0 ? null : _this$props$onLoad, @@ -192,11 +190,11 @@ export var VirtualHrefController = /*#__PURE__*/function (_React$PureComponent) var onLoadResponse = function (nextContext) { var total = nextContext.total, initialResults = nextContext['@graph']; - if (scopedRequest !== _this2.currRequest) { - console.warn("This is no longer the current request", scopedRequest, _this2.currRequest); + if (scopedRequest !== _this3.currRequest) { + console.warn("This is no longer the current request", scopedRequest, _this3.currRequest); return false; } - _this2.currRequest = null; + _this3.currRequest = null; if (typeof total !== "number") { throw new Error("Did not get back a search response, request was potentially aborted."); } @@ -216,7 +214,7 @@ export var VirtualHrefController = /*#__PURE__*/function (_React$PureComponent) } } console.info("Loaded Next Context", nextContext); - _this2.setState({ + _this3.setState({ "virtualContext": nextContext, "isContextLoading": false, "virtualHref": responseHref, @@ -230,14 +228,14 @@ export var VirtualHrefController = /*#__PURE__*/function (_React$PureComponent) } }); }; - if (_this2.currRequest) { + if (_this3.currRequest) { // Try cancel existing request if possible. - _this2.currRequest.abort(); - _this2.currRequest = null; + _this3.currRequest.abort(); + _this3.currRequest = null; } // We still might perform GET request on 4DN which doesn't yet have /compound_search - scopedRequest = _this2.currRequest = ajaxLoad(virtualCompoundFilterSet ? "/compound_search" : nextHrefFull, onLoadResponse, virtualCompoundFilterSet ? "POST" : "GET", onLoadResponse, virtualCompoundFilterSet ? JSON.stringify(virtualCompoundFilterSet) : null); + scopedRequest = _this3.currRequest = ajaxLoad(virtualCompoundFilterSet ? "/compound_search" : nextHrefFull, onLoadResponse, virtualCompoundFilterSet ? "POST" : "GET", onLoadResponse, virtualCompoundFilterSet ? JSON.stringify(virtualCompoundFilterSet) : null); }); return scopedRequest; } @@ -421,5 +419,4 @@ export var VirtualHrefController = /*#__PURE__*/function (_React$PureComponent) return !_.isEqual(origHrefQuery, virtualHrefPartsQuery); } }]); - return VirtualHrefController; }(React.PureComponent); \ No newline at end of file diff --git a/es/components/browse/components/WindowNavigationController.js b/es/components/browse/components/WindowNavigationController.js index 5fe5f20e..d54f9be2 100644 --- a/es/components/browse/components/WindowNavigationController.js +++ b/es/components/browse/components/WindowNavigationController.js @@ -1,22 +1,26 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; var _excluded = ["children", "filterFacetFxn", "facets", "showClearFiltersButton"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo } from 'react'; import memoize from 'memoize-one'; import url from 'url'; @@ -38,23 +42,22 @@ import { SearchResponse, Item, ColumnDefinition, URLParts } from './../../util/t * navigate to new href. */ export var WindowNavigationController = /*#__PURE__*/function (_React$PureComponent) { - _inherits(WindowNavigationController, _React$PureComponent); - var _super = _createSuper(WindowNavigationController); function WindowNavigationController(props) { - var _this; + var _this2; _classCallCheck(this, WindowNavigationController); - _this = _super.call(this, props); - _this.onFilter = _this.onFilter.bind(_assertThisInitialized(_this)); - _this.onFilterMultiple = _this.onFilterMultiple.bind(_assertThisInitialized(_this)); - _this.onClearFilters = _this.onClearFilters.bind(_assertThisInitialized(_this)); - _this.getTermStatus = _this.getTermStatus.bind(_assertThisInitialized(_this)); - _this.memoized = { + _this2 = _callSuper(this, WindowNavigationController, [props]); + _this2.onFilter = _this2.onFilter.bind(_this2); + _this2.onFilterMultiple = _this2.onFilterMultiple.bind(_this2); + _this2.onClearFilters = _this2.onClearFilters.bind(_this2); + _this2.getTermStatus = _this2.getTermStatus.bind(_this2); + _this2.memoized = { transformedFacets: memoize(WindowNavigationController.transformedFacets), isClearFiltersBtnVisible: memoize(WindowNavigationController.isClearFiltersBtnVisible) }; - return _this; + return _this2; } - _createClass(WindowNavigationController, [{ + _inherits(WindowNavigationController, _React$PureComponent); + return _createClass(WindowNavigationController, [{ key: "onFilter", value: function onFilter(facet, term, callback) { var _this$props = this.props, @@ -182,5 +185,4 @@ export var WindowNavigationController = /*#__PURE__*/function (_React$PureCompon return !!(clearFiltersURLQuery && !_.isEqual(clearFiltersURLQuery, urlPartsQuery)); } }]); - return WindowNavigationController; }(React.PureComponent); \ No newline at end of file diff --git a/es/components/browse/components/above-table-controls/AboveTableControlsBase.js b/es/components/browse/components/above-table-controls/AboveTableControlsBase.js index f0ebfc66..adf0658a 100644 --- a/es/components/browse/components/above-table-controls/AboveTableControlsBase.js +++ b/es/components/browse/components/above-table-controls/AboveTableControlsBase.js @@ -1,17 +1,22 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _extends from "@babel/runtime/helpers/extends"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import memoize from 'memoize-one'; import _ from 'underscore'; @@ -27,18 +32,16 @@ import { MultiColumnSortSelector } from './../SortController'; * Some may need to be transformed to exclude certain non-user-controlled columns (e.g. @type) and such. */ export var AboveTableControlsBase = /*#__PURE__*/function (_React$PureComponent) { - _inherits(AboveTableControlsBase, _React$PureComponent); - var _super = _createSuper(AboveTableControlsBase); function AboveTableControlsBase(props) { - var _this; + var _this2; _classCallCheck(this, AboveTableControlsBase); - _this = _super.call(this, props); - _this.handleOpenToggle = _.throttle(_this.handleOpenToggle.bind(_assertThisInitialized(_this)), 350); - _this.handleClose = _this.handleOpenToggle.bind(_assertThisInitialized(_this), false); - _this.handleOpenColumnsSelectionPanel = _this.handleOpenToggle.bind(_assertThisInitialized(_this), 'customColumns'); - _this.panelToggleFxns = {}; + _this2 = _callSuper(this, AboveTableControlsBase, [props]); + _this2.handleOpenToggle = _.throttle(_this2.handleOpenToggle.bind(_this2), 350); + _this2.handleClose = _this2.handleOpenToggle.bind(_this2, false); + _this2.handleOpenColumnsSelectionPanel = _this2.handleOpenToggle.bind(_this2, 'customColumns'); + _this2.panelToggleFxns = {}; Object.keys(props.panelMap).forEach(function (key) { - _this.panelToggleFxns[key] = _this.handleOpenToggle.bind(_assertThisInitialized(_this), key); + _this2.panelToggleFxns[key] = _this2.handleOpenToggle.bind(_this2, key); }); /** @@ -46,13 +49,14 @@ export var AboveTableControlsBase = /*#__PURE__*/function (_React$PureComponent) * @property {boolean} state.reallyOpen - Extra check for if open, will remain true until 'closing' transition is complete. * @property {string[]} state.fileTypeFilters - List of file_type_detailed strings that we filter selected files down to. */ - _this.state = { + _this2.state = { 'open': false, 'reallyOpen': false }; - return _this; + return _this2; } - _createClass(AboveTableControlsBase, [{ + _inherits(AboveTableControlsBase, _React$PureComponent); + return _createClass(AboveTableControlsBase, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps, prevState) { var open = this.state.open; @@ -63,7 +67,7 @@ export var AboveTableControlsBase = /*#__PURE__*/function (_React$PureComponent) }, { key: "handleOpenToggle", value: function handleOpenToggle(value) { - var _this2 = this; + var _this3 = this; if (this.timeout) { clearTimeout(this.timeout); delete this.timeout; @@ -81,13 +85,13 @@ export var AboveTableControlsBase = /*#__PURE__*/function (_React$PureComponent) } return nextState; }, function () { - var _this2$state = _this2.state, - open = _this2$state.open, - reallyOpen = _this2$state.reallyOpen; + var _this3$state = _this3.state, + open = _this3$state.open, + reallyOpen = _this3$state.reallyOpen; setTimeout(ReactTooltip.rebuild, 100); if (!open && reallyOpen) { - _this2.timeout = setTimeout(function () { - _this2.setState({ + _this3.timeout = setTimeout(function () { + _this3.setState({ 'reallyOpen': false }); }, 400); @@ -97,7 +101,7 @@ export var AboveTableControlsBase = /*#__PURE__*/function (_React$PureComponent) }, { key: "render", value: function render() { - var _this3 = this; + var _this4 = this; var _this$props = this.props, children = _this$props.children, _this$props$panelMap = _this$props.panelMap, @@ -109,8 +113,8 @@ export var AboveTableControlsBase = /*#__PURE__*/function (_React$PureComponent) if ( /*#__PURE__*/React.isValidElement(child)) { if (typeof child.type !== "string") { return /*#__PURE__*/React.cloneElement(child, { - "panelToggleFxns": _this3.panelToggleFxns, - "onClosePanel": _this3.handleClose, + "panelToggleFxns": _this4.panelToggleFxns, + "onClosePanel": _this4.handleClose, "currentOpenPanel": open || reallyOpen }); } @@ -194,7 +198,6 @@ export var AboveTableControlsBase = /*#__PURE__*/function (_React$PureComponent) return null; } }]); - return AboveTableControlsBase; }(React.PureComponent); AboveTableControlsBase.defaultProps = { "panelMap": { diff --git a/es/components/browse/components/above-table-controls/RightButtonsSection.js b/es/components/browse/components/above-table-controls/RightButtonsSection.js index a584e863..aef62c7a 100644 --- a/es/components/browse/components/above-table-controls/RightButtonsSection.js +++ b/es/components/browse/components/above-table-controls/RightButtonsSection.js @@ -1,16 +1,21 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -83,16 +88,15 @@ MultiColumnSortButton.defaultProps = { /** Toggles between regular & full screen views */ export var ToggleLayoutButton = /*#__PURE__*/function (_React$PureComponent) { - _inherits(ToggleLayoutButton, _React$PureComponent); - var _super = _createSuper(ToggleLayoutButton); function ToggleLayoutButton(props) { - var _this; + var _this2; _classCallCheck(this, ToggleLayoutButton); - _this = _super.call(this, props); - _this.handleLayoutToggle = _.throttle(_this.handleLayoutToggle.bind(_assertThisInitialized(_this)), 350); - return _this; + _this2 = _callSuper(this, ToggleLayoutButton, [props]); + _this2.handleLayoutToggle = _.throttle(_this2.handleLayoutToggle.bind(_this2), 350); + return _this2; } - _createClass(ToggleLayoutButton, [{ + _inherits(ToggleLayoutButton, _React$PureComponent); + return _createClass(ToggleLayoutButton, [{ key: "handleLayoutToggle", value: function handleLayoutToggle() { var _this$props = this.props, @@ -125,7 +129,6 @@ export var ToggleLayoutButton = /*#__PURE__*/function (_React$PureComponent) { }, !isFullscreen ? "Full Screen" : "Collapse Table Width")); } }]); - return ToggleLayoutButton; }(React.PureComponent); ToggleLayoutButton.propTypes = { 'windowWidth': PropTypes.number.isRequired, diff --git a/es/components/browse/components/table-commons/ColumnCombiner.js b/es/components/browse/components/table-commons/ColumnCombiner.js index b41eed60..a7cc65bb 100644 --- a/es/components/browse/components/table-commons/ColumnCombiner.js +++ b/es/components/browse/components/table-commons/ColumnCombiner.js @@ -1,28 +1,27 @@ +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["children", "columns", "columnExtensionMap", "filterColumnFxn"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -46,13 +45,11 @@ import { Item, ColumnDefinition } from './../../../util/typedefs'; * @returns {JSX.Element} Clone of children, passing in `columnDefinitions` {{ field: string, ... }[]} and `defaultHiddenColumns` {Object}. */ export var ColumnCombiner = /*#__PURE__*/function (_React$PureComponent) { - _inherits(ColumnCombiner, _React$PureComponent); - var _super = _createSuper(ColumnCombiner); function ColumnCombiner(props) { - var _this; + var _this2; _classCallCheck(this, ColumnCombiner); - _this = _super.call(this, props); - _this.memoized = { + _this2 = _callSuper(this, ColumnCombiner, [props]); + _this2.memoized = { haveContextColumnsChanged: memoize(haveContextColumnsChanged), // We want `defaultHiddenColumns` memoized separately from `columnDefinitions` // because `defaultHiddenColumns` change triggers reset in `ColumnCombiner`. @@ -64,7 +61,7 @@ export var ColumnCombiner = /*#__PURE__*/function (_React$PureComponent) { nextColumns = _ref3[0]; var _ref4 = _slicedToArray(_ref2, 1), prevColumns = _ref4[0]; - return !_this.memoized.haveContextColumnsChanged(prevColumns, nextColumns); + return !_this2.memoized.haveContextColumnsChanged(prevColumns, nextColumns); }), getDefinitions: memoize(ColumnCombiner.getDefinitions, // Func to memoize @@ -91,13 +88,14 @@ export var ColumnCombiner = /*#__PURE__*/function (_React$PureComponent) { // reference after each filter, sort, etc call. This allows us to preserve the custom // columns we've selected _unless_ Item type or something else changes which changes the // column set that comes down from back-end response. - return !_this.memoized.haveContextColumnsChanged(prevColumns, nextColumns); + return !_this2.memoized.haveContextColumnsChanged(prevColumns, nextColumns); }), filteredColumns: memoize(ColumnCombiner.filteredColumns) }; - return _this; + return _this2; } - _createClass(ColumnCombiner, [{ + _inherits(ColumnCombiner, _React$PureComponent); + return _createClass(ColumnCombiner, [{ key: "render", value: function render() { var _this$props = this.props, @@ -164,7 +162,6 @@ export var ColumnCombiner = /*#__PURE__*/function (_React$PureComponent) { }); } }]); - return ColumnCombiner; }(React.PureComponent); /** diff --git a/es/components/browse/components/table-commons/HeadersRow.js b/es/components/browse/components/table-commons/HeadersRow.js index 3837e558..080e6341 100644 --- a/es/components/browse/components/table-commons/HeadersRow.js +++ b/es/components/browse/components/table-commons/HeadersRow.js @@ -1,26 +1,26 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +import _extends from "@babel/runtime/helpers/extends"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { memo, useMemo } from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -38,18 +38,16 @@ import { requestAnimationFrame as raf } from './../../../viz/utilities'; * Can exclude props passed by those two and HeadersRow features/UI will degrade gracefully. */ export var HeadersRow = /*#__PURE__*/function (_React$PureComponent) { - _inherits(HeadersRow, _React$PureComponent); - var _super = _createSuper(HeadersRow); function HeadersRow(props) { - var _this; + var _this2; _classCallCheck(this, HeadersRow); - _this = _super.call(this, props); - _this.onWindowClick = _this.onWindowClick.bind(_assertThisInitialized(_this)); - _this.setShowingSortFieldsFor = _this.setShowingSortFieldsFor.bind(_assertThisInitialized(_this)); - _this.sortByField = _this.sortByField.bind(_assertThisInitialized(_this)); - _this.setColumnWidthsFromState = _this.setColumnWidthsFromState.bind(_assertThisInitialized(_this)); - _this.onAdjusterDrag = _this.onAdjusterDrag.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, HeadersRow, [props]); + _this2.onWindowClick = _this2.onWindowClick.bind(_this2); + _this2.setShowingSortFieldsFor = _this2.setShowingSortFieldsFor.bind(_this2); + _this2.sortByField = _this2.sortByField.bind(_this2); + _this2.setColumnWidthsFromState = _this2.setColumnWidthsFromState.bind(_this2); + _this2.onAdjusterDrag = _this2.onAdjusterDrag.bind(_this2); + _this2.state = { 'widths': {}, // Store for temporary column widths used while a header's 'width' edge/grabber is being dragged. 'showingSortFieldsForColumn': null, @@ -57,16 +55,17 @@ export var HeadersRow = /*#__PURE__*/function (_React$PureComponent) { 'loadingField': null // Current key/field of column for which sorted results are being loaded. }; - _this.memoized = { + _this2.memoized = { alignedWidths: memoize(HeadersRow.alignedWidths), getSortColumnMap: memoize(HeadersRow.getSortColumnMap), getRootLoadingField: memoize(HeadersRow.getRootLoadingField), flattenColumnsDefinitionsSortFields: memoize(flattenColumnsDefinitionsSortFields), getTrimmedColumn: memoize(HeadersRow.getTrimmedColumn) }; - return _this; + return _this2; } - _createClass(HeadersRow, [{ + _inherits(HeadersRow, _React$PureComponent); + return _createClass(HeadersRow, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps, pastState) { var _this$props = this.props, @@ -122,15 +121,15 @@ export var HeadersRow = /*#__PURE__*/function (_React$PureComponent) { }, { key: "onWindowClick", value: function onWindowClick(evt) { - var _this2 = this; + var _this3 = this; setTimeout(function () { - var showingSortFieldsForColumn = _this2.state.showingSortFieldsForColumn; + var showingSortFieldsForColumn = _this3.state.showingSortFieldsForColumn; var clickedElement = evt.target; var clickedChildOfDropdownMenu = !!findParentElement(clickedElement, function (el) { return el.getAttribute("data-showing-sort-fields-for") === showingSortFieldsForColumn; }); if (!clickedChildOfDropdownMenu) { - _this2.setShowingSortFieldsFor(null); + _this3.setShowingSortFieldsFor(null); } }, 0); } @@ -194,12 +193,12 @@ export var HeadersRow = /*#__PURE__*/function (_React$PureComponent) { }, { key: "setColumnWidthsFromState", value: function setColumnWidthsFromState() { - var _this3 = this; + var _this4 = this; raf(function () { - var _this3$props = _this3.props, - setColumnWidths = _this3$props.setColumnWidths, - columnWidths = _this3$props.columnWidths; - var widths = _this3.state.widths; + var _this4$props = _this4.props, + setColumnWidths = _this4$props.setColumnWidths, + columnWidths = _this4$props.columnWidths; + var widths = _this4.state.widths; if (typeof setColumnWidths !== 'function') { throw new Error('props.setHeaderWidths not a function'); } @@ -419,7 +418,6 @@ export var HeadersRow = /*#__PURE__*/function (_React$PureComponent) { }[fieldType] || null; } }]); - return HeadersRow; }(React.PureComponent); _defineProperty(HeadersRow, "propTypes", { 'columnDefinitions': PropTypes.arrayOf(PropTypes.shape({ @@ -461,25 +459,24 @@ _defineProperty(HeadersRow, "defaultProps", { 'tableContainerScrollLeft': 0 }); var HeadersRowColumn = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(HeadersRowColumn, _React$PureComponent2); - var _super2 = _createSuper(HeadersRowColumn); function HeadersRowColumn(props) { - var _this4; + var _this5; _classCallCheck(this, HeadersRowColumn); - _this4 = _super2.call(this, props); - _this4.onDrag = _this4.onDrag.bind(_assertThisInitialized(_this4)); - _this4.onStop = _this4.onStop.bind(_assertThisInitialized(_this4)); - _this4.memoized = { + _this5 = _callSuper(this, HeadersRowColumn, [props]); + _this5.onDrag = _this5.onDrag.bind(_this5); + _this5.onStop = _this5.onStop.bind(_this5); + _this5.memoized = { showTooltip: memoize(function (colWidth, titleStr) { return (colWidth - 40) / 7 < (titleStr || "").length; }) }; - _this4.widthAdjustNodeRef = /*#__PURE__*/React.createRef(); - return _this4; + _this5.widthAdjustNodeRef = /*#__PURE__*/React.createRef(); + return _this5; } /** Updates HeadersRow.state.widths {Object} */ - _createClass(HeadersRowColumn, [{ + _inherits(HeadersRowColumn, _React$PureComponent2); + return _createClass(HeadersRowColumn, [{ key: "onDrag", value: function onDrag(event, res) { var _this$props4 = this.props, @@ -580,20 +577,17 @@ var HeadersRowColumn = /*#__PURE__*/function (_React$PureComponent2) { })) : null); } }]); - return HeadersRowColumn; }(React.PureComponent); var ColumnSorterIcon = /*#__PURE__*/function (_React$PureComponent3) { - _inherits(ColumnSorterIcon, _React$PureComponent3); - var _super3 = _createSuper(ColumnSorterIcon); function ColumnSorterIcon(props) { - var _this5; + var _this6; _classCallCheck(this, ColumnSorterIcon); - _this5 = _super3.call(this, props); - _this5.onIconClick = _this5.onIconClick.bind(_assertThisInitialized(_this5)); - _this5.memoized = { + _this6 = _callSuper(this, ColumnSorterIcon, [props]); + _this6.onIconClick = _this6.onIconClick.bind(_this6); + _this6.memoized = { isActive: memoize(ColumnSorterIcon.isActive) }; - return _this5; + return _this6; } /** @@ -602,7 +596,8 @@ var ColumnSorterIcon = /*#__PURE__*/function (_React$PureComponent3) { * * @param {React.SyntheticEvent} e - Click event object. */ - _createClass(ColumnSorterIcon, [{ + _inherits(ColumnSorterIcon, _React$PureComponent3); + return _createClass(ColumnSorterIcon, [{ key: "onIconClick", value: function onIconClick(e) { e.preventDefault(); @@ -699,7 +694,6 @@ var ColumnSorterIcon = /*#__PURE__*/function (_React$PureComponent3) { return active[keys[0]][0]; } }]); - return ColumnSorterIcon; }(React.PureComponent); _defineProperty(ColumnSorterIcon, "propTypes", { 'active': PropTypes.any, diff --git a/es/components/browse/components/table-commons/ResultRowColumnBlockValue.js b/es/components/browse/components/table-commons/ResultRowColumnBlockValue.js index fa5a8577..548bf9b6 100644 --- a/es/components/browse/components/table-commons/ResultRowColumnBlockValue.js +++ b/es/components/browse/components/table-commons/ResultRowColumnBlockValue.js @@ -1,23 +1,24 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _typeof from "@babel/runtime/helpers/typeof"; +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import _ from 'underscore'; import memoize from 'memoize-one'; @@ -29,18 +30,17 @@ import { getNestedProperty, itemUtil } from './../../../util/object'; * a `props.shouldComponentUpdateExt` is available but perhaps not fully implemented. */ export var ResultRowColumnBlockValue = /*#__PURE__*/function (_React$Component) { - _inherits(ResultRowColumnBlockValue, _React$Component); - var _super = _createSuper(ResultRowColumnBlockValue); function ResultRowColumnBlockValue(props) { - var _this; + var _this2; _classCallCheck(this, ResultRowColumnBlockValue); - _this = _super.call(this, props); - _this.memoized = { + _this2 = _callSuper(this, ResultRowColumnBlockValue, [props]); + _this2.memoized = { transformIfNeeded: memoize(ResultRowColumnBlockValue.transformIfNeeded) }; - return _this; + return _this2; } - _createClass(ResultRowColumnBlockValue, [{ + _inherits(ResultRowColumnBlockValue, _React$Component); + return _createClass(ResultRowColumnBlockValue, [{ key: "shouldComponentUpdate", value: function shouldComponentUpdate(nextProps, nextState) { var _this$props = this.props, @@ -175,7 +175,6 @@ export var ResultRowColumnBlockValue = /*#__PURE__*/function (_React$Component) } } }]); - return ResultRowColumnBlockValue; }(React.Component); /** diff --git a/es/components/browse/components/table-commons/basicColumnExtensionMap.js b/es/components/browse/components/table-commons/basicColumnExtensionMap.js index ce3ee4be..b018a6d6 100644 --- a/es/components/browse/components/table-commons/basicColumnExtensionMap.js +++ b/es/components/browse/components/table-commons/basicColumnExtensionMap.js @@ -1,9 +1,6 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _defineProperty from "@babel/runtime/helpers/defineProperty"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } import React, { useMemo } from 'react'; import url from 'url'; import queryString from 'querystring'; diff --git a/es/components/forms/SubmissionView.js b/es/components/forms/SubmissionView.js index f0736ac6..c9874479 100644 --- a/es/components/forms/SubmissionView.js +++ b/es/components/forms/SubmissionView.js @@ -1,33 +1,29 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; var _excluded = ["context", "navigate"]; -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import _ from 'underscore'; import url from 'url'; @@ -74,13 +70,11 @@ import { BuildField, AliasInputField, isValueNull } from './components/submissio * @prop {boolean} edit Is this an Item being edited? */ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SubmissionView, _React$PureComponent); - var _super = _createSuper(SubmissionView); function SubmissionView(props) { - var _this; + var _this2; _classCallCheck(this, SubmissionView); - _this = _super.call(this, props); - _.bindAll(_assertThisInitialized(_this), 'modifyKeyContext', 'initializePrincipal', 'initCreateObj', 'initCreateAlias', 'submitAmbiguousType', 'buildAmbiguousEnumEntry', 'handleTypeSelection', 'handleAliasChange', 'handleAliasLabChange', 'submitAlias', 'modifyAlias', 'createObj', 'removeObj', 'initExistingObj', 'addExistingObj', 'setSubmissionState', 'updateUpload', 'testPostNewContext', 'realPostNewContext', 'removeNullsFromContext', 'checkRoundTwo', 'buildDeleteFields', 'modifyMD5Progess', 'submitObject', 'finishRoundTwo', 'cancelCreateNewObject', 'cancelCreatePrimaryObject'); + _this2 = _callSuper(this, SubmissionView, [props]); + _.bindAll(_this2, 'modifyKeyContext', 'initializePrincipal', 'initCreateObj', 'initCreateAlias', 'submitAmbiguousType', 'buildAmbiguousEnumEntry', 'handleTypeSelection', 'handleAliasChange', 'handleAliasLabChange', 'submitAlias', 'modifyAlias', 'createObj', 'removeObj', 'initExistingObj', 'addExistingObj', 'setSubmissionState', 'updateUpload', 'testPostNewContext', 'realPostNewContext', 'removeNullsFromContext', 'checkRoundTwo', 'buildDeleteFields', 'modifyMD5Progess', 'submitObject', 'finishRoundTwo', 'cancelCreateNewObject', 'cancelCreatePrimaryObject'); /** * *** DETAIL ON THIS.STATE *** @@ -118,7 +112,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { * @prop {!string} uploadStatus Holds message relevant to file BuildField. Reset to null when currKey changes. * @prop {!Object} currentSubmittingUser Holds current/submitting User Item; used primarily for submission permission(s) and autosuggesting an alias. */ - _this.state = { + _this2.state = { 'keyContext': null, 'keyValid': null, 'keyTypes': null, @@ -161,14 +155,15 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { 'create': props.currentAction === 'create' || props.currentAction === 'add', 'callbackHref': null // Where we navigate to after submission }; - return _this; + return _this2; } /** * Call initializePrincipal to get state set up, but only if schemas are * available. */ - _createClass(SubmissionView, [{ + _inherits(SubmissionView, _React$PureComponent); + return _createClass(SubmissionView, [{ key: "componentDidMount", value: function componentDidMount() { var schemas = this.props.schemas; @@ -257,7 +252,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { }, { key: "initializePrincipal", value: function initializePrincipal() { - var _this2 = this; + var _this3 = this; var _this$props2 = this.props, context = _this$props2.context, schemas = _this$props2.schemas, @@ -314,7 +309,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { // We may not have schema (if Abstract type). If so, leave empty and allow initCreateObj ... -> createObj() to create it. if (schema) keyContext["0"] = buildContext({}, schema, bookmarksList, edit, create); keyLinkBookmarks["0"] = bookmarksList; - _this2.setState({ + _this3.setState({ keyContext: keyContext, keyValid: keyValid, keyTypes: keyTypes, @@ -324,7 +319,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { currKey: 0, callbackHref: callbackHref }, function () { - _this2.initCreateObj(principalType, 0, 'Primary Object'); + _this3.initCreateObj(principalType, 0, 'Primary Object'); }); } else { // get the DB result to avoid any possible indexing hang-ups @@ -346,7 +341,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { keyContext["0"] = buildContext({}, schema, bookmarksList, edit, create); keyLinkBookmarks["0"] = bookmarksList; } - _this2.setState({ + _this3.setState({ keyContext: keyContext, keyValid: keyValid, keyTypes: keyTypes, @@ -358,13 +353,13 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { _.forEach(initObjs, function (initObj) { // We get 'path' as display in buildContext->delveExistingObj.. so override here. initObj.display = keyDisplay[initObj.path] || initObj.display; - _this2.initExistingObj(initObj); + _this3.initExistingObj(initObj); }); // if we are cloning and there is not an existing alias // never prompt alias creation on edit // do not initiate ambiguous type lookup on edit or create if (!edit && !existingAlias) { - _this2.initCreateObj(principalType, 0, 'Primary Object', true); + _this3.initCreateObj(principalType, 0, 'Primary Object', true); } }); }); @@ -375,7 +370,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { // Grab current user via AJAX and store to state. To use for alias auto-generation using current user's top submits_for lab name. ajax.load(userHref + '?frame=embedded', function (r) { - _this2.setState({ + _this3.setState({ 'currentSubmittingUser': r }, continueInitProcess); }, 'GET', continueInitProcess); @@ -539,7 +534,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { }, { key: "submitAlias", value: function submitAlias(e) { - var _this3 = this; + var _this4 = this; e.preventDefault(); e.stopPropagation(); var schemas = this.props.schemas; @@ -576,7 +571,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { // see if the input alias is already being used ajax.promise('/' + alias).then(function (data) { if (data && data.title && data.title === "Not Found") { - _this3.createObj(type, newIdx, newLink, alias, { + _this4.createObj(type, newIdx, newLink, alias, { 'creatingIdx': null, 'creatingType': null, 'creatingLink': null, @@ -585,7 +580,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { 'creatingLinkForField': null }); } else { - _this3.setState({ + _this4.setState({ 'creatingAliasMessage': 'ERROR. That alias is already taken.' }); return false; @@ -980,7 +975,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { }, { key: "updateUpload", value: function updateUpload(uploadInfo) { - var _this4 = this; + var _this5 = this; var completed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var failed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var stateToSet = {}; @@ -1000,7 +995,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { // doesn't really matter what response is stateToSet.uploadStatus = 'Upload failed'; stateToSet.upload = null; - _this4.setState(stateToSet); + _this5.setState(stateToSet); }); } else { // must be the initial run @@ -1012,7 +1007,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { if (file === null) return; getLargeMD5(file, this.modifyMD5Progess).then(function (hash) { // perform async patch to set md5sum field of the file - var destination = _this4.state.keyComplete[_this4.state.currKey]; + var destination = _this5.state.keyComplete[_this5.state.currKey]; var payload = JSON.stringify({ 'md5sum': hash }); @@ -1022,24 +1017,24 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { stateToSet.upload = uploadInfo; stateToSet.md5Progress = null; stateToSet.uploadStatus = null; - _this4.setState(stateToSet); + _this5.setState(stateToSet); } else if (data.status && data.title && data.status == 'error' && data.title == 'Conflict') { // md5 key conflict stateToSet.uploadStatus = 'MD5 conflicts with another file'; stateToSet.md5Progress = null; - _this4.setState(stateToSet); + _this5.setState(stateToSet); } else { // error setting md5 stateToSet.uploadStatus = 'MD5 calculation error'; stateToSet.md5Progress = null; - _this4.setState(stateToSet); + _this5.setState(stateToSet); } }); })["catch"](function () { stateToSet.uploadStatus = 'MD5 calculation error'; stateToSet.file = null; stateToSet.md5Progress = null; - _this4.setState(stateToSet); + _this5.setState(stateToSet); }); } } @@ -1114,7 +1109,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { }, { key: "buildDeleteFields", value: function buildDeleteFields(patchContext, origContext, schema) { - var _this5 = this; + var _this6 = this; var deleteFields = []; // must remove nulls from the orig copy to sync with patchContext var origCopy = object.deepClone(origContext); @@ -1146,11 +1141,11 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { } // check round two fields if the parameter roundTwo is set if (fieldSchema.ff_flag && fieldSchema.ff_flag == 'second round') { - if (_this5.state.roundTwo) deleteFields.push(field); + if (_this6.state.roundTwo) deleteFields.push(field); return; } // if we're here, the submission field was legitimately deleted - if (!_this5.state.roundTwo) deleteFields.push(field); + if (!_this6.state.roundTwo) deleteFields.push(field); } }); return deleteFields; @@ -1196,7 +1191,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { }, { key: "submitObject", value: function submitObject(inKey) { - var _this6 = this; + var _this7 = this; var test = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var suppressWarnings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; console.log.apply(console, ["SUBMITOBJ"].concat(Array.prototype.slice.call(arguments))); @@ -1309,12 +1304,12 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { actionMethod = 'PATCH'; var alreadySubmittedContext = keyContext[destination]; // roundTwo flag set to true for second round - deleteFields = _this6.buildDeleteFields(finalizedContext, alreadySubmittedContext, currSchema); + deleteFields = _this7.buildDeleteFields(finalizedContext, alreadySubmittedContext, currSchema); } else if (edit && inKey === 0) { // submitting the principal object destination = object.itemUtil.atId(context); actionMethod = 'PATCH'; - deleteFields = _this6.buildDeleteFields(finalizedContext, context, currSchema); + deleteFields = _this7.buildDeleteFields(finalizedContext, context, currSchema); } else { // submitting a new object destination = '/' + currType + '/'; @@ -1362,14 +1357,14 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { setTimeout(layout.animateScrollTo(0), 100); // scroll to top } - _this6.setState(stateToSet); + _this7.setState(stateToSet); } else { // response successful var responseData; var submitted_at_id; if (test) { stateToSet.keyValid[inKey] = 3; - _this6.setState(stateToSet); + _this7.setState(stateToSet); return; } else { var _response$Graph = _slicedToArray(response['@graph'], 1); @@ -1401,14 +1396,14 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { // file will be uploaded to s3. If all of this // is succesful, call finishRoundTwo. stateToSet.uploadStatus = null; - _this6.setState(stateToSet); - _this6.updateUpload(upload_manager); + _this7.setState(stateToSet); + _this7.updateUpload(upload_manager); } }); } else { // state cleanup for this key - _this6.finishRoundTwo(); - _this6.setState(stateToSet); + _this7.finishRoundTwo(); + _this7.setState(stateToSet); } } else { // posted new object; need to re-key this item @@ -1468,7 +1463,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { stateToSet.keyValid[submitted_at_id] = 4; // update roundTwoKeys if necessary - var needsRoundTwo = _this6.checkRoundTwo(currSchema); + var needsRoundTwo = _this7.checkRoundTwo(currSchema); if (needsRoundTwo && !_.contains(roundTwoCopy, inKey)) { // was getting an error where this could be str roundTwoCopy.push(parseInt(inKey)); @@ -1492,7 +1487,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { stateToSet.keyValid[roundTwoCopy[i]] = 0; } alert('Success! All objects were submitted. However, one or more have additional fields that can be only filled in second round submission. You will now be guided through this process for each object.'); - _this6.setState(stateToSet); + _this7.setState(stateToSet); } } else { // Check if parent validation state will change based on current submission... update that alongside rest of state, if so @@ -1506,7 +1501,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { // console.log("inKey: ", inKey); alert(keyDisplay[inKey] + ' was successfully submitted.'); - _this6.setState(stateToSet); + _this7.setState(stateToSet); } } ReactTooltip.rebuild(); @@ -1537,7 +1532,7 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { }, { key: "finishRoundTwo", value: function finishRoundTwo() { - var _this7 = this; + var _this8 = this; this.setState(function (_ref8) { var currKey = _ref8.currKey, keyValid = _ref8.keyValid, @@ -1560,14 +1555,14 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { roundTwoKeys: roundTwoCopy }; }, function () { - var _this7$props = _this7.props, - setIsSubmitting = _this7$props.setIsSubmitting, - propNavigate = _this7$props.navigate; - var _this7$state = _this7.state, - keyComplete = _this7$state.keyComplete, - _this7$state$roundTwo = _this7$state.roundTwoKeys, - roundTwoKeys = _this7$state$roundTwo === void 0 ? [] : _this7$state$roundTwo, - callbackHref = _this7$state.callbackHref; + var _this8$props = _this8.props, + setIsSubmitting = _this8$props.setIsSubmitting, + propNavigate = _this8$props.navigate; + var _this8$state = _this8.state, + keyComplete = _this8$state.keyComplete, + _this8$state$roundTwo = _this8$state.roundTwoKeys, + roundTwoKeys = _this8$state$roundTwo === void 0 ? [] : _this8$state$roundTwo, + callbackHref = _this8$state.callbackHref; if (roundTwoKeys.length === 0) { // we're done! setIsSubmitting(false, function () { @@ -1786,7 +1781,6 @@ var SubmissionView = /*#__PURE__*/function (_React$PureComponent) { return principalDisplay; } }]); - return SubmissionView; }(React.PureComponent); /** * Generate JSX for a validation button. Disabled unless validation state == 1 @@ -1948,21 +1942,20 @@ var WarningBanner = /*#__PURE__*/React.memo(function (props) { }, children)))); }); var DetailTitleBanner = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(DetailTitleBanner, _React$PureComponent2); - var _super2 = _createSuper(DetailTitleBanner); function DetailTitleBanner(props) { - var _this8; + var _this9; _classCallCheck(this, DetailTitleBanner); - _this8 = _super2.call(this, props); - _this8.generateCrumbTitle = _this8.generateCrumbTitle.bind(_assertThisInitialized(_this8)); - _this8.toggleOpen = _.throttle(_this8.toggleOpen.bind(_assertThisInitialized(_this8)), 500); - _this8.generateHierarchicalTitles = _this8.generateHierarchicalTitles.bind(_assertThisInitialized(_this8)); - _this8.state = { + _this9 = _callSuper(this, DetailTitleBanner, [props]); + _this9.generateCrumbTitle = _this9.generateCrumbTitle.bind(_this9); + _this9.toggleOpen = _.throttle(_this9.toggleOpen.bind(_this9), 500); + _this9.generateHierarchicalTitles = _this9.generateHierarchicalTitles.bind(_this9); + _this9.state = { 'open': true }; - return _this8; + return _this9; } - _createClass(DetailTitleBanner, [{ + _inherits(DetailTitleBanner, _React$PureComponent2); + return _createClass(DetailTitleBanner, [{ key: "handleClick", value: function handleClick(keyIdx, e) { e.preventDefault(); @@ -2113,21 +2106,19 @@ var DetailTitleBanner = /*#__PURE__*/function (_React$PureComponent2) { return foundPropertyName; } }]); - return DetailTitleBanner; }(React.PureComponent); /** TODO: DropdownButton to be v4 bootstrap compliant */ var TypeSelectModal = /*#__PURE__*/function (_React$Component) { - _inherits(TypeSelectModal, _React$Component); - var _super3 = _createSuper(TypeSelectModal); function TypeSelectModal(props) { - var _this9; + var _this10; _classCallCheck(this, TypeSelectModal); - _this9 = _super3.call(this, props); - _this9.onHide = _this9.onHide.bind(_assertThisInitialized(_this9)); - _this9.onContainerKeyDown = _this9.onContainerKeyDown.bind(_assertThisInitialized(_this9)); - return _this9; + _this10 = _callSuper(this, TypeSelectModal, [props]); + _this10.onHide = _this10.onHide.bind(_this10); + _this10.onContainerKeyDown = _this10.onContainerKeyDown.bind(_this10); + return _this10; } - _createClass(TypeSelectModal, [{ + _inherits(TypeSelectModal, _React$Component); + return _createClass(TypeSelectModal, [{ key: "onHide", value: function onHide() { var _this$props9 = this.props, @@ -2200,17 +2191,15 @@ var TypeSelectModal = /*#__PURE__*/function (_React$Component) { }, "Submit")))); } }]); - return TypeSelectModal; }(React.Component); /** Ordinary React Component which just inherits TypeSelectModal.onHide() */ var AliasSelectModal = /*#__PURE__*/function (_TypeSelectModal) { - _inherits(AliasSelectModal, _TypeSelectModal); - var _super4 = _createSuper(AliasSelectModal); function AliasSelectModal() { _classCallCheck(this, AliasSelectModal); - return _super4.apply(this, arguments); + return _callSuper(this, AliasSelectModal, arguments); } - _createClass(AliasSelectModal, [{ + _inherits(AliasSelectModal, _TypeSelectModal); + return _createClass(AliasSelectModal, [{ key: "render", value: function render() { var _this$props11 = this.props, @@ -2257,7 +2246,6 @@ var AliasSelectModal = /*#__PURE__*/function (_TypeSelectModal) { }, "Submit"))))); } }]); - return AliasSelectModal; }(TypeSelectModal); /** * Main view for editing a specific object. This includes all non-same level @@ -2274,13 +2262,11 @@ var AliasSelectModal = /*#__PURE__*/function (_TypeSelectModal) { * Use _.bindAll, make sure setState is using functional updater anywhere state update may derive from other state. */ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { - _inherits(IndividualObjectView, _React$Component2); - var _super5 = _createSuper(IndividualObjectView); function IndividualObjectView(props) { - var _this10; + var _this11; _classCallCheck(this, IndividualObjectView); - _this10 = _super5.call(this, props); - _.bindAll(_assertThisInitialized(_this10), 'modifyNewContext', 'fetchAndValidateItem', 'selectObj', 'selectComplete', 'selectCancel', 'initiateField'); + _this11 = _callSuper(this, IndividualObjectView, [props]); + _.bindAll(_this11, 'modifyNewContext', 'fetchAndValidateItem', 'selectObj', 'selectComplete', 'selectCancel', 'initiateField'); /** * State in this component mostly has to do with selection of existing objs @@ -2289,12 +2275,12 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { * @prop {!string} selectField Actual fieldname that we're selecting the existing obj for. May be nested in the case of subobjects, e.g. experiments_in_set.experiment * @prop {!number[]} selectArrayIdx List of int numbers keeping track of list positions of the object we're selecting for. Since you can have arrays within arrays, one int won't do. Example: [1,2] would mean the current field is the second item within the first item of the array given by the top level field. When null, no arrays involved. */ - _this10.state = { + _this11.state = { 'selectType': null, 'selectField': null, 'selectArrayIdx': null }; - return _this10; + return _this11; } // componentDidUpdate(pastProps, pastState) { @@ -2328,7 +2314,8 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { * * TODO: Examine why newLink isn't being used anywhere; what was it for, why did it disappear? Should it be in use? */ - _createClass(IndividualObjectView, [{ + _inherits(IndividualObjectView, _React$Component2); + return _createClass(IndividualObjectView, [{ key: "modifyNewContext", value: function modifyNewContext(field, value, fieldType) { var arrayIdx = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; @@ -2434,7 +2421,7 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { }, { key: "fetchAndValidateItem", value: function fetchAndValidateItem(itemAtID, field, type, arrayIdx) { - var _this11 = this; + var _this12 = this; arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; // console.log(`calling fetchAndValidateItem( // field=${field}, @@ -2451,14 +2438,14 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { "style": "danger" }); layout.animateScrollTo(0); // Scroll to top of page so alert is visible to end-user. - _this11.modifyNewContext(field, null, 'existing linked object', null, arrayIdx); + _this12.modifyNewContext(field, null, 'existing linked object', null, arrayIdx); }; var successCallback = function (result) { // console.log("fetchAndValidateItem successfully found: ", result); Alerts.deQueue({ 'title': failureAlertTitle }); - _this11.modifyNewContext(field, result['@id'], 'existing linked object', result['@type'][1], arrayIdx, result.display_title); + _this12.modifyNewContext(field, result['@id'], 'existing linked object', result['@type'][1], arrayIdx, result.display_title); addExistingObj(itemAtID, result.display_title, type, field, false); }; if (typeof hrefToFetch !== 'string') { @@ -2524,7 +2511,7 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { }, { key: "selectComplete", value: function selectComplete(atIds) { - var _this12 = this; + var _this13 = this; var customSelectField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var customSelectType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var customArrayIdx = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; @@ -2552,7 +2539,7 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { var currentlySelectedIds = selectField && currContext[selectField]; var isRepeat = Array.isArray(currentlySelectedIds) && _.contains(currentlySelectedIds, atId); if (!isRepeat) { - _this12.fetchAndValidateItem(atId, selectField, customSelectType || stateSelectType, isInArray ? nextArrayIndices.slice() : null, null); + _this13.fetchAndValidateItem(atId, selectField, customSelectType || stateSelectType, isInArray ? nextArrayIndices.slice() : null, null); if (isMultiSelect) { // Sets up nextArrayIndices for next Item being added in multiselect nextArrayIndices[nextArrayIndices.length - 1]++; @@ -2562,14 +2549,14 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { // if the only value, just "replace" the value so it doesn't get deleted from state // this can also serve to update the display title if, say, a recently created item is indexed and then // reselected from dropdown - _this12.modifyNewContext(selectField, atId, 'existing linked object', null, selectArrayIdx); + _this13.modifyNewContext(selectField, atId, 'existing linked object', null, selectArrayIdx); } else { // check if the repeat is the current field; if it is, "replace" it. if (currentlySelectedIds[selectArrayIdx] === atId) { - _this12.modifyNewContext(selectField, atId, 'existing linked object', null, selectArrayIdx); + _this13.modifyNewContext(selectField, atId, 'existing linked object', null, selectArrayIdx); } else { // don't allow a "replacement"; cancel - _this12.modifyNewContext(selectField, null, 'existing linked object', null, selectArrayIdx); + _this13.modifyNewContext(selectField, null, 'existing linked object', null, selectArrayIdx); } } } @@ -2752,7 +2739,6 @@ var IndividualObjectView = /*#__PURE__*/function (_React$Component2) { }) : null); } }]); - return IndividualObjectView; }(React.Component); var FormFieldsContainer = /*#__PURE__*/React.memo(function (props) { var children = props.children, @@ -2776,19 +2762,18 @@ FormFieldsContainer.defaultProps = { * and schemas passed to it. */ var RoundTwoDetailPanel = /*#__PURE__*/function (_React$PureComponent3) { - _inherits(RoundTwoDetailPanel, _React$PureComponent3); - var _super6 = _createSuper(RoundTwoDetailPanel); function RoundTwoDetailPanel(props) { - var _this13; + var _this14; _classCallCheck(this, RoundTwoDetailPanel); - _this13 = _super6.call(this, props); - _this13.handleToggle = _this13.handleToggle.bind(_assertThisInitialized(_this13)); - _this13.state = { + _this14 = _callSuper(this, RoundTwoDetailPanel, [props]); + _this14.handleToggle = _this14.handleToggle.bind(_this14); + _this14.state = { 'open': props.open || false }; - return _this13; + return _this14; } - _createClass(RoundTwoDetailPanel, [{ + _inherits(RoundTwoDetailPanel, _React$PureComponent3); + return _createClass(RoundTwoDetailPanel, [{ key: "handleToggle", value: function handleToggle(e) { e.preventDefault(); @@ -2829,5 +2814,4 @@ var RoundTwoDetailPanel = /*#__PURE__*/function (_React$PureComponent3) { })))); } }]); - return RoundTwoDetailPanel; }(React.PureComponent); \ No newline at end of file diff --git a/es/components/forms/components/Checkbox.js b/es/components/forms/components/Checkbox.js index 204014f7..da6e6d4e 100644 --- a/es/components/forms/components/Checkbox.js +++ b/es/components/forms/components/Checkbox.js @@ -1,7 +1,6 @@ +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["className", "children", "labelClassName", "title", "inputClassName", "indeterminate"]; -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React from 'react'; import { IndeterminateCheckbox } from './IndeterminateCheckbox'; diff --git a/es/components/forms/components/DragAndDropUpload.js b/es/components/forms/components/DragAndDropUpload.js index 63606b63..83d6c0d5 100644 --- a/es/components/forms/components/DragAndDropUpload.js +++ b/es/components/forms/components/DragAndDropUpload.js @@ -1,29 +1,33 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import Modal from 'react-bootstrap/esm/Modal'; import PropTypes from 'prop-types'; import { ajax } from './../../util'; import _ from 'underscore'; export var DragAndDropUploadSubmissionViewController = /*#__PURE__*/function (_React$Component) { - _inherits(DragAndDropUploadSubmissionViewController, _React$Component); - var _super = _createSuper(DragAndDropUploadSubmissionViewController); function DragAndDropUploadSubmissionViewController() { _classCallCheck(this, DragAndDropUploadSubmissionViewController); - return _super.apply(this, arguments); + return _callSuper(this, DragAndDropUploadSubmissionViewController, arguments); } + _inherits(DragAndDropUploadSubmissionViewController, _React$Component); return _createClass(DragAndDropUploadSubmissionViewController); }(React.Component); @@ -38,28 +42,27 @@ export var DragAndDropUploadSubmissionViewController = /*#__PURE__*/function (_R * Heavily reworked from this reference: https://medium.com/@650egor/simple-drag-and-drop-file-upload-in-react-2cb409d88929 */ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Component2) { - _inherits(DragAndDropFileUploadController, _React$Component2); - var _super2 = _createSuper(DragAndDropFileUploadController); function DragAndDropFileUploadController(props) { - var _this; + var _this2; _classCallCheck(this, DragAndDropFileUploadController); - _this = _super2.call(this, props); - _this.state = { + _this2 = _callSuper(this, DragAndDropFileUploadController, [props]); + _this2.state = { files: [], // Always in an array, even if multiselect disabled isLoading: false }; console.log("DragAndDropUploadFileControlller props", props); - _this.handleAddFile = _this.handleAddFile.bind(_assertThisInitialized(_this)); - _this.handleRemoveFile = _this.handleRemoveFile.bind(_assertThisInitialized(_this)); - _this.handleClearAllFiles = _this.handleClearAllFiles.bind(_assertThisInitialized(_this)); - _this.onUploadStart = _this.onUploadStart.bind(_assertThisInitialized(_this)); - return _this; + _this2.handleAddFile = _this2.handleAddFile.bind(_this2); + _this2.handleRemoveFile = _this2.handleRemoveFile.bind(_this2); + _this2.handleClearAllFiles = _this2.handleClearAllFiles.bind(_this2); + _this2.onUploadStart = _this2.onUploadStart.bind(_this2); + return _this2; } - _createClass(DragAndDropFileUploadController, [{ + _inherits(DragAndDropFileUploadController, _React$Component2); + return _createClass(DragAndDropFileUploadController, [{ key: "handleAddFile", value: function handleAddFile(evt) { - var _this2 = this; + var _this3 = this; var _evt$dataTransfer = evt.dataTransfer, items = _evt$dataTransfer.items, files = _evt$dataTransfer.files; @@ -73,41 +76,40 @@ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Compo var fileLimit = multiselect ? files.length : 1; // Populate an array with all of the new files var _loop = function _loop() { - var attachment = {}; - var file = files[i]; + var attachment = {}; + var file = files[i]; - // Check that file type is in schema (TODO: Is this too strict? MIME-types can get complicated...) - var acceptableFileTypes = fileSchema.properties.attachment.properties.type["enum"]; - if (_.indexOf(acceptableFileTypes, file.type) === -1) { - var listOfTypes = acceptableFileTypes.toString(); - alert("FILE NOT ADDED: File \"".concat(file.name, "\" is not of the correct file type for this field.\n\nMust be of type: ").concat(listOfTypes, ".")); - return "continue"; - } - attachment.type = file.type; + // Check that file type is in schema (TODO: Is this too strict? MIME-types can get complicated...) + var acceptableFileTypes = fileSchema.properties.attachment.properties.type["enum"]; + if (_.indexOf(acceptableFileTypes, file.type) === -1) { + var listOfTypes = acceptableFileTypes.toString(); + alert("FILE NOT ADDED: File \"".concat(file.name, "\" is not of the correct file type for this field.\n\nMust be of type: ").concat(listOfTypes, ".")); + return 1; // continue + } + attachment.type = file.type; - // TODO: Figure out how best to check/limit file size pre-attachment... - if (file.size) { - attachment.size = file.size; - } - if (file.name) { - attachment.download = file.name; - } - fileReader = new window.FileReader(); - fileReader.readAsDataURL(file); - fileReader.onloadend = function (e) { - if (e.target.result) { - attachment.href = e.target.result; - } else { - alert('ERROR: There was a problem reading the given file. Please try again.'); - return; + // TODO: Figure out how best to check/limit file size pre-attachment... + if (file.size) { + attachment.size = file.size; + } + if (file.name) { + attachment.download = file.name; } - }.bind(_this2); - fileArr.push(attachment); - }; + fileReader = new window.FileReader(); + fileReader.readAsDataURL(file); + fileReader.onloadend = function (e) { + if (e.target.result) { + attachment.href = e.target.result; + } else { + alert('ERROR: There was a problem reading the given file. Please try again.'); + return; + } + }.bind(_this3); + fileArr.push(attachment); + }, + fileReader; for (var i = 0; i < fileLimit; i++) { - var fileReader; - var _ret = _loop(); - if (_ret === "continue") continue; + if (_loop()) continue; } // Concat with previous files @@ -260,12 +262,12 @@ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Compo }, { key: "onUploadStart", value: function onUploadStart() { - var _this3 = this; + var _this4 = this; var files = this.state.files; var previouslySubmittedAtIds = []; var newFileSubmit = function newFileSubmit(file) { console.log("Attempting to upload file... ", file); - return _this3.createItem(file, true) // Validate + return _this4.createItem(file, true) // Validate .then(function (response) { if (response.status && response.status !== 'success') { var _response$errors = response.errors, @@ -278,7 +280,7 @@ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Compo throw new Error(errorMessage); } else { console.log("validation succeeded"); - return _this3.createItem(file, false); // Submit item + return _this4.createItem(file, false); // Submit item } }).then(function (resp) { if (resp.status && resp.status !== 'success') { @@ -298,7 +300,7 @@ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Compo // Also pass through the atIds of other new files previouslySubmittedAtIds.push(submitted_at_id); - return _this3.patchToParent(resp, previouslySubmittedAtIds); + return _this4.patchToParent(resp, previouslySubmittedAtIds); } }).then(function (res) { if (res.status && res.status !== 'success') { @@ -313,7 +315,7 @@ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Compo throw new Error(errorMessage); } else { alert("".concat(file.download, " uploaded and linked successfully.")); - _this3.handleRemoveFile(file.download); + _this4.handleRemoveFile(file.download); } })["catch"](function (error) { console.log("Error occurred", error); @@ -337,7 +339,7 @@ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Compo })["catch"](function (error) { console.log("May not have completed all uploads!", error); })["finally"](function () { - _this3.setState({ + _this4.setState({ isLoading: false }); }); @@ -370,7 +372,6 @@ export var DragAndDropFileUploadController = /*#__PURE__*/function (_React$Compo }); } }]); - return DragAndDropFileUploadController; }(React.Component); _defineProperty(DragAndDropFileUploadController, "propTypes", { files: PropTypes.array.isRequired, @@ -399,22 +400,21 @@ _defineProperty(DragAndDropFileUploadController, "defaultProps", { cls: "btn" }); var DragAndDropUploadButton = /*#__PURE__*/function (_React$Component3) { - _inherits(DragAndDropUploadButton, _React$Component3); - var _super3 = _createSuper(DragAndDropUploadButton); function DragAndDropUploadButton(props) { - var _this4; + var _this5; _classCallCheck(this, DragAndDropUploadButton); - _this4 = _super3.call(this, props); - _this4.state = { + _this5 = _callSuper(this, DragAndDropUploadButton, [props]); + _this5.state = { showModal: false }; console.log("props, ", props); - _this4.onHide = _this4.onHide.bind(_assertThisInitialized(_this4)); - _this4.onShow = _this4.onShow.bind(_assertThisInitialized(_this4)); - _this4.handleHideModal = _this4.handleHideModal.bind(_assertThisInitialized(_this4)); - return _this4; + _this5.onHide = _this5.onHide.bind(_this5); + _this5.onShow = _this5.onShow.bind(_this5); + _this5.handleHideModal = _this5.handleHideModal.bind(_this5); + return _this5; } - _createClass(DragAndDropUploadButton, [{ + _inherits(DragAndDropUploadButton, _React$Component3); + return _createClass(DragAndDropUploadButton, [{ key: "onHide", value: function onHide() { var showModal = this.state.showModal; @@ -481,7 +481,6 @@ var DragAndDropUploadButton = /*#__PURE__*/function (_React$Component3) { }), " Quick Upload a new ", fieldName)); } }]); - return DragAndDropUploadButton; }(React.Component); _defineProperty(DragAndDropUploadButton, "propTypes", { onUploadStart: PropTypes.func.isRequired, @@ -511,21 +510,20 @@ _defineProperty(DragAndDropUploadButton, "defaultProps", { files: [] }); var DragAndDropModal = /*#__PURE__*/function (_React$Component4) { - _inherits(DragAndDropModal, _React$Component4); - var _super4 = _createSuper(DragAndDropModal); function DragAndDropModal(props) { - var _this5; + var _this6; _classCallCheck(this, DragAndDropModal); - _this5 = _super4.call(this, props); - _this5.state = { + _this6 = _callSuper(this, DragAndDropModal, [props]); + _this6.state = { isVerified: false }; - _this5.toggleCheckbox = _this5.toggleCheckbox.bind(_assertThisInitialized(_this5)); - _this5.disableCheckbox = _this5.toggleCheckbox.bind(_assertThisInitialized(_this5)); - _this5.handleAddFileAndResetVerification = _this5.handleAddFileAndResetVerification.bind(_assertThisInitialized(_this5)); - return _this5; + _this6.toggleCheckbox = _this6.toggleCheckbox.bind(_this6); + _this6.disableCheckbox = _this6.toggleCheckbox.bind(_this6); + _this6.handleAddFileAndResetVerification = _this6.handleAddFileAndResetVerification.bind(_this6); + return _this6; } - _createClass(DragAndDropModal, [{ + _inherits(DragAndDropModal, _React$Component4); + return _createClass(DragAndDropModal, [{ key: "toggleCheckbox", value: function toggleCheckbox() { var isVerified = this.state.isVerified; @@ -624,7 +622,6 @@ var DragAndDropModal = /*#__PURE__*/function (_React$Component4) { }), " Upload ", fieldDisplayTitle))); } }]); - return DragAndDropModal; }(React.Component); /* Drag and Drop File Manager Component that accepts an onHide and onContainerKeyDown function @@ -677,24 +674,23 @@ function RequestVerification(props) { }, requestVerificationMsg, " ")); } export var DragAndDropZone = /*#__PURE__*/function (_React$Component5) { - _inherits(DragAndDropZone, _React$Component5); - var _super5 = _createSuper(DragAndDropZone); function DragAndDropZone(props) { - var _this6; + var _this7; _classCallCheck(this, DragAndDropZone); - _this6 = _super5.call(this, props); - _this6.state = { + _this7 = _callSuper(this, DragAndDropZone, [props]); + _this7.state = { dragging: false }; - _this6.dropZoneRef = /*#__PURE__*/React.createRef(); - _this6.fileUploadRef = /*#__PURE__*/React.createRef(); - _this6.cleanUpEventListeners = _this6.cleanUpEventListeners.bind(_assertThisInitialized(_this6)); - _this6.setUpEventListeners = _this6.setUpEventListeners.bind(_assertThisInitialized(_this6)); - _this6.handleDrop = _this6.handleDrop.bind(_assertThisInitialized(_this6)); - _this6.handleDropzoneClick = _this6.handleDropzoneClick.bind(_assertThisInitialized(_this6)); - return _this6; + _this7.dropZoneRef = /*#__PURE__*/React.createRef(); + _this7.fileUploadRef = /*#__PURE__*/React.createRef(); + _this7.cleanUpEventListeners = _this7.cleanUpEventListeners.bind(_this7); + _this7.setUpEventListeners = _this7.setUpEventListeners.bind(_this7); + _this7.handleDrop = _this7.handleDrop.bind(_this7); + _this7.handleDropzoneClick = _this7.handleDropzoneClick.bind(_this7); + return _this7; } - _createClass(DragAndDropZone, [{ + _inherits(DragAndDropZone, _React$Component5); + return _createClass(DragAndDropZone, [{ key: "componentDidMount", value: function componentDidMount() { this.setUpEventListeners(); @@ -778,7 +774,7 @@ export var DragAndDropZone = /*#__PURE__*/function (_React$Component5) { }, { key: "render", value: function render() { - var _this7 = this; + var _this8 = this; var _this$props8 = this.props, files = _this$props8.files, handleRemoveFile = _this$props8.handleRemoveFile, @@ -792,7 +788,7 @@ export var DragAndDropZone = /*#__PURE__*/function (_React$Component5) { ref: this.fileUploadRef, multiple: multiselect, onChange: function onChange(e) { - return _this7.handleAddFromBrowse(e); + return _this8.handleAddFromBrowse(e); }, name: "filesFromBrowse", className: "d-none" @@ -815,7 +811,6 @@ export var DragAndDropZone = /*#__PURE__*/function (_React$Component5) { }))); } }]); - return DragAndDropZone; }(React.Component); _defineProperty(DragAndDropZone, "propTypes", { /** Callback called when Item is received. Should accept @ID and Item context (not guaranteed) as params. */ diff --git a/es/components/forms/components/EditableField.js b/es/components/forms/components/EditableField.js index 100b94b3..82772462 100644 --- a/es/components/forms/components/EditableField.js +++ b/es/components/forms/components/EditableField.js @@ -1,18 +1,24 @@ -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _extends from "@babel/runtime/helpers/extends"; +import _typeof from "@babel/runtime/helpers/typeof"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -37,46 +43,44 @@ import { ajax, console, object, navigate, logger } from './../../util'; * @see EditableField.propTypes for more info of props to provide. */ export var EditableField = /*#__PURE__*/function (_React$Component) { - _inherits(EditableField, _React$Component); - var _super = _createSuper(EditableField); function EditableField(props) { - var _this; + var _this2; _classCallCheck(this, EditableField); - _this = _super.call(this, props); - _this.onResizeStateChange = _this.onResizeStateChange.bind(_assertThisInitialized(_this)); - _this.objectType = _this.objectType.bind(_assertThisInitialized(_this)); - _this.isSet = _this.isSet.bind(_assertThisInitialized(_this)); - _this.isRequired = _this.isRequired.bind(_assertThisInitialized(_this)); - _this.isValid = _this.isValid.bind(_assertThisInitialized(_this)); - _this.fieldSchema = _this.fieldSchema.bind(_assertThisInitialized(_this)); - _this.validationPattern = _this.validationPattern.bind(_assertThisInitialized(_this)); - _this.validationFeedbackMessage = _this.validationFeedbackMessage.bind(_assertThisInitialized(_this)); - _this.save = _this.save.bind(_assertThisInitialized(_this)); - _this.enterEditState = _this.enterEditState.bind(_assertThisInitialized(_this)); - _this.cancelEditState = _this.cancelEditState.bind(_assertThisInitialized(_this)); - _this.saveEditState = _this.saveEditState.bind(_assertThisInitialized(_this)); - _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this)); - _this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this)); - _this.renderActionIcon = _this.renderActionIcon.bind(_assertThisInitialized(_this)); - _this.renderSavedValue = _this.renderSavedValue.bind(_assertThisInitialized(_this)); - _this.renderSaved = _this.renderSaved.bind(_assertThisInitialized(_this)); - _this.inputField = _this.inputField.bind(_assertThisInitialized(_this)); - _this.renderEditing = _this.renderEditing.bind(_assertThisInitialized(_this)); + _this2 = _callSuper(this, EditableField, [props]); + _this2.onResizeStateChange = _this2.onResizeStateChange.bind(_this2); + _this2.objectType = _this2.objectType.bind(_this2); + _this2.isSet = _this2.isSet.bind(_this2); + _this2.isRequired = _this2.isRequired.bind(_this2); + _this2.isValid = _this2.isValid.bind(_this2); + _this2.fieldSchema = _this2.fieldSchema.bind(_this2); + _this2.validationPattern = _this2.validationPattern.bind(_this2); + _this2.validationFeedbackMessage = _this2.validationFeedbackMessage.bind(_this2); + _this2.save = _this2.save.bind(_this2); + _this2.enterEditState = _this2.enterEditState.bind(_this2); + _this2.cancelEditState = _this2.cancelEditState.bind(_this2); + _this2.saveEditState = _this2.saveEditState.bind(_this2); + _this2.handleChange = _this2.handleChange.bind(_this2); + _this2.handleKeyDown = _this2.handleKeyDown.bind(_this2); + _this2.renderActionIcon = _this2.renderActionIcon.bind(_this2); + _this2.renderSavedValue = _this2.renderSavedValue.bind(_this2); + _this2.renderSaved = _this2.renderSaved.bind(_this2); + _this2.inputField = _this2.inputField.bind(_this2); + _this2.renderEditing = _this2.renderEditing.bind(_this2); var initialValue = null; try { initialValue = object.getNestedProperty(props.context, props.labelID); // Returns undefined if doesn't exist in context } catch (e) { logger.error(e); } - _this.state = { + _this2.state = { 'value': initialValue || null, // Changes on input field change 'savedValue': initialValue || null, // Changes only on sync w/ server. 'valueExistsOnObj': typeof initialValue !== 'undefined', // If undefined then field doesn't exist on props.context - 'validationPattern': props.pattern || _this.validationPattern(), - 'required': props.required || _this.isRequired(), + 'validationPattern': props.pattern || _this2.validationPattern(), + 'required': props.required || _this2.isRequired(), 'valid': null, // Must distinguish between true, false, and null. 'serverErrors': [], @@ -92,11 +96,12 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { // Re: inline style 'selectAllDone': false }; - _this.fieldRef = /*#__PURE__*/React.createRef(); // Field container element - _this.inputElementRef = /*#__PURE__*/React.createRef(); // Input element - return _this; + _this2.fieldRef = /*#__PURE__*/React.createRef(); // Field container element + _this2.inputElementRef = /*#__PURE__*/React.createRef(); // Input element + return _this2; } - _createClass(EditableField, [{ + _inherits(EditableField, _React$Component); + return _createClass(EditableField, [{ key: "onResizeStateChange", value: function onResizeStateChange() { var fieldElem = this.fieldRef.current; @@ -239,7 +244,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { }, { key: "validationPattern", value: function validationPattern() { - var _this2 = this; + var _this3 = this; var schemas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.schemas; var _this$props = this.props, labelID = _this$props.labelID, @@ -249,9 +254,9 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { // TODO: Maybe move to util/Schemas.js // We do not handle nested, linked or embedded properties for now. if (!schemas || !labelID || labelID.indexOf('.') > -1) return null; - var fieldSchema = _this2.fieldSchema(schemas); + var fieldSchema = _this3.fieldSchema(schemas); if (!fieldSchema || typeof fieldSchema.pattern === 'undefined') return null; // No pattern set. - if (debug) console.info('Obtained EditableField validationPattern from schema (' + [_this2.objectType(), 'properties', labelID].join('.') + ')'); + if (debug) console.info('Obtained EditableField validationPattern from schema (' + [_this3.objectType(), 'properties', labelID].join('.') + ')'); return fieldSchema.pattern; }(); if (schemaDerivedPattern) return schemaDerivedPattern; @@ -310,7 +315,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { }, { key: "save", value: function save() { - var _this3 = this; + var _this4 = this; var successCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var errorCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var _this$props2 = this.props, @@ -323,7 +328,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { var errorFallback = function (res) { // ToDo display (bigger?) errors logger.error("Error: ", res); - _this3.setState({ + _this4.setState({ 'serverErrors': res.errors, 'serverErrorsMessage': res.description, 'loading': false @@ -332,7 +337,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { this.setState({ 'loading': true }, function () { - var value = _this3.state.value; + var value = _this4.state.value; if (dataType === 'int') { value = parseInt(value); } @@ -353,7 +358,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { var extendSuccess = object.deepExtend(nextContext, patchData); console.info('EditableField Extended Context', extendSuccess, nextContext); if (extendSuccess) { - _this3.setState({ + _this4.setState({ 'savedValue': value, 'value': value, 'dispatching': true @@ -362,7 +367,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { parent.setState({ 'currentlyEditing': null }, function () { - _this3.setState({ + _this4.setState({ 'loading': false, 'dispatching': false }); @@ -419,7 +424,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { }, { key: "saveEditState", value: function saveEditState(e) { - var _this4 = this; + var _this5 = this; e.preventDefault(); var _this$props3 = this.props, labelID = _this$props3.labelID, @@ -452,7 +457,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { parent.setState({ 'currentlyEditing': null }, function () { - _this4.setState({ + _this5.setState({ 'loading': false, 'dispatching': false }); @@ -463,7 +468,7 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { } else { this.save(function () { // Success callback - console.info("Saved " + _this4.props.labelID + " : " + _this4.state.savedValue); + console.info("Saved " + _this5.props.labelID + " : " + _this5.state.savedValue); }); } } @@ -800,7 +805,6 @@ export var EditableField = /*#__PURE__*/function (_React$Component) { } } }]); - return EditableField; }(React.Component); /** @@ -871,20 +875,19 @@ _defineProperty(EditableField, "defaultProps", { 'buttonAlwaysVisible': false }); export var FieldSet = /*#__PURE__*/function (_React$PureComponent) { - _inherits(FieldSet, _React$PureComponent); - var _super2 = _createSuper(FieldSet); function FieldSet(props) { - var _this5; + var _this6; _classCallCheck(this, FieldSet); - _this5 = _super2.call(this, props); - _this5.adjustedChildren = _this5.adjustedChildren.bind(_assertThisInitialized(_this5)); - _this5.fullClassName = _this5.fullClassName.bind(_assertThisInitialized(_this5)); - return _this5; + _this6 = _callSuper(this, FieldSet, [props]); + _this6.adjustedChildren = _this6.adjustedChildren.bind(_this6); + _this6.fullClassName = _this6.fullClassName.bind(_this6); + return _this6; } - _createClass(FieldSet, [{ + _inherits(FieldSet, _React$PureComponent); + return _createClass(FieldSet, [{ key: "adjustedChildren", value: function adjustedChildren() { - var _this6 = this; + var _this7 = this; var _this$props9 = this.props, children = _this$props9.children, endpoint = _this$props9.endpoint, @@ -904,7 +907,7 @@ export var FieldSet = /*#__PURE__*/function (_React$PureComponent) { if (child.type && child.type.displayName === 'EditableField') { var newProps = {}; if (!child.props.context || _.isEmpty(child.props.context)) newProps.context = context; - if (!child.props.parent) newProps.parent = parent || _this6; + if (!child.props.parent) newProps.parent = parent || _this7; if (!child.props.endpoint && endpoint) newProps.endpoint = endpoint; if (!child.props.href && href) newProps.href = href; if (!child.props.objectType && objectType) newProps.objectType = objectType; @@ -947,7 +950,6 @@ export var FieldSet = /*#__PURE__*/function (_React$PureComponent) { }, this.adjustedChildren()); } }]); - return FieldSet; }(React.PureComponent); _defineProperty(FieldSet, "propTypes", { children: PropTypes.node, diff --git a/es/components/forms/components/IndeterminateCheckbox.js b/es/components/forms/components/IndeterminateCheckbox.js index e0a4b622..65697460 100644 --- a/es/components/forms/components/IndeterminateCheckbox.js +++ b/es/components/forms/components/IndeterminateCheckbox.js @@ -1,7 +1,6 @@ +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["indeterminate"]; -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React from 'react'; export function IndeterminateCheckbox(props) { var _props$indeterminate = props.indeterminate, diff --git a/es/components/forms/components/LinkToDropdown.js b/es/components/forms/components/LinkToDropdown.js index 3bca616f..8f3e16a3 100644 --- a/es/components/forms/components/LinkToDropdown.js +++ b/es/components/forms/components/LinkToDropdown.js @@ -1,48 +1,49 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import DropdownButton from 'react-bootstrap/esm/DropdownButton'; import DropdownItem from 'react-bootstrap/esm/DropdownItem'; import { ajax, console } from './../../util'; export var LinkToDropdown = /*#__PURE__*/function (_React$PureComponent) { - _inherits(LinkToDropdown, _React$PureComponent); - var _super = _createSuper(LinkToDropdown); function LinkToDropdown(props) { - var _this; + var _this2; _classCallCheck(this, LinkToDropdown); - _this = _super.call(this, props); - _this.loadViableOptions = _this.loadViableOptions.bind(_assertThisInitialized(_this)); - _this.handleSelect = _this.handleSelect.bind(_assertThisInitialized(_this)); - _this.handleSearchTextChange = _this.handleSearchTextChange.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, LinkToDropdown, [props]); + _this2.loadViableOptions = _this2.loadViableOptions.bind(_this2); + _this2.handleSelect = _this2.handleSelect.bind(_this2); + _this2.handleSearchTextChange = _this2.handleSearchTextChange.bind(_this2); + _this2.state = { loading: true, optionResults: null, error: null, typedSearchQuery: "" }; - _this.searchCache = new Map(); - return _this; + _this2.searchCache = new Map(); + return _this2; } - _createClass(LinkToDropdown, [{ + _inherits(LinkToDropdown, _React$PureComponent); + return _createClass(LinkToDropdown, [{ key: "componentDidMount", value: function componentDidMount() { // Todo, call from componentDidUpdate if session has changed @@ -52,27 +53,27 @@ export var LinkToDropdown = /*#__PURE__*/function (_React$PureComponent) { }, { key: "loadViableOptions", value: function loadViableOptions() { - var _this2 = this; + var _this3 = this; var searchURLBase = this.props.searchURL; var requestHref = searchURLBase + "&limit=1000&" + LinkToDropdown.fieldsToRequest.map(function (field) { return "field=" + encodeURIComponent(field); }).join('&'); var cb = function (response) { if (!response || Object.keys(response).length === 0) { - _this2.setState({ + _this3.setState({ loading: false, error: "Could not get valid options, check network and try again." }); return; } if (response.total === 0) { - _this2.setState({ + _this3.setState({ loading: false, error: "No valid options found." }); return; } - _this2.setState({ + _this3.setState({ loading: false, error: null, optionResults: response['@graph'] @@ -222,7 +223,6 @@ export var LinkToDropdown = /*#__PURE__*/function (_React$PureComponent) { })) : null, renderedOptions); } }]); - return LinkToDropdown; }(React.PureComponent); _defineProperty(LinkToDropdown, "defaultProps", { 'searchURL': "/search/?type=Project", diff --git a/es/components/forms/components/LinkToSelector.js b/es/components/forms/components/LinkToSelector.js index 39f9a9ba..b6d5f7dd 100644 --- a/es/components/forms/components/LinkToSelector.js +++ b/es/components/forms/components/LinkToSelector.js @@ -1,17 +1,22 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -44,19 +49,18 @@ var linkedObjChildWindow = null; * This component does not render any of its own JSX/HTML, but will render children if any are passed in. */ export var LinkToSelector = /*#__PURE__*/function (_React$PureComponent) { - _inherits(LinkToSelector, _React$PureComponent); - var _super = _createSuper(LinkToSelector); function LinkToSelector(props) { var _this2; _classCallCheck(this, LinkToSelector); - _this2 = _super.call(this, props); - _this2.showAlertInChildWindow = _this2.showAlertInChildWindow.bind(_assertThisInitialized(_this2)); - _this2.setChildWindowMessageHandler = _this2.setChildWindowMessageHandler.bind(_assertThisInitialized(_this2)); - _this2.handleChildWindowMessage = _this2.handleChildWindowMessage.bind(_assertThisInitialized(_this2)); - _this2.receiveData = _this2.receiveData.bind(_assertThisInitialized(_this2)); + _this2 = _callSuper(this, LinkToSelector, [props]); + _this2.showAlertInChildWindow = _this2.showAlertInChildWindow.bind(_this2); + _this2.setChildWindowMessageHandler = _this2.setChildWindowMessageHandler.bind(_this2); + _this2.handleChildWindowMessage = _this2.handleChildWindowMessage.bind(_this2); + _this2.receiveData = _this2.receiveData.bind(_this2); return _this2; } - _createClass(LinkToSelector, [{ + _inherits(LinkToSelector, _React$PureComponent); + return _createClass(LinkToSelector, [{ key: "componentDidMount", value: function componentDidMount() { this.manageChildWindow({ @@ -274,7 +278,6 @@ export var LinkToSelector = /*#__PURE__*/function (_React$PureComponent) { return null; } }]); - return LinkToSelector; }(React.PureComponent); _defineProperty(LinkToSelector, "propTypes", { /** Whether component should be listening for Item to be selected */ @@ -319,21 +322,20 @@ _defineProperty(LinkToSelector, "defaultProps", { 'enableWindowDrop': true }); export var WindowDropReceiver = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(WindowDropReceiver, _React$PureComponent2); - var _super2 = _createSuper(WindowDropReceiver); function WindowDropReceiver(props) { var _this5; _classCallCheck(this, WindowDropReceiver); - _this5 = _super2.call(this, props); - _this5.handleWindowDragOver = _this5.handleWindowDragOver.bind(_assertThisInitialized(_this5)); - _this5.refreshWindowDropReceiver = _.throttle(_this5.refreshWindowDropReceiver.bind(_assertThisInitialized(_this5)), 300); - _this5.closeWindowDropReceiver = _this5.closeWindowDropReceiver.bind(_assertThisInitialized(_this5)); - _this5.handleDrop = _this5.handleDrop.bind(_assertThisInitialized(_this5)); - _this5.receiveData = _this5.receiveData.bind(_assertThisInitialized(_this5)); + _this5 = _callSuper(this, WindowDropReceiver, [props]); + _this5.handleWindowDragOver = _this5.handleWindowDragOver.bind(_this5); + _this5.refreshWindowDropReceiver = _.throttle(_this5.refreshWindowDropReceiver.bind(_this5), 300); + _this5.closeWindowDropReceiver = _this5.closeWindowDropReceiver.bind(_this5); + _this5.handleDrop = _this5.handleDrop.bind(_this5); + _this5.receiveData = _this5.receiveData.bind(_this5); _this5.windowDropReceiverHideTimeout = null; return _this5; } - _createClass(WindowDropReceiver, [{ + _inherits(WindowDropReceiver, _React$PureComponent2); + return _createClass(WindowDropReceiver, [{ key: "componentDidMount", value: function componentDidMount() { this.manageWindowOnDragHandler({ @@ -474,7 +476,6 @@ export var WindowDropReceiver = /*#__PURE__*/function (_React$PureComponent2) { return null; } }]); - return WindowDropReceiver; }(React.PureComponent); _defineProperty(WindowDropReceiver, "propTypes", { /** Whether component should be listening for Item to be selected */ diff --git a/es/components/forms/components/SearchAsYouTypeAjax.js b/es/components/forms/components/SearchAsYouTypeAjax.js index 5c7a6983..a3464090 100644 --- a/es/components/forms/components/SearchAsYouTypeAjax.js +++ b/es/components/forms/components/SearchAsYouTypeAjax.js @@ -1,29 +1,28 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _extends from "@babel/runtime/helpers/extends"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; var _excluded = ["optionsHeader", "value", "keyComplete"]; -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -34,29 +33,28 @@ import { Alerts } from './../../ui/Alerts'; import { LinkToSelector } from './LinkToSelector'; import { SearchSelectionMenu } from './SearchSelectionMenu'; export var SearchAsYouTypeAjax = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SearchAsYouTypeAjax, _React$PureComponent); - var _super = _createSuper(SearchAsYouTypeAjax); function SearchAsYouTypeAjax(props) { - var _this; + var _this2; _classCallCheck(this, SearchAsYouTypeAjax); - _this = _super.call(this, props); - _this.state = { + _this2 = _callSuper(this, SearchAsYouTypeAjax, [props]); + _this2.state = { results: [], currentTextValue: props.value || "", loading: true, // starts out by loading base RequestURL error: null }; - _this.currentRequest = null; - _this.hasBeenOpened = false; - _this.onLoadData = _.debounce(_this.onLoadData.bind(_assertThisInitialized(_this)), 500, false); - _this.constructFetchURL = _this.constructFetchURL.bind(_assertThisInitialized(_this)); - _this.onTextInputChange = _this.onTextInputChange.bind(_assertThisInitialized(_this)); - _this.onDropdownSelect = _this.onDropdownSelect.bind(_assertThisInitialized(_this)); - _this.onToggleOpen = _this.onToggleOpen.bind(_assertThisInitialized(_this)); - return _this; + _this2.currentRequest = null; + _this2.hasBeenOpened = false; + _this2.onLoadData = _.debounce(_this2.onLoadData.bind(_this2), 500, false); + _this2.constructFetchURL = _this2.constructFetchURL.bind(_this2); + _this2.onTextInputChange = _this2.onTextInputChange.bind(_this2); + _this2.onDropdownSelect = _this2.onDropdownSelect.bind(_this2); + _this2.onToggleOpen = _this2.onToggleOpen.bind(_this2); + return _this2; } - _createClass(SearchAsYouTypeAjax, [{ + _inherits(SearchAsYouTypeAjax, _React$PureComponent); + return _createClass(SearchAsYouTypeAjax, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps, pastState) { var pastSelectedID = pastProps.value; @@ -109,29 +107,29 @@ export var SearchAsYouTypeAjax = /*#__PURE__*/function (_React$PureComponent) { }, { key: "onLoadData", value: function onLoadData() { - var _this2 = this; + var _this3 = this; this.setState({ loading: true }, function () { - if (_this2.currentRequest) { + if (_this3.currentRequest) { // if there's already a request running, abort it - _this2.currentRequest.abort && _this2.currentRequest.abort(); + _this3.currentRequest.abort && _this3.currentRequest.abort(); } - var requestInThisScope = _this2.currentRequest = ajax.load(_this2.constructFetchURL(), function (response) { - if (requestInThisScope !== _this2.currentRequest) { + var requestInThisScope = _this3.currentRequest = ajax.load(_this3.constructFetchURL(), function (response) { + if (requestInThisScope !== _this3.currentRequest) { return false; // some other request has been fired; cancel this one } - _this2.currentRequest = null; + _this3.currentRequest = null; if (!response || Object.keys(response).length === 0) { - _this2.setState({ + _this3.setState({ loading: false, results: [], error: "Could not get a response from server. Check network and try again." }); return; } - _this2.setState({ + _this3.setState({ loading: false, results: response['@graph'], error: null @@ -145,10 +143,10 @@ export var SearchAsYouTypeAjax = /*#__PURE__*/function (_React$PureComponent) { error = _response$error === void 0 ? null : _response$error; var status = xhr.status, statusText = xhr.statusText; - _this2.currentRequest = null; + _this3.currentRequest = null; if (graph.length === 0) { // handle case in which no results found - _this2.setState({ + _this3.setState({ loading: false, results: results, error: null @@ -156,7 +154,7 @@ export var SearchAsYouTypeAjax = /*#__PURE__*/function (_React$PureComponent) { } else if (error) { // handle more general errors (should we display the actual error message to users?) logger.error("Status code " + status + " encountered. " + statusText); - _this2.setState({ + _this3.setState({ loading: false, results: results, error: error || "Something went wrong while handling this request." @@ -241,7 +239,6 @@ export var SearchAsYouTypeAjax = /*#__PURE__*/function (_React$PureComponent) { })); } }]); - return SearchAsYouTypeAjax; }(React.PureComponent); SearchAsYouTypeAjax.propTypes = { "value": PropTypes.any, @@ -497,25 +494,24 @@ export var optionCustomizationsByType = { /** Case for a linked object. */ export var LinkedObj = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(LinkedObj, _React$PureComponent2); - var _super2 = _createSuper(LinkedObj); function LinkedObj(props) { - var _this3; + var _this4; _classCallCheck(this, LinkedObj); - _this3 = _super2.call(this, props); - _this3.setSubmissionStateToLinkedToItem = _this3.setSubmissionStateToLinkedToItem.bind(_assertThisInitialized(_this3)); - _this3.handleStartSelectItem = _this3.handleStartSelectItem.bind(_assertThisInitialized(_this3)); - _this3.handleFinishSelectItem = _this3.handleFinishSelectItem.bind(_assertThisInitialized(_this3)); - _this3.handleCreateNewItemClick = _this3.handleCreateNewItemClick.bind(_assertThisInitialized(_this3)); - _this3.handleTextInputChange = _this3.handleTextInputChange.bind(_assertThisInitialized(_this3)); - _this3.handleAcceptTypedID = _this3.handleAcceptTypedID.bind(_assertThisInitialized(_this3)); - _this3.childWindowAlert = _this3.childWindowAlert.bind(_assertThisInitialized(_this3)); - _this3.state = { + _this4 = _callSuper(this, LinkedObj, [props]); + _this4.setSubmissionStateToLinkedToItem = _this4.setSubmissionStateToLinkedToItem.bind(_this4); + _this4.handleStartSelectItem = _this4.handleStartSelectItem.bind(_this4); + _this4.handleFinishSelectItem = _this4.handleFinishSelectItem.bind(_this4); + _this4.handleCreateNewItemClick = _this4.handleCreateNewItemClick.bind(_this4); + _this4.handleTextInputChange = _this4.handleTextInputChange.bind(_this4); + _this4.handleAcceptTypedID = _this4.handleAcceptTypedID.bind(_this4); + _this4.childWindowAlert = _this4.childWindowAlert.bind(_this4); + _this4.state = { 'textInputValue': typeof props.value === 'string' && props.value || '' }; - return _this3; + return _this4; } - _createClass(LinkedObj, [{ + _inherits(LinkedObj, _React$PureComponent2); + return _createClass(LinkedObj, [{ key: "componentDidUpdate", value: function componentDidUpdate() { ReactTooltip.rebuild(); @@ -783,7 +779,6 @@ export var LinkedObj = /*#__PURE__*/function (_React$PureComponent2) { return false; } }]); - return LinkedObj; }(React.PureComponent); export var SquareButton = /*#__PURE__*/React.memo(function (props) { var show = props.show, diff --git a/es/components/forms/components/SearchAsYouTypeLocal.js b/es/components/forms/components/SearchAsYouTypeLocal.js index ab633213..e94b3d33 100644 --- a/es/components/forms/components/SearchAsYouTypeLocal.js +++ b/es/components/forms/components/SearchAsYouTypeLocal.js @@ -1,43 +1,46 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; var _excluded = ["searchList", "filterMethod", "optionsHeader", "allowCustomValue", "customFilterFunction"]; -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import memoize from 'memoize-one'; import { SearchSelectionMenu } from './SearchSelectionMenu'; import { valueTransforms } from './../../util'; export var SearchAsYouTypeLocal = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SearchAsYouTypeLocal, _React$PureComponent); - var _super = _createSuper(SearchAsYouTypeLocal); function SearchAsYouTypeLocal(props) { - var _this; + var _this2; _classCallCheck(this, SearchAsYouTypeLocal); - _this = _super.call(this, props); - _this.onTextInputChange = _this.onTextInputChange.bind(_assertThisInitialized(_this)); - _this.onDropdownSelect = _this.onDropdownSelect.bind(_assertThisInitialized(_this)); - _this.state = { + _this2 = _callSuper(this, SearchAsYouTypeLocal, [props]); + _this2.onTextInputChange = _this2.onTextInputChange.bind(_this2); + _this2.onDropdownSelect = _this2.onDropdownSelect.bind(_this2); + _this2.state = { currentTextValue: props.initializeWithValue ? props.value || "" : "" }; - _this.memoized = { + _this2.memoized = { filterOptions: memoize(SearchAsYouTypeLocal.filterOptions) }; - return _this; + return _this2; } - _createClass(SearchAsYouTypeLocal, [{ + _inherits(SearchAsYouTypeLocal, _React$PureComponent); + return _createClass(SearchAsYouTypeLocal, [{ key: "onTextInputChange", value: function onTextInputChange(evt) { var _this$props = this.props, @@ -126,7 +129,6 @@ export var SearchAsYouTypeLocal = /*#__PURE__*/function (_React$PureComponent) { }); } }]); - return SearchAsYouTypeLocal; }(React.PureComponent); SearchAsYouTypeLocal.propTypes = { searchList: PropTypes.arrayOf(PropTypes.string).isRequired, diff --git a/es/components/forms/components/SearchSelectionMenu.js b/es/components/forms/components/SearchSelectionMenu.js index 66ea516a..0e07e7a8 100644 --- a/es/components/forms/components/SearchSelectionMenu.js +++ b/es/components/forms/components/SearchSelectionMenu.js @@ -1,39 +1,43 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; // import PropTypes from 'prop-types'; import Dropdown from 'react-bootstrap/esm/Dropdown'; import { VerticalScrollContainer } from './VerticalScrollContainer'; export var SearchSelectionMenu = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SearchSelectionMenu, _React$PureComponent); - var _super = _createSuper(SearchSelectionMenu); function SearchSelectionMenu(props) { - var _this; + var _this2; _classCallCheck(this, SearchSelectionMenu); - _this = _super.call(this, props); - _this.state = { + _this2 = _callSuper(this, SearchSelectionMenu, [props]); + _this2.state = { dropOpen: false, refreshKey: 0 // incremented to force a refresh of dropdown }; - _this.dropdown = /*#__PURE__*/React.createRef(); - _this.onToggleOpen = _this.onToggleOpen.bind(_assertThisInitialized(_this)); - _this.onKeyDown = _this.onKeyDown.bind(_assertThisInitialized(_this)); - return _this; + _this2.dropdown = /*#__PURE__*/React.createRef(); + _this2.onToggleOpen = _this2.onToggleOpen.bind(_this2); + _this2.onKeyDown = _this2.onKeyDown.bind(_this2); + return _this2; } - _createClass(SearchSelectionMenu, [{ + _inherits(SearchSelectionMenu, _React$PureComponent); + return _createClass(SearchSelectionMenu, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _prevProps$options = prevProps.options, @@ -63,15 +67,15 @@ export var SearchSelectionMenu = /*#__PURE__*/function (_React$PureComponent) { }, { key: "onToggleOpen", value: function onToggleOpen() { - var _this2 = this; + var _this3 = this; this.setState(function (_ref) { var dropOpen = _ref.dropOpen; return { dropOpen: !dropOpen }; }, function () { - var onToggleOpen = _this2.props.onToggleOpen; - var dropOpen = _this2.state.dropOpen; + var onToggleOpen = _this3.props.onToggleOpen; + var dropOpen = _this3.state.dropOpen; if (typeof onToggleOpen === "function") { onToggleOpen(dropOpen); } @@ -105,7 +109,6 @@ export var SearchSelectionMenu = /*#__PURE__*/function (_React$PureComponent) { }, { key: "render", value: function render() { - var _React$createElement; var _this$props2 = this.props, _this$props2$currentT = _this$props2.currentTextValue, currentTextValue = _this$props2$currentT === void 0 ? "" : _this$props2$currentT, @@ -140,7 +143,7 @@ export var SearchSelectionMenu = /*#__PURE__*/function (_React$PureComponent) { }, /*#__PURE__*/React.createElement(Dropdown.Toggle, { variant: variant, "data-tip": showTips ? value : null - }, showValue), /*#__PURE__*/React.createElement(Dropdown.Menu, (_React$createElement = { + }, showValue), /*#__PURE__*/React.createElement(Dropdown.Menu, _defineProperty(_defineProperty(_defineProperty(_defineProperty({ key: refreshKey, as: SearchSelectionMenuBody, onTextInputChange: onTextInputChange, @@ -152,7 +155,7 @@ export var SearchSelectionMenu = /*#__PURE__*/function (_React$PureComponent) { } /* Style margin:0 is short term workaround to popperJS warning, see: https://github.com/react-bootstrap/react-bootstrap/issues/6017 */, flip: true, show: dropOpen - }, _defineProperty(_React$createElement, "onTextInputChange", onTextInputChange), _defineProperty(_React$createElement, "toggleOpen", this.onToggleOpen), _defineProperty(_React$createElement, "ref", this.dropdown), _defineProperty(_React$createElement, "onKeyDown", this.onKeyDown), _React$createElement), options.map(function (option, idx) { + }, "onTextInputChange", onTextInputChange), "toggleOpen", this.onToggleOpen), "ref", this.dropdown), "onKeyDown", this.onKeyDown), options.map(function (option, idx) { var renderedOption = typeof optionRenderFunction === "function" ? optionRenderFunction(option) : option; return /*#__PURE__*/React.createElement(Dropdown.Item, { "data-index": idx, @@ -169,7 +172,6 @@ export var SearchSelectionMenu = /*#__PURE__*/function (_React$PureComponent) { }))); } }]); - return SearchSelectionMenu; }(React.PureComponent); _defineProperty(SearchSelectionMenu, "defaultProps", { titleRenderFunction: function titleRenderFunction(option) { diff --git a/es/components/forms/components/SubmissionTree.js b/es/components/forms/components/SubmissionTree.js index 27105171..1797f821 100644 --- a/es/components/forms/components/SubmissionTree.js +++ b/es/components/forms/components/SubmissionTree.js @@ -1,27 +1,27 @@ +import _typeof from "@babel/runtime/helpers/typeof"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["keyIdx"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -31,13 +31,12 @@ import Collapse from 'react-bootstrap/esm/Collapse'; // Create a custom tree to represent object hierarchy in front end submission. // Each leaf is clickable and will bring you to a view of the new object export var SubmissionTree = /*#__PURE__*/function (_React$PureComponent) { - _inherits(SubmissionTree, _React$PureComponent); - var _super = _createSuper(SubmissionTree); function SubmissionTree() { _classCallCheck(this, SubmissionTree); - return _super.apply(this, arguments); + return _callSuper(this, SubmissionTree, arguments); } - _createClass(SubmissionTree, [{ + _inherits(SubmissionTree, _React$PureComponent); + return _createClass(SubmissionTree, [{ key: "componentDidMount", value: function componentDidMount() { ReactTooltip.rebuild(); @@ -58,7 +57,6 @@ export var SubmissionTree = /*#__PURE__*/function (_React$PureComponent) { }))); } }]); - return SubmissionTree; }(React.PureComponent); /* @@ -79,24 +77,23 @@ _defineProperty(SubmissionTree, "propTypes", { 'schemas': PropTypes.object }); var SubmissionLeaf = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(SubmissionLeaf, _React$PureComponent2); - var _super2 = _createSuper(SubmissionLeaf); function SubmissionLeaf(props) { - var _this; + var _this2; _classCallCheck(this, SubmissionLeaf); - _this = _super2.call(this, props); - _this.handleClick = _.throttle(_this.handleClick.bind(_assertThisInitialized(_this)), 500, { + _this2 = _callSuper(this, SubmissionLeaf, [props]); + _this2.handleClick = _.throttle(_this2.handleClick.bind(_this2), 500, { 'trailing': false }); - _this.generateAllPlaceholders = _this.generateAllPlaceholders.bind(_assertThisInitialized(_this)); - _this.placeholderSortFxn = _this.placeholderSortFxn.bind(_assertThisInitialized(_this)); - _this.generateChild = _this.generateChild.bind(_assertThisInitialized(_this)); - _this.state = { + _this2.generateAllPlaceholders = _this2.generateAllPlaceholders.bind(_this2); + _this2.placeholderSortFxn = _this2.placeholderSortFxn.bind(_this2); + _this2.generateChild = _this2.generateChild.bind(_this2); + _this2.state = { 'open': typeof props.open === 'boolean' ? props.open : true }; - return _this; + return _this2; } - _createClass(SubmissionLeaf, [{ + _inherits(SubmissionLeaf, _React$PureComponent2); + return _createClass(SubmissionLeaf, [{ key: "generateChild", value: function generateChild(childKey) { if (!isNaN(childKey)) childKey = parseInt(childKey); @@ -152,13 +149,13 @@ var SubmissionLeaf = /*#__PURE__*/function (_React$PureComponent2) { }, { key: "generateAllPlaceholders", value: function generateAllPlaceholders() { - var _this2 = this; + var _this3 = this; var _this$props4 = this.props, keyIdx = _this$props4.keyIdx, keyLinkBookmarks = _this$props4.keyLinkBookmarks; var fieldsWithLinkTosToShow = keyLinkBookmarks[keyIdx].sort(this.placeholderSortFxn); return _.map(fieldsWithLinkTosToShow, function (field) { - return /*#__PURE__*/React.createElement(SubmissionProperty, _extends({}, _this2.props, { + return /*#__PURE__*/React.createElement(SubmissionProperty, _extends({}, _this3.props, { field: field, key: field })); @@ -279,28 +276,26 @@ var SubmissionLeaf = /*#__PURE__*/function (_React$PureComponent2) { }, placeholders) : null); } }]); - return SubmissionLeaf; }(React.PureComponent); _defineProperty(SubmissionLeaf, "defaultProps", { 'depth': 0 }); var SubmissionProperty = /*#__PURE__*/function (_React$Component) { - _inherits(SubmissionProperty, _React$Component); - var _super3 = _createSuper(SubmissionProperty); function SubmissionProperty(props) { - var _this3; + var _this4; _classCallCheck(this, SubmissionProperty); - _this3 = _super3.call(this, props); - _this3.handleToggle = _.throttle(_this3.handleToggle.bind(_assertThisInitialized(_this3)), 500, { + _this4 = _callSuper(this, SubmissionProperty, [props]); + _this4.handleToggle = _.throttle(_this4.handleToggle.bind(_this4), 500, { 'trailing': false }); - _this3.generateChild = _this3.generateChild.bind(_assertThisInitialized(_this3)); - _this3.state = { + _this4.generateChild = _this4.generateChild.bind(_this4); + _this4.state = { 'open': typeof props.open === 'boolean' ? props.open : true }; - return _this3; + return _this4; } - _createClass(SubmissionProperty, [{ + _inherits(SubmissionProperty, _React$Component); + return _createClass(SubmissionProperty, [{ key: "handleToggle", value: function handleToggle(e) { e.preventDefault(); @@ -371,7 +366,6 @@ var SubmissionProperty = /*#__PURE__*/function (_React$Component) { }, children)) : null); } }]); - return SubmissionProperty; }(React.Component); function InfoIcon(_ref2) { var children = _ref2.children, diff --git a/es/components/forms/components/Toggle.js b/es/components/forms/components/Toggle.js index 4e797f0b..633a10a8 100644 --- a/es/components/forms/components/Toggle.js +++ b/es/components/forms/components/Toggle.js @@ -1,7 +1,6 @@ +import _extends from "@babel/runtime/helpers/extends"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["className", "id", "disabled"]; -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React from 'react'; import _ from 'underscore'; import { randomId } from './../../util/object'; diff --git a/es/components/forms/components/VerticalScrollContainer.js b/es/components/forms/components/VerticalScrollContainer.js index 2bd930f4..04e5d3d0 100644 --- a/es/components/forms/components/VerticalScrollContainer.js +++ b/es/components/forms/components/VerticalScrollContainer.js @@ -1,17 +1,22 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import { debounce } from 'underscore'; @@ -26,35 +31,34 @@ This component is used by: - SearchSelectionMenu.js */ export var VerticalScrollContainer = /*#__PURE__*/function (_React$PureComponent) { - _inherits(VerticalScrollContainer, _React$PureComponent); - var _super = _createSuper(VerticalScrollContainer); function VerticalScrollContainer(props) { - var _this; + var _this2; _classCallCheck(this, VerticalScrollContainer); - _this = _super.call(this, props); - _this.state = { + _this2 = _callSuper(this, VerticalScrollContainer, [props]); + _this2.state = { hasOverflow: false, canScrollUp: false, canScrollDown: false, scrollingDirection: null }; - _this.scrollContainer = /*#__PURE__*/React.createRef(); - _this.onMouseDownJumpToTop = _this.onMouseDownJumpToTop.bind(_assertThisInitialized(_this)); - _this.onMouseDownJumpToBottom = _this.onMouseDownJumpToBottom.bind(_assertThisInitialized(_this)); - _this.onMouseOverScrollDown = _this.onMouseOverScrollDown.bind(_assertThisInitialized(_this)); - _this.onMouseOverScrollUp = _this.onMouseOverScrollUp.bind(_assertThisInitialized(_this)); - _this.onMouseUp = _this.onMouseUp.bind(_assertThisInitialized(_this)); - _this.performScrollAction = _this.performScrollAction.bind(_assertThisInitialized(_this)); - _this.performJumpToAction = _this.performJumpToAction.bind(_assertThisInitialized(_this)); - _this.checkForOverflow = _this.checkForOverflow.bind(_assertThisInitialized(_this)); - _this.checkForScrollPosition = _this.checkForScrollPosition.bind(_assertThisInitialized(_this)); - _this.checkArrowKeyScrollPosition = _this.checkArrowKeyScrollPosition.bind(_assertThisInitialized(_this)); - _this.debounceCheckforOverflow = debounce(_this.checkForOverflow, 500, true); - _this.debounceCheckForScrollPosition = debounce(_this.checkForScrollPosition, 100, false); - _this.debounceCheckForScrollPositionImmediate = debounce(_this.checkForScrollPosition, 100, true); - return _this; + _this2.scrollContainer = /*#__PURE__*/React.createRef(); + _this2.onMouseDownJumpToTop = _this2.onMouseDownJumpToTop.bind(_this2); + _this2.onMouseDownJumpToBottom = _this2.onMouseDownJumpToBottom.bind(_this2); + _this2.onMouseOverScrollDown = _this2.onMouseOverScrollDown.bind(_this2); + _this2.onMouseOverScrollUp = _this2.onMouseOverScrollUp.bind(_this2); + _this2.onMouseUp = _this2.onMouseUp.bind(_this2); + _this2.performScrollAction = _this2.performScrollAction.bind(_this2); + _this2.performJumpToAction = _this2.performJumpToAction.bind(_this2); + _this2.checkForOverflow = _this2.checkForOverflow.bind(_this2); + _this2.checkForScrollPosition = _this2.checkForScrollPosition.bind(_this2); + _this2.checkArrowKeyScrollPosition = _this2.checkArrowKeyScrollPosition.bind(_this2); + _this2.debounceCheckforOverflow = debounce(_this2.checkForOverflow, 500, true); + _this2.debounceCheckForScrollPosition = debounce(_this2.checkForScrollPosition, 100, false); + _this2.debounceCheckForScrollPositionImmediate = debounce(_this2.checkForScrollPosition, 100, true); + return _this2; } - _createClass(VerticalScrollContainer, [{ + _inherits(VerticalScrollContainer, _React$PureComponent); + return _createClass(VerticalScrollContainer, [{ key: "componentDidMount", value: function componentDidMount() { this.checkForOverflow(); @@ -131,41 +135,41 @@ export var VerticalScrollContainer = /*#__PURE__*/function (_React$PureComponent }, { key: "onMouseOverScrollUp", value: function onMouseOverScrollUp() { - var _this2 = this; + var _this3 = this; this.setState({ scrollingDirection: -1 }, function () { - raf(_this2.performScrollAction); + raf(_this3.performScrollAction); }); } }, { key: "onMouseDownJumpToTop", value: function onMouseDownJumpToTop() { - var _this3 = this; + var _this4 = this; this.setState({ scrollingDirection: -1 }, function () { - raf(_this3.performJumpToAction); + raf(_this4.performJumpToAction); }); } }, { key: "onMouseOverScrollDown", value: function onMouseOverScrollDown() { - var _this4 = this; + var _this5 = this; this.setState({ scrollingDirection: 1 }, function () { - raf(_this4.performScrollAction); + raf(_this5.performScrollAction); }); } }, { key: "onMouseDownJumpToBottom", value: function onMouseDownJumpToBottom() { - var _this5 = this; + var _this6 = this; this.setState({ scrollingDirection: 1 }, function () { - raf(_this5.performJumpToAction); + raf(_this6.performJumpToAction); }); } }, { @@ -255,7 +259,6 @@ export var VerticalScrollContainer = /*#__PURE__*/function (_React$PureComponent })))); } }]); - return VerticalScrollContainer; }(React.PureComponent); _defineProperty(VerticalScrollContainer, "defaultProps", { 'scrollRate': 40 diff --git a/es/components/forms/components/submission-fields.js b/es/components/forms/components/submission-fields.js index e769d502..a991c2c0 100644 --- a/es/components/forms/components/submission-fields.js +++ b/es/components/forms/components/submission-fields.js @@ -1,24 +1,25 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _typeof from "@babel/runtime/helpers/typeof"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _extends from "@babel/runtime/helpers/extends"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -43,20 +44,19 @@ import { Alerts } from './../../ui/Alerts'; * @todo Possibly rename both this class and the containing file to be `SubmissionViewField` or `SubmissionField`. */ export var BuildField = /*#__PURE__*/function (_React$PureComponent) { - _inherits(BuildField, _React$PureComponent); - var _super = _createSuper(BuildField); function BuildField(props) { - var _this; + var _this2; _classCallCheck(this, BuildField); - _this = _super.call(this, props); - _.bindAll(_assertThisInitialized(_this), 'displayField', 'handleDropdownButtonToggle', 'handleAliasChange', 'handleEnumChange', 'buildSuggestedEnumEntry', 'submitSuggestedEnumVal', 'handleChange', 'handleAliasChange', 'deleteField', 'pushArrayValue', 'commonRowProps', 'labelTypeDescriptor', 'wrapWithLabel', 'wrapWithNoLabel'); - _this.state = { + _this2 = _callSuper(this, BuildField, [props]); + _.bindAll(_this2, 'displayField', 'handleDropdownButtonToggle', 'handleAliasChange', 'handleEnumChange', 'buildSuggestedEnumEntry', 'submitSuggestedEnumVal', 'handleChange', 'handleAliasChange', 'deleteField', 'pushArrayValue', 'commonRowProps', 'labelTypeDescriptor', 'wrapWithLabel', 'wrapWithNoLabel'); + _this2.state = { 'dropdownOpen': false }; - _this.inputElementRef = /*#__PURE__*/React.createRef(); - return _this; + _this2.inputElementRef = /*#__PURE__*/React.createRef(); + return _this2; } - _createClass(BuildField, [{ + _inherits(BuildField, _React$PureComponent); + return _createClass(BuildField, [{ key: "componentDidMount", value: function componentDidMount() { ReactTooltip.rebuild(); @@ -563,7 +563,6 @@ export var BuildField = /*#__PURE__*/function (_React$PureComponent) { return fieldType; } }]); - return BuildField; }(React.PureComponent); //var linkedObjChildWindow = null; // Global var @@ -606,20 +605,19 @@ var PreviewField = /*#__PURE__*/React.memo(function (props) { * unique to ArrayField, since it needs to update the arrayIdx */ var ArrayField = /*#__PURE__*/function (_React$Component) { - _inherits(ArrayField, _React$Component); - var _super2 = _createSuper(ArrayField); function ArrayField(props) { - var _this2; + var _this3; _classCallCheck(this, ArrayField); - _this2 = _super2.call(this, props); - _.bindAll(_assertThisInitialized(_this2), 'initiateArrayField', 'generateAddButton'); - return _this2; + _this3 = _callSuper(this, ArrayField, [props]); + _.bindAll(_this3, 'initiateArrayField', 'generateAddButton'); + return _this3; } /** * If empty array, add initial 'null' element. On Mount & Update. */ - _createClass(ArrayField, [{ + _inherits(ArrayField, _React$Component); + return _createClass(ArrayField, [{ key: "componentDidMount", value: function componentDidMount() { var _this$props11 = this.props, @@ -775,23 +773,20 @@ var ArrayField = /*#__PURE__*/function (_React$Component) { return false; } }]); - return ArrayField; }(React.Component); /** * Builds a field that represents a sub-object. Essentially serves to hold * and coordinate BuildFields that correspond to the fields within the subfield. */ var ObjectField = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(ObjectField, _React$PureComponent2); - var _super3 = _createSuper(ObjectField); function ObjectField() { - var _this3; + var _this4; _classCallCheck(this, ObjectField); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - _this3 = _super3.call.apply(_super3, [this].concat(args)); - _defineProperty(_assertThisInitialized(_this3), "includeField", function (schema, field) { + _this4 = _callSuper(this, ObjectField, [].concat(args)); + _defineProperty(_this4, "includeField", function (schema, field) { if (!schema) return null; var schemaVal = object.getNestedProperty(schema, ['properties', field], true); if (!schemaVal) return null; @@ -812,9 +807,10 @@ var ObjectField = /*#__PURE__*/function (_React$PureComponent2) { } return schemaVal; }); - return _this3; + return _this4; } - _createClass(ObjectField, [{ + _inherits(ObjectField, _React$PureComponent2); + return _createClass(ObjectField, [{ key: "componentDidMount", value: function componentDidMount() { var _this$props16 = this.props, @@ -838,7 +834,7 @@ var ObjectField = /*#__PURE__*/function (_React$PureComponent2) { }, { key: "render", value: function render() { - var _this4 = this; + var _this5 = this; var _this$props17 = this.props, objectSchema = _this$props17.schema, parentObject = _this$props17.value, @@ -847,7 +843,7 @@ var ObjectField = /*#__PURE__*/function (_React$PureComponent2) { var allFieldsInSchema = objectSchema['properties'] ? _.keys(objectSchema['properties']) : []; var fieldsToBuild = _.filter(_.map(allFieldsInSchema, function (f) { // List of [field, fieldSchema] pairs. - var fieldSchemaToUseOrNull = _this4.includeField(objectSchema, f); + var fieldSchemaToUseOrNull = _this5.includeField(objectSchema, f); return fieldSchemaToUseOrNull && [f, fieldSchemaToUseOrNull] || null; })); var passProps = _.pick(this.props, 'modifyNewContext', 'linkType', 'setSubmissionState', 'selectObj', 'selectComplete', 'selectCancel', 'arrayIdx', 'keyDisplay', 'keyComplete', 'currType', 'updateUpload', 'upload', 'uploadStatus', 'md5Progress', 'fieldBeingSelected', 'fieldBeingSelectedArrayIdx'); @@ -898,7 +894,6 @@ var ObjectField = /*#__PURE__*/function (_React$PureComponent2) { }, builtFields); } }]); - return ObjectField; }(React.PureComponent); /** * For version 1. A simple local file upload that gets the name, type, @@ -906,16 +901,15 @@ var ObjectField = /*#__PURE__*/function (_React$PureComponent2) { * upload, adds this information to NewContext */ var AttachmentInput = /*#__PURE__*/function (_React$Component2) { - _inherits(AttachmentInput, _React$Component2); - var _super4 = _createSuper(AttachmentInput); function AttachmentInput(props) { - var _this5; + var _this6; _classCallCheck(this, AttachmentInput); - _this5 = _super4.call(this, props); - _this5.handleChange = _this5.handleChange.bind(_assertThisInitialized(_this5)); - return _this5; + _this6 = _callSuper(this, AttachmentInput, [props]); + _this6.handleChange = _this6.handleChange.bind(_this6); + return _this6; } - _createClass(AttachmentInput, [{ + _inherits(AttachmentInput, _React$Component2); + return _createClass(AttachmentInput, [{ key: "acceptedTypes", value: function acceptedTypes() { var schema = this.props.schema; @@ -992,7 +986,6 @@ var AttachmentInput = /*#__PURE__*/function (_React$Component2) { }, attach_title))); } }]); - return AttachmentInput; }(React.Component); /** * Input for an s3 file upload. Context value set is local value of the filename. @@ -1000,22 +993,21 @@ var AttachmentInput = /*#__PURE__*/function (_React$Component2) { * async using the upload_manager passed down in props. */ var S3FileInput = /*#__PURE__*/function (_React$Component3) { - _inherits(S3FileInput, _React$Component3); - var _super5 = _createSuper(S3FileInput); function S3FileInput(props) { - var _this6; + var _this7; _classCallCheck(this, S3FileInput); - _this6 = _super5.call(this, props); - _.bindAll(_assertThisInitialized(_this6), 'modifyFile', 'handleChange', 'handleAsyncUpload', 'modifyRunningUploads', 'cancelUpload', 'deleteField'); - _this6.state = { + _this7 = _callSuper(this, S3FileInput, [props]); + _.bindAll(_this7, 'modifyFile', 'handleChange', 'handleAsyncUpload', 'modifyRunningUploads', 'cancelUpload', 'deleteField'); + _this7.state = { 'percentDone': null, 'sizeUploaded': null, 'newFile': false, 'status': null }; - return _this6; + return _this7; } - _createClass(S3FileInput, [{ + _inherits(S3FileInput, _React$Component3); + return _createClass(S3FileInput, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps) { var _this$props19 = this.props, @@ -1056,7 +1048,7 @@ var S3FileInput = /*#__PURE__*/function (_React$Component3) { }, { key: "handleChange", value: function handleChange(e) { - var _this7 = this; + var _this8 = this; var _this$props20 = this.props, modifyNewContext = _this$props20.modifyNewContext, nestedField = _this$props20.nestedField, @@ -1089,7 +1081,7 @@ var S3FileInput = /*#__PURE__*/function (_React$Component3) { } modifyNewContext(nestedField, filename, 'file upload', linkType, arrayIdx); // calling modifyFile changes the 'file' state of top level component - _this7.modifyFile(file); + _this8.modifyFile(file); } else { alert('Internal file extension conflict.'); } @@ -1103,22 +1095,22 @@ var S3FileInput = /*#__PURE__*/function (_React$Component3) { }, { key: "handleAsyncUpload", value: function handleAsyncUpload(upload_manager) { - var _this8 = this; + var _this9 = this; if (upload_manager === null) { return; } upload_manager.on('httpUploadProgress', function (evt) { var percentage = Math.round(evt.loaded * 100 / evt.total); - _this8.modifyRunningUploads(percentage, evt.total); + _this9.modifyRunningUploads(percentage, evt.total); }).send(function (err) { if (err) { - _this8.modifyRunningUploads(null, null); - _this8.props.updateUpload(null, false, true); + _this9.modifyRunningUploads(null, null); + _this9.props.updateUpload(null, false, true); alert("File upload failed!"); } else { - _this8.modifyRunningUploads(null, null); + _this9.modifyRunningUploads(null, null); // this will finish roundTwo for the file - _this8.props.updateUpload(null, true); + _this9.props.updateUpload(null, true); } }); } @@ -1259,7 +1251,6 @@ var S3FileInput = /*#__PURE__*/function (_React$Component3) { }))) : null); } }]); - return S3FileInput; }(React.Component); /** * Accepts a 'value' prop (which should contain a colon, at minimum) and present two fields for modifying its two parts. @@ -1269,16 +1260,15 @@ var S3FileInput = /*#__PURE__*/function (_React$Component3) { * On change of either inputs, calls 'onAliasChange' function callback, passing the new modified value (including colon) as parameter. */ export var AliasInputField = /*#__PURE__*/function (_React$Component4) { - _inherits(AliasInputField, _React$Component4); - var _super6 = _createSuper(AliasInputField); function AliasInputField(props) { - var _this9; + var _this10; _classCallCheck(this, AliasInputField); - _this9 = _super6.call(this, props); - _.bindAll(_assertThisInitialized(_this9), 'onAliasSecondPartChange', 'onAliasFirstPartChange', 'onAliasFirstPartChangeTyped', 'getInitialSubmitsForPart', 'finalizeAliasPartsChange'); - return _this9; + _this10 = _callSuper(this, AliasInputField, [props]); + _.bindAll(_this10, 'onAliasSecondPartChange', 'onAliasFirstPartChange', 'onAliasFirstPartChangeTyped', 'getInitialSubmitsForPart', 'finalizeAliasPartsChange'); + return _this10; } - _createClass(AliasInputField, [{ + _inherits(AliasInputField, _React$Component4); + return _createClass(AliasInputField, [{ key: "getInitialSubmitsForPart", value: function getInitialSubmitsForPart() { var currentSubmittingUser = this.props.currentSubmittingUser; @@ -1437,7 +1427,6 @@ export var AliasInputField = /*#__PURE__*/function (_React$Component4) { return parts; } }]); - return AliasInputField; }(React.Component); _defineProperty(AliasInputField, "propTypes", { 'value': PropTypes.string.isRequired, @@ -1456,26 +1445,25 @@ _defineProperty(AliasInputField, "defaultProps", { 'value': ':' }); export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponent3) { - _inherits(AliasInputFieldValidated, _React$PureComponent3); - var _super7 = _createSuper(AliasInputFieldValidated); function AliasInputFieldValidated(props) { - var _this10; + var _this11; _classCallCheck(this, AliasInputFieldValidated); - _this10 = _super7.call(this, props); - _this10.doValidateAlias = _this10.doValidateAlias.bind(_assertThisInitialized(_this10)); - _this10.onAliasChange = _this10.onAliasChange.bind(_assertThisInitialized(_this10)); - _this10.request = null; - _this10.state = { + _this11 = _callSuper(this, AliasInputFieldValidated, [props]); + _this11.doValidateAlias = _this11.doValidateAlias.bind(_this11); + _this11.onAliasChange = _this11.onAliasChange.bind(_this11); + _this11.request = null; + _this11.state = { value: props.value || AliasInputField.defaultProps.value, isValid: null, errorMessage: null }; - return _this10; + return _this11; } - _createClass(AliasInputFieldValidated, [{ + _inherits(AliasInputFieldValidated, _React$PureComponent3); + return _createClass(AliasInputFieldValidated, [{ key: "doValidateAlias", value: function doValidateAlias(alias) { - var _this11 = this; + var _this12 = this; var _this$props23 = this.props, onAliasChange = _this$props23.onAliasChange, errorValue = _this$props23.errorValue; @@ -1485,23 +1473,23 @@ export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponen } var currReq = null; var cb = function (res) { - if (!_this11.request || _this11.request && _this11.request !== currReq) { + if (!_this12.request || _this12.request && _this12.request !== currReq) { // A newer request has been launched, cancel this // to prevent accidental overwrites or something. return; } - _this11.request = null; + _this12.request = null; if (res.code !== 404) { // Not valid - something exists already. onAliasChange(errorValue); - _this11.setState({ + _this12.setState({ errorMessage: "Alias " + alias + " already exists", isValid: false }); return; } onAliasChange(alias); - _this11.setState({ + _this12.setState({ isValid: true, errorMessage: null }); @@ -1511,7 +1499,7 @@ export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponen }, { key: "onAliasChange", value: function (nextAlias) { - var _this12 = this; + var _this13 = this; var _this$props24 = this.props, onAliasChange = _this$props24.onAliasChange, errorValue = _this$props24.errorValue, @@ -1524,14 +1512,14 @@ export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponen this.setState({ value: nextAlias }, function () { - var value = _this12.state.value; + var value = _this13.state.value; var _value$split = value.split(':'), _value$split2 = _slicedToArray(_value$split, 2), firstPart = _value$split2[0], secondPart = _value$split2[1]; if (!firstPart || !secondPart) { onAliasChange(null); - _this12.setState({ + _this13.setState({ errorMessage: "Part of alias is blank. Will be excluded." }); return; @@ -1539,7 +1527,7 @@ export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponen var passedRegex = new RegExp('^\\S+:\\S+$').test(value); if (!passedRegex) { onAliasChange(errorValue); - _this12.setState({ + _this13.setState({ errorMessage: "Aliases must be formatted as: : (e.g. dcic-lab:42)." }); return; @@ -1547,7 +1535,7 @@ export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponen if (rejectAliases.length > 0 && rejectAliases.indexOf(nextAlias) > -1) { // Presume is saved in database as this, skip validation. onAliasChange("ERROR"); - _this12.setState({ + _this13.setState({ errorMessage: "Alias rejected, make sure is not used already." }); return; @@ -1555,12 +1543,12 @@ export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponen if (skipValidateAliases.length > 0 && skipValidateAliases.indexOf(nextAlias) > -1) { // Presume is saved in database as this, skip validation. onAliasChange(nextAlias); - _this12.setState({ + _this13.setState({ errorMessage: null }); return; } - _this12.doValidateAlias(value); + _this13.doValidateAlias(value); }); } }, { @@ -1571,7 +1559,6 @@ export var AliasInputFieldValidated = /*#__PURE__*/function (_React$PureComponen })); } }]); - return AliasInputFieldValidated; }(React.PureComponent); _defineProperty(AliasInputFieldValidated, "defaultProps", { errorValue: "ERROR", @@ -1579,13 +1566,12 @@ _defineProperty(AliasInputFieldValidated, "defaultProps", { rejectAliases: [] }); var InfoIcon = /*#__PURE__*/function (_React$PureComponent4) { - _inherits(InfoIcon, _React$PureComponent4); - var _super8 = _createSuper(InfoIcon); function InfoIcon() { _classCallCheck(this, InfoIcon); - return _super8.apply(this, arguments); + return _callSuper(this, InfoIcon, arguments); } - _createClass(InfoIcon, [{ + _inherits(InfoIcon, _React$PureComponent4); + return _createClass(InfoIcon, [{ key: "fieldTypeDescriptor", value: function fieldTypeDescriptor() { var _this$props25 = this.props, @@ -1621,7 +1607,6 @@ var InfoIcon = /*#__PURE__*/function (_React$PureComponent4) { }); } }]); - return InfoIcon; }(React.PureComponent); export function isValueNull(value) { if (value === null) return true; diff --git a/es/components/navigation/components/LoginController.js b/es/components/navigation/components/LoginController.js index a0cdde33..d4231fbb 100644 --- a/es/components/navigation/components/LoginController.js +++ b/es/components/navigation/components/LoginController.js @@ -1,23 +1,27 @@ +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["children"], _excluded2 = ["children"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; @@ -37,21 +41,19 @@ var Auth0Lock = null; /** Controls Login process, also shows Registration Modal */ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { - _inherits(LoginController, _React$PureComponent); - var _super = _createSuper(LoginController); function LoginController(props) { - var _this; + var _this2; _classCallCheck(this, LoginController); - _this = _super.call(this, props); - _this.showLock = _.throttle(_this.showLock.bind(_assertThisInitialized(_this)), 1000, { + _this2 = _callSuper(this, LoginController, [props]); + _this2.showLock = _.throttle(_this2.showLock.bind(_this2), 1000, { trailing: false }); - _this.validateCookieAndObtainAdditionalUserInfo = _this.validateCookieAndObtainAdditionalUserInfo.bind(_assertThisInitialized(_this)); - _this.auth0LoginCallback = _this.auth0LoginCallback.bind(_assertThisInitialized(_this)); - _this.onAuth0LoginShow = _this.onAuth0LoginShow.bind(_assertThisInitialized(_this)); - _this.onRegistrationComplete = _this.onRegistrationComplete.bind(_assertThisInitialized(_this)); - _this.onRegistrationCancel = _this.onRegistrationCancel.bind(_assertThisInitialized(_this)); - _this.state = { + _this2.validateCookieAndObtainAdditionalUserInfo = _this2.validateCookieAndObtainAdditionalUserInfo.bind(_this2); + _this2.auth0LoginCallback = _this2.auth0LoginCallback.bind(_this2); + _this2.onAuth0LoginShow = _this2.onAuth0LoginShow.bind(_this2); + _this2.onRegistrationComplete = _this2.onRegistrationComplete.bind(_this2); + _this2.onRegistrationCancel = _this2.onRegistrationCancel.bind(_this2); + _this2.state = { // Contains email of Auth0-authenticated user but not in-system user "unverifiedUserEmail": null, // Whether the code-split JS library for Auth0 has loaded yet. @@ -63,12 +65,13 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { // Should be deleted by time user can authenticate "jwtToken": null }; - return _this; + return _this2; } - _createClass(LoginController, [{ + _inherits(LoginController, _React$PureComponent); + return _createClass(LoginController, [{ key: "componentDidMount", value: function componentDidMount() { - var _this2 = this; + var _this3 = this; var auth0OptionsFallback = this.props.auth0Options; var isAuth0LibraryLoaded = this.state.isAuth0LibraryLoaded; ajaxPromise("/auth0_config").then(function (_ref) { @@ -87,11 +90,11 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { var options = _objectSpread(_objectSpread({}, auth0OptionsFallback), auth0Options); if (auth0Domain.indexOf('auth0') != -1) { var createLock = function () { - _this2.lock = new Auth0Lock(auth0Client, auth0Domain, options); - _this2.lock.on("authenticated", _this2.auth0LoginCallback); - _this2.lock.on("show", _this2.onAuth0LoginShow); + _this3.lock = new Auth0Lock(auth0Client, auth0Domain, options); + _this3.lock.on("authenticated", _this3.auth0LoginCallback); + _this3.lock.on("show", _this3.onAuth0LoginShow); setTimeout(function () { - _this2.setState({ + _this3.setState({ "isAuth0LibraryLoaded": true }); }, 200); @@ -109,7 +112,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { // We import it here in separate bundle instead to avoid issues during server-side render. createLock(); setTimeout(function () { - _this2.setState({ + _this3.setState({ "isAuth0LibraryLoaded": true }); }, 200); @@ -119,9 +122,9 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { } } else if (auth0Domain.indexOf('nih.gov') != -1) { // RAS authentication - _this2.lock = { + _this3.lock = { show: function show() { - var href = _this2.props.href; + var href = _this3.props.href; var _ref3$auth = (auth0Options || {}).auth, _ref3$auth2 = _ref3$auth === void 0 ? {} : _ref3$auth, _ref3$auth2$responseT = _ref3$auth2.responseType, @@ -138,7 +141,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { // keep return url for 10 mins document.cookie = "returnUrl=".concat(encodeURIComponent(returnUrl), "; max-age=").concat(10 * 60, "; path=/; SameSite=Lax;"); var authenticationUrl = "https://".concat(auth0Domain, "/auth/oauth/v2/authorize?client_id=").concat(auth0Client, "&prompt=").concat(encodeURIComponent(prompt), "&redirect_uri=").concat(host + '/callback', "&response_type=").concat(encodeURIComponent(responseType), "&scope=").concat(encodeURIComponent(scope)); - _this2.setState({ + _this3.setState({ "isLoading": true }, function () { return setTimeout(function () { @@ -150,19 +153,19 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { // However Auth0 libraries are never imported in RAS implementation, // isAuth0LibraryLoaded is set for compatibility setTimeout(function () { - _this2.setState({ + _this3.setState({ "isAuth0LibraryLoaded": true }); }, 200); } else { // fallback - _this2.lock = { + _this3.lock = { show: function show() { console.error('Non-supported authentication type: ' + auth0Domain); } }; setTimeout(function () { - _this2.setState({ + _this3.setState({ "isAuth0LibraryLoaded": true }); }, 200); @@ -178,7 +181,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { }, { key: "validateCookieAndObtainAdditionalUserInfo", value: function validateCookieAndObtainAdditionalUserInfo(token) { - var _this3 = this; + var _this4 = this; var successCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var errorCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var _this$props = this.props, @@ -188,7 +191,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { this.setState({ "isLoading": true }, function () { - _this3.lock.hide(); + _this4.lock.hide(); // Second stage: get this valid OAuth account (Google or w/e) auth'd from our end. // We probably can get rid of this Promise.race wrapper, since request/server will likely time out in 30s, idk.. @@ -236,7 +239,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { 'id': 'profile' }) || {}).href; if (profileURL) { - _this3.setState({ + _this4.setState({ "isLoading": false }); JWT.saveUserInfoLocalStorage(userInfoResponse); @@ -280,7 +283,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { // Handle Errors logger.error("Error during login: ", error.description); console.log(error); - _this3.setState({ + _this4.setState({ "isLoading": false }); // Alerts.deQueue(Alerts.LoggedOut); @@ -294,7 +297,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { }, { key: "auth0LoginCallback", value: function auth0LoginCallback(authResult) { - var _this4 = this; + var _this5 = this; // First stage: we just have gotten JWT from the Auth0 widget but have not auth'd it against it our own system // to see if this is a valid user account or some random person who just logged into their Google account. var idToken = authResult.idToken; @@ -312,8 +315,8 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { if (unverifiedUserEmail) { // Somewhat weird/hacky approach to mask the idToken in private func enclosure // and not leave potentially-more-exposed in state - _this4.onRegistrationCompleteBoundWithToken = _this4.onRegistrationComplete.bind(_this4, idToken); - _this4.setState({ + _this5.onRegistrationCompleteBoundWithToken = _this5.onRegistrationComplete.bind(_this5, idToken); + _this5.setState({ unverifiedUserEmail: unverifiedUserEmail }); } else { @@ -375,7 +378,7 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { }, { key: "onRegistrationComplete", value: function onRegistrationComplete(idToken) { - var _this5 = this; + var _this6 = this; var unverifiedUserEmail = this.state.unverifiedUserEmail; if (!idToken) { throw Error("Expected an idToken"); @@ -407,11 +410,11 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { "style": 'success', 'navigateDisappearThreshold': 2 }); - _this5.setState({ + _this6.setState({ "unverifiedUserEmail": null }); }, function () { - _this5.setState({ + _this6.setState({ "unverifiedUserEmail": null }); @@ -461,7 +464,6 @@ export var LoginController = /*#__PURE__*/function (_React$PureComponent) { }); } }]); - return LoginController; }(React.PureComponent); /** @@ -535,17 +537,15 @@ export function performLogout() { }); } export var LogoutController = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(LogoutController, _React$PureComponent2); - var _super2 = _createSuper(LogoutController); function LogoutController(props) { - var _this6; + var _this7; _classCallCheck(this, LogoutController); - _this6 = _super2.call(this, props); - _this6.performLogoutUI = _this6.performLogoutUI.bind(_assertThisInitialized(_this6)); - _this6.state = { + _this7 = _callSuper(this, LogoutController, [props]); + _this7.performLogoutUI = _this7.performLogoutUI.bind(_this7); + _this7.state = { "isLoading": false }; - return _this6; + return _this7; } /** @@ -554,10 +554,11 @@ export var LogoutController = /*#__PURE__*/function (_React$PureComponent2) { * * @param {Event} [evt] - Not needed. Will prevent default / stopPropagation if present. */ - _createClass(LogoutController, [{ + _inherits(LogoutController, _React$PureComponent2); + return _createClass(LogoutController, [{ key: "performLogoutUI", value: function performLogoutUI() { - var _this7 = this; + var _this8 = this; var evt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; if (evt && evt.preventDefault) { evt.preventDefault(); @@ -567,7 +568,7 @@ export var LogoutController = /*#__PURE__*/function (_React$PureComponent2) { "isLoading": true }, function () { performLogout().then(function () { - _this7.setState({ + _this8.setState({ "isLoading": false }); @@ -601,5 +602,4 @@ export var LogoutController = /*#__PURE__*/function (_React$PureComponent2) { })); } }]); - return LogoutController; }(React.PureComponent); \ No newline at end of file diff --git a/es/components/navigation/components/Registry.js b/es/components/navigation/components/Registry.js index f9644a64..b6f7bd0c 100644 --- a/es/components/navigation/components/Registry.js +++ b/es/components/navigation/components/Registry.js @@ -1,9 +1,5 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; import _ from 'underscore'; /** @@ -19,7 +15,7 @@ var Registry = /*#__PURE__*/function () { this.views = {}; _.extend(this, options); } - _createClass(Registry, [{ + return _createClass(Registry, [{ key: "providedBy", value: function providedBy(obj) { return obj['@type'] || []; @@ -69,6 +65,5 @@ var Registry = /*#__PURE__*/function () { key: "fallback", value: function fallback() {} }]); - return Registry; }(); export { Registry as default }; \ No newline at end of file diff --git a/es/components/static-pages/BasicStaticSectionBody.js b/es/components/static-pages/BasicStaticSectionBody.js index 44e2ccdc..4b9f8ea8 100644 --- a/es/components/static-pages/BasicStaticSectionBody.js +++ b/es/components/static-pages/BasicStaticSectionBody.js @@ -1,6 +1,5 @@ +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["content", "content_as_html", "children", "filetype", "element", "markdownCompilerOptions", "placeholderReplacementFxn"]; -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; diff --git a/es/components/static-pages/StaticPageBase.js b/es/components/static-pages/StaticPageBase.js index 3f6900a1..6f0c09df 100644 --- a/es/components/static-pages/StaticPageBase.js +++ b/es/components/static-pages/StaticPageBase.js @@ -1,20 +1,26 @@ +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _extends from "@babel/runtime/helpers/extends"; +import _typeof from "@babel/runtime/helpers/typeof"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -110,24 +116,23 @@ Wrapper.defaultProps = { 'tocListStyles': ['decimal', 'lower-alpha', 'lower-roman'] }; export var StaticEntry = /*#__PURE__*/function (_React$PureComponent) { - _inherits(StaticEntry, _React$PureComponent); - var _super = _createSuper(StaticEntry); function StaticEntry(props) { - var _this; + var _this2; _classCallCheck(this, StaticEntry); - _this = _super.call(this, props); - _this.toggleOpen = _.throttle(_this.toggleOpen.bind(_assertThisInitialized(_this)), 1000); + _this2 = _callSuper(this, StaticEntry, [props]); + _this2.toggleOpen = _.throttle(_this2.toggleOpen.bind(_this2), 1000); var options = props.section && props.section.options || {}; - _this.state = { + _this2.state = { 'open': options.default_open, 'closing': false }; - return _this; + return _this2; } - _createClass(StaticEntry, [{ + _inherits(StaticEntry, _React$PureComponent); + return _createClass(StaticEntry, [{ key: "toggleOpen", value: function toggleOpen(open) { - var _this2 = this; + var _this3 = this; this.setState(function (currState) { if (typeof open !== 'boolean') { open = !currState.open; @@ -139,7 +144,7 @@ export var StaticEntry = /*#__PURE__*/function (_React$PureComponent) { }; }, function () { setTimeout(function () { - _this2.setState(function (currState) { + _this3.setState(function (currState) { if (!currState.open && currState.closing) { return { 'closing': false @@ -195,7 +200,6 @@ export var StaticEntry = /*#__PURE__*/function (_React$PureComponent) { }, section.title) : null, renderedChildComponent); } }]); - return StaticEntry; }(React.PureComponent); /** @@ -213,13 +217,12 @@ _defineProperty(StaticEntry, "propTypes", { 'childComponent': PropTypes.elementType }); export var StaticPageBase = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(StaticPageBase, _React$PureComponent2); - var _super2 = _createSuper(StaticPageBase); function StaticPageBase() { _classCallCheck(this, StaticPageBase); - return _super2.apply(this, arguments); + return _callSuper(this, StaticPageBase, arguments); } - _createClass(StaticPageBase, [{ + _inherits(StaticPageBase, _React$PureComponent2); + return _createClass(StaticPageBase, [{ key: "render", value: function render() { var _this$props2 = this.props, @@ -271,7 +274,6 @@ export var StaticPageBase = /*#__PURE__*/function (_React$PureComponent2) { }); } }]); - return StaticPageBase; }(React.PureComponent); _defineProperty(StaticPageBase, "Wrapper", Wrapper); _defineProperty(StaticPageBase, "defaultProps", { diff --git a/es/components/static-pages/TableOfContents.js b/es/components/static-pages/TableOfContents.js index 4a6e3b29..c36d9eb2 100644 --- a/es/components/static-pages/TableOfContents.js +++ b/es/components/static-pages/TableOfContents.js @@ -1,25 +1,27 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +import _typeof from "@babel/runtime/helpers/typeof"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +var _TableEntryChildren; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import * as d3 from 'd3'; import _ from 'underscore'; @@ -30,30 +32,29 @@ import { navigate } from './../util/navigate'; import { isServerSide } from './../util/misc'; import { CopyWrapper, itemUtil } from './../util/object'; var TableEntry = /*#__PURE__*/function (_React$Component) { - _inherits(TableEntry, _React$Component); - var _super = _createSuper(TableEntry); function TableEntry(props) { - var _this; + var _this2; _classCallCheck(this, TableEntry); - _this = _super.call(this, props); - _this.shouldComponentUpdate = _this.shouldComponentUpdate.bind(_assertThisInitialized(_this)); - _this.getTargetElement = _this.getTargetElement.bind(_assertThisInitialized(_this)); - _this.getNextHeaderElement = _this.getNextHeaderElement.bind(_assertThisInitialized(_this)); - _this.handleClick = _.throttle(_this.handleClick.bind(_assertThisInitialized(_this)), 300); - _this.determineIfActive = _this.determineIfActive.bind(_assertThisInitialized(_this)); - _this.toggleOpen = _this.toggleOpen.bind(_assertThisInitialized(_this)); - _this.targetElement = null; // Header element we scroll to is cached here. Not in state as does not change. + _this2 = _callSuper(this, TableEntry, [props]); + _this2.shouldComponentUpdate = _this2.shouldComponentUpdate.bind(_this2); + _this2.getTargetElement = _this2.getTargetElement.bind(_this2); + _this2.getNextHeaderElement = _this2.getNextHeaderElement.bind(_this2); + _this2.handleClick = _.throttle(_this2.handleClick.bind(_this2), 300); + _this2.determineIfActive = _this2.determineIfActive.bind(_this2); + _this2.toggleOpen = _this2.toggleOpen.bind(_this2); + _this2.targetElement = null; // Header element we scroll to is cached here. Not in state as does not change. var collapsible = props.collapsible, defaultExpanded = props.defaultExpanded; if (collapsible) { var open = typeof defaultExpanded === 'boolean' ? defaultExpanded : false; - _this.state = { + _this2.state = { 'open': open }; } - return _this; + return _this2; } - _createClass(TableEntry, [{ + _inherits(TableEntry, _React$Component); + return _createClass(TableEntry, [{ key: "shouldComponentUpdate", value: function shouldComponentUpdate(nextProps, nextState) { if (nextProps.mounted !== this.props.mounted || nextProps.pageScrollTop !== this.props.pageScrollTop || this && this.state && nextState && nextState.open !== this.state.open) { @@ -154,7 +155,7 @@ var TableEntry = /*#__PURE__*/function (_React$Component) { }, { key: "render", value: function render() { - var _this2 = this; + var _this3 = this; var _this$props2 = this.props, recurDepth = _this$props2.recurDepth, link = _this$props2.link, @@ -191,7 +192,7 @@ var TableEntry = /*#__PURE__*/function (_React$Component) { href: (link.charAt(0) === '/' ? '' : '#') + link, onClick: function onClick(e) { e.preventDefault(); - _this2.handleClick(); + _this3.handleClick(); } }, title)); } @@ -229,7 +230,6 @@ var TableEntry = /*#__PURE__*/function (_React$Component) { })))); } }]); - return TableEntry; }(React.Component); _defineProperty(TableEntry, "getChildHeaders", memoize(function (content, maxHeaderDepth, currentDepth) { if (!TableOfContents.isContentJSX(content) || !content.props || !content.props.children) return []; @@ -253,19 +253,18 @@ _defineProperty(TableEntry, "defaultProps", { 'defaultExpanded': undefined }); var TableEntryChildren = /*#__PURE__*/function (_React$Component2) { - _inherits(TableEntryChildren, _React$Component2); - var _super2 = _createSuper(TableEntryChildren); function TableEntryChildren(props) { - var _this3; + var _this4; _classCallCheck(this, TableEntryChildren); - _this3 = _super2.call(this, props); - _this3.shouldComponentUpdate = _this3.shouldComponentUpdate.bind(_assertThisInitialized(_this3)); - _this3.getHeadersFromContent = _this3.getHeadersFromContent.bind(_assertThisInitialized(_this3)); - _this3.children = _this3.children.bind(_assertThisInitialized(_this3)); - _this3.render = _this3.render.bind(_assertThisInitialized(_this3)); - return _this3; + _this4 = _callSuper(this, TableEntryChildren, [props]); + _this4.shouldComponentUpdate = _this4.shouldComponentUpdate.bind(_this4); + _this4.getHeadersFromContent = _this4.getHeadersFromContent.bind(_this4); + _this4.children = _this4.children.bind(_this4); + _this4.render = _this4.render.bind(_this4); + return _this4; } - _createClass(TableEntryChildren, [{ + _inherits(TableEntryChildren, _React$Component2); + return _createClass(TableEntryChildren, [{ key: "shouldComponentUpdate", value: function shouldComponentUpdate(nextProps) { if (nextProps.active) return true; @@ -373,13 +372,13 @@ var TableEntryChildren = /*#__PURE__*/function (_React$Component2) { return null; } }]); - return TableEntryChildren; }(React.Component); +_TableEntryChildren = TableEntryChildren; _defineProperty(TableEntryChildren, "getHeadersFromContent", memoize(function (jsxContent, maxHeaderDepth, currentDepth) { if (Array.isArray(jsxContent)) { // As of html-react-parser v1.2.8, we may get back array of content, including "\n" or similar. return jsxContent.reduce(function (m, c) { - var res = TableEntryChildren.getHeadersFromContent(c, maxHeaderDepth, currentDepth); + var res = _TableEntryChildren.getHeadersFromContent(c, maxHeaderDepth, currentDepth); m.childDepth = Math.max(res.childDepth, m.childDepth); m.childrenForDepth = m.childrenForDepth.concat(res.childrenForDepth); return m; @@ -429,22 +428,21 @@ _defineProperty(TableEntryChildren, "getSubsequentChildHeaders", memoize(functio }; })); export var TableOfContents = /*#__PURE__*/function (_React$Component3) { - _inherits(TableOfContents, _React$Component3); - var _super3 = _createSuper(TableOfContents); function TableOfContents(props) { - var _this4; + var _this5; _classCallCheck(this, TableOfContents); - _this4 = _super3.call(this, props); - _this4.onPageScroll = _this4.onPageScroll.bind(_assertThisInitialized(_this4)); - _this4.onToggleWidthBound = _this4.onToggleWidthBound.bind(_assertThisInitialized(_this4)); - _this4.state = { + _this5 = _callSuper(this, TableOfContents, [props]); + _this5.onPageScroll = _this5.onPageScroll.bind(_this5); + _this5.onToggleWidthBound = _this5.onToggleWidthBound.bind(_this5); + _this5.state = { 'scrollTop': 0, 'mounted': false, 'widthBound': true }; - return _this4; + return _this5; } - _createClass(TableOfContents, [{ + _inherits(TableOfContents, _React$Component3); + return _createClass(TableOfContents, [{ key: "componentDidMount", value: function componentDidMount() { if (window && !isServerSide()) { @@ -471,12 +469,12 @@ export var TableOfContents = /*#__PURE__*/function (_React$Component3) { }, { key: "componentDidUpdate", value: function componentDidUpdate(pastProps) { - var _this5 = this; + var _this6 = this; if (pastProps.windowWidth !== this.props.windowWidth) { // Recalculate new position on page etc. this.updateQueued = true; setTimeout(function () { - _this5.setState({ + _this6.setState({ 'scrollTop': parseInt(getPageVerticalScrollPosition()) }); }, 0); @@ -792,7 +790,6 @@ export var TableOfContents = /*#__PURE__*/function (_React$Component3) { }); } }]); - return TableOfContents; }(React.Component); _defineProperty(TableOfContents, "defaultProps", { "context": { @@ -865,16 +862,15 @@ NextPreviousPageSection.defaultProps = { * @todo need to rename it as StaticContentHeading (here and in 4DN-CGAP-SMaHT) since we started to use it for not only MD but all types of content */ export var MarkdownHeading = /*#__PURE__*/function (_React$PureComponent) { - _inherits(MarkdownHeading, _React$PureComponent); - var _super4 = _createSuper(MarkdownHeading); function MarkdownHeading(props) { - var _this6; + var _this7; _classCallCheck(this, MarkdownHeading); - _this6 = _super4.call(this, props); - _this6.getID = _this6.getID.bind(_assertThisInitialized(_this6)); - return _this6; + _this7 = _callSuper(this, MarkdownHeading, [props]); + _this7.getID = _this7.getID.bind(_this7); + return _this7; } - _createClass(MarkdownHeading, [{ + _inherits(MarkdownHeading, _React$PureComponent); + return _createClass(MarkdownHeading, [{ key: "getID", value: function getID() { var set = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; @@ -948,23 +944,21 @@ export var MarkdownHeading = /*#__PURE__*/function (_React$PureComponent) { return attr; } }]); - return MarkdownHeading; }(React.PureComponent); _defineProperty(MarkdownHeading, "defaultProps", { 'type': 'h1', 'id': null }); export var HeaderWithLink = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(HeaderWithLink, _React$PureComponent2); - var _super5 = _createSuper(HeaderWithLink); function HeaderWithLink(props) { - var _this7; + var _this8; _classCallCheck(this, HeaderWithLink); - _this7 = _super5.call(this, props); - _this7.handleLinkClick = _this7.handleLinkClick.bind(_assertThisInitialized(_this7)); - return _this7; + _this8 = _callSuper(this, HeaderWithLink, [props]); + _this8.handleLinkClick = _this8.handleLinkClick.bind(_this8); + return _this8; } - _createClass(HeaderWithLink, [{ + _inherits(HeaderWithLink, _React$PureComponent2); + return _createClass(HeaderWithLink, [{ key: "handleLinkClick", value: function handleLinkClick() { var _this$props7 = this.props, @@ -1000,5 +994,4 @@ export var HeaderWithLink = /*#__PURE__*/function (_React$PureComponent2) { })]); } }]); - return HeaderWithLink; }(React.PureComponent); \ No newline at end of file diff --git a/es/components/ui/Alerts.js b/es/components/ui/Alerts.js index 8963810f..d207ab11 100644 --- a/es/components/ui/Alerts.js +++ b/es/components/ui/Alerts.js @@ -1,20 +1,24 @@ +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["alerts", "children"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -31,14 +35,12 @@ var store = null; * title for alert that was queued. */ export var Alerts = /*#__PURE__*/function (_React$Component) { - _inherits(Alerts, _React$Component); - var _super = _createSuper(Alerts); /** @ignore */ function Alerts(props) { - var _this; + var _this2; _classCallCheck(this, Alerts); - _this = _super.call(this, props); - _this.setDismissing = _this.setDismissing.bind(_assertThisInitialized(_this)); + _this2 = _callSuper(this, Alerts, [props]); + _this2.setDismissing = _this2.setDismissing.bind(_this2); /** * State object for component. @@ -47,17 +49,18 @@ export var Alerts = /*#__PURE__*/function (_React$Component) { * @private * @property {AlertObj[]} state.dismissing - List of alerts currently being faded out. */ - _this.state = { + _this2.state = { 'dismissing': [] }; - return _this; + return _this2; } /** * Called when 'fade out' of an alert is initialized. * @private */ - _createClass(Alerts, [{ + _inherits(Alerts, _React$Component); + return _createClass(Alerts, [{ key: "setDismissing", value: function setDismissing(dismissing) { this.setState({ @@ -74,7 +77,7 @@ export var Alerts = /*#__PURE__*/function (_React$Component) { }, { key: "render", value: function render() { - var _this2 = this; + var _this3 = this; var _this$props = this.props, alerts = _this$props.alerts, children = _this$props.children, @@ -86,7 +89,7 @@ export var Alerts = /*#__PURE__*/function (_React$Component) { alert: alert, index: index, alerts: alerts, - setDismissing: _this2.setDismissing, + setDismissing: _this3.setDismissing, dismissing: dismissing, key: index }); @@ -206,7 +209,6 @@ export var Alerts = /*#__PURE__*/function (_React$Component) { }); } }]); - return Alerts; }(React.Component); _defineProperty(Alerts, "defaultProps", { "className": "alerts mt-2" @@ -262,17 +264,16 @@ export var LoginFailed = Alerts.LoginFailed = { * @private */ var AlertItem = /*#__PURE__*/function (_React$PureComponent) { - _inherits(AlertItem, _React$PureComponent); - var _super2 = _createSuper(AlertItem); function AlertItem(props) { - var _this3; + var _this4; _classCallCheck(this, AlertItem); - _this3 = _super2.call(this, props); - _this3.dismiss = _this3.dismiss.bind(_assertThisInitialized(_this3)); - _this3.finishDismiss = _this3.finishDismiss.bind(_assertThisInitialized(_this3)); - return _this3; + _this4 = _callSuper(this, AlertItem, [props]); + _this4.dismiss = _this4.dismiss.bind(_this4); + _this4.finishDismiss = _this4.finishDismiss.bind(_this4); + return _this4; } - _createClass(AlertItem, [{ + _inherits(AlertItem, _React$PureComponent); + return _createClass(AlertItem, [{ key: "dismiss", value: function dismiss(e) { e.stopPropagation(); @@ -335,5 +336,4 @@ var AlertItem = /*#__PURE__*/function (_React$PureComponent) { }, message) : null)); } }]); - return AlertItem; }(React.PureComponent); \ No newline at end of file diff --git a/es/components/ui/DotRouter.js b/es/components/ui/DotRouter.js index e21c14ff..38130a0b 100644 --- a/es/components/ui/DotRouter.js +++ b/es/components/ui/DotRouter.js @@ -1,40 +1,43 @@ 'use strict'; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _excluded = ["tabTitle", "dotPath", "disabled", "active", "prependDotPath", "children", "className", "arrowTabs"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React, { useCallback } from 'react'; import _ from 'underscore'; import memoize from 'memoize-one'; import url from 'url'; import { navigate, logger } from '../util'; export var TabPaneErrorBoundary = /*#__PURE__*/function (_React$PureComponent) { - _inherits(TabPaneErrorBoundary, _React$PureComponent); - var _super = _createSuper(TabPaneErrorBoundary); function TabPaneErrorBoundary(props) { - var _this; + var _this2; _classCallCheck(this, TabPaneErrorBoundary); - _this = _super.call(this, props); - _this.state = { + _this2 = _callSuper(this, TabPaneErrorBoundary, [props]); + _this2.state = { hasError: false }; - return _this; + return _this2; } - _createClass(TabPaneErrorBoundary, [{ + _inherits(TabPaneErrorBoundary, _React$PureComponent); + return _createClass(TabPaneErrorBoundary, [{ key: "componentDidCatch", value: function componentDidCatch(error, info) { logger.error("Caught error", error, info); @@ -58,7 +61,6 @@ export var TabPaneErrorBoundary = /*#__PURE__*/function (_React$PureComponent) { }; } }]); - return TabPaneErrorBoundary; }(React.PureComponent); /** @@ -82,24 +84,23 @@ _defineProperty(TabPaneErrorBoundary, "defaultProps", { }, "A client-side error has occured, please go back or try again later.")))) }); export var DotRouter = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(DotRouter, _React$PureComponent2); - var _super2 = _createSuper(DotRouter); function DotRouter(props) { - var _this2; + var _this3; _classCallCheck(this, DotRouter); - _this2 = _super2.call(this, props); - _this2.getCurrentTab = _this2.getCurrentTab.bind(_assertThisInitialized(_this2)); - _this2.memoized = { + _this3 = _callSuper(this, DotRouter, [props]); + _this3.getCurrentTab = _this3.getCurrentTab.bind(_this3); + _this3.memoized = { getDefaultTab: memoize(DotRouter.getDefaultTab), getDotPath: memoize(DotRouter.getDotPath) }; - return _this2; + return _this3; } /** * Method is not explicitly memoized b.c. this component only has 2 props & is a PureComponent itself */ - _createClass(DotRouter, [{ + _inherits(DotRouter, _React$PureComponent2); + return _createClass(DotRouter, [{ key: "getCurrentTab", value: function getCurrentTab() { var _this$props2 = this.props, @@ -217,7 +218,6 @@ export var DotRouter = /*#__PURE__*/function (_React$PureComponent2) { return defaultChildTab; } }]); - return DotRouter; }(React.PureComponent); _defineProperty(DotRouter, "defaultProps", { "className": null, diff --git a/es/components/ui/FileDownloadButton.js b/es/components/ui/FileDownloadButton.js index 8e29d296..2e81420e 100644 --- a/es/components/ui/FileDownloadButton.js +++ b/es/components/ui/FileDownloadButton.js @@ -1,13 +1,10 @@ +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _extends from "@babel/runtime/helpers/extends"; +import _typeof from "@babel/runtime/helpers/typeof"; var _excluded = ["filename", "href", "target", "title", "mimeType", "size", "className", "bsStyle", "variant", "onClick"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; diff --git a/es/components/ui/FlexibleDescriptionBox.js b/es/components/ui/FlexibleDescriptionBox.js index fa2f24a3..a5b86b6f 100644 --- a/es/components/ui/FlexibleDescriptionBox.js +++ b/es/components/ui/FlexibleDescriptionBox.js @@ -1,17 +1,22 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -21,20 +26,19 @@ import { gridContainerWidth, textContentWidth } from './../util/layout'; import { requestAnimationFrame as raf } from './../viz/utilities'; import { EditableField, FieldSet } from '../forms/components/EditableField'; export var FlexibleCharacterCountBox = /*#__PURE__*/function (_React$Component) { - _inherits(FlexibleCharacterCountBox, _React$Component); - var _super = _createSuper(FlexibleCharacterCountBox); function FlexibleCharacterCountBox(props) { - var _this; + var _this2; _classCallCheck(this, FlexibleCharacterCountBox); - _this = _super.call(this, props); - _this.render = _this.render.bind(_assertThisInitialized(_this)); - _this.onClick = _.debounce(_this.onClick.bind(_assertThisInitialized(_this)), 300, true); - _this.state = { + _this2 = _callSuper(this, FlexibleCharacterCountBox, [props]); + _this2.render = _this2.render.bind(_this2); + _this2.onClick = _.debounce(_this2.onClick.bind(_this2), 300, true); + _this2.state = { 'expanded': props.defaultExpanded || false }; - return _this; + return _this2; } - _createClass(FlexibleCharacterCountBox, [{ + _inherits(FlexibleCharacterCountBox, _React$Component); + return _createClass(FlexibleCharacterCountBox, [{ key: "onClick", value: function onClick() { this.setState(function (_ref) { @@ -72,7 +76,6 @@ export var FlexibleCharacterCountBox = /*#__PURE__*/function (_React$Component) }), " \xA0 ", visibleIcon); } }]); - return FlexibleCharacterCountBox; }(React.Component); _defineProperty(FlexibleCharacterCountBox, "propTypes", { 'characters': PropTypes.number.isRequired, @@ -80,13 +83,12 @@ _defineProperty(FlexibleCharacterCountBox, "propTypes", { 'icon': PropTypes.element }); var FlexibleCharacterCountString = /*#__PURE__*/function (_React$Component2) { - _inherits(FlexibleCharacterCountString, _React$Component2); - var _super2 = _createSuper(FlexibleCharacterCountString); function FlexibleCharacterCountString() { _classCallCheck(this, FlexibleCharacterCountString); - return _super2.apply(this, arguments); + return _callSuper(this, FlexibleCharacterCountString, arguments); } - _createClass(FlexibleCharacterCountString, [{ + _inherits(FlexibleCharacterCountString, _React$Component2); + return _createClass(FlexibleCharacterCountString, [{ key: "isExpanded", value: function isExpanded() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; @@ -106,7 +108,6 @@ var FlexibleCharacterCountString = /*#__PURE__*/function (_React$Component2) { } } }]); - return FlexibleCharacterCountString; }(React.Component); /** * Works by calculating height of text content using a temporary off-screen container element. @@ -121,42 +122,41 @@ _defineProperty(FlexibleCharacterCountString, "defaultProps", { 'expanded': false }); export var FlexibleDescriptionBox = /*#__PURE__*/function (_React$Component3) { - _inherits(FlexibleDescriptionBox, _React$Component3); - var _super3 = _createSuper(FlexibleDescriptionBox); function FlexibleDescriptionBox(props) { - var _this2; + var _this3; _classCallCheck(this, FlexibleDescriptionBox); - _this2 = _super3.call(this, props); - _this2.dimensions = _this2.dimensions.bind(_assertThisInitialized(_this2)); - _this2.checkWillDescriptionFitOneLineAndUpdateHeight = _this2.checkWillDescriptionFitOneLineAndUpdateHeight.bind(_assertThisInitialized(_this2)); - _this2.toggleDescriptionExpand = _this2.toggleDescriptionExpand.bind(_assertThisInitialized(_this2)); - _this2.makeShortContent = _this2.makeShortContent.bind(_assertThisInitialized(_this2)); - _this2.havePermissionToEdit = _this2.havePermissionToEdit.bind(_assertThisInitialized(_this2)); - _this2.descriptionHeight = null; - _this2.state = { + _this3 = _callSuper(this, FlexibleDescriptionBox, [props]); + _this3.dimensions = _this3.dimensions.bind(_this3); + _this3.checkWillDescriptionFitOneLineAndUpdateHeight = _this3.checkWillDescriptionFitOneLineAndUpdateHeight.bind(_this3); + _this3.toggleDescriptionExpand = _this3.toggleDescriptionExpand.bind(_this3); + _this3.makeShortContent = _this3.makeShortContent.bind(_this3); + _this3.havePermissionToEdit = _this3.havePermissionToEdit.bind(_this3); + _this3.descriptionHeight = null; + _this3.state = { 'descriptionExpanded': props.defaultExpanded, 'descriptionWillFitOneLine': true, - 'descriptionWhiteSpace': _this2.props.linesOfText > 1 ? 'normal' : 'nowrap', + 'descriptionWhiteSpace': _this3.props.linesOfText > 1 ? 'normal' : 'nowrap', 'shortContent': null, 'mounted': false }; - return _this2; + return _this3; } - _createClass(FlexibleDescriptionBox, [{ + _inherits(FlexibleDescriptionBox, _React$Component3); + return _createClass(FlexibleDescriptionBox, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps) { - var _this3 = this; + var _this4 = this; // Handle window resize if (pastProps.windowWidth !== this.props.windowWidth) { // Recalculate some layouting stuff raf(function () { - _this3.setState(function () { - _this3.descriptionHeight; - var willDescriptionFitAtNewWindowSize = _this3.checkWillDescriptionFitOneLineAndUpdateHeight(); + _this4.setState(function () { + _this4.descriptionHeight; + var willDescriptionFitAtNewWindowSize = _this4.checkWillDescriptionFitOneLineAndUpdateHeight(); return { 'descriptionWillFitOneLine': willDescriptionFitAtNewWindowSize, - 'shortContent': _this3.props.linesOfText > 1 ? _this3.makeShortContent() : null + 'shortContent': _this4.props.linesOfText > 1 ? _this4.makeShortContent() : null }; }); }); @@ -175,16 +175,16 @@ export var FlexibleDescriptionBox = /*#__PURE__*/function (_React$Component3) { }, { key: "componentDidMount", value: function componentDidMount() { - var _this4 = this; + var _this5 = this; if (this.props.debug) console.info("Mounted FlexibleDescriptionBox"); if (!isServerSide()) { // Create throttled version of toggleDescriptionExpand for button. this.throttledToggleDescriptionExpand = _.throttle(this.toggleDescriptionExpand, 350); window.addEventListener('resize', function () { - return _this4.updateDescriptionHeight(); + return _this5.updateDescriptionHeight(); }); setTimeout(function () { - _this4.updateDescriptionHeight(); + _this5.updateDescriptionHeight(); }, 50); } } @@ -258,7 +258,7 @@ export var FlexibleDescriptionBox = /*#__PURE__*/function (_React$Component3) { }, { key: "toggleDescriptionExpand", value: function toggleDescriptionExpand() { - var _this5 = this; + var _this6 = this; this.setState(function (_ref2) { var descriptionExpanded = _ref2.descriptionExpanded; return { @@ -266,12 +266,12 @@ export var FlexibleDescriptionBox = /*#__PURE__*/function (_React$Component3) { "descriptionExpanded": !descriptionExpanded }; }, function () { - var linesOfText = _this5.props.linesOfText; - var descriptionExpanded = _this5.state.descriptionExpanded; + var linesOfText = _this6.props.linesOfText; + var descriptionExpanded = _this6.state.descriptionExpanded; if (!descriptionExpanded && linesOfText === 1) { // Delay whiteSpace style since can't transition it w/ CSS3 setTimeout(function () { - _this5.setState({ + _this6.setState({ "descriptionWhiteSpace": 'nowrap' }); }, 350); @@ -379,7 +379,6 @@ export var FlexibleDescriptionBox = /*#__PURE__*/function (_React$Component3) { }, expanded ? description : shortContent || description)); } }]); - return FlexibleDescriptionBox; }(React.Component); _defineProperty(FlexibleDescriptionBox, "defaultDimensions", { 'paddingWidth': 0, diff --git a/es/components/ui/ItemDetailList.js b/es/components/ui/ItemDetailList.js index 4fb8c892..3d6de9f8 100644 --- a/es/components/ui/ItemDetailList.js +++ b/es/components/ui/ItemDetailList.js @@ -1,24 +1,25 @@ -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _extends from "@babel/runtime/helpers/extends"; +import _typeof from "@babel/runtime/helpers/typeof"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -120,18 +121,17 @@ export var SubItemListView = /*#__PURE__*/React.memo(function (props) { * @todo refactor or get rid of. */ var SubItemTable = /*#__PURE__*/function (_React$Component) { - _inherits(SubItemTable, _React$Component); - var _super = _createSuper(SubItemTable); function SubItemTable(props) { - var _this; + var _this2; _classCallCheck(this, SubItemTable); - _this = _super.call(this, props); - _this.state = { + _this2 = _callSuper(this, SubItemTable, [props]); + _this2.state = { 'mounted': false }; - return _this; + return _this2; } - _createClass(SubItemTable, [{ + _inherits(SubItemTable, _React$Component); + return _createClass(SubItemTable, [{ key: "componentDidMount", value: function componentDidMount() { this.setState({ @@ -475,7 +475,12 @@ var SubItemTable = /*#__PURE__*/function (_React$Component) { var valKey = valKeys[_i]; if (Array.isArray(v2[valKey])) { // Concatenate value in [v2] into value in [m] - m[valKey] = (m[valKey] || []).concat(v2[valKey]); + if (typeof m[valKey] === "number") { + m[valKey] = [m[valKey]].concat(v2[valKey]); + } else { + // m[valKey] is already an array + m[valKey] = (m[valKey] || []).concat(v2[valKey]); + } delete v2[valKey]; } else if (v2[valKey] && _typeof(v2[valKey]) === 'object') { // Extend value in [m] with value in [v2] @@ -716,20 +721,17 @@ var SubItemTable = /*#__PURE__*/function (_React$Component) { return fallbackTitle; } }]); - return SubItemTable; }(React.Component); var DetailRow = /*#__PURE__*/function (_React$PureComponent) { - _inherits(DetailRow, _React$PureComponent); - var _super2 = _createSuper(DetailRow); function DetailRow(props) { - var _this2; + var _this3; _classCallCheck(this, DetailRow); - _this2 = _super2.call(this, props); - _this2.handleToggle = _this2.handleToggle.bind(_assertThisInitialized(_this2)); - _this2.state = { + _this3 = _callSuper(this, DetailRow, [props]); + _this3.handleToggle = _this3.handleToggle.bind(_this3); + _this3.state = { 'isOpen': false }; - return _this2; + return _this3; } /** @@ -738,7 +740,8 @@ var DetailRow = /*#__PURE__*/function (_React$PureComponent) { * @param {React.SyntheticEvent} e - Mouse click event. Its preventDefault() method is called. * @returns {void} */ - _createClass(DetailRow, [{ + _inherits(DetailRow, _React$PureComponent); + return _createClass(DetailRow, [{ key: "handleToggle", value: function handleToggle(e) { e.preventDefault(); @@ -752,7 +755,7 @@ var DetailRow = /*#__PURE__*/function (_React$PureComponent) { }, { key: "render", value: function render() { - var _this3 = this; + var _this4 = this; var _this$props2 = this.props, label = _this$props2.label, labelNumber = _this$props2.labelNumber, @@ -810,7 +813,7 @@ var DetailRow = /*#__PURE__*/function (_React$PureComponent) { className: "array-group", "data-length": item.length }, React.Children.map(value.props.children, function (c, i) { - return /*#__PURE__*/React.createElement(DetailRow, _extends({}, _this3.props, { + return /*#__PURE__*/React.createElement(DetailRow, _extends({}, _this4.props, { label: i === 0 ? labelToShow : /*#__PURE__*/React.createElement("span", { className: "dim-duplicate" }, labelToShow), @@ -828,7 +831,6 @@ var DetailRow = /*#__PURE__*/function (_React$PureComponent) { }, value); } }]); - return DetailRow; }(React.PureComponent); /** * The list of properties contained within ItemDetailList. @@ -838,20 +840,19 @@ var DetailRow = /*#__PURE__*/function (_React$PureComponent) { * @type {Component} */ export var Detail = /*#__PURE__*/function (_React$PureComponent2) { - _inherits(Detail, _React$PureComponent2); - var _super3 = _createSuper(Detail); function Detail(props) { - var _this4; + var _this5; _classCallCheck(this, Detail); - _this4 = _super3.call(this, props); - _this4.renderDetailRow = _this4.renderDetailRow.bind(_assertThisInitialized(_this4)); - _this4.memoized = { + _this5 = _callSuper(this, Detail, [props]); + _this5.renderDetailRow = _this5.renderDetailRow.bind(_this5); + _this5.memoized = { columnDefinitions: memoize(Detail.columnDefinitions), generatedKeysLists: memoize(Detail.generatedKeysLists) }; - return _this4; + return _this5; } - _createClass(Detail, [{ + _inherits(Detail, _React$PureComponent2); + return _createClass(Detail, [{ key: "renderDetailRow", value: function renderDetailRow(key) { var _this$props3 = this.props, @@ -1083,7 +1084,6 @@ export var Detail = /*#__PURE__*/function (_React$PureComponent2) { }; } }]); - return Detail; }(React.PureComponent); _defineProperty(Detail, "SubItemTitle", SubItemTitle); _defineProperty(Detail, "propTypes", { @@ -1197,21 +1197,20 @@ var SeeMoreRowsButton = /*#__PURE__*/React.memo(function (_ref4) { * @type {Component} */ export var ItemDetailList = /*#__PURE__*/function (_React$PureComponent3) { - _inherits(ItemDetailList, _React$PureComponent3); - var _super4 = _createSuper(ItemDetailList); function ItemDetailList(props) { - var _this5; + var _this6; _classCallCheck(this, ItemDetailList); - _this5 = _super4.call(this, props); - _this5.handleToggleJSON = _this5.handleToggleJSON.bind(_assertThisInitialized(_this5)); - _this5.handleToggleCollapsed = _this5.handleToggleCollapsed.bind(_assertThisInitialized(_this5)); - _this5.state = { + _this6 = _callSuper(this, ItemDetailList, [props]); + _this6.handleToggleJSON = _this6.handleToggleJSON.bind(_this6); + _this6.handleToggleCollapsed = _this6.handleToggleCollapsed.bind(_this6); + _this6.state = { 'collapsed': true, 'showingJSON': false }; - return _this5; + return _this6; } - _createClass(ItemDetailList, [{ + _inherits(ItemDetailList, _React$PureComponent3); + return _createClass(ItemDetailList, [{ key: "handleToggleJSON", value: function handleToggleJSON() { this.setState(function (_ref5) { @@ -1330,7 +1329,6 @@ export var ItemDetailList = /*#__PURE__*/function (_React$PureComponent3) { }; } }]); - return ItemDetailList; }(React.PureComponent); _defineProperty(ItemDetailList, "Detail", Detail); _defineProperty(ItemDetailList, "defaultProps", { diff --git a/es/components/ui/LocalizedTime.js b/es/components/ui/LocalizedTime.js index 36e74275..7d7f5a76 100644 --- a/es/components/ui/LocalizedTime.js +++ b/es/components/ui/LocalizedTime.js @@ -1,16 +1,21 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import PropTypes from 'prop-types'; import memoize from 'memoize-one'; @@ -19,13 +24,11 @@ import { format as localFormat, zonedTimeToUtc, utcToZonedTime } from "date-fns- import { enUS } from "date-fns/locale"; import { isServerSide } from './../util/misc'; export var LocalizedTime = /*#__PURE__*/function (_React$Component) { - _inherits(LocalizedTime, _React$Component); - var _super = _createSuper(LocalizedTime); function LocalizedTime(props) { - var _this; + var _this2; _classCallCheck(this, LocalizedTime); - _this = _super.call(this, props); - _this.memoized = { + _this2 = _callSuper(this, LocalizedTime, [props]); + _this2.memoized = { getDateFns: memoize(function (dateFnsDate, timestamp) { var parsedTime = zonedTimeToUtc(timestamp); // console.log("parsedTime", parsedTime); @@ -34,12 +37,13 @@ export var LocalizedTime = /*#__PURE__*/function (_React$Component) { return new Date(); }) }; - _this.state = { + _this2.state = { 'mounted': false }; - return _this; + return _this2; } - _createClass(LocalizedTime, [{ + _inherits(LocalizedTime, _React$Component); + return _createClass(LocalizedTime, [{ key: "componentDidMount", value: function componentDidMount() { this.setState({ @@ -70,7 +74,6 @@ export var LocalizedTime = /*#__PURE__*/function (_React$Component) { } } }]); - return LocalizedTime; }(React.Component); LocalizedTime.propTypes = { dateFnsDate: function dateFnsDate(props, propName) { diff --git a/es/components/ui/PartialList.js b/es/components/ui/PartialList.js index 9a26b2aa..d6290c0c 100644 --- a/es/components/ui/PartialList.js +++ b/es/components/ui/PartialList.js @@ -1,16 +1,21 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} import React from 'react'; import Collapse from 'react-bootstrap/esm/Collapse'; import { console } from './../util'; @@ -79,23 +84,22 @@ Row.defaultProps = { */ export var PartialList = /*#__PURE__*/function (_React$PureComponent) { - _inherits(PartialList, _React$PureComponent); - var _super = _createSuper(PartialList); function PartialList(props) { - var _this; + var _this2; _classCallCheck(this, PartialList); - _this = _super.call(this, props); - _this.state = { + _this2 = _callSuper(this, PartialList, [props]); + _this2.state = { closing: false, lastOpen: props.open }; - _this.timeout = null; - return _this; + _this2.timeout = null; + return _this2; } - _createClass(PartialList, [{ + _inherits(PartialList, _React$PureComponent); + return _createClass(PartialList, [{ key: "componentDidUpdate", value: function componentDidUpdate(pastProps) { - var _this2 = this; + var _this3 = this; var _this$props = this.props, open = _this$props.open, _this$props$timeout = _this$props.timeout, @@ -104,7 +108,7 @@ export var PartialList = /*#__PURE__*/function (_React$PureComponent) { if (!open && pastOpen) { clearTimeout(this.timeout); this.timeout = setTimeout(function () { - _this2.setState({ + _this3.setState({ closing: false }); }, timeout); @@ -164,6 +168,5 @@ export var PartialList = /*#__PURE__*/function (_React$PureComponent) { }; } }]); - return PartialList; }(React.PureComponent); PartialList.Row = Row; \ No newline at end of file diff --git a/es/components/ui/YoutubeVideoEmbed.js b/es/components/ui/YoutubeVideoEmbed.js index e1ece073..079d7898 100644 --- a/es/components/ui/YoutubeVideoEmbed.js +++ b/es/components/ui/YoutubeVideoEmbed.js @@ -1,16 +1,21 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} /** * Much of this code was inspired by https://www.npmjs.com/package/react-lite-youtube-embed * @@ -25,20 +30,19 @@ import _ from 'underscore'; var YOUTUBE_BASE_URL = 'https://www.youtube.com'; var YT_IMG_URL = 'https://i.ytimg.com'; export var YoutubeVideoEmbed = /*#__PURE__*/function (_React$Component) { - _inherits(YoutubeVideoEmbed, _React$Component); - var _super = _createSuper(YoutubeVideoEmbed); function YoutubeVideoEmbed(props) { - var _this; + var _this2; _classCallCheck(this, YoutubeVideoEmbed); - _this = _super.call(this, props); - _this.state = { + _this2 = _callSuper(this, YoutubeVideoEmbed, [props]); + _this2.state = { showVideo: false, preconnected: false }; - _.bindAll(_assertThisInitialized(_this), ['showIframe', 'preconnectToYoutube', 'getIframeJSX']); - return _this; + _.bindAll(_this2, ['showIframe', 'preconnectToYoutube', 'getIframeJSX']); + return _this2; } - _createClass(YoutubeVideoEmbed, [{ + _inherits(YoutubeVideoEmbed, _React$Component); + return _createClass(YoutubeVideoEmbed, [{ key: "showIframe", value: function showIframe() { var showVideo = this.state.showVideo; @@ -151,7 +155,6 @@ export var YoutubeVideoEmbed = /*#__PURE__*/function (_React$Component) { })), showVideo ? this.getIframeJSX() : null)); } }]); - return YoutubeVideoEmbed; }(React.Component); YoutubeVideoEmbed.defaultProps = { videoID: null, diff --git a/es/components/util/ajax.js b/es/components/util/ajax.js index 35219496..ae2cd0ab 100644 --- a/es/components/util/ajax.js +++ b/es/components/util/ajax.js @@ -1,28 +1,27 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; var _excluded = ["children", "fetchedItemPropName", "isFetchingItemPropName"]; -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } import React, { useState, useEffect } from 'react'; import { Alerts } from './../ui/Alerts'; import _ from 'underscore'; @@ -273,7 +272,7 @@ export var PromiseQueue = /*#__PURE__*/function () { this.pendingPromise = false; this.stop = false; } - _createClass(PromiseQueue, [{ + return _createClass(PromiseQueue, [{ key: "enqueue", value: function enqueue(promise) { var _this = this; @@ -321,7 +320,6 @@ export var PromiseQueue = /*#__PURE__*/function () { return true; } }]); - return PromiseQueue; }(); /** @@ -333,13 +331,11 @@ export var PromiseQueue = /*#__PURE__*/function () { * albeit quite a bit simpler hopefully. */ export var FetchedItem = /*#__PURE__*/function (_React$Component) { - _inherits(FetchedItem, _React$Component); - var _super = _createSuper(FetchedItem); function FetchedItem(props) { var _this3; _classCallCheck(this, FetchedItem); - _this3 = _super.call(this, props); - _this3.fetchItem = _this3.fetchItem.bind(_assertThisInitialized(_this3)); + _this3 = _callSuper(this, FetchedItem, [props]); + _this3.fetchItem = _this3.fetchItem.bind(_this3); _this3.state = { "fetchedItem": null, "isFetchingItem": !!props.atId, @@ -347,7 +343,8 @@ export var FetchedItem = /*#__PURE__*/function (_React$Component) { }; return _this3; } - _createClass(FetchedItem, [{ + _inherits(FetchedItem, _React$Component); + return _createClass(FetchedItem, [{ key: "componentDidMount", value: function componentDidMount() { this.fetchItem(); @@ -394,7 +391,6 @@ export var FetchedItem = /*#__PURE__*/function (_React$Component) { }, { key: "render", value: function render() { - var _objectSpread2; var _this$props = this.props, children = _this$props.children, fetchedItemPropName = _this$props.fetchedItemPropName, @@ -404,7 +400,7 @@ export var FetchedItem = /*#__PURE__*/function (_React$Component) { fetchedItem = _this$state.fetchedItem, isFetchingItem = _this$state.isFetchingItem, fetchedItemError = _this$state.fetchedItemError; - var passProps = _objectSpread(_objectSpread({}, remainingProps), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, fetchedItemPropName, fetchedItem), _defineProperty(_objectSpread2, isFetchingItemPropName, isFetchingItem), _objectSpread2)); + var passProps = _objectSpread(_objectSpread({}, remainingProps), {}, _defineProperty(_defineProperty({}, fetchedItemPropName, fetchedItem), isFetchingItemPropName, isFetchingItem)); if (fetchedItemError) { delete passProps[isFetchingItemPropName]; passProps[isFetchingItemPropName + "Error"] = fetchedItemError; @@ -420,7 +416,6 @@ export var FetchedItem = /*#__PURE__*/function (_React$Component) { }); } }]); - return FetchedItem; }(React.Component); /** diff --git a/es/components/util/analytics.js b/es/components/util/analytics.js index fce2b55c..982c0a49 100644 --- a/es/components/util/analytics.js +++ b/es/components/util/analytics.js @@ -1,18 +1,10 @@ +import _typeof from "@babel/runtime/helpers/typeof"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; var _excluded = ["initialContext", "initialHref"]; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } import _ from 'underscore'; import url from 'url'; import queryString from 'query-string'; diff --git a/es/components/util/file.js b/es/components/util/file.js index 54d3b3f3..2e1cdc30 100644 --- a/es/components/util/file.js +++ b/es/components/util/file.js @@ -1,10 +1,5 @@ -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _typeof from "@babel/runtime/helpers/typeof"; var CryptoJS = require('crypto-js'); import _ from 'underscore'; import memoize from 'memoize-one'; diff --git a/es/components/util/misc.js b/es/components/util/misc.js index ce04a3f7..22e5c986 100644 --- a/es/components/util/misc.js +++ b/es/components/util/misc.js @@ -1,4 +1,4 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _typeof from "@babel/runtime/helpers/typeof"; import memoize from 'memoize-one'; import url from 'url'; diff --git a/es/components/util/object.js b/es/components/util/object.js index 1df99ed0..79c64001 100644 --- a/es/components/util/object.js +++ b/es/components/util/object.js @@ -1,28 +1,28 @@ -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; +import _createClass from "@babel/runtime/helpers/createClass"; +import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; +import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; +import _inherits from "@babel/runtime/helpers/inherits"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _extends from "@babel/runtime/helpers/extends"; +import _typeof from "@babel/runtime/helpers/typeof"; +function _callSuper(_this, derived, args) { + derived = _getPrototypeOf(derived); + return _possibleConstructorReturn(_this, function () { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (e) { + return false; + } + }() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args)); +} +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } import _ from 'underscore'; import React from 'react'; import ReactDOM from 'react-dom'; @@ -554,22 +554,21 @@ TooltipInfoIconContainerAuto.propTypes = { * @prop {string|React.Component} [wrapperElement='div'] - Element type to wrap props.children in, if any. */ export var CopyWrapper = /*#__PURE__*/function (_React$PureComponent) { - _inherits(CopyWrapper, _React$PureComponent); - var _super = _createSuper(CopyWrapper); function CopyWrapper(props) { - var _this; + var _this2; _classCallCheck(this, CopyWrapper); - _this = _super.call(this, props); - _this.flashEffect = _this.flashEffect.bind(_assertThisInitialized(_this)); + _this2 = _callSuper(this, CopyWrapper, [props]); + _this2.flashEffect = _this2.flashEffect.bind(_this2); if (typeof props.mounted !== 'boolean') { - _this.state = { + _this2.state = { 'mounted': false }; } - _this.wrapperRef = /*#__PURE__*/React.createRef(); - return _this; + _this2.wrapperRef = /*#__PURE__*/React.createRef(); + return _this2; } - _createClass(CopyWrapper, [{ + _inherits(CopyWrapper, _React$PureComponent); + return _createClass(CopyWrapper, [{ key: "componentDidMount", value: function componentDidMount() { var mounted = this.props.mounted; @@ -616,7 +615,7 @@ export var CopyWrapper = /*#__PURE__*/function (_React$PureComponent) { }, { key: "render", value: function render() { - var _this2 = this; + var _this3 = this; var _this$props2 = this.props, value = _this$props2.value, children = _this$props2.children, @@ -654,7 +653,7 @@ export var CopyWrapper = /*#__PURE__*/function (_React$PureComponent) { e.stopPropagation(); } CopyWrapper.copyToClipboard(value, function (v) { - _this2.onCopy(); + _this3.onCopy(); analyticsOnCopy && analytics.event('copy_wrapper', 'CopyWrapper', 'Copy', null, { 'value': maskAnalyticsValue ? '[value_is_masked]' : v }); @@ -709,7 +708,6 @@ export var CopyWrapper = /*#__PURE__*/function (_React$PureComponent) { } } }]); - return CopyWrapper; }(React.PureComponent); CopyWrapper.defaultProps = { 'wrapperElement': 'div', diff --git a/es/components/util/schema-transforms.js b/es/components/util/schema-transforms.js index f154e873..0eea528a 100644 --- a/es/components/util/schema-transforms.js +++ b/es/components/util/schema-transforms.js @@ -1,9 +1,4 @@ -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; import _ from 'underscore'; import memoize from 'memoize-one'; import { patchedConsoleInstance as console } from './patched-console'; diff --git a/es/components/util/search-filters.js b/es/components/util/search-filters.js index 9cef4860..caa6179b 100644 --- a/es/components/util/search-filters.js +++ b/es/components/util/search-filters.js @@ -1,15 +1,9 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +import _typeof from "@babel/runtime/helpers/typeof"; +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } var Alerts = null; //require('./../alerts'); import _ from 'underscore'; diff --git a/es/components/util/submission-view.js b/es/components/util/submission-view.js index 24dc0a34..16277629 100644 --- a/es/components/util/submission-view.js +++ b/es/components/util/submission-view.js @@ -1,10 +1,5 @@ -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _typeof from "@babel/runtime/helpers/typeof"; /* This file contains utilities specific to the SubmissionView component. Many of these are helpers for managing the top level state of that component/its children. They are organized within their categories diff --git a/es/components/viz/utilities.js b/es/components/viz/utilities.js index 925589d9..6fe203dc 100644 --- a/es/components/viz/utilities.js +++ b/es/components/viz/utilities.js @@ -1,4 +1,4 @@ -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +import _typeof from "@babel/runtime/helpers/typeof"; import React from 'react'; import _ from 'underscore'; import { isServerSide } from './../util/misc'; diff --git a/src/components/ui/ItemDetailList.js b/src/components/ui/ItemDetailList.js index d37ff591..dcb9b461 100644 --- a/src/components/ui/ItemDetailList.js +++ b/src/components/ui/ItemDetailList.js @@ -139,7 +139,12 @@ class SubItemTable extends React.Component { if (Array.isArray(v2[valKey])){ // Concatenate value in [v2] into value in [m] - m[valKey] = (m[valKey] || []).concat(v2[valKey]); + if (typeof m[valKey] === "number") { + m[valKey] = [m[valKey]].concat(v2[valKey]); + } + else { // m[valKey] is already an array + m[valKey] = (m[valKey] || []).concat(v2[valKey]); + } delete v2[valKey]; } else if (v2[valKey] && typeof v2[valKey] === 'object') { // Extend value in [m] with value in [v2]