1 line
14 KiB
JSON
1 line
14 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\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/* eslint-disable react/no-array-index-key */\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { matchScreen } from '../_util/responsiveObserver';\nimport { ConfigContext } from '../config-provider';\nimport useSize from '../config-provider/hooks/useSize';\nimport useBreakpoint from '../grid/hooks/useBreakpoint';\nimport DEFAULT_COLUMN_MAP from './constant';\nimport DescriptionsContext from './DescriptionsContext';\nimport useItems from './hooks/useItems';\nimport useRow from './hooks/useRow';\nimport DescriptionsItem from './Item';\nimport Row from './Row';\nimport useStyle from './style';\nconst Descriptions = props => {\n const {\n prefixCls: customizePrefixCls,\n title,\n extra,\n column,\n colon = true,\n bordered,\n layout,\n children,\n className,\n rootClassName,\n style,\n size: customizeSize,\n labelStyle,\n contentStyle,\n items\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"title\", \"extra\", \"column\", \"colon\", \"bordered\", \"layout\", \"children\", \"className\", \"rootClassName\", \"style\", \"size\", \"labelStyle\", \"contentStyle\", \"items\"]);\n const {\n getPrefixCls,\n direction,\n descriptions\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('descriptions', customizePrefixCls);\n const screens = useBreakpoint();\n // Column count\n const mergedColumn = React.useMemo(() => {\n var _a;\n if (typeof column === 'number') {\n return column;\n }\n return (_a = matchScreen(screens, Object.assign(Object.assign({}, DEFAULT_COLUMN_MAP), column))) !== null && _a !== void 0 ? _a : 3;\n }, [screens, column]);\n // Items with responsive\n const mergedItems = useItems(screens, items, children);\n const mergedSize = useSize(customizeSize);\n const rows = useRow(mergedColumn, mergedItems);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n // ======================== Render ========================\n const contextValue = React.useMemo(() => ({\n labelStyle,\n contentStyle\n }), [labelStyle, contentStyle]);\n return wrapCSSVar( /*#__PURE__*/React.createElement(DescriptionsContext.Provider, {\n value: contextValue\n }, /*#__PURE__*/React.createElement(\"div\", Object.assign({\n className: classNames(prefixCls, descriptions === null || descriptions === void 0 ? void 0 : descriptions.className, {\n [`${prefixCls}-${mergedSize}`]: mergedSize && mergedSize !== 'default',\n [`${prefixCls}-bordered`]: !!bordered,\n [`${prefixCls}-rtl`]: direction === 'rtl'\n }, className, rootClassName, hashId, cssVarCls),\n style: Object.assign(Object.assign({}, descriptions === null || descriptions === void 0 ? void 0 : descriptions.style), style)\n }, restProps), (title || extra) && ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-header`\n }, title && /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-title`\n }, title), extra && /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-extra`\n }, extra))), /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-view`\n }, /*#__PURE__*/React.createElement(\"table\", null, /*#__PURE__*/React.createElement(\"tbody\", null, rows.map((row, index) => ( /*#__PURE__*/React.createElement(Row, {\n key: index,\n index: index,\n colon: colon,\n prefixCls: prefixCls,\n vertical: layout === 'vertical',\n bordered: bordered,\n row: row\n })))))))));\n};\nif (process.env.NODE_EN
|