cat-qw-lib 2.6.33 → 2.6.34
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/fesm2022/cat-qw-lib.mjs
CHANGED
|
@@ -4089,6 +4089,9 @@ class WidgetAdminFormComponent extends BaseFormComponent {
|
|
|
4089
4089
|
});
|
|
4090
4090
|
}
|
|
4091
4091
|
const itemsForDictionary = (dictionaryId) => this.getDictionaryItemsByDictionaryId(allDictionaryItemRecords, dictionaryId);
|
|
4092
|
+
// Edit payload can miss dictionaryID/dataDictionaryId while providing dictionaryItemID.
|
|
4093
|
+
// Infer dictionary ids first so dictionary dropdowns can preselect correctly.
|
|
4094
|
+
this.hydrateMissingDictionaryIdsFromItemSelection(allDictionaryItemRecords);
|
|
4092
4095
|
const r = this.record;
|
|
4093
4096
|
this.headerDictionaryItems = itemsForDictionary(r.headerDictionaryID);
|
|
4094
4097
|
this.subHeaderDictionaryItems = itemsForDictionary(r.subHeaderDictionaryID);
|
|
@@ -4096,6 +4099,35 @@ class WidgetAdminFormComponent extends BaseFormComponent {
|
|
|
4096
4099
|
this.badgeDictionaryItemArray = (r.badges || []).map((badge) => itemsForDictionary(badge.dataDictionaryId || badge.dictionaryID));
|
|
4097
4100
|
});
|
|
4098
4101
|
}
|
|
4102
|
+
hydrateMissingDictionaryIdsFromItemSelection(allDictionaryItemRecords) {
|
|
4103
|
+
const inferDictionaryId = (dictionaryItemId) => {
|
|
4104
|
+
if (!dictionaryItemId) {
|
|
4105
|
+
return '';
|
|
4106
|
+
}
|
|
4107
|
+
const matched = allDictionaryItemRecords.find((item) => String(item?._id) === String(dictionaryItemId));
|
|
4108
|
+
return (matched?.dataDictionaryId || matched?.dictionaryID || '');
|
|
4109
|
+
};
|
|
4110
|
+
this.record.dataItems = (this.record.dataItems || []).map((item) => {
|
|
4111
|
+
const currentDictionaryId = item?.dataDictionaryId || item?.dictionaryID || '';
|
|
4112
|
+
const dictionaryItemId = item?.dictionaryItemId || item?.dictionaryItemID || '';
|
|
4113
|
+
const inferredDictionaryId = inferDictionaryId(dictionaryItemId);
|
|
4114
|
+
return {
|
|
4115
|
+
...item,
|
|
4116
|
+
dataDictionaryId: currentDictionaryId || inferredDictionaryId || this.record.headerDictionaryID || '',
|
|
4117
|
+
dictionaryItemId: dictionaryItemId,
|
|
4118
|
+
};
|
|
4119
|
+
});
|
|
4120
|
+
this.record.badges = (this.record.badges || []).map((badge) => {
|
|
4121
|
+
const currentDictionaryId = badge?.dataDictionaryId || badge?.dictionaryID || '';
|
|
4122
|
+
const dictionaryItemId = badge?.dictionaryItemId || badge?.dictionaryItemID || '';
|
|
4123
|
+
const inferredDictionaryId = inferDictionaryId(dictionaryItemId);
|
|
4124
|
+
return {
|
|
4125
|
+
...badge,
|
|
4126
|
+
dataDictionaryId: currentDictionaryId || inferredDictionaryId || this.record.headerDictionaryID || '',
|
|
4127
|
+
dictionaryItemId: dictionaryItemId,
|
|
4128
|
+
};
|
|
4129
|
+
});
|
|
4130
|
+
}
|
|
4099
4131
|
getDictionaryItemsByDictionaryId(allDictionaryItemRecords, dictionaryId) {
|
|
4100
4132
|
if (!dictionaryId) {
|
|
4101
4133
|
return [];
|