Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
4.7 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.form.TextArea"></div>/**
  16. * @class Ext.form.TextArea
  17. * @extends Ext.form.TextField
  18. * Multiline text field. Can be used as a direct replacement for traditional textarea fields, plus adds
  19. * support for auto-sizing.
  20. * @constructor
  21. * Creates a new TextArea
  22. * @param {Object} config Configuration options
  23. * @xtype textarea
  24. */
  25. Ext.form.TextArea = Ext.extend(Ext.form.TextField, {
  26. <div id="cfg-Ext.form.TextArea-growMin"></div>/**
  27. * @cfg {Number} growMin The minimum height to allow when <tt>{@link Ext.form.TextField#grow grow}=true</tt>
  28. * (defaults to <tt>60</tt>)
  29. */
  30. growMin : 60,
  31. <div id="cfg-Ext.form.TextArea-growMax"></div>/**
  32. * @cfg {Number} growMax The maximum height to allow when <tt>{@link Ext.form.TextField#grow grow}=true</tt>
  33. * (defaults to <tt>1000</tt>)
  34. */
  35. growMax: 1000,
  36. growAppend : '&#160;\n&#160;',
  37. enterIsSpecial : false,
  38. <div id="cfg-Ext.form.TextArea-preventScrollbars"></div>/**
  39. * @cfg {Boolean} preventScrollbars <tt>true</tt> to prevent scrollbars from appearing regardless of how much text is
  40. * in the field. This option is only relevant when {@link #grow} is <tt>true</tt>. Equivalent to setting overflow: hidden, defaults to
  41. * <tt>false</tt>.
  42. */
  43. preventScrollbars: false,
  44. <div id="cfg-Ext.form.TextArea-autoCreate"></div>/**
  45. * @cfg {String/Object} autoCreate <p>A {@link Ext.DomHelper DomHelper} element spec, or true for a default
  46. * element spec. Used to create the {@link Ext.Component#getEl Element} which will encapsulate this Component.
  47. * See <tt>{@link Ext.Component#autoEl autoEl}</tt> for details. Defaults to:</p>
  48. * <pre><code>{tag: "textarea", style: "width:100px;height:60px;", autocomplete: "off"}</code></pre>
  49. */
  50. // private
  51. onRender : function(ct, position){
  52. if(!this.el){
  53. this.defaultAutoCreate = {
  54. tag: "textarea",
  55. style:"width:100px;height:60px;",
  56. autocomplete: "off"
  57. };
  58. }
  59. Ext.form.TextArea.superclass.onRender.call(this, ct, position);
  60. if(this.grow){
  61. this.textSizeEl = Ext.DomHelper.append(document.body, {
  62. tag: "pre", cls: "x-form-grow-sizer"
  63. });
  64. if(this.preventScrollbars){
  65. this.el.setStyle("overflow", "hidden");
  66. }
  67. this.el.setHeight(this.growMin);
  68. }
  69. },
  70. onDestroy : function(){
  71. Ext.removeNode(this.textSizeEl);
  72. Ext.form.TextArea.superclass.onDestroy.call(this);
  73. },
  74. fireKey : function(e){
  75. if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){
  76. this.fireEvent("specialkey", this, e);
  77. }
  78. },
  79. // private
  80. doAutoSize : function(e){
  81. return !e.isNavKeyPress() || e.getKey() == e.ENTER;
  82. },
  83. // inherit docs
  84. filterValidation: function(e) {
  85. if(!e.isNavKeyPress() || (!this.enterIsSpecial && e.keyCode == e.ENTER)){
  86. this.validationTask.delay(this.validationDelay);
  87. }
  88. },
  89. <div id="method-Ext.form.TextArea-autoSize"></div>/**
  90. * Automatically grows the field to accomodate the height of the text up to the maximum field height allowed.
  91. * This only takes effect if grow = true, and fires the {@link #autosize} event if the height changes.
  92. */
  93. autoSize: function(){
  94. if(!this.grow || !this.textSizeEl){
  95. return;
  96. }
  97. var el = this.el,
  98. v = Ext.util.Format.htmlEncode(el.dom.value),
  99. ts = this.textSizeEl,
  100. h;
  101. Ext.fly(ts).setWidth(this.el.getWidth());
  102. if(v.length < 1){
  103. v = "&#160;&#160;";
  104. }else{
  105. v += this.growAppend;
  106. if(Ext.isIE){
  107. v = v.replace(/\n/g, '&#160;<br />');
  108. }
  109. }
  110. ts.innerHTML = v;
  111. h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin));
  112. if(h != this.lastHeight){
  113. this.lastHeight = h;
  114. this.el.setHeight(h);
  115. this.fireEvent("autosize", this, h);
  116. }
  117. }
  118. });
  119. Ext.reg('textarea', Ext.form.TextArea);</pre>
  120. </body>
  121. </html>