Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions resources/css/elements/tables.css
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,41 @@
}
}

.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"],
th[data-column="datestamp"] {
@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');
Expand Down
22 changes: 8 additions & 14 deletions resources/js/components/entries/CollectionWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down Expand Up @@ -72,8 +66,8 @@ function formatDate(value) {
{{ __('There are no entries in this collection') }}
</ui-description>
<div class="px-4 py-3">
<table class="w-full [&_td]:p-0.75 [&_td]:text-sm" :class="{ 'opacity-50': loading }">
<TableHead sr-only />
<table class="w-full widget-table" :class="{ 'opacity-50': loading }">
<TableHead :sr-only="!props.showTableHeader" />
<TableBody>
<template #cell-title="{ row: entry, isColumnVisible }">
<div class="flex items-center gap-2">
Expand All @@ -85,7 +79,7 @@ function formatDate(value) {
</template>
<template #cell-date="{ row: entry, isColumnVisible }">
<div
class="text-end font-mono text-xs whitespace-nowrap text-gray-500 antialiased px-2"
class="text-end font-inter tabular-nums text-xs whitespace-nowrap text-gray-600 dark:text-gray-400 antialiased px-2"
v-text="formatDate(entry.date.date)"
v-if="isColumnVisible('date')"
/>
Expand Down
7 changes: 4 additions & 3 deletions resources/js/components/forms/FormWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const props = defineProps({
title: { type: String },
submissionsUrl: { type: String },
initialPerPage: { type: Number, default: 5 },
showTableHeader: { type: Boolean, default: false },
});

const requestUrl = cp_url(`forms/${props.form}/submissions`);
Expand Down Expand Up @@ -61,8 +62,8 @@ function formatDate(value) {
{{ __('This form is awaiting responses') }}
</ui-description>
<div class="px-4 py-3">
<table class="w-full [&_td]:p-0.5 [&_td]:text-sm">
<TableHead sr-only />
<table class="w-full widget-table">
<TableHead :sr-only="!props.showTableHeader" />
<TableBody>
<template v-for="field in fields" #[`cell-${field}`]="{ row: submission }">
<a
Expand All @@ -74,7 +75,7 @@ function formatDate(value) {
</template>
<template #cell-datestamp="{ row: submission }">
<div
class="text-end font-mono text-xs whitespace-nowrap text-gray-500 antialiased"
class="text-end font-inter tabular-nums text-xs whitespace-nowrap text-gray-600 dark:text-gray-400 antialiased"
v-text="formatDate(submission.datestamp)"
/>
</template>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/ui/Listing/TableHead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const hasVisibleHeader = computed(() => {
>
<ToggleAll v-if="allowsSelections && allowsMultipleSelections" />
</th>
<HeaderCell v-for="column in visibleColumns" :key="column.field" :column />
<HeaderCell v-for="column in visibleColumns" :key="column.field" :column :data-column="column.field" />
<!-- <th class="type-column" v-if="type">
<template v-if="type === 'entries'">{{ __('Collection') }}</template>
<template v-if="type === 'terms'">{{ __('Taxonomy') }}</template>
Expand Down
1 change: 1 addition & 0 deletions src/Forms/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function component()
'form' => $form->handle(),
'fields' => $this->config('fields', []),
'title' => $this->config('title', $form->title()),
'showTableHeader' => $this->config('show_table_header', false),
'submissionsUrl' => cp_route('forms.show', $form->handle()),
'initialPerPage' => $this->config('limit', 5),
]);
Expand Down
1 change: 1 addition & 0 deletions src/Widgets/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function component()
'collection' => $collection->handle(),
'icon' => $collection->icon(),
'title' => $this->config('title', $collection->title()),
'showTableHeader' => $this->config('show_table_header', false),
'additionalColumns' => $columns,
'filters' => Scope::filters('entries', [
'collection' => $collection->handle(),
Expand Down