@farm-investimentos/front-mfe-components 2.4.5 → 2.4.9
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/front-mfe-components.common.js +87 -62
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +87 -62
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DataTableHeader/DataTableHeader.vue +8 -2
- package/src/components/RangeDatePicker/RangeDatePicker.stories.js +6 -0
- package/src/components/RangeDatePicker/RangeDatePicker.vue +16 -0
- package/src/components/RangeDatePicker/__tests__/RangeDatePicker.spec.js +37 -0
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</v-icon>
|
|
33
33
|
</span>
|
|
34
34
|
|
|
35
|
-
<span v-if="isTHDataTableSelect(item)">
|
|
35
|
+
<span v-if="isTHDataTableSelect(item) && showCheckbox">
|
|
36
36
|
<v-simple-checkbox
|
|
37
37
|
:indeterminate="headerProps.someItems && !headerProps.everyItem"
|
|
38
38
|
v-model="inputVal"
|
|
@@ -88,7 +88,7 @@ export default Vue.extend({
|
|
|
88
88
|
* v-model for data-table-select
|
|
89
89
|
*/
|
|
90
90
|
value: {
|
|
91
|
-
|
|
91
|
+
default: false,
|
|
92
92
|
},
|
|
93
93
|
/**
|
|
94
94
|
* Original header props
|
|
@@ -96,6 +96,12 @@ export default Vue.extend({
|
|
|
96
96
|
headerProps: {
|
|
97
97
|
type: Object,
|
|
98
98
|
},
|
|
99
|
+
/**
|
|
100
|
+
* Hide/show checkbox
|
|
101
|
+
*/
|
|
102
|
+
showCheckbox: {
|
|
103
|
+
default: true,
|
|
104
|
+
},
|
|
99
105
|
},
|
|
100
106
|
computed: {
|
|
101
107
|
inputVal: {
|
|
@@ -15,5 +15,11 @@ export const Secondary = () => ({
|
|
|
15
15
|
template: `<RangeDatePicker inputId="input-custom-id" :value="['2021-08-01', '2021-08-05']" />`,
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
export const MinMax = () => ({
|
|
19
|
+
components: { RangeDatePicker },
|
|
20
|
+
template: `<RangeDatePicker inputId="input-custom-id" min="2022-01-17" max="2022-02-15" />`,
|
|
21
|
+
});
|
|
22
|
+
|
|
18
23
|
Primary.storyName = 'Básico';
|
|
19
24
|
Secondary.storyName = 'Data inicial';
|
|
25
|
+
MinMax.storyName = 'Data Mínima e Máxima';
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
no-title
|
|
28
28
|
scrollable
|
|
29
29
|
range
|
|
30
|
+
:max="max"
|
|
31
|
+
:min="min"
|
|
30
32
|
color="secondary"
|
|
31
33
|
locale="pt-br"
|
|
32
34
|
>
|
|
@@ -73,6 +75,20 @@ export default {
|
|
|
73
75
|
return [];
|
|
74
76
|
},
|
|
75
77
|
},
|
|
78
|
+
/**
|
|
79
|
+
* Variável usada para definir a data máxima (yyyy-mm-dd)
|
|
80
|
+
*/
|
|
81
|
+
max: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: null,
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Variável usada para definir a data minima (yyyy-mm-dd)
|
|
87
|
+
*/
|
|
88
|
+
min: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: null,
|
|
91
|
+
},
|
|
76
92
|
},
|
|
77
93
|
data() {
|
|
78
94
|
const s = this.formatDateRange(this.value);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import RangeDatePicker from '../RangeDatePicker';
|
|
3
|
+
|
|
4
|
+
describe('RangeDatePicker component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(RangeDatePicker, {
|
|
9
|
+
propsData: {
|
|
10
|
+
inputId: 'someid',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('Created hook', () => {
|
|
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 values', () => {
|
|
26
|
+
it('min max correctly', async () => {
|
|
27
|
+
await wrapper.setProps({
|
|
28
|
+
inputId: 'someid',
|
|
29
|
+
min: '2022-01-17',
|
|
30
|
+
max: '2022-01-31',
|
|
31
|
+
});
|
|
32
|
+
expect(wrapper.vm.inputId).toBe('someid');
|
|
33
|
+
expect(wrapper.vm.min).toBe('2022-01-17');
|
|
34
|
+
expect(wrapper.vm.max).toBe('2022-01-31');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|