cat-qw-lib 0.41.25 → 0.41.27
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
|
@@ -1262,6 +1262,8 @@ class BaseFormComponent {
|
|
|
1262
1262
|
this.service.getById(id).subscribe((res) => {
|
|
1263
1263
|
// To make the object immutable
|
|
1264
1264
|
this.record = JSON.parse(JSON.stringify(res));
|
|
1265
|
+
console.log('rttte9');
|
|
1266
|
+
console.log(this.record);
|
|
1265
1267
|
this.baseStore?.setRecordChange(res);
|
|
1266
1268
|
this.recordChange.next(res);
|
|
1267
1269
|
});
|
|
@@ -3252,7 +3254,14 @@ class AdminActionFormComponent extends BaseFormComponent {
|
|
|
3252
3254
|
.subscribe({
|
|
3253
3255
|
next: (res) => {
|
|
3254
3256
|
if (res) {
|
|
3255
|
-
|
|
3257
|
+
if (typeof res !== SHARED.STRING) {
|
|
3258
|
+
this.record.formFields = JSON.stringify(res);
|
|
3259
|
+
console.log(this.record.formFields);
|
|
3260
|
+
}
|
|
3261
|
+
else {
|
|
3262
|
+
this.record.formFields = res;
|
|
3263
|
+
}
|
|
3264
|
+
console.log(this.record.formFields);
|
|
3256
3265
|
this.messages = [{ severity: SHARED.SUCCESS, detail: MESSAGE.VALIDATE_ACTION_SUCCESS_MESSAGE }];
|
|
3257
3266
|
setTimeout(() => {
|
|
3258
3267
|
this.messages = SHARED.EMPTYARRAY;
|
|
@@ -3279,12 +3288,22 @@ class AdminActionFormComponent extends BaseFormComponent {
|
|
|
3279
3288
|
handleSubmit() {
|
|
3280
3289
|
console.log(SHARED.STRING);
|
|
3281
3290
|
console.log(this.record.formFields);
|
|
3282
|
-
if (typeof this.record.formFields !== SHARED.STRING) {
|
|
3291
|
+
if (typeof this.record.formFields !== SHARED.STRING || !this.isValidJSONArray(this.record.formFields)) {
|
|
3292
|
+
console.log('Stringifying because it’s not a string or not a valid JSON array');
|
|
3283
3293
|
this.record.formFields = JSON.stringify(this.record.formFields);
|
|
3284
3294
|
}
|
|
3285
3295
|
console.log(this.record.formFields);
|
|
3286
3296
|
super.handleSubmit();
|
|
3287
3297
|
}
|
|
3298
|
+
isValidJSONArray(value) {
|
|
3299
|
+
try {
|
|
3300
|
+
const parsed = JSON.parse(value);
|
|
3301
|
+
return Array.isArray(parsed);
|
|
3302
|
+
}
|
|
3303
|
+
catch (e) {
|
|
3304
|
+
return false;
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3288
3307
|
ngOnDestroy() {
|
|
3289
3308
|
this.record = {};
|
|
3290
3309
|
super.ngOnDestroy();
|