mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 20:50:13 +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.calculateShowWidgets();
|
||||
this.showTopWidget = false;
|
||||
this.showBottomWidgets = false;
|
||||
this.showSubpanels = false;
|
||||
|
||||
const isDuplicate = this.params.isDuplicate ?? false;
|
||||
|
|
|
@ -34,7 +34,7 @@ import {RecordViewStore} from '../store/record-view/record-view.store';
|
|||
export class BottomWidgetAdapter {
|
||||
|
||||
config$ = this.metadata.recordViewMetadata$.pipe(
|
||||
combineLatestWith(this.store.widgets$),
|
||||
combineLatestWith(this.store.showBottomWidgets$),
|
||||
map(([metadata, show]: [RecordViewMetadata, boolean]) => {
|
||||
|
||||
if (metadata.bottomWidgets && metadata.bottomWidgets.length) {
|
||||
|
|
|
@ -49,6 +49,7 @@ export interface RecordViewState {
|
|||
loading: boolean;
|
||||
widgets: boolean;
|
||||
showSidebarWidgets: boolean;
|
||||
showBottomWidgets: boolean;
|
||||
showTopWidget: boolean;
|
||||
showSubpanels: boolean;
|
||||
mode: ViewMode;
|
||||
|
|
|
@ -75,6 +75,7 @@ const initialState: RecordViewState = {
|
|||
loading: false,
|
||||
widgets: false,
|
||||
showSidebarWidgets: false,
|
||||
showBottomWidgets: false,
|
||||
showTopWidget: false,
|
||||
showSubpanels: false,
|
||||
mode: 'detail',
|
||||
|
@ -96,6 +97,7 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
|||
loading$: Observable<boolean>;
|
||||
widgets$: Observable<boolean>;
|
||||
showSidebarWidgets$: Observable<boolean>;
|
||||
showBottomWidgets$: Observable<boolean>;
|
||||
showTopWidget$: Observable<boolean>;
|
||||
showSubpanels$: Observable<boolean>;
|
||||
mode$: Observable<ViewMode>;
|
||||
|
@ -161,6 +163,7 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
|||
this.loading$ = this.state$.pipe(map(state => state.loading));
|
||||
this.widgets$ = this.state$.pipe(map(state => state.widgets));
|
||||
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.showSubpanels$ = this.state$.pipe(map(state => state.showSubpanels));
|
||||
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 {
|
||||
return this.internalState.showTopWidget;
|
||||
}
|
||||
|
@ -664,6 +678,8 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
|||
this.showSidebarWidgets = show;
|
||||
}
|
||||
|
||||
this.showBottomWidgets = true;
|
||||
|
||||
this.widgets = show;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue