mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
feat: add ability to sort tags
This commit is contained in:
parent
62b2c864dc
commit
70d15fb5d1
|
@ -131,9 +131,11 @@ export class MenuBuilder {
|
|||
|
||||
/**
|
||||
* Returns array of OperationsGroup items for the tags of the group or for all tags
|
||||
* @param parser
|
||||
* @param tagsMap tags info returned from `getTagsWithOperations`
|
||||
* @param parent parent item
|
||||
* @param group group which this tag belongs to. if not provided gets all tags
|
||||
* @param options normalized options
|
||||
*/
|
||||
static getTagsItems(
|
||||
parser: OpenAPIParser,
|
||||
|
@ -184,6 +186,11 @@ export class MenuBuilder {
|
|||
|
||||
res.push(item);
|
||||
}
|
||||
|
||||
if (options.sortTagsAlphabetically) {
|
||||
res.sort(alphabeticallyByProp<GroupModel | OperationModel>('name'));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ export interface RedocRawOptions {
|
|||
sortPropsAlphabetically?: boolean | string;
|
||||
sortEnumValuesAlphabetically?: boolean | string;
|
||||
sortOperationsAlphabetically?: boolean | string;
|
||||
sortTagsAlphabetically?: boolean | string;
|
||||
noAutoAuth?: boolean | string;
|
||||
nativeScrollbars?: boolean | string;
|
||||
pathInMiddlePanel?: boolean | string;
|
||||
|
@ -205,6 +206,7 @@ export class RedocNormalizedOptions {
|
|||
sortPropsAlphabetically: boolean;
|
||||
sortEnumValuesAlphabetically: boolean;
|
||||
sortOperationsAlphabetically: boolean;
|
||||
sortTagsAlphabetically: boolean;
|
||||
noAutoAuth: boolean;
|
||||
nativeScrollbars: boolean;
|
||||
pathInMiddlePanel: boolean;
|
||||
|
@ -265,6 +267,7 @@ export class RedocNormalizedOptions {
|
|||
this.sortPropsAlphabetically = argValueToBoolean(raw.sortPropsAlphabetically);
|
||||
this.sortEnumValuesAlphabetically = argValueToBoolean(raw.sortEnumValuesAlphabetically);
|
||||
this.sortOperationsAlphabetically = argValueToBoolean(raw.sortOperationsAlphabetically);
|
||||
this.sortTagsAlphabetically = argValueToBoolean(raw.sortTagsAlphabetically);
|
||||
this.noAutoAuth = argValueToBoolean(raw.noAutoAuth);
|
||||
this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
|
||||
this.pathInMiddlePanel = argValueToBoolean(raw.pathInMiddlePanel);
|
||||
|
|
Loading…
Reference in New Issue
Block a user