ps-toolkit-ui 0.0.118 → 0.0.122

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.
@@ -2566,9 +2566,6 @@
2566
2566
  var opts = this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ?
2567
2567
  [this.addChildren] : [];
2568
2568
  var _loop_1 = function (option) {
2569
- if (this_1.table.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
2570
- return "continue";
2571
- }
2572
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');
2573
2570
  if (option.Action === 'Update') {
2574
2571
  if (this_1.table.form) {
@@ -2632,7 +2629,7 @@
2632
2629
  opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
2633
2630
  }
2634
2631
  else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
2635
- opt.modal = option.Modal;
2632
+ opt.modal = this_1.table.modals.find(function (x) { return x.name === option.Action; });
2636
2633
  opt.onClick = function (btn) {
2637
2634
  var e_2, _a;
2638
2635
  if (opt.modal.table) {
@@ -2819,9 +2816,8 @@
2819
2816
  };
2820
2817
  TableRowComponent.prototype.edit = function (opt) {
2821
2818
  var _this = this;
2822
- var editAccess = this.table.permissions.getAccess('Update');
2823
2819
  if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
2824
- this.table.form.name = editAccess.Name;
2820
+ this.table.form.name = opt.name;
2825
2821
  this.table.form.setData(this.row.Data);
2826
2822
  this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
2827
2823
  this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
@@ -2829,7 +2825,7 @@
2829
2825
  }
2830
2826
  else {
2831
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) {
2832
- _this.table.form.name = editAccess.Name;
2828
+ _this.table.form.name = opt.name;
2833
2829
  _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
2834
2830
  _this.table.form.setData(result);
2835
2831
  _this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
@@ -2996,11 +2992,7 @@
2996
2992
  }
2997
2993
  };
2998
2994
  TableComponent.prototype.getOptions = function () {
2999
- return this.table.options.map(function (o) {
3000
- var i = HelperClass.clone(o);
3001
- i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
3002
- return i;
3003
- }).concat(this.table.permissions && this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
2995
+ return [];
3004
2996
  };
3005
2997
  TableComponent.prototype.setSortable = function () {
3006
2998
  var _this = this;
@@ -3027,9 +3019,15 @@
3027
3019
  c.forEach(function (x, i) { return x.RowNum = c.length - i + 1; });
3028
3020
  return c;
3029
3021
  };
3030
- TableComponent.prototype.getOptionModals = function () {
3031
- return this.table.options.filter(function (x) { return x.modal != null; });
3032
- };
3022
+ // getOptionModals(): InputClass[]{
3023
+ // const modals = [];
3024
+ // for (const [key, value] of Object.entries(this.table.optionActions)) {
3025
+ // if (this.table.optionActions[key].modal){
3026
+ // modals.push(this.table.optionActions[key].modal);
3027
+ // }
3028
+ // }
3029
+ // return modals;
3030
+ // }
3033
3031
  TableComponent.prototype.onChangeRows = function (e) {
3034
3032
  return this.changeRows.emit(e);
3035
3033
  };
@@ -3049,7 +3047,7 @@
3049
3047
  TableComponent.decorators = [
3050
3048
  { type: core.Component, args: [{
3051
3049
  selector: 'lib-table',
3052
- template: "<div [id]=\"table.id + 'Table'\" [style]=\"table.style\" #tableDiv [className]=\"(table.class ? table.class : '') + (table.sortable ? 'sortable' : '') + (table.hasChildren ? ' has-children' : '') + ' table-con'\">\r\n <div *ngIf=\"table.displayLabel\" class=\"title\">\r\n {{this.table.title ? this.table.title : 'List'}}\r\n <div class=\"extra-buttons\" *ngIf=\"table.showExtraButtons\">\r\n <lib-form-icon *ngFor=\"let btn of table.extraButtons\" [inp]=\"btn\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"reload\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"maximum\"></lib-form-icon>\r\n </div>\r\n <div *ngIf=\"table.buttons.length > 0\" class=\"buttons\">\r\n <lib-form-button [inp]=\"btn\" *ngFor=\"let btn of table.buttons\"></lib-form-button>\r\n </div>\r\n </div>\r\n <div class=\"search-form\" *ngIf=\"table.searchForm\">\r\n <lib-form [form]=\"table.searchForm\"></lib-form>\r\n </div>\r\n <lib-form *ngIf=\"table.form && table.form.onTop\" [form]=\"table.form\"></lib-form>\r\n <table>\r\n <thead>\r\n <tr>\r\n <th *ngIf=\"table.hasChildren\" style=\"width: 50px\"></th>\r\n <th *ngIf=\"table.sortable\" style=\"width: 50px\"></th>\r\n <th *ngIf=\"table.withSelect\" style=\"width: 50px\">\r\n <i (click)=\"selectAll()\" [className]=\"(allSelected() ? 'fas fa-check-square green' : isSelected() ? 'fas fa-minus-square green' : 'far fa-square') + ' select-row'\" *ngIf=\"table.rows.length > 0\"></i>\r\n </th>\r\n <th (click)=\"!table.sortable && col.sort && changeSort($event, col.name)\" [className]=\"(!table.sortable && col.sort ? 'sort' : '')\" *ngFor=\"let col of table.cols\" [style]=\"{width: col.percent + '%'}\">\r\n <i *ngIf=\"!table.sortable && col.sort\" [className]=\"'sort-icon fas' + (table.sort === col.name ? (table.sortType === 'ASC' ? ' fa-sort-up' : ' fa-sort-down') : ' fa-sort')\"></i>\r\n <span *ngIf=\"col.search == null\">{{ table.l(col.name) }}</span>\r\n <div class=\"w-90 header-search p-h-20 m-r-5\" *ngIf=\"!table.sortable && col.search != null\">\r\n <lib-form-textbox *ngIf=\"col.type != colType.Date\" [inp]=\"col.search\"></lib-form-textbox>\r\n <lib-form-date *ngIf=\"col.type == colType.Date\" [inp]=\"col.search\"></lib-form-date>\r\n </div>\r\n </th>\r\n <th *ngIf=\"table.optionType == tableOptionType.Show\" [style]=\"{width: (100 - itemsWidth) + '%'}\">{{table.l('Options')}}</th>\r\n<!-- <th *ngIf=\"table.hasOption()\" [style]=\"{width: (100 - itemsWidth) + '%'}\">-->\r\n<!-- <span *ngIf=\"!table.withSelect || !isSelected()\">{{ table.l('Options') }}</span>-->\r\n<!-- <span *ngIf=\"table.withSelect && isSelected()\" class=\"option-con\">-->\r\n<!-- <span *ngFor=\"let opt of options\">-->\r\n<!-- <lib-form-button *ngIf=\"opt.type == type.Button\" [inp]=\"opt\"></lib-form-button>-->\r\n<!-- <lib-form-icon *ngIf=\"opt.type == type.Icon\" [inp]=\"opt\"></lib-form-icon>-->\r\n<!-- </span>-->\r\n<!-- </span>-->\r\n<!-- </th>-->\r\n </tr>\r\n </thead>\r\n <tbody #rows [style]=\"table.perPage > 0 ? {height: table.height * table.perPage + 'px'} : table.loading || !table.permission || table.rows.length == 0 ? {height: '100px'} : {}\">\r\n <lib-table-row (confirmShow)=\"onConfirmShow($event)\" [level]=\"1\" (changeRows)=\"onChangeRows($event)\" [id]=\"row.id ? row.id : ''\" [table]=\"table\" [row]=\"row\" *ngFor=\"let row of getRows()\"></lib-table-row>\r\n <tr *ngIf=\"table.perPage > 0\" [style]=\"{height: (table.perPage > 0 ? (table.perPage - table.rows.length) * table.height : '100') + 'px', visibility: 'hidden'}\"></tr>\r\n <lib-table-loading [table]=\"table\"></lib-table-loading>\r\n </tbody>\r\n <tfoot>\r\n <tr>\r\n <td colspan=\"100%\">\r\n <lib-table-pagination [table]=\"table\" *ngIf=\"table.perPage > 0\"></lib-table-pagination>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n <lib-modal *ngIf=\"table.modal != null\" [modal]=\"table.modal\"></lib-modal>\r\n <lib-modal [modal]=\"opt.modal\" *ngFor=\"let opt of getOptionModals()\"></lib-modal>\r\n <lib-confirm #confirm [tableId]=\"table.name\"></lib-confirm>\r\n</div>\r\n",
3050
+ template: "<div [id]=\"table.id + 'Table'\" [style]=\"table.style\" #tableDiv [className]=\"(table.class ? table.class : '') + (table.sortable ? 'sortable' : '') + (table.hasChildren ? ' has-children' : '') + ' table-con'\">\r\n <div *ngIf=\"table.displayLabel\" class=\"title\">\r\n {{this.table.title ? this.table.title : 'List'}}\r\n <div class=\"extra-buttons\" *ngIf=\"table.showExtraButtons\">\r\n <lib-form-icon *ngFor=\"let btn of table.extraButtons\" [inp]=\"btn\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"reload\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"maximum\"></lib-form-icon>\r\n </div>\r\n <div *ngIf=\"table.buttons.length > 0\" class=\"buttons\">\r\n <lib-form-button [inp]=\"btn\" *ngFor=\"let btn of table.buttons\"></lib-form-button>\r\n </div>\r\n </div>\r\n <div class=\"search-form\" *ngIf=\"table.searchForm\">\r\n <lib-form [form]=\"table.searchForm\"></lib-form>\r\n </div>\r\n <lib-form *ngIf=\"table.form && table.form.onTop\" [form]=\"table.form\"></lib-form>\r\n <table>\r\n <thead>\r\n <tr>\r\n <th *ngIf=\"table.hasChildren\" style=\"width: 50px\"></th>\r\n <th *ngIf=\"table.sortable\" style=\"width: 50px\"></th>\r\n <th *ngIf=\"table.withSelect\" style=\"width: 50px\">\r\n <i (click)=\"selectAll()\" [className]=\"(allSelected() ? 'fas fa-check-square green' : isSelected() ? 'fas fa-minus-square green' : 'far fa-square') + ' select-row'\" *ngIf=\"table.rows.length > 0\"></i>\r\n </th>\r\n <th (click)=\"!table.sortable && col.sort && changeSort($event, col.name)\" [className]=\"(!table.sortable && col.sort ? 'sort' : '')\" *ngFor=\"let col of table.cols\" [style]=\"{width: col.percent + '%'}\">\r\n <i *ngIf=\"!table.sortable && col.sort\" [className]=\"'sort-icon fas' + (table.sort === col.name ? (table.sortType === 'ASC' ? ' fa-sort-up' : ' fa-sort-down') : ' fa-sort')\"></i>\r\n <span *ngIf=\"col.search == null\">{{ table.l(col.name) }}</span>\r\n <div class=\"w-90 header-search p-h-20 m-r-5\" *ngIf=\"!table.sortable && col.search != null\">\r\n <lib-form-textbox *ngIf=\"col.type != colType.Date\" [inp]=\"col.search\"></lib-form-textbox>\r\n <lib-form-date *ngIf=\"col.type == colType.Date\" [inp]=\"col.search\"></lib-form-date>\r\n </div>\r\n </th>\r\n <th *ngIf=\"table.optionType == tableOptionType.Show\" [style]=\"{width: (100 - itemsWidth) + '%'}\">{{table.l('Options')}}</th>\r\n<!-- <th *ngIf=\"table.hasOption()\" [style]=\"{width: (100 - itemsWidth) + '%'}\">-->\r\n<!-- <span *ngIf=\"!table.withSelect || !isSelected()\">{{ table.l('Options') }}</span>-->\r\n<!-- <span *ngIf=\"table.withSelect && isSelected()\" class=\"option-con\">-->\r\n<!-- <span *ngFor=\"let opt of options\">-->\r\n<!-- <lib-form-button *ngIf=\"opt.type == type.Button\" [inp]=\"opt\"></lib-form-button>-->\r\n<!-- <lib-form-icon *ngIf=\"opt.type == type.Icon\" [inp]=\"opt\"></lib-form-icon>-->\r\n<!-- </span>-->\r\n<!-- </span>-->\r\n<!-- </th>-->\r\n </tr>\r\n </thead>\r\n <tbody #rows [style]=\"table.perPage > 0 ? {height: table.height * table.perPage + 'px'} : table.loading || !table.permission || table.rows.length == 0 ? {height: '100px'} : {}\">\r\n <lib-table-row (confirmShow)=\"onConfirmShow($event)\" [level]=\"1\" (changeRows)=\"onChangeRows($event)\" [id]=\"row.id ? row.id : ''\" [table]=\"table\" [row]=\"row\" *ngFor=\"let row of getRows()\"></lib-table-row>\r\n <tr *ngIf=\"table.perPage > 0\" [style]=\"{height: (table.perPage > 0 ? (table.perPage - table.rows.length) * table.height : '100') + 'px', visibility: 'hidden'}\"></tr>\r\n <lib-table-loading [table]=\"table\"></lib-table-loading>\r\n </tbody>\r\n <tfoot>\r\n <tr>\r\n <td colspan=\"100%\">\r\n <lib-table-pagination [table]=\"table\" *ngIf=\"table.perPage > 0\"></lib-table-pagination>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n <lib-modal *ngIf=\"table.modal != null\" [modal]=\"table.modal\"></lib-modal>\r\n <lib-modal [modal]=\"opt\" *ngFor=\"let opt of table.modals\"></lib-modal>\r\n <lib-confirm #confirm [tableId]=\"table.name\"></lib-confirm>\r\n</div>\r\n",
3053
3051
  styles: [".table-con{background-color:#fff;border-radius:5px;box-shadow:var(--box-shadow-table);float:right;padding:20px;position:relative;width:100%}.table-con.maximum{border-radius:0;height:100%;overflow-y:auto;position:fixed;right:0;top:0;width:100%;z-index:11}.table-con>.title{float:right;font-family:VazirBold;font-size:16px;height:40px;line-height:40px;margin-bottom:10px;position:relative;text-align:right;width:100%}.table-con>.title .extra-buttons{float:left;margin-top:5px}.table-con>.title .buttons{float:left;margin-left:10px;margin-top:5px}.table-con>.search-form{border-radius:5px;float:right;margin-bottom:5px;width:100%}.table-con table{border-spacing:0!important;width:100%}.table-con table thead tr{-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;position:relative}.table-con table thead tr th{background-color:var(--base-11);color:var(--black-88);font-family:VazirLight;font-size:12px;font-weight:400;height:45px;position:relative;vertical-align:middle}.table-con table thead tr th:first-child{border-bottom-right-radius:5px;border-top-right-radius:5px}.table-con table thead tr th:last-child{border-bottom-left-radius:5px;border-top-left-radius:5px}.table-con table thead tr th.sort{cursor:pointer}.table-con table thead tr th .sort-icon{font-size:13px;height:20px;left:5px;line-height:20px;opacity:.6;position:absolute;top:calc(50% - 10px);width:20px}.table-con table tbody{position:relative}.table-con table tfoot tr{height:45px}.table-con table tfoot tr td{position:relative;vertical-align:bottom}::ng-deep .table-con:not(.sortable) table lib-table-row:last-of-type>tr:after{background-image:unset}::ng-deep .table-con table thead tr th .select-row{cursor:pointer;font-size:18px;height:30px;line-height:30px}"]
3054
3052
  },] }
3055
3053
  ];
@@ -6616,22 +6614,22 @@
6616
6614
  }, 500);
6617
6615
  };
6618
6616
  TableReportComponent.prototype.getOptions = function () {
6619
- var _this = this;
6620
- return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
6621
- .concat(this.table.options.map(function (o) {
6622
- var i = HelperClass.clone(o);
6623
- if (i.url) {
6624
- i.url = i.url.replace('{}', _this.row.Id);
6625
- }
6626
- if (i.modal && i.modal.form) {
6627
- i.modal.form.url = i.modal.form.url.replace('{}', _this.row.Id);
6628
- }
6629
- i.row = _this.row;
6630
- i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
6631
- return i;
6632
- })).concat(this.table.hasStatus ? [this.optStatus] : [])
6633
- .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
6634
- .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
6617
+ return [];
6618
+ // return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
6619
+ // .concat(this.table.options.map((o) => {
6620
+ // const i = HelperClass.clone(o);
6621
+ // if (i.url){
6622
+ // i.url = i.url.replace('{}', this.row.Id);
6623
+ // }
6624
+ // if (i.modal && i.modal.form){
6625
+ // i.modal.form.url = i.modal.form.url.replace('{}', this.row.Id);
6626
+ // }
6627
+ // i.row = this.row;
6628
+ // i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
6629
+ // return i;
6630
+ // })).concat(this.table.hasStatus ? [this.optStatus] : [])
6631
+ // .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
6632
+ // .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
6635
6633
  };
6636
6634
  TableReportComponent.prototype.getCell = function (col) {
6637
6635
  console.log('getCell');
@@ -7108,7 +7106,7 @@
7108
7106
  this.perPage = 10;
7109
7107
  this.cols = [];
7110
7108
  this.buttons = [];
7111
- this.options = [];
7109
+ this.modals = [];
7112
7110
  this.rows = [];
7113
7111
  this.count = 0;
7114
7112
  this.page = 1;