@farm-investimentos/front-mfe-components 11.2.2 → 11.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "11.2.2",
3
+ "version": "11.3.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -10,7 +10,13 @@ export const Primary = () => ({
10
10
  });
11
11
 
12
12
  export const List = () => ({
13
- template: `<farm-btn-multipleimport :optionsList="[{ listenerKey: 1, title: 'XLS teste'}, { listenerKey: 2, title: 'CSV teste novo'}]" />`,
13
+ methods: {
14
+ listener(key) {
15
+ alert('Handler for item ' + key);
16
+ },
17
+ },
18
+ template: `<farm-btn-multipleimport
19
+ :optionsList="[{ listenerKey: 1, title: 'XLS teste'}, { listenerKey: 2, title: 'CSV teste novo'}]"
20
+ @onClick="listener"
21
+ />`,
14
22
  });
15
-
16
- List.storyName = 'Lista';
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!--
2
3
  <v-menu content-class="elevation-1" v-model="togglePopover" :offset-y="true" :rounded="'b t-0'">
3
4
  <template v-slot:activator="{ on, attrs }">
4
5
  <farm-btn
@@ -39,39 +40,60 @@
39
40
  </v-list-item>
40
41
  </v-list>
41
42
  </v-menu>
43
+ -->
44
+ <farm-contextmenu v-model="value" :bottom="true">
45
+ <template v-slot:activator="{}">
46
+ <farm-btn outlined title="Importar" color="secondary" @click="toggleValue">
47
+ Importar
48
+ <farm-icon class="ml-2"> chevron-{{ value ? 'up' : 'down' }} </farm-icon>
49
+ </farm-btn>
50
+ </template>
51
+ <farm-list>
52
+ <farm-listitem
53
+ v-for="item in optionsList"
54
+ clickable
55
+ hoverColor="primary"
56
+ hoverColorVariation="lighten"
57
+ :key="'importbutton_key_' + item.title"
58
+ :title="item.title"
59
+ @click="onClick(item.listenerKey)"
60
+ >
61
+ <farm-caption bold tag="span">{{ item.title }}</farm-caption>
62
+ </farm-listitem>
63
+ </farm-list>
64
+ </farm-contextmenu>
42
65
  </template>
43
- <script>
44
- import Vue from 'vue';
45
- import VList from 'vuetify/lib/components/VList/VList';
46
- import VMenu from 'vuetify/lib/components/VMenu';
47
- import VListItem from 'vuetify/lib/components/VList/VListItem';
48
- import { VListItemContent, VListItemTitle } from 'vuetify/lib';
66
+ <script lang="ts">
67
+ import Vue, { PropType } from 'vue';
68
+
69
+ export interface IImportOption {
70
+ title: String;
71
+ listenerKey: String;
72
+ }
49
73
 
50
74
  export default Vue.extend({
51
75
  name: 'farm-btn-multipleimport',
52
- components: {
53
- VList,
54
- VListItem,
55
- VMenu,
56
- VListItemContent,
57
- VListItemTitle,
58
- },
59
76
  props: {
60
77
  /**
61
- * Lista de opções para o menu dropdown
78
+ * Options list
62
79
  */
63
80
  optionsList: {
64
- type: Array,
81
+ type: Array as PropType<Array<IImportOption>>,
65
82
  default: () => [],
66
83
  },
67
84
  },
68
85
  data() {
69
86
  return {
70
- togglePopover: false,
87
+ value: false,
71
88
  };
72
89
  },
90
+ methods: {
91
+ onClick(key) {
92
+ this.$emit('onClick', key);
93
+ },
94
+ toggleValue() {
95
+ this.value = !this.value;
96
+ },
97
+ },
73
98
  });
74
99
  </script>
75
- <style scoped lang="scss">
76
- @import './MultiImportButton.scss';
77
- </style>
@@ -15,5 +15,6 @@ export const Primary = () => ({
15
15
  <farm-chip-invite :status="15" />
16
16
  <farm-chip-invite :status="16" />
17
17
  <farm-chip-invite :status="17" />
18
+ <farm-chip-invite :status="18" />
18
19
  </div>`,
19
20
  });
@@ -1,50 +1,18 @@
1
1
  <template>
2
- <v-chip
3
- small
4
- :class="
5
- `status-chip ${
6
- isFull ? 'status-chip--fullwidth' : ''
7
- } status-chip-${color} status-chip--onboarding`
8
- "
2
+ <farm-chip
3
+ :color="obj.color"
4
+ :outlined="obj.outlined"
5
+ :variation="obj.variation"
6
+ :dense="!isFull"
9
7
  >
10
- <span :class="`${textColor}--text`">
11
- {{ label }}
12
- </span>
13
- </v-chip>
8
+ {{ obj.label }}
9
+ </farm-chip>
14
10
  </template>
15
- <script>
11
+ <script lang="ts">
16
12
  import Vue from 'vue';
17
- const StatusLabel = {
18
- 10: 'CONVIDAR',
19
- 11: 'CONVIDADO',
20
- 12: 'INCOMPLETO',
21
- 13: 'CONCLUÍDO',
22
- 14: 'FALHA/ERRO',
23
- 15: 'EM ANÁLISE',
24
- 16: 'EM ANDAMENTO',
25
- 17: 'EM ESPERA',
26
- 18: 'DECLINADO'
27
- };
28
-
29
- const StatusColor = {
30
- 10: 'secondary',
31
- 11: 'yellow',
32
- 12: 'yellow',
33
- 13: 'success',
34
- 14: 'error',
35
- 15: 'accent',
36
- 16: 'primary',
37
- 17: 'on-wait',
38
- 18: 'error',
39
- };
40
-
41
- import VChip from 'vuetify/lib/components/VChip/';
42
-
13
+ import keys from './keys';
43
14
  export default Vue.extend({
44
15
  name: 'farm-chip-invite',
45
- components: {
46
- VChip,
47
- },
48
16
  props: {
49
17
  /**
50
18
  * Invite status
@@ -58,24 +26,13 @@ export default Vue.extend({
58
26
  */
59
27
  isFull: {
60
28
  type: Boolean,
61
- default: true,
29
+ default: false,
62
30
  },
63
31
  },
64
32
  computed: {
65
- textColor() {
66
- return this.status === 10 || this.status === 16 || this.status === 17
67
- ? ''
68
- : StatusColor[this.status];
69
- },
70
- color() {
71
- return !this.status ? '' : StatusColor[this.status];
72
- },
73
- label() {
74
- return StatusLabel[this.status];
33
+ obj() {
34
+ return keys[this.status];
75
35
  },
76
36
  },
77
37
  });
78
38
  </script>
79
- <style lang="scss" scoped>
80
- @import './ChipInviteStatus.scss';
81
- </style>
@@ -21,16 +21,4 @@ describe('ChipInviteStatus component', () => {
21
21
  expect(wrapper.element).toMatchSnapshot();
22
22
  });
23
23
  });
24
-
25
- describe('Computed properties', () => {
26
- it('Should have text color', () => {
27
- expect(component.textColor).toBeDefined();
28
- });
29
- it('Should have color', () => {
30
- expect(component.color).toBeDefined();
31
- });
32
- it('Should have label', () => {
33
- expect(component.label).toBeDefined();
34
- });
35
- });
36
24
  });
@@ -0,0 +1,11 @@
1
+ export default {
2
+ 10: { label: 'Convidar', color: 'primary' },
3
+ 11: { label: 'Convidado', color: 'warning', outlined: true },
4
+ 12: { label: 'Incompleto', color: 'warning', outlined: true },
5
+ 13: { label: 'Concluído', color: 'primary', outlined: true },
6
+ 14: { label: 'Falha/Erro', color: 'error', outlined: true },
7
+ 15: { label: 'Em Análise', color: 'info', outlined: true },
8
+ 16: { label: 'Em Andamento', color: 'secondary', variation: 'darken' },
9
+ 17: { label: 'Em Espera', color: 'secondary' },
10
+ 18: { label: 'Declinado', color: 'error', outlined: true },
11
+ };
@@ -1,31 +0,0 @@
1
- .status-chip--onboarding {
2
- font-weight: bold;
3
- .status-chip-yellow {
4
- color: black;
5
- }
6
- &.status-chip.status-chip-accent {
7
- color: var(--v-accent-base) !important;
8
- border: 2px solid var(--v-accent-base) !important;
9
- background-color: white !important;
10
- }
11
- &.status-chip.status-chip-yellow {
12
- color: black !important;
13
- border: 2px solid var(--v-yellow-lighten1) !important;
14
- background-color: white !important;
15
- }
16
- &.status-chip.status-chip-error {
17
- color: var(--v-error-base) !important;
18
- border: 2px solid var(--v-error-base) !important;
19
- background-color: white !important;
20
- }
21
- &.status-chip.status-chip-success {
22
- color: var(--v-secondary-base) !important;
23
- border: 2px solid var(--v-success-base) !important;
24
- background-color: white !important;
25
- }
26
- &.status-chip.status-chip-on-wait {
27
- color: white !important;
28
- border: 2px solid #467d7e !important;
29
- background-color: #467d7e !important;
30
- }
31
- }