bootstrap-vue-wrapper 1.3.2 → 1.5.0

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": "bootstrap-vue-wrapper",
3
- "version": "1.3.2",
3
+ "version": "1.5.0",
4
4
  "description": "bootstrap 5 components in Vue3 warapper.",
5
5
  "author": "Gabor Zemko <gaborzemko@gmail.com>",
6
6
  "homepage": "https://github.com/zemkogabor/bootstrap-vue-wrapper",
@@ -8,6 +8,7 @@
8
8
  <input
9
9
  ref="validationTarget"
10
10
  :value="modelValue"
11
+ class="form-control"
11
12
  v-bind="$attrs"
12
13
  :aria-describedby="hint !== null ? getHintId() : null"
13
14
  @input="onInput"
@@ -5,7 +5,7 @@
5
5
  tabindex="-1"
6
6
  aria-hidden="true"
7
7
  >
8
- <div class="modal-dialog">
8
+ <div class="modal-dialog" :class="classDialog">
9
9
  <div class="modal-content">
10
10
  <div class="modal-header">
11
11
  <div class="h5 modal-title" v-text="title" />
@@ -39,6 +39,10 @@ export default {
39
39
  type: String,
40
40
  required: true,
41
41
  },
42
+ classDialog: {
43
+ type: Object,
44
+ default: () => {},
45
+ },
42
46
  },
43
47
  emits: ['hidden'],
44
48
  mounted() {
@@ -48,6 +52,12 @@ export default {
48
52
  modalElement.addEventListener('hidden.bs.modal', this.onHidden)
49
53
  },
50
54
  methods: {
55
+ /**
56
+ * Trigger modal hide event.
57
+ */
58
+ hide() {
59
+ Modal.getOrCreateInstance(this.$refs.modalRef).hide()
60
+ },
51
61
  /**
52
62
  * Hidden event.
53
63
  */
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <label
3
+ v-if="label !== null"
4
+ :for="id"
5
+ class="form-label"
6
+ v-text="label"
7
+ />
8
+ <select
9
+ ref="validationTarget"
10
+ class="form-select"
11
+ :value="modelValue"
12
+ :aria-labelledby="hint !== null ? getHintId() : null"
13
+ v-bind="$attrs"
14
+ @input="onInput"
15
+ @invalid="onInvalid"
16
+ >
17
+ <option
18
+ v-if="placeholder !== null"
19
+ value=""
20
+ disabled
21
+ hidden
22
+ >
23
+ {{ placeholder }}
24
+ </option>
25
+ <option
26
+ v-for="(option, index) in options"
27
+ :key="index"
28
+ :value="option.value"
29
+ >
30
+ {{ option.text }}
31
+ </option>
32
+ </select>
33
+ <div
34
+ v-if="invalidMessage !== null"
35
+ class="invalid-feedback"
36
+ v-text="invalidMessage"
37
+ />
38
+ <div
39
+ v-if="hint !== null"
40
+ :id="getHintId()"
41
+ class="form-text"
42
+ v-text="hint"
43
+ />
44
+ </template>
45
+
46
+ <script>
47
+ import validator from '../../mixins/validator.js'
48
+
49
+ export default {
50
+ name: 'BsInput',
51
+ mixins: [validator],
52
+ props: {
53
+ /**
54
+ * Value for v-model
55
+ */
56
+ modelValue: {
57
+ type: String,
58
+ default: null,
59
+ },
60
+ /**
61
+ * Html id
62
+ */
63
+ id: {
64
+ type: String,
65
+ required: true,
66
+ },
67
+ /**
68
+ * Label for input
69
+ */
70
+ label: {
71
+ type: String,
72
+ default: null,
73
+ },
74
+ /**
75
+ * Attribute hint
76
+ */
77
+ hint: {
78
+ type: String,
79
+ default: null,
80
+ },
81
+ /**
82
+ * Options
83
+ */
84
+ options: {
85
+ type: Array,
86
+ default: () => [],
87
+ },
88
+ /**
89
+ * Placeholder
90
+ */
91
+ placeholder: {
92
+ type: String,
93
+ default: null,
94
+ },
95
+ },
96
+ emits: ['update:modelValue'],
97
+ methods: {
98
+ /**
99
+ * Hint id is generated
100
+ */
101
+ getHintId() {
102
+ return this.id + 'Hint'
103
+ },
104
+ /**
105
+ * On input event
106
+ *
107
+ * @param event
108
+ */
109
+ onInput(event) {
110
+ this.$emit('update:modelValue', event.target.value)
111
+ },
112
+ },
113
+ }
114
+ </script>
@@ -8,7 +8,7 @@
8
8
  'cursor-pointer': isSortableField(field),
9
9
  thClass,
10
10
  }"
11
- @click="onHeadClick(field.key)"
11
+ @click="onHeadClick(field)"
12
12
  >
13
13
  <slot name="tr">
14
14
  {{ field.label }}
@@ -176,9 +176,9 @@ export default {
176
176
  return
177
177
  }
178
178
 
179
- this.setSortDesc(field)
179
+ this.setSortDesc(field.key)
180
180
 
181
- this.$emit('orderChanged', { sortDesc: this.sortDesc, orderBy: field })
181
+ this.$emit('orderChanged', { sortDesc: this.sortDesc, orderBy: field.key })
182
182
  },
183
183
  },
184
184
  }
package/src/index.js CHANGED
@@ -7,6 +7,7 @@ import BsPaginator from './components/bs-paginator/BsPaginator.vue'
7
7
  import BsTable from './components/bs-table/BsTable.vue'
8
8
  import BsToast from './components/bs-toast/BsToast.vue'
9
9
  import BsModal from './components/bs-modal/BsModal.vue'
10
+ import BsSelect from './components/bs-select/BsSelect.vue'
10
11
  import Validator from './mixins/validator.js'
11
12
 
12
13
  export {
@@ -19,5 +20,6 @@ export {
19
20
  BsTable,
20
21
  BsToast,
21
22
  BsModal,
23
+ BsSelect,
22
24
  Validator,
23
25
  }