Skip to content

Commit 7ffcf36

Browse files
committed
Enonic UI: Put FilterPanel under the toolbar #4196
1 parent 319d400 commit 7ffcf36

File tree

2 files changed

+15
-39
lines changed

2 files changed

+15
-39
lines changed

src/main/resources/assets/admin/common/js/app/browse/BrowsePanel.ts

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export class BrowsePanel
3333
protected treeActions: TreeGridActions<ViewItem>;
3434
protected filterPanelToBeShownFullScreen: boolean = false;
3535
protected gridAndItemsSplitPanel: SplitPanel;
36-
private gridAndToolbarPanel: Panel;
3736
private browseItemPanel: BrowseItemPanel;
3837
private filterAndGridSplitPanel: SplitPanel;
3938
private filterPanelForcedShown: boolean = false;
@@ -63,17 +62,18 @@ export class BrowsePanel
6362
this.browseItemPanel = this.createBrowseItemPanel();
6463
}
6564

66-
this.gridAndItemsSplitPanel = new SplitPanelBuilder(this.selectableListBoxPanel, this.createBrowseWithItemsPanel())
67-
.setAlignment(SplitPanelAlignment.VERTICAL)
68-
.setFirstPanelSize(SplitPanelSize.PERCENTS(this.getFirstPanelSize()))
69-
.build();
70-
7165
if (this.filterPanel) {
72-
this.gridAndToolbarPanel = new Panel();
7366
this.filterAndGridSplitPanel = this.setupFilterPanel();
7467
}
7568

69+
this.gridAndItemsSplitPanel =
70+
new SplitPanelBuilder(this.filterAndGridSplitPanel ?? this.selectableListBoxPanel, this.createBrowseWithItemsPanel())
71+
.setAlignment(SplitPanelAlignment.VERTICAL)
72+
.setFirstPanelSize(SplitPanelSize.PERCENTS(this.getFirstPanelSize()))
73+
.build();
74+
7675
this.selectableListBoxPanel.getWrapper().setSkipFirstClickOnFocus(true);
76+
this.hideFilterPanel();
7777
}
7878

7979
protected initListeners() {
@@ -189,36 +189,13 @@ export class BrowsePanel
189189
this.browseToolbar.addClass('browse-toolbar');
190190
this.gridAndItemsSplitPanel.addClass('content-grid-and-browse-split-panel');
191191

192-
if (this.filterPanel) {
193-
this.gridAndToolbarPanel.onAdded(() => {
194-
this.gridAndItemsSplitPanel.setDoOffset(true);
195-
});
196-
197-
if (this.filterPanelIsHiddenByDefault) {
198-
this.hideFilterPanel();
199-
}
200-
this.appendChild(this.filterAndGridSplitPanel);
201-
202-
// Hack: Places the append calls farther in the engine call stack.
203-
// Prevent toolbar and gridPanel not being visible when the width/height
204-
// is requested and elements resize/change position/etc.
192+
this.appendChild(this.browseToolbar);
193+
this.browseToolbar.onRendered(() => {
205194
setTimeout(() => {
206-
this.gridAndToolbarPanel.appendChild(this.browseToolbar);
207-
});
208-
this.browseToolbar.onRendered(() => {
209-
setTimeout(() => {
210-
this.gridAndToolbarPanel.appendChild(this.gridAndItemsSplitPanel);
211-
});
212-
});
213-
} else {
214-
this.appendChild(this.browseToolbar);
215-
// Hack: Same hack.
216-
this.browseToolbar.onRendered(() => {
217-
setTimeout(() => {
218-
this.appendChild(this.gridAndItemsSplitPanel);
219-
});
195+
this.appendChild(this.gridAndItemsSplitPanel);
220196
});
221-
}
197+
});
198+
222199
return rendered;
223200
});
224201
}
@@ -334,9 +311,9 @@ export class BrowsePanel
334311
}
335312

336313
private setupFilterPanel() {
337-
let splitPanel = new SplitPanelBuilder(this.filterPanel, this.gridAndToolbarPanel)
338-
.setFirstPanelMinSize(SplitPanelSize.PIXELS(215))
339-
.setFirstPanelSize(SplitPanelSize.PIXELS(215))
314+
const splitPanel = new SplitPanelBuilder(this.filterPanel, this.selectableListBoxPanel)
315+
.setFirstPanelMinSize(SplitPanelSize.PIXELS(300))
316+
.setFirstPanelSize(SplitPanelSize.PIXELS(300))
340317
.setAlignment(SplitPanelAlignment.VERTICAL)
341318
.setAnimationDelay(100) // filter panel animation time
342319
.build();

src/main/resources/assets/admin/common/styles/api/ui/panel/split-panel.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.split-panel {
22
width: 100%;
3-
right: 0;
43

54
&.horizontal > .panel {
65
position: relative;

0 commit comments

Comments
 (0)