@vtx/components 2.5.10 → 2.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,7 +13,7 @@ var _icon = _interopRequireDefault(require("antd/es/icon"));
|
|
|
13
13
|
var _tooltip = _interopRequireDefault(require("antd/es/tooltip"));
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
var _context = require("./context");
|
|
16
|
-
var _excluded = ["weights", "tip", "label"];
|
|
16
|
+
var _excluded = ["weights", "tip", "hideTooltip", "label"];
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -26,6 +26,7 @@ function FormItem(props) {
|
|
|
26
26
|
var _props$weights = props.weights,
|
|
27
27
|
weights = _props$weights === void 0 ? 1 : _props$weights,
|
|
28
28
|
tip = props.tip,
|
|
29
|
+
hideTooltip = props.hideTooltip,
|
|
29
30
|
label = props.label,
|
|
30
31
|
rest = _objectWithoutProperties(props, _excluded);
|
|
31
32
|
var _useContext = (0, _react.useContext)(_context.StoreCtx),
|
|
@@ -33,7 +34,7 @@ function FormItem(props) {
|
|
|
33
34
|
cols = _useContext.cols,
|
|
34
35
|
mode = _useContext.mode,
|
|
35
36
|
layout = _useContext.layout;
|
|
36
|
-
var labelRender = /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
|
|
37
|
+
var labelRender = hideTooltip ? label : /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
|
|
37
38
|
title: label
|
|
38
39
|
}, label);
|
|
39
40
|
if (tip) {
|
|
@@ -73,6 +74,7 @@ FormItem.propTypes = {
|
|
|
73
74
|
weights: _propTypes["default"].number,
|
|
74
75
|
children: _propTypes["default"].node,
|
|
75
76
|
tip: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
76
|
-
label: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node])
|
|
77
|
+
label: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
78
|
+
hideTooltip: _propTypes["default"].bool
|
|
77
79
|
};
|
|
78
80
|
//# sourceMappingURL=FormItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormItem.js","names":["SPAN","FormItem","props","weights","tip","label","rest","useContext","StoreCtx","labelColSpan","cols","mode","layout","labelRender","formItemLayout","conversionLabelColSpan","wrapperColSpan","labelCol","span","wrapperCol","classnames","children","propTypes","PropTypes","number","node","oneOfType","string"],"sources":["vtx-form-layout/FormItem.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport Form from 'antd/es/form';\nimport Col from 'antd/es/col';\nimport Icon from 'antd/es/icon';\nimport Tooltip from 'antd/es/tooltip';\nimport classnames from 'classnames';\nimport { StoreCtx } from './context';\n\n// 24 栅格\nconst SPAN = 24;\n\nexport default function FormItem(props) {\n const { weights = 1, tip, label, ...rest } = props;\n const { labelColSpan, cols, mode, layout } = useContext(StoreCtx);\n\n let labelRender = <Tooltip title={label}>{label}</Tooltip>;\n if (tip) {\n labelRender = (\n <span>\n {label} \n <Tooltip title={tip}>\n <Icon type=\"question-circle-o\" />\n </Tooltip>\n </span>\n );\n }\n\n let formItemLayout = null;\n if (layout === 'horizontal') {\n const conversionLabelColSpan = labelColSpan / weights;\n const wrapperColSpan = SPAN - conversionLabelColSpan;\n formItemLayout = {\n labelCol: { span: conversionLabelColSpan },\n wrapperCol: { span: wrapperColSpan },\n };\n }\n\n return (\n <Col span={(SPAN * weights) / cols} className=\"vtx-form-item-col\">\n <Form.Item\n className={classnames(\n 'vtx-form-item',\n { 'vtx-form-item-vertical': layout === 'vertical' && mode !== 'view' },\n { 'vtx-form-item--view': mode === 'view' },\n )}\n {...formItemLayout}\n label={labelRender}\n {...rest}\n >\n {props.children}\n </Form.Item>\n </Col>\n );\n}\n\nFormItem.propTypes = {\n weights: PropTypes.number,\n children: PropTypes.node,\n tip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAErC;AACA,IAAMA,IAAI,GAAG,EAAE;AAEA,SAASC,QAAQ,CAACC,KAAK,EAAE;EACpC,
|
|
1
|
+
{"version":3,"file":"FormItem.js","names":["SPAN","FormItem","props","weights","tip","hideTooltip","label","rest","useContext","StoreCtx","labelColSpan","cols","mode","layout","labelRender","formItemLayout","conversionLabelColSpan","wrapperColSpan","labelCol","span","wrapperCol","classnames","children","propTypes","PropTypes","number","node","oneOfType","string","bool"],"sources":["vtx-form-layout/FormItem.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport Form from 'antd/es/form';\nimport Col from 'antd/es/col';\nimport Icon from 'antd/es/icon';\nimport Tooltip from 'antd/es/tooltip';\nimport classnames from 'classnames';\nimport { StoreCtx } from './context';\n\n// 24 栅格\nconst SPAN = 24;\n\nexport default function FormItem(props) {\n const { weights = 1, tip, hideTooltip, label, ...rest } = props;\n const { labelColSpan, cols, mode, layout } = useContext(StoreCtx);\n\n let labelRender = hideTooltip ? label : <Tooltip title={label}>{label}</Tooltip>;\n if (tip) {\n labelRender = (\n <span>\n {label} \n <Tooltip title={tip}>\n <Icon type=\"question-circle-o\" />\n </Tooltip>\n </span>\n );\n }\n\n let formItemLayout = null;\n if (layout === 'horizontal') {\n const conversionLabelColSpan = labelColSpan / weights;\n const wrapperColSpan = SPAN - conversionLabelColSpan;\n formItemLayout = {\n labelCol: { span: conversionLabelColSpan },\n wrapperCol: { span: wrapperColSpan },\n };\n }\n\n return (\n <Col span={(SPAN * weights) / cols} className=\"vtx-form-item-col\">\n <Form.Item\n className={classnames(\n 'vtx-form-item',\n { 'vtx-form-item-vertical': layout === 'vertical' && mode !== 'view' },\n { 'vtx-form-item--view': mode === 'view' },\n )}\n {...formItemLayout}\n label={labelRender}\n {...rest}\n >\n {props.children}\n </Form.Item>\n </Col>\n );\n}\n\nFormItem.propTypes = {\n weights: PropTypes.number,\n children: PropTypes.node,\n tip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n hideTooltip: PropTypes.bool\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAErC;AACA,IAAMA,IAAI,GAAG,EAAE;AAEA,SAASC,QAAQ,CAACC,KAAK,EAAE;EACpC,qBAA0DA,KAAK,CAAvDC,OAAO;IAAPA,OAAO,+BAAG,CAAC;IAAEC,GAAG,GAAkCF,KAAK,CAA1CE,GAAG;IAAEC,WAAW,GAAqBH,KAAK,CAArCG,WAAW;IAAEC,KAAK,GAAcJ,K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