Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Feb 24, 2020
1 parent 0174b05 commit 72a07d0
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VXETable.use(VXETablePluginIView)

| 属性 | 描述 | 类型 | 可选值 | 默认值 |
|------|------|-----|-----|-----|
| name | 支持的渲染组件 | String | Input, AutoComplete, InputNumber, Rate, iSwitch ||
| name | 支持的渲染组件 | String | Input, AutoComplete, InputNumber, Rate, iSwitch, Button, Buttons ||
| props | 渲染组件附加属性,参数请查看被渲染的 Component props | Object || {} |
| options | 只对 name=Select 有效,下拉组件选项列表 | Array || [] |
| optionProps | 只对 name=Select 有效,下拉组件选项属性参数配置 | Object || { value: 'value', label: 'label', disabled: 'disabled' } |
Expand All @@ -43,7 +43,7 @@ VXETable.use(VXETablePluginIView)

| 属性 | 描述 | 类型 | 可选值 | 默认值 |
|------|------|-----|-----|-----|
| name | 支持的渲染组件 | String | Input, AutoComplete, InputNumber, Select, Cascader, DatePicker, TimePicker, Rate, iSwitch ||
| name | 支持的渲染组件 | String | Input, AutoComplete, InputNumber, Select, Cascader, DatePicker, TimePicker, Rate, iSwitch, Button, Buttons ||
| props | 渲染组件附加属性,参数请查看被渲染的 Component props | Object || {} |
| options | 只对 name=Select 有效,下拉组件选项列表 | Array || [] |
| optionProps | 只对 name=Select 有效,下拉组件选项属性参数配置 | Object || { value: 'value', label: 'label', disabled: 'disabled' } |
Expand All @@ -67,7 +67,7 @@ VXETable.use(VXETablePluginIView)

| 属性 | 描述 | 类型 | 可选值 | 默认值 |
|------|------|-----|-----|-----|
| name | 支持的渲染组件 | String | Input, AutoComplete, InputNumber, Select, Rate, iSwitch, Radio, Checkbox ||
| name | 支持的渲染组件 | String | Input, AutoComplete, InputNumber, Select, Rate, iSwitch, Radio, Checkbox, Button, Buttons ||
| props | 渲染组件附加属性,参数请查看被渲染的 Component props | Object || {} |
| options | 只对 name=Select 有效,下拉组件选项列表 | Array || [] |
| optionProps | 只对 name=Select 有效,下拉组件选项属性参数配置 | Object || { value: 'value', label: 'label', disabled: 'disabled' } |
Expand Down
52 changes: 47 additions & 5 deletions dist/index.common.js

Large diffs are not rendered by default.

50 changes: 46 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,22 @@
};
}

function defaultButtonEditRender(h, renderOpts, params) {
var attrs = renderOpts.attrs;
var props = getProps(params, renderOpts);
return [h('Button', {
attrs: attrs,
props: props,
on: getCellEvents(renderOpts, params)
}, cellText(h, renderOpts.content))];
}

function defaultButtonsEditRender(h, renderOpts, params) {
return renderOpts.children.map(function (childRenderOpts) {
return defaultButtonEditRender(h, childRenderOpts, params)[0];
});
}

function getFilterEvents(on, renderOpts, params) {
var events = renderOpts.events;

Expand Down Expand Up @@ -344,7 +360,7 @@
property = params.property;
var name = renderOpts.name;
var attrs = renderOpts.attrs;
var props = getFormProps(params, renderOpts, defaultProps);
var props = getFormItemProps(params, renderOpts, defaultProps);
return [h(name, {
attrs: attrs,
props: props,
Expand All @@ -359,7 +375,23 @@
};
}

function getFormProps(_ref4, _ref5, defaultProps) {
function defaultButtonItemRender(h, renderOpts, params) {
var attrs = renderOpts.attrs;
var props = getFormItemProps(params, renderOpts);
return [h('Button', {
attrs: attrs,
props: props,
on: getFormEvents(renderOpts, params)
}, cellText(h, props.content))];
}

function defaultButtonsItemRender(h, renderOpts, params) {
return renderOpts.children.map(function (childRenderOpts) {
return defaultButtonItemRender(h, childRenderOpts, params)[0];
});
}

function getFormItemProps(_ref4, _ref5, defaultProps) {
var $form = _ref4.$form;
var props = _ref5.props;
return _xeUtils["default"].assign($form.vSize ? {
Expand Down Expand Up @@ -411,7 +443,7 @@
var data = params.data,
property = params.property;
var attrs = renderOpts.attrs;
var props = getFormProps(params, renderOpts);
var props = getFormItemProps(params, renderOpts);
var labelProp = optionProps.label || 'label';
var valueProp = optionProps.value || 'value';
var disabledProp = optionProps.disabled || 'disabled';
Expand Down Expand Up @@ -618,7 +650,7 @@
var data = params.data,
property = params.property;
var attrs = renderOpts.attrs;
var props = getFormProps(params, renderOpts);
var props = getFormItemProps(params, renderOpts);

if (optionGroups) {
var groupOptions = optionGroupProps.options || 'options';
Expand Down Expand Up @@ -759,6 +791,16 @@
},
Checkbox: {
renderItem: createFormItemRadioAndCheckboxRender()
},
Button: {
renderEdit: defaultButtonEditRender,
renderDefault: defaultButtonEditRender,
renderItem: defaultButtonItemRender
},
Buttons: {
renderEdit: defaultButtonsEditRender,
renderDefault: defaultButtonsEditRender,
renderItem: defaultButtonsItemRender
}
};
/**
Expand Down
Loading

0 comments on commit 72a07d0

Please sign in to comment.