add onegabes-better-options for inhaltselement

This commit is contained in:
salam committed 2026-05-20 10:14:13 +02:00
1 parent 79ccecf579
commit 30aad69d02
10 files changed
+395 -33

No files matched your search

@@ -8,8 +8,10 @@ use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use ToneGabes\BetterOptions\Forms\Components\RadioCards;
class InhaltsverzeichnisTable
{
@@ -46,22 +48,50 @@ class InhaltsverzeichnisTable
->getStateUsing(fn ($record): string => $record->seite == 0 ? '' : $record->seite),
])
// ->paginated(false)
->defaultPaginationPageOption(5)
->persistFiltersInSession()
->deferFilters(false)
->filtersFormColumns(3)
->filtersFormColumns(1)
->defaultPaginationPageOption(50)
->filters([
SelectFilter::make('part')
->selectablePlaceholder(false)
->default('standard')
->label('Gutachten Komponenten')
->options([
'standard' => 'Gutachten Standard Texte',
'nutzwerte' => 'Nutzwerberechnung',
'paragraph' => 'Auszug Gutachten gem. §6',
]),
])
// ], layout: FiltersLayout::AboveContent)
Filter::make('filters')
->schema([
RadioCards::make('part')
->columns(3)
->iconAfter()
->default('standard')
->indicatorBefore()
->hiddenIcon()
->hiddenLabel()
->options([
'standard' => 'Gutachten Standard',
'nutzwerte' => 'Nutzwertberechnung',
'paragraph' => 'Auszug Gutachten',
])
->idleIndicator('phosphor-circle')
->selectedIndicator('phosphor-circle-fill')
->descriptions([
'standard' => 'Inhaltsangabe, Texte',
'nutzwerte' => 'Tabellen',
'paragraph' => 'Gemäß Paragraph §6',
]),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['part'],
fn (Builder $query, $part): Builder => $query->where('part', $part),
);
}),
// SelectFilter::make('part')
// ->selectablePlaceholder(false)
// ->default('standard')
// ->label('Gutachten Komponenten')
// ->options([
// 'standard' => 'Gutachten Standard Texte',
// 'nutzwerte' => 'Nutzwertberechnung',
// 'paragraph' => 'Auszug Gutachten gem. §6',
// ]),
], layout: FiltersLayout::AboveContent)
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->recordActions([
@@ -24,10 +24,11 @@ class TextblocksTable
->html(),
])
->deferFilters(false)
->filtersFormColumns(3)
->filtersFormColumns(2)
->filters([
SelectFilter::make('id')
->label('Textblock')
->columns(1)
->preload()
->default(1)
->options(function (): array {
@@ -29,8 +29,11 @@ use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use ToneGabes\BetterOptions\Forms\Components\RadioCards;
class ProjektInhaltsverzeichnisRelationManager extends RelationManager
{
@@ -346,17 +349,52 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
->persistFiltersInSession()
->deferFilters(false)
->filtersFormColumns(3)
->persistFiltersInSession()
->deferFilters(false)
->filtersFormColumns(1)
->defaultPaginationPageOption(50)
->filters([
SelectFilter::make('part')
->selectablePlaceholder(false)
->default('standard')
->label('Gutachten Komponenten')
->options([
'standard' => 'Gutachten Standard Texte',
'nutzwerte' => 'Nutzwerberechnung',
'paragraph' => 'Auszug Gutachten gem. §6',
]),
], FiltersLayout::AboveContent)
Filter::make('partfilters')
->schema([
RadioCards::make('part')
->columns(3)
->iconAfter()
->indicatorBefore()
->hiddenIcon()
->hiddenLabel()
->default('standard')
->options([
'standard' => 'Gutachten Standard',
'nutzwerte' => 'Nutzwertberechnung',
'paragraph' => 'Auszug Gutachten',
])
->idleIndicator('phosphor-circle')
->selectedIndicator('phosphor-circle-fill')
->descriptions([
'standard' => 'Inhaltsangabe, Texte',
'nutzwerte' => 'Tabellen',
'paragraph' => 'Gemäß Paragraph §6',
]),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['part'],
fn (Builder $query, $part): Builder => $query->where('part', $part),
);
}),
], layout: FiltersLayout::AboveContent)
// ->filters([
// SelectFilter::make('part')
// ->selectablePlaceholder(false)
// ->default('standard')
// ->label('Gutachten Komponenten')
// ->options([
// 'standard' => 'Gutachten Standard Texte',
// 'nutzwerte' => 'Nutzwertberechnung',
// 'paragraph' => 'Auszug Gutachten gem. §6',
// ]),
// ], FiltersLayout::AboveContent)
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->headerActions([
+14
View File
@@ -253,6 +253,20 @@
0 => 'Swis\\Filament\\Backgrounds\\FilamentBackgroundsServiceProvider',
),
),
'tonegabes/filament-better-options' =>
array (
'providers' =>
array (
0 => 'ToneGabes\\BetterOptions\\BetterOptionsServiceProvider',
),
),
'tonegabes/filament-phosphor-icons' =>
array (
'providers' =>
array (
0 => 'ToneGabes\\Filament\\Icons\\PhosphorIconsServiceProvider',
),
),
'ysfkaya/filament-phone-input' =>
array (
'providers' =>
+10 -6
View File
@@ -58,9 +58,11 @@
54 => 'Spatie\\LoginLink\\LoginLinkServiceProvider',
55 => 'Spatie\\Permission\\PermissionServiceProvider',
56 => 'Swis\\Filament\\Backgrounds\\FilamentBackgroundsServiceProvider',
57 => 'Ysfkaya\\FilamentPhoneInput\\FilamentPhoneInputServiceProvider',
58 => 'App\\Providers\\AppServiceProvider',
59 => 'App\\Providers\\Filament\\AdminPanelProvider',
57 => 'ToneGabes\\BetterOptions\\BetterOptionsServiceProvider',
58 => 'ToneGabes\\Filament\\Icons\\PhosphorIconsServiceProvider',
59 => 'Ysfkaya\\FilamentPhoneInput\\FilamentPhoneInputServiceProvider',
60 => 'App\\Providers\\AppServiceProvider',
61 => 'App\\Providers\\Filament\\AdminPanelProvider',
),
'eager' =>
array (
@@ -106,9 +108,11 @@
39 => 'Spatie\\LoginLink\\LoginLinkServiceProvider',
40 => 'Spatie\\Permission\\PermissionServiceProvider',
41 => 'Swis\\Filament\\Backgrounds\\FilamentBackgroundsServiceProvider',
42 => 'Ysfkaya\\FilamentPhoneInput\\FilamentPhoneInputServiceProvider',
43 => 'App\\Providers\\AppServiceProvider',
44 => 'App\\Providers\\Filament\\AdminPanelProvider',
42 => 'ToneGabes\\BetterOptions\\BetterOptionsServiceProvider',
43 => 'ToneGabes\\Filament\\Icons\\PhosphorIconsServiceProvider',
44 => 'Ysfkaya\\FilamentPhoneInput\\FilamentPhoneInputServiceProvider',
45 => 'App\\Providers\\AppServiceProvider',
46 => 'App\\Providers\\Filament\\AdminPanelProvider',
),
'deferred' =>
array (
+1
View File
@@ -25,6 +25,7 @@
"phpoffice/phpspreadsheet": "^5.2",
"spatie/laravel-login-link": "^1.6",
"swisnl/filament-backgrounds": "^2.0",
"tonegabes/filament-better-options": "^1.2",
"ysfkaya/filament-phone-input": "^4.0"
},
"require-dev": {
Generated
+131 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e33da7257e7e1d28e862441011addcef",
"content-hash": "7020f4e23bcc5b262d3644d33b55c7cf",
"packages": [
{
"name": "agencetwogether/hookshelper",
@@ -9626,6 +9626,136 @@
},
"time": "2025-12-02T11:56:42+00:00"
},
{
"name": "tonegabes/filament-better-options",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/tonegabes/filament-better-options.git",
"reference": "6314bdf052108e19970f6f3e6885e05bb8801b5f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tonegabes/filament-better-options/zipball/6314bdf052108e19970f6f3e6885e05bb8801b5f",
"reference": "6314bdf052108e19970f6f3e6885e05bb8801b5f",
"shasum": ""
},
"require": {
"filament/forms": "^4.0",
"php": "^8.3",
"spatie/laravel-package-tools": "^1.15.0",
"tonegabes/filament-phosphor-icons": "^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.86",
"larastan/larastan": "^3.0",
"laravel/pint": "^1.0",
"phpstan/phpstan-deprecation-rules": "^2.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"ToneGabes\\BetterOptions\\BetterOptionsServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"ToneGabes\\BetterOptions\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tone Gabes",
"email": "tonegabes@gmail.com",
"homepage": "https://tonegabes.com",
"role": "Developer"
}
],
"description": "Filament form components for better radio and checkbox options.",
"homepage": "https://github.com/tonegabes/filament-better-options",
"keywords": [
"Forms",
"checkbox",
"filament",
"laravel",
"php",
"plugin",
"tonegabes"
],
"support": {
"issues": "https://github.com/tonegabes/filament-better-options/issues",
"source": "https://github.com/tonegabes/filament-better-options"
},
"time": "2025-10-22T19:20:56+00:00"
},
{
"name": "tonegabes/filament-phosphor-icons",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/tonegabes/filament-phosphor-icons.git",
"reference": "fdcee3cab6fbd9a606eb54a0a58fa617bb8239c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tonegabes/filament-phosphor-icons/zipball/fdcee3cab6fbd9a606eb54a0a58fa617bb8239c1",
"reference": "fdcee3cab6fbd9a606eb54a0a58fa617bb8239c1",
"shasum": ""
},
"require": {
"codeat3/blade-phosphor-icons": "^2.3",
"filament/filament": "^4.0|^5.0",
"php": "^8.1"
},
"require-dev": {
"laravel/pint": "^1.22"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"ToneGabes\\Filament\\Icons\\PhosphorIconsServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"ToneGabes\\Filament\\Icons\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tone Gabes",
"email": "tonegabes@gmail.com",
"homepage": "https://tonegabes.com",
"role": "Developer"
}
],
"description": "Phosphor Icons Pack ready for Filament 4",
"keywords": [
"Iconset",
"Phosphor",
"filament",
"icons",
"laravel",
"library"
],
"support": {
"issues": "https://github.com/tonegabes/filament-phosphor-icons/issues",
"source": "https://github.com/tonegabes/filament-phosphor-icons/tree/1.3.1"
},
"time": "2026-04-29T17:56:26+00:00"
},
{
"name": "ueberdosis/tiptap-php",
"version": "2.1.0",
@@ -1 +1 @@
/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer theme, base, components, utilities;@layer theme{:host,:root{--font-mono:var(--mono-font-family),ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% 0.114 19.571);--color-red-500:oklch(63.7% 0.237 25.331);--color-sky-400:oklch(74.6% 0.16 232.661);--color-gray-100:var(--gray-100);--color-gray-200:var(--gray-200);--color-gray-300:var(--gray-300);--color-gray-400:var(--gray-400);--color-gray-500:var(--gray-500);--color-gray-600:var(--gray-600);--color-gray-700:var(--gray-700);--color-gray-900:var(--gray-900);--color-gray-950:var(--gray-950);--color-black:#000;--color-white:#fff;--spacing:0.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:0.75rem;--text-xs--line-height:calc(1 / 0.75);--text-sm:0.875rem;--text-sm--line-height:calc(1.25 / 0.875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-0.05em;--tracking-tight:-0.025em;--leading-loose:2;--radius-md:0.375rem;--radius-lg:0.5rem;--radius-xl:0.75rem;--ease-in:cubic-bezier(0.4,0,1,1);--ease-out:cubic-bezier(0,0,0.2,1);--ease-in-out:cubic-bezier(0.4,0,0.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;--default-transition-duration:150ms;--default-transition-timing-function:cubic-bezier(0.4,0,0.2,1);--default-font-family:var(--font-family),ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--default-mono-font-family:var(--mono-font-family),ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-primary-50:var(--color-primary-50);--color-primary-100:var(--color-primary-100);--color-primary-200:var(--color-primary-200);--color-primary-300:var(--color-primary-300);--color-primary-400:var(--color-primary-400);--color-primary-500:var(--color-primary-500);--color-primary-600:var(--color-primary-600);--color-primary-700:var(--color-primary-700);--color-primary-800:var(--color-primary-800);--color-primary-900:var(--color-primary-900);--color-primary-950:var(--color-primary-950)}}@layer base{*,::backdrop,::file-selector-button,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}::file-selector-button,button,input,optgroup,select,textarea{background-color:transparent;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearLine truncated
/*! tailwindcss v4.1.15 | MIT License | https://tailwindcss.com */@layer theme, base, components, utilities;@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% 0.114 19.571);--color-red-500:oklch(63.7% 0.237 25.331);--color-sky-400:oklch(74.6% 0.16 232.661);--color-gray-50:oklch(98.5% 0.002 247.839);--color-gray-100:oklch(96.7% 0.003 264.542);--color-gray-200:oklch(92.8% 0.006 264.531);--color-gray-300:oklch(87.2% 0.01 258.338);--color-gray-400:oklch(70.7% 0.022 261.325);--color-gray-500:oklch(55.1% 0.027 264.364);--color-gray-600:oklch(44.6% 0.03 256.802);--color-gray-700:oklch(37.3% 0.034 259.733);--color-gray-800:oklch(27.8% 0.033 256.848);--color-gray-900:oklch(21% 0.034 264.665);--color-gray-950:oklch(13% 0.028 261.692);--color-black:#000;--color-white:#fff;--spacing:0.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:0.75rem;--text-xs--line-height:calc(1 / 0.75);--text-sm:0.875rem;--text-sm--line-height:calc(1.25 / 0.875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-0.05em;--tracking-tight:-0.025em;--leading-loose:2;--radius-md:0.375rem;--radius-lg:0.5rem;--radius-xl:0.75rem;--ease-in:cubic-bezier(0.4,0,1,1);--ease-out:cubic-bezier(0,0,0.2,1);--ease-in-out:cubic-bezier(0.4,0,0.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;--default-transition-duration:150ms;--default-transition-timing-function:cubic-bezier(0.4,0,0.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary-50:var(--color-primary-50);--color-primary-100:var(--color-primary-100);--color-primary-200:var(--color-primary-200);--color-primary-300:var(--color-primary-300);--color-primary-400:var(--color-primary-400);--color-primary-500:var(--color-primary-500);--color-primary-600:var(--color-primary-600);--color-primary-700:var(--color-primary-700);--color-primary-800:var(--color-primary-800);--color-primary-900:var(--color-primary-900);--color-primary-950:var(--color-primary-950)}}@layer base{*,::backdrop,::file-selector-button,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}::file-selector-button,button,input,optgroup,select,textarea{background-color:transparent;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inLine truncated
@@ -0,0 +1,140 @@
export default function checkboxListFormComponent({ livewireId }) {
return {
areAllCheckboxesChecked: false,
checkboxListOptions: [],
search: "",
visibleCheckboxListOptions: [],
// Cache selectors for better performance
selectors: {
option: ".fi-fo-checkbox-option",
label: ".fi-fo-checkbox-option__label",
description: ".fi-fo-checkbox-option__description",
checkbox: "input[type=checkbox]",
checkedOrDisabled:
"input[type=checkbox]:checked, input[type=checkbox]:disabled",
},
init() {
this.cacheElements();
this.bindEvents();
this.$nextTick(() => {
this.checkIfAllCheckboxesAreChecked();
});
},
cacheElements() {
this.checkboxListOptions = Array.from(
this.$root.querySelectorAll(this.selectors.option)
);
this.updateVisibleCheckboxListOptions();
},
bindEvents() {
// Livewire hook for updates
Livewire.hook("commit", ({ component, succeed }) => {
succeed(() => {
this.$nextTick(() => {
if (component.id !== livewireId) {
return;
}
this.cacheElements();
this.checkIfAllCheckboxesAreChecked();
});
});
});
// Debounced search watcher
this.$watch(
"search",
this.debounce(() => {
this.updateVisibleCheckboxListOptions();
this.checkIfAllCheckboxesAreChecked();
}, 150)
);
},
// Simple debounce implementation
debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
},
isFoundInSearch(checkboxItem) {
if (!this.search || this.search.trim() === "") {
return true;
}
const searchTerm = this.search.toLowerCase();
// Cache elements to avoid repeated queries
const labelElement = checkboxItem.querySelector(this.selectors.label);
const descriptionElement = checkboxItem.querySelector(
this.selectors.description
);
const labelText = labelElement?.innerText?.toLowerCase() || "";
const descriptionText =
descriptionElement?.innerText?.toLowerCase() || "";
return (
labelText.includes(searchTerm) || descriptionText.includes(searchTerm)
);
},
checkIfAllCheckboxesAreChecked() {
if (this.visibleCheckboxListOptions.length === 0) {
this.areAllCheckboxesChecked = false;
return;
}
this.areAllCheckboxesChecked =
this.visibleCheckboxListOptions.length ===
this.visibleCheckboxListOptions.filter((checkboxLabel) =>
checkboxLabel.querySelector(this.selectors.checkedOrDisabled)
).length;
},
toggleAllCheckboxes() {
this.checkIfAllCheckboxesAreChecked();
const shouldCheck = !this.areAllCheckboxesChecked;
// Batch DOM operations for better performance
const checkboxesToUpdate = [];
this.visibleCheckboxListOptions.forEach((checkboxLabel) => {
const checkbox = checkboxLabel.querySelector(this.selectors.checkbox);
if (checkbox && !checkbox.disabled) {
checkboxesToUpdate.push(checkbox);
}
});
// Update all checkboxes at once
checkboxesToUpdate.forEach((checkbox) => {
checkbox.checked = shouldCheck;
checkbox.dispatchEvent(new Event("change"));
});
this.areAllCheckboxesChecked = shouldCheck;
},
updateVisibleCheckboxListOptions() {
if (!this.search || this.search.trim() === "") {
this.visibleCheckboxListOptions = [...this.checkboxListOptions];
return;
}
this.visibleCheckboxListOptions = this.checkboxListOptions.filter(
(checkboxListItem) => this.isFoundInSearch(checkboxListItem)
);
},
};
}
+4
View File
@@ -78,4 +78,8 @@
/* TextInputColumn Inhaltsverzeichnis */
.fi-ta-cell-seite .fi-ta-text-input {
min-width: 5rem !important;
}
.fi-ta-filters-header {
display: none;
}