13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!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"><span id='Ext-layout-component-FieldSet'>/**
</span> * Component layout for Ext.form.FieldSet components
 * @private
 */
Ext.define('Ext.layout.component.FieldSet', {
    extend: 'Ext.layout.component.Body',
    alias: ['layout.fieldset'],
 
<span id='Ext-layout-component-FieldSet-property-type'>    type: 'fieldset',
</span>    
<span id='Ext-layout-component-FieldSet-property-defaultCollapsedWidth'>    defaultCollapsedWidth: 100,
</span>
<span id='Ext-layout-component-FieldSet-method-beforeLayoutCycle'>    beforeLayoutCycle: function (ownerContext) {
</span>        if (ownerContext.target.collapsed) {
            ownerContext.heightModel = this.sizeModels.shrinkWrap;
        }
    },
 
<span id='Ext-layout-component-FieldSet-method-beginLayoutCycle'>    beginLayoutCycle: function (ownerContext) {
</span>        var target = ownerContext.target,
            lastSize;
 
        this.callParent(arguments);
 
        // Each time we begin (2nd+ would be due to invalidate) we need to publish the
        // known contentHeight if we are collapsed:
        //
        if (target.collapsed) {
            ownerContext.setContentHeight(0);
            // if we're collapsed, ignore a minHeight because it's likely going to
            // be greater than the collapsed height
            ownerContext.restoreMinHeight = target.minHeight;
            delete target.minHeight;
 
            // If we are also shrinkWrap width, we must provide a contentWidth (since the
            // container layout is not going to run).
            //
            if (ownerContext.widthModel.shrinkWrap) {
                lastSize = target.lastComponentSize;
                ownerContext.setContentWidth((lastSize &amp;&amp; lastSize.contentWidth) || this.defaultCollapsedWidth);
            }
        }
    },
    
<span id='Ext-layout-component-FieldSet-method-finishedLayout'>    finishedLayout: function(ownerContext) {
</span>        var owner = this.owner,
            restore = ownerContext.restoreMinHeight;
             
        this.callParent(arguments);
        if (restore) {
            owner.minHeight = restore;
        }
    },
 
<span id='Ext-layout-component-FieldSet-method-calculateOwnerHeightFromContentHeight'>    calculateOwnerHeightFromContentHeight: function (ownerContext, contentHeight) {
</span>        var border = ownerContext.getBorderInfo(),
            legend = ownerContext.target.legend;
            
        // Height of fieldset is content height plus top border width (which is either the
        // legend height or top border width) plus bottom border width
        return ownerContext.getProp('contentHeight') +
               ownerContext.getPaddingInfo().height +
               // In IE8m and IEquirks the top padding is on the body el
               ((Ext.isIEQuirks || Ext.isIE8m) ?
                   ownerContext.bodyContext.getPaddingInfo().top : 0) +
               (legend ? legend.getHeight() : border.top) +
               border.bottom;
    },
 
<span id='Ext-layout-component-FieldSet-method-publishInnerHeight'>    publishInnerHeight: function (ownerContext, height) {
</span>        // Subtract the legend off here and pass it up to the body
        // We do this because we don't want to set an incorrect body height
        // and then setting it again with the correct value
        var legend = ownerContext.target.legend;
        if (legend) {
            height -= legend.getHeight();
        }
        this.callParent([ownerContext, height]);
    },
 
<span id='Ext-layout-component-FieldSet-method-getLayoutItems'>    getLayoutItems : function() {
</span>        var legend = this.owner.legend;
        return legend ? [legend] : [];
    }
});</pre>
</body>
</html>