@ywfe/materials-design
Version:
YwDesign for lowcode
197 lines (196 loc) • 5.2 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _base = require("../_base");
var _utils = require("../_utils");
var refConfig = (0, _utils.getRefConfig)('data_edit_dialog');
var DataEditDialogMeta = {
componentName: 'DataEditDialog',
title: '编辑数据',
docUrl: '',
screenshot: '',
group: '基础组件',
category: '弹窗',
devMode: 'proCode',
npm: {
"package": '@ywfe/materials-design',
version: '0.0.1-beta.6',
exportName: 'YwFormDialog',
main: 'src/index.tsx',
destructuring: true,
subName: ''
},
configure: {
props: [refConfig, {
name: 'title',
title: {
label: '弹窗标题',
tip: 'title | 标题'
},
setter: 'StringSetter',
display: 'block'
}].concat(_base.YwButtonBaseProps, [{
title: {
label: '布局配置',
tip: 'props | 布局配置'
},
type: 'group',
display: 'accordion',
extraProps: {
defaultCollapsed: true
},
supportVariable: false,
items: _base.layoutConfig
}, _base.FormItemsProps, {
title: {
label: '表单默认值',
tip: 'initialValues | 表单默认值'
},
display: 'inline',
name: 'initialValues',
description: '表单默认值',
supportVariable: false,
setter: {
componentName: 'JsonSetter',
isRequired: false,
initialValue: {}
}
}, {
title: {
label: '表单初始化',
tip: 'onFormInit | 表单初始化'
},
name: 'onFormInit',
setter: {
componentName: 'SchemaFunctionSetter',
props: {
title: 'getDataSource',
async: true,
properties: {
input: {
type: 'object',
properties: {
form: {
type: 'object'
}
},
required: ['form']
},
body: {
type: 'array',
items: [{
type: 'Function',
properties: {
template: 'RequestFunction',
variable: 'requestRes',
extraProps: {
_params: false,
_paramsArr: [{
name: 'id',
value: '{{this.initialValues?.id}}'
}],
params: {
id: '{{this.initialValues?.id}}'
}
}
}
}, {
type: 'JSExpression',
run: 'console.log(1,this.record,this.initialValues);form.setInitialValues(requestRes || this.initialValues)'
}]
}
}
}
}
}, {
title: {
label: '确定操作',
tip: 'onConfirm | 确定操作'
},
name: 'onConfirm',
setter: {
componentName: 'SchemaFunctionSetter',
props: {
title: 'getDataSource',
async: true,
properties: {
input: {
type: 'object',
properties: {
values: {
type: 'object'
}
},
required: ['values']
},
body: {
type: 'array',
items: [{
type: 'Function',
properties: {
template: 'RequestFunction',
variable: 'requestRes',
extraProps: {
params: '{{values}}'
}
}
}, {
type: 'JSExpression',
run: 'if (requestRes) this.reload && this.reload()'
}]
},
output: 'requestRes'
}
}
}
}]),
supports: {
events: [{
name: 'onCancel',
description: '取消事件',
template: 'function onCancel() {\n this.setState({\n isShowDialog: false\n });\n}'
}, {
name: 'onOpen',
description: '弹窗打开事件(开发中)'
}],
style: true,
className: true,
loop: false
},
component: {
isContainer: false
}
}
};
var snippets = [{
title: '编辑数据',
svgId: 'icon-bianjishuju',
screenshot: 'https://yw-fed-static.oss-cn-hangzhou.aliyuncs.com/lowcode/dialog',
schema: {
componentName: 'DataEditDialog',
props: {
btnText: '编辑',
btnType: 'link',
title: '编辑数据',
initialValues: {
type: 'JSExpression',
value: 'this.record'
},
reload: {
type: 'JSExpression',
value: 'this.reload'
},
items: [{
component: 'Input',
title: '表单项',
name: "input_" + (0, _utils.uuid)()
}],
visible: undefined
}
}
}];
var _default = exports["default"] = (0, _extends2["default"])({}, DataEditDialogMeta, {
snippets: snippets
});