@progress/kendo-angular-common 23.3.0-develop.2 → 23.3.0-develop.20

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.
@@ -369,6 +369,9 @@ const hasFocusableParent = (element, container) => {
369
369
  };
370
370
 
371
371
  const isVisible = (element) => {
372
+ if (!isDocumentAvailable() || !element?.getBoundingClientRect) {
373
+ return false;
374
+ }
372
375
  const rect = element.getBoundingClientRect();
373
376
  const hasSize = rect.width > 0 && rect.height > 0;
374
377
  const hasPosition = rect.x !== 0 && rect.y !== 0;
@@ -1104,7 +1107,7 @@ class WatermarkOverlayComponent {
1104
1107
  /* noop */
1105
1108
  };
1106
1109
  ngOnInit() {
1107
- if (bannerPresentOnPage || !this.licenseMessage) {
1110
+ if (bannerPresentOnPage || !this.licenseMessage || !isDocumentAvailable()) {
1108
1111
  return;
1109
1112
  }
1110
1113
  this.subscribeLicenseMessage();
@@ -1649,40 +1652,99 @@ class PreventableEvent {
1649
1652
 
1650
1653
  const canCreateElement = () => isDocumentAvailable() && document.createElement;
1651
1654
  const propName = '--kendo-scrollbar-width';
1655
+ let cachedScrollbarWidth = null;
1656
+ let cachedPixelRatio;
1657
+ let cachedRtlScrollLeft = null;
1652
1658
  /**
1653
1659
  * @hidden
1654
1660
  */
1655
1661
  const scrollbarWidth = () => {
1656
- let scrollbarWidth = 0;
1657
- if (canCreateElement()) {
1658
- const div = document.createElement('div');
1659
- div.style.cssText = 'overflow:scroll;overflow-x:hidden;zoom:1;clear:both;display:block';
1660
- div.innerHTML = ' ';
1661
- document.body.appendChild(div);
1662
- scrollbarWidth = div.offsetWidth - div.scrollWidth;
1663
- document.body.removeChild(div);
1664
- }
1665
- return scrollbarWidth;
1662
+ if (cachedScrollbarWidth === null && canCreateElement()) {
1663
+ cachedPixelRatio = window.devicePixelRatio || 1;
1664
+ const outer = document.createElement('div');
1665
+ const inner = document.createElement('div');
1666
+ outer.style.overflow = 'scroll';
1667
+ outer.style.overflowX = 'hidden';
1668
+ outer.style.zoom = '1';
1669
+ outer.style.clear = 'both';
1670
+ outer.style.display = 'block';
1671
+ outer.style.width = '100px';
1672
+ outer.style.visibility = 'hidden';
1673
+ inner.style.width = '100%';
1674
+ inner.style.display = 'block';
1675
+ outer.appendChild(inner);
1676
+ document.body.appendChild(outer);
1677
+ cachedScrollbarWidth = outer.getBoundingClientRect().width - inner.getBoundingClientRect().width;
1678
+ document.body.removeChild(outer);
1679
+ }
1680
+ return cachedScrollbarWidth;
1681
+ };
1682
+ /**
1683
+ * @hidden
1684
+ */
1685
+ const rtlScrollLeft = () => {
1686
+ if (cachedRtlScrollLeft === null && canCreateElement()) {
1687
+ const outer = document.createElement('div');
1688
+ outer.style.direction = 'rtl';
1689
+ outer.style.display = 'block';
1690
+ outer.style.clear = 'both';
1691
+ outer.style.width = '100px';
1692
+ outer.style.visibility = 'hidden';
1693
+ outer.style.position = 'absolute';
1694
+ outer.style.left = '-10000px';
1695
+ outer.style.overflow = 'scroll';
1696
+ outer.style.zoom = '1';
1697
+ const inner = document.createElement('div');
1698
+ inner.style.width = '200px';
1699
+ inner.style.height = '1px';
1700
+ outer.append(inner);
1701
+ document.body.appendChild(outer);
1702
+ const initial = outer.scrollLeft;
1703
+ outer.scrollLeft = -1;
1704
+ cachedRtlScrollLeft = outer.scrollLeft < 0 ? outer.scrollLeft : initial;
1705
+ document.body.removeChild(outer);
1706
+ }
1707
+ return cachedRtlScrollLeft;
1666
1708
  };
1667
1709
  /**
1668
1710
  * @hidden
1669
1711
  */
1670
- class ScrollbarWidthService {
1712
+ class ScrollbarService {
1671
1713
  changes = new EventEmitter();
1672
- constructor() {
1714
+ subscription;
1715
+ constructor(ngZone) {
1673
1716
  if (typeof window !== 'undefined' && isDocumentAvailable()) {
1674
1717
  document.body.style.setProperty(propName, `${scrollbarWidth()}px`);
1718
+ ngZone.runOutsideAngular(() => {
1719
+ this.subscription = fromEvent(window, 'resize').pipe(auditTime(100)).subscribe(() => {
1720
+ if (cachedPixelRatio !== window.devicePixelRatio) {
1721
+ cachedScrollbarWidth = null;
1722
+ document.body.style.setProperty(propName, `${scrollbarWidth()}px`);
1723
+ this.changes.emit();
1724
+ }
1725
+ });
1726
+ });
1675
1727
  }
1676
1728
  }
1677
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScrollbarWidthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1678
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScrollbarWidthService, providedIn: 'root' });
1729
+ get scrollbarWidth() {
1730
+ return scrollbarWidth();
1731
+ }
1732
+ get rtlScrollLeft() {
1733
+ return rtlScrollLeft();
1734
+ }
1735
+ ngOnDestroy() {
1736
+ this.subscription?.unsubscribe();
1737
+ this.subscription = null;
1738
+ }
1739
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScrollbarService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
1740
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScrollbarService, providedIn: 'root' });
1679
1741
  }
1680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScrollbarWidthService, decorators: [{
1742
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScrollbarService, decorators: [{
1681
1743
  type: Injectable,
1682
1744
  args: [{
1683
1745
  providedIn: 'root'
1684
1746
  }]
1685
- }], ctorParameters: () => [] });
1747
+ }], ctorParameters: () => [{ type: i0.NgZone }] });
1686
1748
 
1687
1749
  /**
1688
1750
  * @hidden
@@ -2037,5 +2099,5 @@ const replaceMessagePlaceholder = (message, name, value) => (message ?? '').repl
2037
2099
  * Generated bundle index. Do not edit.
2038
2100
  */
2039
2101
 
2040
- export { DraggableDirective, EventsOutsideAngularDirective, KENDO_ADORNMENTS, KENDO_COMMON, KENDO_DRAGGABLE, KENDO_EVENTS, KENDO_RESIZESENSOR, KENDO_TEMPLATE_CONTEXT, KENDO_TOGGLEBUTTONTABSTOP, KENDO_WATERMARK, KendoInput, Keys, MultiTabStop, PrefixTemplateDirective, PreventableEvent, ResizeBatchService, ResizeCompatService, ResizeObserverService, ResizeSensorComponent, ScrollbarWidthService, SeparatorComponent, SuffixTemplateDirective, TemplateContextDirective, ToggleButtonTabStopDirective, WatermarkOverlayComponent, anyChanged, applyAttributes, areObjectsEqual, closest, closestBySelector, closestInScope, contains, findElement, findFocusable, findFocusableChild, firefoxMaxHeight, focusableSelector, getLicenseMessage, getter, guid, hasClasses, hasFocusableParent, hasObservers, isChanged, isControlRequired, isDocumentAvailable, isFirefox, isFocusable, isFocusableWithTabKey, isObject, isObjectPresent, isPresent, isSafari, isSet, isString, isVisible, matchesClasses, matchesNodeName, normalizeKeys, parseAttributes, parseCSSClassNames, processCssValue, removeHTMLAttributes, replaceMessagePlaceholder, rtlScrollPosition, scrollbarWidth, setHTMLAttributes, setter, shouldShowValidationUI, splitStringToArray };
2102
+ export { ScrollbarService as BrowserSupportService, DraggableDirective, EventsOutsideAngularDirective, KENDO_ADORNMENTS, KENDO_COMMON, KENDO_DRAGGABLE, KENDO_EVENTS, KENDO_RESIZESENSOR, KENDO_TEMPLATE_CONTEXT, KENDO_TOGGLEBUTTONTABSTOP, KENDO_WATERMARK, KendoInput, Keys, MultiTabStop, PrefixTemplateDirective, PreventableEvent, ResizeBatchService, ResizeCompatService, ResizeObserverService, ResizeSensorComponent, ScrollbarService, SeparatorComponent, SuffixTemplateDirective, TemplateContextDirective, ToggleButtonTabStopDirective, WatermarkOverlayComponent, anyChanged, applyAttributes, areObjectsEqual, closest, closestBySelector, closestInScope, contains, findElement, findFocusable, findFocusableChild, firefoxMaxHeight, focusableSelector, getLicenseMessage, getter, guid, hasClasses, hasFocusableParent, hasObservers, isChanged, isControlRequired, isDocumentAvailable, isFirefox, isFocusable, isFocusableWithTabKey, isObject, isObjectPresent, isPresent, isSafari, isSet, isString, isVisible, matchesClasses, matchesNodeName, normalizeKeys, parseAttributes, parseCSSClassNames, processCssValue, removeHTMLAttributes, replaceMessagePlaceholder, rtlScrollLeft, rtlScrollPosition, scrollbarWidth, setHTMLAttributes, setter, shouldShowValidationUI, splitStringToArray };
2041
2103
 
package/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export * from './utils/setter';
17
17
  export * from './watermark';
18
18
  export * from './adornments';
19
19
  export { PreventableEvent } from './preventable-event';
20
- export { ScrollbarWidthService, scrollbarWidth } from './utils/scrollbar-width.service';
20
+ export { ScrollbarService, ScrollbarService as BrowserSupportService, scrollbarWidth, rtlScrollLeft } from './utils/scrollbar.service';
21
21
  export * from './toggle-button-tab-stop';
22
22
  export * from './directives';
23
23
  export * from './template-context';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-common",
3
- "version": "23.3.0-develop.2",
3
+ "version": "23.3.0-develop.20",
4
4
  "description": "Kendo UI for Angular - Utility Package",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -23,7 +23,7 @@
23
23
  "@progress/kendo-common": "^1.0.1",
24
24
  "@progress/kendo-draggable": "^3.0.2",
25
25
  "tslib": "^2.3.1",
26
- "@progress/kendo-angular-schematics": "23.3.0-develop.2"
26
+ "@progress/kendo-angular-schematics": "23.3.0-develop.20"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2026 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 { EventEmitter } from '@angular/core';
5
+ import { EventEmitter, NgZone, OnDestroy } from '@angular/core';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
8
8
  * @hidden
@@ -11,9 +11,17 @@ export declare const scrollbarWidth: () => number;
11
11
  /**
12
12
  * @hidden
13
13
  */
14
- export declare class ScrollbarWidthService {
14
+ export declare const rtlScrollLeft: () => number;
15
+ /**
16
+ * @hidden
17
+ */
18
+ export declare class ScrollbarService implements OnDestroy {
15
19
  changes: EventEmitter<any>;
16
- constructor();
17
- static ɵfac: i0.ɵɵFactoryDeclaration<ScrollbarWidthService, never>;
18
- static ɵprov: i0.ɵɵInjectableDeclaration<ScrollbarWidthService>;
20
+ private subscription;
21
+ constructor(ngZone: NgZone);
22
+ get scrollbarWidth(): number;
23
+ get rtlScrollLeft(): number;
24
+ ngOnDestroy(): void;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollbarService, never>;
26
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScrollbarService>;
19
27
  }