Skip to content

Commit 692c21f

Browse files
committed
feat: adding experimental rearrangeEndpoints property
1 parent daabc15 commit 692c21f

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

demo/standalone/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class ApicApplication extends DemoBase {
2727
return html`<api-console-app
2828
app
2929
redirecturi="https://auth.advancedrestclient.com/oauth-popup.html"
30-
oauth2clientid="821776164331-rserncqpdsq32lmbf5cfeolgcoujb6fm.apps.googleusercontent.com">
30+
oauth2clientid="821776164331-rserncqpdsq32lmbf5cfeolgcoujb6fm.apps.googleusercontent.com"
31+
rearrangeEndpoints
32+
>
3133
<anypoint-icon-button
3234
slot="toolbar"
3335
aria-label="Activate to open API selection menu"

src/ApiConsole.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,13 @@ export class ApiConsole extends AmfHelperMixin(LitElement) {
246246
}
247247

248248
_navigationTemplate() {
249-
const { amf, noAttribution } = this;
249+
const { amf, noAttribution, rearrangeEndpoints } = this;
250250
return html`<div class="drawer-content-wrapper">
251251
<api-navigation
252252
.amf="${amf}"
253253
summary
254254
endpointsopened
255+
?rearrangeendpoints="${rearrangeEndpoints}"
255256
@api-navigation-selection-changed="${this._apiNavigationOcurred}"></api-navigation>
256257
${noAttribution ? '' : attributionTpl}
257258
</div>`;
@@ -485,7 +486,17 @@ export class ApiConsole extends AmfHelperMixin(LitElement) {
485486
/**
486487
* Enables compatibility with Anypoint components.
487488
*/
488-
compatibility: { type: Boolean }
489+
compatibility: { type: Boolean },
490+
/**
491+
* This property is passed to the `api-navigation` component.
492+
*
493+
* When this value is set, the navigation component sorts the list
494+
* of endpoints based on the `path` value of the endpoint, keeping the order
495+
* of which endpoint was first in the list, relative to each other.
496+
*
497+
* **This is an experimental option and may dissapear without warning.**
498+
*/
499+
rearrangeEndpoints: { type: Boolean },
489500
};
490501
}
491502

@@ -763,5 +774,6 @@ export class ApiConsole extends AmfHelperMixin(LitElement) {
763774

764775
_closeDrawer() {
765776
this.navigationOpened = false;
777+
this.dispatchEvent(new CustomEvent('navigation-close'));
766778
}
767779
}

0 commit comments

Comments
 (0)