@farm-investimentos/front-mfe-components 11.10.3 → 11.10.5

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": "@farm-investimentos/front-mfe-components",
3
- "version": "11.10.3",
3
+ "version": "11.10.5",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -181,3 +181,16 @@ export const OutsideChangeVmodel = () => ({
181
181
  </farm-btn>
182
182
  </div>`,
183
183
  });
184
+
185
+ export const NoItems = () => ({
186
+ data() {
187
+ return {
188
+ v: null,
189
+ items: [],
190
+ };
191
+ },
192
+ template: `<div style="width: 120px">
193
+ <farm-select v-model="v" :items="items" />
194
+ v-model: {{ v }}
195
+ </div>`,
196
+ });
@@ -24,6 +24,9 @@
24
24
  >
25
25
  <farm-caption bold tag="span">{{ item[itemText] }}</farm-caption>
26
26
  </farm-listitem>
27
+ <farm-listitem v-if="!items || items.length === 0">
28
+ {{ noDataText }}
29
+ </farm-listitem>
27
30
  </farm-list>
28
31
  <template v-slot:activator="{}">
29
32
  <div class="farm-textfield--input farm-textfield--input--iconed">
@@ -113,6 +116,13 @@ export default Vue.extend({
113
116
  type: String,
114
117
  default: 'value',
115
118
  },
119
+ /**
120
+ * No data text
121
+ */
122
+ noDataText: {
123
+ type: String,
124
+ default: 'Não há dados',
125
+ },
116
126
  },
117
127
  setup(props, { emit }) {
118
128
  const { rules, items, itemText, itemValue, disabled } = toRefs(props);
@@ -209,7 +219,7 @@ export default Vue.extend({
209
219
  };
210
220
 
211
221
  const updateSelectedTextValue = () => {
212
- if (!items.value || items.value.length === 0) {
222
+ if (!items.value || items.value.length === 0 || !innerValue.value) {
213
223
  selectedText.value = '';
214
224
  return;
215
225
  }
@@ -24,7 +24,7 @@ describe('Select component', () => {
24
24
  it('reset', () => {
25
25
  component.reset();
26
26
  expect(component.isTouched).toBeTruthy();
27
- expect(component.innerValue).toEqual('');
27
+ expect(component.innerValue).toEqual(null);
28
28
  });
29
29
 
30
30
  it('onBlur', () => {
@@ -41,6 +41,5 @@ describe('Select component', () => {
41
41
  component.updateSelectedTextValue();
42
42
  expect(component.selectedText).toBeDefined();
43
43
  });
44
-
45
44
  });
46
45
  });