feat: add VbenForm component (#4352)

* feat: add form component

* fix: build error

* feat: add form adapter

* feat: add some component

* feat: add some component

* feat: add example

* feat: suppoer custom action button

* chore: update

* feat: add example

* feat: add formModel,formDrawer demo

* fix: build error

* fix: typo

* fix: ci error

---------

Co-authored-by: jinmao <jinmao88@qq.com>
Co-authored-by: likui628 <90845831+likui628@users.noreply.github.com>
This commit is contained in:
Vben
2024-09-10 21:48:51 +08:00
committed by GitHub
parent 86ed732ca8
commit 524b9badf2
271 changed files with 5974 additions and 1247 deletions

View File

@@ -1,8 +1,2 @@
export { default as PointSelectionCaptcha } from './point-selection-captcha.vue';
export interface Point {
i: number;
x: number;
y: number;
t: number;
}
export type ClearFunction = () => void;
export type * from './types';

View File

@@ -1,7 +1,9 @@
<script setup lang="ts">
import type { CaptchaPoint } from './types';
import { computed, ref } from 'vue';
import { SvgRefreshIcon } from '@vben/icons';
import { RotateCw } from '@vben/icons';
import {
Card,
CardContent,
@@ -12,8 +14,6 @@ import {
VbenIconButton,
} from '@vben-core/shadcn-ui';
import { type Point } from '.';
interface Props {
/**
* 点选的图片
@@ -74,7 +74,7 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits<{
click: [number, number];
confirm: [Array<Point>, clear: () => void];
confirm: [Array<CaptchaPoint>, clear: () => void];
refresh: [];
}>();
@@ -129,10 +129,10 @@ function getElementPosition(element: HTMLElement) {
y: posY,
};
}
const points = ref<Point[]>([]);
const points = ref<CaptchaPoint[]>([]);
const POINT_OFFSET = 11;
function handleClick(e: any | Event) {
function handleClick(e: MouseEvent) {
try {
const dom = e.currentTarget as HTMLElement;
if (!dom) throw new Error('Element not found');
@@ -231,7 +231,7 @@ function handleConfirm() {
</CardContent>
<CardFooter class="mt-2 flex justify-between p-0">
<VbenIconButton aria-label="刷新验证码" @click="handleRefresh">
<SvgRefreshIcon class="size-6" />
<RotateCw class="size-5" />
</VbenIconButton>
<VbenButton aria-label="确认选择" @click="handleConfirm">
确认

View File

@@ -0,0 +1,6 @@
export interface CaptchaPoint {
i: number;
x: number;
y: number;
t: number;
}

View File

@@ -1,6 +1,8 @@
export * from './captcha';
export * from './ellipsis-text';
export * from './page';
export * from '@vben-core/form-ui';
export * from '@vben-core/popup-ui';
// 给文档用
export { VbenButton } from '@vben-core/shadcn-ui';