@flatbiz/antd 4.5.39 → 4.5.40

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.
@@ -5,5 +5,5 @@ import './../form-wrapper/index.css';
5
5
  import './../pre-defined-class-name/index.css';
6
6
  import './index.css';
7
7
  /*! @flatjs/forge MIT @flatbiz/antd */
8
- import{classNames as r}from"@dimjs/utils/cjs/class-names";import{a as e,_ as t}from"../_rollupPluginBabelHelpers-a0769acd.js";import{isUndefinedOrNull as l,dom as n}from"@flatbiz/utils";import{useMemo as a,useRef as o,Fragment as i,Children as s,cloneElement as m}from"react";import{BoxGrid as u}from"../box-grid/index.js";import{fbaHooks as f}from"../fba-hooks/index.js";import{FormWrapper as d}from"../form-wrapper/index.js";import{preDefinedClassName as p}from"../pre-defined-class-name/index.js";import{jsxs as c,jsx as x}from"react/jsx-runtime";import"@dimjs/lang/cjs/is-number";import"ahooks";import"@dimjs/lang/cjs/is-array";import"@wove/react/cjs/hooks";import"../use-responsive-point-21b8c601.js";import"antd";var v=["column","forceColumn","children","width","gridGutter","labelWidth","labelItemVertical","labelAlign","formItemGap","isPure","nonuseFormWrapper"];var h=function h(y){var g=f.useResponsivePoint()||"";var b=y.column,j=y.forceColumn,I=y.children,F=y.width,N=y.gridGutter,G=y.labelWidth,W=y.labelItemVertical,w=y.labelAlign,C=y.formItemGap,A=C===void 0?"15":C,P=y.isPure,k=y.nonuseFormWrapper,B=e(y,v);var V=a((function(){if(j){var r=24/j;return{xs:r,sm:r,md:r,lg:r,xl:r,xxl:r}}if(!b){return{xs:24,sm:12,md:12,lg:8,xl:8,xxl:6}}var e={1:{xs:24,sm:24,md:24,lg:24,xl:24,xxl:24},2:{xs:24,sm:12,md:12,lg:12,xl:12,xxl:12},3:{xs:24,sm:12,md:12,lg:8,xl:8,xxl:8},4:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6}};return e[b]}),[b,j]);var E=function r(){var e=s.toArray(I).filter((function(r){return!!r}));return e.map((function(r,e){var l=r.type["domTypeName"];var n=undefined;if(l==="FormItemText"||l==="FormItemSpan"||l==="FormItemWrapper"||l==="BoxGridCol"||l==="EasyForm"){n=r.props["span"];if(n){if(g==="xs"){n=24}else if(g==="sm"){n=n>12?n:12}}}if(l==="BoxGridCol"||l==="FormItemSpan"){if(l==="FormItemSpan"&&r.props.hidden){return null}return m(r,t({},r.props,V,{span:n,key:e}))}return x(u.Col,t({},V,{span:n,removeWrapper:true,children:r}),e)})).filter(Boolean)};var R=a((function(){if(["xs","sm"].includes(g)||!F){return{}}return{width:F}}),[g,F]);var S=l(N)?[15,0]:N;var T=o(null);var L=function r(){try{if(k){return true}if(T.current){var e=n.findParentsElement(T.current,(function(r){var e;return(e=r.classList)==null||e.contains==null?void 0:e.contains("easy-form")}));return e?true:false}return undefined}catch(r){console.log("error",r);return false}};var _=L();var z=a((function(){if(["xs"].includes(g)){return"left"}return w}),[w,g]);var H=a((function(){return p.getFormLayoutClassName({labelWidth:G,labelItemVertical:W,labelAlign:z,formItemGap:A,className:B.className})}),[G,W,z,A,B.className]);return c(i,{children:[x("div",{className:"easy-form-anchor",ref:T}),_===true?x("div",{style:t({},R,B.style),className:r("easy-form",{"easy-form-pure":P},"easy-form-nested",H),children:P?I:x(u.Row,{gutter:S,children:E()})}):undefined,_===false?x(d,t({},B,{labelWidth:G,labelAlign:z,labelItemVertical:W,formItemGap:A,style:t({},R,B.style),className:r("easy-form",{"easy-form-pure":P},H),autoComplete:"off",children:P?I:x(u.Row,{gutter:S,children:E()})})):undefined]})};h["domTypeName"]="EasyForm";export{h as EasyForm};
8
+ import{classNames as r}from"@dimjs/utils/cjs/class-names";import{a as e,_ as t}from"../_rollupPluginBabelHelpers-a0769acd.js";import{isUndefinedOrNull as l,dom as n}from"@flatbiz/utils";import{Form as a}from"antd";import{useMemo as o,useRef as m,Fragment as i,Children as s,cloneElement as u}from"react";import{BoxGrid as f}from"../box-grid/index.js";import{fbaHooks as p}from"../fba-hooks/index.js";import{FormWrapper as d}from"../form-wrapper/index.js";import{preDefinedClassName as c}from"../pre-defined-class-name/index.js";import{jsxs as x,jsx as v}from"react/jsx-runtime";import"@dimjs/lang/cjs/is-number";import"ahooks";import"@dimjs/lang/cjs/is-array";import"@wove/react/cjs/hooks";import"../use-responsive-point-21b8c601.js";var y=["column","forceColumn","children","width","gridGutter","labelWidth","labelItemVertical","labelAlign","formItemGap","isPure","nonuseFormWrapper"];var h=function h(g){var I=p.useResponsivePoint()||"";var b=g.column,j=g.forceColumn,F=g.children,W=g.width,N=g.gridGutter,G=g.labelWidth,w=g.labelItemVertical,C=g.labelAlign,A=g.formItemGap,P=A===void 0?"15":A,k=g.isPure,B=g.nonuseFormWrapper,T=e(g,y);var V=o((function(){if(j){var r=24/j;return{xs:r,sm:r,md:r,lg:r,xl:r,xxl:r}}if(!b){return{xs:24,sm:12,md:12,lg:8,xl:8,xxl:6}}var e={1:{xs:24,sm:24,md:24,lg:24,xl:24,xxl:24},2:{xs:24,sm:12,md:12,lg:12,xl:12,xxl:12},3:{xs:24,sm:12,md:12,lg:8,xl:8,xxl:8},4:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6}};return e[b]}),[b,j]);var E=function r(){var e=s.toArray(F).filter((function(r){return!!r}));return e.map((function(r,e){var l;var n=r.type["domTypeName"];var o=undefined;if(n==="FormItemText"||n==="FormItemSpan"||n==="FormItemWrapper"||n==="BoxGridCol"||n==="EasyForm"){o=r.props["span"];if(o){if(I==="xs"){o=24}else if(I==="sm"){o=o>12?o:12}}}if(n==="BoxGridCol"||n==="FormItemSpan"){if(n==="FormItemSpan"&&r.props.hidden){return null}return u(r,t({},r.props,V,{span:o,key:e}))}var m=(l=r.props)==null||(l=l.style)==null?void 0:l.display;var i=false;if(n==="FormItemText"||n==="FormItemHidden"||n==="FormItemWrapper"||n==="FormItemWrapperDependencies"||r.type===a.Item||m==="none"){i=true}return v(f.Col,t({},V,{span:o,removeWrapper:i,children:r}),e)})).filter(Boolean)};var R=o((function(){if(["xs","sm"].includes(I)||!W){return{}}return{width:W}}),[I,W]);var S=l(N)?[15,0]:N;var H=m(null);var L=function r(){try{if(B){return true}if(H.current){var e=n.findParentsElement(H.current,(function(r){var e;return(e=r.classList)==null||e.contains==null?void 0:e.contains("easy-form")}));return e?true:false}return undefined}catch(r){console.log("error",r);return false}};var _=L();var z=o((function(){if(["xs"].includes(I)){return"left"}return C}),[C,I]);var D=o((function(){return c.getFormLayoutClassName({labelWidth:G,labelItemVertical:w,labelAlign:z,formItemGap:P,className:T.className})}),[G,w,z,P,T.className]);return x(i,{children:[v("div",{className:"easy-form-anchor",ref:H}),_===true?v("div",{style:t({},R,T.style),className:r("easy-form",{"easy-form-pure":k},"easy-form-nested",D),children:k?F:v(f.Row,{gutter:S,children:E()})}):undefined,_===false?v(d,t({},T,{labelWidth:G,labelAlign:z,labelItemVertical:w,formItemGap:P,style:t({},R,T.style),className:r("easy-form",{"easy-form-pure":k},D),autoComplete:"off",children:k?F:v(f.Row,{gutter:S,children:E()})})):undefined]})};h["domTypeName"]="EasyForm";export{h as EasyForm};
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/easy-form/form.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { dom, isUndefinedOrNull, TAny } from '@flatbiz/utils';\nimport { Children, cloneElement, Fragment, ReactNode, useMemo, useRef } from 'react';\nimport { BoxGrid } from '../box-grid';\nimport { BoxRowProps } from '../box-grid/row';\nimport { GutterParams } from '../box-grid/type';\nimport { fbaHooks } from '../fba-hooks';\nimport { FormWrapper, FormWrapperProps } from '../form-wrapper';\nimport { preDefinedClassName } from '../pre-defined-class-name';\nimport './style.less';\n\nexport type EasyFormProps = Omit<FormWrapperProps, 'children'> & {\n /**\n * 定义一行显示几列(当外层宽度尺寸大于 992px(lg) 时,一行显示几列), 默认值:3\n * ```\n * 1. 当外层宽度尺寸小于992px(lg),为xs、sm、md情况下不受column值影响(column=1除外)\n * 2. 宽度尺寸定义\n * xs: 宽度 < 576px\n * sm: 宽度 ≥ 576px\n * md: 宽度 ≥ 768px\n * lg: 宽度 ≥ 992px\n * xl: 宽度 ≥ 1200px\n * xxl: 宽度 ≥ 1600px\n * 3. 列数尺寸定义\n * {\n * 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n * 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n * 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n * 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n * };\n * ```\n */\n column?: 1 | 2 | 3 | 4;\n /**\n * 强制定义一行显示几列,不考虑响应式\n * ```\n * 1. 优先级大于column\n * 2. 建议优先使用column配置\n * ```\n */\n forceColumn?: 1 | 2 | 3 | 4;\n /**\n * Form显示宽度,可数值、可百分比;在小屏幕尺寸(xs、sm)上无效\n */\n width?: number | string;\n /** 网格间距 */\n gridGutter?: BoxRowProps['gutter'];\n children: ReactNode;\n /**\n * 是否为纯净模式,对EasyForm的子节点不做任何包装处理\n */\n isPure?: boolean;\n /**\n * true: 当前EasyForm组件不使用Antd Form包裹,可在Form、EasyForm、FormWrapper内部使用\n */\n nonuseFormWrapper?: boolean;\n /**\n * 栅格占位格数,最大值:24\n * ```\n * 1. 当前EasyForm处在 EasyForm 直接子节点中有效,即当前EasyForm在EasyForm栅格中的占位格数;\n * 2. 父节点使用属性值,当前节点不使用属性值\n * ```\n */\n span?: number;\n};\n\n/**\n * 简单Form布局,可自定义网格布局\n * ```\n * 1. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/grid\n * 2. EasyForm的children列表会进行网格化布局\n * 3. 自定义栅格占位格数的4中方式\n * 3.1 设置FormItemWrapper、FormItemText组件span属性;\n * 3.2 使用 EasyFormItemSpan 包裹children item,设置span属性\n * 3.3 使用 <BoxGrid.Col span={24} ></BoxGrid.Col> 包裹,设置响应式属性\n * 3.4 设置 EasyForm isPure = true设置纯净模式,对EasyForm的子节点不做任何包装处理\n * 4. EasyForm可嵌套使用,嵌套内部的<EasyForm />节点Form相关属性失效,例如属性form、initialValues等都失效\n * <EasyForm form={form}>\n * ....\n * <EasyForm>...</EasyForm>\n * ....\n * <EasyForm>...</EasyForm>\n * ....\n * </EasyForm>\n * 5. 布局网格以当前组件的宽度来计算的,不是屏幕宽度\n * 6. EasyForm 子节点包含 hidden = true 会被忽略\n * 7. 通过 column 可定义一行显示几列FormItem\n * 8. 通过 labelItemVertical 可定义 formitem 竖直布局\n * 9. 通过 formItemGap 可定义 formItem竖直方向间隙\n * 10. 通过 forceColumn 可强制定义一行显示几列,不考虑响应式\n * 11. 通过 labelWidth 可控制Form内部所有label的宽度(可实现整齐效果)\n * 12. 自定义栅格占位格数,见下方`例如`\n * 13. 内部直接子节点为 <Form.Item dependencies={['xxx']} noStyle /> 时,样式会有问题,可使用 <FormItemWrapperDependencies /> 代替,具体参考FormItemWrapperDependencies组件使用\n\n * 例如\n * <EasyForm column={3}>\n *\t <FormItemWrapper name=\"field1\" label=\"条件1\">\n *\t <Input placeholder=\"请输入\" allowClear={true} />\n *\t </FormItemWrapper>\n *\t <!-- !!自定义栅格占位格数第一种方式:可通过使用 BoxGrid.Col 包裹元素来自定义网格占比 -->\n *\t <BoxGrid.Col span={24}>\n *\t <FormItemWrapper name=\"field5\" label=\"条件5\">\n *\t \t<Input placeholder=\"请输入\" allowClear={true} />\n *\t </FormItemWrapper>\n *\t </BoxGrid.Col>\n *\t <!-- !!自定义栅格占位格数第二种方式:如果为FormItemWrapper组件,可设置span属性 -->\n *\t <FormItemWrapper name=\"field6\" label=\"条件6\" span={24}>\n *\t <Input placeholder=\"请输入\" allowClear={true} />\n *\t </FormItemWrapper>\n *\t <FormItemWrapper noStyle span={24}>\n *\t <Button>按钮</Buttone>\n *\t </FormItemWrapper>\n * </EasyForm>\n * ```\n */\nexport const EasyForm = (props: EasyFormProps) => {\n const screenType = fbaHooks.useResponsivePoint() || '';\n\n const {\n column,\n forceColumn,\n children,\n width,\n gridGutter,\n labelWidth,\n labelItemVertical,\n labelAlign,\n formItemGap = '15',\n isPure,\n nonuseFormWrapper,\n ...otherProps\n } = props;\n const gridSize = useMemo(() => {\n if (forceColumn) {\n const num = 24 / forceColumn;\n return { xs: num, sm: num, md: num, lg: num, xl: num, xxl: num };\n }\n if (!column) {\n return { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 };\n }\n const columnMap = {\n 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n };\n return columnMap[column];\n }, [column, forceColumn]);\n\n const getFormRowChildren = () => {\n const childrenList = Children.toArray(children).filter((item: TAny) => {\n return !!item;\n });\n return childrenList\n .map((item: TAny, index) => {\n const domTypeName = item.type['domTypeName'];\n\n let span: number | undefined = undefined;\n if (\n domTypeName === 'FormItemText' ||\n domTypeName === 'FormItemSpan' ||\n domTypeName === 'FormItemWrapper' ||\n domTypeName === 'BoxGridCol' ||\n domTypeName === 'EasyForm'\n ) {\n span = item.props['span'] as number;\n if (span) {\n if (screenType === 'xs') {\n span = 24;\n } else if (screenType === 'sm') {\n span = span > 12 ? span : 12;\n }\n }\n }\n\n if (domTypeName === 'BoxGridCol' || domTypeName === 'FormItemSpan') {\n if (domTypeName === 'FormItemSpan' && item.props.hidden) {\n return null;\n }\n return cloneElement(item, {\n ...item.props,\n ...gridSize,\n span,\n key: index,\n });\n }\n return (\n <BoxGrid.Col key={index} {...gridSize} span={span} removeWrapper>\n {item}\n </BoxGrid.Col>\n );\n })\n .filter(Boolean);\n };\n\n const innerStyle = useMemo(() => {\n /** 小屏幕不控制宽度 */\n if (['xs', 'sm'].includes(screenType) || !width) {\n return {};\n }\n return { width };\n }, [screenType, width]);\n\n const gutter = isUndefinedOrNull(gridGutter) ? ([15, 0] as GutterParams) : gridGutter;\n const anchorRef = useRef<HTMLDivElement>(null);\n\n // 是否嵌套内部EasyForm节点\n const getIsNestedEasyForm = () => {\n try {\n if (nonuseFormWrapper) {\n return true;\n }\n if (anchorRef.current) {\n const target = dom.findParentsElement(anchorRef.current, (node) => {\n return node.classList?.contains?.('easy-form');\n });\n return target ? true : false;\n }\n return undefined;\n } catch (error) {\n console.log('error', error);\n return false;\n }\n };\n\n const isNestedEasyForm = getIsNestedEasyForm();\n\n const labelAlignNew = useMemo(() => {\n if (['xs'].includes(screenType)) {\n return 'left';\n }\n return labelAlign;\n }, [labelAlign, screenType]);\n\n const fromLayoutClassName = useMemo(() => {\n return preDefinedClassName.getFormLayoutClassName({\n labelWidth,\n labelItemVertical,\n labelAlign: labelAlignNew,\n formItemGap,\n className: otherProps.className,\n });\n }, [labelWidth, labelItemVertical, labelAlignNew, formItemGap, otherProps.className]);\n\n return (\n <Fragment>\n <div className=\"easy-form-anchor\" ref={anchorRef}></div>\n {isNestedEasyForm === true ? (\n <div\n style={{ ...innerStyle, ...otherProps.style }}\n className={classNames(\n 'easy-form',\n { 'easy-form-pure': isPure },\n 'easy-form-nested',\n fromLayoutClassName,\n )}\n >\n {isPure ? children : <BoxGrid.Row gutter={gutter}>{getFormRowChildren()}</BoxGrid.Row>}\n </div>\n ) : undefined}\n {isNestedEasyForm === false ? (\n <FormWrapper\n {...otherProps}\n labelWidth={labelWidth}\n labelAlign={labelAlignNew}\n labelItemVertical={labelItemVertical}\n formItemGap={formItemGap}\n style={{ ...innerStyle, ...otherProps.style }}\n className={classNames('easy-form', { 'easy-form-pure': isPure }, fromLayoutClassName)}\n autoComplete=\"off\"\n >\n {isPure ? children : <BoxGrid.Row gutter={gutter}>{getFormRowChildren()}</BoxGrid.Row>}\n </FormWrapper>\n ) : undefined}\n </Fragment>\n );\n};\n\nEasyForm['domTypeName'] = 'EasyForm';\n"],"names":["EasyForm","props","screenType","fbaHooks","useResponsivePoint","column","forceColumn","children","width","gridGutter","labelWidth","labelItemVertical","labelAlign","_props$formItemGap","formItemGap","isPure","nonuseFormWrapper","otherProps","_objectWithoutPropertiesLoose","_excluded","gridSize","useMemo","num","xs","sm","md","lg","xl","xxl","columnMap","getFormRowChildren","childrenList","Children","toArray","filter","item","map","index","domTypeName","type","span","undefined","hidden","cloneElement","_extends","key","_jsx","BoxGrid","Col","removeWrapper","Boolean","innerStyle","includes","gutter","isUndefinedOrNull","anchorRef","useRef","getIsNestedEasyForm","current","target","dom","findParentsElement","node","_node$classList","classList","contains","error","console","log","isNestedEasyForm","labelAlignNew","fromLayoutClassName","preDefinedClassName","getFormLayoutClassName","className","_jsxs","Fragment","ref","style","_classNames","Row","FormWrapper","autoComplete"],"mappings":";22BAmHaA,EAAW,SAAXA,EAAYC,GACvB,IAAMC,EAAaC,EAASC,sBAAwB,GAEpD,IACEC,EAYEJ,EAZFI,OACAC,EAWEL,EAXFK,YACAC,EAUEN,EAVFM,SACAC,EASEP,EATFO,MACAC,EAQER,EARFQ,WACAC,EAOET,EAPFS,WACAC,EAMEV,EANFU,kBACAC,EAKEX,EALFW,WAAUC,EAKRZ,EAJFa,YAAAA,EAAWD,SAAG,EAAA,KAAIA,EAClBE,EAGEd,EAHFc,OACAC,EAEEf,EAFFe,kBACGC,EAAUC,EACXjB,EAAKkB,GACT,IAAMC,EAAWC,GAAQ,WACvB,GAAIf,EAAa,CACf,IAAMgB,EAAM,GAAKhB,EACjB,MAAO,CAAEiB,GAAID,EAAKE,GAAIF,EAAKG,GAAIH,EAAKI,GAAIJ,EAAKK,GAAIL,EAAKM,IAAKN,EAC7D,CACA,IAAKjB,EAAQ,CACX,MAAO,CAAEkB,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,EAAGC,GAAI,EAAGC,IAAK,EACtD,CACA,IAAMC,EAAY,CAChB,EAAG,CAAEN,GAAI,GAAIC,GAAI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KACN3B,EAAU,CACdP,WAAYA,EACZE,WAAY0D,EACZ3D,kBAAmBA,EACnBG,YAAaA,EACbgE,MAAKlC,EAAOO,CAAAA,EAAAA,EAAelC,EAAW6D,OACtCJ,UAAWK,EAAW,YAAa,CAAE,iBAAkBhE,GAAUwD,GACjEW,aAAa,MAAK3E,SAEjBQ,EAASR,EAAWuC,EAACC,EAAQiC,IAAG,CAAC3B,OAAQA,EAAO9C,SAAEuB,SAEnDW,YAGV,EAEAzC,EAAS,eAAiB"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/easy-form/form.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { dom, isUndefinedOrNull, TAny } from '@flatbiz/utils';\nimport { Form } from 'antd';\nimport { Children, cloneElement, Fragment, ReactNode, useMemo, useRef } from 'react';\nimport { BoxGrid } from '../box-grid';\nimport { BoxRowProps } from '../box-grid/row';\nimport { GutterParams } from '../box-grid/type';\nimport { fbaHooks } from '../fba-hooks';\nimport { FormWrapper, FormWrapperProps } from '../form-wrapper';\nimport { preDefinedClassName } from '../pre-defined-class-name';\nimport './style.less';\n\nexport type EasyFormProps = Omit<FormWrapperProps, 'children'> & {\n /**\n * 定义一行显示几列(当外层宽度尺寸大于 992px(lg) 时,一行显示几列), 默认值:3\n * ```\n * 1. 当外层宽度尺寸小于992px(lg),为xs、sm、md情况下不受column值影响(column=1除外)\n * 2. 宽度尺寸定义\n * xs: 宽度 < 576px\n * sm: 宽度 ≥ 576px\n * md: 宽度 ≥ 768px\n * lg: 宽度 ≥ 992px\n * xl: 宽度 ≥ 1200px\n * xxl: 宽度 ≥ 1600px\n * 3. 列数尺寸定义\n * {\n * 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n * 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n * 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n * 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n * };\n * ```\n */\n column?: 1 | 2 | 3 | 4;\n /**\n * 强制定义一行显示几列,不考虑响应式\n * ```\n * 1. 优先级大于column\n * 2. 建议优先使用column配置\n * ```\n */\n forceColumn?: 1 | 2 | 3 | 4;\n /**\n * Form显示宽度,可数值、可百分比;在小屏幕尺寸(xs、sm)上无效\n */\n width?: number | string;\n /** 网格间距 */\n gridGutter?: BoxRowProps['gutter'];\n children: ReactNode;\n /**\n * 是否为纯净模式,对EasyForm的子节点不做任何包装处理\n */\n isPure?: boolean;\n /**\n * true: 当前EasyForm组件不使用Antd Form包裹,可在Form、EasyForm、FormWrapper内部使用\n */\n nonuseFormWrapper?: boolean;\n /**\n * 栅格占位格数,最大值:24\n * ```\n * 1. 当前EasyForm处在 EasyForm 直接子节点中有效,即当前EasyForm在EasyForm栅格中的占位格数;\n * 2. 父节点使用属性值,当前节点不使用属性值\n * ```\n */\n span?: number;\n};\n\n/**\n * 简单Form布局,可自定义网格布局\n * ```\n * 1. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/grid\n * 2. EasyForm的children列表会进行网格化布局\n * 3. 自定义栅格占位格数的4中方式\n * 3.1 设置FormItemWrapper、FormItemText组件span属性;\n * 3.2 使用 EasyFormItemSpan 包裹children item,设置span属性\n * 3.3 使用 <BoxGrid.Col span={24} ></BoxGrid.Col> 包裹,设置响应式属性\n * 3.4 设置 EasyForm isPure = true设置纯净模式,对EasyForm的子节点不做任何包装处理\n * 4. EasyForm可嵌套使用,嵌套内部的<EasyForm />节点Form相关属性失效,例如属性form、initialValues等都失效\n * <EasyForm form={form}>\n * ....\n * <EasyForm>...</EasyForm>\n * ....\n * <EasyForm>...</EasyForm>\n * ....\n * </EasyForm>\n * 5. 布局网格以当前组件的宽度来计算的,不是屏幕宽度\n * 6. EasyForm 子节点包含 hidden = true 会被忽略\n * 7. 通过 column 可定义一行显示几列FormItem\n * 8. 通过 labelItemVertical 可定义 formitem 竖直布局\n * 9. 通过 formItemGap 可定义 formItem竖直方向间隙\n * 10. 通过 forceColumn 可强制定义一行显示几列,不考虑响应式\n * 11. 通过 labelWidth 可控制Form内部所有label的宽度(可实现整齐效果)\n * 12. 自定义栅格占位格数,见下方`例如`\n\n * 例如\n * <EasyForm column={3}>\n *\t <FormItemWrapper name=\"field1\" label=\"条件1\">\n *\t <Input placeholder=\"请输入\" allowClear={true} />\n *\t </FormItemWrapper>\n *\t <!-- !!自定义栅格占位格数第一种方式:可通过使用 BoxGrid.Col 包裹元素来自定义网格占比 -->\n *\t <BoxGrid.Col span={24}>\n *\t <FormItemWrapper name=\"field5\" label=\"条件5\">\n *\t \t<Input placeholder=\"请输入\" allowClear={true} />\n *\t </FormItemWrapper>\n *\t </BoxGrid.Col>\n *\t <!-- !!自定义栅格占位格数第二种方式:如果为FormItemWrapper组件,可设置span属性 -->\n *\t <FormItemWrapper name=\"field6\" label=\"条件6\" span={24}>\n *\t <Input placeholder=\"请输入\" allowClear={true} />\n *\t </FormItemWrapper>\n *\t <FormItemWrapper noStyle span={24}>\n *\t <Button>按钮</Buttone>\n *\t </FormItemWrapper>\n * </EasyForm>\n * ```\n */\nexport const EasyForm = (props: EasyFormProps) => {\n const screenType = fbaHooks.useResponsivePoint() || '';\n\n const {\n column,\n forceColumn,\n children,\n width,\n gridGutter,\n labelWidth,\n labelItemVertical,\n labelAlign,\n formItemGap = '15',\n isPure,\n nonuseFormWrapper,\n ...otherProps\n } = props;\n const gridSize = useMemo(() => {\n if (forceColumn) {\n const num = 24 / forceColumn;\n return { xs: num, sm: num, md: num, lg: num, xl: num, xxl: num };\n }\n if (!column) {\n return { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 };\n }\n const columnMap = {\n 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n };\n return columnMap[column];\n }, [column, forceColumn]);\n\n const getFormRowChildren = () => {\n const childrenList = Children.toArray(children).filter((item: TAny) => {\n return !!item;\n });\n return childrenList\n .map((item: TAny, index) => {\n const domTypeName = item.type['domTypeName'];\n\n let span: number | undefined = undefined;\n if (\n domTypeName === 'FormItemText' ||\n domTypeName === 'FormItemSpan' ||\n domTypeName === 'FormItemWrapper' ||\n domTypeName === 'BoxGridCol' ||\n domTypeName === 'EasyForm'\n ) {\n span = item.props['span'] as number;\n if (span) {\n if (screenType === 'xs') {\n span = 24;\n } else if (screenType === 'sm') {\n span = span > 12 ? span : 12;\n }\n }\n }\n\n if (domTypeName === 'BoxGridCol' || domTypeName === 'FormItemSpan') {\n if (domTypeName === 'FormItemSpan' && item.props.hidden) {\n return null;\n }\n return cloneElement(item, {\n ...item.props,\n ...gridSize,\n span,\n key: index,\n });\n }\n const display = item.props?.style?.display;\n let removeWrapper = false;\n if (\n domTypeName === 'FormItemText' ||\n domTypeName === 'FormItemHidden' ||\n domTypeName === 'FormItemWrapper' ||\n domTypeName === 'FormItemWrapperDependencies' ||\n item.type === Form.Item ||\n display === 'none'\n ) {\n removeWrapper = true;\n }\n return (\n <BoxGrid.Col key={index} {...gridSize} span={span} removeWrapper={removeWrapper}>\n {item}\n </BoxGrid.Col>\n );\n })\n .filter(Boolean);\n };\n\n const innerStyle = useMemo(() => {\n /** 小屏幕不控制宽度 */\n if (['xs', 'sm'].includes(screenType) || !width) {\n return {};\n }\n return { width };\n }, [screenType, width]);\n\n const gutter = isUndefinedOrNull(gridGutter) ? ([15, 0] as GutterParams) : gridGutter;\n const anchorRef = useRef<HTMLDivElement>(null);\n\n // 是否嵌套内部EasyForm节点\n const getIsNestedEasyForm = () => {\n try {\n if (nonuseFormWrapper) {\n return true;\n }\n if (anchorRef.current) {\n const target = dom.findParentsElement(anchorRef.current, (node) => {\n return node.classList?.contains?.('easy-form');\n });\n return target ? true : false;\n }\n return undefined;\n } catch (error) {\n console.log('error', error);\n return false;\n }\n };\n\n const isNestedEasyForm = getIsNestedEasyForm();\n\n const labelAlignNew = useMemo(() => {\n if (['xs'].includes(screenType)) {\n return 'left';\n }\n return labelAlign;\n }, [labelAlign, screenType]);\n\n const fromLayoutClassName = useMemo(() => {\n return preDefinedClassName.getFormLayoutClassName({\n labelWidth,\n labelItemVertical,\n labelAlign: labelAlignNew,\n formItemGap,\n className: otherProps.className,\n });\n }, [labelWidth, labelItemVertical, labelAlignNew, formItemGap, otherProps.className]);\n\n return (\n <Fragment>\n <div className=\"easy-form-anchor\" ref={anchorRef}></div>\n {isNestedEasyForm === true ? (\n <div\n style={{ ...innerStyle, ...otherProps.style }}\n className={classNames(\n 'easy-form',\n { 'easy-form-pure': isPure },\n 'easy-form-nested',\n fromLayoutClassName,\n )}\n >\n {isPure ? children : <BoxGrid.Row gutter={gutter}>{getFormRowChildren()}</BoxGrid.Row>}\n </div>\n ) : undefined}\n {isNestedEasyForm === false ? (\n <FormWrapper\n {...otherProps}\n labelWidth={labelWidth}\n labelAlign={labelAlignNew}\n labelItemVertical={labelItemVertical}\n formItemGap={formItemGap}\n style={{ ...innerStyle, ...otherProps.style }}\n className={classNames('easy-form', { 'easy-form-pure': isPure }, fromLayoutClassName)}\n autoComplete=\"off\"\n >\n {isPure ? children : <BoxGrid.Row gutter={gutter}>{getFormRowChildren()}</BoxGrid.Row>}\n </FormWrapper>\n ) : undefined}\n </Fragment>\n );\n};\n\nEasyForm['domTypeName'] = 'EasyForm';\n"],"names":["EasyForm","props","screenType","fbaHooks","useResponsivePoint","column","forceColumn","children","width","gridGutter","labelWidth","labelItemVertical","labelAlign","_props$formItemGap","formItemGap","isPure","nonuseFormWrapper","otherProps","_objectWithoutPropertiesLoose","_excluded","gridSize","useMemo","num","xs","sm","md","lg","xl","xxl","columnMap","getFormRowChildren","childrenList","Children","toArray","filter","item","map","index","_item$props","domTypeName","type","span","undefined","hidden","cloneElement","_extends","key","display","style","removeWrapper","Form","Item","_jsx","BoxGrid","Col","Boolean","innerStyle","includes","gutter","isUndefinedOrNull","anchorRef","useRef","getIsNestedEasyForm","current","target","dom","findParentsElement","node","_node$classList","classList","contains","error","console","log","isNestedEasyForm","labelAlignNew","fromLayoutClassName","preDefinedClassName","getFormLayoutClassName","className","_jsxs","Fragment","ref","_classNames","Row","FormWrapper","autoComplete"],"mappings":";03BAmHaA,EAAW,SAAXA,EAAYC,GACvB,IAAMC,EAAaC,EAASC,sBAAwB,GAEpD,IACEC,EAYEJ,EAZFI,OACAC,EAWEL,EAXFK,YACAC,EAUEN,EAVFM,SACAC,EASEP,EATFO,MACAC,EAQER,EARFQ,WACAC,EAOET,EAPFS,WACAC,EAMEV,EANFU,kBACAC,EAKEX,EALFW,WAAUC,EAKRZ,EAJFa,YAAAA,EAAWD,SAAG,EAAA,KAAIA,EAClBE,EAGEd,EAHFc,OACAC,EAEEf,EAFFe,kBACGC,EAAUC,EACXjB,EAAKkB,GACT,IAAMC,EAAWC,GAAQ,WACvB,GAAIf,EAAa,CACf,IAAMgB,EAAM,GAAKhB,EACjB,MAAO,CAAEiB,GAAID,EAAKE,GAAIF,EAAKG,GAAIH,EAAKI,GAAIJ,EAAKK,GAAIL,EAAKM,IAAKN,EAC7D,CACA,IAAKjB,EAAQ,CACX,MAAO,CAAEkB,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,EAAGC,GAAI,EAAGC,IAAK,EACtD,CACA,IAAMC,EAAY,CAChB,EAAG,CAAEN,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,IAAK,IAClD,EAAG,CAAEL,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,IAAK,IAClD,EAAG,CAAEL,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,EAAGC,GAAI,EAAGC,IAAK,GAChD,EAAG,CAAEL,GAAI,GAAIC,GAAI,GA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,EAAU,CACdP,WAAYA,EACZE,WAAY+D,EACZhE,kBAAmBA,EACnBG,YAAaA,EACbkC,MAAKH,EAAOW,CAAAA,EAAAA,EAAevC,EAAW+B,OACtC+B,UAAWI,EAAW,YAAa,CAAE,iBAAkBpE,GAAU6D,GACjEU,aAAa,MAAK/E,SAEjBQ,EAASR,EAAW6C,EAACC,EAAQ+B,IAAG,CAAC1B,OAAQA,EAAOnD,SAAEuB,SAEnDY,YAGV,EAEA1C,EAAS,eAAiB"}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
2
  import './index.css';
3
3
  /*! @flatjs/forge MIT @flatbiz/antd */
4
- import{a as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{Form as r}from"antd";import{jsx as n}from"react/jsx-runtime";var l=["dependencies"];var t=function t(i){var o=i.dependencies,s=e(i,l);return n(r.Item,{dependencies:o,noStyle:true,children:function e(r){return i.children==null?void 0:i.children(r,{style:s==null?void 0:s.style,className:s.className})}})};export{t as FormItemWrapperDependencies};
4
+ import{a as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{Form as r}from"antd";import{jsx as n}from"react/jsx-runtime";var l=["dependencies"];var t=function t(i){var o=i.dependencies,a=e(i,l);return n(r.Item,{dependencies:o,noStyle:true,children:function e(r){return i.children==null?void 0:i.children(r,{style:a==null?void 0:a.style,className:a.className})}})};t["domTypeName"]="FormItemWrapperDependencies";export{t as FormItemWrapperDependencies};
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-item-wrapper-dependencies/dependencies.tsx"],"sourcesContent":["import { Form, type FormInstance } from 'antd';\nimport type { CSSProperties, ReactElement } from 'react';\nexport type FormItemWrapperDependenciesProps = {\n children?: (form: FormInstance, otherProps: { style?: CSSProperties; className?: string }) => ReactElement;\n dependencies: any[];\n className?: string;\n style?: CSSProperties;\n};\n/**\n * FormItem依赖写法包装,当处在EasyForm内部时,不支持 <Form.Item dependencies={['xxx']} noStyle /> 此写法,使用 <FormItemWrapperDependencies dependencies={['xxx']} /> 代替\n *\n * ```\n * 例如:(其中 otherProps 中 style、className透传是必要的)\n * <FormItemWrapperDependencies dependencies={['xx2']}>\n * {(_form, otherProps) => {\n * return (\n * <FormItemWrapper\n * name=\"xxxxx\"\n * label=\"xx1\"\n * style={otherProps.style}\n * className={otherProps.className}\n * >\n * <Input />\n * </FormItemWrapper>\n * );\n * }}\n * </FormItemWrapperDependencies>\n *\n *\n * 说明:\n * 透传style、className 是因为在EasyForm内部的BoxGrid组件下发的style、className在配置了noStyle后Form.Item不接收导致的\n *\n * ```\n */\nexport const FormItemWrapperDependencies = (props: FormItemWrapperDependenciesProps) => {\n const { dependencies, ...otherProps } = props;\n return (\n <Form.Item dependencies={dependencies} noStyle>\n {(form) => {\n return props.children?.(form, {\n style: otherProps?.style,\n className: otherProps.className,\n });\n }}\n </Form.Item>\n );\n};\n"],"names":["FormItemWrapperDependencies","props","dependencies","otherProps","_objectWithoutPropertiesLoose","_excluded","_jsx","Form","Item","noStyle","children","form","style","className"],"mappings":";4JAkCaA,EAA8B,SAA9BA,EAA+BC,GAC1C,IAAQC,EAAgCD,EAAhCC,aAAiBC,EAAUC,EAAKH,EAAKI,GAC7C,OACEC,EAACC,EAAKC,KAAI,CAACN,aAAcA,EAAcO,QAAO,KAAAC,SAC3C,SAAAA,EAACC,GACA,OAAOV,EAAMS,UAAQ,UAAA,EAAdT,EAAMS,SAAWC,EAAM,CAC5BC,MAAOT,GAAAA,UAAAA,EAAAA,EAAYS,MACnBC,UAAWV,EAAWU,WAE1B,GAGN"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-item-wrapper-dependencies/dependencies.tsx"],"sourcesContent":["import { Form, type FormInstance } from 'antd';\nimport type { CSSProperties, ReactElement } from 'react';\nexport type FormItemWrapperDependenciesProps = {\n children?: (form: FormInstance, otherProps: { style?: CSSProperties; className?: string }) => ReactElement;\n dependencies: any[];\n className?: string;\n style?: CSSProperties;\n};\n/**\n * FormItem依赖写法包装,当处在EasyForm内部时,不支持 <Form.Item dependencies={['xxx']} noStyle /> 此写法,使用 <FormItemWrapperDependencies dependencies={['xxx']} /> 代替\n *\n * ```\n * 例如:(其中 otherProps 中 style、className透传是必要的)\n * <FormItemWrapperDependencies dependencies={['xx2']}>\n * {(_form, otherProps) => {\n * return (\n * <FormItemWrapper\n * name=\"xxxxx\"\n * label=\"xx1\"\n * style={otherProps.style}\n * className={otherProps.className}\n * >\n * <Input />\n * </FormItemWrapper>\n * );\n * }}\n * </FormItemWrapperDependencies>\n *\n *\n * 说明:\n * 透传style、className 是因为在EasyForm内部的BoxGrid组件下发的style、className在配置了noStyle后Form.Item不接收导致的\n *\n * ```\n */\nexport const FormItemWrapperDependencies = (props: FormItemWrapperDependenciesProps) => {\n const { dependencies, ...otherProps } = props;\n return (\n <Form.Item dependencies={dependencies} noStyle>\n {(form) => {\n return props.children?.(form, {\n style: otherProps?.style,\n className: otherProps.className,\n });\n }}\n </Form.Item>\n );\n};\n\nFormItemWrapperDependencies['domTypeName'] = 'FormItemWrapperDependencies';\n"],"names":["FormItemWrapperDependencies","props","dependencies","otherProps","_objectWithoutPropertiesLoose","_excluded","_jsx","Form","Item","noStyle","children","form","style","className"],"mappings":";4JAkCaA,EAA8B,SAA9BA,EAA+BC,GAC1C,IAAQC,EAAgCD,EAAhCC,aAAiBC,EAAUC,EAAKH,EAAKI,GAC7C,OACEC,EAACC,EAAKC,KAAI,CAACN,aAAcA,EAAcO,QAAO,KAAAC,SAC3C,SAAAA,EAACC,GACA,OAAOV,EAAMS,UAAQ,UAAA,EAAdT,EAAMS,SAAWC,EAAM,CAC5BC,MAAOT,GAAAA,UAAAA,EAAAA,EAAYS,MACnBC,UAAWV,EAAWU,WAE1B,GAGN,EAEAb,EAA4B,eAAiB"}
package/index.d.ts CHANGED
@@ -1542,7 +1542,6 @@ export type EasyFormProps = Omit<FormWrapperProps, "children"> & {
1542
1542
  * 10. 通过 forceColumn 可强制定义一行显示几列,不考虑响应式
1543
1543
  * 11. 通过 labelWidth 可控制Form内部所有label的宽度(可实现整齐效果)
1544
1544
  * 12. 自定义栅格占位格数,见下方`例如`
1545
- * 13. 内部直接子节点为 <Form.Item dependencies={['xxx']} noStyle /> 时,样式会有问题,可使用 <FormItemWrapperDependencies /> 代替,具体参考FormItemWrapperDependencies组件使用
1546
1545
 
1547
1546
  * 例如
1548
1547
  * <EasyForm column={3}>
@@ -3928,7 +3927,10 @@ export type FormItemWrapperDependenciesProps = {
3928
3927
  *
3929
3928
  * ```
3930
3929
  */
3931
- export declare const FormItemWrapperDependencies: (props: FormItemWrapperDependenciesProps) => import("react/jsx-runtime").JSX.Element;
3930
+ export declare const FormItemWrapperDependencies: {
3931
+ (props: FormItemWrapperDependenciesProps): import("react/jsx-runtime").JSX.Element;
3932
+ domTypeName: string;
3933
+ };
3932
3934
  export type FormListWrapperContentProps = {
3933
3935
  /** Form.List item fieldData */
3934
3936
  formListFieldData: FormListFieldData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatbiz/antd",
3
- "version": "4.5.39",
3
+ "version": "4.5.40",
4
4
  "description": "flat-biz ui components",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",