@farm-investimentos/front-mfe-components 11.0.2 → 11.1.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 +443 -264
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +2 -2
- package/dist/front-mfe-components.umd.js +443 -264
- 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/Collapsible/Collapsible.vue +1 -1
- package/src/components/ContextMenu/ContextMenu.scss +32 -0
- package/src/components/ContextMenu/ContextMenu.stories.js +104 -0
- package/src/components/ContextMenu/ContextMenu.vue +129 -0
- package/src/components/ContextMenu/__tests__/ContextMenu.spec.js +20 -0
- package/src/components/ContextMenu/index.ts +5 -0
- package/src/components/DataTablePaginator/DataTablePaginator.scss +5 -4
- package/src/components/DataTablePaginator/DataTablePaginator.stories.js +5 -5
- package/src/components/FilePicker/FilePicker.vue +1 -2
- package/src/components/Icon/Icon.scss +9 -4
- package/src/components/Icon/Icon.stories.js +4 -3
- package/src/components/Icon/Icon.vue +6 -5
- package/src/components/IconBox/IconBox.scss +5 -4
- package/src/components/IconBox/IconBox.stories.js +2 -1
- package/src/components/IconBox/IconBox.vue +15 -5
- package/src/components/IconBox/__tests__/IconBox.spec.js +1 -1
- package/src/components/IdCaption/IdCaption.vue +1 -1
- package/src/components/TableContextMenu/TableContextMenu.scss +16 -2
- package/src/components/TableContextMenu/TableContextMenu.stories.js +17 -4
- package/src/components/TableContextMenu/TableContextMenu.vue +39 -36
- package/src/main.ts +1 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<div class="collapsible__header" @click="onToggleCollapsible(status)">
|
|
5
5
|
<div class="collapsible__content-title">
|
|
6
6
|
<div class="collapsible__icon collapsible__icon--main" v-if="icon !== ''">
|
|
7
|
-
<farm-icon
|
|
7
|
+
<farm-icon size="md">
|
|
8
8
|
{{ icon }}
|
|
9
9
|
</farm-icon>
|
|
10
10
|
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@import '../../configurations/mixins';
|
|
2
|
+
|
|
3
|
+
.farm-contextmenu {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.farm-contextmenu__popup {
|
|
8
|
+
visibility: hidden;
|
|
9
|
+
opacity: 0;
|
|
10
|
+
position: absolute;
|
|
11
|
+
display: block;
|
|
12
|
+
overflow-y: auto;
|
|
13
|
+
overflow-x: hidden;
|
|
14
|
+
contain: content;
|
|
15
|
+
font-family: 'Montserrat', sans-serif !important;
|
|
16
|
+
|
|
17
|
+
transform-origin: left top;
|
|
18
|
+
transition: visibility 0.1s linear, opacity 0.1s linear;
|
|
19
|
+
|
|
20
|
+
border-radius: 4px;
|
|
21
|
+
left: 0;
|
|
22
|
+
|
|
23
|
+
background: #FFFFFF;
|
|
24
|
+
border: 1px solid var(--farm-stroke-base);
|
|
25
|
+
@include addShadow;
|
|
26
|
+
border-radius: 5px;
|
|
27
|
+
|
|
28
|
+
&--visible {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
visibility: visible;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
import ContextMenu from './';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Interactions/ContextMenu',
|
|
6
|
+
component: ContextMenu,
|
|
7
|
+
decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `ContextMenu<br />
|
|
12
|
+
selector: <em>farm-contextmenu</em><br />
|
|
13
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
14
|
+
`,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
viewMode: 'docs',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Primary = () => ({
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
value: false,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
toggleValue() {
|
|
29
|
+
this.value = !this.value;
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
template: `<div style="padding-left: 120px; padding-top: 80px; display: flex;">
|
|
33
|
+
<farm-contextmenu v-model="value">
|
|
34
|
+
some text
|
|
35
|
+
<template v-slot:activator="{ on, attrs }">
|
|
36
|
+
<farm-btn @click="toggleValue">toggle</farm-btn>
|
|
37
|
+
</template>
|
|
38
|
+
</farm-contextmenu>
|
|
39
|
+
</div>`,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const LongContent = () => ({
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
value: false,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
methods: {
|
|
49
|
+
toggleValue() {
|
|
50
|
+
this.value = !this.value;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
template: `<div style="padding-left: 120px; padding-top: 80px;">
|
|
54
|
+
<farm-contextmenu v-model="value">
|
|
55
|
+
<div style="width: 160px">long content<br />
|
|
56
|
+
with breakline</div>
|
|
57
|
+
<template v-slot:activator="{ on, attrs }">
|
|
58
|
+
<farm-btn @click="toggleValue">toggle</farm-btn>
|
|
59
|
+
</template>
|
|
60
|
+
</farm-contextmenu>
|
|
61
|
+
</div>`,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const Bottom = () => ({
|
|
65
|
+
data() {
|
|
66
|
+
return {
|
|
67
|
+
value: false,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
toggleValue() {
|
|
72
|
+
this.value = !this.value;
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
template: `<div style="padding-left: 120px; padding-top: 80px; display: flex;">
|
|
76
|
+
<farm-contextmenu v-model="value" :bottom="true">
|
|
77
|
+
some text
|
|
78
|
+
<template v-slot:activator="{ on, attrs }">
|
|
79
|
+
<farm-btn @click="toggleValue">toggle</farm-btn>
|
|
80
|
+
</template>
|
|
81
|
+
</farm-contextmenu>
|
|
82
|
+
</div>`,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const ComplexContent = () => ({
|
|
86
|
+
data() {
|
|
87
|
+
return {
|
|
88
|
+
value: false,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
methods: {
|
|
92
|
+
toggleValue() {
|
|
93
|
+
this.value = !this.value;
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
template: `<div style="padding-left: 120px; padding-top: 80px; display: flex;">
|
|
97
|
+
<farm-contextmenu v-model="value">
|
|
98
|
+
<farm-chip>farm chip</farm-chip>
|
|
99
|
+
<template v-slot:activator="{ on, attrs }">
|
|
100
|
+
<farm-btn @click="toggleValue">toggle</farm-btn>
|
|
101
|
+
</template>
|
|
102
|
+
</farm-contextmenu>
|
|
103
|
+
</div>`,
|
|
104
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="farm-contextmenu" ref="parent">
|
|
3
|
+
<span ref="activator">
|
|
4
|
+
<slot name="activator"></slot>
|
|
5
|
+
</span>
|
|
6
|
+
|
|
7
|
+
<div
|
|
8
|
+
ref="popup"
|
|
9
|
+
:class="{
|
|
10
|
+
'farm-contextmenu__popup': true,
|
|
11
|
+
'farm-contextmenu__popup--visible': inputValue,
|
|
12
|
+
}"
|
|
13
|
+
:style="styles"
|
|
14
|
+
>
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import Vue, { onMounted, ref, watch, reactive, onBeforeUnmount, toRefs } from 'vue';
|
|
21
|
+
|
|
22
|
+
export default Vue.extend({
|
|
23
|
+
name: 'farm-contextmenu',
|
|
24
|
+
props: {
|
|
25
|
+
/**
|
|
26
|
+
* Control visibility
|
|
27
|
+
* v-model bind
|
|
28
|
+
*/
|
|
29
|
+
value: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: undefined,
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Aligns the component towards the bottom
|
|
35
|
+
*/
|
|
36
|
+
bottom: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
setup(props, { emit }) {
|
|
42
|
+
const parent = ref(null);
|
|
43
|
+
const popup = ref(null);
|
|
44
|
+
const activator = ref(null);
|
|
45
|
+
const styles = reactive({ minWidth: 0, top: 0 } as any);
|
|
46
|
+
const { bottom } = toRefs(props);
|
|
47
|
+
|
|
48
|
+
const inputValue = ref(props.value);
|
|
49
|
+
|
|
50
|
+
let hasBeenBoostrapped = false;
|
|
51
|
+
|
|
52
|
+
const outClick = (event: Event) => {
|
|
53
|
+
if (activator && !activator.value.contains(event.target)) {
|
|
54
|
+
emit('input', false);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const resizeWindowHandler = () => {
|
|
59
|
+
calculatePosition();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
watch(
|
|
63
|
+
() => props.value,
|
|
64
|
+
newValue => {
|
|
65
|
+
if (newValue) {
|
|
66
|
+
if (!hasBeenBoostrapped) {
|
|
67
|
+
document.querySelector('body').appendChild(popup.value);
|
|
68
|
+
|
|
69
|
+
hasBeenBoostrapped = true;
|
|
70
|
+
}
|
|
71
|
+
window.addEventListener('click', outClick);
|
|
72
|
+
window.addEventListener('resize', resizeWindowHandler);
|
|
73
|
+
|
|
74
|
+
calculatePosition();
|
|
75
|
+
} else {
|
|
76
|
+
window.removeEventListener('click', outClick);
|
|
77
|
+
}
|
|
78
|
+
inputValue.value = newValue;
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const calculatePosition = () => {
|
|
83
|
+
const parentBoundingClientRect = parent.value.getBoundingClientRect();
|
|
84
|
+
const popupClientRect = popup.value.getBoundingClientRect();
|
|
85
|
+
|
|
86
|
+
const offsetTop =
|
|
87
|
+
parentBoundingClientRect.top +
|
|
88
|
+
window.scrollY +
|
|
89
|
+
(!bottom.value ? 0 : parentBoundingClientRect.height);
|
|
90
|
+
|
|
91
|
+
let offsetLeft = parentBoundingClientRect.left;
|
|
92
|
+
if (popupClientRect.width > parentBoundingClientRect.width) {
|
|
93
|
+
offsetLeft =
|
|
94
|
+
offsetLeft + parentBoundingClientRect.width / 2 - popupClientRect.width / 2;
|
|
95
|
+
}
|
|
96
|
+
styles.minWidth =
|
|
97
|
+
parentBoundingClientRect.width > 96
|
|
98
|
+
? parseInt(parentBoundingClientRect.width)
|
|
99
|
+
: 96 + 'px';
|
|
100
|
+
styles.top = offsetTop + 'px';
|
|
101
|
+
styles.left = offsetLeft + 'px';
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
onMounted(() => {
|
|
105
|
+
calculatePosition();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
onBeforeUnmount(() => {
|
|
109
|
+
if (hasBeenBoostrapped) {
|
|
110
|
+
window.removeEventListener('resize', resizeWindowHandler);
|
|
111
|
+
window.removeEventListener('click', outClick);
|
|
112
|
+
document.querySelector('body').removeChild(popup.value);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
parent,
|
|
118
|
+
popup,
|
|
119
|
+
activator,
|
|
120
|
+
styles,
|
|
121
|
+
inputValue,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<style lang="scss" scoped>
|
|
128
|
+
@import './ContextMenu';
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import ContextMenu from '../ContextMenu';
|
|
3
|
+
|
|
4
|
+
describe('ContextMenu component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(ContextMenu, {});
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Created hook', () => {
|
|
12
|
+
expect(wrapper).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('mount component', () => {
|
|
16
|
+
it('renders correctly', () => {
|
|
17
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -13,10 +13,11 @@ ul.farm-paginator {
|
|
|
13
13
|
display: flex;
|
|
14
14
|
|
|
15
15
|
button {
|
|
16
|
-
border: 1px solid var(--
|
|
16
|
+
border: 1px solid var(--farm-stroke-base);
|
|
17
17
|
border-right: 0;
|
|
18
18
|
height: 36px;
|
|
19
|
-
width: 36px;
|
|
19
|
+
min-width: 36px;
|
|
20
|
+
padding-inline: 4px;
|
|
20
21
|
display: inline-flex;
|
|
21
22
|
justify-content: center;
|
|
22
23
|
align-items: center;
|
|
@@ -30,7 +31,7 @@ ul.farm-paginator {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
&:last-child button {
|
|
33
|
-
border-right: 1px solid var(--
|
|
34
|
+
border-right: 1px solid var(--farm-stroke-base);
|
|
34
35
|
border-radius: 0 4px 4px 0;
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -63,5 +64,5 @@ ul.farm-paginator {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
.farm-paginator--gutter {
|
|
66
|
-
margin:
|
|
67
|
+
margin: 16px 24px 0;
|
|
67
68
|
}
|
|
@@ -28,23 +28,23 @@ export const Primary = () => ({
|
|
|
28
28
|
totalPages: 8,
|
|
29
29
|
};
|
|
30
30
|
},
|
|
31
|
-
template: '<
|
|
31
|
+
template: '<farm-datatable-paginator :totalPages="totalPages" :page="1" />',
|
|
32
32
|
mounted() {
|
|
33
33
|
setTimeout(() => {
|
|
34
|
-
this.totalPages =
|
|
34
|
+
this.totalPages = 2;
|
|
35
35
|
}, 1000);
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
export const Secondary = () => ({
|
|
40
|
-
template: '<
|
|
40
|
+
template: '<farm-datatable-paginator :hidePerPageOptions="true" :totalPages="190000" :page="1" />',
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
export const Disabled = () => ({
|
|
44
|
-
template: '<
|
|
44
|
+
template: '<farm-datatable-paginator :disabled="true":totalPages="19" :page="1" />',
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
export const CustomPerPage = () => ({
|
|
48
48
|
template:
|
|
49
|
-
'<
|
|
49
|
+
'<farm-datatable-paginator :perPageOptions="[1, 2, 4, 12, 27]" :totalPages="19" :page="1" />',
|
|
50
50
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:accept="acceptedFileTypes"
|
|
8
8
|
/>
|
|
9
9
|
<div v-if="!selectedFile" class="selectfile-container">
|
|
10
|
-
<farm-icon
|
|
10
|
+
<farm-icon>cloud-upload</farm-icon>
|
|
11
11
|
<p>Clique para selecionar ou arraste o arquivo aqui</p>
|
|
12
12
|
</div>
|
|
13
13
|
<div v-if="selectedFile || maxSizeReach" class="reset-container">
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
<farm-btn
|
|
23
23
|
outlined
|
|
24
|
-
color="secondary"
|
|
25
24
|
class="farm-btn--responsive"
|
|
26
25
|
title="Escolher outro"
|
|
27
26
|
@click="reset"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '../../configurations/variables';
|
|
2
|
+
@import '../../configurations/theme-colors';
|
|
2
3
|
|
|
3
4
|
.farm-icon {
|
|
4
5
|
align-items: center;
|
|
@@ -10,16 +11,20 @@
|
|
|
10
11
|
position: relative;
|
|
11
12
|
text-indent: 0;
|
|
12
13
|
|
|
13
|
-
@each $color in $colors {
|
|
14
|
-
&#{'
|
|
15
|
-
color: var(--
|
|
14
|
+
@each $color in $theme-colors-list {
|
|
15
|
+
&#{'--' + $color} {
|
|
16
|
+
color: var(--farm-#{$color}-base);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
&--gray-base {
|
|
21
|
+
color: var(--farm-neutral-darken);
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
@each $size,
|
|
20
25
|
$value in $sizes {
|
|
21
26
|
&#{'.farm-icon[size=' + $size +']'} {
|
|
22
27
|
font-size: $value;
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
|
-
}
|
|
30
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import
|
|
2
|
+
import baseThemeColors from '../../configurations/_theme-colors-base.scss';
|
|
3
|
+
const colors = Object.keys(baseThemeColors);
|
|
3
4
|
import sizes from '../../configurations/sizes';
|
|
4
5
|
import iconsList from './icons_list';
|
|
5
6
|
|
|
@@ -22,7 +23,7 @@ export default {
|
|
|
22
23
|
|
|
23
24
|
export const Atom = () => ({
|
|
24
25
|
template: `<div class="icons-container">
|
|
25
|
-
<farm-icon color="
|
|
26
|
+
<farm-icon color="primary">
|
|
26
27
|
book
|
|
27
28
|
</farm-icon>
|
|
28
29
|
</div>`,
|
|
@@ -31,7 +32,7 @@ export const Atom = () => ({
|
|
|
31
32
|
export const Colors = () => ({
|
|
32
33
|
data() {
|
|
33
34
|
return {
|
|
34
|
-
colors,
|
|
35
|
+
colors: [...colors, 'gray'],
|
|
35
36
|
};
|
|
36
37
|
},
|
|
37
38
|
template: `<div class="icons-container">
|
|
@@ -18,14 +18,15 @@ export default Vue.extend({
|
|
|
18
18
|
type: String as PropType<
|
|
19
19
|
| 'primary'
|
|
20
20
|
| 'secondary'
|
|
21
|
-
| '
|
|
22
|
-
| 'extra'
|
|
23
|
-
| 'accent'
|
|
21
|
+
| 'neutral'
|
|
24
22
|
| 'info'
|
|
25
23
|
| 'success'
|
|
24
|
+
| 'error'
|
|
25
|
+
| 'warning'
|
|
26
|
+
| 'success'
|
|
27
|
+
| 'extra-1'
|
|
28
|
+
| 'extra-2'
|
|
26
29
|
| 'gray'
|
|
27
|
-
| 'yellow'
|
|
28
|
-
| 'white'
|
|
29
30
|
>,
|
|
30
31
|
default: 'primary',
|
|
31
32
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '../../configurations/variables';
|
|
2
|
+
@import '../../configurations/theme-colors';
|
|
2
3
|
|
|
3
4
|
.farm-icon-box {
|
|
4
5
|
width: 48px;
|
|
@@ -8,17 +9,17 @@
|
|
|
8
9
|
justify-content: center;
|
|
9
10
|
align-items: center;
|
|
10
11
|
|
|
11
|
-
@each $color in $colors {
|
|
12
|
+
@each $color in $theme-colors-list {
|
|
12
13
|
&#{'--' + $color} {
|
|
13
|
-
background: var(--
|
|
14
|
+
background: var(--farm-#{$color}-lighten);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
.farm-icon-box--inverted.farm-icon-box {
|
|
19
|
-
@each $color in $colors {
|
|
20
|
+
@each $color in $theme-colors-list {
|
|
20
21
|
&#{'--' + $color} {
|
|
21
|
-
background: var(--
|
|
22
|
+
background: var(--farm-#{$color}-base);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { withDesign } from 'storybook-addon-designs';
|
|
2
2
|
import IconBox from './IconBox';
|
|
3
|
-
import
|
|
3
|
+
import baseThemeColors from '../../configurations/_theme-colors-base.scss';
|
|
4
|
+
const colors = Object.keys(baseThemeColors);
|
|
4
5
|
import sizes from '../../configurations/sizes';
|
|
5
6
|
import('../Icon/Icons.stories.scss');
|
|
6
7
|
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
}"
|
|
8
8
|
:size="size"
|
|
9
9
|
>
|
|
10
|
-
<farm-icon :color="inverted ? 'white' : color" :size="size">{{
|
|
11
|
-
iconParsed
|
|
12
|
-
}}</farm-icon>
|
|
10
|
+
<farm-icon :color="inverted ? 'white' : color" :size="size">{{ iconParsed }}</farm-icon>
|
|
13
11
|
</div>
|
|
14
12
|
</template>
|
|
15
13
|
|
|
@@ -30,8 +28,20 @@ export default Vue.extend({
|
|
|
30
28
|
* Color
|
|
31
29
|
*/
|
|
32
30
|
color: {
|
|
33
|
-
type: String
|
|
34
|
-
|
|
31
|
+
type: String as PropType<
|
|
32
|
+
| 'primary'
|
|
33
|
+
| 'secondary'
|
|
34
|
+
| 'neutral'
|
|
35
|
+
| 'info'
|
|
36
|
+
| 'success'
|
|
37
|
+
| 'error'
|
|
38
|
+
| 'warning'
|
|
39
|
+
| 'success'
|
|
40
|
+
| 'extra-1'
|
|
41
|
+
| 'extra-2'
|
|
42
|
+
| 'gray'
|
|
43
|
+
>,
|
|
44
|
+
default: 'primary',
|
|
35
45
|
},
|
|
36
46
|
size: {
|
|
37
47
|
type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
border-bottom: 1px solid var(--farm-
|
|
1
|
+
.v-list-item.v-list-item--link {
|
|
2
|
+
border-bottom: 1px solid var(--farm-stroke-base);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.v-list-item__title {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
::v-deep .v-application--wrap {
|
|
13
|
+
min-height: auto;
|
|
14
|
+
font-family: 'Montserrat', sans-serif !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.farm-listitem {
|
|
18
|
+
padding: auto 8px;
|
|
19
|
+
|
|
6
20
|
.farm-icon {
|
|
7
21
|
vertical-align: sub;
|
|
8
22
|
margin-right: 8px;
|
|
@@ -23,13 +23,13 @@ export default {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const Primary = () => ({
|
|
26
|
-
template: `<div>
|
|
26
|
+
template: `<div style="padding-left: 80px">
|
|
27
27
|
<farm-context-menu :items="[{ label: 'Remover', icon: { color: 'error', type: 'open-in-new' } }]" />
|
|
28
28
|
</div>`,
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
export const Icons = () => ({
|
|
32
|
-
template: `<div>
|
|
32
|
+
template: `<div style="padding-left: 80px">
|
|
33
33
|
<farm-context-menu
|
|
34
34
|
ref="icons"
|
|
35
35
|
:items="[{ label: 'Remover', icon: { color: 'error', type: 'delete' } }]"
|
|
@@ -41,13 +41,26 @@ export const Multi = () => ({
|
|
|
41
41
|
data() {
|
|
42
42
|
return {
|
|
43
43
|
items: [
|
|
44
|
-
{ label: 'Novo', icon: {
|
|
44
|
+
{ label: 'Novo', icon: { type: 'open-in-new' } },
|
|
45
45
|
{ label: 'Editar', icon: { color: 'secondary', type: 'open-in-new' } },
|
|
46
46
|
{ label: 'Remover', icon: { color: 'error', type: 'delete' } },
|
|
47
47
|
],
|
|
48
48
|
};
|
|
49
49
|
},
|
|
50
|
-
template: `<div>
|
|
50
|
+
template: `<div style="padding-left: 80px">
|
|
51
51
|
<farm-context-menu ref="multi" :items="items" />
|
|
52
52
|
</div>`,
|
|
53
53
|
});
|
|
54
|
+
|
|
55
|
+
export const ClickHandler = () => ({
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
editItem: () => {
|
|
59
|
+
alert('Click handler');
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
template: `<div style="padding-left: 80px">
|
|
64
|
+
<farm-context-menu :items="[{ label: 'Click me', icon: { type: 'open-in-new' }, handler: 'edit' }]" @edit="editItem()" />
|
|
65
|
+
</div>`,
|
|
66
|
+
});
|