adminforth 1.13.0-next.26 → 1.13.0-next.28
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import AdminForth, { AdminForthDataTypes, AdminForthResourceInput } from 'adminforth';
|
|
1
|
+
import AdminForth, { AdminForthDataTypes, AdminForthResourceInput, AdminForthResource, AdminUser } from 'adminforth';
|
|
2
|
+
|
|
2
3
|
import type { AdminUser } from 'adminforth';
|
|
3
4
|
|
|
4
5
|
async function canModifyUsers({ adminUser }: { adminUser: AdminUser }): Promise<boolean> {
|
|
@@ -86,18 +87,19 @@ export default {
|
|
|
86
87
|
],
|
|
87
88
|
hooks: {
|
|
88
89
|
create: {
|
|
89
|
-
beforeSave: async ({ record, adminUser, resource }) => {
|
|
90
|
-
record.
|
|
90
|
+
beforeSave: async ({ record, adminUser, resource }: { record: any, adminUser: AdminUser, resource: AdminForthResource }) => {
|
|
91
|
+
record.passwordHash = await AdminForth.Utils.generatePasswordHash(record.password);
|
|
91
92
|
return { ok: true };
|
|
92
93
|
}
|
|
93
94
|
},
|
|
94
95
|
edit: {
|
|
95
|
-
beforeSave: async ({
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
beforeSave: async ({ updates, adminUser, resource }: { updates: any, adminUser: AdminUser, resource: AdminForthResource }) => {
|
|
97
|
+
console.log('Updating user', updates);
|
|
98
|
+
if (updates.password) {
|
|
99
|
+
updates.passwordHash = await AdminForth.Utils.generatePasswordHash(updates.password);
|
|
98
100
|
}
|
|
99
101
|
return { ok: true }
|
|
100
102
|
},
|
|
101
103
|
},
|
|
102
|
-
}
|
|
104
|
+
},
|
|
103
105
|
} as AdminForthResourceInput;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<div class="flex items-center">
|
|
22
22
|
<input id="checkbox-all-search" type="checkbox" :checked="allFromThisPageChecked" @change="selectAll()"
|
|
23
23
|
:disabled="!rows || !rows.length"
|
|
24
|
-
class="w-4 h-4
|
|
24
|
+
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded
|
|
25
25
|
focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
|
|
26
26
|
<label for="checkbox-all-search" class="sr-only">{{ $t('checkbox') }}</label>
|
|
27
27
|
</div>
|
|
@@ -416,7 +416,7 @@ async function selectAll(value) {
|
|
|
416
416
|
const totalPages = computed(() => Math.ceil(props.totalRows / props.pageSize));
|
|
417
417
|
|
|
418
418
|
const allFromThisPageChecked = computed(() => {
|
|
419
|
-
if (!props.rows) return false;
|
|
419
|
+
if (!props.rows || !props.rows.length) return false;
|
|
420
420
|
return props.rows.every((r) => checkboxesInternal.value.includes(r._primaryKeyValue));
|
|
421
421
|
});
|
|
422
422
|
const ascArr = computed(() => sort.value.filter((s) => s.direction === 'asc').map((s) => s.field));
|
|
@@ -572,4 +572,13 @@ async function startCustomAction(actionId, row) {
|
|
|
572
572
|
}
|
|
573
573
|
|
|
574
574
|
|
|
575
|
-
</script>
|
|
575
|
+
</script>
|
|
576
|
+
|
|
577
|
+
<style lang="scss" scoped>
|
|
578
|
+
input[type="checkbox"][disabled] {
|
|
579
|
+
@apply opacity-50;
|
|
580
|
+
}
|
|
581
|
+
input[type="checkbox"]:not([disabled]) {
|
|
582
|
+
@apply cursor-pointer;
|
|
583
|
+
}
|
|
584
|
+
</style>
|