From d86d1d0bc76132d652e05036f3f970e253e405c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Agust=C3=ADn=20Busso?=
<90727999+agustinbusso@users.noreply.github.com>
Date: Tue, 5 Nov 2024 09:20:36 -0300
Subject: [PATCH] Add aria label field to select list inspector
---
.../inspector/collection-select-list.vue | 13 ++++++++
src/components/inspector/options-list.vue | 30 +++++++++++++++++--
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/src/components/inspector/collection-select-list.vue b/src/components/inspector/collection-select-list.vue
index a28fec7a4..68b9fd346 100644
--- a/src/components/inspector/collection-select-list.vue
+++ b/src/components/inspector/collection-select-list.vue
@@ -31,6 +31,16 @@
/>
+
+ {{ $t("Aria Label") }}
+
+
+
{
diff --git a/src/components/inspector/options-list.vue b/src/components/inspector/options-list.vue
index bc10a60c6..6bfd996ec 100644
--- a/src/components/inspector/options-list.vue
+++ b/src/components/inspector/options-list.vue
@@ -28,6 +28,9 @@
{{ $t('Content') }}
+
+ {{ $t('Aria Label') }}
+
{{ $t('Content') }}
+
+ {{ $t('Aria Label') }}
+
{{ $t('Variable Data Property') }}
{{ $t('Enter the property name from the Request data variable that will be passed as the value when selected.') }}
+
+ {{ $t('Aria Label') }}
+
+ {{ $t('Enter the property name for the aria label from the Request data variable.') }}
@@ -287,6 +302,7 @@ export default {
removeIndex: null,
optionValue: '',
optionContent: '',
+ optionAriaLabel: '',
showRenderAs: false,
renderAs: 'dropdown',
allowMultiSelect: false,
@@ -413,6 +429,9 @@ export default {
valueField() {
return this.value || 'content';
},
+ ariaLabelField() {
+ return this.optionAriaLabel || 'ariaLabel';
+ },
currentItemToDelete() {
if (this.removeIndex !== null
&& this.optionsList.length > 0
@@ -450,6 +469,7 @@ export default {
editIndex: this.editIndex,
removeIndex: this.removeIndex,
valueTypeReturned: this.valueTypeReturned,
+ optionAriaLabel: this.optionAriaLabel,
};
},
},
@@ -467,6 +487,7 @@ export default {
this.selectedEndPoint = this.options.selectedEndPoint,
this.key = this.options.key;
this.value = this.options.value;
+ this.optionAriaLabel = this.options.optionAriaLabel;
this.pmqlQuery = this.options.pmqlQuery;
this.defaultOptionKey= this.options.defaultOptionKey;
this.selectedOptions = this.options.selectedOptions;
@@ -530,8 +551,9 @@ export default {
const that = this;
jsonList.forEach (item => {
that.optionsList.push({
- [that.keyField] : item[that.keyField],
- [that.valueField] : item[that.valueField],
+ [that.keyField]: item[that.keyField],
+ [that.valueField]: item[that.valueField],
+ [that.ariaLabelField]: item[that.ariaLabelField]
});
});
this.jsonError = '';
@@ -560,12 +582,14 @@ export default {
this.editIndex = index;
this.optionContent = this.optionsList[index][this.valueField];
this.optionValue = this.optionsList[index][this.keyField];
+ this.optionAriaLabel = this.optionsList[index][this.ariaLabelField];
this.optionError = '';
},
showAddOption() {
this.optionCardType = 'insert';
this.optionContent = '';
this.optionValue = '';
+ this.optionAriaLabel = '';
this.showOptionCard = true;
this.optionError = '';
this.editIndex = null;
@@ -582,6 +606,7 @@ export default {
{
[this.valueField]: this.optionContent,
[this.keyField]: this.optionValue,
+ [this.ariaLabelField]: this.optionAriaLabel,
}
);
}
@@ -592,6 +617,7 @@ export default {
}
this.optionsList[this.editIndex][this.keyField] = this.optionValue;
this.optionsList[this.editIndex][this.valueField] = this.optionContent;
+ this.optionsList[this.editIndex][this.ariaLabelField] = this.optionAriaLabel;
}
this.jsonData = JSON.stringify(this.optionsList);