@progress/kendo-angular-pager 19.0.0-develop.9 → 19.0.0

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.
package/esm2022/util.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright © 2025 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 { isDocumentAvailable } from "@progress/kendo-angular-common";
5
6
  /**
6
7
  * @hidden
7
8
  */
@@ -64,3 +65,54 @@ export const getStylingClasses = (componentType, stylingOption, previousValue, n
64
65
  * @hidden
65
66
  */
66
67
  export const replaceMessagePlaceholder = (message, name, value) => message.replace(new RegExp(`\{\\s*${name}\\s*\}`, 'g'), value);
68
+ /**
69
+ * @hidden
70
+ */
71
+ export const calculatePadding = (element) => {
72
+ if (!element || !isDocumentAvailable()) {
73
+ return { padding: 0, gapNumbersSizes: 0, gapSizesInfo: 0 };
74
+ }
75
+ const computedStyle = window.getComputedStyle(element);
76
+ const paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
77
+ const paddingRight = parseInt(computedStyle.paddingRight, 10) || 0;
78
+ const padding = (paddingLeft + paddingRight) * 1.2; // account for rounding errors
79
+ const style = getComputedStyle(document.documentElement);
80
+ const gapNumbersSizes = 2 * (parseFloat(style.getPropertyValue('--kendo-spacing-3\\.5') || '0.875rem') * (parseFloat(getComputedStyle(document.documentElement).fontSize) || 16)); // convert rem to px
81
+ const gapSizesInfo = gapNumbersSizes;
82
+ return { padding, gapNumbersSizes, gapSizesInfo };
83
+ };
84
+ /**
85
+ * @hidden
86
+ */
87
+ export const createMeasurementSpan = (renderer, container, className) => {
88
+ const span = renderer.createElement('span');
89
+ renderer.appendChild(container, span);
90
+ renderer.addClass(span, className);
91
+ return span;
92
+ };
93
+ /**
94
+ * @hidden
95
+ */
96
+ export const copyComputedStyles = (renderer, source, destination) => {
97
+ const computedStyle = getComputedStyle(source);
98
+ const importantStyles = [
99
+ 'font-family', 'font-size', 'font-weight', 'font-style',
100
+ 'letter-spacing', 'text-transform', 'white-space', 'word-spacing',
101
+ 'padding-left', 'padding-right', 'margin-left', 'margin-right',
102
+ 'border-left-width', 'border-right-width', 'box-sizing'
103
+ ];
104
+ importantStyles.forEach(style => {
105
+ renderer.setStyle(destination, style, computedStyle.getPropertyValue(style));
106
+ });
107
+ };
108
+ /**
109
+ *
110
+ * @hidden
111
+ */
112
+ export const positionOffScreen = (renderer, element) => {
113
+ renderer.setStyle(element, 'position', 'absolute');
114
+ renderer.setStyle(element, 'visibility', 'hidden');
115
+ renderer.setStyle(element, 'left', '-9999px');
116
+ renderer.setStyle(element, 'top', '-9999px');
117
+ renderer.setStyle(element, 'display', 'flex');
118
+ };