@ngrdt/forms 0.0.83 → 0.0.86

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.
@@ -152,7 +152,7 @@ class RdtBaseFormInputComponent extends RdtInteractiveElementComponent {
152
152
  if (value === '') {
153
153
  value = null; // Convert empty string to null
154
154
  }
155
- if (value !== untracked(this.internalValue)) {
155
+ if (!this.areInternalValuesEqual(value, untracked(this.internalValue))) {
156
156
  const externalValue = this.toExternalValue(value);
157
157
  this.externalValue.set(externalValue);
158
158
  this.onChange(externalValue);
@@ -166,6 +166,9 @@ class RdtBaseFormInputComponent extends RdtInteractiveElementComponent {
166
166
  this.additionalErrors.set(errors);
167
167
  }
168
168
  }
169
+ areInternalValuesEqual(value1, value2) {
170
+ return value1 === value2;
171
+ }
169
172
  listenControlEvents(control) {
170
173
  control.events
171
174
  .pipe(startWith(null), takeUntilDestroyed(this.destroyRef))
@@ -329,6 +332,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
329
332
  type: Directive
330
333
  }], ctorParameters: () => [] });
331
334
 
335
+ const RDT_FORM_CONTROL_DATE_FORMAT = new InjectionToken('RDT_FORM_CONTROL_DATE_FORMAT', { providedIn: 'root', factory: () => 'yyyy-MM-dd' });
336
+ const RDT_FORM_CONTROL_DATETIME_FORMAT = new InjectionToken('RDT_FORM_CONTROL_DATETIME_FORMAT', { providedIn: 'root', factory: () => "yyyy-MM-dd'T'HH:mm:ss" });
337
+ const RDT_FORM_CONTROL_TIME_FORMAT = new InjectionToken('RDT_FORM_CONTROL_TIME_FORMAT', { providedIn: 'root', factory: () => 'HH:mm:ss' });
338
+ const RDT_EMPTY_TIME_DATE = new InjectionToken('RDT_EMPTY_TIME_DATE', {
339
+ providedIn: 'root',
340
+ factory: () => new Date('1970-01-01T00:00:00'),
341
+ });
342
+
332
343
  function nullToUndefined(value) {
333
344
  return value === null ? undefined : value;
334
345
  }
@@ -337,6 +348,10 @@ function nullToUndefinedNumeric(value) {
337
348
  }
338
349
 
339
350
  class RdtDateComponent extends RdtBaseFormInputComponent {
351
+ formControlDateFormat = inject(RDT_FORM_CONTROL_DATE_FORMAT);
352
+ formControlDateTimeFormat = inject(RDT_FORM_CONTROL_DATETIME_FORMAT);
353
+ formControlTimeFormat = inject(RDT_FORM_CONTROL_TIME_FORMAT);
354
+ emptyTimeDate = inject(RDT_EMPTY_TIME_DATE);
340
355
  type = input('date');
341
356
  minInput = input(undefined, {
342
357
  transform: nullToUndefined,
@@ -352,6 +367,17 @@ class RdtDateComponent extends RdtBaseFormInputComponent {
352
367
  const maxInput = this.maxInput();
353
368
  return maxInput ? this.toInternalValue(maxInput) : null;
354
369
  });
370
+ formControlFormat = computed(() => {
371
+ switch (this.type()) {
372
+ case 'datetime-local':
373
+ return this.formControlDateTimeFormat;
374
+ case 'time':
375
+ return this.formControlTimeFormat;
376
+ case 'date':
377
+ default:
378
+ return this.formControlDateFormat;
379
+ }
380
+ });
355
381
  isEmpty(value) {
356
382
  return value === null;
357
383
  }
@@ -1678,5 +1704,5 @@ class RdtCommonValidators {
1678
1704
  * Generated bundle index. Do not edit.
1679
1705
  */
1680
1706
 
1681
- export { NO_OP_FILE_READER, NoOpFileReader, RDT_CHECKBOX_BASE_PROVIDER, RDT_DEFAULT_FILE_LABEL_FN, RDT_DEFAULT_FILE_READER, RDT_DEFAULT_MAX_FILE_SIZE, RDT_FORM_ERROR_CODES_PROVIDER, RdtBaseFormInputComponent, RdtBaseSelectCommonComponent, RdtCheckboxComponent, RdtCheckboxOutletDirective, RdtCommonValidators, RdtDateComponent, RdtDateValidators, RdtFileInputComponent, RdtFileReader, RdtFileReaderArrayBuffer, RdtFileReaderBase64, RdtFormErrorPipe, RdtFormInputOutletDirective, RdtMultiSelectComponent, RdtNumericInputComponent, RdtOfflineSelectDatasource, RdtSelectDatasource, RdtSelectOfflineDatasourceProviderDirective, RdtSelectOptionDirective, RdtSelectStore, RdtSingleSelectComponent, RdtTextAreaComponent, RdtTextInputComponent, VnshFileReaderText, defaultRdtFormErrorCodes, fileLabelTranslate, getFirstError, getRdtSelectPage, rdtSelectInitialState };
1707
+ export { NO_OP_FILE_READER, NoOpFileReader, RDT_CHECKBOX_BASE_PROVIDER, RDT_DEFAULT_FILE_LABEL_FN, RDT_DEFAULT_FILE_READER, RDT_DEFAULT_MAX_FILE_SIZE, RDT_EMPTY_TIME_DATE, RDT_FORM_CONTROL_DATETIME_FORMAT, RDT_FORM_CONTROL_DATE_FORMAT, RDT_FORM_CONTROL_TIME_FORMAT, RDT_FORM_ERROR_CODES_PROVIDER, RdtBaseFormInputComponent, RdtBaseSelectCommonComponent, RdtCheckboxComponent, RdtCheckboxOutletDirective, RdtCommonValidators, RdtDateComponent, RdtDateValidators, RdtFileInputComponent, RdtFileReader, RdtFileReaderArrayBuffer, RdtFileReaderBase64, RdtFormErrorPipe, RdtFormInputOutletDirective, RdtMultiSelectComponent, RdtNumericInputComponent, RdtOfflineSelectDatasource, RdtSelectDatasource, RdtSelectOfflineDatasourceProviderDirective, RdtSelectOptionDirective, RdtSelectStore, RdtSingleSelectComponent, RdtTextAreaComponent, RdtTextInputComponent, VnshFileReaderText, defaultRdtFormErrorCodes, fileLabelTranslate, getFirstError, getRdtSelectPage, rdtSelectInitialState };
1682
1708
  //# sourceMappingURL=ngrdt-forms.mjs.map