Skip to content
Closed
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e421d9d
chore: update deps
xingyu4j Mar 30, 2026
2930dcd
chore: typescript config is expired‌
xingyu4j Mar 30, 2026
5eca357
feat(@vben/plugins): add tiptap rich text editor
xingyu4j Mar 30, 2026
c693c85
fix: extension-document
xingyu4j Mar 30, 2026
7a60a08
chore: update deps
jinmao88 Apr 1, 2026
4a69c9e
perf: replace `onUnMounted` to `tryOnScopeDispose` (#7747)
caodachen Apr 1, 2026
b096e83
fix: make search case-insensitive (#7689) (#7755)
RanGuMo Apr 1, 2026
8e0b65a
feat: fix oxlint error for oxlint upgrade (#7756)
HaroldZhangCode91 Apr 1, 2026
89349f8
fix: interface DropdownMenuProps don‘t have key prop (#7757)
caodachen Apr 2, 2026
c7b1bb3
fix(form): 修复表单示例中 switch 组件无法切换的问题 (#7636) (#7763)
RanGuMo Apr 2, 2026
794b103
feat: Schema 中 componentProps 随注册组件联动类型提示
dullathanol Apr 2, 2026
5ed39c0
fix: 函数式 componentProps 按已注册 component 的 Props 校验返回值
dullathanol Apr 3, 2026
cb5e7e0
refactor: 简化 componentProps 回调的类型写法
dullathanol Apr 3, 2026
064a6a2
feat: 表单 Schema 支持组件 Props 映射泛型,同步适配VxeGrid
dullathanol Apr 4, 2026
f127357
fix: 修复部分情况 component 类型丢失问题
dullathanol Apr 4, 2026
e417a2c
fix: 修复 FormField 在 SFC 中的运行时异常
dullathanol Apr 4, 2026
2013ba4
fix: 补全 ComponentPropsMap 与 Vxe 表格表单链路的类型
dullathanol Apr 5, 2026
e9bdbb6
chore: fix lint
jinmao88 Apr 6, 2026
02372f1
fix: 弹窗组件拖拽后全屏位置异常
dullathanol Apr 6, 2026
cc32ebe
feat: 支持 overflow 配置以允许拖拽超出可视区
dullathanol Apr 7, 2026
d0c1709
fix: 修正 Modal/Drawer 中 loading 属性注释
dullathanol Apr 7, 2026
35e1166
chore: fix lint
jinmao88 Apr 7, 2026
feca014
Merge branch 'vbenjs:main' into main
dullathanol Apr 8, 2026
185011e
fix: tailwindcss config
dullathanol Apr 8, 2026
436a865
chore: 修正注释
dullathanol Apr 8, 2026
92298ba
chore: update deps
jinmao88 Apr 8, 2026
7e8b9c2
fix: 配置 TypeScript 构建根目录
jinmao88 Apr 9, 2026
243456d
fix: ts config
xingyu4j Apr 10, 2026
d700b04
fix: tailwindcss lint
xingyu4j Apr 10, 2026
4f7b396
chore: update deps
xingyu4j Apr 10, 2026
bd369df
fix: check deps
xingyu4j Apr 10, 2026
093479b
chore: remove vite-plugin-html
xingyu4j Apr 10, 2026
306739c
fix: lint
xingyu4j Apr 10, 2026
e023a08
fix: tailwindcss lint config
xingyu4j Apr 10, 2026
93e23c6
chore: update deps
xingyu4j Apr 10, 2026
37393e1
chore: fix actions error
jinmao88 Apr 11, 2026
0c8db0f
fix: 修复VITE_APP_TITLE变量替换语法
jinmao88 Apr 11, 2026
d779a39
fix: antdv-next message/notification 跟随暗色主题 (#7799)
dullathanol Apr 12, 2026
2b1fcb0
feat(common-ui): add labelFn support to ApiComponent (#7801)
Caisin Apr 12, 2026
46f3234
feat(form-ui): support schema valueFormat for getValues payload shapi…
Caisin Apr 13, 2026
2a32715
feat: enable project-scoped preferences extension tabs (#7803)
Caisin Apr 13, 2026
6f18718
feat: add collapsible 组件,form表单增加单项可折叠,支持schema配置默认关闭/开启
2yllll Apr 13, 2026
b7774fc
Merge branch 'main' into feature-collapsible-component
2yllll Apr 13, 2026
4665a78
fix: collapsible component css fix
2yllll Apr 13, 2026
e808fe7
Merge branch 'feature-collapsible-component' of https://github.com/2y…
2yllll Apr 13, 2026
12a81a7
fix: demo validator usage & types import
2yllll Apr 13, 2026
f30157f
fix: class
2yllll Apr 13, 2026
a096073
fix: lint
2yllll Apr 13, 2026
991408b
fix: default precision error
2yllll Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web-naive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"#/*": "./src/*"
},
"dependencies": {
"@vben-core/shadcn-ui": "workspace:*",
"@vben/access": "workspace:*",
"@vben/common-ui": "workspace:*",
"@vben/constants": "workspace:*",
Expand Down
169 changes: 165 additions & 4 deletions apps/web-naive/src/views/demos/form/basic.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,139 @@
<script lang="ts" setup>
import { Page, useVbenModal } from '@vben/common-ui';
import type { CollapsibleParamSchema } from '@vben-core/shadcn-ui';

import { NButton, NCard, useMessage } from 'naive-ui';
import { ref } from 'vue';

import { Page, useVbenModal, z } from '@vben/common-ui';

import { VbenCollapsibleParams } from '@vben-core/shadcn-ui';

import {
NButton,
NCard,
NRadioButton,
NRadioGroup,
useMessage,
} from 'naive-ui';

import { useVbenForm } from '#/adapter/form';
import { getAllMenusApi } from '#/api';

import modalDemo from './modal.vue';

const message = useMessage();

const layouts = [
{ label: 'Vertical', value: 'vertical' },
{ label: 'Horizontal', value: 'horizontal' },
{ label: 'Inline', value: 'inline' },
];
const layout = ref(layouts[0].value);

function getNumberValidator(key: string, limit?: [number, number]) {
const validator = z.number({
required_error: `${key} 值不能为空`,
invalid_type_error: `${key} 值只能为数字`,
});

if (limit) {
validator.min(limit[0], { message: `${key} 值不在区间范围内` });
validator.max(limit[1], { message: `${key} 值不在区间范围内` });
}

return validator;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const paramsSchema = [
{
key: 'micro_batch_size',
description: `批次大小,代表模型训练过程中,模型更新模型参数的数据步长,可理解为模型每看多少数据即更新一次模型参数,
一般建议的批次大小为16/32,表示模型每看16或32条数据即更新一次参数`,
// defaultValue: 8,
option: {
min: 8,
max: 1024,
step: 8,
},
},
{
key: 'learning_rate',
description:
'学习率,代表每次更新数据的增量参数权重,学习率数值越大参数变化越大,对模型影响越大',
// defaultValue: 1e-5,
option: {
step: 1e-4,
type: 'exponential',
},
},
{
key: 'eval_steps',
description:
'验证步数,训练阶段针模型的验证间隔步长,用于阶段性评估模型训练准确率、训练损失',
// defaultValue: 50,
option: {
min: 1,
max: 2_147_483_647,
},
},
{
key: 'num_train_epochs',
description:
'循环次数,代表模型训练过程中模型学习数据集的次数,可理解为看几遍数据,一般建议的范围是1-3遍即可,可依据需求进行调整',
// defaultValue: 3,
option: {
min: 1,
max: 200,
},
},
{
key: 'max_length',
description: `序列长度,单个训练数据样本的最大长度,超出配置长度将丢弃`,
// defaultValue: 32_768,
option: {
min: 500,
max: 131_072,
},
},
{
key: 'warmup_ratio',
description: '学习率预热比例,学习率预热阶段占总训练步数的比例',
// defaultValue: 0.05,
option: {
min: 0,
max: 1,
precision: 2,
step: 0.01,
},
},
{
key: 'save_steps',
description: 'Checkpoint保存间隔',
// defaultValue: 50,
option: {
min: 1,
max: 2_147_483_647,
},
},
] as CollapsibleParamSchema[];

const paramsValidator = z.object({
micro_batch_size: getNumberValidator('micro_batch_size', [8, 1024]),
learning_rate: getNumberValidator('learning_rate'),
eval_steps: getNumberValidator('eval_steps', [1, 2_147_483_647]),
num_train_epochs: getNumberValidator('num_train_epochs', [1, 200]),
max_length: getNumberValidator('max_length', [1, 131_072]),
warmup_ratio: getNumberValidator('warmup_ratio', [0, 1]),
save_steps: getNumberValidator('save_steps', [1, 2_147_483_647]),
});

const [Form, formApi] = useVbenForm({
commonConfig: {
// 所有表单项
componentProps: {
class: 'w-full',
},
},
layout: 'horizontal',
layout: 'vertical',
// 大屏一行显示3个,中屏一行显示2个,小屏一行显示1个
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
handleSubmit: (values) => {
Expand Down Expand Up @@ -133,8 +250,29 @@ const [Form, formApi] = useVbenForm({
},
rules: 'required',
},
{
component: 'Input',
fieldName: 'collapsibleTextArea',
label: 'vertical时可折叠',
componentProps: {
type: 'textarea',
},
collapsible: true,
},
{
component: VbenCollapsibleParams,
componentProps: {
params: paramsSchema,
},
modelPropName: 'value',
fieldName: 'params',
label: '参数配置',
formItemClass: 'col-span-2',
rules: paramsValidator,
},
],
});

function setFormValues() {
formApi.setValues({
string: 'string',
Expand All @@ -143,20 +281,43 @@ function setFormValues() {
radioButton: 'C',
checkbox: ['A', 'C'],
date: Date.now(),
params: {
micro_batch_size: 8,
learning_rate: 1e-5,
eval_steps: 50,
num_train_epochs: 3,
max_length: 32_768,
warmup_ratio: 0.05,
save_steps: 50,
},
});
}

const [Modal, modalApi] = useVbenModal({
connectedComponent: modalDemo,
});

function onLayoutChange(layout: string) {
formApi.setState({
layout,
});
}
</script>
<template>
<Page
description="表单适配器重新包装了CheckboxGroup和RadioGroup,可以通过options属性传递选项数据(选项数据将作为子组件的属性)"
title="表单演示"
>
<NCard title="基础表单">
<NCard title="基础表单" header-extra-class="gap-4">
<template #header-extra>
<NRadioGroup v-model:value="layout" @update:value="onLayoutChange">
<NRadioButton
v-for="layoutItem in layouts"
:key="layoutItem.value"
:value="layoutItem.value"
:label="layoutItem.label"
/>
</NRadioGroup>
<NButton type="primary" @click="setFormValues">设置表单值</NButton>
<NButton type="primary" @click="modalApi.open()" class="ml-2">
打开弹窗
Expand Down
1 change: 1 addition & 0 deletions packages/@core/base/icons/src/lucide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export {
ChevronDown,
ChevronLeft,
ChevronRight,
ChevronsDown,
ChevronsLeft,
ChevronsRight,
Circle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ const submitButtonOptions = computed(() => {
};
});

// const isQueryForm = computed(() => {
// return !!unref(rootProps).showCollapseButton;
// });

async function handleSubmit(e: Event) {
e?.preventDefault();
e?.stopPropagation();
Expand Down
Loading
Loading