@farm-investimentos/front-mfe-components 2.2.6 → 2.4.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/dist/front-mfe-components.common.js +528 -86
- 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 +528 -86
- 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 +76 -76
- package/src/components/AlertReload/AlertReload.vue +34 -32
- package/src/components/AlertReload/__tests__/AlertReload.spec.js +18 -0
- package/src/components/Buttons/ExportButton/__tests__/ExportButton.spec.js +16 -0
- package/src/components/Buttons/ImportButton/__tests__/ImportButton.spec.js +16 -0
- package/src/components/Buttons/RemoveButton/__tests__/RemoveButton.spec.js +16 -0
- package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +14 -0
- package/src/components/CardContext/CardContext.scss +46 -0
- package/src/components/CardContext/CardContext.stories.js +47 -0
- package/src/components/CardContext/CardContext.vue +96 -0
- package/src/components/CardContext/__tests__/CardContext.spec.js +20 -0
- package/src/components/CardContext/index.js +3 -0
- package/src/components/DataTableHeader/DataTableHeader.vue +9 -3
- package/src/components/DataTableHeader/__tests__/DataTableHeader.spec.js +39 -0
- package/src/components/DataTablePaginator/__tests__/DataTablePaginator.spec.js +20 -0
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +24 -0
- package/src/components/DefaultTextField/__tests__/DefaultTextField.spec.js +25 -0
- package/src/components/DialogFooter/__tests__/DialogFooter.spec.js +20 -0
- package/src/components/DialogHeader/DialogHeader.vue +9 -0
- package/src/components/DialogHeader/__tests__/DialogHeader.spec.js +24 -0
- package/src/components/IconBox/IconBox.scss +14 -0
- package/src/components/IconBox/IconBox.stories.js +13 -0
- package/src/components/IconBox/IconBox.vue +29 -0
- package/src/components/IconBox/__tests__/IconBox.spec.js +20 -0
- package/src/components/IconBox/index.js +3 -0
- package/src/components/Logos/OriginatorLogo/OriginatorLogo.stories.js +13 -0
- package/src/components/Logos/OriginatorLogo/OriginatorLogo.vue +31 -0
- package/src/components/Logos/OriginatorLogo/__tests__/OriginatorLogo.spec.js +32 -0
- package/src/components/Logos/OriginatorLogo/index.js +4 -0
- package/src/components/Logos/ProductLogo/ProductLogo.stories.js +13 -0
- package/src/components/Logos/ProductLogo/ProductLogo.vue +31 -0
- package/src/components/Logos/ProductLogo/__tests__/ProductLogo.spec.js +32 -0
- package/src/components/Logos/ProductLogo/index.js +4 -0
- package/src/components/Logos/index.js +2 -0
- package/src/components/MainFilter/__tests__/MainFilter.spec.js +23 -0
- package/src/components/ManagersList/__tests__/ManagersList.spec.js +27 -0
- package/src/components/Tabs/{Tabs.spec.js → __tests__/Tabs.spec.js} +1 -1
- package/src/main.js +8 -1
- package/src/components/MainFilter/MainFilter.spec.js +0 -43
package/package.json
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
2
|
+
"name": "@farm-investimentos/front-mfe-components",
|
|
3
|
+
"version": "2.4.1",
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
44
|
-
|
|
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
|
+
});
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
v-bind:class="[
|
|
8
8
|
item.sortable ? 'sortable' : '',
|
|
9
9
|
sortClick[$index].clicked ? 'active' : '',
|
|
10
|
-
item.sortable
|
|
10
|
+
item.sortable ? (sortClick[$index].descending === 'DESC' ? 'DESC' : 'ASC') : '',
|
|
11
11
|
]"
|
|
12
12
|
v-bind:style="{
|
|
13
|
-
textAlign: item.align,
|
|
13
|
+
textAlign: item.align ? item.align : '',
|
|
14
14
|
width: thWidth(item),
|
|
15
15
|
}"
|
|
16
16
|
@click="item.sortable ? clickSort(item.value, $index) : ''"
|
|
17
17
|
@mouseover="changeShow($index)"
|
|
18
18
|
@mouseout="changeHidden($index)"
|
|
19
19
|
>
|
|
20
|
-
<span class="header-text">
|
|
20
|
+
<span class="header-text" v-if="!isTHDataTableSelect(item)">
|
|
21
21
|
{{ item.text }}
|
|
22
22
|
|
|
23
23
|
<v-icon
|
|
@@ -111,8 +111,14 @@ export default Vue.extend({
|
|
|
111
111
|
return false;
|
|
112
112
|
},
|
|
113
113
|
thWidth(item) {
|
|
114
|
+
if (this.isTHDataTableSelect(item)) {
|
|
115
|
+
return '64px';
|
|
116
|
+
}
|
|
114
117
|
return item.width ? item.width + 'px' : 'auto';
|
|
115
118
|
},
|
|
119
|
+
isTHDataTableSelect(item) {
|
|
120
|
+
return item.value === 'data-table-select';
|
|
121
|
+
},
|
|
116
122
|
},
|
|
117
123
|
created() {
|
|
118
124
|
for (let i = 0; i < this.headers.length; i += 1) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import DataTableHeader from '../DataTableHeader';
|
|
3
|
+
|
|
4
|
+
describe('DataTableHeader component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(DataTableHeader, {
|
|
10
|
+
propsData: {
|
|
11
|
+
headers: [],
|
|
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('Methods', () => {
|
|
28
|
+
it('Should check if item is data-table-select column', () => {
|
|
29
|
+
expect(component.isTHDataTableSelect({ value: 'data-table-select' })).toBeTruthy();
|
|
30
|
+
expect(component.isTHDataTableSelect({ value: 'anything else' })).toBeFalsy();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('Should get th width', () => {
|
|
34
|
+
expect(component.thWidth({ value: 'data-table-select' })).toEqual('64px');
|
|
35
|
+
expect(component.thWidth({ width: 24 })).toEqual('24px');
|
|
36
|
+
expect(component.thWidth({})).toEqual('auto');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -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
|
+
});
|