UNPKG

11.1 kBSource Map (JSON)View Raw
1{"version":3,"sources":["rate/Rate.js"],"names":["__decorate","React","observer","classNames","isString","noop","getConfig","getProPrefixCls","C7NRate","getTooltipTheme","Tooltip","TextTooltip","FIELD_SUFFIX","FormField","renderValidationMessage","Icon","LabelLayout","ShowValidation","autobind","hide","show","Rate","arguments","onChange","value","setValue","validationResult","validationMessage","getValidationMessage","context","labelLayout","showValidation","showIcon","placeholder","includes","newLine","e","currentTarget","title","getProp","popupClassName","theme","help","createElement","type","onMouseEnter","handleHelpMouseEnter","onMouseLeave","handleHelpMouseLeave","hasFloatLabel","label","getLabel","labelTooltip","floatLabelOffsetX","prefixCls","required","classString","readOnly","style","marginLeft","undefined","className","always","overflow","handleFloatLabelMouseEnter","handleFloatLabelMouseLeave","renderTooltipHelp","otherProps","onFocus","onBlur","getValue","key","getWrapperProps","renderFloatLabel","handleMouseEnter","handleMouseLeave","getOtherProps","displayName","propTypes","defaultProps","suffixCls","__PRO_RATE","__IS_IN_CELL_EDITOR","prototype","ObserverRate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,QAAyB,YAAzB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,IAAP,MAAiB,aAAjB;AACA,SAASC,SAAT,EAAoBC,eAApB,QAA2C,4BAA3C;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,SAASC,eAAT,QAAgC,qCAAhC;AACA,SAASC,OAAO,IAAIC,WAApB,QAAuC,cAAvC;AACA,SAASC,YAAT,QAA6B,eAA7B;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,uBAAT,QAAwC,gBAAxC;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,WAAT,EAAsBC,cAAtB,QAA4C,cAA5C;AACA,O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,IAAhG,CAAR;AACH;AACJ;AACJ;AA5EL;AAAA;AAAA,wBAOwB;AAAA,UACRZ,WADQ,GACQ,IADR,CACRA,WADQ;AAEhB,aAAO,CAACd,WAAW,SAAZ,EAAoBA,WAAW,CAACiB,WAAhC,EAA6CC,QAA7C,CAAsDJ,WAAtD,CAAP;AACH;AAVL;;AAAA;AAAA,EAA0BjB,SAA1B;AA8EAQ,IAAI,CAACwD,WAAL,GAAmB,MAAnB;AACAxD,IAAI,CAACyD,SAAL,qBACOtE,OAAO,CAACsE,SADf,MAEOjE,SAAS,CAACiE,SAFjB;AAIAzD,IAAI,CAAC0D,YAAL,qBACOvE,OAAO,CAACuE,YADf,MAEOlE,SAAS,CAACkE,YAFjB;AAGIC,EAAAA,SAAS,EAAE;AAHf,G,CAKA;;AACA3D,IAAI,CAAC4D,UAAL,GAAkB,IAAlB,C,CACA;;AACA5D,IAAI,CAAC6D,mBAAL,GAA2B,IAA3B;;AACAlF,UAAU,CAAC,CACPkB,QADO,CAAD,EAEPG,IAAI,CAAC8D,SAFE,EAES,wBAFT,EAEmC,IAFnC,CAAV;;AAGAnF,UAAU,CAAC,CACPkB,QADO,CAAD,EAEPG,IAAI,CAAC8D,SAFE,EAES,sBAFT,EAEiC,IAFjC,CAAV;;AAGA,IAAIC,YAAY;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA,EAA8B/D,IAA9B,CAAhB;;AAEA+D,YAAY,CAACL,YAAb,GAA4B1D,IAAI,CAAC0D,YAAjC,C,CACA;;AACAK,YAAY,CAACH,UAAb,GAA0B,IAA1B,C,CACA;;AACAG,YAAY,CAACF,mBAAb,GAAmC,IAAnC;AACAE,YAAY,GAAGpF,UAAU,CAAC,CACtBE,QADsB,CAAD,EAEtBkF,YAFsB,CAAzB;AAGA,eAAeA,YAAf","sourcesContent":["import { __decorate } from \"tslib\";\nimport React from 'react';\nimport { observer } from 'mobx-react';\nimport classNames from 'classnames';\nimport isString from 'lodash/isString';\nimport noop from 'lodash/noop';\nimport { getConfig, getProPrefixCls } from '../../../es/configure';\nimport C7NRate from '../../../es/rate';\nimport { getTooltipTheme } from '../../../es/_util/TooltipUtils';\nimport { Tooltip as TextTooltip } from '../core/enum';\nimport { FIELD_SUFFIX } from '../form/utils';\nimport { FormField } from '../field/FormField';\nimport { renderValidationMessage } from '../field/utils';\nimport Icon from '../icon';\nimport { LabelLayout, ShowValidation } from '../form/enum';\nimport autobind from '../_util/autobind';\nimport { hide, show } from '../tooltip/singleton';\nexport class Rate extends FormField {\n constructor() {\n super(...arguments);\n this.onChange = (value) => {\n this.setValue(value);\n };\n }\n get hasFloatLabel() {\n const { labelLayout } = this;\n return [LabelLayout.float, LabelLayout.placeholder].includes(labelLayout);\n }\n renderValidationResult(validationResult) {\n const validationMessage = this.getValidationMessage(validationResult);\n const { labelLayout, showValidation } = this.context;\n if (validationMessage) {\n const showIcon = !([LabelLayout.float, LabelLayout.placeholder].includes(labelLayout) || showValidation === ShowValidation.newLine);\n return renderValidationMessage(validationMessage, showIcon);\n }\n }\n handleHelpMouseEnter(e) {\n show(e.currentTarget, {\n title: this.getProp('help'),\n popupClassName: `${getConfig('proPrefixCls')}-tooltip-popup-help`,\n theme: getTooltipTheme('help'),\n });\n }\n handleHelpMouseLeave() {\n hide();\n }\n renderTooltipHelp() {\n const help = this.getProp('help');\n if (help) {\n return (React.createElement(Icon, { type: \"help\", onMouseEnter: this.handleHelpMouseEnter, onMouseLeave: this.handleHelpMouseLeave }));\n }\n }\n renderFloatLabel() {\n if (this.hasFloatLabel) {\n const label = this.getLabel();\n if (label) {\n const { labelTooltip, floatLabelOffsetX } = this;\n const prefixCls = getProPrefixCls(FIELD_SUFFIX);\n const required = this.getProp('required');\n const classString = classNames(`${prefixCls}-label`, {\n [`${prefixCls}-required`]: required,\n [`${prefixCls}-readonly`]: this.readOnly,\n });\n const style = floatLabelOffsetX ? {\n marginLeft: floatLabelOffsetX,\n } : undefined;\n return (React.createElement(\"div\", { className: `${prefixCls}-label-wrapper`, style: style },\n React.createElement(\"div\", { className: classString, title: isString(label) && ![TextTooltip.always, TextTooltip.overflow].includes(labelTooltip) ? label : undefined, onMouseEnter: this.handleFloatLabelMouseEnter, onMouseLeave: this.handleFloatLabelMouseLeave }, label),\n this.renderTooltipHelp()));\n }\n }\n }\n getOtherProps() {\n const otherProps = super.getOtherProps();\n otherProps.onFocus = noop;\n otherProps.onBlur = noop;\n return otherProps;\n }\n renderWrapper() {\n const value = this.getValue();\n return (React.createElement(\"label\", Object.assign({ key: \"wrapper\" }, this.getWrapperProps()),\n this.renderFloatLabel(),\n React.createElement(\"div\", { onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave },\n React.createElement(C7NRate, Object.assign({}, this.getOtherProps(), { onChange: this.onChange, value: value })))));\n }\n renderHelpMessage() {\n const label = this.getLabel();\n if (!this.hasFloatLabel || !label) {\n const help = this.getProp('help');\n if (help) {\n return (React.createElement(\"div\", { key: \"help\", className: `${getProPrefixCls(FIELD_SUFFIX)}-help` }, help));\n }\n }\n }\n}\nRate.displayName = 'Rate';\nRate.propTypes = {\n ...C7NRate.propTypes,\n ...FormField.propTypes,\n};\nRate.defaultProps = {\n ...C7NRate.defaultProps,\n ...FormField.defaultProps,\n suffixCls: 'rate',\n};\n// eslint-disable-next-line camelcase\nRate.__PRO_RATE = true;\n// eslint-disable-next-line camelcase\nRate.__IS_IN_CELL_EDITOR = true;\n__decorate([\n autobind\n], Rate.prototype, \"renderValidationResult\", null);\n__decorate([\n autobind\n], Rate.prototype, \"handleHelpMouseEnter\", null);\nlet ObserverRate = class ObserverRate extends Rate {\n};\nObserverRate.defaultProps = Rate.defaultProps;\n// eslint-disable-next-line camelcase\nObserverRate.__PRO_RATE = true;\n// eslint-disable-next-line camelcase\nObserverRate.__IS_IN_CELL_EDITOR = true;\nObserverRate = __decorate([\n observer\n], ObserverRate);\nexport default ObserverRate;\n"],"file":"Rate.js"}
\No newline at end of file