@hinen/pro-element-plus 1.7.17 → 1.8.0
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 +13 -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.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 +32 -32
- package/dist/index.js +2947 -2570
- 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,67 @@
|
|
|
1
|
+
# FormSelect examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard wrapped select field
|
|
4
|
+
|
|
5
|
+
Use `FormSelect` when a local-choice field should keep the same wrapper semantics as the rest of a form.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormSelect label="Status" prop="status" :options="statusOptions" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- status selection
|
|
16
|
+
- role selection
|
|
17
|
+
- category pickers with local dictionaries
|
|
18
|
+
|
|
19
|
+
## 2. Enum-backed wrapped select
|
|
20
|
+
|
|
21
|
+
Use `valueEnum` when a compact value-to-label mapping is clearer than an explicit options array.
|
|
22
|
+
|
|
23
|
+
Minimal pattern:
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<FormSelect label="Mode" prop="mode" :value-enum="modeEnum" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Typical fit:
|
|
30
|
+
|
|
31
|
+
- statuses
|
|
32
|
+
- modes
|
|
33
|
+
- small fixed choice sets
|
|
34
|
+
|
|
35
|
+
## 3. Grouped local choices
|
|
36
|
+
|
|
37
|
+
Use grouped `options` when categories matter but the field should remain local-option-driven.
|
|
38
|
+
|
|
39
|
+
Minimal pattern:
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<FormSelect label="Category" prop="category" :options="groupedOptions" />
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Typical fit:
|
|
46
|
+
|
|
47
|
+
- grouped taxonomies
|
|
48
|
+
- categorized local lists
|
|
49
|
+
- role or permission groups
|
|
50
|
+
|
|
51
|
+
## 4. Wrapper-family select field
|
|
52
|
+
|
|
53
|
+
Use `FormSelect` when a reusable form should keep shared wrapper behavior across text, number, and select fields.
|
|
54
|
+
|
|
55
|
+
Minimal pattern:
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<FormText label="Title" prop="title" />
|
|
59
|
+
<FormNumber label="Order" prop="order" />
|
|
60
|
+
<FormSelect label="Status" prop="status" :options="statusOptions" />
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Typical fit:
|
|
64
|
+
|
|
65
|
+
- schema-driven forms
|
|
66
|
+
- mixed forms with `FormText` and `FormNumber`
|
|
67
|
+
- admin forms using consistent wrapper semantics
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# FormSelect gotchas
|
|
2
|
+
|
|
3
|
+
- `FormSelect` is local-option-focused
|
|
4
|
+
If option loading is remote-first or lookup-oriented, prefer `../using-data-select/SKILL.md`.
|
|
5
|
+
|
|
6
|
+
- `valueEnum` becomes local options
|
|
7
|
+
It is a convenience input, not a separate remote or dynamic mode.
|
|
8
|
+
|
|
9
|
+
- Wrapper slots and select slots live at different layers
|
|
10
|
+
Use `label` for the form-item layer and `input-label` for the inner select label-rendering slot.
|
|
11
|
+
|
|
12
|
+
- This wrapper still depends on the local `Select` abstraction
|
|
13
|
+
Grouped options, `valueKey`, and slot behavior follow the wrapped select contract, not an unrelated remote-select model.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# FormSelect props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormSelect` combines `FormItem` props with the local-option `Select` props and adds `valueEnum` as a compact option source.
|
|
6
|
+
|
|
7
|
+
Use it when local choice input should stay inside the standard form-wrapper family.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
Typical useful props:
|
|
12
|
+
|
|
13
|
+
- `label`
|
|
14
|
+
- `prop`
|
|
15
|
+
- one of `options` or `valueEnum`
|
|
16
|
+
|
|
17
|
+
Common optional field props:
|
|
18
|
+
|
|
19
|
+
- `multiple`
|
|
20
|
+
- `filterable`
|
|
21
|
+
- `clearable`
|
|
22
|
+
- `valueKey`
|
|
23
|
+
|
|
24
|
+
## Core props
|
|
25
|
+
|
|
26
|
+
### Wrapper props from `FormItem`
|
|
27
|
+
|
|
28
|
+
Includes wrapper-level props such as:
|
|
29
|
+
|
|
30
|
+
- `label`
|
|
31
|
+
- `prop`
|
|
32
|
+
- `rules`
|
|
33
|
+
- `required`
|
|
34
|
+
- `tooltip`
|
|
35
|
+
|
|
36
|
+
### Select props from `Select`
|
|
37
|
+
|
|
38
|
+
Commonly useful field props include:
|
|
39
|
+
|
|
40
|
+
- `options`
|
|
41
|
+
- `modelValue`
|
|
42
|
+
- `multiple`
|
|
43
|
+
- `filterable`
|
|
44
|
+
- `clearable`
|
|
45
|
+
- `valueKey`
|
|
46
|
+
|
|
47
|
+
### `valueEnum`
|
|
48
|
+
|
|
49
|
+
Compact mapping from value to label.
|
|
50
|
+
|
|
51
|
+
The wrapper converts this into local select options when `options` is not provided.
|
|
52
|
+
|
|
53
|
+
## Slots
|
|
54
|
+
|
|
55
|
+
Useful slots include:
|
|
56
|
+
|
|
57
|
+
- wrapper-level `label` and `error`
|
|
58
|
+
- select-level `option`, `header`, `footer`, `prefix`, `empty`, `loading`, `tag`
|
|
59
|
+
- `input-label` for the inner select label-rendering slot
|
|
60
|
+
|
|
61
|
+
The renamed `input-label` slot matters because the wrapper already uses `label` for the form-item layer.
|
|
62
|
+
|
|
63
|
+
## Instance API
|
|
64
|
+
|
|
65
|
+
The exposed instance combines:
|
|
66
|
+
|
|
67
|
+
- `formItem`
|
|
68
|
+
- `field`
|
|
69
|
+
|
|
70
|
+
## Events
|
|
71
|
+
|
|
72
|
+
Important events include:
|
|
73
|
+
|
|
74
|
+
- `update:modelValue`
|
|
75
|
+
- `change`
|
|
76
|
+
- `focus`
|
|
77
|
+
- `blur`
|
|
78
|
+
- `clear`
|
|
79
|
+
- `visible-change`
|
|
80
|
+
- `remove-tag`
|
|
81
|
+
- `popup-scroll`
|
|
82
|
+
|
|
83
|
+
## Import
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { FormSelect } from '@hinen/pro-element-plus';
|
|
87
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-switch
|
|
3
|
+
description: Use when a wrapped field should combine FormItem semantics with boolean or on-off switch behavior inside the Form* wrapper family.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormSwitch
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormSwitch` for a **boolean wrapped field** that combines `FormItem` behavior with Element Plus switch behavior.
|
|
11
|
+
|
|
12
|
+
It fits fields where the value is fundamentally on or off and the field should stay inside the shared form-wrapper family.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- a field represents enabled, disabled, or another binary state
|
|
17
|
+
- you want Element Plus switch behavior plus built-in `FormItem` label and validation handling
|
|
18
|
+
- active and inactive text or loading state are part of the field contract
|
|
19
|
+
- the field should expose both `formItem` and switch `field` refs together
|
|
20
|
+
|
|
21
|
+
## Prefer something else when
|
|
22
|
+
|
|
23
|
+
- the field should choose among named options instead of true or false
|
|
24
|
+
→ use `../using-form-radio-group/SKILL.md`
|
|
25
|
+
- the field should allow many checked values from a list
|
|
26
|
+
→ use `../using-form-checkbox-group/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 `FormSwitch` if the answer is yes for **two or more** of these:
|
|
33
|
+
|
|
34
|
+
- Is the value fundamentally boolean or binary?
|
|
35
|
+
- Should the UX be toggle-like rather than list-like?
|
|
36
|
+
- Should the field stay inside the shared form-wrapper family?
|
|
37
|
+
- Do you want wrapper validation access and switch instance access together?
|
|
38
|
+
|
|
39
|
+
If not, `FormRadioGroup`, `FormCheckboxGroup`, or another wrapper may fit better.
|
|
40
|
+
|
|
41
|
+
## Start with
|
|
42
|
+
|
|
43
|
+
1. Decide whether the value is truly boolean or just a small named-choice set.
|
|
44
|
+
2. Add the normal `FormItem` props such as `label`, `prop`, and `rules`.
|
|
45
|
+
3. Add switch-specific props such as loading, width, or active or inactive text after the wrapper choice is clear.
|
|
46
|
+
4. Move to radio or checkbox groups if the field is not really a toggle.
|
|
47
|
+
|
|
48
|
+
## Minimal patterns
|
|
49
|
+
|
|
50
|
+
### Standard wrapped switch
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<FormSwitch label="Enabled" prop="enabled" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Text-backed toggle
|
|
57
|
+
|
|
58
|
+
Use active and inactive text when the toggle should read as a product state rather than a raw boolean.
|
|
59
|
+
|
|
60
|
+
### Loading toggle
|
|
61
|
+
|
|
62
|
+
Use loading state when the toggle change triggers async work and the field should show that feedback directly.
|
|
63
|
+
|
|
64
|
+
## Common mistakes
|
|
65
|
+
|
|
66
|
+
- using `FormSwitch` for named choices that should be radios instead
|
|
67
|
+
- treating a switch like a multi-choice control
|
|
68
|
+
- forgetting that toggle semantics communicate binary state, not one-of-many selection
|
|
69
|
+
|
|
70
|
+
## Related skills
|
|
71
|
+
|
|
72
|
+
- Wrapper-family selection: `../using-form-fields/SKILL.md`
|
|
73
|
+
- Base wrapper only: `../using-form-item/SKILL.md`
|
|
74
|
+
- Wrapped radio group: `../using-form-radio-group/SKILL.md`
|
|
75
|
+
- Wrapped checkbox group: `../using-form-checkbox-group/SKILL.md`
|
|
76
|
+
|
|
77
|
+
## References
|
|
78
|
+
|
|
79
|
+
- Props: `./references/props.md`
|
|
80
|
+
- Examples: `./references/examples.md`
|
|
81
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# FormSwitch examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard boolean field
|
|
4
|
+
|
|
5
|
+
Use `FormSwitch` when the field stores a simple on or off state inside a wrapped form flow.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormSwitch label="Enabled" prop="enabled" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- enabled state
|
|
16
|
+
- publish toggle
|
|
17
|
+
- feature flag setting
|
|
18
|
+
|
|
19
|
+
## 2. Toggle with state labels
|
|
20
|
+
|
|
21
|
+
Use active and inactive text when the switch should read as a named product state.
|
|
22
|
+
|
|
23
|
+
Minimal pattern:
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<FormSwitch
|
|
27
|
+
label="Visibility"
|
|
28
|
+
prop="visible"
|
|
29
|
+
active-text="Visible"
|
|
30
|
+
inactive-text="Hidden"
|
|
31
|
+
/>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Typical fit:
|
|
35
|
+
|
|
36
|
+
- public versus private
|
|
37
|
+
- allow versus deny
|
|
38
|
+
- visible versus hidden
|
|
39
|
+
|
|
40
|
+
## 3. Async toggle flow
|
|
41
|
+
|
|
42
|
+
Use loading state when toggling should show in-progress feedback directly on the control.
|
|
43
|
+
|
|
44
|
+
Minimal pattern:
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<FormSwitch label="Sync" prop="syncEnabled" :loading="saving" />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Typical fit:
|
|
51
|
+
|
|
52
|
+
- settings save-on-toggle
|
|
53
|
+
- remote status updates
|
|
54
|
+
- permission toggles
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# FormSwitch gotchas
|
|
2
|
+
|
|
3
|
+
- Switches communicate binary state
|
|
4
|
+
If the user is choosing among named options, `../using-form-radio-group/SKILL.md` is usually clearer.
|
|
5
|
+
|
|
6
|
+
- Wrapper props and switch props are merged
|
|
7
|
+
Keep clear which behavior belongs to the form shell and which belongs to the toggle control.
|
|
8
|
+
|
|
9
|
+
- Loading and disabled state change the interaction contract
|
|
10
|
+
Treat them as part of the field behavior, not just visual polish.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# FormSwitch props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormSwitch` combines `FormItem` props with Element Plus switch props.
|
|
6
|
+
|
|
7
|
+
Use it when binary toggle behavior should stay inside the shared form-wrapper family.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
A minimal working setup is usually just:
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<FormSwitch label="Enabled" prop="enabled" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
That is enough when the field stores a true or false value inside a wrapped form flow.
|
|
18
|
+
|
|
19
|
+
Typical useful props:
|
|
20
|
+
|
|
21
|
+
- `label`
|
|
22
|
+
- `prop`
|
|
23
|
+
- `modelValue`
|
|
24
|
+
|
|
25
|
+
Common optional field props:
|
|
26
|
+
|
|
27
|
+
- `disabled`
|
|
28
|
+
- `loading`
|
|
29
|
+
- active or inactive text
|
|
30
|
+
|
|
31
|
+
## Core props
|
|
32
|
+
|
|
33
|
+
### Wrapper props from `FormItem`
|
|
34
|
+
|
|
35
|
+
Includes wrapper-level props such as:
|
|
36
|
+
|
|
37
|
+
- `label`
|
|
38
|
+
- `prop`
|
|
39
|
+
- `rules`
|
|
40
|
+
- `required`
|
|
41
|
+
- `tooltip`
|
|
42
|
+
|
|
43
|
+
### Common switch props
|
|
44
|
+
|
|
45
|
+
Useful field props include:
|
|
46
|
+
|
|
47
|
+
- `modelValue`
|
|
48
|
+
- `disabled`
|
|
49
|
+
- `loading`
|
|
50
|
+
- width and icon-related props
|
|
51
|
+
|
|
52
|
+
Treat `modelValue` as the real stored boolean value for the field, not just a visual state flag.
|
|
53
|
+
|
|
54
|
+
### Active and inactive presentation props
|
|
55
|
+
|
|
56
|
+
Use switch text and presentation props when the toggle should communicate explicit product states.
|
|
57
|
+
|
|
58
|
+
Reach for these only after the field is clearly a binary toggle rather than a radio-style named choice.
|
|
59
|
+
|
|
60
|
+
## Slots
|
|
61
|
+
|
|
62
|
+
Useful slots include wrapper-level `label` and `error`, plus switch action-content slots where custom active or inactive visuals matter.
|
|
63
|
+
|
|
64
|
+
## Instance API
|
|
65
|
+
|
|
66
|
+
The exposed instance combines:
|
|
67
|
+
|
|
68
|
+
- `formItem`
|
|
69
|
+
- `field`
|
|
70
|
+
|
|
71
|
+
## Events
|
|
72
|
+
|
|
73
|
+
Important events include:
|
|
74
|
+
|
|
75
|
+
- `update:modelValue`
|
|
76
|
+
- `change`
|
|
77
|
+
- `input`
|
|
78
|
+
|
|
79
|
+
## Import
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { FormSwitch } from '@hinen/pro-element-plus';
|
|
83
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-tag-input
|
|
3
|
+
description: Use when a wrapped field should combine FormItem semantics with editable freeform tag-list behavior inside the Form* wrapper family.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormTagInput
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormTagInput` for a **freeform tag-list wrapped field** that combines `FormItem` behavior with Element Plus input-tag behavior.
|
|
11
|
+
|
|
12
|
+
It fits fields where users should create, edit, remove, and possibly reorder arbitrary tag values while staying inside the shared form-wrapper family.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- a field collects multiple freeform tags instead of a fixed option list
|
|
17
|
+
- you want input-tag behavior plus built-in `FormItem` labels, rules, and help text
|
|
18
|
+
- max tag count, drag behavior, or custom tag rendering are part of the field contract
|
|
19
|
+
- the field should expose both `formItem` and tag-input `field` refs together
|
|
20
|
+
|
|
21
|
+
## Prefer something else when
|
|
22
|
+
|
|
23
|
+
- suggestions should drive the input experience
|
|
24
|
+
→ use `../using-form-autocomplete/SKILL.md`
|
|
25
|
+
- the choices come from a fixed select list
|
|
26
|
+
→ use `../using-form-select/SKILL.md`
|
|
27
|
+
- you only need one current text value instead of a tag collection
|
|
28
|
+
→ use `../using-form-text/SKILL.md`
|
|
29
|
+
|
|
30
|
+
## Decision guide
|
|
31
|
+
|
|
32
|
+
Use `FormTagInput` if the answer is yes for **two or more** of these:
|
|
33
|
+
|
|
34
|
+
- Should the field store many freeform tag values?
|
|
35
|
+
- Do users need to add or remove tags directly inside the control?
|
|
36
|
+
- Should the field stay inside the shared form-wrapper family?
|
|
37
|
+
- Do you want wrapper validation access and tag-input instance access together?
|
|
38
|
+
|
|
39
|
+
If not, `FormAutocomplete`, `FormSelect`, or another wrapper may fit better.
|
|
40
|
+
|
|
41
|
+
## Start with
|
|
42
|
+
|
|
43
|
+
1. Decide whether the field is freeform tags, a suggested single value, or a fixed choice set.
|
|
44
|
+
2. Add the normal `FormItem` props such as `label`, `prop`, and `rules`.
|
|
45
|
+
3. Add tag-input props such as `max`, `clearable`, or drag behavior after the wrapper choice is clear.
|
|
46
|
+
4. Use autocomplete or select wrappers instead if the field is not really a tag collection.
|
|
47
|
+
|
|
48
|
+
## Minimal patterns
|
|
49
|
+
|
|
50
|
+
### Standard wrapped tag input
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<FormTagInput label="Tags" prop="tags" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Max-tag or trigger-controlled input
|
|
57
|
+
|
|
58
|
+
Use props like `max` or `trigger` when the product flow constrains tag creation.
|
|
59
|
+
|
|
60
|
+
### Custom tag rendering
|
|
61
|
+
|
|
62
|
+
Use the `tag` slot when each tag needs richer visual treatment than the default tag shell.
|
|
63
|
+
|
|
64
|
+
## Common mistakes
|
|
65
|
+
|
|
66
|
+
- using `FormTagInput` when the field should really be one suggested value from autocomplete
|
|
67
|
+
- using it for a fixed option list that should be modeled as a select-style field
|
|
68
|
+
- forgetting that this field stores a list of values, not one current string
|
|
69
|
+
|
|
70
|
+
## Related skills
|
|
71
|
+
|
|
72
|
+
- Business-form workflow router: `../building-form-workflows/SKILL.md`
|
|
73
|
+
- Wrapper-family selection: `../using-form-fields/SKILL.md`
|
|
74
|
+
- Base wrapper only: `../using-form-item/SKILL.md`
|
|
75
|
+
- Wrapped autocomplete: `../using-form-autocomplete/SKILL.md`
|
|
76
|
+
- Wrapped local select: `../using-form-select/SKILL.md`
|
|
77
|
+
- Wrapped text field: `../using-form-text/SKILL.md`
|
|
78
|
+
|
|
79
|
+
## References
|
|
80
|
+
|
|
81
|
+
- Props: `./references/props.md`
|
|
82
|
+
- Examples: `./references/examples.md`
|
|
83
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# FormTagInput examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard freeform tag field
|
|
4
|
+
|
|
5
|
+
Use `FormTagInput` when users should add and remove many arbitrary values inside a wrapped form flow.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormTagInput label="Tags" prop="tags" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- labels
|
|
16
|
+
- keywords
|
|
17
|
+
- topics
|
|
18
|
+
|
|
19
|
+
## 2. Constrained tag entry
|
|
20
|
+
|
|
21
|
+
Use props like `max` or custom triggers when product rules constrain how tags are created.
|
|
22
|
+
|
|
23
|
+
Minimal pattern:
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<FormTagInput label="Keywords" prop="keywords" :max="5" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Typical fit:
|
|
30
|
+
|
|
31
|
+
- limited tag counts
|
|
32
|
+
- special separator triggers
|
|
33
|
+
- controlled metadata entry
|
|
34
|
+
|
|
35
|
+
## 3. Custom tag rendering
|
|
36
|
+
|
|
37
|
+
Use the `tag` slot when each tag should render with custom visuals or metadata.
|
|
38
|
+
|
|
39
|
+
Minimal pattern:
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<FormTagInput label="Labels" prop="labels">
|
|
43
|
+
<template #tag="{ item }">
|
|
44
|
+
<span>{{ item }}</span>
|
|
45
|
+
</template>
|
|
46
|
+
</FormTagInput>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Typical fit:
|
|
50
|
+
|
|
51
|
+
- colored tags
|
|
52
|
+
- tags with status indicators
|
|
53
|
+
- tags with branded treatment
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# FormTagInput gotchas
|
|
2
|
+
|
|
3
|
+
- `FormTagInput` stores a list of values
|
|
4
|
+
If the field should hold one current value with suggestions, use `../using-form-autocomplete/SKILL.md`.
|
|
5
|
+
|
|
6
|
+
- Freeform tags and fixed choices are different field contracts
|
|
7
|
+
If the option set is known, `../using-form-select/SKILL.md` is usually clearer.
|
|
8
|
+
|
|
9
|
+
- Wrapper props and input-tag props are merged
|
|
10
|
+
Keep clear which behavior belongs to the form shell and which belongs to tag-entry behavior.
|
|
11
|
+
|
|
12
|
+
- Tag count rules and uniqueness rules are part of field meaning
|
|
13
|
+
If max count, duplicate handling, or editing triggers matter, treat them as part of the field contract rather than as cosmetic tuning.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# FormTagInput props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormTagInput` combines `FormItem` props with Element Plus input-tag props.
|
|
6
|
+
|
|
7
|
+
Use it when editable tag-list behavior should stay inside the shared form-wrapper family.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
Typical useful props:
|
|
12
|
+
|
|
13
|
+
- `label`
|
|
14
|
+
- `prop`
|
|
15
|
+
- `modelValue`
|
|
16
|
+
|
|
17
|
+
Common optional field props:
|
|
18
|
+
|
|
19
|
+
- `max`
|
|
20
|
+
- `clearable`
|
|
21
|
+
- `draggable`
|
|
22
|
+
- `trigger`
|
|
23
|
+
|
|
24
|
+
## Core props
|
|
25
|
+
|
|
26
|
+
### Wrapper props from `FormItem`
|
|
27
|
+
|
|
28
|
+
Includes wrapper-level props such as:
|
|
29
|
+
|
|
30
|
+
- `label`
|
|
31
|
+
- `prop`
|
|
32
|
+
- `rules`
|
|
33
|
+
- `required`
|
|
34
|
+
- `tooltip`
|
|
35
|
+
|
|
36
|
+
### Common input-tag props
|
|
37
|
+
|
|
38
|
+
Useful field props include:
|
|
39
|
+
|
|
40
|
+
- `modelValue`
|
|
41
|
+
- `max`
|
|
42
|
+
- `min`
|
|
43
|
+
- uniqueness-related behavior
|
|
44
|
+
- `clearable`
|
|
45
|
+
- `draggable`
|
|
46
|
+
- `autofocus`
|
|
47
|
+
|
|
48
|
+
## Slots
|
|
49
|
+
|
|
50
|
+
Useful slots include wrapper-level `label` and `error`, plus tag-input slots such as:
|
|
51
|
+
|
|
52
|
+
- `tag`
|
|
53
|
+
- `prefix`
|
|
54
|
+
- `suffix`
|
|
55
|
+
|
|
56
|
+
## Instance API
|
|
57
|
+
|
|
58
|
+
The exposed instance combines:
|
|
59
|
+
|
|
60
|
+
- `formItem`
|
|
61
|
+
- `field`
|
|
62
|
+
|
|
63
|
+
## Events
|
|
64
|
+
|
|
65
|
+
Important events include:
|
|
66
|
+
|
|
67
|
+
- `update:modelValue`
|
|
68
|
+
- `change`
|
|
69
|
+
- `input`
|
|
70
|
+
- `focus`
|
|
71
|
+
- `blur`
|
|
72
|
+
- `clear`
|
|
73
|
+
- `remove-tag`
|
|
74
|
+
- `add-tag`
|
|
75
|
+
|
|
76
|
+
## Import
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { FormTagInput } from '@hinen/pro-element-plus';
|
|
80
|
+
```
|