Skip to content

Commit 2b09729

Browse files
author
pipeline
committed
v19.1.56 is released
1 parent 78827ed commit 2b09729

File tree

872 files changed

+9607
-4978
lines changed

Some content is hidden

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

872 files changed

+9607
-4978
lines changed

controls/barcodegenerator/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## [Unreleased]
44

5+
## 19.1.56 (2021-04-13)
6+
7+
### Barcode
8+
9+
#### Bug Fixes
10+
11+
- `#316606` - "Text alignment was not proper with UPCA type barcode" issue has been fixed.
12+
513
## 18.4.30 (2020-12-17)
614

715
### Barcode

controls/barcodegenerator/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@syncfusion/ej2-barcode-generator",
3-
"version": "18.4.2",
3+
"version": "19.1.54",
44
"description": "Barcode generator component is a pure JavaScript library which will convert a string to Barcode and show it to the user. This supports major 1D and 2D barcodes including coda bar, code 128, QR Code.",
55
"author": "Syncfusion Inc.",
66
"license": "SEE LICENSE IN license",

controls/barcodegenerator/spec/barcode/core/UPC.spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ describe('Barcode Control ', () => {
320320
let children: HTMLElement = barcode.children[0] as HTMLElement
321321
expect(Math.round(Number(children.children[1].getAttribute('y'))) === 22
322322
&& Math.round(Number(children.children[0].getAttribute('y'))) === 22
323-
&& Math.round(Number(children.children[0].getAttribute('x'))) === 43
323+
&& Math.round(Number(children.children[0].getAttribute('x'))) === 16
324324
&& (children.children[0] as HTMLElement).style.fontSize === '14.6px').toBe(true);
325-
for (var j = 0; j < children.children.length - 2; j++) {
326-
expect(Math.round(Number(children.children[j + 2].getAttribute('x'))) === output1[j].x && Math.round(Number(children.children[j + 2].getAttribute('y'))) === output1[j].y
327-
&& parseFloat((children.children[j + 2].getAttribute('width'))).toFixed(2) === output1[j].width
328-
&& parseFloat((children.children[j + 2].getAttribute('height'))).toFixed(2) === output1[j].height).toBe(true);
325+
for (var j = 0; j < children.children.length - 4; j++) {
326+
expect(Math.round(Number(children.children[j + 4].getAttribute('x'))) === output1[j].x && Math.round(Number(children.children[j + 4].getAttribute('y'))) === output1[j].y
327+
&& parseFloat((children.children[j + 4].getAttribute('width'))).toFixed(2) === output1[j].width
328+
&& parseFloat((children.children[j + 4].getAttribute('height'))).toFixed(2) === output1[j].height).toBe(true);
329329
}
330330
done();
331331
});

controls/barcodegenerator/spec/barcode/core/code93.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,13 @@ describe('Barcode Control ', () => {
312312
it('upcTestCase bar testing for all lines check upcTestCase barcode', (done: Function) => {
313313
let barcode = document.getElementById('codabar1')
314314
let children: HTMLElement = barcode.children[0] as HTMLElement
315-
expect(Math.round(Number(children.children[0].getAttribute('x'))) === 34
315+
expect(Math.round(Number(children.children[0].getAttribute('x'))) === 11
316316
&& Math.round(Number(children.children[0].getAttribute('y'))) === 132 && (children.children[0] as HTMLElement).style.fontSize === '15.4px').toBe(true);
317-
for (var j = 0; j < children.children.length - 2; j++) {
318-
expect(Math.round(Number(children.children[j + 2].getAttribute('x'))) === output1[j].x
319-
&& Math.round(Number(children.children[j + 2].getAttribute('y'))) === output1[j].y
320-
&& parseFloat((children.children[j + 2].getAttribute('width'))).toFixed(2) === output1[j].width
321-
&& parseFloat((children.children[j + 2].getAttribute('height'))).toFixed(2) === output1[j].height).toBe(true);
317+
for (var j = 0; j < children.children.length - 4; j++) {
318+
expect(Math.round(Number(children.children[j + 4].getAttribute('x'))) === output1[j].x
319+
&& Math.round(Number(children.children[j + 4].getAttribute('y'))) === output1[j].y
320+
&& parseFloat((children.children[j + 4].getAttribute('width'))).toFixed(2) === output1[j].width
321+
&& parseFloat((children.children[j + 4].getAttribute('height'))).toFixed(2) === output1[j].height).toBe(true);
322322

323323
}
324324
done();

controls/barcodegenerator/src/barcode/one-dimension.ts

+18
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,24 @@ export abstract class OneDimension extends BarcodeBase {
298298
} else {
299299
this.getAlignmentPosition(textOptions, endValue, startValue, textSize);
300300
}
301+
if (type === 'UpcA') {
302+
let checkVAl: boolean = (textOptions.string === this.value.substr(0, 6)) ? true : false;
303+
textOptions.string = checkVAl ? this.value.substr(0, 1) : textOptions.string.substr(0, 5);
304+
let xPosition: number = checkVAl ? options[0].x / 2 : options[options.length - 1].x + textOptions.stringSize;
305+
if (checkVAl) {
306+
let tempPosition: number = textOptions.x;
307+
textOptions.x = xPosition;
308+
this.drawText(canvas as HTMLCanvasElement, textOptions);
309+
textOptions.x = tempPosition;
310+
textOptions.string = this.value.substr(1, 5);
311+
this.updateOverlappedTextPosition((endValue - startValue), textOptions, textSize, startValue, textProperty, endValue);
312+
} else {
313+
this.updateOverlappedTextPosition((endValue - startValue), textOptions, textSize, startValue, textProperty, endValue);
314+
this.drawText(canvas as HTMLCanvasElement, textOptions);
315+
textOptions.string = this.value.substr(11, 12);
316+
textOptions.x = xPosition;
317+
}
318+
}
301319
this.alignDisplayText(textOptions, textProperty, startValue, endValue, textSize);
302320
this.drawText(canvas as HTMLCanvasElement, textOptions);
303321
}

controls/base/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## [Unreleased]
44

5-
## 19.1.55 (2021-04-06)
5+
## 19.1.56 (2021-04-13)
66

77
### Common
88

controls/calendars/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@syncfusion/ej2-calendars",
3-
"version": "19.1.54",
3+
"version": "19.1.55",
44
"description": "A complete package of date or time components with built-in features such as date formatting, inline editing, multiple (range) selection, range restriction, month and year selection, strict mode, and globalization.",
55
"author": "Syncfusion Inc.",
66
"license": "SEE LICENSE IN license",

controls/calendars/spec/daterangepicker/daterangepicker.spec.ts

+89
Original file line numberDiff line numberDiff line change
@@ -9295,6 +9295,95 @@ describe('DateRangePicker', () => {
92959295
expect(daterangePicker.inputElement.value === "1/1/2020 - 2/2/2020").toBe(true)
92969296
});
92979297
});
9298+
describe('EJ2-47722 - If openOnFocus property is enabled then DateRangePicker popup does not closed properly',function(){
9299+
let dateRangePicker:any;
9300+
beforeEach(function(){
9301+
let element: HTMLElement = createElement('input',{id:'date'});
9302+
document.body.appendChild(element);
9303+
dateRangePicker = new DateRangePicker({
9304+
openOnFocus : true,
9305+
presets: [{
9306+
label: 'Today', start: new Date(), end: new Date() },
9307+
{ label: 'Last week', start: new Date(new Date().setDate(new Date().getDate() - 7)), end: new Date()
9308+
}],
9309+
});
9310+
dateRangePicker.appendTo('#date');
9311+
});
9312+
afterEach(function(){
9313+
if(dateRangePicker){
9314+
dateRangePicker.destroy();
9315+
}
9316+
document.body.innerHTML = '';
9317+
});
9318+
it('check the popup open by focus the control',function(){
9319+
dateRangePicker.inputFocusHandler();
9320+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).not.toBe(null);
9321+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9322+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child')).click();
9323+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9324+
dateRangePicker.preventFocus = false;
9325+
dateRangePicker.inputFocusHandler();
9326+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).toBe(null);
9327+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9328+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child').classList.contains('e-active')).toBe(true);
9329+
dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child').nextElementSibling.click();
9330+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9331+
dateRangePicker.preventFocus = false;
9332+
dateRangePicker.inputFocusHandler();
9333+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).toBe(null);
9334+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9335+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child').nextElementSibling.classList.contains('e-active')).toBe(true);
9336+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child')).click();
9337+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9338+
dateRangePicker.preventFocus = false;
9339+
dateRangePicker.inputFocusHandler();
9340+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:last-child')).click();
9341+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).not.toBe(null);
9342+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9343+
document.getElementsByClassName('e-day')[15].dispatchEvent(clickEvent);
9344+
document.getElementsByClassName('e-day')[16].dispatchEvent(clickEvent);
9345+
dateRangePicker.applyButton.element.click();
9346+
dateRangePicker.preventFocus = false;
9347+
dateRangePicker.inputFocusHandler();
9348+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).not.toBe(null);
9349+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9350+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child')).click();
9351+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9352+
});
9353+
it('check the popup open by focus the control as well as by click the date range icon',function(){
9354+
(<HTMLElement>document.getElementsByClassName(' e-input-group-icon e-range-icon e-icons')[0]).dispatchEvent(clickEvent);
9355+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).not.toBe(null);
9356+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9357+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child')).click();
9358+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9359+
dateRangePicker.preventFocus = false;
9360+
dateRangePicker.inputFocusHandler();
9361+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).toBe(null);
9362+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9363+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child').classList.contains('e-active')).toBe(true);
9364+
dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child').nextElementSibling.click();
9365+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9366+
(<HTMLElement>document.getElementsByClassName(' e-input-group-icon e-range-icon e-icons')[0]).dispatchEvent(clickEvent);
9367+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).toBe(null);
9368+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9369+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child').nextElementSibling.classList.contains('e-active')).toBe(true);
9370+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child')).click();
9371+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9372+
dateRangePicker.preventFocus = false;
9373+
dateRangePicker.inputFocusHandler();
9374+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:last-child')).click();
9375+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).not.toBe(null);
9376+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9377+
document.getElementsByClassName('e-day')[15].dispatchEvent(clickEvent);
9378+
document.getElementsByClassName('e-day')[16].dispatchEvent(clickEvent);
9379+
dateRangePicker.applyButton.element.click();
9380+
(<HTMLElement>document.getElementsByClassName(' e-input-group-icon e-range-icon e-icons')[0]).dispatchEvent(clickEvent);
9381+
expect(dateRangePicker.popupObj.element.querySelector('.e-date-range-container')).not.toBe(null);
9382+
expect(dateRangePicker.popupObj.element.querySelector('.e-presets')).not.toBe(null);
9383+
<HTMLElement>(dateRangePicker.popupObj.element.querySelector('.e-presets li:first-child')).click();
9384+
expect(document.body.contains(dateRangePicker.popupObj)).toBe(false);
9385+
});
9386+
});
92989387
});
92999388
interface CalendarElement {
93009389
leftCalTitle: HTMLElement;

controls/calendars/src/calendar/calendar.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ export class CalendarBase extends Component<HTMLElement> implements INotifyPrope
792792
if (isBlazor() && this.blazorRef) {
793793
(this.tableBodyElement as HTMLElement).focus();
794794
const targetEle: HTMLElement = e.target as HTMLElement;
795-
/* eslint-disable @typescript-eslint/naming-convention */
796795
const args: object = {
797796
Action: e.action, Key: e.key, Events: e,
798797
SelectDate: selectedDate ? selectedDate.id : null,
@@ -801,7 +800,6 @@ export class CalendarBase extends Component<HTMLElement> implements INotifyPrope
801800
Id: focusedDate ? focusedDate.id : selectedDate ? selectedDate.id : null,
802801
TargetClassList: targetEle.classList.toString()
803802
};
804-
/* eslint-enable @typescript-eslint/naming-convention */
805803
// eslint-disable-next-line @typescript-eslint/no-explicit-any
806804
(this.blazorRef as any).invokeMethodAsync('OnCalendarKeyboardEvent', args);
807805
if (targetEle.classList.contains('e-today')) {
@@ -2371,9 +2369,6 @@ export class Calendar extends CalendarBase {
23712369
let timeZoneDiff: number = serverTimezoneDiff + clientTimeZoneDiff;
23722370
timeZoneDiff = this.isDayLightSaving() ? timeZoneDiff-- : timeZoneDiff;
23732371
this.value = new Date(this.value.getTime() + (timeZoneDiff * 60 * 60 * 1000));
2374-
} else if (!isNullOrUndefined(this.timezone)) {
2375-
const date: Date = this.value || new Date();
2376-
this.setProperties({ value: super.getDate(date, this.timezone) }, true);
23772372
}
23782373
}
23792374
protected formResetHandler(): void {
@@ -2418,7 +2413,10 @@ export class Calendar extends CalendarBase {
24182413

24192414
protected generateTodayVal(value: Date) : Date {
24202415
let tempValue: Date = new Date();
2421-
if (value) {
2416+
if (!isNullOrUndefined(this.timezone)) {
2417+
tempValue = super.getDate(tempValue, this.timezone);
2418+
}
2419+
if (value && isNullOrUndefined(this.timezone)) {
24222420
tempValue.setHours(value.getHours());
24232421
tempValue.setMinutes(value.getMinutes());
24242422
tempValue.setSeconds(value.getSeconds());
@@ -2432,7 +2430,7 @@ export class Calendar extends CalendarBase {
24322430
protected todayButtonClick(e?: MouseEvent | KeyboardEvent): void {
24332431
if (this.showTodayButton) {
24342432
const tempValue: Date = this.generateTodayVal(this.value);
2435-
this.setProperties({ value: super.getDate(tempValue, this.timezone) }, true);
2433+
this.setProperties({ value: tempValue }, true);
24362434
this.isTodayClicked = true;
24372435
this.todayButtonEvent = e;
24382436
if (this.isMultiSelection) {

controls/calendars/src/datepicker/datepicker.ts

-6
Original file line numberDiff line numberDiff line change
@@ -1250,13 +1250,11 @@ export class DatePicker extends Calendar implements IInput {
12501250
this.popupObj = new Popup(this.popupWrapper as HTMLElement, {
12511251
content: this.isBlazorServer ? null : this.calendarElement,
12521252
relateTo: Browser.isDevice ? document.body : this.inputWrapper.container,
1253-
// eslint-disable-next-line @typescript-eslint/naming-convention
12541253
position: Browser.isDevice ? { X: 'center', Y: 'center' } : { X: 'left', Y: 'bottom' },
12551254
offsetY: OFFSETVALUE,
12561255
targetType: 'container',
12571256
enableRtl: this.enableRtl,
12581257
zIndex: this.zIndex,
1259-
// eslint-disable-next-line @typescript-eslint/naming-convention
12601258
collision: Browser.isDevice ? { X: 'fit', Y: 'fit' } : { X: 'flip', Y: 'flip' },
12611259
open: () => {
12621260
if (this.getModuleName() !== 'datetimepicker') {
@@ -1867,7 +1865,6 @@ export class DatePicker extends Calendar implements IInput {
18671865
if (!isNullOrUndefined(this.inputElement.getAttribute(prop))) {
18681866
switch (prop) {
18691867
case 'disabled':
1870-
// eslint-disable-next-line @typescript-eslint/dot-notation
18711868
if (((isNullOrUndefined(this.datepickerOptions) || (this.datepickerOptions['enabled'] === undefined)) || dynamic) &&
18721869
!this.isBlazorServer) {
18731870
const enabled: boolean = this.inputElement.getAttribute(prop) === 'disabled' ||
@@ -1877,7 +1874,6 @@ export class DatePicker extends Calendar implements IInput {
18771874
}
18781875
break;
18791876
case 'readonly':
1880-
// eslint-disable-next-line @typescript-eslint/dot-notation
18811877
if (((isNullOrUndefined(this.datepickerOptions) || (this.datepickerOptions['readonly'] === undefined)) || dynamic) &&
18821878
!this.isBlazorServer) {
18831879
const readonly: boolean = this.inputElement.getAttribute(prop) === 'readonly' ||
@@ -1886,7 +1882,6 @@ export class DatePicker extends Calendar implements IInput {
18861882
}
18871883
break;
18881884
case 'placeholder':
1889-
// eslint-disable-next-line @typescript-eslint/dot-notation
18901885
if (((isNullOrUndefined(this.datepickerOptions) || (this.datepickerOptions['placeholder'] === undefined)) || dynamic) &&
18911886
!this.isBlazorServer) {
18921887
this.setProperties({ placeholder: this.inputElement.getAttribute(prop) }, !dynamic);
@@ -1903,7 +1898,6 @@ export class DatePicker extends Calendar implements IInput {
19031898
}
19041899
break;
19051900
case 'value':
1906-
// eslint-disable-next-line @typescript-eslint/dot-notation
19071901
if (((isNullOrUndefined(this.datepickerOptions) || (this.datepickerOptions['value'] === undefined)) || dynamic) &&
19081902
!this.isBlazorServer) {
19091903
const value: string = this.inputElement.getAttribute(prop);

0 commit comments

Comments
 (0)