UNPKG

focus-pro

Version:

focus-pro 中台前端组件库

55 lines (52 loc) 4.14 kB
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var _excluded = ["columns"]; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import { BetaSchemaForm } from '@ant-design/pro-components'; import ZFProConfigProvider from "../ProConfigProvider"; import { jsx as _jsx } from "react/jsx-runtime"; var ZFSchemaForm = function ZFSchemaForm(props) { var _props$columns = props.columns, columns = _props$columns === void 0 ? [] : _props$columns, restProps = _objectWithoutProperties(props, _excluded); // 需要使用 getItems 生成的组件 // const advancedValueType = ['compact']; // const newColumns = useMemo(() => { // const newColumns = cloneDeep(columns); // const getColumns = ( // columns: // | ProFormColumnsType<T, valueType>[] // | ProFormColumnsType<T, valueType>[][], // ) => { // columns.forEach((c) => { // if (Array.isArray(c)) { // getColumns(c); // return; // } // const { valueType, renderFormItem } = c; // if ( // typeof valueType === 'string' && // advancedValueType.includes(valueType) && // !renderFormItem // ) { // c.renderFormItem = () => { // return <Advanced columns={[c]}></Advanced>; // }; // } // }); // }; // getColumns(newColumns); // return newColumns; // }, [columns]); return /*#__PURE__*/_jsx(ZFProConfigProvider, { children: /*#__PURE__*/_jsx(BetaSchemaForm, _objectSpread(_objectSpread({}, restProps), {}, { columns: columns })) }); }; export default ZFSchemaForm;