Skip to content

Commit fc4c151

Browse files
Merge pull request #3 from Mohamed7Imran/master
2025 Vol 2 release (v30.1.37) changes are added
2 parents 0932963 + 7dd04bf commit fc4c151

File tree

702 files changed

+12305
-1024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

702 files changed

+12305
-1024
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ See [LICENSE FILE](https://github.com/syncfusion/react-ui-components/blob/master
1010

1111

1212
## Resources
13-
* [Getting Started](https://react.syncfusion.com/getting-started/introduction)
13+
* [Getting Started](https://react.syncfusion.com/overview/introduction)
1414
* [View Online Demos](https://react.syncfusion.com/button)
1515

1616
## Pure React Components highlights
@@ -241,6 +241,36 @@ Built-in Material 3 stylesheets provide a modern, accessible design out of the b
241241
</tr>
242242
</table>
243243

244+
### Navigations
245+
246+
<table>
247+
<tr>
248+
<td>
249+
<b>Context Menu</b>
250+
</td>
251+
<td rowspan="2">
252+
<a href="https://www.npmjs.com/package/@syncfusion/react-navigations"><img src="https://ej2.syncfusion.com/github/images/npm-logo.png" alt="npm package @syncfusion/react-navigations" title="@syncfusion/react-navigations" style="height:20px;" />
253+
</td>
254+
<td>
255+
<a href="components/navigations/src/contextMenu">Source</a>
256+
</td>
257+
<td>
258+
<a href="https://react.syncfusion.com/context-menu">Live demo</a>
259+
</td>
260+
</tr>
261+
<tr>
262+
<td>
263+
<b>Toolbar</b>
264+
</td>
265+
<td>
266+
<a href="components/navigations/src/toolbar">Source</a>
267+
</td>
268+
<td>
269+
<a href="https://react.syncfusion.com/toolbar">Live demo</a>
270+
</td>
271+
</tr>
272+
</table>
273+
244274
## Support
245275
Product support is available for through following mediums.
246276
* Creating incident in Syncfusion [Direct-trac](https://www.syncfusion.com/support/directtrac/incidents?utm_source=npm&utm_campaign=react-ui-components) support system or [Community forum](https://www.syncfusion.com/forums/pure-react?utm_source=npm&utm_campaign=react-ui-components).
@@ -250,6 +280,6 @@ Built-in Material 3 stylesheets provide a modern, accessible design out of the b
250280
Check the license detail [here](https://github.com/syncfusion/react-ui-components/blob/master/license).
251281

252282
## Changelog
253-
Check the changelog [here](https://react-api.syncfusion.com/release-notes/29.2.4).
283+
Check the changelog [here](https://react-api.syncfusion.com/release-notes/30.1.37).
254284

255285
&copy; Copyright 2025 Syncfusion, Inc. All Rights Reserved. The Syncfusion Essential Studio license and copyright applies to this distribution.

components/base/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ Check the changelog [here](https://github.com/syncfusion/react-ui-components/blo
4343
4444
See [LICENSE FILE](https://github.com/syncfusion/react-ui-components/blob/master/license?utm_source=npm&utm_campaign=notification) for more info.
4545

46-
&copy; Copyright 2025 Syncfusion, Inc. All Rights Reserved. The Syncfusion Essential Studio license and copyright applies to this distribution.
46+
&copy; Copyright 2025 Syncfusion, Inc. All Rights Reserved. The Syncfusion Essential Studio license and copyright applies to this distribution.

components/base/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@syncfusion/react-base",
3-
"version": "29.2.4",
4-
"description": "A common package of core Pure React base, methods and class definitions",
3+
"version": "30.1.37",
4+
"description": "A common package of core React base, methods and class definitions",
55
"author": "Syncfusion Inc.",
66
"license": "SEE LICENSE IN license",
77
"keywords": [
@@ -21,6 +21,9 @@
2121
"homepage": "https://www.syncfusion.com/react-ui-components",
2222
"module": "./index.js",
2323
"readme": "README.md",
24+
"bin": {
25+
"syncfusion-license": "bin/syncfusion-license.js"
26+
},
2427
"devDependencies": {
2528
"gulp": "4.0.2",
2629
"gulp-typescript": "5.0.1",

components/base/src/drag-util.tsx

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
import { select } from './dom';
2+
import { IPosition } from './draggable';
3+
import { isNullOrUndefined } from './util';
4+
5+
/**
6+
* Position coordinates
7+
*/
8+
export interface PositionCoordinates {
9+
left?: number;
10+
top?: number;
11+
bottom?: number;
12+
right?: number;
13+
}
14+
15+
/**
16+
* Coordinates for element position
17+
*
18+
* @private
19+
*/
20+
export interface Coordinates {
21+
/**
22+
* Defines the x Coordinate of page.
23+
*/
24+
pageX?: number;
25+
/**
26+
* Defines the y Coordinate of page.
27+
*/
28+
pageY?: number;
29+
/**
30+
* Defines the x Coordinate of client.
31+
*/
32+
clientX?: number;
33+
/**
34+
* Defines the y Coordinate of client.
35+
*/
36+
clientY?: number;
37+
}
38+
39+
let left: number;
40+
let top: number;
41+
let width: number;
42+
let height: number;
43+
44+
/**
45+
* Sets the permitted drag area boundaries based on the defined dragArea.
46+
*
47+
* @private
48+
* @param {HTMLElement | string} dragArea - The element or selector string defining the drag area
49+
* @param {Element} helperElement - The helper element used in dragging
50+
* @param {PositionCoordinates} borderWidth - The border width of the drag area
51+
* @param {PositionCoordinates} padding - The padding of the drag area
52+
* @param {PositionCoordinates} dragLimit - The object to store the calculated drag limits
53+
* @returns {void}
54+
*/
55+
export function setDragArea(
56+
dragArea: HTMLElement | string, helperElement: Element,
57+
borderWidth: PositionCoordinates, padding: PositionCoordinates,
58+
dragLimit: PositionCoordinates
59+
): void {
60+
let eleWidthBound: number;
61+
let eleHeightBound: number;
62+
let top: number = 0;
63+
let left: number = 0;
64+
let ele: HTMLElement;
65+
const type: string = typeof dragArea;
66+
if (type === 'string') {
67+
ele = select(dragArea as string) as HTMLElement;
68+
} else {
69+
ele = dragArea as HTMLElement;
70+
}
71+
if (ele) {
72+
const elementArea: ClientRect | DOMRect = ele.getBoundingClientRect();
73+
eleWidthBound = ele.scrollWidth ? ele.scrollWidth : elementArea.right - elementArea.left;
74+
eleHeightBound = ele.scrollHeight ? (dragArea && !isNullOrUndefined(helperElement) && helperElement.classList.contains('sf-treeview')) ? ele.clientHeight : ele.scrollHeight : elementArea.bottom - elementArea.top;
75+
const keys: string[] = ['Top', 'Left', 'Bottom', 'Right'];
76+
const styles: CSSStyleDeclaration = getComputedStyle(ele);
77+
for (let i: number = 0; i < keys.length; i++) {
78+
const key: string = keys[parseInt(i.toString(), 10)];
79+
const tborder: string = styles['border' + key + 'Width'];
80+
const tpadding: string = styles['padding' + key];
81+
const lowerKey: string = key.toLowerCase();
82+
(borderWidth as Record<string, number>)[`${lowerKey}`] = isNaN(parseFloat(tborder)) ? 0 : parseFloat(tborder);
83+
(padding as Record<string, number>)[`${lowerKey}`] = isNaN(parseFloat(tpadding)) ? 0 : parseFloat(tpadding);
84+
}
85+
if (dragArea && !isNullOrUndefined(helperElement) && helperElement.classList.contains('sf-treeview')) {
86+
top = elementArea.top + document.scrollingElement.scrollTop;
87+
} else {
88+
top = elementArea.top;
89+
}
90+
left = elementArea.left;
91+
dragLimit.left = left + borderWidth.left + padding.left;
92+
dragLimit.top = ele.offsetTop + borderWidth.top + padding.top;
93+
dragLimit.right = left + eleWidthBound - (borderWidth.right + padding.right);
94+
dragLimit.bottom = top + eleHeightBound - (borderWidth.bottom + padding.bottom);
95+
}
96+
}
97+
98+
/**
99+
* Retrieves the document's full height or width, considering the scroll and offset values.
100+
*
101+
* @private
102+
* @param {string} str - The dimension type ('Height' or 'Width') to calculate.
103+
* @returns {number} - The maximum value across scroll, offset, and client dimensions.
104+
*/
105+
export function getDocumentWidthHeight(str: 'Height' | 'Width'): number {
106+
const docBody: HTMLElement = document.body;
107+
const docEle: HTMLElement = document.documentElement;
108+
return Math.max(
109+
docBody['scroll' + str], docEle['scroll' + str],
110+
docBody['offset' + str], docEle['offset' + str],
111+
docEle['client' + str]
112+
);
113+
}
114+
115+
/**
116+
* Determines if a given element is within the bounds of the viewport.
117+
*
118+
* @private
119+
* @param {HTMLElement} el - The element to check.
120+
* @returns {boolean} - True if the element is in the viewport, false otherwise.
121+
*/
122+
export function elementInViewport(el: HTMLElement): boolean {
123+
top = el.offsetTop;
124+
left = el.offsetLeft;
125+
width = el.offsetWidth;
126+
height = el.offsetHeight;
127+
while (el.offsetParent) {
128+
el = el.offsetParent as HTMLElement;
129+
top += el.offsetTop;
130+
left += el.offsetLeft;
131+
}
132+
return (
133+
top >= window.pageYOffset &&
134+
left >= window.pageXOffset &&
135+
(top + height) <= (window.pageYOffset + window.innerHeight) &&
136+
(left + width) <= (window.pageXOffset + window.innerWidth)
137+
);
138+
}
139+
140+
/**
141+
* Gets the coordinates of a mouse or touch event.
142+
*
143+
* @private
144+
* @param {MouseEvent | TouchEvent} evt - The event object.
145+
* @returns {Coordinates} - The x and y coordinates of the page and client.
146+
*/
147+
export function getCoordinates(evt: MouseEvent & TouchEvent): Coordinates {
148+
if (evt.type.indexOf('touch') > -1) {
149+
return evt.changedTouches[0];
150+
}
151+
return evt as Coordinates;
152+
}
153+
154+
/**
155+
* Calculates the parent position of the element relative to the document.
156+
*
157+
* @private
158+
* @param {Element} ele - The element for which the parent position is calculated.
159+
* @returns {IPosition} - The calculated left and top position.
160+
*/
161+
export function calculateParentPosition(ele: Element): IPosition {
162+
if (isNullOrUndefined(ele)) {
163+
return { left: 0, top: 0 };
164+
}
165+
const rect: ClientRect | DOMRect = ele.getBoundingClientRect();
166+
const style: CSSStyleDeclaration = getComputedStyle(ele);
167+
return {
168+
left: (rect.left + window.pageXOffset) - parseInt(style.marginLeft, 10),
169+
top: (rect.top + window.pageYOffset) - parseInt(style.marginTop, 10)
170+
};
171+
}
172+
173+
/**
174+
* Retrieves all elements from a point defined by event coordinates.
175+
*
176+
* @private
177+
* @param {MouseEvent | TouchEvent} evt - The event object containing coordinates.
178+
* @returns {Element[]} - An array of elements located at the event's point.
179+
*/
180+
export function getPathElements(evt: MouseEvent & TouchEvent): Element[] {
181+
const elementTop: number = evt.clientX > 0 ? evt.clientX : 0;
182+
const elementLeft: number = evt.clientY > 0 ? evt.clientY : 0;
183+
return document.elementsFromPoint(elementTop, elementLeft);
184+
}
185+
186+
/**
187+
* Identifies the scrollable parent of the current node element.
188+
*
189+
* @private
190+
* @param {Element[]} nodes - The path of elements to check.
191+
* @param {boolean} reverse - Whether to reverse the array to check from bottom to top.
192+
* @returns {Element | null} - The first scrollable parent element or null.
193+
*/
194+
export function getScrollParent(nodes: Element[], reverse: boolean): Element | null {
195+
const nodeList: Element[] = reverse ? [...nodes].reverse() : nodes;
196+
for (const node of nodeList) {
197+
const computedStyle: CSSStyleDeclaration = window.getComputedStyle(node);
198+
const overflowY: string = computedStyle.overflowY;
199+
if ((overflowY === 'auto' || overflowY === 'scroll') &&
200+
node.scrollHeight > node.clientHeight) {
201+
return node;
202+
}
203+
}
204+
const scrollingElement: HTMLElement = document.scrollingElement as HTMLElement;
205+
const docOverflowY: string = window.getComputedStyle(scrollingElement).overflowY;
206+
if (docOverflowY === 'visible') {
207+
scrollingElement.style.overflow = 'auto';
208+
return scrollingElement;
209+
}
210+
return null;
211+
}

0 commit comments

Comments
 (0)