@cimom/ci-web-plugins-commom 1.0.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/.github/copilot-instructions.md +3 -0
- package/.vscode/extensions.json +3 -0
- package/README.en.md +83 -0
- package/README.md +0 -0
- package/dist/CI.Web.Plugins.Commom.css +1 -0
- package/dist/CI.Web.Plugins.Commom.es.js +110 -0
- package/dist/CI.Web.Plugins.Commom.umd.js +1 -0
- package/dist/vite.svg +1 -0
- package/index.html +13 -0
- package/package.json +40 -0
- package/postcss.config.js +9 -0
- package/public/vite.svg +1 -0
- package/src/App-demo.vue +14 -0
- package/src/App.vue +12 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/HelloPlugin.vue +33 -0
- package/src/components/HelloWorld.vue +33 -0
- package/src/components/VxeTablePro/README.md +84 -0
- package/src/components/VxeTablePro/README1.md +57 -0
- package/src/components/VxeTablePro/index.vue +52 -0
- package/src/index.css +5 -0
- package/src/index.js +17 -0
- package/src/main.js +57 -0
- package/src/style.css +1 -0
- package/src/testPlugins/JS-dll/CI.Web.Plugins.Commom.es.js +110 -0
- package/src/testPlugins/VxeTableProDemo/index.vue +51 -0
- package/tailwind.config.js +11 -0
- package/tsconfig.app.json +15 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +25 -0
- package/vite.config.js +41 -0
- package/vue.config.js +13 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
# Vue3 插件模板
|
|
3
|
+
|
|
4
|
+
本项目为基于 Vite + Vue3 + TypeScript + 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
|
+
- TypeScript 支持
|
|
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/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
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}
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
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>
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + Vue + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cimom/ci-web-plugins-commom",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Andy Huang",
|
|
7
|
+
"email": "57237184@qq.com"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"build": "vue-tsc -b && vite build",
|
|
13
|
+
"lib": "vite build --config vite.config.ts",
|
|
14
|
+
"preview": "vite preview"
|
|
15
|
+
},
|
|
16
|
+
"main": "dist/CI.Web.Plugins.Commom.umd.js",
|
|
17
|
+
"module": "dist/CI.Web.Plugins.Commom.es.js",
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies":{
|
|
22
|
+
"vue": "^3.5.13",
|
|
23
|
+
"vxe-table": "4.13.37"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"vue": "^3.5.13",
|
|
27
|
+
"vxe-table": "4.13.37",
|
|
28
|
+
"@tailwindcss/postcss": "^4.1.8",
|
|
29
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
30
|
+
"@vue/tsconfig": "^0.7.0",
|
|
31
|
+
"autoprefixer": "^10.4.21",
|
|
32
|
+
"postcss": "^8.5.4",
|
|
33
|
+
"sass": "^1.89.2",
|
|
34
|
+
"tailwindcss": "^4.1.8",
|
|
35
|
+
"typescript": "~5.8.3",
|
|
36
|
+
"vite": "^6.3.5",
|
|
37
|
+
"vite-plugin-lazy-import": "^1.0.7",
|
|
38
|
+
"vue-tsc": "^2.2.8"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
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>
|
package/src/App-demo.vue
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// import HelloPlugin from './components/HelloPlugin.vue'
|
|
3
|
+
// import HelloWorld from './components/HelloWorld.vue'
|
|
4
|
+
import { HelloPlugin,HelloWorld } from './testPlugins/JS-dll/CI.Web.Plugins.Commom.es.js'
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<HelloPlugin msg1="Vite + Vue" />
|
|
9
|
+
<HelloWorld msg="Vite222 + Vue" />
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<style scoped>
|
|
13
|
+
|
|
14
|
+
</style>
|
package/src/App.vue
ADDED
|
@@ -0,0 +1 @@
|
|
|
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="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// 定义 props
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
msg1: String
|
|
5
|
+
})
|
|
6
|
+
import { reactive,ref } from 'vue'
|
|
7
|
+
const gridOptions = reactive({
|
|
8
|
+
columns: [
|
|
9
|
+
{ type: 'seq', width: 70 },
|
|
10
|
+
{ field: 'name', title: 'Name' },
|
|
11
|
+
{ field: 'sex', title: 'Sex' },
|
|
12
|
+
{ field: 'age', title: 'Age' }
|
|
13
|
+
],
|
|
14
|
+
data: [
|
|
15
|
+
{ id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
|
|
16
|
+
{ id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
|
|
17
|
+
{ id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
|
|
18
|
+
{ id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' }
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
// 定义响应式数据
|
|
22
|
+
const count = ref(0)
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div class="card flex flex-col justify-center">
|
|
27
|
+
<vxe-grid v-bind="gridOptions"></vxe-grid>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<style scoped>
|
|
32
|
+
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// 定义 props
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
msg: String
|
|
5
|
+
})
|
|
6
|
+
import { reactive,ref } from 'vue'
|
|
7
|
+
const gridOptions = reactive({
|
|
8
|
+
columns: [
|
|
9
|
+
{ type: 'seq', width: 70 },
|
|
10
|
+
{ field: 'name', title: 'Name' },
|
|
11
|
+
{ field: 'sex', title: 'Sex' },
|
|
12
|
+
{ field: 'age', title: 'Age' }
|
|
13
|
+
],
|
|
14
|
+
data: [
|
|
15
|
+
{ id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
|
|
16
|
+
{ id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
|
|
17
|
+
{ id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
|
|
18
|
+
{ id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' }
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
// 定义响应式数据
|
|
22
|
+
const count = ref(0)
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div class="card border text-red-200 flex flex-col justify-center">
|
|
27
|
+
<vxe-grid v-bind="gridOptions"></vxe-grid>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<style scoped>
|
|
32
|
+
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
## 属性说明
|
|
51
|
+
|
|
52
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
53
|
+
| ----------- | -------------------------- | ------- | -------- |
|
|
54
|
+
| columns | 表格列配置 | Array | [] |
|
|
55
|
+
| data | 表格数据 | Array | [] |
|
|
56
|
+
| proOptions | 扩展功能配置(如统一对齐) | Object | {} |
|
|
57
|
+
| ... | 透传 vxe-grid 所有原有属性 | | |
|
|
58
|
+
|
|
59
|
+
### proOptions 扩展
|
|
60
|
+
- `align`:统一设置所有列的对齐方式(如 'left'、'center'、'right')。
|
|
61
|
+
|
|
62
|
+
## 后续功能扩展建议
|
|
63
|
+
|
|
64
|
+
1. **更多 proOptions 扩展**:
|
|
65
|
+
- 支持统一设置列宽、表头样式、排序、筛选等。
|
|
66
|
+
- 支持自定义渲染函数、格式化函数等。
|
|
67
|
+
2. **类型增强**:
|
|
68
|
+
- 完善 JavaScript 类型定义,提升开发体验。
|
|
69
|
+
3. **主题与样式**:
|
|
70
|
+
- 支持多主题切换,集成更多 TailwindCSS 实用样式。
|
|
71
|
+
4. **国际化支持**:
|
|
72
|
+
- 提供多语言配置,适配不同地区需求。
|
|
73
|
+
5. **事件透传与增强**:
|
|
74
|
+
- 支持更多事件的透传与自定义事件扩展。
|
|
75
|
+
6. **性能优化**:
|
|
76
|
+
- 针对大数据量表格进行虚拟滚动等优化。
|
|
77
|
+
|
|
78
|
+
## 贡献与反馈
|
|
79
|
+
|
|
80
|
+
欢迎提交 issue 或 PR,提出你的建议和需求!
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
> 本项目为 Vue3+JavaScript 插件模板,适用于 NPM 发布,欢迎二次开发和定制。
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# nvxe-grid.vue 组件功能分析与扩展建议
|
|
2
|
+
## 现有功能总结
|
|
3
|
+
### 1. 基础表格功能
|
|
4
|
+
- 数据展示 :支持基本的表格数据展示,包括分页、排序、筛选等
|
|
5
|
+
- 自定义列 :支持列宽调整、列显示/隐藏、列顺序调整等
|
|
6
|
+
- 列格式化 :根据不同的控件类型(controlType)提供不同的渲染方式
|
|
7
|
+
- 分页功能 :支持页码切换、页大小设置
|
|
8
|
+
### 2. 高级表格功能
|
|
9
|
+
- 树形结构 :支持树形数据展示,包括展开/折叠、树节点操作
|
|
10
|
+
- 行拖拽排序 :支持普通表格和树形表格的行拖拽排序
|
|
11
|
+
- 自定义样式 :支持行样式和单元格样式的自定义,基于条件规则
|
|
12
|
+
- 表格导出 :支持本地导出和远程导出功能
|
|
13
|
+
- 表格汇总 :支持底部汇总行,可计算数值列的合计
|
|
14
|
+
### 3. 数据交互功能
|
|
15
|
+
- 数据加载 :支持从API获取数据,包括普通数据和历史数据
|
|
16
|
+
- 数据过滤 :支持客户端数据过滤
|
|
17
|
+
- 数据操作 :支持数据的增删改查操作
|
|
18
|
+
- 数据缓存 :支持将当前选中行数据缓存到Vuex中
|
|
19
|
+
### 4. 链接与操作功能
|
|
20
|
+
- 链接处理 :支持多种链接类型(Link_Window、Link_Iframe、API等)
|
|
21
|
+
- 文件上传下载 :支持文件上传和API文件下载
|
|
22
|
+
- 自定义操作列 :支持配置操作按钮列
|
|
23
|
+
### 5. 自定义配置功能
|
|
24
|
+
- 列头配置 :支持从API加载列头配置
|
|
25
|
+
- 个性化设置 :支持保存用户的个性化列设置
|
|
26
|
+
- 条件样式 :支持基于字段值的条件样式设置
|
|
27
|
+
## 可扩展功能推荐
|
|
28
|
+
### 1. 性能优化
|
|
29
|
+
- 虚拟滚动 :对于大数据量表格,实现虚拟滚动以提高性能
|
|
30
|
+
- 懒加载树节点 :树形表格中实现按需加载子节点,减少初始加载数据量
|
|
31
|
+
- 数据缓存机制 :优化数据缓存策略,减少重复请求
|
|
32
|
+
### 2. 交互体验增强
|
|
33
|
+
- 拖拽调整列宽 :增强列宽调整的交互体验
|
|
34
|
+
- 行内编辑优化 :提供更丰富的行内编辑控件和验证机制
|
|
35
|
+
- 批量操作增强 :提供更便捷的批量选择和操作功能
|
|
36
|
+
- 快捷键支持 :添加键盘快捷键支持,提高操作效率
|
|
37
|
+
### 3. 数据可视化增强
|
|
38
|
+
- 内嵌图表 :支持在单元格中嵌入迷你图表(如迷你柱状图、趋势线等)
|
|
39
|
+
- 条件格式增强 :提供更丰富的条件格式设置,如渐变色、图标集等
|
|
40
|
+
- 数据透视功能 :增加简单的数据透视分析功能
|
|
41
|
+
### 4. 功能扩展
|
|
42
|
+
- 列筛选增强 :提供更强大的列筛选功能,如区间筛选、多选筛选等
|
|
43
|
+
- 单元格合并 :支持按条件自动合并相同内容的单元格
|
|
44
|
+
- 行分组 :支持按字段值对行进行分组显示
|
|
45
|
+
- 列固定优化 :优化多级表头中的列固定功能
|
|
46
|
+
- 行详情展开 :支持行展开显示详细信息
|
|
47
|
+
### 5. 集成增强
|
|
48
|
+
- 与表单联动 :增强与表单组件的联动能力
|
|
49
|
+
- 数据导入功能 :增加Excel数据导入功能
|
|
50
|
+
- 打印优化 :提供更好的表格打印支持
|
|
51
|
+
- 移动端适配 :优化在移动设备上的显示和操作体验
|
|
52
|
+
### 6. 开发便利性
|
|
53
|
+
- 组件API简化 :简化配置项,提供更直观的API
|
|
54
|
+
- 主题定制 :提供更灵活的主题定制能力
|
|
55
|
+
- 事件系统增强 :提供更丰富的事件回调
|
|
56
|
+
- 插件机制 :设计插件机制,支持功能扩展
|
|
57
|
+
以上扩展建议基于对现有代码的分析,结合了现代表格组件的发展趋势。根据实际业务需求,可以有选择地实施这些功能扩展,以提升表格组件的功能性和用户体验。
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
<script setup>
|
|
3
|
+
// 扩展属性:proOptions 用于统一扩展功能配置
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
// 透传所有原有 vxetable 属性
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
// vxetable 原有属性(如 columns、data、等)
|
|
9
|
+
columns: Array,
|
|
10
|
+
data: Array,
|
|
11
|
+
// ...可继续补充常用属性
|
|
12
|
+
|
|
13
|
+
// 扩展属性
|
|
14
|
+
proOptions: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: () => ({})
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// 处理扩展功能(示例:统一设置所有列的对齐方式)
|
|
21
|
+
const mergedColumns = computed(() => {
|
|
22
|
+
if (!props.proOptions.align) return props.columns
|
|
23
|
+
return props.columns?.map(col => ({
|
|
24
|
+
...col,
|
|
25
|
+
align: col.align || props.proOptions.align
|
|
26
|
+
}))
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
import { useAttrs } from 'vue'
|
|
30
|
+
const attrs = useAttrs()
|
|
31
|
+
// debugger
|
|
32
|
+
// 合并后的配置,包含 $attrs
|
|
33
|
+
const gridOptions = computed(() => ({
|
|
34
|
+
border:true,// 默认设置边框,外置优先可以覆盖内置属性
|
|
35
|
+
...props,
|
|
36
|
+
...attrs,
|
|
37
|
+
columns: mergedColumns.value
|
|
38
|
+
}))
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<!-- 透传所有属性,合并扩展功能 -->
|
|
43
|
+
<vxe-grid v-bind="gridOptions">
|
|
44
|
+
<template v-for="(_, name) in $slots" #[name]="slotProps">
|
|
45
|
+
<slot :name="name" v-bind="slotProps" />
|
|
46
|
+
</template>
|
|
47
|
+
</vxe-grid>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style scoped>
|
|
51
|
+
/* 可在此扩展样式 */
|
|
52
|
+
</style>
|
package/src/index.css
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// 插件入口文件,导出你的Vue插件
|
|
2
|
+
import HelloPlugin from './components/HelloPlugin.vue';
|
|
3
|
+
import HelloWorld from './components/HelloWorld.vue';
|
|
4
|
+
import VxeTablePro from './components/VxeTablePro/index.vue';
|
|
5
|
+
import './index.css';
|
|
6
|
+
|
|
7
|
+
// 按需导出每个组件,支持 tree-shaking
|
|
8
|
+
export { HelloWorld, HelloPlugin,VxeTablePro };
|
|
9
|
+
|
|
10
|
+
// 提供全量注册方法,供需要时使用
|
|
11
|
+
export default {
|
|
12
|
+
install(app) {
|
|
13
|
+
app.component('HelloPlugin', HelloPlugin);
|
|
14
|
+
app.component('HelloWorld', HelloWorld);
|
|
15
|
+
app.component('VxeTablePro', VxeTablePro);
|
|
16
|
+
}
|
|
17
|
+
};
|
package/src/main.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createApp } from "vue";
|
|
2
|
+
import "./style.css";
|
|
3
|
+
import 'vxe-table/lib/style.css'
|
|
4
|
+
import {
|
|
5
|
+
VxeUI,
|
|
6
|
+
VxeButton,
|
|
7
|
+
VxeButtonGroup,
|
|
8
|
+
VxeDrawer,
|
|
9
|
+
VxeForm,
|
|
10
|
+
VxeFormGroup,
|
|
11
|
+
VxeFormItem,
|
|
12
|
+
VxeIcon,
|
|
13
|
+
VxeLoading,
|
|
14
|
+
VxeModal,
|
|
15
|
+
VxePager,
|
|
16
|
+
VxePrint,
|
|
17
|
+
VxeTooltip,
|
|
18
|
+
VxeUpload,
|
|
19
|
+
} from "vxe-pc-ui";
|
|
20
|
+
import {
|
|
21
|
+
VxeTable,
|
|
22
|
+
VxeColumn,
|
|
23
|
+
VxeColgroup,
|
|
24
|
+
VxeGrid,
|
|
25
|
+
VxeToolbar,
|
|
26
|
+
} from "vxe-table";
|
|
27
|
+
import zhCN from "vxe-table/lib/locale/lang/zh-CN";
|
|
28
|
+
|
|
29
|
+
VxeUI.setI18n("zh-CN", zhCN);
|
|
30
|
+
VxeUI.setLanguage("zh-CN");
|
|
31
|
+
|
|
32
|
+
function lazyVxeUI(app) {
|
|
33
|
+
app.use(VxeButton);
|
|
34
|
+
app.use(VxeButtonGroup);
|
|
35
|
+
app.use(VxeDrawer);
|
|
36
|
+
app.use(VxeForm);
|
|
37
|
+
app.use(VxeFormGroup);
|
|
38
|
+
app.use(VxeFormItem);
|
|
39
|
+
app.use(VxeIcon);
|
|
40
|
+
app.use(VxeLoading);
|
|
41
|
+
app.use(VxeModal);
|
|
42
|
+
app.use(VxePager);
|
|
43
|
+
app.use(VxePrint);
|
|
44
|
+
app.use(VxeTooltip);
|
|
45
|
+
app.use(VxeUpload);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function lazyVxeTable(app) {
|
|
49
|
+
app.use(VxeTable);
|
|
50
|
+
app.use(VxeColumn);
|
|
51
|
+
app.use(VxeColgroup);
|
|
52
|
+
app.use(VxeGrid);
|
|
53
|
+
app.use(VxeToolbar);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
import App from "./App.vue";
|
|
57
|
+
createApp(App).use(lazyVxeUI).use(lazyVxeTable).mount('#app')
|
package/src/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './index.css';
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// import VxeTablePro from '../../components/VxeTablePro/index.vue'
|
|
3
|
+
import { VxeTablePro } from '@/testPlugins/JS-dll/CI.Web.Plugins.Commom.es.js'
|
|
4
|
+
import { reactive,ref } from 'vue'
|
|
5
|
+
const gridOptions = reactive({
|
|
6
|
+
columns: [
|
|
7
|
+
{ type: 'seq', width: 70 },
|
|
8
|
+
{ field: 'name', title: 'Name111' ,slots: { header: 'header_name' }},
|
|
9
|
+
{ field: 'sex', title: 'Sex' },
|
|
10
|
+
{ field: 'age', title: 'Age' }
|
|
11
|
+
],
|
|
12
|
+
data: [
|
|
13
|
+
{ id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
|
|
14
|
+
{ id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
|
|
15
|
+
{ id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
|
|
16
|
+
{ id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' }
|
|
17
|
+
]
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<VxeTablePro
|
|
23
|
+
:stripe="true"
|
|
24
|
+
:border="false"
|
|
25
|
+
:rowConfig="{
|
|
26
|
+
isCurrent: true,
|
|
27
|
+
isHover: true
|
|
28
|
+
}"
|
|
29
|
+
:columns="gridOptions.columns"
|
|
30
|
+
:data="gridOptions.data"
|
|
31
|
+
:proOptions="{ align: 'left' }"
|
|
32
|
+
>
|
|
33
|
+
<template #top>
|
|
34
|
+
hello top template
|
|
35
|
+
</template>
|
|
36
|
+
<template #header_name>
|
|
37
|
+
<div class="first-col">
|
|
38
|
+
<div class="first-col-top">名称1</div>
|
|
39
|
+
<div class="first-col-bottom">序号2</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
<template #bottom>
|
|
43
|
+
hello bottom template
|
|
44
|
+
</template>
|
|
45
|
+
</VxeTablePro>
|
|
46
|
+
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<style scoped>
|
|
50
|
+
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
|
|
6
|
+
/* Linting */
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noUnusedLocals": true,
|
|
9
|
+
"noUnusedParameters": true,
|
|
10
|
+
"erasableSyntaxOnly": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"noUncheckedSideEffectImports": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.vue"]
|
|
15
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"erasableSyntaxOnly": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["src", "types", "*.js"]
|
|
25
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
|
|
4
|
+
// https://vite.dev/config/
|
|
5
|
+
import { fileURLToPath, URL } from 'url'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [vue()],
|
|
9
|
+
resolve: {
|
|
10
|
+
alias: {
|
|
11
|
+
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
build: {
|
|
15
|
+
lib: {
|
|
16
|
+
entry: 'src/index.js',
|
|
17
|
+
name: 'CI.Web.Plugins.Commom',
|
|
18
|
+
fileName: (format) => `CI.Web.Plugins.Commom.${format}.js`,
|
|
19
|
+
},
|
|
20
|
+
rollupOptions: {
|
|
21
|
+
// 确保外部化处理那些你不想打包进库的依赖
|
|
22
|
+
external: ['vue'],
|
|
23
|
+
output: {
|
|
24
|
+
globals: {
|
|
25
|
+
vue: 'Vue',
|
|
26
|
+
},
|
|
27
|
+
exports: 'named',
|
|
28
|
+
assetFileNames: (assetInfo) => {
|
|
29
|
+
if (assetInfo.name && assetInfo.name.endsWith('.css')) {
|
|
30
|
+
return 'CI.Web.Plugins.Commom.css';
|
|
31
|
+
}
|
|
32
|
+
return '[name][extname]';
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
server: {
|
|
38
|
+
host: '0.0.0.0', // 指定 IP,0.0.0.0 表示可从局域网访问
|
|
39
|
+
port: 5173, // 指定端口
|
|
40
|
+
},
|
|
41
|
+
})
|