@vef-framework/components 1.0.130 → 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-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-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 +5 -5
- 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
|
@@ -14,4 +14,4 @@ import{jsxs as i,Fragment as l,jsx as e}from"@emotion/react/jsx-runtime";import{
|
|
|
14
14
|
padding: ${o.paddingXxs};
|
|
15
15
|
`,y=r`
|
|
16
16
|
font-size: ${o.fontSizeLg};
|
|
17
|
-
`;function C({icon:t,iconColor:n,selected:s,children:
|
|
17
|
+
`;function C({icon:t,iconColor:n,selected:s,children:d}){const m=f(p()).data.node,c=a().get(n);return i(l,{children:[e(h,{}),e(b,{}),e(u,{selected:s}),i("div",{css:x,children:[e("div",{css:$,style:{backgroundColor:c},children:e(g,{children:t})}),e("h3",{css:y,children:m.getLabel()})]}),d]})}export{C as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as r}from"@emotion/react/jsx-runtime";import{css as i}from"@emotion/react";import{themeVariables as o}from"@vef-framework/shared";import{PlusIcon as
|
|
2
|
+
import{jsx as r}from"@emotion/react/jsx-runtime";import{css as i}from"@emotion/react";import{themeVariables as o}from"@vef-framework/shared";import{PlusIcon as c}from"lucide-react";import m from"../../vef-icon/index.js";import s from"../../vef-popover/index.js";import d from"./selector-content.js";const l=i`
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
transform-origin: center;
|
|
5
5
|
background-color: ${o.colorPrimary};
|
|
@@ -10,4 +10,4 @@ import{jsx as r}from"@emotion/react/jsx-runtime";import{css as i}from"@emotion/r
|
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: center;
|
|
12
12
|
justify-content: center;
|
|
13
|
-
`,p={"--vef-popover-inner-content-padding":"6px"};function f({selectorContentPosition:e,items:t,onAddNode:n}){return r(s,{content:r(d,{items:t,onAddNode:n}),contentStyle:p,placement:e,children:r("div",{css:l,children:r(
|
|
13
|
+
`,p={"--vef-popover-inner-content-padding":"6px"};function f({selectorContentPosition:e,items:t,onAddNode:n}){return r(s,{content:r(d,{items:t,onAddNode:n}),contentStyle:p,placement:e,children:r("div",{css:l,children:r(m,{children:r(c,{})})})})}export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as o}from"@emotion/react/jsx-runtime";import{NodeToolbar as i,Position as t}from"@xyflow/react";import{Trash2Icon as e}from"lucide-react";import s from"../../vef-button/index.js";import n from"../../vef-icon/index.js";function
|
|
2
|
+
import{jsx as o}from"@emotion/react/jsx-runtime";import{NodeToolbar as i,Position as t}from"@xyflow/react";import{Trash2Icon as e}from"lucide-react";import s from"../../vef-button/index.js";import n from"../../vef-icon/index.js";function l({selected:r}){return o(i,{align:"end",isVisible:r,offset:4,position:t.Top,children:o(s,{color:"error",size:"small",tip:"删除",variant:"solid",icon:o(n,{children:o(e,{})})})})}export{l as default};
|
package/esm/vef-button/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as l}from"@emotion/react/jsx-runtime";import{useContextDisabled as w}from"@vef-framework/hooks";import{isNullish as
|
|
2
|
+
import{jsx as l}from"@emotion/react/jsx-runtime";import{useContextDisabled as w}from"@vef-framework/hooks";import{isNullish as u,invokeMaybeAsyncFn as k,omit as O}from"@vef-framework/shared";import{forwardRef as v,useState as x,useMemo as y,memo as F}from"react";import"../helpers/index.js";import I from"../vef-popconfirm/index.js";import N from"../vef-tooltip/index.js";import P from"./components/base-button.js";import{defaultMessageTitle as M,showConfirmation as V}from"../helpers/message.js";const j=v(({tip:c,onClick:t,disabled:q=!1,loading:r,...n},s)=>{const[g,e]=x(!1),a=y(()=>{if(n.requireConfirmation){const{onConfirmationOk:o}=n;return u(r)?async()=>{await k(o,{beforeInvoke:()=>{e(!0)},onFinally:()=>{e(!1)}})}:o}},[n.requireConfirmation,n.onConfirmationOk]),T=y(()=>{if(!n.requireConfirmation)return t&&u(r)?async i=>{await k(t,{beforeInvoke:()=>{e(!0)},onFinally:()=>{e(!1)}},i)}:t;const{confirmationMode:o="simple",confirmationTitle:m=M,confirmationContent:f,onConfirmationCancel:h}=n;return o==="simple"?i=>{i.stopPropagation()}:i=>{i.stopPropagation(),V(m,f,a,{onCancel:h})}},[r,t,a,n.requireConfirmation,n.confirmationMode,n.confirmationTitle,n.confirmationContent,n.onConfirmationCancel]),C=w()||q,d=l(P,{ref:s,disabled:C,loading:r??g,onClick:T,...O(n,["requireConfirmation","confirmationMode","confirmationTitle","confirmationContent","onConfirmationOk","onConfirmationCancel"])}),p=c?l(N,{content:c,children:d}):d;if(n.requireConfirmation&&n.confirmationMode==="simple"){const{confirmationTitle:o=M,confirmationContent:m,onConfirmationCancel:f}=n;return l(I,{ref:s,content:m,disabled:C,title:o,onCancel:f,onOk:a,children:p})}return p}),b=F(j);b.displayName="VefButton";export{b as default};
|
|
@@ -1,58 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as c,jsxs as g}from"@emotion/react/jsx-runtime";import{css as k}from"@emotion/react";import{themeVariables as e,isString as
|
|
3
|
-
display: flex;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
|
|
6
|
-
& .recharts-cartesian-axis-tick text {
|
|
7
|
-
fill: ${e.colorTextDescription};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
& .recharts-cartesian-grid line[stroke='#ccc'] {
|
|
11
|
-
stroke: color-mix(in srgb, ${e.colorBorder} 50%, transparent);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
& .recharts-curve.recharts-tooltip-cursor {
|
|
15
|
-
stroke: ${e.colorBorderSecondary};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
& .recharts-dot[stroke='#fff'] {
|
|
19
|
-
stroke: transparent;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
& .recharts-layer {
|
|
23
|
-
outline: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
& .recharts-polar-grid[stroke='#ccc'] {
|
|
27
|
-
stroke: ${e.colorBorderSecondary};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
& .recharts-radial-bar-background-sector {
|
|
31
|
-
fill: ${e.colorFillContent};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
& .recharts-rectangle.recharts-tooltip-cursor {
|
|
35
|
-
fill: ${e.colorFillContent};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
& .recharts-reference-line[stroke='#ccc'] {
|
|
39
|
-
stroke: ${e.colorBorderSecondary};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
& .recharts-sector[stroke='#fff'] {
|
|
43
|
-
stroke: transparent;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
& .recharts-sector {
|
|
47
|
-
outline: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
& .recharts-surface {
|
|
51
|
-
outline: none;
|
|
52
|
-
}
|
|
53
|
-
`;function b({id:s,config:i}){const o=Object.entries(i).map(([r,{color:t}])=>[r,t]).filter(([,r])=>$(r));return o.length?c("style",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
+
import{jsx as c,jsxs as g}from"@emotion/react/jsx-runtime";import{css as k}from"@emotion/react";import{themeVariables as e,isString as x}from"@vef-framework/shared";import{forwardRef as y,useId as C}from"react";import{ResponsiveContainer as b}from"recharts";import{ChartContainerContextProvider as v}from"./hooks/use-chart-container-context.js";const S=k({display:"flex",justifyContent:"center","& .recharts-cartesian-axis-tick text":{fill:e.colorTextDescription},"& .recharts-cartesian-grid line[stroke='#ccc']":{stroke:`color-mix(in srgb, ${e.colorBorder} 50%, transparent)`},"& .recharts-curve.recharts-tooltip-cursor":{stroke:e.colorBorderSecondary},"& .recharts-dot[stroke='#fff']":{stroke:"transparent"},"& .recharts-layer":{outline:"none"},"& .recharts-polar-grid[stroke='#ccc']":{stroke:e.colorBorderSecondary},"& .recharts-radial-bar-background-sector":{fill:e.colorFillContent},"& .recharts-rectangle.recharts-tooltip-cursor":{fill:e.colorFillContent},"& .recharts-reference-line[stroke='#ccc']":{stroke:e.colorBorderSecondary},"& .recharts-sector[stroke='#fff']":{stroke:"transparent"},"& .recharts-sector":{outline:"none"},"& .recharts-surface":{outline:"none"}});function j({id:s,config:i}){const o=Object.entries(i).map(([r,{color:t}])=>[r,t]).filter(([,r])=>x(r));return o.length?c("style",{dangerouslySetInnerHTML:{__html:`
|
|
54
3
|
[data-chart="${s}"] {
|
|
55
4
|
${o.map(([r,t])=>`--vef-color-${r}: ${t};`).join(`
|
|
56
5
|
`)}
|
|
57
6
|
}
|
|
58
|
-
`}}):null}const a=
|
|
7
|
+
`}}):null}const a=y(({id:s,className:i,children:o,config:r,aspect:t=16/9,width:l="100%",height:h,minWidth:d,minHeight:f,...m},p)=>{const u=C(),n=`${s||u.replace(/:/g,"")}-chart`;return c(v,{value:{config:r},children:g("div",{ref:p,className:i,css:S,"data-chart":n,...m,children:[c(j,{config:r,id:n}),c(b,{aspect:t,height:h,minHeight:f,minWidth:d,width:l,children:o})]})})});a.displayName="VefChartContainer";export{a as default};
|
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as s,jsxs as c}from"@emotion/react/jsx-runtime";import{css as o}from"@emotion/react";import{styles as f,themeVariables as r}from"@vef-framework/shared";import{forwardRef as g}from"react";import"../internal/index.js";import{useChartContainerContextSelector as p}from"../vef-chart-container/hooks/use-chart-container-context.js";import{getPayloadConfigFromPayload as u}from"../internal/chart.js";const h=o
|
|
3
|
-
${f.flexCenter}
|
|
4
|
-
gap: ${r.margin};
|
|
5
|
-
padding-top: ${r.marginSm};
|
|
6
|
-
`,C=o`
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
gap: ${r.marginXs};
|
|
10
|
-
color: ${r.colorTextLabel};
|
|
11
|
-
`,y=o`
|
|
12
|
-
flex: none;
|
|
13
|
-
width: 0.75rem;
|
|
14
|
-
height: 0.75rem;
|
|
15
|
-
border-radius: ${r.borderRadiusXs};
|
|
16
|
-
background-color: var(--vef-indicator-color);
|
|
17
|
-
`,a=g(({className:i,payload:t},l)=>{const n=p(e=>e.config);return t?.length?s("div",{ref:l,className:i,css:h,children:t.map(e=>{const d=`${e.dataKey||"value"}`,m=u(e,d,n);return c("div",{css:C,children:[s("div",{css:y,style:{"--vef-indicator-color":e.color}}),m?.label]},e.value)})}):null});a.displayName="VefChartLegendContent";export{a as VefChartLegendContent,a as default};
|
|
2
|
+
import{jsx as s,jsxs as c}from"@emotion/react/jsx-runtime";import{css as o}from"@emotion/react";import{styles as f,themeVariables as r}from"@vef-framework/shared";import{forwardRef as g}from"react";import"../internal/index.js";import{useChartContainerContextSelector as p}from"../vef-chart-container/hooks/use-chart-container-context.js";import{getPayloadConfigFromPayload as u}from"../internal/chart.js";const C=o(f.flexCenter,{gap:r.margin,paddingTop:r.marginSm}),h=o({display:"flex",alignItems:"center",gap:r.marginXs,color:r.colorTextLabel}),y=o({flex:"none",width:"0.75rem",height:"0.75rem",borderRadius:r.borderRadiusXs,backgroundColor:"var(--vef-indicator-color)"}),a=g(({className:l,payload:t},n)=>{const i=p(e=>e.config);return t?.length?s("div",{ref:n,className:l,css:C,children:t.map(e=>{const d=`${e.dataKey||"value"}`,m=u(e,d,i);return c("div",{css:h,children:[s("div",{css:y,style:{"--vef-indicator-color":e.color}}),m?.label]},e.value)})}):null});a.displayName="VefChartLegendContent";export{a as VefChartLegendContent,a as default};
|
|
@@ -1,43 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as
|
|
3
|
-
display: grid;
|
|
4
|
-
min-width: 10rem;
|
|
5
|
-
align-items: start;
|
|
6
|
-
gap: ${r.marginXs};
|
|
7
|
-
border-radius: ${r.borderRadius};
|
|
8
|
-
border: ${r.lineWidth} ${r.lineType} ${r.colorBorderSecondary};
|
|
9
|
-
background: ${r.colorBgContainer};
|
|
10
|
-
padding: ${r.paddingXs} ${r.paddingSm};
|
|
11
|
-
box-shadow: ${r.boxShadowSecondary};
|
|
12
|
-
color: ${r.colorTextLabel}
|
|
13
|
-
`,j=a`
|
|
14
|
-
display: grid;
|
|
15
|
-
gap: ${r.marginXs};
|
|
16
|
-
`,B=a`
|
|
17
|
-
font-weight: 500;
|
|
18
|
-
`,P=a`
|
|
19
|
-
display: flex;
|
|
20
|
-
width: 100%;
|
|
21
|
-
flex-wrap: wrap;
|
|
22
|
-
align-items: center;
|
|
23
|
-
gap: ${r.marginXs};
|
|
24
|
-
`,T=a`
|
|
25
|
-
height: 0.75rem;
|
|
26
|
-
width: 0.75rem;
|
|
27
|
-
flex: none;
|
|
28
|
-
border-radius: ${r.borderRadiusXs};
|
|
29
|
-
border-color: var(--vef-indicator-color);
|
|
30
|
-
background-color: var(--vef-indicator-color);
|
|
31
|
-
`,k=a`
|
|
32
|
-
display: flex;
|
|
33
|
-
flex: 1;
|
|
34
|
-
justify-content: space-between;
|
|
35
|
-
align-items: center;
|
|
36
|
-
gap: ${r.marginXs};
|
|
37
|
-
line-height: 1;
|
|
38
|
-
`,D=a`
|
|
39
|
-
color: ${r.colorTextDescription};
|
|
40
|
-
`,M=a`
|
|
41
|
-
font-weight: 500;
|
|
42
|
-
font-family: ${r.fontFamilyCode};
|
|
43
|
-
`,W=X(({active:v,payload:i,className:y,label:n,labelFormatter:t,labelClassName:g,formatter:p,valueFormatter:f,color:$,hideLabel:u=!1},x)=>{const s=L(e=>e.config),w=K(()=>{if(u||!i?.length)return null;const[e]=i,d=`${e.dataKey||e.name||"value"}`,c=b(e,d,s),o=F(n)?n:c?.label;return o?l("div",{className:g,css:B,children:h(t)?t(o,i):o}):null},[u,i,s,n,g,t]);return!v||!i?.length?null:m("div",{ref:x,className:y,css:R,children:[w,l("div",{css:j,children:i.map((e,d)=>{const c=`${e.name||e.dataKey||"value"}`,o=b(e,c,s),C=$||e.payload.fill||e.color;return l("div",{css:P,children:p&&!N(e?.value)&&e.name?p(e.value,e.name,e,d,e.payload):m(S,{children:[l("div",{css:T,style:{"--vef-indicator-color":C}}),m("div",{css:k,children:[l("span",{css:D,children:o?.label||e.name}),e.value&&l("span",{css:M,children:h(f)?f(e.value):e.value.toLocaleString()})]})]})},e.dataKey)})})]})});export{W as default};
|
|
2
|
+
import{jsx as i,jsxs as m,Fragment as F}from"@emotion/react/jsx-runtime";import{css as a}from"@emotion/react";import{themeVariables as r,isString as $,isFunction as h,isNullish as R}from"@vef-framework/shared";import{forwardRef as X,useMemo as N}from"react";import"../internal/index.js";import{useChartContainerContextSelector as W}from"../vef-chart-container/hooks/use-chart-container-context.js";import{getPayloadConfigFromPayload as v}from"../internal/chart.js";const I=a({display:"grid",minWidth:"10rem",alignItems:"start",gap:r.marginXs,borderRadius:r.borderRadius,border:`${r.lineWidth} ${r.lineType} ${r.colorBorderSecondary}`,background:r.colorBgContainer,padding:`${r.paddingXs} ${r.paddingSm}`,boxShadow:r.boxShadowSecondary,color:r.colorTextLabel}),K=a({display:"grid",gap:r.marginXs}),L=a({fontWeight:500}),j=a({display:"flex",width:"100%",flexWrap:"wrap",alignItems:"center",gap:r.marginXs}),k=a({height:"0.75rem",width:"0.75rem",flex:"none",borderRadius:r.borderRadiusXs,borderColor:"var(--vef-indicator-color)",backgroundColor:"var(--vef-indicator-color)"}),B=a({display:"flex",flex:1,justifyContent:"space-between",alignItems:"center",gap:r.marginXs,lineHeight:1}),P=a({color:r.colorTextDescription}),T=a({fontWeight:500,fontFamily:r.fontFamilyCode}),D=X(({active:b,payload:l,className:y,label:n,labelFormatter:t,labelClassName:g,formatter:p,valueFormatter:f,color:x,hideLabel:u=!1},C)=>{const s=W(e=>e.config),w=N(()=>{if(u||!l?.length)return null;const[e]=l,d=`${e.dataKey||e.name||"value"}`,c=v(e,d,s),o=$(n)?n:c?.label;return o?i("div",{className:g,css:L,children:h(t)?t(o,l):o}):null},[u,l,s,n,g,t]);return!b||!l?.length?null:m("div",{ref:C,className:y,css:I,children:[w,i("div",{css:K,children:l.map((e,d)=>{const c=`${e.name||e.dataKey||"value"}`,o=v(e,c,s),S=x||e.payload.fill||e.color;return i("div",{css:j,children:p&&!R(e?.value)&&e.name?p(e.value,e.name,e,d,e.payload):m(F,{children:[i("div",{css:k,style:{"--vef-indicator-color":S}}),m("div",{css:B,children:[i("span",{css:P,children:o?.label||e.name}),e.value&&i("span",{css:T,children:h(f)?f(e.value):e.value.toLocaleString()})]})]})},e.dataKey)})})]})});export{D as default};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as e}from"@emotion/react/jsx-runtime";import{
|
|
3
|
-
height: ${N.controlHeight}
|
|
4
|
-
`,children:e($,{})});function F({defaultValue:v,value:n,disabled:C,renderCheckboxes:t,onChange:r,...g},x){const{optionsMap:m,normalizedOptions:a,isLoading:s}=z({value:n,onChange:r,...g}),k=w(x,a),V=h(()=>{if(p(r))return o=>{r(o,o.map(d=>m.get(d)))}},[r,m]),y=h(()=>{if(s)return;const o=a.map(d=>{const{value:i,label:u,disabled:c,description:f}=d;return f?e(j,{content:f,children:e(l,{disabled:c,value:i,children:u})},i):e(l,{disabled:c,value:i,children:u},i)});return p(t)?t(o):o},[s,a,t]);return s?E:e(D,{ref:k,defaultValue:v,disabled:C,onChange:V,...n===void 0?{}:{value:n},children:y})}const b=O(R(F));b.displayName="VefCheckbox";export{b as default};
|
|
2
|
+
import{jsx as e}from"@emotion/react/jsx-runtime";import{themeVariables as D,isFunction as p}from"@vef-framework/shared";import{Checkbox as l}from"antd";import{useMemo as h,memo as M,forwardRef as N}from"react";import O from"../vef-loading-placeholder/index.js";import R from"../vef-tooltip/index.js";import{useCheckboxInstance as j}from"./hooks/use-checkbox-instance.js";import{useDataOptions as w}from"./hooks/use-data-options.js";const{Group:z}=l,F=e("div",{css:{height:D.controlHeight},children:e(O,{})});function G({defaultValue:v,value:t,disabled:C,renderCheckboxes:n,onChange:r,...g},x){const{optionsMap:m,normalizedOptions:a,isLoading:s}=w({value:t,onChange:r,...g}),k=j(x,a),V=h(()=>{if(p(r))return o=>{r(o,o.map(d=>m.get(d)))}},[r,m]),y=h(()=>{if(s)return;const o=a.map(d=>{const{value:i,label:u,disabled:c,description:f}=d;return f?e(R,{content:f,children:e(l,{disabled:c,value:i,children:u})},i):e(l,{disabled:c,value:i,children:u},i)});return p(n)?n(o):o},[s,a,n]);return s?F:e(z,{ref:k,defaultValue:v,disabled:C,onChange:V,...t===void 0?{}:{value:t},children:y})}const b=M(N(G));b.displayName="VefCheckbox";export{b as default};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import{css as o}from"@emotion/react";import{themeVariables as e}from"@vef-framework/shared";import r from"../internal/modern-normalize.css.js";const t=o`
|
|
3
3
|
${r}
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
html, body, #root, .vef-app {
|
|
6
6
|
height: 100%;
|
|
7
|
+
overflow: hidden;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
h1,
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as o,jsxs as g}from"@emotion/react/jsx-runtime";import C from"@emotion/cache";import{CacheProvider as y,Global as A,css as v}from"@emotion/react";import{AuthContextProvider as x,ApiContextProvider as P}from"@vef-framework/core";import{ConfigProvider as m,App as l}from"antd";import{useLayoutEffect as k}from"react";import{ErrorBoundary as
|
|
3
|
-
:root {
|
|
4
|
-
font-size: ${(e.fontSize??"medium")==="medium"?"14px":"16px"};
|
|
5
|
-
}
|
|
6
|
-
`]}),o(b,{children:o(D,{FallbackComponent:w,children:c})})]})})})})}export{j as default};
|
|
2
|
+
import{jsx as o,jsxs as g}from"@emotion/react/jsx-runtime";import C from"@emotion/cache";import{CacheProvider as y,Global as A,css as v}from"@emotion/react";import{AuthContextProvider as x,ApiContextProvider as P}from"@vef-framework/core";import{ConfigProvider as m,App as l}from"antd";import{useLayoutEffect as k}from"react";import{ErrorBoundary as S}from"react-error-boundary";import D from"../vef-error/index.js";import{globalStyle as E,nprogressStyle as F}from"./global-style.js";import{useUiConfig as R}from"./hooks/use-ui-config.js";import{useConfigStore as T,ConfigStoreProvider as U}from"./store.js";function b({children:t}){const i=T(e=>e),r=R(i);k(()=>{const{messageFoldThreshold:e,messageDuration:d,notificationFoldThreshold:p,notificationDuration:u,...h}=r;m.config({holderRender:f=>o(m,{...h,children:o(l,{component:"div",message:{maxCount:e,duration:d},notification:{maxCount:p,duration:u,showProgress:!0,pauseOnHover:!0,placement:"topRight",stack:{threshold:3}},children:f})})}),document.documentElement.style.setProperty("--vef-color-primary",r.theme?.token?.colorPrimary??null)},[r]);const{messageFoldThreshold:n,messageDuration:s,notificationDuration:a,...c}=r;return o(m,{...c,children:o(l,{component:"div",message:{maxCount:n,duration:s},notification:{maxCount:n,duration:a,showProgress:!0,pauseOnHover:!0,placement:"topRight",stack:{threshold:3}},children:t})})}function w({error:t,resetErrorBoundary:i}){return o(D,{error:t,reset:i})}const j=C({key:"vef"});function z({apiClient:t,dataDictionaryApi:i,loginApi:r,logoutApi:n,fetchAuthenticatedUserApi:s,permissionChecker:a,children:c,...e}){return o(x,{permissionChecker:a,children:o(P,{client:t,dataDictionaryApi:i,fetchAuthenticatedUserApi:s,loginApi:r,logoutApi:n,children:o(U,{initialState:e,children:g(y,{value:j,children:[o(A,{styles:[E,F,v({":root":{fontSize:(e.fontSize??"medium")==="medium"?"14px":"16px"}})]}),o(b,{children:o(S,{FallbackComponent:w,children:c})})]})})})})}export{z as default};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as e,jsxs as i,Fragment as v}from"@emotion/react/jsx-runtime";import{css as
|
|
3
|
-
height: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-content: space-between;
|
|
6
|
-
align-items: center;
|
|
7
|
-
padding: ${w.padding};
|
|
8
|
-
`;function G({tableApi:g,tableApiParams:m,batchDeletionApi:r,batchActionButtons:s,selectionSummary:c}){const{useApiMutation:y,stubMutationApi:C}=I(),a=y(r??C),[l,d,p]=T(t=>[t.selectedInfo,t.confirmedFilterValues,t.setSelectedInfo]),{selectedKeys:u,selectedRecords:o}=l,x=n(()=>D(r)?s??[]:[...s??[],{key:"_batchDeletion",label:"批量删除",icon:e(H,{children:e(P,{})}),color:"error",permissions:[r.key],requireConfirmation:!0,confirmationMode:"detailed",onClick:async({refetch:t})=>{const{message:F}=await a.mutate(o);R(F),t()}}],[s,r,a,o]),f=N(),A=n(()=>({...f,...l}),[f,l]),M=g.useIsFetching(n(()=>({...m,...d}),[m,d])),k=V(()=>{p({selectedKeys:[],selectedRecords:[]})},[p]),h=n(()=>{if(K(c))return c(o)},[o,c]);return u.length===0?null:i("div",{css:E,children:[i(b,{color:"secondary",children:["已选择"," ",e(b,{bold:!0,color:"primary",children:u.length})," ","项",h&&i(v,{children:[e(z,{orientation:"vertical"}),h]})]}),e(j,{value:M,children:i(B,{align:"center",gap:"medium",children:[e(q,{color:"primary",variant:"text",onClick:k,children:"取消选择"}),e($,{buttons:x,context:A,useFlexContainer:!1})]})})]})}const J=_(G);export{J as default};
|
|
2
|
+
import{jsx as e,jsxs as i,Fragment as v}from"@emotion/react/jsx-runtime";import{css as I}from"@emotion/react";import{useApiContext as S}from"@vef-framework/core";import{DisabledContextProvider as j}from"@vef-framework/hooks";import{themeVariables as w,isNullish as D,isFunction as R}from"@vef-framework/shared";import{Trash2Icon as K}from"lucide-react";import{useMemo as n,useCallback as P,memo as V}from"react";import"../../helpers/index.js";import _ from"../../vef-action-buttons/index.js";import $ from"../../vef-button/index.js";import q from"../../vef-divider/index.js";import z from"../../vef-flex/index.js";import B from"../../vef-icon/index.js";import b from"../../vef-text/index.js";import{useCrudContext as E}from"../hooks/use-crud-context.js";import{useCrudStore as H}from"../store.js";import{showSuccessMessage as N}from"../../helpers/message.js";const T=I({height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",padding:w.padding});function G({tableApi:g,tableApiParams:l,batchDeletionApi:r,batchActionButtons:s,selectionSummary:m}){const{useApiMutation:C,stubMutationApi:y}=S(),a=C(r??y),[c,d,p]=H(t=>[t.selectedInfo,t.confirmedFilterValues,t.setSelectedInfo]),{selectedKeys:u,selectedRecords:o}=c,x=n(()=>D(r)?s??[]:[...s??[],{key:"_batchDeletion",label:"批量删除",icon:e(B,{children:e(K,{})}),color:"error",permissions:[r.key],requireConfirmation:!0,confirmationMode:"detailed",onClick:async({refetch:t})=>{const{message:F}=await a.mutate(o);N(F),t()}}],[s,r,a,o]),f=E(),A=n(()=>({...f,...c}),[f,c]),M=g.useIsFetching(n(()=>({...l,...d}),[l,d])),k=P(()=>{p({selectedKeys:[],selectedRecords:[]})},[p]),h=n(()=>{if(R(m))return m(o)},[o,m]);return u.length===0?null:i("div",{css:T,children:[i(b,{color:"secondary",children:["已选择"," ",e(b,{bold:!0,color:"primary",children:u.length})," ","项",h&&i(v,{children:[e(q,{orientation:"vertical"}),h]})]}),e(j,{value:M,children:i(z,{align:"center",gap:"medium",children:[e($,{color:"primary",variant:"text",onClick:k,children:"取消选择"}),e(_,{buttons:x,context:A,useFlexContainer:!1})]})})]})}const J=V(G);export{J as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as c}from"@emotion/react/jsx-runtime";import{creationFormScene as o}from"@vef-framework/shared";import{PlusIcon as n}from"lucide-react";import{useMemo as
|
|
2
|
+
import{jsx as c}from"@emotion/react/jsx-runtime";import{creationFormScene as o}from"@vef-framework/shared";import{PlusIcon as n}from"lucide-react";import{useMemo as p}from"react";import f from"../../vef-icon/index.js";import{useCrudStore as u}from"../store.js";function l(e){const t=u(r=>r.formApiKeys),m=Reflect.has(t,o),i=Reflect.get(t,o);return p(()=>m?[...e??[],{label:"创建",key:`_${o}`,icon:c(f,{children:c(n,{})}),color:"primary",permissions:[i],onClick:({openForm:r,refetch:s})=>r({scene:o,title:"创建",onSubmitSuccess:()=>{s()}})}]:e??[],[m,e,i])}export{l as useActionButtons};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as
|
|
2
|
+
import{jsx as e}from"@emotion/react/jsx-runtime";import{useApiContext as d}from"@vef-framework/core";import{updateFormScene as u}from"@vef-framework/shared";import{PencilIcon as h,TrashIcon as y}from"lucide-react";import{useMemo as C}from"react";import"../../helpers/index.js";import p from"../../vef-icon/index.js";import{useCrudStore as M}from"../store.js";import{showSuccessMessage as S}from"../../helpers/message.js";function b(r,n){const{useApiMutation:a,stubMutationApi:l}=d(),c=a(r??l),f=M(o=>o.formApiKeys),m=Reflect.has(f,u);return C(()=>{const o=[...n??[]];return m&&o.push({key:"_update",label:"编辑",icon:e(p,{children:e(h,{})}),color:"primary",onClick:({record:t,openForm:i,refetch:s})=>{i({scene:u,title:"编辑",initialValues:t,onSubmitSuccess:()=>{s()}})}}),r&&o.push({key:"_deletion",label:"删除",icon:e(p,{children:e(y,{})}),color:"error",requireConfirmation:!0,confirmationMode:"simple",onClick:async({record:t,refetch:i})=>{const{message:s}=await c.mutate(t);S(s),i()}}),o},[r,c,n,m])}export{b as useOperationButtons};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{createComponentStore as C,creationFormScene as K,isNullish as B,isFunction as t,mergeFns as L,
|
|
2
|
+
import{createComponentStore as C,creationFormScene as K,isNullish as B,isFunction as t,mergeFns as L,invokeMaybeAsyncFn as H}from"@vef-framework/shared";import"../helpers/index.js";import{showSuccessMessage as E,showSuccessAlert as T}from"../helpers/message.js";const{StoreProvider:D,useStore:M,useStoreApi:P}=C("Crud",({filterValueAsDefaultKeys:u,formApiKeys:f,onFormOpen:p,onBeforeSubmit:V,onSubmitSuccess:b})=>(s,I)=>({onFormOpen:p,onBeforeSubmit:V,onSubmitSuccess:b,currentFormInfo:{scene:K,title:"创建",width:"medium"},currentFormEventHandlers:{},currentFormInitialValues:{},isFormOpen:!1,openForm:async({initialValues:r,width:g,onBeforeSubmit:c,onSubmitSuccess:l,showSuccessTip:y=!0,successTipType:w="message",...m})=>{const{filterValues:a,onFormOpen:i,closeForm:A,onBeforeSubmit:F,onSubmitSuccess:d,setIsFormLoading:h}=I(),S={...u.reduce((e,o)=>{const n=a[o];return B(n)||(e[o]=n),e},{}),...r},v=t(c)||t(F)?async(e,o)=>{const n=await c?.(e,o);return await F?.(n??e,o)??n}:void 0,O=t(l)||t(d)?L(({message:e})=>{y&&(w==="message"?E(e):T(e)),A()},l,d):void 0;s({isFormOpen:!0,currentFormInfo:{...m,width:g??"medium"},currentFormEventHandlers:{onBeforeSubmit:v,onSubmitSuccess:O},isFormLoading:!!i}),i?await H(i,{onSuccess:e=>{s({currentFormInitialValues:e})},onFinally:()=>{h(!1)}},S,a,m.scene):s({currentFormInitialValues:S})},closeForm:()=>{s({isFormOpen:!1,currentFormInitialValues:{},currentFormEventHandlers:{}})},isFormLoading:!1,setIsFormLoading:r=>{s({isFormLoading:r})},filterValueAsDefaultKeys:u,filterValues:{},setFilterValues:r=>{s({filterValues:r})},confirmedFilterValues:null,setConfirmedFilterValues:r=>{s({confirmedFilterValues:r})},selectedInfo:{selectedKeys:[],selectedRecords:[]},setSelectedInfo:r=>{s({selectedInfo:r})},formApiKeys:f,tableInstanceRef:{current:null}}));export{D as CrudStoreProvider,M as useCrudStore,P as useCrudStoreApi};
|
package/esm/vef-drawer/index.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as r,jsxs as N,Fragment as Y}from"@emotion/react/jsx-runtime";import{css as Z}from"@emotion/react";import{themeVariables as G,isFunction as x}from"@vef-framework/shared";import{Drawer as H}from"antd";import{useMemo as y,useState as B,useLayoutEffect as J,useCallback as D,memo as K}from"react";import Q from"./components/cancel-action-button.js";import R from"./components/ok-action-button.js";import{DrawerContextProvider as U}from"./context.js";import{default as de}from"./components/action-button-wrapper.js";const X=Z
|
|
3
|
-
.vef-drawer-footer {
|
|
4
|
-
display: flex;
|
|
5
|
-
gap: ${G.padding};
|
|
6
|
-
justify-content: flex-end;
|
|
7
|
-
align-items: center;
|
|
8
|
-
}
|
|
9
|
-
`,i={narrow:"25",half:"50",wide:"75",full:"100"};function _({title:A,open:a,closable:j=!0,closeOnEscPress:v=!0,closeOnMaskClick:E=!1,destroyOnClose:S=!1,placement:s="right",expansionSize:e,extra:I,showCancelButton:h=!0,cancelButtonText:g="取消",okButtonText:w="提交",actions:l,loading:c,cancelOnClose:O=!0,onClose:k,onCancel:n,onOk:F,onAfterOpen:d,onAfterClose:f,children:L}){const M=y(()=>e==="small"?{size:"default"}:e==="medium"?{size:"large"}:s==="left"||s==="right"?{width:i[e]?`${i[e]}vw`:e}:{height:i[e]?`${i[e]}vh`:e},[e,s]),[m,u]=B({isFullyOpened:!1,isFullyClosed:!1}),[p,P]=B(!1),T=y(()=>({isDisabled:p,setIsDisabled:P,...m}),[p,m]),b=c||p;J(()=>{a&&m.isFullyClosed&&u(o=>({...o,isFullyClosed:!1}))},[a]);const V=y(()=>{const o=r(Q,{text:g,onClick:n},"cancelActionButton"),t=r(R,{text:w,onClick:F},"okActionButton");return x(l)?l([o,t]):l||(h?N(Y,{children:[o,t]}):t)},[l,g,w,n,F,h]),W=D(()=>{b||(O&&n?.(),k?.())},[O,b,n,k]),$=D(o=>{const t=x(d),q=x(f);o?(t&&d(),u(C=>({...C,isFullyOpened:!0}))):(q&&f(),u(C=>({...C,isFullyClosed:!0})))},[d,f]);return r(U,{value:T,children:r(H,{afterOpenChange:$,closable:j,css:X,destroyOnClose:S,extra:I,footer:!c&&V,keyboard:v,loading:c,maskClosable:E,open:a,placement:s,title:A,zIndex:20,onClose:W,...M,children:L})})}const z=K(_);z.displayName="VefDrawer";export{de as VefDrawerActionButtonWrapper,z as default};
|
|
2
|
+
import{jsx as r,jsxs as N,Fragment as Y}from"@emotion/react/jsx-runtime";import{css as Z}from"@emotion/react";import{themeVariables as G,isFunction as x}from"@vef-framework/shared";import{Drawer as H}from"antd";import{useMemo as y,useState as B,useLayoutEffect as J,useCallback as D,memo as K}from"react";import Q from"./components/cancel-action-button.js";import R from"./components/ok-action-button.js";import{DrawerContextProvider as U}from"./context.js";import{default as de}from"./components/action-button-wrapper.js";const X=Z({".vef-drawer-footer":{display:"flex",gap:G.padding,justifyContent:"flex-end",alignItems:"center"}}),i={narrow:"25",half:"50",wide:"75",full:"100"};function _({title:A,open:a,closable:j=!0,closeOnEscPress:v=!0,closeOnMaskClick:E=!1,destroyOnClose:I=!1,placement:l="right",expansionSize:e,extra:L,showCancelButton:h=!0,cancelButtonText:g="取消",okButtonText:w="提交",actions:s,loading:c,cancelOnClose:O=!0,onClose:k,onCancel:n,onOk:F,onAfterOpen:d,onAfterClose:f,children:M}){const P=y(()=>e==="small"?{size:"default"}:e==="medium"?{size:"large"}:l==="left"||l==="right"?{width:i[e]?`${i[e]}vw`:e}:{height:i[e]?`${i[e]}vh`:e},[e,l]),[m,u]=B({isFullyOpened:!1,isFullyClosed:!1}),[p,S]=B(!1),T=y(()=>({isDisabled:p,setIsDisabled:S,...m}),[p,m]),b=c||p;J(()=>{a&&m.isFullyClosed&&u(o=>({...o,isFullyClosed:!1}))},[a]);const V=y(()=>{const o=r(Q,{text:g,onClick:n},"cancelActionButton"),t=r(R,{text:w,onClick:F},"okActionButton");return x(s)?s([o,t]):s||(h?N(Y,{children:[o,t]}):t)},[s,g,w,n,F,h]),W=D(()=>{b||(O&&n?.(),k?.())},[O,b,n,k]),$=D(o=>{const t=x(d),q=x(f);o?(t&&d(),u(C=>({...C,isFullyOpened:!0}))):(q&&f(),u(C=>({...C,isFullyClosed:!0})))},[d,f]);return r(U,{value:T,children:r(H,{afterOpenChange:$,closable:j,css:X,destroyOnClose:I,extra:L,footer:!c&&V,keyboard:v,loading:c,maskClosable:E,open:a,placement:l,title:A,zIndex:20,onClose:W,...P,children:M})})}const z=K(_);z.displayName="VefDrawer";export{de as VefDrawerActionButtonWrapper,z as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as r}from"@emotion/react/jsx-runtime";import{useThemeTokens as a}from"@vef-framework/hooks";import l from"lucide-react/dynamicIconImports";import{forwardRef as c,lazy as f,Suspense as h}from"react";import
|
|
2
|
+
import{jsx as r}from"@emotion/react/jsx-runtime";import{useThemeTokens as a}from"@vef-framework/hooks";import l from"lucide-react/dynamicIconImports";import{forwardRef as c,lazy as f,Suspense as h}from"react";import p from"../vef-icon/index.js";function d(){const{colorFillContent:e}=a();return r("svg",{"aria-label":"Loading icon",height:"1em",role:"img",viewBox:"0 0 100 100",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:r("rect",{fill:e,height:"100",rx:"20",width:"100"})})}const w=r(d,{}),t=new Map,i=c(({name:e,...o},n)=>{if(!t.has(e)){const s=f(l[e]);t.set(e,s)}const m=t.get(e);return r(p,{ref:n,...o,children:r(h,{fallback:w,children:r(m,{})})})});i.displayName="VefDynamicIcon";export{i as default};
|
package/esm/vef-error/index.js
CHANGED
|
@@ -1,29 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as r,jsxs as o,Fragment as c}from"@emotion/react/jsx-runtime";import{css as t}from"@emotion/react";import{styles as l,themeVariables as e}from"@vef-framework/shared";import{RefreshCwIcon as m}from"lucide-react";import
|
|
3
|
-
height: 100%;
|
|
4
|
-
${l.flexCenter}
|
|
5
|
-
`,h=t`
|
|
6
|
-
width: 40%;
|
|
7
|
-
position: relative;
|
|
8
|
-
top: -60px;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
row-gap: ${e.margin};
|
|
14
|
-
|
|
15
|
-
> svg {
|
|
16
|
-
width: 70%;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
> span {
|
|
20
|
-
font-size: ${e.fontSizeLg};
|
|
21
|
-
font-weight: 500;
|
|
22
|
-
color: ${e.colorTextTertiary};
|
|
23
|
-
|
|
24
|
-
> span {
|
|
25
|
-
padding-left: ${e.paddingSm};
|
|
26
|
-
color: ${e.colorErrorText};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`;function g({error:n,reset:s,componentStack:i}){return r("div",{css:f,children:o("div",{css:h,children:[r(d,{}),o("span",{children:["发生错误:",r("span",{children:n.message}),i&&o(c,{children:["组件堆栈:",r("span",{children:i})]})]}),r(a,{color:"primary",size:"large",icon:r(p,{children:r(m,{})}),onClick:s,children:"重试一下"})]})})}export{g as default};
|
|
2
|
+
import{jsx as r,jsxs as o,Fragment as c}from"@emotion/react/jsx-runtime";import{css as t}from"@emotion/react";import{styles as l,themeVariables as e}from"@vef-framework/shared";import{RefreshCwIcon as m}from"lucide-react";import p from"../vef-button/index.js";import a from"../vef-icon/index.js";import d from"./error-icon.js";const f=t(l.flexCenter,{height:"100%"}),h=t({width:"40%",position:"relative",top:"-60px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",rowGap:e.margin,"> svg":{width:"70%"},"> span":{fontSize:e.fontSizeLg,fontWeight:500,color:e.colorTextTertiary,"> span":{paddingLeft:e.paddingSm,color:e.colorErrorText}}});function g({error:n,reset:s,componentStack:i}){return r("div",{css:f,children:o("div",{css:h,children:[r(d,{}),o("span",{children:["发生错误:",r("span",{children:n.message}),i&&o(c,{children:["组件堆栈:",r("span",{children:i})]})]}),r(p,{color:"primary",size:"large",icon:r(a,{children:r(m,{})}),onClick:s,children:"重试一下"})]})})}export{g as default};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as i,jsxs as r}from"@emotion/react/jsx-runtime";import{css as k}from"@emotion/react";import{useThemeTokens as B}from"@vef-framework/hooks";import{themeVariables as a,omit as m}from"@vef-framework/shared";import{SearchIcon as C,ChevronDownIcon as
|
|
3
|
-
&.vef-btn {
|
|
4
|
-
--vef-button-padding-inline: 0;
|
|
5
|
-
|
|
6
|
-
gap: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.vef-collapse-button-text {
|
|
10
|
-
position: relative;
|
|
11
|
-
width: calc(${a.fontSize} * 2 + 4px);
|
|
12
|
-
height: calc(${a.controlHeight} - 4px);
|
|
13
|
-
text-align: center;
|
|
14
|
-
line-height: calc(${a.controlHeight} - 4px);
|
|
15
|
-
|
|
16
|
-
> span {
|
|
17
|
-
position: absolute;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`,A={text:"搜索",icon:i(p,{children:i(C,{})})},H={text:"重置"};function I(){const[d,e,h]=V(t=>[t.isLoading,t.isAdvancedFilterVisible,t.setIsAdvancedFilterVisible]),[f,u,x,g,b,v]=S(t=>[t.externalLoading,t.confirmationButton,t.resetButton,t.showCollapseButton,t.handleReset,t.extraActionButtons]),{controlHeight:y}=B(),s=(y-4)/2,o=u??A,n=x??H;return r(F,{align:"center",gap:"medium",children:[g&&r(c,{color:"primary",css:$,variant:"link",onClick:()=>h(!e),children:[r("span",{className:"vef-collapse-button-text",children:[i(l.span,{initial:!1,animate:{opacity:e?1:0,y:e?0:-s},children:"收起"}),i(l.span,{initial:!1,animate:{opacity:e?0:1,y:e?s:0},children:"展开"})]}),i(l.span,{initial:!1,animate:{rotate:e?-180:0,transition:{bounce:0}},children:i(p,{size:"large",children:i(w,{})})})]}),n&&i(c,{color:"default",variant:"filled",onClick:b,...m(n,["text"]),children:n.text}),o&&i(c,{color:"primary",icon:o.icon,loading:f||d,type:"submit",...m(o,["text"]),children:o.text}),v]})}export{I as default};
|
|
2
|
+
import{jsx as i,jsxs as r}from"@emotion/react/jsx-runtime";import{css as k}from"@emotion/react";import{useThemeTokens as B}from"@vef-framework/hooks";import{themeVariables as a,omit as m}from"@vef-framework/shared";import{SearchIcon as C,ChevronDownIcon as H}from"lucide-react";import{motion as l}from"motion/react";import c from"../../vef-button/index.js";import w from"../../vef-flex/index.js";import p from"../../vef-icon/index.js";import{useFilterContextSelector as A}from"../hooks/use-filter-context.js";import{useFilterStore as F}from"../store.js";const S=k({"&.vef-btn":{"--vef-button-padding-inline":"0",gap:0},".vef-collapse-button-text":{position:"relative",width:`calc(${a.fontSize} * 2 + 4px)`,height:`calc(${a.controlHeight} - 4px)`,textAlign:"center",lineHeight:`calc(${a.controlHeight} - 4px)`,"> span":{position:"absolute"}}}),V={text:"搜索",icon:i(p,{children:i(C,{})})},$={text:"重置"};function I(){const[d,e,h]=F(t=>[t.isLoading,t.isAdvancedFilterVisible,t.setIsAdvancedFilterVisible]),[f,u,x,g,b,v]=A(t=>[t.externalLoading,t.confirmationButton,t.resetButton,t.showCollapseButton,t.handleReset,t.extraActionButtons]),{controlHeight:y}=B(),s=(y-4)/2,o=u??V,n=x??$;return r(w,{align:"center",gap:"medium",children:[g&&r(c,{color:"primary",css:S,variant:"link",onClick:()=>h(!e),children:[r("span",{className:"vef-collapse-button-text",children:[i(l.span,{initial:!1,animate:{opacity:e?1:0,y:e?0:-s},children:"收起"}),i(l.span,{initial:!1,animate:{opacity:e?0:1,y:e?s:0},children:"展开"})]}),i(l.span,{initial:!1,animate:{rotate:e?-180:0,transition:{bounce:0}},children:i(p,{size:"large",children:i(H,{})})})]}),n&&i(c,{color:"default",variant:"filled",onClick:b,...m(n,["text"]),children:n.text}),o&&i(c,{color:"primary",icon:o.icon,loading:f||d,type:"submit",...m(o,["text"]),children:o.text}),v]})}export{I as default};
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as r}from"@emotion/react/jsx-runtime";import{css as t}from"@emotion/react";import{themeVariables as o}from"@vef-framework/shared";import{motion as h}from"motion/react";import u from"../../vef-responsive-container/index.js";import g from"../../vef-responsive-item/index.js";import{useFilterContextSelector as
|
|
3
|
-
overflow: hidden;
|
|
4
|
-
`,C=t`
|
|
5
|
-
margin-top: ${o.margin};
|
|
6
|
-
background-color: ${o.colorFillAlt};
|
|
7
|
-
padding: ${o.padding};
|
|
8
|
-
border-radius: ${o.borderRadiusLg};
|
|
9
|
-
border: ${o.lineWidth} ${o.lineType} ${o.colorBorderSecondary};
|
|
10
|
-
`,W={opacity:1,height:"auto",transition:{ease:"easeInOut",duration:.2}},l={opacity:0,height:0};function v({items:n}){const[e,m,s]=$(i=>[i.labelPosition,i.labelAlign,i.labelWidth]),{labelWidthToUse:d,labelCol:p}=y(e,s),c=e==="top"?a:a+(d??80);return r(h.div,{animate:W,css:A,exit:l,initial:l,children:r(u,{baseItemWidth:c,css:C,gap:"large",children:n.map(i=>{const{name:b,span:f}=i;return r(g,{span:f??1,children:r(x,{item:i,labelAlign:m,labelCol:p,layout:e==="top"?"vertical":"horizontal"})},b)})})})}export{v as default};
|
|
2
|
+
import{jsx as r}from"@emotion/react/jsx-runtime";import{css as t}from"@emotion/react";import{themeVariables as o}from"@vef-framework/shared";import{motion as h}from"motion/react";import u from"../../vef-responsive-container/index.js";import g from"../../vef-responsive-item/index.js";import{useFilterContextSelector as C}from"../hooks/use-filter-context.js";import{useLabelConfig as y}from"../hooks/use-label-config.js";import x from"./filter-item.js";const a=200,A=t({overflow:"hidden"}),W=t({marginTop:o.margin,backgroundColor:o.colorFillAlt,padding:o.padding,borderRadius:o.borderRadiusLg,border:`${o.lineWidth} ${o.lineType} ${o.colorBorderSecondary}`}),v={opacity:1,height:"auto",transition:{ease:"easeInOut",duration:.2}},l={opacity:0,height:0};function F({items:n}){const[e,m,s]=C(i=>[i.labelPosition,i.labelAlign,i.labelWidth]),{labelWidthToUse:d,labelCol:p}=y(e,s),c=e==="top"?a:a+(d??80);return r(h.div,{animate:v,css:A,exit:l,initial:l,children:r(u,{baseItemWidth:c,css:W,gap:"large",children:n.map(i=>{const{name:b,span:f}=i;return r(g,{span:f??1,children:r(x,{item:i,labelAlign:m,labelCol:p,layout:e==="top"?"vertical":"horizontal"})},b)})})})}export{F as default};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as s,Fragment as c,jsx as i}from"@emotion/react/jsx-runtime";import{css as o}from"@emotion/react";import{themeVariables as m}from"@vef-framework/shared";import{Form as l}from"antd";import p from"clsx";import d from"./action-buttons.js";import v from"./filter-item.js";const x=o
|
|
3
|
-
&.vef-filter-basic-items-with-prefix {
|
|
4
|
-
display: grid;
|
|
5
|
-
grid-template-columns: max-content 1fr;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: ${m.margin};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.vef-filter-basic-items-prefix {
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
&.vef-filter-basic-items-content, .vef-filter-basic-items-content {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-wrap: wrap;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: flex-end;
|
|
18
|
-
gap: ${m.margin};
|
|
19
|
-
}
|
|
20
|
-
`;function b({items:f,prefix:e}){const n=p({"vef-filter-basic-items-with-prefix":!!e,"vef-filter-basic-items-content":!e}),t=s(c,{children:[f.map(r=>{const{name:a}=r;return i(v,{item:r},a)}),i(l.Item,{children:i(d,{})})]});return s("div",{className:n,css:x,children:[e&&i("div",{className:"vef-filter-basic-items-prefix",children:e}),e?i("div",{className:"vef-filter-basic-items-content",children:t}):t]})}export{b as default};
|
|
2
|
+
import{jsxs as s,Fragment as c,jsx as i}from"@emotion/react/jsx-runtime";import{css as o}from"@emotion/react";import{themeVariables as m}from"@vef-framework/shared";import{Form as l}from"antd";import p from"clsx";import d from"./action-buttons.js";import v from"./filter-item.js";const x=o({"&.vef-filter-basic-items-with-prefix":{display:"grid",gridTemplateColumns:"max-content 1fr",alignItems:"center",gap:m.margin},".vef-filter-basic-items-prefix":{},"&.vef-filter-basic-items-content, .vef-filter-basic-items-content":{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end",gap:m.margin}});function b({items:f,prefix:e}){const n=p({"vef-filter-basic-items-with-prefix":!!e,"vef-filter-basic-items-content":!e}),t=s(c,{children:[f.map(r=>{const{name:a}=r;return i(v,{item:r},a)}),i(l.Item,{children:i(d,{})})]});return s("div",{className:n,css:x,children:[e&&i("div",{className:"vef-filter-basic-items-prefix",children:e}),e?i("div",{className:"vef-filter-basic-items-content",children:t}):t]})}export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{isFunction as d,omit as F
|
|
2
|
+
import{isFunction as d,omit as F}from"@vef-framework/shared";import{useCallback as h,useMemo as R}from"react";import"../../helpers/index.js";import{useFilterStore as b}from"../store.js";import{showWarningMessage as w}from"../../helpers/message.js";function S({onBeforeConfirm:r,onConfirm:o,onReset:a}){const[l,t,m,u,f,c,s]=b(e=>[e.form,e.eventBus,e.getValues,e.initialValues,e.invokeValueChangeHandlers,e.virtualFieldNames,e.setIsLoading]),p=h(()=>{const e=m();l.resetFields(),f(),t.emitChange(u),a?.(e)},[t,l,m,u,f,a]),g=R(()=>{if(d(o))return async e=>{s(!0);let i=e;try{d(r)&&(i=await r(i));const n=F(i,c);await o(n),t.emitSubmitResult(!0)}catch(n){throw t.emitSubmitResult(!1),n}finally{s(!1)}}},[r,o,t,s,c]),C=h(({errorFields:e})=>{t.emitSubmitResult(!1),e.length>0&&w(e.flatMap(i=>i.errors).join(", "))},[t]);return{handleReset:p,handleConfirm:g,handleConfirmFailed:C}}export{S as useActionHandlers};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{
|
|
2
|
+
import{useMemo as i}from"react";import"../../helpers/index.js";import{showWarningMessage as r}from"../../helpers/message.js";function n(o,e){const t=i(()=>{if(!(o==="top"||!e))return(e<60||e>120)&&r("The labelWidth of VefFilter component must be between 60 and 120, otherwise it will be 60 or 120."),Math.min(Math.max(e,60),120)},[o,e]);return{labelCol:i(()=>{if(t)return{flex:`0 0 ${t}px`}},[t]),labelWidthToUse:t}}export{n as useLabelConfig};
|
package/esm/vef-filter/index.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as t,jsxs as
|
|
3
|
-
display: block;
|
|
4
|
-
flex-wrap: unset;
|
|
5
|
-
|
|
6
|
-
.vef-form-item {
|
|
7
|
-
margin-inline-end: 0;
|
|
8
|
-
}
|
|
9
|
-
`;function ae({schema:o,labelPosition:e="top",labelAlign:n="right",labelWidth:r,disabled:a=!1,loading:i=!1,size:l,variant:s,prefix:m,confirmationButton:u,resetButton:p,extraActionButtons:h,onBeforeConfirm:x,onConfirm:A,onReset:I,onChange:P},R){const[S,w,z,N]=ie(f=>[f.form,f.initialValues,f.isLoading,f.isAdvancedFilterVisible]),{handleReset:c,handleConfirm:y,handleConfirmFailed:D}=Q({onBeforeConfirm:x,onConfirm:A,onReset:I}),{basicItems:j,advancedItems:d}=_(o),H=C(()=>({labelPosition:e,labelAlign:n,labelWidth:r,confirmationButton:u,externalLoading:i,showCollapseButton:d.length>0,handleReset:c,resetButton:p,extraActionButtons:h}),[d.length,u,h,c,n,e,r,i,p]),{handleValuesChange:L}=ee(P);Z(R,c);const F=W()||a||i||z;return t(v,{colon:!1,css:re,disabled:F,form:S,initialValues:w,layout:"inline",size:oe(l),variant:s,onFinish:y,onFinishFailed:D,onValuesChange:L,children:t(k,{value:F,children:E(X,{value:H,children:[t(J,{items:j,prefix:m}),t(T,{children:N&&d.length>0&&t(G,{items:d})})]})})})}const B=b(ae);B.displayName="VefFilterBase";function le({initialValues:o,...e},n){const{schema:r}=e,[a]=ne(),i=q(()=>new K);M(()=>{i.clear()});const{mergedInitialValues:l,valueChangeHandlers:s,virtualFieldNames:m}=Y(r,o),u=C(()=>({eventBus:i,form:a,initialValues:l,valueChangeHandlers:s,virtualFieldNames:m}),[i,a,l,s,m]);return t(te,{initialState:u,children:t(B,{ref:n,...e})})}const V=$(b(le),(o,e)=>O(g(o,["initialValues","schema"]),g(e,["initialValues","schema"])));V.displayName="VefFilter";export{V as default};
|
|
2
|
+
import{jsx as t,jsxs as L}from"@emotion/react/jsx-runtime";import{css as W}from"@emotion/react";import{useContextDisabled as U,DisabledContextProvider as $,useSingleton as k,useUnmount as q}from"@vef-framework/hooks";import{isDeepEqual as M,omit as g}from"@vef-framework/shared";import{Form as v}from"antd";import{AnimatePresence as O}from"motion/react";import{useMemo as C,forwardRef as b,memo as T}from"react";import"../internal/index.js";import G from"./components/advanced-filter.js";import J from"./components/basic-filter.js";import{FilterEventBus as K}from"./event.js";import{useActionHandlers as Q}from"./hooks/use-action-handlers.js";import{FilterContextProvider as X}from"./hooks/use-filter-context.js";import{useFilterInitialization as Y}from"./hooks/use-filter-initialization.js";import{useFilterInstance as Z}from"./hooks/use-filter-instance.js";import{useFilterItems as _}from"./hooks/use-filter-items.js";import{useFilterValuesChange as ee}from"./hooks/use-filter-values-change.js";import{useFilterStore as ie,FilterStoreProvider as te}from"./store.js";import{convertBasicSizeToUiSize as oe}from"../internal/utils.js";const{useForm:ne}=v,re=W({display:"block",flexWrap:"unset",".vef-form-item":{marginInlineEnd:0}});function ae({schema:o,labelPosition:e="top",labelAlign:n="right",labelWidth:r,disabled:a=!1,loading:i=!1,size:l,variant:s,prefix:m,confirmationButton:u,resetButton:p,extraActionButtons:h,onBeforeConfirm:V,onConfirm:A,onReset:I,onChange:P},R){const[S,z,N,w]=ie(f=>[f.form,f.initialValues,f.isLoading,f.isAdvancedFilterVisible]),{handleReset:c,handleConfirm:y,handleConfirmFailed:D}=Q({onBeforeConfirm:V,onConfirm:A,onReset:I}),{basicItems:j,advancedItems:d}=_(o),E=C(()=>({labelPosition:e,labelAlign:n,labelWidth:r,confirmationButton:u,externalLoading:i,showCollapseButton:d.length>0,handleReset:c,resetButton:p,extraActionButtons:h}),[d.length,u,h,c,n,e,r,i,p]),{handleValuesChange:H}=ee(P);Z(R,c);const F=U()||a||i||N;return t(v,{colon:!1,css:re,disabled:F,form:S,initialValues:z,layout:"inline",size:oe(l),variant:s,onFinish:y,onFinishFailed:D,onValuesChange:H,children:t($,{value:F,children:L(X,{value:E,children:[t(J,{items:j,prefix:m}),t(O,{children:w&&d.length>0&&t(G,{items:d})})]})})})}const B=b(ae);B.displayName="VefFilterBase";function le({initialValues:o,...e},n){const{schema:r}=e,[a]=ne(),i=k(()=>new K);q(()=>{i.clear()});const{mergedInitialValues:l,valueChangeHandlers:s,virtualFieldNames:m}=Y(r,o),u=C(()=>({eventBus:i,form:a,initialValues:l,valueChangeHandlers:s,virtualFieldNames:m}),[i,a,l,s,m]);return t(te,{initialState:u,children:t(B,{ref:n,...e})})}const x=T(b(le),(o,e)=>M(g(o,["initialValues","schema"]),g(e,["initialValues","schema"])));x.displayName="VefFilter";export{x as default};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as i,jsxs as a}from"@emotion/react/jsx-runtime";import{CheckOutlined as d}from"@ant-design/icons";import{css as p}from"@emotion/react";import{themeVariables as f,omit as e}from"@vef-framework/shared";import{Form as u}from"antd";import{memo as x}from"react";import m from"../../vef-button/index.js";import h from"../../vef-flex/index.js";import{useFormStore as g}from"../store.js";const{Item:y}=u,b={text:"提交",icon:i(d,{})},j={text:"重置"},B=p
|
|
3
|
-
padding: ${f.padding} 0;
|
|
4
|
-
`;function F({submissionButton:t=b,resetButton:o=j,handleReset:n}){const[c,l]=g(r=>[r.isLoading,r.showActionButtons]);return!l||!t&&!o?null:i(y,{children:a(h,{css:B,gap:"medium",justify:"flex-end",children:[o&&i(m,{color:"default",variant:"filled",onClick:n,...e(o,["text"]),children:o.text}),t&&i(m,{color:"primary",loading:c,type:"submit",...e(t,["text"]),children:t.text})]})})}const s=x(F);s.displayName="VefFormActions";export{s as default};
|
|
2
|
+
import{jsx as i,jsxs as a}from"@emotion/react/jsx-runtime";import{CheckOutlined as d}from"@ant-design/icons";import{css as p}from"@emotion/react";import{themeVariables as f,omit as e}from"@vef-framework/shared";import{Form as u}from"antd";import{memo as x}from"react";import m from"../../vef-button/index.js";import h from"../../vef-flex/index.js";import{useFormStore as g}from"../store.js";const{Item:y}=u,b={text:"提交",icon:i(d,{})},j={text:"重置"},B=p({padding:f.padding});function F({submissionButton:t=b,resetButton:o=j,handleReset:n}){const[c,l]=g(r=>[r.isLoading,r.showActionButtons]);return!l||!t&&!o?null:i(y,{children:a(h,{css:B,gap:"medium",justify:"flex-end",children:[o&&i(m,{color:"default",variant:"filled",onClick:n,...e(o,["text"]),children:o.text}),t&&i(m,{color:"primary",loading:c,type:"submit",...e(t,["text"]),children:t.text})]})})}const s=x(F);s.displayName="VefFormActions";export{s as default};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as o,jsxs as V,Fragment as C}from"@emotion/react/jsx-runtime";import{css as S}from"@emotion/react";import{debounce as x,styles as j,isDeepEqual as B,omit as $}from"@vef-framework/shared";import{useMemo as y,useRef as F,useState as I,useCallback as R,useEffect as E,memo as
|
|
3
|
-
flex: auto;
|
|
4
|
-
min-height: 0;
|
|
5
|
-
`;function H({schema:i,showTabs:s,height:c}){const r=q([...i.map(({key:e,title:t})=>({key:`title-${e}`,rawValue:t})),...i.map(({key:e,show:t})=>({key:`show-${e}`,rawValue:t,defaultValue:!0})),...i.map(({key:e,disabled:t})=>({key:`disabled-${e}`,rawValue:t,defaultValue:!1}))],!0),a=y(()=>i.filter(({key:e})=>r[`show-${e}`]),[r,i]),n=F({}),[k,u]=I(a[0]?.key??0),g=R(e=>{n.current[e]?.scrollIntoView({behavior:"smooth",block:"start",inline:"start"}),u(e)},[]),d=y(()=>s!=="navigation"?void 0:x({delay:60},e=>{const{top:t}=e.target.getBoundingClientRect();for(const[l,h]of Object.entries(n.current))if(h){const{top:v}=h.getBoundingClientRect();v-t<=60&&u(l)}}),[s]),[f]=A(e=>[e.setShowActionButtons]);if(E(()=>{f(a.length>0)},[f,a.length]),a.length===0)return o(O,{description:"空表单"});if(s==="switch"){const e=i.map(({key:t,rows:l})=>({key:`${t}`,label:r[`title-${t}`],destroyInactiveTabPane:!1,children:o(m,{disabled:r[`disabled-${t}`],rows:l})}));return o(w,{items:e})}if(s==="navigation")return V(T,{vertical:!0,css:c==="full"?j.fullHeight:void 0,children:[o(w,{activeKey:`${k}`,items:i.map(({key:e})=>({key:`${e}`,label:r[`title-${e}`]})),onChange:g}),o(b,{css:D,onScroll:d,children:i.map(({key:e,rows:t})=>o(m,{ref:l=>{n.current[e]=l},disabled:r[`disabled-${e}`],rows:t,title:r[`title-${e}`]},e))})]});const p=i.map(({key:e,rows:t})=>o(m,{disabled:r[`disabled-${e}`],rows:t,title:r[`title-${e}`]},e));return c==="full"?o(b,{onScroll:d,children:p}):o(C,{children:p})}const K=M(H,(i,s)=>B($(i,["schema"]),$(s,["schema"])));export{K as default};
|
|
2
|
+
import{jsx as o,jsxs as V,Fragment as C}from"@emotion/react/jsx-runtime";import{css as S}from"@emotion/react";import{debounce as x,styles as j,isDeepEqual as B,omit as $}from"@vef-framework/shared";import{useMemo as y,useRef as F,useState as I,useCallback as R,useEffect as E,memo as H}from"react";import M from"../../vef-empty-placeholder/index.js";import O from"../../vef-flex/index.js";import b from"../../vef-scroll-area/index.js";import w from"../../vef-tabs/index.js";import{useComputedValues as T}from"../hooks/use-computed-values.js";import{useFormStore as q}from"../store.js";import m from"./form-group.js";const A=S({flex:"auto",minHeight:0});function D({schema:i,showTabs:s,height:c}){const r=T([...i.map(({key:e,title:t})=>({key:`title-${e}`,rawValue:t})),...i.map(({key:e,show:t})=>({key:`show-${e}`,rawValue:t,defaultValue:!0})),...i.map(({key:e,disabled:t})=>({key:`disabled-${e}`,rawValue:t,defaultValue:!1}))],!0),a=y(()=>i.filter(({key:e})=>r[`show-${e}`]),[r,i]),n=F({}),[k,u]=I(a[0]?.key??0),g=R(e=>{n.current[e]?.scrollIntoView({behavior:"smooth",block:"start",inline:"start"}),u(e)},[]),d=y(()=>s!=="navigation"?void 0:x({delay:60},e=>{const{top:t}=e.target.getBoundingClientRect();for(const[l,h]of Object.entries(n.current))if(h){const{top:v}=h.getBoundingClientRect();v-t<=60&&u(l)}}),[s]),[f]=q(e=>[e.setShowActionButtons]);if(E(()=>{f(a.length>0)},[f,a.length]),a.length===0)return o(M,{description:"空表单"});if(s==="switch"){const e=i.map(({key:t,rows:l})=>({key:`${t}`,label:r[`title-${t}`],destroyInactiveTabPane:!1,children:o(m,{disabled:r[`disabled-${t}`],rows:l})}));return o(w,{items:e})}if(s==="navigation")return V(O,{vertical:!0,css:c==="full"?j.fullHeight:void 0,children:[o(w,{activeKey:`${k}`,items:i.map(({key:e})=>({key:`${e}`,label:r[`title-${e}`]})),onChange:g}),o(b,{css:A,onScroll:d,children:i.map(({key:e,rows:t})=>o(m,{ref:l=>{n.current[e]=l},disabled:r[`disabled-${e}`],rows:t,title:r[`title-${e}`]},e))})]});const p=i.map(({key:e,rows:t})=>o(m,{disabled:r[`disabled-${e}`],rows:t,title:r[`title-${e}`]},e));return c==="full"?o(b,{onScroll:d,children:p}):o(C,{children:p})}const K=H(D,(i,s)=>B($(i,["schema"]),$(s,["schema"])));export{K as default};
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as f,jsx as m}from"@emotion/react/jsx-runtime";import{css as u}from"@emotion/react";import{themeVariables as c,isDeepEqual as h,omit as l}from"@vef-framework/shared";import{useMemo as w,memo as
|
|
3
|
-
margin-bottom: ${c.margin};
|
|
4
|
-
|
|
5
|
-
&:last-child {
|
|
6
|
-
margin-bottom: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.vef-form-group-content {
|
|
10
|
-
padding: 0 2px;
|
|
11
|
-
}
|
|
12
|
-
`;function $({title:r,disabled:t,rows:s},n){const a=k([...s.map(({key:o,show:e})=>({key:`show-${o}`,rawValue:e,defaultValue:!0})),...s.map(({key:o,disabled:e})=>({key:`disabled-${o}`,rawValue:e,defaultValue:t}))],!0),i=w(()=>s.filter(({key:o})=>a[`show-${o}`]),[a,s]);return f("div",{ref:n,css:x,children:[r&&m(V,{showBottomLine:!0,showLeftBar:!0,level:4,children:r}),m("div",{className:"vef-form-group-content",children:i.length===0?m(g,{description:"空表单组"}):i.map(({key:o,autoExpand:e,columns:p})=>m(v,{autoExpand:e,columns:p,disabled:a[`disabled-${o}`],rowKey:o},o))})]})}const d=b(y($),(r,t)=>h(l(r,["rows"]),l(t,["rows"])));d.displayName="VefFormGroup";export{d as default};
|
|
2
|
+
import{jsxs as f,jsx as m}from"@emotion/react/jsx-runtime";import{css as u}from"@emotion/react";import{themeVariables as c,isDeepEqual as h,omit as l}from"@vef-framework/shared";import{useMemo as w,memo as y,forwardRef as g}from"react";import V from"../../vef-empty-placeholder/index.js";import b from"../../vef-title/index.js";import{useComputedValues as k}from"../hooks/use-computed-values.js";import v from"./form-row.js";const x=u({marginBottom:c.margin,"&:last-child":{marginBottom:0},".vef-form-group-content":{padding:"0 2px"}});function $({title:r,disabled:t,rows:s},n){const a=k([...s.map(({key:o,show:e})=>({key:`show-${o}`,rawValue:e,defaultValue:!0})),...s.map(({key:o,disabled:e})=>({key:`disabled-${o}`,rawValue:e,defaultValue:t}))],!0),i=w(()=>s.filter(({key:o})=>a[`show-${o}`]),[a,s]);return f("div",{ref:n,css:x,children:[r&&m(b,{showBottomLine:!0,showLeftBar:!0,level:4,children:r}),m("div",{className:"vef-form-group-content",children:i.length===0?m(V,{description:"空表单组"}):i.map(({key:o,autoExpand:e,columns:p})=>m(v,{autoExpand:e,columns:p,disabled:a[`disabled-${o}`],rowKey:o},o))})]})}const d=y(g($),(r,t)=>h(l(r,["rows"]),l(t,["rows"])));d.displayName="VefFormGroup";export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{useApiContext as L}from"@vef-framework/core";import{isFunction as
|
|
2
|
+
import{useApiContext as L}from"@vef-framework/core";import{isFunction as a,VefError as V,omit as A}from"@vef-framework/shared";import{useCallback as M,useMemo as N}from"react";import"../../helpers/index.js";import{useFormStore as j}from"../store.js";import{showLoadingMessage as v,showSuccessMessage as q}from"../../helpers/message.js";function I({submitApi:l,submitTip:s="提交中...",onBeforeSubmit:r,onSubmit:c,onSubmitSuccess:d,onSubmitFailure:p,onReset:f}){const[h,e,o,m,b,w,F,g]=j(t=>[t.form,t.scene,t.eventBus,t.setIsLoading,t.virtualFieldNames,t.getValues,t.initialValues,t.invokeValueChangeHandlers]),{useApiMutation:y,stubMutationApi:C}=L(),{mutate:R}=y(l??C);if(!a(c)&&!l)throw new V(-1,"'onSubmit' or 'submitApi' prop is required for VefForm component");const k=M(()=>{const t=w();h.resetFields(),g(),o.emitChange(F),f?.(t,e)},[h,w,f,e,g,F,o]),H=N(()=>a(c)?(l&&console.warn("'submitApi' prop is ignored when 'onSubmit' prop is provided in VefForm component"),async t=>{m(!0);let i=t,n=null;try{const u=a(s)?s(t,e):s;n=v(u),a(r)&&(i=await r(i,e));const S=A(i,b);await c(S,e),o.emitSubmitResult(!0)}catch(u){throw o.emitSubmitResult(!1),u}finally{m(!1),n?.()}}):async t=>{m(!0);let i=t,n=null;try{const u=a(s)?s(t,e):s;n=v(u),a(r)&&(i=await r(t,e));const S=A(i,b),B=await R(S);(d??(({message:E})=>{q(E)}))(B,i,e),o.emitSubmitResult(!0)}catch(u){o.emitSubmitResult(!1),p?.(u,i,e)}finally{m(!1),n?.()}},[c,l,m,s,e,r,b,o,R,d,p]),x=M(({values:t,errorFields:i})=>{o.emitSubmitResult(!1),p?.(new V(-1,i.flatMap(n=>n.errors).join(", ")),t,e)},[o,p,e]);return{handleReset:k,handleSubmit:H,handleSubmitFailed:x}}export{I as useActionHandlers};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{
|
|
2
|
+
import{useMemo as o}from"react";import"../../helpers/index.js";import{showWarningMessage as r}from"../../helpers/message.js";function i(e,t){return o(()=>{if(!(e==="top"||!t))return(t<60||t>120)&&r("The labelWidth of VefForm component must be between 60 and 120, otherwise it will be 60 or 120."),Math.min(Math.max(t,60),120)},[e,t])}export{i as useLabelWidth};
|
package/esm/vef-form/index.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsxs as L,jsx as a}from"@emotion/react/jsx-runtime";import{css as j}from"@emotion/react";import{useContextDisabled as D,useSingleton as O,useUnmount as U}from"@vef-framework/hooks";import{isNumber as q,isDeepEqual as K,omit as x}from"@vef-framework/shared";import{Form as B}from"antd";import{useMemo as b,forwardRef as C,memo as k}from"react";import"../internal/index.js";import G from"./components/form-actions.js";import J from"./components/form-content.js";import{FormEventBus as Q}from"./event.js";import{useActionHandlers as X}from"./hooks/use-action-handlers.js";import{useFormContextSelector as Y,FormContextProvider as Z}from"./hooks/use-form-context.js";import{useFormInitialization as _}from"./hooks/use-form-initialization.js";import{useFormInstance as $}from"./hooks/use-form-instance.js";import{useFormValuesChange as ee}from"./hooks/use-form-values-change.js";import{useLabelWidth as ie}from"./hooks/use-label-width.js";import{useFormStore as oe,FormStoreProvider as te}from"./store.js";import{convertBasicSizeToUiSize as se}from"../internal/utils.js";const{useForm:re}=B,ae={scrollMode:"if-needed",behavior:"smooth"};function ne({schema:t,labelAlign:o="right",variant:n,showTabs:s=!1,height:e="auto",size:p,disabled:l=!1,onChange:f,submissionButton:F,resetButton:m,submitApi:r,submitTip:u,onBeforeSubmit:S,onSubmit:d,onSubmitSuccess:h,onSubmitFailure:c,onReset:g},y){const[z,v]=Y(i=>[i.labelPosition,i.labelWidth]),[E,N,W]=oe(i=>[i.form,i.initialValues,i.isLoading]),{handleValuesChange:A}=ee(f),{handleReset:V,handleSubmit:P,handleSubmitFailed:R}=X({submitApi:r,submitTip:u,onBeforeSubmit:S,onSubmit:d,onSubmitSuccess:h,onSubmitFailure:c,onReset:g});$(y,V);const I=b(()=>{if(v)return{flex:`0 0 ${v}px`}},[v]),M=b(()=>{let i=e;return e==="full"?i="100%":q(e)&&(i=`${e}px`),j
|
|
3
|
-
height: ${i};
|
|
4
|
-
`},[e]),H=D()||l||W;return L(B,{labelWrap:!0,colon:!1,css:M,disabled:H,form:E,initialValues:N,labelAlign:o,labelCol:I,layout:z==="top"?"vertical":"horizontal",scrollToFirstError:ae,size:se(p),variant:n,onFinish:P,onFinishFailed:R,onValuesChange:A,children:[a(J,{height:e,schema:t,showTabs:s===!0?"switch":s}),a(G,{handleReset:V,resetButton:m,submissionButton:F})]})}const T=C(ne);T.displayName="VefFormBase";function le({initialValues:t,scene:o,layoutMode:n="responsive",autoExpand:s=!1,labelPosition:e="top",labelWidth:p,...l},f){const{schema:F}=l,[m]=re(),r=O(()=>new Q);U(()=>{r.clear()});const u=ie(e,p),S=b(()=>({labelPosition:e,labelWidth:u,autoExpand:s,layoutMode:n}),[n,s,e,u]),{mergedInitialValues:d,valueChangeHandlers:h,virtualFieldNames:c}=_(F,t),g=b(()=>({eventBus:r,form:m,initialValues:d,scene:o,valueChangeHandlers:h,virtualFieldNames:c}),[r,m,d,o,h,c]);return a(te,{initialState:g,children:a(Z,{value:S,children:a(T,{ref:f,...l})})})}const w=k(C(le),(t,o)=>K(x(t,["initialValues","schema"]),x(o,["initialValues","schema"])));w.displayName="VefForm";export{w as default};
|
|
2
|
+
import{jsxs as L,jsx as a}from"@emotion/react/jsx-runtime";import{css as j}from"@emotion/react";import{useContextDisabled as D,useSingleton as O,useUnmount as U}from"@vef-framework/hooks";import{isNumber as q,isDeepEqual as K,omit as x}from"@vef-framework/shared";import{Form as B}from"antd";import{useMemo as b,forwardRef as C,memo as k}from"react";import"../internal/index.js";import G from"./components/form-actions.js";import J from"./components/form-content.js";import{FormEventBus as Q}from"./event.js";import{useActionHandlers as X}from"./hooks/use-action-handlers.js";import{useFormContextSelector as Y,FormContextProvider as Z}from"./hooks/use-form-context.js";import{useFormInitialization as _}from"./hooks/use-form-initialization.js";import{useFormInstance as $}from"./hooks/use-form-instance.js";import{useFormValuesChange as ee}from"./hooks/use-form-values-change.js";import{useLabelWidth as ie}from"./hooks/use-label-width.js";import{useFormStore as oe,FormStoreProvider as te}from"./store.js";import{convertBasicSizeToUiSize as se}from"../internal/utils.js";const{useForm:re}=B,ae={scrollMode:"if-needed",behavior:"smooth"};function ne({schema:t,labelAlign:o="right",variant:n,showTabs:s=!1,height:e="auto",size:p,disabled:l=!1,onChange:f,submissionButton:F,resetButton:m,submitApi:r,submitTip:u,onBeforeSubmit:S,onSubmit:d,onSubmitSuccess:h,onSubmitFailure:c,onReset:g},y){const[z,v]=Y(i=>[i.labelPosition,i.labelWidth]),[E,N,W]=oe(i=>[i.form,i.initialValues,i.isLoading]),{handleValuesChange:A}=ee(f),{handleReset:V,handleSubmit:P,handleSubmitFailed:R}=X({submitApi:r,submitTip:u,onBeforeSubmit:S,onSubmit:d,onSubmitSuccess:h,onSubmitFailure:c,onReset:g});$(y,V);const I=b(()=>{if(v)return{flex:`0 0 ${v}px`}},[v]),M=b(()=>{let i=e;return e==="full"?i="100%":q(e)&&(i=`${e}px`),j({height:i})},[e]),H=D()||l||W;return L(B,{labelWrap:!0,colon:!1,css:M,disabled:H,form:E,initialValues:N,labelAlign:o,labelCol:I,layout:z==="top"?"vertical":"horizontal",scrollToFirstError:ae,size:se(p),variant:n,onFinish:P,onFinishFailed:R,onValuesChange:A,children:[a(J,{height:e,schema:t,showTabs:s===!0?"switch":s}),a(G,{handleReset:V,resetButton:m,submissionButton:F})]})}const T=C(ne);T.displayName="VefFormBase";function le({initialValues:t,scene:o,layoutMode:n="responsive",autoExpand:s=!1,labelPosition:e="top",labelWidth:p,...l},f){const{schema:F}=l,[m]=re(),r=O(()=>new Q);U(()=>{r.clear()});const u=ie(e,p),S=b(()=>({labelPosition:e,labelWidth:u,autoExpand:s,layoutMode:n}),[n,s,e,u]),{mergedInitialValues:d,valueChangeHandlers:h,virtualFieldNames:c}=_(F,t),g=b(()=>({eventBus:r,form:m,initialValues:d,scene:o,valueChangeHandlers:h,virtualFieldNames:c}),[r,m,d,o,h,c]);return a(te,{initialState:g,children:a(Z,{value:S,children:a(T,{ref:f,...l})})})}const w=k(C(le),(t,o)=>K(x(t,["initialValues","schema"]),x(o,["initialValues","schema"])));w.displayName="VefForm";export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as e}from"@emotion/react/jsx-runtime";import{SearchOutlined as I}from"@ant-design/icons";import{isFunction as k,styles as B}from"@vef-framework/shared";import{Select as D}from"antd";import{LeafIcon as L}from"lucide-react";import{useState as r,useDeferredValue as M,useCallback as l,useMemo as O,cloneElement as R}from"react";import"../internal/index.js";import T from"../vef-icon/index.js";import{convertBasicSizeToUiSize as W}from"../internal/utils.js";const j={"--vef-select-option-padding":0};function E({value:c,size:s,renderLabel:o,placeholder:d,disabled:u,clearable:
|
|
2
|
+
import{jsx as e}from"@emotion/react/jsx-runtime";import{SearchOutlined as I}from"@ant-design/icons";import{isFunction as k,styles as B}from"@vef-framework/shared";import{Select as D}from"antd";import{LeafIcon as L}from"lucide-react";import{useState as r,useDeferredValue as M,useCallback as l,useMemo as O,cloneElement as R}from"react";import"../internal/index.js";import T from"../vef-icon/index.js";import{convertBasicSizeToUiSize as W}from"../internal/utils.js";const j={"--vef-select-option-padding":0};function E({value:c,size:s,renderLabel:o,placeholder:d,disabled:u,clearable:p,loading:m,variant:f,children:h,onClear:S}){const[n,t]=r(!1),[C,a]=r(!1),[i,b]=r(),v=M(i),w=l(()=>{a(!1)},[]),g=l(()=>{a(!0)},[]),y=l(()=>{t(!1)},[]),z=O(()=>{if(k(o))return({value:x})=>o?.(x)},[o]),F=C&&n?e(I,{}):e(T,{children:e(L,{})}),V=R(h,{keyword:v,onConfirm:y});return e(D,{showSearch:!0,allowClear:p,css:B.fullWidth,disabled:u,dropdownStyle:j,labelRender:z,loading:m,notFoundContent:V,open:n,placeholder:d,popupMatchSelectWidth:!1,searchValue:i,size:W(s),suffixIcon:F,value:c,variant:f,onBlur:w,onClear:S,onDropdownVisibleChange:t,onFocus:g,onSearch:b})}export{E as default};
|
package/esm/vef-grid/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import{jsx as h}from"@emotion/react/jsx-runtime";import{css as $}from"@emotion/react";import{useGapSizeNormalizer as g,useElementSize as x}from"@vef-framework/hooks";import{breakpoints as v,isArray as W}from"@vef-framework/shared";import y from"clsx";import{useMemo as s,useRef as w,useEffect as z}from"react";import{useContainerQuery as A}from"react-container-query";const r=24,b=$`
|
|
3
3
|
display: grid;
|
|
4
4
|
grid: auto-flow / repeat(${r}, minmax(0, 1fr));
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
> * {
|
|
7
7
|
grid-column: span ${r};
|
|
8
8
|
}
|
package/esm/vef-icon/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import{jsx as
|
|
2
|
+
import{jsx as g}from"@emotion/react/jsx-runtime";import{css as u}from"@emotion/react";import{useColorTokens as S}from"@vef-framework/hooks";import{themeVariables as o}from"@vef-framework/shared";import y from"clsx";import{forwardRef as z,useMemo as x,Suspense as b,cloneElement as s,memo as v}from"react";const w=u({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility",WebkitFontSmoothing:"antialiased"}),N=z(({size:e,color:n,children:i,className:f,style:l,...p},h)=>{const m=S(),d=x(()=>{const t={...l},a=e==="small"?o.fontSizeSm:e==="medium"?o.fontSize:e==="large"?o.fontSizeLg:e==="huge"?o.fontSizeXl:void 0;return a&&(t.fontSize=a),n&&(t.color=m.get(n)),t},[e,n,m,l]);let r;if(i.type===b){const{children:t}=i.props;r=s(i,{children:s(t,{width:"1em",height:"1em"})})}else r=s(i,{width:"1em",height:"1em"});return g("span",{ref:h,className:y(f,"vef-icon"),css:w,style:d,...p,children:r})}),c=v(N);c.displayName="VefIcon";export{c as default};
|