@farm-investimentos/front-mfe-components-vue3 0.0.4 → 0.0.6
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 +4275 -5619
- 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 +4275 -5619
- 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 +89 -89
- package/src/components/AlertBox/AlertBox.stories.js +0 -3
- package/src/components/AlertReload/AlertReload.stories.js +0 -7
- package/src/components/Buttons/ConfirmButton/ConfirmButton.stories.js +0 -4
- package/src/components/Buttons/DangerButton/DangerButton.stories.js +0 -3
- package/src/components/Checkbox/Checkbox.stories.js +1 -1
- package/src/components/Collapsible/Collapsible.stories.js +1 -1
- package/src/components/ContextMenu/ContextMenu.stories.js +1 -1
- package/src/components/DatePicker/DatePicker.stories.js +1 -1
- package/src/components/Form/Form.stories.js +117 -159
- package/src/components/Form/Form.vue +13 -21
- package/src/components/IconBox/IconBox.stories.js +1 -1
- package/src/components/Logger/Logger.vue +3 -2
- package/src/components/ManagersList/ManagersList.stories.js +1 -1
- package/src/components/MultipleSelectShortener/MultipleSelectShortener.stories.js +1 -1
- package/src/components/PromptUserToConfirm/PromptUserToConfirm.stories.js +1 -1
- package/src/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/src/components/RangeDatePicker/RangeDatePicker.stories.js +1 -1
- package/src/components/ResetTableRowSelection/ResetTableRowSelection.stories.js +1 -1
- package/src/components/SelectModalOptions/SelectModalOptions.scss +1 -1
- package/src/components/SelectModalOptions/SelectModalOptions.stories.js +0 -3
- package/src/components/SelectModalOptions/SelectModalOptions.vue +1 -3
- package/src/components/Switcher/Switcher.stories.js +1 -1
- package/src/components/TableContextMenu/TableContextMenu.stories.js +1 -1
- package/src/components/TextFieldV2/TextFieldV2.vue +1 -1
- package/src/components/Tooltip/Tooltip.stories.js +1 -3
- package/src/components/Typography/BodyText/BodyText.stories.js +0 -3
- package/src/components/Typography/Caption/Caption.stories.js +1 -1
- package/src/components/Typography/Heading/Heading.stories.js +1 -1
- package/src/components/Typography/Small/Small.stories.js +0 -3
- package/src/components/Typography/Subtitle/Subtitle.stories.js +1 -1
- package/src/components/Typography/Typography.stories.js +1 -1
- package/src/components/ValueCaption/ValueCaption.stories.js +1 -1
- package/src/examples/Dialog.stories.js +1 -32
- package/src/examples/Table.stories.js +2 -2
- package/src/helpers/walk.ts +19 -0
- package/src/scss/Sticky-table.scss +3 -3
- package/src/scss/utils.scss +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form class="farm-form"
|
|
2
|
+
<form class="farm-form">{{ errorsBag }}<slot></slot>
|
|
3
|
+
|
|
4
|
+
</form>
|
|
3
5
|
</template>
|
|
4
6
|
<script lang="ts">
|
|
7
|
+
import walk from '../../helpers/walk';
|
|
5
8
|
import { onMounted, reactive, ref, getCurrentInstance } from 'vue';
|
|
6
9
|
|
|
7
10
|
type ErrorsBag = Record<number, boolean>;
|
|
@@ -9,11 +12,11 @@ type ErrorsBag = Record<number, boolean>;
|
|
|
9
12
|
export default {
|
|
10
13
|
name: 'farm-form',
|
|
11
14
|
props: {
|
|
12
|
-
|
|
15
|
+
modelValue: { type: [Boolean] },
|
|
13
16
|
},
|
|
14
17
|
inheritAttrs: true,
|
|
15
18
|
setup(props, { emit }) {
|
|
16
|
-
const innerValue = ref(props.
|
|
19
|
+
const innerValue = ref(props.modelValue);
|
|
17
20
|
let errorsBag = reactive({} as ErrorsBag);
|
|
18
21
|
let validationFields = [];
|
|
19
22
|
const instance = getCurrentInstance();
|
|
@@ -21,14 +24,14 @@ export default {
|
|
|
21
24
|
const dispatchError = () => {
|
|
22
25
|
const keys = Object.keys(errorsBag);
|
|
23
26
|
const errorsIds = keys.filter(key => !errorsBag[key]);
|
|
24
|
-
emit('
|
|
27
|
+
emit('update:modelValue', errorsIds.length === 0);
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
const watchInput = (field: any) => {
|
|
28
31
|
field.$watch(
|
|
29
32
|
'hasError',
|
|
30
33
|
() => {
|
|
31
|
-
errorsBag[field.
|
|
34
|
+
errorsBag[field.customId] = field.valid;
|
|
32
35
|
dispatchError();
|
|
33
36
|
},
|
|
34
37
|
{ immediate: true }
|
|
@@ -42,20 +45,9 @@ export default {
|
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
const recursiveFormField = $node => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
$node.children.forEach($leaf => {
|
|
49
|
-
if ($leaf.component?.ctx?.validate) {
|
|
50
|
-
validationFields.push($leaf.component?.ctx);
|
|
51
|
-
} else if ($leaf.children && $leaf.children.length > 1) {
|
|
52
|
-
recursiveFormField($leaf);
|
|
53
|
-
} else if ($leaf.children && $leaf.children[0] && $leaf.children[0].validate) {
|
|
54
|
-
validationFields.push($leaf.children[0]);
|
|
55
|
-
} else if ($leaf.validatable) {
|
|
56
|
-
validationFields.push($leaf);
|
|
57
|
-
} else {
|
|
58
|
-
recursiveFormField($leaf);
|
|
48
|
+
walk($node, item => {
|
|
49
|
+
if (item.validate) {
|
|
50
|
+
validationFields.push(item);
|
|
59
51
|
}
|
|
60
52
|
});
|
|
61
53
|
};
|
|
@@ -71,7 +63,7 @@ export default {
|
|
|
71
63
|
const restartValidation = () => {
|
|
72
64
|
validationFields = [];
|
|
73
65
|
errorsBag = {};
|
|
74
|
-
recursiveFormField(instance);
|
|
66
|
+
recursiveFormField(instance.subTree);
|
|
75
67
|
validationFields.forEach(field => {
|
|
76
68
|
watchInput(field);
|
|
77
69
|
field.validate(field.value);
|
|
@@ -82,7 +74,7 @@ export default {
|
|
|
82
74
|
const restart = () => {
|
|
83
75
|
validationFields = [];
|
|
84
76
|
errorsBag = {};
|
|
85
|
-
recursiveFormField(instance);
|
|
77
|
+
recursiveFormField(instance.subTree);
|
|
86
78
|
validationFields.forEach(field => {
|
|
87
79
|
watchInput(field);
|
|
88
80
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import IconBox from './IconBox';
|
|
2
|
+
import IconBox from './IconBox.vue';
|
|
3
3
|
import baseThemeColors from '../../configurations/_theme-colors-base.module.scss';
|
|
4
4
|
const colors = Object.keys(baseThemeColors);
|
|
5
5
|
import sizes from '../../configurations/sizes';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section :class="{ 'logger': true, 'logger--horizontal': !vertical, 'logger--left-aligned': align === 'left' }">
|
|
3
|
-
|
|
3
|
+
<!-- eslint-disable-next-line vue/no-v-for-template-key -->
|
|
4
|
+
<template v-for="(item, index) in items" :key="`logger_item_${index}`">
|
|
4
5
|
<farm-logger-item :item="item" :class="{
|
|
5
6
|
'logger__item--horizontal': !vertical,
|
|
6
7
|
'logger__item--left-aligned': align === 'left',
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
logger__divider: true,
|
|
10
11
|
[dividerCssClass(index)]: true,
|
|
11
12
|
}" :key="'divider_' + index"></div>
|
|
12
|
-
</
|
|
13
|
+
</template>
|
|
13
14
|
</section>
|
|
14
15
|
</template>
|
|
15
16
|
<script lang="ts">
|
|
@@ -50,8 +50,6 @@
|
|
|
50
50
|
</fieldset>
|
|
51
51
|
<v-data-table
|
|
52
52
|
id="v-data-table--default"
|
|
53
|
-
hide-default-header
|
|
54
|
-
hide-default-footer
|
|
55
53
|
:headers="headers"
|
|
56
54
|
:items="items"
|
|
57
55
|
:options.sync="pagination"
|
|
@@ -109,7 +107,7 @@
|
|
|
109
107
|
export default {
|
|
110
108
|
name: 'farm-select-modal-options',
|
|
111
109
|
components: {
|
|
112
|
-
|
|
110
|
+
// 'v-data-table': VDataTable,
|
|
113
111
|
},
|
|
114
112
|
props: {
|
|
115
113
|
/**
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
// import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import Tooltip from '.';
|
|
3
2
|
import baseThemeColors from '../../configurations/_theme-colors-base.module.scss';
|
|
4
3
|
const colors = Object.keys(baseThemeColors);
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: 'Interactions/Tooltip',
|
|
8
|
-
component: Tooltip,
|
|
9
7
|
// decorators: [withDesign],
|
|
10
8
|
parameters: {
|
|
11
9
|
docs: {
|
|
@@ -41,7 +39,7 @@ export const Tooltips = () => ({
|
|
|
41
39
|
this is the tooltip for {{ color }}
|
|
42
40
|
</span>
|
|
43
41
|
<template v-slot:activator="{ on, attrs }">
|
|
44
|
-
{{ color }}
|
|
42
|
+
<farm-bodytext :color="color">{{ color }}</farm-bodytext>
|
|
45
43
|
</template>
|
|
46
44
|
</farm-tooltip>
|
|
47
45
|
</div>`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Typography from './Typography';
|
|
1
|
+
import Typography from './Typography.vue';
|
|
2
2
|
import sizes from '../../configurations/sizes';
|
|
3
3
|
import baseThemeColors from '../../configurations/_theme-colors-base.module.scss';
|
|
4
4
|
import bwThemeColors from '../../configurations/_theme-colors-bw.module.scss';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import ValueCaption from '.';
|
|
2
|
+
import ValueCaption from './ValueCaption.vue';
|
|
3
3
|
import baseThemeColors from '../../configurations/_theme-colors-base.module.scss';
|
|
4
4
|
const colors = Object.keys(baseThemeColors);
|
|
5
5
|
|
|
@@ -126,35 +126,4 @@ export const CustomHtml = () => ({
|
|
|
126
126
|
Open
|
|
127
127
|
</farm-btn>
|
|
128
128
|
</div>`,
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
=======
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
export const DisabledHtml = () => ({
|
|
135
|
-
methods: {
|
|
136
|
-
openDialog() {
|
|
137
|
-
this.$dialog
|
|
138
|
-
.confirm(
|
|
139
|
-
{
|
|
140
|
-
title: 'Dialog title',
|
|
141
|
-
body: `This is a text with <strong>html markup</strong> and<br />break line!<br />
|
|
142
|
-
Also with an <i class="mdi mdi-book"></i>book icon<br />
|
|
143
|
-
and some <span style="color: var(--farm-warning-base)">color</span>`,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
html: false,
|
|
147
|
-
okText: 'Button',
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
.then(() => {})
|
|
151
|
-
.catch(() => {});
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
|
|
155
|
-
<farm-btn @click="openDialog">
|
|
156
|
-
Open
|
|
157
|
-
</farm-btn>
|
|
158
|
-
</div>`,
|
|
159
|
-
});
|
|
160
|
-
>>>>>>> vuejsdialog
|
|
129
|
+
});
|
|
@@ -4,7 +4,7 @@ import { VDataTable } from 'vuetify/labs/components';
|
|
|
4
4
|
const headers = [
|
|
5
5
|
{
|
|
6
6
|
title: 'ID',
|
|
7
|
-
sortable:
|
|
7
|
+
sortable: false,
|
|
8
8
|
value: 'id',
|
|
9
9
|
width: 80,
|
|
10
10
|
align: 'left',
|
|
@@ -12,7 +12,7 @@ const headers = [
|
|
|
12
12
|
{
|
|
13
13
|
title: 'Name',
|
|
14
14
|
sortable: false,
|
|
15
|
-
value: '
|
|
15
|
+
value: 'name',
|
|
16
16
|
width: 160,
|
|
17
17
|
align: 'left',
|
|
18
18
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
export default function walk(vnode: VNode, cb: Function) {
|
|
4
|
+
if (!vnode) return;
|
|
5
|
+
|
|
6
|
+
if (vnode.component) {
|
|
7
|
+
const proxy = vnode.component.proxy;
|
|
8
|
+
if (proxy) cb(vnode.component.proxy);
|
|
9
|
+
walk(vnode.component.subTree, cb);
|
|
10
|
+
} else if (vnode.shapeFlag & 16) {
|
|
11
|
+
const vnodes = vnode.children;
|
|
12
|
+
if (vnodes.length) {
|
|
13
|
+
const length = vnodes.length as number;
|
|
14
|
+
for (let i = 0; i < length; i++) {
|
|
15
|
+
walk(vnodes[i], cb);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -19,7 +19,7 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
19
19
|
border-bottom: none;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.v-
|
|
22
|
+
.v-table__wrapper {
|
|
23
23
|
border-top: 1px solid var(--farm-gray-lighten);
|
|
24
24
|
border-bottom: 1px solid var(--farm-gray-lighten);
|
|
25
25
|
}
|
|
@@ -35,7 +35,7 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
&.v-
|
|
38
|
+
&.v-table__wrapper>.v-table__wrapper>table {
|
|
39
39
|
|
|
40
40
|
>tbody>tr>td:first-child,
|
|
41
41
|
>thead>tr>th:first-child {
|
|
@@ -68,7 +68,7 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
68
68
|
padding-left: 24px;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
th
|
|
71
|
+
th {
|
|
72
72
|
color: var(--farm-secondary-green-darken);
|
|
73
73
|
font-size: 14px;
|
|
74
74
|
font-weight: 700;
|