@vef-framework/components 1.0.129 → 1.0.131
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/cjs/helpers/icons.cjs +2 -0
- package/cjs/helpers/index.cjs +2 -0
- package/cjs/helpers/message.cjs +2 -0
- package/cjs/index.cjs +1 -1
- package/cjs/vef-access-denied/index.cjs +1 -27
- package/cjs/vef-button/index.cjs +1 -1
- package/cjs/vef-chart-container/index.cjs +3 -54
- package/cjs/vef-chart-legend-content/index.cjs +1 -16
- package/cjs/vef-chart-tooltip-content/index.cjs +1 -42
- package/cjs/vef-checkbox/index.cjs +1 -3
- package/cjs/vef-code-editor/index.cjs +1 -1
- package/cjs/vef-config-provider/global-style.cjs +2 -1
- package/cjs/vef-config-provider/index.cjs +1 -5
- package/cjs/vef-crud-page/components/crud-footer.cjs +1 -7
- package/cjs/vef-crud-page/hooks/use-operation-buttons.cjs +1 -1
- package/cjs/vef-crud-page/store.cjs +1 -1
- package/cjs/vef-drawer/index.cjs +1 -8
- package/cjs/vef-error/index.cjs +1 -28
- package/cjs/vef-filter/components/action-buttons.cjs +1 -19
- package/cjs/vef-filter/components/advanced-filter.cjs +1 -9
- package/cjs/vef-filter/components/basic-filter.cjs +1 -19
- package/cjs/vef-filter/hooks/use-action-handlers.cjs +1 -1
- package/cjs/vef-filter/hooks/use-label-config.cjs +1 -1
- package/cjs/vef-filter/index.cjs +1 -8
- package/cjs/vef-form/components/form-actions.cjs +1 -3
- package/cjs/vef-form/components/form-content.cjs +1 -4
- package/cjs/vef-form/components/form-group.cjs +1 -11
- package/cjs/vef-form/hooks/use-action-handlers.cjs +1 -1
- package/cjs/vef-form/hooks/use-label-width.cjs +1 -1
- package/cjs/vef-form/index.cjs +1 -3
- package/cjs/vef-grid/index.cjs +1 -1
- package/cjs/vef-icon/index.cjs +1 -1
- package/cjs/vef-icon-select/index.cjs +2 -28
- package/cjs/vef-intellisense-code-editor/styles.cjs +1 -20
- package/cjs/vef-layout/common-styles.cjs +1 -4
- package/cjs/vef-layout/components/header-action-icons.cjs +1 -15
- package/cjs/vef-layout/components/header.cjs +1 -12
- package/cjs/vef-layout/components/menu-groups.cjs +1 -32
- package/cjs/vef-layout/components/sider.cjs +1 -49
- package/cjs/vef-layout/components/title.cjs +1 -36
- package/cjs/vef-layout/components/user-avatar.cjs +1 -16
- package/cjs/vef-layout/index.cjs +1 -5
- package/cjs/vef-loading-placeholder/index.cjs +1 -7
- package/cjs/vef-login/index.cjs +1 -54
- package/cjs/vef-menu/index.cjs +1 -6
- package/cjs/vef-modal/index.cjs +1 -4
- package/cjs/vef-not-found/index.cjs +1 -28
- package/cjs/vef-page/index.cjs +1 -58
- package/cjs/vef-pie-chart/index.cjs +1 -8
- package/cjs/vef-popconfirm/index.cjs +1 -1
- package/cjs/vef-radio/index.cjs +1 -3
- package/cjs/vef-responsive-container/index.cjs +1 -5
- package/cjs/vef-responsive-item/index.cjs +1 -3
- package/cjs/vef-scroll-area/index.cjs +1 -11
- package/cjs/vef-select/components/option.cjs +1 -9
- package/cjs/vef-select/hooks/use-render-label.cjs +1 -1
- package/cjs/vef-sortable-list/components/overlay-item.cjs +1 -5
- package/cjs/vef-sortable-list/components/sortable-item.cjs +1 -5
- package/cjs/vef-table/components/columns-settings.cjs +1 -52
- package/cjs/vef-table/components/operation-buttons.cjs +1 -10
- package/cjs/vef-table/components/table-footer.cjs +1 -17
- package/cjs/vef-table/index.cjs +1 -54
- package/cjs/vef-title/index.cjs +1 -13
- package/cjs/vef-virtual-grid/index.cjs +1 -12
- package/cjs/vef-virtual-list/index.cjs +1 -18
- package/esm/helpers/icons.js +2 -0
- package/esm/helpers/index.js +2 -0
- package/esm/helpers/message.js +2 -0
- package/esm/index.js +1 -1
- package/esm/vef-access-denied/index.js +1 -27
- package/esm/vef-approval-flow-editor/components/node-content.js +1 -1
- package/esm/vef-approval-flow-editor/components/node-selector.js +2 -2
- package/esm/vef-approval-flow-editor/components/node-toolbar.js +1 -1
- package/esm/vef-button/index.js +1 -1
- package/esm/vef-chart-container/index.js +2 -53
- package/esm/vef-chart-legend-content/index.js +1 -16
- package/esm/vef-chart-tooltip-content/index.js +1 -42
- package/esm/vef-checkbox/index.js +1 -3
- package/esm/vef-code-editor/index.js +1 -1
- package/esm/vef-config-provider/global-style.js +2 -1
- package/esm/vef-config-provider/index.js +1 -5
- package/esm/vef-crud-page/components/crud-footer.js +1 -7
- package/esm/vef-crud-page/hooks/use-action-buttons.js +1 -1
- package/esm/vef-crud-page/hooks/use-operation-buttons.js +1 -1
- package/esm/vef-crud-page/store.js +1 -1
- package/esm/vef-drawer/index.js +1 -8
- package/esm/vef-dynamic-icon/index.js +1 -1
- package/esm/vef-error/index.js +1 -28
- package/esm/vef-filter/components/action-buttons.js +1 -19
- package/esm/vef-filter/components/advanced-filter.js +1 -9
- package/esm/vef-filter/components/basic-filter.js +1 -19
- package/esm/vef-filter/hooks/use-action-handlers.js +1 -1
- package/esm/vef-filter/hooks/use-label-config.js +1 -1
- package/esm/vef-filter/index.js +1 -8
- package/esm/vef-form/components/form-actions.js +1 -3
- package/esm/vef-form/components/form-content.js +1 -4
- package/esm/vef-form/components/form-group.js +1 -11
- package/esm/vef-form/hooks/use-action-handlers.js +1 -1
- package/esm/vef-form/hooks/use-label-width.js +1 -1
- package/esm/vef-form/index.js +1 -3
- package/esm/vef-generic-select/index.js +1 -1
- package/esm/vef-grid/index.js +1 -1
- package/esm/vef-icon/index.js +1 -1
- package/esm/vef-icon-select/index.js +2 -28
- package/esm/vef-intellisense-code-editor/styles.js +1 -20
- package/esm/vef-layout/common-styles.js +1 -4
- package/esm/vef-layout/components/font-size.js +1 -1
- package/esm/vef-layout/components/fullscreen.js +1 -1
- package/esm/vef-layout/components/header-action-icons.js +1 -15
- package/esm/vef-layout/components/header.js +1 -12
- package/esm/vef-layout/components/menu-groups.js +1 -32
- package/esm/vef-layout/components/sider.js +1 -49
- package/esm/vef-layout/components/title.js +1 -36
- package/esm/vef-layout/components/user-avatar.js +1 -16
- package/esm/vef-layout/index.js +1 -5
- package/esm/vef-loading-placeholder/index.js +1 -7
- package/esm/vef-login/index.js +1 -54
- package/esm/vef-menu/index.js +1 -6
- package/esm/vef-modal/index.js +1 -4
- package/esm/vef-not-found/index.js +1 -28
- package/esm/vef-page/index.js +1 -58
- package/esm/vef-pie-chart/index.js +1 -8
- package/esm/vef-popconfirm/index.js +1 -1
- package/esm/vef-radio/index.js +1 -3
- package/esm/vef-responsive-container/index.js +1 -5
- package/esm/vef-responsive-item/index.js +1 -3
- package/esm/vef-scroll-area/index.js +1 -11
- package/esm/vef-select/components/option.js +1 -9
- package/esm/vef-sortable-list/components/overlay-item.js +1 -5
- package/esm/vef-sortable-list/components/sortable-item.js +1 -5
- package/esm/vef-table/components/columns-settings.js +1 -52
- package/esm/vef-table/components/operation-buttons.js +1 -10
- package/esm/vef-table/components/settings-icon.js +1 -1
- package/esm/vef-table/components/table-footer.js +1 -17
- package/esm/vef-table/hooks/use-helper-columns.js +1 -1
- package/esm/vef-table/index.js +1 -54
- package/esm/vef-title/index.js +1 -13
- package/esm/vef-virtual-grid/index.js +1 -12
- package/esm/vef-virtual-list/index.js +1 -18
- package/package.json +4 -4
- package/types/helpers/icons.d.ts +7 -0
- package/types/helpers/index.d.ts +2 -0
- package/types/helpers/message.d.ts +372 -0
- package/types/index.d.ts +1 -0
- package/types/vef-dynamic-icon/props.d.ts +1 -1
- package/types/vef-icon/props.d.ts +2 -3
package/esm/vef-radio/index.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as e}from"@emotion/react/jsx-runtime";import{
|
|
3
|
-
height: ${O.controlHeight}
|
|
4
|
-
`,children:e(j,{})});function H({defaultValue:c,value:r,disabled:p,block:f,variant:h,buttonVariant:b,buttonSize:v,onChange:o,...g},z){const{optionsMap:a,normalizedOptions:s,isLoading:S}=A({value:r,onChange:o,...g}),V=B(z,s),C=x(()=>{if(k(o))return({target:{value:i}})=>{o(i,a.get(i))}},[o,a]);if(S)return G;const R=s.map(i=>{const{value:t,label:l,disabled:d,description:m}=i;return m?e(w,{content:m,children:e(n,{disabled:d,value:t,children:l})},t):e(n,{disabled:d,value:t,children:l},t)});return e(F,{ref:V,block:f,buttonStyle:b,defaultValue:c,disabled:p,optionType:h,size:D(v),onChange:C,...r===void 0?{}:{value:r},children:R})}const u=M(T(H));u.displayName="VefRadio";export{u as default};
|
|
2
|
+
import{jsx as e}from"@emotion/react/jsx-runtime";import{themeVariables as y,isFunction as O}from"@vef-framework/shared";import{Radio as n}from"antd";import{useMemo as k,memo as x,forwardRef as M}from"react";import"../internal/index.js";import N from"../vef-loading-placeholder/index.js";import T from"../vef-tooltip/index.js";import{useDataOptions as j}from"./hooks/use-data-options.js";import{useRadioInstance as w}from"./hooks/use-radio-instance.js";import{convertBasicSizeToUiSize as B}from"../internal/utils.js";const{Group:D}=n,F=e("div",{css:{height:y.controlHeight},children:e(N,{})});function G({defaultValue:c,value:r,disabled:p,block:f,variant:h,buttonVariant:b,buttonSize:v,onChange:o,...g},z){const{optionsMap:a,normalizedOptions:l,isLoading:S}=j({value:r,onChange:o,...g}),V=w(z,l),C=k(()=>{if(O(o))return({target:{value:i}})=>{o(i,a.get(i))}},[o,a]);if(S)return F;const R=l.map(i=>{const{value:t,label:s,disabled:d,description:m}=i;return m?e(T,{content:m,children:e(n,{disabled:d,value:t,children:s})},t):e(n,{disabled:d,value:t,children:s},t)});return e(D,{ref:V,block:f,buttonStyle:b,defaultValue:c,disabled:p,optionType:h,size:B(v),onChange:C,...r===void 0?{}:{value:r},children:R})}const u=x(M(G));u.displayName="VefRadio";export{u as default};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as l}from"@emotion/react/jsx-runtime";import{css as c}from"@emotion/react";import{useGapSizeNormalizer as u}from"@vef-framework/hooks";import{isArray as h}from"@vef-framework/shared";import{motion as b}from"motion/react";import{forwardRef as w,Children as g,isValidElement as y,useMemo as m,memo as x}from"react";import
|
|
3
|
-
display: grid;
|
|
4
|
-
grid-template-columns: repeat(var(--vef-responsive-container-auto-mode), minmax(var(--vef-responsive-container-base-width), 1fr));
|
|
5
|
-
gap: var(--vef-responsive-container-gap);
|
|
6
|
-
`,V=w(({style:t,baseItemWidth:o=320,autoExpand:n=!0,gap:e=0,children:a,...f},v)=>{if(o%2!==0)throw new Error("VefResponsiveContainer: baseItemWidth must be an even number.");g.forEach(a,r=>{if(!y(r)||r.type!==E)throw new Error("VefResponsiveContainer: children must be a VefResponsiveItem element.")});const i=u(),s=m(()=>h(e)?e.map(r=>i(r)).join(" "):i(e),[e,i]),d=m(()=>({...t,"--vef-responsive-container-auto-mode":n?"auto-fit":"auto-fill","--vef-responsive-container-base-width":`${o/2}px`,"--vef-responsive-container-gap":s}),[n,o,s,t]);return l(b.div,{ref:v,css:R,style:d,...f,children:a})}),p=x(V);p.displayName="VefResponsiveContainer";export{p as default};
|
|
2
|
+
import{jsx as l}from"@emotion/react/jsx-runtime";import{css as c}from"@emotion/react";import{useGapSizeNormalizer as u}from"@vef-framework/hooks";import{isArray as h}from"@vef-framework/shared";import{motion as b}from"motion/react";import{forwardRef as w,Children as g,isValidElement as y,useMemo as m,memo as x}from"react";import C from"../vef-responsive-item/index.js";const E=c({display:"grid",gridTemplateColumns:"repeat(var(--vef-responsive-container-auto-mode), minmax(var(--vef-responsive-container-base-width), 1fr))",gap:"var(--vef-responsive-container-gap)"}),R=w(({style:n,baseItemWidth:o=320,autoExpand:t=!0,gap:e=0,children:a,...f},v)=>{if(o%2!==0)throw new Error("VefResponsiveContainer: baseItemWidth must be an even number.");g.forEach(a,r=>{if(!y(r)||r.type!==C)throw new Error("VefResponsiveContainer: children must be a VefResponsiveItem element.")});const i=u(),s=m(()=>h(e)?e.map(r=>i(r)).join(" "):i(e),[e,i]),d=m(()=>({...n,"--vef-responsive-container-auto-mode":t?"auto-fit":"auto-fill","--vef-responsive-container-base-width":`${o/2}px`,"--vef-responsive-container-gap":s}),[t,o,s,n]);return l(b.div,{ref:v,css:E,style:d,...f,children:a})}),p=x(R);p.displayName="VefResponsiveContainer";export{p as default};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as n}from"@emotion/react/jsx-runtime";import{css as p}from"@emotion/react";import{motion as f}from"motion/react";import{forwardRef as a,useMemo as
|
|
3
|
-
grid-column: span var(--vef-responsive-item-span);
|
|
4
|
-
`,r=a(({style:e,span:s=1,children:o,...t},i)=>{const m=c(()=>({...e,"--vef-responsive-item-span":s*2}),[s,e]);return n(f.div,{ref:i,css:l,style:m,...t,children:o})});r.displayName="VefResponsiveItem";export{r as default};
|
|
2
|
+
import{jsx as n}from"@emotion/react/jsx-runtime";import{css as p}from"@emotion/react";import{motion as f}from"motion/react";import{forwardRef as a,useMemo as l}from"react";const c=p({gridColumn:"span var(--vef-responsive-item-span)"}),r=a(({style:e,span:s=1,children:o,...t},i)=>{const m=l(()=>({...e,"--vef-responsive-item-span":s*2}),[s,e]);return n(f.div,{ref:i,css:c,style:m,...t,children:o})});r.displayName="VefResponsiveItem";export{r as default};
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as
|
|
3
|
-
position: relative;
|
|
4
|
-
overflow: hidden;
|
|
5
|
-
height: var(--vef-scroll-area-height, 100%);
|
|
6
|
-
width: var(--vef-scroll-area-width, auto);
|
|
7
|
-
`,j=c`
|
|
8
|
-
height: 100%;
|
|
9
|
-
width: 100%;
|
|
10
|
-
border-radius: inherit;
|
|
11
|
-
-webkit-overflow-scrolling: touch;
|
|
12
|
-
`,m=C(({style:s,height:o,width:e,scrollDirection:r="y",scrollbarSize:i="medium",autoHideScrollbar:n=!0,viewportClassName:p,viewportStyle:a,viewportRef:v,onScroll:w,children:u,...y},b)=>{const x=l(()=>({...s,"--vef-scroll-area-height":(f(o)?`${o}px`:o)??"100%","--vef-scroll-area-width":(f(e)?`${e}px`:e)??"auto"}),[o,s,e]),h=l(()=>({"--vef-scroll-area-scrollbar-size":i==="small"?"10px":i==="medium"?"12px":"14px"}),[i]),g=l(()=>({...a,overflowX:`${r==="x"||r==="both"?"scroll":"hidden"}`,overflowY:`${r==="y"||r==="both"?"scroll":"hidden"}`}),[r,a]);return S($,{ref:b,css:R,style:x,type:n?"hover":"auto",...y,children:[t(N,{ref:v,className:p,css:j,style:g,onScroll:w,children:u}),(r==="y"||r==="both")&&t(d,{orientation:"vertical",style:h}),(r==="x"||r==="both")&&t(d,{orientation:"horizontal",style:h}),t(z,{})]})});m.displayName="VefScrollArea";export{m as default};
|
|
2
|
+
import{jsxs as g,jsx as t}from"@emotion/react/jsx-runtime";import{css as c}from"@emotion/react";import{Root as $,Viewport as N,Corner as R}from"@radix-ui/react-scroll-area";import{isNumber as f}from"@vef-framework/shared";import{forwardRef as z,useMemo as l}from"react";import d from"./components/scrollbar.js";const C=c({position:"relative",overflow:"hidden",height:"var(--vef-scroll-area-height, 100%)",width:"var(--vef-scroll-area-width, auto)"}),j=c({height:"100%",width:"100%",borderRadius:"inherit",WebkitOverflowScrolling:"touch"}),m=z(({style:s,height:o,width:e,scrollDirection:r="y",scrollbarSize:i="medium",autoHideScrollbar:n=!0,viewportClassName:p,viewportStyle:a,viewportRef:v,onScroll:w,children:u,...y},b)=>{const x=l(()=>({...s,"--vef-scroll-area-height":(f(o)?`${o}px`:o)??"100%","--vef-scroll-area-width":(f(e)?`${e}px`:e)??"auto"}),[o,s,e]),h=l(()=>({"--vef-scroll-area-scrollbar-size":i==="small"?"10px":i==="medium"?"12px":"14px"}),[i]),S=l(()=>({...a,overflowX:`${r==="x"||r==="both"?"scroll":"hidden"}`,overflowY:`${r==="y"||r==="both"?"scroll":"hidden"}`}),[r,a]);return g($,{ref:b,css:C,style:x,type:n?"hover":"auto",...y,children:[t(N,{ref:v,className:p,css:j,style:S,onScroll:w,children:u}),(r==="y"||r==="both")&&t(d,{orientation:"vertical",style:h}),(r==="x"||r==="both")&&t(d,{orientation:"horizontal",style:h}),t(R,{})]})});m.displayName="VefScrollArea";export{m as default};
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as o,jsx as i}from"@emotion/react/jsx-runtime";import{css as t}from"@emotion/react";import{themeVariables as p}from"@vef-framework/shared";import{memo as n}from"react";import e from"../../vef-text/index.js";const c=t
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
row-gap: 4px;
|
|
6
|
-
|
|
7
|
-
> .vef-typography-secondary {
|
|
8
|
-
font-size: ${p.fontSizeSm};
|
|
9
|
-
}
|
|
10
|
-
`;function m({label:s,description:l}){return l?o("div",{css:c,children:[i(e,{ellipsis:!0,ellipsisTipPlacement:"right",children:s}),i(e,{ellipsis:!0,color:"secondary",ellipsisTipPlacement:"right",children:l})]}):i(e,{ellipsis:!0,ellipsisTipPlacement:"right",children:s})}const r=n(m);r.displayName="VefOption";export{r as default};
|
|
2
|
+
import{jsxs as o,jsx as i}from"@emotion/react/jsx-runtime";import{css as t}from"@emotion/react";import{themeVariables as p}from"@vef-framework/shared";import{memo as n}from"react";import e from"../../vef-text/index.js";const c=t({display:"flex",flexDirection:"column",rowGap:"4px","> .vef-typography-secondary":{fontSize:p.fontSizeSm}});function m({label:s,description:l}){return l?o("div",{css:c,children:[i(e,{ellipsis:!0,ellipsisTipPlacement:"right",children:s}),i(e,{ellipsis:!0,color:"secondary",ellipsisTipPlacement:"right",children:l})]}):i(e,{ellipsis:!0,ellipsisTipPlacement:"right",children:s})}const r=n(m);r.displayName="VefOption";export{r as default};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as e,jsxs as l,Fragment as
|
|
3
|
-
cursor: move;
|
|
4
|
-
user-select: none;
|
|
5
|
-
touch-action: none;
|
|
6
|
-
`;function f({item:s,renderItem:n,useHandle:r,handleClassName:t,handleStyle:o,handleIcon:c}){return l(a,{children:[r&&e("div",{className:t,css:u,style:o,children:c??i}),n(s,!0)]})}export{f as default};
|
|
2
|
+
import{jsx as e,jsxs as l,Fragment as d}from"@emotion/react/jsx-runtime";import{HolderOutlined as m}from"@ant-design/icons";import{css as a}from"@emotion/react";const i=e(m,{}),u=a({cursor:"move",userSelect:"none",touchAction:"none"});function f({item:n,renderItem:r,useHandle:s,handleClassName:t,handleStyle:o,handleIcon:c}){return l(d,{children:[s&&e("div",{className:t,css:u,style:o,children:c??i}),r(n,!0)]})}export{f as default};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as s,jsxs as b}from"@emotion/react/jsx-runtime";import{HolderOutlined as g}from"@ant-design/icons";import{useSortable as I}from"@dnd-kit/sortable";import{CSS as C}from"@dnd-kit/utilities";import{css as O}from"@emotion/react";const j=s(g,{}),H=
|
|
3
|
-
cursor: move;
|
|
4
|
-
user-select: none;
|
|
5
|
-
touch-action: none;
|
|
6
|
-
`;function R({item:r,itemKey:i,itemIndex:o,itemClassName:n,itemStyle:a,renderItem:l,useHandle:e,useOverlay:m,handleClassName:d,handleStyle:c,handleIcon:f,disabled:u}){const{isDragging:p,attributes:v,listeners:t,setNodeRef:y,setActivatorNodeRef:S,transition:h,transform:x}=I({id:i,disabled:u,data:{index:o}}),N={...a,transition:h,transform:C.Transform.toString(x),...!m&&p?{position:"relative",zIndex:999}:{}};return b("div",{ref:y,className:n,style:N,...v,...e?{}:t,children:[e&&s("div",{ref:S,className:d,css:H,style:c,...t,children:f??j}),l(r,!1)]})}export{R as default};
|
|
2
|
+
import{jsx as s,jsxs as b}from"@emotion/react/jsx-runtime";import{HolderOutlined as g}from"@ant-design/icons";import{useSortable as I}from"@dnd-kit/sortable";import{CSS as C}from"@dnd-kit/utilities";import{css as O}from"@emotion/react";const j=s(g,{}),A=O({cursor:"move",userSelect:"none",touchAction:"none"});function H({item:r,itemKey:i,itemIndex:o,itemClassName:n,itemStyle:a,renderItem:l,useHandle:e,useOverlay:m,handleClassName:d,handleStyle:c,handleIcon:f,disabled:u}){const{isDragging:S,attributes:p,listeners:t,setNodeRef:v,setActivatorNodeRef:y,transition:h,transform:x}=I({id:i,disabled:u,data:{index:o}}),N={...a,transition:h,transform:C.Transform.toString(x),...!m&&S?{position:"relative",zIndex:999}:{}};return b("div",{ref:v,className:n,style:N,...p,...e?{}:t,children:[e&&s("div",{ref:y,className:d,css:A,style:c,...t,children:f??j}),l(r,!1)]})}export{H as default};
|
|
@@ -1,53 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as u,jsx as a,Fragment as
|
|
3
|
-
width: 300px;
|
|
4
|
-
padding: ${o.paddingSm};
|
|
5
|
-
|
|
6
|
-
.vef-divider-horizontal {
|
|
7
|
-
margin: ${o.marginSm} 0;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.vef-table-columns-settings-panel-header {
|
|
11
|
-
display: flex;
|
|
12
|
-
justify-content: space-between;
|
|
13
|
-
align-items: center;
|
|
14
|
-
padding-left: ${o.paddingSm};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.vef-table-columns-settings-panel-body {
|
|
18
|
-
width: 100%;
|
|
19
|
-
|
|
20
|
-
.vef-table-columns-settings-panel-columns {
|
|
21
|
-
width: 100%;
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
|
|
25
|
-
.vef-table-columns-settings-panel-column {
|
|
26
|
-
display: grid;
|
|
27
|
-
grid-template-columns: max-content 1fr max-content;
|
|
28
|
-
align-items: center;
|
|
29
|
-
padding: ${o.paddingXs};
|
|
30
|
-
border-radius: ${o.borderRadius};
|
|
31
|
-
|
|
32
|
-
&:hover {
|
|
33
|
-
background-color: ${o.colorPrimaryBg};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.vef-table-columns-settings-panel-column-drag-icon {
|
|
37
|
-
cursor: move;
|
|
38
|
-
color: ${o.colorTextSecondary};
|
|
39
|
-
padding-right: ${o.padding};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.vef-table-columns-settings-panel-column-fixed-icon {
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: center;
|
|
45
|
-
|
|
46
|
-
.vef-divider {
|
|
47
|
-
--vef-divider-vertical-margin-inline: 0;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
`;function L(){const{defaultColumnConfigMap:h,columnConfigMap:v,setColumnConfigMap:c}=G(e=>{const{defaultColumnConfigMap:t,columnConfigMap:n,setColumnConfigMap:l}=e;return{defaultColumnConfigMap:t,columnConfigMap:n,setColumnConfigMap:l}}),i=p(()=>[...v.entries()].sort(([e,t],[n,l])=>t.order-l.order).map(([e,t])=>{const{title:n,configurable:l,...s}=t;return{value:e,label:n,disabled:!l,...s}}),[v]),r=m(e=>{const t=e.reduce((n,l,s)=>{const{value:N,label:S,disabled:O,order:X,...V}=l,j={title:S,configurable:!O,order:s+1,...V};return n.set(N,j),n},new Map);c(t)},[c]),f=p(()=>i.filter(e=>e.show).map(e=>e.value),[i]),b=p(()=>{const e=f.length,t=i.length;return e===t?"checked":e>0?"indeterminate":"unchecked"},[f.length,i.length]),C=m(e=>{const t=new Set(e),n=i.map(l=>({...l,show:t.has(l.value)}));r(n)},[i,r]),d=m((e,t)=>{const n=i.map(l=>({...l,fixed:l.value===e?t:l.fixed}));r(n)},[i,r]),w=m(e=>{r(e)},[r]),$=m(()=>{c(new Map(h))},[h,c]);return u("div",{css:I,children:[u("div",{className:"vef-table-columns-settings-panel-header",children:[a(P,{indeterminate:b==="indeterminate",label:a(F,{bold:!0,children:"列显示"}),value:b==="checked",variant:"checkbox",onChange:e=>{C(e?i.map(t=>t.value):[])}}),a(g,{color:"primary",variant:"text",onClick:$,children:"重置"})]}),a(k,{}),a(y.Group,{className:"vef-table-columns-settings-panel-body",value:f,onChange:C,children:a(B,{useHandle:!0,className:"vef-table-columns-settings-panel-columns",handleClassName:"vef-table-columns-settings-panel-column-drag-icon",itemClassName:"vef-table-columns-settings-panel-column",itemKey:"value",items:i,useOverlay:!1,renderItem:({value:e,label:t,disabled:n,fixed:l,show:s})=>u(z,{children:[a(y,{disabled:n,value:e,children:t}),u("span",{className:"vef-table-columns-settings-panel-column-fixed-icon",children:[a(g,{color:l==="left"?"primary":"default",disabled:n||!s,icon:l==="left"?a(x,{}):a(R,{}),size:"small",tip:l==="left"?"取消左侧固定":"固定到左侧",variant:"link",onClick:()=>{l==="left"?d(e):d(e,"left")}}),a(k,{orientation:"vertical"}),a(g,{color:l==="right"?"primary":"default",disabled:n||!s,icon:l==="right"?a(x,{}):a(T,{}),size:"small",tip:l==="right"?"取消右侧固定":"固定到右侧",variant:"link",onClick:()=>{l==="right"?d(e):d(e,"right")}})]})]}),onChange:w})})]})}const M=K(L,()=>!1);M.displayName="VefColumnsSettings";export{M as default};
|
|
2
|
+
import{jsxs as u,jsx as a,Fragment as T}from"@emotion/react/jsx-runtime";import{RollbackOutlined as x,VerticalRightOutlined as j,VerticalLeftOutlined as z}from"@ant-design/icons";import{css as $}from"@emotion/react";import{themeVariables as o}from"@vef-framework/shared";import{Checkbox as y}from"antd";import{useMemo as p,useCallback as m,memo as D}from"react";import H from"../../vef-bool/index.js";import g from"../../vef-button/index.js";import k from"../../vef-divider/index.js";import L from"../../vef-sortable-list/index.js";import P from"../../vef-text/index.js";import{useTableContextSelector as X}from"../hooks/use-table-context.js";const B=$({width:300,padding:o.paddingSm,".vef-divider-horizontal":{margin:`${o.marginSm} 0`},".vef-table-columns-settings-panel-header":{display:"flex",justifyContent:"space-between",alignItems:"center",paddingLeft:o.paddingSm},".vef-table-columns-settings-panel-body":{width:"100%",".vef-table-columns-settings-panel-columns":{width:"100%",display:"flex",flexDirection:"column",".vef-table-columns-settings-panel-column":{display:"grid",gridTemplateColumns:"max-content 1fr max-content",alignItems:"center",padding:o.paddingXs,borderRadius:o.borderRadius,"&:hover":{backgroundColor:o.colorPrimaryBg},".vef-table-columns-settings-panel-column-drag-icon":{cursor:"move",color:o.colorTextSecondary,paddingRight:o.padding},".vef-table-columns-settings-panel-column-fixed-icon":{display:"flex",alignItems:"center",".vef-divider":{"--vef-divider-vertical-margin-inline":0}}}}}});function F(){const{defaultColumnConfigMap:h,columnConfigMap:v,setColumnConfigMap:c}=X(e=>{const{defaultColumnConfigMap:n,columnConfigMap:t,setColumnConfigMap:l}=e;return{defaultColumnConfigMap:n,columnConfigMap:t,setColumnConfigMap:l}}),i=p(()=>[...v.entries()].sort(([e,n],[t,l])=>n.order-l.order).map(([e,n])=>{const{title:t,configurable:l,...s}=n;return{value:e,label:t,disabled:!l,...s}}),[v]),r=m(e=>{const n=e.reduce((t,l,s)=>{const{value:S,label:R,disabled:V,order:G,...I}=l,O={title:R,configurable:!V,order:s+1,...I};return t.set(S,O),t},new Map);c(n)},[c]),f=p(()=>i.filter(e=>e.show).map(e=>e.value),[i]),b=p(()=>{const e=f.length,n=i.length;return e===n?"checked":e>0?"indeterminate":"unchecked"},[f.length,i.length]),C=m(e=>{const n=new Set(e),t=i.map(l=>({...l,show:n.has(l.value)}));r(t)},[i,r]),d=m((e,n)=>{const t=i.map(l=>({...l,fixed:l.value===e?n:l.fixed}));r(t)},[i,r]),w=m(e=>{r(e)},[r]),N=m(()=>{c(new Map(h))},[h,c]);return u("div",{css:B,children:[u("div",{className:"vef-table-columns-settings-panel-header",children:[a(H,{indeterminate:b==="indeterminate",label:a(P,{bold:!0,children:"列显示"}),value:b==="checked",variant:"checkbox",onChange:e=>{C(e?i.map(n=>n.value):[])}}),a(g,{color:"primary",variant:"text",onClick:N,children:"重置"})]}),a(k,{}),a(y.Group,{className:"vef-table-columns-settings-panel-body",value:f,onChange:C,children:a(L,{useHandle:!0,className:"vef-table-columns-settings-panel-columns",handleClassName:"vef-table-columns-settings-panel-column-drag-icon",itemClassName:"vef-table-columns-settings-panel-column",itemKey:"value",items:i,useOverlay:!1,renderItem:({value:e,label:n,disabled:t,fixed:l,show:s})=>u(T,{children:[a(y,{disabled:t,value:e,children:n}),u("span",{className:"vef-table-columns-settings-panel-column-fixed-icon",children:[a(g,{color:l==="left"?"primary":"default",disabled:t||!s,icon:l==="left"?a(x,{}):a(j,{}),size:"small",tip:l==="left"?"取消左侧固定":"固定到左侧",variant:"link",onClick:()=>{l==="left"?d(e):d(e,"left")}}),a(k,{orientation:"vertical"}),a(g,{color:l==="right"?"primary":"default",disabled:t||!s,icon:l==="right"?a(x,{}):a(z,{}),size:"small",tip:l==="right"?"取消右侧固定":"固定到右侧",variant:"link",onClick:()=>{l==="right"?d(e):d(e,"right")}})]})]}),onChange:w})})]})}const M=D(F,()=>!1);M.displayName="VefColumnsSettings";export{M as default};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as P,jsx as a}from"@emotion/react/jsx-runtime";import{MoreOutlined as H}from"@ant-design/icons";import{css as S}from"@emotion/react";import{useComputedActionButtons as V}from"@vef-framework/hooks";import{invokeMaybeAsyncFn as N
|
|
3
|
-
.vef-btn-sm {
|
|
4
|
-
--vef-control-height-sm: 24px;
|
|
5
|
-
--vef-button-padding-inline-sm: 4px;
|
|
6
|
-
|
|
7
|
-
&.vef-btn-icon-only {
|
|
8
|
-
padding-inline: 2px;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
`;function W({record:k,rowIndex:x,operationButtons:K,maxVisibleOperationButtons:c}){const{externalContext:v,refetch:F,isFetching:M,selectedKeys:w,selectedRecords:O}=J(e=>{const{externalContext:t,refetch:i,isFetching:n,selectedKeys:o,selectedRecords:s}=e;return{externalContext:t,refetch:i,isFetching:n,selectedKeys:o,selectedRecords:s}}),d=y(()=>({record:k,rowIndex:x,refetch:F,isFetching:M,selectedKeys:w,selectedRecords:O,...v??{}}),[v,M,k,F,x,w,O]),r=V(K,d),[l,T]=b(!1),f=y(()=>r.length>c?r.slice(c).map(e=>{const{key:t,label:i,icon:n,disabled:o}=e;return{type:"item",key:t,label:i,icon:n,disabled:o}}):[],[r,c]),[R,j]=b(!1),[p,u]=b(null),C=U(()=>{j(!1),u(null)},[]),q=y(()=>{if(f.length!==0)return async e=>{const{requireConfirmation:t,confirmationMode:i,confirmationTitle:n,confirmationContent:o,onClick:s}=r.find(h=>h.key===e),m=async()=>{try{await N(s,{beforeInvoke:()=>{T(!0)},onFinally:()=>{T(!1)}},d)}finally{C()}};t?i==="simple"?(u({title:n,content:o,okHandler:m}),j(!0)):Q(n,o,m,{onCancel:()=>{u(null)}}):await m()}},[r,d,C,f.length]);return P(E,{align:"center",css:L,gap:"small",justify:"center",children:[r.slice(0,c).map(e=>{const{key:t,label:i,icon:n,color:o,disabled:s,requireConfirmation:m,confirmationMode:h,confirmationTitle:z,confirmationContent:A,onClick:I}=e;return m?a(g,{requireConfirmation:!0,color:o,confirmationContent:A,confirmationMode:h,confirmationTitle:z,disabled:s||l,icon:n,size:"small",variant:"filled",onConfirmationOk:()=>I(d),children:i},t):a(g,{color:o,disabled:s||l,icon:n,size:"small",variant:"filled",onClick:B=>(B.stopPropagation(),I(d)),children:i},t)}),r.length>c&&a(D,{disabled:l,items:f,onClick:q,children:a(G,{content:p?.content,disabled:l,opened:R,title:p?.title,onCancel:C,onOk:p?.okHandler,children:a(g,{color:"primary",disabled:l,icon:a(H,{}),loading:l,size:"small",variant:"filled",onClick:e=>e.stopPropagation()})})})]})}export{W as default};
|
|
2
|
+
import{jsxs as P,jsx as a}from"@emotion/react/jsx-runtime";import{MoreOutlined as H}from"@ant-design/icons";import{css as S}from"@emotion/react";import{useComputedActionButtons as V}from"@vef-framework/hooks";import{invokeMaybeAsyncFn as N}from"@vef-framework/shared";import{useMemo as y,useState as b,useCallback as Q}from"react";import"../../helpers/index.js";import g from"../../vef-button/index.js";import U from"../../vef-dropdown/index.js";import D from"../../vef-flex/index.js";import E from"../../vef-popconfirm/index.js";import{useTableContextSelector as G}from"../hooks/use-table-context.js";import{showConfirmation as J}from"../../helpers/message.js";const L=S({".vef-btn-sm":{"--vef-control-height-sm":"24px","--vef-button-padding-inline-sm":"4px","&.vef-btn-icon-only":{paddingInline:"2px"}}});function W({record:k,rowIndex:x,operationButtons:K,maxVisibleOperationButtons:c}){const{externalContext:v,refetch:F,isFetching:M,selectedKeys:w,selectedRecords:I}=G(e=>{const{externalContext:t,refetch:i,isFetching:n,selectedKeys:o,selectedRecords:s}=e;return{externalContext:t,refetch:i,isFetching:n,selectedKeys:o,selectedRecords:s}}),m=y(()=>({record:k,rowIndex:x,refetch:F,isFetching:M,selectedKeys:w,selectedRecords:I,...v??{}}),[v,M,k,F,x,w,I]),r=V(K,m),[l,O]=b(!1),f=y(()=>r.length>c?r.slice(c).map(e=>{const{key:t,label:i,icon:n,disabled:o}=e;return{type:"item",key:t,label:i,icon:n,disabled:o}}):[],[r,c]),[R,T]=b(!1),[p,u]=b(null),C=Q(()=>{T(!1),u(null)},[]),q=y(()=>{if(f.length!==0)return async e=>{const{requireConfirmation:t,confirmationMode:i,confirmationTitle:n,confirmationContent:o,onClick:s}=r.find(h=>h.key===e),d=async()=>{try{await N(s,{beforeInvoke:()=>{O(!0)},onFinally:()=>{O(!1)}},m)}finally{C()}};t?i==="simple"?(u({title:n,content:o,okHandler:d}),T(!0)):J(n,o,d,{onCancel:()=>{u(null)}}):await d()}},[r,m,C,f.length]);return P(D,{align:"center",css:L,gap:"small",justify:"center",children:[r.slice(0,c).map(e=>{const{key:t,label:i,icon:n,color:o,disabled:s,requireConfirmation:d,confirmationMode:h,confirmationTitle:z,confirmationContent:A,onClick:j}=e;return d?a(g,{requireConfirmation:!0,color:o,confirmationContent:A,confirmationMode:h,confirmationTitle:z,disabled:s||l,icon:n,size:"small",variant:"filled",onConfirmationOk:()=>j(m),children:i},t):a(g,{color:o,disabled:s||l,icon:n,size:"small",variant:"filled",onClick:B=>(B.stopPropagation(),j(m)),children:i},t)}),r.length>c&&a(U,{disabled:l,items:f,onClick:q,children:a(E,{content:p?.content,disabled:l,opened:R,title:p?.title,onCancel:C,onOk:p?.okHandler,children:a(g,{color:"primary",disabled:l,icon:a(H,{}),loading:l,size:"small",variant:"filled",onClick:e=>e.stopPropagation()})})})]})}export{W as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import{jsx as o}from"@emotion/react/jsx-runtime";import{css as m}from"@emotion/react";import{themeVariables as e}from"@vef-framework/shared";import{SettingsIcon as i}from"lucide-react";import{memo as s}from"react";import c from"../../vef-icon/index.js";import{useTableContextSelector as n}from"../hooks/use-table-context.js";const a=m`
|
|
3
3
|
color: ${e.colorPrimary};
|
|
4
|
-
`;function f(){const r=n(t=>t.columnConfigMapHasChanged);return o(c,{css:r?a:void 0,children:o(i,{})})}const
|
|
4
|
+
`;function f(){const r=n(t=>t.columnConfigMapHasChanged);return o(c,{css:r?a:void 0,children:o(i,{})})}const p=s(f,()=>!1);export{p as default};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as r,jsx as i}from"@emotion/react/jsx-runtime";import{css as
|
|
3
|
-
width: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: var(--vef-table-footer-gap);
|
|
7
|
-
|
|
8
|
-
> div {
|
|
9
|
-
flex: auto;
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
gap: ${B.padding};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
> .vef-pagination {
|
|
16
|
-
flex: none;
|
|
17
|
-
}
|
|
18
|
-
`;function S({selectionSummary:o,size:t,paginationProps:v,batchActionButtons:l,batchActionButtonContext:c}){const e=F(n=>n.selectedRecords),y=a(()=>{if(o!==!1){if(o)return o(e);if(e.length>0)return r(g,{color:"secondary",children:["已选择"," ",i(g,{bold:!0,color:"blue",children:e.length})," ","项"]})}},[o,e]),x=a(()=>l.map(n=>{const{key:m,label:s,icon:d,disabled:f,color:p,requireConfirmation:k,confirmationMode:M,confirmationTitle:T,confirmationContent:$,onClick:q}=n,u=async()=>{await V(q,{},c)};return k?i(b,{requireConfirmation:!0,color:p,confirmationContent:$,confirmationMode:M,confirmationTitle:T,disabled:f,icon:d,onConfirmationOk:u,children:s},m):i(b,{color:p,disabled:f,icon:d,onClick:u,children:s},m)}),[l,c]),C=a(()=>({"--vef-table-footer-gap":`var(--vef-table-cell-padding-block${t==="small"?"-sm":t==="medium"?"-md":""})`}),[t]);return r("div",{css:P,style:C,children:[r("div",{children:[y,x]}),i(w,{...v})]})}const h=j(S);h.displayName="VefTableFooter";export{h as default};
|
|
2
|
+
import{jsxs as r,jsx as i}from"@emotion/react/jsx-runtime";import{css as B}from"@emotion/react";import{themeVariables as V,invokeMaybeAsyncFn as $}from"@vef-framework/shared";import{useMemo as a,memo as j}from"react";import b from"../../vef-button/index.js";import w from"../../vef-pagination/index.js";import g from"../../vef-text/index.js";import{useTableContextSelector as F}from"../hooks/use-table-context.js";const I=B({width:"100%",display:"flex",alignItems:"center",gap:"var(--vef-table-footer-gap)","> div":{flex:"auto",display:"flex",alignItems:"center",gap:V.padding},"> .vef-pagination":{flex:"none"}});function P({selectionSummary:o,size:t,paginationProps:v,batchActionButtons:l,batchActionButtonContext:c}){const e=F(n=>n.selectedRecords),y=a(()=>{if(o!==!1){if(o)return o(e);if(e.length>0)return r(g,{color:"secondary",children:["已选择"," ",i(g,{bold:!0,color:"blue",children:e.length})," ","项"]})}},[o,e]),x=a(()=>l.map(n=>{const{key:m,label:s,icon:d,disabled:f,color:p,requireConfirmation:k,confirmationMode:M,confirmationTitle:T,confirmationContent:q,onClick:A}=n,u=async()=>{await $(A,{},c)};return k?i(b,{requireConfirmation:!0,color:p,confirmationContent:q,confirmationMode:M,confirmationTitle:T,disabled:f,icon:d,onConfirmationOk:u,children:s},m):i(b,{color:p,disabled:f,icon:d,onClick:u,children:s},m)}),[l,c]),C=a(()=>({"--vef-table-footer-gap":`var(--vef-table-cell-padding-block${t==="small"?"-sm":t==="medium"?"-md":""})`}),[t]);return r("div",{css:I,style:C,children:[r("div",{children:[y,x]}),i(w,{...v})]})}const h=j(P);h.displayName="VefTableFooter";export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as n}from"@emotion/react/jsx-runtime";import{useAuthorizedItems as h}from"@vef-framework/hooks";import{isDeepEqual as
|
|
2
|
+
import{jsx as n}from"@emotion/react/jsx-runtime";import{useAuthorizedItems as h}from"@vef-framework/hooks";import{isDeepEqual as w}from"@vef-framework/shared";import{useMemo as s}from"react";import c from"../components/columns-settings.js";import x from"../components/operation-buttons.js";import C from"../components/settings-icon.js";import{useOperationColumnWidth as b}from"./use-operation-column-width.js";const l=3;function B({showRowNumber:m,operationButtons:p,maxVisibleOperationButtons:t,size:d}){const f=s(()=>{if(m)return{key:"_rowNumber",title:"#",align:"center",fixed:"left",width:48,shouldCellUpdate:()=>!1,render:(o,r,i)=>i+1}},[m]),e=h(p??[]),u=b(e,t??l,d),a=s(()=>{if(e&&e.length>0)return{key:"_operationButtons",title:"操作",align:"center",fixed:"right",filterIcon:()=>n(C,{}),filterDropdown:()=>n(c,{}),width:u,shouldCellUpdate:(o,r)=>!w(o,r),render:(o,r,i)=>n(x,{maxVisibleOperationButtons:t??l,operationButtons:e,record:r,rowIndex:i})}},[e,t,u]);return{rowNumberColumn:f,operationColumn:a}}export{B as useHelperColumns};
|
package/esm/vef-table/index.js
CHANGED
|
@@ -1,55 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as u}from"@emotion/react/jsx-runtime";import{css as P}from"@emotion/react";import{themeVariables as
|
|
3
|
-
height: 100%;
|
|
4
|
-
|
|
5
|
-
> .vef-spin-nested-loading {
|
|
6
|
-
height: 100%;
|
|
7
|
-
|
|
8
|
-
> .vef-spin-container {
|
|
9
|
-
height: 100%;
|
|
10
|
-
|
|
11
|
-
> .vef-table {
|
|
12
|
-
height: 100%;
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
|
|
16
|
-
> .vef-table-container {
|
|
17
|
-
flex: 1;
|
|
18
|
-
min-height: 0;
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
|
|
22
|
-
> .vef-table-header {
|
|
23
|
-
flex-shrink: 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
> .vef-table-body {
|
|
27
|
-
flex: 1;
|
|
28
|
-
scrollbar-width: thin;
|
|
29
|
-
scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
|
|
30
|
-
min-height: 200px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
> .vef-table-title {
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
padding: ${E.paddingSm};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
> .vef-table-footer {
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
padding: ${E.paddingXs}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&.vef-table-empty > .vef-table-container > .vef-table-body > table {
|
|
45
|
-
min-height: 100%;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`,Ke=P`
|
|
51
|
-
.vef-table-content {
|
|
52
|
-
scrollbar-width: thin;
|
|
53
|
-
scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
|
|
54
|
-
}
|
|
55
|
-
`;function Fe({columns:i,defaultColumnConfigMap:t,rowNumberColumn:f,operationColumn:d,bordered:a=!1,size:n="medium",rowKey:r=Ne,height:e,virtual:p=!1,selectedKeys:b,defaultSelectedKeys:h,selectable:o=!1,multipleSelection:L,showSelectAllCheckbox:Ve,disabledSelection:x,enableRowClick:y,enableRowClickForSelection:R,rowBackgroundColor:ze,batchActionButtons:U,selectionSummary:C,externalContext:v,onRowSelectionChange:$,onRowSelect:q,onRowDeselect:G,onRowClick:J,...Q},W){const{paginated:s=!1,...X}=Q,{paginationProps:B,paginationParams:Z}=we(s,n),{data:c,isFetching:g,isLoading:k,total:T,refetch:w}=he(X,s,Z),N=l(()=>({...B,total:T}),[B,T]),[m,Y]=me(()=>new Map(t)),_=ue(m),A=be(i,_),{rowSelectionConfig:ee,handleRowClickSelection:oe,selectedKeys:K,selectedRecords:F}=xe({selectedKeys:b,defaultSelectedKeys:h,selectable:o,multipleSelection:L,disabledSelection:x,enableRowClick:y,enableRowClickForSelection:R,onRowSelect:q,onRowDeselect:G,onRowSelectionChange:$,rowKey:r}),te=Se({enableRowClick:y,enableRowClickForSelection:R,onRowClick:J,disabledSelection:x,handleRowClickSelection:oe}),M=l(()=>({externalContext:v,isFetching:g,refetch:w,selectedKeys:K,selectedRecords:F.current,defaultColumnConfigMap:t,columnConfigMap:m,setColumnConfigMap:Y,columnConfigMapHasChanged:!O(t,m)}),[v,g,w,K,F,t,m]),V=ye(A,f,d),z=ke(V,o),ne=l(()=>({x:z,y:e==="auto"?"auto":e,scrollToFirstRowOnChange:!0}),[e,z]),le=ve(W,c??[],w),ie=Be(A),{computedBatchActionButtons:S,batchActionButtonContext:D}=pe(U??[],M),ae=l(()=>{if(k||c?.length===0||!s&&C===!1&&S.length===0)return;const re=u(de,{batchActionButtonContext:D,batchActionButtons:S,paginationProps:N,selectionSummary:C,size:n});return()=>re},[D,S,c?.length,k,N,s,C,n]);return u(Re,{value:M,children:u(ce,{ref:le,bordered:a,columns:V,css:e==="auto"?Ae:Ke,dataSource:c,footer:ae,loading:g,pagination:!1,rowKey:r,rowSelection:ee,scroll:ne,size:Te(n),summary:ie,tableLayout:"fixed",virtual:se(e)&&e>0&&p,onRow:te})})}const j=H(Fe);j.displayName="VefTableBase";function Me({schema:i,showRowNumber:t,operationButtons:f,maxVisibleOperationButtons:d,...a},n){const{size:r}=a,e=l(()=>i.filter(o=>o.show??!0).map(o=>({...o,dependentColumnNames:[...new Set([o.name,...o.dependentColumnNames??[]])]})),[i]);if(e.length===0)throw new Error("The showed columns of VefTable component cannot be empty");const p=Ce(e),{rowNumberColumn:b,operationColumn:h}=ge({showRowNumber:t,operationButtons:f,maxVisibleOperationButtons:d,size:r});return u(j,{ref:n,columns:e,defaultColumnConfigMap:p,operationColumn:h,rowNumberColumn:b,...a})}const I=fe(H(Me),O);I.displayName="VefTable";export{I as default};
|
|
2
|
+
import{jsx as u}from"@emotion/react/jsx-runtime";import{css as P}from"@emotion/react";import{themeVariables as H,isDeepEqual as E,isNumber as se}from"@vef-framework/shared";import{Table as me}from"antd";import{useMemo as l,useState as ce,useDeferredValue as ue,forwardRef as W,memo as fe}from"react";import"../internal/index.js";import pe from"./components/table-footer.js";import{useComputedBatchActionButtons as de}from"./hooks/use-computed-batch-buttons.js";import{useComputedColumns as be}from"./hooks/use-computed-columns.js";import{useData as he}from"./hooks/use-data.js";import{useDefaultColumnConfigs as Ce}from"./hooks/use-default-column-configs.js";import{useHelperColumns as ge}from"./hooks/use-helper-columns.js";import{usePaginationProps as we}from"./hooks/use-pagination-props.js";import{useRowProps as Se}from"./hooks/use-row-props.js";import{useRowSelectionConfig as xe}from"./hooks/use-row-selection-config.js";import{useTableColumns as ye}from"./hooks/use-table-columns.js";import{TableContextProvider as Re}from"./hooks/use-table-context.js";import{useTableInstance as ve}from"./hooks/use-table-instance.js";import{useTableSummary as Be}from"./hooks/use-table-summary.js";import{useTableWidth as ke}from"./hooks/use-table-width.js";import{convertBasicSizeToUiSize as Te}from"../internal/utils.js";const Ne="id",Ke=P({height:"100%","> .vef-spin-nested-loading":{height:"100%","> .vef-spin-container":{height:"100%","> .vef-table":{height:"100%",display:"flex",flexDirection:"column","> .vef-table-container":{flex:1,minHeight:0,display:"flex",flexDirection:"column","> .vef-table-header":{flexShrink:0},"> .vef-table-body":{flex:1,scrollbarWidth:"thin",scrollbarColor:"rgba(0, 0, 0, 0.3) transparent",minHeight:"200px"}},"> .vef-table-title":{flexShrink:0,padding:H.paddingSm},"> .vef-table-footer":{flexShrink:0,padding:H.paddingXs},"&.vef-table-empty > .vef-table-container > .vef-table-body > table":{minHeight:"100%"}}}}}),Ae=P({".vef-table-content":{scrollbarWidth:"thin",scrollbarColor:"rgba(0, 0, 0, 0.3) transparent"}});function De({columns:i,defaultColumnConfigMap:t,rowNumberColumn:f,operationColumn:p,bordered:a=!1,size:n="medium",rowKey:r=Ne,height:e,virtual:d=!1,selectedKeys:b,defaultSelectedKeys:h,selectable:o=!1,multipleSelection:L,showSelectAllCheckbox:Me,disabledSelection:x,enableRowClick:y,enableRowClickForSelection:R,rowBackgroundColor:Ve,batchActionButtons:O,selectionSummary:C,externalContext:v,onRowSelectionChange:q,onRowSelect:J,onRowDeselect:Q,onRowClick:U,...X},Z){const{paginated:s=!1,...$}=X,{paginationProps:B,paginationParams:G}=we(s,n),{data:m,isFetching:g,isLoading:k,total:T,refetch:w}=he($,s,G),N=l(()=>({...B,total:T}),[B,T]),[c,Y]=ce(()=>new Map(t)),_=ue(c),K=be(i,_),{rowSelectionConfig:ee,handleRowClickSelection:oe,selectedKeys:A,selectedRecords:D}=xe({selectedKeys:b,defaultSelectedKeys:h,selectable:o,multipleSelection:L,disabledSelection:x,enableRowClick:y,enableRowClickForSelection:R,onRowSelect:J,onRowDeselect:Q,onRowSelectionChange:q,rowKey:r}),te=Se({enableRowClick:y,enableRowClickForSelection:R,onRowClick:U,disabledSelection:x,handleRowClickSelection:oe}),F=l(()=>({externalContext:v,isFetching:g,refetch:w,selectedKeys:A,selectedRecords:D.current,defaultColumnConfigMap:t,columnConfigMap:c,setColumnConfigMap:Y,columnConfigMapHasChanged:!E(t,c)}),[v,g,w,A,D,t,c]),M=ye(K,f,p),V=ke(M,o),ne=l(()=>({x:V,y:e==="auto"?"auto":e,scrollToFirstRowOnChange:!0}),[e,V]),le=ve(Z,m??[],w),ie=Be(K),{computedBatchActionButtons:S,batchActionButtonContext:z}=de(O??[],F),ae=l(()=>{if(k||m?.length===0||!s&&C===!1&&S.length===0)return;const re=u(pe,{batchActionButtonContext:z,batchActionButtons:S,paginationProps:N,selectionSummary:C,size:n});return()=>re},[z,S,m?.length,k,N,s,C,n]);return u(Re,{value:F,children:u(me,{ref:le,bordered:a,columns:M,css:e==="auto"?Ke:Ae,dataSource:m,footer:ae,loading:g,pagination:!1,rowKey:r,rowSelection:ee,scroll:ne,size:Te(n),summary:ie,tableLayout:"fixed",virtual:se(e)&&e>0&&d,onRow:te})})}const j=W(De);j.displayName="VefTableBase";function Fe({schema:i,showRowNumber:t,operationButtons:f,maxVisibleOperationButtons:p,...a},n){const{size:r}=a,e=l(()=>i.filter(o=>o.show??!0).map(o=>({...o,dependentColumnNames:[...new Set([o.name,...o.dependentColumnNames??[]])]})),[i]);if(e.length===0)throw new Error("The showed columns of VefTable component cannot be empty");const d=Ce(e),{rowNumberColumn:b,operationColumn:h}=ge({showRowNumber:t,operationButtons:f,maxVisibleOperationButtons:p,size:r});return u(j,{ref:n,columns:e,defaultColumnConfigMap:d,operationColumn:h,rowNumberColumn:b,...a})}const I=fe(W(Fe),E);I.displayName="VefTable";export{I as default};
|
package/esm/vef-title/index.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as b,Fragment as v,jsx as f}from"@emotion/react/jsx-runtime";import{css as h}from"@emotion/react";import{useColorTokens as
|
|
3
|
-
margin: ${t.marginSm} 0 ${t.marginLg};
|
|
4
|
-
`,B=h`
|
|
5
|
-
&::before {
|
|
6
|
-
content: "";
|
|
7
|
-
display: inline-block;
|
|
8
|
-
width: 6px;
|
|
9
|
-
height: var(--vef-title-left-bar-height);
|
|
10
|
-
border-radius: 3px;
|
|
11
|
-
background: linear-gradient(to top, ${t.colorPrimary}, ${t.blue5});
|
|
12
|
-
margin-right: ${t.paddingSm};
|
|
13
|
-
}
|
|
14
|
-
`;function L({showLeftBar:i,showBottomLine:d,noPaddingBottom:n,variant:s,color:r,ellipsis:a,ellipsisTip:m,...o}){const{level:p=1}=o,u=g(()=>{if(a)return{tooltip:m??o.children}},[a,m,o.children]),c=$(),y=g(()=>{const e={};if(r==="secondary")e.type="secondary";else{const l=[];r&&l.push({color:c.get(r)}),i&&l.push(B),e.css=l}return s&&(e[s]=!0),i&&(e.style={"--vef-title-left-bar-height":`calc(var(--vef-font-size-heading-${p}) * 0.8)`}),n&&(e.style={...e.style,"--vef-typography-title-margin-bottom":0}),e},[r,s,i,c,p,n]);return b(v,{children:[f(T,{ellipsis:u,...y,...o}),d&&f(k,{css:w})]})}export{L as default};
|
|
2
|
+
import{jsxs as b,Fragment as v,jsx as f}from"@emotion/react/jsx-runtime";import{css as h}from"@emotion/react";import{useColorTokens as x}from"@vef-framework/hooks";import{themeVariables as t}from"@vef-framework/shared";import{Typography as $}from"antd";import{useMemo as g}from"react";import k from"../vef-divider/index.js";const{Title:T}=$,w=h({margin:`${t.marginSm} 0 ${t.marginLg}`}),B=h({"&::before":{content:'""',display:"inline-block",width:"6px",height:"var(--vef-title-left-bar-height)",borderRadius:"3px",background:`linear-gradient(to top, ${t.colorPrimary}, ${t.blue5})`,marginRight:t.paddingSm}});function L({showLeftBar:i,showBottomLine:d,noPaddingBottom:n,variant:s,color:o,ellipsis:a,ellipsisTip:m,...r}){const{level:p=1}=r,u=g(()=>{if(a)return{tooltip:m??r.children}},[a,m,r.children]),c=x(),y=g(()=>{const e={};if(o==="secondary")e.type="secondary";else{const l=[];o&&l.push({color:c.get(o)}),i&&l.push(B),e.css=l}return s&&(e[s]=!0),i&&(e.style={"--vef-title-left-bar-height":`calc(var(--vef-font-size-heading-${p}) * 0.8)`}),n&&(e.style={...e.style,"--vef-typography-title-margin-bottom":0}),e},[o,s,i,c,p,n]);return b(v,{children:[f(T,{ellipsis:u,...y,...r}),d&&f(k,{css:w})]})}export{L as default};
|
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as l}from"@emotion/react/jsx-runtime";import{css as x}from"@emotion/react";import{useVirtualizer as w}from"@tanstack/react-virtual";import{useGapSizeNormalizer as G}from"@vef-framework/hooks";import{isArray as k,isNumber as z}from"@vef-framework/shared";import{useMemo as u,memo as S,useRef as M,Fragment as R,createElement as X}from"react";import j from"../vef-auto-sizer/index.js";import A from"../vef-scroll-area/index.js";const D={willChange:"transform"},F=x`
|
|
3
|
-
position: relative;
|
|
4
|
-
width: var(--vef-virtual-grid-width);
|
|
5
|
-
height: var(--vef-virtual-grid-height);
|
|
6
|
-
`,H=x`
|
|
7
|
-
position: absolute;
|
|
8
|
-
top: 0;
|
|
9
|
-
left: 0;
|
|
10
|
-
width: var(--vef-virtual-grid-item-width);
|
|
11
|
-
height: var(--vef-virtual-grid-item-height);
|
|
12
|
-
transform: translateX(var(--vef-virtual-grid-item-x)) translateY(var(--vef-virtual-grid-item-y));
|
|
13
|
-
`;function L({className:N,style:$,items:m,renderItem:v,itemClassName:I,itemStyle:T,rowHeight:s,columnWidth:n,gap:t,...f}){const V=u(()=>S(v),[v]),d=M(null),o=G(),[b,C]=u(()=>{if(k(t))return[o(t[0]),o(t[1])];if(t){const e=o(t);return[e,e]}return[0,0]},[t,o]),g=w({count:m.length,getScrollElement:()=>d.current,estimateSize:z(s)?()=>s:s,overscan:2,gap:b}),h=w({horizontal:!0,count:m[0]?.length??0,getScrollElement:()=>d.current,estimateSize:z(n)?()=>n:n,overscan:2,gap:C}),E=u(()=>({"--vef-virtual-grid-height":`${g.getTotalSize()}px`,"--vef-virtual-grid-width":`${h.getTotalSize()}px`}),[g.getTotalSize(),h.getTotalSize()]),c=(e,i)=>l(A,{className:N,height:e,scrollbarSize:"small",style:$,viewportRef:d,viewportStyle:D,width:i,children:l("div",{css:F,style:E,children:g.getVirtualItems().map(r=>l(R,{children:h.getVirtualItems().map(a=>{const p=m[r.index][a.index];return l("div",{className:I,css:H,style:{...T,"--vef-virtual-grid-item-width":`${a.size}px`,"--vef-virtual-grid-item-height":`${r.size}px`,"--vef-virtual-grid-item-x":`${a.start}px`,"--vef-virtual-grid-item-y":`${r.start}px`},children:p&&X(V,{item:p,rowIndex:r.index,columnIndex:a.index})},a.key)})},r.key))})});if(!f.autoSize){const{height:e,width:i}=f;return c(e,i)}return l(j,{children:({height:e,width:i})=>c(e,i)})}const y=S(L);y.displayName="VefVirtualGrid";export{y as default};
|
|
2
|
+
import{jsx as l}from"@emotion/react/jsx-runtime";import{css as x}from"@emotion/react";import{useVirtualizer as w}from"@tanstack/react-virtual";import{useGapSizeNormalizer as G}from"@vef-framework/hooks";import{isArray as k,isNumber as z}from"@vef-framework/shared";import{useMemo as u,memo as S,useRef as M,Fragment as R,createElement as X}from"react";import j from"../vef-auto-sizer/index.js";import A from"../vef-scroll-area/index.js";const D={willChange:"transform"},F=x({position:"relative",width:"var(--vef-virtual-grid-width)",height:"var(--vef-virtual-grid-height)"}),H=x({position:"absolute",top:0,left:0,width:"var(--vef-virtual-grid-item-width)",height:"var(--vef-virtual-grid-item-height)",transform:"translateX(var(--vef-virtual-grid-item-x)) translateY(var(--vef-virtual-grid-item-y))"});function L({className:N,style:$,items:m,renderItem:v,itemClassName:I,itemStyle:T,rowHeight:s,columnWidth:n,gap:t,...f}){const V=u(()=>S(v),[v]),d=M(null),o=G(),[b,C]=u(()=>{if(k(t))return[o(t[0]),o(t[1])];if(t){const e=o(t);return[e,e]}return[0,0]},[t,o]),g=w({count:m.length,getScrollElement:()=>d.current,estimateSize:z(s)?()=>s:s,overscan:2,gap:b}),h=w({horizontal:!0,count:m[0]?.length??0,getScrollElement:()=>d.current,estimateSize:z(n)?()=>n:n,overscan:2,gap:C}),E=u(()=>({"--vef-virtual-grid-height":`${g.getTotalSize()}px`,"--vef-virtual-grid-width":`${h.getTotalSize()}px`}),[g.getTotalSize(),h.getTotalSize()]),c=(e,i)=>l(A,{className:N,height:e,scrollbarSize:"small",style:$,viewportRef:d,viewportStyle:D,width:i,children:l("div",{css:F,style:E,children:g.getVirtualItems().map(r=>l(R,{children:h.getVirtualItems().map(a=>{const p=m[r.index][a.index];return l("div",{className:I,css:H,style:{...T,"--vef-virtual-grid-item-width":`${a.size}px`,"--vef-virtual-grid-item-height":`${r.size}px`,"--vef-virtual-grid-item-x":`${a.start}px`,"--vef-virtual-grid-item-y":`${r.start}px`},children:p&&X(V,{item:p,rowIndex:r.index,columnIndex:a.index})},a.key)})},r.key))})});if(!f.autoSize){const{height:e,width:i}=f;return c(e,i)}return l(j,{children:({height:e,width:i})=>c(e,i)})}const y=S(L);y.displayName="VefVirtualGrid";export{y as default};
|
|
@@ -1,19 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as i}from"@emotion/react/jsx-runtime";import{css as z}from"@emotion/react";import{useVirtualizer as P}from"@tanstack/react-virtual";import{useNormalizedGapSize as U}from"@vef-framework/hooks";import{isFunction as E}from"@vef-framework/shared";import{useMemo as v,memo as Y,useRef as W,createElement as w}from"react";import F from"../vef-auto-sizer/index.js";import K from"../vef-scroll-area/index.js";const M={willChange:"transform"},$=z`
|
|
3
|
-
position: relative;
|
|
4
|
-
width: var(--vef-virtual-list-width, auto);
|
|
5
|
-
height: var(--vef-virtual-list-height, auto);
|
|
6
|
-
`,j=z`
|
|
7
|
-
position: absolute;
|
|
8
|
-
top: var(--vef-virtual-list-item-top, 0);
|
|
9
|
-
left: var(--vef-virtual-list-item-left, 0);
|
|
10
|
-
width: var(--vef-virtual-list-item-width, auto);
|
|
11
|
-
height: var(--vef-virtual-list-item-height, auto);
|
|
12
|
-
transform: translateX(var(--vef-virtual-list-item-x, 0)) translateY(var(--vef-virtual-list-item-y, 0));
|
|
13
|
-
`,X=z`
|
|
14
|
-
position: absolute;
|
|
15
|
-
top: 0;
|
|
16
|
-
left: 0;
|
|
17
|
-
width: 100%;
|
|
18
|
-
transform: translateY(var(--vef-virtual-list-frame-y, 0));
|
|
19
|
-
`;function D({className:S,style:N,items:l,renderItem:b,itemClassName:p,itemStyle:B,itemSize:m,autoItemSize:c=!1,gap:C=0,lanes:V=1,itemKey:g,...r}){const x=v(()=>Y(b),[b]),G=v(()=>{if(E(g))return t=>g({index:t,item:l[t]})},[g,l]),H=v(()=>E(m)?t=>m({index:t,item:l[t]}):()=>m,[m,l]),J=U(C),y=W(null),{orientation:a}=r,s=P({horizontal:a==="horizontal",count:l.length,getScrollElement:()=>y.current,estimateSize:H,overscan:2,getItemKey:G,gap:J,lanes:V}),n=s.getVirtualItems(),h=100/V,I=v(()=>a==="horizontal"?{"--vef-virtual-list-width":`${s.getTotalSize()}px`,"--vef-virtual-list-height":"100%"}:{"--vef-virtual-list-height":`${s.getTotalSize()}px`,"--vef-virtual-list-width":"100%"},[a,s.getTotalSize()]),R=v(()=>c&&a!=="horizontal"?{...M,contain:"strict"}:M,[c,a]),u=(t,T)=>c?i(K,{className:S,height:t,scrollbarSize:"small",style:N,viewportRef:y,viewportStyle:R,width:T,children:i("div",{css:$,style:I,children:a==="horizontal"?n.map(({index:e,key:o,start:f})=>i("div",{className:p,css:j,style:{"--vef-virtual-list-item-top":0,"--vef-virtual-list-item-left":0,"--vef-virtual-list-item-width":"auto","--vef-virtual-list-item-height":"100%","--vef-virtual-list-item-x":`${f}px`,"--vef-virtual-list-item-y":0},children:w(x,{index:e,item:l[e]})},o)):i("div",{css:X,style:{"--vef-virtual-list-frame-y":`${n[0]?.start??0}px`},children:n.map(({index:e,key:o})=>i("div",{ref:s.measureElement,className:p,"data-index":e,style:B,children:w(x,{index:e,item:l[e]})},o))})})}):i(K,{className:S,height:t,scrollbarSize:"small",style:N,viewportRef:y,viewportStyle:R,width:T,children:i("div",{css:$,style:I,children:n.map(({index:e,key:o,size:f,start:k,lane:d})=>i("div",{className:p,css:j,style:a==="horizontal"?{"--vef-virtual-list-item-top":d===0?0:`${d*h}%`,"--vef-virtual-list-item-left":0,"--vef-virtual-list-item-width":`${f}px`,"--vef-virtual-list-item-height":`${h}%`,"--vef-virtual-list-item-x":`${k}px`,"--vef-virtual-list-item-y":0}:{"--vef-virtual-list-item-top":0,"--vef-virtual-list-item-left":d===0?0:`${d*h}%`,"--vef-virtual-list-item-width":`${h}%`,"--vef-virtual-list-item-height":`${f}px`,"--vef-virtual-list-item-x":0,"--vef-virtual-list-item-y":`${k}px`},children:w(x,{index:e,item:l[e]})},o))})});return r.autoSize?r.orientation==="horizontal"?i(F,{disableHeight:!0,children:({width:t})=>u("100%",t)}):i(F,{disableWidth:!0,children:({height:t})=>u(t,"100%")}):r.orientation==="horizontal"?u("100%",r.width):u(r.height,"100%")}const q=Y(D);q.displayName="VefVirtualList";export{q as default};
|
|
2
|
+
import{jsx as i}from"@emotion/react/jsx-runtime";import{css as z}from"@emotion/react";import{useVirtualizer as P}from"@tanstack/react-virtual";import{useNormalizedGapSize as U}from"@vef-framework/hooks";import{isFunction as E}from"@vef-framework/shared";import{useMemo as v,memo as Y,useRef as W,createElement as w}from"react";import F from"../vef-auto-sizer/index.js";import K from"../vef-scroll-area/index.js";const M={willChange:"transform"},$=z({position:"relative",width:"var(--vef-virtual-list-width, auto)",height:"var(--vef-virtual-list-height, auto)"}),j=z({position:"absolute",top:"var(--vef-virtual-list-item-top, 0)",left:"var(--vef-virtual-list-item-left, 0)",width:"var(--vef-virtual-list-item-width, auto)",height:"var(--vef-virtual-list-item-height, auto)",transform:"translateX(var(--vef-virtual-list-item-x, 0)) translateY(var(--vef-virtual-list-item-y, 0))"}),X=z({position:"absolute",top:0,left:0,width:"100%",transform:"translateY(var(--vef-virtual-list-frame-y, 0))"});function D({className:S,style:N,items:l,renderItem:b,itemClassName:p,itemStyle:B,itemSize:m,autoItemSize:c=!1,gap:C=0,lanes:V=1,itemKey:g,...r}){const x=v(()=>Y(b),[b]),G=v(()=>{if(E(g))return t=>g({index:t,item:l[t]})},[g,l]),H=v(()=>E(m)?t=>m({index:t,item:l[t]}):()=>m,[m,l]),J=U(C),y=W(null),{orientation:a}=r,s=P({horizontal:a==="horizontal",count:l.length,getScrollElement:()=>y.current,estimateSize:H,overscan:2,getItemKey:G,gap:J,lanes:V}),n=s.getVirtualItems(),h=100/V,I=v(()=>a==="horizontal"?{"--vef-virtual-list-width":`${s.getTotalSize()}px`,"--vef-virtual-list-height":"100%"}:{"--vef-virtual-list-height":`${s.getTotalSize()}px`,"--vef-virtual-list-width":"100%"},[a,s.getTotalSize()]),R=v(()=>c&&a!=="horizontal"?{...M,contain:"strict"}:M,[c,a]),u=(t,T)=>c?i(K,{className:S,height:t,scrollbarSize:"small",style:N,viewportRef:y,viewportStyle:R,width:T,children:i("div",{css:$,style:I,children:a==="horizontal"?n.map(({index:e,key:o,start:f})=>i("div",{className:p,css:j,style:{"--vef-virtual-list-item-top":0,"--vef-virtual-list-item-left":0,"--vef-virtual-list-item-width":"auto","--vef-virtual-list-item-height":"100%","--vef-virtual-list-item-x":`${f}px`,"--vef-virtual-list-item-y":0},children:w(x,{index:e,item:l[e]})},o)):i("div",{css:X,style:{"--vef-virtual-list-frame-y":`${n[0]?.start??0}px`},children:n.map(({index:e,key:o})=>i("div",{ref:s.measureElement,className:p,"data-index":e,style:B,children:w(x,{index:e,item:l[e]})},o))})})}):i(K,{className:S,height:t,scrollbarSize:"small",style:N,viewportRef:y,viewportStyle:R,width:T,children:i("div",{css:$,style:I,children:n.map(({index:e,key:o,size:f,start:k,lane:d})=>i("div",{className:p,css:j,style:a==="horizontal"?{"--vef-virtual-list-item-top":d===0?0:`${d*h}%`,"--vef-virtual-list-item-left":0,"--vef-virtual-list-item-width":`${f}px`,"--vef-virtual-list-item-height":`${h}%`,"--vef-virtual-list-item-x":`${k}px`,"--vef-virtual-list-item-y":0}:{"--vef-virtual-list-item-top":0,"--vef-virtual-list-item-left":d===0?0:`${d*h}%`,"--vef-virtual-list-item-width":`${h}%`,"--vef-virtual-list-item-height":`${f}px`,"--vef-virtual-list-item-x":0,"--vef-virtual-list-item-y":`${k}px`},children:w(x,{index:e,item:l[e]})},o))})});return r.autoSize?r.orientation==="horizontal"?i(F,{disableHeight:!0,children:({width:t})=>u("100%",t)}):i(F,{disableWidth:!0,children:({height:t})=>u(t,"100%")}):r.orientation==="horizontal"?u("100%",r.width):u(r.height,"100%")}const q=Y(D);q.displayName="VefVirtualList";export{q as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework/components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.131",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Components fundamental to the VEF framework",
|
|
7
7
|
"author": "Venus",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@uiw/codemirror-extensions-langs": "^4.23.10",
|
|
49
49
|
"@uiw/codemirror-theme-material": "^4.23.10",
|
|
50
50
|
"@uiw/react-codemirror": "^4.23.10",
|
|
51
|
-
"@vef-framework/core": "1.0.
|
|
52
|
-
"@vef-framework/hooks": "1.0.
|
|
53
|
-
"@vef-framework/shared": "1.0.
|
|
51
|
+
"@vef-framework/core": "1.0.131",
|
|
52
|
+
"@vef-framework/hooks": "1.0.131",
|
|
53
|
+
"@vef-framework/shared": "1.0.131",
|
|
54
54
|
"@xyflow/react": "^12.4.4",
|
|
55
55
|
"clsx": "2.1.1",
|
|
56
56
|
"codemirror-json-schema": "^0.8.0",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SVGProps } from "react";
|
|
2
|
+
export declare function IconTick(props: React.SVGProps<SVGSVGElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function IconTickCircle(props: React.SVGProps<SVGSVGElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function IconInfoCircle(props: React.SVGProps<SVGSVGElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function IconAlertCircle(props: React.SVGProps<SVGSVGElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function IconAlertTriangle(props: React.SVGProps<SVGSVGElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function IconCheck(props: SVGProps<SVGSVGElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|