@farm-investimentos/front-mfe-components 11.2.2 → 11.3.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/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.1",
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,77 +1,57 @@
1
1
  <template>
2
- <v-menu content-class="elevation-1" v-model="togglePopover" :offset-y="true" :rounded="'b t-0'">
3
- <template v-slot:activator="{ on, attrs }">
4
- <farm-btn
5
- v-bind="attrs"
6
- v-on="on"
7
- dense
8
- class="farm-btn--responsive farm-btn--import"
9
- outlined
10
- color="secondary"
11
- title="Importar"
12
- @onClick="togglePopover = true"
13
- >
2
+ <farm-contextmenu v-model="value" :bottom="true">
3
+ <template v-slot:activator="{}">
4
+ <farm-btn outlined title="Importar" color="secondary" @click="toggleValue">
14
5
  Importar
15
- <i
16
- :class="{
17
- 'ml-2': true,
18
- 'mr-0': true,
19
- mdi: true,
20
- 'mdi-chevron-up': togglePopover,
21
- 'mdi-chevron-down': !togglePopover,
22
- }"
23
- >
24
- </i>
6
+ <farm-icon class="ml-2"> chevron-{{ value ? 'up' : 'down' }} </farm-icon>
25
7
  </farm-btn>
26
8
  </template>
27
-
28
- <v-list dense class="pa-0">
29
- <v-list-item
30
- v-for="option in optionsList"
31
- :key="option.listenerKey"
32
- link
33
- :title="option.title"
34
- @click="$emit('onClick', option.listenerKey)"
9
+ <farm-list>
10
+ <farm-listitem
11
+ v-for="item in optionsList"
12
+ clickable
13
+ hoverColor="primary"
14
+ hoverColorVariation="lighten"
15
+ :key="'importbutton_key_' + item.title"
16
+ :title="item.title"
17
+ @click="onClick(item.listenerKey)"
35
18
  >
36
- <v-list-item-content>
37
- <v-list-item-title>{{ option.title }}</v-list-item-title>
38
- </v-list-item-content>
39
- </v-list-item>
40
- </v-list>
41
- </v-menu>
19
+ <farm-caption bold tag="span">{{ item.title }}</farm-caption>
20
+ </farm-listitem>
21
+ </farm-list>
22
+ </farm-contextmenu>
42
23
  </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';
24
+ <script lang="ts">
25
+ import Vue, { PropType } from 'vue';
26
+
27
+ export interface IImportOption {
28
+ title: String;
29
+ listenerKey: String;
30
+ }
49
31
 
50
32
  export default Vue.extend({
51
33
  name: 'farm-btn-multipleimport',
52
- components: {
53
- VList,
54
- VListItem,
55
- VMenu,
56
- VListItemContent,
57
- VListItemTitle,
58
- },
59
34
  props: {
60
35
  /**
61
- * Lista de opções para o menu dropdown
36
+ * Options list
62
37
  */
63
38
  optionsList: {
64
- type: Array,
39
+ type: Array as PropType<Array<IImportOption>>,
65
40
  default: () => [],
66
41
  },
67
42
  },
68
43
  data() {
69
44
  return {
70
- togglePopover: false,
45
+ value: false,
71
46
  };
72
47
  },
48
+ methods: {
49
+ onClick(key) {
50
+ this.$emit('onClick', key);
51
+ },
52
+ toggleValue() {
53
+ this.value = !this.value;
54
+ },
55
+ },
73
56
  });
74
57
  </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
+ };
@@ -82,15 +82,18 @@ export default Vue.extend({
82
82
 
83
83
  const calculatePosition = () => {
84
84
  const parentBoundingClientRect = parent.value.getBoundingClientRect();
85
+ const activatorBoundingClientRect = activator.value.children[0].getBoundingClientRect();
85
86
  const popupClientRect = popup.value.getBoundingClientRect();
86
87
 
88
+ console.log(activatorBoundingClientRect);
89
+
87
90
  let offsetTop =
88
91
  parentBoundingClientRect.top +
89
92
  window.scrollY +
90
- (!bottom.value ? 0 : parentBoundingClientRect.height);
93
+ (!bottom.value ? 0 : activatorBoundingClientRect.height);
91
94
 
92
95
  let offsetLeft = parentBoundingClientRect.left;
93
- if (popupClientRect.width > parentBoundingClientRect.width) {
96
+ if (popupClientRect.width > activatorBoundingClientRect.width) {
94
97
  offsetLeft =
95
98
  offsetLeft + parentBoundingClientRect.width / 2 - popupClientRect.width / 2;
96
99
  }
@@ -4,7 +4,7 @@ import IdCaption from './';
4
4
  export default {
5
5
  title: 'Display/IdCaption',
6
6
  component: IdCaption,
7
- decorators: [withDesign],
7
+ decorators: [withDesign],
8
8
  parameters: {
9
9
  docs: {
10
10
  description: {
@@ -132,3 +132,20 @@ export const IconBoxCustomColor = () => ({
132
132
  </farm-idcaption>
133
133
  `,
134
134
  });
135
+
136
+ export const CustomTag = () => ({
137
+ template: `
138
+ <farm-idcaption
139
+ icon="account-box-outline"
140
+ copyText="texto a copiar"
141
+ :link="true"
142
+ >
143
+ <template v-slot:title>
144
+ <b>Upper Line Text</b>
145
+ </template>
146
+ <template v-slot:subtitle>
147
+ <b>Lower:</b> Line Text Line Text Line Text
148
+ </template>
149
+ </farm-idcaption>
150
+ `,
151
+ });
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <farm-caption variation="medium" v-if="hasTitle">
8
8
  <span>
9
- {{ $slots.title ? $slots.title[0].text : null }}
9
+ <slot name="title"></slot>
10
10
  <farm-btn icon color="gray" v-if="link" @click="$emit('onLinkClick')">
11
11
  <farm-icon size="xs">open-in-new</farm-icon>
12
12
  </farm-btn>
@@ -15,7 +15,7 @@
15
15
 
16
16
  <farm-caption variation="regular" color="gray" v-if="hasSubtitle">
17
17
  <span>
18
- {{ $slots.subtitle ? $slots.subtitle[0].text : null }}
18
+ <slot name="subtitle"></slot>
19
19
  <farm-copytoclipboard v-if="copyText" :toCopy="copyText" />
20
20
  </span>
21
21
  </farm-caption>
@@ -8,5 +8,5 @@ export default () => {
8
8
  all_z.map(x => Number(x))
9
9
  );
10
10
 
11
- return zIndex;
11
+ return zIndex > 5 ? zIndex : 5;
12
12
  };
@@ -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
- }