Skip to content

Commit 27059a5

Browse files
author
pipeline
committed
v17.2.35 is released
1 parent ffeea1f commit 27059a5

File tree

331 files changed

+6502
-2071
lines changed

Some content is hidden

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

331 files changed

+6502
-2071
lines changed

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": "17.2.28",
3+
"version": "17.2.34",
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/base/dist/ej2-base.umd.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controls/base/dist/ej2-base.umd.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controls/base/dist/es6/ej2-base.es2015.js

+31-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controls/base/dist/es6/ej2-base.es2015.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controls/base/dist/es6/ej2-base.es5.js

+32-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controls/base/dist/es6/ej2-base.es5.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controls/base/dist/global/ej2-base.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controls/base/dist/global/ej2-base.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+60-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ window.getName = function () {
2020
return "TestName";
2121
}
2222

23-
let outDOM: Function = (tempFunction: Function, data: Object[], templateID?: string, propName?: string) => {
23+
let outDOM: Function = (tempFunction: Function, data: Object[], templateID?: string, propName?: string, index?: number) => {
2424
let output: any[] = [];
2525
for (let item of data) {
26-
let htmlEle: HTMLCollection = tempFunction(item, templateID, propName);
26+
let htmlEle: HTMLCollection = tempFunction(item, null,propName, templateID, false , index);
2727
output = output.concat(Array.prototype.slice.call(htmlEle));
2828
}
2929
return output.concat([]);
@@ -66,7 +66,7 @@ describe('Template Engine', () => {
6666
let templateStr: string = '<div> Blazor template</div>';
6767
let Blazor: string = 'Blazor';
6868
window[Blazor] = 'template';
69-
let result: any = outDOM(template.compile(templateStr), [dsJSONArray[0]], '', 'Template')
69+
let result: any = outDOM(template.compile(templateStr), [dsJSONArray[0]], '', 'Template');
7070
window[Blazor] = null;
7171
expect(result[0].tagName).toEqual('DIV');
7272
});
@@ -84,14 +84,30 @@ describe('Template Engine', () => {
8484
expect(result).toBeUndefined();
8585
});
8686

87+
it('Check index blazor template', () => {
88+
let templateStr: string = '<div class=" class1">blazor</div>';
89+
let result: any = [];
90+
let blazor: string = 'Blazor';
91+
let ejsIntrop: string = 'ejsInterop';
92+
let tempID: string = 'template';
93+
window[blazor] = 'Template';
94+
window[ejsIntrop] = { updateTemplate: function () { } };
95+
template.blazorTemplates[tempID][0] = {text: '0', info: {id: '03'}, name: 'new first name', BlazorTemplateId: 'id1' };
96+
template.blazorTemplates[tempID][1] = {text: '1', info: {id: '03'}, name: 'new second name', BlazorTemplateId: 'id2' };
97+
result = outDOM(template.compile(templateStr), [dsJSONArray[0]], 'template', 'templateprop', 1);
98+
window[blazor] = null;
99+
window[ejsIntrop] = null;
100+
expect(result[0].tagName).toEqual('DIV');
101+
});
102+
87103
it('Check blazor row template', () => {
88104
let templateStr: string = '<div class=" class1">blazor</div>';
89105
let result: any = [];
90106
let blazor: string = 'Blazor';
91107
let ejsIntrop: string = 'ejsInterop';
92108
window[blazor] = 'Template';
93109
window[ejsIntrop] = { updateTemplate: function () { } };
94-
result = (template.updateBlazorTemplate('rowtemplate', 'RowTemplate'));
110+
result = (template.updateBlazorTemplate('rowtemplate', 'RowTemplate', null, false));
95111
window[blazor] = null;
96112
window[ejsIntrop] = null;
97113
expect(result).toBeUndefined();
@@ -120,6 +136,45 @@ describe('Template Engine', () => {
120136
expect(result).toBeUndefined();
121137
});
122138

139+
it('Check index reset blazor template to the body', () => {
140+
let elem: HTMLElement = document.createElement('div');
141+
elem.setAttribute('id', 'template');
142+
let newElement: HTMLElement = document.createElement('div');
143+
newElement.setAttribute('class', 'blazor-inner-template');
144+
newElement.setAttribute('data-templateId', 'tempID');
145+
elem.appendChild(newElement);
146+
let elem2: HTMLElement = document.createElement('div');
147+
elem2.setAttribute('id', 'tempID');
148+
elem2.setAttribute('data-templateId', 'tempID');
149+
let elem3: HTMLElement = document.createElement('tr');
150+
elem2.appendChild(elem3);
151+
document.activeElement.appendChild(elem2);
152+
document.activeElement.appendChild(elem);
153+
document.getElementById('tempID').appendChild(elem3);
154+
let result: any = [];
155+
result = (template.resetBlazorTemplate('template', 'Template', 0));
156+
expect(result).toBeUndefined();
157+
});
158+
it('Check reset blazor template without index', () => {
159+
let elem: HTMLElement = document.createElement('div');
160+
elem.setAttribute('id', 'template');
161+
let newElement: HTMLElement = document.createElement('div');
162+
newElement.setAttribute('class', 'blazor-inner-template');
163+
newElement.setAttribute('data-templateId', 'tempID');
164+
elem.appendChild(newElement);
165+
let elem2: HTMLElement = document.createElement('div');
166+
elem2.setAttribute('id', 'tempID');
167+
elem2.setAttribute('data-templateId', 'tempID');
168+
let elem3: HTMLElement = document.createElement('tr');
169+
elem2.appendChild(elem3);
170+
document.activeElement.appendChild(elem2);
171+
document.activeElement.appendChild(elem);
172+
document.getElementById('tempID').appendChild(elem3);
173+
let result: any = [];
174+
result = (template.resetBlazorTemplate('template', 'Template'));
175+
expect(result).toBeUndefined();
176+
});
177+
123178
it('Testing for blazor Row template', () => {
124179
let templateStr: string = '<tr> Blazor template</tr>';
125180
let Blazor: string = 'Blazor';
@@ -170,4 +225,4 @@ describe('Template Engine', () => {
170225
});
171226

172227

173-
});
228+
});

controls/base/src/template-engine.ts

+31-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44
import { compile as render } from './template';
55
import { createElement } from './dom';
6+
import { isNullOrUndefined } from './util';
67

78
const HAS_ROW: RegExp = /^[\n\r.]+\<tr|^\<tr/;
89
const HAS_SVG: RegExp = /^[\n\r.]+\<svg|^\<path|^\<g/;
@@ -31,20 +32,33 @@ export interface ITemplateEngine {
3132
export function compile(templateString: string, helper?: Object): (data: Object | JSON, component?: any, propName?: any) => NodeList {
3233
let compiler: Function = engineObj.compile(templateString, helper);
3334
//tslint:disable-next-line
34-
return (data: Object, component?: any, propName?: any, templateId?: any, isStringTemplate?: boolean ): NodeList => {
35+
return (data: Object, component?: any, propName?: any, templateId?: any, isStringTemplate?: boolean, index?: number): NodeList => {
3536
let result: object = compiler(data, component, propName);
3637
let blazor: string = 'Blazor'; let blazorTemplateId: string = 'BlazorTemplateId';
3738
if (window && window[blazor] && !isStringTemplate) {
3839
let randomId: string = getRandomId();
40+
let blazorId: string = templateId + randomId;
3941
if (!blazorTemplates[templateId]) {
4042
blazorTemplates[templateId] = [];
4143
}
42-
data[blazorTemplateId] = templateId + randomId;
43-
blazorTemplates[templateId].push(data);
44+
if (!isNullOrUndefined(index)) {
45+
let keys: string[] = Object.keys(blazorTemplates[templateId][index]);
46+
for (let key of keys) {
47+
if (data[key]) {
48+
blazorTemplates[templateId][index][key] = data[key];
49+
}
50+
if (key === blazorTemplateId) {
51+
blazorId = blazorTemplates[templateId][index][key];
52+
}
53+
}
54+
} else {
55+
data[blazorTemplateId] = blazorId;
56+
blazorTemplates[templateId].push(data);
57+
}
4458
// tslint:disable-next-line:no-any
45-
return propName === 'rowTemplate' ? [createElement('tr', { id: templateId + randomId })] as any :
59+
return propName === 'rowTemplate' ? [createElement('tr', { id: blazorId })] as any :
4660
// tslint:disable-next-line:no-any
47-
[createElement('div', { id: templateId + randomId })] as any;
61+
[createElement('div', { id: blazorId })] as any;
4862
}
4963
if (typeof result === 'string') {
5064
if (HAS_SVG.test(result)) {
@@ -60,16 +74,18 @@ export function compile(templateString: string, helper?: Object): (data: Object
6074
};
6175
}
6276

63-
export function updateBlazorTemplate(templateId?: string, templateName?: string, comp?: object): void {
77+
export function updateBlazorTemplate(templateId?: string, templateName?: string, comp?: object, isEmpty?: boolean): void {
6478
let blazor: string = 'Blazor';
6579
if (window && window[blazor]) {
6680
let ejsIntrop: string = 'ejsInterop';
6781
window[ejsIntrop].updateTemplate(templateName, blazorTemplates[templateId], templateId, comp);
68-
blazorTemplates[templateId] = [];
82+
if (isEmpty !== false) {
83+
blazorTemplates[templateId] = [];
84+
}
6985
}
7086
}
7187

72-
export function resetBlazorTemplate(templateId?: string, templateName?: string): void {
88+
export function resetBlazorTemplate(templateId?: string, templateName?: string, index?: number): void {
7389
let templateDiv: HTMLElement = document.getElementById(templateId);
7490
if (templateDiv) {
7591
// tslint:disable-next-line:no-any
@@ -80,11 +96,15 @@ export function resetBlazorTemplate(templateId?: string, templateName?: string):
8096
if (tempElement) {
8197
let length: number = tempElement.children.length;
8298
for (let j: number = 0; j < length; j++) {
83-
innerTemplates[i].appendChild(tempElement.children[0]);
84-
tempElement.appendChild(innerTemplates[i].children[j].cloneNode(true));
99+
if (!isNullOrUndefined(index)) {
100+
innerTemplates[index].appendChild(tempElement.children[0]);
101+
return;
102+
} else {
103+
innerTemplates[i].appendChild(tempElement.children[0]);
104+
}
85105
}
86-
}
87106

107+
}
88108
}
89109
}
90110
}

controls/buttons/CHANGELOG.md

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

33
## [Unreleased]
44

5-
## 17.2.34 (2019-07-11)
5+
## 17.2.35 (2019-07-17)
66

77
### Chips
88

0 commit comments

Comments
 (0)