Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Feb 20, 2020
1 parent fa8bb45 commit e670beb
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 91 deletions.
58 changes: 25 additions & 33 deletions dist/index.common.js

Large diffs are not rendered by default.

56 changes: 24 additions & 32 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,21 +222,17 @@
};
}

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

if (events) {
return _xeUtils["default"].assign({}, _xeUtils["default"].objectMap(events, function (cb) {
return function () {
params = Object.assign({
context: context
}, params);

for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}

cb.apply(null, [params].concat.apply(params, args));
cb.apply(null, [params].concat(args));
};
}), on);
}
Expand Down Expand Up @@ -278,21 +274,20 @@
}
},
on: getFilterEvents(_defineProperty({}, type, function (evnt) {
handleConfirmFilter(context, column, !!item.data, item);
handleConfirmFilter(params, column, !!item.data, item);

if (events && events[type]) {
events[type](Object.assign({
context: context
}, params), evnt);
events[type](params, evnt);
}
}), renderOpts, params, context)
}), renderOpts, params)
});
});
};
}

function handleConfirmFilter(context, column, checked, item) {
context[column.filterMultiple ? 'changeMultipleOption' : 'changeRadioOption']({}, checked, item);
function handleConfirmFilter(params, column, checked, item) {
var $panel = params.$panel || params.context;
$panel[column.filterMultiple ? 'changeMultipleOption' : 'changeRadioOption']({}, checked, item);
}

function defaultFilterMethod(_ref3) {
Expand Down Expand Up @@ -333,7 +328,7 @@
property = params.property;
var name = renderOpts.name;
var attrs = renderOpts.attrs;
var props = getFormProps(context, renderOpts, defaultProps);
var props = getFormProps(params, renderOpts, defaultProps);
return [h(name, {
attrs: attrs,
props: props,
Expand All @@ -343,7 +338,7 @@
_xeUtils["default"].set(data, property, value);
}
},
on: getFormEvents(renderOpts, params, context)
on: getFormEvents(renderOpts, params)
})];
};
}
Expand All @@ -356,7 +351,7 @@
} : {}, defaultProps, props);
}

function getFormEvents(renderOpts, params, context) {
function getFormEvents(renderOpts, params) {
var events = renderOpts.events;
var $form = params.$form;
var type = 'change';
Expand Down Expand Up @@ -421,7 +416,7 @@
var data = params.data,
property = params.property;
var attrs = renderOpts.attrs;
var props = getFormProps(context, renderOpts);
var props = getFormProps(params, renderOpts);
var labelProp = optionProps.label || 'label';
var valueProp = optionProps.value || 'value';
var disabledProp = optionProps.disabled || 'disabled';
Expand All @@ -434,7 +429,7 @@
_xeUtils["default"].set(data, property, cellValue);
}
},
on: getFormEvents(renderOpts, params, context)
on: getFormEvents(renderOpts, params)
}, options.map(function (option) {
return h(name, {
props: {
Expand Down Expand Up @@ -552,14 +547,12 @@
}
},
on: getFilterEvents(_defineProperty({}, type, function (value) {
handleConfirmFilter(context, column, value && value.length > 0, item);
handleConfirmFilter(params, column, value && value.length > 0, item);

if (events && events[type]) {
events[type](Object.assign({
context: context
}, params), value);
events[type](params, value);
}
}), renderOpts, params, context)
}), renderOpts, params)
}, _xeUtils["default"].map(optionGroups, function (group, gIndex) {
return h('a-select-opt-group', {
key: gIndex
Expand All @@ -582,15 +575,13 @@
},
on: getFilterEvents({
change: function change(value) {
handleConfirmFilter(context, column, value && value.length > 0, item);
handleConfirmFilter(params, column, value && value.length > 0, item);

if (events && events[type]) {
events[type](Object.assign({
context: context
}, params), value);
events[type](params, value);
}
}
}, renderOpts, params, context)
}, renderOpts, params)
}, renderOptions(h, options, optionProps));
});
},
Expand Down Expand Up @@ -628,7 +619,7 @@
var data = params.data,
property = params.property;
var attrs = renderOpts.attrs;
var props = getFormProps(context, renderOpts);
var props = getFormProps(params, renderOpts);

if (optionGroups) {
var groupOptions = optionGroupProps.options || 'options';
Expand All @@ -642,7 +633,7 @@
_xeUtils["default"].set(data, property, cellValue);
}
},
on: getFormEvents(renderOpts, params, context)
on: getFormEvents(renderOpts, params)
}, _xeUtils["default"].map(optionGroups, function (group, gIndex) {
return h('a-select-opt-group', {
key: gIndex
Expand All @@ -661,7 +652,7 @@
_xeUtils["default"].set(data, property, cellValue);
}
},
on: getFormEvents(renderOpts, params, context)
on: getFormEvents(renderOpts, params)
}, renderOptions(h, options, optionProps))];
},
cellExportMethod: createExportMethod(getSelectCellValue),
Expand Down Expand Up @@ -748,7 +739,8 @@
*/

function handleClearEvent(params, evnt, context) {
var getEventTargetNode = context.getEventTargetNode;
var $table = params.$table;
var getEventTargetNode = $table ? $table.getEventTargetNode : context.getEventTargetNode;
var bodyElem = document.body;

if ( // 下拉框
Expand Down
Loading

0 comments on commit e670beb

Please sign in to comment.