@gloww/gloww 20.0.0-beta.27 → 20.0.0-beta.29

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.
@@ -21,14 +21,15 @@ import { MatColumnDef, MatTableDataSource, MatTable, MatHeaderCellDef, MatHeader
21
21
  import { MatProgressSpinner, MatProgressSpinnerModule } from '@angular/material/progress-spinner';
22
22
  import { MatCard, MatCardContent, MatCardActions, MatCardHeader, MatCardTitle, MatCardModule } from '@angular/material/card';
23
23
  import { MatIcon, MatIconModule } from '@angular/material/icon';
24
- import { MatError, MatFormField, MatInput, MatLabel, MatInputModule } from '@angular/material/input';
24
+ import { MatError, MatFormField, MatInput, MatLabel, MatInputModule, MatSuffix } from '@angular/material/input';
25
25
  import * as i4 from '@ctrl/ngx-codemirror';
26
26
  import { CodemirrorModule, CodemirrorComponent } from '@ctrl/ngx-codemirror';
27
27
  import * as i1$3 from '@angular/forms';
28
- import { NG_VALUE_ACCESSOR, FormsModule, UntypedFormControl, ReactiveFormsModule, Validators } from '@angular/forms';
28
+ import { NG_VALUE_ACCESSOR, FormsModule, UntypedFormControl, ReactiveFormsModule, Validators, FormControl } from '@angular/forms';
29
29
  import { MatProgressBar, MatProgressBarModule } from '@angular/material/progress-bar';
30
- import { MatDatepickerModule } from '@angular/material/datepicker';
30
+ import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker, MatDatepickerModule } from '@angular/material/datepicker';
31
31
  import { NgxMatDatetimePickerModule, NgxMatTimepickerComponent, NgxMatNativeDateModule } from 'ngx-mat-datetime-picker-v2';
32
+ import moment from 'moment';
32
33
  import * as i1$4 from '@ngx-translate/core';
33
34
  import { TranslateDefaultParser } from '@ngx-translate/core';
34
35
  import { MatSelect, MatOption, MatSelectModule } from '@angular/material/select';
@@ -45,7 +46,6 @@ import { CdkDrag, CdkDragHandle, DragDropModule } from '@angular/cdk/drag-drop';
45
46
  import FileSaver from 'file-saver';
46
47
  import JSZip from 'jszip';
47
48
  import { MatAutocompleteTrigger, MatAutocomplete, MatAutocompleteModule } from '@angular/material/autocomplete';
48
- import moment from 'moment';
49
49
  import { MAT_DATE_LOCALE } from '@angular/material/core';
50
50
  import { AngularResizeEventModule } from 'angular-resize-event';
51
51
 
@@ -1290,8 +1290,7 @@ class DisplayObjectsComponent {
1290
1290
  const searchData = this.parent.form.value.searchData;
1291
1291
  if (searchData) {
1292
1292
  Object.keys(searchData).forEach(name => {
1293
- const val = searchData[name];
1294
- this.queryParams[name] = val;
1293
+ this.queryParams[name] = this.serializeQueryParamValue(searchData[name]);
1295
1294
  });
1296
1295
  }
1297
1296
  if (this.form2.value._MaxRow_) {
@@ -1303,6 +1302,18 @@ class DisplayObjectsComponent {
1303
1302
  this.location.replaceState(this.router.url, params.toString());
1304
1303
  this.Search();
1305
1304
  }
1305
+ serializeQueryParamValue(value) {
1306
+ if (value === undefined || value === null || value === '') {
1307
+ return value;
1308
+ }
1309
+ if (value instanceof Date) {
1310
+ return Number.isNaN(value.getTime()) ? null : moment(value).format('YYYY-MM-DDTHH:mm:ss');
1311
+ }
1312
+ if (moment.isMoment(value)) {
1313
+ return value.isValid() ? value.format('YYYY-MM-DDTHH:mm:ss') : null;
1314
+ }
1315
+ return value;
1316
+ }
1306
1317
  onFilter() {
1307
1318
  }
1308
1319
  UpdateDataSource(r) {
@@ -3619,28 +3630,32 @@ class DatetimeComponent {
3619
3630
  this.placeHolder = null;
3620
3631
  this.mode = 'date';
3621
3632
  this.showSeconds = false;
3622
- this.inputValue = '';
3633
+ this.dateControl = new FormControl(null);
3634
+ this.hourControl = new FormControl('00', { nonNullable: true });
3635
+ this.minuteControl = new FormControl('00', { nonNullable: true });
3636
+ this.secondControl = new FormControl('00', { nonNullable: true });
3623
3637
  this.isDisabled = false;
3638
+ this.hours = Array.from({ length: 24 }, (_, value) => value.toString().padStart(2, '0'));
3639
+ this.minutes = Array.from({ length: 60 }, (_, value) => value.toString().padStart(2, '0'));
3640
+ this.seconds = Array.from({ length: 60 }, (_, value) => value.toString().padStart(2, '0'));
3624
3641
  this.onChange = () => { };
3625
3642
  this.onTouched = () => { };
3643
+ this.dateControl.valueChanges.subscribe(() => this.emitCurrentValue());
3644
+ this.hourControl.valueChanges.subscribe(() => this.emitCurrentValue());
3645
+ this.minuteControl.valueChanges.subscribe(() => this.emitCurrentValue());
3646
+ this.secondControl.valueChanges.subscribe(() => this.emitCurrentValue());
3626
3647
  }
3627
- get inputType() {
3628
- return this.mode === 'datetime' ? 'datetime-local' : 'date';
3629
- }
3630
- get inputStep() {
3631
- if (this.mode !== 'datetime') {
3632
- return null;
3633
- }
3634
- return this.showSeconds ? '1' : '60';
3648
+ get isDateTime() {
3649
+ return this.mode === 'datetime';
3635
3650
  }
3636
3651
  get value() {
3637
3652
  return this._value;
3638
3653
  }
3639
3654
  set value(val) {
3640
- this.updateValue(val, true);
3655
+ this.setValueFromOutside(val, true);
3641
3656
  }
3642
3657
  writeValue(obj) {
3643
- this.updateValue(obj, false);
3658
+ this.setValueFromOutside(obj, false);
3644
3659
  }
3645
3660
  registerOnChange(fn) {
3646
3661
  this.onChange = fn;
@@ -3650,33 +3665,52 @@ class DatetimeComponent {
3650
3665
  }
3651
3666
  setDisabledState(isDisabled) {
3652
3667
  this.isDisabled = isDisabled;
3668
+ const action = isDisabled ? 'disable' : 'enable';
3669
+ this.dateControl[action]({ emitEvent: false });
3670
+ this.hourControl[action]({ emitEvent: false });
3671
+ this.minuteControl[action]({ emitEvent: false });
3672
+ this.secondControl[action]({ emitEvent: false });
3653
3673
  }
3654
- onInput(rawValue) {
3655
- this.inputValue = rawValue;
3656
- if (!rawValue) {
3657
- this._value = null;
3658
- this.onChange(null);
3659
- return;
3660
- }
3661
- const parsed = this.parseInputValue(rawValue);
3662
- if (parsed) {
3663
- this._value = parsed;
3664
- this.onChange(parsed);
3665
- }
3674
+ clear() {
3675
+ this._value = null;
3676
+ this.dateControl.setValue(null, { emitEvent: false });
3677
+ this.hourControl.setValue('00', { emitEvent: false });
3678
+ this.minuteControl.setValue('00', { emitEvent: false });
3679
+ this.secondControl.setValue('00', { emitEvent: false });
3680
+ this.onChange(null);
3681
+ this.onTouched();
3666
3682
  }
3667
- onBlur() {
3668
- this.inputValue = this.formatValue(this._value);
3683
+ markTouched() {
3669
3684
  this.onTouched();
3670
3685
  }
3671
- updateValue(value, emit) {
3686
+ setValueFromOutside(value, emit) {
3672
3687
  const normalized = this.normalizeDateValue(value);
3673
3688
  this._value = normalized;
3674
- this.inputValue = this.formatValue(normalized);
3689
+ this.dateControl.setValue(normalized ? new Date(normalized.getTime()) : null, { emitEvent: false });
3690
+ this.hourControl.setValue(normalized ? normalized.getHours().toString().padStart(2, '0') : '00', { emitEvent: false });
3691
+ this.minuteControl.setValue(normalized ? normalized.getMinutes().toString().padStart(2, '0') : '00', { emitEvent: false });
3692
+ this.secondControl.setValue(normalized ? normalized.getSeconds().toString().padStart(2, '0') : '00', { emitEvent: false });
3675
3693
  if (emit) {
3676
3694
  this.onChange(normalized);
3677
3695
  this.onTouched();
3678
3696
  }
3679
3697
  }
3698
+ emitCurrentValue() {
3699
+ const date = this.dateControl.value;
3700
+ if (!date) {
3701
+ this._value = null;
3702
+ this.onChange(null);
3703
+ return;
3704
+ }
3705
+ const next = new Date(date.getTime());
3706
+ next.setHours(this.toNumber(this.hourControl.value), this.toNumber(this.minuteControl.value), this.showSeconds ? this.toNumber(this.secondControl.value) : 0, 0);
3707
+ this._value = next;
3708
+ this.onChange(next);
3709
+ }
3710
+ toNumber(value) {
3711
+ const parsed = Number.parseInt(value ?? '0', 10);
3712
+ return Number.isNaN(parsed) ? 0 : parsed;
3713
+ }
3680
3714
  normalizeDateValue(value) {
3681
3715
  if (value === undefined || value === null || value === '') {
3682
3716
  return null;
@@ -3702,44 +3736,24 @@ class DatetimeComponent {
3702
3736
  }
3703
3737
  return null;
3704
3738
  }
3705
- parseInputValue(rawValue) {
3706
- if (!rawValue) {
3707
- return null;
3708
- }
3709
- if (this.mode === 'date') {
3710
- const parsed = moment(rawValue, ['YYYY-MM-DD', 'DD/MM/YYYY', 'MM/DD/YYYY'], true);
3711
- return parsed.isValid() ? parsed.toDate() : this.normalizeDateValue(rawValue);
3712
- }
3713
- const parsed = moment(rawValue, ['YYYY-MM-DDTHH:mm:ss', 'YYYY-MM-DDTHH:mm', ...DatetimeComponent.DATE_FORMATS], true);
3714
- return parsed.isValid() ? parsed.toDate() : this.normalizeDateValue(rawValue);
3715
- }
3716
- formatValue(value) {
3717
- if (!value) {
3718
- return '';
3719
- }
3720
- if (this.mode === 'date') {
3721
- return moment(value).format('YYYY-MM-DD');
3722
- }
3723
- return moment(value).format(this.showSeconds ? 'YYYY-MM-DDTHH:mm:ss' : 'YYYY-MM-DDTHH:mm');
3724
- }
3725
3739
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DatetimeComponent, deps: [{ token: MAT_DATE_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
3726
3740
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: DatetimeComponent, isStandalone: true, selector: "gloww-datetime", inputs: { _value: ["value", "_value"], display: "display", placeHolder: "placeHolder", mode: "mode", showSeconds: "showSeconds" }, providers: [
3727
3741
  {
3728
3742
  provide: NG_VALUE_ACCESSOR,
3729
3743
  multi: true,
3730
- useExisting: DatetimeComponent
3744
+ useExisting: forwardRef(() => DatetimeComponent)
3731
3745
  }
3732
- ], ngImport: i0, template: "<div class=\"datetime-wrapper\">\n <mat-form-field>\n @if (display) {\n <mat-label>{{ display }}</mat-label>\n }\n <input\n matInput\n [type]=\"inputType\"\n [step]=\"inputStep\"\n [placeholder]=\"placeHolder\"\n [value]=\"inputValue\"\n [disabled]=\"isDisabled\"\n (input)=\"onInput($any($event.target).value)\"\n (change)=\"onInput($any($event.target).value)\"\n (blur)=\"onBlur()\">\n </mat-form-field>\n</div>\n", styles: [".datetime-wrapper,mat-form-field{width:100%}\n"], dependencies: [{ kind: "component", type: MatFormField$1, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel$1, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }] }); }
3746
+ ], ngImport: i0, template: "<div class=\"datetime-wrapper\">\n <mat-form-field class=\"date-field\">\n @if (display) {\n <mat-label>{{ display }}</mat-label>\n }\n <input\n matInput\n [matDatepicker]=\"picker\"\n [placeholder]=\"placeHolder\"\n [formControl]=\"dateControl\"\n [disabled]=\"isDisabled\"\n (dateChange)=\"markTouched()\"\n (blur)=\"markTouched()\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n\n @if (isDateTime) {\n <div class=\"time-row\">\n <mat-form-field class=\"time-field\">\n <mat-label>HH</mat-label>\n <mat-select [formControl]=\"hourControl\" [disabled]=\"isDisabled\" (selectionChange)=\"markTouched()\">\n @for (hour of hours; track hour) {\n <mat-option [value]=\"hour\">{{ hour }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field class=\"time-field\">\n <mat-label>MM</mat-label>\n <mat-select [formControl]=\"minuteControl\" [disabled]=\"isDisabled\" (selectionChange)=\"markTouched()\">\n @for (minute of minutes; track minute) {\n <mat-option [value]=\"minute\">{{ minute }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n @if (showSeconds) {\n <mat-form-field class=\"time-field\">\n <mat-label>SS</mat-label>\n <mat-select [formControl]=\"secondControl\" [disabled]=\"isDisabled\" (selectionChange)=\"markTouched()\">\n @for (second of seconds; track second) {\n <mat-option [value]=\"second\">{{ second }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n }\n\n <div class=\"actions-row\">\n <button mat-button type=\"button\" (click)=\"clear()\" [disabled]=\"isDisabled\">Clear</button>\n </div>\n</div>\n", styles: [".datetime-wrapper{display:flex;flex-direction:column;gap:8px;width:100%}.date-field,.time-field{width:100%}.time-row{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr))}.actions-row{display:flex;justify-content:flex-end}@media(min-width:720px){.time-row{grid-template-columns:repeat(3,minmax(0,1fr))}}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField$1, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel$1, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] }); }
3733
3747
  }
3734
3748
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DatetimeComponent, decorators: [{
3735
3749
  type: Component,
3736
- args: [{ selector: 'gloww-datetime', providers: [
3750
+ args: [{ selector: 'gloww-datetime', standalone: true, providers: [
3737
3751
  {
3738
3752
  provide: NG_VALUE_ACCESSOR,
3739
3753
  multi: true,
3740
- useExisting: DatetimeComponent
3754
+ useExisting: forwardRef(() => DatetimeComponent)
3741
3755
  }
3742
- ], imports: [MatFormField$1, MatLabel$1, MatInput], template: "<div class=\"datetime-wrapper\">\n <mat-form-field>\n @if (display) {\n <mat-label>{{ display }}</mat-label>\n }\n <input\n matInput\n [type]=\"inputType\"\n [step]=\"inputStep\"\n [placeholder]=\"placeHolder\"\n [value]=\"inputValue\"\n [disabled]=\"isDisabled\"\n (input)=\"onInput($any($event.target).value)\"\n (change)=\"onInput($any($event.target).value)\"\n (blur)=\"onBlur()\">\n </mat-form-field>\n</div>\n", styles: [".datetime-wrapper,mat-form-field{width:100%}\n"] }]
3756
+ ], imports: [ReactiveFormsModule, MatFormField$1, MatLabel$1, MatInput, MatDatepickerInput, MatDatepickerToggle, MatDatepicker, MatSuffix, MatSelect, MatOption, MatButton], template: "<div class=\"datetime-wrapper\">\n <mat-form-field class=\"date-field\">\n @if (display) {\n <mat-label>{{ display }}</mat-label>\n }\n <input\n matInput\n [matDatepicker]=\"picker\"\n [placeholder]=\"placeHolder\"\n [formControl]=\"dateControl\"\n [disabled]=\"isDisabled\"\n (dateChange)=\"markTouched()\"\n (blur)=\"markTouched()\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n\n @if (isDateTime) {\n <div class=\"time-row\">\n <mat-form-field class=\"time-field\">\n <mat-label>HH</mat-label>\n <mat-select [formControl]=\"hourControl\" [disabled]=\"isDisabled\" (selectionChange)=\"markTouched()\">\n @for (hour of hours; track hour) {\n <mat-option [value]=\"hour\">{{ hour }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field class=\"time-field\">\n <mat-label>MM</mat-label>\n <mat-select [formControl]=\"minuteControl\" [disabled]=\"isDisabled\" (selectionChange)=\"markTouched()\">\n @for (minute of minutes; track minute) {\n <mat-option [value]=\"minute\">{{ minute }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n @if (showSeconds) {\n <mat-form-field class=\"time-field\">\n <mat-label>SS</mat-label>\n <mat-select [formControl]=\"secondControl\" [disabled]=\"isDisabled\" (selectionChange)=\"markTouched()\">\n @for (second of seconds; track second) {\n <mat-option [value]=\"second\">{{ second }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n </div>\n }\n\n <div class=\"actions-row\">\n <button mat-button type=\"button\" (click)=\"clear()\" [disabled]=\"isDisabled\">Clear</button>\n </div>\n</div>\n", styles: [".datetime-wrapper{display:flex;flex-direction:column;gap:8px;width:100%}.date-field,.time-field{width:100%}.time-row{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr))}.actions-row{display:flex;justify-content:flex-end}@media(min-width:720px){.time-row{grid-template-columns:repeat(3,minmax(0,1fr))}}\n"] }]
3743
3757
  }], ctorParameters: () => [{ type: undefined, decorators: [{
3744
3758
  type: Optional
3745
3759
  }, {