@adins/ucsearch 2.11.25 → 2.11.27

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.
package/README.md CHANGED
@@ -3,7 +3,10 @@
3
3
  This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0.
4
4
 
5
5
  ## Version
6
- Version 2.11.17
6
+ Version 2.11.27
7
+ 1. async ngOnInit, initiateForm, reset
8
+
9
+ Version 2.11.26
7
10
  1. type dropdownsearch
8
11
  1.
9
12
  1.
@@ -22,6 +22,109 @@
22
22
  return UCSearchService;
23
23
  }());
24
24
 
25
+ /*! *****************************************************************************
26
+ Copyright (c) Microsoft Corporation.
27
+
28
+ Permission to use, copy, modify, and/or distribute this software for any
29
+ purpose with or without fee is hereby granted.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
32
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
33
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
34
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
35
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
36
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
37
+ PERFORMANCE OF THIS SOFTWARE.
38
+ ***************************************************************************** */
39
+ function __awaiter(thisArg, _arguments, P, generator) {
40
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
+ return new (P || (P = Promise))(function (resolve, reject) {
42
+ function fulfilled(value) { try {
43
+ step(generator.next(value));
44
+ }
45
+ catch (e) {
46
+ reject(e);
47
+ } }
48
+ function rejected(value) { try {
49
+ step(generator["throw"](value));
50
+ }
51
+ catch (e) {
52
+ reject(e);
53
+ } }
54
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
55
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
56
+ });
57
+ }
58
+ function __generator(thisArg, body) {
59
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
60
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
61
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
62
+ function verb(n) { return function (v) { return step([n, v]); }; }
63
+ function step(op) {
64
+ if (f)
65
+ throw new TypeError("Generator is already executing.");
66
+ while (_)
67
+ try {
68
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
69
+ return t;
70
+ if (y = 0, t)
71
+ op = [op[0] & 2, t.value];
72
+ switch (op[0]) {
73
+ case 0:
74
+ case 1:
75
+ t = op;
76
+ break;
77
+ case 4:
78
+ _.label++;
79
+ return { value: op[1], done: false };
80
+ case 5:
81
+ _.label++;
82
+ y = op[1];
83
+ op = [0];
84
+ continue;
85
+ case 7:
86
+ op = _.ops.pop();
87
+ _.trys.pop();
88
+ continue;
89
+ default:
90
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
91
+ _ = 0;
92
+ continue;
93
+ }
94
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
95
+ _.label = op[1];
96
+ break;
97
+ }
98
+ if (op[0] === 6 && _.label < t[1]) {
99
+ _.label = t[1];
100
+ t = op;
101
+ break;
102
+ }
103
+ if (t && _.label < t[2]) {
104
+ _.label = t[2];
105
+ _.ops.push(op);
106
+ break;
107
+ }
108
+ if (t[2])
109
+ _.ops.pop();
110
+ _.trys.pop();
111
+ continue;
112
+ }
113
+ op = body.call(thisArg, _);
114
+ }
115
+ catch (e) {
116
+ op = [6, e];
117
+ y = 0;
118
+ }
119
+ finally {
120
+ f = t = 0;
121
+ }
122
+ if (op[0] & 5)
123
+ throw op[1];
124
+ return { value: op[0] ? op[1] : void 0, done: true };
125
+ }
126
+ }
127
+
25
128
  /**
26
129
  * @fileoverview added by tsickle
27
130
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -346,18 +449,27 @@
346
449
  * @return {?}
347
450
  */
348
451
  function () {
349
- console.log("ucsearch");
350
- this.apiUrl = this.searchInput.enviromentUrl + this.searchInput.apiQryPaging;
351
- this.arrCrit = this.searchInput.arrCritObj;
352
- /** @type {?} */
353
- var js = this._renderer2.createElement('script');
354
- js.text = "\n $(document).ready(function(){\n $(\"#flip\").click(function(){\n $(\"#panel\").slideToggle(\"slow\");\n });\n });\n ";
355
- this._renderer2.appendChild(this._document.body, js);
356
- /** @type {?} */
357
- var value = this.cookieService.get('BusinessDateRaw');
358
- this.BisDt = this.DecryptString(value, "AdInsFOU12345678");
359
- this.BusinessDt = new Date(this.BisDt);
360
- this.initiateForm();
452
+ return __awaiter(this, void 0, void 0, function () {
453
+ var js, value;
454
+ return __generator(this, function (_a) {
455
+ switch (_a.label) {
456
+ case 0:
457
+ console.log("ucsearch");
458
+ this.apiUrl = this.searchInput.enviromentUrl + this.searchInput.apiQryPaging;
459
+ this.arrCrit = this.searchInput.arrCritObj;
460
+ js = this._renderer2.createElement('script');
461
+ js.text = "\n $(document).ready(function(){\n $(\"#flip\").click(function(){\n $(\"#panel\").slideToggle(\"slow\");\n });\n });\n ";
462
+ this._renderer2.appendChild(this._document.body, js);
463
+ value = this.cookieService.get('BusinessDateRaw');
464
+ this.BisDt = this.DecryptString(value, "AdInsFOU12345678");
465
+ this.BusinessDt = new Date(this.BisDt);
466
+ return [4 /*yield*/, this.initiateForm()];
467
+ case 1:
468
+ _a.sent();
469
+ return [2 /*return*/];
470
+ }
471
+ });
472
+ });
361
473
  };
362
474
  /**
363
475
  * @return {?}
@@ -366,162 +478,171 @@
366
478
  * @return {?}
367
479
  */
368
480
  function () {
369
- var _this = this;
370
- this.getJSON(this.searchInput._url).subscribe(( /**
371
- * @param {?} data
372
- * @return {?}
373
- */function (data) {
374
- _this.configuration = data;
375
- _this.exportData = data.exportExcel;
376
- if (data.exportTypeList != undefined && data.exportTypeList.length != 0) {
377
- _this.ExportTypeList = data.exportTypeList;
378
- _this.ExportType = _this.ExportTypeList[0].key;
379
- }
380
- _this.countForm = data.component.length;
381
- _this.isDataLoaded = true;
382
- if (_this.searchInput.title != undefined && _this.searchInput.title != "") {
383
- _this.configuration.title = _this.searchInput.title;
384
- }
385
- for (var i = 0; i < _this.countForm; i++) {
386
- //ini kalau datanya di load dari URL
387
- if (data.component[i].isFromURL == true) {
388
- /** @type {?} */
389
- var request = new RequestCriteriaObj();
390
- /** @type {?} */
391
- var arrayCrit = new Array();
392
- /** @type {?} */
393
- var criteriaObject = new CriteriaObj();
394
- criteriaObject.DataType = "text";
395
- criteriaObject.propName = data.component[i].criteriaPropName;
396
- criteriaObject.value = data.component[i].criteriaPropValue;
397
- criteriaObject.restriction = "eq";
398
- arrayCrit.push(criteriaObject);
399
- request.criteria = arrayCrit;
400
- request[data.component[i].criteriaPropName] = data.component[i].criteriaPropValue;
401
- // Pengecekan penggunaan url atau path
402
- if (data.component[i].path != undefined && data.component[i].path != "") {
403
- if (_this.searchInput.listEnvironments != undefined && _this.searchInput.listEnvironments.length != 0) {
404
- for (var y = 0; y < _this.searchInput.listEnvironments.length; y++) {
405
- if (data.component[i].environment == _this.searchInput.listEnvironments[y].environment) {
406
- data.component[i].fullpath = _this.searchInput.listEnvironments[y].url + data.component[i].path;
407
- break;
408
- }
409
- }
410
- }
411
- else {
412
- data.component[i].fullpath = data.component[i].url;
413
- }
414
- }
415
- else {
416
- data.component[i].fullpath = data.component[i].url;
417
- }
418
- //lempar objectnya sekalian sama urlnya, nnti di bind di dalem karena masalah di asyncnya
419
- //biar tiap function ada state2nya sendiri
420
- _this.resolveObject(data.component[i], data.component[i].fullpath, request);
421
- }
422
- if (data.component[i].type == "numeric") {
423
- data.component[i].value = parseFloat(data.component[i].value).toLocaleString('en');
424
- }
425
- //pengecekan ddl
426
- if (data.component[i].type == "dropdown") {
427
- if (data.component[i].dtmType != undefined) {
428
- if (data.component[i].dtmType.includes("month")) {
429
- if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
430
- data.component[i].value = _this.setDefaultValueMonth(data.component[i].value);
481
+ return __awaiter(this, void 0, void 0, function () {
482
+ var _this = this;
483
+ return __generator(this, function (_a) {
484
+ switch (_a.label) {
485
+ case 0: return [4 /*yield*/, this.getJSON(this.searchInput._url).subscribe(( /**
486
+ * @param {?} data
487
+ * @return {?}
488
+ */function (data) {
489
+ _this.configuration = data;
490
+ _this.exportData = data.exportExcel;
491
+ if (data.exportTypeList != undefined && data.exportTypeList.length != 0) {
492
+ _this.ExportTypeList = data.exportTypeList;
493
+ _this.ExportType = _this.ExportTypeList[0].key;
431
494
  }
432
- data.component[i].items = _this.setMonthDDL(data.component[i].dtmType);
433
- }
434
- if (data.component[i].dtmType.includes("year")) {
435
- if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
436
- data.component[i].value = _this.setDefaultValueYear(data.component[i].value);
437
- }
438
- data.component[i].items = _this.setYearDDL(data.component[i].dtmType);
439
- }
440
- }
441
- }
442
- // if (data.component[i].type == "dropdownSearch" && !data.component[i].isFromURL && data.component[i].items?.length != 1) {
443
- // if (data.component[i].ddsType == undefined || data.component[i].ddsType == "all") {
444
- // data.component[i].value = "all";
445
- // data.component[i].descr = "All";
446
- // } else if (data.component[i].ddsType == "one") {
447
- // data.component[i].value = "one";
448
- // data.component[i].descr = "Select One";
449
- // }
450
- // }
451
- if (!data.component[i].isFromURL && data.component[i].items.length == 1) {
452
- data.component[i].value = data.component[i].items[0].Key;
453
- data.component[i].descr = data.component[i].items[0].Value;
454
- }
455
- if (data.component[i].type != "dropdownSearch" && !data.component[i].value) {
456
- data.component[i].value = "";
457
- if (data.component[i].ddlType == 'all')
458
- data.component[i].value = "all";
459
- if (data.component[i].ddlType == 'one')
460
- data.component[i].value = "one";
461
- }
462
- //pengecekan tanggal
463
- if (data.component[i].type == "datepicker") {
464
- _this.readonly = data.component[i].readonly;
465
- if (data.component[i].value.includes("BD")) {
466
- /** @type {?} */
467
- var businessDate = new Date();
468
- if (_this.BisDt != null) {
469
- businessDate = new Date(_this.BisDt);
470
- }
471
- /** @type {?} */
472
- var operator = data.component[i].value.charAt(2);
473
- /** @type {?} */
474
- var dateShow = new Date();
475
- if (operator == "-") {
476
- /** @type {?} */
477
- var tempMinus = data.component[i].value.split("-", 2);
478
- /** @type {?} */
479
- var numDay = parseInt(tempMinus[1]);
480
- businessDate.setDate(businessDate.getDate() - numDay);
481
- }
482
- else if (operator == "+") {
483
- /** @type {?} */
484
- var tempMinus = data.component[i].value.split("+", 2);
485
- /** @type {?} */
486
- var numDay = parseInt(tempMinus[1]);
487
- businessDate.setDate(businessDate.getDate() + numDay);
488
- }
489
- dateShow = businessDate;
490
- /** @type {?} */
491
- var dateText = common.formatDate(dateShow, 'yyyy-MM-dd', 'en-US');
492
- data.component[i].value = dateText;
493
- }
494
- if (_this.readonly = false) {
495
- if (data.component[i].restriction != undefined && data.component[i].restriction != "") {
496
- if (data.component[i].restriction.toUpperCase() == "GT") {
497
- /** @type {?} */
498
- var minDate = new Date(_this.datePipe.transform(data.component[i].minDate, 'yyyy-MM-dd'));
499
- minDate.setDate(minDate.getDate() + 1);
500
- data.component[i].minDate = minDate;
495
+ _this.countForm = data.component.length;
496
+ _this.isDataLoaded = true;
497
+ if (_this.searchInput.title != undefined && _this.searchInput.title != "") {
498
+ _this.configuration.title = _this.searchInput.title;
501
499
  }
502
- else if (data.component[i].restriction.toUpperCase() == "LT") {
503
- /** @type {?} */
504
- var maxDate = new Date(_this.datePipe.transform(data.component[i].maxDate, 'yyyy-MM-dd'));
505
- maxDate.setDate(maxDate.getDate() - 1);
506
- data.component[i].maxDate = maxDate;
500
+ for (var i = 0; i < _this.countForm; i++) {
501
+ //ini kalau datanya di load dari URL
502
+ if (data.component[i].isFromURL == true) {
503
+ /** @type {?} */
504
+ var request = new RequestCriteriaObj();
505
+ /** @type {?} */
506
+ var arrayCrit = new Array();
507
+ /** @type {?} */
508
+ var criteriaObject = new CriteriaObj();
509
+ criteriaObject.DataType = "text";
510
+ criteriaObject.propName = data.component[i].criteriaPropName;
511
+ criteriaObject.value = data.component[i].criteriaPropValue;
512
+ criteriaObject.restriction = "eq";
513
+ arrayCrit.push(criteriaObject);
514
+ request.criteria = arrayCrit;
515
+ request[data.component[i].criteriaPropName] = data.component[i].criteriaPropValue;
516
+ // Pengecekan penggunaan url atau path
517
+ if (data.component[i].path != undefined && data.component[i].path != "") {
518
+ if (_this.searchInput.listEnvironments != undefined && _this.searchInput.listEnvironments.length != 0) {
519
+ for (var y = 0; y < _this.searchInput.listEnvironments.length; y++) {
520
+ if (data.component[i].environment == _this.searchInput.listEnvironments[y].environment) {
521
+ data.component[i].fullpath = _this.searchInput.listEnvironments[y].url + data.component[i].path;
522
+ break;
523
+ }
524
+ }
525
+ }
526
+ else {
527
+ data.component[i].fullpath = data.component[i].url;
528
+ }
529
+ }
530
+ else {
531
+ data.component[i].fullpath = data.component[i].url;
532
+ }
533
+ //lempar objectnya sekalian sama urlnya, nnti di bind di dalem karena masalah di asyncnya
534
+ //biar tiap function ada state2nya sendiri
535
+ _this.resolveObject(data.component[i], data.component[i].fullpath, request);
536
+ }
537
+ if (data.component[i].type == "numeric") {
538
+ data.component[i].value = parseFloat(data.component[i].value).toLocaleString('en');
539
+ }
540
+ //pengecekan ddl
541
+ if (data.component[i].type == "dropdown") {
542
+ if (data.component[i].dtmType != undefined) {
543
+ if (data.component[i].dtmType.includes("month")) {
544
+ if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
545
+ data.component[i].value = _this.setDefaultValueMonth(data.component[i].value);
546
+ }
547
+ data.component[i].items = _this.setMonthDDL(data.component[i].dtmType);
548
+ }
549
+ if (data.component[i].dtmType.includes("year")) {
550
+ if (data.component[i].value != undefined && data.component[i].value.includes("BD")) {
551
+ data.component[i].value = _this.setDefaultValueYear(data.component[i].value);
552
+ }
553
+ data.component[i].items = _this.setYearDDL(data.component[i].dtmType);
554
+ }
555
+ }
556
+ }
557
+ // if (data.component[i].type == "dropdownSearch" && !data.component[i].isFromURL && data.component[i].items?.length != 1) {
558
+ // if (data.component[i].ddsType == undefined || data.component[i].ddsType == "all") {
559
+ // data.component[i].value = "all";
560
+ // data.component[i].descr = "All";
561
+ // } else if (data.component[i].ddsType == "one") {
562
+ // data.component[i].value = "one";
563
+ // data.component[i].descr = "Select One";
564
+ // }
565
+ // }
566
+ if (data.component[i].type == "dropdownSearch" && !data.component[i].isFromURL && data.component[i].items.length == 1) {
567
+ data.component[i].value = data.component[i].items[0].Key;
568
+ data.component[i].descr = data.component[i].items[0].Value;
569
+ }
570
+ if (data.component[i].type != "dropdownSearch" && !data.component[i].value) {
571
+ data.component[i].value = "";
572
+ if (data.component[i].ddlType == 'all')
573
+ data.component[i].value = "all";
574
+ if (data.component[i].ddlType == 'one')
575
+ data.component[i].value = "one";
576
+ }
577
+ //pengecekan tanggal
578
+ if (data.component[i].type == "datepicker") {
579
+ _this.readonly = data.component[i].readonly;
580
+ if (data.component[i].value.includes("BD")) {
581
+ /** @type {?} */
582
+ var businessDate = new Date();
583
+ if (_this.BisDt != null) {
584
+ businessDate = new Date(_this.BisDt);
585
+ }
586
+ /** @type {?} */
587
+ var operator = data.component[i].value.charAt(2);
588
+ /** @type {?} */
589
+ var dateShow = new Date();
590
+ if (operator == "-") {
591
+ /** @type {?} */
592
+ var tempMinus = data.component[i].value.split("-", 2);
593
+ /** @type {?} */
594
+ var numDay = parseInt(tempMinus[1]);
595
+ businessDate.setDate(businessDate.getDate() - numDay);
596
+ }
597
+ else if (operator == "+") {
598
+ /** @type {?} */
599
+ var tempMinus = data.component[i].value.split("+", 2);
600
+ /** @type {?} */
601
+ var numDay = parseInt(tempMinus[1]);
602
+ businessDate.setDate(businessDate.getDate() + numDay);
603
+ }
604
+ dateShow = businessDate;
605
+ /** @type {?} */
606
+ var dateText = common.formatDate(dateShow, 'yyyy-MM-dd', 'en-US');
607
+ data.component[i].value = dateText;
608
+ }
609
+ if (_this.readonly = false) {
610
+ if (data.component[i].restriction != undefined && data.component[i].restriction != "") {
611
+ if (data.component[i].restriction.toUpperCase() == "GT") {
612
+ /** @type {?} */
613
+ var minDate = new Date(_this.datePipe.transform(data.component[i].minDate, 'yyyy-MM-dd'));
614
+ minDate.setDate(minDate.getDate() + 1);
615
+ data.component[i].minDate = minDate;
616
+ }
617
+ else if (data.component[i].restriction.toUpperCase() == "LT") {
618
+ /** @type {?} */
619
+ var maxDate = new Date(_this.datePipe.transform(data.component[i].maxDate, 'yyyy-MM-dd'));
620
+ maxDate.setDate(maxDate.getDate() - 1);
621
+ data.component[i].maxDate = maxDate;
622
+ }
623
+ }
624
+ }
625
+ }
507
626
  }
508
- }
509
- }
510
- }
511
- }
512
- setTimeout(( /**
513
- * @return {?}
514
- */function () {
515
- for (var j = 0; j < _this.countForm; j++) {
516
- if (data.component[j].isEvent == true && _this.configuration.component[j].itemsUrl.length == 1) {
517
- _this.onChangeEvent(data.component[j].itemsUrl[0].Key, data.component[j]);
518
- }
519
- if (data.component[j].type == "officeRoleCodes" && _this.configuration.component[j].itemsUrl.length > 0) {
520
- _this.SetRoleOfficeCodes(j);
521
- }
627
+ setTimeout(( /**
628
+ * @return {?}
629
+ */function () {
630
+ for (var j = 0; j < _this.countForm; j++) {
631
+ if (data.component[j].isEvent == true && _this.configuration.component[j].itemsUrl.length == 1) {
632
+ _this.onChangeEvent(data.component[j].itemsUrl[0].Key, data.component[j]);
633
+ }
634
+ if (data.component[j].type == "officeRoleCodes" && _this.configuration.component[j].itemsUrl.length > 0) {
635
+ _this.SetRoleOfficeCodes(j);
636
+ }
637
+ }
638
+ }), 1000);
639
+ }))];
640
+ case 1:
641
+ _a.sent();
642
+ return [2 /*return*/];
522
643
  }
523
- }), 1000);
524
- }));
644
+ });
645
+ });
525
646
  };
526
647
  /**
527
648
  * @param {?} i
@@ -777,10 +898,20 @@
777
898
  * @return {?}
778
899
  */
779
900
  function () {
780
- this.searchForm.resetForm({
781
- ExportType: this.ExportTypeList[0].key
901
+ return __awaiter(this, void 0, void 0, function () {
902
+ return __generator(this, function (_a) {
903
+ switch (_a.label) {
904
+ case 0:
905
+ this.searchForm.resetForm({
906
+ ExportType: this.ExportTypeList[0].key
907
+ });
908
+ return [4 /*yield*/, this.initiateForm()];
909
+ case 1:
910
+ _a.sent();
911
+ return [2 /*return*/];
912
+ }
913
+ });
782
914
  });
783
- this.initiateForm();
784
915
  };
785
916
  /**
786
917
  * @param {?} apiUrl