inertia-bootstrap-forms 1.0.87 → 1.0.90

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/index.d.ts CHANGED
@@ -271,7 +271,67 @@ export const MultiQuantityInput: DefineComponent<{}, {}, any>;
271
271
  export const PasswordInput: DefineComponent<{}, {}, any>;
272
272
  export const PersianDatePickerInput: DefineComponent<{}, {}, any>;
273
273
  export const QuantityInput: DefineComponent<{}, {}, any>;
274
- export const Select2Input: DefineComponent<{}, {}, any>;
274
+ export const Select2Input: DefineComponent<{
275
+ name: {
276
+ type: String,
277
+ required: true,
278
+ },
279
+ modelValue: '',
280
+ label: {
281
+ type: String,
282
+ default: 'name',
283
+ },
284
+ placeholder: {
285
+ type: String,
286
+ default: 'Click to choice',
287
+ },
288
+ searchPlaceholder: {
289
+ type: String,
290
+ default: 'Type for search...',
291
+ },
292
+ multiple: {
293
+ type: Boolean,
294
+ default: false,
295
+ },
296
+ required: {
297
+ type: Boolean,
298
+ default: false,
299
+ },
300
+ config: {
301
+ type: Object,
302
+ default: {},
303
+ },
304
+ locale: {
305
+ type: String,
306
+ default: 'en',
307
+ },
308
+ options: Array,
309
+ searchEnabled: {
310
+ type: Boolean,
311
+ default: false
312
+ },
313
+ hideDropdown: {
314
+ type: Boolean,
315
+ default: false
316
+ },
317
+ search: {
318
+ type: Object,
319
+ default: {
320
+ url: null,
321
+ }
322
+ },
323
+ }, {}, any,
324
+ {},
325
+ {},
326
+ {},
327
+ {},
328
+ {
329
+ 'update:modelValue': (data) => void,
330
+ 'search': (event) => void,
331
+ 'change': (file) => void,
332
+ 'selected': () => void,
333
+ }
334
+ >;
275
335
  export const StarRatingInput: DefineComponent<{}, {}, any>;
276
336
  export const SubmitButton: DefineComponent<{
277
337
  disabled: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inertia-bootstrap-forms",
3
- "version": "1.0.87",
3
+ "version": "1.0.90",
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",
@@ -13,7 +13,11 @@ export default defineComponent({
13
13
  modelValue: '',
14
14
  label: {
15
15
  type: String,
16
- default: 'name',
16
+ default: null,
17
+ },
18
+ key: {
19
+ type: String,
20
+ default: null,
17
21
  },
18
22
  placeholder: {
19
23
  type: String,
@@ -108,6 +112,7 @@ export default defineComponent({
108
112
  removeItemButton: true,
109
113
  placeholderValue: this.placeholder,
110
114
  searchPlaceholderValue: this.placeholder,
115
+ shouldSort: false,
111
116
  itemSelectText: null,
112
117
  ...this.localeTranslates[this.currentLocale],
113
118
  ...this.config
@@ -158,7 +163,7 @@ export default defineComponent({
158
163
  await this.choices.setChoices(
159
164
  data.map(item => ({
160
165
  id: item.id,
161
- name: item.name,
166
+ name: item.name || item.label || item.value,
162
167
  })),
163
168
  'id',
164
169
  'name',
@@ -222,9 +227,9 @@ export default defineComponent({
222
227
  :placeholder="placeholder"
223
228
  ref="input">
224
229
  <option
225
- :value="(item.id || item)" v-for="(item, key) in options"
230
+ :value="((key ? item[key] : item?.name ?? item?.label ?? item?.value) ?? item)" v-for="(item, index) in options"
226
231
  :selected="multiple ? (selectedValue || []).includes(item.id || item) : (item?.id?.toString() || item) === modelValue?.toString()">
227
- {{ (label ? item[label] : item.name) || item }}
232
+ {{ (label ? item[label] : item?.name ?? item?.label ?? item?.value) ?? item }}
228
233
  </option>
229
234
  </select>
230
235
  </div>