@progress/kendo-angular-buttons
Version:
Buttons Package for Angular
176 lines (175 loc) • 7.52 kB
TypeScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { ElementRef, OnDestroy, OnInit, Renderer2, NgZone, EventEmitter } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Subscription } from 'rxjs';
import { ControlContainer } from '@angular/forms';
import { SmartPasteAIRequestOptions, SmartPasteFormField, SmartPasteRequestStartEvent, SmartPasteRequestEndEvent } from './models';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { SVGIcon } from '@progress/kendo-svg-icons';
import { ButtonFillMode, ButtonRounded, ButtonSize, ButtonThemeColor } from '../common/models';
import { SmartPasteField } from '@progress/kendo-smartpaste-common';
import * as i0 from "@angular/core";
/**
* Represents the Kendo UI SmartPasteButton component for Angular.
*
* Fills form fields with AI-powered data extraction from clipboard content.
*/
export declare class SmartPasteButtonComponent implements OnInit, OnDestroy {
renderer: Renderer2;
ngZone: NgZone;
private http;
private controlContainer;
/**
* Specifies the form controls to include in Smart Paste.
* When not set, all form controls are included.
*
* @default null
*/
formFields: SmartPasteFormField[] | null;
/**
* When `true`, disables the SmartPasteButton and prevents user interaction.
*
* @default false
*/
set disabled(disabled: boolean);
get disabled(): boolean;
/**
* Sets the padding of the SmartPasteButton.
*
* @default undefined
*/
set size(size: ButtonSize);
get size(): ButtonSize;
/**
* Sets the border radius of the SmartPasteButton.
*
* @default undefined
*/
set rounded(rounded: ButtonRounded);
get rounded(): ButtonRounded;
/**
* Sets the background and border styles of the SmartPasteButton.
*
* @default undefined
*/
set fillMode(fillMode: ButtonFillMode);
get fillMode(): ButtonFillMode;
/**
* Sets a predefined theme color for the SmartPasteButton.
* The theme color applies as a background and border color and adjusts the text color.
*
* @default undefined
*/
set themeColor(themeColor: ButtonThemeColor);
get themeColor(): ButtonThemeColor;
/**
* Sets an SVG icon to display inside the SmartPasteButton.
*/
set svgIcon(icon: SVGIcon);
get svgIcon(): SVGIcon;
/**
* Specifies a URL for an `img` element inside the SmartPasteButton.
* The URL can be relative or absolute. When relative, the browser evaluates it relative to the web page URL.
*/
imageUrl: string;
/**
* Defines one or more CSS classes separated by spaces for a `span` element inside the SmartPasteButton.
* Use `iconClass` to add custom icons.
*/
set iconClass(value: string);
get iconClass(): string;
/**
* Specifies the icon name to display in the SmartPasteButton.
*
* @default 'paste-sparkle'
*/
set icon(name: string);
get icon(): string;
/**
* Sets the URL to which Smart Paste sends the AI request.
* When set, the component sends and handles an HTTP request automatically. Handle the `requestStart` event to modify request options before sending.
* When not set, the component does not send an HTTP request. Handle the `requestStart` event to send and manage a custom HTTP request.
*/
requestUrl?: string;
/**
* Configures the HTTP request options for the AI request.
* Use this to customize headers, method, credentials, and other request settings.
*/
requestOptions?: SmartPasteAIRequestOptions;
/**
* Sets static form field metadata to bypass DOM extraction when Smart Paste runs.
* Use this when you want to provide form field configuration directly instead of extracting it from the DOM.
*
* @hidden
* @default null
*/
smartPasteFormFields: SmartPasteField[] | null;
/**
* Fires when the Smart Paste request is about to start.
* Prevent the event to stop the request before sending it.
*/
requestStart: EventEmitter<SmartPasteRequestStartEvent>;
/**
* Fires when the Smart Paste request completes, either successfully or with an error.
* Prevent the event to cancel populating the form fields with the response data.
*/
requestEnd: EventEmitter<SmartPasteRequestEndEvent>;
/**
* Fires when the user cancels an ongoing Smart Paste request.
*/
requestCancel: EventEmitter<void>;
get iconButtonClass(): boolean;
get classDisabled(): boolean;
get getDirection(): string;
onFocus(): void;
onBlur(): void;
/**
* Focuses the SmartPasteButton.
*/
focus(): void;
/**
* Removes focus from the SmartPasteButton.
*/
blur(): void;
get hasText(): boolean;
set isFocused(isFocused: boolean);
get isFocused(): boolean;
element: HTMLElement;
isDisabled: boolean;
subs: Subscription;
private _size;
private _rounded;
private _fillMode;
private _themeColor;
private _focused;
private direction;
private _iconClass;
private _icon;
private _svgIcon;
private kendoSmartPaste;
private smartPasteBusy;
private currentRequestSubscription;
private nativeForm;
constructor(elementRef: ElementRef, renderer: Renderer2, localization: LocalizationService, ngZone: NgZone, http: HttpClient, controlContainer: ControlContainer);
ngOnInit(): void;
ngOnDestroy(): void;
/**
* Starts the Smart Paste operation.
* Reads clipboard content and sends it to the AI service for processing.
*/
paste(): Promise<void>;
private sendSmartPasteRequest;
private unsubscribeCurrentRequest;
private defaultGetSmartPasteField;
private defaultSetKendoInputValue;
private setControlValue;
private extractFormFields;
private handleClasses;
private handleThemeColor;
private handleSmartPasteRequest;
static ɵfac: i0.ɵɵFactoryDeclaration<SmartPasteButtonComponent, [null, null, null, null, null, { optional: true; skipSelf: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<SmartPasteButtonComponent, "button[kendoSmartPasteButton]", ["kendoSmartPasteButton"], { "formFields": { "alias": "formFields"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "size": { "alias": "size"; "required": false; }; "rounded": { "alias": "rounded"; "required": false; }; "fillMode": { "alias": "fillMode"; "required": false; }; "themeColor": { "alias": "themeColor"; "required": false; }; "svgIcon": { "alias": "svgIcon"; "required": false; }; "imageUrl": { "alias": "imageUrl"; "required": false; }; "iconClass": { "alias": "iconClass"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "requestUrl": { "alias": "requestUrl"; "required": false; }; "requestOptions": { "alias": "requestOptions"; "required": false; }; "smartPasteFormFields": { "alias": "smartPasteFormFields"; "required": false; }; }, { "requestStart": "requestStart"; "requestEnd": "requestEnd"; "requestCancel": "requestCancel"; }, never, ["*"], true, never>;
}