@ngx-smz/core 21.0.0 → 21.0.2

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.
@@ -1352,7 +1352,15 @@ const CONTROL_FUNCTIONS = {
1352
1352
  [SmzControlType.CALENDAR]: {
1353
1353
  initialize: (input) => { },
1354
1354
  clear: (control) => { control.patchValue(''); },
1355
- applyDefaultValue: (control, input) => { control.patchValue(input.defaultValue); },
1355
+ applyDefaultValue: (control, input) => {
1356
+ const rawValue = input.defaultValue;
1357
+ if (rawValue == null) {
1358
+ control.patchValue(null);
1359
+ return;
1360
+ }
1361
+ const valueAsDate = rawValue instanceof Date ? rawValue : new Date(rawValue);
1362
+ control.patchValue(valueAsDate);
1363
+ },
1356
1364
  getValue: (form, input, flattenResponse) => {
1357
1365
  const value = form.get(input.propertyName).value;
1358
1366
  if (!isEmpty$1(value) && !input.showTime && value instanceof Date) {
@@ -6253,7 +6261,9 @@ class FormGroupComponent {
6253
6261
  this.viewdata.updateFormValues();
6254
6262
  // this.viewdata.isValid = this.viewdata.form.valid;
6255
6263
  const runCustomFunctionsOnLoad = this.config.behaviors?.runCustomFunctionsOnLoad ?? false;
6256
- // Esse if garante a execução do custom behaviour na primiera inicialização, já que com o adiamento feito no status changes abaixo,
6264
+ let isStatusChangesEmitted = false;
6265
+ let data = null;
6266
+ // Esse if garante a execução do custom behaviour na primeira inicialização, já que com o adiamento feito no status changes abaixo,
6257
6267
  // ele não passa mais por la
6258
6268
  if (runCustomFunctionsOnLoad) {
6259
6269
  this.checkCustomFunctions();
@@ -6261,7 +6271,19 @@ class FormGroupComponent {
6261
6271
  }
6262
6272
  else {
6263
6273
  if (!this.config.behaviors?.skipEmitChangesOnLoad) {
6264
- this.statusChanges.emit(this.getData());
6274
+ isStatusChangesEmitted = true;
6275
+ data = this.getData();
6276
+ this.statusChanges.emit(data);
6277
+ }
6278
+ }
6279
+ if (this.config.behaviors?.emitAllOutputsOnLoad) {
6280
+ if (data == null) {
6281
+ data = this.getData();
6282
+ }
6283
+ this.initialStateChanged.emit(data);
6284
+ this.previousStateChanged.emit(data);
6285
+ if (!isStatusChangesEmitted) {
6286
+ this.statusChanges.emit(data);
6265
6287
  }
6266
6288
  }
6267
6289
  this.callVisibilityFunctions();
@@ -26945,6 +26967,10 @@ class SmzFormBuilder {
26945
26967
  this.formState.behaviors.runCustomFunctionsOnLoad = true;
26946
26968
  return this;
26947
26969
  }
26970
+ emitAllOutputsOnLoad() {
26971
+ this.formState.behaviors.emitAllOutputsOnLoad = true;
26972
+ return this;
26973
+ }
26948
26974
  setCustomBehavior(callback) {
26949
26975
  this.formState.functions.customBehavior = callback;
26950
26976
  return this;