Skip to content
Open
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
7 changes: 7 additions & 0 deletions resources/views/components/input.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@unless($field->disabled)
<input
@if($field->required) required @endif
@if($field->maskOptions) x-ref="imaskref" x-init="$nextTick(() => IMask($refs.imaskref, {{$field->maskOptions}} ))" @endif
{{ $attributes->except([...array_keys($attr), 'x-data', 'required', 'disabled'])->merge($attr)->merge(['class' => $errors->has($field->key) ? $field->errorClass : $field->class ]) }}
/>
@else
Expand All @@ -45,3 +46,9 @@
</span>
@endif
</div>
@if($field->maskOptions)
@tfonce('scripts:imask')
<script src="https://unpkg.com/imask"></script>
@endtfonce
@endif

1 change: 1 addition & 0 deletions src/Components/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ protected function defaults(): array
'min' => 0,
'max' => null,
'disabled' => false,
'maskOptions' => ''
];
}

Expand Down
10 changes: 10 additions & 0 deletions src/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Input extends BaseField
public $sfxTallIcon;
public $sfxHtmlIcon;
public bool $sfxHasIcon = false;
public string $maskOptions = '';

protected function overrides(): self
{
Expand Down Expand Up @@ -143,5 +144,14 @@ public function suffixHtmlIcon(string $html): self
$this->sfxHasIcon = true;
return $this;
}
/**
* @param string $mask_options
* @return $this
*/
public function maskOptions(string $mask_options): self
{
$this->maskOptions = $mask_options;
return $this;
}

}