@fluid-experimental/property-properties 1.2.7 → 2.0.0-dev.1.3.0.96595
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containerSerializer.d.ts +9 -9
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +13 -13
- package/dist/containerSerializer.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts +49 -37
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +105 -97
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts +44 -47
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +159 -168
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts +66 -80
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +68 -107
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +7 -8
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +33 -39
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts +13 -13
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +27 -31
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +5 -6
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts +9 -12
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +23 -33
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts +9 -9
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +22 -28
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js +3 -3
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts +16 -16
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +70 -73
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts +3 -3
- package/dist/properties/namedNodeProperty.js +3 -3
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts +3 -3
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +4 -9
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +6 -6
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts +11 -11
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +55 -59
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts +7 -7
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +41 -41
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts +8 -8
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +32 -39
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts +6 -4
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +51 -52
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts +8 -9
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +69 -84
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts +2 -2
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +31 -35
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +16 -18
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts +9 -13
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +19 -31
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +178 -179
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts +28 -28
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +34 -45
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts +10 -9
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +13 -13
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts +2 -2
- package/dist/propertyUtils.js +2 -2
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +1 -2
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +1 -2
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +1 -3
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +1 -2
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +1 -2
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +1 -2
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js +1 -2
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +1 -3
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +1 -2
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +1 -2
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +0 -1
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +1 -3
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +1 -3
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +1 -3
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +7 -6
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +1 -3
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +1 -3
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +1 -3
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +2 -3
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +2 -3
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +1 -3
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +0 -1
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +2 -3
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +1 -5
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/utils.spec.js +1 -5
- package/dist/test/utils.spec.js.map +1 -1
- package/lib/containerSerializer.d.ts +9 -9
- package/lib/containerSerializer.d.ts.map +1 -1
- package/lib/containerSerializer.js +11 -11
- package/lib/containerSerializer.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.d.ts +49 -37
- package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +105 -97
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.d.ts +44 -47
- package/lib/properties/arrayProperty.d.ts.map +1 -1
- package/lib/properties/arrayProperty.js +157 -166
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.d.ts +66 -80
- package/lib/properties/baseProperty.d.ts.map +1 -1
- package/lib/properties/baseProperty.js +64 -103
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +7 -8
- package/lib/properties/containerProperty.d.ts.map +1 -1
- package/lib/properties/containerProperty.js +33 -39
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.d.ts +13 -13
- package/lib/properties/enumArrayProperty.d.ts.map +1 -1
- package/lib/properties/enumArrayProperty.js +27 -31
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.d.ts +1 -1
- package/lib/properties/enumProperty.d.ts.map +1 -1
- package/lib/properties/enumProperty.js +5 -6
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts +9 -12
- package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +23 -33
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts +9 -9
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +20 -26
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js +3 -3
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts +16 -16
- package/lib/properties/mapProperty.d.ts.map +1 -1
- package/lib/properties/mapProperty.js +70 -73
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.d.ts +3 -3
- package/lib/properties/namedNodeProperty.js +3 -3
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.d.ts +3 -3
- package/lib/properties/namedProperty.d.ts.map +1 -1
- package/lib/properties/namedProperty.js +4 -9
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +6 -6
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.d.ts +11 -11
- package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
- package/lib/properties/referenceArrayProperty.js +55 -59
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.d.ts +7 -7
- package/lib/properties/referenceMapProperty.d.ts.map +1 -1
- package/lib/properties/referenceMapProperty.js +41 -41
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.d.ts +8 -8
- package/lib/properties/referenceProperty.d.ts.map +1 -1
- package/lib/properties/referenceProperty.js +32 -39
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.d.ts +6 -4
- package/lib/properties/setProperty.d.ts.map +1 -1
- package/lib/properties/setProperty.js +51 -52
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.d.ts +8 -9
- package/lib/properties/stringProperty.d.ts.map +1 -1
- package/lib/properties/stringProperty.js +69 -84
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/valueArrayProperty.d.ts +2 -2
- package/lib/properties/valueArrayProperty.d.ts.map +1 -1
- package/lib/properties/valueArrayProperty.js +29 -33
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.d.ts.map +1 -1
- package/lib/properties/valueMapProperty.js +16 -18
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts +9 -13
- package/lib/properties/valueProperty.d.ts.map +1 -1
- package/lib/properties/valueProperty.js +19 -31
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.d.ts.map +1 -1
- package/lib/propertyFactory.js +178 -179
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.d.ts +28 -28
- package/lib/propertyTemplate.d.ts.map +1 -1
- package/lib/propertyTemplate.js +34 -45
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.d.ts +10 -9
- package/lib/propertyTemplateWrapper.d.ts.map +1 -1
- package/lib/propertyTemplateWrapper.js +13 -13
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.d.ts +2 -2
- package/lib/propertyUtils.js +2 -2
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Serialize the input document.
|
|
3
|
-
* @param {Array<BaseProperty>} in_psets
|
|
4
|
-
* @param {bool} in_dirtyOnly
|
|
3
|
+
* @param {Array<BaseProperty>} in_psets - Property set
|
|
4
|
+
* @param {bool} in_dirtyOnly - Serialize dirty properties only
|
|
5
5
|
* @return {{}} JSON data of the document
|
|
6
6
|
* @alias property-properties.serialize
|
|
7
7
|
*/
|
|
8
8
|
export function serialize(in_psets: Array<BaseProperty>, in_dirtyOnly: bool): {};
|
|
9
9
|
/**
|
|
10
10
|
* Deserialize the input document
|
|
11
|
-
* @param {{}} in_data
|
|
12
|
-
* @param {string|undefined} in_scope The scope to construct the properties from
|
|
13
|
-
* @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions]
|
|
14
|
-
*
|
|
11
|
+
* @param {{}} in_data - The input JSON document data
|
|
12
|
+
* @param {string|undefined} in_scope - The scope to construct the properties from
|
|
13
|
+
* @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions] - The options to selectively
|
|
14
|
+
* create only a subset of a property. Creates all properties if undefined.
|
|
15
15
|
* @return {{}} an object of guid : pset
|
|
16
16
|
* @alias property-properties.deserialize
|
|
17
17
|
*/
|
|
18
18
|
export function deserialize(in_data: {}, in_scope: string | undefined, in_filteringOptions: any): {};
|
|
19
19
|
/**
|
|
20
20
|
* Deserialize the input document assuming it contains elements of a non-primitive array.
|
|
21
|
-
* @param {array<object>} in_data
|
|
22
|
-
* @param {string|undefined} in_scope The scope to construct the properties from
|
|
23
|
-
* @return {array<BaseProperty>}
|
|
21
|
+
* @param {array<object>} in_data - The input JSON document data
|
|
22
|
+
* @param {string|undefined} in_scope - The scope to construct the properties from
|
|
23
|
+
* @return {array<BaseProperty>} An array of psets
|
|
24
24
|
* @alias property-properties.deserializeNonPrimitiveArrayElements
|
|
25
25
|
*/
|
|
26
26
|
export function deserializeNonPrimitiveArrayElements(in_data: array<any>, in_scope: string | undefined): array<BaseProperty>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerSerializer.d.ts","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"containerSerializer.d.ts","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":"AA0DA;;;;;;GAMG;AACH,oCALW,mBAAmB,uBAElB,EAAE,CAmBb;AAED;;;;;;;;GAQG;AACH,qCAPW,EAAE,YACF,MAAM,GAAC,SAAS,6BAGf,EAAE,CAsEb;AACD;;;;;;GAMG;AACH,oFAJW,MAAM,GAAC,SAAS,uBAiC1B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeNonPrimitiveArrayElements = exports.deserialize = exports.serialize = void 0;
|
|
4
2
|
/*!
|
|
5
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
4
|
* Licensed under the MIT License.
|
|
7
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.deserializeNonPrimitiveArrayElements = exports.deserialize = exports.serialize = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* @namespace property-properties
|
|
10
10
|
*/
|
|
@@ -19,8 +19,8 @@ var MSG = {
|
|
|
19
19
|
*/
|
|
20
20
|
class ScopeProperty extends AbstractStaticCollectionProperty {
|
|
21
21
|
/**
|
|
22
|
-
* @param {object} in_params BaseProperty parameters
|
|
23
|
-
* @param {string} in_params.scope The scope to keep track of
|
|
22
|
+
* @param {object} in_params - BaseProperty parameters
|
|
23
|
+
* @param {string} in_params.scope - The scope to keep track of
|
|
24
24
|
* @constructor
|
|
25
25
|
*/
|
|
26
26
|
constructor(in_params) {
|
|
@@ -55,8 +55,8 @@ class ScopeProperty extends AbstractStaticCollectionProperty {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Serialize the input document.
|
|
58
|
-
* @param {Array<BaseProperty>} in_psets
|
|
59
|
-
* @param {bool} in_dirtyOnly
|
|
58
|
+
* @param {Array<BaseProperty>} in_psets - Property set
|
|
59
|
+
* @param {bool} in_dirtyOnly - Serialize dirty properties only
|
|
60
60
|
* @return {{}} JSON data of the document
|
|
61
61
|
* @alias property-properties.serialize
|
|
62
62
|
*/
|
|
@@ -77,10 +77,10 @@ function serialize(in_psets, in_dirtyOnly) {
|
|
|
77
77
|
exports.serialize = serialize;
|
|
78
78
|
/**
|
|
79
79
|
* Deserialize the input document
|
|
80
|
-
* @param {{}} in_data
|
|
81
|
-
* @param {string|undefined} in_scope The scope to construct the properties from
|
|
82
|
-
* @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions]
|
|
83
|
-
*
|
|
80
|
+
* @param {{}} in_data - The input JSON document data
|
|
81
|
+
* @param {string|undefined} in_scope - The scope to construct the properties from
|
|
82
|
+
* @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions] - The options to selectively
|
|
83
|
+
* create only a subset of a property. Creates all properties if undefined.
|
|
84
84
|
* @return {{}} an object of guid : pset
|
|
85
85
|
* @alias property-properties.deserialize
|
|
86
86
|
*/
|
|
@@ -144,9 +144,9 @@ function deserialize(in_data, in_scope, in_filteringOptions) {
|
|
|
144
144
|
exports.deserialize = deserialize;
|
|
145
145
|
/**
|
|
146
146
|
* Deserialize the input document assuming it contains elements of a non-primitive array.
|
|
147
|
-
* @param {array<object>} in_data
|
|
148
|
-
* @param {string|undefined} in_scope The scope to construct the properties from
|
|
149
|
-
* @return {array<BaseProperty>}
|
|
147
|
+
* @param {array<object>} in_data - The input JSON document data
|
|
148
|
+
* @param {string|undefined} in_scope - The scope to construct the properties from
|
|
149
|
+
* @return {array<BaseProperty>} An array of psets
|
|
150
150
|
* @alias property-properties.deserializeNonPrimitiveArrayElements
|
|
151
151
|
*/
|
|
152
152
|
function deserializeNonPrimitiveArrayElements(in_data, in_scope) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerSerializer.js","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACzE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AACxF,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,+CAA+C,CAAC,CAAC;AAEtG,IAAI,GAAG,GAAG;IACN,sBAAsB,EAAE,0CAA0C;CACrE,CAAC;AAEF;;GAEG;AACH,MAAM,aAAc,SAAQ,gCAAgC;IACxD;;;;OAIG;IACH,YAAY,SAAS;QACjB,qGAAqG;QACrG,6CAA6C;QAC7C,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,SAAS;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,eAAe,C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AE,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAErD,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC;QAEjC,kFAAkF;QAClF,iFAAiF;QACjF,IAAI,aAAa,GAAG,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE3D,aAAa,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QAE9C,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAElE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE1B,2CAA2C;QAC3C,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;KACnD;IAED,OAAO,yBAAyB,CAAC;AACrC,CAAC;AA7BD,oFA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @namespace property-properties\n */\nconst { PathHelper } = require('@fluid-experimental/property-changeset');\nconst { LazyLoadedProperties: Property } = require('./properties/lazyLoadedProperties');\nconst { AbstractStaticCollectionProperty } = require('./properties/abstractStaticCollectionProperty');\n\nvar MSG = {\n NOTHING_TO_DESERIALIZE: 'Repository deserialize(), no input given',\n};\n\n/**\n * Dummy property used to return the scope to the underlying properties\n */\nclass ScopeProperty extends AbstractStaticCollectionProperty {\n /**\n * @param {object} in_params BaseProperty parameters\n * @param {string} in_params.scope The scope to keep track of\n * @constructor\n */\n constructor(in_params) {\n // HACK: Normally, we would inherit from NodeProperty however, NodeProperty seems to not be available\n // at this point. There may be a bug with MR.\n super(in_params);\n this._scope = in_params.scope;\n }\n\n /**\n * @override\n */\n _getScope() {\n return this._scope;\n }\n\n /**\n * Remove a child property\n * This is an internal function, called internally by NodeProperty. Removing children dynamically by the user is\n * only allowed in the NodeProperty.\n *\n * @param {String} in_id - the id of the property to remove\n * @protected\n */\n _remove(in_id) {\n if (this._staticChildren[in_id] !== undefined) {\n this._staticChildren[in_id]._setParent(undefined);\n delete this._staticChildren[in_id];\n } else {\n throw new Error(MSG.REMOVING_NON_EXISTING_ID + in_id);\n }\n }\n}\n\n/**\n * Serialize the input document.\n * @param {Array<BaseProperty>} in_psets property set\n * @param {bool} in_dirtyOnly serialize dirty properties only\n * @return {{}} JSON data of the document\n * @alias property-properties.serialize\n */\nexport function serialize(in_psets, in_dirtyOnly) {\n in_dirtyOnly = in_dirtyOnly || false;\n\n var documentData = {};\n var rootTypeid;\n\n var keys = Object.keys(in_psets);\n for (var i = 0; i < keys.length; i++) {\n rootTypeid = in_psets[keys[i]].getTypeid();\n if (!documentData[rootTypeid]) {\n documentData[rootTypeid] = {};\n }\n documentData[rootTypeid][keys[i]] = in_psets[keys[i]].serialize(in_dirtyOnly);\n }\n\n return documentData;\n}\n\n/**\n * Deserialize the input document\n * @param {{}} in_data the input JSON document data\n * @param {string|undefined} in_scope The scope to construct the properties from\n * @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions]\n * The options to selectively create only a subset of a property. Creates all properties if undefined.\n * @return {{}} an object of guid : pset\n * @alias property-properties.deserialize\n */\nexport function deserialize(in_data, in_scope, in_filteringOptions) {\n if (!in_data) {\n console.warn(MSG.NOTHING_TO_DESERIALIZE);\n return {};\n }\n\n // From the given filtering options, keep only what is relevant for this property.\n let baseFilteringOptions;\n if (in_filteringOptions) {\n let pathCoverage = PathHelper.getPathCoverage(in_filteringOptions.basePath, in_filteringOptions.paths);\n switch (pathCoverage.coverageExtent) {\n case PathHelper.CoverageExtent.FULLY_COVERED:\n // No need for filtering options anymore, keep them undefined.\n break;\n case PathHelper.CoverageExtent.PARTLY_COVERED:\n baseFilteringOptions = {\n basePath: in_filteringOptions.basePath,\n paths: pathCoverage.pathList,\n };\n break;\n case PathHelper.CoverageExtent.UNCOVERED:\n // No need to create anything, it is outside the paths.\n return {};\n default:\n break;\n }\n }\n\n var deserializedProperties = {};\n var typeid, entity, classed;\n\n var dataKeys = Object.keys(in_data);\n for (var iData = 0; iData < dataKeys.length; iData++) {\n typeid = dataKeys[iData];\n classed = in_data[typeid];\n var classKeys = Object.keys(classed);\n for (var iClass = 0; iClass < classKeys.length; iClass++) {\n // reconstruct entity\n let filteringOptions = baseFilteringOptions && {\n basePath: PathHelper.getChildAbsolutePathCanonical(baseFilteringOptions.basePath, classKeys[iClass]),\n paths: baseFilteringOptions.paths,\n };\n // TODO: In theory this could throw when the entity can not be created because it is not included\n // in the paths. Make sure to handle this case when we'll add that validation.\n entity = Property.PropertyFactory._createProperty(typeid, null, undefined, in_scope, filteringOptions);\n\n // Store the id prior to calling entity.deserialize() since it is subject to change afterwards\n var id = entity.getId();\n\n // Create a scope property which captures the scope that was passed in as arguments\n // so that it can be picked up downstream by the respective deserialize functions\n var scopeProperty = new ScopeProperty({ scope: in_scope });\n\n scopeProperty._append(entity, false);\n\n entity.deserialize(classed[classKeys[iClass]], filteringOptions, false);\n\n scopeProperty._remove(id);\n\n entity._id = classKeys[iClass];\n\n // keep track of the reconstructed entities\n deserializedProperties[classKeys[iClass]] = entity;\n }\n }\n\n return deserializedProperties;\n}\n/**\n * Deserialize the input document assuming it contains elements of a non-primitive array.\n * @param {array<object>} in_data the input JSON document data\n * @param {string|undefined} in_scope The scope to construct the properties from\n * @return {array<BaseProperty>} an array of psets\n * @alias property-properties.deserializeNonPrimitiveArrayElements\n */\nexport function deserializeNonPrimitiveArrayElements(in_data, in_scope) {\n if (!in_data) {\n console.warn(MSG.NOTHING_TO_DESERIALIZE);\n return [];\n }\n\n var insertedPropertyInstances = [];\n for (var i = 0; i < in_data.length; ++i) {\n // reconstruct entity\n var createdProperty = Property.PropertyFactory._createProperty(\n in_data[i]['typeid'], null, undefined, in_scope);\n\n var id = createdProperty.getId();\n\n // Create a scope property which captures the scope that was passed in as argument\n // so that it can be picked up downstream by the respective deserialize functions\n var scopeProperty = new ScopeProperty({ scope: in_scope });\n\n scopeProperty._append(createdProperty, false);\n\n createdProperty._deserialize(in_data[i], false, undefined, false);\n\n scopeProperty._remove(id);\n\n // keep track of the reconstructed entities\n insertedPropertyInstances.push(createdProperty);\n }\n\n return insertedPropertyInstances;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"containerSerializer.js","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AAEH,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACzE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AACxF,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,+CAA+C,CAAC,CAAC;AAEtG,IAAI,GAAG,GAAG;IACN,sBAAsB,EAAE,0CAA0C;CACrE,CAAC;AAEF;;GAEG;AACH,MAAM,aAAc,SAAQ,gCAAgC;IACxD;;;;OAIG;IACH,YAAY,SAAS;QACjB,qGAAqG;QACrG,6CAA6C;QAC7C,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,SAAS;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE;YAC3C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;SACtC;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,wBAAwB,GAAG,KAAK,CAAC,CAAC;SACzD;IACL,CAAC;CACJ;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,QAAQ,EAAE,Y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,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAElE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE1B,2CAA2C;QAC3C,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;KACnD;IAED,OAAO,yBAAyB,CAAC;AACrC,CAAC;AA7BD,oFA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @namespace property-properties\n */\n\nconst { PathHelper } = require('@fluid-experimental/property-changeset');\nconst { LazyLoadedProperties: Property } = require('./properties/lazyLoadedProperties');\nconst { AbstractStaticCollectionProperty } = require('./properties/abstractStaticCollectionProperty');\n\nvar MSG = {\n NOTHING_TO_DESERIALIZE: 'Repository deserialize(), no input given',\n};\n\n/**\n * Dummy property used to return the scope to the underlying properties\n */\nclass ScopeProperty extends AbstractStaticCollectionProperty {\n /**\n * @param {object} in_params - BaseProperty parameters\n * @param {string} in_params.scope - The scope to keep track of\n * @constructor\n */\n constructor(in_params) {\n // HACK: Normally, we would inherit from NodeProperty however, NodeProperty seems to not be available\n // at this point. There may be a bug with MR.\n super(in_params);\n this._scope = in_params.scope;\n }\n\n /**\n * @override\n */\n _getScope() {\n return this._scope;\n }\n\n /**\n * Remove a child property\n * This is an internal function, called internally by NodeProperty. Removing children dynamically by the user is\n * only allowed in the NodeProperty.\n *\n * @param {String} in_id - the id of the property to remove\n * @protected\n */\n _remove(in_id) {\n if (this._staticChildren[in_id] !== undefined) {\n this._staticChildren[in_id]._setParent(undefined);\n delete this._staticChildren[in_id];\n } else {\n throw new Error(MSG.REMOVING_NON_EXISTING_ID + in_id);\n }\n }\n}\n\n/**\n * Serialize the input document.\n * @param {Array<BaseProperty>} in_psets - Property set\n * @param {bool} in_dirtyOnly - Serialize dirty properties only\n * @return {{}} JSON data of the document\n * @alias property-properties.serialize\n */\nexport function serialize(in_psets, in_dirtyOnly) {\n in_dirtyOnly = in_dirtyOnly || false;\n\n var documentData = {};\n var rootTypeid;\n\n var keys = Object.keys(in_psets);\n for (var i = 0; i < keys.length; i++) {\n rootTypeid = in_psets[keys[i]].getTypeid();\n if (!documentData[rootTypeid]) {\n documentData[rootTypeid] = {};\n }\n documentData[rootTypeid][keys[i]] = in_psets[keys[i]].serialize(in_dirtyOnly);\n }\n\n return documentData;\n}\n\n/**\n * Deserialize the input document\n * @param {{}} in_data - The input JSON document data\n * @param {string|undefined} in_scope - The scope to construct the properties from\n * @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions] - The options to selectively\n * create only a subset of a property. Creates all properties if undefined.\n * @return {{}} an object of guid : pset\n * @alias property-properties.deserialize\n */\nexport function deserialize(in_data, in_scope, in_filteringOptions) {\n if (!in_data) {\n console.warn(MSG.NOTHING_TO_DESERIALIZE);\n return {};\n }\n\n // From the given filtering options, keep only what is relevant for this property.\n let baseFilteringOptions;\n if (in_filteringOptions) {\n let pathCoverage = PathHelper.getPathCoverage(in_filteringOptions.basePath, in_filteringOptions.paths);\n switch (pathCoverage.coverageExtent) {\n case PathHelper.CoverageExtent.FULLY_COVERED:\n // No need for filtering options anymore, keep them undefined.\n break;\n case PathHelper.CoverageExtent.PARTLY_COVERED:\n baseFilteringOptions = {\n basePath: in_filteringOptions.basePath,\n paths: pathCoverage.pathList,\n };\n break;\n case PathHelper.CoverageExtent.UNCOVERED:\n // No need to create anything, it is outside the paths.\n return {};\n default:\n break;\n }\n }\n\n var deserializedProperties = {};\n var typeid, entity, classed;\n\n var dataKeys = Object.keys(in_data);\n for (var iData = 0; iData < dataKeys.length; iData++) {\n typeid = dataKeys[iData];\n classed = in_data[typeid];\n var classKeys = Object.keys(classed);\n for (var iClass = 0; iClass < classKeys.length; iClass++) {\n // reconstruct entity\n let filteringOptions = baseFilteringOptions && {\n basePath: PathHelper.getChildAbsolutePathCanonical(baseFilteringOptions.basePath, classKeys[iClass]),\n paths: baseFilteringOptions.paths,\n };\n // TODO: In theory this could throw when the entity can not be created because it is not included\n // in the paths. Make sure to handle this case when we'll add that validation.\n entity = Property.PropertyFactory._createProperty(typeid, null, undefined, in_scope, filteringOptions);\n\n // Store the id prior to calling entity.deserialize() since it is subject to change afterwards\n var id = entity.getId();\n\n // Create a scope property which captures the scope that was passed in as arguments\n // so that it can be picked up downstream by the respective deserialize functions\n var scopeProperty = new ScopeProperty({ scope: in_scope });\n\n scopeProperty._append(entity, false);\n\n entity.deserialize(classed[classKeys[iClass]], filteringOptions, false);\n\n scopeProperty._remove(id);\n\n entity._id = classKeys[iClass];\n\n // keep track of the reconstructed entities\n deserializedProperties[classKeys[iClass]] = entity;\n }\n }\n\n return deserializedProperties;\n}\n/**\n * Deserialize the input document assuming it contains elements of a non-primitive array.\n * @param {array<object>} in_data - The input JSON document data\n * @param {string|undefined} in_scope - The scope to construct the properties from\n * @return {array<BaseProperty>} An array of psets\n * @alias property-properties.deserializeNonPrimitiveArrayElements\n */\nexport function deserializeNonPrimitiveArrayElements(in_data, in_scope) {\n if (!in_data) {\n console.warn(MSG.NOTHING_TO_DESERIALIZE);\n return [];\n }\n\n var insertedPropertyInstances = [];\n for (var i = 0; i < in_data.length; ++i) {\n // reconstruct entity\n var createdProperty = Property.PropertyFactory._createProperty(\n in_data[i]['typeid'], null, undefined, in_scope);\n\n var id = createdProperty.getId();\n\n // Create a scope property which captures the scope that was passed in as argument\n // so that it can be picked up downstream by the respective deserialize functions\n var scopeProperty = new ScopeProperty({ scope: in_scope });\n\n scopeProperty._append(createdProperty, false);\n\n createdProperty._deserialize(in_data[i], false, undefined, false);\n\n scopeProperty._remove(id);\n\n // keep track of the reconstructed entities\n insertedPropertyInstances.push(createdProperty);\n }\n\n return insertedPropertyInstances;\n}\n"]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
8
8
|
/**
|
|
9
|
-
* @param {Object=} in_params -
|
|
9
|
+
* @param {Object=} in_params - The parameters
|
|
10
10
|
* @protected
|
|
11
11
|
*/
|
|
12
12
|
protected constructor();
|
|
@@ -15,7 +15,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
15
15
|
/**
|
|
16
16
|
* Returns the sub-property having the given name in this property.
|
|
17
17
|
*
|
|
18
|
-
* @param
|
|
18
|
+
* @param {string|number} in_id - The id of the prop you wish to retrieve.
|
|
19
19
|
*
|
|
20
20
|
* @return {property-properties.BaseProperty | undefined} The property you seek or undefined if none is found.
|
|
21
21
|
*/
|
|
@@ -29,18 +29,19 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
29
29
|
*/
|
|
30
30
|
getGuid(): string;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @param
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param {
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @throws
|
|
43
|
-
* @throws
|
|
32
|
+
* Returns the value of a sub-property This is a shortcut for .get(in_ids, in_options).getValue().
|
|
33
|
+
*
|
|
34
|
+
* @param {string|number|Array<string|number>} in_ids - The ID or IDs of the property or an array of IDs if an array
|
|
35
|
+
* is passed, the .get function will be performed on each id in sequence for example .getValue(['position','x'])
|
|
36
|
+
* is equivalent to .get('position').get('x').getValue(). If at any point .get resolves to a ReferenceProperty,
|
|
37
|
+
* it will, by default, return the property that the ReferenceProperty refers to.
|
|
38
|
+
* @param {Object} in_options - Parameter object
|
|
39
|
+
* @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How
|
|
40
|
+
* should this function behave during reference resolution?
|
|
41
|
+
*
|
|
42
|
+
* @throws If the in_ids does not resolve to a ValueProperty or StringProperty
|
|
43
|
+
* @throws If in_ids is not a string or an array of strings or numbers.
|
|
44
|
+
*
|
|
44
45
|
* @return {*} The value of the given sub-property
|
|
45
46
|
*/
|
|
46
47
|
getValue(in_ids: string | number | Array<string | number>, in_options: any): any;
|
|
@@ -58,16 +59,19 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
58
59
|
*/
|
|
59
60
|
_getIds(): Array<string>;
|
|
60
61
|
/**
|
|
61
|
-
* Returns an object with all the nested values contained in this property
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* Returns an object with all the nested values contained in this property.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```javascript
|
|
66
|
+
* {
|
|
64
67
|
* position: {
|
|
65
|
-
*
|
|
66
|
-
*
|
|
68
|
+
* x: 2,
|
|
69
|
+
* y: 5
|
|
67
70
|
* }
|
|
68
71
|
* }
|
|
72
|
+
* ```
|
|
69
73
|
*/
|
|
70
|
-
getValues():
|
|
74
|
+
getValues(): {};
|
|
71
75
|
/**
|
|
72
76
|
* Checks whether a property with the given name exists
|
|
73
77
|
*
|
|
@@ -79,16 +83,18 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
79
83
|
* Given an object that mirrors a PSet Template, assigns the properties to the values
|
|
80
84
|
* found in that object.
|
|
81
85
|
* See {@link setValues}
|
|
82
|
-
* @param {object} in_values The object containing the nested values to assign
|
|
83
|
-
* @param {boolean} in_typed Whether the values are typed/polymorphic.
|
|
84
|
-
* @param {boolean} in_initial
|
|
85
|
-
|
|
86
|
+
* @param {object} in_values - The object containing the nested values to assign
|
|
87
|
+
* @param {boolean} in_typed - Whether the values are typed/polymorphic.
|
|
88
|
+
* @param {boolean} in_initial - Whether we are setting default/initial values
|
|
89
|
+
* or if the function is called directly with the values to set.
|
|
86
90
|
*/
|
|
87
91
|
_setValues(in_values: object, in_typed: boolean, in_initial: boolean): void;
|
|
88
92
|
/**
|
|
89
93
|
* Given an object that mirrors a PSet Template, assigns the properties to the values
|
|
90
94
|
* found in that object.
|
|
91
|
-
*
|
|
95
|
+
* E.g.
|
|
96
|
+
*
|
|
97
|
+
* ```
|
|
92
98
|
* <pre>
|
|
93
99
|
* Templates = {
|
|
94
100
|
* properties: [
|
|
@@ -97,11 +103,12 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
97
103
|
* ]
|
|
98
104
|
* }
|
|
99
105
|
* </pre>
|
|
106
|
+
* ```
|
|
100
107
|
*
|
|
101
|
-
* @param {object} in_values The object containing the nested values to assign
|
|
102
|
-
* @throws
|
|
103
|
-
* @throws
|
|
104
|
-
* @throws
|
|
108
|
+
* @param {object} in_values - The object containing the nested values to assign
|
|
109
|
+
* @throws If in_values is not an object (or in the case of ArrayProperty, an array)
|
|
110
|
+
* @throws If one of the path in in_values does not correspond to a path in that property
|
|
111
|
+
* @throws If one of the path to a value in in_values leads to a property in this property.
|
|
105
112
|
*/
|
|
106
113
|
setValues(in_values: object): void;
|
|
107
114
|
/**
|
|
@@ -110,21 +117,25 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
110
117
|
* This is an internal function, called by the PropertyFactory when instantiating a template and internally by the
|
|
111
118
|
* NodeProperty. Adding children dynamically by the user is only allowed in the NodeProperty.
|
|
112
119
|
*
|
|
113
|
-
* @param {property-properties.BaseProperty} in_property
|
|
120
|
+
* @param {property-properties.BaseProperty} in_property - The property to append
|
|
114
121
|
* @param {boolean} in_allowChildMerges - Whether merging of children (nested properties) is allowed.
|
|
115
|
-
*
|
|
116
|
-
*
|
|
122
|
+
* This is used for extending inherited properties.
|
|
123
|
+
*
|
|
117
124
|
* @throws {OVERWRITING_ID} - Thrown when adding a property with an existing id.
|
|
118
125
|
* @throws {OVERRIDDING_INHERITED_TYPES} - Thrown when overriding inherited typed properties.
|
|
126
|
+
*
|
|
127
|
+
* @protected
|
|
119
128
|
*/
|
|
120
129
|
protected _append(in_property: any, in_allowChildMerges: boolean): void;
|
|
121
130
|
/**
|
|
122
131
|
* Merge child properties
|
|
123
132
|
*
|
|
124
|
-
* This is an internal function that merges children of two properties.
|
|
125
|
-
*
|
|
133
|
+
* This is an internal function that merges children of two properties. This is used for extending inherited
|
|
134
|
+
* properties.
|
|
135
|
+
*
|
|
136
|
+
* @param {property-properties.BaseProperty} in_property - The property to merge its children (nested properties)
|
|
137
|
+
* with.
|
|
126
138
|
*
|
|
127
|
-
* @param {property-properties.BaseProperty} in_property the property to merge its children (nested properties) with.
|
|
128
139
|
* @protected
|
|
129
140
|
*/
|
|
130
141
|
protected _merge(in_property: any): void;
|
|
@@ -132,8 +143,9 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
132
143
|
* Traverses all static properties (properties declared in the template and not added dynamically) in the
|
|
133
144
|
* hierarchy below this node
|
|
134
145
|
*
|
|
135
|
-
* @param {function} in_callback
|
|
136
|
-
* @param {string?}
|
|
146
|
+
* @param {function} in_callback - Callback to invoke for every property
|
|
147
|
+
* @param {string?} in_pathFromTraversalStart - Path from the root of the traversal to this node
|
|
148
|
+
*
|
|
137
149
|
* @protected
|
|
138
150
|
*/
|
|
139
151
|
protected _traverseStaticProperties(in_callback: Function, in_pathFromTraversalStart: string | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractStaticCollectionProperty.d.ts","sourceRoot":"","sources":["../../src/properties/abstractStaticCollectionProperty.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"abstractStaticCollectionProperty.d.ts","sourceRoot":"","sources":["../../src/properties/abstractStaticCollectionProperty.js"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH;IACI;;;OAGG;IACH,wBAQC;IAHO,oBAAyB;IAE7B,sBAA2B;IA0E/B;;;;;;OAMG;IACH,YAJW,MAAM,GAAC,MAAM,YAMvB;IAaD;;;;;;OAMG;IACH,WAFY,MAAM,CAKjB;IAED;;;;;;;;;;;;;;;OAeG;IACH,iBAbW,MAAM,GAAC,MAAM,GAAC,MAAM,MAAM,GAAC,MAAM,CAAC,wBAkB5C;IAED;;;;;OAKG;IACH,0BASC;IAWD;;;;OAIG;IACH,WAFY,MAAO,MAAM,CAAC,CAIzB;IAED;;;;;;;;;;;;OAYG;IACH,gBAcC;IAED;;;;;OAKG;IACH,WAHW,MAAM,GACL,OAAO,CAIlB;IAgGD;;;;;;;;OAQG;IACH,sBALW,MAAM,YACN,OAAO,cACP,OAAO,QAyBjB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,qBALW,MAAM,QAchB;IAED;;;;;;;;;;;;;;OAcG;IACH,yDARW,OAAO,QA+BjB;IAED;;;;;;;;;;MAUE;IACF,yCAMC;IAqED;;;;;;;;OAQG;IACH,sFAJW,MAAM,eAuBhB;IA8ID;;;;OAIG;IACH,0BAEC;IAED;;;OAGG;IACH,uCAIC;CACJ"}
|