@jnrs/vue-core 1.2.23 → 1.2.25

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 CHANGED
@@ -368,13 +368,22 @@ 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 }` | 当前页码和每页大小(用于序号计算) |
373
+ | isMainTable | `boolean` | `false` | 是否为主表,启用行选中高亮样式(多栏布局中主表使用) |
374
+
375
+ **暴露方法 (Exposed):**
376
+
377
+ | 方法名 | 类型 | 说明 |
378
+ | -------------- | ------------ | -------------- |
379
+ | clearSelection | `() => void` | 清空所有选中项 |
372
380
 
373
381
  **使用示例:**
374
382
 
375
383
  ```vue
376
384
  <template>
377
385
  <JnTable
386
+ ref="tableRef"
378
387
  :data="tableData"
379
388
  :pagination="{ pageNo: 1, pageSize: 20 }"
380
389
  show-index-column
@@ -384,9 +393,60 @@ console.log(routes)
384
393
  <el-table-column prop="name" label="姓名" />
385
394
  <el-table-column prop="age" label="年龄" />
386
395
  </JnTable>
396
+ <el-button @click="handleClearSelection">清空选择</el-button>
397
+ </template>
398
+
399
+ <script setup>
400
+ import { ref } from 'vue'
401
+
402
+ const tableRef = ref()
403
+
404
+ const handleClearSelection = () => {
405
+ tableRef.value?.clearSelection()
406
+ }
407
+ </script>
408
+ ```
409
+
410
+ **主表样式示例(多栏布局):**
411
+
412
+ ```vue
413
+ <template>
414
+ <JnTable
415
+ :data="tableData"
416
+ :isMainTable="true"
417
+ :pagination="pagination"
418
+ :autoHeight="true"
419
+ :showScrollbar="true"
420
+ :showIndexColumn="true"
421
+ :rowClassName="tableRowClassName"
422
+ @row-click="handleRowClick"
423
+ >
424
+ <el-table-column prop="name" label="名称" min-width="180" show-overflow-tooltip />
425
+ <el-table-column prop="status" label="状态" />
426
+ </JnTable>
387
427
  </template>
428
+
429
+ <script setup>
430
+ import { ref } from 'vue'
431
+
432
+ const currentId = (ref < string) | (undefined > undefined)
433
+
434
+ const handleRowClick = (row) => {
435
+ if (currentId.value === row.id) {
436
+ currentId.value = undefined
437
+ } else {
438
+ currentId.value = row.id
439
+ }
440
+ }
441
+
442
+ const tableRowClassName = ({ row }) => {
443
+ return row.id === currentId.value ? 'jn-row-selected' : ''
444
+ }
445
+ </script>
388
446
  ```
389
447
 
448
+ > `isMainTable` 启用后,会自动添加行 hover 高亮(`--jnrs-background-hover`)和选中行高亮(`--jnrs-color-primary`)样式,配合 `rowClassName` 实现主表行选中效果。
449
+
390
450
  ---
391
451
 
392
452
  #### JnSelectTemplate
@@ -696,11 +756,11 @@ const dialogVisible = ref(false)
696
756
 
697
757
  **参数:**
698
758
 
699
- | 参数名 | 类型 | 默认值 | 说明 |
700
- | -------------- | ------------------------------- | ----------------- | -------------- |
701
- | containerClass | `string` | `'jn_table'` | 表格或容器类名 |
702
- | rowClass | `string` | `'el-table__row'` | 表格行类名 |
703
- | callback | `(rows: HTMLElement[]) => void` | `handleSelection` | 框选后的回调 |
759
+ | 参数名 | 类型 | 默认值 | 说明 |
760
+ | -------------- | ---------------------------- | ----------------- | -------------------------------------------------- |
761
+ | containerClass | `string` | `'jn_table'` | 表格或容器类名,多个表格时需传入不同类名 |
762
+ | rowClass | `string` | `'el-table__row'` | 表格行类名 |
763
+ | callback | `(row: HTMLElement) => void` | `handleSelection` | 框选后的回调,默认处理 input[type='checkbox'] 元素 |
704
764
 
705
765
  **返回值:**
706
766
 
@@ -722,8 +782,8 @@ import { useMouseSelection } from '@jnrs/vue-core/composables'
722
782
 
723
783
  const { handleMouseDown } = useMouseSelection({
724
784
  containerClass: 'jn_table',
725
- callback: (rows) => {
726
- console.log('框选的行', rows)
785
+ callback: (row) => {
786
+ console.log('选中的行', row)
727
787
  }
728
788
  })
729
789
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # 发版日志
2
2
 
3
+ ## [1.2.25] - 2026-07-17
4
+
5
+ ### Features
6
+
7
+ - `JnTable` 组件新增 `isMainTable` prop,启用行选中高亮样式(多栏布局主表使用)
8
+ - `useReactivityTableHeight` 优化:支持多表格场景,自动生成唯一类名,支持 `elementRef` 参数
9
+
10
+ ### Documentation
11
+
12
+ - `AGENTS.md` 新增 `isMainTable` prop 文档和主表样式示例
13
+
14
+ ## [1.2.24] - 2026-07-08
15
+
16
+ ### Fixed
17
+
18
+ - `JnTable` 组件新增对于 MouseSelection 的支持,新增 clearSelection 方法
19
+
3
20
  ## [1.2.23] - 2026-07-08
4
21
 
5
22
  ### Fixed
package/README.md CHANGED
@@ -4,12 +4,18 @@
4
4
 
5
5
  巨能前端工程化开发,Vue 专用核心功能包。
6
6
 
7
- - Pinia store
8
- - Vue composables
9
- - Vue Router
10
- - 全局指令
11
- - 插件
12
- - 公共 Vue 组件
7
+ ### 功能模块
8
+
9
+ | 模块 | 路径 | 说明 |
10
+ | ----------- | ----------------------------- | ------------------------------------------------------------ |
11
+ | 主模块 | `@jnrs/vue-core` | 基础类型定义(`IMenuItem`, `IPagination`, `IPageData`, `IAttachment`, `IDocument` 等) |
12
+ | Pinia | `@jnrs/vue-core/pinia` | `useSystemStore`(主题/全屏/菜单折叠)+ `useMenuStore`(动态菜单/路由) |
13
+ | Router | `@jnrs/vue-core/router` | `createVueRouter`(创建路由实例)+ `asyncGenerateRoute`(动态路由生成)+ `handleRouter`(跳转)+ `useRouter`/`useRoute` |
14
+ | 组件 | `@jnrs/vue-core/components` | `JnTable`(表格)、`JnPagination`(分页)、`JnDialog`(弹窗)、`JnFileUpload`(文件上传)、`JnSelectTemplate`(选择器)、`JnDatetime`(日期格式化)、`JnImportAndExport`(导入导出)等 |
15
+ | Composables | `@jnrs/vue-core/composables` | `useMouseSelection`(鼠标框选)、`useReactivityTableHeight`(表格高度自适应)、`useWebSocket`(WebSocket 连接) |
16
+ | 常量 | `@jnrs/vue-core/constants` | 主题选项配置 |
17
+ | 工具 | `@jnrs/vue-core/utils` / `lib` | 工具函数 / 类型守卫 |
18
+ | 国际化 | `@jnrs/vue-core/locales` | 组件内置文案的多语言支持 |
13
19
 
14
20
  ## 💻 技术栈
15
21
 
@@ -24,9 +30,20 @@ pnpm add @jnrs/vue-core
24
30
  ## 🔍 使用示例
25
31
 
26
32
  ```typescript
27
- import type { IPageData } from '@jnrs/vue-core'
28
- import { useRouter, useRoute } from '@jnrs/vue-core/router'
29
- import { useSystemStore } from '@jnrs/vue-core/pinia'
33
+ // 类型
34
+ import type { IPageData, IAttachment, IMenuItem } from '@jnrs/vue-core'
35
+
36
+ // Pinia
37
+ import { useSystemStore, useMenuStore } from '@jnrs/vue-core/pinia'
38
+
39
+ // Router
40
+ import { useRouter, useRoute, handleRouter, createVueRouter } from '@jnrs/vue-core/router'
41
+
42
+ // 组件
43
+ import { JnTable, JnPagination, JnDialog, JnFileUpload, JnDatetime, JnImportAndExport } from '@jnrs/vue-core/components'
44
+
45
+ // Composables
46
+ import { useWebSocket, useMouseSelection } from '@jnrs/vue-core/composables'
30
47
  ```
31
48
 
32
49
  ## 📋 API
@@ -5,7 +5,7 @@ export interface Props {
5
5
  /**
6
6
  * 下载导入模板文件的 api 函数
7
7
  */
8
- importTemplateApi?: () => Promise<Blob>;
8
+ importTemplateApi?: () => Promise<IBlobItem>;
9
9
  /**
10
10
  * 数据导入 api 函数
11
11
  */
@@ -12,6 +12,7 @@ export interface Props {
12
12
  rowKey?: string;
13
13
  /**
14
14
  * 总是显示横向滚动条
15
+ * @default false
15
16
  */
16
17
  showScrollbar?: boolean;
17
18
  /**
@@ -26,24 +27,39 @@ export interface Props {
26
27
  autoHeight?: boolean;
27
28
  /**
28
29
  * 表格高度自动计算配置项
30
+ * @default {}
29
31
  */
30
32
  autoHeightOptions?: UseReactivityTableHeightOptions;
31
33
  /**
32
34
  * 是否显示序号列
35
+ * @default false
33
36
  */
34
37
  showIndexColumn?: boolean;
35
38
  /**
36
39
  * 是否显示选择列
40
+ * @default false
37
41
  */
38
42
  showSelectionColumn?: boolean;
39
43
  /**
40
44
  * 是否开启鼠标框选
45
+ * @default false
41
46
  */
42
47
  showMouseSelection?: boolean;
48
+ /**
49
+ * 表格容器类名,用于鼠标框选功能,多个表格时需传入不同类名
50
+ * @default 'jn_table'
51
+ */
52
+ containerClass?: string;
43
53
  /**
44
54
  * 当前页码和每页大小(用于序号计算)
55
+ * @default { pageNo: 0, pageSize: 0 }
45
56
  */
46
57
  pagination?: IPagination;
58
+ /**
59
+ * 是否为主表,启用行选中高亮样式(多栏布局中主表使用)
60
+ * @default false
61
+ */
62
+ isMainTable?: boolean;
47
63
  }
48
64
  declare function __VLS_template(): {
49
65
  attrs: Partial<{}>;
@@ -1565,7 +1581,9 @@ declare function __VLS_template(): {
1565
1581
  rootEl: any;
1566
1582
  };
1567
1583
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
1568
- declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
1584
+ declare const __VLS_component: import('vue').DefineComponent<Props, {
1585
+ clearSelection: () => void;
1586
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
1569
1587
  jnTableRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
1570
1588
  data: {
1571
1589
  type: import('vue').PropType<any[]>;