@stemy/ngx-utils 12.1.4 → 12.2.0
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 +39 -1
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/esm2015/ngx-utils/components/unordered-list/unordered-list.component.js +2 -2
- package/esm2015/ngx-utils/utils/array.utils.js +8 -1
- package/esm2015/ngx-utils/utils/math.utils.js +30 -1
- package/esm2020/ngx-utils/services/acl.service.mjs +3 -1
- package/esm2020/ngx-utils/utils/file-system.mjs +20 -0
- package/esm2020/public_api.mjs +2 -1
- package/fesm2015/stemy-ngx-utils.js +37 -1
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/fesm2015/stemy-ngx-utils.mjs +23 -1
- package/fesm2015/stemy-ngx-utils.mjs.map +1 -1
- package/fesm2020/stemy-ngx-utils.mjs +23 -1
- package/fesm2020/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/utils/array.utils.d.ts +1 -0
- package/ngx-utils/utils/math.utils.d.ts +2 -0
- package/package.json +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -1702,6 +1702,37 @@
|
|
|
1702
1702
|
precision = Math.pow(10, precision);
|
|
1703
1703
|
return Math.round(value * precision / divider) / precision;
|
|
1704
1704
|
};
|
|
1705
|
+
MathUtils.approxIndex = function (x, values, epsilon) {
|
|
1706
|
+
if (epsilon === void 0) { epsilon = null; }
|
|
1707
|
+
if (!Array.isArray(values) || values.length == 0) {
|
|
1708
|
+
return -1;
|
|
1709
|
+
}
|
|
1710
|
+
var s = 0;
|
|
1711
|
+
var e = values.length - 1;
|
|
1712
|
+
while (s <= e) {
|
|
1713
|
+
var i = Math.floor((s + e) / 2);
|
|
1714
|
+
var v = values[i];
|
|
1715
|
+
if (MathUtils.equal(v, x, epsilon)) {
|
|
1716
|
+
return i;
|
|
1717
|
+
}
|
|
1718
|
+
if (v < x) {
|
|
1719
|
+
s = i + 1;
|
|
1720
|
+
}
|
|
1721
|
+
else {
|
|
1722
|
+
e = i - 1;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
var m = Math.max(e, 0);
|
|
1726
|
+
var a = values[s];
|
|
1727
|
+
var b = values[m];
|
|
1728
|
+
return Math.abs(a - x) < Math.abs(b - x) ? s : m;
|
|
1729
|
+
};
|
|
1730
|
+
MathUtils.approximate = function (x, values, epsilon) {
|
|
1731
|
+
if (epsilon === void 0) { epsilon = null; }
|
|
1732
|
+
var _a;
|
|
1733
|
+
var index = MathUtils.approxIndex(x, values, epsilon);
|
|
1734
|
+
return (_a = values[index]) !== null && _a !== void 0 ? _a : null;
|
|
1735
|
+
};
|
|
1705
1736
|
return MathUtils;
|
|
1706
1737
|
}());
|
|
1707
1738
|
|
|
@@ -2539,6 +2570,13 @@
|
|
|
2539
2570
|
}
|
|
2540
2571
|
return result;
|
|
2541
2572
|
};
|
|
2573
|
+
ArrayUtils.unique = function (arr) {
|
|
2574
|
+
if (!ObjectUtils.isArray(arr))
|
|
2575
|
+
return [];
|
|
2576
|
+
return arr.filter(function (value, index, self) {
|
|
2577
|
+
return self.indexOf(value) === index;
|
|
2578
|
+
});
|
|
2579
|
+
};
|
|
2542
2580
|
return ArrayUtils;
|
|
2543
2581
|
}());
|
|
2544
2582
|
|
|
@@ -5564,7 +5602,7 @@
|
|
|
5564
5602
|
UnorderedListComponent.decorators = [
|
|
5565
5603
|
{ type: core.Component, args: [{
|
|
5566
5604
|
selector: "unordered-list",
|
|
5567
|
-
template: "<ng-template let-keyPrefix=\"keyPrefix\" let-key=\"item.key\" let-isArray=\"isArray\" #defaultKeyTemplate>\r\n {{ (keyPrefix ? keyPrefix + key : key) | translate }}:\r\n</ng-template>\r\n<ng-template let-keyPrefix=\"keyPrefix\" let-listStyle=\"listStyle\" let-val=\"item.value\" let-path=\"path\"\r\n let-templates=\"templates\" let-isObject=\"valueIsObject\" let-isArray=\"valueIsArray\" #defaultValueTemplate>\r\n <ng-template #value
|
|
5605
|
+
template: "<ng-template let-keyPrefix=\"keyPrefix\" let-key=\"item.key\" let-isArray=\"isArray\" #defaultKeyTemplate>\r\n {{ (keyPrefix ? keyPrefix + key : key) | translate }}:\r\n</ng-template>\r\n<ng-template let-keyPrefix=\"keyPrefix\" let-listStyle=\"listStyle\" let-val=\"item.value\" let-path=\"path\"\r\n let-templates=\"templates\" let-isObject=\"valueIsObject\" let-isArray=\"valueIsArray\" #defaultValueTemplate>\r\n <ng-template #value>\r\n <span [innerHTML]=\"val\"></span>\r\n </ng-template>\r\n <unordered-list [data]=\"val\"\r\n [keyPrefix]=\"keyPrefix\"\r\n [listStyle]=\"listStyle\"\r\n [path]=\"path\"\r\n [level]=\"level + 1\"\r\n [templates]=\"templates\"\r\n *ngIf=\"(isObject || isArray); else value\"></unordered-list>\r\n</ng-template>\r\n<ng-template let-item=\"item\" let-data=\"data\" let-keyPrefix=\"keyPrefix\" let-listStyle=\"listStyle\" let-path=\"path\" let-level=\"level\" let-templates=\"templates\" #defaultItemTemplate>\r\n <ng-template #itemKey>\r\n <ng-container [unorderedListItem]=\"item\"\r\n type=\"key\"\r\n [data]=\"data\"\r\n [keyPrefix]=\"keyPrefix\"\r\n [listStyle]=\"listStyle\"\r\n [path]=\"path\"\r\n [level]=\"level\"\r\n [templates]=\"templates\"\r\n [defaultTemplates]=\"defaultTemplates\"></ng-container>\r\n </ng-template>\r\n <ng-template #itemValue>\r\n <ng-container [unorderedListItem]=\"item\"\r\n type=\"value\"\r\n [data]=\"data\"\r\n [keyPrefix]=\"keyPrefix\"\r\n [listStyle]=\"listStyle\"\r\n [path]=\"path\"\r\n [level]=\"level\"\r\n [templates]=\"templates\"\r\n [defaultTemplates]=\"defaultTemplates\"></ng-container>\r\n </ng-template>\r\n <ng-container *ngIf=\"!isArray\">\r\n <th *ngIf=\"listStyle == 'table'; else itemKey\">\r\n <ng-container [ngTemplateOutlet]=\"itemKey\"></ng-container>\r\n </th>\r\n </ng-container>\r\n <td *ngIf=\"listStyle == 'table'; else itemValue\">\r\n <ng-container [ngTemplateOutlet]=\"itemValue\"></ng-container>\r\n </td>\r\n</ng-template>\r\n<ng-template #value>\r\n <span [innerHTML]=\"data\"></span>\r\n</ng-template>\r\n<ng-container *ngIf=\"(isObject || isArray); else value\" [ngSwitch]=\"listStyle\">\r\n <ul [ngClass]=\"'level-' + level\" *ngSwitchCase=\"'list'\">\r\n <li *ngFor=\"let item of data | entries\" [ngClass]=\"item.classList\">\r\n <ng-container [unorderedListItem]=\"item\"\r\n type=\"item\"\r\n [data]=\"data\"\r\n [keyPrefix]=\"keyPrefix\"\r\n [listStyle]=\"listStyle\"\r\n [path]=\"path ? path + '.' + item.key : item.key\"\r\n [level]=\"level\"\r\n [templates]=\"templates\"\r\n [defaultTemplates]=\"defaultTemplates\"></ng-container>\r\n </li>\r\n </ul>\r\n <table [ngClass]=\"'level-' + level\" *ngSwitchDefault>\r\n <tr *ngFor=\"let item of data | entries\" [ngClass]=\"item.classList\">\r\n <ng-container [unorderedListItem]=\"item\"\r\n type=\"item\"\r\n [data]=\"data\"\r\n [keyPrefix]=\"keyPrefix\"\r\n [listStyle]=\"listStyle\"\r\n [path]=\"path ? path + '.' + item.key : item.key\"\r\n [level]=\"level\"\r\n [templates]=\"templates\"\r\n [defaultTemplates]=\"defaultTemplates\"></ng-container>\r\n </tr>\r\n </table>\r\n</ng-container>\r\n"
|
|
5568
5606
|
},] }
|
|
5569
5607
|
];
|
|
5570
5608
|
UnorderedListComponent.ctorParameters = function () { return [
|