Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjansen committed Nov 10, 2023
1 parent 0efe3e9 commit ae99d89
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
13 changes: 7 additions & 6 deletions resources/views/components/field/editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'name' => optional($attributes->wire('model'))->value(),
'value' => null,
'disableTab' => false,
'placeholder' => '',
'toolbar' => [
[[ 'header' => [1, 2, 3, 4, 5, 6, false] ]],
['bold', 'italic', 'underline', 'strike'],
Expand All @@ -13,7 +14,8 @@
[[ 'align' => [] ]],
['clean']
],
'rows' => 5
'rows' => 5,
'class' => 'w-full border rounded-b',
])

@php
Expand All @@ -34,7 +36,8 @@
bounds: document.body,
modules: {
toolbar: {{ json_encode($toolbar) }}
}
},
placeholder: '{{ $placeholder }}',
});
quill{{ $id }}.on('text-change', (delta, oldDelta, source) => {
Expand All @@ -47,11 +50,9 @@
@endif
"
style="min-height: {{ $rows * 3 }}em; min-width: 100%;"
class="w-full border rounded-b"
class="{{ $class }}"
>
<div class="ql-editor-{{ $id }}"
tabindex="1"
>{!! $value !!}</div>
<div class="ql-editor-{{ $id }}" tabindex="1">{!! $value !!}</div>
</div>
</div>
<style>
Expand Down
10 changes: 5 additions & 5 deletions resources/views/components/form/row/display/normal.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="
px-4 pt-4 pb-2 last:pb-4 sm:p-6 bg-white w-full border-b last:border-b-0 border-gray-100
{{ ($meta['with_grid'] ?? true) ? 'grid grid-cols-6 gap-6' : null }}
"
<div @class([
'bg-white w-full border-b last:border-b-0 border-gray-100',
'px-4 pt-4 pb-2 last:pb-4 sm:p-6' => ($meta['without_padding'] ?? false) === false,
'grid grid-cols-6 gap-6' => $meta['with_grid'] ?? true,
])
wire:key="move-form-row-{{ $model }}"
>

@if ($meta['full_colspan'] ?? false === true)

<div class="{{ ($labelValue ? 'sm:grid sm:grid-cols-9 sm:gap-4 sm:items-start' : null) }}">
Expand Down
9 changes: 5 additions & 4 deletions src/Concerns/HasHelpText.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait HasHelpText
*
* @var string
*/
public $helpText;
protected $helpText;

public $helpTextAttributes = [];

Expand Down Expand Up @@ -57,19 +57,20 @@ public function getHelpText(): ?string

$data = array_replace_recursive($this->helpTextAttributes, [
'store' => $undotedStore,
'get' => fn ($key) => Arr::get($undotedStore, $key),
'field' => $this
]);

$view = is_callable($helpText)
? app()->call($helpText, $data)
: $helpText;

if (is_string($view)) {
$view = app('view')->make(CreateBladeView::fromString($view));
} else {
if (! is_string($view)) {
return null;
}

$view = app('view')->make(CreateBladeView::fromString($view));

throw_unless($view instanceof View,
new \Exception('"view" method on ['.get_class($this).'] must return instance of ['.View::class.']'));

Expand Down
10 changes: 9 additions & 1 deletion src/Fields/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function init()
return $this;
}

public function fields(array $fields, array $meta = [], array $options = [])
public function schema(array $fields, array $meta = [], array $options = [])
{
$this->fields = $fields;
$this->fieldMeta = $meta ?: $this->fieldMeta;
Expand All @@ -41,6 +41,14 @@ public function fields(array $fields, array $meta = [], array $options = [])
return $this;
}

/**
* @deprecated
*/
public function fields(array $fields, array $meta = [], array $options = [])
{
return $this->schema($fields, $meta, $options);
}

public function fieldMeta(array $meta = [])
{
$this->fieldMeta = $meta;
Expand Down
15 changes: 14 additions & 1 deletion src/Fields/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function id(): string
return $this->id ?? $this->unique;
}

public function setFields(array $fields)
public function schema(array $fields): static
{
$this->fields = $fields;

Expand All @@ -117,6 +117,14 @@ public function setFields(array $fields)
return $this;
}

/**
* @deprecated
*/
public function setFields(array $fields): static
{
return $this->schema($fields);
}

public function nameOnCreate(string $nameOnCreate): static
{
$this->nameOnCreate = $nameOnCreate;
Expand Down Expand Up @@ -354,6 +362,11 @@ public function fullWidth()
]);
}

public function withoutPadding()
{
return $this->withMeta(['without_padding' => true]);
}

public function getParentModel()
{
return $this->model;
Expand Down

0 comments on commit ae99d89

Please sign in to comment.