|
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('attribute-complex', function (Y, NAME) { |
|
|
9 |
|
|
|
10 |
/** |
|
|
11 |
* Adds support for attribute providers to handle complex attributes in the constructor |
|
|
12 |
* |
|
|
13 |
* @module attribute |
|
|
14 |
* @submodule attribute-complex |
|
|
15 |
* @for Attribute |
|
|
16 |
* @deprecated AttributeComplex's overrides are now part of AttributeCore. |
|
|
17 |
*/ |
|
|
18 |
|
|
|
19 |
var Attribute = Y.Attribute; |
|
|
20 |
|
|
|
21 |
Attribute.Complex = function() {}; |
|
|
22 |
Attribute.Complex.prototype = { |
|
|
23 |
|
|
|
24 |
/** |
|
|
25 |
* Utility method to split out simple attribute name/value pairs ("x") |
|
|
26 |
* from complex attribute name/value pairs ("x.y.z"), so that complex |
|
|
27 |
* attributes can be keyed by the top level attribute name. |
|
|
28 |
* |
|
|
29 |
* @method _normAttrVals |
|
|
30 |
* @param {Object} valueHash An object with attribute name/value pairs |
|
|
31 |
* |
|
|
32 |
* @return {Object} An object literal with 2 properties - "simple" and "complex", |
|
|
33 |
* containing simple and complex attribute values respectively keyed |
|
|
34 |
* by the top level attribute name, or null, if valueHash is falsey. |
|
|
35 |
* |
|
|
36 |
* @private |
|
|
37 |
*/ |
|
|
38 |
_normAttrVals : Attribute.prototype._normAttrVals, |
|
|
39 |
|
|
|
40 |
/** |
|
|
41 |
* Returns the initial value of the given attribute from |
|
|
42 |
* either the default configuration provided, or the |
|
|
43 |
* over-ridden value if it exists in the set of initValues |
|
|
44 |
* provided and the attribute is not read-only. |
|
|
45 |
* |
|
|
46 |
* @param {String} attr The name of the attribute |
|
|
47 |
* @param {Object} cfg The attribute configuration object |
|
|
48 |
* @param {Object} initValues The object with simple and complex attribute name/value pairs returned from _normAttrVals |
|
|
49 |
* |
|
|
50 |
* @return {Any} The initial value of the attribute. |
|
|
51 |
* |
|
|
52 |
* @method _getAttrInitVal |
|
|
53 |
* @private |
|
|
54 |
*/ |
|
|
55 |
_getAttrInitVal : Attribute.prototype._getAttrInitVal |
|
|
56 |
|
|
|
57 |
}; |
|
|
58 |
|
|
|
59 |
// Consistency with the rest of the Attribute addons for now. |
|
|
60 |
Y.AttributeComplex = Attribute.Complex; |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
}, '3.10.3', {"requires": ["attribute-base"]}); |