976326eb64bf822bccde49533132e527.json 2.93 KB
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/typeof\";\nimport * as React from 'react';\nimport { composeRef } from \"rc-util/es/ref\";\nimport { FormContext } from '../context';\nexport default function useItemRef() {\n  var _React$useContext = React.useContext(FormContext),\n      itemRef = _React$useContext.itemRef;\n\n  var cacheRef = React.useRef({});\n\n  function getRef(name, children) {\n    var childrenRef = children && _typeof(children) === 'object' && children.ref;\n    var nameStr = name.join('_');\n\n    if (cacheRef.current.name !== nameStr || cacheRef.current.originRef !== childrenRef) {\n      cacheRef.current.name = nameStr;\n      cacheRef.current.originRef = childrenRef;\n      cacheRef.current.ref = composeRef(itemRef(name), childrenRef);\n    }\n\n    return cacheRef.current.ref;\n  }\n\n  return getRef;\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/form/hooks/useItemRef.js"],"names":["_typeof","React","composeRef","FormContext","useItemRef","_React$useContext","useContext","itemRef","cacheRef","useRef","getRef","name","children","childrenRef","ref","nameStr","join","current","originRef"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,+BAApB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,QAA2B,gBAA3B;AACA,SAASC,WAAT,QAA4B,YAA5B;AACA,eAAe,SAASC,UAAT,GAAsB;AACnC,MAAIC,iBAAiB,GAAGJ,KAAK,CAACK,UAAN,CAAiBH,WAAjB,CAAxB;AAAA,MACII,OAAO,GAAGF,iBAAiB,CAACE,OADhC;;AAGA,MAAIC,QAAQ,GAAGP,KAAK,CAACQ,MAAN,CAAa,EAAb,CAAf;;AAEA,WAASC,MAAT,CAAgBC,IAAhB,EAAsBC,QAAtB,EAAgC;AAC9B,QAAIC,WAAW,GAAGD,QAAQ,IAAIZ,OAAO,CAACY,QAAD,CAAP,KAAsB,QAAlC,IAA8CA,QAAQ,CAACE,GAAzE;AACA,QAAIC,OAAO,GAAGJ,IAAI,CAACK,IAAL,CAAU,GAAV,CAAd;;AAEA,QAAIR,QAAQ,CAACS,OAAT,CAAiBN,IAAjB,KAA0BI,OAA1B,IAAqCP,QAAQ,CAACS,OAAT,CAAiBC,SAAjB,KAA+BL,WAAxE,EAAqF;AACnFL,MAAAA,QAAQ,CAACS,OAAT,CAAiBN,IAAjB,GAAwBI,OAAxB;AACAP,MAAAA,QAAQ,CAACS,OAAT,CAAiBC,SAAjB,GAA6BL,WAA7B;AACAL,MAAAA,QAAQ,CAACS,OAAT,CAAiBH,GAAjB,GAAuBZ,UAAU,CAACK,OAAO,CAACI,IAAD,CAAR,EAAgBE,WAAhB,CAAjC;AACD;;AAED,WAAOL,QAAQ,CAACS,OAAT,CAAiBH,GAAxB;AACD;;AAED,SAAOJ,MAAP;AACD","sourcesContent":["import _typeof from \"@babel/runtime/helpers/typeof\";\nimport * as React from 'react';\nimport { composeRef } from \"rc-util/es/ref\";\nimport { FormContext } from '../context';\nexport default function useItemRef() {\n  var _React$useContext = React.useContext(FormContext),\n      itemRef = _React$useContext.itemRef;\n\n  var cacheRef = React.useRef({});\n\n  function getRef(name, children) {\n    var childrenRef = children && _typeof(children) === 'object' && children.ref;\n    var nameStr = name.join('_');\n\n    if (cacheRef.current.name !== nameStr || cacheRef.current.originRef !== childrenRef) {\n      cacheRef.current.name = nameStr;\n      cacheRef.current.originRef = childrenRef;\n      cacheRef.current.ref = composeRef(itemRef(name), childrenRef);\n    }\n\n    return cacheRef.current.ref;\n  }\n\n  return getRef;\n}"]},"metadata":{},"sourceType":"module"}