@pumpkin-tech/pumpkin-tech-ng 0.2.24 → 0.2.25

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.
@@ -5975,6 +5975,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
5975
5975
  }] } });
5976
5976
 
5977
5977
  class InputTimeComponent extends BaseField {
5978
+ cdr;
5979
+ constructor(el, cdr) {
5980
+ super(el);
5981
+ this.cdr = cdr;
5982
+ }
5978
5983
  /** 24 (padrão) ou 12 */
5979
5984
  format = 24;
5980
5985
  /** mostra/oculta seleção de segundos */
@@ -6026,10 +6031,16 @@ class InputTimeComponent extends BaseField {
6026
6031
  this.valueChange.emit(v ?? '');
6027
6032
  }
6028
6033
  }
6029
- writeValue(val) { this._val = val ?? null; }
6034
+ writeValue(val) {
6035
+ this._val = this.normalizeIncomingValue(val);
6036
+ this.cdr.markForCheck();
6037
+ }
6030
6038
  registerOnChange(fn) { this.onChange = fn; }
6031
6039
  registerOnTouched(fn) { this.onTouch = fn; }
6032
- setDisabledState(isDisabled) { this.disabled = isDisabled; }
6040
+ setDisabledState(isDisabled) {
6041
+ this.disabled = isDisabled;
6042
+ this.cdr.markForCheck();
6043
+ }
6033
6044
  // Normaliza saída do timepicker para 'HH:mm' ou 'HH:mm:ss' (24h)
6034
6045
  onTimeSet(raw) {
6035
6046
  const { hh, mm, ss } = this.parseTime(raw);
@@ -6069,7 +6080,21 @@ class InputTimeComponent extends BaseField {
6069
6080
  }
6070
6081
  pad(n) { return n < 10 ? '0' + n : '' + n; }
6071
6082
  clamp(v, min, max) { return Math.max(min, Math.min(max, v)); }
6072
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InputTimeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6083
+ normalizeIncomingValue(value) {
6084
+ if (value == null || value === '')
6085
+ return null;
6086
+ if (value instanceof Date) {
6087
+ if (Number.isNaN(value.getTime()))
6088
+ return null;
6089
+ const hh = this.pad(value.getHours());
6090
+ const mm = this.pad(value.getMinutes());
6091
+ const ss = this.pad(value.getSeconds());
6092
+ return this.seconds ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`;
6093
+ }
6094
+ const { hh, mm, ss } = this.parseTime(String(value));
6095
+ return this.seconds ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`;
6096
+ }
6097
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InputTimeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
6073
6098
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: InputTimeComponent, isStandalone: true, selector: "ptech-input-time", inputs: { format: "format", seconds: "seconds", disableClick: "disableClick", timepickerTheme: "timepickerTheme" }, outputs: { valueChange: "valueChange" }, providers: [{
6074
6099
  provide: NG_VALUE_ACCESSOR,
6075
6100
  useExisting: forwardRef(() => InputTimeComponent),
@@ -6177,7 +6202,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
6177
6202
  <ng-content select="mat-hint, [mat-hint], mat-error, [mat-error]"></ng-content>
6178
6203
  </mat-form-field>
6179
6204
  `, styles: [":host{display:block;width:100%}.ptech-form-field{width:100%}:host ::ng-deep .ptech-form-field{--mdc-outlined-text-field-outline-color: var(--ptech-field-outline, var(--app-border-color, rgba(0,0,0,.38)));--mdc-outlined-text-field-hover-outline-color: var(--ptech-field-outline-hover, var(--app-text, rgba(0,0,0,.87)));--mdc-outlined-text-field-focus-outline-color: var(--ptech-field-outline-focus, var(--app-text, #3f51b5))}:host ::ng-deep .ptech-form-field .mdc-text-field{background-color:var(--ptech-field-bg, var(--app-surface, transparent));color:var(--ptech-field-text, var(--app-text, inherit))}:host ::ng-deep .ptech-form-field .mdc-text-field .mdc-notched-outline__leading,:host ::ng-deep .ptech-form-field .mdc-text-field .mdc-notched-outline__notch,:host ::ng-deep .ptech-form-field .mdc-text-field .mdc-notched-outline__trailing{border-color:var(--ptech-field-outline, var(--app-border-color, rgba(0,0,0,.38)))!important}:host ::ng-deep .ptech-form-field .mdc-text-field.mdc-text-field--hover .mdc-notched-outline__leading,:host ::ng-deep .ptech-form-field .mdc-text-field.mdc-text-field--hover .mdc-notched-outline__notch,:host ::ng-deep .ptech-form-field .mdc-text-field.mdc-text-field--hover .mdc-notched-outline__trailing{border-color:var(--ptech-field-outline-hover, var(--app-text, rgba(0,0,0,.87)))!important}:host ::ng-deep .ptech-form-field .mdc-text-field.mdc-text-field--focused .mdc-notched-outline__leading,:host ::ng-deep .ptech-form-field .mdc-text-field.mdc-text-field--focused .mdc-notched-outline__notch,:host ::ng-deep .ptech-form-field .mdc-text-field.mdc-text-field--focused .mdc-notched-outline__trailing{border-color:var(--ptech-field-outline-focus, var(--app-text, #3f51b5))!important}:host ::ng-deep .ptech-form-field input.mat-mdc-input-element,:host ::ng-deep .ptech-form-field input.mdc-text-field__input,:host ::ng-deep .ptech-form-field .mat-mdc-input-element{color:var(--ptech-field-text, var(--app-text, inherit))!important;caret-color:var(--ptech-field-text, var(--app-text, inherit))!important;-webkit-text-fill-color:var(--ptech-field-text, var(--app-text, inherit))!important}:host ::ng-deep .ptech-form-field .mat-mdc-form-field-icon-suffix{align-items:center;color:var(--ptech-field-icon, var(--ptech-field-text, var(--app-text, inherit)))!important;padding:0 8px 0 4px}:host ::ng-deep .ptech-form-field .mat-mdc-form-field-infix{min-width:0}:host ::ng-deep .ptech-time-toggle{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;min-width:40px;margin:0;color:var(--ptech-field-icon, var(--ptech-field-text, var(--app-text, inherit)))!important}:host ::ng-deep .ptech-time-toggle .ngx-material-timepicker-toggle{width:40px;height:40px;min-width:40px;padding:0;color:inherit!important}:host ::ng-deep .ptech-time-toggle .ngx-material-timepicker-toggle:hover,:host ::ng-deep .ptech-time-toggle .ngx-material-timepicker-toggle:focus{background-color:color-mix(in srgb,var(--app-text, #111827) 10%,transparent)}:host ::ng-deep .ptech-time-toggle mat-icon{width:24px;height:24px;font-size:24px;line-height:24px;color:inherit!important}:host ::ng-deep .ptech-form-field .mat-mdc-icon-button.mat-mdc-button-base,:host ::ng-deep .ptech-form-field .mat-mdc-icon-button .mat-icon,:host ::ng-deep .ptech-form-field .mat-mdc-icon-button svg,:host ::ng-deep .ptech-form-field .ngx-material-timepicker-toggle svg,:host ::ng-deep .ptech-form-field .mat-mdc-icon-button svg path{color:var(--ptech-field-text, var(--app-text, inherit))!important;fill:var(--ptech-field-text, var(--app-text, inherit))!important}:host ::ng-deep .ptech-form-field input::placeholder,:host ::ng-deep .ptech-form-field textarea::placeholder{color:var(--ptech-field-placeholder, var(--app-text, inherit));opacity:.78}:host ::ng-deep .ptech-form-field .mdc-floating-label,:host ::ng-deep .ptech-form-field .mdc-floating-label--float-above{color:var(--ptech-field-label, var(--app-text, inherit))!important}mat-label span{color:var(--ptech-required-color, var(--app-status-error, #f44336))!important}::ng-deep ngx-material-timepicker-container .timepicker{border:1px solid var(--app-border-color, rgba(0,0,0,.12));background-color:var(--app-surface, #fff);color:var(--app-text, inherit)}::ng-deep ngx-material-timepicker-container .timepicker__header{background-color:var(--app-link-accent, #3f51b5)!important;color:var(--app-text-on-accent, #fff)!important}::ng-deep ngx-material-timepicker-container .timepicker__body,::ng-deep ngx-material-timepicker-container .timepicker__actions{background-color:var(--app-surface, #fff)!important;color:var(--app-text, inherit)!important}::ng-deep ngx-material-timepicker-container .clock-face{background-color:var(--app-surface-2, #f0f0f0)!important}::ng-deep ngx-material-timepicker-container .clock-face__number,::ng-deep ngx-material-timepicker-container .clock-face__number>span{color:var(--app-text, inherit)!important}::ng-deep ngx-material-timepicker-container .timepicker-button{color:var(--app-link-accent, #3f51b5)!important}\n"] }]
6180
- }], propDecorators: { format: [{
6205
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { format: [{
6181
6206
  type: Input
6182
6207
  }], seconds: [{
6183
6208
  type: Input