UNPKG

yanzhen-design-vue

Version:

39 lines (38 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const utils = require("@yanzhen-libs/utils"); const handleSchema = require("./handleSchema.cjs"); function handleRawSchema(body, schema) { const { grid, use: _use, readOnly: _readOnly } = handleSchema.handleSchema(schema); let { col, use, readOnly, field, props, ...options } = body ?? {}; switch (true) { case (!_use && use !== true && !utils.isObject(field)): use = false; break; default: use = true; } switch (true) { case _readOnly: readOnly = _readOnly; break; case typeof readOnly !== "boolean": readOnly = false; break; } if (!utils.isObject(props)) { props = {}; } const formItemProps = utils.isObject(field) ? field : {}; const colProps = utils.isObject(col) ? col : {}; return { ...options, props, field: formItemProps, col: colProps, readOnly, grid, use }; } exports.handleRawSchema = handleRawSchema;