@nixweb/nixloc-ui 0.0.197 → 0.0.199

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": "@nixweb/nixloc-ui",
3
- "version": "0.0.197",
3
+ "version": "0.0.199",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -86,4 +86,4 @@
86
86
  "not dead"
87
87
  ],
88
88
  "main": "babel.config.js"
89
- }
89
+ }
@@ -21,6 +21,7 @@ export default {
21
21
  props: {
22
22
  title: String,
23
23
  options: Array,
24
+ initialFieldTarget: String,
24
25
  fieldTarget: String,
25
26
  disabled: Boolean,
26
27
  stacked: Boolean,
@@ -36,6 +37,13 @@ export default {
36
37
  selected: this.value,
37
38
  };
38
39
  },
40
+ mounted() {
41
+ if (this.initialFieldTarget) {
42
+ let value = this.initialFieldTarget.value;
43
+ let obj = { tag: `${this.title}: ${value}`, fieldTarget: this.fieldTarget, value: value };
44
+ this.addFilter(obj);
45
+ }
46
+ },
39
47
  computed: {
40
48
  ...mapGetters("generic", ["event"]),
41
49
  },
@@ -8,6 +8,10 @@
8
8
  <multiselect @open="onOpen" @select="onSelected" @search-change="onSearch" :options="data"
9
9
  v-model.trim="currentValue" :custom-label="label" :disabled="disabled" placeholder :showLabels="true"
10
10
  :noResult="false" ref="multiselect" selectLabel deselectLabel selectedLabel>
11
+ <div slot="beforeList" class="after-list">
12
+ <Button v-if="showBtnClean" key="cleanSelect" title="Limpar" type="warning" classIcon="fas fa-broom"
13
+ size="small" :clicked="cleanSelectStatic" />
14
+ </div>
11
15
  </multiselect>
12
16
  </div>
13
17
  </div>
@@ -16,7 +20,7 @@
16
20
  import Multiselect from "vue-multiselect";
17
21
  import Button from "./Button";
18
22
 
19
- import { mapMutations } from "vuex";
23
+ import { mapMutations, mapGetters } from "vuex";
20
24
 
21
25
  export default {
22
26
  name: "SelectStatic",
@@ -39,6 +43,10 @@ export default {
39
43
  type: Boolean,
40
44
  default: true,
41
45
  },
46
+ showBtnClean: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
42
50
  markFormDirty: {
43
51
  type: Boolean,
44
52
  default: false,
@@ -65,6 +73,9 @@ export default {
65
73
  el.tabIndex = 0;
66
74
  }
67
75
  },
76
+ computed: {
77
+ ...mapGetters("generic", ["event"]),
78
+ },
68
79
  methods: {
69
80
  ...mapMutations("generic", ["addFilter", "removeLoading"]),
70
81
  ...mapMutations("validation", [
@@ -78,6 +89,11 @@ export default {
78
89
  this.$emit("input", value);
79
90
  let obj = { fieldTarget: this.fieldTarget, value: value.id };
80
91
  if (!this.onlyQuery) this.addFilter(obj);
92
+ if (this.fieldTarget) {
93
+ let obj = { tag: `${this.title}: ${value.content}`, fieldTarget: this.fieldTarget, value: value.id };
94
+ this.addFilter(obj);
95
+ }
96
+
81
97
  if (this.markFormDirty) this.updateFormDirty(true);
82
98
  },
83
99
  onSearch(value) { },
@@ -92,10 +108,11 @@ export default {
92
108
  this.removeLoading(["cleanSelectStatic"]);
93
109
 
94
110
  if (this.fieldTarget) {
95
- let obj = { fieldTarget: this.fieldTarget, valor: "" };
111
+ let obj = { fieldTarget: this.fieldTarget, value: "" };
96
112
  this.addFilter(obj);
97
113
  }
98
114
  },
115
+
99
116
  validate() {
100
117
  this.notifications = [];
101
118
  if (this.required && !this.value.id) {
@@ -105,6 +122,16 @@ export default {
105
122
  },
106
123
  },
107
124
  watch: {
125
+ event: {
126
+ handler(event) {
127
+
128
+ if (event.name == "tagRemoved") {
129
+ if (this.fieldTarget == event.data) this.cleanSelectStatic();
130
+ }
131
+
132
+ },
133
+ deep: true,
134
+ },
108
135
  "value.id": function () {
109
136
  this.validate();
110
137
  this.formDirty = true;
@@ -145,7 +172,7 @@ export default {
145
172
  letter-spacing: 0.5px !important;
146
173
  }
147
174
 
148
- div.before-list {
175
+ div.after-list {
149
176
  padding: 8px;
150
177
  }
151
178