nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
52 lines • 2.04 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import map from 'lodash/map';
import mapValues from 'lodash/mapValues';
import { Result } from './result';
import * as Models from '../models';
// todo move this
export function getParametersAndCurrentValue(action, context) {
if (action instanceof Models.InvokableActionMember || action instanceof Models.ActionRepresentation) {
var parms = action.parameters();
var cachedValues_1 = context.getDialogCachedValues(action.actionId());
var values = mapValues(parms, function (p) {
var value = cachedValues_1[p.id()];
return value === undefined ? p.default() : value;
});
return values;
}
return {};
}
export function getFields(field) {
if (field instanceof Models.Parameter) {
var action = field.parent;
if (action instanceof Models.InvokableActionMember || action instanceof Models.ActionRepresentation) {
var parms = action.parameters();
return map(parms, function (p) { return p; });
}
}
if (field instanceof Models.PropertyMember) {
// todo
return [];
}
return [];
}
var CommandResult = (function (_super) {
__extends(CommandResult, _super);
function CommandResult() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.changeState = function () { };
return _this;
}
return CommandResult;
}(Result));
export { CommandResult };
//# sourceMappingURL=command-result.js.map