@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.
Files changed (148) hide show
  1. package/dist/components/DataTable/DataTable.vue.d.ts +24 -6
  2. package/dist/components/DataTable/DataTable.vue.d.ts.map +1 -1
  3. package/dist/components/DataTable/props.d.ts +11 -2
  4. package/dist/components/DataTable/props.d.ts.map +1 -1
  5. package/dist/components/DataTable/types.d.ts +13 -1
  6. package/dist/components/DataTable/types.d.ts.map +1 -1
  7. package/dist/components/DataTable/useDataTable.d.ts.map +1 -1
  8. package/dist/components/FormFields/FormCascadeSelect/FormCascadeSelect.vue.d.ts +136 -146
  9. package/dist/components/FormFields/FormCascadeSelect/FormCascadeSelect.vue.d.ts.map +1 -1
  10. package/dist/components/FormFields/FormCascadeSelect/props.d.ts +112 -114
  11. package/dist/components/FormFields/FormCascadeSelect/props.d.ts.map +1 -1
  12. package/dist/components/FormFields/FormCascadeSelect/types.d.ts +24 -1
  13. package/dist/components/FormFields/FormCascadeSelect/types.d.ts.map +1 -1
  14. package/dist/components/FormFields/FormTagInput/FormTagInput.vue.d.ts.map +1 -1
  15. package/dist/components/FormFields/FormTreeSelect/props.d.ts +3 -1
  16. package/dist/components/FormFields/FormTreeSelect/props.d.ts.map +1 -1
  17. package/dist/index.cjs +32 -32
  18. package/dist/index.js +2947 -2570
  19. package/dist/skills/building-form-workflows/SKILL.md +77 -0
  20. package/dist/skills/building-form-workflows/references/examples.md +47 -0
  21. package/dist/skills/building-form-workflows/references/field-selection.md +16 -0
  22. package/dist/skills/building-form-workflows/references/gotchas.md +10 -0
  23. package/dist/skills/building-form-workflows/references/workflow.md +21 -0
  24. package/dist/skills/building-modal-workflows/SKILL.md +79 -0
  25. package/dist/skills/building-modal-workflows/references/examples.md +104 -0
  26. package/dist/skills/building-modal-workflows/references/gotchas.md +19 -0
  27. package/dist/skills/building-modal-workflows/references/workflow.md +17 -0
  28. package/dist/skills/building-query-pages/SKILL.md +81 -0
  29. package/dist/skills/building-query-pages/references/examples.md +64 -0
  30. package/dist/skills/building-query-pages/references/field-selection.md +24 -0
  31. package/dist/skills/building-query-pages/references/gotchas.md +10 -0
  32. package/dist/skills/building-query-pages/references/workflow.md +22 -0
  33. package/dist/skills/building-selection-inputs/SKILL.md +85 -0
  34. package/dist/skills/building-selection-inputs/references/examples.md +87 -0
  35. package/dist/skills/building-selection-inputs/references/gotchas.md +19 -0
  36. package/dist/skills/building-selection-inputs/references/selection-guide.md +47 -0
  37. package/dist/skills/choosing-components/SKILL.md +78 -0
  38. package/dist/skills/choosing-components/references/component-groups.md +37 -0
  39. package/dist/skills/choosing-components/references/examples.md +91 -0
  40. package/dist/skills/choosing-components/references/gotchas.md +10 -0
  41. package/dist/skills/choosing-components/references/selection-guide.md +40 -0
  42. package/dist/skills/optimizing-component-skills/REVIEW.md +775 -0
  43. package/dist/skills/using-checkbox-group/SKILL.md +91 -0
  44. package/dist/skills/using-checkbox-group/references/examples.md +55 -0
  45. package/dist/skills/using-checkbox-group/references/gotchas.md +13 -0
  46. package/dist/skills/using-checkbox-group/references/props.md +83 -0
  47. package/dist/skills/using-config-provider/SKILL.md +96 -0
  48. package/dist/skills/using-config-provider/references/examples.md +38 -0
  49. package/dist/skills/using-config-provider/references/gotchas.md +13 -0
  50. package/dist/skills/using-config-provider/references/props.md +38 -0
  51. package/dist/skills/using-data-select/SKILL.md +127 -0
  52. package/dist/skills/using-data-select/references/examples.md +67 -0
  53. package/dist/skills/using-data-select/references/gotchas.md +19 -0
  54. package/dist/skills/using-data-select/references/props.md +126 -0
  55. package/dist/skills/using-data-table/SKILL.md +289 -0
  56. package/dist/skills/using-data-table/references/examples.md +347 -0
  57. package/dist/skills/using-data-table/references/gotchas.md +114 -0
  58. package/dist/skills/using-data-table/references/props.md +375 -0
  59. package/dist/skills/using-drawer/SKILL.md +104 -0
  60. package/dist/skills/using-drawer/references/examples.md +109 -0
  61. package/dist/skills/using-drawer/references/gotchas.md +16 -0
  62. package/dist/skills/using-drawer/references/props.md +105 -0
  63. package/dist/skills/using-ellipsis-text/SKILL.md +105 -0
  64. package/dist/skills/using-ellipsis-text/references/examples.md +71 -0
  65. package/dist/skills/using-ellipsis-text/references/gotchas.md +19 -0
  66. package/dist/skills/using-ellipsis-text/references/props.md +97 -0
  67. package/dist/skills/using-form-autocomplete/SKILL.md +87 -0
  68. package/dist/skills/using-form-autocomplete/references/examples.md +62 -0
  69. package/dist/skills/using-form-autocomplete/references/gotchas.md +13 -0
  70. package/dist/skills/using-form-autocomplete/references/props.md +100 -0
  71. package/dist/skills/using-form-cascade-select/SKILL.md +82 -0
  72. package/dist/skills/using-form-cascade-select/references/examples.md +59 -0
  73. package/dist/skills/using-form-cascade-select/references/gotchas.md +13 -0
  74. package/dist/skills/using-form-cascade-select/references/props.md +138 -0
  75. package/dist/skills/using-form-checkbox-group/SKILL.md +83 -0
  76. package/dist/skills/using-form-checkbox-group/references/examples.md +61 -0
  77. package/dist/skills/using-form-checkbox-group/references/gotchas.md +13 -0
  78. package/dist/skills/using-form-checkbox-group/references/props.md +85 -0
  79. package/dist/skills/using-form-date-picker/SKILL.md +79 -0
  80. package/dist/skills/using-form-date-picker/references/examples.md +54 -0
  81. package/dist/skills/using-form-date-picker/references/gotchas.md +10 -0
  82. package/dist/skills/using-form-date-picker/references/props.md +99 -0
  83. package/dist/skills/using-form-fields/SKILL.md +101 -0
  84. package/dist/skills/using-form-fields/references/examples.md +45 -0
  85. package/dist/skills/using-form-fields/references/gotchas.md +6 -0
  86. package/dist/skills/using-form-fields/references/props.md +57 -0
  87. package/dist/skills/using-form-item/SKILL.md +92 -0
  88. package/dist/skills/using-form-item/references/examples.md +59 -0
  89. package/dist/skills/using-form-item/references/gotchas.md +13 -0
  90. package/dist/skills/using-form-item/references/props.md +85 -0
  91. package/dist/skills/using-form-number/SKILL.md +82 -0
  92. package/dist/skills/using-form-number/references/examples.md +66 -0
  93. package/dist/skills/using-form-number/references/gotchas.md +13 -0
  94. package/dist/skills/using-form-number/references/props.md +82 -0
  95. package/dist/skills/using-form-radio-group/SKILL.md +83 -0
  96. package/dist/skills/using-form-radio-group/references/examples.md +53 -0
  97. package/dist/skills/using-form-radio-group/references/gotchas.md +13 -0
  98. package/dist/skills/using-form-radio-group/references/props.md +81 -0
  99. package/dist/skills/using-form-rate/SKILL.md +86 -0
  100. package/dist/skills/using-form-rate/references/examples.md +60 -0
  101. package/dist/skills/using-form-rate/references/gotchas.md +16 -0
  102. package/dist/skills/using-form-rate/references/props.md +88 -0
  103. package/dist/skills/using-form-select/SKILL.md +94 -0
  104. package/dist/skills/using-form-select/references/examples.md +67 -0
  105. package/dist/skills/using-form-select/references/gotchas.md +13 -0
  106. package/dist/skills/using-form-select/references/props.md +87 -0
  107. package/dist/skills/using-form-switch/SKILL.md +81 -0
  108. package/dist/skills/using-form-switch/references/examples.md +54 -0
  109. package/dist/skills/using-form-switch/references/gotchas.md +10 -0
  110. package/dist/skills/using-form-switch/references/props.md +83 -0
  111. package/dist/skills/using-form-tag-input/SKILL.md +83 -0
  112. package/dist/skills/using-form-tag-input/references/examples.md +53 -0
  113. package/dist/skills/using-form-tag-input/references/gotchas.md +13 -0
  114. package/dist/skills/using-form-tag-input/references/props.md +80 -0
  115. package/dist/skills/using-form-text/SKILL.md +82 -0
  116. package/dist/skills/using-form-text/references/examples.md +66 -0
  117. package/dist/skills/using-form-text/references/gotchas.md +13 -0
  118. package/dist/skills/using-form-text/references/props.md +98 -0
  119. package/dist/skills/using-form-time-picker/SKILL.md +78 -0
  120. package/dist/skills/using-form-time-picker/references/examples.md +53 -0
  121. package/dist/skills/using-form-time-picker/references/gotchas.md +10 -0
  122. package/dist/skills/using-form-time-picker/references/props.md +89 -0
  123. package/dist/skills/using-form-tree-select/SKILL.md +82 -0
  124. package/dist/skills/using-form-tree-select/references/examples.md +55 -0
  125. package/dist/skills/using-form-tree-select/references/gotchas.md +13 -0
  126. package/dist/skills/using-form-tree-select/references/props.md +86 -0
  127. package/dist/skills/using-image/SKILL.md +88 -0
  128. package/dist/skills/using-image/references/examples.md +31 -0
  129. package/dist/skills/using-image/references/gotchas.md +13 -0
  130. package/dist/skills/using-image/references/props.md +91 -0
  131. package/dist/skills/using-modal/SKILL.md +113 -0
  132. package/dist/skills/using-modal/references/examples.md +122 -0
  133. package/dist/skills/using-modal/references/gotchas.md +16 -0
  134. package/dist/skills/using-modal/references/props.md +100 -0
  135. package/dist/skills/using-query-form/SKILL.md +134 -0
  136. package/dist/skills/using-query-form/references/examples.md +103 -0
  137. package/dist/skills/using-query-form/references/gotchas.md +19 -0
  138. package/dist/skills/using-query-form/references/props.md +146 -0
  139. package/dist/skills/using-radio-group/SKILL.md +91 -0
  140. package/dist/skills/using-radio-group/references/examples.md +55 -0
  141. package/dist/skills/using-radio-group/references/gotchas.md +13 -0
  142. package/dist/skills/using-radio-group/references/props.md +83 -0
  143. package/dist/skills/using-select/SKILL.md +93 -0
  144. package/dist/skills/using-select/references/examples.md +50 -0
  145. package/dist/skills/using-select/references/gotchas.md +13 -0
  146. package/dist/skills/using-select/references/props.md +90 -0
  147. package/dist/style.css +1 -1
  148. package/package.json +1 -1
@@ -0,0 +1,347 @@
1
+ # DataTable examples
2
+
3
+ ## 1. Standard admin list page
4
+
5
+ Use `DataTable` when the page is a classic list page with:
6
+
7
+ - filters
8
+ - remote rows
9
+ - pagination
10
+ - sorting
11
+ - refresh
12
+ - row-level actions
13
+
14
+ Typical fit:
15
+
16
+ - user management
17
+ - order lists
18
+ - audit records
19
+ - resource inventories
20
+
21
+ Recommended pattern:
22
+
23
+ - define query metadata in `columns`
24
+ - map backend response through `queryFn`
25
+ - keep table shell standard
26
+ - add toolbar actions through the `toolbar` slot
27
+
28
+ Minimal pattern:
29
+
30
+ ```vue
31
+ <DataTable :columns="columns" :query-fn="queryFn" />
32
+ ```
33
+
34
+ ## 2. Static readonly table
35
+
36
+ Use static mode when rows already exist and the page still benefits from the standard table shell.
37
+
38
+ Minimal pattern:
39
+
40
+ ```vue
41
+ <DataTable :columns="columns" :data="rows" :pagination="false" />
42
+ ```
43
+
44
+ Typical fit:
45
+
46
+ - small comparison tables
47
+ - review screens
48
+ - embedded feature detail lists
49
+ - local-only display data
50
+
51
+ Recommended pattern:
52
+
53
+ - pass `columns`
54
+ - pass `data`
55
+ - set `pagination: false` when paging is unnecessary
56
+
57
+ Do not build around `refresh()` or `refetch()` in this mode.
58
+
59
+ ## 3. Controlled table shell
60
+
61
+ Use `useDataTable()` and the exported helpers when parent code needs explicit control.
62
+
63
+ Minimal pattern:
64
+
65
+ ```ts
66
+ const table = useDataTable();
67
+ table.setSearchParams({ status: 'active' });
68
+ ```
69
+
70
+ Typical fit:
71
+
72
+ - toolbar buttons should set filters
73
+ - route changes should restore search params
74
+ - tabs should reset pagination
75
+ - external controls should trigger a refresh
76
+
77
+ Recommended pattern:
78
+
79
+ - let `DataTable` own rendering and query execution
80
+ - let parent code coordinate through imperative methods only where needed
81
+ - avoid rebuilding query state outside the component unless the feature truly requires it
82
+
83
+ ## 4. Delayed query until prerequisites are ready
84
+
85
+ Use `enabled` when querying should wait for setup work.
86
+
87
+ Minimal pattern:
88
+
89
+ ```vue
90
+ <DataTable
91
+ :columns="columns"
92
+ :query-fn="queryFn"
93
+ :enabled="Boolean(projectId)"
94
+ />
95
+ ```
96
+
97
+ Typical fit:
98
+
99
+ - option dictionaries must load first
100
+ - route state is incomplete
101
+ - a project or tenant must be selected first
102
+ - inactive tabs should not fetch yet
103
+
104
+ Recommended pattern:
105
+
106
+ - keep `columns` stable
107
+ - compute `enabled` from the prerequisite
108
+ - pass external `loading` if setup work is separate from table querying
109
+
110
+ ## 5. Shared empty and error states
111
+
112
+ Use `DataTable` with `../../using-config-provider/SKILL.md` when multiple list pages should share fallback rendering.
113
+
114
+ Minimal pattern:
115
+
116
+ ```vue
117
+ <ConfigProvider>
118
+ <DataTable :columns="columns" :query-fn="queryFn" />
119
+ </ConfigProvider>
120
+ ```
121
+
122
+ Typical fit:
123
+
124
+ - one feature contains several list pages
125
+ - empty states should use the same wording and visuals
126
+ - error states should stay consistent across the module
127
+
128
+ Prefer ConfigProvider-level defaults over repeating custom slots everywhere.
129
+
130
+ ## 6. Selection-oriented batch actions
131
+
132
+ Use row selection and `selectionBar` when the page supports batch operations.
133
+
134
+ Minimal pattern:
135
+
136
+ ```vue
137
+ <DataTable :columns="columns" :query-fn="queryFn" row-selection />
138
+ ```
139
+
140
+ Typical fit:
141
+
142
+ - bulk enable or disable
143
+ - batch export
144
+ - multi-row review
145
+ - batch delete with confirmation
146
+
147
+ Recommended pattern:
148
+
149
+ - keep selection behavior inside the `DataTable` shell
150
+ - add `selection` when the built-in checkbox review should stay useful across pages
151
+ - replace the default `selectionBar` only when page-specific actions need fully custom UI
152
+
153
+ ## 7. Built-in cross-page checkbox review
154
+
155
+ Use `selection` when checkbox selection should keep the built-in review state across pages.
156
+
157
+ Minimal pattern:
158
+
159
+ ```vue
160
+ <DataTable
161
+ :columns="columns"
162
+ :query-fn="queryFn"
163
+ row-key="id"
164
+ row-selection
165
+ :selection="{
166
+ formatter: (row) => row.name,
167
+ }"
168
+ />
169
+ ```
170
+
171
+ Recommended pattern:
172
+
173
+ - treat `selection` as the item-level customization API for this review behavior
174
+ - provide `rowKey` so built-in review items can aggregate across pages
175
+ - use `formatter(row)` when the default tag text needs a small change
176
+ - use `render(...)` when each built-in review item needs custom rendering
177
+ - use `selectionBar.reviewPopoverProps` when the built-in 查看已选 popover needs container-level tweaks (default placement is 'bottom-start')
178
+ - keep using `selectionChange` and `getSelectionRows()` as current-page signals
179
+
180
+ Use the `selectionBar` slot only when the page should replace the built-in review UI completely.
181
+
182
+ ## 12. Controlled selection with v-model:selectedRowKeys
183
+
184
+ Use `v-model:selectedRowKeys` when parent state should control checkbox selection.
185
+
186
+ Minimal pattern:
187
+
188
+ ```vue
189
+ <DataTable
190
+ v-model:selectedRowKeys="selectedKeys"
191
+ :columns="columns"
192
+ :query-fn="queryFn"
193
+ row-key="id"
194
+ row-selection
195
+ />
196
+ ```
197
+
198
+ ```ts
199
+ import { ref } from 'vue';
200
+ import type { DataTableSelectionKeyType } from '@hinen/pro-element-plus';
201
+
202
+ const selectedKeys = ref<DataTableSelectionKeyType[]>([]);
203
+
204
+ // Set selection programmatically
205
+ function selectAllVisible(rows: User[]) {
206
+ selectedKeys.value = rows.map((row) => row.id);
207
+ }
208
+
209
+ // Clear selection
210
+ function clearSelection() {
211
+ selectedKeys.value = [];
212
+ }
213
+
214
+ // React to changes
215
+ watch(selectedKeys, (keys) => {
216
+ console.log('Selected:', keys);
217
+ });
218
+ ```
219
+
220
+ Recommended pattern:
221
+
222
+ - use `v-model:selectedRowKeys` for controlled mode, no prop for internal mode
223
+ - always provide `rowKey` when selection should persist across pages
224
+ - update the model ref directly to change selection from parent
225
+ - use `selection` prop only for customization, never for state control
226
+ - instance methods like `getSelectionRows()` still work in controlled mode
227
+
228
+ ## 13. Cross-page selection with controlled mode
229
+
230
+ Use `v-model:selectedRowKeys` with `rowKey` to maintain selection across pagination.
231
+
232
+ Minimal pattern:
233
+
234
+ ```vue
235
+ <DataTable
236
+ v-model:selectedRowKeys="selectedKeys"
237
+ :columns="columns"
238
+ :query-fn="queryFn"
239
+ row-key="id"
240
+ row-selection
241
+ :selection="{
242
+ formatter: (row) => row.name,
243
+ }"
244
+ />
245
+ ```
246
+
247
+ ```ts
248
+ const selectedKeys = ref<DataTableSelectionKeyType[]>([]);
249
+
250
+ // Select rows on page 1
251
+ selectedKeys.value = [1, 2, 3];
252
+
253
+ // Navigate to page 2 and add more selections
254
+ // selectedKeys.value now contains keys from both pages: [1, 2, 3, 4, 5]
255
+ selectedKeys.value = [...selectedKeys.value, 4, 5];
256
+
257
+ // Built-in review UI shows all 5 selections
258
+ ```
259
+
260
+ Recommended pattern:
261
+
262
+ - `rowKey` is required for cross-page selection to work correctly
263
+ - the model accepts keys from any page, not just the current one
264
+ - built-in review UI aggregates selections across pages when `rowKey` is provided
265
+ - `selectionChange` event still emits current-page changes only
266
+
267
+ ## 8. Sticky large-page table
268
+
269
+ Use `fixedHeader` or `fixedFooter` when the page is long enough that default table scrolling becomes awkward.
270
+
271
+ Typical fit:
272
+
273
+ - long filter forms above the table
274
+ - large result sets
275
+ - bottom pagination that should stay reachable
276
+
277
+ Add sticky behavior after the main search and pagination flow is already correct.
278
+
279
+ ## 9. DataTable inside an overlay shell
280
+
281
+ Use `DataTable` inside `../../using-modal/SKILL.md` or `../../using-drawer/SKILL.md` when the filter-plus-results surface belongs in a temporary overlay rather than a full page.
282
+
283
+ Minimal pattern:
284
+
285
+ ```vue
286
+ <Drawer :model-value="visible" title="Select User" @cancel="visible = false">
287
+ <DataTable :columns="columns" :query-fn="queryFn" />
288
+ </Drawer>
289
+ ```
290
+
291
+ Typical fit:
292
+
293
+ - select-from-list drawers
294
+ - review-history overlays
295
+ - search-and-pick workflows inside a larger page
296
+
297
+ ## 10. Built-in radio single-select row
298
+
299
+ Use `highlightCurrentRow` when the page wants `DataTable` to own a radio-based single-select row state.
300
+
301
+ Minimal pattern:
302
+
303
+ ```vue
304
+ <DataTable
305
+ ref="tableRef"
306
+ :columns="columns"
307
+ :data="rows"
308
+ row-key="id"
309
+ highlight-current-row
310
+ @current-change="handleCurrentChange"
311
+ />
312
+ ```
313
+
314
+ Recommended pattern:
315
+
316
+ - provide `rowKey` when selection should stay stable across data updates
317
+ - treat the radio as the selection trigger
318
+ - use `setCurrentRow(row)` for imperative select
319
+ - use `setCurrentRow()` to clear the single-select current row
320
+
321
+ Do not expect row clicks to change the current row in this mode.
322
+
323
+ Checkbox review changes do not affect this single-select mode.
324
+
325
+ ## 11. Controlled current row with `currentRowKey`
326
+
327
+ Use `currentRowKey` when parent state should control which single-select row is active.
328
+
329
+ Minimal pattern:
330
+
331
+ ```vue
332
+ <DataTable
333
+ :columns="columns"
334
+ :data="rows"
335
+ row-key="id"
336
+ highlight-current-row
337
+ :current-row-key="currentRowKey"
338
+ />
339
+ ```
340
+
341
+ Recommended pattern:
342
+
343
+ - always pair `currentRowKey` with `rowKey`
344
+ - set `currentRowKey` to a row key to select that row
345
+ - set `currentRowKey` to `undefined` to clear the current single-select row
346
+
347
+ Do not use `clearSelection()` for this flow; that targets checkbox selection rather than current-row state.
@@ -0,0 +1,114 @@
1
+ # DataTable gotchas
2
+
3
+ - `queryFn` must return `{ data, total, success }`
4
+ Returning only an array, or using fields such as `rows` or `count`, does not match the component contract.
5
+
6
+ - `success` is part of the error-state contract
7
+ `success: false` is treated as an error signal, so backend mapping should be explicit.
8
+
9
+ - Static mode and remote mode are different
10
+ If you pass `data`, do not assume query lifecycle methods like `refresh()` or `refetch()` are available.
11
+
12
+ - Query form rendering is column-driven
13
+ If every column uses `hideInForm` or lacks `prop`, the generated query form may not render.
14
+
15
+ - Form instance methods require a real generated form
16
+ Calls such as `resetForm()`, `validateForm()`, or `setFormData()` only make sense when form items actually exist.
17
+
18
+ - `setSearchParams()` has side effects
19
+ By default it can merge params, reset pagination, restore form state, and trigger a refetch in remote mode.
20
+
21
+ - `enabled` should gate real prerequisites
22
+ Use it when querying should wait for required state, not as a vague workaround for unstable behavior.
23
+
24
+ - `hidePaginationWhenEmpty` changes page behavior
25
+ Empty results can hide the pager entirely, so verify that this matches product intent.
26
+
27
+ - `selectionBar` is built in
28
+ If selected-row UI appears unexpectedly, check whether row selection and `selectionBar` are both active.
29
+
30
+ - `selection` customizes built-in checkbox review items
31
+ Keep item-level customization in `selection`, not in extra events or instance methods.
32
+
33
+ - Built-in cross-page checkbox review requires `rowKey`
34
+ Without `rowKey`, the review UI cannot aggregate selected rows across pages correctly.
35
+
36
+ - `formatter(row)` and `render(...)` have different jobs
37
+ Use `formatter(row)` to change the default tag text. Use `render(...)` to replace each built-in review item render.
38
+
39
+ - `selectionBar.reviewPopoverProps` only customizes the popover container
40
+ Use it for built-in 查看已选 popover props, not for per-tag content or close behavior.
41
+
42
+ - The `selectionBar` slot replaces the built-in review UI
43
+ Once the slot is used, do not expect the default cross-page review UI to remain visible.
44
+
45
+ - In cross-page checkbox mode, the `selectionBar` slot gets aggregated rows
46
+ Search, Reset, pagination, or other current-page changes should not make the slot-level `selection` suddenly drop to the current page only.
47
+
48
+ - `selectionChange` and `getSelectionRows()` stay current-page oriented
49
+ They do not become cross-page aggregate contracts just because the built-in review UI keeps state across pages.
50
+
51
+ - `loading` combines with internal query loading
52
+ External loading and internal query loading both affect the final visual loading state.
53
+
54
+ - `columns` affects both display and query behavior
55
+ A column change can alter the table UI and the generated search form at the same time.
56
+
57
+ - `valueEnum` is not only visual
58
+ It can influence generated query controls as well as table display.
59
+
60
+ - Nested multi-level headers are not the primary target
61
+ If complex header composition is central to the feature, do not assume `DataTable` is the best fit.
62
+
63
+ - Do not overuse imperative control
64
+ `useDataTable()` should coordinate the component, not replace its internal state model.
65
+
66
+ - `highlightCurrentRow` is not visual-only in `DataTable`
67
+ It enables the built-in radio single-select mode, changes click behavior, and prepends a radio column.
68
+
69
+ - Row click and current-row change are decoupled in single-select mode
70
+ With `highlightCurrentRow: true`, clicking a row still emits `rowClick`, but only clicking the radio changes the current row.
71
+
72
+ - Controlled single-select requires `rowKey`
73
+ If you pass `currentRowKey` without `rowKey`, do not expect stable controlled current-row behavior.
74
+
75
+ - Clearing single-select current row uses `setCurrentRow()`, not `clearSelection()`
76
+ `clearSelection()` is for checkbox selection. To clear the current radio-selected row, use `setCurrentRow()` or set `currentRowKey` to `undefined`.
77
+
78
+ - Empty `currentRowKey` clearing is a wrapper convention
79
+ `DataTable` treats `currentRowKey: undefined` as “clear current row” in single-select mode. This is aligned with the wrapper behavior, not a documented Element Plus `current-row-key` guarantee.
80
+
81
+ - An unmatched `currentRowKey` also clears the current single-select row
82
+ If the provided key does not resolve to any row in the current data set, `DataTable` clears the current row instead of preserving the previous one.
83
+
84
+ - Single-select behavior is unchanged
85
+ The built-in cross-page checkbox review does not alter `highlightCurrentRow`, radio selection, or current-row APIs.
86
+
87
+ - `v-model:selectedRowKeys` enables controlled selection mode
88
+ When this prop is provided, parent state owns selection. The component emits `update:selectedRowKeys` but defers to the prop value.
89
+
90
+ - Controlled mode vs internal mode
91
+ Internal mode: component owns selection state, use `clearSelection()` and `getSelectionRows()`.
92
+ Controlled mode: parent owns state via `selectedRowKeys`, update the model ref directly to change selection.
93
+
94
+ - `selection` prop is for customization only
95
+ Never use `selection` to control selection state. Use `v-model:selectedRowKeys` for state control.
96
+ `formatter` and `render` in `selection` only customize the review item display.
97
+
98
+ - `selectedRowKeys` requires matching `rowKey` for cross-page selection
99
+ Without `rowKey`, the component cannot identify which rows correspond to the provided keys across pages.
100
+
101
+ - `selectedRowKeys` accepts keys from any page
102
+ In controlled mode with `rowKey`, the model can contain keys from pages other than the current one. The built-in review UI aggregates them.
103
+
104
+ - `selectionChange` remains current-page oriented
105
+ Even in controlled mode, `selectionChange` only emits changes for the current page. Use `watch(selectedKeys)` to observe all changes.
106
+
107
+ - Instance methods still work in controlled mode
108
+ `getSelectionRows()`, `toggleRowSelection()`, etc. continue to function, but parent state should be the primary control mechanism.
109
+
110
+ - Clearing selection in controlled mode
111
+ Call `clearSelection()` or set `selectedKeys.value = []`. In controlled mode, prefer updating the model directly.
112
+
113
+ - Default placement for review popover is 'bottom-start'
114
+ When using `selectionBar.reviewPopoverProps`, the default placement is 'bottom-start'. Only override if necessary.