ps-toolkit-ui 1.20.48 → 1.20.50

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.
@@ -1021,6 +1021,11 @@
1021
1021
  TableCollType[TableCollType["Month"] = 18] = "Month";
1022
1022
  TableCollType[TableCollType["Year"] = 19] = "Year";
1023
1023
  })(exports.TableCollType || (exports.TableCollType = {}));
1024
+ (function (TableExportType) {
1025
+ TableExportType[TableExportType["Print"] = 0] = "Print";
1026
+ TableExportType[TableExportType["Excel"] = 1] = "Excel";
1027
+ TableExportType[TableExportType["Pdf"] = 2] = "Pdf";
1028
+ })(exports.TableExportType || (exports.TableExportType = {}));
1024
1029
  (function (UserType) {
1025
1030
  UserType[UserType["All"] = 0] = "All";
1026
1031
  UserType[UserType["Admin"] = 1] = "Admin";
@@ -3949,49 +3954,15 @@
3949
3954
  this.export.onClick = function () {
3950
3955
  $__namespace(_this.exportDropDown.nativeElement).slideToggle();
3951
3956
  };
3957
+ this.pdf.onClick = function () {
3958
+ _this.exportTable(exports.TableExportType.Pdf);
3959
+ };
3952
3960
  this.excel.onClick = function () {
3953
- _this.table.excel();
3961
+ _this.exportTable(exports.TableExportType.Excel);
3954
3962
  };
3955
3963
  this.print.onClick = function () {
3956
- var getWidthValue = function (str) {
3957
- var matches = __spread(str.matchAll(/w-(\d+)(?:-(\d+))?/g));
3958
- if (!matches.length) {
3959
- return null;
3960
- }
3961
- var max = matches.reduce(function (best, m) {
3962
- var first = +m[1];
3963
- var second = +m[2] || null;
3964
- if (!best || first > best.first) {
3965
- return { first: first, second: second };
3966
- }
3967
- return best;
3968
- }, null);
3969
- var s = (max.second || max.first);
3970
- return s == null ? 100 : s;
3971
- };
3972
- var url = _this.table.permissions.getAccess(exports.PermissionAccessTypeEnum.List).Url.replace('/list', '/report').replace('-list', '-report');
3973
- var data = _this.table.searchData();
3974
- data.Page = 1;
3975
- data.PerPage = -1;
3976
- data.Cols = _this.table.cols.map(function (x) {
3977
- return {
3978
- Name: x.name,
3979
- TrnName: _this.table.l(x.name),
3980
- Width: getWidthValue(x.class),
3981
- Type: x.type,
3982
- };
3983
- });
3984
- new RequestClass(_this.table.environment, _this.table.l).send(url, exports.Method.Post, data, _this.print, function (result) {
3985
- window.open(_this.table.environment.url + '/report' + url + '?reportId=' + result, '_blank');
3986
- }, function () { });
3964
+ _this.exportTable(exports.TableExportType.Print);
3987
3965
  };
3988
- $__namespace(document).mouseup(function (e) {
3989
- var container = $__namespace(_this.exportDropDown.nativeElement);
3990
- // @ts-ignore
3991
- if (!container.is(e.target) && container.has(e.target).length === 0) {
3992
- container.slideUp(100);
3993
- }
3994
- });
3995
3966
  this.maximum.onClick = function () {
3996
3967
  $__namespace(_this.tableDiv.nativeElement).toggleClass('maximum');
3997
3968
  _this.maximum.icon = _this.maximum.name === 'Minimum' ? 'fad fa-arrows-maximize' : 'fad fa-arrows-minimize';
@@ -4004,6 +3975,41 @@
4004
3975
  _this.confirm.show(l, url, data, accept);
4005
3976
  };
4006
3977
  };
3978
+ TableComponent.prototype.exportTable = function (type) {
3979
+ var _this = this;
3980
+ var getWidthValue = function (str) {
3981
+ var matches = __spread(str.matchAll(/w-(\d+)(?:-(\d+))?/g));
3982
+ if (!matches.length) {
3983
+ return null;
3984
+ }
3985
+ var max = matches.reduce(function (best, m) {
3986
+ var first = +m[1];
3987
+ var second = +m[2] || null;
3988
+ if (!best || first > best.first) {
3989
+ return { first: first, second: second };
3990
+ }
3991
+ return best;
3992
+ }, null);
3993
+ var s = (max.second || max.first);
3994
+ return s == null ? 100 : s;
3995
+ };
3996
+ var url = this.table.permissions.getAccess(exports.PermissionAccessTypeEnum.List).Url.replace('/list', '/export').replace('-list', '-export');
3997
+ var data = this.table.searchData();
3998
+ data.Page = 1;
3999
+ data.PerPage = -1;
4000
+ data.Type = type;
4001
+ data.Cols = this.table.cols.map(function (x) {
4002
+ return {
4003
+ Name: x.name,
4004
+ TrnName: _this.table.l(x.name),
4005
+ Width: getWidthValue(x.class),
4006
+ Type: x.type,
4007
+ };
4008
+ });
4009
+ new RequestClass(this.table.environment, this.table.l).send(url, exports.Method.Post, data, this.print, function (result) {
4010
+ window.open(_this.table.environment.url + '/report' + url + '?reportId=' + result, '_blank');
4011
+ }, function () { });
4012
+ };
4007
4013
  TableComponent.prototype.allChecked = function () {
4008
4014
  return this.table.rows.filter(function (x) { return !x.checked; }).length === 0;
4009
4015
  };