64d7d9bdd12af94d7b000f161fca3eeb.json
7.37 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nvar FormContext = /*#__PURE__*/React.createContext({\n triggerFormChange: function triggerFormChange() {},\n triggerFormFinish: function triggerFormFinish() {},\n registerForm: function registerForm() {},\n unregisterForm: function unregisterForm() {}\n});\n\nvar FormProvider = function FormProvider(_ref) {\n var validateMessages = _ref.validateMessages,\n onFormChange = _ref.onFormChange,\n onFormFinish = _ref.onFormFinish,\n children = _ref.children;\n var formContext = React.useContext(FormContext);\n var formsRef = React.useRef({});\n return /*#__PURE__*/React.createElement(FormContext.Provider, {\n value: _objectSpread(_objectSpread({}, formContext), {}, {\n validateMessages: _objectSpread(_objectSpread({}, formContext.validateMessages), validateMessages),\n // =========================================================\n // = Global Form Control =\n // =========================================================\n triggerFormChange: function triggerFormChange(name, changedFields) {\n if (onFormChange) {\n onFormChange(name, {\n changedFields: changedFields,\n forms: formsRef.current\n });\n }\n\n formContext.triggerFormChange(name, changedFields);\n },\n triggerFormFinish: function triggerFormFinish(name, values) {\n if (onFormFinish) {\n onFormFinish(name, {\n values: values,\n forms: formsRef.current\n });\n }\n\n formContext.triggerFormFinish(name, values);\n },\n registerForm: function registerForm(name, form) {\n if (name) {\n formsRef.current = _objectSpread(_objectSpread({}, formsRef.current), {}, _defineProperty({}, name, form));\n }\n\n formContext.registerForm(name, form);\n },\n unregisterForm: function unregisterForm(name) {\n var newForms = _objectSpread({}, formsRef.current);\n\n delete newForms[name];\n formsRef.current = newForms;\n formContext.unregisterForm(name);\n }\n })\n }, children);\n};\n\nexport { FormProvider };\nexport default FormContext;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-field-form/es/FormContext.js"],"names":["_defineProperty","_objectSpread","React","FormContext","createContext","triggerFormChange","triggerFormFinish","registerForm","unregisterForm","FormProvider","_ref","validateMessages","onFormChange","onFormFinish","children","formContext","useContext","formsRef","useRef","createElement","Provider","value","name","changedFields","forms","current","values","form","newForms"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,aAAP,MAA0B,0CAA1B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,IAAIC,WAAW,GAAG,aAAaD,KAAK,CAACE,aAAN,CAAoB;AACjDC,EAAAA,iBAAiB,EAAE,SAASA,iBAAT,GAA6B,CAAE,CADD;AAEjDC,EAAAA,iBAAiB,EAAE,SAASA,iBAAT,GAA6B,CAAE,CAFD;AAGjDC,EAAAA,YAAY,EAAE,SAASA,YAAT,GAAwB,CAAE,CAHS;AAIjDC,EAAAA,cAAc,EAAE,SAASA,cAAT,GAA0B,CAAE;AAJK,CAApB,CAA/B;;AAOA,IAAIC,YAAY,GAAG,SAASA,YAAT,CAAsBC,IAAtB,EAA4B;AAC7C,MAAIC,gBAAgB,GAAGD,IAAI,CAACC,gBAA5B;AAAA,MACIC,YAAY,GAAGF,IAAI,CAACE,YADxB;AAAA,MAEIC,YAAY,GAAGH,IAAI,CAACG,YAFxB;AAAA,MAGIC,QAAQ,GAAGJ,IAAI,CAACI,QAHpB;AAIA,MAAIC,WAAW,GAAGb,KAAK,CAACc,UAAN,CAAiBb,WAAjB,CAAlB;AACA,MAAIc,QAAQ,GAAGf,KAAK,CAACgB,MAAN,CAAa,EAAb,CAAf;AACA,SAAO,aAAahB,KAAK,CAACiB,aAAN,CAAoBhB,WAAW,CAACiB,QAAhC,EAA0C;AAC5DC,IAAAA,KAAK,EAAEpB,aAAa,CAACA,aAAa,CAAC,EAAD,EAAKc,WAAL,CAAd,EAAiC,EAAjC,EAAqC;AACvDJ,MAAAA,gBAAgB,EAAEV,aAAa,CAACA,aAAa,CAAC,EAAD,EAAKc,WAAW,CAACJ,gBAAjB,CAAd,EAAkDA,gBAAlD,CADwB;AAEvD;AACA;AACA;AACAN,MAAAA,iBAAiB,EAA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,OAAT,GAAmBG,QAAnB;AACAb,QAAAA,WAAW,CAACP,cAAZ,CAA2Bc,IAA3B;AACD;AAtCsD,KAArC;AADwC,GAA1C,EAyCjBR,QAzCiB,CAApB;AA0CD,CAjDD;;AAmDA,SAASL,YAAT;AACA,eAAeN,WAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nvar FormContext = /*#__PURE__*/React.createContext({\n triggerFormChange: function triggerFormChange() {},\n triggerFormFinish: function triggerFormFinish() {},\n registerForm: function registerForm() {},\n unregisterForm: function unregisterForm() {}\n});\n\nvar FormProvider = function FormProvider(_ref) {\n var validateMessages = _ref.validateMessages,\n onFormChange = _ref.onFormChange,\n onFormFinish = _ref.onFormFinish,\n children = _ref.children;\n var formContext = React.useContext(FormContext);\n var formsRef = React.useRef({});\n return /*#__PURE__*/React.createElement(FormContext.Provider, {\n value: _objectSpread(_objectSpread({}, formContext), {}, {\n validateMessages: _objectSpread(_objectSpread({}, formContext.validateMessages), validateMessages),\n // =========================================================\n // = Global Form Control =\n // =========================================================\n triggerFormChange: function triggerFormChange(name, changedFields) {\n if (onFormChange) {\n onFormChange(name, {\n changedFields: changedFields,\n forms: formsRef.current\n });\n }\n\n formContext.triggerFormChange(name, changedFields);\n },\n triggerFormFinish: function triggerFormFinish(name, values) {\n if (onFormFinish) {\n onFormFinish(name, {\n values: values,\n forms: formsRef.current\n });\n }\n\n formContext.triggerFormFinish(name, values);\n },\n registerForm: function registerForm(name, form) {\n if (name) {\n formsRef.current = _objectSpread(_objectSpread({}, formsRef.current), {}, _defineProperty({}, name, form));\n }\n\n formContext.registerForm(name, form);\n },\n unregisterForm: function unregisterForm(name) {\n var newForms = _objectSpread({}, formsRef.current);\n\n delete newForms[name];\n formsRef.current = newForms;\n formContext.unregisterForm(name);\n }\n })\n }, children);\n};\n\nexport { FormProvider };\nexport default FormContext;"]},"metadata":{},"sourceType":"module"}