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.

382 lines
20 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-layout-FormLayout'>/**
  19. </span> * @class Ext.layout.FormLayout
  20. * @extends Ext.layout.AnchorLayout
  21. * &lt;p&gt;This layout manager is specifically designed for rendering and managing child Components of
  22. * {@link Ext.form.FormPanel forms}. It is responsible for rendering the labels of
  23. * {@link Ext.form.Field Field}s.&lt;/p&gt;
  24. *
  25. * &lt;p&gt;This layout manager is used when a Container is configured with the &lt;tt&gt;layout:'form'&lt;/tt&gt;
  26. * {@link Ext.Container#layout layout} config option, and should generally not need to be created directly
  27. * via the new keyword. See &lt;tt&gt;&lt;b&gt;{@link Ext.Container#layout}&lt;/b&gt;&lt;/tt&gt; for additional details.&lt;/p&gt;
  28. *
  29. * &lt;p&gt;In an application, it will usually be preferrable to use a {@link Ext.form.FormPanel FormPanel}
  30. * (which is configured with FormLayout as its layout class by default) since it also provides built-in
  31. * functionality for {@link Ext.form.BasicForm#doAction loading, validating and submitting} the form.&lt;/p&gt;
  32. *
  33. * &lt;p&gt;A {@link Ext.Container Container} &lt;i&gt;using&lt;/i&gt; the FormLayout layout manager (e.g.
  34. * {@link Ext.form.FormPanel} or specifying &lt;tt&gt;layout:'form'&lt;/tt&gt;) can also accept the following
  35. * layout-specific config properties:&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  36. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.form.FormPanel#hideLabels hideLabels}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  37. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.form.FormPanel#labelAlign labelAlign}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  38. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.form.FormPanel#labelPad labelPad}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  39. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.form.FormPanel#labelSeparator labelSeparator}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  40. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.form.FormPanel#labelWidth labelWidth}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  41. * &lt;/ul&gt;&lt;/div&gt;&lt;/p&gt;
  42. *
  43. * &lt;p&gt;Any Component (including Fields) managed by FormLayout accepts the following as a config option:
  44. * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  45. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.Component#anchor anchor}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  46. * &lt;/ul&gt;&lt;/div&gt;&lt;/p&gt;
  47. *
  48. * &lt;p&gt;Any Component managed by FormLayout may be rendered as a form field (with an associated label) by
  49. * configuring it with a non-null &lt;b&gt;&lt;tt&gt;{@link Ext.Component#fieldLabel fieldLabel}&lt;/tt&gt;&lt;/b&gt;. Components configured
  50. * in this way may be configured with the following options which affect the way the FormLayout renders them:
  51. * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  52. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.Component#clearCls clearCls}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  53. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.Component#fieldLabel fieldLabel}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  54. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.Component#hideLabel hideLabel}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  55. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.Component#itemCls itemCls}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  56. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.Component#labelSeparator labelSeparator}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  57. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link Ext.Component#labelStyle labelStyle}&lt;/tt&gt;&lt;/b&gt;&lt;/li&gt;
  58. * &lt;/ul&gt;&lt;/div&gt;&lt;/p&gt;
  59. *
  60. * &lt;p&gt;Example usage:&lt;/p&gt;
  61. * &lt;pre&gt;&lt;code&gt;
  62. // Required if showing validation messages
  63. Ext.QuickTips.init();
  64. // While you can create a basic Panel with layout:'form', practically
  65. // you should usually use a FormPanel to also get its form functionality
  66. // since it already creates a FormLayout internally.
  67. var form = new Ext.form.FormPanel({
  68. title: 'Form Layout',
  69. bodyStyle: 'padding:15px',
  70. width: 350,
  71. defaultType: 'textfield',
  72. defaults: {
  73. // applied to each contained item
  74. width: 230,
  75. msgTarget: 'side'
  76. },
  77. items: [{
  78. fieldLabel: 'First Name',
  79. name: 'first',
  80. allowBlank: false,
  81. {@link Ext.Component#labelSeparator labelSeparator}: ':' // override labelSeparator layout config
  82. },{
  83. fieldLabel: 'Last Name',
  84. name: 'last'
  85. },{
  86. fieldLabel: 'Email',
  87. name: 'email',
  88. vtype:'email'
  89. }, {
  90. xtype: 'textarea',
  91. hideLabel: true, // override hideLabels layout config
  92. name: 'msg',
  93. anchor: '100% -53'
  94. }
  95. ],
  96. buttons: [
  97. {text: 'Save'},
  98. {text: 'Cancel'}
  99. ],
  100. layoutConfig: {
  101. {@link #labelSeparator}: '~' // superseded by assignment below
  102. },
  103. // config options applicable to container when layout='form':
  104. hideLabels: false,
  105. labelAlign: 'left', // or 'right' or 'top'
  106. {@link Ext.form.FormPanel#labelSeparator labelSeparator}: '&gt;&gt;', // takes precedence over layoutConfig value
  107. labelWidth: 65, // defaults to 100
  108. labelPad: 8 // defaults to 5, must specify labelWidth to be honored
  109. });
  110. &lt;/code&gt;&lt;/pre&gt;
  111. */
  112. Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, {
  113. <span id='Ext-layout-FormLayout-cfg-labelSeparator'> /**
  114. </span> * @cfg {String} labelSeparator
  115. * See {@link Ext.form.FormPanel}.{@link Ext.form.FormPanel#labelSeparator labelSeparator}. Configuration
  116. * of this property at the &lt;b&gt;container&lt;/b&gt; level takes precedence.
  117. */
  118. labelSeparator : ':',
  119. <span id='Ext-layout-FormLayout-property-labelStyle'> /**
  120. </span> * Read only. The CSS style specification string added to field labels in this layout if not
  121. * otherwise {@link Ext.Component#labelStyle specified by each contained field}.
  122. * @type String
  123. * @property labelStyle
  124. */
  125. <span id='Ext-layout-FormLayout-cfg-trackLabels'> /**
  126. </span> * @cfg {Boolean} trackLabels
  127. * True to show/hide the field label when the field is hidden. Defaults to &lt;tt&gt;true&lt;/tt&gt;.
  128. */
  129. trackLabels: true,
  130. <span id='Ext-layout-FormLayout-property-type'> type: 'form',
  131. </span>
  132. <span id='Ext-layout-FormLayout-method-onRemove'> onRemove: function(c){
  133. </span> Ext.layout.FormLayout.superclass.onRemove.call(this, c);
  134. if(this.trackLabels){
  135. c.un('show', this.onFieldShow, this);
  136. c.un('hide', this.onFieldHide, this);
  137. }
  138. // check for itemCt, since we may be removing a fieldset or something similar
  139. var el = c.getPositionEl(),
  140. ct = c.getItemCt &amp;&amp; c.getItemCt();
  141. if (c.rendered &amp;&amp; ct) {
  142. if (el &amp;&amp; el.dom) {
  143. el.insertAfter(ct);
  144. }
  145. Ext.destroy(ct);
  146. Ext.destroyMembers(c, 'label', 'itemCt');
  147. if (c.customItemCt) {
  148. Ext.destroyMembers(c, 'getItemCt', 'customItemCt');
  149. }
  150. }
  151. },
  152. <span id='Ext-layout-FormLayout-method-setContainer'> // private
  153. </span> setContainer : function(ct){
  154. Ext.layout.FormLayout.superclass.setContainer.call(this, ct);
  155. ct.labelAlign = ct.labelAlign || this.labelAlign;
  156. if (ct.labelAlign) {
  157. ct.addClass('x-form-label-' + ct.labelAlign);
  158. }
  159. if (ct.hideLabels || this.hideLabels) {
  160. Ext.apply(this, {
  161. labelStyle: 'display:none',
  162. elementStyle: 'padding-left:0;',
  163. labelAdjust: 0
  164. });
  165. } else {
  166. this.labelSeparator = Ext.isDefined(ct.labelSeparator) ? ct.labelSeparator : this.labelSeparator;
  167. ct.labelWidth = ct.labelWidth || this.labelWidth || 100;
  168. if(Ext.isNumber(ct.labelWidth)){
  169. var pad = ct.labelPad || this.labelPad;
  170. pad = Ext.isNumber(pad) ? pad : 5;
  171. Ext.apply(this, {
  172. labelAdjust: ct.labelWidth + pad,
  173. labelStyle: 'width:' + ct.labelWidth + 'px;',
  174. elementStyle: 'padding-left:' + (ct.labelWidth + pad) + 'px'
  175. });
  176. }
  177. if(ct.labelAlign == 'top'){
  178. Ext.apply(this, {
  179. labelStyle: 'width:auto;',
  180. labelAdjust: 0,
  181. elementStyle: 'padding-left:0;'
  182. });
  183. }
  184. }
  185. },
  186. <span id='Ext-layout-FormLayout-method-isHide'> // private
  187. </span> isHide: function(c){
  188. return c.hideLabel || this.container.hideLabels;
  189. },
  190. <span id='Ext-layout-FormLayout-method-onFieldShow'> onFieldShow: function(c){
  191. </span> c.getItemCt().removeClass('x-hide-' + c.hideMode);
  192. // Composite fields will need to layout after the container is made visible
  193. if (c.isComposite) {
  194. c.doLayout();
  195. }
  196. },
  197. <span id='Ext-layout-FormLayout-method-onFieldHide'> onFieldHide: function(c){
  198. </span> c.getItemCt().addClass('x-hide-' + c.hideMode);
  199. },
  200. <span id='Ext-layout-FormLayout-method-getLabelStyle'> //private
  201. </span> getLabelStyle: function(s){
  202. var ls = '', items = [this.labelStyle, s];
  203. for (var i = 0, len = items.length; i &lt; len; ++i){
  204. if (items[i]){
  205. ls += items[i];
  206. if (ls.substr(-1, 1) != ';'){
  207. ls += ';';
  208. }
  209. }
  210. }
  211. return ls;
  212. },
  213. <span id='Ext-layout-FormLayout-cfg-fieldTpl'> /**
  214. </span> * @cfg {Ext.Template} fieldTpl
  215. * A {@link Ext.Template#compile compile}d {@link Ext.Template} for rendering
  216. * the fully wrapped, labeled and styled form Field. Defaults to:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
  217. new Ext.Template(
  218. &amp;#39;&amp;lt;div class=&quot;x-form-item {itemCls}&quot; tabIndex=&quot;-1&quot;&gt;&amp;#39;,
  219. &amp;#39;&amp;lt;&amp;#108;abel for=&quot;{id}&quot; style=&quot;{labelStyle}&quot; class=&quot;x-form-item-&amp;#108;abel&quot;&gt;{&amp;#108;abel}{labelSeparator}&amp;lt;/&amp;#108;abel&gt;&amp;#39;,
  220. &amp;#39;&amp;lt;div class=&quot;x-form-element&quot; id=&quot;x-form-el-{id}&quot; style=&quot;{elementStyle}&quot;&gt;&amp;#39;,
  221. &amp;#39;&amp;lt;/div&gt;&amp;lt;div class=&quot;{clearCls}&quot;&gt;&amp;lt;/div&gt;&amp;#39;,
  222. '&amp;lt;/div&gt;'
  223. );
  224. &lt;/code&gt;&lt;/pre&gt;
  225. * &lt;p&gt;This may be specified to produce a different DOM structure when rendering form Fields.&lt;/p&gt;
  226. * &lt;p&gt;A description of the properties within the template follows:&lt;/p&gt;&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  227. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;itemCls&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The CSS class applied to the outermost div wrapper
  228. * that contains this field label and field element (the default class is &lt;tt&gt;'x-form-item'&lt;/tt&gt; and &lt;tt&gt;itemCls&lt;/tt&gt;
  229. * will be added to that). If supplied, &lt;tt&gt;itemCls&lt;/tt&gt; at the field level will override the default &lt;tt&gt;itemCls&lt;/tt&gt;
  230. * supplied at the container level.&lt;/div&gt;&lt;/li&gt;
  231. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;id&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The id of the Field&lt;/div&gt;&lt;/li&gt;
  232. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link #labelStyle}&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;
  233. * A CSS style specification string to add to the field label for this field (defaults to &lt;tt&gt;''&lt;/tt&gt; or the
  234. * {@link #labelStyle layout's value for &lt;tt&gt;labelStyle&lt;/tt&gt;}).&lt;/div&gt;&lt;/li&gt;
  235. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;label&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The text to display as the label for this
  236. * field (defaults to &lt;tt&gt;''&lt;/tt&gt;)&lt;/div&gt;&lt;/li&gt;
  237. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link #labelSeparator}&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The separator to display after
  238. * the text of the label for this field (defaults to a colon &lt;tt&gt;':'&lt;/tt&gt; or the
  239. * {@link #labelSeparator layout's value for labelSeparator}). To hide the separator use empty string ''.&lt;/div&gt;&lt;/li&gt;
  240. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;elementStyle&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The styles text for the input element's wrapper.&lt;/div&gt;&lt;/li&gt;
  241. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;clearCls&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The CSS class to apply to the special clearing div
  242. * rendered directly after each form field wrapper (defaults to &lt;tt&gt;'x-form-clear-left'&lt;/tt&gt;)&lt;/div&gt;&lt;/li&gt;
  243. * &lt;/ul&gt;&lt;/div&gt;
  244. * &lt;p&gt;Also see &lt;tt&gt;{@link #getTemplateArgs}&lt;/tt&gt;&lt;/p&gt;
  245. */
  246. <span id='Ext-layout-FormLayout-method-renderItem'> /**
  247. </span> * @private
  248. *
  249. */
  250. renderItem : function(c, position, target){
  251. if(c &amp;&amp; (c.isFormField || c.fieldLabel) &amp;&amp; c.inputType != 'hidden'){
  252. var args = this.getTemplateArgs(c);
  253. if(Ext.isNumber(position)){
  254. position = target.dom.childNodes[position] || null;
  255. }
  256. if(position){
  257. c.itemCt = this.fieldTpl.insertBefore(position, args, true);
  258. }else{
  259. c.itemCt = this.fieldTpl.append(target, args, true);
  260. }
  261. if(!c.getItemCt){
  262. // Non form fields don't have getItemCt, apply it here
  263. // This will get cleaned up in onRemove
  264. Ext.apply(c, {
  265. getItemCt: function(){
  266. return c.itemCt;
  267. },
  268. customItemCt: true
  269. });
  270. }
  271. c.label = c.getItemCt().child('label.x-form-item-label');
  272. if(!c.rendered){
  273. c.render('x-form-el-' + c.id);
  274. }else if(!this.isValidParent(c, target)){
  275. Ext.fly('x-form-el-' + c.id).appendChild(c.getPositionEl());
  276. }
  277. if(this.trackLabels){
  278. if(c.hidden){
  279. this.onFieldHide(c);
  280. }
  281. c.on({
  282. scope: this,
  283. show: this.onFieldShow,
  284. hide: this.onFieldHide
  285. });
  286. }
  287. this.configureItem(c);
  288. }else {
  289. Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
  290. }
  291. },
  292. <span id='Ext-layout-FormLayout-method-getTemplateArgs'> /**
  293. </span> * &lt;p&gt;Provides template arguments for rendering the fully wrapped, labeled and styled form Field.&lt;/p&gt;
  294. * &lt;p&gt;This method returns an object hash containing properties used by the layout's {@link #fieldTpl}
  295. * to create a correctly wrapped, labeled and styled form Field. This may be overriden to
  296. * create custom layouts. The properties which must be returned are:&lt;/p&gt;&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
  297. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;itemCls&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The CSS class applied to the outermost div wrapper
  298. * that contains this field label and field element (the default class is &lt;tt&gt;'x-form-item'&lt;/tt&gt; and &lt;tt&gt;itemCls&lt;/tt&gt;
  299. * will be added to that). If supplied, &lt;tt&gt;itemCls&lt;/tt&gt; at the field level will override the default &lt;tt&gt;itemCls&lt;/tt&gt;
  300. * supplied at the container level.&lt;/div&gt;&lt;/li&gt;
  301. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;id&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The id of the Field&lt;/div&gt;&lt;/li&gt;
  302. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link #labelStyle}&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;
  303. * A CSS style specification string to add to the field label for this field (defaults to &lt;tt&gt;''&lt;/tt&gt; or the
  304. * {@link #labelStyle layout's value for &lt;tt&gt;labelStyle&lt;/tt&gt;}).&lt;/div&gt;&lt;/li&gt;
  305. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;label&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The text to display as the label for this
  306. * field (defaults to the field's configured fieldLabel property)&lt;/div&gt;&lt;/li&gt;
  307. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;{@link #labelSeparator}&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The separator to display after
  308. * the text of the label for this field (defaults to a colon &lt;tt&gt;':'&lt;/tt&gt; or the
  309. * {@link #labelSeparator layout's value for labelSeparator}). To hide the separator use empty string ''.&lt;/div&gt;&lt;/li&gt;
  310. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;elementStyle&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The styles text for the input element's wrapper.&lt;/div&gt;&lt;/li&gt;
  311. * &lt;li&gt;&lt;b&gt;&lt;tt&gt;clearCls&lt;/tt&gt;&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The CSS class to apply to the special clearing div
  312. * rendered directly after each form field wrapper (defaults to &lt;tt&gt;'x-form-clear-left'&lt;/tt&gt;)&lt;/div&gt;&lt;/li&gt;
  313. * &lt;/ul&gt;&lt;/div&gt;
  314. * @param (Ext.form.Field} field The {@link Ext.form.Field Field} being rendered.
  315. * @return {Object} An object hash containing the properties required to render the Field.
  316. */
  317. getTemplateArgs: function(field) {
  318. var noLabelSep = !field.fieldLabel || field.hideLabel,
  319. itemCls = (field.itemCls || this.container.itemCls || '') + (field.hideLabel ? ' x-hide-label' : '');
  320. // IE9 quirks needs an extra, identifying class on wrappers of TextFields
  321. if (Ext.isIE9 &amp;&amp; Ext.isIEQuirks &amp;&amp; field instanceof Ext.form.TextField) {
  322. itemCls += ' x-input-wrapper';
  323. }
  324. return {
  325. id : field.id,
  326. label : field.fieldLabel,
  327. itemCls : itemCls,
  328. clearCls : field.clearCls || 'x-form-clear-left',
  329. labelStyle : this.getLabelStyle(field.labelStyle),
  330. elementStyle : this.elementStyle || '',
  331. labelSeparator: noLabelSep ? '' : (Ext.isDefined(field.labelSeparator) ? field.labelSeparator : this.labelSeparator)
  332. };
  333. },
  334. <span id='Ext-layout-FormLayout-method-adjustWidthAnchor'> // private
  335. </span> adjustWidthAnchor: function(value, c){
  336. if(c.label &amp;&amp; !this.isHide(c) &amp;&amp; (this.container.labelAlign != 'top')){
  337. var adjust = Ext.isIE6 || Ext.isIEQuirks;
  338. return value - this.labelAdjust + (adjust ? -3 : 0);
  339. }
  340. return value;
  341. },
  342. <span id='Ext-layout-FormLayout-method-adjustHeightAnchor'> adjustHeightAnchor : function(value, c){
  343. </span> if(c.label &amp;&amp; !this.isHide(c) &amp;&amp; (this.container.labelAlign == 'top')){
  344. return value - c.label.getHeight();
  345. }
  346. return value;
  347. },
  348. <span id='Ext-layout-FormLayout-method-isValidParent'> // private
  349. </span> isValidParent : function(c, target){
  350. return target &amp;&amp; this.container.getEl().contains(c.getPositionEl());
  351. }
  352. <span id='Ext-layout-FormLayout-property-activeItem'> /**
  353. </span> * @property activeItem
  354. * @hide
  355. */
  356. });
  357. Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout;
  358. </pre>
  359. </body>
  360. </html>