From a83fe561b9007740c7106e83ee63f0bf26cd97a8 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 22 Jul 2026 09:18:23 +0200 Subject: [PATCH] Added the new property "readonly" to the UDF component to switch between edit and readonly mode for all the UDfs --- public/js/components/Udf/Udf.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/public/js/components/Udf/Udf.js b/public/js/components/Udf/Udf.js index c765d8a14..007eea236 100644 --- a/public/js/components/Udf/Udf.js +++ b/public/js/components/Udf/Udf.js @@ -26,7 +26,8 @@ export default { // The values as associative array modelValue: Object, // Show only fields with a name that exists in the filter - filter: [String, Array] + filter: [String, Array], + readonly: true }, data() { return { @@ -35,6 +36,13 @@ export default { }; }, computed: { + isPkValid() { + // If the provided pk is _not_ valid + return !Object.keys(this.pk).every(key => !this.pk[key]); + }, + getReadonly() { + return this.readonly; + }, filterArray() { if (!this.filter || Array.isArray(this.filter)) return this.filter; @@ -61,6 +69,10 @@ export default { }, watch: { pk(n, o) { + + // If the provided pk is _not_ valid + if (Object.keys(n).every(key => !n[key])) return; + if (!this.$refs.fetch) return; // NOTE(chris): no initial load yet @@ -124,6 +136,7 @@ export default { template: `
` -} \ No newline at end of file +}