hongluan-ui
Version:
Hongluan Component Library for Vue 3
1 lines • 4.36 kB
Source Map (JSON)
{"version":3,"file":"form.mjs","sources":["../../../../../../packages/components/form/src/form.ts"],"sourcesContent":["import {\n isArray,\n isString,\n isBoolean,\n} from '@hongluan-ui/utils'\n\nimport type { ExtractPropTypes, PropType } from 'vue'\nimport type { ComponentSize } from '@hongluan-ui/constants'\nimport type { FormRules } from '@hongluan-ui/tokens'\nimport type { FormItemProp } from './form-item'\n\nexport const formProps = {\n /**\n * @description Data of form component.\n */\n model: Object,\n /**\n * @description Validation rules of form.\n */\n rules: Object as PropType<FormRules>,\n /**\n * @description Position of label. If set to `'left'` or `'right'`, `label-width` prop is also required.\n */\n labelPosition: [String, Array],\n width: [String, Array],\n /**\n * @description Suffix of the label.\n */\n labelSuffix: {\n type: String,\n default: '',\n },\n /**\n * @description Prefix of the label.\n */\n labelPrefix: {\n type: String,\n default: '',\n },\n /**\n * @description Whether the form is inline.\n */\n inline: Boolean,\n /**\n * @description Whether to show the error message.\n */\n showMessage: {\n type: Boolean,\n default: true,\n },\n statusIcon: Boolean,\n /**\n * @description Control the size of components in this form.\n */\n size: String as PropType<ComponentSize>,\n /**\n * @description Whether to disable all components in this form. If set to `true`, it will override the `disabled` prop of the inner component.\n */\n disabled: Boolean,\n /**\n * @description Whether to trigger validation when the `rules` prop is changed.\n */\n validateOnRuleChange: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Whether to hide required fields should have a red asterisk (star) beside their labels.\n */\n hideRequiredAsterisk: Boolean,\n /**\n * @description Position of asterisk.\n */\n requireAsteriskPosition: {\n type: String,\n values: ['left', 'right'],\n default: 'left',\n },\n gap: {\n type: String,\n default: '',\n },\n itemGap: {\n type: String,\n default: '',\n },\n itemGapX: {\n type: String,\n default: '',\n },\n itemGapY: {\n type: String,\n default: '',\n },\n /**\n * @description When validation fails, scroll to the first error form entry.\n */\n scrollToError: Boolean,\n /**\n * @description When validation fails, it scrolls to the first error item based on the scrollIntoView option.\n */\n scrollIntoViewOptions: {\n type: [Object, Boolean],\n },\n fill: Boolean,\n}\nexport type FormProps = ExtractPropTypes<typeof formProps>\n\nexport const formEmits = {\n validate: (prop: FormItemProp, isValid: boolean, message: string) =>\n (isArray(prop) || isString(prop)) &&\n isBoolean(isValid) &&\n isString(message),\n}\nexport type FormEmits = typeof formEmits\n"],"names":[],"mappings":";;;;AAKY,MAAC,SAAS,GAAG;AACzB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,aAAa,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AAChC,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;AACxB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,UAAU,EAAE,OAAO;AACrB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,oBAAoB,EAAE;AACxB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,oBAAoB,EAAE,OAAO;AAC/B,EAAE,uBAAuB,EAAE;AAC3B,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;AAC7B,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,I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