@stemy/ngx-utils 12.2.12 → 12.2.14
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/bundles/stemy-ngx-utils.umd.js +23 -18
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/esm2015/ngx-utils/common-types.js +1 -1
- package/esm2015/ngx-utils/pipes/filter.pipe.js +6 -11
- package/esm2015/ngx-utils/pipes/find.pipe.js +7 -9
- package/esm2015/ngx-utils/services/config.service.js +14 -1
- package/fesm2015/stemy-ngx-utils.js +24 -18
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/common-types.d.ts +2 -0
- package/ngx-utils/pipes/find.pipe.d.ts +1 -1
- package/ngx-utils/services/config.service.d.ts +1 -0
- package/package.json +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -3399,6 +3399,19 @@
|
|
|
3399
3399
|
ConfigService.prototype.prepareConfig = function (config) {
|
|
3400
3400
|
return Promise.resolve(config);
|
|
3401
3401
|
};
|
|
3402
|
+
ConfigService.prototype.cloneRootElem = function () {
|
|
3403
|
+
if (this.rootElement instanceof HTMLElement) {
|
|
3404
|
+
var clone = this.rootElement.cloneNode(true);
|
|
3405
|
+
var children = Array.from(clone.childNodes);
|
|
3406
|
+
children.forEach(function (child) {
|
|
3407
|
+
if (child instanceof HTMLElement) {
|
|
3408
|
+
child.remove();
|
|
3409
|
+
}
|
|
3410
|
+
});
|
|
3411
|
+
return clone;
|
|
3412
|
+
}
|
|
3413
|
+
return this.rootElement.cloneNode(true);
|
|
3414
|
+
};
|
|
3402
3415
|
ConfigService.prototype.prepareUrl = function (url, ending) {
|
|
3403
3416
|
var _a;
|
|
3404
3417
|
var project = !this.loadedConfig ? "" : this.loadedConfig.project;
|
|
@@ -4382,25 +4395,20 @@
|
|
|
4382
4395
|
var isObject = ObjectUtils.isObject(values);
|
|
4383
4396
|
if (!isObject && !ObjectUtils.isArray(values))
|
|
4384
4397
|
return [];
|
|
4385
|
-
var filterFunc = ObjectUtils.isFunction(filter) ? filter : function (value, key, params) {
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
key: key,
|
|
4389
|
-
item: value,
|
|
4390
|
-
index: key,
|
|
4391
|
-
params: params
|
|
4392
|
-
});
|
|
4398
|
+
var filterFunc = ObjectUtils.isFunction(filter) ? filter : function (value, key, params, values) {
|
|
4399
|
+
var index = key;
|
|
4400
|
+
return ObjectUtils.evaluate(filter, { value: value, key: key, params: params, values: values, index: index });
|
|
4393
4401
|
};
|
|
4394
4402
|
if (isObject) {
|
|
4395
4403
|
return Object.keys(values).filter(function (key) {
|
|
4396
|
-
return filterFunc(values[key], key, params);
|
|
4404
|
+
return filterFunc(values[key], key, params, values);
|
|
4397
4405
|
}).reduce(function (result, key) {
|
|
4398
4406
|
result[key] = values[key];
|
|
4399
4407
|
return result;
|
|
4400
4408
|
}, {});
|
|
4401
4409
|
}
|
|
4402
4410
|
return values.filter(function (value, key) {
|
|
4403
|
-
return filterFunc(value, key, params);
|
|
4411
|
+
return filterFunc(value, key, params, values);
|
|
4404
4412
|
});
|
|
4405
4413
|
};
|
|
4406
4414
|
return FilterPipe;
|
|
@@ -4419,17 +4427,14 @@
|
|
|
4419
4427
|
}
|
|
4420
4428
|
FindPipe.prototype.transform = function (values, filter, params) {
|
|
4421
4429
|
if (filter === void 0) { filter = defaultFilter; }
|
|
4422
|
-
if (params === void 0) { params = {}; }
|
|
4423
4430
|
if (!ObjectUtils.isArray(values))
|
|
4424
4431
|
return [];
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
params: params
|
|
4430
|
-
});
|
|
4432
|
+
params = params || {};
|
|
4433
|
+
params.values = values;
|
|
4434
|
+
var filterFunc = ObjectUtils.isFunction(filter) ? filter : function (value, index, params, values) {
|
|
4435
|
+
return ObjectUtils.evaluate(filter, { value: value, index: index, params: params, values: values });
|
|
4431
4436
|
};
|
|
4432
|
-
return values.find(function (value, index) { return filterFunc(value, index, params); });
|
|
4437
|
+
return values.find(function (value, index) { return filterFunc(value, index, params, values); });
|
|
4433
4438
|
};
|
|
4434
4439
|
return FindPipe;
|
|
4435
4440
|
}());
|