ps-toolkit-ui 0.0.19 → 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 +29 -44
- 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/classes/enum.class.js +9 -8
- package/esm2015/lib/components/base.component.js +13 -22
- package/esm2015/lib/components/sidebar/sidebar.component.js +8 -6
- package/esm2015/lib/components/table/row/table.row.component.js +2 -1
- package/fesm2015/ps-toolkit-ui.js +26 -33
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/enum.class.d.ts +8 -7
- package/lib/components/base.component.d.ts +3 -1
- package/lib/components/sidebar/sidebar.component.d.ts +1 -0
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -801,13 +801,14 @@
|
|
|
801
801
|
})(exports.ResultStatusEnum || (exports.ResultStatusEnum = {}));
|
|
802
802
|
(function (PermissionTypeEnum) {
|
|
803
803
|
PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
|
|
804
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
805
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
806
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
807
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
808
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
809
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
810
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
804
|
+
PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
|
|
805
|
+
PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
|
|
806
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 2] = "OptionLink";
|
|
807
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 3] = "OptionLinkNewTab";
|
|
808
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 4] = "OptionReport";
|
|
809
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 5] = "OptionFile";
|
|
810
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 6] = "OptionModal";
|
|
811
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 7] = "OptionConfirm";
|
|
811
812
|
})(exports.PermissionTypeEnum || (exports.PermissionTypeEnum = {}));
|
|
812
813
|
(function (VehicleType) {
|
|
813
814
|
VehicleType[VehicleType["Car"] = 1] = "Car";
|
|
@@ -2127,13 +2128,15 @@
|
|
|
2127
2128
|
this.currentSidebar = this.getSidebarActive(this.sidebar, active);
|
|
2128
2129
|
};
|
|
2129
2130
|
SidebarComponent.prototype.ngOnInit = function () {
|
|
2131
|
+
this.sidebar = this.getSidebar();
|
|
2132
|
+
this.setActive();
|
|
2133
|
+
};
|
|
2134
|
+
SidebarComponent.prototype.getSidebar = function (parentId) {
|
|
2130
2135
|
var _this = this;
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
}) : []);
|
|
2136
|
+
if (parentId === void 0) { parentId = null; }
|
|
2137
|
+
return this.permissions.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Item && x.ParentId === parentId; }).map(function (s) {
|
|
2138
|
+
return new SidebarClass(_this.l, s.Name, s.Controller, s.Action, s.Icon, _this.getSidebar(s.Id));
|
|
2135
2139
|
});
|
|
2136
|
-
this.setActive();
|
|
2137
2140
|
};
|
|
2138
2141
|
SidebarComponent.prototype.getSidebarActive = function (item, active) {
|
|
2139
2142
|
var e_1, _a;
|
|
@@ -2434,6 +2437,7 @@
|
|
|
2434
2437
|
if (!_this.table.form.onTop) {
|
|
2435
2438
|
_this.table.modal.hide();
|
|
2436
2439
|
}
|
|
2440
|
+
_this.table.form.clear();
|
|
2437
2441
|
_this.table.load();
|
|
2438
2442
|
};
|
|
2439
2443
|
}
|
|
@@ -6859,6 +6863,7 @@
|
|
|
6859
6863
|
var BaseComponent = /** @class */ (function () {
|
|
6860
6864
|
function BaseComponent(app, c, a) {
|
|
6861
6865
|
if (a === void 0) { a = null; }
|
|
6866
|
+
this.app = app;
|
|
6862
6867
|
this.c = c;
|
|
6863
6868
|
this.a = a;
|
|
6864
6869
|
this.l = function (key, v) {
|
|
@@ -6866,45 +6871,25 @@
|
|
|
6866
6871
|
return app.getL("" + c + (a ? "." + a : ''), key, v);
|
|
6867
6872
|
};
|
|
6868
6873
|
if (app.currentUser !== null) {
|
|
6869
|
-
this.permissions = this.getPermission(
|
|
6874
|
+
this.permissions = this.getPermission();
|
|
6875
|
+
console.log(this.permissions);
|
|
6870
6876
|
if (this.permissions) {
|
|
6871
6877
|
this.permissions.Area = app.area;
|
|
6872
6878
|
}
|
|
6873
6879
|
}
|
|
6874
6880
|
}
|
|
6875
|
-
BaseComponent.prototype.getPermission = function (
|
|
6876
|
-
var
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
if (per.Controller === this.c && (this.a == null || per.Action === this.a)) {
|
|
6881
|
-
return this.getPermissionClass(per);
|
|
6882
|
-
}
|
|
6883
|
-
if (per.Children) {
|
|
6884
|
-
var pc = this.getPermission(per.Children);
|
|
6885
|
-
if (pc != null) {
|
|
6886
|
-
return this.getPermissionClass(pc);
|
|
6887
|
-
}
|
|
6888
|
-
}
|
|
6889
|
-
if (per.Accesses) {
|
|
6890
|
-
var pc = this.getPermission(per.Accesses);
|
|
6891
|
-
if (pc != null) {
|
|
6892
|
-
return this.getPermissionClass(pc);
|
|
6893
|
-
}
|
|
6894
|
-
}
|
|
6895
|
-
}
|
|
6896
|
-
}
|
|
6897
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6898
|
-
finally {
|
|
6899
|
-
try {
|
|
6900
|
-
if (permissions_1_1 && !permissions_1_1.done && (_a = permissions_1.return)) _a.call(permissions_1);
|
|
6901
|
-
}
|
|
6902
|
-
finally { if (e_1) throw e_1.error; }
|
|
6903
|
-
}
|
|
6904
|
-
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;
|
|
6905
6886
|
};
|
|
6906
6887
|
BaseComponent.prototype.getPermissionClass = function (p) {
|
|
6907
|
-
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); });
|
|
6908
6893
|
};
|
|
6909
6894
|
BaseComponent.prototype.hasAccess = function (a) {
|
|
6910
6895
|
return this.permissions ? this.permissions.hasAccess(a) : false;
|