Skip to content

Commit b67ce4a

Browse files
authored
Merge pull request #1788 from ProcessMaker/bugfix/FOUR-21691
FOUR-21691:The values set by calcs in a select list(drop-down) lost after refresh the page
2 parents dedd16f + 1c3fc0c commit b67ce4a

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

src/components/inspector/options-list.vue

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

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)