@mozaic-ds/vue 2.15.0 → 2.17.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.
- package/dist/mozaic-vue.css +2 -1
- package/dist/mozaic-vue.d.ts +1040 -408
- package/dist/mozaic-vue.js +17183 -6742
- package/dist/mozaic-vue.js.map +1 -1
- package/dist/mozaic-vue.umd.cjs +26 -6
- package/dist/mozaic-vue.umd.cjs.map +1 -1
- package/package.json +11 -5
- package/src/components/BrandPresets.mdx +2 -2
- package/src/components/ComponentsMapping.mdx +98 -0
- package/src/components/accordionlist/MAccordionList.figma.ts +43 -0
- package/src/components/accordionlistitem/MAccordionListItem.figma.ts +27 -0
- package/src/components/actionbottombar/MActionBottomBar.figma.ts +24 -0
- package/src/components/actionlistbox/MActionListbox.figma.ts +30 -0
- package/src/components/actionlistbox/MActionListbox.spec.ts +14 -0
- package/src/components/actionlistbox/MActionListbox.stories.ts +15 -8
- package/src/components/actionlistbox/MActionListbox.vue +13 -1
- package/src/components/actionlistbox/README.md +2 -1
- package/src/components/avatar/MAvatar.figma.ts +31 -0
- package/src/components/breadcrumb/MBreadcrumb.figma.ts +31 -0
- package/src/components/builtinmenu/MBuiltInMenu.figma.ts +23 -0
- package/src/components/button/MButton.figma.ts +41 -0
- package/src/components/button/README.md +2 -0
- package/src/components/callout/MCallout.figma.ts +29 -0
- package/src/components/carousel/MCarousel.figma.ts +32 -0
- package/src/components/checkbox/MCheckbox.figma.ts +45 -0
- package/src/components/checkboxgroup/MCheckboxGroup.figma.ts +30 -0
- package/src/components/checklistmenu/MCheckListMenu.figma.ts +29 -0
- package/src/components/circularprogressbar/MCircularProgressbar.figma.ts +31 -0
- package/src/components/combobox/MCombobox.figma.ts +48 -0
- package/src/components/combobox/MCombobox.spec.ts +246 -0
- package/src/components/combobox/MCombobox.stories.ts +190 -0
- package/src/components/combobox/MCombobox.vue +286 -0
- package/src/components/combobox/README.md +52 -0
- package/src/components/container/MContainer.figma.ts +30 -0
- package/src/components/datatable/DataTable.stories.ts +277 -0
- package/src/components/datatable/DataTableCells.stories.ts +251 -0
- package/src/components/datatable/DataTableEmpty.stories.ts +102 -0
- package/src/components/datatable/DataTableExpandable.stories.ts +95 -0
- package/src/components/datatable/DataTableNested.stories.ts +96 -0
- package/src/components/datatable/DataTableSelectable.stories.ts +124 -0
- package/src/components/datatable/DataTableSortable.stories.ts +164 -0
- package/src/components/datatable/MDataTable.types.ts +54 -0
- package/src/components/datatable/assets/styles.scss +10 -0
- package/src/components/datatable/datatable.mdx +62 -0
- package/src/components/datatable/tools/data.js +8 -0
- package/src/components/datatable/tools/data.json +2018 -0
- package/src/components/datatable/utils.js +19 -0
- package/src/components/datepicker/MDatepicker.figma.ts +20 -0
- package/src/components/divider/MDivider.figma.ts +30 -0
- package/src/components/drawer/MDrawer.figma.ts +37 -0
- package/src/components/drawer/README.md +1 -1
- package/src/components/field/MField.figma.ts +30 -0
- package/src/components/field/MField.stories.ts +105 -0
- package/src/components/fileuploader/MFileUploader.figma.ts +23 -0
- package/src/components/fileuploaderitem/MFileUploaderItem.figma.ts +27 -0
- package/src/components/flag/MFlag.figma.ts +26 -0
- package/src/components/iconbutton/MIconButton.figma.ts +54 -0
- package/src/components/kpiitem/MKpiItem.figma.ts +33 -0
- package/src/components/linearprogressbarbuffer/MLinearProgressbarBuffer.figma.ts +31 -0
- package/src/components/linearprogressbarpercentage/MLinearProgressbarPercentage.figma.ts +26 -0
- package/src/components/link/MLink.figma.ts +32 -0
- package/src/components/loader/MLoader.figma.ts +30 -0
- package/src/components/loadingoverlay/MLoadingOverlay.figma.ts +18 -0
- package/src/components/modal/MModal.figma.ts +27 -0
- package/src/components/navigationindicator/MNavigationIndicator.figma.ts +24 -0
- package/src/components/numberbadge/MNumberBadge.figma.ts +31 -0
- package/src/components/optionListbox/MOptionListbox.figma.ts +36 -0
- package/src/components/optionListbox/MOptionListbox.spec.ts +527 -0
- package/src/components/optionListbox/MOptionListbox.vue +470 -0
- package/src/components/optionListbox/README.md +63 -0
- package/src/components/overlay/MOverlay.figma.ts +20 -0
- package/src/components/pageheader/MPageHeader.figma.ts +21 -0
- package/src/components/pagination/MPagination.figma.ts +34 -0
- package/src/components/passwordinput/MPasswordInput.figma.ts +30 -0
- package/src/components/phonenumber/MPhoneNumber.figma.ts +47 -0
- package/src/components/pincode/MPincode.figma.ts +41 -0
- package/src/components/pincode/MPincode.spec.ts +1 -4
- package/src/components/pincode/MPincode.vue +11 -15
- package/src/components/popover/MPopover.figma.ts +42 -0
- package/src/components/quantityselector/MQuantitySelector.figma.ts +50 -0
- package/src/components/radio/MRadio.figma.ts +40 -0
- package/src/components/radiogroup/MRadioGroup.figma.ts +30 -0
- package/src/components/segmentedcontrol/MSegmentedControl.figma.ts +33 -0
- package/src/components/select/MSelect.figma.ts +49 -0
- package/src/components/sidebar/MSidebar.figma.ts +28 -0
- package/src/components/sidebarexpandableitem/MSidebarExpandableItem.figma.ts +19 -0
- package/src/components/sidebarfooter/MSidebarFooter.figma.ts +21 -0
- package/src/components/sidebarheader/MSidebarHeader.figma.ts +18 -0
- package/src/components/sidebarnavitem/MSidebarNavItem.figma.ts +23 -0
- package/src/components/sidebarshortcutitem/MSidebarShortcutItem.figma.ts +20 -0
- package/src/components/starrating/MStarRating.figma.ts +35 -0
- package/src/components/statusbadge/MStatusBadge.figma.ts +27 -0
- package/src/components/statusdot/MStatusDot.figma.ts +31 -0
- package/src/components/statusmessage/MStatusMessage.figma.ts +28 -0
- package/src/components/statusmessage/MStatusMessage.spec.ts +15 -0
- package/src/components/statusmessage/MStatusMessage.stories.ts +4 -0
- package/src/components/statusmessage/MStatusMessage.vue +7 -0
- package/src/components/statusmessage/README.md +2 -0
- package/src/components/statusnotification/MStatusNotification.figma.ts +29 -0
- package/src/components/stepperbottombar/MStepperBottomBar.figma.ts +20 -0
- package/src/components/steppercompact/MStepperCompact.figma.ts +21 -0
- package/src/components/stepperinline/MStepperInline.figma.ts +23 -0
- package/src/components/stepperstacked/MStepperStacked.figma.ts +23 -0
- package/src/components/stepperstacked/MStepperStacked.spec.ts +162 -0
- package/src/components/stepperstacked/MStepperStacked.stories.ts +57 -0
- package/src/components/stepperstacked/MStepperStacked.vue +106 -0
- package/src/components/stepperstacked/README.md +15 -0
- package/src/components/tabs/MTabs.figma.ts +33 -0
- package/src/components/tag/MTag.figma.ts +26 -0
- package/src/components/tag/MTag.stories.ts +13 -3
- package/src/components/tag/MTag.vue +11 -1
- package/src/components/tag/README.md +6 -0
- package/src/components/textarea/MTextArea.figma.ts +28 -0
- package/src/components/textinput/MTextInput.figma.ts +51 -0
- package/src/components/textinput/MTextInput.vue +13 -1
- package/src/components/textinput/README.md +15 -1
- package/src/components/tile/MTile.figma.ts +31 -0
- package/src/components/tileclickable/MTileClickable.figma.ts +31 -0
- package/src/components/tileexpandable/MTileExpandable.figma.ts +31 -0
- package/src/components/tileselectable/MTileSelectable.figma.ts +29 -0
- package/src/components/toaster/MToaster.figma.ts +25 -0
- package/src/components/toggle/MToggle.figma.ts +39 -0
- package/src/components/togglegroup/MToggleGroup.figma.ts +30 -0
- package/src/components/tooltip/MTooltip.figma.ts +29 -0
- package/src/main.ts +1 -0
|
@@ -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,62 @@
|
|
|
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 { MButton } from '@mozaic-ds/vue';
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<MDataTable
|
|
44
|
+
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'}}}"
|
|
45
|
+
>
|
|
46
|
+
<MDataTableColumn label="Name" value="name" />
|
|
47
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
48
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
49
|
+
<template v-slot:cell.startDate="{ item }">
|
|
50
|
+
{{formatDate(item.startDate)}}
|
|
51
|
+
</template>
|
|
52
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
53
|
+
<template v-slot:cell.endDate="{ item }">
|
|
54
|
+
{{formatDate(item.startDate)}}
|
|
55
|
+
</template>
|
|
56
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
57
|
+
<template v-slot:cell.status="{ item }">{{item.status.code}}</template>
|
|
58
|
+
</MDataTable>
|
|
59
|
+
</template>
|
|
60
|
+
`} />
|
|
61
|
+
|
|
62
|
+
To see more examples of usage, please refer to the [stories](https://adeo.github.io/mozaic-vue/?path=/docs/datatable-mdatatable-default--docs) of the component.
|