@advanced-rest-client/arc-headers
Version:
A module that contains UI and logic for handle HTTP headers in an HTTP request and request editors.
240 lines (206 loc) • 5.92 kB
TypeScript
import { TemplateResult, CSSResult, LitElement } from 'lit-element';
import { EventsTargetMixin } from '@advanced-rest-client/events-target-mixin';
import { FormTypes } from '@advanced-rest-client/arc-types';
import { AnypointAutocomplete } from '@anypoint-web-components/anypoint-autocomplete';
import { RequestChangeEvent } from '@advanced-rest-client/arc-events';
import {
valueValue,
createViewModel,
viewModel,
valueFromModel,
notifyValueChange,
sourceTemplate,
formTemplate,
addTemplate,
emptyTemplate,
contentActionsTemplate,
headerItemTemplate,
headerToggleTemplate,
headerRemoveTemplate,
headerNameInput,
headerValueInput,
removeHeaderHandler,
enabledHandler,
headerInputHandler,
propagateModelChange,
addHeaderHandler,
autocompleteTemplate,
inputFocusHandler,
autocompleteRef,
copyHandler,
resetCopyState,
sourceModeHandler,
cmExtraKeys,
cmKeysHandler,
cmValueHandler,
focusLastName,
contentTypeHandler,
copyActionButtonTemplate,
editorSwitchTemplate,
} from './internals.js';
/**
* @fires change Dispatches when a value change after the user manipulate the editor value.
* @deprecated This component is deprecated. Use `@advanced-rest-client/app` instead.
*/
export declare class HeadersEditorElement extends EventsTargetMixin(LitElement) {
static readonly styles: CSSResult;
/**
* Headers value.
* @attribute
*/
value: string;
[]: string;
/**
* The view model to use to render the values.
* Note, the `model` property is immediately updated when the `value` is set.
* When the hosting application uses both values make sure to only set the `model` property.
*
* Also note, there's no dedicated event for the model change. When value change then
* the model changed as well.
*/
model: FormTypes.FormItem[];
[]: FormTypes.FormItem[];
/**
* When enabled it renders source mode (code mirror editor with headers support)
* @attribute
*/
source: boolean;
/**
* When set the editor is in read only mode.
* @attribute
*/
readOnly: boolean;
/**
* Enables compatibility with Anypoint components.
* @attribute
*/
compatibility: boolean;
/**
* Enables Material Design outlined style
* @attribute
*/
outlined: boolean;
readonly [autocompleteRef]: AnypointAutocomplete;
readonly [cmExtraKeys]: object;
constructor();
_attachListeners(node: EventTarget): void;
_detachListeners(node: EventTarget): void;
/**
* Updates header value. If the header does not exist in the editor it will be created.
* @param name Header name
* @param value Header value
*/
updateHeader(name: string, value: string): void;
/**
* Removes header from the editor by its name.
* @param name Header name
*/
removeHeader(name: string): void;
/**
* Adds a header to the list of headers
*/
add(): void;
[](e: RequestChangeEvent): void;
/**
* Parses headers string to a view model.
* @returns View model for the headers.
*/
[](input: string): FormTypes.FormItem[];
[](model: FormTypes.FormItem[]): string;
/**
* Dispatches `change` event to notify about the value change
*/
[](): void;
/**
* Updates the `value` from the current model and dispatches the value change event
*/
[](): void;
[](e: CustomEvent): void;
[](e: CustomEvent): void;
/**
* Handler to the remove a header
*/
[](e: PointerEvent): void;
/**
* A handler for the add header click.
*/
[](): Promise<void>;
/**
* Adds autocomplete support for the currently focused header.
*/
[](e: Event): void;
/**
* Copies current response text value to clipboard.
*/
[](e: Event): void;
[](button: HTMLButtonElement): void;
/**
* Toggles the source view
*/
[](e: Event): Promise<void>;
/**
* Code mirror's ctrl+space key handler.
* Opens headers fill support.
*
* @param cm Code mirror instance.
*/
[](cm: any): void;
/**
* Handler for the CodeMirror input event.
*/
[](e: Event): void;
/**
* Focuses on the last header name filed
*/
[](): void;
render(): TemplateResult;
/**
* @returns a template for the content actions
*/
[](): TemplateResult;
/**
* @returns The template for the copy action button
*/
[](): TemplateResult;
/**
* @returns The template for the editor type switch
*/
[](): TemplateResult;
/**
* @returns a template for the content actions
*/
[](): TemplateResult;
/**
* @returns a template for the content actions
*/
[](): TemplateResult;
/**
* @returns a template for the empty list view
*/
[](): TemplateResult;
[](item: FormTypes.FormItem, index: number): TemplateResult;
/**
* @returns a template for the content actions
*/
[](): TemplateResult;
/**
* @return Template for the parameter name input
*/
[](index: number): TemplateResult;
/**
* @return Template for the parameter name input
*/
[](item: FormTypes.FormItem, index: number): TemplateResult;
/**
* @return Template for the parameter name input
*/
[](item: FormTypes.FormItem, index: number): TemplateResult;
/**
* @return Template for the parameter value input
*/
[](item: FormTypes.FormItem, index: number): TemplateResult;
/**
* @returns A template for the autocomplete element
*/
[](): TemplateResult;
}