Skip to content

Commit fe6d157

Browse files
authored
fix: change disabled select all records checkbox appearance (#150)
1 parent 0b0570c commit fe6d157

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

adminforth/spa/src/components/ResourceListTable.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="flex items-center">
2222
<input id="checkbox-all-search" type="checkbox" :checked="allFromThisPageChecked" @change="selectAll()"
2323
:disabled="!rows || !rows.length"
24-
class="w-4 h-4 cursor-pointer text-blue-600 bg-gray-100 border-gray-300 rounded
24+
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded
2525
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">
2626
<label for="checkbox-all-search" class="sr-only">{{ $t('checkbox') }}</label>
2727
</div>
@@ -416,7 +416,7 @@ async function selectAll(value) {
416416
const totalPages = computed(() => Math.ceil(props.totalRows / props.pageSize));
417417
418418
const allFromThisPageChecked = computed(() => {
419-
if (!props.rows) return false;
419+
if (!props.rows || !props.rows.length) return false;
420420
return props.rows.every((r) => checkboxesInternal.value.includes(r._primaryKeyValue));
421421
});
422422
const ascArr = computed(() => sort.value.filter((s) => s.direction === 'asc').map((s) => s.field));
@@ -572,4 +572,13 @@ async function startCustomAction(actionId, row) {
572572
}
573573
574574
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>

dev-demo/resources/apartments.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,9 @@ export default {
223223
{
224224
name: "room_sizes",
225225
type: AdminForthDataTypes.JSON,
226-
// isArray: {
227-
// enabled: true,
228-
// itemType: AdminForthDataTypes.FLOAT,
229-
// },
230226
isArray: {
231227
enabled: true,
232-
itemType: AdminForthDataTypes.STRING,
233-
},
234-
foreignResource: {
235-
resourceId: "users",
228+
itemType: AdminForthDataTypes.FLOAT,
236229
},
237230
},
238231
{

0 commit comments

Comments
 (0)