@cimom/ci-web-plugins-commom 1.0.2 → 1.0.4
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.md +86 -5
- package/VxeTablePro.md +139 -0
- package/dist/CI.Web.Plugins.Commom.css +2 -1
- package/dist/HelloPlugin/index.js +1 -0
- package/dist/HelloWorld/index.js +1 -0
- package/dist/VxeGridPro/index.js +1 -0
- package/dist/VxeTablePro/index.js +1 -0
- package/dist/components/HelloPlugin.vue/index.js +1 -0
- package/dist/components/HelloPlugin.vue/index2.js +1 -0
- package/dist/components/HelloWorld.vue/index.js +1 -0
- package/dist/components/HelloWorld.vue/index2.js +1 -0
- package/dist/components/VxeGridPro/index.vue/index.js +1 -0
- package/dist/components/VxeGridPro/index.vue/index2.js +1 -0
- package/dist/components/VxeTablePro/index.vue/index.js +1 -0
- package/dist/components/VxeTablePro/index.vue/index2.js +1 -0
- package/dist/index/index.js +1 -0
- package/package.json +37 -10
- package/README.en.md +0 -83
- package/dist/CI.Web.Plugins.Commom.es.js +0 -110
- package/dist/CI.Web.Plugins.Commom.umd.js +0 -1
- package/dist/vite.svg +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# Vue3 插件模板
|
|
3
2
|
|
|
4
3
|
本项目为基于 Vite + Vue3 + JavaScript + TailwindCSS 的插件开发模板,适用于发布到 NPM。
|
|
@@ -6,8 +5,8 @@
|
|
|
6
5
|
## 快速开始
|
|
7
6
|
|
|
8
7
|
```bash
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
npm install @cimom/ci-web-plugins-commom
|
|
9
|
+
npm run dev
|
|
11
10
|
```
|
|
12
11
|
|
|
13
12
|
## 打包与发布
|
|
@@ -30,15 +29,97 @@ npm run build
|
|
|
30
29
|
```
|
|
31
30
|
> 建议发布前切换为 npm 官方源:`npm config set registry https://registry.npmjs.org/`
|
|
32
31
|
|
|
32
|
+
## 插件使用说明
|
|
33
|
+
|
|
34
|
+
### 1. NPM 安装方式
|
|
35
|
+
```bash
|
|
36
|
+
npm install @cimom/ci-web-plugins-commom
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### 在 Vue3 项目中使用
|
|
40
|
+
**全局注册:**
|
|
41
|
+
```js
|
|
42
|
+
// main.ts 或 main.js
|
|
43
|
+
import { createApp } from 'vue'
|
|
44
|
+
import App from './App.vue'
|
|
45
|
+
import { HelloPlugin, HelloWorld, VxeTablePro } from '@cimom/ci-web-plugins-commom'
|
|
46
|
+
import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
|
|
47
|
+
|
|
48
|
+
const app = createApp(App)
|
|
49
|
+
app.component('HelloPlugin', HelloPlugin)
|
|
50
|
+
app.component('HelloWorld', HelloWorld)
|
|
51
|
+
app.component('VxeTablePro', VxeTablePro)
|
|
52
|
+
app.mount('#app')
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**局部注册:**
|
|
56
|
+
```vue
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import { HelloPlugin, HelloWorld, VxeTablePro } from '@cimom/ci-web-plugins-commom'
|
|
59
|
+
import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<HelloPlugin msg1="Vite + Vue" />
|
|
64
|
+
<HelloWorld msg="Vite222 + Vue" />
|
|
65
|
+
<VxeTablePro />
|
|
66
|
+
</template>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. 本地 dist 产物直接引入
|
|
70
|
+
|
|
71
|
+
#### ESM 方式
|
|
72
|
+
```js
|
|
73
|
+
import { HelloPlugin, HelloWorld, VxeTablePro } from './dist/CI.Web.Plugins.Commom.es.js'
|
|
74
|
+
import './dist/CI.Web.Plugins.Commom.css'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### UMD 方式(适合 script 标签直接引入)
|
|
78
|
+
```html
|
|
79
|
+
<script src="./dist/CI.Web.Plugins.Commom.umd.js"></script>
|
|
80
|
+
<link rel="stylesheet" href="./dist/CI.Web.Plugins.Commom.css" />
|
|
81
|
+
<script>
|
|
82
|
+
const { HelloPlugin, HelloWorld, VxeTablePro } = window.CIWebPluginsCommom;
|
|
83
|
+
// 通过 window.CIWebPluginsCommom 访问导出组件
|
|
84
|
+
</script>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
> **注意:**
|
|
88
|
+
> - 组件名称和导出对象以实际 dist 产物为准。
|
|
89
|
+
> - 样式文件需手动引入。
|
|
90
|
+
|
|
91
|
+
### 3. 单独引入组件(推荐)
|
|
92
|
+
|
|
93
|
+
自 v1.0.4+ 起,支持通过 `exports` 字段单独引入组件:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import HelloPlugin from '@cimom/ci-web-plugins-commom/HelloPlugin'
|
|
97
|
+
import VxeTablePro from '@cimom/ci-web-plugins-commom/VxeTablePro'
|
|
98
|
+
import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- 只会打包用到的组件,减少体积。
|
|
102
|
+
- 也可用于局部注册:
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<script setup>
|
|
106
|
+
import HelloWorld from '@cimom/ci-web-plugins-commom/HelloWorld'
|
|
107
|
+
</script>
|
|
108
|
+
<template>
|
|
109
|
+
<HelloWorld msg="单独引入" />
|
|
110
|
+
</template>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
> 依赖 `package.json` 的 `exports` 字段,需升级到支持该特性的 npm/yarn 版本。
|
|
114
|
+
|
|
33
115
|
### NPM 用户使用方式
|
|
34
116
|
```bash
|
|
35
117
|
npm install @cimom/ci-web-plugins-commom
|
|
36
118
|
```
|
|
37
119
|
在项目入口引入:
|
|
38
120
|
```js
|
|
39
|
-
import
|
|
121
|
+
import {HelloPlugin,HelloWorld} from '@cimom/ci-web-plugins-commom'
|
|
40
122
|
import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
|
|
41
|
-
//app.use(YourPlugin)
|
|
42
123
|
```
|
|
43
124
|
## 实际使用案例:
|
|
44
125
|
import { HelloPlugin,HelloWorld } from './testPlugins/vxetable/CI.Web.Plugins.Commom.es.js'
|
package/VxeTablePro.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# VxeTablePro 组件使用说明
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
`VxeTablePro` 是基于 Vue3 + JavaScript 的表格插件模板,集成了 SCSS、CSS、TailwindCSS,适用于 NPM 发布。该组件对 [vxe-table](https://x-extends.github.io/vxe-table/) 进行了二次封装,支持统一扩展功能配置,便于业务快速集成和后续扩展。
|
|
5
|
+
|
|
6
|
+
## 安装
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install ci-web-plugins-commom-vxetable
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
或直接复制 `src/components/VxeTablePro` 目录到你的项目中。
|
|
13
|
+
|
|
14
|
+
## 使用方法
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<script setup>
|
|
18
|
+
import VxeTablePro from 'ci-web-plugins-commom-vxetable/src/components/VxeTablePro'
|
|
19
|
+
|
|
20
|
+
const columns = [
|
|
21
|
+
{ field: 'name', title: '姓名' },
|
|
22
|
+
{ field: 'age', title: '年龄' }
|
|
23
|
+
]
|
|
24
|
+
const data = [
|
|
25
|
+
{ name: '张三', age: 18 },
|
|
26
|
+
{ name: '李四', age: 20 }
|
|
27
|
+
]
|
|
28
|
+
const proOptions = {
|
|
29
|
+
align: 'center' // 统一设置所有列的对齐方式
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<VxeTablePro :columns="columns" :data="data" :proOptions="proOptions" />
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 插槽支持
|
|
39
|
+
|
|
40
|
+
所有 `vxe-grid` 插槽均可透传,使用方式与原生一致:
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<VxeTablePro ...>
|
|
44
|
+
<template #toolbar_buttons>
|
|
45
|
+
<button>自定义按钮</button>
|
|
46
|
+
</template>
|
|
47
|
+
</VxeTablePro>
|
|
48
|
+
```
|
|
49
|
+
```
|
|
50
|
+
<script setup>
|
|
51
|
+
// import VxeTablePro from '../../components/VxeTablePro/index.vue'
|
|
52
|
+
//import { VxeTablePro } from '@/testPlugins/JS-dll/CI.Web.Plugins.Commom.es.js'
|
|
53
|
+
import { VxeTablePro } from '@cimom/ci-web-plugins-commom'
|
|
54
|
+
import { reactive,ref } from 'vue'
|
|
55
|
+
const gridOptions = reactive({
|
|
56
|
+
columns: [
|
|
57
|
+
{ type: 'seq', width: 70 },
|
|
58
|
+
{ field: 'name', title: 'Name111' ,slots: { header: 'header_name' }},
|
|
59
|
+
{ field: 'sex', title: 'Sex' },
|
|
60
|
+
{ field: 'age', title: 'Age' }
|
|
61
|
+
],
|
|
62
|
+
data: [
|
|
63
|
+
{ id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
|
|
64
|
+
{ id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
|
|
65
|
+
{ id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
|
|
66
|
+
{ id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' }
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<VxeTablePro
|
|
73
|
+
:stripe="true"
|
|
74
|
+
:border="false"
|
|
75
|
+
:rowConfig="{
|
|
76
|
+
isCurrent: true,
|
|
77
|
+
isHover: true
|
|
78
|
+
}"
|
|
79
|
+
:columns="gridOptions.columns"
|
|
80
|
+
:data="gridOptions.data"
|
|
81
|
+
:proOptions="{ align: 'left' }"
|
|
82
|
+
>
|
|
83
|
+
<template #top>
|
|
84
|
+
hello top template
|
|
85
|
+
</template>
|
|
86
|
+
<template #header_name>
|
|
87
|
+
<div class="first-col">
|
|
88
|
+
<div class="first-col-top">名称1</div>
|
|
89
|
+
<div class="first-col-bottom">序号2</div>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
92
|
+
<template #bottom>
|
|
93
|
+
hello bottom template
|
|
94
|
+
</template>
|
|
95
|
+
</VxeTablePro>
|
|
96
|
+
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<style scoped>
|
|
100
|
+
|
|
101
|
+
</style>
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
## 属性说明
|
|
106
|
+
|
|
107
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
108
|
+
| ----------- | -------------------------- | ------- | -------- |
|
|
109
|
+
| columns | 表格列配置 | Array | [] |
|
|
110
|
+
| data | 表格数据 | Array | [] |
|
|
111
|
+
| proOptions | 扩展功能配置(如统一对齐) | Object | {} |
|
|
112
|
+
| ... | 透传 vxe-grid 所有原有属性 | | |
|
|
113
|
+
|
|
114
|
+
### proOptions 扩展
|
|
115
|
+
- `align`:统一设置所有列的对齐方式(如 'left'、'center'、'right')。
|
|
116
|
+
|
|
117
|
+
## 后续功能扩展建议
|
|
118
|
+
|
|
119
|
+
1. **更多 proOptions 扩展**:
|
|
120
|
+
- 支持统一设置列宽、表头样式、排序、筛选等。
|
|
121
|
+
- 支持自定义渲染函数、格式化函数等。
|
|
122
|
+
2. **类型增强**:
|
|
123
|
+
- 完善 JavaScript 类型定义,提升开发体验。
|
|
124
|
+
3. **主题与样式**:
|
|
125
|
+
- 支持多主题切换,集成更多 TailwindCSS 实用样式。
|
|
126
|
+
4. **国际化支持**:
|
|
127
|
+
- 提供多语言配置,适配不同地区需求。
|
|
128
|
+
5. **事件透传与增强**:
|
|
129
|
+
- 支持更多事件的透传与自定义事件扩展。
|
|
130
|
+
6. **性能优化**:
|
|
131
|
+
- 针对大数据量表格进行虚拟滚动等优化。
|
|
132
|
+
|
|
133
|
+
## 贡献与反馈
|
|
134
|
+
|
|
135
|
+
欢迎提交 issue 或 PR,提出你的建议和需求!
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
> 本项目为 Vue3+JavaScript 插件模板,适用于 NPM 发布,欢迎二次开发和定制。
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
/*! tailwindcss v4.1.10 | MIT License | https://tailwindcss.com */.flex{display:flex}.flex-col{flex-direction:column}.justify-center{justify-content:center}.border{border-style:var(--tw-border-style);border-width:1px}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-border-style:solid}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../components/HelloPlugin.vue/index.js";export{default}from"../components/HelloPlugin.vue/index2.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../components/HelloWorld.vue/index.js";export{default}from"../components/HelloWorld.vue/index2.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../components/VxeGridPro/index.vue/index.js";export{default}from"../components/VxeGridPro/index.vue/index2.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../components/VxeTablePro/index.vue/index.js";export{default}from"../components/VxeTablePro/index.vue/index2.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./index2.js";e.__file="src/components/HelloPlugin.vue";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{reactive as e,ref as s,resolveComponent as a,createElementBlock as t,openBlock as n,createVNode as l,normalizeProps as r,guardReactiveProps as d}from"vue";const i={class:"card flex flex-col justify-center"};var o={__name:"HelloPlugin",props:{msg1:String},setup(o){const g=e({columns:[{type:"seq",width:70},{field:"name",title:"Name"},{field:"sex",title:"Sex"},{field:"age",title:"Age"}],data:[{id:10001,name:"Test1",role:"Develop",sex:"Man",age:28,address:"test abc"},{id:10002,name:"Test2",role:"Test",sex:"Women",age:22,address:"Guangzhou"},{id:10003,name:"Test3",role:"PM",sex:"Man",age:32,address:"Shanghai"},{id:10004,name:"Test4",role:"Designer",sex:"Women",age:24,address:"Shanghai"}]});return s(0),(e,s)=>{const o=a("vxe-grid");return n(),t("div",i,[l(o,r(d(g)),null,16)])}}};export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./index2.js";e.__file="src/components/HelloWorld.vue";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{reactive as e,ref as s,resolveComponent as a,createElementBlock as t,openBlock as r,createVNode as d,normalizeProps as n,guardReactiveProps as l}from"vue";const o={class:"card border text-red-200 flex flex-col justify-center"};var i={__name:"HelloWorld",props:{msg:String},setup(i){const g=e({columns:[{type:"seq",width:70},{field:"name",title:"Name"},{field:"sex",title:"Sex"},{field:"age",title:"Age"}],data:[{id:10001,name:"Test1",role:"Develop",sex:"Man",age:28,address:"test abc"},{id:10002,name:"Test2",role:"Test",sex:"Women",age:22,address:"Guangzhou"},{id:10003,name:"Test3",role:"PM",sex:"Man",age:32,address:"Shanghai"},{id:10004,name:"Test4",role:"Designer",sex:"Women",age:24,address:"Shanghai"}]});return s(0),(e,s)=>{const i=a("vxe-grid");return r(),t("div",o,[d(i,n(l(g)),null,16)])}}};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./index2.js";e.__scopeId="data-v-9a040c52",e.__file="src/components/VxeGridPro/index.vue";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{computed as n,useAttrs as r,resolveComponent as o,createElementBlock as s,openBlock as a,Fragment as e,createCommentVNode as l,createVNode as t,normalizeProps as p,guardReactiveProps as u,createSlots as i,renderList as m,withCtx as c,renderSlot as d}from"vue";var g={__name:"index",props:{columns:Array,data:Array,proOptions:{type:Object,default:()=>({})}},setup(g){const v=g,f=n((()=>v.proOptions.align?v.columns?.map((n=>({...n,align:n.align||v.proOptions.align}))):v.columns)),O=r(),x={border:!0,stripe:!0,size:"small"},y=n((()=>({...x,...v,...O,columns:f.value})));return(n,r)=>{const g=o("vxe-grid");return a(),s(e,null,[l(" 透传所有属性,合并扩展功能 "),t(g,p(u(y.value)),i({_:2},[m(n.$slots,((r,o)=>({name:o,fn:c((r=>[d(n.$slots,o,p(u(r)))]))})))]),1040)],2112)}}};export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./index2.js";e.__scopeId="data-v-cb836df6",e.__file="src/components/VxeTablePro/index.vue";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useAttrs as e,useSlots as r,computed as s,ref as t,resolveComponent as o,createBlock as a,openBlock as n,mergeProps as l,toHandlers as f,unref as p,createSlots as u,renderList as m,withCtx as v,renderSlot as i,normalizeProps as x,guardReactiveProps as _}from"vue";var b={__name:"index",props:{},setup(b){const c={border:!0,stripe:!0,size:"small"},d=b,$=e();r();const k=s((()=>({...c,...d,...$}))),y=$,z=t();return(e,r)=>{const s=o("vxe-table");return n(),a(s,l(k.value,f(p(y)),{ref_key:"vxeTableRef",ref:z}),u({_:2},[m(e.$slots,((r,s)=>({name:s,fn:v((r=>[i(e.$slots,s,x(_(r)))]))})))]),1040)}}};export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../components/HelloPlugin.vue/index.js";import"../components/HelloWorld.vue/index.js";import"../components/VxeGridPro/index.vue/index.js";import"../components/VxeTablePro/index.vue/index.js";import o from"../components/HelloPlugin.vue/index2.js";import e from"../components/HelloWorld.vue/index2.js";import n from"../components/VxeGridPro/index.vue/index2.js";import l from"../components/VxeTablePro/index.vue/index2.js";var r={install(r){r.component("HelloPlugin",o),r.component("HelloWorld",e),r.component("VxeGridPro",n),r.component("VxeTablePro",l)}};export{o as HelloPlugin,e as HelloWorld,n as VxeGridPro,l as VxeTablePro,r as default};
|
package/package.json
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cimom/ci-web-plugins-commom",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "Andy Huang",
|
|
7
8
|
"email": "57237184@qq.com"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"*.md"
|
|
11
13
|
],
|
|
12
14
|
"type": "module",
|
|
13
15
|
"scripts": {
|
|
14
16
|
"dev": "vite",
|
|
15
|
-
"build": "
|
|
17
|
+
"build": "rollup -c rollup.config.js",
|
|
18
|
+
"buildvite": "vue-tsc -b && vite build",
|
|
16
19
|
"lib": "vite build --config vite.config.ts",
|
|
17
20
|
"preview": "vite preview"
|
|
18
21
|
},
|
|
19
22
|
"main": "dist/CI.Web.Plugins.Commom.umd.js",
|
|
20
23
|
"module": "dist/CI.Web.Plugins.Commom.es.js",
|
|
21
|
-
"
|
|
22
|
-
"access": "public"
|
|
23
|
-
},
|
|
24
|
-
"peerDependencies":{
|
|
24
|
+
"peerDependencies": {
|
|
25
25
|
"vue": "^3.5.13",
|
|
26
26
|
"vxe-table": "4.13.37"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"vue": "^3.5.13",
|
|
30
|
-
"vxe-table": "4.13.37",
|
|
31
29
|
"@tailwindcss/postcss": "^4.1.8",
|
|
32
30
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
33
31
|
"@vue/tsconfig": "^0.7.0",
|
|
@@ -38,6 +36,35 @@
|
|
|
38
36
|
"typescript": "~5.8.3",
|
|
39
37
|
"vite": "^6.3.5",
|
|
40
38
|
"vite-plugin-lazy-import": "^1.0.7",
|
|
41
|
-
"vue
|
|
39
|
+
"vue": "^3.5.13",
|
|
40
|
+
"vue-tsc": "^2.2.8",
|
|
41
|
+
"vxe-table": "4.13.37",
|
|
42
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
44
|
+
"rollup": "^4.43.0",
|
|
45
|
+
"rollup-plugin-css-only": "^4.5.2",
|
|
46
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
47
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
48
|
+
"rollup-plugin-vue": "^6.0.0"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"exports": {
|
|
54
|
+
".": {
|
|
55
|
+
"import": "./dist/index/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./HelloPlugin": {
|
|
58
|
+
"import": "./dist/HelloPlugin/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./HelloWorld": {
|
|
61
|
+
"import": "./dist/HelloWorld/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./VxeTablePro": {
|
|
64
|
+
"import": "./dist/VxeTablePro/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./VxeGridPro": {
|
|
67
|
+
"import": "./dist/VxeGridPro/index.js"
|
|
68
|
+
}
|
|
42
69
|
}
|
|
43
70
|
}
|
package/README.en.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# Vue3 插件模板
|
|
3
|
-
|
|
4
|
-
本项目为基于 Vite + Vue3 + JavaScript + TailwindCSS 的插件开发模板,适用于发布到 NPM。
|
|
5
|
-
|
|
6
|
-
## 快速开始
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
cnpm install
|
|
10
|
-
cnpm run dev
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## 打包与发布
|
|
14
|
-
|
|
15
|
-
### 打包
|
|
16
|
-
```bash
|
|
17
|
-
npm run build
|
|
18
|
-
```
|
|
19
|
-
打包产物会输出到 `dist/` 目录,包括:
|
|
20
|
-
- `CI.Web.Plugins.Commom.umd.js` (UMD 格式,适合直接 script 标签引用)
|
|
21
|
-
- `CI.Web.Plugins.Commom.es.js` (ESM 格式,适合现代打包工具)
|
|
22
|
-
- `ci.web.plugins.commom.css` (包含所有 TailwindCSS 原子类和自定义样式)
|
|
23
|
-
|
|
24
|
-
### 发布到 NPM
|
|
25
|
-
1. 修改 `package.json` 中的 `name`、`version`、`description` 等信息。
|
|
26
|
-
2. 确认 `main`、`module`、`types` 字段已指向 `dist/` 下的对应文件。
|
|
27
|
-
3. 执行:
|
|
28
|
-
```bash
|
|
29
|
-
npm publish --access public
|
|
30
|
-
```
|
|
31
|
-
> 建议发布前切换为 npm 官方源:`npm config set registry https://registry.npmjs.org/`
|
|
32
|
-
|
|
33
|
-
### NPM 用户使用方式
|
|
34
|
-
```bash
|
|
35
|
-
npm install <your-plugin-name>
|
|
36
|
-
```
|
|
37
|
-
在项目入口引入:
|
|
38
|
-
```js
|
|
39
|
-
import YourPlugin from '<your-plugin-name>'
|
|
40
|
-
import '<your-plugin-name>/dist/CI.Web.Plugins.Commom.css'
|
|
41
|
-
app.use(YourPlugin)
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
## 实际使用案例:
|
|
45
|
-
import { HelloPlugin,HelloWorld } from './testPlugins/vxetable/CI.Web.Plugins.Commom.es.js'
|
|
46
|
-
```
|
|
47
|
-
<script setup>
|
|
48
|
-
// import HelloPlugin from './components/HelloPlugin.vue'
|
|
49
|
-
// import HelloWorld from './components/HelloWorld.vue'
|
|
50
|
-
import { HelloPlugin,HelloWorld } from './testPlugins/vxetable/CI.Web.Plugins.Commom.es.js'
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<HelloPlugin msg1="Vite + Vue" />
|
|
55
|
-
<HelloWorld msg="Vite222 + Vue" />
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<style scoped>
|
|
59
|
-
|
|
60
|
-
</style>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## 注意事项
|
|
64
|
-
- `main`、`module`、`types` 字段必须指向 `dist/` 下的构建产物,不能指向 `src/`。
|
|
65
|
-
- 发布前请确保已执行 `npm run build`,并包含 `dist/` 目录。
|
|
66
|
-
- TailwindCSS 原子类会自动按组件使用情况生成,无需手动引入。
|
|
67
|
-
- 如需自定义样式,请在 `src/index.css` 中添加。
|
|
68
|
-
- 推荐在 `peerDependencies` 中声明 `vue` 版本要求。
|
|
69
|
-
|
|
70
|
-
## 主要特性
|
|
71
|
-
- Vue3 组件开发
|
|
72
|
-
- JavaScript 支持
|
|
73
|
-
- TailwindCSS 集成
|
|
74
|
-
- 可直接作为插件发布
|
|
75
|
-
|
|
76
|
-
## 目录结构
|
|
77
|
-
- `src/index.ts` 插件入口
|
|
78
|
-
- `src/index.css` 插件样式入口
|
|
79
|
-
|
|
80
|
-
## 参考
|
|
81
|
-
- [Vite](https://vitejs.dev/)
|
|
82
|
-
- [Vue3](https://vuejs.org/)
|
|
83
|
-
- [TailwindCSS](https://tailwindcss.com/)
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { reactive as p, ref as u, resolveComponent as d, createElementBlock as _, openBlock as c, createVNode as x, normalizeProps as a, guardReactiveProps as l, computed as g, useAttrs as v, createBlock as T, createSlots as S, renderList as P, withCtx as b, renderSlot as y } from "vue";
|
|
2
|
-
const O = { class: "card flex flex-col justify-center" }, W = {
|
|
3
|
-
__name: "HelloPlugin",
|
|
4
|
-
props: {
|
|
5
|
-
msg1: String
|
|
6
|
-
},
|
|
7
|
-
setup(t) {
|
|
8
|
-
const e = p({
|
|
9
|
-
columns: [
|
|
10
|
-
{ type: "seq", width: 70 },
|
|
11
|
-
{ field: "name", title: "Name" },
|
|
12
|
-
{ field: "sex", title: "Sex" },
|
|
13
|
-
{ field: "age", title: "Age" }
|
|
14
|
-
],
|
|
15
|
-
data: [
|
|
16
|
-
{ id: 10001, name: "Test1", role: "Develop", sex: "Man", age: 28, address: "test abc" },
|
|
17
|
-
{ id: 10002, name: "Test2", role: "Test", sex: "Women", age: 22, address: "Guangzhou" },
|
|
18
|
-
{ id: 10003, name: "Test3", role: "PM", sex: "Man", age: 32, address: "Shanghai" },
|
|
19
|
-
{ id: 10004, name: "Test4", role: "Designer", sex: "Women", age: 24, address: "Shanghai" }
|
|
20
|
-
]
|
|
21
|
-
});
|
|
22
|
-
return u(0), (n, o) => {
|
|
23
|
-
const s = d("vxe-grid");
|
|
24
|
-
return c(), _("div", O, [
|
|
25
|
-
x(s, a(l(e)), null, 16)
|
|
26
|
-
]);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}, H = { class: "card border text-red-200 flex flex-col justify-center" }, M = {
|
|
30
|
-
__name: "HelloWorld",
|
|
31
|
-
props: {
|
|
32
|
-
msg: String
|
|
33
|
-
},
|
|
34
|
-
setup(t) {
|
|
35
|
-
const e = p({
|
|
36
|
-
columns: [
|
|
37
|
-
{ type: "seq", width: 70 },
|
|
38
|
-
{ field: "name", title: "Name" },
|
|
39
|
-
{ field: "sex", title: "Sex" },
|
|
40
|
-
{ field: "age", title: "Age" }
|
|
41
|
-
],
|
|
42
|
-
data: [
|
|
43
|
-
{ id: 10001, name: "Test1", role: "Develop", sex: "Man", age: 28, address: "test abc" },
|
|
44
|
-
{ id: 10002, name: "Test2", role: "Test", sex: "Women", age: 22, address: "Guangzhou" },
|
|
45
|
-
{ id: 10003, name: "Test3", role: "PM", sex: "Man", age: 32, address: "Shanghai" },
|
|
46
|
-
{ id: 10004, name: "Test4", role: "Designer", sex: "Women", age: 24, address: "Shanghai" }
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
return u(0), (n, o) => {
|
|
50
|
-
const s = d("vxe-grid");
|
|
51
|
-
return c(), _("div", H, [
|
|
52
|
-
x(s, a(l(e)), null, 16)
|
|
53
|
-
]);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}, A = (t, e) => {
|
|
57
|
-
const n = t.__vccOpts || t;
|
|
58
|
-
for (const [o, s] of e)
|
|
59
|
-
n[o] = s;
|
|
60
|
-
return n;
|
|
61
|
-
}, $ = {
|
|
62
|
-
__name: "index",
|
|
63
|
-
props: {
|
|
64
|
-
// vxetable 原有属性(如 columns、data、等)
|
|
65
|
-
columns: Array,
|
|
66
|
-
data: Array,
|
|
67
|
-
// ...可继续补充常用属性
|
|
68
|
-
// 扩展属性
|
|
69
|
-
proOptions: {
|
|
70
|
-
type: Object,
|
|
71
|
-
default: () => ({})
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
setup(t) {
|
|
75
|
-
const e = t, n = g(() => {
|
|
76
|
-
var r;
|
|
77
|
-
return e.proOptions.align ? (r = e.columns) == null ? void 0 : r.map((i) => ({
|
|
78
|
-
...i,
|
|
79
|
-
align: i.align || e.proOptions.align
|
|
80
|
-
})) : e.columns;
|
|
81
|
-
}), o = v(), s = g(() => ({
|
|
82
|
-
border: !0,
|
|
83
|
-
// 默认设置边框,外置优先可以覆盖内置属性
|
|
84
|
-
...e,
|
|
85
|
-
...o,
|
|
86
|
-
columns: n.value
|
|
87
|
-
}));
|
|
88
|
-
return (r, i) => {
|
|
89
|
-
const f = d("vxe-grid");
|
|
90
|
-
return c(), T(f, a(l(s.value)), S({ _: 2 }, [
|
|
91
|
-
P(r.$slots, (D, m) => ({
|
|
92
|
-
name: m,
|
|
93
|
-
fn: b((h) => [
|
|
94
|
-
y(r.$slots, m, a(l(h)), void 0, !0)
|
|
95
|
-
])
|
|
96
|
-
}))
|
|
97
|
-
]), 1040);
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}, k = /* @__PURE__ */ A($, [["__scopeId", "data-v-34a3b5ff"]]), w = {
|
|
101
|
-
install(t) {
|
|
102
|
-
t.component("HelloPlugin", W), t.component("HelloWorld", M), t.component("VxeTablePro", k);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
export {
|
|
106
|
-
W as HelloPlugin,
|
|
107
|
-
M as HelloWorld,
|
|
108
|
-
k as VxeTablePro,
|
|
109
|
-
w as default
|
|
110
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis<"u"?globalThis:t||self,e((t.CI=t.CI||{},t.CI.Web=t.CI.Web||{},t.CI.Web.Plugins=t.CI.Web.Plugins||{},t.CI.Web.Plugins.Commom={}),t.Vue))})(this,function(t,e){"use strict";const _={class:"card flex flex-col justify-center"},l={__name:"HelloPlugin",props:{msg1:String},setup(o){const n=e.reactive({columns:[{type:"seq",width:70},{field:"name",title:"Name"},{field:"sex",title:"Sex"},{field:"age",title:"Age"}],data:[{id:10001,name:"Test1",role:"Develop",sex:"Man",age:28,address:"test abc"},{id:10002,name:"Test2",role:"Test",sex:"Women",age:22,address:"Guangzhou"},{id:10003,name:"Test3",role:"PM",sex:"Man",age:32,address:"Shanghai"},{id:10004,name:"Test4",role:"Designer",sex:"Women",age:24,address:"Shanghai"}]});return e.ref(0),(r,a)=>{const s=e.resolveComponent("vxe-grid");return e.openBlock(),e.createElementBlock("div",_,[e.createVNode(s,e.normalizeProps(e.guardReactiveProps(n)),null,16)])}}},g={class:"card border text-red-200 flex flex-col justify-center"},c={__name:"HelloWorld",props:{msg:String},setup(o){const n=e.reactive({columns:[{type:"seq",width:70},{field:"name",title:"Name"},{field:"sex",title:"Sex"},{field:"age",title:"Age"}],data:[{id:10001,name:"Test1",role:"Develop",sex:"Man",age:28,address:"test abc"},{id:10002,name:"Test2",role:"Test",sex:"Women",age:22,address:"Guangzhou"},{id:10003,name:"Test3",role:"PM",sex:"Man",age:32,address:"Shanghai"},{id:10004,name:"Test4",role:"Designer",sex:"Women",age:24,address:"Shanghai"}]});return e.ref(0),(r,a)=>{const s=e.resolveComponent("vxe-grid");return e.openBlock(),e.createElementBlock("div",g,[e.createVNode(s,e.normalizeProps(e.guardReactiveProps(n)),null,16)])}}},m=((o,n)=>{const r=o.__vccOpts||o;for(const[a,s]of n)r[a]=s;return r})({__name:"index",props:{columns:Array,data:Array,proOptions:{type:Object,default:()=>({})}},setup(o){const n=o,r=e.computed(()=>{var i;return n.proOptions.align?(i=n.columns)==null?void 0:i.map(d=>({...d,align:d.align||n.proOptions.align})):n.columns}),a=e.useAttrs(),s=e.computed(()=>({border:!0,...n,...a,columns:r.value}));return(i,d)=>{const u=e.resolveComponent("vxe-grid");return e.openBlock(),e.createBlock(u,e.normalizeProps(e.guardReactiveProps(s.value)),e.createSlots({_:2},[e.renderList(i.$slots,(T,p)=>({name:p,fn:e.withCtx(x=>[e.renderSlot(i.$slots,p,e.normalizeProps(e.guardReactiveProps(x)),void 0,!0)])}))]),1040)}}},[["__scopeId","data-v-34a3b5ff"]]),f={install(o){o.component("HelloPlugin",l),o.component("HelloWorld",c),o.component("VxeTablePro",m)}};t.HelloPlugin=l,t.HelloWorld=c,t.VxeTablePro=m,t.default=f,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/vite.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|