@progress/kendo-angular-buttons 11.3.0-develop.7 → 11.3.0-develop.9

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.
@@ -4,18 +4,19 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, Renderer2, Output, Optional, NgZone, isDevMode } from '@angular/core';
6
6
  import { KendoButtonService } from './button.service';
7
- import { isDocumentAvailable, isChanged, hasObservers, Keys } from '@progress/kendo-angular-common';
7
+ import { isDocumentAvailable, isChanged, hasObservers, Keys, isSafari, isFirefox } from '@progress/kendo-angular-common';
8
8
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
9
9
  import { Subscription } from 'rxjs';
10
10
  import { validatePackage } from '@progress/kendo-licensing';
11
11
  import { packageMetadata } from '../package-metadata';
12
- import { getStylingClasses, getThemeColorClasses, isFirefox } from '../util';
12
+ import { getStylingClasses, getThemeColorClasses } from '../util';
13
13
  import * as i0 from "@angular/core";
14
14
  import * as i1 from "./button.service";
15
15
  import * as i2 from "@progress/kendo-angular-l10n";
16
16
  import * as i3 from "@progress/kendo-angular-icons";
17
17
  import * as i4 from "@angular/common";
18
18
  const SPAN_TAG_NAME = 'SPAN';
19
+ const BUTTON_TAG_NAME = 'BUTTON';
19
20
  const KENDO_BUTTON_TAG_NAME = 'KENDO-BUTTON';
20
21
  const DEFAULT_ROUNDED = 'medium';
21
22
  const DEFAULT_SIZE = 'medium';
@@ -311,6 +312,15 @@ export class ButtonComponent {
311
312
  this._onButtonClick();
312
313
  }
313
314
  }));
315
+ this.subs.add(this.renderer.listen(this.element, 'mousedown', (event) => {
316
+ const elementTagName = this.element.tagName;
317
+ const isButton = elementTagName === BUTTON_TAG_NAME;
318
+ const isBrowserSafari = isDocumentAvailable() && isSafari(navigator.userAgent);
319
+ if (!this.isDisabled && isButton && isBrowserSafari) {
320
+ event.preventDefault();
321
+ this.element.focus();
322
+ }
323
+ }));
314
324
  });
315
325
  }
316
326
  ngOnChanges(change) {
@@ -167,7 +167,7 @@ export class ListButton {
167
167
  if (this._disabled) {
168
168
  return;
169
169
  }
170
- this._toggle(!this.openState);
170
+ this._toggle(!this.openState, true);
171
171
  if (!this.isClosePrevented) {
172
172
  this.focusService.focus(this.openState ? 0 : -1);
173
173
  }
@@ -229,7 +229,8 @@ export class ListButton {
229
229
  if (this.disabled) {
230
230
  return;
231
231
  }
232
- this._toggle((open === undefined) ? !this.openState : open);
232
+ const value = open === undefined ? !this.openState : open;
233
+ this._toggle(value, false);
233
234
  }
234
235
  /**
235
236
  * @hidden
@@ -343,20 +344,22 @@ export class ListButton {
343
344
  onArrowKeyNavigate({ index }) {
344
345
  this.focusService.focus(index);
345
346
  }
346
- _toggle(open) {
347
+ _toggle(open, emitEvent) {
347
348
  if (this.openState === open) {
348
349
  return;
349
350
  }
350
351
  const eventArgs = new PreventableEvent();
351
- if (open && !this.openState) {
352
- this.open.emit(eventArgs);
353
- }
354
- else if (!open && this.openState) {
355
- this.close.emit(eventArgs);
356
- }
357
- if (eventArgs.isDefaultPrevented()) {
358
- this.isClosePrevented = true;
359
- return;
352
+ if (emitEvent) {
353
+ if (open && !this.openState) {
354
+ this.open.emit(eventArgs);
355
+ }
356
+ else if (!open && this.openState) {
357
+ this.close.emit(eventArgs);
358
+ }
359
+ if (eventArgs.isDefaultPrevented()) {
360
+ this.isClosePrevented = true;
361
+ return;
362
+ }
360
363
  }
361
364
  this.openState = open;
362
365
  this.destroyPopup();
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-buttons',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1677072746,
13
- version: '11.3.0-develop.7',
12
+ publishDate: 1677099700,
13
+ version: '11.3.0-develop.9',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
15
15
  };
package/esm2020/util.mjs CHANGED
@@ -2,7 +2,6 @@
2
2
  * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { detectDesktopBrowser, detectMobileOS } from "@progress/kendo-common";
6
5
  /**
7
6
  * @hidden
8
7
  */
@@ -94,13 +93,3 @@ export const getThemeColorClasses = (componentType, prevFillMode, fillMode, prev
94
93
  toAdd: newValue !== 'none' ? `k-${componentType}-${fillMode}-${newValue}` : ''
95
94
  };
96
95
  };
97
- /**
98
- * @hidden
99
- *
100
- * Returns true if the used browser is Firefox.
101
- */
102
- export const isFirefox = (userAgent) => {
103
- const desktopBrowser = detectDesktopBrowser(userAgent);
104
- const mobileOS = detectMobileOS(userAgent);
105
- return (desktopBrowser && desktopBrowser.mozilla) || (mobileOS && mobileOS.browser === 'firefox');
106
- };
@@ -5,12 +5,11 @@
5
5
  import * as i0 from '@angular/core';
6
6
  import { Injectable, EventEmitter, isDevMode, Component, Optional, Input, Output, HostBinding, HostListener, ContentChildren, NgModule, Directive, InjectionToken, Inject, forwardRef, ElementRef, ViewContainerRef, ContentChild, ViewChild } from '@angular/core';
7
7
  import * as i9 from '@progress/kendo-angular-common';
8
- import { isDocumentAvailable, Keys, isChanged, hasObservers, guid, anyChanged, EventsModule } from '@progress/kendo-angular-common';
8
+ import { isDocumentAvailable, isFirefox, Keys, isSafari, isChanged, hasObservers, guid, anyChanged, EventsModule } from '@progress/kendo-angular-common';
9
9
  import * as i1 from '@progress/kendo-angular-l10n';
10
10
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
11
11
  import { Subject, Subscription, fromEvent, merge } from 'rxjs';
12
12
  import { validatePackage } from '@progress/kendo-licensing';
13
- import { detectDesktopBrowser, detectMobileOS } from '@progress/kendo-common';
14
13
  import * as i2 from '@progress/kendo-angular-icons';
15
14
  import { IconsModule } from '@progress/kendo-angular-icons';
16
15
  import * as i3 from '@angular/common';
@@ -29,8 +28,8 @@ const packageMetadata = {
29
28
  name: '@progress/kendo-angular-buttons',
30
29
  productName: 'Kendo UI for Angular',
31
30
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
32
- publishDate: 1677072746,
33
- version: '11.3.0-develop.7',
31
+ publishDate: 1677099700,
32
+ version: '11.3.0-develop.9',
34
33
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
35
34
  };
36
35
 
@@ -125,16 +124,6 @@ const getThemeColorClasses = (componentType, prevFillMode, fillMode, previousVal
125
124
  toAdd: newValue !== 'none' ? `k-${componentType}-${fillMode}-${newValue}` : ''
126
125
  };
127
126
  };
128
- /**
129
- * @hidden
130
- *
131
- * Returns true if the used browser is Firefox.
132
- */
133
- const isFirefox = (userAgent) => {
134
- const desktopBrowser = detectDesktopBrowser(userAgent);
135
- const mobileOS = detectMobileOS(userAgent);
136
- return (desktopBrowser && desktopBrowser.mozilla) || (mobileOS && mobileOS.browser === 'firefox');
137
- };
138
127
 
139
128
  /**
140
129
  * @hidden
@@ -155,6 +144,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
155
144
  }] });
156
145
 
157
146
  const SPAN_TAG_NAME = 'SPAN';
147
+ const BUTTON_TAG_NAME = 'BUTTON';
158
148
  const KENDO_BUTTON_TAG_NAME = 'KENDO-BUTTON';
159
149
  const DEFAULT_ROUNDED$3 = 'medium';
160
150
  const DEFAULT_SIZE$2 = 'medium';
@@ -450,6 +440,15 @@ class ButtonComponent {
450
440
  this._onButtonClick();
451
441
  }
452
442
  }));
443
+ this.subs.add(this.renderer.listen(this.element, 'mousedown', (event) => {
444
+ const elementTagName = this.element.tagName;
445
+ const isButton = elementTagName === BUTTON_TAG_NAME;
446
+ const isBrowserSafari = isDocumentAvailable() && isSafari(navigator.userAgent);
447
+ if (!this.isDisabled && isButton && isBrowserSafari) {
448
+ event.preventDefault();
449
+ this.element.focus();
450
+ }
451
+ }));
453
452
  });
454
453
  }
455
454
  ngOnChanges(change) {
@@ -1708,7 +1707,7 @@ class ListButton {
1708
1707
  if (this._disabled) {
1709
1708
  return;
1710
1709
  }
1711
- this._toggle(!this.openState);
1710
+ this._toggle(!this.openState, true);
1712
1711
  if (!this.isClosePrevented) {
1713
1712
  this.focusService.focus(this.openState ? 0 : -1);
1714
1713
  }
@@ -1770,7 +1769,8 @@ class ListButton {
1770
1769
  if (this.disabled) {
1771
1770
  return;
1772
1771
  }
1773
- this._toggle((open === undefined) ? !this.openState : open);
1772
+ const value = open === undefined ? !this.openState : open;
1773
+ this._toggle(value, false);
1774
1774
  }
1775
1775
  /**
1776
1776
  * @hidden
@@ -1884,20 +1884,22 @@ class ListButton {
1884
1884
  onArrowKeyNavigate({ index }) {
1885
1885
  this.focusService.focus(index);
1886
1886
  }
1887
- _toggle(open) {
1887
+ _toggle(open, emitEvent) {
1888
1888
  if (this.openState === open) {
1889
1889
  return;
1890
1890
  }
1891
1891
  const eventArgs = new PreventableEvent();
1892
- if (open && !this.openState) {
1893
- this.open.emit(eventArgs);
1894
- }
1895
- else if (!open && this.openState) {
1896
- this.close.emit(eventArgs);
1897
- }
1898
- if (eventArgs.isDefaultPrevented()) {
1899
- this.isClosePrevented = true;
1900
- return;
1892
+ if (emitEvent) {
1893
+ if (open && !this.openState) {
1894
+ this.open.emit(eventArgs);
1895
+ }
1896
+ else if (!open && this.openState) {
1897
+ this.close.emit(eventArgs);
1898
+ }
1899
+ if (eventArgs.isDefaultPrevented()) {
1900
+ this.isClosePrevented = true;
1901
+ return;
1902
+ }
1901
1903
  }
1902
1904
  this.openState = open;
1903
1905
  this.destroyPopup();
@@ -6,11 +6,10 @@ import * as i0 from '@angular/core';
6
6
  import { Injectable, EventEmitter, isDevMode, Component, Optional, Input, Output, HostBinding, HostListener, ContentChildren, NgModule, Directive, InjectionToken, Inject, forwardRef, ElementRef, ViewContainerRef, ContentChild, ViewChild } from '@angular/core';
7
7
  import { Subject, Subscription, fromEvent, merge } from 'rxjs';
8
8
  import * as i9 from '@progress/kendo-angular-common';
9
- import { isDocumentAvailable, Keys, isChanged, hasObservers, guid, anyChanged, EventsModule } from '@progress/kendo-angular-common';
9
+ import { isDocumentAvailable, isFirefox, Keys, isSafari, isChanged, hasObservers, guid, anyChanged, EventsModule } from '@progress/kendo-angular-common';
10
10
  import * as i1 from '@progress/kendo-angular-l10n';
11
11
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
12
12
  import { validatePackage } from '@progress/kendo-licensing';
13
- import { detectDesktopBrowser, detectMobileOS } from '@progress/kendo-common';
14
13
  import * as i2 from '@progress/kendo-angular-icons';
15
14
  import { IconsModule } from '@progress/kendo-angular-icons';
16
15
  import * as i3 from '@angular/common';
@@ -47,8 +46,8 @@ const packageMetadata = {
47
46
  name: '@progress/kendo-angular-buttons',
48
47
  productName: 'Kendo UI for Angular',
49
48
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
50
- publishDate: 1677072746,
51
- version: '11.3.0-develop.7',
49
+ publishDate: 1677099700,
50
+ version: '11.3.0-develop.9',
52
51
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
53
52
  };
54
53
 
@@ -143,18 +142,9 @@ const getThemeColorClasses = (componentType, prevFillMode, fillMode, previousVal
143
142
  toAdd: newValue !== 'none' ? `k-${componentType}-${fillMode}-${newValue}` : ''
144
143
  };
145
144
  };
146
- /**
147
- * @hidden
148
- *
149
- * Returns true if the used browser is Firefox.
150
- */
151
- const isFirefox = (userAgent) => {
152
- const desktopBrowser = detectDesktopBrowser(userAgent);
153
- const mobileOS = detectMobileOS(userAgent);
154
- return (desktopBrowser && desktopBrowser.mozilla) || (mobileOS && mobileOS.browser === 'firefox');
155
- };
156
145
 
157
146
  const SPAN_TAG_NAME = 'SPAN';
147
+ const BUTTON_TAG_NAME = 'BUTTON';
158
148
  const KENDO_BUTTON_TAG_NAME = 'KENDO-BUTTON';
159
149
  const DEFAULT_ROUNDED$3 = 'medium';
160
150
  const DEFAULT_SIZE$2 = 'medium';
@@ -450,6 +440,15 @@ class ButtonComponent {
450
440
  this._onButtonClick();
451
441
  }
452
442
  }));
443
+ this.subs.add(this.renderer.listen(this.element, 'mousedown', (event) => {
444
+ const elementTagName = this.element.tagName;
445
+ const isButton = elementTagName === BUTTON_TAG_NAME;
446
+ const isBrowserSafari = isDocumentAvailable() && isSafari(navigator.userAgent);
447
+ if (!this.isDisabled && isButton && isBrowserSafari) {
448
+ event.preventDefault();
449
+ this.element.focus();
450
+ }
451
+ }));
453
452
  });
454
453
  }
455
454
  ngOnChanges(change) {
@@ -1704,7 +1703,7 @@ class ListButton {
1704
1703
  if (this._disabled) {
1705
1704
  return;
1706
1705
  }
1707
- this._toggle(!this.openState);
1706
+ this._toggle(!this.openState, true);
1708
1707
  if (!this.isClosePrevented) {
1709
1708
  this.focusService.focus(this.openState ? 0 : -1);
1710
1709
  }
@@ -1766,7 +1765,8 @@ class ListButton {
1766
1765
  if (this.disabled) {
1767
1766
  return;
1768
1767
  }
1769
- this._toggle((open === undefined) ? !this.openState : open);
1768
+ const value = open === undefined ? !this.openState : open;
1769
+ this._toggle(value, false);
1770
1770
  }
1771
1771
  /**
1772
1772
  * @hidden
@@ -1880,20 +1880,22 @@ class ListButton {
1880
1880
  onArrowKeyNavigate({ index }) {
1881
1881
  this.focusService.focus(index);
1882
1882
  }
1883
- _toggle(open) {
1883
+ _toggle(open, emitEvent) {
1884
1884
  if (this.openState === open) {
1885
1885
  return;
1886
1886
  }
1887
1887
  const eventArgs = new PreventableEvent();
1888
- if (open && !this.openState) {
1889
- this.open.emit(eventArgs);
1890
- }
1891
- else if (!open && this.openState) {
1892
- this.close.emit(eventArgs);
1893
- }
1894
- if (eventArgs.isDefaultPrevented()) {
1895
- this.isClosePrevented = true;
1896
- return;
1888
+ if (emitEvent) {
1889
+ if (open && !this.openState) {
1890
+ this.open.emit(eventArgs);
1891
+ }
1892
+ else if (!open && this.openState) {
1893
+ this.close.emit(eventArgs);
1894
+ }
1895
+ if (eventArgs.isDefaultPrevented()) {
1896
+ this.isClosePrevented = true;
1897
+ return;
1898
+ }
1897
1899
  }
1898
1900
  this.openState = open;
1899
1901
  this.destroyPopup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-buttons",
3
- "version": "11.3.0-develop.7",
3
+ "version": "11.3.0-develop.9",
4
4
  "description": "Buttons Package for Angular",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -25,15 +25,15 @@
25
25
  "@angular/core": "13 - 15",
26
26
  "@angular/platform-browser": "13 - 15",
27
27
  "@progress/kendo-licensing": "^1.0.2",
28
- "@progress/kendo-angular-common": "11.3.0-develop.7",
29
- "@progress/kendo-angular-l10n": "11.3.0-develop.7",
30
- "@progress/kendo-angular-popup": "11.3.0-develop.7",
31
- "@progress/kendo-angular-icons": "11.3.0-develop.7",
28
+ "@progress/kendo-angular-common": "11.3.0-develop.9",
29
+ "@progress/kendo-angular-l10n": "11.3.0-develop.9",
30
+ "@progress/kendo-angular-popup": "11.3.0-develop.9",
31
+ "@progress/kendo-angular-icons": "11.3.0-develop.9",
32
32
  "rxjs": "^6.5.3 || ^7.0.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "tslib": "^2.3.1",
36
- "@progress/kendo-angular-schematics": "11.3.0-develop.7",
36
+ "@progress/kendo-angular-schematics": "11.3.0-develop.9",
37
37
  "@progress/kendo-common": "^0.2.1"
38
38
  },
39
39
  "schematics": "./schematics/collection.json",
package/util.d.ts CHANGED
@@ -39,9 +39,3 @@ export declare const getStylingClasses: (componentType: any, stylingOption: stri
39
39
  * Returns the themeColor classes to be added and removed
40
40
  */
41
41
  export declare const getThemeColorClasses: (componentType: any, prevFillMode: any, fillMode: any, previousValue: any, newValue: any) => ButtonStylingClasses;
42
- /**
43
- * @hidden
44
- *
45
- * Returns true if the used browser is Firefox.
46
- */
47
- export declare const isFirefox: (userAgent: any) => boolean;