nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
33 lines • 1.77 kB
JavaScript
import { ChoiceViewModel } from './choice-view-model';
import * as Models from '../models';
import * as Helpers from './helpers-view-models';
var LinkViewModel = (function () {
function LinkViewModel(context, colorService, error, urlManager, configService, link, paneId) {
var _this = this;
this.context = context;
this.colorService = colorService;
this.error = error;
this.urlManager = urlManager;
this.configService = configService;
this.link = link;
this.paneId = paneId;
this.draggableTitle = function () { return _this.title; };
this.canDropOn = function (targetType) { return _this.context.isSubTypeOf(_this.domainType, targetType); };
// because may be clicking on menu already open so want to reset focus
this.doClick = function (right) { return _this.urlManager.setMenu(_this.link.rel().parms[0].value, _this.paneId); };
this.title = link.title() + Helpers.dirtyMarker(this.context, this.configService, link.getOid(this.configService.config.keySeparator));
this.domainType = link.type().domainType;
// for dropping
var value = new Models.Value(link);
this.value = value.toString();
this.reference = value.toValueString();
this.selectedChoice = new ChoiceViewModel(value, "");
this.draggableType = this.domainType;
this.colorService.toColorNumberFromHref(link.href()).
then(function (c) { return _this.color = "" + _this.configService.config.linkColor + c; }).
catch(function (reject) { return _this.error.handleError(reject); });
}
return LinkViewModel;
}());
export { LinkViewModel };
//# sourceMappingURL=link-view-model.js.map