Skip to content

Commit 2003cd1

Browse files
authored
Merge branch 'release-2025-winter' into bugfix/FOUR-21710
2 parents f8d3f0f + b67ce4a commit 2003cd1

File tree

3 files changed

+38
-22
lines changed

3 files changed

+38
-22
lines changed

src/components/inspector/options-list.vue

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export default {
430430
return this.value || 'content';
431431
},
432432
ariaLabelField() {
433-
return this.optionAriaLabel || 'ariaLabel';
433+
return this.ariaLabel || 'ariaLabel';
434434
},
435435
currentItemToDelete() {
436436
if (this.removeIndex !== null
@@ -487,7 +487,7 @@ export default {
487487
this.selectedEndPoint = this.options.selectedEndPoint,
488488
this.key = this.options.key;
489489
this.value = this.options.value;
490-
this.optionAriaLabel = this.options.optionAriaLabel;
490+
this.optionAriaLabel = this.options.ariaLabel;
491491
this.pmqlQuery = this.options.pmqlQuery;
492492
this.defaultOptionKey= this.options.defaultOptionKey;
493493
this.selectedOptions = this.options.selectedOptions;
@@ -549,12 +549,19 @@ export default {
549549
}
550550
this.optionsList = [];
551551
const that = this;
552-
jsonList.forEach (item => {
553-
that.optionsList.push({
554-
[that.keyField]: item[that.keyField],
555-
[that.valueField]: item[that.valueField],
556-
[that.ariaLabelField]: item[that.ariaLabelField]
557-
});
552+
jsonList.forEach((item) => {
553+
if (that.renderAs === "checkbox") {
554+
that.optionsList.push({
555+
[that.keyField]: item[that.keyField],
556+
[that.valueField]: item[that.valueField],
557+
[that.ariaLabelField]: item[that.ariaLabelField]
558+
});
559+
} else {
560+
that.optionsList.push({
561+
[that.keyField]: item[that.keyField],
562+
[that.valueField]: item[that.valueField]
563+
});
564+
}
558565
});
559566
this.jsonError = '';
560567
},
@@ -582,7 +589,9 @@ export default {
582589
this.editIndex = index;
583590
this.optionContent = this.optionsList[index][this.valueField];
584591
this.optionValue = this.optionsList[index][this.keyField];
585-
this.optionAriaLabel = this.optionsList[index][this.ariaLabelField];
592+
if (this.renderAs === "checkbox") {
593+
this.optionAriaLabel = this.optionsList[index][this.ariaLabelField];
594+
}
586595
this.optionError = '';
587596
},
588597
showAddOption() {
@@ -602,22 +611,28 @@ export default {
602611
this.optionError = 'An item with the same key already exists';
603612
return;
604613
}
605-
this.optionsList.push(
606-
{
614+
if (this.renderAs === "checkbox") {
615+
this.optionsList.push({
607616
[this.valueField]: this.optionContent,
608617
[this.keyField]: this.optionValue,
609-
[this.ariaLabelField]: this.optionAriaLabel,
610-
}
611-
);
612-
}
613-
else {
618+
[this.ariaLabelField]: this.optionAriaLabel
619+
});
620+
} else {
621+
this.optionsList.push({
622+
[this.valueField]: this.optionContent,
623+
[this.keyField]: this.optionValue
624+
});
625+
}
626+
} else {
614627
if (this.optionsList.find((item, index) => { return item[that.keyField] === this.optionValue && index !== this.editIndex ; })) {
615628
this.optionError = 'An item with the same key already exists';
616629
return;
617630
}
618631
this.optionsList[this.editIndex][this.keyField] = this.optionValue;
619632
this.optionsList[this.editIndex][this.valueField] = this.optionContent;
620-
this.optionsList[this.editIndex][this.ariaLabelField] = this.optionAriaLabel;
633+
if (this.renderAs === "checkbox") {
634+
this.optionsList[this.editIndex][this.ariaLabelField] = this.optionAriaLabel;
635+
}
621636
}
622637
623638
this.jsonData = JSON.stringify(this.optionsList);

src/form-builder-controls.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export default [
224224
optionsList: [],
225225
key:'value',
226226
value:'content',
227+
ariaLabel: 'ariaLabel',
227228
valueTypeReturned: 'single',
228229
},
229230
helper: null,

tests/e2e/specs/FormSelectList.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,23 +348,23 @@ describe("Form Select List", () => {
348348
cy.get("[data-cy=inspector-edit-json]").click();
349349

350350
cy.assertComponentValueAsJson('[data-cy="inspector-monaco-json"]', [
351-
{ content: "one", value: "one", ariaLabel: "" }
351+
{ content: "one", value: "one" }
352352
]);
353353

354354
cy.setVueComponentValue(
355355
'[data-cy="inspector-monaco-json"]',
356356
JSON.stringify([
357-
{ content: "one", value: "one", ariaLabel: "" },
358-
{ content: "two", value: "two", ariaLabel: "" }
357+
{ content: "one", value: "one" },
358+
{ content: "two", value: "two" }
359359
])
360360
);
361361
cy.get("[data-cy=inspector-monaco-json-expand]").click();
362362
cy.setVueComponentValue(
363363
'[data-cy="inspector-monaco-json-expanded"]',
364364
JSON.stringify(
365365
[
366-
{ content: "one", value: "one", ariaLabel: "" },
367-
{ content: "two", value: "two", ariaLabel: "" }
366+
{ content: "one", value: "one" },
367+
{ content: "two", value: "two" }
368368
],
369369
null,
370370
2

0 commit comments

Comments
 (0)