ps-toolkit-ui 0.0.154 → 0.0.158

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.
@@ -2653,7 +2653,7 @@
2653
2653
  opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
2654
2654
  }
2655
2655
  else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
2656
- opt.modal = this_1.table.modals.find(function (x) { return x.name === option.Action; });
2656
+ opt.modal = this_1.table.optionsActions.find(function (x) { return x.name === option.Action; });
2657
2657
  opt.onClick = function () {
2658
2658
  var e_2, _a;
2659
2659
  if (opt.modal.table) {
@@ -2713,7 +2713,7 @@
2713
2713
  p.RelatedId = 'Index';
2714
2714
  p.Area = this_1.table.permissions.Area;
2715
2715
  p.Controller = 'Print';
2716
- p.Action = option.Action;
2716
+ p.Action = option.Controller;
2717
2717
  opt.url = '/Report' + p.getUrl() + '/' + this_1.row.Data.Id;
2718
2718
  opt.urlNewTab = true;
2719
2719
  }
@@ -2886,6 +2886,60 @@
2886
2886
  childrenDiv: [{ type: core.ViewChild, args: ['childrenDiv',] }]
2887
2887
  };
2888
2888
 
2889
+ var ModalClass = /** @class */ (function () {
2890
+ function ModalClass(environment, l, name, cls) {
2891
+ if (cls === void 0) { cls = ''; }
2892
+ this.environment = null;
2893
+ this.form = null;
2894
+ this.firstForm = true;
2895
+ this.table = null;
2896
+ this.accordion = null;
2897
+ this.onShow = null;
2898
+ this.onHide = null;
2899
+ this.environment = environment;
2900
+ this.l = l;
2901
+ this.name = name;
2902
+ this.id = this.name;
2903
+ this.class = cls;
2904
+ }
2905
+ ModalClass.prototype.show = function () {
2906
+ var _this = this;
2907
+ if (this.onShow) {
2908
+ this.onShow();
2909
+ }
2910
+ $__namespace('body').addClass('open-modal');
2911
+ $__namespace('#' + this.id + 'Modal').fadeIn(300, function () {
2912
+ if (_this.form != null) {
2913
+ var i = _this.form.inputs.find(function (x) { return !x.disabled && x.type !== exports.InputType.Label && x.type !== exports.InputType.Hidden &&
2914
+ x.type !== exports.InputType.Constant && x.type !== exports.InputType.Submit && x.type !== exports.InputType.Button && x.type !== exports.InputType.Icon &&
2915
+ x.type !== exports.InputType.Check; });
2916
+ if (i) {
2917
+ i.focus();
2918
+ }
2919
+ }
2920
+ });
2921
+ };
2922
+ ModalClass.prototype.hide = function () {
2923
+ var _this = this;
2924
+ $__namespace('body').removeClass('open-modal');
2925
+ $__namespace('#' + this.id + 'Modal').fadeOut(300, function () {
2926
+ if (_this.form && _this.form.name !== 'Confirm' && _this.form.name !== 'Alert') {
2927
+ _this.form.clear();
2928
+ if (_this.form.onHideModal) {
2929
+ _this.form.onHideModal();
2930
+ }
2931
+ }
2932
+ if (_this.table && _this.table.form) {
2933
+ _this.table.form.clear();
2934
+ }
2935
+ if (_this.onHide) {
2936
+ _this.onHide();
2937
+ }
2938
+ });
2939
+ };
2940
+ return ModalClass;
2941
+ }());
2942
+
2889
2943
  var TableComponent = /** @class */ (function () {
2890
2944
  function TableComponent(router) {
2891
2945
  this.router = router;
@@ -3066,12 +3120,15 @@
3066
3120
  this.table.sort = s;
3067
3121
  this.table.load();
3068
3122
  };
3123
+ TableComponent.prototype.getModals = function () {
3124
+ return this.table.optionsActions.filter(function (x) { return x instanceof ModalClass; });
3125
+ };
3069
3126
  return TableComponent;
3070
3127
  }());
3071
3128
  TableComponent.decorators = [
3072
3129
  { type: core.Component, args: [{
3073
3130
  selector: 'lib-table',
3074
- 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",
3131
+ 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 getModals()\"></lib-modal>\r\n <lib-confirm #confirm [tableId]=\"table.name\"></lib-confirm>\r\n</div>\r\n",
3075
3132
  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}"]
3076
3133
  },] }
3077
3134
  ];
@@ -3450,14 +3507,21 @@
3450
3507
  };
3451
3508
  };
3452
3509
  FormDateComponent.prototype.setInpValue = function (v) {
3510
+ console.log(v, 'vv');
3511
+ console.log(typeof v, 'typeof vtypeof v');
3512
+ console.log(this.inp.default, 'this.inp.defaultthis.inp.default');
3513
+ console.log(typeof this.inp.default, 'typeof this.inp.default');
3453
3514
  if (v === null) {
3454
3515
  this.inp.clear();
3455
3516
  return;
3456
3517
  }
3457
- else if (typeof v === 'string') {
3518
+ else if (typeof v === 'string' && v.includes('Date')) {
3458
3519
  var d = parseInt(v.substring(6, v.length - 2), 10);
3459
3520
  this.active = moment__namespace(d);
3460
3521
  }
3522
+ else if (typeof v === 'string' && v.includes('/')) {
3523
+ this.active = moment__namespace(this.inp.value, 'jYYYY/jMM/jDD');
3524
+ }
3461
3525
  else if (typeof v === 'number') {
3462
3526
  this.active = moment__namespace(v);
3463
3527
  }
@@ -5940,60 +6004,6 @@
5940
6004
  inputBase: [{ type: core.ViewChild, args: ['inputBase',] }]
5941
6005
  };
5942
6006
 
5943
- var ModalClass = /** @class */ (function () {
5944
- function ModalClass(environment, l, name, cls) {
5945
- if (cls === void 0) { cls = ''; }
5946
- this.environment = null;
5947
- this.form = null;
5948
- this.firstForm = true;
5949
- this.table = null;
5950
- this.accordion = null;
5951
- this.onShow = null;
5952
- this.onHide = null;
5953
- this.environment = environment;
5954
- this.l = l;
5955
- this.name = name;
5956
- this.id = this.name;
5957
- this.class = cls;
5958
- }
5959
- ModalClass.prototype.show = function () {
5960
- var _this = this;
5961
- if (this.onShow) {
5962
- this.onShow();
5963
- }
5964
- $__namespace('body').addClass('open-modal');
5965
- $__namespace('#' + this.id + 'Modal').fadeIn(300, function () {
5966
- if (_this.form != null) {
5967
- var i = _this.form.inputs.find(function (x) { return !x.disabled && x.type !== exports.InputType.Label && x.type !== exports.InputType.Hidden &&
5968
- x.type !== exports.InputType.Constant && x.type !== exports.InputType.Submit && x.type !== exports.InputType.Button && x.type !== exports.InputType.Icon &&
5969
- x.type !== exports.InputType.Check; });
5970
- if (i) {
5971
- i.focus();
5972
- }
5973
- }
5974
- });
5975
- };
5976
- ModalClass.prototype.hide = function () {
5977
- var _this = this;
5978
- $__namespace('body').removeClass('open-modal');
5979
- $__namespace('#' + this.id + 'Modal').fadeOut(300, function () {
5980
- if (_this.form && _this.form.name !== 'Confirm' && _this.form.name !== 'Alert') {
5981
- _this.form.clear();
5982
- if (_this.form.onHideModal) {
5983
- _this.form.onHideModal();
5984
- }
5985
- }
5986
- if (_this.table && _this.table.form) {
5987
- _this.table.form.clear();
5988
- }
5989
- if (_this.onHide) {
5990
- _this.onHide();
5991
- }
5992
- });
5993
- };
5994
- return ModalClass;
5995
- }());
5996
-
5997
6007
  var AlertComponent = /** @class */ (function () {
5998
6008
  function AlertComponent(config) {
5999
6009
  this.config = config;
@@ -7130,7 +7140,7 @@
7130
7140
  this.perPage = 10;
7131
7141
  this.cols = [];
7132
7142
  this.buttons = [];
7133
- this.modals = [];
7143
+ this.optionsActions = [];
7134
7144
  this.rows = [];
7135
7145
  this.count = 0;
7136
7146
  this.page = 1;