@syncfusion/ej2-lists
Advanced tools
Comparing version 17.4.39 to 17.4.40
@@ -5,2 +5,8 @@ # Changelog | ||
### ListBox | ||
#### Bug Fixes | ||
- Provided 'beforeDrop' event. | ||
## 17.3.27 (2019-11-12) | ||
@@ -7,0 +13,0 @@ |
/*! | ||
* filename: index.d.ts | ||
* version : 17.4.39 | ||
* version : 17.4.40 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"_from": "@syncfusion/ej2-lists@*", | ||
"_id": "@syncfusion/ej2-lists@17.3.27", | ||
"_id": "@syncfusion/ej2-lists@17.4.39", | ||
"_inBundle": false, | ||
"_integrity": "sha512-DYD0JZKKPw1M7P4hrrmDWJAqBAliuqzYVyddwBVyB+bkfCDGGzf3GS46fo/8kBEMQ6nD6mgBBmUDDzDnDHf13A==", | ||
"_integrity": "sha512-YbKdtW6Lc0740beJXrkne7ayyp+f7FRd9GsRXjH0grP2gm1K9RrooAYZBtnZtOlo2ym/UQDmaGzee5TN3JtjIQ==", | ||
"_location": "/@syncfusion/ej2-lists", | ||
@@ -36,4 +36,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-lists/-/ej2-lists-17.3.27.tgz", | ||
"_shasum": "fb6fee696d03e96eab5d9818ad455bda592b8f13", | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-lists/-/ej2-lists-17.4.39.tgz", | ||
"_shasum": "247fa5572c5e9ae5d2ba9663bde52a9ca4a49053", | ||
"_spec": "@syncfusion/ej2-lists@*", | ||
@@ -88,4 +88,4 @@ "_where": "/jenkins/workspace/ation_hotfix_17.2.0.34_Vol2-DDPJ6C2YEWTWLLKKNA7AG2JBE6DYTCTNGMHGORWGAYAVCL6L7OLQ/packages/included", | ||
"typings": "index.d.ts", | ||
"version": "17.4.39", | ||
"version": "17.4.40", | ||
"sideEffects": false | ||
} |
@@ -49,2 +49,8 @@ import { Base, Event, getUniqueID, NotifyPropertyChanges, INotifyPropertyChanged, Property } from '@syncfusion/ej2-base';import { closest, Draggable, DragPosition, MouseEventArgs, remove, compareElementParent } from '@syncfusion/ej2-base';import { addClass, isNullOrUndefined, getComponent, isBlazor, BlazorDragEventArgs } from '@syncfusion/ej2-base'; | ||
/** | ||
* Specifies the callback function for beforeDrop event. | ||
* @event | ||
*/ | ||
beforeDrop?: Function; | ||
/** | ||
* Specifies the callback function for drop event. | ||
@@ -51,0 +57,0 @@ * @event |
@@ -57,2 +57,7 @@ import { Base, INotifyPropertyChanged } from '@syncfusion/ej2-base'; | ||
/** | ||
* Specifies the callback function for beforeDrop event. | ||
* @event | ||
*/ | ||
beforeDrop: Function; | ||
/** | ||
* Specifies the callback function for drop event. | ||
@@ -102,1 +107,10 @@ * @event | ||
export declare function moveTo(from: HTMLElement, to?: HTMLElement, targetIndexes?: number[], insertBefore?: number): void; | ||
export interface DropEventArgs { | ||
previousIndex: number; | ||
currentIndex: number; | ||
droppedElement: Element; | ||
target: Element; | ||
helper: Element; | ||
cancel?: boolean; | ||
handled?: boolean; | ||
} |
@@ -124,19 +124,41 @@ var __extends = (this && this.__extends) || (function () { | ||
var prevIdx; | ||
var curIdx; | ||
var handled; | ||
prevIdx = _this.getIndex(_this.target); | ||
if (_this.isPlaceHolderPresent(dropInst)) { | ||
prevIdx = _this.getIndex(_this.target); | ||
_this.updateItemClass(dropInst); | ||
dropInst.element.insertBefore(_this.target, dropInst.placeHolderElement); | ||
var curIdx = _this.getIndex(_this.target, dropInst); | ||
prevIdx = _this === dropInst && (prevIdx - curIdx) > 1 ? prevIdx - 1 : prevIdx; | ||
_this.trigger('drop', { event: e.event, element: dropInst.element, previousIndex: prevIdx, currentIndex: curIdx, | ||
target: e.target, helper: e.helper, droppedElement: _this.target, scopeName: _this.scope }); | ||
remove(dropInst.placeHolderElement); | ||
var curIdx_1 = _this.getIndex(dropInst.placeHolderElement, dropInst); | ||
var args = { previousIndex: prevIdx, currentIndex: curIdx_1, target: e.target, droppedElement: _this.target, | ||
helper: e.helper, cancel: false, handled: false }; | ||
_this.trigger('beforeDrop', args, function (observedArgs) { | ||
if (!observedArgs.cancel) { | ||
handled = observedArgs.handled; | ||
_this.updateItemClass(dropInst); | ||
if (observedArgs.handled) { | ||
var ele = _this.target.cloneNode(true); | ||
_this.target.classList.remove('e-grabbed'); | ||
_this.target = ele; | ||
} | ||
dropInst.element.insertBefore(_this.target, dropInst.placeHolderElement); | ||
var curIdx_2 = _this.getIndex(_this.target, dropInst); | ||
prevIdx = _this === dropInst && (prevIdx - curIdx_2) > 1 ? prevIdx - 1 : prevIdx; | ||
_this.trigger('drop', { event: e.event, element: dropInst.element, previousIndex: prevIdx, currentIndex: curIdx_2, | ||
target: e.target, helper: e.helper, droppedElement: _this.target, scopeName: _this.scope, handled: handled }); | ||
} | ||
remove(dropInst.placeHolderElement); | ||
}); | ||
} | ||
dropInst = _this.getSortableInstance(e.target); | ||
curIdx = dropInst.element.childElementCount; | ||
prevIdx = _this.getIndex(_this.target); | ||
if (dropInst.element === e.target) { | ||
prevIdx = _this.getIndex(_this.target); | ||
_this.updateItemClass(dropInst); | ||
dropInst.element.appendChild(_this.target); | ||
_this.trigger('drop', { event: e.event, element: dropInst.element, previousIndex: prevIdx, currentIndex: 0, | ||
target: e.target, helper: e.helper, droppedElement: _this.target, scopeName: _this.scope }); | ||
var beforeDropArgs = { previousIndex: prevIdx, currentIndex: curIdx, target: e.target, | ||
droppedElement: _this.target, helper: e.helper, cancel: false }; | ||
_this.trigger('beforeDrop', beforeDropArgs, function (observedArgs) { | ||
if (!observedArgs.cancel) { | ||
_this.updateItemClass(dropInst); | ||
dropInst.element.appendChild(_this.target); | ||
_this.trigger('drop', { event: e.event, element: dropInst.element, previousIndex: prevIdx, currentIndex: curIdx, | ||
target: e.target, helper: e.helper, droppedElement: _this.target, scopeName: _this.scope }); | ||
} | ||
}); | ||
} | ||
@@ -320,2 +342,5 @@ _this.target.classList.remove('e-grabbed'); | ||
Event() | ||
], Sortable.prototype, "beforeDrop", void 0); | ||
__decorate([ | ||
Event() | ||
], Sortable.prototype, "drop", void 0); | ||
@@ -322,0 +347,0 @@ Sortable = Sortable_1 = __decorate([ |
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
2313648
21777