@fluid-experimental/property-properties 2.70.0-360374 → 2.70.0-361092
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/properties/arrayProperty.d.ts +2 -2
- package/dist/properties/arrayProperty.js +2 -2
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +2 -2
- package/dist/properties/containerProperty.js +2 -2
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts +2 -2
- package/dist/properties/indexedCollectionBaseProperty.js +2 -2
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +5 -6
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts +2 -2
- package/dist/properties/mapProperty.js +2 -2
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts +2 -2
- package/dist/properties/valueProperty.js +2 -2
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.js +6 -6
- package/dist/propertyFactory.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/lib/properties/arrayProperty.d.ts +2 -2
- package/lib/properties/arrayProperty.js +2 -2
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +2 -2
- package/lib/properties/containerProperty.js +2 -2
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts +2 -2
- package/lib/properties/indexedCollectionBaseProperty.js +2 -2
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +5 -6
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts +2 -2
- package/lib/properties/mapProperty.js +2 -2
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts +2 -2
- package/lib/properties/valueProperty.js +2 -2
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.js +6 -6
- package/lib/propertyFactory.js.map +1 -1
- package/package.json +6 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapProperty.js","sourceRoot":"","sources":["../../src/properties/mapProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;AACrF,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAE7E,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;AAE7C;;;;;GAKG;AAEH;;;GAGG;AACH,MAAa,WAAY,SAAQ,6BAA6B;IAC7D;;;;;;;;OAQG;IACH,YAAY,SAAS,EAAE,QAAQ;QAC9B,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,cAAc,IAAI,QAAQ,CAAC;QAE5D,6CAA6C;QAC7C,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC5B,CAAC;I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AAC;IAED;;OAEG;IACH,KAAK;QACJ,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAvZD,kCAuZC;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC;AAC/C,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst { PathHelper, TypeIdHelper } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\nconst { ConsoleUtils } = require(\"@fluid-experimental/property-common\");\nconst _ = require(\"lodash\");\n\nconst { AbstractStaticCollectionProperty } = require(\"./abstractStaticCollectionProperty\");\nconst { BaseProperty } = require(\"./baseProperty\");\nconst { IndexedCollectionBaseProperty } = require(\"./indexedCollectionBaseProperty\");\nconst { LazyLoadedProperties: Property } = require(\"./lazyLoadedProperties\");\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n * @internal\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n\t/**\n\t * @param {Object} in_params - Input parameters for property creation\n\t * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.IndexedCollectionBaseProperty\n\t * @alias property-properties.MapProperty\n\t * @category Maps\n\t */\n\tconstructor(in_params, in_scope) {\n\t\tsuper(in_params);\n\n\t\tthis._scope = in_scope;\n\t\tthis._contextKeyType = in_params.contextKeyType || \"string\";\n\n\t\t/** Contains the actual entries of the map */\n\t\tthis._dynamicChildren = {};\n\t}\n\n\t/**\n\t * Returns the full property type identifier for the ChangeSet including the enum type id\n\t * @param {boolean} [in_hideCollection=false] - If true the collection type (if applicable) will be omitted\n\t * @return {string} The typeid\n\t */\n\tgetFullTypeid(in_hideCollection = false) {\n\t\treturn in_hideCollection\n\t\t\t? this._typeid\n\t\t\t: TypeIdHelper.createSerializationTypeId(this._typeid, \"map\");\n\t}\n\n\t/**\n\t * Is this property a leaf node with regard to flattening?\n\t *\n\t * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n\t *\n\t * @return {boolean} Is it a leaf with regard to flattening?\n\t */\n\t_isFlattenLeaf() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * See {@link MapProperty.setValues}\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n\t * properties with that typeid, else use the set's typeid (support polymorphic items).\n\t * @private\n\t */\n\t_setValuesInternal(in_values, in_typed) {\n\t\tif (this._containsPrimitiveTypes) {\n\t\t\tvar that = this;\n\t\t\t_.each(in_values, function (value, key) {\n\t\t\t\tif (that.has(key)) {\n\t\t\t\t\tthat.remove(key);\n\t\t\t\t}\n\n\t\t\t\tthat.insert(key, value);\n\t\t\t});\n\t\t} else {\n\t\t\tvar that = this;\n\t\t\t_.each(in_values, function (value, key) {\n\t\t\t\tvar property = that.get(String(key), {\n\t\t\t\t\treferenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,\n\t\t\t\t});\n\t\t\t\t// if key exists in set replace its value else insert a new key/value\n\t\t\t\tif (property) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tproperty instanceof Property.ValueProperty ||\n\t\t\t\t\t\tproperty instanceof Property.StringProperty\n\t\t\t\t\t) {\n\t\t\t\t\t\tproperty.setValue(value);\n\t\t\t\t\t} else if (property instanceof BaseProperty && _.isObject(value)) {\n\t\t\t\t\t\tproperty._setValues(value, false, false);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new TypeError(MSG.SET_VALUES_PATH_INVALID + key);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (value instanceof BaseProperty) {\n\t\t\t\t\t\tthat.insert(key, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (in_typed) {\n\t\t\t\t\t\t\tthat.insert(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tProperty.PropertyFactory._createProperty(\n\t\t\t\t\t\t\t\t\tvalue.typeid || that._typeid,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tvalue.value,\n\t\t\t\t\t\t\t\t\tthat._getScope(),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthat.insert(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tProperty.PropertyFactory._createProperty(\n\t\t\t\t\t\t\t\t\tthat._typeid,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\tthat._getScope(),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * See {@link MapProperty.setValues}\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @param {boolean} in_typed - Whether the values are typed/polymorphic.\n\t * @param {boolean} in_initial - Whether we are setting default/initial values or if the function is called directly\n\t * with the values to set.\n\t *\n\t * @override\n\t */\n\t_setValues(in_values, in_typed, in_initial) {\n\t\tif (in_initial) {\n\t\t\tthis.clear();\n\t\t}\n\n\t\tthis._setValuesInternal(in_values, in_typed);\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @throws If one of the path in in_values does not exist in this property\n\t * @throws If trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n\t *\n\t * @override\n\t */\n\tsetValues(in_values) {\n\t\tvar checkoutView = this._getCheckoutView();\n\t\tif (checkoutView !== undefined) {\n\t\t\tcheckoutView.pushNotificationDelayScope();\n\t\t\tthis._setValues(in_values, false, false);\n\t\t\tcheckoutView.popNotificationDelayScope();\n\t\t} else {\n\t\t\tthis._setValues(in_values, false, false);\n\t\t}\n\t}\n\n\t/**\n\t * Returns an object with all the nested values contained in this property.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * 'firstString': {\n\t * 'stringValue': 'test1'\n\t * },\n\t * 'secondString': {\n\t * 'stringValue': 'test2'\n\t * }\n\t * }\n\t */\n\tgetValues() {\n\t\tvar ids = this.getIds();\n\t\tvar result = {};\n\t\tfor (var i = 0; i < ids.length; i++) {\n\t\t\tvar child = this.get(ids[i]);\n\t\t\tresult[ids[i]] = child.isPrimitiveType()\n\t\t\t\t? this.get(ids[i]).getValue()\n\t\t\t\t: child.getValues();\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Returns the path segment for a child\n\t *\n\t * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n\t *\n\t * @return {string} The path segment to resolve the child property under this property\n\t * @protected\n\t */\n\t_getPathSegmentForChildNode(in_childNode) {\n\t\treturn \"[\" + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + \"]\";\n\t}\n\n\t/**\n\t * Resolves a direct child node based on the given path segment\n\t *\n\t * @param {String} in_segment - The path segment to resolve\n\t * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n\t *\n\t * @return {BaseProperty | undefined} The child property that has been resolved\n\t * @protected\n\t */\n\t_resolvePathSegment(in_segment, in_segmentType) {\n\t\treturn in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n\t\t\t? this._dynamicChildren[in_segment]\n\t\t\t: AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tin_segment,\n\t\t\t\t\tin_segmentType,\n\t\t\t\t);\n\t}\n\n\t/**\n\t * Inserts a property or value into the map\n\t *\n\t * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n\t * existing entries you can use the set function.\n\t *\n\t * @param {string} in_key - The key under which the entry is added\n\t * @param {property-properties.Property} in_property - The property to insert\n\t * @throws If the property already exists\n\t * @throws If the property already has a parent\n\t * @throws If in_key is not a string\n\t * @throws If the property is a root property\n\t */\n\tinsert(in_key, in_property) {\n\t\tConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n\t\tif (this._dynamicChildren[in_key] !== undefined) {\n\t\t\tthrow new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n\t\t}\n\t\tif (in_property instanceof BaseProperty) {\n\t\t\tin_property._validateInsertIn(this);\n\t\t\t// Set the ID of the entry, to make sure it corresponds to the used key\n\t\t\tin_property._setId(in_key);\n\n\t\t\t// Insert the entry into the collection\n\t\t\tthis._insert(in_key, in_property, true);\n\t\t} else {\n\t\t\tthrow new TypeError(MSG.NONVALUE_MAP_INSERT_PROP);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the entry with the given key from the map\n\t *\n\t * @param {string} in_key - The key of the entry to remove from the map\n\t * @throws If trying to remove an entry that does not exist\n\t * @return {*} the item removed\n\t */\n\tremove(in_key) {\n\t\tvar item = this.get(in_key);\n\t\tthis._removeByKey(in_key, true);\n\t\treturn item;\n\t}\n\n\t/**\n\t * Sets the entry with the given key to the property passed in\n\t *\n\t * Note: this will overwrite an already existing value\n\t *\n\t * @param {string} in_key - The key under which the entry is stored\n\t * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n\t * @throws If in_property is not a property\n\t * @throws If trying to insert a property that has a parent\n\t * @throws If in_key is not a string or a number\n\t */\n\tset(in_key, in_property) {\n\t\tthis._checkIsNotReadOnly(true);\n\t\tif (this._dynamicChildren[in_key] !== in_property) {\n\t\t\tif (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n\t\t\t\tthrow new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n\t\t\t}\n\t\t\tif (this._dynamicChildren[in_key] !== undefined) {\n\t\t\t\tthis._removeByKey(in_key, false);\n\t\t\t}\n\t\t\t// Set the ID of the entry, to make sure it corresponds to the used key\n\t\t\tif (this._containsPrimitiveTypes === false) {\n\t\t\t\tin_property._setId(in_key);\n\t\t\t}\n\t\t\tthis._insert(in_key, in_property, false);\n\n\t\t\t// Make one final report\n\t\t\tthis._reportDirtinessToView();\n\t\t}\n\t}\n\n\t/**\n\t * Returns an Object with all the entries of the map.\n\t * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n\t * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n\t * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n\t * of this class.\n\t *\n\t * @return {Object} The map with all entries in the map.\n\t */\n\tgetEntriesReadOnly() {\n\t\treturn this._dynamicChildren;\n\t}\n\n\t/**\n\t * Returns the collection entry with the given key\n\t *\n\t * @param {string | Array<string>} in_ids - key of the entry to return or an array of keys\n\t * if an array is passed, the .get function will be performed on each id in sequence\n\t * for example .get(['position','x']) is equivalent to .get('position').get('x').\n\t * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n\t * refers to.\n\t * @param {Object} in_options - parameter object\n\t * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS]- -\n\t * How should this function behave during reference resolution?\n\t *\n\t * @return {BaseProperty | undefined} The entry in the collection or undefined\n\t * if none could be found\n\t */\n\tget(in_ids, in_options) {\n\t\tif (_.isArray(in_ids)) {\n\t\t\t// Forward handling of arrays to the BaseProperty function\n\t\t\treturn AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n\t\t} else {\n\t\t\tin_options = in_options || {};\n\t\t\tin_options.referenceResolutionMode =\n\t\t\t\tin_options.referenceResolutionMode === undefined\n\t\t\t\t\t? BaseProperty.REFERENCE_RESOLUTION.ALWAYS\n\t\t\t\t\t: in_options.referenceResolutionMode;\n\n\t\t\tvar prop = this;\n\t\t\tswitch (in_ids) {\n\t\t\t\tcase PATH_TOKENS.ROOT: {\n\t\t\t\t\tprop = prop.getRoot();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase PATH_TOKENS.UP: {\n\t\t\t\t\tprop = prop.getParent();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase PATH_TOKENS.REF: {\n\t\t\t\t\tthrow new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tprop = prop._dynamicChildren[in_ids];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle automatic reference resolution\n\t\t\tif (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n\t\t\t\tif (prop instanceof Property.ReferenceProperty) {\n\t\t\t\t\tprop = prop.ref;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn prop;\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether an entry with the given name exists\n\t *\n\t * @param {string} in_id - Name of the property\n\t * @return {boolean} True if the property exists, otherwise false.\n\t */\n\thas(in_id) {\n\t\treturn this._dynamicChildren[in_id] !== undefined;\n\t}\n\n\t/**\n\t * Returns all entries of the map as an array.\n\t *\n\t * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n\t *\n\t * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n\t * is a shallow copy which can be modified by the caller without effects on the map.\n\t */\n\tgetAsArray() {\n\t\treturn _.values(this._dynamicChildren);\n\t}\n\n\t/**\n\t * Returns all keys found in the map\n\t *\n\t * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n\t *\n\t * @return {Array.<string>} The keys\n\t */\n\tgetIds() {\n\t\treturn Object.keys(this._dynamicChildren);\n\t}\n\n\t/**\n\t * Get the scope to which this property belongs to.\n\t * @return {string|undefined} The guid representing the scope in which the\n\t * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n\t * @override\n\t * @private\n\t */\n\t_getScope() {\n\t\tvar scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n\t\treturn scope !== undefined ? scope : this._scope;\n\t}\n\n\t/**\n\t * Deletes all values from the Map\n\t */\n\tclear() {\n\t\tvar that = this;\n\t\tthis.getIds().forEach(function (id) {\n\t\t\tthat.remove(id);\n\t\t});\n\t}\n}\n\nMapProperty.prototype._typeid = \"BaseProperty\";\nMapProperty.prototype._context = \"map\";\n"]}
|
|
1
|
+
{"version":3,"file":"mapProperty.js","sourceRoot":"","sources":["../../src/properties/mapProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;AACrF,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAE7E,MAAM,WAAW,GAAG,Y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gBAAgB,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,MAAM;QACL,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACR,IAAI,KAAK,GAAG,6BAA6B,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzE,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,KAAK;QACJ,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAvZD,kCAuZC;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC;AAC/C,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst { PathHelper, TypeIdHelper } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\nconst { ConsoleUtils } = require(\"@fluid-experimental/property-common\");\nconst _ = require(\"lodash\");\n\nconst { AbstractStaticCollectionProperty } = require(\"./abstractStaticCollectionProperty\");\nconst { BaseProperty } = require(\"./baseProperty\");\nconst { IndexedCollectionBaseProperty } = require(\"./indexedCollectionBaseProperty\");\nconst { LazyLoadedProperties: Property } = require(\"./lazyLoadedProperties\");\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n * @internal\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n\t/**\n\t * @param {Object} in_params - Input parameters for property creation\n\t * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.IndexedCollectionBaseProperty\n\t * @alias property-properties.MapProperty\n\t * @category Maps\n\t */\n\tconstructor(in_params, in_scope) {\n\t\tsuper(in_params);\n\n\t\tthis._scope = in_scope;\n\t\tthis._contextKeyType = in_params.contextKeyType || \"string\";\n\n\t\t/** Contains the actual entries of the map */\n\t\tthis._dynamicChildren = {};\n\t}\n\n\t/**\n\t * Returns the full property type identifier for the ChangeSet including the enum type id\n\t * @param {boolean} [in_hideCollection=false] - If true the collection type (if applicable) will be omitted\n\t * @return {string} The typeid\n\t */\n\tgetFullTypeid(in_hideCollection = false) {\n\t\treturn in_hideCollection\n\t\t\t? this._typeid\n\t\t\t: TypeIdHelper.createSerializationTypeId(this._typeid, \"map\");\n\t}\n\n\t/**\n\t * Is this property a leaf node with regard to flattening?\n\t *\n\t * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n\t *\n\t * @return {boolean} Is it a leaf with regard to flattening?\n\t */\n\t_isFlattenLeaf() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * See {@link MapProperty.setValues}\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n\t * properties with that typeid, else use the set's typeid (support polymorphic items).\n\t * @private\n\t */\n\t_setValuesInternal(in_values, in_typed) {\n\t\tif (this._containsPrimitiveTypes) {\n\t\t\tvar that = this;\n\t\t\t_.each(in_values, function (value, key) {\n\t\t\t\tif (that.has(key)) {\n\t\t\t\t\tthat.remove(key);\n\t\t\t\t}\n\n\t\t\t\tthat.insert(key, value);\n\t\t\t});\n\t\t} else {\n\t\t\tvar that = this;\n\t\t\t_.each(in_values, function (value, key) {\n\t\t\t\tvar property = that.get(String(key), {\n\t\t\t\t\treferenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,\n\t\t\t\t});\n\t\t\t\t// if key exists in set replace its value else insert a new key/value\n\t\t\t\tif (property) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tproperty instanceof Property.ValueProperty ||\n\t\t\t\t\t\tproperty instanceof Property.StringProperty\n\t\t\t\t\t) {\n\t\t\t\t\t\tproperty.setValue(value);\n\t\t\t\t\t} else if (property instanceof BaseProperty && _.isObject(value)) {\n\t\t\t\t\t\tproperty._setValues(value, false, false);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new TypeError(MSG.SET_VALUES_PATH_INVALID + key);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (value instanceof BaseProperty) {\n\t\t\t\t\t\tthat.insert(key, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (in_typed) {\n\t\t\t\t\t\t\tthat.insert(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tProperty.PropertyFactory._createProperty(\n\t\t\t\t\t\t\t\t\tvalue.typeid || that._typeid,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tvalue.value,\n\t\t\t\t\t\t\t\t\tthat._getScope(),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthat.insert(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tProperty.PropertyFactory._createProperty(\n\t\t\t\t\t\t\t\t\tthat._typeid,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\tthat._getScope(),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * See {@link MapProperty.setValues}\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @param {boolean} in_typed - Whether the values are typed/polymorphic.\n\t * @param {boolean} in_initial - Whether we are setting default/initial values or if the function is called directly\n\t * with the values to set.\n\t *\n\t * @override\n\t */\n\t_setValues(in_values, in_typed, in_initial) {\n\t\tif (in_initial) {\n\t\t\tthis.clear();\n\t\t}\n\n\t\tthis._setValuesInternal(in_values, in_typed);\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @throws If one of the path in in_values does not exist in this property\n\t * @throws If trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n\t *\n\t * @override\n\t */\n\tsetValues(in_values) {\n\t\tvar checkoutView = this._getCheckoutView();\n\t\tif (checkoutView !== undefined) {\n\t\t\tcheckoutView.pushNotificationDelayScope();\n\t\t\tthis._setValues(in_values, false, false);\n\t\t\tcheckoutView.popNotificationDelayScope();\n\t\t} else {\n\t\t\tthis._setValues(in_values, false, false);\n\t\t}\n\t}\n\n\t/**\n\t * Returns an object with all the nested values contained in this property.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * 'firstString': {\n\t * 'stringValue': 'test1'\n\t * },\n\t * 'secondString': {\n\t * 'stringValue': 'test2'\n\t * }\n\t * }\n\t */\n\tgetValues() {\n\t\tvar ids = this.getIds();\n\t\tvar result = {};\n\t\tfor (var i = 0; i < ids.length; i++) {\n\t\t\tvar child = this.get(ids[i]);\n\t\t\tresult[ids[i]] = child.isPrimitiveType()\n\t\t\t\t? this.get(ids[i]).getValue()\n\t\t\t\t: child.getValues();\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Returns the path segment for a child\n\t *\n\t * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n\t *\n\t * @return {string} The path segment to resolve the child property under this property\n\t * @protected\n\t */\n\t_getPathSegmentForChildNode(in_childNode) {\n\t\treturn \"[\" + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + \"]\";\n\t}\n\n\t/**\n\t * Resolves a direct child node based on the given path segment\n\t *\n\t * @param {String} in_segment - The path segment to resolve\n\t * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n\t *\n\t * @return {BaseProperty | undefined} The child property that has been resolved\n\t * @protected\n\t */\n\t_resolvePathSegment(in_segment, in_segmentType) {\n\t\treturn in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n\t\t\t? this._dynamicChildren[in_segment]\n\t\t\t: AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tin_segment,\n\t\t\t\t\tin_segmentType,\n\t\t\t\t);\n\t}\n\n\t/**\n\t * Inserts a property or value into the map\n\t *\n\t * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n\t * existing entries you can use the set function.\n\t *\n\t * @param {string} in_key - The key under which the entry is added\n\t * @param {property-properties.Property} in_property - The property to insert\n\t * @throws If the property already exists\n\t * @throws If the property already has a parent\n\t * @throws If in_key is not a string\n\t * @throws If the property is a root property\n\t */\n\tinsert(in_key, in_property) {\n\t\tConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n\t\tif (this._dynamicChildren[in_key] !== undefined) {\n\t\t\tthrow new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n\t\t}\n\t\tif (in_property instanceof BaseProperty) {\n\t\t\tin_property._validateInsertIn(this);\n\t\t\t// Set the ID of the entry, to make sure it corresponds to the used key\n\t\t\tin_property._setId(in_key);\n\n\t\t\t// Insert the entry into the collection\n\t\t\tthis._insert(in_key, in_property, true);\n\t\t} else {\n\t\t\tthrow new TypeError(MSG.NONVALUE_MAP_INSERT_PROP);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the entry with the given key from the map\n\t *\n\t * @param {string} in_key - The key of the entry to remove from the map\n\t * @throws If trying to remove an entry that does not exist\n\t * @return {*} the item removed\n\t */\n\tremove(in_key) {\n\t\tvar item = this.get(in_key);\n\t\tthis._removeByKey(in_key, true);\n\t\treturn item;\n\t}\n\n\t/**\n\t * Sets the entry with the given key to the property passed in\n\t *\n\t * Note: this will overwrite an already existing value\n\t *\n\t * @param {string} in_key - The key under which the entry is stored\n\t * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n\t * @throws If in_property is not a property\n\t * @throws If trying to insert a property that has a parent\n\t * @throws If in_key is not a string or a number\n\t */\n\tset(in_key, in_property) {\n\t\tthis._checkIsNotReadOnly(true);\n\t\tif (this._dynamicChildren[in_key] !== in_property) {\n\t\t\tif (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n\t\t\t\tthrow new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n\t\t\t}\n\t\t\tif (this._dynamicChildren[in_key] !== undefined) {\n\t\t\t\tthis._removeByKey(in_key, false);\n\t\t\t}\n\t\t\t// Set the ID of the entry, to make sure it corresponds to the used key\n\t\t\tif (this._containsPrimitiveTypes === false) {\n\t\t\t\tin_property._setId(in_key);\n\t\t\t}\n\t\t\tthis._insert(in_key, in_property, false);\n\n\t\t\t// Make one final report\n\t\t\tthis._reportDirtinessToView();\n\t\t}\n\t}\n\n\t/**\n\t * Returns an Object with all the entries of the map.\n\t * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n\t * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n\t * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n\t * of this class.\n\t *\n\t * @return {Object} The map with all entries in the map.\n\t */\n\tgetEntriesReadOnly() {\n\t\treturn this._dynamicChildren;\n\t}\n\n\t/**\n\t * Returns the collection entry with the given key\n\t *\n\t * @param {string | Array<string>} in_ids - key of the entry to return or an array of keys\n\t * if an array is passed, the .get function will be performed on each id in sequence\n\t * for example .get(['position','x']) is equivalent to .get('position').get('x').\n\t * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n\t * refers to.\n\t * @param {Object} in_options - parameter object\n\t * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n\t * should this function behave during reference resolution?\n\t *\n\t * @return {BaseProperty | undefined} The entry in the collection or undefined\n\t * if none could be found\n\t */\n\tget(in_ids, in_options) {\n\t\tif (_.isArray(in_ids)) {\n\t\t\t// Forward handling of arrays to the BaseProperty function\n\t\t\treturn AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n\t\t} else {\n\t\t\tin_options = in_options || {};\n\t\t\tin_options.referenceResolutionMode =\n\t\t\t\tin_options.referenceResolutionMode === undefined\n\t\t\t\t\t? BaseProperty.REFERENCE_RESOLUTION.ALWAYS\n\t\t\t\t\t: in_options.referenceResolutionMode;\n\n\t\t\tvar prop = this;\n\t\t\tswitch (in_ids) {\n\t\t\t\tcase PATH_TOKENS.ROOT: {\n\t\t\t\t\tprop = prop.getRoot();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase PATH_TOKENS.UP: {\n\t\t\t\t\tprop = prop.getParent();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase PATH_TOKENS.REF: {\n\t\t\t\t\tthrow new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tprop = prop._dynamicChildren[in_ids];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle automatic reference resolution\n\t\t\tif (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n\t\t\t\tif (prop instanceof Property.ReferenceProperty) {\n\t\t\t\t\tprop = prop.ref;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn prop;\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether an entry with the given name exists\n\t *\n\t * @param {string} in_id - Name of the property\n\t * @return {boolean} True if the property exists, otherwise false.\n\t */\n\thas(in_id) {\n\t\treturn this._dynamicChildren[in_id] !== undefined;\n\t}\n\n\t/**\n\t * Returns all entries of the map as an array.\n\t *\n\t * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n\t *\n\t * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n\t * is a shallow copy which can be modified by the caller without effects on the map.\n\t */\n\tgetAsArray() {\n\t\treturn _.values(this._dynamicChildren);\n\t}\n\n\t/**\n\t * Returns all keys found in the map\n\t *\n\t * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n\t *\n\t * @return {Array.<string>} The keys\n\t */\n\tgetIds() {\n\t\treturn Object.keys(this._dynamicChildren);\n\t}\n\n\t/**\n\t * Get the scope to which this property belongs to.\n\t * @return {string|undefined} The guid representing the scope in which the\n\t * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n\t * @override\n\t * @private\n\t */\n\t_getScope() {\n\t\tvar scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n\t\treturn scope !== undefined ? scope : this._scope;\n\t}\n\n\t/**\n\t * Deletes all values from the Map\n\t */\n\tclear() {\n\t\tvar that = this;\n\t\tthis.getIds().forEach(function (id) {\n\t\t\tthat.remove(id);\n\t\t});\n\t}\n}\n\nMapProperty.prototype._typeid = \"BaseProperty\";\nMapProperty.prototype._context = \"map\";\n"]}
|
|
@@ -65,8 +65,8 @@ export class ValueProperty extends BaseProperty {
|
|
|
65
65
|
* @param {boolean} in_dirtyOnly - Only include dirty entries in the serialization
|
|
66
66
|
* @param {boolean} in_includeRootTypeid - Include the typeid of the root of the hierarchy.
|
|
67
67
|
* Has no effect for ValueProperty
|
|
68
|
-
* @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] -
|
|
69
|
-
*
|
|
68
|
+
* @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] - The type of dirtiness to use
|
|
69
|
+
* when reporting dirty changes. By default this is `PENDING_CHANGE`.
|
|
70
70
|
* @param {boolean} [in_includeReferencedRepositories=false] - If this is set to true, the serialize
|
|
71
71
|
* function will descend into referenced repositories. WARNING: if there are loops in the references
|
|
72
72
|
* this can result in an infinite loop
|
|
@@ -134,8 +134,8 @@ class ValueProperty extends BaseProperty {
|
|
|
134
134
|
* @param {boolean} in_dirtyOnly - Only include dirty entries in the serialization
|
|
135
135
|
* @param {boolean} in_includeRootTypeid - Include the typeid of the root of the hierarchy.
|
|
136
136
|
* Has no effect for ValueProperty
|
|
137
|
-
* @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] -
|
|
138
|
-
*
|
|
137
|
+
* @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] - The type of dirtiness to use
|
|
138
|
+
* when reporting dirty changes. By default this is `PENDING_CHANGE`.
|
|
139
139
|
* @param {boolean} [in_includeReferencedRepositories=false] - If this is set to true, the serialize
|
|
140
140
|
* function will descend into referenced repositories. WARNING: if there are loops in the references
|
|
141
141
|
* this can result in an infinite loop
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueProperty.js","sourceRoot":"","sources":["../../src/properties/valueProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AAEzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;;;;GAMG;AACH,MAAa,aAAc,SAAQ,YAAY;IAC9C;;;;;;;;;;;;OAYG;IACH,YAAY,SAAS;QACpB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACxB,CAAC;IAED;;;;;;OAMG;IACH,cAAc;QACb,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;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ;QACxC,QAAQ,CACP,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CACjF,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,OAAO;QACN,OAAO;YACN,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE;YAChB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE;YACxB,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE;SACtB,CAAC;IACH,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,KAAK,CAAC,GAAG;QACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;CACD;AAxLD,sCAwLC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nconst { ChangeSet } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\n\nconst { BaseProperty } = require(\"./baseProperty\");\n\n/**\n * This class serves as a view to read, write and listen to changes in an\n * object's value field. To do this we simply keep a pointer to the object and\n * its associated data field that we are interested in. If no data field is\n * present this property will fail constructing.\n * @internal\n */\nexport class ValueProperty extends BaseProperty {\n\t/**\n\t * @virtual\n\t * @param {Object=} in_params - The parameters\n\t * @param {Object=} in_params.dataObj - Optional argument containing an object that should be used as the backing\n\t * store of this value property.\n\t * @param {Object=} in_params.dataId - optional argument must be provided when in_params.dataObj is passed. Must\n\t * contain a valid member name of dataObj. This member will be used to set/get values of this value property.\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.BaseProperty\n\t * @alias property-properties.ValueProperty\n\t * @category Value Properties\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t\tthis._data = undefined;\n\t}\n\n\t/**\n\t * Is this property a leaf node with regard to flattening?\n\t *\n\t * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n\t *\n\t * @return {boolean} Is it a leaf with regard to flattening?\n\t */\n\t_isFlattenLeaf() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * returns the current value of ValueProperty\n\t * @return {*} the current value\n\t */\n\tgetValue() {\n\t\treturn this._data;\n\t}\n\n\t/**\n\t * Ensure the array dirty mask is also cleaned when cleaning the tree.\n\t *\n\t * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_flags] - The flags to clean.\n\t * If none are supplied all will be removed.\n\t */\n\tcleanDirty(in_flags) {\n\t\tthis._cleanDirty(in_flags);\n\t}\n\n\t/**\n\t * @param {*} in_value - The new value\n\t * @throws If property is read only\n\t */\n\tsetValue(in_value) {\n\t\tthis._checkIsNotReadOnly(true);\n\t\tthis._setValue(in_value, true);\n\t}\n\n\t/**\n\t * Internal function to update the value of a property\n\t *\n\t * @param {*} in_value - The new value\n\t * @param {boolean} [in_reportToView = true] - By default, the dirtying will always be reported to the checkout view\n\t * and trigger a modified event there. When batching updates, this can be prevented via this flag.\n\t * @return {boolean} true if the value was actually changed\n\t */\n\t_setValue(in_value, in_reportToView) {\n\t\t// dirtiness check: setValue casts the input e.g. in an\n\t\t// int property 1.2 gets cast to 1, in a boolean property\n\t\t// false gets cast to 0,... so we first have to cast(set)\n\t\t// and then compare the value here:\n\t\tvar oldValue = this._data;\n\t\tvar castedValue = this._castFunctor(in_value);\n\t\tvar changed = castedValue !== oldValue;\n\t\tif (changed) {\n\t\t\tthis._data = castedValue;\n\t\t\tthis._setDirty(in_reportToView);\n\t\t}\n\t\treturn changed;\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_deserialize(in_serializedObj, in_reportToView, in_filteringOptions, in_createChangeSet) {\n\t\tif (ChangeSet.isEmptyChangeSet(in_serializedObj)) {\n\t\t\tconsole.warn(MSG.DESERIALIZE_EMPTY_CHANGESET);\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tvar changed = this._setValue(in_serializedObj, in_reportToView);\n\t\t\treturn changed ? this._data : undefined;\n\t\t}\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_applyChangeset(in_changeSet, in_reportToView, in_filteringOptions) {\n\t\tif (!ChangeSet.isEmptyChangeSet(in_changeSet)) {\n\t\t\tvar newVal = in_changeSet;\n\t\t\tif (typeof newVal === \"object\") {\n\t\t\t\tnewVal = newVal.value;\n\t\t\t}\n\t\t\tthis._setValue(newVal, in_reportToView);\n\t\t}\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_reapplyDirtyFlags(in_pendingChangeSet, in_dirtyChangeSet) {\n\t\tconst flags =\n\t\t\t(ChangeSet.isEmptyChangeSet(in_pendingChangeSet)\n\t\t\t\t? BaseProperty.MODIFIED_STATE_FLAGS.CLEAN\n\t\t\t\t: BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE) |\n\t\t\t(ChangeSet.isEmptyChangeSet(in_dirtyChangeSet)\n\t\t\t\t? BaseProperty.MODIFIED_STATE_FLAGS.CLEAN\n\t\t\t\t: BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\tif (flags) {\n\t\t\tthis._setDirty(false, this, flags);\n\t\t}\n\t}\n\n\t/**\n\t * Serialize the property\n\t *\n\t * @param {boolean} in_dirtyOnly - Only include dirty entries in the serialization\n\t * @param {boolean} in_includeRootTypeid - Include the typeid of the root of the hierarchy.\n\t * Has no effect for ValueProperty\n\t * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType]
|
|
1
|
+
{"version":3,"file":"valueProperty.js","sourceRoot":"","sources":["../../src/properties/valueProperty.js"],"names":[],"mapp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ights reserved.\n * Licensed under the MIT License.\n */\n\nconst { ChangeSet } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\n\nconst { BaseProperty } = require(\"./baseProperty\");\n\n/**\n * This class serves as a view to read, write and listen to changes in an\n * object's value field. To do this we simply keep a pointer to the object and\n * its associated data field that we are interested in. If no data field is\n * present this property will fail constructing.\n * @internal\n */\nexport class ValueProperty extends BaseProperty {\n\t/**\n\t * @virtual\n\t * @param {Object=} in_params - The parameters\n\t * @param {Object=} in_params.dataObj - Optional argument containing an object that should be used as the backing\n\t * store of this value property.\n\t * @param {Object=} in_params.dataId - optional argument must be provided when in_params.dataObj is passed. Must\n\t * contain a valid member name of dataObj. This member will be used to set/get values of this value property.\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.BaseProperty\n\t * @alias property-properties.ValueProperty\n\t * @category Value Properties\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t\tthis._data = undefined;\n\t}\n\n\t/**\n\t * Is this property a leaf node with regard to flattening?\n\t *\n\t * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n\t *\n\t * @return {boolean} Is it a leaf with regard to flattening?\n\t */\n\t_isFlattenLeaf() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * returns the current value of ValueProperty\n\t * @return {*} the current value\n\t */\n\tgetValue() {\n\t\treturn this._data;\n\t}\n\n\t/**\n\t * Ensure the array dirty mask is also cleaned when cleaning the tree.\n\t *\n\t * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_flags] - The flags to clean.\n\t * If none are supplied all will be removed.\n\t */\n\tcleanDirty(in_flags) {\n\t\tthis._cleanDirty(in_flags);\n\t}\n\n\t/**\n\t * @param {*} in_value - The new value\n\t * @throws If property is read only\n\t */\n\tsetValue(in_value) {\n\t\tthis._checkIsNotReadOnly(true);\n\t\tthis._setValue(in_value, true);\n\t}\n\n\t/**\n\t * Internal function to update the value of a property\n\t *\n\t * @param {*} in_value - The new value\n\t * @param {boolean} [in_reportToView = true] - By default, the dirtying will always be reported to the checkout view\n\t * and trigger a modified event there. When batching updates, this can be prevented via this flag.\n\t * @return {boolean} true if the value was actually changed\n\t */\n\t_setValue(in_value, in_reportToView) {\n\t\t// dirtiness check: setValue casts the input e.g. in an\n\t\t// int property 1.2 gets cast to 1, in a boolean property\n\t\t// false gets cast to 0,... so we first have to cast(set)\n\t\t// and then compare the value here:\n\t\tvar oldValue = this._data;\n\t\tvar castedValue = this._castFunctor(in_value);\n\t\tvar changed = castedValue !== oldValue;\n\t\tif (changed) {\n\t\t\tthis._data = castedValue;\n\t\t\tthis._setDirty(in_reportToView);\n\t\t}\n\t\treturn changed;\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_deserialize(in_serializedObj, in_reportToView, in_filteringOptions, in_createChangeSet) {\n\t\tif (ChangeSet.isEmptyChangeSet(in_serializedObj)) {\n\t\t\tconsole.warn(MSG.DESERIALIZE_EMPTY_CHANGESET);\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tvar changed = this._setValue(in_serializedObj, in_reportToView);\n\t\t\treturn changed ? this._data : undefined;\n\t\t}\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_applyChangeset(in_changeSet, in_reportToView, in_filteringOptions) {\n\t\tif (!ChangeSet.isEmptyChangeSet(in_changeSet)) {\n\t\t\tvar newVal = in_changeSet;\n\t\t\tif (typeof newVal === \"object\") {\n\t\t\t\tnewVal = newVal.value;\n\t\t\t}\n\t\t\tthis._setValue(newVal, in_reportToView);\n\t\t}\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_reapplyDirtyFlags(in_pendingChangeSet, in_dirtyChangeSet) {\n\t\tconst flags =\n\t\t\t(ChangeSet.isEmptyChangeSet(in_pendingChangeSet)\n\t\t\t\t? BaseProperty.MODIFIED_STATE_FLAGS.CLEAN\n\t\t\t\t: BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE) |\n\t\t\t(ChangeSet.isEmptyChangeSet(in_dirtyChangeSet)\n\t\t\t\t? BaseProperty.MODIFIED_STATE_FLAGS.CLEAN\n\t\t\t\t: BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\tif (flags) {\n\t\t\tthis._setDirty(false, this, flags);\n\t\t}\n\t}\n\n\t/**\n\t * Serialize the property\n\t *\n\t * @param {boolean} in_dirtyOnly - Only include dirty entries in the serialization\n\t * @param {boolean} in_includeRootTypeid - Include the typeid of the root of the hierarchy.\n\t * Has no effect for ValueProperty\n\t * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] - The type of dirtiness to use\n\t * when reporting dirty changes. By default this is `PENDING_CHANGE`.\n\t * @param {boolean} [in_includeReferencedRepositories=false] - If this is set to true, the serialize\n\t * function will descend into referenced repositories. WARNING: if there are loops in the references\n\t * this can result in an infinite loop\n\t *\n\t * @return {*} The serialized representation of this property\n\t * @protected\n\t */\n\t_serialize(\n\t\tin_dirtyOnly,\n\t\tin_includeRootTypeid,\n\t\tin_dirtinessType,\n\t\tin_includeReferencedRepositories,\n\t) {\n\t\tif (in_dirtyOnly) {\n\t\t\treturn this._isDirty(in_dirtinessType) ? this._data : {};\n\t\t} else {\n\t\t\treturn this._data;\n\t\t}\n\t}\n\n\t/**\n\t * Calls back the given function with a human-readable string\n\t * representation of the property.\n\t * @param {string} indent - Leading spaces to create the tree representation\n\t * @param {string} externalId - Name of the current property at the upper level. Used for arrays.\n\t * @param {function} printFct - Function to call for printing each property\n\t */\n\t_prettyPrint(indent, externalId, printFct) {\n\t\tprintFct(\n\t\t\tindent + externalId + this.getId() + \" (\" + this.getTypeid() + \"): \" + this.value,\n\t\t);\n\t}\n\n\t/**\n\t * Return a JSON representation of the property.\n\t * @return {object} A JSON representation of the property.\n\t * @protected\n\t */\n\t_toJson() {\n\t\treturn {\n\t\t\tid: this.getId(),\n\t\t\tcontext: this._context,\n\t\t\ttypeid: this.getTypeid(),\n\t\t\tisConstant: this._isConstant,\n\t\t\tvalue: this.getValue(),\n\t\t};\n\t}\n\n\tget value() {\n\t\treturn this.getValue.apply(this, arguments);\n\t}\n\tset value(val) {\n\t\tthis.setValue.call(this, val);\n\t}\n}\n"]}
|
package/dist/propertyFactory.js
CHANGED
|
@@ -676,8 +676,8 @@ class PropertyFactory {
|
|
|
676
676
|
*
|
|
677
677
|
* @param {property-properties.PropertyTemplate|string} in_typeid - typeid of for the property the given
|
|
678
678
|
* template/constructor represents
|
|
679
|
-
* @param {property-properties.PropertyTemplate|object|property-properties.BaseProperty} in_templateOrProperty -
|
|
680
|
-
*
|
|
679
|
+
* @param {property-properties.PropertyTemplate|object|property-properties.BaseProperty} in_templateOrProperty - Template/native
|
|
680
|
+
* property class to associate with the typeid
|
|
681
681
|
* @param {string} [in_context='single'] - The context for which the parameter is added (if it is set to all the
|
|
682
682
|
* object will be used in all contexts)
|
|
683
683
|
*/
|
|
@@ -1296,8 +1296,8 @@ class PropertyFactory {
|
|
|
1296
1296
|
*
|
|
1297
1297
|
* @param {string} in_typeid - The type unique identifier
|
|
1298
1298
|
* @param {string} in_id - The id of the property to create
|
|
1299
|
-
* @param {property-properties.PropertyTemplate|object|property-properties.BaseProperty} in_templateOrConstructor -
|
|
1300
|
-
*
|
|
1299
|
+
* @param {property-properties.PropertyTemplate|object|property-properties.BaseProperty} in_templateOrConstructor - The
|
|
1300
|
+
* Template/Property for this in_typeid
|
|
1301
1301
|
* @param {string|undefined} in_scope - The scope in which the property typeid is defined
|
|
1302
1302
|
*
|
|
1303
1303
|
* @returns {property-properties.BaseProperty} The property that serves as parent for the properties in the template
|
|
@@ -1772,8 +1772,8 @@ class PropertyFactory {
|
|
|
1772
1772
|
* sessions, when trying out different templates.
|
|
1773
1773
|
*
|
|
1774
1774
|
* @protected
|
|
1775
|
-
* @param {property-properties.PropertyTemplate|object|property-properties.BaseProperty} in_template -
|
|
1776
|
-
*
|
|
1775
|
+
* @param {property-properties.PropertyTemplate|object|property-properties.BaseProperty} in_template - The template
|
|
1776
|
+
* to reregister.
|
|
1777
1777
|
*/
|
|
1778
1778
|
_reregister(in_template) {
|
|
1779
1779
|
var typeid = in_template.typeid;
|