ps-toolkit-ui 0.0.22 → 0.0.23
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/ps-toolkit-ui.umd.js +13 -33
- package/bundles/ps-toolkit-ui.umd.js.map +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js.map +1 -1
- package/esm2015/lib/components/base.component.js +13 -22
- package/esm2015/lib/components/sidebar/sidebar.component.js +1 -2
- package/fesm2015/ps-toolkit-ui.js +11 -22
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/components/base.component.d.ts +3 -1
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -2129,7 +2129,6 @@
|
|
|
2129
2129
|
};
|
|
2130
2130
|
SidebarComponent.prototype.ngOnInit = function () {
|
|
2131
2131
|
this.sidebar = this.getSidebar();
|
|
2132
|
-
console.log(this.sidebar);
|
|
2133
2132
|
this.setActive();
|
|
2134
2133
|
};
|
|
2135
2134
|
SidebarComponent.prototype.getSidebar = function (parentId) {
|
|
@@ -6864,6 +6863,7 @@
|
|
|
6864
6863
|
var BaseComponent = /** @class */ (function () {
|
|
6865
6864
|
function BaseComponent(app, c, a) {
|
|
6866
6865
|
if (a === void 0) { a = null; }
|
|
6866
|
+
this.app = app;
|
|
6867
6867
|
this.c = c;
|
|
6868
6868
|
this.a = a;
|
|
6869
6869
|
this.l = function (key, v) {
|
|
@@ -6871,45 +6871,25 @@
|
|
|
6871
6871
|
return app.getL("" + c + (a ? "." + a : ''), key, v);
|
|
6872
6872
|
};
|
|
6873
6873
|
if (app.currentUser !== null) {
|
|
6874
|
-
this.permissions = this.getPermission(
|
|
6874
|
+
this.permissions = this.getPermission();
|
|
6875
|
+
console.log(this.permissions);
|
|
6875
6876
|
if (this.permissions) {
|
|
6876
6877
|
this.permissions.Area = app.area;
|
|
6877
6878
|
}
|
|
6878
6879
|
}
|
|
6879
6880
|
}
|
|
6880
|
-
BaseComponent.prototype.getPermission = function (
|
|
6881
|
-
var
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
if (per.Controller === this.c && (this.a == null || per.Action === this.a)) {
|
|
6886
|
-
return this.getPermissionClass(per);
|
|
6887
|
-
}
|
|
6888
|
-
if (per.Children) {
|
|
6889
|
-
var pc = this.getPermission(per.Children);
|
|
6890
|
-
if (pc != null) {
|
|
6891
|
-
return this.getPermissionClass(pc);
|
|
6892
|
-
}
|
|
6893
|
-
}
|
|
6894
|
-
if (per.Accesses) {
|
|
6895
|
-
var pc = this.getPermission(per.Accesses);
|
|
6896
|
-
if (pc != null) {
|
|
6897
|
-
return this.getPermissionClass(pc);
|
|
6898
|
-
}
|
|
6899
|
-
}
|
|
6900
|
-
}
|
|
6901
|
-
}
|
|
6902
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6903
|
-
finally {
|
|
6904
|
-
try {
|
|
6905
|
-
if (permissions_1_1 && !permissions_1_1.done && (_a = permissions_1.return)) _a.call(permissions_1);
|
|
6906
|
-
}
|
|
6907
|
-
finally { if (e_1) throw e_1.error; }
|
|
6908
|
-
}
|
|
6909
|
-
return null;
|
|
6881
|
+
BaseComponent.prototype.getPermission = function () {
|
|
6882
|
+
var _this = this;
|
|
6883
|
+
var p = this.app.currentUser.Permissions.filter(function (per) { return per.Controller === _this.c && (_this.a == null || per.Action === _this.a) &&
|
|
6884
|
+
per.Type === exports.PermissionTypeEnum.Item; });
|
|
6885
|
+
return p.length > 0 ? this.getPermissionClass(p) : null;
|
|
6910
6886
|
};
|
|
6911
6887
|
BaseComponent.prototype.getPermissionClass = function (p) {
|
|
6912
|
-
return new PermissionClass(p.Name, p.Icon, p.Type, p.Area, p.Controller, p.Action,
|
|
6888
|
+
return new PermissionClass(p.Name, p.Icon, p.Type, p.Area, p.Controller, p.Action, [], this.getPermissionAccessesClass(p.Id));
|
|
6889
|
+
};
|
|
6890
|
+
BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
|
|
6891
|
+
var _this = this;
|
|
6892
|
+
return this.app.currentUser.Permissions.filter(function (x) { return x.ParentId = parentId; }).map(function (x) { return _this.getPermissionClass(x); });
|
|
6913
6893
|
};
|
|
6914
6894
|
BaseComponent.prototype.hasAccess = function (a) {
|
|
6915
6895
|
return this.permissions ? this.permissions.hasAccess(a) : false;
|