@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,13 @@
|
|
|
1
|
+
# FormCascadeSelect gotchas
|
|
2
|
+
|
|
3
|
+
- Cascader paths and tree nodes are different UX choices
|
|
4
|
+
Use `../using-form-tree-select/SKILL.md` when visible node semantics matter more than path traversal.
|
|
5
|
+
|
|
6
|
+
- Cascader `props` control major behavior
|
|
7
|
+
Expand trigger, strictness, multiple choice, and lazy loading are not minor details.
|
|
8
|
+
|
|
9
|
+
- A flat list should not become a fake hierarchy
|
|
10
|
+
If nesting is not part of the product model, `../using-form-select/SKILL.md` is usually clearer.
|
|
11
|
+
|
|
12
|
+
- Cascader `props` can change selection semantics, not just visuals
|
|
13
|
+
Multiple mode, strict checking, expand trigger, and lazy loading all affect what the field means and how users traverse it.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# FormCascadeSelect props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormCascadeSelect` combines `FormItem` props with Element Plus cascader props.
|
|
6
|
+
|
|
7
|
+
Use it when hierarchical path selection should stay inside the shared form-wrapper family.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
Typical useful props:
|
|
12
|
+
|
|
13
|
+
- `label`
|
|
14
|
+
- `prop`
|
|
15
|
+
- `options`
|
|
16
|
+
|
|
17
|
+
Common optional field props:
|
|
18
|
+
|
|
19
|
+
- `props`
|
|
20
|
+
- `filterable`
|
|
21
|
+
- `clearable`
|
|
22
|
+
|
|
23
|
+
## Core props
|
|
24
|
+
|
|
25
|
+
### Wrapper props from `FormItem`
|
|
26
|
+
|
|
27
|
+
Includes wrapper-level props such as:
|
|
28
|
+
|
|
29
|
+
- `label`
|
|
30
|
+
- `prop`
|
|
31
|
+
- `rules`
|
|
32
|
+
- `required`
|
|
33
|
+
- `tooltip`
|
|
34
|
+
|
|
35
|
+
### `options`
|
|
36
|
+
|
|
37
|
+
The hierarchical option source.
|
|
38
|
+
|
|
39
|
+
Use this when the full cascader tree is known up front.
|
|
40
|
+
|
|
41
|
+
### Cascader `props`
|
|
42
|
+
|
|
43
|
+
Use cascader configuration props to control:
|
|
44
|
+
|
|
45
|
+
- expand trigger
|
|
46
|
+
- multiple selection
|
|
47
|
+
- strict checking behavior
|
|
48
|
+
- lazy loading
|
|
49
|
+
|
|
50
|
+
### Common selection props
|
|
51
|
+
|
|
52
|
+
Useful field props include:
|
|
53
|
+
|
|
54
|
+
- `filterable`
|
|
55
|
+
- `clearable`
|
|
56
|
+
- `showAllLevels`
|
|
57
|
+
|
|
58
|
+
### `renderDefault`
|
|
59
|
+
|
|
60
|
+
A function that receives `{ node, data }` and returns VNode content for customizing cascader node display.
|
|
61
|
+
|
|
62
|
+
Use this when you cannot use the `default` slot (for example, in DataTable query forms rendered dynamically) but still need to customize how each cascader node appears.
|
|
63
|
+
|
|
64
|
+
**Signature:**
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
renderDefault?: (scope: {
|
|
68
|
+
node: CascaderNode;
|
|
69
|
+
data: CascaderOption;
|
|
70
|
+
}) => VNodeChild;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Example:**
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<FormCascadeSelect
|
|
77
|
+
label="Category"
|
|
78
|
+
prop="category"
|
|
79
|
+
:options="categoryOptions"
|
|
80
|
+
:render-default="({ node, data }) => (
|
|
81
|
+
<span>
|
|
82
|
+
{data.label}
|
|
83
|
+
{!node.isLeaf && ` (${data.children?.length || 0})`}
|
|
84
|
+
</span>
|
|
85
|
+
)"
|
|
86
|
+
/>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**When to use:**
|
|
90
|
+
|
|
91
|
+
- In DataTable query forms where slots cannot be passed via dynamic component rendering
|
|
92
|
+
- When you need programmatic control over node rendering
|
|
93
|
+
- When the render logic depends on external state that is easier to access in the parent component
|
|
94
|
+
|
|
95
|
+
**Note:** When both `renderDefault` prop and `default` slot are provided, the slot takes precedence.
|
|
96
|
+
|
|
97
|
+
## Slots
|
|
98
|
+
|
|
99
|
+
Useful slots include wrapper-level `label` and `error`, plus cascader node customization slots where richer node rendering is needed.
|
|
100
|
+
|
|
101
|
+
### `default` slot
|
|
102
|
+
|
|
103
|
+
Customize cascader node rendering via slot (preferred when possible):
|
|
104
|
+
|
|
105
|
+
```vue
|
|
106
|
+
<FormCascadeSelect label="Category" prop="category" :options="options">
|
|
107
|
+
<template #default="{ node, data }">
|
|
108
|
+
<span>{{ data.label }}</span>
|
|
109
|
+
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
|
110
|
+
</template>
|
|
111
|
+
</FormCascadeSelect>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Instance API
|
|
115
|
+
|
|
116
|
+
The exposed instance combines:
|
|
117
|
+
|
|
118
|
+
- `formItem`
|
|
119
|
+
- `field`
|
|
120
|
+
|
|
121
|
+
## Events
|
|
122
|
+
|
|
123
|
+
Important events include:
|
|
124
|
+
|
|
125
|
+
- `update:modelValue`
|
|
126
|
+
- `change`
|
|
127
|
+
- `focus`
|
|
128
|
+
- `blur`
|
|
129
|
+
- `clear`
|
|
130
|
+
- `expandChange`
|
|
131
|
+
- `removeTag`
|
|
132
|
+
- `visibleChange`
|
|
133
|
+
|
|
134
|
+
## Import
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { FormCascadeSelect } from '@hinen/pro-element-plus';
|
|
138
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-checkbox-group
|
|
3
|
+
description: Use when a wrapped field should combine FormItem semantics with multi-choice checkbox-group behavior inside the Form* wrapper family.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormCheckboxGroup
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormCheckboxGroup` for a **multi-choice wrapped field** that combines `FormItem` behavior with the package’s `CheckboxGroup` abstraction.
|
|
11
|
+
|
|
12
|
+
It fits fields where the user should pick zero or more values from a fixed set while staying inside the shared form-wrapper family.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- a field should capture multiple selected values from a fixed option set
|
|
17
|
+
- you want checkbox-group behavior plus form labels, rules, and tooltip support
|
|
18
|
+
- options can come from `options` or lightweight `valueEnum` mappings
|
|
19
|
+
- the field should expose both `formItem` and checkbox-group `field` refs together
|
|
20
|
+
|
|
21
|
+
## Prefer something else when
|
|
22
|
+
|
|
23
|
+
- you need the raw checkbox group component outside FormFields
|
|
24
|
+
→ use `../using-checkbox-group/SKILL.md`
|
|
25
|
+
- only one option should be selected
|
|
26
|
+
→ use `../using-form-radio-group/SKILL.md`
|
|
27
|
+
- the field is really a binary toggle
|
|
28
|
+
→ use `../using-form-switch/SKILL.md`
|
|
29
|
+
|
|
30
|
+
## Decision guide
|
|
31
|
+
|
|
32
|
+
Use `FormCheckboxGroup` if the answer is yes for **two or more** of these:
|
|
33
|
+
|
|
34
|
+
- Should the user be able to select many values from a fixed set?
|
|
35
|
+
- Is the option set local enough for `options` or `valueEnum`?
|
|
36
|
+
- Should the field stay inside the shared form-wrapper family?
|
|
37
|
+
- Do you want wrapper validation access and checkbox-group instance access together?
|
|
38
|
+
|
|
39
|
+
If not, `FormRadioGroup`, `FormSwitch`, or another wrapper may fit better.
|
|
40
|
+
|
|
41
|
+
## Start with
|
|
42
|
+
|
|
43
|
+
1. Decide whether the field is multi-choice, single-choice, or binary.
|
|
44
|
+
2. Add the normal `FormItem` props such as `label`, `prop`, and `rules`.
|
|
45
|
+
3. Choose `options` or `valueEnum` after the wrapper choice is clear.
|
|
46
|
+
4. Use radio groups or switches instead if the interaction is not really many-of-many.
|
|
47
|
+
|
|
48
|
+
## Minimal patterns
|
|
49
|
+
|
|
50
|
+
### Standard wrapped checkbox group
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<FormCheckboxGroup label="Permissions" prop="permissions" :options="options" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Enum-backed wrapped checkbox group
|
|
57
|
+
|
|
58
|
+
Use `valueEnum` when a compact mapping is clearer than an explicit options array.
|
|
59
|
+
|
|
60
|
+
### Custom checkbox rendering
|
|
61
|
+
|
|
62
|
+
Use slots when the option body should render as checkbox buttons or richer content.
|
|
63
|
+
|
|
64
|
+
## Common mistakes
|
|
65
|
+
|
|
66
|
+
- using `FormCheckboxGroup` when only one option should be chosen
|
|
67
|
+
- using it for a true or false toggle that should be a switch instead
|
|
68
|
+
- forgetting that `valueEnum` is converted into local options by the wrapper
|
|
69
|
+
|
|
70
|
+
## Related skills
|
|
71
|
+
|
|
72
|
+
- Selection-control router above this wrapped choice: `../building-selection-inputs/SKILL.md`
|
|
73
|
+
- Wrapper-family selection: `../using-form-fields/SKILL.md`
|
|
74
|
+
- Base wrapper only: `../using-form-item/SKILL.md`
|
|
75
|
+
- Raw checkbox group: `../using-checkbox-group/SKILL.md`
|
|
76
|
+
- Wrapped radio group: `../using-form-radio-group/SKILL.md`
|
|
77
|
+
- Wrapped switch: `../using-form-switch/SKILL.md`
|
|
78
|
+
|
|
79
|
+
## References
|
|
80
|
+
|
|
81
|
+
- Props: `./references/props.md`
|
|
82
|
+
- Examples: `./references/examples.md`
|
|
83
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# FormCheckboxGroup examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard many-of-many field
|
|
4
|
+
|
|
5
|
+
Use `FormCheckboxGroup` when a wrapped form field should allow many selected values from a fixed local set.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormCheckboxGroup
|
|
11
|
+
label="Permissions"
|
|
12
|
+
prop="permissions"
|
|
13
|
+
:options="permissionOptions"
|
|
14
|
+
/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Typical fit:
|
|
18
|
+
|
|
19
|
+
- permissions
|
|
20
|
+
- feature selection
|
|
21
|
+
- preference groups
|
|
22
|
+
|
|
23
|
+
## 2. Enum-backed checkbox field
|
|
24
|
+
|
|
25
|
+
Use `valueEnum` when a compact value-to-label mapping is clearer than an explicit options array.
|
|
26
|
+
|
|
27
|
+
Minimal pattern:
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<FormCheckboxGroup
|
|
31
|
+
label="Capabilities"
|
|
32
|
+
prop="capabilities"
|
|
33
|
+
:value-enum="capabilityEnum"
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Typical fit:
|
|
38
|
+
|
|
39
|
+
- admin toggles with several allowed flags
|
|
40
|
+
- small fixed capability sets
|
|
41
|
+
- compact settings groups
|
|
42
|
+
|
|
43
|
+
## 3. Custom checkbox rendering
|
|
44
|
+
|
|
45
|
+
Use slots when the option body should render as checkbox buttons or richer content.
|
|
46
|
+
|
|
47
|
+
Minimal pattern:
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<FormCheckboxGroup label="Features" prop="features" :options="featureOptions">
|
|
51
|
+
<template #default="{ option }">
|
|
52
|
+
<span>{{ option.label }}</span>
|
|
53
|
+
</template>
|
|
54
|
+
</FormCheckboxGroup>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Typical fit:
|
|
58
|
+
|
|
59
|
+
- button-style choices
|
|
60
|
+
- icon-backed options
|
|
61
|
+
- detailed option descriptions
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# FormCheckboxGroup gotchas
|
|
2
|
+
|
|
3
|
+
- Checkbox groups are for many-of-many choice
|
|
4
|
+
If only one value may be selected, use `../using-form-radio-group/SKILL.md`.
|
|
5
|
+
|
|
6
|
+
- A switch is often clearer for binary state
|
|
7
|
+
If the field is really just on or off, `../using-form-switch/SKILL.md` is usually a better fit.
|
|
8
|
+
|
|
9
|
+
- `valueEnum` becomes local options
|
|
10
|
+
It is a convenience input, not a separate remote option-loading mode.
|
|
11
|
+
|
|
12
|
+
- This wrapped field is still part of the selection family
|
|
13
|
+
If you are not yet sure whether the field should be radio, checkbox, select, or autocomplete, route back up through `../building-selection-inputs/SKILL.md` before locking into this wrapper.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# FormCheckboxGroup props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormCheckboxGroup` combines `FormItem` props with the package’s `CheckboxGroup` props and adds `valueEnum` as a compact option source.
|
|
6
|
+
|
|
7
|
+
Use it when many-of-many selection 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
|
+
<FormCheckboxGroup
|
|
15
|
+
label="Permissions"
|
|
16
|
+
prop="permissions"
|
|
17
|
+
:options="permissionOptions"
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That works because the wrapper already combines `FormItem` semantics with checkbox-group behavior.
|
|
22
|
+
|
|
23
|
+
Typical useful props:
|
|
24
|
+
|
|
25
|
+
- `label`
|
|
26
|
+
- `prop`
|
|
27
|
+
- one of `options` or `valueEnum`
|
|
28
|
+
|
|
29
|
+
## Core props
|
|
30
|
+
|
|
31
|
+
### Wrapper props from `FormItem`
|
|
32
|
+
|
|
33
|
+
Includes wrapper-level props such as:
|
|
34
|
+
|
|
35
|
+
- `label`
|
|
36
|
+
- `prop`
|
|
37
|
+
- `rules`
|
|
38
|
+
- `required`
|
|
39
|
+
- `tooltip`
|
|
40
|
+
|
|
41
|
+
`label` and `prop` are the minimum wrapper-level anchors in most schema-driven usage.
|
|
42
|
+
|
|
43
|
+
### Checkbox-group props
|
|
44
|
+
|
|
45
|
+
Useful field props include:
|
|
46
|
+
|
|
47
|
+
- `options`
|
|
48
|
+
- `modelValue`
|
|
49
|
+
- disabled-state and layout props from the wrapped checkbox-group abstraction
|
|
50
|
+
|
|
51
|
+
Use `options` for the normal local-choice case. Treat `modelValue` as the selected values array for the field, not as a visual-only helper.
|
|
52
|
+
|
|
53
|
+
### `valueEnum`
|
|
54
|
+
|
|
55
|
+
Compact mapping from value to label.
|
|
56
|
+
|
|
57
|
+
The wrapper converts this into local checkbox options when `options` is not provided.
|
|
58
|
+
|
|
59
|
+
Use either `options` or `valueEnum` as the option source of truth. `valueEnum` is a compact local mapping, not a remote-loading mode.
|
|
60
|
+
|
|
61
|
+
## Slots
|
|
62
|
+
|
|
63
|
+
Useful slots include wrapper-level `label` and `error`, plus checkbox option-rendering slots from the wrapped checkbox-group abstraction.
|
|
64
|
+
|
|
65
|
+
Reach for slots after the many-of-many field semantics are already correct.
|
|
66
|
+
|
|
67
|
+
## Instance API
|
|
68
|
+
|
|
69
|
+
The exposed instance combines:
|
|
70
|
+
|
|
71
|
+
- `formItem`
|
|
72
|
+
- `field`
|
|
73
|
+
|
|
74
|
+
## Events
|
|
75
|
+
|
|
76
|
+
Important events include:
|
|
77
|
+
|
|
78
|
+
- `update:modelValue`
|
|
79
|
+
- `change`
|
|
80
|
+
|
|
81
|
+
## Import
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { FormCheckboxGroup } from '@hinen/pro-element-plus';
|
|
85
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-date-picker
|
|
3
|
+
description: Use when a wrapped field should combine FormItem semantics with date, calendar, or date-range picking behavior inside the Form* wrapper family.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormDatePicker
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormDatePicker` for a **date-oriented wrapped field** that combines `FormItem` behavior with Element Plus date picker modes.
|
|
11
|
+
|
|
12
|
+
It fits fields where the value is date-like or range-like and the field should stay inside the same wrapper family as sibling text, number, and select fields.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- a field captures dates, weeks, months, years, or date ranges
|
|
17
|
+
- you want date-picker modes plus built-in `FormItem` labels and validation
|
|
18
|
+
- shortcuts, format configuration, or range behavior are part of the field contract
|
|
19
|
+
- the field should expose both `formItem` and date-picker `field` refs together
|
|
20
|
+
|
|
21
|
+
## Prefer something else when
|
|
22
|
+
|
|
23
|
+
- the field is time-only
|
|
24
|
+
→ use `../using-form-time-picker/SKILL.md`
|
|
25
|
+
- you only need wrapper behavior around custom content
|
|
26
|
+
→ use `../using-form-item/SKILL.md`
|
|
27
|
+
|
|
28
|
+
## Decision guide
|
|
29
|
+
|
|
30
|
+
Use `FormDatePicker` if the answer is yes for **two or more** of these:
|
|
31
|
+
|
|
32
|
+
- Is the stored value fundamentally date-like rather than time-only?
|
|
33
|
+
- Do date-picker modes or ranges matter to the normal interaction?
|
|
34
|
+
- Should the field stay inside the shared form-wrapper family?
|
|
35
|
+
- Do you want wrapper validation access and date-picker instance access together?
|
|
36
|
+
|
|
37
|
+
If not, `FormTimePicker` or another wrapper is probably a better fit.
|
|
38
|
+
|
|
39
|
+
## Start with
|
|
40
|
+
|
|
41
|
+
1. Decide whether the field is single-date, multi-date, or range-based.
|
|
42
|
+
2. Add the normal `FormItem` props such as `label`, `prop`, and `rules`.
|
|
43
|
+
3. Choose `type`, formatting, and shortcuts only after the wrapper choice is clear.
|
|
44
|
+
4. Use time-only wrappers instead if the value is not date-oriented.
|
|
45
|
+
|
|
46
|
+
## Minimal patterns
|
|
47
|
+
|
|
48
|
+
### Standard wrapped date field
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<FormDatePicker label="Due Date" prop="dueDate" type="date" />
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Date range field
|
|
55
|
+
|
|
56
|
+
Use `type="daterange"` when the field stores a start-and-end date range.
|
|
57
|
+
|
|
58
|
+
### Shortcut-driven date field
|
|
59
|
+
|
|
60
|
+
Use `shortcuts` when common date presets are part of the product flow.
|
|
61
|
+
|
|
62
|
+
## Common mistakes
|
|
63
|
+
|
|
64
|
+
- using `FormDatePicker` for time-only input
|
|
65
|
+
- forgetting that picker `type` changes the value shape and UX meaning
|
|
66
|
+
- mixing wrapper concerns and field concerns without deciding the date contract first
|
|
67
|
+
- manually composing `FormItem` and `ElDatePicker` when the standard wrapper already fits
|
|
68
|
+
|
|
69
|
+
## Related skills
|
|
70
|
+
|
|
71
|
+
- Wrapper-family selection: `../using-form-fields/SKILL.md`
|
|
72
|
+
- Base wrapper only: `../using-form-item/SKILL.md`
|
|
73
|
+
- Wrapped time picker: `../using-form-time-picker/SKILL.md`
|
|
74
|
+
|
|
75
|
+
## References
|
|
76
|
+
|
|
77
|
+
- Props: `./references/props.md`
|
|
78
|
+
- Examples: `./references/examples.md`
|
|
79
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# FormDatePicker examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard date field
|
|
4
|
+
|
|
5
|
+
Use `FormDatePicker` when the field stores a single date-like value inside a wrapped form flow.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormDatePicker label="Due Date" prop="dueDate" type="date" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- due date
|
|
16
|
+
- birthday
|
|
17
|
+
- publish date
|
|
18
|
+
|
|
19
|
+
## 2. Date range field
|
|
20
|
+
|
|
21
|
+
Use date-range modes when the field stores a start and end date together.
|
|
22
|
+
|
|
23
|
+
Minimal pattern:
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<FormDatePicker label="Active Range" prop="activeRange" type="daterange" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Typical fit:
|
|
30
|
+
|
|
31
|
+
- reporting windows
|
|
32
|
+
- booking periods
|
|
33
|
+
- active date ranges
|
|
34
|
+
|
|
35
|
+
## 3. Shortcut-backed date picking
|
|
36
|
+
|
|
37
|
+
Use `shortcuts` when common date presets are part of the intended workflow.
|
|
38
|
+
|
|
39
|
+
Minimal pattern:
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<FormDatePicker
|
|
43
|
+
label="Window"
|
|
44
|
+
prop="window"
|
|
45
|
+
type="daterange"
|
|
46
|
+
:shortcuts="shortcuts"
|
|
47
|
+
/>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Typical fit:
|
|
51
|
+
|
|
52
|
+
- today and yesterday
|
|
53
|
+
- last week
|
|
54
|
+
- last month
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# FormDatePicker gotchas
|
|
2
|
+
|
|
3
|
+
- `type` changes the UX and value shape
|
|
4
|
+
Decide the picker mode first instead of treating it like a minor prop.
|
|
5
|
+
|
|
6
|
+
- Date range and single date are different field contracts
|
|
7
|
+
Keep placeholders, formatting, and downstream value handling aligned with the chosen mode.
|
|
8
|
+
|
|
9
|
+
- Use `../using-form-time-picker/SKILL.md` for time-only fields
|
|
10
|
+
Date picking and time picking are related but different wrapper decisions.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# FormDatePicker props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormDatePicker` combines `FormItem` props with Element Plus date picker props.
|
|
6
|
+
|
|
7
|
+
Use it when date and range semantics should stay inside the shared form-wrapper family.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
Typical useful props:
|
|
12
|
+
|
|
13
|
+
- `label`
|
|
14
|
+
- `prop`
|
|
15
|
+
- `type`
|
|
16
|
+
|
|
17
|
+
Common optional field props:
|
|
18
|
+
|
|
19
|
+
- `format`
|
|
20
|
+
- `valueFormat`
|
|
21
|
+
- `shortcuts`
|
|
22
|
+
- range placeholders and separators
|
|
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
|
+
### `type`
|
|
37
|
+
|
|
38
|
+
The main date-mode selector.
|
|
39
|
+
|
|
40
|
+
Common modes include:
|
|
41
|
+
|
|
42
|
+
- `date`
|
|
43
|
+
- `dates`
|
|
44
|
+
- `week`
|
|
45
|
+
- `month`
|
|
46
|
+
- `months`
|
|
47
|
+
- `year`
|
|
48
|
+
- `years`
|
|
49
|
+
- `daterange`
|
|
50
|
+
- `monthrange`
|
|
51
|
+
- `yearrange`
|
|
52
|
+
|
|
53
|
+
### Formatting and default-value props
|
|
54
|
+
|
|
55
|
+
Useful field props include:
|
|
56
|
+
|
|
57
|
+
- `format`
|
|
58
|
+
- `valueFormat`
|
|
59
|
+
- `defaultValue`
|
|
60
|
+
- `shortcuts`
|
|
61
|
+
|
|
62
|
+
### Range-related props
|
|
63
|
+
|
|
64
|
+
Use range props when the field stores a start and end value:
|
|
65
|
+
|
|
66
|
+
- `rangeSeparator`
|
|
67
|
+
- `startPlaceholder`
|
|
68
|
+
- `endPlaceholder`
|
|
69
|
+
- `unlinkPanels`
|
|
70
|
+
|
|
71
|
+
## Slots
|
|
72
|
+
|
|
73
|
+
Useful slots include wrapper-level `label` and `error`, plus picker customization slots for icon and panel decoration.
|
|
74
|
+
|
|
75
|
+
## Instance API
|
|
76
|
+
|
|
77
|
+
The exposed instance combines:
|
|
78
|
+
|
|
79
|
+
- `formItem`
|
|
80
|
+
- `field`
|
|
81
|
+
|
|
82
|
+
## Events
|
|
83
|
+
|
|
84
|
+
Important events include:
|
|
85
|
+
|
|
86
|
+
- `update:modelValue`
|
|
87
|
+
- `change`
|
|
88
|
+
- `focus`
|
|
89
|
+
- `blur`
|
|
90
|
+
- `clear`
|
|
91
|
+
- `calendar-change`
|
|
92
|
+
- `panel-change`
|
|
93
|
+
- `visible-change`
|
|
94
|
+
|
|
95
|
+
## Import
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { FormDatePicker } from '@hinen/pro-element-plus';
|
|
99
|
+
```
|