init
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,54 @@
|
||||
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createCommentVNode, renderSlot } from "vue";
|
||||
const withInstall = (comp) => {
|
||||
const component2 = comp;
|
||||
component2.install = (app) => {
|
||||
app.component(component2.name, comp);
|
||||
};
|
||||
return component2;
|
||||
};
|
||||
var index = /* @__PURE__ */ (() => ".layui-badge,.layui-badge-dot,.layui-badge-rim{position:relative;display:inline-block;padding:0 6px;font-size:12px;text-align:center;background-color:#ff5722;color:#fff;border-radius:var(--global-border-radius)}.layui-badge{height:18px;line-height:18px}.layui-badge-dot{width:8px;height:8px;padding:0;border-radius:50%}.layui-badge-rim{height:18px;line-height:18px;border-width:1px;border-style:solid;background-color:#fff;border-color:var(--global-neutral-color-3);color:#666}.layui-badge-dot-ripple>span{position:absolute;top:0;left:0;width:100%;height:100%;display:block;border-radius:50%;box-sizing:border-box;animation:layui-badge-dot-anim-ripple 1.2s ease-in-out infinite}@keyframes layui-badge-dot-anim-ripple{0%{transform:scale(.8);opacity:.6}to{transform:scale(2.4);opacity:0}}.layui-btn .layui-badge,.layui-btn .layui-badge-dot{margin-left:5px}.layui-nav .layui-badge,.layui-nav .layui-badge-dot{position:absolute;top:50%;margin:-5px 6px 0}.layui-nav .layui-badge{margin-top:-10px}.layui-tab-title .layui-badge,.layui-tab-title .layui-badge-dot{left:5px;top:-2px}\n")();
|
||||
const __default__ = {
|
||||
name: "LayBadge"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
type: null,
|
||||
theme: null,
|
||||
color: null,
|
||||
ripple: { type: Boolean }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const classes = computed(() => {
|
||||
return [
|
||||
{
|
||||
"layui-badge": !props.type,
|
||||
"layui-badge-dot": props.type == "dot",
|
||||
"layui-badge-rim": props.type == "rim",
|
||||
"layui-badge-dot-ripple": props.ripple
|
||||
},
|
||||
`layui-bg-${props.theme}`
|
||||
];
|
||||
});
|
||||
const styles = computed(() => {
|
||||
return [props.color ? `background-color: ${props.color}` : ""];
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
var _a;
|
||||
return openBlock(), createElementBlock("span", {
|
||||
class: normalizeClass(unref(classes)),
|
||||
style: normalizeStyle(unref(styles))
|
||||
}, [
|
||||
__props.type === "dot" ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass(props.theme ? `layui-bg-${props.theme}` : ``),
|
||||
style: normalizeStyle((_a = unref(styles)) != null ? _a : `background-color: #ff5722;`)
|
||||
}, null, 6)) : createCommentVNode("", true),
|
||||
__props.type != "dot" ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("", true)
|
||||
], 6);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as c, withInstall as w };
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x<01><>A
|
||||
<EFBFBD>0Fa<46>=<3D>H<>P)<29><>LL<4C>ҙ0&E-<2D>]/<2F><>}<7D>碸<EFBFBD>y<79>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>I&dw"e<><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>US<55>by<1E>l<EFBFBD>4['<27><><EFBFBD><EFBFBD><EFBFBD>D}Ps<50>v]<5D>X<EFBFBD>o<1E><><0E><>9<EFBFBD>
|
||||
Binary file not shown.
@@ -0,0 +1,60 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LayDropdownSubMenu",
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { inject, Ref } from "vue";
|
||||
import LayDropdown from "../dropdown/index.vue";
|
||||
import LayDropdownMenu from "../dropdownMenu/index.vue";
|
||||
import LayDropdownMenuItem from "../dropdownMenuItem/index.vue";
|
||||
import { LayIcon } from "@layui/icons-vue";
|
||||
import { DropdownPlacement } from "../dropdown/interface";
|
||||
|
||||
export type DropdownTrigger = "click" | "hover" | "focus" | "contextMenu";
|
||||
|
||||
export interface DropdownSubMenuProps {
|
||||
trigger?: DropdownTrigger | DropdownTrigger[];
|
||||
placement?: DropdownPlacement;
|
||||
disabled?: boolean;
|
||||
contentOffset?: number;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<DropdownSubMenuProps>(), {
|
||||
trigger: "hover",
|
||||
disabled: false,
|
||||
placement: "right-start",
|
||||
contentOffset: 2,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<lay-dropdown
|
||||
:trigger="trigger"
|
||||
:placement="placement"
|
||||
:auto-fit-min-width="false"
|
||||
:contentOffset="contentOffset"
|
||||
:disabled="disabled"
|
||||
updateAtScroll
|
||||
>
|
||||
<lay-dropdown-menu-item :disabled="disabled">
|
||||
<template v-if="$slots.prefix" #prefix>
|
||||
<slot name="prefix" />
|
||||
</template>
|
||||
<template v-if="$slots.default" #default>
|
||||
<slot />
|
||||
</template>
|
||||
<template #suffix>
|
||||
<slot name="suffix">
|
||||
<lay-icon type="layui-icon-right" size="14px"></lay-icon>
|
||||
</slot>
|
||||
</template>
|
||||
</lay-dropdown-menu-item>
|
||||
<template #content>
|
||||
<lay-dropdown-menu>
|
||||
<slot name="content" />
|
||||
</lay-dropdown-menu>
|
||||
</template>
|
||||
</lay-dropdown>
|
||||
</template>
|
||||
@@ -0,0 +1,6 @@
|
||||
0000000000000000000000000000000000000000 c892ebfd44ae4d5b71f5d8c122acb3cc6c77f6a1 Theluyuan <1162963624@qq.com> 1668472083 +0800 commit (initial): init
|
||||
c892ebfd44ae4d5b71f5d8c122acb3cc6c77f6a1 6c5ea36d6e5d3ab005020d9fc308b19d0e756fe6 Theluyuan <1162963624@qq.com> 1668472765 +0800 commit: icon
|
||||
6c5ea36d6e5d3ab005020d9fc308b19d0e756fe6 f08bdde36bcb88f47041cc4bad491b3cac196bb0 Theluyuan <1162963624@qq.com> 1668474546 +0800 commit: text
|
||||
f08bdde36bcb88f47041cc4bad491b3cac196bb0 616a277edb4259f869bb55dedbfe6871d3fc0dd3 Theluyuan <1162963624@qq.com> 1668474813 +0800 commit: text
|
||||
616a277edb4259f869bb55dedbfe6871d3fc0dd3 f0450921d8bc9ec46a3529fc6a4736699b39624f Theluyuan <1162963624@qq.com> 1668475426 +0800 commit: aaa
|
||||
f0450921d8bc9ec46a3529fc6a4736699b39624f 4b0c6aafd57d16ef1458a65066138a290dc2eb50 Theluyuan <1162963624@qq.com> 1668475638 +0800 commit: aaa
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
example/dist/
|
||||
lib/
|
||||
es/
|
||||
umd/
|
||||
/types/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
pnpm-lock.yaml
|
||||
Binary file not shown.
@@ -0,0 +1,124 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LaySubMenu",
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, ref, Ref, useSlots, watchEffect } from "vue";
|
||||
import LayTransition from "../transition/index.vue";
|
||||
import SubMenuPopup from "./SubMenuPopup.vue";
|
||||
import { indentHandle } from "../menu/utils";
|
||||
import { provideLevel, default as useLevel } from "../menu/useLevel";
|
||||
|
||||
export interface SubMenuProps {
|
||||
id: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
const slots = useSlots();
|
||||
const props = defineProps<SubMenuProps>();
|
||||
|
||||
const { level } = useLevel();
|
||||
const isTree: Ref<boolean> = inject("isTree") as Ref<boolean>;
|
||||
const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>;
|
||||
const openKeys: Ref<string[]> = inject("openKeys") as Ref<string[]>;
|
||||
const indent = inject("indent") as Ref<string | boolean>;
|
||||
const isCollapse: Ref<boolean | string> = inject("isCollapse") as Ref<
|
||||
boolean | string
|
||||
>;
|
||||
const isCollapseTransition: Ref<boolean> = inject(
|
||||
"isCollapseTransition"
|
||||
) as Ref<boolean>;
|
||||
|
||||
const isOpen = computed(() => {
|
||||
return openKeys.value.includes(props.id);
|
||||
});
|
||||
|
||||
const nextLevel = computed(() => level.value + 1);
|
||||
|
||||
provideLevel(nextLevel);
|
||||
|
||||
const needPopup = ref(false);
|
||||
watchEffect(() => {
|
||||
if (isTree.value) {
|
||||
const _isCollapse =
|
||||
isCollapse.value === true || isCollapse.value === "true";
|
||||
if (_isCollapse && level.value === 1) {
|
||||
setTimeout(() => {
|
||||
needPopup.value = isTree.value && _isCollapse;
|
||||
}, 200);
|
||||
} else {
|
||||
needPopup.value = isTree.value && _isCollapse;
|
||||
}
|
||||
} else if (slots.default && slots.default().length > 0) {
|
||||
needPopup.value = true;
|
||||
}
|
||||
});
|
||||
|
||||
const openHandle = function () {
|
||||
if (!isCollapse.value) {
|
||||
let newOpenKeys = [...openKeys.value];
|
||||
if (openKeys.value.includes(props.id)) {
|
||||
newOpenKeys.splice(newOpenKeys.indexOf(props.id), 1);
|
||||
} else {
|
||||
newOpenKeys.push(props.id);
|
||||
}
|
||||
openKeys.value = newOpenKeys;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li v-if="!needPopup" class="layui-nav-item">
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
@click="openHandle()"
|
||||
:style="indentHandle({ indent, level, basePadding: 23, isTree })"
|
||||
>
|
||||
<!-- 图标 -->
|
||||
<i v-if="slots.icon" class="layui-sub-menu-icon">
|
||||
<slot name="icon"></slot>
|
||||
</i>
|
||||
<!-- 标题 -->
|
||||
<span>
|
||||
<slot v-if="slots.title" name="title"></slot>
|
||||
</span>
|
||||
<!-- 扩展 -->
|
||||
<i v-if="slots.expandIcon" class="layui-nav-more">
|
||||
<slot name="expandIcon" :isExpand="isOpen"></slot>
|
||||
</i>
|
||||
<i
|
||||
v-else
|
||||
:class="[
|
||||
isOpen ? 'layui-nav-mored' : '',
|
||||
'layui-icon layui-icon-down',
|
||||
'layui-nav-more',
|
||||
]"
|
||||
></i>
|
||||
</a>
|
||||
<template v-if="isTree">
|
||||
<lay-transition :enable="isCollapseTransition">
|
||||
<div v-if="isOpen">
|
||||
<dl class="layui-nav-child">
|
||||
<slot></slot>
|
||||
</dl>
|
||||
</div>
|
||||
</lay-transition>
|
||||
</template>
|
||||
</li>
|
||||
<SubMenuPopup v-else :id="id">
|
||||
<template v-if="slots.icon" #icon>
|
||||
<slot name="icon"></slot>
|
||||
</template>
|
||||
<template v-if="slots.title" #title>
|
||||
<slot name="title"></slot>
|
||||
</template>
|
||||
<template #expandIcon>
|
||||
<slot name="expandIcon"></slot>
|
||||
</template>
|
||||
<template #default>
|
||||
<slot name="default"></slot>
|
||||
</template>
|
||||
</SubMenuPopup>
|
||||
</template>
|
||||
Reference in New Issue
Block a user