@qy_better_lib/pc 0.0.1

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.
Files changed (47) hide show
  1. package/dist/@qy_better_lib/pc.min.js +1 -0
  2. package/lib/contextMenu/index.d.ts +3 -0
  3. package/lib/contextMenu/index.js +7 -0
  4. package/lib/contextMenu/src/index.vue.d.ts +71 -0
  5. package/lib/contextMenu/src/index.vue.js +108 -0
  6. package/lib/contextMenu/src/index.vue2.js +4 -0
  7. package/lib/index.d.ts +8 -0
  8. package/lib/index.js +18 -0
  9. package/lib/tableExtend/index.d.ts +4 -0
  10. package/lib/tableExtend/index.js +7 -0
  11. package/lib/tableExtend/props.d.ts +52 -0
  12. package/lib/tableExtend/props.js +50 -0
  13. package/lib/tableExtend/src/colVisible.vue.d.ts +3 -0
  14. package/lib/tableExtend/src/colVisible.vue.js +103 -0
  15. package/lib/tableExtend/src/colVisible.vue2.js +4 -0
  16. package/lib/tableExtend/src/index.vue.d.ts +117 -0
  17. package/lib/tableExtend/src/index.vue.js +177 -0
  18. package/lib/tableExtend/src/index.vue2.js +4 -0
  19. package/lib/tableExtend/src/valueCol.vue.d.ts +24 -0
  20. package/lib/tableExtend/src/valueCol.vue.js +26 -0
  21. package/lib/tableExtend/src/valueCol.vue2.js +4 -0
  22. package/lib/tableExtend/type.d.ts +167 -0
  23. package/lib/tableExtend/type.js +4 -0
  24. package/lib/tableExtend/useTable.d.ts +64 -0
  25. package/lib/tableExtend/useTable.js +72 -0
  26. package/lib/textButton/index.d.ts +3 -0
  27. package/lib/textButton/index.js +7 -0
  28. package/lib/textButton/src/index.vue.d.ts +31 -0
  29. package/lib/textButton/src/index.vue.js +39 -0
  30. package/lib/textButton/src/index.vue2.js +4 -0
  31. package/package.json +56 -0
  32. package/src/contextMenu/index.ts +8 -0
  33. package/src/contextMenu/src/index.vue +131 -0
  34. package/src/index.ts +16 -0
  35. package/src/tableExtend/index.ts +10 -0
  36. package/src/tableExtend/props.ts +53 -0
  37. package/src/tableExtend/src/colVisible.vue +80 -0
  38. package/src/tableExtend/src/index.vue +178 -0
  39. package/src/tableExtend/src/valueCol.vue +25 -0
  40. package/src/tableExtend/type.ts +173 -0
  41. package/src/tableExtend/useTable.ts +136 -0
  42. package/src/textButton/index.ts +8 -0
  43. package/src/textButton/src/index.vue +39 -0
  44. package/tsconfig.json +5 -0
  45. package/types/index.d.ts +1 -0
  46. package/types/json.d.ts +4 -0
  47. package/types/vue.shim.d.ts +5 -0
@@ -0,0 +1 @@
1
+ (function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-i18n"),require("@qy_better_lib/core")):typeof define=="function"&&define.amd?define(["exports","vue","vue-i18n","@qy_better_lib/core"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u["@qy_better_lib/pc"]={},u.Vue,u.vueI18n,u.core))})(this,function(u,e,z,P){"use strict";const S=e.defineComponent({name:"TextButton",__name:"index",props:{type:{type:String,default:"primary",validator:o=>["default","primary","success","warning","info","danger"].includes(o)},disabled:Boolean},emits:["click"],setup(o,{emit:n}){const l=o,s=n;function d(m){l.disabled||s("click",m)}return(m,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${o.type}`,o.disabled&&"is-disabled"]]),onClick:e.withModifiers(d,["prevent","stop"])},[e.renderSlot(m.$slots,"default")],2))}});S.install=o=>{o.component("TextButton",S)};var $=(o=>(o[o.PICTURE=1]="PICTURE",o[o.PDF=2]="PDF",o[o.OTHER=3]="OTHER",o))($||{});function R(o){var i,h;const n=e.getCurrentInstance(),l=n==null?void 0:n.props,s={rowKey:"Id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1,height:"100%"},d={headerAlign:void 0,align:void 0,prop:void 0,label:void 0,init:!0,width:void 0,showOverflowTooltip:!1,sortable:void 0,fixed:void 0},m=e.computed(()=>({...s,...Object.keys(l.options).length>0?l.options:{}})),_=e.reactive({count:0,rows:[]}),y=e.reactive({pageIndex:(i=l==null?void 0:l.paging)!=null&&i.pageIndex?e.toRef(l.paging,"pageIndex"):1,pageSize:(h=l==null?void 0:l.paging)!=null&&h.pageSize?e.toRef(l.paging,"pageSize"):10}),g=e.computed(()=>{var c,r;return((c=l==null?void 0:l.paging)==null?void 0:c.pageIndex)>0&&((r=l==null?void 0:l.paging)==null?void 0:r.pageSize)>0}),f=e.reactive({show:!1,filePathList:[],index:0}),a=e.reactive({showColumn:[],hiddenColumn:[]}),b=e.computed(()=>!a.showColumn||a.showColumn.length===0?[{prop:"default-prop",init:!0,label:""}]:a.showColumn.map(r=>(o&&r.langue&&(r.label=o(r.langue)),{...d,...r}))),C=e.computed(()=>{var c,r,p,x,t,B;return(((p=(r=n==null?void 0:(c=n.slots)["tool-left"])==null?void 0:r.call(c))==null?void 0:p.length)||0)>0||(((B=(t=n==null?void 0:(x=n.slots)["tool-right"])==null?void 0:t.call(x))==null?void 0:B.length)||0)>0}),w=e.computed(()=>b.value.some(c=>c.fileType&&c.fileType==$.PICTURE));return{defColSetting:d,selectionOptions:_,tableAttribute:m,pagination:y,hasPagination:g,imageViewer:f,columnConfig:a,colSettingList:b,showToolPanel:C,hasImageViewer:w}}function L(){return{options:{type:Object,default:()=>({})},tableData:{type:Array,default:[]},tableColums:{type:Array,default:()=>[]},tableLoading:Boolean,selectionCol:{type:Boolean,default:()=>!0},indexCol:{type:Boolean,default:()=>!0},isSetColumn:{type:Boolean,default:()=>!1},paging:{type:Object},total:Number,sizeList:{type:Array,default:()=>[15,20,30,50,100]}}}const D=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(o){const n=o,l=e.computed(()=>{const{row:s,colCfg:d}=n;return s[d.prop]});return(s,d)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(l.value!=null?l.value:"--"),1))}}),O={class:"set-column-list-wrap"},I={class:"fixed-wrap"},M=e.defineComponent({__name:"colVisible",setup(o){const n=e.inject("table-extend"),l=e.ref(!0),s=e.ref(!1),d=e.computed(()=>n&&n.columnConfig.showColumn.map(f=>f.prop)||[]),m=e.computed(()=>(n==null?void 0:n.tableColums.value)||[]);function _(f){f?n&&(n.columnConfig.showColumn=m.value):n&&(n.columnConfig.showColumn=[])}function y(f){if(n){n.columnConfig.showColumn=m.value.filter(b=>f.includes(b.prop));const a=f.length;l.value=a===m.value.length,s.value=a>0&&a<m.value.length}}function g(f,a){a.fixed===f?a.fixed=void 0:a.fixed=f}return(f,a)=>{const b=e.resolveComponent("Setting"),C=e.resolveComponent("el-icon"),w=e.resolveComponent("el-checkbox"),i=e.resolveComponent("Upload"),h=e.resolveComponent("el-divider"),c=e.resolveComponent("el-checkbox-group"),r=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(r,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(b)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(w,{indeterminate:s.value,modelValue:l.value,"onUpdate:modelValue":a[0]||(a[0]=p=>l.value=p),onChange:_},{default:e.withCtx(()=>[e.createTextVNode("全选 ")]),_:1},8,["indeterminate","modelValue"]),e.createVNode(c,{class:"set-column-check-group",modelValue:d.value,"onUpdate:modelValue":a[1]||(a[1]=p=>d.value=p),onChange:y},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,p=>(e.openBlock(),e.createElementBlock("div",{class:"group-item",key:p.prop},[e.createVNode(w,{class:"set-column-check",label:p.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",I,[e.createVNode(C,{class:e.normalizeClass(["fixed-icon",p.fixed==="left"&&"active"]),title:"固定到左边",onClick:x=>g("left",p)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"]),e.createVNode(h,{direction:"vertical"}),e.createVNode(C,{class:e.normalizeClass(["fixed-icon",p.fixed==="right"&&"active"]),title:"固定到右边",onClick:x=>g("right",p)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),j={class:"table-extend"},A={class:"tool-panel"},U={class:"left-panel"},q={class:"right-panel"},H={class:"default-tool"},X=["innerHTML"],V=e.defineComponent({__name:"index",props:{...L()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(o,{expose:n,emit:l}){const s=o,d=l,{t:m}=z.useI18n(),{selectionOptions:_,tableAttribute:y,pagination:g,hasPagination:f,columnConfig:a,colSettingList:b}=R(m);e.provide("table-extend",{tableProps:s,tableColums:e.toRef(s,"tableColums"),columnConfig:a});const C=e.ref(null),w=e.ref(!1);e.watch(()=>s.tableColums,()=>{a.showColumn=s.tableColums}),e.watch(()=>g.pageIndex,t=>{if(t&&t>0){if(w.value){w.value=!1;return}d("currentChange",t),C.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,t=>{t&&t>0&&(w.value=!0,g.pageIndex=1,d("pageSizeChange",t),C.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{s.tableColums&&s.tableColums.length>0&&(a.showColumn=s.tableColums)})}),n({clearSelection:p,toggleRowSelection:x});function i(t){d("tableSort",{sortName:t.prop,sortType:t.order==="descending"?"desc":t.order==="ascending"?"asc":""})}function h(t){_.rows=t,_.count=t&&t.length,d("handleSelectionChange",t)}function c(t){d("rowClick",t)}function r(t){d("rowDblClick",t)}function p(){var t;(t=C.value)==null||t.clearSelection()}function x(t){var B;(B=C.value)==null||B.toggleRowSelection(t)}return(t,B)=>{const N=e.resolveComponent("el-table-column"),J=e.resolveComponent("el-empty"),Q=e.resolveComponent("el-table"),Z=e.resolveComponent("el-pagination"),v=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",U,[e.renderSlot(t.$slots,"tool-left")]),e.createElementVNode("div",q,[e.renderSlot(t.$slots,"tool-right"),e.createElementVNode("div",H,[t.isSetColumn?(e.openBlock(),e.createBlock(M,{key:0})):e.createCommentVNode("",!0)])])]),e.withDirectives((e.openBlock(),e.createBlock(Q,e.mergeProps({ref_key:"tableRef",ref:C},e.unref(y),{data:t.tableData,onSortChange:i,onSelectionChange:h,onRowClick:c,onRowDblclick:r}),{empty:e.withCtx(()=>[e.createVNode(J,{"image-size":60})]),default:e.withCtx(()=>[t.selectionCol?(e.openBlock(),e.createBlock(N,{key:0,type:"selection",width:"48",fixed:"left"})):e.createCommentVNode("",!0),t.indexCol?(e.openBlock(),e.createBlock(N,{key:1,type:"index",width:"58",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),k=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k.prop},[k.isHtml?(e.openBlock(),e.createBlock(N,e.mergeProps({key:0,ref_for:!0},k),{default:e.withCtx(T=>[e.createElementVNode("div",{innerHTML:k.prop&&T.row[k.prop]},null,8,X)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[k.init?(e.openBlock(),e.createBlock(N,e.mergeProps({key:0,ref_for:!0},k),{default:e.withCtx(T=>[e.renderSlot(t.$slots,`col_${k.prop}`,{data:T.row},()=>[e.createVNode(D,e.mergeProps({ref_for:!0},{row:T.row,colCfg:k}),null,16)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(t.$slots,"operatColumn")]),_:3},16,["data"])),[[v,t.tableLoading]]),e.unref(f)?(e.openBlock(),e.createBlock(Z,{key:0,background:"","current-page":e.unref(g).pageIndex,"onUpdate:currentPage":B[0]||(B[0]=k=>e.unref(g).pageIndex=k),"page-size":e.unref(g).pageSize,"onUpdate:pageSize":B[1]||(B[1]=k=>e.unref(g).pageSize=k),"page-sizes":t.sizeList,layout:"total, sizes, prev, pager, next, jumper",total:t.total},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)])}}});V.install=o=>{o.component("TableExtend",V)};const F={class:"contextmenu-wrap"},Y={class:"contextmenu-items"},W=["onClick"],E=e.defineComponent({__name:"index",props:{visible:{type:Boolean,default:()=>!1},position:{type:Object,default:()=>{}},options:{type:Array,default:[],required:!0}},emits:["menuClick","update:visible"],setup(o,{expose:n,emit:l}){const s=o,d=l;n({hide:C,show:a});const m=e.ref(!1),_=e.ref(null),y=e.reactive({left:0,top:0});e.watch(()=>s.visible,i=>{i&&(m.value=!0,e.nextTick(()=>{b(s.position)}))},{immediate:!0}),e.onMounted(()=>{var i;(i=_.value)==null||i.addEventListener("contextmenu",a)}),e.onBeforeUnmount(()=>{g()});function g(){var i;(i=_.value)==null||i.removeEventListener("contextmenu",a)}function f(i){d("menuClick",i),C()}async function a(i){i.preventDefault(),m.value=!0,await e.nextTick();const{pageX:h,pageY:c}=i;b({x:h,y:c})}function b(i){const{clientWidth:h,clientHeight:c}=_.value;!h||!c||(y.top=`${w("Y",i.y||0,c)}px`,y.left=`${w("X",i.x||0,h)}px`)}function C(){g(),m.value=!1,e.nextTick(()=>{d("update:visible",!1)})}function w(i,h,c){const r=i==="X"?window.innerWidth:window.innerHeight,p=i==="X"?window.scrollX:window.scrollY;let x=h-p;return x+c>r&&(x=Math.max(0,x-c)),x+p}return(i,h)=>{const c=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[m.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:"contextmenu",style:e.normalizeStyle({top:y.top,left:y.left}),ref_key:"contextMenuRef",ref:_},[e.createElementVNode("div",F,[e.createElementVNode("ul",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(r==null?void 0:r.type)=="divider"?(e.openBlock(),e.createBlock(c,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:p=>f(r)},[e.renderSlot(i.$slots,"items",{data:{item:r,options:o.options}},()=>[e.createTextVNode(e.toDisplayString(r.label),1)])],8,W))],64))),128))])])],4)),[[e.unref(P.ClickOutside),C]]):e.createCommentVNode("",!0)])}}});E.install=o=>{o.component("ContextMenu",E)};const K=[S,V,E];function G(o){K.forEach(n=>{o.use(n)})}u.contextMenu=E,u.install=G,u.tableExtend=V,u.textButton=S,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,3 @@
1
+ import { default as contextMenu } from './src/index.vue';
2
+
3
+ export default contextMenu;
@@ -0,0 +1,7 @@
1
+ import t from "./src/index.vue.js";
2
+ t.install = (n) => {
3
+ n.component("ContextMenu", t);
4
+ };
5
+ export {
6
+ t as default
7
+ };
@@ -0,0 +1,71 @@
1
+ import { PropType, DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
2
+
3
+ /**
4
+ * 右键菜单显示
5
+ */
6
+ declare function show(e: any): Promise<void>;
7
+ declare function hide(): void;
8
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
9
+ visible: {
10
+ type: BooleanConstructor;
11
+ default: () => boolean;
12
+ };
13
+ position: {
14
+ type: PropType<{
15
+ x: number;
16
+ y: number;
17
+ }>;
18
+ default: () => void;
19
+ };
20
+ options: {
21
+ type: PropType<Record<string, any>>;
22
+ default: never[];
23
+ required: true;
24
+ };
25
+ }, {
26
+ hide: typeof hide;
27
+ show: typeof show;
28
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
29
+ menuClick: (...args: any[]) => void;
30
+ "update:visible": (...args: any[]) => void;
31
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
32
+ visible: {
33
+ type: BooleanConstructor;
34
+ default: () => boolean;
35
+ };
36
+ position: {
37
+ type: PropType<{
38
+ x: number;
39
+ y: number;
40
+ }>;
41
+ default: () => void;
42
+ };
43
+ options: {
44
+ type: PropType<Record<string, any>>;
45
+ default: never[];
46
+ required: true;
47
+ };
48
+ }>> & {
49
+ onMenuClick?: ((...args: any[]) => any) | undefined;
50
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
51
+ }, {
52
+ options: Record<string, any>;
53
+ visible: boolean;
54
+ position: {
55
+ x: number;
56
+ y: number;
57
+ };
58
+ }, {}>, {
59
+ items?(_: {
60
+ data: {
61
+ item: any;
62
+ options: Record<string, any>;
63
+ };
64
+ }): any;
65
+ }>;
66
+ export default _default;
67
+ type __VLS_WithTemplateSlots<T, S> = T & {
68
+ new (): {
69
+ $slots: S;
70
+ };
71
+ };
@@ -0,0 +1,108 @@
1
+ import { defineComponent as M, ref as h, reactive as X, watch as $, nextTick as m, onMounted as D, onBeforeUnmount as L, resolveComponent as N, openBlock as i, createBlock as _, Teleport as P, withDirectives as S, createElementBlock as a, normalizeStyle as T, createElementVNode as C, Fragment as b, renderList as V, renderSlot as Y, createTextVNode as H, toDisplayString as O, unref as R, createCommentVNode as W } from "vue";
2
+ import { ClickOutside as j } from "@qy_better_lib/core";
3
+ const q = { class: "contextmenu-wrap" }, z = { class: "contextmenu-items" }, A = ["onClick"], G = /* @__PURE__ */ M({
4
+ __name: "index",
5
+ props: {
6
+ visible: {
7
+ type: Boolean,
8
+ default: () => !1
9
+ },
10
+ position: {
11
+ type: Object,
12
+ default: () => {
13
+ }
14
+ },
15
+ options: {
16
+ type: Array,
17
+ default: [],
18
+ required: !0
19
+ }
20
+ },
21
+ emits: ["menuClick", "update:visible"],
22
+ setup(u, { expose: g, emit: B }) {
23
+ const v = u, y = B;
24
+ g({
25
+ hide: p,
26
+ show: d
27
+ });
28
+ const l = h(!1), s = h(null), c = X({
29
+ left: 0,
30
+ top: 0
31
+ });
32
+ $(() => v.visible, (e) => {
33
+ e && (l.value = !0, m(() => {
34
+ k(v.position);
35
+ }));
36
+ }, {
37
+ immediate: !0
38
+ }), D(() => {
39
+ var e;
40
+ (e = s.value) == null || e.addEventListener("contextmenu", d);
41
+ }), L(() => {
42
+ x();
43
+ });
44
+ function x() {
45
+ var e;
46
+ (e = s.value) == null || e.removeEventListener("contextmenu", d);
47
+ }
48
+ function E(e) {
49
+ y("menuClick", e), p();
50
+ }
51
+ async function d(e) {
52
+ e.preventDefault(), l.value = !0, await m();
53
+ const { pageX: o, pageY: t } = e;
54
+ k({ x: o, y: t });
55
+ }
56
+ function k(e) {
57
+ const { clientWidth: o, clientHeight: t } = s.value;
58
+ !o || !t || (c.top = `${w("Y", e.y || 0, t)}px`, c.left = `${w("X", e.x || 0, o)}px`);
59
+ }
60
+ function p() {
61
+ x(), l.value = !1, m(() => {
62
+ y("update:visible", !1);
63
+ });
64
+ }
65
+ function w(e, o, t) {
66
+ const n = e === "X" ? window.innerWidth : window.innerHeight, f = e === "X" ? window.scrollX : window.scrollY;
67
+ let r = o - f;
68
+ return r + t > n && (r = Math.max(0, r - t)), r + f;
69
+ }
70
+ return (e, o) => {
71
+ const t = N("el-divider");
72
+ return i(), _(P, { to: "body" }, [
73
+ l.value ? S((i(), a("div", {
74
+ key: 0,
75
+ class: "contextmenu",
76
+ style: T({ top: c.top, left: c.left }),
77
+ ref_key: "contextMenuRef",
78
+ ref: s
79
+ }, [
80
+ C("div", q, [
81
+ C("ul", z, [
82
+ (i(!0), a(b, null, V(u.options, (n) => (i(), a(b, {
83
+ key: n.key
84
+ }, [
85
+ (n == null ? void 0 : n.type) == "divider" ? (i(), _(t, { key: 0 })) : (i(), a("li", {
86
+ key: 1,
87
+ class: "contextmenu-item",
88
+ onClick: (f) => E(n)
89
+ }, [
90
+ Y(e.$slots, "items", {
91
+ data: { item: n, options: u.options }
92
+ }, () => [
93
+ H(O(n.label), 1)
94
+ ])
95
+ ], 8, A))
96
+ ], 64))), 128))
97
+ ])
98
+ ])
99
+ ], 4)), [
100
+ [R(j), p]
101
+ ]) : W("", !0)
102
+ ]);
103
+ };
104
+ }
105
+ });
106
+ export {
107
+ G as default
108
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.js";
2
+ export {
3
+ f as default
4
+ };
package/lib/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { default as textButton } from './textButton';
2
+ import { default as tableExtend } from './tableExtend';
3
+ import { default as contextMenu } from './contextMenu';
4
+ import { App } from 'vue';
5
+
6
+ declare function install(app: App): void;
7
+ export type { TableProp, TableColumn } from './tableExtend';
8
+ export { install, textButton, tableExtend, contextMenu };
package/lib/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import "./textButton/index.js";
2
+ import "./tableExtend/index.js";
3
+ import "./contextMenu/index.js";
4
+ import m from "./textButton/src/index.vue.js";
5
+ import n from "./tableExtend/src/index.vue.js";
6
+ import i from "./contextMenu/src/index.vue.js";
7
+ const r = [m, n, i];
8
+ function _(t) {
9
+ r.forEach((o) => {
10
+ t.use(o);
11
+ });
12
+ }
13
+ export {
14
+ i as contextMenu,
15
+ _ as install,
16
+ n as tableExtend,
17
+ m as textButton
18
+ };
@@ -0,0 +1,4 @@
1
+ import { default as tableExtend } from './src/index.vue';
2
+
3
+ export type { TableProp, TableColumn } from './type';
4
+ export default tableExtend;
@@ -0,0 +1,7 @@
1
+ import t from "./src/index.vue.js";
2
+ t.install = (a) => {
3
+ a.component("TableExtend", t);
4
+ };
5
+ export {
6
+ t as default
7
+ };
@@ -0,0 +1,52 @@
1
+ import { PropType } from 'vue';
2
+ import { TableAttr, TableColumn } from './type';
3
+
4
+ /**表单组件属性 */
5
+ export default function props(): {
6
+ /**UI选项配置 */
7
+ options: {
8
+ type: PropType<TableAttr>;
9
+ default: () => {};
10
+ };
11
+ /**表格数据源 */
12
+ tableData: {
13
+ type: ArrayConstructor;
14
+ default: never[];
15
+ };
16
+ /**表格列(所有列) */
17
+ tableColums: {
18
+ type: PropType<TableColumn[]>;
19
+ default: () => never[];
20
+ };
21
+ /**loading显示状态 */
22
+ tableLoading: BooleanConstructor;
23
+ /**是否显示列check */
24
+ selectionCol: {
25
+ type: BooleanConstructor;
26
+ default: () => boolean;
27
+ };
28
+ /**是否显示索引列 */
29
+ indexCol: {
30
+ type: BooleanConstructor;
31
+ default: () => boolean;
32
+ };
33
+ /**是否能设置表格列 */
34
+ isSetColumn: {
35
+ type: BooleanConstructor;
36
+ default: () => boolean;
37
+ };
38
+ /**是否显示分页 */
39
+ paging: {
40
+ type: PropType<{
41
+ pageIndex: number;
42
+ pageSize: number;
43
+ }>;
44
+ };
45
+ /**总数 */
46
+ total: NumberConstructor;
47
+ /**可选页面大小 */
48
+ sizeList: {
49
+ type: PropType<number[]>;
50
+ default: () => number[];
51
+ };
52
+ };
@@ -0,0 +1,50 @@
1
+ function e() {
2
+ return {
3
+ /**UI选项配置 */
4
+ options: {
5
+ type: Object,
6
+ default: () => ({})
7
+ },
8
+ /**表格数据源 */
9
+ tableData: {
10
+ type: Array,
11
+ default: []
12
+ },
13
+ /**表格列(所有列) */
14
+ tableColums: {
15
+ type: Array,
16
+ default: () => []
17
+ },
18
+ /**loading显示状态 */
19
+ tableLoading: Boolean,
20
+ /**是否显示列check */
21
+ selectionCol: {
22
+ type: Boolean,
23
+ default: () => !0
24
+ },
25
+ /**是否显示索引列 */
26
+ indexCol: {
27
+ type: Boolean,
28
+ default: () => !0
29
+ },
30
+ /**是否能设置表格列 */
31
+ isSetColumn: {
32
+ type: Boolean,
33
+ default: () => !1
34
+ },
35
+ /**是否显示分页 */
36
+ paging: {
37
+ type: Object
38
+ },
39
+ /**总数 */
40
+ total: Number,
41
+ /**可选页面大小 */
42
+ sizeList: {
43
+ type: Array,
44
+ default: () => [15, 20, 30, 50, 100]
45
+ }
46
+ };
47
+ }
48
+ export {
49
+ e as default
50
+ };
@@ -0,0 +1,3 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
2
+ declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{}>>, {}, {}>;
3
+ export default _default;
@@ -0,0 +1,103 @@
1
+ import { defineComponent as A, inject as E, ref as v, computed as h, resolveComponent as i, openBlock as r, createBlock as F, withCtx as c, createVNode as t, createElementVNode as g, createTextVNode as k, createElementBlock as x, Fragment as $, renderList as j, toDisplayString as y, normalizeClass as b } from "vue";
2
+ const z = { class: "set-column-list-wrap" }, D = { class: "fixed-wrap" }, T = /* @__PURE__ */ A({
3
+ __name: "colVisible",
4
+ setup(I) {
5
+ const n = E("table-extend"), s = v(!0), m = v(!1), f = h(() => n && n.columnConfig.showColumn.map((l) => l.prop) || []), a = h(() => (n == null ? void 0 : n.tableColums.value) || []);
6
+ function V(l) {
7
+ l ? n && (n.columnConfig.showColumn = a.value) : n && (n.columnConfig.showColumn = []);
8
+ }
9
+ function w(l) {
10
+ if (n) {
11
+ n.columnConfig.showColumn = a.value.filter((u) => l.includes(u.prop));
12
+ const e = l.length;
13
+ s.value = e === a.value.length, m.value = e > 0 && e < a.value.length;
14
+ }
15
+ }
16
+ function p(l, e) {
17
+ e.fixed === l ? e.fixed = void 0 : e.fixed = l;
18
+ }
19
+ return (l, e) => {
20
+ const u = i("Setting"), d = i("el-icon"), _ = i("el-checkbox"), C = i("Upload"), U = i("el-divider"), B = i("el-checkbox-group"), N = i("el-popover");
21
+ return r(), F(N, {
22
+ placement: "bottom",
23
+ title: "列显示设置",
24
+ width: 220
25
+ }, {
26
+ reference: c(() => [
27
+ t(d, null, {
28
+ default: c(() => [
29
+ t(u)
30
+ ]),
31
+ _: 1
32
+ })
33
+ ]),
34
+ default: c(() => [
35
+ g("div", z, [
36
+ t(_, {
37
+ indeterminate: m.value,
38
+ modelValue: s.value,
39
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => s.value = o),
40
+ onChange: V
41
+ }, {
42
+ default: c(() => [
43
+ k("全选 ")
44
+ ]),
45
+ _: 1
46
+ }, 8, ["indeterminate", "modelValue"]),
47
+ t(B, {
48
+ class: "set-column-check-group",
49
+ modelValue: f.value,
50
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => f.value = o),
51
+ onChange: w
52
+ }, {
53
+ default: c(() => [
54
+ (r(!0), x($, null, j(a.value, (o) => (r(), x("div", {
55
+ class: "group-item",
56
+ key: o.prop
57
+ }, [
58
+ t(_, {
59
+ class: "set-column-check",
60
+ label: o.prop
61
+ }, {
62
+ default: c(() => [
63
+ k(y(o.label), 1)
64
+ ]),
65
+ _: 2
66
+ }, 1032, ["label"]),
67
+ g("div", D, [
68
+ t(d, {
69
+ class: b(["fixed-icon", o.fixed === "left" && "active"]),
70
+ title: "固定到左边",
71
+ onClick: (S) => p("left", o)
72
+ }, {
73
+ default: c(() => [
74
+ t(C)
75
+ ]),
76
+ _: 2
77
+ }, 1032, ["class", "onClick"]),
78
+ t(U, { direction: "vertical" }),
79
+ t(d, {
80
+ class: b(["fixed-icon", o.fixed === "right" && "active"]),
81
+ title: "固定到右边",
82
+ onClick: (S) => p("right", o)
83
+ }, {
84
+ default: c(() => [
85
+ t(C)
86
+ ]),
87
+ _: 2
88
+ }, 1032, ["class", "onClick"])
89
+ ])
90
+ ]))), 128))
91
+ ]),
92
+ _: 1
93
+ }, 8, ["modelValue"])
94
+ ])
95
+ ]),
96
+ _: 1
97
+ });
98
+ };
99
+ }
100
+ });
101
+ export {
102
+ T as default
103
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./colVisible.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,117 @@
1
+ import { DefineComponent, PropType, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
2
+ import { TableAttr, TableColumn } from './../type';
3
+ declare function clearSelection(): void;
4
+ declare function toggleRowSelection(row: any): void;
5
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
6
+ options: {
7
+ type: PropType<TableAttr>;
8
+ default: () => {};
9
+ };
10
+ tableData: {
11
+ type: ArrayConstructor;
12
+ default: never[];
13
+ };
14
+ tableColums: {
15
+ type: PropType< TableColumn[]>;
16
+ default: () => never[];
17
+ };
18
+ tableLoading: BooleanConstructor;
19
+ selectionCol: {
20
+ type: BooleanConstructor;
21
+ default: () => boolean;
22
+ };
23
+ indexCol: {
24
+ type: BooleanConstructor;
25
+ default: () => boolean;
26
+ };
27
+ isSetColumn: {
28
+ type: BooleanConstructor;
29
+ default: () => boolean;
30
+ };
31
+ paging: {
32
+ type: PropType<{
33
+ pageIndex: number;
34
+ pageSize: number;
35
+ }>;
36
+ };
37
+ total: NumberConstructor;
38
+ sizeList: {
39
+ type: PropType<number[]>;
40
+ default: () => number[];
41
+ };
42
+ }, {
43
+ clearSelection: typeof clearSelection;
44
+ toggleRowSelection: typeof toggleRowSelection;
45
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
46
+ tableSort: (...args: any[]) => void;
47
+ handleSelectionChange: (...args: any[]) => void;
48
+ currentChange: (...args: any[]) => void;
49
+ pageSizeChange: (...args: any[]) => void;
50
+ rowClick: (...args: any[]) => void;
51
+ rowDblClick: (...args: any[]) => void;
52
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
53
+ options: {
54
+ type: PropType<TableAttr>;
55
+ default: () => {};
56
+ };
57
+ tableData: {
58
+ type: ArrayConstructor;
59
+ default: never[];
60
+ };
61
+ tableColums: {
62
+ type: PropType< TableColumn[]>;
63
+ default: () => never[];
64
+ };
65
+ tableLoading: BooleanConstructor;
66
+ selectionCol: {
67
+ type: BooleanConstructor;
68
+ default: () => boolean;
69
+ };
70
+ indexCol: {
71
+ type: BooleanConstructor;
72
+ default: () => boolean;
73
+ };
74
+ isSetColumn: {
75
+ type: BooleanConstructor;
76
+ default: () => boolean;
77
+ };
78
+ paging: {
79
+ type: PropType<{
80
+ pageIndex: number;
81
+ pageSize: number;
82
+ }>;
83
+ };
84
+ total: NumberConstructor;
85
+ sizeList: {
86
+ type: PropType<number[]>;
87
+ default: () => number[];
88
+ };
89
+ }>> & {
90
+ onTableSort?: ((...args: any[]) => any) | undefined;
91
+ onHandleSelectionChange?: ((...args: any[]) => any) | undefined;
92
+ onCurrentChange?: ((...args: any[]) => any) | undefined;
93
+ onPageSizeChange?: ((...args: any[]) => any) | undefined;
94
+ onRowClick?: ((...args: any[]) => any) | undefined;
95
+ onRowDblClick?: ((...args: any[]) => any) | undefined;
96
+ }, {
97
+ tableColums: TableColumn[];
98
+ options: TableAttr;
99
+ tableData: unknown[];
100
+ tableLoading: boolean;
101
+ selectionCol: boolean;
102
+ indexCol: boolean;
103
+ isSetColumn: boolean;
104
+ sizeList: number[];
105
+ }, {}>, Partial<Record<`col_${string}`, (_: {
106
+ data: any;
107
+ }) => any>> & {
108
+ "tool-left"?(_: {}): any;
109
+ "tool-right"?(_: {}): any;
110
+ operatColumn?(_: {}): any;
111
+ }>;
112
+ export default _default;
113
+ type __VLS_WithTemplateSlots<T, S> = T & {
114
+ new (): {
115
+ $slots: S;
116
+ };
117
+ };