@progress/kendo-angular-buttons 23.0.0-develop.6 → 23.0.0-develop.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,12 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
- import { Injectable, isDevMode, EventEmitter, Input, HostListener, HostBinding, Output, Optional, Component, ContentChildren, Directive, InjectionToken, Inject, ElementRef, ViewContainerRef, ViewChild, ContentChild, forwardRef, NgModule } from '@angular/core';
6
+ import { Injectable, isDevMode, EventEmitter, Input, HostListener, HostBinding, Output, Optional, Component, ContentChildren, Directive, InjectionToken, Inject, ElementRef, ViewContainerRef, ViewChild, ContentChild, forwardRef, SkipSelf, NgModule } from '@angular/core';
7
7
  import { Subject, Subscription, fromEvent, merge, of, from, Observable } from 'rxjs';
8
8
  import * as i12 from '@progress/kendo-angular-common';
9
- import { isDocumentAvailable, isFirefox, isSafari, isChanged, hasObservers, normalizeKeys, Keys, TemplateContextDirective, MultiTabStop, guid, parseCSSClassNames, isPresent as isPresent$1, EventsOutsideAngularDirective, replaceMessagePlaceholder, anyChanged, ToggleButtonTabStopDirective, ResizeBatchService, KENDO_TOGGLEBUTTONTABSTOP } from '@progress/kendo-angular-common';
9
+ import { isDocumentAvailable, isFirefox, isSafari, isChanged, hasObservers, normalizeKeys, Keys, TemplateContextDirective, MultiTabStop, guid, parseCSSClassNames, isPresent as isPresent$1, EventsOutsideAngularDirective, replaceMessagePlaceholder, anyChanged, PreventableEvent as PreventableEvent$1, ToggleButtonTabStopDirective, ResizeBatchService, KENDO_TOGGLEBUTTONTABSTOP } from '@progress/kendo-angular-common';
10
10
  export { ToggleButtonTabStopDirective } from '@progress/kendo-angular-common';
11
- import { caretAltDownIcon, xCircleIcon, moreVerticalIcon, microphoneOutlineIcon, stopSmIcon } from '@progress/kendo-svg-icons';
11
+ import { caretAltDownIcon, xCircleIcon, moreVerticalIcon, microphoneOutlineIcon, stopSmIcon, pasteSparkleIcon } from '@progress/kendo-svg-icons';
12
12
  import * as i1 from '@progress/kendo-angular-l10n';
13
13
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
14
14
  import { validatePackage } from '@progress/kendo-licensing';
@@ -20,6 +20,10 @@ import { PopupService } from '@progress/kendo-angular-popup';
20
20
  import * as i4 from '@angular/animations';
21
21
  import { sequence, query, style, stagger, animate } from '@angular/animations';
22
22
  import { KendoSpeechRecognition } from '@progress/kendo-webspeech-common';
23
+ import * as i2 from '@angular/common/http';
24
+ import { HttpHeaders, HttpRequest, HttpEventType } from '@angular/common/http';
25
+ import * as i3$1 from '@angular/forms';
26
+ import { KendoSmartPaste } from '@progress/kendo-smartpaste-common';
23
27
 
24
28
  /**
25
29
  * @hidden
@@ -46,7 +50,7 @@ const packageMetadata = {
46
50
  productCode: 'KENDOUIANGULAR',
47
51
  productCodes: ['KENDOUIANGULAR'],
48
52
  publishDate: 0,
49
- version: '23.0.0-develop.6',
53
+ version: '23.0.0-develop.8',
50
54
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
51
55
  };
52
56
 
@@ -5852,6 +5856,716 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
5852
5856
  args: ['blur']
5853
5857
  }] } });
5854
5858
 
5859
+ /**
5860
+ * @hidden
5861
+ */
5862
+ const DEFAULT_AI_REQUEST_OPTIONS = {
5863
+ headers: new HttpHeaders({
5864
+ 'Content-Type': 'application/json'
5865
+ }),
5866
+ role: 'user',
5867
+ method: 'POST',
5868
+ responseType: 'json'
5869
+ };
5870
+ class SmartPasteRequestStartEvent extends PreventableEvent$1 {
5871
+ /**
5872
+ * Gets the request data to send to the AI service.
5873
+ */
5874
+ requestData;
5875
+ constructor(requestData) {
5876
+ super();
5877
+ this.requestData = requestData;
5878
+ }
5879
+ }
5880
+ class SmartPasteRequestEndEvent extends PreventableEvent$1 {
5881
+ /**
5882
+ * Gets the HTTP response from the AI service.
5883
+ * Contains an error object when the request fails.
5884
+ */
5885
+ response;
5886
+ constructor(response) {
5887
+ super();
5888
+ this.response = response;
5889
+ }
5890
+ }
5891
+
5892
+ /**
5893
+ * Checks if a field should be ignored during Smart Paste.
5894
+ *
5895
+ * @hidden
5896
+ */
5897
+ function isFieldIgnored(element) {
5898
+ return element.hasAttribute('type') && element.type === 'hidden' ||
5899
+ element.hasAttribute('disabled') ||
5900
+ element.hasAttribute('readonly') ||
5901
+ (element.hasAttribute('aria-disabled') && element.getAttribute('aria-disabled') === 'true') ||
5902
+ (element.hasAttribute('aria-readonly') && element.getAttribute('aria-readonly') === 'true') ||
5903
+ (element.hasAttribute('aria-hidden') && element.getAttribute('aria-hidden') === 'true');
5904
+ }
5905
+ /**
5906
+ * @hidden
5907
+ */
5908
+ const getElementIdentifier = (element) => {
5909
+ if (!isDocumentAvailable()) {
5910
+ return null;
5911
+ }
5912
+ return element.getAttribute('formcontrolname') ||
5913
+ element.getAttribute('name') ||
5914
+ element.id;
5915
+ };
5916
+ /**
5917
+ * Specifies custom inputs (Kendo components) to include in Smart Paste.
5918
+ * Each custom input has an identifier used to detect the component.
5919
+ * Defaults to common Kendo UI components (DropDownList, ComboBox, AutoComplete, MultiSelect, DatePicker, etc.).
5920
+ *
5921
+ * @hidden
5922
+ */
5923
+ const customInputs = [
5924
+ { identifier: '.k-checkbox' },
5925
+ { identifier: '.k-colorpalette' },
5926
+ { identifier: '.k-colorgradient' },
5927
+ { identifier: '.k-flatcolorpicker' },
5928
+ { identifier: '.k-otp' },
5929
+ { identifier: '.k-textbox' },
5930
+ { identifier: '.k-radio' },
5931
+ { identifier: '.k-slider' },
5932
+ { identifier: '.k-rating' },
5933
+ { identifier: '.k-signature' },
5934
+ { identifier: '.k-switch' },
5935
+ { identifier: '.k-textarea' },
5936
+ { identifier: '.k-calendar' },
5937
+ { identifier: '.k-timepicker' },
5938
+ { identifier: '.k-dateinput' },
5939
+ { identifier: '.k-datetimepicker' },
5940
+ { identifier: '.k-dropdownlist' },
5941
+ { identifier: '.k-combobox' },
5942
+ { identifier: '.k-autocomplete' },
5943
+ { identifier: '.k-multiselect' },
5944
+ { identifier: '.k-datepicker' },
5945
+ { identifier: '.k-numerictextbox' },
5946
+ { identifier: '.k-maskedtextbox' },
5947
+ { identifier: '.k-colorpicker' },
5948
+ { identifier: '.k-dropdowntree' },
5949
+ { identifier: '.k-multiselecttree' },
5950
+ ];
5951
+ const DATEPICKER_SELECTOR = '.k-datepicker';
5952
+ const TIMEPICKER_SELECTOR = '.k-timepicker';
5953
+ const DATETIMEPICKER_SELECTOR = '.k-datetimepicker';
5954
+ const DATERANGEPICKER_SELECTOR = '.k-daterangepicker';
5955
+ const CHECKBOX_SELECTOR = '.k-checkbox';
5956
+ const RADIO_SELECTOR = '.k-radio';
5957
+ const NUMERICTEXTBOX_SELECTOR = '.k-numerictextbox';
5958
+ /**
5959
+ * @hidden
5960
+ */
5961
+ const requiresDateValue = (element) => {
5962
+ const isDateInput = [DATEPICKER_SELECTOR, TIMEPICKER_SELECTOR, DATETIMEPICKER_SELECTOR, DATERANGEPICKER_SELECTOR];
5963
+ return isDateInput.some(selector => element.classList.contains(selector.slice(1)));
5964
+ };
5965
+ /**
5966
+ * @hidden
5967
+ */
5968
+ const requiresBooleanValue = (element) => {
5969
+ const isBooleanInput = [CHECKBOX_SELECTOR, RADIO_SELECTOR];
5970
+ return isBooleanInput.some(selector => element.classList.contains(selector.slice(1)));
5971
+ };
5972
+ /**
5973
+ * @hidden
5974
+ */
5975
+ const requiresNumericValue = (element) => {
5976
+ const isNumericInput = [NUMERICTEXTBOX_SELECTOR];
5977
+ return isNumericInput.some(selector => element.classList.contains(selector.slice(1)));
5978
+ };
5979
+ /**
5980
+ * @hidden
5981
+ */
5982
+ const populateCustomInputs = (element, value) => {
5983
+ const parseNumericValue = requiresNumericValue(element);
5984
+ if (parseNumericValue) {
5985
+ const numericValue = parseFloat(value);
5986
+ return !isNaN(numericValue) ? numericValue : null;
5987
+ }
5988
+ const parseBooleanValue = requiresBooleanValue(element);
5989
+ if (parseBooleanValue) {
5990
+ return value.toLowerCase() === 'true';
5991
+ }
5992
+ const parseDateValue = requiresDateValue(element);
5993
+ if (parseDateValue) {
5994
+ const dateValue = new Date(value);
5995
+ return !isNaN(dateValue.getTime()) ? dateValue : null;
5996
+ }
5997
+ return value;
5998
+ };
5999
+ /**
6000
+ * @hidden
6001
+ */
6002
+ const readClipboard = async () => {
6003
+ return await navigator.clipboard.readText();
6004
+ };
6005
+ /**
6006
+ * @hidden
6007
+ */
6008
+ const sendSmartPasteRequest = (http, requestData) => {
6009
+ const body = {
6010
+ formFields: requestData.formFields,
6011
+ content: requestData.content
6012
+ };
6013
+ const request = new HttpRequest(requestData.requestOptions?.method || 'POST', requestData.url, body, requestData.requestOptions);
6014
+ return http.request(request).pipe(filter((event) => event.type === HttpEventType.Response));
6015
+ };
6016
+
6017
+ const DEFAULT_SVG_ICON = pasteSparkleIcon;
6018
+ const DEFAULT_ICON = 'paste-sparkle';
6019
+ /**
6020
+ * Represents the Kendo UI SmartPasteButton component for Angular.
6021
+ *
6022
+ * Fills form fields with AI-powered data extraction from clipboard content.
6023
+ */
6024
+ class SmartPasteButtonComponent {
6025
+ renderer;
6026
+ ngZone;
6027
+ http;
6028
+ controlContainer;
6029
+ /**
6030
+ * Specifies the form controls to include in Smart Paste.
6031
+ * When not set, all form controls are included.
6032
+ *
6033
+ * @default null
6034
+ */
6035
+ formFields = null;
6036
+ /**
6037
+ * When `true`, disables the SmartPasteButton and prevents user interaction.
6038
+ *
6039
+ * @default false
6040
+ */
6041
+ set disabled(disabled) {
6042
+ if (disabled && isDocumentAvailable() && isFirefox(navigator.userAgent)) {
6043
+ this.blur();
6044
+ }
6045
+ this.isDisabled = disabled;
6046
+ this.renderer.setProperty(this.element, 'disabled', disabled);
6047
+ }
6048
+ get disabled() {
6049
+ return this.isDisabled;
6050
+ }
6051
+ /**
6052
+ * Sets the padding of the SmartPasteButton.
6053
+ *
6054
+ * @default undefined
6055
+ */
6056
+ set size(size) {
6057
+ this.handleClasses(size, 'size');
6058
+ this._size = size;
6059
+ }
6060
+ get size() {
6061
+ return this._size;
6062
+ }
6063
+ /**
6064
+ * Sets the border radius of the SmartPasteButton.
6065
+ *
6066
+ * @default undefined
6067
+ */
6068
+ set rounded(rounded) {
6069
+ this.handleClasses(rounded, 'rounded');
6070
+ this._rounded = rounded;
6071
+ }
6072
+ get rounded() {
6073
+ return this._rounded;
6074
+ }
6075
+ /**
6076
+ * Sets the background and border styles of the SmartPasteButton.
6077
+ *
6078
+ * @default undefined
6079
+ */
6080
+ set fillMode(fillMode) {
6081
+ this.handleClasses(fillMode, 'fillMode');
6082
+ this._fillMode = fillMode;
6083
+ }
6084
+ get fillMode() {
6085
+ return this._fillMode;
6086
+ }
6087
+ /**
6088
+ * Sets a predefined theme color for the SmartPasteButton.
6089
+ * The theme color applies as a background and border color and adjusts the text color.
6090
+ *
6091
+ * @default undefined
6092
+ */
6093
+ set themeColor(themeColor) {
6094
+ this.handleThemeColor(themeColor);
6095
+ this._themeColor = themeColor;
6096
+ }
6097
+ get themeColor() {
6098
+ return this._themeColor;
6099
+ }
6100
+ /**
6101
+ * Sets an SVG icon to display inside the SmartPasteButton.
6102
+ */
6103
+ set svgIcon(icon) {
6104
+ if (isDevMode() && icon && this.iconClass) {
6105
+ throw new Error('Setting both icon/svgIcon and iconClass options at the same time is not supported.');
6106
+ }
6107
+ this._svgIcon = icon;
6108
+ }
6109
+ get svgIcon() {
6110
+ return this._svgIcon;
6111
+ }
6112
+ /**
6113
+ * Specifies a URL for an `img` element inside the SmartPasteButton.
6114
+ * The URL can be relative or absolute. When relative, the browser evaluates it relative to the web page URL.
6115
+ */
6116
+ imageUrl;
6117
+ /**
6118
+ * Defines one or more CSS classes separated by spaces for a `span` element inside the SmartPasteButton.
6119
+ * Use `iconClass` to add custom icons.
6120
+ */
6121
+ set iconClass(value) {
6122
+ const hasCustomIcon = this.icon !== DEFAULT_ICON || this.svgIcon !== DEFAULT_SVG_ICON;
6123
+ if (isDevMode() && value && hasCustomIcon) {
6124
+ throw new Error('Setting both icon/svgIcon and iconClass options at the same time is not supported.');
6125
+ }
6126
+ if (!hasCustomIcon) {
6127
+ this._icon = null;
6128
+ this._svgIcon = null;
6129
+ }
6130
+ this._iconClass = value;
6131
+ }
6132
+ get iconClass() {
6133
+ return this._iconClass;
6134
+ }
6135
+ /**
6136
+ * Specifies the icon name to display in the SmartPasteButton.
6137
+ *
6138
+ * @default 'paste-sparkle'
6139
+ */
6140
+ set icon(name) {
6141
+ if (isDevMode() && name && this.iconClass) {
6142
+ throw new Error('Setting both icon/svgIcon and iconClass options at the same time is not supported.');
6143
+ }
6144
+ this._icon = name;
6145
+ }
6146
+ get icon() {
6147
+ return this._icon;
6148
+ }
6149
+ /**
6150
+ * Sets the URL to which Smart Paste sends the AI request.
6151
+ * When set, the component sends and handles an HTTP request automatically. Handle the `requestStart` event to modify request options before sending.
6152
+ * When not set, the component does not send an HTTP request. Handle the `requestStart` event to send and manage a custom HTTP request.
6153
+ */
6154
+ requestUrl;
6155
+ /**
6156
+ * Configures the HTTP request options for the AI request.
6157
+ * Use this to customize headers, method, credentials, and other request settings.
6158
+ */
6159
+ requestOptions;
6160
+ /**
6161
+ * Sets static form field metadata to bypass DOM extraction when Smart Paste runs.
6162
+ * Use this when you want to provide form field configuration directly instead of extracting it from the DOM.
6163
+ *
6164
+ * @default null
6165
+ */
6166
+ smartPasteFormFields = null;
6167
+ /**
6168
+ * Fires when the Smart Paste request is about to start.
6169
+ * Prevent the event to stop the request before sending it.
6170
+ */
6171
+ requestStart = new EventEmitter();
6172
+ /**
6173
+ * Fires when the Smart Paste request completes, either successfully or with an error.
6174
+ * Prevent the event to cancel populating the form fields with the response data.
6175
+ */
6176
+ requestEnd = new EventEmitter();
6177
+ /**
6178
+ * Fires when the user cancels an ongoing Smart Paste request.
6179
+ */
6180
+ requestCancel = new EventEmitter();
6181
+ get iconButtonClass() {
6182
+ return !this.hasText;
6183
+ }
6184
+ classButton = true;
6185
+ get classDisabled() {
6186
+ return this.isDisabled;
6187
+ }
6188
+ get getDirection() {
6189
+ return this.direction;
6190
+ }
6191
+ onFocus() {
6192
+ this.isFocused = true;
6193
+ }
6194
+ onBlur() {
6195
+ this.isFocused = false;
6196
+ }
6197
+ /**
6198
+ * Focuses the SmartPasteButton.
6199
+ */
6200
+ focus() {
6201
+ if (isDocumentAvailable()) {
6202
+ this.element.focus();
6203
+ this.isFocused = true;
6204
+ }
6205
+ }
6206
+ /**
6207
+ * Removes focus from the SmartPasteButton.
6208
+ */
6209
+ blur() {
6210
+ if (isDocumentAvailable()) {
6211
+ this.element.blur();
6212
+ this.isFocused = false;
6213
+ }
6214
+ }
6215
+ get hasText() {
6216
+ return isDocumentAvailable() && this.element.textContent.trim().length > 0;
6217
+ }
6218
+ set isFocused(isFocused) {
6219
+ toggleClass('k-focus', isFocused, this.renderer, this.element);
6220
+ this._focused = isFocused;
6221
+ }
6222
+ get isFocused() {
6223
+ return this._focused;
6224
+ }
6225
+ element;
6226
+ isDisabled = false;
6227
+ subs = new Subscription();
6228
+ _size = undefined;
6229
+ _rounded = undefined;
6230
+ _fillMode = undefined;
6231
+ _themeColor = undefined;
6232
+ _focused = false;
6233
+ direction;
6234
+ _iconClass;
6235
+ _icon = DEFAULT_ICON;
6236
+ _svgIcon = DEFAULT_SVG_ICON;
6237
+ kendoSmartPaste;
6238
+ smartPasteBusy = false;
6239
+ currentRequestSubscription = null;
6240
+ nativeForm = null;
6241
+ constructor(elementRef, renderer, localization, ngZone, http, controlContainer) {
6242
+ this.renderer = renderer;
6243
+ this.ngZone = ngZone;
6244
+ this.http = http;
6245
+ this.controlContainer = controlContainer;
6246
+ validatePackage(packageMetadata);
6247
+ this.direction = localization.rtl ? 'rtl' : 'ltr';
6248
+ this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
6249
+ this.element = elementRef.nativeElement;
6250
+ }
6251
+ ngOnInit() {
6252
+ this.nativeForm = this.element.form;
6253
+ this.kendoSmartPaste = new KendoSmartPaste({
6254
+ getElement: () => this.nativeForm,
6255
+ customInputs: customInputs || undefined,
6256
+ getSmartPasteField: this.defaultGetSmartPasteField,
6257
+ setKendoInputValue: this.defaultSetKendoInputValue
6258
+ });
6259
+ this.ngZone.runOutsideAngular(() => {
6260
+ this.subs.add(this.renderer.listen(this.element, 'click', this.paste.bind(this)));
6261
+ this.subs.add(this.renderer.listen(this.element, 'mousedown', (event) => {
6262
+ const isBrowserSafari = isDocumentAvailable() && isSafari(navigator.userAgent);
6263
+ if (!this.isDisabled && isBrowserSafari) {
6264
+ event.preventDefault();
6265
+ this.element.focus();
6266
+ }
6267
+ }));
6268
+ });
6269
+ }
6270
+ ngOnDestroy() {
6271
+ this.unsubscribeCurrentRequest();
6272
+ this.subs.unsubscribe();
6273
+ }
6274
+ /**
6275
+ * Starts the Smart Paste operation.
6276
+ * Reads clipboard content and sends it to the AI service for processing.
6277
+ */
6278
+ async paste() {
6279
+ if (!this.nativeForm) {
6280
+ return;
6281
+ }
6282
+ if (this.smartPasteBusy) {
6283
+ this.requestCancel.emit();
6284
+ this.unsubscribeCurrentRequest();
6285
+ this.smartPasteBusy = false;
6286
+ return;
6287
+ }
6288
+ let clipboardContent;
6289
+ try {
6290
+ clipboardContent = await readClipboard();
6291
+ }
6292
+ catch (error) {
6293
+ this.ngZone.run(() => {
6294
+ const responseErrorEvent = new SmartPasteRequestEndEvent(error);
6295
+ this.requestEnd.emit(responseErrorEvent);
6296
+ });
6297
+ return;
6298
+ }
6299
+ if (!clipboardContent || clipboardContent.trim() === '') {
6300
+ return;
6301
+ }
6302
+ this.smartPasteBusy = true;
6303
+ this.unsubscribeCurrentRequest();
6304
+ const formFields = this.extractFormFields();
6305
+ const requestData = {
6306
+ formFields,
6307
+ content: clipboardContent,
6308
+ url: this.requestUrl,
6309
+ requestOptions: {
6310
+ ...this.requestOptions
6311
+ }
6312
+ };
6313
+ if (!this.requestUrl) {
6314
+ this.smartPasteBusy = false;
6315
+ return;
6316
+ }
6317
+ this.ngZone.run(() => {
6318
+ const requestStartEvent = new SmartPasteRequestStartEvent(requestData);
6319
+ this.requestStart.emit(requestStartEvent);
6320
+ if (requestStartEvent.isDefaultPrevented()) {
6321
+ this.smartPasteBusy = false;
6322
+ return;
6323
+ }
6324
+ if (!this.smartPasteBusy) {
6325
+ return;
6326
+ }
6327
+ this.handleSmartPasteRequest(requestData, formFields);
6328
+ });
6329
+ }
6330
+ sendSmartPasteRequest(requestData) {
6331
+ const body = {
6332
+ formFields: requestData.formFields,
6333
+ content: requestData.content
6334
+ };
6335
+ const request = new HttpRequest(requestData.requestOptions?.method || 'POST', requestData.url, body, requestData.requestOptions);
6336
+ return this.http.request(request).pipe(filter((event) => event.type === HttpEventType.Response));
6337
+ }
6338
+ unsubscribeCurrentRequest() {
6339
+ if (this.currentRequestSubscription) {
6340
+ this.currentRequestSubscription.unsubscribe();
6341
+ this.currentRequestSubscription = null;
6342
+ }
6343
+ }
6344
+ defaultGetSmartPasteField = (field) => {
6345
+ const element = field.element;
6346
+ if (isFieldIgnored(element)) {
6347
+ return null;
6348
+ }
6349
+ const hasKendoWrapper = customInputs.some(input => {
6350
+ if (!element.classList.contains(input.identifier.slice(1)) && element.closest(input.identifier)) {
6351
+ return true;
6352
+ }
6353
+ });
6354
+ if (hasKendoWrapper) {
6355
+ return null;
6356
+ }
6357
+ if (field.type === 'kendo-input') {
6358
+ const identifier = getElementIdentifier(element);
6359
+ if (!identifier) {
6360
+ return null;
6361
+ }
6362
+ if (requiresBooleanValue(element)) {
6363
+ field.allowedValues = ['true', 'false'];
6364
+ }
6365
+ field.field = identifier;
6366
+ }
6367
+ return field;
6368
+ };
6369
+ defaultSetKendoInputValue = (field, value) => {
6370
+ const element = field.element;
6371
+ const controlName = getElementIdentifier(element);
6372
+ if (!controlName || !this.controlContainer) {
6373
+ return;
6374
+ }
6375
+ const control = this.controlContainer.control.get?.(controlName);
6376
+ if (!control || typeof control.setValue !== 'function') {
6377
+ return;
6378
+ }
6379
+ const updatedValue = populateCustomInputs(element, value);
6380
+ if (!isPresent$1(updatedValue)) {
6381
+ return;
6382
+ }
6383
+ this.setControlValue(control, updatedValue);
6384
+ };
6385
+ setControlValue(control, value) {
6386
+ this.ngZone.run(() => {
6387
+ control.setValue(value);
6388
+ control.markAsDirty();
6389
+ control.updateValueAndValidity();
6390
+ });
6391
+ }
6392
+ extractFormFields() {
6393
+ if (!this.formFields || this.formFields.length === 0) {
6394
+ return this.kendoSmartPaste.extractFormConfig();
6395
+ }
6396
+ else {
6397
+ const formFields = this.formFields.map(field => {
6398
+ const element = this.nativeForm?.querySelector(`#${field.field}`);
6399
+ return {
6400
+ ...field,
6401
+ element
6402
+ };
6403
+ });
6404
+ return formFields;
6405
+ }
6406
+ }
6407
+ handleClasses(value, input) {
6408
+ const elem = this.element;
6409
+ const classes = getStylingClasses('button', input, this[input], value);
6410
+ if (input === 'fillMode') {
6411
+ this.handleThemeColor(this.themeColor);
6412
+ }
6413
+ if (classes.toRemove) {
6414
+ this.renderer.removeClass(elem, classes.toRemove);
6415
+ }
6416
+ if (classes.toAdd) {
6417
+ this.renderer.addClass(elem, classes.toAdd);
6418
+ }
6419
+ }
6420
+ handleThemeColor(value) {
6421
+ const elem = this.element;
6422
+ const themeColorClass = getThemeColorClasses('button', this.themeColor, value);
6423
+ if (themeColorClass.toRemove) {
6424
+ this.renderer.removeClass(elem, themeColorClass.toRemove);
6425
+ }
6426
+ if (themeColorClass.toAdd) {
6427
+ this.renderer.addClass(elem, themeColorClass.toAdd);
6428
+ }
6429
+ }
6430
+ handleSmartPasteRequest(requestData, formFields) {
6431
+ this.currentRequestSubscription = this.sendSmartPasteRequest(requestData).subscribe((response) => {
6432
+ if (!this.smartPasteBusy) {
6433
+ return;
6434
+ }
6435
+ const responseEvent = new SmartPasteRequestEndEvent(response);
6436
+ this.requestEnd.emit(responseEvent);
6437
+ if (responseEvent.isDefaultPrevented()) {
6438
+ this.smartPasteBusy = false;
6439
+ return;
6440
+ }
6441
+ if (response?.body?.fieldValues) {
6442
+ this.kendoSmartPaste.populateFormFields(response.body, formFields);
6443
+ }
6444
+ this.smartPasteBusy = false;
6445
+ this.currentRequestSubscription = null;
6446
+ }, (error) => {
6447
+ if (!this.smartPasteBusy) {
6448
+ return;
6449
+ }
6450
+ const responseErrorEvent = new SmartPasteRequestEndEvent(error);
6451
+ this.requestEnd.emit(responseErrorEvent);
6452
+ this.smartPasteBusy = false;
6453
+ this.currentRequestSubscription = null;
6454
+ });
6455
+ }
6456
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SmartPasteButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.NgZone }, { token: i2.HttpClient }, { token: i3$1.ControlContainer, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });
6457
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: SmartPasteButtonComponent, isStandalone: true, selector: "button[kendoSmartPasteButton]", inputs: { formFields: "formFields", disabled: "disabled", size: "size", rounded: "rounded", fillMode: "fillMode", themeColor: "themeColor", svgIcon: "svgIcon", imageUrl: "imageUrl", iconClass: "iconClass", icon: "icon", requestUrl: "requestUrl", requestOptions: "requestOptions", smartPasteFormFields: "smartPasteFormFields" }, outputs: { requestStart: "requestStart", requestEnd: "requestEnd", requestCancel: "requestCancel" }, host: { listeners: { "focus": "onFocus()", "blur": "onBlur()" }, properties: { "class.k-icon-button": "this.iconButtonClass", "class.k-button": "this.classButton", "class.k-disabled": "this.classDisabled", "attr.dir": "this.getDirection" } }, providers: [
6458
+ LocalizationService,
6459
+ {
6460
+ provide: L10N_PREFIX,
6461
+ useValue: 'kendo.smartpastebutton'
6462
+ }
6463
+ ], exportAs: ["kendoSmartPasteButton"], ngImport: i0, template: `
6464
+ @if (icon || svgIcon) {
6465
+ <kendo-icon-wrapper
6466
+ innerCssClass="k-button-icon"
6467
+ [name]="icon"
6468
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
6469
+ }
6470
+ @if (imageUrl) {
6471
+ <span class="k-button-icon k-icon">
6472
+ <img [src]="imageUrl" class="k-image" role="presentation" />
6473
+ </span>
6474
+ }
6475
+ @if (iconClass) {
6476
+ <span class="k-button-icon" [ngClass]="iconClass"></span>
6477
+ }
6478
+ <span class="k-button-text"><ng-content></ng-content></span>
6479
+ `, isInline: true, dependencies: [{ kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
6480
+ }
6481
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SmartPasteButtonComponent, decorators: [{
6482
+ type: Component,
6483
+ args: [{
6484
+ exportAs: 'kendoSmartPasteButton',
6485
+ providers: [
6486
+ LocalizationService,
6487
+ {
6488
+ provide: L10N_PREFIX,
6489
+ useValue: 'kendo.smartpastebutton'
6490
+ }
6491
+ ],
6492
+ selector: 'button[kendoSmartPasteButton]',
6493
+ standalone: true,
6494
+ imports: [IconWrapperComponent, NgClass],
6495
+ template: `
6496
+ @if (icon || svgIcon) {
6497
+ <kendo-icon-wrapper
6498
+ innerCssClass="k-button-icon"
6499
+ [name]="icon"
6500
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
6501
+ }
6502
+ @if (imageUrl) {
6503
+ <span class="k-button-icon k-icon">
6504
+ <img [src]="imageUrl" class="k-image" role="presentation" />
6505
+ </span>
6506
+ }
6507
+ @if (iconClass) {
6508
+ <span class="k-button-icon" [ngClass]="iconClass"></span>
6509
+ }
6510
+ <span class="k-button-text"><ng-content></ng-content></span>
6511
+ `
6512
+ }]
6513
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.NgZone }, { type: i2.HttpClient }, { type: i3$1.ControlContainer, decorators: [{
6514
+ type: Optional
6515
+ }, {
6516
+ type: SkipSelf
6517
+ }] }], propDecorators: { formFields: [{
6518
+ type: Input
6519
+ }], disabled: [{
6520
+ type: Input
6521
+ }], size: [{
6522
+ type: Input
6523
+ }], rounded: [{
6524
+ type: Input
6525
+ }], fillMode: [{
6526
+ type: Input
6527
+ }], themeColor: [{
6528
+ type: Input
6529
+ }], svgIcon: [{
6530
+ type: Input
6531
+ }], imageUrl: [{
6532
+ type: Input
6533
+ }], iconClass: [{
6534
+ type: Input
6535
+ }], icon: [{
6536
+ type: Input
6537
+ }], requestUrl: [{
6538
+ type: Input
6539
+ }], requestOptions: [{
6540
+ type: Input
6541
+ }], smartPasteFormFields: [{
6542
+ type: Input
6543
+ }], requestStart: [{
6544
+ type: Output
6545
+ }], requestEnd: [{
6546
+ type: Output
6547
+ }], requestCancel: [{
6548
+ type: Output
6549
+ }], iconButtonClass: [{
6550
+ type: HostBinding,
6551
+ args: ['class.k-icon-button']
6552
+ }], classButton: [{
6553
+ type: HostBinding,
6554
+ args: ['class.k-button']
6555
+ }], classDisabled: [{
6556
+ type: HostBinding,
6557
+ args: ['class.k-disabled']
6558
+ }], getDirection: [{
6559
+ type: HostBinding,
6560
+ args: ['attr.dir']
6561
+ }], onFocus: [{
6562
+ type: HostListener,
6563
+ args: ['focus']
6564
+ }], onBlur: [{
6565
+ type: HostListener,
6566
+ args: ['blur']
6567
+ }] } });
6568
+
5855
6569
  /**
5856
6570
  * Use the `KENDO_BUTTON` utility array to add all Button-related components and directives to a standalone Angular component.
5857
6571
  *
@@ -5988,6 +6702,22 @@ const KENDO_SPLITBUTTON = [
5988
6702
  const KENDO_SPEECHTOTEXTBUTTON = [
5989
6703
  SpeechToTextButtonComponent
5990
6704
  ];
6705
+ /**
6706
+ * Use the `KENDO_SMARTPASTEBUTTON` utility array to add all SmartPasteButton-related components and directives to a standalone Angular component.
6707
+ *
6708
+ * @example
6709
+ * ```typescript
6710
+ * @Component({
6711
+ * standalone: true,
6712
+ * imports: [KENDO_SMARTPASTEBUTTON],
6713
+ * // ...
6714
+ * })
6715
+ * export class MyComponent {}
6716
+ * ```
6717
+ */
6718
+ const KENDO_SMARTPASTEBUTTON = [
6719
+ SmartPasteButtonComponent
6720
+ ];
5991
6721
  /**
5992
6722
  * Use the `KENDO_BUTTONS` utility array to add all `@progress/kendo-angular-buttons`-related components and directives to a standalone Angular component.
5993
6723
  *
@@ -6009,7 +6739,8 @@ const KENDO_BUTTONS = [
6009
6739
  ...KENDO_CHIPLIST,
6010
6740
  ...KENDO_FLOATINGACTIONBUTTON,
6011
6741
  ...KENDO_SPLITBUTTON,
6012
- ...KENDO_SPEECHTOTEXTBUTTON
6742
+ ...KENDO_SPEECHTOTEXTBUTTON,
6743
+ ...KENDO_SMARTPASTEBUTTON
6013
6744
  ];
6014
6745
 
6015
6746
  //IMPORTANT: NgModule export kept for backwards compatibility
@@ -6112,8 +6843,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
6112
6843
  */
6113
6844
  class ButtonsModule {
6114
6845
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6115
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: ButtonsModule, imports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, SpeechToTextButtonComponent, i12.ToggleButtonTabStopDirective], exports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, SpeechToTextButtonComponent, i12.ToggleButtonTabStopDirective] });
6116
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ButtonsModule, providers: [IconsService, PopupService, ResizeBatchService], imports: [ButtonComponent, ButtonComponent, DropDownButtonComponent, ChipComponent, ChipComponent, FloatingActionButtonComponent, SplitButtonComponent, SpeechToTextButtonComponent] });
6846
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: ButtonsModule, imports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, SpeechToTextButtonComponent, SmartPasteButtonComponent, i12.ToggleButtonTabStopDirective], exports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, SpeechToTextButtonComponent, SmartPasteButtonComponent, i12.ToggleButtonTabStopDirective] });
6847
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ButtonsModule, providers: [IconsService, PopupService, ResizeBatchService], imports: [ButtonComponent, ButtonComponent, DropDownButtonComponent, ChipComponent, ChipComponent, FloatingActionButtonComponent, SplitButtonComponent, SpeechToTextButtonComponent, SmartPasteButtonComponent] });
6117
6848
  }
6118
6849
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ButtonsModule, decorators: [{
6119
6850
  type: NgModule,
@@ -6281,9 +7012,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
6281
7012
  }]
6282
7013
  }] });
6283
7014
 
7015
+ /**
7016
+ * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
7017
+ * definition for the SmartPasteButton component.
7018
+ *
7019
+ * The module is meant for backward compatibility. For new applications, use the standalone SmartPasteButton component.
7020
+ *
7021
+ * @example
7022
+ * ```ts-no-run
7023
+ * import { SmartPasteButtonModule } from '@progress/kendo-angular-buttons';
7024
+ *
7025
+ * _@NgModule({
7026
+ * imports: [SmartPasteButtonModule]
7027
+ * })
7028
+ * export class AppModule {}
7029
+ * ```
7030
+ */
7031
+ class SmartPasteButtonModule {
7032
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SmartPasteButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
7033
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: SmartPasteButtonModule, imports: [SmartPasteButtonComponent], exports: [SmartPasteButtonComponent] });
7034
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SmartPasteButtonModule, imports: [SmartPasteButtonComponent] });
7035
+ }
7036
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SmartPasteButtonModule, decorators: [{
7037
+ type: NgModule,
7038
+ args: [{
7039
+ exports: [SmartPasteButtonComponent],
7040
+ imports: [SmartPasteButtonComponent]
7041
+ }]
7042
+ }] });
7043
+
6284
7044
  /**
6285
7045
  * Generated bundle index. Do not edit.
6286
7046
  */
6287
7047
 
6288
- export { ButtonComponent as Button, ButtonComponent, ButtonComponent as ButtonDirective, ButtonGroupComponent as ButtonGroup, ButtonGroupComponent, ButtonGroupModule, ButtonItemTemplateDirective, ButtonModule, ButtonsModule, ChipComponent, ChipListComponent, ChipModule, DialItemTemplateDirective, DropDownButtonComponent as DropDownButton, DropDownButtonComponent, DropDownButtonModule, FloatingActionButtonComponent, FloatingActionButtonModule, FloatingActionButtonTemplateDirective, FocusableDirective, KENDO_BUTTON, KENDO_BUTTONGROUP, KENDO_BUTTONS, KENDO_CHIP, KENDO_CHIPLIST, KENDO_DROPDOWNBUTTON, KENDO_FLOATINGACTIONBUTTON, KENDO_SPEECHTOTEXTBUTTON, KENDO_SPLITBUTTON, KendoButtonService, ListComponent, LocalizedSplitButtonMessagesDirective, PreventableEvent, SpeechToTextButtonComponent, SpeechToTextButtonModule, SplitButtonComponent as SplitButton, SplitButtonComponent, SplitButtonCustomMessagesComponent, SplitButtonModule };
7048
+ export { ButtonComponent as Button, ButtonComponent, ButtonComponent as ButtonDirective, ButtonGroupComponent as ButtonGroup, ButtonGroupComponent, ButtonGroupModule, ButtonItemTemplateDirective, ButtonModule, ButtonsModule, ChipComponent, ChipListComponent, ChipModule, DialItemTemplateDirective, DropDownButtonComponent as DropDownButton, DropDownButtonComponent, DropDownButtonModule, FloatingActionButtonComponent, FloatingActionButtonModule, FloatingActionButtonTemplateDirective, FocusableDirective, KENDO_BUTTON, KENDO_BUTTONGROUP, KENDO_BUTTONS, KENDO_CHIP, KENDO_CHIPLIST, KENDO_DROPDOWNBUTTON, KENDO_FLOATINGACTIONBUTTON, KENDO_SMARTPASTEBUTTON, KENDO_SPEECHTOTEXTBUTTON, KENDO_SPLITBUTTON, KendoButtonService, ListComponent, LocalizedSplitButtonMessagesDirective, PreventableEvent, SmartPasteButtonComponent, SmartPasteButtonModule, SmartPasteRequestEndEvent, SmartPasteRequestStartEvent, SpeechToTextButtonComponent, SpeechToTextButtonModule, SplitButtonComponent as SplitButton, SplitButtonComponent, SplitButtonCustomMessagesComponent, SplitButtonModule };
6289
7049