@hinen/pro-element-plus 1.7.17 → 1.8.1
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.
- package/dist/components/DataTable/DataTable.vue.d.ts +24 -6
- package/dist/components/DataTable/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DataTable/props.d.ts +11 -2
- package/dist/components/DataTable/props.d.ts.map +1 -1
- package/dist/components/DataTable/types.d.ts +14 -1
- package/dist/components/DataTable/types.d.ts.map +1 -1
- package/dist/components/DataTable/useDataTable.d.ts.map +1 -1
- package/dist/components/FormFields/FormCascadeSelect/FormCascadeSelect.test.d.ts +2 -0
- package/dist/components/FormFields/FormCascadeSelect/FormCascadeSelect.test.d.ts.map +1 -0
- package/dist/components/FormFields/FormCascadeSelect/FormCascadeSelect.vue.d.ts +136 -146
- package/dist/components/FormFields/FormCascadeSelect/FormCascadeSelect.vue.d.ts.map +1 -1
- package/dist/components/FormFields/FormCascadeSelect/props.d.ts +112 -114
- package/dist/components/FormFields/FormCascadeSelect/props.d.ts.map +1 -1
- package/dist/components/FormFields/FormCascadeSelect/types.d.ts +24 -1
- package/dist/components/FormFields/FormCascadeSelect/types.d.ts.map +1 -1
- package/dist/components/FormFields/FormTagInput/FormTagInput.vue.d.ts.map +1 -1
- package/dist/components/FormFields/FormTreeSelect/props.d.ts +3 -1
- package/dist/components/FormFields/FormTreeSelect/props.d.ts.map +1 -1
- package/dist/index.cjs +14 -14
- package/dist/index.js +2613 -2203
- package/dist/skills/building-form-workflows/SKILL.md +77 -0
- package/dist/skills/building-form-workflows/references/examples.md +47 -0
- package/dist/skills/building-form-workflows/references/field-selection.md +16 -0
- package/dist/skills/building-form-workflows/references/gotchas.md +10 -0
- package/dist/skills/building-form-workflows/references/workflow.md +21 -0
- package/dist/skills/building-modal-workflows/SKILL.md +79 -0
- package/dist/skills/building-modal-workflows/references/examples.md +104 -0
- package/dist/skills/building-modal-workflows/references/gotchas.md +19 -0
- package/dist/skills/building-modal-workflows/references/workflow.md +17 -0
- package/dist/skills/building-query-pages/SKILL.md +81 -0
- package/dist/skills/building-query-pages/references/examples.md +64 -0
- package/dist/skills/building-query-pages/references/field-selection.md +24 -0
- package/dist/skills/building-query-pages/references/gotchas.md +10 -0
- package/dist/skills/building-query-pages/references/workflow.md +22 -0
- package/dist/skills/building-selection-inputs/SKILL.md +85 -0
- package/dist/skills/building-selection-inputs/references/examples.md +87 -0
- package/dist/skills/building-selection-inputs/references/gotchas.md +19 -0
- package/dist/skills/building-selection-inputs/references/selection-guide.md +47 -0
- package/dist/skills/choosing-components/SKILL.md +78 -0
- package/dist/skills/choosing-components/references/component-groups.md +37 -0
- package/dist/skills/choosing-components/references/examples.md +91 -0
- package/dist/skills/choosing-components/references/gotchas.md +10 -0
- package/dist/skills/choosing-components/references/selection-guide.md +40 -0
- package/dist/skills/optimizing-component-skills/REVIEW.md +775 -0
- package/dist/skills/using-checkbox-group/SKILL.md +91 -0
- package/dist/skills/using-checkbox-group/references/examples.md +55 -0
- package/dist/skills/using-checkbox-group/references/gotchas.md +13 -0
- package/dist/skills/using-checkbox-group/references/props.md +83 -0
- package/dist/skills/using-config-provider/SKILL.md +96 -0
- package/dist/skills/using-config-provider/references/examples.md +38 -0
- package/dist/skills/using-config-provider/references/gotchas.md +13 -0
- package/dist/skills/using-config-provider/references/props.md +38 -0
- package/dist/skills/using-data-select/SKILL.md +127 -0
- package/dist/skills/using-data-select/references/examples.md +67 -0
- package/dist/skills/using-data-select/references/gotchas.md +19 -0
- package/dist/skills/using-data-select/references/props.md +126 -0
- package/dist/skills/using-data-table/SKILL.md +289 -0
- package/dist/skills/using-data-table/references/examples.md +347 -0
- package/dist/skills/using-data-table/references/gotchas.md +114 -0
- package/dist/skills/using-data-table/references/props.md +375 -0
- package/dist/skills/using-drawer/SKILL.md +104 -0
- package/dist/skills/using-drawer/references/examples.md +109 -0
- package/dist/skills/using-drawer/references/gotchas.md +16 -0
- package/dist/skills/using-drawer/references/props.md +105 -0
- package/dist/skills/using-ellipsis-text/SKILL.md +105 -0
- package/dist/skills/using-ellipsis-text/references/examples.md +71 -0
- package/dist/skills/using-ellipsis-text/references/gotchas.md +19 -0
- package/dist/skills/using-ellipsis-text/references/props.md +97 -0
- package/dist/skills/using-form-autocomplete/SKILL.md +87 -0
- package/dist/skills/using-form-autocomplete/references/examples.md +62 -0
- package/dist/skills/using-form-autocomplete/references/gotchas.md +13 -0
- package/dist/skills/using-form-autocomplete/references/props.md +100 -0
- package/dist/skills/using-form-cascade-select/SKILL.md +82 -0
- package/dist/skills/using-form-cascade-select/references/examples.md +59 -0
- package/dist/skills/using-form-cascade-select/references/gotchas.md +13 -0
- package/dist/skills/using-form-cascade-select/references/props.md +138 -0
- package/dist/skills/using-form-checkbox-group/SKILL.md +83 -0
- package/dist/skills/using-form-checkbox-group/references/examples.md +61 -0
- package/dist/skills/using-form-checkbox-group/references/gotchas.md +13 -0
- package/dist/skills/using-form-checkbox-group/references/props.md +85 -0
- package/dist/skills/using-form-date-picker/SKILL.md +79 -0
- package/dist/skills/using-form-date-picker/references/examples.md +54 -0
- package/dist/skills/using-form-date-picker/references/gotchas.md +10 -0
- package/dist/skills/using-form-date-picker/references/props.md +99 -0
- package/dist/skills/using-form-fields/SKILL.md +101 -0
- package/dist/skills/using-form-fields/references/examples.md +45 -0
- package/dist/skills/using-form-fields/references/gotchas.md +6 -0
- package/dist/skills/using-form-fields/references/props.md +57 -0
- package/dist/skills/using-form-item/SKILL.md +92 -0
- package/dist/skills/using-form-item/references/examples.md +59 -0
- package/dist/skills/using-form-item/references/gotchas.md +13 -0
- package/dist/skills/using-form-item/references/props.md +85 -0
- package/dist/skills/using-form-number/SKILL.md +82 -0
- package/dist/skills/using-form-number/references/examples.md +66 -0
- package/dist/skills/using-form-number/references/gotchas.md +13 -0
- package/dist/skills/using-form-number/references/props.md +82 -0
- package/dist/skills/using-form-radio-group/SKILL.md +83 -0
- package/dist/skills/using-form-radio-group/references/examples.md +53 -0
- package/dist/skills/using-form-radio-group/references/gotchas.md +13 -0
- package/dist/skills/using-form-radio-group/references/props.md +81 -0
- package/dist/skills/using-form-rate/SKILL.md +86 -0
- package/dist/skills/using-form-rate/references/examples.md +60 -0
- package/dist/skills/using-form-rate/references/gotchas.md +16 -0
- package/dist/skills/using-form-rate/references/props.md +88 -0
- package/dist/skills/using-form-select/SKILL.md +94 -0
- package/dist/skills/using-form-select/references/examples.md +67 -0
- package/dist/skills/using-form-select/references/gotchas.md +13 -0
- package/dist/skills/using-form-select/references/props.md +87 -0
- package/dist/skills/using-form-switch/SKILL.md +81 -0
- package/dist/skills/using-form-switch/references/examples.md +54 -0
- package/dist/skills/using-form-switch/references/gotchas.md +10 -0
- package/dist/skills/using-form-switch/references/props.md +83 -0
- package/dist/skills/using-form-tag-input/SKILL.md +83 -0
- package/dist/skills/using-form-tag-input/references/examples.md +53 -0
- package/dist/skills/using-form-tag-input/references/gotchas.md +13 -0
- package/dist/skills/using-form-tag-input/references/props.md +80 -0
- package/dist/skills/using-form-text/SKILL.md +82 -0
- package/dist/skills/using-form-text/references/examples.md +66 -0
- package/dist/skills/using-form-text/references/gotchas.md +13 -0
- package/dist/skills/using-form-text/references/props.md +98 -0
- package/dist/skills/using-form-time-picker/SKILL.md +78 -0
- package/dist/skills/using-form-time-picker/references/examples.md +53 -0
- package/dist/skills/using-form-time-picker/references/gotchas.md +10 -0
- package/dist/skills/using-form-time-picker/references/props.md +89 -0
- package/dist/skills/using-form-tree-select/SKILL.md +82 -0
- package/dist/skills/using-form-tree-select/references/examples.md +55 -0
- package/dist/skills/using-form-tree-select/references/gotchas.md +13 -0
- package/dist/skills/using-form-tree-select/references/props.md +86 -0
- package/dist/skills/using-image/SKILL.md +88 -0
- package/dist/skills/using-image/references/examples.md +31 -0
- package/dist/skills/using-image/references/gotchas.md +13 -0
- package/dist/skills/using-image/references/props.md +91 -0
- package/dist/skills/using-modal/SKILL.md +113 -0
- package/dist/skills/using-modal/references/examples.md +122 -0
- package/dist/skills/using-modal/references/gotchas.md +16 -0
- package/dist/skills/using-modal/references/props.md +100 -0
- package/dist/skills/using-query-form/SKILL.md +134 -0
- package/dist/skills/using-query-form/references/examples.md +103 -0
- package/dist/skills/using-query-form/references/gotchas.md +19 -0
- package/dist/skills/using-query-form/references/props.md +146 -0
- package/dist/skills/using-radio-group/SKILL.md +91 -0
- package/dist/skills/using-radio-group/references/examples.md +55 -0
- package/dist/skills/using-radio-group/references/gotchas.md +13 -0
- package/dist/skills/using-radio-group/references/props.md +83 -0
- package/dist/skills/using-select/SKILL.md +93 -0
- package/dist/skills/using-select/references/examples.md +50 -0
- package/dist/skills/using-select/references/gotchas.md +13 -0
- package/dist/skills/using-select/references/props.md +90 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-fields
|
|
3
|
+
description: Use when choosing among the package’s Form* field wrappers or mapping schema-driven field intent to the right wrapper component.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormFields
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormFields` as the **family-level router** for the package’s wrapped field components.
|
|
11
|
+
|
|
12
|
+
This skill is not about one component with one prop surface. It is about deciding which `Form*` wrapper matches a schema-driven or form-driven need before you pick a concrete field such as `FormText`, `FormNumber`, or `FormSelect`.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- you need the map of available form wrappers
|
|
17
|
+
- you are building a schema-driven form and want consistent wrapper behavior
|
|
18
|
+
- you need to jump from a `valueType` to the matching `Form*` component
|
|
19
|
+
- you are choosing between wrapper-level composition and raw field components
|
|
20
|
+
- you want the shared mental model before selecting a specific wrapped field
|
|
21
|
+
|
|
22
|
+
## Prefer something else when
|
|
23
|
+
|
|
24
|
+
- you are still deciding whether the broader workflow is a business form, query page, or another page shell
|
|
25
|
+
→ use `../building-form-workflows/SKILL.md` or the top-level router first
|
|
26
|
+
- you already know the exact field wrapper you need
|
|
27
|
+
→ use that concrete skill directly
|
|
28
|
+
- you only need the base wrapper semantics
|
|
29
|
+
→ use `../using-form-item/SKILL.md`
|
|
30
|
+
- you are choosing page-level query composition rather than field wrappers
|
|
31
|
+
→ use `../using-query-form/SKILL.md`
|
|
32
|
+
|
|
33
|
+
## Decision guide
|
|
34
|
+
|
|
35
|
+
Use `FormFields` if the answer is yes for **two or more** of these:
|
|
36
|
+
|
|
37
|
+
- Are you still choosing which wrapped field type fits best?
|
|
38
|
+
- Do you need to map schema intent to a concrete `Form*` component?
|
|
39
|
+
- Do multiple field wrappers need to share the same wrapper semantics?
|
|
40
|
+
- Are you trying to understand the boundary between `FormItem` and the higher-level wrapped fields?
|
|
41
|
+
|
|
42
|
+
If not, go straight to the concrete field skill.
|
|
43
|
+
|
|
44
|
+
## Start with
|
|
45
|
+
|
|
46
|
+
1. Decide whether you need the base wrapper only or a concrete wrapped field.
|
|
47
|
+
2. Choose the stored value shape first.
|
|
48
|
+
3. Map that value shape to a field family member.
|
|
49
|
+
4. Only then refine field-specific props.
|
|
50
|
+
|
|
51
|
+
## Minimal patterns
|
|
52
|
+
|
|
53
|
+
### Family-level wrapper selection
|
|
54
|
+
|
|
55
|
+
Use this skill to move from intent to wrapper choice:
|
|
56
|
+
|
|
57
|
+
- text-like input → `../using-form-text/SKILL.md`
|
|
58
|
+
- numeric stepping or bounds → `../using-form-number/SKILL.md`
|
|
59
|
+
- local dropdown choice → `../using-form-select/SKILL.md`
|
|
60
|
+
- visible single choice → `../using-form-radio-group/SKILL.md`
|
|
61
|
+
- visible multi choice → `../using-form-checkbox-group/SKILL.md`
|
|
62
|
+
- binary toggle → `../using-form-switch/SKILL.md`
|
|
63
|
+
- suggestion-driven text entry → `../using-form-autocomplete/SKILL.md`
|
|
64
|
+
- date-like or time-like values → `../using-form-date-picker/SKILL.md`, `../using-form-time-picker/SKILL.md`
|
|
65
|
+
- hierarchical path or tree choice → `../using-form-cascade-select/SKILL.md`, `../using-form-tree-select/SKILL.md`
|
|
66
|
+
- freeform tags or tag collections → `../using-form-tag-input/SKILL.md`
|
|
67
|
+
- bounded rating input → `../using-form-rate/SKILL.md`
|
|
68
|
+
- custom control with only wrapper semantics → `../using-form-item/SKILL.md`
|
|
69
|
+
|
|
70
|
+
### QueryForm valueType mapping
|
|
71
|
+
|
|
72
|
+
Use this family as the conceptual backing for `QueryForm.items` when `valueType` should correspond to a known wrapped field behavior.
|
|
73
|
+
|
|
74
|
+
## Common mistakes
|
|
75
|
+
|
|
76
|
+
- treating `FormFields` like one monolithic component
|
|
77
|
+
- choosing the family entry point when the exact wrapper is already obvious
|
|
78
|
+
- thinking every wrapped field has the same field-level props just because the wrapper contract is shared
|
|
79
|
+
- skipping the wrapper-family decision and mixing raw fields with wrapped fields inconsistently
|
|
80
|
+
|
|
81
|
+
## Related skills
|
|
82
|
+
|
|
83
|
+
- Business-form workflow router above this family: `../building-form-workflows/SKILL.md`
|
|
84
|
+
- Base wrapper semantics: `../using-form-item/SKILL.md`
|
|
85
|
+
- Text-style wrapped field: `../using-form-text/SKILL.md`
|
|
86
|
+
- Number-style wrapped field: `../using-form-number/SKILL.md`
|
|
87
|
+
- Select-style wrapped field: `../using-form-select/SKILL.md`
|
|
88
|
+
- Wrapped single-choice field: `../using-form-radio-group/SKILL.md`
|
|
89
|
+
- Wrapped multi-choice field: `../using-form-checkbox-group/SKILL.md`
|
|
90
|
+
- Wrapped binary toggle: `../using-form-switch/SKILL.md`
|
|
91
|
+
- Suggestion-driven wrapped field: `../using-form-autocomplete/SKILL.md`
|
|
92
|
+
- Wrapped date and time fields: `../using-form-date-picker/SKILL.md`, `../using-form-time-picker/SKILL.md`
|
|
93
|
+
- Wrapped hierarchical selectors: `../using-form-cascade-select/SKILL.md`, `../using-form-tree-select/SKILL.md`
|
|
94
|
+
- Wrapped tag and rating fields: `../using-form-tag-input/SKILL.md`, `../using-form-rate/SKILL.md`
|
|
95
|
+
- Query-schema form shell: `../using-query-form/SKILL.md`
|
|
96
|
+
|
|
97
|
+
## References
|
|
98
|
+
|
|
99
|
+
- Props: `./references/props.md`
|
|
100
|
+
- Examples: `./references/examples.md`
|
|
101
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# FormFields examples
|
|
2
|
+
|
|
3
|
+
## 1. Query field selection
|
|
4
|
+
|
|
5
|
+
Use this family as the backing model for `QueryForm.items` when a field’s `valueType` should map to a known wrapper behavior.
|
|
6
|
+
|
|
7
|
+
Typical route:
|
|
8
|
+
|
|
9
|
+
- text-like query field → `FormText`
|
|
10
|
+
- numeric query field → `FormNumber`
|
|
11
|
+
- local-choice query field → `FormSelect`
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- schema-driven filter forms
|
|
16
|
+
- shared field definitions across tabs or modules
|
|
17
|
+
- consistent wrapper behavior across generated forms
|
|
18
|
+
|
|
19
|
+
## 2. Schema-driven business form
|
|
20
|
+
|
|
21
|
+
Start with `FormItem` semantics, then pick the concrete `Form*` wrapper that matches the stored value.
|
|
22
|
+
|
|
23
|
+
Minimal pattern:
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<FormText label="Title" prop="title" />
|
|
27
|
+
<FormNumber label="Order" prop="order" />
|
|
28
|
+
<FormSelect label="Status" prop="status" :options="statusOptions" />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Typical fit:
|
|
32
|
+
|
|
33
|
+
- admin edit forms
|
|
34
|
+
- settings forms with mixed value shapes
|
|
35
|
+
- reusable field configuration layers
|
|
36
|
+
|
|
37
|
+
## 3. Base wrapper versus concrete wrapper choice
|
|
38
|
+
|
|
39
|
+
Use this family view when you know the field belongs in a business form, but you still need to decide whether it should stay a base wrapper or move into a concrete `Form*` field.
|
|
40
|
+
|
|
41
|
+
Typical fit:
|
|
42
|
+
|
|
43
|
+
- custom upload or bespoke control that only needs `FormItem` semantics
|
|
44
|
+
- text, number, or select field that should reuse an existing wrapped component
|
|
45
|
+
- schema-driven form where some fields use standard wrappers and one field stays custom
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# FormFields gotchas
|
|
2
|
+
|
|
3
|
+
- `FormFields` is a family entry point, not one monolithic field with a huge prop surface.
|
|
4
|
+
- Every concrete `Form*` wrapper combines the underlying input props with `FormItem` behavior.
|
|
5
|
+
- Shared wrapper semantics do not mean identical field props across the whole family.
|
|
6
|
+
- If you already know the exact wrapped field you need, go to that concrete skill instead of staying at the family level.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# FormFields family
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormFields` is an exported family of wrapped field components, not a single component.
|
|
6
|
+
|
|
7
|
+
All members share the same basic pattern:
|
|
8
|
+
|
|
9
|
+
- wrapper behavior from `FormItem`
|
|
10
|
+
- field behavior from an underlying concrete input component
|
|
11
|
+
|
|
12
|
+
## Included wrappers
|
|
13
|
+
|
|
14
|
+
Currently exported family members include:
|
|
15
|
+
|
|
16
|
+
- `FormText`
|
|
17
|
+
- `FormNumber`
|
|
18
|
+
- `FormSelect`
|
|
19
|
+
- `FormCheckboxGroup`
|
|
20
|
+
- `FormRadioGroup`
|
|
21
|
+
- `FormSwitch`
|
|
22
|
+
- `FormCascadeSelect`
|
|
23
|
+
- `FormDatePicker`
|
|
24
|
+
- `FormTimePicker`
|
|
25
|
+
- `FormTagInput`
|
|
26
|
+
- `FormTreeSelect`
|
|
27
|
+
- `FormRate`
|
|
28
|
+
- `FormAutocomplete`
|
|
29
|
+
- `FormItem`
|
|
30
|
+
|
|
31
|
+
## Family shape
|
|
32
|
+
|
|
33
|
+
Most concrete `Form*` wrappers combine:
|
|
34
|
+
|
|
35
|
+
- form-item props such as `label`, `prop`, `rules`, and `tooltip`
|
|
36
|
+
- field-specific props from the wrapped control
|
|
37
|
+
- slot pass-through for both wrapper and field concerns
|
|
38
|
+
- an exposed instance shaped as `{ formItem, field }`
|
|
39
|
+
|
|
40
|
+
## When this matters
|
|
41
|
+
|
|
42
|
+
Use this family view when:
|
|
43
|
+
|
|
44
|
+
- mapping schema intent to a concrete wrapper
|
|
45
|
+
- deciding whether wrapper semantics should stay consistent across a form
|
|
46
|
+
- choosing between base `FormItem` and a specific wrapped field
|
|
47
|
+
|
|
48
|
+
## Import
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import {
|
|
52
|
+
FormItem,
|
|
53
|
+
FormText,
|
|
54
|
+
FormNumber,
|
|
55
|
+
FormSelect,
|
|
56
|
+
} from '@hinen/pro-element-plus';
|
|
57
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-item
|
|
3
|
+
description: Use when wrapper-level label, validation, tooltip, and error-display behavior matter more than the inner field control, especially inside the Form* wrapper family.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormItem
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormItem` as the **base wrapper abstraction** for the `Form*` field family when label rendering, validation state, tooltip behavior, and error presentation matter more than the specific input control inside.
|
|
11
|
+
|
|
12
|
+
It is the wrapper contract that the rest of the form-foundation skills build on. Reach for it when you need custom content inside a standard form-item shell or when you need to understand what the higher-level `Form*` wrappers are adding.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- you need wrapper-level label, validation, and tooltip behavior around custom content
|
|
17
|
+
- you want the base mental model used by the rest of the `Form*` wrapper family
|
|
18
|
+
- the field control is custom, but the label and validation shell should stay standard
|
|
19
|
+
- you need the truncated expandable error behavior provided by this wrapper
|
|
20
|
+
- parent code needs a direct form-item instance rather than a combined field wrapper
|
|
21
|
+
|
|
22
|
+
## Prefer something else when
|
|
23
|
+
|
|
24
|
+
- you are still routing at the business-form workflow level and have not yet decided whether the field should stay custom or use a standard wrapper
|
|
25
|
+
→ use `../building-form-workflows/SKILL.md`
|
|
26
|
+
- you need the full wrapper family map first
|
|
27
|
+
→ use `../using-form-fields/SKILL.md`
|
|
28
|
+
- you already know the concrete wrapped field you need
|
|
29
|
+
→ use one of `../using-form-text/SKILL.md`, `../using-form-number/SKILL.md`, or `../using-form-select/SKILL.md`
|
|
30
|
+
- you need query-schema routing rather than a single form-item shell
|
|
31
|
+
→ use `../using-query-form/SKILL.md`
|
|
32
|
+
|
|
33
|
+
## Decision guide
|
|
34
|
+
|
|
35
|
+
Use `FormItem` if the answer is yes for **two or more** of these:
|
|
36
|
+
|
|
37
|
+
- Is the wrapper behavior more important than the input component?
|
|
38
|
+
- Do you need a custom child control inside a standard form-item shell?
|
|
39
|
+
- Should tooltip, label, and validation behavior stay consistent with the `Form*` family?
|
|
40
|
+
- Do you need direct access to form-item instance methods like `validate()` or `clearValidate()`?
|
|
41
|
+
|
|
42
|
+
If not, a concrete `Form*` field wrapper is usually the better fit.
|
|
43
|
+
|
|
44
|
+
## Start with
|
|
45
|
+
|
|
46
|
+
1. Decide whether you truly need a custom inner control.
|
|
47
|
+
2. Pass normal form-item props such as `label`, `prop`, `rules`, and `required`.
|
|
48
|
+
3. Add `tooltip` only when label help is part of the field contract.
|
|
49
|
+
4. Use a concrete `Form*` wrapper instead if the inner field is already standard.
|
|
50
|
+
|
|
51
|
+
## Minimal patterns
|
|
52
|
+
|
|
53
|
+
### Base wrapper around custom content
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<FormItem label="Project Name" prop="name" :rules="rules.name">
|
|
57
|
+
<ElInput v-model="form.name" />
|
|
58
|
+
</FormItem>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Tooltip-backed label
|
|
62
|
+
|
|
63
|
+
Use `tooltip` when label help should stay attached to the wrapper rather than the field body.
|
|
64
|
+
|
|
65
|
+
### Instance-oriented wrapper usage
|
|
66
|
+
|
|
67
|
+
Use the exposed form-item instance when parent code needs:
|
|
68
|
+
|
|
69
|
+
- `validate()`
|
|
70
|
+
- `clearValidate()`
|
|
71
|
+
- `resetField()`
|
|
72
|
+
|
|
73
|
+
## Common mistakes
|
|
74
|
+
|
|
75
|
+
- using `FormItem` directly when a concrete `Form*` wrapper would be clearer
|
|
76
|
+
- treating it as if it manages field value behavior by itself
|
|
77
|
+
- forgetting that the main value of this component is the wrapper shell, not the inner control
|
|
78
|
+
- assuming the custom error rendering behaves exactly like plain Element Plus form-item output
|
|
79
|
+
|
|
80
|
+
## Related skills
|
|
81
|
+
|
|
82
|
+
- Business-form router above this wrapper layer: `../building-form-workflows/SKILL.md`
|
|
83
|
+
- Wrapper-family selection: `../using-form-fields/SKILL.md`
|
|
84
|
+
- Text-style wrapped field: `../using-form-text/SKILL.md`
|
|
85
|
+
- Number-style wrapped field: `../using-form-number/SKILL.md`
|
|
86
|
+
- Select-style wrapped field: `../using-form-select/SKILL.md`
|
|
87
|
+
|
|
88
|
+
## References
|
|
89
|
+
|
|
90
|
+
- Props: `./references/props.md`
|
|
91
|
+
- Examples: `./references/examples.md`
|
|
92
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# FormItem examples
|
|
2
|
+
|
|
3
|
+
## 1. Wrapper around a custom control
|
|
4
|
+
|
|
5
|
+
Use `FormItem` when the field UI is custom but the label, validation, and error shell should stay standard.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormItem label="Members" prop="members">
|
|
11
|
+
<MemberPicker v-model="members" />
|
|
12
|
+
</FormItem>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Typical fit:
|
|
16
|
+
|
|
17
|
+
- custom composite controls
|
|
18
|
+
- third-party inputs placed inside a normal form shell
|
|
19
|
+
- feature-specific widgets that still belong to a standard form
|
|
20
|
+
|
|
21
|
+
Recommended pattern:
|
|
22
|
+
|
|
23
|
+
- keep the custom control in the default slot
|
|
24
|
+
- let `FormItem` handle label, rules, and error state
|
|
25
|
+
|
|
26
|
+
## 2. Base model for the Form\* family
|
|
27
|
+
|
|
28
|
+
Use `FormItem` as the mental model for understanding higher-level wrappers like `FormText`, `FormNumber`, and `FormSelect`.
|
|
29
|
+
|
|
30
|
+
Minimal pattern:
|
|
31
|
+
|
|
32
|
+
```vue
|
|
33
|
+
<FormText label="Name" prop="name" />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This is the wrapped-field version of keeping the same label, rule, and error shell.
|
|
37
|
+
|
|
38
|
+
Typical fit:
|
|
39
|
+
|
|
40
|
+
- deciding whether to use the base wrapper or a concrete wrapped field
|
|
41
|
+
- understanding where tooltip and label behavior comes from
|
|
42
|
+
|
|
43
|
+
## 3. Tooltip-backed label behavior
|
|
44
|
+
|
|
45
|
+
Use `tooltip` when field help belongs next to the label rather than inside helper text or placeholder copy.
|
|
46
|
+
|
|
47
|
+
Minimal pattern:
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<FormItem label="API Key" prop="apiKey" tooltip="Use the server-issued key.">
|
|
51
|
+
<Input v-model="apiKey" />
|
|
52
|
+
</FormItem>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Typical fit:
|
|
56
|
+
|
|
57
|
+
- policy explanations
|
|
58
|
+
- field-specific format hints
|
|
59
|
+
- admin forms with ambiguous labels
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# FormItem gotchas
|
|
2
|
+
|
|
3
|
+
- `FormItem` is only the wrapper shell
|
|
4
|
+
It does not choose or manage the inner field component for you.
|
|
5
|
+
|
|
6
|
+
- `htmlFor` replaces the raw `for` prop name
|
|
7
|
+
Use `htmlFor` when you need explicit label-to-input binding.
|
|
8
|
+
|
|
9
|
+
- `tooltip` is wrapper-level behavior
|
|
10
|
+
Put label help here only when it belongs to the label contract, not when it should live in field content.
|
|
11
|
+
|
|
12
|
+
- Error rendering is customized
|
|
13
|
+
This wrapper truncates long errors and expands them on hover, so do not assume the plain Element Plus visual behavior.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# FormItem props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormItem` extends the Element Plus form-item contract and adds two important wrapper-level capabilities:
|
|
6
|
+
|
|
7
|
+
- `htmlFor` as the explicit label-to-field binding prop
|
|
8
|
+
- `tooltip` for label help content
|
|
9
|
+
|
|
10
|
+
It also customizes error rendering and exposes the underlying form-item instance methods.
|
|
11
|
+
|
|
12
|
+
## Minimum setup
|
|
13
|
+
|
|
14
|
+
Typical useful props:
|
|
15
|
+
|
|
16
|
+
- `label`
|
|
17
|
+
- `prop`
|
|
18
|
+
- `rules`
|
|
19
|
+
- `required`
|
|
20
|
+
|
|
21
|
+
Optional wrapper enhancements:
|
|
22
|
+
|
|
23
|
+
- `tooltip`
|
|
24
|
+
- `htmlFor`
|
|
25
|
+
|
|
26
|
+
## Core props
|
|
27
|
+
|
|
28
|
+
### Standard form-item props
|
|
29
|
+
|
|
30
|
+
`FormItem` keeps the normal Element Plus form-item surface, including commonly used props such as:
|
|
31
|
+
|
|
32
|
+
- `prop`
|
|
33
|
+
- `label`
|
|
34
|
+
- `labelPosition`
|
|
35
|
+
- `rules`
|
|
36
|
+
- `required`
|
|
37
|
+
- `error`
|
|
38
|
+
- `validateStatus`
|
|
39
|
+
|
|
40
|
+
### `htmlFor`
|
|
41
|
+
|
|
42
|
+
Wrapper alias for the label `for` binding.
|
|
43
|
+
|
|
44
|
+
Use this when the label should point to an inner input element explicitly.
|
|
45
|
+
|
|
46
|
+
### `tooltip`
|
|
47
|
+
|
|
48
|
+
Accepts:
|
|
49
|
+
|
|
50
|
+
- a simple string
|
|
51
|
+
- a partial tooltip-props object
|
|
52
|
+
|
|
53
|
+
Use this when label help should be rendered next to the field label.
|
|
54
|
+
|
|
55
|
+
## Slots
|
|
56
|
+
|
|
57
|
+
Useful wrapper slots:
|
|
58
|
+
|
|
59
|
+
- default
|
|
60
|
+
- `label`
|
|
61
|
+
- `error`
|
|
62
|
+
|
|
63
|
+
These are the same extension points the higher-level `Form*` wrappers compose around.
|
|
64
|
+
|
|
65
|
+
## Instance API
|
|
66
|
+
|
|
67
|
+
Exposed form-item instance behavior includes:
|
|
68
|
+
|
|
69
|
+
- `validate()`
|
|
70
|
+
- `clearValidate()`
|
|
71
|
+
- `resetField()`
|
|
72
|
+
- `size`
|
|
73
|
+
- `validateMessage`
|
|
74
|
+
- `validateState`
|
|
75
|
+
|
|
76
|
+
## Import
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { FormItem } from '@hinen/pro-element-plus';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Notes
|
|
83
|
+
|
|
84
|
+
- This component is the base wrapper for the `Form*` field family.
|
|
85
|
+
- It does not manage field value behavior on its own; the inner control still owns that part.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-number
|
|
3
|
+
description: Use when a wrapped field needs numeric step, bounds, or precision behavior while keeping the shared FormItem shell and combined formItem-plus-field instance shape.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormNumber
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormNumber` for a **numeric wrapped field** that combines `FormItem` wrapper behavior with Element Plus input-number behavior.
|
|
11
|
+
|
|
12
|
+
It is the right fit when the field needs true numeric control semantics such as stepping, bounds, or precision, not just a text input that happens to accept numbers.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- a schema-driven field must enforce numeric stepping, bounds, or precision
|
|
17
|
+
- you want Element Plus input-number behavior plus `FormItem` labels and rules
|
|
18
|
+
- the field should expose both `formItem` and numeric `field` refs together
|
|
19
|
+
- wrapper-level tooltip, label, and error behavior should stay consistent with the rest of the form family
|
|
20
|
+
|
|
21
|
+
## Prefer something else when
|
|
22
|
+
|
|
23
|
+
- you need freeform text, password, or textarea input
|
|
24
|
+
→ use `../using-form-text/SKILL.md`
|
|
25
|
+
- you need select-style choice input
|
|
26
|
+
→ use `../using-form-select/SKILL.md`
|
|
27
|
+
- you only need wrapper behavior around custom content
|
|
28
|
+
→ use `../using-form-item/SKILL.md`
|
|
29
|
+
|
|
30
|
+
## Decision guide
|
|
31
|
+
|
|
32
|
+
Use `FormNumber` if the answer is yes for **two or more** of these:
|
|
33
|
+
|
|
34
|
+
- Should the value behave like a real numeric control rather than freeform text?
|
|
35
|
+
- Do step, min, max, or precision rules matter to normal usage?
|
|
36
|
+
- Should the field stay inside the shared form-wrapper family?
|
|
37
|
+
- Do you need both wrapper validation access and numeric-field instance access?
|
|
38
|
+
|
|
39
|
+
If not, `FormText` or another wrapper is probably a better fit.
|
|
40
|
+
|
|
41
|
+
## Start with
|
|
42
|
+
|
|
43
|
+
1. Decide the numeric contract first: bounds, step, and precision.
|
|
44
|
+
2. Add the normal `FormItem` props such as `label`, `prop`, and `rules`.
|
|
45
|
+
3. Pass numeric-control props only after the wrapper fit is clear.
|
|
46
|
+
4. Use a text wrapper instead if the value is not truly numeric in behavior.
|
|
47
|
+
|
|
48
|
+
## Minimal patterns
|
|
49
|
+
|
|
50
|
+
### Standard wrapped number field
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<FormNumber label="Quantity" prop="quantity" :min="0" :step="1" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Precision-aware numeric field
|
|
57
|
+
|
|
58
|
+
Use `precision` when decimal behavior is part of the field contract.
|
|
59
|
+
|
|
60
|
+
### Range-bounded numeric field
|
|
61
|
+
|
|
62
|
+
Use `min` and `max` when bounds are part of normal user guidance, not only a final validation rule.
|
|
63
|
+
|
|
64
|
+
## Common mistakes
|
|
65
|
+
|
|
66
|
+
- using `FormNumber` when the feature really wants freeform numeric text input
|
|
67
|
+
- forgetting that this wrapper combines both form-item props and input-number props
|
|
68
|
+
- treating `min`, `max`, or `step` as optional styling hints instead of core numeric behavior
|
|
69
|
+
- manually composing `FormItem` and `ElInputNumber` when the standard wrapper already fits
|
|
70
|
+
|
|
71
|
+
## Related skills
|
|
72
|
+
|
|
73
|
+
- Wrapper-family selection: `../using-form-fields/SKILL.md`
|
|
74
|
+
- Base wrapper only: `../using-form-item/SKILL.md`
|
|
75
|
+
- Text-style wrapped field: `../using-form-text/SKILL.md`
|
|
76
|
+
- Select-style wrapped field: `../using-form-select/SKILL.md`
|
|
77
|
+
|
|
78
|
+
## References
|
|
79
|
+
|
|
80
|
+
- Props: `./references/props.md`
|
|
81
|
+
- Examples: `./references/examples.md`
|
|
82
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# FormNumber examples
|
|
2
|
+
|
|
3
|
+
## 1. Quantity or count field
|
|
4
|
+
|
|
5
|
+
Use `FormNumber` when the value is inherently numeric and stepping is part of the normal interaction.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormNumber label="Count" prop="count" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- quantity
|
|
16
|
+
- sort order
|
|
17
|
+
- retry count
|
|
18
|
+
- item limits
|
|
19
|
+
|
|
20
|
+
## 2. Precision-aware numeric input
|
|
21
|
+
|
|
22
|
+
Use `precision` when decimals are part of the field contract.
|
|
23
|
+
|
|
24
|
+
Minimal pattern:
|
|
25
|
+
|
|
26
|
+
```vue
|
|
27
|
+
<FormNumber label="Rate" prop="rate" :precision="2" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Typical fit:
|
|
31
|
+
|
|
32
|
+
- rates
|
|
33
|
+
- percentages
|
|
34
|
+
- decimal thresholds
|
|
35
|
+
|
|
36
|
+
## 3. Range-bounded numeric field
|
|
37
|
+
|
|
38
|
+
Use `min` and `max` when the field should communicate allowed bounds directly through the control.
|
|
39
|
+
|
|
40
|
+
Minimal pattern:
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<FormNumber label="Age" prop="age" :min="18" :max="99" />
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Typical fit:
|
|
47
|
+
|
|
48
|
+
- age limits
|
|
49
|
+
- pagination size settings
|
|
50
|
+
- configurable thresholds
|
|
51
|
+
|
|
52
|
+
## 4. Wrapper-family numeric field
|
|
53
|
+
|
|
54
|
+
Use `FormNumber` when a schema-driven or reusable form should keep the same wrapper semantics as sibling fields.
|
|
55
|
+
|
|
56
|
+
Minimal pattern:
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<FormNumber label="Retry Count" prop="retryCount" />
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Typical fit:
|
|
63
|
+
|
|
64
|
+
- shared admin forms
|
|
65
|
+
- generated form schemas
|
|
66
|
+
- mixed forms using `FormText`, `FormNumber`, and `FormSelect` together
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# FormNumber gotchas
|
|
2
|
+
|
|
3
|
+
- `FormNumber` is for numeric control semantics, not just numeric-looking text
|
|
4
|
+
If freeform input is acceptable, `../using-form-text/SKILL.md` may be a better fit.
|
|
5
|
+
|
|
6
|
+
- Wrapper props and field props are merged
|
|
7
|
+
Keep clear which behavior comes from the form shell and which comes from the numeric control.
|
|
8
|
+
|
|
9
|
+
- The exposed instance is split into `formItem` and `field`
|
|
10
|
+
Validation methods live on `formItem`; numeric-field behavior lives on `field`.
|
|
11
|
+
|
|
12
|
+
- Bounds and stepping are part of the abstraction
|
|
13
|
+
If `min`, `max`, or `step` are central to the feature, document them intentionally rather than treating them as minor options.
|