{"version":3,"file":"form-item.mjs","names":[],"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 { ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\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 interface FormItemProps {\n  /**\n   * @description Label text.\n   */\n  label?: string\n  /**\n   * @description Width of label, e.g. `'50px'`. `'auto'` is supported.\n   */\n  labelWidth?: string | number\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?: 'left' | 'right' | 'top' | ''\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?: FormItemProp\n  /**\n   * @description Whether the field is required or not, will be determined by validation rules if omitted.\n   */\n  required?: boolean\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?: Arrayable<FormItemRule>\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?: FormItemValidateState\n  /**\n   * @description Same as for in native label.\n   */\n  for?: string\n  /**\n   * @description Inline style validate message.\n   */\n  inlineMessage?: boolean\n  /**\n   * @description Whether to show the error message.\n   */\n  showMessage?: boolean\n  /**\n   * @description Control the size of components in this form-item.\n   */\n  size?: ComponentSize\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `FormItemProps` instead.\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  },\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: Boolean,\n    default: undefined,\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)\n\n/**\n * @deprecated Removed after 3.0.0, Use `FormItemProps` instead.\n */\nexport type FormItemPropsPublic = ExtractPublicPropTypes<typeof formItemProps>\n"],"mappings":";;;;AAQA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACD;;;;AA2DD,MAAa,gBAAgB,WAAW;CAItC,OAAO;CAIP,YAAY,EACV,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,eAAe;EACb,MAAM;EACN,QAAQ;GAAC;GAAQ;GAAS;GAAO;GAAG;EACpC,SAAS;EACV;CAID,MAAM,EACJ,MAAM,eAA6B,CAAC,QAAQ,MAAM,CAAC,EACpD;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,OAAO,EACL,MAAM,eAAwC,CAAC,QAAQ,MAAM,CAAC,EAC/D;CAID,OAAO;CAIP,gBAAgB;EACd,MAAM;EACN,QAAQ;EACT;CAID,KAAK;CAIL,eAAe;EACb,MAAM;EACN,SAAS;EACV;CAID,aAAa;EACX,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,QAAQ;EACT;CACF,CAAU"}