adminforth 1.10.0-next.9 → 1.10.0
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.
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
|
|
272
272
|
import { computed, onMounted, ref, watch, type Ref } from 'vue';
|
|
273
273
|
import { callAdminForthApi } from '@/utils';
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
276
276
|
import { getCustomComponent } from '@/utils';
|
|
277
277
|
import { useCoreStore } from '@/stores/core';
|
|
@@ -293,7 +293,7 @@ import type { AdminForthResourceCommon } from '@/types/Common';
|
|
|
293
293
|
import adminforth from '@/adminforth';
|
|
294
294
|
|
|
295
295
|
const coreStore = useCoreStore();
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
const props = defineProps<{
|
|
298
298
|
page: number,
|
|
299
299
|
resource: AdminForthResourceCommon,
|
|
@@ -456,9 +456,9 @@ async function onClick(e,row) {
|
|
|
456
456
|
|
|
457
457
|
async function deleteRecord(row) {
|
|
458
458
|
const data = await adminforth.confirm({
|
|
459
|
-
message:
|
|
460
|
-
yes:
|
|
461
|
-
no:
|
|
459
|
+
message: 'Are you sure you want to delete this item?',
|
|
460
|
+
yes: 'Delete',
|
|
461
|
+
no: 'Cancel',
|
|
462
462
|
});
|
|
463
463
|
if (data) {
|
|
464
464
|
try {
|
|
@@ -472,13 +472,13 @@ async function deleteRecord(row) {
|
|
|
472
472
|
});
|
|
473
473
|
if (!res.error){
|
|
474
474
|
emits('update:records', true)
|
|
475
|
-
showSuccesTost(
|
|
475
|
+
showSuccesTost('Record deleted successfully')
|
|
476
476
|
} else {
|
|
477
477
|
showErrorTost(res.error)
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
} catch (e) {
|
|
481
|
-
showErrorTost(
|
|
481
|
+
showErrorTost(`Something went wrong, please try again later`);
|
|
482
482
|
console.error(e);
|
|
483
483
|
};
|
|
484
484
|
}
|
|
@@ -797,7 +797,7 @@ export interface AdminForthResourceColumnInputCommon {
|
|
|
797
797
|
*/
|
|
798
798
|
debounceTimeMs?: number,
|
|
799
799
|
/**
|
|
800
|
-
* If
|
|
800
|
+
* If true - will force EQ operator for filter instead of ILIKE.
|
|
801
801
|
*/
|
|
802
802
|
substringSearch?: boolean,
|
|
803
803
|
},
|
|
@@ -86,7 +86,7 @@ import { computed } from 'vue';
|
|
|
86
86
|
import { showErrorTost } from '@/composables/useFrontendApi';
|
|
87
87
|
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
88
88
|
import adminforth from '@/adminforth';
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
|
|
91
91
|
const isValid = ref(false);
|
|
92
92
|
const validating = ref(false);
|
|
@@ -101,8 +101,6 @@ const record = ref({});
|
|
|
101
101
|
|
|
102
102
|
const coreStore = useCoreStore();
|
|
103
103
|
|
|
104
|
-
const { t } = useI18n();
|
|
105
|
-
|
|
106
104
|
const initialValues = ref({});
|
|
107
105
|
|
|
108
106
|
|
|
@@ -116,14 +114,15 @@ onMounted(async () => {
|
|
|
116
114
|
await coreStore.fetchResourceFull({
|
|
117
115
|
resourceId: route.params.resourceId
|
|
118
116
|
});
|
|
119
|
-
initialValues.value = (coreStore.resource?.columns || []).reduce((acc, column) => {
|
|
120
|
-
if (column.suggestOnCreate !== undefined) {
|
|
121
|
-
acc[column.name] = column.suggestOnCreate;
|
|
122
|
-
}
|
|
123
|
-
return acc;
|
|
124
|
-
}, {});
|
|
125
117
|
if (route.query.values) {
|
|
126
|
-
initialValues.value =
|
|
118
|
+
initialValues.value = JSON.parse(decodeURIComponent(route.query.values));
|
|
119
|
+
} else {
|
|
120
|
+
initialValues.value = (coreStore.resource?.columns || []).reduce((acc, column) => {
|
|
121
|
+
if (column.suggestOnCreate !== undefined) {
|
|
122
|
+
acc[column.name] = column.suggestOnCreate;
|
|
123
|
+
}
|
|
124
|
+
return acc;
|
|
125
|
+
}, {});
|
|
127
126
|
}
|
|
128
127
|
record.value = initialValues.value;
|
|
129
128
|
loading.value = false;
|
|
@@ -163,7 +162,7 @@ async function saveRecord() {
|
|
|
163
162
|
}
|
|
164
163
|
});
|
|
165
164
|
adminforth.alert({
|
|
166
|
-
message:
|
|
165
|
+
message: 'Record created successfully',
|
|
167
166
|
variant: 'success'
|
|
168
167
|
});
|
|
169
168
|
}
|
|
@@ -120,12 +120,12 @@ import { showSuccesTost, showErrorTost } from '@/composables/useFrontendApi';
|
|
|
120
120
|
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
121
121
|
import ShowTable from '@/components/ShowTable.vue';
|
|
122
122
|
import adminforth from "@/adminforth";
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
|
|
125
125
|
const route = useRoute();
|
|
126
126
|
const router = useRouter();
|
|
127
127
|
const loading = ref(true);
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
const coreStore = useCoreStore();
|
|
130
130
|
|
|
131
131
|
onMounted(async () => {
|
|
@@ -179,9 +179,9 @@ const otherColumns = computed(() => {
|
|
|
179
179
|
|
|
180
180
|
async function deleteRecord(row) {
|
|
181
181
|
const data = await adminforth.confirm({
|
|
182
|
-
message:
|
|
183
|
-
yes:
|
|
184
|
-
no:
|
|
182
|
+
message: 'Are you sure you want to delete this item?',
|
|
183
|
+
yes: 'Delete',
|
|
184
|
+
no: 'Cancel',
|
|
185
185
|
});
|
|
186
186
|
if (data) {
|
|
187
187
|
try {
|
|
@@ -194,7 +194,7 @@ async function deleteRecord(row) {
|
|
|
194
194
|
}});
|
|
195
195
|
if (!res.error){
|
|
196
196
|
router.push({ name: 'resource-list', params: { resourceId: route.params.resourceId } });
|
|
197
|
-
showSuccesTost(
|
|
197
|
+
showSuccesTost('Record deleted successfully')
|
|
198
198
|
} else {
|
|
199
199
|
showErrorTost(res.error)
|
|
200
200
|
}
|
package/dist/types/Common.d.ts
CHANGED
|
@@ -707,7 +707,7 @@ export interface AdminForthResourceColumnInputCommon {
|
|
|
707
707
|
*/
|
|
708
708
|
debounceTimeMs?: number;
|
|
709
709
|
/**
|
|
710
|
-
* If
|
|
710
|
+
* If true - will force EQ operator for filter instead of ILIKE.
|
|
711
711
|
*/
|
|
712
712
|
substringSearch?: boolean;
|
|
713
713
|
};
|