@adins/ucsearch 2.11.26 → 2.11.28

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.
@@ -1,3 +1,4 @@
1
+ import { __awaiter, __generator } from 'tslib';
1
2
  import { HttpClient } from '@angular/common/http';
2
3
  import { DOCUMENT } from '@angular/platform-browser';
3
4
  import { saveAs } from 'file-saver';
@@ -12,7 +13,7 @@ import { CurrencyMaskInputMode, NgxCurrencyModule } from 'ngx-currency';
12
13
  import { TranslateModule } from '@ngx-translate/core';
13
14
  import { UcShowErrorsModule } from '@adins/uc-show-errors';
14
15
  import { UcDirectiveUpperCaseModule } from '@adins/uc-directive-upper-case';
15
- import { Injectable, Pipe, NgModule, Component, Input, ViewChild, ElementRef, Inject, Renderer2, EventEmitter, Output, defineInjectable } from '@angular/core';
16
+ import { Injectable, Pipe, NgModule, defineInjectable, EventEmitter, Component, Renderer2, Inject, ElementRef, ViewChild, Input, Output } from '@angular/core';
16
17
 
17
18
  /**
18
19
  * @fileoverview added by tsickle
@@ -356,18 +357,27 @@ var UCSearchComponent = /** @class */ (function () {
356
357
  * @return {?}
357
358
  */
358
359
  function () {
359
- console.log("ucsearch");
360
- this.apiUrl = this.searchInput.enviromentUrl + this.searchInput.apiQryPaging;
361
- this.arrCrit = this.searchInput.arrCritObj;
362
- /** @type {?} */
363
- var js = this._renderer2.createElement('script');
364
- js.text = "\n $(document).ready(function(){\n $(\"#flip\").click(function(){\n $(\"#panel\").slideToggle(\"slow\");\n });\n });\n ";
365
- this._renderer2.appendChild(this._document.body, js);
366
- /** @type {?} */
367
- var value = this.cookieService.get('BusinessDateRaw');
368
- this.BisDt = this.DecryptString(value, "AdInsFOU12345678");
369
- this.BusinessDt = new Date(this.BisDt);
370
- this.initiateForm();
360
+ return __awaiter(this, void 0, void 0, function () {
361
+ var js, value;
362
+ return __generator(this, function (_a) {
363
+ switch (_a.label) {
364
+ case 0:
365
+ console.log("ucsearch");
366
+ this.apiUrl = this.searchInput.enviromentUrl + this.searchInput.apiQryPaging;
367
+ this.arrCrit = this.searchInput.arrCritObj;
368
+ js = this._renderer2.createElement('script');
369
+ js.text = "\n $(document).ready(function(){\n $(\"#flip\").click(function(){\n $(\"#panel\").slideToggle(\"slow\");\n });\n });\n ";
370
+ this._renderer2.appendChild(this._document.body, js);
371
+ value = this.cookieService.get('BusinessDateRaw');
372
+ this.BisDt = this.DecryptString(value, "AdInsFOU12345678");
373
+ this.BusinessDt = new Date(this.BisDt);
374
+ return [4 /*yield*/, this.initiateForm()];
375
+ case 1:
376
+ _a.sent();
377
+ return [2 /*return*/];
378
+ }
379
+ });
380
+ });
371
381
  };
372
382
  /**
373
383
  * @return {?}
@@ -376,164 +386,173 @@ var UCSearchComponent = /** @class */ (function () {
376
386
  * @return {?}
377
387
  */
378
388
  function () {
379
- var _this = this;
380
- this.getJSON(this.searchInput._url).subscribe((/**
381
- * @param {?} data
382
- * @return {?}
383
- */
384
- function (data) {
385
- _this.configuration = data;
386
- _this.exportData = data.exportExcel;
387
- if (data.exportTypeList != undefined && data.exportTypeList.length != 0) {
388
- _this.ExportTypeList = data.exportTypeList;
389
- _this.ExportType = _this.ExportTypeList[0].key;
390
- }
391
- _this.countForm = data.component.length;
392
- _this.isDataLoaded = true;
393
- if (_this.searchInput.title != undefined && _this.searchInput.title != "") {
394
- _this.configuration.title = _this.searchInput.title;
395
- }
396
- for (var i = 0; i < _this.countForm; i++) {
397
- //ini kalau datanya di load dari URL
398
- if (data.component[i].isFromURL == true) {
399
- /** @type {?} */
400
- var request = new RequestCriteriaObj();
401
- /** @type {?} */
402
- var arrayCrit = new Array();
403
- /** @type {?} */
404
- var criteriaObject = new CriteriaObj();
405
- criteriaObject.DataType = "text";
406
- criteriaObject.propName = data.component[i].criteriaPropName;
407
- criteriaObject.value = data.component[i].criteriaPropValue;
408
- criteriaObject.restriction = "eq";
409
- arrayCrit.push(criteriaObject);
410
- request.criteria = arrayCrit;
411
- request[data.component[i].criteriaPropName] = data.component[i].criteriaPropValue;
412
- // Pengecekan penggunaan url atau path
413
- if (data.component[i].path != undefined && data.component[i].path != "") {
414
- if (_this.searchInput.listEnvironments != undefined && _this.searchInput.listEnvironments.length != 0) {
415
- for (var y = 0; y < _this.searchInput.listEnvironments.length; y++) {
416
- if (data.component[i].environment == _this.searchInput.listEnvironments[y].environment) {
417
- data.component[i].fullpath = _this.searchInput.listEnvironments[y].url + data.component[i].path;
418
- break;
419
- }
420
- }
421
- }
422
- else {
423
- data.component[i].fullpath = data.component[i].url;
424
- }
425
- }
426
- else {
427
- data.component[i].fullpath = data.component[i].url;
428
- }
429
- //lempar objectnya sekalian sama urlnya, nnti di bind di dalem karena masalah di asyncnya
430
- //biar tiap function ada state2nya sendiri
431
- _this.resolveObject(data.component[i], data.component[i].fullpath, request);
432
- }
433
- if (data.component[i].type == "numeric") {
434
- data.component[i].value = parseFloat(data.component[i].value).toLocaleString('en');
435
- }
436
- //pengecekan ddl
437
- if (data.component[i].type == "dropdown") {
438
- if (data.component[i].dtmType != undefined) {
439
- if (data.component[i].dtmType.includes("month")) {
440
- if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
441
- data.component[i].value = _this.setDefaultValueMonth(data.component[i].value);
389
+ return __awaiter(this, void 0, void 0, function () {
390
+ var _this = this;
391
+ return __generator(this, function (_a) {
392
+ switch (_a.label) {
393
+ case 0: return [4 /*yield*/, this.getJSON(this.searchInput._url).subscribe((/**
394
+ * @param {?} data
395
+ * @return {?}
396
+ */
397
+ function (data) {
398
+ _this.configuration = data;
399
+ _this.exportData = data.exportExcel;
400
+ if (data.exportTypeList != undefined && data.exportTypeList.length != 0) {
401
+ _this.ExportTypeList = data.exportTypeList;
402
+ _this.ExportType = _this.ExportTypeList[0].key;
442
403
  }
443
- data.component[i].items = _this.setMonthDDL(data.component[i].dtmType);
444
- }
445
- if (data.component[i].dtmType.includes("year")) {
446
- if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
447
- data.component[i].value = _this.setDefaultValueYear(data.component[i].value);
404
+ _this.countForm = data.component.length;
405
+ _this.isDataLoaded = true;
406
+ if (_this.searchInput.title != undefined && _this.searchInput.title != "") {
407
+ _this.configuration.title = _this.searchInput.title;
448
408
  }
449
- data.component[i].items = _this.setYearDDL(data.component[i].dtmType);
450
- }
451
- }
452
- }
453
- // if (data.component[i].type == "dropdownSearch" && !data.component[i].isFromURL && data.component[i].items?.length != 1) {
454
- // if (data.component[i].ddsType == undefined || data.component[i].ddsType == "all") {
455
- // data.component[i].value = "all";
456
- // data.component[i].descr = "All";
457
- // } else if (data.component[i].ddsType == "one") {
458
- // data.component[i].value = "one";
459
- // data.component[i].descr = "Select One";
460
- // }
461
- // }
462
- if (data.component[i].type == "dropdownSearch" && !data.component[i].isFromURL && data.component[i].items.length == 1) {
463
- data.component[i].value = data.component[i].items[0].Key;
464
- data.component[i].descr = data.component[i].items[0].Value;
465
- }
466
- if (data.component[i].type != "dropdownSearch" && !data.component[i].value) {
467
- data.component[i].value = "";
468
- if (data.component[i].ddlType == 'all')
469
- data.component[i].value = "all";
470
- if (data.component[i].ddlType == 'one')
471
- data.component[i].value = "one";
472
- }
473
- //pengecekan tanggal
474
- if (data.component[i].type == "datepicker") {
475
- _this.readonly = data.component[i].readonly;
476
- if (data.component[i].value.includes("BD")) {
477
- /** @type {?} */
478
- var businessDate = new Date();
479
- if (_this.BisDt != null) {
480
- businessDate = new Date(_this.BisDt);
481
- }
482
- /** @type {?} */
483
- var operator = data.component[i].value.charAt(2);
484
- /** @type {?} */
485
- var dateShow = new Date();
486
- if (operator == "-") {
487
- /** @type {?} */
488
- var tempMinus = data.component[i].value.split("-", 2);
489
- /** @type {?} */
490
- var numDay = parseInt(tempMinus[1]);
491
- businessDate.setDate(businessDate.getDate() - numDay);
492
- }
493
- else if (operator == "+") {
494
- /** @type {?} */
495
- var tempMinus = data.component[i].value.split("+", 2);
496
- /** @type {?} */
497
- var numDay = parseInt(tempMinus[1]);
498
- businessDate.setDate(businessDate.getDate() + numDay);
499
- }
500
- dateShow = businessDate;
501
- /** @type {?} */
502
- var dateText = formatDate(dateShow, 'yyyy-MM-dd', 'en-US');
503
- data.component[i].value = dateText;
504
- }
505
- if (_this.readonly = false) {
506
- if (data.component[i].restriction != undefined && data.component[i].restriction != "") {
507
- if (data.component[i].restriction.toUpperCase() == "GT") {
508
- /** @type {?} */
509
- var minDate = new Date(_this.datePipe.transform(data.component[i].minDate, 'yyyy-MM-dd'));
510
- minDate.setDate(minDate.getDate() + 1);
511
- data.component[i].minDate = minDate;
512
- }
513
- else if (data.component[i].restriction.toUpperCase() == "LT") {
514
- /** @type {?} */
515
- var maxDate = new Date(_this.datePipe.transform(data.component[i].maxDate, 'yyyy-MM-dd'));
516
- maxDate.setDate(maxDate.getDate() - 1);
517
- data.component[i].maxDate = maxDate;
409
+ for (var i = 0; i < _this.countForm; i++) {
410
+ //ini kalau datanya di load dari URL
411
+ if (data.component[i].isFromURL == true) {
412
+ /** @type {?} */
413
+ var request = new RequestCriteriaObj();
414
+ /** @type {?} */
415
+ var arrayCrit = new Array();
416
+ /** @type {?} */
417
+ var criteriaObject = new CriteriaObj();
418
+ criteriaObject.DataType = "text";
419
+ criteriaObject.propName = data.component[i].criteriaPropName;
420
+ criteriaObject.value = data.component[i].criteriaPropValue;
421
+ criteriaObject.restriction = "eq";
422
+ arrayCrit.push(criteriaObject);
423
+ request.criteria = arrayCrit;
424
+ request[data.component[i].criteriaPropName] = data.component[i].criteriaPropValue;
425
+ // Pengecekan penggunaan url atau path
426
+ if (data.component[i].path != undefined && data.component[i].path != "") {
427
+ if (_this.searchInput.listEnvironments != undefined && _this.searchInput.listEnvironments.length != 0) {
428
+ for (var y = 0; y < _this.searchInput.listEnvironments.length; y++) {
429
+ if (data.component[i].environment == _this.searchInput.listEnvironments[y].environment) {
430
+ data.component[i].fullpath = _this.searchInput.listEnvironments[y].url + data.component[i].path;
431
+ break;
432
+ }
433
+ }
434
+ }
435
+ else {
436
+ data.component[i].fullpath = data.component[i].url;
437
+ }
438
+ }
439
+ else {
440
+ data.component[i].fullpath = data.component[i].url;
441
+ }
442
+ //lempar objectnya sekalian sama urlnya, nnti di bind di dalem karena masalah di asyncnya
443
+ //biar tiap function ada state2nya sendiri
444
+ _this.resolveObject(data.component[i], data.component[i].fullpath, request);
445
+ }
446
+ if (data.component[i].type == "numeric") {
447
+ data.component[i].value = parseFloat(data.component[i].value).toLocaleString('en');
448
+ }
449
+ //pengecekan ddl
450
+ if (data.component[i].type == "dropdown") {
451
+ if (data.component[i].dtmType != undefined) {
452
+ if (data.component[i].dtmType.includes("month")) {
453
+ if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
454
+ data.component[i].value = _this.setDefaultValueMonth(data.component[i].value);
455
+ }
456
+ data.component[i].items = _this.setMonthDDL(data.component[i].dtmType);
457
+ }
458
+ if (data.component[i].dtmType.includes("year")) {
459
+ if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
460
+ data.component[i].value = _this.setDefaultValueYear(data.component[i].value);
461
+ }
462
+ data.component[i].items = _this.setYearDDL(data.component[i].dtmType);
463
+ }
464
+ }
465
+ }
466
+ // if (data.component[i].type == "dropdownSearch" && !data.component[i].isFromURL && data.component[i].items?.length != 1) {
467
+ // if (data.component[i].ddsType == undefined || data.component[i].ddsType == "all") {
468
+ // data.component[i].value = "all";
469
+ // data.component[i].descr = "All";
470
+ // } else if (data.component[i].ddsType == "one") {
471
+ // data.component[i].value = "one";
472
+ // data.component[i].descr = "Select One";
473
+ // }
474
+ // }
475
+ if (data.component[i].type == "dropdownSearch" && !data.component[i].isFromURL && data.component[i].items.length == 1) {
476
+ data.component[i].value = data.component[i].items[0].Key;
477
+ data.component[i].descr = data.component[i].items[0].Value;
478
+ }
479
+ if (data.component[i].type != "dropdownSearch" && !data.component[i].value) {
480
+ data.component[i].value = "";
481
+ if (data.component[i].ddlType == 'all')
482
+ data.component[i].value = "all";
483
+ if (data.component[i].ddlType == 'one')
484
+ data.component[i].value = "one";
485
+ }
486
+ //pengecekan tanggal
487
+ if (data.component[i].type == "datepicker") {
488
+ _this.readonly = data.component[i].readonly;
489
+ if (data.component[i].value.includes("BD")) {
490
+ /** @type {?} */
491
+ var businessDate = new Date();
492
+ if (_this.BisDt != null) {
493
+ businessDate = new Date(_this.BisDt);
494
+ }
495
+ /** @type {?} */
496
+ var operator = data.component[i].value.charAt(2);
497
+ /** @type {?} */
498
+ var dateShow = new Date();
499
+ if (operator == "-") {
500
+ /** @type {?} */
501
+ var tempMinus = data.component[i].value.split("-", 2);
502
+ /** @type {?} */
503
+ var numDay = parseInt(tempMinus[1]);
504
+ businessDate.setDate(businessDate.getDate() - numDay);
505
+ }
506
+ else if (operator == "+") {
507
+ /** @type {?} */
508
+ var tempMinus = data.component[i].value.split("+", 2);
509
+ /** @type {?} */
510
+ var numDay = parseInt(tempMinus[1]);
511
+ businessDate.setDate(businessDate.getDate() + numDay);
512
+ }
513
+ dateShow = businessDate;
514
+ /** @type {?} */
515
+ var dateText = formatDate(dateShow, 'yyyy-MM-dd', 'en-US');
516
+ data.component[i].value = dateText;
517
+ }
518
+ if (_this.readonly = false) {
519
+ if (data.component[i].restriction != undefined && data.component[i].restriction != "") {
520
+ if (data.component[i].restriction.toUpperCase() == "GT") {
521
+ /** @type {?} */
522
+ var minDate = new Date(_this.datePipe.transform(data.component[i].minDate, 'yyyy-MM-dd'));
523
+ minDate.setDate(minDate.getDate() + 1);
524
+ data.component[i].minDate = minDate;
525
+ }
526
+ else if (data.component[i].restriction.toUpperCase() == "LT") {
527
+ /** @type {?} */
528
+ var maxDate = new Date(_this.datePipe.transform(data.component[i].maxDate, 'yyyy-MM-dd'));
529
+ maxDate.setDate(maxDate.getDate() - 1);
530
+ data.component[i].maxDate = maxDate;
531
+ }
532
+ }
533
+ }
534
+ }
518
535
  }
519
- }
520
- }
521
- }
522
- }
523
- setTimeout((/**
524
- * @return {?}
525
- */
526
- function () {
527
- for (var j = 0; j < _this.countForm; j++) {
528
- if (data.component[j].isEvent == true && _this.configuration.component[j].itemsUrl.length == 1) {
529
- _this.onChangeEvent(data.component[j].itemsUrl[0].Key, data.component[j]);
530
- }
531
- if (data.component[j].type == "officeRoleCodes" && _this.configuration.component[j].itemsUrl.length > 0) {
532
- _this.SetRoleOfficeCodes(j);
533
- }
536
+ setTimeout((/**
537
+ * @return {?}
538
+ */
539
+ function () {
540
+ for (var j = 0; j < _this.countForm; j++) {
541
+ if (data.component[j].isEvent == true && _this.configuration.component[j].itemsUrl.length == 1) {
542
+ _this.onChangeEvent(data.component[j].itemsUrl[0].Key, data.component[j]);
543
+ }
544
+ if (data.component[j].type == "officeRoleCodes" && _this.configuration.component[j].itemsUrl.length > 0) {
545
+ _this.SetRoleOfficeCodes(j);
546
+ }
547
+ }
548
+ }), 1000);
549
+ }))];
550
+ case 1:
551
+ _a.sent();
552
+ return [2 /*return*/];
534
553
  }
535
- }), 1000);
536
- }));
554
+ });
555
+ });
537
556
  };
538
557
  /**
539
558
  * @param {?} i
@@ -789,10 +808,20 @@ var UCSearchComponent = /** @class */ (function () {
789
808
  * @return {?}
790
809
  */
791
810
  function () {
792
- this.searchForm.resetForm({
793
- ExportType: this.ExportTypeList[0].key
811
+ return __awaiter(this, void 0, void 0, function () {
812
+ return __generator(this, function (_a) {
813
+ switch (_a.label) {
814
+ case 0:
815
+ this.searchForm.resetForm({
816
+ ExportType: this.ExportTypeList[0].key
817
+ });
818
+ return [4 /*yield*/, this.initiateForm()];
819
+ case 1:
820
+ _a.sent();
821
+ return [2 /*return*/];
822
+ }
823
+ });
794
824
  });
795
- this.initiateForm();
796
825
  };
797
826
  /**
798
827
  * @param {?} apiUrl