@mozaic-ds/vue 2.16.0 → 2.18.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 (132) hide show
  1. package/dist/mozaic-vue.css +2 -1
  2. package/dist/mozaic-vue.d.ts +258 -137
  3. package/dist/mozaic-vue.js +14054 -10878
  4. package/dist/mozaic-vue.js.map +1 -1
  5. package/dist/mozaic-vue.umd.cjs +7 -25
  6. package/dist/mozaic-vue.umd.cjs.map +1 -1
  7. package/package.json +22 -11
  8. package/src/components/BrandPresets.mdx +2 -2
  9. package/src/components/Migration.mdx +651 -0
  10. package/src/components/accordionlist/MAccordionList.figma.ts +43 -0
  11. package/src/components/accordionlistitem/MAccordionListItem.figma.ts +27 -0
  12. package/src/components/accordionlistitem/MAccordionListItem.spec.ts +22 -3
  13. package/src/components/accordionlistitem/MAccordionListItem.vue +38 -28
  14. package/src/components/actionbottombar/MActionBottomBar.figma.ts +24 -0
  15. package/src/components/actionlistbox/MActionListbox.figma.ts +30 -0
  16. package/src/components/avatar/MAvatar.figma.ts +31 -0
  17. package/src/components/breadcrumb/MBreadcrumb.figma.ts +31 -0
  18. package/src/components/builtinmenu/MBuiltInMenu.figma.ts +23 -0
  19. package/src/components/builtinmenu/MBuiltInMenu.spec.ts +30 -1
  20. package/src/components/builtinmenu/MBuiltInMenu.vue +26 -17
  21. package/src/components/builtinmenu/README.md +2 -0
  22. package/src/components/button/MButton.figma.ts +41 -0
  23. package/src/components/callout/MCallout.figma.ts +29 -0
  24. package/src/components/callout/MCallout.spec.ts +35 -0
  25. package/src/components/callout/MCallout.vue +22 -4
  26. package/src/components/callout/README.md +2 -0
  27. package/src/components/carousel/MCarousel.figma.ts +32 -0
  28. package/src/components/checkbox/MCheckbox.figma.ts +45 -0
  29. package/src/components/checkboxgroup/MCheckboxGroup.figma.ts +30 -0
  30. package/src/components/checklistmenu/MCheckListMenu.figma.ts +29 -0
  31. package/src/components/checklistmenu/MCheckListMenu.spec.ts +12 -1
  32. package/src/components/checklistmenu/MCheckListMenu.vue +6 -0
  33. package/src/components/checklistmenu/README.md +2 -0
  34. package/src/components/circularprogressbar/MCircularProgressbar.figma.ts +31 -0
  35. package/src/components/combobox/MCombobox.figma.ts +48 -0
  36. package/src/components/combobox/MCombobox.spec.ts +1 -1
  37. package/src/components/combobox/MCombobox.vue +18 -9
  38. package/src/components/combobox/README.md +2 -2
  39. package/src/components/container/MContainer.figma.ts +30 -0
  40. package/src/components/datatable/DataTable.stories.ts +277 -0
  41. package/src/components/datatable/DataTableCells.stories.ts +251 -0
  42. package/src/components/datatable/DataTableEmpty.stories.ts +102 -0
  43. package/src/components/datatable/DataTableExpandable.stories.ts +95 -0
  44. package/src/components/datatable/DataTableNested.stories.ts +96 -0
  45. package/src/components/datatable/DataTableSelectable.stories.ts +124 -0
  46. package/src/components/datatable/DataTableSortable.stories.ts +164 -0
  47. package/src/components/datatable/MDataTable.types.ts +54 -0
  48. package/src/components/datatable/assets/styles.scss +10 -0
  49. package/src/components/datatable/datatable.mdx +63 -0
  50. package/src/components/datatable/tools/data.js +8 -0
  51. package/src/components/datatable/tools/data.json +2018 -0
  52. package/src/components/datatable/utils.js +19 -0
  53. package/src/components/datepicker/MDatepicker.figma.ts +20 -0
  54. package/src/components/divider/MDivider.figma.ts +30 -0
  55. package/src/components/drawer/MDrawer.figma.ts +37 -0
  56. package/src/components/drawer/README.md +1 -1
  57. package/src/components/field/MField.figma.ts +30 -0
  58. package/src/components/fileuploader/MFileUploader.figma.ts +23 -0
  59. package/src/components/fileuploaderitem/MFileUploaderItem.figma.ts +27 -0
  60. package/src/components/flag/MFlag.figma.ts +26 -0
  61. package/src/components/iconbutton/MIconButton.figma.ts +54 -0
  62. package/src/components/kpiitem/MKpiItem.figma.ts +33 -0
  63. package/src/components/linearprogressbarbuffer/MLinearProgressbarBuffer.figma.ts +31 -0
  64. package/src/components/linearprogressbarpercentage/MLinearProgressbarPercentage.figma.ts +26 -0
  65. package/src/components/link/MLink.figma.ts +32 -0
  66. package/src/components/loader/MLoader.figma.ts +30 -0
  67. package/src/components/loadingoverlay/MLoadingOverlay.figma.ts +18 -0
  68. package/src/components/modal/MModal.figma.ts +27 -0
  69. package/src/components/navigationindicator/MNavigationIndicator.figma.ts +24 -0
  70. package/src/components/navigationindicator/MNavigationIndicator.spec.ts +75 -18
  71. package/src/components/navigationindicator/MNavigationIndicator.vue +10 -12
  72. package/src/components/numberbadge/MNumberBadge.figma.ts +31 -0
  73. package/src/components/optionListbox/MOptionListbox.figma.ts +36 -0
  74. package/src/components/optionListbox/MOptionListbox.vue +34 -19
  75. package/src/components/optionListbox/README.md +1 -1
  76. package/src/components/overlay/MOverlay.figma.ts +20 -0
  77. package/src/components/pageheader/MPageHeader.figma.ts +21 -0
  78. package/src/components/pagination/MPagination.figma.ts +34 -0
  79. package/src/components/passwordinput/MPasswordInput.figma.ts +30 -0
  80. package/src/components/phonenumber/MPhoneNumber.figma.ts +47 -0
  81. package/src/components/pincode/MPincode.figma.ts +41 -0
  82. package/src/components/pincode/MPincode.spec.ts +1 -4
  83. package/src/components/pincode/MPincode.vue +11 -15
  84. package/src/components/popover/MPopover.figma.ts +42 -0
  85. package/src/components/popover/MPopover.spec.ts +126 -0
  86. package/src/components/popover/MPopover.vue +36 -1
  87. package/src/components/quantityselector/MQuantitySelector.figma.ts +50 -0
  88. package/src/components/radio/MRadio.figma.ts +40 -0
  89. package/src/components/radiogroup/MRadioGroup.figma.ts +30 -0
  90. package/src/components/segmentedcontrol/MSegmentedControl.figma.ts +33 -0
  91. package/src/components/segmentedcontrol/MSegmentedControl.spec.ts +92 -0
  92. package/src/components/segmentedcontrol/MSegmentedControl.vue +61 -2
  93. package/src/components/select/MSelect.figma.ts +49 -0
  94. package/src/components/sidebar/MSidebar.figma.ts +28 -0
  95. package/src/components/sidebarexpandableitem/MSidebarExpandableItem.figma.ts +19 -0
  96. package/src/components/sidebarfooter/MSidebarFooter.figma.ts +21 -0
  97. package/src/components/sidebarheader/MSidebarHeader.figma.ts +18 -0
  98. package/src/components/sidebarnavitem/MSidebarNavItem.figma.ts +23 -0
  99. package/src/components/sidebarshortcutitem/MSidebarShortcutItem.figma.ts +20 -0
  100. package/src/components/starrating/MStarRating.figma.ts +35 -0
  101. package/src/components/starrating/MStarRating.spec.ts +19 -22
  102. package/src/components/starrating/MStarRating.vue +3 -2
  103. package/src/components/statusbadge/MStatusBadge.figma.ts +27 -0
  104. package/src/components/statusdot/MStatusDot.figma.ts +31 -0
  105. package/src/components/statusmessage/MStatusMessage.figma.ts +28 -0
  106. package/src/components/statusmessage/MStatusMessage.spec.ts +15 -0
  107. package/src/components/statusmessage/MStatusMessage.stories.ts +4 -0
  108. package/src/components/statusmessage/MStatusMessage.vue +7 -0
  109. package/src/components/statusmessage/README.md +2 -0
  110. package/src/components/statusnotification/MStatusNotification.figma.ts +29 -0
  111. package/src/components/stepperbottombar/MStepperBottomBar.figma.ts +20 -0
  112. package/src/components/steppercompact/MStepperCompact.figma.ts +21 -0
  113. package/src/components/stepperinline/MStepperInline.figma.ts +23 -0
  114. package/src/components/stepperstacked/MStepperStacked.figma.ts +23 -0
  115. package/src/components/tabs/MTabs.figma.ts +33 -0
  116. package/src/components/tabs/MTabs.vue +90 -4
  117. package/src/components/tabs/Mtabs.spec.ts +162 -0
  118. package/src/components/tag/MTag.figma.ts +26 -0
  119. package/src/components/tag/MTag.stories.ts +13 -3
  120. package/src/components/tag/MTag.vue +11 -1
  121. package/src/components/tag/README.md +6 -0
  122. package/src/components/textarea/MTextArea.figma.ts +28 -0
  123. package/src/components/textinput/MTextInput.figma.ts +51 -0
  124. package/src/components/tile/MTile.figma.ts +31 -0
  125. package/src/components/tileclickable/MTileClickable.figma.ts +31 -0
  126. package/src/components/tileexpandable/MTileExpandable.figma.ts +31 -0
  127. package/src/components/tileselectable/MTileSelectable.figma.ts +29 -0
  128. package/src/components/toaster/MToaster.figma.ts +25 -0
  129. package/src/components/toggle/MToggle.figma.ts +39 -0
  130. package/src/components/togglegroup/MToggleGroup.figma.ts +30 -0
  131. package/src/components/tooltip/MTooltip.figma.ts +29 -0
  132. package/src/main.ts +1 -0
@@ -0,0 +1,95 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
+ import * as utils from './utils';
3
+
4
+ // Components
5
+ import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
6
+
7
+ const meta: Meta<typeof MDataTable> = {
8
+ title: 'DataTable/MDataTable Expandable',
9
+ component: MDataTable,
10
+ args: utils.args,
11
+ parameters: {
12
+ componentName: 'MDataTable',
13
+ docs: {
14
+ canvas: { sourceState: 'none' },
15
+ }
16
+ },
17
+ render: (args) => ({
18
+ components: { MDataTable, MDataTableColumn },
19
+ setup() {
20
+ return { args };
21
+ },
22
+ template: `
23
+ <MDataTable v-bind="args">
24
+ <!--
25
+ Default content
26
+ -->
27
+ <MDataTableColumn label="Name" value="name" />
28
+ <MDataTableColumn label="Stock" value="stock" />
29
+
30
+ <!-- Start Date -->
31
+ <MDataTableColumn label="Start date" value="startDate" />
32
+ <template v-slot:cell.startDate="{ item }">
33
+ {{ formatDate(item.startDate) }}
34
+ </template>
35
+
36
+ <!-- End Date -->
37
+ <MDataTableColumn label="End date" value="endDate" />
38
+ <template v-slot:cell.endDate="{ item }">
39
+ {{ formatDate(item.startDate) }}
40
+ </template>
41
+
42
+ <!-- Status -->
43
+ <MDataTableColumn label="Statut" value="status" />
44
+ <template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
45
+
46
+ <!-- Expandable Row -->
47
+ <template v-slot:expandContent="expandProps">
48
+ <div
49
+ style="
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ padding: 20px;
54
+ "
55
+ >
56
+ <p>
57
+ {{ expandProps }}
58
+ <strong>
59
+ This is the expand content for row n°{{ expandProps.rowIndex }}
60
+ </strong>
61
+ </p>
62
+ </div>
63
+ </template>
64
+ </MDataTable>
65
+ `,
66
+ methods: {
67
+ formatDate(date) {
68
+ return new Date(date).toLocaleString();
69
+ },
70
+ },
71
+ }),
72
+ };
73
+
74
+ export default meta;
75
+ type Story = StoryObj<typeof MDataTable>;
76
+
77
+ export const Default: Story = {
78
+ args: {
79
+ expandable: true,
80
+ },
81
+ };
82
+
83
+ export const ExpandedRows: Story = {
84
+ args: {
85
+ ...Default.args,
86
+ showExpandableContent: true,
87
+ },
88
+ };
89
+
90
+ export const SpecifiedRows: Story = {
91
+ args: {
92
+ ...Default.args,
93
+ expandableList: [1, 7, 9],
94
+ },
95
+ };
@@ -0,0 +1,96 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
+ import { ref } from 'vue';
3
+ import * as utils from './utils';
4
+
5
+ // Components
6
+ import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
7
+
8
+ const meta: Meta<typeof MDataTable> = {
9
+ title: 'DataTable/MDataTable Nested',
10
+ component: MDataTable,
11
+ args: utils.args,
12
+ parameters: {
13
+ componentName: 'MDataTable',
14
+ docs: {
15
+ canvas: { sourceState: 'none' },
16
+ }
17
+ },
18
+ render: (args) => ({
19
+ components: { MDataTable, MDataTableColumn },
20
+ setup() {
21
+ const subItems = ref([...utils.addlDeals.slice(0, 5)]);
22
+ return { args, subItems };
23
+ },
24
+ template: `
25
+ <MDataTable v-bind="args">
26
+ <!-- Columns -->
27
+ <MDataTableColumn label="Name" value="name" />
28
+ <MDataTableColumn label="Stock" value="stock" />
29
+ <MDataTableColumn label="Start date" value="startDate" />
30
+ <MDataTableColumn label="End date" value="endDate" />
31
+ <MDataTableColumn label="Statut" value="status" />
32
+
33
+ <!-- Cells -->
34
+ <template v-slot:cell.startDate="{ item }">
35
+ {{ formatDate(item.startDate) }}
36
+ </template>
37
+ <template v-slot:cell.endDate="{ item }">
38
+ {{ formatDate(item.startDate) }}
39
+ </template>
40
+ <template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
41
+
42
+ <!-- Expandable Content -->
43
+ <template v-slot:expandContent="slotProps">
44
+ <MDataTable :items="subItems" nested>
45
+ <!-- Columns -->
46
+ <MDataTableColumn label="" value="button" type="button" />
47
+ <MDataTableColumn label="Name" value="name" />
48
+ <MDataTableColumn label="Stock" value="stock" />
49
+ <MDataTableColumn label="Start date" value="startDate" />
50
+ <MDataTableColumn label="End date" value="endDate" />
51
+ <MDataTableColumn label="Statut" value="status" />
52
+ <!-- Cells -->
53
+ <template v-slot:cell.startDate="{ item }">
54
+ {{ formatDate(item.startDate) }}
55
+ </template>
56
+ <template v-slot:cell.endDate="{ item }">
57
+ {{ formatDate(item.startDate) }}
58
+ </template>
59
+ <template v-slot:cell.status="{ item }">
60
+ {{ item.status.code }}
61
+ </template>
62
+ </MDataTable>
63
+ </template>
64
+ </MDataTable>
65
+ `,
66
+ methods: {
67
+ formatDate(date) {
68
+ return new Date(date).toLocaleString();
69
+ },
70
+ },
71
+ }),
72
+ };
73
+
74
+ export default meta;
75
+ type Story = StoryObj<typeof MDataTable>;
76
+
77
+ export const Default: Story = {
78
+ args: {
79
+ expandable: true,
80
+ },
81
+ };
82
+
83
+ export const MaxHeight: Story = {
84
+ args: {
85
+ ...Default.args,
86
+ maxHeight: '300px',
87
+ },
88
+ };
89
+
90
+ export const FixedHeader: Story = {
91
+ args: {
92
+ ...Default.args,
93
+ fixedHeader: true,
94
+ maxHeight: '400px',
95
+ },
96
+ };
@@ -0,0 +1,124 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
+ import * as utils from './utils';
3
+
4
+ // Components
5
+ import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
6
+ import MCheckbox from '../checkbox/MCheckbox.vue';
7
+
8
+
9
+ const meta: Meta<typeof MDataTable> = {
10
+ title: 'DataTable/MDataTable Selectable',
11
+ component: MDataTable,
12
+ args: utils.args,
13
+ parameters: {
14
+ componentName: 'MDataTable',
15
+ docs: {
16
+ canvas: { sourceState: 'none' },
17
+ }
18
+ },
19
+ render: (args) => ({
20
+ components: { MDataTable, MDataTableColumn },
21
+ setup() {
22
+ return { args };
23
+ },
24
+ template: `
25
+ <MDataTable v-bind="args">
26
+ <!--
27
+ Default content
28
+ -->
29
+ <MDataTableColumn label="Name" value="name" />
30
+ <MDataTableColumn label="Stock" value="stock" />
31
+
32
+ <!-- Start Date -->
33
+ <MDataTableColumn label="Start date" value="startDate" />
34
+ <template v-slot:cell.startDate="{ item }">
35
+ {{ formatDate(item.startDate) }}
36
+ </template>
37
+
38
+ <!-- End Date -->
39
+ <MDataTableColumn label="End date" value="endDate" />
40
+ <template v-slot:cell.endDate="{ item }">
41
+ {{ formatDate(item.startDate) }}
42
+ </template>
43
+
44
+ <!-- Status -->
45
+ <MDataTableColumn label="Statut" value="status" />
46
+ <template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
47
+ </MDataTable>
48
+ `,
49
+ methods: {
50
+ formatDate(date) {
51
+ return new Date(date).toLocaleString();
52
+ },
53
+ },
54
+ }),
55
+ };
56
+
57
+ export default meta;
58
+ type Story = StoryObj<typeof MDataTable>;
59
+
60
+ export const Default: Story = {
61
+ args: {
62
+ selectable: true,
63
+ },
64
+ };
65
+
66
+ export const SpecifiedRows: Story = {
67
+ render: (args) => ({
68
+ components: { MDataTable, MDataTableColumn, MCheckbox },
69
+ setup() {
70
+ return { args };
71
+ },
72
+ template: `
73
+ <MDataTable v-bind="args">
74
+ <!-- Headers -->
75
+ <MDataTableColumn
76
+ label="MasterCheckbox"
77
+ value="mastercheckbox"
78
+ class="mc-datatable__cell-checkbox"
79
+ />
80
+ <template v-slot:header.mastercheckbox>
81
+ <MCheckbox id="mastercheckbox" />
82
+ </template>
83
+
84
+ <MDataTableColumn label="Name" value="name" />
85
+ <MDataTableColumn label="Stock" value="stock" />
86
+ <MDataTableColumn label="Start date" value="startDate" />
87
+ <MDataTableColumn label="End date" value="endDate" />
88
+ <MDataTableColumn label="Statut" value="status" />
89
+
90
+ <!-- Cells -->
91
+
92
+ <!-- [Cell] => Master Checkbox -->
93
+ <template v-slot:cell.mastercheckbox="{ item }">
94
+ <MCheckbox :id="item.id" :disabled="isDisabled(item)" />
95
+ </template>
96
+
97
+ <!-- [Cell] => Start Date -->
98
+ <template v-slot:cell.startDate="{ item }">
99
+ {{ formatDate(item.startDate) }}
100
+ </template>
101
+
102
+ <!-- [Cell] => End Date -->
103
+ <template v-slot:cell.endDate="{ item }">
104
+ {{ formatDate(item.startDate) }}
105
+ </template>
106
+
107
+ <!-- [Cell] => Status -->
108
+ <template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
109
+ </MDataTable>
110
+ `,
111
+ methods: {
112
+ formatDate(date) {
113
+ return new Date(date).toLocaleString();
114
+ },
115
+ isDisabled(item) {
116
+ if (item.id % 2 == 0) {
117
+ return true;
118
+ }
119
+
120
+ return false;
121
+ },
122
+ },
123
+ }),
124
+ };
@@ -0,0 +1,164 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
+ import { ref } from 'vue';
3
+ import * as utils from './utils';
4
+
5
+ // Components
6
+ import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
7
+
8
+ const meta: Meta<typeof MDataTable> = {
9
+ title: 'DataTable/MDataTable Sortable',
10
+ component: MDataTable,
11
+ args: utils.args,
12
+ argTypes: utils.argtypes,
13
+ parameters: {
14
+ componentName: 'MDataTable',
15
+ docs: {
16
+ canvas: { sourceState: 'none' },
17
+ }
18
+ },
19
+ render: (args) => ({
20
+ components: { MDataTable, MDataTableColumn },
21
+ setup() {
22
+ return { args };
23
+ },
24
+ template: `
25
+ <MDataTable v-bind="args">
26
+ <!-- Name-->
27
+ <MDataTableColumn label="Name" value="name" sortable />
28
+
29
+ <!-- Stock-->
30
+ <MDataTableColumn label="Stock" value="stock" sortable />
31
+
32
+ <!-- Start Date -->
33
+ <MDataTableColumn label="Start date" value="startDate" sortable />
34
+ <template v-slot:cell.startDate="{ item }">
35
+ {{ formatDate(item.startDate) }}
36
+ </template>
37
+
38
+ <!-- End Date -->
39
+ <MDataTableColumn label="End date" value="endDate" sortable />
40
+ <template v-slot:cell.endDate="{ item }">
41
+ {{ formatDate(item.startDate) }}
42
+ </template>
43
+
44
+ <!-- Status -->
45
+ <MDataTableColumn label="Statut" value="status" sortable />
46
+ <template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
47
+ </MDataTable>
48
+ `,
49
+ methods: {
50
+ formatDate(date) {
51
+ return new Date(date).toLocaleString();
52
+ },
53
+ },
54
+ }),
55
+ };
56
+
57
+ export default meta;
58
+ type Story = StoryObj<typeof MDataTable>;
59
+
60
+ export const SingleSort: Story = {};
61
+
62
+ export const SingleSortVModel: Story = {
63
+ name: 'Single Sort (with v-model)',
64
+ args: {
65
+ sort: { column: 'stock', direction: 'DESC' },
66
+ },
67
+ render: (args) => ({
68
+ components: { MDataTable, MDataTableColumn },
69
+ setup() {
70
+ const propSort = ref(args.sort);
71
+ return { args, propSort };
72
+ },
73
+ template: `
74
+ <code class="code">
75
+ <pre>v-model with prop sort: {{ propSort }}</pre>
76
+ </code>
77
+ <MDataTable v-bind="args" v-model:sort="propSort">
78
+ <!-- Name-->
79
+ <MDataTableColumn label="Name" value="name" sortable />
80
+
81
+ <!-- Stock-->
82
+ <MDataTableColumn label="Stock" value="stock" sortable />
83
+
84
+ <!-- Start Date -->
85
+ <MDataTableColumn label="Start date" value="startDate" sortable />
86
+ <template v-slot:cell.startDate="{ item }">
87
+ {{ formatDate(item.startDate) }}
88
+ </template>
89
+
90
+ <!-- End Date -->
91
+ <MDataTableColumn label="End date" value="endDate" sortable />
92
+ <template v-slot:cell.endDate="{ item }">
93
+ {{ formatDate(item.startDate) }}
94
+ </template>
95
+
96
+ <!-- Status -->
97
+ <MDataTableColumn label="Statut" value="status" sortable />
98
+ <template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
99
+ </MDataTable>
100
+ `,
101
+ methods: {
102
+ formatDate(date) {
103
+ return new Date(date).toLocaleString();
104
+ },
105
+ },
106
+ }),
107
+ };
108
+
109
+ export const MultipleSort: Story = {
110
+ args: {
111
+ sortMode: 'multiple',
112
+ },
113
+ };
114
+
115
+ export const MultipleSortVModel: Story = {
116
+ name: 'Multiple Sort (with v-model)',
117
+ args: {
118
+ sortMode: 'multiple',
119
+ sortMultiple: [
120
+ { column: 'stock', direction: 'DESC' },
121
+ { column: 'status', direction: 'ASC' },
122
+ ],
123
+ },
124
+ render: (args) => ({
125
+ components: { MDataTable, MDataTableColumn },
126
+ setup() {
127
+ const propSortMultiple = ref(args.sortMultiple);
128
+ return { args, propSortMultiple };
129
+ },
130
+ template: `
131
+ <code class="code">
132
+ <pre>v-model with prop sortMultiple: {{ propSortMultiple }}</pre>
133
+ </code>
134
+ <MDataTable v-bind="args" v-model:sortMultiple="propSortMultiple">
135
+ <!-- Name-->
136
+ <MDataTableColumn label="Name" value="name" sortable />
137
+
138
+ <!-- Stock-->
139
+ <MDataTableColumn label="Stock" value="stock" sortable />
140
+
141
+ <!-- Start Date -->
142
+ <MDataTableColumn label="Start date" value="startDate" sortable />
143
+ <template v-slot:cell.startDate="{ item }">
144
+ {{ formatDate(item.startDate) }}
145
+ </template>
146
+
147
+ <!-- End Date -->
148
+ <MDataTableColumn label="End date" value="endDate" sortable />
149
+ <template v-slot:cell.endDate="{ item }">
150
+ {{ formatDate(item.startDate) }}
151
+ </template>
152
+
153
+ <!-- Status -->
154
+ <MDataTableColumn label="Statut" value="status" sortable />
155
+ <template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
156
+ </MDataTable>
157
+ `,
158
+ methods: {
159
+ formatDate(date) {
160
+ return new Date(date).toLocaleString();
161
+ },
162
+ },
163
+ }),
164
+ };
@@ -0,0 +1,54 @@
1
+ export type MDataTableSortDirection = 'ASC' | 'DESC' | null;
2
+
3
+ export type MDatatableSortType = {
4
+ direction?: MDataTableSortDirection;
5
+ column: string;
6
+ };
7
+
8
+ export interface MDatatableHeaderType {
9
+ label: string;
10
+ /** The key of item to generate cell slot name */
11
+ value: string;
12
+
13
+ sortable?: boolean;
14
+ sortDirectionDefault?: MDataTableSortDirection;
15
+ class?: string;
16
+ type?: string;
17
+
18
+ /** Misc */
19
+ e2eSelector?: string;
20
+ }
21
+
22
+ export type MDataTableProps = {
23
+ /** Functional */
24
+ items: [];
25
+ headers?: MDatatableHeaderType[];
26
+ loading?: boolean;
27
+ indexKey?: string;
28
+
29
+ /** Pagination */
30
+ pageable?: boolean;
31
+ itemsPerPage?: number;
32
+ itemsPerPageOptions?: PageSizeOption[] | number[];
33
+ currentPage?: number;
34
+ totalItems?: number;
35
+ itemsPerPageLabel?: string;
36
+
37
+ /** Sort */
38
+ sort?: MDatatableSortType | null;
39
+
40
+ /** Display Options */
41
+ size?: 's' | 'm' | 'l';
42
+ hidePageCount?: boolean;
43
+
44
+ /** Misc */
45
+ e2eSelector?: string;
46
+ };
47
+
48
+ export type PageSizeOption = { text: string; value: string };
49
+
50
+ export type MDatatableUpdatePayloadType = {
51
+ sort?: MDatatableSortType | null;
52
+ size: number;
53
+ page: number;
54
+ };
@@ -0,0 +1,10 @@
1
+ .datatablev2-caution {
2
+ margin-bottom: 20px;
3
+ p {
4
+ margin: 0 auto;
5
+
6
+ &:not(:last-child) {
7
+ margin-bottom: 14px;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,63 @@
1
+ import { Meta, Source } from '@storybook/addon-docs/blocks';
2
+
3
+ <Meta title="DataTable/Introduction" />
4
+
5
+ # Introduction
6
+
7
+ Datatable implementation in [Vue.js](https://vuejs.org/) for ADEO Design system.
8
+
9
+ ## 📦 Installation
10
+
11
+ In order to use the datatable in your **Vue.js** project, you must first install the [npm package](https://www.npmjs.com/package/@mozaic-ds/datatable-vue):
12
+
13
+ <Source language="bash" dark code="npm i @mozaic-ds/datatable-vue" />
14
+
15
+ Or with **Yarn**:
16
+
17
+ <Source language="bash" dark code="yarn add @mozaic-ds/datatable-vue" />
18
+
19
+ ## 📝 Usage
20
+
21
+ Import the styles
22
+
23
+ <Source
24
+ language='typescript'
25
+ dark
26
+ code={`
27
+ // In the Vue file using the datatable component
28
+
29
+ import '@mozaic-ds/datatable-vue/style.css';
30
+ `} />
31
+
32
+ Then to use the component, you can proceed as follows:
33
+
34
+ <Source
35
+ language='html'
36
+ dark
37
+ code={`
38
+ <script setup>
39
+ import '@mozaic-ds/datatable-vue/style.css';
40
+ import { MDataTable, MDataTableColumn } from '@mozaic-ds/datatable-vue';
41
+ </script>
42
+
43
+ <template>
44
+ <MDataTable
45
+ v-bind="{items:{0:{id:0,name:'Deal test 0',startDate:{},endDate:{},status:{code:'CLOSE'},stock:'Stock 0'},1:{id:1,name:'Deal test 1',startDate:{},endDate:{},status:{code:'CALCULATED'},stock:'Stock 1'},2:{id:2,name:'Deal test 2',startDate:{},endDate:{},status:{code:'CALCULATED'},stock:'Stock 2'},3:{id:3,name:'Deal test 3',startDate:{},endDate:{},status:{code:'ACTIVE'},stock:'Stock 3'},4:{id:4,name:'Deal test 4',startDate:{},endDate:{},status:{code:'CLOSE'},stock:'Stock 4'},5:{id:5,name:'Deal test 5',startDate:{},endDate:{},status:{code:'ACTIVE'},stock:'Stock 5'},6:{id:6,name:'Deal test 6',startDate:{},endDate:{},status:{code:'CLOSE'},stock:'Stock 6'},7:{id:7,name:'Deal test 7',startDate:{},endDate:{},status:{code:'ACTIVE'},stock:'Stock 7'},8:{id:8,name:'Deal test 8',startDate:{},endDate:{},status:{code:'CLOSE'},stock:'Stock 8'},9:{id:9,name:'Deal test 9',startDate:{},endDate:{},status:{code:'CALCULATED'},stock:'Stock 9'}}}"
46
+ >
47
+ <MDataTableColumn label="Name" value="name" />
48
+ <MDataTableColumn label="Stock" value="stock" />
49
+ <MDataTableColumn label="Start date" value="startDate" />
50
+ <template v-slot:cell.startDate="{ item }">
51
+ {{formatDate(item.startDate)}}
52
+ </template>
53
+ <MDataTableColumn label="End date" value="endDate" />
54
+ <template v-slot:cell.endDate="{ item }">
55
+ {{formatDate(item.startDate)}}
56
+ </template>
57
+ <MDataTableColumn label="Statut" value="status" />
58
+ <template v-slot:cell.status="{ item }">{{item.status.code}}</template>
59
+ </MDataTable>
60
+ </template>
61
+ `} />
62
+
63
+ To see more examples of usage, please refer to the other stories of the component.
@@ -0,0 +1,8 @@
1
+ import jsonData from './data.json';
2
+
3
+ export const samples = jsonData.samples;
4
+ export const deals = jsonData.deals.map((d) => ({
5
+ ...d,
6
+ startDate: new Date(d.startDate),
7
+ endDate: new Date(d.endDate),
8
+ }));