From d32b2dafccc182bcb3d9340fde2283aeda1c8391 Mon Sep 17 00:00:00 2001 From: Jack McDade Date: Mon, 2 Mar 2026 23:55:15 -0500 Subject: [PATCH 1/2] Add option to show widget table headers Closes #14120 --- resources/css/elements/tables.css | 34 +++++++++++++++++++ .../components/entries/CollectionWidget.vue | 22 +++++------- resources/js/components/forms/FormWidget.vue | 7 ++-- .../js/components/ui/Listing/TableHead.vue | 2 +- src/Forms/Widget.php | 1 + src/Widgets/Collection.php | 1 + 6 files changed, 49 insertions(+), 18 deletions(-) diff --git a/resources/css/elements/tables.css b/resources/css/elements/tables.css index e944ae4ef22..fe9de417afe 100644 --- a/resources/css/elements/tables.css +++ b/resources/css/elements/tables.css @@ -163,6 +163,40 @@ } } +.widget-table { + @apply w-full max-w-full outline-hidden min-w-full overflow-x-auto text-start; + + thead { + th { + @apply text-sm font-medium text-start; + @apply p-0.75; + } + + th[data-column="date"] { + @apply text-end; + } + } + + tbody { + @apply text-sm; + + tr { + td { + @apply p-0.75 text-sm; + } + + } + + .type-column { + @apply text-end; + } + } + + .date-index-field { + @apply whitespace-nowrap; + } +} + .table-drag-handle { @apply h-full cursor-grab hover:bg-gray-100 dark:hover:bg-gray-700 dark:opacity-75; background-image: url('../../svg/drag-dots.svg'); diff --git a/resources/js/components/entries/CollectionWidget.vue b/resources/js/components/entries/CollectionWidget.vue index cfb229a6af7..c71793eadfa 100644 --- a/resources/js/components/entries/CollectionWidget.vue +++ b/resources/js/components/entries/CollectionWidget.vue @@ -15,22 +15,16 @@ import { Link } from '@inertiajs/vue3'; const props = defineProps({ additionalColumns: Array, collection: String, - icon: String, + icon: String, title: String, listingUrl: String, - initialPerPage: { - type: Number, - default: 5, - }, - initialSortColumn: { - type: String, - }, - initialSortDirection: { - type: String, - }, + initialPerPage: { type: Number, default: 5 }, + initialSortColumn: { type: String }, + initialSortDirection: { type: String }, canCreate: Boolean, createLabel: String, blueprints: Array, + showTableHeader: { type: Boolean, default: false }, }); const requestUrl = cp_url(`collections/${props.collection}/entries`); @@ -72,8 +66,8 @@ function formatDate(value) { {{ __('There are no entries in this collection') }}
- - +
+