Skip to content

Commit 706b624

Browse files
author
pipeline
committed
v22.2.5 is released
1 parent 0360ca4 commit 706b624

File tree

36,998 files changed

+712851
-4260353
lines changed

Some content is hidden

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

36,998 files changed

+712851
-4260353
lines changed

controls/base/CHANGELOG.md

+40
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
## [Unreleased]
44

5+
## 22.2.5 (2023-07-27)
6+
7+
### Common
8+
9+
#### Bug Fixes
10+
11+
- `#479520` - The issue with dragged elements and mouse positions getting misaligned has been resolved.
12+
13+
## 22.1.38 (2023-07-11)
14+
15+
### Common
16+
17+
#### New Features
18+
19+
- Added UTM parameters.
20+
21+
## 22.1.34 (2023-06-21)
22+
23+
### Common
24+
25+
#### New Features
26+
27+
- Provided the TypeScript 5 compatible support for the EJ2 components.
28+
29+
## 21.2.9 (2023-06-06)
30+
31+
### Common
32+
33+
#### Bug Fixes
34+
35+
- `#I461547` - The issue with the "popup showing on the entire page in the Chrome browser on iPad devices" has been resolved.
36+
37+
## 21.1.35 (2023-05-9)
38+
39+
### Common
40+
41+
#### Bug Fixes
42+
43+
- `#I451675` - The issue in the `template engine` when using `boolean` value has been resolved.
44+
545
## 21.2.3 (2023-05-03)
646

747
### Common

controls/base/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@syncfusion/ej2-base",
3-
"version": "21.2.3",
3+
"version": "22.1.38",
44
"description": "A common package of Essential JS 2 base libraries, methods and class definitions",
55
"author": "Syncfusion Inc.",
66
"license": "SEE LICENSE IN license",

controls/base/spec/drag-drop.spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,15 @@ describe('draggable', () => {
556556
expect(dragEvent).not.toHaveBeenCalled();
557557
instance.intDestroy(mousedown);
558558
});
559+
it('Set enableAutoScroll and perform drag operation within the draggable area', () => {
560+
instance.enableAutoScroll = true;
561+
mousemove = setMouseCordinates(mousemove, 25, 35);
562+
mousemove.srcElement = mousemove.targetElement = mousemove.toElement = document.body;
563+
EventHandler.trigger(<any>(document), 'mousemove', mousemove);
564+
expect(instance.element.style.top).toBe('32px');
565+
expect(instance.element.style.left).toBe('18px');
566+
instance.intDestroy(mousedown);
567+
});
559568
});
560569
describe('Drag without draggable area and negative values', () => {
561570
let instance: any;

controls/base/spec/fetch.spec.ts

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { Fetch } from '../src/fetch';
2+
const link = 'https://api.example.com/data';
3+
const contentType = 'application/json; charset=utf-8';
4+
const fetchData = { name: 'John', age: 30 };
5+
6+
describe('fetch', () => {
7+
describe('constructor', () => {
8+
beforeAll(() => {
9+
// Spy on window.fetch method to mock default response object
10+
spyOn(window, 'fetch').and.returnValue(Promise.resolve({
11+
ok: true,
12+
headers: { get: () => 'application/json' },
13+
json: () => Promise.resolve({ message: 'Mock response' })
14+
}));
15+
});
16+
17+
it('Different input parameters', function (done) {
18+
// Create a new instance of Fetch class as url as string type
19+
let fetchObj = new Fetch(link, 'GET');
20+
expect(fetchObj.url).toEqual(link);
21+
expect(fetchObj.type).toEqual('GET');
22+
23+
// Create a new instance of Fetch class as url as string type & assign type in instance
24+
fetchObj = new Fetch(link);
25+
fetchObj.type = 'GET';
26+
expect(fetchObj.url).toEqual(link);
27+
expect(fetchObj.type).toEqual('GET');
28+
29+
// Create a new instance of Fetch class as url as object type
30+
fetchObj = new Fetch({
31+
'url': link,
32+
'type': 'POST',
33+
'contentType': contentType,
34+
'data': fetchData
35+
});
36+
fetchObj.send();
37+
expect(fetchObj.url).toEqual(link);
38+
expect(fetchObj.type).toEqual('POST');
39+
expect(fetchObj.contentType).toEqual(contentType);
40+
expect(fetchObj.data).toEqual(fetchData);
41+
42+
// Create a new instance of Fetch class using request object
43+
let request = new Request(link, { method: 'GET' });
44+
fetchObj = new Fetch({'fetchRequest':request});
45+
expect(fetchObj.fetchRequest).toEqual(request);
46+
done();
47+
});
48+
49+
it('beforeSend event', function (done) {
50+
let doneFn = jasmine.createSpy('beforeSend').and.callFake((e: any) => {
51+
expect(doneFn).toHaveBeenCalled();
52+
e.cancel = true; done();
53+
});
54+
let fetchObj = new Fetch(link, 'GET');
55+
fetchObj.beforeSend = doneFn;
56+
fetchObj.send();
57+
});
58+
59+
it('onLoad event', function (done) {
60+
let doneFn = jasmine.createSpy('onLoad').and.callFake(() => {
61+
expect(doneFn).toHaveBeenCalled();
62+
done();
63+
});
64+
let fetchObj = new Fetch(link, 'GET');
65+
fetchObj.onLoad = doneFn;
66+
fetchObj.send();
67+
});
68+
69+
it('GET method with onSuccess event', function (done) {
70+
let doneFn = jasmine.createSpy('onSuccess').and.callFake((e: any) => {
71+
expect(doneFn).toHaveBeenCalled();
72+
expect(e.message).toEqual('Mock response');
73+
done();
74+
});
75+
let fetchObj = new Fetch(link, 'GET');
76+
fetchObj.onSuccess = doneFn;
77+
fetchObj.send();
78+
});
79+
80+
it('POST method with onSuccess event', function (done) {
81+
let doneFn = jasmine.createSpy('onSuccess').and.callFake((e: any) => {
82+
expect(doneFn).toHaveBeenCalled();
83+
expect(e.message).toEqual('Mock response');
84+
done();
85+
});
86+
let fetchObj = new Fetch(link, 'POST', contentType);
87+
fetchObj.onSuccess = doneFn;
88+
fetchObj.send(fetchData);
89+
});
90+
});
91+
92+
it('onFailure event', function (done) {
93+
spyOn(window, 'fetch').and.returnValue(Promise.resolve({
94+
ok: false,
95+
headers: { get: () => 'application/json' },
96+
json: () => Promise.resolve({ message: 'Mock response' })
97+
}));
98+
let doneFn = jasmine.createSpy('onFailure').and.callFake(() => {
99+
expect(doneFn).toHaveBeenCalled();
100+
done();
101+
});
102+
let fetchObj = new Fetch(link, 'GET');
103+
fetchObj.onFailure = doneFn;
104+
fetchObj.send();
105+
});
106+
});

controls/base/spec/internationalization.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ describe('Internationalization', () => {
193193
setCurrencyCode('USD');
194194
});
195195
});
196+
describe('Number Fromatting with local culture set', () => {
197+
let numIntl: Internationalization = new Internationalization('ja');
198+
it('numberfromatting using the formatNumber with option', () => {
199+
let result: string = numIntl.formatNumber(0.45,{format:'###.00'});
200+
expect(result).toBe('.45');
201+
});
202+
it('numberfromatting using the formatNumber with option', () => {
203+
let result: string = numIntl.formatNumber(-0.45,{format:'0'});
204+
expect(result).toBe('0');
205+
});
206+
});
196207
describe('Date Parser', () => {
197208
let dParseIntl: Internationalization = new Internationalization();
198209
let parseDate: Date = new Date();

controls/base/spec/intl/date-parser.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ describe('DateParser', () => {
867867
});
868868
it('year only format input returns correct year value',()=>{
869869
let tFormatter: Date = DateParser.dateParser('en', { format:'yy',calendar:'islamic' }, cldrData)('40');
870-
let iFormatter: Date = DateParser.dateParser('en', { format:'y',calendar:'islamic' }, cldrData)('1444');
870+
let iFormatter: Date = DateParser.dateParser('en', { format:'y',calendar:'islamic' }, cldrData)('1445');
871871
expect(iFormatter.getFullYear()).toBe(new Date().getFullYear());
872872
});
873873
it('full skeletom eleton returns proper value',()=>{

controls/base/spec/santize-helper.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('Sanitize Html Helper', () => {
5858
it('check the div element attribute while inline event bind', () => {
5959
expect(htmlObject.querySelector('#inline-event').hasAttribute('onmouseover')).toBe(false);
6060
});
61-
61+
6262
it('should remove onpropertychange attribute', () => {
6363
expect(htmlObject.querySelector('#onpropertychange').hasAttribute('onpropertychange')).toBe(false);
6464
});

controls/base/spec/template-engine.spec.ts

+15
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,21 @@ describe('Template Engine', () => {
199199
expect(outDOM(template.compile(templateStr, cHelper), dsJSONArray)).toEqual(result);
200200
});
201201

202+
203+
it('Check initializeCSPTemplate method', () => {
204+
let cHelper: any = {
205+
uCase: (str: string) => {
206+
return str.toUpperCase();
207+
}
208+
};
209+
function templateStr(data: any) {
210+
return `<div>${cHelper.uCase(data[0].name)}${data[0].info.id}</div>`
211+
}
212+
template.initializeCSPTemplate(templateStr, cHelper);
213+
let result: string = templateStr(dsJSONArray);
214+
expect(result).toEqual('<div>ONE01</div>');
215+
});
216+
202217
it('custom engine', () => {
203218
let spyCompiler = jasmine.createSpy("compile");
204219
class CustomEngine implements template.ITemplateEngine {

controls/base/spec/template.spec.ts

+55
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ let arrayOfObj = [
3131
}
3232
];
3333
let specialCharValue = [{'@ShipCountry': 'France'}];
34+
let dsJSONArrayBoolean: any=[{name: true,info:{ id:'01'} }, { name: false, info: { id:'02'} }];
3435
let dsJSONArray: any = [{ name: 'one', info: { id: '01' } }, { name: 'two', info: { id: '02' } }];
3536
let dsSubArray: any = [{ name: 'one', items: ['AR Item1', 'AR Item2'] }, { name: 'two', items: ['AR Item1', 'AR Item2'] }];
3637
let dsJSONSubArray: any = [{ name: 'one', info: { id: '01', items: ['AR Item1', 'AR Item2'] } }, { name: 'two', info: { id: '02', items: ['AR Item1', 'AR Item2'] } }];
@@ -255,6 +256,14 @@ describe('Template', () => {
255256
expect(outDOM(template.compile(templateStr), dsJSONArray)).toEqual(result);
256257
});
257258

259+
it('JSON Array Input With IF ELSE Condition Boolean', () => {
260+
let templateStr: string = '<div>${if(name===true)}${info.id}${else}${name}${/if}</div>';
261+
let result: Element[] = [];
262+
result.push(createElement('div', { innerHTML: '01' }));
263+
result.push(createElement('div', { innerHTML: 'false' }));
264+
expect(outDOM(template.compile(templateStr), dsJSONArrayBoolean)).toEqual(result);
265+
});
266+
258267
it('JSON Array Input With Multiple IF Condition', () => {
259268
let templateStr: string = '<div>${if(name=="one" && info.id != "01")}${info.id}${/if}</div>';
260269
let result: Element[] = [];
@@ -412,4 +421,50 @@ describe('Template', () => {
412421
expect(outDOM(template.compile(templateStr), arrayOfObj)).toEqual(result);
413422
});
414423

424+
it('JSON Array Input with function template', () => {
425+
let templateFunc: Function = (data: any) => `<span>${data['IDPRATICA']}</span>`;
426+
let result: HTMLElement = document.createElement('span');
427+
result.textContent = '700';
428+
expect(outDOM(template.compile(templateFunc), arrayOfObj)[0]).toEqual(result);
429+
});
430+
431+
it('JSON Array Input with function template with if condition', () => {;
432+
let templateFunc: Function = (data: any) => `${data['IDPRATICA'] === 700 ? `<span>${data['IDPRATICA']}</span>` : ''}`;
433+
let result: HTMLElement = document.createElement('span');
434+
result.textContent = '700';
435+
expect(outDOM(template.compile(templateFunc), arrayOfObj)[0]).toEqual(result);
436+
});
437+
438+
it('JSON Array Input with complex function template', () => {
439+
let data: any = {
440+
people: [
441+
{ firstName: "Todd", age: 16 },
442+
{ firstName: "Mike", age: 23, driver: true },
443+
{ firstName: "Amanda", age: 21 },
444+
{ firstName: "Stacy", age: 19 }
445+
]
446+
};
447+
let output: string = "<ul><li style='color: red;'>Name: Todd Age: 16</li><li style='color: green;'>Name: Mike Age: 23 is a driver.</li><li style='color: blue;'>Name: Amanda Age: 21</li><li style='color: red;'>Name: Stacy Age: 19</li></ul>";
448+
var templateFunc: (data: any) => string = ({ people }) => {
449+
var result = "<ul>";
450+
for (let i = 0; i < people.length; i++) {
451+
let person = people[i];
452+
453+
if (person.age > 20) {
454+
if (person.driver) {
455+
result += `<li style='color: green;'>Name: ${person.firstName} Age: ${person.age} is a driver.</li>`;
456+
} else {
457+
result += `<li style='color: blue;'>Name: ${person.firstName} Age: ${person.age}</li>`;
458+
}
459+
} else {
460+
result += `<li style='color: red;'>Name: ${person.firstName} Age: ${person.age}</li>`;
461+
}
462+
}
463+
result += "</ul>";
464+
return result;
465+
};
466+
let outputDOM: Function = template.compile(templateFunc);
467+
expect(outputDOM(data)).toEqual(output);
468+
});
469+
415470
});

controls/base/src/browser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export class Browser {
159159

160160
private static getValue(key: string, regX: RegExp): Object {
161161
const browserDetails: {} = typeof window !== 'undefined' ? window.browserDetails : {};
162-
if (typeof navigator !== 'undefined' && navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 && Browser.isTouch === true) {
162+
if (typeof navigator !== 'undefined' && navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 && Browser.isTouch === true && !REGX_BROWSER.CHROME.test(navigator.userAgent)) {
163163
browserDetails['isIos'] = true;
164164
browserDetails['isDevice'] = true;
165165
browserDetails['isTouch'] = true;

controls/base/src/draggable.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
412412
}
413413
const handler: Function = (this.enableTapHold && Browser.isDevice && Browser.isTouch) ? this.mobileInitialize : this.initialize;
414414
if (isUnWire) {
415-
EventHandler.remove(ele || this.element, Browser.isSafari() ? 'touchstart' : Browser.touchStartEvent, handler);
415+
EventHandler.remove(ele || this.element, Browser.isSafari() ? 'touchstart' : Browser.touchStartEvent, handler);
416416
} else {
417-
EventHandler.add(ele || this.element, Browser.isSafari() ? 'touchstart' : Browser.touchStartEvent, handler, this);
417+
EventHandler.add(ele || this.element, Browser.isSafari() ? 'touchstart' : Browser.touchStartEvent, handler, this);
418418
}
419419
}
420420
/* istanbul ignore next */
@@ -524,7 +524,7 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
524524
document.body.classList.add('e-prevent-select');
525525
}
526526
this.externalInitialize = false;
527-
EventHandler.trigger(document.documentElement, Browser.isSafari() ? 'touchstart' : Browser.touchStartEvent, evt);
527+
EventHandler.trigger(document.documentElement, Browser.isSafari() ? 'touchstart' : Browser.touchStartEvent, evt);
528528
}
529529
private intDragStart(evt: MouseEvent & TouchEvent): void {
530530
this.removeTapholdTimer();
@@ -725,6 +725,9 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
725725
const dTop: number = this.position.top - this.diffY;
726726
const styles: CSSStyleDeclaration = getComputedStyle(helperElement);
727727
if (this.dragArea) {
728+
if (this.enableAutoScroll) {
729+
this.setDragArea();
730+
}
728731
if (this.pageX !== pagex || this.skipDistanceCheck) {
729732
const helperWidth: number = helperElement.offsetWidth + (parseFloat(styles.marginLeft)
730733
+ parseFloat(styles.marginRight));
@@ -797,7 +800,9 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
797800
draEleTop -= marginTop;
798801
}
799802
}
800-
draEleTop = (this.dragLimit.bottom < draEleTop) ? this.dragLimit.bottom : draEleTop;
803+
if (this.dragArea) {
804+
draEleTop = (this.dragLimit.bottom < draEleTop) ? this.dragLimit.bottom : draEleTop;
805+
}
801806
}
802807
if ((top - iTop) < 0) {
803808
if (dTop + marginTop + (helperElement.offsetHeight - iTop) >= 0) {

0 commit comments

Comments
 (0)