@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.
Files changed (45) hide show
  1. package/dist/front-mfe-components.common.js +4275 -5619
  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 +4275 -5619
  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 +89 -89
  9. package/src/components/AlertBox/AlertBox.stories.js +0 -3
  10. package/src/components/AlertReload/AlertReload.stories.js +0 -7
  11. package/src/components/Buttons/ConfirmButton/ConfirmButton.stories.js +0 -4
  12. package/src/components/Buttons/DangerButton/DangerButton.stories.js +0 -3
  13. package/src/components/Checkbox/Checkbox.stories.js +1 -1
  14. package/src/components/Collapsible/Collapsible.stories.js +1 -1
  15. package/src/components/ContextMenu/ContextMenu.stories.js +1 -1
  16. package/src/components/DatePicker/DatePicker.stories.js +1 -1
  17. package/src/components/Form/Form.stories.js +117 -159
  18. package/src/components/Form/Form.vue +13 -21
  19. package/src/components/IconBox/IconBox.stories.js +1 -1
  20. package/src/components/Logger/Logger.vue +3 -2
  21. package/src/components/ManagersList/ManagersList.stories.js +1 -1
  22. package/src/components/MultipleSelectShortener/MultipleSelectShortener.stories.js +1 -1
  23. package/src/components/PromptUserToConfirm/PromptUserToConfirm.stories.js +1 -1
  24. package/src/components/RadioGroup/RadioGroup.stories.js +1 -1
  25. package/src/components/RangeDatePicker/RangeDatePicker.stories.js +1 -1
  26. package/src/components/ResetTableRowSelection/ResetTableRowSelection.stories.js +1 -1
  27. package/src/components/SelectModalOptions/SelectModalOptions.scss +1 -1
  28. package/src/components/SelectModalOptions/SelectModalOptions.stories.js +0 -3
  29. package/src/components/SelectModalOptions/SelectModalOptions.vue +1 -3
  30. package/src/components/Switcher/Switcher.stories.js +1 -1
  31. package/src/components/TableContextMenu/TableContextMenu.stories.js +1 -1
  32. package/src/components/TextFieldV2/TextFieldV2.vue +1 -1
  33. package/src/components/Tooltip/Tooltip.stories.js +1 -3
  34. package/src/components/Typography/BodyText/BodyText.stories.js +0 -3
  35. package/src/components/Typography/Caption/Caption.stories.js +1 -1
  36. package/src/components/Typography/Heading/Heading.stories.js +1 -1
  37. package/src/components/Typography/Small/Small.stories.js +0 -3
  38. package/src/components/Typography/Subtitle/Subtitle.stories.js +1 -1
  39. package/src/components/Typography/Typography.stories.js +1 -1
  40. package/src/components/ValueCaption/ValueCaption.stories.js +1 -1
  41. package/src/examples/Dialog.stories.js +1 -32
  42. package/src/examples/Table.stories.js +2 -2
  43. package/src/helpers/walk.ts +19 -0
  44. package/src/scss/Sticky-table.scss +3 -3
  45. package/src/scss/utils.scss +1 -1
@@ -1,7 +1,10 @@
1
1
  <template>
2
- <form class="farm-form"><slot></slot></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
- value: { type: [Boolean] },
15
+ modelValue: { type: [Boolean] },
13
16
  },
14
17
  inheritAttrs: true,
15
18
  setup(props, { emit }) {
16
- const innerValue = ref(props.value);
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('input', errorsIds.length === 0);
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._uid] = field.valid;
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
- if(!Array.isArray($node.children)) {
46
- return;
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
- <div v-for="(item, index) in items" :key="`logger_item_${index}`">
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
- </div>
13
+ </template>
13
14
  </section>
14
15
  </template>
15
16
  <script lang="ts">
@@ -1,4 +1,4 @@
1
- import ManagersList from './ManagersList';
1
+ import ManagersList from './ManagersList.vue';
2
2
 
3
3
  export default {
4
4
  title: 'Display/ManagersList',
@@ -1,4 +1,4 @@
1
- import MultipleSelectShortener from './MultipleSelectShortener';
1
+ import MultipleSelectShortener from './MultipleSelectShortener.vue';
2
2
 
3
3
  export default {
4
4
  title: 'Display/MultipleSelectShortener',
@@ -1,4 +1,4 @@
1
- import PromptUserToConfirm from './PromptUserToConfirm';
1
+ import PromptUserToConfirm from './PromptUserToConfirm.vue';
2
2
 
3
3
  export default {
4
4
  title: 'Interactions/PromptUserToConfirm',
@@ -1,4 +1,4 @@
1
- import RadioGroup from './RadioGroup';
1
+ import RadioGroup from './RadioGroup.vue';
2
2
  // import { withDesign } from 'storybook-addon-designs';
3
3
 
4
4
  export default {
@@ -1,5 +1,5 @@
1
1
  // import { withDesign } from 'storybook-addon-designs';
2
- import RangeDatePicker from './RangeDatePicker';
2
+ import RangeDatePicker from './RangeDatePicker.vue';
3
3
 
4
4
  export default {
5
5
  title: 'Form/RangeDatePicker',
@@ -1,4 +1,4 @@
1
- import ResetTableRowSelection from './ResetTableRowSelection';
1
+ import ResetTableRowSelection from './ResetTableRowSelection.vue';
2
2
 
3
3
  export default {
4
4
  title: 'Interactions/ResetTableRowSelection',
@@ -8,7 +8,7 @@
8
8
  border: 0;
9
9
  }
10
10
 
11
- :deep(#v-data-table--default) {
11
+ :deep(#v-table--default) {
12
12
  thead {
13
13
  display: none;
14
14
  }
@@ -1,8 +1,5 @@
1
- import SelectModalOptions from './SelectModalOptions';
2
-
3
1
  export default {
4
2
  title: 'Interactions/SelectModalOptions',
5
- component: SelectModalOptions,
6
3
  };
7
4
 
8
5
  export const Primary = () => ({
@@ -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
- // 'v-data-table': VDataTable,
110
+ // 'v-data-table': VDataTable,
113
111
  },
114
112
  props: {
115
113
  /**
@@ -1,4 +1,4 @@
1
- import Switch from './Switcher';
1
+ import Switch from './Switcher.vue';
2
2
  import baseThemeColors from '../../configurations/_theme-colors-base.module.scss';
3
3
  const colors = Object.keys(baseThemeColors);
4
4
 
@@ -1,4 +1,4 @@
1
- import TableContextMenu from './TableContextMenu';
1
+ import TableContextMenu from './TableContextMenu.vue';
2
2
  // import { withDesign } from 'storybook-addon-designs';
3
3
 
4
4
  export default {
@@ -241,7 +241,7 @@ export default {
241
241
  const reset = () => {
242
242
  innerValue.value = '';
243
243
  isTouched.value = true;
244
- emit('input', innerValue.value);
244
+ emit('update:modelValue', innerValue.value);
245
245
  };
246
246
 
247
247
  const makePristine = () => {
@@ -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,8 +1,5 @@
1
- import BodyText from './BodyText';
2
-
3
1
  export default {
4
2
  title: 'Typography/BodyText',
5
- component: BodyText,
6
3
  parameters: {
7
4
  docs: {
8
5
  description: {
@@ -1,4 +1,4 @@
1
- import Caption from './Caption';
1
+ import Caption from './Caption.vue';
2
2
 
3
3
  export default {
4
4
  title: 'Typography/Caption',
@@ -1,4 +1,4 @@
1
- import Heading from './Heading';
1
+ import Heading from './Heading.vue';
2
2
 
3
3
  export default {
4
4
  title: 'Typography/Heading',
@@ -1,8 +1,5 @@
1
- import Small from './Small';
2
-
3
1
  export default {
4
2
  title: 'Typography/Small',
5
- component: Small,
6
3
  parameters: {
7
4
  docs: {
8
5
  description: {
@@ -1,4 +1,4 @@
1
- import Subtitle from './Subtitle';
1
+ import Subtitle from './Subtitle.vue';
2
2
 
3
3
  export default {
4
4
  title: 'Typography/Subtitle',
@@ -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
- <<<<<<< HEAD
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: true,
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: 'id',
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-data-table__wrapper {
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-data-table>.v-data-table__wrapper>table {
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[role='columnheader'] {
71
+ th {
72
72
  color: var(--farm-secondary-green-darken);
73
73
  font-size: 14px;
74
74
  font-weight: 700;
@@ -2,7 +2,7 @@
2
2
  max-width: 960px;
3
3
  }
4
4
 
5
- tr.v-data-table__empty-wrapper {
5
+ tr.v-data-table-rows-no-data {
6
6
  td {
7
7
  background-color: white !important;
8
8
  cursor: default !important;