{"version":3,"file":"form-item2.mjs","sources":["../../../../../../packages/components/form/src/form-item.ts"],"sourcesContent":["import { buildProps, definePropType } from '@sgui-plus/utils/props'\r\nimport { componentSizes } from '@sgui-plus/utils/size'\r\nimport type { Arrayable } from '@sgui-plus/utils/types'\r\nimport type { ExtractPropTypes } from 'vue'\r\n\r\nimport type { FormItemRule } from './types'\r\n\r\nexport const formItemValidateStates = [\r\n  '',\r\n  'error',\r\n  'validating',\r\n  'success',\r\n] as const\r\nexport type FormItemValidateState = typeof formItemValidateStates[number]\r\n\r\nexport type FormItemProp = Arrayable<string>\r\n\r\nexport const formItemProps = buildProps({\r\n  /**\r\n   * @description Label text.\r\n   */\r\n  label: String,\r\n  /**\r\n   * @description Width of label, e.g. `'50px'`. `'auto'` is supported.\r\n   */\r\n  labelWidth: {\r\n    type: [String, Number],\r\n    default: '',\r\n  },\r\n  /**\r\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.\r\n   */\r\n  prop: {\r\n    type: definePropType<FormItemProp>([String, Array]),\r\n  },\r\n  /**\r\n   * @description Whether the field is required or not, will be determined by validation rules if omitted.\r\n   */\r\n  required: {\r\n    type: Boolean,\r\n    default: undefined,\r\n  },\r\n  /**\r\n   * @description Validation rules of form, see the [following table](#formitemrule), more advanced usage at [async-validator](https://github.com/yiminghe/async-validator).\r\n   */\r\n  rules: {\r\n    type: definePropType<Arrayable<FormItemRule>>([Object, Array]),\r\n  },\r\n  /**\r\n   * @description Field error message, set its value and the field will validate error and show this message immediately.\r\n   */\r\n  error: String,\r\n  /**\r\n   * @description Validation state of formItem.\r\n   */\r\n  validateStatus: {\r\n    type: String,\r\n    values: formItemValidateStates,\r\n  },\r\n  /**\r\n   * @description Same as for in native label.\r\n   */\r\n  for: String,\r\n  /**\r\n   * @description Inline style validate message.\r\n   */\r\n  inlineMessage: {\r\n    type: [String, Boolean],\r\n    default: '',\r\n  },\r\n  /**\r\n   * @description Whether to show the error message.\r\n   */\r\n  showMessage: {\r\n    type: Boolean,\r\n    default: true,\r\n  },\r\n  /**\r\n   * @description Control the size of components in this form-item.\r\n   */\r\n  size: {\r\n    type: String,\r\n    values: componentSizes,\r\n  },\r\n} as const)\r\nexport type FormItemProps = ExtractPropTypes<typeof formItemProps>\r\n"],"names":[],"mappings":";;;AAEY,MAAC,sBAAsB,GAAG;AACtC,EAAE,EAAE;AACJ,EAAE,OAAO;AACT,EAAE,YAAY;AACd,EAAE,SAAS;AACX,EAAE;AACU,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzC,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzC,GAAG;AACH,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,cAAc,EAAE;AAClB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,sBAAsB;AAClC,GAAG;AACH,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;AAC3B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,cAAc;AAC1B,GAAG;AACH,CAAC;;;;"}