diff --git a/packages/hierarchical-tags/example/plugin.js b/packages/hierarchical-tags/example/plugin.js index c7526df..2ffdb2b 100644 --- a/packages/hierarchical-tags/example/plugin.js +++ b/packages/hierarchical-tags/example/plugin.js @@ -420,7 +420,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HierarchicalOperationTag\", function() { return HierarchicalOperationTag; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ \"./node_modules/@babel/runtime/helpers/createClass.js\");\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ \"./node_modules/@babel/runtime/helpers/assertThisInitialized.js\");\n/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react-immutable-proptypes */ \"./node_modules/react-immutable-proptypes/dist/ImmutablePropTypes.js\");\n/* harmony import */ var react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! immutable */ \"./node_modules/immutable/dist/immutable.js\");\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(immutable__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Utils */ \"./src/Utils.js\");\n\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result); }; }\n\nfunction _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; } }\n\n\n\n\n\n\nvar SWAGGER2_OPERATION_METHODS = [\"get\", \"put\", \"post\", \"delete\", \"options\", \"head\", \"patch\"];\nvar OAS3_OPERATION_METHODS = SWAGGER2_OPERATION_METHODS.concat([\"trace\"]);\nvar HierarchicalOperationTag = /*#__PURE__*/function (_React$Component) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(HierarchicalOperationTag, _React$Component);\n\n var _super = _createSuper(HierarchicalOperationTag);\n\n function HierarchicalOperationTag(props) {\n var _this;\n\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, HierarchicalOperationTag);\n\n _this = _super.call(this, props);\n _this.render = _this.render.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this));\n _this.renderChildTags = _this.renderChildTags.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this));\n return _this;\n }\n\n _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(HierarchicalOperationTag, [{\n key: \"render\",\n value: function render() {\n // If this is the root element, just render the child tags\n if (this.props.isRoot) {\n return this.renderChildTags(this.props.childTags);\n } // Otherwise, we're rendering the individual elements, so proceed with full render\n // Get the necessary props\n\n\n var _this$props = this.props,\n tagObj = _this$props.tagObj,\n tag = _this$props.tag,\n childTags = _this$props.childTags,\n oas3Selectors = _this$props.oas3Selectors,\n layoutSelectors = _this$props.layoutSelectors,\n layoutActions = _this$props.layoutActions,\n getConfigs = _this$props.getConfigs,\n getComponent = _this$props.getComponent,\n specSelectors = _this$props.specSelectors,\n specUrl = _this$props.specUrl;\n\n var _getConfigs = getConfigs(),\n docExpansion = _getConfigs.docExpansion,\n deepLinking = _getConfigs.deepLinking; // Get the necessary components\n\n\n var OperationContainer = getComponent(\"OperationContainer\", true);\n var Collapse = getComponent(\"Collapse\");\n var Markdown = getComponent(\"Markdown\", true);\n var DeepLink = getComponent(\"DeepLink\");\n var Link = getComponent(\"Link\"); // Set up some helpers\n\n var isDeepLinkingEnabled = deepLinking && deepLinking !== \"false\";\n var tagDescription = tagObj ? tagObj.getIn([\"tagDetails\", \"description\"], null) : null;\n var tagExternalDocsDescription = tagObj ? tagObj.getIn([\"tagDetails\", \"externalDocs\", \"description\"]) : null;\n var rawTagExternalDocsUrl = tagObj ? tagObj.getIn([\"tagDetails\", \"externalDocs\", \"url\"]) : null;\n var tagExternalDocsUrl = Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"isFunc\"])(oas3Selectors) && Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"isFunc\"])(oas3Selectors.selectedServer) ? Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"buildUrl\"])(rawTagExternalDocsUrl, specUrl, {\n selectedServer: oas3Selectors.selectedServer()\n }) : rawTagExternalDocsUrl;\n var operations = tagObj ? tagObj.get(\"operations\") : immutable__WEBPACK_IMPORTED_MODULE_11___default.a.fromJS({});\n var canonicalTagName = tagObj && tagObj.get(\"canonicalTagName\") || tag;\n var isShownKey = [\"operations-tag\", canonicalTagName];\n var showTag = layoutSelectors.isShown(isShownKey, docExpansion === \"full\" || docExpansion === \"list\");\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", {\n className: showTag ? \"opblock-tag-section is-open\" : \"opblock-tag-section\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"h4\", {\n onClick: function onClick() {\n return layoutActions.show(isShownKey, !showTag);\n },\n className: !tagDescription ? \"opblock-tag no-desc\" : \"opblock-tag\",\n id: isShownKey.map(function (v) {\n return Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"escapeDeepLinkPath\"])(v);\n }).join(\"-\"),\n \"data-tag\": canonicalTagName,\n \"data-is-open\": showTag\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(DeepLink, {\n enabled: isDeepLinkingEnabled,\n isShown: showTag,\n path: Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"createDeepLinkPath\"])(tag),\n text: tag\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"small\", null, tagDescription ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(Markdown, {\n source: tagDescription\n }) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", null, !tagExternalDocsDescription ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"small\", null, tagExternalDocsDescription, !tagExternalDocsUrl ? null : \": \", !tagExternalDocsUrl ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(Link, {\n href: Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"sanitizeUrl\"])(tagExternalDocsUrl),\n onClick: function onClick(e) {\n return e.stopPropagation();\n },\n target: \"_blank\"\n }, tagExternalDocsUrl))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"button\", {\n className: \"expand-operation\",\n title: showTag ? \"Collapse operation\" : \"Expand operation\",\n onClick: function onClick() {\n return layoutActions.show(isShownKey, !showTag);\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"svg\", {\n className: \"arrow\",\n width: \"20\",\n height: \"20\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"use\", {\n href: showTag ? \"#large-arrow-down\" : \"#large-arrow\",\n xlinkHref: showTag ? \"#large-arrow-down\" : \"#large-arrow\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(Collapse, {\n isOpened: showTag\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", {\n \"class\": \"hierarchical-operation-tag-operations\"\n }, operations.map(function (op) {\n var path = op.get(\"path\");\n var method = op.get(\"method\");\n var specPath = immutable__WEBPACK_IMPORTED_MODULE_11___default.a.List([\"paths\", path, method]); // FIXME: (someday) this logic should probably be in a selector,\n // but doing so would require further opening up\n // selectors to the plugin system, to allow for dynamic\n // overriding of low-level selectors that other selectors\n // rely on. --KS, 12/17\n\n var validMethods = specSelectors.isOAS3() ? OAS3_OPERATION_METHODS : SWAGGER2_OPERATION_METHODS;\n\n if (validMethods.indexOf(method) === -1) {\n return null;\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(OperationContainer, {\n key: \"\".concat(method, \"-\").concat(path),\n specPath: specPath,\n op: op,\n path: path,\n method: method,\n tag: tag\n });\n }).toArray()), this.renderChildTags(childTags)));\n }\n }, {\n key: \"renderChildTags\",\n value: function renderChildTags(childTags) {\n if (!childTags || Object.keys(childTags).length === 0) {\n return null;\n }\n\n var _this$props2 = this.props,\n oas3Selectors = _this$props2.oas3Selectors,\n layoutSelectors = _this$props2.layoutSelectors,\n layoutActions = _this$props2.layoutActions,\n getConfigs = _this$props2.getConfigs,\n getComponent = _this$props2.getComponent,\n specSelectors = _this$props2.specSelectors,\n isRoot = _this$props2.isRoot;\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", {\n className: \"hierarchical-operation-tags\",\n style: isRoot ? null : {\n margin: \"0 0 0 1.2rem\",\n paddingLeft: \"0.8rem\",\n borderLeft: \"1px solid #ccc\"\n }\n }, Object.entries(childTags).map(function (_ref) {\n var _ref2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref, 2),\n tag = _ref2[0],\n data = _ref2[1];\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(HierarchicalOperationTag, {\n key: \"operation-\" + (data.data && data.data.get(\"canonicalTagName\") || tag),\n tagObj: data.data,\n tag: tag,\n specSelectors: specSelectors,\n oas3Selectors: oas3Selectors,\n layoutSelectors: layoutSelectors,\n layoutActions: layoutActions,\n getConfigs: getConfigs,\n getComponent: getComponent,\n childTags: data.childTags,\n isRoot: false\n });\n }));\n }\n }]);\n\n return HierarchicalOperationTag;\n}(react__WEBPACK_IMPORTED_MODULE_8___default.a.Component);\n\n_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(HierarchicalOperationTag, \"defaultProps\", {\n tagObj: immutable__WEBPACK_IMPORTED_MODULE_11___default.a.fromJS({}),\n tag: \"\"\n});\n\n_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(HierarchicalOperationTag, \"propTypes\", {\n tagObj: react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10___default.a.map,\n tag: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.string,\n childTags: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n specSelectors: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n oas3Selectors: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n layoutSelectors: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n layoutActions: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n getConfigs: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.func.isRequired,\n getComponent: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.func.isRequired,\n children: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.element),\n isRoot: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.bool\n});\n\n//# sourceURL=webpack://YourLibraryName/./src/HierarchicalOperationTag.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HierarchicalOperationTag\", function() { return HierarchicalOperationTag; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ \"./node_modules/@babel/runtime/helpers/createClass.js\");\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ \"./node_modules/@babel/runtime/helpers/assertThisInitialized.js\");\n/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react-immutable-proptypes */ \"./node_modules/react-immutable-proptypes/dist/ImmutablePropTypes.js\");\n/* harmony import */ var react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! immutable */ \"./node_modules/immutable/dist/immutable.js\");\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(immutable__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Utils */ \"./src/Utils.js\");\n\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result); }; }\n\nfunction _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; } }\n\n\n\n\n\n\nvar SWAGGER2_OPERATION_METHODS = [\"get\", \"put\", \"post\", \"delete\", \"options\", \"head\", \"patch\"];\nvar OAS3_OPERATION_METHODS = SWAGGER2_OPERATION_METHODS.concat([\"trace\"]);\nvar HierarchicalOperationTag = /*#__PURE__*/function (_React$Component) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(HierarchicalOperationTag, _React$Component);\n\n var _super = _createSuper(HierarchicalOperationTag);\n\n function HierarchicalOperationTag(props) {\n var _this;\n\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, HierarchicalOperationTag);\n\n _this = _super.call(this, props);\n _this.render = _this.render.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this));\n _this.renderChildTags = _this.renderChildTags.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this));\n return _this;\n }\n\n _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(HierarchicalOperationTag, [{\n key: \"render\",\n value: function render() {\n // If this is the root element, just render the child tags\n if (this.props.isRoot) {\n return this.renderChildTags(this.props.childTags);\n } // Otherwise, we're rendering the individual elements, so proceed with full render\n // Get the necessary props\n\n\n var _this$props = this.props,\n tagObj = _this$props.tagObj,\n tag = _this$props.tag,\n childTags = _this$props.childTags,\n oas3Selectors = _this$props.oas3Selectors,\n layoutSelectors = _this$props.layoutSelectors,\n layoutActions = _this$props.layoutActions,\n getConfigs = _this$props.getConfigs,\n getComponent = _this$props.getComponent,\n specSelectors = _this$props.specSelectors;\n var specUrl = specSelectors.url();\n\n var _getConfigs = getConfigs(),\n docExpansion = _getConfigs.docExpansion,\n deepLinking = _getConfigs.deepLinking; // Get the necessary components\n\n\n var OperationContainer = getComponent(\"OperationContainer\", true);\n var Collapse = getComponent(\"Collapse\");\n var Markdown = getComponent(\"Markdown\", true);\n var DeepLink = getComponent(\"DeepLink\");\n var Link = getComponent(\"Link\"); // Set up some helpers\n\n var isDeepLinkingEnabled = deepLinking && deepLinking !== \"false\";\n var tagDescription = tagObj ? tagObj.getIn([\"tagDetails\", \"description\"], null) : null;\n var tagExternalDocsDescription = tagObj ? tagObj.getIn([\"tagDetails\", \"externalDocs\", \"description\"]) : null;\n var rawTagExternalDocsUrl = tagObj ? tagObj.getIn([\"tagDetails\", \"externalDocs\", \"url\"]) : null;\n var tagExternalDocsUrl = Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"isFunc\"])(oas3Selectors) && Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"isFunc\"])(oas3Selectors.selectedServer) ? Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"buildUrl\"])(rawTagExternalDocsUrl, specUrl, {\n selectedServer: oas3Selectors.selectedServer()\n }) : rawTagExternalDocsUrl;\n var operations = tagObj ? tagObj.get(\"operations\") : immutable__WEBPACK_IMPORTED_MODULE_11___default.a.fromJS({});\n var canonicalTagName = tagObj && tagObj.get(\"canonicalTagName\") || tag;\n var isShownKey = [\"operations-tag\", canonicalTagName];\n var showTag = layoutSelectors.isShown(isShownKey, docExpansion === \"full\" || docExpansion === \"list\");\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", {\n className: showTag ? \"opblock-tag-section is-open\" : \"opblock-tag-section\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"h4\", {\n onClick: function onClick() {\n return layoutActions.show(isShownKey, !showTag);\n },\n className: !tagDescription ? \"opblock-tag no-desc\" : \"opblock-tag\",\n id: isShownKey.map(function (v) {\n return Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"escapeDeepLinkPath\"])(v);\n }).join(\"-\"),\n \"data-tag\": canonicalTagName,\n \"data-is-open\": showTag\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(DeepLink, {\n enabled: isDeepLinkingEnabled,\n isShown: showTag,\n path: Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"createDeepLinkPath\"])(tag),\n text: tag\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"small\", null, tagDescription ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(Markdown, {\n source: tagDescription\n }) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", null, !tagExternalDocsDescription ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"small\", null, tagExternalDocsDescription, !tagExternalDocsUrl ? null : \": \", !tagExternalDocsUrl ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(Link, {\n href: Object(_Utils__WEBPACK_IMPORTED_MODULE_12__[\"sanitizeUrl\"])(tagExternalDocsUrl),\n onClick: function onClick(e) {\n return e.stopPropagation();\n },\n target: \"_blank\"\n }, tagExternalDocsUrl))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"button\", {\n className: \"expand-operation\",\n title: showTag ? \"Collapse operation\" : \"Expand operation\",\n onClick: function onClick() {\n return layoutActions.show(isShownKey, !showTag);\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"svg\", {\n className: \"arrow\",\n width: \"20\",\n height: \"20\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"use\", {\n href: showTag ? \"#large-arrow-down\" : \"#large-arrow\",\n xlinkHref: showTag ? \"#large-arrow-down\" : \"#large-arrow\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(Collapse, {\n isOpened: showTag\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", {\n \"class\": \"hierarchical-operation-tag-operations\"\n }, operations.map(function (op) {\n var path = op.get(\"path\");\n var method = op.get(\"method\");\n var specPath = immutable__WEBPACK_IMPORTED_MODULE_11___default.a.List([\"paths\", path, method]); // FIXME: (someday) this logic should probably be in a selector,\n // but doing so would require further opening up\n // selectors to the plugin system, to allow for dynamic\n // overriding of low-level selectors that other selectors\n // rely on. --KS, 12/17\n\n var validMethods = specSelectors.isOAS3() ? OAS3_OPERATION_METHODS : SWAGGER2_OPERATION_METHODS;\n\n if (validMethods.indexOf(method) === -1) {\n return null;\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(OperationContainer, {\n key: \"\".concat(method, \"-\").concat(path),\n specPath: specPath,\n op: op,\n path: path,\n method: method,\n tag: tag\n });\n }).toArray()), this.renderChildTags(childTags)));\n }\n }, {\n key: \"renderChildTags\",\n value: function renderChildTags(childTags) {\n if (!childTags || Object.keys(childTags).length === 0) {\n return null;\n }\n\n var _this$props2 = this.props,\n oas3Selectors = _this$props2.oas3Selectors,\n layoutSelectors = _this$props2.layoutSelectors,\n layoutActions = _this$props2.layoutActions,\n getConfigs = _this$props2.getConfigs,\n getComponent = _this$props2.getComponent,\n specSelectors = _this$props2.specSelectors,\n isRoot = _this$props2.isRoot;\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(\"div\", {\n className: \"hierarchical-operation-tags\",\n style: isRoot ? null : {\n margin: \"0 0 0 1.2rem\",\n paddingLeft: \"0.8rem\",\n borderLeft: \"1px solid #ccc\"\n }\n }, Object.entries(childTags).map(function (_ref) {\n var _ref2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref, 2),\n tag = _ref2[0],\n data = _ref2[1];\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8___default.a.createElement(HierarchicalOperationTag, {\n key: \"operation-\" + (data.data && data.data.get(\"canonicalTagName\") || tag),\n tagObj: data.data,\n tag: tag,\n specSelectors: specSelectors,\n oas3Selectors: oas3Selectors,\n layoutSelectors: layoutSelectors,\n layoutActions: layoutActions,\n getConfigs: getConfigs,\n getComponent: getComponent,\n childTags: data.childTags,\n isRoot: false\n });\n }));\n }\n }]);\n\n return HierarchicalOperationTag;\n}(react__WEBPACK_IMPORTED_MODULE_8___default.a.Component);\n\n_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(HierarchicalOperationTag, \"defaultProps\", {\n tagObj: immutable__WEBPACK_IMPORTED_MODULE_11___default.a.fromJS({}),\n tag: \"\"\n});\n\n_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(HierarchicalOperationTag, \"propTypes\", {\n tagObj: react_immutable_proptypes__WEBPACK_IMPORTED_MODULE_10___default.a.map,\n tag: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.string,\n childTags: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n specSelectors: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n oas3Selectors: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n layoutSelectors: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n layoutActions: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.object.isRequired,\n getConfigs: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.func.isRequired,\n getComponent: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.func.isRequired,\n children: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.element),\n isRoot: prop_types__WEBPACK_IMPORTED_MODULE_9___default.a.bool\n});\n\n//# sourceURL=webpack://YourLibraryName/./src/HierarchicalOperationTag.jsx?"); /***/ }), @@ -432,7 +432,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HierarchicalOperations\", function() { return HierarchicalOperations; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ \"./node_modules/@babel/runtime/helpers/createClass.js\");\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! immutable */ \"./node_modules/immutable/dist/immutable.js\");\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(immutable__WEBPACK_IMPORTED_MODULE_8__);\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }\n\nfunction _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; } }\n\n\n\n\n/**\n * This is a direct copy of [this file](https://github.com/swagger-api/swagger-ui/blob/d3a65060628b79729445bc155f6d96a1ed1cd426/src/core/components/operations.jsx),\n * which was then modified to accommodate the necessary recursion for this plugin.\n */\n\nvar HierarchicalOperations = /*#__PURE__*/function (_React$Component) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(HierarchicalOperations, _React$Component);\n\n var _super = _createSuper(HierarchicalOperations);\n\n function HierarchicalOperations() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, HierarchicalOperations);\n\n return _super.apply(this, arguments);\n }\n\n _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(HierarchicalOperations, [{\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n specSelectors = _this$props.specSelectors,\n getComponent = _this$props.getComponent,\n oas3Selectors = _this$props.oas3Selectors,\n layoutSelectors = _this$props.layoutSelectors,\n layoutActions = _this$props.layoutActions,\n getConfigs = _this$props.getConfigs,\n fn = _this$props.fn;\n console.log({\n props: this.props\n });\n console.log({\n configs: getConfigs()\n });\n console.log(\"hello hello\"); // Get a flat map of tags to their set of operations\n\n var taggedOps = specSelectors.taggedOperations(); // Get the component we need\n\n var HierarchicalOperationTag = getComponent(\"HierarchicalOperationTag\");\n\n var _getConfigs = getConfigs(),\n maxDisplayedTags = _getConfigs.maxDisplayedTags,\n hierarchicalTagSeparator = _getConfigs.hierarchicalTagSeparator;\n\n if (!hierarchicalTagSeparator) {\n hierarchicalTagSeparator = /[:|>]/;\n }\n\n console.log({\n hierarchicalTagSeparator: hierarchicalTagSeparator\n });\n var filter = layoutSelectors.currentFilter();\n\n if (filter) {\n if (filter !== true && filter !== \"true\" && filter !== \"false\") {\n taggedOps = fn.opsFilter(taggedOps, filter);\n }\n }\n\n if (maxDisplayedTags && !isNaN(maxDisplayedTags) && maxDisplayedTags >= 0) {\n taggedOps = taggedOps.slice(0, maxDisplayedTags);\n }\n /**\n * Each taggedOperation is a tag with information and then some operations. All we need\n * to do is restructure this so that it reflects a hierarchical list instead of a flat\n * one.\n * \n * Existing structure:\n *\n * type TagObj = unknown;\n * type TaggedOps = Map;\n *\n * Need to transform into:\n *\n * type HierarchicalOperationTag = {\n * [TagName]: {\n * data: TagObj & { canonicalTagName: string };\n * childTags: Array;\n * }\n * }\n *\n */\n\n\n var tagHierarchy = {};\n taggedOps.map(function (data, tag) {\n // Fill in canonicalTagName, if necessary\n if (!data.has(\"canonicalTagName\")) {\n data = data.set(\"canonicalTagName\", tag.replace(hierarchicalTagSeparator, \"_\"));\n }\n\n var parts = tag.split(hierarchicalTagSeparator);\n var current = tagHierarchy;\n\n for (var i = 0; i < parts.length; i++) {\n var part = parts[i]; // if hierarchical structure not exists create it and add cursor for child tags\n\n if (current[part] === undefined) {\n current[part] = {\n data: null,\n childTags: {}\n };\n } // if point of insert reached add operations and tag information to structure\n\n\n if (i === parts.length - 1) {\n current[part].data = data;\n }\n\n current = current[part].childTags;\n }\n });\n return Object.keys(tagHierarchy).size === 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(\"h3\", null, \" No operations defined in spec!\") : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(HierarchicalOperationTag, {\n specSelectors: specSelectors,\n oas3Selectors: oas3Selectors,\n layoutSelectors: layoutSelectors,\n layoutActions: layoutActions,\n getConfigs: getConfigs,\n getComponent: getComponent,\n childTags: tagHierarchy,\n isRoot: true\n });\n }\n }]);\n\n return HierarchicalOperations;\n}(react__WEBPACK_IMPORTED_MODULE_6___default.a.Component);\n\n_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5___default()(HierarchicalOperations, \"propTypes\", {\n specSelectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n specActions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n oas3Actions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n getComponent: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.func.isRequired,\n oas3Selectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n layoutSelectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n layoutActions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n authActions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n authSelectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n getConfigs: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.func.isRequired,\n fn: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (HierarchicalOperations);\n\n//# sourceURL=webpack://YourLibraryName/./src/HierarchicalOperations.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HierarchicalOperations\", function() { return HierarchicalOperations; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ \"./node_modules/@babel/runtime/helpers/createClass.js\");\n/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! immutable */ \"./node_modules/immutable/dist/immutable.js\");\n/* harmony import */ var immutable__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(immutable__WEBPACK_IMPORTED_MODULE_8__);\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }\n\nfunction _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; } }\n\n\n\n\n/**\n * This is a direct copy of [this file](https://github.com/swagger-api/swagger-ui/blob/d3a65060628b79729445bc155f6d96a1ed1cd426/src/core/components/operations.jsx),\n * which was then modified to accommodate the necessary recursion for this plugin.\n */\n\nvar HierarchicalOperations = /*#__PURE__*/function (_React$Component) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(HierarchicalOperations, _React$Component);\n\n var _super = _createSuper(HierarchicalOperations);\n\n function HierarchicalOperations() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, HierarchicalOperations);\n\n return _super.apply(this, arguments);\n }\n\n _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(HierarchicalOperations, [{\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n specSelectors = _this$props.specSelectors,\n getComponent = _this$props.getComponent,\n oas3Selectors = _this$props.oas3Selectors,\n layoutSelectors = _this$props.layoutSelectors,\n layoutActions = _this$props.layoutActions,\n getConfigs = _this$props.getConfigs,\n fn = _this$props.fn; // Get a flat map of tags to their set of operations\n\n var taggedOps = specSelectors.taggedOperations(); // Get the component we need\n\n var HierarchicalOperationTag = getComponent(\"HierarchicalOperationTag\");\n\n var _getConfigs = getConfigs(),\n maxDisplayedTags = _getConfigs.maxDisplayedTags,\n hierarchicalTagSeparator = _getConfigs.hierarchicalTagSeparator;\n\n if (!hierarchicalTagSeparator) {\n hierarchicalTagSeparator = /[:|>]/;\n }\n\n var filter = layoutSelectors.currentFilter();\n\n if (filter) {\n if (filter !== true && filter !== \"true\" && filter !== \"false\") {\n taggedOps = fn.opsFilter(taggedOps, filter);\n }\n }\n\n if (maxDisplayedTags && !isNaN(maxDisplayedTags) && maxDisplayedTags >= 0) {\n taggedOps = taggedOps.slice(0, maxDisplayedTags);\n }\n /**\n * Each taggedOperation is a tag with information and then some operations. All we need\n * to do is restructure this so that it reflects a hierarchical list instead of a flat\n * one.\n * \n * Existing structure:\n *\n * type TagObj = unknown;\n * type TaggedOps = Map;\n *\n * Need to transform into:\n *\n * type HierarchicalOperationTag = {\n * [TagName]: {\n * data: TagObj & { canonicalTagName: string };\n * childTags: Array;\n * }\n * }\n *\n */\n\n\n var tagHierarchy = {};\n taggedOps.map(function (data, tag) {\n // Fill in canonicalTagName, if necessary\n if (!data.has(\"canonicalTagName\")) {\n data = data.set(\"canonicalTagName\", tag.replace(hierarchicalTagSeparator, \"_\"));\n }\n\n var parts = tag.split(hierarchicalTagSeparator);\n var current = tagHierarchy;\n\n for (var i = 0; i < parts.length; i++) {\n var part = parts[i].trim(); // if hierarchical structure not exists create it and add cursor for child tags\n\n if (current[part] === undefined) {\n current[part] = {\n data: null,\n childTags: {}\n };\n } // if point of insert reached add operations and tag information to structure\n\n\n if (i === parts.length - 1) {\n current[part].data = data;\n }\n\n current = current[part].childTags;\n console.log({\n part: part,\n current: current\n });\n }\n });\n return Object.keys(tagHierarchy).size === 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(\"h3\", null, \" No operations defined in spec!\") : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(HierarchicalOperationTag, {\n specSelectors: specSelectors,\n oas3Selectors: oas3Selectors,\n layoutSelectors: layoutSelectors,\n layoutActions: layoutActions,\n getConfigs: getConfigs,\n getComponent: getComponent,\n childTags: tagHierarchy,\n isRoot: true\n });\n }\n }]);\n\n return HierarchicalOperations;\n}(react__WEBPACK_IMPORTED_MODULE_6___default.a.Component);\n\n_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_5___default()(HierarchicalOperations, \"propTypes\", {\n specSelectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n specActions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n oas3Actions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n getComponent: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.func.isRequired,\n oas3Selectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n layoutSelectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n layoutActions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n authActions: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n authSelectors: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired,\n getConfigs: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.func.isRequired,\n fn: prop_types__WEBPACK_IMPORTED_MODULE_7___default.a.object.isRequired\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (HierarchicalOperations);\n\n//# sourceURL=webpack://YourLibraryName/./src/HierarchicalOperations.jsx?"); /***/ }), diff --git a/packages/hierarchical-tags/src/HierarchicalOperationTag.jsx b/packages/hierarchical-tags/src/HierarchicalOperationTag.jsx index e688ccb..411dd04 100644 --- a/packages/hierarchical-tags/src/HierarchicalOperationTag.jsx +++ b/packages/hierarchical-tags/src/HierarchicalOperationTag.jsx @@ -59,9 +59,10 @@ export class HierarchicalOperationTag extends React.Component { getConfigs, getComponent, specSelectors, - specUrl, } = this.props; + const specUrl = specSelectors.url(); + let { docExpansion, deepLinking, diff --git a/packages/hierarchical-tags/src/HierarchicalOperations.jsx b/packages/hierarchical-tags/src/HierarchicalOperations.jsx index ec612a6..49a6a50 100644 --- a/packages/hierarchical-tags/src/HierarchicalOperations.jsx +++ b/packages/hierarchical-tags/src/HierarchicalOperations.jsx @@ -92,7 +92,7 @@ export class HierarchicalOperations extends React.Component { const parts = tag.split(hierarchicalTagSeparator); let current = tagHierarchy; for (let i = 0; i < parts.length; i++) { - const part = parts[i]; + const part = parts[i].trim(); // if hierarchical structure not exists create it and add cursor for child tags if (current[part] === undefined) { current[part] = { @@ -106,9 +106,9 @@ export class HierarchicalOperations extends React.Component { current[part].data = data; } current = current[part].childTags; + console.log({part, current}) } }); - return Object.keys(tagHierarchy).size === 0 ?

No operations defined in spec!

: