tin-spa 2.2.0 → 2.2.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.
@@ -449,14 +449,13 @@ class DetailsDialogProcessor {
449
449
  static processDetailsConfig(detailsConfig, row) {
450
450
  const updatedDetailsConfig = Core.getClone(detailsConfig);
451
451
  updatedDetailsConfig.details = row;
452
- updatedDetailsConfig.config.mode = "view";
453
- updatedDetailsConfig.setHero = updatedDetailsConfig.setHero ?? false;
452
+ updatedDetailsConfig.formConfig.mode = updatedDetailsConfig.mode ?? "view";
454
453
  if (updatedDetailsConfig.heroField) {
455
454
  updatedDetailsConfig.heroValue = row[updatedDetailsConfig.heroField];
456
455
  function updateTableConfig(tableConfig) {
457
456
  tableConfig.heroField = updatedDetailsConfig.heroField;
458
457
  tableConfig.heroValue = updatedDetailsConfig.heroValue;
459
- tableConfig.setHero = updatedDetailsConfig.setHero;
458
+ // tableConfig.setHero = updatedDetailsConfig.setHero;
460
459
  tableConfig.searchConfig = null;
461
460
  tableConfig.tileConfig = null;
462
461
  tableConfig.parentData = updatedDetailsConfig.details;
@@ -488,15 +487,21 @@ class DetailsDialogProcessor {
488
487
  static initializeConfigs(detailsConfig) {
489
488
  const tableConfig = detailsConfig.tableConfig;
490
489
  const tableConfigs = detailsConfig.tableConfigs;
491
- const formConfig = detailsConfig.config;
490
+ const formConfig = detailsConfig.formConfig;
492
491
  const buttons = detailsConfig.buttons;
493
492
  formConfig.mode = formConfig.mode ?? "view";
494
493
  return { tableConfig, tableConfigs, formConfig, buttons };
495
494
  }
496
495
  static setHeroValue(detailsConfig, details) {
497
- if (detailsConfig.heroField) {
498
- detailsConfig.heroValue = details[detailsConfig.heroField];
496
+ console.log(detailsConfig);
497
+ if ((detailsConfig.formConfig.mode == "create") && detailsConfig.heroField && detailsConfig.heroValue) {
498
+ details[detailsConfig.heroField] = detailsConfig.heroValue;
499
+ return;
499
500
  }
501
+ // if (detailsConfig.config.mode != "create" && detailsConfig.heroField) {
502
+ // detailsConfig.heroValue = details[detailsConfig.heroField];
503
+ // }
504
+ console.log(detailsConfig);
500
505
  }
501
506
  static handleFormMode(detailsConfig, formConfig) {
502
507
  let details;
@@ -504,7 +509,7 @@ class DetailsDialogProcessor {
504
509
  let loadByAction = false;
505
510
  if (formConfig.mode === "create") {
506
511
  details = Core.generateObject(formConfig.fields);
507
- this.setHeroValue(detailsConfig, details);
512
+ // this.setHeroValue(detailsConfig, details);
508
513
  }
509
514
  else {
510
515
  let resp = this.loadDetailsData(detailsConfig, formConfig);
@@ -3281,6 +3286,7 @@ class DetailsDialogInternal {
3281
3286
  this.tableConfigs = tableConfigs;
3282
3287
  this.formConfig = formConfig;
3283
3288
  this.buttons = buttons;
3289
+ // console.log(this.detailsConfig)
3284
3290
  let resp = DetailsDialogProcessor.handleFormMode(this.detailsConfig, this.formConfig);
3285
3291
  if (resp.loadByAction) {
3286
3292
  this.loadByAction = true;
@@ -3289,6 +3295,7 @@ class DetailsDialogInternal {
3289
3295
  }
3290
3296
  else {
3291
3297
  this.details = resp.details;
3298
+ DetailsDialogProcessor.setHeroValue(this.detailsConfig, this.details);
3292
3299
  this.loadByAction = false;
3293
3300
  this.isLoadComplete = true;
3294
3301
  }
@@ -3310,6 +3317,7 @@ class DetailsDialogInternal {
3310
3317
  if (apiResponse.success) {
3311
3318
  this.details = apiResponse.data;
3312
3319
  this.isLoadComplete = true;
3320
+ // DetailsDialogProcessor.setHeroValue(this.detailsConfig, this.details);
3313
3321
  }
3314
3322
  else {
3315
3323
  this.messageService.toast("Error: " + apiResponse.message);
@@ -3894,14 +3902,14 @@ class TableInternalComponent {
3894
3902
  return;
3895
3903
  }
3896
3904
  let conf = {
3897
- config: this.config.formConfig,
3905
+ formConfig: this.config.formConfig,
3898
3906
  buttons: this.config.buttons,
3899
3907
  details: row,
3900
3908
  };
3901
3909
  if (button.detailsConfig) {
3902
3910
  conf = DetailsDialogProcessor.processDetailsConfig(button.detailsConfig, row);
3903
3911
  }
3904
- conf.config.mode = "view";
3912
+ conf.formConfig.mode = "view";
3905
3913
  const dialogRef = this.dialog.open(DetailsDialogInternal, {
3906
3914
  width: "900px",
3907
3915
  data: conf
@@ -3926,13 +3934,13 @@ class TableInternalComponent {
3926
3934
  }
3927
3935
  this.config.formConfig.mode = "create";
3928
3936
  let conf = {
3929
- config: this.config.formConfig,
3937
+ formConfig: this.config.formConfig,
3930
3938
  buttons: this.config.buttons,
3931
3939
  };
3932
3940
  if (button.detailsConfig) {
3933
3941
  conf = button.detailsConfig;
3934
3942
  }
3935
- conf.config.mode = "create";
3943
+ conf.formConfig.mode = "create";
3936
3944
  conf.heroField = this.config?.heroField;
3937
3945
  conf.heroValue = this.config?.heroValue;
3938
3946
  const dialogRef = this.dialog.open(DetailsDialogInternal, {
@@ -3963,14 +3971,14 @@ class TableInternalComponent {
3963
3971
  }
3964
3972
  this.config.formConfig.mode = "edit";
3965
3973
  let conf = {
3966
- config: this.config.formConfig,
3974
+ formConfig: this.config.formConfig,
3967
3975
  buttons: this.config.buttons,
3968
3976
  details: row,
3969
3977
  };
3970
3978
  if (button.detailsConfig) {
3971
3979
  conf = DetailsDialogProcessor.processDetailsConfig(button.detailsConfig, row);
3972
3980
  }
3973
- conf.config.mode = "edit";
3981
+ conf.formConfig.mode = "edit";
3974
3982
  const dialogRef = this.dialog.open(DetailsDialogInternal, {
3975
3983
  width: "900px",
3976
3984
  data: conf
@@ -4697,14 +4705,14 @@ class TableComponent {
4697
4705
  return;
4698
4706
  }
4699
4707
  let conf = {
4700
- config: this.config.formConfig,
4708
+ formConfig: this.config.formConfig,
4701
4709
  buttons: this.config.buttons,
4702
4710
  details: row,
4703
4711
  };
4704
4712
  if (button.detailsConfig) {
4705
4713
  conf = DetailsDialogProcessor.processDetailsConfig(button.detailsConfig, row);
4706
4714
  }
4707
- conf.config.mode = "view";
4715
+ conf.formConfig.mode = "view";
4708
4716
  const dialogRef = this.dialog.open(DetailsDialog, {
4709
4717
  width: "900px",
4710
4718
  data: conf
@@ -4729,13 +4737,13 @@ class TableComponent {
4729
4737
  }
4730
4738
  this.config.formConfig.mode = "create";
4731
4739
  let conf = {
4732
- config: this.config.formConfig,
4740
+ formConfig: this.config.formConfig,
4733
4741
  buttons: this.config.buttons,
4734
4742
  };
4735
4743
  if (button.detailsConfig) {
4736
4744
  conf = button.detailsConfig;
4737
4745
  }
4738
- conf.config.mode = "create";
4746
+ conf.formConfig.mode = "create";
4739
4747
  conf.heroField = this.config?.heroField;
4740
4748
  conf.heroValue = this.config?.heroValue;
4741
4749
  const dialogRef = this.dialog.open(DetailsDialog, {
@@ -4765,14 +4773,14 @@ class TableComponent {
4765
4773
  return;
4766
4774
  }
4767
4775
  let conf = {
4768
- config: this.config.formConfig,
4776
+ formConfig: this.config.formConfig,
4769
4777
  buttons: this.config.buttons,
4770
4778
  details: row,
4771
4779
  };
4772
4780
  if (button.detailsConfig) {
4773
4781
  conf = DetailsDialogProcessor.processDetailsConfig(button.detailsConfig, row);
4774
4782
  }
4775
- conf.config.mode = "edit";
4783
+ conf.formConfig.mode = "edit";
4776
4784
  const dialogRef = this.dialog.open(DetailsDialog, {
4777
4785
  width: "900px",
4778
4786
  data: conf