dareway-rui
Version:
129 lines (111 loc) • 5.87 kB
JavaScript
;
var _interopRequireWildcard = require('@babel/runtime/helpers/interopRequireWildcard');
var _interopRequireDefault = require('@babel/runtime/helpers/interopRequireDefault');
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = LovColumnApiFactory;
var _regenerator = _interopRequireDefault(require('@babel/runtime/regenerator'));
var _typeof2 = _interopRequireDefault(require('@babel/runtime/helpers/typeof'));
var sagaEffects = _interopRequireWildcard(require('redux-saga/effects'));
var _isPlainObject = _interopRequireDefault(require('is-plain-object'));
function LovColumnApiFactory(gridNamespace, columnName) {
return {
openLOV:
/*#__PURE__*/
_regenerator.default.mark(function openLOV(title) {
var biz,
vmPath,
width,
height,
params,
_args = arguments;
return _regenerator.default.wrap(function openLOV$(_context) {
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
biz = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
vmPath = _args.length > 2 ? _args[2] : undefined;
width = _args.length > 3 && _args[3] !== undefined ? _args[3] : 1024;
height = _args.length > 4 && _args[4] !== undefined ? _args[4] : 600;
params = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
if ((0, _isPlainObject.default)(params)) {
_context.next = 7;
break;
}
throw new Error(
'\u51FD\u6570\u7B7E\u540D\uFF1ALovColumn.openLOV(title, biz, vmPath, width, height, params)\n\u51FD\u6570\u8C03\u7528\uFF1AopenLov('
.concat(title, ', ')
.concat(biz, ', ')
.concat(vmPath, ', ')
.concat(width, ', ')
.concat(height, ', ')
.concat(
params,
' )\n\u5F02\u5E38\u4FE1\u606F\uFF1A\u53C2\u6570 params\uFF0C\u671F\u671B JSON \u5BF9\u8C61\u7C7B\u578B\uFF08\u4F8B\u5982\uFF1A{xm: "\u5F20\u4E09"}\uFF09\uFF0C\u5B9E\u9645\u4F20\u5165\u503C '
)
.concat(params, '\uFF0C\u7C7B\u578B\u4E3A ')
.concat((0, _typeof2.default)(params), '\n\u8BF7\u68C0\u67E5!')
);
case 7:
_context.next = 9;
return sagaEffects.put({
type: ''.concat(gridNamespace, '/openLOV'),
payload: {
meta: {
columnName: columnName
},
params: {
title: title,
biz: biz,
vmPath: vmPath,
width: width,
height: height,
params: params
}
}
});
case 9:
_context.next = 11;
return _context.sent;
case 11:
return _context.abrupt('return', _context.sent);
case 12:
case 'end':
return _context.stop();
}
}
}, openLOV);
}),
clearMappingValues:
/*#__PURE__*/
_regenerator.default.mark(function clearMappingValues() {
return _regenerator.default.wrap(function clearMappingValues$(_context2) {
while (1) {
switch ((_context2.prev = _context2.next)) {
case 0:
_context2.next = 2;
return sagaEffects.put({
type: ''.concat(gridNamespace, '/clearMappingValues'),
payload: {
meta: {
columnName: columnName
},
params: {}
}
});
case 2:
_context2.next = 4;
return _context2.sent;
case 4:
return _context2.abrupt('return', _context2.sent);
case 5:
case 'end':
return _context2.stop();
}
}
}, clearMappingValues);
})
};
}
//@ sourceMappingURL=LovColumnApiFactory.js.map