ps-toolkit-ui 0.0.128 → 0.0.132
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 -7
- 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 +8 -1
- package/esm2015/lib/classes/permission.class.js +6 -4
- package/esm2015/lib/classes/table.class.js +3 -2
- package/esm2015/lib/components/base.component.js +2 -2
- package/esm2015/lib/components/table/row/table.row.component.js +5 -3
- package/fesm2015/ps-toolkit-ui.js +20 -8
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/enum.class.d.ts +6 -0
- package/lib/classes/permission.class.d.ts +4 -3
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -809,6 +809,12 @@
|
|
|
809
809
|
PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
|
|
810
810
|
PermissionTypeEnum[PermissionTypeEnum["Option"] = 2] = "Option";
|
|
811
811
|
})(exports.PermissionTypeEnum || (exports.PermissionTypeEnum = {}));
|
|
812
|
+
(function (PermissionAccessTypeEnum) {
|
|
813
|
+
PermissionAccessTypeEnum[PermissionAccessTypeEnum["List"] = 1] = "List";
|
|
814
|
+
PermissionAccessTypeEnum[PermissionAccessTypeEnum["Insert"] = 2] = "Insert";
|
|
815
|
+
PermissionAccessTypeEnum[PermissionAccessTypeEnum["Update"] = 3] = "Update";
|
|
816
|
+
PermissionAccessTypeEnum[PermissionAccessTypeEnum["Delete"] = 4] = "Delete";
|
|
817
|
+
})(exports.PermissionAccessTypeEnum || (exports.PermissionAccessTypeEnum = {}));
|
|
812
818
|
(function (PermissionInputActionEnum) {
|
|
813
819
|
PermissionInputActionEnum[PermissionInputActionEnum["None"] = 0] = "None";
|
|
814
820
|
PermissionInputActionEnum[PermissionInputActionEnum["Link"] = 1] = "Link";
|
|
@@ -2392,11 +2398,12 @@
|
|
|
2392
2398
|
};
|
|
2393
2399
|
|
|
2394
2400
|
var PermissionClass = /** @class */ (function () {
|
|
2395
|
-
function PermissionClass(Name, Icon, Type, InputType, InputAction, Area, Controller, Action, Condition, Accesses) {
|
|
2401
|
+
function PermissionClass(Name, Icon, Type, InputType, AccessType, InputAction, Area, Controller, Action, Condition, Accesses) {
|
|
2396
2402
|
if (Name === void 0) { Name = ''; }
|
|
2397
2403
|
if (Icon === void 0) { Icon = ''; }
|
|
2398
2404
|
if (Type === void 0) { Type = null; }
|
|
2399
2405
|
if (InputType === void 0) { InputType = null; }
|
|
2406
|
+
if (AccessType === void 0) { AccessType = null; }
|
|
2400
2407
|
if (InputAction === void 0) { InputAction = null; }
|
|
2401
2408
|
if (Area === void 0) { Area = ''; }
|
|
2402
2409
|
if (Controller === void 0) { Controller = ''; }
|
|
@@ -2407,6 +2414,7 @@
|
|
|
2407
2414
|
this.Icon = Icon;
|
|
2408
2415
|
this.Type = Type;
|
|
2409
2416
|
this.InputType = InputType;
|
|
2417
|
+
this.AccessType = AccessType;
|
|
2410
2418
|
this.InputAction = InputAction;
|
|
2411
2419
|
this.Area = Area;
|
|
2412
2420
|
this.Controller = Controller;
|
|
@@ -2416,8 +2424,11 @@
|
|
|
2416
2424
|
this.RelatedId = null;
|
|
2417
2425
|
this.OnClick = null;
|
|
2418
2426
|
}
|
|
2419
|
-
PermissionClass.prototype.getAccess = function (a) {
|
|
2420
|
-
|
|
2427
|
+
PermissionClass.prototype.getAccess = function (a, at) {
|
|
2428
|
+
if (a === void 0) { a = null; }
|
|
2429
|
+
if (at === void 0) { at = null; }
|
|
2430
|
+
var c = this.Accesses.filter(function (x) { return ((a != null && x.Action === a) || (at != null && x.AccessType === at)) &&
|
|
2431
|
+
x.Type === exports.PermissionTypeEnum.Access; });
|
|
2421
2432
|
return c.length > 0 ? c[0] : null;
|
|
2422
2433
|
};
|
|
2423
2434
|
PermissionClass.prototype.hasAccess = function (a) {
|
|
@@ -2600,6 +2611,7 @@
|
|
|
2600
2611
|
}
|
|
2601
2612
|
}
|
|
2602
2613
|
else if (option.Action === 'Delete') {
|
|
2614
|
+
opt.class = opt.class.replace('blue', 'red');
|
|
2603
2615
|
opt.onClick = function () {
|
|
2604
2616
|
if (_this.table.form) {
|
|
2605
2617
|
_this.table.form.clear();
|
|
@@ -2634,12 +2646,13 @@
|
|
|
2634
2646
|
opt.onClick = function (btn) {
|
|
2635
2647
|
var e_2, _a;
|
|
2636
2648
|
if (opt.modal.table) {
|
|
2649
|
+
console.log(_this.row.Options.filter(function (x) { return x.ParentId === option.Id; }), 'this.row.Options.filter(x => x.ParentId === option.Id)');
|
|
2637
2650
|
var p = new PermissionClass();
|
|
2638
2651
|
p.RelatedId = btn.row.Data.Id;
|
|
2639
2652
|
p.Area = _this.table.permissions.Area;
|
|
2640
2653
|
p.Controller = _this.table.permissions.Controller;
|
|
2641
2654
|
p.Action = option.Action;
|
|
2642
|
-
p.Accesses = option.
|
|
2655
|
+
p.Accesses = _this.row.Options.filter(function (x) { return x.ParentId === option.Id; });
|
|
2643
2656
|
opt.modal.table.permissions = p;
|
|
2644
2657
|
if (opt.modal.table.form) {
|
|
2645
2658
|
opt.modal.table.form.url = p.getUrl() + 'Insert';
|
|
@@ -2726,7 +2739,7 @@
|
|
|
2726
2739
|
};
|
|
2727
2740
|
var this_1 = this;
|
|
2728
2741
|
try {
|
|
2729
|
-
for (var _b = __values(this.row.Options), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2742
|
+
for (var _b = __values(this.row.Options.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; })), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2730
2743
|
var option = _c.value;
|
|
2731
2744
|
_loop_1(option);
|
|
2732
2745
|
}
|
|
@@ -7045,7 +7058,7 @@
|
|
|
7045
7058
|
return p.length > 0 ? this.getPermissionClass(p[0]) : null;
|
|
7046
7059
|
};
|
|
7047
7060
|
BaseComponent.prototype.getPermissionClass = function (p) {
|
|
7048
|
-
return new PermissionClass(p.Name, p.Icon, p.Type, p.InputType, p.InputAction, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
|
|
7061
|
+
return new PermissionClass(p.Name, p.Icon, p.Type, p.InputType, p.AccessType, p.InputAction, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
|
|
7049
7062
|
};
|
|
7050
7063
|
BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
|
|
7051
7064
|
var _this = this;
|
|
@@ -7216,8 +7229,9 @@
|
|
|
7216
7229
|
try {
|
|
7217
7230
|
for (var _b = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7218
7231
|
var access = _c.value;
|
|
7219
|
-
var accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === exports.PermissionInputTypeEnum.Button ? exports.InputType.Button : exports.InputType.Icon, 'w-u h-30');
|
|
7232
|
+
var accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === exports.PermissionInputTypeEnum.Button ? exports.InputType.Button : exports.InputType.Icon, 'blue w-u h-30');
|
|
7220
7233
|
if (access.Action === 'Insert') {
|
|
7234
|
+
accessInp.class = accessInp.class.replace('blue', 'green');
|
|
7221
7235
|
if (this.form) {
|
|
7222
7236
|
this.form.url = this.form.baseUrl = this.url + 'Insert';
|
|
7223
7237
|
if (!this.form.onTop) {
|