cat-qw-lib 2.6.34 → 2.6.35
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
|
@@ -3986,6 +3986,21 @@ class WidgetAdminFormComponent extends BaseFormComponent {
|
|
|
3986
3986
|
this.handleAPIChange(this.record.apiConfigId);
|
|
3987
3987
|
});
|
|
3988
3988
|
}
|
|
3989
|
+
/**
|
|
3990
|
+
* Widget Items / Badges dropdowns bind to dictionaryID + dictionaryItemID (template).
|
|
3991
|
+
* API may send dataDictionaryId + dictionaryItemID (or any mix). Keep both in sync.
|
|
3992
|
+
*/
|
|
3993
|
+
syncRowDictionaryKeys(row) {
|
|
3994
|
+
const dictionaryId = row?.dataDictionaryId || row?.dictionaryID || '';
|
|
3995
|
+
const dictionaryItemId = row?.dictionaryItemId || row?.dictionaryItemID || '';
|
|
3996
|
+
return {
|
|
3997
|
+
...row,
|
|
3998
|
+
dataDictionaryId: dictionaryId,
|
|
3999
|
+
dictionaryID: dictionaryId,
|
|
4000
|
+
dictionaryItemId: dictionaryItemId,
|
|
4001
|
+
dictionaryItemID: dictionaryItemId,
|
|
4002
|
+
};
|
|
4003
|
+
}
|
|
3989
4004
|
/**
|
|
3990
4005
|
* Normalize backend dictionary keys into UI form keys on edit load.
|
|
3991
4006
|
* This lets dropdowns preselect values immediately without user re-selection.
|
|
@@ -3993,16 +4008,8 @@ class WidgetAdminFormComponent extends BaseFormComponent {
|
|
|
3993
4008
|
normalizeIncomingDictionaryAliases(record) {
|
|
3994
4009
|
return {
|
|
3995
4010
|
...record,
|
|
3996
|
-
dataItems: (record.dataItems || []).map((item) => (
|
|
3997
|
-
|
|
3998
|
-
dataDictionaryId: item.dataDictionaryId || item.dictionaryID || '',
|
|
3999
|
-
dictionaryItemId: item.dictionaryItemId || item.dictionaryItemID || '',
|
|
4000
|
-
})),
|
|
4001
|
-
badges: (record.badges || []).map((badge) => ({
|
|
4002
|
-
...badge,
|
|
4003
|
-
dataDictionaryId: badge.dataDictionaryId || badge.dictionaryID || '',
|
|
4004
|
-
dictionaryItemId: badge.dictionaryItemId || badge.dictionaryItemID || '',
|
|
4005
|
-
})),
|
|
4011
|
+
dataItems: (record.dataItems || []).map((item) => this.syncRowDictionaryKeys(item)),
|
|
4012
|
+
badges: (record.badges || []).map((badge) => this.syncRowDictionaryKeys(badge)),
|
|
4006
4013
|
};
|
|
4007
4014
|
}
|
|
4008
4015
|
handleWidgetItemAddBtnClick() {
|
|
@@ -4111,21 +4118,27 @@ class WidgetAdminFormComponent extends BaseFormComponent {
|
|
|
4111
4118
|
const currentDictionaryId = item?.dataDictionaryId || item?.dictionaryID || '';
|
|
4112
4119
|
const dictionaryItemId = item?.dictionaryItemId || item?.dictionaryItemID || '';
|
|
4113
4120
|
const inferredDictionaryId = inferDictionaryId(dictionaryItemId);
|
|
4114
|
-
|
|
4121
|
+
const resolvedDictId = currentDictionaryId || inferredDictionaryId || this.record.headerDictionaryID || '';
|
|
4122
|
+
return this.syncRowDictionaryKeys({
|
|
4115
4123
|
...item,
|
|
4116
|
-
dataDictionaryId:
|
|
4124
|
+
dataDictionaryId: resolvedDictId,
|
|
4125
|
+
dictionaryID: resolvedDictId,
|
|
4117
4126
|
dictionaryItemId: dictionaryItemId,
|
|
4118
|
-
|
|
4127
|
+
dictionaryItemID: dictionaryItemId,
|
|
4128
|
+
});
|
|
4119
4129
|
});
|
|
4120
4130
|
this.record.badges = (this.record.badges || []).map((badge) => {
|
|
4121
4131
|
const currentDictionaryId = badge?.dataDictionaryId || badge?.dictionaryID || '';
|
|
4122
4132
|
const dictionaryItemId = badge?.dictionaryItemId || badge?.dictionaryItemID || '';
|
|
4123
4133
|
const inferredDictionaryId = inferDictionaryId(dictionaryItemId);
|
|
4124
|
-
|
|
4134
|
+
const resolvedDictId = currentDictionaryId || inferredDictionaryId || this.record.headerDictionaryID || '';
|
|
4135
|
+
return this.syncRowDictionaryKeys({
|
|
4125
4136
|
...badge,
|
|
4126
|
-
dataDictionaryId:
|
|
4137
|
+
dataDictionaryId: resolvedDictId,
|
|
4138
|
+
dictionaryID: resolvedDictId,
|
|
4127
4139
|
dictionaryItemId: dictionaryItemId,
|
|
4128
|
-
|
|
4140
|
+
dictionaryItemID: dictionaryItemId,
|
|
4141
|
+
});
|
|
4129
4142
|
});
|
|
4130
4143
|
}
|
|
4131
4144
|
getDictionaryItemsByDictionaryId(allDictionaryItemRecords, dictionaryId) {
|
|
@@ -4242,22 +4255,26 @@ class WidgetAdminFormComponent extends BaseFormComponent {
|
|
|
4242
4255
|
this.record.style = this.service.parseStylePayload(this.record.style);
|
|
4243
4256
|
this.record.dataItems = this.record.dataItems.map((item) => {
|
|
4244
4257
|
const raw = item;
|
|
4245
|
-
const
|
|
4258
|
+
const dictionaryID = raw.dataDictionaryId || raw.dictionaryID || '';
|
|
4259
|
+
const dictionaryItemID = raw.dictionaryItemId || raw.dictionaryItemID || '';
|
|
4260
|
+
const { dataDictionaryId: _dd, dictionaryItemId: _di, ...rest } = raw;
|
|
4246
4261
|
return {
|
|
4247
4262
|
...rest,
|
|
4248
|
-
dictionaryID
|
|
4249
|
-
dictionaryItemID
|
|
4263
|
+
dictionaryID,
|
|
4264
|
+
dictionaryItemID,
|
|
4250
4265
|
style: this.service.parseStylePayload(raw.style),
|
|
4251
4266
|
};
|
|
4252
4267
|
});
|
|
4253
4268
|
if (this.record.badges && Array.isArray(this.record.badges)) {
|
|
4254
4269
|
this.record.badges = this.record.badges.map((badge) => {
|
|
4255
4270
|
const raw = badge;
|
|
4256
|
-
const
|
|
4271
|
+
const dictionaryID = raw.dataDictionaryId || raw.dictionaryID || '';
|
|
4272
|
+
const dictionaryItemID = raw.dictionaryItemId || raw.dictionaryItemID || '';
|
|
4273
|
+
const { dataDictionaryId: _dd, dictionaryItemId: _di, ...rest } = raw;
|
|
4257
4274
|
return {
|
|
4258
4275
|
...rest,
|
|
4259
|
-
dictionaryID
|
|
4260
|
-
dictionaryItemID
|
|
4276
|
+
dictionaryID,
|
|
4277
|
+
dictionaryItemID,
|
|
4261
4278
|
style: this.service.parseStylePayload(raw.style),
|
|
4262
4279
|
};
|
|
4263
4280
|
});
|