@sumaris-net/ngx-components 2.0.0-rc40 → 2.0.0-rc41
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/esm2020/src/app/core/services/model/entity.decorators.mjs +39 -65
- package/fesm2015/sumaris-net.ngx-components.mjs +38 -64
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +38 -64
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/model/entity.decorators.d.ts +1 -1
|
@@ -11180,73 +11180,47 @@ function EntityClass(opts) {
|
|
|
11180
11180
|
// Define static field TYPENAME
|
|
11181
11181
|
clazz.TYPENAME = typename;
|
|
11182
11182
|
// Define static fromObject()
|
|
11183
|
-
if (
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
};
|
|
11201
|
-
}
|
|
11202
|
-
else {
|
|
11203
|
-
clazz.fromObject = function (source, opts) {
|
|
11204
|
-
if (!source)
|
|
11205
|
-
return undefined;
|
|
11206
|
-
if (source instanceof constructor) {
|
|
11207
|
-
// DEBUG
|
|
11208
|
-
//console.debug('@EntityClass() fromObject() => will recycle existing object: ', source);
|
|
11209
|
-
return source;
|
|
11210
|
-
}
|
|
11211
|
-
const target = new constructor();
|
|
11212
|
-
target.fromObject(source, opts);
|
|
11213
|
-
return target;
|
|
11214
|
-
};
|
|
11215
|
-
clazz.asObject = function (source, opts) {
|
|
11216
|
-
if (!source)
|
|
11217
|
-
return undefined;
|
|
11218
|
-
if (source instanceof constructor) {
|
|
11219
|
-
return source.asObject(opts);
|
|
11220
|
-
}
|
|
11221
|
-
// DEBUG
|
|
11222
|
-
//console.debug('@EntityClass() asObject() => will recycle existing object: ', source);
|
|
11223
|
-
return source;
|
|
11224
|
-
};
|
|
11225
|
-
}
|
|
11183
|
+
if (opts.fromObjectReuseStrategy === 'clone') {
|
|
11184
|
+
clazz.fromObject = function (source, opts) {
|
|
11185
|
+
if (!source)
|
|
11186
|
+
return undefined;
|
|
11187
|
+
if (source instanceof constructor)
|
|
11188
|
+
return source.clone(opts);
|
|
11189
|
+
const target = new constructor();
|
|
11190
|
+
target.fromObject(source, opts);
|
|
11191
|
+
return target;
|
|
11192
|
+
};
|
|
11193
|
+
clazz.asObject = function (source, opts) {
|
|
11194
|
+
if (!source)
|
|
11195
|
+
return undefined;
|
|
11196
|
+
if (source instanceof constructor)
|
|
11197
|
+
return source.asObject(opts);
|
|
11198
|
+
return Object.assign({}, source);
|
|
11199
|
+
};
|
|
11226
11200
|
}
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
return undefined;
|
|
11233
|
-
if (source instanceof constructor)
|
|
11234
|
-
return source.asObject(opts);
|
|
11235
|
-
return Object.assign({}, source);
|
|
11236
|
-
};
|
|
11237
|
-
}
|
|
11238
|
-
else {
|
|
11239
|
-
clazz.asObject = function (source, opts) {
|
|
11240
|
-
if (!source)
|
|
11241
|
-
return undefined;
|
|
11242
|
-
if (source instanceof constructor) {
|
|
11243
|
-
return source.asObject(opts);
|
|
11244
|
-
}
|
|
11201
|
+
else {
|
|
11202
|
+
clazz.fromObject = function (source, opts) {
|
|
11203
|
+
if (!source)
|
|
11204
|
+
return undefined;
|
|
11205
|
+
if (source instanceof constructor) {
|
|
11245
11206
|
// DEBUG
|
|
11246
|
-
//console.debug('@EntityClass()
|
|
11207
|
+
//console.debug('@EntityClass() fromObject() => will recycle existing object: ', source);
|
|
11247
11208
|
return source;
|
|
11248
|
-
}
|
|
11249
|
-
|
|
11209
|
+
}
|
|
11210
|
+
const target = new constructor();
|
|
11211
|
+
target.fromObject(source, opts);
|
|
11212
|
+
return target;
|
|
11213
|
+
};
|
|
11214
|
+
clazz.asObject = function (source, opts) {
|
|
11215
|
+
if (!source)
|
|
11216
|
+
return undefined;
|
|
11217
|
+
if (source instanceof constructor) {
|
|
11218
|
+
return source.asObject(opts);
|
|
11219
|
+
}
|
|
11220
|
+
// DEBUG
|
|
11221
|
+
//console.debug('@EntityClass() asObject() => will recycle existing object: ', source);
|
|
11222
|
+
return source;
|
|
11223
|
+
};
|
|
11250
11224
|
}
|
|
11251
11225
|
// Register the entity class
|
|
11252
11226
|
EntityClasses.register(typename, constructor);
|