@byan99/vue-base-table 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/index.css +1 -1
- package/dist/index.js +41 -24
- package/dist/src/components/Table/BaseTable.vue.d.ts +2 -2
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
# @byan99/vue-base-table
|
|
2
2
|
|
|
3
|
-
基于 Vue 3 + TypeScript 的可复用表格组件。
|
|
3
|
+
基于 Vue 3 + Element Plus + TypeScript 的可复用表格组件。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @byan99/vue-base-table
|
|
8
|
+
npm install @byan99/vue-base-table element-plus
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## 使用
|
|
12
12
|
|
|
13
|
+
在入口文件中注册 Element Plus 并引入样式:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import ElementPlus from 'element-plus'
|
|
17
|
+
import 'element-plus/dist/index.css'
|
|
18
|
+
|
|
19
|
+
app.use(ElementPlus)
|
|
20
|
+
```
|
|
21
|
+
|
|
13
22
|
```vue
|
|
14
23
|
<script setup lang="ts">
|
|
15
24
|
import { BaseTable } from '@byan99/vue-base-table'
|
|
16
25
|
import type { TableColumn } from '@byan99/vue-base-table'
|
|
17
|
-
import '@byan99/vue-base-table/style.css'
|
|
18
26
|
|
|
19
27
|
interface UserRow {
|
|
20
28
|
id: number
|
package/dist/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.
|
|
1
|
+
.base-table[data-v-7d862b68]{width:100%}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Fragment as e,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Fragment as e, createBlock as t, createElementBlock as n, createTextVNode as r, defineComponent as i, openBlock as a, renderList as o, renderSlot as s, toDisplayString as c, unref as l, withCtx as u } from "vue";
|
|
2
|
+
import { ElTable as d, ElTableColumn as f } from "element-plus";
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/components/Table/BaseTable.vue
|
|
5
|
+
var p = /*#__PURE__*/ ((e, t) => {
|
|
4
6
|
let n = e.__vccOpts || e;
|
|
5
7
|
for (let [e, r] of t) n[e] = r;
|
|
6
8
|
return n;
|
|
@@ -15,30 +17,45 @@ var d = { key: 0 }, f = ["colspan"], p = { key: 1 }, m = ["colspan"], h = /*#__P
|
|
|
15
17
|
bordered: { type: Boolean }
|
|
16
18
|
},
|
|
17
19
|
setup(i) {
|
|
18
|
-
function
|
|
20
|
+
function p(e, t) {
|
|
19
21
|
let n = e[t];
|
|
20
22
|
return n == null ? "" : String(n);
|
|
21
23
|
}
|
|
22
|
-
return (
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
return (m, h) => (a(), t(l(d), {
|
|
25
|
+
class: "base-table",
|
|
26
|
+
data: i.data,
|
|
27
|
+
stripe: i.stripe,
|
|
28
|
+
border: i.bordered,
|
|
29
|
+
loading: i.loading,
|
|
30
|
+
"empty-text": i.emptyText ?? "暂无数据"
|
|
31
|
+
}, {
|
|
32
|
+
default: u(() => [(a(!0), n(e, null, o(i.columns, (e) => (a(), t(l(f), {
|
|
33
|
+
key: e.key,
|
|
34
|
+
prop: e.key,
|
|
35
|
+
label: e.label,
|
|
25
36
|
width: e.width,
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
37
|
+
align: e.align ?? "left"
|
|
38
|
+
}, {
|
|
39
|
+
default: u(({ row: t }) => [s(m.$slots, e.key, {
|
|
40
|
+
row: t,
|
|
41
|
+
value: t[e.key]
|
|
42
|
+
}, () => [r(c(p(t, e.key)), 1)], !0)]),
|
|
43
|
+
_: 2
|
|
44
|
+
}, 1032, [
|
|
45
|
+
"prop",
|
|
46
|
+
"label",
|
|
47
|
+
"width",
|
|
48
|
+
"align"
|
|
49
|
+
]))), 128))]),
|
|
50
|
+
_: 3
|
|
51
|
+
}, 8, [
|
|
52
|
+
"data",
|
|
53
|
+
"stripe",
|
|
54
|
+
"border",
|
|
55
|
+
"loading",
|
|
56
|
+
"empty-text"
|
|
57
|
+
]));
|
|
41
58
|
}
|
|
42
|
-
}), [["__scopeId", "data-v-
|
|
59
|
+
}), [["__scopeId", "data-v-7d862b68"]]);
|
|
43
60
|
//#endregion
|
|
44
|
-
export {
|
|
61
|
+
export { p as BaseTable };
|
|
@@ -11,8 +11,8 @@ declare const _default: <T extends object>(__VLS_props: NonNullable<Awaited<type
|
|
|
11
11
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
12
12
|
attrs: any;
|
|
13
13
|
slots: Partial<Record<NonNullable<keyof T & string>, (_: {
|
|
14
|
-
row:
|
|
15
|
-
value:
|
|
14
|
+
row: import('element-plus/es/components/table/src/table/defaults.mjs').DefaultRow;
|
|
15
|
+
value: import('element-plus/es/components/table/src/table/defaults.mjs').DefaultRow[keyof T & string];
|
|
16
16
|
}) => any>>;
|
|
17
17
|
emit: {};
|
|
18
18
|
}>) => import('vue').VNode & {
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byan99/vue-base-table",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A reusable Vue 3 table component with TypeScript support",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A reusable Vue 3 table component based on Element Plus with TypeScript support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vue",
|
|
8
8
|
"vue3",
|
|
9
9
|
"table",
|
|
10
10
|
"component",
|
|
11
|
-
"typescript"
|
|
11
|
+
"typescript",
|
|
12
|
+
"element-plus"
|
|
12
13
|
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
13
17
|
"license": "MIT",
|
|
14
18
|
"author": "byan99",
|
|
15
19
|
"repository": {
|
|
@@ -42,12 +46,14 @@
|
|
|
42
46
|
"prepublishOnly": "npm run build:lib"
|
|
43
47
|
},
|
|
44
48
|
"peerDependencies": {
|
|
49
|
+
"element-plus": "^2.9.0",
|
|
45
50
|
"vue": "^3.5.0"
|
|
46
51
|
},
|
|
47
52
|
"devDependencies": {
|
|
48
53
|
"@types/node": "^24.13.2",
|
|
49
54
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
50
55
|
"@vue/tsconfig": "^0.9.1",
|
|
56
|
+
"element-plus": "^2.14.2",
|
|
51
57
|
"typescript": "~6.0.2",
|
|
52
58
|
"vite": "^8.1.1",
|
|
53
59
|
"vite-plugin-dts": "^4.5.4",
|