@mozaic-ds/vue 2.16.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 +134 -91
- package/dist/mozaic-vue.js +17184 -10878
- package/dist/mozaic-vue.js.map +1 -1
- package/dist/mozaic-vue.umd.cjs +23 -22
- package/dist/mozaic-vue.umd.cjs.map +1 -1
- package/package.json +10 -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/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/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 +1 -1
- package/src/components/combobox/MCombobox.vue +18 -9
- package/src/components/combobox/README.md +2 -2
- 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/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.vue +18 -18
- package/src/components/optionListbox/README.md +1 -1
- 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/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/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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Connect mapping for MCombobox
|
|
3
|
+
* Links Figma _combobox / base to @mozaic-ds/vue
|
|
4
|
+
*/
|
|
5
|
+
import figma, { html } from '@figma/code-connect/html';
|
|
6
|
+
|
|
7
|
+
figma.connect(
|
|
8
|
+
'https://www.figma.com/design/Zyh9RyabNaqkjbuFWP9Aqj/%E2%9C%A8-Components--ADS2---Stable-version-?node-id=19683-17907',
|
|
9
|
+
{
|
|
10
|
+
props: {
|
|
11
|
+
size: figma.enum('Size', {
|
|
12
|
+
S: 's',
|
|
13
|
+
'M (default)': 'm',
|
|
14
|
+
}),
|
|
15
|
+
disabled: figma.enum('State', {
|
|
16
|
+
Disabled: true,
|
|
17
|
+
Default: false,
|
|
18
|
+
Hovered: false,
|
|
19
|
+
Focused: false,
|
|
20
|
+
'Read-only': false,
|
|
21
|
+
}),
|
|
22
|
+
readonly: figma.enum('State', {
|
|
23
|
+
'Read-only': true,
|
|
24
|
+
Default: false,
|
|
25
|
+
Hovered: false,
|
|
26
|
+
Focused: false,
|
|
27
|
+
Disabled: false,
|
|
28
|
+
}),
|
|
29
|
+
isInvalid: figma.enum('Is invalid', {
|
|
30
|
+
True: true,
|
|
31
|
+
False: false,
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
example: ({ size, disabled, readonly, isInvalid }) =>
|
|
35
|
+
html`<script setup>
|
|
36
|
+
import { MCombobox } from '@mozaic-ds/vue';
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<MCombobox
|
|
40
|
+
id="combobox-id"
|
|
41
|
+
size=${size}
|
|
42
|
+
disabled=${disabled}
|
|
43
|
+
readonly=${readonly}
|
|
44
|
+
:is-invalid=${isInvalid}
|
|
45
|
+
:options="[{ label: 'Option 1', value: 'option1' }, { label: 'Option 2', value: 'option2' }]"
|
|
46
|
+
></MCombobox>`,
|
|
47
|
+
},
|
|
48
|
+
);
|
|
@@ -117,7 +117,7 @@ describe('MCombobox', () => {
|
|
|
117
117
|
},
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
expect(wrapper.find('.mc-combobox__control').text()).toBe('
|
|
120
|
+
expect(wrapper.find('.mc-combobox__control').text()).toBe('One, Two');
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
it('toggles listbox open/close on control click', async () => {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<div class="mc-combobox__input">
|
|
15
15
|
<button
|
|
16
16
|
ref="comboboxControl"
|
|
17
|
+
type="button"
|
|
17
18
|
:aria-expanded="isOpen ? 'true' : 'false'"
|
|
18
19
|
aria-haspopup="listbox"
|
|
19
20
|
:aria-controls="`listbox-${id}`"
|
|
@@ -33,7 +34,10 @@
|
|
|
33
34
|
>
|
|
34
35
|
{{ selectionLabel }}
|
|
35
36
|
</button>
|
|
36
|
-
<span
|
|
37
|
+
<span
|
|
38
|
+
v-if="multiple && hasValue && counterLabel"
|
|
39
|
+
class="mc-combobox__counter"
|
|
40
|
+
>
|
|
37
41
|
{{ counterLabel }}
|
|
38
42
|
</span>
|
|
39
43
|
|
|
@@ -80,8 +84,8 @@
|
|
|
80
84
|
}
|
|
81
85
|
"
|
|
82
86
|
>
|
|
83
|
-
<template #
|
|
84
|
-
<slot name="
|
|
87
|
+
<template #item="{ item }">
|
|
88
|
+
<slot name="item" v-bind="{ item }" />
|
|
85
89
|
</template>
|
|
86
90
|
</MOptionListbox>
|
|
87
91
|
</div>
|
|
@@ -173,7 +177,6 @@ const props = withDefaults(
|
|
|
173
177
|
}>(),
|
|
174
178
|
{
|
|
175
179
|
placeholder: 'Select an option',
|
|
176
|
-
counterLabel: '99 selected',
|
|
177
180
|
searchPlaceholder: 'Find an option...',
|
|
178
181
|
selectLabel: 'Select all',
|
|
179
182
|
clearLabel: 'Clear',
|
|
@@ -197,9 +200,9 @@ const emit = defineEmits<{
|
|
|
197
200
|
|
|
198
201
|
defineSlots<{
|
|
199
202
|
/**
|
|
200
|
-
* Use this slot to
|
|
203
|
+
* Use this slot to customize the content of each item.
|
|
201
204
|
*/
|
|
202
|
-
|
|
205
|
+
item(props: { item: ListboxOption }): VNode;
|
|
203
206
|
}>();
|
|
204
207
|
|
|
205
208
|
const id = useId();
|
|
@@ -227,12 +230,13 @@ const selection = computed({
|
|
|
227
230
|
const selectionLabel = computed(() => {
|
|
228
231
|
if (Array.isArray(selection.value)) {
|
|
229
232
|
if (!selection.value.length) return props.placeholder;
|
|
230
|
-
return (selection.value as (string | number)[])
|
|
233
|
+
return (selection.value as (string | number)[])
|
|
234
|
+
.map((value) => getOptionLabel(value))
|
|
235
|
+
.join(', ');
|
|
231
236
|
}
|
|
232
237
|
|
|
233
238
|
return (
|
|
234
|
-
|
|
235
|
-
props.placeholder
|
|
239
|
+
getOptionLabel(selection.value as string | number) || props.placeholder
|
|
236
240
|
);
|
|
237
241
|
});
|
|
238
242
|
|
|
@@ -267,6 +271,11 @@ function toggleListbox() {
|
|
|
267
271
|
return isOpen.value ? close() : open();
|
|
268
272
|
}
|
|
269
273
|
|
|
274
|
+
function getOptionLabel(value: string | number) {
|
|
275
|
+
const option = props.options.find((option) => option.value === value);
|
|
276
|
+
return option ? option.label : '';
|
|
277
|
+
}
|
|
278
|
+
|
|
270
279
|
onBeforeUnmount(() => {
|
|
271
280
|
document.removeEventListener('click', handleClickOutside);
|
|
272
281
|
});
|
|
@@ -18,7 +18,7 @@ A combobox is an input field that allows users to select an option from a dropdo
|
|
|
18
18
|
| `actions` | Show select all / clear buttons when multiple. | `boolean` | - |
|
|
19
19
|
| `checkableSections` | Enable checkable section headers in the listbox. | `boolean` | - |
|
|
20
20
|
| `placeholder` | Placeholder text when no value is selected. | `string` | `"Select an option"` |
|
|
21
|
-
| `counterLabel` | Label for the selected items counter. | `string` |
|
|
21
|
+
| `counterLabel` | Label for the selected items counter. | `string` | - |
|
|
22
22
|
| `searchPlaceholder` | Placeholder text for the search input. | `string` | `"Find an option..."` |
|
|
23
23
|
| `selectLabel` | Label for the "Select all" button. | `string` | `"Select all"` |
|
|
24
24
|
| `clearLabel` | Label for the "Clear selection" button. | `string` | `"Clear"` |
|
|
@@ -28,7 +28,7 @@ A combobox is an input field that allows users to select an option from a dropdo
|
|
|
28
28
|
|
|
29
29
|
| Name | Description |
|
|
30
30
|
| --- | --- |
|
|
31
|
-
| `
|
|
31
|
+
| `item` | Use this slot to customize the content of each item. |
|
|
32
32
|
|
|
33
33
|
## Events
|
|
34
34
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Connect mapping for MContainer
|
|
3
|
+
* Links Figma Container to @mozaic-ds/vue
|
|
4
|
+
*/
|
|
5
|
+
import figma, { html } from '@figma/code-connect/html';
|
|
6
|
+
|
|
7
|
+
figma.connect(
|
|
8
|
+
'https://www.figma.com/design/Zyh9RyabNaqkjbuFWP9Aqj/%E2%9C%A8-Components--ADS2---Stable-version-?node-id=20116-26427',
|
|
9
|
+
{
|
|
10
|
+
props: {
|
|
11
|
+
appearance: figma.enum('Appearance', {
|
|
12
|
+
Primary: 'primary',
|
|
13
|
+
Secondary: 'secondary',
|
|
14
|
+
Inverse: 'inverse',
|
|
15
|
+
}),
|
|
16
|
+
bordered: figma.enum('Is bordered', {
|
|
17
|
+
True: true,
|
|
18
|
+
False: false,
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
example: () =>
|
|
22
|
+
html`<script setup>
|
|
23
|
+
import { MContainer } from '@mozaic-ds/vue';
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<MContainer>
|
|
27
|
+
<p>Container content</p>
|
|
28
|
+
</MContainer>`,
|
|
29
|
+
},
|
|
30
|
+
);
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import * as utils from './utils';
|
|
3
|
+
|
|
4
|
+
// Components
|
|
5
|
+
import '@mozaic-ds/datatable-vue/style.css';
|
|
6
|
+
import { MDataTable, MDataTableColumn, MDataTableTop } from '@mozaic-ds/datatable-vue';
|
|
7
|
+
import MButton from '../button/MButton.vue';
|
|
8
|
+
import MIconButton from '../iconbutton/MIconButton.vue';
|
|
9
|
+
import { Settings24, Edit24, Download24, Filter24, Search24 } from '@mozaic-ds/icons-vue';
|
|
10
|
+
import MToggle from '../toggle/MToggle.vue';
|
|
11
|
+
import MTextInput from '../textinput/MTextInput.vue';
|
|
12
|
+
import MTag from '../tag/MTag.vue';
|
|
13
|
+
|
|
14
|
+
const meta: Meta<typeof MDataTable> = {
|
|
15
|
+
title: 'DataTable/MDataTable Default',
|
|
16
|
+
component: MDataTable,
|
|
17
|
+
args: {
|
|
18
|
+
...utils.args,
|
|
19
|
+
default: `
|
|
20
|
+
<!--
|
|
21
|
+
Default content
|
|
22
|
+
-->
|
|
23
|
+
<MDataTableColumn label="Name" value="name" />
|
|
24
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
25
|
+
|
|
26
|
+
<!-- Start Date -->
|
|
27
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
28
|
+
<template v-slot:cell.startDate="{ item }">
|
|
29
|
+
{{ formatDate(item.startDate) }}
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<!-- End Date -->
|
|
33
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
34
|
+
<template v-slot:cell.endDate="{ item }">
|
|
35
|
+
{{ formatDate(item.startDate) }}
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<!-- Status -->
|
|
39
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
40
|
+
<template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
|
|
41
|
+
`
|
|
42
|
+
},
|
|
43
|
+
argTypes: utils.argtypes,
|
|
44
|
+
parameters: {
|
|
45
|
+
componentName: 'MDataTable',
|
|
46
|
+
backgrounds: utils.backgrounds,
|
|
47
|
+
docs: {
|
|
48
|
+
canvas: { sourceState: 'none' },
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
render: (args) => ({
|
|
52
|
+
components: { MDataTable, MDataTableColumn, MDataTableTop, MButton },
|
|
53
|
+
setup() {
|
|
54
|
+
return { args };
|
|
55
|
+
},
|
|
56
|
+
template: `
|
|
57
|
+
<MDataTable v-bind="args">
|
|
58
|
+
${args.default}
|
|
59
|
+
</MDataTable>
|
|
60
|
+
`,
|
|
61
|
+
methods: {
|
|
62
|
+
formatDate(date) {
|
|
63
|
+
return new Date(date).toLocaleString();
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default meta;
|
|
70
|
+
type Story = StoryObj<typeof MDataTable>;
|
|
71
|
+
|
|
72
|
+
export const Default: Story = {};
|
|
73
|
+
|
|
74
|
+
export const SizeS: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
size: 's',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const SizeL: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
size: 'l',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const LoadingState: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
loading: true,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const MaxHeight: Story = {
|
|
93
|
+
args: {
|
|
94
|
+
maxHeight: '300px',
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const FixedHeader: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
fixedHeader: true,
|
|
101
|
+
maxHeight: '400px',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const TopbarActions: Story = {
|
|
106
|
+
render: (args) => ({
|
|
107
|
+
components: { MDataTable, MDataTableColumn, MDataTableTop, MButton, Settings24, Filter24, MToggle },
|
|
108
|
+
setup() {
|
|
109
|
+
return { args };
|
|
110
|
+
},
|
|
111
|
+
template: `
|
|
112
|
+
<MDataTable v-bind="args">
|
|
113
|
+
<!-- Topbar - With Actions tools -->
|
|
114
|
+
<template v-slot:topbar>
|
|
115
|
+
<MDataTableTop>
|
|
116
|
+
<template v-slot:actions>
|
|
117
|
+
<MToggle size="s" label="Toggle Label" />
|
|
118
|
+
<MButton iconPosition="left" outlined size="s"><template #icon><Filter24 /></template> Filter</MButton>
|
|
119
|
+
<MButton iconPosition="only" outlined size="s"><template #icon><Settings24 /></template></MButton>
|
|
120
|
+
<MButton appearance="accent" size="s" >Primary action</MButton>
|
|
121
|
+
<MButton outlined appearance="danger" size="s">Negative action</MButton>
|
|
122
|
+
</template>
|
|
123
|
+
</MDataTableTop>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<!-- Default content -->
|
|
127
|
+
<MDataTableColumn label="Name" value="name" />
|
|
128
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
129
|
+
<!-- Start Date -->
|
|
130
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
131
|
+
<template v-slot:cell.startDate="{ item }">
|
|
132
|
+
{{ formatDate(item.startDate) }}
|
|
133
|
+
</template>
|
|
134
|
+
|
|
135
|
+
<!-- End Date -->
|
|
136
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
137
|
+
<template v-slot:cell.endDate="{ item }">
|
|
138
|
+
{{ formatDate(item.startDate) }}
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<!-- Status -->
|
|
142
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
143
|
+
<template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
|
|
144
|
+
</MDataTable>
|
|
145
|
+
`,
|
|
146
|
+
methods: {
|
|
147
|
+
formatDate(date) {
|
|
148
|
+
return new Date(date).toLocaleString();
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
}),
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const TopbarEdition: Story = {
|
|
155
|
+
render: (args) => ({
|
|
156
|
+
components: { MDataTable, MDataTableColumn, MDataTableTop, MButton, MIconButton, Edit24, Download24 },
|
|
157
|
+
setup() {
|
|
158
|
+
return { args };
|
|
159
|
+
},
|
|
160
|
+
template: `
|
|
161
|
+
<MDataTable v-bind="args">
|
|
162
|
+
<!-- Topbar - With Edition tools -->
|
|
163
|
+
<template v-slot:topbar>
|
|
164
|
+
<MDataTableTop>
|
|
165
|
+
<template v-slot:edition>
|
|
166
|
+
<MIconButton ghost size="s"><template #icon><Edit24/></template></MIconButton>
|
|
167
|
+
<MIconButton ghost size="s"><template #icon><Download24/></template></MIconButton>
|
|
168
|
+
<div style="display: flex;align-items: center;">999 selected</div>
|
|
169
|
+
</template>
|
|
170
|
+
</MDataTableTop>
|
|
171
|
+
</template>
|
|
172
|
+
|
|
173
|
+
<!-- Default content -->
|
|
174
|
+
<MDataTableColumn label="Name" value="name" />
|
|
175
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
176
|
+
|
|
177
|
+
<!-- Start Date -->
|
|
178
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
179
|
+
<template v-slot:cell.startDate="{ item }">
|
|
180
|
+
{{ formatDate(item.startDate) }}
|
|
181
|
+
</template>
|
|
182
|
+
|
|
183
|
+
<!-- End Date -->
|
|
184
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
185
|
+
<template v-slot:cell.endDate="{ item }">
|
|
186
|
+
{{ formatDate(item.startDate) }}
|
|
187
|
+
</template>
|
|
188
|
+
|
|
189
|
+
<!-- Status -->
|
|
190
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
191
|
+
<template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
|
|
192
|
+
</MDataTable>
|
|
193
|
+
`,
|
|
194
|
+
methods: {
|
|
195
|
+
formatDate(date) {
|
|
196
|
+
return new Date(date).toLocaleString();
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
}),
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export const TopbarFull: Story = {
|
|
203
|
+
render: (args) => ({
|
|
204
|
+
components: {
|
|
205
|
+
MDataTable,
|
|
206
|
+
MDataTableColumn,
|
|
207
|
+
MDataTableTop,
|
|
208
|
+
MButton,
|
|
209
|
+
MIconButton,
|
|
210
|
+
MToggle,
|
|
211
|
+
MTextInput,
|
|
212
|
+
Edit24,
|
|
213
|
+
Download24,
|
|
214
|
+
Settings24,
|
|
215
|
+
Filter24,
|
|
216
|
+
Search24,
|
|
217
|
+
MTag
|
|
218
|
+
},
|
|
219
|
+
setup() {
|
|
220
|
+
return { args };
|
|
221
|
+
},
|
|
222
|
+
template: `
|
|
223
|
+
<MDataTable v-bind="args">
|
|
224
|
+
<!-- Topbar - Full topbar -->
|
|
225
|
+
<template v-slot:topbar>
|
|
226
|
+
<MDataTableTop>
|
|
227
|
+
<template v-slot:edition>
|
|
228
|
+
<MIconButton ghost size="s"><template #icon><Edit24/></template></MIconButton>
|
|
229
|
+
<MIconButton ghost size="s"><template #icon><Download24/></template></MIconButton>
|
|
230
|
+
<div style="display: flex;align-items: center;">999 selected</div>
|
|
231
|
+
</template>
|
|
232
|
+
<template v-slot:actions>
|
|
233
|
+
<MToggle size="s" label="Toggle Label" />
|
|
234
|
+
<MButton iconPosition="left" outlined size="s"><template #icon><Filter24 /></template> Filter</MButton>
|
|
235
|
+
<MButton iconPosition="only" outlined size="s"><template #icon><Settings24 /></template></MButton>
|
|
236
|
+
<MButton appearance="accent" size="s" >Primary action</MButton>
|
|
237
|
+
<MButton outlined appearance="danger" size="s">Negative action</MButton>
|
|
238
|
+
</template>
|
|
239
|
+
<template v-slot:filters>
|
|
240
|
+
<MTag type="removable" label="Filter label" size="s" />
|
|
241
|
+
<MTag type="removable" label="Filter label" size="s" />
|
|
242
|
+
<MTag type="removable" label="Filter label" size="s" />
|
|
243
|
+
<MTag type="removable" label="Filter label" size="s" />
|
|
244
|
+
<MTag type="removable" label="Filter label" size="s" />
|
|
245
|
+
<MButton ghost size="s">reset</MButton>
|
|
246
|
+
</template>
|
|
247
|
+
</MDataTableTop>
|
|
248
|
+
</template>
|
|
249
|
+
|
|
250
|
+
<!-- Default content -->
|
|
251
|
+
<MDataTableColumn label="Name" value="name" />
|
|
252
|
+
<MDataTableColumn label="Stock" value="stock" />
|
|
253
|
+
|
|
254
|
+
<!-- Start Date -->
|
|
255
|
+
<MDataTableColumn label="Start date" value="startDate" />
|
|
256
|
+
<template v-slot:cell.startDate="{ item }">
|
|
257
|
+
{{ formatDate(item.startDate) }}
|
|
258
|
+
</template>
|
|
259
|
+
|
|
260
|
+
<!-- End Date -->
|
|
261
|
+
<MDataTableColumn label="End date" value="endDate" />
|
|
262
|
+
<template v-slot:cell.endDate="{ item }">
|
|
263
|
+
{{ formatDate(item.startDate) }}
|
|
264
|
+
</template>
|
|
265
|
+
|
|
266
|
+
<!-- Status -->
|
|
267
|
+
<MDataTableColumn label="Statut" value="status" />
|
|
268
|
+
<template v-slot:cell.status="{ item }"> {{ item.status.code }} </template>
|
|
269
|
+
</MDataTable>
|
|
270
|
+
`,
|
|
271
|
+
methods: {
|
|
272
|
+
formatDate(date) {
|
|
273
|
+
return new Date(date).toLocaleString();
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
}),
|
|
277
|
+
};
|