ps-toolkit-ui 0.0.117 → 0.0.118

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.
@@ -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,64 @@
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
2569
  if (this_1.table.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
2635
2570
  return "continue";
2636
2571
  }
2637
2572
  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
- opt.condition = option.Condition;
2639
- console.log(option.InputAction);
2640
- if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
2573
+ if (option.Action === 'Update') {
2574
+ if (this_1.table.form) {
2575
+ opt.onClick = function () {
2576
+ _this.table.form.url = _this.table.url + 'Update/' + _this.row.Data.Id;
2577
+ if (_this.table.hasChildren && _this.row.Data.ParentId != null) {
2578
+ _this.table.form.onSuccessBase = function () {
2579
+ _this.table.modal.hide();
2580
+ if (_this.table.childrenAutoLoad) {
2581
+ _this.loadParent.emit(_this.row.Data.ParentId);
2582
+ }
2583
+ else {
2584
+ _this.table.load();
2585
+ }
2586
+ };
2587
+ }
2588
+ else {
2589
+ _this.table.form.onSuccessBase = function () {
2590
+ if (!_this.table.form.onTop) {
2591
+ _this.table.modal.hide();
2592
+ }
2593
+ _this.table.form.clear();
2594
+ _this.table.load();
2595
+ };
2596
+ }
2597
+ _this.edit(opt);
2598
+ };
2599
+ }
2600
+ else {
2601
+ opt.url = this_1.table.url + '/Update/' + this_1.row.Data.Id;
2602
+ }
2603
+ }
2604
+ else if (option.Action === 'Delete') {
2605
+ opt.onClick = function () {
2606
+ if (_this.table.form) {
2607
+ _this.table.form.clear();
2608
+ }
2609
+ if (_this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
2610
+ _this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Data.Id; });
2611
+ _this.changeRows.emit(_this.row.Data);
2612
+ }
2613
+ else {
2614
+ _this.confirmShow.emit({ id: _this.row.Data.Id, accept: function () {
2615
+ if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.Data.ParentId != null) {
2616
+ _this.loadParent.emit(_this.row.Data.ParentId);
2617
+ }
2618
+ else {
2619
+ _this.table.load();
2620
+ }
2621
+ } });
2622
+ }
2623
+ };
2624
+ }
2625
+ else if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
2641
2626
  var p = new PermissionClass();
2642
2627
  p.RelatedId = this_1.table.permissions.RelatedId;
2643
2628
  p.Area = this_1.table.permissions.Area;
@@ -2832,7 +2817,7 @@
2832
2817
  });
2833
2818
  return c;
2834
2819
  };
2835
- TableRowComponent.prototype.edit = function () {
2820
+ TableRowComponent.prototype.edit = function (opt) {
2836
2821
  var _this = this;
2837
2822
  var editAccess = this.table.permissions.getAccess('Update');
2838
2823
  if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
@@ -2843,7 +2828,7 @@
2843
2828
  this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
2844
2829
  }
2845
2830
  else {
2846
- 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) {
2831
+ new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Data.Id, exports.Method.Post, null, opt, function (result) {
2847
2832
  _this.table.form.name = editAccess.Name;
2848
2833
  _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
2849
2834
  _this.table.form.setData(result);
@@ -3011,7 +2996,7 @@
3011
2996
  }
3012
2997
  };
3013
2998
  TableComponent.prototype.getOptions = function () {
3014
- return this.table.options.filter(function (x) { return x.condition == null; }).map(function (o) {
2999
+ return this.table.options.map(function (o) {
3015
3000
  var i = HelperClass.clone(o);
3016
3001
  i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
3017
3002
  return i;
@@ -6633,7 +6618,7 @@
6633
6618
  TableReportComponent.prototype.getOptions = function () {
6634
6619
  var _this = this;
6635
6620
  return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
6636
- .concat(this.table.options.filter(function (x) { return x.condition == null || x.condition(_this.row); }).map(function (o) {
6621
+ .concat(this.table.options.map(function (o) {
6637
6622
  var i = HelperClass.clone(o);
6638
6623
  if (i.url) {
6639
6624
  i.url = i.url.replace('{}', _this.row.Id);
@@ -7157,10 +7142,6 @@
7157
7142
  this.perPage = perPage;
7158
7143
  this.height = height;
7159
7144
  }
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
7145
  TableClass.prototype.load = function (btn) {
7165
7146
  if (btn === void 0) { btn = null; }
7166
7147
  if (this.url) {