Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get actionHolders() {
if (this.mode === InteractionMode.View) {
return this.viewButtons;
}
if (this.mode === InteractionMode.Edit || this.mode === InteractionMode.Transient) {
return this.saveButtons;
}
if (this.mode === InteractionMode.Form) {
// cache because otherwise we will recreate this array of actionHolders everytime page changes !
if (!this.actionButtons) {
const menuItems = this.menuItems()!;
const actions = flatten(map(menuItems, (mi: MenuItemViewModel) => mi.actions!));
this.actionButtons = map(actions, a => wrapAction(a));
}
return this.actionButtons;
}
readonly getTitle = (mode: InteractionMode) => {
const prefix = mode === InteractionMode.Edit || mode === InteractionMode.Transient ? `${Msg.editing} - ` : '';
return `${prefix}${this.title}`;
}
const newState = () => {
this.context.clearObjectCachedValues();
this.urlManager.setInteractionMode(InteractionMode.Edit);
};
if (routeData.interactionMode === InteractionMode.Transient) {
state = CollectionViewState.Summary;
}
function getDefaultTableState(exts: Ro.Extensions) {
if (exts.renderEagerly()) {
return exts.tableViewColumns() || exts.tableViewTitle() ? CollectionViewState.Table : CollectionViewState.List;
}
return CollectionViewState.Summary;
}
if (state == null) {
state = getDefaultTableState(this.collectionRep.extensions());
}
this.editing = routeData.interactionMode === InteractionMode.Edit;
if (resetting || state !== this.currentState) {
const size = this.collectionRep.size();
const itemLinks = this.collectionRep.value();
if (size == null || size > 0) {
this.mayHaveItems = true;
}
this.details = Helpers.getCollectionDetails(size);
const getDetails = itemLinks == null || state === CollectionViewState.Table;
const actions = this.collectionRep.actionMembers();
this.setActions(actions, routeData);
if (state === CollectionViewState.Summary) {
.then((updatedObject: Ro.DomainObjectRepresentation) => {
this.reset(updatedObject, this.currentPaneData(), true);
this.urlManager.pushUrlState(this.onPaneId);
this.urlManager.setInteractionMode(InteractionMode.Edit, this.onPaneId);
})
.catch((reject: ErrorWrapper) => this.handleWrappedError(reject));