@teammodlr/ui-kit 2.3.23 → 3.0.0-beta.4
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/lib/components/avatar/Avatar.vue.d.ts +2 -2
- package/lib/components/badge/style/Badge.css.d.ts +2 -2
- package/lib/components/button/Button.vue.d.ts +7 -4
- package/lib/components/button/style/Button.css.d.ts +3 -3
- package/lib/components/cardcontextmenu/CardContextMenu.vue.d.ts +5 -8
- package/lib/components/cardcontextmenu/CardContextMenuItem.vue.d.ts +11 -2
- package/lib/components/cardcontextmenu/CardContextMenuTriggerProvider.vue.d.ts +2 -0
- package/lib/components/cardcontextmenu/style/Dropdown.css.d.ts +2 -1
- package/lib/components/cardcontextmenu/symbol.d.ts +1 -0
- package/lib/components/checkbox/Checkbox.vue.d.ts +15 -4
- package/lib/components/collapse/CollapseItem.vue.d.ts +3 -2
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +8 -9
- package/lib/components/confirm/Confirm.vue.d.ts +9 -0
- package/lib/components/confirm/props.d.ts +4 -0
- package/lib/components/dialog/Dialog.vue.d.ts +13 -5
- package/lib/components/dialogprovider/DialogProvider.vue.d.ts +1 -0
- package/lib/components/dialogprovider/types.d.ts +1 -0
- package/lib/components/dropdown/Dropdown.vue.d.ts +3 -1
- package/lib/components/dropdown/DropdownItem.vue.d.ts +11 -1
- package/lib/components/dropdown/DropdownSeperator.vue.d.ts +1 -0
- package/lib/components/dropdown/DropdownTriggerProvider.vue.d.ts +2 -0
- package/lib/components/dropdown/style/Dropdown.css.d.ts +2 -1
- package/lib/components/dropdown/symbol.d.ts +2 -0
- package/lib/components/image/Image.vue.d.ts +1 -1
- package/lib/components/messageprovider/Message.vue.d.ts +1 -1
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +22 -24
- package/lib/components/messageprovider/style/Message.css.d.ts +1 -1
- package/lib/components/messageprovider/types.d.ts +5 -0
- package/lib/components/modal/Modal.vue.d.ts +18 -6
- package/lib/components/radio/Radio.vue.d.ts +2 -0
- package/lib/components/radiobuttongroup/RadioButtonGroup.vue.d.ts +1 -0
- package/lib/components/select/Select.vue.d.ts +20 -11
- package/lib/components/switch/Switch.vue.d.ts +2 -0
- package/lib/components/tab/Tab.vue.d.ts +5 -2
- package/lib/components/tab/TabGroup.vue.d.ts +8 -3
- package/lib/components/textarea/Textarea.vue.d.ts +2 -1
- package/lib/components/tooltip/Tooltip.vue.d.ts +5 -20
- package/lib/components/tooltip/TooltipTrigger.vue.d.ts +1 -10
- package/lib/components/tree/Tree.vue.d.ts +3 -3
- package/lib/components/tree/TreeNode.vue.d.ts +26 -12
- package/lib/components/tree/types.d.ts +5 -5
- package/lib/index.cjs.js +5 -14
- package/lib/index.es.js +15444 -10914
- package/lib/style.css +1 -1
- package/package.json +12 -6
- package/src/components/avatar/Avatar.vue +32 -24
- package/src/components/button/Button.vue +24 -5
- package/src/components/cardcontextmenu/CardContextMenu.vue +68 -95
- package/src/components/cardcontextmenu/CardContextMenuItem.vue +40 -50
- package/src/components/cardcontextmenu/CardContextMenuSeperator.vue +9 -7
- package/src/components/cardcontextmenu/CardContextMenuTriggerProvider.vue +15 -0
- package/src/components/cardcontextmenu/style/Dropdown.css.ts +155 -2
- package/src/components/cardcontextmenu/symbol.ts +3 -0
- package/src/components/checkbox/Checkbox.vue +37 -12
- package/src/components/checkbox/style/Checkbox.css.ts +6 -6
- package/src/components/collapse/CollapseItem.vue +46 -21
- package/src/components/collapse/style/Collapse.css.ts +5 -1
- package/src/components/colorpicker/ColorPicker.vue +76 -45
- package/src/components/confirm/Confirm.vue +15 -8
- package/src/components/confirm/props.ts +4 -0
- package/src/components/dialog/Dialog.vue +183 -37
- package/src/components/dialog/style/Dialog.css.ts +15 -1
- package/src/components/dialogprovider/types.ts +1 -0
- package/src/components/dropdown/Dropdown.vue +46 -3
- package/src/components/dropdown/DropdownItem.vue +55 -25
- package/src/components/dropdown/DropdownSeperator.vue +19 -11
- package/src/components/dropdown/DropdownTriggerProvider.vue +15 -0
- package/src/components/dropdown/examples/context.vue +2 -2
- package/src/components/dropdown/style/Dropdown.css.ts +157 -4
- package/src/components/dropdown/symbol.ts +4 -0
- package/src/components/form/examples/basic.vue +19 -8
- package/src/components/messageprovider/MessageProvider.vue +136 -90
- package/src/components/messageprovider/examples/basic.vue +3 -1
- package/src/components/messageprovider/examples/index.stories.ts +37 -1
- package/src/components/messageprovider/types.ts +10 -0
- package/src/components/modal/Modal.vue +142 -67
- package/src/components/modal/style/Modal.css.ts +26 -2
- package/src/components/radio/Radio.vue +31 -17
- package/src/components/radiobutton/RadioButton.vue +15 -2
- package/src/components/radiobuttongroup/RadioButtonGroup.vue +11 -4
- package/src/components/select/Select.vue +301 -153
- package/src/components/select/examples/basic.vue +1 -1
- package/src/components/slider/Slider.vue +1 -1
- package/src/components/switch/Switch.vue +30 -10
- package/src/components/switch/style/Switch.css.ts +3 -5
- package/src/components/tab/Tab.vue +29 -20
- package/src/components/tab/TabGroup.vue +29 -38
- package/src/components/textarea/Textarea.vue +8 -4
- package/src/components/tooltip/Tooltip.vue +52 -141
- package/src/components/tooltip/TooltipTrigger.vue +14 -17
- package/src/components/tooltip/style/Tooltip.css.ts +148 -29
- package/src/components/tree/Tree.vue +138 -100
- package/src/components/tree/TreeNode.vue +105 -98
- package/src/components/tree/types.ts +4 -4
- package/src/styles/transitions.css.ts +36 -16
|
@@ -1,109 +1,116 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
<div :class="style.nodeWrapper">
|
|
3
|
+
<div
|
|
4
|
+
:class="style.node"
|
|
5
|
+
v-bind="resolvedNodeProps"
|
|
6
|
+
@dblclick="doDoubleClick"
|
|
7
|
+
>
|
|
8
|
+
<template v-if="level > 0">
|
|
9
|
+
<div v-for="i in level" :key="i" style="flex-grow: 0; flex-shrink: 0; height: 0;">
|
|
10
|
+
<div :style="{ width: `${indent}px` }"></div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<TreeNodeToggle
|
|
15
|
+
:hide="isLeaf"
|
|
16
|
+
:expanded="expanded"
|
|
17
|
+
:node="node"
|
|
18
|
+
@click="handleToggleClick"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<div :class="style.nodeContent" @click="handleContentClick">
|
|
22
|
+
<div :class="style.nodeContentText">{{ label }}</div>
|
|
23
|
+
</div>
|
|
11
24
|
</div>
|
|
12
|
-
</template>
|
|
13
|
-
<TreeNodeToggle
|
|
14
|
-
:hide="node.isLeaf"
|
|
15
|
-
:node="node"
|
|
16
|
-
:expanded="expanded"
|
|
17
|
-
@click="handleToggleClick"
|
|
18
|
-
/>
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
<template v-if="expanded && children.length">
|
|
27
|
+
<TreeNode
|
|
28
|
+
v-for="child in children"
|
|
29
|
+
:key="String(child[keyField])"
|
|
30
|
+
:node="child"
|
|
31
|
+
:level="level + 1"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
23
34
|
</div>
|
|
24
|
-
</div>
|
|
25
35
|
</template>
|
|
26
36
|
|
|
27
37
|
<script lang="ts">
|
|
28
|
-
import {
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
38
|
+
import { computed, defineComponent, inject, type PropType } from 'vue';
|
|
39
|
+
import TreeNodeToggle from './TreeNodeToggle.vue';
|
|
40
|
+
import * as style from './style';
|
|
41
|
+
import type { Key, TreeOption } from './types';
|
|
42
|
+
import { treeInjectionKey } from './types';
|
|
33
43
|
|
|
34
44
|
export default defineComponent({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
style
|
|
106
|
-
}
|
|
107
|
-
}
|
|
45
|
+
name: 'TreeNode',
|
|
46
|
+
components: { TreeNodeToggle },
|
|
47
|
+
props: {
|
|
48
|
+
node: {
|
|
49
|
+
type: Object as PropType<TreeOption>,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
level: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 0,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
setup(props) {
|
|
58
|
+
const injectedTree = inject(treeInjectionKey, null);
|
|
59
|
+
|
|
60
|
+
if (!injectedTree) {
|
|
61
|
+
throw new Error('TreeNode must be used within MTree.');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const tree = injectedTree;
|
|
65
|
+
|
|
66
|
+
const keyField = computed(() => tree.keyFieldRef.value);
|
|
67
|
+
const labelField = computed(() => tree.labelFieldRef.value);
|
|
68
|
+
const indent = computed(() => tree.indentRef.value);
|
|
69
|
+
const children = computed(() => tree.getChildren(props.node));
|
|
70
|
+
const isLeaf = computed(() => children.value.length === 0);
|
|
71
|
+
const nodeKey = computed(() => props.node[keyField.value] as Key | undefined);
|
|
72
|
+
const expanded = computed(() => {
|
|
73
|
+
const key = nodeKey.value;
|
|
74
|
+
return typeof key === 'undefined'
|
|
75
|
+
? false
|
|
76
|
+
: tree.mergedExpandedKeysRef.value.includes(key);
|
|
77
|
+
});
|
|
78
|
+
const label = computed(() => {
|
|
79
|
+
return String(props.node[labelField.value] ?? '');
|
|
80
|
+
});
|
|
81
|
+
const resolvedNodeProps = computed(() => {
|
|
82
|
+
return tree.nodePropsRef.value?.(props.node) ?? {};
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
function handleToggleClick(event?: MouseEvent): void {
|
|
86
|
+
event?.stopPropagation();
|
|
87
|
+
tree.handleToggle(props.node);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function handleContentClick(): void {
|
|
91
|
+
if (tree.expandOnClickRef.value && !isLeaf.value) {
|
|
92
|
+
tree.handleToggle(props.node);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function doDoubleClick(): void {
|
|
97
|
+
tree.handleDoubleClick({ ...props.node });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
children,
|
|
102
|
+
expanded,
|
|
103
|
+
handleContentClick,
|
|
104
|
+
doDoubleClick,
|
|
105
|
+
handleToggleClick,
|
|
106
|
+
indent,
|
|
107
|
+
isLeaf,
|
|
108
|
+
keyField,
|
|
109
|
+
label,
|
|
110
|
+
level: props.level,
|
|
111
|
+
resolvedNodeProps,
|
|
112
|
+
style,
|
|
113
|
+
};
|
|
114
|
+
},
|
|
108
115
|
});
|
|
109
116
|
</script>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { HTMLAttributes, Ref
|
|
2
|
-
import type { TreeNode } from 'treemate';
|
|
1
|
+
import type { HTMLAttributes, Ref } from 'vue';
|
|
3
2
|
import { createInjectionKey } from '../../utils/injection';
|
|
4
3
|
|
|
5
4
|
export type Key = string | number;
|
|
@@ -27,13 +26,14 @@ export interface TreeInjection {
|
|
|
27
26
|
labelFieldRef: Ref<string>;
|
|
28
27
|
keyFieldRef: Ref<string>;
|
|
29
28
|
childrenFieldRef: Ref<string>;
|
|
30
|
-
|
|
29
|
+
getChildren: (node: TreeOption) => TreeOption[];
|
|
30
|
+
handleToggle: (node: TreeOption) => void;
|
|
31
31
|
handleDoubleClick: (node: TreeOption) => void;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export const treeInjectionKey = createInjectionKey<TreeInjection>('tree');
|
|
35
35
|
|
|
36
|
-
export type TmNode =
|
|
36
|
+
export type TmNode = TreeOption;
|
|
37
37
|
|
|
38
38
|
export type OnUpdateCheckedKeys = (
|
|
39
39
|
value: (string & number)[],
|
|
@@ -61,38 +61,58 @@ export const scale = {
|
|
|
61
61
|
})
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const MODAL_ENTER_NAME = 'modal-enter';
|
|
65
|
+
const MODAL_LEAVE_NAME = 'modal-leave';
|
|
66
|
+
const MODAL_ENTER_DURATION = 0.24;
|
|
67
|
+
const MODAL_LEAVE_DURATION = 0.18;
|
|
68
|
+
|
|
69
|
+
globalKeyframes(MODAL_ENTER_NAME, {
|
|
70
|
+
from: {
|
|
68
71
|
opacity: 0,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
transformOrigin: 'bottom',
|
|
72
|
-
transform: `translateY(10%)`
|
|
72
|
+
transform: 'translateY(24px) scale(0.97)',
|
|
73
|
+
filter: 'blur(6px)'
|
|
73
74
|
},
|
|
74
|
-
'
|
|
75
|
+
'60%': {
|
|
76
|
+
opacity: 1
|
|
77
|
+
},
|
|
78
|
+
to: {
|
|
75
79
|
opacity: 1,
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
transform: 'translateY(0) scale(1)',
|
|
81
|
+
filter: 'blur(0)'
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
globalKeyframes(MODAL_LEAVE_NAME, {
|
|
86
|
+
from: {
|
|
87
|
+
opacity: 1,
|
|
88
|
+
transform: 'translateY(0) scale(1)',
|
|
89
|
+
filter: 'blur(0)'
|
|
90
|
+
},
|
|
91
|
+
to: {
|
|
92
|
+
opacity: 0,
|
|
93
|
+
transform: 'translateY(16px) scale(0.985)',
|
|
94
|
+
filter: 'blur(2px)'
|
|
78
95
|
}
|
|
79
96
|
});
|
|
80
97
|
|
|
81
98
|
export const modalScale = {
|
|
82
99
|
enterActive: style({
|
|
83
|
-
animation: `${
|
|
84
|
-
willChange: 'transform, opacity'
|
|
100
|
+
animation: `${MODAL_ENTER_DURATION}s ${MODAL_ENTER_NAME} cubic-bezier(0.16, 1, 0.3, 1)`,
|
|
101
|
+
willChange: 'transform, opacity, filter'
|
|
85
102
|
}),
|
|
86
103
|
|
|
87
104
|
leaveActive: style({
|
|
88
|
-
animation: `${
|
|
105
|
+
animation: `${MODAL_LEAVE_DURATION}s ${MODAL_LEAVE_NAME} cubic-bezier(0.4, 0, 1, 1)`,
|
|
106
|
+
willChange: 'transform, opacity, filter'
|
|
89
107
|
}),
|
|
90
108
|
|
|
91
109
|
enterFrom: style({
|
|
92
|
-
opacity: 0
|
|
110
|
+
opacity: 0,
|
|
111
|
+
transform: 'translateY(24px) scale(0.97)'
|
|
93
112
|
}),
|
|
94
113
|
|
|
95
114
|
leaveTo: style({
|
|
96
|
-
opacity: 0
|
|
115
|
+
opacity: 0,
|
|
116
|
+
transform: 'translateY(16px) scale(0.985)'
|
|
97
117
|
})
|
|
98
118
|
};
|