@fluid-experimental/property-properties 0.58.1001 → 0.58.2000-58133
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.map +1 -1
- package/dist/containerSerializer.js +4 -10
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.d.ts.map +1 -1
- package/dist/enableValidations.js +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +1 -28
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +26 -85
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +9 -71
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +0 -1
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +4 -22
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +2 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +3 -10
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +0 -2
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +7 -38
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js +37 -68
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +6 -18
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +3 -20
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +4 -23
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +0 -3
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +0 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +2 -2
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +3 -16
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +3 -13
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +4 -12
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +3 -22
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +12 -48
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +0 -3
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +3 -45
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +4 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +2 -14
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +35 -72
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +0 -14
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +4 -12
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts.map +1 -1
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +82 -82
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +53 -53
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +25 -25
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +35 -35
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +6 -6
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +26 -26
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +22 -22
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +28 -28
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +11 -11
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +25 -25
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +110 -110
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +5 -5
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +160 -160
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +21 -21
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +4 -4
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +32 -32
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +38 -38
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +3 -3
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +28 -28
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +7 -7
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +559 -560
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +38 -38
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +5 -5
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +266 -266
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +145 -145
- package/dist/test/utils.spec.js +508 -517
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +9 -9
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +5 -5
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +42 -42
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +2 -2
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +9 -9
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.js +4 -10
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +1 -28
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.js +26 -85
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.js +7 -69
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.js +0 -1
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.js +4 -22
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.js +2 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.js +3 -10
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +0 -2
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.js +7 -38
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +6 -18
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.js +3 -20
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.js +4 -23
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.js +0 -3
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.js +0 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +2 -2
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.js +3 -16
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.js +3 -13
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.js +4 -12
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.js +3 -22
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.js +12 -48
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +0 -3
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.js +3 -45
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.js +4 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.js +2 -14
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.js +35 -72
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.js +0 -14
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.js +4 -12
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +13 -6
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @fileoverview Definition of the StringProperty class
|
|
7
7
|
*/
|
|
8
|
-
const _ = require('lodash');
|
|
9
|
-
const { ValueArrayProperty } = require('./valueArrayProperty');
|
|
10
|
-
const { ArrayProperty } = require('./arrayProperty');
|
|
11
|
-
const { MSG } = require('@fluid-experimental/property-common').constants;
|
|
12
8
|
const { ChangeSet } = require('@fluid-experimental/property-changeset');
|
|
9
|
+
const { MSG } = require('@fluid-experimental/property-common').constants;
|
|
13
10
|
const { ConsoleUtils } = require('@fluid-experimental/property-common');
|
|
11
|
+
const _ = require('lodash');
|
|
12
|
+
const { ArrayProperty } = require('./arrayProperty');
|
|
14
13
|
const { BaseProperty } = require('./baseProperty');
|
|
14
|
+
const { ValueArrayProperty } = require('./valueArrayProperty');
|
|
15
15
|
var MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;
|
|
16
16
|
// Some global constant objects that are used to indicate a few special
|
|
17
17
|
// cases for the dirty object. If the string was directly set to a literal,
|
|
@@ -22,12 +22,12 @@ var MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;
|
|
|
22
22
|
var PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE = {
|
|
23
23
|
pending: 'setAsLiteral',
|
|
24
24
|
dirty: 'setAsLiteral',
|
|
25
|
-
flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE | MODIFIED_STATE_FLAGS.DIRTY
|
|
25
|
+
flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE | MODIFIED_STATE_FLAGS.DIRTY,
|
|
26
26
|
};
|
|
27
27
|
var NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE = {
|
|
28
28
|
pending: 'setAsLiteral',
|
|
29
29
|
dirty: undefined,
|
|
30
|
-
flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
30
|
+
flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE,
|
|
31
31
|
};
|
|
32
32
|
var DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE = {
|
|
33
33
|
pending: undefined,
|
|
@@ -39,13 +39,13 @@ var DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE = {
|
|
|
39
39
|
},
|
|
40
40
|
get flags() {
|
|
41
41
|
return this._flags;
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
var STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS = [
|
|
45
45
|
undefined,
|
|
46
46
|
NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE,
|
|
47
47
|
DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE,
|
|
48
|
-
PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE
|
|
48
|
+
PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE,
|
|
49
49
|
];
|
|
50
50
|
/**
|
|
51
51
|
* A primitive property for a string value.
|
|
@@ -62,7 +62,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
62
62
|
constructor(in_params) {
|
|
63
63
|
super(in_params);
|
|
64
64
|
}
|
|
65
|
-
;
|
|
66
65
|
/**
|
|
67
66
|
* Get the string value
|
|
68
67
|
* @return {string} the JavaScript string primitive value of this StringProperty
|
|
@@ -70,7 +69,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
70
69
|
getValue() {
|
|
71
70
|
return this._dataArrayRef;
|
|
72
71
|
}
|
|
73
|
-
;
|
|
74
72
|
/**
|
|
75
73
|
* Private helper function to update the internal dirty and pending changes
|
|
76
74
|
*
|
|
@@ -102,7 +100,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
102
100
|
}
|
|
103
101
|
this._setChanges(pendingChanges, dirtyChanges);
|
|
104
102
|
}
|
|
105
|
-
;
|
|
106
103
|
_getPendingChanges() {
|
|
107
104
|
if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||
|
|
108
105
|
this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {
|
|
@@ -110,7 +107,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
110
107
|
}
|
|
111
108
|
return (this._dirty && this._dirty.pending) || {};
|
|
112
109
|
}
|
|
113
|
-
;
|
|
114
110
|
_getDirtyChanges() {
|
|
115
111
|
if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||
|
|
116
112
|
this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {
|
|
@@ -121,7 +117,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
121
117
|
}
|
|
122
118
|
return (this._dirty && this._dirty.dirty) || {};
|
|
123
119
|
}
|
|
124
|
-
;
|
|
125
120
|
/**
|
|
126
121
|
* inserts a string starting at a position and shifts the rest of
|
|
127
122
|
* the String to the right. Will not overwrite existing values.
|
|
@@ -134,7 +129,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
134
129
|
ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);
|
|
135
130
|
this._insertRange(in_position, in_value);
|
|
136
131
|
}
|
|
137
|
-
;
|
|
138
132
|
/**
|
|
139
133
|
* Adds letters to the end of the string
|
|
140
134
|
* @param {string} in_value the string to be pushed
|
|
@@ -146,7 +140,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
146
140
|
this._insertRange(this._dataArrayRef.length, in_value);
|
|
147
141
|
return this.getLength();
|
|
148
142
|
}
|
|
149
|
-
;
|
|
150
143
|
/**
|
|
151
144
|
* inserts values
|
|
152
145
|
* @param {number} in_position target index
|
|
@@ -157,7 +150,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
157
150
|
this._insertRangeWithoutDirtying(in_position, in_value);
|
|
158
151
|
this._setDirty();
|
|
159
152
|
}
|
|
160
|
-
;
|
|
161
153
|
/**
|
|
162
154
|
* Returns the full property type identifier for the ChangeSet including the enum type id
|
|
163
155
|
* @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted
|
|
@@ -167,14 +159,12 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
167
159
|
getFullTypeid(in_hideCollection) {
|
|
168
160
|
return this._typeid;
|
|
169
161
|
}
|
|
170
|
-
;
|
|
171
162
|
/**
|
|
172
163
|
* returns the String to an empty string.
|
|
173
164
|
*/
|
|
174
165
|
clear() {
|
|
175
166
|
this.setValue('');
|
|
176
167
|
}
|
|
177
|
-
;
|
|
178
168
|
/**
|
|
179
169
|
* removes a given number of elements from the array property and shifts
|
|
180
170
|
* remaining values to the left.
|
|
@@ -199,7 +189,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
199
189
|
this._setDirty();
|
|
200
190
|
return result;
|
|
201
191
|
}
|
|
202
|
-
;
|
|
203
192
|
/**
|
|
204
193
|
* @inheritdoc
|
|
205
194
|
*/
|
|
@@ -230,7 +219,7 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
230
219
|
if (oldStringLength > 0) {
|
|
231
220
|
this.removeRange(0, oldStringLength, in_reportToView);
|
|
232
221
|
return {
|
|
233
|
-
remove: [[0, oldStringLength]]
|
|
222
|
+
remove: [[0, oldStringLength]],
|
|
234
223
|
};
|
|
235
224
|
}
|
|
236
225
|
else {
|
|
@@ -250,7 +239,7 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
250
239
|
if (newStringData.length > oldStringLength) {
|
|
251
240
|
if (newStringData.substring(0, oldStringLength) === this._dataArrayRef) {
|
|
252
241
|
var appendChanges = {
|
|
253
|
-
insert: [[oldStringLength, newStringData.substring(oldStringLength)]]
|
|
242
|
+
insert: [[oldStringLength, newStringData.substring(oldStringLength)]],
|
|
254
243
|
};
|
|
255
244
|
this.insertRange(oldStringLength, newStringData.substring(oldStringLength), in_reportToView);
|
|
256
245
|
return appendChanges;
|
|
@@ -258,7 +247,7 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
258
247
|
}
|
|
259
248
|
// most simplistic diff method: Remove all existing data and insert the new data
|
|
260
249
|
var simpleChanges = {
|
|
261
|
-
insert: [[0, newStringData]]
|
|
250
|
+
insert: [[0, newStringData]],
|
|
262
251
|
};
|
|
263
252
|
if (oldStringLength > 0) {
|
|
264
253
|
simpleChanges.remove = [[0, oldStringLength]];
|
|
@@ -267,7 +256,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
267
256
|
this.insertRange(0, newStringData, in_reportToView);
|
|
268
257
|
return simpleChanges;
|
|
269
258
|
}
|
|
270
|
-
;
|
|
271
259
|
/**
|
|
272
260
|
* Serialize the property
|
|
273
261
|
*
|
|
@@ -294,7 +282,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
294
282
|
return this._dataArrayRef;
|
|
295
283
|
}
|
|
296
284
|
}
|
|
297
|
-
;
|
|
298
285
|
/**
|
|
299
286
|
* @param {string} in_value the new value
|
|
300
287
|
* @throws if string property is read only
|
|
@@ -303,7 +290,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
303
290
|
this._checkIsNotReadOnly(true);
|
|
304
291
|
this._setValue(in_value, true);
|
|
305
292
|
}
|
|
306
|
-
;
|
|
307
293
|
/**
|
|
308
294
|
* @param {string} in_values the new values
|
|
309
295
|
* @param {Bool} in_initial - Whether we are setting default/initial values
|
|
@@ -313,7 +299,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
313
299
|
_setValues(in_values, in_initial) {
|
|
314
300
|
throw new Error(MSG.NO_VALUE_PROPERTY_SETVALUES);
|
|
315
301
|
}
|
|
316
|
-
;
|
|
317
302
|
/**
|
|
318
303
|
* @param {string} in_values the new values
|
|
319
304
|
* @throws always - cannot use .setValues on a StringProperty. Use .setValue() instead.
|
|
@@ -321,14 +306,12 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
321
306
|
setValues(in_values) {
|
|
322
307
|
StringProperty.prototype._setValues.call(this, in_values, false);
|
|
323
308
|
}
|
|
324
|
-
;
|
|
325
309
|
/**
|
|
326
310
|
* @throws always - cannot call .getValues on a string. Use .getValue() instead
|
|
327
311
|
*/
|
|
328
312
|
getValues() {
|
|
329
313
|
throw new Error(MSG.NO_VALUE_PROPERTY_GETVALUES);
|
|
330
314
|
}
|
|
331
|
-
;
|
|
332
315
|
/**
|
|
333
316
|
* Internal function to update the value of a property
|
|
334
317
|
*
|
|
@@ -361,7 +344,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
361
344
|
}
|
|
362
345
|
return changed;
|
|
363
346
|
}
|
|
364
|
-
;
|
|
365
347
|
/**
|
|
366
348
|
* Sets the pending and dirty changesets
|
|
367
349
|
*
|
|
@@ -389,7 +371,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
389
371
|
ArrayProperty.prototype._setChanges.call(this, in_pending, in_dirty);
|
|
390
372
|
}
|
|
391
373
|
}
|
|
392
|
-
;
|
|
393
374
|
/**
|
|
394
375
|
* Sets the dirty flags for this property
|
|
395
376
|
* @param {Number} in_flags The dirty flags
|
|
@@ -403,7 +384,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
403
384
|
}
|
|
404
385
|
ArrayProperty.prototype._setDirtyFlags.call(this, in_flags);
|
|
405
386
|
}
|
|
406
|
-
;
|
|
407
387
|
/**
|
|
408
388
|
* Gets the dirty flags for this property
|
|
409
389
|
* @return {Number} The dirty flags
|
|
@@ -416,7 +396,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
416
396
|
}
|
|
417
397
|
return ArrayProperty.prototype._getDirtyFlags.call(this);
|
|
418
398
|
}
|
|
419
|
-
;
|
|
420
399
|
/**
|
|
421
400
|
* @inheritdoc
|
|
422
401
|
*/
|
|
@@ -439,7 +418,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
439
418
|
ArrayProperty.prototype._applyChangeset.call(this, in_changeSet, in_reportToView);
|
|
440
419
|
}
|
|
441
420
|
}
|
|
442
|
-
;
|
|
443
421
|
/**
|
|
444
422
|
* Calls back the given function with a human-readable string
|
|
445
423
|
* representation of the property.
|
|
@@ -451,7 +429,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
451
429
|
_prettyPrint(indent, externalId, printFct) {
|
|
452
430
|
printFct(indent + externalId + this.getId() + ' (' + this.getTypeid() + '): "' + this.value + '"');
|
|
453
431
|
}
|
|
454
|
-
;
|
|
455
432
|
/**
|
|
456
433
|
* Return a JSON representation of the property.
|
|
457
434
|
* @return {object} A JSON representation of the property.
|
|
@@ -463,10 +440,9 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
463
440
|
context: this._context,
|
|
464
441
|
typeid: this.getTypeid(),
|
|
465
442
|
isConstant: this._isConstant,
|
|
466
|
-
value: this.value
|
|
443
|
+
value: this.value,
|
|
467
444
|
};
|
|
468
445
|
}
|
|
469
|
-
;
|
|
470
446
|
/**
|
|
471
447
|
* Sets the value of a character at a single index.
|
|
472
448
|
* For example, if you have a string of value 'AAAA' and do .set(1, 'a') => 'AaAA'
|
|
@@ -481,7 +457,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
481
457
|
}
|
|
482
458
|
this.setRange(in_index, in_character);
|
|
483
459
|
}
|
|
484
|
-
;
|
|
485
460
|
/**
|
|
486
461
|
* sets values in a string starting at an index.
|
|
487
462
|
* For example, if you have a string of Value 'AAAA' and do .setRange(1, 'aa') => AaaA
|
|
@@ -493,7 +468,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
493
468
|
setRange(in_index, in_string) {
|
|
494
469
|
ArrayProperty.prototype.setRange.call(this, in_index, in_string);
|
|
495
470
|
}
|
|
496
|
-
;
|
|
497
471
|
/**
|
|
498
472
|
* get a letter at a given index
|
|
499
473
|
* @param {number} in_index the index
|
|
@@ -502,7 +476,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
502
476
|
get(in_index) {
|
|
503
477
|
return ArrayProperty.prototype.get.call(this, in_index);
|
|
504
478
|
}
|
|
505
|
-
;
|
|
506
479
|
/**
|
|
507
480
|
* inserts a string starting at a position and shifts the rest of the String to the right.
|
|
508
481
|
* Will not overwrite existing values.
|
|
@@ -518,7 +491,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
518
491
|
}
|
|
519
492
|
this._insertRange(in_position, in_value);
|
|
520
493
|
}
|
|
521
|
-
;
|
|
522
494
|
/**
|
|
523
495
|
* Creates and initializes the data array
|
|
524
496
|
* @param {Number} in_length the initial length of the array
|
|
@@ -526,7 +498,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
526
498
|
_dataArrayCreate(in_length) {
|
|
527
499
|
this._dataArrayRef = '';
|
|
528
500
|
}
|
|
529
|
-
;
|
|
530
501
|
/**
|
|
531
502
|
* Returns the length of the data array
|
|
532
503
|
* @return {Number} The length
|
|
@@ -534,7 +505,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
534
505
|
_dataArrayGetLength() {
|
|
535
506
|
return this._dataArrayRef.length;
|
|
536
507
|
}
|
|
537
|
-
;
|
|
538
508
|
/**
|
|
539
509
|
* Returns the data array's internal buffer
|
|
540
510
|
* @return {Array} The buffer
|
|
@@ -542,7 +512,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
542
512
|
_dataArrayGetBuffer() {
|
|
543
513
|
return this._dataArrayRef;
|
|
544
514
|
}
|
|
545
|
-
;
|
|
546
515
|
/**
|
|
547
516
|
* Returns an entry from the data array
|
|
548
517
|
* @param {Number} in_i - Position in the array
|
|
@@ -556,7 +525,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
556
525
|
}
|
|
557
526
|
return this._dataArrayRef[in_i];
|
|
558
527
|
}
|
|
559
|
-
;
|
|
560
528
|
/**
|
|
561
529
|
* Set the array to the given new array
|
|
562
530
|
* @param {String} in_newString - The new contents of the array
|
|
@@ -564,7 +532,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
564
532
|
_dataArrayDeserialize(in_newString) {
|
|
565
533
|
this._dataArrayRef = in_newString;
|
|
566
534
|
}
|
|
567
|
-
;
|
|
568
535
|
/**
|
|
569
536
|
* Inserts a range into the data array
|
|
570
537
|
* @param {Number} in_position - Position at which the insert should be done
|
|
@@ -573,7 +540,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
573
540
|
_dataArrayInsertRange(in_position, in_range) {
|
|
574
541
|
this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_range + this._dataArrayRef.substr(in_position);
|
|
575
542
|
}
|
|
576
|
-
;
|
|
577
543
|
/**
|
|
578
544
|
* Removes a range from the data array
|
|
579
545
|
* @param {Number} in_position - Position at which to start the removal
|
|
@@ -588,7 +554,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
588
554
|
throw Error('DataArray removeRange in_offset + in_deleteCount is out of bounds.');
|
|
589
555
|
}
|
|
590
556
|
}
|
|
591
|
-
;
|
|
592
557
|
/**
|
|
593
558
|
* Overwrites a range in the data array
|
|
594
559
|
* @param {Number} in_position - Position at which to start the removal
|
|
@@ -598,7 +563,6 @@ export class StringProperty extends ValueArrayProperty {
|
|
|
598
563
|
this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_values +
|
|
599
564
|
this._dataArrayRef.substr(in_position + in_values.length);
|
|
600
565
|
}
|
|
601
|
-
;
|
|
602
566
|
get value() {
|
|
603
567
|
return this.getValue();
|
|
604
568
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringProperty.js","sourceRoot":"","sources":["../../src/properties/stringProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAEH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAC/D,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACxE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD,IAAI,oBAAoB,GAAG,YAAY,CAAC,oBAAoB,CAAC;AAE7D,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,wDAAwD;AACxD,mFAAmF;AACnF,uCAAuC;AACvC,IAAI,uCAAuC,GAAG;IAC1C,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,oBAAoB,CAAC,cAAc,GAAG,oBAA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,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,SAAS;YACtE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAAA,CAAC;IAGF,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK,CAAC,GAAG;QACT,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,kBAAkB;IAClB,SAAS,CAAC,WAAW,EAAE,yBAAyB;QAC5C,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,kBAAkB;IAClB,yBAAyB,CAAC,WAAW,EAAE,yBAAyB;QAC5D,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAED,cAAc,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC5C,cAAc,CAAC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7C,cAAc,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the StringProperty class\n */\n\nconst _ = require('lodash');\nconst { ValueArrayProperty } = require('./valueArrayProperty');\nconst { ArrayProperty } = require('./arrayProperty');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ChangeSet } = require('@fluid-experimental/property-changeset');\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst { BaseProperty } = require('./baseProperty');\n\nvar MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;\n\n// Some global constant objects that are used to indicate a few special\n// cases for the dirty object. If the string was directly set to a literal,\n// we don't need to store any ChangeSet, we only need to store the information\n// that it was updated to a literal and the dirty flags.\n// By using these special objects we avoid the memory overhead of having a separate\n// object for each array in this state.\nvar PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: 'setAsLiteral',\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE | MODIFIED_STATE_FLAGS.DIRTY\n};\nvar NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: undefined,\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE\n};\n\nvar DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: undefined,\n dirty: 'setAsLiteral',\n _flags: MODIFIED_STATE_FLAGS.DIRTY,\n set flags(flags) {\n this._flags = flags;\n console.log('flags was changed!');\n },\n get flags() {\n return this._flags;\n }\n};\n\nvar STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS = [\n undefined,\n NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE,\n DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE,\n PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE\n];\n\n/**\n * A primitive property for a string value.\n */\nexport class StringProperty extends ValueArrayProperty {\n /**\n * @param {Object=} in_params - the parameters\n * @constructor\n * @protected\n * @extends property-properties.ValueArrayProperty\n * @alias property-properties.StringProperty\n * @category Arrays\n */\n constructor(in_params) {\n super(in_params);\n };\n\n /**\n * Get the string value\n * @return {string} the JavaScript string primitive value of this StringProperty\n */\n getValue() {\n return this._dataArrayRef;\n };\n\n /**\n * Private helper function to update the internal dirty and pending changes\n *\n * @param {property-properties.SerializedChangeSet} in_changeSet - The changeset to apply\n * @private\n */\n _updateChanges(in_changeSet) {\n // we need to convert the format to allow the application of the changes\n // since _performApplyAfterOnPropertyArray only understands insert/modify/remove commands\n var pendingChangesWereSetBefore = false;\n var pendingChanges = this._getPendingChanges();\n\n if (_.isString(pendingChanges)) {\n pendingChanges = { insert: [[0, pendingChanges]] };\n pendingChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(pendingChanges,\n in_changeSet, this.getFullTypeid(true));\n if (pendingChangesWereSetBefore) {\n pendingChanges = pendingChanges.insert[0][1];\n }\n\n var dirtyChangesWereSetBefore = false;\n var dirtyChanges = this._getDirtyChanges();\n\n if (_.isString(dirtyChanges)) {\n dirtyChanges = { insert: [[0, dirtyChanges]] };\n dirtyChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(dirtyChanges,\n in_changeSet, this.getFullTypeid(true));\n if (dirtyChangesWereSetBefore) {\n dirtyChanges = dirtyChanges.insert[0][1];\n }\n\n this._setChanges(pendingChanges, dirtyChanges);\n };\n\n _getPendingChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n }\n\n return (this._dirty && this._dirty.pending) || {};\n };\n\n _getDirtyChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n } else if (this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return {};\n }\n\n return (this._dirty && this._dirty.dirty) || {};\n };\n\n /**\n * inserts a string starting at a position and shifts the rest of\n * the String to the right. Will not overwrite existing values.\n * @param {number} in_position target index\n * @param {string} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n * @throws if in_value is not a string\n */\n insert(in_position, in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(in_position, in_value);\n };\n\n /**\n * Adds letters to the end of the string\n * @param {string} in_value the string to be pushed\n * @throws if in_value is not a string\n * @return {number} the new length of the string.\n */\n push(in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(this._dataArrayRef.length, in_value);\n return this.getLength();\n };\n\n\n /**\n * inserts values\n * @param {number} in_position target index\n * @param {string} in_value the string to be inserted\n */\n _insertRange(in_position, in_value) {\n this._checkIsNotReadOnly(true);\n this._insertRangeWithoutDirtying(in_position, in_value);\n this._setDirty();\n };\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * since that is not aplicable here, this param is ignored\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection) {\n return this._typeid;\n };\n\n /**\n * returns the String to an empty string.\n */\n clear() {\n this.setValue('');\n };\n\n /**\n * removes a given number of elements from the array property and shifts\n * remaining values to the left.\n * @param {number} in_offset target start index\n * @param {number} in_deleteCount number of elements to be deleted\n * @throws if in_offset is not a number\n * @throws if in_deleteCount is not a number\n * @throws if trying to remove an item with a parent\n * @throws if in_offset is smaller than zero or if in_offset + in_delete count is larger than the length of the array\n * @return {String} the part of the string that was removed.\n */\n removeRange(in_offset, in_deleteCount) {\n ConsoleUtils.assert(_.isNumber(in_offset),\n MSG.NOT_NUMBER + 'in_offset, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(_.isNumber(in_deleteCount),\n MSG.NOT_NUMBER + 'in_deleteCount, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0,\n MSG.REMOVE_OUT_OF_BOUNDS + 'Cannot remove ' + in_deleteCount + ' items starting at index ' + in_offset);\n var result = '';\n for (var i = in_offset; i < in_offset + in_deleteCount; i++) {\n result += this.get(i);\n }\n this._checkIsNotReadOnly(true);\n this._removeRangeWithoutDirtying(in_offset, in_deleteCount);\n this._setDirty();\n return result;\n };\n\n\n /**\n * @inheritdoc\n */\n _deserialize(in_serializedObj, in_reportToView,\n in_filteringOptions, in_createChangeSet) {\n if ((in_serializedObj.remove && in_serializedObj.remove.length > 0) ||\n (in_serializedObj.modify && in_serializedObj.modify.length > 0) ||\n (in_serializedObj.insert &&\n (in_serializedObj.insert.length > 1 ||\n (in_serializedObj.insert.length === 1 &&\n (in_serializedObj.insert[0][0] !== 0 ||\n !_.isString(in_serializedObj.insert[0][1])))))) {\n throw new Error(MSG.NO_NORMALIZED_CHANGESET);\n }\n\n var oldStringLength = this._dataArrayRef.length;\n var newStringData;\n if (_.isString(in_serializedObj)) {\n if (this._setValue(in_serializedObj, in_reportToView)) {\n return in_serializedObj;\n } else {\n return {};\n }\n } else {\n if (!in_serializedObj.insert ||\n !in_serializedObj.insert[0]) {\n // we've got an empty object, so we have to wipe everything we've got\n if (oldStringLength > 0) {\n this.removeRange(0, oldStringLength, in_reportToView);\n return {\n remove: [[0, oldStringLength]]\n };\n } else {\n // the string was already empty, nothing has changed\n return {};\n }\n } else {\n newStringData = in_serializedObj.insert[0][1];\n }\n }\n\n if (newStringData === this._dataArrayRef) {\n // nothing changed\n return {};\n }\n\n // check if something was attached (very common case)\n if (newStringData.length > oldStringLength) {\n if (newStringData.substring(0, oldStringLength) === this._dataArrayRef) {\n var appendChanges = {\n insert: [[oldStringLength, newStringData.substring(oldStringLength)]]\n };\n this.insertRange(oldStringLength, newStringData.substring(oldStringLength), in_reportToView);\n return appendChanges;\n }\n }\n\n // most simplistic diff method: Remove all existing data and insert the new data\n var simpleChanges = {\n insert: [[0, newStringData]]\n };\n if (oldStringLength > 0) {\n simpleChanges.remove = [[0, oldStringLength]];\n this._removeRangeWithoutDirtying(0, oldStringLength, in_reportToView);\n }\n this.insertRange(0, newStringData, in_reportToView);\n return simpleChanges;\n };\n\n /**\n * Serialize the property\n *\n * @param {boolean} in_dirtyOnly -\n * Only include dirty entries in the serialization\n * @param {boolean} in_includeRootTypeid -\n * Include the typeid of the root of the hierarchy - has no effect for ArrayProperty\n * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] -\n * The type of dirtiness to use when reporting dirty changes. By default this is\n * PENDING_CHANGE\n * @param {boolean} [in_includeReferencedRepositories=false] - If this is set to true, the serialize\n * function will descend into referenced repositories. WARNING: if there are loops in the references\n * this can result in an infinite loop\n *\n * @return {Object} The serialized representation of this property\n * @private\n */\n _serialize(in_dirtyOnly, in_includeRootTypeid,\n in_dirtinessType, in_includeReferencedRepositories) {\n if (in_dirtyOnly) {\n return ArrayProperty.prototype._serialize.call(this, in_dirtyOnly, in_includeRootTypeid, in_dirtinessType);\n } else {\n // returns just the current data\n return this._dataArrayRef;\n }\n };\n\n /**\n * @param {string} in_value the new value\n * @throws if string property is read only\n */\n setValue(in_value) {\n this._checkIsNotReadOnly(true);\n this._setValue(in_value, true);\n };\n\n /**\n * @param {string} in_values the new values\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @see {setValues}\n */\n _setValues(in_values, in_initial) {\n throw new Error(MSG.NO_VALUE_PROPERTY_SETVALUES);\n };\n\n /**\n * @param {string} in_values the new values\n * @throws always - cannot use .setValues on a StringProperty. Use .setValue() instead.\n */\n setValues(in_values) {\n StringProperty.prototype._setValues.call(this, in_values, false);\n };\n\n /**\n * @throws always - cannot call .getValues on a string. Use .getValue() instead\n */\n getValues() {\n throw new Error(MSG.NO_VALUE_PROPERTY_GETVALUES);\n };\n\n\n /**\n * Internal function to update the value of a property\n *\n * @param {string} in_value the new value\n * @param {boolean} [in_reportToView = true] - By default, the dirtying will always be reported to the checkout view\n * and trigger a modified event there. When batching updates, this\n * can be prevented via this flag.\n * @return {boolean} true if the value was actually changed\n */\n _setValue(in_value, in_reportToView) {\n var oldValue = this._dataArrayRef;\n var castedValue = String(in_value);\n var changed = castedValue !== oldValue;\n if (changed) {\n\n var stringLength = this._dataArrayRef.length;\n if (stringLength > 0) {\n this._dataArrayRemoveRange(0, stringLength);\n }\n this._dataArrayInsertRange(0, castedValue);\n\n this._dirty = PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE;\n\n // The assignment in the line above already set this property to\n // dirty, so we only update the parent (instead of calling\n // setDirty on this property)\n if (this._parent) {\n this._parent._setDirty(in_reportToView, this);\n } else if (in_reportToView === true || in_reportToView === undefined) {\n this._reportDirtinessToView();\n }\n }\n return changed;\n };\n\n /**\n * Sets the pending and dirty changesets\n *\n * @param {property-properties.SerializedChangeSet|undefined|null} in_pending\n * The pending changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n * @param {property-properties.SerializedChangeSet|undefined|null} in_dirty\n * The dirty changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n */\n _setChanges(in_pending, in_dirty) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n let newFlags = this._dirty.flags;\n if (in_pending === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE;\n }\n if (in_dirty === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.DIRTY;\n }\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[newFlags];\n } else {\n ArrayProperty.prototype._setChanges.call(this, in_pending, in_dirty);\n }\n };\n\n /**\n * Sets the dirty flags for this property\n * @param {Number} in_flags The dirty flags\n */\n _setDirtyFlags(in_flags) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[in_flags];\n return;\n }\n\n ArrayProperty.prototype._setDirtyFlags.call(this, in_flags);\n };\n\n /**\n * Gets the dirty flags for this property\n * @return {Number} The dirty flags\n */\n _getDirtyFlags() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this._dirty.flags;\n }\n\n return ArrayProperty.prototype._getDirtyFlags.call(this);\n };\n\n /**\n * @inheritdoc\n */\n _applyChangeset(in_changeSet, in_reportToView) {\n // It is unfortunate, but because StringProperty derives from ArrayProperty, it can happen\n // that we receive here a ChangeSet that is formatted for an Array. We must be able to\n // distinguish it from a reversible changeset and from a simple changeset...\n // TODO: We need a formal way to know what kind of content we are to expect in a ChangeSet,\n // we should never have to guess that.\n if (typeof in_changeSet === 'string') {\n // Let's consider it's a simple changeset.\n this._setValue(in_changeSet, in_reportToView);\n } else if (in_changeSet.value !== undefined) {\n // Let's consider it's a reversible changeset.\n this._setValue(in_changeSet.value, in_reportToView);\n } else {\n // Let's consider it's an ArrayProperty-like changeset\n ArrayProperty.prototype._applyChangeset.call(this, in_changeSet, in_reportToView);\n }\n };\n\n /**\n * Calls back the given function with a human-readable string\n * representation of the property.\n * @param {string} indent - Leading spaces to create the tree representation\n * @param {string} externalId - Name of the current property at the upper level.\n * Used for arrays.\n * @param {function} printFct - Function to call for printing each property\n */\n _prettyPrint(indent, externalId, printFct) {\n printFct(indent + externalId + this.getId() + ' (' + this.getTypeid() + '): \"' + this.value + '\"');\n };\n\n /**\n * Return a JSON representation of the property.\n * @return {object} A JSON representation of the property.\n * @private\n */\n _toJson() {\n return {\n id: this.getId(),\n context: this._context,\n typeid: this.getTypeid(),\n isConstant: this._isConstant,\n value: this.value\n };\n };\n\n /**\n * Sets the value of a character at a single index.\n * For example, if you have a string of value 'AAAA' and do .set(1, 'a') => 'AaAA'\n * @param {number} in_index the index you wish to set\n * @param {string} in_character the character you wish to set\n * @throws if length of in_character is longer than one character\n */\n set(in_index, in_character) {\n ConsoleUtils.assert(_.isNumber(in_index), MSG.STRING_SET_NEEDS_INDEX + in_index);\n\n if (in_character.length !== 1) {\n throw new Error(MSG.STRING_SET_ONE_CHAR);\n }\n\n this.setRange(in_index, in_character);\n };\n\n /**\n * sets values in a string starting at an index.\n * For example, if you have a string of Value 'AAAA' and do .setRange(1, 'aa') => AaaA\n * It will set as many letters as are in in_string.\n * @param {number} in_index the index at which you wish to start setting\n * @param {string} in_string the string you wish to set\n * @throws if in_index + length of in_string is longer than the original string\n */\n setRange(in_index, in_string) {\n ArrayProperty.prototype.setRange.call(this, in_index, in_string);\n };\n\n /**\n * get a letter at a given index\n * @param {number} in_index the index\n * @return {string} the single letter found at in_index\n */\n get(in_index) {\n return ArrayProperty.prototype.get.call(this, in_index);\n };\n\n /**\n * inserts a string starting at a position and shifts the rest of the String to the right.\n * Will not overwrite existing values.\n * For StringProperty, insert and insertRange work the same, except that .insert\n * checks that in_value is a string and .insertRange will accept an array of strings.\n * @param {number} in_position target index\n * @param {string | array<string>} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n */\n insertRange(in_position, in_value) {\n if (_.isArray(in_value)) {\n in_value = in_value.join('');\n }\n this._insertRange(in_position, in_value);\n };\n\n /**\n * Creates and initializes the data array\n * @param {Number} in_length the initial length of the array\n */\n _dataArrayCreate(in_length) {\n this._dataArrayRef = '';\n };\n\n /**\n * Returns the length of the data array\n * @return {Number} The length\n */\n _dataArrayGetLength() {\n return this._dataArrayRef.length;\n };\n\n /**\n * Returns the data array's internal buffer\n * @return {Array} The buffer\n */\n _dataArrayGetBuffer() {\n return this._dataArrayRef;\n };\n\n /**\n * Returns an entry from the data array\n * @param {Number} in_i - Position in the array\n *\n * @return {*} The value at index in_i\n */\n _dataArrayGetValue(in_i) {\n in_i = in_i === undefined ? 0 : in_i;\n if (in_i >= this._size || in_i < 0) {\n throw new Error('Trying to access out of bounds!');\n }\n\n return this._dataArrayRef[in_i];\n };\n\n /**\n * Set the array to the given new array\n * @param {String} in_newString - The new contents of the array\n */\n _dataArrayDeserialize(in_newString) {\n this._dataArrayRef = in_newString;\n };\n\n /**\n * Inserts a range into the data array\n * @param {Number} in_position - Position at which the insert should be done\n * @param {String} in_range - The array to insert\n */\n _dataArrayInsertRange(in_position, in_range) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_range + this._dataArrayRef.substr(in_position);\n };\n\n /**\n * Removes a range from the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {Number} in_length - The number of entries to remove\n */\n _dataArrayRemoveRange(in_position, in_length) {\n if (in_position + in_length < this._dataArrayRef.length + 1) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) +\n this._dataArrayRef.substr(in_position + in_length);\n } else {\n throw Error('DataArray removeRange in_offset + in_deleteCount is out of bounds.');\n }\n };\n\n /**\n * Overwrites a range in the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {String} in_values - The string with which the range is overwritten\n */\n _dataArraySetRange(in_position, in_values) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_values +\n this._dataArrayRef.substr(in_position + in_values.length);\n };\n\n\n get value() {\n return this.getValue();\n }\n\n set value(val) {\n this.setValue.call(this, val);\n }\n\n /** @inheritdoc */\n _traverse(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n\n /** @inheritdoc */\n _traverseStaticProperties(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n}\n\nStringProperty.prototype._typeid = 'String';\nStringProperty.prototype._context = 'single';\nStringProperty.prototype._noDirtyInBase = true;\n"]}
|
|
1
|
+
{"version":3,"file":"stringProperty.js","sourceRoot":"","sources":["../../src/properties/stringProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAEH,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACxE,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,CAA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,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,SAAS;YACtE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK,CAAC,GAAG;QACT,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,kBAAkB;IAClB,SAAS,CAAC,WAAW,EAAE,yBAAyB;QAC5C,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,kBAAkB;IAClB,yBAAyB,CAAC,WAAW,EAAE,yBAAyB;QAC5D,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAED,cAAc,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC5C,cAAc,CAAC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7C,cAAc,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the StringProperty class\n */\n\nconst { ChangeSet } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { ArrayProperty } = require('./arrayProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { ValueArrayProperty } = require('./valueArrayProperty');\n\nvar MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;\n\n// Some global constant objects that are used to indicate a few special\n// cases for the dirty object. If the string was directly set to a literal,\n// we don't need to store any ChangeSet, we only need to store the information\n// that it was updated to a literal and the dirty flags.\n// By using these special objects we avoid the memory overhead of having a separate\n// object for each array in this state.\nvar PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: 'setAsLiteral',\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE | MODIFIED_STATE_FLAGS.DIRTY,\n};\nvar NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: 'setAsLiteral',\n dirty: undefined,\n flags: MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n};\n\nvar DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE = {\n pending: undefined,\n dirty: 'setAsLiteral',\n _flags: MODIFIED_STATE_FLAGS.DIRTY,\n set flags(flags) {\n this._flags = flags;\n console.log('flags was changed!');\n },\n get flags() {\n return this._flags;\n },\n};\n\nvar STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS = [\n undefined,\n NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE,\n DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE,\n PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE,\n];\n\n/**\n * A primitive property for a string value.\n */\nexport class StringProperty extends ValueArrayProperty {\n /**\n * @param {Object=} in_params - the parameters\n * @constructor\n * @protected\n * @extends property-properties.ValueArrayProperty\n * @alias property-properties.StringProperty\n * @category Arrays\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Get the string value\n * @return {string} the JavaScript string primitive value of this StringProperty\n */\n getValue() {\n return this._dataArrayRef;\n }\n\n /**\n * Private helper function to update the internal dirty and pending changes\n *\n * @param {property-properties.SerializedChangeSet} in_changeSet - The changeset to apply\n * @private\n */\n _updateChanges(in_changeSet) {\n // we need to convert the format to allow the application of the changes\n // since _performApplyAfterOnPropertyArray only understands insert/modify/remove commands\n var pendingChangesWereSetBefore = false;\n var pendingChanges = this._getPendingChanges();\n\n if (_.isString(pendingChanges)) {\n pendingChanges = { insert: [[0, pendingChanges]] };\n pendingChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(pendingChanges,\n in_changeSet, this.getFullTypeid(true));\n if (pendingChangesWereSetBefore) {\n pendingChanges = pendingChanges.insert[0][1];\n }\n\n var dirtyChangesWereSetBefore = false;\n var dirtyChanges = this._getDirtyChanges();\n\n if (_.isString(dirtyChanges)) {\n dirtyChanges = { insert: [[0, dirtyChanges]] };\n dirtyChangesWereSetBefore = true;\n }\n ChangeSet.prototype._performApplyAfterOnPropertyArray(dirtyChanges,\n in_changeSet, this.getFullTypeid(true));\n if (dirtyChangesWereSetBefore) {\n dirtyChanges = dirtyChanges.insert[0][1];\n }\n\n this._setChanges(pendingChanges, dirtyChanges);\n }\n\n _getPendingChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n }\n\n return (this._dirty && this._dirty.pending) || {};\n }\n\n _getDirtyChanges() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this.getValue();\n } else if (this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE) {\n return {};\n }\n\n return (this._dirty && this._dirty.dirty) || {};\n }\n\n /**\n * inserts a string starting at a position and shifts the rest of\n * the String to the right. Will not overwrite existing values.\n * @param {number} in_position target index\n * @param {string} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n * @throws if in_value is not a string\n */\n insert(in_position, in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(in_position, in_value);\n }\n\n /**\n * Adds letters to the end of the string\n * @param {string} in_value the string to be pushed\n * @throws if in_value is not a string\n * @return {number} the new length of the string.\n */\n push(in_value) {\n ConsoleUtils.assert(_.isString(in_value), MSG.IN_VALUE_MUST_BE_STRING + in_value);\n this._insertRange(this._dataArrayRef.length, in_value);\n return this.getLength();\n }\n\n /**\n * inserts values\n * @param {number} in_position target index\n * @param {string} in_value the string to be inserted\n */\n _insertRange(in_position, in_value) {\n this._checkIsNotReadOnly(true);\n this._insertRangeWithoutDirtying(in_position, in_value);\n this._setDirty();\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * since that is not aplicable here, this param is ignored\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection) {\n return this._typeid;\n }\n\n /**\n * returns the String to an empty string.\n */\n clear() {\n this.setValue('');\n }\n\n /**\n * removes a given number of elements from the array property and shifts\n * remaining values to the left.\n * @param {number} in_offset target start index\n * @param {number} in_deleteCount number of elements to be deleted\n * @throws if in_offset is not a number\n * @throws if in_deleteCount is not a number\n * @throws if trying to remove an item with a parent\n * @throws if in_offset is smaller than zero or if in_offset + in_delete count is larger than the length of the array\n * @return {String} the part of the string that was removed.\n */\n removeRange(in_offset, in_deleteCount) {\n ConsoleUtils.assert(_.isNumber(in_offset),\n MSG.NOT_NUMBER + 'in_offset, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(_.isNumber(in_deleteCount),\n MSG.NOT_NUMBER + 'in_deleteCount, method: StringProperty.remove or .removeRange');\n ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0,\n MSG.REMOVE_OUT_OF_BOUNDS + 'Cannot remove ' + in_deleteCount + ' items starting at index ' + in_offset);\n var result = '';\n for (var i = in_offset; i < in_offset + in_deleteCount; i++) {\n result += this.get(i);\n }\n this._checkIsNotReadOnly(true);\n this._removeRangeWithoutDirtying(in_offset, in_deleteCount);\n this._setDirty();\n return result;\n }\n\n /**\n * @inheritdoc\n */\n _deserialize(in_serializedObj, in_reportToView,\n in_filteringOptions, in_createChangeSet) {\n if ((in_serializedObj.remove && in_serializedObj.remove.length > 0) ||\n (in_serializedObj.modify && in_serializedObj.modify.length > 0) ||\n (in_serializedObj.insert &&\n (in_serializedObj.insert.length > 1 ||\n (in_serializedObj.insert.length === 1 &&\n (in_serializedObj.insert[0][0] !== 0 ||\n !_.isString(in_serializedObj.insert[0][1])))))) {\n throw new Error(MSG.NO_NORMALIZED_CHANGESET);\n }\n\n var oldStringLength = this._dataArrayRef.length;\n var newStringData;\n if (_.isString(in_serializedObj)) {\n if (this._setValue(in_serializedObj, in_reportToView)) {\n return in_serializedObj;\n } else {\n return {};\n }\n } else {\n if (!in_serializedObj.insert ||\n !in_serializedObj.insert[0]) {\n // we've got an empty object, so we have to wipe everything we've got\n if (oldStringLength > 0) {\n this.removeRange(0, oldStringLength, in_reportToView);\n return {\n remove: [[0, oldStringLength]],\n };\n } else {\n // the string was already empty, nothing has changed\n return {};\n }\n } else {\n newStringData = in_serializedObj.insert[0][1];\n }\n }\n\n if (newStringData === this._dataArrayRef) {\n // nothing changed\n return {};\n }\n\n // check if something was attached (very common case)\n if (newStringData.length > oldStringLength) {\n if (newStringData.substring(0, oldStringLength) === this._dataArrayRef) {\n var appendChanges = {\n insert: [[oldStringLength, newStringData.substring(oldStringLength)]],\n };\n this.insertRange(oldStringLength, newStringData.substring(oldStringLength), in_reportToView);\n return appendChanges;\n }\n }\n\n // most simplistic diff method: Remove all existing data and insert the new data\n var simpleChanges = {\n insert: [[0, newStringData]],\n };\n if (oldStringLength > 0) {\n simpleChanges.remove = [[0, oldStringLength]];\n this._removeRangeWithoutDirtying(0, oldStringLength, in_reportToView);\n }\n this.insertRange(0, newStringData, in_reportToView);\n return simpleChanges;\n }\n\n /**\n * Serialize the property\n *\n * @param {boolean} in_dirtyOnly -\n * Only include dirty entries in the serialization\n * @param {boolean} in_includeRootTypeid -\n * Include the typeid of the root of the hierarchy - has no effect for ArrayProperty\n * @param {property-properties.BaseProperty.MODIFIED_STATE_FLAGS} [in_dirtinessType] -\n * The type of dirtiness to use when reporting dirty changes. By default this is\n * PENDING_CHANGE\n * @param {boolean} [in_includeReferencedRepositories=false] - If this is set to true, the serialize\n * function will descend into referenced repositories. WARNING: if there are loops in the references\n * this can result in an infinite loop\n *\n * @return {Object} The serialized representation of this property\n * @private\n */\n _serialize(in_dirtyOnly, in_includeRootTypeid,\n in_dirtinessType, in_includeReferencedRepositories) {\n if (in_dirtyOnly) {\n return ArrayProperty.prototype._serialize.call(this, in_dirtyOnly, in_includeRootTypeid, in_dirtinessType);\n } else {\n // returns just the current data\n return this._dataArrayRef;\n }\n }\n\n /**\n * @param {string} in_value the new value\n * @throws if string property is read only\n */\n setValue(in_value) {\n this._checkIsNotReadOnly(true);\n this._setValue(in_value, true);\n }\n\n /**\n * @param {string} in_values the new values\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @see {setValues}\n */\n _setValues(in_values, in_initial) {\n throw new Error(MSG.NO_VALUE_PROPERTY_SETVALUES);\n }\n\n /**\n * @param {string} in_values the new values\n * @throws always - cannot use .setValues on a StringProperty. Use .setValue() instead.\n */\n setValues(in_values) {\n StringProperty.prototype._setValues.call(this, in_values, false);\n }\n\n /**\n * @throws always - cannot call .getValues on a string. Use .getValue() instead\n */\n getValues() {\n throw new Error(MSG.NO_VALUE_PROPERTY_GETVALUES);\n }\n\n /**\n * Internal function to update the value of a property\n *\n * @param {string} in_value the new value\n * @param {boolean} [in_reportToView = true] - By default, the dirtying will always be reported to the checkout view\n * and trigger a modified event there. When batching updates, this\n * can be prevented via this flag.\n * @return {boolean} true if the value was actually changed\n */\n _setValue(in_value, in_reportToView) {\n var oldValue = this._dataArrayRef;\n var castedValue = String(in_value);\n var changed = castedValue !== oldValue;\n if (changed) {\n var stringLength = this._dataArrayRef.length;\n if (stringLength > 0) {\n this._dataArrayRemoveRange(0, stringLength);\n }\n this._dataArrayInsertRange(0, castedValue);\n\n this._dirty = PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE;\n\n // The assignment in the line above already set this property to\n // dirty, so we only update the parent (instead of calling\n // setDirty on this property)\n if (this._parent) {\n this._parent._setDirty(in_reportToView, this);\n } else if (in_reportToView === true || in_reportToView === undefined) {\n this._reportDirtinessToView();\n }\n }\n return changed;\n }\n\n /**\n * Sets the pending and dirty changesets\n *\n * @param {property-properties.SerializedChangeSet|undefined|null} in_pending\n * The pending changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n * @param {property-properties.SerializedChangeSet|undefined|null} in_dirty\n * The dirty changeset. If null is passed, no change will be\n * applied. undefined indicates that the changes should be reset\n */\n _setChanges(in_pending, in_dirty) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n let newFlags = this._dirty.flags;\n if (in_pending === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE;\n }\n if (in_dirty === undefined) {\n newFlags &= 0xFFFFFFFF ^ BaseProperty.MODIFIED_STATE_FLAGS.DIRTY;\n }\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[newFlags];\n } else {\n ArrayProperty.prototype._setChanges.call(this, in_pending, in_dirty);\n }\n }\n\n /**\n * Sets the dirty flags for this property\n * @param {Number} in_flags The dirty flags\n */\n _setDirtyFlags(in_flags) {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n this._dirty = STRING_PROPERTY_SET_PROPERTY_VALUE_STATE_FLAGS[in_flags];\n return;\n }\n\n ArrayProperty.prototype._setDirtyFlags.call(this, in_flags);\n }\n\n /**\n * Gets the dirty flags for this property\n * @return {Number} The dirty flags\n */\n _getDirtyFlags() {\n if (this._dirty === PENDING_AND_DIRTY_SET_TO_PROPERTY_VALUE ||\n this._dirty === NO_DIRTY_AND_PENDING_SET_TO_PROPERTY_VALUE ||\n this._dirty === DIRTY_AND_NO_PENDING_SET_TO_PROPERTY_VALUE) {\n return this._dirty.flags;\n }\n\n return ArrayProperty.prototype._getDirtyFlags.call(this);\n }\n\n /**\n * @inheritdoc\n */\n _applyChangeset(in_changeSet, in_reportToView) {\n // It is unfortunate, but because StringProperty derives from ArrayProperty, it can happen\n // that we receive here a ChangeSet that is formatted for an Array. We must be able to\n // distinguish it from a reversible changeset and from a simple changeset...\n // TODO: We need a formal way to know what kind of content we are to expect in a ChangeSet,\n // we should never have to guess that.\n if (typeof in_changeSet === 'string') {\n // Let's consider it's a simple changeset.\n this._setValue(in_changeSet, in_reportToView);\n } else if (in_changeSet.value !== undefined) {\n // Let's consider it's a reversible changeset.\n this._setValue(in_changeSet.value, in_reportToView);\n } else {\n // Let's consider it's an ArrayProperty-like changeset\n ArrayProperty.prototype._applyChangeset.call(this, in_changeSet, in_reportToView);\n }\n }\n\n /**\n * Calls back the given function with a human-readable string\n * representation of the property.\n * @param {string} indent - Leading spaces to create the tree representation\n * @param {string} externalId - Name of the current property at the upper level.\n * Used for arrays.\n * @param {function} printFct - Function to call for printing each property\n */\n _prettyPrint(indent, externalId, printFct) {\n printFct(indent + externalId + this.getId() + ' (' + this.getTypeid() + '): \"' + this.value + '\"');\n }\n\n /**\n * Return a JSON representation of the property.\n * @return {object} A JSON representation of the property.\n * @private\n */\n _toJson() {\n return {\n id: this.getId(),\n context: this._context,\n typeid: this.getTypeid(),\n isConstant: this._isConstant,\n value: this.value,\n };\n }\n\n /**\n * Sets the value of a character at a single index.\n * For example, if you have a string of value 'AAAA' and do .set(1, 'a') => 'AaAA'\n * @param {number} in_index the index you wish to set\n * @param {string} in_character the character you wish to set\n * @throws if length of in_character is longer than one character\n */\n set(in_index, in_character) {\n ConsoleUtils.assert(_.isNumber(in_index), MSG.STRING_SET_NEEDS_INDEX + in_index);\n\n if (in_character.length !== 1) {\n throw new Error(MSG.STRING_SET_ONE_CHAR);\n }\n\n this.setRange(in_index, in_character);\n }\n\n /**\n * sets values in a string starting at an index.\n * For example, if you have a string of Value 'AAAA' and do .setRange(1, 'aa') => AaaA\n * It will set as many letters as are in in_string.\n * @param {number} in_index the index at which you wish to start setting\n * @param {string} in_string the string you wish to set\n * @throws if in_index + length of in_string is longer than the original string\n */\n setRange(in_index, in_string) {\n ArrayProperty.prototype.setRange.call(this, in_index, in_string);\n }\n\n /**\n * get a letter at a given index\n * @param {number} in_index the index\n * @return {string} the single letter found at in_index\n */\n get(in_index) {\n return ArrayProperty.prototype.get.call(this, in_index);\n }\n\n /**\n * inserts a string starting at a position and shifts the rest of the String to the right.\n * Will not overwrite existing values.\n * For StringProperty, insert and insertRange work the same, except that .insert\n * checks that in_value is a string and .insertRange will accept an array of strings.\n * @param {number} in_position target index\n * @param {string | array<string>} in_value value to be inserted\n * @throws if in_position is smaller than zero, larger than the length of the string or not a number\n */\n insertRange(in_position, in_value) {\n if (_.isArray(in_value)) {\n in_value = in_value.join('');\n }\n this._insertRange(in_position, in_value);\n }\n\n /**\n * Creates and initializes the data array\n * @param {Number} in_length the initial length of the array\n */\n _dataArrayCreate(in_length) {\n this._dataArrayRef = '';\n }\n\n /**\n * Returns the length of the data array\n * @return {Number} The length\n */\n _dataArrayGetLength() {\n return this._dataArrayRef.length;\n }\n\n /**\n * Returns the data array's internal buffer\n * @return {Array} The buffer\n */\n _dataArrayGetBuffer() {\n return this._dataArrayRef;\n }\n\n /**\n * Returns an entry from the data array\n * @param {Number} in_i - Position in the array\n *\n * @return {*} The value at index in_i\n */\n _dataArrayGetValue(in_i) {\n in_i = in_i === undefined ? 0 : in_i;\n if (in_i >= this._size || in_i < 0) {\n throw new Error('Trying to access out of bounds!');\n }\n\n return this._dataArrayRef[in_i];\n }\n\n /**\n * Set the array to the given new array\n * @param {String} in_newString - The new contents of the array\n */\n _dataArrayDeserialize(in_newString) {\n this._dataArrayRef = in_newString;\n }\n\n /**\n * Inserts a range into the data array\n * @param {Number} in_position - Position at which the insert should be done\n * @param {String} in_range - The array to insert\n */\n _dataArrayInsertRange(in_position, in_range) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_range + this._dataArrayRef.substr(in_position);\n }\n\n /**\n * Removes a range from the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {Number} in_length - The number of entries to remove\n */\n _dataArrayRemoveRange(in_position, in_length) {\n if (in_position + in_length < this._dataArrayRef.length + 1) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) +\n this._dataArrayRef.substr(in_position + in_length);\n } else {\n throw Error('DataArray removeRange in_offset + in_deleteCount is out of bounds.');\n }\n }\n\n /**\n * Overwrites a range in the data array\n * @param {Number} in_position - Position at which to start the removal\n * @param {String} in_values - The string with which the range is overwritten\n */\n _dataArraySetRange(in_position, in_values) {\n this._dataArrayRef = this._dataArrayRef.substr(0, in_position) + in_values +\n this._dataArrayRef.substr(in_position + in_values.length);\n }\n\n get value() {\n return this.getValue();\n }\n\n set value(val) {\n this.setValue.call(this, val);\n }\n\n /** @inheritdoc */\n _traverse(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n\n /** @inheritdoc */\n _traverseStaticProperties(in_callback, in_pathFromTraversalStart) {\n return undefined;\n }\n}\n\nStringProperty.prototype._typeid = 'String';\nStringProperty.prototype._context = 'single';\nStringProperty.prototype._noDirtyInBase = true;\n"]}
|
|
@@ -24,7 +24,6 @@ export class Uint8Property extends ValueProperty {
|
|
|
24
24
|
// default for this property type is '0'
|
|
25
25
|
this._data = 0;
|
|
26
26
|
}
|
|
27
|
-
;
|
|
28
27
|
}
|
|
29
28
|
Uint8Property.prototype._typeid = 'Uint8';
|
|
30
29
|
Uint8Property.prototype._castFunctor = _castFunctors.Uint8;
|
|
@@ -45,7 +44,6 @@ export class Uint16Property extends ValueProperty {
|
|
|
45
44
|
// default for this property type is '0'
|
|
46
45
|
this._data = 0;
|
|
47
46
|
}
|
|
48
|
-
;
|
|
49
47
|
}
|
|
50
48
|
Uint16Property.prototype._typeid = 'Uint16';
|
|
51
49
|
Uint16Property.prototype._castFunctor = _castFunctors.Uint16;
|
|
@@ -66,7 +64,6 @@ export class Uint32Property extends ValueProperty {
|
|
|
66
64
|
// default for this property type is '0'
|
|
67
65
|
this._data = 0;
|
|
68
66
|
}
|
|
69
|
-
;
|
|
70
67
|
}
|
|
71
68
|
Uint32Property.prototype._typeid = 'Uint32';
|
|
72
69
|
Uint32Property.prototype._castFunctor = _castFunctors.Uint32;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uintProperties.js","sourceRoot":"","sources":["../../src/properties/uintProperties.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAEH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC5C;;;;;;;OAOG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,wCAAwC;QACxC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"uintProperties.js","sourceRoot":"","sources":["../../src/properties/uintProperties.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAEH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC5C;;;;;;;OAOG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,wCAAwC;QACxC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;CACJ;AACD,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1C,aAAa,CAAC,SAAS,CAAC,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC;AAE3D;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,aAAa;IAC7C;;;;;;;OAOG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,wCAAwC;QACxC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;CACJ;AACD,cAAc,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC5C,cAAc,CAAC,SAAS,CAAC,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,aAAa;IAC7C;;;;;;;OAOG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,wCAAwC;QACxC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;CACJ;AACD,cAAc,CAAC,SAAS,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC5C,cAAc,CAAC,SAAS,CAAC,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the Uint32Property class\n */\n\nconst { ValueProperty } = require('./valueProperty');\nconst { _castFunctors } = require('./primitiveTypeCasts');\n\n/**\n * A primitive property for an unsigned 8 bit integer value.\n */\nexport class Uint8Property extends ValueProperty {\n /**\n * @param {Object=} in_params - the parameters\n * @constructor\n * @private\n * @extends property-properties.ValueProperty\n * @alias property-properties.Uint8Property\n * @category Value Properties\n */\n constructor(in_params) {\n super(in_params);\n // default for this property type is '0'\n this._data = 0;\n }\n}\nUint8Property.prototype._typeid = 'Uint8';\nUint8Property.prototype._castFunctor = _castFunctors.Uint8;\n\n/**\n * A primitive property for an unsigned 16 bit integer value.\n */\nexport class Uint16Property extends ValueProperty {\n /**\n * @param {Object=} in_params - the parameters\n * @constructor\n * @private\n * @extends property-properties.ValueProperty\n * @alias property-properties.Uint16Property\n * @category Value Properties\n */\n constructor(in_params) {\n super(in_params);\n // default for this property type is '0'\n this._data = 0;\n }\n}\nUint16Property.prototype._typeid = 'Uint16';\nUint16Property.prototype._castFunctor = _castFunctors.Uint16;\n\n/**\n * A primitive property for an unsigned 32 bit integer value.\n */\nexport class Uint32Property extends ValueProperty {\n /**\n * @param {Object=} in_params - the parameters\n * @constructor\n * @protected\n * @extends property-properties.ValueProperty\n * @alias property-properties.Uint32Property\n * @category Value Properties\n */\n constructor(in_params) {\n super(in_params);\n // default for this property type is '0'\n this._data = 0;\n }\n}\nUint32Property.prototype._typeid = 'Uint32';\nUint32Property.prototype._castFunctor = _castFunctors.Uint32;\n"]}
|