@weni/unnnic-system 2.0.17 → 2.0.18
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/dist/style.css +1 -1
- package/dist/unnnic.mjs +4293 -4179
- package/dist/unnnic.umd.js +18 -18
- package/package.json +1 -1
- package/src/components/DatePicker/DatePicker.vue +51 -53
- package/src/components/DatePicker/translations.js +131 -0
- package/src/stories/DatePicker.stories.js +0 -43
- package/src/utils/plugins/i18n.js +1 -1
package/package.json
CHANGED
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
/>
|
|
20
20
|
|
|
21
21
|
<div :class="['label', `label--${size}`]">
|
|
22
|
-
{{
|
|
22
|
+
{{ monthsLocale[getMonth(openMonth)] }}
|
|
23
23
|
{{ getFullYear(openMonth) }}
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
27
|
<div :class="['days', `days--${size}`]">
|
|
28
28
|
<div
|
|
29
|
-
v-for="(day, index) in
|
|
29
|
+
v-for="(day, index) in daysLocale"
|
|
30
30
|
:key="index"
|
|
31
31
|
class="name"
|
|
32
32
|
>
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
date.properties.includes('inside month') && selectDate(date)
|
|
105
105
|
"
|
|
106
106
|
>
|
|
107
|
-
{{
|
|
107
|
+
{{ monthsLocale[getMonth(date)].substr(0, 3) }}
|
|
108
108
|
</div>
|
|
109
109
|
</div>
|
|
110
110
|
</div>
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
<div class="options">
|
|
177
177
|
<div
|
|
178
178
|
:class="['option', { selected: optionSelected === option.id }]"
|
|
179
|
-
v-for="(option, index) in
|
|
179
|
+
v-for="(option, index) in periodsLocale"
|
|
180
180
|
:key="index"
|
|
181
181
|
@click="autoSelect(option.id)"
|
|
182
182
|
>
|
|
@@ -187,14 +187,14 @@
|
|
|
187
187
|
<div class="actions">
|
|
188
188
|
<UnnnicButton
|
|
189
189
|
size="small"
|
|
190
|
-
:text="
|
|
190
|
+
:text="clearText"
|
|
191
191
|
type="tertiary"
|
|
192
192
|
@click="clear"
|
|
193
193
|
/>
|
|
194
194
|
|
|
195
195
|
<UnnnicButton
|
|
196
196
|
size="small"
|
|
197
|
-
:text="
|
|
197
|
+
:text="filterText"
|
|
198
198
|
type="secondary"
|
|
199
199
|
@click="$emit('submit', value)"
|
|
200
200
|
/>
|
|
@@ -204,9 +204,19 @@
|
|
|
204
204
|
</template>
|
|
205
205
|
|
|
206
206
|
<script>
|
|
207
|
+
import {
|
|
208
|
+
months as translationMonths,
|
|
209
|
+
days as translationDays,
|
|
210
|
+
periods as translationPeriods,
|
|
211
|
+
} from './translations.js';
|
|
212
|
+
|
|
213
|
+
import UnnnicI18n from '../../mixins/i18n';
|
|
214
|
+
|
|
207
215
|
import UnnnicButton from '../Button/Button.vue';
|
|
208
216
|
|
|
209
217
|
export default {
|
|
218
|
+
mixins: [UnnnicI18n],
|
|
219
|
+
|
|
210
220
|
components: {
|
|
211
221
|
UnnnicButton,
|
|
212
222
|
},
|
|
@@ -241,22 +251,7 @@ export default {
|
|
|
241
251
|
|
|
242
252
|
months: {
|
|
243
253
|
type: Array,
|
|
244
|
-
default()
|
|
245
|
-
return [
|
|
246
|
-
'Janeiro',
|
|
247
|
-
'Fevereiro',
|
|
248
|
-
'Março',
|
|
249
|
-
'Abril',
|
|
250
|
-
'Maio',
|
|
251
|
-
'Junho',
|
|
252
|
-
'Julho',
|
|
253
|
-
'Agosto',
|
|
254
|
-
'Setembro',
|
|
255
|
-
'Outubro',
|
|
256
|
-
'Novembro',
|
|
257
|
-
'Dezembro',
|
|
258
|
-
];
|
|
259
|
-
},
|
|
254
|
+
default: () => [],
|
|
260
255
|
validator(months) {
|
|
261
256
|
return months.length === 12;
|
|
262
257
|
},
|
|
@@ -264,9 +259,7 @@ export default {
|
|
|
264
259
|
|
|
265
260
|
days: {
|
|
266
261
|
type: Array,
|
|
267
|
-
default()
|
|
268
|
-
return ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];
|
|
269
|
-
},
|
|
262
|
+
default: () => [],
|
|
270
263
|
validator(days) {
|
|
271
264
|
return days.length === 7;
|
|
272
265
|
},
|
|
@@ -274,34 +267,7 @@ export default {
|
|
|
274
267
|
|
|
275
268
|
options: {
|
|
276
269
|
type: Array,
|
|
277
|
-
default()
|
|
278
|
-
return [
|
|
279
|
-
{
|
|
280
|
-
name: 'Últimos 7 dias',
|
|
281
|
-
id: 'last-7-days',
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
name: 'Últimos 14 dias',
|
|
285
|
-
id: 'last-14-days',
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
name: 'Últimos 30 dias',
|
|
289
|
-
id: 'last-30-days',
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
name: 'Últimos 12 meses',
|
|
293
|
-
id: 'last-12-months',
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: 'Mês Atual',
|
|
297
|
-
id: 'current-month',
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
name: 'Personalizar',
|
|
301
|
-
id: 'custom',
|
|
302
|
-
},
|
|
303
|
-
];
|
|
304
|
-
},
|
|
270
|
+
default: () => [],
|
|
305
271
|
},
|
|
306
272
|
},
|
|
307
273
|
|
|
@@ -314,6 +280,18 @@ export default {
|
|
|
314
280
|
startDate: (this.initialStartDate || '').replace(/-/g, ' '),
|
|
315
281
|
endDate: (this.initialEndDate || '').replace(/-/g, ' '),
|
|
316
282
|
optionSelected: '',
|
|
283
|
+
defaultTranslations: {
|
|
284
|
+
clean: {
|
|
285
|
+
'pt-br': 'Limpar',
|
|
286
|
+
en: 'Clean',
|
|
287
|
+
es: 'Limpiar',
|
|
288
|
+
},
|
|
289
|
+
filter: {
|
|
290
|
+
'pt-br': 'Filtrar',
|
|
291
|
+
en: 'Filter',
|
|
292
|
+
es: 'Filtrar',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
317
295
|
};
|
|
318
296
|
},
|
|
319
297
|
|
|
@@ -328,6 +306,26 @@ export default {
|
|
|
328
306
|
endDate: this.endDate.replaceAll(' ', '-'),
|
|
329
307
|
};
|
|
330
308
|
},
|
|
309
|
+
|
|
310
|
+
monthsLocale() {
|
|
311
|
+
const { months } = this;
|
|
312
|
+
return months.length ? months : translationMonths[this.$i18n.locale];
|
|
313
|
+
},
|
|
314
|
+
daysLocale() {
|
|
315
|
+
const { days } = this;
|
|
316
|
+
return days.length ? days : translationDays[this.$i18n.locale];
|
|
317
|
+
},
|
|
318
|
+
periodsLocale() {
|
|
319
|
+
const { options } = this;
|
|
320
|
+
return options.length ? options : translationPeriods[this.$i18n.locale];
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
clearText() {
|
|
324
|
+
return this.clearLabel || this.i18n('clean');
|
|
325
|
+
},
|
|
326
|
+
filterText() {
|
|
327
|
+
return this.actionLabel || this.i18n('filter');
|
|
328
|
+
},
|
|
331
329
|
},
|
|
332
330
|
|
|
333
331
|
watch: {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export const months = {
|
|
2
|
+
'pt-br': [
|
|
3
|
+
'Janeiro',
|
|
4
|
+
'Fevereiro',
|
|
5
|
+
'Março',
|
|
6
|
+
'Abril',
|
|
7
|
+
'Maio',
|
|
8
|
+
'Junho',
|
|
9
|
+
'Julho',
|
|
10
|
+
'Agosto',
|
|
11
|
+
'Setembro',
|
|
12
|
+
'Outubro',
|
|
13
|
+
'Novembro',
|
|
14
|
+
'Dezembro',
|
|
15
|
+
],
|
|
16
|
+
en: [
|
|
17
|
+
'January',
|
|
18
|
+
'February',
|
|
19
|
+
'March',
|
|
20
|
+
'April',
|
|
21
|
+
'May',
|
|
22
|
+
'June',
|
|
23
|
+
'July',
|
|
24
|
+
'August',
|
|
25
|
+
'September',
|
|
26
|
+
'October',
|
|
27
|
+
'November',
|
|
28
|
+
'December',
|
|
29
|
+
],
|
|
30
|
+
es: [
|
|
31
|
+
'Enero',
|
|
32
|
+
'Febrero',
|
|
33
|
+
'Marzo',
|
|
34
|
+
'Abril',
|
|
35
|
+
'Mayo',
|
|
36
|
+
'Junio',
|
|
37
|
+
'Julio',
|
|
38
|
+
'Agosto',
|
|
39
|
+
'Septiembre',
|
|
40
|
+
'Octubre',
|
|
41
|
+
'Noviembre',
|
|
42
|
+
'Diciembre',
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const days = {
|
|
47
|
+
'pt-br': ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
|
|
48
|
+
en: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
49
|
+
es: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const periods = {
|
|
53
|
+
'pt-br': [
|
|
54
|
+
{
|
|
55
|
+
name: 'Últimos 7 dias',
|
|
56
|
+
id: 'last-7-days',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Últimos 14 dias',
|
|
60
|
+
id: 'last-14-days',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Últimos 30 dias',
|
|
64
|
+
id: 'last-30-days',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'Últimos 12 meses',
|
|
68
|
+
id: 'last-12-months',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Mês Atual',
|
|
72
|
+
id: 'current-month',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Personalizar',
|
|
76
|
+
id: 'custom',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
en: [
|
|
80
|
+
{
|
|
81
|
+
name: 'Last 7 days',
|
|
82
|
+
id: 'last-7-days',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'Last 14 days',
|
|
86
|
+
id: 'last-14-days',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'Last 30 days',
|
|
90
|
+
id: 'last-30-days',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'Last 12 months',
|
|
94
|
+
id: 'last-12-months',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Current month',
|
|
98
|
+
id: 'current-month',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Custom',
|
|
102
|
+
id: 'custom',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
es: [
|
|
106
|
+
{
|
|
107
|
+
name: 'Últimos 7 días',
|
|
108
|
+
id: 'last-7-days',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'Últimos 14 días',
|
|
112
|
+
id: 'last-14-days',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'Últimos 30 días',
|
|
116
|
+
id: 'last-30-days',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'Últimos 12 meses',
|
|
120
|
+
id: 'last-12-months',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'Mes actual',
|
|
124
|
+
id: 'current-month',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'Personalizar',
|
|
128
|
+
id: 'custom',
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
};
|
|
@@ -27,50 +27,7 @@ export default {
|
|
|
27
27
|
export const Default = {
|
|
28
28
|
args: {
|
|
29
29
|
size: 'large',
|
|
30
|
-
clearLabel: 'Limpar',
|
|
31
|
-
actionLabel: 'Filtrar',
|
|
32
|
-
months: [
|
|
33
|
-
'Janeiro',
|
|
34
|
-
'Fevereiro',
|
|
35
|
-
'Março',
|
|
36
|
-
'Abril',
|
|
37
|
-
'Maio',
|
|
38
|
-
'Junho',
|
|
39
|
-
'Julho',
|
|
40
|
-
'Agosto',
|
|
41
|
-
'Setembro',
|
|
42
|
-
'Outubro',
|
|
43
|
-
'Novembro',
|
|
44
|
-
'Dezembro',
|
|
45
|
-
],
|
|
46
|
-
days: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
|
|
47
30
|
initialStartDate: '12-01-2021',
|
|
48
31
|
initialEndDate: '12-01-2021',
|
|
49
|
-
options: [
|
|
50
|
-
{
|
|
51
|
-
name: 'Últimos 7 dias',
|
|
52
|
-
id: 'last-7-days',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'Últimos 14 dias',
|
|
56
|
-
id: 'last-14-days',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'Últimos 30 dias',
|
|
60
|
-
id: 'last-30-days',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: 'Últimos 12 meses',
|
|
64
|
-
id: 'last-12-months',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'Mês Atual',
|
|
68
|
-
id: 'current-month',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: 'Personalizar',
|
|
72
|
-
id: 'custom',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
32
|
},
|
|
76
33
|
};
|