@teammodlr/ui-kit 2.1.39 → 2.1.43
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/env.d.ts +1 -1
- package/lib/components/checkbox/Checkbox.vue.d.ts +1 -0
- package/lib/components/checkbox/style/Checkbox.css.d.ts +1 -0
- package/lib/index.cjs.js +10 -10
- package/lib/index.es.js +1950 -1932
- package/lib/nuxt.js +35 -35
- package/lib/nuxt.plugin.js +8 -8
- package/lib/style.css +1 -1
- package/package.json +89 -89
- package/src/__storybook__/argTypes.ts +53 -53
- package/src/__storybook__/createStory.ts +15 -15
- package/src/__storybook__/index.ts +2 -2
- package/src/call.ts +34 -34
- package/src/components/avatar/Avatar.vue +110 -110
- package/src/components/avatar/examples/basic.vue +6 -6
- package/src/components/avatar/examples/custom-size.vue +7 -7
- package/src/components/avatar/examples/index.ts +5 -5
- package/src/components/avatar/examples/sizes.vue +33 -33
- package/src/components/avatar/examples/slots.vue +8 -8
- package/src/components/avatar/examples/variants.vue +18 -18
- package/src/components/avatar/style/Avatar.css.ts +92 -92
- package/src/components/avatar/style/index.ts +1 -1
- package/src/components/avatargroup/AvatarGroup.vue +72 -72
- package/src/components/avatargroup/examples/basic.vue +37 -37
- package/src/components/avatargroup/examples/index.ts +1 -1
- package/src/components/avatargroup/style/AvatarGroup.css.ts +26 -26
- package/src/components/avatargroup/style/index.ts +1 -1
- package/src/components/avatargroup/symbol.ts +17 -17
- package/src/components/badge/Badge.vue +43 -43
- package/src/components/badge/examples/basic.vue +10 -10
- package/src/components/badge/examples/index.ts +1 -1
- package/src/components/badge/style/Badge.css.ts +135 -135
- package/src/components/badge/style/index.ts +1 -1
- package/src/components/breadcrumb/Breadcrumb.vue +54 -54
- package/src/components/breadcrumb/BreadcrumbItem.vue +72 -72
- package/src/components/breadcrumb/examples/basic.vue +7 -7
- package/src/components/breadcrumb/examples/index.ts +1 -1
- package/src/components/breadcrumb/style/Breadcrumb.css.ts +40 -40
- package/src/components/breadcrumb/style/index.ts +1 -1
- package/src/components/breadcrumb/symbol.ts +18 -18
- package/src/components/button/Button.vue +203 -203
- package/src/components/button/examples/basic.vue +3 -3
- package/src/components/button/examples/disabled.vue +3 -3
- package/src/components/button/examples/icon-left.vue +12 -12
- package/src/components/button/examples/icon.vue +9 -9
- package/src/components/button/examples/index.ts +9 -9
- package/src/components/button/examples/link.vue +3 -3
- package/src/components/button/examples/rounded.vue +7 -7
- package/src/components/button/examples/size.vue +7 -7
- package/src/components/button/examples/variants-secondary.vue +10 -10
- package/src/components/button/examples/variants.vue +10 -10
- package/src/components/button/style/Button.css.ts +695 -695
- package/src/components/button/style/index.ts +1 -1
- package/src/components/buttongroup/ButtonGroup.vue +36 -36
- package/src/components/buttongroup/examples/basic.vue +9 -9
- package/src/components/buttongroup/examples/icon-group.vue +21 -21
- package/src/components/buttongroup/examples/index.ts +2 -2
- package/src/components/buttongroup/style/ButtonGroup.css.ts +42 -42
- package/src/components/buttongroup/style/index.ts +1 -1
- package/src/components/buttongroup/symbol.ts +9 -9
- package/src/components/checkbox/Checkbox.vue +149 -145
- package/src/components/checkbox/examples/basic.vue +9 -9
- package/src/components/checkbox/examples/index.ts +2 -2
- package/src/components/checkbox/examples/slot.vue +14 -11
- package/src/components/checkbox/style/Checkbox.css.ts +178 -161
- package/src/components/checkbox/style/index.ts +1 -1
- package/src/components/colorpicker/ColorPicker.vue +333 -333
- package/src/components/colorpicker/examples/basic.vue +2 -2
- package/src/components/colorpicker/examples/index.ts +1 -1
- package/src/components/colorpicker/style/ColorPicker.css.ts +127 -127
- package/src/components/colorpicker/style/index.ts +1 -1
- package/src/components/colorpicker/utils.ts +206 -206
- package/src/components/confirm/Confirm.vue +65 -65
- package/src/components/confirm/ConfirmProvider.vue +83 -83
- package/src/components/confirm/examples/basic.vue +48 -48
- package/src/components/confirm/examples/index.ts +1 -1
- package/src/components/confirm/examples/wrapper.vue +9 -9
- package/src/components/confirm/props.ts +24 -24
- package/src/components/confirm/providerProps.ts +10 -10
- package/src/components/confirm/types.ts +33 -33
- package/src/components/confirm/useConfirm.ts +14 -14
- package/src/components/dialog/Dialog.vue +118 -118
- package/src/components/dialog/examples/basic.vue +16 -16
- package/src/components/dialog/examples/index.ts +1 -1
- package/src/components/dialog/style/Dialog.css.ts +100 -100
- package/src/components/dialog/style/index.ts +1 -1
- package/src/components/dropdown/Dropdown.vue +308 -308
- package/src/components/dropdown/DropdownHeading.vue +23 -23
- package/src/components/dropdown/DropdownItem.vue +151 -151
- package/src/components/dropdown/DropdownList.vue +20 -20
- package/src/components/dropdown/DropdownSeperator.vue +22 -22
- package/src/components/dropdown/DropdownWrapper.vue +18 -18
- package/src/components/dropdown/examples/basic.vue +119 -119
- package/src/components/dropdown/examples/context.vue +71 -71
- package/src/components/dropdown/examples/index.ts +3 -3
- package/src/components/dropdown/hooks.ts +30 -30
- package/src/components/dropdown/style/Dropdown.css.ts +158 -158
- package/src/components/dropdown/style/index.ts +1 -1
- package/src/components/dropdown/symbol.ts +9 -9
- package/src/components/form/Form.vue +153 -153
- package/src/components/form/examples/basic.vue +75 -75
- package/src/components/form/examples/index.ts +1 -1
- package/src/components/form/style/Form.css.ts +28 -28
- package/src/components/form/style/index.ts +2 -2
- package/src/components/form/symbol.ts +16 -16
- package/src/components/image/Image.vue +71 -71
- package/src/components/image/examples/basic.vue +5 -5
- package/src/components/image/examples/index.ts +1 -1
- package/src/components/index.ts +47 -47
- package/src/components/input/Input.vue +233 -233
- package/src/components/input/examples/basic.vue +21 -21
- package/src/components/input/examples/index.ts +6 -6
- package/src/components/input/examples/left-icon.vue +9 -9
- package/src/components/input/examples/prefix.vue +5 -5
- package/src/components/input/examples/right-icon.vue +9 -9
- package/src/components/input/examples/sizes.vue +9 -9
- package/src/components/input/examples/suffix.vue +7 -7
- package/src/components/input/style/Input.css.ts +294 -294
- package/src/components/input/style/index.ts +1 -1
- package/src/components/link/Link.vue +53 -53
- package/src/components/link/examples/basic.vue +3 -3
- package/src/components/link/examples/index.ts +1 -1
- package/src/components/messageprovider/Message.vue +135 -135
- package/src/components/messageprovider/MessageProvider.vue +156 -156
- package/src/components/messageprovider/examples/basic.vue +70 -70
- package/src/components/messageprovider/examples/index.ts +2 -2
- package/src/components/messageprovider/examples/update.vue +34 -34
- package/src/components/messageprovider/examples/wrapper.vue +9 -9
- package/src/components/messageprovider/style/Message.css.ts +111 -111
- package/src/components/messageprovider/style/index.ts +1 -1
- package/src/components/messageprovider/types.ts +56 -56
- package/src/components/messageprovider/useMessage.ts +14 -14
- package/src/components/modal/Modal.vue +310 -310
- package/src/components/modal/examples/basic.vue +80 -80
- package/src/components/modal/examples/index.ts +3 -3
- package/src/components/modal/examples/modal-form.vue +99 -99
- package/src/components/modal/examples/sidebar.vue +79 -79
- package/src/components/modal/style/Modal.css.ts +318 -318
- package/src/components/modal/style/index.ts +1 -1
- package/src/components/pagination/Pagination.vue +296 -296
- package/src/components/pagination/examples/basic.vue +17 -17
- package/src/components/pagination/examples/index.ts +1 -1
- package/src/components/pagination/style/Pagination.css.ts +93 -93
- package/src/components/pagination/style/index.ts +1 -1
- package/src/components/radio/Radio.vue +136 -136
- package/src/components/radio/examples/basic.vue +8 -8
- package/src/components/radio/examples/group.vue +15 -15
- package/src/components/radio/examples/index.ts +2 -2
- package/src/components/radio/style/Checkbox.css.ts +130 -130
- package/src/components/radio/style/index.ts +1 -1
- package/src/components/radiobutton/RadioButton.vue +131 -131
- package/src/components/radiobutton/style/RadioButton.css.ts +189 -189
- package/src/components/radiobutton/style/index.ts +1 -1
- package/src/components/radiobuttongroup/RadioButtonGroup.vue +74 -74
- package/src/components/radiobuttongroup/examples/basic.vue +16 -16
- package/src/components/radiobuttongroup/examples/index.ts +1 -1
- package/src/components/radiobuttongroup/style/RadioButtonGroup.css.ts +37 -37
- package/src/components/radiobuttongroup/style/index.ts +1 -1
- package/src/components/radiobuttongroup/symbol.ts +12 -12
- package/src/components/renderer/examlpes/basic.vue +23 -23
- package/src/components/renderer/examlpes/index.ts +1 -1
- package/src/components/renderer/props.ts +14 -14
- package/src/components/renderer/renderer.ts +16 -16
- package/src/components/select/Select.vue +781 -781
- package/src/components/select/examples/basic.vue +21 -21
- package/src/components/select/examples/index.ts +3 -3
- package/src/components/select/examples/multiple.vue +21 -21
- package/src/components/select/examples/searchable.vue +20 -20
- package/src/components/select/style/Select.css.ts +368 -368
- package/src/components/select/style/index.ts +1 -1
- package/src/components/skeleton/Skeleton.vue +55 -55
- package/src/components/skeleton/examples/basic.vue +3 -3
- package/src/components/skeleton/examples/index.ts +2 -2
- package/src/components/skeleton/examples/post.vue +8 -8
- package/src/components/skeleton/style/Skeleton.css.ts +72 -72
- package/src/components/skeleton/style/index.ts +2 -2
- package/src/components/slider/Slider.vue +76 -76
- package/src/components/slider/style/Slider.css.ts +50 -50
- package/src/components/slider/style/index.ts +1 -1
- package/src/components/switch/Switch.vue +132 -132
- package/src/components/switch/examples/basic.vue +9 -9
- package/src/components/switch/examples/index.ts +2 -2
- package/src/components/switch/examples/slot.vue +11 -11
- package/src/components/switch/style/Switch.css.ts +135 -135
- package/src/components/switch/style/index.ts +1 -1
- package/src/components/tab/Tab.css +113 -113
- package/src/components/tab/Tab.vue +98 -98
- package/src/components/tab/TabGroup.vue +90 -90
- package/src/components/tab/examples/basic.vue +19 -19
- package/src/components/tab/examples/index.ts +2 -2
- package/src/components/tab/examples/vertical.vue +19 -19
- package/src/components/table/Table.vue +198 -198
- package/src/components/table/TableBody.vue +13 -13
- package/src/components/table/TableCell.vue +13 -13
- package/src/components/table/TableHead.vue +46 -46
- package/src/components/table/TableHeadRow.vue +15 -15
- package/src/components/table/TableRow.vue +19 -19
- package/src/components/table/examples/basic.vue +61 -61
- package/src/components/table/examples/empty.vue +44 -44
- package/src/components/table/examples/index.ts +3 -3
- package/src/components/table/examples/selected.vue +68 -68
- package/src/components/table/style/Table.css.ts +62 -62
- package/src/components/table/style/index.ts +1 -1
- package/src/components/table/types/index.ts +6 -6
- package/src/components/tag/Tag.vue +72 -72
- package/src/components/tag/examples/basic.vue +5 -5
- package/src/components/tag/examples/index.ts +1 -1
- package/src/components/tag/style/Tag.css.ts +83 -83
- package/src/components/tag/style/index.ts +1 -1
- package/src/components/textarea/Textarea.vue +180 -180
- package/src/components/textarea/examples/basic.vue +8 -8
- package/src/components/textarea/examples/index.ts +1 -1
- package/src/components/textarea/style/Textarea.css.ts +191 -191
- package/src/components/textarea/style/index.ts +1 -1
- package/src/components/tooltip/Tooltip.vue +196 -196
- package/src/components/tooltip/examples/basic.vue +5 -5
- package/src/components/tooltip/examples/index.ts +2 -2
- package/src/components/tooltip/examples/placement.vue +9 -9
- package/src/components/tooltip/style/Tooltip.css.ts +90 -90
- package/src/components/tooltip/style/index.ts +1 -1
- package/src/components/transfer/Transfer.vue +145 -145
- package/src/components/transfer/examples/basic.vue +21 -21
- package/src/components/transfer/examples/index.ts +1 -1
- package/src/components/transfer/style/Transfer.css.ts +81 -81
- package/src/components/transfer/style/index.ts +1 -1
- package/src/components/tree/Tree.vue +138 -138
- package/src/components/tree/TreeNode.vue +109 -109
- package/src/components/tree/TreeNodeToggle.vue +48 -48
- package/src/components/tree/examples/basic.vue +458 -458
- package/src/components/tree/examples/index.ts +1 -1
- package/src/components/tree/props.ts +97 -97
- package/src/components/tree/style/Tree.css.ts +75 -75
- package/src/components/tree/style/index.ts +1 -1
- package/src/components/tree/types.ts +103 -103
- package/src/components/virtualscroll/VirtualScroll.css +13 -13
- package/src/components/virtualscroll/VirtualScroll.vue +166 -166
- package/src/components/virtualscroll/examples/basic.vue +31 -31
- package/src/components/virtualscroll/examples/index.ts +1 -1
- package/src/components/virtualscroll/style/VirtualScroll.css.ts +17 -17
- package/src/components/virtualscroll/style/index.ts +1 -1
- package/src/composables/element.ts +13 -13
- package/src/composables/index.ts +4 -4
- package/src/composables/useCachedUid.ts +49 -49
- package/src/composables/useEventListener.ts +19 -19
- package/src/composables/useInput.ts +151 -151
- package/src/composables/useInteractive.ts +19 -19
- package/src/composables/useIsServer.ts +7 -7
- package/src/composables/useMergedState.ts +18 -18
- package/src/composables/useMount.ts +43 -43
- package/src/composables/usePopper.ts +215 -215
- package/src/composables/useZIndex.ts +33 -33
- package/src/create.ts +38 -38
- package/src/css/components.css +16 -16
- package/src/css/index.css +4 -4
- package/src/css/transitions.css +40 -40
- package/src/css/variables.css +80 -80
- package/src/examples/cards/sidebar.vue +262 -262
- package/src/examples/modal/modal.vue +52 -52
- package/src/exports/nuxt.js +35 -35
- package/src/exports/nuxt.plugin.js +8 -8
- package/src/index.ts +5 -5
- package/src/install.ts +8 -8
- package/src/shims-vue.d.ts +6 -6
- package/src/styles/theme.css.ts +181 -181
- package/src/styles/transitions.css.ts +97 -97
- package/src/types/props.ts +19 -19
- package/src/utils/injection.ts +5 -5
- package/volar.d.ts +16 -16
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MTable
|
|
3
|
-
:headers="headers"
|
|
4
|
-
:items="items"
|
|
5
|
-
@onClick="handleClick"
|
|
6
|
-
>
|
|
7
|
-
<template #actions="{ item, onHover }">
|
|
8
|
-
{{ onHover }}
|
|
9
|
-
<MButton
|
|
10
|
-
color="blue"
|
|
11
|
-
secondary
|
|
12
|
-
size="sm"
|
|
13
|
-
>
|
|
14
|
-
Edit - {{ item.name }}
|
|
15
|
-
</MButton>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<template #empty>
|
|
19
|
-
Nothing here
|
|
20
|
-
</template>
|
|
21
|
-
</MTable>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script setup lang="ts">
|
|
25
|
-
import { ref } from "vue";
|
|
26
|
-
import type { TableHeadItem } from "../types";
|
|
27
|
-
|
|
28
|
-
let headers = ref<TableHeadItem[]>([
|
|
29
|
-
{
|
|
30
|
-
name: "ID",
|
|
31
|
-
key: "id",
|
|
32
|
-
width: 50
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "Name",
|
|
36
|
-
key: "name",
|
|
37
|
-
width: 200
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "Age",
|
|
41
|
-
key: "age",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "Actions",
|
|
45
|
-
key: "actions",
|
|
46
|
-
align: "right"
|
|
47
|
-
}
|
|
48
|
-
]);
|
|
49
|
-
|
|
50
|
-
let items = [
|
|
51
|
-
...Array.from({ length: 30 }, (v, i) => ({
|
|
52
|
-
id: i,
|
|
53
|
-
name: "John Doe",
|
|
54
|
-
age: 4
|
|
55
|
-
}))
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
const handleClick = (item: any) => {
|
|
59
|
-
console.log(item);
|
|
60
|
-
}
|
|
61
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<MTable
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:items="items"
|
|
5
|
+
@onClick="handleClick"
|
|
6
|
+
>
|
|
7
|
+
<template #actions="{ item, onHover }">
|
|
8
|
+
{{ onHover }}
|
|
9
|
+
<MButton
|
|
10
|
+
color="blue"
|
|
11
|
+
secondary
|
|
12
|
+
size="sm"
|
|
13
|
+
>
|
|
14
|
+
Edit - {{ item.name }}
|
|
15
|
+
</MButton>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<template #empty>
|
|
19
|
+
Nothing here
|
|
20
|
+
</template>
|
|
21
|
+
</MTable>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { ref } from "vue";
|
|
26
|
+
import type { TableHeadItem } from "../types";
|
|
27
|
+
|
|
28
|
+
let headers = ref<TableHeadItem[]>([
|
|
29
|
+
{
|
|
30
|
+
name: "ID",
|
|
31
|
+
key: "id",
|
|
32
|
+
width: 50
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "Name",
|
|
36
|
+
key: "name",
|
|
37
|
+
width: 200
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "Age",
|
|
41
|
+
key: "age",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "Actions",
|
|
45
|
+
key: "actions",
|
|
46
|
+
align: "right"
|
|
47
|
+
}
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
let items = [
|
|
51
|
+
...Array.from({ length: 30 }, (v, i) => ({
|
|
52
|
+
id: i,
|
|
53
|
+
name: "John Doe",
|
|
54
|
+
age: 4
|
|
55
|
+
}))
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const handleClick = (item: any) => {
|
|
59
|
+
console.log(item);
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MTable
|
|
3
|
-
:headers="headers"
|
|
4
|
-
:items="items"
|
|
5
|
-
>
|
|
6
|
-
<template #actions="{ item }">
|
|
7
|
-
<MButton
|
|
8
|
-
color="blue"
|
|
9
|
-
secondary
|
|
10
|
-
size="sm"
|
|
11
|
-
>
|
|
12
|
-
Edit - {{ item.name }}
|
|
13
|
-
</MButton>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<template #empty>
|
|
17
|
-
Nothing here
|
|
18
|
-
</template>
|
|
19
|
-
</MTable>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
import { ref } from "vue";
|
|
24
|
-
import type { TableHeadItem } from "../types";
|
|
25
|
-
|
|
26
|
-
let headers = ref<TableHeadItem[]>([
|
|
27
|
-
{
|
|
28
|
-
name: "Name",
|
|
29
|
-
key: "name",
|
|
30
|
-
width: 500
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "Age",
|
|
34
|
-
key: "age",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "Actions",
|
|
38
|
-
key: "actions",
|
|
39
|
-
align: "right"
|
|
40
|
-
}
|
|
41
|
-
]);
|
|
42
|
-
|
|
43
|
-
let items = ref([]);
|
|
44
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<MTable
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:items="items"
|
|
5
|
+
>
|
|
6
|
+
<template #actions="{ item }">
|
|
7
|
+
<MButton
|
|
8
|
+
color="blue"
|
|
9
|
+
secondary
|
|
10
|
+
size="sm"
|
|
11
|
+
>
|
|
12
|
+
Edit - {{ item.name }}
|
|
13
|
+
</MButton>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<template #empty>
|
|
17
|
+
Nothing here
|
|
18
|
+
</template>
|
|
19
|
+
</MTable>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { ref } from "vue";
|
|
24
|
+
import type { TableHeadItem } from "../types";
|
|
25
|
+
|
|
26
|
+
let headers = ref<TableHeadItem[]>([
|
|
27
|
+
{
|
|
28
|
+
name: "Name",
|
|
29
|
+
key: "name",
|
|
30
|
+
width: 500
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Age",
|
|
34
|
+
key: "age",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "Actions",
|
|
38
|
+
key: "actions",
|
|
39
|
+
align: "right"
|
|
40
|
+
}
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
let items = ref([]);
|
|
44
|
+
</script>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as MTableBasic } from './basic.vue';
|
|
2
|
-
export { default as MTableEmpty } from './empty.vue';
|
|
3
|
-
export { default as MTableSelected } from './selected.vue';
|
|
1
|
+
export { default as MTableBasic } from './basic.vue';
|
|
2
|
+
export { default as MTableEmpty } from './empty.vue';
|
|
3
|
+
export { default as MTableSelected } from './selected.vue';
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MTable
|
|
3
|
-
:headers="headers"
|
|
4
|
-
:items="items"
|
|
5
|
-
@onClick="handleClick"
|
|
6
|
-
v-model="selected"
|
|
7
|
-
>
|
|
8
|
-
<template #name-header="{ item }">
|
|
9
|
-
Custom header slot if need be
|
|
10
|
-
</template>
|
|
11
|
-
<template #actions="{ item, onHover }">
|
|
12
|
-
{{ onHover }}
|
|
13
|
-
<MButton
|
|
14
|
-
color="blue"
|
|
15
|
-
secondary
|
|
16
|
-
size="sm"
|
|
17
|
-
>
|
|
18
|
-
Edit - {{ item.name }}
|
|
19
|
-
</MButton>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<template #empty>
|
|
23
|
-
Nothing here
|
|
24
|
-
</template>
|
|
25
|
-
</MTable>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script setup lang="ts">
|
|
29
|
-
import { ref } from "vue";
|
|
30
|
-
import type { TableHeadItem } from "../types";
|
|
31
|
-
|
|
32
|
-
let headers = ref<TableHeadItem[]>([
|
|
33
|
-
{
|
|
34
|
-
name: "ID",
|
|
35
|
-
key: "id",
|
|
36
|
-
width: 50
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "Name",
|
|
40
|
-
key: "name",
|
|
41
|
-
width: 200
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "Age",
|
|
45
|
-
key: "age",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "Actions",
|
|
49
|
-
key: "actions",
|
|
50
|
-
align: "right"
|
|
51
|
-
}
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
let items = [
|
|
55
|
-
...Array.from({ length: 30 }, (v, i) => ({
|
|
56
|
-
id: i,
|
|
57
|
-
name: "John Doe",
|
|
58
|
-
age: 4
|
|
59
|
-
}))
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
let selected = ref([items[0]]);
|
|
63
|
-
|
|
64
|
-
const handleClick = (item: any) => {
|
|
65
|
-
console.log(item);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<MTable
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:items="items"
|
|
5
|
+
@onClick="handleClick"
|
|
6
|
+
v-model="selected"
|
|
7
|
+
>
|
|
8
|
+
<template #name-header="{ item }">
|
|
9
|
+
Custom header slot if need be
|
|
10
|
+
</template>
|
|
11
|
+
<template #actions="{ item, onHover }">
|
|
12
|
+
{{ onHover }}
|
|
13
|
+
<MButton
|
|
14
|
+
color="blue"
|
|
15
|
+
secondary
|
|
16
|
+
size="sm"
|
|
17
|
+
>
|
|
18
|
+
Edit - {{ item.name }}
|
|
19
|
+
</MButton>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<template #empty>
|
|
23
|
+
Nothing here
|
|
24
|
+
</template>
|
|
25
|
+
</MTable>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { ref } from "vue";
|
|
30
|
+
import type { TableHeadItem } from "../types";
|
|
31
|
+
|
|
32
|
+
let headers = ref<TableHeadItem[]>([
|
|
33
|
+
{
|
|
34
|
+
name: "ID",
|
|
35
|
+
key: "id",
|
|
36
|
+
width: 50
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Name",
|
|
40
|
+
key: "name",
|
|
41
|
+
width: 200
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "Age",
|
|
45
|
+
key: "age",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "Actions",
|
|
49
|
+
key: "actions",
|
|
50
|
+
align: "right"
|
|
51
|
+
}
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
let items = [
|
|
55
|
+
...Array.from({ length: 30 }, (v, i) => ({
|
|
56
|
+
id: i,
|
|
57
|
+
name: "John Doe",
|
|
58
|
+
age: 4
|
|
59
|
+
}))
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
let selected = ref([items[0]]);
|
|
63
|
+
|
|
64
|
+
const handleClick = (item: any) => {
|
|
65
|
+
console.log(item);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
</script>
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createVar,
|
|
3
|
-
globalKeyframes,
|
|
4
|
-
globalStyle,
|
|
5
|
-
style,
|
|
6
|
-
styleVariants
|
|
7
|
-
} from '@vanilla-extract/css';
|
|
8
|
-
import { themeVars } from '../../../styles/theme.css';
|
|
9
|
-
|
|
10
|
-
export const wrapper = style({
|
|
11
|
-
width: '100%',
|
|
12
|
-
overflow: 'auto'
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const vars = {
|
|
16
|
-
headerHeight: createVar(),
|
|
17
|
-
cellPadding: createVar(),
|
|
18
|
-
fontSize: createVar()
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const table = style({
|
|
22
|
-
vars: {
|
|
23
|
-
[vars.headerHeight]: '44px',
|
|
24
|
-
[vars.cellPadding]: '8px 14px',
|
|
25
|
-
[vars.fontSize]: themeVars.fontSize.base
|
|
26
|
-
},
|
|
27
|
-
width: '100%',
|
|
28
|
-
borderCollapse: 'collapse',
|
|
29
|
-
fontSize: vars.fontSize
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const hoverable = style({});
|
|
33
|
-
export const striped = style({});
|
|
34
|
-
|
|
35
|
-
globalStyle(`${striped} tbody tr:nth-child(even)`, {
|
|
36
|
-
backgroundColor: themeVars.color.gray[75]
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
globalStyle(`${table} th`, {
|
|
40
|
-
height: vars.headerHeight,
|
|
41
|
-
padding: vars.cellPadding,
|
|
42
|
-
textAlign: 'left',
|
|
43
|
-
backgroundColor: themeVars.color.gray[100],
|
|
44
|
-
borderBottom: `1px solid ${themeVars.color.gray[200]}`,
|
|
45
|
-
color: themeVars.color.gray[600],
|
|
46
|
-
fontWeight: 500,
|
|
47
|
-
fontSize: themeVars.fontSize.base,
|
|
48
|
-
marginBottom: '5px'
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
globalStyle(`${table} td`, {
|
|
52
|
-
padding: vars.cellPadding,
|
|
53
|
-
textAlign: 'left',
|
|
54
|
-
color: themeVars.color.gray[900],
|
|
55
|
-
borderBottom: `1px solid ${themeVars.color.gray[200]}`,
|
|
56
|
-
fontWeight: 400,
|
|
57
|
-
transition: `background-color 0.2s ${themeVars.transition.default}`
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
globalStyle(`${hoverable} tr:hover td`, {
|
|
61
|
-
backgroundColor: themeVars.color.gray[100]
|
|
62
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
createVar,
|
|
3
|
+
globalKeyframes,
|
|
4
|
+
globalStyle,
|
|
5
|
+
style,
|
|
6
|
+
styleVariants
|
|
7
|
+
} from '@vanilla-extract/css';
|
|
8
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
9
|
+
|
|
10
|
+
export const wrapper = style({
|
|
11
|
+
width: '100%',
|
|
12
|
+
overflow: 'auto'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const vars = {
|
|
16
|
+
headerHeight: createVar(),
|
|
17
|
+
cellPadding: createVar(),
|
|
18
|
+
fontSize: createVar()
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const table = style({
|
|
22
|
+
vars: {
|
|
23
|
+
[vars.headerHeight]: '44px',
|
|
24
|
+
[vars.cellPadding]: '8px 14px',
|
|
25
|
+
[vars.fontSize]: themeVars.fontSize.base
|
|
26
|
+
},
|
|
27
|
+
width: '100%',
|
|
28
|
+
borderCollapse: 'collapse',
|
|
29
|
+
fontSize: vars.fontSize
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const hoverable = style({});
|
|
33
|
+
export const striped = style({});
|
|
34
|
+
|
|
35
|
+
globalStyle(`${striped} tbody tr:nth-child(even)`, {
|
|
36
|
+
backgroundColor: themeVars.color.gray[75]
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
globalStyle(`${table} th`, {
|
|
40
|
+
height: vars.headerHeight,
|
|
41
|
+
padding: vars.cellPadding,
|
|
42
|
+
textAlign: 'left',
|
|
43
|
+
backgroundColor: themeVars.color.gray[100],
|
|
44
|
+
borderBottom: `1px solid ${themeVars.color.gray[200]}`,
|
|
45
|
+
color: themeVars.color.gray[600],
|
|
46
|
+
fontWeight: 500,
|
|
47
|
+
fontSize: themeVars.fontSize.base,
|
|
48
|
+
marginBottom: '5px'
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
globalStyle(`${table} td`, {
|
|
52
|
+
padding: vars.cellPadding,
|
|
53
|
+
textAlign: 'left',
|
|
54
|
+
color: themeVars.color.gray[900],
|
|
55
|
+
borderBottom: `1px solid ${themeVars.color.gray[200]}`,
|
|
56
|
+
fontWeight: 400,
|
|
57
|
+
transition: `background-color 0.2s ${themeVars.transition.default}`
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
globalStyle(`${hoverable} tr:hover td`, {
|
|
61
|
+
backgroundColor: themeVars.color.gray[100]
|
|
62
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Table.css';
|
|
1
|
+
export * from './Table.css';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type TableHeadItem = {
|
|
2
|
-
key: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
width?: string | number;
|
|
5
|
-
align?: 'left' | 'center' | 'right';
|
|
6
|
-
};
|
|
1
|
+
export type TableHeadItem = {
|
|
2
|
+
key: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
width?: string | number;
|
|
5
|
+
align?: 'left' | 'center' | 'right';
|
|
6
|
+
};
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="computedClasses">
|
|
3
|
-
<span>
|
|
4
|
-
<slot />
|
|
5
|
-
</span>
|
|
6
|
-
<button
|
|
7
|
-
v-if="closeable"
|
|
8
|
-
@mousedown.stop="close"
|
|
9
|
-
:class="style.close"
|
|
10
|
-
tabindex="0">
|
|
11
|
-
<svg
|
|
12
|
-
viewBox="0 0 12 12"
|
|
13
|
-
version="1.1"
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
aria-hidden="true"
|
|
16
|
-
style="width: 1em; height: 1em">
|
|
17
|
-
<g
|
|
18
|
-
stroke="none"
|
|
19
|
-
stroke-width="1"
|
|
20
|
-
fill="none"
|
|
21
|
-
fill-rule="evenodd">
|
|
22
|
-
<g fill="currentColor" fill-rule="nonzero">
|
|
23
|
-
<path
|
|
24
|
-
d="M2.08859116,2.2156945 L2.14644661,2.14644661 C2.32001296,1.97288026 2.58943736,1.95359511 2.7843055,2.08859116 L2.85355339,2.14644661 L6,5.293 L9.14644661,2.14644661 C9.34170876,1.95118446 9.65829124,1.95118446 9.85355339,2.14644661 C10.0488155,2.34170876 10.0488155,2.65829124 9.85355339,2.85355339 L6.707,6 L9.85355339,9.14644661 C10.0271197,9.32001296 10.0464049,9.58943736 9.91140884,9.7843055 L9.85355339,9.85355339 C9.67998704,10.0271197 9.41056264,10.0464049 9.2156945,9.91140884 L9.14644661,9.85355339 L6,6.707 L2.85355339,9.85355339 C2.65829124,10.0488155 2.34170876,10.0488155 2.14644661,9.85355339 C1.95118446,9.65829124 1.95118446,9.34170876 2.14644661,9.14644661 L5.293,6 L2.14644661,2.85355339 C1.97288026,2.67998704 1.95359511,2.41056264 2.08859116,2.2156945 L2.14644661,2.14644661 L2.08859116,2.2156945 Z"></path>
|
|
25
|
-
</g>
|
|
26
|
-
</g>
|
|
27
|
-
</svg>
|
|
28
|
-
</button>
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<script lang="ts">
|
|
33
|
-
import type { Color, Size } from '../../types/props';
|
|
34
|
-
import { computed, defineComponent, type PropType } from 'vue';
|
|
35
|
-
import * as style from './style';
|
|
36
|
-
|
|
37
|
-
export default defineComponent({
|
|
38
|
-
name: 'MTag',
|
|
39
|
-
props: {
|
|
40
|
-
color: {
|
|
41
|
-
type: String as PropType<Color>,
|
|
42
|
-
default: 'primary'
|
|
43
|
-
},
|
|
44
|
-
size: {
|
|
45
|
-
type: String as PropType<Size>,
|
|
46
|
-
default: 'md'
|
|
47
|
-
},
|
|
48
|
-
closeable: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: false
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
emits: {
|
|
54
|
-
close: (event: MouseEvent) => true
|
|
55
|
-
},
|
|
56
|
-
setup(props, { emit }) {
|
|
57
|
-
const computedClasses = computed(() => {
|
|
58
|
-
return [style.base];
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const close = (event: MouseEvent) => {
|
|
62
|
-
emit('close', event);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
computedClasses,
|
|
67
|
-
close,
|
|
68
|
-
style
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="computedClasses">
|
|
3
|
+
<span>
|
|
4
|
+
<slot />
|
|
5
|
+
</span>
|
|
6
|
+
<button
|
|
7
|
+
v-if="closeable"
|
|
8
|
+
@mousedown.stop="close"
|
|
9
|
+
:class="style.close"
|
|
10
|
+
tabindex="0">
|
|
11
|
+
<svg
|
|
12
|
+
viewBox="0 0 12 12"
|
|
13
|
+
version="1.1"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
style="width: 1em; height: 1em">
|
|
17
|
+
<g
|
|
18
|
+
stroke="none"
|
|
19
|
+
stroke-width="1"
|
|
20
|
+
fill="none"
|
|
21
|
+
fill-rule="evenodd">
|
|
22
|
+
<g fill="currentColor" fill-rule="nonzero">
|
|
23
|
+
<path
|
|
24
|
+
d="M2.08859116,2.2156945 L2.14644661,2.14644661 C2.32001296,1.97288026 2.58943736,1.95359511 2.7843055,2.08859116 L2.85355339,2.14644661 L6,5.293 L9.14644661,2.14644661 C9.34170876,1.95118446 9.65829124,1.95118446 9.85355339,2.14644661 C10.0488155,2.34170876 10.0488155,2.65829124 9.85355339,2.85355339 L6.707,6 L9.85355339,9.14644661 C10.0271197,9.32001296 10.0464049,9.58943736 9.91140884,9.7843055 L9.85355339,9.85355339 C9.67998704,10.0271197 9.41056264,10.0464049 9.2156945,9.91140884 L9.14644661,9.85355339 L6,6.707 L2.85355339,9.85355339 C2.65829124,10.0488155 2.34170876,10.0488155 2.14644661,9.85355339 C1.95118446,9.65829124 1.95118446,9.34170876 2.14644661,9.14644661 L5.293,6 L2.14644661,2.85355339 C1.97288026,2.67998704 1.95359511,2.41056264 2.08859116,2.2156945 L2.14644661,2.14644661 L2.08859116,2.2156945 Z"></path>
|
|
25
|
+
</g>
|
|
26
|
+
</g>
|
|
27
|
+
</svg>
|
|
28
|
+
</button>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
import type { Color, Size } from '../../types/props';
|
|
34
|
+
import { computed, defineComponent, type PropType } from 'vue';
|
|
35
|
+
import * as style from './style';
|
|
36
|
+
|
|
37
|
+
export default defineComponent({
|
|
38
|
+
name: 'MTag',
|
|
39
|
+
props: {
|
|
40
|
+
color: {
|
|
41
|
+
type: String as PropType<Color>,
|
|
42
|
+
default: 'primary'
|
|
43
|
+
},
|
|
44
|
+
size: {
|
|
45
|
+
type: String as PropType<Size>,
|
|
46
|
+
default: 'md'
|
|
47
|
+
},
|
|
48
|
+
closeable: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
emits: {
|
|
54
|
+
close: (event: MouseEvent) => true
|
|
55
|
+
},
|
|
56
|
+
setup(props, { emit }) {
|
|
57
|
+
const computedClasses = computed(() => {
|
|
58
|
+
return [style.base];
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const close = (event: MouseEvent) => {
|
|
62
|
+
emit('close', event);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
computedClasses,
|
|
67
|
+
close,
|
|
68
|
+
style
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MTag>
|
|
3
|
-
hi
|
|
4
|
-
</MTag>
|
|
5
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<MTag>
|
|
3
|
+
hi
|
|
4
|
+
</MTag>
|
|
5
|
+
</template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as MTagBasic } from './basic.vue';
|
|
1
|
+
export { default as MTagBasic } from './basic.vue';
|