yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
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
define([
    "./focus",
    "./_WidgetBase",
    "dojo/_base/declare", // declare
    "dojo/_base/lang" // lang.extend
], function(focus, _WidgetBase, declare, lang){
 
    // module:
    //      dijit/_FocusMixin
 
    // We don't know where _FocusMixin will occur in the inheritance chain, but we need the _onFocus()/_onBlur() below
    // to be last in the inheritance chain, so mixin to _WidgetBase.
    lang.extend(_WidgetBase, {
        // focused: [readonly] Boolean
        //      This widget or a widget it contains has focus, or is "active" because
        //      it was recently clicked.
        focused: false,
 
        onFocus: function(){
            // summary:
            //      Called when the widget becomes "active" because
            //      it or a widget inside of it either has focus, or has recently
            //      been clicked.
            // tags:
            //      callback
        },
 
        onBlur: function(){
            // summary:
            //      Called when the widget stops being "active" because
            //      focus moved to something outside of it, or the user
            //      clicked somewhere outside of it, or the widget was
            //      hidden.
            // tags:
            //      callback
        },
 
        _onFocus: function(){
            // summary:
            //      This is where widgets do processing for when they are active,
            //      such as changing CSS classes.  See onFocus() for more details.
            // tags:
            //      protected
            this.onFocus();
        },
 
        _onBlur: function(){
            // summary:
            //      This is where widgets do processing for when they stop being active,
            //      such as changing CSS classes.  See onBlur() for more details.
            // tags:
            //      protected
            this.onBlur();
        }
    });
 
    return declare("dijit._FocusMixin", null, {
        // summary:
        //      Mixin to widget to provide _onFocus() and _onBlur() methods that
        //      fire when a widget or its descendants get/lose focus
 
        // flag that I want _onFocus()/_onBlur() notifications from focus manager
        _focusManager: focus
    });
 
});