adminforth 2.4.0-next.271 → 2.4.0-next.273
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/spa/src/utils.ts
CHANGED
|
@@ -478,4 +478,23 @@ export function checkShowIf(c: AdminForthResourceColumnInputCommon, record: Reco
|
|
|
478
478
|
};
|
|
479
479
|
|
|
480
480
|
return evaluatePredicate(c.showIf);
|
|
481
|
-
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
export function encodeQueryJSON(obj) {
|
|
485
|
+
return JSON.stringify(obj)
|
|
486
|
+
.replace(/{/g, '(')
|
|
487
|
+
.replace(/}/g, ')')
|
|
488
|
+
.replace(/\[/g, '<')
|
|
489
|
+
.replace(/]/g, '>')
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export function decodeQueryJSON(str) {
|
|
493
|
+
return JSON.parse(
|
|
494
|
+
str
|
|
495
|
+
.replace(/\(/g, '{')
|
|
496
|
+
.replace(/\)/g, '}')
|
|
497
|
+
.replace(/</g, '[')
|
|
498
|
+
.replace(/>/g, ']')
|
|
499
|
+
);
|
|
500
|
+
}
|
|
@@ -79,7 +79,7 @@ import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
|
|
|
79
79
|
import ResourceForm from '@/components/ResourceForm.vue';
|
|
80
80
|
import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
|
|
81
81
|
import { useCoreStore } from '@/stores/core';
|
|
82
|
-
import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions, initThreeDotsDropdown } from '@/utils';
|
|
82
|
+
import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions, initThreeDotsDropdown, decodeQueryJSON } from '@/utils';
|
|
83
83
|
import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
|
|
84
84
|
import { onMounted, ref, watch } from 'vue';
|
|
85
85
|
import { useRoute, useRouter } from 'vue-router';
|
|
@@ -125,11 +125,26 @@ onMounted(async () => {
|
|
|
125
125
|
}
|
|
126
126
|
return acc;
|
|
127
127
|
}, {});
|
|
128
|
+
let userUseMultipleEncoding = false; //TODO remove this in future versions
|
|
128
129
|
if (route.query.values) {
|
|
129
|
-
|
|
130
|
+
try {
|
|
131
|
+
JSON.parse((route.query.values as string));
|
|
132
|
+
} catch (e) {
|
|
133
|
+
userUseMultipleEncoding = true;
|
|
134
|
+
console.warn('You are using an outdated format for the query vales. Please update your links and don`t use multiple URL encoding.');
|
|
135
|
+
}
|
|
136
|
+
if (userUseMultipleEncoding) {
|
|
137
|
+
initialValues.value = { ...initialValues.value, ...JSON.parse(decodeURIComponent((route.query.values as string))) };
|
|
138
|
+
} else {
|
|
139
|
+
initialValues.value = { ...initialValues.value, ...JSON.parse(decodeQueryJSON(route.query.values as string)) };
|
|
140
|
+
}
|
|
130
141
|
}
|
|
131
142
|
if (route.query.readonlyColumns) {
|
|
132
|
-
|
|
143
|
+
if (userUseMultipleEncoding) {
|
|
144
|
+
readonlyColumns.value = JSON.parse(decodeURIComponent((route.query.readonlyColumns as string)));
|
|
145
|
+
} else {
|
|
146
|
+
readonlyColumns.value = JSON.parse(decodeQueryJSON(route.query.readonlyColumns as string));
|
|
147
|
+
}
|
|
133
148
|
}
|
|
134
149
|
record.value = initialValues.value;
|
|
135
150
|
loading.value = false;
|