@farm-investimentos/front-mfe-components 2.2.7 → 2.4.2

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.
Files changed (46) hide show
  1. package/dist/front-mfe-components.common.js +511 -77
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +1 -1
  4. package/dist/front-mfe-components.umd.js +511 -77
  5. package/dist/front-mfe-components.umd.js.map +1 -1
  6. package/dist/front-mfe-components.umd.min.js +1 -1
  7. package/dist/front-mfe-components.umd.min.js.map +1 -1
  8. package/package.json +76 -76
  9. package/src/components/AlertReload/AlertReload.vue +34 -32
  10. package/src/components/AlertReload/__tests__/AlertReload.spec.js +18 -0
  11. package/src/components/Buttons/ExportButton/__tests__/ExportButton.spec.js +16 -0
  12. package/src/components/Buttons/ImportButton/__tests__/ImportButton.spec.js +16 -0
  13. package/src/components/Buttons/RemoveButton/__tests__/RemoveButton.spec.js +16 -0
  14. package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +14 -0
  15. package/src/components/CardContext/CardContext.scss +46 -0
  16. package/src/components/CardContext/CardContext.stories.js +47 -0
  17. package/src/components/CardContext/CardContext.vue +96 -0
  18. package/src/components/CardContext/__tests__/CardContext.spec.js +20 -0
  19. package/src/components/CardContext/index.js +3 -0
  20. package/src/components/DataTableHeader/DataTableHeader.stories.js +1 -1
  21. package/src/components/DataTableHeader/DataTableHeader.vue +10 -3
  22. package/src/components/DataTableHeader/__tests__/DataTableHeader.spec.js +89 -0
  23. package/src/components/DataTablePaginator/__tests__/DataTablePaginator.spec.js +20 -0
  24. package/src/components/DatePicker/__tests__/DatePicker.spec.js +24 -0
  25. package/src/components/DefaultTextField/__tests__/DefaultTextField.spec.js +25 -0
  26. package/src/components/DialogFooter/__tests__/DialogFooter.spec.js +20 -0
  27. package/src/components/DialogHeader/__tests__/DialogHeader.spec.js +24 -0
  28. package/src/components/IconBox/IconBox.scss +14 -0
  29. package/src/components/IconBox/IconBox.stories.js +13 -0
  30. package/src/components/IconBox/IconBox.vue +29 -0
  31. package/src/components/IconBox/__tests__/IconBox.spec.js +20 -0
  32. package/src/components/IconBox/index.js +3 -0
  33. package/src/components/Logos/OriginatorLogo/OriginatorLogo.stories.js +13 -0
  34. package/src/components/Logos/OriginatorLogo/OriginatorLogo.vue +31 -0
  35. package/src/components/Logos/OriginatorLogo/__tests__/OriginatorLogo.spec.js +32 -0
  36. package/src/components/Logos/OriginatorLogo/index.js +4 -0
  37. package/src/components/Logos/ProductLogo/ProductLogo.stories.js +13 -0
  38. package/src/components/Logos/ProductLogo/ProductLogo.vue +31 -0
  39. package/src/components/Logos/ProductLogo/__tests__/ProductLogo.spec.js +32 -0
  40. package/src/components/Logos/ProductLogo/index.js +4 -0
  41. package/src/components/Logos/index.js +2 -0
  42. package/src/components/MainFilter/__tests__/MainFilter.spec.js +23 -0
  43. package/src/components/ManagersList/__tests__/ManagersList.spec.js +27 -0
  44. package/src/components/Tabs/{Tabs.spec.js → __tests__/Tabs.spec.js} +1 -1
  45. package/src/main.js +8 -1
  46. package/src/components/MainFilter/MainFilter.spec.js +0 -43
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DataTablePaginator from '../DataTablePaginator';
3
+
4
+ describe('DataTablePaginator component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DataTablePaginator);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+
15
+ describe('mount component', () => {
16
+ it('renders correctly', () => {
17
+ expect(wrapper.element).toMatchSnapshot();
18
+ });
19
+ });
20
+ });
@@ -0,0 +1,24 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DatePicker from '../DatePicker';
3
+
4
+ describe('DatePicker component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DatePicker, {
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
+ });
@@ -0,0 +1,25 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DefaultTextField from '../DefaultTextField';
3
+
4
+ describe('DefaultTextField component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DefaultTextField, {
9
+ propsData: {
10
+ item: {},
11
+ value: false,
12
+ },
13
+ });
14
+ });
15
+
16
+ test('Created hook', () => {
17
+ expect(wrapper).toBeDefined();
18
+ });
19
+
20
+ describe('mount component', () => {
21
+ it('renders correctly', () => {
22
+ expect(wrapper.element).toMatchSnapshot();
23
+ });
24
+ });
25
+ });
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DialogFooter from '../DialogFooter';
3
+
4
+ describe('DialogFooter component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DialogFooter);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+
15
+ describe('mount component', () => {
16
+ it('renders correctly', () => {
17
+ expect(wrapper.element).toMatchSnapshot();
18
+ });
19
+ });
20
+ });
@@ -0,0 +1,24 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DialogHeader from '../DialogHeader';
3
+
4
+ describe('DialogHeader component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DialogHeader, {
9
+ propsData: {
10
+ title: ''
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
+ });
@@ -0,0 +1,14 @@
1
+ .icon-box {
2
+ width: 40px;
3
+ height: 40px;
4
+ padding: 6px;
5
+ background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), #00b493;
6
+ border-radius: 5px;
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ }
11
+
12
+ .icon i {
13
+ font-size: 1.875em;
14
+ }
@@ -0,0 +1,13 @@
1
+ import IconBox from './IconBox.vue';
2
+
3
+ export default {
4
+ title: 'Example/IconBox',
5
+ component: IconBox,
6
+ };
7
+
8
+ export const Primary = () => ({
9
+ components: { IconBox },
10
+ template: '<IconBox icon="mdi-currency-usd" />',
11
+ });
12
+
13
+ Primary.storyName = 'Básico';
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div class="icon-box">
3
+ <div class="icon">
4
+ <v-icon color="secondary">{{ icon }}</v-icon>
5
+ </div>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import Vue from 'vue';
11
+ import VIcon from 'vuetify/lib/components/VIcon';
12
+
13
+ export default Vue.extend({
14
+ name: 'farm-icon-box',
15
+ components: {
16
+ VIcon,
17
+ },
18
+ props: {
19
+ icon: {
20
+ type: String,
21
+ require: true,
22
+ },
23
+ },
24
+ });
25
+ </script>
26
+
27
+ <style lang="sass" scoped>
28
+ @import './IconBox.scss'
29
+ </style>
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import IconBox from '../IconBox';
3
+
4
+ describe('IconBox component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(IconBox);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+
15
+ describe('mount component', () => {
16
+ it('renders correctly', () => {
17
+ expect(wrapper.element).toMatchSnapshot();
18
+ });
19
+ });
20
+ });
@@ -0,0 +1,3 @@
1
+ import IconBox from './IconBox.vue';
2
+
3
+ export default IconBox;
@@ -0,0 +1,13 @@
1
+ import OriginatorLogo from './OriginatorLogo.vue';
2
+
3
+ export default {
4
+ title: 'Example/Logos/OriginatorLogo',
5
+ component: OriginatorLogo,
6
+ };
7
+
8
+ export const Primary = () => ({
9
+ components: { OriginatorLogo },
10
+ template: '<OriginatorLogo alt="primary" id="1" />',
11
+ });
12
+
13
+ Primary.storyName = 'Básico';
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <img :src="imgSrc" />
3
+ </template>
4
+ <script>
5
+ import Vue from 'vue';
6
+
7
+ export default Vue.extend({
8
+ name: 'farm-imglogo-originator',
9
+ inheritAttrs: true,
10
+ props: {
11
+ /**
12
+ * Product id
13
+ */
14
+ id: {
15
+ required: true,
16
+ },
17
+ /**
18
+ * Logo variation
19
+ */
20
+ variation: {
21
+ type: String,
22
+ default: 'full',
23
+ },
24
+ },
25
+ computed: {
26
+ imgSrc() {
27
+ return `/public/logos/originadores/${this.id}/${this.variation}.svg`;
28
+ },
29
+ },
30
+ });
31
+ </script>
@@ -0,0 +1,32 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import OriginatorLogo from '../OriginatorLogo';
3
+
4
+ describe('OriginatorLogo component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(OriginatorLogo, {
10
+ propsData: {
11
+ id: 10,
12
+ },
13
+ });
14
+ component = wrapper.vm;
15
+ });
16
+
17
+ test('Created hook', () => {
18
+ expect(wrapper).toBeDefined();
19
+ });
20
+
21
+ describe('mount component', () => {
22
+ it('renders correctly', () => {
23
+ expect(wrapper.element).toMatchSnapshot();
24
+ });
25
+ });
26
+
27
+ describe('Computed properties', () => {
28
+ it('Should have imgSrc', () => {
29
+ expect(component.imgSrc).toEqual('/public/logos/originadores/10/full.svg');
30
+ });
31
+ });
32
+ });
@@ -0,0 +1,4 @@
1
+ import OriginatorLogo from './OriginatorLogo';
2
+
3
+ export { OriginatorLogo };
4
+ export default OriginatorLogo;
@@ -0,0 +1,13 @@
1
+ import ProductLogo from './ProductLogo.vue';
2
+
3
+ export default {
4
+ title: 'Example/Logos/ProductLogo',
5
+ component: ProductLogo,
6
+ };
7
+
8
+ export const Primary = () => ({
9
+ components: { ProductLogo },
10
+ template: '<ProductLogo alt="primary" id="1" />',
11
+ });
12
+
13
+ Primary.storyName = 'Básico';
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <img :src="imgSrc" />
3
+ </template>
4
+ <script>
5
+ import Vue from 'vue';
6
+
7
+ export default Vue.extend({
8
+ name: 'farm-imglogo-product',
9
+ inheritAttrs: true,
10
+ props: {
11
+ /**
12
+ * Product id
13
+ */
14
+ id: {
15
+ required: true,
16
+ },
17
+ /**
18
+ * Logo variation
19
+ */
20
+ variation: {
21
+ type: String,
22
+ default: 'full',
23
+ },
24
+ },
25
+ computed: {
26
+ imgSrc() {
27
+ return `/public/logos/products/${this.id}/${this.variation}.svg`;
28
+ },
29
+ },
30
+ });
31
+ </script>
@@ -0,0 +1,32 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ProductLogo from '../ProductLogo';
3
+
4
+ describe('ProductLogo component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(ProductLogo, {
10
+ propsData: {
11
+ id: 10,
12
+ },
13
+ });
14
+ component = wrapper.vm;
15
+ });
16
+
17
+ test('Created hook', () => {
18
+ expect(wrapper).toBeDefined();
19
+ });
20
+
21
+ describe('mount component', () => {
22
+ it('renders correctly', () => {
23
+ expect(wrapper.element).toMatchSnapshot();
24
+ });
25
+ });
26
+
27
+ describe('Computed properties', () => {
28
+ it('Should have imgSrc', () => {
29
+ expect(component.imgSrc).toEqual('/public/logos/products/10/full.svg');
30
+ });
31
+ });
32
+ });
@@ -0,0 +1,4 @@
1
+ import ProductLogo from './ProductLogo';
2
+
3
+ export { ProductLogo };
4
+ export default ProductLogo;
@@ -0,0 +1,2 @@
1
+ export * from './ProductLogo/';
2
+ export * from './OriginatorLogo/';
@@ -0,0 +1,23 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import MainFilter from '../MainFilter';
3
+
4
+ describe('MainFilter component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(MainFilter);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+
17
+ describe('methods', () => {
18
+ it('Should emit event', () => {
19
+ component.onFilterClick();
20
+ expect(wrapper.emitted().onClick).toBeTruthy();
21
+ });
22
+ });
23
+ });
@@ -0,0 +1,27 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ManagersList from '../ManagersList';
3
+
4
+ describe('ManagersList component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(ManagersList, {
10
+ propsData: {
11
+ managersString: 'a,b,c',
12
+ },
13
+ });
14
+ component = wrapper.vm;
15
+ });
16
+
17
+ test('Created hook', () => {
18
+ expect(wrapper).toBeDefined();
19
+ });
20
+
21
+ describe('Computed properties', () => {
22
+ it('Should have managers array', () => {
23
+ expect(component.managers).toBeInstanceOf(Array);
24
+ expect(component.managers.length).toEqual(3);
25
+ });
26
+ });
27
+ });
@@ -1,5 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import Tabs from './Tabs';
2
+ import Tabs from '../Tabs';
3
3
 
4
4
  describe('Tabs component', () => {
5
5
  let wrapper;
package/src/main.js CHANGED
@@ -16,7 +16,10 @@ import PromptUserToConfirm from './components/PromptUserToConfirm';
16
16
  import ModalPromptUser from './components/ModalPromptUser';
17
17
 
18
18
  import TableContextMenu from './components/TableContextMenu';
19
- import DefaultButton from './components/Buttons/DefaultButton/DefaultButton.vue';
19
+ import IconBox from './components/IconBox';
20
+ import CardContext from './components/CardContext';
21
+
22
+ import DefaultButton from './components/Buttons/DefaultButton/DefaultButton';
20
23
 
21
24
  export {
22
25
  DataTableEmptyWrapper,
@@ -37,6 +40,8 @@ export {
37
40
  TableContextMenu,
38
41
  ModalPromptUser,
39
42
  DefaultButton,
43
+ IconBox,
44
+ CardContext,
40
45
  };
41
46
 
42
47
  export * from './components/Buttons/DefaultButton/';
@@ -46,3 +51,5 @@ export * from './components/Buttons/ExportButton/';
46
51
  export * from './components/Buttons/ImportButton/';
47
52
  export * from './components/Buttons/ToggleButton/';
48
53
  export * from './components/Buttons/RemoveButton/';
54
+ export * from './components/Logos/ProductLogo/';
55
+ export * from './components/Logos/OriginatorLogo/';
@@ -1,43 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
- import MainFilter from './MainFilter';
3
-
4
- describe('MainFilter component', () => {
5
- let wrapper;
6
- let component;
7
-
8
- beforeEach(() => {
9
- wrapper = shallowMount(MainFilter);
10
- component = wrapper.vm;
11
- });
12
-
13
- test('Created hook', () => {
14
- expect(wrapper).toBeDefined();
15
- });
16
-
17
- describe('methods', () => {
18
- describe('onKeyUp', () => {
19
- it('Should change value after throttle', done => {
20
- const mockEvent = { target: { value: 'some value' } };
21
- const spy = jest.spyOn(component, '$emit');
22
- component.onKeyUp(mockEvent);
23
- setTimeout(() => {
24
- expect(spy).toHaveBeenCalledWith('onInputChange', 'some value');
25
- done();
26
- }, 300);
27
- });
28
-
29
- it('Should clear timer', async () => {
30
- await wrapper.setData({ timer: true });
31
- const mockEvent = { target: { value: 'some value' } };
32
- const spy = jest.spyOn(window, 'clearTimeout');
33
- component.onKeyUp(mockEvent);
34
- expect(spy).toHaveBeenCalled();
35
- });
36
- });
37
-
38
- it('Should emit event', () => {
39
- component.onFilterClick();
40
- expect(wrapper.emitted().onClick).toBeTruthy();
41
- });
42
- });
43
- });