@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,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-ellipsis-text
|
|
3
|
+
description: Use when long content must be truncated cleanly while still exposing the full value through the built-in tooltip behavior.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using EllipsisText
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `EllipsisText` for a **truncation-plus-tooltip primitive** that detects overflow and only exposes a tooltip when the content is actually clipped.
|
|
11
|
+
|
|
12
|
+
It is strongest when the UI regularly constrains text width or line count and users still need a reliable way to access the full value without custom overflow logic. By default it already gives you single-line truncation, and it keeps the overflow state in sync when content or container size changes.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
Use `EllipsisText` when several of these are true:
|
|
17
|
+
|
|
18
|
+
- text regularly overflows constrained layouts
|
|
19
|
+
- one-line or multi-line truncation is part of the design
|
|
20
|
+
- a tooltip should reveal the full value
|
|
21
|
+
- the wrapper element should stay configurable
|
|
22
|
+
- you want overflow detection to react to resize or content changes
|
|
23
|
+
|
|
24
|
+
Strong signals this skill applies:
|
|
25
|
+
|
|
26
|
+
- table cells
|
|
27
|
+
- card metadata rows
|
|
28
|
+
- dense admin layouts
|
|
29
|
+
- mixed inline text with variable length
|
|
30
|
+
|
|
31
|
+
## Prefer something else when
|
|
32
|
+
|
|
33
|
+
- the main problem is image loading or preview rather than text overflow
|
|
34
|
+
→ use `../using-image/SKILL.md`
|
|
35
|
+
- plain CSS truncation is sufficient and tooltip access to the full value does not matter
|
|
36
|
+
|
|
37
|
+
## Decision guide
|
|
38
|
+
|
|
39
|
+
Use `EllipsisText` if the answer is yes for **two or more** of these:
|
|
40
|
+
|
|
41
|
+
- Will the content often overflow its container?
|
|
42
|
+
- Should the full value be accessible through a built-in tooltip?
|
|
43
|
+
- Do you need single-line or multi-line truncation without writing custom overflow observers?
|
|
44
|
+
- Should the component react correctly when content or layout size changes?
|
|
45
|
+
|
|
46
|
+
If not, plain text or simple CSS truncation may be enough.
|
|
47
|
+
|
|
48
|
+
## Start with
|
|
49
|
+
|
|
50
|
+
1. Start with the default single-line mode; you do not need to pass `truncated` unless you want to be explicit.
|
|
51
|
+
2. Make sure the rendered element actually has a constrained width or line count, otherwise no overflow will happen.
|
|
52
|
+
3. Set the wrapper `tag` if inline versus block semantics matter.
|
|
53
|
+
4. Switch to `lineClamp` only when the design intentionally allows multiple visible lines.
|
|
54
|
+
5. Override tooltip props only when the default reveal behavior is not enough.
|
|
55
|
+
|
|
56
|
+
## Minimal patterns
|
|
57
|
+
|
|
58
|
+
### Standard single-line truncation
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<EllipsisText class="w-300px">{{ text }}</EllipsisText>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This is the smallest correct setup when one line is enough. `truncated` already defaults to `true`.
|
|
65
|
+
|
|
66
|
+
### Multi-line clamp
|
|
67
|
+
|
|
68
|
+
Use `lineClamp` when the design should allow a fixed number of visible lines instead of a single-line ellipsis.
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<EllipsisText tag="div" class="w-300px" :line-clamp="3">
|
|
72
|
+
{{ text }}
|
|
73
|
+
</EllipsisText>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
When `lineClamp` is a positive number, it becomes the active truncation mode and takes precedence over the default single-line behavior.
|
|
77
|
+
|
|
78
|
+
### Custom tooltip content
|
|
79
|
+
|
|
80
|
+
Use `tooltip` when the revealed content should differ from the raw rendered text.
|
|
81
|
+
|
|
82
|
+
```vue
|
|
83
|
+
<EllipsisText class="w-300px" tooltip="Normalized full value">
|
|
84
|
+
{{ shortLabel }}
|
|
85
|
+
</EllipsisText>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Common mistakes
|
|
89
|
+
|
|
90
|
+
- assuming `lineClamp` and single-line truncation are the same strategy or combine visually
|
|
91
|
+
- using the component when tooltip access to the full value is unnecessary
|
|
92
|
+
- forgetting that overflow only happens when the surrounding layout actually constrains the text
|
|
93
|
+
- expecting the tooltip to open even when `disabled` is set or the text is fully visible
|
|
94
|
+
- forgetting that the displayed tag can change layout semantics
|
|
95
|
+
- styling the container in a way that prevents the truncation mode from making sense
|
|
96
|
+
|
|
97
|
+
## Related skills
|
|
98
|
+
|
|
99
|
+
- Media primitive with different loading and error concerns: `../using-image/SKILL.md`
|
|
100
|
+
|
|
101
|
+
## References
|
|
102
|
+
|
|
103
|
+
- Props: `./references/props.md`
|
|
104
|
+
- Examples: `./references/examples.md`
|
|
105
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# EllipsisText examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard single-line truncation
|
|
4
|
+
|
|
5
|
+
Use `EllipsisText` when dense layouts need one-line truncation with access to the full value on hover or trigger.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<EllipsisText class="w-300px">{{ row.name }}</EllipsisText>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Why this is enough:
|
|
14
|
+
|
|
15
|
+
- single-line truncation is already on by default
|
|
16
|
+
- the tooltip uses the rendered text by default
|
|
17
|
+
- only the width constraint has to come from your layout
|
|
18
|
+
|
|
19
|
+
Typical fit:
|
|
20
|
+
|
|
21
|
+
- table cells
|
|
22
|
+
- inline metadata
|
|
23
|
+
- list rows with narrow columns
|
|
24
|
+
|
|
25
|
+
## 2. Multi-line clamp
|
|
26
|
+
|
|
27
|
+
Use `lineClamp` when the design allows a fixed number of visible lines before truncation.
|
|
28
|
+
|
|
29
|
+
Minimal pattern:
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<EllipsisText tag="div" class="w-300px" :line-clamp="3">
|
|
33
|
+
{{ description }}
|
|
34
|
+
</EllipsisText>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use a block-like tag when the surrounding layout should behave like a block container.
|
|
38
|
+
|
|
39
|
+
Typical fit:
|
|
40
|
+
|
|
41
|
+
- card descriptions
|
|
42
|
+
- feed previews
|
|
43
|
+
- constrained summary blocks
|
|
44
|
+
|
|
45
|
+
## 3. Custom tooltip content
|
|
46
|
+
|
|
47
|
+
Use `tooltip` when the revealed content should differ from the raw rendered text.
|
|
48
|
+
|
|
49
|
+
Minimal pattern:
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<EllipsisText class="w-300px" :tooltip="fullLabel">
|
|
53
|
+
{{ shortLabel }}
|
|
54
|
+
</EllipsisText>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Typical fit:
|
|
58
|
+
|
|
59
|
+
- normalized full values
|
|
60
|
+
- translated explanatory copy
|
|
61
|
+
- alternate long-form text for abbreviated display
|
|
62
|
+
|
|
63
|
+
## 4. Dynamic content that changes after render
|
|
64
|
+
|
|
65
|
+
This still fits `EllipsisText` when the visible text can change after mount and you want the overflow-aware tooltip state to stay correct.
|
|
66
|
+
|
|
67
|
+
Typical fit:
|
|
68
|
+
|
|
69
|
+
- cells that refresh after a request
|
|
70
|
+
- toggled tag or badge content
|
|
71
|
+
- responsive layouts that resize with the page
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# EllipsisText gotchas
|
|
2
|
+
|
|
3
|
+
- Tooltip behavior is part of the component contract
|
|
4
|
+
If tooltip access to the full value does not matter, plain truncation may be enough.
|
|
5
|
+
|
|
6
|
+
- `lineClamp` uses a different truncation strategy than single-line ellipsis
|
|
7
|
+
Choose the mode intentionally instead of treating them as interchangeable. When `lineClamp` is active, it takes precedence over the default single-line mode.
|
|
8
|
+
|
|
9
|
+
- Tooltip visibility depends on actual overflow
|
|
10
|
+
If the text is fully visible, the tooltip stays disabled.
|
|
11
|
+
|
|
12
|
+
- `disabled` turns off tooltip reveal, not truncation itself
|
|
13
|
+
Use it when the text should still be clipped visually but should not open the tooltip.
|
|
14
|
+
|
|
15
|
+
- Layout constraints are still required
|
|
16
|
+
`EllipsisText` does not create overflow on its own; the surrounding width or line budget must make truncation possible.
|
|
17
|
+
|
|
18
|
+
- The wrapper `tag` affects layout semantics
|
|
19
|
+
Inline versus block rendering can change how truncation behaves in the surrounding layout.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# EllipsisText props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`EllipsisText` combines truncation behavior with built-in tooltip handling and overflow detection.
|
|
6
|
+
|
|
7
|
+
Use it when overflow-aware reveal behavior matters more than plain text rendering.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
A minimal working setup is usually just:
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<EllipsisText class="w-300px">{{ text }}</EllipsisText>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
That works because:
|
|
18
|
+
|
|
19
|
+
- `truncated` defaults to `true`
|
|
20
|
+
- `tag` defaults to `span`
|
|
21
|
+
- the tooltip uses the rendered text content by default
|
|
22
|
+
|
|
23
|
+
You only need more props when the default single-line mode is not enough.
|
|
24
|
+
|
|
25
|
+
Typical useful props:
|
|
26
|
+
|
|
27
|
+
- `truncated`
|
|
28
|
+
- or `lineClamp`
|
|
29
|
+
|
|
30
|
+
Common optional props:
|
|
31
|
+
|
|
32
|
+
- `tag`
|
|
33
|
+
- `tooltip`
|
|
34
|
+
- tooltip behavior props inherited from `Tooltip`
|
|
35
|
+
|
|
36
|
+
## Core props
|
|
37
|
+
|
|
38
|
+
### `truncated`
|
|
39
|
+
|
|
40
|
+
Enables single-line truncation.
|
|
41
|
+
|
|
42
|
+
Default: `true`
|
|
43
|
+
|
|
44
|
+
### `lineClamp`
|
|
45
|
+
|
|
46
|
+
Enables multi-line truncation.
|
|
47
|
+
|
|
48
|
+
Use this when the design allows more than one visible line.
|
|
49
|
+
|
|
50
|
+
Default: `false`
|
|
51
|
+
|
|
52
|
+
When `lineClamp` is a positive number, the component uses multi-line clamping and the single-line `truncated` class no longer applies.
|
|
53
|
+
|
|
54
|
+
### `tag`
|
|
55
|
+
|
|
56
|
+
Controls the wrapper element.
|
|
57
|
+
|
|
58
|
+
Default: `span`
|
|
59
|
+
|
|
60
|
+
### `tooltip`
|
|
61
|
+
|
|
62
|
+
Overrides the tooltip content.
|
|
63
|
+
|
|
64
|
+
If not provided, the component falls back to the rendered text content.
|
|
65
|
+
|
|
66
|
+
### `disabled`
|
|
67
|
+
|
|
68
|
+
Disables the tooltip even if the text is overflowed.
|
|
69
|
+
|
|
70
|
+
This affects tooltip visibility, not the truncation styles themselves.
|
|
71
|
+
|
|
72
|
+
### Tooltip behavior props
|
|
73
|
+
|
|
74
|
+
Useful inherited props include:
|
|
75
|
+
|
|
76
|
+
- `trigger`
|
|
77
|
+
- `placement`
|
|
78
|
+
- `effect`
|
|
79
|
+
- `showAfter`
|
|
80
|
+
- `showArrow`
|
|
81
|
+
- `hideAfter`
|
|
82
|
+
- `enterable`
|
|
83
|
+
- `teleported`
|
|
84
|
+
|
|
85
|
+
## Behavior notes
|
|
86
|
+
|
|
87
|
+
The tooltip is disabled when the text is fully visible or when the component is explicitly disabled.
|
|
88
|
+
|
|
89
|
+
The overflow state updates when content or size changes, so slot content that changes after render can still produce the correct tooltip behavior.
|
|
90
|
+
|
|
91
|
+
If you pass both `truncated` and `lineClamp`, treat `lineClamp` as the active mode.
|
|
92
|
+
|
|
93
|
+
## Import
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { EllipsisText } from '@hinen/pro-element-plus';
|
|
97
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-autocomplete
|
|
3
|
+
description: Use when a wrapped field should combine FormItem semantics with callback-driven autocomplete suggestions inside the Form* wrapper family.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormAutocomplete
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormAutocomplete` for a **suggestion-driven wrapped field** that combines `FormItem` behavior with Element Plus autocomplete input behavior.
|
|
11
|
+
|
|
12
|
+
It fits fields where typing should trigger suggestions or completions, but the field still needs to live inside the shared `Form*` wrapper family with standard label, validation, and tooltip behavior.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- a field should suggest options while typing
|
|
17
|
+
- callback-driven suggestions are part of the core field behavior
|
|
18
|
+
- you want autocomplete behavior plus built-in `FormItem` labels, rules, and help text
|
|
19
|
+
- the field should expose both `formItem` and autocomplete `field` refs together
|
|
20
|
+
|
|
21
|
+
## Prefer something else when
|
|
22
|
+
|
|
23
|
+
- the option set is already known and select-style UI fits better
|
|
24
|
+
→ use `../using-form-select/SKILL.md`
|
|
25
|
+
- the field should collect freeform tags instead of one current text value
|
|
26
|
+
→ use `../using-form-tag-input/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 `FormAutocomplete` if the answer is yes for **two or more** of these:
|
|
33
|
+
|
|
34
|
+
- Should typing actively drive suggestions?
|
|
35
|
+
- Is the suggestion source callback-based rather than a fixed local option list?
|
|
36
|
+
- Should the field stay inside the shared form-wrapper family?
|
|
37
|
+
- Do you want wrapper validation access and autocomplete instance access together?
|
|
38
|
+
|
|
39
|
+
If not, `FormSelect`, `FormTagInput`, or another wrapper may fit better.
|
|
40
|
+
|
|
41
|
+
## Start with
|
|
42
|
+
|
|
43
|
+
1. Decide what the text value represents and how suggestions should be fetched.
|
|
44
|
+
2. Add the normal `FormItem` props such as `label`, `prop`, and `rules`.
|
|
45
|
+
3. Add `fetchSuggestions` and related autocomplete props only after the wrapper choice is clear.
|
|
46
|
+
4. Use slots only when the default suggestion row is not enough.
|
|
47
|
+
|
|
48
|
+
## Minimal patterns
|
|
49
|
+
|
|
50
|
+
### Standard wrapped autocomplete
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<FormAutocomplete
|
|
54
|
+
label="Repository"
|
|
55
|
+
prop="repo"
|
|
56
|
+
:fetch-suggestions="fetchSuggestions"
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Suggest only after typing
|
|
61
|
+
|
|
62
|
+
Use `triggerOnFocus="false"` when suggestions should wait for input instead of opening immediately on focus.
|
|
63
|
+
|
|
64
|
+
### Custom suggestion row
|
|
65
|
+
|
|
66
|
+
Use the default suggestion slot when each suggestion needs richer content than plain text.
|
|
67
|
+
|
|
68
|
+
## Common mistakes
|
|
69
|
+
|
|
70
|
+
- using `FormAutocomplete` when a fixed local choice list should just use `FormSelect`
|
|
71
|
+
- treating autocomplete like a multi-tag input when the field only stores one current value
|
|
72
|
+
- forgetting that suggestion behavior depends on `fetchSuggestions`, not a local `options` prop
|
|
73
|
+
- reaching for manual `FormItem` plus autocomplete composition when the standard wrapper already fits
|
|
74
|
+
|
|
75
|
+
## Related skills
|
|
76
|
+
|
|
77
|
+
- Selection-control router when autocomplete is still one candidate among several choice patterns: `../building-selection-inputs/SKILL.md`
|
|
78
|
+
- Wrapper-family selection: `../using-form-fields/SKILL.md`
|
|
79
|
+
- Base wrapper only: `../using-form-item/SKILL.md`
|
|
80
|
+
- Wrapped local select: `../using-form-select/SKILL.md`
|
|
81
|
+
- Wrapped tag list input: `../using-form-tag-input/SKILL.md`
|
|
82
|
+
|
|
83
|
+
## References
|
|
84
|
+
|
|
85
|
+
- Props: `./references/props.md`
|
|
86
|
+
- Examples: `./references/examples.md`
|
|
87
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# FormAutocomplete examples
|
|
2
|
+
|
|
3
|
+
## 1. Suggestion-driven text field
|
|
4
|
+
|
|
5
|
+
Use `FormAutocomplete` when typing should surface likely matches while the field still behaves like one wrapped text value.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormAutocomplete
|
|
11
|
+
label="Repository"
|
|
12
|
+
prop="repo"
|
|
13
|
+
:fetch-suggestions="fetchSuggestions"
|
|
14
|
+
/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Typical fit:
|
|
18
|
+
|
|
19
|
+
- repository lookup
|
|
20
|
+
- city suggestions
|
|
21
|
+
- account or member search terms
|
|
22
|
+
|
|
23
|
+
## 2. Suggestions after typing begins
|
|
24
|
+
|
|
25
|
+
Use `triggerOnFocus="false"` when the field should stay quiet on focus and only suggest after the user types.
|
|
26
|
+
|
|
27
|
+
Minimal pattern:
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<FormAutocomplete
|
|
31
|
+
label="Member"
|
|
32
|
+
prop="member"
|
|
33
|
+
:fetch-suggestions="fetchMembers"
|
|
34
|
+
:trigger-on-focus="false"
|
|
35
|
+
/>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Typical fit:
|
|
39
|
+
|
|
40
|
+
- large suggestion spaces
|
|
41
|
+
- expensive lookup callbacks
|
|
42
|
+
- search-like field behavior
|
|
43
|
+
|
|
44
|
+
## 3. Custom suggestion rendering
|
|
45
|
+
|
|
46
|
+
Use the suggestion-row slot when each result needs more context than a single label.
|
|
47
|
+
|
|
48
|
+
Minimal pattern:
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<FormAutocomplete label="Package" prop="pkg" :fetch-suggestions="fetchPackages">
|
|
52
|
+
<template #default="{ item }">
|
|
53
|
+
<span>{{ item.label }}</span>
|
|
54
|
+
</template>
|
|
55
|
+
</FormAutocomplete>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Typical fit:
|
|
59
|
+
|
|
60
|
+
- label plus metadata
|
|
61
|
+
- title plus URL
|
|
62
|
+
- name plus secondary description
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# FormAutocomplete gotchas
|
|
2
|
+
|
|
3
|
+
- `FormAutocomplete` is suggestion-driven, not option-list-driven
|
|
4
|
+
If the option set is already known, `../using-form-select/SKILL.md` is usually clearer.
|
|
5
|
+
|
|
6
|
+
- The field still stores one current value
|
|
7
|
+
If the feature needs many freeform entries, prefer `../using-form-tag-input/SKILL.md`.
|
|
8
|
+
|
|
9
|
+
- Wrapper props and autocomplete props are merged
|
|
10
|
+
Keep clear which behavior belongs to the form shell and which belongs to the suggestion input.
|
|
11
|
+
|
|
12
|
+
- `fetchSuggestions` is the core behavior, not an enhancement
|
|
13
|
+
If the field does not really need callback-driven suggestions, autocomplete adds complexity where a local select or text field would be clearer.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# FormAutocomplete props
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`FormAutocomplete` combines `FormItem` props with Element Plus autocomplete props.
|
|
6
|
+
|
|
7
|
+
Use it when callback-driven suggestions should live inside the shared form-wrapper family.
|
|
8
|
+
|
|
9
|
+
## Minimum setup
|
|
10
|
+
|
|
11
|
+
A minimal working setup is usually just:
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<FormAutocomplete
|
|
15
|
+
label="Repository"
|
|
16
|
+
prop="repo"
|
|
17
|
+
:fetch-suggestions="fetchSuggestions"
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That is enough when callback-driven suggestions are the real reason to use the field.
|
|
22
|
+
|
|
23
|
+
Typical useful props:
|
|
24
|
+
|
|
25
|
+
- `label`
|
|
26
|
+
- `prop`
|
|
27
|
+
- `modelValue`
|
|
28
|
+
- `fetchSuggestions`
|
|
29
|
+
|
|
30
|
+
Common optional field props:
|
|
31
|
+
|
|
32
|
+
- `triggerOnFocus`
|
|
33
|
+
- `placeholder`
|
|
34
|
+
- `readonly`
|
|
35
|
+
|
|
36
|
+
## Core props
|
|
37
|
+
|
|
38
|
+
### Wrapper props from `FormItem`
|
|
39
|
+
|
|
40
|
+
Includes wrapper-level props such as:
|
|
41
|
+
|
|
42
|
+
- `label`
|
|
43
|
+
- `prop`
|
|
44
|
+
- `rules`
|
|
45
|
+
- `required`
|
|
46
|
+
- `tooltip`
|
|
47
|
+
|
|
48
|
+
### `fetchSuggestions`
|
|
49
|
+
|
|
50
|
+
The main autocomplete hook.
|
|
51
|
+
|
|
52
|
+
Use this to provide callback-driven suggestions from local logic or async-backed lookup code.
|
|
53
|
+
|
|
54
|
+
This is the real required behavior prop in normal usage. If suggestion fetching is not central, the field usually wants `FormSelect` or `FormText` instead.
|
|
55
|
+
|
|
56
|
+
### Common autocomplete props
|
|
57
|
+
|
|
58
|
+
Useful field props include:
|
|
59
|
+
|
|
60
|
+
- `modelValue`
|
|
61
|
+
- `triggerOnFocus`
|
|
62
|
+
- `placeholder`
|
|
63
|
+
- `readonly`
|
|
64
|
+
|
|
65
|
+
`triggerOnFocus` is one of the first behavior props to check because it changes whether the field feels like proactive suggestion or search-after-typing.
|
|
66
|
+
|
|
67
|
+
## Slots
|
|
68
|
+
|
|
69
|
+
Useful slots include:
|
|
70
|
+
|
|
71
|
+
- wrapper-level `label` and `error`
|
|
72
|
+
- autocomplete suggestion-row slots such as the default item slot
|
|
73
|
+
- input-adornment slots such as `prefix` and `suffix`
|
|
74
|
+
|
|
75
|
+
Use item slots only after the fetch shape and selection behavior are already correct.
|
|
76
|
+
|
|
77
|
+
## Instance API
|
|
78
|
+
|
|
79
|
+
The exposed instance combines:
|
|
80
|
+
|
|
81
|
+
- `formItem`
|
|
82
|
+
- `field`
|
|
83
|
+
|
|
84
|
+
## Events
|
|
85
|
+
|
|
86
|
+
Important events include:
|
|
87
|
+
|
|
88
|
+
- `update:modelValue`
|
|
89
|
+
- `input`
|
|
90
|
+
- `change`
|
|
91
|
+
- `focus`
|
|
92
|
+
- `blur`
|
|
93
|
+
- `select`
|
|
94
|
+
- `clear`
|
|
95
|
+
|
|
96
|
+
## Import
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { FormAutocomplete } from '@hinen/pro-element-plus';
|
|
100
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-form-cascade-select
|
|
3
|
+
description: Use when a wrapped field should combine FormItem semantics with cascader-style hierarchical path selection inside the Form* wrapper family.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using FormCascadeSelect
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Use `FormCascadeSelect` for a **path-oriented hierarchical wrapped field** that combines `FormItem` behavior with Element Plus cascader behavior.
|
|
11
|
+
|
|
12
|
+
It fits fields where users should pick through nested options as a path, rather than interact with a full tree selection model.
|
|
13
|
+
|
|
14
|
+
## Use it when
|
|
15
|
+
|
|
16
|
+
- a field chooses from nested options where path-style cascading is the right UX
|
|
17
|
+
- you want cascader behavior plus built-in `FormItem` labels, rules, and help text
|
|
18
|
+
- hierarchical options, lazy loading, or filterable cascading are part of the field contract
|
|
19
|
+
- the field should expose both `formItem` and cascader `field` refs together
|
|
20
|
+
|
|
21
|
+
## Prefer something else when
|
|
22
|
+
|
|
23
|
+
- tree semantics fit better than path selection
|
|
24
|
+
→ use `../using-form-tree-select/SKILL.md`
|
|
25
|
+
- a simple local flat choice list is enough
|
|
26
|
+
→ use `../using-form-select/SKILL.md`
|
|
27
|
+
- you only need wrapper behavior around custom content
|
|
28
|
+
→ use `../using-form-item/SKILL.md`
|
|
29
|
+
|
|
30
|
+
## Decision guide
|
|
31
|
+
|
|
32
|
+
Use `FormCascadeSelect` if the answer is yes for **two or more** of these:
|
|
33
|
+
|
|
34
|
+
- Should users move through nested options as a path?
|
|
35
|
+
- Is the hierarchy better expressed as parent-to-child expansion instead of a visible tree?
|
|
36
|
+
- Should the field stay inside the shared form-wrapper family?
|
|
37
|
+
- Do you want wrapper validation access and cascader instance access together?
|
|
38
|
+
|
|
39
|
+
If not, `FormTreeSelect`, `FormSelect`, or another wrapper may fit better.
|
|
40
|
+
|
|
41
|
+
## Start with
|
|
42
|
+
|
|
43
|
+
1. Decide whether the hierarchy should behave like a cascader path or a tree.
|
|
44
|
+
2. Add the normal `FormItem` props such as `label`, `prop`, and `rules`.
|
|
45
|
+
3. Add `options`, cascader `props`, and filtering or lazy-loading behavior only after the wrapper choice is clear.
|
|
46
|
+
4. Use tree-oriented wrappers instead if node semantics matter more than path traversal.
|
|
47
|
+
|
|
48
|
+
## Minimal patterns
|
|
49
|
+
|
|
50
|
+
### Standard wrapped cascader
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<FormCascadeSelect label="Category" prop="category" :options="options" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Hover-expand or multiple cascader
|
|
57
|
+
|
|
58
|
+
Use cascader `props` when expand trigger, multiple choice, or strictness should change.
|
|
59
|
+
|
|
60
|
+
### Lazy-loaded hierarchy
|
|
61
|
+
|
|
62
|
+
Use lazy cascader props when child nodes should load on demand.
|
|
63
|
+
|
|
64
|
+
## Common mistakes
|
|
65
|
+
|
|
66
|
+
- using `FormCascadeSelect` when tree node semantics would be clearer
|
|
67
|
+
- treating path selection and tree selection as interchangeable
|
|
68
|
+
- forgetting that cascader `props` control major behavior such as hover expansion, strictness, and lazy loading
|
|
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 tree select: `../using-form-tree-select/SKILL.md`
|
|
76
|
+
- Wrapped local select: `../using-form-select/SKILL.md`
|
|
77
|
+
|
|
78
|
+
## References
|
|
79
|
+
|
|
80
|
+
- Props: `./references/props.md`
|
|
81
|
+
- Examples: `./references/examples.md`
|
|
82
|
+
- Gotchas: `./references/gotchas.md`
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# FormCascadeSelect examples
|
|
2
|
+
|
|
3
|
+
## 1. Standard hierarchical path field
|
|
4
|
+
|
|
5
|
+
Use `FormCascadeSelect` when users should drill through nested options as a path.
|
|
6
|
+
|
|
7
|
+
Minimal pattern:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<FormCascadeSelect label="Category" prop="category" :options="options" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Typical fit:
|
|
14
|
+
|
|
15
|
+
- region selection
|
|
16
|
+
- category path selection
|
|
17
|
+
- nested taxonomy paths
|
|
18
|
+
|
|
19
|
+
## 2. Multi-select or strict cascader behavior
|
|
20
|
+
|
|
21
|
+
Use cascader `props` when multiple path selection or strict parent-child behavior matters.
|
|
22
|
+
|
|
23
|
+
Minimal pattern:
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<FormCascadeSelect
|
|
27
|
+
label="Scopes"
|
|
28
|
+
prop="scopes"
|
|
29
|
+
:options="options"
|
|
30
|
+
:props="cascaderProps"
|
|
31
|
+
/>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Typical fit:
|
|
35
|
+
|
|
36
|
+
- multi-category assignment
|
|
37
|
+
- partial hierarchy selection
|
|
38
|
+
- mixed parent or child pick rules
|
|
39
|
+
|
|
40
|
+
## 3. Lazy-loaded hierarchy
|
|
41
|
+
|
|
42
|
+
Use lazy loading when the full option tree is too large to preload.
|
|
43
|
+
|
|
44
|
+
Minimal pattern:
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<FormCascadeSelect
|
|
48
|
+
label="Region"
|
|
49
|
+
prop="region"
|
|
50
|
+
:options="options"
|
|
51
|
+
:props="lazyProps"
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Typical fit:
|
|
56
|
+
|
|
57
|
+
- remote taxonomy loading
|
|
58
|
+
- deep organization trees
|
|
59
|
+
- large nested catalogs
|