openapi-explorer 0.8.300 → 0.8.301

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "0.8.300",
3
+ "version": "0.8.301",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Rhosys Developers <developers@rhosys.ch>",
6
6
  "repository": {
@@ -1,51 +1,22 @@
1
1
  import { html } from 'lit-element';
2
2
  import { pathIsInSearch } from '../utils/common-utils';
3
3
 
4
- export function expandCollapseNavBarTag(navLinkEl, action = 'toggle') {
5
- const tagAndPathEl = navLinkEl && navLinkEl.closest('.nav-bar-tag-and-paths');
6
- if (tagAndPathEl) {
7
- const expand = tagAndPathEl.classList.contains('collapsed') && action === 'toggle' || action === 'expand';
8
- if (expand) {
9
- tagAndPathEl.classList.remove('collapsed');
10
- tagAndPathEl.classList.add('expanded');
11
- return;
12
- }
13
-
14
- tagAndPathEl.classList.remove('expanded');
15
- tagAndPathEl.classList.add('collapsed');
16
- }
17
- }
18
-
19
- function onExpandCollapse(tagId, e) {
4
+ function onExpandCollapse(tagId) {
20
5
  const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
21
6
  if (!tag) {
22
7
  return;
23
8
  }
24
- expandCollapseNavBarTag(e.target, 'toggle');
25
9
  tag.expanded = !tag.expanded;
26
-
27
- if (this.resolvedSpec.tags.some(t => t.expanded)) {
28
- this.operationsCollapsed = false;
29
- }
30
-
31
- if (this.resolvedSpec.tags.every(t => !t.expanded)) {
32
- this.operationsCollapsed = true;
10
+ if (tag.expanded && this.operationsCollapsed) {
11
+ this.resolvedSpec.tags.filter(t => t.elementId !== tagId).forEach(t => t.expanded = false);
33
12
  }
13
+ this.requestUpdate();
34
14
  }
35
15
 
36
- export function expandCollapseAll(e, action = 'expand-all') {
37
- const navEl = e.target.closest('.nav-scroll');
38
-
39
- const elList = [...navEl.querySelectorAll('.nav-bar-tag-and-paths')];
40
- if (action === 'expand-all') {
41
- elList.map((el) => { expandCollapseNavBarTag(el, 'expand'); });
42
- this.resolvedSpec.tags.forEach(t => { t.expanded = true; });
43
- this.operationsCollapsed = false;
44
- } else {
45
- elList.map((el) => { expandCollapseNavBarTag(el, 'collapse'); });
46
- this.resolvedSpec.tags.forEach(t => { t.expanded = false; });
47
- this.operationsCollapsed = true;
48
- }
16
+ export function expandCollapseAll() {
17
+ const expand = this.operationsCollapsed;
18
+ this.operationsCollapsed = !expand;
19
+ this.resolvedSpec.tags.forEach(t => { t.expanded = expand; });
49
20
  }
50
21
 
51
22
  /* eslint-disable indent */
@@ -116,8 +87,8 @@ export default function navbarTemplate() {
116
87
  ${this.resolvedSpec.tags.length > 1
117
88
  ? html`
118
89
  ${this.operationsCollapsed
119
- ? html`<div @click="${(e) => { expandCollapseAll.call(this, e, 'expand-all'); }}" style="font-size: 16px; transform: rotate(0deg); cursor: pointer;">▸</div>`
120
- : html`<div @click="${(e) => { expandCollapseAll.call(this, e, 'collapse-all'); }}" style="font-size: 16px; transform: rotate(90deg); cursor: pointer;">▸</div>`
90
+ ? html`<div @click="${(e) => { expandCollapseAll.call(this, e); }}" style="font-size: 16px; transform: rotate(0deg); cursor: pointer;">▸</div>`
91
+ : html`<div @click="${(e) => { expandCollapseAll.call(this, e); }}" style="font-size: 16px; transform: rotate(90deg); cursor: pointer;">▸</div>`
121
92
  }`
122
93
  : ''
123
94
  }
@@ -135,7 +106,7 @@ export default function navbarTemplate() {
135
106
  ? html``
136
107
  : html`
137
108
  <div class='nav-bar-tag' id="link-${tag.elementId}" data-content-id='${tag.elementId}'
138
- @click='${(e) => { onExpandCollapse.call(this, tag.elementId, e); }}'>
109
+ @click='${() => { onExpandCollapse.call(this, tag.elementId); }}'>
139
110
 
140
111
  <div style="display: flex; justify-content: space-between; width: 100%;">
141
112
  <div>${tag.name}</div>