Merge remote-tracking branch 'origin/main' into gitee

This commit is contained in:
xiaoxian521 2024-01-18 23:53:03 +08:00
commit a118b701d1
9 changed files with 344 additions and 49 deletions

View File

@ -3,14 +3,14 @@ import { getPackageSize } from "./utils";
import dayjs, { type Dayjs } from "dayjs"; import dayjs, { type Dayjs } from "dayjs";
import duration from "dayjs/plugin/duration"; import duration from "dayjs/plugin/duration";
import gradientString from "gradient-string"; import gradientString from "gradient-string";
import boxen, { type Options as boxenOptions } from "boxen"; import boxen, { type Options as BoxenOptions } from "boxen";
dayjs.extend(duration); dayjs.extend(duration);
const welcomeMessage = gradientString("cyan", "magenta").multiline( const welcomeMessage = gradientString("cyan", "magenta").multiline(
`Hello! 欢迎使用 vue-pure-admin\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://yiming_chang.gitee.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app` `Hello! 欢迎使用 vue-pure-admin\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://yiming_chang.gitee.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app`
); );
const boxenOprions: boxenOptions = { const boxenOptions: BoxenOptions = {
padding: 0.5, padding: 0.5,
borderColor: "cyan", borderColor: "cyan",
borderStyle: "round" borderStyle: "round"
@ -28,7 +28,7 @@ export function viteBuildInfo(): Plugin {
outDir = resolvedConfig.build?.outDir ?? "dist"; outDir = resolvedConfig.build?.outDir ?? "dist";
}, },
buildStart() { buildStart() {
console.log(boxen(welcomeMessage, boxenOprions)); console.log(boxen(welcomeMessage, boxenOptions));
if (config.command === "build") { if (config.command === "build") {
startTime = dayjs(new Date()); startTime = dayjs(new Date());
} }
@ -46,7 +46,7 @@ export function viteBuildInfo(): Plugin {
.duration(endTime.diff(startTime)) .duration(endTime.diff(startTime))
.format("mm分ss秒")}${size}` .format("mm分ss秒")}${size}`
), ),
boxenOprions boxenOptions
) )
); );
} }

View File

@ -44,7 +44,9 @@ menus:
hsmap: Map hsmap: Map
hsdraggable: Draggable hsdraggable: Draggable
hssplitPane: Split Pane hssplitPane: Split Pane
hsbutton: Button hsElButton: Button
hsbutton: Button Animation
hsCheckButton: Check Button
hscropping: Picture Cropping hscropping: Picture Cropping
hsanimatecss: AnimateCss Selector hsanimatecss: AnimateCss Selector
hscountTo: Digital Animation hscountTo: Digital Animation
@ -102,7 +104,6 @@ menus:
hsCascader: Area Cascader hsCascader: Area Cascader
hsSwiper: Swiper Plugin hsSwiper: Swiper Plugin
hsVirtualList: Virtual List hsVirtualList: Virtual List
hsCheckButton: Check Button
hsPdf: PDF Preview hsPdf: PDF Preview
hsExcel: Export Excel hsExcel: Export Excel
hsInfiniteScroll: Table Infinite Scroll hsInfiniteScroll: Table Infinite Scroll

View File

@ -44,7 +44,9 @@ menus:
hsmap: 地图 hsmap: 地图
hsdraggable: 拖拽 hsdraggable: 拖拽
hssplitPane: 切割面板 hssplitPane: 切割面板
hsbutton: 按钮 hsElButton: 按钮
hsCheckButton: 可选按钮
hsbutton: 按钮动效
hscropping: 图片裁剪 hscropping: 图片裁剪
hsanimatecss: animate.css选择器 hsanimatecss: animate.css选择器
hscountTo: 数字动画 hscountTo: 数字动画
@ -102,7 +104,6 @@ menus:
hsCascader: 区域级联选择器 hsCascader: 区域级联选择器
hsSwiper: Swiper插件 hsSwiper: Swiper插件
hsVirtualList: 虚拟列表 hsVirtualList: 虚拟列表
hsCheckButton: 可选按钮
hsPdf: PDF预览 hsPdf: PDF预览
hsExcel: 导出Excel hsExcel: 导出Excel
hsInfiniteScroll: 表格无限滚动 hsInfiniteScroll: 表格无限滚动

View File

@ -123,7 +123,7 @@ export default {
} }
}, },
{ {
path: "/able/videoFrame", path: "/able/video-frame",
name: "VideoFrame", name: "VideoFrame",
component: () => import("@/views/able/video-frame/index.vue"), component: () => import("@/views/able/video-frame/index.vue"),
meta: { meta: {
@ -139,7 +139,7 @@ export default {
} }
}, },
{ {
path: "/able/infiniteScroll", path: "/able/infinite-scroll",
name: "InfiniteScroll", name: "InfiniteScroll",
component: () => import("@/views/able/infinite-scroll.vue"), component: () => import("@/views/able/infinite-scroll.vue"),
meta: { meta: {
@ -147,7 +147,7 @@ export default {
} }
}, },
{ {
path: "/able/menuTree", path: "/able/menu-tree",
name: "MenuTree", name: "MenuTree",
component: () => import("@/views/able/menu-tree.vue"), component: () => import("@/views/able/menu-tree.vue"),
meta: { meta: {
@ -155,7 +155,7 @@ export default {
} }
}, },
{ {
path: "/able/lineTree", path: "/able/line-tree",
name: "LineTree", name: "LineTree",
component: () => import("@/views/able/line-tree.vue"), component: () => import("@/views/able/line-tree.vue"),
meta: { meta: {

View File

@ -27,7 +27,7 @@ export default {
} }
}, },
{ {
path: "/components/iconSelect", path: "/components/icon-select",
name: "IconSelect", name: "IconSelect",
component: () => import("@/views/components/icon-select.vue"), component: () => import("@/views/components/icon-select.vue"),
meta: { meta: {
@ -51,7 +51,23 @@ export default {
} }
}, },
{ {
path: "/components/checkButton", path: "/components/segmented",
name: "Segmented",
component: () => import("@/views/components/segmented.vue"),
meta: {
title: $t("menus.hssegmented")
}
},
{
path: "/components/el-button",
name: "PureButton",
component: () => import("@/views/components/el-button.vue"),
meta: {
title: $t("menus.hsElButton")
}
},
{
path: "/components/check-button",
name: "CheckButton", name: "CheckButton",
component: () => import("@/views/components/check-button.vue"), component: () => import("@/views/components/check-button.vue"),
meta: { meta: {
@ -60,11 +76,11 @@ export default {
} }
}, },
{ {
path: "/components/segmented", path: "/components/button",
name: "Segmented", name: "ButtonPage",
component: () => import("@/views/components/segmented.vue"), component: () => import("@/views/components/button.vue"),
meta: { meta: {
title: $t("menus.hssegmented") title: $t("menus.hsbutton")
} }
}, },
{ {
@ -92,7 +108,7 @@ export default {
} }
}, },
{ {
path: "/components/splitPane", path: "/components/split-pane",
name: "SplitPane", name: "SplitPane",
component: () => import("@/views/components/split-pane.vue"), component: () => import("@/views/components/split-pane.vue"),
meta: { meta: {
@ -116,7 +132,7 @@ export default {
} }
}, },
{ {
path: "/components/countTo", path: "/components/count-to",
name: "CountTo", name: "CountTo",
component: () => import("@/views/components/count-to.vue"), component: () => import("@/views/components/count-to.vue"),
meta: { meta: {
@ -140,7 +156,7 @@ export default {
} }
}, },
{ {
path: "/components/seamlessScroll", path: "/components/seamless-scroll",
name: "SeamlessScroll", name: "SeamlessScroll",
component: () => import("@/views/components/seamless-scroll.vue"), component: () => import("@/views/components/seamless-scroll.vue"),
meta: { meta: {
@ -148,20 +164,12 @@ export default {
} }
}, },
{ {
path: "/components/virtualList", path: "/components/virtual-list",
name: "VirtualList", name: "VirtualList",
component: () => import("@/views/components/virtual-list/index.vue"), component: () => import("@/views/components/virtual-list/index.vue"),
meta: { meta: {
title: $t("menus.hsVirtualList") title: $t("menus.hsVirtualList")
} }
},
{
path: "/components/button",
name: "ButtonPage",
component: () => import("@/views/components/button.vue"),
meta: {
title: $t("menus.hsbutton")
}
} }
] ]
} satisfies RouteConfigsTable; } satisfies RouteConfigsTable;

View File

@ -2,8 +2,8 @@ import { $t } from "@/plugins/i18n";
import { flowchart } from "@/router/enums"; import { flowchart } from "@/router/enums";
export default { export default {
path: "/flowChart", path: "/flow-chart",
redirect: "/flowChart/index", redirect: "/flow-chart/index",
meta: { meta: {
icon: "setUp", icon: "setUp",
title: $t("menus.hsflowChart"), title: $t("menus.hsflowChart"),
@ -11,7 +11,7 @@ export default {
}, },
children: [ children: [
{ {
path: "/flowChart/index", path: "/flow-chart/index",
name: "FlowChart", name: "FlowChart",
component: () => import("@/views/flow-chart/index.vue"), component: () => import("@/views/flow-chart/index.vue"),
meta: { meta: {

View File

@ -3,8 +3,8 @@ import { formdesign } from "@/router/enums";
const IFrame = () => import("@/layout/frameView.vue"); const IFrame = () => import("@/layout/frameView.vue");
export default { export default {
path: "/formDesign", path: "/form-design",
redirect: "/formDesign/index", redirect: "/form-design/index",
meta: { meta: {
icon: "terminalWindowLine", icon: "terminalWindowLine",
title: $t("menus.hsFormDesign"), title: $t("menus.hsFormDesign"),
@ -12,7 +12,7 @@ export default {
}, },
children: [ children: [
{ {
path: "/formDesign/index", path: "/form-design/index",
name: "FormDesign", name: "FormDesign",
component: IFrame, component: IFrame,
meta: { meta: {

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref, watch } from "vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { getKeyList } from "@pureadmin/utils"; import { getKeyList } from "@pureadmin/utils";
@ -9,6 +9,8 @@ defineOptions({
const spaceSize = ref(20); const spaceSize = ref(20);
const size = ref("default"); const size = ref("default");
const dynamicSize = ref();
const checked = ref(true);
const radio = ref("wait"); const radio = ref("wait");
const radioBox = ref("complete"); const radioBox = ref("complete");
@ -35,6 +37,7 @@ const checkTag = ref([
]); ]);
const curTagMap = ref({}); const curTagMap = ref({});
function onChecked(tag, index) { function onChecked(tag, index) {
if (size.value === "disabled") return;
curTagMap.value[index] = Object.assign({ curTagMap.value[index] = Object.assign({
...tag, ...tag,
checked: !tag.checked checked: !tag.checked
@ -64,12 +67,24 @@ const checkGroupTag = ref([
]); ]);
const curTagGroupMap = ref({}); const curTagGroupMap = ref({});
function onGroupChecked(tag, index) { function onGroupChecked(tag, index) {
if (size.value === "disabled") return;
curTagGroupMap.value[index] = Object.assign({ curTagGroupMap.value[index] = Object.assign({
...tag, ...tag,
checked: !tag.checked checked: !tag.checked
}); });
checkGroupTag.value[index].checked = curTagGroupMap.value[index].checked; checkGroupTag.value[index].checked = curTagGroupMap.value[index].checked;
} }
function onSingleChecked() {
if (size.value === "disabled") return;
checked.value = !checked.value;
}
watch(size, val =>
val === "disabled"
? (dynamicSize.value = "default")
: (dynamicSize.value = size.value)
);
</script> </script>
<template> <template>
@ -80,10 +95,10 @@ function onGroupChecked(tag, index) {
可选按钮 可选按钮
<br /> <br />
<el-radio-group v-model="size" size="small"> <el-radio-group v-model="size" size="small">
<el-radio-button label="large">大尺寸</el-radio-button> <el-radio label="large">大尺寸</el-radio>
<el-radio-button label="default">默认尺寸</el-radio-button> <el-radio label="default">默认尺寸</el-radio>
<el-radio-button label="small">小尺寸</el-radio-button> <el-radio label="small">小尺寸</el-radio>
<el-radio-button label="disabled">禁用</el-radio-button> <el-radio label="disabled">禁用</el-radio>
</el-radio-group> </el-radio-group>
</span> </span>
</div> </div>
@ -91,7 +106,7 @@ function onGroupChecked(tag, index) {
<p class="mb-2">单选紧凑风格的按钮样式</p> <p class="mb-2">单选紧凑风格的按钮样式</p>
<el-radio-group <el-radio-group
v-model="radio" v-model="radio"
:size="size as any" :size="dynamicSize"
:disabled="size === 'disabled'" :disabled="size === 'disabled'"
> >
<el-radio-button label="wait">等待中</el-radio-button> <el-radio-button label="wait">等待中</el-radio-button>
@ -103,7 +118,7 @@ function onGroupChecked(tag, index) {
<p class="mb-2">单选带有边框</p> <p class="mb-2">单选带有边框</p>
<el-radio-group <el-radio-group
v-model="radioBox" v-model="radioBox"
:size="size as any" :size="dynamicSize"
:disabled="size === 'disabled'" :disabled="size === 'disabled'"
> >
<el-radio label="wait" border>等待中</el-radio> <el-radio label="wait" border>等待中</el-radio>
@ -115,7 +130,7 @@ function onGroupChecked(tag, index) {
<p class="mb-2">单选自定义内容</p> <p class="mb-2">单选自定义内容</p>
<el-radio-group <el-radio-group
v-model="radioCustom" v-model="radioCustom"
:size="size as any" :size="dynamicSize"
:disabled="size === 'disabled'" :disabled="size === 'disabled'"
> >
<el-radio-button label="wait"> <el-radio-button label="wait">
@ -142,7 +157,7 @@ function onGroupChecked(tag, index) {
<p class="mb-2">多选紧凑风格的按钮样式</p> <p class="mb-2">多选紧凑风格的按钮样式</p>
<el-checkbox-group <el-checkbox-group
v-model="checkboxGroup" v-model="checkboxGroup"
:size="size as any" :size="dynamicSize"
:disabled="size === 'disabled'" :disabled="size === 'disabled'"
> >
<el-checkbox-button label="apple">苹果</el-checkbox-button> <el-checkbox-button label="apple">苹果</el-checkbox-button>
@ -154,7 +169,7 @@ function onGroupChecked(tag, index) {
<p class="mb-2">多选带有边框</p> <p class="mb-2">多选带有边框</p>
<el-checkbox-group <el-checkbox-group
v-model="checkboxGroupBox" v-model="checkboxGroupBox"
:size="size as any" :size="dynamicSize"
:disabled="size === 'disabled'" :disabled="size === 'disabled'"
> >
<el-checkbox label="cucumber" border>黄瓜</el-checkbox> <el-checkbox label="cucumber" border>黄瓜</el-checkbox>
@ -167,7 +182,7 @@ function onGroupChecked(tag, index) {
<el-checkbox-group <el-checkbox-group
v-model="checkboxGroupCustom" v-model="checkboxGroupCustom"
class="pure-checkbox" class="pure-checkbox"
:size="size as any" :size="dynamicSize"
:disabled="size === 'disabled'" :disabled="size === 'disabled'"
> >
<el-checkbox-button label="tomato"> <el-checkbox-button label="tomato">
@ -209,7 +224,11 @@ function onGroupChecked(tag, index) {
<el-check-tag <el-check-tag
v-for="(tag, index) in checkTag" v-for="(tag, index) in checkTag"
:key="index" :key="index"
class="select-none" :class="[
'select-none',
size === 'disabled' && 'tag-disabled',
tag.checked && 'is-active'
]"
:checked="tag.checked" :checked="tag.checked"
@change="onChecked(tag, index)" @change="onChecked(tag, index)"
> >
@ -229,13 +248,31 @@ function onGroupChecked(tag, index) {
<el-check-tag <el-check-tag
v-for="(tag, index) in checkGroupTag" v-for="(tag, index) in checkGroupTag"
:key="index" :key="index"
class="select-none" :class="[
'select-none',
size === 'disabled' && 'tag-disabled',
tag.checked && 'is-active'
]"
:checked="tag.checked" :checked="tag.checked"
@change="onGroupChecked(tag, index)" @change="onGroupChecked(tag, index)"
> >
{{ tag.title }} {{ tag.title }}
</el-check-tag> </el-check-tag>
</el-space> </el-space>
<el-divider />
<p class="mb-2">单个可选按钮</p>
<el-check-tag
:class="[
'select-none',
size === 'disabled' && 'tag-disabled',
checked && 'is-active'
]"
:checked="checked"
@change="onSingleChecked"
>
一个人也要努力 😊
</el-check-tag>
</el-card> </el-card>
</template> </template>
@ -272,4 +309,19 @@ function onGroupChecked(tag, index) {
} }
} }
} }
/** 可控制间距的按钮禁用样式 */
.tag-disabled {
color: var(--el-disabled-text-color);
cursor: not-allowed;
background-color: var(--el-color-info-light-9);
&:hover {
background-color: var(--el-color-info-light-9);
}
&.is-active {
background-color: var(--el-color-primary-light-9);
}
}
</style> </style>

View File

@ -0,0 +1,233 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useDark } from "@pureadmin/utils";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
defineOptions({
name: "PureButton"
});
const { isDark } = useDark();
const size = ref("default");
const dynamicSize = ref();
const baseRadio = ref("default");
const buttonList = [
{
type: "",
text: "Default",
icon: "ep:search"
},
{
type: "primary",
text: "Primary",
icon: "ep:edit"
},
{
type: "success",
text: "Success",
icon: "ep:check"
},
{
type: "info",
text: "Info",
icon: "ep:message"
},
{
type: "warning",
text: "Warning",
icon: "ep:star"
},
{
type: "danger",
text: "Danger",
icon: "ep:delete"
}
];
watch(size, val =>
val === "disabled"
? (dynamicSize.value = "default")
: (dynamicSize.value = size.value)
);
</script>
<template>
<el-card shadow="never">
<template #header>
<div class="card-header">
<span class="font-medium">
<el-link
href="https://element-plus.org/zh-CN/component/button.html"
target="_blank"
style="margin: 0 4px 5px; font-size: 16px"
>
Button 按钮
</el-link>
<br />
<el-radio-group v-model="size" size="small">
<el-radio label="large">大尺寸</el-radio>
<el-radio label="default">默认尺寸</el-radio>
<el-radio label="small">小尺寸</el-radio>
<el-radio label="disabled">禁用</el-radio>
</el-radio-group>
</span>
</div>
</template>
<p class="mb-2">基础按钮</p>
<el-radio-group v-model="baseRadio" class="mb-3">
<el-radio label="default" />
<el-radio label="plain" />
<el-radio label="round" />
<el-radio label="circle" />
<el-radio label="link" />
<el-radio label="text" />
<el-radio label="text-bg" />
</el-radio-group>
<br />
<el-space wrap>
<el-button
v-for="(button, index) in buttonList"
:key="index"
:type="button.type"
:size="dynamicSize"
:disabled="size === 'disabled'"
:plain="baseRadio === 'plain'"
:round="baseRadio === 'round'"
:circle="baseRadio === 'circle'"
:link="baseRadio === 'link'"
:text="baseRadio === 'text' || baseRadio === 'text-bg'"
:bg="baseRadio === 'text-bg'"
:icon="useRenderIcon(button.icon)"
>
<template v-if="baseRadio !== 'circle'" #default>
<p>{{ button.text }}</p>
</template>
</el-button>
</el-space>
<el-divider />
<p class="mb-4">加载状态按钮</p>
<el-button
text
bg
type="primary"
:size="dynamicSize"
:disabled="size === 'disabled'"
:loading="size !== 'disabled'"
>
{{ size === "disabled" ? "停止加载" : "加载中" }}
</el-button>
<el-button
type="primary"
plain
:size="dynamicSize"
:disabled="size === 'disabled'"
:loading-icon="useRenderIcon('ep:eleme')"
:loading="size !== 'disabled'"
>
{{ size === "disabled" ? "停止加载" : "加载中" }}
</el-button>
<el-button
type="primary"
:size="dynamicSize"
:disabled="size === 'disabled'"
:loading="size !== 'disabled'"
>
<template #loading>
<div class="custom-loading">
<svg class="circular" viewBox="-10, -10, 50, 50">
<path
class="path"
d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
"
style="fill: rgb(0 0 0 / 0%); stroke-width: 4px"
/>
</svg>
</div>
</template>
{{ size === "disabled" ? "停止加载" : "加载中" }}
</el-button>
<el-divider />
<p class="mb-4">自定义元素标签例如按钮div链接</p>
<el-button :size="dynamicSize" :disabled="size === 'disabled'">
button 标签
</el-button>
<el-button
tag="div"
role="button"
tabindex="0"
:size="dynamicSize"
:disabled="size === 'disabled'"
>
div 标签
</el-button>
<el-button
type="primary"
tag="a"
:href="
size === 'disabled'
? 'javascript:void(0);'
: 'https://element-plus.org/zh-CN/component/button.html#tag'
"
:target="size === 'disabled' ? '_self' : '_blank'"
rel="noopener noreferrer"
:size="dynamicSize"
:disabled="size === 'disabled'"
>
a 链接
</el-button>
<el-divider />
<p class="mb-4">自定义颜色</p>
<el-space wrap>
<el-button
color="#626aef"
:size="dynamicSize"
:disabled="size === 'disabled'"
:dark="isDark"
>
Default
</el-button>
<el-button
color="#626aef"
:size="dynamicSize"
:disabled="size === 'disabled'"
:dark="isDark"
plain
>
Plain
</el-button>
</el-space>
</el-card>
</template>
<style lang="scss" scoped>
:deep(.el-divider--horizontal) {
margin: 17px 0;
}
.el-button .custom-loading .circular {
width: 18px;
height: 18px;
margin-right: 6px;
animation: loading-rotate 2s linear infinite;
}
.el-button .custom-loading .circular .path {
stroke: var(--el-button-text-color);
stroke-dasharray: 90, 150;
stroke-dashoffset: 0;
stroke-linecap: round;
stroke-width: 2;
animation: loading-dash 1.5s ease-in-out infinite;
}
</style>