mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 21:30:21 +03:00
chore: update snapshots and add prop to readme
This commit is contained in:
parent
9e0f6cb2ac
commit
68aadaf1b0
|
@ -207,6 +207,7 @@ Redoc uses the following [specification extensions](https://swagger.io/specifica
|
||||||
You can use all of the following options with the standalone version of the <redoc> tag by kebab-casing them. For example, `scrollYOffset` becomes `scroll-y-offset`, and `expandResponses` becomes `expand-responses`.
|
You can use all of the following options with the standalone version of the <redoc> tag by kebab-casing them. For example, `scrollYOffset` becomes `scroll-y-offset`, and `expandResponses` becomes `expand-responses`.
|
||||||
|
|
||||||
* `disableSearch` - disable search indexing and search box.
|
* `disableSearch` - disable search indexing and search box.
|
||||||
|
* `minCharacterLengthToInitSearch` - set minimal characters length to init search, default `3`, minimal `1`.
|
||||||
* `expandDefaultServerVariables` - enable expanding default server variables, default `false`.
|
* `expandDefaultServerVariables` - enable expanding default server variables, default `false`.
|
||||||
* `expandResponses` - specify which responses to expand by default by response codes. Values should be passed as comma-separated list without spaces e.g. `expandResponses="200,201"`. Special value `"all"` expands all responses by default. Be careful: this option can slow-down documentation rendering time.
|
* `expandResponses` - specify which responses to expand by default by response codes. Values should be passed as comma-separated list without spaces e.g. `expandResponses="200,201"`. Special value `"all"` expands all responses by default. Be careful: this option can slow-down documentation rendering time.
|
||||||
* `generatedPayloadSamplesMaxDepth` - set the maximum render depth for JSON payload samples (responses and request body). The default value is `10`.
|
* `generatedPayloadSamplesMaxDepth` - set the maximum render depth for JSON payload samples (responses and request body). The default value is `10`.
|
||||||
|
|
|
@ -8,8 +8,6 @@ import { MarkerService } from '../../services/MarkerService';
|
||||||
import { SearchResult } from '../../services/SearchWorker.worker';
|
import { SearchResult } from '../../services/SearchWorker.worker';
|
||||||
|
|
||||||
import { OptionsContext } from '../OptionsProvider';
|
import { OptionsContext } from '../OptionsProvider';
|
||||||
import { RedocRawOptions } from '../../services/RedocNormalizedOptions';
|
|
||||||
|
|
||||||
import { bind, debounce } from 'decko';
|
import { bind, debounce } from 'decko';
|
||||||
import { PerfectScrollbarWrap } from '../../common-elements/perfect-scrollbar';
|
import { PerfectScrollbarWrap } from '../../common-elements/perfect-scrollbar';
|
||||||
import {
|
import {
|
||||||
|
@ -113,13 +111,13 @@ export class SearchBox extends React.PureComponent<SearchBoxProps, SearchBoxStat
|
||||||
@bind
|
@bind
|
||||||
@debounce(400)
|
@debounce(400)
|
||||||
searchCallback(searchTerm: string) {
|
searchCallback(searchTerm: string) {
|
||||||
this.props.search.search(searchTerm).then((res) => {
|
this.props.search.search(searchTerm).then(res => {
|
||||||
this.setResults(res, searchTerm);
|
this.setResults(res, searchTerm);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
search = (event: React.ChangeEvent<HTMLInputElement>) => {
|
search = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const { minCharacterLengthToInitSearch = 3 } = this.context as RedocRawOptions;
|
const { minCharacterLengthToInitSearch } = this.context;
|
||||||
const q = event.target.value;
|
const q = event.target.value;
|
||||||
if (q.length < minCharacterLengthToInitSearch) {
|
if (q.length < minCharacterLengthToInitSearch) {
|
||||||
this.clearResults(q);
|
this.clearResults(q);
|
||||||
|
@ -136,7 +134,7 @@ export class SearchBox extends React.PureComponent<SearchBoxProps, SearchBoxStat
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { activeItemIdx } = this.state;
|
const { activeItemIdx } = this.state;
|
||||||
const results = this.state.results.map((res) => ({
|
const results = this.state.results.map(res => ({
|
||||||
item: this.props.getItemById(res.meta)!,
|
item: this.props.getItemById(res.meta)!,
|
||||||
score: res.score,
|
score: res.score,
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -89,6 +89,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -339,6 +340,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -565,6 +567,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -856,6 +859,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -1106,6 +1110,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -1332,6 +1337,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -1581,6 +1587,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -1869,6 +1876,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -2119,6 +2127,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
@ -2345,6 +2354,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
||||||
"jsonSampleExpandLevel": 2,
|
"jsonSampleExpandLevel": 2,
|
||||||
"maxDisplayedEnumValues": undefined,
|
"maxDisplayedEnumValues": undefined,
|
||||||
"menuToggle": true,
|
"menuToggle": true,
|
||||||
|
"minCharacterLengthToInitSearch": 3,
|
||||||
"nativeScrollbars": false,
|
"nativeScrollbars": false,
|
||||||
"noAutoAuth": false,
|
"noAutoAuth": false,
|
||||||
"nonce": undefined,
|
"nonce": undefined,
|
||||||
|
|
|
@ -252,7 +252,7 @@ export class RedocNormalizedOptions {
|
||||||
hideSchemaPattern: boolean;
|
hideSchemaPattern: boolean;
|
||||||
generatedPayloadSamplesMaxDepth: number;
|
generatedPayloadSamplesMaxDepth: number;
|
||||||
hideFab: boolean;
|
hideFab: boolean;
|
||||||
minCharacterLengthToInitSearch?: number;
|
minCharacterLengthToInitSearch: number;
|
||||||
|
|
||||||
nonce?: string;
|
nonce?: string;
|
||||||
|
|
||||||
|
@ -327,6 +327,6 @@ export class RedocNormalizedOptions {
|
||||||
);
|
);
|
||||||
this.nonce = raw.nonce;
|
this.nonce = raw.nonce;
|
||||||
this.hideFab = argValueToBoolean(raw.hideFab);
|
this.hideFab = argValueToBoolean(raw.hideFab);
|
||||||
this.minCharacterLengthToInitSearch = argValueToNumber(raw.minCharacterLengthToInitSearch);
|
this.minCharacterLengthToInitSearch = argValueToNumber(raw.minCharacterLengthToInitSearch) || 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user