@everchron/ec-shards 7.3.6 → 7.3.7

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": "@everchron/ec-shards",
3
- "version": "7.3.6",
3
+ "version": "7.3.7",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <select v-model="selectedOption" @change="onChange">
3
+ <option v-for="option in options" :value="option.value">{{ option.name }}</option>
4
+ </select>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ props: {
10
+ options: {
11
+ type: Array,
12
+ required: true,
13
+ validator: (options) => {
14
+ return options.every((option) => {
15
+ return option.hasOwnProperty('name') && option.hasOwnProperty('value');
16
+ });
17
+ }
18
+ },
19
+ value: {
20
+ type: String,
21
+ default: ''
22
+ }
23
+ },
24
+
25
+ data() {
26
+ return {
27
+ selectedOption: this.value
28
+ }
29
+ },
30
+
31
+ watch: {
32
+ value(newValue) {
33
+ this.selectedOption = newValue;
34
+ }
35
+ },
36
+
37
+ methods: {
38
+ onChange() {
39
+ const selected = this.options.find((option) => {
40
+ return option.value === this.selectedOption;
41
+ });
42
+ this.$emit('change', { name: selected.name, value: selected.value });
43
+ }
44
+ }
45
+ };
46
+ </script>
@@ -5,6 +5,8 @@
5
5
  @focus="$emit('focus', $event)"
6
6
  @blur="$emit('blur', $event)"
7
7
  v-bind="{ id, name, disabled, required }"
8
+ :id="id"
9
+ :name="name"
8
10
  :class="hasPlaceholder? 'placeholder' : ''" >
9
11
  <option v-if="placeholder" selected hidden disabled>{{placeholder}}</option>
10
12
  <slot></slot>
@@ -21,7 +21,7 @@ export const select = () => ({
21
21
  Set to: <button @click="value = 'admin'">admin</button>
22
22
  <button @click="value = 'basic'">basic</button>
23
23
  <button @click="value = 'guest'">guest</button>
24
- <ecs-select class="mb-4" :value="value" @change="update($event.target.value)">
24
+ <ecs-select class="mb-4" :value="value" @change="update($event.target.value)" id="test" name="testname">
25
25
  <option value="admin">Admin</option>
26
26
  <option value="basic">Basic</option>
27
27
  <option value="guest">Guest</option>