@farm-investimentos/front-mfe-components 3.2.0 → 3.4.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": "3.2.0",
3
+ "version": "3.4.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -0,0 +1,17 @@
1
+ .v-btn.v-btn--import {
2
+ background: var(--v-extra-lighten2);
3
+ color: var(--v-gray-lighten5);
4
+ .v-icon {
5
+ margin-right: 1rem;
6
+ }
7
+ }
8
+
9
+ .v-list-item {
10
+ border-bottom: 1px solid var(--v-gray-lighten2);
11
+ &:last-child {
12
+ border-bottom: none;
13
+ }
14
+ }
15
+ .v-list-item--link {
16
+ font-size: 0.875rem;
17
+ }
@@ -0,0 +1,19 @@
1
+ import MultiImport from './MultiImportButton.vue';
2
+
3
+ export default {
4
+ title: 'Example/Buttons/MultiImport',
5
+ component: MultiImport,
6
+ };
7
+
8
+ export const Primary = () => ({
9
+ components: { MultiImport },
10
+ template: '<MultiImport />',
11
+ });
12
+
13
+ export const List = () => ({
14
+ components: { MultiImport },
15
+ template: `<MultiImport :optionsList="[{ listenerKey: 1, title: 'XLS teste'}, { listenerKey: 2, title: 'CSV teste novo'}]" />`,
16
+ });
17
+
18
+ Primary.storyName = 'Básico';
19
+ List.storyName = 'Lista';
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <v-menu
3
+ content-class="elevation-1"
4
+ v-model="togglePopover"
5
+ :offset-y="true"
6
+ :rounded="'b t-0'"
7
+ >
8
+ <template v-slot:activator="{ on, attrs }">
9
+ <v-btn
10
+ v-bind="attrs"
11
+ v-on="on"
12
+ dense
13
+ @onClick="togglePopover = true"
14
+ class="v-btn--responsive v-btn--import"
15
+ outlined
16
+ title="Importar"
17
+ >
18
+ Importar
19
+ <v-icon class="ml-2 mr-0">
20
+ {{ togglePopover ? 'mdi-chevron-up' : 'mdi-chevron-down' }}
21
+ </v-icon>
22
+ </v-btn>
23
+ </template>
24
+
25
+ <v-list dense class="pa-0">
26
+ <v-list-item
27
+ v-for="option in optionsList"
28
+ :key="option.listenerKey"
29
+ link
30
+ :title="option.title"
31
+ @click="$emit('onClick', option.listenerKey)"
32
+ >
33
+ <v-list-item-content>
34
+ <v-list-item-title>{{ option.title }}</v-list-item-title>
35
+ </v-list-item-content>
36
+ </v-list-item>
37
+ </v-list>
38
+ </v-menu>
39
+ </template>
40
+ <script>
41
+ import Vue from 'vue';
42
+ import VBtn from 'vuetify/lib/components/VBtn';
43
+ import VIcon from 'vuetify/lib/components/VIcon';
44
+ import VList from 'vuetify/lib/components/VList/VList';
45
+ import VMenu from 'vuetify/lib/components/VMenu';
46
+ import VListItem from 'vuetify/lib/components/VList/VListItem';
47
+ import { VListItemContent, VListItemTitle } from 'vuetify/lib';
48
+
49
+ export default Vue.extend({
50
+ name: 'farm-btn-multipleimport',
51
+ components: {
52
+ VBtn,
53
+ VIcon,
54
+ VList,
55
+ VListItem,
56
+ VMenu,
57
+ VListItemContent,
58
+ VListItemTitle,
59
+ },
60
+ props: {
61
+ /**
62
+ * Lista de opções para o menu dropdown
63
+ */
64
+ optionsList: {
65
+ type: Array,
66
+ default: () => [],
67
+ },
68
+ },
69
+ data() {
70
+ return {
71
+ togglePopover: false,
72
+ };
73
+ },
74
+ });
75
+ </script>
76
+ <style scoped lang="scss">
77
+ @import './MultiImportButton.scss';
78
+ </style>
@@ -0,0 +1,16 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import MultiImportButton from '../MultiImportButton';
3
+
4
+ describe('MultiImportButton component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(MultiImportButton);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+ });
@@ -0,0 +1,4 @@
1
+ import MultiImportButton from './MultiImportButton';
2
+
3
+ export { MultiImportButton };
4
+ export default MultiImportButton;
@@ -0,0 +1,26 @@
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
+ }
@@ -0,0 +1,19 @@
1
+ import ChipInviteStatus from './ChipInviteStatus.vue';
2
+
3
+ export default {
4
+ title: 'Example/Onboarding/ChipInviteStatus',
5
+ component: ChipInviteStatus,
6
+ };
7
+
8
+ export const Primary = () => ({
9
+ components: { ChipInviteStatus },
10
+ template: `<div style="width: 120px;">
11
+ <ChipInviteStatus status="CONVIDAR" />
12
+ <ChipInviteStatus status="CONVIDADO" />
13
+ <ChipInviteStatus status="INCOMPLETO" />
14
+ <ChipInviteStatus status="CONCLUIDO" />
15
+ <ChipInviteStatus status="FALHA/ERRO" />
16
+ </div>`,
17
+ });
18
+
19
+ Primary.storyName = 'Básico';
@@ -0,0 +1,63 @@
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
+ "
9
+ >
10
+ <span :class="`${textColor}--text`">
11
+ {{ label }}
12
+ </span>
13
+ </v-chip>
14
+ </template>
15
+ <script>
16
+ import Vue from 'vue';
17
+ const StatusColor = {
18
+ CONVIDAR: 'secondary',
19
+ CONVIDADO: 'yellow',
20
+ INCOMPLETO: 'yellow',
21
+ CONCLUIDO: 'success',
22
+ 'FALHA/ERRO': 'error',
23
+ };
24
+
25
+ import VChip from 'vuetify/lib/components/VChip/';
26
+
27
+ export default Vue.extend({
28
+ name: 'farm-chip-invite',
29
+ components: {
30
+ VChip,
31
+ },
32
+ props: {
33
+ /**
34
+ * Invite status
35
+ */
36
+ status: {
37
+ type: String,
38
+ default: '',
39
+ },
40
+ /**
41
+ * Full width (from parent)
42
+ */
43
+ isFull: {
44
+ type: Boolean,
45
+ default: true,
46
+ },
47
+ },
48
+ computed: {
49
+ textColor() {
50
+ return this.status === 'CONVIDAR' ? '' : StatusColor[this.status];
51
+ },
52
+ color() {
53
+ return !this.status ? '' : StatusColor[this.status];
54
+ },
55
+ label() {
56
+ return this.status;
57
+ },
58
+ },
59
+ });
60
+ </script>
61
+ <style lang="scss" scoped>
62
+ @import './ChipInviteStatus.scss';
63
+ </style>
@@ -0,0 +1,36 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ChipInviteStatus from '../ChipInviteStatus.vue';
3
+ describe('ChipInviteStatus component', () => {
4
+ let wrapper;
5
+ let component;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(ChipInviteStatus, {
9
+ propsData: {
10
+ status: 'CONVIDAR',
11
+ },
12
+ });
13
+ component = wrapper.vm;
14
+ });
15
+ test('ChipInviteStatus created', () => {
16
+ expect(wrapper).toBeDefined();
17
+ });
18
+
19
+ describe('mount component', () => {
20
+ it('renders correctly', () => {
21
+ expect(wrapper.element).toMatchSnapshot();
22
+ });
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
+ });
@@ -0,0 +1,4 @@
1
+ import ChipInviteStatus from './ChipInviteStatus.vue';
2
+
3
+ export { ChipInviteStatus };
4
+ export default ChipInviteStatus;
@@ -1,19 +1,43 @@
1
1
  import DefaultTextField from './DefaultTextField.vue';
2
2
 
3
3
  export default {
4
- title: 'Example/Form/DefaultTextField',
5
- component: DefaultTextField,
4
+ title: 'Example/Form/DefaultTextField',
5
+ component: DefaultTextField,
6
6
  };
7
7
 
8
8
  export const Primary = () => ({
9
- components: { DefaultTextField },
10
- template: '<DefaultTextField :item="{ label: \'Nome do campo\'}" />',
9
+ components: { DefaultTextField },
10
+ data() {
11
+ return {
12
+ model: 'primary',
13
+ item: { label: 'Nome do campo', key: 'key' },
14
+ };
15
+ },
16
+ template: '<DefaultTextField v-model="model" :item="item" />',
11
17
  });
12
18
 
13
19
  export const Secondary = () => ({
14
- components: { DefaultTextField },
15
- template: '<DefaultTextField :item="{ label: \'Nome do campo\'} :required="true" />',
20
+ components: { DefaultTextField },
21
+ data() {
22
+ return {
23
+ model: 'secondary',
24
+ item: { label: 'Nome do campo', key: 'key' },
25
+ };
26
+ },
27
+ template: '<DefaultTextField :item="item" v-model="model" required="true" />',
28
+ });
29
+
30
+ export const ReadOnly = () => ({
31
+ components: { DefaultTextField },
32
+ data() {
33
+ return {
34
+ model: 'readonly',
35
+ item: { label: 'Nome do campo', key: 'key' },
36
+ };
37
+ },
38
+ template: '<DefaultTextField :item="item" v-model="model" :readonly="true" />',
16
39
  });
17
40
 
18
41
  Primary.storyName = 'Básico';
19
42
  Secondary.storyName = 'Label de obrigatório';
43
+ ReadOnly.storyName = 'Input readonly';
@@ -1,18 +1,19 @@
1
1
  <template>
2
2
  <v-col cols="12" sm="12" :md="item.md ? item.md : 2" class="v-col-fieldset-default pl-0">
3
- <label :for="`${forKey}-${item.key}`">
3
+ <label :for="inputId">
4
4
  {{ item.label }}
5
5
  <span class="required" v-if="required && !disabled">*</span>
6
6
  </label>
7
7
  <v-text-field
8
- :id="`${forKey}-${item.key}`"
9
8
  color="secondary"
10
9
  v-model="inputVal"
11
10
  outlined
12
11
  dense
13
12
  v-mask="`${mask ? mask : ''}`"
13
+ :id="inputId"
14
14
  :rules="inputRules"
15
15
  :disabled="disabled"
16
+ :readonly="readonly"
16
17
  ></v-text-field>
17
18
  </v-col>
18
19
  </template>
@@ -38,16 +39,20 @@ export default {
38
39
  forKey: {
39
40
  type: String,
40
41
  required: false,
42
+ default: 'form',
41
43
  },
42
44
  required: {
43
45
  type: Boolean,
44
46
  default: false,
45
- required: false,
46
47
  },
47
48
  mask: {
48
49
  type: String,
49
50
  default: null,
50
51
  },
52
+ readonly: {
53
+ type: Boolean,
54
+ default: false,
55
+ },
51
56
  },
52
57
  components: {
53
58
  VCol,
@@ -71,6 +76,9 @@ export default {
71
76
  }
72
77
  return [];
73
78
  },
79
+ inputId() {
80
+ return `${this.forKey}-${this.item.key}`;
81
+ },
74
82
  },
75
83
  };
76
84
  </script>
@@ -3,14 +3,16 @@ import DefaultTextField from '../DefaultTextField';
3
3
 
4
4
  describe('DefaultTextField component', () => {
5
5
  let wrapper;
6
+ let component;
6
7
 
7
8
  beforeEach(() => {
8
9
  wrapper = shallowMount(DefaultTextField, {
9
10
  propsData: {
10
- item: {},
11
+ item: { key: 'key' },
11
12
  value: false,
12
13
  },
13
14
  });
15
+ component = wrapper.vm;
14
16
  });
15
17
 
16
18
  test('Created hook', () => {
@@ -22,4 +24,10 @@ describe('DefaultTextField component', () => {
22
24
  expect(wrapper.element).toMatchSnapshot();
23
25
  });
24
26
  });
27
+
28
+ describe('Computed properties', () => {
29
+ it('Should have inputId', () => {
30
+ expect(component.inputId).toEqual('form-key');
31
+ });
32
+ });
25
33
  });
package/src/main.js CHANGED
@@ -51,8 +51,10 @@ export * from './components/Buttons/ExportButton/';
51
51
  export * from './components/Buttons/ImportButton/';
52
52
  export * from './components/Buttons/ToggleButton/';
53
53
  export * from './components/Buttons/RemoveButton/';
54
+ export * from './components/Buttons/MultiImportButton/';
54
55
  export * from './components/Logos/ProductLogo/';
55
56
  export * from './components/Logos/OriginatorLogo/';
56
57
  export * from './components/ResetTableRowSelection/';
57
58
  export * from './components/MultipleSelectShortener/';
58
59
  export * from './components/SelectModalOptions/';
60
+ export * from './components/ChipInviteStatus/';
@@ -24,7 +24,11 @@ $statusList: 'primary', 'secondary', 'accent', 'error', 'info', 'success', 'warn
24
24
  }
25
25
  &.status-chip-yellow {
26
26
  background-color: var(--v-yellow-base) !important;
27
- color: var(--v-gray-lighten5);
27
+ color: var(--v-gray-lighten3) !important;
28
28
  }
29
29
 
30
+ &.status-chip--fullwidth {
31
+ width: 100%;
32
+ justify-content: center;
33
+ }
30
34
  }