From 783a91b78a92c00adf3bdb50764ef8cbdecb68cc Mon Sep 17 00:00:00 2001
From: Joe <104938042+lrljoe@users.noreply.github.com>
Date: Sat, 5 Oct 2024 03:01:01 +0100
Subject: [PATCH] Table Caption - Initial Commit
---
resources/views/components/table.blade.php | 1 +
.../TableCaptionConfiguration.php | 14 ++++++++++++++
src/Traits/Features/HasTableCaption.php | 14 ++++++++++++++
.../Features/Helpers/TableCaptionHelpers.php | 19 +++++++++++++++++++
src/Traits/HasAllTraits.php | 3 +++
5 files changed, 51 insertions(+)
create mode 100644 src/Traits/Features/Configuration/TableCaptionConfiguration.php
create mode 100644 src/Traits/Features/HasTableCaption.php
create mode 100644 src/Traits/Features/Helpers/TableCaptionHelpers.php
diff --git a/resources/views/components/table.blade.php b/resources/views/components/table.blade.php
index 297548694..af2babef8 100644
--- a/resources/views/components/table.blade.php
+++ b/resources/views/components/table.blade.php
@@ -23,6 +23,7 @@
->except(['default','default-styling','default-colors']) }}
>
+ @if($this->hasTableCaptionMessage())
{{ $this->getTableCaptionMessage() }} @endif
merge($customAttributes['thead'])
->class(['bg-gray-50 dark:bg-gray-800' => $customAttributes['thead']['default'] ?? true])
diff --git a/src/Traits/Features/Configuration/TableCaptionConfiguration.php b/src/Traits/Features/Configuration/TableCaptionConfiguration.php
new file mode 100644
index 000000000..940623c2d
--- /dev/null
+++ b/src/Traits/Features/Configuration/TableCaptionConfiguration.php
@@ -0,0 +1,14 @@
+tableCaptionMessage = $tableCaptionMessage;
+
+ return $this;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Traits/Features/HasTableCaption.php b/src/Traits/Features/HasTableCaption.php
new file mode 100644
index 000000000..bb6ef821d
--- /dev/null
+++ b/src/Traits/Features/HasTableCaption.php
@@ -0,0 +1,14 @@
+tableCaptionMessage);
+ }
+
+ #[Computed]
+ public function getTableCaptionMessage(): string
+ {
+ return $this->hasTableCaptionMessage() ? $this->tableCaptionMessage : '';
+ }
+}
\ No newline at end of file
diff --git a/src/Traits/HasAllTraits.php b/src/Traits/HasAllTraits.php
index 70ddd3eb5..c6504cf88 100644
--- a/src/Traits/HasAllTraits.php
+++ b/src/Traits/HasAllTraits.php
@@ -4,6 +4,7 @@
use Rappasoft\LaravelLivewireTables\Traits\Core\HasCustomAttributes;
use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasTheme;
+use Rappasoft\LaravelLivewireTables\Traits\Features\{HasTableCaption};
trait HasAllTraits
{
@@ -35,4 +36,6 @@ trait HasAllTraits
WithSessionStorage,
WithTableAttributes,
WithTools;
+
+ use HasTableCaption;
}