UNPKG

@cainiaofe/cn-ui-layout

Version:

- 安装 cone-cli | [Cone-CLI 使用指引](https://alidocs.dingtalk.com/i/nodes/xdqZp24KneBJzvGM6XezJvyb7RA0Nr1E) - `tnpm i -g @alife/cone-cli@latest` - 安装依赖包 - `cone install` - 启动研发 - `cone start`

72 lines 2.64 kB
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; import _extends from "@babel/runtime/helpers/extends"; var _excluded = ["noPadding"]; import React from 'react'; import isPlainObject from 'lodash/isPlainObject'; import { executeFunction, getLowCodeCoreUtil, isArrayNotEmpty } from "../../common/util/util"; export var getExtraDom = function getExtraDom(props) { var _getLowCodeCoreUtil; var _ref = props || {}, extra = _ref.extra, _context = _ref._context; var state = _context === null || _context === void 0 ? void 0 : _context.state; var extraDom = (_getLowCodeCoreUtil = getLowCodeCoreUtil('util.makeButtons')) === null || _getLowCodeCoreUtil === void 0 ? void 0 : _getLowCodeCoreUtil({ buttons: extra === null || extra === void 0 ? void 0 : extra.map(function (item) { var realChildren = item === null || item === void 0 ? void 0 : item.children; if (typeof (item === null || item === void 0 ? void 0 : item.children) === 'function') { realChildren = executeFunction(item.children, {}, state); } return _extends({}, item, { size: 'small', position: getLowCodeCoreUtil('enumMap.ButtonPosition.tileRightButton'), children: realChildren }); }), _context: _context, state: state, recordDataSource: {} }); if (isArrayNotEmpty(extraDom)) { extraDom = /*#__PURE__*/React.createElement("div", { className: 'cn-layout-section-extra' }, extraDom); } return extraDom; }; export var getSlotDom = function getSlotDom(componentSlot) { if (isArrayNotEmpty(componentSlot)) { return componentSlot.map(function (item) { return /*#__PURE__*/React.cloneElement(item, { existPosition: 'SectionExtra' }); }); } if (componentSlot) { return componentSlot; } return null; }; export var getExtraProps = function getExtraProps(props) { var _ref2 = props || {}, normalStyle = _ref2.normalStyle, _context = _ref2._context, handleProps = _ref2.handleProps; var _ref3 = normalStyle || {}, noPadding = _ref3.noPadding, rest = _objectWithoutPropertiesLoose(_ref3, _excluded); var extraProps = {}; if (noPadding) { extraProps.style = { paddingLeft: 0, paddingRight: 0 }; } extraProps = _extends({}, extraProps, rest); if (typeof handleProps === 'function') { var tempProps = executeFunction(handleProps, _extends({}, extraProps), _context === null || _context === void 0 ? void 0 : _context.state); if (isPlainObject(tempProps)) { extraProps = tempProps; } } return extraProps; };