cat-qw-lib 2.6.32 → 2.6.33

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.
@@ -3966,6 +3966,15 @@ class WidgetAdminFormComponent extends BaseFormComponent {
3966
3966
  super.init();
3967
3967
  this.baseStore.setIsApiValidated(null);
3968
3968
  this.recordChange.asObservable().subscribe((record) => {
3969
+ const hasRecord = !!record && (!!record._id ||
3970
+ !!record.apiConfigId ||
3971
+ (record.dataItems?.length ?? 0) > 0 ||
3972
+ (record.badges?.length ?? 0) > 0 ||
3973
+ !!record.headerDictionaryID);
3974
+ // Ignore initial empty emissions to avoid clearing edit values before actual record arrives.
3975
+ if (!hasRecord) {
3976
+ return;
3977
+ }
3969
3978
  // recordChange can emit readonly store objects; clone before normalization/mutation.
3970
3979
  const editableRecord = structuredClone((record || {}));
3971
3980
  const withAliases = this.normalizeIncomingDictionaryAliases(editableRecord);
@@ -4031,8 +4040,29 @@ class WidgetAdminFormComponent extends BaseFormComponent {
4031
4040
  selectedApiConfigId: apiConfigId
4032
4041
  });
4033
4042
  }
4034
- this.dictionaries =
4035
- allDictionaryRecords?.filter((item) => String(item.apiConfigId ?? item.apiConfigID ?? '') === String(apiConfigId ?? '')) || [];
4043
+ if (apiConfigId) {
4044
+ this.dictionaries =
4045
+ allDictionaryRecords?.filter((item) => String(item.apiConfigId ?? item.apiConfigID ?? '') === String(apiConfigId ?? '')) || [];
4046
+ }
4047
+ else {
4048
+ // Edit fallback when apiConfigId is not yet available: keep dictionaries needed by currently selected IDs.
4049
+ const selectedDictionaryIds = new Set();
4050
+ if (this.record?.headerDictionaryID)
4051
+ selectedDictionaryIds.add(String(this.record.headerDictionaryID));
4052
+ if (this.record?.subHeaderDictionaryID)
4053
+ selectedDictionaryIds.add(String(this.record.subHeaderDictionaryID));
4054
+ (this.record?.dataItems || []).forEach((item) => {
4055
+ const id = item?.dataDictionaryId || item?.dictionaryID;
4056
+ if (id)
4057
+ selectedDictionaryIds.add(String(id));
4058
+ });
4059
+ (this.record?.badges || []).forEach((badge) => {
4060
+ const id = badge?.dataDictionaryId || badge?.dictionaryID;
4061
+ if (id)
4062
+ selectedDictionaryIds.add(String(id));
4063
+ });
4064
+ this.dictionaries = (allDictionaryRecords || []).filter((d) => selectedDictionaryIds.has(String(d?._id)));
4065
+ }
4036
4066
  if (this.enableDictionaryDebugLogs) {
4037
4067
  console.log('[WidgetAdmin] dictionary records after apiConfigId filter', {
4038
4068
  selectedApiConfigId: apiConfigId,