e4bf30f1817a38ab243c96d453cab957.json
15.3 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport { useMemo } from 'react';\nimport classNames from 'classnames';\nimport FieldForm, { List } from 'rc-field-form';\nimport { ConfigContext } from '../config-provider';\nimport { FormContext } from './context';\nimport useForm from './hooks/useForm';\nimport SizeContext, { SizeContextProvider } from '../config-provider/SizeContext';\n\nvar InternalForm = function InternalForm(props, ref) {\n var _classNames;\n\n var contextSize = React.useContext(SizeContext);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction,\n contextForm = _React$useContext.form;\n\n var customizePrefixCls = props.prefixCls,\n _props$className = props.className,\n className = _props$className === void 0 ? '' : _props$className,\n _props$size = props.size,\n size = _props$size === void 0 ? contextSize : _props$size,\n form = props.form,\n colon = props.colon,\n labelAlign = props.labelAlign,\n labelCol = props.labelCol,\n wrapperCol = props.wrapperCol,\n hideRequiredMark = props.hideRequiredMark,\n _props$layout = props.layout,\n layout = _props$layout === void 0 ? 'horizontal' : _props$layout,\n scrollToFirstError = props.scrollToFirstError,\n requiredMark = props.requiredMark,\n onFinishFailed = props.onFinishFailed,\n name = props.name,\n restFormProps = __rest(props, [\"prefixCls\", \"className\", \"size\", \"form\", \"colon\", \"labelAlign\", \"labelCol\", \"wrapperCol\", \"hideRequiredMark\", \"layout\", \"scrollToFirstError\", \"requiredMark\", \"onFinishFailed\", \"name\"]);\n\n var mergedRequiredMark = useMemo(function () {\n if (requiredMark !== undefined) {\n return requiredMark;\n }\n\n if (contextForm && contextForm.requiredMark !== undefined) {\n return contextForm.requiredMark;\n }\n\n if (hideRequiredMark) {\n return false;\n }\n\n return true;\n }, [hideRequiredMark, requiredMark, contextForm]);\n var prefixCls = getPrefixCls('form', customizePrefixCls);\n var formClassName = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(layout), true), _defineProperty(_classNames, \"\".concat(prefixCls, \"-hide-required-mark\"), mergedRequiredMark === false), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(size), size), _classNames), className);\n\n var _useForm = useForm(form),\n _useForm2 = _slicedToArray(_useForm, 1),\n wrapForm = _useForm2[0];\n\n var __INTERNAL__ = wrapForm.__INTERNAL__;\n __INTERNAL__.name = name;\n var formContextValue = useMemo(function () {\n return {\n name: name,\n labelAlign: labelAlign,\n labelCol: labelCol,\n wrapperCol: wrapperCol,\n vertical: layout === 'vertical',\n colon: colon,\n requiredMark: mergedRequiredMark,\n itemRef: __INTERNAL__.itemRef\n };\n }, [name, labelAlign, labelCol, wrapperCol, layout, colon, mergedRequiredMark]);\n React.useImperativeHandle(ref, function () {\n return wrapForm;\n });\n\n var onInternalFinishFailed = function onInternalFinishFailed(errorInfo) {\n if (onFinishFailed) {\n onFinishFailed(errorInfo);\n }\n\n if (scrollToFirstError && errorInfo.errorFields.length) {\n wrapForm.scrollToField(errorInfo.errorFields[0].name);\n }\n };\n\n return /*#__PURE__*/React.createElement(SizeContextProvider, {\n size: size\n }, /*#__PURE__*/React.createElement(FormContext.Provider, {\n value: formContextValue\n }, /*#__PURE__*/React.createElement(FieldForm, _extends({\n id: name\n }, restFormProps, {\n name: name,\n onFinishFailed: onInternalFinishFailed,\n form: wrapForm,\n className: formClassName\n }))));\n};\n\nvar Form = /*#__PURE__*/React.forwardRef(InternalForm);\nexport { useForm, List };\nexport default Form;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/form/Form.js"],"names":["_extends","_slicedToArray","_defineProperty","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","useMemo","classNames","FieldForm","List","ConfigContext","FormContext","useForm","SizeContext","SizeContextProvider","InternalForm","props","ref","_classNames","contextSize","useContext","_React$useContext","getPrefixCls","direction","contextForm","form","customizePrefixCls","prefixCls","_props$className","className","_props$size","size","colon","labelAlign","labelCol","wrapperCol","hideRequiredMark","_props$layout","layout","scrollToFirstError","requiredMark","onFinishFailed","name","restFormProps","mergedRequiredMark","undefined","formClassName","concat","_useForm","_useForm2","wrapForm","__INTERNAL__","formContextValue","vertical","itemRef","useImperativeHandle","onInternalFinishFailed","errorInfo","errorFields","scrollToField","createElement","Provider","value","id","Form","forwardRef"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,cAAP,MAA2B,sCAA3B;AACA,OAAOC,eAAP,MAA4B,uCAA5B;;AAEA,IAAIC,MAAM,GAAG,QAAQ,KAAKA,MAAb,IAAuB,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAClD,MAAIC,CAAC,GAAG,EAAR;;AAEA,OAAK,IAAIC,CAAT,IAAcH,CAAd,EAAiB;AACf,QAAII,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCP,CAArC,EAAwCG,CAAxC,KAA8CF,CAAC,CAACO,OAAF,CAAUL,CAAV,IAAe,CAAjE,EAAoED,CAAC,CAACC,CAAD,CAAD,GAAOH,CAAC,CAACG,CAAD,CAAR;AACrE;;AAED,MAAIH,CAAC,IAAI,IAAL,IAAa,OAAOI,MAAM,CAACK,qBAAd,KAAwC,UAAzD,EAAqE,KAAK,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AAA,EAAE,EAAErB;AADkD,GAAD,EAEpDC,aAFoD,EAErC;AAChBD,IAAAA,IAAI,EAAEA,IADU;AAEhBD,IAAAA,cAAc,EAAEe,sBAFA;AAGhB/B,IAAAA,IAAI,EAAEyB,QAHU;AAIhBrB,IAAAA,SAAS,EAAEiB;AAJK,GAFqC,CAAvC,CAFA,CAFI,CAApB;AAYD,CA3FD;;AA6FA,IAAIkB,IAAI,GAAG,aAAa3D,KAAK,CAAC4D,UAAN,CAAiBlD,YAAjB,CAAxB;AACA,SAASH,OAAT,EAAkBH,IAAlB;AACA,eAAeuD,IAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport { useMemo } from 'react';\nimport classNames from 'classnames';\nimport FieldForm, { List } from 'rc-field-form';\nimport { ConfigContext } from '../config-provider';\nimport { FormContext } from './context';\nimport useForm from './hooks/useForm';\nimport SizeContext, { SizeContextProvider } from '../config-provider/SizeContext';\n\nvar InternalForm = function InternalForm(props, ref) {\n var _classNames;\n\n var contextSize = React.useContext(SizeContext);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction,\n contextForm = _React$useContext.form;\n\n var customizePrefixCls = props.prefixCls,\n _props$className = props.className,\n className = _props$className === void 0 ? '' : _props$className,\n _props$size = props.size,\n size = _props$size === void 0 ? contextSize : _props$size,\n form = props.form,\n colon = props.colon,\n labelAlign = props.labelAlign,\n labelCol = props.labelCol,\n wrapperCol = props.wrapperCol,\n hideRequiredMark = props.hideRequiredMark,\n _props$layout = props.layout,\n layout = _props$layout === void 0 ? 'horizontal' : _props$layout,\n scrollToFirstError = props.scrollToFirstError,\n requiredMark = props.requiredMark,\n onFinishFailed = props.onFinishFailed,\n name = props.name,\n restFormProps = __rest(props, [\"prefixCls\", \"className\", \"size\", \"form\", \"colon\", \"labelAlign\", \"labelCol\", \"wrapperCol\", \"hideRequiredMark\", \"layout\", \"scrollToFirstError\", \"requiredMark\", \"onFinishFailed\", \"name\"]);\n\n var mergedRequiredMark = useMemo(function () {\n if (requiredMark !== undefined) {\n return requiredMark;\n }\n\n if (contextForm && contextForm.requiredMark !== undefined) {\n return contextForm.requiredMark;\n }\n\n if (hideRequiredMark) {\n return false;\n }\n\n return true;\n }, [hideRequiredMark, requiredMark, contextForm]);\n var prefixCls = getPrefixCls('form', customizePrefixCls);\n var formClassName = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(layout), true), _defineProperty(_classNames, \"\".concat(prefixCls, \"-hide-required-mark\"), mergedRequiredMark === false), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(size), size), _classNames), className);\n\n var _useForm = useForm(form),\n _useForm2 = _slicedToArray(_useForm, 1),\n wrapForm = _useForm2[0];\n\n var __INTERNAL__ = wrapForm.__INTERNAL__;\n __INTERNAL__.name = name;\n var formContextValue = useMemo(function () {\n return {\n name: name,\n labelAlign: labelAlign,\n labelCol: labelCol,\n wrapperCol: wrapperCol,\n vertical: layout === 'vertical',\n colon: colon,\n requiredMark: mergedRequiredMark,\n itemRef: __INTERNAL__.itemRef\n };\n }, [name, labelAlign, labelCol, wrapperCol, layout, colon, mergedRequiredMark]);\n React.useImperativeHandle(ref, function () {\n return wrapForm;\n });\n\n var onInternalFinishFailed = function onInternalFinishFailed(errorInfo) {\n if (onFinishFailed) {\n onFinishFailed(errorInfo);\n }\n\n if (scrollToFirstError && errorInfo.errorFields.length) {\n wrapForm.scrollToField(errorInfo.errorFields[0].name);\n }\n };\n\n return /*#__PURE__*/React.createElement(SizeContextProvider, {\n size: size\n }, /*#__PURE__*/React.createElement(FormContext.Provider, {\n value: formContextValue\n }, /*#__PURE__*/React.createElement(FieldForm, _extends({\n id: name\n }, restFormProps, {\n name: name,\n onFinishFailed: onInternalFinishFailed,\n form: wrapForm,\n className: formClassName\n }))));\n};\n\nvar Form = /*#__PURE__*/React.forwardRef(InternalForm);\nexport { useForm, List };\nexport default Form;"]},"metadata":{},"sourceType":"module"}