mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-30 02:52:22 +08:00
Fix bottom-widget display/hide logic
This commit is contained in:
parent
66e5463c15
commit
567d034c24
4 changed files with 19 additions and 1 deletions
|
@ -108,6 +108,7 @@ export class CreateViewStore extends RecordViewStore {
|
||||||
this.parseParams(params);
|
this.parseParams(params);
|
||||||
this.calculateShowWidgets();
|
this.calculateShowWidgets();
|
||||||
this.showTopWidget = false;
|
this.showTopWidget = false;
|
||||||
|
this.showBottomWidgets = false;
|
||||||
this.showSubpanels = false;
|
this.showSubpanels = false;
|
||||||
|
|
||||||
const isDuplicate = this.params.isDuplicate ?? false;
|
const isDuplicate = this.params.isDuplicate ?? false;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import {RecordViewStore} from '../store/record-view/record-view.store';
|
||||||
export class BottomWidgetAdapter {
|
export class BottomWidgetAdapter {
|
||||||
|
|
||||||
config$ = this.metadata.recordViewMetadata$.pipe(
|
config$ = this.metadata.recordViewMetadata$.pipe(
|
||||||
combineLatestWith(this.store.widgets$),
|
combineLatestWith(this.store.showBottomWidgets$),
|
||||||
map(([metadata, show]: [RecordViewMetadata, boolean]) => {
|
map(([metadata, show]: [RecordViewMetadata, boolean]) => {
|
||||||
|
|
||||||
if (metadata.bottomWidgets && metadata.bottomWidgets.length) {
|
if (metadata.bottomWidgets && metadata.bottomWidgets.length) {
|
||||||
|
|
|
@ -49,6 +49,7 @@ export interface RecordViewState {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
widgets: boolean;
|
widgets: boolean;
|
||||||
showSidebarWidgets: boolean;
|
showSidebarWidgets: boolean;
|
||||||
|
showBottomWidgets: boolean;
|
||||||
showTopWidget: boolean;
|
showTopWidget: boolean;
|
||||||
showSubpanels: boolean;
|
showSubpanels: boolean;
|
||||||
mode: ViewMode;
|
mode: ViewMode;
|
||||||
|
|
|
@ -75,6 +75,7 @@ const initialState: RecordViewState = {
|
||||||
loading: false,
|
loading: false,
|
||||||
widgets: false,
|
widgets: false,
|
||||||
showSidebarWidgets: false,
|
showSidebarWidgets: false,
|
||||||
|
showBottomWidgets: false,
|
||||||
showTopWidget: false,
|
showTopWidget: false,
|
||||||
showSubpanels: false,
|
showSubpanels: false,
|
||||||
mode: 'detail',
|
mode: 'detail',
|
||||||
|
@ -96,6 +97,7 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
||||||
loading$: Observable<boolean>;
|
loading$: Observable<boolean>;
|
||||||
widgets$: Observable<boolean>;
|
widgets$: Observable<boolean>;
|
||||||
showSidebarWidgets$: Observable<boolean>;
|
showSidebarWidgets$: Observable<boolean>;
|
||||||
|
showBottomWidgets$: Observable<boolean>;
|
||||||
showTopWidget$: Observable<boolean>;
|
showTopWidget$: Observable<boolean>;
|
||||||
showSubpanels$: Observable<boolean>;
|
showSubpanels$: Observable<boolean>;
|
||||||
mode$: Observable<ViewMode>;
|
mode$: Observable<ViewMode>;
|
||||||
|
@ -161,6 +163,7 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
||||||
this.loading$ = this.state$.pipe(map(state => state.loading));
|
this.loading$ = this.state$.pipe(map(state => state.loading));
|
||||||
this.widgets$ = this.state$.pipe(map(state => state.widgets));
|
this.widgets$ = this.state$.pipe(map(state => state.widgets));
|
||||||
this.showSidebarWidgets$ = this.state$.pipe(map(state => state.showSidebarWidgets));
|
this.showSidebarWidgets$ = this.state$.pipe(map(state => state.showSidebarWidgets));
|
||||||
|
this.showBottomWidgets$ = this.state$.pipe(map(state => state.showBottomWidgets));
|
||||||
this.showTopWidget$ = this.state$.pipe(map(state => state.showTopWidget));
|
this.showTopWidget$ = this.state$.pipe(map(state => state.showTopWidget));
|
||||||
this.showSubpanels$ = this.state$.pipe(map(state => state.showSubpanels));
|
this.showSubpanels$ = this.state$.pipe(map(state => state.showSubpanels));
|
||||||
this.mode$ = this.state$.pipe(map(state => state.mode));
|
this.mode$ = this.state$.pipe(map(state => state.mode));
|
||||||
|
@ -214,6 +217,17 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get showBottomWidgets(): boolean {
|
||||||
|
return this.internalState.showBottomWidgets;
|
||||||
|
}
|
||||||
|
|
||||||
|
set showBottomWidgets(show: boolean) {
|
||||||
|
this.updateState({
|
||||||
|
...this.internalState,
|
||||||
|
showBottomWidgets: show
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
get showTopWidget(): boolean {
|
get showTopWidget(): boolean {
|
||||||
return this.internalState.showTopWidget;
|
return this.internalState.showTopWidget;
|
||||||
}
|
}
|
||||||
|
@ -664,6 +678,8 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
||||||
this.showSidebarWidgets = show;
|
this.showSidebarWidgets = show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.showBottomWidgets = true;
|
||||||
|
|
||||||
this.widgets = show;
|
this.widgets = show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue