| 35977 | } |
| 35978 | } |
| 35979 | } |
| 35980 | class Models extends Re.Component { |
| 35981 | getSchemaBasePath = () => |
| 35982 | this.props.specSelectors.isOAS3() ? ['components', 'schemas'] : ['definitions'] |
| 35983 | getCollapsedContent = () => ' ' |
| 35984 | handleToggle = (s, o) => { |
| 35985 | const { layoutActions: i } = this.props |
| 35986 | ;(i.show([...this.getSchemaBasePath(), s], o), |
| 35987 | o && this.props.specActions.requestResolvedSubtree([...this.getSchemaBasePath(), s])) |
| 35988 | } |
| 35989 | onLoadModels = (s) => { |
| 35990 | s && this.props.layoutActions.readyToScroll(this.getSchemaBasePath(), s) |
| 35991 | } |
| 35992 | onLoadModel = (s) => { |
| 35993 | if (s) { |
| 35994 | const o = s.getAttribute('data-name') |
| 35995 | this.props.layoutActions.readyToScroll([...this.getSchemaBasePath(), o], s) |
| 35996 | } |
| 35997 | } |
| 35998 | render() { |
| 35999 | let { |
| 36000 | specSelectors: s, |
| 36001 | getComponent: o, |
| 36002 | layoutSelectors: i, |
| 36003 | layoutActions: a, |
| 36004 | getConfigs: u, |
| 36005 | } = this.props, |
| 36006 | _ = s.definitions(), |
| 36007 | { docExpansion: w, defaultModelsExpandDepth: x } = u() |
| 36008 | if (!_.size || x < 0) return null |
| 36009 | const C = this.getSchemaBasePath() |
| 36010 | let j = i.isShown(C, x > 0 && 'none' !== w) |
| 36011 | const L = s.isOAS3(), |
| 36012 | B = o('ModelWrapper'), |
| 36013 | $ = o('Collapse'), |
| 36014 | U = o('ModelCollapse'), |
| 36015 | V = o('JumpToPath', !0), |
| 36016 | z = o('ArrowUpIcon'), |
| 36017 | Y = o('ArrowDownIcon') |
| 36018 | return Re.createElement( |
| 36019 | 'section', |
| 36020 | { className: j ? 'models is-open' : 'models', ref: this.onLoadModels }, |
| 36021 | Re.createElement( |
| 36022 | 'h4', |
| 36023 | null, |
| 36024 | Re.createElement( |
| 36025 | 'button', |
| 36026 | { 'aria-expanded': j, className: 'models-control', onClick: () => a.show(C, !j) }, |
| 36027 | Re.createElement('span', null, L ? 'Schemas' : 'Models'), |
| 36028 | j ? Re.createElement(z, null) : Re.createElement(Y, null) |
| 36029 | ) |
| 36030 | ), |
| 36031 | Re.createElement( |
| 36032 | $, |
| 36033 | { isOpened: j }, |
| 36034 | _.entrySeq() |
| 36035 | .map(([_]) => { |
| 36036 | const w = [...C, _], |