@cj-design/vue 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/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("element-plus"),C=require("@element-plus/icons-vue"),g=e.defineComponent({__name:"CjButton",props:{type:{default:"default"},size:{default:"default"},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:c}){const a=c,i=o=>{a("click",o)};return(o,r)=>(e.openBlock(),e.createBlock(e.unref(u.ElButton),{type:t.type,size:t.size,loading:t.loading,disabled:t.disabled,plain:t.plain,round:t.round,circle:t.circle,onClick:i},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},8,["type","size","loading","disabled","plain","round","circle"]))}}),B={key:0,class:"cj-table-pagination"},b=e.defineComponent({__name:"CjTable",props:{data:{},columns:{},loading:{type:Boolean,default:!1},stripe:{type:Boolean,default:!0},border:{type:Boolean,default:!1},height:{},selection:{type:Boolean,default:!1},pagination:{type:Boolean,default:!1},total:{default:0},page:{default:1},pageSize:{default:10}},emits:["update:page","update:pageSize","selectionChange"],setup(t,{emit:c}){const a=t,i=c,o=e.ref(a.page),r=e.ref(a.pageSize);e.watch(()=>a.page,l=>{o.value=l}),e.watch(()=>a.pageSize,l=>{r.value=l});const m=l=>{i("selectionChange",l)},d=l=>{i("update:pageSize",l)},s=l=>{i("update:page",l)};return(l,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(u.ElTable),{data:t.data,loading:t.loading,stripe:t.stripe,border:t.border,height:t.height,onSelectionChange:m},{empty:e.withCtx(()=>[e.renderSlot(l.$slots,"empty",{},()=>[f[2]||(f[2]=e.createTextVNode("暂无数据",-1))],!0)]),default:e.withCtx(()=>[t.selection?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),{key:0,type:"selection",width:"55"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,n=>(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),{key:n.prop,prop:n.prop,label:n.label,width:n.width,"min-width":n.minWidth,fixed:n.fixed},e.createSlots({_:2},[n.slot?{name:"default",fn:e.withCtx(p=>[e.renderSlot(l.$slots,n.prop,{row:p.row,$index:p.$index},void 0,!0)]),key:"0"}:void 0]),1032,["prop","label","width","min-width","fixed"]))),128))]),_:3},8,["data","loading","stripe","border","height"]),t.pagination?(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.unref(u.ElPagination),{"current-page":o.value,"onUpdate:currentPage":f[0]||(f[0]=n=>o.value=n),"page-size":r.value,"onUpdate:pageSize":f[1]||(f[1]=n=>r.value=n),total:t.total,"page-sizes":[10,20,50,100],layout:"total, sizes, prev, pager, next, jumper",onSizeChange:d,onCurrentChange:s},null,8,["current-page","page-size","total"])])):e.createCommentVNode("",!0)],64))}}),k=(t,c)=>{const a=t.__vccOpts||t;for(const[i,o]of c)a[i]=o;return a},h=k(b,[["__scopeId","data-v-9f4222e8"]]),x={class:"el-upload__tip"},y=e.defineComponent({__name:"CjUpload",props:{action:{},headers:{},data:{},name:{default:"file"},accept:{},limit:{},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},showFileList:{type:Boolean,default:!0},buttonText:{default:"点击上传"},buttonType:{default:"primary"},icon:{type:Boolean,default:!0},tip:{},maxSize:{},fileList:{default:()=>[]}},emits:["success","error","exceed"],setup(t,{emit:c}){const a=c,i=d=>!0,o=(d,s)=>{a("success",d,s)},r=(d,s)=>{a("error",d,s)},m=d=>{a("exceed",d)};return(d,s)=>(e.openBlock(),e.createBlock(e.unref(u.ElUpload),{action:t.action,headers:t.headers,data:t.data,name:t.name,accept:t.accept,limit:t.limit,multiple:t.multiple,disabled:t.disabled,"show-file-list":t.showFileList,"before-upload":i,"on-success":o,"on-error":r,"on-exceed":m,"file-list":t.fileList},e.createSlots({default:e.withCtx(()=>[e.createVNode(e.unref(u.ElButton),{type:t.buttonType,disabled:t.disabled},{default:e.withCtx(()=>[t.icon?(e.openBlock(),e.createBlock(e.unref(u.ElIcon),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(C.Upload))]),_:1})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.buttonText),1)]),_:1},8,["type","disabled"])]),_:2},[t.tip?{name:"tip",fn:e.withCtx(()=>[e.createElementVNode("div",x,e.toDisplayString(t.tip),1)]),key:"0"}:void 0]),1032,["action","headers","data","name","accept","limit","multiple","disabled","show-file-list","file-list"]))}}),w={install(t){t.component("CjButton",g),t.component("CjTable",h),t.component("CjUpload",y)}};exports.CjButton=g;exports.CjTable=h;exports.CjUpload=y;exports.default=w;
@@ -0,0 +1,157 @@
1
+ import { App } from 'vue';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import { ComponentProvideOptions } from 'vue';
4
+ import { DefineComponent } from 'vue';
5
+ import { PublicProps } from 'vue';
6
+ import { UploadFile } from 'element-plus';
7
+
8
+ declare const __VLS_component: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
9
+ click: (event: MouseEvent) => any;
10
+ }, string, PublicProps, Readonly<Props> & Readonly<{
11
+ onClick?: ((event: MouseEvent) => any) | undefined;
12
+ }>, {
13
+ type: "primary" | "success" | "warning" | "danger" | "info" | "default";
14
+ size: "large" | "default" | "small";
15
+ loading: boolean;
16
+ disabled: boolean;
17
+ plain: boolean;
18
+ round: boolean;
19
+ circle: boolean;
20
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
21
+
22
+ declare const __VLS_component_2: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
23
+ "update:page": (page: number) => any;
24
+ "update:pageSize": (size: number) => any;
25
+ selectionChange: (selection: any[]) => any;
26
+ }, string, PublicProps, Readonly<Props_2> & Readonly<{
27
+ "onUpdate:page"?: ((page: number) => any) | undefined;
28
+ "onUpdate:pageSize"?: ((size: number) => any) | undefined;
29
+ onSelectionChange?: ((selection: any[]) => any) | undefined;
30
+ }>, {
31
+ loading: boolean;
32
+ stripe: boolean;
33
+ border: boolean;
34
+ selection: boolean;
35
+ pagination: boolean;
36
+ total: number;
37
+ page: number;
38
+ pageSize: number;
39
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
40
+
41
+ declare function __VLS_template(): {
42
+ attrs: Partial<{}>;
43
+ slots: {
44
+ default?(_: {}): any;
45
+ };
46
+ refs: {};
47
+ rootEl: any;
48
+ };
49
+
50
+ declare function __VLS_template_2(): {
51
+ attrs: Partial<{}>;
52
+ slots: Partial<Record<string, (_: {
53
+ row: any;
54
+ $index: any;
55
+ }) => any>> & {
56
+ empty?(_: {}): any;
57
+ };
58
+ refs: {};
59
+ rootEl: any;
60
+ };
61
+
62
+ declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
63
+
64
+ declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
65
+
66
+ declare type __VLS_WithTemplateSlots<T, S> = T & {
67
+ new (): {
68
+ $slots: S;
69
+ };
70
+ };
71
+
72
+ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
73
+ new (): {
74
+ $slots: S;
75
+ };
76
+ };
77
+
78
+ export declare const CjButton: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
79
+
80
+ export declare const CjTable: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
81
+
82
+ export declare const CjUpload: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
83
+ success: (response: any, file: UploadFile) => any;
84
+ error: (error: any, file: UploadFile) => any;
85
+ exceed: (files: File[]) => any;
86
+ }, string, PublicProps, Readonly<Props_3> & Readonly<{
87
+ onSuccess?: ((response: any, file: UploadFile) => any) | undefined;
88
+ onError?: ((error: any, file: UploadFile) => any) | undefined;
89
+ onExceed?: ((files: File[]) => any) | undefined;
90
+ }>, {
91
+ disabled: boolean;
92
+ icon: boolean;
93
+ name: string;
94
+ multiple: boolean;
95
+ showFileList: boolean;
96
+ buttonText: string;
97
+ buttonType: "primary" | "success" | "warning" | "danger" | "info" | "default";
98
+ fileList: any[];
99
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
100
+
101
+ declare interface Column {
102
+ prop: string;
103
+ label: string;
104
+ width?: string | number;
105
+ minWidth?: string | number;
106
+ fixed?: 'left' | 'right' | boolean;
107
+ slot?: boolean;
108
+ }
109
+
110
+ declare const _default: {
111
+ install(app: App): void;
112
+ };
113
+ export default _default;
114
+
115
+ declare interface Props {
116
+ type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'default';
117
+ size?: 'large' | 'default' | 'small';
118
+ loading?: boolean;
119
+ disabled?: boolean;
120
+ plain?: boolean;
121
+ round?: boolean;
122
+ circle?: boolean;
123
+ }
124
+
125
+ declare interface Props_2 {
126
+ data: any[];
127
+ columns: Column[];
128
+ loading?: boolean;
129
+ stripe?: boolean;
130
+ border?: boolean;
131
+ height?: string | number;
132
+ selection?: boolean;
133
+ pagination?: boolean;
134
+ total?: number;
135
+ page?: number;
136
+ pageSize?: number;
137
+ }
138
+
139
+ declare interface Props_3 {
140
+ action: string;
141
+ headers?: Record<string, string>;
142
+ data?: Record<string, any>;
143
+ name?: string;
144
+ accept?: string;
145
+ limit?: number;
146
+ multiple?: boolean;
147
+ disabled?: boolean;
148
+ showFileList?: boolean;
149
+ buttonText?: string;
150
+ buttonType?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'default';
151
+ icon?: boolean;
152
+ tip?: string;
153
+ maxSize?: number;
154
+ fileList?: any[];
155
+ }
156
+
157
+ export { }
package/dist/index.mjs ADDED
@@ -0,0 +1,213 @@
1
+ import { defineComponent as B, openBlock as u, createBlock as p, unref as d, withCtx as s, renderSlot as b, ref as z, watch as S, createElementBlock as y, Fragment as v, createVNode as g, createCommentVNode as C, renderList as U, createSlots as j, createTextVNode as E, toDisplayString as k, createElementVNode as $ } from "vue";
2
+ import { ElButton as T, ElTable as L, ElTableColumn as w, ElPagination as N, ElUpload as P, ElIcon as V } from "element-plus";
3
+ import { Upload as F } from "@element-plus/icons-vue";
4
+ const I = /* @__PURE__ */ B({
5
+ __name: "CjButton",
6
+ props: {
7
+ type: { default: "default" },
8
+ size: { default: "default" },
9
+ loading: { type: Boolean, default: !1 },
10
+ disabled: { type: Boolean, default: !1 },
11
+ plain: { type: Boolean, default: !1 },
12
+ round: { type: Boolean, default: !1 },
13
+ circle: { type: Boolean, default: !1 }
14
+ },
15
+ emits: ["click"],
16
+ setup(e, { emit: c }) {
17
+ const t = c, i = (n) => {
18
+ t("click", n);
19
+ };
20
+ return (n, r) => (u(), p(d(T), {
21
+ type: e.type,
22
+ size: e.size,
23
+ loading: e.loading,
24
+ disabled: e.disabled,
25
+ plain: e.plain,
26
+ round: e.round,
27
+ circle: e.circle,
28
+ onClick: i
29
+ }, {
30
+ default: s(() => [
31
+ b(n.$slots, "default")
32
+ ]),
33
+ _: 3
34
+ }, 8, ["type", "size", "loading", "disabled", "plain", "round", "circle"]));
35
+ }
36
+ }), D = {
37
+ key: 0,
38
+ class: "cj-table-pagination"
39
+ }, O = /* @__PURE__ */ B({
40
+ __name: "CjTable",
41
+ props: {
42
+ data: {},
43
+ columns: {},
44
+ loading: { type: Boolean, default: !1 },
45
+ stripe: { type: Boolean, default: !0 },
46
+ border: { type: Boolean, default: !1 },
47
+ height: {},
48
+ selection: { type: Boolean, default: !1 },
49
+ pagination: { type: Boolean, default: !1 },
50
+ total: { default: 0 },
51
+ page: { default: 1 },
52
+ pageSize: { default: 10 }
53
+ },
54
+ emits: ["update:page", "update:pageSize", "selectionChange"],
55
+ setup(e, { emit: c }) {
56
+ const t = e, i = c, n = z(t.page), r = z(t.pageSize);
57
+ S(() => t.page, (a) => {
58
+ n.value = a;
59
+ }), S(() => t.pageSize, (a) => {
60
+ r.value = a;
61
+ });
62
+ const h = (a) => {
63
+ i("selectionChange", a);
64
+ }, o = (a) => {
65
+ i("update:pageSize", a);
66
+ }, f = (a) => {
67
+ i("update:page", a);
68
+ };
69
+ return (a, m) => (u(), y(v, null, [
70
+ g(d(L), {
71
+ data: e.data,
72
+ loading: e.loading,
73
+ stripe: e.stripe,
74
+ border: e.border,
75
+ height: e.height,
76
+ onSelectionChange: h
77
+ }, {
78
+ empty: s(() => [
79
+ b(a.$slots, "empty", {}, () => [
80
+ m[2] || (m[2] = E("暂无数据", -1))
81
+ ], !0)
82
+ ]),
83
+ default: s(() => [
84
+ e.selection ? (u(), p(d(w), {
85
+ key: 0,
86
+ type: "selection",
87
+ width: "55"
88
+ })) : C("", !0),
89
+ (u(!0), y(v, null, U(e.columns, (l) => (u(), p(d(w), {
90
+ key: l.prop,
91
+ prop: l.prop,
92
+ label: l.label,
93
+ width: l.width,
94
+ "min-width": l.minWidth,
95
+ fixed: l.fixed
96
+ }, j({ _: 2 }, [
97
+ l.slot ? {
98
+ name: "default",
99
+ fn: s((x) => [
100
+ b(a.$slots, l.prop, {
101
+ row: x.row,
102
+ $index: x.$index
103
+ }, void 0, !0)
104
+ ]),
105
+ key: "0"
106
+ } : void 0
107
+ ]), 1032, ["prop", "label", "width", "min-width", "fixed"]))), 128))
108
+ ]),
109
+ _: 3
110
+ }, 8, ["data", "loading", "stripe", "border", "height"]),
111
+ e.pagination ? (u(), y("div", D, [
112
+ g(d(N), {
113
+ "current-page": n.value,
114
+ "onUpdate:currentPage": m[0] || (m[0] = (l) => n.value = l),
115
+ "page-size": r.value,
116
+ "onUpdate:pageSize": m[1] || (m[1] = (l) => r.value = l),
117
+ total: e.total,
118
+ "page-sizes": [10, 20, 50, 100],
119
+ layout: "total, sizes, prev, pager, next, jumper",
120
+ onSizeChange: o,
121
+ onCurrentChange: f
122
+ }, null, 8, ["current-page", "page-size", "total"])
123
+ ])) : C("", !0)
124
+ ], 64));
125
+ }
126
+ }), W = (e, c) => {
127
+ const t = e.__vccOpts || e;
128
+ for (const [i, n] of c)
129
+ t[i] = n;
130
+ return t;
131
+ }, q = /* @__PURE__ */ W(O, [["__scopeId", "data-v-9f4222e8"]]), A = { class: "el-upload__tip" }, G = /* @__PURE__ */ B({
132
+ __name: "CjUpload",
133
+ props: {
134
+ action: {},
135
+ headers: {},
136
+ data: {},
137
+ name: { default: "file" },
138
+ accept: {},
139
+ limit: {},
140
+ multiple: { type: Boolean, default: !1 },
141
+ disabled: { type: Boolean, default: !1 },
142
+ showFileList: { type: Boolean, default: !0 },
143
+ buttonText: { default: "点击上传" },
144
+ buttonType: { default: "primary" },
145
+ icon: { type: Boolean, default: !0 },
146
+ tip: {},
147
+ maxSize: {},
148
+ fileList: { default: () => [] }
149
+ },
150
+ emits: ["success", "error", "exceed"],
151
+ setup(e, { emit: c }) {
152
+ const t = c, i = (o) => !0, n = (o, f) => {
153
+ t("success", o, f);
154
+ }, r = (o, f) => {
155
+ t("error", o, f);
156
+ }, h = (o) => {
157
+ t("exceed", o);
158
+ };
159
+ return (o, f) => (u(), p(d(P), {
160
+ action: e.action,
161
+ headers: e.headers,
162
+ data: e.data,
163
+ name: e.name,
164
+ accept: e.accept,
165
+ limit: e.limit,
166
+ multiple: e.multiple,
167
+ disabled: e.disabled,
168
+ "show-file-list": e.showFileList,
169
+ "before-upload": i,
170
+ "on-success": n,
171
+ "on-error": r,
172
+ "on-exceed": h,
173
+ "file-list": e.fileList
174
+ }, j({
175
+ default: s(() => [
176
+ g(d(T), {
177
+ type: e.buttonType,
178
+ disabled: e.disabled
179
+ }, {
180
+ default: s(() => [
181
+ e.icon ? (u(), p(d(V), { key: 0 }, {
182
+ default: s(() => [
183
+ g(d(F))
184
+ ]),
185
+ _: 1
186
+ })) : C("", !0),
187
+ E(" " + k(e.buttonText), 1)
188
+ ]),
189
+ _: 1
190
+ }, 8, ["type", "disabled"])
191
+ ]),
192
+ _: 2
193
+ }, [
194
+ e.tip ? {
195
+ name: "tip",
196
+ fn: s(() => [
197
+ $("div", A, k(e.tip), 1)
198
+ ]),
199
+ key: "0"
200
+ } : void 0
201
+ ]), 1032, ["action", "headers", "data", "name", "accept", "limit", "multiple", "disabled", "show-file-list", "file-list"]));
202
+ }
203
+ }), M = {
204
+ install(e) {
205
+ e.component("CjButton", I), e.component("CjTable", q), e.component("CjUpload", G);
206
+ }
207
+ };
208
+ export {
209
+ I as CjButton,
210
+ q as CjTable,
211
+ G as CjUpload,
212
+ M as default
213
+ };
package/dist/vue.css ADDED
@@ -0,0 +1 @@
1
+ .cj-table-pagination[data-v-9f4222e8]{margin-top:16px;display:flex;justify-content:flex-end}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@cj-design/vue",
3
+ "version": "1.0.0",
4
+ "description": "Vue3 components based on Element Plus",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ },
15
+ "./dist/style.css": "./dist/style.css"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "peerDependencies": {
21
+ "vue": "^3.4.0",
22
+ "element-plus": "^2.5.0",
23
+ "@element-plus/icons-vue": "^2.3.0"
24
+ },
25
+ "devDependencies": {
26
+ "@vitejs/plugin-vue": "^5.0.0",
27
+ "element-plus": "^2.5.0",
28
+ "typescript": "^5.9.0",
29
+ "vite": "^6.0.0",
30
+ "vite-plugin-dts": "^4.0.0",
31
+ "vue": "^3.4.0",
32
+ "vue-tsc": "^2.0.0"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "scripts": {
38
+ "build": "vite build && vue-tsc --declaration --emitDeclarationOnly",
39
+ "dev": "vite build --watch"
40
+ }
41
+ }