@resolveio/client-lib-core 1.0.5 → 1.0.7

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.
@@ -2377,6 +2377,7 @@ class DialogSelectDateTimeContent {
2377
2377
  this._activeModal = _activeModal;
2378
2378
  this._fb = _fb;
2379
2379
  this.title = '';
2380
+ this.showTime = true;
2380
2381
  }
2381
2382
  ngOnInit() {
2382
2383
  if (!this.date) {
@@ -2387,12 +2388,45 @@ class DialogSelectDateTimeContent {
2387
2388
  date: [{ year: this.date.getFullYear(), month: this.date.getMonth() + 1, day: this.date.getDate() }, [Validators.required]]
2388
2389
  });
2389
2390
  }
2391
+ ngAfterViewInit() {
2392
+ setTimeout(() => {
2393
+ let foundElement = this.recursiveFindFirstElement(this.allElements.nativeElement);
2394
+ if (foundElement) {
2395
+ foundElement.focus();
2396
+ }
2397
+ else {
2398
+ this.close.nativeElement.focus();
2399
+ this.close.nativeElement.blur();
2400
+ }
2401
+ }, 100);
2402
+ }
2403
+ recursiveFindFirstElement(element) {
2404
+ let foundElement = null;
2405
+ let htmlCol = element.children;
2406
+ for (let i = 0; i < Object.keys(htmlCol).length; i++) {
2407
+ let key = Object.keys(htmlCol)[i];
2408
+ let htmlElem = htmlCol[key];
2409
+ if (htmlElem.children && htmlElem.children.length) {
2410
+ foundElement = this.recursiveFindFirstElement(htmlElem);
2411
+ }
2412
+ else if (htmlElem.tagName === 'BUTTON' && htmlElem.classList.contains('close')) {
2413
+ return null;
2414
+ }
2415
+ else if ((htmlElem.tagName === 'BUTTON' || htmlElem.tagName === 'INPUT' || htmlElem.tagName === 'SELECT' || htmlElem.tagName === 'TEXTAREA') && !htmlElem.hidden && !htmlElem.disabled) {
2416
+ return htmlElem;
2417
+ }
2418
+ if (foundElement) {
2419
+ break;
2420
+ }
2421
+ }
2422
+ return foundElement;
2423
+ }
2390
2424
  submitForm() {
2391
2425
  this._activeModal.close(new Date(this.form.value.date.year, parseInt(this.form.value.date.month) - 1, this.form.value.date.day, this.form.value.time.hour, this.form.value.time.minute, this.form.value.time.second, 0));
2392
2426
  }
2393
2427
  }
2394
2428
  DialogSelectDateTimeContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: DialogSelectDateTimeContent, deps: [{ token: i1$4.NgbActiveModal }, { token: i2.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
2395
- DialogSelectDateTimeContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: DialogSelectDateTimeContent, selector: "ng-component", inputs: { title: "title", date: "date" }, ngImport: i0, template: `
2429
+ DialogSelectDateTimeContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: DialogSelectDateTimeContent, selector: "ng-component", inputs: { title: "title", date: "date", showTime: "showTime" }, viewQueries: [{ propertyName: "close", first: true, predicate: ["close"], descendants: true }, { propertyName: "allElements", first: true, predicate: ["allElements"], descendants: true }], ngImport: i0, template: `
2396
2430
  <style>
2397
2431
  table {
2398
2432
  width: 100%;
@@ -2408,41 +2442,42 @@ DialogSelectDateTimeContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.
2408
2442
  text-align: center;
2409
2443
  }
2410
2444
  </style>
2411
- <form [formGroup]="form" novalidate (ngSubmit)="submitForm()">
2412
- <div class="modal-header">
2413
- <h4 class="modal-title"><i class="fa fa-question-circle" style="color: blue; font-size: 0.85em" aria-hidden="true"></i> {{ title }}</h4>
2414
- <button type="button" class="close" aria-label="Close" (click)="_activeModal.dismiss()">
2415
- <span aria-hidden="true">&times;</span>
2416
- </button>
2417
- </div>
2418
- <div class="modal-body">
2419
-
2420
- <table>
2421
- <tr>
2422
- <td>
2423
- <div class="input-group">
2424
- <input class="form-control" placeholder="yyyy-mm-dd" name="dp" formControlName="date" ngbDatepicker #d="ngbDatepicker">
2425
- <div class="input-group-append" (click)="d.toggle()">
2426
- <div class="input-group-text">
2427
- <i class="fa fa-calendar" aria-hidden="true"></i>
2445
+ <div #allElements>
2446
+ <form [formGroup]="form" novalidate (ngSubmit)="submitForm()">
2447
+ <div class="modal-header">
2448
+ <h4 class="modal-title"><i class="fa fa-question-circle" style="color: blue; font-size: 0.85em" aria-hidden="true"></i> {{ title }}</h4>
2449
+ <button type="button" class="close" aria-label="Close" (click)="_activeModal.dismiss()" #close>
2450
+ <span aria-hidden="true">&times;</span>
2451
+ </button>
2452
+ </div>
2453
+ <div class="modal-body">
2454
+ <table>
2455
+ <tr>
2456
+ <td style="border: none;">
2457
+ <div class="input-group">
2458
+ <input class="form-control" placeholder="yyyy-mm-dd" name="dp" formControlName="date" ngbDatepicker [firstDayOfWeek]="7" #d="ngbDatepicker">
2459
+ <div class="input-group-append" (click)="d.toggle()">
2460
+ <div class="input-group-text">
2461
+ <i class="fa fa-calendar" aria-hidden="true"></i>
2462
+ </div>
2428
2463
  </div>
2429
2464
  </div>
2430
- </div>
2431
- </td>
2432
- <td>
2433
- <div class="offset-3">
2434
- <ngb-timepicker formControlName="time" meridian="ON"></ngb-timepicker>
2435
- </div>
2436
- </td>
2437
- </tr>
2438
- </table>
2439
- </div>
2440
- <div class="modal-footer">
2441
- <form-button [form]="form"></form-button>
2442
- <button type="button" class="btn btn-secondary" (click)="_activeModal.dismiss()">Cancel</button>
2443
- </div>
2444
- </form>
2445
- `, isInline: true, styles: ["\n\t\t \ttable {\n\t\t\t\twidth: 100%;\n\t\t\t\ttable-layout: fixed;\n\t\t\t}\n\n\t\t\ttr {\n\t\t\t\twidth: 100%;\n\t\t\t}\n\n\t\t\ttd {\n\t\t\t\twidth: 100%;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t"], components: [{ type: i1$4.NgbTimepicker, selector: "ngb-timepicker", inputs: ["meridian", "spinners", "seconds", "hourStep", "minuteStep", "secondStep", "readonlyInputs", "size"] }, { type: FormButtonComponent, selector: "form-button", inputs: ["form", "disabled"] }], directives: [{ type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$4.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
2465
+ </td>
2466
+ <td *ngIf="showTime" style="border: none;">
2467
+ <div class="offset-3">
2468
+ <ngb-timepicker formControlName="time" meridian="ON"></ngb-timepicker>
2469
+ </div>
2470
+ </td>
2471
+ </tr>
2472
+ </table>
2473
+ </div>
2474
+ <div class="modal-footer">
2475
+ <form-button [form]="form"></form-button>
2476
+ <button type="button" class="btn btn-secondary" (click)="_activeModal.dismiss()">Cancel</button>
2477
+ </div>
2478
+ </form>
2479
+ </div>
2480
+ `, isInline: true, styles: ["\n\t\t \ttable {\n\t\t\t\twidth: 100%;\n\t\t\t\ttable-layout: fixed;\n\t\t\t}\n\n\t\t\ttr {\n\t\t\t\twidth: 100%;\n\t\t\t}\n\n\t\t\ttd {\n\t\t\t\twidth: 100%;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t"], components: [{ type: i1$4.NgbTimepicker, selector: "ngb-timepicker", inputs: ["meridian", "spinners", "seconds", "hourStep", "minuteStep", "secondStep", "readonlyInputs", "size"] }, { type: FormButtonComponent, selector: "form-button", inputs: ["form", "disabled"] }], directives: [{ type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$4.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2446
2481
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: DialogSelectDateTimeContent, decorators: [{
2447
2482
  type: Component,
2448
2483
  args: [{
@@ -2462,46 +2497,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
2462
2497
  text-align: center;
2463
2498
  }
2464
2499
  </style>
2465
- <form [formGroup]="form" novalidate (ngSubmit)="submitForm()">
2466
- <div class="modal-header">
2467
- <h4 class="modal-title"><i class="fa fa-question-circle" style="color: blue; font-size: 0.85em" aria-hidden="true"></i> {{ title }}</h4>
2468
- <button type="button" class="close" aria-label="Close" (click)="_activeModal.dismiss()">
2469
- <span aria-hidden="true">&times;</span>
2470
- </button>
2471
- </div>
2472
- <div class="modal-body">
2473
-
2474
- <table>
2475
- <tr>
2476
- <td>
2477
- <div class="input-group">
2478
- <input class="form-control" placeholder="yyyy-mm-dd" name="dp" formControlName="date" ngbDatepicker #d="ngbDatepicker">
2479
- <div class="input-group-append" (click)="d.toggle()">
2480
- <div class="input-group-text">
2481
- <i class="fa fa-calendar" aria-hidden="true"></i>
2500
+ <div #allElements>
2501
+ <form [formGroup]="form" novalidate (ngSubmit)="submitForm()">
2502
+ <div class="modal-header">
2503
+ <h4 class="modal-title"><i class="fa fa-question-circle" style="color: blue; font-size: 0.85em" aria-hidden="true"></i> {{ title }}</h4>
2504
+ <button type="button" class="close" aria-label="Close" (click)="_activeModal.dismiss()" #close>
2505
+ <span aria-hidden="true">&times;</span>
2506
+ </button>
2507
+ </div>
2508
+ <div class="modal-body">
2509
+ <table>
2510
+ <tr>
2511
+ <td style="border: none;">
2512
+ <div class="input-group">
2513
+ <input class="form-control" placeholder="yyyy-mm-dd" name="dp" formControlName="date" ngbDatepicker [firstDayOfWeek]="7" #d="ngbDatepicker">
2514
+ <div class="input-group-append" (click)="d.toggle()">
2515
+ <div class="input-group-text">
2516
+ <i class="fa fa-calendar" aria-hidden="true"></i>
2517
+ </div>
2482
2518
  </div>
2483
2519
  </div>
2484
- </div>
2485
- </td>
2486
- <td>
2487
- <div class="offset-3">
2488
- <ngb-timepicker formControlName="time" meridian="ON"></ngb-timepicker>
2489
- </div>
2490
- </td>
2491
- </tr>
2492
- </table>
2493
- </div>
2494
- <div class="modal-footer">
2495
- <form-button [form]="form"></form-button>
2496
- <button type="button" class="btn btn-secondary" (click)="_activeModal.dismiss()">Cancel</button>
2497
- </div>
2498
- </form>
2520
+ </td>
2521
+ <td *ngIf="showTime" style="border: none;">
2522
+ <div class="offset-3">
2523
+ <ngb-timepicker formControlName="time" meridian="ON"></ngb-timepicker>
2524
+ </div>
2525
+ </td>
2526
+ </tr>
2527
+ </table>
2528
+ </div>
2529
+ <div class="modal-footer">
2530
+ <form-button [form]="form"></form-button>
2531
+ <button type="button" class="btn btn-secondary" (click)="_activeModal.dismiss()">Cancel</button>
2532
+ </div>
2533
+ </form>
2534
+ </div>
2499
2535
  `
2500
2536
  }]
2501
2537
  }], ctorParameters: function () { return [{ type: i1$4.NgbActiveModal }, { type: i2.FormBuilder }]; }, propDecorators: { title: [{
2502
2538
  type: Input
2503
2539
  }], date: [{
2504
2540
  type: Input
2541
+ }], showTime: [{
2542
+ type: Input
2543
+ }], close: [{
2544
+ type: ViewChild,
2545
+ args: ['close', { static: false }]
2546
+ }], allElements: [{
2547
+ type: ViewChild,
2548
+ args: ['allElements', { static: false }]
2505
2549
  }] } });
2506
2550
 
2507
2551
  // tslint:disable-next-line:component-class-suffix
@@ -4126,10 +4170,11 @@ class DialogService {
4126
4170
  modalRef.componentInstance.html = html;
4127
4171
  return modalRef.result;
4128
4172
  }
4129
- selectDateTime(date) {
4173
+ selectDateTime(date, showTime = true) {
4130
4174
  const modalRef = this.openDialog(DialogSelectDateTimeContent);
4131
- modalRef.componentInstance.title = 'Select Date and Time';
4175
+ modalRef.componentInstance.title = 'Select Date' + (showTime ? ' and Time' : '');
4132
4176
  modalRef.componentInstance.date = date;
4177
+ modalRef.componentInstance.showTime = showTime;
4133
4178
  return modalRef.result;
4134
4179
  }
4135
4180
  selectDataLabel(data, showArraySubData = true) {