This widget represents a drop target for items dragged from a DragAndDropItems widget. When an item is dropped onto this widget it will render that item using the configured widgetsForWrappingDroppedItems and widgetsForDroppedItems unless it has been configured to use a modelling service (in which case the service will provide the widget models).
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Extends
Mixes In
- external:dojo/_TemplatedMixin
- module:alfresco/core/Core
Members
-
acceptTypes :string[]
-
The types that this drop zone will accept. By default this is set to null but if not specified in the configuration this will be initialised to ["widget"].
Type:
- string[]
- Default Value:
- null
- Source:
-
cssRequirements :Array
-
An array of the CSS files to use with this widget.
Type:
- Array
- Source:
-
horizontal :boolean
-
Type:
- boolean
- Default Value:
- false
- Source:
-
initialItems :object[]
-
A list of the initial items to add to the drop zone when it is first created.
Type:
- object[]
- Default Value:
- null
- Source:
-
label :string
-
An optional label to provide for the target.
Type:
- string
- Default Value:
- null
- Source:
-
previewTarget :object
-
The target for dropping widgets onto.
Type:
- object
- Default Value:
- null
- Source:
-
targetProperty :string
-
An optional property that the target represents. This is expected to be used when a target is nested within the display of another dropped item.
Type:
- string
- Default Value:
- null
- Source:
-
templateString :String
-
The HTML template to use for the widget.
Type:
- String
- Source:
-
useModellingService :boolean
-
Indicates whether or not to use a modelling service to render the dropped items. This will result in publications being made to request the widgets to use for each dropped item based on the value of the dropped item.
Type:
- boolean
- Default Value:
- false
- Source:
-
widgetsForDroppedItems :array
-
This is the default widget model to use for each dropped item. It can be overridden if required and will not be used if the data in the dropped item contains a "widgets" attribute.
Type:
- array
- Source:
-
widgetsForWrappingDroppedItems :array
-
The widget model used to wrap each dropped item.
Type:
- array
- Source:
-
withHandles :boolean
-
Indicates whether or not dragging should be done with handles.
Type:
- boolean
- Default Value:
- true
- Source:
Methods
-
addItem(resolvedPromise)
-
Inserts a new item provided by a resolved promise.
Parameters:
Name Type Description resolvedPromise
promise A resolved promise that is expected to contain an item to insert - Source:
-
createDndNodesForValue(value)
-
Create the drag-and-drop nodes as required for the supplied value.
Parameters:
Name Type Description value
object The value to set. - Since:
- 1.0.65
- Source:
-
createDroppedItemsWidgets(item, node, resolvedPromise)
-
This function is the callback for the promise published by the [createViaService] module:alfresco/dnd/DragAndDropTarget#createViaService function. It will render the model provided to wrap and represent the dropped item.
Parameters:
Name Type Description item
object The dropped item configuration node
element The dropped element resolvedPromise
object A resolved promise containing the widget models to render - Source:
-
createViaService(item)
-
This function is called from the creator function when useModellingService is set to true. It publishes a request for a widget model for the value of the dropped item that is expected to be serviced by a modelling service (such as the DndModellingService).
Parameters:
Name Type Description item
object The dropped item - Source:
-
creator()
-
This handles the creation of the widget in the preview panel.
- Source:
-
deleteItem(evt)
-
Handles requests to delete a previously dropped item.
Parameters:
Name Type Description evt
object The event. - Source:
-
getValue() → {array}
-
Iterates over all the dropped nodes, finds the widget associated with each node and then calls that widgets getValue function (if it has one). The resulting values are all pushed into an array that is then returned.
- Source:
Returns:
The array of values represented by the dropped items.- Type
- array
-
onItemDraggedOut()
-
Called whenever an item is dragged out of the current drop target. This is emits an event to indicating that this has occurred to enabled nested drop targets to be supported.
- Source:
-
onItemDraggedOver()
-
Called whenever an item is dragged out of the current drop target. This is emits an event to indicating that this has occurred to enabled nested drop targets to be supported.
- Source:
-
onItemsUpdated()
-
This function is called after a new item is dropped onto the target or when items are deleted from it
- Source:
-
onKeyPress(evt)
-
Handles key presses when the drop target has focus. If the key pressed is the ENTER key then a request will be published to request an item to insert. This is expected to be the currently selected item in a DragAndDropItems widget.
Parameters:
Name Type Description evt
object The keypress event - Source:
-
onNestedDragOut(evt)
-
This function is called when a DragAndDropNestedTarget has an item dragged out of it. This function will then call the Dojo dojo.dnd.Manager singleton to let it know that the item is currently over the current target. This is required because the Dojo drag and drop framework that is used does not support nested targets.
Parameters:
Name Type Description evt
object The drag out event - Source:
-
onNestedDragOver(evt)
-
This function is called when a DragAndDropNestedTarget has an item dragged over it. This then updates the CSS classes to indicate that the item is no longer the current target (because the nested target is the current target).
Parameters:
Name Type Description evt
object The drag out event - Source:
-
onWidgetSelected(evt)
-
Although this function's name suggests it handles an nodes selection, there is no guarantee that a node has actually been selected. This is simply attached to the mouseDown event.
Parameters:
Name Type Description evt
object The selection event - Source:
-
postCreate()
-
- Source:
-
setValue(value)
-
This will render new items for each value in the element array provided.
Parameters:
Name Type Description value
object The value to set. - Source: