@bioturing/components 0.42.0-beta.0 → 0.42.0
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/dist/components/form/FormItem/FormItemInput.js +1 -1
- package/dist/components/form/FormItem/FormItemInput.js.map +1 -1
- package/dist/components/form/FormItem/ItemHolder.js +3 -3
- package/dist/components/form/FormItem/ItemHolder.js.map +1 -1
- package/dist/components/form/FormItem/index.js +2 -2
- package/dist/components/form/FormItem/index.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as t, jsxs as I, Fragment as q } from "react/jsx-runtime";
|
|
3
3
|
import * as n from "react";
|
|
4
4
|
import { get as y, set as z } from "rc-util";
|
|
5
|
-
import J from "rc-util/
|
|
5
|
+
import J from "rc-util/es/hooks/useLayoutEffect";
|
|
6
6
|
import K from "antd/es/grid/col";
|
|
7
7
|
import { FormContext as H, FormItemPrefixContext as Q } from "antd/es/form/context";
|
|
8
8
|
import T from "antd/es/form/ErrorList";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormItemInput.js","sources":["../../../../src/components/form/FormItem/FormItemInput.tsx"],"sourcesContent":["/**\n * This file is copied from Ant Design 5.x-stable\n * Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItemInput.tsx\n *\n * Customizations for @bioturing/components:\n * - Added `classNames` prop for styling control, input, error, and extra elements\n *\n * Last synced with antd version: 5.x-stable (2025-02-04)\n */\n\n\"use client\";\n\nimport * as React from \"react\";\nimport type { JSX } from \"react\";\nimport { get, set } from \"rc-util\";\nimport useLayoutEffect from \"rc-util/lib/hooks/useLayoutEffect\";\n\n// ============ BioTuring Utils ============\nimport { clsx as classNames } from \"../../utils\";\n\n// ============ Ant Design Imports ============\nimport type { ColProps } from \"antd/es/grid/col\";\nimport Col from \"antd/es/grid/col\";\nimport { FormContext, FormItemPrefixContext } from \"antd/es/form/context\";\nimport ErrorList from \"antd/es/form/ErrorList\";\nimport type { ValidateStatus } from \"antd/es/form/FormItem\";\nimport FallbackCmp from \"antd/es/form/style/fallbackCmp\";\ninterface FormItemInputMiscProps {\n prefixCls: string;\n children: React.ReactNode;\n errors: React.ReactNode[];\n warnings: React.ReactNode[];\n marginBottom?: number | null;\n onErrorVisibleChanged?: (visible: boolean) => void;\n /** @internal do not use in any of your production. */\n _internalItemRender?: {\n mark: string;\n render: (\n props: FormItemInputProps & FormItemInputMiscProps,\n domList: {\n input: JSX.Element;\n errorList: JSX.Element | null;\n extra: JSX.Element | null;\n },\n ) => React.ReactNode;\n };\n}\n\nexport interface FormItemInputProps {\n labelCol?: ColProps;\n wrapperCol?: ColProps;\n extra?: React.ReactNode;\n status?: ValidateStatus;\n help?: React.ReactNode;\n fieldId?: string;\n label?: React.ReactNode;\n\n // ============ BioTuring Custom ============\n classNames?: {\n control?: string;\n controlInput?: string;\n controlInputContent?: string;\n additional?: string;\n explain?: string;\n extra?: string;\n };\n // ============ End Custom ============\n}\n\nconst GRID_MAX = 24;\n\nconst FormItemInput: React.FC<FormItemInputProps & FormItemInputMiscProps> = (\n props,\n) => {\n const {\n prefixCls,\n status,\n labelCol,\n wrapperCol,\n children,\n errors,\n warnings,\n _internalItemRender: formItemRender,\n extra,\n help,\n fieldId,\n marginBottom,\n onErrorVisibleChanged,\n label,\n // ============ BioTuring Custom: Extract classNames ============\n classNames: customClassNames,\n // ============ End Custom ============\n } = props;\n const baseClassName = `${prefixCls}-item`;\n\n const formContext = React.useContext(FormContext);\n\n const mergedWrapperCol = React.useMemo(() => {\n let mergedWrapper: ColProps = {\n ...(wrapperCol || formContext.wrapperCol || {}),\n };\n if (label === null && !labelCol && !wrapperCol && formContext.labelCol) {\n const list = [undefined, \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"xxl\"] as const;\n\n list.forEach((size) => {\n const _size = size ? [size] : [];\n\n const formLabel = get(formContext.labelCol, _size);\n const formLabelObj = typeof formLabel === \"object\" ? formLabel : {};\n\n const wrapper = get(mergedWrapper, _size);\n const wrapperObj = typeof wrapper === \"object\" ? wrapper : {};\n\n if (\n \"span\" in formLabelObj &&\n !(\"offset\" in wrapperObj) &&\n formLabelObj.span < GRID_MAX\n ) {\n mergedWrapper = set(\n mergedWrapper,\n [..._size, \"offset\"],\n formLabelObj.span,\n );\n }\n });\n }\n return mergedWrapper;\n }, [\n wrapperCol,\n formContext.wrapperCol,\n formContext.labelCol,\n label,\n labelCol,\n ]);\n\n // ============ BioTuring Custom: Apply control className ============\n const className = classNames(\n `${baseClassName}-control`,\n mergedWrapperCol.className,\n customClassNames?.control,\n );\n // ============ End Custom ============\n\n // Pass to sub FormItem should not with col info\n const subFormContext = React.useMemo(() => {\n const {\n labelCol: _labelCol,\n wrapperCol: _wrapperCol,\n ...rest\n } = formContext;\n return rest;\n }, [formContext]);\n\n const extraRef = React.useRef<HTMLDivElement>(null);\n const [extraHeight, setExtraHeight] = React.useState<number>(0);\n useLayoutEffect(() => {\n if (extra && extraRef.current) {\n setExtraHeight(extraRef.current.clientHeight);\n } else {\n setExtraHeight(0);\n }\n }, [extra]);\n\n // ============ BioTuring Custom: Apply input classNames ============\n const inputDom: React.ReactNode = (\n <div\n className={classNames(\n `${baseClassName}-control-input`,\n customClassNames?.controlInput,\n )}\n >\n <div\n className={classNames(\n `${baseClassName}-control-input-content`,\n customClassNames?.controlInputContent,\n )}\n >\n {children}\n </div>\n </div>\n );\n // ============ End Custom ============\n\n const formItemContext = React.useMemo(\n () => ({ prefixCls, status }),\n [prefixCls, status],\n );\n\n // ============ BioTuring Custom: Apply explain className ============\n const errorListDom: React.ReactNode =\n marginBottom !== null || errors.length || warnings.length ? (\n <FormItemPrefixContext.Provider value={formItemContext}>\n <ErrorList\n fieldId={fieldId}\n errors={errors}\n warnings={warnings}\n help={help}\n helpStatus={status}\n className={classNames(\n `${baseClassName}-explain-connected`,\n customClassNames?.explain,\n )}\n onVisibleChanged={onErrorVisibleChanged}\n />\n </FormItemPrefixContext.Provider>\n ) : null;\n // ============ End Custom ============\n\n const extraProps: { id?: string } = {};\n\n if (fieldId) {\n extraProps.id = `${fieldId}_extra`;\n }\n\n // If extra = 0, && will goes wrong\n // 0&&error -> 0\n // ============ BioTuring Custom: Apply extra className ============\n const extraDom: React.ReactNode = extra ? (\n <div\n {...extraProps}\n className={classNames(`${baseClassName}-extra`, customClassNames?.extra)}\n ref={extraRef}\n >\n {extra}\n </div>\n ) : null;\n // ============ End Custom ============\n\n // ============ BioTuring Custom: Apply additional className ============\n const additionalDom: React.ReactNode =\n errorListDom || extraDom ? (\n <div\n className={classNames(\n `${baseClassName}-additional`,\n customClassNames?.additional,\n )}\n style={marginBottom ? { minHeight: marginBottom + extraHeight } : {}}\n >\n {errorListDom}\n {extraDom}\n </div>\n ) : null;\n // ============ End Custom ============\n\n const dom: React.ReactNode =\n formItemRender &&\n formItemRender.mark === \"pro_table_render\" &&\n formItemRender.render ? (\n formItemRender.render(props, {\n input: inputDom,\n errorList: errorListDom,\n extra: extraDom,\n })\n ) : (\n <>\n {inputDom}\n {additionalDom}\n </>\n );\n return (\n <FormContext.Provider value={subFormContext}>\n <Col {...mergedWrapperCol} className={className}>\n {dom}\n </Col>\n <FallbackCmp prefixCls={prefixCls} />\n </FormContext.Provider>\n );\n};\n\nexport default FormItemInput;\n"],"names":["GRID_MAX","FormItemInput","props","prefixCls","status","labelCol","wrapperCol","children","errors","warnings","formItemRender","extra","help","fieldId","marginBottom","onErrorVisibleChanged","label","customClassNames","baseClassName","formContext","React","FormContext","mergedWrapperCol","mergedWrapper","size","_size","formLabel","get","formLabelObj","wrapper","wrapperObj","set","className","classNames","subFormContext","_labelCol","_wrapperCol","rest","extraRef","extraHeight","setExtraHeight","useLayoutEffect","inputDom","jsx","formItemContext","errorListDom","FormItemPrefixContext","ErrorList","extraProps","extraDom","additionalDom","jsxs","dom","Fragment","Col","FallbackCmp"],"mappings":";;;;;;;;;;AAqEA,MAAMA,IAAW,IAEX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IAAA;AAAA,EAAA,GAEtB,IACE,MAGAiC,IAA8B,CAAA;AAEpC,EAAInC,MACFmC,EAAW,KAAK,GAAGnC,CAAO;AAM5B,QAAMoC,IAA4BtC,IAChC,gBAAAgC;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGK;AAAA,MACJ,WAAWf,EAAW,GAAGf,CAAa,UAAUD,GAAkB,KAAK;AAAA,MACvE,KAAKqB;AAAA,MAEJ,UAAA3B;AAAA,IAAA;AAAA,EAAA,IAED,MAIEuC,IACJL,KAAgBI,IACd,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWlB;AAAAA,QACT,GAAGf,CAAa;AAAA,QAChBD,GAAkB;AAAA,MAAA;AAAA,MAEpB,OAAOH,IAAe,EAAE,WAAWA,IAAeyB,EAAA,IAAgB,CAAA;AAAA,MAEjE,UAAA;AAAA,QAAAM;AAAA,QACAI;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAED,MAGAG,IACJ1C,KACAA,EAAe,SAAS,sBACxBA,EAAe,SACbA,EAAe,OAAOR,GAAO;AAAA,IAC3B,OAAOwC;AAAA,IACP,WAAWG;AAAA,IACX,OAAOI;AAAA,EAAA,CACR,IAED,gBAAAE,EAAAE,GAAA,EACG,UAAA;AAAA,IAAAX;AAAA,IACAQ;AAAA,EAAA,GACH;AAEJ,SACE,gBAAAC,EAAC9B,EAAY,UAAZ,EAAqB,OAAOa,GAC3B,UAAA;AAAA,IAAA,gBAAAS,EAACW,GAAA,EAAK,GAAGhC,GAAkB,WAAAU,GACxB,UAAAoB,GACH;AAAA,IACA,gBAAAT,EAACY,KAAY,WAAApD,EAAA,CAAsB;AAAA,EAAA,GACrC;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"FormItemInput.js","sources":["../../../../src/components/form/FormItem/FormItemInput.tsx"],"sourcesContent":["/**\n * This file is copied from Ant Design 5.x-stable\n * Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItemInput.tsx\n *\n * Customizations for @bioturing/components:\n * - Added `classNames` prop for styling control, input, error, and extra elements\n *\n * Last synced with antd version: 5.x-stable (2025-02-04)\n */\n\n\"use client\";\n\nimport * as React from \"react\";\nimport type { JSX } from \"react\";\nimport { get, set } from \"rc-util\";\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\n\n// ============ BioTuring Utils ============\nimport { clsx as classNames } from \"../../utils\";\n\n// ============ Ant Design Imports ============\nimport type { ColProps } from \"antd/es/grid/col\";\nimport Col from \"antd/es/grid/col\";\nimport { FormContext, FormItemPrefixContext } from \"antd/es/form/context\";\nimport ErrorList from \"antd/es/form/ErrorList\";\nimport type { ValidateStatus } from \"antd/es/form/FormItem\";\nimport FallbackCmp from \"antd/es/form/style/fallbackCmp\";\ninterface FormItemInputMiscProps {\n prefixCls: string;\n children: React.ReactNode;\n errors: React.ReactNode[];\n warnings: React.ReactNode[];\n marginBottom?: number | null;\n onErrorVisibleChanged?: (visible: boolean) => void;\n /** @internal do not use in any of your production. */\n _internalItemRender?: {\n mark: string;\n render: (\n props: FormItemInputProps & FormItemInputMiscProps,\n domList: {\n input: JSX.Element;\n errorList: JSX.Element | null;\n extra: JSX.Element | null;\n },\n ) => React.ReactNode;\n };\n}\n\nexport interface FormItemInputProps {\n labelCol?: ColProps;\n wrapperCol?: ColProps;\n extra?: React.ReactNode;\n status?: ValidateStatus;\n help?: React.ReactNode;\n fieldId?: string;\n label?: React.ReactNode;\n\n // ============ BioTuring Custom ============\n classNames?: {\n control?: string;\n controlInput?: string;\n controlInputContent?: string;\n additional?: string;\n explain?: string;\n extra?: string;\n };\n // ============ End Custom ============\n}\n\nconst GRID_MAX = 24;\n\nconst FormItemInput: React.FC<FormItemInputProps & FormItemInputMiscProps> = (\n props,\n) => {\n const {\n prefixCls,\n status,\n labelCol,\n wrapperCol,\n children,\n errors,\n warnings,\n _internalItemRender: formItemRender,\n extra,\n help,\n fieldId,\n marginBottom,\n onErrorVisibleChanged,\n label,\n // ============ BioTuring Custom: Extract classNames ============\n classNames: customClassNames,\n // ============ End Custom ============\n } = props;\n const baseClassName = `${prefixCls}-item`;\n\n const formContext = React.useContext(FormContext);\n\n const mergedWrapperCol = React.useMemo(() => {\n let mergedWrapper: ColProps = {\n ...(wrapperCol || formContext.wrapperCol || {}),\n };\n if (label === null && !labelCol && !wrapperCol && formContext.labelCol) {\n const list = [undefined, \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"xxl\"] as const;\n\n list.forEach((size) => {\n const _size = size ? [size] : [];\n\n const formLabel = get(formContext.labelCol, _size);\n const formLabelObj = typeof formLabel === \"object\" ? formLabel : {};\n\n const wrapper = get(mergedWrapper, _size);\n const wrapperObj = typeof wrapper === \"object\" ? wrapper : {};\n\n if (\n \"span\" in formLabelObj &&\n !(\"offset\" in wrapperObj) &&\n formLabelObj.span < GRID_MAX\n ) {\n mergedWrapper = set(\n mergedWrapper,\n [..._size, \"offset\"],\n formLabelObj.span,\n );\n }\n });\n }\n return mergedWrapper;\n }, [\n wrapperCol,\n formContext.wrapperCol,\n formContext.labelCol,\n label,\n labelCol,\n ]);\n\n // ============ BioTuring Custom: Apply control className ============\n const className = classNames(\n `${baseClassName}-control`,\n mergedWrapperCol.className,\n customClassNames?.control,\n );\n // ============ End Custom ============\n\n // Pass to sub FormItem should not with col info\n const subFormContext = React.useMemo(() => {\n const {\n labelCol: _labelCol,\n wrapperCol: _wrapperCol,\n ...rest\n } = formContext;\n return rest;\n }, [formContext]);\n\n const extraRef = React.useRef<HTMLDivElement>(null);\n const [extraHeight, setExtraHeight] = React.useState<number>(0);\n useLayoutEffect(() => {\n if (extra && extraRef.current) {\n setExtraHeight(extraRef.current.clientHeight);\n } else {\n setExtraHeight(0);\n }\n }, [extra]);\n\n // ============ BioTuring Custom: Apply input classNames ============\n const inputDom: React.ReactNode = (\n <div\n className={classNames(\n `${baseClassName}-control-input`,\n customClassNames?.controlInput,\n )}\n >\n <div\n className={classNames(\n `${baseClassName}-control-input-content`,\n customClassNames?.controlInputContent,\n )}\n >\n {children}\n </div>\n </div>\n );\n // ============ End Custom ============\n\n const formItemContext = React.useMemo(\n () => ({ prefixCls, status }),\n [prefixCls, status],\n );\n\n // ============ BioTuring Custom: Apply explain className ============\n const errorListDom: React.ReactNode =\n marginBottom !== null || errors.length || warnings.length ? (\n <FormItemPrefixContext.Provider value={formItemContext}>\n <ErrorList\n fieldId={fieldId}\n errors={errors}\n warnings={warnings}\n help={help}\n helpStatus={status}\n className={classNames(\n `${baseClassName}-explain-connected`,\n customClassNames?.explain,\n )}\n onVisibleChanged={onErrorVisibleChanged}\n />\n </FormItemPrefixContext.Provider>\n ) : null;\n // ============ End Custom ============\n\n const extraProps: { id?: string } = {};\n\n if (fieldId) {\n extraProps.id = `${fieldId}_extra`;\n }\n\n // If extra = 0, && will goes wrong\n // 0&&error -> 0\n // ============ BioTuring Custom: Apply extra className ============\n const extraDom: React.ReactNode = extra ? (\n <div\n {...extraProps}\n className={classNames(`${baseClassName}-extra`, customClassNames?.extra)}\n ref={extraRef}\n >\n {extra}\n </div>\n ) : null;\n // ============ End Custom ============\n\n // ============ BioTuring Custom: Apply additional className ============\n const additionalDom: React.ReactNode =\n errorListDom || extraDom ? (\n <div\n className={classNames(\n `${baseClassName}-additional`,\n customClassNames?.additional,\n )}\n style={marginBottom ? { minHeight: marginBottom + extraHeight } : {}}\n >\n {errorListDom}\n {extraDom}\n </div>\n ) : null;\n // ============ End Custom ============\n\n const dom: React.ReactNode =\n formItemRender &&\n formItemRender.mark === \"pro_table_render\" &&\n formItemRender.render ? (\n formItemRender.render(props, {\n input: inputDom,\n errorList: errorListDom,\n extra: extraDom,\n })\n ) : (\n <>\n {inputDom}\n {additionalDom}\n </>\n );\n return (\n <FormContext.Provider value={subFormContext}>\n <Col {...mergedWrapperCol} className={className}>\n {dom}\n </Col>\n <FallbackCmp prefixCls={prefixCls} />\n </FormContext.Provider>\n );\n};\n\nexport default FormItemInput;\n"],"names":["GRID_MAX","FormItemInput","props","prefixCls","status","labelCol","wrapperCol","children","errors","warnings","formItemRender","extra","help","fieldId","marginBottom","onErrorVisibleChanged","label","customClassNames","baseClassName","formContext","React","FormContext","mergedWrapperCol","mergedWrapper","size","_size","formLabel","get","formLabelObj","wrapper","wrapperObj","set","className","classNames","subFormContext","_labelCol","_wrapperCol","rest","extraRef","extraHeight","setExtraHeight","useLayoutEffect","inputDom","jsx","formItemContext","errorListDom","FormItemPrefixContext","ErrorList","extraProps","extraDom","additionalDom","jsxs","dom","Fragment","Col","FallbackCmp"],"mappings":";;;;;;;;;;AAqEA,MAAMA,IAAW,IAEXC,KAAuE,CAC3EC,MACG;AACH,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,qBAAqBC;AAAA,IACrB,OAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,OAAAC;AAAA;AAAA,IAEA,YAAYC;AAAA;AAAA,EAAA,IAEVf,GACEgB,IAAgB,GAAGf,CAAS,SAE5BgB,IAAcC,EAAM,WAAWC,CAAW,GAE1CC,IAAmBF,EAAM,QAAQ,MAAM;AAC3C,QAAIG,IAA0B;AAAA,MAC5B,GAAIjB,KAAca,EAAY,cAAc,CAAA;AAAA,IAAC;AAE/C,WAAIH,MAAU,QAAQ,CAACX,KAAY,CAACC,KAAca,EAAY,YAC/C,CAAC,QAAW,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK,EAEvD,QAAQ,CAACK,MAAS;AACrB,YAAMC,IAAQD,IAAO,CAACA,CAAI,IAAI,CAAA,GAExBE,IAAYC,EAAIR,EAAY,UAAUM,CAAK,GAC3CG,IAAe,OAAOF,KAAc,WAAWA,IAAY,CAAA,GAE3DG,IAAUF,EAAIJ,GAAeE,CAAK,GAClCK,IAAa,OAAOD,KAAY,W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,UAAZ,EAAqB,OAAOa,GAC3B,UAAA;AAAA,IAAA,gBAAAS,EAACW,GAAA,EAAK,GAAGhC,GAAkB,WAAAU,GACxB,UAAAoB,GACH;AAAA,IACA,gBAAAT,EAACY,KAAY,WAAApD,EAAA,CAAsB;AAAA,EAAA,GACrC;AAEJ;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as y, jsx as s } from "react/jsx-runtime";
|
|
3
3
|
import * as p from "react";
|
|
4
|
-
import G from "rc-util/
|
|
5
|
-
import J from "rc-util/
|
|
6
|
-
import Q from "rc-util/
|
|
4
|
+
import G from "rc-util/es/Dom/isVisible";
|
|
5
|
+
import J from "rc-util/es/hooks/useLayoutEffect";
|
|
6
|
+
import Q from "rc-util/es/omit";
|
|
7
7
|
import { Row as X } from "antd/es/grid";
|
|
8
8
|
import { FormContext as Y, NoStyleItemContext as Z } from "antd/es/form/context";
|
|
9
9
|
import C from "antd/es/form/hooks/useDebounce";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemHolder.js","sources":["../../../../src/components/form/FormItem/ItemHolder.tsx"],"sourcesContent":["/**\n * This file is copied from Ant Design 5.x-stable\n * Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItem/ItemHolder.tsx\n * \n * Customizations for @bioturing/components:\n * - Added `classNames` prop support for styling sub-elements\n * - Pass custom props (optionalMark, requiredMark, labelRender) to FormItemLabel\n * \n * Last synced with antd version: 5.x-stable (2025-02-04)\n */\n\n\"use client\";\n\nimport * as React from 'react';\nimport type { Meta } from 'rc-field-form/lib/interface';\nimport isVisible from 'rc-util/lib/Dom/isVisible';\nimport useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';\nimport omit from 'rc-util/lib/omit';\n\n// ============ BioTuring Utils ============\nimport { clsx as classNames } from '../../utils';\n\n// ============ Ant Design Imports ============\nimport type { FormItemProps } from '.';\nimport { Row } from 'antd/es/grid';\nimport type { ReportMetaChange } from 'antd/es/form/context';\nimport { FormContext, NoStyleItemContext } from 'antd/es/form/context';\nimport useDebounce from 'antd/es/form/hooks/useDebounce';\nimport { getStatus } from 'antd/es/form/util';\nimport StatusProvider from 'antd/es/form/FormItem/StatusProvider';\n\n// ============ BioTuring Custom Imports ============\nimport FormItemInput from './FormItemInput';\nimport FormItemLabel from './FormItemLabel';\n\nexport interface ItemHolderProps extends FormItemProps {\n prefixCls: string;\n className?: string;\n rootClassName?: string;\n style?: React.CSSProperties;\n errors: React.ReactNode[];\n warnings: React.ReactNode[];\n meta: Meta;\n children?: React.ReactNode;\n fieldId?: string;\n isRequired?: boolean;\n onSubItemMetaChange: ReportMetaChange;\n \n // ============ BioTuring Custom Props ============\n classNames?: FormItemProps['classNames'];\n optionalMark?: FormItemProps['optionalMark'];\n requiredMark?: FormItemProps['requiredMark'];\n labelRender?: FormItemProps['labelRender'];\n // ============ End Custom Props ============\n}\n\nexport default function ItemHolder(props: ItemHolderProps) {\n const {\n prefixCls,\n className,\n rootClassName,\n style,\n help,\n errors,\n warnings,\n validateStatus,\n meta,\n hasFeedback,\n hidden,\n children,\n fieldId,\n required,\n isRequired,\n onSubItemMetaChange,\n layout: propsLayout,\n name,\n // ============ BioTuring Custom: Extract classNames ============\n classNames: customClassNames,\n optionalMark,\n requiredMark,\n labelRender,\n // ============ End Custom ============\n ...restProps\n } = props;\n\n const itemPrefixCls = `${prefixCls}-item`;\n const { requiredMark: contextRequiredMark, layout: formLayout } = React.useContext(FormContext);\n const layout = propsLayout || formLayout;\n\n const vertical = layout === 'vertical';\n\n // ======================== Margin ========================\n const itemRef = React.useRef<HTMLDivElement>(null);\n const debounceErrors = useDebounce(errors);\n const debounceWarnings = useDebounce(warnings);\n const hasHelp = help !== undefined && help !== null;\n const hasError = !!(hasHelp || errors.length || warnings.length);\n const isOnScreen = !!itemRef.current && isVisible(itemRef.current);\n const [marginBottom, setMarginBottom] = React.useState<number | null>(null);\n\n useLayoutEffect(() => {\n if (hasError && itemRef.current) {\n // The element must be part of the DOMTree to use getComputedStyle\n // https://stackoverflow.com/questions/35360711/getcomputedstyle-returns-a-cssstyledeclaration-but-all-properties-are-empty-on-a\n const itemStyle = getComputedStyle(itemRef.current);\n setMarginBottom(Number.parseInt(itemStyle.marginBottom, 10));\n }\n }, [hasError, isOnScreen]);\n\n const onErrorVisibleChanged = (nextVisible: boolean) => {\n if (!nextVisible) {\n setMarginBottom(null);\n }\n };\n\n // ======================== Status ========================\n\n const getValidateState = (isDebounce = false) => {\n const _errors = isDebounce ? debounceErrors : meta.errors;\n const _warnings = isDebounce ? debounceWarnings : meta.warnings;\n\n return getStatus(_errors, _warnings, meta, '', !!hasFeedback, validateStatus);\n };\n\n const mergedValidateStatus = getValidateState();\n\n // ======================== Render ========================\n // ============ BioTuring Custom: Apply root className ============\n const itemClassName = classNames(\n itemPrefixCls,\n className,\n rootClassName,\n customClassNames?.root,\n (hasHelp || debounceErrors.length || debounceWarnings.length) && `${itemPrefixCls}-with-help`,\n // Status\n mergedValidateStatus && hasFeedback && `${itemPrefixCls}-has-feedback`,\n mergedValidateStatus === 'success' && `${itemPrefixCls}-has-success`,\n mergedValidateStatus === 'warning' && `${itemPrefixCls}-has-warning`,\n mergedValidateStatus === 'error' && `${itemPrefixCls}-has-error`,\n mergedValidateStatus === 'validating' && `${itemPrefixCls}-is-validating`,\n hidden && `${itemPrefixCls}-hidden`,\n // Layout\n layout && `${itemPrefixCls}-${layout}`,\n );\n // ============ End Custom ============\n\n return (\n <div className={itemClassName} style={style} ref={itemRef}>\n {/* ============ BioTuring Custom: Apply row className ============ */}\n <Row\n className={classNames(`${itemPrefixCls}-row`, customClassNames?.row)}\n {...omit(restProps, [\n '_internalItemRender' as any,\n 'colon',\n 'dependencies',\n 'extra',\n 'fieldKey',\n 'getValueFromEvent',\n 'getValueProps',\n 'htmlFor',\n 'id', // It is deprecated because `htmlFor` is its replacement.\n 'initialValue',\n 'isListField',\n 'label',\n 'labelAlign',\n 'labelCol',\n 'labelWrap',\n 'messageVariables',\n 'name',\n 'normalize',\n 'noStyle',\n 'preserve',\n 'requiredMark',\n 'rules',\n 'shouldUpdate',\n 'trigger',\n 'tooltip',\n 'validateFirst',\n 'validateTrigger',\n 'valuePropName',\n 'wrapperCol',\n 'validateDebounce',\n ])}\n >\n {/* Label */}\n <FormItemLabel\n htmlFor={fieldId}\n {...props}\n requiredMark={requiredMark ?? contextRequiredMark}\n required={required ?? isRequired}\n prefixCls={prefixCls}\n vertical={vertical}\n classNames={customClassNames}\n optionalMark={optionalMark}\n labelRender={labelRender}\n />\n {/* Input Group */}\n <FormItemInput\n {...props}\n {...meta}\n errors={debounceErrors}\n warnings={debounceWarnings}\n prefixCls={prefixCls}\n status={mergedValidateStatus}\n help={help}\n marginBottom={marginBottom}\n onErrorVisibleChanged={onErrorVisibleChanged}\n classNames={customClassNames}\n >\n <NoStyleItemContext.Provider value={onSubItemMetaChange}>\n <StatusProvider\n prefixCls={prefixCls}\n meta={meta}\n errors={meta.errors}\n warnings={meta.warnings}\n hasFeedback={hasFeedback}\n // Already calculated\n validateStatus={mergedValidateStatus}\n name={name}\n >\n {children}\n </StatusProvider>\n </NoStyleItemContext.Provider>\n </FormItemInput>\n </Row>\n {/* ============ End Custom ============ */}\n\n {!!marginBottom && (\n <div\n className={`${itemPrefixCls}-margin-offset`}\n style={{\n marginBottom: -marginBottom,\n }}\n />\n )}\n </div>\n );\n}\n"],"names":["ItemHolder","props","prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange","propsLayout","name","customClassNames","optionalMark","requiredMark","labelRender","restProps","itemPrefixCls","contextRequiredMark","formLayout","React","FormContext","layout","vertical","itemRef","debounceErrors","useDebounce","debounceWarnings","hasHelp","hasError","isOnScreen","isVisible","marginBottom","setMarginBottom","useLayoutEffect","itemStyle","onErrorVisibleChanged","nextVisible","mergedValidateStatus","isDebounce","_errors","_warnings","getStatus","itemClassName","classNames","jsx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der.tsx"],"sourcesContent":["/**\n * This file is copied from Ant Design 5.x-stable\n * Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItem/ItemHolder.tsx\n * \n * Customizations for @bioturing/components:\n * - Added `classNames` prop support for styling sub-elements\n * - Pass custom props (optionalMark, requiredMark, labelRender) to FormItemLabel\n * \n * Last synced with antd version: 5.x-stable (2025-02-04)\n */\n\n\"use client\";\n\nimport * as React from 'react';\nimport type { Meta } from 'rc-field-form/lib/interface';\nimport isVisible from 'rc-util/es/Dom/isVisible';\nimport useLayoutEffect from 'rc-util/es/hooks/useLayoutEffect';\nimport omit from 'rc-util/es/omit';\n\n// ============ BioTuring Utils ============\nimport { clsx as classNames } from '../../utils';\n\n// ============ Ant Design Imports ============\nimport type { FormItemProps } from '.';\nimport { Row } from 'antd/es/grid';\nimport type { ReportMetaChange } from 'antd/es/form/context';\nimport { FormContext, NoStyleItemContext } from 'antd/es/form/context';\nimport useDebounce from 'antd/es/form/hooks/useDebounce';\nimport { getStatus } from 'antd/es/form/util';\nimport StatusProvider from 'antd/es/form/FormItem/StatusProvider';\n\n// ============ BioTuring Custom Imports ============\nimport FormItemInput from './FormItemInput';\nimport FormItemLabel from './FormItemLabel';\n\nexport interface ItemHolderProps extends FormItemProps {\n prefixCls: string;\n className?: string;\n rootClassName?: string;\n style?: React.CSSProperties;\n errors: React.ReactNode[];\n warnings: React.ReactNode[];\n meta: Meta;\n children?: React.ReactNode;\n fieldId?: string;\n isRequired?: boolean;\n onSubItemMetaChange: ReportMetaChange;\n \n // ============ BioTuring Custom Props ============\n classNames?: FormItemProps['classNames'];\n optionalMark?: FormItemProps['optionalMark'];\n requiredMark?: FormItemProps['requiredMark'];\n labelRender?: FormItemProps['labelRender'];\n // ============ End Custom Props ============\n}\n\nexport default function ItemHolder(props: ItemHolderProps) {\n const {\n prefixCls,\n className,\n rootClassName,\n style,\n help,\n errors,\n warnings,\n validateStatus,\n meta,\n hasFeedback,\n hidden,\n children,\n fieldId,\n required,\n isRequired,\n onSubItemMetaChange,\n layout: propsLayout,\n name,\n // ============ BioTuring Custom: Extract classNames ============\n classNames: customClassNames,\n optionalMark,\n requiredMark,\n labelRender,\n // ============ End Custom ============\n ...restProps\n } = props;\n\n const itemPrefixCls = `${prefixCls}-item`;\n const { requiredMark: contextRequiredMark, layout: formLayout } = React.useContext(FormContext);\n const layout = propsLayout || formLayout;\n\n const vertical = layout === 'vertical';\n\n // ======================== Margin ========================\n const itemRef = React.useRef<HTMLDivElement>(null);\n const debounceErrors = useDebounce(errors);\n const debounceWarnings = useDebounce(warnings);\n const hasHelp = help !== undefined && help !== null;\n const hasError = !!(hasHelp || errors.length || warnings.length);\n const isOnScreen = !!itemRef.current && isVisible(itemRef.current);\n const [marginBottom, setMarginBottom] = React.useState<number | null>(null);\n\n useLayoutEffect(() => {\n if (hasError && itemRef.current) {\n // The element must be part of the DOMTree to use getComputedStyle\n // https://stackoverflow.com/questions/35360711/getcomputedstyle-returns-a-cssstyledeclaration-but-all-properties-are-empty-on-a\n const itemStyle = getComputedStyle(itemRef.current);\n setMarginBottom(Number.parseInt(itemStyle.marginBottom, 10));\n }\n }, [hasError, isOnScreen]);\n\n const onErrorVisibleChanged = (nextVisible: boolean) => {\n if (!nextVisible) {\n setMarginBottom(null);\n }\n };\n\n // ======================== Status ========================\n\n const getValidateState = (isDebounce = false) => {\n const _errors = isDebounce ? debounceErrors : meta.errors;\n const _warnings = isDebounce ? debounceWarnings : meta.warnings;\n\n return getStatus(_errors, _warnings, meta, '', !!hasFeedback, validateStatus);\n };\n\n const mergedValidateStatus = getValidateState();\n\n // ======================== Render ========================\n // ============ BioTuring Custom: Apply root className ============\n const itemClassName = classNames(\n itemPrefixCls,\n className,\n rootClassName,\n customClassNames?.root,\n (hasHelp || debounceErrors.length || debounceWarnings.length) && `${itemPrefixCls}-with-help`,\n // Status\n mergedValidateStatus && hasFeedback && `${itemPrefixCls}-has-feedback`,\n mergedValidateStatus === 'success' && `${itemPrefixCls}-has-success`,\n mergedValidateStatus === 'warning' && `${itemPrefixCls}-has-warning`,\n mergedValidateStatus === 'error' && `${itemPrefixCls}-has-error`,\n mergedValidateStatus === 'validating' && `${itemPrefixCls}-is-validating`,\n hidden && `${itemPrefixCls}-hidden`,\n // Layout\n layout && `${itemPrefixCls}-${layout}`,\n );\n // ============ End Custom ============\n\n return (\n <div className={itemClassName} style={style} ref={itemRef}>\n {/* ============ BioTuring Custom: Apply row className ============ */}\n <Row\n className={classNames(`${itemPrefixCls}-row`, customClassNames?.row)}\n {...omit(restProps, [\n '_internalItemRender' as any,\n 'colon',\n 'dependencies',\n 'extra',\n 'fieldKey',\n 'getValueFromEvent',\n 'getValueProps',\n 'htmlFor',\n 'id', // It is deprecated because `htmlFor` is its replacement.\n 'initialValue',\n 'isListField',\n 'label',\n 'labelAlign',\n 'labelCol',\n 'labelWrap',\n 'messageVariables',\n 'name',\n 'normalize',\n 'noStyle',\n 'preserve',\n 'requiredMark',\n 'rules',\n 'shouldUpdate',\n 'trigger',\n 'tooltip',\n 'validateFirst',\n 'validateTrigger',\n 'valuePropName',\n 'wrapperCol',\n 'validateDebounce',\n ])}\n >\n {/* Label */}\n <FormItemLabel\n htmlFor={fieldId}\n {...props}\n requiredMark={requiredMark ?? contextRequiredMark}\n required={required ?? isRequired}\n prefixCls={prefixCls}\n vertical={vertical}\n classNames={customClassNames}\n optionalMark={optionalMark}\n labelRender={labelRender}\n />\n {/* Input Group */}\n <FormItemInput\n {...props}\n {...meta}\n errors={debounceErrors}\n warnings={debounceWarnings}\n prefixCls={prefixCls}\n status={mergedValidateStatus}\n help={help}\n marginBottom={marginBottom}\n onErrorVisibleChanged={onErrorVisibleChanged}\n classNames={customClassNames}\n >\n <NoStyleItemContext.Provider value={onSubItemMetaChange}>\n <StatusProvider\n prefixCls={prefixCls}\n meta={meta}\n errors={meta.errors}\n warnings={meta.warnings}\n hasFeedback={hasFeedback}\n // Already calculated\n validateStatus={mergedValidateStatus}\n name={name}\n >\n {children}\n </StatusProvider>\n </NoStyleItemContext.Provider>\n </FormItemInput>\n </Row>\n {/* ============ End Custom ============ */}\n\n {!!marginBottom && (\n <div\n className={`${itemPrefixCls}-margin-offset`}\n style={{\n marginBottom: -marginBottom,\n }}\n />\n )}\n </div>\n );\n}\n"],"names":["ItemHolder","props","prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange","propsLayout","name","customClassNames","optionalMark","requiredMark","labelRender","restProps","itemPrefixCls","contextRequiredMark","formLayout","React","FormContext","layout","vertical","itemRef","debounceErrors","useDebounce","debounceWarnings","hasHelp","hasError","isOnScreen","isVisible","marginBottom","setMarginBottom","useLayoutEffect","itemStyle","onErrorVisibleChanged","nextVisible","mergedValidateStatus","isDebounce","_errors","_warnings","getStatus","itemClassName","classNames","jsxs","Row","omit","jsx","FormItemLabel","FormItemInput","NoStyleItemContext","StatusProvider"],"mappings":";;;;;;;;;;;;;;AAwDA,SAAwBA,GAAWC,GAAwB;AACzD,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,MAAAC;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,QAAQC;AAAA,IACR,MAAAC;AAAA;AAAA,IAEA,YAAYC;AAAA,IACZ,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA;AAAA,IAEA,GAAGC;AAAA,EAAA,IACDvB,GAEEwB,IAAgB,GAAGvB,CAAS,SAC5B,EAAE,cAAcwB,GAAqB,QAAQC,MAAeC,EAAM,WAAWC,CAAW,GACxFC,IAASZ,KAAeS,GAExBI,IAAWD,MAAW,YA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AA1D;AAAA,kBACA,MAAAQ;AAAA,kBACA,QAAQA,EAAK;AAAA,kBACb,UAAUA,EAAK;AAAA,kBACf,aAAAC;AAAA,kBAEA,gBAAgBmC;AAAA,kBAChB,MAAA3B;AAAA,kBAEC,UAAAN;AAAA,gBAAA;AAAA,cAAA,EACH,CACF;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAID,CAAC,CAAC2B,KACD,gBAAAgB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,GAAG/B,CAAa;AAAA,QAC3B,OAAO;AAAA,UACL,cAAc,CAACe;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EACF,GAEJ;AAEJ;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as P } from "react/jsx-runtime";
|
|
3
3
|
import * as d from "react";
|
|
4
4
|
import { FieldContext as ue, ListContext as ce, Field as fe } from "rc-field-form";
|
|
5
|
-
import ge from "rc-util/
|
|
6
|
-
import { supportRef as pe } from "rc-util/
|
|
5
|
+
import ge from "rc-util/es/hooks/useState";
|
|
6
|
+
import { supportRef as pe } from "rc-util/es/ref";
|
|
7
7
|
import { cloneElement as he } from "antd/es/_util/reactNode";
|
|
8
8
|
import { devUseWarning as ye } from "antd/es/_util/warning";
|
|
9
9
|
import { ConfigContext as Ce } from "antd/es/config-provider";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/form/FormItem/index.tsx"],"sourcesContent":["/**\n * This file is copied from Ant Design 5.x-stable\n * Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItem/index.tsx\n * \n * Customizations for @bioturing/components:\n * - Added `classNames` prop for styling sub-elements (root, row, label, control, etc.)\n * - Added `optionalMark` prop to show optional indicator\n * - Added enhanced `requiredMark` support (boolean | ReactNode)\n * - Added `labelRender` prop for custom label rendering\n * \n * Last synced with antd version: 5.x-stable (2025-02-04)\n */\n\n\"use client\";\n\nimport * as React from 'react';\nimport type { JSX } from 'react';\nimport { Field, FieldContext, ListContext } from 'rc-field-form';\nimport type { FieldProps } from 'rc-field-form/lib/Field';\nimport type { InternalNamePath, Meta } from 'rc-field-form/lib/interface';\nimport useState from 'rc-util/lib/hooks/useState';\nimport { supportRef } from 'rc-util/lib/ref';\n\n// ============ BioTuring Utils ============\nimport { clsx as classNames } from '../../utils';\n\n// ============ Ant Design Imports (from antd/es) ============\nimport { cloneElement } from 'antd/es/_util/reactNode';\nimport { devUseWarning } from 'antd/es/_util/warning';\nimport { ConfigContext } from 'antd/es/config-provider';\nimport useCSSVarCls from 'antd/es/config-provider/hooks/useCSSVarCls';\nimport { FormContext, NoStyleItemContext } from 'antd/es/form/context';\nimport type { FormInstance, FormItemLayout } from 'antd/es/form/Form';\nimport type { FormItemInputProps } from 'antd/es/form/FormItemInput';\nimport type { FormItemLabelProps, LabelTooltipType } from 'antd/es/form/FormItemLabel';\nimport useChildren from 'antd/es/form/hooks/useChildren';\nimport useFormItemStatus from 'antd/es/form/hooks/useFormItemStatus';\nimport useFrameState from 'antd/es/form/hooks/useFrameState';\nimport useItemRef from 'antd/es/form/hooks/useItemRef';\nimport useStyle from 'antd/es/form/style';\nimport { getFieldId, toArray } from 'antd/es/form/util';\nimport StatusProvider from 'antd/es/form/FormItem/StatusProvider';\n\n// ============ BioTuring Custom Imports ============\nimport ItemHolder from './ItemHolder';\nimport type { ItemHolderProps } from './ItemHolder';\n\nconst NAME_SPLIT = '__SPLIT__';\n\ninterface FieldError {\n errors: string[];\n warnings: string[];\n}\n\nconst _ValidateStatuses = ['success', 'warning', 'error', 'validating', ''] as const;\nexport type ValidateStatus = (typeof _ValidateStatuses)[number];\n\ntype RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;\ntype RcFieldProps<Values = any> = Omit<FieldProps<Values>, 'children'>;\ntype ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;\n\nexport type FeedbackIcons = (itemStatus: {\n status: ValidateStatus;\n errors?: React.ReactNode[];\n warnings?: React.ReactNode[];\n}) => { [key in ValidateStatus]?: React.ReactNode };\n\ninterface MemoInputProps {\n control: object;\n update: any;\n children: React.ReactNode;\n childProps: any[];\n}\n\n// https://github.com/ant-design/ant-design/issues/46417\n// `getValueProps` may modify the value props name,\n// we should check if the control is similar.\nfunction isSimilarControl(a: object, b: object) {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n return (\n keysA.length === keysB.length &&\n keysA.every((key) => {\n const propValueA = (a as any)[key];\n const propValueB = (b as any)[key];\n\n return (\n propValueA === propValueB ||\n typeof propValueA === 'function' ||\n typeof propValueB === 'function'\n );\n })\n );\n}\n\nconst MemoInput = React.memo(\n ({ children }: MemoInputProps) => children as JSX.Element,\n (prev, next) =>\n isSimilarControl(prev.control, next.control) &&\n prev.update === next.update &&\n prev.childProps.length === next.childProps.length &&\n prev.childProps.every((value, index) => value === next.childProps[index]),\n);\n\nexport interface FormItemProps<Values = any>\n extends Omit<FormItemLabelProps, 'requiredMark'>,\n FormItemInputProps,\n RcFieldProps<Values> {\n prefixCls?: string;\n noStyle?: boolean;\n style?: React.CSSProperties;\n className?: string;\n rootClassName?: string;\n children?: ChildrenType<Values>;\n id?: string;\n hasFeedback?: boolean | { icons: FeedbackIcons };\n validateStatus?: ValidateStatus;\n required?: boolean;\n hidden?: boolean;\n initialValue?: any;\n messageVariables?: Record<string, string>;\n tooltip?: LabelTooltipType;\n /** @deprecated No need anymore */\n fieldKey?: React.Key | React.Key[];\n layout?: FormItemLayout;\n \n // ============ BioTuring Custom Props ============\n /**\n * Custom class names for different parts of the form item\n * @custom BioTuring addition\n */\n classNames?: {\n /** Class name for the form item root wrapper */\n root?: string;\n /** Class name for the row container */\n row?: string;\n /** Class name for the label column wrapper */\n label?: string;\n /** Class name for the label text element */\n labelText?: string;\n /** Class name for the label tooltip icon */\n labelIcon?: string;\n /** Class name for the control/input wrapper column */\n control?: string;\n /** Class name for the control input wrapper */\n controlInput?: string;\n /** Class name for the control input content */\n controlInputContent?: string;\n /** Class name for the additional wrapper (errors + extra) */\n additional?: string;\n /** Class name for the error/help message wrapper */\n explain?: string;\n /** Class name for the extra text wrapper */\n extra?: string;\n /** Class name for the feedback icon */\n feedbackIcon?: string;\n };\n \n /**\n * Whether to show the optional mark\n * @default false\n * @custom BioTuring addition\n */\n optionalMark?: boolean | React.ReactNode;\n \n /**\n * Custom required mark (enhanced from antd to support ReactNode)\n * @default true\n * @custom BioTuring addition - enhanced to support ReactNode\n */\n requiredMark?: boolean | React.ReactNode;\n \n /**\n * Custom render function for the label\n * @custom BioTuring addition\n */\n labelRender?: (label: React.ReactElement) => React.ReactElement;\n // ============ End Custom Props ============\n}\n\nfunction genEmptyMeta(): Meta {\n return {\n errors: [],\n warnings: [],\n touched: false,\n validating: false,\n name: [],\n validated: false,\n };\n}\n\nfunction InternalFormItem<Values = any>(props: FormItemProps<Values>): React.ReactElement {\n const {\n name,\n noStyle,\n className,\n dependencies,\n prefixCls: customizePrefixCls,\n shouldUpdate,\n rules,\n children,\n required,\n label,\n messageVariables,\n trigger = 'onChange',\n validateTrigger,\n hidden,\n help,\n layout,\n // ============ BioTuring Custom: Extract custom props ============\n classNames: customClassNames,\n optionalMark,\n requiredMark,\n labelRender,\n // ============ End Custom ============\n } = props;\n const { getPrefixCls } = React.useContext(ConfigContext);\n const { name: formName } = React.useContext(FormContext);\n\n const mergedChildren = useChildren(children);\n\n const isRenderProps = typeof mergedChildren === 'function';\n const notifyParentMetaChange = React.useContext(NoStyleItemContext);\n\n const { validateTrigger: contextValidateTrigger } = React.useContext(FieldContext);\n const mergedValidateTrigger =\n validateTrigger !== undefined ? validateTrigger : contextValidateTrigger;\n\n const hasName = !(name === undefined || name === null);\n\n const prefixCls = getPrefixCls('form', customizePrefixCls);\n\n // Style\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n\n // ========================= Warn =========================\n const warning = devUseWarning('Form.Item');\n\n if (process.env.NODE_ENV !== 'production') {\n warning(name !== null, 'usage', '`null` is passed as `name` property');\n }\n\n // ========================= MISC =========================\n // Get `noStyle` required info\n const listContext = React.useContext(ListContext);\n const fieldKeyPathRef = React.useRef<InternalNamePath>(null);\n\n // ======================== Errors ========================\n // >>>>> Collect sub field errors\n const [subFieldErrors, setSubFieldErrors] = useFrameState<Record<string, FieldError>>({});\n\n // >>>>> Current field errors\n const [meta, setMeta] = useState<Meta>(() => genEmptyMeta());\n\n const onMetaChange = (nextMeta: Meta & { destroy?: boolean }) => {\n // This keyInfo is not correct when field is removed\n // Since origin keyManager no longer keep the origin key anymore\n // Which means we need cache origin one and reuse when removed\n const keyInfo = listContext?.getKey(nextMeta.name);\n\n // Destroy will reset all the meta\n setMeta(nextMeta.destroy ? genEmptyMeta() : nextMeta, true);\n\n // Bump to parent since noStyle\n if (noStyle && help !== false && notifyParentMetaChange) {\n let namePath = nextMeta.name;\n\n if (!nextMeta.destroy) {\n if (keyInfo !== undefined) {\n const [fieldKey, restPath] = keyInfo;\n namePath = [fieldKey, ...restPath];\n fieldKeyPathRef.current = namePath;\n }\n } else {\n // Use origin cache data\n namePath = fieldKeyPathRef.current || namePath;\n }\n notifyParentMetaChange(nextMeta, namePath);\n }\n };\n\n // >>>>> Collect noStyle Field error to the top FormItem\n const onSubItemMetaChange: ItemHolderProps['onSubItemMetaChange'] = (subMeta, uniqueKeys) => {\n // Only `noStyle` sub item will trigger\n setSubFieldErrors((prevSubFieldErrors) => {\n const clone = {\n ...prevSubFieldErrors,\n };\n\n // name: ['user', 1] + key: [4] = ['user', 4]\n const mergedNamePath = [...subMeta.name.slice(0, -1), ...uniqueKeys];\n const mergedNameKey = mergedNamePath.join(NAME_SPLIT);\n\n if ((subMeta as any).destroy) {\n // Remove\n delete clone[mergedNameKey];\n } else {\n // Update\n clone[mergedNameKey] = subMeta;\n }\n\n return clone;\n });\n };\n\n // >>>>> Get merged errors\n const [mergedErrors, mergedWarnings] = React.useMemo(() => {\n const errorList: string[] = [...meta.errors];\n const warningList: string[] = [...meta.warnings];\n\n Object.values(subFieldErrors).forEach((subFieldError) => {\n errorList.push(...(subFieldError.errors || []));\n warningList.push(...(subFieldError.warnings || []));\n });\n\n return [errorList, warningList];\n }, [subFieldErrors, meta.errors, meta.warnings]);\n\n // ===================== Children Ref =====================\n const getItemRef = useItemRef();\n\n // ======================== Render ========================\n function renderLayout(\n baseChildren: React.ReactNode,\n fieldId?: string,\n isRequired?: boolean,\n ): React.ReactNode {\n if (noStyle && !hidden) {\n return (\n <StatusProvider\n prefixCls={prefixCls}\n hasFeedback={props.hasFeedback}\n validateStatus={props.validateStatus}\n meta={meta}\n errors={mergedErrors}\n warnings={mergedWarnings}\n noStyle\n name={name}\n >\n {baseChildren}\n </StatusProvider>\n );\n }\n\n // ============ BioTuring Custom: Pass custom props to ItemHolder ============\n return (\n <ItemHolder\n key=\"row\"\n {...props}\n className={classNames(className, cssVarCls, rootCls, hashId)}\n prefixCls={prefixCls}\n fieldId={fieldId}\n isRequired={isRequired}\n errors={mergedErrors}\n warnings={mergedWarnings}\n meta={meta}\n onSubItemMetaChange={onSubItemMetaChange}\n layout={layout}\n name={name}\n classNames={customClassNames}\n optionalMark={optionalMark}\n requiredMark={requiredMark}\n labelRender={labelRender}\n >\n {baseChildren}\n </ItemHolder>\n );\n // ============ End Custom ============\n }\n\n if (!hasName && !isRenderProps && !dependencies) {\n return wrapCSSVar(renderLayout(mergedChildren) as JSX.Element);\n }\n\n let variables: Record<string, string> = {};\n if (typeof label === 'string') {\n variables.label = label;\n } else if (name) {\n variables.label = String(name);\n }\n if (messageVariables) {\n variables = { ...variables, ...messageVariables };\n }\n\n // >>>>> With Field\n return wrapCSSVar(\n <Field\n {...props}\n messageVariables={variables}\n trigger={trigger}\n validateTrigger={mergedValidateTrigger}\n onMetaChange={onMetaChange}\n >\n {(control, renderMeta, context) => {\n const mergedName = toArray(name).length && renderMeta ? renderMeta.name : [];\n const fieldId = getFieldId(mergedName, formName);\n\n const isRequired =\n required !== undefined\n ? required\n : !!rules?.some((rule) => {\n if (rule && typeof rule === 'object' && rule.required && !rule.warningOnly) {\n return true;\n }\n if (typeof rule === 'function') {\n const ruleEntity = rule(context);\n return ruleEntity?.required && !ruleEntity?.warningOnly;\n }\n return false;\n });\n\n // ======================= Children =======================\n const mergedControl: typeof control = {\n ...control,\n };\n\n let childNode: React.ReactNode = null;\n\n warning(\n !(shouldUpdate && dependencies),\n 'usage',\n \"`shouldUpdate` and `dependencies` shouldn't be used together. See https://u.ant.design/form-deps.\",\n );\n if (Array.isArray(mergedChildren) && hasName) {\n warning(\n false,\n 'usage',\n 'A `Form.Item` with a `name` prop must have a single child element. For information on how to render more complex form items, see https://u.ant.design/complex-form-item.',\n );\n childNode = mergedChildren;\n } else if (isRenderProps && (!(shouldUpdate || dependencies) || hasName)) {\n warning(\n !!(shouldUpdate || dependencies),\n 'usage',\n 'A `Form.Item` with a render function must have either `shouldUpdate` or `dependencies`.',\n );\n warning(\n !hasName,\n 'usage',\n 'A `Form.Item` with a render function cannot be a field, and thus cannot have a `name` prop.',\n );\n } else if (dependencies && !isRenderProps && !hasName) {\n warning(\n false,\n 'usage',\n 'Must set `name` or use a render function when `dependencies` is set.',\n );\n } else if (React.isValidElement<{ defaultValue?: any }>(mergedChildren)) {\n warning(\n mergedChildren.props.defaultValue === undefined,\n 'usage',\n '`defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.',\n );\n\n const childProps: React.ReactElement<any>['props'] = {\n ...mergedChildren.props,\n ...mergedControl,\n };\n\n if (!childProps.id) {\n childProps.id = fieldId;\n }\n\n if (help || mergedErrors.length > 0 || mergedWarnings.length > 0 || props.extra) {\n const describedbyArr = [];\n if (help || mergedErrors.length > 0) {\n describedbyArr.push(`${fieldId}_help`);\n }\n if (props.extra) {\n describedbyArr.push(`${fieldId}_extra`);\n }\n childProps['aria-describedby'] = describedbyArr.join(' ');\n }\n\n if (mergedErrors.length > 0) {\n childProps['aria-invalid'] = 'true';\n }\n\n if (isRequired) {\n childProps['aria-required'] = 'true';\n }\n\n if (supportRef(mergedChildren)) {\n childProps.ref = getItemRef(mergedName, mergedChildren);\n }\n\n // We should keep user origin event handler\n const triggers = new Set<string>([\n ...toArray(trigger),\n ...toArray(mergedValidateTrigger),\n ]);\n\n triggers.forEach((eventName) => {\n childProps[eventName] = (...args: any[]) => {\n mergedControl[eventName]?.(...args);\n (mergedChildren as React.ReactElement<any>).props[eventName]?.(...args);\n };\n });\n\n // List of props that need to be watched for changes -> if changes are detected in MemoInput -> rerender\n const watchingChildProps = [\n childProps['aria-required'],\n childProps['aria-invalid'],\n childProps['aria-describedby'],\n ];\n\n childNode = (\n <MemoInput\n control={mergedControl}\n update={mergedChildren}\n childProps={watchingChildProps}\n >\n {cloneElement(mergedChildren, childProps)}\n </MemoInput>\n );\n } else if (isRenderProps && (shouldUpdate || dependencies) && !hasName) {\n childNode = mergedChildren(context as any);\n } else {\n warning(\n !mergedName.length || !!noStyle,\n 'usage',\n '`name` is only used for validate React element. If you are using Form.Item as layout display, please remove `name` instead.',\n );\n childNode = mergedChildren as React.ReactNode;\n }\n\n return renderLayout(childNode, fieldId, isRequired);\n }}\n </Field>,\n );\n}\n\ntype InternalFormItemType = typeof InternalFormItem;\n\ntype CompoundedComponent = InternalFormItemType & {\n useStatus: typeof useFormItemStatus;\n};\n\nconst FormItem = InternalFormItem as CompoundedComponent;\nFormItem.useStatus = useFormItemStatus;\n\nexport default FormItem;\n"],"names":["NAME_SPLIT","isSimilarControl","a","b","keysA","keysB","key","propValueA","propValueB","MemoInput","React","children","prev","next","value","index","genEmptyMeta","InternalFormItem","props","name","noStyle","className","dependencies","customizePrefixCls","shouldUpdate","rules","required","label","messageVariables","trigger","validateTrigger","hidden","help","layout","customClassNames","optionalMark","requiredMark","labelRender","getPrefixCls","ConfigContext","formName","FormContext","mergedChildren","useChildren","isRenderProps","notifyParentMetaChange","NoStyleItemContext","contextValidateTrigger","FieldContext","mergedValidateTrigger","hasName","prefixCls","rootCls","useCSSVarCls","wrapCSSVar","hashId","cssVarCls","useStyle","warning","devUseWarning","listContext","ListContext","fieldKeyPathRef","subFieldErrors","setSubFieldErrors","useFrameState","meta","setMeta","useState","onMetaChange","nextMeta","keyInfo","namePath","fieldKey","restPath","onSubItemMetaChange","subMeta","uniqueKeys","prevSubFieldErrors","clone","mergedNameKey","mergedErrors","mergedWarnings","errorList","warningList","subFieldError","getItemRef","useItemRef","renderLayout","baseChildren","fieldId","isRequired","jsx","StatusProvider","ItemHolder","classNames","variables","Field","control","renderMeta","context","mergedName","toArray","getFieldId","rule","ruleEntity","mergedControl","childNode","childProps","describedbyArr","supportRef","eventName","args","watchingChildProps","cloneElement","FormItem","useFormItemStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+CA,MAAMA,KAAa;AA8BnB,SAASC,GAAiBC,GAAWC,GAAW;AAC9C,QAAMC,IAAQ,OAAO,KAAKF,CAAC,GACrBG,IAAQ,OAAO,KAAKF,CAAC;AAE3B,SACEC,EAAM,WAAWC,EAAM,UACvBD,EAAM,MAAM,CAACE,MAAQ;AACnB,UAAMC,IAAcL,EAAUI,CAAG,GAC3BE,IAAcL,EAAUG,CAAG;AAEjC,WACEC,MAAeC,KACf,OAAOD,KAAe,cACtB,OAAOC,KAAe;AAAA,EAE1B,CAAC;AAEL;AAEA,MAAMC,KAAYC,EAAM;AAAA,EACtB,CAAC,EAAE,UAAAC,EAAA,MAA+BA;AAAA,EAClC,CAACC,GAAMC,MACLZ,GAAiBW,EAAK,SAASC,EAAK,OAAO,KAC3CD,EAAK,WAAWC,EAAK,UACrBD,EAAK,WAAW,WAAWC,EAAK,WAAW,UAC3CD,EAAK,WAAW,MAAM,CAACE,GAAOC,MAAUD,MAAUD,EAAK,WAAWE,CAAK,CAAC;AAC5E;AA8EA,SAASC,IAAqB;AAC5B,SAAO;AAAA,IACL,QAAQ,CAAA;AAAA,IACR,UAAU,CAAA;AAAA,IACV,SAAS;AAA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A;AAAA,UAAA,GAEFuF,IAAYjE;AAGd,iBAAO8C,EAAamB,GAAWjB,GAASC,CAAU;AAAA,QACpD;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAQA,MAAMwB,KAAWlG;AACjBkG,GAAS,YAAYC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/form/FormItem/index.tsx"],"sourcesContent":["/**\n * This file is copied from Ant Design 5.x-stable\n * Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItem/index.tsx\n * \n * Customizations for @bioturing/components:\n * - Added `classNames` prop for styling sub-elements (root, row, label, control, etc.)\n * - Added `optionalMark` prop to show optional indicator\n * - Added enhanced `requiredMark` support (boolean | ReactNode)\n * - Added `labelRender` prop for custom label rendering\n * \n * Last synced with antd version: 5.x-stable (2025-02-04)\n */\n\n\"use client\";\n\nimport * as React from 'react';\nimport type { JSX } from 'react';\nimport { Field, FieldContext, ListContext } from 'rc-field-form';\nimport type { FieldProps } from 'rc-field-form/lib/Field';\nimport type { InternalNamePath, Meta } from 'rc-field-form/lib/interface';\nimport useState from 'rc-util/es/hooks/useState';\nimport { supportRef } from 'rc-util/es/ref';\n\n// ============ BioTuring Utils ============\nimport { clsx as classNames } from '../../utils';\n\n// ============ Ant Design Imports (from antd/es) ============\nimport { cloneElement } from 'antd/es/_util/reactNode';\nimport { devUseWarning } from 'antd/es/_util/warning';\nimport { ConfigContext } from 'antd/es/config-provider';\nimport useCSSVarCls from 'antd/es/config-provider/hooks/useCSSVarCls';\nimport { FormContext, NoStyleItemContext } from 'antd/es/form/context';\nimport type { FormInstance, FormItemLayout } from 'antd/es/form/Form';\nimport type { FormItemInputProps } from 'antd/es/form/FormItemInput';\nimport type { FormItemLabelProps, LabelTooltipType } from 'antd/es/form/FormItemLabel';\nimport useChildren from 'antd/es/form/hooks/useChildren';\nimport useFormItemStatus from 'antd/es/form/hooks/useFormItemStatus';\nimport useFrameState from 'antd/es/form/hooks/useFrameState';\nimport useItemRef from 'antd/es/form/hooks/useItemRef';\nimport useStyle from 'antd/es/form/style';\nimport { getFieldId, toArray } from 'antd/es/form/util';\nimport StatusProvider from 'antd/es/form/FormItem/StatusProvider';\n\n// ============ BioTuring Custom Imports ============\nimport ItemHolder from './ItemHolder';\nimport type { ItemHolderProps } from './ItemHolder';\n\nconst NAME_SPLIT = '__SPLIT__';\n\ninterface FieldError {\n errors: string[];\n warnings: string[];\n}\n\nconst _ValidateStatuses = ['success', 'warning', 'error', 'validating', ''] as const;\nexport type ValidateStatus = (typeof _ValidateStatuses)[number];\n\ntype RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;\ntype RcFieldProps<Values = any> = Omit<FieldProps<Values>, 'children'>;\ntype ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;\n\nexport type FeedbackIcons = (itemStatus: {\n status: ValidateStatus;\n errors?: React.ReactNode[];\n warnings?: React.ReactNode[];\n}) => { [key in ValidateStatus]?: React.ReactNode };\n\ninterface MemoInputProps {\n control: object;\n update: any;\n children: React.ReactNode;\n childProps: any[];\n}\n\n// https://github.com/ant-design/ant-design/issues/46417\n// `getValueProps` may modify the value props name,\n// we should check if the control is similar.\nfunction isSimilarControl(a: object, b: object) {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n return (\n keysA.length === keysB.length &&\n keysA.every((key) => {\n const propValueA = (a as any)[key];\n const propValueB = (b as any)[key];\n\n return (\n propValueA === propValueB ||\n typeof propValueA === 'function' ||\n typeof propValueB === 'function'\n );\n })\n );\n}\n\nconst MemoInput = React.memo(\n ({ children }: MemoInputProps) => children as JSX.Element,\n (prev, next) =>\n isSimilarControl(prev.control, next.control) &&\n prev.update === next.update &&\n prev.childProps.length === next.childProps.length &&\n prev.childProps.every((value, index) => value === next.childProps[index]),\n);\n\nexport interface FormItemProps<Values = any>\n extends Omit<FormItemLabelProps, 'requiredMark'>,\n FormItemInputProps,\n RcFieldProps<Values> {\n prefixCls?: string;\n noStyle?: boolean;\n style?: React.CSSProperties;\n className?: string;\n rootClassName?: string;\n children?: ChildrenType<Values>;\n id?: string;\n hasFeedback?: boolean | { icons: FeedbackIcons };\n validateStatus?: ValidateStatus;\n required?: boolean;\n hidden?: boolean;\n initialValue?: any;\n messageVariables?: Record<string, string>;\n tooltip?: LabelTooltipType;\n /** @deprecated No need anymore */\n fieldKey?: React.Key | React.Key[];\n layout?: FormItemLayout;\n \n // ============ BioTuring Custom Props ============\n /**\n * Custom class names for different parts of the form item\n * @custom BioTuring addition\n */\n classNames?: {\n /** Class name for the form item root wrapper */\n root?: string;\n /** Class name for the row container */\n row?: string;\n /** Class name for the label column wrapper */\n label?: string;\n /** Class name for the label text element */\n labelText?: string;\n /** Class name for the label tooltip icon */\n labelIcon?: string;\n /** Class name for the control/input wrapper column */\n control?: string;\n /** Class name for the control input wrapper */\n controlInput?: string;\n /** Class name for the control input content */\n controlInputContent?: string;\n /** Class name for the additional wrapper (errors + extra) */\n additional?: string;\n /** Class name for the error/help message wrapper */\n explain?: string;\n /** Class name for the extra text wrapper */\n extra?: string;\n /** Class name for the feedback icon */\n feedbackIcon?: string;\n };\n \n /**\n * Whether to show the optional mark\n * @default false\n * @custom BioTuring addition\n */\n optionalMark?: boolean | React.ReactNode;\n \n /**\n * Custom required mark (enhanced from antd to support ReactNode)\n * @default true\n * @custom BioTuring addition - enhanced to support ReactNode\n */\n requiredMark?: boolean | React.ReactNode;\n \n /**\n * Custom render function for the label\n * @custom BioTuring addition\n */\n labelRender?: (label: React.ReactElement) => React.ReactElement;\n // ============ End Custom Props ============\n}\n\nfunction genEmptyMeta(): Meta {\n return {\n errors: [],\n warnings: [],\n touched: false,\n validating: false,\n name: [],\n validated: false,\n };\n}\n\nfunction InternalFormItem<Values = any>(props: FormItemProps<Values>): React.ReactElement {\n const {\n name,\n noStyle,\n className,\n dependencies,\n prefixCls: customizePrefixCls,\n shouldUpdate,\n rules,\n children,\n required,\n label,\n messageVariables,\n trigger = 'onChange',\n validateTrigger,\n hidden,\n help,\n layout,\n // ============ BioTuring Custom: Extract custom props ============\n classNames: customClassNames,\n optionalMark,\n requiredMark,\n labelRender,\n // ============ End Custom ============\n } = props;\n const { getPrefixCls } = React.useContext(ConfigContext);\n const { name: formName } = React.useContext(FormContext);\n\n const mergedChildren = useChildren(children);\n\n const isRenderProps = typeof mergedChildren === 'function';\n const notifyParentMetaChange = React.useContext(NoStyleItemContext);\n\n const { validateTrigger: contextValidateTrigger } = React.useContext(FieldContext);\n const mergedValidateTrigger =\n validateTrigger !== undefined ? validateTrigger : contextValidateTrigger;\n\n const hasName = !(name === undefined || name === null);\n\n const prefixCls = getPrefixCls('form', customizePrefixCls);\n\n // Style\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n\n // ========================= Warn =========================\n const warning = devUseWarning('Form.Item');\n\n if (process.env.NODE_ENV !== 'production') {\n warning(name !== null, 'usage', '`null` is passed as `name` property');\n }\n\n // ========================= MISC =========================\n // Get `noStyle` required info\n const listContext = React.useContext(ListContext);\n const fieldKeyPathRef = React.useRef<InternalNamePath>(null);\n\n // ======================== Errors ========================\n // >>>>> Collect sub field errors\n const [subFieldErrors, setSubFieldErrors] = useFrameState<Record<string, FieldError>>({});\n\n // >>>>> Current field errors\n const [meta, setMeta] = useState<Meta>(() => genEmptyMeta());\n\n const onMetaChange = (nextMeta: Meta & { destroy?: boolean }) => {\n // This keyInfo is not correct when field is removed\n // Since origin keyManager no longer keep the origin key anymore\n // Which means we need cache origin one and reuse when removed\n const keyInfo = listContext?.getKey(nextMeta.name);\n\n // Destroy will reset all the meta\n setMeta(nextMeta.destroy ? genEmptyMeta() : nextMeta, true);\n\n // Bump to parent since noStyle\n if (noStyle && help !== false && notifyParentMetaChange) {\n let namePath = nextMeta.name;\n\n if (!nextMeta.destroy) {\n if (keyInfo !== undefined) {\n const [fieldKey, restPath] = keyInfo;\n namePath = [fieldKey, ...restPath];\n fieldKeyPathRef.current = namePath;\n }\n } else {\n // Use origin cache data\n namePath = fieldKeyPathRef.current || namePath;\n }\n notifyParentMetaChange(nextMeta, namePath);\n }\n };\n\n // >>>>> Collect noStyle Field error to the top FormItem\n const onSubItemMetaChange: ItemHolderProps['onSubItemMetaChange'] = (subMeta, uniqueKeys) => {\n // Only `noStyle` sub item will trigger\n setSubFieldErrors((prevSubFieldErrors) => {\n const clone = {\n ...prevSubFieldErrors,\n };\n\n // name: ['user', 1] + key: [4] = ['user', 4]\n const mergedNamePath = [...subMeta.name.slice(0, -1), ...uniqueKeys];\n const mergedNameKey = mergedNamePath.join(NAME_SPLIT);\n\n if ((subMeta as any).destroy) {\n // Remove\n delete clone[mergedNameKey];\n } else {\n // Update\n clone[mergedNameKey] = subMeta;\n }\n\n return clone;\n });\n };\n\n // >>>>> Get merged errors\n const [mergedErrors, mergedWarnings] = React.useMemo(() => {\n const errorList: string[] = [...meta.errors];\n const warningList: string[] = [...meta.warnings];\n\n Object.values(subFieldErrors).forEach((subFieldError) => {\n errorList.push(...(subFieldError.errors || []));\n warningList.push(...(subFieldError.warnings || []));\n });\n\n return [errorList, warningList];\n }, [subFieldErrors, meta.errors, meta.warnings]);\n\n // ===================== Children Ref =====================\n const getItemRef = useItemRef();\n\n // ======================== Render ========================\n function renderLayout(\n baseChildren: React.ReactNode,\n fieldId?: string,\n isRequired?: boolean,\n ): React.ReactNode {\n if (noStyle && !hidden) {\n return (\n <StatusProvider\n prefixCls={prefixCls}\n hasFeedback={props.hasFeedback}\n validateStatus={props.validateStatus}\n meta={meta}\n errors={mergedErrors}\n warnings={mergedWarnings}\n noStyle\n name={name}\n >\n {baseChildren}\n </StatusProvider>\n );\n }\n\n // ============ BioTuring Custom: Pass custom props to ItemHolder ============\n return (\n <ItemHolder\n key=\"row\"\n {...props}\n className={classNames(className, cssVarCls, rootCls, hashId)}\n prefixCls={prefixCls}\n fieldId={fieldId}\n isRequired={isRequired}\n errors={mergedErrors}\n warnings={mergedWarnings}\n meta={meta}\n onSubItemMetaChange={onSubItemMetaChange}\n layout={layout}\n name={name}\n classNames={customClassNames}\n optionalMark={optionalMark}\n requiredMark={requiredMark}\n labelRender={labelRender}\n >\n {baseChildren}\n </ItemHolder>\n );\n // ============ End Custom ============\n }\n\n if (!hasName && !isRenderProps && !dependencies) {\n return wrapCSSVar(renderLayout(mergedChildren) as JSX.Element);\n }\n\n let variables: Record<string, string> = {};\n if (typeof label === 'string') {\n variables.label = label;\n } else if (name) {\n variables.label = String(name);\n }\n if (messageVariables) {\n variables = { ...variables, ...messageVariables };\n }\n\n // >>>>> With Field\n return wrapCSSVar(\n <Field\n {...props}\n messageVariables={variables}\n trigger={trigger}\n validateTrigger={mergedValidateTrigger}\n onMetaChange={onMetaChange}\n >\n {(control, renderMeta, context) => {\n const mergedName = toArray(name).length && renderMeta ? renderMeta.name : [];\n const fieldId = getFieldId(mergedName, formName);\n\n const isRequired =\n required !== undefined\n ? required\n : !!rules?.some((rule) => {\n if (rule && typeof rule === 'object' && rule.required && !rule.warningOnly) {\n return true;\n }\n if (typeof rule === 'function') {\n const ruleEntity = rule(context);\n return ruleEntity?.required && !ruleEntity?.warningOnly;\n }\n return false;\n });\n\n // ======================= Children =======================\n const mergedControl: typeof control = {\n ...control,\n };\n\n let childNode: React.ReactNode = null;\n\n warning(\n !(shouldUpdate && dependencies),\n 'usage',\n \"`shouldUpdate` and `dependencies` shouldn't be used together. See https://u.ant.design/form-deps.\",\n );\n if (Array.isArray(mergedChildren) && hasName) {\n warning(\n false,\n 'usage',\n 'A `Form.Item` with a `name` prop must have a single child element. For information on how to render more complex form items, see https://u.ant.design/complex-form-item.',\n );\n childNode = mergedChildren;\n } else if (isRenderProps && (!(shouldUpdate || dependencies) || hasName)) {\n warning(\n !!(shouldUpdate || dependencies),\n 'usage',\n 'A `Form.Item` with a render function must have either `shouldUpdate` or `dependencies`.',\n );\n warning(\n !hasName,\n 'usage',\n 'A `Form.Item` with a render function cannot be a field, and thus cannot have a `name` prop.',\n );\n } else if (dependencies && !isRenderProps && !hasName) {\n warning(\n false,\n 'usage',\n 'Must set `name` or use a render function when `dependencies` is set.',\n );\n } else if (React.isValidElement<{ defaultValue?: any }>(mergedChildren)) {\n warning(\n mergedChildren.props.defaultValue === undefined,\n 'usage',\n '`defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.',\n );\n\n const childProps: React.ReactElement<any>['props'] = {\n ...mergedChildren.props,\n ...mergedControl,\n };\n\n if (!childProps.id) {\n childProps.id = fieldId;\n }\n\n if (help || mergedErrors.length > 0 || mergedWarnings.length > 0 || props.extra) {\n const describedbyArr = [];\n if (help || mergedErrors.length > 0) {\n describedbyArr.push(`${fieldId}_help`);\n }\n if (props.extra) {\n describedbyArr.push(`${fieldId}_extra`);\n }\n childProps['aria-describedby'] = describedbyArr.join(' ');\n }\n\n if (mergedErrors.length > 0) {\n childProps['aria-invalid'] = 'true';\n }\n\n if (isRequired) {\n childProps['aria-required'] = 'true';\n }\n\n if (supportRef(mergedChildren)) {\n childProps.ref = getItemRef(mergedName, mergedChildren);\n }\n\n // We should keep user origin event handler\n const triggers = new Set<string>([\n ...toArray(trigger),\n ...toArray(mergedValidateTrigger),\n ]);\n\n triggers.forEach((eventName) => {\n childProps[eventName] = (...args: any[]) => {\n mergedControl[eventName]?.(...args);\n (mergedChildren as React.ReactElement<any>).props[eventName]?.(...args);\n };\n });\n\n // List of props that need to be watched for changes -> if changes are detected in MemoInput -> rerender\n const watchingChildProps = [\n childProps['aria-required'],\n childProps['aria-invalid'],\n childProps['aria-describedby'],\n ];\n\n childNode = (\n <MemoInput\n control={mergedControl}\n update={mergedChildren}\n childProps={watchingChildProps}\n >\n {cloneElement(mergedChildren, childProps)}\n </MemoInput>\n );\n } else if (isRenderProps && (shouldUpdate || dependencies) && !hasName) {\n childNode = mergedChildren(context as any);\n } else {\n warning(\n !mergedName.length || !!noStyle,\n 'usage',\n '`name` is only used for validate React element. If you are using Form.Item as layout display, please remove `name` instead.',\n );\n childNode = mergedChildren as React.ReactNode;\n }\n\n return renderLayout(childNode, fieldId, isRequired);\n }}\n </Field>,\n );\n}\n\ntype InternalFormItemType = typeof InternalFormItem;\n\ntype CompoundedComponent = InternalFormItemType & {\n useStatus: typeof useFormItemStatus;\n};\n\nconst FormItem = InternalFormItem as CompoundedComponent;\nFormItem.useStatus = useFormItemStatus;\n\nexport default FormItem;\n"],"names":["NAME_SPLIT","isSimilarControl","a","b","keysA","keysB","key","propValueA","propValueB","MemoInput","React","children","prev","next","value","index","genEmptyMeta","InternalFormItem","props","name","noStyle","className","dependencies","customizePrefixCls","shouldUpdate","rules","required","label","messageVariables","trigger","validateTrigger","hidden","help","layout","customClassNames","optionalMark","requiredMark","labelRender","getPrefixCls","ConfigContext","formName","FormContext","mergedChildren","useChildren","isRenderProps","notifyParentMetaChange","NoStyleItemContext","contextValidateTrigger","FieldContext","mergedValidateTrigger","hasName","prefixCls","rootCls","useCSSVarCls","wrapCSSVar","hashId","cssVarCls","useStyle","warning","devUseWarning","listContext","ListContext","fieldKeyPathRef","subFieldErrors","setSubFieldErrors","useFrameState","meta","setMeta","useState","onMetaChange","nextMeta","keyInfo","namePath","fieldKey","restPath","onSubItemMetaChange","subMeta","uniqueKeys","prevSubFieldErrors","clone","mergedNameKey","mergedErrors","mergedWarnings","errorList","warningList","subFieldError","getItemRef","useItemRef","renderLayout","baseChildren","fieldId","isRequired","jsx","StatusProvider","ItemHolder","classNames","variables","Field","control","renderMeta","context","mergedName","toArray","getFieldId","rule","ruleEntity","mergedControl","childNode","childProps","describedbyArr","supportRef","eventName","args","watchingChildProps","cloneElement","FormItem","useFormItemStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+CA,MAAMA,KAAa;AA8BnB,SAASC,GAAiBC,GAAWC,GAAW;AAC9C,QAAMC,IAAQ,OAAO,KAAKF,CAAC,GACrBG,IAAQ,OAAO,KAAKF,CAAC;AAE3B,SACEC,EAAM,WAAWC,EAAM,UACvBD,EAAM,MAAM,CAACE,MAAQ;AACnB,UAAMC,IA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