You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
5.0 KiB

1 month ago
  1. {"ast":null,"code":"import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';\nimport { componentSizes } from '../../../constants/size.mjs';\nconst formItemValidateStates = [\"\", \"error\", \"validating\", \"success\"];\nconst formItemProps = buildProps({\n label: String,\n labelWidth: {\n type: [String, Number],\n default: \"\"\n },\n labelPosition: {\n type: String,\n values: [\"left\", \"right\", \"top\", \"\"],\n default: \"\"\n },\n prop: {\n type: definePropType([String, Array])\n },\n required: {\n type: Boolean,\n default: void 0\n },\n rules: {\n type: definePropType([Object, Array])\n },\n error: String,\n validateStatus: {\n type: String,\n values: formItemValidateStates\n },\n for: String,\n inlineMessage: {\n type: [String, Boolean],\n default: \"\"\n },\n showMessage: {\n type: Boolean,\n default: true\n },\n size: {\n type: String,\n values: componentSizes\n }\n});\nexport { formItemProps, formItemValidateStates };","map":{"version":3,"names":["formItemValidateStates","formItemProps","buildProps","label","String","labelWidth","type","Number","default","labelPosition","values","prop","definePropType","Array","required","Boolean","rules","Object","error","validateStatus","for","inlineMessage","showMessage","size","componentSizes"],"sources":["../../../../../../packages/components/form/src/form-item.ts"],"sourcesContent":["import { componentSizes } from '@element-plus/constants'\nimport { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type { Arrayable } from '@element-plus/utils'\nimport type { FormItemRule } from './types'\n\nexport const formItemValidateStates = [\n '',\n 'error',\n 'validating',\n 'success',\n] as const\nexport type FormItemValidateState = typeof formItemValidateStates[number]\n\nexport type FormItemProp = Arrayable<string>\n\nexport const formItemProps = buildProps({\n /**\n * @description Label text.\n */\n label: String,\n /**\n * @description Width of label, e.g. `'50px'`. `'auto'` is supported.\n */\n labelWidth: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description Position of label. If set to `'left'` or `'right'`, `label-width` prop is also required. The default is extend from `form label-position`.\n */\n labelPosition: {\n type: String,\n values: ['left', 'right', 'top', ''],\n default: '',\n },\n /**\n * @description A key of `model`. It could be an array of property paths (e.g `['a', 'b', '0']`). In the use of `validate` and `resetFields` method, the attribute is required.\n */\n prop: {\n type: definePropType<FormItemProp>([String, Array]),\n },\n /**\n * @description Whether the field is required or not, will be determined by validation rules if omitted.\n */\n required: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description Validation rules of form, see the [following table](#formitemrule), more advanced usage at [async-validator](https://github.com/yiminghe/async-validator).\n */\n rules: {\n type: definePropType<Arrayable<FormItemRule>>([Object, Array]),\n },\n /**\n * @description Field error message, set its value and the field will validate error and show this message immediately.\n */\n error: String,\n /**\n * @description Validation state of formItem.\n */\n validateStatus: {\n type: String,\n values: formItemValidateStates,\n },\n /**\n * @description Same as for in native label.\n */\n for: String,\n /**\n * @description Inline style validate message.\n */\n inlineMessage: {\n type: [String, Boolean],\n default: '',\n },\n /**\n * @description Whether to show the error message.\n */\n showMessage: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Control the size of components in this form-item.\n */\n size: {\n type: String,\n values: componentSizes,\n },\n} as const)\nexport type FormItemProps = ExtractPropTypes<typeof formI