]> git.proxmox.com Git - extjs.git/blame - extjs/classic/classic/src/tree/ViewDragZone.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / src / tree / ViewDragZone.js
CommitLineData
6527f429
DM
1/**\r
2 * @private\r
3 */\r
4Ext.define('Ext.tree.ViewDragZone', {\r
5 extend: 'Ext.view.DragZone',\r
6\r
7 isPreventDrag: function(e, record) {\r
8 return (record.get('allowDrag') === false) || !!e.getTarget(this.view.expanderSelector);\r
9 },\r
10\r
11 getDragText: function() {\r
12 var records = this.dragData.records,\r
13 count = records.length,\r
14 text = records[0].get(this.displayField),\r
15 suffix = 's',\r
16 formatRe = /\{\d+\}/,\r
17 dragText = this.dragText;\r
18\r
19 if (formatRe.test(dragText) && count === 1 && text) {\r
20 return text;\r
21 } else if (!text) {\r
22 suffix = '';\r
23 }\r
24 return Ext.String.format(dragText, count, suffix);\r
25 },\r
26\r
27 afterRepair: function() {\r
28 var me = this,\r
29 view = me.view,\r
30 selectedRowCls = view.selectedItemCls,\r
31 records = me.dragData.records,\r
32 r,\r
33 rLen = records.length,\r
34 fly = Ext.fly,\r
35 item;\r
36\r
37 if (Ext.enableFx && me.repairHighlight) {\r
38 // Roll through all records and highlight all the ones we attempted to drag.\r
39 for (r = 0; r < rLen; r++) {\r
40 // anonymous fns below, don't hoist up unless below is wrapped in\r
41 // a self-executing function passing in item.\r
42 item = view.getNode(records[r]);\r
43\r
44 // We must remove the selected row class before animating, because\r
45 // the selected row class declares !important on its background-color.\r
46 fly(item.firstChild).highlight(me.repairHighlightColor, {\r
47 listeners: {\r
48 beforeanimate: function() {\r
49 if (view.isSelected(item)) {\r
50 fly(item).removeCls(selectedRowCls);\r
51 }\r
52 },\r
53 afteranimate: function() {\r
54 if (view.isSelected(item)) {\r
55 fly(item).addCls(selectedRowCls);\r
56 }\r
57 }\r
58 }\r
59 });\r
60 }\r
61\r
62 }\r
63 me.dragging = false;\r
64 }\r
65});