@farm-investimentos/front-mfe-components 2.2.5 → 2.4.0

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 (40) hide show
  1. package/dist/front-mfe-components.common.js +532 -79
  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 +532 -79
  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.vue +21 -5
  21. package/src/components/DialogHeader/DialogHeader.vue +9 -0
  22. package/src/components/IconBox/IconBox.scss +14 -0
  23. package/src/components/IconBox/IconBox.stories.js +13 -0
  24. package/src/components/IconBox/IconBox.vue +29 -0
  25. package/src/components/IconBox/__tests__/IconBox.spec.js +20 -0
  26. package/src/components/IconBox/index.js +3 -0
  27. package/src/components/Logos/OriginatorLogo/OriginatorLogo.stories.js +13 -0
  28. package/src/components/Logos/OriginatorLogo/OriginatorLogo.vue +31 -0
  29. package/src/components/Logos/OriginatorLogo/__tests__/OriginatorLogo.spec.js +32 -0
  30. package/src/components/Logos/OriginatorLogo/index.js +4 -0
  31. package/src/components/Logos/ProductLogo/ProductLogo.stories.js +13 -0
  32. package/src/components/Logos/ProductLogo/ProductLogo.vue +31 -0
  33. package/src/components/Logos/ProductLogo/__tests__/ProductLogo.spec.js +32 -0
  34. package/src/components/Logos/ProductLogo/index.js +4 -0
  35. package/src/components/Logos/index.js +2 -0
  36. package/src/components/MainFilter/__tests__/MainFilter.spec.js +23 -0
  37. package/src/components/ManagersList/__tests__/ManagersList.spec.js +27 -0
  38. package/src/components/Tabs/{Tabs.spec.js → __tests__/Tabs.spec.js} +1 -1
  39. package/src/main.js +8 -1
  40. package/src/components/MainFilter/MainFilter.spec.js +0 -43
package/package.json CHANGED
@@ -1,78 +1,78 @@
1
1
  {
2
- "name": "@farm-investimentos/front-mfe-components",
3
- "version": "2.2.5",
4
- "author": "farm investimentos",
5
- "private": false,
6
- "main": "./dist/front-mfe-components.common.js",
7
- "unpkg": "dist/front-mfe-components.umd.min.js",
8
- "jsdelivr": "dist/front-mfe-components.umd.min.js",
9
- "scripts": {
10
- "serve": "vue-cli-service serve",
11
- "build": "npm run build:components",
12
- "build:components": "vue-cli-service build --target lib --name front-mfe-components src/main.js",
13
- "lint": "vue-cli-service lint",
14
- "storybook": "start-storybook -p 6006",
15
- "build-storybook": "build-storybook",
16
- "test:unit": "jest --updateSnapshot",
17
- "test:coverage": "jest --updateSnapshot --coverage"
18
- },
19
- "files": [
20
- "dist/*",
21
- "src/*"
22
- ],
23
- "dependencies": {
24
- "@socheatsok78/storybook-addon-vuetify": "^0.1.8",
25
- "@vue/cli-service-global": "^4.5.13",
26
- "@vue/test-utils": "^1.3.0",
27
- "core-js": "^3.6.5",
28
- "sass": "~1.32.0",
29
- "sass-loader": "^10.2.0",
30
- "vue": "^2.6.11",
31
- "vuetify": "^2.5.7"
32
- },
33
- "devDependencies": {
34
- "@babel/core": "^7.14.8",
35
- "@storybook/addon-actions": "^6.3.6",
36
- "@storybook/addon-essentials": "^6.3.6",
37
- "@storybook/addon-links": "^6.3.6",
38
- "@storybook/vue": "^6.3.6",
39
- "@vue/cli-plugin-babel": "~4.5.0",
40
- "@vue/cli-plugin-eslint": "~4.5.0",
41
- "@vue/cli-plugin-unit-jest": "^4.5.15",
42
- "@vue/cli-service": "~4.5.0",
43
- "babel-eslint": "^10.1.0",
44
- "babel-loader": "^8.2.2",
45
- "eslint": "^6.7.2",
46
- "eslint-plugin-vue": "^6.2.2",
47
- "jest": "^25.5.4",
48
- "jsdoc": "^3.6.7",
49
- "vue-template-compiler": "^2.6.11",
50
- "webpack-cli": "^4.9.0"
51
- },
52
- "eslintConfig": {
53
- "root": true,
54
- "env": {
55
- "node": true
56
- },
57
- "extends": [
58
- "plugin:vue/essential",
59
- "eslint:recommended"
60
- ],
61
- "parserOptions": {
62
- "parser": "babel-eslint"
63
- },
64
- "rules": {}
65
- },
66
- "browserslist": [
67
- "> 1%",
68
- "last 2 versions",
69
- "not dead"
70
- ],
71
- "repository": {
72
- "type": "git",
73
- "url": "git://github.com/Farm-Investimentos/front-mfe-components.git"
74
- },
75
- "publishConfig": {
76
- "@farm-investimentos:registry": "https://registry.npmjs.org"
77
- }
2
+ "name": "@farm-investimentos/front-mfe-components",
3
+ "version": "2.4.0",
4
+ "author": "farm investimentos",
5
+ "private": false,
6
+ "main": "./dist/front-mfe-components.common.js",
7
+ "unpkg": "dist/front-mfe-components.umd.min.js",
8
+ "jsdelivr": "dist/front-mfe-components.umd.min.js",
9
+ "scripts": {
10
+ "serve": "vue-cli-service serve",
11
+ "build": "npm run build:components",
12
+ "build:components": "vue-cli-service build --target lib --name front-mfe-components src/main.js",
13
+ "lint": "vue-cli-service lint",
14
+ "storybook": "start-storybook -p 6006",
15
+ "build-storybook": "build-storybook",
16
+ "test:unit": "jest --updateSnapshot",
17
+ "test:coverage": "jest --updateSnapshot --coverage"
18
+ },
19
+ "files": [
20
+ "dist/*",
21
+ "src/*"
22
+ ],
23
+ "dependencies": {
24
+ "@socheatsok78/storybook-addon-vuetify": "^0.1.8",
25
+ "@vue/cli-service-global": "^4.5.13",
26
+ "@vue/test-utils": "^1.3.0",
27
+ "core-js": "^3.6.5",
28
+ "sass": "~1.32.0",
29
+ "sass-loader": "^10.2.0",
30
+ "vue": "^2.6.11",
31
+ "vuetify": "^2.5.7"
32
+ },
33
+ "devDependencies": {
34
+ "@babel/core": "^7.14.8",
35
+ "@storybook/addon-actions": "^6.3.6",
36
+ "@storybook/addon-essentials": "^6.3.6",
37
+ "@storybook/addon-links": "^6.3.6",
38
+ "@storybook/vue": "^6.3.6",
39
+ "@vue/cli-plugin-babel": "~4.5.0",
40
+ "@vue/cli-plugin-eslint": "~4.5.0",
41
+ "@vue/cli-plugin-unit-jest": "^4.5.15",
42
+ "@vue/cli-service": "~4.5.0",
43
+ "babel-eslint": "^10.1.0",
44
+ "babel-loader": "^8.2.2",
45
+ "eslint": "^6.7.2",
46
+ "eslint-plugin-vue": "^6.2.2",
47
+ "jest": "^25.5.4",
48
+ "jsdoc": "^3.6.7",
49
+ "vue-template-compiler": "^2.6.11",
50
+ "webpack-cli": "^4.9.0"
51
+ },
52
+ "eslintConfig": {
53
+ "root": true,
54
+ "env": {
55
+ "node": true
56
+ },
57
+ "extends": [
58
+ "plugin:vue/essential",
59
+ "eslint:recommended"
60
+ ],
61
+ "parserOptions": {
62
+ "parser": "babel-eslint"
63
+ },
64
+ "rules": {}
65
+ },
66
+ "browserslist": [
67
+ "> 1%",
68
+ "last 2 versions",
69
+ "not dead"
70
+ ],
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "git://github.com/Farm-Investimentos/front-mfe-components.git"
74
+ },
75
+ "publishConfig": {
76
+ "@farm-investimentos:registry": "https://registry.npmjs.org"
77
+ }
78
78
  }
@@ -1,17 +1,17 @@
1
1
  <template>
2
- <v-alert dense outlined type="error">
3
- <v-row align="center">
4
- <v-col class="grow">
5
- {{ label }}
6
- </v-col>
7
- <v-col class="shrink">
8
- <v-btn color="secondary" class="ml-3" @click="$emit('onClick')">
9
- <v-icon>mdi-refresh</v-icon>
10
- Recarregar</v-btn
11
- >
12
- </v-col>
13
- </v-row>
14
- </v-alert>
2
+ <v-alert dense outlined type="error" class="farm-alert-reload">
3
+ <v-row align="center">
4
+ <v-col class="grow">
5
+ {{ label }}
6
+ </v-col>
7
+ <v-col class="shrink">
8
+ <v-btn color="secondary" class="ml-3" alt="Recarregar" @click="$emit('onClick')">
9
+ <v-icon class="v-icon__refresh">mdi-refresh</v-icon>
10
+ Recarregar</v-btn
11
+ >
12
+ </v-col>
13
+ </v-row>
14
+ </v-alert>
15
15
  </template>
16
16
  <script>
17
17
  import VBtn from 'vuetify/lib/components/VBtn';
@@ -20,28 +20,30 @@ import VAlert from 'vuetify/lib/components/VAlert';
20
20
  import { VRow, VCol } from 'vuetify/lib/components/VGrid';
21
21
 
22
22
  export default {
23
- name: 'AlertReload',
24
- components: {
25
- VBtn,
26
- VIcon,
27
- VAlert,
28
- VRow,
29
- VCol,
30
- },
31
-
32
- props: {
33
- label: {
34
- type: String,
35
- default: '',
36
- },
37
- },
23
+ name: 'farm-alert-reload',
24
+ components: {
25
+ VBtn,
26
+ VIcon,
27
+ VAlert,
28
+ VRow,
29
+ VCol,
30
+ },
31
+ props: {
32
+ /**
33
+ * Label
34
+ */
35
+ label: {
36
+ type: String,
37
+ default: '',
38
+ },
39
+ },
38
40
  };
39
41
  </script>
40
42
 
41
- <style lang="scss">
43
+ <style lang="scss" scoped>
42
44
  .v-btn {
43
- .v-icon {
44
- margin-right: 1rem;
45
- }
45
+ .v-icon.v-icon__refresh {
46
+ margin-right: 1rem;
47
+ }
46
48
  }
47
49
  </style>
@@ -0,0 +1,18 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import AlertReload from '../AlertReload';
3
+
4
+ describe('AlertReload component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(AlertReload, {
9
+ propsData: {
10
+ managersString: 'a,b,c',
11
+ },
12
+ });
13
+ });
14
+
15
+ test('Created hook', () => {
16
+ expect(wrapper).toBeDefined();
17
+ });
18
+ });
@@ -0,0 +1,16 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ExportButton from '../ExportButton';
3
+
4
+ describe('ExportButton component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(ExportButton);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+ });
@@ -0,0 +1,16 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ImportButton from '../ImportButton';
3
+
4
+ describe('ImportButton component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(ImportButton);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+ });
@@ -0,0 +1,16 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import RemoveButton from '../RemoveButton';
3
+
4
+ describe('RemoveButton component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(RemoveButton);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+ });
@@ -0,0 +1,14 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ToggleButton from '../ToggleButton';
3
+
4
+ describe('ToggleButton component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(ToggleButton);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+ });
@@ -0,0 +1,46 @@
1
+ .card-context {
2
+ width: 100%;
3
+ padding: 1.5rem;
4
+ background: #ffffff;
5
+ box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.16);
6
+ border-radius: 5px;
7
+ }
8
+
9
+ .card-context-header {
10
+ width: 100%;
11
+ height: 40px;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: space-between;
15
+ }
16
+
17
+ .card-context-content {
18
+ width: calc(100% - 56px);
19
+ height: 40px;
20
+ display: flex;
21
+ align-items: center;
22
+ }
23
+
24
+ .card-context-title {
25
+ color: #5c5c5c;
26
+ margin: 0;
27
+ font-size: 0.75rem;
28
+ }
29
+
30
+ .card-context-title.bold {
31
+ font-size: 0.875rem;
32
+ font-weight: bold;
33
+ color: #1c1c1c;
34
+ }
35
+
36
+ .card-context-body {
37
+ width: 100%;
38
+ padding-top: 1rem;
39
+ }
40
+
41
+ .card-context-loding-or-error {
42
+ width: 100%;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ }
@@ -0,0 +1,47 @@
1
+ import CardContext from './CardContext.vue';
2
+
3
+ export default {
4
+ title: 'Example/CardContext',
5
+ component: CardContext,
6
+ };
7
+
8
+ export const Primary = () => ({
9
+ components: { CardContext },
10
+ template: `
11
+ <CardContext icon="mdi-currency-usd" title="Titulo do Card">
12
+ <p>Conteúdo do Card</p>
13
+ </CardContext>
14
+ `,
15
+ });
16
+
17
+ export const Secondary = () => ({
18
+ components: { CardContext },
19
+ template: `
20
+ <CardContext icon="mdi-currency-usd" title="Titulo do Card" bold>
21
+ <p>Conteúdo do Card</p>
22
+ </CardContext>
23
+ `,
24
+ });
25
+
26
+ export const WithLoading = () => ({
27
+ components: { CardContext },
28
+ template: `
29
+ <CardContext icon="mdi-currency-usd" title="Titulo do Card" isLoading>
30
+ <p>Conteúdo do Card</p>
31
+ </CardContext>
32
+ `,
33
+ });
34
+
35
+ export const WithError = () => ({
36
+ components: { CardContext },
37
+ template: `
38
+ <CardContext icon="mdi-currency-usd" title="Titulo do Card" isError>
39
+ <p>Conteúdo do Card</p>
40
+ </CardContext>
41
+ `,
42
+ });
43
+
44
+ Primary.storyName = 'Básico';
45
+ Secondary.storyName = 'Título em Bold';
46
+ WithLoading.storyName = 'Com Loading';
47
+ WithError.storyName = 'Com Erro';
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <div class="card-context">
3
+ <div class="card-context-header" v-if="isSuccess">
4
+ <IconBox :icon="icon" />
5
+ <div class="card-context-content">
6
+ <p :class="isBold">
7
+ {{ title }}
8
+ </p>
9
+ </div>
10
+ </div>
11
+ <div class="card-context-body" v-if="isSuccess">
12
+ <slot></slot>
13
+ </div>
14
+ <div class="card-context-loding-or-error" v-if="isLoading">
15
+ <Loader size="small" />
16
+ </div>
17
+ <div class="card-context-loding-or-error" v-if="isError">
18
+ <AlertReload :label="errorLabel" @onClick="$emit('onLoad')" />
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ import Vue from 'vue';
25
+ import { Loader, AlertReload, IconBox } from '../../main.js';
26
+
27
+ export default Vue.extend({
28
+ name: 'farm-card-context',
29
+ components: {
30
+ IconBox,
31
+ AlertReload,
32
+ Loader,
33
+ },
34
+ props: {
35
+ /**
36
+ * Title
37
+ */
38
+ title: {
39
+ type: String,
40
+ require: true,
41
+ },
42
+ /**
43
+ * Set bold text
44
+ */
45
+ bold: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ /**
50
+ * Icon (from Material Icons)
51
+ * Example: mdi-chart-bar
52
+ */
53
+ icon: {
54
+ type: String,
55
+ require: true,
56
+ },
57
+ /**
58
+ * Show loader
59
+ */
60
+ isLoading: {
61
+ type: Boolean,
62
+ default: false,
63
+ },
64
+ /**
65
+ * Show error alert
66
+ */
67
+ isError: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
71
+ /**
72
+ * Label to be shown in error alert
73
+ */
74
+ errorLabel: {
75
+ type: String,
76
+ default: 'Ocorreu um erro',
77
+ },
78
+ },
79
+
80
+ computed: {
81
+ isBold() {
82
+ if (this.bold) {
83
+ return 'card-context-title bold';
84
+ }
85
+ return 'card-context-title';
86
+ },
87
+ isSuccess() {
88
+ return !this.isLoading && !this.isError;
89
+ },
90
+ },
91
+ });
92
+ </script>
93
+
94
+ <style lang="sass" scoped>
95
+ @import './CardContext.scss'
96
+ </style>
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import CardContext from '../CardContext';
3
+
4
+ describe('CardContext component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(CardContext);
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 CardContext from './CardContext';
2
+
3
+ export default CardContext;
@@ -44,17 +44,33 @@ export default Vue.extend({
44
44
  VIcon,
45
45
  },
46
46
  props: {
47
+ /**
48
+ * Cabeçalho
49
+ */
47
50
  headers: {
48
51
  type: Array,
49
52
  require: true,
50
53
  },
54
+ /**
55
+ * Array para controle da exibição da ordenação
56
+ */
51
57
  sortClick: {
52
58
  type: Array,
53
59
  require: true,
54
60
  },
61
+ /**
62
+ * Começar selecionado
63
+ */
55
64
  firstSelected: {
56
65
  type: Boolean,
57
- default: () => false,
66
+ default: false,
67
+ },
68
+ /**
69
+ * Index do item do cabeçalho que deve começar selecionado
70
+ */
71
+ selectedIndex: {
72
+ type: Number,
73
+ default: 0,
58
74
  },
59
75
  },
60
76
  methods: {
@@ -88,8 +104,8 @@ export default Vue.extend({
88
104
  this.sortClick[i].show = false;
89
105
  }
90
106
  },
91
- checkFistSelected(index) {
92
- if (index === 0) {
107
+ checkFirstSelected(index) {
108
+ if (index === this.selectedIndex) {
93
109
  return this.firstSelected;
94
110
  }
95
111
  return false;
@@ -104,8 +120,8 @@ export default Vue.extend({
104
120
  [this.headers[i].value]: false,
105
121
  descending: 'ASC',
106
122
  field: this.headers[i].value,
107
- clicked: this.checkFistSelected(i),
108
- show: this.checkFistSelected(i),
123
+ clicked: this.checkFirstSelected(i),
124
+ show: this.checkFirstSelected(i),
109
125
  });
110
126
  }
111
127
  },
@@ -4,6 +4,7 @@
4
4
  {{ title }}
5
5
 
6
6
  <v-icon
7
+ v-if="hasCloseIcon"
7
8
  role="button"
8
9
  title="Fechar"
9
10
  class="dialog-header__close-icon"
@@ -37,6 +38,14 @@ export default {
37
38
  default: null,
38
39
  required: false,
39
40
  },
41
+ /**
42
+ * Ícone - se possui o ícone de fechar
43
+ */
44
+ hasCloseIcon: {
45
+ type: Boolean,
46
+ default: true,
47
+ required: false,
48
+ },
40
49
  },
41
50
  components: {
42
51
  VIcon,
@@ -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>