@adins/ucsearch 2.11.28 → 2.13.2

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.
@@ -768,28 +768,35 @@ var UCSearchComponent = /** @class */ (function () {
768
768
  return this.http.post(url, criteria);
769
769
  };
770
770
  /**
771
+ * @param {?=} IsExportExcel
771
772
  * @return {?}
772
773
  */
773
774
  UCSearchComponent.prototype.searchClick = /**
775
+ * @param {?=} IsExportExcel
774
776
  * @return {?}
775
777
  */
776
- function () {
777
- // for(let i=0;i<this.countForm;i++){
778
- // if(this.configuration.component[i].type == "datepicker"){
779
- // if ((i != (this.countForm-1)) && (this.configuration.component[i].name != this.configuration.component[i+1].name)){
780
- // this.checkInputDate(this.configuration.component[i]);
781
- // }
782
- // }
783
- // }
784
- // if(this.dateWrong) return;
785
- // for(let i=0;i<this.countForm;i++){
786
- // if(this.configuration.component[i].type == "datepicker"){
787
- // if ((i != (this.countForm-1)) && (this.configuration.component[i].name != this.configuration.component[i+1].name)){
788
- // this.checkInputDate(this.configuration.component[i]);
789
- // }
790
- // }
791
- // }
792
- // if(this.dateWrong) return;
778
+ function (IsExportExcel) {
779
+ if (IsExportExcel === void 0) { IsExportExcel = false; }
780
+ /** @type {?} */
781
+ var filtered = this.configuration.component.filter((/**
782
+ * @param {?} item
783
+ * @param {?} i
784
+ * @param {?} arr
785
+ * @return {?}
786
+ */
787
+ function (item, i, arr) {
788
+ return arr.findIndex((/**
789
+ * @param {?} x
790
+ * @return {?}
791
+ */
792
+ function (x) { return (x.name === item.name); })) === i;
793
+ }));
794
+ for (var i = 0; i < filtered.length; i++) {
795
+ if (filtered[i].type == "numeric") {
796
+ if (!this.checkValueGteLte(filtered[i]))
797
+ return;
798
+ }
799
+ }
793
800
  /** @type {?} */
794
801
  var order = null;
795
802
  if (this.configuration.orderby != null) {
@@ -799,7 +806,11 @@ var UCSearchComponent = /** @class */ (function () {
799
806
  };
800
807
  }
801
808
  this.pageNow = 1;
802
- this.search(this.apiUrl, this.pageNow, this.pageSize, order, this.arrCrit);
809
+ /** @type {?} */
810
+ var rowPerPage = this.pageSize;
811
+ if (IsExportExcel)
812
+ rowPerPage = 9999;
813
+ this.search(this.apiUrl, this.pageNow, rowPerPage, order, this.arrCrit, IsExportExcel);
803
814
  };
804
815
  /**
805
816
  * @return {?}
@@ -829,6 +840,7 @@ var UCSearchComponent = /** @class */ (function () {
829
840
  * @param {?} rowPerPage
830
841
  * @param {?} orderBy
831
842
  * @param {?=} addCrit
843
+ * @param {?=} IsExportExcel
832
844
  * @return {?}
833
845
  */
834
846
  UCSearchComponent.prototype.search = /**
@@ -837,11 +849,13 @@ var UCSearchComponent = /** @class */ (function () {
837
849
  * @param {?} rowPerPage
838
850
  * @param {?} orderBy
839
851
  * @param {?=} addCrit
852
+ * @param {?=} IsExportExcel
840
853
  * @return {?}
841
854
  */
842
- function (apiUrl, pageNo, rowPerPage, orderBy, addCrit) {
855
+ function (apiUrl, pageNo, rowPerPage, orderBy, addCrit, IsExportExcel) {
843
856
  var _this = this;
844
857
  if (addCrit === void 0) { addCrit = new Array(); }
858
+ if (IsExportExcel === void 0) { IsExportExcel = false; }
845
859
  /** @type {?} */
846
860
  var request = new RequestCriteriaObj();
847
861
  /** @type {?} */
@@ -1012,10 +1026,8 @@ var UCSearchComponent = /** @class */ (function () {
1012
1026
  }
1013
1027
  }
1014
1028
  request.criteria = arrCrit;
1015
- if (!this.searchInput.isJoinExAPI) {
1016
- request.integrationObj = null;
1017
- }
1018
- else {
1029
+ request.integrationObj = null;
1030
+ if (this.searchInput.isJoinExAPI) {
1019
1031
  request.integrationObj = this.searchInput.integrationObj;
1020
1032
  }
1021
1033
  this.http.post(apiUrl, request).subscribe((/**
@@ -1023,6 +1035,11 @@ var UCSearchComponent = /** @class */ (function () {
1023
1035
  * @return {?}
1024
1036
  */
1025
1037
  function (response) {
1038
+ if (IsExportExcel) {
1039
+ _this.ExcelData = response["Data"];
1040
+ _this.excelService.exportAsExcelFile(_this.ExcelData, 'sample');
1041
+ return;
1042
+ }
1026
1043
  /** @type {?} */
1027
1044
  var qryPaging = {
1028
1045
  response: response,
@@ -1097,6 +1114,50 @@ var UCSearchComponent = /** @class */ (function () {
1097
1114
  }
1098
1115
  }));
1099
1116
  };
1117
+ /**
1118
+ * @param {?} component
1119
+ * @return {?}
1120
+ */
1121
+ UCSearchComponent.prototype.checkValueGteLte = /**
1122
+ * @param {?} component
1123
+ * @return {?}
1124
+ */
1125
+ function (component) {
1126
+ //cek yg pakai restriction gte/lte/gt/lt
1127
+ /** @type {?} */
1128
+ var MinComponent = this.configuration.component.find((/**
1129
+ * @param {?} x
1130
+ * @return {?}
1131
+ */
1132
+ function (x) { return x.name == component.name && (x.restriction.toUpperCase() == "GTE"); })) == undefined ? this.configuration.component.find((/**
1133
+ * @param {?} x
1134
+ * @return {?}
1135
+ */
1136
+ function (x) { return x.name == component.name && (x.restriction.toUpperCase() == "GT"); })) : this.configuration.component.find((/**
1137
+ * @param {?} x
1138
+ * @return {?}
1139
+ */
1140
+ function (x) { return x.name == component.name && (x.restriction.toUpperCase() == "GTE"); }));
1141
+ /** @type {?} */
1142
+ var MaxComponent = this.configuration.component.find((/**
1143
+ * @param {?} x
1144
+ * @return {?}
1145
+ */
1146
+ function (x) { return x.name == component.name && (x.restriction.toUpperCase() == "LTE"); })) == undefined ? this.configuration.component.find((/**
1147
+ * @param {?} x
1148
+ * @return {?}
1149
+ */
1150
+ function (x) { return x.name == component.name && (x.restriction.toUpperCase() == "LT"); })) : this.configuration.component.find((/**
1151
+ * @param {?} x
1152
+ * @return {?}
1153
+ */
1154
+ function (x) { return x.name == component.name && (x.restriction.toUpperCase() == "LTE"); }));
1155
+ if (this.myForm.nativeElement[MinComponent.id].value > this.myForm.nativeElement[MaxComponent.id].value) {
1156
+ this.toastr.warning(MinComponent.label + " must be less than " + MaxComponent.label);
1157
+ return false;
1158
+ }
1159
+ return true;
1160
+ };
1100
1161
  /**
1101
1162
  * @param {?} element
1102
1163
  * @return {?}
@@ -1128,34 +1189,26 @@ var UCSearchComponent = /** @class */ (function () {
1128
1189
  * @return {?}
1129
1190
  */
1130
1191
  function () {
1131
- var _this = this;
1132
- /** @type {?} */
1133
- var request = new RequestCriteriaObj();
1134
- request.pageNo = 1;
1135
- request.rowPerPage = 9999;
1136
- request.orderBy = null;
1137
- request.criteria = [];
1138
- request.queryString = this.configuration.querystring;
1139
- if (!this.searchInput.isJoinExAPI) {
1140
- request.integrationObj = null;
1141
- }
1142
- else {
1143
- request.integrationObj = this.searchInput.integrationObj;
1144
- }
1145
- this.http.post(this.apiUrl, request).subscribe((/**
1146
- * @param {?} response
1147
- * @return {?}
1148
- */
1149
- function (response) {
1150
- _this.ExcelData = response["Data"];
1151
- _this.excelService.exportAsExcelFile(_this.ExcelData, 'sample');
1152
- }), (/**
1153
- * @param {?} error
1154
- * @return {?}
1155
- */
1156
- function (error) {
1157
- console.log(error);
1158
- }));
1192
+ this.searchClick(true);
1193
+ // let request = new RequestCriteriaObj();
1194
+ // request.pageNo = 1;
1195
+ // request.rowPerPage = 9999;
1196
+ // request.orderBy = null;
1197
+ // request.criteria = [];
1198
+ // request.queryString = this.configuration.querystring;
1199
+ // if (!this.searchInput.isJoinExAPI) {
1200
+ // request.integrationObj = null;
1201
+ // } else {
1202
+ // request.integrationObj = this.searchInput.integrationObj;
1203
+ // }
1204
+ // this.http.post(this.apiUrl, request).subscribe(
1205
+ // response => {
1206
+ // this.ExcelData = response["Data"];
1207
+ // this.excelService.exportAsExcelFile(this.ExcelData, 'sample');
1208
+ // },
1209
+ // (error) => {
1210
+ // console.log(error);
1211
+ // });
1159
1212
  };
1160
1213
  /**
1161
1214
  * @param {?} optValue
@@ -1232,8 +1285,12 @@ var UCSearchComponent = /** @class */ (function () {
1232
1285
  var ddl = component.options;
1233
1286
  /** @type {?} */
1234
1287
  var text = ddl[ddl.selectedIndex].value.trim();
1235
- if (text) {
1236
- this.searchInput.integrationObj.requestObj[wfKeyFilter] = text;
1288
+ /** @type {?} */
1289
+ var listValue = text.split(';');
1290
+ /** @type {?} */
1291
+ var listWfKey = wfKeyFilter.split(';');
1292
+ for (var i = 0; i < listValue.length; i++) {
1293
+ this.searchInput.integrationObj.requestObj[listWfKey[i]] = listValue[i];
1237
1294
  }
1238
1295
  };
1239
1296
  /**