ps-toolkit-ui 0.0.113 → 0.0.114
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 +224 -220
- 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/table.class.js +2 -101
- package/esm2015/lib/components/table/row/table.row.component.js +141 -38
- package/fesm2015/ps-toolkit-ui.js +184 -181
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -2392,6 +2392,62 @@
|
|
|
2392
2392
|
table: [{ type: core.Input }]
|
|
2393
2393
|
};
|
|
2394
2394
|
|
|
2395
|
+
var PermissionClass = /** @class */ (function () {
|
|
2396
|
+
function PermissionClass(Name, Icon, Type, InputType, InputAction, Area, Controller, Action, Condition, Accesses) {
|
|
2397
|
+
if (Name === void 0) { Name = ''; }
|
|
2398
|
+
if (Icon === void 0) { Icon = ''; }
|
|
2399
|
+
if (Type === void 0) { Type = null; }
|
|
2400
|
+
if (InputType === void 0) { InputType = null; }
|
|
2401
|
+
if (InputAction === void 0) { InputAction = null; }
|
|
2402
|
+
if (Area === void 0) { Area = ''; }
|
|
2403
|
+
if (Controller === void 0) { Controller = ''; }
|
|
2404
|
+
if (Action === void 0) { Action = ''; }
|
|
2405
|
+
if (Condition === void 0) { Condition = null; }
|
|
2406
|
+
if (Accesses === void 0) { Accesses = []; }
|
|
2407
|
+
this.Name = Name;
|
|
2408
|
+
this.Icon = Icon;
|
|
2409
|
+
this.Type = Type;
|
|
2410
|
+
this.InputType = InputType;
|
|
2411
|
+
this.InputAction = InputAction;
|
|
2412
|
+
this.Area = Area;
|
|
2413
|
+
this.Controller = Controller;
|
|
2414
|
+
this.Action = Action;
|
|
2415
|
+
this.Condition = Condition;
|
|
2416
|
+
this.Accesses = Accesses;
|
|
2417
|
+
this.RelatedId = null;
|
|
2418
|
+
this.OnClick = null;
|
|
2419
|
+
}
|
|
2420
|
+
PermissionClass.prototype.getAccess = function (a) {
|
|
2421
|
+
var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
|
|
2422
|
+
return c.length > 0 ? c[0] : null;
|
|
2423
|
+
};
|
|
2424
|
+
PermissionClass.prototype.hasAccess = function (a) {
|
|
2425
|
+
return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
|
|
2426
|
+
};
|
|
2427
|
+
PermissionClass.prototype.getAccesses = function () {
|
|
2428
|
+
return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
|
|
2429
|
+
};
|
|
2430
|
+
PermissionClass.prototype.delete = function (a) {
|
|
2431
|
+
this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
|
|
2432
|
+
};
|
|
2433
|
+
PermissionClass.prototype.hasOption = function (a) {
|
|
2434
|
+
return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
|
|
2435
|
+
};
|
|
2436
|
+
PermissionClass.prototype.getOptions = function () {
|
|
2437
|
+
return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; });
|
|
2438
|
+
};
|
|
2439
|
+
PermissionClass.prototype.getOption = function (a) {
|
|
2440
|
+
var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; });
|
|
2441
|
+
return c.length > 0 ? c[0] : null;
|
|
2442
|
+
};
|
|
2443
|
+
PermissionClass.prototype.getUrl = function () {
|
|
2444
|
+
return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
|
|
2445
|
+
(this.RelatedId ? this.RelatedId + "/" : '') +
|
|
2446
|
+
(this.Action ? this.Action : '');
|
|
2447
|
+
};
|
|
2448
|
+
return PermissionClass;
|
|
2449
|
+
}());
|
|
2450
|
+
|
|
2395
2451
|
var TableRowComponent = /** @class */ (function () {
|
|
2396
2452
|
function TableRowComponent(service) {
|
|
2397
2453
|
this.service = service;
|
|
@@ -2436,23 +2492,23 @@
|
|
|
2436
2492
|
if (this.table.permissions.hasAccess('Insert')) {
|
|
2437
2493
|
this.addChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'AddSubsetTitle', 'fad fa-plus fa-rotate-90', exports.InputType.Icon, 'green m-h-5 h-25 d-ib va-m f-u');
|
|
2438
2494
|
this.addChildren.onClick = function () {
|
|
2439
|
-
_this.table.form.inputs.find(function (x) { return x.name === 'ParentId'; }).setValue(_this.row.Id, false);
|
|
2495
|
+
_this.table.form.inputs.find(function (x) { return x.name === 'ParentId'; }).setValue(_this.row.Data.Id, false);
|
|
2440
2496
|
_this.table.form.onSuccessBase = function () {
|
|
2441
2497
|
_this.table.modal.hide();
|
|
2442
2498
|
_this.showChildren.type = exports.InputType.Icon;
|
|
2443
|
-
_this.loadChildren(_this.row.Id);
|
|
2499
|
+
_this.loadChildren(_this.row.Data.Id);
|
|
2444
2500
|
};
|
|
2445
2501
|
_this.table.showInsertModal();
|
|
2446
2502
|
};
|
|
2447
2503
|
}
|
|
2448
|
-
this.showChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'SubsetTitle', 'fad fa-angle-left f-s-22', this.row.CountChild > 0 || (!this.table.childrenAutoLoad && this.children.length > 0) ? exports.InputType.Icon : exports.InputType.Hidden, 'h-25 m-h-5 d-ib va-m f-u');
|
|
2504
|
+
this.showChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'SubsetTitle', 'fad fa-angle-left f-s-22', this.row.Data.CountChild > 0 || (!this.table.childrenAutoLoad && this.children.length > 0) ? exports.InputType.Icon : exports.InputType.Hidden, 'h-25 m-h-5 d-ib va-m f-u');
|
|
2449
2505
|
this.showChildren.onClick = function () {
|
|
2450
2506
|
if ($__namespace(_this.childrenDiv.nativeElement).is(':visible')) {
|
|
2451
2507
|
$__namespace(_this.childrenDiv.nativeElement).hide();
|
|
2452
2508
|
_this.showChildren.icon = 'fad fa-angle-left f-s-22';
|
|
2453
2509
|
}
|
|
2454
2510
|
else if (_this.children.length === 0) {
|
|
2455
|
-
_this.loadChildren(_this.row.Id);
|
|
2511
|
+
_this.loadChildren(_this.row.Data.Id);
|
|
2456
2512
|
}
|
|
2457
2513
|
else {
|
|
2458
2514
|
$__namespace(_this.childrenDiv.nativeElement).show();
|
|
@@ -2461,8 +2517,8 @@
|
|
|
2461
2517
|
};
|
|
2462
2518
|
}
|
|
2463
2519
|
if (this.table.hasStatus) {
|
|
2464
|
-
this.optStatus = new InputClass(this.table.environment, this.table.l, 'Status', this.row.Active ? 'fa-toggle-on' : 'fa-toggle-off', exports.InputType.Icon, 'm-h-5 h-20 ' + (this.row.Active ? 'green' : ''));
|
|
2465
|
-
this.optStatus.row = this.row;
|
|
2520
|
+
this.optStatus = new InputClass(this.table.environment, this.table.l, 'Status', this.row.Data.Active ? 'fa-toggle-on' : 'fa-toggle-off', exports.InputType.Icon, 'm-h-5 h-20 ' + (this.row.Data.Active ? 'green' : ''));
|
|
2521
|
+
this.optStatus.row = this.row.Data;
|
|
2466
2522
|
this.optStatus.onClick = function (btn) {
|
|
2467
2523
|
new RequestClass(_this.table.l).send(_this.table.url + '/Status/' + btn.row.Id, exports.Method.Post, null, btn, function (r) {
|
|
2468
2524
|
btn.class = 'm-h-5 h-20 ' + (r ? 'green' : '');
|
|
@@ -2474,12 +2530,12 @@
|
|
|
2474
2530
|
if (this.optEdit !== null) {
|
|
2475
2531
|
if (this.table.form) {
|
|
2476
2532
|
this.optEdit.onClick = function () {
|
|
2477
|
-
_this.table.form.url = _this.table.url + 'Update/' + _this.row.Id;
|
|
2478
|
-
if (_this.table.hasChildren && _this.row.ParentId != null) {
|
|
2533
|
+
_this.table.form.url = _this.table.url + 'Update/' + _this.row.Data.Id;
|
|
2534
|
+
if (_this.table.hasChildren && _this.row.Data.ParentId != null) {
|
|
2479
2535
|
_this.table.form.onSuccessBase = function () {
|
|
2480
2536
|
_this.table.modal.hide();
|
|
2481
2537
|
if (_this.table.childrenAutoLoad) {
|
|
2482
|
-
_this.loadParent.emit(_this.row.ParentId);
|
|
2538
|
+
_this.loadParent.emit(_this.row.Data.ParentId);
|
|
2483
2539
|
}
|
|
2484
2540
|
else {
|
|
2485
2541
|
_this.table.load();
|
|
@@ -2499,7 +2555,7 @@
|
|
|
2499
2555
|
};
|
|
2500
2556
|
}
|
|
2501
2557
|
else {
|
|
2502
|
-
this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
|
|
2558
|
+
this.optEdit.url = this.table.url + '/Update/' + this.row.Data.Id;
|
|
2503
2559
|
}
|
|
2504
2560
|
}
|
|
2505
2561
|
if (this.optDelete != null) {
|
|
@@ -2508,13 +2564,13 @@
|
|
|
2508
2564
|
_this.table.form.clear();
|
|
2509
2565
|
}
|
|
2510
2566
|
if (_this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
|
|
2511
|
-
_this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Id; });
|
|
2512
|
-
_this.changeRows.emit(_this.row);
|
|
2567
|
+
_this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Data.Id; });
|
|
2568
|
+
_this.changeRows.emit(_this.row.Data);
|
|
2513
2569
|
}
|
|
2514
2570
|
else {
|
|
2515
|
-
_this.confirmShow.emit({ id: _this.row.Id, accept: function () {
|
|
2516
|
-
if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.ParentId != null) {
|
|
2517
|
-
_this.loadParent.emit(_this.row.ParentId);
|
|
2571
|
+
_this.confirmShow.emit({ id: _this.row.Data.Id, accept: function () {
|
|
2572
|
+
if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.Data.ParentId != null) {
|
|
2573
|
+
_this.loadParent.emit(_this.row.Data.ParentId);
|
|
2518
2574
|
}
|
|
2519
2575
|
else {
|
|
2520
2576
|
_this.table.load();
|
|
@@ -2538,7 +2594,7 @@
|
|
|
2538
2594
|
});
|
|
2539
2595
|
};
|
|
2540
2596
|
TableRowComponent.prototype.select = function () {
|
|
2541
|
-
this.row.selected = !this.row.selected;
|
|
2597
|
+
this.row.Data.selected = !this.row.Data.selected;
|
|
2542
2598
|
};
|
|
2543
2599
|
TableRowComponent.prototype.onChangeRows = function (e) {
|
|
2544
2600
|
return this.changeRows.emit(e);
|
|
@@ -2569,26 +2625,154 @@
|
|
|
2569
2625
|
}, 500);
|
|
2570
2626
|
};
|
|
2571
2627
|
TableRowComponent.prototype.getOptions = function () {
|
|
2628
|
+
var e_1, _a;
|
|
2572
2629
|
var _this = this;
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
i.url = i.url.replace('{}', _this.row.Id);
|
|
2630
|
+
var opts = this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ?
|
|
2631
|
+
[this.addChildren] : [];
|
|
2632
|
+
var _loop_1 = function (option) {
|
|
2633
|
+
if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
|
|
2634
|
+
return "continue";
|
|
2579
2635
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2636
|
+
var opt = new InputClass(this_1.table.environment, this_1.table.l, option.Name, option.Icon, option.InputType === exports.PermissionInputTypeEnum.Icon ? exports.InputType.Icon : exports.InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
2637
|
+
opt.condition = option.Condition;
|
|
2638
|
+
if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
|
|
2639
|
+
var p = new PermissionClass();
|
|
2640
|
+
p.RelatedId = this_1.table.permissions.RelatedId;
|
|
2641
|
+
p.Area = this_1.table.permissions.Area;
|
|
2642
|
+
p.Controller = option.Controller ? option.Controller : this_1.table.permissions.Controller;
|
|
2643
|
+
p.Action = this_1.table.permissions.Action;
|
|
2644
|
+
opt.url = p.getUrl() + option.Action + '/{}';
|
|
2645
|
+
opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
|
|
2646
|
+
}
|
|
2647
|
+
else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
|
|
2648
|
+
opt.modal = option.Modal;
|
|
2649
|
+
opt.onClick = function (btn) {
|
|
2650
|
+
var e_2, _a;
|
|
2651
|
+
if (opt.modal.table) {
|
|
2652
|
+
var p = new PermissionClass();
|
|
2653
|
+
p.RelatedId = btn.row.Id;
|
|
2654
|
+
p.Area = _this.table.permissions.Area;
|
|
2655
|
+
p.Controller = _this.table.permissions.Controller;
|
|
2656
|
+
p.Action = option.Action;
|
|
2657
|
+
p.Accesses = option.Accesses;
|
|
2658
|
+
opt.modal.table.permissions = p;
|
|
2659
|
+
if (opt.modal.table.form) {
|
|
2660
|
+
opt.modal.table.form.url = p.getUrl() + 'Insert';
|
|
2661
|
+
opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
2662
|
+
}
|
|
2663
|
+
opt.modal.table.set();
|
|
2664
|
+
}
|
|
2665
|
+
if (opt.modal.form) {
|
|
2666
|
+
opt.modal.form.name = option.Name;
|
|
2667
|
+
opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
|
|
2668
|
+
opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
|
|
2669
|
+
opt.modal.form.onSuccessBase = function () {
|
|
2670
|
+
opt.modal.hide();
|
|
2671
|
+
};
|
|
2672
|
+
}
|
|
2673
|
+
if (opt.modal.accordion) {
|
|
2674
|
+
try {
|
|
2675
|
+
for (var _b = (e_2 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2676
|
+
var r = _c.value;
|
|
2677
|
+
if (r.table) {
|
|
2678
|
+
var p = new PermissionClass();
|
|
2679
|
+
p.RelatedId = btn.row.Id;
|
|
2680
|
+
p.Area = _this.table.permissions.Area;
|
|
2681
|
+
p.Controller = _this.table.permissions.Controller;
|
|
2682
|
+
p.Action = r.name;
|
|
2683
|
+
p.Accesses = option.Accesses;
|
|
2684
|
+
r.table.permissions = p;
|
|
2685
|
+
if (r.table.form) {
|
|
2686
|
+
r.table.form.url = p.getUrl() + 'Insert';
|
|
2687
|
+
r.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
2688
|
+
}
|
|
2689
|
+
r.table.set();
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2694
|
+
finally {
|
|
2695
|
+
try {
|
|
2696
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2697
|
+
}
|
|
2698
|
+
finally { if (e_2) throw e_2.error; }
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
};
|
|
2702
|
+
}
|
|
2703
|
+
else if (option.InputAction === exports.PermissionInputActionEnum.Report) {
|
|
2704
|
+
var p = new PermissionClass();
|
|
2705
|
+
p.RelatedId = 'Index';
|
|
2706
|
+
p.Area = this_1.table.permissions.Area;
|
|
2707
|
+
p.Controller = 'Print';
|
|
2708
|
+
p.Action = option.Action;
|
|
2709
|
+
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
2710
|
+
opt.urlNewTab = true;
|
|
2711
|
+
}
|
|
2712
|
+
else if (option.InputAction === exports.PermissionInputActionEnum.File) {
|
|
2713
|
+
var p = new PermissionClass();
|
|
2714
|
+
p.RelatedId = this_1.table.permissions.RelatedId;
|
|
2715
|
+
p.Area = this_1.table.permissions.Area;
|
|
2716
|
+
p.Controller = this_1.table.permissions.Controller;
|
|
2717
|
+
p.Action = (this_1.table.permissions.Action ? this_1.table.permissions.Action : '') + option.Action;
|
|
2718
|
+
opt.url = '/File' + p.getUrl() + '/{}';
|
|
2719
|
+
opt.urlNewTab = true;
|
|
2720
|
+
}
|
|
2721
|
+
else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
|
|
2722
|
+
opt.onClick = function (btn) {
|
|
2723
|
+
var p = new PermissionClass();
|
|
2724
|
+
p.RelatedId = _this.table.permissions.RelatedId;
|
|
2725
|
+
p.Area = _this.table.permissions.Area;
|
|
2726
|
+
p.Controller = _this.table.permissions.Controller;
|
|
2727
|
+
p.Action = option.Action;
|
|
2728
|
+
_this.table.showConfirm(_this.table.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
|
|
2729
|
+
_this.table.load();
|
|
2730
|
+
});
|
|
2731
|
+
};
|
|
2732
|
+
}
|
|
2733
|
+
else if (option.Type === exports.PermissionTypeEnum.Option) {
|
|
2734
|
+
if (option.OnClick) {
|
|
2735
|
+
opt.onClick = function (btn) {
|
|
2736
|
+
option.OnClick(btn);
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
opts.push(opt);
|
|
2741
|
+
};
|
|
2742
|
+
var this_1 = this;
|
|
2743
|
+
try {
|
|
2744
|
+
for (var _b = __values(this.row.Options), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2745
|
+
var option = _c.value;
|
|
2746
|
+
_loop_1(option);
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2750
|
+
finally {
|
|
2751
|
+
try {
|
|
2752
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2753
|
+
}
|
|
2754
|
+
finally { if (e_1) throw e_1.error; }
|
|
2755
|
+
}
|
|
2756
|
+
return opts;
|
|
2757
|
+
// return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
|
|
2758
|
+
// .concat(this.table.options.filter(x => x.condition == null ||
|
|
2759
|
+
// (x.condition.startsWith('!') ? !this.row.Data[x.condition.substring(1)] : this.row.Data[x.condition])).map((o) => {
|
|
2760
|
+
// const i = HelperClass.clone(o);
|
|
2761
|
+
// if (i.url){
|
|
2762
|
+
// i.url = i.url.replace('{}', this.row.Data.Id);
|
|
2763
|
+
// }
|
|
2764
|
+
// i.row = this.row.Data;
|
|
2765
|
+
// i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
|
|
2766
|
+
// return i;
|
|
2767
|
+
// })).concat(this.table.hasStatus ? [this.optStatus] : [])
|
|
2768
|
+
// .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
|
|
2769
|
+
// .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
|
|
2586
2770
|
};
|
|
2587
2771
|
TableRowComponent.prototype.getCell = function (col) {
|
|
2588
2772
|
console.log('getCell');
|
|
2589
|
-
var cv = _.get(this.row, col.name);
|
|
2773
|
+
var cv = _.get(this.row.Data, col.name);
|
|
2590
2774
|
if (col.fun != null) {
|
|
2591
|
-
return col.fun(this.row);
|
|
2775
|
+
return col.fun(this.row.Data);
|
|
2592
2776
|
}
|
|
2593
2777
|
else if (col.enum !== null) {
|
|
2594
2778
|
return col.enum.get(cv);
|
|
@@ -2640,7 +2824,7 @@
|
|
|
2640
2824
|
return this.table.l(cv);
|
|
2641
2825
|
};
|
|
2642
2826
|
TableRowComponent.prototype.getCol = function (n) {
|
|
2643
|
-
var c = this.row;
|
|
2827
|
+
var c = this.row.Data;
|
|
2644
2828
|
n.split('.').forEach(function (x) {
|
|
2645
2829
|
c = c[x];
|
|
2646
2830
|
});
|
|
@@ -2651,15 +2835,15 @@
|
|
|
2651
2835
|
var editAccess = this.table.permissions.getAccess('Update');
|
|
2652
2836
|
if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
|
|
2653
2837
|
this.table.form.name = editAccess.Name;
|
|
2654
|
-
this.table.form.setData(this.row);
|
|
2655
|
-
this.table.form.setButtons(this.table.form.onTop, true, this.row.Id);
|
|
2838
|
+
this.table.form.setData(this.row.Data);
|
|
2839
|
+
this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
|
|
2656
2840
|
this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
|
|
2657
2841
|
this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
|
|
2658
2842
|
}
|
|
2659
2843
|
else {
|
|
2660
|
-
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Id, exports.Method.Post, null, this.optEdit, function (result) {
|
|
2844
|
+
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Data.Id, exports.Method.Post, null, this.optEdit, function (result) {
|
|
2661
2845
|
_this.table.form.name = editAccess.Name;
|
|
2662
|
-
_this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Id);
|
|
2846
|
+
_this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
|
|
2663
2847
|
_this.table.form.setData(result);
|
|
2664
2848
|
_this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
|
|
2665
2849
|
_this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
|
|
@@ -2671,7 +2855,7 @@
|
|
|
2671
2855
|
};
|
|
2672
2856
|
TableRowComponent.prototype.getChildren = function () {
|
|
2673
2857
|
var _this = this;
|
|
2674
|
-
return this.row.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Id; }) : [];
|
|
2858
|
+
return this.row.Data.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Data.Id; }) : [];
|
|
2675
2859
|
};
|
|
2676
2860
|
return TableRowComponent;
|
|
2677
2861
|
}());
|
|
@@ -5053,62 +5237,6 @@
|
|
|
5053
5237
|
inputLabel: [{ type: core.ViewChild, args: ['inputLabel',] }]
|
|
5054
5238
|
};
|
|
5055
5239
|
|
|
5056
|
-
var PermissionClass = /** @class */ (function () {
|
|
5057
|
-
function PermissionClass(Name, Icon, Type, InputType, InputAction, Area, Controller, Action, Condition, Accesses) {
|
|
5058
|
-
if (Name === void 0) { Name = ''; }
|
|
5059
|
-
if (Icon === void 0) { Icon = ''; }
|
|
5060
|
-
if (Type === void 0) { Type = null; }
|
|
5061
|
-
if (InputType === void 0) { InputType = null; }
|
|
5062
|
-
if (InputAction === void 0) { InputAction = null; }
|
|
5063
|
-
if (Area === void 0) { Area = ''; }
|
|
5064
|
-
if (Controller === void 0) { Controller = ''; }
|
|
5065
|
-
if (Action === void 0) { Action = ''; }
|
|
5066
|
-
if (Condition === void 0) { Condition = null; }
|
|
5067
|
-
if (Accesses === void 0) { Accesses = []; }
|
|
5068
|
-
this.Name = Name;
|
|
5069
|
-
this.Icon = Icon;
|
|
5070
|
-
this.Type = Type;
|
|
5071
|
-
this.InputType = InputType;
|
|
5072
|
-
this.InputAction = InputAction;
|
|
5073
|
-
this.Area = Area;
|
|
5074
|
-
this.Controller = Controller;
|
|
5075
|
-
this.Action = Action;
|
|
5076
|
-
this.Condition = Condition;
|
|
5077
|
-
this.Accesses = Accesses;
|
|
5078
|
-
this.RelatedId = null;
|
|
5079
|
-
this.OnClick = null;
|
|
5080
|
-
}
|
|
5081
|
-
PermissionClass.prototype.getAccess = function (a) {
|
|
5082
|
-
var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
|
|
5083
|
-
return c.length > 0 ? c[0] : null;
|
|
5084
|
-
};
|
|
5085
|
-
PermissionClass.prototype.hasAccess = function (a) {
|
|
5086
|
-
return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
|
|
5087
|
-
};
|
|
5088
|
-
PermissionClass.prototype.getAccesses = function () {
|
|
5089
|
-
return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
|
|
5090
|
-
};
|
|
5091
|
-
PermissionClass.prototype.delete = function (a) {
|
|
5092
|
-
this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
|
|
5093
|
-
};
|
|
5094
|
-
PermissionClass.prototype.hasOption = function (a) {
|
|
5095
|
-
return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
|
|
5096
|
-
};
|
|
5097
|
-
PermissionClass.prototype.getOptions = function () {
|
|
5098
|
-
return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; });
|
|
5099
|
-
};
|
|
5100
|
-
PermissionClass.prototype.getOption = function (a) {
|
|
5101
|
-
var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; });
|
|
5102
|
-
return c.length > 0 ? c[0] : null;
|
|
5103
|
-
};
|
|
5104
|
-
PermissionClass.prototype.getUrl = function () {
|
|
5105
|
-
return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
|
|
5106
|
-
(this.RelatedId ? this.RelatedId + "/" : '') +
|
|
5107
|
-
(this.Action ? this.Action : '');
|
|
5108
|
-
};
|
|
5109
|
-
return PermissionClass;
|
|
5110
|
-
}());
|
|
5111
|
-
|
|
5112
5240
|
var FormTableComponent = /** @class */ (function () {
|
|
5113
5241
|
function FormTableComponent() {
|
|
5114
5242
|
this.changeIndex = new core.EventEmitter();
|
|
@@ -7082,7 +7210,7 @@
|
|
|
7082
7210
|
this.modal.show();
|
|
7083
7211
|
};
|
|
7084
7212
|
TableClass.prototype.set = function (changeRows) {
|
|
7085
|
-
var e_2, _a
|
|
7213
|
+
var e_2, _a;
|
|
7086
7214
|
var _this = this;
|
|
7087
7215
|
if (changeRows === void 0) { changeRows = null; }
|
|
7088
7216
|
this.permission = true;
|
|
@@ -7104,8 +7232,8 @@
|
|
|
7104
7232
|
return;
|
|
7105
7233
|
}
|
|
7106
7234
|
try {
|
|
7107
|
-
for (var
|
|
7108
|
-
var access =
|
|
7235
|
+
for (var _b = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7236
|
+
var access = _c.value;
|
|
7109
7237
|
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');
|
|
7110
7238
|
if (access.Action === 'Insert') {
|
|
7111
7239
|
if (this.form) {
|
|
@@ -7151,7 +7279,7 @@
|
|
|
7151
7279
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
7152
7280
|
finally {
|
|
7153
7281
|
try {
|
|
7154
|
-
if (
|
|
7282
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7155
7283
|
}
|
|
7156
7284
|
finally { if (e_2) throw e_2.error; }
|
|
7157
7285
|
}
|
|
@@ -7183,130 +7311,6 @@
|
|
|
7183
7311
|
this.modal.form = this.form;
|
|
7184
7312
|
}
|
|
7185
7313
|
}
|
|
7186
|
-
var _loop_1 = function (option) {
|
|
7187
|
-
if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
|
|
7188
|
-
return "continue";
|
|
7189
|
-
}
|
|
7190
|
-
var opt = new InputClass(this_1.environment, this_1.l, option.Name, option.Icon, option.InputType === exports.PermissionInputTypeEnum.Icon ? exports.InputType.Icon : exports.InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
7191
|
-
opt.condition = option.Condition;
|
|
7192
|
-
if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
|
|
7193
|
-
var p = new PermissionClass();
|
|
7194
|
-
p.RelatedId = this_1.permissions.RelatedId;
|
|
7195
|
-
p.Area = this_1.permissions.Area;
|
|
7196
|
-
p.Controller = option.Controller ? option.Controller : this_1.permissions.Controller;
|
|
7197
|
-
p.Action = this_1.permissions.Action;
|
|
7198
|
-
opt.url = p.getUrl() + option.Action + '/{}';
|
|
7199
|
-
opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
|
|
7200
|
-
}
|
|
7201
|
-
else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
|
|
7202
|
-
opt.modal = option.Modal;
|
|
7203
|
-
opt.onClick = function (btn) {
|
|
7204
|
-
var e_4, _a;
|
|
7205
|
-
if (opt.modal.table) {
|
|
7206
|
-
var p = new PermissionClass();
|
|
7207
|
-
p.RelatedId = btn.row.Id;
|
|
7208
|
-
p.Area = _this.permissions.Area;
|
|
7209
|
-
p.Controller = _this.permissions.Controller;
|
|
7210
|
-
p.Action = option.Action;
|
|
7211
|
-
p.Accesses = option.Accesses;
|
|
7212
|
-
opt.modal.table.permissions = p;
|
|
7213
|
-
if (opt.modal.table.form) {
|
|
7214
|
-
opt.modal.table.form.url = p.getUrl() + 'Insert';
|
|
7215
|
-
opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
7216
|
-
}
|
|
7217
|
-
opt.modal.table.set();
|
|
7218
|
-
}
|
|
7219
|
-
if (opt.modal.form) {
|
|
7220
|
-
opt.modal.form.name = option.Name;
|
|
7221
|
-
opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
|
|
7222
|
-
opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
|
|
7223
|
-
opt.modal.form.onSuccessBase = function () {
|
|
7224
|
-
opt.modal.hide();
|
|
7225
|
-
};
|
|
7226
|
-
}
|
|
7227
|
-
if (opt.modal.accordion) {
|
|
7228
|
-
try {
|
|
7229
|
-
for (var _b = (e_4 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7230
|
-
var r = _c.value;
|
|
7231
|
-
if (r.table) {
|
|
7232
|
-
var p = new PermissionClass();
|
|
7233
|
-
p.RelatedId = btn.row.Id;
|
|
7234
|
-
p.Area = _this.permissions.Area;
|
|
7235
|
-
p.Controller = _this.permissions.Controller;
|
|
7236
|
-
p.Action = r.name;
|
|
7237
|
-
p.Accesses = option.Accesses;
|
|
7238
|
-
r.table.permissions = p;
|
|
7239
|
-
if (r.table.form) {
|
|
7240
|
-
r.table.form.url = p.getUrl() + 'Insert';
|
|
7241
|
-
r.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
7242
|
-
}
|
|
7243
|
-
r.table.set();
|
|
7244
|
-
}
|
|
7245
|
-
}
|
|
7246
|
-
}
|
|
7247
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
7248
|
-
finally {
|
|
7249
|
-
try {
|
|
7250
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7251
|
-
}
|
|
7252
|
-
finally { if (e_4) throw e_4.error; }
|
|
7253
|
-
}
|
|
7254
|
-
}
|
|
7255
|
-
};
|
|
7256
|
-
}
|
|
7257
|
-
else if (option.InputAction === exports.PermissionInputActionEnum.Report) {
|
|
7258
|
-
var p = new PermissionClass();
|
|
7259
|
-
p.RelatedId = 'Index';
|
|
7260
|
-
p.Area = this_1.permissions.Area;
|
|
7261
|
-
p.Controller = 'Print';
|
|
7262
|
-
p.Action = option.Action;
|
|
7263
|
-
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
7264
|
-
opt.urlNewTab = true;
|
|
7265
|
-
}
|
|
7266
|
-
else if (option.InputAction === exports.PermissionInputActionEnum.File) {
|
|
7267
|
-
var p = new PermissionClass();
|
|
7268
|
-
p.RelatedId = this_1.permissions.RelatedId;
|
|
7269
|
-
p.Area = this_1.permissions.Area;
|
|
7270
|
-
p.Controller = this_1.permissions.Controller;
|
|
7271
|
-
p.Action = (this_1.permissions.Action ? this_1.permissions.Action : '') + option.Action;
|
|
7272
|
-
opt.url = '/File' + p.getUrl() + '/{}';
|
|
7273
|
-
opt.urlNewTab = true;
|
|
7274
|
-
}
|
|
7275
|
-
else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
|
|
7276
|
-
opt.onClick = function (btn) {
|
|
7277
|
-
var p = new PermissionClass();
|
|
7278
|
-
p.RelatedId = _this.permissions.RelatedId;
|
|
7279
|
-
p.Area = _this.permissions.Area;
|
|
7280
|
-
p.Controller = _this.permissions.Controller;
|
|
7281
|
-
p.Action = option.Action;
|
|
7282
|
-
_this.showConfirm(_this.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
|
|
7283
|
-
_this.load();
|
|
7284
|
-
});
|
|
7285
|
-
};
|
|
7286
|
-
}
|
|
7287
|
-
else if (option.Type === exports.PermissionTypeEnum.Option) {
|
|
7288
|
-
if (option.OnClick) {
|
|
7289
|
-
opt.onClick = function (btn) {
|
|
7290
|
-
option.OnClick(btn);
|
|
7291
|
-
};
|
|
7292
|
-
}
|
|
7293
|
-
}
|
|
7294
|
-
this_1.options.push(opt);
|
|
7295
|
-
};
|
|
7296
|
-
var this_1 = this;
|
|
7297
|
-
try {
|
|
7298
|
-
for (var _e = __values(this.permissions.getOptions()), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
7299
|
-
var option = _f.value;
|
|
7300
|
-
_loop_1(option);
|
|
7301
|
-
}
|
|
7302
|
-
}
|
|
7303
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
7304
|
-
finally {
|
|
7305
|
-
try {
|
|
7306
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
7307
|
-
}
|
|
7308
|
-
finally { if (e_3) throw e_3.error; }
|
|
7309
|
-
}
|
|
7310
7314
|
};
|
|
7311
7315
|
return TableClass;
|
|
7312
7316
|
}());
|