form-item.mjs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { componentSizes } from "../../../constants/size.mjs";
  2. import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
  3. //#region ../../packages/components/form/src/form-item.ts
  4. const formItemValidateStates = [
  5. "",
  6. "error",
  7. "validating",
  8. "success"
  9. ];
  10. /**
  11. * @deprecated Removed after 3.0.0, Use `FormItemProps` instead.
  12. */
  13. const formItemProps = buildProps({
  14. /**
  15. * @description Label text.
  16. */
  17. label: String,
  18. /**
  19. * @description Width of label, e.g. `'50px'`. `'auto'` is supported.
  20. */
  21. labelWidth: { type: [String, Number] },
  22. /**
  23. * @description Position of label. If set to `'left'` or `'right'`, `label-width` prop is also required. The default is extend from `form label-position`.
  24. */
  25. labelPosition: {
  26. type: String,
  27. values: [
  28. "left",
  29. "right",
  30. "top",
  31. ""
  32. ],
  33. default: ""
  34. },
  35. /**
  36. * @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.
  37. */
  38. prop: { type: definePropType([String, Array]) },
  39. /**
  40. * @description Whether the field is required or not, will be determined by validation rules if omitted.
  41. */
  42. required: {
  43. type: Boolean,
  44. default: void 0
  45. },
  46. /**
  47. * @description Validation rules of form, see the [following table](#formitemrule), more advanced usage at [async-validator](https://github.com/yiminghe/async-validator).
  48. */
  49. rules: { type: definePropType([Object, Array]) },
  50. /**
  51. * @description Field error message, set its value and the field will validate error and show this message immediately.
  52. */
  53. error: String,
  54. /**
  55. * @description Validation state of formItem.
  56. */
  57. validateStatus: {
  58. type: String,
  59. values: formItemValidateStates
  60. },
  61. /**
  62. * @description Same as for in native label.
  63. */
  64. for: String,
  65. /**
  66. * @description Inline style validate message.
  67. */
  68. inlineMessage: {
  69. type: Boolean,
  70. default: void 0
  71. },
  72. /**
  73. * @description Whether to show the error message.
  74. */
  75. showMessage: {
  76. type: Boolean,
  77. default: true
  78. },
  79. /**
  80. * @description Control the size of components in this form-item.
  81. */
  82. size: {
  83. type: String,
  84. values: componentSizes
  85. }
  86. });
  87. //#endregion
  88. export { formItemProps, formItemValidateStates };
  89. //# sourceMappingURL=form-item.mjs.map