Skip to content

Commit d417028

Browse files
committed
Popper positioning bug fix
1 parent 5ba7809 commit d417028

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

resources/views/components/script.blade.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ function SimpleSelect(config) {
2929
init: function() {
3030
if (this.value && !this.selected) {
3131
this.selected = this.value;
32-
this.value = null;
3332
}
34-
33+
3534
if (!this.selected) {
36-
if (this.multiple) {
37-
this.selected = [];
38-
} else {
39-
this.selected = '';
40-
}
35+
if (this.multiple) {
36+
this.selected = [];
37+
} else {
38+
this.selected = null;
39+
}
4140
}
4241
this.resetOptions();
4342

resources/views/components/simple-select.blade.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<div
2+
x-cloak
23
class="relative mt-1"
34
x-data="SimpleSelect({
45
dataSource: {{ is_array($options) ? json_encode($options) : json_encode([]) }},
@@ -41,7 +42,7 @@ class="relative mt-1"
4142
}"
4243
{{ $attributes->class('block w-full border border-gray-300 rounded-md shadow-sm focus:ring-0 focus:ring-gray-400 focus:border-gray-400 sm:text-sm sm:leading-5')->only('class'); }}
4344
>
44-
<div x-cloak x-show="!selected || selected.length === 0" class="flex flex-wrap">
45+
<div x-show="!selected || selected.length === 0" class="flex flex-wrap">
4546
<div class="text-gray-800 rounded-sm w-full truncate px-2 py-0.5 my-0.5 flex flex-row items-center">
4647
<div class="w-full px-2 truncate" x-text="placeholder">&nbsp;</div>
4748
<div x-show="!disabled" x-bind:class="{ 'cursor-pointer': !disabled }" class="h-6" x-on:click.prevent.stop="toggleSelect()">
@@ -50,7 +51,7 @@ class="relative mt-1"
5051
</div>
5152
</div>
5253
@isset($attributes['multiple'])
53-
<div x-cloak x-show="selected && typeof selected === 'object' && selected.length > 0" class="flex flex-wrap space-x-1">
54+
<div x-show="selected && typeof selected === 'object' && selected.length > 0" class="flex flex-wrap space-x-1">
5455
<template x-for="(value, index) in selected" :key="index">
5556
<div class="text-gray-800 rounded-full truncate bg-gray-300 px-2 py-0.5 my-0.5 flex flex-row items-center">
5657
{{-- Invisible inputs for standard form submission values --}}
@@ -80,7 +81,7 @@ class="w-6"
8081
</template>
8182
</div>
8283
@else
83-
<div x-cloak x-show="selected" class="flex flex-wrap">
84+
<div x-show="selected" class="flex flex-wrap">
8485
<div class="text-gray-800 rounded-sm w-full truncate px-2 py-0.5 my-0.5 flex flex-row items-center">
8586
{{-- Invisible input for standard form submission of values --}}
8687
<input type="text" :name="name" x-model="selected" :required="required" style="display: none;" />
@@ -134,8 +135,8 @@ class="absolute z-10 w-full py-1 overflow-auto text-base bg-white shadow-lg roun
134135
tabindex="-1"
135136
role="listbox"
136137
>
137-
<div x-cloak x-show="Object.values(options).length == 0 && search.toString().trim() == ''" x-text="noOptions" class="px-2 py-2"></div>
138-
<div x-cloak x-show="Object.values(options).length == 0 && search.toString().trim() != ''" x-text="noResult" class="px-2 py-2"></div>
138+
<div x-show="Object.values(options).length == 0 && search.toString().trim() == ''" x-text="noOptions" class="px-2 py-2"></div>
139+
<div x-show="Object.values(options).length == 0 && search.toString().trim() != ''" x-text="noResult" class="px-2 py-2"></div>
139140
<template x-for="(option, index) in Object.values(options)" :key="index">
140141
<li
141142
:tabindex="index"

0 commit comments

Comments
 (0)