bfg-common 1.2.203 → 1.2.205

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.
@@ -483,4 +483,56 @@ export default class Wizard {
483
483
  getStepIdByFieldName(fieldName: string): number {
484
484
  return this.steps.find((step) => step.fields[fieldName])?.id || -1
485
485
  }
486
+
487
+ setDynamicValidationField(fieldName: string | string[]): void {
488
+ const fields: {
489
+ [key: string]: UI_I_ErrorFields
490
+ } = this.steps[this.selectedStepId].fields
491
+
492
+ if (typeof fieldName === 'string') {
493
+ fields[fieldName] = {
494
+ alert: '',
495
+ field: '',
496
+ }
497
+ } else {
498
+ fieldName.forEach((name: string) => {
499
+ fields[name] = {
500
+ alert: '',
501
+ field: '',
502
+ }
503
+ })
504
+ }
505
+
506
+ this.steps = this.steps.map((step: UI_I_WizardStep) =>
507
+ step.id === this.selectedStepId
508
+ ? {
509
+ ...step,
510
+ fields,
511
+ }
512
+ : step
513
+ )
514
+ }
515
+
516
+ removeDynamicValidationField(fieldName: string | string[]): void {
517
+ const newFields: {
518
+ [key: string]: UI_I_ErrorFields
519
+ } = this.steps[this.selectedStepId].fields
520
+
521
+ if (typeof fieldName === 'string') {
522
+ delete newFields[fieldName]
523
+ } else {
524
+ fieldName.forEach((name: string) => {
525
+ delete newFields[name]
526
+ })
527
+ }
528
+
529
+ this.steps = this.steps.map((step: UI_I_WizardStep) =>
530
+ step.id === this.selectedStepId
531
+ ? {
532
+ ...step,
533
+ fields: newFields,
534
+ }
535
+ : step
536
+ )
537
+ }
486
538
  }