@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,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-checkbox-group
|
|
3
|
+
description: Use when users should see several local options at once and pick any number of them without hiding the choices inside a dropdown or wrapper flow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using CheckboxGroup
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `CheckboxGroup` for a **visible multi-choice control** when users should see all options at once and select zero or more values.
|
|
11
|
+
|
|
12
|
+
It is the direct, non-wrapper counterpart to `../using-form-checkbox-group/SKILL.md`. Reach for it when the options are local, comparison matters, and the control does not need to live inside the `Form*` wrapper family.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
Use `CheckboxGroup` when several of these are true:
|
|
17
|
+
|
|
18
|
+
- multi-select choices should stay visible
|
|
19
|
+
- a simple local `options` array is enough
|
|
20
|
+
- checkbox semantics are clearer than a dropdown
|
|
21
|
+
- custom rendered checkbox options may help the UX
|
|
22
|
+
- the control does not need form-wrapper semantics
|
|
23
|
+
|
|
24
|
+
Strong signals this skill applies:
|
|
25
|
+
|
|
26
|
+
- permission sets
|
|
27
|
+
- preference groups
|
|
28
|
+
- visible multi-tag selection
|
|
29
|
+
- short local feature lists
|
|
30
|
+
|
|
31
|
+
## Prefer something else when
|
|
32
|
+
|
|
33
|
+
- the choice is single-select
|
|
34
|
+
→ use `../using-radio-group/SKILL.md`
|
|
35
|
+
- the same control belongs inside a form wrapper
|
|
36
|
+
→ use `../using-form-checkbox-group/SKILL.md`
|
|
37
|
+
- the option set is large enough that a dropdown is clearer
|
|
38
|
+
→ use `../using-select/SKILL.md`
|
|
39
|
+
|
|
40
|
+
## Decision guide
|
|
41
|
+
|
|
42
|
+
Use `CheckboxGroup` if the answer is yes for **two or more** of these:
|
|
43
|
+
|
|
44
|
+
- Should users be able to select many values from a fixed set?
|
|
45
|
+
- Does keeping all options visible improve comparison or understanding?
|
|
46
|
+
- Is the option set small and local enough for an `options` array?
|
|
47
|
+
- Is a direct component clearer than introducing a form wrapper?
|
|
48
|
+
|
|
49
|
+
If not, `RadioGroup`, `Select`, or a form-wrapper version may fit better.
|
|
50
|
+
|
|
51
|
+
## Start with
|
|
52
|
+
|
|
53
|
+
1. Confirm that the choice is truly many-of-many.
|
|
54
|
+
2. Model the local option list as `options`.
|
|
55
|
+
3. Use the default rendering first.
|
|
56
|
+
4. Reach for slot-based custom option rendering only when labels alone are not enough.
|
|
57
|
+
|
|
58
|
+
## Minimal patterns
|
|
59
|
+
|
|
60
|
+
### Standard local checkbox group
|
|
61
|
+
|
|
62
|
+
```vue
|
|
63
|
+
<CheckboxGroup :options="options" v-model="values" />
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Disabled option set
|
|
67
|
+
|
|
68
|
+
Use `disabled` or per-option `disabled` values when unavailable choices should stay visible but not selectable.
|
|
69
|
+
|
|
70
|
+
### Custom option rendering
|
|
71
|
+
|
|
72
|
+
Use the default slot when the option body should render as checkbox buttons or richer content instead of plain labels.
|
|
73
|
+
|
|
74
|
+
## Common mistakes
|
|
75
|
+
|
|
76
|
+
- using `CheckboxGroup` when only one value should be selected
|
|
77
|
+
- using visible checkboxes for long option lists that would be clearer as a select
|
|
78
|
+
- reaching for the direct component when the field really belongs in a wrapped form flow
|
|
79
|
+
- rebuilding the option body manually when the standard `options` shape already fits
|
|
80
|
+
|
|
81
|
+
## Related skills
|
|
82
|
+
|
|
83
|
+
- Visible single-choice counterpart: `../using-radio-group/SKILL.md`
|
|
84
|
+
- Wrapped multi-choice version: `../using-form-checkbox-group/SKILL.md`
|
|
85
|
+
- Dropdown alternative for larger local sets: `../using-select/SKILL.md`
|
|
86
|
+
|
|
87
|
+
## References
|
|
88
|
+
|
|
89
|
+
- Props: `./references/props.md`
|
|
90
|
+
- Examples: `./references/examples.md`
|
|
91
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# CheckboxGroup examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard visible multi-choice control
|
|
4
|
+
|
|
5
|
+
Use `CheckboxGroup` when users should choose zero or more values and comparing all options at once is useful.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<CheckboxGroup :options="permissionOptions" v-model="permissions" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- permission sets
|
|
16
|
+
- feature toggles by group
|
|
17
|
+
- preference clusters
|
|
18
|
+
|
|
19
|
+
## 2. Disabled options remain visible
|
|
20
|
+
|
|
21
|
+
Use disabled group or option state when unavailable choices should still be visible for context.
|
|
22
|
+
|
|
23
|
+
Minimal pattern:
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<CheckboxGroup :options="featureOptions" v-model="enabledFeatures" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Mark individual options disabled when users should still understand the full option set.
|
|
30
|
+
|
|
31
|
+
Typical fit:
|
|
32
|
+
|
|
33
|
+
- plan-restricted features
|
|
34
|
+
- permission-limited selections
|
|
35
|
+
- staged rollout options
|
|
36
|
+
|
|
37
|
+
## 3. Custom checkbox rendering
|
|
38
|
+
|
|
39
|
+
Use the default slot when the option body should render as checkbox buttons or richer custom UI.
|
|
40
|
+
|
|
41
|
+
Minimal pattern:
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<CheckboxGroup :options="filterOptions" v-model="selectedFilters">
|
|
45
|
+
<template #default="{ option }">
|
|
46
|
+
<span>{{ option.label }}</span>
|
|
47
|
+
</template>
|
|
48
|
+
</CheckboxGroup>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Typical fit:
|
|
52
|
+
|
|
53
|
+
- button-style multi-selects
|
|
54
|
+
- icon-backed choices
|
|
55
|
+
- grouped visible filters
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# CheckboxGroup gotchas
|
|
2
|
+
|
|
3
|
+
- `CheckboxGroup` is for many-of-many choice
|
|
4
|
+
If only one value can be selected, use `../using-radio-group/SKILL.md`.
|
|
5
|
+
|
|
6
|
+
- A true or false field is usually not a checkbox-group problem
|
|
7
|
+
If the feature is really one binary toggle, a switch-style control is usually clearer than a one-option checkbox group.
|
|
8
|
+
|
|
9
|
+
- Large option sets become noisy when always visible
|
|
10
|
+
If the list is too long, `../using-select/SKILL.md` is usually clearer.
|
|
11
|
+
|
|
12
|
+
- The direct component is not the form-wrapper version
|
|
13
|
+
If the control belongs in a wrapped schema or form flow, use `../using-form-checkbox-group/SKILL.md`.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# CheckboxGroup props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`CheckboxGroup` stays close to Element Plus checkbox-group behavior and adds a first-class local `options` prop.
|
|
6
|
+
|
|
7
|
+
Use it when many visible local choices should be rendered directly instead of through a dropdown.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
A minimal working setup is usually just:
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<CheckboxGroup :options="options" v-model="values" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
That is enough when the options are local and many values may be selected.
|
|
18
|
+
|
|
19
|
+
Typical useful props:
|
|
20
|
+
|
|
21
|
+
- `options`
|
|
22
|
+
- `modelValue`
|
|
23
|
+
|
|
24
|
+
Common optional props:
|
|
25
|
+
|
|
26
|
+
- `disabled`
|
|
27
|
+
- `size`
|
|
28
|
+
- `fill`
|
|
29
|
+
- `textColor`
|
|
30
|
+
|
|
31
|
+
## Core props
|
|
32
|
+
|
|
33
|
+
### `options`
|
|
34
|
+
|
|
35
|
+
The main local option source.
|
|
36
|
+
|
|
37
|
+
Each option uses the shape:
|
|
38
|
+
|
|
39
|
+
- `label`
|
|
40
|
+
- `value`
|
|
41
|
+
- optional `disabled`
|
|
42
|
+
|
|
43
|
+
This is the real required input in normal usage. Without `options`, the component has nothing to render unless you fully replace rendering through slots.
|
|
44
|
+
|
|
45
|
+
### `modelValue`
|
|
46
|
+
|
|
47
|
+
The selected values array.
|
|
48
|
+
|
|
49
|
+
Use this for the current many-of-many selection state.
|
|
50
|
+
|
|
51
|
+
Keep the array value shape aligned with the option `value` shape. Mismatched value types make the group look uncontrolled even when data exists.
|
|
52
|
+
|
|
53
|
+
### Group styling props
|
|
54
|
+
|
|
55
|
+
Useful inherited props include:
|
|
56
|
+
|
|
57
|
+
- `disabled`
|
|
58
|
+
- `size`
|
|
59
|
+
- `fill`
|
|
60
|
+
- `textColor`
|
|
61
|
+
|
|
62
|
+
These are secondary to getting the many-of-many state correct.
|
|
63
|
+
|
|
64
|
+
## Slots
|
|
65
|
+
|
|
66
|
+
Useful slots include the default slot receiving `{ options }`.
|
|
67
|
+
|
|
68
|
+
Use this when the option body should render as custom checkbox content instead of the built-in label rendering.
|
|
69
|
+
|
|
70
|
+
If you customize the slot heavily, keep the multi-select affordance obvious so the control still reads like a checkbox group instead of loose buttons.
|
|
71
|
+
|
|
72
|
+
## Events
|
|
73
|
+
|
|
74
|
+
Important events include:
|
|
75
|
+
|
|
76
|
+
- `update:modelValue`
|
|
77
|
+
- `change`
|
|
78
|
+
|
|
79
|
+
## Import
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { CheckboxGroup } from '@hinen/pro-element-plus';
|
|
83
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-config-provider
|
|
3
|
+
description: Use when a subtree of pro-element-plus components, especially DataTable instances, should share injected empty and error rendering defaults.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using ConfigProvider
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `ConfigProvider` to **inject shared pro-element-plus UI defaults into a subtree**, especially shared `DataTable` empty and error rendering.
|
|
11
|
+
|
|
12
|
+
In the current documented package surface, this component is mostly slot-based. It is not a broad global settings object. Its safest documented job is to let nearby `DataTable` instances share fallback UI without repeating the same local slot customization everywhere.
|
|
13
|
+
|
|
14
|
+
Package-level docs also hint at locale-oriented copy such as search, reset, and data-error wording, but this skill treats the clearly documented public contract as **subtree-scoped shared rendering and copy for downstream table consumers**, not a general application configuration layer.
|
|
15
|
+
|
|
16
|
+
## Use it when
|
|
17
|
+
|
|
18
|
+
Use `ConfigProvider` when several of these are true:
|
|
19
|
+
|
|
20
|
+
- multiple `DataTable` instances should share the same empty UI
|
|
21
|
+
- multiple `DataTable` instances should share the same error UI
|
|
22
|
+
- the customization belongs to one feature shell or page subtree
|
|
23
|
+
- local per-table slot repetition is starting to create noise
|
|
24
|
+
- you already know the page or feature is in the query/list family and want one shared fallback voice for nearby tables
|
|
25
|
+
|
|
26
|
+
Strong signals this skill applies:
|
|
27
|
+
|
|
28
|
+
- one module contains several list pages
|
|
29
|
+
- a feature wants standardized empty and error messaging
|
|
30
|
+
- a dashboard area should share the same list fallback visuals
|
|
31
|
+
- `building-query-pages` or `using-data-table` is already the right shell, and now the remaining question is how to share fallback rendering across sibling tables
|
|
32
|
+
|
|
33
|
+
## Prefer something else when
|
|
34
|
+
|
|
35
|
+
- the customization applies to only one table and can stay local there
|
|
36
|
+
- the component subtree does not actually contain `DataTable` consumers
|
|
37
|
+
- you need a broader application configuration system than this slot-based provider offers
|
|
38
|
+
- you only need `empty` or `error` content for one `DataTable`, because local slots are usually clearer than introducing a provider
|
|
39
|
+
|
|
40
|
+
## Decision guide
|
|
41
|
+
|
|
42
|
+
Use `ConfigProvider` if the answer is yes for **two or more** of these:
|
|
43
|
+
|
|
44
|
+
- Should several `DataTable` instances share the same fallback UI?
|
|
45
|
+
- Does the override belong to a subtree rather than every table individually?
|
|
46
|
+
- Would repeating `empty` and `error` slots across tables add noise?
|
|
47
|
+
- Is slot-based injection enough for the current feature?
|
|
48
|
+
|
|
49
|
+
If only one table needs the customization, keep the slots on that `DataTable` instead of adding a provider layer.
|
|
50
|
+
|
|
51
|
+
If the broader page shell is still undecided, route through `../building-query-pages/SKILL.md` first.
|
|
52
|
+
|
|
53
|
+
## Start with
|
|
54
|
+
|
|
55
|
+
1. Wrap the smallest feature subtree that should share fallback rendering.
|
|
56
|
+
2. Provide `dataTableEmpty` and/or `dataTableError` slots only when the defaults should change.
|
|
57
|
+
3. Keep table-specific special cases local if only one view needs them.
|
|
58
|
+
4. Treat locale-like shared copy as feature-scoped unless the package documents a broader stable contract.
|
|
59
|
+
|
|
60
|
+
## Minimal patterns
|
|
61
|
+
|
|
62
|
+
### Shared DataTable fallback shell
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<ConfigProvider>
|
|
66
|
+
<template #dataTableEmpty>
|
|
67
|
+
<EmptyState />
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<template #dataTableError>
|
|
71
|
+
<ErrorState />
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<FeatureTables />
|
|
75
|
+
</ConfigProvider>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Common mistakes
|
|
79
|
+
|
|
80
|
+
- assuming `ConfigProvider` exposes a rich prop API when the current public contract is slot-based
|
|
81
|
+
- wrapping too much of the tree when only one feature area needs the override
|
|
82
|
+
- using it without actual `DataTable` consumers in the subtree
|
|
83
|
+
- moving one-off table customizations here too early and losing local clarity
|
|
84
|
+
- choosing the provider before deciding whether the page even needs a shared query/list shell
|
|
85
|
+
- treating README capability hints as proof of a broad stable global-config API
|
|
86
|
+
|
|
87
|
+
## Related skills
|
|
88
|
+
|
|
89
|
+
- Query/list router that usually decides whether this provider is relevant at all: `../building-query-pages/SKILL.md`
|
|
90
|
+
- Page-level list shell that consumes shared empty and error UI: `../using-data-table/SKILL.md`
|
|
91
|
+
|
|
92
|
+
## References
|
|
93
|
+
|
|
94
|
+
- Props: `./references/props.md`
|
|
95
|
+
- Examples: `./references/examples.md`
|
|
96
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ConfigProvider examples
|
|
2
|
+
|
|
3
|
+
## 1. Shared table shell
|
|
4
|
+
|
|
5
|
+
Wrap a feature subtree with `ConfigProvider` when several `DataTable` instances should share fallback rendering.
|
|
6
|
+
|
|
7
|
+
Typical fit:
|
|
8
|
+
|
|
9
|
+
- one feature contains several list pages
|
|
10
|
+
- the same copy and visuals should appear across related empty states
|
|
11
|
+
- error rendering should stay consistent inside the module
|
|
12
|
+
|
|
13
|
+
Recommended pattern:
|
|
14
|
+
|
|
15
|
+
- wrap the feature boundary, not the whole app by default
|
|
16
|
+
- provide only the slots you need to override
|
|
17
|
+
|
|
18
|
+
## 2. App-section customization
|
|
19
|
+
|
|
20
|
+
Use it when the empty and error UI belongs to one part of the app rather than every table individually.
|
|
21
|
+
|
|
22
|
+
Typical fit:
|
|
23
|
+
|
|
24
|
+
- admin area tables share one style
|
|
25
|
+
- project area tables share another
|
|
26
|
+
- dashboard lists have their own fallback voice and visuals
|
|
27
|
+
|
|
28
|
+
This keeps `DataTable` usage local while centralizing the repeated fallback UI.
|
|
29
|
+
|
|
30
|
+
## 3. Local override remains local
|
|
31
|
+
|
|
32
|
+
Do **not** use `ConfigProvider` when only one table needs the customization.
|
|
33
|
+
|
|
34
|
+
Typical fit for staying local:
|
|
35
|
+
|
|
36
|
+
- one special report screen
|
|
37
|
+
- a single table with unique empty-state actions
|
|
38
|
+
- one-off product copy that should not spread to sibling views
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# ConfigProvider gotchas
|
|
2
|
+
|
|
3
|
+
- The current contract is slot-based, not prop-driven
|
|
4
|
+
Do not design around a large configuration object that the current component does not expose.
|
|
5
|
+
|
|
6
|
+
- Scope is the main decision
|
|
7
|
+
The sharp edge here is usually wrapping the wrong subtree, not passing the wrong prop.
|
|
8
|
+
|
|
9
|
+
- It is mainly about `DataTable` fallback rendering today
|
|
10
|
+
Do not overstate its role beyond the surfaces the current package actually wires up.
|
|
11
|
+
|
|
12
|
+
- Local one-off customization can be clearer
|
|
13
|
+
If only one table needs a custom empty or error state, a provider can add unnecessary indirection.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ConfigProvider props and slots
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`ConfigProvider` currently has **no meaningful public props**. The main contract is slot-based subtree configuration for downstream pro-element-plus consumers.
|
|
6
|
+
|
|
7
|
+
In the current code, the useful public surface is almost entirely about `DataTable` fallback rendering.
|
|
8
|
+
|
|
9
|
+
## Public surface
|
|
10
|
+
|
|
11
|
+
### Default slot
|
|
12
|
+
|
|
13
|
+
Wraps the child subtree that should receive the injected configuration.
|
|
14
|
+
|
|
15
|
+
### `dataTableError` slot
|
|
16
|
+
|
|
17
|
+
Provides shared custom error UI for `DataTable` consumers under this provider.
|
|
18
|
+
|
|
19
|
+
### `dataTableEmpty` slot
|
|
20
|
+
|
|
21
|
+
Provides shared custom empty UI for `DataTable` consumers under this provider.
|
|
22
|
+
|
|
23
|
+
## Provider behavior
|
|
24
|
+
|
|
25
|
+
The component injects slot-based renderers into the subtree through the internal config-provider context.
|
|
26
|
+
|
|
27
|
+
This means the main decision is not about prop shape. It is about **scope**: which subtree should share the fallback UI.
|
|
28
|
+
|
|
29
|
+
## Import
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { ConfigProvider } from '@hinen/pro-element-plus';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Notes
|
|
36
|
+
|
|
37
|
+
- There are no documented public props in the current package surface.
|
|
38
|
+
- The provider is useful mainly when a subtree contains `DataTable` consumers.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-data-select
|
|
3
|
+
description: Use when a select needs request-aware, param-driven, enum-driven, or filter-mode-aware option loading rather than a purely local option list.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using DataSelect
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `DataSelect` for a **dropdown whose option source may be remote, param-driven, or enum-driven** while still keeping a standard select shell.
|
|
11
|
+
|
|
12
|
+
It supports three valid source modes:
|
|
13
|
+
|
|
14
|
+
1. **Local options mode** — pass `options`
|
|
15
|
+
2. **Enum mode** — pass `valueEnum`
|
|
16
|
+
3. **Request mode** — pass `request`
|
|
17
|
+
|
|
18
|
+
It also supports two filtering models:
|
|
19
|
+
|
|
20
|
+
- local filtering with `filterable: true`
|
|
21
|
+
- remote filtering with `filterable: 'remote'`
|
|
22
|
+
|
|
23
|
+
Choose it when option loading behavior is part of the component decision, not just a data detail.
|
|
24
|
+
|
|
25
|
+
## Use it when
|
|
26
|
+
|
|
27
|
+
Use `DataSelect` when several of these are true:
|
|
28
|
+
|
|
29
|
+
- options may come from a request
|
|
30
|
+
- dropdown options should react to params or search content
|
|
31
|
+
- `valueEnum` is a convenient compact mapping for small choice sets
|
|
32
|
+
- local and remote filtering need to be expressed intentionally
|
|
33
|
+
- options may need dynamic disable logic through `disableOption`
|
|
34
|
+
|
|
35
|
+
Strong signals this skill applies:
|
|
36
|
+
|
|
37
|
+
- user lookup selects
|
|
38
|
+
- tenant or project selectors backed by the server
|
|
39
|
+
- filterable selects with changing option sets
|
|
40
|
+
- enum-backed status selectors that may later become remote
|
|
41
|
+
|
|
42
|
+
## Prefer something else when
|
|
43
|
+
|
|
44
|
+
- the choices are purely local and should stay simple
|
|
45
|
+
→ use `../using-select/SKILL.md`
|
|
46
|
+
- you need always-visible choices rather than a dropdown
|
|
47
|
+
→ use `../building-selection-inputs/SKILL.md`
|
|
48
|
+
- the field belongs inside a schema-driven wrapper flow and request behavior is not the main reason to choose the component
|
|
49
|
+
→ use `../using-form-select/SKILL.md`
|
|
50
|
+
- request behavior is irrelevant and a plain select wrapper already fits
|
|
51
|
+
|
|
52
|
+
## Decision guide
|
|
53
|
+
|
|
54
|
+
Use `DataSelect` if the answer is yes for **two or more** of these:
|
|
55
|
+
|
|
56
|
+
- Will the option source come from `request`, `params`, or `valueEnum`?
|
|
57
|
+
- Should filtering behavior change request execution or remote search state?
|
|
58
|
+
- Do options need dynamic disabling logic tied to current filter text?
|
|
59
|
+
- Is there a chance this control will move between local and remote option modes?
|
|
60
|
+
- Would a standardized request-aware select be better than hand-writing option-fetch logic?
|
|
61
|
+
|
|
62
|
+
If not, `Select` is usually the better fit.
|
|
63
|
+
|
|
64
|
+
If the control belongs inside a wrapped form flow, decide separately whether the wrapper boundary or the request-aware option source is the more important abstraction.
|
|
65
|
+
|
|
66
|
+
## Start with
|
|
67
|
+
|
|
68
|
+
1. Decide whether the source of truth is `options`, `valueEnum`, or `request`.
|
|
69
|
+
2. Choose local filtering or remote filtering intentionally.
|
|
70
|
+
3. Add `params` only when the option set truly depends on external state.
|
|
71
|
+
4. Tune debounce only after the request behavior feels correct.
|
|
72
|
+
5. If the same choice belongs in a `FormItem` workflow, compare this skill against `../using-form-select/SKILL.md` instead of assuming there is a one-to-one wrapped `DataSelect` counterpart.
|
|
73
|
+
|
|
74
|
+
## Minimal patterns
|
|
75
|
+
|
|
76
|
+
### Local options mode
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<DataSelect :options="options" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Enum mode
|
|
83
|
+
|
|
84
|
+
```vue
|
|
85
|
+
<DataSelect :value-enum="{ enabled: 'Enabled', disabled: 'Disabled' }" />
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Request mode
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const request = async (
|
|
92
|
+
filterContent?: string,
|
|
93
|
+
params?: Record<string, any>
|
|
94
|
+
) => {
|
|
95
|
+
return fetchUsers(filterContent, params);
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```vue
|
|
100
|
+
<DataSelect :request="request" :params="params" />
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Remote filtering mode
|
|
104
|
+
|
|
105
|
+
Use `filterable: 'remote'` when search text should drive the option source rather than local filtering.
|
|
106
|
+
|
|
107
|
+
## Common mistakes
|
|
108
|
+
|
|
109
|
+
- using `DataSelect` for purely local options that should just use `Select`
|
|
110
|
+
- treating `filterable: true` and `filterable: 'remote'` as the same mode
|
|
111
|
+
- passing both local options and expecting request behavior to still matter
|
|
112
|
+
- tuning debounce before validating the request contract
|
|
113
|
+
- forgetting that `disableOption` runs against the current option shape and filter content
|
|
114
|
+
- assuming remote mode uses Element Plus `remoteMethod`; this component manages its own request path instead
|
|
115
|
+
- assuming there is a dedicated wrapped `FormDataSelect` skill when the wrapper decision may still belong to `FormSelect`
|
|
116
|
+
|
|
117
|
+
## Related skills
|
|
118
|
+
|
|
119
|
+
- Local-only dropdown wrapper: `../using-select/SKILL.md`
|
|
120
|
+
- Wrapped select for schema-driven form flows: `../using-form-select/SKILL.md`
|
|
121
|
+
- General selection-pattern choice: `../building-selection-inputs/SKILL.md`
|
|
122
|
+
|
|
123
|
+
## References
|
|
124
|
+
|
|
125
|
+
- Props: `./references/props.md`
|
|
126
|
+
- Examples: `./references/examples.md`
|
|
127
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# DataSelect examples
|
|
2
|
+
|
|
3
|
+
## 1. Remote lookup select
|
|
4
|
+
|
|
5
|
+
Use `request` when the option list depends on backend search, user input, or page params.
|
|
6
|
+
|
|
7
|
+
Typical fit:
|
|
8
|
+
|
|
9
|
+
- user or member lookup
|
|
10
|
+
- project picker scoped by tenant
|
|
11
|
+
- select controls backed by a search endpoint
|
|
12
|
+
|
|
13
|
+
Recommended pattern:
|
|
14
|
+
|
|
15
|
+
- keep `options` undefined
|
|
16
|
+
- pass `request`
|
|
17
|
+
- add `params` only when the backend needs parent context
|
|
18
|
+
|
|
19
|
+
## 2. Local enum-backed select
|
|
20
|
+
|
|
21
|
+
Use `valueEnum` when a full `options` array would be unnecessary repetition.
|
|
22
|
+
|
|
23
|
+
Typical fit:
|
|
24
|
+
|
|
25
|
+
- status fields
|
|
26
|
+
- boolean-like mode selection
|
|
27
|
+
- small fixed choice sets that may still benefit from this component’s API shape
|
|
28
|
+
|
|
29
|
+
This keeps the configuration compact while preserving the same shell.
|
|
30
|
+
|
|
31
|
+
## 3. Local filterable multi-select
|
|
32
|
+
|
|
33
|
+
Use `filterable: true` with local options when the user needs to search within an already loaded option set.
|
|
34
|
+
|
|
35
|
+
Typical fit:
|
|
36
|
+
|
|
37
|
+
- tag-like multi-selects
|
|
38
|
+
- grouped local options
|
|
39
|
+
- client-side searchable lists
|
|
40
|
+
|
|
41
|
+
Prefer this over remote filtering when all options are already available.
|
|
42
|
+
|
|
43
|
+
## 4. Remote filtering workflow
|
|
44
|
+
|
|
45
|
+
Use `filterable: 'remote'` when search input should change the option source rather than just narrowing what is already loaded.
|
|
46
|
+
|
|
47
|
+
Typical fit:
|
|
48
|
+
|
|
49
|
+
- large remote datasets
|
|
50
|
+
- typeahead lookups
|
|
51
|
+
- backend-scoped search dropdowns
|
|
52
|
+
|
|
53
|
+
Recommended pattern:
|
|
54
|
+
|
|
55
|
+
- treat `search` as query state
|
|
56
|
+
- do not rely on `filterOption` in this mode
|
|
57
|
+
- tune debounce after measuring UX and request volume
|
|
58
|
+
|
|
59
|
+
## 5. Dynamic option disabling
|
|
60
|
+
|
|
61
|
+
Use `disableOption` when choices stay visible but should become unavailable under specific conditions.
|
|
62
|
+
|
|
63
|
+
Typical fit:
|
|
64
|
+
|
|
65
|
+
- options blocked by permission state
|
|
66
|
+
- options disabled for current filter context
|
|
67
|
+
- grouped choices with conditional availability
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# DataSelect gotchas
|
|
2
|
+
|
|
3
|
+
- `options` or `valueEnum` bypass request mode
|
|
4
|
+
If either is present, the component does not use `request` for the option source.
|
|
5
|
+
|
|
6
|
+
- `filterable: true` and `filterable: 'remote'` are different
|
|
7
|
+
Local filtering runs `filterOption`. Remote filtering skips local filtering and treats the search text as remote state.
|
|
8
|
+
|
|
9
|
+
- `filterOption` does not control remote filtering
|
|
10
|
+
In remote mode, changing `filterOption` will not change the filtering behavior you see.
|
|
11
|
+
|
|
12
|
+
- Debounce settings affect both UX and network load
|
|
13
|
+
Tune `debounceTime` and `debounceWaitTime` intentionally instead of guessing.
|
|
14
|
+
|
|
15
|
+
- Loading can come from two places
|
|
16
|
+
The final loading state combines external `loading` and the component’s internal request loading.
|
|
17
|
+
|
|
18
|
+
- Object values require `valueKey` awareness
|
|
19
|
+
If option values are objects, stable identity depends on the configured `valueKey`.
|