@farm-investimentos/front-mfe-components 15.2.2 → 15.3.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 (88) hide show
  1. package/dist/front-mfe-components.common.js +2863 -1623
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +2 -2
  4. package/dist/front-mfe-components.umd.js +2863 -1623
  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 +5 -2
  9. package/src/components/AlertBox/AlertBox.vue +2 -2
  10. package/src/components/AlertReload/AlertReload.vue +2 -2
  11. package/src/components/ButtonToggle/ButtonToggle.vue +3 -2
  12. package/src/components/ButtonToggle/__tests__/ButtonToggle.spec.js +17 -0
  13. package/src/components/Buttons/ConfirmButton/ConfirmButton.vue +2 -2
  14. package/src/components/Buttons/DangerButton/DangerButton.vue +2 -2
  15. package/src/components/Buttons/DefaultButton/DefaultButton.vue +2 -2
  16. package/src/components/Buttons/ExportButton/ExportButton.vue +2 -2
  17. package/src/components/Buttons/ImportButton/ImportButton.vue +2 -2
  18. package/src/components/Buttons/MultiImportButton/MultiImportButton.vue +2 -2
  19. package/src/components/Buttons/RemoveButton/RemoveButton.vue +3 -3
  20. package/src/components/Buttons/ToggleButton/ToggleButton.vue +2 -2
  21. package/src/components/Card/Card.vue +2 -2
  22. package/src/components/Card/CardContent/CardContent.vue +2 -2
  23. package/src/components/Checkbox/Checkbox.vue +18 -4
  24. package/src/components/Chip/Chip.vue +2 -2
  25. package/src/components/ChipInviteStatus/ChipInviteStatus.vue +2 -2
  26. package/src/components/Collapsible/Collapsible.vue +2 -2
  27. package/src/components/ContextMenu/ContextMenu.vue +2 -2
  28. package/src/components/CopyToClipboard/CopyToClipboard.vue +2 -2
  29. package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.vue +2 -2
  30. package/src/components/DataTableHeader/DataTableHeader.vue +2 -2
  31. package/src/components/DataTablePaginator/DataTablePaginator.vue +2 -2
  32. package/src/components/DatePicker/DatePicker.vue +2 -2
  33. package/src/components/DialogFooter/DialogFooter.vue +2 -2
  34. package/src/components/DialogHeader/DialogHeader.vue +2 -2
  35. package/src/components/Form/Form.vue +2 -2
  36. package/src/components/Icon/Icon.vue +2 -2
  37. package/src/components/IconBox/IconBox.vue +2 -2
  38. package/src/components/IdCaption/IdCaption.vue +2 -2
  39. package/src/components/Label/Label.vue +2 -2
  40. package/src/components/List/List.vue +2 -2
  41. package/src/components/ListItem/ListItem.vue +2 -2
  42. package/src/components/Loader/Loader.vue +2 -2
  43. package/src/components/Logger/Logger.vue +2 -2
  44. package/src/components/Logger/LoggerItem/LoggerItem.vue +2 -2
  45. package/src/components/Logos/OriginatorLogo/OriginatorLogo.vue +2 -2
  46. package/src/components/Logos/ProductLogo/ProductLogo.vue +2 -2
  47. package/src/components/MainFilter/MainFilter.vue +2 -2
  48. package/src/components/ManagersList/ManagersList.vue +2 -2
  49. package/src/components/Modal/Modal.vue +11 -2
  50. package/src/components/ModalPromptUser/ModalPromptUser.vue +2 -2
  51. package/src/components/MultipleFilePicker/MultipleFilePicker.vue +6 -6
  52. package/src/components/MultipleSelectShortener/MultipleSelectShortener.vue +2 -2
  53. package/src/components/ProgressBar/ProgressBar.vue +2 -2
  54. package/src/components/PromptUserToConfirm/PromptUserToConfirm.vue +2 -2
  55. package/src/components/Radio/Radio.vue +2 -2
  56. package/src/components/RadioGroup/RadioGroup.vue +2 -2
  57. package/src/components/RangeDatePicker/RangeDatePicker.vue +4 -3
  58. package/src/components/ResetTableRowSelection/ResetTableRowSelection.stories.js +1 -1
  59. package/src/components/ResetTableRowSelection/ResetTableRowSelection.vue +4 -10
  60. package/src/components/ResourceMetaInfo/ResourceMetaInfo.stories.js +19 -0
  61. package/src/components/ResourceMetaInfo/ResourceMetaInfo.vue +49 -9
  62. package/src/components/ResourceMetaInfo/__tests__/ResourceMetaInfo.spec.js +54 -0
  63. package/src/components/Select/Select.vue +2 -2
  64. package/src/components/SelectModalOptions/SelectModalOptions.vue +2 -2
  65. package/src/components/Stepper/StepperHeader/StepperHeader.vue +2 -2
  66. package/src/components/Switcher/Switcher.vue +2 -2
  67. package/src/components/TableContextMenu/TableContextMenu.vue +5 -3
  68. package/src/components/Tabs/Tabs.vue +3 -2
  69. package/src/components/TextArea/TextArea.vue +2 -2
  70. package/src/components/TextFieldV2/TextFieldV2.vue +2 -2
  71. package/src/components/Tooltip/Tooltip.vue +2 -2
  72. package/src/components/Typography/BodyText/BodyText.vue +2 -2
  73. package/src/components/Typography/Caption/Caption.vue +2 -2
  74. package/src/components/Typography/Heading/Heading.vue +2 -2
  75. package/src/components/Typography/OverlayText/OverlayText.vue +2 -2
  76. package/src/components/Typography/Small/Small.vue +2 -2
  77. package/src/components/Typography/Subtitle/Subtitle.vue +2 -2
  78. package/src/components/Typography/Typography.vue +2 -2
  79. package/src/components/ValueCaption/ValueCaption.vue +3 -2
  80. package/src/components/layout/Box/Box.vue +2 -2
  81. package/src/components/layout/Col/Col.vue +2 -2
  82. package/src/components/layout/Container/Container.vue +2 -2
  83. package/src/components/layout/ContainerFooter/ContainerFooter.vue +2 -2
  84. package/src/components/layout/Line/Line.vue +2 -2
  85. package/src/components/layout/Row/Row.vue +2 -2
  86. package/src/composition/__tests__/validateFormFieldBuilder.spec.js +26 -0
  87. package/src/composition/validateFormFieldBuilder.ts +2 -3
  88. package/src/examples/Table.stories.js +43 -16
@@ -11,11 +11,11 @@
11
11
  </farm-typography>
12
12
  </template>
13
13
  <script lang="ts">
14
- import Vue, { computed, ref, watch, toRefs, PropType } from 'vue';
14
+ import { defineComponent, computed, ref, watch, toRefs, PropType } from 'vue';
15
15
 
16
16
  import { Keys } from './configurations';
17
17
 
18
- export default Vue.extend({
18
+ export default defineComponent({
19
19
  inheritAttrs: true,
20
20
  name: 'farm-bodysmall',
21
21
  props: {
@@ -11,11 +11,11 @@
11
11
  </farm-typography>
12
12
  </template>
13
13
  <script lang="ts">
14
- import Vue, { computed, ref, watch, toRefs, PropType } from 'vue';
14
+ import { defineComponent, computed, ref, watch, toRefs, PropType } from 'vue';
15
15
 
16
16
  import { Keys } from './configurations';
17
17
 
18
- export default Vue.extend({
18
+ export default defineComponent({
19
19
  inheritAttrs: true,
20
20
  name: 'farm-subtitle',
21
21
  props: {
@@ -18,11 +18,11 @@
18
18
  </component>
19
19
  </template>
20
20
  <script lang="ts">
21
- import Vue, { computed, PropType, ref, toRefs } from 'vue';
21
+ import { defineComponent, computed, PropType, ref, toRefs } from 'vue';
22
22
  import breakPoints from '../../configurations/sizes';
23
23
  import typographyHtmlTags from '../../configurations/typographyHtmlTags';
24
24
 
25
- export default Vue.extend({
25
+ export default defineComponent({
26
26
  inheritAttrs: true,
27
27
  name: 'farm-typography',
28
28
  props: {
@@ -14,8 +14,9 @@
14
14
  </template>
15
15
 
16
16
  <script lang="ts">
17
- import Vue, { computed, PropType } from 'vue';
18
- export default Vue.extend({
17
+ import { computed, PropType, defineComponent } from 'vue';
18
+
19
+ export default defineComponent({
19
20
  name: 'farm-valuecaption',
20
21
  props: {
21
22
  /**
@@ -12,9 +12,9 @@
12
12
  </component>
13
13
  </template>
14
14
  <script lang="ts">
15
- import Vue, { PropType } from 'vue';
15
+ import { defineComponent, PropType } from 'vue';
16
16
 
17
- export default Vue.extend({
17
+ export default defineComponent({
18
18
  name: 'farm-box',
19
19
  props: {
20
20
  /**
@@ -22,9 +22,9 @@
22
22
  </component>
23
23
  </template>
24
24
  <script lang="ts">
25
- import Vue, { PropType } from 'vue';
25
+ import { PropType, defineComponent } from 'vue';
26
26
 
27
- export default Vue.extend({
27
+ export default defineComponent({
28
28
  name: 'farm-col',
29
29
  props: {
30
30
  /**
@@ -6,9 +6,9 @@
6
6
  </section>
7
7
  </template>
8
8
  <script lang="ts">
9
- import Vue from 'vue';
9
+ import { defineComponent } from 'vue';
10
10
 
11
- export default Vue.extend({
11
+ export default defineComponent({
12
12
  name: 'farm-container',
13
13
  inheritAttrs: true,
14
14
  });
@@ -9,9 +9,9 @@
9
9
  </footer>
10
10
  </template>
11
11
  <script lang="ts">
12
- import Vue from 'vue';
12
+ import { defineComponent } from 'vue';
13
13
 
14
- export default Vue.extend({
14
+ export default defineComponent({
15
15
  name: 'farm-container-footer',
16
16
  props: {
17
17
  noTop: {
@@ -11,9 +11,9 @@
11
11
  </template>
12
12
 
13
13
  <script lang="ts">
14
- import Vue, { PropType } from 'vue';
14
+ import { PropType, defineComponent } from 'vue';
15
15
 
16
- export default Vue.extend({
16
+ export default defineComponent({
17
17
  name: 'farm-line',
18
18
  props: {
19
19
  /**
@@ -15,9 +15,9 @@
15
15
  </component>
16
16
  </template>
17
17
  <script lang="ts">
18
- import Vue, { PropType } from 'vue';
18
+ import { PropType, defineComponent } from 'vue';
19
19
 
20
- export default Vue.extend({
20
+ export default defineComponent({
21
21
  name: 'farm-row',
22
22
  props: {
23
23
  /**
@@ -5,4 +5,30 @@ describe('validateFormFieldBuilder', () => {
5
5
  const r = validateFormFieldBuilder();
6
6
  expect(typeof r).toEqual('function');
7
7
  });
8
+
9
+ it('Should run validations', () => {
10
+ const rules = [() => true, () => true];
11
+ const r = validateFormFieldBuilder(rules)(1);
12
+ expect(r.length).toEqual(0);
13
+ expect(r instanceof Array).toBeTruthy();
14
+ });
15
+
16
+ it('Should run validations and have some error', () => {
17
+ const rules = [() => true, () => false, () => false];
18
+ const r = validateFormFieldBuilder(rules)(1);
19
+ expect(r.length).toEqual(2);
20
+ expect(r instanceof Array).toBeTruthy();
21
+ });
22
+
23
+ it('Should run validations and have some error', () => {
24
+ const rules = [() => true, () => false, () => false];
25
+ const r = validateFormFieldBuilder(rules)(1);
26
+ expect(r.length).toEqual(2);
27
+ expect(r instanceof Array).toBeTruthy();
28
+ });
29
+
30
+ it('Should throw error', () => {
31
+ const rules = [() => 123];
32
+ expect(() => validateFormFieldBuilder(rules)(1)).toThrowError();
33
+ });
8
34
  });
@@ -8,9 +8,8 @@ export default function (rules) {
8
8
  if (valid === false || typeof valid === 'string') {
9
9
  innerErrorBucket.push(valid || '');
10
10
  } else if (typeof valid !== 'boolean') {
11
- console.error(
12
- `Rules should return a string or boolean, received '${typeof valid}' instead`,
13
- this
11
+ throw new Error(
12
+ `Rules should return a string or boolean, received '${typeof valid}' instead`
14
13
  );
15
14
  }
16
15
  }
@@ -83,6 +83,7 @@ export const TableSampleData = () => ({
83
83
  </v-data-table>
84
84
  </div>`,
85
85
  });
86
+
86
87
  export const TableSampleDataWithCheckbox = () => ({
87
88
  components: { 'v-data-table': VDataTable },
88
89
  data() {
@@ -93,6 +94,7 @@ export const TableSampleDataWithCheckbox = () => ({
93
94
  { id: 2, name: 'name 2' },
94
95
  { id: 3, name: 'name 3' },
95
96
  ],
97
+ selectedItems: [],
96
98
  };
97
99
  },
98
100
  template: `<div>
@@ -102,8 +104,8 @@ export const TableSampleDataWithCheckbox = () => ({
102
104
  :headers="headers"
103
105
  :items="items"
104
106
  show-select
107
+ v-model="selectedItems"
105
108
  >
106
-
107
109
  </v-data-table>
108
110
  </div>`,
109
111
  });
@@ -161,18 +163,43 @@ export const TableSampleLocalPagination = () => ({
161
163
  </div>`,
162
164
  });
163
165
 
164
- TableNoData.story = {
165
- name: 'No data',
166
- };
167
-
168
- TableSampleData.story = {
169
- name: 'With data',
170
- };
171
-
172
- TableSampleDataWithCheckbox.story = {
173
- name: 'With data and checkbox',
174
- };
175
-
176
- TableSampleLocalPagination.story = {
177
- name: 'With data and local pagination',
178
- };
166
+ export const TableSampleDataWithFarmCheckbox = () => ({
167
+ components: { 'v-data-table': VDataTable },
168
+ data() {
169
+ return {
170
+ headers,
171
+ items: [
172
+ { id: 1, name: 'name 1' },
173
+ { id: 2, name: 'name 2' },
174
+ { id: 3, name: 'name 3' },
175
+ ],
176
+ selectedItems: [],
177
+ };
178
+ },
179
+ methods: {
180
+ onSelect({ item }) {
181
+ if (item.id === 2)
182
+ this.selectedItems = [...this.selectedItems].filter(
183
+ innerItem => innerItem.id !== 2
184
+ );
185
+ },
186
+ isItemSelected(item) {
187
+ return this.selectedItems.some(innerItem => innerItem.id === item.id);
188
+ },
189
+ },
190
+ template: `<div>{{selectedItems}}
191
+ <v-data-table
192
+ hide-default-footer
193
+ id="v-data-table--default"
194
+ v-model="selectedItems"
195
+ show-select
196
+ :headers="headers"
197
+ :items="items"
198
+ @item-selected="onSelect"
199
+ >
200
+ <template v-slot:item.data-table-select="{ isSelected, select, item }">
201
+ <farm-checkbox :value="item.id" :checked="isItemSelected(item)" @input="select($event)"/>
202
+ </template>
203
+ </v-data-table>
204
+ </div>`,
205
+ });