@farm-investimentos/front-mfe-components 15.9.0 → 15.10.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": "15.9.0",
3
+ "version": "15.10.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -73,5 +73,8 @@
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=14.0.0 <15.0.0"
76
+ },
77
+ "volta": {
78
+ "node": "14.21.3"
76
79
  }
77
80
  }
@@ -27,4 +27,12 @@ export const CustomTitles = () => ({
27
27
 
28
28
  export const NoBorder = () => ({
29
29
  template: '<farm-emptywrapper :bordered="false" />',
30
+ });
31
+
32
+ export const Icon = () => ({
33
+ template: '<farm-emptywrapper icon="alert" :bordered="false" />',
34
+ });
35
+
36
+ export const CustomHTML = () => ({
37
+ template: `<farm-emptywrapper subtitle="Para finalizar ou alterar a parametrização <b style='color: #4f8406;'>clique aqui</b>" icon="alert-outline" :bordered="false" />`,
30
38
  });
@@ -5,13 +5,11 @@
5
5
  'farm-emptywrapper--bordered': bordered,
6
6
  }"
7
7
  >
8
- <farm-icon size="xl" color="gray">magnify</farm-icon>
8
+ <farm-icon size="xl" color="gray">{{ icon }}</farm-icon>
9
9
  <farm-bodytext type="2" variation="bold" color="black" color-variation="40">
10
10
  {{ title }}
11
11
  </farm-bodytext>
12
- <farm-caption v-if="subtitle" variation="regular" color-variation="30">
13
- {{ subtitle }}
14
- </farm-caption>
12
+ <farm-caption v-html="subtitle" v-if="subtitle" variation="regular" color-variation="30" />
15
13
  </div>
16
14
  </template>
17
15
  <script lang="ts">
@@ -42,6 +40,10 @@ export default defineComponent({
42
40
  type: Boolean,
43
41
  default: true,
44
42
  },
43
+ icon: {
44
+ type: String,
45
+ default: 'magnify',
46
+ }
45
47
  },
46
48
  });
47
49
  </script>
@@ -61,7 +61,6 @@ export default [
61
61
  'alpha',
62
62
  'alphabetical',
63
63
  'altimeter',
64
-
65
64
  'ambulance',
66
65
  'amplifier',
67
66
  'anchor',
@@ -182,6 +181,7 @@ export default [
182
181
  'arrow-up-drop-circle-outline',
183
182
  'arrow-up-thick',
184
183
  'artist',
184
+ 'assessment',
185
185
  'assistant',
186
186
  'asterisk',
187
187
  'at',
@@ -1954,6 +1954,7 @@ export default [
1954
1954
  'rowing',
1955
1955
  'rss',
1956
1956
  'rss-box',
1957
+ 'rule',
1957
1958
  'ruler',
1958
1959
  'run',
1959
1960
  'run-fast',
@@ -14,7 +14,6 @@
14
14
  }
15
15
 
16
16
  &__body {
17
-
18
17
  display: flex;
19
18
  flex-direction: column;
20
19
  justify-content: space-between;
@@ -26,7 +25,6 @@
26
25
  }
27
26
 
28
27
  .farm-typography {
29
-
30
28
  margin-bottom: 0;
31
29
  display: flex;
32
30
  flex: none;
@@ -34,7 +32,7 @@
34
32
  align-items: center;
35
33
  height: 18px;
36
34
 
37
- >span {
35
+ > span {
38
36
  max-width: 100%;
39
37
  @include ellipsis;
40
38
  }
@@ -48,4 +46,10 @@
48
46
  &.farm-idcaption--noheight {
49
47
  min-height: auto;
50
48
  }
51
- }
49
+
50
+ .farm-idcaption--hide-copy-btn {
51
+ .farm-tooltip:has(.mdi-content-copy) {
52
+ display: none;
53
+ }
54
+ }
55
+ }
@@ -23,11 +23,11 @@ export default {
23
23
  };
24
24
 
25
25
  export const Primary = () => ({
26
- methods: {
27
- onLinkClick() {
28
- alert('onLinkClick');
29
- }
30
- },
26
+ methods: {
27
+ onLinkClick() {
28
+ alert('onLinkClick');
29
+ },
30
+ },
31
31
  template: `
32
32
  <farm-idcaption
33
33
  icon="account-box-outline"
@@ -62,6 +62,24 @@ export const Linkless = () => ({
62
62
  `,
63
63
  });
64
64
 
65
+ export const CopyBtnHidden = () => ({
66
+ template: `
67
+ <farm-idcaption
68
+ icon="account-box-outline"
69
+ copyText="texto a copiar"
70
+ hide-copy-btn
71
+ >
72
+ <template v-slot:title>
73
+ Upper Line Text
74
+ </template>
75
+ <template v-slot:subtitle>
76
+ Lower:Line Text
77
+ </template>
78
+ </farm-idcaption>
79
+
80
+ `,
81
+ });
82
+
65
83
  export const Iconless = () => ({
66
84
  template: `
67
85
  <farm-idcaption
@@ -221,4 +239,4 @@ export const NoHeight = () => ({
221
239
  </template>
222
240
  </farm-idcaption>
223
241
  </farm-col>`,
224
- });
242
+ });
@@ -41,7 +41,7 @@
41
41
  <slot name="subtitle"></slot>
42
42
  </span>
43
43
  <farm-copytoclipboard
44
- v-if="copyText"
44
+ v-if="copyText && !hideCopyBtn"
45
45
  sizeIcon="16px"
46
46
  :toCopy="copyText"
47
47
  :successMessage="successMessage"
@@ -126,6 +126,13 @@ export default defineComponent({
126
126
  type: String,
127
127
  default: 'Conteúdo copiado para a área de trabalho',
128
128
  },
129
+ /**
130
+ * Hides copy button
131
+ */
132
+ hideCopyBtn: {
133
+ type: Boolean,
134
+ default: false,
135
+ },
129
136
  /**
130
137
  * Tooltip color
131
138
  */
@@ -154,11 +161,11 @@ export default defineComponent({
154
161
  },
155
162
  },
156
163
 
157
- setup(_, { slots }) {
164
+ setup({ hideCopyBtn }, { slots }) {
158
165
  const hasTitle = computed(() => slots.title);
159
166
  const hasSubtitle = computed(() => slots.subtitle);
160
167
 
161
- return { hasSubtitle, hasTitle };
168
+ return { hasSubtitle, hasTitle, hideCopyBtn };
162
169
  },
163
170
  });
164
171
  </script>
@@ -69,7 +69,7 @@
69
69
  &--horizontal {
70
70
  flex-direction: column;
71
71
  height: auto;
72
- width: 158px;
72
+ max-width: 230px;
73
73
 
74
74
  > div {
75
75
  align-items: center;
@@ -93,3 +93,44 @@ export const disabled = () => ({
93
93
  date: {{ date }}
94
94
  </div>`,
95
95
  });
96
+
97
+ export const ValidacaoInputPadrao = () => ({
98
+ data() {
99
+ return {
100
+ date: null,
101
+ };
102
+ },
103
+ template: `<div style='max-width: 320px'>
104
+ <farm-label>Selecione uma data entre 01/01/2024 e 31/12/2024</farm-label>
105
+ <RangeDatePicker
106
+ inputId="input-custom-id"
107
+ v-model="date"
108
+ min="2024-01-01"
109
+ max="2024-12-31"
110
+ validateInput
111
+ required
112
+ />
113
+ date: {{ date }}
114
+ </div>`,
115
+ });
116
+
117
+ export const ValidacaoInputCustomizada = () => ({
118
+ data() {
119
+ return {
120
+ date: null,
121
+ };
122
+ },
123
+ template: `<div style='max-width: 320px'>
124
+ <farm-label>Selecione uma data do primeiro semestre de 2024</farm-label>
125
+ <RangeDatePicker
126
+ inputId="input-custom-id"
127
+ v-model="date"
128
+ min="2024-01-01"
129
+ max="2024-06-30"
130
+ validateInput
131
+ required
132
+ outOfRangeMessage="Por favor, selecione datas dentro do primeiro semestre de 2024 ({min} até {max})"
133
+ />
134
+ date: {{ date }}
135
+ </div>`,
136
+ });
@@ -1,4 +1,4 @@
1
- <template>
1
+ <template>
2
2
  <farm-contextmenu
3
3
  stay-open
4
4
  v-model="menuField"
@@ -48,7 +48,7 @@
48
48
  :readonly="readonly"
49
49
  :id="inputId"
50
50
  :mask="`${readonly ? [''] : ['##/##/####' + ' a ' + '##/##/####']}`"
51
- :rules="[checkDateValid, checkRequire]"
51
+ :rules="[checkDateValid, checkRequire, ...(validateInput ? [checkMinMax] : [])]"
52
52
  :disabled="disabled"
53
53
  @keyup="keyUpInput"
54
54
  />
@@ -123,6 +123,20 @@ export default defineComponent({
123
123
  type: Boolean,
124
124
  default: false,
125
125
  },
126
+ /**
127
+ * Habilita a validação de min/max no input
128
+ */
129
+ validateInput: {
130
+ type: Boolean,
131
+ default: false,
132
+ },
133
+ /**
134
+ * Mensagem de erro customizada para data fora do período permitido
135
+ */
136
+ outOfRangeMessage: {
137
+ type: String,
138
+ default: 'A data selecionada deve ser entre {min} e {max}',
139
+ },
126
140
  },
127
141
  data() {
128
142
  const s = this.formatDateRange(this.value);
@@ -141,6 +155,31 @@ export default defineComponent({
141
155
  }
142
156
  return true;
143
157
  },
158
+ checkMinMax: value => {
159
+ if (!this.validateInput || !value || value.length === 0) return true;
160
+ if (!this.min || !this.max) {
161
+ if (process.env.NODE_ENV === 'development') {
162
+ console.warn('[RangeDatePicker] Para usar validateInput é necessário definir as props min e max');
163
+ }
164
+ return true;
165
+ }
166
+
167
+ const [startDate, endDate] = value.split(' a ').map(date => {
168
+ const [day, month, year] = date.split('/');
169
+ return new Date(year, month - 1, day);
170
+ });
171
+
172
+ const minDate = new Date(this.min);
173
+ const maxDate = new Date(this.max);
174
+
175
+ if (startDate < minDate || endDate > maxDate) {
176
+ return this.outOfRangeMessage
177
+ .replace('{min}', dateDefaultFormatter(this.min))
178
+ .replace('{max}', dateDefaultFormatter(this.max));
179
+ }
180
+
181
+ return true;
182
+ },
144
183
  };
145
184
  },
146
185
  watch: {