ps-toolkit-ui 0.0.102 → 0.0.106

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.
@@ -2694,6 +2694,7 @@
2694
2694
  this.router = router;
2695
2695
  this.changeRows = new core.EventEmitter();
2696
2696
  this.select = null;
2697
+ this.export = null;
2697
2698
  this.itemsWidth = 0;
2698
2699
  }
2699
2700
  Object.defineProperty(TableComponent.prototype, "type", {
@@ -2739,7 +2740,6 @@
2739
2740
  }, 0);
2740
2741
  this.reload = new InputClass(this.table.environment, this.table.l, 'Reload', 'fad fa-sync-alt', exports.InputType.Icon, 'm-h-5');
2741
2742
  this.maximum = new InputClass(this.table.environment, this.table.l, 'Maximum', 'fad fa-expand-arrows-alt', exports.InputType.Icon, 'm-h-5');
2742
- this.export = new InputClass(this.table.environment, this.table.l, 'Export', 'fad fa-arrow-to-bottom', exports.InputType.Icon, 'm-h-5');
2743
2743
  this.optDelete = new InputClass(this.table.environment, this.table.l, 'Delete', 'fad fa-trash', exports.InputType.Icon, 'red h-25 m-h-5 d-ib va-m f-u');
2744
2744
  try {
2745
2745
  for (var _b = __values(this.table.cols.filter(function (x) { return x.withSearch; })), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -2789,11 +2789,6 @@
2789
2789
  _this.maximum.icon = _this.maximum.name === 'Minimum' ? 'fad fa-expand-arrows-alt' : 'fad fa-compress-arrows-alt';
2790
2790
  _this.maximum.name = _this.maximum.name === 'Minimum' ? 'Maximum' : 'Minimum';
2791
2791
  };
2792
- this.export.onClick = function () {
2793
- if (!_this.export.loading) {
2794
- $__namespace(_this.exportDropDown.nativeElement).fadeToggle();
2795
- }
2796
- };
2797
2792
  this.optDelete.onClick = function (i) {
2798
2793
  if (_this.table.form) {
2799
2794
  _this.table.form.clear();
@@ -2824,7 +2819,7 @@
2824
2819
  }
2825
2820
  };
2826
2821
  TableComponent.prototype.getOptions = function () {
2827
- return this.table.isReport ? [] : this.table.options.filter(function (x) { return x.condition == null; }).map(function (o) {
2822
+ return this.table.options.filter(function (x) { return x.condition == null; }).map(function (o) {
2828
2823
  var i = HelperClass.clone(o);
2829
2824
  i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
2830
2825
  return i;
@@ -2872,59 +2867,13 @@
2872
2867
  this.table.sort = s;
2873
2868
  this.table.load();
2874
2869
  };
2875
- TableComponent.prototype.report = function (type) {
2876
- var _this = this;
2877
- $__namespace(this.exportDropDown.nativeElement).fadeOut();
2878
- if (type === 'Print' || type === 'PDF') {
2879
- window.open(this.table.getUrl(true), '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
2880
- }
2881
- else {
2882
- new RequestClass(this.table.l).send(this.table.getUrl(true), exports.Method.Post, null, this.export, function (result) {
2883
- var e_2, _a, e_3, _b;
2884
- var report = [];
2885
- try {
2886
- for (var _c = __values(result.List), _d = _c.next(); !_d.done; _d = _c.next()) {
2887
- var r = _d.value;
2888
- var row = {};
2889
- try {
2890
- for (var _e = (e_3 = void 0, __values(Object.keys(r))), _f = _e.next(); !_f.done; _f = _e.next()) {
2891
- var k = _f.value;
2892
- row[_this.table.l(k)] = r[k];
2893
- }
2894
- }
2895
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2896
- finally {
2897
- try {
2898
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
2899
- }
2900
- finally { if (e_3) throw e_3.error; }
2901
- }
2902
- report.push(row);
2903
- }
2904
- }
2905
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2906
- finally {
2907
- try {
2908
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
2909
- }
2910
- finally { if (e_2) throw e_2.error; }
2911
- }
2912
- if (type === 'Excel') {
2913
- // new ExcelService().exportAsExcelFile(report, 'Report');
2914
- }
2915
- else if (type === 'CSV') {
2916
- // new ExcelService().exportAsCsvFile(report, 'Report');
2917
- }
2918
- });
2919
- }
2920
- };
2921
2870
  return TableComponent;
2922
2871
  }());
2923
2872
  TableComponent.decorators = [
2924
2873
  { type: core.Component, args: [{
2925
2874
  selector: 'lib-table',
2926
- 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.extraButtons\">\r\n <div *ngIf=\"table.permissions && table.permissions.hasAccess('Report')\" class=\"export\">\r\n <lib-form-icon [inp]=\"export\"></lib-form-icon>\r\n <div class=\"export-dropdown\" #exportDropDown>\r\n <div (click)=\"report('Print')\" class=\"item\"><div class=\"text\">Print</div><i class=\"fad fa-print\"></i></div>\r\n <div (click)=\"report('Excel')\" class=\"item\"><div class=\"text\">Excel</div><i class=\"fad fa-file-excel\"></i></div>\r\n <div (click)=\"report('CSV')\" class=\"item\"><div class=\"text\">CSV</div><i class=\"fad fa-file-csv\"></i></div>\r\n <div (click)=\"report('PDF')\" class=\"item\"><div class=\"text\">PDF</div><i class=\"fad fa-file-pdf\"></i></div>\r\n </div>\r\n </div>\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",
2927
- 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 .extra-buttons .export{float:right;position:relative}.table-con>.title .extra-buttons .export .export-dropdown{background-color:#fff;border-radius:5px;box-shadow:var(--box-shadow-table);display:none;overflow:hidden;padding:15px 0;position:absolute;right:-50px;top:35px;width:130px;z-index:2}.table-con>.title .extra-buttons .export .export-dropdown .item{cursor:pointer;float:right;padding:0 15px;text-align:center;width:100%}.table-con>.title .extra-buttons .export .export-dropdown .item:hover{background-color:var(--black-22)}.table-con>.title .extra-buttons .export .export-dropdown .text{float:right;font-family:VazirLight;font-size:13px;height:40px;line-height:41px;width:70%}.table-con>.title .extra-buttons .export .export-dropdown i{color:var(--black-88);float:right;font-size:14px;height:40px;line-height:40px;width:30%}.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}"]
2875
+ 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",
2876
+ 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}"]
2928
2877
  },] }
2929
2878
  ];
2930
2879
  TableComponent.ctorParameters = function () { return [
@@ -5174,7 +5123,7 @@
5174
5123
  this.inp.table.displayLabel = false;
5175
5124
  this.inp.table.style = { padding: 0, boxShadow: 'unset' };
5176
5125
  this.inp.table.permissions = p;
5177
- this.inp.table.extraButtons = false;
5126
+ this.inp.table.showExtraButtons = false;
5178
5127
  this.inp.table.cols.forEach(function (x) { return x.sort = false; });
5179
5128
  if (this.inp.table.form) {
5180
5129
  this.inp.table.form.onTop = true;
@@ -7043,7 +6992,6 @@
7043
6992
  this.title = null;
7044
6993
  this.sortType = null;
7045
6994
  this.displayLabel = true;
7046
- this.isReport = false;
7047
6995
  this.sortable = false;
7048
6996
  this.optionType = exports.TableOptionType.Hidden;
7049
6997
  this.loading = true;
@@ -7051,7 +6999,8 @@
7051
6999
  this.hasChildren = false;
7052
7000
  this.childrenAutoLoad = false;
7053
7001
  this.withSelect = false;
7054
- this.extraButtons = true;
7002
+ this.showExtraButtons = true;
7003
+ this.extraButtons = [];
7055
7004
  this.form = null;
7056
7005
  this.searchForm = null;
7057
7006
  this.modal = null;
@@ -7110,9 +7059,8 @@
7110
7059
  }
7111
7060
  return this.searchForm ? this.searchForm.json(d) : d;
7112
7061
  };
7113
- TableClass.prototype.getUrl = function (isReport) {
7114
- if (isReport === void 0) { isReport = false; }
7115
- return this.url + (this.isReport || isReport ? 'Report?' : 'List');
7062
+ TableClass.prototype.getUrl = function () {
7063
+ return this.url + 'List';
7116
7064
  };
7117
7065
  TableClass.prototype.showInsertModal = function () {
7118
7066
  var insertAccess = this.permissions.getAccess('Insert');
@@ -7178,9 +7126,17 @@
7178
7126
  }
7179
7127
  var reportAccess = this.permissions.getAccess('Report');
7180
7128
  if (reportAccess != null) {
7181
- var report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, exports.InputType.Button, 'w-u blue h-30');
7182
- report.url = this.url + 'Report';
7183
- report.url.urlNewTab = true;
7129
+ var report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, exports.InputType.Button, 'm-h-5');
7130
+ var p = new PermissionClass();
7131
+ console.log(this.permissions);
7132
+ console.log(p.getUrl());
7133
+ p.RelatedId = 'Index';
7134
+ p.Area = this.permissions.Area;
7135
+ p.Controller = 'Print';
7136
+ p.Action = this.permissions.Action;
7137
+ report.url = '/Report' + p.getUrl();
7138
+ report.urlNewTab = true;
7139
+ this.extraButtons.push(report);
7184
7140
  }
7185
7141
  if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
7186
7142
  this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {