hongluan-ui
Version:
Hongluan Component Library for Vue 3
1 lines • 3.21 kB
Source Map (JSON)
{"version":3,"file":"form-item2.mjs","sources":["../../../../../../packages/components/form/src/form-item.ts"],"sourcesContent":["import { isValidComponentSize } from '@hongluan-ui/utils'\n\nimport type { ExtractPropTypes, PropType } from 'vue'\nimport type { Arrayable } from '@hongluan-ui/utils'\nimport type { ComponentSize } from '@hongluan-ui/constants'\nimport type { FormItemRule } from '@hongluan-ui/tokens'\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 = {\n /**\n * @description Label text.\n */\n label: String,\n width: [String, Array],\n labelPosition: [String, Array],\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: [String, Array] as PropType<string | FormItemProp>,\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: [Object, Array] as PropType<FormItemRule | 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: String as PropType<FormItemValidateState>,\n /**\n * @description Same as for in native label.\n */\n for: String,\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 as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n gap: {\n type: String,\n default: '',\n },\n offset: {\n type: String,\n default: '',\n },\n}\nexport type FormItemProps = ExtractPropTypes<typeof formItemProps>\n"],"names":[],"mappings":";;;AACY,MAAC,sBAAsB,GAAG;AACtC,EAAE,EAAE;AACJ,EAAE,OAAO;AACT,EAAE,YAAY;AACd,EAAE,SAAS;AACX,EAAE;AACU,MAAC,aAAa,GAAG;AAC7B,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACxB,EAAE,aAAa,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AAChC,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACvB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACxB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,cAAc,EAAE,MAAM;AACxB,EAAE,GAAG,EAAE,MAAM;AACb,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,SAAS,EAAE,oBAAoB;AACnC,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH;;;;"}