livewire($livewire); } /** * @param (LivewireComponent & HasSchemas) | null $livewire */ public static function make(?HasSchemas $livewire = null): static { $static = app(static::class, ['livewire' => $livewire]); $static->configure(); return $static; } /** * @return array */ protected function resolveDefaultClosureDependencyForEvaluationByName(string $parameterName): array { return match ($parameterName) { 'container' => [$this], 'livewire' => [$this->getLivewire()], 'model' => [$this->getModel()], 'record' => [$this->getRecord()], default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName), }; } /** * @return array */ protected function resolveDefaultClosureDependencyForEvaluationByType(string $parameterType): array { $record = is_a($parameterType, Model::class, allow_string: true) ? $this->getRecord() : null; if (! ($record instanceof Model)) { return match ($parameterType) { static::class, self::class => [$this], default => parent::resolveDefaultClosureDependencyForEvaluationByType($parameterType), }; } return match ($parameterType) { Model::class, $record::class => [$record], default => parent::resolveDefaultClosureDependencyForEvaluationByType($parameterType), }; } /** * @param array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components */ public static function start(array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components): static { return static::make() ->components($components) ->alignStart(); } /** * @param array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components */ public static function end(array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components): static { return static::make() ->components($components) ->alignEnd(); } /** * @param array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components */ public static function center(array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components): static { return static::make() ->components($components) ->alignCenter(); } /** * @param array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components */ public static function between(array | Schema | Component | Action | ActionGroup | string | Htmlable | Closure $components): static { return static::make() ->components($components) ->alignBetween(); } public function deferLoading(bool | Closure $condition = true): static { $this->isLoadingDeferred = $condition; return $this; } public function isLoadingDeferred(): bool { return (bool) $this->evaluate($this->isLoadingDeferred); } public function toEmbeddedHtml(): string { return Component::withVisibilityCache(fn (): string => $this->renderEmbeddedHtml()); } protected function renderEmbeddedHtml(): string { if ($this->isDirectlyHidden()) { return ''; } $isLoadingDeferred = $this->isLoadingDeferred(); if ($isLoadingDeferred && (! $this->isDeferredSchemaLoaded())) { return $this->renderDeferredLoadingHtml(); } $hasVisibleComponents = false; $componentsWithVisibility = array_map( function (Component | Action | ActionGroup $component) use (&$hasVisibleComponents): array { $isComponentVisible = $component->isVisible(); if ($isComponentVisible) { $hasVisibleComponents = true; } return [$component, $isComponentVisible]; }, $this->getComponents(withHidden: true), ); if (! $hasVisibleComponents) { return ''; } $alignment = $this->getAlignment(); $isInline = $this->isInline(); $isRoot = $this->isRoot(); $attributes = $this->getExtraAttributeBag() ->when( ! $isInline, fn (ComponentAttributeBag $attributes) => $attributes->grid($this->getColumns()), ) ->merge([ 'wire:partial' => ($this->shouldPartiallyRender() || $isLoadingDeferred) ? ('schema.' . $this->getKey()) : null, 'x-data' => $isRoot ? 'filamentSchema({ livewireId: ' . Js::from($this->getLivewire()->getId()) . ', schemaKey: ' . Js::from($this->getKey()) . ' })' : null, 'x-on:form-validation-error.window' => $isRoot ? 'handleFormValidationError' : null, 'x-on:reset-schema-component-state.window' => $isRoot ? 'handleClientSideStateReset' : null, ], escape: false) ->class([ 'fi-sc', 'fi-inline' => $isInline, ($alignment instanceof Alignment) ? "fi-align-{$alignment->value}" : $alignment, 'fi-sc-has-gap' => $this->hasGap(), 'fi-sc-dense' => $this->isDense(), ]); ob_start(); ?>
toHtml() ?>>
toHtml() ?>
isLiberatedFromContainerGrid()) { ?> toSchemaHtml(isVisible: $isSchemaComponentVisible) ?> toHtml() ?>
getLivewire(); if (! method_exists($livewire, 'isDeferredSchemaLoaded')) { throw new LogicException('Deferred schema loading requires the Livewire component to use the [InteractsWithSchemas] trait.'); } return $livewire->isDeferredSchemaLoaded($this); } /** * @internal This method is not part of the public API and should not be used. Its parameters may change at any time without notice. */ protected function renderDeferredLoadingHtml(): string { $schemaKey = $this->getKey(); $attributes = $this->getExtraAttributeBag() ->merge([ 'wire:partial' => "schema.{$schemaKey}", 'x-data' => 'filamentSchema({ livewireId: ' . Js::from($this->getLivewire()->getId()) . ', schemaKey: ' . Js::from($schemaKey) . ', isLoadingDeferred: true })', 'role' => 'status', 'aria-busy' => 'true', ], escape: false) ->class([ 'fi-sc', 'fi-sc-loading', ]); ob_start(); ?>
toHtml() ?>> toHtml() ?>
getLivewire(); $livewire->dispatch( 'reset-schema-component-state', livewireId: $livewire->getId(), schemaKey: $this->getKey(), ); } }