@farm-investimentos/front-mfe-components 15.3.2 → 15.3.4

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": "15.3.2",
3
+ "version": "15.3.4",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -26,7 +26,39 @@ export const Title = () => ({
26
26
 
27
27
  export const Icon = () => ({
28
28
  template:
29
- '<farm-collapsible icon="plus" title="With Icon">collapsible content</farm-collapsible>',
29
+ '<farm-collapsible icon="clipboard" title="With Icon">collapsible content</farm-collapsible>',
30
+ });
31
+
32
+ export const ColorIcons = () => ({
33
+ data() {
34
+ return {
35
+ colors,
36
+ };
37
+ },
38
+ template: `
39
+ <farm-row>
40
+ <farm-col cols="12" md="4" v-for="color in colors" :key="'color_' + color">
41
+ <h4 style="margin:15px">{{ color }}</h4>
42
+ <farm-collapsible
43
+ style="margin-top:15px"
44
+ icon="clipboard"
45
+ title="color icon"
46
+ :colorIcon="color"
47
+ >
48
+ </farm-collapsible>
49
+ </farm-col>
50
+ </farm-row>`,
51
+ });
52
+
53
+ export const Export = () => ({
54
+ data() {
55
+ return {
56
+ clicked: false,
57
+ };
58
+ },
59
+ template: `<div>
60
+ clicked: {{clicked}} <farm-collapsible icon="clipboard" title="With Button" :hasButton="true" @onClick="value => clicked = !clicked" >collapsible content</farm-collapsible>
61
+ </div>`,
30
62
  });
31
63
 
32
64
  export const Opened = () => ({
@@ -110,7 +142,9 @@ export const Dense = () => ({
110
142
  Primary.storyName = 'Basic';
111
143
  Title.storyName = 'Title';
112
144
  Icon.storyName = 'Icon';
145
+ Export.storyName = 'Export';
113
146
  Opened.storyName = 'Opened';
114
- ColorsChips.storyName = 'Colors';
147
+ ColorIcons.storyName = 'Icon Colors';
148
+ ColorsChips.storyName = 'Chip Colors';
115
149
  ColorsOutlinedChips.storyName = 'Outlined';
116
150
  Dense.storyName = 'Dense';
@@ -4,13 +4,16 @@
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 size="md" color="secondary-green">
7
+ <farm-icon size="md" :color="colorIcon">
8
8
  {{ icon }}
9
9
  </farm-icon>
10
10
  </div>
11
11
  <farm-heading type="6" color="black">
12
12
  {{ title }}
13
13
  </farm-heading>
14
+ <farm-btn outlined class="ml-6" v-if="hasButton" @click.stop="onClick()">
15
+ {{ labelButton }}
16
+ </farm-btn>
14
17
  </div>
15
18
  <div class="collapsible__content-right">
16
19
  <div class="collapsible__icon" v-if="showChip">
@@ -82,6 +85,27 @@ export default defineComponent({
82
85
  type: String,
83
86
  default: '',
84
87
  },
88
+ /**
89
+ * has butotn
90
+ */
91
+ hasButton: {
92
+ type: Boolean,
93
+ default: false,
94
+ },
95
+ /**
96
+ * export button
97
+ */
98
+ onExport: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+ /**
103
+ * label button
104
+ */
105
+ labelButton: {
106
+ type: String,
107
+ default: 'Exportar',
108
+ },
85
109
  /**
86
110
  * color of Chip
87
111
  */
@@ -101,6 +125,25 @@ export default defineComponent({
101
125
  >,
102
126
  default: 'primary',
103
127
  },
128
+ colorIcon: {
129
+ type: String as PropType<
130
+ | 'primary'
131
+ | 'secondary'
132
+ | 'secondary-green'
133
+ | 'secondary-golden'
134
+ | 'neutral'
135
+ | 'info'
136
+ | 'success'
137
+ | 'error'
138
+ | 'warning'
139
+ | 'extra-1'
140
+ | 'extra-2'
141
+ >,
142
+ default: 'secondary-green',
143
+ },
144
+ /**
145
+ * Is dense
146
+ */
104
147
  dense: {
105
148
  type: Boolean,
106
149
  default: false,
@@ -112,6 +155,9 @@ export default defineComponent({
112
155
  type: Boolean,
113
156
  default: false,
114
157
  },
158
+ /**
159
+ * Is variation
160
+ */
115
161
  variation: {
116
162
  type: String,
117
163
  default: 'base',
@@ -134,6 +180,9 @@ export default defineComponent({
134
180
  this.status = !status;
135
181
  this.$emit('open', this.status);
136
182
  },
183
+ onClick(): void {
184
+ this.$emit('onClick');
185
+ },
137
186
  },
138
187
  });
139
188
  </script>
@@ -121,11 +121,17 @@ export default defineComponent({
121
121
  return this.required ? !!value || value != '' || 'Campo obrigatório' : true;
122
122
  },
123
123
  checkMax: value => {
124
+ if(!this.required && value.length === 0) {
125
+ return true;
126
+ }
124
127
  return this.max && new Date(convertDate(value)) > new Date(this.max)
125
128
  ? 'A data está fora do período permitido'
126
129
  : true;
127
130
  },
128
131
  checkMin: value => {
132
+ if(!this.required && value.length === 0) {
133
+ return true;
134
+ }
129
135
  if(this.min) {
130
136
  const dateSelected = new Date(convertDate(value));
131
137
  const dateMin = new Date(convertDate(this.min));