@farm-investimentos/front-mfe-components 15.6.3 → 15.7.2
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/dist/front-mfe-components.common.js +185 -154
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +185 -154
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Buttons/ExportButton/ExportButton.stories.js +9 -0
- package/src/components/Buttons/ExportButton/ExportButton.vue +11 -4
- package/src/components/Logger/Logger.scss +1 -1
- package/src/components/SelectAutoComplete/SelectAutoComplete.vue +45 -27
- package/src/components/SelectAutoComplete/__tests__/SelectAutoComplete.spec.js +0 -1
package/package.json
CHANGED
|
@@ -38,3 +38,12 @@ export const CustomColor = () => ({
|
|
|
38
38
|
<farm-btn-export color="info" :optionsList="[{ key: 1, label: 'XLS teste'}, { key: 2, label: 'CSV teste novo'}]" />
|
|
39
39
|
</div>`,
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
export const CustomLabel = () => ({
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
label: 'Exportar Histórico',
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
template: '<farm-btn-export :label="label" />',
|
|
49
|
+
});
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
v-if="optionsList.length == 0 || disabled"
|
|
4
4
|
class="farm-btn--responsive"
|
|
5
5
|
outlined
|
|
6
|
-
title="
|
|
6
|
+
:title="label"
|
|
7
7
|
:color="$attrs.color"
|
|
8
8
|
:disabled="disabled"
|
|
9
9
|
@click="onClick"
|
|
10
10
|
>
|
|
11
11
|
<farm-icon v-if="optionsList.length == 0" class="mr-2"> file-export-outline </farm-icon>
|
|
12
|
-
|
|
12
|
+
{{ label }}
|
|
13
13
|
<farm-icon v-if="optionsList.length != 0" class="ml-2"> chevron-down </farm-icon>
|
|
14
14
|
</farm-btn>
|
|
15
15
|
|
|
16
16
|
<farm-contextmenu v-else v-model="value" :bottom="true">
|
|
17
17
|
<template v-slot:activator="{}">
|
|
18
|
-
<farm-btn outlined title="
|
|
19
|
-
|
|
18
|
+
<farm-btn outlined :title="label" :color="$attrs.color" @click="toggleValue">
|
|
19
|
+
{{ label }}
|
|
20
20
|
<farm-icon class="ml-2"> chevron-{{ value ? 'up' : 'down' }} </farm-icon>
|
|
21
21
|
</farm-btn>
|
|
22
22
|
</template>
|
|
@@ -63,6 +63,13 @@ export default defineComponent({
|
|
|
63
63
|
type: Boolean,
|
|
64
64
|
default: false,
|
|
65
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* Label
|
|
68
|
+
*/
|
|
69
|
+
label: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: 'Exportar',
|
|
72
|
+
},
|
|
66
73
|
},
|
|
67
74
|
data() {
|
|
68
75
|
return {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
hover-color="primary"
|
|
25
25
|
:key="'contextmenu_item_' + index"
|
|
26
26
|
:class="{ 'farm-listitem--selected': item[itemValue] === innerValue }"
|
|
27
|
-
@click=
|
|
27
|
+
@click="selectItem(item)"
|
|
28
28
|
>
|
|
29
29
|
<farm-checkbox
|
|
30
30
|
class="farm-select__checkbox"
|
|
@@ -42,7 +42,13 @@
|
|
|
42
42
|
/>
|
|
43
43
|
<farm-caption bold tag="span">{{ item[itemText] }}</farm-caption>
|
|
44
44
|
</farm-listitem>
|
|
45
|
-
<farm-listitem
|
|
45
|
+
<farm-listitem
|
|
46
|
+
v-if="
|
|
47
|
+
!items ||
|
|
48
|
+
items.length === 0 ||
|
|
49
|
+
(showFilteredItems && filteredItems.length === 0)
|
|
50
|
+
"
|
|
51
|
+
>
|
|
46
52
|
{{ noDataText }}
|
|
47
53
|
</farm-listitem>
|
|
48
54
|
</farm-list>
|
|
@@ -60,12 +66,16 @@
|
|
|
60
66
|
@keyup="onKeyUp"
|
|
61
67
|
autocomplete="off"
|
|
62
68
|
/>
|
|
63
|
-
<farm-icon
|
|
69
|
+
<farm-icon
|
|
70
|
+
color="gray"
|
|
71
|
+
:class="{ 'farm-icon--rotate': isVisible }"
|
|
72
|
+
@click="addFocusToInput"
|
|
73
|
+
>
|
|
64
74
|
menu-down
|
|
65
75
|
</farm-icon>
|
|
66
76
|
</div>
|
|
67
77
|
</template>
|
|
68
|
-
</farm-contextmenu>
|
|
78
|
+
</farm-contextmenu>
|
|
69
79
|
<farm-caption v-if="showErrorText" color="error" variation="regular">
|
|
70
80
|
{{ errorBucket[0] }}
|
|
71
81
|
</farm-caption>
|
|
@@ -79,12 +89,26 @@
|
|
|
79
89
|
{{ hint }}
|
|
80
90
|
</farm-caption>
|
|
81
91
|
</div>
|
|
82
|
-
<farm-textfield-v2
|
|
92
|
+
<farm-textfield-v2
|
|
93
|
+
v-else
|
|
94
|
+
v-model="selectedText"
|
|
95
|
+
:disabled="disabled"
|
|
96
|
+
:readonly="readonly"
|
|
97
|
+
/>
|
|
83
98
|
</div>
|
|
84
99
|
</template>
|
|
85
100
|
|
|
86
101
|
<script lang="ts">
|
|
87
|
-
import {
|
|
102
|
+
import {
|
|
103
|
+
computed,
|
|
104
|
+
onBeforeMount,
|
|
105
|
+
onMounted,
|
|
106
|
+
PropType,
|
|
107
|
+
ref,
|
|
108
|
+
toRefs,
|
|
109
|
+
watch,
|
|
110
|
+
defineComponent,
|
|
111
|
+
} from 'vue';
|
|
88
112
|
import validateFormStateBuilder from '../../composition/validateFormStateBuilder';
|
|
89
113
|
import validateFormFieldBuilder from '../../composition/validateFormFieldBuilder';
|
|
90
114
|
import validateFormMethodBuilder from '../../composition/validateFormMethodBuilder';
|
|
@@ -235,7 +259,7 @@ export default defineComponent({
|
|
|
235
259
|
filteredItems,
|
|
236
260
|
inputField,
|
|
237
261
|
} = useSelectAutoComplete(props);
|
|
238
|
-
|
|
262
|
+
|
|
239
263
|
const listRef = ref();
|
|
240
264
|
|
|
241
265
|
const contextmenu = ref(null);
|
|
@@ -252,9 +276,9 @@ export default defineComponent({
|
|
|
252
276
|
const customId = 'farm-select-' + (props.id || randomId(2));
|
|
253
277
|
|
|
254
278
|
const showErrorText = computed(() => hasError.value && isTouched.value);
|
|
255
|
-
|
|
279
|
+
|
|
256
280
|
const searchText = ref('');
|
|
257
|
-
|
|
281
|
+
|
|
258
282
|
const filterOptions = () => {
|
|
259
283
|
searchText.value = selectedText.value.toLowerCase();
|
|
260
284
|
if (!searchText || searchText.value.includes('+')) {
|
|
@@ -262,19 +286,19 @@ export default defineComponent({
|
|
|
262
286
|
return;
|
|
263
287
|
}
|
|
264
288
|
|
|
265
|
-
filteredItems.value = items.value.filter(
|
|
266
|
-
|
|
289
|
+
filteredItems.value = items.value.filter(item =>
|
|
290
|
+
item[itemText.value].toLowerCase().includes(searchText.value)
|
|
267
291
|
);
|
|
268
292
|
|
|
269
293
|
if (filteredItems.value.length === 0 && searchText.value.trim() !== '') {
|
|
270
294
|
filteredItems.value = [];
|
|
271
295
|
}
|
|
272
296
|
};
|
|
273
|
-
|
|
297
|
+
|
|
274
298
|
const showFilteredItems = computed(() => {
|
|
275
299
|
return isVisible.value && searchText.value.trim() !== '';
|
|
276
300
|
});
|
|
277
|
-
|
|
301
|
+
|
|
278
302
|
watch(
|
|
279
303
|
() => props.value,
|
|
280
304
|
newValue => {
|
|
@@ -323,13 +347,11 @@ export default defineComponent({
|
|
|
323
347
|
validate(innerValue.value);
|
|
324
348
|
}
|
|
325
349
|
);
|
|
326
|
-
|
|
327
350
|
|
|
328
|
-
const handleOutsideClick =
|
|
351
|
+
const handleOutsideClick = event => {
|
|
329
352
|
clearSearchAndReturnSelection(event);
|
|
330
|
-
|
|
331
353
|
};
|
|
332
|
-
|
|
354
|
+
|
|
333
355
|
onBeforeMount(() => {
|
|
334
356
|
validate(innerValue.value);
|
|
335
357
|
updateSelectedTextValue();
|
|
@@ -359,18 +381,17 @@ export default defineComponent({
|
|
|
359
381
|
isBlured.value = true;
|
|
360
382
|
validate(innerValue.value);
|
|
361
383
|
emit('blur', event);
|
|
362
|
-
|
|
384
|
+
|
|
363
385
|
setTimeout(() => {
|
|
364
|
-
if (multiple.value){
|
|
386
|
+
if (multiple.value) {
|
|
365
387
|
searchText.value = '';
|
|
366
388
|
addLabelToMultiple();
|
|
367
389
|
return;
|
|
368
390
|
}
|
|
369
391
|
}, 100);
|
|
370
|
-
|
|
371
392
|
};
|
|
372
393
|
|
|
373
|
-
const clearSearchAndReturnSelection =
|
|
394
|
+
const clearSearchAndReturnSelection = event => {
|
|
374
395
|
if (!event.srcElement.className.includes('farm-listitem')) {
|
|
375
396
|
if (innerValue.value !== null) {
|
|
376
397
|
if (!selectedText.value) {
|
|
@@ -383,12 +404,10 @@ export default defineComponent({
|
|
|
383
404
|
};
|
|
384
405
|
|
|
385
406
|
const onFocus = (focus: boolean) => {
|
|
386
|
-
|
|
387
407
|
isFocus.value = focus;
|
|
388
408
|
};
|
|
389
409
|
|
|
390
410
|
const selectItem = item => {
|
|
391
|
-
|
|
392
411
|
if (multiple.value) {
|
|
393
412
|
const alreadyAdded = multipleValues.value.findIndex(
|
|
394
413
|
val => val === item[itemValue.value]
|
|
@@ -414,7 +433,6 @@ export default defineComponent({
|
|
|
414
433
|
};
|
|
415
434
|
|
|
416
435
|
const clickInput = () => {
|
|
417
|
-
|
|
418
436
|
isTouched.value = true;
|
|
419
437
|
emit('click');
|
|
420
438
|
};
|
|
@@ -470,9 +488,9 @@ export default defineComponent({
|
|
|
470
488
|
multipleValues.value.findIndex(val => val === item[itemValue.value]) !== -1
|
|
471
489
|
);
|
|
472
490
|
};
|
|
473
|
-
|
|
491
|
+
|
|
474
492
|
const onInput = () => {
|
|
475
|
-
isVisible.value = true;
|
|
493
|
+
isVisible.value = true;
|
|
476
494
|
};
|
|
477
495
|
|
|
478
496
|
function onKeyUp(event) {
|
|
@@ -522,7 +540,7 @@ export default defineComponent({
|
|
|
522
540
|
filteredItems,
|
|
523
541
|
showFilteredItems,
|
|
524
542
|
searchText,
|
|
525
|
-
handleOutsideClick
|
|
543
|
+
handleOutsideClick,
|
|
526
544
|
};
|
|
527
545
|
},
|
|
528
546
|
});
|