inertia-bootstrap-forms 1.0.90 → 1.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inertia-bootstrap-forms",
3
- "version": "1.0.90",
3
+ "version": "1.0.91",
4
4
  "description": "Create bootstrap forms with inertia and twitter bootstrap",
5
5
  "main": "dist/inertia-bootstrap-forms.cjs.js",
6
6
  "module": "dist/inertia-bootstrap-forms.es.js",
@@ -129,17 +129,11 @@ export default defineComponent({
129
129
  },
130
130
  async setLoading() {
131
131
  this.loading = true;
132
- this.choices.clearChoices();
133
132
  await this.choices.setChoices(
134
- [
135
- {
136
- value: '',
137
- label: this.localeTranslates[this.currentLocale]['searchingPlaceholder'] || 'Searching...',
138
- }
139
- ],
133
+ [{ value: '', label: this.localeTranslates[this.currentLocale]['searchingPlaceholder'] || 'Searching...', disabled: true }],
140
134
  'value',
141
135
  'label',
142
- true
136
+ true // replaceChoices
143
137
  );
144
138
  },
145
139
  async doSearch(searchTerm) {
@@ -153,33 +147,30 @@ export default defineComponent({
153
147
  this.searchController = new AbortController();
154
148
 
155
149
  try {
156
- const res = await fetch(this.search?.url + '?query=' + encodeURIComponent(searchTerm), {
150
+ const res = await fetch(this.search.url + '?query=' + encodeURIComponent(searchTerm), {
157
151
  method: 'POST',
158
152
  signal: this.searchController.signal,
159
153
  });
160
154
  const data = await res.json();
161
155
 
162
- this.choices.clearChoices();
163
156
  await this.choices.setChoices(
164
157
  data.map(item => ({
165
- id: item.id,
166
- name: item.name || item.label || item.value,
158
+ value: item.id,
159
+ label: item.name || item.label || item.value,
167
160
  })),
168
- 'id',
169
- 'name',
161
+ 'value',
162
+ 'label',
170
163
  true
171
164
  );
172
165
  this.loading = false;
173
166
  } catch (err) {
174
167
  this.loading = false;
175
- this.choices.clearChoices();
176
168
  if (err.name !== 'AbortError') {
177
169
  console.error(err);
170
+ await this.choices.setChoices([], 'value', 'label', true);
178
171
  }
179
172
  }
180
-
181
- }
182
- },
173
+ } },
183
174
  mounted() {
184
175
  if (this.locale === 'en' && document.dir === 'rtl') {
185
176
  this.currentLocale = 'fa';