diff --git a/src/components/inspector/collection-data-source.vue b/src/components/inspector/collection-data-source.vue
index 8b2e4c857..bc08411fd 100644
--- a/src/components/inspector/collection-data-source.vue
+++ b/src/components/inspector/collection-data-source.vue
@@ -57,13 +57,6 @@
-
-
-
-
diff --git a/src/components/renderer/form-record-list.vue b/src/components/renderer/form-record-list.vue
index a5af67299..2b230880a 100644
--- a/src/components/renderer/form-record-list.vue
+++ b/src/components/renderer/form-record-list.vue
@@ -33,21 +33,35 @@
:current-page="currentPage"
data-cy="table"
>
-
+
+
+
+
-
-
-
-
-
+
-
+ :value="item"
+ @change="onMultipleSelectionChange(index)"
+ />
+
+
+
+
+
+
+
+
{{
mustache(field.key, item)
@@ -261,10 +275,16 @@ export default {
currentRowIndex: null,
collectionData: {},
selectedRow: null,
- selectedRows: []
+ selectedRows: [],
+ selectedIndex: null,
+ rows: [],
+ selectAll: false
};
},
computed: {
+ indeterminate() {
+ return this.selectedRows.length > 0 && this.selectedRows.length < this.tableData.data.length;
+ },
popupConfig() {
const config = [];
config[this.form] = this.formConfig[this.form];
@@ -302,6 +322,10 @@ export default {
? this.collectionData
: (Array.isArray(this.value) ? this.value : []);
+ if(this.value) {
+ this.selectedIndex = this.value.selectedRowIndex;
+ }
+
const from = this.paginatorPage - 1;
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
this.lastPage = Math.ceil(value.length / this.perPage);
@@ -318,8 +342,23 @@ export default {
data: value,
lastSortConfig: false
};
- return data;
-
+
+ // Enable Radio button selected when process finishes
+ if (this.selectedIndex !== null && this.selectedIndex < data.data.length) {
+ this.selectedRow = data.data[this.selectedIndex];
+ }
+
+ //Enable Checkbox selected when process finishes
+ if (Array.isArray(this.value) && this.value.length > 0) {
+ if(this.rows.length === 0) {
+ this.value.forEach(item => {
+ if (item.hasOwnProperty('selectedRowsIndex')) {
+ this.selectedRows.push(data.data[item.selectedRowsIndex]);
+ }
+ });
+ }
+ }
+ return data;
},
// The fields used for our vue table
tableFields() {
@@ -342,7 +381,7 @@ export default {
fields.unshift({
key: 'checkbox',
label: '',
- sortable: false,
+ sortable: false
});
}
@@ -384,19 +423,56 @@ export default {
this.$root.$emit("record-list-option", this.source?.sourceOptions);
},
methods: {
+ selectAllRows() {
+ if (this.allRowsSelected) {
+ const updatedRows = this.tableData.data.map((item, index) => {
+ return {
+ ...item,
+ selectedRowsIndex: index
+ };
+ });
+
+ this.selectedRows = updatedRows;
+ this.collectionData = updatedRows;
+ this.onMultipleSelectionChange();
+ } else {
+ this.selectedRows = [];
+ this.onMultipleSelectionChange();
+ }
+ },
componentOutput(data) {
this.$emit('input', data);
},
- onRadioChange(selectedItem) {
+ onRadioChange(selectedItem, index) {
+ const globalIndex = (this.currentPage - 1) * this.perPage + index;
if(this.source?.singleField) {
- const valueOfColumn = selectedItem[this.source.singleField];
+ let valueOfColumn = selectedItem[this.source.singleField];
this.componentOutput(valueOfColumn);
} else {
+ selectedItem = { ...selectedItem, selectedRowIndex: globalIndex};
this.componentOutput(selectedItem);
}
},
- onMultipleSelectionChange() {
+ onMultipleSelectionChange(selIndex) {
+ this.collectionData.forEach((item, index) => {
+ this.selectedRows.forEach((selectedItem) => {
+ // Compares both objects all keys and values
+ if (this.areObjectsEqual(selectedItem, item)) {
+ // Adds`selectedRowIndex` with index iteration
+ selectedItem.selectedRowsIndex = index;
+ }
+ });
+ });
this.componentOutput(this.selectedRows);
+ this.rows.push(selIndex);
+ },
+ areObjectsEqual(obj1, obj2) {
+ const keys1 = Object.keys(obj1);
+ const keys2 = Object.keys(obj2);
+
+ if (keys1.length !== keys2.length) return false;
+
+ return keys1.every(key => obj1[key] === obj2[key]);
},
onCollectionChange(collectionId,pmql) {
let param = {params:{pmql:pmql}};