@farm-investimentos/front-mfe-components 9.1.1 → 9.2.1
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 +303 -148
- 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 +303 -148
- 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/ButtonToggle/ButtonToggle.scss +14 -0
- package/src/components/ButtonToggle/ButtonToggle.stories.js +49 -0
- package/src/components/ButtonToggle/ButtonToggle.vue +52 -0
- package/src/components/ButtonToggle/IButtonToggle.ts +5 -0
- package/src/components/ButtonToggle/__tests__/ButtonToggle.spec.js +18 -0
- package/src/components/ButtonToggle/index.ts +4 -0
- package/src/components/DataTableHeader/DataTableHeader.scss +5 -3
- package/src/components/DataTableHeader/DataTableHeader.vue +6 -7
- package/src/components/DataTablePaginator/DataTablePaginator.scss +5 -1
- package/src/components/DataTablePaginator/DataTablePaginator.vue +10 -3
- package/src/components/Icon/Icon.scss +1 -1
- package/src/components/Icon/Icon.stories.js +28 -14
- package/src/components/Icon/Icons.stories.scss +17 -0
- package/src/components/Icon/icons_list.ts +2566 -0
- package/src/components/Logger/Logger.stories.js +55 -0
- package/src/components/Logger/LoggerItem/ILoggerItem.ts +1 -0
- package/src/components/Logger/LoggerItem/LoggerItem.stories.js +40 -0
- package/src/components/Logger/LoggerItem/LoggerItem.vue +27 -2
- package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +40 -0
- package/src/examples/Modal.stories.js +0 -1
- package/src/examples/Table.stories.js +2 -0
- package/src/main.ts +1 -0
- package/src/scss/Sticky-table.scss +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import ButtonToggle from './ButtonToggle.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Interactions/Button Toggle',
|
|
5
|
+
component: ButtonToggle,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Button Toggle<br />
|
|
10
|
+
selector: <em>farm-button-toggle</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
design: {
|
|
15
|
+
type: 'figma',
|
|
16
|
+
url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=3772%3A5973',
|
|
17
|
+
},
|
|
18
|
+
viewMode: 'docs',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Primary = () => ({
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
buttons: [{ label: 'label 1' }, { label: 'label 2' }, { label: 'label 3' }],
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
template: `
|
|
29
|
+
<div>
|
|
30
|
+
<farm-button-toggle :buttons="buttons" />
|
|
31
|
+
</div>`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const BindModel = () => ({
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
buttons: [{ label: 'label 1' }, { label: 'label 2' }, { label: 'label 3' }],
|
|
38
|
+
currentItem: 1,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
template: `
|
|
42
|
+
<div>
|
|
43
|
+
<farm-button-toggle
|
|
44
|
+
v-model="currentItem"
|
|
45
|
+
:buttons="buttons"
|
|
46
|
+
/>
|
|
47
|
+
selected item: {{ currentItem }}
|
|
48
|
+
</div>`,
|
|
49
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="farm-button-toggle">
|
|
3
|
+
<farm-btn
|
|
4
|
+
v-for="(button, index) in buttons"
|
|
5
|
+
:key="`button_toggle_` + index"
|
|
6
|
+
:color="isSelected(index) ? 'secondary' : 'gray'"
|
|
7
|
+
:outlined="!isSelected(index)"
|
|
8
|
+
@click="setValue(index)"
|
|
9
|
+
>
|
|
10
|
+
{{ button.label }}
|
|
11
|
+
</farm-btn>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import Vue, { PropType, ref } from 'vue';
|
|
16
|
+
import IButtonToggle from './IButtonToggle';
|
|
17
|
+
export default Vue.extend({
|
|
18
|
+
name: 'farm-button-toggle',
|
|
19
|
+
props: {
|
|
20
|
+
/**
|
|
21
|
+
* Array of buttons
|
|
22
|
+
*/
|
|
23
|
+
buttons: {
|
|
24
|
+
type: Array as PropType<Array<IButtonToggle>>,
|
|
25
|
+
default: () => [],
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* v-model binding
|
|
29
|
+
*/
|
|
30
|
+
value: { default: null },
|
|
31
|
+
},
|
|
32
|
+
setup(props, { emit }) {
|
|
33
|
+
const inputVal = ref(props.value);
|
|
34
|
+
|
|
35
|
+
const setValue = (index: number) => {
|
|
36
|
+
inputVal.value = index;
|
|
37
|
+
emit('input', inputVal.value);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const isSelected = (index: number) => index === inputVal.value;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
inputVal,
|
|
44
|
+
setValue,
|
|
45
|
+
isSelected,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
<style lang="scss" scoped>
|
|
51
|
+
@import './ButtonToggle';
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import ButtonToggle from '../ButtonToggle.vue';
|
|
3
|
+
|
|
4
|
+
describe('ButtonToggle component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(ButtonToggle, {
|
|
9
|
+
propsData: {
|
|
10
|
+
buttons: [],
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('Created hook', () => {
|
|
16
|
+
expect(wrapper).toBeDefined();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
.header-text {
|
|
2
2
|
position: relative;
|
|
3
|
-
|
|
3
|
+
color: var(--v-primary-base);
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
.farm-icon {
|
|
4
6
|
position: absolute;
|
|
5
7
|
right: -20px;
|
|
6
8
|
top: -1px;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
.
|
|
10
|
-
&.
|
|
11
|
+
.farm-icon {
|
|
12
|
+
&.farm-icon--asc {
|
|
11
13
|
transform: rotateX(180deg);
|
|
12
14
|
}
|
|
13
15
|
}
|
|
@@ -21,15 +21,16 @@
|
|
|
21
21
|
<span class="header-text" v-if="!isTHDataTableSelect(item)">
|
|
22
22
|
{{ item.text }}
|
|
23
23
|
|
|
24
|
-
<
|
|
24
|
+
<farm-icon
|
|
25
25
|
v-if="item.sortable && sortClick[$index].show"
|
|
26
26
|
v-bind:class="[
|
|
27
|
-
sortClick[$index][item.value] ? '
|
|
27
|
+
sortClick[$index][item.value] ? 'farm-icon--desc' : 'farm-icon--asc',
|
|
28
28
|
]"
|
|
29
|
-
|
|
29
|
+
size="sm"
|
|
30
|
+
color="gray"
|
|
30
31
|
>
|
|
31
|
-
|
|
32
|
-
</
|
|
32
|
+
sort-descending
|
|
33
|
+
</farm-icon>
|
|
33
34
|
</span>
|
|
34
35
|
|
|
35
36
|
<span v-if="isTHDataTableSelect(item) && showCheckbox">
|
|
@@ -47,13 +48,11 @@
|
|
|
47
48
|
<script>
|
|
48
49
|
/* eslint-disable */
|
|
49
50
|
import Vue from 'vue';
|
|
50
|
-
import VIcon from 'vuetify/lib/components/VIcon';
|
|
51
51
|
import VSimpleCheckbox from 'vuetify/lib/components/VCheckbox/VSimpleCheckbox';
|
|
52
52
|
|
|
53
53
|
export default Vue.extend({
|
|
54
54
|
name: 'farm-datatable-header',
|
|
55
55
|
components: {
|
|
56
|
-
VIcon,
|
|
57
56
|
VSimpleCheckbox,
|
|
58
57
|
},
|
|
59
58
|
props: {
|
|
@@ -55,9 +55,13 @@ ul.farm-paginator {
|
|
|
55
55
|
display: flex;
|
|
56
56
|
flex-direction: row;
|
|
57
57
|
justify-content: space-between;
|
|
58
|
-
margin:
|
|
58
|
+
margin: 0;
|
|
59
59
|
|
|
60
60
|
&.hidden-perpageoptions {
|
|
61
61
|
justify-content: flex-end;
|
|
62
62
|
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.farm-paginator--gutter {
|
|
66
|
+
margin: 1rem 1.5rem 0;
|
|
63
67
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section
|
|
3
|
-
class="
|
|
4
|
-
|
|
3
|
+
:class="{
|
|
4
|
+
'v-data-table-custom-footer': true,
|
|
5
|
+
'hidden-perpageoptions': hidePerPageOptions,
|
|
6
|
+
'farm-paginator--gutter': hasGutter,
|
|
7
|
+
}"
|
|
5
8
|
>
|
|
6
9
|
<div v-if="!hidePerPageOptions">
|
|
7
10
|
<v-select
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
</li>
|
|
35
38
|
|
|
36
39
|
<li>
|
|
37
|
-
<button :disabled="currentPage === totalPages || disabled"
|
|
40
|
+
<button :disabled="currentPage === totalPages || disabled" @click="nextPage">
|
|
38
41
|
<farm-icon color="gray" size="sm">chevron-right</farm-icon>
|
|
39
42
|
</button>
|
|
40
43
|
</li>
|
|
@@ -89,6 +92,10 @@ export default Vue.extend({
|
|
|
89
92
|
type: Number,
|
|
90
93
|
default: 10,
|
|
91
94
|
},
|
|
95
|
+
hasGutter: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: true,
|
|
98
|
+
},
|
|
92
99
|
},
|
|
93
100
|
methods: {
|
|
94
101
|
range(from: number, to: number) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import Icon from './Icon';
|
|
3
2
|
import colors from '../../configurations/colors';
|
|
4
3
|
import sizes from '../../configurations/sizes';
|
|
4
|
+
import iconsList from './icons_list';
|
|
5
5
|
|
|
6
6
|
import('./Icons.stories.scss');
|
|
7
7
|
|
|
@@ -26,10 +26,7 @@ export const Atom = () => ({
|
|
|
26
26
|
</div>`,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
export const
|
|
30
|
-
components: {
|
|
31
|
-
'farm-icon': Icon,
|
|
32
|
-
},
|
|
29
|
+
export const Colors = () => ({
|
|
33
30
|
data() {
|
|
34
31
|
return {
|
|
35
32
|
colors,
|
|
@@ -43,9 +40,6 @@ export const Icons = () => ({
|
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
export const Sizes = () => ({
|
|
46
|
-
components: {
|
|
47
|
-
'farm-icon': Icon,
|
|
48
|
-
},
|
|
49
43
|
data() {
|
|
50
44
|
return {
|
|
51
45
|
sizes,
|
|
@@ -85,9 +79,29 @@ export const Sizes = () => ({
|
|
|
85
79
|
</div>`,
|
|
86
80
|
});
|
|
87
81
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
};
|
|
82
|
+
export const ListOfIcons = () => ({
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
iconsList: [...iconsList],
|
|
86
|
+
filterKey: '',
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
watch: {
|
|
90
|
+
filterKey(newValue) {
|
|
91
|
+
this.iconsList = [...iconsList].filter(
|
|
92
|
+
item => item.toLowerCase().indexOf(newValue.toLowerCase()) >= 0
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
template: `<div>
|
|
97
|
+
<farm-textfield v-model="filterKey" style="margin: 0 auto; width: 240px;" />
|
|
98
|
+
<div class="icons-container__list">
|
|
99
|
+
<div v-for="icon of iconsList" :key="'icon_' + icon">
|
|
100
|
+
<farm-icon>
|
|
101
|
+
{{ icon }}
|
|
102
|
+
</farm-icon>
|
|
103
|
+
<span>{{ icon }}</span>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>`,
|
|
107
|
+
});
|
|
@@ -11,4 +11,21 @@
|
|
|
11
11
|
margin-right: 1rem;
|
|
12
12
|
align-items: center;
|
|
13
13
|
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.icons-container__list {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
> div {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
width: 120px;
|
|
25
|
+
height: 100px;
|
|
26
|
+
text-align: center;
|
|
27
|
+
span {
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
14
31
|
}
|