liuyg
2021-07-02 25ce610f6ecca7325e7a743dc032c4a76559c63d
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
define(['dojo/_base/declare',
  'dojo/_base/lang',
  'dojo/dom-class',
  'dojo/dom-attr',
  'dojo/_base/fx',
  './BaseIconItem'
], function(declare, lang, domClass, domAttr, baseFx, BaseIconItem){
  var ANIMATION_DURATION = 500, ICON_IMG_SIZE = 20;
  /**
   * @exports themes/LaunchpadTheme/widgets/AnchorBarController/DockableItem
   */
  var clazz = declare([BaseIconItem], {
    /**
     * The visibility of widget icon in controller
     * @type {Boolean}
     */
    visible: true,
 
    postCreate: function(){
      this.inherited(arguments);
 
      domClass.add(this.iconItemNode, 'dockable');
      domAttr.set(this.domNode, 'settingid', this.config.id);
    },
 
    /**
     * AnimateProperty of hiding the iconItem
     * @return {object} dojo._base.fx.animateProperty
     */
    hideAnim: function(){
      var nodeStyle = this.domNode.style,
          animArray = [],
          prop = {};
 
      if(window.isRTL){
        prop['margin-right'] = 0;
      }else{
        prop['margin-left'] = 0;
      }
      domClass.remove(this.iconItemStatus, 'selected');
 
      animArray.push(baseFx.animateProperty({
        node: this.domNode,
        duration: ANIMATION_DURATION,
        properties: prop,
        onEnd: lang.hitch(this, function(){
          nodeStyle.display = 'none';
          this.visible = false;
        })
      }));
 
      animArray.push(baseFx.animateProperty({
        node: this.iconItemNode,
        duration: ANIMATION_DURATION,
        properties: {
          width: 1 // 0 causes IE to display the whole panel
        }
      }));
 
      animArray.push(baseFx.animateProperty({
        node: this.imgNode,
        duration: ANIMATION_DURATION,
        properties: {
          width: 1 // 0 causes IE to display the whole panel
        }
      }));
 
      return animArray; // dojo/_base/fx.Animation
    },
 
    /**
     * AnimateProperty of showing the iconItem. Learn from dojo.fx.WipeIn
     * @return {[type]} [description]
     */
    showAnim: function(marginValue){
      var nodeStyle = this.domNode.style,
          iconNodeStyle = this.iconItemNode.style,
          imgStyle = this.imgNode.style,
          animArray = [],
          iconNodeSize = this.size,
          prop = {},
          transition;
 
      transition = {
        start: function(){
          nodeStyle.display = '';
          return 0;
        },
        end: marginValue
      };
 
      if(window.isRTL){
        prop['margin-right'] = transition;
      }else{
        prop['margin-left'] = transition;
      }
 
      animArray.push(baseFx.animateProperty({
        node: this.domNode,
        duration: ANIMATION_DURATION,
        properties: prop,
        onEnd: lang.hitch(this, function(){
          if(this.isOpen){
            domClass.add(this.iconItemStatus, 'selected');
          }
          this.visible = true;
        })
      }));
 
      animArray.push(baseFx.animateProperty({
        node: this.iconItemNode,
        duration: ANIMATION_DURATION,
        properties: {
          width: {
            start: function(){
              iconNodeStyle.width = '1px';
              return 1;
            },
            end: iconNodeSize
          }
        }
      }));
 
      animArray.push(baseFx.animateProperty({
        node: this.imgNode,
        duration: ANIMATION_DURATION,
        properties: {
          width: {
            start: function(){
              imgStyle.width = '1px';
              return 1;
            },
            end: ICON_IMG_SIZE
          }
        }
      }));
 
      return animArray; // dojo/_base/fx.Animation
    }
  });
  return clazz;
});