UNPKG

siesta-lite

Version:

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

95 lines (80 loc) 2.8 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.ContextMenu&#39;, { extend : &#39;Ext.menu.Menu&#39;, alias : &#39;widget.recordercontextmenu&#39;, panel : null, width : 300, plain : true, initComponent : function () { var me = this; //var R = Siesta.Resource(&#39;Siesta.Recorder.UI.RecorderPanel&#39;); Ext.apply(me, { items : [ { xtype : &#39;textfield&#39;, itemId : &#39;newGroupName&#39;, fieldLabel : &#39;Create group&#39;, width : 80, enableKeyEvents : true, listeners : { specialkey : this.onCreateGroupKeyUp, scope : this } } ] }); this.panel.on({ rowcontextmenu : this.onActivate, scope : this }) this.callParent(arguments) this.nameField = this.down(&#39;#newGroupName&#39;); }, onActivate : function (panel, record, node, rowIndex, e) { this.showAt(e.getXY()); this.nameField.reset(); e.stopEvent(); }, onCreateGroupKeyUp : function(field, e) { if (e.getKey() === e.ENTER) { var name = this.nameField.getValue(); if (name){ var store = this.panel.getStore(); var selected = this.panel.getSelectionModel().getSelected().items; var firstRow = Math.min.apply(Math, selected.map(function(rec) { return rec.data.index; })); store.getRootNode().insertChild(firstRow, { action : &#39;group&#39;, value : name, expanded : true, children : selected }); this.hide(); } } } }); </pre> </body> </html>