|
525
|
1 |
/* |
|
|
2 |
YUI 3.10.3 (build 2fb5187) |
|
|
3 |
Copyright 2013 Yahoo! Inc. All rights reserved. |
|
|
4 |
Licensed under the BSD License. |
|
|
5 |
http://yuilibrary.com/license/ |
|
|
6 |
*/ |
|
|
7 |
|
|
|
8 |
YUI.add('tree-labelable', function (Y, NAME) { |
|
|
9 |
|
|
|
10 |
/*jshint expr:true, onevar:false */ |
|
|
11 |
|
|
|
12 |
/** |
|
|
13 |
Extension for `Tree` that adds baked-in support for node labels like you might |
|
|
14 |
see in a treeview or menu. |
|
|
15 |
|
|
|
16 |
@module tree |
|
|
17 |
@submodule tree-labelable |
|
|
18 |
@main tree-labelable |
|
|
19 |
**/ |
|
|
20 |
|
|
|
21 |
/** |
|
|
22 |
Extension for `Tree` that adds baked-in support for node labels like you might |
|
|
23 |
see in a treeview or menu. |
|
|
24 |
|
|
|
25 |
@class Tree.Labelable |
|
|
26 |
@constructor |
|
|
27 |
@extensionfor Tree |
|
|
28 |
**/ |
|
|
29 |
|
|
|
30 |
function Labelable() {} |
|
|
31 |
|
|
|
32 |
Labelable.prototype = { |
|
|
33 |
initializer: function () { |
|
|
34 |
this.nodeExtensions = this.nodeExtensions.concat(Y.Tree.Node.Labelable); |
|
|
35 |
} |
|
|
36 |
}; |
|
|
37 |
|
|
|
38 |
Y.Tree.Labelable = Labelable; |
|
|
39 |
/** |
|
|
40 |
@module tree |
|
|
41 |
@submodule tree-labelable |
|
|
42 |
**/ |
|
|
43 |
|
|
|
44 |
/** |
|
|
45 |
`Tree.Node` extension that adds baked in support for labels like you might see |
|
|
46 |
in a treeview or menu. |
|
|
47 |
|
|
|
48 |
**Security note:** The label is stored in raw, unescaped form. If you choose to |
|
|
49 |
render the label as HTML, be sure to escape it first with `Y.Escape.html()` |
|
|
50 |
unless you actually intend to render raw HTML contained in the label. |
|
|
51 |
|
|
|
52 |
@class Tree.Node.Labelable |
|
|
53 |
@constructor |
|
|
54 |
@param {Tree} tree `Tree` instance with which this node should be associated. |
|
|
55 |
@param {Object} [config] Configuration hash. |
|
|
56 |
@param {String} [config.label=''] Label for this node. |
|
|
57 |
@extensionfor Tree.Node |
|
|
58 |
**/ |
|
|
59 |
|
|
|
60 |
function NodeLabelable(tree, config) { |
|
|
61 |
this._serializable = this._serializable.concat('label'); |
|
|
62 |
|
|
|
63 |
if ('label' in config) { |
|
|
64 |
this.label = config.label; |
|
|
65 |
} |
|
|
66 |
} |
|
|
67 |
|
|
|
68 |
NodeLabelable.prototype = { |
|
|
69 |
/** |
|
|
70 |
Label for this node. |
|
|
71 |
|
|
|
72 |
**Security note:** The label is stored in raw, unescaped form. If you choose |
|
|
73 |
to render the label as HTML, be sure to escape it first with |
|
|
74 |
`Y.Escape.html()` unless you actually intend to render raw HTML contained in |
|
|
75 |
the label. |
|
|
76 |
|
|
|
77 |
@property {String} label |
|
|
78 |
@default '' |
|
|
79 |
**/ |
|
|
80 |
label: '' |
|
|
81 |
}; |
|
|
82 |
|
|
|
83 |
Y.Tree.Node.Labelable = NodeLabelable; |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
}, '3.10.3', {"requires": ["tree"]}); |