UNPKG

@wufengteam/wform

Version:

@wufengteam/wform

85 lines 3.25 kB
var getDateFormat = function getDateFormat(format) { var result = format || 'YYYY-MM-DD HH:mm:ss'; result = result.replace('YYYY', 'yyyy').replace('DD', 'dd'); return result; }; export var getRowColumns = function getRowColumns(data, ignoreCompType) { var rowColumns = []; (data || []).forEach(function (item) { var _a, _b; var type = item.type; if (!(ignoreCompType || []).includes(type)) { var _ref = item.props || {}, name = _ref.name, fieldName = _ref.fieldName, desc = _ref.desc, staticData = _ref.staticData, format = _ref.format, options = _ref.options, treeData = _ref.treeData, multiple = _ref.multiple; if (['Select', 'MultipleSelect', 'Radio', 'CheckboxGroup'].includes(type)) { rowColumns.push({ attrCode: fieldName, attrName: name, staticCode: (_a = staticData === null || staticData === void 0 ? void 0 : staticData.extraData) === null || _a === void 0 ? void 0 : _a.attrNbr, compType: type, desc: desc }); } else if (['Cascader'].includes(type)) { rowColumns.push({ attrCode: fieldName, attrName: name, staticCode: (options === null || options === void 0 ? void 0 : options[0].extraData.attrNbr) || ((_b = staticData === null || staticData === void 0 ? void 0 : staticData.data) === null || _b === void 0 ? void 0 : _b[0].extraData.attrNbr), compType: type, desc: desc }); } else if (['TreeSelect'].includes(type)) { rowColumns.push({ attrCode: fieldName, attrName: name, staticCode: treeData === null || treeData === void 0 ? void 0 : treeData[0].extraData.attrNbr, compType: type, multiple: multiple, desc: desc }); } else if (['DatePicker', 'TimePicker', 'RangePicker'].includes(type)) { rowColumns.push({ attrCode: fieldName, attrName: name, compType: type, assignRuleObj: getDateFormat(format), desc: desc }); } else { rowColumns.push({ attrCode: fieldName, attrName: name, compType: type, desc: desc }); } if (type === 'DataLinkage') { var _item$props$previewFi = item.props.previewFields, previewFields = _item$props$previewFi === void 0 ? [] : _item$props$previewFi; if (Array.isArray(previewFields) && previewFields.length > 0) { previewFields.forEach(function (field) { var _ref2 = field || {}, attrName = _ref2.attrName, attrCode = _ref2.attrCode, staticCode = _ref2.staticCode; rowColumns.push({ attrCode: attrCode, attrName: attrName, staticCode: staticCode, compType: type }); }); } } } }); return rowColumns; }; export var WFORMCOMPTYPE = ['Address', 'Location', 'Autograph', 'AddMember', 'AddDepartment', 'InputPhone', 'InputMail', 'VideoUpload', 'ImgUpload']; export var EXPORTIGNORECOMPTYPE = ['Autograph', 'VideoUpload', 'ImgUpload', 'StdUpload'];