ps-toolkit-ui 0.0.21 → 0.0.25
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 +21 -34
- 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 +20 -22
- package/esm2015/lib/components/sidebar/sidebar.component.js +2 -3
- package/fesm2015/ps-toolkit-ui.js +19 -23
- 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,13 +2129,12 @@
|
|
|
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) {
|
|
2136
2135
|
var _this = this;
|
|
2137
2136
|
if (parentId === void 0) { parentId = null; }
|
|
2138
|
-
return this.permissions.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Item &&
|
|
2137
|
+
return this.permissions.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Item && x.ParentId === parentId; }).map(function (s) {
|
|
2139
2138
|
return new SidebarClass(_this.l, s.Name, s.Controller, s.Action, s.Icon, _this.getSidebar(s.Id));
|
|
2140
2139
|
});
|
|
2141
2140
|
};
|
|
@@ -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,32 @@
|
|
|
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[0]) : null;
|
|
6910
6886
|
};
|
|
6911
6887
|
BaseComponent.prototype.getPermissionClass = function (p) {
|
|
6912
|
-
|
|
6888
|
+
console.log('$$$$$$$$$$');
|
|
6889
|
+
console.log(p);
|
|
6890
|
+
console.log('$$$$$$$$$$');
|
|
6891
|
+
return new PermissionClass(p.Name, p.Icon, p.Type, p.Area, p.Controller, p.Action, [], this.getPermissionAccessesClass(p.Id));
|
|
6892
|
+
};
|
|
6893
|
+
BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
|
|
6894
|
+
var _this = this;
|
|
6895
|
+
console.log('--------------');
|
|
6896
|
+
console.log(parentId);
|
|
6897
|
+
console.log(this.app.currentUser.Permissions.filter(function (x) { return x.ParentId = parentId; }));
|
|
6898
|
+
console.log('--------------');
|
|
6899
|
+
return this.app.currentUser.Permissions.filter(function (x) { return x.ParentId = parentId; }).map(function (x) { return _this.getPermissionClass(x); });
|
|
6913
6900
|
};
|
|
6914
6901
|
BaseComponent.prototype.hasAccess = function (a) {
|
|
6915
6902
|
return this.permissions ? this.permissions.hasAccess(a) : false;
|