ps-toolkit-ui 0.0.117 → 0.0.121
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 +94 -104
- 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/form.class.js +1 -2
- package/esm2015/lib/classes/table.class.js +2 -6
- package/esm2015/lib/components/table/report/table.report.component.js +17 -16
- package/esm2015/lib/components/table/row/table.row.component.js +59 -77
- package/esm2015/lib/components/table/table.component.js +9 -8
- package/fesm2015/ps-toolkit-ui.js +83 -103
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/form.class.d.ts +0 -1
- package/lib/classes/table.class.d.ts +1 -2
- package/lib/components/table/row/table.row.component.d.ts +1 -3
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -1703,7 +1703,6 @@
|
|
|
1703
1703
|
this.match = null;
|
|
1704
1704
|
this.rel = null;
|
|
1705
1705
|
this.relUrl = null;
|
|
1706
|
-
this.condition = null;
|
|
1707
1706
|
this.style = {};
|
|
1708
1707
|
this.position = 'bottom';
|
|
1709
1708
|
this.onChange = null;
|
|
@@ -2454,8 +2453,6 @@
|
|
|
2454
2453
|
this.confirmShow = new core.EventEmitter();
|
|
2455
2454
|
this.changeRows = new core.EventEmitter();
|
|
2456
2455
|
this.loadParent = new core.EventEmitter();
|
|
2457
|
-
this.optEdit = null;
|
|
2458
|
-
this.optDelete = null;
|
|
2459
2456
|
this.showChildren = null;
|
|
2460
2457
|
this.addChildren = null;
|
|
2461
2458
|
this.itemsWidth = 0;
|
|
@@ -2477,14 +2474,6 @@
|
|
|
2477
2474
|
var percent = _a.percent;
|
|
2478
2475
|
return a + percent;
|
|
2479
2476
|
}, 0);
|
|
2480
|
-
var updateAccess = this.table.permissions.getAccess('Update');
|
|
2481
|
-
var deleteAccess = this.table.permissions.getAccess('Delete');
|
|
2482
|
-
if (updateAccess != null) {
|
|
2483
|
-
this.optEdit = new InputClass(this.table.environment, this.table.l, updateAccess.Name, 'fad fa-pen', exports.InputType.Icon, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
2484
|
-
}
|
|
2485
|
-
if (deleteAccess != null) {
|
|
2486
|
-
this.optDelete = new InputClass(this.table.environment, this.table.l, deleteAccess.Name, 'fad fa-trash', exports.InputType.Icon, 'red h-25 m-h-5 d-ib va-m f-u');
|
|
2487
|
-
}
|
|
2488
2477
|
if (this.table.hasChildren) {
|
|
2489
2478
|
if (!this.table.childrenAutoLoad) {
|
|
2490
2479
|
this.children = this.getChildren();
|
|
@@ -2526,58 +2515,6 @@
|
|
|
2526
2515
|
});
|
|
2527
2516
|
};
|
|
2528
2517
|
}
|
|
2529
|
-
if (this.optEdit !== null) {
|
|
2530
|
-
if (this.table.form) {
|
|
2531
|
-
this.optEdit.onClick = function () {
|
|
2532
|
-
_this.table.form.url = _this.table.url + 'Update/' + _this.row.Data.Id;
|
|
2533
|
-
if (_this.table.hasChildren && _this.row.Data.ParentId != null) {
|
|
2534
|
-
_this.table.form.onSuccessBase = function () {
|
|
2535
|
-
_this.table.modal.hide();
|
|
2536
|
-
if (_this.table.childrenAutoLoad) {
|
|
2537
|
-
_this.loadParent.emit(_this.row.Data.ParentId);
|
|
2538
|
-
}
|
|
2539
|
-
else {
|
|
2540
|
-
_this.table.load();
|
|
2541
|
-
}
|
|
2542
|
-
};
|
|
2543
|
-
}
|
|
2544
|
-
else {
|
|
2545
|
-
_this.table.form.onSuccessBase = function () {
|
|
2546
|
-
if (!_this.table.form.onTop) {
|
|
2547
|
-
_this.table.modal.hide();
|
|
2548
|
-
}
|
|
2549
|
-
_this.table.form.clear();
|
|
2550
|
-
_this.table.load();
|
|
2551
|
-
};
|
|
2552
|
-
}
|
|
2553
|
-
_this.edit();
|
|
2554
|
-
};
|
|
2555
|
-
}
|
|
2556
|
-
else {
|
|
2557
|
-
this.optEdit.url = this.table.url + '/Update/' + this.row.Data.Id;
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
if (this.optDelete != null) {
|
|
2561
|
-
this.optDelete.onClick = function () {
|
|
2562
|
-
if (_this.table.form) {
|
|
2563
|
-
_this.table.form.clear();
|
|
2564
|
-
}
|
|
2565
|
-
if (_this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
|
|
2566
|
-
_this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Data.Id; });
|
|
2567
|
-
_this.changeRows.emit(_this.row.Data);
|
|
2568
|
-
}
|
|
2569
|
-
else {
|
|
2570
|
-
_this.confirmShow.emit({ id: _this.row.Data.Id, accept: function () {
|
|
2571
|
-
if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.Data.ParentId != null) {
|
|
2572
|
-
_this.loadParent.emit(_this.row.Data.ParentId);
|
|
2573
|
-
}
|
|
2574
|
-
else {
|
|
2575
|
-
_this.table.load();
|
|
2576
|
-
}
|
|
2577
|
-
} });
|
|
2578
|
-
}
|
|
2579
|
-
};
|
|
2580
|
-
}
|
|
2581
2518
|
if (this.table.sortable) {
|
|
2582
2519
|
this.setSortRow();
|
|
2583
2520
|
}
|
|
@@ -2628,16 +2565,61 @@
|
|
|
2628
2565
|
var _this = this;
|
|
2629
2566
|
var opts = this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ?
|
|
2630
2567
|
[this.addChildren] : [];
|
|
2631
|
-
console.log(this.row.Options);
|
|
2632
2568
|
var _loop_1 = function (option) {
|
|
2633
|
-
console.log(this_1.table.options.filter(function (x) { return x.name === option.Name; }).length);
|
|
2634
|
-
if (this_1.table.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
|
|
2635
|
-
return "continue";
|
|
2636
|
-
}
|
|
2637
2569
|
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');
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2570
|
+
if (option.Action === 'Update') {
|
|
2571
|
+
if (this_1.table.form) {
|
|
2572
|
+
opt.onClick = function () {
|
|
2573
|
+
_this.table.form.url = _this.table.url + 'Update/' + _this.row.Data.Id;
|
|
2574
|
+
if (_this.table.hasChildren && _this.row.Data.ParentId != null) {
|
|
2575
|
+
_this.table.form.onSuccessBase = function () {
|
|
2576
|
+
_this.table.modal.hide();
|
|
2577
|
+
if (_this.table.childrenAutoLoad) {
|
|
2578
|
+
_this.loadParent.emit(_this.row.Data.ParentId);
|
|
2579
|
+
}
|
|
2580
|
+
else {
|
|
2581
|
+
_this.table.load();
|
|
2582
|
+
}
|
|
2583
|
+
};
|
|
2584
|
+
}
|
|
2585
|
+
else {
|
|
2586
|
+
_this.table.form.onSuccessBase = function () {
|
|
2587
|
+
if (!_this.table.form.onTop) {
|
|
2588
|
+
_this.table.modal.hide();
|
|
2589
|
+
}
|
|
2590
|
+
_this.table.form.clear();
|
|
2591
|
+
_this.table.load();
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
_this.edit(opt);
|
|
2595
|
+
};
|
|
2596
|
+
}
|
|
2597
|
+
else {
|
|
2598
|
+
opt.url = this_1.table.url + '/Update/' + this_1.row.Data.Id;
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
else if (option.Action === 'Delete') {
|
|
2602
|
+
opt.onClick = function () {
|
|
2603
|
+
if (_this.table.form) {
|
|
2604
|
+
_this.table.form.clear();
|
|
2605
|
+
}
|
|
2606
|
+
if (_this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
|
|
2607
|
+
_this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Data.Id; });
|
|
2608
|
+
_this.changeRows.emit(_this.row.Data);
|
|
2609
|
+
}
|
|
2610
|
+
else {
|
|
2611
|
+
_this.confirmShow.emit({ id: _this.row.Data.Id, accept: function () {
|
|
2612
|
+
if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.Data.ParentId != null) {
|
|
2613
|
+
_this.loadParent.emit(_this.row.Data.ParentId);
|
|
2614
|
+
}
|
|
2615
|
+
else {
|
|
2616
|
+
_this.table.load();
|
|
2617
|
+
}
|
|
2618
|
+
} });
|
|
2619
|
+
}
|
|
2620
|
+
};
|
|
2621
|
+
}
|
|
2622
|
+
else if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
|
|
2641
2623
|
var p = new PermissionClass();
|
|
2642
2624
|
p.RelatedId = this_1.table.permissions.RelatedId;
|
|
2643
2625
|
p.Area = this_1.table.permissions.Area;
|
|
@@ -2647,7 +2629,7 @@
|
|
|
2647
2629
|
opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
|
|
2648
2630
|
}
|
|
2649
2631
|
else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
|
|
2650
|
-
opt.modal = option.Modal;
|
|
2632
|
+
opt.modal = this_1.table.optionActions[option.Action].Modal;
|
|
2651
2633
|
opt.onClick = function (btn) {
|
|
2652
2634
|
var e_2, _a;
|
|
2653
2635
|
if (opt.modal.table) {
|
|
@@ -2832,19 +2814,18 @@
|
|
|
2832
2814
|
});
|
|
2833
2815
|
return c;
|
|
2834
2816
|
};
|
|
2835
|
-
TableRowComponent.prototype.edit = function () {
|
|
2817
|
+
TableRowComponent.prototype.edit = function (opt) {
|
|
2836
2818
|
var _this = this;
|
|
2837
|
-
var editAccess = this.table.permissions.getAccess('Update');
|
|
2838
2819
|
if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
|
|
2839
|
-
this.table.form.name =
|
|
2820
|
+
this.table.form.name = opt.name;
|
|
2840
2821
|
this.table.form.setData(this.row.Data);
|
|
2841
2822
|
this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
|
|
2842
2823
|
this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
|
|
2843
2824
|
this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
|
|
2844
2825
|
}
|
|
2845
2826
|
else {
|
|
2846
|
-
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Data.Id, exports.Method.Post, null,
|
|
2847
|
-
_this.table.form.name =
|
|
2827
|
+
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Data.Id, exports.Method.Post, null, opt, function (result) {
|
|
2828
|
+
_this.table.form.name = opt.name;
|
|
2848
2829
|
_this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
|
|
2849
2830
|
_this.table.form.setData(result);
|
|
2850
2831
|
_this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
|
|
@@ -3011,11 +2992,7 @@
|
|
|
3011
2992
|
}
|
|
3012
2993
|
};
|
|
3013
2994
|
TableComponent.prototype.getOptions = function () {
|
|
3014
|
-
return
|
|
3015
|
-
var i = HelperClass.clone(o);
|
|
3016
|
-
i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
|
|
3017
|
-
return i;
|
|
3018
|
-
}).concat(this.table.permissions && this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
|
|
2995
|
+
return [];
|
|
3019
2996
|
};
|
|
3020
2997
|
TableComponent.prototype.setSortable = function () {
|
|
3021
2998
|
var _this = this;
|
|
@@ -3043,7 +3020,24 @@
|
|
|
3043
3020
|
return c;
|
|
3044
3021
|
};
|
|
3045
3022
|
TableComponent.prototype.getOptionModals = function () {
|
|
3046
|
-
|
|
3023
|
+
var e_2, _a;
|
|
3024
|
+
var modals = [];
|
|
3025
|
+
try {
|
|
3026
|
+
for (var _b = __values(Object.entries(this.table.optionActions)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3027
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
3028
|
+
if (this.table.optionActions[key].modal) {
|
|
3029
|
+
modals.push(this.table.optionActions[key].modal);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3034
|
+
finally {
|
|
3035
|
+
try {
|
|
3036
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3037
|
+
}
|
|
3038
|
+
finally { if (e_2) throw e_2.error; }
|
|
3039
|
+
}
|
|
3040
|
+
return modals;
|
|
3047
3041
|
};
|
|
3048
3042
|
TableComponent.prototype.onChangeRows = function (e) {
|
|
3049
3043
|
return this.changeRows.emit(e);
|
|
@@ -6631,22 +6625,22 @@
|
|
|
6631
6625
|
}, 500);
|
|
6632
6626
|
};
|
|
6633
6627
|
TableReportComponent.prototype.getOptions = function () {
|
|
6634
|
-
|
|
6635
|
-
return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
})).concat(this.table.hasStatus ? [this.optStatus] : [])
|
|
6648
|
-
|
|
6649
|
-
|
|
6628
|
+
return [];
|
|
6629
|
+
// return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
|
|
6630
|
+
// .concat(this.table.options.map((o) => {
|
|
6631
|
+
// const i = HelperClass.clone(o);
|
|
6632
|
+
// if (i.url){
|
|
6633
|
+
// i.url = i.url.replace('{}', this.row.Id);
|
|
6634
|
+
// }
|
|
6635
|
+
// if (i.modal && i.modal.form){
|
|
6636
|
+
// i.modal.form.url = i.modal.form.url.replace('{}', this.row.Id);
|
|
6637
|
+
// }
|
|
6638
|
+
// i.row = this.row;
|
|
6639
|
+
// i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
|
|
6640
|
+
// return i;
|
|
6641
|
+
// })).concat(this.table.hasStatus ? [this.optStatus] : [])
|
|
6642
|
+
// .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
|
|
6643
|
+
// .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
|
|
6650
6644
|
};
|
|
6651
6645
|
TableReportComponent.prototype.getCell = function (col) {
|
|
6652
6646
|
console.log('getCell');
|
|
@@ -7123,7 +7117,7 @@
|
|
|
7123
7117
|
this.perPage = 10;
|
|
7124
7118
|
this.cols = [];
|
|
7125
7119
|
this.buttons = [];
|
|
7126
|
-
this.
|
|
7120
|
+
this.optionActions = {};
|
|
7127
7121
|
this.rows = [];
|
|
7128
7122
|
this.count = 0;
|
|
7129
7123
|
this.page = 1;
|
|
@@ -7157,10 +7151,6 @@
|
|
|
7157
7151
|
this.perPage = perPage;
|
|
7158
7152
|
this.height = height;
|
|
7159
7153
|
}
|
|
7160
|
-
TableClass.prototype.hasOption = function () {
|
|
7161
|
-
return this.permissions && (this.permissions.hasAccess('Delete') ||
|
|
7162
|
-
this.permissions.hasAccess('Update') || this.hasStatus || this.options.length > 0 || this.hasChildren);
|
|
7163
|
-
};
|
|
7164
7154
|
TableClass.prototype.load = function (btn) {
|
|
7165
7155
|
if (btn === void 0) { btn = null; }
|
|
7166
7156
|
if (this.url) {
|