@syncfusion/ej2-lists
Advanced tools
Comparing version 16.2.46 to 16.2.47
@@ -5,2 +5,4 @@ # Changelog | ||
## 16.2.46 (2018-07-30) | ||
### ListView | ||
@@ -7,0 +9,0 @@ |
/*! | ||
* filename: index.d.ts | ||
* version : 16.2.46 | ||
* version : 16.2.47 | ||
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"name": "@syncfusion/ej2-lists", | ||
"version": "16.2.46", | ||
"version": "16.2.47", | ||
"description": "Essential JS 2 List Components", | ||
@@ -12,4 +12,4 @@ "author": "Syncfusion Inc.", | ||
"@syncfusion/ej2-base": "~16.2.46", | ||
"@syncfusion/ej2-data": "~16.2.46", | ||
"@syncfusion/ej2-buttons": "~16.2.46" | ||
"@syncfusion/ej2-data": "~16.2.47", | ||
"@syncfusion/ej2-buttons": "~16.2.47" | ||
}, | ||
@@ -50,3 +50,4 @@ "devDependencies": { | ||
"url": "https://github.com/syncfusion/ej2-lists" | ||
} | ||
}, | ||
"homepage": "https://www.syncfusion.com/products/javascript/listview" | ||
} |
@@ -39,3 +39,3 @@ import { Query } from '@syncfusion/ej2-data'; | ||
*/ | ||
function createList(dataSource: { | ||
function createList(createElement: createElementParams, dataSource: { | ||
[key: string]: Object; | ||
@@ -47,3 +47,3 @@ }[] | string[], options?: ListBaseOptions, isSingleLevel?: boolean): HTMLElement; | ||
*/ | ||
function createListFromArray(dataSource: string[], isSingleLevel?: boolean, options?: ListBaseOptions): HTMLElement; | ||
function createListFromArray(createElement: createElementParams, dataSource: string[], isSingleLevel?: boolean, options?: ListBaseOptions): HTMLElement; | ||
/** | ||
@@ -53,3 +53,3 @@ * Function helps to created an element list based on string array input . | ||
*/ | ||
function createListItemFromArray(dataSource: string[], isSingleLevel?: boolean, options?: ListBaseOptions): HTMLElement[]; | ||
function createListItemFromArray(createElement: createElementParams, dataSource: string[], isSingleLevel?: boolean, options?: ListBaseOptions): HTMLElement[]; | ||
/** | ||
@@ -60,3 +60,3 @@ * Function helps to created an element list based on array of JSON input . | ||
*/ | ||
function createListItemFromJson(dataSource: { | ||
function createListItemFromJson(createElement: createElementParams, dataSource: { | ||
[key: string]: Object; | ||
@@ -69,3 +69,3 @@ }[], options?: ListBaseOptions, level?: number, isSingleLevel?: boolean): HTMLElement[]; | ||
*/ | ||
function createListFromJson(dataSource: { | ||
function createListFromJson(createElement: createElementParams, dataSource: { | ||
[key: string]: Object; | ||
@@ -128,3 +128,3 @@ }[], options?: ListBaseOptions, level?: number, isSingleLevel?: boolean): HTMLElement; | ||
*/ | ||
function renderContentTemplate(template: string, dataSource: { | ||
function renderContentTemplate(createElement: createElementParams, template: string, dataSource: { | ||
[key: string]: Object; | ||
@@ -149,3 +149,3 @@ }[], fields?: FieldsMapping, options?: ListBaseOptions): HTMLElement; | ||
*/ | ||
function generateUL(liElement: HTMLElement[], className?: string, options?: ListBaseOptions): HTMLElement; | ||
function generateUL(createElement: createElementParams, liElement: HTMLElement[], className?: string, options?: ListBaseOptions): HTMLElement; | ||
/** | ||
@@ -157,4 +157,13 @@ * Returns LI element with additional DIV tag based on the given LI element. | ||
*/ | ||
function generateIcon(liElement: HTMLElement, className?: string, options?: ListBaseOptions): HTMLElement; | ||
function generateIcon(createElement: createElementParams, liElement: HTMLElement, className?: string, options?: ListBaseOptions): HTMLElement; | ||
} | ||
export declare type createElementParams = (tag: string, prop?: { | ||
id?: string; | ||
className?: string; | ||
innerHTML?: string; | ||
styles?: string; | ||
attrs?: { | ||
[key: string]: string; | ||
}; | ||
}) => HTMLElement; | ||
export interface FieldsMapping { | ||
@@ -269,4 +278,4 @@ id?: string; | ||
[key: string]: Object; | ||
} | string | string[], fields: FieldsMapping): { | ||
} | string | number, fields: FieldsMapping): { | ||
[key: string]: Object; | ||
} | string | string[]; | ||
} | string | number; |
import { extend, merge, isNullOrUndefined, getValue } from '@syncfusion/ej2-base'; | ||
import { createElement, attributes, prepend, isVisible, append, addClass } from '@syncfusion/ej2-base'; | ||
import { attributes, prepend, isVisible, append, addClass } from '@syncfusion/ej2-base'; | ||
import { compile } from '@syncfusion/ej2-base'; | ||
@@ -82,3 +82,3 @@ import { DataManager, Query } from '@syncfusion/ej2-data'; | ||
*/ | ||
function createList(dataSource, options, isSingleLevel) { | ||
function createList(createElement, dataSource, options, isSingleLevel) { | ||
var curOpt = extend({}, defaultListBaseOptions, options); | ||
@@ -88,6 +88,6 @@ var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes); | ||
if (type === 'string' || type === 'number') { | ||
return createListFromArray(dataSource, isSingleLevel, options); | ||
return createListFromArray(createElement, dataSource, isSingleLevel, options); | ||
} | ||
else { | ||
return createListFromJson(dataSource, options, ariaAttributes.level, isSingleLevel); | ||
return createListFromJson(createElement, dataSource, options, ariaAttributes.level, isSingleLevel); | ||
} | ||
@@ -100,5 +100,5 @@ } | ||
*/ | ||
function createListFromArray(dataSource, isSingleLevel, options) { | ||
var subChild = createListItemFromArray(dataSource, isSingleLevel, options); | ||
return generateUL(subChild, null, options); | ||
function createListFromArray(createElement, dataSource, isSingleLevel, options) { | ||
var subChild = createListItemFromArray(createElement, dataSource, isSingleLevel, options); | ||
return generateUL(createElement, subChild, null, options); | ||
} | ||
@@ -110,3 +110,3 @@ ListBase.createListFromArray = createListFromArray; | ||
*/ | ||
function createListItemFromArray(dataSource, isSingleLevel, options) { | ||
function createListItemFromArray(createElement, dataSource, isSingleLevel, options) { | ||
var subChild = []; | ||
@@ -131,6 +131,6 @@ var curOpt = extend({}, defaultListBaseOptions, options); | ||
if (isSingleLevel) { | ||
li = generateSingleLevelLI(dataSource[i], null, null, [], null, id, i, options); | ||
li = generateSingleLevelLI(createElement, dataSource[i], undefined, null, null, [], null, id, i, options); | ||
} | ||
else { | ||
li = generateLI(dataSource[i], null, null, options); | ||
li = generateLI(createElement, dataSource[i], undefined, null, null, options); | ||
} | ||
@@ -158,3 +158,3 @@ if (curOpt.itemCreated && typeof curOpt.itemCreated === 'function') { | ||
// tslint:disable-next-line:max-func-body-length | ||
function createListItemFromJson(dataSource, options, level, isSingleLevel) { | ||
function createListItemFromJson(createElement, dataSource, options, level, isSingleLevel) { | ||
var curOpt = extend({}, defaultListBaseOptions, options); | ||
@@ -170,3 +170,3 @@ cssClass = getModuleClass(curOpt.moduleName); | ||
var li; | ||
if (Object.keys(dataSource).length && !typeofData(dataSource).item.hasOwnProperty(fields.id)) { | ||
if (dataSource.length && !typeofData(dataSource).item.hasOwnProperty(fields.id)) { | ||
id = generateId(); // generate id for drop-down-list option. | ||
@@ -193,4 +193,3 @@ } | ||
} | ||
if (Object.keys(dataSource).length && fieldData.hasOwnProperty(fields.id) | ||
&& !isNullOrUndefined(fieldData[fields.id])) { | ||
if (fieldData.hasOwnProperty(fields.id) && !isNullOrUndefined(fieldData[fields.id])) { | ||
id = fieldData.id; | ||
@@ -208,7 +207,7 @@ } | ||
} | ||
li = generateSingleLevelLI(curItem, fields, curOpt.itemClass, innerEle, (curItem.hasOwnProperty('isHeader') && | ||
li = generateSingleLevelLI(createElement, curItem, fieldData, fields, curOpt.itemClass, innerEle, (curItem.hasOwnProperty('isHeader') && | ||
curItem.isHeader) ? true : false, id, i, options); | ||
} | ||
else { | ||
li = generateLI(curItem, fields, curOpt.itemClass, options); | ||
li = generateLI(createElement, curItem, fieldData, fields, curOpt.itemClass, options); | ||
li.classList.add(cssClass.level + '-' + ariaAttributes.level); | ||
@@ -243,3 +242,3 @@ li.setAttribute('aria-level', ariaAttributes.level.toString()); | ||
} | ||
processSubChild(curItem, fields, dataSource, curOpt, li, ariaAttributes.level); | ||
processSubChild(createElement, fieldData, fields, dataSource, curOpt, li, ariaAttributes.level); | ||
} | ||
@@ -267,6 +266,6 @@ if (curOpt.itemCreated && typeof curOpt.itemCreated === 'function') { | ||
*/ | ||
function createListFromJson(dataSource, options, level, isSingleLevel) { | ||
function createListFromJson(createElement, dataSource, options, level, isSingleLevel) { | ||
var curOpt = extend({}, defaultListBaseOptions, options); | ||
var li = createListItemFromJson(dataSource, options, level, isSingleLevel); | ||
return generateUL(li, curOpt.listClass, options); | ||
var li = createListItemFromJson(createElement, dataSource, options, level, isSingleLevel); | ||
return generateUL(createElement, li, curOpt.listClass, options); | ||
} | ||
@@ -459,3 +458,3 @@ ListBase.createListFromJson = createListFromJson; | ||
*/ | ||
function renderContentTemplate(template, dataSource, fields, options) { | ||
function renderContentTemplate(createElement, template, dataSource, fields, options) { | ||
cssClass = getModuleClass(defaultListBaseOptions.moduleName); | ||
@@ -541,4 +540,3 @@ var ulElement = createElement('ul', { className: cssClass.ul, attrs: { role: 'presentation' } }); | ||
ListBase.generateId = generateId; | ||
function processSubChild(curItem, fields, ds, options, element, level) { | ||
var fieldData = getFieldValues(curItem, fields); | ||
function processSubChild(createElement, fieldData, fields, ds, options, element, level) { | ||
// Get SubList | ||
@@ -552,3 +550,3 @@ var subDS = fieldData[fields.child] || []; | ||
if (options.processSubChild) { | ||
var subLi = createListFromJson(subDS, options, ++level); | ||
var subLi = createListFromJson(createElement, subDS, options, ++level); | ||
element.appendChild(subLi); | ||
@@ -566,3 +564,3 @@ } | ||
} | ||
function generateSingleLevelLI(item, fields, className, innerElements, grpLI, id, index, options) { | ||
function generateSingleLevelLI(createElement, item, fieldData, fields, className, innerElements, grpLI, id, index, options) { | ||
var curOpt = extend({}, defaultListBaseOptions, options); | ||
@@ -573,3 +571,2 @@ var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes); | ||
var dataSource; | ||
var fieldData = getFieldValues(item, fields); | ||
if (typeof item !== 'string' && typeof item !== 'number' && typeof item !== 'boolean') { | ||
@@ -612,3 +609,3 @@ dataSource = item; | ||
if (dataSource && fieldData.hasOwnProperty(fields.url) && fieldData[fields.url]) { | ||
li.appendChild(anchorTag(dataSource, fields, text)); | ||
li.appendChild(anchorTag(createElement, dataSource, fields, text)); | ||
} | ||
@@ -643,3 +640,3 @@ else { | ||
} | ||
function anchorTag(dataSource, fields, text) { | ||
function anchorTag(createElement, dataSource, fields, text) { | ||
var fieldData = getFieldValues(dataSource, fields); | ||
@@ -655,3 +652,3 @@ var attr = { href: fieldData[fields.url] }; | ||
/* tslint:disable:align */ | ||
function generateLI(item, fields, className, options) { | ||
function generateLI(createElement, item, fieldData, fields, className, options) { | ||
var curOpt = extend({}, defaultListBaseOptions, options); | ||
@@ -663,5 +660,3 @@ var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes); | ||
var dataSource; | ||
var fieldData; | ||
if (typeof item !== 'string' && typeof item !== 'number') { | ||
fieldData = getFieldValues(item, fields); | ||
dataSource = item; | ||
@@ -688,10 +683,14 @@ text = fieldData[fields.text] || ''; | ||
else { | ||
var innerDiv = createElement('div', { className: cssClass.textContent, | ||
attrs: (ariaAttributes.wrapperRole !== '' ? { role: ariaAttributes.wrapperRole } : {}) }); | ||
var innerDiv = createElement('div', { | ||
className: cssClass.textContent, | ||
attrs: (ariaAttributes.wrapperRole !== '' ? { role: ariaAttributes.wrapperRole } : {}) | ||
}); | ||
if (dataSource && fieldData.hasOwnProperty(fields.url) && fieldData[fields.url]) { | ||
innerDiv.appendChild(anchorTag(dataSource, fields, text)); | ||
innerDiv.appendChild(anchorTag(createElement, dataSource, fields, text)); | ||
} | ||
else { | ||
innerDiv.appendChild(createElement('span', { className: cssClass.text, innerHTML: text, | ||
attrs: (ariaAttributes.itemText !== '' ? { role: ariaAttributes.itemText } : {}) })); | ||
innerDiv.appendChild(createElement('span', { | ||
className: cssClass.text, innerHTML: text, | ||
attrs: (ariaAttributes.itemText !== '' ? { role: ariaAttributes.itemText } : {}) | ||
})); | ||
} | ||
@@ -708,3 +707,3 @@ li.appendChild(innerDiv); | ||
*/ | ||
function generateUL(liElement, className, options) { | ||
function generateUL(createElement, liElement, className, options) { | ||
var curOpt = extend({}, defaultListBaseOptions, options); | ||
@@ -727,9 +726,10 @@ var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes); | ||
*/ | ||
function generateIcon(liElement, className, options) { | ||
function generateIcon(createElement, liElement, className, options) { | ||
var curOpt = extend({}, defaultListBaseOptions, options); | ||
var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes); | ||
cssClass = getModuleClass(curOpt.moduleName); | ||
var expandElement = curOpt.expandIconPosition === 'Left' ? prepend : append; | ||
expandElement([createElement('div', { className: 'e-icons ' + curOpt.expandIconClass + ' ' + | ||
(isNullOrUndefined(className) ? '' : className) })], liElement.querySelector('.' + cssClass.textContent)); | ||
expandElement([createElement('div', { | ||
className: 'e-icons ' + curOpt.expandIconClass + ' ' + | ||
(isNullOrUndefined(className) ? '' : className) | ||
})], liElement.querySelector('.' + cssClass.textContent)); | ||
return liElement; | ||
@@ -746,29 +746,18 @@ } | ||
var fieldData = {}; | ||
var value; | ||
if (isNullOrUndefined(dataItem)) { | ||
if (isNullOrUndefined(dataItem) || typeof (dataItem) === 'string' || typeof (dataItem) === 'number' | ||
|| !isNullOrUndefined(dataItem.isHeader)) { | ||
return dataItem; | ||
} | ||
else if (typeof (dataItem) === 'string' || typeof (dataItem) === 'number') { | ||
return dataItem; | ||
} | ||
else if (isNullOrUndefined(dataItem.isHeader)) { | ||
else { | ||
for (var _i = 0, _a = Object.keys(fields); _i < _a.length; _i++) { | ||
var field = _a[_i]; | ||
if (!isNullOrUndefined(fields[field]) && | ||
typeof (fields[field]) === 'string') { | ||
var property = fields[field].split('.'); | ||
var dataField = property.length > 1 ? property[0] : fields[field]; | ||
if (!isNullOrUndefined(dataItem[dataField])) { | ||
value = getValue(fields[field], dataItem); | ||
if (!isNullOrUndefined(value)) { | ||
fieldData[fields[field]] = value; | ||
} | ||
} | ||
var dataField = fields[field]; | ||
var value = !isNullOrUndefined(dataField) && | ||
typeof (dataField) === 'string' ? getValue(dataField, dataItem) : undefined; | ||
if (!isNullOrUndefined(value)) { | ||
fieldData[dataField] = value; | ||
} | ||
} | ||
} | ||
else if (!isNullOrUndefined(dataItem.isHeader) && dataItem.isHeader) { | ||
fieldData = dataItem; | ||
} | ||
return fieldData; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Virtualization } from './virtualization';import { merge, formatUnit, isNullOrUndefined, classList, append, detach, ModuleDeclaration } from '@syncfusion/ej2-base';import { attributes, addClass, removeClass, prepend, closest, remove } from '@syncfusion/ej2-base';import { Component, EventHandler, BaseEventArgs, Property, Complex, Event } from '@syncfusion/ej2-base';import { NotifyPropertyChanges, INotifyPropertyChanged, ChildProperty } from '@syncfusion/ej2-base';import { KeyboardEventArgs, EmitType, compile } from '@syncfusion/ej2-base';import { Animation, AnimationOptions, Effect, rippleEffect, Touch, SwipeEventArgs } from '@syncfusion/ej2-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { createCheckBox } from '@syncfusion/ej2-buttons';import { ListBase, ListBaseOptions, SortOrder, getFieldValues, FieldsMapping } from '../common/list-base'; | ||
import { Virtualization } from './virtualization';import { merge, formatUnit, isNullOrUndefined, classList, append, detach, ModuleDeclaration } from '@syncfusion/ej2-base';import { attributes, addClass, removeClass, prepend, closest, remove } from '@syncfusion/ej2-base';import { Component, EventHandler, BaseEventArgs, Property, Complex, Event } from '@syncfusion/ej2-base';import { NotifyPropertyChanges, INotifyPropertyChanged, ChildProperty } from '@syncfusion/ej2-base';import { KeyboardEventArgs, EmitType, compile } from '@syncfusion/ej2-base';import { Animation, AnimationOptions, Effect, rippleEffect, Touch, SwipeEventArgs } from '@syncfusion/ej2-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { createCheckBox } from '@syncfusion/ej2-buttons';import { ListBase, ListBaseOptions, SortOrder, getFieldValues, FieldsMapping } from '../common/list-base'; | ||
import {AnimationSettings,checkBoxPosition,SelectEventArgs} from "./list-view"; | ||
@@ -3,0 +3,0 @@ import {ComponentModel} from '@syncfusion/ej2-base'; |
@@ -11,3 +11,3 @@ import { classNames } from './list-view'; | ||
var firstDs = curViewDS.slice(0, 1); | ||
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(firstDs, this.listViewInstance.listBaseOption); | ||
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption); | ||
this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.content }); | ||
@@ -23,3 +23,3 @@ this.listViewInstance.element.appendChild(this.listViewInstance.contentContainer); | ||
var otherDs = curViewDS.slice(1, this.domItemCount); | ||
var listItems = ListBase.createListItemFromJson(otherDs, this.listViewInstance.listBaseOption); | ||
var listItems = ListBase.createListItemFromJson(this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption); | ||
append(listItems, this.listViewInstance.ulElement); | ||
@@ -26,0 +26,0 @@ this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li'); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
5005316
1
30827