]> git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/src/layout/component/field/FieldContainer.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / src / layout / component / field / FieldContainer.js
1 /**
2 * @private
3 */
4 Ext.define('Ext.layout.component.field.FieldContainer', {
5
6 /* Begin Definitions */
7
8 extend: 'Ext.layout.component.Auto',
9
10 alias: 'layout.fieldcontainer',
11
12 /* End Definitions */
13
14 type: 'fieldcontainer',
15
16 waitForOuterHeightInDom: true,
17 waitForOuterWidthInDom: true,
18
19 beginLayout: function(ownerContext) {
20 var containerEl = this.owner.containerEl;
21
22 this.callParent(arguments);
23
24 // Tell Component.measureAutoDimensions to measure the DOM when containerChildrenSizeDone is true
25 ownerContext.hasRawContent = true;
26 containerEl.setStyle('width', '');
27 containerEl.setStyle('height', '');
28 ownerContext.containerElContext = ownerContext.getEl('containerEl');
29 },
30
31 measureContentHeight: function (ownerContext) {
32 // since we are measuring the outer el, we have to wait for whatever is in our
33 // container to be flushed to the DOM... especially for things like box layouts
34 // that size the innerCt since that is all that will contribute to our size!
35 return ownerContext.hasDomProp('containerLayoutDone') ? this.callParent(arguments) : NaN;
36 },
37
38 measureContentWidth: function (ownerContext) {
39 // see measureContentHeight
40 return ownerContext.hasDomProp('containerLayoutDone') ? this.callParent(arguments) : NaN;
41 },
42
43 publishInnerHeight: function (ownerContext, height) {
44 var owner = this.owner;
45
46 if (owner.labelAlign === 'top' && owner.hasVisibleLabel()) {
47 height -= owner.labelEl.getHeight();
48 }
49
50 if (owner.msgTarget === 'under' && owner.hasActiveError()) {
51 height -= owner.errorWrapEl.getHeight();
52 }
53
54 height -= owner.bodyEl.getPadding('tb');
55
56 ownerContext.containerElContext.setHeight(height);
57 },
58
59 publishInnerWidth: function (ownerContext, width) {
60 var owner = this.owner;
61
62 if (owner.labelAlign !== 'top' && owner.hasVisibleLabel()) {
63 width -= (owner.labelWidth + (owner.labelPad || 0));
64 }
65
66 if (owner.msgTarget === 'side' && owner.hasActiveError()) {
67 width -= owner.errorWrapEl.getWidth();
68 }
69
70 width -= owner.bodyEl.getPadding('lr');
71
72 ownerContext.containerElContext.setWidth(width);
73 }
74
75 });