@jnrs/vue-core 1.2.23 → 1.2.24
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/AGENTS.md +26 -7
- package/CHANGELOG.md +6 -0
- package/dist/components/JnTable.vue.d.ts +7 -1
- package/dist/components/index.js +436 -430
- package/dist/composables/index.js +1 -1
- package/dist/useMouseSelection-BYwoK2fm.js +208 -0
- package/package.json +2 -2
- package/dist/useMouseSelection-DRaVfdZU.js +0 -206
package/AGENTS.md
CHANGED
|
@@ -368,13 +368,21 @@ console.log(routes)
|
|
|
368
368
|
| showIndexColumn | `boolean` | `false` | 是否显示序号列 |
|
|
369
369
|
| showSelectionColumn | `boolean` | `false` | 是否显示选择列 |
|
|
370
370
|
| showMouseSelection | `boolean` | `false` | 是否开启鼠标框选 |
|
|
371
|
+
| containerClass | `string` | `'jn_table'` | 表格容器类名,用于鼠标框选功能,多个表格时需传入不同类名 |
|
|
371
372
|
| pagination | `IPagination` | `{ pageNo: 0, pageSize: 0 }` | 当前页码和每页大小(用于序号计算) |
|
|
372
373
|
|
|
374
|
+
**暴露方法 (Exposed):**
|
|
375
|
+
|
|
376
|
+
| 方法名 | 类型 | 说明 |
|
|
377
|
+
| -------------- | ------------ | -------------- |
|
|
378
|
+
| clearSelection | `() => void` | 清空所有选中项 |
|
|
379
|
+
|
|
373
380
|
**使用示例:**
|
|
374
381
|
|
|
375
382
|
```vue
|
|
376
383
|
<template>
|
|
377
384
|
<JnTable
|
|
385
|
+
ref="tableRef"
|
|
378
386
|
:data="tableData"
|
|
379
387
|
:pagination="{ pageNo: 1, pageSize: 20 }"
|
|
380
388
|
show-index-column
|
|
@@ -384,7 +392,18 @@ console.log(routes)
|
|
|
384
392
|
<el-table-column prop="name" label="姓名" />
|
|
385
393
|
<el-table-column prop="age" label="年龄" />
|
|
386
394
|
</JnTable>
|
|
395
|
+
<el-button @click="handleClearSelection">清空选择</el-button>
|
|
387
396
|
</template>
|
|
397
|
+
|
|
398
|
+
<script setup>
|
|
399
|
+
import { ref } from 'vue'
|
|
400
|
+
|
|
401
|
+
const tableRef = ref()
|
|
402
|
+
|
|
403
|
+
const handleClearSelection = () => {
|
|
404
|
+
tableRef.value?.clearSelection()
|
|
405
|
+
}
|
|
406
|
+
</script>
|
|
388
407
|
```
|
|
389
408
|
|
|
390
409
|
---
|
|
@@ -696,11 +715,11 @@ const dialogVisible = ref(false)
|
|
|
696
715
|
|
|
697
716
|
**参数:**
|
|
698
717
|
|
|
699
|
-
| 参数名 | 类型
|
|
700
|
-
| -------------- |
|
|
701
|
-
| containerClass | `string`
|
|
702
|
-
| rowClass | `string`
|
|
703
|
-
| callback | `(
|
|
718
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
719
|
+
| -------------- | ---------------------------- | ----------------- | -------------------------------------------------- |
|
|
720
|
+
| containerClass | `string` | `'jn_table'` | 表格或容器类名,多个表格时需传入不同类名 |
|
|
721
|
+
| rowClass | `string` | `'el-table__row'` | 表格行类名 |
|
|
722
|
+
| callback | `(row: HTMLElement) => void` | `handleSelection` | 框选后的回调,默认处理 input[type='checkbox'] 元素 |
|
|
704
723
|
|
|
705
724
|
**返回值:**
|
|
706
725
|
|
|
@@ -722,8 +741,8 @@ import { useMouseSelection } from '@jnrs/vue-core/composables'
|
|
|
722
741
|
|
|
723
742
|
const { handleMouseDown } = useMouseSelection({
|
|
724
743
|
containerClass: 'jn_table',
|
|
725
|
-
callback: (
|
|
726
|
-
console.log('
|
|
744
|
+
callback: (row) => {
|
|
745
|
+
console.log('选中的行', row)
|
|
727
746
|
}
|
|
728
747
|
})
|
|
729
748
|
|
package/CHANGELOG.md
CHANGED
|
@@ -40,6 +40,10 @@ export interface Props {
|
|
|
40
40
|
* 是否开启鼠标框选
|
|
41
41
|
*/
|
|
42
42
|
showMouseSelection?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 表格容器类名,用于鼠标框选功能,多个表格时需传入不同类名
|
|
45
|
+
*/
|
|
46
|
+
containerClass?: string;
|
|
43
47
|
/**
|
|
44
48
|
* 当前页码和每页大小(用于序号计算)
|
|
45
49
|
*/
|
|
@@ -1565,7 +1569,9 @@ declare function __VLS_template(): {
|
|
|
1565
1569
|
rootEl: any;
|
|
1566
1570
|
};
|
|
1567
1571
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
1568
|
-
declare const __VLS_component: import('vue').DefineComponent<Props, {
|
|
1572
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {
|
|
1573
|
+
clearSelection: () => void;
|
|
1574
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
1569
1575
|
jnTableRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
1570
1576
|
data: {
|
|
1571
1577
|
type: import('vue').PropType<any[]>;
|