@cimom/ci-web-plugins-commom 1.0.3 → 1.0.5

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 CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  # Vue3 插件模板
3
2
 
4
3
  本项目为基于 Vite + Vue3 + JavaScript + TailwindCSS 的插件开发模板,适用于发布到 NPM。
@@ -6,8 +5,7 @@
6
5
  ## 快速开始
7
6
 
8
7
  ```bash
9
- cnpm install
10
- cnpm run dev
8
+ npm install @cimom/ci-web-plugins-commom
11
9
  ```
12
10
 
13
11
  ## 打包与发布
@@ -16,37 +14,106 @@ cnpm run dev
16
14
  ```bash
17
15
  npm run build
18
16
  ```
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
17
 
24
18
  ### 发布到 NPM
25
19
  1. 修改 `package.json` 中的 `name`、`version`、`description` 等信息。
26
20
  2. 确认 `main`、`module`、`types` 字段已指向 `dist/` 下的对应文件。
27
21
  3. 执行:
28
22
  ```bash
29
- npm publish --access public
23
+ npm publish
30
24
  ```
31
25
  > 建议发布前切换为 npm 官方源:`npm config set registry https://registry.npmjs.org/`
32
26
 
27
+ ## 插件使用说明
28
+
29
+ ### 1. NPM 安装方式
30
+ ```bash
31
+ npm install @cimom/ci-web-plugins-commom
32
+ ```
33
+
34
+ #### 在 Vue3 项目中使用
35
+ **全局注册:**
36
+ ```js
37
+ // main.ts 或 main.js
38
+ import { createApp } from 'vue'
39
+ import App from './App.vue'
40
+ import { HelloPlugin, HelloWorld, VxeTablePro } from '@cimom/ci-web-plugins-commom'
41
+ import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
42
+
43
+ const app = createApp(App)
44
+ app.component('HelloPlugin', HelloPlugin)
45
+ app.component('HelloWorld', HelloWorld)
46
+ app.component('VxeTablePro', VxeTablePro)
47
+ app.mount('#app')
48
+ ```
49
+
50
+ **局部注册:**
51
+ ```vue
52
+ <script setup>
53
+ import { HelloPlugin, HelloWorld, VxeTablePro } from '@cimom/ci-web-plugins-commom'
54
+ import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
55
+ </script>
56
+
57
+ <template>
58
+ <HelloPlugin msg1="Vite + Vue" />
59
+ <HelloWorld msg="Vite222 + Vue" />
60
+ <VxeTablePro />
61
+ </template>
62
+ ```
63
+
64
+
65
+ #### UMD 方式(适合 script 标签直接引入)
66
+ ```html
67
+ <script src="./dist/CI.Web.Plugins.Commom.umd.js"></script>
68
+ <link rel="stylesheet" href="./dist/CI.Web.Plugins.Commom.css" />
69
+ <script>
70
+ const { HelloPlugin, HelloWorld, VxeTablePro } = window.CIWebPluginsCommom;
71
+ // 通过 window.CIWebPluginsCommom 访问导出组件
72
+ </script>
73
+ ```
74
+
75
+ > **注意:**
76
+ > - 组件名称和导出对象以实际 dist 产物为准。
77
+ > - 样式文件需手动引入。
78
+
79
+ ### 3. 单独引入组件(推荐)
80
+
81
+ 自 v1.0.4+ 起,支持通过 `exports` 字段单独引入组件:
82
+
83
+ ```js
84
+ import HelloPlugin from '@cimom/ci-web-plugins-commom/HelloPlugin'
85
+ import VxeTablePro from '@cimom/ci-web-plugins-commom/VxeTablePro'
86
+ import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
87
+ ```
88
+
89
+ - 只会打包用到的组件,减少体积。
90
+ - 也可用于局部注册:
91
+
92
+ ```vue
93
+ <script setup>
94
+ import HelloWorld from '@cimom/ci-web-plugins-commom/HelloWorld'
95
+ </script>
96
+ <template>
97
+ <HelloWorld msg="单独引入" />
98
+ </template>
99
+ ```
100
+
101
+ > 依赖 `package.json` 的 `exports` 字段,需升级到支持该特性的 npm/yarn 版本。
102
+
33
103
  ### NPM 用户使用方式
34
104
  ```bash
35
105
  npm install @cimom/ci-web-plugins-commom
36
106
  ```
37
107
  在项目入口引入:
38
108
  ```js
39
- import YourPlugin from '@cimom/ci-web-plugins-commom'
109
+ import {HelloPlugin,HelloWorld} from '@cimom/ci-web-plugins-commom'
40
110
  import '@cimom/ci-web-plugins-commom/dist/CI.Web.Plugins.Commom.css'
41
- //app.use(YourPlugin)
42
111
  ```
43
- ## 实际使用案例:
44
- import { HelloPlugin,HelloWorld } from './testPlugins/vxetable/CI.Web.Plugins.Commom.es.js'
112
+ ## 开发使用案例:
45
113
  ```
46
114
  <script setup>
47
- // import HelloPlugin from './components/HelloPlugin.vue'
48
- // import HelloWorld from './components/HelloWorld.vue'
49
- import { HelloPlugin,HelloWorld,VxeTablePro } from './testPlugins/vxetable/CI.Web.Plugins.Commom.es.js'
115
+ import HelloPlugin from './components/HelloPlugin.vue'
116
+ import HelloWorld from './components/HelloWorld.vue'
50
117
  </script>
51
118
 
52
119
  <template>
@@ -1 +1,2 @@
1
- /*! tailwindcss v4.1.10 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid}}}.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}
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,61 @@
1
+ # VxeGridPro 组件使用说明
2
+
3
+ ## 简介
4
+ `VxeGridPro` 是基于 Vue3 + TypeScript 的表格插件模板,集成了 SCSS、CSS、TailwindCSS,适用于 NPM 发布。该组件对 [vxe-table](https://x-extends.github.io/vxe-table/) 进行了二次封装,支持统一扩展功能配置,便于业务快速集成和后续扩展。
5
+
6
+ ## 安装
7
+
8
+ ```bash
9
+ npm install @cimom/ci-web-plugins-commom
10
+ ```
11
+
12
+ ## 使用方法
13
+
14
+ ```vue
15
+ <script setup>
16
+ import VxeGridPro from '@cimom/ci-web-plugins-commom/VxeGridPro'
17
+ import { reactive } from 'vue'
18
+ const gridOptions = reactive({
19
+ columns: [
20
+ { type: 'seq', width: 70 },
21
+ { field: 'name', title: '姓名', slots: { header: 'header_name' } },
22
+ { field: 'sex', title: '性别' },
23
+ { field: 'age', title: '年龄' }
24
+ ],
25
+ data: [
26
+ { id: 10001, name: '张三', sex: '男', age: 28 },
27
+ { id: 10002, name: '李四', sex: '女', age: 22 }
28
+ ]
29
+ })
30
+ function currentRowChange(params) {
31
+ alert(params.row.name)
32
+ }
33
+ </script>
34
+
35
+ <template>
36
+ <VxeGridPro
37
+ @current-row-change="currentRowChange"
38
+ :stripe="true"
39
+ :border="false"
40
+ :rowConfig="{ isCurrent: true, isHover: true }"
41
+ :columns="gridOptions.columns"
42
+ :data="gridOptions.data"
43
+ :proOptions="{ align: 'left' }"
44
+ >
45
+ <template #top>
46
+ hello top template
47
+ </template>
48
+ <template #header_name>
49
+ <span style="color: red">自定义表头</span>
50
+ </template>
51
+ </VxeGridPro>
52
+ </template>
53
+ ```
54
+
55
+ ### 插槽支持
56
+
57
+ 所有 `vxe-grid` 插槽均可透传,使用方式与原生一致。
58
+
59
+ ---
60
+
61
+ > 组件打包采用 `rollup.config.js`,产物位于 `dist/VxeGridPro` 目录,按需引入即可。
@@ -0,0 +1 @@
1
+ import"../components/VxeGridPro/index.vue/index.js";export{default}from"../components/VxeGridPro/index.vue/index2.js";
@@ -0,0 +1,56 @@
1
+ # VxeTablePro 组件使用说明
2
+
3
+ ## 简介
4
+ `VxeTablePro` 是基于 Vue3 + TypeScript 的表格插件模板,集成了 SCSS、CSS、TailwindCSS,适用于 NPM 发布。该组件对 [vxe-table](https://x-extends.github.io/vxe-table/) 进行了二次封装,支持统一扩展功能配置,便于业务快速集成和后续扩展。
5
+
6
+ ## 安装
7
+
8
+ ```bash
9
+ npm install @cimom/ci-web-plugins-commom
10
+ ```
11
+
12
+ ## 使用方法
13
+
14
+ ```vue
15
+ <script setup>
16
+ import { VxeTablePro } from '@cimom/ci-web-plugins-commom'
17
+
18
+ import VxeTablePro from '@cimom/ci-web-plugins-commom/VxeTablePro' // 独立引用 可减少打包体积
19
+ import { reactive } from 'vue'
20
+ const gridOptions = reactive({
21
+ data: [
22
+ { id: '10001', name: '张三', role: '开发', sex: '男', num: '28', address: '北京' },
23
+ { id: '10002', name: '李四', role: '测试', sex: '女', num: '22', address: '上海' }
24
+ ]
25
+ })
26
+ const footerData = [
27
+ { seq: '合计', num: '50' },
28
+ { seq: '平均', num: '25' }
29
+ ]
30
+ function currentRowChange(params) {
31
+ alert(params.row.name)
32
+ }
33
+ </script>
34
+
35
+ <template>
36
+ <VxeTablePro
37
+ @current-row-change="currentRowChange"
38
+ :rowConfig="{ isCurrent: true, isHover: true }"
39
+ :data="gridOptions.data"
40
+ show-footer
41
+ :footer-data="footerData"
42
+ border
43
+ stripe
44
+ height="400"
45
+ :column-config="{ resizable: true }"
46
+ />
47
+ </template>
48
+ ```
49
+
50
+ ### 插槽支持
51
+
52
+ 所有 `vxe-table` 插槽均可透传,使用方式与原生一致。
53
+
54
+ ---
55
+
56
+ > 组件打包采用 `rollup.config.js`,产物位于 `dist/VxeTablePro` 目录,按需引入即可。
@@ -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,44 +1,74 @@
1
1
  {
2
2
  "name": "@cimom/ci-web-plugins-commom",
3
3
  "private": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
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
- "*.md"
11
+ "dist"
12
12
  ],
13
13
  "type": "module",
14
14
  "scripts": {
15
15
  "dev": "vite",
16
- "build": "vue-tsc -b && vite build",
16
+ "build": "rollup -c rollup.config.js",
17
+ "buildvite": "vue-tsc -b && vite build",
17
18
  "lib": "vite build --config vite.config.ts",
18
19
  "preview": "vite preview"
19
20
  },
20
21
  "main": "dist/CI.Web.Plugins.Commom.umd.js",
21
22
  "module": "dist/CI.Web.Plugins.Commom.es.js",
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
- "peerDependencies":{
23
+ "peerDependencies": {
26
24
  "vue": "^3.5.13",
27
25
  "vxe-table": "4.13.37"
28
26
  },
29
27
  "devDependencies": {
30
- "vue": "^3.5.13",
31
- "vxe-table": "4.13.37",
28
+ "@rollup/plugin-commonjs": "^28.0.3",
29
+ "@rollup/plugin-node-resolve": "^16.0.1",
32
30
  "@tailwindcss/postcss": "^4.1.8",
33
31
  "@vitejs/plugin-vue": "^5.2.3",
34
32
  "@vue/tsconfig": "^0.7.0",
35
33
  "autoprefixer": "^10.4.21",
36
34
  "postcss": "^8.5.4",
35
+ "rollup": "^4.43.0",
36
+ "rollup-plugin-css-only": "^4.5.2",
37
+ "rollup-plugin-postcss": "^4.0.2",
38
+ "rollup-plugin-terser": "^7.0.2",
39
+ "rollup-plugin-vue": "^6.0.0",
37
40
  "sass": "^1.89.2",
38
41
  "tailwindcss": "^4.1.8",
39
42
  "typescript": "~5.8.3",
40
43
  "vite": "^6.3.5",
41
44
  "vite-plugin-lazy-import": "^1.0.7",
42
- "vue-tsc": "^2.2.8"
45
+ "vue": "^3.5.13",
46
+ "vue-tsc": "^2.2.8",
47
+ "vxe-table": "4.13.37"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "exports": {
53
+ ".": {
54
+ "import": "./dist/index/index.js"
55
+ },
56
+ "./HelloPlugin": {
57
+ "import": "./dist/HelloPlugin/index.js"
58
+ },
59
+ "./HelloWorld": {
60
+ "import": "./dist/HelloWorld/index.js"
61
+ },
62
+ "./VxeTablePro": {
63
+ "import": "./dist/VxeTablePro/index.js"
64
+ },
65
+ "./VxeGridPro": {
66
+ "import": "./dist/VxeGridPro/index.js"
67
+ }
68
+ },
69
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
70
+ "dependencies": {
71
+ "@cimom/ci-web-plugins-commom": "^1.0.4",
72
+ "rollup-plugin-copy": "^3.5.0"
43
73
  }
44
74
  }
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/)
package/VxeTablePro.md DELETED
@@ -1,137 +0,0 @@
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 { reactive,ref } from 'vue'
54
- const gridOptions = reactive({
55
- columns: [
56
- { type: 'seq', width: 70 },
57
- { field: 'name', title: 'Name111' ,slots: { header: 'header_name' }},
58
- { field: 'sex', title: 'Sex' },
59
- { field: 'age', title: 'Age' }
60
- ],
61
- data: [
62
- { id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
63
- { id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
64
- { id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
65
- { id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' }
66
- ]
67
- })
68
- </script>
69
-
70
- <template>
71
- <VxeTablePro
72
- :stripe="true"
73
- :border="false"
74
- :rowConfig="{
75
- isCurrent: true,
76
- isHover: true
77
- }"
78
- :columns="gridOptions.columns"
79
- :data="gridOptions.data"
80
- :proOptions="{ align: 'left' }"
81
- >
82
- <template #top>
83
- hello top template
84
- </template>
85
- <template #header_name>
86
- <div class="first-col">
87
- <div class="first-col-top">名称1</div>
88
- <div class="first-col-bottom">序号2</div>
89
- </div>
90
- </template>
91
- <template #bottom>
92
- hello bottom template
93
- </template>
94
- </VxeTablePro>
95
-
96
- </template>
97
-
98
- <style scoped>
99
-
100
- </style>
101
-
102
- ```
103
- ## 属性说明
104
-
105
- | 属性 | 说明 | 类型 | 默认值 |
106
- | ----------- | -------------------------- | ------- | -------- |
107
- | columns | 表格列配置 | Array | [] |
108
- | data | 表格数据 | Array | [] |
109
- | proOptions | 扩展功能配置(如统一对齐) | Object | {} |
110
- | ... | 透传 vxe-grid 所有原有属性 | | |
111
-
112
- ### proOptions 扩展
113
- - `align`:统一设置所有列的对齐方式(如 'left'、'center'、'right')。
114
-
115
- ## 后续功能扩展建议
116
-
117
- 1. **更多 proOptions 扩展**:
118
- - 支持统一设置列宽、表头样式、排序、筛选等。
119
- - 支持自定义渲染函数、格式化函数等。
120
- 2. **类型增强**:
121
- - 完善 JavaScript 类型定义,提升开发体验。
122
- 3. **主题与样式**:
123
- - 支持多主题切换,集成更多 TailwindCSS 实用样式。
124
- 4. **国际化支持**:
125
- - 提供多语言配置,适配不同地区需求。
126
- 5. **事件透传与增强**:
127
- - 支持更多事件的透传与自定义事件扩展。
128
- 6. **性能优化**:
129
- - 针对大数据量表格进行虚拟滚动等优化。
130
-
131
- ## 贡献与反馈
132
-
133
- 欢迎提交 issue 或 PR,提出你的建议和需求!
134
-
135
- ---
136
-
137
- > 本项目为 Vue3+JavaScript 插件模板,适用于 NPM 发布,欢迎二次开发和定制。
@@ -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>