UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

165 lines (131 loc) 4.92 kB
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The source code</title> <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../resources/prettify/prettify.js"></script> <style type="text/css"> .highlight { display: block; background-color: #ddd; } </style> <script type="text/javascript"> function highlight() { document.getElementById(location.hash.replace(/#/, "")).className = "highlight"; } </script> </head> <body onload="prettyPrint(); highlight();"> <pre class="prettyprint lang-js">/* Siesta 5.6.1 Copyright(c) 2009-2022 Bryntum AB https://bryntum.com/contact https://bryntum.com/products/siesta/license */ Ext.define(&#39;Siesta.Recorder.UI.Editor.DragTarget&#39;, { extend : &#39;Ext.form.field.Picker&#39;, alias : &#39;widget.drageditor&#39;, editable : false, hideTrigger : true, minWidth : 300, sourceEditor : null, targetEditor : null, record : null, onTargetChange : null, listeners : { focus : function (fld, e, opts) { fld.expand(); } }, cancelEdit : function () { var me = this; me.fireEvent(&#39;blur&#39;); me.collapse(); }, applyValues : function () { var me = this, form = me.picker, values = form.getForm().getValues() var rec = me.up(&#39;tablepanel&#39;).editing.activeRecord; this.sourceEditor.applyChanges(rec) this.targetEditor.applyChanges(rec) var by = values.by; rec.set(&#39;by&#39;, (by &amp;&amp; rec.parseOffset(by)) || by) me.fireEvent(&#39;blur&#39;); me.collapse(); }, applyChanges : function () { }, collapseIf : function (e) { if (!e.getTarget(&#39;.x-layer&#39;)) return this.callParent(arguments) }, valueToRaw : function () { return &#39;&#39; }, createPicker : function () { var R = Siesta.Resource(&#39;Siesta.Recorder.UI.Editor.DragTarget&#39;); var me = this; var targetListeners = { select : this.onTargetChange, keyup : this.onTargetChange, focus : this.onTargetChange, buffer : 50, scope : this }; return new Ext.form.Panel({ floating : true, bodyPadding : 5, title : R.get(&#39;dragVariantTitle&#39;), items : [ this.sourceEditor = new Siesta.Recorder.UI.Editor.Target({ fieldLabel : R.get(&#39;targetLabel&#39;) + &#39;:&#39;, anchor : &#39;100%&#39;, name : &#39;target&#39;, labelWidth : 60, listeners : targetListeners }), this.targetEditor = new Siesta.Recorder.UI.Editor.Target({ targetProperty : &#39;toTarget&#39;, fieldLabel : R.get(&#39;toLabel&#39;) + &#39;:&#39;, name : &#39;toTarget&#39;, anchor : &#39;100%&#39;, labelWidth : 60, listeners : targetListeners }), { xtype : &#39;textfield&#39;, name : &#39;by&#39;, fieldLabel : R.get(&#39;byLabel&#39;) + &#39;:&#39;, labelWidth : 60, width : 200 } ], listeners: { afterrender: function (panel, opts) { var rec = me.record; me.sourceEditor.populate(rec.get(&#39;target&#39;)) me.targetEditor.populate(rec.get(&#39;toTarget&#39;)) panel.getForm().setValues(rec.data); } }, buttons : [ { name : &#39;cancel&#39;, text : R.get(&#39;cancelButtonText&#39;), handler : function (btn, e, opts) { me.cancelEdit(); } }, &#39;-&gt;&#39;, { name : &#39;save&#39;, text : R.get(&#39;saveButtonText&#39;), handler : function (btn, e, opts) { me.applyValues(); } } ] }); } });</pre> </body> </html>