@teammodlr/ui-kit 2.1.7 → 2.1.8
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/tree/TreeNode.vue.d.ts +2 -0
- package/lib/components/tree/TreeNodeToggle.vue.d.ts +7 -1
- package/lib/components/tree/style/Tree.css.d.ts +7 -0
- package/lib/components/tree/style/index.d.ts +1 -0
- package/lib/components/tree/types.d.ts +1 -0
- package/lib/index.cjs.js +8 -8
- package/lib/index.es.js +1382 -1371
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/src/components/tree/Tree.vue +110 -109
- package/src/components/tree/TreeNode.vue +29 -23
- package/src/components/tree/TreeNodeToggle.vue +37 -25
- package/src/components/tree/examples/basic.vue +1 -1
- package/src/components/tree/style/Tree.css.ts +70 -0
- package/src/components/tree/style/index.ts +1 -0
- package/src/components/tree/types.ts +1 -0
|
@@ -1,36 +1,48 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
<div
|
|
3
|
+
@click="onClick"
|
|
4
|
+
:class="iconClass"
|
|
5
|
+
>
|
|
6
|
+
<template v-if="!hide">
|
|
7
|
+
<svg v-if="expanded" :class="style.icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
8
|
+
<path d="M12 8l10 8l-10 8z"></path>
|
|
9
|
+
</svg>
|
|
10
|
+
<svg v-else :class="style.icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
11
|
+
<path d="M12 8l10 8l-10 8z"></path>
|
|
12
|
+
</svg>
|
|
13
|
+
</template>
|
|
14
|
+
</div>
|
|
11
15
|
</template>
|
|
12
16
|
|
|
13
17
|
<script lang="ts">
|
|
14
|
-
import {defineComponent, type PropType} from "vue";
|
|
18
|
+
import {computed, defineComponent, type PropType} from "vue";
|
|
15
19
|
import type {TmNode} from "./types";
|
|
20
|
+
import * as style from "./style";
|
|
16
21
|
|
|
17
22
|
export default defineComponent({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return {
|
|
23
|
+
name: "TreeNodeToggle",
|
|
24
|
+
props: {
|
|
25
|
+
expanded: Boolean,
|
|
26
|
+
selected: Boolean,
|
|
27
|
+
onClick: Function as PropType<(e: MouseEvent) => void>,
|
|
28
|
+
hide: Boolean,
|
|
29
|
+
node: {
|
|
30
|
+
type: Object as PropType<TmNode>,
|
|
31
|
+
required: true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setup(props) {
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
const iconClass = computed(() => {
|
|
37
|
+
return {
|
|
38
|
+
[style.toggle]: true,
|
|
39
|
+
[style.iconRotate["90"]]: props.expanded,
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
style,
|
|
44
|
+
iconClass
|
|
34
45
|
}
|
|
46
|
+
}
|
|
35
47
|
})
|
|
36
48
|
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {createVar, globalKeyframes, globalStyle, style, styleVariants} from "@vanilla-extract/css";
|
|
2
|
+
import {themeVars} from "../../../styles/theme.css";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const toggle = style({
|
|
6
|
+
cursor: "pointer",
|
|
7
|
+
display: "inline-flex",
|
|
8
|
+
flexShrink: 0,
|
|
9
|
+
height: `24px`,
|
|
10
|
+
width: `24px`,
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
verticalAlign: "bottom",
|
|
14
|
+
transition: `transform .15s ${themeVars.transition.default}`
|
|
15
|
+
})
|
|
16
|
+
export const icon = style({
|
|
17
|
+
position: "relative",
|
|
18
|
+
height: `14px`,
|
|
19
|
+
width: `14px`,
|
|
20
|
+
display: "flex",
|
|
21
|
+
fontSize: `14px`,
|
|
22
|
+
fill: "currentColor",
|
|
23
|
+
color: themeVars.color.gray["600"],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const iconRotate = styleVariants({
|
|
27
|
+
90: {
|
|
28
|
+
transform: `rotate(90deg)`,
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const nodeWrapper = style({
|
|
33
|
+
boxSizing: "border-box",
|
|
34
|
+
padding: `${themeVars.space["0.5"]} 0`,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const node = style({
|
|
38
|
+
transform: `translate3d(0, 0, 0)`,
|
|
39
|
+
position: "relative",
|
|
40
|
+
display: "flex",
|
|
41
|
+
borderRadius: themeVars.rounded.small,
|
|
42
|
+
transition: `background-color .3s ${themeVars.transition.default}`,
|
|
43
|
+
selectors: {
|
|
44
|
+
[`&:hover`]: {
|
|
45
|
+
backgroundColor: themeVars.color.gray["150"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export const nodeContent = style({
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
position: "relative",
|
|
53
|
+
display: "inline-flex",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
minHeight: `24px`,
|
|
56
|
+
boxSizing: "border-box",
|
|
57
|
+
verticalAlign: "bottom",
|
|
58
|
+
padding: `0 ${themeVars.space["1"]} 0 ${themeVars.space["1"]}`,
|
|
59
|
+
borderRadius: themeVars.rounded.default,
|
|
60
|
+
lineHeight: 1.5,
|
|
61
|
+
userSelect: "none",
|
|
62
|
+
flexGrow: 1
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const nodeContentText = style({
|
|
66
|
+
flexGrow: 1,
|
|
67
|
+
maxWidth: `100%`,
|
|
68
|
+
fontSize: themeVars.fontSize.base,
|
|
69
|
+
color: themeVars.color.gray["700"],
|
|
70
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tree.css';
|
|
@@ -28,6 +28,7 @@ export interface TreeInjection {
|
|
|
28
28
|
nodePropsRef: Ref<TreeNodeProps | undefined>,
|
|
29
29
|
labelFieldRef: Ref<string>,
|
|
30
30
|
keyFieldRef: Ref<string>,
|
|
31
|
+
childrenFieldRef: Ref<string>,
|
|
31
32
|
handleToggleClick: (node: TreeNode<TreeOption>) => void,
|
|
32
33
|
handleDoubleClick: (node: TreeOption) => void,
|
|
33
34
|
}
|