@gnggln/ng-ui-system 1.0.0-alpha.21 → 1.0.0-alpha.22
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.
- package/crud-table/lib/components/form-builder/types/schema.types.d.ts +20 -0
- package/crud-table/lib/core/logging/logger.service.d.ts +1 -1
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +1 -1
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +1 -1
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +1 -1
- package/esm2022/crud-table/lib/components/form-builder/types/schema.types.mjs +1 -1
- package/esm2022/crud-table/lib/core/logging/logger.service.mjs +1 -1
- package/esm2022/form-builder/lib/components/form-builder/form-wizard.component.mjs +105 -18
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +1 -1
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +1 -1
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +1 -1
- package/esm2022/form-builder/lib/components/form-builder/types/index.mjs +1 -1
- package/esm2022/form-builder/lib/components/form-builder/types/schema.types.mjs +1 -1
- package/esm2022/form-builder/lib/core/logging/logger.service.mjs +1 -1
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +1 -1
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +1 -1
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +1 -1
- package/esm2022/form-builder-editor/lib/components/form-builder/types/index.mjs +1 -1
- package/esm2022/form-builder-editor/lib/components/form-builder/types/schema.types.mjs +1 -1
- package/esm2022/form-builder-editor/lib/core/logging/logger.service.mjs +1 -1
- package/esm2022/lib/components/form-builder/form-wizard.component.mjs +105 -18
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +1 -1
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +1 -1
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +1 -1
- package/esm2022/lib/components/form-builder/types/index.mjs +1 -1
- package/esm2022/lib/components/form-builder/types/schema.types.mjs +1 -1
- package/esm2022/lib/core/logging/logger.service.mjs +1 -1
- package/fesm2022/gnggln-ng-ui-system-crud-table.mjs.map +1 -1
- package/fesm2022/gnggln-ng-ui-system-form-builder-editor.mjs.map +1 -1
- package/fesm2022/gnggln-ng-ui-system-form-builder.mjs +104 -17
- package/fesm2022/gnggln-ng-ui-system-form-builder.mjs.map +1 -1
- package/fesm2022/gnggln-ng-ui-system.mjs +104 -17
- package/fesm2022/gnggln-ng-ui-system.mjs.map +1 -1
- package/form-builder/lib/components/form-builder/form-wizard.component.d.ts +10 -1
- package/form-builder/lib/components/form-builder/types/index.d.ts +1 -1
- package/form-builder/lib/components/form-builder/types/schema.types.d.ts +20 -0
- package/form-builder/lib/core/logging/logger.service.d.ts +1 -1
- package/form-builder-editor/lib/components/form-builder/types/index.d.ts +1 -1
- package/form-builder-editor/lib/components/form-builder/types/schema.types.d.ts +20 -0
- package/form-builder-editor/lib/core/logging/logger.service.d.ts +1 -1
- package/lib/components/form-builder/form-wizard.component.d.ts +10 -1
- package/lib/components/form-builder/types/index.d.ts +1 -1
- package/lib/components/form-builder/types/schema.types.d.ts +20 -0
- package/lib/core/logging/logger.service.d.ts +1 -1
- package/package.json +30 -30
|
@@ -49246,6 +49246,69 @@ class UiFormWizardComponent {
|
|
|
49246
49246
|
await this.wizardConfig.onStepSave(data, this.state.currentStep);
|
|
49247
49247
|
}
|
|
49248
49248
|
}
|
|
49249
|
+
/**
|
|
49250
|
+
* Scansiona gli step in ordine, marca come completati quelli validi rispetto alle
|
|
49251
|
+
* stesse regole di Next/Completa e posiziona il wizard sul primo step non valido
|
|
49252
|
+
* (o sull'ultimo se tutti validi). Utile dopo il preload di `initialData` in edit.
|
|
49253
|
+
*/
|
|
49254
|
+
async resumeCompletedStepsFromValidation(options) {
|
|
49255
|
+
const emitStepComplete = options?.emitStepComplete ?? false;
|
|
49256
|
+
const emitStepSave = options?.emitStepSave ?? false;
|
|
49257
|
+
if (!this.schema || this.state.totalSteps <= 0) {
|
|
49258
|
+
return { lastCompletedStep: -1, currentStep: 0 };
|
|
49259
|
+
}
|
|
49260
|
+
this.logger?.logWizardAction('resume', {
|
|
49261
|
+
wizardId: this.wizardConfig?.wizardId,
|
|
49262
|
+
schemaId: this.schema.id,
|
|
49263
|
+
totalSteps: this.state.totalSteps,
|
|
49264
|
+
});
|
|
49265
|
+
const completed = new Set();
|
|
49266
|
+
let lastCompletedStep = -1;
|
|
49267
|
+
let targetStep = 0;
|
|
49268
|
+
for (let i = 0; i < this.state.totalSteps; i++) {
|
|
49269
|
+
const ready = await this.prepareStepForValidation(i);
|
|
49270
|
+
if (!ready) {
|
|
49271
|
+
targetStep = i;
|
|
49272
|
+
break;
|
|
49273
|
+
}
|
|
49274
|
+
const valid = await this.validateCurrentStep({
|
|
49275
|
+
emitStepComplete,
|
|
49276
|
+
emitStepValidationFailed: false,
|
|
49277
|
+
});
|
|
49278
|
+
if (!valid) {
|
|
49279
|
+
targetStep = i;
|
|
49280
|
+
break;
|
|
49281
|
+
}
|
|
49282
|
+
completed.add(i);
|
|
49283
|
+
lastCompletedStep = i;
|
|
49284
|
+
targetStep = i;
|
|
49285
|
+
this.accumulatedData = {
|
|
49286
|
+
...this.accumulatedData,
|
|
49287
|
+
...(this.formBuilder?.getFormValue() || {}),
|
|
49288
|
+
};
|
|
49289
|
+
if (emitStepSave) {
|
|
49290
|
+
await this.autoSaveIfNeeded();
|
|
49291
|
+
}
|
|
49292
|
+
}
|
|
49293
|
+
this.state.completedSteps = completed;
|
|
49294
|
+
for (let v = 0; v <= targetStep; v++) {
|
|
49295
|
+
this.state.visitedSteps.add(v);
|
|
49296
|
+
}
|
|
49297
|
+
if (this.state.currentStep !== targetStep) {
|
|
49298
|
+
this.navigateToStep(targetStep);
|
|
49299
|
+
}
|
|
49300
|
+
else {
|
|
49301
|
+
this.syncWizardState();
|
|
49302
|
+
this.cdr.markForCheck();
|
|
49303
|
+
}
|
|
49304
|
+
this.logger?.logWizardAction('resumeComplete', {
|
|
49305
|
+
wizardId: this.wizardConfig?.wizardId,
|
|
49306
|
+
lastCompletedStep,
|
|
49307
|
+
currentStep: targetStep,
|
|
49308
|
+
completedSteps: Array.from(completed),
|
|
49309
|
+
});
|
|
49310
|
+
return { lastCompletedStep, currentStep: targetStep };
|
|
49311
|
+
}
|
|
49249
49312
|
// ─── Callback form builder ─────────────────────────────────────
|
|
49250
49313
|
onValueChange(data) {
|
|
49251
49314
|
this.accumulatedData = { ...this.accumulatedData, ...data };
|
|
@@ -49286,7 +49349,9 @@ class UiFormWizardComponent {
|
|
|
49286
49349
|
this.syncWizardState();
|
|
49287
49350
|
this.cdr.markForCheck();
|
|
49288
49351
|
}
|
|
49289
|
-
async validateCurrentStep() {
|
|
49352
|
+
async validateCurrentStep(options) {
|
|
49353
|
+
const emitStepComplete = options?.emitStepComplete ?? true;
|
|
49354
|
+
const emitStepValidationFailed = options?.emitStepValidationFailed ?? true;
|
|
49290
49355
|
this.formBuilder?.validateAllFields();
|
|
49291
49356
|
const group = this.wizardStepGroups[this.state.currentStep];
|
|
49292
49357
|
const primary = group?.[0];
|
|
@@ -49300,10 +49365,12 @@ class UiFormWizardComponent {
|
|
|
49300
49365
|
if (customFnName && this.customValidationMethods[customFnName]) {
|
|
49301
49366
|
const customValid = await this.customValidationMethods[customFnName](this.accumulatedData, this.state.currentStep, isFormValid);
|
|
49302
49367
|
if (!customValid) {
|
|
49303
|
-
|
|
49304
|
-
|
|
49305
|
-
|
|
49306
|
-
|
|
49368
|
+
if (emitStepValidationFailed) {
|
|
49369
|
+
this.stepValidationFailed.emit({
|
|
49370
|
+
step: this.state.currentStep,
|
|
49371
|
+
errors: ['Validazione custom fallita'],
|
|
49372
|
+
});
|
|
49373
|
+
}
|
|
49307
49374
|
return false;
|
|
49308
49375
|
}
|
|
49309
49376
|
}
|
|
@@ -49318,23 +49385,43 @@ class UiFormWizardComponent {
|
|
|
49318
49385
|
step: this.state.currentStep,
|
|
49319
49386
|
errors,
|
|
49320
49387
|
});
|
|
49321
|
-
|
|
49388
|
+
if (emitStepValidationFailed) {
|
|
49389
|
+
this.stepValidationFailed.emit({
|
|
49390
|
+
step: this.state.currentStep,
|
|
49391
|
+
errors,
|
|
49392
|
+
});
|
|
49393
|
+
}
|
|
49394
|
+
return false;
|
|
49395
|
+
}
|
|
49396
|
+
if (emitStepComplete) {
|
|
49397
|
+
this.logger?.logWizardAction('stepComplete', {
|
|
49398
|
+
wizardId: this.wizardConfig.wizardId,
|
|
49399
|
+
step: this.state.currentStep,
|
|
49400
|
+
schemaId: this.schema?.id,
|
|
49401
|
+
});
|
|
49402
|
+
this.stepComplete.emit({
|
|
49322
49403
|
step: this.state.currentStep,
|
|
49323
|
-
|
|
49404
|
+
data: this.formBuilder?.getFormValue() || {},
|
|
49324
49405
|
});
|
|
49325
|
-
return false;
|
|
49326
49406
|
}
|
|
49327
|
-
this.logger?.logWizardAction('stepComplete', {
|
|
49328
|
-
wizardId: this.wizardConfig.wizardId,
|
|
49329
|
-
step: this.state.currentStep,
|
|
49330
|
-
schemaId: this.schema?.id,
|
|
49331
|
-
});
|
|
49332
|
-
this.stepComplete.emit({
|
|
49333
|
-
step: this.state.currentStep,
|
|
49334
|
-
data: this.formBuilder?.getFormValue() || {},
|
|
49335
|
-
});
|
|
49336
49407
|
return true;
|
|
49337
49408
|
}
|
|
49409
|
+
/** Naviga allo step e attende il mount del form builder per la validazione resume. */
|
|
49410
|
+
async prepareStepForValidation(stepIndex) {
|
|
49411
|
+
this.navigateToStep(stepIndex);
|
|
49412
|
+
return this.waitForFormBuilderReady();
|
|
49413
|
+
}
|
|
49414
|
+
async waitForFormBuilderReady(maxAttempts = 30) {
|
|
49415
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
49416
|
+
this.cdr.detectChanges();
|
|
49417
|
+
if (this.formBuilder) {
|
|
49418
|
+
await Promise.resolve();
|
|
49419
|
+
return true;
|
|
49420
|
+
}
|
|
49421
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
49422
|
+
}
|
|
49423
|
+
return false;
|
|
49424
|
+
}
|
|
49338
49425
|
/**
|
|
49339
49426
|
* Raggruppa le sezioni con `wizardStep` per `stepNumber` (ordine stabile per numero, poi ordine di apparizione nello schema).
|
|
49340
49427
|
*/
|