7640bc7373ca777ee3e115d40a3c47fb.json 15.3 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\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 classNames from 'classnames';\nimport QuestionCircleOutlined from '@ant-design/icons/QuestionCircleOutlined';\nimport Col from '../grid/col';\nimport { FormContext } from './context';\nimport { useLocaleReceiver } from '../locale-provider/LocaleReceiver';\nimport defaultLocale from '../locale/default';\nimport Tooltip from '../tooltip';\n\nfunction toTooltipProps(tooltip) {\n  if (!tooltip) {\n    return null;\n  }\n\n  if (_typeof(tooltip) === 'object' && ! /*#__PURE__*/React.isValidElement(tooltip)) {\n    return tooltip;\n  }\n\n  return {\n    title: tooltip\n  };\n}\n\nvar FormItemLabel = function FormItemLabel(_ref) {\n  var prefixCls = _ref.prefixCls,\n      label = _ref.label,\n      htmlFor = _ref.htmlFor,\n      labelCol = _ref.labelCol,\n      labelAlign = _ref.labelAlign,\n      colon = _ref.colon,\n      required = _ref.required,\n      requiredMark = _ref.requiredMark,\n      tooltip = _ref.tooltip;\n\n  var _useLocaleReceiver = useLocaleReceiver('Form'),\n      _useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),\n      formLocale = _useLocaleReceiver2[0];\n\n  if (!label) return null;\n  return /*#__PURE__*/React.createElement(FormContext.Consumer, {\n    key: \"label\"\n  }, function (_ref2) {\n    var _classNames;\n\n    var vertical = _ref2.vertical,\n        contextLabelAlign = _ref2.labelAlign,\n        contextLabelCol = _ref2.labelCol,\n        contextColon = _ref2.colon;\n\n    var _a;\n\n    var mergedLabelCol = labelCol || contextLabelCol || {};\n    var mergedLabelAlign = labelAlign || contextLabelAlign;\n    var labelClsBasic = \"\".concat(prefixCls, \"-item-label\");\n    var labelColClassName = classNames(labelClsBasic, mergedLabelAlign === 'left' && \"\".concat(labelClsBasic, \"-left\"), mergedLabelCol.className);\n    var labelChildren = label; // Keep label is original where there should have no colon\n\n    var computedColon = colon === true || contextColon !== false && colon !== false;\n    var haveColon = computedColon && !vertical; // Remove duplicated user input colon\n\n    if (haveColon && typeof label === 'string' && label.trim() !== '') {\n      labelChildren = label.replace(/[:|:]\\s*$/, '');\n    } // Tooltip\n\n\n    var tooltipProps = toTooltipProps(tooltip);\n\n    if (tooltipProps) {\n      var _tooltipProps$icon = tooltipProps.icon,\n          icon = _tooltipProps$icon === void 0 ? /*#__PURE__*/React.createElement(QuestionCircleOutlined, null) : _tooltipProps$icon,\n          restTooltipProps = __rest(tooltipProps, [\"icon\"]);\n\n      var tooltipNode = /*#__PURE__*/React.createElement(Tooltip, restTooltipProps, /*#__PURE__*/React.cloneElement(icon, {\n        className: \"\".concat(prefixCls, \"-item-tooltip\")\n      }));\n      labelChildren = /*#__PURE__*/React.createElement(React.Fragment, null, labelChildren, tooltipNode);\n    } // Add required mark if optional\n\n\n    if (requiredMark === 'optional' && !required) {\n      labelChildren = /*#__PURE__*/React.createElement(React.Fragment, null, labelChildren, /*#__PURE__*/React.createElement(\"span\", {\n        className: \"\".concat(prefixCls, \"-item-optional\")\n      }, (formLocale === null || formLocale === void 0 ? void 0 : formLocale.optional) || ((_a = defaultLocale.Form) === null || _a === void 0 ? void 0 : _a.optional)));\n    }\n\n    var labelClassName = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-required\"), required), _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-required-mark-optional\"), requiredMark === 'optional'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-no-colon\"), !computedColon), _classNames));\n    return /*#__PURE__*/React.createElement(Col, _extends({}, mergedLabelCol, {\n      className: labelColClassName\n    }), /*#__PURE__*/React.createElement(\"label\", {\n      htmlFor: htmlFor,\n      className: labelClassName,\n      title: typeof label === 'string' ? label : ''\n    }, labelChildren));\n  });\n};\n\nexport default FormItemLabel;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/form/FormItemLabel.js"],"names":["_extends","_defineProperty","_slicedToArray","_typeof","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","classNames","QuestionCircleOutlined","Col","FormContext","useLocaleReceiver","defaultLocale","Tooltip","toTooltipProps","tooltip","isValidElement","title","FormItemLabel","_ref","prefixCls","label","htmlFor","labelCol","labelAlign","colon","required","requiredMark","_useLocaleReceiver","_useLocaleReceiver2","formLocale","createElement","Consumer","key","_ref2","_classNames","vertical","contextLabelAlign","contextLabelCol","contextColon","_a","mergedLabelCol","mergedLabelAlign","labelClsBasic","concat","labelColClassName","className","labelChildren","computedColon","haveColon","trim","replace","tooltipProps","_tooltipProps$icon","icon","restTooltipProps","tooltipNode","cloneElement","Fragment","optional","Form","labelClassName"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,cAAP,MAA2B,sCAA3B;AACA,OAAOC,OAAP,MAAoB,+BAApB;;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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B,KAAK,CAACyB,aAAN,CAAoBtB,GAApB,EAAyBrB,QAAQ,CAAC,EAAD,EAAKqD,cAAL,EAAqB;AACxEK,MAAAA,SAAS,EAAED;AAD6D,KAArB,CAAjC,EAEhB,aAAavC,KAAK,CAACyB,aAAN,CAAoB,OAApB,EAA6B;AAC5CT,MAAAA,OAAO,EAAEA,OADmC;AAE5CwB,MAAAA,SAAS,EAAEe,cAFiC;AAG5C5C,MAAAA,KAAK,EAAE,OAAOI,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoC;AAHC,KAA7B,EAId0B,aAJc,CAFG,CAApB;AAOD,GAtDmB,CAApB;AAuDD,CAvED;;AAyEA,eAAe7B,aAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\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 classNames from 'classnames';\nimport QuestionCircleOutlined from '@ant-design/icons/QuestionCircleOutlined';\nimport Col from '../grid/col';\nimport { FormContext } from './context';\nimport { useLocaleReceiver } from '../locale-provider/LocaleReceiver';\nimport defaultLocale from '../locale/default';\nimport Tooltip from '../tooltip';\n\nfunction toTooltipProps(tooltip) {\n  if (!tooltip) {\n    return null;\n  }\n\n  if (_typeof(tooltip) === 'object' && ! /*#__PURE__*/React.isValidElement(tooltip)) {\n    return tooltip;\n  }\n\n  return {\n    title: tooltip\n  };\n}\n\nvar FormItemLabel = function FormItemLabel(_ref) {\n  var prefixCls = _ref.prefixCls,\n      label = _ref.label,\n      htmlFor = _ref.htmlFor,\n      labelCol = _ref.labelCol,\n      labelAlign = _ref.labelAlign,\n      colon = _ref.colon,\n      required = _ref.required,\n      requiredMark = _ref.requiredMark,\n      tooltip = _ref.tooltip;\n\n  var _useLocaleReceiver = useLocaleReceiver('Form'),\n      _useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),\n      formLocale = _useLocaleReceiver2[0];\n\n  if (!label) return null;\n  return /*#__PURE__*/React.createElement(FormContext.Consumer, {\n    key: \"label\"\n  }, function (_ref2) {\n    var _classNames;\n\n    var vertical = _ref2.vertical,\n        contextLabelAlign = _ref2.labelAlign,\n        contextLabelCol = _ref2.labelCol,\n        contextColon = _ref2.colon;\n\n    var _a;\n\n    var mergedLabelCol = labelCol || contextLabelCol || {};\n    var mergedLabelAlign = labelAlign || contextLabelAlign;\n    var labelClsBasic = \"\".concat(prefixCls, \"-item-label\");\n    var labelColClassName = classNames(labelClsBasic, mergedLabelAlign === 'left' && \"\".concat(labelClsBasic, \"-left\"), mergedLabelCol.className);\n    var labelChildren = label; // Keep label is original where there should have no colon\n\n    var computedColon = colon === true || contextColon !== false && colon !== false;\n    var haveColon = computedColon && !vertical; // Remove duplicated user input colon\n\n    if (haveColon && typeof label === 'string' && label.trim() !== '') {\n      labelChildren = label.replace(/[:|:]\\s*$/, '');\n    } // Tooltip\n\n\n    var tooltipProps = toTooltipProps(tooltip);\n\n    if (tooltipProps) {\n      var _tooltipProps$icon = tooltipProps.icon,\n          icon = _tooltipProps$icon === void 0 ? /*#__PURE__*/React.createElement(QuestionCircleOutlined, null) : _tooltipProps$icon,\n          restTooltipProps = __rest(tooltipProps, [\"icon\"]);\n\n      var tooltipNode = /*#__PURE__*/React.createElement(Tooltip, restTooltipProps, /*#__PURE__*/React.cloneElement(icon, {\n        className: \"\".concat(prefixCls, \"-item-tooltip\")\n      }));\n      labelChildren = /*#__PURE__*/React.createElement(React.Fragment, null, labelChildren, tooltipNode);\n    } // Add required mark if optional\n\n\n    if (requiredMark === 'optional' && !required) {\n      labelChildren = /*#__PURE__*/React.createElement(React.Fragment, null, labelChildren, /*#__PURE__*/React.createElement(\"span\", {\n        className: \"\".concat(prefixCls, \"-item-optional\")\n      }, (formLocale === null || formLocale === void 0 ? void 0 : formLocale.optional) || ((_a = defaultLocale.Form) === null || _a === void 0 ? void 0 : _a.optional)));\n    }\n\n    var labelClassName = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-required\"), required), _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-required-mark-optional\"), requiredMark === 'optional'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-item-no-colon\"), !computedColon), _classNames));\n    return /*#__PURE__*/React.createElement(Col, _extends({}, mergedLabelCol, {\n      className: labelColClassName\n    }), /*#__PURE__*/React.createElement(\"label\", {\n      htmlFor: htmlFor,\n      className: labelClassName,\n      title: typeof label === 'string' ? label : ''\n    }, labelChildren));\n  });\n};\n\nexport default FormItemLabel;"]},"metadata":{},"sourceType":"module"}