@farm-investimentos/front-mfe-components 9.1.0 → 9.2.0
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 +243 -118
- 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 +243 -118
- 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/DatePicker/DatePicker.vue +8 -1
- package/src/components/Icon/Icon.scss +1 -1
- package/src/components/Icon/Icon.stories.js +17 -13
- package/src/components/Icon/Icons.stories.scss +17 -0
- package/src/components/Icon/icons_list.ts +2566 -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: {
|
|
@@ -136,7 +136,9 @@ export default Vue.extend({
|
|
|
136
136
|
timeZone: 'America/Sao_Paulo',
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
console.log(this.getUniversalDate(locatedSelectedDate), this.getUniversalDate(locatedMinDate));
|
|
140
|
+
|
|
141
|
+
return this.min && this.getUniversalDate(locatedSelectedDate) < this.getUniversalDate(locatedMinDate)
|
|
140
142
|
? 'A data está fora do período permitido'
|
|
141
143
|
: true;
|
|
142
144
|
},
|
|
@@ -174,6 +176,11 @@ export default Vue.extend({
|
|
|
174
176
|
this.save();
|
|
175
177
|
}
|
|
176
178
|
},
|
|
179
|
+
getUniversalDate(d) {
|
|
180
|
+
const onlyDMY = d.split(' ')[0];
|
|
181
|
+
const arr = onlyDMY.split('/');
|
|
182
|
+
return new Date(arr[2], arr[1] -1, arr[0]);
|
|
183
|
+
},
|
|
177
184
|
},
|
|
178
185
|
computed: {
|
|
179
186
|
inputVal: {
|
|
@@ -2,6 +2,7 @@ import { withDesign } from 'storybook-addon-designs';
|
|
|
2
2
|
import Icon from './Icon';
|
|
3
3
|
import colors from '../../configurations/colors';
|
|
4
4
|
import sizes from '../../configurations/sizes';
|
|
5
|
+
import iconsList from './icons_list';
|
|
5
6
|
|
|
6
7
|
import('./Icons.stories.scss');
|
|
7
8
|
|
|
@@ -26,10 +27,7 @@ export const Atom = () => ({
|
|
|
26
27
|
</div>`,
|
|
27
28
|
});
|
|
28
29
|
|
|
29
|
-
export const
|
|
30
|
-
components: {
|
|
31
|
-
'farm-icon': Icon,
|
|
32
|
-
},
|
|
30
|
+
export const Colors = () => ({
|
|
33
31
|
data() {
|
|
34
32
|
return {
|
|
35
33
|
colors,
|
|
@@ -43,9 +41,6 @@ export const Icons = () => ({
|
|
|
43
41
|
});
|
|
44
42
|
|
|
45
43
|
export const Sizes = () => ({
|
|
46
|
-
components: {
|
|
47
|
-
'farm-icon': Icon,
|
|
48
|
-
},
|
|
49
44
|
data() {
|
|
50
45
|
return {
|
|
51
46
|
sizes,
|
|
@@ -85,9 +80,18 @@ export const Sizes = () => ({
|
|
|
85
80
|
</div>`,
|
|
86
81
|
});
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
83
|
+
export const ListOfIcons = () => ({
|
|
84
|
+
data() {
|
|
85
|
+
return {
|
|
86
|
+
iconsList: [...iconsList],
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
template: `<div class="icons-container__list">
|
|
90
|
+
<div v-for="icon of iconsList" :key="'icon_' + icon">
|
|
91
|
+
<farm-icon>
|
|
92
|
+
{{ icon }}
|
|
93
|
+
</farm-icon>
|
|
94
|
+
<span>{{ icon }}</span>
|
|
95
|
+
</div>
|
|
96
|
+
</div>`,
|
|
97
|
+
});
|
|
@@ -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
|
}
|