UNPKG

8.03 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports["default"] = void 0;
7
8var _react = _interopRequireWildcard(require("react"));
9
10var _propTypes = _interopRequireDefault(require("prop-types"));
11
12var _LogMonitorEntry = _interopRequireDefault(require("./LogMonitorEntry"));
13
14var _function = _interopRequireDefault(require("react-pure-render/function"));
15
16function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
18function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
19
20function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
22function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23
24function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
26function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
28function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
29
30function _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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
32function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
34function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { 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); }; }
35
36function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
37
38function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
40function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
41
42function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
44function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
46var LogMonitorEntryList = /*#__PURE__*/function (_Component) {
47 _inherits(LogMonitorEntryList, _Component);
48
49 var _super = _createSuper(LogMonitorEntryList);
50
51 function LogMonitorEntryList() {
52 var _this;
53
54 _classCallCheck(this, LogMonitorEntryList);
55
56 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
57 args[_key] = arguments[_key];
58 }
59
60 _this = _super.call.apply(_super, [this].concat(args));
61
62 _defineProperty(_assertThisInitialized(_this), "shouldComponentUpdate", _function["default"]);
63
64 return _this;
65 }
66
67 _createClass(LogMonitorEntryList, [{
68 key: "render",
69 value: function render() {
70 var elements = [];
71 var _this$props = this.props,
72 theme = _this$props.theme,
73 actionsById = _this$props.actionsById,
74 computedStates = _this$props.computedStates,
75 currentStateIndex = _this$props.currentStateIndex,
76 consecutiveToggleStartId = _this$props.consecutiveToggleStartId,
77 select = _this$props.select,
78 skippedActionIds = _this$props.skippedActionIds,
79 stagedActionIds = _this$props.stagedActionIds,
80 expandActionRoot = _this$props.expandActionRoot,
81 expandStateRoot = _this$props.expandStateRoot,
82 markStateDiff = _this$props.markStateDiff,
83 onActionClick = _this$props.onActionClick,
84 onActionShiftClick = _this$props.onActionShiftClick;
85
86 for (var i = 0; i < stagedActionIds.length; i++) {
87 var actionId = stagedActionIds[i];
88 var action = actionsById[actionId].action;
89 var _computedStates$i = computedStates[i],
90 state = _computedStates$i.state,
91 error = _computedStates$i.error;
92 var previousState = void 0;
93
94 if (i > 0) {
95 previousState = computedStates[i - 1].state;
96 }
97
98 elements.push( /*#__PURE__*/_react["default"].createElement(_LogMonitorEntry["default"], {
99 key: actionId,
100 theme: theme,
101 select: select,
102 action: action,
103 actionId: actionId,
104 state: state,
105 previousState: previousState,
106 collapsed: skippedActionIds.indexOf(actionId) > -1,
107 inFuture: i > currentStateIndex,
108 selected: consecutiveToggleStartId === i,
109 error: error,
110 expandActionRoot: expandActionRoot,
111 expandStateRoot: expandStateRoot,
112 markStateDiff: markStateDiff,
113 onActionClick: onActionClick,
114 onActionShiftClick: onActionShiftClick
115 }));
116 }
117
118 return /*#__PURE__*/_react["default"].createElement("div", null, elements);
119 }
120 }]);
121
122 return LogMonitorEntryList;
123}(_react.Component);
124
125exports["default"] = LogMonitorEntryList;
126
127_defineProperty(LogMonitorEntryList, "propTypes", {
128 actionsById: _propTypes["default"].object,
129 computedStates: _propTypes["default"].array,
130 stagedActionIds: _propTypes["default"].array,
131 skippedActionIds: _propTypes["default"].array,
132 currentStateIndex: _propTypes["default"].number,
133 consecutiveToggleStartId: _propTypes["default"].number,
134 select: _propTypes["default"].func.isRequired,
135 onActionClick: _propTypes["default"].func.isRequired,
136 theme: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].string]),
137 expandActionRoot: _propTypes["default"].bool,
138 expandStateRoot: _propTypes["default"].bool
139});
\No newline at end of file