@king-one/antdv 1.0.76 → 1.0.78

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 (84) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/components/index.mjs +8 -6
  3. package/dist/es/components/pro-table/hooks/use-pro-table.mjs +11 -0
  4. package/dist/es/components/pro-table/index.mjs +12 -0
  5. package/dist/es/components/pro-table/src/constants.mjs +23 -0
  6. package/dist/es/components/pro-table/src/field/field-date-range/field-date-range.vue.mjs +4 -0
  7. package/dist/es/components/pro-table/src/field/field-date-range/field-date-range.vue2.mjs +28 -0
  8. package/dist/es/components/pro-table/src/field/field-input/field-input.vue.mjs +4 -0
  9. package/dist/es/components/pro-table/src/field/field-input/field-input.vue2.mjs +28 -0
  10. package/dist/es/components/pro-table/src/field/field-radio/field-radio.vue.mjs +4 -0
  11. package/dist/es/components/pro-table/src/field/field-radio/field-radio.vue2.mjs +54 -0
  12. package/dist/es/components/pro-table/src/field/field-select/field-select.vue.mjs +4 -0
  13. package/dist/es/components/pro-table/src/field/field-select/field-select.vue2.mjs +54 -0
  14. package/dist/es/components/pro-table/src/field/field.css +1 -0
  15. package/dist/es/components/pro-table/src/field/field.vue.mjs +5 -0
  16. package/dist/es/components/pro-table/src/field/field.vue2.mjs +118 -0
  17. package/dist/es/components/pro-table/src/form-render.css +1 -0
  18. package/dist/es/components/pro-table/src/form-render.vue.mjs +5 -0
  19. package/dist/es/components/pro-table/src/form-render.vue2.mjs +147 -0
  20. package/dist/es/components/pro-table/src/hooks/use-form.mjs +22 -0
  21. package/dist/es/components/pro-table/src/hooks/use-table.mjs +39 -0
  22. package/dist/es/components/pro-table/src/pro-table.css +1 -0
  23. package/dist/es/components/pro-table/src/pro-table.vue.mjs +5 -0
  24. package/dist/es/components/pro-table/src/pro-table.vue2.mjs +192 -0
  25. package/dist/es/components/pro-table/src/types.mjs +1 -0
  26. package/dist/es/components/pro-table/style/index.mjs +2 -0
  27. package/dist/es/components/pro-table/utils.mjs +15 -0
  28. package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +39 -40
  29. package/dist/es/components/scroll-bar/src/scroll-bar.mjs +140 -130
  30. package/dist/es/components/scroll-bar/src/types.mjs +6 -3
  31. package/dist/es/index.mjs +14 -10
  32. package/dist/lib/components/index.js +1 -1
  33. package/dist/lib/components/pro-table/hooks/use-pro-table.js +1 -0
  34. package/dist/lib/components/pro-table/index.js +1 -0
  35. package/dist/lib/components/pro-table/src/constants.js +1 -0
  36. package/dist/lib/components/pro-table/src/field/field-date-range/field-date-range.vue.js +1 -0
  37. package/dist/lib/components/pro-table/src/field/field-date-range/field-date-range.vue2.js +1 -0
  38. package/dist/lib/components/pro-table/src/field/field-input/field-input.vue.js +1 -0
  39. package/dist/lib/components/pro-table/src/field/field-input/field-input.vue2.js +1 -0
  40. package/dist/lib/components/pro-table/src/field/field-radio/field-radio.vue.js +1 -0
  41. package/dist/lib/components/pro-table/src/field/field-radio/field-radio.vue2.js +1 -0
  42. package/dist/lib/components/pro-table/src/field/field-select/field-select.vue.js +1 -0
  43. package/dist/lib/components/pro-table/src/field/field-select/field-select.vue2.js +1 -0
  44. package/dist/lib/components/pro-table/src/field/field.css +1 -0
  45. package/dist/lib/components/pro-table/src/field/field.vue.js +1 -0
  46. package/dist/lib/components/pro-table/src/field/field.vue2.js +1 -0
  47. package/dist/lib/components/pro-table/src/form-render.css +1 -0
  48. package/dist/lib/components/pro-table/src/form-render.vue.js +1 -0
  49. package/dist/lib/components/pro-table/src/form-render.vue2.js +1 -0
  50. package/dist/lib/components/pro-table/src/hooks/use-form.js +1 -0
  51. package/dist/lib/components/pro-table/src/hooks/use-table.js +1 -0
  52. package/dist/lib/components/pro-table/src/pro-table.css +1 -0
  53. package/dist/lib/components/pro-table/src/pro-table.vue.js +1 -0
  54. package/dist/lib/components/pro-table/src/pro-table.vue2.js +1 -0
  55. package/dist/lib/components/pro-table/src/types.js +1 -0
  56. package/dist/lib/components/pro-table/style/index.js +1 -0
  57. package/dist/lib/components/pro-table/utils.js +1 -0
  58. package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +1 -1
  59. package/dist/lib/components/scroll-bar/src/scroll-bar.js +1 -1
  60. package/dist/lib/components/scroll-bar/src/types.js +1 -1
  61. package/dist/lib/index.js +1 -1
  62. package/dist/theme-chalk/icon.css +1 -1
  63. package/dist/theme-chalk/index.css +1 -1
  64. package/dist/theme-chalk/pro-table.css +1 -0
  65. package/dist/types/components/index.d.ts +1 -0
  66. package/dist/types/components/pro-table/hooks/use-pro-table.d.ts +6 -0
  67. package/dist/types/components/pro-table/index.d.ts +7 -0
  68. package/dist/types/components/pro-table/src/constants.d.ts +5 -0
  69. package/dist/types/components/pro-table/src/field/field-date-range/field-date-range.vue.d.ts +10 -0
  70. package/dist/types/components/pro-table/src/field/field-input/field-input.vue.d.ts +10 -0
  71. package/dist/types/components/pro-table/src/field/field-radio/field-radio.vue.d.ts +10 -0
  72. package/dist/types/components/pro-table/src/field/field-select/field-select.vue.d.ts +10 -0
  73. package/dist/types/components/pro-table/src/field/field.vue.d.ts +7 -0
  74. package/dist/types/components/pro-table/src/form-render.vue.d.ts +8 -0
  75. package/dist/types/components/pro-table/src/hooks/use-form.d.ts +6 -0
  76. package/dist/types/components/pro-table/src/hooks/use-table.d.ts +17 -0
  77. package/dist/types/components/pro-table/src/pro-table.vue.d.ts +62 -0
  78. package/dist/types/components/pro-table/src/types.d.ts +158 -0
  79. package/dist/types/components/pro-table/utils.d.ts +9 -0
  80. package/dist/types/components/scroll-bar/index.d.ts +10 -2
  81. package/dist/types/components/scroll-bar/src/scroll-bar.d.ts +10 -2
  82. package/dist/types/components/scroll-bar/src/types.d.ts +4 -1
  83. package/global.d.ts +1 -0
  84. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@vueuse/shared"),f=require("vue"),G=require("@vueuse/core");function S(r,t){const{containerStyle:a,wrapperProps:c,scrollTo:n,calculateRange:e,currentList:o,containerRef:l,scaleTo:u,state:s,onUpdate:v}="itemHeight"in t?F(t,r):_(t,r);return{onUpdate:v,state:s,scaleTo:u,list:o,scrollTo:n,containerProps:{ref:l,onScroll:()=>{e()},style:a},wrapperProps:c}}function $(r){const t=f.ref(null),a=G.useElementSize(t),c=f.ref([]),n=f.shallowRef(r);return{state:f.ref({start:0,end:10,current:0,scale:1}),source:n,currentList:c,size:a,containerRef:t}}function P(r,t,a){return c=>{const{start:n=0,scale:e=1}=r.value;if(typeof a=="number")return Math.ceil(c/(a*e));let o=0,l=0;for(let u=n;u<t.value.length;u++){const s=a(u)*e;if(o+=s,l=u,o>c)break}return l-n}}function k(r,t,a){return c=>{const{scale:n=1}=a.value;if(typeof t=="number")return Math.floor(c/(t*n))+1;let e=0,o=0;for(let l=0;l<r.value.length;l++){const u=t(l)*n;if(e+=u,e>c){o=l;break}}return o+1}}function x(r,t,a,c,{containerRef:n,state:e,currentList:o,source:l},u){return()=>{const s=n.value;if(s){const v=a(Math.ceil(r==="vertical"?s.scrollTop:s.scrollLeft)),i=c(r==="vertical"?s.clientHeight:s.clientWidth),g=v-t,h=v+i+t;e.value={start:g<0?0:g,end:h>l.value.length?l.value.length:h,current:v-1,scale:e.value.scale},o.value=l.value.slice(e.value.start,e.value.end).map((d,p)=>({data:d,index:p+e.value.start})),u(e.value)}}}function z(r,t,a){return c=>{const{scale:n=1}=a.value;if(typeof r=="number"){const o=c*(r*n);return Math.ceil(o)}const e=t.value.slice(0,c).reduce((o,l,u)=>o+r(u)*n,0);return Math.ceil(e)}}function E(r,t,a,c){f.watch([r.width,r.height,t,a],()=>{c()})}function W(r,t,a){return f.computed(()=>{const{scale:c=1}=a.value;return typeof r=="number"?t.value.length*r*c:t.value.reduce((n,e,o)=>n+r(o)*c,0)})}const U={horizontal:"scrollLeft",vertical:"scrollTop"};function q(r,t,a,c){return n=>{if(c.value){if(n<0)return;const e=a(n);c.value[U[r]]=e,t()}}}function _(r,t){const{on:a,trigger:c}=O.createEventHook(),n=$(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=n,v={overflowX:"auto"},{itemWidth:i,overscan:g=5}=r,h=P(e,o,i),d=k(o,i,e),p=x("horizontal",g,d,h,n,c),m=z(i,o,e),T=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("horizontal",p,m,s),V=y=>{e.value.scale=y},H=f.computed(()=>({style:{height:"100%",width:`${b.value-T.value}px`,marginLeft:`${T.value}px`,display:"flex",transform:`scale(${e.value.scale})`,transformOrigin:"0% 0%"}}));return{onUpdate:a,state:e,scaleTo:V,scrollTo:R,calculateRange:p,wrapperProps:H,containerStyle:v,currentList:l,containerRef:s}}function F(r,t){const{on:a,trigger:c}=O.createEventHook(),n=$(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=n,v={overflowY:"auto"},{itemHeight:i,overscan:g=5}=r,h=P(e,o,i),d=k(o,i,e),p=x("vertical",g,d,h,n,c),m=z(i,o,e),T=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("vertical",p,m,s),V=y=>{const L=s.value;if(L){const{current:M}=e.value;let w=0;typeof i=="number"?w=M*(y*i-e.value.scale*i):w=o.value.slice(0,M).reduce((D,X,C)=>D+y*i(C)-e.value.scale*i(C),0),L.scrollTop=L.scrollTop+w>=0?L.scrollTop+w:0,e.value.scale=y}},H=f.computed(()=>({style:{height:`${b.value-T.value}px`,marginTop:`${T.value}px`,transform:`translateX(-50%) scale(${e.value.scale})`,transformOrigin:"50% 0%"}}));return{onUpdate:a,state:e,scaleTo:V,calculateRange:p,scrollTo:R,containerStyle:v,wrapperProps:H,currentList:l,containerRef:s}}exports.useVirtualList=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@vueuse/shared"),f=require("vue"),G=require("@vueuse/core");function S(r,t){const{containerStyle:a,wrapperProps:c,scrollTo:n,calculateRange:e,currentList:o,containerRef:l,scaleTo:u,state:s,onUpdate:v}="itemHeight"in t?F(t,r):_(t,r);return{onUpdate:v,state:s,scaleTo:u,list:o,scrollTo:n,containerProps:{ref:l,onScroll:()=>{e()},style:a},wrapperProps:c}}function $(r){const t=f.ref(null),a=G.useElementSize(t),c=f.ref([]),n=f.shallowRef(r);return{state:f.ref({start:0,end:10,current:0,scale:1}),source:n,currentList:c,size:a,containerRef:t}}function P(r,t,a){return c=>{const{start:n=0,scale:e=1}=r.value;if(typeof a=="number")return Math.ceil(c/(a*e));let o=0,l=0;for(let u=n;u<t.value.length;u++){const s=a(u)*e;if(o+=s,l=u,o>c)break}return l-n}}function k(r,t,a){return c=>{const{scale:n=1}=a.value;if(typeof t=="number")return Math.floor(c/(t*n))+1;let e=0,o=0;for(let l=0;l<r.value.length;l++){const u=t(l)*n;if(e+=u,e>c){o=l;break}}return o+1}}function x(r,t,a,c,{containerRef:n,state:e,currentList:o,source:l},u){return()=>{const s=n.value;if(s){const v=a(r==="vertical"?Math.ceil(s.scrollTop)+1:Math.ceil(s.scrollLeft)),i=c(r==="vertical"?s.clientHeight:s.clientWidth),g=v-t,h=v+i+t;e.value={start:g<0?0:g,end:h>l.value.length?l.value.length:h,current:v-1,scale:e.value.scale},o.value=l.value.slice(e.value.start,e.value.end).map((d,p)=>({data:d,index:p+e.value.start})),u(e.value)}}}function z(r,t,a){return c=>{const{scale:n=1}=a.value;if(typeof r=="number"){const o=c*(r*n);return Math.ceil(o)}const e=t.value.slice(0,c).reduce((o,l,u)=>o+r(u)*n,0);return Math.ceil(e)}}function E(r,t,a,c){f.watch([r.width,r.height,t,a],()=>{c()})}function W(r,t,a){return f.computed(()=>{const{scale:c=1}=a.value;return typeof r=="number"?t.value.length*r*c:t.value.reduce((n,e,o)=>n+r(o)*c,0)})}const U={horizontal:"scrollLeft",vertical:"scrollTop"};function q(r,t,a,c){return n=>{if(c.value){if(n<0)return;c.value[U[r]]=a(n),t()}}}function _(r,t){const{on:a,trigger:c}=O.createEventHook(),n=$(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=n,v={overflowX:"auto"},{itemWidth:i,overscan:g=5}=r,h=P(e,o,i),d=k(o,i,e),p=x("horizontal",g,d,h,n,c),m=z(i,o,e),y=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("horizontal",p,m,s),V=T=>{e.value.scale=T},H=f.computed(()=>({style:{height:"100%",width:`${b.value-y.value}px`,marginLeft:`${y.value}px`,display:"flex",transform:`scale(${e.value.scale})`,transformOrigin:"0% 0%"}}));return{onUpdate:a,state:e,scaleTo:V,scrollTo:R,calculateRange:p,wrapperProps:H,containerStyle:v,currentList:l,containerRef:s}}function F(r,t){const{on:a,trigger:c}=O.createEventHook(),n=$(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=n,v={overflowY:"auto"},{itemHeight:i,overscan:g=5}=r,h=P(e,o,i),d=k(o,i,e),p=x("vertical",g,d,h,n,c),m=z(i,o,e),y=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("vertical",p,m,s),V=T=>{const L=s.value;if(L){const{current:M}=e.value;let w=0;typeof i=="number"?w=M*(T*i-e.value.scale*i):w=o.value.slice(0,M).reduce((D,X,C)=>D+T*i(C)-e.value.scale*i(C),0),L.scrollTop=L.scrollTop+w>=0?L.scrollTop+w:0,e.value.scale=T}},H=f.computed(()=>({style:{height:`${b.value-y.value}px`,marginTop:`${y.value}px`,transform:`translateX(-50%) scale(${e.value.scale})`,transformOrigin:"50% 0%"}}));return{onUpdate:a,state:e,scaleTo:V,calculateRange:p,scrollTo:R,containerStyle:v,wrapperProps:H,currentList:l,containerRef:s}}exports.useVirtualList=S;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),I=require("@vueuse/core"),f=require("evtd"),s=require("../../../hooks/use-namespace/index.js"),ae=require("./types.js"),ce=t.defineComponent({name:"KScrollbar",props:ae.scrollbarProps,inheritAttrs:!1,setup(l){t.onMounted(()=>{l.container||v()});const h=t.ref(null),m=t.ref(null),B=t.ref(null),z=t.ref(null),d=t.ref(null),i=t.ref(null),u=t.ref(null),R=t.ref(null),N=t.ref(null),P=t.ref(null),j=t.computed(()=>{var e;return((e=l.content)==null?void 0:e.call(l))||h.value}),M=t.computed(()=>{var e;return((e=l.container)==null?void 0:e.call(l))||m.value}),T=t.ref(0),X=t.ref(0);I.useResizeObserver(h,()=>{v()}),I.useResizeObserver(m,()=>{v()});const A=t.computed(()=>{const{value:e}=u,{value:n}=d;return e!==null&&n!==null&&n>e}),S=t.ref(!1),K=t.computed(()=>{const{trigger:e}=l;return e==="none"||S.value}),Y=t.computed(()=>{const{value:e}=u,{value:n}=d,{value:o}=N;return e===null||n===null||o===null?0:Math.min(e,o*e/n+5*1.5)}),k=t.computed(()=>`${Y.value}px`),F=t.computed(()=>{const{value:e}=u,{value:n}=T,{value:o}=d,{value:a}=N;if(e===null||o===null||a===null)return 0;{const r=o-e;return r?n/r*(a-Y.value):0}}),G=t.computed(()=>`${F.value}px`);let g=!1,$=0,D=0,x,y;const C=e=>{if(!g)return;y!==void 0&&window.clearTimeout(y),x!==void 0&&window.clearTimeout(x);const{value:n}=u,{value:o}=d,{value:a}=Y;if(n===null||o===null)return;const H=(e.clientY-D)*(o-n)/(n-a),W=o-n;let c=$+H;c=Math.min(W,c),c=Math.max(c,0);const{value:w}=M;w&&(w.scrollTop=c)},V=e=>{e.preventDefault(),e.stopPropagation(),f.off("mousemove",window,C,!0),f.off("mouseup",window,V,!0),g=!1,S.value=!1,v()},J=e=>{e.preventDefault(),e.stopPropagation(),f.on("mousemove",window,C,!0),f.on("mouseup",window,V,!0),$=T.value,D=e.clientY,g=!0,S.value=!0};function Q(e){const{onScroll:n}=l;n&&n(e),O()}const Z=t.computed(()=>{const{value:e}=R,{value:n}=i;return e!==null&&n!==null&&n>e}),p=t.ref(!1),ee=t.computed(()=>{const{trigger:e}=l;return e==="none"||p.value}),L=t.computed(()=>{const{value:e}=R,{value:n}=i,{value:o}=P;return e===null||n===null||o===null?0:o*e/n+5*1.5}),te=t.computed(()=>`${L.value}px`),ne=t.computed(()=>{const{value:e}=R,{value:n}=X,{value:o}=i,{value:a}=P;if(e===null||o===null||a===null)return 0;{const r=o-e;return r?n/r*(a-L.value):0}}),oe=t.computed(()=>`${ne.value}px`);let b=!1,_=0,q=0;const E=e=>{if(!b)return;y!==void 0&&window.clearTimeout(y),x!==void 0&&window.clearTimeout(x);const{value:n}=R,{value:o}=i,{value:a}=L;if(n===null||o===null)return;const H=(e.clientX-q)*(o-n)/(n-a),W=o-n;let c=_+H;c=Math.min(W,c),c=Math.max(c,0);const{value:w}=M;w&&(w.scrollLeft=c)},U=e=>{e.preventDefault(),e.stopPropagation(),f.off("mousemove",window,E,!0),f.off("mouseup",window,U,!0),p.value=!1,b=!1,v()};function le(e){e.preventDefault(),e.stopPropagation(),b=!0,p.value=!0,f.on("mousemove",window,E,!0),f.on("mouseup",window,U,!0),_=X.value,q=e.clientX}function O(){const{value:e}=M;e&&(T.value=e.scrollTop,X.value=e.scrollLeft)}const re=()=>{const{value:e}=j;if(e){const r=e.getBoundingClientRect();d.value=r.height,i.value=r.width}const{value:n}=M;if(n){const r=n.getBoundingClientRect();u.value=r.height,R.value=r.width}const{value:o}=B;o&&(N.value=o.offsetHeight);const{value:a}=z;a&&(P.value=a.offsetWidth)};function v(){re(),O()}return{showYBarRef:K,showXBarRef:ee,sync:v,handleMouseEnter:()=>{S.value=!0,p.value=!0},handleMouseLeave:()=>{g||(S.value=!1),b||(p.value=!1)},contentRef:h,yRailRef:B,xRailRef:z,containerRef:m,contentHeightRef:d,containerHeightRef:u,needYBarRef:A,needXBarRef:Z,yBarSizePxRef:k,handleYScrollMouseDown:J,handleXScrollMouseDown:le,yBarTopPxRef:G,handleScroll:Q,xBarSizePxRef:te,xBarLeftPxRef:oe}},render(){const{$slots:l,xScrollable:h}=this,m=()=>t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail ${s.defaultNamespace}-scrollbar-rail--horizontal`,ref:"xRailRef"},[this.needXBarRef&&this.showXBarRef&&t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail__scrollbar--horizontal`,style:{width:this.xBarSizePxRef,left:this.xBarLeftPxRef},onMousedown:this.handleXScrollMouseDown},null,46,["onMousedown"])],2),B=()=>t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail ${s.defaultNamespace}-scrollbar-rail--vertical`,ref:"yRailRef"},[this.needYBarRef&&this.showYBarRef&&t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail__scrollbar--vertical`,style:{height:this.yBarSizePxRef,top:this.yBarTopPxRef},onMousedown:this.handleYScrollMouseDown},null,46,["onMousedown"])],2);return(()=>{var i,u;return t.createVNode("div",t.mergeProps({class:`${s.defaultNamespace}-scrollbar`},this.$attrs,{onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave}),[this.container?(i=l.default)==null?void 0:i.call(l):t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-container`,onScroll:this.handleScroll,ref:"containerRef"},[t.createVNode("div",{ref:"contentRef",class:`${s.defaultNamespace}-scrollbar-content`},[(u=l.default)==null?void 0:u.call(l)],2)],42,["onScroll"]),B(),h&&m()],16,["onMouseenter","onMouseleave"])})()}});exports.default=ce;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),j=require("@vueuse/core"),f=require("evtd"),s=require("../../../hooks/use-namespace/index.js"),re=require("./types.js"),ce=t.defineComponent({name:"KScrollbar",props:re.scrollbarProps,inheritAttrs:!1,setup(o){t.onMounted(()=>{o.container||h()});const v=t.ref(null),m=t.ref(null),x=t.ref(null),P=t.ref(null),d=t.ref(null),i=t.ref(null),u=t.ref(null),R=t.ref(null),X=t.ref(null),z=t.ref(null),A=t.computed(()=>{var e;return((e=o.content)==null?void 0:e.call(o))||v.value}),S=t.computed(()=>{var e;return((e=o.container)==null?void 0:e.call(o))||m.value}),N=t.ref(0),T=t.ref(0);j.useResizeObserver(v,()=>{h()}),j.useResizeObserver(m,()=>{h()});const K=t.computed(()=>{const{value:e}=u,{value:n}=d;return e!==null&&n!==null&&n>e}),w=t.ref(!1),k=t.computed(()=>{const{trigger:e}=o;return e!=="none"&&(e==="always"||w.value)}),W=t.computed(()=>{const{value:e}=u,{value:n}=d,{value:l}=X;return e===null||n===null||l===null?0:Math.min(e,l*e/n+5*1.5)}),F=t.computed(()=>`${W.value}px`),G=t.computed(()=>{const{value:e}=u,{value:n}=N,{value:l}=d,{value:r}=X;if(e===null||l===null||r===null)return 0;{const a=l-e;return a?n/a*(r-W.value):0}}),J=t.computed(()=>`${G.value}px`);let g=!1,H=0,$=0,y,b;const C=e=>{if(!g)return;b!==void 0&&window.clearTimeout(b),y!==void 0&&window.clearTimeout(y);const{value:n}=u,{value:l}=d,{value:r}=W;if(n===null||l===null)return;const B=(e.clientY-$)*(l-n)/(n-r),D=l-n;let c=H+B;c=Math.min(D,c),c=Math.max(c,0);const{value:M}=S;M&&(M.scrollTop=c)},V=e=>{e.preventDefault(),e.stopPropagation(),f.off("mousemove",window,C,!0),f.off("mouseup",window,V,!0),g=!1,w.value=!1,h()},Q=e=>{e.preventDefault(),e.stopPropagation(),f.on("mousemove",window,C,!0),f.on("mouseup",window,V,!0),H=N.value,$=e.clientY,g=!0,w.value=!0};function Z(e){const{onScroll:n}=o;n&&n(e),I()}const _=t.computed(()=>{const{value:e}=R,{value:n}=i;return e!==null&&n!==null&&n>e}),p=t.ref(!1),ee=t.computed(()=>{const{trigger:e}=o;return e!=="none"&&(e==="always"||p.value)}),Y=t.computed(()=>{const{value:e}=R,{value:n}=i,{value:l}=z;return e===null||n===null||l===null?0:l*e/n+5*1.5}),te=t.computed(()=>`${Y.value}px`),ne=t.computed(()=>{const{value:e}=R,{value:n}=T,{value:l}=i,{value:r}=z;if(e===null||l===null||r===null)return 0;{const a=l-e;return a?n/a*(r-Y.value):0}}),le=t.computed(()=>`${ne.value}px`);let L=!1,q=0,E=0;const U=e=>{if(!L)return;b!==void 0&&window.clearTimeout(b),y!==void 0&&window.clearTimeout(y);const{value:n}=R,{value:l}=i,{value:r}=Y;if(n===null||l===null)return;const B=(e.clientX-E)*(l-n)/(n-r),D=l-n;let c=q+B;c=Math.min(D,c),c=Math.max(c,0);const{value:M}=S;M&&(M.scrollLeft=c)},O=e=>{e.preventDefault(),e.stopPropagation(),f.off("mousemove",window,U,!0),f.off("mouseup",window,O,!0),p.value=!1,L=!1,h()};function oe(e){e.preventDefault(),e.stopPropagation(),L=!0,p.value=!0,f.on("mousemove",window,U,!0),f.on("mouseup",window,O,!0),q=T.value,E=e.clientX}function I(){const{value:e}=S;e&&(N.value=e.scrollTop,T.value=e.scrollLeft)}const ae=()=>{const{value:e}=A;if(e){const a=e.getBoundingClientRect();d.value=a.height,i.value=a.width}const{value:n}=S;if(n){const a=n.getBoundingClientRect();u.value=a.height,R.value=a.width}const{value:l}=x;l&&(X.value=l.offsetHeight);const{value:r}=P;r&&(z.value=r.offsetWidth)};function h(){ae(),I()}return{showYBarRef:k,showXBarRef:ee,sync:h,handleMouseEnter:()=>{w.value=!0,p.value=!0},handleMouseLeave:()=>{g||(w.value=!1),L||(p.value=!1)},handleXScrollWheel:e=>{const{value:n}=S;if(n&&e.deltaY&&_.value&&o.xScrollable){const l=n.scrollLeft,r=n.scrollWidth-n.clientWidth,a=e.deltaY*.8,B=Math.max(0,Math.min(l+a,r));n.scrollLeft=B,h(),e.stopPropagation(),e.preventDefault()}},contentRef:v,yRailRef:x,xRailRef:P,containerRef:m,contentHeightRef:d,containerHeightRef:u,needYBarRef:K,needXBarRef:_,yBarSizePxRef:F,handleYScrollMouseDown:Q,handleXScrollMouseDown:oe,yBarTopPxRef:J,handleScroll:Z,xBarSizePxRef:te,xBarLeftPxRef:le}},render(){const{$slots:o,xScrollable:v}=this,m=()=>t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail ${s.defaultNamespace}-scrollbar-rail--horizontal`,ref:"xRailRef"},[this.needXBarRef&&this.showXBarRef&&t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail__scrollbar--horizontal`,style:{width:this.xBarSizePxRef,left:this.xBarLeftPxRef},onMousedown:this.handleXScrollMouseDown},null,46,["onMousedown"])],2),x=()=>t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail ${s.defaultNamespace}-scrollbar-rail--vertical`,ref:"yRailRef"},[this.needYBarRef&&this.showYBarRef&&t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-rail__scrollbar--vertical`,style:{height:this.yBarSizePxRef,top:this.yBarTopPxRef},onMousedown:this.handleYScrollMouseDown},null,46,["onMousedown"])],2);return(()=>{var i,u;return t.createVNode("div",t.mergeProps({class:`${s.defaultNamespace}-scrollbar`},this.$attrs,{onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave}),[this.container?(i=o.default)==null?void 0:i.call(o):t.createVNode("div",{class:`${s.defaultNamespace}-scrollbar-container`,onScroll:this.handleScroll,ref:"containerRef",onWheel:this.handleXScrollWheel},[t.createVNode("div",{ref:"contentRef",class:`${s.defaultNamespace}-scrollbar-content`},[(u=o.default)==null?void 0:u.call(o)],2)],42,["onScroll","onWheel"]),x(),v&&m()],16,["onMouseenter","onMouseleave"])})()}});exports.default=ce;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o={container:Function,content:Function,onScroll:Function,xScrollable:Boolean,trigger:String};exports.scrollbarProps=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o={container:Function,content:Function,onScroll:Function,xScrollable:Boolean,trigger:{type:String,default:"hover"}};exports.scrollbarProps=o;
package/dist/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./installer.js");require("./components/index.js");require("./hooks/index.js");const r=require("./components/form/component/form.js"),e=require("./components/form/index.js"),P=require("./components/collapse-transtion/src/types.js"),n=require("./components/collapse-transtion/index.js"),o=require("./components/pro-modal/hooks/useProModal.js"),u=require("./components/pro-modal/index.js"),a=require("./components/pro-title/src/types.js"),c=require("./components/pro-title/index.js"),l=require("./components/scroll-bar/src/types.js"),p=require("./components/scroll-bar/index.js"),d=require("./components/scale-virtual-list/index.js"),q=require("./components/pro-tag/src/types.js"),K=require("./components/pro-tag/index.js"),s=require("./components/pro-picker/src/types.js"),m=require("./components/pro-picker/index.js"),$=require("./components/pro-area/src/types.js"),T=require("./components/pro-area/hooks/use-pro-area.js"),x=require("./components/pro-area/index.js"),g=require("./components/pro-signature/src/types.js"),y=require("./components/pro-signature/index.js"),I=require("./components/icon/index.js"),i=require("./hooks/useProForm.js");exports.default=t.default;exports.definePropType=r.definePropType;exports.formItemProps=r.formItemProps;exports.KForm=e.KForm;exports.KFormItem=e.KFormItem;exports.collapseProps=P.collapseProps;exports.KCollapseTranstion=n.KCollapseTranstion;exports.useProModal=o.useProModal;exports.useProModalInit=o.useProModalInit;exports.KProModal=u.KProModal;exports.TitleProps=a.TitleProps;exports.KProTitle=c.KProTitle;exports.scrollbarProps=l.scrollbarProps;exports.KScrollBar=p.KScrollBar;exports.KScaleVirtualList=d.KScaleVirtualList;exports.proTagProps=q.proTagProps;exports.KProTag=K.KProTag;exports.PickerApiEnum=s.PickerApiEnum;exports.ProPickerProps=s.ProPickerProps;exports.KProPicker=m.KProPicker;exports.ProAreaProps=$.ProAreaProps;exports.useProArea=T.useProArea;exports.KProArea=x.KProArea;exports.ProSignatureProps=g.ProSignatureProps;exports.KProSignature=y.KProSignature;exports.KIcon=I.KIcon;exports.useProForm=i.useProForm;exports.useProFormInit=i.useProFormInit;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./installer.js");require("./components/index.js");require("./hooks/index.js");const r=require("./components/form/component/form.js"),e=require("./components/form/index.js"),P=require("./components/collapse-transtion/src/types.js"),u=require("./components/collapse-transtion/index.js"),o=require("./components/pro-modal/hooks/useProModal.js"),n=require("./components/pro-modal/index.js"),a=require("./components/pro-title/src/types.js"),l=require("./components/pro-title/index.js"),c=require("./components/scroll-bar/src/types.js"),p=require("./components/scroll-bar/index.js"),q=require("./components/scale-virtual-list/index.js"),d=require("./components/pro-tag/src/types.js"),K=require("./components/pro-tag/index.js"),s=require("./components/pro-picker/src/types.js"),m=require("./components/pro-picker/index.js"),T=require("./components/pro-area/src/types.js"),$=require("./components/pro-area/hooks/use-pro-area.js"),x=require("./components/pro-area/index.js"),b=require("./components/pro-signature/src/types.js"),g=require("./components/pro-signature/index.js"),y=require("./components/pro-table/hooks/use-pro-table.js"),I=require("./components/pro-table/index.js"),S=require("./components/icon/index.js"),i=require("./hooks/useProForm.js");exports.default=t.default;exports.definePropType=r.definePropType;exports.formItemProps=r.formItemProps;exports.KForm=e.KForm;exports.KFormItem=e.KFormItem;exports.collapseProps=P.collapseProps;exports.KCollapseTranstion=u.KCollapseTranstion;exports.useProModal=o.useProModal;exports.useProModalInit=o.useProModalInit;exports.KProModal=n.KProModal;exports.TitleProps=a.TitleProps;exports.KProTitle=l.KProTitle;exports.scrollbarProps=c.scrollbarProps;exports.KScrollBar=p.KScrollBar;exports.KScaleVirtualList=q.KScaleVirtualList;exports.proTagProps=d.proTagProps;exports.KProTag=K.KProTag;exports.PickerApiEnum=s.PickerApiEnum;exports.ProPickerProps=s.ProPickerProps;exports.KProPicker=m.KProPicker;exports.ProAreaProps=T.ProAreaProps;exports.useProArea=$.useProArea;exports.KProArea=x.KProArea;exports.ProSignatureProps=b.ProSignatureProps;exports.KProSignature=g.KProSignature;exports.useProTable=y.useProTable;exports.KProTable=I.KProTable;exports.KIcon=S.KIcon;exports.useProForm=i.useProForm;exports.useProFormInit=i.useProFormInit;
@@ -1 +1 @@
1
- @font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=87008) format("woff2"),url(fonts/iconfont.woff?t=79200) format("woff"),url(fonts/iconfont.ttf?t=40515) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-title-icon:before{content:"\e680"}
1
+ @font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=83189) format("woff2"),url(fonts/iconfont.woff?t=80679) format("woff"),url(fonts/iconfont.ttf?t=65487) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-title-icon:before{content:"\e680"}
@@ -1 +1 @@
1
- :root{--king-color-white:#ffffff;--king-color-primary:#409eff;--king-color-success:#67c23a;--king-color-warning:#e6a23c;--king-color-danger:#f56c6c;--king-color-error:#f56c6c;--king-color-info:#909399;--king-transition-duration:0.3s}.king-button--primary{--king-button-text-color:var(--king-color-primary)}.king-button--success{--king-button-text-color:var(--king-color-success)}.king-button--warning{--king-button-text-color:var(--king-color-warning)}.king-button--danger{--king-button-text-color:var(--king-color-danger)}.king-button--error{--king-button-text-color:var(--king-color-error)}.king-button--info{--king-button-text-color:var(--king-color-info)}.king-button{color:var(--king-button-text-color)}.king-scrollbar{overflow:hidden;position:relative;z-index:auto;height:100%;width:100%}.king-scrollbar .king-scrollbar-container{width:100%;overflow:scroll;height:100%;min-height:inherit;max-height:inherit;scrollbar-width:none}.king-scrollbar .king-scrollbar-content{width:-moz-fit-content;width:fit-content}.king-scrollbar .king-scrollbar-rail{position:absolute}.king-scrollbar .king-scrollbar-rail--vertical{right:0;width:5px;top:2px;bottom:2px;right:4px}.king-scrollbar .king-scrollbar-rail--horizontal{bottom:2px;height:5px;left:2px;right:2px}.king-scrollbar .king-scrollbar-rail__scrollbar--vertical{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;width:100%;cursor:pointer}.king-scrollbar .king-scrollbar-rail__scrollbar--horizontal{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;height:100%;cursor:pointer}.v-vl-items{width:-moz-fit-content;width:fit-content}.king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-virtual-list-container{margin:0 auto;position:relative}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto;position:absolute;left:50%}.king-pro-title{border-bottom:1px solid #ccc;font-weight:500;display:flex;align-items:center}.king-pro-title .icon{margin-right:10px}.king-pro-title--unborder{border:none}.king-pro-modal .ant-modal-content{padding:0}.king-pro-modal .ant-modal-header{height:56px;padding-left:32px;padding-right:24px;display:flex;justify-content:space-between;align-items:center;background:#f1f7ff;border-bottom:1px solid #e6e8ea}.king-pro-modal .ant-modal-body{padding:10px 20px;max-height:65vh;overflow:auto}.king-pro-modal .ant-modal-footer{height:56px;display:flex;padding:0 16px;justify-content:flex-end;align-items:center;border-top:1px solid #e6e8ea}.king-pro-modal .ant-modal-title{flex:1}.king-pro-modal .pro-modal-title{cursor:move;width:100%}.king-pro-area-select{width:100%}@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=13932) format("woff2"),url(fonts/iconfont.woff?t=72330) format("woff"),url(fonts/iconfont.ttf?t=86389) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-title-icon:before{content:"\e680"}
1
+ :root{--king-color-white:#ffffff;--king-color-primary:#409eff;--king-color-success:#67c23a;--king-color-warning:#e6a23c;--king-color-danger:#f56c6c;--king-color-error:#f56c6c;--king-color-info:#909399;--king-transition-duration:0.3s}.king-button--primary{--king-button-text-color:var(--king-color-primary)}.king-button--success{--king-button-text-color:var(--king-color-success)}.king-button--warning{--king-button-text-color:var(--king-color-warning)}.king-button--danger{--king-button-text-color:var(--king-color-danger)}.king-button--error{--king-button-text-color:var(--king-color-error)}.king-button--info{--king-button-text-color:var(--king-color-info)}.king-button{color:var(--king-button-text-color)}.king-scrollbar{overflow:hidden;position:relative;z-index:auto;height:100%;width:100%}.king-scrollbar .king-scrollbar-container{width:100%;overflow:scroll;height:100%;min-height:inherit;max-height:inherit;scrollbar-width:none}.king-scrollbar .king-scrollbar-content{width:-moz-fit-content;width:fit-content}.king-scrollbar .king-scrollbar-rail{position:absolute}.king-scrollbar .king-scrollbar-rail--vertical{right:0;width:5px;top:2px;bottom:2px;right:4px}.king-scrollbar .king-scrollbar-rail--horizontal{bottom:2px;height:5px;left:2px;right:2px}.king-scrollbar .king-scrollbar-rail__scrollbar--vertical{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;width:100%;cursor:pointer}.king-scrollbar .king-scrollbar-rail__scrollbar--horizontal{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;height:100%;cursor:pointer}.v-vl-items{width:-moz-fit-content;width:fit-content}.king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-virtual-list-container{margin:0 auto;position:relative}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto;position:absolute;left:50%}.king-pro-title{border-bottom:1px solid #ccc;font-weight:500;display:flex;align-items:center}.king-pro-title .icon{margin-right:10px}.king-pro-title--unborder{border:none}.king-pro-modal .ant-modal-content{padding:0}.king-pro-modal .ant-modal-header{height:56px;padding-left:32px;padding-right:24px;display:flex;justify-content:space-between;align-items:center;background:#f1f7ff;border-bottom:1px solid #e6e8ea}.king-pro-modal .ant-modal-body{padding:10px 20px;max-height:65vh;overflow:auto}.king-pro-modal .ant-modal-footer{height:56px;display:flex;padding:0 16px;justify-content:flex-end;align-items:center;border-top:1px solid #e6e8ea}.king-pro-modal .ant-modal-title{flex:1}.king-pro-modal .pro-modal-title{cursor:move;width:100%}.king-pro-area-select{width:100%}@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=38382) format("woff2"),url(fonts/iconfont.woff?t=96183) format("woff"),url(fonts/iconfont.ttf?t=72193) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-title-icon:before{content:"\e680"}
@@ -0,0 +1 @@
1
+ .king-pro-title{border-bottom:1px solid #ccc;font-weight:500;display:flex;align-items:center}.king-pro-title .icon{margin-right:10px}
@@ -8,4 +8,5 @@ export * from './pro-tag';
8
8
  export * from './pro-picker';
9
9
  export * from './pro-area';
10
10
  export * from './pro-signature';
11
+ export * from './pro-table';
11
12
  export * from './icon';
@@ -0,0 +1,6 @@
1
+ import { TableExpose } from '../src/types';
2
+ import { Ref } from 'vue';
3
+ export declare function useProTable(): {
4
+ proTableRef: Ref<TableExpose | undefined, TableExpose | undefined>;
5
+ onRefresh: () => void;
6
+ };
@@ -0,0 +1,7 @@
1
+ import { Plugin } from 'vue';
2
+ import { default as ProTable } from './src/pro-table.vue';
3
+ export * from './src/types';
4
+ export * from './hooks/use-pro-table';
5
+ export * from './src/pro-table.vue';
6
+ export declare const KProTable: typeof ProTable & Plugin;
7
+ export default KProTable;
@@ -0,0 +1,5 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { TableContextProvideType, TableSlotsType, FieldContextProvideType } from '..';
3
+ export declare const TABLE_CONTEXT_PROVIDE_KEY: InjectionKey<TableContextProvideType>;
4
+ export declare const FIELD_CONTEXT_PROVIDE_KEY: InjectionKey<FieldContextProvideType>;
5
+ export declare const ANTD_SLOT_NAMES: (keyof TableSlotsType)[];
@@ -0,0 +1,10 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ type __VLS_PublicProps = {
3
+ 'modelValue': any;
4
+ };
5
+ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (value: any) => any;
7
+ }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ type __VLS_PublicProps = {
3
+ 'modelValue': any;
4
+ };
5
+ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (value: any) => any;
7
+ }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ type __VLS_PublicProps = {
3
+ 'modelValue': any;
4
+ };
5
+ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (value: any) => any;
7
+ }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ type __VLS_PublicProps = {
3
+ 'modelValue': any;
4
+ };
5
+ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (value: any) => any;
7
+ }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
10
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { ColumnInside } from '../..';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ type __VLS_Props = {
4
+ column: ColumnInside;
5
+ };
6
+ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { FormInstance } from 'ant-design-vue';
2
+ import { DefineComponent, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ declare const _default: DefineComponent<{}, {
4
+ formRef: Ref<FormInstance | undefined, FormInstance | undefined>;
5
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
6
+ formRef: unknown;
7
+ }, HTMLDivElement>;
8
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { TablePropsType } from '../..';
2
+ import { Ref } from 'vue';
3
+ export declare function useForm(props: TablePropsType): {
4
+ formState: Ref<Record<string, any>, Record<string, any>>;
5
+ genFormState: () => void;
6
+ };
@@ -0,0 +1,17 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ import { TablePropsType, PageData, BodyCellSlotProps, TableSlotsType, ColumnInside, OriginBodyCellProps } from '../..';
3
+ import { Column } from '../types';
4
+ type Params = {
5
+ loading: Ref<boolean>;
6
+ pageData: PageData;
7
+ formState: Ref<any>;
8
+ dataSource: Ref<any[]>;
9
+ };
10
+ export declare function useTable(props: TablePropsType, slots: TableSlotsType, { loading, pageData, formState, dataSource }: Params): {
11
+ filteredColumns: ComputedRef< Column<any>[]>;
12
+ handleRequest: () => Promise<void>;
13
+ getLabelByValue: (value: string, column: ColumnInside) => string | undefined;
14
+ hasCurrentColBodySlot: (originScope: OriginBodyCellProps) => boolean;
15
+ bodyCellProps: (originScope: OriginBodyCellProps) => BodyCellSlotProps;
16
+ };
17
+ export {};
@@ -0,0 +1,62 @@
1
+ import { TablePropsType, TableExpose } from '..';
2
+ import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, Slot, VNode } from 'vue';
3
+ import { RenderExpandIconProps } from 'ant-design-vue/es/vc-table/interface';
4
+ import { ColumnType } from 'ant-design-vue';
5
+ import { OmittedAntdTableSlots, ExtraTableSlotsType } from './types';
6
+ declare const _default: <RecordType>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & TablePropsType<RecordType> & Partial<{}>> & PublicProps;
8
+ expose(exposed: ShallowUnwrapRef<TableExpose>): void;
9
+ attrs: any;
10
+ slots: Readonly<Omit<Readonly<{
11
+ emptyText?: any;
12
+ expandIcon?: Slot< RenderExpandIconProps<any> | undefined> | undefined;
13
+ title?: any;
14
+ footer?: any;
15
+ summary?: any;
16
+ expandedRowRender?: any;
17
+ expandColumnTitle?: any;
18
+ bodyCell?: ((props: {
19
+ text: any;
20
+ value: any;
21
+ record: Record<string, any>;
22
+ index: number;
23
+ column: ColumnType<any>;
24
+ }) => void) | undefined;
25
+ headerCell?: ((props: {
26
+ title: any;
27
+ column: ColumnType<any>;
28
+ }) => void) | undefined;
29
+ customFilterIcon?: any;
30
+ customFilterDropdown?: any;
31
+ default: any;
32
+ }>, OmittedAntdTableSlots> & ExtraTableSlotsType<RecordType>> & Omit<Readonly<{
33
+ emptyText?: any;
34
+ expandIcon?: Slot< RenderExpandIconProps<any> | undefined> | undefined;
35
+ title?: any;
36
+ footer?: any;
37
+ summary?: any;
38
+ expandedRowRender?: any;
39
+ expandColumnTitle?: any;
40
+ bodyCell?: ((props: {
41
+ text: any;
42
+ value: any;
43
+ record: Record<string, any>;
44
+ index: number;
45
+ column: ColumnType<any>;
46
+ }) => void) | undefined;
47
+ headerCell?: ((props: {
48
+ title: any;
49
+ column: ColumnType<any>;
50
+ }) => void) | undefined;
51
+ customFilterIcon?: any;
52
+ customFilterDropdown?: any;
53
+ default: any;
54
+ }>, OmittedAntdTableSlots> & ExtraTableSlotsType<RecordType>;
55
+ emit: {};
56
+ }>) => VNode & {
57
+ __ctx?: Awaited<typeof __VLS_setup>;
58
+ };
59
+ export default _default;
60
+ type __VLS_PrettifyLocal<T> = {
61
+ [K in keyof T]: T[K];
62
+ } & {};
@@ -0,0 +1,158 @@
1
+ import { Table, TableProps, TableColumnType, FormProps, FormItemProps, InputProps, RadioProps, SelectProps, DatePickerProps, FormInstance, ColProps } from 'ant-design-vue';
2
+ import { RangePickerProps } from 'ant-design-vue/es/date-picker';
3
+ import { RenderedCell } from 'ant-design-vue/es/vc-table/interface';
4
+ import { Slot, Ref } from 'vue';
5
+ export type BasicValue = string | number | boolean | undefined;
6
+ export type PickParameter<T extends Record<any, any>, K extends keyof T> = Parameters<Required<T>[K]>;
7
+ export type RewriteParameters<T extends Record<any, any>, K extends keyof T, Item> = Omit<PickParameter<T, K>[number], keyof Item> & Item;
8
+ /**
9
+ * 几种情况
10
+ * 1. 默认为 text
11
+ * 2. 为 option 不展示表单
12
+ * 3. column 里没有 valueType, 但是有 valueEnum 则默认为 select
13
+ */
14
+ export type ValueType = 'text' | 'select' | 'radio' | 'option' | 'dateRange';
15
+ export type ValueEnumStatue = 'Success' | 'Error' | 'Processing' | 'Warning' | 'Default';
16
+ export type ValueEnumValue = {
17
+ text: string;
18
+ status?: ValueEnumStatue;
19
+ disabled?: boolean;
20
+ };
21
+ export type ValueEnum = {
22
+ [key: string]: ValueEnumValue;
23
+ };
24
+ export type FormFieldSlotProps<RecordType = any> = {
25
+ column: ColumnInside<RecordType>;
26
+ value: any;
27
+ formState: Record<string, any>;
28
+ };
29
+ export type FieldOption = Omit<Partial<ValueEnumValue> & {
30
+ value: string;
31
+ label: string;
32
+ }, 'status'>;
33
+ export type OmitProperties<T, P extends string = 'model'> = Omit<T, P>;
34
+ export type FieldProps = OmitProperties<InputProps> | OmitProperties<SelectProps> | OmitProperties<RadioProps, 'checked'> | OmitProperties<DatePickerProps> | OmitProperties<RangePickerProps>;
35
+ export type ExtraColumnType<RecordType = any> = {
36
+ /** 值类型 也代表着字段控件的类型 */
37
+ valueType?: ValueType;
38
+ /** select 等可枚举或下拉的控件的枚举值 */
39
+ valueEnum?: ValueEnum;
40
+ /** 在表格中隐藏该列 */
41
+ hideInTable?: boolean;
42
+ /** 在表单中隐藏该列 */
43
+ hideInForm?: boolean;
44
+ /** 用来请求控件类似下拉等 options 数据 */
45
+ request?: ColumnRequest;
46
+ /** 字段控件的 props */
47
+ fieldProps?: FieldProps;
48
+ /** 初始化的值 */
49
+ initialValue?: any;
50
+ /** antdv 的 formItem 的 props */
51
+ formItemProps?: FormItemProps;
52
+ /** 字段布局 同 <Col> 组件 默认 span 为根据 table props 中的 formColNum 计算而来 */
53
+ fieldCol?: ColProps;
54
+ /** form 中的每一个字段的自定义渲染函数 */
55
+ customFormFieldRender?: (props: FormFieldSlotProps<RecordType>) => any;
56
+ /** 表格中的 body 下的每个 cell 的自定义渲染函数, 同 antdv */
57
+ customRender?: (opt: CustomRenderProps<RecordType>) => any | RenderedCell<RecordType>;
58
+ };
59
+ export type CustomRenderProps<RecordType = any> = BodyCellSlotProps<RecordType>;
60
+ export type OmittedAntdTableColumnProps = 'customRender';
61
+ export type TableColumnProps<RecordType = any> = Omit<TableColumnType<RecordType>, OmittedAntdTableColumnProps>;
62
+ export type Column<RecordType = any> = TableColumnProps<RecordType> & ExtraColumnType<RecordType>;
63
+ export type ColumnInside<RecordType = any> = Column<RecordType> & {
64
+ _fieldOptions?: Readonly<FieldOption[]>;
65
+ };
66
+ export type OmittedAntdTableProps = 'columns' | 'dataSource' | 'pagination' | 'loading';
67
+ export type AntdTableProps = Omit<TableProps, OmittedAntdTableProps>;
68
+ export type TablePropsType<RecordType = any> = {
69
+ /** antdv 的 table 属性 */
70
+ antdTableProps?: AntdTableProps;
71
+ /** 表单每行展示几列 */
72
+ formColNum?: 1 | 2 | 3 | 4 | 6 | 8 | 12 | 24;
73
+ /** Table column 配置 */
74
+ columns: Column<RecordType>[];
75
+ /** 是否隐藏头部标题 */
76
+ headerTitle?: string;
77
+ /** 数据请求方法 */
78
+ request?: TableRequest;
79
+ /** antdv 的 form 属性 */
80
+ antdFormProps?: Omit<FormProps, 'model'>;
81
+ /** 工具条自定义渲染函数 */
82
+ toolbarRender?: () => void;
83
+ /** 是否立即执行一次 request 中的方法 */
84
+ requestImmediately?: boolean;
85
+ /** 页码中是否展示总数 */
86
+ pageShowTotal?: boolean;
87
+ /** 页码中的每页展示数量 */
88
+ pageSize?: number;
89
+ /** 是否隐藏表单 */
90
+ hideForm?: boolean;
91
+ /** 是否隐藏页码 */
92
+ hidePage?: boolean;
93
+ /** 按钮布局 同 <Col> 组件 默认 span 为根据 table props 中的 formColNum 计算而来 */
94
+ buttonCol?: ColProps;
95
+ };
96
+ export type TableContextProvideType = TablePropsType & {
97
+ column: ColumnInside;
98
+ } & {
99
+ tableSlots: TableSlotsType;
100
+ formState: Record<string, any>;
101
+ loading: Ref<boolean>;
102
+ pageData: PageData;
103
+ handleRequest: () => void;
104
+ };
105
+ export type FieldContextProvideType = {
106
+ fieldOptions: Ref<FieldOption[]>;
107
+ column: Column;
108
+ };
109
+ export type TableRequestParams = {
110
+ readonly pageSize: number;
111
+ readonly pageNum: number;
112
+ readonly [key: string]: any;
113
+ };
114
+ export type TableRequestReturn = {
115
+ data: any;
116
+ success: boolean;
117
+ total?: number;
118
+ };
119
+ export type RequestFn<Params = any, Return = any> = (params: Params) => Return | Promise<Return>;
120
+ export type TableRequest = RequestFn<TableRequestParams, TableRequestReturn>;
121
+ export type ColumnRequest = RequestFn<any, FieldOption[]>;
122
+ export type OriginBodyCellProps = PickParameter<AntdSlots, 'bodyCell'>[number] & {
123
+ column: ColumnInside;
124
+ };
125
+ export type OmittedAntdTableSlots = 'bodyCell' | 'headerCell';
126
+ export type BodyCellSlotProps<RecordType = any> = RewriteParameters<AntdSlots, 'bodyCell', {
127
+ record: RecordType;
128
+ column: ColumnInside<RecordType>;
129
+ labelText?: string;
130
+ }>;
131
+ export type HeaderCellSlotProps<RecordType = any> = RewriteParameters<AntdSlots, 'headerCell', {
132
+ column: ColumnInside<RecordType>;
133
+ }>;
134
+ export type ExtraTableSlotsType<RecordType = any> = {
135
+ /** form 中的每一个字段的插槽 */
136
+ formField?: Slot<FormFieldSlotProps<RecordType>>;
137
+ /** 表格中的 body 下的每个 cell 插槽, 同 antdv */
138
+ bodyCell?: Slot<BodyCellSlotProps<RecordType>>;
139
+ /** 表格中的 header 下的每个 cell 插槽, 同 antdv */
140
+ headerCell?: Slot<HeaderCellSlotProps<RecordType>>;
141
+ /** 工具条插槽 */
142
+ toolbar?: Slot;
143
+ };
144
+ export type AntdSlots = InstanceType<typeof Table>['$slots'];
145
+ export type TableSlotsType<RecordType = any> = Omit<AntdSlots, OmittedAntdTableSlots> & ExtraTableSlotsType<RecordType>;
146
+ export type PageData = {
147
+ pageNum: number;
148
+ pageSize: number;
149
+ total: number;
150
+ };
151
+ export type TableExpose = {
152
+ /** 刷新数据 */
153
+ onRefresh: () => void;
154
+ /** 表单的 context ref */
155
+ formRef: () => FormInstance | undefined;
156
+ /** 页码信息 */
157
+ pageData: PageData;
158
+ };
@@ -0,0 +1,9 @@
1
+ import { VNode, RendererNode, RendererElement } from 'vue';
2
+ export declare function spitRender(data: {
3
+ fn: (...args: any) => any;
4
+ scope: any;
5
+ }): any;
6
+ export declare function handleFn<T extends (...args: any) => any>(fn: T | undefined | null, ...args: Parameters<T>): ReturnType<T>;
7
+ export declare function getAvailableVNode(vNodes: VNode[]): VNode< RendererNode, RendererElement, {
8
+ [key: string]: any;
9
+ }>[];
@@ -6,13 +6,17 @@ export declare const KScrollBar: SFCWithInstall<DefineComponent<ExtractPropTypes
6
6
  readonly content: PropType<() => HTMLElement | null | undefined>;
7
7
  readonly onScroll: PropType<(e: Event) => void>;
8
8
  readonly xScrollable: BooleanConstructor;
9
- readonly trigger: PropType<"none" | "hover">;
9
+ readonly trigger: {
10
+ readonly type: PropType<"none" | "hover" | "always">;
11
+ readonly default: "hover";
12
+ };
10
13
  }>, {
11
14
  showYBarRef: ComputedRef<boolean>;
12
15
  showXBarRef: ComputedRef<boolean>;
13
16
  sync: () => void;
14
17
  handleMouseEnter: () => void;
15
18
  handleMouseLeave: () => void;
19
+ handleXScrollWheel: (e: WheelEvent) => void;
16
20
  contentRef: Ref<HTMLElement | null, HTMLElement | null>;
17
21
  yRailRef: Ref<HTMLElement | null, HTMLElement | null>;
18
22
  xRailRef: Ref<HTMLElement | null, HTMLElement | null>;
@@ -33,8 +37,12 @@ export declare const KScrollBar: SFCWithInstall<DefineComponent<ExtractPropTypes
33
37
  readonly content: PropType<() => HTMLElement | null | undefined>;
34
38
  readonly onScroll: PropType<(e: Event) => void>;
35
39
  readonly xScrollable: BooleanConstructor;
36
- readonly trigger: PropType<"none" | "hover">;
40
+ readonly trigger: {
41
+ readonly type: PropType<"none" | "hover" | "always">;
42
+ readonly default: "hover";
43
+ };
37
44
  }>> & Readonly<{}>, {
45
+ readonly trigger: "none" | "hover" | "always";
38
46
  readonly xScrollable: boolean;
39
47
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>>;
40
48
  export default KScrollBar;
@@ -4,13 +4,17 @@ declare const _default: DefineComponent<ExtractPropTypes<{
4
4
  readonly content: PropType<() => HTMLElement | null | undefined>;
5
5
  readonly onScroll: PropType<(e: Event) => void>;
6
6
  readonly xScrollable: BooleanConstructor;
7
- readonly trigger: PropType<"none" | "hover">;
7
+ readonly trigger: {
8
+ readonly type: PropType<"none" | "hover" | "always">;
9
+ readonly default: "hover";
10
+ };
8
11
  }>, {
9
12
  showYBarRef: ComputedRef<boolean>;
10
13
  showXBarRef: ComputedRef<boolean>;
11
14
  sync: () => void;
12
15
  handleMouseEnter: () => void;
13
16
  handleMouseLeave: () => void;
17
+ handleXScrollWheel: (e: WheelEvent) => void;
14
18
  contentRef: Ref<HTMLElement | null, HTMLElement | null>;
15
19
  yRailRef: Ref<HTMLElement | null, HTMLElement | null>;
16
20
  xRailRef: Ref<HTMLElement | null, HTMLElement | null>;
@@ -31,8 +35,12 @@ declare const _default: DefineComponent<ExtractPropTypes<{
31
35
  readonly content: PropType<() => HTMLElement | null | undefined>;
32
36
  readonly onScroll: PropType<(e: Event) => void>;
33
37
  readonly xScrollable: BooleanConstructor;
34
- readonly trigger: PropType<"none" | "hover">;
38
+ readonly trigger: {
39
+ readonly type: PropType<"none" | "hover" | "always">;
40
+ readonly default: "hover";
41
+ };
35
42
  }>> & Readonly<{}>, {
43
+ readonly trigger: "none" | "hover" | "always";
36
44
  readonly xScrollable: boolean;
37
45
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
38
46
  export default _default;
@@ -4,5 +4,8 @@ export declare const scrollbarProps: {
4
4
  readonly content: PropType<() => HTMLElement | null | undefined>;
5
5
  readonly onScroll: PropType<(e: Event) => void>;
6
6
  readonly xScrollable: BooleanConstructor;
7
- readonly trigger: PropType<"none" | "hover">;
7
+ readonly trigger: {
8
+ readonly type: PropType<"none" | "hover" | "always">;
9
+ readonly default: "hover";
10
+ };
8
11
  };
package/global.d.ts CHANGED
@@ -9,6 +9,7 @@ declare module 'vue' {
9
9
  KProModal: typeof import('@king-one/antdv')['KProModal'];
10
10
  KProPicker: typeof import('@king-one/antdv')['KProPicker'];
11
11
  KProSignature: typeof import('@king-one/antdv')['KProSignature'];
12
+ KProTable: typeof import('@king-one/antdv')['KProTable'];
12
13
  KProTag: typeof import('@king-one/antdv')['KProTag'];
13
14
  KProTitle: typeof import('@king-one/antdv')['KProTitle'];
14
15
  KScaleVirtualList: typeof import('@king-one/antdv')['KScaleVirtualList'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@king-one/antdv",
3
3
  "type": "module",
4
- "version": "1.0.76",
4
+ "version": "1.0.78",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",