Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(form): add size attribute #189

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified db/TDesign.db
Binary file not shown.
28 changes: 0 additions & 28 deletions packages/products/tdesign-react/src/form/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdFormProps, TdFormItemProps } from './type';

export const formDefaultProps: TdFormProps = {
colon: false,
disabled: undefined,
labelAlign: 'right',
labelWidth: '100px',
layout: 'vertical',
preventSubmitDefault: true,
requiredMark: undefined,
resetType: 'empty',
showErrorMessage: true,
statusIcon: undefined,
submitWithWarningMessage: false,
};

export const formItemDefaultProps: TdFormItemProps = {
label: '',
requiredMark: undefined,
shouldUpdate: false,
showErrorMessage: undefined,
statusIcon: undefined,
successBorder: false,
};
469 changes: 0 additions & 469 deletions packages/products/tdesign-react/src/form/type.ts

Large diffs are not rendered by default.

72 changes: 0 additions & 72 deletions packages/products/tdesign-vue-next/src/form/form-item-props.ts
Original file line number Diff line number Diff line change
@@ -1,72 +0,0 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdFormItemProps } from '../form/type';
import { PropType } from 'vue';

export default {
/** label 原生属性 */
for: {
type: String,
default: '',
},
/** 表单项说明内容 */
help: {
type: [String, Function] as PropType<TdFormItemProps['help']>,
},
/** 字段标签名称 */
label: {
type: [String, Function] as PropType<TdFormItemProps['label']>,
default: '' as TdFormItemProps['label'],
},
/** 表单字段标签对齐方式:左对齐、右对齐、顶部对齐。默认使用 Form 的对齐方式,优先级高于 Form.labelAlign */
labelAlign: {
type: String as PropType<TdFormItemProps['labelAlign']>,
validator(val: TdFormItemProps['labelAlign']): boolean {
if (!val) return true;
return ['left', 'right', 'top'].includes(val);
},
},
/** 可以整体设置标签宽度,优先级高于 Form.labelWidth */
labelWidth: {
type: [String, Number] as PropType<TdFormItemProps['labelWidth']>,
},
/** 表单字段名称 */
name: {
type: String,
default: '',
},
/** 是否显示必填符号(*),优先级高于 Form.requiredMark */
requiredMark: {
type: Boolean,
default: undefined,
},
/** 表单字段校验规则 */
rules: {
type: Array as PropType<TdFormItemProps['rules']>,
},
/** 校验不通过时,是否显示错误提示信息,优先级高于 `Form.showErrorMessage` */
showErrorMessage: {
type: Boolean,
default: undefined,
},
/** 校验状态,可在需要完全自主控制校验状态时使用 */
status: {
type: String as PropType<TdFormItemProps['status']>,
default: '' as TdFormItemProps['status'],
},
/** 校验状态图标,值为 `true` 显示默认图标,默认图标有 成功、失败、警告 等,不同的状态图标不同。`statusIcon` 值为 `false`,不显示图标。`statusIcon` 值类型为渲染函数,则可以自定义右侧状态图标。优先级高级 Form 的 statusIcon */
statusIcon: {
type: [Boolean, Function] as PropType<TdFormItemProps['statusIcon']>,
default: undefined as TdFormItemProps['statusIcon'],
},
/** 是否显示校验成功的边框,默认不显示 */
successBorder: Boolean,
/** 自定义提示内容,样式跟随 `status` 变动,可在需要完全自主控制校验规则时使用 */
tips: {
type: [String, Function] as PropType<TdFormItemProps['tips']>,
},
};
103 changes: 0 additions & 103 deletions packages/products/tdesign-vue-next/src/form/props.ts
Original file line number Diff line number Diff line change
@@ -1,103 +0,0 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdFormProps } from './type';
import { PropType } from 'vue';

export default {
/** 是否在表单标签字段右侧显示冒号 */
colon: Boolean,
/** 表单数据 */
data: {
type: Object as PropType<TdFormProps['data']>,
default: () => ({}),
},
/** 是否禁用整个表单 */
disabled: {
type: Boolean,
default: undefined,
},
/** 表单错误信息配置,示例:`{ idcard: '请输入正确的身份证号码', max: '字符长度不能超过 ${max}' }` */
errorMessage: {
type: Object as PropType<TdFormProps['errorMessage']>,
},
/** 允许表单统一控制禁用状态的自定义组件名称列表。默认会有组件库的全部输入类组件:TInput、TInputNumber、TCascader、TSelect、TOption、TSwitch、TCheckbox、TCheckboxGroup、TRadio、TRadioGroup、TTreeSelect、TDatePicker、TTimePicker、TUpload、TTransfer、TSlider。对于自定义组件,组件内部需要包含可以控制表单禁用状态的变量 `formDisabled`。示例:`['CustomUpload', 'CustomInput']` */
formControlledComponents: {
type: Array as PropType<TdFormProps['formControlledComponents']>,
},
/** 表单字段标签对齐方式:左对齐、右对齐、顶部对齐 */
labelAlign: {
type: String as PropType<TdFormProps['labelAlign']>,
default: 'right' as TdFormProps['labelAlign'],
validator(val: TdFormProps['labelAlign']): boolean {
if (!val) return true;
return ['left', 'right', 'top'].includes(val);
},
},
/** 可以整体设置label标签宽度,默认为100px */
labelWidth: {
type: [String, Number] as PropType<TdFormProps['labelWidth']>,
default: '100px' as TdFormProps['labelWidth'],
},
/** 表单布局,有两种方式:纵向布局 和 行内布局 */
layout: {
type: String as PropType<TdFormProps['layout']>,
default: 'vertical' as TdFormProps['layout'],
validator(val: TdFormProps['layout']): boolean {
if (!val) return true;
return ['vertical', 'inline'].includes(val);
},
},
/** 是否阻止表单提交默认事件(表单提交默认事件会刷新页面),设置为 `true` 可以避免刷新 */
preventSubmitDefault: {
type: Boolean,
default: true,
},
/** 是否显示必填符号(*),默认显示 */
requiredMark: {
type: Boolean,
default: undefined,
},
/** 重置表单的方式,值为 empty 表示重置表单为空,值为 initial 表示重置表单数据为初始值 */
resetType: {
type: String as PropType<TdFormProps['resetType']>,
default: 'empty' as TdFormProps['resetType'],
validator(val: TdFormProps['resetType']): boolean {
if (!val) return true;
return ['empty', 'initial'].includes(val);
},
},
/** 表单字段校验规则 */
rules: {
type: Object as PropType<TdFormProps['rules']>,
},
/** 表单校验不通过时,是否自动滚动到第一个校验不通过的字段,平滑滚动或是瞬间直达。值为空则表示不滚动 */
scrollToFirstError: {
type: String as PropType<TdFormProps['scrollToFirstError']>,
validator(val: TdFormProps['scrollToFirstError']): boolean {
if (!val) return true;
return ['', 'smooth', 'auto'].includes(val);
},
},
/** 校验不通过时,是否显示错误提示信息,统一控制全部表单项。如果希望控制单个表单项,请给 FormItem 设置该属性 */
showErrorMessage: {
type: Boolean,
default: true,
},
/** 校验状态图标,值为 `true` 显示默认图标,默认图标有 成功、失败、警告 等,不同的状态图标不同。`statusIcon` 值为 `false`,不显示图标。`statusIcon` 值类型为渲染函数,则可以自定义右侧状态图标 */
statusIcon: {
type: [Boolean, Function] as PropType<TdFormProps['statusIcon']>,
default: undefined as TdFormProps['statusIcon'],
},
/** 【讨论中】当校验结果只有告警信息时,是否触发 `submit` 提交事件 */
submitWithWarningMessage: Boolean,
/** 表单重置时触发 */
onReset: Function as PropType<TdFormProps['onReset']>,
/** 表单提交时触发。其中 `context.validateResult` 表示校验结果,`context.firstError` 表示校验不通过的第一个规则提醒。`context.validateResult` 值为 `true` 表示校验通过;如果校验不通过,`context.validateResult` 值为校验结果列表。<br />【注意】⚠️ 默认情况,输入框按下 Enter 键会自动触发提交事件,如果希望禁用这个默认行为,可以给输入框添加 enter 事件,并在事件中设置 `e.preventDefault()` */
onSubmit: Function as PropType<TdFormProps['onSubmit']>,
/** 校验结束后触发,result 值为 true 表示校验通过;如果校验不通过,result 值为校验结果列表 */
onValidate: Function as PropType<TdFormProps['onValidate']>,
};
Loading