mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 21:30:21 +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
|
* 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 tagsMap tags info returned from `getTagsWithOperations`
|
||||||
* @param parent parent item
|
* @param parent parent item
|
||||||
* @param group group which this tag belongs to. if not provided gets all tags
|
* @param group group which this tag belongs to. if not provided gets all tags
|
||||||
|
* @param options normalized options
|
||||||
*/
|
*/
|
||||||
static getTagsItems(
|
static getTagsItems(
|
||||||
parser: OpenAPIParser,
|
parser: OpenAPIParser,
|
||||||
|
@ -184,6 +186,11 @@ export class MenuBuilder {
|
||||||
|
|
||||||
res.push(item);
|
res.push(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.sortTagsAlphabetically) {
|
||||||
|
res.sort(alphabeticallyByProp<GroupModel | OperationModel>('name'));
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ export interface RedocRawOptions {
|
||||||
sortPropsAlphabetically?: boolean | string;
|
sortPropsAlphabetically?: boolean | string;
|
||||||
sortEnumValuesAlphabetically?: boolean | string;
|
sortEnumValuesAlphabetically?: boolean | string;
|
||||||
sortOperationsAlphabetically?: boolean | string;
|
sortOperationsAlphabetically?: boolean | string;
|
||||||
|
sortTagsAlphabetically?: boolean | string;
|
||||||
noAutoAuth?: boolean | string;
|
noAutoAuth?: boolean | string;
|
||||||
nativeScrollbars?: boolean | string;
|
nativeScrollbars?: boolean | string;
|
||||||
pathInMiddlePanel?: boolean | string;
|
pathInMiddlePanel?: boolean | string;
|
||||||
|
@ -205,6 +206,7 @@ export class RedocNormalizedOptions {
|
||||||
sortPropsAlphabetically: boolean;
|
sortPropsAlphabetically: boolean;
|
||||||
sortEnumValuesAlphabetically: boolean;
|
sortEnumValuesAlphabetically: boolean;
|
||||||
sortOperationsAlphabetically: boolean;
|
sortOperationsAlphabetically: boolean;
|
||||||
|
sortTagsAlphabetically: boolean;
|
||||||
noAutoAuth: boolean;
|
noAutoAuth: boolean;
|
||||||
nativeScrollbars: boolean;
|
nativeScrollbars: boolean;
|
||||||
pathInMiddlePanel: boolean;
|
pathInMiddlePanel: boolean;
|
||||||
|
@ -265,6 +267,7 @@ export class RedocNormalizedOptions {
|
||||||
this.sortPropsAlphabetically = argValueToBoolean(raw.sortPropsAlphabetically);
|
this.sortPropsAlphabetically = argValueToBoolean(raw.sortPropsAlphabetically);
|
||||||
this.sortEnumValuesAlphabetically = argValueToBoolean(raw.sortEnumValuesAlphabetically);
|
this.sortEnumValuesAlphabetically = argValueToBoolean(raw.sortEnumValuesAlphabetically);
|
||||||
this.sortOperationsAlphabetically = argValueToBoolean(raw.sortOperationsAlphabetically);
|
this.sortOperationsAlphabetically = argValueToBoolean(raw.sortOperationsAlphabetically);
|
||||||
|
this.sortTagsAlphabetically = argValueToBoolean(raw.sortTagsAlphabetically);
|
||||||
this.noAutoAuth = argValueToBoolean(raw.noAutoAuth);
|
this.noAutoAuth = argValueToBoolean(raw.noAutoAuth);
|
||||||
this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
|
this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
|
||||||
this.pathInMiddlePanel = argValueToBoolean(raw.pathInMiddlePanel);
|
this.pathInMiddlePanel = argValueToBoolean(raw.pathInMiddlePanel);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user