mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-01 15:09:33 +08:00
Save on enter and debounce numeric input
This commit is contained in:
@@ -13,6 +13,13 @@
|
||||
error: undefined,
|
||||
state: @js($state),
|
||||
isLoading: false,
|
||||
update: async function(value) {
|
||||
this.isLoading = true
|
||||
this.response = await $wire.updateTableColumnState(@js($getName()), @js($recordKey), value)
|
||||
this.error = response?.error ?? undefined
|
||||
if (! this.error) this.state = response
|
||||
this.isLoading = false
|
||||
}
|
||||
}"
|
||||
x-init="
|
||||
Livewire.hook('message.processed', (component) => {
|
||||
@@ -46,13 +53,8 @@
|
||||
{!! ($inputMode = $getInputMode()) ? "inputmode=\"{$inputMode}\"" : null !!}
|
||||
{!! ($placeholder = $getPlaceholder()) ? "placeholder=\"{$placeholder}\"" : null !!}
|
||||
{!! ($interval = $getStep()) ? "step=\"{$interval}\"" : null !!}
|
||||
x-on:change="
|
||||
isLoading = true
|
||||
response = await $wire.updateTableColumnState(@js($getName()), @js($recordKey), $event.target.value)
|
||||
error = response?.error ?? undefined
|
||||
if (! error) state = response
|
||||
isLoading = false
|
||||
"
|
||||
x-on:change{{ $getType() === 'number' ? '.debounce.750ms' : null }}="update($event.target.value)"
|
||||
x-on:keydown.enter="update($event.target.value)"
|
||||
:readonly="isLoading"
|
||||
x-tooltip="error"
|
||||
{{ $attributes->merge($getExtraInputAttributes())->merge($getExtraAttributes())->class([
|
||||
|
||||
Reference in New Issue
Block a user