dse-edit-table 1.1.6 → 1.2.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.
package/README.en.md ADDED
@@ -0,0 +1,36 @@
1
+ # edit-tablt-ui
2
+
3
+ #### Description
4
+ {**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
5
+
6
+ #### Software Architecture
7
+ Software architecture description
8
+
9
+ #### Installation
10
+
11
+ 1. xxxx
12
+ 2. xxxx
13
+ 3. xxxx
14
+
15
+ #### Instructions
16
+
17
+ 1. xxxx
18
+ 2. xxxx
19
+ 3. xxxx
20
+
21
+ #### Contribution
22
+
23
+ 1. Fork the repository
24
+ 2. Create Feat_xxx branch
25
+ 3. Commit your code
26
+ 4. Create Pull Request
27
+
28
+
29
+ #### Gitee Feature
30
+
31
+ 1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
32
+ 2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
33
+ 3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
34
+ 4. The most valuable open source project [GVP](https://gitee.com/gvp)
35
+ 5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
36
+ 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # DseEditTable UI
2
+
3
+ 基于 [vxe-table](https://github.com/x-extends/vxe-table) 4.x 二次封装的 Vue 3 可编辑表格组件库,把项目中重复的表格配置(编辑、区域选择、复制粘贴、右键菜单、虚拟滚动、高度自适应)收敛成一份内置默认值,开箱即用。
4
+
5
+ [![npm version](https://img.shields.io/npm/v/dse-edit-table.svg)](https://www.npmjs.com/package/dse-edit-table)
6
+ [![license](https://img.shields.io/npm/l/dse-edit-table.svg)](LICENSE)
7
+
8
+ ## 特性
9
+
10
+ - 🚀 **内置默认配置**:编辑 / 键盘 / 剪贴板 / 区域选择 / 虚拟滚动等 12 组配置零配置可用,传入的同名配置会与默认值合并
11
+ - 📦 **完整透传 vxe-grid**:未声明的属性通过 `$attrs` 直接落到内部 `vxe-grid`,`stripe`、`loading`、`pagerConfig` 等照常用
12
+ - ✏️ **变更采集**:`getUpdateCellData()` 返回"仅包含被改动字段"的增量数据,便于提交
13
+ - 🖱️ **右键菜单与内置命令**:1.2.0 起自带默认菜单(表头:添加列 / 删除列 / 编辑列;表体:清空行 / 新增 1、10 行 / 复制 / 粘贴 / 剪切 / 删除行),命中的 `code` 由组件直接执行,其余 `code` 走 `@menu-click`
14
+ - 🔗 **v-model 友好**:内置行/列命令不修改传入数组,而是生成新数组并派发 `update:data` / `update:columns`,`v-model:data`、`v-model:columns` 可直接使用
15
+ - 📋 **类 Excel 操作**:区域选择、复制/剪切/粘贴、填充柄扩展(依赖内置的 `vxe-table-extend-cell-area` 插件)
16
+ - 📐 **高度自适应**:默认按视口与容器位置自动计算表格高度,也可通过 `height` 固定
17
+
18
+ ## 安装
19
+
20
+ 组件库把 `vxe-table`、`vxe-pc-ui` 等声明为 peerDependencies,需要在使用方项目中一并安装:
21
+
22
+ ```bash
23
+ # pnpm
24
+ pnpm add dse-edit-table vxe-table@4.11.1 vxe-pc-ui @vxe-ui/plugin-menu
25
+
26
+ # npm
27
+ npm i dse-edit-table vxe-table@4.11.1 vxe-pc-ui @vxe-ui/plugin-menu
28
+ ```
29
+
30
+ > 需要 xlsx / html 导出时,额外安装 `vxe-table-plugin-export-xlsx` 与 `xlsx`,参考 [安装 · 可选导出插件](docs/guide/installation.md#可选导出插件)。
31
+
32
+ ## 快速开始
33
+
34
+ ```js
35
+ // main.js
36
+ import { createApp } from 'vue'
37
+ import App from './App.vue'
38
+ import DseEditTable from 'dse-edit-table'
39
+ import 'dse-edit-table/style.css'
40
+
41
+ createApp(App).use(DseEditTable).mount('#app')
42
+ ```
43
+
44
+ `use(DseEditTable)` 会同时完成三件事:安装 `vxe-pc-ui` 与 `vxe-table`、注册菜单/区域扩展插件、设置中文语言与图标,因此无需在使用方重复 `app.use(VxeTable)`。
45
+
46
+ ```vue
47
+ <template>
48
+ <DseEditTable v-model:data="tableData" v-model:columns="columns" />
49
+ </template>
50
+
51
+ <script setup>
52
+ import { ref } from 'vue'
53
+
54
+ const columns = [
55
+ { type: 'seq', title: '序号', width: 60 },
56
+ { field: 'name', title: '姓名', width: 120, editRender: { name: 'VxeInput' } },
57
+ { field: 'num', title: '数量', width: 100, editRender: { name: 'VxeNumberInput' } },
58
+ ]
59
+
60
+ const tableData = ref([
61
+ { name: '张三', num: 1 },
62
+ { name: '李四', num: 2 },
63
+ ])
64
+ </script>
65
+ ```
66
+
67
+ ## 文档
68
+
69
+ - 指南:[介绍](docs/guide/getting-started.md) · [安装](docs/guide/installation.md) · [快速上手](docs/guide/usage.md) · [FAQ 与已知问题](docs/guide/faq.md)
70
+ - 组件:[基础表格](docs/components/basic.md) · [列与插槽](docs/components/columns.md) · [可编辑表格](docs/components/edit.md) · [复制粘贴与区域操作](docs/components/copy-paste.md) · [右键菜单](docs/components/context-menu.md) · [API](docs/components/api.md)
71
+
72
+ 在线文档:`pnpm docs:dev`(本地预览),`pnpm docs:build`(构建)。
73
+
74
+ ## 本地开发
75
+
76
+ ```bash
77
+ pnpm install
78
+ pnpm build # 产出 dist/index.js、dist/index.cjs、dist/style.css
79
+ pnpm docs:dev # 文档站
80
+ pnpm test:run # 单元测试(vitest + jsdom)
81
+ ```
82
+
83
+ ## 目录结构
84
+
85
+ ```
86
+ packages/
87
+ ├── index.js # 库入口,install(app)
88
+ ├── components/
89
+ │ ├── DseEditTable/
90
+ │ │ ├── index.vue # 组件实现(渲染函数)
91
+ │ │ ├── props.js # defaultProps(prop 声明)+ defaultConfigs(内置默认值)
92
+ │ │ └── emit.js # 事件声明
93
+ │ └── __tests__/ # vitest 用例(配置合并、内置命令、变更采集)
94
+ ├── plugins/
95
+ │ ├── vxe-table.js # vxe 安装、国际化、菜单插件、区域扩展插件
96
+ │ └── VxeTable/ # vxe-table-extend-cell-area(区域扩展,商业插件产物)
97
+ └── theme/ # 预留主题样式目录
98
+ utils/merge.js # 浅合并 / 按 code 深合并工具
99
+ docs/ # VitePress 文档站
100
+ ```
101
+
102
+ ## 版本策略
103
+
104
+ - `1.2.0`:内置行/列命令改为不可变提交(新数组 + `update:data` / `update:columns`)、不再调用 `reloadData`、`DELETE_COLUMN` 按 `field` 定位、修复 `defaultProps()` 调用崩溃与 `gridId` 被 DOM 引用覆盖、补齐 prop `type`/`default`、新增默认右键菜单与单元测试。属于**行为变更**,依赖“引用不变 / 就地修改”的业务需回归
105
+ - `1.1.x` 适配 `vxe-table@4.11.1`;vxe-table 小版本升级后需要回归区域选择、右键菜单与编辑采集相关行为
106
+ - 组件库自身遵循 semver:新增内置默认值或改变合并语义会发布 minor 版本
107
+
108
+ ## License
109
+
110
+ [MIT](LICENSE)