@next-bricks/form 1.21.11 → 1.21.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/bricks.json +35 -35
  2. package/dist/chunks/2537.be4cf82c.js.map +1 -1
  3. package/dist/chunks/845.2f598dd9.js +3 -0
  4. package/dist/chunks/845.2f598dd9.js.map +1 -0
  5. package/dist/chunks/{9949.753e2720.js → 9949.3d28a915.js} +3 -3
  6. package/dist/chunks/9949.3d28a915.js.map +1 -0
  7. package/dist/chunks/eo-auto-complete.0ed854e4.js.map +1 -1
  8. package/dist/chunks/eo-checkbox.2d0a8dbc.js.map +1 -1
  9. package/dist/chunks/eo-color-picker.ecf0c4c0.js.map +1 -1
  10. package/dist/chunks/eo-date-picker.faa60507.js.map +1 -1
  11. package/dist/chunks/eo-dynamic-form-item.aa5f7d9e.js.map +1 -1
  12. package/dist/chunks/eo-form.9db78cdb.js.map +1 -1
  13. package/dist/chunks/eo-icon-select.6a7f7e12.js +3 -0
  14. package/dist/chunks/eo-icon-select.6a7f7e12.js.map +1 -0
  15. package/dist/chunks/eo-radio.b2ed57db.js.map +1 -1
  16. package/dist/chunks/eo-search.206dd65e.js.map +1 -1
  17. package/dist/chunks/eo-select.cd00c791.js.map +1 -1
  18. package/dist/chunks/eo-switch.f0a27c08.js.map +1 -1
  19. package/dist/chunks/eo-textarea.405851dd.js.map +1 -1
  20. package/dist/chunks/eo-time-picker.46e7a667.js.map +1 -1
  21. package/dist/chunks/eo-time-range-picker.5afbad69.js.map +1 -1
  22. package/dist/chunks/eo-upload-file.27a4288d.js.map +1 -1
  23. package/dist/chunks/eo-upload-image.b43c2329.js.map +1 -1
  24. package/dist/chunks/{main.8c394d3e.js → main.59f7a796.js} +2 -2
  25. package/dist/chunks/{main.8c394d3e.js.map → main.59f7a796.js.map} +1 -1
  26. package/dist/examples.json +27 -24
  27. package/dist/index.2c92cf90.js +2 -0
  28. package/dist/{index.7917bac6.js.map → index.2c92cf90.js.map} +1 -1
  29. package/dist/manifest.json +451 -385
  30. package/dist/types.json +2699 -2649
  31. package/dist-types/auto-complete/index.d.ts +4 -0
  32. package/dist-types/checkbox/index.d.ts +2 -2
  33. package/dist-types/color-picker/index.d.ts +2 -1
  34. package/dist-types/date-picker/index.d.ts +1 -1
  35. package/dist-types/form/index.d.ts +16 -1
  36. package/dist-types/form-item/index.d.ts +31 -2
  37. package/dist-types/general-switch/index.d.ts +1 -1
  38. package/dist-types/icon-select/index.d.ts +1 -1
  39. package/dist-types/input/index.d.ts +2 -2
  40. package/dist-types/radio/index.d.ts +4 -4
  41. package/dist-types/select/index.d.ts +1 -0
  42. package/dist-types/textarea/index.d.ts +1 -1
  43. package/dist-types/time-range-picker/index.d.ts +7 -4
  44. package/dist-types/upload/upload-file/index.d.ts +1 -1
  45. package/docs/eo-auto-complete.md +158 -8
  46. package/docs/eo-auto-complete.react.md +229 -0
  47. package/docs/eo-checkbox.md +107 -4
  48. package/docs/eo-checkbox.react.md +369 -0
  49. package/docs/eo-color-picker.md +102 -22
  50. package/docs/eo-color-picker.react.md +160 -0
  51. package/docs/eo-date-picker.md +82 -50
  52. package/docs/eo-date-picker.react.md +146 -0
  53. package/docs/eo-dynamic-form-item.md +60 -15
  54. package/docs/eo-dynamic-form-item.react.md +186 -0
  55. package/docs/eo-form-item.md +194 -0
  56. package/docs/eo-form-item.react.md +163 -0
  57. package/docs/eo-form.md +144 -3
  58. package/docs/eo-form.react.md +330 -0
  59. package/docs/eo-icon-select.md +80 -1
  60. package/docs/eo-icon-select.react.md +97 -0
  61. package/docs/eo-input.md +147 -22
  62. package/docs/eo-input.react.md +275 -0
  63. package/docs/eo-radio.md +145 -8
  64. package/docs/eo-radio.react.md +492 -0
  65. package/docs/eo-search.md +94 -1
  66. package/docs/eo-search.react.md +122 -0
  67. package/docs/eo-select.md +157 -9
  68. package/docs/eo-select.react.md +411 -0
  69. package/docs/eo-submit-buttons.md +120 -7
  70. package/docs/eo-submit-buttons.react.md +129 -0
  71. package/docs/eo-switch.md +57 -3
  72. package/docs/eo-switch.react.md +136 -0
  73. package/docs/eo-textarea.md +101 -22
  74. package/docs/eo-textarea.react.md +193 -0
  75. package/docs/eo-time-picker.md +70 -42
  76. package/docs/eo-time-picker.react.md +106 -0
  77. package/docs/eo-time-range-picker.md +89 -35
  78. package/docs/eo-time-range-picker.react.md +163 -0
  79. package/docs/eo-upload-file.md +101 -9
  80. package/docs/eo-upload-file.react.md +126 -0
  81. package/docs/eo-upload-image.md +70 -6
  82. package/docs/eo-upload-image.react.md +92 -0
  83. package/package.json +2 -2
  84. package/dist/chunks/845.c8b5b1e8.js +0 -3
  85. package/dist/chunks/845.c8b5b1e8.js.map +0 -1
  86. package/dist/chunks/9949.753e2720.js.map +0 -1
  87. package/dist/chunks/eo-icon-select.6ea15888.js +0 -3
  88. package/dist/chunks/eo-icon-select.6ea15888.js.map +0 -1
  89. package/dist/index.7917bac6.js +0 -2
  90. /package/dist/chunks/{845.c8b5b1e8.js.LICENSE.txt → 845.2f598dd9.js.LICENSE.txt} +0 -0
  91. /package/dist/chunks/{9949.753e2720.js.LICENSE.txt → 9949.3d28a915.js.LICENSE.txt} +0 -0
  92. /package/dist/chunks/{eo-icon-select.6ea15888.js.LICENSE.txt → eo-icon-select.6a7f7e12.js.LICENSE.txt} +0 -0
@@ -34,6 +34,7 @@ export type OptionType = Option | OptionGroup;
34
34
  * @author zhendonghuang
35
35
  *
36
36
  * @category form-input-basic
37
+ * @slot options-toolbar - 下拉列表底部工具栏
37
38
  */
38
39
  export declare class AutoComplete extends FormItemElementBase {
39
40
  #private;
@@ -61,6 +62,9 @@ export declare class AutoComplete extends FormItemElementBase {
61
62
  * 是否必填
62
63
  */
63
64
  accessor required: boolean | undefined;
65
+ /**
66
+ * 输入框当前值
67
+ */
64
68
  accessor value: string | undefined;
65
69
  /**
66
70
  * 选项列表
@@ -77,7 +77,7 @@ declare class Checkbox extends FormItemElementBase {
77
77
  */
78
78
  accessor disabled: boolean | undefined;
79
79
  /**
80
- * 是否为自定义
80
+ * 是否为自定义样式,仅在 type="icon" 时生效,启用后图标尺寸更大(52px)
81
81
  * @default false
82
82
  */
83
83
  accessor isCustom: boolean;
@@ -90,7 +90,7 @@ declare class Checkbox extends FormItemElementBase {
90
90
  */
91
91
  accessor message: Record<string, string> | undefined;
92
92
  /**
93
- * 是否为复选框,为true时,则可设置分组数据 optionGroups
93
+ * 是否启用分组模式,为 true 时,则可设置分组数据 optionGroups
94
94
  */
95
95
  accessor isGroup: boolean | undefined;
96
96
  /**
@@ -15,8 +15,9 @@ export interface EoColorPickerEventsMapping {
15
15
  onChange: "change";
16
16
  }
17
17
  /**
18
- * 构件 `eo-color-picker`
18
+ * 颜色选择器
19
19
  * @author astrid
20
+ * @category form-input-basic
20
21
  */
21
22
  export declare class EoColorPicker extends FormItemElementBase implements EoColorPickerProps {
22
23
  #private;
@@ -19,7 +19,7 @@ interface InternalStateDatePickerProps {
19
19
  onChange?: (value: Dayjs | null, dateString: string) => void;
20
20
  onOk?: (date: Dayjs) => void;
21
21
  }
22
- interface EoDatePickerProps extends Omit<InternalStateDatePickerProps, "value" | "onChange" | "onOk">, FormItemProps {
22
+ export interface EoDatePickerProps extends Omit<InternalStateDatePickerProps, "value" | "onChange" | "onOk">, FormItemProps {
23
23
  shadowRoot: ShadowRoot | null;
24
24
  value?: string;
25
25
  onChange?: (value: string) => void;
@@ -44,6 +44,9 @@ declare class Form extends ReactNextElement implements FormProps, AbstractForm {
44
44
  get isFormElement(): true;
45
45
  set values(value: Record<string, unknown>);
46
46
  get values(): Record<string, unknown>;
47
+ /**
48
+ * 静态附加值,在表单验证成功时会合并到 validate.success 事件的 detail 中
49
+ */
47
50
  accessor staticValues: Record<string, unknown> | undefined;
48
51
  /**
49
52
  * 布局方式(默认 vertical 布局)
@@ -62,6 +65,9 @@ declare class Form extends ReactNextElement implements FormProps, AbstractForm {
62
65
  * 输入控件列布局样式(仅当 layout="horizontal" 时有效)
63
66
  */
64
67
  accessor wrapperCol: ColProps;
68
+ /**
69
+ * 是否在验证失败时自动滚动到第一个错误字段
70
+ */
65
71
  accessor autoScrollToInvalidFields: boolean | undefined;
66
72
  handleValuesChange: (values: Record<string, unknown>) => void;
67
73
  /**
@@ -70,6 +76,8 @@ declare class Form extends ReactNextElement implements FormProps, AbstractForm {
70
76
  validate(): boolean | Record<string, unknown>;
71
77
  /**
72
78
  * 表单设置值方法
79
+ * @param values - 要设置的表单字段值
80
+ * @param options - 可选配置,支持 runInMicrotask(微任务中执行)和 runInMacrotask(宏任务中执行)
73
81
  */
74
82
  setInitValue(values: Record<string, unknown>, options?: {
75
83
  runInMacrotask?: boolean;
@@ -77,15 +85,22 @@ declare class Form extends ReactNextElement implements FormProps, AbstractForm {
77
85
  }): void;
78
86
  /**
79
87
  * 表单重置值方法
88
+ * @param name - 要重置的字段名,不传则重置所有字段
80
89
  */
81
90
  resetFields(name?: string): void;
82
91
  /**
83
92
  * 获取表单值方法
93
+ * @param name - 要获取的字段名,不传则获取所有字段的值
94
+ * @returns 指定字段的值,或所有字段值的对象
95
+ */
96
+ getFieldsValue(name?: string): Record<string, unknown> | unknown;
97
+ /**
98
+ * 表单自定义样式
84
99
  */
85
- getFieldsValue(name?: string): unknown;
86
100
  accessor formStyle: React.CSSProperties | undefined;
87
101
  /**
88
102
  * 校验表单字段方法
103
+ * @param name - 要校验的字段名
89
104
  */
90
105
  validateField(name: string): void;
91
106
  /**
@@ -5,7 +5,7 @@ import type { ComponentSize, Layout } from "../interface.js";
5
5
  import type { Form } from "../form/index.js";
6
6
  export type { FormItemProps };
7
7
  /**
8
- * 通用输入框构件
8
+ * 表单项构件
9
9
  * @author sailor
10
10
  * @slot - 表单项内容
11
11
  * @category form-input-basic
@@ -18,11 +18,29 @@ declare class FormItem extends FormItemElementBase implements FormItemProps {
18
18
  * 字段名称
19
19
  */
20
20
  accessor name: string | undefined;
21
+ /**
22
+ * 标签文字
23
+ */
21
24
  accessor label: string | undefined;
25
+ /**
26
+ * 正则校验规则
27
+ */
22
28
  accessor pattern: string | undefined;
29
+ /**
30
+ * 校验失败时的提示信息
31
+ */
23
32
  accessor message: Record<string, string> | undefined;
33
+ /**
34
+ * 校验类型
35
+ */
24
36
  accessor type: string | undefined;
37
+ /**
38
+ * 表单校验最大值(当 type 为 number 时表示最大数值,否则表示最大长度)
39
+ */
25
40
  accessor max: number | undefined;
41
+ /**
42
+ * 表单校验最小值(当 type 为 number 时表示最小数值,否则表示最小长度)
43
+ */
26
44
  accessor min: number | undefined;
27
45
  /**
28
46
  * 表单项是否为必填
@@ -33,8 +51,18 @@ declare class FormItem extends FormItemElementBase implements FormItemProps {
33
51
  * 初始值
34
52
  */
35
53
  accessor value: string | undefined;
54
+ /**
55
+ * 子构件中对应值的属性名
56
+ * @default "value"
57
+ */
36
58
  accessor valuePropsName: string | undefined;
59
+ /**
60
+ * 布局方式
61
+ */
37
62
  accessor layout: Layout | undefined;
63
+ /**
64
+ * 尺寸
65
+ */
38
66
  accessor size: ComponentSize | undefined;
39
67
  /**
40
68
  * 是否自动去除前后的空白字符
@@ -44,6 +72,7 @@ declare class FormItem extends FormItemElementBase implements FormItemProps {
44
72
  accessor trim: boolean;
45
73
  /**
46
74
  * 事件触发方法名
75
+ * @default "onChange"
47
76
  */
48
77
  accessor trigger: string;
49
78
  /**
@@ -51,7 +80,7 @@ declare class FormItem extends FormItemElementBase implements FormItemProps {
51
80
  */
52
81
  accessor validator: ((value: any) => MessageBody) | undefined;
53
82
  /**
54
- * 值变化时是否主动出发校验
83
+ * 值变化时是否主动触发校验
55
84
  */
56
85
  accessor needValidate: boolean | undefined;
57
86
  disconnectedCallback(): void;
@@ -62,7 +62,7 @@ export declare class GeneralSwitch extends FormItemElementBase {
62
62
  */
63
63
  accessor checkedIcon: GeneralIconProps | undefined;
64
64
  /**
65
- * 非选中时的文本
65
+ * 非选中时的图标
66
66
  */
67
67
  accessor unCheckedIcon: GeneralIconProps | undefined;
68
68
  /** 主题变体 */
@@ -49,7 +49,7 @@ export declare class IconSelect extends FormItemElementBase implements IconSelec
49
49
  */
50
50
  accessor required: boolean | undefined;
51
51
  /**
52
- * 是否必填
52
+ * 校验错误提示信息
53
53
  */
54
54
  accessor message: Record<string, string> | undefined;
55
55
  /** 主题变体 */
@@ -125,11 +125,11 @@ export declare class Input extends FormItemElementBase {
125
125
  accessor themeVariant: "default" | "elevo" | undefined;
126
126
  handleInputChange: (value: string) => void;
127
127
  /**
128
- * focus
128
+ * 使输入框获得焦点
129
129
  */
130
130
  focusInput(): void | undefined;
131
131
  /**
132
- * blur
132
+ * 使输入框失去焦点
133
133
  */
134
134
  blurInput(): void | undefined;
135
135
  /**
@@ -27,14 +27,14 @@ export interface RadioProps extends FormItemProps {
27
27
  }
28
28
  export interface RadioEvents {
29
29
  change: CustomEvent<GeneralComplexOption>;
30
- optionsChange: CustomEvent<{
30
+ "options.change": CustomEvent<{
31
31
  options: GeneralComplexOption[];
32
32
  name: string;
33
33
  }>;
34
34
  }
35
35
  export interface RadioEventsMapping {
36
36
  onValueChange: "change";
37
- onOptionsChange: "optionsChange";
37
+ onOptionsChange: "options.change";
38
38
  }
39
39
  export type { GeneralComplexOption };
40
40
  /**
@@ -45,7 +45,7 @@ export type { GeneralComplexOption };
45
45
  declare class Radio extends FormItemElementBase {
46
46
  #private;
47
47
  /**
48
- * 下拉框字段名
48
+ * 字段名称
49
49
  */
50
50
  accessor name: string | undefined;
51
51
  /**
@@ -58,7 +58,7 @@ declare class Radio extends FormItemElementBase {
58
58
  */
59
59
  accessor options: GeneralOption[] | undefined;
60
60
  /**
61
- * 单选框当前选中始值
61
+ * 单选框当前选中值
62
62
  */
63
63
  accessor value: any | undefined;
64
64
  /**
@@ -140,6 +140,7 @@ declare class Select extends FormItemElementBase {
140
140
  */
141
141
  accessor groupBy: string | undefined;
142
142
  /**
143
+ * 后缀内容,使用 useBrick 在选项及选中值旁显示额外信息
143
144
  */
144
145
  accessor suffix: {
145
146
  useBrick: UseSingleBrickConf;
@@ -102,7 +102,7 @@ declare class Textarea extends FormItemElementBase implements TextareaProps {
102
102
  */
103
103
  accessor themeVariant: "default" | "elevo" | undefined;
104
104
  /**
105
- * focus
105
+ * 使文本域获得焦点
106
106
  */
107
107
  focusTextarea(): void | undefined;
108
108
  handleInputChange: (value: string) => void;
@@ -75,15 +75,18 @@ export declare class EoTimeRangePicker extends FormItemElementBase {
75
75
  */
76
76
  accessor selectNearDays: number | undefined;
77
77
  /**
78
- * @default true
79
- * 是否在初始化完成后额外触发一次`time.range.change`, 这里因为历史原因之前默认行为就是在初始化后会触发该事件,这里为了兼容之前的行为,默认值只能设置为 true
78
+ * 是否在初始化完成后额外触发一次 change 事件。因历史原因,默认行为就是在初始化后触发该事件,为了兼容之前的行为,默认值只能设置为 true
79
+ * @default true
80
80
  */
81
81
  accessor emitChangeOnInit: boolean | undefined;
82
82
  /**
83
- * @default []
84
- * 预设时间范围快捷选择;设置了属性selectNearDays时,属性presetRanges不生效;属性rangeType为week时,presetRanges的值只能为本周、本月、本季度、今年,属性rangeType为month、quarter、year时,以此类推
83
+ * 预设时间范围快捷选择。设置了 selectNearDays 时,presetRanges 不生效;rangeType 为 week 时只能选本周、本月、本季度、今年,rangeType 为 month、quarter、year 时以此类推。
84
+ * @default []
85
85
  */
86
86
  accessor presetRanges: presetRangeType[] | undefined;
87
+ /**
88
+ * 自定义校验函数,返回错误信息字符串或 MessageBody 对象,返回空字符串表示校验通过。
89
+ */
87
90
  accessor validator: ((value: any) => MessageBody | string) | undefined;
88
91
  handleChange: (value: TimeRange) => void;
89
92
  unequal: (value: TimeRange) => string;
@@ -86,7 +86,7 @@ export declare class EoUploadFile extends FormItemElementBase implements UploadF
86
86
  */
87
87
  accessor buttonType: ButtonProps["type"] | undefined;
88
88
  /**
89
- * 上传按钮类型
89
+ * 上传按钮图标
90
90
  */
91
91
  accessor buttonIcon: GeneralIconProps;
92
92
  /**
@@ -1,9 +1,50 @@
1
- 构件 `eo-auto-complete`
1
+ ---
2
+ tagName: eo-auto-complete
3
+ displayName: WrappedEoAutoComplete
4
+ description: 带候选项的输入框
5
+ category: form-input-basic
6
+ source: "@next-bricks/form"
7
+ ---
8
+
9
+ # eo-auto-complete
10
+
11
+ > 带候选项的输入框
12
+
13
+ ## Props
14
+
15
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
16
+ | --------------- | ----------------------------- | ---- | ------ | -------------------------------- |
17
+ | name | `string` | 否 | - | 字段名称 |
18
+ | placeholder | `string` | 否 | - | 占位说明 |
19
+ | label | `string` | 否 | - | 字段文本 |
20
+ | inputStyle | `React.CSSProperties` | 否 | - | 输入框样式 |
21
+ | disabled | `boolean` | 否 | - | 是否禁用 |
22
+ | required | `boolean` | 否 | - | 是否必填 |
23
+ | value | `string` | 否 | - | 输入框当前值 |
24
+ | options | `string[] \| OptionType[]` | 否 | - | 选项列表 |
25
+ | filterByCaption | `boolean` | 否 | - | 搜索时是否根据caption过滤options |
26
+ | validator | `(value: any) => MessageBody` | 否 | - | 表单项校验方法 |
27
+ | pattern | `string` | 否 | - | 正则校验规则 |
28
+ | message | `Record<string, string>` | 否 | - | 校验文本信息 |
29
+
30
+ ## Events
31
+
32
+ | 事件 | detail | 说明 |
33
+ | ------ | ------------------------- | ---------- |
34
+ | change | `string` — 当前输入框的值 | 值改变事件 |
35
+
36
+ ## Slots
37
+
38
+ | 名称 | 说明 |
39
+ | --------------- | ------------------ |
40
+ | options-toolbar | 下拉列表底部工具栏 |
2
41
 
3
42
  ## Examples
4
43
 
5
44
  ### Basic
6
45
 
46
+ 展示带候选项输入框的最基本用法,通过字符串数组提供候选选项。
47
+
7
48
  ```yaml preview minHeight=500px
8
49
  - brick: eo-auto-complete
9
50
  properties:
@@ -14,7 +55,9 @@
14
55
  - Shenzhen
15
56
  ```
16
57
 
17
- ### caption
58
+ ### Caption
59
+
60
+ 通过 `OptionType` 对象格式为每个选项添加 `caption` 附加说明文字。
18
61
 
19
62
  ```yaml preview
20
63
  - brick: eo-auto-complete
@@ -33,6 +76,8 @@
33
76
 
34
77
  ### 分组
35
78
 
79
+ 通过 `OptionGroup` 格式对选项进行分组展示,组内每个选项可包含 `label`、`value` 和 `caption`。
80
+
36
81
  ```yaml preview
37
82
  - brick: eo-auto-complete
38
83
  properties:
@@ -48,13 +93,15 @@
48
93
  - label: 选项3-1
49
94
  value: 3-1
50
95
  caption: 说明3-1
51
- - label: 选项3-1
96
+ - label: 选项3-2
52
97
  value: 3-2
53
98
  caption: 说明3-2
54
99
  ```
55
100
 
56
101
  ### filterByCaption
57
102
 
103
+ 设置 `filterByCaption` 为 `true`,搜索时同时匹配选项的 `caption` 字段。
104
+
58
105
  ```yaml preview
59
106
  - brick: eo-auto-complete
60
107
  properties:
@@ -71,12 +118,60 @@
71
118
  - label: 选项3-1
72
119
  value: 3-1
73
120
  caption: 说明3-1
74
- - label: 选项3-1
121
+ - label: 选项3-2
75
122
  value: 3-2
76
123
  caption: 说明3-2
77
124
  ```
78
125
 
79
- ### disabled
126
+ ### Value
127
+
128
+ 通过 `value` 属性设置输入框的默认值。
129
+
130
+ ```yaml preview minHeight=300px
131
+ - brick: eo-auto-complete
132
+ properties:
133
+ value: Beijing
134
+ options:
135
+ - Beijing
136
+ - Shanghai
137
+ - Guangzhou
138
+ - Shenzhen
139
+ ```
140
+
141
+ ### Placeholder
142
+
143
+ 通过 `placeholder` 属性设置输入框的占位提示文字。
144
+
145
+ ```yaml preview minHeight=300px
146
+ - brick: eo-auto-complete
147
+ properties:
148
+ placeholder: 请输入城市名称
149
+ options:
150
+ - Beijing
151
+ - Shanghai
152
+ - Guangzhou
153
+ - Shenzhen
154
+ ```
155
+
156
+ ### Input Style
157
+
158
+ 通过 `inputStyle` 属性自定义输入框的内联样式。
159
+
160
+ ```yaml preview minHeight=300px
161
+ - brick: eo-auto-complete
162
+ properties:
163
+ inputStyle:
164
+ width: 300px
165
+ options:
166
+ - Beijing
167
+ - Shanghai
168
+ - Guangzhou
169
+ - Shenzhen
170
+ ```
171
+
172
+ ### Disabled
173
+
174
+ 设置 `disabled` 属性禁用输入框。
80
175
 
81
176
  ```yaml preview
82
177
  - brick: eo-auto-complete
@@ -89,9 +184,11 @@
89
184
  - Shenzhen
90
185
  ```
91
186
 
92
- ### events
187
+ ### Events
93
188
 
94
- ```yaml preview
189
+ 监听 `change` 事件获取用户输入或选中的实时值。
190
+
191
+ ```yaml preview minHeight=300px
95
192
  - brick: eo-auto-complete
96
193
  events:
97
194
  change:
@@ -106,7 +203,9 @@
106
203
 
107
204
  ### With Form
108
205
 
109
- ```yaml preview minHeight=500px
206
+ `eo-form` 中使用,通过 `name`、`label` 属性集成表单功能,并可配合 `required`、`pattern`、`message` 属性实现表单校验。
207
+
208
+ ```yaml preview minHeight=400px
110
209
  - brick: eo-form
111
210
  events:
112
211
  validate.success:
@@ -119,6 +218,10 @@
119
218
  name: city
120
219
  label: 城市
121
220
  required: true
221
+ pattern: "^[A-Za-z]+"
222
+ message:
223
+ required: 请选择城市
224
+ pattern: 城市名称只能包含字母
122
225
  options:
123
226
  - Beijing
124
227
  - Shanghai
@@ -126,3 +229,50 @@
126
229
  - Shenzhen
127
230
  - brick: eo-submit-buttons
128
231
  ```
232
+
233
+ ### Validator
234
+
235
+ 通过 `validator` 属性自定义表单项的校验逻辑,返回 `null` 表示校验通过,返回包含 `message` 的对象表示校验失败。
236
+
237
+ ```yaml preview minHeight=400px
238
+ - brick: eo-form
239
+ events:
240
+ validate.success:
241
+ - action: console.log
242
+ children:
243
+ - brick: eo-auto-complete
244
+ properties:
245
+ name: city
246
+ label: 城市
247
+ options:
248
+ - Beijing
249
+ - Shanghai
250
+ - Guangzhou
251
+ - Shenzhen
252
+ validator: "<% (value) => value && value.length > 10 ? { message: '城市名称不能超过10个字符' } : null %>"
253
+ - brick: eo-submit-buttons
254
+ ```
255
+
256
+ ### Options Toolbar Slot
257
+
258
+ 通过 `options-toolbar` 插槽在下拉列表底部添加自定义工具栏内容。
259
+
260
+ ```yaml preview minHeight=400px
261
+ - brick: eo-auto-complete
262
+ properties:
263
+ options:
264
+ - Beijing
265
+ - Shanghai
266
+ - Guangzhou
267
+ - Shenzhen
268
+ slots:
269
+ options-toolbar:
270
+ bricks:
271
+ - brick: span
272
+ properties:
273
+ textContent: 自定义工具栏
274
+ style:
275
+ padding: 4px 8px
276
+ color: "#999"
277
+ fontSize: 12px
278
+ ```